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

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