Skip to content

fix: detect absolute rtk path in Claude hook settings#2885

Open
TaKO8Ki wants to merge 2 commits into
rtk-ai:developfrom
TaKO8Ki:fix/claude-hook-absolute-rtk-path
Open

fix: detect absolute rtk path in Claude hook settings#2885
TaKO8Ki wants to merge 2 commits into
rtk-ai:developfrom
TaKO8Ki:fix/claude-hook-absolute-rtk-path

Conversation

@TaKO8Ki

@TaKO8Ki TaKO8Ki commented Jul 8, 2026

Copy link
Copy Markdown

Fixes #2884

Summary

  • recognize Claude hook commands where rtk is configured with an absolute path

Test plan

  • I prepared the following settings.json and confirmed that this implementation works as expected in my local environment.
{
  "hooks": {
      "PreToolUse": [{
        "matcher": "Bash",
        "hooks": [{
          "type": "command",
          "command": "/opt/homebrew/bin/rtk hook claude",
          "timeout": 5
        }]
      }]
   }
}
  • cargo fmt --all && cargo clippy --all-targets && cargo test
  • Manual testing: rtk <command> output inspected

Important: All PRs must target the develop branch (not master).
See CONTRIBUTING.md for details.

@CLAassistant

CLAassistant commented Jul 8, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@aeppling

aeppling commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Hey @TaKO8Ki

Thanks for addressing this issue
A few observations:

src/hooks/init.rs (remove_hook_from_json) still uses exact match

if command.contains(REWRITE_HOOK_FILE) || command == CLAUDE_HOOK_COMMAND 

should use your is_claude_hook_command

Your coding in constant.rs this file was dedicated to pure constant, just a nit but to keep it clean it may belong to a more proper file

I tested code locally it correctly fix the issue

@TaKO8Ki

TaKO8Ki commented Jul 8, 2026

Copy link
Copy Markdown
Author

@aeppling Hi. Thank you for the review. I have fixed remove_hook_from_json and moved is_claude_hook_command from constant.rs into mod.rs. Please let me know if it's better to create a new module.

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.

[BUG] Hook detection reports 'No hook installed' when settings.json uses an absolute path to rtk

3 participants