@gordon.gan/specflow 1.4.3-beta → 1.4.6-beta

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.
@@ -80,13 +80,71 @@ change names, file paths, commands, and code in their original form.
80
80
  - `Cargo.toml` → Rust
81
81
  - `tsconfig.json` → TypeScript (refines Node detection)
82
82
  - If none match, set `techStack: unknown`
83
- 5. **Detect database stack** (for §4.4 guidance). Follow
83
+ 5. Set `projectMode`:
84
+ - `greenfield` — no meaningful application source yet (no `src/`/`app/`/`internal/`/`lib/`
85
+ with real code, or only empty scaffold); Pass 6 will be SKIPPED greenfield
86
+ - `brownfield` — existing product code to ground against
87
+ 6. **Detect database stack** (for §4.4 guidance). Follow
84
88
  `prompts/approval/database-guidance.md` §1 — set
85
89
  `dbStack: mysql|postgresql|oracle|redis|elasticsearch|none`. Prefer OLTP
86
90
  (`mysql`/`postgresql`/`oracle`) over cache/search when multiple match.
87
- 6. Read `specflow/specs/` baseline if it exists (for Pass 7 baseline cross-check).
91
+ 7. **Scan four artifacts for tech selection coverage** (proposal / design / tasks / specs):
92
+ look for explicit choices on: 前端、后端、数据库与缓存、基础设施(含 CI/部署/云)。
93
+ Set `stackCoverage: complete | partial | missing`.
94
+ 8. **Detect `uiInScope`** (follow `prompts/approval/frontend-guidance.md` §1):
95
+ UI/控制台/页面/组件 signals → `uiInScope=yes|no`. When yes, check FE 五元组 coverage
96
+ (Framework / Styling / State / UI kit / FE testing); incomplete counts as
97
+ `stackCoverage=partial` for 前端.
98
+ 9. Read `specflow/specs/` baseline if it exists (for Pass 7 baseline cross-check).
99
+
100
+ Announce: "Generating technical approval document for change `<name>` (phase=refined,
101
+ language=<lang>, projectMode=<greenfield|brownfield>, techStack=<stack>, dbStack=<db>,
102
+ uiInScope=<yes|no>, stackCoverage=<complete|partial|missing>)."
88
103
 
89
- Announce: "Generating technical approval document for change `<name>` (phase=refined, language=<lang>, techStack=<stack>, dbStack=<db>)."
104
+ ---
105
+
106
+ ## Gate: Tech Stack Intake (0→1 / 四件套缺选型)
107
+
108
+ **Trigger** (any):
109
+
110
+ - `projectMode = greenfield`, **or**
111
+ - `stackCoverage = missing | partial` for dimensions this change needs
112
+ (e.g. UI change needs 前端; persistence needs 数据库与缓存; ship needs 基础设施)
113
+
114
+ **Do NOT** invent a full stack. **STOP and ask the user** in chat (structured), then wait:
115
+
116
+ ```text
117
+ 本变更需要补全技术选型(四件套未写清 / 0→1 绿场)。请确认或补充下列方向
118
+ (可写「本变更不涉及」跳过某一维):
119
+
120
+ 1. 前端:Framework / Styling / State / UI kit / FE testing(五元组;或不涉及前端)
121
+ 2. 后端:语言/框架、API 风格(HTTP/gRPC/…)、进程模型
122
+ 3. 数据库与缓存:主存(MySQL/PG/…)、缓存(Redis/…)、搜索(若有)
123
+ 4. 基础设施:运行环境(K8s/VM/Serverless)、CI/CD、对象存储/消息队列(若有)
124
+ 5. 其它约束:公司强制栈、禁止项、必须复用的现网组件
125
+
126
+ 若本变更含 UI 且前端仍不清,追问(可合并一次问完):
127
+ - 关键页面/路由清单(或「沿用现网,本迭代只改某页」)
128
+ - 验证命令(dev / test / e2e / browser)
129
+ - (可选)若用 v0/Lovable 等 AI builder:导出与本地可构建计划
130
+
131
+ 回复示例:
132
+ 前端 Next.js+TS / Tailwind / Zustand / shadcn / Vitest+Playwright;
133
+ 后端 Go+Gin;DB MySQL 8 + Redis;基础设施 K8s + GitHub Actions;
134
+ 禁止自建消息队列,复用公司 Kafka。
135
+ ```
136
+
137
+ After the user answers:
138
+
139
+ 1. Record answers for §2.2 技术选型 + fold into §2.4 决策评审表 (new D-rows).
140
+ 2. Suggest (do not force) updating `design.md` via `/specflow:refine` later; approval may
141
+ proceed with chat-confirmed stack for this `approval.md` only.
142
+ 3. Re-run dbStack detection if the user named a DB; re-check FE 五元组 if UI in scope.
143
+ 4. Continue subsequent stages.
144
+
145
+ If the user refuses to choose and the change clearly needs a stack → mark
146
+ `[待 refine 澄清: 技术选型]` and **do not** fabricate architecture/DDL/页面树 around a
147
+ guessed stack.
90
148
 
91
149
  ---
92
150
 
@@ -95,36 +153,30 @@ Announce: "Generating technical approval document for change `<name>` (phase=ref
95
153
  Read these files and follow them:
96
154
 
97
155
  1. `.claude/specflow/prompts/approval/generate.md` (or repo `prompts/approval/generate.md`)
98
- 2. `prompts/approval/database-guidance.md` — DB **guidance pack** router for packs under
99
- `{ide}/specflow/guidance/database/` (installed by init; **not** an IDE skill) with
100
- package fallback `skills/database/`. **Not an MCP tool**: on `dbStack` hit, `Read`
101
- matched `SKILL.md` + focused references; on `none` or missing files, LLM-only §4.4.
102
- Never "invoke `/mysql` skill" always `Read` a resolved path.
103
-
104
- `generate.md` + `database-guidance.md` together specify:
105
-
106
- - The 7-dimension closed-loop verification (Passes 1–7, each with AI self-prompt, verdict rules, evidence format)
107
- - The design quality assessment (over-engineering signals + extensibility signals)
108
- - The architecture design (Mermaid diagrams + **图要点说明** + core-component table)
109
- - The detailed design generation (设计要点一览 + Happy Path 完整时序 + 业务场景时序与说明 +
110
- data ER/DDL + interfaces inventory/fields/examples/errors + logic/config/compat)
111
- - The test strategy (layered test matrix mapped to §5 acceptance criteria)
112
- - The deployment/release/rollback plan
113
- - The implementability assessment (7 dimensions with verdict rules)
114
- - The approval document structure and generation rules
115
- - Protocol-marker preservation and language policy enforcement
116
- - §1 绪论与边界 (proposal + optional explore + AI; absorbs What/Impact; **no 变更摘要 chapter**;
117
- pain-point diagram, User Journey, Non-Goals with reasons)
118
- - Document order: §1 绪论 §2 评估 → §3 架构 → §4 详细设计 → **§5 验收标准** → §6 测试 → …
119
- - **Quality Gates G1–G4** + **Style & Tone** (hard rules in generate.md Part E)
120
- - **DB guidance router** (`database-guidance.md` + guidance pack `database`): match project
121
- stack resolve `{ide}/specflow/guidance/database/<stack>/` (or package `skills/database/`)
122
- → `Read`; miss → LLM-fallback. Packs are **not** installed under IDE `skills/` discovery.
123
- stack → Read in-repo skill; no hit → LLM fallback; **never** fetch remote skills / MCP wrap
124
- - Anchor-file extraction and code-reading rules (depth: anchor file only, no recursion)
125
-
126
- You MUST read `generate.md` before performing any analysis or writing `approval.md`. Do not
127
- invent the assessment dimensions or document structure — they are defined in that prompt.
156
+ 2. `prompts/approval/database-guidance.md` — SpecFlow DB **guidance pack** router
157
+ 3. `prompts/approval/frontend-guidance.md` UI scope + FE 五元组 + §4.6 contract
158
+ 4. `prompts/approval/project-conventions-guidance.md` **project** skill/rule/docs
159
+ lazy-load (architecture / api / database / frontend); cross-IDE path resolve;
160
+ priority **project > SpecFlow guidance > LLM**
161
+
162
+ `generate.md` + convention/DB/FE routers together specify:
163
+
164
+ - The 7-dimension closed-loop verification (Passes 1–7)
165
+ - Design quality, architecture, detailed design, test/deploy (optional chapters), implementability
166
+ - Document order: §1 → §2 → §3 → §4 → **(optional §5)** §6 **(optional §7/§8)** → §9 → §10(签字栏 only)
167
+ - **Quality Gates G1–G6** + **Style & Tone**(含禁止正文代码腔)
168
+ - **Optional chapters** §5 / §7 / §8 — ask before write; **AI 预审** chat-only
169
+ - **Project conventions** lazy-load before §3/§4.4/§4.5/§4.6; **project > SpecFlow guidance > LLM**
170
+ - **DB guidance** after project DB conventions; resolve
171
+ `{ide}/specflow/guidance/database/<stack>/` (or package `skills/database/`); record
172
+ 项目约定 + DB 技能 + `dbStack` in §4.4.1; never fetch remote / MCP
173
+ - **FE guidance** when `uiInScope=yes`: `frontend-guidance.md` §3 **must** scan
174
+ IDE skills/rules + 落地文档(组件/路由/状态/表单/样式/a11y/测试) + `topic=frontend`;
175
+ §4.6 cites 项目约定 + IDE skills/rules; G5/G6; Visual Loop; never invent page trees
176
+ - **Tech stack intake**: greenfield or four-artifacts missing 前端/后端/数据库与缓存/基础设施
177
+ ask user before inventing stacks; FE needs 五元组; record in §2.2; never fabricate
178
+
179
+ You MUST read `generate.md` before any analysis or writing `approval.md`.
128
180
 
129
181
  ---
130
182
 
@@ -181,9 +233,10 @@ After all 7 Passes:
181
233
  - `PASS WITH WARNINGS` if no `FAIL` but at least one `WARNING`
182
234
  - `PASS` if all Passes are `PASS` (a `SKIPPED` Pass does not affect the verdict)
183
235
 
184
- When writing `approval.md` **§8**, use the **single compact table** only (see generate.md
185
- Part E §8): no per-Pass long sections, no duplicate summary table. Expand evidence only
186
- for ⚠️/❌ rows (max 2–3 bullets).
236
+ When writing `approval.md` **§8** (only if the user opted in), use the **single compact
237
+ table** only (see generate.md Part E §8). Always run Passes 1–7 for the **chat** summary
238
+ even when §8 is omitted from the document. Expand evidence only for ⚠️/❌ rows
239
+ (max 2–3 bullets); PASS/SKIPPED stay one line.
187
240
 
188
241
  ---
189
242
 
@@ -227,9 +280,11 @@ Scan `design.md` for the 5 extensibility signals:
227
280
 
228
281
  ## Stage 6: Architecture Design
229
282
 
230
- Produce the **architecture design** section (approval.md **§3** 架构整体设计) defined in
231
- `generate.md` Part E. This answers "what modules make up the system, how they depend on
232
- and interact with each other, and what each module's responsibility and boundary is."
283
+ **Before drafting §3**: follow `project-conventions-guidance.md` with `topic=architecture`
284
+ (lazy-load ≤3 project convention files). Apply project bans to 图要点; cite path or「未发现」.
285
+
286
+ Produce the **architecture design** section (approval.md **§3**) defined in
287
+ `generate.md` Part E.
233
288
 
