@anhth2/spec-driven-dev-plugin 0.12.0 → 0.14.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 (130) hide show
  1. package/commands/debug.md +42 -7
  2. package/commands/define-product.md +42 -7
  3. package/commands/dev-gen-test.md +60 -17
  4. package/commands/dev-run-test.md +61 -18
  5. package/commands/dev-run-test.tmpl +1 -1
  6. package/commands/dev-smoke-test.md +42 -7
  7. package/commands/fix-bug.md +42 -7
  8. package/commands/generate-bdd.md +67 -21
  9. package/commands/generate-bdd.tmpl +7 -4
  10. package/commands/generate-code.md +113 -35
  11. package/commands/generate-code.tmpl +53 -18
  12. package/commands/generate-design-spec.md +42 -7
  13. package/commands/generate-prd.md +42 -7
  14. package/commands/generate-spec-manifest.md +42 -7
  15. package/commands/generate-tech-docs.md +229 -20
  16. package/commands/generate-tech-docs.tmpl +187 -13
  17. package/commands/learn.md +42 -7
  18. package/commands/map-testids.md +564 -0
  19. package/commands/map-testids.tmpl +81 -0
  20. package/commands/propose-scenario.md +42 -7
  21. package/commands/qc-analyze.md +42 -7
  22. package/commands/qc-design-test.md +44 -8
  23. package/commands/qc-design-test.tmpl +2 -1
  24. package/commands/qc-plan.md +42 -7
  25. package/commands/qc-report.md +42 -7
  26. package/commands/qc-review.md +42 -7
  27. package/commands/qc-run-test.md +62 -18
  28. package/commands/qc-run-test.tmpl +2 -1
  29. package/commands/refine-prd.md +42 -7
  30. package/commands/report-bug.md +42 -7
  31. package/commands/review-code.md +42 -7
  32. package/commands/review-context.md +42 -7
  33. package/commands/review-tech-docs.md +45 -9
  34. package/commands/review-tech-docs.tmpl +3 -2
  35. package/commands/setup-ai-first.md +37 -4
  36. package/commands/setup-ai-first.tmpl +2 -2
  37. package/commands/sync.md +35 -2
  38. package/commands/update-framework.md +35 -2
  39. package/commands/validate-traces.md +85 -40
  40. package/commands/validate-traces.tmpl +43 -33
  41. package/core/FRAMEWORK_VERSION +1 -1
  42. package/core/commands/debug.md +42 -7
  43. package/core/commands/define-product.md +42 -7
  44. package/core/commands/dev-gen-test.md +60 -17
  45. package/core/commands/dev-run-test.md +61 -18
  46. package/core/commands/dev-smoke-test.md +42 -7
  47. package/core/commands/fix-bug.md +42 -7
  48. package/core/commands/generate-bdd.md +67 -21
  49. package/core/commands/generate-code.md +113 -35
  50. package/core/commands/generate-design-spec.md +42 -7
  51. package/core/commands/generate-prd.md +42 -7
  52. package/core/commands/generate-spec-manifest.md +42 -7
  53. package/core/commands/generate-tech-docs.md +229 -20
  54. package/core/commands/learn.md +42 -7
  55. package/core/commands/map-testids.md +564 -0
  56. package/core/commands/propose-scenario.md +42 -7
  57. package/core/commands/qc-analyze.md +42 -7
  58. package/core/commands/qc-design-test.md +44 -8
  59. package/core/commands/qc-plan.md +42 -7
  60. package/core/commands/qc-report.md +42 -7
  61. package/core/commands/qc-review.md +42 -7
  62. package/core/commands/qc-run-test.md +62 -18
  63. package/core/commands/refine-prd.md +42 -7
  64. package/core/commands/report-bug.md +42 -7
  65. package/core/commands/review-code.md +42 -7
  66. package/core/commands/review-context.md +42 -7
  67. package/core/commands/review-tech-docs.md +45 -9
  68. package/core/commands/setup-ai-first.md +37 -4
  69. package/core/commands/sync.md +35 -2
  70. package/core/commands/update-framework.md +35 -2
  71. package/core/commands/validate-traces.md +85 -40
  72. package/core/modules/qc-playwright/stack-profile.yaml +1 -0
  73. package/core/skills/code/SKILL.md +77 -9
  74. package/core/skills/debug/SKILL.md +112 -11
  75. package/core/skills/design-spec/SKILL.md +42 -7
  76. package/core/skills/discovery/SKILL.md +42 -7
  77. package/core/skills/prd/SKILL.md +70 -4
  78. package/core/skills/setup-ai-first/SKILL.md +35 -2
  79. package/core/skills/spec/SKILL.md +70 -4
  80. package/core/skills/test/SKILL.md +119 -16
  81. package/core/steps/context-loader.md +7 -5
  82. package/core/steps/report-footer.md +35 -2
  83. package/core/steps/trace-mirror.md +18 -10
  84. package/core/templates/project-context.yaml +8 -5
  85. package/docs/01-getting-started/core-concepts.md +7 -7
  86. package/docs/01-getting-started/installation.md +2 -2
  87. package/docs/01-getting-started/quickstart.md +1 -1
  88. package/docs/02-guides/README.md +1 -2
  89. package/docs/02-guides/developer/README.md +1 -1
  90. package/docs/02-guides/developer/bdd-and-trace.md +10 -8
  91. package/docs/02-guides/developer/commands.md +3 -3
  92. package/docs/02-guides/developer/scenarios.md +26 -14
  93. package/docs/02-guides/developer/workflow.md +80 -20
  94. package/docs/02-guides/product-owner/README.md +6 -4
  95. package/docs/02-guides/product-owner/commands.md +1 -1
  96. package/docs/02-guides/product-owner/scenarios.md +80 -1
  97. package/docs/02-guides/tester/README.md +12 -11
  98. package/docs/02-guides/tester/bug-reporting.md +1 -1
  99. package/docs/02-guides/{qc-automation.md → tester/qc-automation.md} +14 -6
  100. package/docs/02-guides/tester/reading-specs.md +4 -4
  101. package/docs/02-guides/tester/scenarios.md +5 -5
  102. package/docs/02-guides/tester/spec-manifest.md +17 -12
  103. package/docs/02-guides/tester/test-checklist.md +3 -3
  104. package/docs/02-guides/tester/workflow.md +8 -11
  105. package/docs/03-concepts/architecture.md +5 -4
  106. package/docs/03-concepts/pipeline.md +18 -6
  107. package/docs/03-concepts/traceability.md +17 -17
  108. package/docs/04-operations/README.md +1 -1
  109. package/docs/04-operations/bug-flow.md +4 -4
  110. package/docs/04-operations/sync-and-update.md +163 -38
  111. package/docs/05-reference/README.md +3 -0
  112. package/docs/05-reference/command-cheatsheet.md +147 -0
  113. package/docs/05-reference/commands.md +72 -69
  114. package/docs/05-reference/modules.md +2 -2
  115. package/docs/05-reference/trace-schema.md +15 -14
  116. package/docs/README.md +3 -5
  117. package/modules/qc-playwright/stack-profile.yaml +1 -0
  118. package/package.json +1 -1
  119. package/skills/code/SKILL.md +77 -9
  120. package/skills/debug/SKILL.md +112 -11
  121. package/skills/design-spec/SKILL.md +42 -7
  122. package/skills/discovery/SKILL.md +42 -7
  123. package/skills/prd/SKILL.md +70 -4
  124. package/skills/setup-ai-first/SKILL.md +35 -2
  125. package/skills/spec/SKILL.md +70 -4
  126. package/skills/test/SKILL.md +119 -16
  127. package/steps/context-loader.md +7 -5
  128. package/steps/report-footer.md +35 -2
  129. package/steps/trace-mirror.md +18 -10
  130. package/templates/project-context.yaml +8 -5
