Skip to content

docs: update native Windows hook troubleshooting - #4350

Merged
KuSh merged 3 commits into
rtk-ai:developfrom
mvanhorn:fix/docs-windows-native-hook-troubleshooting
Oct 3, 2026
Merged

KuSh merged 3 commits into
rtk-ai:developfrom
mvanhorn:fix/docs-windows-native-hook-troubleshooting

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Summary

  • Follow-up to docs: document native-Windows manual settings.json hook (no WSL) #2704, per @KuSh's note there. The "Hook not working (no auto-rewrite)" entry in docs/guide/resources/troubleshooting.md still said native Windows falls back to CLAUDE.md injection and pointed people to WSL. The Windows support section in docs/guide/getting-started/supported-agents.md made the same claim.
  • Since v0.37.2, rtk init -g registers rtk hook claude on Windows too, and docs(windows): document native binary hook support #2791 already updated the README. This rewrites the troubleshooting entry to match: upgrade, re-run rtk init -g to migrate off the legacy rtk-rewrite.sh hook, restart Claude Code, check with rtk init --show. WSL is mentioned as an option, not a requirement. The supported-agents section now says the same, and keeps WSL for integrations that still install a shell wrapper script (such as Gemini).

Test plan

  • Docs only, two files. Checked the wording against run_default_mode and migrate_old_hook_script in src/hooks/init/claude.rs, the Gemini wrapper script in src/hooks/init/gemini.rs, and the Windows section of the README.
  • cargo fmt --all && cargo clippy --all-targets && cargo test (not applicable, no code changes)

Since v0.37.2, rtk init -g installs the native rtk hook claude entry on Windows, so the troubleshooting page no longer needs to describe the CLAUDE.md fallback. Point legacy setups at re-running rtk init -g to migrate off rtk-rewrite.sh.
@rtk-wshm-sync-bot rtk-wshm-sync-bot Bot added the documentation Improvements or additions to documentation label Sep 29, 2026
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

📝 Type docs
🟢 Risk low

Summary

This PR updates documentation to reflect that since v0.37.2, rtk init -g registers a native rtk hook claude command on Windows, eliminating the previous CLAUDE.md-injection fallback. It rewrites the 'Hook not working' troubleshooting entry and the Windows support section to describe upgrading and re-running rtk init -g to migrate off the legacy rtk-rewrite.sh hook, with WSL now framed as optional rather than required.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

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

On native Windows, rtk init -g before v0.37.2 never wrote
rtk-rewrite.sh: it fell back to CLAUDE.md injection. Name that as
the legacy state in the troubleshooting entry, supported-agents and
the README, and keep the rtk-rewrite.sh cleanup as the conditional
case.

The settings.json prompt defaults to N, and the "RTK hook registered"
banner prints whatever the answer, so say to answer y (or pass
--auto-patch outside a terminal) before the command, point at the
line that confirms the patch, and give what rtk init --show reports
once the hook is in place.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@KuSh KuSh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Round 1 of 3 — APPROVED, follow-ups filed

Claim: the Windows troubleshooting entry and the supported-agents Windows section stop describing the pre-v0.37.2 CLAUDE.md fallback and tell legacy setups to re-run rtk init -g, which installs the native rtk hook claude.
Scope: accept (round 1, frozen)
Ran: develop 4f9015f binary against legacy states built with v0.36.0 in an isolated HOME: (A) the old Windows fallback state, init -g --claude-md; (B) a legacy rtk-rewrite.sh hook; (C) a legacy settings entry whose script is gone; (E) a fresh install. Each was then run through rtk init -g (non-interactive, pty answering y, pty answering N, --auto-patch) and rtk init --show. Invariants: every claim in the added lines checked against the code or a transcript; docs only, so no savings figure.
Pins: 0 decisions (docs only), nothing to mutate
Matrix: executed this round; pin check: not applicable (no code)
CI @4e47c314f: all green; @2a8161da9 (fixup): 10/10 green

Blocks merge (0, frozen at round 1)

None.

Filed as follow-ups

  • #3693: comment added with three states from the same migration. (1) rtk init --show reports any legacy rtk-rewrite.sh entry as [ok] Hook: rtk hook claude (native binary command), both before migration and once the script is gone, so the check this page recommends cannot tell the two apart. (2) Declining the prompt on the CLAUDE.md-fallback state removes the instruction block and adds no hook. (3) settings.json.bak ends up holding the in-between file rather than the original. All three are outside the PR's hunks.
  • #4423 rtk init -g leaves a pre-v0.10 CLAUDE.md RTK block in place (v0.9.x wrote no closing marker) and adds @RTK.md next to it. The hook is still added. This is pre-existing and outside the PR's hunks; filed.

Checked and correct — no need to re-verify

  • v0.37.2 is the first tag with 0e29650, which removed the cfg(not(unix)) fallback that printed "Falling back to --claude-md mode".
  • Migration from (B), the legacy-script state: rtk-rewrite.sh and .rtk-hook.sha256 are deleted, and the settings entry is replaced with rtk hook claude (pty answering y). From (A), the 137-line CLAUDE.md block is replaced with @RTK.md and the hook is added.
  • The printed lines RTK hook registered (global). and Command: rtk hook claude match byte for byte.
  • rtk init --show exists and reports the hook after a successful migration.
  • Gemini is the only init integration that still writes a shell wrapper (#!/bin/bash / exec rtk hook gemini). Cursor registers rtk hook cursor, so dropping it from the WSL sentence is correct.
  • No other page (README, translated READMEs, docs/, src/hooks) still claims the Windows fallback.

Next

fixup 2a8161d pushed, code-reviewed, wording only:

  • Legacy state. On native Windows, rtk init -g never wrote rtk-rewrite.sh. v0.10.0 to v0.37.1 had a cfg(not(unix)) fallback that injected CLAUDE.md, and releases before that only wrote CLAUDE.md. The Symptom/Cause lines, the supported-agents sentence and the README upgrade line now name the CLAUDE.md fallback; the script cleanup stays as the "if one exists" case. rtk hook claude itself shipped in v0.37.0; v0.37.2 is when init began registering it on Windows.
  • Prompt. rtk init -g asks before patching settings.json and defaults to N. On a legacy setup N removes the old entry and adds nothing. The banner RTK hook registered (global). prints whatever the answer. The entry now says to answer y, or to use --auto-patch, which patches without that question and also works outside a terminal. It names the line that confirms the patch (settings.json: hook added, or hook already present on a re-run) and gives what rtk init --show reports once the hook is in place. supported-agents.md and the README carry the same caveat, and the troubleshooting entry gives it before the command, not after.

CI is green on it; approving.
Rounds: 1/3. Threads: 0 open.

@KuSh
KuSh merged commit 6f5503d into rtk-ai:develop Oct 3, 2026
10 checks passed
@rtk-release-bot rtk-release-bot Bot mentioned this pull request Oct 3, 2026
@mvanhorn

mvanhorn commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @KuSh, glad the native Windows hook troubleshooting entry matches the support page now instead of pointing people to WSL.

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

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants