@anhth2/spec-driven-dev-plugin 0.11.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 (173) hide show
  1. package/commands/debug.md +47 -7
  2. package/commands/define-product.md +47 -7
  3. package/commands/dev-gen-test.md +65 -17
  4. package/commands/dev-run-test.md +66 -18
  5. package/commands/dev-run-test.tmpl +1 -1
  6. package/commands/dev-smoke-test.md +47 -7
  7. package/commands/fix-bug.md +83 -13
  8. package/commands/fix-bug.tmpl +36 -6
  9. package/commands/generate-bdd.md +74 -21
  10. package/commands/generate-bdd.tmpl +9 -4
  11. package/commands/generate-code.md +118 -35
  12. package/commands/generate-code.tmpl +53 -18
  13. package/commands/generate-design-spec.md +47 -7
  14. package/commands/generate-prd.md +47 -7
  15. package/commands/generate-spec-manifest.md +47 -7
  16. package/commands/generate-tech-docs.md +234 -20
  17. package/commands/generate-tech-docs.tmpl +187 -13
  18. package/commands/learn.md +47 -7
  19. package/commands/map-testids.md +564 -0
  20. package/commands/map-testids.tmpl +81 -0
  21. package/commands/propose-scenario.md +78 -18
  22. package/commands/propose-scenario.tmpl +31 -11
  23. package/commands/qc-analyze.md +67 -12
  24. package/commands/qc-analyze.tmpl +20 -5
  25. package/commands/qc-design-test.md +51 -10
  26. package/commands/qc-design-test.tmpl +4 -3
  27. package/commands/qc-plan.md +50 -10
  28. package/commands/qc-plan.tmpl +3 -3
  29. package/commands/qc-report.md +60 -8
  30. package/commands/qc-report.tmpl +13 -1
  31. package/commands/qc-review.md +49 -9
  32. package/commands/qc-review.tmpl +2 -2
  33. package/commands/qc-run-test.md +75 -20
  34. package/commands/qc-run-test.tmpl +10 -3
  35. package/commands/refine-prd.md +47 -7
  36. package/commands/report-bug.md +63 -9
  37. package/commands/report-bug.tmpl +16 -2
  38. package/commands/review-code.md +47 -7
  39. package/commands/review-context.md +47 -7
  40. package/commands/review-tech-docs.md +50 -9
  41. package/commands/review-tech-docs.tmpl +3 -2
  42. package/commands/setup-ai-first.md +37 -4
  43. package/commands/setup-ai-first.tmpl +2 -2
  44. package/commands/sync.md +47 -11
  45. package/commands/sync.tmpl +12 -9
  46. package/commands/update-framework.md +35 -2
  47. package/commands/validate-traces.md +98 -40
  48. package/commands/validate-traces.tmpl +51 -33
  49. package/core/FRAMEWORK_VERSION +1 -1
  50. package/core/commands/debug.md +47 -7
  51. package/core/commands/define-product.md +47 -7
  52. package/core/commands/dev-gen-test.md +65 -17
  53. package/core/commands/dev-run-test.md +66 -18
  54. package/core/commands/dev-smoke-test.md +47 -7
  55. package/core/commands/fix-bug.md +83 -13
  56. package/core/commands/generate-bdd.md +74 -21
  57. package/core/commands/generate-code.md +118 -35
  58. package/core/commands/generate-design-spec.md +47 -7
  59. package/core/commands/generate-prd.md +47 -7
  60. package/core/commands/generate-spec-manifest.md +47 -7
  61. package/core/commands/generate-tech-docs.md +234 -20
  62. package/core/commands/learn.md +47 -7
  63. package/core/commands/map-testids.md +564 -0
  64. package/core/commands/propose-scenario.md +78 -18
  65. package/core/commands/qc-analyze.md +67 -12
  66. package/core/commands/qc-design-test.md +51 -10
  67. package/core/commands/qc-plan.md +50 -10
  68. package/core/commands/qc-report.md +60 -8
  69. package/core/commands/qc-review.md +49 -9
  70. package/core/commands/qc-run-test.md +75 -20
  71. package/core/commands/refine-prd.md +47 -7
  72. package/core/commands/report-bug.md +63 -9
  73. package/core/commands/review-code.md +47 -7
  74. package/core/commands/review-context.md +47 -7
  75. package/core/commands/review-tech-docs.md +50 -9
  76. package/core/commands/setup-ai-first.md +37 -4
  77. package/core/commands/sync.md +47 -11
  78. package/core/commands/update-framework.md +35 -2
  79. package/core/commands/validate-traces.md +98 -40
  80. package/core/modules/qc-playwright/stack-profile.yaml +4 -3
  81. package/core/skills/code/SKILL.md +82 -9
  82. package/core/skills/debug/SKILL.md +117 -11
  83. package/core/skills/design-spec/SKILL.md +47 -7
  84. package/core/skills/discovery/SKILL.md +47 -7
  85. package/core/skills/prd/SKILL.md +70 -4
  86. package/core/skills/qc/qa-analyst/acceptance-criteria.md +5 -1
  87. package/core/skills/qc/qa-analyst/business-rules.md +6 -2
  88. package/core/skills/qc/qa-analyst/data-flow.md +6 -2
  89. package/core/skills/qc/qa-analyst/spec-breakdown.md +7 -3
  90. package/core/skills/qc/qa-designer/e2e/journey.md +1 -1
  91. package/core/skills/qc/qa-designer/exploratory/charter.md +2 -2
  92. package/core/skills/qc/qa-designer/exploratory/explore-to-functional.md +1 -1
  93. package/core/skills/qc/qa-designer/functional/api.md +1 -1
  94. package/core/skills/qc/qa-designer/functional/gui-feature.md +1 -1
  95. package/core/skills/qc/qa-designer/functional/gui-screen.md +1 -1
  96. package/core/skills/qc/qa-designer/integration/api.md +1 -1
  97. package/core/skills/qc/qa-designer/integration/db.md +1 -1
  98. package/core/skills/qc/qa-designer/integration/gui.md +1 -1
  99. package/core/skills/qc/qa-designer/integration/kafka.md +1 -1
  100. package/core/skills/qc/qa-designer/non-functional.md +1 -1
  101. package/core/skills/qc/qa-planner/test-plan.md +4 -4
  102. package/core/skills/qc/qa-runner/exploratory/session.md +2 -2
  103. package/core/skills/setup-ai-first/SKILL.md +35 -2
  104. package/core/skills/spec/SKILL.md +70 -4
  105. package/core/skills/test/SKILL.md +129 -16
  106. package/core/steps/context-loader.md +12 -5
  107. package/core/steps/report-footer.md +35 -2
  108. package/core/steps/trace-mirror.md +18 -10
  109. package/core/templates/project-context.yaml +27 -6
  110. package/docs/01-getting-started/core-concepts.md +7 -7
  111. package/docs/01-getting-started/installation.md +4 -2
  112. package/docs/01-getting-started/quickstart.md +1 -1
  113. package/docs/02-guides/README.md +1 -2
  114. package/docs/02-guides/developer/README.md +1 -1
  115. package/docs/02-guides/developer/bdd-and-trace.md +10 -8
  116. package/docs/02-guides/developer/commands.md +4 -4
  117. package/docs/02-guides/developer/scenarios.md +26 -14
  118. package/docs/02-guides/developer/workflow.md +81 -19
  119. package/docs/02-guides/product-owner/README.md +6 -4
  120. package/docs/02-guides/product-owner/commands.md +1 -1
  121. package/docs/02-guides/product-owner/scenarios.md +80 -1
  122. package/docs/02-guides/tester/README.md +13 -10
  123. package/docs/02-guides/tester/bug-reporting.md +2 -2
  124. package/docs/02-guides/tester/qc-automation.md +165 -0
  125. package/docs/02-guides/tester/reading-specs.md +4 -4
  126. package/docs/02-guides/tester/scenarios.md +5 -5
  127. package/docs/02-guides/tester/spec-manifest.md +17 -12
  128. package/docs/02-guides/tester/test-checklist.md +3 -3
  129. package/docs/02-guides/tester/workflow.md +12 -14
  130. package/docs/03-concepts/architecture.md +7 -4
  131. package/docs/03-concepts/pipeline.md +37 -12
  132. package/docs/03-concepts/traceability.md +19 -18
  133. package/docs/04-operations/README.md +1 -1
  134. package/docs/04-operations/bug-flow.md +46 -5
  135. package/docs/04-operations/sync-and-update.md +186 -24
  136. package/docs/05-reference/README.md +3 -0
  137. package/docs/05-reference/command-cheatsheet.md +147 -0
  138. package/docs/05-reference/commands.md +73 -70
  139. package/docs/05-reference/modules.md +4 -4
  140. package/docs/05-reference/trace-schema.md +23 -16
  141. package/docs/README.md +3 -5
  142. package/modules/qc-playwright/stack-profile.yaml +4 -3
  143. package/package.json +1 -1
  144. package/skills/code/SKILL.md +82 -9
  145. package/skills/debug/SKILL.md +117 -11
  146. package/skills/design-spec/SKILL.md +47 -7
  147. package/skills/discovery/SKILL.md +47 -7
  148. package/skills/prd/SKILL.md +70 -4
  149. package/skills/qc/qa-analyst/acceptance-criteria.md +5 -1
  150. package/skills/qc/qa-analyst/business-rules.md +6 -2
  151. package/skills/qc/qa-analyst/data-flow.md +6 -2
  152. package/skills/qc/qa-analyst/spec-breakdown.md +7 -3
  153. package/skills/qc/qa-designer/e2e/journey.md +1 -1
  154. package/skills/qc/qa-designer/exploratory/charter.md +2 -2
  155. package/skills/qc/qa-designer/exploratory/explore-to-functional.md +1 -1
  156. package/skills/qc/qa-designer/functional/api.md +1 -1
  157. package/skills/qc/qa-designer/functional/gui-feature.md +1 -1
  158. package/skills/qc/qa-designer/functional/gui-screen.md +1 -1
  159. package/skills/qc/qa-designer/integration/api.md +1 -1
  160. package/skills/qc/qa-designer/integration/db.md +1 -1
  161. package/skills/qc/qa-designer/integration/gui.md +1 -1
  162. package/skills/qc/qa-designer/integration/kafka.md +1 -1
  163. package/skills/qc/qa-designer/non-functional.md +1 -1
  164. package/skills/qc/qa-planner/test-plan.md +4 -4
  165. package/skills/qc/qa-runner/exploratory/session.md +2 -2
  166. package/skills/setup-ai-first/SKILL.md +35 -2
  167. package/skills/spec/SKILL.md +70 -4
  168. package/skills/test/SKILL.md +129 -16
  169. package/steps/context-loader.md +12 -5
  170. package/steps/report-footer.md +35 -2
  171. package/steps/trace-mirror.md +18 -10
  172. package/templates/project-context.yaml +27 -6
  173. package/docs/02-guides/qc-automation.md +0 -92
@@ -147,6 +147,36 @@ Output Artifacts:
147
147
 
148
148
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
149
149
 
150
+ ## Pipeline Position
151
+
152
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
153
+ so the user always sees where this command sits in the end-to-end flow:
154
+
155
+ ```
156
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
157
+ ```
158
+
159
+ Find the current command in this phase legend and mark **its** phase in the map above:
160
+
161
+ | Phase | Commands |
162
+ |-------|----------|
163
+ | Discovery | `/define-product` |
164
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
165
+ | Design Spec | `/generate-design-spec` |
166
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
167
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
168
+ | Code | `/generate-code` · `/review-code` |
169
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
170
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
171
+ | Trace Audit | `/validate-traces` |
172
+
173
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
174
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
175
+
176
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
177
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
178
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
179
+
150
180
  ## Next Command Suggestion
151
181
 
152
182
  Suggest the logical next command based on workflow phase:
@@ -188,10 +218,13 @@ Suggest the logical next command based on workflow phase:
188
218
  Format the footer as:
189
219
  ```
190
220
  ---
191
- Status : {badge}
221
+ Status : {badge}
192
222
  {Output Artifacts block}
193
- Next : {suggested command with example arguments}
223
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
224
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
225
+ Next : {suggested command with example arguments}
194
226
  ```
227
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
195
228
 
196
229
 
197
230
  ```
@@ -127,6 +127,8 @@ Read `.agent/project-context.yaml`. Extract and store:
127
127
  - `paths.specs_dir` → BDD specs root
128
128
  - `paths.prd_dir` → PRD documents root
129
129
  - `paths.refinement_dir` → findings/review output dir
130
+ - `paths.qc_dir` → QC automation artifacts root (visible top-level, one subfolder per UC: `{qc_dir}/{UC-ID}/`)
131
+ - `paths.qc_skills_dir` → where qc-* commands load QC skills from (default bundled `.agent/skills/qc`; override to the QC team's own repo/submodule so framework upgrade won't overwrite them)
130
132
  - `paths.product_definitions_dir` → product definitions root
131
133
  - `paths.domain_knowledge_dir` → domain knowledge root
132
134
  - `paths.business_dictionary` → path to business-dictionary.md
@@ -139,6 +141,8 @@ If `paths` section is absent, use these defaults:
139
141
  - `specs_dir` = `specs/bdd`
140
142
  - `prd_dir` = `specs/prd`
141
143
  - `refinement_dir` = `.agent/review`
144
+ - `qc_dir` = `docs`
145
+ - `qc_skills_dir` = `.agent/skills/qc`
142
146
  - `product_definitions_dir` = `specs/product-definition`
143
147
  - `domain_knowledge_dir` = `specs/domain-knowledge`
144
148
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
@@ -164,7 +168,7 @@ If `services` section is present:
164
168
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
165
169
 
166
170
  **2. Route to service** — if active domain matches a key in `services`:
167
- - Override `paths.specs_dir` → `services.{domain}.specs_dir`
171
+ - 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.
168
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.
169
173
  - Store `active_service` = `services.{domain}.path`
170
174
  - Store `active_service_module` = `services.{domain}.module`
@@ -175,6 +179,7 @@ If `services` section is present:
175
179
  - Set `active_service = unresolved`
176
180
 
177
181
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
182
+ - 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`.)*
178
183
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
179
184
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
180
185
  - 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.)*
@@ -183,8 +188,10 @@ If `services` section is present:
183
188
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
184
189
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
185
190
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
191
+ - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
192
+ - 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`.)*
186
193
 
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.
194
+ > **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.
188
195
 
189
196
  ---
190
197
 
@@ -204,12 +211,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
204
211
  |----------|--------|
205
212
  | `conventions.test_command` | service's `conventions.test_command` |
206
213
  | `conventions.build_command` | service's `conventions.build_command` |
207
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
208
- | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
214
+ | `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`). |
215
+ | `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. |
209
216
 
