Skip to content

fix(init): match the push gate on command words, not literal text - #216

Merged
tupe12334 merged 1 commit into
mainfrom
fix/sample-command-words
Sep 24, 2026
Merged

tupe12334 merged 1 commit into
mainfrom
fix/sample-command-words

Conversation

@tupe12334

Copy link
Copy Markdown
Member

Summary

The steplock init sample checklist, which is what every new user starts from, and the git-push-quality-gate example matched input.command.contains('git push'). That is a literal substring, so any global option between git and push skips the gate:

  • git -C /path/to/repo push origin main: not gated
  • git -c core.hooksPath=/dev/null push: not gated

I found this while running the global gate live in Claude Code: a git -C <dir> push went straight through. They now match on command_words, the way this repo's own .steplock/checklists/pre-push already does:

match_input = "input.command_words.exists(x, x == 'git') && input.command_words.exists(x, x == 'push')"
  • Updated: the init sample (core/src/bin/main.rs), examples/git-push-quality-gate, Installation.md, examples/README.md, and the first schema example.
  • Unchanged: the unit tests that exercise contains() itself, and the schema's other examples.

Test plan

  • New regression test: the init sample blocks git -C /repo push origin main, git push, and cd x && git push -q, and still approves git status
  • cargo test passes (115 lib, 36 bin, 18 cli, 11 integration); clippy with -D warnings and fmt --check pass
  • steplock validate on examples/git-push-quality-gate: all checklists valid
  • Live in Claude Code, using the same matcher in ~/.config/steplock: git -C <dir> push is now denied at step 1/2

🤖 Generated with Claude Code

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>
@tupe12334
tupe12334 marked this pull request as ready for review September 24, 2026 11:33
@tupe12334
tupe12334 merged commit 95e1a9d into main Sep 24, 2026
13 checks passed
@tupe12334
tupe12334 deleted the fix/sample-command-words branch September 24, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant