@gordon.gan/specflow 1.5.0-beta → 1.7.0-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.
Files changed (39) hide show
  1. package/README.md +2 -2
  2. package/dist/cli/commands/approval-assemble.d.ts +48 -5
  3. package/dist/cli/commands/approval-assemble.js +347 -34
  4. package/dist/core/approval/assemble.js +15 -22
  5. package/dist/core/approval/bundle.d.ts +9 -0
  6. package/dist/core/approval/bundle.js +172 -0
  7. package/dist/core/approval/forbidden-patterns.d.ts +6 -0
  8. package/dist/core/approval/forbidden-patterns.js +37 -0
  9. package/dist/core/approval/index-schema.d.ts +203 -0
  10. package/dist/core/approval/index-schema.js +47 -0
  11. package/dist/core/approval/index.d.ts +10 -2
  12. package/dist/core/approval/index.js +7 -1
  13. package/dist/core/approval/lint.d.ts +10 -0
  14. package/dist/core/approval/lint.js +302 -0
  15. package/dist/core/approval/paths.d.ts +5 -0
  16. package/dist/core/approval/paths.js +15 -0
  17. package/dist/core/approval/pipeline.d.ts +28 -0
  18. package/dist/core/approval/pipeline.js +146 -0
  19. package/dist/core/approval/playbook-schema.d.ts +182 -0
  20. package/dist/core/approval/playbook-schema.js +51 -0
  21. package/dist/core/approval/render.d.ts +20 -0
  22. package/dist/core/approval/render.js +210 -0
  23. package/dist/core/approval/review-pack.d.ts +26 -0
  24. package/dist/core/approval/review-pack.js +205 -0
  25. package/dist/core/approval/types.d.ts +103 -0
  26. package/dist/integrations/shared/capability-evidence.js +2 -0
  27. package/dist/integrations/shared/parity-manifest.js +2 -0
  28. package/package.json +2 -1
  29. package/prompts/approval/acp-pipeline.md +104 -0
  30. package/prompts/approval/ai-review.md +145 -0
  31. package/prompts/approval/generate.md +94 -9
  32. package/prompts/approval/multi-repo-guidance.md +46 -10
  33. package/prompts/approval/runtime-guidance.md +64 -0
  34. package/prompts/approval/segmented-generation.md +14 -8
  35. package/skills/GUIDANCE_PACKS.md +1 -1
  36. package/skills/specflow-approval/SKILL.md +48 -25
  37. package/templates/approval-index.yaml +25 -4
  38. package/templates/approval-part.md +1 -1
  39. package/templates/approval-playbook.yaml +28 -0
@@ -116,19 +116,15 @@ Read **`prompts/approval/multi-repo-guidance.md`**.
116
116
 
117
117
  ```text
118
118
  跨 N 个仓库,审批技术文档如何产出?
119
- A) 一份合订 (unified) — 单份 approval.md
120
- B) 多份分仓 (per_repo) — 每仓各自 approval.md
119
+ A) 一份合订视图 (bundle) — 各仓 per_repo 真源 + CLI bundle 只读合订 (**推荐**)
120
+ B) 多份分仓 (per_repo) — 每仓各自 approval.md(默认 Map 模式)
121
+ C) 一份 LLM 合订 (legacy unified) — 仅当用户明确要求且无 bundle;不推荐
121
122
  ```
122
123
 
123
- 4. If **A** ask **主仓** (stores `approval.md` + `approval/` workspace):
124
-
125
- ```text
126
- 合订文档存放在哪个主仓? (talos / talos-web / talos-worker / …)
127
- ```
128
-
129
- 5. Write `approval/index.yaml` → `multi_repo` with user choices + `outputs`.
130
- 6. **Unified**: Stage 12 workspace + `specflow approval assemble` run in **primary** planning root only.
131
- 7. **Per_repo**: repeat Stage 12 + assemble **per repo** (scope = that repo only).
124
+ 4. **A (recommended)**: `document_mode: per_repo` + `multi_repo.bundle.enabled: true` + primary repo for playbook output; **B**: per_repo only; **C**: legacy unified (discourage).
125
+ 5. If **A or C** — ask **主仓** for playbook/bundle output path.
126
+ 6. Write `approval/index.yaml` → `multi_repo` + `acp.pipeline: acp/v2`.
127
+ 7. **Per_repo**: Stage 12 + ACP **per repo**; if **A**, run `specflow approval bundle` after all repos assemble.
132
128
 
133
129
  Single-repo → skip (`multi_repo.enabled=false`).
134
130
 
@@ -455,7 +451,7 @@ Each dimension produces a verdict (`READY` | `NEEDS REFINEMENT` | `BLOCKED`) wit
455
451
  ## Stage 12: Generate approval.md (Index → Map → CLI Reduce)
456
452
 
457
453
  Follow `generate.md` Part E (structure) and Part F (segmented pipeline + anti-lazy rules).
458
- Read `prompts/approval/segmented-generation.md` when `mode=segmented`.
454
+ Read `prompts/approval/segmented-generation.md` when `mode=segmented`; read `prompts/approval/acp-pipeline.md` for ACP verify/finalize flow.
459
455
 
460
456
  **Output artifact**: `specflow/changes/<name>/approval.md`
461
457
  **Workspace** (segmented): `specflow/changes/<name>/approval/` — `index.yaml`, `analysis.json`, `parts/*.md`, `manifest.json`
@@ -469,7 +465,7 @@ Read `prompts/approval/segmented-generation.md` when `mode=segmented`.
469
465
 
470
466
  Copy `templates/approval-index.yaml` → `approval/index.yaml`; fill `tables[]` / `interfaces[]` / `pages[]` with stable ids and `part` paths **before** any Map batch.
471
467
 
472
- **Anti-lazy (hard)**: when segmented, **never** one-shot the full `approval.md`; **never** stub parts (`TODO` / `待补充` / empty); **always** finish with CLI Reduce (12d).
468
+ **Anti-lazy (hard)**: when segmented, **never** one-shot the full `approval.md`; **never** stub parts (`TODO` / `待补充` / empty); **always** finish with `specflow approval finalize` (Stage 12f).
473
469
 
474
470
  ### 12a Index + Skeleton
475
471
 
@@ -506,16 +502,43 @@ Only if user accepted **and** `optional.s5/s7/s8: true` in index:
506
502
  - Insert `05-*` / `07-deploy` / `08-closed-loop` into `parts_order`
507
503
  - §8: one table only (from analysis)
508
504
 
509
- ### 12d CLI Reduce (mandatory for segmented)
505
+ ### 12e AI Review (ACP — in-session, mandatory for non-lightweight)
506
+
507
+ Read **`prompts/approval/ai-review.md`**. This step runs **inside `/specflow-approval`** — not as separate user-facing commands.
508
+
509
+ 1. Run once (or when paused): `specflow approval finalize <change>` — if `review-result.json` missing, CLI pauses and writes `review-packet.json`.
510
+ 2. Read `review-packet.json` + all parts; fix **parts only**; write `approval/review-result.json` (use `specflow approval review-hashes <change> --json` for `part_hashes`).
511
+ 3. Use **generic long-document checks** in `ai-review.md` (R1–R13). Load optional packs (`runtime-guidance.md`, `api-guidance.md`) **only** when the change design requires them.
512
+
513
+ Set in `index.yaml`:
514
+
515
+ ```yaml
516
+ acp:
517
+ pipeline: acp/v2
518
+ review:
519
+ enabled: true
520
+ required_pass: true
521
+ ```
522
+
523
+ ### 12f Finalize (one CLI — preferred)
524
+
525
+ After Map + AI Review, **one command** finishes Verify → Reduce → optional bundle:
510
526
 
511
527
  ```bash
512
- specflow approval check <change>
513
- specflow approval assemble <change> --force
528
+ specflow approval finalize <change> [--bundle] [--workspace-root <workset-root>]
514
529
  ```
515
530
 
516
- - `check` must pass with **zero errors** before assemble
517
- - Reduce is **deterministic** — no LLM stitching
518
- - Report final path: `specflow/changes/<name>/approval.md`
531
+ Chains: `lint --strict` → `review-check` `check` `assemble --force` `bundle` (when `multi_repo.bundle.enabled`).
532
+
533
+ **Do not** ask the user to run `lint` / `review-pack` / `review-check` / `assemble` separately unless debugging a single stage.
534
+
535
+ Low-level subcommands (`lint`, `review-pack`, `assemble`, …) remain for CI hooks and troubleshooting — not the default skill path.
536
+
537
+ ### 12g Multi-repo bundle
538
+
539
+ When `multi_repo.bundle.enabled`, `finalize --bundle` (or auto) produces readonly `approval-unified.md` from `approval-playbook.yaml`. **Apply 只用各仓 approval.md 真源。**
540
+
541
+ Optional HTML: `specflow approval render <change>` or `finalize --render` → `approval.html` (browser-readable; mermaid via CDN).
519
542
 
520
543
  ### Monolithic fast path
521
544
 
@@ -586,22 +609,22 @@ If not forced segmented, ask generation mode:
586
609
 
587
610
  Do NOT run 12b until index + optional choices are confirmed.
588
611
 