@@ -197,6 +197,36 @@ Output Artifacts:
197
197
 
198
198
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
199
199
 
200
+ ## Pipeline Position
201
+
202
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
203
+ so the user always sees where this command sits in the end-to-end flow:
204
+
205
+ ```
206
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
207
+ ```
208
+
209
+ Find the current command in this phase legend and mark **its** phase in the map above:
210
+
211
+ | Phase | Commands |
212
+ |-------|----------|
213
+ | Discovery | `/define-product` |
214
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
215
+ | Design Spec | `/generate-design-spec` |
216
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
217
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
218
+ | Code | `/generate-code` · `/review-code` |
219
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
220
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
221
+ | Trace Audit | `/validate-traces` |
222
+
223
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
224
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
225
+
226
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
227
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
228
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
229
+
200
230
  ## Next Command Suggestion
201
231
 
202
232
  Suggest the logical next command based on workflow phase:
@@ -238,10 +268,13 @@ Suggest the logical next command based on workflow phase:
238
268
  Format the footer as:
239
269
  ```
240
270
  ---
241
- Status : {badge}
271
+ Status : {badge}
242
272
  {Output Artifacts block}
243
- Next : {suggested command with example arguments}
273
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
274
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
275
+ Next : {suggested command with example arguments}
244
276
  ```