210
217
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
211
218
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
212
- - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
219
+ - **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/`).
213
220
 
214
221
  **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).
215
222
 
@@ -395,16 +402,15 @@ Proceed to the next step of the calling command.
395
402
  Check whether `services` array exists in `project-context.yaml`.
396
403
 
397
404
  **If `services` exists (umbrella mode):**
398
- - Resolve the trace dir for each service:
399
- - Use `services[N].trace_dir` if explicitly set
400
- - Otherwise default to `{services[N].path}/.trace`
401
- - Set `all_trace_dirs = [ dir1, dir2, ... ]` — one per service
402
- - Step 1 will read TSVs from ALL dirs in `all_trace_dirs`, tagged by service name
403
- - **Resolve the Living Docs home (canonical report location):**
405
+ - Resolve the trace dir(s):
406
+ - **If `setup.spec_source` is set (consolidated trace):** `all_trace_dirs = [ {spec_source}/.trace ]` — a **single** authoritative location in the spec repo. Scenarios carry their owning service via the `@trace.service` field, so no per-service split is needed. This is the common case.
407
+ - **Else (no spec_source — legacy per-service trace):** one dir per service — `services[N].trace_dir` if set, else `{services[N].path}/.trace`; `all_trace_dirs = [ dir1, dir2, … ]`, tagged by service name on read.
408
+ - Step 1 reads TSVs from `all_trace_dirs`.
409
+ - **Resolve the Living Docs home (generated report location):**
404
410
  - If `setup.spec_source` is set → `living_docs_dir = {spec_source}/.living-docs`
405
411
  *(the shared specs module — mounted inside every service/umbrella workspace, so the panel resolves it no matter which submodule the dev is standing in)*
406
412
  - Else (umbrella without a separate spec repo) → `living_docs_dir = .living-docs` at umbrella root
407
- - **Resolve the panel mirror:** `panel_mirror = ./.trace` at the **current workspace root** (wherever this command runs). The VS Code panel reads `.trace/trace-report.json` from the open workspace — writing the merged report here is what makes the view non-empty when a dev opens a service submodule directly.
413
+ - **Resolve the panel mirror:** `panel_mirror = ./.trace` at the **current workspace root** (wherever this command runs). The VS Code panel reads `.trace/trace-report.json` from the open workspace — writing the report here is what makes the view non-empty when a dev opens a service submodule directly.
408
414
 
409
415
  **If no `services` key (single-service mode):**
410
416
  - Set `all_trace_dirs = [ {paths.trace_dir} ]`
@@ -456,18 +462,21 @@ If any layer is behind current PRD version → flag `PRD_DRIFT` and extract chan
456
462
 
457
463
  ### Step 5 — Tech-doc revision drift check
458
464
 
459
- For each UC that has a tech-doc, compare:
460
- - Current `@trace.revision` in `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md`
461
- - `tech_doc_revision` stored in `.tsv` (revision at time of codegen)
465
+ For each UC that has a tech-doc, compare the stored revision against the current doc — for **both** tech-doc kinds:
462
466
 
463
- If code was generated from an older revision flag `TECHDOC_DRIFT`.
467
+ - **BE contract:** `@trace.revision` in `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md` vs `tech_doc_revision` in `.tsv`.
468
+ Code generated from an older revision → flag `TECHDOC_DRIFT`.
469
+ - **FE tech-design:** `@trace.revision` in `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design-{platform}.md` vs `fe_tech_doc_revision` in `.tsv` (per platform row).
470
+ FE code generated from an older revision → flag `FE_TECHDOC_DRIFT`.
471
+
472
+ Skip whichever kind has no doc / no stored revision (`—`).
464
473
 
465
474
  ### Step 6 — Write status back to TSV
466
475
 
467
476
  *Skip this step if no TSV files existed (handled by Step 1 no-TSV path).*
468
477
 
469
478
  For each `.tsv` file processed: write updated `spec_ver`, `status`, `last_updated` back to disk.
470
- Do **not** modify `dev_selftest`/`dev_selftest_at` (owned by `/dev-run-test`) or `qc_status`/`qc_run_at` (owned by `/qc-run-test`); this command only reads them for the report.
479
+ Do **not** modify `dev_selftest`/`dev_selftest_at` (owned by `/dev-run-test`) or `qc_status`/`qc_run_at`/`qc_owner`/`qc_blocked_by` (owned by `/qc-run-test` + `/report-bug`); this command only reads them for the report.
471
480
 
472
481
  ### Step 7 — Compute dashboard aggregates
473
482
 
@@ -494,6 +503,9 @@ qc_skipped = rows where qc_status == skip
494
503
  qc_not_run = rows where qc_status in (not_run, —)
495
504
  # qc_status is the OFFICIAL QC automation result (set by /qc-run-test),
496
505
  # shown alongside — never merged with — dev_selftest.
506
+ waiting_dev = rows where qc_owner == dev # PM view: QC-found, waiting on dev to fix
507
+ waiting_po = rows where qc_owner == po # PM view: blocked, waiting on PO to confirm/clarify
508
+ # qc_owner + qc_blocked_by answer "case nào đang chờ ai" — surface as a "Waiting on" column.
497
509
  tech_docs_count = count .md files in {paths.tech_docs_dir}/{domain}/
498
510
  ```
499
511
 
@@ -528,6 +540,8 @@ Schema:
528
540
  "qc_failing": 0,
529
541
  "qc_skipped": 0,
530
542
  "qc_not_run": 0,
543
+ "waiting_dev": 0,
544
+ "waiting_po": 0,
531
545
  "tech_docs_count": 0
532
546
  },
533
547
  "prds": [
@@ -557,9 +571,12 @@ Schema:
557
571
  "dev_selftest_at": "<YYYY-MM-DD or null>",
558
572
  "qc_status": "pass | fail | skip | not_run",
559
573
  "qc_run_at": "<YYYY-MM-DD or null>",
574
+ "qc_owner": "dev | po | null",
575
+ "qc_blocked_by": "<BUG-id / GAP-id or null>",
560
576
  "prd_version": "<prd version when BDD was generated>",
561
577
  "bdd_version": "<bdd version when code was generated>",
562
578
  "tech_doc_revision": 0,
579
+ "fe_tech_doc_revision": 0,
563
580
  "status": "OK | DRIFT | GAP | UNTRACKED",
564
581
  "last_updated": "<YYYY-MM-DD>"
565
582
  }
@@ -609,6 +626,15 @@ Schema:
609
626
  "current_revision": 0,
610
627
  "fix": "/generate-code <UC-ID>"
611
628
  }
629
+ ],
630
+ "fe_techdoc_drift": [
631
+ {
632
+ "uc_id": "<UC-ID>",
633
+ "platform": "web | app",
634
+ "code_revision": 0,
635
+ "current_revision": 0,
636
+ "fix": "/generate-code <UC-ID> --phase=integration"
637
+ }
612
638
  ]
613
639
  }
614
640
  }
@@ -618,43 +644,42 @@ Schema:
618
644
  - `implemented_by`: use `null` (not `"—"`) in JSON when no value
619
645
  - `test_count`: use integer `0` (not `"—"`) when no tests
620
646
  - `test_classes`: use `[]` (not `"—"`) when no test classes
621
- - `tech_doc_revision`: use integer; `0` if not yet generated
647
+ - `tech_doc_revision` / `fe_tech_doc_revision`: use integer; `0` if not yet generated
622
648
  - `code_coverage_pct` / `test_coverage_pct`: round to nearest integer (0–100)
623
649
  - Always write to `{paths.trace_dir}/trace-report.json` regardless of domain filter — if a domain filter was applied, include only those PRDs in `prds[]` but note the domain in the `domain` field