234
289
  It is complementary to Detailed Design: architecture is about **module-to-module
235
290
  relationships** (macro), detailed design is about **module-internal implementation**
@@ -278,22 +333,30 @@ Produce the **detailed design** section (approval.md **§4** 方案详细设计)
278
333
 
279
334
  **Selective** categories; uninvolved ones get explicit「不涉及 X」markers.
280
335
 
281
- Order and hard requirements (from `generate.md` §4.1–4.8):
336
+ Order and hard requirements (from `generate.md` §4.1–4.9):
282
337
 
283
338
  1. **设计要点一览** — P1…Pn invariants from design decisions (required).
284
339
  2. **核心业务时序 · Happy Path** — complete Mermaid `sequenceDiagram` for the main success
285
340
  path + post-diagram「设计要点」(required).
286
341
  3. **业务场景时序** — each scenario: purpose + diagram + **设计要点说明** (required notes;
287
342
  bare diagrams fail quality).
288
- 4. **数据结构** — Before drafting §4.4: follow `database-guidance.md`. If `dbStack` hit,
289
- resolve then `Read` `{ide}/specflow/guidance/database/<stack>/SKILL.md` (init-installed
290
- guidance pack) or package fallback `skills/database/<stack>/SKILL.md` (+ refs as needed).
291
- If `none` or files missing, LLM-only with SpecFlow §4.4 hard bar (ER + full CREATE TABLE…).
292
- Cite the actual path in §4.4 总则. **Never** install/invoke database as an IDE skill.
293
- **Outline**: only `4.4.1–4.4.4` + `##### table`; DDL/字段说明/JSON = `**bold**`, not headings.
294
- 5. **接口设计** — inventory + fields + examples + errors…
295
- **Outline**: only `4.5.1–4.5.3` + `##### In`; 请求体字段/示例/错误 = `**bold**`, not headings.
296
- 6. **核心算法 / 配置 / 兼容性** — as applicable.
343
+ 4. **数据结构** — Before §4.4: (1) `project-conventions-guidance.md` `topic=database`;
344
+ (2) `database-guidance.md` + SpecFlow guidance pack / `dbStack`; (3) live DDL/anchors.
345
+ Priority: **project + live DDL > SpecFlow pack > LLM**. §4.4.1 must list 项目约定 + DB 技能.
346
+ **Outline**: only `4.4.1–4.4.4` + `##### table`; DDL/字段说明/JSON = `**bold**`.
347
+ 5. **接口设计** Before §4.5: `project-conventions-guidance.md` `topic=api`.
348
+ Then inventory + fields + examples + errors…
349
+ **Outline**: only `4.5.1–4.5.3` + `##### In`; 请求体字段/示例/错误 = `**bold**`.
350
+ 6. **前端 / UI** When `uiInScope=yes`: before §4.6:
351
+ (1) `project-conventions-guidance.md` `topic=frontend`;
352
+ (2) **`frontend-guidance.md` §3** — 强制扫描 IDE skills/rules(`.cursor`/`.claude`/`.agents`)
353
+ 与落地文档(组件命名、路由、状态、表单、API client、样式/token、a11y、测试命令、lint 禁令);
354
+ 合计 ≤5 文件,禁止 `invoke` skill;
355
+ (3) live UI anchors from design/tasks.
356
+ Then write 五元组 + 页面/路由 + Page 详设(空/加载/错态) + 状态 + Visual Loop.
357
+ §4.6.1 must list **项目约定** + **IDE skills/rules**.
358
+ **Outline**: only `4.6.1–4.6.5` + `##### Page · …`. **G5/G6**. Omit chapter if no UI.
359
+ 7. **核心算法 / 配置 / 兼容性** — §4.7–4.9 as applicable.
297
360
 
298
361
  **Traceability**: every element → **§5** Requirement/Scenario and **§2** decision.
299
362
  If not implementer-ready, mark `[待 refine 澄清: <元素>]`.
