@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
@@ -92,7 +92,7 @@ Wait for explicit "Y" or "N" from the user before continuing.
92
92
  - "N" → stop and ask what the user wants to change.
93
93
 
94
94
 
95
- *Note: For this command, the target in Step 1 is a UC-ID. Read the reviewed `.Test.md` from `{paths.refinement_dir}/qc/{UC-ID}/test-cases/`. This command uses the **qc-playwright** stack module (`.agent/modules/qc-playwright/stack-profile.yaml`) — Python + pytest-playwright + Page Object — independent of the dev implementation module.*
95
+ *Note: For this command, the target in Step 1 is a UC-ID. Read the reviewed `.Test.md` from `{paths.qc_dir}/{UC-ID}/test-cases/`. This command uses the **qc-playwright** stack module (`.agent/modules/qc-playwright/stack-profile.yaml`) — Python + pytest-playwright + Page Object — independent of the dev implementation module.*
96
96
 
97
97
  ## Context
98
98
  # Context Loader — Load All Project Context
@@ -133,6 +133,8 @@ Read `.agent/project-context.yaml`. Extract and store:
133
133
  - `paths.specs_dir` → BDD specs root
134
134
  - `paths.prd_dir` → PRD documents root
135
135
  - `paths.refinement_dir` → findings/review output dir
136
+ - `paths.qc_dir` → QC automation artifacts root (visible top-level, one subfolder per UC: `{qc_dir}/{UC-ID}/`)
137
+ - `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)
136
138
  - `paths.product_definitions_dir` → product definitions root
137
139
  - `paths.domain_knowledge_dir` → domain knowledge root
138
140
  - `paths.business_dictionary` → path to business-dictionary.md
@@ -145,6 +147,8 @@ If `paths` section is absent, use these defaults:
145
147
  - `specs_dir` = `specs/bdd`
146
148
  - `prd_dir` = `specs/prd`
147
149
  - `refinement_dir` = `.agent/review`
150
+ - `qc_dir` = `docs`
151
+ - `qc_skills_dir` = `.agent/skills/qc`
148
152
  - `product_definitions_dir` = `specs/product-definition`
149
153
  - `domain_knowledge_dir` = `specs/domain-knowledge`
150
154
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
@@ -170,7 +174,7 @@ If `services` section is present:
170
174
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
171
175
 
172
176
  **2. Route to service** — if active domain matches a key in `services`:
173
- - 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.
174
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.
175
179
  - Store `active_service` = `services.{domain}.path`
176
180
  - Store `active_service_module` = `services.{domain}.module`
@@ -181,6 +185,7 @@ If `services` section is present:
181
185
  - Set `active_service = unresolved`
182
186
 
183
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`.)*
184
189
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
185
190
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
186
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.)*
@@ -189,8 +194,10 @@ If `services` section is present:
189
194
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
190
195
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
191
196
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
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`.)*
192
199
 
193
- > **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.
194
201
 
195
202
  ---
196
203
 
@@ -210,12 +217,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
210
217
  |----------|--------|
211
218
  | `conventions.test_command` | service's `conventions.test_command` |
212
219
  | `conventions.build_command` | service's `conventions.build_command` |
213
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
214
- | `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. |
215
222
 
