@gordon.gan/specflow 1.8.0-beta → 1.8.2-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 (181) hide show
  1. package/README.md +7 -5
  2. package/dist/cli/commands/document-run.d.ts +98 -0
  3. package/dist/cli/commands/document-run.js +1064 -0
  4. package/dist/cli/index.js +2 -2
  5. package/dist/core/artifact-language.js +11 -1
  6. package/dist/core/document/asset-paths.d.ts +15 -0
  7. package/dist/core/document/asset-paths.js +38 -0
  8. package/dist/core/document/chapters.d.ts +6 -0
  9. package/dist/core/document/chapters.js +38 -0
  10. package/dist/core/document/coverage.d.ts +25 -0
  11. package/dist/core/document/coverage.js +49 -0
  12. package/dist/core/document/digests.d.ts +40 -0
  13. package/dist/core/document/digests.js +144 -0
  14. package/dist/core/document/engine.d.ts +101 -0
  15. package/dist/core/document/engine.js +722 -0
  16. package/dist/core/document/extract.d.ts +61 -0
  17. package/dist/core/document/extract.js +437 -0
  18. package/dist/core/{approval → document}/forbidden-patterns.d.ts +4 -2
  19. package/dist/core/document/forbidden-patterns.js +36 -0
  20. package/dist/core/document/gates.d.ts +39 -0
  21. package/dist/core/document/gates.js +75 -0
  22. package/dist/core/document/input-digest.d.ts +63 -0
  23. package/dist/core/document/input-digest.js +200 -0
  24. package/dist/core/document/input-features.d.ts +43 -0
  25. package/dist/core/document/input-features.js +161 -0
  26. package/dist/core/document/lint.d.ts +39 -0
  27. package/dist/core/document/lint.js +147 -0
  28. package/dist/core/document/llm.d.ts +28 -0
  29. package/dist/core/document/llm.js +22 -0
  30. package/dist/core/document/map.d.ts +52 -0
  31. package/dist/core/document/map.js +296 -0
  32. package/dist/core/document/outline.d.ts +29 -0
  33. package/dist/core/document/outline.js +171 -0
  34. package/dist/core/document/paths.d.ts +23 -0
  35. package/dist/core/document/paths.js +36 -0
  36. package/dist/core/document/profile-validator.d.ts +23 -0
  37. package/dist/core/document/profile-validator.js +155 -0
  38. package/dist/core/document/profiles.d.ts +23 -0
  39. package/dist/core/document/profiles.js +76 -0
  40. package/dist/core/document/render.d.ts +61 -0
  41. package/dist/core/document/render.js +243 -0
  42. package/dist/core/document/review.d.ts +57 -0
  43. package/dist/core/document/review.js +202 -0
  44. package/dist/core/document/scene-detect.d.ts +32 -0
  45. package/dist/core/document/scene-detect.js +237 -0
  46. package/dist/core/document/schemas.d.ts +1111 -0
  47. package/dist/core/document/schemas.js +191 -0
  48. package/dist/integrations/shared/capability-evidence.js +4 -9
  49. package/dist/integrations/shared/command-catalog.js +2 -1
  50. package/dist/integrations/shared/parity-manifest.js +4 -9
  51. package/package.json +2 -1
  52. package/prompts/apply/phase-a-plan.md +1 -1
  53. package/prompts/document/map/acceptance.md +9 -0
  54. package/prompts/document/map/anti-ai.md +29 -0
  55. package/prompts/document/map/api-design.md +26 -0
  56. package/prompts/document/map/architecture.md +27 -0
  57. package/prompts/document/map/benchmark.md +26 -0
  58. package/prompts/document/map/closed-loop.md +9 -0
  59. package/prompts/document/map/compat-migration.md +31 -0
  60. package/prompts/document/map/component-design.md +30 -0
  61. package/prompts/document/map/config-runtime.md +9 -0
  62. package/prompts/document/map/core-flow.md +62 -0
  63. package/prompts/document/map/core-logic.md +9 -0
  64. package/prompts/document/map/data-model.md +18 -0
  65. package/prompts/document/map/deploy.md +26 -0
  66. package/prompts/document/map/fix.md +8 -0
  67. package/prompts/document/map/frontend-architecture.md +35 -0
  68. package/prompts/document/map/goal.md +8 -0
  69. package/prompts/document/map/impact.md +8 -0
  70. package/prompts/document/map/implementability.md +9 -0
  71. package/prompts/document/map/migration-guide.md +36 -0
  72. package/prompts/document/map/mvp-boundary.md +8 -0
  73. package/prompts/document/map/non-goals.md +8 -0
  74. package/prompts/document/map/ops.md +33 -0
  75. package/prompts/document/map/performance.md +32 -0
  76. package/prompts/document/map/poc-demo.md +25 -0
  77. package/prompts/document/map/regression.md +8 -0
  78. package/prompts/document/map/reproduce.md +8 -0
  79. package/prompts/document/map/requirement.md +8 -0
  80. package/prompts/document/map/research.md +25 -0
  81. package/prompts/document/map/root-cause.md +8 -0
  82. package/prompts/document/map/signoff.md +9 -0
  83. package/prompts/document/map/state-management.md +23 -0
  84. package/prompts/document/map/tech-selection.md +29 -0
  85. package/prompts/document/map/test-strategy.md +24 -0
  86. package/prompts/document/map/ui-design.md +21 -0
  87. package/prompts/document/outline/general.md +46 -0
  88. package/prompts/document/review/ai-review.md +57 -0
  89. package/prompts/document/shared/grounding.md +84 -0
  90. package/prompts/explore/explore-session.md +1 -1
  91. package/prompts/propose/design-draft.md +1 -1
  92. package/prompts/propose/proposal.md +1 -1
  93. package/prompts/propose/specs.md +1 -1
  94. package/prompts/propose/tasks-draft.md +1 -1
  95. package/prompts/refine/design-output.md +1 -1
  96. package/prompts/refine/update-artifacts.md +2 -0
  97. package/prompts/shared/artifact-language.md +13 -0
  98. package/skills/specflow-techdoc/SKILL.md +143 -0
  99. package/skills/specflow-techdoc-synth/SKILL.md +115 -0
  100. package/templates/document/chapters/acceptance.yaml +16 -0
  101. package/templates/document/chapters/api-design.yaml +29 -0
  102. package/templates/document/chapters/architecture.yaml +21 -0
  103. package/templates/document/chapters/benchmark.yaml +20 -0
  104. package/templates/document/chapters/closed-loop.yaml +22 -0
  105. package/templates/document/chapters/compat-migration.yaml +21 -0
  106. package/templates/document/chapters/component-design.yaml +22 -0
  107. package/templates/document/chapters/config-runtime.yaml +16 -0
  108. package/templates/document/chapters/core-flow.yaml +27 -0
  109. package/templates/document/chapters/core-logic.yaml +16 -0
  110. package/templates/document/chapters/data-model.yaml +25 -0
  111. package/templates/document/chapters/deploy.yaml +22 -0
  112. package/templates/document/chapters/fix.yaml +18 -0
  113. package/templates/document/chapters/frontend-architecture.yaml +22 -0
  114. package/templates/document/chapters/goal.yaml +17 -0
  115. package/templates/document/chapters/impact.yaml +16 -0
  116. package/templates/document/chapters/implementability.yaml +22 -0
  117. package/templates/document/chapters/migration-guide.yaml +21 -0
  118. package/templates/document/chapters/mvp-boundary.yaml +20 -0
  119. package/templates/document/chapters/non-goals.yaml +17 -0
  120. package/templates/document/chapters/ops.yaml +25 -0
  121. package/templates/document/chapters/performance.yaml +21 -0
  122. package/templates/document/chapters/poc-demo.yaml +22 -0
  123. package/templates/document/chapters/regression.yaml +16 -0
  124. package/templates/document/chapters/reproduce.yaml +16 -0
  125. package/templates/document/chapters/requirement.yaml +18 -0
  126. package/templates/document/chapters/research.yaml +22 -0
  127. package/templates/document/chapters/root-cause.yaml +18 -0
  128. package/templates/document/chapters/signoff.yaml +15 -0
  129. package/templates/document/chapters/state-management.yaml +22 -0
  130. package/templates/document/chapters/tech-selection.yaml +23 -0
  131. package/templates/document/chapters/test-strategy.yaml +23 -0
  132. package/templates/document/chapters/ui-design.yaml +28 -0
  133. package/templates/document/profiles/0to1.yaml +44 -0
  134. package/templates/document/profiles/approve.yaml +22 -0
  135. package/templates/document/profiles/bugfix.yaml +15 -0
  136. package/templates/document/profiles/feature.yaml +23 -0
  137. package/templates/document/profiles/frontend-0to1.yaml +47 -0
  138. package/templates/document/profiles/migration.yaml +42 -0
  139. package/templates/document/profiles/poc.yaml +46 -0
  140. package/dist/cli/commands/approval-assemble.d.ts +0 -64
  141. package/dist/cli/commands/approval-assemble.js +0 -408
  142. package/dist/core/approval/assemble.d.ts +0 -10
  143. package/dist/core/approval/assemble.js +0 -384
  144. package/dist/core/approval/bundle.d.ts +0 -9
  145. package/dist/core/approval/bundle.js +0 -172
  146. package/dist/core/approval/forbidden-patterns.js +0 -40
  147. package/dist/core/approval/index-schema.d.ts +0 -676
  148. package/dist/core/approval/index-schema.js +0 -193
  149. package/dist/core/approval/index.d.ts +0 -12
  150. package/dist/core/approval/index.js +0 -9
  151. package/dist/core/approval/lint.d.ts +0 -10
  152. package/dist/core/approval/lint.js +0 -302
  153. package/dist/core/approval/paths.d.ts +0 -13
  154. package/dist/core/approval/paths.js +0 -43
  155. package/dist/core/approval/pipeline.d.ts +0 -28
  156. package/dist/core/approval/pipeline.js +0 -146
  157. package/dist/core/approval/playbook-schema.d.ts +0 -182
  158. package/dist/core/approval/playbook-schema.js +0 -51
  159. package/dist/core/approval/render.d.ts +0 -20
  160. package/dist/core/approval/render.js +0 -210
  161. package/dist/core/approval/review-pack.d.ts +0 -26
  162. package/dist/core/approval/review-pack.js +0 -205
  163. package/dist/core/approval/types.d.ts +0 -223
  164. package/dist/core/approval/types.js +0 -1
  165. package/prompts/approval/acp-pipeline.md +0 -106
  166. package/prompts/approval/ai-review.md +0 -145
  167. package/prompts/approval/api-guidance.md +0 -179
  168. package/prompts/approval/database-guidance.md +0 -105
  169. package/prompts/approval/frontend-guidance.md +0 -249
  170. package/prompts/approval/generate.md +0 -1596
  171. package/prompts/approval/multi-repo-guidance.md +0 -263
  172. package/prompts/approval/multi-repo-spoke-subagent.md +0 -94
  173. package/prompts/approval/project-conventions-guidance.md +0 -171
  174. package/prompts/approval/runtime-guidance.md +0 -64
  175. package/prompts/approval/segmented-generation.md +0 -157
  176. package/skills/specflow-approval/SKILL.md +0 -778
  177. package/templates/approval-index.yaml +0 -93
  178. package/templates/approval-part.md +0 -15
  179. package/templates/approval-playbook-talos-scenario-job-compile.yaml +0 -29
  180. package/templates/approval-playbook.yaml +0 -28
  181. package/templates/approval.md +0 -261
