@gordon.gan/specflow 1.5.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 (135) 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/document/forbidden-patterns.d.ts +8 -0
  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 -6
  47. package/dist/integrations/shared/command-catalog.js +1 -1
  48. package/dist/integrations/shared/parity-manifest.js +4 -6
  49. package/package.json +2 -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/GUIDANCE_PACKS.md +1 -1
  85. package/skills/specflow-document/SKILL.md +124 -0
  86. package/templates/document/chapters/acceptance.yaml +16 -0
  87. package/templates/document/chapters/api-design.yaml +24 -0
  88. package/templates/document/chapters/architecture.yaml +18 -0
  89. package/templates/document/chapters/closed-loop.yaml +22 -0
  90. package/templates/document/chapters/compat-migration.yaml +17 -0
  91. package/templates/document/chapters/config-runtime.yaml +16 -0
  92. package/templates/document/chapters/core-logic.yaml +16 -0
  93. package/templates/document/chapters/data-model.yaml +25 -0
  94. package/templates/document/chapters/deploy.yaml +18 -0
  95. package/templates/document/chapters/fix.yaml +18 -0
  96. package/templates/document/chapters/goal.yaml +17 -0
  97. package/templates/document/chapters/impact.yaml +16 -0
  98. package/templates/document/chapters/implementability.yaml +22 -0
  99. package/templates/document/chapters/mvp-boundary.yaml +20 -0
  100. package/templates/document/chapters/non-goals.yaml +17 -0
  101. package/templates/document/chapters/regression.yaml +16 -0
  102. package/templates/document/chapters/reproduce.yaml +16 -0
  103. package/templates/document/chapters/requirement.yaml +18 -0
  104. package/templates/document/chapters/root-cause.yaml +18 -0
  105. package/templates/document/chapters/signoff.yaml +15 -0
  106. package/templates/document/chapters/tech-selection.yaml +20 -0
  107. package/templates/document/chapters/test-strategy.yaml +20 -0
  108. package/templates/document/chapters/ui-design.yaml +22 -0
  109. package/templates/document/profiles/0to1.yaml +12 -0
  110. package/templates/document/profiles/approve.yaml +22 -0
  111. package/templates/document/profiles/bugfix.yaml +10 -0
  112. package/templates/document/profiles/feature.yaml +11 -0
  113. package/dist/cli/commands/approval-assemble.d.ts +0 -21
  114. package/dist/cli/commands/approval-assemble.js +0 -95
  115. package/dist/core/approval/assemble.d.ts +0 -10
  116. package/dist/core/approval/assemble.js +0 -391
  117. package/dist/core/approval/index-schema.d.ts +0 -473
  118. package/dist/core/approval/index-schema.js +0 -146
  119. package/dist/core/approval/index.d.ts +0 -4
  120. package/dist/core/approval/index.js +0 -3
  121. package/dist/core/approval/paths.d.ts +0 -8
  122. package/dist/core/approval/paths.js +0 -28
  123. package/dist/core/approval/types.d.ts +0 -120
  124. package/dist/core/approval/types.js +0 -1
  125. package/prompts/approval/api-guidance.md +0 -179
  126. package/prompts/approval/database-guidance.md +0 -105
  127. package/prompts/approval/frontend-guidance.md +0 -249
  128. package/prompts/approval/generate.md +0 -1498
  129. package/prompts/approval/multi-repo-guidance.md +0 -202
  130. package/prompts/approval/project-conventions-guidance.md +0 -171
  131. package/prompts/approval/segmented-generation.md +0 -151
  132. package/skills/specflow-approval/SKILL.md +0 -640
  133. package/templates/approval-index.yaml +0 -72
  134. package/templates/approval-part.md +0 -15
  135. package/templates/approval.md +0 -261
@@ -1,202 +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) 一份合订文档 (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,行为与旧版一致。
@@ -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,151 +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 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.