Skip to content

fix(hooks): windows use 'rtk hook claude' no fallback#1399

Merged
aeppling merged 3 commits intodevelopfrom
fix/windows-go-binary-hook
Apr 19, 2026
Merged

fix(hooks): windows use 'rtk hook claude' no fallback#1399
aeppling merged 3 commits intodevelopfrom
fix/windows-go-binary-hook

Conversation

@aeppling
Copy link
Copy Markdown
Contributor

Removing old guards, windows can now just use the binary hook engine from 0.37

Related issues:

Supersedes 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

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
@pszymkowiak pszymkowiak added bug Something isn't working effort-small Quelques heures, 1 fichier enhancement New feature or request labels Apr 19, 2026
@pszymkowiak
Copy link
Copy Markdown
Collaborator

[w] wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟡 Risk medium

Summary

Removes 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

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #502, #1353, #330, #913, #1373, #682, #1248


Analyzed automatically by wshm · This is an automated analysis, not a human review.

Copy link
Copy Markdown
Collaborator

@pszymkowiak pszymkowiak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 in rtk init --show
  • cargo test hooks::init 57/57 green

Non-blocking follow-ups:

  • No automated Windows regression test for the 8 test-plan items — an integration test with tempdir + HOME/USERPROFILE override 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.

@aeppling
Copy link
Copy Markdown
Contributor Author

Added regressions test, merging for next release :)

Thanks for reviews

@aeppling aeppling merged commit da3c432 into develop Apr 19, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working effort-small Quelques heures, 1 fichier enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants