fix(hooks): recognize absolute-path rtk hook claude in settings.json#2901
Open
syf2211 wants to merge 1 commit into
Open
fix(hooks): recognize absolute-path rtk hook claude in settings.json#2901syf2211 wants to merge 1 commit into
syf2211 wants to merge 1 commit into
Conversation
Hook detection previously required an exact match on "rtk hook claude", so settings.json entries like "/opt/homebrew/bin/rtk hook claude" were reported as missing even when the hook was active. Fixes rtk-ai#2884
|
|
Author
|
I have read the CLA Document and I hereby sign the CLA |
Author
|
recheck |
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.
Summary
claude_hook_command_matches()so hook detection recognizes absolute-path commands like/opt/homebrew/bin/rtk hook claudehook_check::binary_hook_registeredandinit::hook_already_presentFixes #2884
Motivation
Users on macOS often configure Claude Code hooks with an absolute path to
rtkbecause hook commands run under/bin/shwithout Homebrew on PATH.rtk gainandrtk init -gincorrectly warned "No hook installed" even when the hook was active and tracking commands.Changes
src/hooks/hook_check.rs: new matcher + unit test;binary_hook_registereddelegates to itsrc/hooks/init.rs:hook_already_presentuses the shared matcherTests
cargo fmt --all && cargo clippy --all-targets— passedcargo test hooks::hook_check— passed (14 tests)Notes
Uninstall path (
remove_hook_from_json) still uses exact matching for removal; detection is fixed here. A follow-up could reuse the helper for uninstall symmetry.