feat(windows): native auto-rewrite hook support + install.ps1#2484
Open
279814 wants to merge 1 commit into
Open
feat(windows): native auto-rewrite hook support + install.ps1#2484279814 wants to merge 1 commit into
279814 wants to merge 1 commit into
Conversation
The Claude Code hook migrated from the `rtk-rewrite.sh` shell script to the native `rtk hook claude` subcommand, which reads PreToolUse JSON from stdin and writes the rewritten command to stdout. It runs identically on every platform, so `rtk init -g` already registers the real auto-rewrite hook on native Windows (no CLAUDE.md fallback) — but the docs still claimed otherwise. - add install.ps1: PowerShell installer mirroring install.sh (resolves the latest release, downloads rtk-x86_64-pc-windows-msvc.zip, installs rtk.exe to %USERPROFILE%\.local\bin, verifies PATH) - README / INSTALL: add Windows quick-install (irm ... | iex) and rewrite the Windows section to describe native auto-rewrite as the default - docs(troubleshooting, supported-agents): replace the outdated "falls back to CLAUDE.md injection" guidance; note Gemini's shell wrapper still needs WSL on Windows
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
Native Windows already runs the auto-rewrite hook today — the Claude Code hook is the platform-agnostic
rtk hook claudesubcommand, andrtk init -gregisters it on Windows with no special-casing. But the docs still tell Windows users that auto-rewrite doesn't work and that they fall back to "CLAUDE.md injection mode". This PR closes that gap and adds a first-class Windows installer.Why the docs are stale
src/hooks/constants.rs:CLAUDE_HOOK_COMMAND = "rtk hook claude"(native Rust, not a shell script).src/hooks/init.rsrun_default_mode()callspatch_settings_json_command(CLAUDE_HOOK_COMMAND, ...)on all platforms — there is nocfg!(windows)branch forcingrun_claude_md_mode.src/hooks/hook_cmd.rsrun_claude()reads stdin JSON / writes stdout JSON and already strips Windows UTF-8 BOMs.So the "requires a Unix shell → falls back to CLAUDE.md" wording predates the migration to the native subcommand.
Changes
install.ps1(new): PowerShell installer that mirrorsinstall.sh— resolves the latest release via the/releases/latestredirect (API fallback), downloadsrtk-x86_64-pc-windows-msvc.zip, installsrtk.exeto%USERPROFILE%\.local\bin, and verifies PATH. Supports$env:RTK_VERSION/$env:RTK_INSTALL_DIR.irm ... | iex) and rewrite the Windows section so native auto-rewrite is the documented default; WSL is presented as optional.#!/bin/bashwrapper and needs WSL on native Windows until it migrates tortk hook gemini.Verification
install.ps1passes[System.Management.Automation.Language.Parser]::ParseFile(no syntax errors).rtk-x86_64-pc-windows-msvc.zip(v0.42.4):rtk init -g→rtk init --showreports[ok] Hook: rtk hook claude, existingsettings.jsonkeys preserved (deep-merge).echo '{"tool_name":"Bash","tool_input":{"command":"git status"}}' | rtk hook claude→updatedInput.command=rtk git status.cargo test→rtk cargo test; unsupported commands (e.g.htop) pass through unchanged.Scope / notes
install.ps1is a thin installer with no Rust logic, consistent with the existing untestedinstall.sh. Happy to add a CI lint (e.g. PSScriptAnalyzer) if maintainers want one.rtk hook geminiregistration so it too works on native Windows.