@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.
Files changed (124) hide show
  1. package/ARCHITECTURE.md +20 -9
  2. package/bin/index.js +1 -2
  3. package/commands/debug.md +13 -12
  4. package/commands/define-product.md +12 -11
  5. package/commands/{generate-tests.md → dev-gen-test.md} +48 -15
  6. package/commands/{generate-tests.tmpl → dev-gen-test.tmpl} +18 -4
  7. package/{core/commands/run-tests.md → commands/dev-run-test.md} +62 -13
  8. package/commands/{run-tests.tmpl → dev-run-test.tmpl} +32 -2
  9. package/{core/commands/smoke-test.md → commands/dev-smoke-test.md} +17 -16
  10. package/commands/{smoke-test.tmpl → dev-smoke-test.tmpl} +5 -5
  11. package/commands/fix-bug.md +13 -12
  12. package/commands/generate-bdd.md +39 -13
  13. package/commands/generate-bdd.tmpl +9 -2
  14. package/commands/generate-code.md +86 -15
  15. package/commands/generate-code.tmpl +56 -4
  16. package/commands/generate-design-spec.md +105 -39
  17. package/commands/generate-design-spec.tmpl +93 -28
  18. package/commands/generate-prd.md +12 -11
  19. package/commands/generate-spec-manifest.md +12 -11
  20. package/commands/generate-tech-docs.md +63 -22
  21. package/commands/generate-tech-docs.tmpl +51 -11
  22. package/commands/learn.md +13 -12
  23. package/commands/propose-scenario.md +13 -12
  24. package/commands/propose-scenario.tmpl +1 -1
  25. package/commands/refine-prd.md +166 -16
  26. package/commands/refine-prd.tmpl +16 -5
  27. package/commands/report-bug.md +12 -11
  28. package/commands/review-code.md +14 -13
  29. package/commands/review-code.tmpl +1 -1
  30. package/commands/review-context.md +161 -12
  31. package/commands/review-context.tmpl +11 -1
  32. package/commands/review-tech-docs.md +13 -11
  33. package/commands/review-tech-docs.tmpl +1 -0
  34. package/commands/setup-ai-first.md +7 -7
  35. package/commands/sync.md +23 -20
  36. package/commands/sync.tmpl +16 -13
  37. package/commands/update-framework.md +7 -7
  38. package/commands/validate-traces.md +57 -37
  39. package/commands/validate-traces.tmpl +45 -26
  40. package/core/FRAMEWORK_VERSION +1 -1
  41. package/core/commands/debug.md +13 -12
  42. package/core/commands/define-product.md +12 -11
  43. package/core/commands/{generate-tests.md → dev-gen-test.md} +48 -15
  44. package/{commands/run-tests.md → core/commands/dev-run-test.md} +62 -13
  45. package/{commands/smoke-test.md → core/commands/dev-smoke-test.md} +17 -16
  46. package/core/commands/fix-bug.md +13 -12
  47. package/core/commands/generate-bdd.md +39 -13
  48. package/core/commands/generate-code.md +86 -15
  49. package/core/commands/generate-design-spec.md +105 -39
  50. package/core/commands/generate-prd.md +12 -11
  51. package/core/commands/generate-spec-manifest.md +12 -11
  52. package/core/commands/generate-tech-docs.md +63 -22
  53. package/core/commands/learn.md +13 -12
  54. package/core/commands/propose-scenario.md +13 -12
  55. package/core/commands/refine-prd.md +166 -16
  56. package/core/commands/report-bug.md +12 -11
  57. package/core/commands/review-code.md +14 -13
  58. package/core/commands/review-context.md +161 -12
  59. package/core/commands/review-tech-docs.md +13 -11
  60. package/core/commands/setup-ai-first.md +7 -7
  61. package/core/commands/sync.md +23 -20
  62. package/core/commands/update-framework.md +7 -7
  63. package/core/commands/validate-traces.md +57 -37
  64. package/core/modules/android-compose/module.yaml +13 -0
  65. package/core/modules/android-compose/stack-profile.yaml +57 -0
  66. package/core/modules/flutter/module.yaml +14 -0
  67. package/core/modules/flutter/stack-profile.yaml +59 -0
  68. package/core/modules/ios-swiftui/module.yaml +13 -0
  69. package/core/modules/ios-swiftui/stack-profile.yaml +55 -0
  70. package/core/modules/nuxt/module.yaml +14 -0
  71. package/core/modules/nuxt/stack-profile.yaml +58 -0
  72. package/core/modules/react-native/module.yaml +14 -0
  73. package/core/modules/react-native/stack-profile.yaml +56 -0
  74. package/core/modules/vue/module.yaml +14 -0
  75. package/core/modules/vue/stack-profile.yaml +65 -0
  76. package/core/skills/code/SKILL.md +19 -18
  77. package/core/skills/debug/SKILL.md +27 -26
  78. package/core/skills/design-spec/SKILL.md +12 -11
  79. package/core/skills/discovery/SKILL.md +12 -11
  80. package/core/skills/prd/SKILL.md +14 -14
  81. package/core/skills/setup-ai-first/SKILL.md +7 -7
  82. package/core/skills/spec/SKILL.md +14 -14
  83. package/core/skills/test/SKILL.md +40 -38
  84. package/core/steps/capture-lesson.md +1 -1
  85. package/core/steps/context-loader.md +5 -4
  86. package/core/steps/report-footer.md +7 -7
  87. package/core/steps/review-fanout.md +138 -0
  88. package/core/steps/spawn-agent.md +1 -1
  89. package/core/steps/trace-mirror.md +18 -0
  90. package/core/templates/design-spec.template.md +16 -8
  91. package/core/templates/product-definition.template.md +3 -3
  92. package/core/templates/project-context.yaml +4 -1
  93. package/modules/android-compose/module.yaml +13 -0
  94. package/modules/android-compose/stack-profile.yaml +57 -0
  95. package/modules/flutter/module.yaml +14 -0
  96. package/modules/flutter/stack-profile.yaml +59 -0
  97. package/modules/ios-swiftui/module.yaml +13 -0
  98. package/modules/ios-swiftui/stack-profile.yaml +55 -0
  99. package/modules/nuxt/module.yaml +14 -0
  100. package/modules/nuxt/stack-profile.yaml +58 -0
  101. package/modules/react-native/module.yaml +14 -0
  102. package/modules/react-native/stack-profile.yaml +56 -0
  103. package/modules/vue/module.yaml +14 -0
  104. package/modules/vue/stack-profile.yaml +65 -0
  105. package/package.json +1 -1
  106. package/skills/code/SKILL.md +19 -18
  107. package/skills/debug/SKILL.md +27 -26
  108. package/skills/debug/SKILL.tmpl +1 -1
  109. package/skills/design-spec/SKILL.md +12 -11
  110. package/skills/discovery/SKILL.md +12 -11
  111. package/skills/prd/SKILL.md +14 -14
  112. package/skills/setup-ai-first/SKILL.md +7 -7
  113. package/skills/spec/SKILL.md +14 -14
  114. package/skills/test/SKILL.md +40 -38
  115. package/skills/test/SKILL.tmpl +9 -9
  116. package/steps/capture-lesson.md +1 -1
  117. package/steps/context-loader.md +5 -4
  118. package/steps/report-footer.md +7 -7
  119. package/steps/review-fanout.md +138 -0
  120. package/steps/spawn-agent.md +1 -1
  121. package/steps/trace-mirror.md +18 -0
  122. package/templates/design-spec.template.md +16 -8
  123. package/templates/product-definition.template.md +3 -3
  124. package/templates/project-context.yaml +4 -1
@@ -1,4 +1,10 @@
1
- # /run-tests — Run Tests & Report Results
1
+ # /dev-run-test — Run Dev Self-Check Tests & Report Results
2
+
3
+ > **Scope — dev self-check (smoke), not the official test suite.** Runs the tests produced
4
+ > by `/dev-gen-test` so the developer can confirm their own code works before review. This
5
+ > is a developer self-check, **not** the QC/dev-team's authoritative test run (separate flow).
6
+ > The pass/fail is published to Living Docs as a **dev self-test** signal — it tells QC the
7
+ > dev ran their checks; it is NOT a statement of official test coverage.
2
8
 
3
9
  ## Gate
4
10
  # Gate — Universal Entry Procedure
@@ -163,7 +169,7 @@ If `services` section is present:
163
169
 
164
170
  **2. Route to service** — if active domain matches a key in `services`:
165
171
  - Override `paths.specs_dir` → `services.{domain}.specs_dir`
166
- - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
172
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, the tech-design (API contract) is a cross-team artifact and must live in the shared spec repo (handled in step 4), so leave `tech_docs_dir` for step 4 to route — do NOT pin it per-service here.
167
173
  - Store `active_service` = `services.{domain}.path`
168
174
  - Store `active_service_module` = `services.{domain}.module`
169
175
  - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
@@ -175,13 +181,14 @@ If `services` section is present:
175
181
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
176
182
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
177
183
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
184
+ - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **always when `spec_source` is set** (step 2 no longer pins tech-docs per-service in this case). The tech-design IS the cross-team API contract: BE authors it here, and FE/App read it from the same spec submodule at `/generate-code --phase=integration`. *(Per-service tech-docs only happen when there is no `spec_source` — a pure multi-service BE repo with no shared spec module.)*
178
185
  - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
179
186
  - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
180
187
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
181
188
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
182
189
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
183
190
 
184
- > **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.
191
+ > **Why under `spec_source`:** PRD, design-spec, domain knowledge, the **API contract (tech-docs)**, and tester feedback are all **cross-team artifacts** — they must live in the **shared spec repo** so every umbrella (FE/App/BE) reads the same source via `/sync`. Tech-docs specifically: BE authors the tech-design (API contract), commits + pushes it into the spec submodule (2-layer commit), and FE/App pull it on their next `/sync` to wire the real API in `/generate-code --phase=integration`. In single-service mode (no `spec_source`), these default under the repo root — still shared, same repo.
185
192
 
186
193
  ---
187
194
 
@@ -205,7 +212,7 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
205
212
  | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
206
213
 
207
214
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
208
- - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
215
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
209
216
  - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
210
217
 
211
218
  **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).
@@ -298,7 +305,7 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
298
305
 
299
306
  If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
300
307
 
301
- These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
308
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (dev-gen-test, debug, fix-bug, dev-smoke-test).
302
309
 
303
310
  ---
304
311
 
@@ -522,6 +529,44 @@ xcodebuild test -scheme {Scheme} -destination 'platform=iOS Simulator,name=iPhon
522
529
 
523
530
  ---
524
531
 
532
+ ## Write Trace State
533
+
534
+ After the run, persist results to the **authoritative TSV** in the service so they reach
535
+ the Living Docs report at the spec module (via `/sync` + `/validate-traces`). The test
536
+ files themselves stay in the service — only the run *status* is reported.
537
+
538
+ Update `{paths.trace_dir}/{UC-ID}.tsv` — for each scenario row (matched by `sc_id` via its
539
+ test's `@trace.verifies={UC-ID}-SC{N}` tag):
540
+
541
+ | Column | Value |
542
+ |--------|-------|
543
+ | `dev_selftest` | `pass` if all tests for this SC passed · `fail` if any failed · `not_run` if its tests were skipped/absent |
544
+ | `dev_selftest_at` | today `YYYY-MM-DD` |
545
+
546
+ Leave all other columns unchanged. `dev_selftest`/`dev_selftest_at` are orthogonal to `status`
547
+ (OK/GAP/DRIFT/UNTRACKED): `status` tracks *coverage*, `dev_selftest` tracks the latest *run result*.
548
+
549
+ ## Refresh Panel Mirror
550
+ # Refresh Living Docs panel mirror *(local, umbrella mode)*
551
+
552
+ *Skip entirely in single-service mode (no `services` and no `setup.spec_source`) — there
553
+ the service `.trace/` IS the panel location, so nothing to mirror.*
554
+
555
+ After updating the authoritative service TSV(s) at `{paths.trace_dir}`:
556
+
557
+ 1. Resolve `panel_mirror = ./.trace` at the **current workspace root** (where this command runs).
558
+ 2. If `panel_mirror` resolves to a different path than `{paths.trace_dir}`, copy each
559
+ just-updated `{UC-ID}.tsv` → `{panel_mirror}/{service-name}/{UC-ID}.tsv`
560
+ (create the dir; overwrite). Use `active_service` for `{service-name}`.
561
+
562
+ This keeps the open workspace's Living Docs panel current **between syncs** — it is a
563
+ **local convenience mirror only**. The *canonical* report in the spec module
564
+ (`{spec_source}/.living-docs/`) and the merged `trace-report.json` are rebuilt by
565
+ `/sync` or `/validate-traces` (those need every service's data, so a single per-UC
566
+ command cannot produce them). For orchestrated commands, do this once in the orchestrator
567
+ after all sub-agents return — not inside each sub-agent.
568
+
569
+
525
570
  ## Output
526
571
 
527
572
  # Report Footer — Standard Command Output Format
@@ -562,13 +607,13 @@ Suggest the logical next command based on workflow phase:
562
607
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
563
608
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
564
609
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
565
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
566
- | /generate-tests | `/run-tests {UC-ID}` |
567
- | /run-tests (passing) | `/review-code {UC-ID}` |
568
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
569
- | /review-code | `/smoke-test {UC-ID}` or create PR |
570
- | /smoke-test | Create PR and link to ticket |
571
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
610
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
611
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
612
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
613
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
614
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
615
+ | /dev-smoke-test | Create PR and link to ticket |
616
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
572
617
  | /fix-bug | Create PR and link to ticket |
573
618
  | /debug | `/fix-bug {ticket-id}` if fix needed |
574
619
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -587,7 +632,7 @@ Next : {suggested command with example arguments}
587
632
 
588
633
 
589
634
  ```
590
- /run-tests Report — {UC-ID} ({active_module})
635
+ /dev-run-test Report — {UC-ID} ({active_module})
591
636
  ✅ Passed: {N} | ❌ Failed: {M} | ⏭️ Skipped: {K} | Duration: {X}s
592
637
 
593
638
  ## Failed Tests
@@ -597,7 +642,11 @@ Next : {suggested command with example arguments}
597
642
  ## Recommendations
598
643
  {specific fix per failure}
599
644
 
645
+ Trace: {paths.trace_dir}/{UC-ID}.tsv updated (dev_selftest, dev_selftest_at)
646
+
600
647
  Next:
601
648
  All tests pass → /review-code {UC-ID}
602
649
  Tests fail → /fix-bug {TICKET_ID} (real bug) or fix test (wrong expectation)
650
+
651
+ 📊 Living Docs: run /validate-traces (or /sync) to push this trace to the spec-module dashboard.
603
652
  ```
@@ -1,6 +1,6 @@
1
- # /smoke-test — Smoke Test Live Service or App
1
+ # /dev-smoke-test — Smoke Test Live Service or App
2
2
 
3
- Use when service/app is **already running**. Different from `/run-tests` (no live server needed).
3
+ Use when service/app is **already running**. Different from `/dev-run-test` (no live server needed).
4
4
 
5
5
  ## Gate
6
6
  # Gate — Universal Entry Procedure
@@ -165,7 +165,7 @@ If `services` section is present:
165
165
 
166
166
  **2. Route to service** — if active domain matches a key in `services`:
167
167
  - Override `paths.specs_dir` → `services.{domain}.specs_dir`
168
- - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
168
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, the tech-design (API contract) is a cross-team artifact and must live in the shared spec repo (handled in step 4), so leave `tech_docs_dir` for step 4 to route — do NOT pin it per-service here.
169
169
  - Store `active_service` = `services.{domain}.path`
170
170
  - Store `active_service_module` = `services.{domain}.module`
171
171
  - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
@@ -177,13 +177,14 @@ If `services` section is present:
177
177
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
178
178
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
179
179
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
180
+ - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **always when `spec_source` is set** (step 2 no longer pins tech-docs per-service in this case). The tech-design IS the cross-team API contract: BE authors it here, and FE/App read it from the same spec submodule at `/generate-code --phase=integration`. *(Per-service tech-docs only happen when there is no `spec_source` — a pure multi-service BE repo with no shared spec module.)*
180
181
  - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
181
182
  - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
182
183
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
183
184
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
184
185
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
185
186
 
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
+ > **Why under `spec_source`:** PRD, design-spec, domain knowledge, the **API contract (tech-docs)**, and tester feedback are all **cross-team artifacts** — they must live in the **shared spec repo** so every umbrella (FE/App/BE) reads the same source via `/sync`. Tech-docs specifically: BE authors the tech-design (API contract), commits + pushes it into the spec submodule (2-layer commit), and FE/App pull it on their next `/sync` to wire the real API in `/generate-code --phase=integration`. In single-service mode (no `spec_source`), these default under the repo root — still shared, same repo.
187
188
 
188
189
  ---
189
190
 
@@ -207,7 +208,7 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
207
208
  | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
208
209
 
209
210
  **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
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
211
212
  - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
212
213
 
213
214
  **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).
