@gordon.gan/specflow 1.8.6-beta → 1.9.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 +28 -2
- package/dist/core/document/engine.js +62 -5
- package/dist/core/document/gates.js +20 -1
- package/dist/core/document/lint.d.ts +56 -0
- package/dist/core/document/lint.js +466 -1
- package/dist/core/document/review.d.ts +2 -0
- package/dist/core/document/review.js +10 -0
- package/package.json +2 -2
- package/prompts/apply/phase-a-plan.md +25 -13
- package/prompts/apply/phase-b-execute.md +43 -14
- package/prompts/apply/phase-b-review.md +20 -2
- package/prompts/apply/phase-b-worktree.md +25 -17
- package/prompts/document/map/acceptance.md +2 -6
- package/prompts/document/map/api-design.md +2 -6
- package/prompts/document/map/architecture.md +2 -6
- package/prompts/document/map/benchmark.md +2 -5
- package/prompts/document/map/closed-loop.md +2 -6
- package/prompts/document/map/compat-migration.md +2 -6
- package/prompts/document/map/component-design.md +2 -5
- package/prompts/document/map/config-runtime.md +2 -6
- package/prompts/document/map/core-flow.md +2 -5
- package/prompts/document/map/core-logic.md +2 -5
- package/prompts/document/map/data-model.md +9 -12
- package/prompts/document/map/deploy.md +2 -5
- package/prompts/document/map/fix.md +2 -6
- package/prompts/document/map/frontend-architecture.md +2 -5
- package/prompts/document/map/goal.md +2 -6
- package/prompts/document/map/impact.md +2 -6
- package/prompts/document/map/implementability.md +2 -6
- package/prompts/document/map/migration-guide.md +2 -5
- package/prompts/document/map/mvp-boundary.md +2 -6
- package/prompts/document/map/non-goals.md +2 -6
- package/prompts/document/map/ops.md +2 -5
- package/prompts/document/map/performance.md +2 -5
- package/prompts/document/map/poc-demo.md +2 -5
- package/prompts/document/map/regression.md +2 -6
- package/prompts/document/map/reproduce.md +2 -6
- package/prompts/document/map/requirement.md +2 -6
- package/prompts/document/map/research.md +2 -5
- package/prompts/document/map/root-cause.md +2 -6
- package/prompts/document/map/signoff.md +2 -6
- package/prompts/document/map/state-management.md +2 -5
- package/prompts/document/map/tech-selection.md +2 -6
- package/prompts/document/map/test-strategy.md +2 -6
- package/prompts/document/map/ui-design.md +2 -6
- package/prompts/document/outline/general.md +2 -5
- package/prompts/document/review/ai-review.md +4 -5
- package/prompts/document/shared/grounding.md +21 -27
- package/prompts/shared/artifact-language.md +5 -0
- package/prompts/shared/code-reviewer-prompt.md +2 -0
- package/prompts/shared/implementer-prompt.md +12 -2
- package/prompts/shared/spec-reviewer-prompt.md +2 -0
- package/skills/specflow-apply/SKILL.md +35 -13
- package/skills/specflow-techdoc/SKILL.md +23 -46
- package/skills/specflow-techdoc-synth/SKILL.md +19 -40
- package/templates/document/chapters/data-model.yaml +2 -0
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
# 章节填充:poc-demo(PoC Demo)
|
|
2
2
|
|
|
3
|
-
你是方案文档撰写员。按大纲要点"填空题"
|
|
4
|
-
-
|
|
5
|
-
- 遵循 prompts/shared/artifact-language.md 的中文叙述规范(简要;怎么做用 1. 2. 3.)
|
|
6
|
-
- 禁止 stub(TODO/待补充/此处省略);禁止含糊词
|
|
7
|
-
- **事实从工程数据源提取,意图向用户询问,推理由你完成**(见 `prompts/document/shared/grounding.md`):本章涉及的接口字段/表列/组件名/依赖版本必须来自工程,缺失的关键信息列入缺口清单一次性询问用户,禁止编造
|
|
3
|
+
你是方案文档撰写员。按大纲要点"填空题"式展开:kind=narrative|mixed → 叙述 Markdown。
|
|
4
|
+
遵循 prompts/shared/artifact-language.md(中文规范);禁止 stub/含糊词;事实从工程数据源提取、意图询问用户(grounding.md),缺口一次性确认,禁止编造。
|
|
8
5
|
|
|
9
6
|
## PoC 章节硬规则(F5 预研/选型 · 验证假设而非做功能)
|
|
10
7
|
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
# 章节填充:regression
|
|
2
2
|
|
|
3
|
-
你是方案文档撰写员。按大纲要点"填空题"
|
|
4
|
-
-
|
|
5
|
-
- kind=narrative|mixed 的要点 → 产出叙述 Markdown
|
|
6
|
-
- 遵循 prompts/shared/artifact-language.md 的中文叙述规范(简要;怎么做用 1. 2. 3.)
|
|
7
|
-
- 禁止 stub(TODO/待补充/此处省略);禁止含糊词
|
|
8
|
-
- **事实从工程数据源提取,意图向用户询问,推理由你完成**(见 `prompts/document/shared/grounding.md`):本章涉及的接口字段/表列/组件名/依赖版本必须来自工程,缺失的关键信息列入缺口清单一次性询问用户,禁止编造
|
|
3
|
+
你是方案文档撰写员。按大纲要点"填空题"式展开:kind=entity|mixed → JSON 契约实体块(```json {"interfaces":[...],"tables":[...],"decisions":[...]} ```);kind=narrative|mixed → 叙述 Markdown。
|
|
4
|
+
遵循 prompts/shared/artifact-language.md(中文规范);禁止 stub/含糊词;事实从工程数据源提取、意图询问用户(grounding.md),缺口一次性确认,禁止编造。
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
# 章节填充:reproduce
|
|
2
2
|
|
|
3
|
-
你是方案文档撰写员。按大纲要点"填空题"
|
|
4
|
-
-
|
|
5
|
-
- kind=narrative|mixed 的要点 → 产出叙述 Markdown
|
|
6
|
-
- 遵循 prompts/shared/artifact-language.md 的中文叙述规范(简要;怎么做用 1. 2. 3.)
|
|
7
|
-
- 禁止 stub(TODO/待补充/此处省略);禁止含糊词
|
|
8
|
-
- **事实从工程数据源提取,意图向用户询问,推理由你完成**(见 `prompts/document/shared/grounding.md`):本章涉及的接口字段/表列/组件名/依赖版本必须来自工程,缺失的关键信息列入缺口清单一次性询问用户,禁止编造
|
|
3
|
+
你是方案文档撰写员。按大纲要点"填空题"式展开:kind=entity|mixed → JSON 契约实体块(```json {"interfaces":[...],"tables":[...],"decisions":[...]} ```);kind=narrative|mixed → 叙述 Markdown。
|
|
4
|
+
遵循 prompts/shared/artifact-language.md(中文规范);禁止 stub/含糊词;事实从工程数据源提取、意图询问用户(grounding.md),缺口一次性确认,禁止编造。
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
# 章节填充:requirement
|
|
2
2
|
|
|
3
|
-
你是方案文档撰写员。按大纲要点"填空题"
|
|
4
|
-
-
|
|
5
|
-
- kind=narrative|mixed 的要点 → 产出叙述 Markdown
|
|
6
|
-
- 遵循 prompts/shared/artifact-language.md 的中文叙述规范(简要;怎么做用 1. 2. 3.;**正文中文化**)
|
|
7
|
-
- 禁止 stub(TODO/待补充/此处省略);禁止含糊词
|
|
8
|
-
- **事实从工程数据源提取,意图向用户询问,推理由你完成**(见 `prompts/document/shared/grounding.md`):本章涉及的接口字段/表列/组件名/依赖版本必须来自工程,缺失的关键信息列入缺口清单一次性询问用户,禁止编造
|
|
3
|
+
你是方案文档撰写员。按大纲要点"填空题"式展开:kind=entity|mixed → JSON 契约实体块(```json {"interfaces":[...],"tables":[...],"decisions":[...]} ```);kind=narrative|mixed → 叙述 Markdown。
|
|
4
|
+
遵循 prompts/shared/artifact-language.md(正文中文化);禁止 stub/含糊词;事实从工程数据源提取、意图询问用户(grounding.md),缺口一次性确认,禁止编造。
|
|
9
5
|
|
|
10
6
|
## 需求章节硬规则
|
|
11
7
|
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
# 章节填充:research(技术调研报告)
|
|
2
2
|
|
|
3
|
-
你是方案文档撰写员。按大纲要点"填空题"
|
|
4
|
-
-
|
|
5
|
-
- 遵循 prompts/shared/artifact-language.md 的中文叙述规范(简要;怎么做用 1. 2. 3.)
|
|
6
|
-
- 禁止 stub(TODO/待补充/此处省略);禁止含糊词
|
|
7
|
-
- **事实从工程数据源提取,意图向用户询问,推理由你完成**(见 `prompts/document/shared/grounding.md`):本章涉及的接口字段/表列/组件名/依赖版本必须来自工程,缺失的关键信息列入缺口清单一次性询问用户,禁止编造
|
|
3
|
+
你是方案文档撰写员。按大纲要点"填空题"式展开:kind=narrative|mixed → 叙述 Markdown。
|
|
4
|
+
遵循 prompts/shared/artifact-language.md(中文规范);禁止 stub/含糊词;事实从工程数据源提取、意图询问用户(grounding.md),缺口一次性确认,禁止编造。
|
|
8
5
|
|
|
9
6
|
## 技术调研章节硬规则(F5 预研/选型 · 反AI决策精神)
|
|
10
7
|
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
# 章节填充:root-cause
|
|
2
2
|
|
|
3
|
-
你是方案文档撰写员。按大纲要点"填空题"
|
|
4
|
-
-
|
|
5
|
-
- kind=narrative|mixed 的要点 → 产出叙述 Markdown
|
|
6
|
-
- 遵循 prompts/shared/artifact-language.md 的中文叙述规范(简要;怎么做用 1. 2. 3.)
|
|
7
|
-
- 禁止 stub(TODO/待补充/此处省略);禁止含糊词
|
|
8
|
-
- **事实从工程数据源提取,意图向用户询问,推理由你完成**(见 `prompts/document/shared/grounding.md`):本章涉及的接口字段/表列/组件名/依赖版本必须来自工程,缺失的关键信息列入缺口清单一次性询问用户,禁止编造
|
|
3
|
+
你是方案文档撰写员。按大纲要点"填空题"式展开:kind=entity|mixed → JSON 契约实体块(```json {"interfaces":[...],"tables":[...],"decisions":[...]} ```);kind=narrative|mixed → 叙述 Markdown。
|
|
4
|
+
遵循 prompts/shared/artifact-language.md(中文规范);禁止 stub/含糊词;事实从工程数据源提取、意图询问用户(grounding.md),缺口一次性确认,禁止编造。
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
# 章节填充:signoff
|
|
2
2
|
|
|
3
|
-
你是方案文档撰写员。按大纲要点"填空题"
|
|
4
|
-
-
|
|
5
|
-
- kind=narrative|mixed 的要点 → 产出叙述 Markdown
|
|
6
|
-
- 遵循 prompts/shared/artifact-language.md 的中文叙述规范(简要;怎么做用 1. 2. 3.)
|
|
7
|
-
- 禁止 stub(TODO/待补充/此处省略);禁止含糊词
|
|
8
|
-
- **事实从工程数据源提取,意图向用户询问,推理由你完成**(见 `prompts/document/shared/grounding.md`):本章涉及的接口字段/表列/组件名/依赖版本必须来自工程,缺失的关键信息列入缺口清单一次性询问用户,禁止编造
|
|
3
|
+
你是方案文档撰写员。按大纲要点"填空题"式展开:kind=entity|mixed → JSON 契约实体块(```json {"interfaces":[...],"tables":[...],"decisions":[...]} ```);kind=narrative|mixed → 叙述 Markdown。
|
|
4
|
+
遵循 prompts/shared/artifact-language.md(中文规范);禁止 stub/含糊词;事实从工程数据源提取、意图询问用户(grounding.md),缺口一次性确认,禁止编造。
|
|
9
5
|
- 涉及项目规约/DB/API/前端约束时,遵循「项目约定 > SpecFlow guidance > LLM」优先级
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
# 章节填充:state-management(状态管理)
|
|
2
2
|
|
|
3
|
-
你是方案文档撰写员。按大纲要点"填空题"
|
|
4
|
-
-
|
|
5
|
-
- 遵循 prompts/shared/artifact-language.md 的中文叙述规范(简要;怎么做用 1. 2. 3.)
|
|
6
|
-
- 禁止 stub(TODO/待补充/此处省略);禁止含糊词
|
|
7
|
-
- **事实从工程数据源提取,意图向用户询问,推理由你完成**(见 `prompts/document/shared/grounding.md`):本章涉及的接口字段/表列/组件名/依赖版本必须来自工程,缺失的关键信息列入缺口清单一次性询问用户,禁止编造
|
|
3
|
+
你是方案文档撰写员。按大纲要点"填空题"式展开:kind=narrative|mixed → 叙述 Markdown。
|
|
4
|
+
遵循 prompts/shared/artifact-language.md(中文规范);禁止 stub/含糊词;事实从工程数据源提取、意图询问用户(grounding.md),缺口一次性确认,禁止编造。
|
|
8
5
|
|
|
9
6
|
## 状态管理章节硬规则(frontend-dev-guide 数据流方法论)
|
|
10
7
|
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
# 章节填充:tech-selection(技术方案评估 / 技术选型)
|
|
2
2
|
|
|
3
|
-
你是方案文档撰写员。按大纲要点"填空题"
|
|
4
|
-
-
|
|
5
|
-
- kind=narrative|mixed 的要点 → 产出叙述 Markdown
|
|
6
|
-
- 遵循 prompts/shared/artifact-language.md 的中文叙述规范(简要;怎么做用 1. 2. 3.)
|
|
7
|
-
- 禁止 stub(TODO/待补充/此处省略);禁止含糊词
|
|
8
|
-
- **事实从工程数据源提取,意图向用户询问,推理由你完成**(见 `prompts/document/shared/grounding.md`):本章涉及的接口字段/表列/组件名/依赖版本必须来自工程,缺失的关键信息列入缺口清单一次性询问用户,禁止编造
|
|
3
|
+
你是方案文档撰写员。按大纲要点"填空题"式展开:kind=entity|mixed → JSON 契约实体块(```json {"interfaces":[...],"tables":[...],"decisions":[...]} ```);kind=narrative|mixed → 叙述 Markdown。
|
|
4
|
+
遵循 prompts/shared/artifact-language.md(中文规范);禁止 stub/含糊词;事实从工程数据源提取、意图询问用户(grounding.md),缺口一次性确认,禁止编造。
|
|
9
5
|
|
|
10
6
|
## 技术评估章节硬规则(借鉴 approval 技术方案评估)
|
|
11
7
|
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
# 章节填充:test-strategy(测试策略 · 前端金字塔)
|
|
2
2
|
|
|
3
|
-
你是方案文档撰写员。按大纲要点"填空题"
|
|
4
|
-
-
|
|
5
|
-
- kind=narrative|mixed 的要点 → 产出叙述 Markdown
|
|
6
|
-
- 遵循 prompts/shared/artifact-language.md 的中文叙述规范(简要;怎么做用 1. 2. 3.)
|
|
7
|
-
- 禁止 stub(TODO/待补充/此处省略);禁止含糊词
|
|
8
|
-
- **事实从工程数据源提取,意图向用户询问,推理由你完成**(见 `prompts/document/shared/grounding.md`):本章涉及的接口字段/表列/组件名/依赖版本必须来自工程,缺失的关键信息列入缺口清单一次性询问用户,禁止编造
|
|
3
|
+
你是方案文档撰写员。按大纲要点"填空题"式展开:kind=entity|mixed → JSON 契约实体块(```json {"interfaces":[...],"tables":[...],"decisions":[...]} ```);kind=narrative|mixed → 叙述 Markdown。
|
|
4
|
+
遵循 prompts/shared/artifact-language.md(中文规范);禁止 stub/含糊词;事实从工程数据源提取、意图询问用户(grounding.md),缺口一次性确认,禁止编造。
|
|
9
5
|
|
|
10
6
|
## 测试策略章节硬规则(F1 §2.2 + 前端金字塔)
|
|
11
7
|
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
# 章节填充:ui-design(前端/UI 设计 · 扩展状态机/路由守卫/埋点/浏览器兼容)
|
|
2
2
|
|
|
3
|
-
你是方案文档撰写员。按大纲要点"填空题"
|
|
4
|
-
-
|
|
5
|
-
- kind=narrative|mixed 的要点 → 产出叙述 Markdown
|
|
6
|
-
- 遵循 prompts/shared/artifact-language.md 的中文叙述规范(简要;怎么做用 1. 2. 3.)
|
|
7
|
-
- 禁止 stub(TODO/待补充/此处省略);禁止含糊词
|
|
8
|
-
- **事实从工程数据源提取,意图向用户询问,推理由你完成**(见 `prompts/document/shared/grounding.md`):本章涉及的接口字段/表列/组件名/依赖版本必须来自工程,缺失的关键信息列入缺口清单一次性询问用户,禁止编造
|
|
3
|
+
你是方案文档撰写员。按大纲要点"填空题"式展开:kind=entity|mixed → JSON 契约实体块(```json {"interfaces":[...],"tables":[...],"decisions":[...]} ```);kind=narrative|mixed → 叙述 Markdown。
|
|
4
|
+
遵循 prompts/shared/artifact-language.md(中文规范);禁止 stub/含糊词;事实从工程数据源提取、意图询问用户(grounding.md),缺口一次性确认,禁止编造。
|
|
9
5
|
|
|
10
6
|
## 前端章节硬规则(借鉴 approval frontend-guidance + README §1.2/§1.4)
|
|
11
7
|
|
|
@@ -4,10 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## 前置:工程数据源扫描 + 信息缺口询问(必须先做)
|
|
6
6
|
|
|
7
|
-
生成大纲前,先按 `prompts/document/shared/grounding.md`
|
|
8
|
-
1. **扫描工程数据源**:只读与场景相关的数据源(OpenAPI/proto、DDL/ORM、路由/组件树、package.json、git diff 等),提取事实(接口字段/表列/依赖版本/组件名)。
|
|
9
|
-
2. **汇总信息缺口并一次性询问**:提取不到的关键信息(验收标准/非目标/权衡偏好/灰度策略等)→ 形成编号清单一次性问用户;拿到答案或"按默认判断"后再生成大纲。
|
|
10
|
-
3. **事实进大纲**:能确定的契约实体(接口/表/决策)进入大纲 `entities` 注册表并冻结名称;推断内容标注来源。
|
|
7
|
+
生成大纲前,先按 `prompts/document/shared/grounding.md` 执行:扫描场景相关数据源(OpenAPI/proto、DDL/ORM、路由/组件树、package.json、git diff 等)提取事实;汇总仍缺失的关键信息(验收标准/非目标/权衡偏好/灰度策略等)→ 编号清单一次性问用户;能确定的契约实体(接口/表/决策)进入大纲 `entities` 注册表并冻结名称。
|
|
11
8
|
|
|
12
9
|
## 输入
|
|
13
10
|
- 全局输入摘要(含各段 id 与实体候选)
|
|
@@ -48,7 +45,7 @@
|
|
|
48
45
|
- 接口契约(请求/响应字段表、示例、错误表)内联进「接口与数据设计」章(渲染为「接口明细」);
|
|
49
46
|
- **数据库表必须由「数据模型」章节组件承载**(表结构与 DDL、字段说明、存量填充 G3、回滚 G4、契约-表映射)——涉及持久化时必须选入 `data-model` 章,禁止把表塞进接口章或忽略;
|
|
50
47
|
- 契约-表映射(每接口 ↔ 读写表/列)写在「数据模型」章,接口约定与数据库通过映射表对齐。
|
|
51
|
-
9. **完整性骨架(P7)**:涉及 ≥2 仓的合成文档必须含 `术语与约定`、`非目标汇总`、`风险与开放问题` 章节位。**不设决策记录(ADR)章节**——决策理由沉淀在技术选型(否决/备选列)与风险章即可,正文不得使用 `[D#]`
|
|
48
|
+
9. **完整性骨架(P7)**:涉及 ≥2 仓的合成文档必须含 `术语与约定`、`非目标汇总`、`风险与开放问题` 章节位。**不设决策记录(ADR)章节**——决策理由沉淀在技术选型(否决/备选列)与风险章即可,正文不得使用 `[D#]` 引用。术语与约定章的术语表**必须覆盖全文将出现的全部工程标识符与业务术语**(含既有系统黑话、外部编号引用),并预留新增行——生成后续章节时每引入一个新标识符/术语,必须回填该表(validate 按 `undefined_term`/`undefined_ref` 拦截未登记项)。
|
|
52
49
|
10. **实体注册表增强**:接口实体注册时记录 `side`(console/worker/internal)、`consumers`、`producers`(仓名);同一 method+path 只注册一个实体,`<repo>_<id>` 前缀仅作追溯别名(防 `duplicate_contract`)。
|
|
53
50
|
11. **主流程含图(P12)**:`core-flow` 章必须输出整体流程图(含失败分支)+ 时序图 + 失败路径决策图,图必须有文字说明。
|
|
54
51
|
12. **文档头与目录**:最终文档由引擎确定性渲染元信息头(标题/参与仓/生成时间)与目录;大纲只决定章节序与要点,不写文档头。
|
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
你是独立审查者,审查一份**分片生成**的方案文档。你与生成者是分离的——以"挑错"为目标,不替生成者辩护。
|
|
4
4
|
|
|
5
5
|
## 输入
|
|
6
|
-
- 大纲(outline.yaml)
|
|
7
|
-
- 各章填充(chapters/*.md)
|
|
8
|
-
- 契约实体(entities.json)
|
|
9
|
-
- 依赖摘要与约束清单
|
|
10
6
|
|
|
11
|
-
|
|
7
|
+
outline.yaml / chapters/*.md / entities.json / 依赖摘要与约束清单。
|
|
8
|
+
|
|
9
|
+
## 审查维度(R1–R15)
|
|
12
10
|
- R1 跨章命名:同一实体在 § 各章/大纲/实体区用同一规范名,无「暂定/实现时」
|
|
13
11
|
- R2 决策落地:大纲 decisions 每项在对应章有具体行为
|
|
14
12
|
- R3 实体↔正文:大纲实体注册表每个实体有实质内容;无孤儿实体
|
|
@@ -23,6 +21,7 @@
|
|
|
23
21
|
- R12 stub 清除:无 TODO/待补充/仅占位
|
|
24
22
|
- R13 结论一致:可实施性/就绪结论与章节深度匹配
|
|
25
23
|
- R14 大纲要点覆盖:每个 kind=narrative|mixed 要点对应小节存在且有实质内容(非 stub)
|
|
24
|
+
- R15 禁止造词(术语登记):正文出现的代码标识符/业务术语/编号引用(如 `oauthstart`、`TALOS-WORK-1`、`G3/G4`、`第 8 条`、`link_mode`)是否已在术语与约定章登记或指向既有文档;跨章是否重复整段定义(P9 首次定义后续引用);未登记的 snake_case/camelCase 标识符必须作为 finding 报告(未登记术语 → critical/important,黑话专名 → important,跨章重复 → minor)
|
|
26
25
|
|
|
27
26
|
## 输出(JSON,符合 review-result schema)
|
|
28
27
|
```json
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# 工程数据源提取 + 信息缺口询问(grounding 通用指引)
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
> 原则:**事实从工程数据源提取,意图向用户询问,推理由你完成**。禁止用 LLM 编造工程事实。
|
|
3
|
+
> 所有章节生成前的强制前置。原则:**事实从工程数据源提取,意图向用户询问,推理由你完成**。禁止用 LLM 编造工程事实。
|
|
5
4
|
|
|
6
5
|
## 一、为什么必须做(质量链)
|
|
7
6
|
|
|
@@ -9,26 +8,21 @@
|
|
|
9
8
|
工程数据源(事实)→ 信息缺口询问(意图)→ 大纲(结构)→ 逐章填充(推理)→ lint/review(校验)
|
|
10
9
|
```
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
- 接口字段少一个、表结构差一列、路由写错——方案文档就失去"可直接交给后端/测试执行"的价值。
|
|
11
|
+
lint/review 只保证格式正确;数据源提取 + 缺口询问才保证内容正确。接口字段少一个、表结构差一列、路由写错——文档就失去「可直接交给后端/测试执行」的价值。
|
|
14
12
|
|
|
15
13
|
## 二、双层提取:引擎确定性提取 + Agent 按需补取
|
|
16
14
|
|
|
17
|
-
**第一层(引擎确定性,无需 Agent 操作)**:`specflow techdoc run`
|
|
18
|
-
OpenAPI(`openapi.yaml`/`swagger.json` 等)、proto3(`*.proto`)、SQL DDL(`schema.sql`/`migration` 等),
|
|
19
|
-
**确定性**解析出契约实体(接口 method/path/字段/错误码、表名/字段/DDL 原文),并作为
|
|
20
|
-
「工程契约候选」注入大纲生成——LLM 只能原样引用这些 frozen 名,禁止改名/编造。
|
|
15
|
+
**第一层(引擎确定性,无需 Agent 操作)**:`specflow techdoc run` 自动扫描 OpenAPI(`openapi.yaml`/`swagger.json`)、proto3(`*.proto`)、SQL DDL(`schema.sql`/`migration`),确定性解析出契约实体(接口 method/path/字段/错误码、表名/字段/DDL 原文),作为「工程契约候选」注入大纲——LLM 只能原样引用 frozen 名,禁止改名/编造。
|
|
21
16
|
|
|
22
|
-
**第二层(Agent
|
|
23
|
-
并按「事实 vs 推理」分级使用。
|
|
17
|
+
**第二层(Agent 按需补取)**:引擎未覆盖的数据源,由你在生成前主动扫描补取(见下表),并按「事实 vs 推理」分级使用。
|
|
24
18
|
|
|
25
|
-
##
|
|
19
|
+
## 三、工程数据源清单(按场景按需取用,禁止一次性全读)
|
|
26
20
|
|
|
27
21
|
| 数据源 | 提取什么 | 优先场景/章节 |
|
|
28
22
|
|---|---|---|
|
|
29
|
-
| OpenAPI / Swagger / proto /
|
|
23
|
+
| OpenAPI / Swagger / proto / 路由文件 | 接口签名、DTO 字段、错误码、http_path | api-design / compat-migration |
|
|
30
24
|
| DDL / ORM schema / migration 文件 | 表结构、字段、索引、外键 | data-model / migration |
|
|
31
|
-
| 组件树 / 路由表 /
|
|
25
|
+
| 组件树 / 路由表 / store / 样式文件 | 页面清单、组件结构、状态流 | ui-design / component-design / state-management |
|
|
32
26
|
| package.json / 依赖清单 / 构建配置 | 技术栈、依赖版本、框架 | tech-selection / migration / 0to1 |
|
|
33
27
|
| 现有 docs / README / conventions | 团队约定、既有术语、命名规范 | 所有章节(约定优先) |
|
|
34
28
|
| 配置文件(环境/部署/CI) | 环境拆分、部署拓扑、密钥策略 | deploy / ops |
|
|
@@ -37,20 +31,19 @@ OpenAPI(`openapi.yaml`/`swagger.json` 等)、proto3(`*.proto`)、SQL DDL
|
|
|
37
31
|
|
|
38
32
|
> **按需加载**:只读当前章节涉及的数据源,禁止一次性读全部(token 暴涨 + 注意力稀释)。
|
|
39
33
|
|
|
40
|
-
##
|
|
34
|
+
## 四、事实 vs 推理 分级(必须遵守)
|
|
41
35
|
|
|
42
36
|
| 类型 | 定义 | 处理方式 |
|
|
43
37
|
|---|---|---|
|
|
44
38
|
| **事实(fact)** | 工程里已有的:接口字段、表列、路由、依赖版本、组件名 | **必须从工程数据源提取**,禁止 LLM 编造 |
|
|
45
39
|
| **意图(intent)** | 用户/业务的目标、验收标准、非目标、权衡偏好、灰度策略 | **向用户询问**,禁止猜测 |
|
|
46
|
-
| **推理(reasoning)** | 方案权衡、架构分析、迁移步骤、测试设计 |
|
|
40
|
+
| **推理(reasoning)** | 方案权衡、架构分析、迁移步骤、测试设计 | **基于事实+意图推导**,可自由发挥但须可溯源 |
|
|
47
41
|
|
|
48
|
-
##
|
|
42
|
+
## 五、信息缺口清单(一次性询问,禁止逐章打断)
|
|
49
43
|
|
|
50
|
-
**流程**:
|
|
51
44
|
1. 扫描工程数据源 + 读用户输入,提取能确定的事实。
|
|
52
|
-
2.
|
|
53
|
-
3.
|
|
45
|
+
2. 汇总**仍缺失的关键信息** → 形成编号清单。
|
|
46
|
+
3. **一次性**向用户询问(列编号清单),拿到答案后再生成;不要每章都问。
|
|
54
47
|
|
|
55
48
|
**常见缺口(按场景)**:
|
|
56
49
|
|
|
@@ -70,22 +63,23 @@ OpenAPI(`openapi.yaml`/`swagger.json` 等)、proto3(`*.proto`)、SQL DDL
|
|
|
70
63
|
2. <缺口 2>
|
|
71
64
|
```
|
|
72
65
|
|
|
73
|
-
##
|
|
66
|
+
## 六、与现有机制的衔接
|
|
74
67
|
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
68
|
+
- 反偷懒 lint 不替代缺口询问:被 lint 拦住后"硬编一个"是错误路径——应先问用户。
|
|
69
|
+
- detect 场景确认复用同一模式:场景不确定已会向用户确认;本节扩展到章节级信息缺口。
|
|
70
|
+
- 用户明确"按默认判断"时,在对应章节标注「此处为用户默认判断,非工程确认」,保证可审计。
|
|
78
71
|
|
|
79
|
-
##
|
|
72
|
+
## 七、前端场景补充(资深前端视角)
|
|
80
73
|
|
|
81
74
|
- 接口契约:**字段名、类型、错误码必须与后端/OpenAPI 对齐**,禁止"前后端各写一套"。
|
|
82
75
|
- 组件/页面:组件名、路由路径、状态 store 名应来自工程;页面清单可与用户核对。
|
|
83
76
|
- 性能:基准数值必须来自实测(或标注"待实测"),禁止编造 LCP/包体数字。
|
|
84
77
|
- 依赖升级:当前版本/目标版本来自 package.json;升级理由与收益向用户确认。
|
|
85
78
|
|
|
86
|
-
##
|
|
79
|
+
## 八、整体性文档写作约定(P9/P11/P12,所有章节通用)
|
|
87
80
|
|
|
88
81
|
1. **首次定义、后续引用**:术语、关键事实(幂等键、零 DDL、禁直连等)只在首次出现处定义,后续一律引用,禁止跨章重复整段(防 P9 重复)。**不设决策记录(ADR)章、不使用 `[D#]` 引用**——决策理由沉淀在技术选型(否决/备选列)与风险章。
|
|
89
|
-
2.
|
|
82
|
+
2. **接口与数据同源**:接口字段与表列来自同一工程数据源;契约-表映射字段↔列必须一一对齐,禁止接口讲接口、表讲表(P11)。
|
|
90
83
|
3. **主流程必有图**:涉及多步流程的章节(core-flow 等)必须给出 mermaid 图(整体流程图/时序图),图必须有文字说明(P12)。
|
|
91
|
-
4.
|
|
84
|
+
4. **某仓无内容则不出现**:跨仓写作时,某仓在某维度无内容就**不写该仓的占位小节**,只写真实存在的内容。
|
|
85
|
+
5. **禁止造词(术语登记,validate 硬门禁)**:正文叙述使用的每个代码标识符/业务术语**必须已登记**在「术语与约定」章术语表(中文名 ↔ 工程标识),或属于实体字段名 / 技术白名单;首次出现即登记,禁止直接使用未登记的 snake_case/camelCase 标识符与黑话专名(如 `oauthstart`、`TALOS-WORK-1`、`G3/G4` 这类编号引用须在术语表登记含义或指向既有文档)。validate 按 `undefined_term`(error)/ `undefined_jargon`(warning)/ `undefined_ref`(warning)拦截;跨章整段重复按 `cross_chapter_duplicate`(warning)拦截。标识符只允许出现在术语表、字段表、JSON/HTTP 示例与代码块中(与 artifact-language.md「正文中文化」一致)。
|
|
@@ -54,5 +54,10 @@ When `artifacts.language` is `zh-CN`:
|
|
|
54
54
|
- 叙述内容多的章节**分条输出**:涉及步骤/规则/流程用 **1. 2. 3.** 编号,一句一条,禁止大段散文堆砌。
|
|
55
55
|
- 流程 / 状态流转 / 结构 / 决策分支类内容**必须配 Mermaid 图**(flowchart / sequenceDiagram / stateDiagram-v2),图紧跟一段文字说明——**图文成对**,禁止只有图没有文字、也禁止长叙述没有任何图。
|
|
56
56
|
- 图粒度:一图一事,多流程拆多图。
|
|
57
|
+
6. **禁止造词(术语登记)** — 正文不得使用未登记的标识符、黑话与无来源术语:
|
|
58
|
+
- 每个代码标识符(snake_case / camelCase)与业务术语**必须先登记**进「术语与约定」章术语表(中文名 ↔ 工程标识)再使用;未登记标识符 validate 按 `undefined_term` error 拦截。
|
|
59
|
+
- 引用既有系统 / 外部编号(如 `oauthstart`、`TALOS-WORK-1`、`G3/G4`、`第 8 条`)必须在术语表登记含义或指向既有文档,禁止直接使用让读者无法定位的黑话。
|
|
60
|
+
- 禁止生造与既有系统不一致的新词;确需新术语时在术语表给出定义并全文统一。
|
|
61
|
+
- 跨章不得重复整段定义同一术语——首次定义、后续引用(P9)。
|
|
57
62
|
|
|
58
63
|
`en`: keep prose brief; numbered steps for how-to. Same table/diagram exception.
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
Use this template when dispatching a code quality reviewer subagent.
|
|
6
6
|
|
|
7
|
+
**Dispatch:** Use your platform's subagent tool. In Codex, use `spawn_agent`, `wait_agent`, and `send_input`; the `Task tool` label below is Claude-specific. If subagent tools are unavailable, run this prompt inline and say so.
|
|
8
|
+
|
|
7
9
|
**Purpose:** Verify implementation is well-built (clean, tested, maintainable)
|
|
8
10
|
|
|
9
11
|
**Only dispatch after spec compliance review passes.**
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
Use this template when dispatching an implementer subagent.
|
|
6
6
|
|
|
7
|
+
**Dispatch:** Use your platform's subagent tool. In Codex, use `spawn_agent`, `wait_agent`, and `send_input`; the `Task tool` label below is Claude-specific. If subagent tools are unavailable, run this prompt inline and say so.
|
|
8
|
+
|
|
7
9
|
```
|
|
8
10
|
Task tool (general-purpose):
|
|
9
11
|
description: "Implement Task N: [task name]"
|
|
@@ -28,6 +30,8 @@ Task tool (general-purpose):
|
|
|
28
30
|
|
|
29
31
|
**Ask them now.** Raise any concerns before starting work.
|
|
30
32
|
|
|
33
|
+
In non-interactive runs (`--yes` / `--yes-after-plan`), do not ask non-blocking questions. Resolve them from the provided task, design, and spec; record any assumption in your report. Return `NEEDS_CONTEXT` only when a missing fact blocks implementation.
|
|
34
|
+
|
|
31
35
|
## Your Job
|
|
32
36
|
|
|
33
37
|
Once you're clear on requirements:
|
|
@@ -40,8 +44,14 @@ Task tool (general-purpose):
|
|
|
40
44
|
|
|
41
45
|
Work from: [directory]
|
|
42
46
|
|
|
43
|
-
**While you work:**
|
|
44
|
-
|
|
47
|
+
**While you work:** In `default` mode, ask questions when something is unexpected or unclear.
|
|
48
|
+
In `yes` / `yes-after-plan` mode, resolve non-blocking ambiguity from the task, design, and
|
|
49
|
+
spec; record the assumption in your report. Return `NEEDS_CONTEXT` only when a missing fact
|
|
50
|
+
blocks implementation. Do not end an auto run just to ask a non-blocking question.
|
|
51
|
+
|
|
52
|
+
**Scope:** Touch only files declared for this task. If the task cannot be completed without
|
|
53
|
+
changing another file or a sensitive area, stop and return `NEEDS_CONTEXT` with the reason.
|
|
54
|
+
Never run archive, push, merge, or deploy commands.
|
|
45
55
|
|
|
46
56
|
## Code Organization
|
|
47
57
|
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
Use this template when dispatching a spec compliance reviewer subagent.
|
|
6
6
|
|
|
7
|
+
**Dispatch:** Use your platform's subagent tool. In Codex, use `spawn_agent`, `wait_agent`, and `send_input`; the `Task tool` label below is Claude-specific. If subagent tools are unavailable, run this prompt inline and say so.
|
|
8
|
+
|
|
7
9
|
**Purpose:** Verify implementer built what was requested (nothing more, nothing less)
|
|
8
10
|
|
|
9
11
|
```
|
|
@@ -7,16 +7,18 @@ description: "Two-phase apply — task rewrite + subagent TDD execution"
|
|
|
7
7
|
|
|
8
8
|
## Invocation mode
|
|
9
9
|
|
|
10
|
-
Inspect the current user invocation before any stage work
|
|
10
|
+
Inspect the current user invocation before any stage work and set `ApplyMode`:
|
|
11
11
|
|
|
12
12
|
- **Default mode:** `/specflow:apply` preserves every existing user confirmation gate and the default interactive behavior.
|
|
13
|
-
- **Yes mode:** `/specflow:apply --yes` records non-interactive confirmation mode for the current invocation only. It auto-accepts
|
|
13
|
+
- **Yes mode:** `/specflow:apply --yes` records non-interactive confirmation mode for the current invocation only. It auto-accepts successful Gate A and Gate B acknowledgements, then runs review → test → verify. It never bypasses hard stops.
|
|
14
|
+
- **Yes-after-plan mode:** `/specflow:apply --yes-after-plan` keeps Gate A interactive, then auto-continues Phase B and the downstream sequence. It never bypasses hard stops.
|
|
14
15
|
|
|
15
16
|
Report the selected mode once at the start of the session. Do not persist it to future invocations.
|
|
16
17
|
|
|
17
18
|
> **HARD GATE (prerequisite)**: phase must be `refined`. Run /specflow:refine first if not.
|
|
18
|
-
> **HARD GATE (Phase A)**: rewritten tasks.md must be
|
|
19
|
-
> **HARD GATE (Phase B)**: each task must be reviewed (spec + code quality) and
|
|
19
|
+
> **HARD GATE (Phase A)**: rewritten tasks.md must be confirmed before Phase B. Exception: `--yes` auto-accepts a successful rewrite; `--yes-after-plan` still requires confirmation.
|
|
20
|
+
> **HARD GATE (Phase B)**: each task must be reviewed (spec + code quality). User confirmation is required in default mode; `--yes` and `--yes-after-plan` auto-accept `Approve`/`Warning`.
|
|
21
|
+
> **HARD STOPS (all modes)**: design gap, reorganization choice, review `Block`, failing baseline/tests, verify `FAIL`, unresolved `BLOCKED`/`NEEDS_CONTEXT`, unexplained out-of-scope file changes, sensitive-area change without explicit approval, or budget/retry limit exceeded.
|
|
20
22
|
|
|
21
23
|
## Prerequisites
|
|
22
24
|
|
|
@@ -72,8 +74,19 @@ Present the audit summary to the user: per-group task count (coarse → atomic),
|
|
|
72
74
|
|
|
73
75
|
### Gate A: Rewrite Confirmation
|
|
74
76
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
Before asking for confirmation, present the **Gate A contract summary**:
|
|
78
|
+
|
|
79
|
+
- **Scope:** task groups, task count, files/directories to modify.
|
|
80
|
+
- **Non-goals:** what this run will not change.
|
|
81
|
+
- **Risk:** migrations, auth/security, payments, public API/schema, dependency manifests, CI/deploy config, secrets, and any files that would widen the declared scope.
|
|
82
|
+
- **Budget:** task count from `tasks.md`, declared file/directory scope, and per-task retry cap (default: 3 implement → review rounds). If design or tasks specify a stricter budget, use it.
|
|
83
|
+
- **Stop conditions:** the hard stops and sensitive areas in this contract.
|
|
84
|
+
|
|
85
|
+
Treat the Gate A confirmation as approval **only** for sensitive areas explicitly named in the contract. Stop before touching a newly discovered sensitive area. In auto modes, compare changed files with the declared scope after each task; an unexplained out-of-scope file is a hard stop.
|
|
86
|
+
|
|
87
|
+
- **Default mode:** Present the rewritten `tasks.md` and contract summary; ask the user to confirm the rewrite. Do NOT proceed to Phase B until confirmed.
|
|
88
|
+
- **Yes-after-plan mode:** Present the rewritten `tasks.md` and contract summary; ask the user to confirm **once**. After confirmation, record Gate A as accepted, set Gate B to auto, and continue.
|
|
89
|
+
- **Yes mode:** Present the rewrite audit and contract summary; record Gate A as automatically accepted and continue directly to Phase B.
|
|
77
90
|
|
|
78
91
|
If Phase A reports a reorganization choice or a design gap, stop regardless of mode; `--yes` does not choose a reorganization or fill a missing design decision.
|
|
79
92
|
|
|
@@ -102,10 +115,14 @@ After Stage B1 completes successfully and before the per-task loop starts:
|
|
|
102
115
|
|
|
103
116
|
For each atomic task in the confirmed rewritten plan:
|
|
104
117
|
|
|
118
|
+
Mark a task `[x]` in `tasks.md` only after both reviews pass. On resume, start from the first unchecked task; Phase A preserves existing `[x]` progress.
|
|
119
|
+
|
|
105
120
|
#### B2a: Execute Task (implementer subagent)
|
|
106
121
|
|
|
107
122
|
Read the file at `.claude/specflow/prompts/apply/phase-b-execute.md` and follow its instructions.
|
|
108
123
|
|
|
124
|
+
Before dispatch, include the full task text, relevant design/spec excerpts, acceptance criteria, and the files this task may touch. Use the platform's subagent tool: in Codex, `spawn_agent` + `wait_agent` (+ `send_input` for fixes); if unavailable, run the same prompt inline and say so.
|
|
125
|
+
|
|
109
126
|
Dispatch a fresh implementer subagent to implement the task using TDD:
|
|
110
127
|
1. Write failing tests first
|
|
111
128
|
2. Implement minimal code to pass
|
|
@@ -122,37 +139,42 @@ For the code quality review, Read the `ReviewerFile` set during Stage B1b. When
|
|
|
122
139
|
|
|
123
140
|
ECC reviewer verdict routing:
|
|
124
141
|
- `Block` (CRITICAL or HIGH findings): return the task to the implementer; do not advance to Gate B until a subsequent review produces `Approve` or `Warning`.
|
|
125
|
-
- `Warning` (MEDIUM findings only): proceed to Gate B with MEDIUM findings visible in the task summary.
|
|
142
|
+
- `Warning` (MEDIUM findings only): proceed to Gate B with MEDIUM findings visible in the task summary, unless a finding concerns a sensitive area or scope drift; those stop.
|
|
126
143
|
- `Approve`: proceed directly to Gate B.
|
|
127
144
|
|
|
128
145
|
#### Gate B: Per-task Confirmation
|
|
129
146
|
|
|
130
147
|
- **Default mode:** Present the task output and both review reports. Ask the user to confirm the task is complete. Do NOT proceed to the next task until confirmation is received.
|
|
131
|
-
- **Yes mode:**
|
|
148
|
+
- **Yes / Yes-after-plan mode:** If spec review passes and code-quality review returns `Approve`, or `Warning` with only non-sensitive MEDIUM findings, mark the task `[x]` in `tasks.md`, record the verdicts, report at most one compact progress line, and start the next task. Do NOT end the turn for acknowledgement, present a menu, or ask "continue?".
|
|
132
149
|
|
|
133
|
-
If either review blocks, return to Stage B2a for the same task.
|
|
150
|
+
If either review blocks, return to Stage B2a for the same task. Auto modes never advance past a blocked review. Before advancing, verify that the task's changed files are inside the Gate A scope; stop on unexplained scope drift.
|
|
134
151
|
|
|
135
152
|
### Stage B3: Phase Transition
|
|
136
153
|
|
|
137
|
-
Once all tasks are confirmed in default mode or automatically accepted in yes mode:
|
|
154
|
+
Once all tasks are confirmed in default mode or automatically accepted in yes/yes-after-plan mode:
|
|
155
|
+
- Ensure every completed task is marked `[x]` in `tasks.md`.
|
|
138
156
|
- Invoke `specflow change phase <name> --set apply` to transition the phase.
|
|
139
157
|
- Summarize the build results and overall coverage.
|
|
140
158
|
|
|
141
|
-
####
|
|
159
|
+
#### Auto-mode downstream sequence (`--yes` and `--yes-after-plan`)
|
|
142
160
|
|
|
143
|
-
When
|
|
161
|
+
When an auto mode reaches this point:
|
|
144
162
|
1. Invoke `/specflow:review`. Stop if it reports a CRITICAL or HIGH finding.
|
|
145
163
|
2. Invoke `/specflow:test` only after review has no CRITICAL/HIGH findings. Stop if tests cannot be made green.
|
|
146
164
|
3. Invoke `/specflow:verify` only after test succeeds. Stop if verify returns `FAIL`.
|
|
147
165
|
4. Report review, test, and verification evidence. Do NOT invoke `/specflow:archive` automatically; archive remains the user's manual choice.
|
|
148
166
|
|
|
167
|
+
#### Final acceptance
|
|
168
|
+
|
|
169
|
+
Always present the final diff/commit range, review/test/verify evidence, the list of automatically accepted gates, and any MEDIUM/LOW findings. The user decides whether to archive. Do NOT archive, push, merge, or deploy automatically.
|
|
170
|
+
|
|
149
171
|
When default mode reaches this point, inform the user that they can now run `/specflow:review` or `/specflow:verify`.
|
|
150
172
|
|
|
151
173
|
---
|
|
152
174
|
|
|
153
175
|
## Phase Transition Notes
|
|
154
176
|
|
|
155
|
-
- **On Phase B success**: phase → `apply` (automatic via Stage B3 CLI call).
|
|
177
|
+
- **On Phase B success**: phase → `apply` after all tasks are user-confirmed or auto-accepted by `--yes`/`--yes-after-plan` (automatic via Stage B3 CLI call).
|
|
156
178
|
- **On Phase A gap halt (Outcome 3)**: phase remains `refined`. No transition. User runs `/specflow:refine` to close gaps, then re-runs `/specflow:apply`.
|
|
157
179
|
- **On Phase A reorganization choice C**: phase remains `refined`. No transition. User edits groups manually, then re-runs `/specflow:apply`.
|
|
158
180
|
- **On Phase B interruption or failing tests**: phase remains `refined`. User resumes Phase B later.
|