@gordon.gan/specflow 1.4.4-beta → 1.5.0-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cli/commands/approval-assemble.d.ts +21 -0
- package/dist/cli/commands/approval-assemble.js +95 -0
- package/dist/cli/index.js +2 -0
- package/dist/core/approval/assemble.d.ts +10 -0
- package/dist/core/approval/assemble.js +391 -0
- package/dist/core/approval/index-schema.d.ts +473 -0
- package/dist/core/approval/index-schema.js +146 -0
- package/dist/core/approval/index.d.ts +4 -0
- package/dist/core/approval/index.js +3 -0
- package/dist/core/approval/paths.d.ts +8 -0
- package/dist/core/approval/paths.js +28 -0
- package/dist/core/approval/types.d.ts +120 -0
- package/dist/core/approval/types.js +1 -0
- package/package.json +1 -1
- package/prompts/approval/api-guidance.md +179 -0
- package/prompts/approval/generate.md +224 -153
- package/prompts/approval/multi-repo-guidance.md +202 -0
- package/prompts/approval/project-conventions-guidance.md +1 -1
- package/prompts/approval/segmented-generation.md +151 -0
- package/skills/GUIDANCE_PACKS.md +3 -1
- package/skills/specflow-approval/SKILL.md +132 -16
- package/templates/approval-index.yaml +72 -0
- package/templates/approval-part.md +15 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# Approval · Multi-Repo (多仓) Guidance
|
|
2
|
+
|
|
3
|
+
> Used by `/specflow:approval` when the user **自然语言指定多仓**、workset 含多个规划根、或
|
|
4
|
+
> design/tasks 明确跨 `talos` / `talos-web` / `talos-worker` 等仓库。
|
|
5
|
+
>
|
|
6
|
+
> **目的**:按各仓四件套与锚点生成技术审批文档,并 **询问用户** 产出 **一份合订** 还是 **多份分仓**;
|
|
7
|
+
> 合订时 **必须** 指定 **主仓** 存放 `approval.md` 与 `approval/` 工作区。
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 0. When to run
|
|
12
|
+
|
|
13
|
+
| 信号 | 动作 |
|
|
14
|
+
|------|------|
|
|
15
|
+
| 用户说「三仓 / talos+web+worker / 多仓合订 / 前后端一体」 | 启用 `multi_repo.enabled=true` |
|
|
16
|
+
| `specflow workset` / 会话上下文含多个 git 规划根 | 列出候选仓,请用户确认 |
|
|
17
|
+
| 仅单仓 change,无跨仓表述 | `multi_repo.enabled=false`,走单仓流程 |
|
|
18
|
+
| Hub + Spoke 联邦 | 见 §5;各 Spoke 可有不同 change id |
|
|
19
|
+
|
|
20
|
+
Announce:
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
Multi-repo approval: enabled | single-repo
|
|
24
|
+
Repos in scope: talos(scenario-job-compile), talos-web(web-scenario-cases), …
|
|
25
|
+
Document mode: (pending user) unified | per_repo
|
|
26
|
+
Primary repo (if unified): (pending user)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 1. Resolve repos (硬顺序)
|
|
32
|
+
|
|
33
|
+
1. **Parse user natural language** — 仓名、别名(平台/控制台/Worker)、change 名。
|
|
34
|
+
2. **Cross-check workset** — `specflow workset list` / 用户给出的绝对路径;成员顺序 **不** 等于主仓。
|
|
35
|
+
3. **Per repo, verify** (Read-only):
|
|
36
|
+
- `specflow/changes/<change>/.specflow.yaml` → `phase: refined`
|
|
37
|
+
- 四件套:`proposal.md`, `specs/**`, `design.md`, `tasks.md`
|
|
38
|
+
4. **Record** in `approval/index.yaml` → `multi_repo.repos[]`:
|
|
39
|
+
|
|
40
|
+
```yaml
|
|
41
|
+
multi_repo:
|
|
42
|
+
enabled: true
|
|
43
|
+
document_mode: unified # unified | per_repo — 用户确认后写入
|
|
44
|
+
primary_repo: talos # unified 时必填
|
|
45
|
+
repos:
|
|
46
|
+
- id: talos
|
|
47
|
+
label: 平台
|
|
48
|
+
role: platform
|
|
49
|
+
change: scenario-job-compile
|
|
50
|
+
root_hint: /path/to/talos # agent 读取用,可选
|
|
51
|
+
- id: talos-web
|
|
52
|
+
label: 控制台
|
|
53
|
+
role: web
|
|
54
|
+
change: web-scenario-cases
|
|
55
|
+
- id: talos-worker
|
|
56
|
+
label: Worker
|
|
57
|
+
role: worker
|
|
58
|
+
change: scenario-execution
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**禁止**在未 Read 各仓四件套前假设内容一致;change id **可以** 各仓不同。
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 2. User gate — 一份还是多份 (硬)
|
|
66
|
+
|
|
67
|
+
在 Pass 1 之前或 Stage 12a 之前,**必须** 询问:
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
本需求跨 N 个仓库,审批技术文档如何产出?
|
|
71
|
+
|
|
72
|
+
A) 一份合订文档 (unified) — 单份 approval.md,含各仓决策/接口/前端/Worker 切片
|
|
73
|
+
B) 多份分仓文档 (per_repo) — 每个仓库各自一份 approval.md,仅写本仓范围
|
|
74
|
+
|
|
75
|
+
请选择 A 或 B。
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 2.1 Unified(一份合订)
|
|
79
|
+
|
|
80
|
+
再询问:
|
|
81
|
+
|
|
82
|
+
```text
|
|
83
|
+
合订文档存放在哪个主仓?(approval.md 与 approval/ 工作区写在该仓 change 目录下)
|
|
84
|
+
|
|
85
|
+
1) talos (平台)
|
|
86
|
+
2) talos-web (控制台)
|
|
87
|
+
3) talos-worker (Worker)
|
|
88
|
+
…
|
|
89
|
+
|
|
90
|
+
请选主仓 id。
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**硬规则**:
|
|
94
|
+
|
|
95
|
+
- `multi_repo.document_mode: unified`
|
|
96
|
+
- `multi_repo.primary_repo: <id>` **必填**
|
|
97
|
+
- **工作区路径**(分片模式):
|
|
98
|
+
- `specflow/changes/<primary.change>/approval/index.yaml`
|
|
99
|
+
- `specflow/changes/<primary.change>/approval/parts/*.md`
|
|
100
|
+
- 产出:`specflow/changes/<primary.change>/approval.md`
|
|
101
|
+
- CLI:`specflow approval assemble <primary.change>` **在主仓规划根**执行
|
|
102
|
+
- 文档 §1.2 / §2.3 / 附录 B **必须** 按仓分表;Pass 6 锚点 **分仓列举**
|
|
103
|
+
- 合订 **不是** 只写主仓 design;须合并各仓 specs/design/tasks 的跨端语义
|
|
104
|
+
|
|
105
|
+
写入 `multi_repo.outputs.unified`:
|
|
106
|
+
|
|
107
|
+
```yaml
|
|
108
|
+
outputs:
|
|
109
|
+
unified:
|
|
110
|
+
repo: talos
|
|
111
|
+
change: scenario-job-compile
|
|
112
|
+
path: specflow/changes/scenario-job-compile/approval.md
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 2.2 Per-repo(多份分仓)
|
|
116
|
+
|
|
117
|
+
**硬规则**:
|
|
118
|
+
|
|
119
|
+
- `multi_repo.document_mode: per_repo`
|
|
120
|
+
- **每个** `repos[]` 条目独立:
|
|
121
|
+
- 在该仓 `specflow/changes/<repo.change>/approval/`(分片)或 `approval.md`(单体)
|
|
122
|
+
- 内容 **仅** 本仓 scope;交叉引用用「见 `<other-repo>` approval §x」
|
|
123
|
+
- 各仓分别 `specflow approval assemble <repo.change>`(若在主仓 CLI,需 `--store` 或 cd 到该根)
|
|
124
|
+
- **禁止**只在主仓写一份然后复制到其它仓
|
|
125
|
+
|
|
126
|
+
写入 `multi_repo.outputs.per_repo[]`:
|
|
127
|
+
|
|
128
|
+
```yaml
|
|
129
|
+
outputs:
|
|
130
|
+
per_repo:
|
|
131
|
+
- repo: talos
|
|
132
|
+
change: scenario-job-compile
|
|
133
|
+
path: specflow/changes/scenario-job-compile/approval.md
|
|
134
|
+
- repo: talos-web
|
|
135
|
+
change: web-scenario-cases
|
|
136
|
+
path: specflow/changes/web-scenario-cases/approval.md
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## 3. Analysis & Map 上下文
|
|
142
|
+
|
|
143
|
+
| 模式 | Read 范围 | index 库存 |
|
|
144
|
+
|------|-----------|------------|
|
|
145
|
+
| unified | 各仓四件套 + 各仓锚点 + 各仓约定 | `interfaces/pages/tables` 带 `repo` 字段(推荐) |
|
|
146
|
+
| per_repo | **当前仓**四件套 + 本仓锚点 | 仅本仓实体 |
|
|
147
|
+
|
|
148
|
+
**Unified 分片建议**:
|
|
149
|
+
|
|
150
|
+
- `02-design-review` — 三仓决策表
|
|
151
|
+
- `04.5-api` — 按 `repo` 或 L1/L2/L3/L4 分批;Worker 切片须 Read `api-guidance.md` + worker OpenAPI 路径
|
|
152
|
+
- `04.6-*` — 仅 `ui_in_scope` 且 web 仓
|
|
153
|
+
- 附录 B — 按仓允许/禁止路径
|
|
154
|
+
|
|
155
|
+
**Inventory 扩展**(可选列):
|
|
156
|
+
|
|
157
|
+
```yaml
|
|
158
|
+
interfaces:
|
|
159
|
+
- id: I4
|
|
160
|
+
short: 逐步上报
|
|
161
|
+
change: scenario-job-compile
|
|
162
|
+
part: 04.5-api-worker
|
|
163
|
+
repo: talos-worker
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## 4. Document header (unified)
|
|
169
|
+
|
|
170
|
+
合订 `approval.md` 头部 **必须** 声明:
|
|
171
|
+
|
|
172
|
+
```markdown
|
|
173
|
+
> **覆盖变更(多仓合订,主仓: talos)**:
|
|
174
|
+
> - 平台 `talos/scenario-job-compile`
|
|
175
|
+
> - 控制台 `talos-web/web-scenario-cases`
|
|
176
|
+
> - Worker `talos-worker/scenario-execution`
|
|
177
|
+
> **存放路径**: `specflow/changes/scenario-job-compile/approval.md`
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## 5. Hub / Federated 注意
|
|
183
|
+
|
|
184
|
+
- Hub change id 可与 Spoke change id **同名或不同**;`multi_repo.repos[].change` 用 **各规划根内真实目录名**。
|
|
185
|
+
- Hub 合同摘要可读 `--store`;Spoke approval **不**替代 Hub archive。
|
|
186
|
+
- `coordination.yaml`(若有)可 Read;无则 chat 列出各仓 phase。
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 6. 自检
|
|
191
|
+
|
|
192
|
+
- [ ] 用户已选 unified **或** per_repo
|
|
193
|
+
- [ ] unified → `primary_repo` 已选且工作区在该仓
|
|
194
|
+
- [ ] per_repo → 每仓输出路径已写入 `outputs.per_repo`
|
|
195
|
+
- [ ] 各仓四件套已 Read;非主仓内容已进合订正文或分仓文档
|
|
196
|
+
- [ ] Gate 摘要中列出 **所有** 将写入的 `approval.md` 路径
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## 7. 与单仓关系
|
|
201
|
+
|
|
202
|
+
`multi_repo.enabled=false` 时忽略本章;`change` 字段为当前规划根 change,行为与旧版一致。
|
|
@@ -33,7 +33,7 @@ Conflict policy: project > SpecFlow guidance > LLM
|
|
|
33
33
|
|--------------|----------------------|----------------|
|
|
34
34
|
| `architecture` | 起草 **§3** 前 | 分层、模块边界、目录约定、禁止直连 |
|
|
35
35
|
| `database` | 起草 **§4.4** 前(且有持久化) | 迁移工具禁令、命名、字符集、现网表规范 |
|
|
36
|
-
| `api` | 起草 **§4.5** 前(且有对外/跨端接口) | 错误码、鉴权、契约/OpenAPI
|
|
36
|
+
| `api` | 起草 **§4.5** 前(且有对外/跨端接口) | 错误码、鉴权、契约/OpenAPI、通道;然后 **`api-guidance.md`**(分层、RPC 锁名、proto 可生成包) |
|
|
37
37
|
| `frontend` | 起草 **§4.6** 前(且 `uiInScope=yes`) | 组件/状态/路由/API client/设计系统/**表单/测试/a11y** 等落地约定;须含 IDE skills/rules 扫描(见 `frontend-guidance.md` §3) |
|
|
38
38
|
|
|
39
39
|
每个主题 **最多 Read 5 个文件**(配置列出的优先;自动探测时取最相关的前 5 个)。细节 references 仅在入口文件点名时再读(禁止 reference 链式跳转)。
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Approval · Segmented Generation (Map → CLI Reduce)
|
|
2
|
+
|
|
3
|
+
> Used by `/specflow:approval` **Stage 12** when `mode=segmented` (default for non-trivial §4).
|
|
4
|
+
> **Reduce 禁止 LLM**:拼接必须 `specflow approval assemble <change>` 或 `specflow approval check <change>`。
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 0. When to segment
|
|
9
|
+
|
|
10
|
+
| Condition | Mode |
|
|
11
|
+
|-----------|------|
|
|
12
|
+
| `tables > 2` OR `interfaces > 3` OR `pages > 2` OR `optional.s5=true` | **segmented** (mandatory) |
|
|
13
|
+
| Else | ask user: segmented (recommended) or monolithic |
|
|
14
|
+
| User chose monolithic | write `approval.md` directly OR parts + single assemble |
|
|
15
|
+
|
|
16
|
+
Copy template: `templates/approval-index.yaml` → `approval/index.yaml`.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 1. Pipeline (hard order)
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
12a Index + Skeleton → index.yaml + analysis.json + parts 01–03 + 04-detail-core + stubs
|
|
24
|
+
Gate → user confirms index + optional chapters + mode
|
|
25
|
+
12b Map Append → parts 04.4* / 04.5* / 04.6* / 04.7–04.9 (batched)
|
|
26
|
+
12c Optional → parts 05* / 07 / 08 (only if optional.s5/s7/s8)
|
|
27
|
+
12d CLI Reduce → specflow approval check → specflow approval assemble --force
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Never** skip 12d. **Never** paste assembled markdown from memory instead of running CLI.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 2. Anti-lazy rules (Map — LLM MUST NOT)
|
|
35
|
+
|
|
36
|
+
| # | Forbidden | Required instead |
|
|
37
|
+
|---|-----------|------------------|
|
|
38
|
+
| L1 | One-shot full `approval.md` when `mode=segmented` | Write parts; assemble via CLI |
|
|
39
|
+
| L2 | Empty part, `< 20` chars, or only HTML comments | Full section content per generate.md |
|
|
40
|
+
| L3 | `TODO` / `待补充` / `此处省略` / bare `TBD` | Concrete text or `[待 refine 澄清: <元素>]` with reason |
|
|
41
|
+
| L4 | `详见 design/tasks` without §/In/Page id | Cross-ref `§4.5 I2` / `Page·列表` / `P1` |
|
|
42
|
+
| L5 | Invent new table/interface/page ids not in index | Update index.yaml first, then write part |
|
|
43
|
+
| L6 | Skip §4.4 DDL/字段表/失败示例 because "same as design" | Minimum per G2–G6; **不变**仍须完整 §4.5 |
|
|
44
|
+
| L6b | L2 HTTP only +「内部 I7」stub; or L4 one-liner | **分层** L2/L3/L4 各 `In`; `api-guidance.md` §1 |
|
|
45
|
+
| L6c | RPC「暂定/如/实现时」 | **冻结**名 + proto 字段号; `api-guidance.md` §2–§3 |
|
|
46
|
+
| L7 | Skip IDE skills/rules scan for §4.6 | frontend-guidance.md §3 before Map |
|
|
47
|
+
| L8 | Paste skill/rule bodies verbatim | Readable Chinese + path in §4.6.1 table |
|
|
48
|
+
| L9 | Write `## 4.` or foreign `## N.` in parts | Parts use `###`/`####`/`#####` only; CLI injects `## 4` |
|
|
49
|
+
| L10 | Mark part `ok` without `specflow approval check` passing | Run check; fix errors; then assemble |
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 3. Stage 12a — Index + Skeleton
|
|
54
|
+
|
|
55
|
+
**Write first:**
|
|
56
|
+
|
|
57
|
+
1. `approval/index.yaml` — full `parts_order`, all `tables[]`/`interfaces[]`/`pages[]` with `part` paths
|
|
58
|
+
2. `approval/analysis.json` — Pass 1–7 + quality + implementability (chat-only fields ok)
|
|
59
|
+
3. Parts (minimum):
|
|
60
|
+
- `01-intro.md` … `03-architecture.md`
|
|
61
|
+
- `04-detail-core.md` (§4.1–4.3 only)
|
|
62
|
+
- `06-test.md`, `09-implementability.md`, `10-signoff.md` (may be stub-length only for structure in 12a, fill before assemble)
|
|
63
|
+
|
|
64
|
+
**Chat gate:** show table/interface/page list from index; ask user to confirm before 12b.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 4. Stage 12b — Map Append
|
|
69
|
+
|
|
70
|
+
For each batch, **Read only**:
|
|
71
|
+
|
|
72
|
+
- `approval/index.yaml`
|
|
73
|
+
- `approval/analysis.json` (verdicts, not full Pass essays)
|
|
74
|
+
- design/tasks/specs **snippets** for this batch's ids
|
|
75
|
+
- lazy-loaded conventions (per topic caps)
|
|
76
|
+
- anchor files for this batch (Pass 6 depth: file only)
|
|
77
|
+
|
|
78
|
+
**Batching:** use `index.batching.*_per_call`. One part file per batch unit OR per index `part` field.
|
|
79
|
+
|
|
80
|
+
**After each part write:** update `approval/manifest.json` part entry (`status: draft|ok`).
|
|
81
|
+
|
|
82
|
+
### §4.4 part minimum (per table batch)
|
|
83
|
+
|
|
84
|
+
- 4.4.1 row in batch leader file if first batch
|
|
85
|
+
- ER if new entities
|
|
86
|
+
- per-table: CREATE TABLE + 字段说明 + 本迭代用法
|
|
87
|
+
- G3/G4 when applicable
|
|
88
|
+
|
|
89
|
+
### §4.5 part minimum (per interface)
|
|
90
|
+
|
|
91
|
+
- Run **`api-guidance.md`** before batch
|
|
92
|
+
- **One `In` per contract surface** (L2 Worker HTTP / L3 RPC+http / L4 client RPC) — no B2-style collapse
|
|
93
|
+
- meta + fields + success req/resp + **failure example (G2)** + error table (**含不变**)
|
|
94
|
+
- **新增/改 HTTP binding**: `**Proto 草案**` block — frozen RPC name, field numbers, `google.api.http`, Gateway registration, Worker OpenAPI path
|
|
95
|
+
- HTTP examples for L2: **all** required work auth headers (not body-only)
|
|
96
|
+
- **Forbidden**: 暂定 / 如 XxxRpc / 实现时命名 / 内部经 I7 一行代替 L4 详设
|
|
97
|
+
|
|
98
|
+
### §4.6 part minimum (per page)
|
|
99
|
+
|
|
100
|
+
- route + components + states + ≥1 of 空/加载/错态 (G6) + §4.5 `In` refs
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## 5. Stage 12c — Optional chapters
|
|
105
|
+
|
|
106
|
+
Only if user opted in AND `optional.s5/s7/s8: true` in index:
|
|
107
|
+
|
|
108
|
+
- Insert `05-*` / `07-deploy` / `08-closed-loop` into `parts_order` at correct positions
|
|
109
|
+
- §8: **one table only** (from analysis.json)
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 6. Stage 12d — CLI Reduce
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
specflow approval check <change>
|
|
117
|
+
specflow approval assemble <change> --force
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
- `check` MUST pass with **zero errors** before assemble
|
|
121
|
+
- Warnings (orphan parts) should be fixed or removed
|
|
122
|
+
- Report paths: `specflow/changes/<name>/approval.md`
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## 7. manifest.json (agent-maintained)
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"schema": "specflow.approval.manifest/v1",
|
|
131
|
+
"change": "<name>",
|
|
132
|
+
"parts": [
|
|
133
|
+
{ "id": "01-intro", "path": "approval/parts/01-intro.md", "status": "ok" }
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
CLI overwrites manifest on successful assemble with sha256 sums.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## 8. Retry
|
|
143
|
+
|
|
144
|
+
| Failure | Action |
|
|
145
|
+
|---------|--------|
|
|
146
|
+
| `lazy_part_content` on one part | Rewrite that part only; re-check |
|
|
147
|
+
| `missing_part` | Write missing part or fix index |
|
|
148
|
+
| `id_part_mismatch` | Align index `part` field with filename |
|
|
149
|
+
| index wrong | Edit index.yaml; delete wrong parts; rerun affected Map batches |
|
|
150
|
+
|
|
151
|
+
Do **not** rerun Pass 1–7 unless analysis is stale.
|
package/skills/GUIDANCE_PACKS.md
CHANGED
|
@@ -24,7 +24,9 @@ Workflow 通过路由 `Read` 路径加载 guidance;禁止写成「invoke `/mys
|
|
|
24
24
|
| 主题 | `architecture` → §3;`database` → §4.4;`api` → §4.5;`frontend` → §4.6(有 UI;含 IDE skills/rules 落地扫描) |
|
|
25
25
|
| 上限 | 每主题约定文件最多 **3**(helper);前端专题合计约定+IDE skills/rules ≤ **5**(见 `frontend-guidance.md` §3) |
|
|
26
26
|
|
|
27
|
-
另:前端详设结构由 `prompts/approval/frontend-guidance.md`
|
|
27
|
+
另:前端详设结构由 `prompts/approval/frontend-guidance.md` 驱动;接口/RPC 可生成契约由 **`prompts/approval/api-guidance.md`** 驱动(分层 L2/L3/L4、RPC 锁名、proto/OpenAPI 包)。与 DB 的 `database-guidance.md` 对称。
|
|
28
|
+
|
|
29
|
+
**分片生成(非 trivial §4)**:`prompts/approval/segmented-generation.md` + `templates/approval-index.yaml`;Map 写 `approval/parts/`,Reduce 用 `specflow approval assemble`(禁止 LLM 拼接)。
|
|
28
30
|
|
|
29
31
|
```yaml
|
|
30
32
|
# specflow/config.yaml(可选,优先于自动探测)
|
|
@@ -103,6 +103,37 @@ uiInScope=<yes|no>, stackCoverage=<complete|partial|missing>)."
|
|
|
103
103
|
|
|
104
104
|
---
|
|
105
105
|
|
|
106
|
+
## Stage 1b: Multi-Repo Intake (多仓)
|
|
107
|
+
|
|
108
|
+
**Trigger**: user **自然语言** specifies multiple repos (talos + talos-web + worker), workset
|
|
109
|
+
with multiple planning roots, or cross-repo design/tasks.
|
|
110
|
+
|
|
111
|
+
Read **`prompts/approval/multi-repo-guidance.md`**.
|
|
112
|
+
|
|
113
|
+
1. Resolve `multi_repo.repos[]` — `id`, `label`, `role`, **per-repo `change`**, optional `root_hint`.
|
|
114
|
+
2. **Read four refined artifacts from each repo** before Pass 1.
|
|
115
|
+
3. **User gate (hard)** — ask before writing any approval file:
|
|
116
|
+
|
|
117
|
+
```text
|
|
118
|
+
跨 N 个仓库,审批技术文档如何产出?
|
|
119
|
+
A) 一份合订 (unified) — 单份 approval.md
|
|
120
|
+
B) 多份分仓 (per_repo) — 每仓各自 approval.md
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
4. If **A** — ask **主仓** (stores `approval.md` + `approval/` workspace):
|
|
124
|
+
|
|
125
|
+
```text
|
|
126
|
+
合订文档存放在哪个主仓? (talos / talos-web / talos-worker / …)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
5. Write `approval/index.yaml` → `multi_repo` with user choices + `outputs`.
|
|
130
|
+
6. **Unified**: Stage 12 workspace + `specflow approval assemble` run in **primary** planning root only.
|
|
131
|
+
7. **Per_repo**: repeat Stage 12 + assemble **per repo** (scope = that repo only).
|
|
132
|
+
|
|
133
|
+
Single-repo → skip (`multi_repo.enabled=false`).
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
106
137
|
## Gate: Tech Stack Intake (0→1 / 四件套缺选型)
|
|
107
138
|
|
|
108
139
|
**Trigger** (any):
|
|
@@ -344,8 +375,11 @@ Order and hard requirements (from `generate.md` §4.1–4.9):
|
|
|
344
375
|
(2) `database-guidance.md` + SpecFlow guidance pack / `dbStack`; (3) live DDL/anchors.
|
|
345
376
|
Priority: **project + live DDL > SpecFlow pack > LLM**. §4.4.1 must list 项目约定 + DB 技能.
|
|
346
377
|
**Outline**: only `4.4.1–4.4.4` + `##### table`; DDL/字段说明/JSON = `**bold**`.
|
|
347
|
-
5. **接口设计** — Before §4.5: `project-conventions-guidance.md` `topic=api
|
|
348
|
-
|
|
378
|
+
5. **接口设计** — Before §4.5: (1) `project-conventions-guidance.md` `topic=api`;
|
|
379
|
+
(2) **`api-guidance.md`** — 契约面分层(L2/L3/L4 各独立 `In`)、RPC 锁名、proto/OpenAPI 可生成包;
|
|
380
|
+
(3) live proto/OpenAPI/anchors.
|
|
381
|
+
Then inventory + **each surface** fields + examples + errors + **Proto 草案**(新增 RPC).
|
|
382
|
+
**禁止** L2 HTTP 详写 + L4「内部调用」stub; **禁止**「暂定/如/实现时」RPC 名。
|
|
349
383
|
**Outline**: only `4.5.1–4.5.3` + `##### In`; 请求体字段/示例/错误 = `**bold**`.
|
|
350
384
|
6. **前端 / UI** — When `uiInScope=yes`: before §4.6:
|
|
351
385
|
(1) `project-conventions-guidance.md` `topic=frontend`;
|
|
@@ -418,10 +452,74 @@ Each dimension produces a verdict (`READY` | `NEEDS REFINEMENT` | `BLOCKED`) wit
|
|
|
418
452
|
|
|
419
453
|
---
|
|
420
454
|
|
|
421
|
-
## Stage 12: Generate approval.md
|
|
455
|
+
## Stage 12: Generate approval.md (Index → Map → CLI Reduce)
|
|
456
|
+
|
|
457
|
+
Follow `generate.md` Part E (structure) and Part F (segmented pipeline + anti-lazy rules).
|
|
458
|
+
Read `prompts/approval/segmented-generation.md` when `mode=segmented`.
|
|
459
|
+
|
|
460
|
+
**Output artifact**: `specflow/changes/<name>/approval.md`
|
|
461
|
+
**Workspace** (segmented): `specflow/changes/<name>/approval/` — `index.yaml`, `analysis.json`, `parts/*.md`, `manifest.json`
|
|
462
|
+
|
|
463
|
+
### 12.0 Mode selection (before writing)
|
|
464
|
+
|
|
465
|
+
| Trigger | Mode |
|
|
466
|
+
|---------|------|
|
|
467
|
+
| `tables > 2` OR `interfaces > 3` OR `pages > 2` OR user opted §5 | **segmented** (mandatory) |
|
|
468
|
+
| Else | ask user: **segmented** (recommended) or **monolithic** |
|
|
469
|
+
|
|
470
|
+
Copy `templates/approval-index.yaml` → `approval/index.yaml`; fill `tables[]` / `interfaces[]` / `pages[]` with stable ids and `part` paths **before** any Map batch.
|
|
471
|
+
|
|
472
|
+
**Anti-lazy (hard)**: when segmented, **never** one-shot the full `approval.md`; **never** stub parts (`TODO` / `待补充` / empty); **always** finish with CLI Reduce (12d).
|
|
473
|
+
|
|
474
|
+
### 12a Index + Skeleton
|
|
475
|
+
|
|
476
|
+
Write **first** (Gate depends on this):
|
|
477
|
+
|
|
478
|
+
1. `approval/index.yaml` — full `parts_order`, entity inventory, `optional.s5/s7/s8`, `mode`
|
|
479
|
+
2. `approval/analysis.json` — Pass 1–7 + quality + implementability summaries
|
|
480
|
+
3. `approval/parts/` skeleton:
|
|
481
|
+
- `01-intro.md` … `03-architecture.md`
|
|
482
|
+
- `04-detail-core.md` (§4.1–4.3 only)
|
|
483
|
+
- `06-test.md`, `09-implementability.md`, `10-signoff.md`
|
|
422
484
|
|
|
423
|
-
|
|
424
|
-
|
|
485
|
+
Use `templates/approval-part.md` fragment header; parts use `###`/`####` only — **no** foreign `## N.` headings.
|
|
486
|
+
|
|
487
|
+
### 12b Map Append (batched §4.4 / §4.5 / §4.6 / §4.7–§4.9)
|
|
488
|
+
|
|
489
|
+
Per batch, Read only: `index.yaml`, `analysis.json` digests, design/tasks/spec snippets for batch ids, lazy-loaded conventions (caps per topic), anchor files.
|
|
490
|
+
|
|
491
|
+
Respect `index.batching.*_per_call`. After each part: update `approval/manifest.json` entry.
|
|
492
|
+
|
|
493
|
+
Minimums (no shortcuts — see Part E hard rules 9–10, 18–20):
|
|
494
|
+
|
|
495
|
+
- §4.4 batch: DDL + 字段说明 + 本迭代用法 per table; G3/G4 when applicable
|
|
496
|
+
- §4.5 batch: **Read `api-guidance.md`**; one `In` per contract surface (L2 Worker HTTP / L3 RPC / L4 client RPC — no collapsing)
|
|
497
|
+
- meta + fields + success examples + **failure example (G2)** + error table per interface (**含不变**)
|
|
498
|
+
- **新增 RPC**: frozen `Service.Method` + proto field numbers + `google.api.http` + Gateway registration + Worker OpenAPI pointer
|
|
499
|
+
- **禁止** 暂定/如/实现时 RPC; **禁止** L4 stub when L2 is fully written
|
|
500
|
+
- §4.6 batch (when `uiInScope`): IDE skills/rules scan first; page/route + states + G6; §4.5 `In` refs
|
|
501
|
+
|
|
502
|
+
### 12c Optional chapters
|
|
503
|
+
|
|
504
|
+
Only if user accepted **and** `optional.s5/s7/s8: true` in index:
|
|
505
|
+
|
|
506
|
+
- Insert `05-*` / `07-deploy` / `08-closed-loop` into `parts_order`
|
|
507
|
+
- §8: one table only (from analysis)
|
|
508
|
+
|
|
509
|
+
### 12d CLI Reduce (mandatory for segmented)
|
|
510
|
+
|
|
511
|
+
```bash
|
|
512
|
+
specflow approval check <change>
|
|
513
|
+
specflow approval assemble <change> --force
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
- `check` must pass with **zero errors** before assemble
|
|
517
|
+
- Reduce is **deterministic** — no LLM stitching
|
|
518
|
+
- Report final path: `specflow/changes/<name>/approval.md`
|
|
519
|
+
|
|
520
|
+
### Monolithic fast path
|
|
521
|
+
|
|
522
|
+
When user chose `mode: monolithic` and lightweight inventory: write `approval.md` directly **or** parts + single assemble. Same Part E quality bars apply.
|
|
425
523
|
|
|
426
524
|
Document chapter order (hard for included chapters):
|
|
427
525
|
|
|
@@ -436,7 +534,7 @@ Document chapter order (hard for included chapters):
|
|
|
436
534
|
9. §9 可实施性评估
|
|
437
535
|
10. §10 审批 — **仅人工签字栏**(无 AI 预审小节)
|
|
438
536
|
|
|
439
|
-
Key rules:
|
|
537
|
+
Key rules (all modes):
|
|
440
538
|
|
|
441
539
|
- §1 truthful; Journey traces to §5 if present else named specs; Non-Goals with reasons.
|
|
442
540
|
- **§2.2 技术选型**: required for greenfield or when four artifacts lack needed stack
|
|
@@ -461,9 +559,11 @@ Present a summary to the user (**chat only** — these are not document chapters
|
|
|
461
559
|
- Design quality verdict (PASS / WARNING / FAIL)
|
|
462
560
|
- Implementability overall verdict (READY / NEEDS REFINEMENT / BLOCKED)
|
|
463
561
|
- **AI pre-approval recommendation** (建议批准 / 有条件批准 / 退回 refine / 拒绝) + 理由
|
|
464
|
-
- The path where `approval.md` will be written
|
|
562
|
+
- The path where `approval.md` will be written (**all paths** if `multi_repo.document_mode=per_repo`)
|
|
563
|
+
|
|
564
|
+
If `multi_repo.enabled`, confirm document mode + primary repo (unified) are already in `index.yaml`.
|
|
465
565
|
|
|
466
|
-
Ask explicitly about **optional chapters
|
|
566
|
+
Ask explicitly about **optional chapters** (record in `approval/index.yaml` → `optional.s5/s7/s8`):
|
|
467
567
|
|
|
468
568
|
```text
|
|
469
569
|
是否将以下章节写入审批文档?
|
|
@@ -472,20 +572,36 @@ Ask explicitly about **optional chapters**:
|
|
|
472
572
|
- §8 闭环性检查表: 要 / 不要
|
|
473
573
|
```
|
|
474
574
|
|
|
575
|
+
If not forced segmented, ask generation mode:
|
|
576
|
+
|
|
577
|
+
```text
|
|
578
|
+
审批文档生成方式:
|
|
579
|
+
- segmented (推荐): 分片写入 approval/parts/,CLI 拼接 approval.md
|
|
580
|
+
- monolithic: 一次性写入 approval.md(仅轻量变更)
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
**After Stage 12a**, show index inventory (tables / interfaces / pages) and ask:
|
|
584
|
+
|
|
585
|
+
> "确认 index 与可选章节后继续 Map 生成?"
|
|
586
|
+
|
|
587
|
+
Do NOT run 12b until index + optional choices are confirmed.
|
|
588
|
+
|
|
589
|
+
After 12b/12c, run `specflow approval check` and fix all errors before asking final write.
|
|
590
|
+
|
|
475
591
|
Then ask:
|
|
476
592
|
|
|
477
|
-
> "
|
|
593
|
+
> "确认拼接并写入 `specflow/changes/<name>/approval.md`?"
|
|
478
594
|
|
|
479
|
-
Do NOT
|
|
480
|
-
If the user wants changes to the assessment, re-run the relevant Pass or dimension and
|
|
481
|
-
update the summary before re-asking.
|
|
595
|
+
Do NOT assemble until the user confirms (unless they already confirmed end-to-end generation).
|
|
482
596
|
|
|
483
597
|
On confirmation:
|
|
484
598
|
|
|
485
|
-
1.
|
|
486
|
-
2.
|
|
487
|
-
3.
|
|
488
|
-
4.
|
|
599
|
+
1. **Segmented**: `specflow approval assemble <change> --force` — do not paste assembled markdown manually.
|
|
600
|
+
2. **Monolithic**: write `approval.md` directly (or parts + assemble).
|
|
601
|
+
3. Include only optional chapters the user accepted.
|
|
602
|
+
4. Do **not** include「AI 预审建议」in the file.
|
|
603
|
+
5. Do NOT change `phase` — it remains `refined`.
|
|
604
|
+
6. Report the file path and next-step suggestions.
|
|
489
605
|
|
|
490
606
|
---
|
|
491
607
|
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# specflow.approval.index/v1 — copy to specflow/changes/<name>/approval/index.yaml
|
|
2
|
+
schema: specflow.approval.index/v1
|
|
3
|
+
change: <change-name>
|
|
4
|
+
generated_at: 2026-08-26T12:00:00+08:00
|
|
5
|
+
mode: segmented
|
|
6
|
+
ui_in_scope: false
|
|
7
|
+
db_in_scope: true
|
|
8
|
+
api_in_scope: true
|
|
9
|
+
|
|
10
|
+
optional:
|
|
11
|
+
s5: false
|
|
12
|
+
s7: false
|
|
13
|
+
s8: false
|
|
14
|
+
|
|
15
|
+
parts_order:
|
|
16
|
+
- 01-intro
|
|
17
|
+
- 02-design-review
|
|
18
|
+
- 03-architecture
|
|
19
|
+
- 04-detail-core
|
|
20
|
+
- 04.4-data
|
|
21
|
+
- 04.5-api
|
|
22
|
+
- 04.7-logic
|
|
23
|
+
- 04.8-config
|
|
24
|
+
- 04.9-compat
|
|
25
|
+
- 06-test
|
|
26
|
+
- 09-implementability
|
|
27
|
+
- 10-signoff
|
|
28
|
+
|
|
29
|
+
design_points: [P1]
|
|
30
|
+
decisions: [D1]
|
|
31
|
+
|
|
32
|
+
tables: []
|
|
33
|
+
interfaces: []
|
|
34
|
+
pages: []
|
|
35
|
+
capabilities: []
|
|
36
|
+
|
|
37
|
+
batching:
|
|
38
|
+
tables_per_call: 3
|
|
39
|
+
interfaces_per_call: 3
|
|
40
|
+
pages_per_call: 3
|
|
41
|
+
capabilities_per_call: 1
|
|
42
|
+
|
|
43
|
+
conventions:
|
|
44
|
+
architecture: []
|
|
45
|
+
database: []
|
|
46
|
+
api: []
|
|
47
|
+
frontend: []
|
|
48
|
+
|
|
49
|
+
meta:
|
|
50
|
+
language: zh-CN
|
|
51
|
+
tech_stack: unknown
|
|
52
|
+
project_mode: brownfield
|
|
53
|
+
|
|
54
|
+
# 多仓时启用 (见 prompts/approval/multi-repo-guidance.md)
|
|
55
|
+
# multi_repo:
|
|
56
|
+
# enabled: true
|
|
57
|
+
# document_mode: unified # unified | per_repo — 用户确认后填写
|
|
58
|
+
# primary_repo: talos # unified 时必填
|
|
59
|
+
# repos:
|
|
60
|
+
# - id: talos
|
|
61
|
+
# label: 平台
|
|
62
|
+
# role: platform
|
|
63
|
+
# change: <change-name>
|
|
64
|
+
# - id: talos-web
|
|
65
|
+
# label: 控制台
|
|
66
|
+
# role: web
|
|
67
|
+
# change: <web-change-name>
|
|
68
|
+
# outputs:
|
|
69
|
+
# unified:
|
|
70
|
+
# repo: talos
|
|
71
|
+
# change: <change-name>
|
|
72
|
+
# path: specflow/changes/<change-name>/approval.md
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Approval part fragment — NOT a standalone document.
|
|
3
|
+
Written under specflow/changes/<name>/approval/parts/<part-id>.md
|
|
4
|
+
Assembled by: specflow approval assemble <change>
|
|
5
|
+
-->
|
|
6
|
+
|
|
7
|
+
<!-- part-id: <must match filename without .md> -->
|
|
8
|
+
<!-- index-ref: approval/index.yaml parts_order -->
|
|
9
|
+
|
|
10
|
+
<!-- FORBIDDEN in parts:
|
|
11
|
+
- Top-level "# 技术方案审批文档"
|
|
12
|
+
- Foreign chapter headings "## N." not owned by this part
|
|
13
|
+
- TODO / 待补充 / 此处省略 / 详见 design (without §ref)
|
|
14
|
+
- Empty or placeholder-only body
|
|
15
|
+
-->
|