@@ -300,7 +301,7 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
300
301
 
301
302
  If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
302
303
 
303
- These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
304
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (dev-gen-test, debug, fix-bug, dev-smoke-test).
304
305
 
305
306
  ---
306
307
 
@@ -366,7 +367,7 @@ Proceed to the next step of the calling command.
366
367
 
367
368
  ## Service Detection
368
369
 
369
- Read `active_module` from context. Use to select the correct smoke-test approach.
370
+ Read `active_module` from context. Use to select the correct dev-smoke-test approach.
370
371
 
371
372
  | Platform | Modules |
372
373
  |---|---|
@@ -526,7 +527,7 @@ npx react-native run-ios # build + install on iOS simulator
526
527
  # Open Xcode → select simulator → Product → Run
527
528
  ```
528
529
 
529
- ### Phase 2 — Manual smoke-test checklist
530
+ ### Phase 2 — Manual dev-smoke-test checklist
530
531
 
531
532
  For the UC under test, verify on device:
532
533
  1. Navigate to the screen for this UC
@@ -591,13 +592,13 @@ Suggest the logical next command based on workflow phase:
591
592
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
592
593
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
593
594
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
594
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
595
- | /generate-tests | `/run-tests {UC-ID}` |
596
- | /run-tests (passing) | `/review-code {UC-ID}` |
597
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
598
- | /review-code | `/smoke-test {UC-ID}` or create PR |
599
- | /smoke-test | Create PR and link to ticket |
600
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
595
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
596
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
597
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
598
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
599
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
600
+ | /dev-smoke-test | Create PR and link to ticket |
601
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
601
602
  | /fix-bug | Create PR and link to ticket |
602
603
  | /debug | `/fix-bug {ticket-id}` if fix needed |
603
604
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -616,7 +617,7 @@ Next : {suggested command with example arguments}
616
617
 
617
618
 
618
619
  ```
619
- /smoke-test Report — {UC-ID}
620
+ /dev-smoke-test Report — {UC-ID}
620
621
  Platform: {backend | web-frontend | mobile}
621
622
  | Endpoint / Flow | Status | Result |
622
623
  |-----------------------|-------------|---------|
@@ -163,7 +163,7 @@ If `services` section is present:
163
163
 
164
164
  **2. Route to service** — if active domain matches a key in `services`:
165
165
  - Override `paths.specs_dir` → `services.{domain}.specs_dir`
166
- - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
166
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, the tech-design (API contract) is a cross-team artifact and must live in the shared spec repo (handled in step 4), so leave `tech_docs_dir` for step 4 to route — do NOT pin it per-service here.
167
167
  - Store `active_service` = `services.{domain}.path`
168
168
  - Store `active_service_module` = `services.{domain}.module`
169
169
  - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
@@ -175,13 +175,14 @@ If `services` section is present:
175
175
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
176
176
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
177
177
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
178
+ - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **always when `spec_source` is set** (step 2 no longer pins tech-docs per-service in this case). The tech-design IS the cross-team API contract: BE authors it here, and FE/App read it from the same spec submodule at `/generate-code --phase=integration`. *(Per-service tech-docs only happen when there is no `spec_source` — a pure multi-service BE repo with no shared spec module.)*
178
179
  - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
179
180
  - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
180
181
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
181
182
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
182
183
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
183
184
 
184
- > **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.
185
+ > **Why under `spec_source`:** PRD, design-spec, domain knowledge, the **API contract (tech-docs)**, and tester feedback are all **cross-team artifacts** — they must live in the **shared spec repo** so every umbrella (FE/App/BE) reads the same source via `/sync`. Tech-docs specifically: BE authors the tech-design (API contract), commits + pushes it into the spec submodule (2-layer commit), and FE/App pull it on their next `/sync` to wire the real API in `/generate-code --phase=integration`. In single-service mode (no `spec_source`), these default under the repo root — still shared, same repo.
185
186
 
186
187
  ---
187
188
 
@@ -205,7 +206,7 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
205
206
  | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
206
207
 
207
208
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
208
- - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
209
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
209
210
  - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
210
211
 
211
212
  **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).
@@ -298,7 +299,7 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
298
299
 
299
300
  If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
300
301
 
301
- These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
302
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (dev-gen-test, debug, fix-bug, dev-smoke-test).
302
303
 
303
304
  ---
304
305
 
@@ -532,7 +533,7 @@ If `lessons_path` does not exist, create it with this header first:
532
533
  | code-gen | /generate-code output |
533
534
  | bdd | /generate-bdd output |
534
535
  | tech-docs | /generate-tech-docs output |
535
- | tests | /generate-tests output |
536
+ | tests | /dev-gen-test output |
536
537
  | prd | /generate-prd, /refine-prd output |
537
538
  | general | every command |
538
539
 
@@ -597,13 +598,13 @@ Suggest the logical next command based on workflow phase:
597
598
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
598
599
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
599
600
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
600
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
601
- | /generate-tests | `/run-tests {UC-ID}` |
602
- | /run-tests (passing) | `/review-code {UC-ID}` |
603
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
604
- | /review-code | `/smoke-test {UC-ID}` or create PR |
605
- | /smoke-test | Create PR and link to ticket |
606
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
601
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
602
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
603
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
604
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
605
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
606
+ | /dev-smoke-test | Create PR and link to ticket |
607
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
607
608
  | /fix-bug | Create PR and link to ticket |
608
609
  | /debug | `/fix-bug {ticket-id}` if fix needed |
609
610
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -161,7 +161,7 @@ If `services` section is present:
161
161
 
162
162
  **2. Route to service** — if active domain matches a key in `services`:
163
163
  - Override `paths.specs_dir` → `services.{domain}.specs_dir`
164
- - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
164
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, the tech-design (API contract) is a cross-team artifact and must live in the shared spec repo (handled in step 4), so leave `tech_docs_dir` for step 4 to route — do NOT pin it per-service here.
165
165
  - Store `active_service` = `services.{domain}.path`
166
166
  - Store `active_service_module` = `services.{domain}.module`
167
167
  - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
@@ -173,13 +173,14 @@ If `services` section is present:
173
173
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
174
174
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
175
175
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
176
+ - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **always when `spec_source` is set** (step 2 no longer pins tech-docs per-service in this case). The tech-design IS the cross-team API contract: BE authors it here, and FE/App read it from the same spec submodule at `/generate-code --phase=integration`. *(Per-service tech-docs only happen when there is no `spec_source` — a pure multi-service BE repo with no shared spec module.)*
176
177
  - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
177
178
  - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
178
179
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
179
180
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
180
181
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
181
182
 
182
- > **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.
183
+ > **Why under `spec_source`:** PRD, design-spec, domain knowledge, the **API contract (tech-docs)**, and tester feedback are all **cross-team artifacts** — they must live in the **shared spec repo** so every umbrella (FE/App/BE) reads the same source via `/sync`. Tech-docs specifically: BE authors the tech-design (API contract), commits + pushes it into the spec submodule (2-layer commit), and FE/App pull it on their next `/sync` to wire the real API in `/generate-code --phase=integration`. In single-service mode (no `spec_source`), these default under the repo root — still shared, same repo.
183
184
 
184
185
  ---
185
186
 
@@ -203,7 +204,7 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
203
204
  | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
204
205
 
205
206
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
206
- - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
207
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
207
208
  - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
208
209
 
209
210
  **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).
@@ -296,7 +297,7 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
296
297
 
297
298
  If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
298
299
 
299
- These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
300
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (dev-gen-test, debug, fix-bug, dev-smoke-test).
300
301
 
301
302
  ---
302
303
 
@@ -810,7 +811,7 @@ After generating all `.feature` files, create or update `{paths.trace_dir}/{UC-I
810
811
 
811
812
  **TSV columns (tab-separated, one header row + one data row per scenario):**
812
813
  ```
