fix(hook_check): skip hook warning on Windows when --claude-md mode is installed#1083
Open
SrHuevo wants to merge 1 commit intortk-ai:developfrom
Open
fix(hook_check): skip hook warning on Windows when --claude-md mode is installed#1083SrHuevo wants to merge 1 commit intortk-ai:developfrom
SrHuevo wants to merge 1 commit intortk-ai:developfrom
Conversation
…s installed On Windows, `rtk init -g` does not install a PreToolUse hook — it falls back to `--claude-md` mode and writes the RTK instructions block into `~/.claude/CLAUDE.md`. That is the only supported integration on this platform. However, `status()` still reports `Missing` in that configuration, so `maybe_warn()` prints `/!\ No hook installed — run 'rtk init -g' for automatic token savings` every 24h. The advice is impossible to follow: running `rtk init -g` on Windows just re-emits the `--claude-md` fallback, so the user is nagged forever about a hook they can never install. Detect the `--claude-md` integration on Windows by looking for the `<!-- rtk-instructions` marker in `~/.claude/CLAUDE.md`, and return `HookStatus::Ok` in that case. The check is gated on `cfg!(windows)` to stay narrowly scoped and avoid reopening the broader "hook masking" discussion from d85fe33.
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
rtk init -gcannot install a PreToolUse hook — it falls back to--claude-mdmode and writes the RTK instructions block into~/.claude/CLAUDE.md. That's the only valid integration on this platform.status()still returnsMissingin that configuration, somaybe_warn()keeps printing/!\ No hook installed — run `rtk init -g` for automatic token savingsevery 24h.rtk init -gon Windows just re-emits the--claude-mdfallback message (Hook-based mode requires Unix (macOS/Linux). Windows: use --claude-md mode). The user is nagged forever about an integration they can never install.status()to recognize the--claude-mdintegration on Windows by looking for the<!-- rtk-instructionsmarker in~/.claude/CLAUDE.md, and returnHookStatus::Okin that case.cfg!(windows)to stay minimal and avoid reopening the broader "hook masking" discussion from d85fe33 — on macOS/Linux, behavior is unchanged.Reproduction (before this patch, on Windows)
After the patch, once
<!-- rtk-instructionsis present in~/.claude/CLAUDE.md, the warning stops — on Windows only.Test plan
claude_md_mode_installed: marker present, marker absent, file missing.test_status_returns_valid_variantextended with a Windows +--claude-mdbranch assertingHookStatus::Ok.cargo fmt --all && cargo clippy --all-targets && cargo test— I don't have a Rust toolchain on the Windows machine where I reproduced this, so relying on CI for the pre-commit gate.~/.claude/CLAUDE.mdcontaining the RTK block; after this patch it should go silent.