624
- - **TSV `"—"` mapping**: when reading TSV files, map dash values to JSON types: `implemented_by: "—"` → `null`; `test_count: "—"` → `0`; `test_classes: "—"` → `[]`; `tech_doc_revision: "—"` → `0`; `dev_selftest: "—"` → `"not_run"`; `dev_selftest_at: "—"` → `null`; `qc_status: "—"` → `"not_run"`; `qc_run_at: "—"` → `null`
650
+ - **TSV `"—"` mapping**: when reading TSV files, map dash values to JSON types: `implemented_by: "—"` → `null`; `test_count: "—"` → `0`; `test_classes: "—"` → `[]`; `tech_doc_revision: "—"` → `0`; `fe_tech_doc_revision: "—"` → `0`; `dev_selftest: "—"` → `"not_run"`; `dev_selftest_at: "—"` → `null`; `qc_status: "—"` → `"not_run"`; `qc_run_at: "—"` → `null`; `qc_owner: "—"` → `null`; `qc_blocked_by: "—"` → `null`
651
+ - **Backward-compat:** older TSVs may be missing newer columns from the header — treat any absent column as its empty value (do not error): `qc_owner`/`qc_blocked_by` (pre-19-col) → `null`; `fe_tech_doc_revision` (pre-22-col) → `0`. The next `/generate-bdd` re-gen upgrades the header to the current 22-column layout.
625
652
 
626
653
  ### Step 8b — Living Docs Sync *(umbrella mode only)*
627
654
 
628
655
  *Skip this step in single-service mode.*
629
656
 
630
- Authoritative trace state stays in each service submodule's `.trace/` (committed there).
631
- This step publishes the merged report to the **canonical Living Docs home** (the specs
632
- module) and drops a local mirror so the panel is never empty.
657
+ **With `spec_source` set,** the authoritative trace TSVs already live in **one** place —
658
+ `{spec_source}/.trace/` (committed in the spec repo). There is **no per-service merge**:
659
+ each scenario row carries its owning service via `@trace.service`. This step just
660
+ (re)generates the report and refreshes the local panel.
633
661
 
634
- 1. **Write canonical merged report** to `{living_docs_dir}/` (`mkdir -p` it first):
635
- - `{living_docs_dir}/trace-report.json` merge every per-service `trace-report.json`
636
- into one document, add a `"service"` field per scenario row, recalc summary aggregates.
637
- - `{living_docs_dir}/{service-name}/{UC-ID}.tsv` copy each service's TSVs, namespaced
638
- by service. Overwrite; don't delete TSVs whose service source is gone (prior runs).
662
+ 1. **Write the report** to `{living_docs_dir}/trace-report.json` (`mkdir -p` first) — built
663
+ directly from `{spec_source}/.trace/*.tsv`, with a `"service"` field per scenario row and
664
+ the summary aggregates. *(Legacy no-`spec_source` umbrellas still merge every per-service
665
+ `trace-report.json` into one document, namespaced by service.)*
639
666
 
640
667
  2. **Mirror to the panel location** `{panel_mirror}` (`./.trace` at the current workspace
641
- root) so a dev who opened *this* repo (umbrella **or** a single service submodule) sees
642
- data immediately: copy `{living_docs_dir}/trace-report.json` → `{panel_mirror}/trace-report.json`
643
- (and the namespaced TSVs). If `panel_mirror` already resolves to `living_docs_dir`, skip.
668
+ root) so a dev who opened *this* repo sees data immediately: copy
669
+ `{living_docs_dir}/trace-report.json` (+ the `{UC-ID}.tsv` files) → `{panel_mirror}/`.
670
+ If `panel_mirror` already resolves to `{spec_source}/.trace`, skip.
644
671
 
645
672
  3. **Print sync summary:**
646
673
  ```
647
- Living Docs → {living_docs_dir}/ (canonical, in specs module)
648
- user-service : {N} TSV files
649
- order-service : {N} TSV files
650
- trace-report.json: merged ({total} scenarios across {S} services)
674
+ Living Docs → {living_docs_dir}/trace-report.json ({total} scenarios across {S} services)
675
+ Trace (authoritative) → {spec_source}/.trace/ (committed in spec repo)
651
676
  Panel mirror → {panel_mirror}/trace-report.json (current workspace)
652
677
  ```
653
678
 
654
- > **Note both locations are generated, gitignored mirrors.** Add `.living-docs/` to the
655
- > **specs module's** `.gitignore` and `.trace/` to the current repo's `.gitignore`. The only
656
- > committed, authoritative trace state is each service submodule's own `.trace/`. The report
657
- > is regenerated by `/validate-traces` or `/sync` — never commit it.
679
+ > **Note:** the committed, authoritative trace state is `{spec_source}/.trace/*.tsv` (in the
680
+ > spec repo one place for the PM). The report (`.living-docs/`) and the panel mirror
681
+ > (`./.trace` at a workspace that is not the spec repo) are **generated** — gitignore them;
682
+ > they are regenerated by `/validate-traces` or `/sync`.
658
683
 
659
684
  ## Output
660
685
 
@@ -680,6 +705,36 @@ Output Artifacts:
680
705
 
681
706
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
682
707
 
708
+ ## Pipeline Position
709
+
710
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
711
+ so the user always sees where this command sits in the end-to-end flow:
712
+
713
+ ```
714
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
715
+ ```
716
+
717
+ Find the current command in this phase legend and mark **its** phase in the map above:
718
+
719
+ | Phase | Commands |
720
+ |-------|----------|
721
+ | Discovery | `/define-product` |
722
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
723
+ | Design Spec | `/generate-design-spec` |
724
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
725
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
726
+ | Code | `/generate-code` · `/review-code` |
727
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
728
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
729
+ | Trace Audit | `/validate-traces` |
730
+
731
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
732
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
733
+
734
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
735
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
736
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
737
+
683
738
  ## Next Command Suggestion
684
739
 
685
740
  Suggest the logical next command based on workflow phase:
