@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
@@ -174,7 +174,7 @@ If `services` section is present:
174
174
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
175
175
 
176
176
  **2. Route to service** — if active domain matches a key in `services`:
177
- - Override `paths.specs_dir` → `services.{domain}.specs_dir`
177
+ - 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.
178
178
  - 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.
179
179
  - Store `active_service` = `services.{domain}.path`
180
180
  - Store `active_service_module` = `services.{domain}.module`
@@ -185,6 +185,7 @@ If `services` section is present:
185
185
  - Set `active_service = unresolved`
186
186
 
187
187
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
188
+ - 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`.)*
188
189
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
189
190
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
190
191
  - 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.)*
@@ -194,8 +195,9 @@ If `services` section is present:
194
195
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
195
196
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
196
197
  - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
198
+ - 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`.)*
197
199
 
198
- > **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.
200
+ > **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.
199
201
 
200
202
  ---
201
203
 
@@ -215,12 +217,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
215
217
  |----------|--------|
216
218
  | `conventions.test_command` | service's `conventions.test_command` |
217
219
  | `conventions.build_command` | service's `conventions.build_command` |
218
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
219
- | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
220
+ | `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`). |
221
+ | `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. |
220
222
 
221
223
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
222
224
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
223
- - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
225
+ - **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/`).
224
226
 
225
227
  **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).
226
228
 
@@ -445,6 +447,36 @@ Output Artifacts:
445
447
 
446
448
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
447
449
 
450
+ ## Pipeline Position
451
+
452
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
453
+ so the user always sees where this command sits in the end-to-end flow:
454
+
455
+ ```
456
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
457
+ ```
458
+
459
+ Find the current command in this phase legend and mark **its** phase in the map above:
460
+
461
+ | Phase | Commands |
462
+ |-------|----------|
463
+ | Discovery | `/define-product` |
464
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
465
+ | Design Spec | `/generate-design-spec` |
466
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
467
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
468
+ | Code | `/generate-code` · `/review-code` |
469
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
470
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
471
+ | Trace Audit | `/validate-traces` |
472
+
473
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
474
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
475
+
476
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
477
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
478
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
479
+
448
480
  ## Next Command Suggestion
449
481
 
450
482
  Suggest the logical next command based on workflow phase:
@@ -486,10 +518,13 @@ Suggest the logical next command based on workflow phase:
486
518
  Format the footer as:
487
519
  ```
488
520
  ---
489
- Status : {badge}
521
+ Status : {badge}
490
522
  {Output Artifacts block}
491
- Next : {suggested command with example arguments}
523
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
524
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
525
+ Next : {suggested command with example arguments}
492
526
  ```
527
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
493
528
 
494
529
 
495
530
  ```
@@ -174,7 +174,7 @@ If `services` section is present:
174
174
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
175
175
 
176
176
  **2. Route to service** — if active domain matches a key in `services`:
177
- - Override `paths.specs_dir` → `services.{domain}.specs_dir`
177
+ - 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.
178
178
  - 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.
179
179
  - Store `active_service` = `services.{domain}.path`
180
180
  - Store `active_service_module` = `services.{domain}.module`
@@ -185,6 +185,7 @@ If `services` section is present:
185
185
  - Set `active_service = unresolved`
186
186
 
187
187
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
188
+ - 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`.)*
188
189
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
189
190
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
190
191
  - 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.)*
@@ -194,8 +195,9 @@ If `services` section is present:
194
195
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
195
196
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
196
197
  - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
198
+ - 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`.)*
197
199
 
198
- > **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.
200
+ > **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.
199
201
 
200
202
  ---
201
203
 
@@ -215,12 +217,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
215
217
  |----------|--------|
216
218
  | `conventions.test_command` | service's `conventions.test_command` |
217
219
  | `conventions.build_command` | service's `conventions.build_command` |
218
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
219
- | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
220
+ | `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`). |
221
+ | `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. |
220
222
 
