@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
@@ -2,7 +2,9 @@
2
2
 
3
3
  # Command Reference
4
4
 
5
- > Mọi slash command của framework, gom theo phase. Mỗi command kèm **Input**, **Output**, và **When to use**. Phần cuối mô tả **Command Internals** — kiến trúc step file dùng chung bởi mọi command.
5
+ > Mọi slash command của framework, gom theo phase. Mỗi command kèm **Cách dùng (ví dụ cụ thể)**, **Output**, và **When to use**. Phần cuối mô tả **Command Internals** — kiến trúc step file dùng chung bởi mọi command.
6
+ >
7
+ > Ví dụ dùng chung một feature xuyên suốt: domain `auth`, ticket `FEAT-01`, use case `FEAT-01-UC1` (đăng nhập). Thay bằng file/UC-ID của bạn.
6
8
 
7
9
  ---
8
10
 
@@ -18,7 +20,7 @@
18
20
  - [Phase 6 — Dev Self-Check](#phase-6--dev-self-check)
19
21
  - [Phase 6b — QC Automation (official QC suite)](#phase-6b--qc-automation-official-qc-suite)
20
22
  - [Phase 7 — Traceability Audit](#phase-7--traceability-audit)
21
- - [Phase 8 — Tester Feedback](#phase-8--tester-feedback)
23
+ - [Phase 8 — Tester / QC Feedback](#phase-8--tester--qc-feedback)
22
24
  - [Debugging & Cross-cutting](#debugging--cross-cutting)
23
25
  - [Command Internals — Step Architecture](#command-internals--step-architecture)
24
26
 
@@ -28,13 +30,13 @@
28
30
 
29
31
  ## Setup & Maintenance
30
32
 
31
- | Command | Input | Output | When to use |
32
- |---------|-------|--------|-------------|
33
- | `/setup-ai-first` | | Project structure + config files | First-time project setup |
34
- | `/sync` | | Git pull + submodule update + Living Docs sync | **Daily driver** — đồng bộ *nội dung* project (code/specs trong submodule) |
35
- | `/update-framework` | | Refreshed `.agent/` command files from npm | **Occasionally** — nâng cấp *bản thân framework* khi có version mới |
36
- | `/sync-figma-components {module}` | Module name | Updated `figma-components/{module}.md` | After Figma design system changes |
37
- | `/sync-figma-tokens {url?}` | Optional Figma URL | Updated `figma-tokens.md` | After design token changes |
33
+ | Command | Cách dùng (ví dụ) | Output | When to use |
34
+ |---------|-------------------|--------|-------------|
35
+ | `/setup-ai-first` | `/setup-ai-first` | Project structure + config files | First-time project setup |
36
+ | `/sync` | `/sync` | Git pull + submodule update + Living Docs sync | **Daily driver** — đồng bộ *nội dung* project (code/specs trong submodule) |
37
+ | `/update-framework` | `/update-framework` | Refreshed `.agent/` command files from npm | **Occasionally** — nâng cấp *bản thân framework* khi có version mới |
38
+ | `/sync-figma-components {module}` | `/sync-figma-components react` | Updated `figma-components/{module}.md` | After Figma design system changes |
39
+ | `/sync-figma-tokens {url?}` | `/sync-figma-tokens` *(hoặc kèm URL Figma)* | Updated `figma-tokens.md` | After design token changes |
38
40
 
39
41
  > **`/sync` vs `/update-framework` là hai thứ khác nhau:**
40
42
  > - `/sync` cập nhật **nội dung project** — pull code/specs mới từ git remote + refresh Living Docs. Nguồn = git remotes của bạn. Chạy thường xuyên.
@@ -44,30 +46,30 @@
44
46
 
45
47
  ## Phase 1 — Discovery
46
48
 
47
- | Command | Input | Output | When to use |
48
- |---------|-------|--------|-------------|
49
- | `/define-product` | | `specs/product-definition/{TICKET-ID}-{slug}.md` | Starting any new feature. AI dẫn PO qua 7 phase Q&A có cấu trúc — không cần spec viết sẵn. |
49
+ | Command | Cách dùng (ví dụ) | Output | When to use |
50
+ |---------|-------------------|--------|-------------|
51
+ | `/define-product` | `/define-product` | `specs/product-definition/{TICKET-ID}-{slug}.md` | Starting any new feature. AI dẫn PO qua 7 phase Q&A có cấu trúc — không cần spec viết sẵn. |
50
52
 
51
53
  ---
52
54
 
53
55
  ## Phase 2 — PRD
54
56
 
55
- | Command | Input | Output | When to use |
56
- |---------|-------|--------|-------------|
57
- | `/generate-prd` | product-definition file | `specs/prd/{domain}/{TICKET-ID}-{slug}.md` | After define-product. Thêm `API Source: existing` + section "Existing API Contract" cho feature brownfield. |
58
- | `/refine-prd` | prd file | `.agent/review/{prd-slug}-findings.yaml` | After generate-prd — fan-out 4 review lens + completeness-critic loop, mở Review Board. |
59
- | `/refine-prd --resume` | prd file | Applied findings + bumped version | Sau khi review trong Review Board. |
60
- | `/review-context` (PRD) | prd file | `.agent/review/{prd-slug}-review-context-findings.yaml` | Quality gate bắt buộc trước Phase 3. Checks: banned terms (P1), ambiguity (P2), conflicts (P3), completeness (P4). |
61
- | `/review-context --fix` | prd file | Applies all auto-fixable findings immediately | Dev quick-fix, không cần Review Board. |
62
- | `/review-context --resume` | prd file | Applies accepted findings + bump version | PO/SA review — human quyết từng finding. |
57
+ | Command | Cách dùng (ví dụ) | Output | When to use |
58
+ |---------|-------------------|--------|-------------|
59
+ | `/generate-prd` | `/generate-prd specs/product-definition/FEAT-01-login.md` | `specs/prd/{domain}/{TICKET-ID}-{slug}.md` | After define-product. Thêm `API Source: existing` + section "Existing API Contract" cho feature brownfield. |
60
+ | `/refine-prd` | `/refine-prd specs/prd/auth/FEAT-01-login.md` | `.agent/review/{prd-slug}-findings.yaml` | After generate-prd — fan-out 4 review lens + completeness-critic loop, mở Review Board. |
61
+ | `/refine-prd --resume` | `/refine-prd --resume specs/prd/auth/FEAT-01-login.md` | Applied findings + bumped version | Sau khi review trong Review Board (nút ⚡ Apply tự chạy lệnh này). |
62
+ | `/review-context` (PRD) | `/review-context specs/prd/auth/FEAT-01-login.md` | `.agent/review/{prd-slug}-review-context-findings.yaml` | Quality gate bắt buộc trước Phase 3. Checks: banned terms (P1), ambiguity (P2), conflicts (P3), completeness (P4). |
63
+ | `/review-context --fix` | `/review-context --fix specs/prd/auth/FEAT-01-login.md` | Applies all auto-fixable findings immediately | Dev quick-fix, không cần Review Board. |
64
+ | `/review-context --resume` | `/review-context --resume specs/prd/auth/FEAT-01-login.md` | Applies accepted findings + bump version | PO/SA review — human quyết từng finding. |
63
65
 
64
66
  ---
65
67
 
66
68
  ## Phase 2b — Design Spec (FE/App)
67
69
 
68
- | Command | Input | Output | When to use |
69
- |---------|-------|--------|-------------|
70
- | `/generate-design-spec` | prd file | `specs/design-spec/{domain}/{TICKET-ID}-design-spec-{platform}.md` | FE/App: sau khi PRD approved, trước BDD. PO phải cấp **node-level Figma frame link** (URL có `?node-id=`) cho mỗi screen; AI fetch từng frame qua Figma MCP. Screen thiếu link → ❌ Missing, spec ở draft và chặn sign-off + `/generate-bdd`. |
70
+ | Command | Cách dùng (ví dụ) | Output | When to use |
71
+ |---------|-------------------|--------|-------------|
72
+ | `/generate-design-spec` | `/generate-design-spec specs/prd/auth/FEAT-01-login.md` | `specs/design-spec/{domain}/{TICKET-ID}-design-spec-{platform}.md` | FE/App: sau khi PRD approved, trước BDD. PO phải cấp **node-level Figma frame link** (URL có `?node-id=`) cho mỗi screen; AI fetch từng frame qua Figma MCP. Screen thiếu link → ❌ Missing, spec ở draft và chặn sign-off + `/generate-bdd`. |
71
73
 
72
74
  > BE teams bỏ qua Phase 2b — đọc PRD trực tiếp rồi `/generate-bdd`.
73
75
 
@@ -75,33 +77,34 @@
75
77
 
76
78
  ## Phase 3 — BDD Spec
77
79
 
78
- | Command | Input | Output | When to use |
79
- |---------|-------|--------|-------------|
80
- | `/generate-bdd` | prd file | `specs/bdd/{domain}/{UC-ID}.feature` (multi-service: `{domain}/{service}/{UC-ID}.feature`) | After PRD approved (+ Design Spec sign-off cho FE/App). Đọc Service/Module từ PRD metadata, áp platform vocabulary, hiện SC outline chờ confirm. PRD lớn (>3 UC hoặc >300 dòng) → orchestration mode (1 sub-agent / UC). |
81
- | `/review-context` (BDD) | feature file | `.agent/review/{uc-id}-review-bdd-findings.yaml` | Quality gate bắt buộc trước Phase 4. Checks: PRD coverage (mỗi AC + BR → ≥1 SC), Gherkin R1–R10, compliance C1–C5. |
82
- | `/review-context --fix` | feature file | Auto-fix terminology, metadata, coverage matrix | Dev quick-fix. |
83
- | `/review-context --resume` | feature file | Applies accepted findings + bump bdd_version | SA review. |
80
+ | Command | Cách dùng (ví dụ) | Output | When to use |
81
+ |---------|-------------------|--------|-------------|
82
+ | `/generate-bdd` | `/generate-bdd specs/prd/auth/FEAT-01-login.md` | `specs/bdd/{domain}/{UC-ID}.feature` (multi-service: `{domain}/{service}/{UC-ID}.feature`) | After PRD approved (+ Design Spec sign-off cho FE/App). Đọc Service/Module từ PRD metadata, áp platform vocabulary, hiện SC outline chờ confirm. **Thứ tự outside-in: web → app → system**; `system` **tổng hợp từ web+app BDD** (web&app lệch contract → CHECKPOINT chọn union/platform-hint/separate-endpoints, ghi `@system.resolution:`; chỉ-BE → từ PRD). PRD lớn (>3 UC hoặc >300 dòng) → orchestration mode (1 sub-agent / UC). |
83
+ | `/review-context` (BDD) | `/review-context specs/bdd/auth/system/FEAT-01-UC1-login.feature` | `.agent/review/{uc-id}-review-bdd-findings.yaml` | Quality gate bắt buộc trước Phase 4. Checks: PRD coverage (mỗi AC + BR → ≥1 SC), Gherkin R1–R10, compliance C1–C5. |
84
+ | `/review-context --fix` | `/review-context --fix specs/bdd/auth/web/FEAT-01-UC1-login.feature` | Auto-fix terminology, metadata, coverage matrix | Dev quick-fix. |
85
+ | `/review-context --resume` | `/review-context --resume specs/bdd/auth/system/FEAT-01-UC1-login.feature` | Applies accepted findings + bump bdd_version | SA review. |
84
86
 
85
87
  ---
86
88
 
87
89
  ## Phase 4 — Tech Design
88
90
 
89
- | Command | Input | Output | When to use |
90
- |---------|-------|--------|-------------|
91
- | `/generate-tech-docs` | feature file | `tech-docs/{domain}/{UC-ID}-tech-design.md` (multi-service: `{domain}/{service}/...`) | After BDD approved. Đọc `@trace.module` → chọn template theo platform type. Brownfield (`@trace.api_source: existing`) → reverse-document mode. |
92
- | `/review-tech-docs` | tech-design file | `.agent/review/{uc-id}-tech-review-findings.yaml` | After generate-tech-docs mở Review Board. |
93
- | `/review-tech-docs --resume` | tech-design file | Applies accepted findings + bump revision | Sau khi review trong Review Board. |
91
+ | Command | Cách dùng (ví dụ) | Output | When to use |
92
+ |---------|-------------------|--------|-------------|
93
+ | `/generate-tech-docs` | `/generate-tech-docs specs/bdd/auth/system/FEAT-01-UC1-login.feature` | **BE** (`system`): `tech-docs/{domain}/{UC-ID}-tech-design.md` (API contract) · **FE/App** (`web`/`app`): `{UC-ID}-tech-design-{platform}.md` (client design) | After BDD approved. **Platform-aware** (`@trace.platform`): BE = API contract; FE/App = client design (components/state/API-integration/routing + **§2b Test Selectors**: test-id ổn định cho element có action QC locate khỏi scan) — **GATED**: HALT nếu thiếu System BDD hoặc BE contract approved. Brownfield (`@trace.api_source: existing`) → reverse-document (BE). |
94
+ | `/map-testids {UC-ID}` | `/map-testids FEAT-01-UC1` | Cập nhật FE tech-design §2b Test Selectors + patch forwarding/usage-site + ghi `figma-components/{module}.md` | FE/App, cho component **reuse** / code **có sẵn** (brownfield): reverse-document id đang có, gán id còn thiếu, đảm bảo component dùng chung forward được test-id. Bổ trợ cho `/generate-tech-docs` (chỉ gán id cho code mới). |
95
+ | `/review-tech-docs` | `/review-tech-docs tech-docs/auth/FEAT-01-UC1-tech-design.md` | `.agent/review/{uc-id}-tech-review-findings.yaml` | After generate-tech-docs mở Review Board. |
96
+ | `/review-tech-docs --resume` | `/review-tech-docs --resume tech-docs/auth/FEAT-01-UC1-tech-design.md` | Applies accepted findings + bump revision | Sau khi review trong Review Board. |
94
97
 
95
98
  ---
96
99
 
97
100
  ## Phase 5 — Code
98
101
 
99
- | Command | Input | Output | When to use |
100
- |---------|-------|--------|-------------|
101
- | `/generate-code` | feature file | `src/...` (tags `@trace.implements`) | After tech-design approved. Default = full impl/BE. |
102
- | `/generate-code --phase=ui` | feature file | UI + mock API adapter | FE: BE chưa sẵn sàng — sinh UI + mock adapter từ System BDD contract; tester test FE ngay được. |
103
- | `/generate-code --phase=integration` | feature file | Wires real API | FE: sau khi T7 sign-off gate approved — thay mock adapter bằng real API calls. |
104
- | `/review-code` | | Review report: Critical / Major / Minor | After generate-code. Check: mỗi scenario có endpoint, trace tags, layer rules, error handling khớp CLAUDE.md §5. Fix CRITICAL + MAJOR trước khi merge. |
102
+ | Command | Cách dùng (ví dụ) | Output | When to use |
103
+ |---------|-------------------|--------|-------------|
104
+ | `/generate-code` | `/generate-code specs/bdd/auth/system/FEAT-01-UC1-login.feature` | `src/...` (tags `@trace.implements`) | After tech-design approved. Default = full impl/BE. |
105
+ | `/generate-code --phase=ui` | `/generate-code --phase=ui specs/bdd/auth/web/FEAT-01-UC1-login.feature` | UI + mock API adapter | FE: BE chưa sẵn sàng — sinh UI + mock adapter. Mock **shape**: BE contract nếu có (chuẩn) → else System BDD + warn; fixture values luôn từ System BDD. Tester test FE ngay được. |
106
+ | `/generate-code --phase=integration` | `/generate-code --phase=integration specs/bdd/auth/web/FEAT-01-UC1-login.feature` | Wires real API | FE: sau khi T7 sign-off gate approved — thay mock adapter bằng real API calls. |
107
+ | `/review-code` | `/review-code FEAT-01-UC1` | Review report: Critical / Major / Minor | After generate-code. Check: mỗi scenario có endpoint, trace tags, layer rules, error handling khớp CLAUDE.md §5. Fix CRITICAL + MAJOR trước khi merge. |
105
108
 
106
109
  ---
107
110
 
@@ -109,56 +112,56 @@
109
112
 
110
113
  > Đây là **developer self-check / smoke** — dev tự kiểm tra code mình vừa sinh ra. **Không phải** official QC suite (đó là Phase 6b `/qc-*`). Signal = `dev_selftest`, tách biệt với `qc_status`.
111
114
 
112
- | Command | Input | Output | When to use |
113
- |---------|-------|--------|-------------|
114
- | `/dev-gen-test` | feature file | `src/test/...` (tags `@trace.verifies`) | After generate-code. Tự chọn test framework đúng platform. |
115
- | `/dev-run-test` | | Self-check report — ghi `dev_selftest` (pass/fail/not_run) + `dev_selftest_at` vào trace TSV | After dev-gen-test. |
116
- | `/dev-smoke-test` | | Live endpoint check | Optional — sau deploy. |
115
+ | Command | Cách dùng (ví dụ) | Output | When to use |
116
+ |---------|-------------------|--------|-------------|
117
+ | `/dev-gen-test` | `/dev-gen-test specs/bdd/auth/system/FEAT-01-UC1-login.feature` | `src/test/...` (tags `@trace.verifies`) | After generate-code. Tự chọn test framework đúng platform. |
118
+ | `/dev-run-test` | `/dev-run-test FEAT-01-UC1` | Self-check report — ghi `dev_selftest` (pass/fail/not_run) + `dev_selftest_at` vào trace TSV | After dev-gen-test. |
119
+ | `/dev-smoke-test` | `/dev-smoke-test FEAT-01-UC1` | Live endpoint check | Optional — sau deploy. |
117
120
 
118
121
  ---
119
122
 
120
123
  ## Phase 6b — QC Automation (official QC suite)
121
124
 
122
- > Pipeline `/qc-*` **là** official QC suite. Chạy **theo thứ tự** sau khi BDD approved (`/review-context` (BDD) APPROVED). Tách biệt hoàn toàn với dev self-check: QC sở hữu `qc_status`, dev sở hữu `dev_selftest`. `/qc-run-test` & `/qc-report` dùng module `qc-playwright`, độc lập với dev implementation module. Xem [../02-guides/qc-automation.md](../02-guides/qc-automation.md).
125
+ > Pipeline `/qc-*` **là** official QC suite. Chạy **theo thứ tự** sau khi BDD approved (`/review-context` (BDD) APPROVED). Tách biệt hoàn toàn với dev self-check: QC sở hữu `qc_status`, dev sở hữu `dev_selftest`. `/qc-run-test` & `/qc-report` dùng module `qc-playwright`, độc lập với dev implementation module. Xem [../02-guides/tester/qc-automation.md](../02-guides/tester/qc-automation.md).
123
126
 
124
- | Command | Input | Output | When to use |
125
- |---------|-------|--------|-------------|
126
- | `/qc-analyze` | feature file / UC-ID | QC analysis of scenarios + risks | After BDD approved — đầu pipeline QC. |
127
- | `/qc-plan` | QC analysis | Test plan (scope, layers, priorities) | After `/qc-analyze`. |
128
- | `/qc-design-test` | test plan | Test case designs mapped to `{UC-ID}-SC{N}` | After `/qc-plan`. |
129
- | `/qc-review` | test designs | Reviewed/approved test design set | After `/qc-design-test`. |
130
- | `/qc-run-test` | test designs | Execution results ghi `qc_status` (pass/fail/skip/not_run) + `qc_run_at` vào trace TSV, keyed by `@trace.verifies={UC-ID}-SC{N}` | After `/qc-review`. |
131
- | `/qc-report` | run results | QC report (Playwright Trace + pytest-html) | After `/qc-run-test`. |
127
+ | Command | Cách dùng (ví dụ) | Output | When to use |
128
+ |---------|-------------------|--------|-------------|
129
+ | `/qc-analyze` | `/qc-analyze FEAT-01-UC1` | **2 file** trong `{qc_dir}/{UC-ID}/` (mặc định `docs/`): `REQUIREMENT_ANALYSIS.md` (gộp requirement + BR + data-flow + AC) + `DOC_GAPS.md` | After BDD approved — đầu pipeline QC. |
130
+ | `/qc-plan` | `/qc-plan FEAT-01-UC1` | `{qc_dir}/{UC-ID}/TEST_PLAN.md` (scope, layers, priorities, questions-for-dev) | After `/qc-analyze`. |
131
+ | `/qc-design-test` | `/qc-design-test FEAT-01-UC1` | `{qc_dir}/{UC-ID}/test-cases/*.Test.md` mapped to `{UC-ID}-SC{N}` | After `/qc-plan`. |
132
+ | `/qc-review` | `/qc-review FEAT-01-UC1` | Verdict APPROVED / NEEDS_FIX + findings (**inline — không sinh file**) | After `/qc-design-test` (test-case) hoặc `/qc-run-test` (script). |
133
+ | `/qc-run-test` | `/qc-run-test FEAT-01-UC1` | Script Python (`pages/`, `tests/`) + ghi `qc_status` (pass/fail/skip/not_run) + `qc_run_at` vào trace TSV, keyed by `@trace.verifies={UC-ID}-SC{N}` | After `/qc-review`. |
134
+ | `/qc-report` | `/qc-report FEAT-01-UC1` | QC report `reports/<feature>/report.html` (Playwright Trace + pytest-html) | After `/qc-run-test`. |
132
135
 
133
136
  ---
134
137
 
135
138
  ## Phase 7 — Traceability Audit
136
139
 
137
- | Command | Input | Output | When to use |
138
- |---------|-------|--------|-------------|
139
- | `/validate-traces {domain}` | domain name (hoặc UC-ID) | Coverage matrix + drift report + `trace-report.json` | Anytime — verify traceability. Đọc mọi `.trace/{UC-ID}.tsv` rồi tính status OK / DRIFT / GAP / UNTRACKED. |
140
+ | Command | Cách dùng (ví dụ) | Output | When to use |
141
+ |---------|-------------------|--------|-------------|
142
+ | `/validate-traces {domain}` | `/validate-traces auth` *(hoặc `/validate-traces FEAT-01-UC1`)* | Coverage matrix + drift report + `trace-report.json` | Anytime — verify traceability. Đọc mọi `.trace/{UC-ID}.tsv` rồi tính status OK / DRIFT / GAP / UNTRACKED. |
140
143
 
141
144
  ---
142
145
 
143
- ## Phase 8 — Tester Feedback
146
+ ## Phase 8 — Tester / QC Feedback
144
147
 
145
- > Cả hai đều **read-only trên canonical specs/code**. Chúng chỉ ghi vào `feedback/` của shared spec repo và **commit + push** → PO/Dev thấy qua `/sync`. Testers không bao giờ sửa `.feature` trực tiếp.
148
+ > Cả hai đều **read-only trên canonical specs/code**. Chúng chỉ ghi vào `feedback/` của shared spec repo và **commit + push** → PO/Dev thấy qua `/sync`. Tester/QC không bao giờ sửa `.feature` trực tiếp. QC cũng dùng hai lệnh này: `/qc-run-test` FAIL = product-gap và `/qc-analyze` DOC_GAPS blocker đều route sang `/report-bug` hoặc `/propose-scenario` (xem [../02-guides/tester/qc-automation.md](../02-guides/tester/qc-automation.md)).
146
149
 
147
- | Command | Input | Output | When to use |
148
- |---------|-------|--------|-------------|
149
- | `/report-bug {UC-ID} {desc}` | UC/TICKET + description | `{spec_repo}/feedback/bug-reports/{BUG-ID}.md` + spec context + layer classification | Tester tìm thấy bug. Phân loại layer (Code/BDD/PRD/Design/Env) để route. |
150
- | `/propose-scenario {UC-ID} {desc}` | UC + edge-case description | `{spec_repo}/feedback/bdd-proposals/{UC-ID}-*.md` draft Gherkin | Tester tìm thấy edge case BDD chưa cover. Map vào PRD AC sẵn có, hoặc emit PRD change request nếu hành vi thực sự mới. |
150
+ | Command | Cách dùng (ví dụ) | Output | When to use |
151
+ |---------|-------------------|--------|-------------|
152
+ | `/report-bug {UC-ID} {desc}` | `/report-bug FEAT-01-UC1 "nhập sai mật khẩu vẫn đăng nhập được"` | `{spec_repo}/feedback/bug-reports/{BUG-ID}.md` + spec context + layer classification | Tester hoặc QC tìm thấy bug (gồm QC product-gap). Phân loại layer (Code/BDD/PRD/Design/Env) để route. |
153
+ | `/propose-scenario {UC-ID} {desc}` | `/propose-scenario FEAT-01-UC1 "khoá tài khoản sau 5 lần sai mật khẩu"` | `{spec_repo}/feedback/bdd-proposals/{UC-ID}-*.md` draft Gherkin | Tester hoặc QC tìm thấy edge case BDD chưa cover. Map vào PRD AC sẵn có, hoặc emit PRD change request nếu hành vi thực sự mới. |
151
154
 
152
155
  ---
153
156
 
154
157
  ## Debugging & Cross-cutting
155
158
 
156
- | Command | Input | Output | When to use |
157
- |---------|-------|--------|-------------|
158
- | `/fix-bug` | | Bug fix | When a bug is found. |
159
- | `/debug` | | Debug session | Deep debugging. |
160
- | `/learn {text}` | "AI does X, should Y" | Appends guardrail vào project lessons file | Khi AI lặp lại lỗi bạn muốn chặn. |
161
- | `/generate-spec-manifest` | | `spec-manifest.yaml` | Sinh manifest làm entry point cho external/tester agents. |
159
+ | Command | Cách dùng (ví dụ) | Output | When to use |
160
+ |---------|-------------------|--------|-------------|
161
+ | `/fix-bug {BUG-ID\|ticket\|desc}` | `/fix-bug BUG-012` *(hoặc ticket / mô tả lỗi)* | Code fix trên branch + regression test; nếu nhận `{BUG-ID}` → set report State `🟢 Open` → `🟡 Fixed` (QC re-verify pass mới → `🟢 Closed`) | Khi tìm thấy bug/ticket, hoặc route một filed bug report. |
162
+ | `/debug` | `/debug "NullPointerException ở LoginService"` | Debug session | Deep debugging. |
163
+ | `/learn {text}` | `/learn "AI hay dùng var, phải dùng const"` | Appends guardrail vào project lessons file | Khi AI lặp lại lỗi bạn muốn chặn. |
164
+ | `/generate-spec-manifest` | `/generate-spec-manifest` | `spec-manifest.yaml` | Sinh manifest làm entry point cho external/tester agents. |
162
165
 
163
166
  > **Project Lessons:** lessons lưu ở `paths.lessons_file` (default `specs/domain-knowledge/lessons-learned.md`; per-service `.agent/project-lessons.md` trong umbrella mode). Context-loader **Step 6.7** load mọi lesson đầu **mỗi** command như hard constraint. Đây là *project memory*, không phải fine-tuning model.
164
167
 
@@ -195,7 +198,7 @@ Load context theo thứ tự ưu tiên nghiêm ngặt (anti-lost-in-middle: fact
195
198
  | Step | Priority | What loads |
196
199
  |------|----------|-----------|
197
200
  | 1 | PROJECT-CONFIG | `project-context.yaml` → stack, conventions, domains, services, paths |
198
- | 1.5 | SERVICE ROUTING | *(umbrella only)* detect active domain, route `specs_dir`/`tech_docs_dir` → service submodule, store `service_root` |
201
+ | 1.5 | SERVICE ROUTING | *(umbrella only)* detect active domain, route `trace_dir` (+ code) → service submodule, store `service_root`. Khi `spec_source` set: `specs_dir` (BDD) / `tech_docs_dir` / PRD / design-spec / domain-knowledge / feedback → **spec repo** (cross-team), KHÔNG per-service |
199
202
  | 1.6 | SERVICE CONVENTIONS | *(umbrella only)* load `{service_root}/.agent/project-context.yaml` → override `test_command`, `build_command`, `paths.trace_dir` |
200
203
  | 2 | PROJECT-CONFIG | `.agent/modules/{module}/stack-profile.yaml` → framework-specific layer patterns |
201
204
  | 3 | **CRITICAL** | `CLAUDE.md` → architecture layers, coding standards, naming |
@@ -58,7 +58,7 @@ Ví dụ adapt theo platform type:
58
58
 
59
59
  ## qc-playwright — QC automation stack
60
60
 
61
- `qc-playwright` là **stack QC automation độc lập** với dev implementation module. Nó power native QC pipeline (`/qc-run-test`, `/qc-report`) và được chọn qua `tech_stack.qc_module` hoặc per `/qc-*` run — không phụ thuộc vào stack dev (java-spring, react, flutter…). Per-layer guides nằm ở `skills/qc/<stage>/`. Xem [../02-guides/qc-automation.md](../02-guides/qc-automation.md).
61
+ `qc-playwright` là **stack QC automation độc lập** với dev implementation module. Nó power native QC pipeline (`/qc-run-test`, `/qc-report`) và được chọn qua `tech_stack.qc_module` hoặc per `/qc-*` run — không phụ thuộc vào stack dev (java-spring, react, flutter…). Per-layer guides nằm ở `skills/qc/<stage>/`. Xem [../02-guides/tester/qc-automation.md](../02-guides/tester/qc-automation.md).
62
62
 
63
63
  **Stack** (từ `modules/qc-playwright/stack-profile.yaml`): Python 3 + pytest-playwright + Page Object Model. Report = Playwright Trace + pytest-html (**không** dùng Allure, không hand-written dashboard, không `record_video`).
64
64
 
@@ -85,9 +85,9 @@ Ví dụ adapt theo platform type:
85
85
 
86
86
  **Folder structure:**
87
87
  ```
88
- docs/<project>/<feature>/ ← test-case Markdown (.Test.md) — source of truth
88
+ {paths.qc_dir}/{UC-ID}/test-cases/ ← test-case Markdown (.Test.md) — source of truth (mặc định docs/, lộ ra ngoài)
89
89
  pages/ ← Page Object Model (base_page.py + <feature>_page.py)
90
- tests/ ← pytest scripts, 1-1 với docs/ (conftest.py + test_<feature>.py)
90
+ tests/ ← pytest scripts, 1-1 với test-cases/ (conftest.py + test_<feature>.py)
91
91
  utils/ ← config_loader, logger, steps, test_ordering, report helpers
92
92
  test_data/ ← JSON datasets
93
93
  config/config.yaml ← browser, timeout, video/screenshot/trace toggles
@@ -107,4 +107,4 @@ reports/ test-results/ ← generated (gitignored): html report, trace.zip,
107
107
 
108
108
  ---
109
109
 
110
- *Xem thêm:* [Trace TSV Schema](trace-schema.md) (`qc_status` vs `dev_selftest`) · [Command Reference](commands.md) (pipeline `/qc-*`) · [02 · Guides · QC Automation](../02-guides/qc-automation.md).
110
+ *Xem thêm:* [Trace TSV Schema](trace-schema.md) (`qc_status` vs `dev_selftest`) · [Command Reference](commands.md) (pipeline `/qc-*`) · [02 · Guides · QC Automation](../02-guides/tester/qc-automation.md).
@@ -22,10 +22,10 @@
22
22
  Tab-separated, một header row + một data row mỗi scenario. Header chính xác (từ `generate-bdd.tmpl`):
23
23
 
24
24
  ```
25
- sc_id sc_title spec_ver gen_ver implemented_by test_count test_classes dev_selftest dev_selftest_at qc_status qc_run_at prd_version bdd_version tech_doc_revision prd_status uc_status fe_phase status last_updated
25
+ sc_id sc_title spec_ver gen_ver implemented_by test_count test_classes dev_selftest dev_selftest_at qc_status qc_run_at qc_owner qc_blocked_by prd_version bdd_version tech_doc_revision fe_tech_doc_revision prd_status uc_status fe_phase status last_updated
26
26
  ```
27
27
 
28
- 19 cột, theo đúng thứ tự trên.
28
+ 22 cột, theo đúng thứ tự trên.
29
29
 
30
30
  ---
31
31
 
@@ -44,16 +44,23 @@ sc_id sc_title spec_ver gen_ver implemented_by test_count test_classes dev_selft
44
44
  | 9 | `dev_selftest_at` | Ngày chạy dev self-check (`YYYY-MM-DD`) | `—` | **dev-run-test** |
45
45
  | 10 | `qc_status` | Kết quả QC chính thức: `pass` / `fail` / `skip` / `not_run` | `—` | **qc-run-test** |
46
46
  | 11 | `qc_run_at` | Ngày chạy QC (`YYYY-MM-DD`) | `—` | **qc-run-test** |
47
- | 12 | `prd_version` | `@trace.prd_version` từ `.feature` header | từ `.feature` | generate-bdd |
48
- | 13 | `bdd_version` | `@trace.bdd_version` từ `.feature` header | từ `.feature` | generate-bdd |
49
- | 14 | `tech_doc_revision` | Tech-doc revision tại thời điểm codegen | `—` | generate-code |
50
- | 15 | `prd_status` | `\| **Status** \|` từ PRD metadata | từ PRD | generate-bdd |
51
- | 16 | `uc_status` | Trạng thái UC: `draft` / `approved` / | `draft` (UC mới) | generate-bdd |
52
- | 17 | `fe_phase` | FE phase khi implement (`ui` / `integration`) | `—` | generate-code `--phase` |
53
- | 18 | `status` | Trạng thái tổng hợp: `OK` / `DRIFT` / `GAP` / `UNTRACKED` | `UNTRACKED` | validate-traces |
54
- | 19 | `last_updated` | Ngày update gần nhất (`YYYY-MM-DD`) | today | mọi command ghi row |
47
+ | 12 | `qc_owner` | **Đang chờ ai** (PM view) khi SC chưa pass: `dev` / `po` / `—` | `—` | **qc-run-test** / **report-bug** |
48
+ | 13 | `qc_blocked_by` | Artifact liên quan: `BUG-{id}` / `GAP-{id}` / `—` | `—` | **qc-run-test** / **report-bug** |
49
+ | 14 | `prd_version` | `@trace.prd_version` từ `.feature` header | từ `.feature` | generate-bdd |
50
+ | 15 | `bdd_version` | `@trace.bdd_version` từ `.feature` header | từ `.feature` | generate-bdd |
51
+ | 16 | `tech_doc_revision` | **BE** API-contract revision tại thời điểm codegen | `—` | generate-code / review-tech-docs (BE doc) |
52
+ | 17 | `fe_tech_doc_revision` | **FE** client tech-design revision (`{UC-ID}-tech-design-{platform}.md`) tại thời điểm FE integration | `—` | generate-code `--phase=integration` / review-tech-docs (FE doc) |
53
+ | 18 | `prd_status` | `\| **Status** \|` từ PRD metadata | từ PRD | generate-bdd |
54
+ | 19 | `uc_status` | Trạng thái UC: `draft` / `approved` / | `draft` (UC mới) | generate-bdd |
55
+ | 20 | `fe_phase` | FE phase khi implement (`ui` / `integration`) | `—` | generate-code `--phase` |
56
+ | 21 | `status` | Trạng thái tổng hợp: `OK` / `DRIFT` / `GAP` / `UNTRACKED` | `UNTRACKED` | validate-traces |
57
+ | 22 | `last_updated` | Ngày update gần nhất (`YYYY-MM-DD`) | today | mọi command ghi row |
55
58
 
56
- > **Re-generation rules (generate-bdd):** SC đã trong TSV & `spec_ver` không đổi chỉ update `sc_title`, `prd_version`, `bdd_version`, `prd_status`, `uc_status`, `last_updated`. Nếu `spec_ver` đổithêm `spec_ver` set `status = DRIFT` ngay. SC mới append với `gen_ver`/`implemented_by`/`test_count`/`test_classes`/`dev_selftest`/`dev_selftest_at`/`qc_status`/`qc_run_at`/`tech_doc_revision` = `—`. SC bị xóa khỏi `.feature` xóa row.
59
+ > **`qc_owner` / `qc_blocked_by` (PM "waiting-on" view):** dành cho PO kiêm PM xem **case nào đang chờ ai**. `/qc-run-test` set khi ghi `qc_status`: product-gap FAIL → `qc_owner=dev`; `skip`/`not_run` do `DOC_GAPS` 🔴 Blocker mở → `qc_owner=po` + `qc_blocked_by=GAP-{id}`; `pass` cả hai về `—`. `/report-bug` backfill `qc_blocked_by=BUG-{id}` (+ `qc_owner` theo layer) cho SC khớp. `/validate-traces` tổng hợp `waiting_dev` / `waiting_po` cho dashboard.
60
+
61
+ > **Re-generation rules (generate-bdd):** SC đã có trong TSV & `spec_ver` không đổi → chỉ update `sc_title`, `prd_version`, `bdd_version`, `prd_status`, `uc_status`, `last_updated`. Nếu `spec_ver` đổi → thêm `spec_ver` và set `status = DRIFT` ngay. SC mới → append với `gen_ver`/`implemented_by`/`test_count`/`test_classes`/`dev_selftest`/`dev_selftest_at`/`qc_status`/`qc_run_at`/`qc_owner`/`qc_blocked_by`/`tech_doc_revision`/`fe_tech_doc_revision` = `—`. SC bị xóa khỏi `.feature` → xóa row.
62
+
63
+ > **Backward-compat:** TSV cũ thiếu cột mới ở header → `/validate-traces` đọc thành giá trị rỗng, không lỗi: `qc_owner`/`qc_blocked_by` (trước 19 cột) → `null`; `fe_tech_doc_revision` (trước 22 cột) → `0`. Lần `/generate-bdd` re-gen kế tiếp tự nâng header lên 22 cột.
57
64
 
58
65
  ---
59
66
 
@@ -85,7 +92,7 @@ Trace TSV mang **hai cột tín hiệu độc lập** — không bao giờ trộ
85
92
  | 3 | `DRIFT` | `spec_ver != gen_ver` (scenario đổi sau lần codegen gần nhất) |
86
93
  | 4 | `OK` | tất cả: `spec_ver == gen_ver`, `implemented_by != —`, `test_count > 0` |
87
94
 
88
- Ngoài ra `/validate-traces` còn flag **`PRD_DRIFT`** (PRD version trong code/TSV trễ hơn PRD file hiện tại) và **`TECHDOC_DRIFT`** (code sinh từ tech-doc revision cũ).
95
+ Ngoài ra `/validate-traces` còn flag **`PRD_DRIFT`** (PRD version trong code/TSV trễ hơn PRD file hiện tại), **`TECHDOC_DRIFT`** (code BE sinh từ BE-contract revision cũ — so `tech_doc_revision`), và **`FE_TECHDOC_DRIFT`** (FE integration code sinh từ FE tech-design revision cũ — so `fe_tech_doc_revision`).
89
96
 
90
97
  ---
91
98
 
@@ -133,13 +140,13 @@ Per-scenario trong file: `# @trace.scenario: {UC-ID}-SC{N}`, `# @trace.sc_versio
133
140
  `/validate-traces` ghi `{paths.trace_dir}/trace-report.json` — single source of truth cho web dashboards. Cấu trúc rút gọn:
134
141
 
135
142
  - `generated_at`, `domain`
136
- - `summary` — aggregates: `total_prds`, `approved_prds`, `total_ucs`, `approved_ucs`, `draft_ucs`, `total_scs`, `coded_scs`, `tested_scs`, `code_coverage_pct`, `test_coverage_pct`, `drift_count`, `gap_count`, `untracked_count`, `dev_selftest_passing/failing/not_run`, `qc_passing/failing/skipped/not_run`, `tech_docs_count`
143
+ - `summary` — aggregates: `total_prds`, `approved_prds`, `total_ucs`, `approved_ucs`, `draft_ucs`, `total_scs`, `coded_scs`, `tested_scs`, `code_coverage_pct`, `test_coverage_pct`, `drift_count`, `gap_count`, `untracked_count`, `dev_selftest_passing/failing/not_run`, `qc_passing/failing/skipped/not_run`, `waiting_dev`, `waiting_po`, `tech_docs_count`
137
144
  - `prds[]` → `ucs[]` → `scenarios[]` — mỗi scenario có đầy đủ các trường của TSV row (gồm `dev_selftest`, `dev_selftest_at`, `qc_status`, `qc_run_at`)
138
- - `issues` — phân loại: `drift`, `gap`, `untracked`, `prd_version_drift`, `techdoc_drift`, mỗi entry kèm `fix` command gợi ý
145
+ - `issues` — phân loại: `drift`, `gap`, `untracked`, `prd_version_drift`, `techdoc_drift`, `fe_techdoc_drift` (kèm `platform`), mỗi entry kèm `fix` command gợi ý
139
146
 
140
- **TSV `"—"` → JSON mapping:** `implemented_by: "—"` → `null` · `test_count: "—"` → `0` · `test_classes: "—"` → `[]` · `tech_doc_revision: "—"` → `0` · `dev_selftest: "—"` → `"not_run"` · `dev_selftest_at: "—"` → `null` · `qc_status: "—"` → `"not_run"` · `qc_run_at: "—"` → `null`.
147
+ **TSV `"—"` → JSON mapping:** `implemented_by: "—"` → `null` · `test_count: "—"` → `0` · `test_classes: "—"` → `[]` · `tech_doc_revision: "—"` → `0` · `fe_tech_doc_revision: "—"` → `0` · `dev_selftest: "—"` → `"not_run"` · `dev_selftest_at: "—"` → `null` · `qc_status: "—"` → `"not_run"` · `qc_run_at: "—"` → `null`.
141
148
 
142
- > **Umbrella mode:** mỗi service submodule giữ `.trace/` riêng (committed). `/validate-traces` (hoặc `/sync`) publish merged report vào `{spec_source}/.living-docs/` (canonical) + mirror `./.trace/trace-report.json` ở workspace hiện tại. Cả hai generated mirror gitignore, không commit.
149
+ > **Umbrella mode:** khi `spec_source` set, `.trace/*.tsv` authoritative nằm **một chỗ** ở `{spec_source}/.trace/` (committed — PM quản lý tập trung; mỗi scenario mang `@trace.service`). `/validate-traces` (hoặc `/sync`) sinh `trace-report.json` vào `{spec_source}/.living-docs/` + mirror `./.trace/trace-report.json` ở workspace hiện tại cả hai generated, gitignore. (Không `spec_source` → `.trace` per-service.)
143
150
 
144
151
  ---
145
152
 
package/docs/README.md CHANGED
@@ -10,8 +10,7 @@ Tài liệu được chia theo **vai trò** và **chủ đề**. Bắt đầu
10
10
  | Người mới / cài đặt lần đầu | [01 · Getting Started](01-getting-started/) |
11
11
  | Product Owner | [Guide · Product Owner](02-guides/product-owner/README.md) |
12
12
  | Developer | [Guide · Developer](02-guides/developer/README.md) |
13
- | Tester | [Guide · Tester](02-guides/tester/README.md) |
14
- | QC Automation | [Guide · QC Automation](02-guides/qc-automation.md) |
13
+ | QC / Tester (QA) | [Guide · Tester / QA](02-guides/tester/README.md) — gồm cả pipeline QC tự động (`/qc-*`) |
15
14
  | Muốn hiểu kiến trúc | [03 · Concepts](03-concepts/) |
16
15
  | Vận hành / admin | [04 · Operations](04-operations/) |
17
16
  | Tra cứu lệnh | [05 · Reference](05-reference/) |
@@ -28,8 +27,7 @@ Tài liệu được chia theo **vai trò** và **chủ đề**. Bắt đầu
28
27
  ### 02 · [Guides (theo vai trò)](02-guides/)
29
28
  - [Product Owner](02-guides/product-owner/README.md) — define-product, PRD, design-spec, review
30
29
  - [Developer](02-guides/developer/README.md) — BDD, tech-docs, code, dev self-check
31
- - [Tester](02-guides/tester/README.md) — spec-manifest, report-bug, propose-scenario, Living Docs
32
- - [QC Automation](02-guides/qc-automation.md) — pipeline `/qc-*`, qc_status
30
+ - [Tester / QA](02-guides/tester/README.md) — spec-manifest, report-bug, propose-scenario, Living Docs, và **chương [QC Automation](02-guides/tester/qc-automation.md)** (pipeline `/qc-*`, `qc_status`)
33
31
 
34
32
  ### 03 · [Concepts](03-concepts/)
35
33
  - [Architecture](03-concepts/architecture.md) — layers, modules, plug-in system
@@ -48,4 +46,4 @@ Tài liệu được chia theo **vai trò** và **chủ đề**. Bắt đầu
48
46
 
49
47
  ---
50
48
 
51
- *Mỗi file có breadcrumb điều hướng ở đầu. Phiên bản framework: xem `core/FRAMEWORK_VERSION`.*
49
+ *Mỗi file có breadcrumb điều hướng ở đầu. Phiên bản framework mới nhất: xem trên [npm](https://www.npmjs.com/package/@anhth2/spec-driven-dev-plugin).*
@@ -19,14 +19,15 @@ architecture:
19
19
  - "Each test independent via pytest-playwright fixtures (page / logged_in_page / …)"
20
20
  - "Page Object extends slim BasePage; split 3 layers: locators _x(), actions verb_noun(), assertions assert_x() using expect()"
21
21
  - "Locator priority: data-testid → role → label/text → CSS → avoid XPath"
22
+ - "test-id values come from the FE tech-design §2b Test Selectors contract ({UC-ID}-tech-design-{platform}.md) — prefer them (no runtime scan); fall back to role/text only when an actionable element has no test-id there, and note the gap"
22
23
  - "Group tests by (role, account) so login/logout never interleaves across roles"
23
24
  - "Cover 100% of TCs in the .Test.md — every TC ends Pass/Fail/Skip, none left Draft"
24
25
  folder_structure: |
25
- docs/<project>/<feature>/ ← test-case Markdown (.Test.md) — source of truth
26
+ {paths.qc_dir}/{UC-ID}/test-cases/ ← test-case Markdown (.Test.md) — source of truth (mặc định docs/, lộ ra ngoài)
26
27
  pages/ ← Page Object Model
27
28
  │ ├── base_page.py ← slim BasePage (click/fill/wait/screenshot)
28
29
  │ └── <feature>_page.py
29
- tests/ ← pytest scripts, 1-1 with docs/
30
+ tests/ ← pytest scripts, 1-1 with test-cases/
30
31
  │ ├── conftest.py ← fixtures: browser, page, logged_in_page, tracing
31
32
  │ └── <project>/test_<feature>.py
32
33
  utils/ ← config_loader, logger, steps, test_ordering, report helpers
@@ -41,7 +42,7 @@ coding_standards:
41
42
  test_function: "test_TC<NNN>_<snake_case>"
42
43
  page_object: "<feature>_page.py with <Feature>Page class extending BasePage"
43
44
  files:
44
- test_case_md: "docs/<project>/<feature>/TC_<FEATURE>.Test.md"
45
+ test_case_md: "{paths.qc_dir}/{UC-ID}/test-cases/TC_<FEATURE>.Test.md"
45
46
  page_object: "pages/<feature>_page.py"
46
47
  test_script: "tests/<project>/test_<feature>.py"
47
48
  patterns:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anhth2/spec-driven-dev-plugin",
3
- "version": "0.11.0",
3
+ "version": "0.14.0",
4
4
  "description": "AI-First Spec-Driven Development workflow plugin for Claude Code",
5
5
  "bin": {
6
6
  "spec-driven-dev": "./bin/index.js"
@@ -152,6 +152,8 @@ Read `.agent/project-context.yaml`. Extract and store:
152
152
  - `paths.specs_dir` → BDD specs root
153
153
  - `paths.prd_dir` → PRD documents root
154
154
  - `paths.refinement_dir` → findings/review output dir
155
+ - `paths.qc_dir` → QC automation artifacts root (visible top-level, one subfolder per UC: `{qc_dir}/{UC-ID}/`)
156
+ - `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)
155
157
  - `paths.product_definitions_dir` → product definitions root
156
158
  - `paths.domain_knowledge_dir` → domain knowledge root
157
159
  - `paths.business_dictionary` → path to business-dictionary.md
@@ -164,6 +166,8 @@ If `paths` section is absent, use these defaults:
164
166
  - `specs_dir` = `specs/bdd`
165
167
  - `prd_dir` = `specs/prd`
166
168
  - `refinement_dir` = `.agent/review`
169
+ - `qc_dir` = `docs`
170
+ - `qc_skills_dir` = `.agent/skills/qc`
167
171
  - `product_definitions_dir` = `specs/product-definition`
168
172
  - `domain_knowledge_dir` = `specs/domain-knowledge`
169
173
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
@@ -189,7 +193,7 @@ If `services` section is present:
189
193
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
190
194
 
191
195
  **2. Route to service** — if active domain matches a key in `services`:
192
- - Override `paths.specs_dir` → `services.{domain}.specs_dir`
196
+ - 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.
193
197
  - 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.
194
198
  - Store `active_service` = `services.{domain}.path`
195
199
  - Store `active_service_module` = `services.{domain}.module`
@@ -200,6 +204,7 @@ If `services` section is present:
200
204
  - Set `active_service = unresolved`
201
205
 
202
206
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
207
+ - 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`.)*
203
208
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
204
209
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
205
210
  - 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.)*
@@ -208,8 +213,10 @@ If `services` section is present:
208
213
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
209
214
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
210
215
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
216
+ - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
217
+ - 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`.)*
211
218
 
212
- > **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.
219
+ > **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.
213
220
 
214
221
  ---
215
222
 
@@ -229,12 +236,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
229
236
  |----------|--------|
230
237
  | `conventions.test_command` | service's `conventions.test_command` |
231
238
  | `conventions.build_command` | service's `conventions.build_command` |
232
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
233
- | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
239
+ | `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`). |
240
+ | `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. |
234
241
 
235
242
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
236
243
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
237
- - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
244
+ - **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/`).
238
245
 
239
246
  **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).
240
247
 
@@ -513,6 +520,36 @@ Output Artifacts:
513
520
 
514
521
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
515
522
 
523
+ ## Pipeline Position
524
+
525
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
526
+ so the user always sees where this command sits in the end-to-end flow:
527
+
528
+ ```
529
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
530
+ ```
531
+
532
+ Find the current command in this phase legend and mark **its** phase in the map above:
533
+
534
+ | Phase | Commands |
535
+ |-------|----------|
536
+ | Discovery | `/define-product` |
537
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
538
+ | Design Spec | `/generate-design-spec` |
539
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
540
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
541
+ | Code | `/generate-code` · `/review-code` |
542
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
543
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
544
+ | Trace Audit | `/validate-traces` |
545
+
546
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
547
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
548
+
549
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
550
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
551
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
552
+
516
553
  ## Next Command Suggestion
517
554
 
518
555
  Suggest the logical next command based on workflow phase:
@@ -554,10 +591,13 @@ Suggest the logical next command based on workflow phase:
554
591
  Format the footer as:
555
592
  ```
556
593
  ---
557
- Status : {badge}
594
+ Status : {badge}
558
595
  {Output Artifacts block}
559
- Next : {suggested command with example arguments}
596
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
597
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
598
+ Next : {suggested command with example arguments}
560
599
  ```
600
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
561
601
 
562
602
 
563
603
  ---
@@ -638,6 +678,36 @@ Output Artifacts:
638
678
 
639
679
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
640
680
 
681
+ ## Pipeline Position
682
+
683
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
684
+ so the user always sees where this command sits in the end-to-end flow:
685
+
686
+ ```
687
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
688
+ ```
689
+
690
+ Find the current command in this phase legend and mark **its** phase in the map above:
691
+
692
+ | Phase | Commands |
693
+ |-------|----------|
694
+ | Discovery | `/define-product` |
695
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
696
+ | Design Spec | `/generate-design-spec` |
697
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
698
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
699
+ | Code | `/generate-code` · `/review-code` |
700
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
701
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
702
+ | Trace Audit | `/validate-traces` |
703
+
704
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
705
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
706
+
707
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
708
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
709
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
710
+
641
711
  ## Next Command Suggestion
642
712
 
643
713
  Suggest the logical next command based on workflow phase:
@@ -679,8 +749,11 @@ Suggest the logical next command based on workflow phase:
679
749
  Format the footer as:
680
750
  ```
681
751
  ---
682
- Status : {badge}
752
+ Status : {badge}
683
753
  {Output Artifacts block}
684
- Next : {suggested command with example arguments}
754
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
755
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
756
+ Next : {suggested command with example arguments}
685
757
  ```
758
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
686
759