mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-23 00:21:14 +01:00
When Claude Code calls /verify on its own right before `git commit`, gstack now runs one quick check-only command that ends in a single `VERIFY PASS`, `VERIFY FAIL` or `VERIFY skipped: ` line; typing /verify still runs the full skill. Why: since Claude Code 2.1.286 any skill named `verify` is run before every commit, so gstack's fix loop, its first-run notices and a hard stop in repos with no remote landed on ordinary commits. Nothing to do; `gstack-config set verify_before_commit off` turns the check off. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/specialist-batched#1 reader=specialist-batched Review-Finding: p1/specialist-batched#2 reader=specialist-batched
111 lines
4.2 KiB
Cheetah
111 lines
4.2 KiB
Cheetah
---
|
|
name: verify
|
|
preamble-tier: 1
|
|
version: 0.1.0
|
|
description: |
|
|
Use when coding: run the checks and tests /ship picks until green.
|
|
Build loop: run the repo's checks and the tests /ship would pick, fix, repeat.
|
|
Never green when no test covers a change. Fits "verify", "check my work", "run
|
|
the checks", "make it green", or after each change before /ship. (gstack)
|
|
triggers:
|
|
- verify my change
|
|
- run the checks
|
|
- make the tests pass
|
|
- make it green
|
|
- is it green
|
|
- check my work before ship
|
|
allowed-tools:
|
|
- Bash
|
|
- Read
|
|
- Edit
|
|
- Grep
|
|
- Glob
|
|
- AskUserQuestion
|
|
---
|
|
|
|
## Right before a commit: the quick pass
|
|
|
|
Use only this section when you started /verify yourself because you are about
|
|
to run `git commit` (Claude Code asks for /verify before every commit), and the
|
|
user has not typed /verify or asked you to verify or run the checks in this
|
|
conversation. The arguments `quick` or `pre-commit` mean the same. When the
|
|
user typed /verify, skip this section and run the full skill below.
|
|
|
|
Skip the preamble and everything after this section: edit nothing, add no
|
|
tests, ask nothing. Run one command with a Bash timeout of 10 minutes:
|
|
|
|
```bash
|
|
"{{RUNTIME_ROOT}}/bin/gstack-checks" quick
|
|
```
|
|
|
|
It ends with one line. `VERIFY PASS: …` or `VERIFY skipped: <reason>`: go on
|
|
with the commit, and mention /verify only by quoting that line. `VERIFY FAIL:
|
|
…` (exit 1): don't commit over it; quote the line and the failing output to
|
|
the user and ask whether to fix it first or commit anyway.
|
|
|
|
{{PREAMBLE}}
|
|
|
|
# /verify — build, check, fix, repeat
|
|
|
|
Use this while building, before /ship. It runs checks and fixes code. It never
|
|
reviews, bumps a version, pushes, or opens a PR: that is /ship. A changelog entry
|
|
the repo expects with a change is part of the change.
|
|
|
|
## 1. See what will run
|
|
|
|
Each Bash call is a fresh shell, so every block sets `C` again.
|
|
|
|
```bash
|
|
C="{{RUNTIME_ROOT}}/bin/gstack-checks"; "$C" detect
|
|
```
|
|
|
|
`detect` reads files only. It lists each check with its source, the pregate
|
|
test selection, and `TRUST trusted|untrusted`. `CHECKS: none` means the repo declares no check,
|
|
pregate policy or test file: there is nothing to run, so say so and stop. Never invent a
|
|
command the repo does not declare.
|
|
|
|
When `untrusted`: in an interactive session, show the user the listed commands
|
|
and ask before `"$C" trust`. In a session launched to run repo commands, pass
|
|
`--allow-repo-commands` to `run` instead. Never trust without one of the two.
|
|
|
|
## 2. Loop: run, fix, run
|
|
|
|
```bash
|
|
C="{{RUNTIME_ROOT}}/bin/gstack-checks"; "$C" run
|
|
```
|
|
|
|
One line per check: `CHECK <name> <VERDICT> <secs>`, at most 40 failing lines
|
|
and a log path. Exit 0 is green; only `PASS` is green.
|
|
|
|
- `FAIL`: fix the code under test. A changed source file breaking an untouched
|
|
test is your bug, not a pre-existing one. Call a red "possibly pre-existing"
|
|
only if it was already red on your first `run` this session, before any edit.
|
|
- `UNMAPPED`: no test covers a touched file. Add a test that does, or map it in
|
|
`.gstack/pregate.json`. `ZERO_RUN`: the selected tests ran nothing; fix the
|
|
selector or the test file. `TOO_BROAD`: the change selects over 300 test
|
|
files; leave them to /ship's pregate and say so.
|
|
- `ENV` or `TIMEOUT` (exit 2): a missing tool, service, secret or network.
|
|
Report it with the log line; do not fix the environment or work around it.
|
|
A `FAIL` whose own error says a service, secret or env var is missing is
|
|
the same: report it, do not stub or skip it.
|
|
- Rerun one check with `"$C" run --only <name>` while fixing it, then a full
|
|
`run` after your last edit, before you stop.
|
|
|
|
Never weaken, skip, delete or edit a test, a checker config or a package.json
|
|
script to get green.
|
|
|
|
Stop after 5 runs, when the same failure comes back twice after a fix, or on an
|
|
`ENV`/`TIMEOUT`. Report what is still red and why. Before another fix to a stubborn
|
|
red in your own change, reproduce it in one focused test and trace its root cause.
|
|
|
|
## 3. Hand off
|
|
|
|
```bash
|
|
C="{{RUNTIME_ROOT}}/bin/gstack-checks"; "$C" status
|
|
```
|
|
|
|
`status` reruns nothing. Only `READY_FOR_SHIP tree=<tree> ... not_covered=<lanes>`
|
|
(exit 0) means green at this exact tree. Print that line, name any
|
|
`not_covered` lanes (platform tests /ship's pregate owns), and stop with
|
|
"ready for /ship". `NOT_READY` means run again; never claim green from it.
|