@@ -721,10 +776,13 @@ Suggest the logical next command based on workflow phase:
721
776
  Format the footer as:
722
777
  ```
723
778
  ---
724
- Status : {badge}
779
+ Status : {badge}
725
780
  {Output Artifacts block}
726
- Next : {suggested command with example arguments}
781
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
782
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
783
+ Next : {suggested command with example arguments}
727
784
  ```
785
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
728
786
 
729
787
 
730
788
  ```
@@ -19,16 +19,15 @@ Read-only check of coverage between specs, code, and tests — including PRD ver
19
19
  Check whether `services` array exists in `project-context.yaml`.
20
20
 
21
21
  **If `services` exists (umbrella mode):**
22
- - Resolve the trace dir for each service:
23
- - Use `services[N].trace_dir` if explicitly set
24
- - Otherwise default to `{services[N].path}/.trace`
25
- - Set `all_trace_dirs = [ dir1, dir2, ... ]` — one per service
26
- - Step 1 will read TSVs from ALL dirs in `all_trace_dirs`, tagged by service name
27
- - **Resolve the Living Docs home (canonical report location):**
22
+ - Resolve the trace dir(s):
23
+ - **If `setup.spec_source` is set (consolidated trace):** `all_trace_dirs = [ {spec_source}/.trace ]` — a **single** authoritative location in the spec repo. Scenarios carry their owning service via the `@trace.service` field, so no per-service split is needed. This is the common case.
24
+ - **Else (no spec_source — legacy per-service trace):** one dir per service — `services[N].trace_dir` if set, else `{services[N].path}/.trace`; `all_trace_dirs = [ dir1, dir2, … ]`, tagged by service name on read.
25
+ - Step 1 reads TSVs from `all_trace_dirs`.
26
+ - **Resolve the Living Docs home (generated report location):**
28
27
  - If `setup.spec_source` is set → `living_docs_dir = {spec_source}/.living-docs`
29
28
  *(the shared specs module — mounted inside every service/umbrella workspace, so the panel resolves it no matter which submodule the dev is standing in)*
30
29
  - Else (umbrella without a separate spec repo) → `living_docs_dir = .living-docs` at umbrella root
31
- - **Resolve the panel mirror:** `panel_mirror = ./.trace` at the **current workspace root** (wherever this command runs). The VS Code panel reads `.trace/trace-report.json` from the open workspace — writing the merged report here is what makes the view non-empty when a dev opens a service submodule directly.
30
+ - **Resolve the panel mirror:** `panel_mirror = ./.trace` at the **current workspace root** (wherever this command runs). The VS Code panel reads `.trace/trace-report.json` from the open workspace — writing the report here is what makes the view non-empty when a dev opens a service submodule directly.
32
31
 
33
32
  **If no `services` key (single-service mode):**
34
33
  - Set `all_trace_dirs = [ {paths.trace_dir} ]`
@@ -80,18 +79,21 @@ If any layer is behind current PRD version → flag `PRD_DRIFT` and extract chan
80
79
 
81
80
  ### Step 5 — Tech-doc revision drift check
82
81
 
83
- For each UC that has a tech-doc, compare:
84
- - Current `@trace.revision` in `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md`
85
- - `tech_doc_revision` stored in `.tsv` (revision at time of codegen)
82
+ For each UC that has a tech-doc, compare the stored revision against the current doc — for **both** tech-doc kinds:
86
83
 
87
- If code was generated from an older revision flag `TECHDOC_DRIFT`.
84
+ - **BE contract:** `@trace.revision` in `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md` vs `tech_doc_revision` in `.tsv`.
85
+ Code generated from an older revision → flag `TECHDOC_DRIFT`.
86
+ - **FE tech-design:** `@trace.revision` in `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design-{platform}.md` vs `fe_tech_doc_revision` in `.tsv` (per platform row).
87
+ FE code generated from an older revision → flag `FE_TECHDOC_DRIFT`.
88
+
89
+ Skip whichever kind has no doc / no stored revision (`—`).
88
90
 
89
91
  ### Step 6 — Write status back to TSV
90
92
 
91
93
  *Skip this step if no TSV files existed (handled by Step 1 no-TSV path).*
92
94
 
93
95
  For each `.tsv` file processed: write updated `spec_ver`, `status`, `last_updated` back to disk.
94
- Do **not** modify `dev_selftest`/`dev_selftest_at` (owned by `/dev-run-test`) or `qc_status`/`qc_run_at` (owned by `/qc-run-test`); this command only reads them for the report.
96
+ Do **not** modify `dev_selftest`/`dev_selftest_at` (owned by `/dev-run-test`) or `qc_status`/`qc_run_at`/`qc_owner`/`qc_blocked_by` (owned by `/qc-run-test` + `/report-bug`); this command only reads them for the report.
95
97
 
96
98
  ### Step 7 — Compute dashboard aggregates
97
99
 
@@ -118,6 +120,9 @@ qc_skipped = rows where qc_status == skip
118
120
  qc_not_run = rows where qc_status in (not_run, —)
119
121
  # qc_status is the OFFICIAL QC automation result (set by /qc-run-test),
120
122
  # shown alongside — never merged with — dev_selftest.
123
+ waiting_dev = rows where qc_owner == dev # PM view: QC-found, waiting on dev to fix
124
+ waiting_po = rows where qc_owner == po # PM view: blocked, waiting on PO to confirm/clarify
125
+ # qc_owner + qc_blocked_by answer "case nào đang chờ ai" — surface as a "Waiting on" column.
121
126
  tech_docs_count = count .md files in {paths.tech_docs_dir}/{domain}/
122
127
  ```
123
128
 
@@ -152,6 +157,8 @@ Schema:
152
157
  "qc_failing": 0,
153
158
  "qc_skipped": 0,
154
159
  "qc_not_run": 0,
