@zephyrdeng/pi-review 0.4.4 → 0.4.5
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 +21 -4
- package/README.zh-CN.md +85 -0
- package/extensions/review.ts +28 -14
- package/extensions/rv-prompts.test.ts +53 -0
- package/extensions/rv-prompts.ts +192 -0
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -22,10 +22,18 @@ Works as a standalone CLI, a Pi package (extension + skill), or integrated into
|
|
|
22
22
|
- **Model-agnostic** — use any model available in your Pi installation
|
|
23
23
|
- **Session continuity** — keep sessions alive for follow-up questions with `--keep-session`
|
|
24
24
|
- **Customizable presets** — extend or override review modes via JSON configuration
|
|
25
|
-
- **Pi package integration** — `/
|
|
25
|
+
- **Pi package integration** — `/rv` slash command and agent skill included
|
|
26
|
+
|
|
27
|
+
## Language policy
|
|
28
|
+
|
|
29
|
+
- **Source code** (CLI, extensions, presets, prompts, TUI strings emitted from code): **English only**.
|
|
30
|
+
- **Documentation** may be bilingual. See [README.zh-CN.md](./README.zh-CN.md) for 中文说明.
|
|
31
|
+
- **Git commits**: [Husky](https://typicode.github.io/husky/) runs `ai-commit` on `prepare-commit-msg` / `commit-msg` / `pre-commit` (see [`.husky/`](./.husky/)). Config: [`.ai-commit.yaml`](./.ai-commit.yaml) (English, `ai_footer: off`, **ai-commit v0.1.45+** on PATH). Or run `ai-commit commit` / `ai-commit generate` directly after `git add`.
|
|
26
32
|
|
|
27
33
|
## Installation
|
|
28
34
|
|
|
35
|
+
Dev dependencies use the [public npm registry](https://registry.npmjs.org/) (see [`.npmrc`](./.npmrc)); run `npm install` in the repo root for Husky hooks.
|
|
36
|
+
|
|
29
37
|
### CLI (recommended)
|
|
30
38
|
|
|
31
39
|
```bash
|
|
@@ -122,8 +130,8 @@ PI_REVIEW_META: {"reviewMode":"code","verdict":"request_changes","verdictSource"
|
|
|
122
130
|
# Keep a review session for follow-up
|
|
123
131
|
pi-review --mode challenge --keep-session -- @docs/design.md
|
|
124
132
|
|
|
125
|
-
# Continue a previous session
|
|
126
|
-
pi-review --mode challenge --
|
|
133
|
+
# Continue a previous session (same optional flags as an initial run)
|
|
134
|
+
pi-review --continue <sessionHandle> --mode challenge --model provider/model -- "expand finding 2"
|
|
127
135
|
```
|
|
128
136
|
|
|
129
137
|
## CLI Reference
|
|
@@ -166,7 +174,16 @@ After installing as a Pi package, use the `/rv` slash command:
|
|
|
166
174
|
/rv --mode challenge @docs/design.md
|
|
167
175
|
```
|
|
168
176
|
|
|
169
|
-
The `/rv` command
|
|
177
|
+
The `/rv` command injects a task message for the parent agent (mode-specific instructions + the `pi-review` CLI to run). The agent follows the **pi-review** skill and runs an isolated child session.
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
/rv models
|
|
181
|
+
/rv @src/foo.ts
|
|
182
|
+
/rv --mode plan @docs/architecture.md
|
|
183
|
+
/rv --mode challenge --keep-session @docs/design.md
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Argument completions (`--mode`, `@`, `models`, etc.) are hints only; execution is skill-driven.
|
|
170
187
|
|
|
171
188
|
## Security
|
|
172
189
|
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# pi-review
|
|
2
|
+
|
|
3
|
+
[English README](./README.md)
|
|
4
|
+
|
|
5
|
+
**在命令行中运行隔离的 AI 代码与方案审查。**
|
|
6
|
+
|
|
7
|
+
`pi-review` 把审查工作交给一次全新的、隔离的 [Pi](https://github.com/anthropics/pi) 子会话,并返回结构化结论。子会话只读、只评,不改文件、不打补丁、不提交。
|
|
8
|
+
|
|
9
|
+
可作为独立 CLI、Pi 包(扩展 + skill),或接入 CI / 编辑器工作流。
|
|
10
|
+
|
|
11
|
+
## 语言约定
|
|
12
|
+
|
|
13
|
+
| 范围 | 语言 |
|
|
14
|
+
|------|------|
|
|
15
|
+
| 源码(CLI、扩展、`review-presets.json`、提示词、代码里的用户可见文案) | **仅英文** |
|
|
16
|
+
| 文档(本页与英文 README) | **中英均可** |
|
|
17
|
+
|
|
18
|
+
实现与对外协议(如 `PI_REVIEW_META`、Verdict 枚举)保持英文,便于自动化与跨工具一致。
|
|
19
|
+
|
|
20
|
+
## 前置条件
|
|
21
|
+
|
|
22
|
+
- 已安装并配置好 [Pi CLI](https://pi.dev),且至少有一个可用模型
|
|
23
|
+
|
|
24
|
+
## 安装
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install -g @zephyrdeng/pi-review
|
|
28
|
+
# 或 Pi 包
|
|
29
|
+
pi install npm:@zephyrdeng/pi-review
|
|
30
|
+
# 或安装 skill 到各 Agent
|
|
31
|
+
npx @zephyrdeng/pi-review install-skill
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## 快速开始
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pi-review -- @src/foo.ts
|
|
38
|
+
pi-review --model openai/gpt-5.5 -- @src/foo.ts
|
|
39
|
+
pi-review --mode plan -- @docs/architecture.md
|
|
40
|
+
pi-review --mode challenge -- @docs/design.md
|
|
41
|
+
pi-review models
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 审查模式
|
|
45
|
+
|
|
46
|
+
| 模式 | 说明 |
|
|
47
|
+
|------|------|
|
|
48
|
+
| `code`(默认) | 代码、diff、MR、文件与仓库审查 |
|
|
49
|
+
| `plan` | 多视角方案 / 架构审查 |
|
|
50
|
+
| `challenge` | 对抗式审查,压测假设与证据缺口 |
|
|
51
|
+
|
|
52
|
+
## Pi 包:`/rv` 命令
|
|
53
|
+
|
|
54
|
+
安装 Pi 包后可在 Pi 里使用 `/rv`:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
/rv models
|
|
58
|
+
/rv @src/foo.ts
|
|
59
|
+
/rv --mode challenge @docs/design.md
|
|
60
|
+
/rv --continue <handle> --mode challenge --model provider/model "expand finding 2"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
跟进审查时,`--continue` 与首次 `/rv` 一样可**选填** `--mode`、`--model`(以及后续 CLI 支持的其它选项由 skill 直接调用 CLI 时传入)。
|
|
64
|
+
|
|
65
|
+
`/rv` 会向主会话注入**英文任务说明**(按 `--mode` 等参数区分),由主 Agent 按 **pi-review** skill 调用 `pi-review` CLI 跑子会话。Tab 补全是固定选项提示,不是另一套实现。
|
|
66
|
+
|
|
67
|
+
## 输出格式
|
|
68
|
+
|
|
69
|
+
审查结果包含 `## Verdict`、`## Summary`、`## Findings` 等章节,并以 `PI_REVIEW_META: {...}` 结尾(英文 JSON,便于脚本解析)。
|
|
70
|
+
|
|
71
|
+
## 配置
|
|
72
|
+
|
|
73
|
+
提交代码:`npm install` 后会启用 **Husky** 钩子(`.husky/` → `ai-commit` 的 prepare-commit-msg / commit-msg / pre-commit)。也可 `git add` 后直接 `ai-commit commit`。配置见 `.ai-commit.yaml`(英文、`ai_footer: off`,需本机安装 ai-commit ≥ v0.1.45)。
|
|
74
|
+
|
|
75
|
+
可通过 `PI_REVIEW_HOME`、`PI_REVIEW_PRESETS`、`PI_REVIEW_SYSTEM_PROMPT` 等环境变量覆盖预设与系统提示词路径。预设与审查指令文件内容均为英文。
|
|
76
|
+
|
|
77
|
+
## 安全
|
|
78
|
+
|
|
79
|
+
- 每次审查在隔离子进程中运行
|
|
80
|
+
- 默认不保留子会话;`--keep-session` 仅用于显式跟进
|
|
81
|
+
- 审查会话只读,不编辑、不部署
|
|
82
|
+
|
|
83
|
+
## 许可
|
|
84
|
+
|
|
85
|
+
[MIT](LICENSE) © ZephyrDeng
|
package/extensions/review.ts
CHANGED
|
@@ -1,27 +1,41 @@
|
|
|
1
1
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import {
|
|
3
|
+
buildRvOrchestrationPrompt,
|
|
4
|
+
parseRvArgs,
|
|
5
|
+
RV_COMPLETIONS,
|
|
6
|
+
validateRvParsed,
|
|
7
|
+
} from "./rv-prompts.js";
|
|
2
8
|
|
|
3
9
|
export default function piReviewExtension(pi: ExtensionAPI) {
|
|
4
10
|
pi.registerCommand("rv", {
|
|
5
|
-
description:
|
|
11
|
+
description:
|
|
12
|
+
"Delegate pi-review to the agent. Usage: /rv [--mode plan|challenge] [--model id] [--keep-session] @target | /rv --continue <handle> [opts] [text] | models",
|
|
6
13
|
getArgumentCompletions: (prefix) => {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"--model ",
|
|
12
|
-
"--keep-session",
|
|
13
|
-
"models",
|
|
14
|
-
];
|
|
15
|
-
const filtered = items.filter((item) => item.startsWith(prefix));
|
|
16
|
-
return filtered.length ? filtered.map((value) => ({ value, label: value })) : null;
|
|
14
|
+
const filtered = RV_COMPLETIONS.filter((item) => item.value.startsWith(prefix));
|
|
15
|
+
return filtered.length
|
|
16
|
+
? filtered.map(({ value, hint }) => ({ value, label: value, description: hint }))
|
|
17
|
+
: null;
|
|
17
18
|
},
|
|
18
19
|
handler: async (rawArgs, ctx) => {
|
|
19
20
|
const trimmed = rawArgs.trim();
|
|
20
21
|
if (!trimmed) {
|
|
21
|
-
ctx.ui.notify("
|
|
22
|
+
ctx.ui.notify("/rv needs a target or `models`. Try: /rv @path or /rv models", "warning");
|
|
22
23
|
return;
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
+
|
|
26
|
+
const parsed = parseRvArgs(trimmed);
|
|
27
|
+
const validation = validateRvParsed(parsed);
|
|
28
|
+
if (!validation.ok) {
|
|
29
|
+
ctx.ui.notify(validation.message, "warning");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (!parsed.modelsOnly && !parsed.target && !parsed.continueHandle) {
|
|
34
|
+
ctx.ui.notify("/rv needs a target, --continue <handle>, or `models`.", "warning");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
pi.sendUserMessage(buildRvOrchestrationPrompt(parsed));
|
|
25
39
|
},
|
|
26
40
|
});
|
|
27
|
-
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { describe, it } from "node:test";
|
|
3
|
+
import { buildPiReviewArgv, parseRvArgs, validateRvParsed } from "./rv-prompts.js";
|
|
4
|
+
|
|
5
|
+
describe("parseRvArgs / validateRvParsed", () => {
|
|
6
|
+
it("parses continue with optional mode and model", () => {
|
|
7
|
+
const p = parseRvArgs("--continue abc123 --mode challenge --model zenmux/foo expand finding 2");
|
|
8
|
+
assert.equal(p.continueHandle, "abc123");
|
|
9
|
+
assert.equal(p.mode, "challenge");
|
|
10
|
+
assert.equal(p.model, "zenmux/foo");
|
|
11
|
+
assert.equal(p.target, "expand finding 2");
|
|
12
|
+
assert.equal(validateRvParsed(p).ok, true);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it("passes custom preset mode through to CLI argv", () => {
|
|
16
|
+
const p = parseRvArgs("--mode plan-bigbang @x.md");
|
|
17
|
+
assert.equal(p.mode, "plan-bigbang");
|
|
18
|
+
assert.equal(validateRvParsed(p).ok, true);
|
|
19
|
+
assert.deepEqual(buildPiReviewArgv(p, "@x.md"), ["pi-review", "--mode", "plan-bigbang", "--", "@x.md"]);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("rejects keep-session with continue", () => {
|
|
23
|
+
const p = parseRvArgs("--keep-session --continue h -- foo");
|
|
24
|
+
const v = validateRvParsed(p);
|
|
25
|
+
assert.equal(v.ok, false);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("buildPiReviewArgv matches for initial and continue", () => {
|
|
29
|
+
const initial = parseRvArgs("--mode plan --model m/a @doc.md");
|
|
30
|
+
assert.deepEqual(buildPiReviewArgv(initial, "@doc.md"), [
|
|
31
|
+
"pi-review",
|
|
32
|
+
"--mode",
|
|
33
|
+
"plan",
|
|
34
|
+
"--model",
|
|
35
|
+
"m/a",
|
|
36
|
+
"--",
|
|
37
|
+
"@doc.md",
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
const cont = parseRvArgs("--continue h --mode plan --model m/a more");
|
|
41
|
+
assert.deepEqual(buildPiReviewArgv(cont, "more"), [
|
|
42
|
+
"pi-review",
|
|
43
|
+
"--continue",
|
|
44
|
+
"h",
|
|
45
|
+
"--mode",
|
|
46
|
+
"plan",
|
|
47
|
+
"--model",
|
|
48
|
+
"m/a",
|
|
49
|
+
"--",
|
|
50
|
+
"more",
|
|
51
|
+
]);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/** /rv → parent-agent task text; child review uses resources/review-presets.json */
|
|
2
|
+
|
|
3
|
+
export const RV_MODES = ["code", "plan", "challenge"] as const;
|
|
4
|
+
export type RvMode = (typeof RV_MODES)[number];
|
|
5
|
+
|
|
6
|
+
const FLAGS_REQUIRING_VALUE = ["--mode", "--model", "--continue"] as const;
|
|
7
|
+
|
|
8
|
+
export type RvParsed = {
|
|
9
|
+
mode: string;
|
|
10
|
+
model?: string;
|
|
11
|
+
keepSession: boolean;
|
|
12
|
+
continueHandle?: string;
|
|
13
|
+
modelsOnly: boolean;
|
|
14
|
+
target: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type RvValidation =
|
|
18
|
+
| { ok: true }
|
|
19
|
+
| { ok: false; message: string };
|
|
20
|
+
|
|
21
|
+
export function parseRvArgs(raw: string): RvParsed {
|
|
22
|
+
const tokens = raw.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g) ?? [];
|
|
23
|
+
const cleaned = tokens.map((t) => t.replace(/^['"]|['"]$/g, ""));
|
|
24
|
+
|
|
25
|
+
let mode = "code";
|
|
26
|
+
let model: string | undefined;
|
|
27
|
+
let keepSession = false;
|
|
28
|
+
let continueHandle: string | undefined;
|
|
29
|
+
let modelsOnly = false;
|
|
30
|
+
const rest: string[] = [];
|
|
31
|
+
|
|
32
|
+
for (let i = 0; i < cleaned.length; i++) {
|
|
33
|
+
const t = cleaned[i];
|
|
34
|
+
if (t === "models" && rest.length === 0 && i === cleaned.length - 1) {
|
|
35
|
+
modelsOnly = true;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (t === "--keep-session") {
|
|
39
|
+
keepSession = true;
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (t === "--mode") {
|
|
43
|
+
const m = cleaned[i + 1];
|
|
44
|
+
if (!m || m.startsWith("--")) {
|
|
45
|
+
rest.push(t);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
mode = cleaned[++i];
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (t === "--model") {
|
|
52
|
+
const v = cleaned[i + 1];
|
|
53
|
+
if (!v || v.startsWith("--")) {
|
|
54
|
+
rest.push(t);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
model = cleaned[++i];
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (t === "--continue") {
|
|
61
|
+
const v = cleaned[i + 1];
|
|
62
|
+
if (!v || v.startsWith("--")) {
|
|
63
|
+
rest.push(t);
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
continueHandle = cleaned[++i];
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
rest.push(t);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
mode,
|
|
74
|
+
model,
|
|
75
|
+
keepSession,
|
|
76
|
+
continueHandle,
|
|
77
|
+
modelsOnly,
|
|
78
|
+
target: rest.join(" ").trim(),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function validateRvParsed(parsed: RvParsed): RvValidation {
|
|
83
|
+
if (parsed.keepSession && parsed.continueHandle) {
|
|
84
|
+
return { ok: false, message: "--keep-session and --continue cannot be used together." };
|
|
85
|
+
}
|
|
86
|
+
for (const flag of FLAGS_REQUIRING_VALUE) {
|
|
87
|
+
if (parsed.target === flag) {
|
|
88
|
+
return { ok: false, message: `Missing value for ${flag}.` };
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return { ok: true };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Same optional flags for initial review and --continue follow-up (all optional). */
|
|
95
|
+
export function buildPiReviewArgv(parsed: RvParsed, target: string): string[] {
|
|
96
|
+
const parts = ["pi-review"];
|
|
97
|
+
if (parsed.continueHandle) {
|
|
98
|
+
parts.push("--continue", parsed.continueHandle);
|
|
99
|
+
} else if (parsed.keepSession) {
|
|
100
|
+
parts.push("--keep-session");
|
|
101
|
+
}
|
|
102
|
+
if (parsed.mode !== "code") parts.push("--mode", parsed.mode);
|
|
103
|
+
if (parsed.model) parts.push("--model", parsed.model);
|
|
104
|
+
parts.push("--", target);
|
|
105
|
+
return parts;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function baseRules(): string {
|
|
109
|
+
return [
|
|
110
|
+
"Follow the pi-review skill.",
|
|
111
|
+
"Run pi-review in an isolated child session; return only the review conclusion.",
|
|
112
|
+
"Do not edit, patch, commit, or implement findings unless the user asks separately.",
|
|
113
|
+
"Preserve the final PI_REVIEW_META line from pi-review output.",
|
|
114
|
+
].join(" ");
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function buildRvOrchestrationPrompt(parsed: RvParsed): string {
|
|
118
|
+
if (parsed.modelsOnly) {
|
|
119
|
+
return [
|
|
120
|
+
"Run the pi-review model catalog step.",
|
|
121
|
+
baseRules(),
|
|
122
|
+
"Execute: pi-review models",
|
|
123
|
+
"Summarize briefly: provider count and 2–3 model IDs that fit code review vs plan/challenge.",
|
|
124
|
+
"Do not start a review until the user supplies a target (@path or text).",
|
|
125
|
+
].join("\n\n");
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const followUpDefault = "follow up on the previous review";
|
|
129
|
+
const target = parsed.target || (parsed.continueHandle ? followUpDefault : "");
|
|
130
|
+
|
|
131
|
+
if (!target && !parsed.continueHandle) {
|
|
132
|
+
return [
|
|
133
|
+
"/rv needs a review target.",
|
|
134
|
+
"Usage: /rv [--mode code|plan|challenge] [--model provider/model] [--keep-session] @files-or-brief",
|
|
135
|
+
"Continue: /rv --continue <handle> [--mode ...] [--model ...] [follow-up text]",
|
|
136
|
+
"Examples: /rv @src/foo.ts | /rv --mode challenge @docs/design.md | /rv models",
|
|
137
|
+
].join("\n\n");
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const modeBlock: Record<string, string> = {
|
|
141
|
+
code: [
|
|
142
|
+
"Mode: code (default).",
|
|
143
|
+
"Focus: correctness, regressions, security, concurrency, API contracts, edge cases, tests.",
|
|
144
|
+
"Use read-only inspection via pi-review; no file mutations.",
|
|
145
|
+
].join(" "),
|
|
146
|
+
plan: [
|
|
147
|
+
"Mode: plan.",
|
|
148
|
+
"Review architecture, design, or strategy through engineering, product, security, QA, ops, and DX lenses.",
|
|
149
|
+
"Identify fatal flaws, trade-offs, sequencing risks, and minimal changes to de-risk the plan.",
|
|
150
|
+
].join(" "),
|
|
151
|
+
challenge: [
|
|
152
|
+
"Mode: challenge (adversarial).",
|
|
153
|
+
"Pressure-test assumptions, boundaries, dependencies, failure modes, migration, and missing evidence.",
|
|
154
|
+
"One-shot conclusion; do not run a live Q&A interview.",
|
|
155
|
+
].join(" "),
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const cliLine = buildPiReviewArgv(parsed, target).join(" ");
|
|
159
|
+
|
|
160
|
+
const modelStep = parsed.model
|
|
161
|
+
? `Use model exactly as given: ${parsed.model} (must appear in pi-review models output).`
|
|
162
|
+
: "Run pi-review models first if needed; pick a suitable listed ID or omit --model for Pi default.";
|
|
163
|
+
|
|
164
|
+
const continueNote = parsed.continueHandle
|
|
165
|
+
? "Continuing an existing review session. Optional --mode and --model match the same flags as an initial /rv run."
|
|
166
|
+
: parsed.keepSession
|
|
167
|
+
? "Use --keep-session so the user can follow up with /rv --continue <handle>."
|
|
168
|
+
: "";
|
|
169
|
+
|
|
170
|
+
return [
|
|
171
|
+
parsed.continueHandle ? "Continue a prior pi-review session." : "Run pi-review for the target below.",
|
|
172
|
+
baseRules(),
|
|
173
|
+
modeBlock[parsed.mode] ??
|
|
174
|
+
`Mode: ${parsed.mode}. Follow the preset named in review-presets.json when present.`,
|
|
175
|
+
modelStep,
|
|
176
|
+
continueNote,
|
|
177
|
+
`Execute:\n${cliLine}`,
|
|
178
|
+
]
|
|
179
|
+
.filter(Boolean)
|
|
180
|
+
.join("\n\n");
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export const RV_COMPLETIONS: { value: string; hint: string }[] = [
|
|
184
|
+
{ value: "@", hint: "file path after @ (e.g. @src/foo.ts)" },
|
|
185
|
+
{ value: "models", hint: "list pi-review models only" },
|
|
186
|
+
{ value: "--mode code", hint: "code / diff / MR review" },
|
|
187
|
+
{ value: "--mode plan", hint: "architecture or plan review" },
|
|
188
|
+
{ value: "--mode challenge", hint: "adversarial plan review" },
|
|
189
|
+
{ value: "--model ", hint: "provider/model from pi-review models" },
|
|
190
|
+
{ value: "--keep-session", hint: "persist session for follow-up" },
|
|
191
|
+
{ value: "--continue ", hint: "resume session; same optional flags as initial /rv" },
|
|
192
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zephyrdeng/pi-review",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
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>",
|
|
@@ -58,13 +58,16 @@
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"
|
|
62
|
-
"
|
|
61
|
+
"@types/node": "^22.0.0",
|
|
62
|
+
"husky": "^9.1.7",
|
|
63
|
+
"typescript": "^5.8.0"
|
|
63
64
|
},
|
|
64
65
|
"scripts": {
|
|
66
|
+
"prepare": "husky",
|
|
65
67
|
"build": "tsc",
|
|
66
68
|
"check": "tsc --noEmit",
|
|
67
69
|
"smoke": "node dist/cli.js --help >/dev/null",
|
|
70
|
+
"test:rv": "npx --yes tsx --test extensions/rv-prompts.test.ts",
|
|
68
71
|
"prepublishOnly": "npm run build",
|
|
69
72
|
"pack:dry": "npm pack --dry-run"
|
|
70
73
|
},
|