@@ -1,1596 +0,0 @@
1
- <!-- SOURCE: SpecFlow original — integrates OpenSpec structural aggregation, arc42 design-review framework, ADR status fields, Superpowers challenge-behavior injection, and SpecFlow verify/review grounding patterns -->
2
-
3
- # Approval Document Generation
4
-
5
- > This prompt drives the `/specflow:approval` skill. It defines the 7-Pass closed-loop
6
- > verification, design quality assessment, detailed design generation, implementability
7
- > assessment, and the exact structure of `approval.md`. The calling SKILL.md owns phase
8
- > gating, anchor-file extraction, and user confirmation; this prompt owns the analysis
9
- > and document generation.
10
-
11
- ## Entry Context
12
-
13
- Before running this flow, the SKILL.md has confirmed:
14
-
15
- - `phase: refined` in `.specflow.yaml`
16
- - All four artifacts exist: `proposal.md`, `specs/**/*.md`, `design.md`, `tasks.md`
17
- - `artifacts.language` resolved (default `en`)
18
- - Tech stack detected (Node/Go/Python/Rust/unknown)
19
- - `projectMode` (`greenfield` | `brownfield`) and `stackCoverage` (`complete` | `partial` | `missing`)
20
- - Tech Stack Intake gate completed when greenfield or stack dimensions are missing
21
- (user confirmed 前端 / 后端 / 数据库与缓存 / 基础设施, or marked「不涉及」)
22
- - `uiInScope` resolved; when yes, FE 五元组 confirmed (or marked pending refine)
23
- - Anchor files extracted from **each in-scope repo** when `multi_repo.enabled` (Stage 1b)
24
- - Optional: `specflow/specs/` baseline exists (for Pass 7)
25
- - When multi-repo: `multi_repo.document_mode` + (`primary_repo` if unified) confirmed by user
26
-
27
- You MUST read, in this order, before any analysis:
28
-
29
- 1. `specflow/changes/<name>/proposal.md` — the WHY and WHAT
30
- 2. `specflow/changes/<name>/specs/**/*.md` — the behavioral contract (all delta specs)
31
- 3. `specflow/changes/<name>/design.md` — the HOW (decisions, risks)
32
- 4. `specflow/changes/<name>/tasks.md` — the implementation breakdown
33
- 5. `specflow/changes/<name>/.specflow.yaml` — metadata (phase, created date)
34
- 6. Optional: `specflow/changes/<name>/explore.md` — exploration context
35
- 7. Optional: `specflow/specs/` baseline — for Pass 7 cross-check
36
- 8. Anchor files (read in Pass 6, not here)
37
-
38
- Do not skip any of the four required artifacts. If any is missing, stop and tell the
39
- SKILL.md caller which are missing.
40
-
41
- When **`multi_repo.enabled=true`**, read **`prompts/approval/multi-repo-guidance.md`** first.
42
- Load four artifacts **from every repo** in `multi_repo.repos[]` before analysis. Unified mode
43
- merges cross-repo content into **one** document stored under **`primary_repo`**; per_repo mode
44
- writes **separate** `approval.md` per repo (see §G).
45
-
46
- ---
47
-
48
- ## Part A: Closed-Loop Verification (7 Passes)
49
-
50
- Each Pass examines cross-artifact or artifact-to-reality coherence from one angle.
51
- Every Pass MUST produce (for analysis / conversation):
52
-
53
- 1. A **Verdict**: `PASS` | `WARNING` | `FAIL` | `SKIPPED`
54
- 2. **Evidence**: concrete citations (keep brief; full matrices only when WARNING/FAIL)
55
- 3. A brief **rationale** linking evidence to verdict
56
-
57
- **Document output (§8)**: collapse all 7 Passes into **one table** — see Part E §8.
58
- Do not paste per-Pass essays into `approval.md`.
59
-
60
- Verdict calibration:
61
-
62
- - `PASS` — no gaps found in this dimension.
63
- - `WARNING` — gaps exist but are recoverable. The plan is still implementable but the approver should note the risk.
64
- - `FAIL` — a structural break exists. The plan is not coherent or not grounded as-is.
65
- - `SKIPPED` — the check does not apply (e.g., greenfield project for Pass 6/7). A `SKIPPED` Pass does not affect the overall verdict.
66
-
67
- ### Pass 1 — Requirement Closure (proposal ↔ specs)
68
-
69
- **AI self-prompt**: "Does every item in proposal's `## What Changes` have a corresponding
70
- delta spec? Does every capability listed in `## Capabilities` have a `specs/<name>/spec.md`?
71
- Does every impact area in `## Impact` have spec coverage? Is there a delta spec that the
72
- proposal never mentioned (orphan spec)?"
73
-
74
- **Check**:
75
-
76
- 1. For each bullet in `## What Changes`, identify which capability/spec addresses it. If a change bullet has no corresponding spec, that is a `FAIL`.
77
- 2. For each capability in `## Capabilities → New/Modified`, confirm `specs/<name>/spec.md` exists. Missing spec file is a `FAIL`.
78
- 3. For each impact area in `## Impact`, assess whether the specs cover the behavioral consequences. Uncovered impact is a `WARNING`.
79
- 4. For each delta spec file, confirm the proposal mentions its capability. Orphan spec is a `WARNING`.
80
-
81
- **Evidence format**: a table mapping proposal items → spec files, with coverage status.
82
-
83
- ### Pass 2 — Design Closure (design ↔ specs)
84
-
85
- **AI self-prompt**: "Does every `### Decision N` in design.md point to at least one spec
86
- Requirement it enables? Is there a spec Requirement that has no design decision supporting
87
- it (orphan requirement)? Does any design decision contradict a spec scenario?"
88
-
89
- **Check**:
90
-
91
- 1. For each decision in `design.md` under `## Design Decisions` (or equivalent), identify which spec Requirements it enables. A decision with no traceable requirement is a `WARNING`.
92
- 2. For each spec Requirement, identify which design decision(s) support its implementation. A requirement with no supporting decision is a `WARNING`.
93
- 3. Scan for contradictions: does any design decision specify behavior that conflicts with a `WHEN/THEN` scenario? Contradiction is a `FAIL`.
94
-
95
- **Evidence format**: a bidirectional table — decisions → requirements, and requirements → decisions.
96
-
97
- ### Pass 3 — Spec Closure (scenario completeness + testability + delta integrity)
98
-
99
- **AI self-prompt**: "Does every Requirement have at least one Scenario? Are WHEN/THEN clauses
100
- testable? Are delta operations structurally complete?"
101
-
102
- **Check**:
103
-
104
- 1. Every `### Requirement:` has ≥1 `#### Scenario:`. Missing scenario is a `FAIL`.
105
- 2. Every Scenario has at least one `- **WHEN**` and one `- **THEN**`. Missing clause is a `FAIL`.
106
- 3. **3-level testability grading** for each Scenario:
107
- - **Functional-testable** (✅): WHEN condition is reproducible (specific input/config/state), THEN is verifiable (specific output/behavior). Example: "config contains `artifacts.language: zh-CN`" → reproducible.
108
- - **Document-testable** (⚠️): Tests existence/completeness but not behavior. Example: "a user reads the initialization documentation" → can only verify doc exists, not that a user "reads" it.
109
- - **Untestable** (❌): WHEN or THEN uses vague terms ("appropriate", "reasonable", "fast", "适当", "合理", "快速") or describes an unverifiable state.
110
- - Document-testable and Untestable are both `WARNING`.
111
- 4. REMOVED Requirements have `**Reason**:` and `**Migration**:`. Missing is a `FAIL`.
112
- 5. RENAMED Requirements have `FROM:` and `TO:`. Missing is a `FAIL`.
113
- 6. MODIFIED Requirements reference names that exist in the main specs baseline (if baseline exists). Mismatched name is a `FAIL`.
114
- 7. Run `specflow validate` on each delta spec file. Any validation error is a `FAIL`.
115
- 8. **Detailed-design coverage** (cross-check with §4 方案详细设计): every spec Requirement
116
- that involves data/interface/flow changes must have a corresponding detailed-design
117
- element. A Requirement whose implementation needs a data structure, interface, or state
118
- flow but has NO detailed-design element (or an element marked "待 refine 澄清") is a
119
- `WARNING` — the plan describes WHAT but not HOW to build it.
120
-
121
- **Evidence format**: per-spec-file, a Scenario table with columns: Scenario | WHEN | THEN | Testability (✅/⚠️/❌) | Notes.
122
-
123
- ### Pass 4 — Implementation Closure (tasks ↔ specs)
124
-
125
- **AI self-prompt**: "Does every spec Requirement have at least one task implementing it? Is
126
- there a task that implements behavior not in any spec (scope creep)? Are tasks atomic enough?"
127
-
128
- **Check**:
129
-
130
- 1. For each spec Requirement, identify which task(s) implement it. A requirement with no covering task is a `FAIL`.
131
- 2. For each task, identify which spec Requirement it implements. A task with no traceable requirement is a `WARNING` (scope creep).
132
- 3. Scan tasks for placeholders: 'TBD', 'TODO', 'implement feature', '待定'. Each is a `WARNING`.
133
- 4. Assess task granularity: tasks that bundle multiple unrelated changes, or are so vague an engineer cannot estimate them, are `WARNING`.
134
-
135
- **Evidence format**: coverage matrix — requirements (rows) × tasks (columns), plus "scope creep" section.
136
-
137
- ### Pass 5 — Risk Closure (risks ↔ mitigations + BREAKING migration + unidentified risks)
138
-
139
- **AI self-prompt**: "Does every risk in design.md have a mitigation? Are there BREAKING
140
- changes with no migration plan? Based on the change's nature, are there risks the design
141
- did not identify?"
142
-
143
- **Check**:
144
-
145
- 1. For each risk in `design.md` under `## Risks / Trade-offs`, confirm a mitigation exists. Risk with no mitigation is a `WARNING`.
146
- 2. For each `**BREAKING**` item in proposal's `## What Changes`, confirm a migration path. BREAKING with no migration is a `FAIL`.
147
- 3. Reason about unidentified risks based on the change's nature: auth/security, data schema/migration, concurrency/race, external dependency supply-chain. Each unidentified risk is a `WARNING` with reasoning.
148
-
149
- **Evidence format**: risk table with columns: Risk | Severity | Mitigation | Status (identified+mitigated / identified+unmitigated / AI-identified-new).
150
-
151
- ### Pass 6 — Code Grounding (design/tasks ↔ existing project code)
152
-
153
- > This Pass reads actual project code. It is the key difference between "self-consistency
154
- > check" and "landing feasibility check".
155
-
156
- **AI self-prompt**: "Do the files the plan says it will modify/extend actually exist? Is the
157
- plan's extension approach compatible with the existing code structure? Does the plan's
158
- tech choices match the project's actual tech stack?"
159
-
160
- **Anchor files**: the SKILL.md has already extracted the set of file paths referenced in
161
- `design.md` and `tasks.md`. Read each anchor file (the file itself only — do NOT follow
162
- imports, do NOT recurse into dependencies).
163
-
164
- **Greenfield handling**: If the project has no source code directory (e.g., no `src/`,
165
- no `lib/`, no `cmd/`), emit `SKIPPED (greenfield — no existing code to ground against)`
166
- and do not grade.
167
-
168
- **Check** (for non-greenfield projects):
169
-
170
- 1. **File existence**: For each anchor file path, check if the file exists in the project.
171
- - All exist → this sub-check passes.
172
- - Some missing → `FAIL` with the list of missing files. The plan references files that don't exist — either it's wrong about the codebase, or it's a greenfield file to be created (if the plan clearly says "create new file X", that's fine; if it says "extend existing file X" and X doesn't exist, that's a FAIL).
173
- - Plan says "create new file" and file doesn't exist → OK (not a failure).
174
-
175
- 2. **Structure compatibility**: For each existing anchor file, read it and assess:
176
- - If the plan says "extend function X" — does function X exist? Is it structured to be extensible (e.g., has a clear signature, not a monolithic 500-line function)?
177
- - If the plan says "add module Y" — does the parent directory's pattern support adding modules (e.g., are there sibling modules following a consistent pattern)?
178
- - If the plan says "modify config schema" — does the current schema structure support the modification without breaking existing consumers?
179
- - Incompatibility is a `WARNING` (not a `FAIL` — the plan might still work with adjustments, but the approver should know).
180
-
181
- 3. **Tech-stack consistency**: Does the plan's technology approach match the detected tech stack?
182
- - Plan uses patterns/libraries consistent with the project's `package.json`/`go.mod`/etc. → OK.
183
- - Plan introduces a new library/ pattern not in the project → `WARNING` with reasoning (may be justified, but the approver should confirm).
184
- - Plan contradicts the tech stack (e.g., plan says "use jest" but project uses vitest) → `WARNING` unless design.md explicitly justifies the switch.
185
-
186
- **Evidence format**:
187
- - Table: Anchor File | Exists? | Plan Action (extend/create/modify) | Compatibility Assessment
188
- - Tech-stack consistency: one-line verdict with reasoning.
189
- - For greenfield: the single `SKIPPED (greenfield)` line, verbatim.
190
-
191
- ### Pass 7 — Baseline Cross-Check (delta specs ↔ `specflow/specs/` main baseline)
192
-
193
- > This Pass checks whether the change's delta specs conflict with or duplicate existing
194
- > main specs. It is the "plan-time regression check" — verify owns the "implementation-time
195
- > regression check".
196
-
197
- **AI self-prompt**: "Do the delta specs' ADDED requirements duplicate anything already in the
198
- main specs? Do the MODIFIED requirements' names match existing main spec requirement names
199
- (so delta merge will work at archive time)? Does the change claim to modify a capability that
200
- doesn't exist in the baseline?"
201
-
202
- **Baseline handling**: If `specflow/specs/` does not exist or contains no spec files, emit
203
- `SKIPPED (no baseline — greenfield or no archived changes yet)` and do not grade. This is
204
- the same pattern as verify Pass 2.
205
-
206
- **Check** (when baseline exists):
207
-
208
- 1. **Duplicate detection**: For each ADDED Requirement in the delta specs, check if a Requirement with the same name already exists in the main spec for the same capability. Duplicate is a `WARNING` (the archive merge would produce a duplicate header).
209
- 2. **MODIFIED name matching**: For each MODIFIED Requirement, confirm a Requirement with the exact same name exists in the corresponding main spec. Mismatch is a `FAIL` (delta merge at archive time would fail with "Requirement not found").
210
- 3. **REMOVED name matching**: For each REMOVED Requirement, confirm it exists in the main spec. Mismatch is a `FAIL`.
211
- 4. **RENAMED FROM matching**: For each RENAMED Requirement's `FROM:` name, confirm it exists in the main spec. Mismatch is a `FAIL`.
212
- 5. **Cross-capability conflict**: If the change modifies capability A's spec, does the change introduce behavior that conflicts with capability B's existing spec (if B exists in baseline)? Conflict is a `WARNING`.
213
-
214
- **Evidence format**:
215
- - For each delta operation (ADDED/MODIFIED/REMOVED/RENAMED), a row: Capability | Requirement Name | Operation | Baseline Status (exists/duplicate/not-found) | Verdict.
216
- - For greenfield: the single `SKIPPED (no baseline)` line, verbatim.
217
-
218
- ### Closed-Loop Overall Verdict
219
-
220
- - `FAIL` if any non-SKIPPED Pass is `FAIL`
221
- - `PASS WITH WARNINGS` if no `FAIL` but ≥1 non-SKIPPED Pass is `WARNING`
222
- - `PASS` if all non-SKIPPED Passes are `PASS` (SKIPPED Passes do not affect the verdict)
223
-
224
- ---
225
-
226
- ## Part B: Design Quality Assessment
227
-
228
- ### Over-Engineering Check
229
-
230
- Scan `design.md` and `tasks.md` for 5 over-engineering signals. Each signal detected must
231
- cite the specific design section or task.
232
-
233
- | # | Signal | How to detect | Example |
234
- |---|--------|--------------|---------|
235
- | 1 | Interface for unrequested requirements | design defines interfaces/capabilities not in spec's Requirements | spec only requires `en`/`zh-CN`, design builds a `LocaleRegistry` |
236
- | 2 | Unnecessary abstraction layer | single implementation gets an interface + factory + strategy | one reviewer type → `ReviewerFactory` + `ReviewerStrategy` |
237
- | 3 | Pre-built unused infrastructure | tasks include infrastructure not required by any spec scenario | CLI option change → builds a plugin system |
238
- | 4 | Config fields beyond current needs | YAML schema defines fields with no current consumer | `artifacts.language` + pre-built `artifacts.format`/`artifacts.tone` |
239
- | 5 | Complexity exceeding problem scale | simple problem uses heavy pattern (state machine, event bus, middleware chain) for a boolean config |
240
-
241
- **Verdict rule**:
242
- - 0 signals → `PASS`
243
- - 1-2 signals → `WARNING` (each must cite design section)
244
- - 3+ signals → `FAIL` (the plan is over-engineered)
245
-
246
- ### Extensibility Assessment
247
-
248
- Scan `design.md` for 5 extensibility signals. Each signal detected must cite the specific
249
- decision or section.
250
-
251
- | # | Signal | How to detect | Example (from SpecFlow's own design D1) |
252
- |---|--------|--------------|----------------------------------------|
253
- | 1 | Namespace reservation | config uses nested key to leave room for siblings | `artifacts.language` not `artifactLanguage` |
254
- | 2 | Stable interface, replaceable implementation | type/interface defined clearly but no pre-built multi-impl | `ArtifactLanguage` type with `en`/`zh-CN` only |
255
- | 3 | Explicit Non-Goals | design has a Non-Goals section listing what's NOT done | "本变更不支持任意 BCP 47 语言" |
256
- | 4 | Backward-compatibility path | design describes how existing behavior stays compatible | "缺省 `artifacts.language` 解析为 `en`" |
257
- | 5 | Decision rationale mentions extensibility trade-off | a Decision block's rationale explicitly weighs extensibility | D1 rationale: "为未来 artifact 设置留命名空间" |
258
-
259
- **Verdict rule**:
260
- - 4-5 signals → `PASS`
261
- - 2-3 signals → `WARNING`
262
- - 0-1 signals → `WARNING` (the plan may be too rigid — approver should confirm extensibility was considered)
263
-
264
- ### Combined Design Quality Verdict
265
-
266
- - `FAIL` if over-engineering is `FAIL`
267
- - `FAIL` (escalated) if over-engineering is `WARNING`/`FAIL` AND extensibility is `WARNING` — the plan is both bloated AND not extensible
268
- - `WARNING` if either check is `WARNING` (without the escalation condition)
269
- - `PASS` if both checks are `PASS`
270
-
271
- ---
272
-
273
- ## Part C: Implementability Assessment (7 Dimensions)
274
-
275
- Each dimension produces a verdict: `READY` | `NEEDS REFINEMENT` | `BLOCKED`.
276
-
277
- ### Dimension 1: Completeness
278
- Scan all four artifacts for TODOs/placeholders/vague sections.
279
- - `READY` if no placeholders. `NEEDS REFINEMENT` if non-critical. `BLOCKED` if in spec requirements or critical decisions.
280
-
281
- ### Dimension 2: Spec Alignment
282
- Tasks cover all spec requirements? Scope creep?
283
- - `READY` if full coverage, no scope creep. `NEEDS REFINEMENT` if minor gaps/creep. `BLOCKED` if a core requirement has zero tasks.
284
-
285
- ### Dimension 3: Task Actionability
286
- Each task concrete and executable? Paths, commands, expected outputs defined?
287
- - `READY` if all actionable. `NEEDS REFINEMENT` if some vague. `BLOCKED` if tasks are too coarse to start.
288
-
289
- ### Dimension 4: Technical Feasibility
290
- Design decisions achievable in the detected tech stack?
291
- - `READY` if all feasible. `NEEDS REFINEMENT` if a new dependency/infra is plausible but unconfirmed. `BLOCKED` if a decision is technically infeasible.
292
-
293
- ### Dimension 5: Dependency Clarity
294
- Task dependencies and external dependencies explicit? Execution order derivable?
295
- - `READY` if explicit and clear. `NEEDS REFINEMENT` if implicit but inferrable. `BLOCKED` if ambiguous and unsequenceable.
296
-
297
- ### Dimension 6: Architecture Consistency
298
- > Grounded in code reading from Pass 6. Reuse Pass 6's anchor-file findings.
299
-
300
- Design choices match the project's existing patterns:
301
- - **Tech stack**: plan's libraries/patterns match `package.json`/`go.mod`/etc.
302
- - **Directory structure**: new modules placed where siblings live (e.g., `src/core/` not `src/utils/` if existing core modules are in `src/core/`)
303
- - **Error handling**: plan uses the project's error pattern (e.g., `StoreError` with diagnostics, not bare `throw new Error`)
304
- - **Test framework**: plan's test approach matches project's framework (vitest not jest, if vitest is in use)
305
- - `READY` if all consistent. `NEEDS REFINEMENT` if 1-2 inconsistencies with justification. `BLOCKED` if fundamental mismatch (e.g., plan requires a framework the project doesn't use and can't easily add).
306
-
307
- ### Dimension 7: Implementation Risk
308
- Assess risk factors that could derail implementation:
309
- - **Core module change**: does the plan modify high-risk modules (delta merge engine, parser, archive, validator)?
310
- - **Data migration**: does the change require migrating existing data formats?
311
- - **Concurrency**: does the change touch concurrent/transactional code?
312
- - **External API break**: does the change break interfaces other consumers depend on?
313
- - **Team tech-stack unfamiliarity**: does the plan use technologies the project doesn't already use (inferring from `package.json`/`go.mod`)?
314
- - `READY` if no high-risk items. `NEEDS REFINEMENT` if high-risk items exist with mitigations. `BLOCKED` if high-risk items exist with no mitigation.
315
-
316
- ### Implementability Overall Verdict
317
-
318
- - `BLOCKED` if any dimension is `BLOCKED`
319
- - `NEEDS REFINEMENT` if no `BLOCKED` but any dimension is `NEEDS REFINEMENT`
320
- - `READY` if all 7 are `READY`
321
-
322
- ---
323
-
324
- ## Part D: AI Pre-Approval Recommendation
325
-
326
- Based on all three verdicts:
327
-
328
- | Closed-Loop | Design Quality | Implementability | Recommendation |
329
- |-------------|---------------|-----------------|----------------|
330
- | PASS | PASS | READY | **建议批准** (Recommend approval) |
331
- | PASS | PASS | NEEDS REFINEMENT | **有条件批准** (Conditional — fix during apply) |
332
- | PASS WITH WARNINGS | any non-FAIL | READY/NEEDS REFINEMENT | **有条件批准** (Conditional — acknowledge warnings) |
333
- | any | WARNING | any non-BLOCKED | **有条件批准** (Conditional — design quality concerns) |
334
- | FAIL | any | any | **退回 refine** (Return to refine) |
335
- | any | FAIL | any | **退回 refine** (Return to refine — over-engineered or rigid) |
336
- | any | any | BLOCKED | **退回 refine** (Return to refine — remove blockers) |
337
-
338
- The recommendation must include a 1-2 sentence rationale citing the specific verdicts that drove it.
339
-
340
- ---
341
-
342
- ## Part E: approval.md Document Structure
343
-
344
- Generate `approval.md` following this exact structure. Adapt narrative language to
345
- `artifacts.language`; keep protocol markers, IDs, paths, commands, and code in English.
346
-
347
- **Chapter order (implementer-first, aligned with scenario-job-compile readability)**:
348
-
349
- 1. 绪论与边界 — proposal + optional explore + AI; absorbs What/Impact; **no 变更摘要 chapter**
350
- 2. 技术方案评估 — decisions / risks / design quality
351
- 3. 架构整体设计 — 架构图 + **图要点说明** + 组件(置于验收之前)
352
- 4. 方案详细设计 — 设计要点 + Happy Path + 业务场景(+说明) + 数据/接口/**前端(若有 UI)**…
353
- 5. 验收标准 — **可选**(须先询问用户;选「要」则放在设计之后;选「不要」则整章省略)
354
- 6. 测试策略 — 默认输出(若无 §5,矩阵改为映射 delta specs 的 Requirement/Scenario)
355
- 7. 部署/发布/回滚 — **可选**(须先询问用户)
356
- 8. 闭环性检查 — **可选**(须先询问用户;内部仍跑 Pass 1–7,仅「要」时写入正文表)
357
- 9. 可实施性评估 → 10. 审批意见(**仅人工签字栏**;AI 预审只在对话中反馈,不写入文档)
358
-
359
- ### 可选章节门禁(写入前必须询问)
360
-
361
- 在写入 `approval.md` 之前,向用户明确询问(可合并进确认摘要):
362
-
363
- ```text
364
- 以下章节是否写入审批文档?(默认均可选「不要」以保持精简)
365
- - [ ] §5 验收标准(从 specs 展开全部 Requirement/Scenario)
366
- - [ ] §7 部署/发布/回滚方案
367
- - [ ] §8 闭环性检查表(Pass 1–7 结论表)
368
- ```
369
-
370
- - 用户选「要」→ 按下方骨架生成该章。
371
- - 用户选「不要」→ **整章省略**(不要写「不涉及…」占位段)。
372
- - 未得到明确答复前,**不要**写入文件。
373
-
374
- ### ⚠️ 质量红线 — 必须严格执行
375
-
376
- 生成 `approval.md` 时,下列红线**缺一不可**;违反则详细设计/接口/数据相关章节视为不合格,确认写入前必须补全。
377
-
378
- | 编号 | 红线名称 | 要求 |
379
- |------|----------|------|
380
- | G1 | 一图胜千言 | 任何超过 **5 行**的文字流程描述,**必须**改为 Mermaid 图(`sequenceDiagram` / `flowchart` / `stateDiagram-v2`),禁止用长段落散文写流程 |
381
- | G2 | 必须有失败示例 | §4.5 清单中**每个**接口(含**不变**):除成功请求与成功响应示例外,**还必须**附 ≥1 组**失败**请求或响应示例(如参数校验失败、租约过期、未认证)。只有错误码表、没有具体 HTTP/正文示例 → 不合格 |
382
- | G3 | 必须有数据迁移/填充方案 | 凡涉及 **JSON 字段形状变更**或**新增列**:必须写明**存量数据的默认值填充策略**(回填脚本 / 读时默认值 / 禁止空读等)。即使本迭代不做表结构变更、只改 JSON 语义,同样适用 |
383
- | G4 | 必须有回滚数据兼容说明 | 若发布失败需要回滚:新版本已经写入的数据,旧版本代码能否**安全跳过或忽略**?必须给出明确方案(例如忽略未知字段、按数据版本分派、兼容窗口双写等)。禁止只写「回滚镜像/回滚应用」却不说明数据兼容结论 |
384
- | G5 | 前端须有页面/路由清单 | 当 `uiInScope=yes`:§4.6 **必须**给出本迭代页面/路由清单与栈五元组(Framework/Styling/State/UI kit/FE testing)。禁止只写「用 React」 |
385
- | G6 | 关键页须有空/加载/错态 | 当 `uiInScope=yes`:每个关键 `Page · …` **至少**覆盖空态 / 加载 / 错误之一,并标明依赖的 §4.5 接口编号 |
386
-
387
- ### 文风要求 — 全文适用
388
-
389
- 1. **通俗易懂**:面向要动手实现的开发同学;避免生僻英文缩写,**首次出现必须中文注解**(例:DDL(数据定义语言)、RPC(远程过程调用))。
390
- 2. **叙述用可读中文,禁止「代码腔」堆砌**:
391
- - §2.1 现状与约束、§3 架构说明、§4 设计要点等**正文/列表**,用业务与模块语言书写(例:「调度侧编译目前只认接口用例类型,运行时打成扁平的 HTTP 请求规格」)。
392
- - **禁止**把路径、函数名、类型名、结构体字段当作句子主干连写(反例:`compileOne` in `internal/scheduler/...` only accepts `ref_type=api_case`…)。
393
- - 若确需锚定实现位置:同一条约束最多用括号**点名一次**可读定位(模块中文名 + 必要时一个路径或符号),或把路径/符号放到表格「证据」列;细节接口形状仍放在 §4.5 的字段表与示例中。
394
- - Mermaid、DDL、HTTP 示例、字段表中的协议名/列名保持技术原文(不受本条限制)。
395
- 3. **逻辑严密**:拒绝模棱两可 —— **禁止**「尽量」「大概」「一般情况下」「可能需要」「酌情」「视情况」;应使用「**必须**」「**禁止**」「**采用 XX 方案**」「固定为…」。若有分支,写成显式条件表(若 A → 做 X;若 B → 做 Y)。
396
-
397
- ```markdown
398
- # 技术方案审批文档: <change-name>
399
-
400
- > 本文档由 `/specflow:approval` 基于 refine 收敛后的四件套 + 现有代码与 spec 基线生成,
401
- > 经 AI 闭环检查与设计质量/可实施性评估(结论在对话中反馈),并含架构与详细设计等章节,供人工审批使用。
402
- > 生成时间: YYYY-MM-DD HH:MM | phase: refined | 产物语言: <lang> | 技术栈: <stack>
403
-
404
- ---
405
-
406
- ## 1. 绪论与边界 (Introduction & Boundaries)
407
-
408
- > 本章以**业务叙事**说明"为什么做、做什么、影响面、做完后如何闭环、坚决不做什么"。
409
- > **数据来源**:`proposal.md`(必选)+ `explore.md`(若存在且可用则吸收)+ **AI 提炼**。
410
- > **不再单列「变更摘要」章**:原 Why / What Changes / Impact 并入本章 1.1–1.2。
411
-
412
- ### 1.1 背景与痛点 (Background & Pain Points)
413
-
414
- 用一段话说明当前现状,并用 **Mermaid 现状流程图** 直观呈现,痛点节点**用红色标注**。
415
-
416
- **要求**:
417
-
418
- 1. 描述当前业务/系统的实际流程(用户如何完成目标、经过了哪些步骤)
419
- 2. 用 Mermaid `flowchart` 绘制现状流程
420
- 3. **痛点节点用红色标注**:`classDef pain fill:#ffcccc,stroke:#cc0000,color:#000` + `:::pain` 或 `class X pain`
421
- 4. 每个痛点一句话说明**它造成的代价**(返工/延迟/错误/成本)
422
- 5. 痛点应可追溯到 proposal.md 的 `## Why`;若有 `explore.md`,吸收其中已确认的痛点/约束洞察(勿编造)
423
-
424
- **痛点清单**(对应图中红色节点):
425
-
426
- | 痛点 | 代价 |
427
- |------|------|
428
- | <痛点> | <代价> |
429
-
430
- ### 1.2 做什么与影响面 (What & Impact)
431
-
432
- AI 从 proposal `## What Changes` / `## Impact`(及 explore 相关结论)提炼,替代原「变更摘要」章。
433
-
434
- **做什么**(按 新增/修改/移除/重命名;BREAKING 显式标注):
435
-
436
- | 类别 | 内容 | BREAKING? |
437
- |------|------|-----------|
438
- | 新增 | | |
439
- | 修改 | | |
440
- | 移除 / 重命名 | | |
441
-
442
- **影响面**:
443
-
444
- | 影响区域 | 影响等级 | 说明 |
445
- |---------|---------|------|
446
- | | 高/中/低 | |
447
-
448
- ### 1.3 业务闭环与目标 (Business Loop & Goals)
449
-
450
- 说明"本次变更完成后,业务如何形成闭环",并给出 **用户操作路径(User Journey)**。
451
-
452
- **要求**:
453
-
454
- 1. 描述完成本次变更后,用户完成目标的完整路径
455
- 2. 用 Mermaid `sequenceDiagram` 或 `flowchart` 绘制 User Journey
456
- 3. 标注每一步的价值/产出
457
- 4. Goals 应可验证,引用 **§5 验收标准**
458
-
459
- **业务目标**(可验证):
460
-
461
- | 目标 | 可验证方式(引用 §5) |
462
- |------|---------------------|
463
- | <目标> | §5 <Scenario 名> |
464
-
465
- ### 1.4 非目标 (Non-Goals)
466
-
467
- **必须明确列出本次迭代坚决不做的事项,并说明不做理由**(防止需求蔓延)。
468
-
469
- 1. 从 proposal.md / design.md / explore.md 的 Non-Goals 提炼,必须补充"不做理由"
470
- 2. 若确实没有,写明 `proposal/design 未声明 Non-Goals,建议在 refine 补充边界`
471
-
472
- | 非目标 | 不做理由 |
473
- |--------|---------|
474
- | <非目标> | <理由> |
475
-
476
- ---
477
-
478
- ## 2. 技术方案评估 (Technical Design Review)
479
-
480
- ### 2.1 现状与约束 (Context & Constraints)
481
-
482
- > 用**可读中文**归纳现状与硬约束(含「本迭代禁止…」类红线)。禁止代码腔堆砌;需要锚点时见上文「文风要求」第 2 条。
483
- > **0→1 绿场**:可写「尚无存量业务代码;约束来自用户确认的技术选型与组织规范」。
484
-
485
- [整合 design.md Context + AI 从锚点代码提炼的隐含约束 — 写成中文要点列表]
486
-
487
- ### 2.2 技术选型 (Tech Stack Selection)
488
-
489
- > **何时必须有本章节**:
490
- > - `projectMode=greenfield`(从 0 到 1),或
491
- > - 四件套未写清且本变更需要的维度缺失(前端 / 后端 / 数据库与缓存 / 基础设施)。
492
- > **来源优先级**:用户在 Tech Stack Intake 门禁中的确认 **>** design 决策表 **>** 仓库信号。
493
- > **禁止**在未提问、未确认时由模型臆造全栈。
494
- > 若本变更为棕地小改且选型沿用现网 → 可写一行「沿用现网栈:<摘要>」并跳过详表。
495
-
496
- **选型总表**(绿场或补选型时强制):
497
-
498
- | 方向 | 选定方案 | 备选(若有) | 选择理由 | 来源 |
499
- |------|----------|------------|----------|------|
500
- | 前端 | Framework / Styling / State / UI kit / FE testing | | | 用户确认 / design / 沿用现网 / 不涉及 |
501
- | 后端 | | | | |
502
- | 数据库与缓存 | | | | |
503
- | 基础设施 | | | | |
504
- | 其它(消息/搜索/… ) | | | | |
505
-
506
- > 前端行在 `uiInScope=yes` 时**必须**写成五元组(见 `frontend-guidance.md`);禁止只填「React」。
507
-
508
- 将关键选型同步写入下方 **§2.4 决策评审表**(如 D-FE / D-BE / D-DB / D-Infra)。
509
-
510
- ### 2.3 目标与非目标 (Goals & Non-Goals)
511
- [整合 design.md Goals/Non-Goals]
512
-
513
- ### 2.4 决策评审表 (Decision Review)
514
-
515
- | 决策 | 选定方案 | 备选方案 | 理由 | 影响评估 | 状态 |
516
- |------|---------|---------|------|---------|------|
517
- | D1: <name> | <方案> | <A/B> | <理由> | <评估> | Proposed |
518
-
519
- ### 2.5 风险与权衡 (Risks & Trade-offs)
520
-
521
- | 风险 | 严重等级 | 缓解措施 | 就绪度 |
522
- |------|---------|---------|--------|
523
- | <name> | 高/中/低 | <措施> | ✅/⚠️/❌ |
524
-
525
- ### 2.6 设计质量评估 (Design Quality)
526
-
527
- #### 过度设计检查
528
- | # | 信号 | 检测到? | 证据(design/tasks 位置) |
529
- |---|------|--------|----------------------|
530
- | 1 | 为未提出的需求设计接口 | ✅是/❌否 | |
531
- | 2 | 不必要的抽象层 | | |
532
- | 3 | 预建未使用的基础设施 | | |
533
- | 4 | 配置项超出当前需求 | | |
534
- | 5 | 复杂度超出问题规模 | | |
535
- **过度设计结论:** PASS (0 signals) / WARNING (1-2) / FAIL (3+)
536
-
537
- #### 扩展性评估
538
- | # | 信号 | 检测到? | 证据(design 位置) |
539
- |---|------|--------|----------------|
540
- | 1 | 命名空间预留 | | |
541
- | 2 | 接口稳定,实现可替换 | | |
542
- | 3 | 显式 Non-Goals | | |
543
- | 4 | 向后兼容路径 | | |
544
- | 5 | 决策理由提及扩展性权衡 | | |
545
- **扩展性结论:** PASS (4-5) / WARNING (0-3)
546
-
547
- **设计质量总评:** PASS / WARNING / FAIL
548
-
549
- ---
550
-
551
-
552
- ## 3. 架构整体设计 (Architecture Design)
553
-
554
- > 本章回答"系统由哪些模块组成、模块间如何依赖与交互、每个模块的职责与边界是什么"。
555
- > 聚焦**宏观结构**;与 §4 方案详细设计(模块内部实现 / 时序)互补。
556
- > 质量标杆:`scenario-job-compile` §3 —— **图 + 图要点说明 + 核心组件表**。
557
-
558
- > **项目约定(先于起草)**:执行 `prompts/approval/project-conventions-guidance.md`,`topic=architecture`。
559
- > 懒加载 Read 项目 architecture skill/rule/docs(跨 IDE 路径见该路由)。
560
- > **优先级**:项目约定 + 锚点代码 **>** 通用架构常识。将硬边界/禁令写入图要点(可读中文)。
561
- > 总则式标注:在图要点第 1 条或组件表注记「项目约定: <path|未发现>」。
562
-
563
- ### 3.1 总体架构 (Architecture Overview)
564
-
565
- 用 Mermaid 绘制 **模块依赖/分层图**(推荐),并可附加 **系统交互总览**。
566
-
567
- **绘制要求**:
568
-
569
- 1. 标注变更模块(`[新增]` / `[修改]`),影响面一眼可见
570
- 2. 边标注依赖方向或交互消息
571
- 3. CLI/库 → `src/core/*`、`src/cli/*`;Web → 服务/组件;多仓 → 仓库/服务
572
- 4. 图与 **§2 决策**一致
573
-
574
- **设计说明 / 图要点**(强制,紧跟每张架构图之后):
575
-
576
- 用编号列表解释图中**读图关键点**(不是复述节点名),对齐标杆「设计说明(总体架构)」:
577
-
578
- 1. 分层/边界怎么划、谁不直连谁
579
- 2. 本迭代不变式(如零 DDL、双通道、一场景一作业)
580
- 3. 复用 vs 新增的落点
581
- 4. 与 §2 决策的对应关系
582
-
583
- 若有第二张交互图,另写 **交互要点**(一段或短列表):谁感知、谁禁止直连 DB/绕过网关等。
584
-
585
- ### 3.2 核心组件说明 (Core Components)
586
-
587
- | 组件 | 职责 | 边界(做什么 / 不做什么) | 依赖 | 变更类型 |
588
- |------|------|-------------------------|------|---------|
589
- | `<组件名>` | 一句话职责 | 做什么;不做什么 | 依赖的组件 | 新增/修改/不变 |
590
-
591
- **填写要求**:列出新增+修改组件;边界写「不做什么」;与 §3.1 图一一对应;边界可追溯到 §2 决策。
592
-
593
- 可附 **组件边界总原则**(短列表:平台/Worker/控制台各做什么、禁止什么)。
594
-
595
- **不涉及架构变更时写**:`不涉及架构变更(单模块/单文件调整,模块边界无变化)`。
596
-
597
- ### 3.3 架构一致性自检(生成后检查)
598
-
599
- - [ ] §3.1 图标注了新增/修改模块
600
- - [ ] **每张架构图后有「设计说明 / 图要点」**(非空编号列表)
601
- - [ ] §3.2 每个组件有「不做什么」边界
602
- - [ ] 图与表一一对应
603
- - [ ] 组件边界可追溯到 §2 决策
604
- - [ ] 未涉及时显式标注「不涉及架构变更」
605
-
606
- ---
607
-
608
- ## 4. 方案详细设计 (Detailed Design)
609
-
610
- > 将方案从宏观决策落到实现者可照写的细节。
611
- > **只呈现本变更涉及的部分**;不涉及显式写「不涉及 X」。
612
- > 每个元素可追溯到 **§5 验收标准**与 **§2 决策**。
613
- > 质量标杆:`scenario-job-compile` §4 —— **设计要点一览 → 业务时序(含设计要点说明) → 表/接口**。
614
-
615
- ### 4.1 设计要点一览(强制)
616
-
617
- 从 design 决策提炼实现**不可随便推翻**的要点(P1…Pn):
618
-
619
- | 编号 | 要点 | 说明 |
620
- |------|------|------|
621
- | P1 | <短名> | <一句话不变量/策略> |
622
-
623
- ### 4.2 核心业务时序 · Happy Path(强制)
624
-
625
- **必须**给出主成功路径的**完整** Mermaid `sequenceDiagram`(建议 `autonumber`),覆盖主角色从发起到成功终态的端到端调用;不得用一句话替代。
626
-
627
- **结构**:
628
-
629
- 1. **目的**:一句话
630
- 2. **时序图**:Happy Path 全链路
631
- 3. **设计要点**:图后强制说明(不变式、与 P1…Pn 对应、本图不展开的失败边界)
632
-
633
- ```mermaid
634
- sequenceDiagram
635
- autonumber
636
- %% Happy Path — 成功路径完整时序
637
- ```
638
-
639
- **设计要点**:
640
-
641
- - …
642
-
643
- ### 4.3 业务场景时序(强制有说明)
644
-
645
- 对每个关键业务场景输出同构小节(对齐标杆「业务流程 A/B/C…」):
646
-
647
- #### 场景 X · `<名称>`
648
-
649
- 1. **目的**
650
- 2. **时序/状态/流程开**(Mermaid `sequenceDiagram` / `flowchart` / `stateDiagram-v2`)
651
- 3. **设计要点**(强制 — 禁止有图无说明;可用列表或小表)
652
-
653
- 至少覆盖本变更的核心分支(如失败策略、幂等、兼容缺省、计划 vs 调试等)。纯单步无分支时可写:`不涉及多业务场景(主路径已由 §4.2 Happy Path 覆盖)`——但仍须保留 §4.2。
654
-
655
- ### 4.4 数据结构 / 数据模型变更 (Data Structures)
656
-
657
- **适用范围**:涉及持久化、状态存储、数据模型的变更。纯 CLI/库项目若无数据库,覆盖配置结构 / 状态文件 / 缓存结构 / YAML schema 等"数据模型"(走下方「非库表路径」)。
658
-
659
- > **项目约定 + DB 技能(先于起草,固定顺序)**:
660
- > 1. 执行 `prompts/approval/project-conventions-guidance.md`,`topic=database` — Read 项目 DB 约定(若有)。
661
- > 2. 执行 `prompts/approval/database-guidance.md` — 探测 `dbStack` 并 Read SpecFlow `{ide}/specflow/guidance/database/<stack>/`(或包内回退)。
662
- > 3. Read 现网 DDL/迁移/锚点(Pass 6)。
663
- > **优先级**:项目约定 + 现网 DDL **>** SpecFlow DB guidance **>** LLM。
664
- > 不得「invoke `/mysql`」;总则须同时填写「项目约定」「DB 技能」「DDL 来源」。
665
-
666
- > **质量硬门槛(库表路径)**:只要本变更读写/依赖任何数据库表(含"零 DDL、只改读写语义"),§4.4 **必须**按下列结构输出,不得用一句话带过、不得省略 ER / DDL / 字段说明表。参考质量标杆:`scenario-job-compile` 类审批文档的「表与数据设计」章(总则结论表 → ER → 表一览 → 逐表 DDL+字段表 → 非表字段与回滚)。
667
-
668
- > **大纲 / 标题层级(硬门槛 — 防 TOC 爆炸)**:Markdown 预览大纲**只允许**下列标题进入目录;「DDL」「字段说明」「JSON 形状」等**禁止**写成 `####`/`#####`/`######`,一律用 **加粗标签** + 正文/代码块/表格。
669
-
670
- ```text
671
- ### 4.4 数据结构 / 数据模型变更
672
- ├── #### 4.4.1 总则与本迭代结构变更结论
673
- ├── #### 4.4.2 ER 图(核心实体关系)
674
- ├── #### 4.4.3 逐表详设
675
- │ ├── ##### `table_a`(中文名) ← 每张表仅此一级标题
676
- │ └── ##### `table_b`(中文名)
677
- └── #### 4.4.4 非表字段、数据迁移与回滚兼容
678
- ```
679
-
680
- 表内固定顺序用加粗标签(不是标题):`**本迭代动作**` → `**本迭代变更语句**` → `**DDL(现网/目标)**` → `**字段说明**` →(可选)`**JSON 形状 · <字段名>**`。
681
-
682
- #### A. 库表路径(MySQL / PostgreSQL / SQLite 等关系库)——强制结构
683
-
684
- 按以下小节**顺序**生成。缺任一强制项 → 视为详细设计质量不合格,在确认摘要中报告用户并标记 `[待 refine 澄清]` 或补全后再写入。
685
-
686
- ##### 4.4.1 总则与本迭代结构变更结论
687
-
688
- 用结论表一眼说清本迭代对库结构做什么(即使结论是「零迁移」也要写明):
689
-
690
- | 项 | 结论 |
691
- |----|------|
692
- | 数据库迁移(脚本/工具名) | 有 / **本迭代零迁移** |
693
- | 新建表 | 表名列表 / **无** |
694
- | 新增 / 修改 / 删除列 | 列清单 / **无** |
695
- | 新增索引 | 索引清单 / **无** |
696
- | DDL 来源 | 仓库基线路径 或 本迭代新增 |
697
- | 项目约定 | 实际 Read 路径(可多个用 `; `) / **未发现** |
698
- | DB 技能 | `{ide}/specflow/guidance/database/<stack>` / `skills/database/<stack>`(fallback) / `LLM-fallback` |
699
-
700
- 紧接一段 **本迭代变更语句** 代码块:
701
-
702
- - 有变更:给出可执行的 `CREATE` / `ALTER` / `DROP`(与下方逐表 DDL 一致)。
703
- - **零变更**:显式写「无(明确不执行)」,并可用注释列出**禁止合入**的反例 `ALTER`/`CREATE`(防止实现时偷偷加列)。
704
-
705
- ##### 4.4.2 ER 图(核心实体关系)——强制
706
-
707
- 用 Mermaid `erDiagram` 画出**本变更涉及的核心实体**(新增 + 修改 + 本迭代强依赖的既有表),标注:
708
-
709
- 1. 实体名(= 表名)与**中文表意**(可用实体注释或紧随其后的说明)。
710
- 2. 关系基数(`||--o{` / `}o--||` 等)与关联键语义(如「作业 1 — N 逐步结果」)。
711
- 3. 每个实体列出 **3–8 个关键属性**(主键、业务主键、外键、本迭代读写的关键列);勿堆砌全量字段(全量在字段说明表)。
712
- 4. 与 §2 决策、§3 组件一致:图中实体必须在表一览与逐表章节出现。
713
-
714
- ```mermaid
715
- erDiagram
716
- PARENT_TABLE ||--o{ CHILD_TABLE : "1:N 业务关系说明"
717
- PARENT_TABLE {
718
- char uid PK "业务主键"
719
- varchar name "名称"
720
- }
721
- CHILD_TABLE {
722
- char uid PK
723
- char parent_uid FK
724
- int step_order "本迭代幂等键之一"
725
- }
726
- ```
727
-
728
- **图说明(强制,紧跟 ER 图)**:用表格描述图中每张表,提升可读性 —— 不是重复 ER 属性列表,而是回答「这张表是干什么的、本迭代怎么动」:
729
-
730
- | 表名 | 中文名 | 职责(一句话) | 结构 | 本迭代动作 |
731
- |------|--------|--------------|------|------------|
732
- | `parent_table` | … | … | 不变 / 新增 / 改列 | 只读 / 写入 / 新建 |
733
-
734
- ##### 4.4.3 逐表详设(强制骨架)
735
-
736
- 对表一览中的**每一张表**输出同构小节 `##### \`table_name\`(中文名)`(**仅此一级**进大纲;其下**禁止**再开标题)。顺序固定,标签一律 `**加粗**`:
737
-
738
- 1. **本迭代动作**:只读 / 写入(既有路径) / 新建 / 改结构(列清单) —— 一句话 + 关键不变量(如幂等键)。
739
- 2. **本迭代变更语句**:`无` 或完整 `ALTER`/`CREATE` 片段(可执行)。
740
- 3. **DDL(现网/目标)**:完整 `CREATE TABLE ...`(即使本迭代零 DDL 也给出对照用完整表定义)。
741
- - **必须含存储引擎与字符集**(MySQL:`ENGINE=InnoDB DEFAULT CHARSET=utf8mb4` …;PostgreSQL 写明 schema;SQLite 可省略 ENGINE)。
742
- - 含 PRIMARY KEY、UNIQUE、KEY/INDEX、必要时列/表 `COMMENT`;首行注释标明 DDL 来源。
743
- 4. **字段说明**:紧跟一张表(强制列):
744
-
745
- | 字段名称 | 字段类型 | 是否有默认值 | 字段说明 | 本迭代用法 |
746
- |----------|----------|--------------|----------|------------|
747
-
748
- - 「本迭代用法」写清:读 / 写 / 不涉及 / **固定赋值**等;索引已在 DDL 声明即可。
749
- 5. 若含 JSON / 大字段契约:用 `**JSON 形状 · <列名或逻辑名>**` 加粗标签 + 形状表/代码块,**不要**再开 `##### 字段说明` / `##### runtime_payload…` 标题。
750
-
751
- ##### 4.4.4 非表字段、数据迁移与回滚兼容
752
-
753
- | 项 | 说明 |
754
- |----|------|
755
- | 协议/计算字段(不落库) | 如列表聚合计数;说明计算方式 |
756
- | **存量数据默认值填充策略**(G3) | JSON 形状变更或新增列时**必须**填写:回填 SQL/脚本、读路径默认值、是否允许空、上线顺序(先兼容读再写新形状等) |
757
- | 结构回滚 | 有 DDL → 回滚脚本要点;无 DDL →「无结构可回滚,回滚应用即可」 |
758
- | **回滚数据兼容**(G4) | 新版本已写入行/JSON,旧版本代码能否安全忽略未知字段或旧 `schema_version`?写明机制(`omitempty` / 忽略未知键 / version 分派等) |
759
- | 数据保留 | 已写入行是否保留、是否需清洗 |
760
-
761
- **零结构变更且不改 JSON 语义时**:在上表写明「无存量填充;无新形状回滚兼容问题」,不得整节留空。
762
-
763
- #### B. 库表路径 —— 质量自检(生成后必过)
764
-
765
- - [ ] 有总则结论表 + 本迭代变更语句(零变更也显式写「无」)
766
- - [ ] 有 Mermaid `erDiagram`,且图后有「表名/中文名/职责/结构/本迭代动作」说明表
767
- - [ ] 每张涉及表均有:动作、变更语句、**完整 CREATE TABLE(含引擎与字符集)**、字段说明表
768
- - [ ] 字段说明表含「本迭代用法」列;幂等键 / 外键 / 枚举合法值写清
769
- - [ ] **G3**:JSON 变更或新增列时有存量默认值填充策略;否则显式写「无存量填充」
770
- - [ ] **G4**:回滚数据兼容有明确方案或显式「无新旧互读问题」
771
- - [ ] 无「仅文字描述表结构、无 DDL」或「DDL 缺 ENGINE/CHARSET」的偷懒写法
772
- - [ ] 零 DDL 迭代禁止假装「不涉及数据库」—— 只要读写表,仍走库表路径并展示现网 DDL
773
- - [ ] 总则含「项目约定」列(路径或「未发现」)+「DB 技能」列+「DDL 来源」
774
- - [ ] 若探测到项目 DB 约定,正文已体现其硬禁令;否则确认摘要 WARNING
775
-
776
- #### C. 非库表路径(CLI / 库 / 配置 / 状态文件)
777
-
778
- 无关系库表时,覆盖配置结构 / 状态文件 / YAML schema / 缓存键:
779
-
780
- | 元素 | 内容 |
781
- |------|------|
782
- | 配置或状态结构 | 键路径、类型、默认值、生效时机 |
783
- | 约束 | 合法值、校验失败行为 |
784
- | 迁移 | 缺省兼容、是否改写存量文件 |
785
-
786
- 示例:
787
- ```yaml
788
- # specflow/config.yaml 新增
789
- artifacts:
790
- language: zh-CN # en | zh-CN,缺省 en
791
- ```
792
-
793
- **完全不涉及任何持久化/配置结构时写**:`不涉及数据库变更(纯逻辑/CLI 变更,无持久化数据模型)`。
794
-
795
- #### D. 库表 DDL 示例(完整度标杆)
796
-
797
- ```sql
798
- -- 来源:migrations/example/ddl/orders.sql(或:本迭代新增)
799
- CREATE TABLE `orders` (
800
- `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '内部自增主键',
801
- `uid` CHAR(36) NOT NULL COMMENT '业务主键',
802
- `project_id` VARCHAR(64) NOT NULL,
803
- `status` VARCHAR(32) NOT NULL DEFAULT 'pending',
804
- `created_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
805
- `updated_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
806
- PRIMARY KEY (`id`),
807
- UNIQUE KEY `uk_uid` (`uid`),
808
- KEY `idx_project_status` (`project_id`, `status`)
809
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
810
- COMMENT='订单';
811
- ```
812
-
813
- ### 4.5 接口设计 (Interface Design)
814
-
815
- **适用范围**:暴露 API / RPC / CLI 命令 / 跨模块函数接口的变更(含「协议不变但本迭代新消费」)。
816
- **项目类型适配**:Web/服务 → HTTP(+RPC);CLI → commander 等命令参数;库 → 导出函数签名。
817
-
818
- > **项目约定(先于起草)**:执行 `prompts/approval/project-conventions-guidance.md`,`topic=api`;再执行 **`prompts/approval/api-guidance.md`**(分层、RPC 锁名、proto/OpenAPI 可生成包)。
819
- > 懒加载项目 API/错误码/鉴权/契约约定。有 UI 时 **§4.6** 另跑 `topic=frontend` + `frontend-guidance.md`
820
- > (勿把页面树塞进 §4.5)。
821
- > **优先级**:项目约定 + 现网 OpenAPI/proto **>** SpecFlow §4.5 骨架 **>** LLM。
822
- > 在 §4.5.1 总览用一行注明「项目约定: <path|未发现>」。
823
-
824
- > **质量硬门槛(对外/跨端接口路径)**:本迭代**列入 §4.5 清单**的每个接口(含**协议不变**、**本迭代消费**、**行为扩展**等),§4.5 **必须**按下列完整结构输出,**禁止**因「无协议变更」而精简、省略字段表/示例/错误约定。参考质量标杆:`scenario-job-compile`「接口设计」章(总览与约定 → 接口清单 → 通用错误码 → 逐接口字段表+HTTP 示例 → 调用关系)。禁止只有路径名、无字段表、无错误约定、无请求/响应示例。
825
-
826
- > **大纲 / 标题层级(硬门槛 — 防 TOC 爆炸)**:大纲**只允许**下列标题;「请求体字段」「请求示例」「响应示例」「错误」等**禁止**写成标题,一律 `**加粗**`。
827
-
828
- ```text
829
- ### 4.5 接口设计
830
- ├── #### 4.5.1 总览与约定 ← 通道 / 清单 / 通用错误码 均用加粗小标题,不进更深目录
831
- ├── #### 4.5.2 逐接口详设
832
- │ ├── ##### I1 · <短名>(变更类型) ← 每个接口仅此一级标题
833
- │ └── ##### I2 · …
834
- └── #### 4.5.3 调用关系
835
- ```
836
-
837
- 接口内固定顺序用加粗标签:`**元信息**` → `**请求体字段**`(或路径/Query/CLI flags) → `**请求示例**` → `**成功响应字段**` → `**响应示例(成功)**` → `**响应示例(失败)**`(G2) → `**错误**` →(可选)`**处理顺序**`。
838
-
839
- #### A. 对外/跨端接口路径——强制结构
840
-
841
- ##### 4.5.1 总览与约定
842
-
843
- **1) 调用方与通道**(多通道时必填;单通道也建议写明鉴权):
844
-
845
- | 通道 | 路径前缀 / 入口 | 调用方 | 鉴权 |
846
- |------|-----------------|--------|------|
847
- | 例:控制台 API | `/api/v1/...` | 前端经网关 | 用户/项目身份 |
848
- | 例:内部 API | `/internal/v1/...` | Worker/服务 | 租约/服务身份 |
849
-
850
- **2) 本迭代接口清单**(强制总表,编号稳定便于交叉引用):
851
-
852
- | 编号 | 接口 | 变更类型 | 应用场景 |
853
- |------|------|----------|----------|
854
- | I1 | <短名> | **新增** / **修改** / **行为扩展**(请求体不变) / **不变**(本迭代消费) | 谁在什么时候用 |
855
-
856
- 变更类型约定(优化自标杆文档,强制统一用语):
857
-
858
- | 类型 | 含义 | §4.5 展开深度 |
859
- |------|------|---------------|
860
- | 新增 | 新路径或新 RPC | 完整展开(字段+示例+错误) |
861
- | 修改 | 请求/响应形状变化(加字段、改语义) | 完整展开,并标明**本迭代变更点** |
862
- | 行为扩展 | 消息形状不变,服务端认新取值/新分支 | 完整展开;在「本迭代变更」写明行为差异;可注明「请求/响应消息不变」 |
863
- | 不变(本迭代消费) | 协议/消息形状不动,本迭代开始依赖或调用 | **完整展开**(与新增/修改同骨架);「本迭代变更」写「协议不变,本迭代消费」;禁止「详见 OpenAPI/既有文档」代替字段表与示例 |
864
- | 不变(协议不变) | 本迭代仍调用,协议与现网一致 | **完整展开**(同上);字段/示例须与现网 OpenAPI/proto/锚点对齐,可标注「与现网一致」 |
865
-
866
- > **清单规则(硬)**:本迭代**不调用、不消费**的接口 **不列入** §4.5 清单。**一旦列入清单,无论变更类型是否为「不变」,均须按 §4.5.2 完整骨架输出**,不得精简、不得只写路径、不得跳过示例。
867
-
868
- > **分层规则(硬 — 防 B2 类混写)**:同一业务链上的 **Worker HTTP(L2)**、**平台 gRPC+HTTP 绑定(L3)**、**东向 client RPC(L4)** 必须是 **独立 `In`**,各自完整展开。禁止在 L2 写满 HTTP 后,用「内部经 I6/I7 调用」一行代替 L4 详设。见 `api-guidance.md` §1。
869
-
870
- **2b) 契约面分层(合订/三端推荐)**:
871
-
872
- | 层 | 面 | 清单要求 |
873
- |----|-----|----------|
874
- | L1 | 控制台 HTTP | 字段表 + 示例 + 错误 |
875
- | L2 | Worker→Gateway HTTP | OpenAPI schema 草案 + **完整** work 鉴权头示例 |
876
- | L3 | Gateway 转码 RPC | **冻结** RPC 名 + proto 字段号 + `google.api.http` + **Gateway 注册点** |
877
- | L4 | 平台 `client/<svc>/` RPC | 完整骨架;不变亦须字段表+示例,禁止 stub |
878
-
879
- **3) 通用错误码约定**(强制;按项目现网风格映射):
880
-
881
- | 错误类别 / 状态 | 典型 HTTP 或退出码 | 含义(本迭代) |
882
- |-----------------|-------------------|--------------|
883
- | 参数非法 | 400 / 退出码 1 | … |
884
- | 未找到 | 404 | … |
885
- | 无权限 / 未认证 | 403 / 401 | … |
886
- | 冲突 / 前置失败 | 409 / 412 | … |
887
- | 内部错误 | 500 | … |
888
-
889
- **约定**(按项目裁剪,至少覆盖命名与错误风格):
890
-
891
- 1. **字段命名**:与现网一致(如 JSON 蛇形 `project_id`;proto `json_name`;CLI kebab-case 等)。
892
- 2. **错误风格**:业务错误进 `message` / 状态详情;**禁止**「HTTP 200 + 业务错误码」混用(除非项目现网已是该风格且 design 显式沿用)。
893
- 3. **幂等 / 终态语义**:若存在上报类接口,写清「成功 ≠ 资源终态」等不变量(对齐 §2 决策)。
894
- 4. **兼容缺省**:可选字段缺省时的兼容行为写进字段表「默认」列。
895
- 5. **与流程对齐**:接口编号可被 §4.2/§4.3 时序与 §6 测试引用。
896
- 6. **RPC 锁名(硬)**:新增/修改 gRPC **禁止**「暂定」「如 XxxRpc」「实现时命名/对齐」。须写死 `package.ServiceMethod`,并在决策表或 §4.5 元信息一致。见 `api-guidance.md` §2。
897
- 7. **错误映射唯一(硬)**:条件 → **唯一** gRPC code → **唯一** HTTP;禁止「403/409(与 progress 同类)」「或现网」。
898
-
899
- ##### 4.5.2 逐接口详设(强制骨架)
900
-
901
- 对清单中**每个**编号 `In`(含**不变**类型),输出同构小节 `##### In · <短名>(<变更类型>)`(**仅此一级**进大纲;其下**禁止**再开 `####`/`#####`/`######`)。顺序固定,标签一律 `**加粗**`:
902
-
903
- 1. **元信息**(强制表):
904
-
905
- | 项 | 内容 |
906
- |----|------|
907
- | 应用场景 | 谁、在什么用户动作/系统时机下调用 |
908
- | 协议 | 方法 + 路径(或 CLI 命令 / 导出函数签名) |
909
- | Content-Type / 编码 | 如 `application/json`(若适用) |
910
- | 对应 RPC / 内部名 | **冻结**全名(例 `scheduler.SubmitStepResult`);proto 路径;**禁止**暂定/如/实现时 |
911
- | 鉴权 | 本接口鉴权要点(可引用通道表) |
912
- | Gateway 注册 | 新增 HTTP 绑定时:**文件+函数名**或 ProtoSets 路径(禁止只写「含新绑定」) |
913
- | 本迭代变更 | 一句话(新增字段 / 行为扩展 / 不变仅消费 …) |
914
-
915
- 2. **请求体字段**(有则写;路径参数 / Query / CLI flags 用同级加粗标签分块,如 `**Query 参数**`,仍**不要**升为标题):
916
-
917
- | 字段 | 类型 | 必填 | 默认 | 说明 |
918
- |------|------|------|------|------|
919
-
920
- - 合法值枚举、别名归一、与表字段差异写在「说明」;互斥参数用引用块。
921
-
922
- 3. **请求示例**(强制 ≥1 主路径成功请求):Web 用完整 `http` 块;CLI/库用等价示例。多场景时用加粗副标区分,例:`**请求示例(场景)**` / `**请求示例(接口用例 · 兼容旧客户端)**` —— **不是**标题。
923
-
924
- 4. **成功响应字段** + **响应示例(成功)**(强制)。
925
-
926
- 5. **响应示例(失败)**(质量红线 G2 — 强制):清单中**每个**接口 **≥1** 组报错示例(完整 HTTP 或等价);「不变」接口亦须给出典型失败场景(如参数非法、未认证、资源不存在);副标可写失败原因,例:`**响应示例(失败 · 无启用步)**`,仍**不是**标题。
927
-
928
- 6. **错误**(强制表:条件 → 状态/退出码 → 说明):
929
-
930
- | 条件 | 状态 / 退出码 | 说明 |
931
- |------|---------------|------|
932
-
933
- 7. **处理顺序**(可选):多步服务端合同用编号列表;与 §4.2/§4.3、§4.4 对齐。
934
-
935
- 8. **Proto / OpenAPI 契约包**( **新增** 或 **修改 HTTP 绑定** 的 RPC — 硬):在接口小节末尾用加粗标签 `**Proto 草案**` / `**OpenAPI 指针**` 输出:
936
- - proto:`rpc` 全名 + `message` 字段号表 + `google.api.http` 原文
937
- - Gateway:与现网同类 RPC **同一注册点**的文件/函数,或 ProtoSets 条目
938
- - Worker:OpenAPI 路径 + schema 字段与 L3 一致;HTTP 示例含 **全部** 必填头
939
- - status/enum **闭合**,与现网 ingest 校验一致(禁止「等」、禁止逐步 ingest 写 `running` 除非同步改白名单)
940
- 详见 `api-guidance.md` §3。
941
-
942
- ##### 4.5.3 调用关系(推荐)
943
-
944
- 用短文本或 Mermaid 概括调用方如何串起 `I1…In`(主路径一条线即可),便于实现与联调对照。
945
-
946
- ```text
947
- 调用方A: I3 → I1 → I4 → I7
948
- 调用方B: … → I5 → I6
949
- ```
950
-
951
- #### B. 接口路径 —— 质量自检(生成后必过)
952
-
953
- - [ ] 有通道/鉴权表(或多通道说明)+ 本迭代接口清单(编号+变更类型+场景)
954
- - [ ] 有通用错误码约定 + 命名/错误风格约定
955
- - [ ] **分层**:L2 Worker HTTP / L3 RPC / L4 东向 RPC 各有独立 `In`,无「内部调用」stub
956
- - [ ] **RPC 已冻结**:无暂定/如/实现时;新增 RPC 含 proto 字段号 + http option + Gateway 注册点
957
- - [ ] 清单中**每个**接口(含**不变**)具备:元信息、字段表、成功请求/响应示例、**失败示例(G2)**、错误表
958
- - [ ] **不变**接口未因「无协议变更」而省略字段表/示例;内容与现网契约或锚点一致
959
- - [ ] 无「只有路径、无字段/无示例/无错误」的偷懒写法;示例与字段表一致
960
- - [ ] 接口编号可被 §4.2/§4.3 流程、§6 测试引用
961
- - [ ] **大纲干净**:§4.5 目录仅为 `4.5.1–4.5.3` + 各 `##### In · …`;**无**「请求体字段 / 请求示例 / 响应示例 / 错误」标题节点
962
-
963
- #### C. CLI / 库项目路径(无 HTTP 时)
964
-
965
- 无 HTTP 时仍用「清单 + 逐接口」骨架,将「协议」换为命令/导出签名;错误码换为退出码或抛错类型。示例:
966
-
967
- ```text
968
- specflow init --artifact-language <language>
969
- 入参: language?: string 可选,默认 'en';合法值 en | zh-CN | zh(zh 别名→zh-CN)
970
- 出参: { status: 'initialized' | 'already_initialized' | 'updated_assets', message: string }
971
- 错误码:
972
- E_INVALID_LANGUAGE 退出码 1 — 不支持的 language 值
973
- E_PARITY_STRICT 退出码 1 — 资产生成后 parity 校验失败
974
- ```
975
-
976
- **完全不涉及接口变更时写**:`不涉及接口变更(内部实现调整,无对外/跨模块接口变化)`。
977
-
978
- ### 4.6 前端 / UI 设计 (Frontend / UI Design)
979
-
980
- **适用范围**:本变更含控制台 / Web / App UI / 页面 / 路由 / 组件(见 `frontend-guidance.md` → `uiInScope`)。
981
- **不涉及时**:整章省略,或在详细设计自检处写一行 `不涉及前端/UI 变更` —— **禁止**臆造页面树。
982
-
983
- > **项目约定 + IDE 落地规约 + FE 路由(先于起草)**:
984
- > 1. 执行 `project-conventions-guidance.md`,`topic=frontend`。
985
- > 2. 执行 `prompts/approval/frontend-guidance.md` §3 — **强制**扫描 IDE skills/rules
986
- > (`.cursor` / `.claude` / `.agents`)与落地文档(组件/路由/状态/表单/样式/a11y/测试/lint);
987
- > 合计 ≤5 文件;`Read` 路径,禁止 `invoke`。
988
- > 3. Read 现网路由/布局/API client 锚点(Pass 6 深度:仅文件)。
989
- > **优先级**:项目约定 + IDE skills/rules + 现网 UI **>** §4.6 骨架 **>** LLM。
990
-
991
- > **质量硬门槛**:`uiInScope=yes` 时必须输出下列结构。禁止只有「用 React/Vue」一句话;禁止把完整目录树堆进 §2.1。
992
- > **大纲 / 标题层级**:只允许 `#### 4.6.1–4.6.5` + `##### Page · <短名>`;「空态/加载/错误/依赖接口」等用 `**加粗**`。
993
-
994
- ```text
995
- ### 4.6 前端 / UI 设计
996
- ├── #### 4.6.1 总则与本迭代结论
997
- ├── #### 4.6.2 信息架构与路由
998
- ├── #### 4.6.3 关键页面 / 组件详设
999
- │ └── ##### Page · <短名>
1000
- ├── #### 4.6.4 状态与数据获取
1001
- └── #### 4.6.5 视觉与验证回路
1002
- ```
1003
-
1004
- #### 4.6.1 总则与本迭代结论
1005
-
1006
- | 项 | 结论 |
1007
- |----|------|
1008
- | Surface | Web / Mobile / Desktop / 混合 |
1009
- | Framework | |
1010
- | Styling / 设计系统 | |
1011
- | State | |
1012
- | UI kit | |
1013
- | FE testing | |
1014
- | 本迭代页面 | 列表 / **无新增页(仅改组件)** |
1015
- | 项目约定 | config + 中立 docs 路径 / **未发现** |
1016
- | IDE skills/rules | `.cursor`/`.claude`/`.agents` 下实际 Read 路径 / **未发现** |
1017
- | 本迭代不涉及 | 例:无设计系统重建 / 无 RN |
1018
-
1019
- 栈五元组须与 §2.2 前端行、Intake 确认一致。
1020
- 落地禁令(组件库、禁止全局 CSS、表单校验库等)用可读中文写入本节与 §2.1;路径放本表。
1021
-
1022
- #### 4.6.2 信息架构与路由
1023
-
1024
- | 路由 / 入口 | 页面短名 | 对应 Journey / Scenario | 本迭代动作 |
1025
- |-------------|----------|-------------------------|------------|
1026
- | | | | 新增 / 修改 / 不动 |
1027
-
1028
- 可用简短 Mermaid `flowchart` 画页面关系(G1:超 5 行散文改图)。
1029
-
1030
- #### 4.6.3 关键页面 / 组件详设
1031
-
1032
- 对清单中每个需展开的页面输出 `##### Page · <短名>`(**仅此一级**进大纲):
1033
-
1034
- 1. **目的**:一句话用户目标
1035
- 2. **关键组件**:布局 / 列表 / 表单 / 抽屉…(中文名;边界「不做什么」)
1036
- 3. **依赖接口**:§4.5 `In` 编号(无接口则写「无」并说明纯本地态)
1037
- 4. **状态要点**:进入页需要的数据;提交后的成功态
1038
- 5. **空态 / 加载 / 错误**(G6 — 至少一项写清文案或行为;推荐三项都写)
1039
- 6. **权限 / 可见性**(若有)
1040
-
1041
- #### 4.6.4 状态与数据获取
1042
-
1043
- | 类别 | 方案 | 说明 |
1044
- |------|------|------|
1045
- | Server state | 例:React Query / SWR / 仅页面内 fetch | |
1046
- | Client state | 例:Zustand / 组件本地 | |
1047
- | 表单与校验 | 例:Zod + RHF / 现网表单库 | |
1048
- | 错误呈现 | Toast / 页内 Alert / 错误边界 | 须用户可理解 |
1049
-
1050
- #### 4.6.5 视觉与验证回路
1051
-
1052
- - **响应式 / a11y**:本迭代必须覆盖的断点与可达性抽查(有则写;无则「沿用现网,本迭代不改视觉体系」)。
1053
- - **Visual Loop**:Generate → Render → Inspect → Refine(写清本项目的 preview / 截图 / 浏览器检查方式)。
1054
- - **命令**:`dev` / `test` / `e2e` / `browser check`(来自约定或 Intake;未知则 `[待 refine 澄清: FE 验证命令]`)。
1055
- - **AI builder**(若用):导出、本地可构建、密钥、退出计划 — 一小节即可。
1056
-
1057
- #### 前端路径 —— 质量自检
1058
-
1059
- - [ ] `uiInScope=yes` 时有 §4.6.1 五元组 + 页面清单(**G5**) + **项目约定/IDE skills/rules** 列
1060
- - [ ] 每个关键 Page 有依赖接口与空/加载/错态(**G6**)
1061
- - [ ] 页面可被 §4.2/§1.3 引用;接口编号对齐 §4.5
1062
- - [ ] 状态/表单/测试命令与已 Read 的 IDE/仓规约一致(有则引用路径)
1063
- - [ ] 大纲仅为 `4.6.1–4.6.5` + `Page · …`;无「空态」等标题节点
1064
- - [ ] 正文可读中文,无代码腔目录树堆砌,无整段粘贴 skill 原文
1065
-
1066
- ### 4.7 核心算法 / 逻辑说明 (Core Logic)
1067
-
1068
- **适用范围**:有非平凡算法或数据处理逻辑的变更。
1069
- | 元素 | 内容 |
1070
- |------|------|
1071
- | 输入输出 | 输入数据结构、输出数据结构 |
1072
- | 处理步骤 | 逐步逻辑(编号列表) |
1073
- | 复杂度 | 时间/空间复杂度,边界条件 |
1074
-
1075
- **不涉及非平凡算法时写**:`不涉及非平凡算法(逻辑简单,无复杂数据处理)`。
1076
-
1077
- ### 4.8 配置与运行环境 (Configuration & Runtime)
1078
-
1079
- **适用范围**:新增配置项、环境变量、运行时依赖的变更。
1080
- | 元素 | 内容 |
1081
- |------|------|
1082
- | 配置项 | 名称、类型、默认值、生效时机 |
1083
- | 环境变量 | 新增变量、语义 |
1084
- | 运行时依赖 | 新增依赖、版本、用途 |
1085
-
1086
- **不涉及配置变更时写**:`不涉及配置或运行环境变更`。
1087
-
1088
- ### 4.9 兼容性与迁移 (Compatibility & Migration)
1089
-
1090
- **适用范围**:破坏性变更、JSON/列变更、或任何「新版本写入、旧版本仍可能读」的发布窗口。
1091
-
1092
- | 元素 | 内容 |
1093
- |------|------|
1094
- | 旧行为 → 新行为 | 映射表(禁止含糊「基本兼容」) |
1095
- | 迁移路径 | 存量用户如何升级、步骤顺序 |
1096
- | **存量默认值填充**(G3) | 与 §4.4.4 一致;JSON/新列必须写明填充策略 |
1097
- | **回滚数据兼容**(G4) | 发布失败回滚后:新代码已写数据,旧代码是否安全忽略/跳过?必须给出方案(`omitempty` / 忽略未知字段 / `schema_version` 等) |
1098
- | 应用回滚 | 镜像/包回退步骤 |
1099
-
1100
- **完全无兼容风险时写**:`不涉及破坏性变更(向后兼容);无新形状写入,回滚仅回退应用即可` —— 仍须一句话点明「无新旧数据互读问题」。
1101
-
1102
- ### 详细设计质量自检(生成后检查)
1103
-
1104
- - [ ] 有 §4.1 设计要点一览(P1…Pn)
1105
- - [ ] 有 §4.2 Happy Path **完整**时序图 + 设计要点说明
1106
- - [ ] 每个 §4.3 业务场景均有图 + **设计要点说明**(无裸图)
1107
- - [ ] **G1**:超过 5 行的文字流程已改为 Mermaid,无长散文流程
1108
- - [ ] 每个详细设计元素可追溯到 §5 Requirement/Scenario(若有 §5)或 delta specs 中的同名条目,以及 §2 决策
1109
- - [ ] 涉及数据/接口的均非留空;不涉及类别显式标注
1110
- - [ ] **§4.4**:ER + DDL + 字段说明;若 JSON/新列变更则有**存量填充策略(G3)**与回滚数据兼容(G4)
1111
- - [ ] **§4.5**:通道/清单/错误码 + 字段/成功示例 + **失败示例(G2)** + 错误表
1112
- - [ ] **§4.6**(若 `uiInScope`):五元组 + 页面清单(**G5**) + 空/加载/错态(**G6**) + Visual Loop
1113
- - [ ] **§4.4/§4.5/§4.6 大纲**:目录仅含规定小节 + 表名/`In`/`Page`;字段/示例/DDL/空态等均为加粗标签
1114
- - [ ] **§4.9**:回滚兼容结论明确(或显式声明无新旧数据互读问题)
1115
- - [ ] **文风**:无「尽量/大概/一般情况下」等含糊词;生僻缩写首次已注解
1116
- - [ ] 若无法写出实现级细节,标记 `[待 refine 澄清: <元素>]`
1117
-
1118
- ---
1119
-
1120
- ## 5. 验收标准 (Acceptance Criteria)
1121
-
1122
- > **可选章**:仅当用户在写入前确认「要 §5」时输出;否则整章省略。
1123
- > 若输出:放在架构与详细设计之后;按 capability 完整列出 Requirement + Scenario,并做 3 级可测试性标注。
1124
-
1125
- [仅在用户确认需要时展开]
1126
-
1127
- ### 5.1 Capability: <name>
1128
- [Delta 操作类型: ADDED / MODIFIED / REMOVED / RENAMED]
1129
-
1130
- #### Requirement: <name>
1131
- <描述>
1132
-
1133
- | Scenario | WHEN | THEN | 可测试性 | 说明 |
1134
- |----------|------|------|---------|------|
1135
- | <name> | <条件> | <期望> | ✅ 功能可测试 / ⚠️ 文档可测试 / ❌ 不可测试 | <原因 if ⚠️/❌> |
1136
-
1137
- ---
1138
-
1139
- ## 6. 测试策略 (Test Strategy)
1140
-
1141
- > 本章回答:用分层测试证明方案正确。
1142
- > **与 §5 的关系**:若文档含 §5,矩阵必须映射到具体 Scenario;若用户未要 §5,则映射到 delta specs 中的 Requirement/Scenario **名称**(仍须可追溯,不得空泛)。
1143
- > **选择性呈现**:只列出本变更实际需要的测试层级;不涉及的层级显式标注"不涉及"。
1144
-
1145
- ### 6.1 分层测试矩阵
1146
-
1147
- | 测试层级 | 覆盖对象 | 工具/框架 | 目标(证明什么) | 覆盖的验收标准 |
1148
- |---------|---------|----------|---------------|---------------|
1149
- | 单元测试 | 核心函数/类/模块内部逻辑 | <框架,如 vitest/jest/pytest> | 逻辑正确、边界处理 | 引用 §5 的 Scenario |
1150
- | 集成测试 | 模块间交互、接口契约、外部依赖 | <框架> | 模块协作正确、契约一致 | 引用 §5 的 Scenario |
1151
- | 验收测试 | spec 的 WHEN/THEN 行为 | <E2E/CLI 测试> | 逐 Scenario 验证用户可见行为 | §5 全部核心 Scenario |
1152
- | 回归测试 | 主 specs 基线 + 既有行为 | <框架> | 不破坏已有功能 | 主 specs(§5 基线对照) |
1153
- | 性能测试 | 关键路径/高并发 | <如 k6/jmeter/bench> | NFR 性能目标达成 | NFR 章节 |
1154
- | 安全测试 | 认证/授权/输入边界 | <SAST/渗透> | 无已知漏洞 | NFR 安全目标 |
1155
- | 兼容性测试 | 多平台/多版本/多浏览器 | <如 playwright> | 跨环境一致 | 兼容性 Requirement |
1156
-
1157
- **填写要求**:
1158
-
1159
- 1. 每个测试层级**映射到 §5 验收标准**(引用具体 Scenario 名)—— 这是"测试策略与验收标准闭环"的关键
1160
- 2. 每个层级标注**工具/框架**(呼应 full-stack-skills 的"阶段→技能映射":测试阶段→test-writer/playwright/pytest)
1161
- 3. **目标要可验证**("证明 P95 < 200ms" 而非 "测性能")
1162
- 4. 新增测试 vs 修改既有测试要区分
1163
- 5. 若 `uiInScope=yes`:矩阵须覆盖组件/E2E 或 browser 检查,并与 §4.6.5 Visual Loop
1164
- (Generate→Render→Inspect→Refine)命令一致
1165
-
1166
- **示例**:
1167
-
1168
- | 测试层级 | 覆盖对象 | 工具/框架 | 目标(证明什么) | 覆盖的验收标准 |
1169
- |---------|---------|----------|---------------|---------------|
1170
- | 单元测试 | `artifact-language.ts` 的 normalize/require/validate | vitest | `zh`→`zh-CN` 别名、非法值拒绝 | "Normalize the Chinese CLI alias" |
1171
- | 集成测试 | `init` 命令 + config 写入 + 资产生成 | vitest + tmpdir | init 后 config.yaml 含 `artifacts.language` | "Initialize a Simplified Chinese project" |
1172
- | 验收测试 | `specflow init --artifact-language zh-CN` 全流程 | CLI 测试 | 端到端产物符合预期 | "Reject an unsupported language" 等 |
1173
- | 回归测试 | 既有 init 行为(无语言参数) | vitest | 缺省仍为 en,不破坏既有 | "Initialize without an explicit language" |
1174
-
1175
- ### 6.2 测试环境与数据
1176
-
1177
- | 项 | 说明 |
1178
- |----|------|
1179
- | 测试环境 | 单元/集成用本地 tmpdir;验收用隔离环境(如 CI) |
1180
- | 测试数据 | 需要的 fixture/seed 数据、中文/英文样本 |
1181
- | 并行/隔离 | 测试间是否可并行、是否需要隔离(文件锁/独立目录) |
1182
- | 覆盖率目标 | 核心模块目标覆盖率(如 ≥80%) |
1183
-
1184
- ### 6.3 测试策略自检
1185
-
1186
- - [ ] 每个 §5 验收标准至少被一个测试层级覆盖(闭环)
1187
- - [ ] 每个测试层级有工具、有可验证目标
1188
- - [ ] 既有行为有回归测试保护(对应 Pass 7 基线)
1189
- - [ ] 新增测试与修改既有测试已区分
1190
-
1191
- **不涉及测试变更时写**:`不涉及测试变更(纯文档/配置变更,无行为逻辑需要测试)`。
1192
-
1193
- ---
1194
-
1195
- ## 7. 部署/发布/回滚方案 (Deployment & Release)
1196
-
1197
- > **可选章**:仅当用户确认「要 §7」时输出;否则整章省略。
1198
- > 若输出:回答如何上线、如何发布、出问题如何回滚、上线后如何监控。纯库/CLI/文档项目若用户仍要本章,可写精简的「包发布/版本发布」方案,勿用空话充数。
1199
-
1200
- ### 7.1 部署方案 (Deployment)
1201
-
1202
- | 项 | 方案 |
1203
- |----|------|
1204
- | 部署目标 | 部署到哪里(生产/预发/多环境)、依赖的基础设施 |
1205
- | 部署方式 | 镜像/包发布/代码部署/配置下发;CI 流水线步骤 |
1206
- | 部署顺序 | 依赖部署的先后(如先迁移 DB 再部署应用) |
1207
- | 配置管理 | 新配置项如何在各环境生效、密钥管理 |
1208
- | 环境差异 | dev/staging/prod 的环境差异与处理 |
1209
-
1210
- ### 7.2 发布策略 (Release Strategy)
1211
-
1212
- | 项 | 方案 |
1213
- |----|------|
1214
- | 发布方式 | 蓝绿/金丝雀/滚动/直接替换;理由 |
1215
- | 发布窗口 | 是否需停机窗口、灰度比例 |
1216
- | 兼容性 | 新旧版本共存期间的兼容(如 API 版本化、DB 兼容) |
1217
-
1218
- ### 7.3 回滚方案 (Rollback)
1219
-
1220
- | 项 | 方案 |
1221
- |----|------|
1222
- | 回滚触发条件 | 什么情况下回滚(错误率/指标阈值) |
1223
- | 回滚方式 | 镜像回退/代码回退/数据回滚;自动或手动 |
1224
- | 回滚的数据一致性 | 数据迁移的回滚(若有)、缓存/队列的清理 |
1225
- | 回滚验证 | 回滚后如何确认恢复正常 |
1226
-
1227
- ### 7.4 监控与可观测性 (Monitoring & Observability)
1228
-
1229
- | 项 | 方案 |
1230
- |----|------|
1231
- | 关键指标 | 上线后需监控的指标(错误率/延迟/资源) |
1232
- | 日志/追踪 | 日志规范、链路追踪 |
1233
- | 告警 | 告警阈值与负责人 |
1234
-
1235
- ### 7.5 部署方案自检
1236
-
1237
- - [ ] 部署目标/方式/顺序明确
1238
- - [ ] 发布策略与兼容性说明
1239
- - [ ] 回滚触发条件、方式、数据一致性、验证明确
1240
- - [ ] 上线后监控指标与告警明确
1241
-
1242
- **不涉及运行时部署时写**:`不涉及运行时部署(纯库/CLI/文档项目,无服务上线,变更通过包发布/版本发布交付)`。
1243
-
1244
- ---
1245
-
1246
- ## 8. 闭环性检查 (Closed-Loop Verification)
1247
-
1248
- > **可选章**:仅当用户确认「要 §8」时输出;否则整章省略。
1249
- > 无论是否写入文档,**内部分析仍必须跑完 Pass 1–7**,并在对话确认摘要中给出整体闭环结论。
1250
- > 若写入本文:只保留下表 —— `PASS`/`SKIPPED` 一句话;`WARNING`/`FAIL` 最多 2–3 条要点;禁止每 Pass 长小节。
1251
-
1252
- | Pass | 检查项 | 结论 | 关键证据(一句话;⚠️/❌ 可列 2–3 条要点) |
1253
- |------|--------|------|--------------------------------------|
1254
- | 1 | 需求闭环 proposal↔specs | ✅/⚠️/❌ | |
1255
- | 2 | 方案闭环 design↔specs | ✅/⚠️/❌ | |
1256
- | 3 | 规格闭环 场景/可测试性/delta | ✅/⚠️/❌ | |
1257
- | 4 | 实施闭环 tasks↔specs | ✅/⚠️/❌ | |
1258
- | 5 | 风险闭环 缓解/BREAKING | ✅/⚠️/❌ | |
1259
- | 6 | 代码落地性 锚点/结构/栈 | ✅/⚠️/❌/⊘ | |
1260
- | 7 | 基线对照 主 specs | ✅/⚠️/❌/⊘ | |
1261
-
1262
- **整体闭环性:** PASS / PASS WITH WARNINGS / FAIL
1263
-
1264
- 判定:任一 ❌ → FAIL;无 ❌ 但有 ⚠️ → PASS WITH WARNINGS;全 ✅(⊘ 不计)→ PASS。
1265
-
1266
- ---
1267
-
1268
- ## 9. 可实施性评估 (Implementability Assessment)
1269
-
1270
- | 评估维度 | 结论 | 说明 |
1271
- |---------|------|------|
1272
- | 完整性 | READY / NEEDS REFINEMENT / BLOCKED | |
1273
- | 规格对齐 | | |
1274
- | 任务可执行性 | | |
1275
- | 技术可行性 | | |
1276
- | 依赖明确性 | | |
1277
- | 架构一致性 | | <基于 Pass 6 代码读取> |
1278
- | 实施风险 | | <核心模块/数据迁移/并发/外部接口> |
1279
-
1280
- **可实施性总评:** READY / NEEDS REFINEMENT / BLOCKED
1281
-
1282
- ---
1283
-
1284
- ## 10. 审批意见 (Approval Decision)
1285
-
1286
- > **禁止**在本文写入「AI 预审建议」小节。AI 预审结论(建议批准 / 有条件批准 / 退回 refine / 拒绝 + 理由)只在**对话中**向用户反馈。
1287
- > 本文仅保留人工签字栏。
1288
-
1289
- ### 10.1 人工审批签字栏
1290
-
1291
- | 角色 | 姓名 | 审批结论 | 日期 | 意见 |
1292
- |------|------|---------|------|------|
1293
- | 技术负责人 | | □ 批准 □ 退回 □ 拒绝 | | |
1294
- | 产品负责人 | | □ 批准 □ 退回 □ 拒绝 | | |
1295
- | 架构师 | | □ 批准 □ 退回 □ 拒绝 | | |
1296
-
1297
- > 审批结论填写说明:批准 → 可执行 `/specflow:apply`;退回 → 执行 `/specflow:refine` 修复后重新审批;拒绝 → 废弃本次 change。
1298
-
1299
- ---
1300
-
1301
- ## 附录 A: 产物溯源
1302
-
1303
- | 章节 | 数据来源 | 处理方式 |
1304
- |------|---------|---------|
1305
- | 绪论与边界 | proposal.md + explore.md(可选) + design Non-Goals | AI 提炼;痛点图 + What/Impact + User Journey + 非目标;**无变更摘要章** |
1306
- | 技术方案评估 | design.md | 决策表 + 风险表 + 设计质量 |
1307
- | 架构整体设计 | design + 锚点代码 + specs | Mermaid 图 + **图要点说明** + 组件边界表;追溯 §2 |
1308
- | 方案详细设计 | design + specs + 锚点 + 现网 DDL/API | 设计要点 + Happy Path + 业务场景(+说明) + 数据/接口等;追溯 §5+§2 |
1309
- | 验收标准 | specs/**/*.md | **可选**;用户确认后置于设计之后;3 级可测试性 |
1310
- | 测试策略 | §5(若有)或 delta specs + 项目测试栈 | 分层矩阵可追溯 |
1311
- | 部署/发布/回滚 | §2 决策 + 运行环境 | **可选**;用户确认后输出 |
1312
- | 闭环性检查 | 四件套 + 锚点 + 主 specs | 内部必跑 Pass 1–7;正文表**可选** |
1313
- | 可实施性评估 | tasks + design + specs + 代码 | AI 推理写入文档 |
1314
- | 审批意见 | 人工签字 | **仅签字栏**;AI 预审只在对话反馈 |
1315
- ```
1316
-
1317
- ### 生成规则 (Generation Rules)
1318
-
1319
- 1. **§1 绪论须真实准确**:现状流程图中的每个痛点必须有据于 `proposal.md` 的 `## Why`、`design.md` Context 或已确认的 `explore.md`(禁止臆造痛点)。将 What Changes + Impact 吸收进 §1.2(不设单独的「变更摘要」章)。每条 User Journey 步骤须能追溯到 §5 验收标准(**当 §5 纳入时**),否则追溯到具名 delta-spec 的 Requirement/Scenario。每条 Non-Goal 须写明「不做理由」。
1320
-
1321
- 2. **§5 / §7 / §8 为可选章节(硬规则)**:写入 `approval.md` 前,须询问用户是否纳入验收标准、部署/发布/回滚、闭环性检查表。仅当用户明确选择「要」时才写入对应章节;选择「不要/省略」时整章删除(禁止用「不涉及」占位填充)。§5 纳入时须穷尽(覆盖每个 Requirement/Scenario),且放在 §3/§4 之后。
1322
-
1323
- 3. **Pass 6 证据须引用真实代码**:当 Pass 6 为 ⚠️/❌ 时,若 §8 纳入,其「关键证据」须引用实际锚点路径与具体发现;**对话**确认摘要中亦须呈现相同证据。PASS 可一行带过(例:`锚点 N 个均存在,结构可扩展`)。绿场 → `⊘` 并注明 SKIPPED 原因。
1324
-
1325
- 4. **Pass 7 证据须引用基线 specs**:当 ⚠️/❌ 时,须引用所比对的能力/requirement 名称(§8 纳入时写入正文,**对话中始终呈现**)。PASS → 一行带过;无基线 → `⊘`。
1326
-
1327
- 5. **过度设计证据须引用 design/tasks 位置**:例:「Signal 2 见于 `design.md` § D3,为单一 reviewer 类型定义了 `ReviewerFactory`」——禁止只写「过度设计」。叙述优先可读中文;路径/符号放证据列。
1328
-
1329
- 6. **语言策略与文风**:叙述遵循 `artifacts.language`。须遵守文风硬规则:通俗、缩写首次注解、禁止含糊词、**禁止正文代码腔**(路径/函数名堆砌 → 可读中文;协议字段/DDL/HTTP 示例除外)。协议标记(`Requirement:` / `WHEN` / `THEN`)保持原文形式。
1330
-
1331
- 7. **禁止修改其他文件**:本 prompt 仅生成 `approval.md`。不得修改四件套、项目代码或主 specs。
1332
-
1333
- 8. **签字栏须留空**:人工签字字段必须空白。
1334
-
1335
- 8b. **AI 预审不入库(硬规则)**:禁止将「AI 预审建议」/§10.1 建议写入 `approval.md`。建议批准/有条件批准/退回 refine/拒绝 + 理由**仅在对话**确认摘要中交付。文档 §10 **仅**含人工签字表。
1336
-
1337
- 9. **§4.4 数据库章节质量(硬规则)**:若变更读/写任何关系表(含零 DDL、仅语义变更),§4.4 **必须**包含:
1338
- (a) 结构变更结论表 + 明确变更 SQL(或明确写「无」),
1339
- (b) 核心实体的 Mermaid `erDiagram` + 表说明图例(表名/中文名/职责/结构/本迭代动作),
1340
- (c) 每张表完整 `CREATE TABLE`(含存储引擎与字符集;MySQL 须 `ENGINE=InnoDB DEFAULT CHARSET=utf8mb4` …),
1341
- (d) 每张表字段说明表(含「本迭代用法」)。
1342
- 禁止仅用散文描述 schema。MySQL DDL 禁止省略 ENGINE/CHARSET。零 DDL 迭代仍须展示当前基线 DDL —— 当表处于读/写路径时,禁止声称「不涉及数据库」。
1343
-
1344
- 10. **§4.5 接口章节质量(硬规则)**:起草前执行 `project-conventions-guidance.md` `topic=api` + **`api-guidance.md`**.若变更涉及对外/跨服务/跨模块接口(含新增、修改、行为扩展、**协议不变但本迭代消费或调用**),§4.5 **必须**包含:
1345
- (a) 调用方/通道 + 鉴权总览,
1346
- (b) 编号稳定的接口清单(变更类型含 新增/修改/行为扩展/不变·本迭代消费/不变·协议不变),
1347
- (c) **契约面分层**:Worker HTTP / 平台 RPC+HTTP 绑定 / 东向 RPC **各自独立 `In`**,禁止 L2 详写、L4 一句 stub,
1348
- (d) 通用错误码映射(**唯一** gRPC code → **唯一** HTTP;禁止「或」「同类映射」),
1349
- (e) 清单中**每个**接口的元信息表、字段表、≥1 组成功请求/响应示例,
1350
- **(f) 每个接口 ≥1 组失败示例(G2)**,
1351
- (g) 错误条件表,
1352
- **(h) 新增/改 HTTP 绑定的 RPC**:冻结 RPC 全名 + proto 字段号 + `google.api.http` + Gateway 注册点 + Worker OpenAPI schema(禁止「暂定」「如」「实现时对齐」)。
1353
- 禁止 stub。**一旦列入清单,无论是否不变,均须完整骨架**;可标注「与现网一致」但仍须贴字段表与示例。
1354
-
1355
- 11. **§3 架构图须附设计要点(硬规则)**:每个架构 Mermaid 图后**必须**跟编号「设计说明 / 图要点」列表(边界/不变式/复用) —— 禁止仅复述节点名。仅有组件表不够。
1356
-
1357
- 12. **§4 Happy Path 与场景设计要点(硬规则)**:§4.1 设计要点表、§4.2 完整 Happy Path `sequenceDiagram`、§4.3 每个业务场景**必须**在图后附「设计要点」说明。仅有图无说明视为质量不合格。
1358
-
1359
- 13. **质量红线 G1–G6(硬规则)**:
1360
- - **G1**:超过 5 行散文的流程描述**必须**改为 Mermaid `sequenceDiagram` / `flowchart` / `stateDiagram-v2`(禁止长散文流程)。
1361
- - **G2**:§4.5 清单中**每个**接口(含**不变**)**必须**含 ≥1 组失败请求/响应示例(参数校验失败、租约过期等),禁止仅有错误码表。
1362
- - **G3**:JSON 形状变更或新增列**必须**在 §4.4.4 / §4.9 记录存量数据默认值填充策略。
1363
- - **G4**:**必须**说明回滚数据兼容性 —— 旧代码能否安全忽略/跳过新代码写入的数据(`omitempty`、未知字段忽略、`schema_version` 等)。仅写「回滚镜像」不够。
1364
- - **G5**:当 `uiInScope=yes` 时,§4.6 **必须**含页面/路由清单 + 前端栈五元组(Framework / Styling / State / UI kit / FE testing)。仅写「用 React」不合格。
1365
- - **G6**:当 `uiInScope=yes` 时,每个关键 `Page · …` **必须**覆盖空态/加载/错误至少一项,调用 API 时引用 §4.5 `In` 编号。
1366
-
1367
- 14. **文风(硬规则)**:面向实现者的通俗语言;生僻英文缩写首次使用须注解。禁止含糊词「尽量」「大概」「一般情况下」「可能需要」「酌情」「视情况」;改用「必须」「禁止」「采用 XX 方案」或显式 if/then 表。**禁止** §2.1/§3/§4 正文代码腔:改写为可读中文;每条 bullet 括号内定位至多一次;协议名仅出现在表/DDL/HTTP 示例中。
1368
-
1369
- 15. **§8 闭环正文可选但分析不可省(硬规则)**:对话摘要**始终**跑 Pass 1–7。用户选择纳入 §8 时,正文**仅**写一张汇总表(Pass | 检查项 | 结论 | 关键证据)。禁止展开七个 Pass 子节。用户选择省略时,`approval.md` 中**完全**不含 §8。
1370
-
1371
- 16. **§4.4 数据库取证(硬规则)**:起草关系型 DDL 前:
1372
- (a) 执行 `project-conventions-guidance.md`,`topic=database`,Read 最多 3 份项目约定;
1373
- (b) 执行 `database-guidance.md` 取 SpecFlow pack / `dbStack`;
1374
- (c) Read 现网 DDL/迁移/锚点。优先级:**项目约定 + 现网 DDL > SpecFlow guidance > LLM**。§4.4.1 须记录 `项目约定` 与 `DB 技能`(或 未发现 / LLM-fallback)。禁止臆造 MCP 工具;禁止 `npx skills add`。
1375
-
1376
- 17. **§4.4 / §4.5 / §4.6 大纲层级(硬规则)**:Markdown 目录须保持浅层。
1377
- - §4.4 标题仅:`#### 4.4.1–4.4.4` + 每表 `##### \`table\`(中文名)`。
1378
- - §4.5 标题仅:`#### 4.5.1–4.5.3` + 每接口 `##### In · <短名>(类型)`。
1379
- - §4.6 标题仅:`#### 4.6.1–4.6.5` + 每页 `##### Page · <短名>`。
1380
- - 「请求体字段」「请求示例」「响应示例」「错误」「DDL」「字段说明」「JSON 形状」「通用错误码约定」「空态」「加载」「错误」「依赖接口」等**必须**为 `**加粗**` 正文标签 —— **禁止** `####` / `#####` / `######` 标题。多组示例用加粗副标,禁止额外标题节点。
1381
-
1382
- 18. **项目约定懒加载(硬规则)**:写 §3 / §4.4 / §4.5 / §4.6 前,执行 `project-conventions-guidance.md` 对应主题(`architecture` / `database` / `api` / `frontend`)。优先 `specflow/config.yaml` 的 `conventions.<topic>`;否则 activeIde → 其他 IDE → 仓根中立文档。每主题最多 3 文件。若约定文件存在但草稿违反硬禁令,在对话摘要(及 §8 若纳入)中发出 WARNING。
1383
-
1384
- 19. **绿场/缺选型 Tech Stack Intake(硬规则)**:若 `projectMode=greenfield` 或四件套缺少所需栈维度(前端/后端/数据库与缓存/基础设施),**须在对话中询问用户**后再写架构或 DDL。答案写入 §2.2 技术选型与 §2.4 决策。禁止臆造全栈。标「不涉及」的维度可跳过。必选维度用户拒绝选择 → `[待 refine 澄清: 技术选型]` 并阻止猜测栈。`uiInScope=yes` 时前端答案须覆盖五元组(见 `frontend-guidance.md`);不接受仅「React」。
1385
-
1386
- 20. **§4.6 前端章节质量(硬规则)**:若 `uiInScope=yes`,起草 §4.6 前:
1387
- (a) 执行 `topic=frontend` 约定;
1388
- (b) 执行 `frontend-guidance.md` §3 并 **Read** 匹配的 IDE skills/rules + 实现文档(组件/路由/状态/表单/API client/样式/a11y/测试命令/lint 禁令) —— 最多 5 文件,禁止 `invoke`;
1389
- (c) Read 现网 UI 锚点。§4.6.1 **必须**引用 `项目约定` 与 `IDE skills/rules`(或 未发现)。§4.6 **必须**含 4.6.1–4.6.5(页面/状态明确后,未知命令方可标 `[待 refine 澄清]`)。页面交叉引用 §4.5 `In` 与 §4.2 旅程。UI 不在范围时整章省略 —— 禁止臆造页面树。禁止将 skill 正文原文粘贴进 `approval.md`。
1390
-
1391
- ---
1392
-
1393
- ## Part F: Segmented Generation (Map → CLI Reduce)
1394
-
1395
- > Router detail: `prompts/approval/segmented-generation.md`
1396
- > Index template: `templates/approval-index.yaml` · Part fragment: `templates/approval-part.md`
1397
-
1398
- When `approval/index.yaml` has `mode: segmented` (default for non-trivial §4), follow
1399
- **12a → Gate → 12b → 12c → 12d**. The external artifact remains `approval.md`; the
1400
- `approval/` directory is agent workspace only.
1401
-
1402
- ### F.1 When to segment
1403
-
1404
- | Condition | Mode |
1405
- |-----------|------|
1406
- | `tables > 2` OR `interfaces > 3` OR `pages > 2` OR `optional.s5=true` | **segmented** (mandatory) |
1407
- | Else | ask user: segmented (recommended) or monolithic |
1408
-
1409
- ### F.2 Pipeline (hard order)
1410
-
1411
- 1. **12a Index + Skeleton** — write `index.yaml` + `analysis.json` + parts 01–03, 04-detail-core, 06/09/10
1412
- 2. **Gate** — user confirms index inventory + optional chapters + mode
1413
- 3. **12b Map Append** — batched `04.4*` / `04.5*` / `04.6*` / `04.7–04.9`
1414
- 4. **12c Optional** — `05*` / `07` / `08` only when opted in
1415
- 5. **12e AI Review** — fix parts; write `review-result.json` with `part_hashes` (see `ai-review.md`)
1416
- 6. **12f Finalize** — `specflow approval finalize <change>` (lint → review-check → check → assemble → bundle)
1417
-
1418
- **Reduce 禁止 LLM** — never stitch parts in chat or paste from memory.
1419
-
1420
- ### F.3 Anti-lazy rules (Map — hard)
1421
-
1422
- | # | Forbidden | Required |
1423
- |---|-----------|----------|
1424
- | L1 | One-shot full `approval.md` when `mode=segmented` | Write parts; `specflow approval finalize` |
1425
- | L2 | Empty part, `< 20` chars, placeholder-only | Full section per Part E |
1426
- | L3 | `TODO` / `待补充` / `此处省略` / bare `TBD` | Concrete text or `[待 refine 澄清: <元素>]` |
1427
- | L4 | `详见 design/tasks` without §/In/Page id | Cross-ref `§4.5 I2` / `Page·列表` / `P1` |
1428
- | L5 | New table/interface/page ids not in index | Update `index.yaml` first |
1429
- | L6 | Skip DDL/字段表/失败示例 because "same as design" or "unchanged API" | G2–G6 minimum; **不变**仍须完整 §4.5 骨架 |
1430
- | L6b | Collapse L4 RPC into「内部调用 I7」; L2-only HTTP without proto | **分层**: L2/L3/L4 各独立 `In`;见 `api-guidance.md` §1 |
1431
- | L6c | RPC「暂定/如/实现时命名」 | **冻结** `Service.Method` + proto 字段号;见 `api-guidance.md` §2–§3 |
1432
- | L7 | Skip IDE skills/rules scan for §4.6 | `frontend-guidance.md` §3 before Map |
1433
- | L8 | Paste skill/rule bodies verbatim | Readable Chinese + path in §4.6.1 |
1434
- | L9 | Foreign `## N.` headings in parts | `###`/`####` only; CLI injects chapter headers |
1435
- | L10 | Mark done without finalize passing | Fix diagnostics; run `specflow approval finalize` |
1436
-
1437
- CLI lazy validation mirrors L2–L3 (`lazy_part_content` on assemble/check).
1438
-
1439
- ### F.4 Map context budget
1440
-
1441
- Per batch Read only:
1442
-
1443
- - `approval/index.yaml` + `approval/analysis.json` (verdicts, not full Pass essays)
1444
- - design/tasks/spec **snippets** for batch ids
1445
- - conventions (≤3 files/topic; frontend ≤5 total per frontend-guidance)
1446
- - anchor files for batch entities
1447
-
1448
- Do not reload entire four artifacts each batch.
1449
-
1450
- ### F.5 index.yaml contract
1451
-
1452
- - `parts_order` is source of truth for assemble order
1453
- - `tables[]` / `interfaces[]` / `pages[]` entries MUST include `part` matching `approval/parts/<part>.md`
1454
- - `optional.s5/s7/s8` gates §5/§7/§8 parts even if files exist on disk
1455
-
1456
- ### F.6 Retry
1457
-
1458
- | CLI diagnostic | Action |
1459
- |----------------|--------|
1460
- | `lazy_part_content` | Rewrite that part only; re-check |
1461
- | `missing_part` | Write part or fix index |
1462
- | `id_part_mismatch` | Align index `part` with filename |
1463
- | `orphan_part` | Add to index or delete file |
1464
-
1465
- Do not rerun Pass 1–7 unless analysis is stale.
1466
-
1467
- ---
1468
-
1469
- ## Part G: Multi-Repo Approval (多仓)
1470
-
1471
- > Router: `prompts/approval/multi-repo-guidance.md`
1472
-
1473
- ### G.1 Trigger
1474
-
1475
- User natural language, workset, or cross-repo design → `multi_repo.enabled=true`.
1476
-
1477
- ### G.2 User gates (hard, before Stage 12a)
1478
-
1479
- 1. **Document mode**: **A** bundle (per_repo + CLI bundle, recommended) **or** **B** per_repo only **or** **C** legacy unified LLM merge (discourage).
1480
- 2. If **A or C**: **主仓** `primary_repo` — playbook/bundle or unified workspace path.
1481
- 3. Record in `index.yaml`; set `acp.pipeline: acp/v2`; do not assemble until answered.
1482
-
1483
- ### G.3 Bundle 合订视图 (recommended)
1484
-
1485
- - Each repo: own `approval/` + `specflow approval assemble <repo.change>`.
1486
- - Primary repo: `approval-playbook.yaml` + `specflow approval bundle <primary.change>`.
1487
- - Output: `approval-unified.md` (readonly concatenation, no LLM merge).
1488
-
1489
- ### G.4 Legacy unified LLM 合订 (discouraged)
1490
-
1491
- - Read **every** repo's four artifacts + anchors.
1492
- - `index.change` **should equal** primary repo's change name.
1493
- - Header lists all repos; §2.3 / 附录 B per-repo tables.
1494
- - CLI: `specflow approval assemble <primary.change>` from **primary** planning root.
1495
-
1496
- ### G.5 Per-repo 分仓
1497
-
1498
- - Separate `approval/` (or monolithic `approval.md`) **in each repo**.
1499
- - Each document scoped to that repo only; cross-ref sibling paths.
1500
- - Separate assemble per repo.
1501
-
1502
- ### G.6 Inventory
1503
-
1504
- Recommend `repo` on `tables[]` / `interfaces[]` / `pages[]` entries for unified mode traceability.
1505
-
1506
- ### G.7 主仓一键 · Subagent 并行 (mode A)
1507
-
1508
- > Router: `prompts/approval/multi-repo-spoke-subagent.md` · Orchestrator: `skills/specflow-approval/SKILL.md` **Stage 1c**
1509
-
1510
- When user starts `/specflow:approval` from **primary** repo and chose **A (bundle)**:
1511
-
1512
- 1. Primary writes `approval-playbook.yaml`; spoke indexes set `bundle.enabled: false`.
1513
- 2. **Parallel** Task subagents per non-primary repo → full spoke Map + 12e + `finalize` (no `--bundle`).
1514
- 3. Primary **wait gate** — all spokes `finalize_ok`.
1515
- 4. Primary Map + finalize + `finalize --bundle --workspace-root <primary.planning_root>`.
1516
-
1517
- **Anti-lazy (multi-repo)**: no unified LLM merge when mode A chosen; no stub spoke parts (`见 design.md` rows without decision text); each spoke needs `analysis.json` + `review-result.json` when `acp.review.enabled`.
1518
-
1519
- ---
1520
-
1521
- ## Part H: ACP Pipeline (Approval Compiler Pipeline)
1522
-
1523
- > Router: `prompts/approval/acp-pipeline.md` · AI review: `prompts/approval/ai-review.md`
1524
-
1525
- ### H.1 When to use
1526
-
1527
- | Signal | Action |
1528
- |--------|--------|
1529
- | Segmented mode (`approval/parts/`) | **Always** run ACP Verify before assemble |
1530
- | Multi-repo bundle | per_repo assemble → `approval bundle` |
1531
- | Long doc / cross-part inconsistency risk | Enable `acp.review` (Stage 12e) |
1532
-
1533
- ### H.2 Pipeline stages
1534
-
1535
- ```text
1536
- Analyze (Pass 1–7) → IR Freeze (index.yaml + interfaces[].frozen)
1537
- → Map (batched parts) → lint → review-pack → AI Review (12e) → review-check
1538
- → check → assemble → bundle (optional)
1539
- ```
1540
-
1541
- ### H.3 index.yaml `acp` block
1542
-
1543
- ```yaml
1544
- acp:
1545
- pipeline: acp/v2
1546
- review:
1547
- enabled: true
1548
- required_pass: true # assemble --require-review gates on this
1549
- ```
1550
-
1551
- Also freeze RPC names in `interfaces[].frozen` before Map batches.
1552
-
1553
- ### H.4 CLI
1554
-
1555
- **Preferred (skill default)**:
1556
-
1557
- ```bash
1558
- specflow approval finalize <change> [--bundle] [--workspace-root <root>]
1559
- ```
1560
-
1561
- | Command | Purpose |
1562
- |---------|---------|
1563
- | `specflow approval review-hashes <change> [--json]` | Emit `part_hashes[]` for `review-result.json` |
1564
- | `specflow approval finalize <change>` | One-shot: lint → review-check → check → assemble → bundle |
1565
- | `specflow approval lint <change> [--strict]` | Debug / CI: cross-part consistency |
1566
- | `specflow approval review-pack <change>` | Debug: generate review packet |
1567
- | `specflow approval review-check <change>` | Debug: validate review-result |
1568
- | `specflow approval check <change>` | Debug: parts/index validation |
1569
- | `specflow approval assemble <change> [--require-review]` | Debug: merge parts only |
1570
- | `specflow approval bundle <change>` | Debug: multi-repo readonly merge |
1571
-
1572
- ### H.5 Stage 12e AI Review (mandatory when `acp.review.enabled`)
1573
-
1574
- Runs **inside `/specflow-approval`** — not as separate user steps:
1575
-
1576
- 1. `specflow approval finalize <change>` — pauses with `review-packet.json` if needed
1577
- 2. Agent reads `prompts/approval/ai-review.md` + parts; fixes parts; writes `review-result.json`
1578
- 3. Re-run `specflow approval finalize <change>`
1579
-
1580
- AI review targets **long-document failure modes**: cross-part naming drift, inventory/body mismatch, depth imbalance across batches, unclosed branches, diagram/prose divergence, §4.6/§4.5 misalignment — not product-specific case rules.
1581
-
1582
- Optional domain packs (`runtime-guidance.md`, `api-guidance.md`) apply **only when** design/analysis mentions those topics.
1583
-
1584
- ### H.6 Render (MD → HTML)
1585
-
1586
- ```bash
1587
- specflow approval render <change> [--input approval.md] [--output approval.html]
1588
- specflow approval finalize <change> --render # optional: render after finalize
1589
- ```
1590
-
1591
- Standalone HTML with embedded CSS; Mermaid diagrams load from CDN when present.
1592
-
1593
- ### H.7 Playbook bundle (multi-repo)
1594
-
1595
- Template: `templates/approval-playbook.yaml`. Lists per-repo `approval.md` paths; `bundle` concatenates with repo headers — **no LLM merge**.
1596
-