@anhth2/spec-driven-dev-plugin 0.7.0 → 0.9.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.
Files changed (96) hide show
  1. package/ARCHITECTURE.md +6 -2
  2. package/bin/index.js +105 -0
  3. package/commands/debug.md +189 -1
  4. package/commands/debug.tmpl +16 -0
  5. package/commands/define-product.md +94 -1
  6. package/commands/fix-bug.md +190 -1
  7. package/commands/fix-bug.tmpl +17 -0
  8. package/commands/generate-bdd.md +314 -14
  9. package/commands/generate-bdd.tmpl +220 -13
  10. package/commands/generate-code.md +191 -3
  11. package/commands/generate-code.tmpl +97 -2
  12. package/commands/generate-design-spec.md +811 -0
  13. package/commands/generate-design-spec.tmpl +399 -0
  14. package/commands/generate-prd.md +133 -1
  15. package/commands/generate-prd.tmpl +39 -0
  16. package/commands/generate-spec-manifest.md +576 -0
  17. package/commands/generate-spec-manifest.tmpl +164 -0
  18. package/commands/generate-tech-docs.md +116 -2
  19. package/commands/generate-tech-docs.tmpl +22 -1
  20. package/commands/generate-tests.md +94 -1
  21. package/commands/learn.md +554 -0
  22. package/commands/learn.tmpl +63 -0
  23. package/commands/propose-scenario.md +521 -0
  24. package/commands/propose-scenario.tmpl +109 -0
  25. package/commands/refine-prd.md +94 -1
  26. package/commands/report-bug.md +543 -0
  27. package/commands/report-bug.tmpl +131 -0
  28. package/commands/review-code.md +190 -1
  29. package/commands/review-code.tmpl +17 -0
  30. package/commands/review-context.md +134 -1
  31. package/commands/review-context.tmpl +40 -0
  32. package/commands/review-tech-docs.md +176 -5
  33. package/commands/review-tech-docs.tmpl +82 -4
  34. package/commands/run-tests.md +119 -1
  35. package/commands/run-tests.tmpl +25 -0
  36. package/commands/setup-ai-first.md +142 -4
  37. package/commands/setup-ai-first.tmpl +135 -3
  38. package/commands/smoke-test.md +94 -1
  39. package/commands/sync.md +405 -0
  40. package/commands/sync.tmpl +345 -0
  41. package/commands/update-framework.md +211 -0
  42. package/commands/update-framework.tmpl +151 -0
  43. package/commands/validate-traces.md +152 -3
  44. package/commands/validate-traces.tmpl +58 -2
  45. package/core/FRAMEWORK_VERSION +1 -1
  46. package/core/commands/debug.md +189 -1
  47. package/core/commands/define-product.md +94 -1
  48. package/core/commands/fix-bug.md +190 -1
  49. package/core/commands/generate-bdd.md +314 -14
  50. package/core/commands/generate-code.md +191 -3
  51. package/core/commands/generate-design-spec.md +811 -0
  52. package/core/commands/generate-prd.md +133 -1
  53. package/core/commands/generate-spec-manifest.md +576 -0
  54. package/core/commands/generate-tech-docs.md +116 -2
  55. package/core/commands/generate-tests.md +94 -1
  56. package/core/commands/learn.md +554 -0
  57. package/core/commands/propose-scenario.md +521 -0
  58. package/core/commands/refine-prd.md +94 -1
  59. package/core/commands/report-bug.md +543 -0
  60. package/core/commands/review-code.md +190 -1
  61. package/core/commands/review-context.md +134 -1
  62. package/core/commands/review-tech-docs.md +176 -5
  63. package/core/commands/run-tests.md +119 -1
  64. package/core/commands/setup-ai-first.md +142 -4
  65. package/core/commands/smoke-test.md +94 -1
  66. package/core/commands/sync.md +405 -0
  67. package/core/commands/update-framework.md +211 -0
  68. package/core/commands/validate-traces.md +152 -3
  69. package/core/skills/code/SKILL.md +101 -2
  70. package/core/skills/debug/SKILL.md +108 -3
  71. package/core/skills/design-spec/SKILL.md +507 -0
  72. package/core/skills/discovery/SKILL.md +94 -1
  73. package/core/skills/prd/SKILL.md +14 -2
  74. package/core/skills/setup-ai-first/SKILL.md +7 -1
  75. package/core/skills/spec/SKILL.md +14 -2
  76. package/core/skills/test/SKILL.md +195 -3
  77. package/core/steps/capture-lesson.md +79 -0
  78. package/core/steps/context-loader.md +87 -0
  79. package/core/steps/report-footer.md +7 -1
  80. package/core/templates/design-spec.template.md +209 -0
  81. package/core/templates/project-context.yaml +40 -0
  82. package/package.json +1 -1
  83. package/skills/code/SKILL.md +101 -2
  84. package/skills/debug/SKILL.md +108 -3
  85. package/skills/design-spec/SKILL.md +507 -0
  86. package/skills/design-spec/SKILL.tmpl +95 -0
  87. package/skills/discovery/SKILL.md +94 -1
  88. package/skills/prd/SKILL.md +14 -2
  89. package/skills/setup-ai-first/SKILL.md +7 -1
  90. package/skills/spec/SKILL.md +14 -2
  91. package/skills/test/SKILL.md +195 -3
  92. package/steps/capture-lesson.md +79 -0
  93. package/steps/context-loader.md +87 -0
  94. package/steps/report-footer.md +7 -1
  95. package/templates/design-spec.template.md +209 -0
  96. package/templates/project-context.yaml +40 -0
@@ -0,0 +1,151 @@
1
+ # /update-framework — Update the Spec-Driven Dev Framework
2
+
3
+ Upgrades the **framework tooling** (`.agent/commands/`, `steps/`, `modules/`, `hooks/`, `rules/`, `templates/`, `skills/`) to the latest published version from npm.
4
+
5
+ > **Not the same as `/sync`.**
6
+ > - `/sync` → pulls **project content** (submodule code/specs) + refreshes Living Docs. Run daily.
7
+ > - `/update-framework` → upgrades the **framework command files themselves**. Run occasionally, when a new framework version ships.
8
+
9
+ This command wraps `npx @anhth2/spec-driven-dev-plugin@latest --init`. It requires network + npm access.
10
+
11
+ ---
12
+
13
+ ## Step 0 — Detect Current State
14
+
15
+ 1. Read `.agent/FRAMEWORK_VERSION` → current installed version.
16
+ - If missing → this project was not installed via `--init`. Stop:
17
+ ```
18
+ ❌ .agent/FRAMEWORK_VERSION not found.
19
+ This project was not set up with the framework installer.
20
+ Run: npx @anhth2/spec-driven-dev-plugin --init
21
+ ```
22
+
23
+ 2. Read `.agent/project-context.yaml` → extract `setup.mode` (`umbrella` / absent = single) and `services`.
24
+
25
+ 3. List `.agent/modules/` → record installed module names (these must be re-passed on upgrade so they update too).
26
+
27
+ Print:
28
+ ```
29
+ Current framework : v{current}
30
+ Mode : {umbrella | single-service}
31
+ Installed modules : {list or "none"}
32
+ ```
33
+
34
+ ---
35
+
36
+ ## Step 1 — Check Latest Version
37
+
38
+ Run:
39
+ ```bash
40
+ npm view @anhth2/spec-driven-dev-plugin version
41
+ ```
42
+
43
+ Compare `current` vs `latest`:
44
+
45
+ | Result | Action |
46
+ |--------|--------|
47
+ | Network/registry unreachable | Warn `⚠️ Could not reach npm registry — check connection.` and stop |
48
+ | `current == latest` | Print `✅ Already up to date (v{current}). Nothing to do.` and stop |
49
+ | `latest > current` | Print `Update available: v{current} → v{latest}` and continue |
50
+
51
+ Ask: `Proceed with upgrade? (Y/N)` — wait for `Y`.
52
+
53
+ ---
54
+
55
+ ## Step 2 — Umbrella Awareness *(umbrella mode only)*
56
+
57
+ If `setup.mode == umbrella`, print this note before upgrading:
58
+
59
+ ```
60
+ ℹ️ Umbrella mode — framework tooling lives ONLY at this umbrella root.
61
+ Service submodules contain just .agent/project-context.yaml (config), not
62
+ command files — they read commands from the umbrella root. No per-service
63
+ framework update is needed here.
64
+
65
+ Exception: if a teammate opens Claude Code directly INSIDE a service repo
66
+ (outside the umbrella), that repo has its own .agent/ — its owning team runs
67
+ /update-framework there independently.
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Step 3 — Pre-flight Git Check
73
+
74
+ Run `git status --short .agent/ .claude/commands/`.
75
+
76
+ If there are uncommitted changes in those paths:
77
+ ```
78
+ ⚠️ Uncommitted changes in .agent/ or .claude/commands/.
79
+ The upgrade overwrites framework files. Commit or stash first so you can
80
+ cleanly review the upgrade diff:
81
+ git add .agent/ .claude/commands/ && git commit -m "wip" (or git stash)
82
+ ```
83
+ Ask whether to continue anyway `(Y/N)`. Default to stopping.
84
+
85
+ ---
86
+
87
+ ## Step 4 — Run the Upgrade
88
+
89
+ Build the module flags from Step 0 (one `--module {name}` per installed module), then run:
90
+
91
+ ```bash
92
+ npx -y @anhth2/spec-driven-dev-plugin@latest --init {--module X ...}
93
+ ```
94
+
95
+ This **overwrites** (refreshes to the new version):
96
+ - `.agent/commands/`, `.agent/steps/`, `.agent/hooks/`, `.agent/rules/`, `.agent/templates/`, `.agent/skills/`, `.agent/modules/{installed}/`
97
+ - `.agent/FRAMEWORK_VERSION`
98
+ - `.claude/commands/` shortcuts
99
+
100
+ This **does NOT touch** (your content is safe):
101
+ - `.agent/project-context.yaml`
102
+ - `CLAUDE.md`
103
+ - `specs/domain-knowledge/` (business-dictionary, core-entities)
104
+ - `.trace/`
105
+
106
+ If the npx command exits non-zero → print the error and stop with `❌`.
107
+
108
+ ---
109
+
110
+ ## Step 5 — Review Changes
111
+
112
+ Run:
113
+ ```bash
114
+ git diff --stat .agent/ .claude/commands/
115
+ ```
116
+
117
+ Summarize for the user:
118
+ - **New commands** — `.md` files present now but not before
119
+ - **Updated commands** — files with changed content
120
+ - **Removed commands** — files deleted in the new version
121
+
122
+ If a new command appeared (e.g. a new slash command), call it out explicitly so the user knows it is now available.
123
+
124
+ ---
125
+
126
+ ## Output
127
+
128
+ {{include:steps/report-footer.md}}
129
+
130
+ ```
131
+ /update-framework — v{current} → v{latest}
132
+
133
+ ✅ Framework upgraded
134
+ Updated : {N} command files, {M} step files
135
+ New : {list any new commands, e.g. /some-new-command}
136
+ Removed : {list any removed commands, or "none"}
137
+
138
+ Your content was preserved:
139
+ project-context.yaml, CLAUDE.md, domain-knowledge/, .trace/ — untouched
140
+
141
+ Review & commit:
142
+ git diff .agent/
143
+ git add .agent/ .claude/commands/
144
+ git commit -m "chore: upgrade spec-driven-dev v{current} → v{latest}"
145
+ {umbrella mode: this is the umbrella root — service submodules need no framework update}
146
+
147
+ ---
148
+ Status : ✅ Complete | ⚠️ Warnings
149
+ Output Artifacts: refreshed .agent/ framework files, .claude/commands/ shortcuts
150
+ Next : review git diff, then commit | /sync to refresh project content
151
+ ```
@@ -133,6 +133,7 @@ Read `.agent/project-context.yaml`. Extract and store:
133
133
  - `paths.core_entities` → path to core-entities.md
134
134
  - `paths.tech_docs_dir` → technical documentation root
135
135
  - `paths.trace_dir` → trace state directory
136
+ - `paths.design_spec_dir` → Design Spec documents root (FE/App only)
136
137
 
137
138
  If `paths` section is absent, use these defaults:
138
139
  - `specs_dir` = `specs/bdd`
@@ -144,11 +145,75 @@ If `paths` section is absent, use these defaults:
144
145
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
145
146
  - `tech_docs_dir` = `specs/tech-docs`
146
147
  - `trace_dir` = `.trace`
148
+ - `design_spec_dir` = `specs/design-spec`
147
149
 
148
150
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
149
151
 
150
152
  ---
151
153
 
154
+ ## Step 1.5 — [SERVICE ROUTING] Resolve service paths (umbrella mode)
155
+
156
+ *Skip this step entirely if `setup.mode` is not `"umbrella"` and `services` section is absent from project-context.yaml.*
157
+
158
+ If `services` section is present:
159
+
160
+ **1. Detect active domain** (in priority order):
161
+ - Read `@trace.domain` from target file frontmatter (if Gate loaded a target file)
162
+ - Extract from target file path: segment immediately after `prd_dir` base path
163
+ *(e.g., `specs/prd/user/FEAT-01.md` → domain = `user`)*
164
+ - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
165
+
166
+ **2. Route to service** — if active domain matches a key in `services`:
167
+ - Override `paths.specs_dir` → `services.{domain}.specs_dir`
168
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
169
+ - Store `active_service` = `services.{domain}.path`
170
+ - Store `active_service_module` = `services.{domain}.module`
171
+ - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
172
+
173
+ **3. Fallback** — if domain not detected or no matching service key:
174
+ - Keep default paths from Step 1
175
+ - Set `active_service = unresolved`
176
+
177
+ **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
178
+ - Override `paths.prd_dir` → `{spec_source}/specs/prd`
179
+ - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
180
+ - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
181
+ - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
182
+ - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
183
+ - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
184
+ - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
185
+
186
+ > **Why under `spec_source`:** tester feedback (`/report-bug`, `/propose-scenario`) must land in the **shared spec repo** so PO/Dev see it when they `/sync`. In single-service mode (no `spec_source`), these default to `feedback/bug-reports` and `feedback/bdd-proposals` at repo root — still shared, same repo.
187
+
188
+ ---
189
+
190
+ ## Step 1.6 — [SERVICE CONVENTIONS] Load service-specific conventions (umbrella mode)
191
+
192
+ *Skip this step entirely if `active_service` is `"unresolved"` or context is single-service mode.*
193
+
194
+ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-service/`):
195
+
196
+ **1. Locate service config** — try in priority order:
197
+ - `{active_service}/.agent/project-context.yaml`
198
+ - `{active_service}/project-context.yaml`
199
+
200
+ **2. If found, override with service-specific values:**
201
+
202
+ | Variable | Source |
203
+ |----------|--------|
204
+ | `conventions.test_command` | service's `conventions.test_command` |
205
+ | `conventions.build_command` | service's `conventions.build_command` |
206
+ | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` — default: `{active_service}/.trace` |
207
+ | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
208
+
209
+ **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
210
+ - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
211
+ - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
212
+
213
+ **4. If service config not found** — keep umbrella defaults, still set `service_root = {active_service}` (path anchor is always needed even without a config override).
214
+
215
+ ---
216
+
152
217
  ## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
153
218
 
154
219
  If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
@@ -239,6 +304,25 @@ These two variables (`active_module`, `platform_type`) are the canonical source
239
304
 
240
305
  ---
241
306
 
307
+ ## Step 6.7 — [GUARDRAILS] Load Project Lessons (conditional)
308
+
309
+ *Accumulated mistakes the AI must not repeat in this project. These are added over time via `/learn`
310
+ or accepted during `/review-code`, `/fix-bug`, `/debug`.*
311
+
312
+ Resolve the lessons file path:
313
+ - Use `paths.lessons_file` if set (may be service-overridden in umbrella mode, Step 1.6)
314
+ - Else default `specs/domain-knowledge/lessons-learned.md`
315
+ - In umbrella/service mode (when `service_root` is set), if `paths.lessons_file` is unset, default to `{service_root}/.agent/project-lessons.md`
316
+
317
+ If the file exists, read it and store ALL lessons as **ACTIVE GUARDRAILS** for the session:
318
+ - Treat each lesson's **Rule** as a hard constraint — same priority as CLAUDE.md coding standards (Step 3).
319
+ - Before generating or modifying any artifact (PRD, BDD, tech-doc, code, test), check the output against every lesson whose `category` matches the current command AND whose `scope` matches the target (domain / file).
320
+ - If a generated output would violate a lesson → correct it **before** presenting, and note which lesson (`L-NNN`) was applied.
321
+
322
+ If the file does not exist → skip silently (no lessons captured yet).
323
+
324
+ ---
325
+
242
326
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
243
327
 
244
328
  After loading all context, synthesize and output a compact summary block.
@@ -254,6 +338,9 @@ Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Ser
254
338
  Ticket : {ticket_prefix}-
255
339
  Dict : {loaded — N canonical terms, M banned terms | missing}
256
340
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
341
+ Lessons : {loaded — N guardrails | none yet}
342
+ Service : {active_service} ({active_service_module}) | single-service
343
+ Svc Root : {service_root} — conventions + trace_dir loaded from service config | —
257
344
  Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
258
345
  ```
259
346
 
@@ -279,12 +366,33 @@ Proceed to the next step of the calling command.
279
366
 
280
367
  ## Process
281
368
 
369
+ ### Step 0 — Umbrella Mode Detection
370
+
371
+ Check whether `services` array exists in `project-context.yaml`.
372
+
373
+ **If `services` exists (umbrella mode):**
374
+ - Resolve the trace dir for each service:
375
+ - Use `services[N].trace_dir` if explicitly set
376
+ - Otherwise default to `{services[N].path}/.trace`
377
+ - Set `all_trace_dirs = [ dir1, dir2, ... ]` — one per service
378
+ - Set `umbrella_root_trace = ".trace"` (at umbrella workspace root)
379
+ - Step 1 will read TSVs from ALL dirs in `all_trace_dirs`, tagged by service name
380
+
381
+ **If no `services` key (single-service mode):**
382
+ - Set `all_trace_dirs = [ {paths.trace_dir} ]`
383
+ - No umbrella sync needed
384
+
385
+ ---
386
+
282
387
  ### Step 1 — Load TSV data
283
388
 
284
- Read all `{paths.trace_dir}/{UC-ID}.tsv` files matching the target domain (or all domains if no domain filter).
389
+ **Umbrella mode:** read all `{trace_dir}/{UC-ID}.tsv` files from every dir in `all_trace_dirs`. For each TSV, tag its rows with the originating service name.
390
+
391
+ **Single-service mode:** read all `{paths.trace_dir}/{UC-ID}.tsv` files matching the target domain (or all domains if no domain filter).
392
+
285
393
  Each file gives the persisted trace state for that UC.
286
394
 
287
- **If no `.tsv` files found** in `{paths.trace_dir}`:
395
+ **If no `.tsv` files found** in any of the trace dirs:
288
396
  - Scan all `{paths.specs_dir}/**/*.feature` files in the target domain to build an in-memory list of all scenarios.
289
397
  - Treat all scenarios as `UNTRACKED` (no code generated yet).
290
398
  - Print: "⚠️ No trace files found. All {N} scenarios across {M} UCs are UNTRACKED."
@@ -464,6 +572,36 @@ Schema:
464
572
  - Always write to `{paths.trace_dir}/trace-report.json` regardless of domain filter — if a domain filter was applied, include only those PRDs in `prds[]` but note the domain in the `domain` field
465
573
  - **TSV `"—"` mapping**: when reading TSV files, map dash values to JSON types: `implemented_by: "—"` → `null`; `test_count: "—"` → `0`; `test_classes: "—"` → `[]`; `tech_doc_revision: "—"` → `0`
466
574
 
575
+ ### Step 8b — Umbrella Living Docs Sync *(umbrella mode only)*
576
+
577
+ *Skip this step in single-service mode.*
578
+
579
+ After writing each service's `trace-report.json`, sync trace files to the umbrella root so the Living Docs VS Code panel (opened at umbrella root) can read them:
580
+
581
+ 1. Create directory `{umbrella_root_trace}/` if it does not exist (`mkdir -p .trace`).
582
+
583
+ 2. **Copy TSV files** from each service trace dir to umbrella trace dir with service namespace:
584
+ ```
585
+ {service.path}/.trace/{UC-ID}.tsv → .trace/{service-name}/{UC-ID}.tsv
586
+ ```
587
+ Overwrite if exists. Do not delete files in `.trace/` that no longer have a service source — they may be from a previous run.
588
+
589
+ 3. **Write aggregated `trace-report.json`** to `{umbrella_root_trace}/trace-report.json`:
590
+ - Merge all per-service `trace-report.json` data into one document
591
+ - Add `"service"` field to each scenario row
592
+ - Recalculate summary aggregates across all services
593
+
594
+ 4. **Print sync summary:**
595
+ ```
596
+ Umbrella sync → .trace/
597
+ user-service : {N} TSV files copied
598
+ order-service : {N} TSV files copied
599
+ trace-report.json: merged ({total} scenarios across {S} services)
600
+ Living Docs panel will reflect this data immediately.
601
+ ```
602
+
603
+ > **Note:** `.trace/` at umbrella root is a **read-only mirror** — do NOT commit it to the umbrella repo. Add `.trace/` to the umbrella's `.gitignore`. Authoritative trace state lives in each service submodule's `.trace/` dir and is committed there.
604
+
467
605
  ## Output