813
- sc_id\tsc_title\tspec_ver\tgen_ver\timplemented_by\ttest_count\ttest_classes\tprd_version\tbdd_version\ttech_doc_revision\tprd_status\tuc_status\tfe_phase\tstatus\tlast_updated
814
+ sc_id\tsc_title\tspec_ver\tgen_ver\timplemented_by\ttest_count\ttest_classes\tdev_selftest\tdev_selftest_at\tprd_version\tbdd_version\ttech_doc_revision\tprd_status\tuc_status\tfe_phase\tstatus\tlast_updated
814
815
  ```
815
816
 
816
817
  **Rules:**
@@ -818,7 +819,7 @@ sc_id\tsc_title\tspec_ver\tgen_ver\timplemented_by\ttest_count\ttest_classes\tpr
818
819
  - If file exists (re-generation) → for each SC in the new `.feature`:
819
820
  - SC already in `.tsv` AND `spec_ver` is unchanged → update only: `sc_title`, `prd_version`, `bdd_version`, `prd_status`, `uc_status`, `last_updated`. Leave all other columns unchanged.
820
821
  - SC already in `.tsv` AND `spec_ver` changed (scenario was modified) → update: `sc_title`, `spec_ver`, `prd_version`, `bdd_version`, `prd_status`, `uc_status`, `last_updated` AND set `status = DRIFT` immediately (so the TSV reflects drift without waiting for `/validate-traces`). Leave `gen_ver`, `implemented_by`, `test_count`, `test_classes`, `tech_doc_revision` unchanged.
821
- - SC is new (added in this re-gen) → append new row with `gen_ver`, `implemented_by`, `test_count`, `test_classes`, `tech_doc_revision` all set to `—`.
822
+ - SC is new (added in this re-gen) → append new row with `gen_ver`, `implemented_by`, `test_count`, `test_classes`, `dev_selftest`, `dev_selftest_at`, `tech_doc_revision` all set to `—`.
822
823
  - SC no longer in `.feature` (removed) → delete its row.
823
824
 
824
825
  **Values to write for each scenario:**
@@ -832,6 +833,8 @@ sc_id\tsc_title\tspec_ver\tgen_ver\timplemented_by\ttest_count\ttest_classes\tpr
832
833
  | `implemented_by` | `—` |
833
834
  | `test_count` | `—` |
834
835
  | `test_classes` | `—` |
836
+ | `dev_selftest` | `—` (no tests run yet) |
837
+ | `dev_selftest_at` | `—` |
835
838
  | `prd_version` | `@trace.prd_version` from `.feature` header |
836
839
  | `bdd_version` | `@trace.bdd_version` from `.feature` header |
837
840
  | `tech_doc_revision` | `—` |
@@ -841,6 +844,27 @@ sc_id\tsc_title\tspec_ver\tgen_ver\timplemented_by\ttest_count\ttest_classes\tpr
841
844
  | `status` | `UNTRACKED` |
842
845
  | `last_updated` | today `YYYY-MM-DD` |
843
846
 
847
+ ## Refresh Panel Mirror
848
+ # Refresh Living Docs panel mirror *(local, umbrella mode)*
849
+
850
+ *Skip entirely in single-service mode (no `services` and no `setup.spec_source`) — there
851
+ the service `.trace/` IS the panel location, so nothing to mirror.*
852
+
853
+ After updating the authoritative service TSV(s) at `{paths.trace_dir}`:
854
+
855
+ 1. Resolve `panel_mirror = ./.trace` at the **current workspace root** (where this command runs).
856
+ 2. If `panel_mirror` resolves to a different path than `{paths.trace_dir}`, copy each
857
+ just-updated `{UC-ID}.tsv` → `{panel_mirror}/{service-name}/{UC-ID}.tsv`
858
+ (create the dir; overwrite). Use `active_service` for `{service-name}`.
859
+
860
+ This keeps the open workspace's Living Docs panel current **between syncs** — it is a
861
+ **local convenience mirror only**. The *canonical* report in the spec module
862
+ (`{spec_source}/.living-docs/`) and the merged `trace-report.json` are rebuilt by
863
+ `/sync` or `/validate-traces` (those need every service's data, so a single per-UC
864
+ command cannot produce them). For orchestrated commands, do this once in the orchestrator
865
+ after all sub-agents return — not inside each sub-agent.
866
+
867
+
844
868
  ## Output
845
869
 
846
870
  # Report Footer — Standard Command Output Format
@@ -881,13 +905,13 @@ Suggest the logical next command based on workflow phase:
881
905
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
882
906
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
883
907
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
884
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
885
- | /generate-tests | `/run-tests {UC-ID}` |
886
- | /run-tests (passing) | `/review-code {UC-ID}` |
887
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
888
- | /review-code | `/smoke-test {UC-ID}` or create PR |
889
- | /smoke-test | Create PR and link to ticket |
890
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
908
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
909
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
910
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
911
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
912
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
913
+ | /dev-smoke-test | Create PR and link to ticket |
914
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
891
915
  | /fix-bug | Create PR and link to ticket |
892
916
  | /debug | `/fix-bug {ticket-id}` if fix needed |
893
917
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -929,4 +953,6 @@ Next (umbrella):
929
953
  → /review-context {feature-file} to verify coverage
930
954
  → /generate-tech-docs {feature-file}
931
955
  → /generate-code {feature-file}
956
+
957
+ 📊 Living Docs: run /validate-traces (or /sync) to push this trace to the spec-module dashboard.
932
958
  ```
@@ -163,7 +163,7 @@ If `services` section is present:
163
163
 
164
164
  **2. Route to service** — if active domain matches a key in `services`:
165
165
  - Override `paths.specs_dir` → `services.{domain}.specs_dir`
166
- - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
166
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, the tech-design (API contract) is a cross-team artifact and must live in the shared spec repo (handled in step 4), so leave `tech_docs_dir` for step 4 to route — do NOT pin it per-service here.
167
167
  - Store `active_service` = `services.{domain}.path`