589
- After 12b/12c, run `specflow approval check` and fix all errors before asking final write.
612
+ After 12b/12c, run **Stage 12e AI Review** (fix parts, write `review-result.json` with `part_hashes`).
590
613
 
591
614
  Then ask:
592
615
 
593
- > "确认拼接并写入 `specflow/changes/<name>/approval.md`?"
616
+ > "确认 finalize 并写入 `specflow/changes/<name>/approval.md`?"
594
617
 
595
- Do NOT assemble until the user confirms (unless they already confirmed end-to-end generation).
618
+ Do NOT finalize until the user confirms (unless they already confirmed end-to-end generation).
596
619
 
597
620
  On confirmation:
598
621
 
599
- 1. **Segmented**: `specflow approval assemble <change> --force` — do not paste assembled markdown manually.
600
- 2. **Monolithic**: write `approval.md` directly (or parts + assemble).
622
+ 1. **Segmented**: `specflow approval finalize <change>` — do not paste assembled markdown manually; do not run lint/assemble subcommands separately unless debugging.
623
+ 2. **Monolithic**: write `approval.md` directly (or parts + finalize).
601
624
  3. Include only optional chapters the user accepted.
602
625
  4. Do **not** include「AI 预审建议」in the file.
603
626
  5. Do NOT change `phase` — it remains `refined`.
604
- 6. Report the file path and next-step suggestions.
627
+ 6. Report the file path (and bundle path if multi-repo) and next-step suggestions.
605
628
 
606
629
  ---
607
630
 
@@ -51,11 +51,28 @@ meta:
51
51
  tech_stack: unknown
52
52
  project_mode: brownfield
53
53
 
54
+ # ACP (recommended for non-lightweight) — see prompts/approval/acp-pipeline.md
55
+ acp:
56
+ pipeline: acp/v2
57
+ context_budget_tokens: 40000
58
+ output_budget_tokens: 8000
59
+ review:
60
+ enabled: true
61
+ required_pass: true
62
+ # feature_slices:
63
+ # - id: core-flow
64
+ # parts: [04-detail-core, 04.5-api]
65
+
54
66
  # 多仓时启用 (见 prompts/approval/multi-repo-guidance.md)
55
67
  # multi_repo:
56
68
  # enabled: true
57
- # document_mode: unified # unified | per_repo 用户确认后填写
58
- # primary_repo: talos # unified 时必填
69
+ # document_mode: per_repo # per_repo + bundle (推荐 A) | per_repo only (B) | unified (C)
70
+ # primary_repo: talos # bundle 或 unified 时必填
71
+ # bundle:
72
+ # enabled: true
73
+ # playbook: approval-playbook.yaml
74
+ # output: approval-unified.md
75
+ # readonly: true
59
76
  # repos:
60
77
  # - id: talos
61
78
  # label: 平台
@@ -66,7 +83,11 @@ meta:
66
83
  # role: web
67
84
  # change: <web-change-name>
68
85
  # outputs:
69
- # unified:
86
+ # per_repo:
87
+ # - repo: talos
88
+ # change: <change-name>
89
+ # path: specflow/changes/<change-name>/approval.md
90
+ # bundle:
70
91
  # repo: talos
71
92
  # change: <change-name>
72
- # path: specflow/changes/<change-name>/approval.md
93
+ # path: specflow/changes/<change-name>/approval-unified.md
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  Approval part fragment — NOT a standalone document.
3
3
  Written under specflow/changes/<name>/approval/parts/<part-id>.md
4
- Assembled by: specflow approval assemble <change>
4
+ Assembled by: specflow approval finalize <change>
5
5
  -->
6
6
 
7
7
  <!-- part-id: <must match filename without .md> -->
@@ -0,0 +1,28 @@
1
+ # specflow.approval.playbook/v1 — copy to specflow/changes/<change>/approval/approval-playbook.yaml
2
+ schema: specflow.approval.playbook/v1
3
+ change: <change-name>
4
+ title: <合订标题>
5
+ primary_repo: talos
6
+
7
+ sources:
8
+ - repo: talos
9
+ change: <platform-change>
10
+ include_parts: all
11
+ - repo: talos-web
12
+ change: <web-change>
13
+ root: /path/to/talos-web/planning-root
14
+ include_parts: [04.6-ui, 06-test]
15
+ - repo: talos-worker
16
+ change: <worker-change>
17
+ root: /path/to/talos-worker/planning-root
18
+ include_parts: [04.5-api-worker, 04.7-logic]
19
+
20
+ # optional overlay markdown under approval/overlays/
21
+ # overlay:
22
+ # - overlays/01-unified-scope.md
23
+
24
+ assemble:
25
+ inject_headers: true
26
+ dedupe_appendix: true
27
+ output: approval-unified.md
28
+ readonly: true