Skip to content

Feat/windows hooks#1063

Draft
kylegrover wants to merge 4 commits intortk-ai:developfrom
kylegrover:feat/windows-hooks
Draft

Feat/windows hooks#1063
kylegrover wants to merge 4 commits intortk-ai:developfrom
kylegrover:feat/windows-hooks

Conversation

@kylegrover
Copy link
Copy Markdown

Summary

Support Windows if bash is available (ie from git-bash)

  • Adds Windows support for Claude Code Bash hook installation in rtk init -g
  • Replaces the old bash/jq hook with a Rust-native rtk hook claude-code handler
  • Keeps hook registration compatible with Windows by wrapping hook invocation in bash ".../rtk-rewrite.sh"

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
rtk git bash screenshot

  • cargo fmt --all && cargo clippy --all-targets && cargo test
  • Manual testing: rtk <command> output inspected
  • test on Windows without git-bash (should show informative failure message)
  • test with other agents on Windows

github-actions bot and others added 4 commits April 6, 2026 23:17
- 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.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 7, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

❌ github-actions[bot]
❌ kylegrover
You have signed the CLA already but the status is still pending? Let us recheck it.

@Warrio111
Copy link
Copy Markdown

#954 Maybe can help too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants