@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
@@ -108,7 +108,7 @@ If `services` section is present:
108
108
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
109
109
 
110
110
  **2. Route to service** — if active domain matches a key in `services`:
111
- - Override `paths.specs_dir` → `services.{domain}.specs_dir`
111
+ - 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.
112
112
  - 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.
113
113
  - Store `active_service` = `services.{domain}.path`
114
114
  - Store `active_service_module` = `services.{domain}.module`
@@ -119,6 +119,7 @@ If `services` section is present:
119
119
  - Set `active_service = unresolved`
120
120
 
121
121
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
122
+ - 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`.)*
122
123
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
123
124
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
124
125
  - 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.)*
@@ -128,8 +129,9 @@ If `services` section is present:
128
129
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
129
130
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
130
131
  - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
132
+ - 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`.)*
131
133
 
132
- > **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.
134
+ > **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.
133
135
 
134
136
  ---
135
137
 
@@ -149,12 +151,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
149
151
  |----------|--------|
150
152
  | `conventions.test_command` | service's `conventions.test_command` |
151
153
  | `conventions.build_command` | service's `conventions.build_command` |
152
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
153
- | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
154
+ | `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`). |
155
+ | `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. |
154
156
 
155
157
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
156
158
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
157
- - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
159
+ - **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/`).
158
160
 
159
161
  **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).
160
162
 
@@ -456,6 +458,36 @@ Output Artifacts:
456
458
 
457
459
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
458
460
 
461
+ ## Pipeline Position
462
+
463
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
464
+ so the user always sees where this command sits in the end-to-end flow:
465
+
466
+ ```
467
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
468
+ ```
469
+
470
+ Find the current command in this phase legend and mark **its** phase in the map above:
471
+
472
+ | Phase | Commands |
473
+ |-------|----------|
474
+ | Discovery | `/define-product` |
475
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
476
+ | Design Spec | `/generate-design-spec` |
477
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
478
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
479
+ | Code | `/generate-code` · `/review-code` |
480
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
481
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
482
+ | Trace Audit | `/validate-traces` |
483
+
484
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
485
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
486
+
487
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
488
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
489
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
490
+
459
491
  ## Next Command Suggestion
460
492
 
461
493
  Suggest the logical next command based on workflow phase:
@@ -497,10 +529,13 @@ Suggest the logical next command based on workflow phase:
497
529
  Format the footer as:
498
530
  ```
499
531
  ---
500
- Status : {badge}
532
+ Status : {badge}
501
533
  {Output Artifacts block}
502
- Next : {suggested command with example arguments}
534
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
535
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
536
+ Next : {suggested command with example arguments}
503
537
  ```
538
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
504
539
 
505
540
 
506
541
  ---
@@ -607,6 +642,36 @@ Output Artifacts:
607
642
 
608
643
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
609
644
 
645
+ ## Pipeline Position
646
+
647
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
648
+ so the user always sees where this command sits in the end-to-end flow:
649
+
650
+ ```
651
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
652
+ ```
653
+
654
+ Find the current command in this phase legend and mark **its** phase in the map above:
655
+
656
+ | Phase | Commands |
657
+ |-------|----------|
658
+ | Discovery | `/define-product` |
659
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
660
+ | Design Spec | `/generate-design-spec` |
661
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
662
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
663
+ | Code | `/generate-code` · `/review-code` |
664
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
665
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
666
+ | Trace Audit | `/validate-traces` |
667
+
668
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
669
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
670
+
671
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
672
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
673
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
674
+
610
675
  ## Next Command Suggestion
611
676
 
612
677
  Suggest the logical next command based on workflow phase:
@@ -648,10 +713,13 @@ Suggest the logical next command based on workflow phase:
648
713
  Format the footer as:
649
714
  ```
650
715
  ---
651
- Status : {badge}
716
+ Status : {badge}
652
717
  {Output Artifacts block}
653
- Next : {suggested command with example arguments}
718
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
719
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
720
+ Next : {suggested command with example arguments}
654
721
  ```
722
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
655
723
 
656
724
 
657
725
  ---
@@ -715,6 +783,36 @@ Output Artifacts:
715
783
 
716
784
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
717
785
 
786
+ ## Pipeline Position
787
+
788
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
789
+ so the user always sees where this command sits in the end-to-end flow:
790
+
791
+ ```
792
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
793
+ ```
794
+
795
+ Find the current command in this phase legend and mark **its** phase in the map above:
796
+
797
+ | Phase | Commands |
798
+ |-------|----------|
799
+ | Discovery | `/define-product` |
800
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
801
+ | Design Spec | `/generate-design-spec` |
802
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
803
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
804
+ | Code | `/generate-code` · `/review-code` |
805
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
806
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
807
+ | Trace Audit | `/validate-traces` |
808
+
809
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
810
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
811
+
812
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
813
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
814
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
815
+
718
816
  ## Next Command Suggestion
719
817
 