221
223
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
222
224
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
223
- - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
225
+ - **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/`).
224
226
 
225
227
  **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).
226
228
 
@@ -407,6 +409,7 @@ pytest-playwright scripts + Page Objects, run them, and report the result per sc
407
409
  Stack rules (MANDATORY — from `modules/qc-playwright/stack-profile.yaml`):
408
410
  - Markdown-first: never generate Python without a reviewed `.Test.md`.
409
411
  - Page Object extends slim `BasePage`, 3 layers: locators `_x()`, actions `verb_noun()`, assertions `assert_x()` using `expect()`.
412
+ - **Locators from the test-id contract (no runtime scan).** Read the FE tech-design §2b *Test Selectors* table at `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design-{platform}.md` (if present) and build each Page Object locator from its stable test-id — web `get_by_test_id("...")`, RN `testID`, Flutter `Key`/`Semantics`, native `accessibilityIdentifier`. **Prefer the map; fall back** to role/label/text/CSS (the slower scan) only for an actionable element that has **no** test-id in §2b — and note it so the gap can be added to the tech-design.
410
413
  - pytest-playwright fixtures; each test independent; group by (role, account) so auth never interleaves.
411
414
  - No hard-coded URL/cred/timeout (use `Env.*` / `CONFIG[...]`); no `time.sleep()`; no Allure.
412
415
  - Cover **100%** of TCs in the file — every TC ends Pass/Fail/Skip (none left Draft).
@@ -430,7 +433,7 @@ def test_TC_<FEATURE>_001_...(...): ...
430
433
  ## Write Trace State — qc_status (OFFICIAL QC result)
431
434
 
432
435
  After the run, update `{paths.trace_dir}/{UC-ID}.tsv` — for each scenario row (matched by
433
- `sc_id` via its tests' `@trace.verifies={UC-ID}-SC{N}` tag):
436
+ `sc_id` via its tests' `@trace.verifies={UC-ID}-SC{N}` tag). *(Umbrella + `spec_source`: `trace_dir` is `{spec_source}/.trace` — write the `qc_status` update into the **spec repo** and commit/push the spec submodule, same as `feedback/`.)*
434
437
 
435
438
  | Column | Value |
436
439
  |--------|-------|
@@ -451,21 +454,29 @@ separate signals; both are orthogonal to `status` (OK/GAP/DRIFT/UNTRACKED = cove
451
454
  # Refresh Living Docs panel mirror *(local, umbrella mode)*
452
455
 
453
456
  *Skip entirely in single-service mode (no `services` and no `setup.spec_source`) — there
454
- the service `.trace/` IS the panel location, so nothing to mirror.*
457
+ the repo's own `.trace/` IS the panel location, so nothing to mirror.*
455
458
 
456
- After updating the authoritative service TSV(s) at `{paths.trace_dir}`:
459
+ After updating the authoritative TSV(s) at `{paths.trace_dir}`:
457
460
 
458
- 1. Resolve `panel_mirror = ./.trace` at the **current workspace root** (where this command runs).
461
+ **When `setup.spec_source` is set (consolidated trace the common case):**
462
+ `{paths.trace_dir}` resolves to `{spec_source}/.trace` — the single authoritative location.
463
+ This command runs from `service_root`, so the write is **cross-repo into the spec submodule**;
464
+ commit/push the spec submodule for the trace update (same as `feedback/`).
465
+ 1. Resolve `panel_mirror = ./.trace` at the **current workspace root**.
459
466
  2. If `panel_mirror` resolves to a different path than `{paths.trace_dir}`, copy each
460
- just-updated `{UC-ID}.tsv` → `{panel_mirror}/{service-name}/{UC-ID}.tsv`
461
- (create the dir; overwrite). Use `active_service` for `{service-name}`.
467
+ just-updated `{UC-ID}.tsv` → `{panel_mirror}/{UC-ID}.tsv` (create the dir; overwrite).
468
+ No per-service namespacing — there is one trace set; the owning service is carried in each
469
+ row's `@trace.service`.
470
+
471
+ **Legacy (no `spec_source` — per-service trace):**
472
+ Copy each just-updated `{UC-ID}.tsv` → `{panel_mirror}/{service-name}/{UC-ID}.tsv`
473
+ (namespaced by `active_service`).
462
474
 
463
475
  This keeps the open workspace's Living Docs panel current **between syncs** — it is a
464
- **local convenience mirror only**. The *canonical* report in the spec module
465
- (`{spec_source}/.living-docs/`) and the merged `trace-report.json` are rebuilt by
466
- `/sync` or `/validate-traces` (those need every service's data, so a single per-UC
467
- command cannot produce them). For orchestrated commands, do this once in the orchestrator
468
- after all sub-agents return — not inside each sub-agent.
476
+ **local convenience mirror only**. The merged `trace-report.json` (canonical, in
477
+ `{spec_source}/.living-docs/`) is rebuilt by `/sync` or `/validate-traces`. For orchestrated
478
+ commands, do this once in the orchestrator after all sub-agents return — not inside each
479
+ sub-agent.
469
480
 
470
481
 
471
482
  ## Report
@@ -492,6 +503,36 @@ Output Artifacts:
492
503
 
493
504
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
494
505
 
506
+ ## Pipeline Position
507
+
508
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
509
+ so the user always sees where this command sits in the end-to-end flow:
510
+
511
+ ```
512
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
513
+ ```
514
+
515
+ Find the current command in this phase legend and mark **its** phase in the map above:
516
+
517
+ | Phase | Commands |
518
+ |-------|----------|
519
+ | Discovery | `/define-product` |
520
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
521
+ | Design Spec | `/generate-design-spec` |
522
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
523
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
524
+ | Code | `/generate-code` · `/review-code` |
525
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
526
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
527
+ | Trace Audit | `/validate-traces` |
528
+
529
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
530
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
531
+
532
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
533
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
534
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
535
+
495
536
  ## Next Command Suggestion
496
537
 
497
538
  Suggest the logical next command based on workflow phase:
@@ -533,10 +574,13 @@ Suggest the logical next command based on workflow phase:
533
574
  Format the footer as:
534
575
  ```
535
576
  ---
536
- Status : {badge}
577
+ Status : {badge}
537
578
  {Output Artifacts block}
538
- Next : {suggested command with example arguments}
579
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
580
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
581
+ Next : {suggested command with example arguments}
539
582
  ```
583
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
540
584
 
541
585
 
542
586
  ```
@@ -26,6 +26,7 @@ pytest-playwright scripts + Page Objects, run them, and report the result per sc
26
26
  Stack rules (MANDATORY — from `modules/qc-playwright/stack-profile.yaml`):
27
27
  - Markdown-first: never generate Python without a reviewed `.Test.md`.
28
28
  - Page Object extends slim `BasePage`, 3 layers: locators `_x()`, actions `verb_noun()`, assertions `assert_x()` using `expect()`.
29
+ - **Locators from the test-id contract (no runtime scan).** Read the FE tech-design §2b *Test Selectors* table at `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design-{platform}.md` (if present) and build each Page Object locator from its stable test-id — web `get_by_test_id("...")`, RN `testID`, Flutter `Key`/`Semantics`, native `accessibilityIdentifier`. **Prefer the map; fall back** to role/label/text/CSS (the slower scan) only for an actionable element that has **no** test-id in §2b — and note it so the gap can be added to the tech-design.
29
30
  - pytest-playwright fixtures; each test independent; group by (role, account) so auth never interleaves.
30
31
  - No hard-coded URL/cred/timeout (use `Env.*` / `CONFIG[...]`); no `time.sleep()`; no Allure.
31
32
  - Cover **100%** of TCs in the file — every TC ends Pass/Fail/Skip (none left Draft).
@@ -49,7 +50,7 @@ def test_TC_<FEATURE>_001_...(...): ...
49
50
  ## Write Trace State — qc_status (OFFICIAL QC result)
50
51
 
