@gordon.gan/specflow 1.4.4-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.
@@ -418,10 +418,71 @@ Each dimension produces a verdict (`READY` | `NEEDS REFINEMENT` | `BLOCKED`) wit
418
418
 
419
419
  ---
420
420
 
421
- ## Stage 12: Generate approval.md
421
+ ## Stage 12: Generate approval.md (Index → Map → CLI Reduce)
422
422
 
423
- Following the document structure and generation rules in `generate.md` Part E, produce
424
- `approval.md` inside the change directory at `specflow/changes/<name>/approval.md`.
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).
439
+
440
+ ### 12a Index + Skeleton
441
+
442
+ Write **first** (Gate depends on this):
443
+
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`
450
+
451
+ Use `templates/approval-part.md` fragment header; parts use `###`/`####` only — **no** foreign `## N.` headings.
452
+
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.
425
486
 
426
487
  Document chapter order (hard for included chapters):
427
488
 
@@ -436,7 +497,7 @@ Document chapter order (hard for included chapters):
436
497
  9. §9 可实施性评估
437
498
  10. §10 审批 — **仅人工签字栏**(无 AI 预审小节)
438
499
 
439
- Key rules:
500
+ Key rules (all modes):
440
501
 
441
502
  - §1 truthful; Journey traces to §5 if present else named specs; Non-Goals with reasons.
442
503
  - **§2.2 技术选型**: required for greenfield or when four artifacts lack needed stack
@@ -463,7 +524,7 @@ Present a summary to the user (**chat only** — these are not document chapters
463
524
  - **AI pre-approval recommendation** (建议批准 / 有条件批准 / 退回 refine / 拒绝) + 理由
464
525
  - The path where `approval.md` will be written
465
526
 
466
- Ask explicitly about **optional chapters**:
527
+ Ask explicitly about **optional chapters** (record in `approval/index.yaml` → `optional.s5/s7/s8`):
467
528
 
468
529
  ```text
469
530
  是否将以下章节写入审批文档?
@@ -472,20 +533,36 @@ Ask explicitly about **optional chapters**:
472
533
  - §8 闭环性检查表: 要 / 不要
473
534
  ```
474
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
+
475
552
  Then ask:
476
553
 
477
- > "确认生成审批文档并写入 `specflow/changes/<name>/approval.md`?"
554
+ > "确认拼接并写入 `specflow/changes/<name>/approval.md`?"
478
555
 
479
- Do NOT write the file until the user answers the optional-chapter choices **and** confirms.
480
- If the user wants changes to the assessment, re-run the relevant Pass or dimension and
481
- update the summary before re-asking.
556
+ Do NOT assemble until the user confirms (unless they already confirmed end-to-end generation).
482
557
 
483
558
  On confirmation:
484
559
 
485
- 1. Write `approval.md` including only the optional chapters the user accepted.
486
- 2. Do **not** include「AI 预审建议」in the file.
487
- 3. Do NOT change `phase` it remains `refined`.
488
- 4. 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.
489
566
 
490
567
  ---
491
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
+ -->