@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
@@ -4,7 +4,7 @@
4
4
 
5
5
  Generate a proposal document following the SpecFlow format. The proposal establishes WHY a change is needed and WHAT it affects.
6
6
 
7
- **Narrative language:** Follow the resolved `artifacts.language` for Why, What Changes, Impact, Capabilities prose, and success criteria. Keep change IDs, capability IDs, paths, commands, and code symbols unchanged.
7
+ **Narrative language:** Follow the resolved `artifacts.language` for Why, What Changes, Impact, Capabilities prose, and success criteria. Keep change IDs, capability IDs, paths, commands, and code symbols unchanged. zh-CN: 叙述简要;怎么做用 1. 2. 3.(见 `artifact-language.md`)。
8
8
 
9
9
  ## Process
10
10
 
@@ -27,7 +27,7 @@ Create one spec file per capability at `specflow/changes/<change-name>/specs/<ca
27
27
 
28
28
  **CRITICAL FORMAT — the specflow CLI parses this exact structure. Deviations will cause validation and archive failures.**
29
29
 
30
- **Narrative language:** Follow the resolved `artifacts.language` for all business content — requirement descriptions, scenario titles, and the text after `WHEN` / `THEN`. Protocol markers below stay exactly English. Do not emit English narrative when `zh-CN` is configured.
30
+ **Narrative language:** Follow the resolved `artifacts.language` for all business content — requirement descriptions, scenario titles, and the text after `WHEN` / `THEN`. Protocol markers below stay exactly English. Do not emit English narrative when `zh-CN` is configured. zh-CN: 叙述简要;怎么做用 1. 2. 3.(见 `artifact-language.md`)。
31
31
 
32
32
  Use `##` headers for delta operation sections. Use `###` for requirements. Use `####` for scenarios. Use `- **WHEN**` and `- **THEN**` bullet format for scenario steps.
33
33
 
@@ -31,7 +31,7 @@ This marker tells future readers (and the Apply Phase A prompt) that this docume
31
31
 
32
32
  2. **Each group contains 2 to 6 concrete checkbox items**
33
33
  - Format: `- [ ] N.M <action phrase>` where N is the group number and M is the item index within the group
34
- - Group titles and task descriptions MUST follow the resolved `artifacts.language` from Artifact Language Setup (zh-CN → Simplified Chinese; en → English). Keep paths, commands, code, and symbols unchanged. Do not default to English when `zh-CN` is configured, and do not mix narrative languages inside the same tasks.md.
34
+ - Group titles and task descriptions MUST follow the resolved `artifacts.language` from Artifact Language Setup (zh-CN → Simplified Chinese; en → English). Keep paths, commands, code, and symbols unchanged. Do not default to English when `zh-CN` is configured, and do not mix narrative languages inside the same tasks.md. zh-CN: 叙述简要;怎么做用 1. 2. 3.。
35
35
 
36
36
  3. **Items are concrete actions, not topics**
37
37
  - zh-CN good: "实现 searchNotes 纯函数"
@@ -4,7 +4,7 @@ Orchestration prompt for generating `design.md` from an approved proposal and de
4
4
 
5
5
  ## Overview
6
6
 
7
- The design document captures architectural decisions, technical approach, and risk assessment for a change. It bridges the gap between "what" (specs) and "how" (implementation plan).
7
+ The design document captures architectural decisions, technical approach, and risk assessment for a change. It bridges the gap between "what" (specs) and "how" (implementation plan). Follow `prompts/shared/artifact-language.md`. zh-CN: 叙述简要;怎么做用 1. 2. 3.。
8
8
 
9
9
  ## Prerequisites
10
10
 
@@ -75,6 +75,8 @@ Never proceed to writing without an explicit A/B/C choice from the user.
75
75
 
76
76
  ## Format Preservation Rules
77
77
 
78
+ zh-CN 叙述: 简要;怎么做用 1. 2. 3.(见 `prompts/shared/artifact-language.md`)。表格与协议标记不改结构。
79
+
78
80
  Each artifact type has format contracts that `specflow validate` and `specflow change
79
81
  archive` rely on. Violating them breaks downstream automation.
80
82
 
@@ -14,6 +14,7 @@ Before creating or rewriting any SpecFlow artifact:
14
14
  - text after protected `WHEN` / `THEN` markers