216
223
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
217
224
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
218
- - 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/`).
219
226
 
220
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).
221
228
 
@@ -402,12 +409,13 @@ pytest-playwright scripts + Page Objects, run them, and report the result per sc
402
409
  Stack rules (MANDATORY — from `modules/qc-playwright/stack-profile.yaml`):
403
410
  - Markdown-first: never generate Python without a reviewed `.Test.md`.
404
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.
405
413
  - pytest-playwright fixtures; each test independent; group by (role, account) so auth never interleaves.
406
414
  - No hard-coded URL/cred/timeout (use `Env.*` / `CONFIG[...]`); no `time.sleep()`; no Allure.
407
415
  - Cover **100%** of TCs in the file — every TC ends Pass/Fail/Skip (none left Draft).
408
416
  - Classify each FAIL: script-bug (fix selector/logic) vs product-gap (keep FAIL + evidence, never fake-pass).
409
417
 
410
- ## Skills — pick the layer, load ONE file (`skills/qc/qa-runner/`)
418
+ ## Skills — pick the layer, load ONE file (`{paths.qc_skills_dir}/qa-runner/`)
411
419
 
412
420
  `functional/{gui-screen,gui-feature,api}.md`, `integration.md`, `e2e.md`,
413
421
  `non-functional.md`, `exploratory/session.md`.
@@ -425,12 +433,18 @@ def test_TC_<FEATURE>_001_...(...): ...
425
433
  ## Write Trace State — qc_status (OFFICIAL QC result)
426
434
 
427
435
  After the run, update `{paths.trace_dir}/{UC-ID}.tsv` — for each scenario row (matched by
428
- `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/`.)*
429
437
 
430
438
  | Column | Value |
431
439
  |--------|-------|
432
440
  | `qc_status` | `pass` if all QC tests for this SC passed · `fail` if any failed · `skip` if all skipped/xfail · `not_run` if no QC test covers it |
433
441
  | `qc_run_at` | today `YYYY-MM-DD` |
442
+ | `qc_owner` | **who the SC is waiting on** (the PM/PO "pending" view): `dev` if FAIL = product-gap (real defect → dev fixes) · `po` if `skip`/`not_run` because an **open `DOC_GAPS` 🔴 Blocker** prevents testing (PO must clarify PRD/BDD) · `—` if `pass`, or FAIL = script-bug (QC's own to fix — transient) |
443
+ | `qc_blocked_by` | linked artifact: `GAP-{id}` when blocked by a spec gap (set here) · `BUG-{id}` once `/report-bug` is filed for the product-gap (backfilled by `/report-bug`) · `—` otherwise |
444
+
445
+ Set `qc_owner`/`qc_blocked_by` together with `qc_status`. On `pass`, **clear** both to `—`.
446
+ For a product-gap FAIL, set `qc_owner=dev` now; the `BUG-{id}` is backfilled into `qc_blocked_by`
447
+ when QC runs the `/report-bug` that `/qc-report` prompts.
434
448
 
435
449
  Leave all other columns unchanged — **never** touch `dev_selftest`/`dev_selftest_at`
436
450
  (owned by `/dev-run-test`). `qc_status` (official QC) and `dev_selftest` (dev smoke) are
@@ -440,21 +454,29 @@ separate signals; both are orthogonal to `status` (OK/GAP/DRIFT/UNTRACKED = cove
440
454
  # Refresh Living Docs panel mirror *(local, umbrella mode)*
441
455
 
442
456
  *Skip entirely in single-service mode (no `services` and no `setup.spec_source`) — there
443
- 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.*
444
458
 
445
- After updating the authoritative service TSV(s) at `{paths.trace_dir}`:
459
+ After updating the authoritative TSV(s) at `{paths.trace_dir}`:
446
460
 
447
- 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**.
448
466
  2. If `panel_mirror` resolves to a different path than `{paths.trace_dir}`, copy each
449
- just-updated `{UC-ID}.tsv` → `{panel_mirror}/{service-name}/{UC-ID}.tsv`
450
- (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`).
451
474
 
452
475
  This keeps the open workspace's Living Docs panel current **between syncs** — it is a
453
- **local convenience mirror only**. The *canonical* report in the spec module
454
- (`{spec_source}/.living-docs/`) and the merged `trace-report.json` are rebuilt by
455
- `/sync` or `/validate-traces` (those need every service's data, so a single per-UC
456
- command cannot produce them). For orchestrated commands, do this once in the orchestrator
457
- 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.
458
480
 
459
481
 
460
482
  ## Report
@@ -481,6 +503,36 @@ Output Artifacts:
481
503
 
