Skip to content

fix(hook): use absolute claude hook command#2577

Open
YOMXXX wants to merge 2 commits into
rtk-ai:developfrom
YOMXXX:fix/issue-2361-absolute-claude-hook
Open

fix(hook): use absolute claude hook command#2577
YOMXXX wants to merge 2 commits into
rtk-ai:developfrom
YOMXXX:fix/issue-2361-absolute-claude-hook

Conversation

@YOMXXX

@YOMXXX YOMXXX commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • register Claude hooks with the current RTK executable absolute path instead of bare rtk hook claude
  • recognize absolute native Claude hook commands during idempotency checks and uninstall
  • add regression coverage for install, hook-only install, detection, and removal

Fixes #2361

Verification

  • cargo +1.93.0 fmt --check
  • git diff --check
  • cargo +1.93.0 test absolute -- --nocapture
  • cargo +1.93.0 test hooks::init -- --nocapture
  • cargo +1.93.0 clippy --all-targets
  • cargo +1.93.0 test --all -- --skip small_grep_not_worse_than_plain
  • CLI smoke with temporary CLAUDE_CONFIG_DIR: rtk init -g --hook-only --auto-patch writes /.../target/debug/rtk hook claude

@YOMXXX

YOMXXX commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up pushed in 15c3f9c to address the Windows CI failures. Root cause was host-platform path parsing: Unix-style absolute hook commands were not considered absolute on Windows. The hook detection now recognizes Unix, Windows drive, and UNC path styles portably, with a Windows-style regression test.\n\nVerification run locally:\n- RED: cargo +1.93.0 test test_hook_already_present_windows_absolute_native_command -- --nocapture failed before the fix\n- cargo +1.93.0 test test_hook_already_present_windows_absolute_native_command -- --nocapture\n- cargo +1.93.0 test test_hook_already_present_absolute_native_command -- --nocapture\n- cargo +1.93.0 test test_remove_hook_from_json_absolute_native_command -- --nocapture\n- cargo +1.93.0 test hooks::init::tests -- --nocapture\n- cargo +1.93.0 fmt --check\n- git diff --check\n- cargo +1.93.0 clippy --all-targets\n- cargo +1.93.0 test --all -- --skip small_grep_not_worse_than_plain

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.

Claude hook doesn't validate rtk binary before use, so a malicious script earlier in $PATH can be executed

1 participant