diff --git a/plugin/hooks/hooks.codex.json b/plugin/hooks/hooks.codex.json index 73e43c666b..3ce8463e11 100644 --- a/plugin/hooks/hooks.codex.json +++ b/plugin/hooks/hooks.codex.json @@ -59,6 +59,10 @@ { "type": "command", "command": "node ${CLAUDE_PLUGIN_ROOT}/scripts/stop.mjs" + }, + { + "type": "command", + "command": "node ${CLAUDE_PLUGIN_ROOT}/scripts/session-end.mjs" } ] } diff --git a/test/codex-plugin.test.ts b/test/codex-plugin.test.ts index bb38087643..2b1fb3fa53 100644 --- a/test/codex-plugin.test.ts +++ b/test/codex-plugin.test.ts @@ -91,6 +91,19 @@ describe("Codex plugin manifest (developers.openai.com/codex/plugins)", () => { expect(existsSync(join(pluginRoot, rel)), `missing hook script: ${rel}`).toBe(true); } }); + + it("Stop hook summarizes and ends the session", () => { + type HookHandler = { type: string; command: string }; + type HookEntry = { hooks: HookHandler[] }; + const hooks = readJson<{ hooks: Record }>( + join(pluginRoot, "hooks/hooks.codex.json"), + ); + const stopCommands = hooks.hooks.Stop.flatMap((entry) => + entry.hooks.map((handler) => handler.command), + ); + expect(stopCommands).toContain("node ${CLAUDE_PLUGIN_ROOT}/scripts/stop.mjs"); + expect(stopCommands).toContain("node ${CLAUDE_PLUGIN_ROOT}/scripts/session-end.mjs"); + }); }); describe("Codex marketplace.json (.codex-plugin/marketplace.json at repo root)", () => {