51
52
  After the run, update `{paths.trace_dir}/{UC-ID}.tsv` — for each scenario row (matched by
52
- `sc_id` via its tests' `@trace.verifies={UC-ID}-SC{N}` tag):
53
+ `sc_id` via its tests' `@trace.verifies={UC-ID}-SC{N}` tag). *(Umbrella + `spec_source`: `trace_dir` is `{spec_source}/.trace` — write the `qc_status` update into the **spec repo** and commit/push the spec submodule, same as `feedback/`.)*
53
54
 
54
55
  | Column | Value |
55
56
  |--------|-------|
@@ -166,7 +166,7 @@ If `services` section is present:
166
166
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
167
167
 
168
168
  **2. Route to service** — if active domain matches a key in `services`:
169
- - Override `paths.specs_dir` → `services.{domain}.specs_dir`
169
+ - 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.
170
170
  - 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.
171
171
  - Store `active_service` = `services.{domain}.path`
172
172
  - Store `active_service_module` = `services.{domain}.module`
@@ -177,6 +177,7 @@ If `services` section is present:
177
177
  - Set `active_service = unresolved`
178
178
 
179
179
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
180
+ - 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`.)*
180
181
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
181
182
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
182
183
  - 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.)*
@@ -186,8 +187,9 @@ If `services` section is present:
186
187
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
187
188
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
188
189
  - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
190
+ - 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`.)*
189
191
 
190
- > **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.
192
+ > **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.
191
193
 
192
194
  ---
193
195
 
@@ -207,12 +209,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
207
209
  |----------|--------|
208
210
  | `conventions.test_command` | service's `conventions.test_command` |
209
211
  | `conventions.build_command` | service's `conventions.build_command` |
210
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
211
- | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
212
+ | `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`). |
213
+ | `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. |
212
214
 
213
215
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
214
216
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
215
- - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
217
+ - **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/`).
216
218
 
217
219
  **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).
218
220
 
@@ -612,6 +614,36 @@ Output Artifacts:
612
614
 
613
615
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
614
616
 
617
+ ## Pipeline Position
618
+
619
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
620
+ so the user always sees where this command sits in the end-to-end flow:
621
+
622
+ ```
623
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
624
+ ```
625
+
626
+ Find the current command in this phase legend and mark **its** phase in the map above:
627
+
628
+ | Phase | Commands |
629
+ |-------|----------|
630
+ | Discovery | `/define-product` |
631
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
632
+ | Design Spec | `/generate-design-spec` |
633
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
634
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
635
+ | Code | `/generate-code` · `/review-code` |
636
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
637
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
638
+ | Trace Audit | `/validate-traces` |
639
+
640
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
641
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
642
+
643
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
644
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
645
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
646
+
615
647
  ## Next Command Suggestion
616
648
 
617
649
  Suggest the logical next command based on workflow phase:
@@ -653,10 +685,13 @@ Suggest the logical next command based on workflow phase:
653
685
  Format the footer as:
654
686
  ```
655
687
  ---
656
- Status : {badge}
688
+ Status : {badge}
657
689
  {Output Artifacts block}
658
- Next : {suggested command with example arguments}
690
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
691
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
692
+ Next : {suggested command with example arguments}
659
693
  ```
694
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
660
695
 
661
696
 
662
697
  ```
@@ -177,7 +177,7 @@ If `services` section is present:
177
177
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
178
178
 
179
179
  **2. Route to service** — if active domain matches a key in `services`:
180
- - Override `paths.specs_dir` → `services.{domain}.specs_dir`
180
+ - 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.
181
181
  - 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.
182
182
  - Store `active_service` = `services.{domain}.path`
183
183
  - Store `active_service_module` = `services.{domain}.module`
@@ -188,6 +188,7 @@ If `services` section is present:
188
188
  - Set `active_service = unresolved`
189
189
 
190
190
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
191
+ - 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`.)*
191
192
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
192
193
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
193
194
  - 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.)*
@@ -197,8 +198,9 @@ If `services` section is present:
197
198
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
198
199
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
199
200
  - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
201
+ - 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`.)*
200
202
 
201
- > **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.
203
+ > **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.
202
204
 
203
205
  ---
204
206
 
@@ -218,12 +220,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
218
220
  |----------|--------|
219
221
  | `conventions.test_command` | service's `conventions.test_command` |
220
222
  | `conventions.build_command` | service's `conventions.build_command` |
221
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
222
- | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
223
+ | `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`). |
224
+ | `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. |
223
225
 