720
818
  Suggest the logical next command based on workflow phase:
@@ -756,8 +854,11 @@ Suggest the logical next command based on workflow phase:
756
854
  Format the footer as:
757
855
  ```
758
856
  ---
759
- Status : {badge}
857
+ Status : {badge}
760
858
  {Output Artifacts block}
761
- Next : {suggested command with example arguments}
859
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
860
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
861
+ Next : {suggested command with example arguments}
762
862
  ```
863
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
763
864
 
@@ -182,7 +182,7 @@ If `services` section is present:
182
182
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
183
183
 
184
184
  **2. Route to service** — if active domain matches a key in `services`:
185
- - Override `paths.specs_dir` → `services.{domain}.specs_dir`
185
+ - 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.
186
186
  - 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.
187
187
  - Store `active_service` = `services.{domain}.path`
188
188
  - Store `active_service_module` = `services.{domain}.module`
@@ -193,6 +193,7 @@ If `services` section is present:
193
193
  - Set `active_service = unresolved`
194
194
 
195
195
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
196
+ - 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`.)*
196
197
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
197
198
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
198
199
  - 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.)*
@@ -202,8 +203,9 @@ If `services` section is present:
202
203
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
203
204
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
204
205
  - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
206
+ - 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`.)*
205
207
 
206
- > **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.
208
+ > **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.
207
209
 
208
210
  ---
209
211
 
@@ -223,12 +225,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
223
225
  |----------|--------|
224
226
  | `conventions.test_command` | service's `conventions.test_command` |
225
227
  | `conventions.build_command` | service's `conventions.build_command` |
226
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
227
- | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
228
+ | `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`). |
229
+ | `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. |
228
230
 
229
231
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
230
232
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
231
- - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
233
+ - **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/`).
232
234
 
233
235
  **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).
234
236
 
@@ -485,6 +487,36 @@ Output Artifacts:
485
487
 
486
488
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
487
489
 
490
+ ## Pipeline Position
491
+
492
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
493
+ so the user always sees where this command sits in the end-to-end flow:
494
+
495
+ ```
496
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
497
+ ```
498
+
499
+ Find the current command in this phase legend and mark **its** phase in the map above:
500
+
501
+ | Phase | Commands |
502
+ |-------|----------|
503
+ | Discovery | `/define-product` |
504
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
505
+ | Design Spec | `/generate-design-spec` |
506
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
507
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
508
+ | Code | `/generate-code` · `/review-code` |
509
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
510
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
511
+ | Trace Audit | `/validate-traces` |
512
+
513
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
514
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
515
+
516
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
517
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
518
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
519
+
488
520
  ## Next Command Suggestion
489
521
 
490
522
  Suggest the logical next command based on workflow phase:
@@ -526,10 +558,13 @@ Suggest the logical next command based on workflow phase:
526
558
  Format the footer as:
527
559
  ```
528
560
  ---
529
- Status : {badge}
561
+ Status : {badge}
530
562
  {Output Artifacts block}
531
- Next : {suggested command with example arguments}
563
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
564
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
565
+ Next : {suggested command with example arguments}
532
566
  ```
567
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
533
568
 
534
569
 
535
570
  ```
@@ -87,7 +87,7 @@ If `services` section is present:
87
87
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
88
88
 
89
89
  **2. Route to service** — if active domain matches a key in `services`:
90
- - Override `paths.specs_dir` → `services.{domain}.specs_dir`
90
+ - 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.
91
91
  - 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.
92
92
  - Store `active_service` = `services.{domain}.path`
93
93
  - Store `active_service_module` = `services.{domain}.module`
@@ -98,6 +98,7 @@ If `services` section is present:
98
98
  - Set `active_service = unresolved`
99
99
 
100
100
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
101
+ - 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`.)*
101
102
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
102
103
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
103
104
  - 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.)*
@@ -107,8 +108,9 @@ If `services` section is present:
107
108
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
108
109
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
109
110
  - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
111
+ - 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`.)*
110
112
 
111
- > **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.
113
+ > **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.
112
114
 
113
115
  ---
114
116
 
@@ -128,12 +130,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
128
130
  |----------|--------|
129
131
  | `conventions.test_command` | service's `conventions.test_command` |
130
132
  | `conventions.build_command` | service's `conventions.build_command` |
131
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
132
- | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
133
+ | `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`). |
134
+ | `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. |
133
135
 