@@ -302,24 +365,34 @@ Present the detailed design to the user as part of the confirmation summary.
302
365
 
303
366
  ---
304
367
 
305
- ## Stage 8: Acceptance Criteria (after design)
368
+ ## Stage 8: Acceptance Criteria (optional)
369
+
370
+ **Ask the user** whether to include **§5 验收标准** in `approval.md`.
306
371
 
307
- Produce **§5 验收标准** only **after** §3 architecture and §4 detailed design are drafted
308
- in the document order. Exhaustive Requirement + Scenario list with 3-level testability.
309
- Do not place acceptance before the design chapters.
372
+ - If **yes**: produce §5 only **after** §3/§4 are drafted; exhaustive Requirement +
373
+ Scenario list with 3-level testability.
374
+ - If **no**: omit the entire chapter (no placeholder).
310
375
 
311
376
  ---
312
377
 
313
378
  ## Stage 9: Test Strategy
314
379
 
315
- Produce the **test strategy** section (approval.md **§6** 测试策略). Every §5 acceptance
316
- criterion maps to ≥1 test layer with tools and verifiable goals.
380
+ Produce **§6 测试策略**. If §5 is included, every criterion maps to ≥1 test layer.
381
+ If §5 was omitted, map layers to named Requirement/Scenario from delta specs.
382
+
383
+ ---
384
+
385
+ ## Stage 10: Deployment & Release (optional)
386
+
387
+ **Ask the user** whether to include **§7 部署/发布/回滚**. If yes, produce the section;
388
+ if no, omit entirely.
317
389
 
318
390
  ---
319
391
 
320
- ## Stage 10: Deployment & Release
392
+ ## Stage 10b: Closed-Loop table (optional)
321
393
 
322
- Produce the **deployment / release / rollback** section (approval.md **§7**).
394
+ Closed-loop **analysis** (Passes 1–7) always runs. **Ask the user** whether to include
395
+ **§8 闭环性检查表** in the document. If no, omit §8; still report overall verdict in chat.
323
396
 
324
397
  ---
325
398
 
@@ -345,57 +418,151 @@ Each dimension produces a verdict (`READY` | `NEEDS REFINEMENT` | `BLOCKED`) wit
345
418
 
346
419
  ---
347
420
 
348
- ## Stage 12: Generate approval.md
421
+ ## Stage 12: Generate approval.md (Index → Map → CLI Reduce)
422
+
423
+ Follow `generate.md` Part E (structure) and Part F (segmented pipeline + anti-lazy rules).
424
+ Read `prompts/approval/segmented-generation.md` when `mode=segmented`.
425
+
426
+ **Output artifact**: `specflow/changes/<name>/approval.md`
427
+ **Workspace** (segmented): `specflow/changes/<name>/approval/` — `index.yaml`, `analysis.json`, `parts/*.md`, `manifest.json`
428
+
429
+ ### 12.0 Mode selection (before writing)
430
+
431
+ | Trigger | Mode |
432
+ |---------|------|
433
+ | `tables > 2` OR `interfaces > 3` OR `pages > 2` OR user opted §5 | **segmented** (mandatory) |
434
+ | Else | ask user: **segmented** (recommended) or **monolithic** |
435
+
436
+ Copy `templates/approval-index.yaml` → `approval/index.yaml`; fill `tables[]` / `interfaces[]` / `pages[]` with stable ids and `part` paths **before** any Map batch.
437
+
438
+ **Anti-lazy (hard)**: when segmented, **never** one-shot the full `approval.md`; **never** stub parts (`TODO` / `待补充` / empty); **always** finish with CLI Reduce (12d).
349
439
 
350
- Following the document structure and generation rules in `generate.md` Part E, produce
351
- `approval.md` inside the change directory at `specflow/changes/<name>/approval.md`.
440
+ ### 12a Index + Skeleton
352
441
 
