@boyingliu01/xp-gate 0.41.9 → 0.41.52
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/adapters/gate-3.sh +28 -1
- package/adapters/gate-6-layers.sh +18 -1
- package/bin/xp-gate.js +13 -0
- package/gate-3.sh +28 -1
- package/gate-6-layers.sh +18 -1
- package/gates/python-health.ts +74 -26
- package/gates/test-layers.ts +94 -9
- package/hooks/gate-3.sh +28 -1
- package/hooks/gate-6-layers.sh +18 -1
- package/hooks/gate-entries/gate-11-entry.sh +21 -0
- package/hooks/gate-entries/gate-2-entry.sh +15 -0
- package/hooks/install.sh +15 -3
- package/hooks/pre-commit +90 -13
- package/hooks/pre-push +10 -1
- package/hooks/sprint-gate.sh +101 -13
- package/lib/check-alignment-runner.cjs +97 -0
- package/lib/check.js +6 -0
- package/lib/crap-cli.js +14 -6
- package/lib/delphi-setup.js +13 -0
- package/lib/doctor-tui.js +205 -102
- package/lib/doctor.js +146 -7
- package/lib/gate-runner.js +14 -3
- package/lib/init-install.js +299 -0
- package/lib/init-languages.js +158 -0
- package/lib/init-manifest.js +165 -0
- package/lib/init-md-injection.js +58 -0
- package/lib/init.js +134 -500
- package/lib/install-skill.js +66 -1
- package/lib/layer-baseline.cjs +94 -0
- package/lib/mattpocock-license-verdict.json +7 -0
- package/lib/uninstall-skills.js +140 -0
- package/lib/uninstall.js +41 -100
- package/lib/update-skill.js +9 -1
- package/package.json +3 -1
- package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/claude-code/skills/delphi-review/INSTALL.md +22 -3
- package/plugins/claude-code/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/claude-code/skills/sprint-flow/references/definition-of-done.md +2 -2
- package/plugins/claude-code/skills/sprint-flow/references/phase-3-build.md +1 -1
- package/plugins/claude-code/skills/sprint-flow/references/phase-4-verify.md +2 -2
- package/plugins/claude-code/skills/sprint-flow/references/phase-6-close.md +17 -0
- package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/dsh/lib/delphi-evidence.d.ts +59 -0
- package/plugins/dsh/lib/delphi-evidence.d.ts.map +1 -0
- package/plugins/dsh/lib/delphi-evidence.js +128 -0
- package/plugins/dsh/lib/delphi-finding.d.ts +123 -0
- package/plugins/dsh/lib/delphi-finding.d.ts.map +1 -0
- package/plugins/dsh/lib/delphi-finding.js +332 -0
- package/plugins/dsh/lib/delphi-findings-parse.d.ts +29 -0
- package/plugins/dsh/lib/delphi-findings-parse.d.ts.map +1 -0
- package/plugins/dsh/lib/delphi-findings-parse.js +138 -0
- package/plugins/dsh/lib/delphi-ledger.d.ts +55 -0
- package/plugins/dsh/lib/delphi-ledger.d.ts.map +1 -0
- package/plugins/dsh/lib/delphi-ledger.js +124 -0
- package/plugins/dsh/lib/delphi-run.d.ts +7 -0
- package/plugins/dsh/lib/delphi-run.d.ts.map +1 -1
- package/plugins/dsh/lib/delphi-run.js +48 -18
- package/plugins/dsh/lib/delphi-seats.d.ts +34 -0
- package/plugins/dsh/lib/delphi-seats.d.ts.map +1 -0
- package/plugins/dsh/lib/delphi-seats.js +40 -0
- package/plugins/dsh/lib/evidence.d.ts +21 -0
- package/plugins/dsh/lib/evidence.d.ts.map +1 -1
- package/plugins/dsh/lib/evidence.js +3 -0
- package/plugins/dsh/lib/index.d.ts.map +1 -1
- package/plugins/dsh/lib/index.js +12 -0
- package/plugins/dsh/package.json +1 -1
- package/plugins/dsh/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/dsh/skills/delphi-review/INSTALL.md +22 -3
- package/plugins/dsh/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/dsh/skills/sprint-flow/references/definition-of-done.md +2 -2
- package/plugins/dsh/skills/sprint-flow/references/phase-3-build.md +1 -1
- package/plugins/dsh/skills/sprint-flow/references/phase-4-verify.md +2 -2
- package/plugins/dsh/skills/sprint-flow/references/phase-6-close.md +17 -0
- package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/dsh/src/delphi-evidence.test.ts +100 -0
- package/plugins/dsh/src/delphi-evidence.ts +201 -0
- package/plugins/dsh/src/delphi-finding.test.ts +333 -0
- package/plugins/dsh/src/delphi-finding.ts +446 -0
- package/plugins/dsh/src/delphi-findings-parse.test.ts +100 -0
- package/plugins/dsh/src/delphi-findings-parse.ts +158 -0
- package/plugins/dsh/src/delphi-findings.test.ts +4 -0
- package/plugins/dsh/src/delphi-ledger.test.ts +210 -0
- package/plugins/dsh/src/delphi-ledger.ts +158 -0
- package/plugins/dsh/src/delphi-run.test.ts +71 -68
- package/plugins/dsh/src/delphi-run.ts +80 -24
- package/plugins/dsh/src/delphi-seats.test.ts +117 -0
- package/plugins/dsh/src/delphi-seats.ts +50 -0
- package/plugins/dsh/src/evidence-findings.test.ts +75 -0
- package/plugins/dsh/src/evidence.ts +25 -0
- package/plugins/dsh/src/index.ts +14 -0
- package/plugins/opencode/package.json +1 -1
- package/plugins/opencode/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/opencode/skills/delphi-review/INSTALL.md +22 -3
- package/plugins/opencode/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/opencode/skills/sprint-flow/references/definition-of-done.md +2 -2
- package/plugins/opencode/skills/sprint-flow/references/phase-3-build.md +1 -1
- package/plugins/opencode/skills/sprint-flow/references/phase-4-verify.md +2 -2
- package/plugins/opencode/skills/sprint-flow/references/phase-6-close.md +17 -0
- package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/qoder/plugin.json +1 -1
- package/plugins/qoder/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/qoder/skills/delphi-review/INSTALL.md +22 -3
- package/plugins/qoder/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/qoder/skills/sprint-flow/references/definition-of-done.md +2 -2
- package/plugins/qoder/skills/sprint-flow/references/phase-3-build.md +1 -1
- package/plugins/qoder/skills/sprint-flow/references/phase-4-verify.md +2 -2
- package/plugins/qoder/skills/sprint-flow/references/phase-6-close.md +17 -0
- package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +1 -1
- package/principles/index.ts +50 -1
- package/scripts/delphi-config-read.cjs +43 -6
- package/scripts/delphi-external-review.cjs +69 -12
- package/scripts/delphi-prompts.cjs +47 -1
- package/skills/delphi-review/AGENTS.md +1 -1
- package/skills/delphi-review/INSTALL.md +22 -3
- package/skills/sprint-flow/AGENTS.md +1 -1
- package/skills/sprint-flow/references/definition-of-done.md +2 -2
- package/skills/sprint-flow/references/phase-3-build.md +1 -1
- package/skills/sprint-flow/references/phase-4-verify.md +2 -2
- package/skills/sprint-flow/references/phase-6-close.md +17 -0
- package/skills/test-specification-alignment/AGENTS.md +1 -1
- package/sprint-gate.sh +101 -13
- package/mutation/stryker-types.ts +0 -14
|
@@ -12,15 +12,34 @@ This guide walks you through setting up the Delphi consensus review skill in you
|
|
|
12
12
|
|
|
13
13
|
## Quick Setup (3 steps)
|
|
14
14
|
|
|
15
|
-
### Step 1:
|
|
15
|
+
### Step 1: Create ONE configuration, machine-wide by default
|
|
16
|
+
|
|
17
|
+
Two locations are read, and **a project-root file always wins over the machine-wide
|
|
18
|
+
one**. That precedence is the single most important thing on this page:
|
|
19
|
+
|
|
20
|
+
| Location | Scope | When to use it |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| `~/.config/xp-gate/.delphi-config.json` | every project on this machine | **the normal choice** |
|
|
23
|
+
| `<repo>/.delphi-config.json` | that repo only, and it **overrides** the above | only to pin different seats for one repo |
|
|
16
24
|
|
|
17
25
|
```bash
|
|
18
|
-
#
|
|
19
|
-
|
|
26
|
+
# Recommended: one config for the whole machine.
|
|
27
|
+
mkdir -p ~/.config/xp-gate
|
|
28
|
+
cp skills/delphi-review/.delphi-config.json.example ~/.config/xp-gate/.delphi-config.json
|
|
20
29
|
```
|
|
21
30
|
|
|
31
|
+
> **If you copy it into the repo root instead, every later edit to the machine-wide
|
|
32
|
+
> config becomes a no-op for that repo.** `xp-gate doctor delphi` reports this as
|
|
33
|
+
> `Delphi config shadow (#541)`; deleting the repo-root copy makes it go away. Do not
|
|
34
|
+
> put a copy in every project "to be safe" — that is what creates the shadow. Measured
|
|
35
|
+
> 2026-11-17: a consumer followed the old version of this page, then fixed the global
|
|
36
|
+
> seats and kept getting the old ones, because the repo copy silently won.
|
|
37
|
+
|
|
22
38
|
This file maps abstract expert roles to agent names. You typically don't need to edit this unless you want custom agent names.
|
|
23
39
|
|
|
40
|
+
Pass `--config <path>` to point at a specific file for one run; a relative path that
|
|
41
|
+
does not exist in the current directory falls back to the machine-wide config.
|
|
42
|
+
|
|
24
43
|
### Step 2: Add agent definitions to opencode.json
|
|
25
44
|
|
|
26
45
|
Copy the `agent` block from `skills/delphi-review/opencode.json.delphi.example` into your `opencode.json`.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.41.
|
|
6
|
+
**Version:** 0.41.52.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
**6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; each REQ starts from a clean context instead of accumulating one across REQs). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
|
|
18
18
|
| # | 条目 | 判据(必须能指出位置) |
|
|
19
19
|
|---|------|------------------------|
|
|
20
|
-
| 1 | **需求可追溯** | `specification.yaml` 有 REQ + AC;测试文件带 `@covers AC-xxx
|
|
20
|
+
| 1 | **需求可追溯** | `specification.yaml` 有 REQ + AC;测试文件带 `@covers AC-xxx`。**(xp-gate 自身仓库额外要求)** `scripts/__tests__/ac-reference-guard.test.cjs` 通过;你的项目用等价的「AC 必须存在于 spec」检查 |
|
|
21
21
|
| 2 | **测试先行** | 实现前存在失败的测试;或说明为何不适用(纯文档/配置) |
|
|
22
22
|
| 3 | **测试真的能失败** | 至少一个变异体/破坏被测试抓住。「测试通过」在从未运行时和「功能正确」无法区分 |
|
|
23
23
|
| 4 | **验证命令已运行** | 记录实际命令与输出,不是「应该是绿的」。CI 命令与本地命令一致 |
|
|
24
24
|
| 5 | **门禁未降级** | 无 `--no-verify`;无新增基线额度来吸收本次改动自身的告警 |
|
|
25
|
-
| 6 | **镜像已同步** | 改了 `githooks/`/`skills/`/`plugins/` → `bash scripts/check-hook-mirror.sh` 输出 PASS |
|
|
25
|
+
| 6 | **镜像已同步** | **(仅 xp-gate 自身仓库)** 改了 `githooks/`/`skills/`/`plugins/` → `bash scripts/check-hook-mirror.sh` 输出 PASS。你的项目若没有镜像树,本条不适用——填「不适用」而不是发明等价检查 |
|
|
26
26
|
| 7 | **不做未经要求的相邻改动** | 每行改动可追溯到本 REQ;顺手发现的无关死代码只提及不删除 |
|
|
27
27
|
| 8 | **已知限制已写明** | 没做的部分、以及为什么没做,写进 issue/提交,而不是留空 |
|
|
28
28
|
| 9 | **文档与实现一致** | 门禁数量、CLI 表、阈值等出现在多处的事实同步更新(见 `AGENTS.md` "Known Drift") |
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
| 4 | **Gate 4 Principles** | 14 条 Clean Code/SOLID 规则,任一 error/warning 即拦(按 `.principlesrc`) | `xp-gate check 4 <file>`;避免超长参数表、空 catch、`as any` |
|
|
39
39
|
| 5 | **Gate 1 Lint** | 适配器 lint 任一 error | 提交前跑一次项目 lint;不要留未用变量/导入 |
|
|
40
40
|
| 6 | **Gate 5 测试** | 测试全绿 + 覆盖率 ≥80%(新 .ts/.tsx 无测试直接 BLOCK) | 新代码先写测试(TDD);`npx vitest run <file>` |
|
|
41
|
-
| 7 | **mirror/sync 纪律** | 改 `githooks/` 或 `skills/` 后必须 `node src/npm-package/scripts/sync-package-content.js --fix` 且 `bash scripts/check-hook-mirror.sh` 报 PASS | 忘了同步会在 pre-push 的 mirror
|
|
41
|
+
| 7 | **mirror/sync 纪律** | **(仅 xp-gate 自身仓库)** 改 `githooks/` 或 `skills/` 后必须 `node src/npm-package/scripts/sync-package-content.js --fix` 且 `bash scripts/check-hook-mirror.sh` 报 PASS | 忘了同步会在 pre-push 的 mirror 校验被打回;无镜像树的项目本条不适用 |
|
|
42
42
|
|
|
43
43
|
**权威清单用 `xp-gate gate-rules` 现取,不要背上面这张表。** 上表是手抄的,阈值真正定义在
|
|
44
44
|
`.principlesrc`、`jscpd.conf.json` 和 `githooks/pre-commit` 里。`xp-gate gate-rules` 从那些
|
|
@@ -148,12 +148,12 @@ ELSE:
|
|
|
148
148
|
|
|
149
149
|
| # | 条目 | 在 VERIFY 的检查方式 |
|
|
150
150
|
|---|------|----------------------|
|
|
151
|
-
| 1 | 需求可追溯 | `npx vitest run scripts/__tests__/ac-reference-guard.test.cjs`
|
|
151
|
+
| 1 | 需求可追溯 | 测试引用的 AC 都在 spec 里。**(xp-gate 自身仓库额外要求)** `npx vitest run scripts/__tests__/ac-reference-guard.test.cjs` 通过;你的项目用等价的自带检查 |
|
|
152
152
|
| 2 | 测试先行 | 有 RED 证据(提交历史或记录),或说明为何不适用 |
|
|
153
153
|
| 3 | **测试真的能失败** | 至少证明过一个变异体会被抓住——「测试通过」在从未运行时与「功能正确」无法区分 |
|
|
154
154
|
| 4 | 验证命令已运行 | 记录实际命令 + 输出,不是「应该是绿的」 |
|
|
155
155
|
| 5 | 门禁未降级 | 无 `--no-verify`;无为了本次改动新增的基线额度 |
|
|
156
|
-
| 6 | 镜像已同步 | `bash scripts/check-hook-mirror.sh` → PASS |
|
|
156
|
+
| 6 | 镜像已同步 | **(仅 xp-gate 自身仓库)** `bash scripts/check-hook-mirror.sh` → PASS;无镜像树的项目本条不适用 |
|
|
157
157
|
|
|
158
158
|
第 5 项值得单独说明:**加基线额度来吸收自己刚产生的告警,等于把门禁关掉一次。**
|
|
159
159
|
`.warnings-baseline.json` 只应记录「改动之前就存在」的告警。
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
|
|
24
24
|
**Purpose**: `.sprint-state/` is gitignored and lives inside the worktree. When the worktree is removed during CLEANUP, all sprint state is lost. This step copies it into the main repository before cleanup.
|
|
25
25
|
|
|
26
|
+
**`.xp-gate/` goes too (#836).** The tool writes its own audit surface into a DIFFERENT gitignored directory inside the same worktree: the `--skip-evidence` REASON, the gate-result snapshots, and the quality reports retro reads. Backing up only `.sprint-state/` loses them at the same moment, and the loss is silent -- the sprint closes looking complete while the record of *why* a gate was skipped no longer exists anywhere. #318 extended this list to cover state; it never covered audit.
|
|
27
|
+
|
|
28
|
+
Backup BOTH directories. A missing `.xp-gate/` is not an error (a sprint may never have triggered a gate), so the copy is conditional.
|
|
29
|
+
|
|
26
30
|
**Execution** (immediately after SHIP→CLOSE GATE passes):
|
|
27
31
|
|
|
28
32
|
```bash
|
|
@@ -34,14 +38,27 @@ BACKUP_DIR=".sprint-history/${SPRINT_ID}"
|
|
|
34
38
|
mkdir -p "$BACKUP_DIR"
|
|
35
39
|
cp -r .sprint-state/* "$BACKUP_DIR/"
|
|
36
40
|
|
|
41
|
+
# 2b. Audit surface (#836) — gitignored, worktree-local, and NOT covered by the
|
|
42
|
+
# copy above. Missing is fine; losing a present one is not.
|
|
43
|
+
if [ -d .xp-gate ]; then
|
|
44
|
+
mkdir -p "$BACKUP_DIR/xp-gate"
|
|
45
|
+
cp -r .xp-gate/* "$BACKUP_DIR/xp-gate/"
|
|
46
|
+
fi
|
|
47
|
+
|
|
37
48
|
# 3. Verify backup
|
|
38
49
|
ls "$BACKUP_DIR/sprint-state.json" && echo "✅ Sprint state backed up to $BACKUP_DIR"
|
|
50
|
+
if [ -d .xp-gate ]; then
|
|
51
|
+
ls "$BACKUP_DIR/xp-gate/audit.jsonl" \
|
|
52
|
+
&& echo "✅ Audit surface backed up to $BACKUP_DIR/xp-gate/" \
|
|
53
|
+
|| echo "⚠️ .xp-gate/ existed but audit.jsonl was not copied"
|
|
54
|
+
fi
|
|
39
55
|
```
|
|
40
56
|
|
|
41
57
|
**GATE CHECK**:
|
|
42
58
|
```
|
|
43
59
|
[BACKUP] sprint-state.json copied ✓
|
|
44
60
|
[BACKUP] phase-outputs/ preserved ✓
|
|
61
|
+
[BACKUP] .xp-gate/ audit surface copied ✓ (or: absent, nothing to copy)
|
|
45
62
|
```
|
|
46
63
|
|
|
47
64
|
**Output**: `.sprint-history/<sprint-id>/` contains full sprint state, safely outside the worktree.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.41.
|
|
6
|
+
**Version:** 0.41.52.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xp-gate",
|
|
3
|
-
"version": "0.41.
|
|
3
|
+
"version": "0.41.52",
|
|
4
4
|
"displayName": "XP-Gate",
|
|
5
5
|
"description": "Extreme Programming quality gates + AI workflow skills for Qoder. Includes 12 pre-commit gates (Gate 0-11), 8 pre-push gates, Sprint Flow (6 phases), and Delphi multi-expert review (>=90% consensus).",
|
|
6
6
|
"author": {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.41.
|
|
6
|
+
**Version:** 0.41.52.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
|
|
@@ -12,15 +12,34 @@ This guide walks you through setting up the Delphi consensus review skill in you
|
|
|
12
12
|
|
|
13
13
|
## Quick Setup (3 steps)
|
|
14
14
|
|
|
15
|
-
### Step 1:
|
|
15
|
+
### Step 1: Create ONE configuration, machine-wide by default
|
|
16
|
+
|
|
17
|
+
Two locations are read, and **a project-root file always wins over the machine-wide
|
|
18
|
+
one**. That precedence is the single most important thing on this page:
|
|
19
|
+
|
|
20
|
+
| Location | Scope | When to use it |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| `~/.config/xp-gate/.delphi-config.json` | every project on this machine | **the normal choice** |
|
|
23
|
+
| `<repo>/.delphi-config.json` | that repo only, and it **overrides** the above | only to pin different seats for one repo |
|
|
16
24
|
|
|
17
25
|
```bash
|
|
18
|
-
#
|
|
19
|
-
|
|
26
|
+
# Recommended: one config for the whole machine.
|
|
27
|
+
mkdir -p ~/.config/xp-gate
|
|
28
|
+
cp skills/delphi-review/.delphi-config.json.example ~/.config/xp-gate/.delphi-config.json
|
|
20
29
|
```
|
|
21
30
|
|
|
31
|
+
> **If you copy it into the repo root instead, every later edit to the machine-wide
|
|
32
|
+
> config becomes a no-op for that repo.** `xp-gate doctor delphi` reports this as
|
|
33
|
+
> `Delphi config shadow (#541)`; deleting the repo-root copy makes it go away. Do not
|
|
34
|
+
> put a copy in every project "to be safe" — that is what creates the shadow. Measured
|
|
35
|
+
> 2026-11-17: a consumer followed the old version of this page, then fixed the global
|
|
36
|
+
> seats and kept getting the old ones, because the repo copy silently won.
|
|
37
|
+
|
|
22
38
|
This file maps abstract expert roles to agent names. You typically don't need to edit this unless you want custom agent names.
|
|
23
39
|
|
|
40
|
+
Pass `--config <path>` to point at a specific file for one run; a relative path that
|
|
41
|
+
does not exist in the current directory falls back to the machine-wide config.
|
|
42
|
+
|
|
24
43
|
### Step 2: Add agent definitions to opencode.json
|
|
25
44
|
|
|
26
45
|
Copy the `agent` block from `skills/delphi-review/opencode.json.delphi.example` into your `opencode.json`.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.41.
|
|
6
|
+
**Version:** 0.41.52.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
**6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; each REQ starts from a clean context instead of accumulating one across REQs). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
|
|
18
18
|
| # | 条目 | 判据(必须能指出位置) |
|
|
19
19
|
|---|------|------------------------|
|
|
20
|
-
| 1 | **需求可追溯** | `specification.yaml` 有 REQ + AC;测试文件带 `@covers AC-xxx
|
|
20
|
+
| 1 | **需求可追溯** | `specification.yaml` 有 REQ + AC;测试文件带 `@covers AC-xxx`。**(xp-gate 自身仓库额外要求)** `scripts/__tests__/ac-reference-guard.test.cjs` 通过;你的项目用等价的「AC 必须存在于 spec」检查 |
|
|
21
21
|
| 2 | **测试先行** | 实现前存在失败的测试;或说明为何不适用(纯文档/配置) |
|
|
22
22
|
| 3 | **测试真的能失败** | 至少一个变异体/破坏被测试抓住。「测试通过」在从未运行时和「功能正确」无法区分 |
|
|
23
23
|
| 4 | **验证命令已运行** | 记录实际命令与输出,不是「应该是绿的」。CI 命令与本地命令一致 |
|
|
24
24
|
| 5 | **门禁未降级** | 无 `--no-verify`;无新增基线额度来吸收本次改动自身的告警 |
|
|
25
|
-
| 6 | **镜像已同步** | 改了 `githooks/`/`skills/`/`plugins/` → `bash scripts/check-hook-mirror.sh` 输出 PASS |
|
|
25
|
+
| 6 | **镜像已同步** | **(仅 xp-gate 自身仓库)** 改了 `githooks/`/`skills/`/`plugins/` → `bash scripts/check-hook-mirror.sh` 输出 PASS。你的项目若没有镜像树,本条不适用——填「不适用」而不是发明等价检查 |
|
|
26
26
|
| 7 | **不做未经要求的相邻改动** | 每行改动可追溯到本 REQ;顺手发现的无关死代码只提及不删除 |
|
|
27
27
|
| 8 | **已知限制已写明** | 没做的部分、以及为什么没做,写进 issue/提交,而不是留空 |
|
|
28
28
|
| 9 | **文档与实现一致** | 门禁数量、CLI 表、阈值等出现在多处的事实同步更新(见 `AGENTS.md` "Known Drift") |
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
| 4 | **Gate 4 Principles** | 14 条 Clean Code/SOLID 规则,任一 error/warning 即拦(按 `.principlesrc`) | `xp-gate check 4 <file>`;避免超长参数表、空 catch、`as any` |
|
|
39
39
|
| 5 | **Gate 1 Lint** | 适配器 lint 任一 error | 提交前跑一次项目 lint;不要留未用变量/导入 |
|
|
40
40
|
| 6 | **Gate 5 测试** | 测试全绿 + 覆盖率 ≥80%(新 .ts/.tsx 无测试直接 BLOCK) | 新代码先写测试(TDD);`npx vitest run <file>` |
|
|
41
|
-
| 7 | **mirror/sync 纪律** | 改 `githooks/` 或 `skills/` 后必须 `node src/npm-package/scripts/sync-package-content.js --fix` 且 `bash scripts/check-hook-mirror.sh` 报 PASS | 忘了同步会在 pre-push 的 mirror
|
|
41
|
+
| 7 | **mirror/sync 纪律** | **(仅 xp-gate 自身仓库)** 改 `githooks/` 或 `skills/` 后必须 `node src/npm-package/scripts/sync-package-content.js --fix` 且 `bash scripts/check-hook-mirror.sh` 报 PASS | 忘了同步会在 pre-push 的 mirror 校验被打回;无镜像树的项目本条不适用 |
|
|
42
42
|
|
|
43
43
|
**权威清单用 `xp-gate gate-rules` 现取,不要背上面这张表。** 上表是手抄的,阈值真正定义在
|
|
44
44
|
`.principlesrc`、`jscpd.conf.json` 和 `githooks/pre-commit` 里。`xp-gate gate-rules` 从那些
|
|
@@ -148,12 +148,12 @@ ELSE:
|
|
|
148
148
|
|
|
149
149
|
| # | 条目 | 在 VERIFY 的检查方式 |
|
|
150
150
|
|---|------|----------------------|
|
|
151
|
-
| 1 | 需求可追溯 | `npx vitest run scripts/__tests__/ac-reference-guard.test.cjs`
|
|
151
|
+
| 1 | 需求可追溯 | 测试引用的 AC 都在 spec 里。**(xp-gate 自身仓库额外要求)** `npx vitest run scripts/__tests__/ac-reference-guard.test.cjs` 通过;你的项目用等价的自带检查 |
|
|
152
152
|
| 2 | 测试先行 | 有 RED 证据(提交历史或记录),或说明为何不适用 |
|
|
153
153
|
| 3 | **测试真的能失败** | 至少证明过一个变异体会被抓住——「测试通过」在从未运行时与「功能正确」无法区分 |
|
|
154
154
|
| 4 | 验证命令已运行 | 记录实际命令 + 输出,不是「应该是绿的」 |
|
|
155
155
|
| 5 | 门禁未降级 | 无 `--no-verify`;无为了本次改动新增的基线额度 |
|
|
156
|
-
| 6 | 镜像已同步 | `bash scripts/check-hook-mirror.sh` → PASS |
|
|
156
|
+
| 6 | 镜像已同步 | **(仅 xp-gate 自身仓库)** `bash scripts/check-hook-mirror.sh` → PASS;无镜像树的项目本条不适用 |
|
|
157
157
|
|
|
158
158
|
第 5 项值得单独说明:**加基线额度来吸收自己刚产生的告警,等于把门禁关掉一次。**
|
|
159
159
|
`.warnings-baseline.json` 只应记录「改动之前就存在」的告警。
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
|
|
24
24
|
**Purpose**: `.sprint-state/` is gitignored and lives inside the worktree. When the worktree is removed during CLEANUP, all sprint state is lost. This step copies it into the main repository before cleanup.
|
|
25
25
|
|
|
26
|
+
**`.xp-gate/` goes too (#836).** The tool writes its own audit surface into a DIFFERENT gitignored directory inside the same worktree: the `--skip-evidence` REASON, the gate-result snapshots, and the quality reports retro reads. Backing up only `.sprint-state/` loses them at the same moment, and the loss is silent -- the sprint closes looking complete while the record of *why* a gate was skipped no longer exists anywhere. #318 extended this list to cover state; it never covered audit.
|
|
27
|
+
|
|
28
|
+
Backup BOTH directories. A missing `.xp-gate/` is not an error (a sprint may never have triggered a gate), so the copy is conditional.
|
|
29
|
+
|
|
26
30
|
**Execution** (immediately after SHIP→CLOSE GATE passes):
|
|
27
31
|
|
|
28
32
|
```bash
|
|
@@ -34,14 +38,27 @@ BACKUP_DIR=".sprint-history/${SPRINT_ID}"
|
|
|
34
38
|
mkdir -p "$BACKUP_DIR"
|
|
35
39
|
cp -r .sprint-state/* "$BACKUP_DIR/"
|
|
36
40
|
|
|
41
|
+
# 2b. Audit surface (#836) — gitignored, worktree-local, and NOT covered by the
|
|
42
|
+
# copy above. Missing is fine; losing a present one is not.
|
|
43
|
+
if [ -d .xp-gate ]; then
|
|
44
|
+
mkdir -p "$BACKUP_DIR/xp-gate"
|
|
45
|
+
cp -r .xp-gate/* "$BACKUP_DIR/xp-gate/"
|
|
46
|
+
fi
|
|
47
|
+
|
|
37
48
|
# 3. Verify backup
|
|
38
49
|
ls "$BACKUP_DIR/sprint-state.json" && echo "✅ Sprint state backed up to $BACKUP_DIR"
|
|
50
|
+
if [ -d .xp-gate ]; then
|
|
51
|
+
ls "$BACKUP_DIR/xp-gate/audit.jsonl" \
|
|
52
|
+
&& echo "✅ Audit surface backed up to $BACKUP_DIR/xp-gate/" \
|
|
53
|
+
|| echo "⚠️ .xp-gate/ existed but audit.jsonl was not copied"
|
|
54
|
+
fi
|
|
39
55
|
```
|
|
40
56
|
|
|
41
57
|
**GATE CHECK**:
|
|
42
58
|
```
|
|
43
59
|
[BACKUP] sprint-state.json copied ✓
|
|
44
60
|
[BACKUP] phase-outputs/ preserved ✓
|
|
61
|
+
[BACKUP] .xp-gate/ audit surface copied ✓ (or: absent, nothing to copy)
|
|
45
62
|
```
|
|
46
63
|
|
|
47
64
|
**Output**: `.sprint-history/<sprint-id>/` contains full sprint state, safely outside the worktree.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.41.
|
|
6
|
+
**Version:** 0.41.52.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|
package/principles/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
1
2
|
import { analyze, getAdapterForFile } from './analyzer';
|
|
2
3
|
import { formatConsole, formatJSON, formatSARIF } from './reporter';
|
|
3
4
|
import { loadConfig, setActiveConfig } from './config';
|
|
@@ -27,7 +28,55 @@ const VALID_FORMATS: readonly string[] = ['json', 'console', 'sarif'] as const;
|
|
|
27
28
|
* principles.sarif (#623).
|
|
28
29
|
*/
|
|
29
30
|
function splitFileList(value: string): string[] {
|
|
30
|
-
|
|
31
|
+
// #821: `@path` means "the list is in this file". `lib/principles.js` writes one
|
|
32
|
+
// whenever the inline list would exceed ARGV_CHAR_BUDGET (6000 chars) and passes
|
|
33
|
+
// `--files @<tmpfile>`, documenting it as the engine's own hand-off form -- which
|
|
34
|
+
// the engine never implemented. The literal `@/tmp/...txt` matched no file, so the
|
|
35
|
+
// run checked nothing and reported "✓ No violations found / Files checked: 0"
|
|
36
|
+
// with exit 0. Measured: 5 files -> 25 violations, 60 -> 217, 134 -> clean.
|
|
37
|
+
//
|
|
38
|
+
// This is #623 one level down: a separator the producer emitted and the consumer
|
|
39
|
+
// did not read. The failure was silent both times.
|
|
40
|
+
// The whole decision lives in the helper: this function's ratchet is 1, which
|
|
41
|
+
// means no branch of its own, and the branch IS the subject here.
|
|
42
|
+
return parseFileArgument(value);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Split a `--files` value, resolving the `@list` form first.
|
|
47
|
+
*
|
|
48
|
+
* One place for both steps: a list file and an inline list differ only in where the
|
|
49
|
+
* text comes from, so the source is resolved and then split once.
|
|
50
|
+
*
|
|
51
|
+
* @param value the raw `--files` argument
|
|
52
|
+
* @returns the paths it names
|
|
53
|
+
*/
|
|
54
|
+
function parseFileArgument(value: string): string[] {
|
|
55
|
+
const trimmed = value.trim();
|
|
56
|
+
const text = trimmed.startsWith('@') ? readFileList(trimmed.slice(1)) : trimmed;
|
|
57
|
+
return text.split(/\s+/).filter(f => f.trim());
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The paths listed in a file, one per line or space-separated.
|
|
62
|
+
*
|
|
63
|
+
* Throws rather than returning []: an unreadable list is the difference between
|
|
64
|
+
* "nothing to check" and "the list never arrived", and returning an empty array here
|
|
65
|
+
* is exactly the silent no-op this form exists to prevent.
|
|
66
|
+
*
|
|
67
|
+
* @param listPath file written by the CLI caller
|
|
68
|
+
* @returns the paths it names
|
|
69
|
+
*/
|
|
70
|
+
function readFileList(listPath: string): string {
|
|
71
|
+
let text: string;
|
|
72
|
+
try {
|
|
73
|
+
text = fs.readFileSync(listPath, 'utf-8');
|
|
74
|
+
} catch (err) {
|
|
75
|
+
throw new Error(
|
|
76
|
+
`--files @${listPath}: cannot read the file list (${err instanceof Error ? err.message : String(err)})`,
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
return text;
|
|
31
80
|
}
|
|
32
81
|
|
|
33
82
|
/**
|
|
@@ -155,15 +155,52 @@ function resolveProviderCredentials(profile, profileName) {
|
|
|
155
155
|
* model id the gateway does not know -- and the error would name a value that LOOKS
|
|
156
156
|
* right, which is the worst kind to debug.
|
|
157
157
|
*/
|
|
158
|
-
function normalizeExperts(experts) {
|
|
158
|
+
function normalizeExperts(experts, warnings) {
|
|
159
159
|
return Object.fromEntries(
|
|
160
|
-
Object.entries(experts || {}).map(([role, expert]) =>
|
|
161
|
-
role,
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
Object.entries(experts || {}).map(([role, expert]) => {
|
|
161
|
+
reportUnknownSeatKeys(role, expert, warnings);
|
|
162
|
+
return [
|
|
163
|
+
role,
|
|
164
|
+
{ ...expert, model: typeof expert.model === 'string' ? expert.model.trim() : expert.model },
|
|
165
|
+
];
|
|
166
|
+
}),
|
|
164
167
|
);
|
|
165
168
|
}
|
|
166
169
|
|
|
170
|
+
/**
|
|
171
|
+
* Keys a seat is ALLOWED to carry -- the ones something actually reads.
|
|
172
|
+
*
|
|
173
|
+
* Deliberately short. `provider` selects the gateway, `model` is the requested id,
|
|
174
|
+
* `max_tokens` bounds the reply. Anything else is a claim nothing checks, and
|
|
175
|
+
* reporting it is the whole point (#880).
|
|
176
|
+
*/
|
|
177
|
+
const READ_SEAT_KEYS = new Set(['provider', 'model', 'max_tokens']);
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Report seat keys that nothing reads (#880).
|
|
181
|
+
*
|
|
182
|
+
* Measured: every seat in a real config carried `expected_echo`, whose value had
|
|
183
|
+
* already drifted away from the `model` beside it. `grep -r expected_echo .` found
|
|
184
|
+
* no reader and `git log -S` found no commit -- the field never existed here. But
|
|
185
|
+
* the config LOOKED like it asserted "this seat must resolve to that model", and a
|
|
186
|
+
* reviewer reading the evidence's `resolved_model` would take it as confirmation.
|
|
187
|
+
*
|
|
188
|
+
* The key is REPORTED, not dropped: the reader needs to see the thing the warning
|
|
189
|
+
* names, and silently rewriting somebody's config is a worse surprise than the
|
|
190
|
+
* warning itself.
|
|
191
|
+
*
|
|
192
|
+
* @param {string} role the seat name, for the message
|
|
193
|
+
* @param {object} expert the seat as written
|
|
194
|
+
* @param {string[]} warnings collected by the caller
|
|
195
|
+
*/
|
|
196
|
+
function reportUnknownSeatKeys(role, expert, warnings) {
|
|
197
|
+
if (!warnings || !expert || typeof expert !== 'object') return;
|
|
198
|
+
for (const key of Object.keys(expert)) {
|
|
199
|
+
if (READ_SEAT_KEYS.has(key)) continue;
|
|
200
|
+
warnings.push(`unknown_seat_key:${role}.${key}`);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
167
204
|
/**
|
|
168
205
|
* The consensus settings, clamped to what the review can honestly claim.
|
|
169
206
|
*
|
|
@@ -203,7 +240,7 @@ function readConfig(configPath, profileOverride) {
|
|
|
203
240
|
return {
|
|
204
241
|
active_profile: profileName,
|
|
205
242
|
providers: resolveProviderCredentials(profile, profileName),
|
|
206
|
-
experts: normalizeExperts(profile.experts),
|
|
243
|
+
experts: normalizeExperts(profile.experts, warnings),
|
|
207
244
|
consensus: resolveConsensus(raw, warnings),
|
|
208
245
|
warnings,
|
|
209
246
|
};
|
|
@@ -225,11 +225,11 @@ const { converseWithTools } = require('./delphi-repo-tools.cjs');
|
|
|
225
225
|
const { extractJsonFromResponse } = require('./delphi-json-extract.cjs');
|
|
226
226
|
|
|
227
227
|
// ── System prompt templates ────────────────────────────────────────────
|
|
228
|
-
const { SYSTEM_PROMPTS, MODE_FOCUS_PROMPTS } = require('./delphi-prompts.cjs');
|
|
228
|
+
const { SYSTEM_PROMPTS, MODE_FOCUS_PROMPTS, toolGuidance } = require('./delphi-prompts.cjs');
|
|
229
229
|
|
|
230
230
|
function buildSystemPrompt(role, mode = 'design') {
|
|
231
231
|
const rolePrompt = SYSTEM_PROMPTS[role] || SYSTEM_PROMPTS.architecture;
|
|
232
|
-
return `${rolePrompt}${MODE_FOCUS_PROMPTS[mode] || ''}`;
|
|
232
|
+
return `${rolePrompt}${MODE_FOCUS_PROMPTS[mode] || ''}${toolGuidance(mode)}`;
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
// ── User prompt construction ───────────────────────────────────────────
|
|
@@ -584,6 +584,57 @@ function withRepoTools(providerConfig, model, systemPrompt, userPrompt, options)
|
|
|
584
584
|
});
|
|
585
585
|
}
|
|
586
586
|
|
|
587
|
+
/**
|
|
588
|
+
* Where a pre-response failure happened, as a fixed token (#844).
|
|
589
|
+
*
|
|
590
|
+
* The vocabulary is closed on purpose. This value reaches the evidence file, so it
|
|
591
|
+
* must not be able to carry provider text, hostnames or tokens -- the same reason
|
|
592
|
+
* the raw cause is not recorded at all. Only a classification survives.
|
|
593
|
+
*
|
|
594
|
+
* The distinction is the one an operator needs: a connection that never opened
|
|
595
|
+
* points at the network, a TLS failure at certificates or an inspection proxy, and
|
|
596
|
+
* a socket that closed mid-flight at the provider or a gateway timeout.
|
|
597
|
+
*
|
|
598
|
+
* @param {unknown} err whatever `fetch` threw
|
|
599
|
+
* @returns {'connect_dns'|'tls'|'connection_reset'|'socket_hangup'|'unknown'}
|
|
600
|
+
*/
|
|
601
|
+
function classifyDropStage(err) {
|
|
602
|
+
const code = err && typeof err === 'object' && typeof err.code === 'string' ? err.code : '';
|
|
603
|
+
const name = err && typeof err === 'object' && typeof err.name === 'string' ? err.name : '';
|
|
604
|
+
// A table, not a chain of ifs: the vocabulary is closed, so the mapping can be
|
|
605
|
+
// one. Written as a chain of nine conditions this scored CCN 17 against a block
|
|
606
|
+
// threshold of 10 -- the branch count was measuring the number of error codes,
|
|
607
|
+
// which is data, not logic.
|
|
608
|
+
const byName = {
|
|
609
|
+
ENOTFOUND: 'connect_dns',
|
|
610
|
+
EAI_AGAIN: 'connect_dns',
|
|
611
|
+
EAI_NODATA: 'connect_dns',
|
|
612
|
+
ECONNREFUSED: 'connect_dns',
|
|
613
|
+
ECONNRESET: 'connection_reset',
|
|
614
|
+
ECONNABORTED: 'socket_hangup',
|
|
615
|
+
EPIPE: 'socket_hangup',
|
|
616
|
+
};
|
|
617
|
+
if (byName[code]) return byName[code];
|
|
618
|
+
// TLS failures arrive as OpenSSL codes (CERT_HAS_EXPIRED,
|
|
619
|
+
// DEPTH_ZERO_SELF_SIGNED_CERT, ...) whose variety is open-ended, so this one
|
|
620
|
+
// stays a pattern rather than becoming a list.
|
|
621
|
+
if (/CERT|TLS|SSL/i.test(code) || /CERT|TLS|SSL/i.test(name)) return 'tls';
|
|
622
|
+
return 'unknown';
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
/** The request init for one provider call. Extracted so callModelAPI stays readable. */
|
|
626
|
+
function buildRequestInit(providerConfig, body, signal) {
|
|
627
|
+
return {
|
|
628
|
+
method: 'POST',
|
|
629
|
+
headers: {
|
|
630
|
+
'Content-Type': 'application/json',
|
|
631
|
+
'Authorization': `Bearer ${providerConfig.api_key}`,
|
|
632
|
+
},
|
|
633
|
+
body: JSON.stringify(body),
|
|
634
|
+
signal,
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
|
|
587
638
|
async function callModelAPI(providerConfig, model, systemPrompt, userPrompt, options = {}) {
|
|
588
639
|
const url = `${providerConfig.base_url.replace(/\/$/, '')}/chat/completions`;
|
|
589
640
|
const body = buildChatBody(model, systemPrompt, userPrompt);
|
|
@@ -596,15 +647,7 @@ async function callModelAPI(providerConfig, model, systemPrompt, userPrompt, opt
|
|
|
596
647
|
let responseReceived = false;
|
|
597
648
|
|
|
598
649
|
try {
|
|
599
|
-
const response = await fetch(url,
|
|
600
|
-
method: 'POST',
|
|
601
|
-
headers: {
|
|
602
|
-
'Content-Type': 'application/json',
|
|
603
|
-
'Authorization': `Bearer ${providerConfig.api_key}`,
|
|
604
|
-
},
|
|
605
|
-
body: JSON.stringify(body),
|
|
606
|
-
signal: controller.signal,
|
|
607
|
-
});
|
|
650
|
+
const response = await fetch(url, buildRequestInit(providerConfig, body, controller.signal));
|
|
608
651
|
responseReceived = true;
|
|
609
652
|
|
|
610
653
|
return await classifyHttpResponse(response);
|
|
@@ -621,7 +664,20 @@ async function callModelAPI(providerConfig, model, systemPrompt, userPrompt, opt
|
|
|
621
664
|
// `error_kind` is what classifySeatFailure keys on — matching the human
|
|
622
665
|
// message would make every future wording change silently disable the
|
|
623
666
|
// size-ceiling classification (#414 R1 FC-01).
|
|
624
|
-
|
|
667
|
+
//
|
|
668
|
+
// #844: "Network error." is not actionable, and the report that prompted this
|
|
669
|
+
// could not tell a gateway queue from a TLS failure from a provider dropping
|
|
670
|
+
// the connection before any header. The cause itself still must not be
|
|
671
|
+
// recorded, so what is added is a CLASSIFICATION of it -- derived here, from
|
|
672
|
+
// the error, and reduced to a fixed vocabulary so no provider text can ride
|
|
673
|
+
// along. `cause_stage` answers "where did it break"; nothing else is kept.
|
|
674
|
+
|
|
675
|
+
return {
|
|
676
|
+
error: true,
|
|
677
|
+
error_kind: 'pre_response_drop',
|
|
678
|
+
message: 'Network error.',
|
|
679
|
+
cause_stage: classifyDropStage(err),
|
|
680
|
+
};
|
|
625
681
|
} finally {
|
|
626
682
|
clearTimeout(timeout);
|
|
627
683
|
}
|
|
@@ -918,6 +974,7 @@ if (require.main !== module) {
|
|
|
918
974
|
SCHEMA_RESTATEMENT,
|
|
919
975
|
checkNodeVersion,
|
|
920
976
|
callModelAPI,
|
|
977
|
+
classifyDropStage,
|
|
921
978
|
callWithRetry,
|
|
922
979
|
parseExpertVerdict,
|
|
923
980
|
buildReviewOutput,
|
|
@@ -45,11 +45,57 @@ const SYSTEM_PROMPTS = {
|
|
|
45
45
|
输出要求:返回结构化 JSON,包含 verdict (APPROVED/REQUEST_CHANGES/REJECTED)、confidence (1-10,整数,10 为最高)、summary (字符串)。critical_issues、major_concerns、minor_concerns 必须是字符串数组(string[]),每项是一句自包含的完整描述(可加 "FC-01: " 前缀,但整体必须是字符串,不是对象)。不要把问题写成 {id, title, description} 对象。`,
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* What the seat may DO, as opposed to what it is asked to judge.
|
|
50
|
+
*
|
|
51
|
+
* The repository tools shipped in 5a38938a but no role prompt ever mentioned
|
|
52
|
+
* them, so whether a seat looked things up instead of inferring came down to the
|
|
53
|
+
* model's own initiative. Measured: the feasibility seat approved 0 of 29
|
|
54
|
+
* batches, nearly every rejection a claim that code had DISAPPEARED -- all of it
|
|
55
|
+
* still present in files the batch did not include.
|
|
56
|
+
*
|
|
57
|
+
* Naming the tools here is the difference between "can look" and "does look".
|
|
58
|
+
*/
|
|
59
|
+
const REPO_TOOL_GUIDANCE = `
|
|
60
|
+
|
|
61
|
+
你可以调用三个只读工具查看仓库(路径限于仓库根内):
|
|
62
|
+
- read_file(path, start_line?, end_line?) — 读取文件或行区间
|
|
63
|
+
- grep(pattern, glob?) — 按正则搜索,返回 文件:行号: 内容
|
|
64
|
+
- list_files(dir, glob?) — 列目录或按 glob 过滤
|
|
65
|
+
|
|
66
|
+
**在断言之前先用它们查证。** 尤其是以下情况:
|
|
67
|
+
- 你怀疑某个函数/文件"消失了" —— 先用 grep 确认它是否只是移到了别处
|
|
68
|
+
- 你怀疑某处逻辑有问题 —— 先 read_file 看到完整实现,而不是从 diff 片段推断
|
|
69
|
+
- 你引用「已有测试」「既有约定」 —— 先搜到它,再说它
|
|
70
|
+
|
|
71
|
+
没有查证就断言"这段代码没了/错了",是本项目反复出现的误报来源(见 docs/adr/0005)。
|
|
72
|
+
给出 verdict 之前完成查证。
|
|
73
|
+
`;
|
|
74
|
+
|
|
48
75
|
const MODE_FOCUS_PROMPTS = {
|
|
49
76
|
design: '',
|
|
50
77
|
'code-walkthrough': '\n\n本次评审聚焦已实现代码的正确性、风险和可验证结果。',
|
|
51
78
|
requirements: '\n\n本次评审聚焦需求陈述的完整性、一致性、可验收性和约束清晰度。',
|
|
52
79
|
};
|
|
53
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Whether a mode's seats should be told about the repository tools.
|
|
83
|
+
*
|
|
84
|
+
* A requirements review judges what a spec SAYS, not what the code does, so
|
|
85
|
+
* telling that seat to `grep` before asserting invites it to review the wrong
|
|
86
|
+
* artifact and spends budget on guidance it cannot act on. A design review CAN
|
|
87
|
+
* cite existing code, so it keeps the guidance.
|
|
88
|
+
*/
|
|
89
|
+
const MODE_WANTS_TOOLS = {
|
|
90
|
+
design: true,
|
|
91
|
+
'code-walkthrough': true,
|
|
92
|
+
requirements: false,
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/** The tool guidance for this mode, or an empty string when the mode needs none. */
|
|
96
|
+
function toolGuidance(mode) {
|
|
97
|
+
return MODE_WANTS_TOOLS[mode] ? REPO_TOOL_GUIDANCE : '';
|
|
98
|
+
}
|
|
99
|
+
|
|
54
100
|
|
|
55
|
-
module.exports = { SYSTEM_PROMPTS, MODE_FOCUS_PROMPTS };
|
|
101
|
+
module.exports = { SYSTEM_PROMPTS, MODE_FOCUS_PROMPTS, REPO_TOOL_GUIDANCE, toolGuidance };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.41.
|
|
6
|
+
**Version:** 0.41.52.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
|