@unifan/pi-review-zh 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +540 -0
- package/LICENSE +15 -0
- package/README.md +55 -0
- package/agents/bugbot.md +46 -0
- package/agents/claude-md-compliance.md +46 -0
- package/agents/code-comments.md +43 -0
- package/agents/conventions.md +41 -0
- package/agents/gate.md +70 -0
- package/agents/history-context.md +45 -0
- package/agents/lite-review.md +51 -0
- package/agents/security-review.md +45 -0
- package/index.ts +205 -0
- package/package.json +38 -0
- package/reference/README.md +20 -0
- package/reference/claude-code-review.md +133 -0
- package/reference/cursor-review-skills.md +72 -0
- package/reference/pi-review-roadmap.md +183 -0
- package/reference/structured-output.md +26 -0
- package/reference/v0.2-plan.md +268 -0
- package/src/cli-args.ts +105 -0
- package/src/config.ts +340 -0
- package/src/directive.ts +481 -0
- package/src/gate-enforce.ts +151 -0
- package/src/lean-agents.ts +105 -0
- package/src/pr-ref.ts +39 -0
- package/src/report-tool.ts +394 -0
- package/src/report.ts +399 -0
- package/src/review-report.ts +279 -0
- package/src/review-run.ts +568 -0
- package/src/target-workspace.ts +239 -0
- package/src/tool-wrapper.ts +75 -0
- package/src/tui-renderer.ts +92 -0
- package/src/types.ts +207 -0
- package/src/workflow-schemas.ts +172 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [0.8.3] - 2026-08-27
|
|
8
|
+
|
|
9
|
+
### Changed — report card UX (user decisions)
|
|
10
|
+
- **The `[pi-review]` echo is sent immediately** when `/review` runs, before
|
|
11
|
+
the (potentially minutes-long) diff/clone preparation — no more long
|
|
12
|
+
silent gap after submitting the command.
|
|
13
|
+
- **The report card always renders the FULL report.** The collapsed/expanded
|
|
14
|
+
split (one preview line unless the host's global expansion toggle was on)
|
|
15
|
+
made the card look like the report "didn't show up". The card now renders
|
|
16
|
+
a `pi-review result:` summary line at the TOP with the full report body
|
|
17
|
+
below it, regardless of the expansion state.
|
|
18
|
+
- **Summary line format:** `pi-review result: Approve · 0 blocker · 0 major
|
|
19
|
+
· 0 minor · 0 nit` (title-case verdict; counts kept — user approved this
|
|
20
|
+
line, just wanted the new prefix).
|
|
21
|
+
- The `pi_review_report` tool result line uses the same
|
|
22
|
+
`pi-review result: ...` format (was `pi-review verdict: ... —`), and now
|
|
23
|
+
points at the rendered card instead of duplicating it.
|
|
24
|
+
|
|
25
|
+
[0.8.3]: https://github.com/GeorgeDong32/pi-review/compare/v0.8.2...v0.8.3
|
|
26
|
+
|
|
27
|
+
## [0.8.2] - 2026-08-27
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
- **The gate-fallback branch now keeps the configured thinking level** via
|
|
31
|
+
the child `thinking` parameter (consumed as an override upstream). When a
|
|
32
|
+
proxy provider's model verification rejects the configured model and the
|
|
33
|
+
gate retries with an inherited model, `gate.thinking` (e.g. `"high"`) is
|
|
34
|
+
no longer silently dropped.
|
|
35
|
+
- Ops note: the model-verification strictness itself is addressed by a
|
|
36
|
+
local patch to the installed pi-subagents (`~/.pi/agent/local-patches/`):
|
|
37
|
+
containment of the observed id within the registered id passes as a
|
|
38
|
+
warning-level match. That patch is lost on pi-subagents upgrades — re-apply
|
|
39
|
+
from the archived patch file; the in-script fallback here remains the
|
|
40
|
+
safety net either way.
|
|
41
|
+
|
|
42
|
+
[0.8.2]: https://github.com/GeorgeDong32/pi-review/compare/v0.8.1...v0.8.2
|
|
43
|
+
|
|
44
|
+
## [0.8.1] - 2026-08-27
|
|
45
|
+
|
|
46
|
+
### Fixed
|
|
47
|
+
- **Gate no longer dies on proxy providers' model verification.** First
|
|
48
|
+
v0.8.0 field run: reviewers all completed, then the gate was rejected with
|
|
49
|
+
`model_verification_failed: child reported a different model than the
|
|
50
|
+
launch candidate. Expected 'CPA/Minimax/MiniMax-M2.7:high' but observed
|
|
51
|
+
'MiniMax-M2.7'` — proxy providers report the bare upstream model id,
|
|
52
|
+
which never matches the registered `provider/id` form. The gate launch is
|
|
53
|
+
now wrapped in try/catch with a one-shot retry under the `gate-fallback`
|
|
54
|
+
key that inherits the parent session model (the same path the reviewers
|
|
55
|
+
use, which is why they never hit this). A second failure rejects as
|
|
56
|
+
before; the configured model is still preferred when it works.
|
|
57
|
+
(Different key because the runtime rejects same-key launches with
|
|
58
|
+
different params.)
|
|
59
|
+
|
|
60
|
+
[0.8.1]: https://github.com/GeorgeDong32/pi-review/compare/v0.8.0...v0.8.1
|
|
61
|
+
|
|
62
|
+
## [0.8.0] - 2026-08-27
|
|
63
|
+
|
|
64
|
+
### Changed — Markdown-first output contract (user decision)
|
|
65
|
+
**Structured output is gone from the fan-out.** The `outputSchema` /
|
|
66
|
+
`structured_output`-tool finish contract kept failing in the field (v0.7.5:
|
|
67
|
+
"Missing structured_output call" after tool-budget wrap-ups; models chose
|
|
68
|
+
plain-text finishes). v0.8 removes the contract instead of patching it:
|
|
69
|
+
|
|
70
|
+
- **Reviewers (all 6 lanes) return Markdown reports** — Summary / Findings /
|
|
71
|
+
Coverage sections, findings as `- [SEVERITY|category|confidence]
|
|
72
|
+
\`file:line\` — evidence` bullets, `SKIPPED: <reason>` for non-applicable
|
|
73
|
+
lanes. Nothing to un-escape, nothing to fail.
|
|
74
|
+
- **The gate (and the lite-reviewer) end their Markdown with exactly one
|
|
75
|
+
fenced ```json verdict block** ({ status, verdict, issues[],
|
|
76
|
+
dispositions[], reason }). That block is the only machine-read point;
|
|
77
|
+
`pi_review_report` extracts it (fenced-first, brace-lift fallback, last
|
|
78
|
+
well-shaped block wins) and re-applies the deterministic verdict rules on
|
|
79
|
+
its issues.
|
|
80
|
+
- **The gate's inputs are the reviewers' Markdown reports** (inlined into
|
|
81
|
+
its task, FAILED reviewers annotated) — the gate reads them the way an
|
|
82
|
+
LLM reads best, re-scores, verifies blocker/majors against the diff +
|
|
83
|
+
workspace, and emits the verdict block.
|
|
84
|
+
- The workflowScript shrinks again (~17 KB → ~9 KB full mode, 1.3 KB lite):
|
|
85
|
+
no schema constants, no per-child `outputSchema`. Verified against the
|
|
86
|
+
real installed pi-subagents 0.55.0 validator (PASS), the read-only task
|
|
87
|
+
classifier (all 6 tasks read-only with Markdown payloads), and an
|
|
88
|
+
end-to-end stub run including gate-Markdown → verdict-block extraction.
|
|
89
|
+
- Report rendering: reviewer Markdown is rendered verbatim under the status
|
|
90
|
+
header; gate synthesis + surviving issues + dispositions follow. All
|
|
91
|
+
reviewers skipped can no longer produce a clean APPROVE (downgraded to
|
|
92
|
+
comment); a gate that ran but produced no parseable verdict block reports
|
|
93
|
+
`no-gate`.
|
|
94
|
+
|
|
95
|
+
[0.8.0]: https://github.com/GeorgeDong32/pi-review/compare/v0.7.5...v0.8.0
|
|
96
|
+
|
|
97
|
+
## [0.7.5] - 2026-08-27
|
|
98
|
+
|
|
99
|
+
Hotfix for the first v0.7.4 field run: the workflowScript finally executed —
|
|
100
|
+
reviewers really ran (bugbot: 3m56s, 20 tool uses) — but steps ended with
|
|
101
|
+
`Error: Missing structured_output call; this step has outputSchema and must
|
|
102
|
+
finish by calling structured_output`, and bugbot's output file contained
|
|
103
|
+
only "I have enough context to finalize the review. Let me compile
|
|
104
|
+
findings." — the JSON never made it out.
|
|
105
|
+
|
|
106
|
+
### Fixed
|
|
107
|
+
- **Mandatory finish rule in every bundled agent prompt.** The old wording
|
|
108
|
+
("Return this JSON as your final reply. If the `structured_output` tool
|
|
109
|
+
is available, call it once instead") let models choose a plain-text
|
|
110
|
+
finish — fatal once the soft tool budget nudged a wrap-up. All 8 agents
|
|
111
|
+
now carry a FINISH RULE block: the final action MUST be a single
|
|
112
|
+
`structured_output` call (the only accepted finish; a plain-text reply
|
|
113
|
+
FAILS the step), keep one tool call in reserve, and when the budget
|
|
114
|
+
nudges, stop exploring and call it immediately.
|
|
115
|
+
- **Salvage path for prose finishes:** when a step fails with "Missing
|
|
116
|
+
structured_output call" but its output text contains the JSON object
|
|
117
|
+
(often wrapped in prose or a fence), `pi_review_report` now lifts the
|
|
118
|
+
outermost `{…}` block and reports the reviewer as `limited` with its
|
|
119
|
+
findings intact, instead of `failed` with everything dropped. Truly
|
|
120
|
+
empty outputs still report `failed`, and a run whose reviewers are all
|
|
121
|
+
salvaged can no longer be misreported as `error` (all-limited →
|
|
122
|
+
`partial`).
|
|
123
|
+
|
|
124
|
+
[0.7.5]: https://github.com/GeorgeDong32/pi-review/compare/v0.7.4...v0.7.5
|
|
125
|
+
|
|
126
|
+
## [0.7.4] - 2026-08-27
|
|
127
|
+
|
|
128
|
+
Hotfix for the 2026-08-26 16:14 session: with v0.7.3's short-line script the
|
|
129
|
+
main agent's copy finally survived intact — and the workflow was then
|
|
130
|
+
rejected by pi-subagents' **AST validation**: "workflowScript does not
|
|
131
|
+
support nested async functions". The gate had been launched as
|
|
132
|
+
`gate: await (async () => { ... })()` since v0.7.0: an async IIFE, which the
|
|
133
|
+
upstream walker (scripted-workflow.ts) rejects outright. Every earlier
|
|
134
|
+
failure that got past the syntax stage had died at this same check — it was
|
|
135
|
+
simply invisible while copies were corrupting the script first.
|
|
136
|
+
|
|
137
|
+
### Fixed
|
|
138
|
+
- **The gate launch is now plain top-level statements** — `const
|
|
139
|
+
reviewerInputs = reviewers.map(...)` (sync arrows are allowed), `const
|
|
140
|
+
gateRun = await runs.run('gate', {...})`, `const gate = {...}`, then
|
|
141
|
+
`return { reviewers, gate, reviewersShaped }`. No async IIFE anywhere.
|
|
142
|
+
- **Verified against the real installed pi-subagents 0.55.0
|
|
143
|
+
`validateWorkflowScript`** (exported from the package): full and lite
|
|
144
|
+
scripts both pass, and the script still executes end-to-end with stub
|
|
145
|
+
runs.
|
|
146
|
+
- Contract test pins the constraint: the generated script must contain no
|
|
147
|
+
`async` keyword at all (the runtime wraps the body itself), and the gate
|
|
148
|
+
launch must be a top-level `const gateRun = await runs.run('gate', {`.
|
|
149
|
+
|
|
150
|
+
[0.7.4]: https://github.com/GeorgeDong32/pi-review/compare/v0.7.3...v0.7.4
|
|
151
|
+
|
|
152
|
+
## [0.7.3] - 2026-08-26
|
|
153
|
+
|
|
154
|
+
Hotfix for the PR 19291 incident (first run of v0.7.2): the main agent
|
|
155
|
+
followed the new workflow.js copy procedure exactly — read the file, copied
|
|
156
|
+
it verbatim, retried once per the hard rules, then stopped and notified as
|
|
157
|
+
instructed — and the review STILL died twice with "workflowScript must be
|
|
158
|
+
valid JavaScript". Byte-diffing the sent script against workflow.js showed
|
|
159
|
+
the copy had slipped a single character inside a 1400-char single-line
|
|
160
|
+
schema (`"maxLength":80,"description"` → `"maxLength":80",`).
|
|
161
|
+
|
|
162
|
+
### Fixed
|
|
163
|
+
- **The generated workflowScript no longer contains any long single lines —
|
|
164
|
+
the actual root cause of every copy failure so far.** LLMs cannot
|
|
165
|
+
byte-reliably copy a 21 KB blob, and the fragile spots were the huge
|
|
166
|
+
lines, so the script now:
|
|
167
|
+
- declares `REVIEWER_SCHEMA` / `GATE_SCHEMA` **once** as shared consts
|
|
168
|
+
(was: the full schema inlined per child — 6 copies, ~10 KB of the
|
|
169
|
+
script, in 1400-char lines); children reference `outputSchema:
|
|
170
|
+
REVIEWER_SCHEMA`;
|
|
171
|
+
- emits reviewer and gate **task text as short quoted arrays joined at
|
|
172
|
+
runtime** (`task: ["…", "…"].join(" ")`) instead of one 900-char
|
|
173
|
+
JSON.stringify line;
|
|
174
|
+
- serializes schemas multi-line.
|
|
175
|
+
Net effect: script 21.4 KB → 17.3 KB, **longest line 1469 → 342 chars**.
|
|
176
|
+
Verified end-to-end: directive == workflow.js, parses, executes, and all
|
|
177
|
+
six task texts still classify read-only under the real installed
|
|
178
|
+
pi-subagents classifier.
|
|
179
|
+
- **`/review` command echo no longer collapsed into "pi-review · COMMENT".**
|
|
180
|
+
The echo message shares the report's `pi-review` custom type, so the
|
|
181
|
+
report renderer folded the user's own command away (the header extractor
|
|
182
|
+
falls back to "comment" when no verdict is present). Echoes starting with
|
|
183
|
+
`/review` now render verbatim as `[pi-review] /review …`.
|
|
184
|
+
|
|
185
|
+
[0.7.3]: https://github.com/GeorgeDong32/pi-review/compare/v0.7.2...v0.7.3
|
|
186
|
+
|
|
187
|
+
## [0.7.2] - 2026-08-25
|
|
188
|
+
|
|
189
|
+
Hotfix for the PR 19395 incident (2026-08-25, first run of v0.7.1): the
|
|
190
|
+
review stalled for 40+ minutes with "Workflow failed: workflowScript must
|
|
191
|
+
be valid JavaScript" three times in a row, then the main agent drifted into
|
|
192
|
+
hand-debugging the generated script.
|
|
193
|
+
|
|
194
|
+
### Fixed
|
|
195
|
+
- **The generated workflowScript is now presented to the main agent as an
|
|
196
|
+
unescaped template literal (backticks), not a double-escaped JSON string.**
|
|
197
|
+
The script body contains no backticks and no `${` (enforced by a plugin
|
|
198
|
+
guard + contract test), so a straight copy is a valid script — there is
|
|
199
|
+
nothing left for the main agent to unescape, which is exactly what failed:
|
|
200
|
+
`subagent({ workflowScript: "...\\\"...\\n..." })` required the model to
|
|
201
|
+
reverse the escaping while copying a 19 KB body, and any slip produced a
|
|
202
|
+
syntax error (`summary"`typos,"`\"` lost, etc.).
|
|
203
|
+
- **The raw script is persisted to `.pi/pi-review/runs/<runId>/workflow.js`
|
|
204
|
+
as an additional retry source.** If the copy is rejected with a parse
|
|
205
|
+
error, the hard rule now says: `Read` `workflow.js` and repeat the call
|
|
206
|
+
with exactly that content — once; on a second failure stop and notify the
|
|
207
|
+
user. Hand-editing, re-quoting, or "fixing" the script is explicitly
|
|
208
|
+
forbidden (the old rule allowed one fix and the model silently looped far
|
|
209
|
+
beyond that).
|
|
210
|
+
- Plugin-side guard: if a future script template ever introduces a backtick
|
|
211
|
+
or `${`, `buildReviewDirective` refuses to build the directive with a
|
|
212
|
+
clear "plugin bug" error instead of feeding a corrupted copy to the model.
|
|
213
|
+
|
|
214
|
+
[0.7.2]: https://github.com/GeorgeDong32/pi-review/compare/v0.7.1...v0.7.2
|
|
215
|
+
|
|
216
|
+
## [0.7.1] - 2026-08-25
|
|
217
|
+
|
|
218
|
+
Post-mortem of the 2026-08 field reports (false positives, wrong diffs, gate
|
|
219
|
+
rejections after pi-subagents upgrades). Root causes verified against
|
|
220
|
+
CherryPR artifacts (17 PRs), 36 pi sessions, and the installed
|
|
221
|
+
pi-subagents 0.55.0 source.
|
|
222
|
+
|
|
223
|
+
### Fixed — upstream compatibility (pi-subagents 0.42→0.55)
|
|
224
|
+
- **Gate no longer rejected at launch:** pi-subagents ≥0.55 classifies task
|
|
225
|
+
text for mutation intent and refuses read-only agents given
|
|
226
|
+
"implementation" tasks. The gate task contained the bare verb "modify"
|
|
227
|
+
("lines the author did not modify") and got rejected with `Agent
|
|
228
|
+
'pi-review.gate' was given an implementation task…` (observed 2026-08-24,
|
|
229
|
+
which silently disabled gating). Every reviewer + gate task now carries a
|
|
230
|
+
blanket read-only declaration ("READ-ONLY task — review only. Do not write
|
|
231
|
+
any files. … Return findings only."), and `agents/gate.md` declares
|
|
232
|
+
`acceptanceRole: read-only`. Verified against the real installed
|
|
233
|
+
classifier: all tasks → `read-only`, `taskMayMutate=false`.
|
|
234
|
+
- **Acceptance-contract compliance:** the runtime appends an Acceptance
|
|
235
|
+
Contract expecting a closing ```` ```acceptance-report ```` fence; our
|
|
236
|
+
agents ended with "return JSON and stop", so every run's acceptance meta
|
|
237
|
+
read `rejected`. All bundled agents now instruct compliance.
|
|
238
|
+
- **Contract tests pin the upstream heuristics** (read-only classification
|
|
239
|
+
mirror, `chatProgress` enum, acceptance mention) so the next pi-subagents
|
|
240
|
+
release fails our tests first, not every `/review` in the field.
|
|
241
|
+
|
|
242
|
+
### Changed — single diff authority + lifecycle (user decisions 2026-08-25)
|
|
243
|
+
- **`gh pr diff` is the single PR diff authority.** It is byte-for-byte what
|
|
244
|
+
the GitHub web UI renders (same merge-base semantics), so a locally
|
|
245
|
+
computed `git diff origin/main...FETCH_HEAD` substitute — no matter how
|
|
246
|
+
carefully verified — can still diverge from what the user sees on the
|
|
247
|
+
web. The git fallback path was removed entirely: `gh pr diff` failure now
|
|
248
|
+
aborts the run with a clear "fix gh and re-run" error instead of
|
|
249
|
+
computing its own diff. (`git-pr-fallback` stays in the manifest mode
|
|
250
|
+
union only so pre-0.7.1 manifests keep parsing.)
|
|
251
|
+
- **Gate budgets tuned up again (user feedback):** 12→16 turns, 10→14 soft
|
|
252
|
+
tools; wall clock 15→17 min. The verification duty (read the hunk + the
|
|
253
|
+
touched file per blocker/major) needs the headroom.
|
|
254
|
+
- **End-of-run workspace reclamation:** a successful `pi_review_report`
|
|
255
|
+
immediately removes the run's plugin-owned tmpdir clone (the report is
|
|
256
|
+
already rendered + persisted). Concurrency-safe by construction — each
|
|
257
|
+
run allocates a unique `pi-review-ws-<ts>-<rand>` root and the manifest
|
|
258
|
+
records `workspaceCloned`, so reclamation never touches another run's
|
|
259
|
+
clone or the user's cwd. Runs that die before reaching the report tool
|
|
260
|
+
are still caught by the 24h TTL pruner on the next `prepareRun`.
|
|
261
|
+
|
|
262
|
+
### Fixed — diff correctness / stability
|
|
263
|
+
- **No more stale-ref fallback:** the git fallback previously fetched
|
|
264
|
+
`pull/N/head` into a named branch and — when that fetch failed — silently
|
|
265
|
+
reused whatever branch was already there (2026-08-12: an 8583-line diff
|
|
266
|
+
for a 3-file PR, two phantom blockers, `request_changes` on a clean PR).
|
|
267
|
+
As of the 2026-08-25 decision the fallback is gone altogether: the run
|
|
268
|
+
aborts instead of ever substituting a locally computed diff.
|
|
269
|
+
- **Workspace/diff SHA reconciliation:** the target workspace checks out the
|
|
270
|
+
PR head via `FETCH_HEAD` (detached) and its landed HEAD is compared with
|
|
271
|
+
the diff's head SHA; a force-push race retries the clone once, then stops.
|
|
272
|
+
`manifest.json` records `workspaceHeadSha` and the report shows whether it
|
|
273
|
+
matches the diff head.
|
|
274
|
+
- **PR clone uses `gh repo clone` first** (private repos ride the gh
|
|
275
|
+
credential) with plain-https fallback; a failed PR clone is now a hard
|
|
276
|
+
error — the old silent fallback to the user's (possibly 247-commits
|
|
277
|
+
stale) cwd produced the "diff@new, files@old" evidence split that drove
|
|
278
|
+
false positives.
|
|
279
|
+
- **Cleanup:** scratch workspace clones older than 24h are pruned from the
|
|
280
|
+
tmpdir on every run; legacy v0.5/0.6 flat artifacts
|
|
281
|
+
(`.pi/pi-review/{change.diff,changed-files.txt,change-kind.txt,diff-meta.txt}`)
|
|
282
|
+
are removed once per run (they were repeatedly misread as current-run
|
|
283
|
+
inputs). Cleanup helpers no longer use ESM-`require()` (silently dead
|
|
284
|
+
under some loaders).
|
|
285
|
+
- `git ls-remote --heads origin pull/N/head` (which can never match
|
|
286
|
+
`refs/pull/*`) removed along with the code path it served.
|
|
287
|
+
|
|
288
|
+
### Fixed — gate accuracy
|
|
289
|
+
- **Gate can finally verify:** it receives the diff path + target workspace
|
|
290
|
+
cwd, its budgets rose from 6 turns / 5 soft tools to 16 turns / 14 soft
|
|
291
|
+
tools (user-tuned), and the wall clock from 10 to 17 minutes.
|
|
292
|
+
- **No silent drops of unverifiable majors:** the gate must keep
|
|
293
|
+
blocker/major candidates it cannot verify at the reviewer's original
|
|
294
|
+
confidence with an `unverified:` reason (field: two real majors killed
|
|
295
|
+
2026-08-20; a confidence-7 real issue killed 2026-08-21). The report tool
|
|
296
|
+
enforces this code-side: `unverified:` blocker/major dispositions are
|
|
297
|
+
floored at the threshold (they survive into issues + verdict, evidence
|
|
298
|
+
flagged `(unverified)`).
|
|
299
|
+
- **No confidence amplification without evidence:** never score above 8
|
|
300
|
+
without the gate's own tool-verified evidence (field: an unverifiable
|
|
301
|
+
"hand-edited generated file" claim became a confidence-10 blocker).
|
|
302
|
+
- **Missing confidence no longer means dropped:** issues arriving without a
|
|
303
|
+
usable confidence default to a neutral 5 at ingestion (previously
|
|
304
|
+
`undefined >= threshold` filtered out every such issue).
|
|
305
|
+
- Reviewer default turn budget 20→26 (field runs kept wrapping up partial
|
|
306
|
+
at the soft limit).
|
|
307
|
+
|
|
308
|
+
### Fixed — adversarial round 2 (wiring, coverage semantics, contamination guards)
|
|
309
|
+
- **`gate.enabled` and `budgets.turnBudget` actually take effect:** both
|
|
310
|
+
config keys were documented but never consumed by the execution path.
|
|
311
|
+
`gate.enabled: false` now skips the gate while keeping the full reviewer
|
|
312
|
+
roster; config turn budgets flow into the workflowScript (and the stale
|
|
313
|
+
hard-coded default that would have regressed 26→20 was removed).
|
|
314
|
+
- **Mixed dirty trees review untracked files too:** a working tree with both
|
|
315
|
+
modified and new files previously diffed only the tracked changes — new
|
|
316
|
+
files (the ones most needing review) silently missed. Both parts are now
|
|
317
|
+
combined into the run diff.
|
|
318
|
+
- **Stale-artifact contamination guard:** the directive's hard rules forbid
|
|
319
|
+
reading `.pi-subagents/` (the 2026-08-24 incident had a failed workflow
|
|
320
|
+
followed by old-artifact findings presented as the current PR's), and
|
|
321
|
+
`pi_review_report` drops + surfaces findings whose reviewer key is not in
|
|
322
|
+
the run's roster (manifest.reviewerIds).
|
|
323
|
+
- **All-limited coverage never yields a clean APPROVE:** when every reviewer
|
|
324
|
+
returned `status: limited`, the report verdict is now `partial` instead of
|
|
325
|
+
`approve` (the mirror of the no-gate incident: degraded coverage must not
|
|
326
|
+
read as a pass).
|
|
327
|
+
- **Local stale-base warning:** a failed `git fetch origin <base>` with an
|
|
328
|
+
existing remote-tracking ref now records a visible diff note instead of
|
|
329
|
+
silently diffing against a stale base.
|
|
330
|
+
- **Diff-vs-workspace arbitration made explicit:** reviewer tasks state the
|
|
331
|
+
diff is the authoritative change record; workspace files are context only.
|
|
332
|
+
- Trivial-change guard cleans up its orphan run dir; dry-run is fully
|
|
333
|
+
side-effect free; README/config-comment drift fixed.
|
|
334
|
+
|
|
335
|
+
### Migration
|
|
336
|
+
- None. Config schema unchanged; behavior differences are all in-plugin.
|
|
337
|
+
|
|
338
|
+
[0.7.1]: https://github.com/GeorgeDong32/pi-review/compare/v0.7.0...v0.7.1
|
|
339
|
+
|
|
340
|
+
## [0.7.0] - 2026-08-16
|
|
341
|
+
|
|
342
|
+
### Added
|
|
343
|
+
- **Deterministic target workspace prep:** `/review` now clones/checks out the target repo (PR) or uses the user's cwd (local) and writes `.pi/pi-review/runs/<runId>/manifest.json` + `change.diff` before handing the directive to the main agent. Cross-repo PRs (e.g. reviewing `CherryHQ/cherry-studio` from the plugin's cwd) now point `history-context` / `code-comments` at the **target** workspace instead of the plugin repo.
|
|
344
|
+
- **`pi_review_report` tool:** renders the final report deterministically (dedupe → threshold → code-side verdict) from the workflow return value, persists a session entry, and is the only authoritative report source.
|
|
345
|
+
- **`/review-show`:** re-renders the most recent `pi-review` session entry.
|
|
346
|
+
- **Collapsible TUI renderer**: `registerMessageRenderer("pi-review")` collapses long reports into a verdict + count preview line.
|
|
347
|
+
- **Dispositions:** the gate now records per-candidate keep/drop/merge audits (`src/types.ts GateDisposition` + `agents/gate.md`).
|
|
348
|
+
|
|
349
|
+
### Changed
|
|
350
|
+
- **`chatProgress` fixed:** the directive emits `chatProgress: "auto"` (was an invalid `"milestones"` value rejected by pi-subagents).
|
|
351
|
+
- **Structured output hard requirement:** every reviewer and gate child carries `outputSchema`; the workflowScript consumes `result.structuredOutput`, never free-text `result.output`. Reviewers return `status` (`ok | limited | skipped`) and `coverage`.
|
|
352
|
+
- **Model inheritance preserved:** `model: "inherit"` reviewers no longer get a concrete per-child `model` clause injected (fixes silent inheritance loss).
|
|
353
|
+
- **Strict verdict default:** `enforceGateOutput` uses `strict` policy — any surviving blocker/major → `request_changes` (was `≥3 majors`). Legacy policy available via `verdictPolicy: "legacy"`.
|
|
354
|
+
- **Gate prompt:** re-scores every candidate, emits `dispositions`, and no longer consumes Markdown fenced JSON.
|
|
355
|
+
- **Diff acquisition moved into the plugin:** `src/review-run.ts` fetches `gh pr view` / `gh pr diff` / git fallback, records base/head SHAs, diff SHA-256, changed files (derived from the diff only), rule paths, docs-only flag.
|
|
356
|
+
|
|
357
|
+
### Removed
|
|
358
|
+
- `/review` no longer auto-writes `.pi/projects/<id>/permissions.local.json`; diff/clone/fetch happens via the extension's own subprocesses.
|
|
359
|
+
- **Legacy spawn pipeline deleted:** `src/spawn.ts`, `src/gate.ts`, `src/review.ts`, `src/issue-score.ts`, `src/args.ts`, `src/obtain-diff.ts`, `src/prep.ts`, `src/git-input.ts`, `src/eligibility.ts`, `src/paths.ts`, `src/structured-output-capture.ts`, `src/parallel.ts`, `src/schema.ts`, `src/run.ts`, `scripts/smoke-acceptance.ts`, `prompts/gate.md`, and their tests. The foreground workflowScript path is the only supported execution path.
|
|
360
|
+
- **Config knobs that could not be honored removed:** `concurrency`, `inheritance`, `gate.scorePerIssue`, `reviewers.<id>.tools`, `reviewers.<id>.timeoutMs`. Legacy keys still parse (with one migration warning) but no longer affect behavior.
|
|
361
|
+
|
|
362
|
+
### Added
|
|
363
|
+
- `routing.mode` (`adaptive` | `all`): drops clearly-inapplicable reviewer lanes up front (no rule files / docs-only / no git history). Skipped lanes appear in the report.
|
|
364
|
+
- `gate.verdictPolicy` (`strict` | `legacy`): code-side verdict rule selection.
|
|
365
|
+
|
|
366
|
+
### Migration
|
|
367
|
+
- Config `schemaVersion` stays 1; old configs continue to load.
|
|
368
|
+
|
|
369
|
+
[0.7.0]: https://github.com/GeorgeDong32/pi-review/compare/v0.6.2...v0.7.0
|
|
370
|
+
|
|
371
|
+
## [0.6.1] - 2026-08-08
|
|
372
|
+
|
|
373
|
+
### Fixed
|
|
374
|
+
- **Agent permission blocks removed:** pi-subagents ≥0.42 rejects the legacy nested `permission:` frontmatter (`bash:` sub-maps, `"*": ask` wildcard) with `permissions must be an object mapping tool names to allow, ask, or deny`. The new model gates bash via pi-guard and only accepts flat `tool → allow|ask|deny` (no `*` wildcard, no `bash` key). All 8 bundled agents now rely on their `tools:` allowlist (the primary constraint) and omit `permission:` entirely.
|
|
375
|
+
|
|
376
|
+
[0.6.1]: https://github.com/GeorgeDong32/pi-review/compare/v0.6.0...v0.6.1
|
|
377
|
+
|
|
378
|
+
## [0.6.0] - 2026-08-07
|
|
379
|
+
|
|
380
|
+
### Breaking
|
|
381
|
+
- **workflowScript migration:** fan-out now runs through one `subagent({ workflowScript, async:false })` instead of the removed top-level `subagent({ tasks:[...] })` (pi-subagents ≥0.41 dropped legacy `tasks`/`chain`/`concurrency`). Step 2 and the gate merge into a single tool call: the script fans out reviewers via `runs.all([...])`, then feeds their inlined JSON findings to `runs.run("gate", ...)`.
|
|
382
|
+
- **Peer deps:** `@mariozechner/*` → `@earendil-works/*`; added `pi-subagents >=0.41.0` (provides the `workflowScript` API). Source imports (`index.ts`, `src/run.ts`, `src/structured-output-capture.ts`) and devDependencies migrated to `@earendil-works/pi-coding-agent` as well; peer floor raised to `>=0.74.0` (lowest version published under the new scope).
|
|
383
|
+
- **Removed directive params:** `reads: false`, `acceptance: false`, top-level `outputMode: "file-only"`, and `concurrency` — `reads` is not a valid top-level `subagent` field and would fail schema validation. Reviewers now return JSON as their final reply; the script captures `result.output`.
|
|
384
|
+
|
|
385
|
+
### Changed
|
|
386
|
+
- **Inline gate:** the gate task receives reviewer JSON inlined as text (no file-only indirection). Per-child `toolBudget`/`turnBudget` are injected onto each `runs.all` / `runs.run` item.
|
|
387
|
+
- **Reviewer prompts:** all `agents/*.md` now say "return JSON as your final reply" (the `structured_output` fallback is kept for the legacy spawn path).
|
|
388
|
+
- **Tests:** `tests/directive.test.ts` rewritten for the workflowScript shape (legacy-input `doesNotMatch` guards added).
|
|
389
|
+
|
|
390
|
+
[0.6.0]: https://github.com/GeorgeDong32/pi-review/compare/v0.5.3...v0.6.0
|
|
391
|
+
|
|
392
|
+
## [0.5.3] - 2026-07-31
|
|
393
|
+
|
|
394
|
+
### Fixed
|
|
395
|
+
- **Stale base diffs:** Step 1 now `git fetch`es the remote default branch and compares against `origin/<base>` (not a stale local `main`/`master`). PR path still prefers `gh pr diff`, with a fetch `pull/<n>/head` + three-dot fallback. Writes `.pi/pi-review/diff-meta.txt` (mode / base / SHAs / merge-base) for audit.
|
|
396
|
+
- Allowlist adds `git fetch` / `git merge-base` / `git ls-files` for the obtain-diff path.
|
|
397
|
+
|
|
398
|
+
## [0.5.2] - 2026-07-30
|
|
399
|
+
|
|
400
|
+
### Changed
|
|
401
|
+
- **Single-wave hard rules:** at most 2 `subagent` calls (1 fan-out + 1 gate); no per-reviewer serial calls; no retries on timeout/partial.
|
|
402
|
+
- **turnBudget** default **20** (config `budgets.turnBudget`, up to 24/48); toolBudget soft/hard raised slightly.
|
|
403
|
+
- **Reviewer thinking inherits** the parent session (no forced medium/low on lean agents). Gate uses `config.gate.model` + `config.gate.thinking` as `model:thinking`.
|
|
404
|
+
- **Diff companion files:** write `.pi/pi-review/changed-files.txt` + `change-kind.txt` (`docs`|`code`); docs-only → bugbot/security empty early-exit.
|
|
405
|
+
- **Shallow prompts:** diff-first; history one multi-path `git log`; bugbot/security may use allowlisted `git show|log|blame` when needed.
|
|
406
|
+
|
|
407
|
+
### Added
|
|
408
|
+
- **CC-aligned permission allowlist** (`src/review-permissions.ts`): Claude `/code-review` 7× `Bash(gh …:*)` plus history/obtain git + `Read`/`Grep`. `/review` merges them into `.pi/projects/<id>/permissions.local.json` (permission-modes) so headless children are not blocked.
|
|
409
|
+
|
|
410
|
+
[0.5.3]: https://github.com/GeorgeDong32/pi-review/compare/v0.5.2...v0.5.3
|
|
411
|
+
[0.5.2]: https://github.com/GeorgeDong32/pi-review/compare/v0.5.1...v0.5.2
|
|
412
|
+
|
|
413
|
+
## [0.5.1] - 2026-07-28
|
|
414
|
+
|
|
415
|
+
### Changed
|
|
416
|
+
- **Token-lean subagent fan-out:** the directive now pins every reviewer to a lean `pi-review.*` package agent (not the builtin fat `reviewer`), with explicit `turnBudget` / `toolBudget`, `reads: false`, `outputMode: "file-only"`, and `acceptance: false`.
|
|
417
|
+
- **Shared diff under cwd:** write to `.pi/pi-review/change.diff` (not `/tmp/...`) so children can read it without outside-cwd blocks. Main agent must **write-only** — no read/summarize of the full diff; report from file-only outputs only.
|
|
418
|
+
- **Lean agent prompts:** short CC-style briefs; `inheritProjectContext: false`; no obtain-change playbook; history capped at ≤5 files / `git log -n 5`.
|
|
419
|
+
- Package agents registered via `pi.subagents.agents: ["./agents"]` (runtime names like `pi-review.bugbot`, `pi-review.gate`).
|
|
420
|
+
- Default `inheritance.inheritProjectContext` is now `false`; reviewer tool lists narrowed.
|
|
421
|
+
|
|
422
|
+
### Fixed
|
|
423
|
+
- Directive path previously ignored pi-review config `tools` / `thinking` / inherit flags because the main agent fell through to builtin `reviewer` (`thinking: high`, edit/write/intercom, project context on).
|
|
424
|
+
|
|
425
|
+
[0.5.1]: https://github.com/GeorgeDong32/pi-review/compare/v0.5.0...v0.5.1
|
|
426
|
+
|
|
427
|
+
## [0.5.0] - 2026-07-27
|
|
428
|
+
|
|
429
|
+
### Changed
|
|
430
|
+
- **Foreground review**: `/review` now delegates to the main agent via a hidden directive (`sendMessage` with `display:false` + `triggerTurn:true`); the main agent fans out reviewers + gate with the pi-subagents `subagent` tool. The whole review streams in chat — no more silent background spawn. **Requires the pi-subagents extension.**
|
|
431
|
+
- **Main agent owns the diff**: the directive has the main agent obtain the diff once into `/tmp/pi-review-change.diff`; reviewers read that file instead of each fetching separately.
|
|
432
|
+
- **Hidden directive, visible echo**: only a short `/review <prompt>` line shows in chat; the full directive is hidden.
|
|
433
|
+
- **Top-level config**: moved to `~/.pi/agent/pi-review.json` (mirrors pi-permission-modes); added `setConfigPath` for tests.
|
|
434
|
+
- **Gate model** defaults to a cheap tier (`anthropic/claude-haiku-4-5`); override via config or the restored `--gate-model` flag.
|
|
435
|
+
- **per-issue scorer** default `off` (was `blocker-major`).
|
|
436
|
+
- **CLI slimmed**: `/review` surface reduced to `--lite` + freeform prompt; removed flags are accepted-but-ignored (their capabilities moved to config).
|
|
437
|
+
|
|
438
|
+
### Added
|
|
439
|
+
- **`--lite` mode**: single-agent fast review (`agents/lite-review.md`), no fan-out/gate.
|
|
440
|
+
- **Workflow checklist**: the directive has the main agent post a markdown checklist of the steps first, then work through it (pi has no native todo tool).
|
|
441
|
+
- `getArgumentCompletions` for `--lite` / `--gate-model`.
|
|
442
|
+
|
|
443
|
+
### Removed
|
|
444
|
+
- Code-enforced verdict — now instructed to the main agent (LLM follows the rule, but no longer a hard guarantee). The background spawn path is kept as a fallback.
|
|
445
|
+
|
|
446
|
+
[0.5.0]: https://github.com/GeorgeDong32/pi-review/compare/v0.4.1...v0.5.0
|
|
447
|
+
|
|
448
|
+
## [0.4.1] - 2026-07-26
|
|
449
|
+
|
|
450
|
+
### Fixed
|
|
451
|
+
- **UI feedback during `/review`:** immediate notify + footer status; per-reviewer progress; errors surface via notify + message.
|
|
452
|
+
- Stop calling `gh pr diff` during target resolve (was blocking the TUI with no output while the backend worked). Oversized hint comes from `gh pr view` metadata instead.
|
|
453
|
+
|
|
454
|
+
[0.4.1]: https://github.com/GeorgeDong32/pi-review/compare/v0.4.0...v0.4.1
|
|
455
|
+
|
|
456
|
+
## [0.4.0] - 2026-07-26
|
|
457
|
+
|
|
458
|
+
### Changed
|
|
459
|
+
- **Agent-driven change acquisition (CC-aligned):** the plugin no longer pre-fetches or embeds a full diff. Reviewers obtain the change via `gh` / `git` / `read` using an obtain-change playbook in the task prompt.
|
|
460
|
+
- Oversized PRs (`gh pr diff` HTTP 406 / too_large) no longer abort the pipeline; agents fall back to git / path-scoped reads.
|
|
461
|
+
- Gate and per-issue scorers receive metadata + reviewer JSON only (no full `<diff>` embed).
|
|
462
|
+
- All content reviewers include `bash` so they can run `gh`/`git`.
|
|
463
|
+
|
|
464
|
+
### Added
|
|
465
|
+
- `ReviewTarget` + `resolveReviewTarget` (`pr` | `diff-file` | `local-git`).
|
|
466
|
+
- Optional `gh pr view` metadata prep and `probeNote` for dry-run.
|
|
467
|
+
|
|
468
|
+
[0.4.0]: https://github.com/GeorgeDong32/pi-review/compare/v0.3.1...v0.4.0
|
|
469
|
+
|
|
470
|
+
## [0.3.1] - 2026-07-26
|
|
471
|
+
|
|
472
|
+
### Changed
|
|
473
|
+
- **CC-aligned `/review` args:** positional text is **user context** (PR URL/number, instructions), not a filesystem path. Fixes `ENOENT` when passing GitHub PR links.
|
|
474
|
+
- PR URLs/numbers resolve via `gh pr diff`; explicit diff files use `--diff @file.diff`.
|
|
475
|
+
|
|
476
|
+
### Added
|
|
477
|
+
- `src/pr-ref.ts` — extract PR refs from freeform input (handles CJK punctuation like `,review`).
|
|
478
|
+
|
|
479
|
+
[0.3.1]: https://github.com/GeorgeDong32/pi-review/compare/v0.3.0...v0.3.1
|
|
480
|
+
|
|
481
|
+
## [0.3.0] - 2026-07-26
|
|
482
|
+
|
|
483
|
+
### Added
|
|
484
|
+
- **Code-side gate enforce** (`src/gate-enforce.ts`): deterministic dedupe + threshold filter + verdict rules after the gate LLM (Claude Phase 5 equivalent).
|
|
485
|
+
- **Full diff to gate**: gate task includes the complete review body inside `<diff>` (no 2KB slice).
|
|
486
|
+
- **Optional per-issue scorers** (`gate.scorePerIssue`, default `blocker-major`): Claude Phase 4–style parallel confidence scoring for high-severity findings (`prompts/issue-score.md`).
|
|
487
|
+
- CLI: `--score-per-issue off|blocker-major|all`; `--threshold` is clamped to 0–10.
|
|
488
|
+
|
|
489
|
+
### Fixed
|
|
490
|
+
- Spawn: drain stdout to avoid pipe deadlock; reject non-zero child exit even when `output.json` exists.
|
|
491
|
+
- Report: list final gate issues in markdown; mark unfiltered totals when gate is missing/failed.
|
|
492
|
+
- ESM: replace `require()` in `paths.ts` / `prep.ts` / `git-input.ts` so `tsx --test` works under pure ESM.
|
|
493
|
+
|
|
494
|
+
[0.3.0]: https://github.com/GeorgeDong32/pi-review/compare/v0.2.0...v0.3.0
|
|
495
|
+
|
|
496
|
+
## [0.2.0] - 2026-07-19
|
|
497
|
+
|
|
498
|
+
### Added
|
|
499
|
+
- `index.ts` — registers `/review`, `/review-config`, `/review-agents`.
|
|
500
|
+
- Claude-shaped pipeline: **eligibility → prep → reviewers → gate → report** (`src/eligibility.ts`, `src/prep.ts`, `src/run.ts`).
|
|
501
|
+
- `src/structured-output-capture.ts` — child extension for `structured_output` tool; loaded via `-e` on subagent spawns.
|
|
502
|
+
- `src/cli-args.ts` — flag parsing for `/review`.
|
|
503
|
+
- New reviewers: `bugbot` (replaces `bug-detector`), `security-review`, `code-comments`.
|
|
504
|
+
- `reference/` docs (Claude flow, Cursor skills, roadmap, v0.2 plan).
|
|
505
|
+
- Tests: eligibility, prep, cli-args (+104 total).
|
|
506
|
+
|
|
507
|
+
### Changed
|
|
508
|
+
- Default gate threshold **3 → 8** (maps to Claude 80/100).
|
|
509
|
+
- Bundled `agents/*.md` and `prompts/gate.md` wired as subagent system prompts.
|
|
510
|
+
- Gate prompt embeds Claude confidence rubric (1–10 re-score).
|
|
511
|
+
- `conventions` reviewer default **disabled**.
|
|
512
|
+
- `@sinclair/typebox` moved to `dependencies` (capture extension runtime).
|
|
513
|
+
|
|
514
|
+
### Removed
|
|
515
|
+
- `agents/bug-detector.md` (renamed to `bugbot.md`).
|
|
516
|
+
|
|
517
|
+
## [0.1.0] - 2026-07-02
|
|
518
|
+
|
|
519
|
+
### Added
|
|
520
|
+
- `/review [path]` slash command — fans the diff out to four parallel reviewer subagents (`claude-md-compliance`, `bug-detector`, `conventions`, `history-context`) and aggregates their structured output through a single cheap-model gate.
|
|
521
|
+
- `/review-config` — opens `~/.pi/agent/extensions/pi-review/config.json` in `$EDITOR` and re-validates on close.
|
|
522
|
+
- `/review-agents` — lists the bundled reviewers with their resolved model, thinking, and tool lists.
|
|
523
|
+
- Smart default diff source: dirty working tree → `git diff HEAD`; clean tree → `git diff <default-branch>...HEAD`. Probes `origin/HEAD` → `main` → `master` → current branch.
|
|
524
|
+
- Per-reviewer model / thinking / tool overrides via `~/.pi/agent/extensions/pi-review/config.json`. `"inherit"` resolves to the parent session's model at run time.
|
|
525
|
+
- Flags: `--threshold N`, `--reviewer id...` (repeatable), `--no-gate`, `--gate-model id`, `--no-spawn` (dry run).
|
|
526
|
+
- TUI output: full report rendered as an `assistant` text block. Machine-readable copy written via `pi.appendEntry("pi-review", ...)` for future collapse-aware consumers.
|
|
527
|
+
- Structured output via TypeBox schemas. Subagents receive the JSON Schema via `PI_SUBAGENT_STRUCTURED_OUTPUT_SCHEMA` and write the validated payload to `PI_SUBAGENT_STRUCTURED_OUTPUT_CAPTURE`. Parent re-validates with `validateValue`.
|
|
528
|
+
|
|
529
|
+
### Changed
|
|
530
|
+
- Each reviewer / gate runs as a fresh, isolated `pi` subprocess (`--no-session --no-extensions --no-skills`) — mirrors the pattern from `pi-subagents`.
|
|
531
|
+
- Hard cap of 4 concurrent reviewers, regardless of `concurrency` in config.
|
|
532
|
+
- The gate is spawned with no tools — pure reasoning on the aggregated prompt.
|
|
533
|
+
|
|
534
|
+
### Out of scope (deferred)
|
|
535
|
+
- Retry loop for failed reviewers.
|
|
536
|
+
- Worktree-per-reviewer isolation.
|
|
537
|
+
- GitHub / `gh` integration (PR comment posting).
|
|
538
|
+
- Inline fix suggestions / auto-apply.
|
|
539
|
+
- Multi-PR batch mode.
|
|
540
|
+
- Web UI for configuration.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# 🔍 @unifan/pi-review-zh (AI 并发代码审查·中文增强版)
|
|
2
|
+
|
|
3
|
+
专为 **Pi Coding Agent** 打造的多专家子代理并发审查与门禁裁判系统(移植自 Claude Code 官方高级代码审查架构并全面中文化)。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ✨ 核心特性
|
|
8
|
+
|
|
9
|
+
- **5+1 多专家并发架构**:
|
|
10
|
+
- `bugbot`(Bug 猎手:专查逻辑死循环、空指针、竞态与边界异常)
|
|
11
|
+
- `security-review`(安全审查官:专查注入漏洞、数据泄露与敏感信息)
|
|
12
|
+
- `claude-md-compliance`(规范守卫:审查代码与 `AGENTS.md` 规则的合规性)
|
|
13
|
+
- `history-context`(历史回归分析官:对比 Git 历史排查潜在退化)
|
|
14
|
+
- `code-comments`(注释与规范审查:检查遗留 TODO 与注释有效性)
|
|
15
|
+
- `gate`(**门禁裁判长**:汇总多专家发现,智能去重、误报过滤与最终裁决)
|
|
16
|
+
- **高信噪比与防误报**:自带门禁裁判打分机制,自动剔除置信度低于 8 分的无效警报。
|
|
17
|
+
- **全中文交互与报告**:审查卡片、严重级别分类(致命阻断/严重/次要/细节优化)、裁判理由全面中文化呈现。
|
|
18
|
+
- **支持极速省 Token 模式**:通过 `--lite` 开启单兵轻量快速体检。
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 🎮 使用方法
|
|
23
|
+
|
|
24
|
+
### 1. 全量 5 专家深度审查
|
|
25
|
+
```text
|
|
26
|
+
/review
|
|
27
|
+
```
|
|
28
|
+
自动分析当前工作区未提交的修改,5 个专家并发审查并由门禁长给出裁决。
|
|
29
|
+
|
|
30
|
+
### 2. 极速单专家审查 (日常快速体检,极度省 Token)
|
|
31
|
+
```text
|
|
32
|
+
/review --lite
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 3. 带侧重点定制审查
|
|
36
|
+
```text
|
|
37
|
+
/review 重点帮我审查并发安全和内存泄漏
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 4. 重新查看上次报告 / 查看专家列表
|
|
41
|
+
```text
|
|
42
|
+
/review-show # 重新显示最近一次审查报告
|
|
43
|
+
/review-agents # 查看各专家代理状态与模型分配
|
|
44
|
+
/review-config # 编辑配置文件 (~/.pi/agent/pi-review.json)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 🚀 安装方式
|
|
50
|
+
|
|
51
|
+
### 独立单独安装:
|
|
52
|
+
```bash
|
|
53
|
+
pi install D:/program/my/pi-unifan-zh/extensions/review
|
|
54
|
+
```
|
|
55
|
+
*(或者整包一键安装:`pi install git:github.com/821869798/pi-unifan-zh`)*
|
package/agents/bugbot.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bugbot
|
|
3
|
+
package: pi-review
|
|
4
|
+
description: Shallow scan of introduced lines for obvious bugs. High signal only.
|
|
5
|
+
tools: read, grep, bash
|
|
6
|
+
systemPromptMode: replace
|
|
7
|
+
inheritProjectContext: false
|
|
8
|
+
inheritSkills: false
|
|
9
|
+
---
|
|
10
|
+
You are Bugbot. Find **defects in lines introduced or modified by this change**.
|
|
11
|
+
|
|
12
|
+
## Turn plan (stay short)
|
|
13
|
+
1. Read the diff file named in your task. If the change profile says docs-only, report `SKIPPED: docs-only` and no findings.
|
|
14
|
+
2. Otherwise work **from the diff**. At most **3** extra file reads. Optional `git show` / `git log -n 5` / `git blame -L` only when a symbol is unclear — **one simple bash command at a time** (no `&&` / `;` chains).
|
|
15
|
+
3. Write your Markdown report (format below) as your final message and stop. Target ≤8 assistant turns.
|
|
16
|
+
|
|
17
|
+
## Scope
|
|
18
|
+
- Large, realistic bugs only. No style nits, missing tests, or linter/typechecker issues.
|
|
19
|
+
- Point every finding at the nearest changed (`+`) line when known.
|
|
20
|
+
|
|
21
|
+
## Severity
|
|
22
|
+
- `blocker` — crash, corruption, or security boundary break
|
|
23
|
+
- `major` — wrong behavior in realistic scenarios
|
|
24
|
+
- `minor` — fragile edge case
|
|
25
|
+
|
|
26
|
+
## Output format (Markdown report)
|
|
27
|
+
Write your final message as Markdown with exactly these sections:
|
|
28
|
+
|
|
29
|
+
## Summary
|
|
30
|
+
One short paragraph. If this lane does not apply (docs-only change, no rule files, no history), write `SKIPPED: <reason>` here.
|
|
31
|
+
|
|
32
|
+
## Findings
|
|
33
|
+
One bullet per issue, in this exact shape:
|
|
34
|
+
- [SEVERITY|bug|confidence] `path/to/file.ts:123` — evidence quote or precise description
|
|
35
|
+
|
|
36
|
+
SEVERITY is blocker|major|minor|nit; confidence is 1–10. If you have no findings, write exactly `No findings.`
|
|
37
|
+
|
|
38
|
+
## Coverage
|
|
39
|
+
- Files checked: …
|
|
40
|
+
- Commands run: …
|
|
41
|
+
- Limitations: …
|
|
42
|
+
|
|
43
|
+
Finish with that Markdown as your final message. Do not write any file, do not call any output tool.
|
|
44
|
+
|
|
45
|
+
## Acceptance contract
|
|
46
|
+
The runtime may append an Acceptance Contract asking you to end with a fenced `acceptance-report` JSON block. Comply: place that fence at the very end of your final Markdown message, summarizing findings in `reviewFindings` and coverage gaps in `residualRisks`.
|