Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion hooks/hooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "propulsion",
"version": "1.0.4",
"version": "1.0.5",
"main": "./index.mjs",
"exports": "./index.mjs",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion skills/pr/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
52 changes: 35 additions & 17 deletions tests/codex-hook.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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',
},
Expand All @@ -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',
Expand Down