Commit Graph
2 Commits
Author SHA1 Message Date
Defame1297andClaude Opus 5.5 cc1d396d47 fix(rtk): never block a Bash call when rtk itself fails
The hook ran `exec rtk hook claude`, so rtk's exit code became the hook's.
Claude Code treats a PreToolUse exit 2 as "block this tool call", and rtk
(clap) exits 2 on a usage error, e.g. an older rtk without `hook claude`.
On such a machine every Bash call would have been blocked.

The hook now captures rtk's stdout and always exits 0. On any non-zero rtk
exit it prints nothing, so the call proceeds unchanged. On success it prints
rtk's output only when non-empty, with no stray blank line. stdin still
reaches rtk.

Tests cover a stub rtk exiting 2 with stderr, exiting 1, and exiting 0 with
no output, and note that the real-rtk pass-through case depends on rtk
0.42.4's built-in rules.

Refs: #179

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 07:55:22 +00:00
Defame1297andClaude Opus 5.5 c5f09a22d0 test(rtk): cover the rtk routing hook
Stub rtk, rtk absent, the .claude/hooks/ guard, the real rtk when installed, and the hooks.json wiring.

Refs: #179

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-05 22:18:14 +00:00