277
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
245
278
 
246
279
 
247
280
  ---
@@ -341,6 +374,36 @@ Output Artifacts:
341
374
 
342
375
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
343
376
 
377
+ ## Pipeline Position
378
+
379
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
380
+ so the user always sees where this command sits in the end-to-end flow:
381
+
382
+ ```
383
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
384
+ ```
385
+
386
+ Find the current command in this phase legend and mark **its** phase in the map above:
387
+
388
+ | Phase | Commands |
389
+ |-------|----------|
390
+ | Discovery | `/define-product` |
391
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
392
+ | Design Spec | `/generate-design-spec` |
393
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
394
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
395
+ | Code | `/generate-code` · `/review-code` |
396
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
397
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
398
+ | Trace Audit | `/validate-traces` |
399
+
400
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
401
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
402
+
403
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
404
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
405
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
406
+
344
407
  ## Next Command Suggestion
345
408
 
346
409
  Suggest the logical next command based on workflow phase:
@@ -382,8 +445,11 @@ Suggest the logical next command based on workflow phase:
382
445
  Format the footer as:
383
446
  ```
384
447
  ---
385
- Status : {badge}
448
+ Status : {badge}
386
449
  {Output Artifacts block}
387
- Next : {suggested command with example arguments}
450
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
451
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
452
+ Next : {suggested command with example arguments}
388
453
  ```
454
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
389
455
 
@@ -240,6 +240,36 @@ Output Artifacts:
240
240
 
241
241
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
242
242
 
243
+ ## Pipeline Position
244
+
245
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
246
+ so the user always sees where this command sits in the end-to-end flow:
247
+
248
+ ```
249
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
250
+ ```
251
+
252
+ Find the current command in this phase legend and mark **its** phase in the map above:
253
+
254
+ | Phase | Commands |
255
+ |-------|----------|
256
+ | Discovery | `/define-product` |
257
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
258
+ | Design Spec | `/generate-design-spec` |
259
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
260
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
261
+ | Code | `/generate-code` · `/review-code` |
262
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
263
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
264
+ | Trace Audit | `/validate-traces` |
265
+
266
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
267
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
268
+
269
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
270
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
271
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
272
+
243
273
  ## Next Command Suggestion
244
274
 
245
275
  Suggest the logical next command based on workflow phase:
@@ -281,10 +311,13 @@ Suggest the logical next command based on workflow phase:
281
311
  Format the footer as:
282
312
  ```
283
313
  ---
284
- Status : {badge}
314
+ Status : {badge}
285
315
  {Output Artifacts block}
286
- Next : {suggested command with example arguments}
316
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
317
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
318
+ Next : {suggested command with example arguments}
287
319
  ```
320
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
288
321
 
289
322
 
290
323
  ---
@@ -372,7 +405,7 @@ If `services` section is present:
372
405
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
373
406
 
374
407
  **2. Route to service** — if active domain matches a key in `services`:
375
- - Override `paths.specs_dir` → `services.{domain}.specs_dir`
408
+ - Override `paths.specs_dir` → `services.{domain}.specs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, ALL BDD (web/app/**system**) is a shared cross-team artifact → leave `specs_dir` for step 4 to route to the spec repo; do NOT pin it per-service here.
376
409
  - 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.
377
410
  - Store `active_service` = `services.{domain}.path`
378
411
  - Store `active_service_module` = `services.{domain}.module`
@@ -383,6 +416,7 @@ If `services` section is present:
383
416
  - Set `active_service = unresolved`
384
417
 
385
418
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
419
+ - Override `paths.specs_dir` → `{spec_source}/specs/bdd` — **always when `spec_source` is set.** All BDD (web/app/**system**) lives in the shared spec repo so every umbrella (FE/App/BE) reads the same scenarios; the FE tech-design gate + `/generate-code --phase=ui`/`--phase=integration` resolve the `system/` BDD here. *(Per-service `specs/bdd` only when there is no `spec_source`.)*
386
420
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
387
421
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
388
422
  - 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.)*
@@ -392,8 +426,9 @@ If `services` section is present:
392
426
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
393
427
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
394
428
  - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
429
+ - Override `paths.trace_dir` → `{spec_source}/.trace` — **always when `spec_source` is set.** Trace TSVs are consolidated in the spec repo (single authoritative location, no per-service split) so the PM/PO has one place to manage status. Code-side commands (`/generate-code`, `/dev-run-test`, `/qc-run-test`) run from `service_root` but **write their trace row into `{spec_source}/.trace`** — like they already push `feedback/` there. *(Per-service `.trace` only when there is no `spec_source`.)*
395
430
 
396
- > **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.
431
+ > **Why under `spec_source`:** PRD, design-spec, domain knowledge, **all BDD (web/app/system)**, the **API contract (tech-docs)**, tester feedback, **and the `.trace/` coverage state** are all **cross-team artifacts** — they live in the **shared spec repo** so every umbrella (FE/App/BE) and the PM read one source via `/sync`. The service submodule holds only **code** (+ build/test tooling). `.trace/` and `feedback/` are the dev/QC **write areas** in the spec repo (the PRD/BDD/design-spec/tech-docs there stay read-only for dev/QC only PO edits those). In single-service mode (no `spec_source`), everything defaults under the repo root — still one repo.
397
432
 
398
433
  ---
399
434
 
@@ -413,12 +448,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
413
448
  |----------|--------|
414
449
  | `conventions.test_command` | service's `conventions.test_command` |
415
450
  | `conventions.build_command` | service's `conventions.build_command` |
416
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
417
- | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
451
+ | `paths.trace_dir` | **If `spec_source` is set → keep the Step 4 spec-repo route (`{spec_source}/.trace`); ignore any service-level `trace_dir`.** Only when there is no `spec_source`: `{active_service}/{service paths.trace_dir}` (default `{active_service}/.trace`). |
452
+ | `paths.specs_dir` | **If `spec_source` is set → keep the Step 4 spec-repo route (`{spec_source}/specs/bdd`); ignore any service-level `specs_dir`** (BDD is cross-team, never per-service in this mode). Only when there is no `spec_source`: `{active_service}/{service paths.specs_dir}` if set, else the Step 1.5 override. |
418
453
 
419
454
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
420
455
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
421
- - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
456
+ - **Source/test files** are written relative to `service_root`; **trace TSVs** are written to `{paths.trace_dir}` (the spec repo when `spec_source` is set — a cross-repo write, committed/pushed to the spec submodule like `feedback/`).
422
457
 
423
458
  **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).
424
459
 
@@ -676,6 +711,36 @@ Output Artifacts:
676
711
 
677
712
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
678
713
 
714
+ ## Pipeline Position
715
+
716
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
717
+ so the user always sees where this command sits in the end-to-end flow:
718
+
719
+ ```
720
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
721
+ ```
722
+
723
+ Find the current command in this phase legend and mark **its** phase in the map above:
724
+
725
+ | Phase | Commands |
726
+ |-------|----------|
727
+ | Discovery | `/define-product` |
728
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
729
+ | Design Spec | `/generate-design-spec` |
730
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
731
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
732
+ | Code | `/generate-code` · `/review-code` |
733
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
734
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
735
+ | Trace Audit | `/validate-traces` |
736
+
737
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
738
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
739
+
740
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
741
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
742
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
743
+
679
744
  ## Next Command Suggestion
680
745
 
681
746
  Suggest the logical next command based on workflow phase:
@@ -717,10 +782,13 @@ Suggest the logical next command based on workflow phase:
717
782
  Format the footer as:
718
783
  ```
