@boyingliu01/xp-gate 0.38.77 → 0.38.78

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.
Files changed (28) hide show
  1. package/lib/__tests__/gate2-verdict.test.js +58 -1
  2. package/lib/gate-runner.js +88 -9
  3. package/lib/mattpocock-license-verdict.json +1 -1
  4. package/package.json +1 -1
  5. package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
  6. package/plugins/claude-code/skills/delphi-review/AGENTS.md +1 -1
  7. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +1 -1
  8. package/plugins/claude-code/skills/sprint-flow/references/phase-2-design.md +62 -2
  9. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +1 -1
  10. package/plugins/dsh/package.json +1 -1
  11. package/plugins/dsh/skills/delphi-review/AGENTS.md +1 -1
  12. package/plugins/dsh/skills/sprint-flow/AGENTS.md +1 -1
  13. package/plugins/dsh/skills/sprint-flow/references/phase-2-design.md +62 -2
  14. package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +1 -1
  15. package/plugins/opencode/package.json +1 -1
  16. package/plugins/opencode/skills/delphi-review/AGENTS.md +1 -1
  17. package/plugins/opencode/skills/sprint-flow/AGENTS.md +1 -1
  18. package/plugins/opencode/skills/sprint-flow/references/phase-2-design.md +62 -2
  19. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +1 -1
  20. package/plugins/qoder/plugin.json +1 -1
  21. package/plugins/qoder/skills/delphi-review/AGENTS.md +1 -1
  22. package/plugins/qoder/skills/sprint-flow/AGENTS.md +1 -1
  23. package/plugins/qoder/skills/sprint-flow/references/phase-2-design.md +62 -2
  24. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +1 -1
  25. package/skills/delphi-review/AGENTS.md +1 -1
  26. package/skills/sprint-flow/AGENTS.md +1 -1
  27. package/skills/sprint-flow/references/phase-2-design.md +62 -2
  28. package/skills/test-specification-alignment/AGENTS.md +1 -1
@@ -14,7 +14,7 @@ const fs = require('node:fs');
14
14
  const path = require('node:path');
15
15
  const os = require('node:os');
16
16
 
17
- const { buildJscpdArgs } = require('../gate-runner');
17
+ const { buildJscpdArgs, classifyJscpdRun } = require('../gate-runner');
18
18
 
19
19
  let tmpDir;
20
20
 
@@ -124,3 +124,60 @@ describe('#853 Gate 2 must be able to fail', () => {
124
124
  expect(args).not.toContain('--config');
125
125
  });
126
126
  });
127
+
128
+ /**
129
+ * @test REQ-GATE2-NO-FILES the CLI must not report "clean" when jscpd analysed zero files
130
+ * @intent `xp-gate check 2` captures jscpd's stream and classifies it BEFORE deciding the
131
+ * verdict. The shell hook already does this (`classify_jscpd_run` in
132
+ * githooks/lib/jscpd-run.sh, pinned by gate-2-no-files.test.bats); the CLI path
133
+ * had no equivalent, so the same defect survived there.
134
+ * @covers AC-855-01 AC-855-02 AC-855-03 AC-855-04
135
+ *
136
+ * #855 measured on 0.38.76: a two-file fixture jscpd refuses to parse (below its
137
+ * min-tokens floor) produced `Files analyzed: 0`, jscpd's own
138
+ * `Warning: jscpd analyzed no files`, and `exit 0` from `xp-gate check 2` with
139
+ * "No duplicates found." A scan that read nothing was indistinguishable from a scan
140
+ * that read the change set and found it clean -- the exact failure family both
141
+ * AGENTS.md files name.
142
+ */
143
+ describe('#855 Gate 2 must not call an empty scan clean', () => {
144
+ it('classifies an "analyzed no files" warning as no_files, not clean', () => {
145
+ const out = [
146
+ 'No duplicates found.',
147
+ '| Format | Files analyzed | Total lines | Total tokens | Clones found |',
148
+ 'Found 0 clones.',
149
+ 'time: 8.279ms',
150
+ 'Warning: jscpd analyzed no files: check the paths and the --format, --ignore and --pattern filters',
151
+ ].join('\n');
152
+ expect(classifyJscpdRun(0, out)).toBe('no_files');
153
+ });
154
+
155
+ it('keeps a real scan with zero clones as clean', () => {
156
+ // Anti-vacuity: if every "Found 0 clones" became no_files the gate would skip
157
+ // every project, trading a silent pass for a permanent skip.
158
+ const out = ['| Total: | 12 | 340 | 2100 | 0 |', 'Found 0 clones.'].join('\n');
159
+ expect(classifyJscpdRun(0, out)).toBe('clean');
160
+ });
161
+
162
+ it('keeps a real scan with clones as duplicates', () => {
163
+ const out = ['| Total: | 12 | 340 | 2100 | 3 |', 'Found 3 clones.'].join('\n');
164
+ expect(classifyJscpdRun(0, out)).toBe('duplicates');
165
+ });
166
+
167
+ it('lets a non-zero exit win over the no-files warning', () => {
168
+ // A failed run is the more specific fact; calling it no_files would hide it.
169
+ expect(classifyJscpdRun(2, 'Warning: jscpd analyzed no files: check the paths')).toBe('error');
170
+ });
171
+
172
+ it('treats a report with no clones line and no files line as no_files', () => {
173
+ // Measured shape: an --ignore that excludes everything prints one timing line.
174
+ expect(classifyJscpdRun(0, 'time: 0.156ms')).toBe('no_files');
175
+ });
176
+
177
+ it('does not turn an unfamiliar but non-empty report into a skip', () => {
178
+ // The pre-existing tolerance, kept deliberately: a future jscpd format must not
179
+ // disable the gate for everyone whose output we do not recognise.
180
+ const out = 'some future jscpd format\nformat v9\nclones: none detected\nfiles scanned: 14';
181
+ expect(classifyJscpdRun(0, out)).toBe('clean');
182
+ });
183
+ });
@@ -601,7 +601,21 @@ const GATE_REGISTRY = {
601
601
  aliases: ['duplicates', 'dup', '2'],
602
602
  run: (targetPath) => {
603
603
  const args = buildJscpdArgs({ targetPath });
604
- runJscpd(args, targetPath);
604
+ const outcome = runJscpd(args, targetPath);
605
+ // A run that examined nothing is NOT a pass. Say so with a reason, per the
606
+ // SKIP contract both AGENTS.md files state: "not checked" must never be
607
+ // recordable as "passed". Returning GATE_NOT_RUN is how the rest of this file
608
+ // reports the same condition, so the caller records a skip rather than a
609
+ // verdict it never computed.
610
+ if (outcome === 'no_files') {
611
+ process.stderr.write(
612
+ '[gate-2] SKIP: jscpd analysed no files, so "Found 0 clones" is not a verdict. '
613
+ + 'Check --ignore / --format / --pattern, or whether the target holds any '
614
+ + 'source this tool recognises.\n',
615
+ );
616
+ return GATE_NOT_RUN;
617
+ }
618
+ return undefined;
605
619
  },
606
620
  },
