fix(init): match the push gate on command words, not literal text - #216
Merged
Merged
Conversation
The `steplock init` sample and the git-push-quality-gate example used
`input.command.contains('git push')`, so `git -C <dir> push` (any global
option between `git` and `push`) skipped the gate. Found while running
the gate live in Claude Code. Match on `command_words` instead, the way
the repo's own pre-push checklist does.
- Sample, example checklist, Installation.md, examples/README.md and
the schema example updated.
- Regression test: the sample blocks `git -C /repo push`, `git push`
and `cd x && git push -q`, and still approves `git status`.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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
The
steplock initsample checklist, which is what every new user starts from, and thegit-push-quality-gateexample matchedinput.command.contains('git push'). That is a literal substring, so any global option betweengitandpushskips the gate:git -C /path/to/repo push origin main: not gatedgit -c core.hooksPath=/dev/null push: not gatedI found this while running the global gate live in Claude Code: a
git -C <dir> pushwent straight through. They now match oncommand_words, the way this repo's own.steplock/checklists/pre-pushalready does:initsample (core/src/bin/main.rs),examples/git-push-quality-gate, Installation.md, examples/README.md, and the first schema example.contains()itself, and the schema's other examples.Test plan
initsample blocksgit -C /repo push origin main,git push, andcd x && git push -q, and still approvesgit statuscargo testpasses (115 lib, 36 bin, 18 cli, 11 integration); clippy with-D warningsandfmt --checkpasssteplock validateonexamples/git-push-quality-gate: all checklists valid~/.config/steplock:git -C <dir> pushis now denied at step 1/2🤖 Generated with Claude Code