353
- Document chapter order (hard):
442
+ Write **first** (Gate depends on this):
354
443
 
355
- 1. §1 绪论与边界 (proposal + optional explore + AI; includes What/Impact; **no 变更摘要**)
356
- 2. §2 技术方案评估
357
- 3. §3 架构整体设计 (图 + **图要点说明** + 组件)
358
- 4. §4 方案详细设计 (设计要点 + Happy Path + 业务场景说明 + 数据/接口…)
359
- 5. §5 验收标准 (**after** design)
360
- 6. §6 测试策略 → §7 部署 → §8 闭环 → §9 可实施性 → §10 审批
444
+ 1. `approval/index.yaml` full `parts_order`, entity inventory, `optional.s5/s7/s8`, `mode`
445
+ 2. `approval/analysis.json` — Pass 1–7 + quality + implementability summaries
446
+ 3. `approval/parts/` skeleton:
447
+ - `01-intro.md` `03-architecture.md`
448
+ - `04-detail-core.md` (§4.1–4.3 only)
449
+ - `06-test.md`, `09-implementability.md`, `10-signoff.md`
361
450
 
362
- Key rules:
451
+ Use `templates/approval-part.md` fragment header; parts use `###`/`####` only — **no** foreign `## N.` headings.
363
452
 
364
- - §1 truthful: pains from proposal/design/confirmed explore; User Journey → §5; Non-Goals with reasons; What/Impact in §1.2.
365
- - Decision Review includes every `design.md` decision.
366
- - §5 Acceptance exhaustive with 3-level testability; placed after §3/§4.
367
- - §3 every architecture diagram has「设计说明 / 图要点」; component table with「不做什么」.
368
- - §4 has 设计要点一览, complete Happy Path sequence + notes, each business scenario with 设计要点; DB/API hard bars (§4.4/§4.5); outline hygiene (no heading for 请求体字段/DDL/字段说明 — bold labels only).
369
- - **Quality Gates G1–G4**: >5-line prose flow → Mermaid; interfaces need failure examples; JSON/new-column need存量填充策略; rollback data compatibility explicit.
370
- - **Style & Tone**: plain language; gloss obscure abbreviations on first use; ban「尽量/大概/一般情况下」; use「必须/禁止/采用 XX 方案」.
371
- - **§8 闭环**: one compact table only; PASS one line; ⚠️/❌ ≤3 bullets; no per-Pass essays.
372
- - Test Strategy maps every §5 criterion to ≥1 layer.
373
- - Deployment selective; Code Grounding cites real files; sign-off blank; never recommend approve if any verdict is `FAIL`.
453
+ ### 12b Map Append (batched §4.4 / §4.5 / §4.6 / §4.7–§4.9)
454
+
455
+ Per batch, Read only: `index.yaml`, `analysis.json` digests, design/tasks/spec snippets for batch ids, lazy-loaded conventions (caps per topic), anchor files.
456
+
457
+ Respect `index.batching.*_per_call`. After each part: update `approval/manifest.json` entry.
458
+
459
+ Minimums (no shortcuts see Part E hard rules 9–10, 18–20):
460
+
461
+ - §4.4 batch: DDL + 字段说明 + 本迭代用法 per table; G3/G4 when applicable
462
+ - §4.5 batch: meta + fields + success examples + **failure example (G2)** + error table per interface (**含不变**;完整格式,禁止精简)
463
+ - §4.6 batch (when `uiInScope`): IDE skills/rules scan first; page/route + states + G6; §4.5 `In` refs
464
+
465
+ ### 12c Optional chapters
466
+
467
+ Only if user accepted **and** `optional.s5/s7/s8: true` in index:
468
+
469
+ - Insert `05-*` / `07-deploy` / `08-closed-loop` into `parts_order`
470
+ - §8: one table only (from analysis)
471
+
472
+ ### 12d CLI Reduce (mandatory for segmented)
473
+
474
+ ```bash
475
+ specflow approval check <change>
476
+ specflow approval assemble <change> --force
477
+ ```
478
+
479
+ - `check` must pass with **zero errors** before assemble
480
+ - Reduce is **deterministic** — no LLM stitching
481
+ - Report final path: `specflow/changes/<name>/approval.md`
482
+
483
+ ### Monolithic fast path
484
+
485
+ When user chose `mode: monolithic` and lightweight inventory: write `approval.md` directly **or** parts + single assemble. Same Part E quality bars apply.
486
+
487
+ Document chapter order (hard for included chapters):
488
+
489
+ 1. §1 绪论与边界
490
+ 2. §2 技术方案评估 — **可读中文**写现状与约束(禁止代码腔堆砌)
491
+ 3. §3 架构整体设计
492
+ 4. §4 方案详细设计
493
+ 5. §5 验收标准 — **仅用户确认要时**
494
+ 6. §6 测试策略
495
+ 7. §7 部署 — **仅用户确认要时**
496
+ 8. §8 闭环表 — **仅用户确认要时**(分析仍必做)
497
+ 9. §9 可实施性评估
498
+ 10. §10 审批 — **仅人工签字栏**(无 AI 预审小节)
499
+
500
+ Key rules (all modes):
501
+
502
+ - §1 truthful; Journey traces to §5 if present else named specs; Non-Goals with reasons.
503
+ - **§2.2 技术选型**: required for greenfield or when four artifacts lack needed stack
504
+ dimensions; only after Tech Stack Intake (user confirm); never invent full stack.
505
+ Frontend (when UI) needs 五元组, not「React」alone.
506
+ - Decision Review includes every `design.md` decision (plus D-FE/D-BE/D-DB/D-Infra when intake ran).
507
+ - §5 when included: exhaustive + after §3/§4.
508
+ - §3/§4 hard bars + outline hygiene; **G1–G6**; Style & Tone including **no code-dump prose**.
509
+ - §4.6 when `uiInScope`: pages/routes + G5/G6 + Visual Loop; **must Read** IDE
510
+ skills/rules/落地规约 before draft; cite paths in §4.6.1; omit if no UI.
511
+ - §8 when included: one compact table; always report closed-loop verdict in chat.
512
+ - Test Strategy maps to §5 or specs names; Deployment only if opted in.
513
+ - Sign-off blank; **never** write AI pre-approval into the file; never recommend approve if any verdict is `FAIL`.
374
514
 
