diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json index 166b797..d78cda5 100644 --- a/.codex-plugin/plugin.json +++ b/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "propulsion", - "version": "1.0.4", + "version": "1.0.5", "description": "Opinionated agentic coding workflow that guides software work from exploration and planning through execution and review.", "author": { "name": "Moon Pixels" diff --git a/hooks/hooks.json b/hooks/hooks.json index ef959fa..499e20f 100644 --- a/hooks/hooks.json +++ b/hooks/hooks.json @@ -6,7 +6,7 @@ "hooks": [ { "type": "command", - "command": "\"${CODEX_PLUGIN_ROOT}/hooks/run-hook.cmd\" session-start", + "command": "\"${CODEX_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-}}/hooks/run-hook.cmd\" session-start", "timeout": 10, "statusMessage": "Loading Propulsion workflow" } diff --git a/package.json b/package.json index 06e1d4c..50a5a29 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "propulsion", - "version": "1.0.4", + "version": "1.0.5", "main": "./index.mjs", "exports": "./index.mjs", "scripts": { diff --git a/skills/pr/SKILL.md b/skills/pr/SKILL.md index 4d6141a..fa173ab 100644 --- a/skills/pr/SKILL.md +++ b/skills/pr/SKILL.md @@ -11,7 +11,7 @@ Create or reuse one GitHub pull request from the current branch and report the v ALL prerequisites MUST be true before following this skill. -- GitHub CLI `gh` is installed and authenticated for the target repository. +- GitHub CLI `gh` is installed and authenticated for the target repository (may need to run outside sandbox). - The current directory is a git repository with an `origin` remote. ## Instructions diff --git a/tests/codex-hook.test.js b/tests/codex-hook.test.js index ca70fab..a2cbad0 100644 --- a/tests/codex-hook.test.js +++ b/tests/codex-hook.test.js @@ -10,6 +10,27 @@ async function readJson(path) { return JSON.parse(await readFile(path, 'utf8')); } +async function runConfiguredHook(env) { + const config = await readJson('hooks/hooks.json'); + const command = config.hooks.SessionStart[0].hooks[0].command; + + const result = Bun.spawnSync({ + cmd: ['sh', '-c', command], + cwd: '/private/tmp', + env: { + ...process.env, + ...env, + }, + stdout: 'pipe', + stderr: 'pipe', + }); + + expect(result.exitCode).toBe(0); + + const output = new TextDecoder().decode(result.stdout).trim(); + return JSON.parse(output); +} + describe('Codex Propulsion bootstrap guidance', () => { test('uses the shared Propulsion bootstrap contract', () => { expect(getPropulsionBootstrapGuidance()).toBe( @@ -27,7 +48,7 @@ describe('Codex Propulsion bootstrap guidance', () => { { type: 'command', command: - '"${CODEX_PLUGIN_ROOT}/hooks/run-hook.cmd" session-start', + '"${CODEX_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-}}/hooks/run-hook.cmd" session-start', timeout: 10, statusMessage: 'Loading Propulsion workflow', }, @@ -36,25 +57,22 @@ describe('Codex Propulsion bootstrap guidance', () => { ]); }); - test('runs configured hook command from outside the plugin cwd', async () => { - const config = await readJson('hooks/hooks.json'); - const command = config.hooks.SessionStart[0].hooks[0].command; - - const result = Bun.spawnSync({ - cmd: ['sh', '-c', command], - cwd: '/private/tmp', - env: { - ...process.env, - CODEX_PLUGIN_ROOT: process.cwd(), - }, - stdout: 'pipe', - stderr: 'pipe', + test('runs configured hook command with CODEX_PLUGIN_ROOT', async () => { + const payload = await runConfiguredHook({ + CODEX_PLUGIN_ROOT: process.cwd(), }); - expect(result.exitCode).toBe(0); + expect(payload.hookSpecificOutput).toEqual({ + hookEventName: 'SessionStart', + additionalContext: PROPULSION_BOOTSTRAP_GUIDANCE, + }); + }); - const output = new TextDecoder().decode(result.stdout).trim(); - const payload = JSON.parse(output); + test('runs configured hook command with CLAUDE_PLUGIN_ROOT fallback', async () => { + const payload = await runConfiguredHook({ + CODEX_PLUGIN_ROOT: '', + CLAUDE_PLUGIN_ROOT: process.cwd(), + }); expect(payload.hookSpecificOutput).toEqual({ hookEventName: 'SessionStart',