Draft
Conversation
- Remove redundant hook existence checks and streamline hook command building. - Introduce validation for Windows hook runtime requirements. - Update manual instructions to reflect new command format. - Add tests for Windows-specific hook command formatting and validation.
Claude Code hook script required jq to parse/emit JSON, but jq isn't installed on this Windows machine. The script silently exited with code 0 (passthrough), so hooks never rewired commands. Fix (4 files): 1. hooks/claude/rtk-rewrite.sh — Replaced 99-line bash+jq script with a 15-line thin wrapper that just does exec rtk hook claude-code. Only dependency: rtk on PATH. 2. src/hooks/hook_cmd.rs — Added run_claude_code() function that handles the full Claude Code hook protocol in pure Rust (serde_json, no external deps). Reads stdin JSON, extracts command, rewrites, emits response JSON. 3. src/main.rs — Added ClaudeCode variant to HookCommands enum + routing. 4. src/hooks/init.rs — Removed jq runtime warnings, updated hook validation tests to reflect the new script structure.
|
|
|
#954 Maybe can help too |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Support Windows if bash is available (ie from git-bash)
Test plan
cargo fmt --all && cargo clippy --all-targets && cargo test

Manual testing: rtk git status and Claude Code hook path verified in Windows Git Bash
cargo fmt --all && cargo clippy --all-targets && cargo testrtk <command>output inspected