375
515
  ---
376
516
 
377
517
  ## Gate: User Confirmation
378
518
 
379
- Present a summary to the user:
519
+ Present a summary to the user (**chat only** — these are not document chapters):
380
520
 
381
521
  - Closed-loop overall verdict (PASS / PASS WITH WARNINGS / FAIL)
382
522
  - Design quality verdict (PASS / WARNING / FAIL)
383
523
  - Implementability overall verdict (READY / NEEDS REFINEMENT / BLOCKED)
384
- - AI pre-approval recommendation (建议批准 / 有条件批准 / 退回 refine / 拒绝)
524
+ - **AI pre-approval recommendation** (建议批准 / 有条件批准 / 退回 refine / 拒绝) + 理由
385
525
  - The path where `approval.md` will be written
386
526
 
387
- Ask explicitly:
527
+ Ask explicitly about **optional chapters** (record in `approval/index.yaml` → `optional.s5/s7/s8`):
528
+
529
+ ```text
530
+ 是否将以下章节写入审批文档?
531
+ - §5 验收标准: 要 / 不要
532
+ - §7 部署/发布/回滚: 要 / 不要
533
+ - §8 闭环性检查表: 要 / 不要
534
+ ```
535
+
536
+ If not forced segmented, ask generation mode:
537
+
538
+ ```text
539
+ 审批文档生成方式:
540
+ - segmented (推荐): 分片写入 approval/parts/,CLI 拼接 approval.md
541
+ - monolithic: 一次性写入 approval.md(仅轻量变更)
542
+ ```
543
+
544
+ **After Stage 12a**, show index inventory (tables / interfaces / pages) and ask:
545
+
546
+ > "确认 index 与可选章节后继续 Map 生成?"
547
+
548
+ Do NOT run 12b until index + optional choices are confirmed.
549
+
550
+ After 12b/12c, run `specflow approval check` and fix all errors before asking final write.
551
+
552
+ Then ask:
388
553
 
