fix: correct hooks.json structure per Claude Code documentation #344

Merged
lmiranda merged 1 commits from fix/hooks-json-structure into development 2026-01-31 19:28:27 +00:00
Owner

Summary

Three plugins had incorrect hooks.json structure that caused hooks to fail silently:

  • pr-review: SessionStart used nested hooks array without matcher
  • cmdb-assistant: SessionStart used nested hooks array without matcher
  • git-flow: Used completely wrong format (array with event field)

Root Cause

Per Claude Code documentation, the correct structure depends on whether a matcher is used:

Without matcher (direct in event array):

"SessionStart": [{ "type": "command", "command": "..." }]

With matcher (nested hooks array):

"PreToolUse": [{ "matcher": "Bash", "hooks": [{ "type": "command", "command": "..." }] }]

Changes

Plugin Before After
pr-review Nested array without matcher Direct type/command
cmdb-assistant Nested array without matcher (SessionStart only) Direct type/command
git-flow Array with event field Proper object structure with matcher

Test Plan

  • ./scripts/verify-hooks.sh passes
  • Installed marketplace copies updated
  • Restart Claude Code session to verify hooks load correctly

🤖 Generated with Claude Code

## Summary Three plugins had incorrect hooks.json structure that caused hooks to fail silently: - **pr-review**: SessionStart used nested `hooks` array without matcher - **cmdb-assistant**: SessionStart used nested `hooks` array without matcher - **git-flow**: Used completely wrong format (array with `event` field) ## Root Cause Per Claude Code documentation, the correct structure depends on whether a matcher is used: **Without matcher** (direct in event array): ```json "SessionStart": [{ "type": "command", "command": "..." }] ``` **With matcher** (nested hooks array): ```json "PreToolUse": [{ "matcher": "Bash", "hooks": [{ "type": "command", "command": "..." }] }] ``` ## Changes | Plugin | Before | After | |--------|--------|-------| | pr-review | Nested array without matcher | Direct type/command | | cmdb-assistant | Nested array without matcher (SessionStart only) | Direct type/command | | git-flow | Array with `event` field | Proper object structure with matcher | ## Test Plan - [x] `./scripts/verify-hooks.sh` passes - [x] Installed marketplace copies updated - [ ] Restart Claude Code session to verify hooks load correctly 🤖 Generated with [Claude Code](https://claude.ai/code)
lmiranda added 1 commit 2026-01-31 19:27:46 +00:00
Three plugins had incorrect hooks.json structure that caused hooks to fail:

- pr-review: SessionStart used nested `hooks` array without matcher
- cmdb-assistant: SessionStart used nested `hooks` array without matcher
- git-flow: Used completely wrong format (array with `event` field)

Per Claude Code documentation:
- Without matcher: direct `type`/`command` in the event array
- With matcher: nested `hooks` array inside matcher object

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
lmiranda merged commit b6b09c1754 into development 2026-01-31 19:28:27 +00:00
lmiranda deleted branch fix/hooks-json-structure 2026-01-31 19:28:27 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: personal-projects/leo-claude-mktplace#344