@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
@@ -13,15 +13,15 @@
13
13
  - [ ] Cross-service flows đã được verify (nếu feature span nhiều service)
14
14
 
15
15
  **TSV & Living Docs:**
16
- - [ ] `/qc-run-test` đã chạy → `qc_status` đã ghi vào `{service}/.trace/{UC-ID}.tsv`
17
- - [ ] TSV đã được commit vào service submodule + umbrella pointer đã update + push
16
+ - [ ] `/qc-run-test` đã chạy → `qc_status` đã ghi vào `{spec_source}/.trace/{UC-ID}.tsv` (spec repo — một chỗ)
17
+ - [ ] TSV đã được commit vào **spec repo** (1 tầng, giống `feedback/`) + push KHÔNG commit vào service submodule
18
18
  - [ ] `/validate-traces` (hoặc `/sync`) đã chạy → Living Docs panel hiển thị `qc_status: pass`
19
19
  - [ ] Không còn scenario nào `qc_status: not_run` trong UC đang test
20
20
  - [ ] Nếu có `qc_status: fail` → đã `/report-bug` kèm path evidence (`reports/<feature>/report.html`)
21
21
 
22
22
  ## Xem Thêm
23
23
 
24
- - [Guide › QC Automation](../qc-automation.md) — pipeline `/qc-*` chi tiết, `qc_status`, stack `qc-playwright`
24
+ - [Guide › QC Automation](qc-automation.md) — pipeline `/qc-*` chi tiết, `qc_status`, stack `qc-playwright`
25
25
  - [Operations › Bug Flow](../../04-operations/bug-flow.md) — flow phối hợp Tester ↔ Dev ↔ PO
26
26
  - [Concepts › Traceability](../../03-concepts/traceability.md) — trace TSV, dev_selftest vs qc_status
27
27
  - [Reference › Commands](../../05-reference/commands.md) — danh mục đầy đủ mọi command
@@ -17,9 +17,10 @@ Lookup FT-042 trong spec-manifest.yaml
17
17
  → status: approved? ✅ (nếu draft → dừng, báo PO)
18
18
  → ghi lại paths (tất cả đều nằm trong submodule):
19
19
  prd: {spec_source}/specs/prd/{domain}/FT-042-*.md
20
- bdd.be: {service-be}/specs/bdd/{domain}/FT-042-*.feature
21
- bdd.web: {service-web}/specs/bdd/{domain}/FT-042-*.feature
20
+ bdd.system: {spec_source}/specs/bdd/{domain}/system/FT-042-*.feature
21
+ bdd.web: {spec_source}/specs/bdd/{domain}/web/FT-042-*.feature
22
22
  tech_docs.be: {spec_source}/specs/tech-docs/{domain}/FT-042-*.md
23
+ tech_docs.fe: {spec_source}/specs/tech-docs/{domain}/FT-042-*-tech-design-web.md
23
24
 
24
25
 
25
26
  Đọc PRD tại path manifest.prd
@@ -28,7 +29,7 @@ Lookup FT-042 trong spec-manifest.yaml
28
29
 
29
30
 
30
31
  Đọc BDD tại path manifest.bdd.be / bdd.web
31
- → file nằm trong SERVICE submodule (be/web/app — PO gen từ PRD)
32
+ → file nằm trong SPEC submodule (PO gen từ PRD — tất cả BDD web/app/system ở spec repo)
32
33
  → mỗi Scenario = 1 test case cần cover
33
34
  → BE có BDD riêng (system/), Web có BDD riêng (web/), App có BDD riêng (app/)
34
35
 
@@ -41,30 +42,27 @@ Lookup FT-042 trong spec-manifest.yaml
41
42
 
42
43
  Chạy QC automation pipeline (6 bước — ghi kết quả chính thức vào TSV)
43
44
 
