@gordon.gan/specflow 1.4.6-beta → 1.7.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 +2 -2
- package/dist/cli/commands/approval-assemble.d.ts +48 -5
- package/dist/cli/commands/approval-assemble.js +347 -34
- package/dist/core/approval/assemble.js +64 -17
- package/dist/core/approval/bundle.d.ts +9 -0
- package/dist/core/approval/bundle.js +172 -0
- package/dist/core/approval/forbidden-patterns.d.ts +6 -0
- package/dist/core/approval/forbidden-patterns.js +37 -0
- package/dist/core/approval/index-schema.d.ts +432 -0
- package/dist/core/approval/index-schema.js +103 -0
- package/dist/core/approval/index.d.ts +10 -2
- package/dist/core/approval/index.js +7 -1
- package/dist/core/approval/lint.d.ts +10 -0
- package/dist/core/approval/lint.js +302 -0
- package/dist/core/approval/paths.d.ts +5 -0
- package/dist/core/approval/paths.js +15 -0
- package/dist/core/approval/pipeline.d.ts +28 -0
- package/dist/core/approval/pipeline.js +146 -0
- package/dist/core/approval/playbook-schema.d.ts +182 -0
- package/dist/core/approval/playbook-schema.js +51 -0
- package/dist/core/approval/render.d.ts +20 -0
- package/dist/core/approval/render.js +210 -0
- package/dist/core/approval/review-pack.d.ts +26 -0
- package/dist/core/approval/review-pack.js +205 -0
- package/dist/core/approval/types.d.ts +131 -0
- package/dist/integrations/shared/capability-evidence.js +2 -0
- package/dist/integrations/shared/parity-manifest.js +2 -0
- package/package.json +2 -1
- package/prompts/approval/acp-pipeline.md +104 -0
- package/prompts/approval/ai-review.md +145 -0
- package/prompts/approval/api-guidance.md +179 -0
- package/prompts/approval/generate.md +164 -13
- package/prompts/approval/multi-repo-guidance.md +238 -0
- package/prompts/approval/project-conventions-guidance.md +1 -1
- package/prompts/approval/runtime-guidance.md +64 -0
- package/prompts/approval/segmented-generation.md +23 -11
- package/skills/GUIDANCE_PACKS.md +2 -2
- package/skills/specflow-approval/SKILL.md +80 -18
- package/templates/approval-index.yaml +41 -0
- package/templates/approval-part.md +1 -1
- package/templates/approval-playbook.yaml +28 -0
|
@@ -103,6 +103,33 @@ uiInScope=<yes|no>, stackCoverage=<complete|partial|missing>)."
|
|
|
103
103
|
|
|
104
104
|
---
|
|
105
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
|
+
|
|
106
133
|
## Gate: Tech Stack Intake (0→1 / 四件套缺选型)
|
|
107
134
|
|
|
108
135
|
**Trigger** (any):
|
|
@@ -344,8 +371,11 @@ Order and hard requirements (from `generate.md` §4.1–4.9):
|
|
|
344
371
|
(2) `database-guidance.md` + SpecFlow guidance pack / `dbStack`; (3) live DDL/anchors.
|
|
345
372
|
Priority: **project + live DDL > SpecFlow pack > LLM**. §4.4.1 must list 项目约定 + DB 技能.
|
|
346
373
|
**Outline**: only `4.4.1–4.4.4` + `##### table`; DDL/字段说明/JSON = `**bold**`.
|
|
347
|
-
5. **接口设计** — Before §4.5: `project-conventions-guidance.md` `topic=api
|
|
348
|
-
|
|
374
|
+
5. **接口设计** — Before §4.5: (1) `project-conventions-guidance.md` `topic=api`;
|
|
375
|
+
(2) **`api-guidance.md`** — 契约面分层(L2/L3/L4 各独立 `In`)、RPC 锁名、proto/OpenAPI 可生成包;
|
|
376
|
+
(3) live proto/OpenAPI/anchors.
|
|
377
|
+
Then inventory + **each surface** fields + examples + errors + **Proto 草案**(新增 RPC).
|
|
378
|
+
**禁止** L2 HTTP 详写 + L4「内部调用」stub; **禁止**「暂定/如/实现时」RPC 名。
|
|
349
379
|
**Outline**: only `4.5.1–4.5.3` + `##### In`; 请求体字段/示例/错误 = `**bold**`.
|
|
350
380
|
6. **前端 / UI** — When `uiInScope=yes`: before §4.6:
|
|
351
381
|
(1) `project-conventions-guidance.md` `topic=frontend`;
|
|
@@ -421,7 +451,7 @@ Each dimension produces a verdict (`READY` | `NEEDS REFINEMENT` | `BLOCKED`) wit
|
|
|
421
451
|
## Stage 12: Generate approval.md (Index → Map → CLI Reduce)
|
|
422
452
|
|
|
423
453
|
Follow `generate.md` Part E (structure) and Part F (segmented pipeline + anti-lazy rules).
|
|
424
|
-
Read `prompts/approval/segmented-generation.md` when `mode=segmented
|
|
454
|
+
Read `prompts/approval/segmented-generation.md` when `mode=segmented`; read `prompts/approval/acp-pipeline.md` for ACP verify/finalize flow.
|
|
425
455
|
|
|
426
456
|
**Output artifact**: `specflow/changes/<name>/approval.md`
|
|
427
457
|
**Workspace** (segmented): `specflow/changes/<name>/approval/` — `index.yaml`, `analysis.json`, `parts/*.md`, `manifest.json`
|
|
@@ -435,7 +465,7 @@ Read `prompts/approval/segmented-generation.md` when `mode=segmented`.
|
|
|
435
465
|
|
|
436
466
|
Copy `templates/approval-index.yaml` → `approval/index.yaml`; fill `tables[]` / `interfaces[]` / `pages[]` with stable ids and `part` paths **before** any Map batch.
|
|
437
467
|
|
|
438
|
-
**Anti-lazy (hard)**: when segmented, **never** one-shot the full `approval.md`; **never** stub parts (`TODO` / `待补充` / empty); **always** finish with
|
|
468
|
+
**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).
|
|
439
469
|
|
|
440
470
|
### 12a Index + Skeleton
|
|
441
471
|
|
|
@@ -459,7 +489,10 @@ Respect `index.batching.*_per_call`. After each part: update `approval/manifest.
|
|
|
459
489
|
Minimums (no shortcuts — see Part E hard rules 9–10, 18–20):
|
|
460
490
|
|
|
461
491
|
- §4.4 batch: DDL + 字段说明 + 本迭代用法 per table; G3/G4 when applicable
|
|
462
|
-
- §4.5 batch:
|
|
492
|
+
- §4.5 batch: **Read `api-guidance.md`**; one `In` per contract surface (L2 Worker HTTP / L3 RPC / L4 client RPC — no collapsing)
|
|
493
|
+
- meta + fields + success examples + **failure example (G2)** + error table per interface (**含不变**)
|
|
494
|
+
- **新增 RPC**: frozen `Service.Method` + proto field numbers + `google.api.http` + Gateway registration + Worker OpenAPI pointer
|
|
495
|
+
- **禁止** 暂定/如/实现时 RPC; **禁止** L4 stub when L2 is fully written
|
|
463
496
|
- §4.6 batch (when `uiInScope`): IDE skills/rules scan first; page/route + states + G6; §4.5 `In` refs
|
|
464
497
|
|
|
465
498
|
### 12c Optional chapters
|
|
@@ -469,16 +502,43 @@ Only if user accepted **and** `optional.s5/s7/s8: true` in index:
|
|
|
469
502
|
- Insert `05-*` / `07-deploy` / `08-closed-loop` into `parts_order`
|
|
470
503
|
- §8: one table only (from analysis)
|
|
471
504
|
|
|
472
|
-
###
|
|
505
|
+
### 12e AI Review (ACP — in-session, mandatory for non-lightweight)
|
|
506
|
+
|
|
507
|
+
Read **`prompts/approval/ai-review.md`**. This step runs **inside `/specflow-approval`** — not as separate user-facing commands.
|
|
508
|
+
|
|
509
|
+
1. Run once (or when paused): `specflow approval finalize <change>` — if `review-result.json` missing, CLI pauses and writes `review-packet.json`.
|
|
510
|
+
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`).
|
|
511
|
+
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.
|
|
512
|
+
|
|
513
|
+
Set in `index.yaml`:
|
|
514
|
+
|
|
515
|
+
```yaml
|
|
516
|
+
acp:
|
|
517
|
+
pipeline: acp/v2
|
|
518
|
+
review:
|
|
519
|
+
enabled: true
|
|
520
|
+
required_pass: true
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
### 12f Finalize (one CLI — preferred)
|
|
524
|
+
|
|
525
|
+
After Map + AI Review, **one command** finishes Verify → Reduce → optional bundle:
|
|
473
526
|
|
|
474
527
|
```bash
|
|
475
|
-
specflow approval
|
|
476
|
-
specflow approval assemble <change> --force
|
|
528
|
+
specflow approval finalize <change> [--bundle] [--workspace-root <workset-root>]
|
|
477
529
|
```
|
|
478
530
|
|
|
479
|
-
- `check`
|
|
480
|
-
|
|
481
|
-
-
|
|
531
|
+
Chains: `lint --strict` → `review-check` → `check` → `assemble --force` → `bundle` (when `multi_repo.bundle.enabled`).
|
|
532
|
+
|
|
533
|
+
**Do not** ask the user to run `lint` / `review-pack` / `review-check` / `assemble` separately unless debugging a single stage.
|
|
534
|
+
|
|
535
|
+
Low-level subcommands (`lint`, `review-pack`, `assemble`, …) remain for CI hooks and troubleshooting — not the default skill path.
|
|
536
|
+
|
|
537
|
+
### 12g Multi-repo bundle
|
|
538
|
+
|
|
539
|
+
When `multi_repo.bundle.enabled`, `finalize --bundle` (or auto) produces readonly `approval-unified.md` from `approval-playbook.yaml`. **Apply 只用各仓 approval.md 真源。**
|
|
540
|
+
|
|
541
|
+
Optional HTML: `specflow approval render <change>` or `finalize --render` → `approval.html` (browser-readable; mermaid via CDN).
|
|
482
542
|
|
|
483
543
|
### Monolithic fast path
|
|
484
544
|
|
|
@@ -522,7 +582,9 @@ Present a summary to the user (**chat only** — these are not document chapters
|
|
|
522
582
|
- Design quality verdict (PASS / WARNING / FAIL)
|
|
523
583
|
- Implementability overall verdict (READY / NEEDS REFINEMENT / BLOCKED)
|
|
524
584
|
- **AI pre-approval recommendation** (建议批准 / 有条件批准 / 退回 refine / 拒绝) + 理由
|
|
525
|
-
- The path where `approval.md` will be written
|
|
585
|
+
- The path where `approval.md` will be written (**all paths** if `multi_repo.document_mode=per_repo`)
|
|
586
|
+
|
|
587
|
+
If `multi_repo.enabled`, confirm document mode + primary repo (unified) are already in `index.yaml`.
|
|
526
588
|
|
|
527
589
|
Ask explicitly about **optional chapters** (record in `approval/index.yaml` → `optional.s5/s7/s8`):
|
|
528
590
|
|
|
@@ -547,22 +609,22 @@ If not forced segmented, ask generation mode:
|
|
|
547
609
|
|
|
548
610
|
Do NOT run 12b until index + optional choices are confirmed.
|
|
549
611
|
|
|
550
|
-
After 12b/12c, run
|
|
612
|
+
After 12b/12c, run **Stage 12e AI Review** (fix parts, write `review-result.json` with `part_hashes`).
|
|
551
613
|
|
|
552
614
|
Then ask:
|
|
553
615
|
|
|
554
|
-
> "
|
|
616
|
+
> "确认 finalize 并写入 `specflow/changes/<name>/approval.md`?"
|
|
555
617
|
|
|
556
|
-
Do NOT
|
|
618
|
+
Do NOT finalize until the user confirms (unless they already confirmed end-to-end generation).
|
|
557
619
|
|
|
558
620
|
On confirmation:
|
|
559
621
|
|
|
560
|
-
1. **Segmented**: `specflow approval
|
|
561
|
-
2. **Monolithic**: write `approval.md` directly (or parts +
|
|
622
|
+
1. **Segmented**: `specflow approval finalize <change>` — do not paste assembled markdown manually; do not run lint/assemble subcommands separately unless debugging.
|
|
623
|
+
2. **Monolithic**: write `approval.md` directly (or parts + finalize).
|
|
562
624
|
3. Include only optional chapters the user accepted.
|
|
563
625
|
4. Do **not** include「AI 预审建议」in the file.
|
|
564
626
|
5. Do NOT change `phase` — it remains `refined`.
|
|
565
|
-
6. Report the file path and next-step suggestions.
|
|
627
|
+
6. Report the file path (and bundle path if multi-repo) and next-step suggestions.
|
|
566
628
|
|
|
567
629
|
---
|
|
568
630
|
|
|
@@ -50,3 +50,44 @@ meta:
|
|
|
50
50
|
language: zh-CN
|
|
51
51
|
tech_stack: unknown
|
|
52
52
|
project_mode: brownfield
|
|
53
|
+
|
|
54
|
+
# ACP (recommended for non-lightweight) — see prompts/approval/acp-pipeline.md
|
|
55
|
+
acp:
|
|
56
|
+
pipeline: acp/v2
|
|
57
|
+
context_budget_tokens: 40000
|
|
58
|
+
output_budget_tokens: 8000
|
|
59
|
+
review:
|
|
60
|
+
enabled: true
|
|
61
|
+
required_pass: true
|
|
62
|
+
# feature_slices:
|
|
63
|
+
# - id: core-flow
|
|
64
|
+
# parts: [04-detail-core, 04.5-api]
|
|
65
|
+
|
|
66
|
+
# 多仓时启用 (见 prompts/approval/multi-repo-guidance.md)
|
|
67
|
+
# multi_repo:
|
|
68
|
+
# enabled: true
|
|
69
|
+
# document_mode: per_repo # per_repo + bundle (推荐 A) | per_repo only (B) | unified (C)
|
|
70
|
+
# primary_repo: talos # bundle 或 unified 时必填
|
|
71
|
+
# bundle:
|
|
72
|
+
# enabled: true
|
|
73
|
+
# playbook: approval-playbook.yaml
|
|
74
|
+
# output: approval-unified.md
|
|
75
|
+
# readonly: true
|
|
76
|
+
# repos:
|
|
77
|
+
# - id: talos
|
|
78
|
+
# label: 平台
|
|
79
|
+
# role: platform
|
|
80
|
+
# change: <change-name>
|
|
81
|
+
# - id: talos-web
|
|
82
|
+
# label: 控制台
|
|
83
|
+
# role: web
|
|
84
|
+
# change: <web-change-name>
|
|
85
|
+
# outputs:
|
|
86
|
+
# per_repo:
|
|
87
|
+
# - repo: talos
|
|
88
|
+
# change: <change-name>
|
|
89
|
+
# path: specflow/changes/<change-name>/approval.md
|
|
90
|
+
# bundle:
|
|
91
|
+
# repo: talos
|
|
92
|
+
# change: <change-name>
|
|
93
|
+
# path: specflow/changes/<change-name>/approval-unified.md
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
Approval part fragment — NOT a standalone document.
|
|
3
3
|
Written under specflow/changes/<name>/approval/parts/<part-id>.md
|
|
4
|
-
Assembled by: specflow approval
|
|
4
|
+
Assembled by: specflow approval finalize <change>
|
|
5
5
|
-->
|
|
6
6
|
|
|
7
7
|
<!-- part-id: <must match filename without .md> -->
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# specflow.approval.playbook/v1 — copy to specflow/changes/<change>/approval/approval-playbook.yaml
|
|
2
|
+
schema: specflow.approval.playbook/v1
|
|
3
|
+
change: <change-name>
|
|
4
|
+
title: <合订标题>
|
|
5
|
+
primary_repo: talos
|
|
6
|
+
|
|
7
|
+
sources:
|
|
8
|
+
- repo: talos
|
|
9
|
+
change: <platform-change>
|
|
10
|
+
include_parts: all
|
|
11
|
+
- repo: talos-web
|
|
12
|
+
change: <web-change>
|
|
13
|
+
root: /path/to/talos-web/planning-root
|
|
14
|
+
include_parts: [04.6-ui, 06-test]
|
|
15
|
+
- repo: talos-worker
|
|
16
|
+
change: <worker-change>
|
|
17
|
+
root: /path/to/talos-worker/planning-root
|
|
18
|
+
include_parts: [04.5-api-worker, 04.7-logic]
|
|
19
|
+
|
|
20
|
+
# optional overlay markdown under approval/overlays/
|
|
21
|
+
# overlay:
|
|
22
|
+
# - overlays/01-unified-scope.md
|
|
23
|
+
|
|
24
|
+
assemble:
|
|
25
|
+
inject_headers: true
|
|
26
|
+
dedupe_appendix: true
|
|
27
|
+
output: approval-unified.md
|
|
28
|
+
readonly: true
|