@gordon.gan/specflow 1.7.0-beta → 1.8.0-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/README.md +4 -4
  2. package/dist/cli/commands/document-run.d.ts +84 -0
  3. package/dist/cli/commands/document-run.js +539 -0
  4. package/dist/cli/index.js +2 -2
  5. package/dist/core/artifact-language.js +11 -1
  6. package/dist/core/document/chapters.d.ts +6 -0
  7. package/dist/core/document/chapters.js +21 -0
  8. package/dist/core/document/coverage.d.ts +25 -0
  9. package/dist/core/document/coverage.js +49 -0
  10. package/dist/core/document/digests.d.ts +41 -0
  11. package/dist/core/document/digests.js +136 -0
  12. package/dist/core/document/engine.d.ts +92 -0
  13. package/dist/core/document/engine.js +487 -0
  14. package/dist/core/{approval → document}/forbidden-patterns.d.ts +4 -2
  15. package/dist/core/document/forbidden-patterns.js +33 -0
  16. package/dist/core/document/gates.d.ts +27 -0
  17. package/dist/core/document/gates.js +33 -0
  18. package/dist/core/document/index.d.ts +7 -0
  19. package/dist/core/document/index.js +7 -0
  20. package/dist/core/document/input-digest.d.ts +55 -0
  21. package/dist/core/document/input-digest.js +121 -0
  22. package/dist/core/document/input-features.d.ts +24 -0
  23. package/dist/core/document/input-features.js +112 -0
  24. package/dist/core/document/lint.d.ts +22 -0
  25. package/dist/core/document/lint.js +29 -0
  26. package/dist/core/document/llm.d.ts +35 -0
  27. package/dist/core/document/llm.js +27 -0
  28. package/dist/core/document/map.d.ts +46 -0
  29. package/dist/core/document/map.js +212 -0
  30. package/dist/core/document/outline.d.ts +26 -0
  31. package/dist/core/document/outline.js +128 -0
  32. package/dist/core/document/paths.d.ts +23 -0
  33. package/dist/core/document/paths.js +31 -0
  34. package/dist/core/document/profile-validator.d.ts +23 -0
  35. package/dist/core/document/profile-validator.js +127 -0
  36. package/dist/core/document/profiles.d.ts +23 -0
  37. package/dist/core/document/profiles.js +69 -0
  38. package/dist/core/document/render.d.ts +19 -0
  39. package/dist/core/document/render.js +97 -0
  40. package/dist/core/document/review.d.ts +42 -0
  41. package/dist/core/document/review.js +157 -0
  42. package/dist/core/document/scene-detect.d.ts +25 -0
  43. package/dist/core/document/scene-detect.js +121 -0
  44. package/dist/core/document/schemas.d.ts +949 -0
  45. package/dist/core/document/schemas.js +158 -0
  46. package/dist/integrations/shared/capability-evidence.js +4 -8
  47. package/dist/integrations/shared/command-catalog.js +1 -1
  48. package/dist/integrations/shared/parity-manifest.js +4 -8
  49. package/package.json +1 -1
  50. package/prompts/apply/phase-a-plan.md +1 -1
  51. package/prompts/document/map/acceptance.md +8 -0
  52. package/prompts/document/map/api-design.md +17 -0
  53. package/prompts/document/map/architecture.md +7 -0
  54. package/prompts/document/map/closed-loop.md +8 -0
  55. package/prompts/document/map/compat-migration.md +8 -0
  56. package/prompts/document/map/config-runtime.md +8 -0
  57. package/prompts/document/map/core-logic.md +8 -0
  58. package/prompts/document/map/data-model.md +17 -0
  59. package/prompts/document/map/deploy.md +8 -0
  60. package/prompts/document/map/fix.md +7 -0
  61. package/prompts/document/map/goal.md +7 -0
  62. package/prompts/document/map/impact.md +7 -0
  63. package/prompts/document/map/implementability.md +8 -0
  64. package/prompts/document/map/mvp-boundary.md +7 -0
  65. package/prompts/document/map/non-goals.md +7 -0
  66. package/prompts/document/map/regression.md +7 -0
  67. package/prompts/document/map/reproduce.md +7 -0
  68. package/prompts/document/map/requirement.md +7 -0
  69. package/prompts/document/map/root-cause.md +7 -0
  70. package/prompts/document/map/signoff.md +8 -0
  71. package/prompts/document/map/tech-selection.md +17 -0
  72. package/prompts/document/map/test-strategy.md +7 -0
  73. package/prompts/document/map/ui-design.md +18 -0
  74. package/prompts/document/outline/general.md +37 -0
  75. package/prompts/document/review/ai-review.md +56 -0
  76. package/prompts/explore/explore-session.md +1 -1
  77. package/prompts/propose/design-draft.md +1 -1
  78. package/prompts/propose/proposal.md +1 -1
  79. package/prompts/propose/specs.md +1 -1
  80. package/prompts/propose/tasks-draft.md +1 -1
  81. package/prompts/refine/design-output.md +1 -1
  82. package/prompts/refine/update-artifacts.md +2 -0
  83. package/prompts/shared/artifact-language.md +13 -0
  84. package/skills/specflow-document/SKILL.md +124 -0
  85. package/templates/document/chapters/acceptance.yaml +16 -0
  86. package/templates/document/chapters/api-design.yaml +24 -0
  87. package/templates/document/chapters/architecture.yaml +18 -0
  88. package/templates/document/chapters/closed-loop.yaml +22 -0
  89. package/templates/document/chapters/compat-migration.yaml +17 -0
  90. package/templates/document/chapters/config-runtime.yaml +16 -0
  91. package/templates/document/chapters/core-logic.yaml +16 -0
  92. package/templates/document/chapters/data-model.yaml +25 -0
  93. package/templates/document/chapters/deploy.yaml +18 -0
  94. package/templates/document/chapters/fix.yaml +18 -0
  95. package/templates/document/chapters/goal.yaml +17 -0
  96. package/templates/document/chapters/impact.yaml +16 -0
  97. package/templates/document/chapters/implementability.yaml +22 -0
  98. package/templates/document/chapters/mvp-boundary.yaml +20 -0
  99. package/templates/document/chapters/non-goals.yaml +17 -0
  100. package/templates/document/chapters/regression.yaml +16 -0
  101. package/templates/document/chapters/reproduce.yaml +16 -0
  102. package/templates/document/chapters/requirement.yaml +18 -0
  103. package/templates/document/chapters/root-cause.yaml +18 -0
  104. package/templates/document/chapters/signoff.yaml +15 -0
  105. package/templates/document/chapters/tech-selection.yaml +20 -0
  106. package/templates/document/chapters/test-strategy.yaml +20 -0
  107. package/templates/document/chapters/ui-design.yaml +22 -0
  108. package/templates/document/profiles/0to1.yaml +12 -0
  109. package/templates/document/profiles/approve.yaml +22 -0
  110. package/templates/document/profiles/bugfix.yaml +10 -0
  111. package/templates/document/profiles/feature.yaml +11 -0
  112. package/dist/cli/commands/approval-assemble.d.ts +0 -64
  113. package/dist/cli/commands/approval-assemble.js +0 -408
  114. package/dist/core/approval/assemble.d.ts +0 -10
  115. package/dist/core/approval/assemble.js +0 -384
  116. package/dist/core/approval/bundle.d.ts +0 -9
  117. package/dist/core/approval/bundle.js +0 -172
  118. package/dist/core/approval/forbidden-patterns.js +0 -37
  119. package/dist/core/approval/index-schema.d.ts +0 -676
  120. package/dist/core/approval/index-schema.js +0 -193
  121. package/dist/core/approval/index.d.ts +0 -12
  122. package/dist/core/approval/index.js +0 -9
  123. package/dist/core/approval/lint.d.ts +0 -10
  124. package/dist/core/approval/lint.js +0 -302
  125. package/dist/core/approval/paths.d.ts +0 -13
  126. package/dist/core/approval/paths.js +0 -43
  127. package/dist/core/approval/pipeline.d.ts +0 -28
  128. package/dist/core/approval/pipeline.js +0 -146
  129. package/dist/core/approval/playbook-schema.d.ts +0 -182
  130. package/dist/core/approval/playbook-schema.js +0 -51
  131. package/dist/core/approval/render.d.ts +0 -20
  132. package/dist/core/approval/render.js +0 -210
  133. package/dist/core/approval/review-pack.d.ts +0 -26
  134. package/dist/core/approval/review-pack.js +0 -205
  135. package/dist/core/approval/types.d.ts +0 -223
  136. package/dist/core/approval/types.js +0 -1
  137. package/prompts/approval/acp-pipeline.md +0 -104
  138. package/prompts/approval/ai-review.md +0 -145
  139. package/prompts/approval/api-guidance.md +0 -179
  140. package/prompts/approval/database-guidance.md +0 -105
  141. package/prompts/approval/frontend-guidance.md +0 -249
  142. package/prompts/approval/generate.md +0 -1583
  143. package/prompts/approval/multi-repo-guidance.md +0 -238
  144. package/prompts/approval/project-conventions-guidance.md +0 -171
  145. package/prompts/approval/runtime-guidance.md +0 -64
  146. package/prompts/approval/segmented-generation.md +0 -157
  147. package/skills/specflow-approval/SKILL.md +0 -663
  148. package/templates/approval-index.yaml +0 -93
  149. package/templates/approval-part.md +0 -15
  150. package/templates/approval-playbook.yaml +0 -28
  151. package/templates/approval.md +0 -261
