fix(rtk): bridge ~/.cargo/bin/rtk into ~/.local/bin — compression was PATH-dead on develop

Ports e58037c from release/1.0.0 (never back-merged). develop installed rtk via
cargo (~/.cargo/bin) and checked 'command -v rtk' in the installer shell that
sourced cargo env — so the check passed while Claude's tool shell never got the
PATH, dropping every compound rewrite (measured on release audit: 6/5070 commands
compressed over 30 days, ~460K tokens missed). Idempotent bridge symlink, self-
repairs a stale link, skips when no cargo binary. Resolves BLK-016 on develop. Review A3.
This commit is contained in:
Bastien Chanot
2026-07-08 15:58:00 +02:00
parent 38cc821a35
commit 416b68f7d2
+13
View File
@@ -431,6 +431,19 @@ else
cargo install --git https://github.com/rtk-ai/rtk cargo install --git https://github.com/rtk-ai/rtk
fi fi
fi fi
# PATH bridge: cargo installs to ~/.cargo/bin, which hand-managed shell
# profiles routinely lose (LRN-036 class). This installer sources cargo env
# so `command -v rtk` passes HERE — but Claude's tool shell never gets that
# PATH: the rewrite hook then drops every COMPOUND rewrite (it can only
# absolute-path the string head) and compression silently dies (measured:
# 6/5070 commands compressed over 30 days). ~/.local/bin is on the standard
# PATH — bridge with a symlink. Idempotent; -x on a broken link is false,
# so a stale link self-repairs.
if [ -x "$HOME/.cargo/bin/rtk" ] && [ ! -x "$HOME/.local/bin/rtk" ]; then
mkdir -p "$HOME/.local/bin"
ln -sf "$HOME/.cargo/bin/rtk" "$HOME/.local/bin/rtk"
ok "rtk bridged into ~/.local/bin (cargo bin dir is not on the tool-shell PATH)"
fi
# Only init if not already configured (avoids overwriting custom RTK config) # Only init if not already configured (avoids overwriting custom RTK config)
if ! grep -q "rtk" "$HOME/.claude/settings.json" 2>/dev/null; then if ! grep -q "rtk" "$HOME/.claude/settings.json" 2>/dev/null; then
info "Configuring RTK PreToolUse hook (global)..." info "Configuring RTK PreToolUse hook (global)..."