Fix Codex hook manifest schema

This commit is contained in:
Paul Bakaus
2026-06-30 23:56:06 -07:00
parent c979ac37c3
commit 1a3f5d78bd
7 changed files with 8 additions and 13 deletions
@@ -75,7 +75,6 @@ const HOOK_MANIFEST_TARGETS = [
skillRel: '.agents/skills/impeccable',
destRel: '.codex/hooks.json',
manifest: () => ({
description: 'Impeccable design detector: runs after Edit/Write/apply_patch on UI files and surfaces findings as system reminders.',
hooks: {
PostToolUse: [
{
@@ -83,7 +82,7 @@ const HOOK_MANIFEST_TARGETS = [
hooks: [
{
type: 'command',
command: 'node "$(git rev-parse --show-toplevel)/.agents/skills/impeccable/scripts/hook.mjs"',
command: 'node ".agents/skills/impeccable/scripts/hook.mjs"',
timeout: TIMEOUT_SECONDS,
statusMessage: STATUS_MESSAGE,
},
+1 -2
View File
@@ -1,5 +1,4 @@
{
"description": "Impeccable design detector: runs after Edit/Write/apply_patch on UI files and surfaces findings as system reminders.",
"hooks": {
"PostToolUse": [
{
@@ -7,7 +6,7 @@
"hooks": [
{
"type": "command",
"command": "node \"$(git rev-parse --show-toplevel)/.agents/skills/impeccable/scripts/hook.mjs\"",
"command": "node \".agents/skills/impeccable/scripts/hook.mjs\"",
"timeout": 5,
"statusMessage": "Checking UI changes"
}
@@ -75,7 +75,6 @@ const HOOK_MANIFEST_TARGETS = [
skillRel: '.agents/skills/impeccable',
destRel: '.codex/hooks.json',
manifest: () => ({
description: 'Impeccable design detector: runs after Edit/Write/apply_patch on UI files and surfaces findings as system reminders.',
hooks: {
PostToolUse: [
{
@@ -83,7 +82,7 @@ const HOOK_MANIFEST_TARGETS = [
hooks: [
{
type: 'command',
command: 'node "$(git rev-parse --show-toplevel)/.agents/skills/impeccable/scripts/hook.mjs"',
command: 'node ".agents/skills/impeccable/scripts/hook.mjs"',
timeout: TIMEOUT_SECONDS,
statusMessage: STATUS_MESSAGE,
},
+1 -2
View File
@@ -22,7 +22,7 @@ const TIMEOUT_SECONDS = 5;
const STATUS_MESSAGE = 'Checking UI changes';
const CLAUDE_PROJECT_HOOK = '${CLAUDE_PROJECT_DIR}/.claude/skills/impeccable/scripts/hook.mjs';
const CLAUDE_PLUGIN_HOOK = '${CLAUDE_PLUGIN_ROOT}/skills/impeccable/scripts/hook.mjs';
const CODEX_PROJECT_HOOK = '$(git rev-parse --show-toplevel)/.agents/skills/impeccable/scripts/hook.mjs';
const CODEX_PROJECT_HOOK = '.agents/skills/impeccable/scripts/hook.mjs';
const CURSOR_BEFORE_EDIT_SCRIPT = '.cursor/skills/impeccable/scripts/hook-before-edit.mjs';
const GITHUB_PROJECT_HOOK = '$(git rev-parse --show-toplevel)/.github/skills/impeccable/scripts/hook.mjs';
@@ -74,7 +74,6 @@ export function buildClaudePluginHooksManifest() {
export function buildCodexHooksManifest() {
return {
description: 'Impeccable design detector: runs after Edit/Write/apply_patch on UI files and surfaces findings as system reminders.',
hooks: {
PostToolUse: [
{
+1 -2
View File
@@ -75,7 +75,6 @@ const HOOK_MANIFEST_TARGETS = [
skillRel: '.agents/skills/impeccable',
destRel: '.codex/hooks.json',
manifest: () => ({
description: 'Impeccable design detector: runs after Edit/Write/apply_patch on UI files and surfaces findings as system reminders.',
hooks: {
PostToolUse: [
{
@@ -83,7 +82,7 @@ const HOOK_MANIFEST_TARGETS = [
hooks: [
{
type: 'command',
command: 'node "$(git rev-parse --show-toplevel)/.agents/skills/impeccable/scripts/hook.mjs"',
command: 'node ".agents/skills/impeccable/scripts/hook.mjs"',
timeout: TIMEOUT_SECONDS,
statusMessage: STATUS_MESSAGE,
},
+2 -1
View File
@@ -49,6 +49,7 @@ describe('hook manifest builders', () => {
it('builds Codex project-local hooks for the real detector hook', () => {
const manifest = buildCodexHooksManifest();
assert.equal(manifest.description, undefined);
const group = manifest.hooks.PostToolUse[0];
const handler = group.hooks[0];
@@ -57,7 +58,7 @@ describe('hook manifest builders', () => {
assert.equal(handler.timeout, 5);
assert.equal(handler.statusMessage, 'Checking UI changes');
expectCommand(handler.command, '.agents/skills/impeccable/scripts/hook.mjs');
assert.ok(handler.command.includes('git rev-parse --show-toplevel'));
assert.ok(!handler.command.includes('git rev-parse --show-toplevel'));
assert.ok(!handler.command.includes('${PLUGIN_ROOT}'));
assert.equal(manifest.hooks.SessionStart, undefined);
});
+1 -2
View File
@@ -99,8 +99,7 @@ function createFakeUniversalBundle(root, providers = ['.claude', '.agents', '.cu
if (providers.includes('.agents')) {
mkdirSync(join(bundleRoot, '.codex'), { recursive: true });
writeFileSync(join(bundleRoot, '.codex', 'hooks.json'), JSON.stringify({
description: 'fresh codex hook',
hooks: { PostToolUse: [{ matcher: 'apply_patch', hooks: [{ type: 'command', command: 'node "$(git rev-parse --show-toplevel)/.agents/skills/impeccable/scripts/hook.mjs"' }] }] },
hooks: { PostToolUse: [{ matcher: 'apply_patch', hooks: [{ type: 'command', command: 'node ".agents/skills/impeccable/scripts/hook.mjs"' }] }] },
}, null, 2));
}
return bundleRoot;