44
- ├─ /qc-analyze {UC-ID} → bóc tách spec, xác định scope, phát hiện DOC_GAPS
45
- ├─ /qc-plan {UC-ID} → risk + test plan + questions-for-dev
46
- ├─ /qc-design-test {UC-ID} → thiết kế test case chi tiết (.Test.md)
45
+ ├─ /qc-analyze {UC-ID} → 2 file: REQUIREMENT_ANALYSIS.md + DOC_GAPS.md
46
+ ├─ /qc-plan {UC-ID} → TEST_PLAN.md (risk + plan + questions-for-dev)
47
+ ├─ /qc-design-test {UC-ID} → test-cases/*.Test.md
48
+ │ ⌙ artifact phân tích/thiết kế → {qc_dir}/{UC-ID}/ (mặc định docs/, VISIBLE)
47
49
  ├─ /qc-review {UC-ID} → review test design trước khi chạy
48
50
  ├─ /qc-run-test {UC-ID} → sinh + chạy pytest-playwright
49
51
  │ → ghi qc_status (pass/fail/skip) per scenario
50
- │ → vào {service}/.trace/{UC-ID}.tsv ← AUTHORITATIVE
52
+ │ → vào {spec_source}/.trace/{UC-ID}.tsv ← AUTHORITATIVE (spec repo)
51
53
  └─ /qc-report {UC-ID} → report pytest-html + Playwright trace evidence
52
54
  → reports/<feature>/report.html ← LOCAL, gitignored
53
55
 
54
56
 
55
- Commit TSV vào service submodule + update umbrella pointer
56
- cd {service}
57
+ Commit TSV vào spec repo (1 tầng trace dồn về specs, giống feedback/)
58
+ cd {spec_source}
57
59
  git add .trace/{UC-ID}.tsv
58
60
  git commit -m "qc: record qc_status for {UC-ID} — pass/fail"
59
- git push
60
- cd .. ← umbrella root
61
- git add {service}
62
- git commit -m "chore: update {service} submodule pointer — {UC-ID} qc_status"
63
61
  git push
64
62
 
65
63
 
66
64
  /validate-traces (hoặc /sync)
67
- tổng hợp TSVs từ tất cả services → Living Docs cập nhật cột qc_status
65
+ đọc {spec_source}/.trace/ (một chỗ) → Living Docs cập nhật cột qc_status
68
66
 
69
67
 
70
68
  Kết quả:
@@ -56,12 +56,15 @@ LAYER 4 — EXECUTION (command logic)
56
56
 
57
57
  LAYER 5 — OUTPUT (artifacts in consumer proj)
58
58
  Spec module (cross-team, via {spec_source}):
59
- specs/product-definition/ · specs/prd/ · specs/bdd/
60
- specs/tech-docs/ (API contract) · .living-docs/ (gitignored)
59
+ specs/product-definition/ · specs/prd/ · specs/bdd/ (web/app/system)
60
+ specs/tech-docs/ (API contract + FE tech-design) · feedback/
61
+ .trace/*.tsv (authoritative, committed — một chỗ cho PM) · .living-docs/ (gitignored)
61
62
  Service submodule (per-service):
62
- src/ · .trace/*.tsv (authoritative, committed) · .agent/review/
63
+ src/ (chỉ code) · .agent/review/
63
64
  QC automation outputs:
64
65
  QC test cases / scripts (Python pytest-playwright, Page Object)
66
+ → QC analysis / test-cases ghi vào {qc_dir}/{UC-ID}/ (mặc định docs/,
67
+ visible — KHÔNG nằm trong .agent/)
65
68
  → guides per-layer ở skills/qc/<stage>/ · qc_status trong .trace/*.tsv
66
69
  ```
67
70
 
@@ -217,7 +220,7 @@ spec-driven-dev/
217
220
 
218
221
  > **Umbrella mode — API contract (tech-docs) là cross-team artifact:** khi `setup.spec_source` được set, tech-docs LUÔN route về `{spec_source}/specs/tech-docs/` (giống PRD / design-spec / domain-knowledge), KHÔNG per-service — để FE/App đọc contract qua spec submodule ở `/generate-code --phase=integration`. Chỉ khi không có `spec_source` thì tech-docs mới nằm per-service.
219
222
 
220
- > **Living Docs / trace data location:** `.trace/*.tsv` của mỗi service **authoritative** commit trong chính service submodule. Canonical report (`trace-report.json` + TSV mirror namespaced) sinh vào spec module tại `{spec_source}/.living-docs/` (gitignored), cộng một panel mirror cục bộ tại `./.trace`. Chi tiết: [traceability.md](traceability.md#living-docs--canonical-trong-spec-module--panel-mirror).
223
+ > **Living Docs / trace data location:** khi `spec_source` set, `.trace/*.tsv` **authoritative** nằm **một chỗ** `{spec_source}/.trace/` (committed trong spec repo PM quản lý tập trung; mỗi scenario mang `@trace.service`). Report `trace-report.json` sinh vào `{spec_source}/.living-docs/` (gitignored) + panel mirror cục bộ `./.trace`. Chỉ khi không có `spec_source` thì `.trace` mới per-service. Chi tiết: [traceability.md](traceability.md#living-docs--canonical-trong-spec-module--panel-mirror).
221
224
 
222
225
  ---
223
226
 
@@ -27,7 +27,7 @@ Vòng đời feature đi qua các phase, mỗi transition có một **AI review
27
27
  | **2. PRD** | AI → SA/PO review | `/generate-prd`, `/refine-prd`, `/review-context` | `specs/prd/{domain}/{TICKET-ID}-{slug}.md` |
28
28
  | **2b. Design Spec** *(FE/App only)* | AI → Designer/PO sign-off | `/generate-design-spec` | `specs/design-spec/{domain}/{TICKET-ID}-design-spec-{platform}.md` |
29
29
  | **3. BDD Spec** | AI → SA/Dev review | `/generate-bdd`, `/review-context` | `specs/bdd/{domain}/{UC-ID}.feature` |
30
- | **4. Tech Design** | AI → SA/Lead review | `/generate-tech-docs`, `/review-tech-docs` | `tech-docs/{domain}/{UC-ID}-tech-design.md` |
30
+ | **4. Tech Design** *(platform-aware)* | AI → SA/Lead review | `/generate-tech-docs`, `/review-tech-docs` | BE: `tech-docs/{domain}/{UC-ID}-tech-design.md` (API contract) · FE/App: `{UC-ID}-tech-design-{platform}.md` (client design — **gated** trên System BDD + BE contract) |
31
31
  | **5. Code** | AI → Dev review | `/generate-code` *(FE: `--phase=ui`/`--phase=integration`)*, `/review-code` | `src/...` |
32
32
  | **6. Dev Self-Check** | Dev (own code) | `/dev-gen-test`, `/dev-run-test`, `/dev-smoke-test` | `src/test/...` — dev smoke (`dev_selftest`), tách khỏi QC suite |
33
33
  | **6b. QC Automation** *(official QC suite)* | QC | `/qc-analyze` → `/qc-plan` → `/qc-design-test` → `/qc-review` → `/qc-run-test` → `/qc-report` | QC test designs + run results — set `qc_status` (`qc-playwright` module) |
@@ -64,21 +64,33 @@ Phase 2b/3: Design Spec & BDD
64
64
  sign-off + /generate-bdd blocked tới khi mọi screen có link)
65
65
  [Designer review + PO sign-off]
66
66
  /generate-bdd ────────────→ specs/bdd/{domain}/{UC-ID}.feature
67
+ THỨ TỰ OUTSIDE-IN (khi có client): web → app → system
68
+ System BDD được TỔNG HỢP từ web+app BDD (client-facing trước → BE/system suy ra để phục vụ)
69
+ (project chỉ-BE, không web/app: system gen thẳng từ PRD)
67
70
  (apply platform vocabulary: web "clicks" / mobile "taps" / backend "submits a request")
68
71
  /review-context {feature} → .agent/review/{uc-id}-review-bdd-findings.yaml
69
72
  Checks: PRD coverage (mỗi AC + BR bullet → ≥1 scenario) · Gherkin R1–R10 · compliance C1–C5
70
73
  ✅ APPROVED → Phase 4
71
74
 
72
- Phase 4: Tech Design
73
- /generate-tech-docs ──────→ tech-docs/{domain}/{UC-ID}-tech-design.md
74
- (đọc @trace.modulechọn template theo platform; brownfield: reverse-document mode)
75
+ Phase 4: Tech Design (platform-aware — đọc @trace.platform)
76
+ BE (system):
77
+ /generate-tech-docs {system .feature}tech-docs/{domain}/{UC-ID}-tech-design.md
78
+ API contract: endpoints, data model, DB, caching (brownfield: reverse-document)
79
+ FE/App (web|app) — GATED, cần CÓ trước: System BDD + BE contract (approved):
80
+ /generate-tech-docs {web|app .feature} → tech-docs/{domain}/{UC-ID}-tech-design-{platform}.md
81
+ client design: components, state, API-integration map theo BE contract, routing,
82
+ §2b Test Selectors (test-id ổn định cho element có action → QC locate khỏi scan)
83
+ (thiếu System BDD hoặc BE contract → HALT, in hướng dẫn)
75
84
  /review-tech-docs ────────→ .agent/review/{uc-id}-tech-review-findings.yaml
76
85
  [Review Board] → --resume (apply + bump revision)
77
86
  ✅ APPROVED → Phase 5
78
87
 
79
88
  Phase 5: Code
80
89
  /generate-code ───────────→ src/... (@trace.implements tags)
81
- FE: --phase=ui (UI + mock adapter, tester-ready) → --phase=integration (real API after sign-off)
90
+ FE: --phase=ui (UI + mock adapter, tester-ready)
91
+ mock shape: BE contract nếu có (chuẩn) → else System BDD (tạm, warn) — fixture values luôn từ System BDD
92
+ → khi BE contract approved → /generate-tech-docs {web|app} (FE design, Phase 4)
93
+ → --phase=integration (wire real API theo §4 của FE tech-design)
82
94
  (component enforcement: ✅ existing / ⚠️ TODO blocked / ❌ NEW confirm)
83
95
  /review-code ─────────────→ Report: Critical / Major / Minor → fix CRITICAL/MAJOR
84
96
 
@@ -90,10 +102,13 @@ Phase 5 (cont): Dev Self-Check (dev verifies their OWN code — NOT the officia
90
102
 
91
103
  Phase 5b: QC Automation (the OFFICIAL QC suite — see below)
92
104
 
93
- Phase 6: Tester Feedback (QA → PO/Dev, closes the loop)
94
- /report-bug {UC-ID} ──────→ {spec}/feedback/bug-reports/{BUG-ID}.md commit+push
95
- /propose-scenario {UC-ID} → {spec}/feedback/bdd-proposals/{...}.md commit+push
96
- PO/Dev: /sync "📥 New tester feedback" → /fix-bug · add to BDD · update PRD
105
+ Phase 6: Tester / QC Feedback (QA/QC → PO/Dev, closes the loop)
106
+ /report-bug {UC-ID} ──────→ {spec}/feedback/bug-reports/{BUG-ID}.md (State: Open) → push
107
+ /propose-scenario {UC-ID} → behavior ∈ AC → {spec}/feedback/bdd-proposals/{...}.md → push
108
+ behavior MỚI {spec}/feedback/prd-change-requests/{...}.md push
109
+ QC nguồn: /qc-run-test FAIL & /qc-analyze DOC_GAPS cũng route vào đây
110
+ PO/Dev: /sync → "📥 State: Open" → /fix-bug {BUG-ID} (Open→Fixed) · add BDD · update PRD
111
+ QC: /qc-run-test re-verify pass → bug Closed (qc_owner/qc_blocked_by clear)
97
112
 
98
113
  Cross-cutting (any role, anytime)
99
114
  /sync ────────────────────→ git pull + submodules + Living Docs + surface feedback
@@ -117,8 +132,18 @@ BDD approved (specs/bdd/*.feature)
117
132
  /qc-analyze → /qc-plan → /qc-design-test → /qc-review → /qc-run-test → /qc-report
118
133
  (đọc UC/SC, phân tích) chạy test → set qc_status
119
134
  ▼ ▼
120
- QC test cases / scripts .trace/*.tsv: qc_status
121
- (skills/qc/<stage>/ guides) (pass/fail/skip/not_run)
135
+ QC analysis + test cases .trace/*.tsv: qc_status
136
+ → {qc_dir}/{UC-ID}/ (visible, mặc định docs/) (pass/fail/skip/not_run)
137
+ REQUIREMENT_ANALYSIS.md · DOC_GAPS.md · + qc_owner / qc_blocked_by
138
+ TEST_PLAN.md · test-cases/*.Test.md (skills load từ {qc_skills_dir})
139
+
140
+ ── Feedback loop về spec (đóng vòng) ───────────────────────────────────
141
+ /qc-analyze DOC_GAPS blocker (spec sai/mơ hồ) ┐
142
+ /qc-run-test FAIL = product-gap ├─▶ /report-bug · /propose-scenario
143
+ /qc-report tổng hợp gap → in sẵn lệnh ┘ │ (cùng flow tester)
144
+
145
+ feedback/ trong spec repo (State: Open)
146
+ → commit+push → PO/Dev thấy qua /sync (xem bug-flow.md)
122
147
 
123
148
  Mapping: mỗi QC test → scenario qua @trace.verifies={UC-ID}-SC{N}
124
149
  ```
@@ -171,7 +196,7 @@ Load toàn bộ project context vào working memory theo thứ tự ưu tiên ng
171
196
  | Step | Priority | What loads |
172
197
  |------|----------|-----------|
173
198
  | 1 | PROJECT-CONFIG | `project-context.yaml` → stack, conventions, domains, services, paths |
174
- | 1.5 | SERVICE ROUTING | *(umbrella only)* detect active domain, route `specs_dir`/`tech_docs_dir` tới service submodule, store `service_root` |
199
+ | 1.5 | SERVICE ROUTING | *(umbrella only)* detect active domain, route `trace_dir` (+ code) tới 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 |
175
200
  | 1.6 | SERVICE CONVENTIONS | *(umbrella only)* load `{service_root}/.agent/project-context.yaml` → override `test_command`, `build_command`, `paths.trace_dir` |
176
201
  | 2 | PROJECT-CONFIG | `.agent/modules/{module}/stack-profile.yaml` → layer patterns |
177
202
  | 3 | **CRITICAL** | `CLAUDE.md` → architecture layers, coding standards, naming |
@@ -22,12 +22,12 @@ Mỗi artifact mang `@trace.*` metadata liên kết về artifact trước nó:
22
22
 
23
23
  ```
24
24
  product-definition.md
25
- └─► PRD.md (Service, Module trong metadata; @trace.domain, @trace.status)
26
- └─► {UC-ID}.feature (@trace.service, @trace.module, @trace.prd_version)
27
- └─► tech-design.md (@trace.bdd_version)
28
- └─► src/ code (@trace.implements, @trace.prd_version, @trace.bdd_version)
25
+ └─► PRD.md (@trace.domain, @trace.status; Service/Module trong metadata)
26
+ └─► specs/bdd/{domain}/{web|app|system}/{UC-ID}.feature (@trace.prd_version, @trace.module)
27
+ └─► specs/tech-docs/{domain}/{UC-ID}-tech-design*.md (@trace.bdd_version)
28
+ └─► src/ code — service submodule (@trace.implements)
29
29
  └─► src/test/ (@trace.verifies, @trace.service)
30
- └─► .trace/{UC-ID}.tsv (drift tracking)
30
+ ════► {spec_source}/.trace/{UC-ID}.tsv — TSV authoritative ở SPEC repo (coverage/drift)
31
31
  ```
32
32
 
33
33
  **Các trace field quan trọng:**
@@ -62,7 +62,7 @@ Ví dụ tags trong `.feature`, code, và test:
62
62
 
63
63
  ## Trace TSV — coverage & drift
64
64
 
65
- `.trace/{UC-ID}.tsv` là nguồn sự thật per-scenario về trạng thái implement/test. Được **ghi** bởi `/generate-bdd`, `/generate-code`, `/dev-gen-test`, `/qc-run-test`, và **update** bởi `/validate-traces`. File `.trace/*.tsv` authoritative **được commit** trong chính service submodule (không phải mirror).
65
+ `.trace/{UC-ID}.tsv` là nguồn sự thật per-scenario về trạng thái implement/test. Được **ghi** bởi `/generate-bdd`, `/generate-code`, `/dev-gen-test`, `/qc-run-test`, và **update** bởi `/validate-traces`. Khi `spec_source` set, file `.trace/*.tsv` authoritative **được commit ở một chỗ** trong spec repo (`{spec_source}/.trace/`) — một nơi cho PM quản lý; mỗi scenario mang `@trace.service`. (Không `spec_source` → `.trace` per-service.)
66
66
 
67
67
  Status coverage per scenario:
68
68
 
@@ -103,28 +103,29 @@ Living Docs (VS Code panel) đọc trace TSV và hiển thị traceability healt
103
103
  └──────────────────────────────────────────────────────────────────┘
104
104
  ```
105
105
 
106
- - Drill down: PRD → UC → per-scenario table (Spec ver, Gen ver, Code, Tests, **Dev Self-Check**, **QC Status**, Status)
106
+ - Drill down: PRD → UC → per-scenario table (Spec ver, Gen ver, Code, Tests, **Dev Self-Check**, **QC Status**, **Waiting on**, Status)
107
+ - **Waiting on** (cột `qc_owner` + `qc_blocked_by`): cho PO/PM thấy case chưa pass đang **chờ dev** (product-gap → `BUG-{id}`) hay **chờ PO** confirm/clarify (spec gap → `GAP-{id}`). Aggregates `waiting_dev` / `waiting_po` ở header dashboard.
107
108
  - Status badges: ✅ OK · ⚠️ DRIFT · 🔴 GAP · — UNTRACKED · filter theo domain/PRD status/doc status · search theo UC/SC ID.
108
109
 
109
110
  **Ba nơi chứa trace data — phân biệt authoritative vs mirror:**
110
111
 
111
112
  | Vị trí | Vai trò | Commit? |
112
113
  |--------|---------|---------|
113
- | `{service}/.trace/*.tsv` | **Authoritative** — nguồn sự thật per-service | ✅ Committed trong service submodule |
114
- | `{spec_source}/.living-docs/` (`trace-report.json` + TSV mirror namespaced) | **Canonical report** — tổng hợp cross-team, regenerate bởi `/sync` hoặc `/validate-traces` | ❌ Gitignored |
115
- | `./.trace` của workspace hiện tại | **Panel mirror** — giữ Living Docs panel không trống kể cả khi mở Claude Code/VS Code bên trong một service submodule đơn lẻ | ❌ Gitignored |
114
+ | `{spec_source}/.trace/*.tsv` | **Authoritative** — nguồn sự thật, một chỗ cho cả team/PM (mỗi row mang `@trace.service`) | ✅ Committed trong spec repo |
115
+ | `{spec_source}/.living-docs/trace-report.json` | **Report** — dashboard tổng hợp, regenerate bởi `/sync` hoặc `/validate-traces` | ❌ Gitignored |
116
+ | `./.trace` của workspace hiện tại | **Panel mirror** — giữ Living Docs panel không trống khi mở Claude Code/VS Code một repo không phải spec repo | ❌ Gitignored |
116
117
 
117
- **Vì sao canonical nằm ở spec module?** Spec module được mount vào mọi umbrella/service workspace, nên là nơi chung luôn resolve được cho cross-team dashboard. Vấn đề trước đây: panel mở umbrella root (hoặc một service submodule đơn lẻ) sẽ TRỐNG nếu không mirror TSV authoritative nằm rải rác trong từng service submodule. Panel mirror `./.trace` giải quyết case mở single service.
118
+ **Vì sao authoritative + report nằm ở spec module?** Spec module được mount vào mọi umbrella/service workspace, nên là nơi chung luôn resolve được cho cross-team dashboard, **một chỗ duy nhất** để PM/PO quản trạng thái. Code-side commands (`/generate-code`, `/dev-run-test`, `/qc-run-test`) chạy trong service nhưng ghi trace cross-repo vào đây (giống `feedback/`). Panel mirror `./.trace` chỉ để panel không trống khi mở một repo lẻ.
118
119
 
119
- Thêm vào `.gitignore` (cả haimirror read-only, không commit):
120
+ Thêm vào `.gitignore` (report + mirror là read-only generated, không commit; `.trace/*.tsv` thì commit trong spec repo):
120
121
  ```
121
122
  # spec module
122
123
  .living-docs/
123
- # workspace / umbrella root (mirror)
124
+ # workspace không phải spec repo (panel mirror)
124
125
  .trace/
125
126
  ```
126
127
 
127
- > **Prerequisite cho data chính xác:** mỗi service submodule cần `.agent/project-context.yaml` với `paths.trace_dir` configure đúng. Thiếu → framework không biết ghi trace TSV về đâu panel thiếu data.
128
+ > **Prerequisite cho data chính xác:** umbrella cần `setup.spec_source` trỏ đúng spec submodule → framework ghi mọi trace TSV vào `{spec_source}/.trace`. (Chế độ không có `spec_source` mới cần `paths.trace_dir` per-service.)
128
129
 
129
130
  ---
130
131
 
@@ -134,10 +135,10 @@ Chạy `/validate-traces {domain}` bất cứ lúc nào (đặc biệt **sau m
134
135
 
135
136
  ```
136
137
  /validate-traces {domain}
137
- → Reads .trace/*.tsv authoritative (committed) trong từng service:
138
- user-service/.trace/, order-service/.trace/, ...
139
- → Writes canonical trace-report.json + TSV mirror → {spec_source}/.living-docs/ (gitignored)
140
- → Writes panel mirror → ./.trace của workspace hiện tại (non-empty khi mở single service)
138
+ → Reads .trace/*.tsv authoritative (committed) từ MỘT chỗ: {spec_source}/.trace/
139
+ (mỗi scenario mang @trace.service — không cần quét/merge từng service)
140
+ → Writes trace-report.json → {spec_source}/.living-docs/ (generated, gitignored)
141
+ → Writes panel mirror → ./.trace của workspace hiện tại (non-empty khi mở repo lẻ)
141
142
  → Living Docs panel cập nhật ngay
142
143
  ```
143
144
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  > Vận hành hằng ngày với framework: đồng bộ nội dung & nâng cấp framework, quy trình xử lý bug, và publish package lên npm.
6
6
 
7
- Mục này dành cho cả team (PO · Dev · Tester · QC) và người maintain framework.
7
+ Mục này dành cho cả team (PO · Dev · QC/Tester) và người maintain framework.
8
8
 
9
9
  ---
10
10
 
@@ -1,8 +1,10 @@
1
1
  [📚 Docs](../README.md) › [Operations](README.md) › Bug Flow
2
2
 
3
- # Bug Flow — PO · Dev · Tester
3
+ # Bug Flow — PO · Dev · QC/Tester
4
4
 
5
- > Cách **PO, Dev, và Tester phối hợp** khi phát hiện bug. Mọi bug đều được trace về spec layer để fix đúng chỗ và tránh lặp lại.
5
+ > Cách **PO, Dev, và QC/Tester phối hợp** khi phát hiện bug. Mọi bug đều được trace về spec layer để fix đúng chỗ và tránh lặp lại.
6
+
7
+ > **QC cũng là nguồn bug.** Pipeline `/qc-*` đẩy vào **cùng** flow này: `/qc-run-test` FAIL = `product-gap` → `/report-bug {UC-ID}`; `/qc-analyze` `DOC_GAPS` blocker (spec sai/mơ hồ) → `/report-bug` (Case 2/3) hoặc thiếu coverage → `/propose-scenario`. Cùng phân loại Case 1–6 bên dưới. Chi tiết: [chương QC Automation](../02-guides/tester/qc-automation.md#khi-qc-tìm-thấy-bug--spec-gap--đẩy-lên-specs).
6
8
 
7
9
  ---
8
10
 
@@ -242,6 +244,40 @@ DevOps → check infra, env vars, deploy artifacts
242
244
 
243
245
  ## 9. Giao tiếp hiệu quả — các format thông báo
244
246
 
247
+ ### Git flow của feedback loop (2 repo, 1 vòng)
248
+
249
+ Mọi feedback đi qua **git**, không qua chat: file được ghi vào spec repo, commit+push, rồi PO/Dev kéo về bằng `/sync`. Đây là đường đi đầy đủ — từ lúc QC/Tester phát hiện tới lúc bug `Closed`:
250
+
251
+ ```
252
+ QC / Tester SPEC REPO (PO sở hữu) SERVICE SUBMODULE (Dev sở hữu)
253
+ ───────────── ───────────────────── ──────────────────────────────
254
+ /report-bug read-only
255
+ /propose-scenario specs/code
256
+ (QC: /qc-run-test FAIL,
257
+ /qc-analyze DOC_GAPS)
258
+ │ ghi file ──────────────▶ feedback/bug-reports/*.md (KHÔNG sửa specs/code trực tiếp)
259
+ feedback/bdd-proposals/*.md
260
+ feedback/prd-change-requests/*.md
261
+ State: Open
262
+ │ git commit + push (tầng spec repo)
263
+
264
+ origin(spec) ──── /sync (PO/Dev pull) ────┐
265
+
266
+ ┌──────────────── phân loại (Case 1–6) ───────────────┐
267
+ ▼ ▼
268
+ PRD/BDD gap → PO sửa PRD + bump Code bug → Dev /fix-bug {BUG-ID}
269
+ → commit+push spec repo → set State: Fixed
270
+ → /generate-bdd lại → commit+push service (tầng 1)
271
+ │ + umbrella pointer (tầng 2)
272
+ └───────────────────┬──────────────────┘
273
+
274
+ QC /qc-run-test re-verify ──── pass ──▶ State: Closed
275
+ (qc_owner / qc_blocked_by tự clear)
276
+ ```
277
+
278
+ - **2 tầng push** chỉ áp dụng phía service submodule (xem [Sync & Update §4.4](sync-and-update.md#44--commit-2-tầng-thay-đổi-trong-service-submodule)); feedback file nằm trong **spec repo** nên chỉ cần push 1 tầng ở đó.
279
+ - `/sync` chỉ surface bug `State: Open`; `Fixed`/`Closed` để riêng (xem [§10](#10-checklist-đóng-bug)).
280
+
245
281
  ### Bug report (Tester → Dev)
246
282
 
247
283
  Tester chạy `/report-bug {UC-ID} {mô tả}` → tự sinh report theo format dưới (gồm phân loại layer + phát hiện coverage gap), commit+push vào **spec repo** `feedback/bug-reports/{BUG-ID}.md`. PO/Dev thấy khi chạy `/sync` (dòng `📥 New tester feedback`):
@@ -306,11 +342,16 @@ Trước khi đánh "Resolved":
306
342
  - [ ] Nếu root cause là lỗi AI gen hay lặp → đã `/learn` (hoặc accept prompt khi `/fix-bug`)
307
343
  - [ ] Notify tester với đầy đủ thông tin re-test
308
344
 
309
- **Tester:**
310
- - [ ] Re-test đúng scenario được chỉ định
345
+ **Tester / QC:**
346
+ - [ ] Re-test đúng scenario được chỉ định (QC: `/qc-run-test {UC-ID}` lại → `qc_status` flip `fail → pass`)
311
347
  - [ ] Kiểm tra regression: các AC khác của cùng PRD không bị ảnh hưởng
312
348
  - [ ] Confirm PASS trước khi close
313
349
 
350
+ **Vòng đời bug report (đừng để `feedback/` phình mãi):**
351
+ - [ ] `State` của `feedback/bug-reports/{BUG-ID}.md`: `🟢 Open` → `🟡 Fixed` (set bởi `/fix-bug {BUG-ID}`) → `🟢 Closed` (sau khi `/qc-run-test` re-verify pass).
352
+ - [ ] Khi `Closed`: `/qc-run-test` clear `qc_owner`/`qc_blocked_by` của SC (tự động khi `qc_status=pass`); tuỳ chọn move file sang `feedback/bug-reports/archive/`.
353
+ - [ ] `/sync` chỉ surface bug `State: Open` là "đang chờ" — Fixed/Closed không làm nhiễu PO/PM.
354
+
314
355
  **PO** *(nếu PRD được cập nhật)*:
315
356
  - [ ] PRD version mới đã được bump
316
357
  - [ ] Changelog có entry cho thay đổi
@@ -318,4 +359,4 @@ Trước khi đánh "Resolved":
318
359
 
319
360
  ---
320
361
 
321
- *Xem thêm:* [Sync & Update](sync-and-update.md) · [Guide · Tester](../02-guides/tester/README.md) · [Guide · QC Automation](../02-guides/qc-automation.md).
362
+ *Xem thêm:* [Sync & Update](sync-and-update.md) · [Guide · Tester](../02-guides/tester/README.md) · [chương QC Automation](../02-guides/tester/qc-automation.md).