Skip to content

fix: support Claude Code hook format (matcher/hooks wrapper)#5

Merged
cafitac merged 1 commit intomainfrom
fix/claude-hook-format
Apr 27, 2026
Merged

fix: support Claude Code hook format (matcher/hooks wrapper)#5
cafitac merged 1 commit intomainfrom
fix/claude-hook-format

Conversation

@cafitac
Copy link
Copy Markdown
Owner

@cafitac cafitac commented Apr 27, 2026

Summary

  • upsert_hook() now accepts hook_format="claude" to emit the {"matcher":".*","hooks":[{"type":"command","command":"..."}]} structure that Claude Code requires
  • install_claude_hooks() passes hook_format="claude" so Stop hooks are written correctly
  • is_agent_learner_hook() detects both simple {"command":"..."} and Claude Code {"matcher":...,"hooks":[...]} formats for idempotent upsert

Test plan

  • All 79 existing tests pass
  • install_claude_hooks() writes correct Claude Code format to settings.json
  • Re-running install_claude_hooks() updates existing hook (idempotent)

🤖 Generated with Claude Code

upsert_hook now accepts hook_format="claude" to emit the
{"matcher":".*","hooks":[{"type":"command","command":"..."}]} structure
that Claude Code requires. install_claude_hooks() passes this format.
is_agent_learner_hook() detects both old and new formats for idempotent
upsert.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cafitac cafitac merged commit 091e261 into main Apr 27, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant