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 de9de7c226 feat(rtk): add rtk plugin that routes Bash calls through rtk
A Claude Code PreToolUse hook on Bash execs `rtk hook claude` when rtk is on PATH and passes its answer through unchanged; without rtk it exits 0 silently. It acts only from .claude/hooks/, like git's push guard.

Refs: #179

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