15
15
  - design Context, Goals, Decisions, Risks, Open Questions
16
16
  - task group titles and task descriptions (including Apply Phase A rewrites)
17
+ - explore.md and approval.md narrative
17
18
  4. Do **not** mix languages for that business content. Protocol markers and technical identifiers stay as written below; everything else follows the resolved language.
18
19
 
19
20
  ## Protected Protocol
@@ -34,3 +35,15 @@ Language selection never changes SpecFlow's machine-readable protocol. Keep thes
34
35
  Also preserve capability IDs, change names, file paths, commands, code, symbols, and established technical identifiers.
35
36
 
36
37
  When modifying an existing requirement, preserve its exact requirement name if delta matching depends on that name. Do not translate historical artifacts automatically; the configured language applies prospectively to content created or intentionally rewritten in the current workflow.
38
+
39
+ ## Narrative style (all artifacts)
40
+
41
+ Applies to **every** human-readable artifact: proposal, specs (after WHEN/THEN), design, tasks, explore, approval, apply Phase A rewrites.
42
+
43
+ When `artifacts.language` is `zh-CN`:
44
+
45
+ 1. **简要** — 一句一事;禁止套话与大段散文。
46
+ 2. **有条理** — 「怎么做 / 怎么走 / 怎么处理」写成 **1. 2. 3.**,每步一句。
47
+ 3. **不改结构** — 表格、Mermaid、DDL、HTTP 示例、协议标记保持原样。
48
+
49
+ `en`: keep prose brief; numbered steps for how-to. Same table/diagram exception.
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: specflow-document
3
+ description: "One-command scenario-based technical document generation (0→1 / bugfix / feature) using the IDE's model — run → Agent auto-generates → validate"
4
+ ---
5
+
6
+ # SpecFlow: Document
7
+
8
+ > **一键生成技术文档**:输入 `/specflow:document run <profile> --text "..."`,你用当前 IDE 模型自动完成全部生成,用户拿到 `document.md`。
9
+ > 引擎不调用第三方 LLM API——由你(Agent,运行在 IDE 模型上)完成需要 LLM 的步骤,`specflow document` 只做确定性校验与渲染。
10
+
11
+ ## Invocation(一键入口)
12
+
13
+ ```text
14
+ /specflow:document run [<0to1|bugfix|feature>] [--text "..."] [--design <file>] [--specs <file>] [--work-root <path>]
15
+ ```
16
+
17
+ Cursor: `specflow:document run <profile>`; Codex: `$specflow-document run <profile>`.
18
+
19
+ **收到 `run` 命令后,你必须自动完成全流程,不得中途停下来要求用户分步确认**(除非产物校验失败需要修正)。
20
+
21
+ ## 双模式
22
+
23
+ document 同时支持两种用法:
24
+
25
+ 1. **通用模式(现状)**:`run <0to1|bugfix|feature>` 从自然语言/素材生成方案文档。
26
+ 2. **审批模式(approval 能力)**:`document approve` 从**四件套**(proposal / specs / design / tasks)生成审批文档——含闭环性检查(7 Pass)、可实施性评估(7 维)、质量红线(G1-G6)、可选签字栏(`--signoff`)。多仓:`--workspace-root <root>` 扫描各仓四件套,每仓生成后主仓合订。
27
+
28
+ ```text
29
+ # 审批模式(单仓)
30
+ specflow document approve --change <name> --signoff
31
+ # 审批模式(多仓:各仓四件套 → 各自生成 → 主仓合订)
32
+ specflow document approve --workspace-root <root> --changes "platform:ch1,web:ch2"
33
+ ```
34
+
35
+ ## 场景自动识别(省略 profile 时)
36
+
37
+ 当用户 **未指定** `<profile>` 时:
38
+
39
+ 1. 先用你的模型理解自然语言,判断场景:
40
+ - **0to1**:从零做一个产品/项目("想做/做一个/新产品")
41
+ - **bugfix**:排查修复问题("报错/500/崩溃/挂了/异常")
42
+ - **feature**:给已有系统加功能("新增/加个/扩展")
43
+ 2. 若判断明确 → 直接使用该场景。
44
+ 3. 若**不确定**或信号冲突 → **向用户确认**(列出 0to1 / bugfix / feature 三个选项及含义),等待用户选择后再继续。
45
+ 4. 可选:`specflow document detect --text "..."` 查看确定性关键词识别的结果作为参考。
46
+
47
+ > 确定性规则(`detect`)是初判参考;你的模型理解更准。以模型判断 + 用户确认为准。
48
+
49
+ ## 一键执行流程(Agent 自动完成)
50
+
51
+ ```text
52
+ run [<profile>]
53
+ ├─ ① 规划 specflow document plan <profile> ... → 得到步骤清单 + workRoot
54
+ ├─ ② 生成 你(Agent)用当前模型按步骤逐项执行:
55
+ │ ├─ input-summary(多输入时)→ digests/input-summary.md
56
+ │ ├─ outline → outline.yaml(参考 prompts/document/outline/general.md)
57
+ │ ├─ 逐章填空 → chapters/<id>.md + entities.json(参考 prompts/document/map/<id>.md)
58
+ │ └─ review(可选)→ review-result.json(参考 prompts/document/review/ai-review.md)
59
+ └─ ③ 校验 specflow document validate --work-root <path>
60
+ └─ 通过 → 输出 document.md;失败 → 修正产物后重跑 validate
61
+ ```
62
+
63
+ ## ① 规划(plan)
64
+
65
+ ```text
66
+ specflow document plan <profile> [--text "..."] [--design <file>] [--specs <file>] [--work-root <path>]
67
+ ```
68
+
69
+ 引擎输出每个 Agent 步骤(id / 做什么 / 参考提示词 / 输入 / 输出 / 必做)。你按此清单执行即可。
70
+
71
+ ## ② 生成(你,用 IDE 模型执行)
72
+
73
+ 0. **读取项目规约(必须先做)**:生成任何章节前,先扫描项目规约与 IDE 规则——
74
+ - 配置:`specflow/config.yaml` 的 `conventions.<topic>`(architecture / database / api / frontend)
75
+ - 中立文档:`docs/db/conventions.md`、`docs/api/guidelines.md`、`docs/engineering/*` 等
76
+ - IDE 规则:`.cursor` / `.claude` / `.agents` 下的 skills 与 rules
77
+ - guidance packs:`skills/guidance-packs.yaml` 声明的私有知识包(如 database)
78
+ - **优先级:项目约定 > SpecFlow guidance > LLM**。未发现时显式标注「未发现项目规约」。
79
+ - 将数据库 DDL 约定、API 规范、前端规约、架构禁令落实到后续章节。
80
+ 1. **input-summary**(多输入或长输入时):读全部输入,产出紧凑摘要 → `digests/input-summary.md`。
81
+ 2. **outline**:按场景 Profile 生成 `outline.yaml`——章节序 + 每章要点(kind / references / source_segments)+ 实体注册表 + 决策。参考 `.claude/specflow/prompts/document/outline/general.md`。
82
+ 3. **逐章填空**:每章一个步骤 → `chapters/<id>.md`(叙述)+ 契约实体进 `entities.json`。参考 `.claude/specflow/prompts/document/map/goal.md` 等(如 `map/api-design.md`、`map/root-cause.md`)。
83
+ 4. **review**(可选):独立审查全部章节 → `review-result.json`(findings + part_hashes)。参考 `.claude/specflow/prompts/document/review/ai-review.md`。
84
+
85
+ ## ③ 校验(validate,引擎确定性执行)
86
+
87
+ ```text
88
+ specflow document validate --work-root <path>
89
+ ```
90
+
91
+ 引擎校验:
92
+ - outline 必选章 / references / kind 一致性
93
+ - 每章叙述过反偷懒 lint(禁 TODO/待补充/同上/含糊词)
94
+ - 契约实体 zod + 结构化覆盖(引用的实体必须被填充)
95
+ - 通过后渲染 `document.md`(+ `document.html`)
96
+
97
+ **若 validate 失败**:读取 diagnostics,修正对应产物,重跑 validate,直到通过。
98
+
99
+ ## 内置场景 Profile
100
+
101
+ | Profile | 必选章 | 候选章 |
102
+ |---------|--------|--------|
103
+ | `0to1` | goal / tech-selection / mvp-boundary / non-goals | architecture / api-design / data-model / test-strategy |
104
+ | `bugfix` | reproduce / root-cause / fix | impact / regression |
105
+ | `feature` | requirement / test-strategy | api-design / data-model / ui-design |
106
+
107
+ ## 质量红线(生成时必须满足)
108
+
109
+ - 契约实体:接口须含 ≥1 失败示例(G2);表须含完整 DDL。
110
+ - 覆盖:每个大纲要点必须有填充落点。
111
+ - 反偷懒:禁止 TODO/待补充/同上/含糊词。
112
+ - 一致性:跨章实体名/路径与 outline.yaml 冻结名一致,不靠记忆。
113
+
114
+ ## 说明
115
+
116
+ - `run` 是一键入口(Agent 自动执行)。`plan` / `validate` 是分步/高级用法。
117
+ - 本命令不改 phase,不阻塞 apply。
118
+
119
+ ## 实现能力标记(parity 校验用)
120
+
121
+ - **两遍扫描(two-pass outline)**:Pass 1 生成 outline(大纲),Pass 2 逐章填空。
122
+ - **按要点填空(fill-in by points)**:每章对着要点清单填空。
123
+ - **契约注入(contract injection)**:上游契约实体按 references 确定性注入。
124
+ - **覆盖校验(coverage check)**:结构化通道 + 语义通道校验覆盖。
@@ -0,0 +1,16 @@
1
+ # 验收标准(可选;按 capability 列出 Scenario + 可测试性)
2
+ id: acceptance
3
+ title: 验收标准
4
+ when: null
5
+ depends_on: [goal]
6
+ outline_points:
7
+ - { id: AC1, text: Capability + Requirement 清单, required: true, kind: narrative }
8
+ - { id: AC2, text: 每个 Scenario 的可测试性标注, required: true, kind: narrative }
9
+ entities: {}
10
+ narratives:
11
+ acceptance: required
12
+ gates:
13
+ - 每个验收标准必须映射到可测试性(✅ 功能 / ⚠️ 文档 / ❌ 不可测试)
14
+ - 禁止空泛(无 WHEN/THEN)
15
+ map_prompt: prompts/document/map/acceptance.md
16
+ output_budget_tokens: 3000
@@ -0,0 +1,24 @@
1
+ # 接口设计(候选;依赖架构)
2
+ id: api-design
3
+ title: 接口设计
4
+ when: input.containsApiChange
5
+ depends_on: [architecture]
6
+ outline_points:
7
+ - { id: O1, text: 接口总览与调用方/鉴权, required: true, kind: narrative }
8
+ - { id: O2, text: 逐接口字段表 + 成功示例, required: true, kind: mixed }
9
+ - { id: O3, text: 每个接口 ≥1 失败示例(G2), required: true, kind: entity }
10
+ - { id: O4, text: 错误码映射, required: true, kind: entity }
11
+ entities:
12
+ interfaces:
13
+ required: [id, name, method, path, errors]
14
+ each:
15
+ failure_example: required
16
+ errors_table: required
17
+ narratives:
18
+ design_notes: required
19
+ gates:
20
+ - 禁止「暂定/如/实现时」接口名
21
+ - 每个接口必须 ≥1 失败示例
22
+ - 接口编号稳定可交叉引用
23
+ map_prompt: prompts/document/map/api-design.md
24
+ output_budget_tokens: 8000
@@ -0,0 +1,18 @@
1
+ # 架构设计(0→1 候选;依赖技术选型)
2
+ id: architecture
3
+ title: 架构设计
4
+ when: input.hasLogic
5
+ depends_on: [tech-selection]
6
+ outline_points:
7
+ - { id: AR1, text: 总体架构(模块关系), required: true, kind: mixed }
8
+ - { id: AR2, text: 核心组件与职责边界, required: true, kind: narrative }
9
+ - { id: AR3, text: 架构一致性自检, required: false, kind: narrative }
10
+ entities: {}
11
+ narratives:
12
+ architecture_notes: required
13
+ gates:
14
+ - 架构图必须附「设计要点」说明(禁止只复述节点名)
15
+ - 每个组件须有「不做什么」边界
16
+ - 超 5 行流程必须 Mermaid(G1)
17
+ map_prompt: prompts/document/map/architecture.md
18
+ output_budget_tokens: 4000
@@ -0,0 +1,22 @@
1
+ # 闭环性检查(审批模式必选;需求↔方案↔规格↔实施↔风险↔代码↔基线)
2
+ id: closed-loop
3
+ title: 闭环性检查
4
+ when: null
5
+ depends_on: [goal, tech-selection, architecture, api-design, data-model]
6
+ outline_points:
7
+ - { id: CL1, text: 需求闭环(proposal↔specs), required: true, kind: narrative }
8
+ - { id: CL2, text: 方案闭环(design↔specs), required: true, kind: narrative }
9
+ - { id: CL3, text: 规格闭环(场景/可测试性/delta), required: true, kind: narrative }
10
+ - { id: CL4, text: 实施闭环(tasks↔specs), required: true, kind: narrative }
11
+ - { id: CL5, text: 风险闭环(缓解/BREAKING), required: true, kind: narrative }
12
+ - { id: CL6, text: 代码落地性(锚点/结构/栈), required: true, kind: narrative }
13
+ - { id: CL7, text: 基线对照(主 specs), required: true, kind: narrative }
14
+ entities: {}
15
+ narratives:
16
+ closed_loop: required
17
+ gates:
18
+ - 每个 Pass 必须给 ✅/⚠️/❌ 结论 + 一句话证据
19
+ - 必须给出整体闭环性结论(PASS / PASS WITH WARNINGS / FAIL)
20
+ - 禁止空泛(无证据的通过)
21
+ map_prompt: prompts/document/map/closed-loop.md
22
+ output_budget_tokens: 3000
@@ -0,0 +1,17 @@
1
+ # 兼容性与迁移
2
+ id: compat-migration
3
+ title: 兼容性与迁移
4
+ when: null
5
+ depends_on: [api-design, data-model]
6
+ outline_points:
7
+ - { id: CM1, text: 接口/数据兼容结论, required: true, kind: narrative }
8
+ - { id: CM2, text: 存量填充策略(G3), required: true, kind: narrative }
9
+ - { id: CM3, text: 回滚数据兼容(G4), required: true, kind: narrative }
10
+ entities: {}
11
+ narratives:
12
+ compat_migration: required
13
+ gates:
14
+ - 回滚后旧版本能否安全跳过/忽略新数据(G4)必须写明
15
+ - 零变更时显式「无新旧互读问题」
16
+ map_prompt: prompts/document/map/compat-migration.md
17
+ output_budget_tokens: 2500
@@ -0,0 +1,16 @@
1
+ # 配置与运行环境
2
+ id: config-runtime
3
+ title: 配置与运行环境
4
+ when: null
5
+ depends_on: [architecture]
6
+ outline_points:
7
+ - { id: CFG1, text: 配置项(键路径/类型/默认值/生效时机), required: true, kind: narrative }
8
+ - { id: CFG2, text: 约束与校验失败行为, required: true, kind: narrative }
9
+ entities: {}
10
+ narratives:
11
+ config_runtime: required
12
+ gates:
13
+ - 配置变更须写明兼容(缺省兼容/是否改写存量)
14
+ - 完全不涉及写「不涉及」
15
+ map_prompt: prompts/document/map/config-runtime.md
16
+ output_budget_tokens: 2000
@@ -0,0 +1,16 @@
1
+ # 核心算法 / 逻辑说明
2
+ id: core-logic
3
+ title: 核心算法/逻辑
4
+ when: null
5
+ depends_on: [architecture]
6
+ outline_points:
7
+ - { id: LOG1, text: 核心算法/流程说明, required: true, kind: narrative }
8
+ - { id: LOG2, text: 边界与异常处理, required: true, kind: narrative }
9
+ entities: {}
10
+ narratives:
11
+ core_logic: required
12
+ gates:
13
+ - 超 5 行流程必须 Mermaid(G1)
14
+ - 复杂交互页状态机用 stateDiagram-v2
15
+ map_prompt: prompts/document/map/core-logic.md
16
+ output_budget_tokens: 3000
@@ -0,0 +1,25 @@
1
+ # 数据模型(候选;依赖接口设计)
2
+ id: data-model
3
+ title: 数据模型
4
+ when: input.hasPersistence
5
+ depends_on: [api-design]
6
+ outline_points:
7
+ - { id: DM1, text: 表结构与 DDL, required: true, kind: entity }
8
+ - { id: DM2, text: 字段说明 + 本迭代用法, required: true, kind: entity }
9
+ - { id: DM3, text: 存量填充策略(G3), required: true, kind: narrative }
10
+ - { id: DM4, text: 回滚数据兼容(G4), required: true, kind: narrative }
11
+ entities:
12
+ tables:
13
+ required: [id, name, ddl]
14
+ each:
15
+ migration: required
16
+ rollback: required
17
+ narratives:
18
+ data_notes: required
19
+ gates:
20
+ - 每张表必须有完整 CREATE TABLE(含 ENGINE/CHARSET)
21
+ - JSON/新列必须有存量填充策略(G3)
22
+ - 必须有回滚数据兼容说明(G4)
23
+ - 零 DDL 迭代仍须展示现网 DDL(禁止假装不涉及数据库)
24
+ map_prompt: prompts/document/map/data-model.md
25
+ output_budget_tokens: 8000
@@ -0,0 +1,18 @@
1
+ # 部署/发布/回滚方案(可选)
2
+ id: deploy
3
+ title: 部署/发布/回滚
4
+ when: null
5
+ depends_on: [test-strategy]
6
+ outline_points:
7
+ - { id: DP1, text: 部署方案(目标/方式/顺序/配置), required: true, kind: narrative }
8
+ - { id: DP2, text: 发布策略(蓝绿/金丝雀/滚动), required: true, kind: narrative }
9
+ - { id: DP3, text: 回滚方案(触发条件/方式/数据一致/验证), required: true, kind: narrative }
10
+ - { id: DP4, text: 监控与可观测性(指标/日志/告警), required: true, kind: narrative }
11
+ entities: {}
12
+ narratives:
13
+ deploy: required
14
+ gates:
15
+ - 回滚必须有数据一致性结论(G4 语义)
16
+ - 纯库/CLI 项目可写「不涉及运行时部署」
17
+ map_prompt: prompts/document/map/deploy.md
18
+ output_budget_tokens: 2500
@@ -0,0 +1,18 @@
1
+ # 修复方案(bugfix 必选;依赖根因)
2
+ id: fix
3
+ title: 修复方案
4
+ when: null
5
+ depends_on: [root-cause]
6
+ outline_points:
7
+ - { id: F1, text: 修复思路(对应根因), required: true, kind: narrative }
8
+ - { id: F2, text: 具体改动点, required: true, kind: mixed }
9
+ - { id: F3, text: 修复验证方式, required: true, kind: narrative }
10
+ entities: {}
11
+ narratives:
12
+ fix_notes: required
13
+ gates:
14
+ - 修复必须对应根因(禁止治标不治本)
15
+ - 改动点必须具体可执行
16
+ - 必须给出验证方式
17
+ map_prompt: prompts/document/map/fix.md
18
+ output_budget_tokens: 2500
@@ -0,0 +1,17 @@
1
+ # 目标与问题(0→1 必选)
2
+ id: goal
3
+ title: 目标与问题
4
+ when: null
5
+ depends_on: []
6
+ outline_points:
7
+ - { id: G1, text: 要解决什么问题(一句话痛点), required: true, kind: narrative }
8
+ - { id: G2, text: 产品目标(解决…实现…), required: true, kind: narrative }
9
+ - { id: G3, text: 目标用户与核心场景, required: true, kind: narrative }
10
+ entities: {}
11
+ narratives:
12
+ goal: required
13
+ gates:
14
+ - 目标必须用「解决…实现…」句式
15
+ - 禁止含糊目标(如「做一个好用的工具」)
16
+ map_prompt: prompts/document/map/goal.md
17
+ output_budget_tokens: 2000
@@ -0,0 +1,16 @@
1
+ # 影响面(bugfix 候选;依赖根因)
2
+ id: impact
3
+ title: 影响面
4
+ when: null
5
+ depends_on: [root-cause]
6
+ outline_points:
7
+ - { id: IM1, text: 受影响功能/用户/数据, required: true, kind: narrative }
8
+ - { id: IM2, text: 影响严重度评估, required: true, kind: narrative }
9
+ entities: {}
10
+ narratives:
11
+ impact_notes: required
12
+ gates:
13
+ - 必须覆盖功能/用户/数据三维度
14
+ - 严重度必须有依据
15
+ map_prompt: prompts/document/map/impact.md
16
+ output_budget_tokens: 1500
@@ -0,0 +1,22 @@
1
+ # 可实施性评估(审批模式必选;7 维)
2
+ id: implementability
3
+ title: 可实施性评估
4
+ when: null
5
+ depends_on: [closed-loop, test-strategy]
6
+ outline_points:
7
+ - { id: IM1, text: 完整性(READY/NEEDS REFINEMENT/BLOCKED), required: true, kind: narrative }
8
+ - { id: IM2, text: 规格对齐, required: true, kind: narrative }
9
+ - { id: IM3, text: 任务可执行性, required: true, kind: narrative }
10
+ - { id: IM4, text: 技术可行性, required: true, kind: narrative }
11
+ - { id: IM5, text: 依赖明确性, required: true, kind: narrative }
12
+ - { id: IM6, text: 架构一致性, required: true, kind: narrative }
13
+ - { id: IM7, text: 实施风险, required: true, kind: narrative }
14
+ entities: {}
15
+ narratives:
16
+ implementability: required
17
+ gates:
18
+ - 每维必须给结论(READY/NEEDS REFINEMENT/BLOCKED)+ 说明
19
+ - 必须给可实施性总评
20
+ - 禁止与 §4 深度矛盾(如「READY」但 §4 缺细节)
21
+ map_prompt: prompts/document/map/implementability.md
22
+ output_budget_tokens: 2500
@@ -0,0 +1,20 @@
1
+ # MVP 边界(0→1 必选;依赖目标)
2
+ id: mvp-boundary
3
+ title: MVP 边界
4
+ when: null
5
+ depends_on: [goal]
6
+ outline_points:
7
+ - { id: MVP1, text: MVP 核心功能清单, required: true, kind: entity }
8
+ - { id: MVP2, text: 后续版本功能, required: true, kind: narrative }
9
+ - { id: MVP3, text: 预估复杂度与开发阶段, required: true, kind: narrative }
10
+ entities:
11
+ decisions:
12
+ required: [id, text]
13
+ narratives:
14
+ mvp_notes: required
15
+ gates:
16
+ - MVP 核心功能 ≤5 条
17
+ - 必须区分「MVP 核心 / 后续版本」
18
+ - 禁止范围蔓延(把非核心塞进 MVP)
19
+ map_prompt: prompts/document/map/mvp-boundary.md
20
+ output_budget_tokens: 2500
@@ -0,0 +1,17 @@
1
+ # 非目标(0→1 必选;依赖 MVP 边界)
2
+ id: non-goals
3
+ title: 非目标(本期不做)
4
+ when: null
5
+ depends_on: [mvp-boundary]
6
+ outline_points:
7
+ - { id: NG1, text: 明确排除的功能/优化点, required: true, kind: narrative }
8
+ - { id: NG2, text: 每个非目标的排除理由, required: true, kind: narrative }
9
+ entities: {}
10
+ narratives:
11
+ non_goals: required
12
+ gates:
13
+ - 至少列 1 条非目标
14
+ - 每个非目标必须写明「不做理由」
15
+ - 禁止把「做不到」写成「不做」
16
+ map_prompt: prompts/document/map/non-goals.md
17
+ output_budget_tokens: 1500
@@ -0,0 +1,16 @@
1
+ # 回归验证(bugfix 候选;依赖修复)
2
+ id: regression
3
+ title: 回归验证
4
+ when: null
5
+ depends_on: [fix]
6
+ outline_points:
7
+ - { id: RG1, text: 回归测试范围, required: true, kind: narrative }
8
+ - { id: RG2, text: 防复发策略, required: true, kind: narrative }
9
+ entities: {}
10
+ narratives:
11
+ regression_notes: required
12
+ gates:
13
+ - 回归范围必须覆盖受影响面
14
+ - 必须有防复发策略(测试/监控)
15
+ map_prompt: prompts/document/map/regression.md
16
+ output_budget_tokens: 1500
@@ -0,0 +1,16 @@
1
+ # 复现路径(bugfix 必选)
2
+ id: reproduce
3
+ title: 复现路径
4
+ when: null
5
+ depends_on: []
6
+ outline_points:
7
+ - { id: R1, text: 复现步骤与环境, required: true, kind: narrative }
8
+ - { id: R2, text: 预期 vs 实际行为, required: true, kind: narrative }
9
+ entities: {}
10
+ narratives:
11
+ reproduce_notes: required
12
+ gates:
13
+ - 复现步骤必须可执行(编号步骤)
14
+ - 必须写明预期 vs 实际
15
+ map_prompt: prompts/document/map/reproduce.md
16
+ output_budget_tokens: 1500
@@ -0,0 +1,18 @@
1
+ # 需求(feature 必选)
2
+ id: requirement
3
+ title: 需求
4
+ when: null
5
+ depends_on: []
6
+ outline_points:
7
+ - { id: REQ1, text: 功能需求描述, required: true, kind: narrative }
8
+ - { id: REQ2, text: 验收标准(Given-When-Then), required: true, kind: mixed }
9
+ entities:
10
+ decisions:
11
+ required: [id, text]
12
+ narratives:
13
+ requirement_notes: required
14
+ gates:
15
+ - 需求必须可验证(有明确验收标准)
16
+ - 禁止含糊需求(如「更好的体验」)
17
+ map_prompt: prompts/document/map/requirement.md
18
+ output_budget_tokens: 3000
@@ -0,0 +1,18 @@
1
+ # 根因分析(bugfix 必选;依赖复现)
2
+ id: root-cause
3
+ title: 根因分析
4
+ when: null
5
+ depends_on: [reproduce]
6
+ outline_points:
7
+ - { id: C1, text: 直接原因, required: true, kind: narrative }
8
+ - { id: C2, text: 触发条件, required: true, kind: narrative }
9
+ - { id: C3, text: 影响链路, required: true, kind: narrative }
10
+ entities: {}
11
+ narratives:
12
+ root_cause: required
13
+ gates:
14
+ - 禁止「可能是…」含糊根因
15
+ - 必须区分直接原因 vs 触发条件
16
+ - 根因必须可验证(与复现步骤对应)
17
+ map_prompt: prompts/document/map/root-cause.md
18
+ output_budget_tokens: 2000
@@ -0,0 +1,15 @@
1
+ # 审批意见(可选;仅人工签字栏,用户 --signoff 时启用)
2
+ id: signoff
3
+ title: 审批意见
4
+ when: input.includeSignoff
5
+ depends_on: []
6
+ outline_points:
7
+ - { id: SG1, text: 人工审批签字栏(角色/姓名/结论/日期/意见), required: true, kind: narrative }
8
+ entities: {}
9
+ narratives:
10
+ signoff: required
11
+ gates:
12
+ - 禁止写入 AI 预审建议(仅人工签字栏)
13
+ - 每个角色有结论选项(批准/退回/拒绝)
14
+ map_prompt: prompts/document/map/signoff.md
15
+ output_budget_tokens: 1000
@@ -0,0 +1,20 @@
1
+ # 技术选型(0→1 必选;五元组门禁)
2
+ id: tech-selection
3
+ title: 技术选型
4
+ when: null
5
+ depends_on: []
6
+ outline_points:
7
+ - { id: TS1, text: 前端五元组(Framework/Styling/State/UI kit/FE testing), required: true, kind: entity }
8
+ - { id: TS2, text: 后端/数据库/基础设施选型与理由, required: true, kind: mixed }
9
+ - { id: TS3, text: 选型理由(为何不用备选), required: true, kind: narrative }
10
+ entities:
11
+ decisions:
12
+ required: [id, text]
13
+ narratives:
14
+ selection_reason: required
15
+ gates:
16
+ - 前端必须给出五元组,禁止只写「用 React」
17
+ - 每项选型必须附理由
18
+ - 禁止臆造全栈(绿场需用户确认选型)
19
+ map_prompt: prompts/document/map/tech-selection.md
20
+ output_budget_tokens: 3000
@@ -0,0 +1,20 @@
1
+ # 测试策略(候选;依赖接口 + 数据)
2
+ id: test-strategy
3
+ title: 测试策略
4
+ when: input.hasLogic
5
+ depends_on: [api-design, data-model]
6
+ outline_points:
7
+ - { id: T1, text: 分层测试矩阵, required: true, kind: entity }
8
+ - { id: T2, text: 测试环境与数据, required: true, kind: narrative }
9
+ - { id: T3, text: 与验收标准的映射, required: true, kind: narrative }
10
+ entities:
11
+ decisions:
12
+ required: [id, text]
13
+ narratives:
14
+ test_notes: required
15
+ gates:
16
+ - 每个测试层级必须映射到具体验收标准/场景
17
+ - 每个层级有工具/框架 + 可验证目标
18
+ - 不涉及测试变更时显式标注
19
+ map_prompt: prompts/document/map/test-strategy.md
20
+ output_budget_tokens: 3000