@gordon.gan/specflow 1.8.0-beta → 1.8.2-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 +7 -5
- package/dist/cli/commands/document-run.d.ts +98 -0
- package/dist/cli/commands/document-run.js +1064 -0
- package/dist/cli/index.js +2 -2
- package/dist/core/artifact-language.js +11 -1
- package/dist/core/document/asset-paths.d.ts +15 -0
- package/dist/core/document/asset-paths.js +38 -0
- package/dist/core/document/chapters.d.ts +6 -0
- package/dist/core/document/chapters.js +38 -0
- package/dist/core/document/coverage.d.ts +25 -0
- package/dist/core/document/coverage.js +49 -0
- package/dist/core/document/digests.d.ts +40 -0
- package/dist/core/document/digests.js +144 -0
- package/dist/core/document/engine.d.ts +101 -0
- package/dist/core/document/engine.js +722 -0
- package/dist/core/document/extract.d.ts +61 -0
- package/dist/core/document/extract.js +437 -0
- package/dist/core/{approval → document}/forbidden-patterns.d.ts +4 -2
- package/dist/core/document/forbidden-patterns.js +36 -0
- package/dist/core/document/gates.d.ts +39 -0
- package/dist/core/document/gates.js +75 -0
- package/dist/core/document/input-digest.d.ts +63 -0
- package/dist/core/document/input-digest.js +200 -0
- package/dist/core/document/input-features.d.ts +43 -0
- package/dist/core/document/input-features.js +161 -0
- package/dist/core/document/lint.d.ts +39 -0
- package/dist/core/document/lint.js +147 -0
- package/dist/core/document/llm.d.ts +28 -0
- package/dist/core/document/llm.js +22 -0
- package/dist/core/document/map.d.ts +52 -0
- package/dist/core/document/map.js +296 -0
- package/dist/core/document/outline.d.ts +29 -0
- package/dist/core/document/outline.js +171 -0
- package/dist/core/document/paths.d.ts +23 -0
- package/dist/core/document/paths.js +36 -0
- package/dist/core/document/profile-validator.d.ts +23 -0
- package/dist/core/document/profile-validator.js +155 -0
- package/dist/core/document/profiles.d.ts +23 -0
- package/dist/core/document/profiles.js +76 -0
- package/dist/core/document/render.d.ts +61 -0
- package/dist/core/document/render.js +243 -0
- package/dist/core/document/review.d.ts +57 -0
- package/dist/core/document/review.js +202 -0
- package/dist/core/document/scene-detect.d.ts +32 -0
- package/dist/core/document/scene-detect.js +237 -0
- package/dist/core/document/schemas.d.ts +1111 -0
- package/dist/core/document/schemas.js +191 -0
- package/dist/integrations/shared/capability-evidence.js +4 -9
- package/dist/integrations/shared/command-catalog.js +2 -1
- package/dist/integrations/shared/parity-manifest.js +4 -9
- package/package.json +2 -1
- package/prompts/apply/phase-a-plan.md +1 -1
- package/prompts/document/map/acceptance.md +9 -0
- package/prompts/document/map/anti-ai.md +29 -0
- package/prompts/document/map/api-design.md +26 -0
- package/prompts/document/map/architecture.md +27 -0
- package/prompts/document/map/benchmark.md +26 -0
- package/prompts/document/map/closed-loop.md +9 -0
- package/prompts/document/map/compat-migration.md +31 -0
- package/prompts/document/map/component-design.md +30 -0
- package/prompts/document/map/config-runtime.md +9 -0
- package/prompts/document/map/core-flow.md +62 -0
- package/prompts/document/map/core-logic.md +9 -0
- package/prompts/document/map/data-model.md +18 -0
- package/prompts/document/map/deploy.md +26 -0
- package/prompts/document/map/fix.md +8 -0
- package/prompts/document/map/frontend-architecture.md +35 -0
- package/prompts/document/map/goal.md +8 -0
- package/prompts/document/map/impact.md +8 -0
- package/prompts/document/map/implementability.md +9 -0
- package/prompts/document/map/migration-guide.md +36 -0
- package/prompts/document/map/mvp-boundary.md +8 -0
- package/prompts/document/map/non-goals.md +8 -0
- package/prompts/document/map/ops.md +33 -0
- package/prompts/document/map/performance.md +32 -0
- package/prompts/document/map/poc-demo.md +25 -0
- package/prompts/document/map/regression.md +8 -0
- package/prompts/document/map/reproduce.md +8 -0
- package/prompts/document/map/requirement.md +8 -0
- package/prompts/document/map/research.md +25 -0
- package/prompts/document/map/root-cause.md +8 -0
- package/prompts/document/map/signoff.md +9 -0
- package/prompts/document/map/state-management.md +23 -0
- package/prompts/document/map/tech-selection.md +29 -0
- package/prompts/document/map/test-strategy.md +24 -0
- package/prompts/document/map/ui-design.md +21 -0
- package/prompts/document/outline/general.md +46 -0
- package/prompts/document/review/ai-review.md +57 -0
- package/prompts/document/shared/grounding.md +84 -0
- package/prompts/explore/explore-session.md +1 -1
- package/prompts/propose/design-draft.md +1 -1
- package/prompts/propose/proposal.md +1 -1
- package/prompts/propose/specs.md +1 -1
- package/prompts/propose/tasks-draft.md +1 -1
- package/prompts/refine/design-output.md +1 -1
- package/prompts/refine/update-artifacts.md +2 -0
- package/prompts/shared/artifact-language.md +13 -0
- package/skills/specflow-techdoc/SKILL.md +143 -0
- package/skills/specflow-techdoc-synth/SKILL.md +115 -0
- package/templates/document/chapters/acceptance.yaml +16 -0
- package/templates/document/chapters/api-design.yaml +29 -0
- package/templates/document/chapters/architecture.yaml +21 -0
- package/templates/document/chapters/benchmark.yaml +20 -0
- package/templates/document/chapters/closed-loop.yaml +22 -0
- package/templates/document/chapters/compat-migration.yaml +21 -0
- package/templates/document/chapters/component-design.yaml +22 -0
- package/templates/document/chapters/config-runtime.yaml +16 -0
- package/templates/document/chapters/core-flow.yaml +27 -0
- package/templates/document/chapters/core-logic.yaml +16 -0
- package/templates/document/chapters/data-model.yaml +25 -0
- package/templates/document/chapters/deploy.yaml +22 -0
- package/templates/document/chapters/fix.yaml +18 -0
- package/templates/document/chapters/frontend-architecture.yaml +22 -0
- package/templates/document/chapters/goal.yaml +17 -0
- package/templates/document/chapters/impact.yaml +16 -0
- package/templates/document/chapters/implementability.yaml +22 -0
- package/templates/document/chapters/migration-guide.yaml +21 -0
- package/templates/document/chapters/mvp-boundary.yaml +20 -0
- package/templates/document/chapters/non-goals.yaml +17 -0
- package/templates/document/chapters/ops.yaml +25 -0
- package/templates/document/chapters/performance.yaml +21 -0
- package/templates/document/chapters/poc-demo.yaml +22 -0
- package/templates/document/chapters/regression.yaml +16 -0
- package/templates/document/chapters/reproduce.yaml +16 -0
- package/templates/document/chapters/requirement.yaml +18 -0
- package/templates/document/chapters/research.yaml +22 -0
- package/templates/document/chapters/root-cause.yaml +18 -0
- package/templates/document/chapters/signoff.yaml +15 -0
- package/templates/document/chapters/state-management.yaml +22 -0
- package/templates/document/chapters/tech-selection.yaml +23 -0
- package/templates/document/chapters/test-strategy.yaml +23 -0
- package/templates/document/chapters/ui-design.yaml +28 -0
- package/templates/document/profiles/0to1.yaml +44 -0
- package/templates/document/profiles/approve.yaml +22 -0
- package/templates/document/profiles/bugfix.yaml +15 -0
- package/templates/document/profiles/feature.yaml +23 -0
- package/templates/document/profiles/frontend-0to1.yaml +47 -0
- package/templates/document/profiles/migration.yaml +42 -0
- package/templates/document/profiles/poc.yaml +46 -0
- package/dist/cli/commands/approval-assemble.d.ts +0 -64
- package/dist/cli/commands/approval-assemble.js +0 -408
- package/dist/core/approval/assemble.d.ts +0 -10
- package/dist/core/approval/assemble.js +0 -384
- package/dist/core/approval/bundle.d.ts +0 -9
- package/dist/core/approval/bundle.js +0 -172
- package/dist/core/approval/forbidden-patterns.js +0 -40
- package/dist/core/approval/index-schema.d.ts +0 -676
- package/dist/core/approval/index-schema.js +0 -193
- package/dist/core/approval/index.d.ts +0 -12
- package/dist/core/approval/index.js +0 -9
- package/dist/core/approval/lint.d.ts +0 -10
- package/dist/core/approval/lint.js +0 -302
- package/dist/core/approval/paths.d.ts +0 -13
- package/dist/core/approval/paths.js +0 -43
- package/dist/core/approval/pipeline.d.ts +0 -28
- package/dist/core/approval/pipeline.js +0 -146
- package/dist/core/approval/playbook-schema.d.ts +0 -182
- package/dist/core/approval/playbook-schema.js +0 -51
- package/dist/core/approval/render.d.ts +0 -20
- package/dist/core/approval/render.js +0 -210
- package/dist/core/approval/review-pack.d.ts +0 -26
- package/dist/core/approval/review-pack.js +0 -205
- package/dist/core/approval/types.d.ts +0 -223
- package/dist/core/approval/types.js +0 -1
- package/prompts/approval/acp-pipeline.md +0 -106
- package/prompts/approval/ai-review.md +0 -145
- package/prompts/approval/api-guidance.md +0 -179
- package/prompts/approval/database-guidance.md +0 -105
- package/prompts/approval/frontend-guidance.md +0 -249
- package/prompts/approval/generate.md +0 -1596
- package/prompts/approval/multi-repo-guidance.md +0 -263
- package/prompts/approval/multi-repo-spoke-subagent.md +0 -94
- package/prompts/approval/project-conventions-guidance.md +0 -171
- package/prompts/approval/runtime-guidance.md +0 -64
- package/prompts/approval/segmented-generation.md +0 -157
- package/skills/specflow-approval/SKILL.md +0 -778
- package/templates/approval-index.yaml +0 -93
- package/templates/approval-part.md +0 -15
- package/templates/approval-playbook-talos-scenario-job-compile.yaml +0 -29
- package/templates/approval-playbook.yaml +0 -28
- package/templates/approval.md +0 -261
|
@@ -1,778 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: specflow-approval
|
|
3
|
-
description: "Post-refine technical approval document -- AI closed-loop check + code/baseline grounding + over-design guard + implementability assessment"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# SpecFlow: Approval
|
|
7
|
-
|
|
8
|
-
> **HARD GATE**: phase must be `refined`. Run `/specflow:refine` first if not.
|
|
9
|
-
> **HARD GATE**: User must confirm before `approval.md` is written to the change directory.
|
|
10
|
-
> Approval does NOT advance phase — it produces an optional review artifact for human sign-off.
|
|
11
|
-
|
|
12
|
-
## Purpose
|
|
13
|
-
|
|
14
|
-
Approval is the **post-refine, pre-apply technical review pass**: it reads the four
|
|
15
|
-
refined artifacts (`proposal.md`, delta `specs/`, `design.md`, `tasks.md`), **grounds them
|
|
16
|
-
against existing project code and spec baseline**, and produces a single `approval.md`
|
|
17
|
-
technical-approval document for human sign-off.
|
|
18
|
-
|
|
19
|
-
It is **optional**. Skip it when you want to go straight from refine to apply. Use it when
|
|
20
|
-
the change is significant enough to warrant formal technical review before implementation
|
|
21
|
-
begins — architecture decisions, cross-team impact, regulatory exposure, or any change where
|
|
22
|
-
"should we even build this, this way?" deserves a documented answer.
|
|
23
|
-
|
|
24
|
-
Unlike `/specflow:review` (which reviews code after implementation) and `/specflow:verify`
|
|
25
|
-
(which validates implementation against specs), approval reviews the **plan** before any
|
|
26
|
-
code is written. It fills the gap between refine convergence and apply execution.
|
|
27
|
-
|
|
28
|
-
Approval does five things a deterministic CLI cannot:
|
|
29
|
-
|
|
30
|
-
1. **Integrates** the four artifacts into a single narrative with cross-references.
|
|
31
|
-
2. **Checks closed-loop coherence** across requirements ↔ design ↔ specs ↔ tasks using
|
|
32
|
-
semantic reasoning (fuzzy wording detection, coverage gaps, traceability).
|
|
33
|
-
3. **Grounds the plan against reality** — reads existing project code (anchor files) and
|
|
34
|
-
the main spec baseline to verify the plan can actually land on this codebase.
|
|
35
|
-
4. **Guards design quality** — detects over-engineering (YAGNI violations) while confirming
|
|
36
|
-
reasonable extensibility is preserved.
|
|
37
|
-
5. **Assesses implementability** — can an engineer execute this plan without getting stuck?
|
|
38
|
-
|
|
39
|
-
## Invocation
|
|
40
|
-
|
|
41
|
-
```text
|
|
42
|
-
/specflow:approval <change-name>
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Cursor: `specflow:approval <change-name>`;Codex: `$specflow-approval <change-name>`.
|
|
46
|
-
|
|
47
|
-
## Prerequisites
|
|
48
|
-
|
|
49
|
-
- An active change exists with `.specflow.yaml` and `phase: refined`.
|
|
50
|
-
- If phase is not `refined`, REFUSE to proceed and suggest: "This change is in phase
|
|
51
|
-
`<phase>`. Run `/specflow:refine` first to complete deep review before generating an
|
|
52
|
-
approval document."
|
|
53
|
-
- All four refined artifacts exist in `specflow/changes/<name>/`:
|
|
54
|
-
- `proposal.md`
|
|
55
|
-
- `specs/**/*.md` (at least one delta spec)
|
|
56
|
-
- `design.md`
|
|
57
|
-
- `tasks.md`
|
|
58
|
-
- `specflow` CLI is available on PATH (for `specflow validate` and optional status lookup).
|
|
59
|
-
- Optional: `explore.md` with `Status: confirmed` (enriches the approval's "why" section).
|
|
60
|
-
|
|
61
|
-
## Artifact Language Setup
|
|
62
|
-
|
|
63
|
-
Read `.claude/specflow/prompts/shared/artifact-language.md` and resolve the active planning
|
|
64
|
-
root's `specflow/config.yaml` before generating `approval.md`. Apply the policy to all
|
|
65
|
-
human-readable narrative content (summaries, assessments, evidence). Preserve protocol
|
|
66
|
-
markers (`### Requirement:`, `#### Scenario:`, `- **WHEN**`, `- **THEN**`), capability IDs,
|
|
67
|
-
change names, file paths, commands, and code in their original form.
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## Stage 1: Pre-flight Validation
|
|
72
|
-
|
|
73
|
-
1. Read `.specflow.yaml` and confirm `phase: refined`. If not, refuse and suggest `/specflow:refine`.
|
|
74
|
-
2. Confirm all four artifacts exist. If any is missing, stop and tell the user which are missing.
|
|
75
|
-
3. Read `specflow/config.yaml` and resolve `artifacts.language` (default `en`).
|
|
76
|
-
4. Detect project tech stack signals at the project root only (do not recurse):
|
|
77
|
-
- `package.json` → Node/TS/JS ecosystem
|
|
78
|
-
- `go.mod` → Go
|
|
79
|
-
- `pyproject.toml` / `requirements.txt` → Python
|
|
80
|
-
- `Cargo.toml` → Rust
|
|
81
|
-
- `tsconfig.json` → TypeScript (refines Node detection)
|
|
82
|
-
- If none match, set `techStack: unknown`
|
|
83
|
-
5. Set `projectMode`:
|
|
84
|
-
- `greenfield` — no meaningful application source yet (no `src/`/`app/`/`internal/`/`lib/`
|
|
85
|
-
with real code, or only empty scaffold); Pass 6 will be SKIPPED greenfield
|
|
86
|
-
- `brownfield` — existing product code to ground against
|
|
87
|
-
6. **Detect database stack** (for §4.4 guidance). Follow
|
|
88
|
-
`prompts/approval/database-guidance.md` §1 — set
|
|
89
|
-
`dbStack: mysql|postgresql|oracle|redis|elasticsearch|none`. Prefer OLTP
|
|
90
|
-
(`mysql`/`postgresql`/`oracle`) over cache/search when multiple match.
|
|
91
|
-
7. **Scan four artifacts for tech selection coverage** (proposal / design / tasks / specs):
|
|
92
|
-
look for explicit choices on: 前端、后端、数据库与缓存、基础设施(含 CI/部署/云)。
|
|
93
|
-
Set `stackCoverage: complete | partial | missing`.
|
|
94
|
-
8. **Detect `uiInScope`** (follow `prompts/approval/frontend-guidance.md` §1):
|
|
95
|
-
UI/控制台/页面/组件 signals → `uiInScope=yes|no`. When yes, check FE 五元组 coverage
|
|
96
|
-
(Framework / Styling / State / UI kit / FE testing); incomplete counts as
|
|
97
|
-
`stackCoverage=partial` for 前端.
|
|
98
|
-
9. Read `specflow/specs/` baseline if it exists (for Pass 7 baseline cross-check).
|
|
99
|
-
|
|
100
|
-
Announce: "Generating technical approval document for change `<name>` (phase=refined,
|
|
101
|
-
language=<lang>, projectMode=<greenfield|brownfield>, techStack=<stack>, dbStack=<db>,
|
|
102
|
-
uiInScope=<yes|no>, stackCoverage=<complete|partial|missing>)."
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
## Stage 1b: Multi-Repo Intake (多仓)
|
|
107
|
-
|
|
108
|
-
**Trigger**: user **自然语言** specifies multiple repos (talos + talos-web + worker), workset
|
|
109
|
-
with multiple planning roots, or cross-repo design/tasks.
|
|
110
|
-
|
|
111
|
-
Read **`prompts/approval/multi-repo-guidance.md`**.
|
|
112
|
-
|
|
113
|
-
1. Resolve `multi_repo.repos[]` — `id`, `label`, `role`, **per-repo `change`**, optional `root_hint`.
|
|
114
|
-
2. **Read four refined artifacts from each repo** before Pass 1.
|
|
115
|
-
3. **User gate (hard)** — ask before writing any approval file:
|
|
116
|
-
|
|
117
|
-
```text
|
|
118
|
-
跨 N 个仓库,审批技术文档如何产出?
|
|
119
|
-
A) 一份合订视图 (bundle) — 各仓 per_repo 真源 + CLI bundle 只读合订 (**推荐**)
|
|
120
|
-
B) 多份分仓 (per_repo) — 每仓各自 approval.md(默认 Map 模式)
|
|
121
|
-
C) 一份 LLM 合订 (legacy unified) — 仅当用户明确要求且无 bundle;不推荐
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
4. **A (recommended)**: `document_mode: per_repo` + `multi_repo.bundle.enabled: true` + primary repo for playbook output; **B**: per_repo only; **C**: legacy unified (discourage).
|
|
125
|
-
5. If **A or C** — ask **主仓** for playbook/bundle output path.
|
|
126
|
-
6. Write `approval/index.yaml` → `multi_repo` + `acp.pipeline: acp/v2`.
|
|
127
|
-
7. **Per_repo**: Stage 12 + ACP **per repo**; if **A**, run `specflow approval bundle` after all repos assemble.
|
|
128
|
-
|
|
129
|
-
Single-repo → skip (`multi_repo.enabled=false`).
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
## Stage 1c: Multi-Repo Subagent Orchestration (主仓一键 · 子仓并行)
|
|
134
|
-
|
|
135
|
-
**Trigger**: `multi_repo.enabled=true` **and** user chose **A (bundle)** or **B (per_repo only)** **and** session supports **Task** subagents (Cursor Agent / compatible harness).
|
|
136
|
-
|
|
137
|
-
**User-facing promise**: user starts **once** from the **primary** repo (`/specflow:approval <primary.change>`). Orchestrator runs spoke approvals **in parallel**; primary **waits** for all spokes to finish `finalize` successfully, then runs **primary Map + finalize + bundle** (mode A).
|
|
138
|
-
|
|
139
|
-
Read **`prompts/approval/multi-repo-spoke-subagent.md`** before dispatching subagents.
|
|
140
|
-
|
|
141
|
-
### 1c.1 Preconditions (hard)
|
|
142
|
-
|
|
143
|
-
1. User gate **A** answered → `document_mode: per_repo` + `multi_repo.bundle.enabled: true` + `primary_repo` set.
|
|
144
|
-
2. Primary `approval/index.yaml` lists every `multi_repo.repos[]` with `id`, `change`, **`root_hint`** (absolute planning root).
|
|
145
|
-
3. Primary `approval/approval-playbook.yaml` exists (copy from `templates/approval-playbook.yaml` or `templates/approval-playbook-talos-scenario-job-compile.yaml`); every **non-primary** source has explicit `root:` in playbook. **Spoke** `index.yaml` must set `multi_repo.bundle.enabled: false` (only primary enables bundle).
|
|
146
|
-
4. **Scope map** recorded: which `parts` / `interfaces` / `pages` / `capabilities` belong to each repo (from primary index inventory — **split**, do not duplicate bodies across repos).
|
|
147
|
-
5. If migrating from legacy **unified** (mode C): **split parts first** — move `04.6-ui` → web, Worker L2 → worker, platform keeps L3/DDL/compile; add cross-refs. Do not bundle until split is done.
|
|
148
|
-
|
|
149
|
-
### 1c.2 Phase diagram
|
|
150
|
-
|
|
151
|
-
```text
|
|
152
|
-
[Primary orchestrator]
|
|
153
|
-
Stage 1b intake + user gate A + playbook + scope map
|
|
154
|
-
Stage 2–11 (closed-loop) — primary reads ALL repos' four artifacts
|
|
155
|
-
Stage 12a — primary index + playbook + overlay only (optional skeleton on primary)
|
|
156
|
-
|
|
157
|
-
═══ PARALLEL (Task subagent × each non-primary repo) ═══
|
|
158
|
-
For each spoke in multi_repo.repos[] where repo.id != primary_repo:
|
|
159
|
-
Launch Task (generalPurpose) with multi-repo-spoke-subagent.md brief
|
|
160
|
-
Inputs: repo_id, planning_root=root_hint, change, role, scope, workset_root, primary_change
|
|
161
|
-
Spoke runs: 12a → 12b → 12e → finalize <spoke.change> (NO --bundle)
|
|
162
|
-
|
|
163
|
-
═══ WAIT GATE (orchestrator blocks) ═══
|
|
164
|
-
Collect each spoke return payload → all finalize_ok: true
|
|
165
|
-
If any blocked → STOP; report failing repo + diagnostics; do NOT bundle
|
|
166
|
-
|
|
167
|
-
═══ PRIMARY (sequential) ═══
|
|
168
|
-
Stage 12b Map primary-scoped parts only
|
|
169
|
-
Stage 12e AI Review + finalize <primary.change> # no --bundle yet if review pauses
|
|
170
|
-
Re-run finalize until primary ok
|
|
171
|
-
|
|
172
|
-
═══ BUNDLE (primary only) ═══
|
|
173
|
-
specflow approval finalize <primary.change> --bundle --workspace-root <primary.planning_root> [--render]
|
|
174
|
-
Report: each per_repo approval.md path + approval-unified.md (readonly)
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
**`--workspace-root`**: use the **primary repo planning root** (directory containing `specflow/changes/`), not the workset parent — unless every playbook `sources[]` entry sets explicit `root:` (recommended for web/worker).
|
|
178
|
-
|
|
179
|
-
### 1c.3 Subagent dispatch template
|
|
180
|
-
|
|
181
|
-
For each spoke, launch **one** Task in parallel (same turn when possible):
|
|
182
|
-
|
|
183
|
-
```text
|
|
184
|
-
Task · Spoke approval · <repo_id>
|
|
185
|
-
|
|
186
|
-
Read prompts/approval/multi-repo-spoke-subagent.md and execute spoke approval end-to-end.
|
|
187
|
-
|
|
188
|
-
repo_id: <id>
|
|
189
|
-
planning_root: <root_hint absolute path>
|
|
190
|
-
change: <spoke change name>
|
|
191
|
-
role: platform | web | worker
|
|
192
|
-
primary_repo_id: <primary_repo>
|
|
193
|
-
primary_change: <primary change name>
|
|
194
|
-
workset_root: <parent containing all repos, optional>
|
|
195
|
-
scope:
|
|
196
|
-
parts: [<part ids for this repo only>]
|
|
197
|
-
interfaces: [<I ids>]
|
|
198
|
-
pages: [<page ids>]
|
|
199
|
-
capabilities: [<cap ids>]
|
|
200
|
-
cross_ref_policy: 跨仓细节用「见 <other-repo> approval §x」;禁止复制平台 DDL/Worker OpenAPI 全文到本仓
|
|
201
|
-
|
|
202
|
-
Return the YAML payload from multi-repo-spoke-subagent.md § Return payload.
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
**Parallelism**: launch all spoke Tasks in **one** assistant message. Do **not** start primary Map §4 batches that belong to a spoke until spoke Tasks are dispatched (orchestrator may prepare primary skeleton while spokes run).
|
|
206
|
-
|
|
207
|
-
### 1c.4 Wait gate & bundle (hard)
|
|
208
|
-
|
|
209
|
-
Before primary `--bundle`:
|
|
210
|
-
|
|
211
|
-
| Check | Action |
|
|
212
|
-
|-------|--------|
|
|
213
|
-
| Each spoke `finalize_ok: true` | else STOP |
|
|
214
|
-
| Each spoke `approval.md` exists | Read path from return payload |
|
|
215
|
-
| Primary `finalize` ok (no lint/review errors) | else fix primary parts first |
|
|
216
|
-
| Playbook sources match actual per-repo parts | `specflow approval bundle <primary.change>` dry path via finalize |
|
|
217
|
-
|
|
218
|
-
On success announce:
|
|
219
|
-
|
|
220
|
-
```text
|
|
221
|
-
Multi-repo approval complete (mode A):
|
|
222
|
-
- talos/.../approval.md (platform)
|
|
223
|
-
- talos-web/.../approval.md (web)
|
|
224
|
-
- talos-worker/.../approval.md (worker)
|
|
225
|
-
- talos/.../approval-unified.md (readonly bundle)
|
|
226
|
-
Apply uses per_repo approval.md only.
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
### 1c.5 Fallback (no Task / subagent)
|
|
230
|
-
|
|
231
|
-
If subagents unavailable, run spokes **sequentially** in the same session: `cd <root_hint>` → full spoke flow → return to primary. Same wait gate before bundle. **Never** skip per-repo finalize.
|
|
232
|
-
|
|
233
|
-
### 1c.6 User confirmation
|
|
234
|
-
|
|
235
|
-
After Stage 12a + scope map, ask once:
|
|
236
|
-
|
|
237
|
-
```text
|
|
238
|
-
将并行在 N-1 个子仓生成 approval(<repo list>),主仓完成后合订 bundle。确认继续?
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
On confirm: dispatch subagents + proceed. User does **not** run spoke CLIs manually.
|
|
242
|
-
|
|
243
|
-
---
|
|
244
|
-
|
|
245
|
-
## Gate: Tech Stack Intake (0→1 / 四件套缺选型)
|
|
246
|
-
|
|
247
|
-
**Trigger** (any):
|
|
248
|
-
|
|
249
|
-
- `projectMode = greenfield`, **or**
|
|
250
|
-
- `stackCoverage = missing | partial` for dimensions this change needs
|
|
251
|
-
(e.g. UI change needs 前端; persistence needs 数据库与缓存; ship needs 基础设施)
|
|
252
|
-
|
|
253
|
-
**Do NOT** invent a full stack. **STOP and ask the user** in chat (structured), then wait:
|
|
254
|
-
|
|
255
|
-
```text
|
|
256
|
-
本变更需要补全技术选型(四件套未写清 / 0→1 绿场)。请确认或补充下列方向
|
|
257
|
-
(可写「本变更不涉及」跳过某一维):
|
|
258
|
-
|
|
259
|
-
1. 前端:Framework / Styling / State / UI kit / FE testing(五元组;或不涉及前端)
|
|
260
|
-
2. 后端:语言/框架、API 风格(HTTP/gRPC/…)、进程模型
|
|
261
|
-
3. 数据库与缓存:主存(MySQL/PG/…)、缓存(Redis/…)、搜索(若有)
|
|
262
|
-
4. 基础设施:运行环境(K8s/VM/Serverless)、CI/CD、对象存储/消息队列(若有)
|
|
263
|
-
5. 其它约束:公司强制栈、禁止项、必须复用的现网组件
|
|
264
|
-
|
|
265
|
-
若本变更含 UI 且前端仍不清,追问(可合并一次问完):
|
|
266
|
-
- 关键页面/路由清单(或「沿用现网,本迭代只改某页」)
|
|
267
|
-
- 验证命令(dev / test / e2e / browser)
|
|
268
|
-
- (可选)若用 v0/Lovable 等 AI builder:导出与本地可构建计划
|
|
269
|
-
|
|
270
|
-
回复示例:
|
|
271
|
-
前端 Next.js+TS / Tailwind / Zustand / shadcn / Vitest+Playwright;
|
|
272
|
-
后端 Go+Gin;DB MySQL 8 + Redis;基础设施 K8s + GitHub Actions;
|
|
273
|
-
禁止自建消息队列,复用公司 Kafka。
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
After the user answers:
|
|
277
|
-
|
|
278
|
-
1. Record answers for §2.2 技术选型 + fold into §2.4 决策评审表 (new D-rows).
|
|
279
|
-
2. Suggest (do not force) updating `design.md` via `/specflow:refine` later; approval may
|
|
280
|
-
proceed with chat-confirmed stack for this `approval.md` only.
|
|
281
|
-
3. Re-run dbStack detection if the user named a DB; re-check FE 五元组 if UI in scope.
|
|
282
|
-
4. Continue subsequent stages.
|
|
283
|
-
|
|
284
|
-
If the user refuses to choose and the change clearly needs a stack → mark
|
|
285
|
-
`[待 refine 澄清: 技术选型]` and **do not** fabricate architecture/DDL/页面树 around a
|
|
286
|
-
guessed stack.
|
|
287
|
-
|
|
288
|
-
---
|
|
289
|
-
|
|
290
|
-
## Stage 2: Load Execution Instructions
|
|
291
|
-
|
|
292
|
-
Read these files and follow them:
|
|
293
|
-
|
|
294
|
-
1. `.claude/specflow/prompts/approval/generate.md` (or repo `prompts/approval/generate.md`)
|
|
295
|
-
2. `prompts/approval/database-guidance.md` — SpecFlow DB **guidance pack** router
|
|
296
|
-
3. `prompts/approval/frontend-guidance.md` — UI scope + FE 五元组 + §4.6 contract
|
|
297
|
-
4. `prompts/approval/project-conventions-guidance.md` — **project** skill/rule/docs
|
|
298
|
-
lazy-load (architecture / api / database / frontend); cross-IDE path resolve;
|
|
299
|
-
priority **project > SpecFlow guidance > LLM**
|
|
300
|
-
|
|
301
|
-
`generate.md` + convention/DB/FE routers together specify:
|
|
302
|
-
|
|
303
|
-
- The 7-dimension closed-loop verification (Passes 1–7)
|
|
304
|
-
- Design quality, architecture, detailed design, test/deploy (optional chapters), implementability
|
|
305
|
-
- Document order: §1 → §2 → §3 → §4 → **(optional §5)** → §6 → **(optional §7/§8)** → §9 → §10(签字栏 only)
|
|
306
|
-
- **Quality Gates G1–G6** + **Style & Tone**(含禁止正文代码腔)
|
|
307
|
-
- **Optional chapters** §5 / §7 / §8 — ask before write; **AI 预审** chat-only
|
|
308
|
-
- **Project conventions** lazy-load before §3/§4.4/§4.5/§4.6; **project > SpecFlow guidance > LLM**
|
|
309
|
-
- **DB guidance** after project DB conventions; resolve
|
|
310
|
-
`{ide}/specflow/guidance/database/<stack>/` (or package `skills/database/`); record
|
|
311
|
-
项目约定 + DB 技能 + `dbStack` in §4.4.1; never fetch remote / MCP
|
|
312
|
-
- **FE guidance** when `uiInScope=yes`: `frontend-guidance.md` §3 **must** scan
|
|
313
|
-
IDE skills/rules + 落地文档(组件/路由/状态/表单/样式/a11y/测试) + `topic=frontend`;
|
|
314
|
-
§4.6 cites 项目约定 + IDE skills/rules; G5/G6; Visual Loop; never invent page trees
|
|
315
|
-
- **Tech stack intake**: greenfield or four-artifacts missing 前端/后端/数据库与缓存/基础设施
|
|
316
|
-
→ ask user before inventing stacks; FE needs 五元组; record in §2.2; never fabricate
|
|
317
|
-
|
|
318
|
-
You MUST read `generate.md` before any analysis or writing `approval.md`.
|
|
319
|
-
|
|
320
|
-
---
|
|
321
|
-
|
|
322
|
-
## Stage 3: Extract Anchor Files
|
|
323
|
-
|
|
324
|
-
Before running the closed-loop passes, extract the set of **anchor files** that the plan
|
|
325
|
-
references. These are the files Pass 6 (Code Grounding) will read.
|
|
326
|
-
|
|
327
|
-
**Extraction rules** (defined in detail in `generate.md` Part A → Pass 6):
|
|
328
|
-
|
|
329
|
-
1. Scan `design.md` and `tasks.md` for file path references (backtick-quoted paths, code
|
|
330
|
-
blocks, or inline paths like `src/core/...`).
|
|
331
|
-
2. Collect only paths under the project root that look like source files (`.ts`, `.js`,
|
|
332
|
-
`.py`, `.go`, `.rs`, `.kt`, `.java`, etc.) or config files (`package.json`, `tsconfig.json`,
|
|
333
|
-
etc.).
|
|
334
|
-
3. Deduplicate. Do NOT read directories, only files.
|
|
335
|
-
4. **Depth limit: read the anchor file itself only.** Do not follow imports, do not recurse.
|
|
336
|
-
5. If no anchor files are found and the project has no source code (greenfield), Pass 6
|
|
337
|
-
will emit `skipped (greenfield — no existing code)`. If the project HAS source code but
|
|
338
|
-
the plan references no existing files, that is a `FAIL` (plan is ungrounded).
|
|
339
|
-
|
|
340
|
-
Announce the extracted anchor file list to the user before Pass 1 begins.
|
|
341
|
-
|
|
342
|
-
---
|
|
343
|
-
|
|
344
|
-
## Stage 4: AI Closed-Loop Verification
|
|
345
|
-
|
|
346
|
-
Perform the 7 closed-loop passes defined in `generate.md`, in order:
|
|
347
|
-
|
|
348
|
-
### Internal coherence (Passes 1–5)
|
|
349
|
-
|
|
350
|
-
1. **Pass 1 — Requirement Closure**: proposal ↔ specs coverage
|
|
351
|
-
2. **Pass 2 — Design Closure**: design decisions ↔ spec requirements
|
|
352
|
-
3. **Pass 3 — Spec Closure**: scenario completeness + testability (3-level grading) + delta integrity
|
|
353
|
-
4. **Pass 4 — Implementation Closure**: tasks ↔ spec requirements coverage + granularity
|
|
354
|
-
5. **Pass 5 — Risk Closure**: risks ↔ mitigations + BREAKING migration + unidentified risks
|
|
355
|
-
|
|
356
|
-
### External grounding (Passes 6–7)
|
|
357
|
-
|
|
358
|
-
6. **Pass 6 — Code Grounding**: design/tasks anchor files exist in the project + structure
|
|
359
|
-
compatibility + tech-stack consistency. Reads actual project code (anchor files only).
|
|
360
|
-
7. **Pass 7 — Baseline Cross-Check**: delta specs vs `specflow/specs/` main baseline —
|
|
361
|
-
conflict detection, duplicate-definition detection, MODIFIED name matching.
|
|
362
|
-
|
|
363
|
-
Each Pass must produce a brief result for the conversation (verdict + one-line evidence).
|
|
364
|
-
Do **not** dump full coverage matrices into chat unless the user asks or a Pass is
|
|
365
|
-
`WARNING`/`FAIL`.
|
|
366
|
-
|
|
367
|
-
### Closed-Loop Overall Verdict
|
|
368
|
-
|
|
369
|
-
After all 7 Passes:
|
|
370
|
-
|
|
371
|
-
- `FAIL` if any Pass is `FAIL`
|
|
372
|
-
- `PASS WITH WARNINGS` if no `FAIL` but at least one `WARNING`
|
|
373
|
-
- `PASS` if all Passes are `PASS` (a `SKIPPED` Pass does not affect the verdict)
|
|
374
|
-
|
|
375
|
-
When writing `approval.md` **§8** (only if the user opted in), use the **single compact
|
|
376
|
-
table** only (see generate.md Part E §8). Always run Passes 1–7 for the **chat** summary
|
|
377
|
-
even when §8 is omitted from the document. Expand evidence only for ⚠️/❌ rows
|
|
378
|
-
(max 2–3 bullets); PASS/SKIPPED stay one line.
|
|
379
|
-
|
|
380
|
-
---
|
|
381
|
-
|
|
382
|
-
## Stage 5: Design Quality Assessment
|
|
383
|
-
|
|
384
|
-
Perform the two design-quality checks defined in `generate.md` Part B:
|
|
385
|
-
|
|
386
|
-
### Over-Engineering Check
|
|
387
|
-
|
|
388
|
-
Scan `design.md` and `tasks.md` for the 5 over-engineering signals:
|
|
389
|
-
|
|
390
|
-
1. Interface for unrequested requirements
|
|
391
|
-
2. Unnecessary abstraction layers
|
|
392
|
-
3. Pre-built unused infrastructure
|
|
393
|
-
4. Config fields beyond current needs
|
|
394
|
-
5. Complexity exceeding problem scale
|
|
395
|
-
|
|
396
|
-
**Verdict rule**: 1 signal → `WARNING`; 3+ signals → `FAIL`; 0 signals → `PASS`.
|
|
397
|
-
|
|
398
|
-
### Extensibility Assessment
|
|
399
|
-
|
|
400
|
-
Scan `design.md` for the 5 extensibility signals:
|
|
401
|
-
|
|
402
|
-
1. Namespace reservation
|
|
403
|
-
2. Stable interface, replaceable implementation
|
|
404
|
-
3. Explicit Non-Goals
|
|
405
|
-
4. Backward-compatibility path
|
|
406
|
-
5. Decision rationale mentions extensibility trade-off
|
|
407
|
-
|
|
408
|
-
**Verdict rule**: 4-5 signals present → `PASS`; 2-3 → `WARNING`; 0-1 → `WARNING`.
|
|
409
|
-
|
|
410
|
-
### Combined Design Quality Verdict
|
|
411
|
-
|
|
412
|
-
- `FAIL` if over-engineering is `FAIL`
|
|
413
|
-
- `WARNING` if either check is `WARNING`
|
|
414
|
-
- `PASS` if both are `PASS`
|
|
415
|
-
- **Special**: if over-engineering = `WARNING`/`FAIL` AND extensibility = `WARNING` →
|
|
416
|
-
escalate to `FAIL` (the plan is both bloated AND not extensible)
|
|
417
|
-
|
|
418
|
-
---
|
|
419
|
-
|
|
420
|
-
## Stage 6: Architecture Design
|
|
421
|
-
|
|
422
|
-
**Before drafting §3**: follow `project-conventions-guidance.md` with `topic=architecture`
|
|
423
|
-
(lazy-load ≤3 project convention files). Apply project bans to 图要点; cite path or「未发现」.
|
|
424
|
-
|
|
425
|
-
Produce the **architecture design** section (approval.md **§3**) defined in
|
|
426
|
-
`generate.md` Part E.
|
|
427
|
-
|
|
428
|
-
It is complementary to Detailed Design: architecture is about **module-to-module
|
|
429
|
-
relationships** (macro), detailed design is about **module-internal implementation**
|
|
430
|
-
(micro). Architecture is placed **before** acceptance criteria so implementers read
|
|
431
|
-
structure first.
|
|
432
|
-
|
|
433
|
-
### 3.1 Overall Architecture
|
|
434
|
-
|
|
435
|
-
Draw Mermaid diagram(s) — module dependency / layered and optionally system interaction:
|
|
436
|
-
|
|
437
|
-
Requirements:
|
|
438
|
-
|
|
439
|
-
1. **Mark changed modules** (`[新增]` / `[修改]`) so the change surface is visible.
|
|
440
|
-
2. Label edges with dependency direction or interaction messages.
|
|
441
|
-
3. Project-type mapping: CLI/library → `src/core/*`, `src/cli/*`; Web → services/components;
|
|
442
|
-
multi-repo → repositories/services.
|
|
443
|
-
4. Consistent with **§2** decisions.
|
|
444
|
-
5. **Hard rule — 图要点说明**: every architecture diagram MUST be followed by a numbered
|
|
445
|
-
「设计说明 / 图要点」list (boundaries, invariants, reuse vs new) — not a restatement of
|
|
446
|
-
node names. Align with scenario-job-compile §3 style.
|
|
447
|
-
|
|
448
|
-
### 3.2 Core Components
|
|
449
|
-
|
|
450
|
-
| Component | Responsibility | Boundary (does / does NOT) | Depends on | Change type |
|
|
451
|
-
|-----------|---------------|----------------------------|-----------|-------------|
|
|
452
|
-
|
|
453
|
-
Requirements: list added+modified components;「不做什么」boundaries; 1:1 with diagram;
|
|
454
|
-
trace to §2 decisions. Optional short「组件边界总原则」list.
|
|
455
|
-
|
|
456
|
-
**If no architecture change**: write explicit `不涉及架构变更(...)` marker.
|
|
457
|
-
|
|
458
|
-
### 3.3 Architecture Consistency Self-check
|
|
459
|
-
|
|
460
|
-
- Diagrams mark added/modified modules; each has 图要点说明.
|
|
461
|
-
- Each component has a "does NOT do" boundary; diagram ↔ table 1:1.
|
|
462
|
-
- Boundaries trace to §2 decisions.
|
|
463
|
-
|
|
464
|
-
Present the architecture design to the user as part of the confirmation summary.
|
|
465
|
-
|
|
466
|
-
---
|
|
467
|
-
|
|
468
|
-
## Stage 7: Detailed Design
|
|
469
|
-
|
|
470
|
-
Produce the **detailed design** section (approval.md **§4** 方案详细设计) defined in
|
|
471
|
-
`generate.md` Part E.
|
|
472
|
-
|
|
473
|
-
**Selective** categories; uninvolved ones get explicit「不涉及 X」markers.
|
|
474
|
-
|
|
475
|
-
Order and hard requirements (from `generate.md` §4.1–4.9):
|
|
476
|
-
|
|
477
|
-
1. **设计要点一览** — P1…Pn invariants from design decisions (required).
|
|
478
|
-
2. **核心业务时序 · Happy Path** — complete Mermaid `sequenceDiagram` for the main success
|
|
479
|
-
path + post-diagram「设计要点」(required).
|
|
480
|
-
3. **业务场景时序** — each scenario: purpose + diagram + **设计要点说明** (required notes;
|
|
481
|
-
bare diagrams fail quality).
|
|
482
|
-
4. **数据结构** — Before §4.4: (1) `project-conventions-guidance.md` `topic=database`;
|
|
483
|
-
(2) `database-guidance.md` + SpecFlow guidance pack / `dbStack`; (3) live DDL/anchors.
|
|
484
|
-
Priority: **project + live DDL > SpecFlow pack > LLM**. §4.4.1 must list 项目约定 + DB 技能.
|
|
485
|
-
**Outline**: only `4.4.1–4.4.4` + `##### table`; DDL/字段说明/JSON = `**bold**`.
|
|
486
|
-
5. **接口设计** — Before §4.5: (1) `project-conventions-guidance.md` `topic=api`;
|
|
487
|
-
(2) **`api-guidance.md`** — 契约面分层(L2/L3/L4 各独立 `In`)、RPC 锁名、proto/OpenAPI 可生成包;
|
|
488
|
-
(3) live proto/OpenAPI/anchors.
|
|
489
|
-
Then inventory + **each surface** fields + examples + errors + **Proto 草案**(新增 RPC).
|
|
490
|
-
**禁止** L2 HTTP 详写 + L4「内部调用」stub; **禁止**「暂定/如/实现时」RPC 名。
|
|
491
|
-
**Outline**: only `4.5.1–4.5.3` + `##### In`; 请求体字段/示例/错误 = `**bold**`.
|
|
492
|
-
6. **前端 / UI** — When `uiInScope=yes`: before §4.6:
|
|
493
|
-
(1) `project-conventions-guidance.md` `topic=frontend`;
|
|
494
|
-
(2) **`frontend-guidance.md` §3** — 强制扫描 IDE skills/rules(`.cursor`/`.claude`/`.agents`)
|
|
495
|
-
与落地文档(组件命名、路由、状态、表单、API client、样式/token、a11y、测试命令、lint 禁令);
|
|
496
|
-
合计 ≤5 文件,禁止 `invoke` skill;
|
|
497
|
-
(3) live UI anchors from design/tasks.
|
|
498
|
-
Then write 五元组 + 页面/路由 + Page 详设(空/加载/错态) + 状态 + Visual Loop.
|
|
499
|
-
§4.6.1 must list **项目约定** + **IDE skills/rules**.
|
|
500
|
-
**Outline**: only `4.6.1–4.6.5` + `##### Page · …`. **G5/G6**. Omit chapter if no UI.
|
|
501
|
-
7. **核心算法 / 配置 / 兼容性** — §4.7–4.9 as applicable.
|
|
502
|
-
|
|
503
|
-
**Traceability**: every element → **§5** Requirement/Scenario and **§2** decision.
|
|
504
|
-
If not implementer-ready, mark `[待 refine 澄清: <元素>]`.
|
|
505
|
-
|
|
506
|
-
Present the detailed design to the user as part of the confirmation summary.
|
|
507
|
-
|
|
508
|
-
---
|
|
509
|
-
|
|
510
|
-
## Stage 8: Acceptance Criteria (optional)
|
|
511
|
-
|
|
512
|
-
**Ask the user** whether to include **§5 验收标准** in `approval.md`.
|
|
513
|
-
|
|
514
|
-
- If **yes**: produce §5 only **after** §3/§4 are drafted; exhaustive Requirement +
|
|
515
|
-
Scenario list with 3-level testability.
|
|
516
|
-
- If **no**: omit the entire chapter (no placeholder).
|
|
517
|
-
|
|
518
|
-
---
|
|
519
|
-
|
|
520
|
-
## Stage 9: Test Strategy
|
|
521
|
-
|
|
522
|
-
Produce **§6 测试策略**. If §5 is included, every criterion maps to ≥1 test layer.
|
|
523
|
-
If §5 was omitted, map layers to named Requirement/Scenario from delta specs.
|
|
524
|
-
|
|
525
|
-
---
|
|
526
|
-
|
|
527
|
-
## Stage 10: Deployment & Release (optional)
|
|
528
|
-
|
|
529
|
-
**Ask the user** whether to include **§7 部署/发布/回滚**. If yes, produce the section;
|
|
530
|
-
if no, omit entirely.
|
|
531
|
-
|
|
532
|
-
---
|
|
533
|
-
|
|
534
|
-
## Stage 10b: Closed-Loop table (optional)
|
|
535
|
-
|
|
536
|
-
Closed-loop **analysis** (Passes 1–7) always runs. **Ask the user** whether to include
|
|
537
|
-
**§8 闭环性检查表** in the document. If no, omit §8; still report overall verdict in chat.
|
|
538
|
-
|
|
539
|
-
---
|
|
540
|
-
|
|
541
|
-
## Stage 11: Implementability Assessment
|
|
542
|
-
|
|
543
|
-
Perform the 7 implementability dimensions defined in `generate.md` Part C.
|
|
544
|
-
|
|
545
|
-
1. **Completeness** — no TODOs, placeholders, vague tasks
|
|
546
|
-
2. **Spec Alignment** — tasks cover all spec requirements, no scope creep
|
|
547
|
-
3. **Task Actionability** — can an engineer execute each task without ambiguity
|
|
548
|
-
4. **Technical Feasibility** — design decisions are achievable in the detected tech stack
|
|
549
|
-
5. **Dependency Clarity** — task dependencies and external dependencies are explicit
|
|
550
|
-
6. **Architecture Consistency** — design choices match project's existing tech stack, directory structure, error-handling patterns, and test framework (grounded in code reading from Pass 6)
|
|
551
|
-
7. **Implementation Risk** — high-risk module changes, data migration, concurrency, external API breaks, team tech-stack unfamiliarity
|
|
552
|
-
|
|
553
|
-
Each dimension produces a verdict (`READY` | `NEEDS REFINEMENT` | `BLOCKED`) with evidence.
|
|
554
|
-
|
|
555
|
-
### Implementability Overall Verdict
|
|
556
|
-
|
|
557
|
-
- `BLOCKED` if any dimension is `BLOCKED`
|
|
558
|
-
- `NEEDS REFINEMENT` if no `BLOCKED` but any dimension is `NEEDS REFINEMENT`
|
|
559
|
-
- `READY` if all 7 are `READY`
|
|
560
|
-
|
|
561
|
-
---
|
|
562
|
-
|
|
563
|
-
## Stage 12: Generate approval.md (Index → Map → CLI Reduce)
|
|
564
|
-
|
|
565
|
-
Follow `generate.md` Part E (structure) and Part F (segmented pipeline + anti-lazy rules).
|
|
566
|
-
Read `prompts/approval/segmented-generation.md` when `mode=segmented`; read `prompts/approval/acp-pipeline.md` for ACP verify/finalize flow.
|
|
567
|
-
|
|
568
|
-
**Output artifact**: `specflow/changes/<name>/approval.md`
|
|
569
|
-
**Workspace** (segmented): `specflow/changes/<name>/approval/` — `index.yaml`, `analysis.json`, `parts/*.md`, `manifest.json`
|
|
570
|
-
|
|
571
|
-
### 12.0 Mode selection (before writing)
|
|
572
|
-
|
|
573
|
-
| Trigger | Mode |
|
|
574
|
-
|---------|------|
|
|
575
|
-
| `tables > 2` OR `interfaces > 3` OR `pages > 2` OR user opted §5 | **segmented** (mandatory) |
|
|
576
|
-
| Else | ask user: **segmented** (recommended) or **monolithic** |
|
|
577
|
-
|
|
578
|
-
Copy `templates/approval-index.yaml` → `approval/index.yaml`; fill `tables[]` / `interfaces[]` / `pages[]` with stable ids and `part` paths **before** any Map batch.
|
|
579
|
-
|
|
580
|
-
**Anti-lazy (hard)**: when segmented, **never** one-shot the full `approval.md`; **never** stub parts (`TODO` / `待补充` / empty); **always** finish with `specflow approval finalize` (Stage 12f).
|
|
581
|
-
|
|
582
|
-
### 12a Index + Skeleton
|
|
583
|
-
|
|
584
|
-
Write **first** (Gate depends on this):
|
|
585
|
-
|
|
586
|
-
1. `approval/index.yaml` — full `parts_order`, entity inventory, `optional.s5/s7/s8`, `mode`
|
|
587
|
-
2. `approval/analysis.json` — Pass 1–7 + quality + implementability summaries
|
|
588
|
-
3. `approval/parts/` skeleton:
|
|
589
|
-
- `01-intro.md` … `03-architecture.md`
|
|
590
|
-
- `04-detail-core.md` (§4.1–4.3 only)
|
|
591
|
-
- `06-test.md`, `09-implementability.md`, `10-signoff.md`
|
|
592
|
-
|
|
593
|
-
Use `templates/approval-part.md` fragment header; parts use `###`/`####` only — **no** foreign `## N.` headings.
|
|
594
|
-
|
|
595
|
-
### 12b Map Append (batched §4.4 / §4.5 / §4.6 / §4.7–§4.9)
|
|
596
|
-
|
|
597
|
-
Per batch, Read only: `index.yaml`, `analysis.json` digests, design/tasks/spec snippets for batch ids, lazy-loaded conventions (caps per topic), anchor files.
|
|
598
|
-
|
|
599
|
-
Respect `index.batching.*_per_call`. After each part: update `approval/manifest.json` entry.
|
|
600
|
-
|
|
601
|
-
Minimums (no shortcuts — see Part E hard rules 9–10, 18–20):
|
|
602
|
-
|
|
603
|
-
- §4.4 batch: DDL + 字段说明 + 本迭代用法 per table; G3/G4 when applicable
|
|
604
|
-
- §4.5 batch: **Read `api-guidance.md`**; one `In` per contract surface (L2 Worker HTTP / L3 RPC / L4 client RPC — no collapsing)
|
|
605
|
-
- meta + fields + success examples + **failure example (G2)** + error table per interface (**含不变**)
|
|
606
|
-
- **新增 RPC**: frozen `Service.Method` + proto field numbers + `google.api.http` + Gateway registration + Worker OpenAPI pointer
|
|
607
|
-
- **禁止** 暂定/如/实现时 RPC; **禁止** L4 stub when L2 is fully written
|
|
608
|
-
- §4.6 batch (when `uiInScope`): IDE skills/rules scan first; page/route + states + G6; §4.5 `In` refs
|
|
609
|
-
|
|
610
|
-
### 12c Optional chapters
|
|
611
|
-
|
|
612
|
-
Only if user accepted **and** `optional.s5/s7/s8: true` in index:
|
|
613
|
-
|
|
614
|
-
- Insert `05-*` / `07-deploy` / `08-closed-loop` into `parts_order`
|
|
615
|
-
- §8: one table only (from analysis)
|
|
616
|
-
|
|
617
|
-
### 12e AI Review (ACP — in-session, mandatory for non-lightweight)
|
|
618
|
-
|
|
619
|
-
Read **`prompts/approval/ai-review.md`**. This step runs **inside `/specflow-approval`** — not as separate user-facing commands.
|
|
620
|
-
|
|
621
|
-
1. Run once (or when paused): `specflow approval finalize <change>` — if `review-result.json` missing, CLI pauses and writes `review-packet.json`.
|
|
622
|
-
2. Read `review-packet.json` + all parts; fix **parts only**; write `approval/review-result.json` (use `specflow approval review-hashes <change> --json` for `part_hashes`).
|
|
623
|
-
3. Use **generic long-document checks** in `ai-review.md` (R1–R13). Load optional packs (`runtime-guidance.md`, `api-guidance.md`) **only** when the change design requires them.
|
|
624
|
-
|
|
625
|
-
Set in `index.yaml`:
|
|
626
|
-
|
|
627
|
-
```yaml
|
|
628
|
-
acp:
|
|
629
|
-
pipeline: acp/v2
|
|
630
|
-
review:
|
|
631
|
-
enabled: true
|
|
632
|
-
required_pass: true
|
|
633
|
-
```
|
|
634
|
-
|
|
635
|
-
### 12f Finalize (one CLI — preferred)
|
|
636
|
-
|
|
637
|
-
After Map + AI Review, **one command** finishes Verify → Reduce → optional bundle:
|
|
638
|
-
|
|
639
|
-
```bash
|
|
640
|
-
specflow approval finalize <change> [--bundle] [--workspace-root <workset-root>]
|
|
641
|
-
```
|
|
642
|
-
|
|
643
|
-
Chains: `lint --strict` → `review-check` → `check` → `assemble --force` → `bundle` (when `multi_repo.bundle.enabled`).
|
|
644
|
-
|
|
645
|
-
**Do not** ask the user to run `lint` / `review-pack` / `review-check` / `assemble` separately unless debugging a single stage.
|
|
646
|
-
|
|
647
|
-
Low-level subcommands (`lint`, `review-pack`, `assemble`, …) remain for CI hooks and troubleshooting — not the default skill path.
|
|
648
|
-
|
|
649
|
-
### 12g Multi-repo bundle
|
|
650
|
-
|
|
651
|
-
When `multi_repo.bundle.enabled`, **only the primary orchestrator** runs `finalize --bundle` **after** all spokes (Stage 1c wait gate) and primary finalize succeed. Produces readonly `approval-unified.md` from `approval-playbook.yaml`. **Apply 只用各仓 approval.md 真源。**
|
|
652
|
-
|
|
653
|
-
Spoke subagents **must not** pass `--bundle`. See **Stage 1c**.
|
|
654
|
-
|
|
655
|
-
Optional HTML: `specflow approval render <change>` or `finalize --render` → `approval.html` (browser-readable; mermaid via CDN).
|
|
656
|
-
|
|
657
|
-
### Monolithic fast path
|
|
658
|
-
|
|
659
|
-
When user chose `mode: monolithic` and lightweight inventory: write `approval.md` directly **or** parts + single assemble. Same Part E quality bars apply.
|
|
660
|
-
|
|
661
|
-
Document chapter order (hard for included chapters):
|
|
662
|
-
|
|
663
|
-
1. §1 绪论与边界
|
|
664
|
-
2. §2 技术方案评估 — **可读中文**写现状与约束(禁止代码腔堆砌)
|
|
665
|
-
3. §3 架构整体设计
|
|
666
|
-
4. §4 方案详细设计
|
|
667
|
-
5. §5 验收标准 — **仅用户确认要时**
|
|
668
|
-
6. §6 测试策略
|
|
669
|
-
7. §7 部署 — **仅用户确认要时**
|
|
670
|
-
8. §8 闭环表 — **仅用户确认要时**(分析仍必做)
|
|
671
|
-
9. §9 可实施性评估
|
|
672
|
-
10. §10 审批 — **仅人工签字栏**(无 AI 预审小节)
|
|
673
|
-
|
|
674
|
-
Key rules (all modes):
|
|
675
|
-
|
|
676
|
-
- §1 truthful; Journey traces to §5 if present else named specs; Non-Goals with reasons.
|
|
677
|
-
- **§2.2 技术选型**: required for greenfield or when four artifacts lack needed stack
|
|
678
|
-
dimensions; only after Tech Stack Intake (user confirm); never invent full stack.
|
|
679
|
-
Frontend (when UI) needs 五元组, not「React」alone.
|
|
680
|
-
- Decision Review includes every `design.md` decision (plus D-FE/D-BE/D-DB/D-Infra when intake ran).
|
|
681
|
-
- §5 when included: exhaustive + after §3/§4.
|
|
682
|
-
- §3/§4 hard bars + outline hygiene; **G1–G6**; Style & Tone including **no code-dump prose**.
|
|
683
|
-
- §4.6 when `uiInScope`: pages/routes + G5/G6 + Visual Loop; **must Read** IDE
|
|
684
|
-
skills/rules/落地规约 before draft; cite paths in §4.6.1; omit if no UI.
|
|
685
|
-
- §8 when included: one compact table; always report closed-loop verdict in chat.
|
|
686
|
-
- Test Strategy maps to §5 or specs names; Deployment only if opted in.
|
|
687
|
-
- Sign-off blank; **never** write AI pre-approval into the file; never recommend approve if any verdict is `FAIL`.
|
|
688
|
-
|
|
689
|
-
---
|
|
690
|
-
|
|
691
|
-
## Gate: User Confirmation
|
|
692
|
-
|
|
693
|
-
Present a summary to the user (**chat only** — these are not document chapters):
|
|
694
|
-
|
|
695
|
-
- Closed-loop overall verdict (PASS / PASS WITH WARNINGS / FAIL)
|
|
696
|
-
- Design quality verdict (PASS / WARNING / FAIL)
|
|
697
|
-
- Implementability overall verdict (READY / NEEDS REFINEMENT / BLOCKED)
|
|
698
|
-
- **AI pre-approval recommendation** (建议批准 / 有条件批准 / 退回 refine / 拒绝) + 理由
|
|
699
|
-
- The path where `approval.md` will be written (**all paths** if `multi_repo.document_mode=per_repo`)
|
|
700
|
-
|
|
701
|
-
If `multi_repo.enabled`, confirm document mode + primary repo (unified) are already in `index.yaml`.
|
|
702
|
-
|
|
703
|
-
Ask explicitly about **optional chapters** (record in `approval/index.yaml` → `optional.s5/s7/s8`):
|
|
704
|
-
|
|
705
|
-
```text
|
|
706
|
-
是否将以下章节写入审批文档?
|
|
707
|
-
- §5 验收标准: 要 / 不要
|
|
708
|
-
- §7 部署/发布/回滚: 要 / 不要
|
|
709
|
-
- §8 闭环性检查表: 要 / 不要
|
|
710
|
-
```
|
|
711
|
-
|
|
712
|
-
If not forced segmented, ask generation mode:
|
|
713
|
-
|
|
714
|
-
```text
|
|
715
|
-
审批文档生成方式:
|
|
716
|
-
- segmented (推荐): 分片写入 approval/parts/,CLI 拼接 approval.md
|
|
717
|
-
- monolithic: 一次性写入 approval.md(仅轻量变更)
|
|
718
|
-
```
|
|
719
|
-
|
|
720
|
-
**After Stage 12a**, show index inventory (tables / interfaces / pages) and ask:
|
|
721
|
-
|
|
722
|
-
> "确认 index 与可选章节后继续 Map 生成?"
|
|
723
|
-
|
|
724
|
-
Do NOT run 12b until index + optional choices are confirmed.
|
|
725
|
-
|
|
726
|
-
After 12b/12c, run **Stage 12e AI Review** (fix parts, write `review-result.json` with `part_hashes`).
|
|
727
|
-
|
|
728
|
-
Then ask:
|
|
729
|
-
|
|
730
|
-
> "确认 finalize 并写入各仓 `approval.md`?(多仓时将并行子仓 approval,完成后主仓合订 bundle)"
|
|
731
|
-
|
|
732
|
-
Do NOT finalize until the user confirms (unless they already confirmed end-to-end generation).
|
|
733
|
-
|
|
734
|
-
On confirmation:
|
|
735
|
-
|
|
736
|
-
1. **Multi-repo mode A/B**: run **Stage 1c** — dispatch spoke subagents in parallel → wait gate → primary Map/12e/finalize → `finalize --bundle --workspace-root <primary.planning_root>`.
|
|
737
|
-
2. **Segmented (single-repo)**: `specflow approval finalize <change>` — do not paste assembled markdown manually; do not run lint/assemble subcommands separately unless debugging.
|
|
738
|
-
3. **Monolithic**: write `approval.md` directly (or parts + finalize).
|
|
739
|
-
3. Include only optional chapters the user accepted.
|
|
740
|
-
4. Do **not** include「AI 预审建议」in the file.
|
|
741
|
-
5. Do NOT change `phase` — it remains `refined`.
|
|
742
|
-
6. Report the file path (and bundle path if multi-repo) and next-step suggestions.
|
|
743
|
-
|
|
744
|
-
---
|
|
745
|
-
|
|
746
|
-
## Stage 13: Next-Step Suggestions
|
|
747
|
-
|
|
748
|
-
Based on the assessment results:
|
|
749
|
-
|
|
750
|
-
- **If closed-loop = PASS, design quality = PASS, and implementability = READY**:
|
|
751
|
-
Suggest `/specflow:apply` to begin implementation.
|
|
752
|
-
|
|
753
|
-
- **If any verdict is WARNING**:
|
|
754
|
-
Suggest the user either (a) proceed to `/specflow:apply` after acknowledging the warnings
|
|
755
|
-
in the approval document, or (b) return to `/specflow:refine` to close the gaps first.
|
|
756
|
-
|
|
757
|
-
- **If any verdict is FAIL or implementability = BLOCKED**:
|
|
758
|
-
Strongly recommend `/specflow:refine` to resolve the failures before implementation.
|
|
759
|
-
Do NOT suggest `/specflow:apply` — the plan is not ready.
|
|
760
|
-
|
|
761
|
-
In all cases, remind the user that `approval.md` is an optional artifact: it does not block
|
|
762
|
-
`/specflow:apply` (which only requires `phase=refined`), and it does not affect
|
|
763
|
-
`/specflow:archive` (which scans `specs/`, not `approval.md`).
|
|
764
|
-
|
|
765
|
-
---
|
|
766
|
-
|
|
767
|
-
## Not Covered by Approval
|
|
768
|
-
|
|
769
|
-
- No code implementation — `/specflow:apply` owns that.
|
|
770
|
-
- No phase transition — phase stays `refined` until `/specflow:apply` advances it.
|
|
771
|
-
- No spec validation — `/specflow:verify` owns delta + main spec regression checks.
|
|
772
|
-
- No code review — `/specflow:review` owns post-implementation code quality checks.
|
|
773
|
-
- No artifact modification — approval reads the four artifacts (and project code, read-only)
|
|
774
|
-
but never modifies them. If a Pass reveals a gap, the user returns to `/specflow:refine`
|
|
775
|
-
to fix it; approval only documents the finding.
|
|
776
|
-
- No full codebase scan — approval reads only the anchor files extracted in Stage 3. Full
|
|
777
|
-
codebase investigation is `/specflow:explore`'s job.
|
|
778
|
-
- Approval is **not** a gate for apply. It is a decision-support artifact for human review.
|