Files
Holocron/plugins/rtk/.apm/hooks/route-through-rtk.sh
T
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

17 lines
533 B
Bash
Executable File

#!/usr/bin/env bash
# PreToolUse hook: route a Bash tool call through `rtk hook claude`, which may
# rewrite the command to its rtk-prefixed form. rtk's output is passed through
# unchanged. Without rtk on PATH it does nothing. Limits: the rtk plugin's README.
set -euo pipefail
# apm could deploy this file to other runtimes, where it must do nothing.
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/"
case "$here" in
*/.claude/hooks/*) ;;
*) exit 0 ;;
esac
command -v rtk > /dev/null 2>&1 || exit 0
exec rtk hook claude