468
606
 
469
607
  # Report Footer — Standard Command Output Format
@@ -498,7 +636,8 @@ Suggest the logical next command based on workflow phase:
498
636
  | /define-product | `/generate-prd {product-definition-file}` |
499
637
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
500
638
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
501
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
639
+ | /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
640
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
502
641
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
503
642
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
504
643
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -512,6 +651,11 @@ Suggest the logical next command based on workflow phase:
512
651
  | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
513
652
  | /fix-bug | Create PR and link to ticket |
514
653
  | /debug | `/fix-bug {ticket-id}` if fix needed |
654
+ | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
655
+ | /propose-scenario | Notify PO/Dev to review the proposal in `feedback/bdd-proposals/` |
656
+ | /learn | Continue working — lesson applies on next command |
657
+ | /sync | `/validate-traces` for full coverage; act on any `📥 tester feedback` surfaced |
658
+ | /update-framework | Review `git diff .agent/`, commit; `/sync` for project content |
515
659
 
516
660
  Format the footer as:
517
661
  ```
@@ -559,4 +703,9 @@ Recommendations:
559
703
  - /generate-code {UC-ID} for DRIFT and UNTRACKED scenarios
560
704
  - /generate-tests {UC-ID} for GAP (missing tests)
561
705
  - /generate-bdd {prd-file} for PRD version drift
706
+
707
+ [Umbrella mode only]
708
+ Living Docs synced → .trace/ (umbrella root)
709
+ Tip: run /validate-traces after each codegen session to refresh the panel.
710
+ .trace/ at umbrella root is a mirror — do not commit it (add to .gitignore).
562
711
  ```
