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.3",
"version": "1.0.4",
"description": "Opinionated agentic coding workflow that guides software work from exploration and planning through execution and review.",
"author": {
"name": "Moon Pixels"
Expand Down
4 changes: 3 additions & 1 deletion hooks/hooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"hooks": [
{
"type": "command",
"command": "./hooks/run-hook.cmd session-start"
"command": "\"${CODEX_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.3",
"version": "1.0.4",
"main": "./index.mjs",
"exports": "./index.mjs",
"scripts": {
Expand Down
33 changes: 31 additions & 2 deletions tests/codex-hook.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('Codex Propulsion bootstrap guidance', () => {
);
});

test('registers a compact plugin-local session-start hook matcher', async () => {
test('registers a plugin-root session-start hook matcher', async () => {
const config = await readJson('hooks/hooks.json');

expect(config.hooks.SessionStart).toEqual([
Expand All @@ -26,13 +26,42 @@ describe('Codex Propulsion bootstrap guidance', () => {
hooks: [
{
type: 'command',
command: './hooks/run-hook.cmd session-start',
command:
'"${CODEX_PLUGIN_ROOT}/hooks/run-hook.cmd" session-start',
timeout: 10,
statusMessage: 'Loading Propulsion workflow',
},
],
},
]);
});

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',
Comment thread
adamwhp marked this conversation as resolved.
env: {
...process.env,
CODEX_PLUGIN_ROOT: process.cwd(),
},
stdout: 'pipe',
stderr: 'pipe',
});

expect(result.exitCode).toBe(0);

const output = new TextDecoder().decode(result.stdout).trim();
const payload = JSON.parse(output);

expect(payload.hookSpecificOutput).toEqual({
hookEventName: 'SessionStart',
additionalContext: PROPULSION_BOOTSTRAP_GUIDANCE,
});
});

test('prints Codex SessionStart additional context as parseable JSON', async () => {
const result = Bun.spawnSync({
cmd: ['./hooks/run-hook.cmd', 'session-start'],
Expand Down