Repository navigation
fix(plugin): nest hook matchers under hooks so Claude Code loads the plugin - #148
Conversation
…plugin
Claude Code rejects a plugin hooks.json without a top-level hooks key
("Hook load failed: hooks.json must have 'hooks'"), so installing the
plugin from the marketplace checked nothing.
Claude-Session: https://claude.ai/code/session_012bHx97dSM8bVZv8HoNDdNc
There was a problem hiding this comment.
Conductor review (kirocrew-conductor-2) of the merged change 9e44128eb1..9f8896ee80, from review-only session review-comm-148 (/ce-code-review base:9e44128eb1) plus my verdict. This PR merged with gate red, and master has been red since.
P1. The plugin-hooks test still reads the old top-level shape (crates/comment-checker/tests/hook_commands.rs:64).
- Evidence:
cargo test --test hook_commandsat9f8896ee80gives2 passed; 9 failed, nine panics athook_commands.rs:34:9: "hooks/hooks.json must wire exactly one PostToolUse command hook, found []".gate / gateis the only failing job, on the merge commit (run 40276645554) and on master45e50465ef(run 40276667634). Master was green at9e44128eb1. Thechangeset-release/masterrelease PR is failing on the same job. - The hooks.json change is right; the test is wrong.
- Claude Code's plugin components reference specifies
hooks/hooks.jsonas{"hooks": {"PostToolUse": [...]}}, the shape this PR adopted (the command string is byte-identical). - The test's sibling parsers already read the nested shape (
hook_commands.rs:49,:57). Onlyplugin_hook_commandstill reads top-levelhooks["PostToolUse"].
- Claude Code's plugin components reference specifies
- Fix (follow-up PR): change line 64 to
exactly_one(&command_hooks(&hooks["hooks"]["PostToolUse"]), "hooks/hooks.json"), then runcargo test --test hook_commandsand the full gate.
Nothing else: the diff is in scope (the changeset and hooks/hooks.json), clean of skips, secrets and markers, and the literals match hooks/run.ts and the npm package name. Test integrity: no new exports or tests. The failing test is not tautological; it catches exactly the plugin-not-wiring bug this PR fixes.
Residual, awareness only: plugin.json pins 0.3.6, while the changeset bumps the npm package at the next release.
claude plugin listshowed the marketplace plugin as✘ failed to load: "Hook load failed: hooks.json must have 'hooks' (the hook matchers) or 'modules' (hooks modules), or both".hooks/hooks.jsonhadPostToolUseat the top level; Claude Code requires it underhooks. This wraps it, with no other change, plus a patch changeset so the release workflow cuts a tag the workstation can pin the marketplace to.Checked:
claude plugin validate .passes; the hook command, run from this tree against a Write payload with a restating comment, flags it and exits 2.https://claude.ai/code/session_012bHx97dSM8bVZv8HoNDdNc