Files
ECC/schemas/hooks-metadata.schema.json
T
zpearce-2814andGitHub 1ac07903ec fix(hooks): keep hooks.json within Claude Code's schema
Move stable hook metadata to a validated sidecar while preserving hook commands and installer identity. Reject moved fingerprints and duplicate IDs, and validate before updating metadata. Independent local review passed at c315271624a1fd055b992f2bff889ad2a0ff8a6b; CI run 34678210149 passed. Rollback: revert this squash commit.
2026-09-12 02:59:02 -04:00

68 lines
2.1 KiB
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ECC Hooks Metadata",
"description": "Stable ids and human-readable descriptions for the matcher entries in hooks/hooks.json. Kept in a sidecar because Claude Code reports any key outside its own hooks schema as an unknown key when the plugin loads.",
"type": "object",
"required": [
"entries"
],
"properties": {
"$schema": {
"type": "string"
},
"entries": {
"type": "object",
"description": "Event name to an array aligned by index with the same event's entries in hooks.json.",
"propertyNames": {
"enum": [
"SessionStart",
"UserPromptSubmit",
"PreToolUse",
"PermissionRequest",
"PostToolUse",
"PostToolUseFailure",
"Notification",
"SubagentStart",
"Stop",
"SubagentStop",
"PreCompact",
"InstructionsLoaded",
"TeammateIdle",
"TaskCompleted",
"ConfigChange",
"WorktreeCreate",
"WorktreeRemove",
"SessionEnd"
]
},
"additionalProperties": {
"type": "array",
"items": {
"type": "object",
"required": [
"id",
"fingerprint"
],
"properties": {
"id": {
"type": "string",
"pattern": "\\S",
"description": "Stable, globally unique identifier for the matcher entry at this index."
},
"description": {
"type": "string"
},
"fingerprint": {
"type": "string",
"pattern": "^[0-9a-f]{12}$",
"description": "First 12 hex characters of the SHA-256 of the matcher entry (matcher + hooks, keys sorted) at this index in hooks.json. Binds the sidecar entry to a specific matcher so a reorder is detected. Regenerate with `node scripts/ci/validate-hooks.js --update-fingerprints`."
}
},
"additionalProperties": false
}
}
}
},
"additionalProperties": false
}