389
- > "确认生成审批文档并写入 `specflow/changes/<name>/approval.md`?"
554
+ > "确认拼接并写入 `specflow/changes/<name>/approval.md`?"
390
555
 
391
- Do NOT write the file until the user confirms. If the user wants changes to the assessment,
392
- re-run the relevant Pass or dimension and update the summary before re-asking.
556
+ Do NOT assemble until the user confirms (unless they already confirmed end-to-end generation).
393
557
 
394
558
  On confirmation:
395
559
 
396
- 1. Write `approval.md` to the change directory.
397
- 2. Do NOT change `phase` it remains `refined`.
398
- 3. Report the file path and next-step suggestions.
560
+ 1. **Segmented**: `specflow approval assemble <change> --force` do not paste assembled markdown manually.
561
+ 2. **Monolithic**: write `approval.md` directly (or parts + assemble).
562
+ 3. Include only optional chapters the user accepted.
563
+ 4. Do **not** include「AI 预审建议」in the file.
564
+ 5. Do NOT change `phase` — it remains `refined`.
565
+ 6. Report the file path and next-step suggestions.
399
566
 
400
567
  ---
401
568
 
@@ -0,0 +1,52 @@
1
+ # specflow.approval.index/v1 — copy to specflow/changes/<name>/approval/index.yaml
2
+ schema: specflow.approval.index/v1
3
+ change: <change-name>
4
+ generated_at: 2026-08-26T12:00:00+08:00
5
+ mode: segmented
6
+ ui_in_scope: false
7
+ db_in_scope: true
8
+ api_in_scope: true
9
+
10
+ optional:
11
+ s5: false
12
+ s7: false
13
+ s8: false
14
+
15
+ parts_order:
16
+ - 01-intro
17
+ - 02-design-review
18
+ - 03-architecture
19
+ - 04-detail-core
20
+ - 04.4-data
21
+ - 04.5-api
22
+ - 04.7-logic
23
+ - 04.8-config
24
+ - 04.9-compat
25
+ - 06-test
26
+ - 09-implementability
27
+ - 10-signoff
28
+
29
+ design_points: [P1]
30
+ decisions: [D1]
31
+
32
+ tables: []
33
+ interfaces: []
34
+ pages: []
35
+ capabilities: []
36
+
37
+ batching:
38
+ tables_per_call: 3
39
+ interfaces_per_call: 3
40
+ pages_per_call: 3
41
+ capabilities_per_call: 1
42
+
43
+ conventions:
44
+ architecture: []
45
+ database: []
46
+ api: []
47
+ frontend: []
48
+
49
+ meta:
50
+ language: zh-CN
51
+ tech_stack: unknown
52
+ project_mode: brownfield
@@ -0,0 +1,15 @@
1
+ <!--
2
+ Approval part fragment — NOT a standalone document.
3
+ Written under specflow/changes/<name>/approval/parts/<part-id>.md
4
+ Assembled by: specflow approval assemble <change>
5
+ -->
6
+
7
+ <!-- part-id: <must match filename without .md> -->
8
+ <!-- index-ref: approval/index.yaml parts_order -->
9
+
10
+ <!-- FORBIDDEN in parts:
11
+ - Top-level "# 技术方案审批文档"
12
+ - Foreign chapter headings "## N." not owned by this part
13
+ - TODO / 待补充 / 此处省略 / 详见 design (without §ref)
14
+ - Empty or placeholder-only body
15
+ -->