fix: correct hooks schema and prevent clobbering existing hooks on install#257
Open
rahuldodwe wants to merge 1 commit intotirth8205:mainfrom
Open
fix: correct hooks schema and prevent clobbering existing hooks on install#257rahuldodwe wants to merge 1 commit intotirth8205:mainfrom
rahuldodwe wants to merge 1 commit intotirth8205:mainfrom
Conversation
…stall
- hooks/hooks.json: add missing matcher field to SessionStart entry,
replace undefined \${CLAUDE_PLUGIN_ROOT} variable with the actual
code-review-graph status command, and align commands/timeouts with
what generate_hooks_config() writes (--skip-flows, timeout values)
- skills.py: deep-merge the hooks key instead of shallow-replacing it
so pre-existing hooks from other tools are preserved on reinstall
- tests/test_skills.py: assert that OtherHook survives the merge;
the previous test passed silently while the clobber went undetected
- docs/TROUBLESHOOTING.md: point users at .claude/settings.json
instead of the stale hooks/hooks.json reference
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.
What this fixes
1. hooks/hooks.json — malformed and stale static template
2. skills.py — shallow merge clobbers existing hooks
existing.update(hooks_config) replaced the entire hooks key on reinstall,
wiping any hooks from other tools already in .claude/settings.json.
Fixed with a deep merge: existing.setdefault("hooks", {}).update(hooks_config["hooks"])
3. tests/test_skills.py — merge test had a gap
test_merges_with_existing never asserted that OtherHook survived the merge,
so the clobber went undetected. Assertion added.
4. docs/TROUBLESHOOTING.md — stale reference
Pointed users at hooks/hooks.json as authoritative, but the installed config
comes from generate_hooks_config() in skills.py. Updated to point at
.claude/settings.json with the correct fix command.