@@ -14,12 +14,33 @@ Read-only check of coverage between specs, code, and tests — including PRD ver
14
14
 
15
15
  ## Process
16
16
 
17
+ ### Step 0 — Umbrella Mode Detection
18
+
19
+ Check whether `services` array exists in `project-context.yaml`.
20
+
21
+ **If `services` exists (umbrella mode):**
22
+ - Resolve the trace dir for each service:
23
+ - Use `services[N].trace_dir` if explicitly set
24
+ - Otherwise default to `{services[N].path}/.trace`
25
+ - Set `all_trace_dirs = [ dir1, dir2, ... ]` — one per service
26
+ - Set `umbrella_root_trace = ".trace"` (at umbrella workspace root)
27
+ - Step 1 will read TSVs from ALL dirs in `all_trace_dirs`, tagged by service name
28
+
29
+ **If no `services` key (single-service mode):**
30
+ - Set `all_trace_dirs = [ {paths.trace_dir} ]`
31
+ - No umbrella sync needed
32
+
33
+ ---
34
+
17
35
  ### Step 1 — Load TSV data
18
36
 
19
- Read all `{paths.trace_dir}/{UC-ID}.tsv` files matching the target domain (or all domains if no domain filter).
37
+ **Umbrella mode:** read all `{trace_dir}/{UC-ID}.tsv` files from every dir in `all_trace_dirs`. For each TSV, tag its rows with the originating service name.
38
+
39
+ **Single-service mode:** read all `{paths.trace_dir}/{UC-ID}.tsv` files matching the target domain (or all domains if no domain filter).
40
+
20
41
  Each file gives the persisted trace state for that UC.
