fix: augment PATH in hook to fix silent failure on Homebrew installs (#685)#1117
Open
ousamabenyounes wants to merge 1 commit intortk-ai:developfrom
Open
fix: augment PATH in hook to fix silent failure on Homebrew installs (#685)#1117ousamabenyounes wants to merge 1 commit intortk-ai:developfrom
ousamabenyounes wants to merge 1 commit intortk-ai:developfrom
Conversation
609f280 to
0cbf237
Compare
…tk-ai#685) Claude Code runs hooks with a restricted PATH that excludes Homebrew (/opt/homebrew/bin) and cargo (~/.cargo/bin) directories. `command -v rtk` silently failed, causing the hook to exit early without rewriting any commands. Add `export PATH="$HOME/.cargo/bin:/opt/homebrew/bin:/usr/local/bin:$PATH"` at the top of the hook script (before the rtk guard) and bump hook version to 4 so existing installations are upgraded on the next `rtk init -g`. Generated by Claude Code Vibe coded by ousamabenyounes Co-Authored-By: Claude <noreply@anthropic.com>
0cbf237 to
aaf0c7b
Compare
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
Fixes #685
PATHthat excludes Homebrew (/opt/homebrew/binon Apple Silicon,/usr/local/binon Intel) and cargo (~/.cargo/bin) directoriescommand -v rtksilently returns non-zero, causing the hook to print a warning and exit — no commands are rewritten, token savings are lost silentlyexport PATH="$HOME/.cargo/bin:/opt/homebrew/bin:/usr/local/bin:$PATH"at the top of the hook, before thecommand -v rtkguardrtk init -gVerification
test_hook_augments_path_before_rtk_check— asserts PATH export exists and precedes the rtk guard, and that/opt/homebrew/binand.cargo/binare coveredFiles changed
hooks/claude/rtk-rewrite.shsrc/hooks/hook_check.rsCURRENT_HOOK_VERSIONconstant to 4src/hooks/init.rstest_hook_augments_path_before_rtk_checktestGenerated by Claude Code
Vibe coded by ousamabenyounes
Vibe Coded by Ousama Ben Younes
Developed With Ora Studio (Claude Code)