482
504
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
483
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
+
484
536
  ## Next Command Suggestion
485
537
 
486
538
  Suggest the logical next command based on workflow phase:
@@ -522,10 +574,13 @@ Suggest the logical next command based on workflow phase:
522
574
  Format the footer as:
523
575
  ```
524
576
  ---
525
- Status : {badge}
577
+ Status : {badge}
526
578
  {Output Artifacts block}
527
- 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}
528
582
  ```
583
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
529
584
 
530
585
 
531
586
  ```
@@ -11,7 +11,7 @@ ported_from: ai-automation-qc-base
11
11
  ## Gate
12
12
  {{include:steps/gate.md}}
13
13
 
14
- *Note: For this command, the target in Step 1 is a UC-ID. Read the reviewed `.Test.md` from `{paths.refinement_dir}/qc/{UC-ID}/test-cases/`. This command uses the **qc-playwright** stack module (`.agent/modules/qc-playwright/stack-profile.yaml`) — Python + pytest-playwright + Page Object — independent of the dev implementation module.*
14
+ *Note: For this command, the target in Step 1 is a UC-ID. Read the reviewed `.Test.md` from `{paths.qc_dir}/{UC-ID}/test-cases/`. This command uses the **qc-playwright** stack module (`.agent/modules/qc-playwright/stack-profile.yaml`) — Python + pytest-playwright + Page Object — independent of the dev implementation module.*
15
15
 
16
16
  ## Context
17
17
  {{include:steps/context-loader.md}}
@@ -26,12 +26,13 @@ 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).
32
33
  - Classify each FAIL: script-bug (fix selector/logic) vs product-gap (keep FAIL + evidence, never fake-pass).
33
34
 
34
- ## Skills — pick the layer, load ONE file (`skills/qc/qa-runner/`)
35
+ ## Skills — pick the layer, load ONE file (`{paths.qc_skills_dir}/qa-runner/`)
35
36
 
36
37
  `functional/{gui-screen,gui-feature,api}.md`, `integration.md`, `e2e.md`,
37
38
  `non-functional.md`, `exploratory/session.md`.
@@ -49,12 +50,18 @@ 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
  |--------|-------|
56
57
  | `qc_status` | `pass` if all QC tests for this SC passed · `fail` if any failed · `skip` if all skipped/xfail · `not_run` if no QC test covers it |
57
58
  | `qc_run_at` | today `YYYY-MM-DD` |
59
+ | `qc_owner` | **who the SC is waiting on** (the PM/PO "pending" view): `dev` if FAIL = product-gap (real defect → dev fixes) · `po` if `skip`/`not_run` because an **open `DOC_GAPS` 🔴 Blocker** prevents testing (PO must clarify PRD/BDD) · `—` if `pass`, or FAIL = script-bug (QC's own to fix — transient) |
60
+ | `qc_blocked_by` | linked artifact: `GAP-{id}` when blocked by a spec gap (set here) · `BUG-{id}` once `/report-bug` is filed for the product-gap (backfilled by `/report-bug`) · `—` otherwise |
61
+
62
+ Set `qc_owner`/`qc_blocked_by` together with `qc_status`. On `pass`, **clear** both to `—`.
63
+ For a product-gap FAIL, set `qc_owner=dev` now; the `BUG-{id}` is backfilled into `qc_blocked_by`
64
+ when QC runs the `/report-bug` that `/qc-report` prompts.
58
65
 
59
66
  Leave all other columns unchanged — **never** touch `dev_selftest`/`dev_selftest_at`
60
67
  (owned by `/dev-run-test`). `qc_status` (official QC) and `dev_selftest` (dev smoke) are
@@ -125,6 +125,8 @@ Read `.agent/project-context.yaml`. Extract and store:
125
125
  - `paths.specs_dir` → BDD specs root
126
126
  - `paths.prd_dir` → PRD documents root
127
127
  - `paths.refinement_dir` → findings/review output dir
128
+ - `paths.qc_dir` → QC automation artifacts root (visible top-level, one subfolder per UC: `{qc_dir}/{UC-ID}/`)
129
+ - `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)
128
130
  - `paths.product_definitions_dir` → product definitions root
