@gordon.gan/specflow 1.4.2-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/dist/integrations/claude/adapter.js +2 -0
- package/dist/integrations/codex/adapter.js +3 -0
- package/dist/integrations/cursor/adapter.js +2 -0
- package/dist/integrations/shared/parity-comparator.js +1 -0
- package/dist/integrations/shared/parity-manifest.js +3 -0
- package/dist/integrations/shared/runtime-assets.d.ts +13 -0
- package/dist/integrations/shared/runtime-assets.js +41 -3
- package/package.json +1 -1
- package/prompts/approval/database-guidance.md +43 -17
- package/prompts/approval/frontend-guidance.md +249 -0
- package/prompts/approval/generate.md +292 -87
- package/prompts/approval/project-conventions-guidance.md +171 -0
- package/skills/GUIDANCE_PACKS.md +70 -0
- package/skills/database/README.md +24 -5
- package/skills/guidance-packs.yaml +10 -0
- package/skills/specflow-approval/SKILL.md +172 -77
- package/templates/approval.md +81 -310
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# Approval · Project Conventions Router
|
|
2
|
+
|
|
3
|
+
> Used by `/specflow:approval` before drafting **§3 架构 / §4.4 数据 / §4.5 接口 / §4.6 前端**
|
|
4
|
+
> (frontend when `uiInScope=yes`).
|
|
5
|
+
> **目的**:让方案贴合**本仓库**的 skill / rule / 工程约定,而不是只套 SpecFlow 通用 guidance。
|
|
6
|
+
> **懒加载**:按主题按需 `Read`,禁止一次灌入全部 IDE rules。
|
|
7
|
+
> **Not** an MCP tool; **禁止** `invoke /xxx skill` —— 一律解析路径后 `Read`。
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 0. Priority (冲突时必须遵守)
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
① 项目约定 + 现网代码/DDL/OpenAPI > ② SpecFlow Guidance Pack > ③ LLM 常识
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- ① 决定「能不能做、禁令、现网形状」。
|
|
18
|
+
- ② 只补强「怎么写清楚」(如完整 CREATE TABLE、接口失败示例骨架)。
|
|
19
|
+
- ②/③ **不得**覆盖 ①(例:项目约定「本迭代禁止迁移」时,不得按通用 skill 发明 `ALTER`)。
|
|
20
|
+
|
|
21
|
+
Announce after resolve:
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
Project conventions (architecture|api|database|frontend): <paths…> | none
|
|
25
|
+
Conflict policy: project > SpecFlow guidance > LLM
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 1. Topics (何时加载)
|
|
31
|
+
|
|
32
|
+
| 主题 `topic` | 何时 **必须**跑本路由 | 典型要找的内容 |
|
|
33
|
+
|--------------|----------------------|----------------|
|
|
34
|
+
| `architecture` | 起草 **§3** 前 | 分层、模块边界、目录约定、禁止直连 |
|
|
35
|
+
| `database` | 起草 **§4.4** 前(且有持久化) | 迁移工具禁令、命名、字符集、现网表规范 |
|
|
36
|
+
| `api` | 起草 **§4.5** 前(且有对外/跨端接口) | 错误码、鉴权、契约/OpenAPI、通道 |
|
|
37
|
+
| `frontend` | 起草 **§4.6** 前(且 `uiInScope=yes`) | 组件/状态/路由/API client/设计系统/**表单/测试/a11y** 等落地约定;须含 IDE skills/rules 扫描(见 `frontend-guidance.md` §3) |
|
|
38
|
+
|
|
39
|
+
每个主题 **最多 Read 5 个文件**(配置列出的优先;自动探测时取最相关的前 5 个)。细节 references 仅在入口文件点名时再读(禁止 reference 链式跳转)。
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 2. Resolve paths (跨 IDE)
|
|
44
|
+
|
|
45
|
+
### 2.1 显式配置(最高优先)
|
|
46
|
+
|
|
47
|
+
读 `specflow/config.yaml` → `conventions.<topic>`(字符串路径数组,相对项目根)。
|
|
48
|
+
有配置则 **只 Read 这些路径**(仍受「最多 5 个」限制);缺文件 → WARNING。
|
|
49
|
+
|
|
50
|
+
```yaml
|
|
51
|
+
conventions:
|
|
52
|
+
architecture:
|
|
53
|
+
- docs/engineering/architecture.md
|
|
54
|
+
api:
|
|
55
|
+
- docs/api/guidelines.md
|
|
56
|
+
database:
|
|
57
|
+
- docs/db/conventions.md
|
|
58
|
+
frontend:
|
|
59
|
+
- docs/frontend/conventions.md
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 2.2 自动探测(无配置时)
|
|
63
|
+
|
|
64
|
+
1. 判定 `activeIde`(本会话 IDE):Cursor / Claude / Codex。
|
|
65
|
+
2. **先**扫 activeIde 候选。
|
|
66
|
+
3. 若无命中:按 `cursor → claude → agents` 回退扫同主题候选。
|
|
67
|
+
4. 再扫**仓根中立**路径。
|
|
68
|
+
5. 仍无 → `none`(允许继续,但总则/架构说明须写「未发现项目级约定」)。
|
|
69
|
+
|
|
70
|
+
#### 候选路径表
|
|
71
|
+
|
|
72
|
+
**仓根中立(跨 IDE 推荐真相源)**
|
|
73
|
+
|
|
74
|
+
| topic | 候选(存在则纳入) |
|
|
75
|
+
|-------|------------------|
|
|
76
|
+
| `architecture` | `docs/engineering/architecture.md`, `.specflow/conventions/architecture.md`, `ARCHITECTURE.md` |
|
|
77
|
+
| `api` | `docs/api/guidelines.md`, `docs/engineering/api.md`, `.specflow/conventions/api.md` |
|
|
78
|
+
| `database` | `docs/db/conventions.md`, `docs/engineering/database.md`, `.specflow/conventions/database.md` |
|
|
79
|
+
| `frontend` | `docs/frontend/conventions.md`, `docs/frontend/patterns.md`, `docs/frontend/testing.md`, `docs/engineering/frontend.md`, `.specflow/conventions/frontend.md`, `agent_docs/tech_stack.md`, `agent_docs/code_patterns.md`, `agent_docs/testing.md` |
|
|
80
|
+
|
|
81
|
+
**Cursor**
|
|
82
|
+
|
|
83
|
+
| topic | 候选 |
|
|
84
|
+
|-------|------|
|
|
85
|
+
| 通用 | `.cursor/rules/**/*.mdc` 中文件名/标题含 architecture\|api\|database\|db\|frontend\|backend\|ui\|react\|vue\|component\|tailwind\|a11y\|playwright 的条目(每主题最多 2) |
|
|
86
|
+
| skill | `.cursor/skills/**/SKILL.md` 目录名或 frontmatter `name`/`description` 匹配主题关键词 |
|
|
87
|
+
|
|
88
|
+
**Claude**
|
|
89
|
+
|
|
90
|
+
| topic | 候选 |
|
|
91
|
+
|-------|------|
|
|
92
|
+
| 通用 | `CLAUDE.md`, `.claude/CLAUDE.md`(整文件较大时只提取与主题相关章节) |
|
|
93
|
+
| skill | `.claude/skills/**/SKILL.md`(主题关键词匹配) |
|
|
94
|
+
| rules | `.claude/rules/**/*`(若存在;同名过滤) |
|
|
95
|
+
|
|
96
|
+
**Codex**
|
|
97
|
+
|
|
98
|
+
| topic | 候选 |
|
|
99
|
+
|-------|------|
|
|
100
|
+
| 通用 | `AGENTS.md`(提取与主题相关段落) |
|
|
101
|
+
| skill | `.agents/skills/**/SKILL.md`(主题关键词匹配) |
|
|
102
|
+
|
|
103
|
+
关键词提示:
|
|
104
|
+
|
|
105
|
+
- `architecture|arch|分层|模块`
|
|
106
|
+
- `api|openapi|rpc|接口|错误码`
|
|
107
|
+
- `database|db|sql|迁移|schema`
|
|
108
|
+
- `frontend|ui|react|vue|next|svelte|tailwind|component|控制台|页面|组件|表单|路由|a11y|playwright|vitest|样式|design.?system`
|
|
109
|
+
|
|
110
|
+
> **前端专题**:`topic=frontend` 时 **必须**按 `frontend-guidance.md` §3 扩扫 IDE skills/rules
|
|
111
|
+
> 与落地文档(状态/表单/测试/a11y 等);不要只命中一个泛化的「frontend」文件名就停。
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## 3. How to apply (写入方案时)
|
|
116
|
+
|
|
117
|
+
1. **用可读中文**把约定写进 §2.1 / §3 图要点 / §4.4 / §4.5 / §4.6(禁止代码腔堆砌)。
|
|
118
|
+
2. **硬禁令**原样保留语义(例:「本迭代禁止 goose 迁移」)。
|
|
119
|
+
3. 与 SpecFlow DB/API 硬门槛同时满足:项目禁令优先;表达骨架用 SpecFlow 规则。
|
|
120
|
+
4. 在对应章节**标明来源路径**(总则「项目约定」列,或架构图要点首条)。
|
|
121
|
+
5. 若探测到约定文件但正文未体现关键禁令 → 确认摘要 / §8(若有)记 `WARNING`:
|
|
122
|
+
`发现项目约定 <path> 但方案未采纳关键约束`。
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## 4. Interaction with SpecFlow database guidance
|
|
127
|
+
|
|
128
|
+
写 §4.4 时顺序固定:
|
|
129
|
+
|
|
130
|
+
1. 本路由 `topic=database`(项目约定)
|
|
131
|
+
2. `prompts/approval/database-guidance.md`(SpecFlow pack + dbStack)
|
|
132
|
+
3. 现网 DDL / 迁移 / 锚点文件(Pass 6)
|
|
133
|
+
4. 起草:表形状与禁令 ← ①+③;DDL 完整度与类型惯例 ← ②
|
|
134
|
+
|
|
135
|
+
§4.4.1 总则必须同时填写:
|
|
136
|
+
|
|
137
|
+
| 项 | 说明 |
|
|
138
|
+
|----|------|
|
|
139
|
+
| 项目约定 | 实际 Read 到的路径,或 **未发现** |
|
|
140
|
+
| DB 技能 | SpecFlow guidance 路径或 `LLM-fallback` |
|
|
141
|
+
| DDL 来源 | 迁移/基线路径或本迭代新增 |
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 4b. Interaction with frontend guidance
|
|
146
|
+
|
|
147
|
+
写 §4.6 时顺序固定:
|
|
148
|
+
|
|
149
|
+
1. 本路由 `topic=frontend`(项目约定 docs + IDE skills/rules 关键词匹配)
|
|
150
|
+
2. **强制**再跑 `prompts/approval/frontend-guidance.md` §3 —— 补扫开发落地维
|
|
151
|
+
(组件/路由/状态/表单/API client/样式/a11y/测试/lint);与步骤 1 **去重**,合计 ≤5 文件
|
|
152
|
+
3. 现网路由/布局/API client 锚点(Pass 6)
|
|
153
|
+
4. 起草:页面/组件边界与禁令 ← ①+②+③;章节骨架与 G5/G6 ← `frontend-guidance` 其余条款
|
|
154
|
+
|
|
155
|
+
§4.6.1 总则必须填写:
|
|
156
|
+
|
|
157
|
+
| 项 | 说明 |
|
|
158
|
+
|----|------|
|
|
159
|
+
| 项目约定 | config + 中立 docs 路径,或 **未发现** |
|
|
160
|
+
| IDE skills/rules | 实际 Read 的 `.cursor/.claude/.agents` skill/rule 路径,或 **未发现** |
|
|
161
|
+
| FE 栈 | 五元组 |
|
|
162
|
+
|
|
163
|
+
无 UI → 整章省略。发现约定但方案未采纳 → WARNING。
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## 5. Why this shape
|
|
168
|
+
|
|
169
|
+
- IDE 目录不同 → 用 **activeIde + 回退 + 中立 docs** 统一发现,不强迫业务仓只选一个 IDE。
|
|
170
|
+
- 上下文有限 → **按主题懒加载**,最多 3 文件。
|
|
171
|
+
- 贴合项目 → **优先级写死**,并要求总则可核对来源。
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Guidance Packs 与项目约定
|
|
2
|
+
|
|
3
|
+
审批写技术章时的取证优先级:
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
① 项目约定 (conventions / IDE rules / docs) > ② SpecFlow Guidance Pack > ③ LLM
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## SpecFlow 两层模型(包内)
|
|
10
|
+
|
|
11
|
+
| 层 | 包内位置 | 业务仓落地 | IDE 可发现 |
|
|
12
|
+
|----|----------|------------|------------|
|
|
13
|
+
| **Workflow skill** | `skills/specflow-*` + `COMMAND_CATALOG` | `.cursor/skills/specflow-*`(及 claude/agents) | 是 |
|
|
14
|
+
| **Guidance pack** | `skills/<pack>/` + [`guidance-packs.yaml`](guidance-packs.yaml) | `{ide}/specflow/guidance/<pack>/` | **否** |
|
|
15
|
+
|
|
16
|
+
Workflow 通过路由 `Read` 路径加载 guidance;禁止写成「invoke `/mysql` skill」。
|
|
17
|
+
|
|
18
|
+
## 项目约定(仓内,懒加载)
|
|
19
|
+
|
|
20
|
+
| 项 | 说明 |
|
|
21
|
+
|----|------|
|
|
22
|
+
| 路由 | `prompts/approval/project-conventions-guidance.md` |
|
|
23
|
+
| 解析辅助 | `src/core/project-conventions.ts`(config + 仓根中立路径) |
|
|
24
|
+
| 主题 | `architecture` → §3;`database` → §4.4;`api` → §4.5;`frontend` → §4.6(有 UI;含 IDE skills/rules 落地扫描) |
|
|
25
|
+
| 上限 | 每主题约定文件最多 **3**(helper);前端专题合计约定+IDE skills/rules ≤ **5**(见 `frontend-guidance.md` §3) |
|
|
26
|
+
|
|
27
|
+
另:前端详设结构由 `prompts/approval/frontend-guidance.md` 驱动(`uiInScope`、栈五元组、G5/G6、Visual Loop);与 DB 的 `database-guidance.md` 对称,**暂无**独立 `skills/frontend` guidance pack。
|
|
28
|
+
|
|
29
|
+
```yaml
|
|
30
|
+
# specflow/config.yaml(可选,优先于自动探测)
|
|
31
|
+
conventions:
|
|
32
|
+
database:
|
|
33
|
+
- docs/db/conventions.md
|
|
34
|
+
api:
|
|
35
|
+
- docs/api/guidelines.md
|
|
36
|
+
architecture:
|
|
37
|
+
- docs/engineering/architecture.md
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
无配置时:仓根中立文件(如 `docs/db/conventions.md`)+ Cursor/Claude/Codex 下 rules/skills(见路由文档,按 activeIde 优先再回退)。
|
|
41
|
+
|
|
42
|
+
## Guidance Pack 注册表
|
|
43
|
+
|
|
44
|
+
```yaml
|
|
45
|
+
packs:
|
|
46
|
+
- id: database
|
|
47
|
+
source: skills/database
|
|
48
|
+
installAs: guidance/database
|
|
49
|
+
consumers: [approval]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 新增 Guidance Pack
|
|
53
|
+
|
|
54
|
+
1. 在 `skills/<id>/` 放置 `SKILL.md`(及可选 `references/`)。
|
|
55
|
+
2. 在 `guidance-packs.yaml` 增加一行。
|
|
56
|
+
3. 消费方 prompt 写清:业务仓 `{ide}/specflow/guidance/<id>/` → 包内回退 → fallback。
|
|
57
|
+
|
|
58
|
+
## 数据库章节取证顺序
|
|
59
|
+
|
|
60
|
+
1. 项目约定 `topic=database`
|
|
61
|
+
2. SpecFlow `guidance/database/<stack>/`
|
|
62
|
+
3. 现网 DDL / 迁移 / 锚点
|
|
63
|
+
|
|
64
|
+
§4.4.1 总则必须填写「项目约定」「DB 技能」「DDL 来源」。
|
|
65
|
+
|
|
66
|
+
## 当前 packs
|
|
67
|
+
|
|
68
|
+
| id | consumers | 说明 |
|
|
69
|
+
|----|-----------|------|
|
|
70
|
+
| `database` | approval | 按 `dbStack` 补强 DDL 写法;不得覆盖项目禁令 |
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
# SpecFlow 本地数据库技能 (`skills/database/`)
|
|
2
2
|
|
|
3
|
-
本目录是 **SpecFlow
|
|
3
|
+
本目录是 **Guidance Pack** `database`:SpecFlow 仓库内长期维护的数据库参考知识,供 `/specflow:approval` 生成 §4.4 时按项目栈按需 `Read`。
|
|
4
|
+
|
|
5
|
+
详见 [`../GUIDANCE_PACKS.md`](../GUIDANCE_PACKS.md) 与 [`../guidance-packs.yaml`](../guidance-packs.yaml)。
|
|
4
6
|
|
|
5
7
|
## 硬性约定
|
|
6
8
|
|
|
7
9
|
| 项 | 约定 |
|
|
8
10
|
|----|------|
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
| 加载方式 | `
|
|
12
|
-
|
|
|
11
|
+
| 与项目约定关系 | **项目约定优先**。先跑 `project-conventions-guidance.md`(`topic=database`),再读本 pack |
|
|
12
|
+
| 运行时依赖 | **无远程仓库依赖**。审批流程只读本地文件 |
|
|
13
|
+
| 加载方式 | `database-guidance.md`:命中栈 → Read 本目录;未命中 → LLM-fallback |
|
|
14
|
+
| init 安装目标 | `{ide}/specflow/guidance/database/` |
|
|
15
|
+
| IDE 全局技能 | **不**安装到 `.cursor/skills` 等发现路径 |
|
|
16
|
+
|
|
17
|
+
## 路径解析(业务仓 §4.4)
|
|
18
|
+
|
|
19
|
+
1. 项目约定(`conventions.database` 或 `docs/db/conventions.md` 等)
|
|
20
|
+
2. `.cursor/specflow/guidance/database/<stack>/`(或 `.claude` / `.agents`)
|
|
21
|
+
3. 回退:包内 `skills/database/<stack>/`
|
|
22
|
+
4. 仍缺失:`LLM-fallback` + WARNING
|
|
23
|
+
|
|
24
|
+
§4.4.1 总则须同时填写「项目约定」「DB 技能」「DDL 来源」。
|
|
13
25
|
|
|
14
26
|
## 目录
|
|
15
27
|
|
|
@@ -24,6 +36,13 @@ skills/database/
|
|
|
24
36
|
README.md # 本文件
|
|
25
37
|
```
|
|
26
38
|
|
|
39
|
+
业务仓 init 后对应:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
.cursor/specflow/guidance/database/mysql/SKILL.md
|
|
43
|
+
…
|
|
44
|
+
```
|
|
45
|
+
|
|
27
46
|
## 历史种子(非依赖)
|
|
28
47
|
|
|
29
48
|
初版内容种子自 [full-stack-skills/database-skills](https://github.com/full-stack-skills/database-skills)(Apache-2.0)。
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Guidance packs: private knowledge installed under {ide}/specflow/guidance/
|
|
2
|
+
# NOT copied into IDE skills discovery paths (.cursor/skills, .claude/skills, .agents/skills).
|
|
3
|
+
# See skills/GUIDANCE_PACKS.md
|
|
4
|
+
|
|
5
|
+
packs:
|
|
6
|
+
- id: database
|
|
7
|
+
source: skills/database
|
|
8
|
+
installAs: guidance/database
|
|
9
|
+
consumers:
|
|
10
|
+
- approval
|
|
@@ -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,33 +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
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
- The
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
- **
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
You MUST read `generate.md` before performing any analysis or writing `approval.md`. Do not
|
|
124
|
-
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`.
|
|
125
180
|
|
|
126
181
|
---
|
|
127
182
|
|
|
@@ -178,9 +233,10 @@ After all 7 Passes:
|
|
|
178
233
|
- `PASS WITH WARNINGS` if no `FAIL` but at least one `WARNING`
|
|
179
234
|
- `PASS` if all Passes are `PASS` (a `SKIPPED` Pass does not affect the verdict)
|
|
180
235
|
|
|
181
|
-
When writing `approval.md` **§8
|
|
182
|
-
Part E §8)
|
|
183
|
-
|
|
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.
|
|
184
240
|
|
|
185
241
|
---
|
|
186
242
|
|
|
@@ -224,9 +280,11 @@ Scan `design.md` for the 5 extensibility signals:
|
|
|
224
280
|
|
|
225
281
|
## Stage 6: Architecture Design
|
|
226
282
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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.
|
|
230
288
|
|
|
231
289
|
It is complementary to Detailed Design: architecture is about **module-to-module
|
|
232
290
|
relationships** (macro), detailed design is about **module-internal implementation**
|
|
@@ -275,20 +333,30 @@ Produce the **detailed design** section (approval.md **§4** 方案详细设计)
|
|
|
275
333
|
|
|
276
334
|
**Selective** categories; uninvolved ones get explicit「不涉及 X」markers.
|
|
277
335
|
|
|
278
|
-
Order and hard requirements (from `generate.md` §4.1–4.
|
|
336
|
+
Order and hard requirements (from `generate.md` §4.1–4.9):
|
|
279
337
|
|
|
280
338
|
1. **设计要点一览** — P1…Pn invariants from design decisions (required).
|
|
281
339
|
2. **核心业务时序 · Happy Path** — complete Mermaid `sequenceDiagram` for the main success
|
|
282
340
|
path + post-diagram「设计要点」(required).
|
|
283
341
|
3. **业务场景时序** — each scenario: purpose + diagram + **设计要点说明** (required notes;
|
|
284
342
|
bare diagrams fail quality).
|
|
285
|
-
4. **数据结构** — Before
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
**Outline**: only `4.4.1–4.4.4` + `##### table`; DDL/字段说明/JSON = `**bold
|
|
289
|
-
5. **接口设计** —
|
|
290
|
-
|
|
291
|
-
|
|
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.
|
|
292
360
|
|
|
293
361
|
**Traceability**: every element → **§5** Requirement/Scenario and **§2** decision.
|
|
294
362
|
If not implementer-ready, mark `[待 refine 澄清: <元素>]`.
|
|
@@ -297,24 +365,34 @@ Present the detailed design to the user as part of the confirmation summary.
|
|
|
297
365
|
|
|
298
366
|
---
|
|
299
367
|
|
|
300
|
-
## Stage 8: Acceptance Criteria (
|
|
368
|
+
## Stage 8: Acceptance Criteria (optional)
|
|
369
|
+
|
|
370
|
+
**Ask the user** whether to include **§5 验收标准** in `approval.md`.
|
|
301
371
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
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).
|
|
305
375
|
|
|
306
376
|
---
|
|
307
377
|
|
|
308
378
|
## Stage 9: Test Strategy
|
|
309
379
|
|
|
310
|
-
Produce
|
|
311
|
-
|
|
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.
|
|
312
382
|
|
|
313
383
|
---
|
|
314
384
|
|
|
315
|
-
## Stage 10: Deployment & Release
|
|
385
|
+
## Stage 10: Deployment & Release (optional)
|
|
316
386
|
|
|
317
|
-
|
|
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.
|
|
318
396
|
|
|
319
397
|
---
|
|
320
398
|
|
|
@@ -345,52 +423,69 @@ Each dimension produces a verdict (`READY` | `NEEDS REFINEMENT` | `BLOCKED`) wit
|
|
|
345
423
|
Following the document structure and generation rules in `generate.md` Part E, produce
|
|
346
424
|
`approval.md` inside the change directory at `specflow/changes/<name>/approval.md`.
|
|
347
425
|
|
|
348
|
-
Document chapter order (hard):
|
|
426
|
+
Document chapter order (hard for included chapters):
|
|
349
427
|
|
|
350
|
-
1. §1 绪论与边界
|
|
351
|
-
2. §2 技术方案评估
|
|
352
|
-
3. §3 架构整体设计
|
|
353
|
-
4. §4 方案详细设计
|
|
354
|
-
5. §5 验收标准
|
|
355
|
-
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 预审小节)
|
|
356
438
|
|
|
357
439
|
Key rules:
|
|
358
440
|
|
|
359
|
-
- §1 truthful
|
|
360
|
-
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
-
|
|
364
|
-
-
|
|
365
|
-
-
|
|
366
|
-
-
|
|
367
|
-
|
|
368
|
-
-
|
|
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`.
|
|
369
453
|
|
|
370
454
|
---
|
|
371
455
|
|
|
372
456
|
## Gate: User Confirmation
|
|
373
457
|
|
|
374
|
-
Present a summary to the user:
|
|
458
|
+
Present a summary to the user (**chat only** — these are not document chapters):
|
|
375
459
|
|
|
376
460
|
- Closed-loop overall verdict (PASS / PASS WITH WARNINGS / FAIL)
|
|
377
461
|
- Design quality verdict (PASS / WARNING / FAIL)
|
|
378
462
|
- Implementability overall verdict (READY / NEEDS REFINEMENT / BLOCKED)
|
|
379
|
-
- AI pre-approval recommendation (建议批准 / 有条件批准 / 退回 refine / 拒绝)
|
|
463
|
+
- **AI pre-approval recommendation** (建议批准 / 有条件批准 / 退回 refine / 拒绝) + 理由
|
|
380
464
|
- The path where `approval.md` will be written
|
|
381
465
|
|
|
382
|
-
Ask explicitly
|
|
466
|
+
Ask explicitly about **optional chapters**:
|
|
467
|
+
|
|
468
|
+
```text
|
|
469
|
+
是否将以下章节写入审批文档?
|
|
470
|
+
- §5 验收标准: 要 / 不要
|
|
471
|
+
- §7 部署/发布/回滚: 要 / 不要
|
|
472
|
+
- §8 闭环性检查表: 要 / 不要
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
Then ask:
|
|
383
476
|
|
|
384
477
|
> "确认生成审批文档并写入 `specflow/changes/<name>/approval.md`?"
|
|
385
478
|
|
|
386
|
-
Do NOT write the file until the user
|
|
387
|
-
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.
|
|
388
482
|
|
|
389
483
|
On confirmation:
|
|
390
484
|
|
|
391
|
-
1. Write `approval.md`
|
|
392
|
-
2. Do
|
|
393
|
-
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.
|
|
394
489
|
|
|
395
490
|
---
|
|
396
491
|
|