Repository navigation
Conversation
…s them Claude Code rejects a plugin hooks/hooks.json that holds a bare event map: "hooks.json must have `hooks` (the hook matchers) or `modules` (hooks modules), or both". The plugin's SessionStart and PostToolUse hooks were therefore never registered. The plugins reference requires the event map under a top-level "hooks" key, which is the shape this file had before 66ccaef. That commit fixed the missing matchers from tirth8205#283 and also removed the wrapper, which the settings.json error in that issue did not ask for. Tests that read the shipped file now expect the wrapper.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked issue
No open issue. Current Claude Code reports this when it loads the plugin:
What & why
hooks/hooks.jsonholds a bare event map ({"SessionStart": [...], "PostToolUse": [...]}). Claude Code requires a plugin hooks file to put that map under a top-level"hooks"key, so it skips the file and none of the plugin's hooks run.The plugins reference states it directly:
The wrapper was in this file until 66ccaef (#283). The error in #283 came from a
settings.jsonwritten by the installer and listedhooks: Expected array, but received undefinedunder each event, which points to the missingmatcher/hooksentries. 66ccaef fixed those and also removed the wrapper. This PR puts the wrapper back and keeps the matchers.Changes:
hooks/hooks.json: event map moved under"hooks". Matchers, commands, and timeouts are unchanged.tests/test_packaging.pyandtests/test_skills.py: both read the shipped file, so they now expect the wrapper. The packaging test fails if the wrapper is removed again.CHANGELOG.md: entry under Unreleased.How it was tested
Claude Code loading the plugin (Claude Code 2.1.294,
claude --plugin-dir <checkout> -p "reply ok" --debug-file <log>):stagingbefore this PR[ERROR] "Failed to load hooks for crg: ... hooks.json must have \hooks` (the hook matchers) or `modules` (hooks modules), or both"andRegistered 15 hooks from 23 plugins`Registered 18 hooks from 23 pluginsThe difference of 3 is this plugin's SessionStart hook plus its two PostToolUse hooks.
claude plugin validate .passes on both versions, so it does not catch this. Only loading the plugin shows the error.Test suite:
uv run pytest tests/ --tb=short -q # 1 failed, 4267 passed, 850 skipped, 2 xfailed, 2 xpassedThe one failure is
tests/test_embedding_initialization.py::test_windows_server_still_prewarms_before_mcp_run(NameError: name 'windows_events' is not defined). It fails the same way on unmodifiedstagingon macOS and is not related to this change.Checklist
uv run pytest tests/ --tb=short -q(except the Windows test above, which also fails onstaging)code_review_graph/changed