The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
fix: add async/timeout to hooks schema and validate in CI
Affaan Mustafa40a4fafa7f2e
diff --git a/schemas/hooks.schema.json b/schemas/hooks.schema.jsonindex d07d61dd6..ceb2bd9bb 100644--- a/schemas/hooks.schema.json+++ b/schemas/hooks.schema.json@@ -25,6 +25,15 @@}}]+ },+ "async": {+ "type": "boolean",+ "description": "Run hook asynchronously in background without blocking"+ },+ "timeout": {+ "type": "number",+ "minimum": 0,+ "description": "Timeout in seconds for async hooks"}}},diff --git a/scripts/ci/validate-hooks.js b/scripts/ci/validate-hooks.jsindex dc3f6f424..ddc08df1b 100644--- a/scripts/ci/validate-hooks.js+++ b/scripts/ci/validate-hooks.js@@ -24,6 +24,16 @@ function validateHookEntry(hook, label) {hasErrors = true;}+ // Validate optional async and timeout fields+ if ('async' in hook && typeof hook.async !== 'boolean') {+ console.error(`ERROR: ${label} 'async' must be a boolean`);+ hasErrors = true;+ }+ if ('timeout' in hook && (typeof hook.timeout !== 'number' || hook.timeout < 0)) {+ console.error(`ERROR: ${label} 'timeout' must be a non-negative number`);+ hasErrors = true;+ }+if (!hook.command || (typeof hook.command !== 'string' && !Array.isArray(hook.command))) {console.error(`ERROR: ${label} missing or invalid 'command' field`);hasErrors = true;diff --git a/tests/hooks/hooks.test.js b/tests/hooks/hooks.test.jsindex 7da7eb4b0..aebe0d21d 100644--- a/tests/hooks/hooks.test.js+++ b/tests/hooks/hooks.test.js@@ -278,6 +278,7 @@ async function runTests() {assert.ok(hooks.hooks.PreToolUse, 'Should have PreToolUse hooks');assert.ok(hooks.hooks.PostToolUse, 'Should have PostToolUse hooks');assert.ok(hooks.hooks.SessionStart, 'Should have SessionStart hooks');+ assert.ok(hooks.hooks.SessionEnd, 'Should have SessionEnd hooks');assert.ok(hooks.hooks.Stop, 'Should have Stop hooks');assert.ok(hooks.hooks.PreCompact, 'Should have PreCompact hooks');})) passed++; else failed++;