168
168
  - Store `active_service_module` = `services.{domain}.module`
169
169
  - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
@@ -175,13 +175,14 @@ If `services` section is present:
175
175
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
176
176
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
177
177
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
178
+ - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **always when `spec_source` is set** (step 2 no longer pins tech-docs per-service in this case). The tech-design IS the cross-team API contract: BE authors it here, and FE/App read it from the same spec submodule at `/generate-code --phase=integration`. *(Per-service tech-docs only happen when there is no `spec_source` — a pure multi-service BE repo with no shared spec module.)*
178
179
  - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
179
180
  - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
180
181
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
181
182
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
182
183
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
183
184
 
184
- > **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.
185
+ > **Why under `spec_source`:** PRD, design-spec, domain knowledge, the **API contract (tech-docs)**, and tester feedback are all **cross-team artifacts** — they must live in the **shared spec repo** so every umbrella (FE/App/BE) reads the same source via `/sync`. Tech-docs specifically: BE authors the tech-design (API contract), commits + pushes it into the spec submodule (2-layer commit), and FE/App pull it on their next `/sync` to wire the real API in `/generate-code --phase=integration`. In single-service mode (no `spec_source`), these default under the repo root — still shared, same repo.
185
186
 
186
187
  ---
187
188
 
@@ -205,7 +206,7 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
205
206
  | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
206
207
 
207
208
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
208
- - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
209
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
209
210
  - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
210
211
 
211
212
  **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).
@@ -298,7 +299,7 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
298
299
 
299
300
  If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
300
301
 
301
- These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
302
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (dev-gen-test, debug, fix-bug, dev-smoke-test).
302
303
 
303
304
  ---
304
305
 
@@ -379,6 +380,7 @@ Read:
379
380
  1. The scoped `.feature` file only
380
381
  2. Tech-doc at `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md` (if exists)
381
382
  3. CLAUDE.md §architecture + §coding_standards
383
+ 4. **(FE/App only)** Design Spec at `{paths.design_spec_dir}/{domain}/{TICKET-ID}-design-spec-*{slug}.md` (if exists) — source of screens, component inventory, and the per-screen Figma frame links.
382
384
 
383
385
  ---
384
386
 
