feat(config): add suppress_hook_warning option#776
Open
mvanhorn wants to merge 1 commit intortk-ai:developfrom
Open
feat(config): add suppress_hook_warning option#776mvanhorn wants to merge 1 commit intortk-ai:developfrom
mvanhorn wants to merge 1 commit intortk-ai:developfrom
Conversation
Add hooks.suppress_hook_warning config option and RTK_SUPPRESS_HOOK_WARNING env var to disable "No hook installed" and "Hook outdated" warnings. Users running rtk via CLAUDE.md instructions instead of hooks, or with tools like OpenCode, get these warnings on every command. The warnings waste tokens and confuse AI agents since rtk is working correctly. The env var is checked first (useful for CI and tools without config files), then the config file. Both default to false so existing behavior is unchanged. Fixes rtk-ai#682 Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Collaborator
📊 Automated PR Analysis
SummaryAdds a new Review Checklist
Linked issues: #682 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
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
hooks.suppress_hook_warningconfig option inconfig.tomlRTK_SUPPRESS_HOOK_WARNING=1env var as zero-config alternativeWhy this matters
Users running rtk via CLAUDE.md instructions (instead of hooks) or with tools like OpenCode get
[rtk] /!\ No hook installedon every command (#682). The warning wastes tokens and confuses AI agents - @btbxbob reports it printing on everygit add,git commit, andgit status. 5 users across Windows and OpenCode report the same problem.Currently the warning is rate-limited to once per day, but there's no way to suppress it permanently.
Changes
src/config.rs:suppress_hook_warning: boolfield toHooksConfig(defaults tofalse)hook_warning_suppressed()helper that checks the env var first, then config filesrc/hook_check.rs:check_and_warn()now returns early whenhook_warning_suppressed()is trueThe
rtk gaindiagnostic output (src/gain.rs) still shows hook status since that's an explicit diagnostic command.Usage
Config file (
~/.config/rtk/config.toml):Or env var (useful for CI, OpenCode, non-Claude tools):
export RTK_SUPPRESS_HOOK_WARNING=1Test plan
cargo fmt --all --check && cargo clippy --all-targets && cargo test(1074 tests pass)suppress_hook_warningdeserializes correctly from TOMLfalse(existing behavior unchanged)[hooks]section defaults tofalseFixes #682
This contribution was developed with AI assistance (Claude Code).