Repository navigation
Conversation
When running `rtk init -g`, the hook check would fire before init had a chance to install the hook, printing a confusing "No hook installed - run rtk init -g" message. Replace that with an "Installing RTK hook" message for Init, matching how Gain already skips the check.
|
Thanks @andeart — #1011 is a real bug (verified, still present on I built and tested the branch. The fix works:
The minimal fix is just to extend the skip condition, no extra message: if !matches!(cli.command, Commands::Gain { .. } | Commands::Init { .. }) {
hooks::hook_check::maybe_warn();
}
|
|
Thanks for the suggestion, @pszymkowiak . This is cleaner and more direct. I just updated the code if you could take another look when you have a moment please. |
|
Tested against a compiled build of the current head (052c283). Small PR, one real gap. The exemption at // Warn if installed hook is outdated/missing (1/day, non-blocking).
// Skip for Gain (own inline hook warning) and Init (about to install/update hooks itself).
if !matches!(cli.command, Commands::Gain { .. } | Commands::Init { .. }) {
hooks::hook_check::maybe_warn();
}But Repro with a compiled build ( # baseline — warns correctly
rtk git status
# [rtk] /!\ No hook installed — run `rtk init -g` for automatic token savings
# init for an unrelated agent — no warning, even though it never touches the Claude hook
rtk init --agent hermes
# (no warning printed)
# confirms the Claude hook is still missing right after
rtk git log
# [rtk] /!\ No hook installed — run `rtk init -g` for automatic token savingsLow severity — it's a single missed notification per day (the rate-limit marker is only written when the warning actually fires, so the next non-Init command still warns normally), not a correctness/security issue. But it doesn't match the stated rationale for non-Claude agent targets. Might be worth narrowing the skip to |
Summary
This fixes #1011.
maybe_warn()hook check when the command isInit, since it's about to install/update hooks itselfrtk init(no replacement message,initalready announces its own actions)Gainalready skips the checkTest plan
rtk init -g --uninstallandrm ~/Library/Application\ Support/rtk/.hook_warn_last, then rebuild the binary.cargo fmt --all && cargo clippy --all-targets && cargo test. All pass.rtk init -gno longer prints the misleading "No hook installed" warning.rtk init --uninstalland--showstay clean too.