224
226
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
225
227
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
226
- - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
228
+ - **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/`).
227
229
 
228
230
  **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).
229
231
 
@@ -512,6 +514,36 @@ Output Artifacts:
512
514
 
513
515
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
514
516
 
517
+ ## Pipeline Position
518
+
519
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
520
+ so the user always sees where this command sits in the end-to-end flow:
521
+
522
+ ```
523
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
524
+ ```
525
+
526
+ Find the current command in this phase legend and mark **its** phase in the map above:
527
+
528
+ | Phase | Commands |
529
+ |-------|----------|
530
+ | Discovery | `/define-product` |
531
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
532
+ | Design Spec | `/generate-design-spec` |
533
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
534
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
535
+ | Code | `/generate-code` · `/review-code` |
536
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
537
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
538
+ | Trace Audit | `/validate-traces` |
539
+
540
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
541
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
542
+
543
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
544
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
545
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
546
+
515
547
  ## Next Command Suggestion
516
548
 
517
549
  Suggest the logical next command based on workflow phase:
@@ -553,10 +585,13 @@ Suggest the logical next command based on workflow phase:
553
585
  Format the footer as:
554
586
  ```
555
587
  ---
556
- Status : {badge}
588
+ Status : {badge}
557
589
  {Output Artifacts block}
558
- Next : {suggested command with example arguments}
590
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
591
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
592
+ Next : {suggested command with example arguments}
559
593
  ```
594
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
560
595
 
561
596
 
562
597
  ```
@@ -168,7 +168,7 @@ If `services` section is present:
168
168
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
169
169
 
170
170
  **2. Route to service** — if active domain matches a key in `services`:
171
- - 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.
172
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.
173
173
  - Store `active_service` = `services.{domain}.path`
174
174
  - Store `active_service_module` = `services.{domain}.module`
@@ -179,6 +179,7 @@ If `services` section is present:
179
179
  - Set `active_service = unresolved`
180
180
 
181
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`.)*
182
183
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
183
184
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
184
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.)*
@@ -188,8 +189,9 @@ If `services` section is present:
188
189
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
189
190
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
190
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`.)*
191
193
 
192
- > **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.
193
195
 
194
196
  ---
195
197
 
@@ -209,12 +211,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
209
211
  |----------|--------|
210
212
  | `conventions.test_command` | service's `conventions.test_command` |
211
213
  | `conventions.build_command` | service's `conventions.build_command` |
212
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
213
- | `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. |
214
216
 
215
217
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
216
218
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
217
- - 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/`).
218
220
 
219
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).
220
222
 
@@ -461,6 +463,36 @@ Output Artifacts:
461
463
 
462
464
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
463
465
 
466
+ ## Pipeline Position
467
+
468
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
469
+ so the user always sees where this command sits in the end-to-end flow:
470
+
471
+ ```
472
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
473
+ ```
474
+
475
+ Find the current command in this phase legend and mark **its** phase in the map above:
476
+
477
+ | Phase | Commands |
478
+ |-------|----------|
479
+ | Discovery | `/define-product` |
480
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
481
+ | Design Spec | `/generate-design-spec` |
482
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
483
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
484
+ | Code | `/generate-code` · `/review-code` |
485
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
486
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
487
+ | Trace Audit | `/validate-traces` |
488
+
489
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
490
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
491
+
492
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
493
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
494
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
495
+
464
496
  ## Next Command Suggestion
465
497
 
466
498
  Suggest the logical next command based on workflow phase:
@@ -502,10 +534,13 @@ Suggest the logical next command based on workflow phase:
502
534
  Format the footer as:
503
535
  ```
504
536
  ---
505
- Status : {badge}
537
+ Status : {badge}
506
538
  {Output Artifacts block}
507
- Next : {suggested command with example arguments}
539
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
540
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
541
+ Next : {suggested command with example arguments}
508
542
  ```
543
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
509
544
 
510
545
 
511
546
  ```