@zephyrdeng/pi-review 0.18.3 → 0.20.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/README.md +7 -0
- package/README.zh-CN.md +7 -0
- package/dist/args.d.ts.map +1 -1
- package/dist/args.js +20 -2
- package/dist/args.js.map +1 -1
- package/dist/claude-plugin-sync.test.d.ts +2 -0
- package/dist/claude-plugin-sync.test.d.ts.map +1 -0
- package/dist/claude-plugin-sync.test.js +33 -0
- package/dist/claude-plugin-sync.test.js.map +1 -0
- package/dist/claude-plugin.d.ts +16 -0
- package/dist/claude-plugin.d.ts.map +1 -0
- package/dist/claude-plugin.js +58 -0
- package/dist/claude-plugin.js.map +1 -0
- package/dist/claude-plugin.test.d.ts +2 -0
- package/dist/claude-plugin.test.d.ts.map +1 -0
- package/dist/claude-plugin.test.js +21 -0
- package/dist/claude-plugin.test.js.map +1 -0
- package/dist/cli.js +12 -3
- package/dist/cli.js.map +1 -1
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +13 -4
- package/dist/install.js.map +1 -1
- package/dist/meta-footer.d.ts +3 -1
- package/dist/meta-footer.d.ts.map +1 -1
- package/dist/meta-footer.js +10 -0
- package/dist/meta-footer.js.map +1 -1
- package/dist/panel-ui.d.ts +8 -0
- package/dist/panel-ui.d.ts.map +1 -1
- package/dist/panel-ui.js +23 -0
- package/dist/panel-ui.js.map +1 -1
- package/dist/panel-ui.test.js +23 -1
- package/dist/panel-ui.test.js.map +1 -1
- package/dist/panel.d.ts +6 -0
- package/dist/panel.d.ts.map +1 -1
- package/dist/panel.js +17 -2
- package/dist/panel.js.map +1 -1
- package/dist/review.d.ts.map +1 -1
- package/dist/review.js +5 -1
- package/dist/review.js.map +1 -1
- package/dist/skill-update.test.js +2 -2
- package/dist/skill-update.test.js.map +1 -1
- package/dist/types.d.ts +60 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/update.d.ts.map +1 -1
- package/dist/update.js +9 -3
- package/dist/update.js.map +1 -1
- package/dist/verify-cli.d.ts +14 -0
- package/dist/verify-cli.d.ts.map +1 -0
- package/dist/verify-cli.js +223 -0
- package/dist/verify-cli.js.map +1 -0
- package/dist/verify-cli.test.d.ts +2 -0
- package/dist/verify-cli.test.d.ts.map +1 -0
- package/dist/verify-cli.test.js +208 -0
- package/dist/verify-cli.test.js.map +1 -0
- package/dist/verify-regression.test.d.ts +2 -0
- package/dist/verify-regression.test.d.ts.map +1 -0
- package/dist/verify-regression.test.js +307 -0
- package/dist/verify-regression.test.js.map +1 -0
- package/dist/verify.d.ts +151 -0
- package/dist/verify.d.ts.map +1 -0
- package/dist/verify.js +737 -0
- package/dist/verify.js.map +1 -0
- package/dist/verify.test.d.ts +2 -0
- package/dist/verify.test.d.ts.map +1 -0
- package/dist/verify.test.js +442 -0
- package/dist/verify.test.js.map +1 -0
- package/package.json +3 -2
- package/resources/review-presets.json +3 -3
- package/skills/pi-review/SKILL.md +26 -0
- package/skills/pi-review/references/codex-tools.md +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zephyrdeng/pi-review",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Isolated AI-powered code and plan reviews from the command line",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "ZephyrDeng <zephyrTang@aliyun.com>",
|
|
@@ -81,7 +81,8 @@
|
|
|
81
81
|
"test:watch": "vitest",
|
|
82
82
|
"test:rv": "vitest run extensions",
|
|
83
83
|
"prepublishOnly": "npm run build",
|
|
84
|
-
"pack:dry": "npm pack --dry-run"
|
|
84
|
+
"pack:dry": "npm pack --dry-run",
|
|
85
|
+
"test:mod": "sh scripts/test-claude-mod.sh"
|
|
85
86
|
},
|
|
86
87
|
"engines": {
|
|
87
88
|
"node": ">=20"
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
"description": "Code review only: inspect provided files, diffs, or paths and return review conclusions without editing.",
|
|
4
4
|
"tools": ["read", "grep", "find", "ls"],
|
|
5
5
|
"thinking": "high",
|
|
6
|
-
"instructions": "Review code or code changes only. Do not edit, write, patch, format, commit, or otherwise mutate files. Use the enabled read-only tools for inspection. Focus on correctness, regressions, security, concurrency, API contracts, edge cases, maintainability, and missing tests."
|
|
6
|
+
"instructions": "Review code or code changes only. Do not edit, write, patch, format, commit, or otherwise mutate files. Use the enabled read-only tools for inspection. Focus on correctness, regressions, security, concurrency, API contracts, edge cases, maintainability, and missing tests. Ground every finding in facts: before concluding, use grep/find/ls to look for the repository's own evidence — design docs, ADRs, README/docs, CHANGELOG, any spec or issue text included in the request, and the existing tests that cover the touched code — and cite what you found. If no spec or test evidence exists for a claim, say so explicitly in Risks and Blind Spots instead of assuming the code is correct, and do not mark a finding Actionable when it rests on inference alone."
|
|
7
7
|
},
|
|
8
8
|
"plan": {
|
|
9
9
|
"description": "High-level plan review with multiple expert lenses; output a decisive conclusion.",
|
|
10
10
|
"tools": ["read", "grep", "find", "ls"],
|
|
11
11
|
"thinking": "high",
|
|
12
|
-
"instructions": "Review the proposal, design, architecture, or product plan through multiple expert lenses: engineering lead, product owner, security, QA, operations, and developer experience. Do not implement. Identify fatal flaws, trade-offs, missing constraints, sequencing risks, and the smallest changes that would make the plan safer."
|
|
12
|
+
"instructions": "Review the proposal, design, architecture, or product plan through multiple expert lenses: engineering lead, product owner, security, QA, operations, and developer experience. Do not implement. Identify fatal flaws, trade-offs, missing constraints, sequencing risks, and the smallest changes that would make the plan safer. Verify the plan's factual claims against the repository (grep/find/read the code, docs, ADRs, and tests it refers to) and cite what you checked; mark claims you could not verify as unverified rather than accepting them."
|
|
13
13
|
},
|
|
14
14
|
"challenge": {
|
|
15
15
|
"description": "Adversarial plan review: pressure-test assumptions, boundaries, dependencies, and terminology.",
|
|
16
16
|
"tools": ["read", "grep", "find", "ls"],
|
|
17
17
|
"thinking": "high",
|
|
18
|
-
"instructions": "Challenge the plan as an adversarial design reviewer. Do not ask a sequence of live interview questions; produce a one-shot review conclusion. Pressure-test terminology, hidden dependencies, reversibility, edge cases, failure modes, migration paths, ownership boundaries, and what evidence would invalidate the plan."
|
|
18
|
+
"instructions": "Challenge the plan as an adversarial design reviewer. Do not ask a sequence of live interview questions; produce a one-shot review conclusion. Pressure-test terminology, hidden dependencies, reversibility, edge cases, failure modes, migration paths, ownership boundaries, and what evidence would invalidate the plan. For every assumption you attack, check it against the repository's actual code, docs, and tests first and cite the evidence; state which assumptions you could not verify."
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -61,6 +61,7 @@ There is no `/rv-config set` command — the agent is the config editor. When th
|
|
|
61
61
|
| **Fast CI / Pre-commit Gate** | Run `pi-review screen <@files\|paths...>` (~1s wall time, zero LLM generation). Immediately blocks obvious defects (off-by-one, SQLi, unawaited async, float money) via typed Jev judgments before launching full reviewer sessions. |
|
|
62
62
|
| **Pi** (`/rv`) | New panel reviews call the native `pi_review` API tool, shown to users as **Pi Review Panel**, which launches the packaged CLI in event mode and renders live reviewer state. Continuations, kept sessions, `/rv-loop`, and explicit `--no-stream` use the shell CLI. |
|
|
63
63
|
| **Pi terminal** | Foreground `pi-review`; text deltas stream live by default. |
|
|
64
|
+
| **Claude Code with the pi-review plugin** (`PI_REVIEW_UI=pane` in the shell environment; check with `echo $PI_REVIEW_UI`) | The plugin draws panel runs live in a Claude Code pane, and the CLI skips the web dashboard even when `--ui web` is passed. **Panel review default: background run with `--ui web --no-ui-open`, no `--ui-url-file`** (a pane-aware CLI skips the dashboard; an older CLI starts it without a browser, and the pane follows its events either way); panel `loop` runs in the background with no `--ui` flags. Tell the user the pane shows progress (`/pi-review-panel` reopens it). Single review keeps the row below. |
|
|
64
65
|
| **Claude Code / Codex / Cursor / agy (Antigravity)** and similar agent hosts | These hosts buffer a shell tool's output until the command exits, so a foreground run looks like a silent wait. **Panel review (`--reviewers`/`--panel`) default: `--ui web --ui-url-file <path>` + background run** — get the dashboard in front of the user: on Claude Code the CLI auto-open lands in the system default browser; on Codex open the `--ui-url-file` URL in the host's built-in browser (the CLI cannot reach a GUI there); on agy prefer the host browser / share the URL the same way; hand over the URL as fallback either way. **Single review / `loop` default: `--progress-log <path>` + background run + tail the log** (`--ui web` requires an active panel and rejects `loop`). See [references/codex-tools.md](./references/codex-tools.md). Map skill mentions of `Bash` to your host shell tool. |
|
|
65
66
|
| Scripts / CI | Foreground is fine; add `--no-stream` only when the caller must buffer until exit (cannot combine with `--progress-log`). |
|
|
66
67
|
|
|
@@ -155,6 +156,29 @@ Use this protocol when the host is closing out implementation work and may edit
|
|
|
155
156
|
|
|
156
157
|
The shell exit policy is: `0` clean, `1` status is `has_findings`, `2` usage error, `3` needs human, `4` blocked/runtime failure. A non-zero loop result is a gate signal, not permission for the child reviewer to edit.
|
|
157
158
|
|
|
159
|
+
## Verification before review (`--verify`)
|
|
160
|
+
|
|
161
|
+
Opt-in. pi-review runs verification commands once, in a disposable isolated copy of the working tree, before reviewers start, and gives every reviewer the results as `test-output` evidence. Reviewers stay read-only; pi-review's own code runs the commands. Guide: [docs/guide/verify-mode.md](https://github.com/ZephyrDeng/pi-review/blob/main/docs/guide/verify-mode.md).
|
|
162
|
+
|
|
163
|
+
**When to use it:** the user asks for a review that should rest on executed tests/type checks, or the change makes claims (a bug fix, a behavior change) that a test can confirm. Skip it for plan/design reviews and for untrusted checkouts.
|
|
164
|
+
|
|
165
|
+
**Trust boundary:** verification executes repository code on this machine with the user's privileges. The isolated copy protects the working tree, not the machine. Never add `--verify` on a repository the user would not run its tests on.
|
|
166
|
+
|
|
167
|
+
**What runs without asking:** only `verify.commands` from `.pi-review.json` committed at `HEAD` (standing pre-approval). `pi-review --verify -- <target>` runs exactly those. Everything else needs a human decision.
|
|
168
|
+
|
|
169
|
+
**Agent-proposed verification — host steps (mandatory order):**
|
|
170
|
+
|
|
171
|
+
1. **Propose.** Write `plan.json` yourself (default: you know the session, the issue, the design docs, and what you changed). Pick the smallest set of commands that confirms or refutes the change's claims; add a minimal repro test via `files` when a key claim has no test. Every step needs `id`, `argv` (no shell), and `purpose`; add `expectedDurationSec`, `sideEffects`, `idempotent` as your honest self-assessment. Fallback when you lack context: `pi-review verify propose -- <target> > plan.json` (read-only Pi child, same format).
|
|
172
|
+
2. **Show.** Run `pi-review verify show plan.json`. Exit `0` = everything is pre-approved, go to step 5 without `--verify-approval`. Exit `5` = a human must decide. Exit `2` = invalid plan; fix it.
|
|
173
|
+
3. **Ask the user.** Present every step that says `NEEDS APPROVAL` — command, purpose, new files, your self-assessment — with your host's question tool (Claude Code `AskUserQuestion`; Codex/Cursor approval prompt). Offer approve all / choose steps / reject. **Never approve on the user's behalf, never skip the question, and never run a step yourself in the shell instead.**
|
|
174
|
+
4. **Record.** `pi-review verify approve plan.json --all | --steps a,b [--reject c] --by "<user> via <tool>" > approval.json`. The record binds to each step's content hash; editing a step afterwards voids its approval, so re-ask after any edit.
|
|
175
|
+
5. **Review.** `pi-review [loop] --verify-plan plan.json --verify-approval approval.json [panel flags] -- <target>`. Unapproved steps show up as `skipped_unapproved` in the prompt and meta.
|
|
176
|
+
6. **Iterate (optional, capped).** To see results without a full review: `pi-review verify run --plan plan.json --approval approval.json`. After a failure you may append `"round": 2` steps (e.g. a minimal repro), then repeat steps 2-4 for the new steps only and pass both approval files (`--verify-approval` is repeatable). The default cap is one follow-up round (`verify.maxFollowUpRounds`).
|
|
177
|
+
|
|
178
|
+
CI / non-interactive callers: pass `--verify` (whitelist) or a plan without approval; only pre-approved steps run.
|
|
179
|
+
|
|
180
|
+
**Reading results:** the footer shows `Verify <status> · N run / M not run`; `PI_REVIEW_META_JSON.verification` carries `status` (`passed | partial | failed | unverified`), `reason`, per-step `approval`, `status`, `exitCode`, `stepSha256`, and the redacted output tail. A failing command is evidence, not a pi-review failure. Report `unverified` honestly; never describe it as passing.
|
|
181
|
+
|
|
158
182
|
## Gate-grade fast screening (`pi-review screen`)
|
|
159
183
|
|
|
160
184
|
`pi-review screen <@files|paths...>` is a sub-second gate check that completely skips LLM prose generation. It slices files at declaration boundaries into hunks, evaluates each hunk against defect patterns via single-call typed Jev judgments, and assembles findings from catalog templates in **~1.0–1.2s**:
|
|
@@ -196,6 +220,8 @@ A finding whose summary ends `matched no known pattern` is an unmatched signal:
|
|
|
196
220
|
| `--until clean` | In `loop` mode, automates iterative convergence (stops when confirmed actionable issues drop to 0 or hard `--max-rounds` cap is hit). |
|
|
197
221
|
| `--progress-log <path>` | Streams compact JSON events to a file; essential for background runs in buffered-output hosts like Claude Code, Codex, or Cursor. |
|
|
198
222
|
| `--ui web` | Starts a loopback browser dashboard for panel runs; recommended for visual inspection on agent hosts. |
|
|
223
|
+
| `--verify` / `--verify-plan <file>` / `--verify-approval <file>` | Run whitelisted or human-approved verification once in an isolated copy before reviewers; see [Verification before review](#verification-before-review---verify). |
|
|
224
|
+
| `verify propose\|show\|approve\|run` | The host-side handshake for agent-proposed verification plans. `show` exits `5` when the user must approve. |
|
|
199
225
|
|
|
200
226
|
|
|
201
227
|
## Panel review
|
|
@@ -18,7 +18,7 @@ Native shell tools on these hosts **buffer stdout/stderr until the command exits
|
|
|
18
18
|
|
|
19
19
|
### Panel review: browser dashboard (default)
|
|
20
20
|
|
|
21
|
-
`--reviewers <n>` or `--panel <name>` activates panel review. On Codex, Claude Code, Cursor, or agy, default to the dashboard instead of a tailed log:
|
|
21
|
+
`--reviewers <n>` or `--panel <name>` activates panel review. On Codex, Claude Code, Cursor, or agy, default to the dashboard instead of a tailed log (Claude Code with the pi-review plugin, where `PI_REVIEW_UI=pane` is set, skips this: the pane draws the run, so run it in the background with `--ui web --no-ui-open` and no `--ui-url-file`):
|
|
22
22
|
|
|
23
23
|
1. Run `pi-review --reviewers <n> --ui web --ui-url-file <path> -- <target>` (or `--panel <name>`) in the **background**. Pass `--no-ui-open` only when the user asked not to open a browser (CI, remote shells).
|
|
24
24
|
2. Read `<path>` shortly after launch — it is written atomically as soon as the dashboard server is ready, well before reviewers finish (poll a few times a second for a couple of seconds if the file is not there yet). Then get the dashboard in front of the user: on **Claude Code** the CLI auto-open already lands in the system default browser; on **Codex** the CLI cannot reach a GUI browser, so open the URL from `<path>` in the host's built-in browser yourself. Share the URL either way as a fallback: *"Dashboard opened in your browser (URL: `<url>`). I'll report back when the review completes."*
|