@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.
- package/README.md +1 -1
- package/dist/core/project-config.d.ts +4 -0
- package/dist/core/project-config.js +49 -0
- package/dist/core/project-conventions.d.ts +15 -0
- package/dist/core/project-conventions.js +66 -0
- package/package.json +1 -1
- package/prompts/approval/database-guidance.md +10 -8
- package/prompts/approval/frontend-guidance.md +249 -0
- package/prompts/approval/generate.md +291 -88
- package/prompts/approval/project-conventions-guidance.md +171 -0
- package/skills/GUIDANCE_PACKS.md +45 -24
- package/skills/database/README.md +11 -10
- package/skills/specflow-approval/SKILL.md +172 -82
- package/templates/approval.md +81 -310
|
@@ -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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
`generate.md` +
|
|
105
|
-
|
|
106
|
-
- The 7-dimension closed-loop verification (Passes 1–7
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
110
|
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
|
185
|
-
Part E §8)
|
|
186
|
-
|
|
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
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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.
|
|
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
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
5.
|
|
295
|
-
|
|
296
|
-
|
|
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 (
|
|
368
|
+
## Stage 8: Acceptance Criteria (optional)
|
|
369
|
+
|
|
370
|
+
**Ask the user** whether to include **§5 验收标准** in `approval.md`.
|
|
306
371
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
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
|
|
316
|
-
|
|
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
|
-
|
|
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 绪论与边界
|
|
356
|
-
2. §2 技术方案评估
|
|
357
|
-
3. §3 架构整体设计
|
|
358
|
-
4. §4 方案详细设计
|
|
359
|
-
5. §5 验收标准
|
|
360
|
-
6. §6 测试策略
|
|
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
|
|
365
|
-
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
-
|
|
369
|
-
-
|
|
370
|
-
-
|
|
371
|
-
-
|
|
372
|
-
|
|
373
|
-
-
|
|
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
|
|
392
|
-
re-run the relevant Pass or dimension and
|
|
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`
|
|
397
|
-
2. Do
|
|
398
|
-
3.
|
|
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
|
|