134
136
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
135
137
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
136
- - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
138
+ - **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/`).
137
139
 
138
140
  **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).
139
141
 
@@ -466,6 +468,36 @@ Output Artifacts:
466
468
 
467
469
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
468
470
 
471
+ ## Pipeline Position
472
+
473
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
474
+ so the user always sees where this command sits in the end-to-end flow:
475
+
476
+ ```
477
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
478
+ ```
479
+
480
+ Find the current command in this phase legend and mark **its** phase in the map above:
481
+
482
+ | Phase | Commands |
483
+ |-------|----------|
484
+ | Discovery | `/define-product` |
485
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
486
+ | Design Spec | `/generate-design-spec` |
487
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
488
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
489
+ | Code | `/generate-code` · `/review-code` |
490
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
491
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
492
+ | Trace Audit | `/validate-traces` |
493
+
494
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
495
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
496
+
497
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
498
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
499
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
500
+
469
501
  ## Next Command Suggestion
470
502
 
471
503
  Suggest the logical next command based on workflow phase:
@@ -507,8 +539,11 @@ Suggest the logical next command based on workflow phase:
507
539
  Format the footer as:
508
540
  ```
509
541
  ---
510
- Status : {badge}
542
+ Status : {badge}
511
543
  {Output Artifacts block}
512
- Next : {suggested command with example arguments}
544
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
545
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
546
+ Next : {suggested command with example arguments}
513
547
  ```
548
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
514
549
 
@@ -180,6 +180,36 @@ Output Artifacts:
180
180
 
181
181
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
182
182
 
183
+ ## Pipeline Position
184
+
185
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
186
+ so the user always sees where this command sits in the end-to-end flow:
187
+
188
+ ```
189
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
190
+ ```
191
+
192
+ Find the current command in this phase legend and mark **its** phase in the map above:
193
+
194
+ | Phase | Commands |
195
+ |-------|----------|
196
+ | Discovery | `/define-product` |
197
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
198
+ | Design Spec | `/generate-design-spec` |
199
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
200
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
201
+ | Code | `/generate-code` · `/review-code` |
202
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
203
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
204
+ | Trace Audit | `/validate-traces` |
205
+
206
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
207
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
208
+
209
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
210
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
211
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
212
+
183
213
  ## Next Command Suggestion
184
214
 
185
215
  Suggest the logical next command based on workflow phase:
@@ -221,10 +251,13 @@ Suggest the logical next command based on workflow phase:
221
251
  Format the footer as:
222
252
  ```
223
253
  ---
224
- Status : {badge}
254
+ Status : {badge}
225
255
  {Output Artifacts block}
226
- Next : {suggested command with example arguments}
256
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
257
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
258
+ Next : {suggested command with example arguments}
227
259
  ```
260
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
228
261
 
229
262
 
230
263
  ---
@@ -436,6 +469,36 @@ Output Artifacts:
436
469
 
437
470
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
438
471
 
472
+ ## Pipeline Position
473
+
474
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
475
+ so the user always sees where this command sits in the end-to-end flow:
476
+
477
+ ```
478
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
479
+ ```
480
+
481
+ Find the current command in this phase legend and mark **its** phase in the map above:
482
+
483
+ | Phase | Commands |
484
+ |-------|----------|
485
+ | Discovery | `/define-product` |
486
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
487
+ | Design Spec | `/generate-design-spec` |
488
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
489
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
490
+ | Code | `/generate-code` · `/review-code` |
491
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
492
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
493
+ | Trace Audit | `/validate-traces` |
494
+
495
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
496
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
497
+
498
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
499
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
500
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
501
+
439
502
  ## Next Command Suggestion
440
503
 
441
504
  Suggest the logical next command based on workflow phase:
@@ -477,8 +540,11 @@ Suggest the logical next command based on workflow phase:
477
540
  Format the footer as:
478
541
  ```
479
542
  ---
480
- Status : {badge}
543
+ Status : {badge}
481
544
  {Output Artifacts block}
482
- Next : {suggested command with example arguments}
545
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
546
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
547
+ Next : {suggested command with example arguments}
483
548
  ```
549
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
484
550
 
@@ -126,6 +126,36 @@ Output Artifacts:
126
126
 
127
127
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
128
128
 
129
+ ## Pipeline Position
130
+
131
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
132
+ so the user always sees where this command sits in the end-to-end flow:
133
+
134
+ ```
135
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
136
+ ```
137
+
138
+ Find the current command in this phase legend and mark **its** phase in the map above:
139
+
140
+ | Phase | Commands |
141
+ |-------|----------|
142
+ | Discovery | `/define-product` |
143
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
144
+ | Design Spec | `/generate-design-spec` |
145
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
146
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
147
+ | Code | `/generate-code` · `/review-code` |
148
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
149
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
150
+ | Trace Audit | `/validate-traces` |
151
+
152
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
153
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
154
+
155
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
156
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
157
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
158
+
129
159
  ## Next Command Suggestion
130
160
 
131
161
  Suggest the logical next command based on workflow phase:
@@ -167,8 +197,11 @@ Suggest the logical next command based on workflow phase:
167
197
  Format the footer as:
168
198
  ```
169
199
  ---
170
- Status : {badge}
200
+ Status : {badge}
171
201
  {Output Artifacts block}
172
- Next : {suggested command with example arguments}
202
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
203
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
204
+ Next : {suggested command with example arguments}
173
205
  ```
206
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
174
207