diff --git a/.changeset/plugin-hooks-wrapper.md b/.changeset/plugin-hooks-wrapper.md new file mode 100644 index 00000000..492bfe05 --- /dev/null +++ b/.changeset/plugin-hooks-wrapper.md @@ -0,0 +1,5 @@ +--- +"@systemfsoftware/claude-code-comment-checker": patch +--- + +The Claude Code plugin loads again: `hooks/hooks.json` now nests its matchers under `hooks`, the shape Claude Code requires. Before, `claude plugin list` reported "Hook load failed: hooks.json must have 'hooks'" and the plugin checked nothing. diff --git a/hooks/hooks.json b/hooks/hooks.json index cc871e18..b7ca71ac 100644 --- a/hooks/hooks.json +++ b/hooks/hooks.json @@ -1,14 +1,16 @@ { - "PostToolUse": [ - { - "matcher": "Write|Edit|MultiEdit", - "hooks": [ - { - "type": "command", - "command": "if ! command -v deno >/dev/null 2>&1; then\n cat >/dev/null\n echo \"comment-checker did not run — nothing checked this write.\" >&2\n exit 1\nfi\nenv $(env | awk -F= '$1 ~ /^(LD_|DYLD_)/ { printf \"-u %s \", $1 }') deno run --config \"${CLAUDE_PLUGIN_ROOT}/hooks/deno.jsonc\" --allow-read --allow-run=comment-checker,direnv --allow-env=CLAUDE_PROJECT_DIR,PATH,HOME \"${CLAUDE_PLUGIN_ROOT}/hooks/run.ts\"\nrc=$?\ncase \"$rc\" in 0|2) exit \"$rc\" ;; esac\ncat >/dev/null\n[ \"$rc\" -eq 3 ] || echo \"comment-checker did not run — nothing checked this write.\" >&2\nexit 1", - "timeout": 30 - } - ] - } - ] -} \ No newline at end of file + "hooks": { + "PostToolUse": [ + { + "matcher": "Write|Edit|MultiEdit", + "hooks": [ + { + "type": "command", + "command": "if ! command -v deno >/dev/null 2>&1; then\n cat >/dev/null\n echo \"comment-checker did not run — nothing checked this write.\" >&2\n exit 1\nfi\nenv $(env | awk -F= '$1 ~ /^(LD_|DYLD_)/ { printf \"-u %s \", $1 }') deno run --config \"${CLAUDE_PLUGIN_ROOT}/hooks/deno.jsonc\" --allow-read --allow-run=comment-checker,direnv --allow-env=CLAUDE_PROJECT_DIR,PATH,HOME \"${CLAUDE_PLUGIN_ROOT}/hooks/run.ts\"\nrc=$?\ncase \"$rc\" in 0|2) exit \"$rc\" ;; esac\ncat >/dev/null\n[ \"$rc\" -eq 3 ] || echo \"comment-checker did not run — nothing checked this write.\" >&2\nexit 1", + "timeout": 30 + } + ] + } + ] + } +}