129
131
  - `paths.domain_knowledge_dir` → domain knowledge root
130
132
  - `paths.business_dictionary` → path to business-dictionary.md
@@ -137,6 +139,8 @@ If `paths` section is absent, use these defaults:
137
139
  - `specs_dir` = `specs/bdd`
138
140
  - `prd_dir` = `specs/prd`
139
141
  - `refinement_dir` = `.agent/review`
142
+ - `qc_dir` = `docs`
143
+ - `qc_skills_dir` = `.agent/skills/qc`
140
144
  - `product_definitions_dir` = `specs/product-definition`
141
145
  - `domain_knowledge_dir` = `specs/domain-knowledge`
142
146
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
@@ -162,7 +166,7 @@ If `services` section is present:
162
166
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
163
167
 
164
168
  **2. Route to service** — if active domain matches a key in `services`:
165
- - 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.
166
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.
167
171
  - Store `active_service` = `services.{domain}.path`
168
172
  - Store `active_service_module` = `services.{domain}.module`
@@ -173,6 +177,7 @@ If `services` section is present:
173
177
  - Set `active_service = unresolved`
174
178
 
175
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`.)*
176
181
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
177
182
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
178
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.)*
@@ -181,8 +186,10 @@ If `services` section is present:
181
186
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
182
187
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
183
188
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
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`.)*
184
191
 
185
- > **Why under `spec_source`:** PRD, design-spec, domain knowledge, the **API contract (tech-docs)**, and tester feedback are all **cross-team artifacts** — they must live in the **shared spec repo** so every umbrella (FE/App/BE) reads the same source via `/sync`. Tech-docs specifically: BE authors the tech-design (API contract), commits + pushes it into the spec submodule (2-layer commit), and FE/App pull it on their next `/sync` to wire the real API in `/generate-code --phase=integration`. In single-service mode (no `spec_source`), these default under the repo root — still shared, same repo.
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.
186
193
 
187
194
  ---
188
195
 
@@ -202,12 +209,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
202
209
  |----------|--------|
203
210
  | `conventions.test_command` | service's `conventions.test_command` |
204
211
  | `conventions.build_command` | service's `conventions.build_command` |
205
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
206
- | `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. |
207
214
 
208
215
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
209
216
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
210
- - 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/`).
211
218
 
212
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).
213
220
 
@@ -607,6 +614,36 @@ Output Artifacts:
607
614
 
608
615
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
609
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
+
610
647
  ## Next Command Suggestion
611
648
 
612
649
  Suggest the logical next command based on workflow phase:
@@ -648,10 +685,13 @@ Suggest the logical next command based on workflow phase:
648
685
  Format the footer as:
649
686
  ```
650
687
  ---
651
- Status : {badge}
688
+ Status : {badge}
652
689
  {Output Artifacts block}
653
- 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}
654
693
  ```
694
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
655
695
 
656
696
 
657
697
  ```
@@ -1,6 +1,8 @@
1
- # /report-bug — File a Spec-Traced Bug (Tester-Facing)
1
+ # /report-bug — File a Spec-Traced Bug (Tester & QC-Facing)
2
2
 
3
- For **testers**. Produces a structured bug report with full spec context, classifies the likely
3
+ For **testers and QC** including **product-gaps** surfaced by the `/qc-*` pipeline
4
+ (`/qc-run-test` FAIL classified product-gap, or a `DOC_GAPS` spec-defect blocker from
5
+ `/qc-analyze`). Produces a structured bug report with full spec context, classifies the likely
4
6
  layer, and saves it for handoff to the dev team.
5
7
 
6
8
  **READ-ONLY on specs and code.** This command never edits PRD, BDD, tech-docs, or source.
@@ -134,6 +136,8 @@ Read `.agent/project-context.yaml`. Extract and store:
134
136
  - `paths.specs_dir` → BDD specs root
135
137
  - `paths.prd_dir` → PRD documents root
136
138
  - `paths.refinement_dir` → findings/review output dir
139
+ - `paths.qc_dir` → QC automation artifacts root (visible top-level, one subfolder per UC: `{qc_dir}/{UC-ID}/`)
140
+ - `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)
137
141
  - `paths.product_definitions_dir` → product definitions root