@@ -1,238 +0,0 @@
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) 一份合订视图 (bundle) — 各仓 per_repo 真源 + CLI bundle 只读合订 (**推荐**)
73
- B) 多份分仓 (per_repo) — 每仓各自 approval.md(默认 Map 模式)
74
- C) 一份 LLM 合订 (legacy unified) — 仅当用户明确要求且无 bundle;不推荐
75
-
76
- 请选择 A、B 或 C。
77
- ```
78
-
79
- ### 2.1 Bundle(推荐 — A)
80
-
81
- **真源**: 各仓 **per_repo** `approval.md` + `approval/parts/`(ACP Map 分片)。
82
-
83
- **只读合订**: 主仓 `approval-playbook.yaml` + `specflow approval bundle <primary.change>` → `approval-unified.md`(**无 LLM 合并**)。
84
-
85
- 再询问主仓:
86
-
87
- ```text
88
- 合订 playbook 与 bundle 输出存放在哪个主仓?
89
- 1) talos (平台)
90
- 2) talos-web (控制台)
91
-
92
- ```
93
-
94
- **硬规则**:
95
-
96
- - `multi_repo.document_mode: per_repo`
97
- - `multi_repo.bundle.enabled: true`
98
- - `multi_repo.primary_repo: <id>` — playbook 与 bundle 输出路径
99
- - 各仓独立 Stage 12 + assemble;**全部 assemble 通过后** 在主仓执行 bundle
100
- - `acp.pipeline: acp/v2` 写入 `index.yaml`
101
-
102
- ```yaml
103
- multi_repo:
104
- document_mode: per_repo
105
- primary_repo: talos
106
- bundle:
107
- enabled: true
108
- output: approval-unified.md
109
- outputs:
110
- per_repo: [ …各仓路径… ]
111
- bundle:
112
- repo: talos
113
- change: scenario-job-compile
114
- path: specflow/changes/scenario-job-compile/approval-unified.md
115
- ```
116
-
117
- ### 2.2 Per-repo only(B)
118
-
119
- 见 §2.3;`bundle.enabled: false`。
120
-
121
- ### 2.3 Legacy unified LLM 合订(C — 不推荐)
122
-
123
- 仅在用户 **明确要求** 且拒绝 bundle 时使用。再询问主仓:
124
-
125
- ```text
126
- 合订文档存放在哪个主仓?(approval.md 与 approval/ 工作区写在该仓 change 目录下)
127
- ```
128
-
129
- **硬规则**:
130
-
131
- - `multi_repo.document_mode: unified`
132
- - `multi_repo.primary_repo: <id>` **必填**
133
- - **工作区路径**(分片模式):
134
- - `specflow/changes/<primary.change>/approval/index.yaml`
135
- - `specflow/changes/<primary.change>/approval/parts/*.md`
136
- - 产出:`specflow/changes/<primary.change>/approval.md`
137
- - CLI:`specflow approval assemble <primary.change>` **在主仓规划根**执行
138
- - 文档 §1.2 / §2.3 / 附录 B **必须** 按仓分表;Pass 6 锚点 **分仓列举**
139
- - 合订 **不是** 只写主仓 design;须合并各仓 specs/design/tasks 的跨端语义
140
-
141
- 写入 `multi_repo.outputs.unified`:
142
-
143
- ```yaml
144
- outputs:
145
- unified:
146
- repo: talos
147
- change: scenario-job-compile
148
- path: specflow/changes/scenario-job-compile/approval.md
149
- ```
150
-
151
- ### 2.4 Per-repo(B 详情)
152
-
153
- **硬规则**:
154
-
155
- - `multi_repo.document_mode: per_repo`
156
- - **每个** `repos[]` 条目独立:
157
- - 在该仓 `specflow/changes/<repo.change>/approval/`(分片)或 `approval.md`(单体)
158
- - 内容 **仅** 本仓 scope;交叉引用用「见 `<other-repo>` approval §x」
159
- - 各仓分别 `specflow approval assemble <repo.change>`(若在主仓 CLI,需 `--store` 或 cd 到该根)
160
- - **禁止**只在主仓写一份然后复制到其它仓
161
-
162
- 写入 `multi_repo.outputs.per_repo[]`:
163
-
164
- ```yaml
165
- outputs:
166
- per_repo:
167
- - repo: talos
168
- change: scenario-job-compile
169
- path: specflow/changes/scenario-job-compile/approval.md
170
- - repo: talos-web
171
- change: web-scenario-cases
172
- path: specflow/changes/web-scenario-cases/approval.md
173
- ```
174
-
175
- ---
176
-
177
- ## 3. Analysis & Map 上下文
178
-
179
- | 模式 | Read 范围 | index 库存 |
180
- |------|-----------|------------|
181
- | unified | 各仓四件套 + 各仓锚点 + 各仓约定 | `interfaces/pages/tables` 带 `repo` 字段(推荐) |
182
- | per_repo | **当前仓**四件套 + 本仓锚点 | 仅本仓实体 |
183
-
184
- **Unified 分片建议**:
185
-
186
- - `02-design-review` — 三仓决策表
187
- - `04.5-api` — 按 `repo` 或 L1/L2/L3/L4 分批;Worker 切片须 Read `api-guidance.md` + worker OpenAPI 路径
188
- - `04.6-*` — 仅 `ui_in_scope` 且 web 仓
189
- - 附录 B — 按仓允许/禁止路径
190
-
191
- **Inventory 扩展**(可选列):
192
-
193
- ```yaml
194
- interfaces:
195
- - id: I4
196
- short: 逐步上报
197
- change: scenario-job-compile
198
- part: 04.5-api-worker
199
- repo: talos-worker
200
- ```
201
-
202
- ---
203
-
204
- ## 4. Document header (unified)
205
-
206
- 合订 `approval.md` 头部 **必须** 声明:
207
-
208
- ```markdown
209
- > **覆盖变更(多仓合订,主仓: talos)**:
210
- > - 平台 `talos/scenario-job-compile`
211
- > - 控制台 `talos-web/web-scenario-cases`
212
- > - Worker `talos-worker/scenario-execution`
213
- > **存放路径**: `specflow/changes/scenario-job-compile/approval.md`
214
- ```
215
-
216
- ---
217
-
218
- ## 5. Hub / Federated 注意
219
-
220
- - Hub change id 可与 Spoke change id **同名或不同**;`multi_repo.repos[].change` 用 **各规划根内真实目录名**。
221
- - Hub 合同摘要可读 `--store`;Spoke approval **不**替代 Hub archive。
222
- - `coordination.yaml`(若有)可 Read;无则 chat 列出各仓 phase。
223
-
224
- ---
225
-
226
- ## 6. 自检
227
-
228
- - [ ] 用户已选 unified **或** per_repo
229
- - [ ] unified → `primary_repo` 已选且工作区在该仓
230
- - [ ] per_repo → 每仓输出路径已写入 `outputs.per_repo`
231
- - [ ] 各仓四件套已 Read;非主仓内容已进合订正文或分仓文档
232
- - [ ] Gate 摘要中列出 **所有** 将写入的 `approval.md` 路径
233
-
234
- ---
235
-
236
- ## 7. 与单仓关系
237
-
238
- `multi_repo.enabled=false` 时忽略本章;`change` 字段为当前规划根 change,行为与旧版一致。
@@ -1,171 +0,0 @@
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、通道;然后 **`api-guidance.md`**(分层、RPC 锁名、proto 可生成包) |
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
- - 贴合项目 → **优先级写死**,并要求总则可核对来源。
@@ -1,64 +0,0 @@
1
- # Approval · Runtime Semantics Guidance (optional domain pack)
2
-
3
- > **Optional** — load only when the change design touches async execution, leases, retries,
4
- > cancellation, LWW/idempotency keys, or result-ingest validation.
5
- >
6
- > **Not** part of default Stage 12e checklist. Use when analysis/design mentions these topics;
7
- > then add checks from §2 to AI review findings for **this change only**.
8
-
9
- ---
10
-
11
- ## 1. When to load
12
-
13
- | Signal in design/analysis | Action |
14
- |---------------------------|--------|
15
- | Job lease, reclaim, retry, duplicate execution | §1.1 |
16
- | User/system cancel, abort, teardown | §1.2 |
17
- | Step/job status enum vs ingest validator | §1.3 |
18
- | None of the above | **Skip this file** |
19
-
20
- ---
21
-
22
- ## 2. Mandatory decisions (pick one per topic — when in scope)
23
-
24
- ### 2.1 Retry / reclaim vs accumulated state
25
-
26
- When the same execution key can run again, document how prior partial state is handled:
27
-
28
- | Option | Write in approval |
29
- |--------|-------------------|
30
- | **A wipe** | Clear prior results before re-run |
31
- | **B epoch/version** | Reads/writes scoped by epoch or version |
32
- | **C no retry** | Disable retry for this execution type |
33
-
34
- **Hard**: add decision row + §4 scenario + testable AC. **Forbidden**: leave unspecified when retry exists in design.
35
-
36
- ### 2.2 Cancel / abort
37
-
38
- When cancel is in scope:
39
-
40
- - Document abort behavior (in-flight work, teardown, partial commit)
41
- - Terminal status for cancelled runs
42
- - §4.3 sequence for cancel path
43
-
44
- ### 2.3 Status ingest / validator alignment
45
-
46
- When external ingest validates status values:
47
-
48
- - Document the **closed** allowed set
49
- - **Forbidden**: doc lists values outside validator unless same iteration changes validator
50
-
51
- ---
52
-
53
- ## 3. AI review hook (when loaded)
54
-
55
- Add targeted findings (category `runtime_semantics`) — do not apply to changes without these topics.
56
-
57
- ```yaml
58
- design_points: [P<n>-retry-policy, P<n>-cancel]
59
- acp:
60
- review:
61
- enabled: true
62
- ```
63
-
64
- Cross-links: `api-guidance.md` (contract layers), `ai-review.md` (generic R9 unclosed branches).
@@ -1,157 +0,0 @@
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 finalize <change>`(或 debug:`check` / `assemble`)。
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
- 12e AI Review → fix parts; review-result.json + part_hashes
28
- 12f Finalize → specflow approval finalize <change>
29
- ```
30
-
31
- **Never** skip 12d. **Never** paste assembled markdown from memory instead of running CLI.
32
-
33
- ---
34
-
35
- ## 2. Anti-lazy rules (Map — LLM MUST NOT)
36
-
37
- | # | Forbidden | Required instead |
38
- |---|-----------|------------------|
39
- | L1 | One-shot full `approval.md` when `mode=segmented` | Write parts; assemble via CLI |
40
- | L2 | Empty part, `< 20` chars, or only HTML comments | Full section content per generate.md |
41
- | L3 | `TODO` / `待补充` / `此处省略` / bare `TBD` | Concrete text or `[待 refine 澄清: <元素>]` with reason |
42
- | L4 | `详见 design/tasks` without §/In/Page id | Cross-ref `§4.5 I2` / `Page·列表` / `P1` |
43
- | L5 | Invent new table/interface/page ids not in index | Update index.yaml first, then write part |
44
- | L6 | Skip §4.4 DDL/字段表/失败示例 because "same as design" | Minimum per G2–G6; **不变**仍须完整 §4.5 |
45
- | L6b | L2 HTTP only +「内部 I7」stub; or L4 one-liner | **分层** L2/L3/L4 各 `In`; `api-guidance.md` §1 |
46
- | L6c | RPC「暂定/如/实现时」 | **冻结**名 + proto 字段号; `api-guidance.md` §2–§3 |
47
- | L7 | Skip IDE skills/rules scan for §4.6 | frontend-guidance.md §3 before Map |
48
- | L8 | Paste skill/rule bodies verbatim | Readable Chinese + path in §4.6.1 table |
49
- | L9 | Write `## 4.` or foreign `## N.` in parts | Parts use `###`/`####`/`#####` only; CLI injects `## 4` |
50
- | L10 | Mark part `ok` without `specflow approval check` passing | Run check; fix errors; then assemble |
51
-
52
- ---
53
-
54
- ## 3. Stage 12a — Index + Skeleton
55
-
56
- **Write first:**
57
-
58
- 1. `approval/index.yaml` — full `parts_order`, all `tables[]`/`interfaces[]`/`pages[]` with `part` paths
59
- 2. `approval/analysis.json` — Pass 1–7 + quality + implementability (chat-only fields ok)
60
- 3. Parts (minimum):
61
- - `01-intro.md` … `03-architecture.md`
62
- - `04-detail-core.md` (§4.1–4.3 only)
63
- - `06-test.md`, `09-implementability.md`, `10-signoff.md` (may be stub-length only for structure in 12a, fill before assemble)
64
-
65
- **Chat gate:** show table/interface/page list from index; ask user to confirm before 12b.
66
-
67
- ---
68
-
69
- ## 4. Stage 12b — Map Append
70
-
71
- For each batch, **Read only**:
72
-
73
- - `approval/index.yaml`
74
- - `approval/analysis.json` (verdicts, not full Pass essays)
75
- - design/tasks/specs **snippets** for this batch's ids
76
- - lazy-loaded conventions (per topic caps)
77
- - anchor files for this batch (Pass 6 depth: file only)
78
-
79
- **Batching:** use `index.batching.*_per_call`. One part file per batch unit OR per index `part` field.
80
-
81
- **After each part write:** update `approval/manifest.json` part entry (`status: draft|ok`).
82
-
83
- ### §4.4 part minimum (per table batch)
84
-
85
- - 4.4.1 row in batch leader file if first batch
86
- - ER if new entities
87
- - per-table: CREATE TABLE + 字段说明 + 本迭代用法
88
- - G3/G4 when applicable
89
-
90
- ### §4.5 part minimum (per interface)
91
-
92
- - Run **`api-guidance.md`** before batch
93
- - **One `In` per contract surface** (L2 Worker HTTP / L3 RPC+http / L4 client RPC) — no B2-style collapse
94
- - meta + fields + success req/resp + **failure example (G2)** + error table (**含不变**)
95
- - **新增/改 HTTP binding**: `**Proto 草案**` block — frozen RPC name, field numbers, `google.api.http`, Gateway registration, Worker OpenAPI path
96
- - HTTP examples for L2: **all** required work auth headers (not body-only)
97
- - **Forbidden**: 暂定 / 如 XxxRpc / 实现时命名 / 内部经 I7 一行代替 L4 详设
98
-
99
- ### §4.6 part minimum (per page)
100
-
101
- - route + components + states + ≥1 of 空/加载/错态 (G6) + §4.5 `In` refs
102
-
103
- ---
104
-
105
- ## 5. Stage 12c — Optional chapters
106
-
107
- Only if user opted in AND `optional.s5/s7/s8: true` in index:
108
-
109
- - Insert `05-*` / `07-deploy` / `08-closed-loop` into `parts_order` at correct positions
110
- - §8: **one table only** (from analysis.json)
111
-
112
- ---
113
-
114
- ## 6. Stage 12e–12f — AI Review + Finalize
115
-
116
- **12e (in-session)**: Read `prompts/approval/ai-review.md`; fix parts; write `approval/review-result.json`.
117
-
118
- **12f (one CLI)**:
119
-
120
- ```bash
121
- specflow approval finalize <change> [--bundle] [--workspace-root <root>]
122
- ```
123
-
124
- - First run without `review-result.json`: pauses, writes `review-packet.json`, agent completes 12e, re-run finalize
125
- - Chains lint → review-check → check → assemble → bundle (when enabled)
126
- - Subcommands (`lint`, `assemble`, …) are for CI/debug only
127
-
128
- See **`prompts/approval/acp-pipeline.md`**.
129
-
130
- ---
131
-
132
- ## 7. manifest.json (agent-maintained)
133
-
134
- ```json
135
- {
136
- "schema": "specflow.approval.manifest/v1",
137
- "change": "<name>",
138
- "parts": [
139
- { "id": "01-intro", "path": "approval/parts/01-intro.md", "status": "ok" }
140
- ]
141
- }
142
- ```
143
-
144
- CLI overwrites manifest on successful assemble with sha256 sums.
145
-
146
- ---
147
-
148
- ## 8. Retry
149
-
150
- | Failure | Action |
151
- |---------|--------|
152
- | `lazy_part_content` on one part | Rewrite that part only; re-check |
153
- | `missing_part` | Write missing part or fix index |
154
- | `id_part_mismatch` | Align index `part` field with filename |
155
- | index wrong | Edit index.yaml; delete wrong parts; rerun affected Map batches |
156
-
157
- Do **not** rerun Pass 1–7 unless analysis is stale.