Repository navigation
Conversation
`hook_check::status()` only ever inspected Claude Code. The presence of a
`~/.claude` directory means Claude Code has been run on the machine, not
that it is the agent in use — so a user whose agent is Codex, Gemini,
Cursor, Droid, Hermes or Vibe got
[rtk] /!\ No hook installed — run `rtk init -g` for automatic token savings
on every `rtk gain`, forever, with a remedy aimed at an agent they do not
use. Their working integration was invisible to the check.
A helper for exactly this already existed — `other_integration_installed`
— but only inside `#[cfg(test)]`, so production never called it and its
green tests proved nothing about the warning users actually see. This
promotes it out of the test module, has `status()` consult it before
reporting `Missing`, and extends it to the integrations added since it
was written: Factory Droid's `hooks.json` and Mistral Vibe's `hooks.toml`
were both invisible.
Detection keys on RTK's own installed artifacts, never on an agent's
config directory existing, so a machine with Codex installed but RTK not
wired into it still gets the warning it should. A new test walks the
artifact list itself, so an integration added later that forgets to
register here fails in CI rather than in a user's terminal.
Measured on a machine with the Gemini hook installed and no Claude hook:
released 0.48.0 prints the warning, this build prints nothing.
|
|
📊 Automated PR Analysis
SummaryFixes rtk gain incorrectly warning 'No hook installed' for users on non-Claude agents (Codex, Gemini, Cursor, Droid, Hermes, Vibe) whose hooks are actually installed. Promotes the previously test-only other_integration_installed helper to production use in hook_check::status(), and adds detection for Factory Droid and Mistral Vibe integrations that were missing from the artifact list. Review Checklist
Analyzed automatically by wshm · This is an automated analysis, not a human review. |
|
Thanks for working on this. Closing as a duplicate of #4343, which fixes the same false 'No hook installed' warning (#913) on the current develop layout. It reads each tool's registered hook entry rather than checking whether a file exists, so it also catches current Cursor hooks.json installs, Antigravity, Trae and Pi, and its CI is green. Review or comments are welcome on #4343, and if your change covers a case it misses, please reply here. |
Summary
hook_check::status()only inspects Claude Code, sortk gaintells anyone on Codex, Gemini, Cursor, Droid, Hermes or Vibe that no hook is installed — forever — while their integration is working fine.other_integration_installedalready existed for exactly this, but only under#[cfg(test)]. Production never called it.status()consult it before reportingMissing, and adds the integrations that appeared after it was written.The bug, as a user sees it
The hook is installed — just not for Claude Code.
status()resolves~/.claude, finds no RTK hook there, and reportsMissing. But a~/.claudedirectory only means Claude Code has been run on this machine at some point; it says nothing about which agent the user actually works in. The suggested remedy (rtk init -g) targets an agent they may not use, so following it does not clear the warning either.Measured on a machine with the Gemini hook installed and no Claude hook:
Why the tests did not catch it
other_integration_installedsat inside the#[cfg(test)]module with four green tests behind it. Those tests only ever proved that a helper nothing calls behaves correctly. Moving it into production is most of this diff.While moving it I checked the list against the integrations RTK actually ships today: Factory Droid (
~/.factory/hooks.json) and Mistral Vibe (~/.vibe/hooks.toml) were missing, so their users were in exactly the same position. Codex'shooks.jsonis listed alongside itsAGENTS.md.Design notes
Detection keys on RTK's own artifacts, not on agents being present. A machine with Codex installed but RTK not wired into it should still get the warning — that user genuinely has no hook.
test_other_integration_ignores_unrelated_filespins this: dropping~/.codex/config.toml,~/.cursor/mcp.jsonand~/.gemini/settings.jsoninto a home directory does not count as an integration.A new test walks the artifact list itself (
test_other_integration_detects_every_listed_artifact), so an integration added later that forgets to register here fails in CI rather than in a user's terminal — which is how this drifted in the first place.any_other_integration_installedreturnsOption<bool>so an unresolvable home directory stays distinguishable from a resolved one with nothing in it. The caller treats "don't know" as "keep the existing behaviour" rather than silently suppressing the warning.AGENTS_MDmoved from a private const ininit.rstopub(super)sohook_checkcan share it instead of re-declaring the literal.Scope
Only the false warning. Not touched, found while working here and happy to send separately:
HookCommands::Checkdiscards its--agentargument insrc/main.rs, sortk hook check --agent anythingreturns the generic rewrite regardless of the agent named.Test plan
cargo fmt --all && cargo clippy --all-targets -- -D warnings && cargo test— clean; 3398 tests passrtk gainon a machine with a Gemini hook and no Claude hook — released binary warns, this build does not