fix(hooks): windows use 'rtk hook claude' no fallback#1399
Conversation
Removing old guards, windows can now just use the binary hook engine from 0.37 Related issues: - Fixes #502 : rtk init --global falls back to --claude-md on Windows - Fixes #1353 : Feature request: hook-based mode on Windows - Partially addresses #330 : Add hooks support for Windows - Partially addresses #913 : Persistent "No hook installed" warning on Windows - Partially addresses #1373 : Suppress "No hook installed" warning on Windows - Partially addresses #682 : Config to suppress hook warning - Related to #1248 : Windows PowerShell compatibility gaps Supersedes community PRs: - #1123 fix(init): enable hook installation on Windows - #1027 fix(init): enable hook-based mode on Windows - #809 feat: enable hook-based mode on Windows - #452 feat: add Windows hook support for rtk init --global - #551 feat: native cross-platform hook for Windows support - #150 feat(hook): native cross-platform hook-rewrite command - #1063 Feat/windows hooks
📊 Automated PR Analysis
SummaryRemoves Windows-specific fallback guards that prevented hook-based mode from working on Windows, allowing Windows users to use the binary hook engine (available since v0.37) instead of falling back to --claude-md mode. This deletes two #[cfg(not(unix))] conditional compilation blocks that previously blocked or warned Windows users. Review Checklist
Linked issues: #502, #1353, #330, #913, #1373, #682, #1248 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
pszymkowiak
left a comment
There was a problem hiding this comment.
LGTM. Minimal, well-scoped: removes 25 lines of Unix-only guards that are obsolete since v0.37's native binary hook (rtk hook claude). The underlying path is portable (dirs::home_dir, NamedTempFile::persist, stdin/stdout JSON — no chmod/sh). Supersedes 7 community PRs.
Verified:
- CI green on all 3 targets incl. windows-latest
- Remaining
#[cfg(unix)]blocks (init.rs ~2102/2139/2260/2281) correctly scoped to legacy shell-script detection inrtk init --show cargo test hooks::init57/57 green
Non-blocking follow-ups:
- No automated Windows regression test for the 8 test-plan items — an integration test with
tempdir+HOME/USERPROFILEoverride would cover Tests 1/4/5/6/8 - Gemini CLI install still
#[cfg(unix)]for chmod (init.rs ~2405) — separate issue to align Gemini on the same binary-command model as Claude/Cursor
Recommend tagging vX.Y.Z-rc1 before the definitive release so the matrix + Homebrew/Scoop pipelines are exercised end-to-end before promotion.
|
Added regressions test, merging for next release :) Thanks for reviews |
Removing old guards, windows can now just use the binary hook engine from 0.37
Related issues:
rtk init -gfor automatic token savings" #682 : Config to suppress hook warningSupersedes community PRs:
Summary
init claude with binary hook for Windows support
Test plan
Test 1: rtk init -g: Shows Command: rtk hook claude, no Unix warning
Test 2: rtk init -g --hook-only: Shows RTK hook registered (hook-only mode), no Unix error
Test 3: rtk init --show: No crash, shows [ok] Hook: rtk hook claude
Test 4: rtk init -g --uninstall: RTK.md removed, hook removed from settings.json
Test 5: rtk init -g twice: Second run says hook already present, hook count = 1
Test 6: Upgrade from --claude-md: Shows Migrated, replaces full block with @RTK.md
Test 7: rtk hook claude binary: Returns JSON, no crash
Test 8: rtk init (local): Creates local CLAUDE.md only, no hook installed