607
621
  '3': {
@@ -1006,6 +1020,62 @@ function buildGlobalPrefixes(env) {
1006
1020
  return prefixes.filter((p) => typeof p === 'string' && p.length > 0 && path.isAbsolute(p));
1007
1021
  }
1008
1022
 
1023
+ /**
1024
+ * What a finished jscpd run tells us, as one of four values.
1025
+ *
1026
+ * `no_files` is the one that did not exist before #855, and it is the reason this
1027
+ * function exists at all. jscpd answers "Found 0 clones" for a run that examined
1028
+ * nothing and for a run that examined the change set and found it clean -- the two
1029
+ * are only the same statement if something was actually read. It says so itself, on
1030
+ * the stream, and exits 0 anyway:
1031
+ *
1032
+ * Warning: jscpd analyzed no files: check the paths and the --format, --ignore
1033
+ * and --pattern filters
1034
+ * Found 0 clones.
1035
+ *
1036
+ * Measured on a fixture below jscpd's min-tokens floor: `xp-gate check 2` printed
1037
+ * "No duplicates found.", a table with `Files analyzed: 0`, and exited 0. A gate
1038
+ * that examined nothing was indistinguishable from a passing one.
1039
+ *
1040
+ * "error" is wrong here (jscpd did not fail), "clean" is wrong (nothing was read),
1041
+ * and "duplicates" is wrong. Hence a fourth value.
1042
+ *
1043
+ * The shell hook has classified this way since gate-2-no-files.test.bats landed
1044
+ * (`classify_jscpd_run` in githooks/lib/jscpd-run.sh); the CLI path had no
1045
+ * equivalent, which is how #855 survived its fix.
1046
+ *
1047
+ * @param {number|null} exitCode jscpd's exit status
1048
+ * @param {string} output the combined stdout+stderr
1049
+ * @returns {'error'|'no_files'|'duplicates'|'clean'}
1050
+ */
1051
+ function classifyJscpdRun(exitCode, output) {
1052
+ const text = typeof output === 'string' ? output : '';
1053
+ // A failed run is the more specific fact, so it is checked first: reporting it as
1054
+ // no_files would hide a genuine tool failure behind a plausible excuse.
1055
+ if (typeof exitCode !== 'number' || exitCode !== 0) return 'error';
1056
+
1057
+ const clones = text.match(/Found (\d+) (?:clones?|duplicates?)/i);
1058
+ if (clones) {
1059
+ // A clone count above zero is a finding whatever else the run said.
1060
+ if (Number.parseInt(clones[1], 10) > 0) return 'duplicates';
1061
+ // Zero clones is a verdict only when files were read.
1062
+ if (/analyzed no files/i.test(text)) return 'no_files';
1063
+ const scanned = text.match(/\|\s*Total:\s*\|\s*(\d+)\s*\|/i);
1064
+ if (scanned && Number.parseInt(scanned[1], 10) === 0) return 'no_files';
1065
+ return 'clean';
1066
+ }
1067
+
1068
+ // No clone line at all. A report with any content other than a bare timing is
1069
+ // still treated as a scan that happened -- turning every unfamiliar future jscpd
1070
+ // format into a SKIP would disable the gate for everyone.
1071
+ const meaningful = text
1072
+ .split('\n')
1073
+ .map((line) => line.trim())
1074
+ .filter((line) => line.length > 0 && !/^time:\s/i.test(line));
1075
+ if (meaningful.length === 0) return 'no_files';
1076
+ return 'clean';
1077
+ }
1078
+
1009
1079
  function runJscpd(args, targetPath) {
1010
1080
  // Invoke jscpd's JS entry through `node` rather than going through .bin/.
1011
1081
  //
@@ -1059,13 +1129,22 @@ function runJscpd(args, targetPath) {
1059
1129
  ];
1060
1130
  for (const [cmd, cmdArgs] of attempts) {
1061
1131
  try {
1062
- // cwd must be the scan target. Without it jscpd runs in whatever directory
1063
- // the CLI was started from, so `xp-gate check 2 <path>` scanned the CURRENT
1064
- // directory and the path argument only affected its display name. Measured:
1065
- // a 3-copy fixture reported 0 clones because the scan happened in the xp-gate
1066
- // repo instead of the fixture.
1067
- execFileSync(cmd, cmdArgs, { stdio: 'inherit', cwd: targetPath || process.cwd() });
1068
- return;
1132
+ // The stream is CAPTURED and replayed rather than inherited, because the
1133
+ // verdict depends on what jscpd said. With `stdio: 'inherit'` the output went
1134
+ // straight to the terminal, so the gate could not tell a clean scan from one
1135
+ // that examined nothing -- #855. Replaying it immediately keeps the operator's
1136
+ // view identical to before.
1137
+ const result = spawnSync(cmd, cmdArgs, {
1138
+ cwd: targetPath || process.cwd(),
1139
+ encoding: 'utf8',
1140
+ maxBuffer: 64 * 1024 * 1024,
1141
+ });
1142
+ if (result.stdout) process.stdout.write(result.stdout);
1143
+ if (result.stderr) process.stderr.write(result.stderr);
1144
+ if (result.error) throw result.error;
1145
+ const outcome = classifyJscpdRun(result.status, `${result.stdout || ''}\n${result.stderr || ''}`);
1146
+ if (result.status === 0) return outcome;
1147
+ lastErr = new Error(`jscpd exited ${result.status}`);
1069
1148
  } catch (err) {
1070
1149
  lastErr = err;
1071
1150
  }
@@ -1297,7 +1376,7 @@ async function invokeGateHandler(gateId, gate, targetPath, opts) {
1297
1376
  }
1298
1377
  }
1299
1378
 
1300
- module.exports = { findConsumerGateVariant, GATE_REGISTRY, GATE_NOT_RUN, getGateInfo, getAllGates, runGate, resolveAlias, getAliases, runGateAdapter, findTsGateEntry, resolveGateScript, resolveTsxInvocation, findTsxCli, findJscpdEntry, buildJscpdArgs, JSCPD_THRESHOLD, buildGlobalPrefixes, SOURCE_FILE_EXTENSIONS, resolveAllModeChangedFiles, describeEmptyChangedFiles, describeChangedFilesScope,
1379
+ module.exports = { findConsumerGateVariant, GATE_REGISTRY, GATE_NOT_RUN, classifyJscpdRun, getGateInfo, getAllGates, runGate, resolveAlias, getAliases, runGateAdapter, findTsGateEntry, resolveGateScript, resolveTsxInvocation, findTsxCli, findJscpdEntry, buildJscpdArgs, JSCPD_THRESHOLD, buildGlobalPrefixes, SOURCE_FILE_EXTENSIONS, resolveAllModeChangedFiles, describeEmptyChangedFiles, describeChangedFilesScope,
1301
1380
  // AC-670-03 asserts the --all preamble END-TO-END: that an all-mode run hands
1302
1381
  // the security gates a non-empty file population sourced from the list file and
1303
1382
  // sets GATE_SCOPE="all". With these unexported, the case could only take its
@@ -2,6 +2,6 @@
2
2
  "verdict": "PASS",
3
3
  "license_type": "MIT",
4
4
  "sha256": "0e7ac423bf2c6e223b7c5b156f8cf72da49d748e56a1641402c31f22ad07dbb5",
5
- "checked_at": "2026-11-21T00:58:04.017Z",
5
+ "checked_at": "2026-11-21T14:57:53.211Z",
6
6
  "source": "network"
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/xp-gate",
3
- "version": "0.38.77",
3
+ "version": "0.38.78",
4
4
  "description": "AI-driven development workflow: 6 quality gates + Delphi review + Sprint Flow",
5
5
  "bin": {
6
6
  "xp-gate": "bin/xp-gate.js"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xp-gate",
3
- "version": "0.38.77",
3
+ "version": "0.38.78",
4
4
  "displayName": "XP-Gate",
5
5
  "description": "Extreme Programming quality gates + AI workflow skills for Claude Code. 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.38.77.0
6
+ **Version:** 0.38.78.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.
@@ -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.38.77.0
6
+ **Version:** 0.38.78.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.
@@ -51,7 +51,7 @@ skill(name="grill-with-docs", user_message="[需求描述]")
51
51
  grill-with-docs 执行:
52
52
  1. **逐个追问决策树** — 每题附推荐答案;事实自行探查,决策留给用户
53
53
  2. **同步维护 CONTEXT.md** — 项目上下文沉淀(`domain-modeling` 内置)
54
- 3. **同步维护 ADR** — `docs/adr/ADR-NNNN-*.md` 架构决策记录
54
+ 3. **同步维护 ADR** — 架构决策记录,路径与命名以 `skills/domain-modeling/ADR-FORMAT.md` 为准(`docs/adr/{NNNN}-{kebab-case-title}.md`)
55
55
  4. **达成共享理解** — 需求边界、用户场景、验收标准清晰化
56
56
 
57
57
  ### Step 2: R1 需求评审(#368 恢复的第一点评审)
@@ -131,6 +131,66 @@ orchestrator 基于访谈记录 + CONTEXT.md + R1 评审结论生成设计文档
131
131
  - 收到用户 APPROVED 后,自动进入 Part B
132
132
  - 如果用户未 APPROVED,BLOCK 并等待
133
133
 
134
+ ### Step 4b: ADR 门 — 每个 sprint 都必须交付一条记录
135
+
136
+ > **为什么这一步存在**:`docs/adr/` 曾长期只有 3 份记录,而 `grill-with-docs` 有能力写
137
+ > ADR、文档也把 ADR 列在"输出"里——但**没有任何条件要求它发生**。于是它没有发生。
138
+ > 这正是 ADR-0003 记录的缺陷形态:**声明了,但没执行**。
139
+ > 清单里的一项只是建议;**完成条件**才是保证。
140
+
141
+ **这一步不要求你"判断本次 sprint 是否触碰架构"**——那种判断没有产物、无法审计,
142
+ 执行者会不自觉地答"没有",于是门形同不存在。改为:**任何 sprint 都必须写出一个文件**,
143
+ 写的是哪个由你决定,但"没写"不是选项。
144
+
145
+ **产物**:`.sprint-state/phase-outputs/phase-2-adr.json`
146
+
147
+ ```json
148
+ {
149
+ "decision": "recorded",
150
+ "adr": "docs/adr/0007-switch-to-riverpod.md",
151
+ "reason": "引入新的状态管理方案替代 provider,属于难以回退的技术选型变更;ADR 记录了被否决的选项 B/C 及理由"
152
+ }
153
+ ```
154
+
155
+ 或
156
+
157
+ ```json
158
+ {
159
+ "decision": "not_needed",
160
+ "reason": "只修改 src/gate-12 内部的条件判断,未新增或删除模块边界,未改变依赖方向,未引入或替换技术选型"
161
+ }
162
+ ```
163
+
164
+ `decision` 只允许这两个值。`reason` 在两种情况下都必填:`recorded` 时说明这条决策
165
+ **为什么值得记**,`not_needed` 时说明**凭什么判定不需要**。
166
+
167
+ **若有 ADR**:路径必须真实存在,命名遵循 `skills/domain-modeling/ADR-FORMAT.md`
168
+ (`docs/adr/{NNNN}-{kebab-case-title}.md`,`{NNNN}` 为零填充递增序号)。
169
+ 内容必须包含**决策**与**被否决的备选方案及理由**——后者是未来读者唯一无法自行重建的
170
+ 部分,也是 ADR 存在的全部价值;只写结论的 ADR 等于没有。
171
+
172
+ **哪些改动通常生成 ADR**(用于提高 `recorded` 的比例,不是豁免清单):
173
+
174
+ | 信号 | 例子 |
175
+ |---|---|
176
+ | 新增或取消模块、层边界 | 拆包、合并包、新增目录层级 |
177
+ | 改变依赖方向 | A 依赖 B 改为 B 依赖 A |
178
+ | 引入或替换关键技术选型 | 换 ORM、换构建工具、换通信协议 |
179
+ | 做出**难以回退**的决策 | 数据模型、公开 API 形状、存储格式 |
180
+ | 出现被否决的备选方案且有理由 | 选了 A 而不是 B,B 更好为什么不用 |
181
+
182
+ > 与 AGENTS.md 的 SKIP 规则同源:**"没有决策要记"与"忘了记决策"必须可区分**。
183
+ > 前者是一份带理由的 JSON,后者是该文件不存在。差别在产物上,不在措辞上。
184
+
185
+ **门禁行为**(四条都由脚本判定,不看叙述):
186
+
187
+ 1. `.sprint-state/phase-outputs/phase-2-adr.json` 不存在 → BLOCK,不可进入 Part B。
188
+ 2. `decision` 不是 `recorded` / `not_needed` 之一 → BLOCK。
189
+ 3. `reason` 为空或短于 20 字符 → BLOCK(`无`、`n/a`、`skip` 这类不算理由)。
190
+ 4. `decision` 为 `recorded` 但 `adr` 指向的文件不存在 → BLOCK。
191
+
192
+ > 第 1 条是这一步的全部要点:**门检查的是产物是否存在,不是你声称自己想过**。
193
+
134
194
  ### 暂停点
135
195
 
136
196
  | 暂停点 | 触发条件 | 用户操作 | 自动恢复条件 |
@@ -141,7 +201,7 @@ orchestrator 基于访谈记录 + CONTEXT.md + R1 评审结论生成设计文档
141
201
  ### 输出
142
202
 
143
203
  - CONTEXT.md(项目上下文沉淀)
144
- - ADR 文件(`docs/adr/ADR-NNNN-*.md`)
204
+ - ADR 文件(`docs/adr/{NNNN}-{kebab-case-title}.md`,Step 4b 的产出;若豁免则记录理由)
145
205
  - requirements-reviewed.json(`.sprint-state/phase-outputs/`)
146
206
  - Design Document(`docs/plans/YYYY-MM-DD-<topic>-design.md`)
147
207
  - 进入 Part B 自动执行(使用设计文档作为输入)
@@ -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.38.77.0
6
+ **Version:** 0.38.78.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": "@boyingliu01/dsh-plugin-xp-gate",
3
- "version": "0.38.77",
3
+ "version": "0.38.78",
4
4
  "description": "XP-Gate deterministic quality gates + AI workflow skills as a DeepSeek Harness (DSH) native plugin: gate-check / gate-principles / gate-arch tools + 12 SKILL.md skills",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -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.38.77.0
6
+ **Version:** 0.38.78.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.
@@ -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.38.77.0
6
+ **Version:** 0.38.78.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.
@@ -51,7 +51,7 @@ skill(name="grill-with-docs", user_message="[需求描述]")
51
51
  grill-with-docs 执行:
52
52
  1. **逐个追问决策树** — 每题附推荐答案;事实自行探查,决策留给用户
53
53
  2. **同步维护 CONTEXT.md** — 项目上下文沉淀(`domain-modeling` 内置)
54
- 3. **同步维护 ADR** — `docs/adr/ADR-NNNN-*.md` 架构决策记录
54
+ 3. **同步维护 ADR** — 架构决策记录,路径与命名以 `skills/domain-modeling/ADR-FORMAT.md` 为准(`docs/adr/{NNNN}-{kebab-case-title}.md`)
55
55
  4. **达成共享理解** — 需求边界、用户场景、验收标准清晰化
56
56
 
57
57
  ### Step 2: R1 需求评审(#368 恢复的第一点评审)
@@ -131,6 +131,66 @@ orchestrator 基于访谈记录 + CONTEXT.md + R1 评审结论生成设计文档
131
131
  - 收到用户 APPROVED 后,自动进入 Part B
132
132
  - 如果用户未 APPROVED,BLOCK 并等待
133
133
 
134
+ ### Step 4b: ADR 门 — 每个 sprint 都必须交付一条记录
135
+
136
+ > **为什么这一步存在**:`docs/adr/` 曾长期只有 3 份记录,而 `grill-with-docs` 有能力写
137
+ > ADR、文档也把 ADR 列在"输出"里——但**没有任何条件要求它发生**。于是它没有发生。
138
+ > 这正是 ADR-0003 记录的缺陷形态:**声明了,但没执行**。
139
+ > 清单里的一项只是建议;**完成条件**才是保证。
140
+
141
+ **这一步不要求你"判断本次 sprint 是否触碰架构"**——那种判断没有产物、无法审计,
142
+ 执行者会不自觉地答"没有",于是门形同不存在。改为:**任何 sprint 都必须写出一个文件**,
143
+ 写的是哪个由你决定,但"没写"不是选项。
144
+
145
+ **产物**:`.sprint-state/phase-outputs/phase-2-adr.json`
146
+
147
+ ```json
148
+ {
149
+ "decision": "recorded",
150
+ "adr": "docs/adr/0007-switch-to-riverpod.md",
151
+ "reason": "引入新的状态管理方案替代 provider,属于难以回退的技术选型变更;ADR 记录了被否决的选项 B/C 及理由"
152
+ }
153
+ ```
154
+
155
+ 或
156
+
157
+ ```json
158
+ {
159
+ "decision": "not_needed",
160
+ "reason": "只修改 src/gate-12 内部的条件判断,未新增或删除模块边界,未改变依赖方向,未引入或替换技术选型"
161
+ }
162
+ ```
163
+
164
+ `decision` 只允许这两个值。`reason` 在两种情况下都必填:`recorded` 时说明这条决策
165
+ **为什么值得记**,`not_needed` 时说明**凭什么判定不需要**。
166
+
167
+ **若有 ADR**:路径必须真实存在,命名遵循 `skills/domain-modeling/ADR-FORMAT.md`
168
+ (`docs/adr/{NNNN}-{kebab-case-title}.md`,`{NNNN}` 为零填充递增序号)。
169
+ 内容必须包含**决策**与**被否决的备选方案及理由**——后者是未来读者唯一无法自行重建的
170
+ 部分,也是 ADR 存在的全部价值;只写结论的 ADR 等于没有。
171
+
172
+ **哪些改动通常生成 ADR**(用于提高 `recorded` 的比例,不是豁免清单):
173
+
174
+ | 信号 | 例子 |
175
+ |---|---|
176
+ | 新增或取消模块、层边界 | 拆包、合并包、新增目录层级 |
177
+ | 改变依赖方向 | A 依赖 B 改为 B 依赖 A |
178
+ | 引入或替换关键技术选型 | 换 ORM、换构建工具、换通信协议 |
179
+ | 做出**难以回退**的决策 | 数据模型、公开 API 形状、存储格式 |
180
+ | 出现被否决的备选方案且有理由 | 选了 A 而不是 B,B 更好为什么不用 |
181
+
182
+ > 与 AGENTS.md 的 SKIP 规则同源:**"没有决策要记"与"忘了记决策"必须可区分**。
183
+ > 前者是一份带理由的 JSON,后者是该文件不存在。差别在产物上,不在措辞上。
184
+
185
+ **门禁行为**(四条都由脚本判定,不看叙述):
186
+
187
+ 1. `.sprint-state/phase-outputs/phase-2-adr.json` 不存在 → BLOCK,不可进入 Part B。
188
+ 2. `decision` 不是 `recorded` / `not_needed` 之一 → BLOCK。
189
+ 3. `reason` 为空或短于 20 字符 → BLOCK(`无`、`n/a`、`skip` 这类不算理由)。
190
+ 4. `decision` 为 `recorded` 但 `adr` 指向的文件不存在 → BLOCK。
191
+
192
+ > 第 1 条是这一步的全部要点:**门检查的是产物是否存在,不是你声称自己想过**。
193
+
134
194
  ### 暂停点
135
195
 
136
196
  | 暂停点 | 触发条件 | 用户操作 | 自动恢复条件 |
@@ -141,7 +201,7 @@ orchestrator 基于访谈记录 + CONTEXT.md + R1 评审结论生成设计文档
141
201
  ### 输出
142
202
 
143
203
  - CONTEXT.md(项目上下文沉淀)
144
- - ADR 文件(`docs/adr/ADR-NNNN-*.md`)
204
+ - ADR 文件(`docs/adr/{NNNN}-{kebab-case-title}.md`,Step 4b 的产出;若豁免则记录理由)
145
205
  - requirements-reviewed.json(`.sprint-state/phase-outputs/`)
146
206
  - Design Document(`docs/plans/YYYY-MM-DD-<topic>-design.md`)
147
207
  - 进入 Part B 自动执行(使用设计文档作为输入)
@@ -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.38.77.0
6
+ **Version:** 0.38.78.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": "@boyingliu01/opencode-plugin",
3
- "version": "0.38.77",
3
+ "version": "0.38.78",
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
6
  "description": "XP-Gate quality gates + AI workflow skills for OpenCode",
@@ -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.38.77.0
6
+ **Version:** 0.38.78.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.
@@ -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.38.77.0
6
+ **Version:** 0.38.78.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.
@@ -51,7 +51,7 @@ skill(name="grill-with-docs", user_message="[需求描述]")
51
51
  grill-with-docs 执行:
52
52
  1. **逐个追问决策树** — 每题附推荐答案;事实自行探查,决策留给用户
53
53
  2. **同步维护 CONTEXT.md** — 项目上下文沉淀(`domain-modeling` 内置)
54
- 3. **同步维护 ADR** — `docs/adr/ADR-NNNN-*.md` 架构决策记录
54
+ 3. **同步维护 ADR** — 架构决策记录,路径与命名以 `skills/domain-modeling/ADR-FORMAT.md` 为准(`docs/adr/{NNNN}-{kebab-case-title}.md`)
55
55
  4. **达成共享理解** — 需求边界、用户场景、验收标准清晰化
56
56
 
57
57
  ### Step 2: R1 需求评审(#368 恢复的第一点评审)
@@ -131,6 +131,66 @@ orchestrator 基于访谈记录 + CONTEXT.md + R1 评审结论生成设计文档
131
131
  - 收到用户 APPROVED 后,自动进入 Part B
132
132
  - 如果用户未 APPROVED,BLOCK 并等待
133
133
 
134
+ ### Step 4b: ADR 门 — 每个 sprint 都必须交付一条记录
135
+
136
+ > **为什么这一步存在**:`docs/adr/` 曾长期只有 3 份记录,而 `grill-with-docs` 有能力写
137
+ > ADR、文档也把 ADR 列在"输出"里——但**没有任何条件要求它发生**。于是它没有发生。
138
+ > 这正是 ADR-0003 记录的缺陷形态:**声明了,但没执行**。
139
+ > 清单里的一项只是建议;**完成条件**才是保证。
140
+
141
+ **这一步不要求你"判断本次 sprint 是否触碰架构"**——那种判断没有产物、无法审计,
142
+ 执行者会不自觉地答"没有",于是门形同不存在。改为:**任何 sprint 都必须写出一个文件**,
143
+ 写的是哪个由你决定,但"没写"不是选项。
144
+
145
+ **产物**:`.sprint-state/phase-outputs/phase-2-adr.json`
146
+
147
+ ```json
148
+ {
149
+ "decision": "recorded",
150
+ "adr": "docs/adr/0007-switch-to-riverpod.md",
151
+ "reason": "引入新的状态管理方案替代 provider,属于难以回退的技术选型变更;ADR 记录了被否决的选项 B/C 及理由"
152
+ }
153
+ ```
154
+
155
+ 或
156
+
157
+ ```json
158
+ {
159
+ "decision": "not_needed",
160
+ "reason": "只修改 src/gate-12 内部的条件判断,未新增或删除模块边界,未改变依赖方向,未引入或替换技术选型"
161
+ }
162
+ ```
163
+
164
+ `decision` 只允许这两个值。`reason` 在两种情况下都必填:`recorded` 时说明这条决策
165
+ **为什么值得记**,`not_needed` 时说明**凭什么判定不需要**。
166
+
167
+ **若有 ADR**:路径必须真实存在,命名遵循 `skills/domain-modeling/ADR-FORMAT.md`
168
+ (`docs/adr/{NNNN}-{kebab-case-title}.md`,`{NNNN}` 为零填充递增序号)。
169
+ 内容必须包含**决策**与**被否决的备选方案及理由**——后者是未来读者唯一无法自行重建的
170
+ 部分,也是 ADR 存在的全部价值;只写结论的 ADR 等于没有。
171
+
172
+ **哪些改动通常生成 ADR**(用于提高 `recorded` 的比例,不是豁免清单):
173
+
174
+ | 信号 | 例子 |
175
+ |---|---|
176
+ | 新增或取消模块、层边界 | 拆包、合并包、新增目录层级 |
177
+ | 改变依赖方向 | A 依赖 B 改为 B 依赖 A |
178
+ | 引入或替换关键技术选型 | 换 ORM、换构建工具、换通信协议 |
179
+ | 做出**难以回退**的决策 | 数据模型、公开 API 形状、存储格式 |
180
+ | 出现被否决的备选方案且有理由 | 选了 A 而不是 B,B 更好为什么不用 |
181
+
182
+ > 与 AGENTS.md 的 SKIP 规则同源:**"没有决策要记"与"忘了记决策"必须可区分**。
183
+ > 前者是一份带理由的 JSON,后者是该文件不存在。差别在产物上,不在措辞上。
184
+
185
+ **门禁行为**(四条都由脚本判定,不看叙述):
186
+
187
+ 1. `.sprint-state/phase-outputs/phase-2-adr.json` 不存在 → BLOCK,不可进入 Part B。
188
+ 2. `decision` 不是 `recorded` / `not_needed` 之一 → BLOCK。
189
+ 3. `reason` 为空或短于 20 字符 → BLOCK(`无`、`n/a`、`skip` 这类不算理由)。
190
+ 4. `decision` 为 `recorded` 但 `adr` 指向的文件不存在 → BLOCK。
191
+
192
+ > 第 1 条是这一步的全部要点:**门检查的是产物是否存在,不是你声称自己想过**。
193
+
134
194
  ### 暂停点
135
195
 
136
196
  | 暂停点 | 触发条件 | 用户操作 | 自动恢复条件 |
@@ -141,7 +201,7 @@ orchestrator 基于访谈记录 + CONTEXT.md + R1 评审结论生成设计文档
141
201
  ### 输出
142
202
 
143
203
  - CONTEXT.md(项目上下文沉淀)
144
- - ADR 文件(`docs/adr/ADR-NNNN-*.md`)
204
+ - ADR 文件(`docs/adr/{NNNN}-{kebab-case-title}.md`,Step 4b 的产出;若豁免则记录理由)
145
205
  - requirements-reviewed.json(`.sprint-state/phase-outputs/`)
146
206
  - Design Document(`docs/plans/YYYY-MM-DD-<topic>-design.md`)
147
207
  - 进入 Part B 自动执行(使用设计文档作为输入)
@@ -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.38.77.0
6
+ **Version:** 0.38.78.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.38.77",
3
+ "version": "0.38.78",
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.38.77.0
6
+ **Version:** 0.38.78.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.
@@ -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.38.77.0
6
+ **Version:** 0.38.78.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.
@@ -51,7 +51,7 @@ skill(name="grill-with-docs", user_message="[需求描述]")
51
51
  grill-with-docs 执行:
52
52
  1. **逐个追问决策树** — 每题附推荐答案;事实自行探查,决策留给用户
53
53
  2. **同步维护 CONTEXT.md** — 项目上下文沉淀(`domain-modeling` 内置)
54
- 3. **同步维护 ADR** — `docs/adr/ADR-NNNN-*.md` 架构决策记录
54
+ 3. **同步维护 ADR** — 架构决策记录,路径与命名以 `skills/domain-modeling/ADR-FORMAT.md` 为准(`docs/adr/{NNNN}-{kebab-case-title}.md`)
55
55
  4. **达成共享理解** — 需求边界、用户场景、验收标准清晰化
56
56
 
57
57
  ### Step 2: R1 需求评审(#368 恢复的第一点评审)
@@ -131,6 +131,66 @@ orchestrator 基于访谈记录 + CONTEXT.md + R1 评审结论生成设计文档
131
131
  - 收到用户 APPROVED 后,自动进入 Part B
132
132
  - 如果用户未 APPROVED,BLOCK 并等待
133
133
 
134
+ ### Step 4b: ADR 门 — 每个 sprint 都必须交付一条记录
135
+
136
+ > **为什么这一步存在**:`docs/adr/` 曾长期只有 3 份记录,而 `grill-with-docs` 有能力写
137
+ > ADR、文档也把 ADR 列在"输出"里——但**没有任何条件要求它发生**。于是它没有发生。
138
+ > 这正是 ADR-0003 记录的缺陷形态:**声明了,但没执行**。
139
+ > 清单里的一项只是建议;**完成条件**才是保证。
140
+
141
+ **这一步不要求你"判断本次 sprint 是否触碰架构"**——那种判断没有产物、无法审计,
142
+ 执行者会不自觉地答"没有",于是门形同不存在。改为:**任何 sprint 都必须写出一个文件**,
143
+ 写的是哪个由你决定,但"没写"不是选项。
144
+
145
+ **产物**:`.sprint-state/phase-outputs/phase-2-adr.json`
146
+
147
+ ```json
148
+ {
149
+ "decision": "recorded",
150
+ "adr": "docs/adr/0007-switch-to-riverpod.md",
151
+ "reason": "引入新的状态管理方案替代 provider,属于难以回退的技术选型变更;ADR 记录了被否决的选项 B/C 及理由"
152
+ }
153
+ ```
154
+
155
+ 或
156
+
157
+ ```json
158
+ {
159
+ "decision": "not_needed",
160
+ "reason": "只修改 src/gate-12 内部的条件判断,未新增或删除模块边界,未改变依赖方向,未引入或替换技术选型"
161
+ }
162
+ ```
163
+
164
+ `decision` 只允许这两个值。`reason` 在两种情况下都必填:`recorded` 时说明这条决策
165
+ **为什么值得记**,`not_needed` 时说明**凭什么判定不需要**。
166
+
167
+ **若有 ADR**:路径必须真实存在,命名遵循 `skills/domain-modeling/ADR-FORMAT.md`
168
+ (`docs/adr/{NNNN}-{kebab-case-title}.md`,`{NNNN}` 为零填充递增序号)。
169
+ 内容必须包含**决策**与**被否决的备选方案及理由**——后者是未来读者唯一无法自行重建的
170
+ 部分,也是 ADR 存在的全部价值;只写结论的 ADR 等于没有。
171
+
172
+ **哪些改动通常生成 ADR**(用于提高 `recorded` 的比例,不是豁免清单):
173
+
174
+ | 信号 | 例子 |
175
+ |---|---|
176
+ | 新增或取消模块、层边界 | 拆包、合并包、新增目录层级 |
177
+ | 改变依赖方向 | A 依赖 B 改为 B 依赖 A |
178
+ | 引入或替换关键技术选型 | 换 ORM、换构建工具、换通信协议 |
179
+ | 做出**难以回退**的决策 | 数据模型、公开 API 形状、存储格式 |
180
+ | 出现被否决的备选方案且有理由 | 选了 A 而不是 B,B 更好为什么不用 |
181
+
182
+ > 与 AGENTS.md 的 SKIP 规则同源:**"没有决策要记"与"忘了记决策"必须可区分**。
183
+ > 前者是一份带理由的 JSON,后者是该文件不存在。差别在产物上,不在措辞上。
184
+
185
+ **门禁行为**(四条都由脚本判定,不看叙述):
186
+
187
+ 1. `.sprint-state/phase-outputs/phase-2-adr.json` 不存在 → BLOCK,不可进入 Part B。
188
+ 2. `decision` 不是 `recorded` / `not_needed` 之一 → BLOCK。
189
+ 3. `reason` 为空或短于 20 字符 → BLOCK(`无`、`n/a`、`skip` 这类不算理由)。
190
+ 4. `decision` 为 `recorded` 但 `adr` 指向的文件不存在 → BLOCK。
191
+
192
+ > 第 1 条是这一步的全部要点:**门检查的是产物是否存在,不是你声称自己想过**。
193
+
134
194
  ### 暂停点
135
195
 
136
196
  | 暂停点 | 触发条件 | 用户操作 | 自动恢复条件 |
@@ -141,7 +201,7 @@ orchestrator 基于访谈记录 + CONTEXT.md + R1 评审结论生成设计文档
141
201
  ### 输出
142
202
 
143
203
  - CONTEXT.md(项目上下文沉淀)
144
- - ADR 文件(`docs/adr/ADR-NNNN-*.md`)
204
+ - ADR 文件(`docs/adr/{NNNN}-{kebab-case-title}.md`,Step 4b 的产出;若豁免则记录理由)
145
205
  - requirements-reviewed.json(`.sprint-state/phase-outputs/`)
146
206
  - Design Document(`docs/plans/YYYY-MM-DD-<topic>-design.md`)
147
207
  - 进入 Part B 自动执行(使用设计文档作为输入)
@@ -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.38.77.0
6
+ **Version:** 0.38.78.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -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.38.77.0
6
+ **Version:** 0.38.78.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.
@@ -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.38.77.0
6
+ **Version:** 0.38.78.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.
@@ -51,7 +51,7 @@ skill(name="grill-with-docs", user_message="[需求描述]")
51
51
  grill-with-docs 执行:
52
52
  1. **逐个追问决策树** — 每题附推荐答案;事实自行探查,决策留给用户
53
53
  2. **同步维护 CONTEXT.md** — 项目上下文沉淀(`domain-modeling` 内置)
54
- 3. **同步维护 ADR** — `docs/adr/ADR-NNNN-*.md` 架构决策记录
54
+ 3. **同步维护 ADR** — 架构决策记录,路径与命名以 `skills/domain-modeling/ADR-FORMAT.md` 为准(`docs/adr/{NNNN}-{kebab-case-title}.md`)
55
55
  4. **达成共享理解** — 需求边界、用户场景、验收标准清晰化
56
56
 
57
57
  ### Step 2: R1 需求评审(#368 恢复的第一点评审)
@@ -131,6 +131,66 @@ orchestrator 基于访谈记录 + CONTEXT.md + R1 评审结论生成设计文档
131
131
  - 收到用户 APPROVED 后,自动进入 Part B
132
132
  - 如果用户未 APPROVED,BLOCK 并等待
133
133
 
134
+ ### Step 4b: ADR 门 — 每个 sprint 都必须交付一条记录
135
+
136
+ > **为什么这一步存在**:`docs/adr/` 曾长期只有 3 份记录,而 `grill-with-docs` 有能力写
137
+ > ADR、文档也把 ADR 列在"输出"里——但**没有任何条件要求它发生**。于是它没有发生。
138
+ > 这正是 ADR-0003 记录的缺陷形态:**声明了,但没执行**。
139
+ > 清单里的一项只是建议;**完成条件**才是保证。
140
+
141
+ **这一步不要求你"判断本次 sprint 是否触碰架构"**——那种判断没有产物、无法审计,
142
+ 执行者会不自觉地答"没有",于是门形同不存在。改为:**任何 sprint 都必须写出一个文件**,
143
+ 写的是哪个由你决定,但"没写"不是选项。
144
+
145
+ **产物**:`.sprint-state/phase-outputs/phase-2-adr.json`
146
+
147
+ ```json
148
+ {
149
+ "decision": "recorded",
150
+ "adr": "docs/adr/0007-switch-to-riverpod.md",
151
+ "reason": "引入新的状态管理方案替代 provider,属于难以回退的技术选型变更;ADR 记录了被否决的选项 B/C 及理由"
152
+ }
153
+ ```
154
+
155
+ 或
156
+
157
+ ```json
158
+ {
159
+ "decision": "not_needed",
160
+ "reason": "只修改 src/gate-12 内部的条件判断,未新增或删除模块边界,未改变依赖方向,未引入或替换技术选型"
161
+ }
162
+ ```
163
+
164
+ `decision` 只允许这两个值。`reason` 在两种情况下都必填:`recorded` 时说明这条决策
165
+ **为什么值得记**,`not_needed` 时说明**凭什么判定不需要**。
166
+
167
+ **若有 ADR**:路径必须真实存在,命名遵循 `skills/domain-modeling/ADR-FORMAT.md`
168
+ (`docs/adr/{NNNN}-{kebab-case-title}.md`,`{NNNN}` 为零填充递增序号)。
169
+ 内容必须包含**决策**与**被否决的备选方案及理由**——后者是未来读者唯一无法自行重建的
170
+ 部分,也是 ADR 存在的全部价值;只写结论的 ADR 等于没有。
171
+
172
+ **哪些改动通常生成 ADR**(用于提高 `recorded` 的比例,不是豁免清单):
173
+
174
+ | 信号 | 例子 |
175
+ |---|---|
176
+ | 新增或取消模块、层边界 | 拆包、合并包、新增目录层级 |
177
+ | 改变依赖方向 | A 依赖 B 改为 B 依赖 A |
178
+ | 引入或替换关键技术选型 | 换 ORM、换构建工具、换通信协议 |
179
+ | 做出**难以回退**的决策 | 数据模型、公开 API 形状、存储格式 |
180
+ | 出现被否决的备选方案且有理由 | 选了 A 而不是 B,B 更好为什么不用 |
181
+
182
+ > 与 AGENTS.md 的 SKIP 规则同源:**"没有决策要记"与"忘了记决策"必须可区分**。
183
+ > 前者是一份带理由的 JSON,后者是该文件不存在。差别在产物上,不在措辞上。
184
+
185
+ **门禁行为**(四条都由脚本判定,不看叙述):
186
+
187
+ 1. `.sprint-state/phase-outputs/phase-2-adr.json` 不存在 → BLOCK,不可进入 Part B。
188
+ 2. `decision` 不是 `recorded` / `not_needed` 之一 → BLOCK。
189
+ 3. `reason` 为空或短于 20 字符 → BLOCK(`无`、`n/a`、`skip` 这类不算理由)。
190
+ 4. `decision` 为 `recorded` 但 `adr` 指向的文件不存在 → BLOCK。
191
+
192
+ > 第 1 条是这一步的全部要点:**门检查的是产物是否存在,不是你声称自己想过**。
193
+
134
194
  ### 暂停点
135
195
 
136
196
  | 暂停点 | 触发条件 | 用户操作 | 自动恢复条件 |
@@ -141,7 +201,7 @@ orchestrator 基于访谈记录 + CONTEXT.md + R1 评审结论生成设计文档
141
201
  ### 输出
142
202
 
143
203
  - CONTEXT.md(项目上下文沉淀)
144
- - ADR 文件(`docs/adr/ADR-NNNN-*.md`)
204
+ - ADR 文件(`docs/adr/{NNNN}-{kebab-case-title}.md`,Step 4b 的产出;若豁免则记录理由)
145
205
  - requirements-reviewed.json(`.sprint-state/phase-outputs/`)
146
206
  - Design Document(`docs/plans/YYYY-MM-DD-<topic>-design.md`)
147
207
  - 进入 Part B 自动执行(使用设计文档作为输入)
@@ -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.38.77.0
6
+ **Version:** 0.38.78.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.