@@ -402,6 +404,51 @@ Load System BDD for this UC: find `{specs_dir}/{domain}/system/{TICKET-ID}*.feat
402
404
  Extract all `Then` clauses → collect implied response shapes and error states.
403
405
  If System BDD not found → warn: "System BDD not found — mock layer will use placeholder fixtures." Continue.
404
406
 
407
+ **Then run the Figma Dev Mode MCP Check below** before generating any UI — the Design
408
+ Spec's frame links are the visual contract, and the local MCP reads them with far more
409
+ fidelity than a plain web link.
410
+
411
+ ---
412
+
413
+ ## Figma Dev Mode MCP Check *(FE/App UI generation only)*
414
+
415
+ *Run this only when `platform` is `web`/`app` AND generating UI (`--phase=ui`, or default
416
+ mode for an FE/App feature). Skip entirely for BE / `system` platform.*
417
+
418
+ The PO authored the Design Spec from **Figma web links** (read-only, limited). For
419
+ codegen, the **local Figma Dev Mode MCP server** (built into the Figma **desktop app**)
420
+ gives far more: exact layout, design **variables/tokens**, **Code Connect** component
421
+ mappings, selection context, and code snippets — things a web URL alone cannot return.
422
+
423
+ **Step 1 — Detect the local MCP.** Check whether a Figma Dev Mode MCP server is connected
424
+ (a `get_design_context` / `get_code` style Figma tool is available via MCP).
425
+
426
+ **Step 2 — If NOT connected → suggest the dev enable it, then wait:**
427
+
428
+ ```
429
+ 🎨 Figma Dev Mode MCP not detected.
430
+ For accurate FE code (real tokens, components, Code Connect), use the LOCAL server:
431
+
432
+ 1. Open the Figma DESKTOP app (not the browser)
433
+ 2. Open the file/frame for this feature
434
+ 3. Enable the Dev Mode MCP server:
435
+ Figma menu → Preferences → "Enable Dev Mode MCP Server"
436
+ (requires Dev or Full seat; server runs at http://127.0.0.1:3845)
437
+ 4. Make sure this MCP server is added in your Claude Code MCP config
438
+ 5. Select the frame for the screen you're implementing, then continue
439
+
440
+ Type C to continue once enabled, or S to skip (fall back to web links + text spec).
441
+ ```
442
+
443
+ - `C` → re-detect; if now connected → proceed using the local MCP.
444
+ - `S` → proceed in **fallback mode**: use the Design Spec's web frame links + textual spec
445
+ only; add a ⚠️ note in the final report that UI was generated without local Figma fidelity.
446
+
447
+ **Step 3 — When the local MCP IS connected:** for each screen being implemented, pull the
448
+ selected frame via the Figma MCP and ground the UI on the returned layout, variables, and
449
+ Code Connect mappings. Prefer Code-Connect-mapped components over inventing markup; use the
450
+ real token names, not hardcoded values.
451
+
405
452
  **If `--phase=integration`:**
406
453
  Read tech-doc `@trace.status` from `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md`.
407
454
  If `draft` or `in-review` → warn:
@@ -424,7 +471,7 @@ Read `{paths.trace_dir}/{UC-ID}.tsv` if it exists. For each scenario row, note i
424
471
  | `UNTRACKED` | `implemented_by == —` | Generate — scenario has no code yet |
425
472
  | `DRIFT` | `spec_ver != gen_ver` | Regenerate — scenario updated since last codegen |
426
473
  | `OK` | implemented + tested | Skip unless explicitly re-generating |
427
- | `GAP` | implemented, no tests | Skip codegen — already coded; run `/generate-tests` instead |
474
+ | `GAP` | implemented, no tests | Skip codegen — already coded; run `/dev-gen-test` instead |
428
475
 
429
476
  Use these statuses to populate the **Scenarios** count in the CHECKPOINT plan (`{X} new, {Y} drifted, {Z} synced-skip`).
430
477
  If `.tsv` does not exist → treat all scenarios as `UNTRACKED`.
@@ -578,9 +625,30 @@ Update `{paths.trace_dir}/{UC-ID}.tsv` — for each implemented scenario, find t
578
625
  | `fe_phase` | `ui` if `--phase=ui` \| `integrated` if `--phase=integration` \| `—` if no phase flag |
579
626
  | `last_updated` | today `YYYY-MM-DD` |
580
627
 
581
- Leave all other columns (`sc_title`, `spec_ver`, `prd_version`, `prd_status`, `uc_status`, `test_count`, `test_classes`) unchanged.
628
+ Leave all other columns (`sc_title`, `spec_ver`, `prd_version`, `prd_status`, `uc_status`, `test_count`, `test_classes`, `dev_selftest`, `dev_selftest_at`) unchanged.
582
629
  `status` is computed by `/validate-traces` — do not set here.
583
630
 
631
+ ## Refresh Panel Mirror
632
+ # Refresh Living Docs panel mirror *(local, umbrella mode)*
633
+
634
+ *Skip entirely in single-service mode (no `services` and no `setup.spec_source`) — there
635
+ the service `.trace/` IS the panel location, so nothing to mirror.*
636
+
637
+ After updating the authoritative service TSV(s) at `{paths.trace_dir}`:
638
+
639
+ 1. Resolve `panel_mirror = ./.trace` at the **current workspace root** (where this command runs).
640
+ 2. If `panel_mirror` resolves to a different path than `{paths.trace_dir}`, copy each
641
+ just-updated `{UC-ID}.tsv` → `{panel_mirror}/{service-name}/{UC-ID}.tsv`
642
+ (create the dir; overwrite). Use `active_service` for `{service-name}`.
643
+
644
+ This keeps the open workspace's Living Docs panel current **between syncs** — it is a
645
+ **local convenience mirror only**. The *canonical* report in the spec module
646
+ (`{spec_source}/.living-docs/`) and the merged `trace-report.json` are rebuilt by
647
+ `/sync` or `/validate-traces` (those need every service's data, so a single per-UC
648
+ command cannot produce them). For orchestrated commands, do this once in the orchestrator
649
+ after all sub-agents return — not inside each sub-agent.
650
+
651
+
584
652
  ## Commit
585
653
  ```bash
586
654
  git add {files}
@@ -627,13 +695,13 @@ Suggest the logical next command based on workflow phase:
627
695
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
628
696
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
629
697
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
630
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
631
- | /generate-tests | `/run-tests {UC-ID}` |
632
- | /run-tests (passing) | `/review-code {UC-ID}` |
633
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
634
- | /review-code | `/smoke-test {UC-ID}` or create PR |
635
- | /smoke-test | Create PR and link to ticket |
636
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
698
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
699
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
700
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
701
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
702
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
703
+ | /dev-smoke-test | Create PR and link to ticket |
704
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
637
705
  | /fix-bug | Create PR and link to ticket |
638
706
  | /debug | `/fix-bug {ticket-id}` if fix needed |
639
707
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -657,6 +725,7 @@ Files: created={N}, extended={M}, skipped={K} | Build: SUCCESS
657
725
  Branch: feature/{TICKET_ID}-{slug}
658
726
  Phase : {UI (mock layer) | Integration (real API) | Default (full)}
659
727
  fe_phase : {ui | integrated | —}
728
+ Figma : {local Dev Mode MCP (grounded) | ⚠️ web links + text spec only (no local MCP) | n/a for BE} ← FE/App UI only
660
729
 
661
730
  Next:
662
731
  --phase=ui done:
@@ -666,9 +735,11 @@ Next:
666
735
 
667
736
  --phase=integration done:
668
737
  → /review-code {UC-ID} ← code review required
669
- → /generate-tests {UC-ID} ← integration test suite
738
+ → /dev-gen-test {UC-ID} ← integration test suite
670
739
 
671
740
  Default (no phase flag):
672
741
  → /review-code {UC-ID} ← code review required before tests
673
- → /generate-tests {UC-ID}
742
+ → /dev-gen-test {UC-ID}
743
+
744
+ 📊 Living Docs: run /validate-traces (or /sync) to push this trace to the spec-module dashboard.
674
745
  ```