21
42
 
22
- **If no `.tsv` files found** in `{paths.trace_dir}`:
43
+ **If no `.tsv` files found** in any of the trace dirs:
23
44
  - Scan all `{paths.specs_dir}/**/*.feature` files in the target domain to build an in-memory list of all scenarios.
24
45
  - Treat all scenarios as `UNTRACKED` (no code generated yet).
25
46
  - Print: "⚠️ No trace files found. All {N} scenarios across {M} UCs are UNTRACKED."
@@ -199,6 +220,36 @@ Schema:
199
220
  - Always write to `{paths.trace_dir}/trace-report.json` regardless of domain filter — if a domain filter was applied, include only those PRDs in `prds[]` but note the domain in the `domain` field
200
221
  - **TSV `"—"` mapping**: when reading TSV files, map dash values to JSON types: `implemented_by: "—"` → `null`; `test_count: "—"` → `0`; `test_classes: "—"` → `[]`; `tech_doc_revision: "—"` → `0`
201
222
 
223
+ ### Step 8b — Umbrella Living Docs Sync *(umbrella mode only)*
224
+
225
+ *Skip this step in single-service mode.*
226
+
227
+ After writing each service's `trace-report.json`, sync trace files to the umbrella root so the Living Docs VS Code panel (opened at umbrella root) can read them:
228
+
229
+ 1. Create directory `{umbrella_root_trace}/` if it does not exist (`mkdir -p .trace`).
230
+
231
+ 2. **Copy TSV files** from each service trace dir to umbrella trace dir with service namespace:
232
+ ```
233
+ {service.path}/.trace/{UC-ID}.tsv → .trace/{service-name}/{UC-ID}.tsv
234
+ ```
235
+ Overwrite if exists. Do not delete files in `.trace/` that no longer have a service source — they may be from a previous run.
236
+
237
+ 3. **Write aggregated `trace-report.json`** to `{umbrella_root_trace}/trace-report.json`:
238
+ - Merge all per-service `trace-report.json` data into one document
239
+ - Add `"service"` field to each scenario row
240
+ - Recalculate summary aggregates across all services
241
+
242
+ 4. **Print sync summary:**
243
+ ```
244
+ Umbrella sync → .trace/
245
+ user-service : {N} TSV files copied
246
+ order-service : {N} TSV files copied
247
+ trace-report.json: merged ({total} scenarios across {S} services)
248
+ Living Docs panel will reflect this data immediately.
249
+ ```
250
+
251
+ > **Note:** `.trace/` at umbrella root is a **read-only mirror** — do NOT commit it to the umbrella repo. Add `.trace/` to the umbrella's `.gitignore`. Authoritative trace state lives in each service submodule's `.trace/` dir and is committed there.
252
+
202
253
  ## Output
203
254
 
204
255
  {{include:steps/report-footer.md}}
@@ -240,4 +291,9 @@ Recommendations:
240
291
  - /generate-code {UC-ID} for DRIFT and UNTRACKED scenarios
241
292
  - /generate-tests {UC-ID} for GAP (missing tests)
242
293
  - /generate-bdd {prd-file} for PRD version drift
294
+
295
+ [Umbrella mode only]
296
+ Living Docs synced → .trace/ (umbrella root)
297
+ Tip: run /validate-traces after each codegen session to refresh the panel.
298
+ .trace/ at umbrella root is a mirror — do not commit it (add to .gitignore).
243
299
  ```
@@ -1 +1 @@
1
- 0.7.0
1
+ 0.9.0