719
784
  ---
720
- Status : {badge}
785
+ Status : {badge}
721
786
  {Output Artifacts block}
722
- Next : {suggested command with example arguments}
787
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
788
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
789
+ Next : {suggested command with example arguments}
723
790
  ```
791
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
724
792
 
725
793
 
726
794
  ---
@@ -811,7 +879,7 @@ If `services` section is present:
811
879
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
812
880
 
813
881
  **2. Route to service** — if active domain matches a key in `services`:
814
- - Override `paths.specs_dir` → `services.{domain}.specs_dir`
882
+ - Override `paths.specs_dir` → `services.{domain}.specs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, ALL BDD (web/app/**system**) is a shared cross-team artifact → leave `specs_dir` for step 4 to route to the spec repo; do NOT pin it per-service here.
815
883
  - 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.
816
884
  - Store `active_service` = `services.{domain}.path`
817
885
  - Store `active_service_module` = `services.{domain}.module`
@@ -822,6 +890,7 @@ If `services` section is present:
822
890
  - Set `active_service = unresolved`
823
891
 
824
892
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
893
+ - Override `paths.specs_dir` → `{spec_source}/specs/bdd` — **always when `spec_source` is set.** All BDD (web/app/**system**) lives in the shared spec repo so every umbrella (FE/App/BE) reads the same scenarios; the FE tech-design gate + `/generate-code --phase=ui`/`--phase=integration` resolve the `system/` BDD here. *(Per-service `specs/bdd` only when there is no `spec_source`.)*
825
894
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
826
895
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
827
896
  - 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.)*
@@ -831,8 +900,9 @@ If `services` section is present:
831
900
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
832
901
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
833
902
  - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
903
+ - Override `paths.trace_dir` → `{spec_source}/.trace` — **always when `spec_source` is set.** Trace TSVs are consolidated in the spec repo (single authoritative location, no per-service split) so the PM/PO has one place to manage status. Code-side commands (`/generate-code`, `/dev-run-test`, `/qc-run-test`) run from `service_root` but **write their trace row into `{spec_source}/.trace`** — like they already push `feedback/` there. *(Per-service `.trace` only when there is no `spec_source`.)*
834
904
 
835
- > **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.
905
+ > **Why under `spec_source`:** PRD, design-spec, domain knowledge, **all BDD (web/app/system)**, the **API contract (tech-docs)**, tester feedback, **and the `.trace/` coverage state** are all **cross-team artifacts** — they live in the **shared spec repo** so every umbrella (FE/App/BE) and the PM read one source via `/sync`. The service submodule holds only **code** (+ build/test tooling). `.trace/` and `feedback/` are the dev/QC **write areas** in the spec repo (the PRD/BDD/design-spec/tech-docs there stay read-only for dev/QC only PO edits those). In single-service mode (no `spec_source`), everything defaults under the repo root — still one repo.
836
906
 
837
907
  ---
838
908
 
@@ -852,12 +922,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
852
922
  |----------|--------|
853
923
  | `conventions.test_command` | service's `conventions.test_command` |
854
924
  | `conventions.build_command` | service's `conventions.build_command` |
855
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
856
- | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
925
+ | `paths.trace_dir` | **If `spec_source` is set → keep the Step 4 spec-repo route (`{spec_source}/.trace`); ignore any service-level `trace_dir`.** Only when there is no `spec_source`: `{active_service}/{service paths.trace_dir}` (default `{active_service}/.trace`). |
926
+ | `paths.specs_dir` | **If `spec_source` is set → keep the Step 4 spec-repo route (`{spec_source}/specs/bdd`); ignore any service-level `specs_dir`** (BDD is cross-team, never per-service in this mode). Only when there is no `spec_source`: `{active_service}/{service paths.specs_dir}` if set, else the Step 1.5 override. |
857
927
 
858
928
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
859
929
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
860
- - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
930
+ - **Source/test files** are written relative to `service_root`; **trace TSVs** are written to `{paths.trace_dir}` (the spec repo when `spec_source` is set — a cross-repo write, committed/pushed to the spec submodule like `feedback/`).
861
931
 
862
932
  **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).
863
933
 
@@ -1130,6 +1200,36 @@ Output Artifacts:
1130
1200
 
1131
1201
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
1132
1202
 
1203
+ ## Pipeline Position
1204
+
1205
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
1206
+ so the user always sees where this command sits in the end-to-end flow:
1207
+
1208
+ ```
1209
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
1210
+ ```
1211
+
1212
+ Find the current command in this phase legend and mark **its** phase in the map above:
1213
+
1214
+ | Phase | Commands |
1215
+ |-------|----------|
1216
+ | Discovery | `/define-product` |
1217
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
1218
+ | Design Spec | `/generate-design-spec` |
1219
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
1220
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
1221
+ | Code | `/generate-code` · `/review-code` |
1222
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
1223
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
1224
+ | Trace Audit | `/validate-traces` |
1225
+
1226
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
1227
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
1228
+
1229
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
1230
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
1231
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
1232
+
1133
1233
  ## Next Command Suggestion
1134
1234
 
1135
1235
  Suggest the logical next command based on workflow phase:
@@ -1171,8 +1271,11 @@ Suggest the logical next command based on workflow phase:
1171
1271
  Format the footer as:
1172
1272
  ```
1173
1273
  ---
1174
- Status : {badge}
1274
+ Status : {badge}
1175
1275
  {Output Artifacts block}
1176
- Next : {suggested command with example arguments}
1276
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
1277
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
1278
+ Next : {suggested command with example arguments}
1177
1279
  ```
1280
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
1178
1281
 
@@ -77,7 +77,7 @@ If `services` section is present:
77
77
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
78
78
 
79
79
  **2. Route to service** — if active domain matches a key in `services`:
80
- - Override `paths.specs_dir` → `services.{domain}.specs_dir`
80
+ - Override `paths.specs_dir` → `services.{domain}.specs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, ALL BDD (web/app/**system**) is a shared cross-team artifact → leave `specs_dir` for step 4 to route to the spec repo; do NOT pin it per-service here.
81
81
  - 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.
82
82
  - Store `active_service` = `services.{domain}.path`
83
83
  - Store `active_service_module` = `services.{domain}.module`
@@ -88,6 +88,7 @@ If `services` section is present:
88
88
  - Set `active_service = unresolved`
89
89
 
90
90
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
91
+ - Override `paths.specs_dir` → `{spec_source}/specs/bdd` — **always when `spec_source` is set.** All BDD (web/app/**system**) lives in the shared spec repo so every umbrella (FE/App/BE) reads the same scenarios; the FE tech-design gate + `/generate-code --phase=ui`/`--phase=integration` resolve the `system/` BDD here. *(Per-service `specs/bdd` only when there is no `spec_source`.)*
91
92
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
92
93
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
93
94
  - 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.)*
@@ -97,8 +98,9 @@ If `services` section is present:
97
98
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
98
99
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
99
100
  - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
101
+ - Override `paths.trace_dir` → `{spec_source}/.trace` — **always when `spec_source` is set.** Trace TSVs are consolidated in the spec repo (single authoritative location, no per-service split) so the PM/PO has one place to manage status. Code-side commands (`/generate-code`, `/dev-run-test`, `/qc-run-test`) run from `service_root` but **write their trace row into `{spec_source}/.trace`** — like they already push `feedback/` there. *(Per-service `.trace` only when there is no `spec_source`.)*
100
102
 
101
- > **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.
103
+ > **Why under `spec_source`:** PRD, design-spec, domain knowledge, **all BDD (web/app/system)**, the **API contract (tech-docs)**, tester feedback, **and the `.trace/` coverage state** are all **cross-team artifacts** — they live in the **shared spec repo** so every umbrella (FE/App/BE) and the PM read one source via `/sync`. The service submodule holds only **code** (+ build/test tooling). `.trace/` and `feedback/` are the dev/QC **write areas** in the spec repo (the PRD/BDD/design-spec/tech-docs there stay read-only for dev/QC only PO edits those). In single-service mode (no `spec_source`), everything defaults under the repo root — still one repo.
102
104
 
103
105
  ---
104
106
 
@@ -118,12 +120,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
118
120
  |----------|--------|
119
121
  | `conventions.test_command` | service's `conventions.test_command` |
120
122
  | `conventions.build_command` | service's `conventions.build_command` |
121
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
122
- | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
123
+ | `paths.trace_dir` | **If `spec_source` is set → keep the Step 4 spec-repo route (`{spec_source}/.trace`); ignore any service-level `trace_dir`.** Only when there is no `spec_source`: `{active_service}/{service paths.trace_dir}` (default `{active_service}/.trace`). |
124
+ | `paths.specs_dir` | **If `spec_source` is set → keep the Step 4 spec-repo route (`{spec_source}/specs/bdd`); ignore any service-level `specs_dir`** (BDD is cross-team, never per-service in this mode). Only when there is no `spec_source`: `{active_service}/{service paths.specs_dir}` if set, else the Step 1.5 override. |
123
125
 
124
126
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
125
127
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
126
- - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
128
+ - **Source/test files** are written relative to `service_root`; **trace TSVs** are written to `{paths.trace_dir}` (the spec repo when `spec_source` is set — a cross-repo write, committed/pushed to the spec submodule like `feedback/`).
127
129
 
128
130
  **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).
129
131
 
@@ -20,6 +20,36 @@ Output Artifacts:
20
20
 
21
21
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
22
22
 
23
+ ## Pipeline Position
24
+
25
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
26
+ so the user always sees where this command sits in the end-to-end flow:
27
+
28
+ ```
29
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
30
+ ```
31
+
32
+ Find the current command in this phase legend and mark **its** phase in the map above:
33
+
34
+ | Phase | Commands |
35
+ |-------|----------|
36
+ | Discovery | `/define-product` |
37
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
38
+ | Design Spec | `/generate-design-spec` |
39
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
40
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
41
+ | Code | `/generate-code` · `/review-code` |
42
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
43
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
44
+ | Trace Audit | `/validate-traces` |
45
+
46
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
47
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
48
+
49
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
50
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
51
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
52
+
23
53
  ## Next Command Suggestion
24
54
 
25
55
  Suggest the logical next command based on workflow phase:
@@ -61,7 +91,10 @@ Suggest the logical next command based on workflow phase:
61
91
  Format the footer as:
62
92
  ```
63
93
  ---
64
- Status : {badge}
94
+ Status : {badge}
65
95
  {Output Artifacts block}
66
- Next : {suggested command with example arguments}
96
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
97
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
98
+ Next : {suggested command with example arguments}
67
99
  ```
100
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
@@ -1,18 +1,26 @@
1
1
  # Refresh Living Docs panel mirror *(local, umbrella mode)*
2
2
 
3
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.*
4
+ the repo's own `.trace/` IS the panel location, so nothing to mirror.*
5
5
 
6
- After updating the authoritative service TSV(s) at `{paths.trace_dir}`:
6
+ After updating the authoritative TSV(s) at `{paths.trace_dir}`:
7
7
 
8
- 1. Resolve `panel_mirror = ./.trace` at the **current workspace root** (where this command runs).
8
+ **When `setup.spec_source` is set (consolidated trace the common case):**
9
+ `{paths.trace_dir}` resolves to `{spec_source}/.trace` — the single authoritative location.
10
+ This command runs from `service_root`, so the write is **cross-repo into the spec submodule**;
11
+ commit/push the spec submodule for the trace update (same as `feedback/`).
12
+ 1. Resolve `panel_mirror = ./.trace` at the **current workspace root**.
9
13
  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}`.
14
+ just-updated `{UC-ID}.tsv` → `{panel_mirror}/{UC-ID}.tsv` (create the dir; overwrite).
15
+ No per-service namespacing — there is one trace set; the owning service is carried in each
16
+ row's `@trace.service`.
17
+
18
+ **Legacy (no `spec_source` — per-service trace):**
19
+ Copy each just-updated `{UC-ID}.tsv` → `{panel_mirror}/{service-name}/{UC-ID}.tsv`
20
+ (namespaced by `active_service`).
12
21
 
13
22
  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.
23
+ **local convenience mirror only**. The merged `trace-report.json` (canonical, in
24
+ `{spec_source}/.living-docs/`) is rebuilt by `/sync` or `/validate-traces`. For orchestrated
25
+ commands, do this once in the orchestrator after all sub-agents return — not inside each
26
+ sub-agent.
@@ -111,19 +111,22 @@ domains:
111
111
  # mode: umbrella # "umbrella" | "single" (default: single)
112
112
  # spec_source: "{{SPEC_SUBMODULE_PATH}}" # path to PO spec submodule, e.g. "free-trial-specs"
113
113
  #
114
- # When spec_source is set, context-loader auto-derives:
114
+ # When spec_source is set, context-loader auto-derives (ALL specs live in the spec repo;
115
+ # service submodules hold only code + .trace/):
116
+ # specs_dir → {spec_source}/specs/bdd # ALL BDD (web/app/system) — cross-team
115
117
  # prd_dir → {spec_source}/specs/prd
116
118
  # design_spec_dir → {spec_source}/specs/design-spec
117
- # tech_docs_dir → {spec_source}/specs/tech-docs # shared API contract (per-service tech_docs_dir below wins in multi-service)
119
+ # tech_docs_dir → {spec_source}/specs/tech-docs # BE API contract + FE tech-design
118
120
  # domain_knowledge_dir → {spec_source}/specs/domain-knowledge
119
121
  # (You can still override these manually in paths: section below.)
120
122
  #
121
123
  # services: # domain → service submodule routing
122
124
  # {{DOMAIN_1}}: # must match @trace.domain in PRD files
123
- # path: "{{SERVICE_SUBMODULE_DIR}}" # relative path to service submodule
125
+ # path: "{{SERVICE_SUBMODULE_DIR}}" # relative path to service submodule (code + .trace/)
124
126
  # module: "{{STACK_MODULE}}" # e.g., java-spring, nextjs, flutter
125
- # specs_dir: "{{SERVICE_SUBMODULE_DIR}}/specs/bdd"
126
- # tech_docs_dir: "{{SERVICE_SUBMODULE_DIR}}/specs/tech-docs"
127
+ # # NOTE: with spec_source set, BDD + tech-docs are cross-team and live in the spec repo —
128
+ # # do NOT pin per-service specs_dir / tech_docs_dir here (they would be ignored).
129
+ # # Per-service specs_dir / tech_docs_dir apply ONLY when there is no spec_source.
127
130
  #
128
131
  # IMPORTANT — per-service CLAUDE.md:
129
132
  # Each service submodule should have its OWN CLAUDE.md ({path}/CLAUDE.md) defining its