160
+ "waiting_dev": 0,
161
+ "waiting_po": 0,
155
162
  "tech_docs_count": 0
156
163
  },
157
164
  "prds": [
@@ -181,9 +188,12 @@ Schema:
181
188
  "dev_selftest_at": "<YYYY-MM-DD or null>",
182
189
  "qc_status": "pass | fail | skip | not_run",
183
190
  "qc_run_at": "<YYYY-MM-DD or null>",
191
+ "qc_owner": "dev | po | null",
192
+ "qc_blocked_by": "<BUG-id / GAP-id or null>",
184
193
  "prd_version": "<prd version when BDD was generated>",
185
194
  "bdd_version": "<bdd version when code was generated>",
186
195
  "tech_doc_revision": 0,
196
+ "fe_tech_doc_revision": 0,
187
197
  "status": "OK | DRIFT | GAP | UNTRACKED",
188
198
  "last_updated": "<YYYY-MM-DD>"
189
199
  }
@@ -233,6 +243,15 @@ Schema:
233
243
  "current_revision": 0,
234
244
  "fix": "/generate-code <UC-ID>"
235
245
  }
246
+ ],
247
+ "fe_techdoc_drift": [
248
+ {
249
+ "uc_id": "<UC-ID>",
250
+ "platform": "web | app",
251
+ "code_revision": 0,
252
+ "current_revision": 0,
253
+ "fix": "/generate-code <UC-ID> --phase=integration"
254
+ }
236
255
  ]
237
256
  }
238
257
  }
@@ -242,43 +261,42 @@ Schema:
242
261
  - `implemented_by`: use `null` (not `"—"`) in JSON when no value
243
262
  - `test_count`: use integer `0` (not `"—"`) when no tests
244
263
  - `test_classes`: use `[]` (not `"—"`) when no test classes
245
- - `tech_doc_revision`: use integer; `0` if not yet generated
264
+ - `tech_doc_revision` / `fe_tech_doc_revision`: use integer; `0` if not yet generated
246
265
  - `code_coverage_pct` / `test_coverage_pct`: round to nearest integer (0–100)
247
266
  - Always write to `{paths.trace_dir}/trace-report.json` regardless of domain filter — if a domain filter was applied, include only those PRDs in `prds[]` but note the domain in the `domain` field
248
- - **TSV `"—"` mapping**: when reading TSV files, map dash values to JSON types: `implemented_by: "—"` → `null`; `test_count: "—"` → `0`; `test_classes: "—"` → `[]`; `tech_doc_revision: "—"` → `0`; `dev_selftest: "—"` → `"not_run"`; `dev_selftest_at: "—"` → `null`; `qc_status: "—"` → `"not_run"`; `qc_run_at: "—"` → `null`
267
+ - **TSV `"—"` mapping**: when reading TSV files, map dash values to JSON types: `implemented_by: "—"` → `null`; `test_count: "—"` → `0`; `test_classes: "—"` → `[]`; `tech_doc_revision: "—"` → `0`; `fe_tech_doc_revision: "—"` → `0`; `dev_selftest: "—"` → `"not_run"`; `dev_selftest_at: "—"` → `null`; `qc_status: "—"` → `"not_run"`; `qc_run_at: "—"` → `null`; `qc_owner: "—"` → `null`; `qc_blocked_by: "—"` → `null`
268
+ - **Backward-compat:** older TSVs may be missing newer columns from the header — treat any absent column as its empty value (do not error): `qc_owner`/`qc_blocked_by` (pre-19-col) → `null`; `fe_tech_doc_revision` (pre-22-col) → `0`. The next `/generate-bdd` re-gen upgrades the header to the current 22-column layout.
249
269
 
250
270
  ### Step 8b — Living Docs Sync *(umbrella mode only)*
251
271
 
252
272
  *Skip this step in single-service mode.*
253
273
 
254
- Authoritative trace state stays in each service submodule's `.trace/` (committed there).
255
- This step publishes the merged report to the **canonical Living Docs home** (the specs
256
- module) and drops a local mirror so the panel is never empty.
274
+ **With `spec_source` set,** the authoritative trace TSVs already live in **one** place —
275
+ `{spec_source}/.trace/` (committed in the spec repo). There is **no per-service merge**:
276
+ each scenario row carries its owning service via `@trace.service`. This step just
277
+ (re)generates the report and refreshes the local panel.
257
278
 
258
- 1. **Write canonical merged report** to `{living_docs_dir}/` (`mkdir -p` it first):
259
- - `{living_docs_dir}/trace-report.json` merge every per-service `trace-report.json`
260
- into one document, add a `"service"` field per scenario row, recalc summary aggregates.
261
- - `{living_docs_dir}/{service-name}/{UC-ID}.tsv` copy each service's TSVs, namespaced
262
- by service. Overwrite; don't delete TSVs whose service source is gone (prior runs).
279
+ 1. **Write the report** to `{living_docs_dir}/trace-report.json` (`mkdir -p` first) — built
280
+ directly from `{spec_source}/.trace/*.tsv`, with a `"service"` field per scenario row and
281
+ the summary aggregates. *(Legacy no-`spec_source` umbrellas still merge every per-service
282
+ `trace-report.json` into one document, namespaced by service.)*
263
283
 
264
284
  2. **Mirror to the panel location** `{panel_mirror}` (`./.trace` at the current workspace
265
- root) so a dev who opened *this* repo (umbrella **or** a single service submodule) sees
266
- data immediately: copy `{living_docs_dir}/trace-report.json` → `{panel_mirror}/trace-report.json`
267
- (and the namespaced TSVs). If `panel_mirror` already resolves to `living_docs_dir`, skip.
285
+ root) so a dev who opened *this* repo sees data immediately: copy
286
+ `{living_docs_dir}/trace-report.json` (+ the `{UC-ID}.tsv` files) → `{panel_mirror}/`.
287
+ If `panel_mirror` already resolves to `{spec_source}/.trace`, skip.
268
288
 