138
142
  - `paths.domain_knowledge_dir` → domain knowledge root
139
143
  - `paths.business_dictionary` → path to business-dictionary.md
@@ -146,6 +150,8 @@ If `paths` section is absent, use these defaults:
146
150
  - `specs_dir` = `specs/bdd`
147
151
  - `prd_dir` = `specs/prd`
148
152
  - `refinement_dir` = `.agent/review`
153
+ - `qc_dir` = `docs`
154
+ - `qc_skills_dir` = `.agent/skills/qc`
149
155
  - `product_definitions_dir` = `specs/product-definition`
150
156
  - `domain_knowledge_dir` = `specs/domain-knowledge`
151
157
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
@@ -171,7 +177,7 @@ If `services` section is present:
171
177
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
172
178
 
173
179
  **2. Route to service** — if active domain matches a key in `services`:
174
- - 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.
175
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.
176
182
  - Store `active_service` = `services.{domain}.path`
177
183
  - Store `active_service_module` = `services.{domain}.module`
@@ -182,6 +188,7 @@ If `services` section is present:
182
188
  - Set `active_service = unresolved`
183
189
 
184
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`.)*
185
192
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
186
193
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
187
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.)*
@@ -190,8 +197,10 @@ If `services` section is present:
190
197
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
191
198
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
192
199
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
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`.)*
193
202
 
194
- > **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.
195
204
 
196
205
  ---
197
206
 
@@ -211,12 +220,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
211
220
  |----------|--------|
212
221
  | `conventions.test_command` | service's `conventions.test_command` |
213
222
  | `conventions.build_command` | service's `conventions.build_command` |
214
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
215
- | `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. |
216
225
 
217
226
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
218
227
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
219
- - 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/`).
220
229
 
221
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).
222
231
 
@@ -446,6 +455,17 @@ State the classification as a suggestion (dev confirms during `/fix-bug`).
446
455
  Assign `BUG-{today YYYYMMDD}-{NN}` (NN = next sequence among existing reports).
447
456
  Write to `{paths.bug_reports_dir}/{BUG-ID}.md` (resolved to `{spec_source}/feedback/bug-reports/` in umbrella mode; create dir if needed) using the structure in the Output block, and also print it for pasting into Jira/Slack.
448
457
 
458
+ ## Step 5.5 — Backfill the trace (pending-view link)
459
+
460
+ If Step 1 matched a specific failing scenario `{UC-ID}-SC{N}` **and** a trace row exists in
461
+ `{paths.trace_dir}/{UC-ID}.tsv`, update **only** that row so the PO/PM "waiting-on" view points
462
+ to this bug — leave every other column (incl. `qc_status`) unchanged:
463
+ - `qc_blocked_by` = `{BUG-ID}`
464
+ - `qc_owner` = `dev` if likely layer ∈ {Code, BDD, Design Spec, Env} · `po` if likely layer = PRD ambiguity
465
+
466
+ Skip silently if no SC matched or no trace file/row exists (a bug can still be filed). This is
467
+ the only write this command makes to operational state — it still **never** edits PRD/BDD/code.
468
+
449
469
  ## Step 6 — Handoff (so PO/Dev actually see it)
450
470
 
451
471
  The report only reaches PO/Dev if it is **committed and pushed to the shared spec repo**. A local file is a dead drop.
@@ -494,6 +514,36 @@ Output Artifacts:
494
514
 
495
515
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
496
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
+
497
547
  ## Next Command Suggestion
