diff --git a/scripts/tokenwar-statusline.sh b/scripts/tokenwar-statusline.sh index 45c8e9f..481a235 100755 --- a/scripts/tokenwar-statusline.sh +++ b/scripts/tokenwar-statusline.sh @@ -219,7 +219,11 @@ if command -v "$RTK_BIN" >/dev/null 2>&1; then const cfg = JSON.parse(readFileSync(path, "utf8")); const pre = (cfg.hooks && cfg.hooks.PreToolUse) || []; return pre.some(h => (h.matcher||"") === "Bash" - && (h.hooks||[]).some(x => (x.command||"").includes("rtk hook"))); + && (h.hooks||[]).some(x => { + const command = x.command || ""; + return command.includes("rtk hook") + || command.includes("rtk-rewrite.sh"); + })); } catch { return false; } }; const wired = wiredIn(process.env.SETTINGS) || wiredIn(process.env.SETTINGS_LOCAL); diff --git a/tests/statusline.bats b/tests/statusline.bats index dfa52cd..489fc89 100644 --- a/tests/statusline.bats +++ b/tests/statusline.bats @@ -110,6 +110,18 @@ EOF [[ "$output" == *"${GREEN}[caveman 84cc3c1]"* ]] } +@test "rtk rewrite script hook → rtk green" { + write_settings <<'EOF' +{"hooks":{"PreToolUse":[{"matcher":"Bash","hooks":[{"command":"/another/users/home/.claude/hooks/rtk-rewrite.sh"}]}]}} +EOF + mock_claude_with_plugins '[]' + mock_rtk_alive + + run bash "$SCRIPT" <<<'{}' + [ "$status" -eq 0 ] + [[ "$output" == *"${GREEN}[rtk 44.7M]"* ]] +} + @test "pxpipe installed → pxpipe badge green" { write_settings <<'EOF' {}