原始内容
@davehardy20/pi-quality-gates
Pi quality-gates bundle: post-turn linting, LSP diagnostics, and a PR review gate that blocks unsafe publishing until changes are reviewed.
What it adds
Post-Turn Linter
- Automatically runs lint checks on files modified during each agent turn
- Supports: markdownlint, Biome, Ruff, cppcheck, tflint, cargo clippy, and Go (
gofmt+go vet) - Optional LSP diagnostics integration, including
goplsfor supplementary Go diagnostics - Auto-fix follow-up turns for findings
- Summary-first finding reports that keep parent context bounded by default
- Full redacted linter reports are written to sidecars for manual recovery
- Built-in ignores for generated
agent/plans/*.mdand archived plan files /post-turn-linter-run— Run linter now (optionally pass file paths)/post-turn-linter-fix— Start a fix turn for the latest findings/post-turn-linter-report— Recover the latest sidecar report preview/slice/full/post-turn-linter-status— Show current linter state
PR Gate
- Gates
gh_safepush/pr_createbehind a PASS token: the hook vetoes publishing until the current HEAD has been reviewed /pr-reviewprepares the PR diff, then requests the sandboxed orchestratorpr-reviewercategory to review it; on PASS it stamps a token for that HEAD- An agent-callable
pr_reviewcustom tool requests the same sandboxed review autonomously (over the shared coordinator) without a human running/pr-review - The main agent remains the sole publisher; the gate only vetoes and steers
- The reviewer runs in the configured Apple-container sandbox profile with broad in-container tooling, while publishing and durable state mutation stay denied
- On CRITICAL security findings the gate escalates for a human acknowledgement
/pr-review— Run a PR review for the current HEAD (optional base ref arg)pr_review(LLM tool) — Agent-callable review request; asynchronous kickoff, same coordinator as/pr-review; never publishes/pr-review-status— Show PR review state/pr-gate-status— Show push gate state (enabled, gated actions, tokens)/pr-gate-toggle— Enable or disable the push gate
Workflow
Post-turn (per turn):
Agent modifies files → turn_end fires
→ Post-turn-linter runs (mechanical checks)
→ findings → auto-fix turn → linter re-runs (loop)
→ clean → done
PR gate (per publish):
Agent calls gh_safe push / pr_create
→ tool_call hook vetoes (no PASS token) with a steer
→ agent runs /pr-review OR calls pr_review
→ review runs via sandboxed orchestrator pr-reviewer
→ on PASS, token stamped; agent retries the push; hook allows
→ on ISSUES, agent fixes → lint-clean → re-review
→ on CRITICAL security, escalate for human ack
Install
From a local checkout during development:
pi install /Users/dave/tools/pi-quality-gates
From git:
pi install git:github.com/davehardy20/pi-quality-gates
For one run only:
pi -e /Users/dave/tools/pi-quality-gates
Configuration
Linter
Create .pi/linter.config.json in your project root:
{
"cooldownMs": 15000,
"reportMode": "auto-follow-up",
"runtimeMode": "auto",
"lsp": {
"enabled": false,
"settleMs": 500,
"minSeverity": "warning"
}
}
Reviewer
This bundle previously shipped an auto-triggering post-turn reviewer. It has
been retired in favour of explicit /pr-review and governed Seeds closeout
review requests. /pr-review prepares a PR diff, asks the sandboxed
orchestrator pr-reviewer category to produce the ## Review Report, and
stamps a PASS token before publishing. There is no separate reviewer config
file; PR review uses built-in diff limits and the active orchestrator category
policy.
Notes
/pr-reviewuses the activepr-reviewerorchestrator category; if theorchestratetool is unavailable, the gate fails closed with an explicit status message instead of spawning a host reviewer.- LSP diagnostics are optional and disabled by default. Enable via linter config.
- Go files are validated by default with
gofmt -lfor modified files andgo vet ./...once per nearestgo.modmodule. This does not require LSP. - Clean/status messages distinguish files routed to validators from unsupported files that were skipped.
- Linter sidecar
fullrecovery requires--ack-context-costin parent sessions; in orchestrator/sub-agent sessions, linterruntimeMode: "auto"detectsPI_QUALITY_GATES_SUBAGENT_MODE=1orPI_ORCH_*worker env and allows full redacted recovery without the parent-session acknowledgement. Set linterruntimeModeto"parent"or"sub-agent"to override linter detection. - If commands appear twice, Pi may be loading both this package and old local extension files. Disable or remove old local extensions before testing.
- Both extensions share package-local copies of LSP helpers — they do not reach
back into
~/.pi/agent/extensions/shared/*.
Update flow
- Update the package repo
- Push to GitHub
- Run
pi update --extensionsor reinstall the package - Run
/reload
/reload alone does not fetch newer package commits.
Troubleshooting
- Run
/post-turn-linter-statusto check linter state - Run
/pr-gate-statusto check push gate state - Run
/pr-review-statusto check PR review state - Check
~/.pi/lsp-config.yamlfor LSP server configuration
Build and test
npm run typecheck
npm run test
npm run build