498
548
 
499
549
  Suggest the logical next command based on workflow phase:
@@ -535,16 +585,20 @@ Suggest the logical next command based on workflow phase:
535
585
  Format the footer as:
536
586
  ```
537
587
  ---
538
- Status : {badge}
588
+ Status : {badge}
539
589
  {Output Artifacts block}
540
- 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}
541
593
  ```
594
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
542
595
 
543
596
 
544
597
  ```
545
598
  🐞 {BUG-ID} → {paths.bug_reports_dir}/{BUG-ID}.md (in shared spec repo)
546
599
 
547
600
  Feature : {UC-ID} — {feature name} | Service: {service} | Severity: {Critical|Major|Minor}
601
+ State : 🟢 Open (lifecycle: Open → Fixed → Closed — set `Fixed` by /fix-bug, `Closed` after /qc-run-test re-verify pass)
548
602
 
549
603
  Spec context
550
604
  PRD : {prd_path} (v{prd_version})
@@ -1,6 +1,8 @@
1
- # /report-bug — File a Spec-Traced Bug (Tester-Facing)
1
+ # /report-bug — File a Spec-Traced Bug (Tester & QC-Facing)
2
2
 
3
- For **testers**. Produces a structured bug report with full spec context, classifies the likely
3
+ For **testers and QC** including **product-gaps** surfaced by the `/qc-*` pipeline
4
+ (`/qc-run-test` FAIL classified product-gap, or a `DOC_GAPS` spec-defect blocker from
5
+ `/qc-analyze`). Produces a structured bug report with full spec context, classifies the likely
4
6
  layer, and saves it for handoff to the dev team.
5
7
 
6
8
  **READ-ONLY on specs and code.** This command never edits PRD, BDD, tech-docs, or source.
@@ -70,6 +72,17 @@ State the classification as a suggestion (dev confirms during `/fix-bug`).
70
72
  Assign `BUG-{today YYYYMMDD}-{NN}` (NN = next sequence among existing reports).
71
73
  Write to `{paths.bug_reports_dir}/{BUG-ID}.md` (resolved to `{spec_source}/feedback/bug-reports/` in umbrella mode; create dir if needed) using the structure in the Output block, and also print it for pasting into Jira/Slack.
72
74
 
75
+ ## Step 5.5 — Backfill the trace (pending-view link)
76
+
77
+ If Step 1 matched a specific failing scenario `{UC-ID}-SC{N}` **and** a trace row exists in
78
+ `{paths.trace_dir}/{UC-ID}.tsv`, update **only** that row so the PO/PM "waiting-on" view points
79
+ to this bug — leave every other column (incl. `qc_status`) unchanged:
80
+ - `qc_blocked_by` = `{BUG-ID}`
81
+ - `qc_owner` = `dev` if likely layer ∈ {Code, BDD, Design Spec, Env} · `po` if likely layer = PRD ambiguity
82
+
83
+ Skip silently if no SC matched or no trace file/row exists (a bug can still be filed). This is
84
+ the only write this command makes to operational state — it still **never** edits PRD/BDD/code.
85
+
73
86
  ## Step 6 — Handoff (so PO/Dev actually see it)
74
87
 
75
88
  The report only reaches PO/Dev if it is **committed and pushed to the shared spec repo**. A local file is a dead drop.
@@ -102,6 +115,7 @@ git push # → PO/Dev see it on their next /sync
102
115
  🐞 {BUG-ID} → {paths.bug_reports_dir}/{BUG-ID}.md (in shared spec repo)
103
116
 
104
117
  Feature : {UC-ID} — {feature name} | Service: {service} | Severity: {Critical|Major|Minor}
118
+ State : 🟢 Open (lifecycle: Open → Fixed → Closed — set `Fixed` by /fix-bug, `Closed` after /qc-run-test re-verify pass)
105
119
 
106
120
  Spec context
107
121
  PRD : {prd_path} (v{prd_version})