@anhth2/spec-driven-dev-plugin 0.9.1 → 0.10.0
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/ARCHITECTURE.md +20 -9
- package/bin/index.js +1 -2
- package/commands/debug.md +13 -12
- package/commands/define-product.md +12 -11
- package/commands/{generate-tests.md → dev-gen-test.md} +48 -15
- package/commands/{generate-tests.tmpl → dev-gen-test.tmpl} +18 -4
- package/{core/commands/run-tests.md → commands/dev-run-test.md} +62 -13
- package/commands/{run-tests.tmpl → dev-run-test.tmpl} +32 -2
- package/{core/commands/smoke-test.md → commands/dev-smoke-test.md} +17 -16
- package/commands/{smoke-test.tmpl → dev-smoke-test.tmpl} +5 -5
- package/commands/fix-bug.md +13 -12
- package/commands/generate-bdd.md +39 -13
- package/commands/generate-bdd.tmpl +9 -2
- package/commands/generate-code.md +86 -15
- package/commands/generate-code.tmpl +56 -4
- package/commands/generate-design-spec.md +105 -39
- package/commands/generate-design-spec.tmpl +93 -28
- package/commands/generate-prd.md +12 -11
- package/commands/generate-spec-manifest.md +12 -11
- package/commands/generate-tech-docs.md +63 -22
- package/commands/generate-tech-docs.tmpl +51 -11
- package/commands/learn.md +13 -12
- package/commands/propose-scenario.md +13 -12
- package/commands/propose-scenario.tmpl +1 -1
- package/commands/refine-prd.md +166 -16
- package/commands/refine-prd.tmpl +16 -5
- package/commands/report-bug.md +12 -11
- package/commands/review-code.md +14 -13
- package/commands/review-code.tmpl +1 -1
- package/commands/review-context.md +161 -12
- package/commands/review-context.tmpl +11 -1
- package/commands/review-tech-docs.md +13 -11
- package/commands/review-tech-docs.tmpl +1 -0
- package/commands/setup-ai-first.md +7 -7
- package/commands/sync.md +23 -20
- package/commands/sync.tmpl +16 -13
- package/commands/update-framework.md +7 -7
- package/commands/validate-traces.md +57 -37
- package/commands/validate-traces.tmpl +45 -26
- package/core/FRAMEWORK_VERSION +1 -1
- package/core/commands/debug.md +13 -12
- package/core/commands/define-product.md +12 -11
- package/core/commands/{generate-tests.md → dev-gen-test.md} +48 -15
- package/{commands/run-tests.md → core/commands/dev-run-test.md} +62 -13
- package/{commands/smoke-test.md → core/commands/dev-smoke-test.md} +17 -16
- package/core/commands/fix-bug.md +13 -12
- package/core/commands/generate-bdd.md +39 -13
- package/core/commands/generate-code.md +86 -15
- package/core/commands/generate-design-spec.md +105 -39
- package/core/commands/generate-prd.md +12 -11
- package/core/commands/generate-spec-manifest.md +12 -11
- package/core/commands/generate-tech-docs.md +63 -22
- package/core/commands/learn.md +13 -12
- package/core/commands/propose-scenario.md +13 -12
- package/core/commands/refine-prd.md +166 -16
- package/core/commands/report-bug.md +12 -11
- package/core/commands/review-code.md +14 -13
- package/core/commands/review-context.md +161 -12
- package/core/commands/review-tech-docs.md +13 -11
- package/core/commands/setup-ai-first.md +7 -7
- package/core/commands/sync.md +23 -20
- package/core/commands/update-framework.md +7 -7
- package/core/commands/validate-traces.md +57 -37
- package/core/modules/android-compose/module.yaml +13 -0
- package/core/modules/android-compose/stack-profile.yaml +57 -0
- package/core/modules/flutter/module.yaml +14 -0
- package/core/modules/flutter/stack-profile.yaml +59 -0
- package/core/modules/ios-swiftui/module.yaml +13 -0
- package/core/modules/ios-swiftui/stack-profile.yaml +55 -0
- package/core/modules/nuxt/module.yaml +14 -0
- package/core/modules/nuxt/stack-profile.yaml +58 -0
- package/core/modules/react-native/module.yaml +14 -0
- package/core/modules/react-native/stack-profile.yaml +56 -0
- package/core/modules/vue/module.yaml +14 -0
- package/core/modules/vue/stack-profile.yaml +65 -0
- package/core/skills/code/SKILL.md +19 -18
- package/core/skills/debug/SKILL.md +27 -26
- package/core/skills/design-spec/SKILL.md +12 -11
- package/core/skills/discovery/SKILL.md +12 -11
- package/core/skills/prd/SKILL.md +14 -14
- package/core/skills/setup-ai-first/SKILL.md +7 -7
- package/core/skills/spec/SKILL.md +14 -14
- package/core/skills/test/SKILL.md +40 -38
- package/core/steps/capture-lesson.md +1 -1
- package/core/steps/context-loader.md +5 -4
- package/core/steps/report-footer.md +7 -7
- package/core/steps/review-fanout.md +138 -0
- package/core/steps/spawn-agent.md +1 -1
- package/core/steps/trace-mirror.md +18 -0
- package/core/templates/design-spec.template.md +16 -8
- package/core/templates/product-definition.template.md +3 -3
- package/core/templates/project-context.yaml +4 -1
- package/modules/android-compose/module.yaml +13 -0
- package/modules/android-compose/stack-profile.yaml +57 -0
- package/modules/flutter/module.yaml +14 -0
- package/modules/flutter/stack-profile.yaml +59 -0
- package/modules/ios-swiftui/module.yaml +13 -0
- package/modules/ios-swiftui/stack-profile.yaml +55 -0
- package/modules/nuxt/module.yaml +14 -0
- package/modules/nuxt/stack-profile.yaml +58 -0
- package/modules/react-native/module.yaml +14 -0
- package/modules/react-native/stack-profile.yaml +56 -0
- package/modules/vue/module.yaml +14 -0
- package/modules/vue/stack-profile.yaml +65 -0
- package/package.json +1 -1
- package/skills/code/SKILL.md +19 -18
- package/skills/debug/SKILL.md +27 -26
- package/skills/debug/SKILL.tmpl +1 -1
- package/skills/design-spec/SKILL.md +12 -11
- package/skills/discovery/SKILL.md +12 -11
- package/skills/prd/SKILL.md +14 -14
- package/skills/setup-ai-first/SKILL.md +7 -7
- package/skills/spec/SKILL.md +14 -14
- package/skills/test/SKILL.md +40 -38
- package/skills/test/SKILL.tmpl +9 -9
- package/steps/capture-lesson.md +1 -1
- package/steps/context-loader.md +5 -4
- package/steps/report-footer.md +7 -7
- package/steps/review-fanout.md +138 -0
- package/steps/spawn-agent.md +1 -1
- package/steps/trace-mirror.md +18 -0
- package/templates/design-spec.template.md +16 -8
- package/templates/product-definition.template.md +3 -3
- package/templates/project-context.yaml +4 -1
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Exhaustive Review Fan-Out + Completeness Convergence
|
|
2
|
+
|
|
3
|
+
**Why this exists:** A single-pass review never lists every issue at once — the model
|
|
4
|
+
stops at "enough" findings, so each later review round surfaces *new* problems
|
|
5
|
+
(whack-a-mole). This procedure forces the review to **converge in one command run**:
|
|
6
|
+
fan out across review dimensions in parallel, then loop a completeness critic until a
|
|
7
|
+
round produces nothing new, *before* writing the findings file.
|
|
8
|
+
|
|
9
|
+
The calling command supplies two things:
|
|
10
|
+
- **DIMENSIONS** — the list of review dimensions to fan out over
|
|
11
|
+
(`/refine-prd` → the 4 lenses; `/review-context` → the P-checks or B-checks).
|
|
12
|
+
- **FINDINGS SCHEMA** — the YAML shape each finding must follow (defined in the command).
|
|
13
|
+
|
|
14
|
+
> **Sub-agent mode bypass:** If Gate Step 0 set `_agent_mode: true`, this whole
|
|
15
|
+
> procedure is **skipped** — the orchestrator is already running one dimension/UC per
|
|
16
|
+
> sub-agent. Run the command's checks directly on the scoped section and return findings.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Phase 1 — Parallel dimension scan
|
|
21
|
+
|
|
22
|
+
**How many sub-agents:** the agent *count* is not the completeness lever — breadth is
|
|
23
|
+
fixed by the DIMENSION taxonomy (adding agents to the same dimension just re-finds the
|
|
24
|
+
same issues), and *depth* is owned by the Phase 2 critic loop. Pick the **fan-out
|
|
25
|
+
granularity** by target size, reusing the `steps/spawn-agent.md` thresholds:
|
|
26
|
+
|
|
27
|
+
| Target size | Granularity | Agent count |
|
|
28
|
+
|-------------|-------------|-------------|
|
|
29
|
+
| ≤ 3 UCs **and** ≤ 300 lines | one agent per DIMENSION over the whole file | = number of dimensions |
|
|
30
|
+
| > 3 UCs **or** > 300 lines | one agent per **DIMENSION × UC-scope** (UCs + a PRD-global scope), batched to fit the agent cap | `dimensions × (UCs + 1)`, capped (see below) |
|
|
31
|
+
|
|
32
|
+
The larger granularity keeps each sub-agent's context small and its scan exhaustive on a
|
|
33
|
+
single UC — which is what prevents misses on big PRDs.
|
|
34
|
+
|
|
35
|
+
> **Global (non-UC) sections — required in `DIMENSION × UC` mode.** Per-UC agents only
|
|
36
|
+
> see one UC each, so PRD-wide sections that belong to no UC (scope, success metrics,
|
|
37
|
+
> problem statement, terminology, glossary, changelog) would go unscanned. Whenever you
|
|
38
|
+
> fan out per UC, also include a **"PRD-global"** scope (the non-UC sections, findings get
|
|
39
|
+
> `uc_id: ""`) alongside the UC list. So the natural agent count is `dimensions × (UCs + 1)`.
|
|
40
|
+
> (Not needed in the whole-file mode — there each agent already sees the global sections.)
|
|
41
|
+
|
|
42
|
+
### Agent cap — batch UCs when the fan-out gets too wide
|
|
43
|
+
|
|
44
|
+
`dimensions × (UCs + 1)` can explode on large PRDs (e.g. 6 checks × (8 UCs + 1) = 54
|
|
45
|
+
agents). Cap the wave at **`AGENT_CAP = 12`** agents and batch UC scopes to fit:
|
|
46
|
+
|
|
47
|
+
1. Build the scope list = `[UC1, UC2, …, UCn, PRD-global]` (length `UCs + 1`).
|
|
48
|
+
2. Compute scopes-per-agent-bucket: `groups = max(1, floor(AGENT_CAP / dimensions))`.
|
|
49
|
+
- If `groups ≥ UCs + 1` → no batching needed, run one agent per `DIMENSION × scope`.
|
|
50
|
+
- Else split the scope list into `groups` contiguous buckets of roughly equal size
|
|
51
|
+
(keep `PRD-global` in its own bucket if it fits; otherwise append it to the last
|
|
52
|
+
bucket). Each agent then handles **one DIMENSION over one bucket of UCs**.
|
|
53
|
+
3. Resulting wave size = `dimensions × groups ≤ AGENT_CAP`.
|
|
54
|
+
|
|
55
|
+
A batched agent reviews several UCs at once — still scoped far tighter than the whole
|
|
56
|
+
file, so coverage stays high. `AGENT_CAP` is the only knob; raise it if the host allows
|
|
57
|
+
more concurrency, lower it to save tokens. Whole-file mode (≤ 3 UCs) never hits the cap.
|
|
58
|
+
|
|
59
|
+
Spawn the chosen sub-agents using the Agent tool (send them in a single message so they
|
|
60
|
+
run concurrently). Each sub-agent gets a **fresh context window** and scans its scope
|
|
61
|
+
through its **one** dimension only — deeper coverage than one session juggling every
|
|
62
|
+
dimension at once (avoids lost-in-the-middle).
|
|
63
|
+
|
|
64
|
+
Sub-agent prompt template (fill the braces):
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
You are a {DIMENSION_NAME} reviewer. Read the full target file at {target_file}.
|
|
68
|
+
Scope: review ONLY through the {DIMENSION_NAME} lens/check — {DIMENSION_DESCRIPTION}.
|
|
69
|
+
Be exhaustive: scan every section, every UC, every AC/BR/scenario. Do not stop early.
|
|
70
|
+
Project context (terminology, entities, architecture):
|
|
71
|
+
{slim_context — banned terms, canonical entities, layer order, domains}
|
|
72
|
+
|
|
73
|
+
Return a JSON array of findings, each:
|
|
74
|
+
{ "dimension": "{DIMENSION_NAME}", "severity": "critical|major|minor",
|
|
75
|
+
"section": "...", "uc_id": "...", "quote": "<verbatim ≤120 chars>",
|
|
76
|
+
"finding": "...", "suggestion": "...", "auto_fixable": true|false }
|
|
77
|
+
Return [] if this dimension is clean. Return ONLY the JSON array.
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Collect every sub-agent's array into one consolidated list `ALL_FINDINGS`.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Phase 2 — Completeness-critic convergence loop
|
|
85
|
+
|
|
86
|
+
This is the anti-whack-a-mole step. Repeat until **two consecutive rounds add zero new
|
|
87
|
+
findings**, or a hard cap of **3 rounds**, whichever comes first:
|
|
88
|
+
|
|
89
|
+
1. Spawn one **completeness-critic** sub-agent with the Agent tool. Give it:
|
|
90
|
+
- the full target file (`{target_file}`),
|
|
91
|
+
- the current `ALL_FINDINGS` list (so it knows what is already captured),
|
|
92
|
+
- the same slim context.
|
|
93
|
+
Prompt it:
|
|
94
|
+
```
|
|
95
|
+
Here is a document and a list of issues already found. Read the WHOLE document.
|
|
96
|
+
List ONLY real, additional issues NOT already in the list — gaps, ambiguities,
|
|
97
|
+
contradictions, missing edge/negative paths, coverage holes, terminology drift,
|
|
98
|
+
structural omissions, and any issue that a fix to an existing finding would expose.
|
|
99
|
+
Do NOT repeat anything already listed. Return the same finding JSON shape, or [] if
|
|
100
|
+
nothing new.
|
|
101
|
+
```
|
|
102
|
+
2. Append any genuinely new findings (not already in `ALL_FINDINGS`) to the list.
|
|
103
|
+
3. If this round returned 0 new → increment the dry-round counter; else reset it to 0.
|
|
104
|
+
4. Stop when dry-round counter reaches 2, or after 3 rounds total.
|
|
105
|
+
|
|
106
|
+
Record `convergence_rounds` (how many critic rounds ran) for the report.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Phase 3 — Dedup, resolve conflicts, merge
|
|
111
|
+
|
|
112
|
+
Sub-agents run **blind to each other** (independence = diverse coverage). They never
|
|
113
|
+
talk or reconcile among themselves — all duplicate/conflict resolution happens **here in
|
|
114
|
+
the orchestrator**, where the full set is visible.
|
|
115
|
+
|
|
116
|
+
1. **Deduplicate** `ALL_FINDINGS`: two findings are duplicates if they target the same
|
|
117
|
+
`section` + `uc_id` and describe the same underlying issue. Keep the one with the
|
|
118
|
+
richer `suggestion`; if they differ on severity, keep the **higher** severity.
|
|
119
|
+
2. **Resolve conflicts** — group remaining findings by `section` + `uc_id` and check for
|
|
120
|
+
contradictions (two findings whose `suggestion`s cannot both be applied, or that
|
|
121
|
+
propose opposite fixes for the same spot):
|
|
122
|
+
- If the two suggestions can be **merged** into one coherent fix → merge them into a
|
|
123
|
+
single finding.
|
|
124
|
+
- If they are **mutually exclusive** → emit **one** finding that states both options
|
|
125
|
+
and set `auto_fixable: false` with `status: "needs_discussion"` (PRD) /
|
|
126
|
+
`status: "pending"` (review) so a human picks — never silently drop one side.
|
|
127
|
+
- If a finding is **invalidated** by another (e.g. a structural finding says a section
|
|
128
|
+
is missing, but another quotes content from it) → drop the invalid one.
|
|
129
|
+
3. **Sort** by severity (critical → major → minor), then by `section` order in the file.
|
|
130
|
+
4. **Assign stable IDs** `F001, F002, …` in that sorted order.
|
|
131
|
+
5. Map each finding's `dimension` into the command's schema field
|
|
132
|
+
(`lens` for `/refine-prd`; `check_id` for `/review-context`).
|
|
133
|
+
6. Write the **single** findings file in the FINDINGS SCHEMA the command defines.
|
|
134
|
+
|
|
135
|
+
In the command's final report, add one line:
|
|
136
|
+
```
|
|
137
|
+
Convergence: {convergence_rounds} critic round(s) — findings file is complete; re-running should surface 0 new issues.
|
|
138
|
+
```
|
package/steps/spawn-agent.md
CHANGED
|
@@ -80,7 +80,7 @@ Build payload and invoke Agent tool for each UC:
|
|
|
80
80
|
}
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
> **Command scope**: Only `/generate-bdd` initiates orchestration mode. `/generate-code` and `/
|
|
83
|
+
> **Command scope**: Only `/generate-bdd` initiates orchestration mode. `/generate-code` and `/dev-gen-test` can run as sub-agents (they respect `_agent_mode: true` from Gate Step 0), but they do not spawn further sub-agents — their scope is already a single UC.
|
|
84
84
|
|
|
85
85
|
Serialize this JSON and pass as `$ARGUMENTS` when invoking the sub-agent command.
|
|
86
86
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Refresh Living Docs panel mirror *(local, umbrella mode)*
|
|
2
|
+
|
|
3
|
+
*Skip entirely in single-service mode (no `services` and no `setup.spec_source`) — there
|
|
4
|
+
the service `.trace/` IS the panel location, so nothing to mirror.*
|
|
5
|
+
|
|
6
|
+
After updating the authoritative service TSV(s) at `{paths.trace_dir}`:
|
|
7
|
+
|
|
8
|
+
1. Resolve `panel_mirror = ./.trace` at the **current workspace root** (where this command runs).
|
|
9
|
+
2. If `panel_mirror` resolves to a different path than `{paths.trace_dir}`, copy each
|
|
10
|
+
just-updated `{UC-ID}.tsv` → `{panel_mirror}/{service-name}/{UC-ID}.tsv`
|
|
11
|
+
(create the dir; overwrite). Use `active_service` for `{service-name}`.
|
|
12
|
+
|
|
13
|
+
This keeps the open workspace's Living Docs panel current **between syncs** — it is a
|
|
14
|
+
**local convenience mirror only**. The *canonical* report in the spec module
|
|
15
|
+
(`{spec_source}/.living-docs/`) and the merged `trace-report.json` are rebuilt by
|
|
16
|
+
`/sync` or `/validate-traces` (those need every service's data, so a single per-UC
|
|
17
|
+
command cannot produce them). For orchestrated commands, do this once in the orchestrator
|
|
18
|
+
after all sub-agents return — not inside each sub-agent.
|
|
@@ -14,6 +14,13 @@
|
|
|
14
14
|
- ⚠️ TODO → đánh dấu [TODO — chưa implement]
|
|
15
15
|
- ❌ Chưa có → đánh dấu [NEW — cần confirm với designer]
|
|
16
16
|
|
|
17
|
+
FIGMA LINKS (bắt buộc mỗi màn):
|
|
18
|
+
- Mỗi screen PHẢI có link Figma node-level (URL chứa ?node-id=...) — lấy bằng
|
|
19
|
+
right-click frame → "Copy link to selection". Đây là link AI đọc được qua Figma MCP.
|
|
20
|
+
- Link file trần (không có node-id) KHÔNG hợp lệ — AI không định vị được frame.
|
|
21
|
+
- Screen chưa có design → đánh dấu ❌ Missing; spec giữ Status "draft", chặn sign-off
|
|
22
|
+
và /generate-bdd cho tới khi đủ link.
|
|
23
|
+
|
|
17
24
|
SCREEN STATES (bắt buộc mỗi màn):
|
|
18
25
|
- Tối thiểu: default, loading, error
|
|
19
26
|
- Thêm "empty" nếu màn có thể hiển thị trạng thái không có dữ liệu
|
|
@@ -34,7 +41,7 @@
|
|
|
34
41
|
| **Service** | {active_service} |
|
|
35
42
|
| **Domain** | {domain} |
|
|
36
43
|
| **Business PRD** | [{TICKET-ID}](./{TICKET-ID}-slug.md) |
|
|
37
|
-
| **Figma** | {
|
|
44
|
+
| **Figma** | {feature file link} ({linked}/{N} frames linked) |
|
|
38
45
|
| **Author** | {PO name or "AI-assisted"} |
|
|
39
46
|
| **Created** | {YYYY-MM-DD} |
|
|
40
47
|
| **Updated** | {YYYY-MM-DD} |
|
|
@@ -43,10 +50,10 @@
|
|
|
43
50
|
|
|
44
51
|
# 1. Screen Inventory
|
|
45
52
|
|
|
46
|
-
| # | Screen Name | Entry Point | Figma Frame | Notes |
|
|
47
|
-
|
|
48
|
-
| 1 | {Screen 1} | {how user arrives} | [Frame]({
|
|
49
|
-
| 2 | {Screen 2} | {entry point} |
|
|
53
|
+
| # | Screen Name | Entry Point | Figma Frame (node-level link) | Notes |
|
|
54
|
+
|---|-------------|-------------|-------------------------------|-------|
|
|
55
|
+
| 1 | {Screen 1} | {how user arrives} | [Frame]({node-level url}) | |
|
|
56
|
+
| 2 | {Screen 2} | {entry point} | ❌ Missing — add node-id link | |
|
|
50
57
|
|
|
51
58
|
---
|
|
52
59
|
|
|
@@ -181,9 +188,10 @@
|
|
|
181
188
|
|
|
182
189
|
## Figma Summary
|
|
183
190
|
|
|
184
|
-
| Screen | Figma Frame
|
|
185
|
-
|
|
186
|
-
| {Screen 1} | [Link]({url})
|
|
191
|
+
| Screen | Figma Frame (node-level) | Link / Fetch Status |
|
|
192
|
+
|------------|--------------------------|--------------------------------|
|
|
193
|
+
| {Screen 1} | [Link]({node-level url}) | ✅ Linked & fetched |
|
|
194
|
+
| {Screen 2} | — | ❌ Missing — no node-id link |
|
|
187
195
|
|
|
188
196
|
## Design Tokens Referenced
|
|
189
197
|
|
|
@@ -50,7 +50,9 @@ paths:
|
|
|
50
50
|
# .agent/project-context.yaml to ".agent/project-lessons.md" (resolved per service_root).
|
|
51
51
|
lessons_file: "specs/domain-knowledge/lessons-learned.md"
|
|
52
52
|
|
|
53
|
-
# Tech Docs
|
|
53
|
+
# Tech Docs (BE-authored API contract).
|
|
54
|
+
# In umbrella mode with spec_source set, context-loader auto-routes this to
|
|
55
|
+
# {spec_source}/specs/tech-docs so FE/App read the contract via the spec submodule.
|
|
54
56
|
tech_docs_dir: "tech-docs"
|
|
55
57
|
|
|
56
58
|
# Design Specs (FE/App platforms only — web, app)
|
|
@@ -94,6 +96,7 @@ domains:
|
|
|
94
96
|
# When spec_source is set, context-loader auto-derives:
|
|
95
97
|
# prd_dir → {spec_source}/specs/prd
|
|
96
98
|
# design_spec_dir → {spec_source}/specs/design-spec
|
|
99
|
+
# tech_docs_dir → {spec_source}/specs/tech-docs # shared API contract (per-service tech_docs_dir below wins in multi-service)
|
|
97
100
|
# domain_knowledge_dir → {spec_source}/specs/domain-knowledge
|
|
98
101
|
# (You can still override these manually in paths: section below.)
|
|
99
102
|
#
|