feat(rules): add 5 anti-foot-shoot block rules (Tier 1)#17
Conversation
Adds a new rule family - Anti foot-shoot (Tier 1) - covering the high-cost
mistakes the team has already paid for. Each rule maps 1:1 to a feedback
memory whose intent is "never do this", and ships a bypass marker for
the rare cases where the action is intentional.
The 5 new rules:
| Rule | Action | Tool | Memory |
|---|---|---|---|
| block-playwright-headless | block | Bash | feedback_no_headless.md |
| block-git-force-push-no-lease | block | Bash | feedback_resolve_merge_conflicts.md |
| block-git-rebase-skip | block | Bash | feedback_resolve_merge_conflicts.md |
| block-standup-not-in-escritorio | block | Edit/Write/MultiEdit | feedback_standup_desktop.md |
| block-goodnight-not-in-escritorio | block | Edit/Write/MultiEdit | feedback_goodnight_desktop.md |
Coverage notes:
- block-playwright-headless: matches `playwright test` (npx, pnpm, yarn,
bare) and requires --headed / --ui / --debug on the same line.
- block-git-force-push-no-lease: positive match on `-f` or `--force` plus
defense-in-depth negative match on `--force-with-lease` for
pathological orderings like `git push -f --force-with-lease`.
- block-git-rebase-skip: matches `git rebase --skip` exactly; --continue
and --abort are unaffected.
- block-{standup,goodnight}-not-in-escritorio: pattern + not_pattern on
the same file_path field. Both `~/Escritorio` (Spanish locale) and
`~/Desktop` (English / aliasing) are accepted.
Tests: 99 -> 128 passing (+29 new). Each rule covers positive matches,
negative matches, and bypass behavior.
Version bump: 1.8.0 -> 1.9.0 in package.json, plugin.json, and
marketplace.json (top-level + nested plugin entry).
|
@greptile review |
Greptile SummaryThis PR adds five
Confidence Score: 5/5All five new block rules are well-scoped, have comprehensive tests covering positive matches, negative matches, and bypass-marker behavior, and raise no correctness concerns. Safe to merge. Every concern raised in the prior review round — bypass marker reachability for Edit/MultiEdit, the missing defense-in-depth test for No files require special attention.
|
| Filename | Overview |
|---|---|
| hooks/rules/rules.yaml | Five new block rules added: playwright headless, git force-push, git rebase --skip, standup/goodnight desktop placement. All previous review concerns addressed — bypass marker reachability for Edit/MultiEdit now has explicit tests, defense-in-depth test added, pnpm/yarn dlx cases covered. |
| hooks/rules/rules.json | Regenerated artifact from rules.yaml via npm run build-rules; structurally mirrors the YAML additions with no discrepancies found. |
| hooks/rules/README.md | Documentation updated to list the new "Anti foot-shoot (Tier 1)" family with accurate descriptions of all five rules. |
| .claude-plugin/marketplace.json | Both top-level and nested plugin version bumped from 1.8.0 to 1.9.0 consistently. |
| package.json | Version bumped from 1.8.0 to 1.9.0, consistent with all other manifests. |
| openspec/changes/2026-05-hooks-tier-1-foot-shoot-prevention/design.md | Design document accurately describes the regex logic for all five rules; no discrepancies with the actual implementation. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Tool Call Intercepted] --> B{Check applies_to}
B -->|Bash| C1[block-playwright-headless]
B -->|Bash| C2[block-git-force-push-no-lease]
B -->|Bash| C3[block-git-rebase-skip]
B -->|Edit / Write / MultiEdit| C4[block-standup-not-in-escritorio]
B -->|Edit / Write / MultiEdit| C5[block-goodnight-not-in-escritorio]
C1 --> D1{command matches playwright test?}
D1 -->|No| PASS1[Allow]
D1 -->|Yes| E1{--headed / --ui / --debug present?}
E1 -->|Yes| PASS1
E1 -->|No| BLOCK1[Block exit 2]
C2 --> D2{git push -f / --force?}
D2 -->|No| PASS2[Allow]
D2 -->|Yes| E2{--force-with-lease present?}
E2 -->|Yes| PASS2
E2 -->|No| BLOCK2[Block exit 2]
C3 --> D3{git rebase --skip?}
D3 -->|No| PASS3[Allow]
D3 -->|Yes| BLOCK3[Block exit 2]
C4 --> D4{file_path matches daily-standup*.md?}
D4 -->|No| PASS4[Allow]
D4 -->|Yes| E4{under /Escritorio/ or /Desktop/?}
E4 -->|Yes| PASS4
E4 -->|No| BLOCK4[Block exit 2]
C5 --> D5{file_path matches next-day-* / goodnight-*?}
D5 -->|No| PASS5[Allow]
D5 -->|Yes| E5{under /Escritorio/ or /Desktop/?}
E5 -->|Yes| PASS5
E5 -->|No| BLOCK5[Block exit 2]
Reviews (2): Last reviewed commit: "fix(rules): close 3 Greptile findings on..." | Re-trigger Greptile
1. **Edit/MultiEdit bypass reachability documented and tested** (block-standup-not-in-escritorio + block-goodnight-not-in-escritorio). The dispatcher's bypass scan already runs against the full raw tool_input JSON via `parse-input.sh INPUT_RAW`, so a marker in any string-valued field (`new_string`, `old_string`, `edits[].new_string`) short-circuits the rule. Add explicit `allows-bypass-marker-edit-tool` and `allows-bypass-marker-multiedit-tool` tests for both rules and a clarifying comment so a future maintainer doesn't reintroduce the reachability concern. Renames `allows-bypass-marker` -> `allows-bypass-marker-write-tool` to keep the tool-shape symmetry. 2. **Combined --force + --force-with-lease defense-in-depth tested** (block-git-force-push-no-lease). Add `allows-force-with-lease-and-force-combined` with the exact pathological-ordering command the design doc calls out, locking in the not_pattern safety net against future regex refactors. 3. **pnpm dlx / yarn dlx playwright invocations tested** (block-playwright-headless). Add `blocks-pnpm-dlx-playwright-headless`, `blocks-yarn-dlx-playwright-headless`, and `allows-pnpm-dlx-playwright-headed`. The pattern already covers these forms; the tests pin that behavior. Tests: 128 -> 136 passing (+8).
|
Round 2: addressed all 3 Greptile findings. See commit b0d1d9c.
Tests: 128 -> 136 passing. @greptile review |
Summary
Adds a new Anti foot-shoot (Tier 1) rule family — five
blockrulescovering the high-cost mistakes the team has already paid for. Each rule
maps 1:1 to a feedback memory whose intent is "never do this", not "be
careful".
The 5 new rules
block-playwright-headlessBashfeedback_no_headless.mdblock-git-force-push-no-leaseBashfeedback_resolve_merge_conflicts.mdblock-git-rebase-skipBashfeedback_resolve_merge_conflicts.mdblock-standup-not-in-escritorioEdit/Write/MultiEditfeedback_standup_desktop.mdblock-goodnight-not-in-escritorioEdit/Write/MultiEditfeedback_goodnight_desktop.mdEach rule ships a kebab-case
bypass_markerfor the rare intentionalcase (e.g. an explicit CI run for the playwright rule, an acknowledged
data-loss for the rebase-skip rule, etc.).
Coverage notes
block-playwright-headless — matches
playwright testafternpx,pnpm,yarn, or bare. Requires--headed/--ui/--debugonthe same line, otherwise blocks. `\b` boundaries on
playwrightexclude unrelated tools like
playwright-extra-cli.block-git-force-push-no-lease — positive match on
-for--force(with proper word boundaries that already exclude--force-with-lease), plus a defense-in-depthnot_patternon--force-with-leaseto abort the fire even in pathological orderingslike `git push -f --force-with-lease`.
block-git-rebase-skip — exact match on
git rebase --skip;--continueand--abortare unaffected.block-{standup,goodnight}-not-in-escritorio —
patternmatchesthe filename and
not_patternexcludes~/Escritorio(Spanishlocale) and
~/Desktop(English / aliasing) on the samefile_pathcondition.
Test count
```
Before: 99 / 99 passed (19 rules)
After: 128 / 128 passed (24 rules, +29 new tests)
```
Each rule covers positive matches across realistic invocations,
negative matches that should NOT fire, and bypass-marker behavior.
Version bump
`1.8.0 -> 1.9.0`
Per semver, adding new enforcement rules is a feature add -> minor bump.
Bumped in:
Test plan
Notes for reviewers
feedback memories vs. existing rules. The first (feat(rules): add warn-curl-mutating-supabase-rest (close feedback_scripts_not_db.md) #16) added the
curl-supabase-rest warn rule; this PR adds the 5 hard-stop rules; the
next will add 6 discipline warns.
command,file_path) and existingmatcher semantics — no schema or dispatcher changes.
`-fu`, `-force` (single dash), and similar mistypes do NOT
accidentally fire.
OpenSpec: `openspec/changes/2026-05-hooks-tier-1-foot-shoot-prevention/`
(proposal, design, tasks).
Created by Claude Code on behalf of @lapc506
Claude Code