feat(hook)!: make staging contextual - #1256
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR makes automatic fixer staging contextual: enabled by default for
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (22): Last reviewed commit: "test(hook): use canonical builtin factor..." | Re-trigger Greptile |
Instruction counts
No instruction-count regression above 1%. Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run. Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.
|
4b219e7 to
b311007
Compare
|
Stack continuation: #1257 removes the deprecated v1 configuration interfaces and adds the v1-to-v2 migration guide. AI-assisted — Tool: Codex; model: unavailable/unavailable; version: unavailable. |
b311007 to
be7ba3b
Compare
be7ba3b to
7ac5585
Compare
7ac5585 to
059eb78
Compare
059eb78 to
7759421
Compare
7759421 to
74eaa5e
Compare
74eaa5e to
74eb71b
Compare
74eb71b to
345e97b
Compare
a75d3fa to
4eb3ea8
Compare
231b757 to
41bfc1c
Compare
41bfc1c to
cffa439
Compare
dcecf66 to
e31f558
Compare
e31f558 to
0a12c65
Compare
0a12c65 to
a593b59
Compare
d19f5b4 to
de86ffb
Compare
de86ffb to
179abde
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 179abde. Configure here.
4b37510 to
52672e2
Compare

Summary
pre-commithk fixand every other hook unstaged unless explicitly enabledstagepatterns filters rather than hidden staging switchesfail_on_fixas a forced no-staging modeStack
Testing
cargo test --no-default-features(287 passed)mise run test:bats test/stage_setting.batsmise run test:bats test/stage_default.batscargo fmtgit diff --checkAI-assisted — Tool: Codex; model: unavailable/unavailable; version: unavailable.
Note
Medium Risk
Changes default Git index behavior for
hk fixand non–pre-commit hooks—a breaking v2 behavior shift that can surprise workflows relying on implicit staging, though overrides remain available.Overview
Breaking change: auto-staging after fix commands is no longer universal. Only
pre-committurns staging on by default;hk fix, the implicitfixhook, and every other hook leave the index alone unless you opt in.Hook-level
should_stagenow defaults withunwrap_or_else(|| self.name == "pre-commit")instead of always defaulting totrue. Precedence is unchanged: CLI--stage/--no-stage, then globalstage(HK_STAGE, git, config), then the hook’sstage, then that contextual default.fail_on_fixstill forces no staging.Step-level
stageglobs are filters only—they narrow which paths getgit addwhen staging is enabled; they no longer imply staging on hooks where it’s off. When staging is on and no step patterns are set, hk still stages the files the step actually processed (not merely the stepglob).Docs (
hooks.md,Config.pkl,settings.toml, env docs) and bats tests are updated; tests that expectedhk fixto stage now pass--stagewhere staging is the assertion.Reviewed by Cursor Bugbot for commit 52672e2. Bugbot is set up for automated code reviews on this repo. Configure here.