269
289
  3. **Print sync summary:**
270
290
  ```
271
- Living Docs → {living_docs_dir}/ (canonical, in specs module)
272
- user-service : {N} TSV files
273
- order-service : {N} TSV files
274
- trace-report.json: merged ({total} scenarios across {S} services)
291
+ Living Docs → {living_docs_dir}/trace-report.json ({total} scenarios across {S} services)
292
+ Trace (authoritative) → {spec_source}/.trace/ (committed in spec repo)
275
293
  Panel mirror → {panel_mirror}/trace-report.json (current workspace)
276
294
  ```
277
295
 
278
- > **Note both locations are generated, gitignored mirrors.** Add `.living-docs/` to the
279
- > **specs module's** `.gitignore` and `.trace/` to the current repo's `.gitignore`. The only
280
- > committed, authoritative trace state is each service submodule's own `.trace/`. The report
281
- > is regenerated by `/validate-traces` or `/sync` — never commit it.
296
+ > **Note:** the committed, authoritative trace state is `{spec_source}/.trace/*.tsv` (in the
297
+ > spec repo one place for the PM). The report (`.living-docs/`) and the panel mirror
298
+ > (`./.trace` at a workspace that is not the spec repo) are **generated** — gitignore them;
299
+ > they are regenerated by `/validate-traces` or `/sync`.
282
300
 
283
301
  ## Output
284
302
 
@@ -1 +1 @@
1
- 0.11.0
1
+ 0.14.0
@@ -128,6 +128,8 @@ Read `.agent/project-context.yaml`. Extract and store:
128
128
  - `paths.specs_dir` → BDD specs root
129
129
  - `paths.prd_dir` → PRD documents root
130
130
  - `paths.refinement_dir` → findings/review output dir
131
+ - `paths.qc_dir` → QC automation artifacts root (visible top-level, one subfolder per UC: `{qc_dir}/{UC-ID}/`)
132
+ - `paths.qc_skills_dir` → where qc-* commands load QC skills from (default bundled `.agent/skills/qc`; override to the QC team's own repo/submodule so framework upgrade won't overwrite them)
131
133
  - `paths.product_definitions_dir` → product definitions root
132
134
  - `paths.domain_knowledge_dir` → domain knowledge root
133
135
  - `paths.business_dictionary` → path to business-dictionary.md
@@ -140,6 +142,8 @@ If `paths` section is absent, use these defaults:
140
142
  - `specs_dir` = `specs/bdd`
141
143
  - `prd_dir` = `specs/prd`
142
144
  - `refinement_dir` = `.agent/review`
145
+ - `qc_dir` = `docs`
146
+ - `qc_skills_dir` = `.agent/skills/qc`
143
147
  - `product_definitions_dir` = `specs/product-definition`
144
148
  - `domain_knowledge_dir` = `specs/domain-knowledge`
145
149
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
@@ -165,7 +169,7 @@ If `services` section is present:
165
169
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
166
170
 
167
171
  **2. Route to service** — if active domain matches a key in `services`:
168
- - Override `paths.specs_dir` → `services.{domain}.specs_dir`
172
+ - 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.
169
173
  - 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.
170
174
  - Store `active_service` = `services.{domain}.path`
171
175
  - Store `active_service_module` = `services.{domain}.module`
@@ -176,6 +180,7 @@ If `services` section is present:
176
180
  - Set `active_service = unresolved`
177
181
 
178
182
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
183
+ - 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`.)*
179
184
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
180
185
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
181
186
  - 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.)*
@@ -184,8 +189,10 @@ If `services` section is present:
184
189
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
185
190
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
186
191
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
192
+ - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
193
+ - 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`.)*
187
194
 
188
- > **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.
195
+ > **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.
189
196
 
190
197
  ---
191
198
 
@@ -205,12 +212,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
205
212
  |----------|--------|
206
213
  | `conventions.test_command` | service's `conventions.test_command` |
207
214
  | `conventions.build_command` | service's `conventions.build_command` |
208
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
209
- | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
215
+ | `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`). |
216
+ | `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. |
210
217
 
211
218
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
212
219
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
213
- - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
220
+ - **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/`).
214
221
 
215
222
  **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).
216
223
 
@@ -613,6 +620,36 @@ Output Artifacts:
613
620
 
614
621
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
615
622
 
623
+ ## Pipeline Position
624
+
625
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
626
+ so the user always sees where this command sits in the end-to-end flow:
627
+
628
+ ```
629
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
630
+ ```
631
+
632
+ Find the current command in this phase legend and mark **its** phase in the map above:
633
+
634
+ | Phase | Commands |
635
+ |-------|----------|
636
+ | Discovery | `/define-product` |
637
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
638
+ | Design Spec | `/generate-design-spec` |
639
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
640
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
641
+ | Code | `/generate-code` · `/review-code` |
642
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
643
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
644
+ | Trace Audit | `/validate-traces` |
645
+
646
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
647
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
648
+
649
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
650
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
651
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
652
+
616
653
  ## Next Command Suggestion
617
654
 
618
655
  Suggest the logical next command based on workflow phase:
@@ -654,10 +691,13 @@ Suggest the logical next command based on workflow phase:
654
691
  Format the footer as:
655
692
  ```
656
693
  ---
657
- Status : {badge}
694
+ Status : {badge}
658
695
  {Output Artifacts block}
659
- Next : {suggested command with example arguments}
696
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
697
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
698
+ Next : {suggested command with example arguments}
660
699
  ```
700
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
661
701
 
662
702
 
663
703
  ```