@anhth2/spec-driven-dev-plugin 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/commands/debug.md +42 -7
  2. package/commands/define-product.md +42 -7
  3. package/commands/dev-gen-test.md +60 -17
  4. package/commands/dev-run-test.md +61 -18
  5. package/commands/dev-run-test.tmpl +1 -1
  6. package/commands/dev-smoke-test.md +42 -7
  7. package/commands/fix-bug.md +42 -7
  8. package/commands/generate-bdd.md +67 -21
  9. package/commands/generate-bdd.tmpl +7 -4
  10. package/commands/generate-code.md +113 -35
  11. package/commands/generate-code.tmpl +53 -18
  12. package/commands/generate-design-spec.md +42 -7
  13. package/commands/generate-prd.md +42 -7
  14. package/commands/generate-spec-manifest.md +42 -7
  15. package/commands/generate-tech-docs.md +229 -20
  16. package/commands/generate-tech-docs.tmpl +187 -13
  17. package/commands/learn.md +42 -7
  18. package/commands/map-testids.md +564 -0
  19. package/commands/map-testids.tmpl +81 -0
  20. package/commands/propose-scenario.md +42 -7
  21. package/commands/qc-analyze.md +42 -7
  22. package/commands/qc-design-test.md +44 -8
  23. package/commands/qc-design-test.tmpl +2 -1
  24. package/commands/qc-plan.md +42 -7
  25. package/commands/qc-report.md +42 -7
  26. package/commands/qc-review.md +42 -7
  27. package/commands/qc-run-test.md +62 -18
  28. package/commands/qc-run-test.tmpl +2 -1
  29. package/commands/refine-prd.md +42 -7
  30. package/commands/report-bug.md +42 -7
  31. package/commands/review-code.md +42 -7
  32. package/commands/review-context.md +42 -7
  33. package/commands/review-tech-docs.md +45 -9
  34. package/commands/review-tech-docs.tmpl +3 -2
  35. package/commands/setup-ai-first.md +37 -4
  36. package/commands/setup-ai-first.tmpl +2 -2
  37. package/commands/sync.md +35 -2
  38. package/commands/update-framework.md +35 -2
  39. package/commands/validate-traces.md +85 -40
  40. package/commands/validate-traces.tmpl +43 -33
  41. package/core/FRAMEWORK_VERSION +1 -1
  42. package/core/commands/debug.md +42 -7
  43. package/core/commands/define-product.md +42 -7
  44. package/core/commands/dev-gen-test.md +60 -17
  45. package/core/commands/dev-run-test.md +61 -18
  46. package/core/commands/dev-smoke-test.md +42 -7
  47. package/core/commands/fix-bug.md +42 -7
  48. package/core/commands/generate-bdd.md +67 -21
  49. package/core/commands/generate-code.md +113 -35
  50. package/core/commands/generate-design-spec.md +42 -7
  51. package/core/commands/generate-prd.md +42 -7
  52. package/core/commands/generate-spec-manifest.md +42 -7
  53. package/core/commands/generate-tech-docs.md +229 -20
  54. package/core/commands/learn.md +42 -7
  55. package/core/commands/map-testids.md +564 -0
  56. package/core/commands/propose-scenario.md +42 -7
  57. package/core/commands/qc-analyze.md +42 -7
  58. package/core/commands/qc-design-test.md +44 -8
  59. package/core/commands/qc-plan.md +42 -7
  60. package/core/commands/qc-report.md +42 -7
  61. package/core/commands/qc-review.md +42 -7
  62. package/core/commands/qc-run-test.md +62 -18
  63. package/core/commands/refine-prd.md +42 -7
  64. package/core/commands/report-bug.md +42 -7
  65. package/core/commands/review-code.md +42 -7
  66. package/core/commands/review-context.md +42 -7
  67. package/core/commands/review-tech-docs.md +45 -9
  68. package/core/commands/setup-ai-first.md +37 -4
  69. package/core/commands/sync.md +35 -2
  70. package/core/commands/update-framework.md +35 -2
  71. package/core/commands/validate-traces.md +85 -40
  72. package/core/modules/qc-playwright/stack-profile.yaml +1 -0
  73. package/core/skills/code/SKILL.md +77 -9
  74. package/core/skills/debug/SKILL.md +112 -11
  75. package/core/skills/design-spec/SKILL.md +42 -7
  76. package/core/skills/discovery/SKILL.md +42 -7
  77. package/core/skills/prd/SKILL.md +70 -4
  78. package/core/skills/setup-ai-first/SKILL.md +35 -2
  79. package/core/skills/spec/SKILL.md +70 -4
  80. package/core/skills/test/SKILL.md +119 -16
  81. package/core/steps/context-loader.md +7 -5
  82. package/core/steps/report-footer.md +35 -2
  83. package/core/steps/trace-mirror.md +18 -10
  84. package/core/templates/project-context.yaml +8 -5
  85. package/docs/01-getting-started/core-concepts.md +7 -7
  86. package/docs/01-getting-started/installation.md +2 -2
  87. package/docs/01-getting-started/quickstart.md +1 -1
  88. package/docs/02-guides/README.md +1 -2
  89. package/docs/02-guides/developer/README.md +1 -1
  90. package/docs/02-guides/developer/bdd-and-trace.md +10 -8
  91. package/docs/02-guides/developer/commands.md +3 -3
  92. package/docs/02-guides/developer/scenarios.md +26 -14
  93. package/docs/02-guides/developer/workflow.md +80 -20
  94. package/docs/02-guides/product-owner/README.md +6 -4
  95. package/docs/02-guides/product-owner/commands.md +1 -1
  96. package/docs/02-guides/product-owner/scenarios.md +80 -1
  97. package/docs/02-guides/tester/README.md +12 -11
  98. package/docs/02-guides/tester/bug-reporting.md +1 -1
  99. package/docs/02-guides/{qc-automation.md → tester/qc-automation.md} +14 -6
  100. package/docs/02-guides/tester/reading-specs.md +4 -4
  101. package/docs/02-guides/tester/scenarios.md +5 -5
  102. package/docs/02-guides/tester/spec-manifest.md +17 -12
  103. package/docs/02-guides/tester/test-checklist.md +3 -3
  104. package/docs/02-guides/tester/workflow.md +8 -11
  105. package/docs/03-concepts/architecture.md +5 -4
  106. package/docs/03-concepts/pipeline.md +18 -6
  107. package/docs/03-concepts/traceability.md +17 -17
  108. package/docs/04-operations/README.md +1 -1
  109. package/docs/04-operations/bug-flow.md +4 -4
  110. package/docs/04-operations/sync-and-update.md +163 -38
  111. package/docs/05-reference/README.md +3 -0
  112. package/docs/05-reference/command-cheatsheet.md +147 -0
  113. package/docs/05-reference/commands.md +72 -69
  114. package/docs/05-reference/modules.md +2 -2
  115. package/docs/05-reference/trace-schema.md +15 -14
  116. package/docs/README.md +3 -5
  117. package/modules/qc-playwright/stack-profile.yaml +1 -0
  118. package/package.json +1 -1
  119. package/skills/code/SKILL.md +77 -9
  120. package/skills/debug/SKILL.md +112 -11
  121. package/skills/design-spec/SKILL.md +42 -7
  122. package/skills/discovery/SKILL.md +42 -7
  123. package/skills/prd/SKILL.md +70 -4
  124. package/skills/setup-ai-first/SKILL.md +35 -2
  125. package/skills/spec/SKILL.md +70 -4
  126. package/skills/test/SKILL.md +119 -16
  127. package/steps/context-loader.md +7 -5
  128. package/steps/report-footer.md +35 -2
  129. package/steps/trace-mirror.md +18 -10
  130. package/templates/project-context.yaml +8 -5
@@ -14,18 +14,19 @@ Tài liệu dành cho **QA / Tester** — cách kết nối với spec framework
14
14
  | [Tình huống thực tế](scenarios.md) | 6 scenario: feature mới, PRD thay đổi, multi-service, regression, ... |
15
15
  | [Báo cáo bug](bug-reporting.md) | `/report-bug` · `/propose-scenario` · template báo cáo |
16
16
  | [Checklist test pass](test-checklist.md) | Checklist trước khi báo "test pass" |
17
+ | [QC Automation](qc-automation.md) | Deep-dive pipeline `/qc-*` 6 bước · stack `qc-playwright` · `qc_status` → Living Docs |
17
18
 
18
19
  ## Vai Trò Tester Trong Framework
19
20
 
20
21
  ```
21
- PO/BA Dev Tester
22
- ────────── ────────────────── ──────────────────────────
23
- PRD BDD (từ PRD) /sync + /generate-spec-manifest
24
- Tech Docs Đọc PRD + BDD + Tech Docs
25
- Code Viết test cases · Chạy test
26
- /report-bug (bug spec-traced)
27
- /propose-scenario (edge case → BDD draft)
28
- └──────────────┴───── feedback/ trong spec repo ◄────┘
22
+ PO/BA Dev Tester / QA
23
+ ───────────────── ─────────────────── ──────────────────────────
24
+ PRD (đọc BDD KHÔNG gen) /sync + /generate-spec-manifest
25
+ BDD web→app→system Tech Docs Đọc PRD + BDD + Tech Docs
26
+ Design Spec Code Viết test cases · chạy /qc-*
27
+ /report-bug · /propose-scenario
28
+ (bug / edge case → spec repo)
29
+ └─────────────────────┴──── feedback/ trong spec repo ◄────┘
29
30
  PO/Dev thấy qua /sync (📥) → fix / promote / update PRD
30
31
  ```
31
32
 
@@ -63,12 +64,12 @@ PRD BDD (từ PRD) /sync + /generate-spec-manifest
63
64
  | `/qc-run-test` | Chạy automation test → ghi `qc_status` per scenario vào trace TSV | Bước 5 |
64
65
  | `/qc-report` | Tổng hợp kết quả thành QC report | Bước 6 |
65
66
 
66
- Đây là **bộ test chính thức (authoritative) của QC**, chạy ngay trong framework. Pipeline dùng stack module `qc-playwright` (Python + pytest-playwright + Page Object). Xem chi tiết flow tại **[QC Automation guide](../qc-automation.md)**.
67
+ Đây là **bộ test chính thức (authoritative) của QC**, chạy ngay trong framework. Pipeline dùng stack module `qc-playwright` (Python + pytest-playwright + Page Object). Xem chi tiết flow tại **chương [QC Automation](qc-automation.md)** (một phần của guide Tester / QA này).
67
68
 
68
- > **Artifact ra đâu:** `/qc-analyze` ghi **2 file** (`REQUIREMENT_ANALYSIS.md` + `DOC_GAPS.md`), `/qc-plan` → `TEST_PLAN.md`, `/qc-design-test` → `test-cases/*.Test.md` — tất cả trong `{qc_dir}/{UC-ID}/` (mặc định `docs/`, **visible**, không phải `.agent/` ẩn). Skill QC nạp từ `paths.qc_skills_dir` — trỏ được tới repo QC để skill **không bị `/update-framework` ghi đè**. Chi tiết: [QC Automation guide](../qc-automation.md#skill-sourcing--upgrade-safety).
69
+ > **Artifact ra đâu:** `/qc-analyze` ghi **2 file** (`REQUIREMENT_ANALYSIS.md` + `DOC_GAPS.md`), `/qc-plan` → `TEST_PLAN.md`, `/qc-design-test` → `test-cases/*.Test.md` — tất cả trong `{qc_dir}/{UC-ID}/` (mặc định `docs/`, **visible**, không phải `.agent/` ẩn). Skill QC nạp từ `paths.qc_skills_dir` — trỏ được tới repo QC để skill **không bị `/update-framework` ghi đè**. Chi tiết: [QC Automation guide](qc-automation.md#skill-sourcing--upgrade-safety).
69
70
 
70
71
  > **Phân biệt với test commands của Dev:** `/dev-gen-test`, `/dev-run-test`, `/dev-smoke-test` là **dev tự kiểm tra code của mình** — phát tín hiệu `dev_selftest`, KHÔNG phải bộ test chính thức. Bộ test authoritative của QC là pipeline `/qc-*` (sinh ra `qc_status`). Hai luồng tách biệt.
71
72
 
72
73
  ---
73
74
 
74
- *Xem thêm:* [Developer Guide](../developer/README.md) · [QC Automation Guide](../qc-automation.md) · [Operations › Bug Flow](../../04-operations/bug-flow.md) · [Reference › Commands](../../05-reference/commands.md)
75
+ *Xem thêm:* [Developer Guide](../developer/README.md) · [Chương QC Automation](qc-automation.md) · [Operations › Bug Flow](../../04-operations/bug-flow.md) · [Reference › Commands](../../05-reference/commands.md)
@@ -78,7 +78,7 @@ Severity : Major
78
78
 
79
79
  Spec context:
80
80
  PRD : specs/prd/auth/FT-001-login.md (v1.0)
81
- BDD : free-trial-be/specs/bdd/auth/FT-001-login.feature
81
+ BDD : free-trial-specs/specs/bdd/auth/system/FT-001-login.feature
82
82
  → Scenario: "Lock account after 5 failed attempts"
83
83
  Tech Doc : free-trial-specs/specs/tech-docs/auth/FT-001-auth-api.md
84
84
 
@@ -1,7 +1,9 @@
1
- [📚 Docs](../README.md) › [Guides](README.md) › QC Automation
1
+ [📚 Docs](../../README.md) › [Guides](../README.md) › [Tester](README.md) › QC Automation
2
2
 
3
3
  # Hướng Dẫn QC Automation — Spec-Driven Dev
4
4
 
5
+ > Đây là **một chương của [guide Tester / QA](README.md)** — QC và Tester là **cùng một role**. Chương này đi sâu vào pipeline QC tự động (`/qc-*`); phần vai trò chung, spec-manifest, `/report-bug`, `/propose-scenario`… ở [README của guide](README.md).
6
+
5
7
  Pipeline QC automation **chính thức** của framework — được port từ agent của team QC (reference repo `ai-automation-qc-base`) vào ngay trong framework. Nó sinh và chạy automation **Playwright/pytest** từ BDD `.feature` chính thức, rồi ghi tín hiệu **`qc_status`** (authoritative) vào trace TSV → Living Docs.
6
8
 
7
9
  ## Mục Lục
@@ -59,6 +61,12 @@ này độc lập với module implementation của dev (java-spring, react, flu
59
61
  Per-layer guides chi tiết nằm trong `skills/qc/<stage>/` (port từ skills của agent QC):
60
62
  functional / integration / e2e / non-functional / exploratory.
61
63
 
64
+ ### Test-ID contract — locate element không cần scan
65
+
66
+ Để QC **không** phải dò/giả lập vị trí element lúc runtime (chậm), FE tech-design có section **§2b Test Selectors**: mỗi element **có action** được gán test-id ổn định (`{uc}-{screen}-{element}-{type}`, vd `ft001-login-submit-btn`). `/generate-code` emit đúng id đó theo attribute platform (web `data-testid` · RN `testID` · Flutter `Key`/`Semantics` · iOS `accessibilityIdentifier`); `/qc-design-test` cite test-id trong step; `/qc-run-test` build Page Object locator **thẳng từ map** (ưu tiên trong locator priority `data-testid → role → …`). Element có action mà chưa có test-id trong §2b → QC **fallback** role/text (chậm hơn) và nên bổ sung vào tech-design. Xem [Trace Schema](../../05-reference/trace-schema.md) và FE tech-design (`/generate-tech-docs`).
67
+
68
+ > **Component reuse / code có sẵn:** `/generate-tech-docs` + `/generate-code` chỉ gán id cho code **mới**. Với component dùng chung (id ở usage site, component phải *forward* test-id) hoặc màn hình **brownfield** đã viết tay → chạy **`/map-testids {UC-ID}`**: reverse-document id đang có, gán id còn thiếu, patch forwarding + ghi vào `figma-components/{module}.md` (section *Test-ID Forwarding*), điền §2b. Nhờ vậy QC vẫn locate-by-id không cần scan.
69
+
62
70
  ## Trace Join: qc_status Đến Living Docs Như Thế Nào
63
71
 
64
72
  1. `.feature` chính thức định nghĩa scenario là `@trace.scenario={UC-ID}-SC{N}`.
@@ -117,7 +125,7 @@ ghi `feedback/bdd-proposals/`. PO/Dev thấy khi `/sync`, rồi BUG_FLOW định
117
125
 
118
126
  > QC chỉ **đọc** spec (từ submodule PO) — mọi thay đổi PRD/BDD là việc của PO/Dev. QC đẩy *tín hiệu*
119
127
  > (bug / proposal / gap), không tự sửa canonical spec. `/qc-report` ở cuối pipeline **in sẵn** danh
120
- > sách lệnh `/report-bug` cho từng product-gap để QC chạy. Chi tiết flow bug: [Operations · Bug Flow](../04-operations/bug-flow.md).
128
+ > sách lệnh `/report-bug` cho từng product-gap để QC chạy. Chi tiết flow bug: [Operations · Bug Flow](../../04-operations/bug-flow.md).
121
129
 
122
130
  ## Skill Sourcing & Upgrade-Safety
123
131
 
@@ -151,7 +159,7 @@ không nuốt mất skill đang hoàn thiện, và QC update skill 1 chỗ (repo
151
159
 
152
160
  ## Xem Thêm
153
161
 
154
- - [Guide › Tester](tester/README.md) — vai trò tester, spec-manifest, `/report-bug`, `/propose-scenario`
155
- - [Concepts › Traceability](../03-concepts/traceability.md) — trace TSV, dev_selftest vs qc_status
156
- - [Reference › Modules](../05-reference/modules.md) — chi tiết module `qc-playwright`
157
- - [Reference › Commands](../05-reference/commands.md) — danh mục đầy đủ mọi command
162
+ - [Guide › Tester](README.md) — vai trò tester, spec-manifest, `/report-bug`, `/propose-scenario`
163
+ - [Concepts › Traceability](../../03-concepts/traceability.md) — trace TSV, dev_selftest vs qc_status
164
+ - [Reference › Modules](../../05-reference/modules.md) — chi tiết module `qc-playwright`
165
+ - [Reference › Commands](../../05-reference/commands.md) — danh mục đầy đủ mọi command
@@ -20,8 +20,8 @@ Sau khi chạy `/generate-spec-manifest`, tra manifest để lấy paths:
20
20
  FT-001:
21
21
  prd: "my-project-specs/specs/prd/auth/FT-001-login.md"
22
22
  bdd:
23
- be: "free-trial-be/specs/bdd/auth/system/FT-001-UC1-login-system.feature"
24
- web: "free-trial-web/specs/bdd/auth/web/FT-001-UC1-login-web.feature"
23
+ be: "my-project-specs/specs/bdd/auth/system/FT-001-UC1-login-system.feature"
24
+ web: "my-project-specs/specs/bdd/auth/web/FT-001-UC1-login-web.feature"
25
25
  tech_docs:
26
26
  be: "my-project-specs/specs/tech-docs/auth/FT-001-auth-api.md"
27
27
  ```
@@ -37,8 +37,8 @@ AC3: Sai password 5 lần liên tiếp → khoá tài khoản 30 phút
37
37
  AC4: Tài khoản bị khoá → thông báo thời gian mở khoá
38
38
  ```
39
39
 
40
- **Bước 2: Đọc BDD System (cho BE)** tại `free-trial-be/specs/bdd/auth/system/FT-001-UC1-login-system.feature`
41
- *(nằm trong service submodule của BE — PO gen, chứa contract BE phải đáp ứng)*
40
+ **Bước 2: Đọc BDD System (cho BE)** tại `my-project-specs/specs/bdd/auth/system/FT-001-UC1-login-system.feature`
41
+ *(nằm trong spec submodule — PO gen, chứa contract BE phải đáp ứng; tất cả BDD web/app/system đều ở spec repo)*
42
42
 
43
43
  ```gherkin
44
44
  Scenario: Successful login
@@ -18,8 +18,8 @@ git pull && git submodule update --remote --recursive
18
18
  # status: approved ← ✅ có thể test
19
19
  # prd: "specs/prd/payment/FT-042-checkout.md"
20
20
  # bdd:
21
- # be: "free-trial-be/specs/bdd/payment/system/FT-042-UC1-checkout-system.feature"
22
- # web: "free-trial-web/specs/bdd/payment/web/FT-042-UC1-checkout-web.feature"
21
+ # be: "free-trial-specs/specs/bdd/payment/system/FT-042-UC1-checkout-system.feature"
22
+ # web: "free-trial-specs/specs/bdd/payment/web/FT-042-UC1-checkout-web.feature"
23
23
  ```
24
24
 
25
25
  **Test plan từ BDD BE (7 scenarios):**
@@ -156,9 +156,9 @@ FT-042:
156
156
  domain: payment
157
157
  status: approved
158
158
  bdd:
159
- be: "free-trial-be/specs/bdd/payment/system/FT-042-UC1-checkout-system.feature"
160
- web: "free-trial-web/specs/bdd/payment/web/FT-042-UC1-checkout-web.feature"
161
- app: "free-trial-app/specs/bdd/payment/app/FT-042-UC1-checkout-app.feature"
159
+ be: "free-trial-specs/specs/bdd/payment/system/FT-042-UC1-checkout-system.feature"
160
+ web: "free-trial-specs/specs/bdd/payment/web/FT-042-UC1-checkout-web.feature"
161
+ app: "free-trial-specs/specs/bdd/payment/app/FT-042-UC1-checkout-app.feature"
162
162
  ```
163
163
 
164
164
  **Test strategy:**
@@ -4,18 +4,23 @@
4
4
 
5
5
  ## Spec-Manifest Là Gì Và Tại Sao Cần
6
6
 
7
- Trong umbrella repo, spec files nằm rải rác ở nhiều submodule:
7
+ Trong umbrella repo (có `spec_source`), **mọi spec đều nằm trong spec submodule** — nhưng rải ở nhiều thư mục (`prd/`, `bdd/{platform}/`, `tech-docs/`) và nhiều domain:
8
8
 
9
9
  ```
10
- free-trial-spec/
11
- ├── specs/prd/auth/FT-001-login.md PRD (spec submodule)
12
- ├── specs/product-definition/auth/... ← PDD
13
- ├── free-trial-be/specs/bdd/... BDD của BE
14
- ├── free-trial-web/specs/bdd/... BDD của Web
15
- └── free-trial-app/specs/bdd/... ← BDD của App
10
+ free-trial-umbrella/ ← umbrella (Claude Code mở ở đây)
11
+ ├── free-trial-specs/ SPEC submodule — TẤT CẢ spec ở đây
12
+ │ └── specs/
13
+ ├── prd/auth/FT-001-login.md PRD
14
+ ├── design-spec/auth/... Design Spec
15
+ │ ├── bdd/auth/system/... ← BDD System (BE)
16
+ │ ├── bdd/auth/web/... ← BDD Web (FE)
17
+ │ ├── bdd/auth/app/... ← BDD App
18
+ │ └── tech-docs/auth/... ← Tech Docs (BE contract + FE design)
19
+ ├── free-trial-be/ (chỉ code) ← SERVICE submodule
20
+ └── free-trial-web/ (chỉ code) ← SERVICE submodule
16
21
  ```
17
22
 
18
- Tester's agent không biết layout này → cần một **index file** để tra cứu.
23
+ Tester's agent không biết domain nào / file nào ứng với TICKET-ID → cần một **index file** để tra cứu. *(Chỉ khi KHÔNG có `spec_source` thì BDD mới rải theo từng service submodule.)*
19
24
 
20
25
  `spec-manifest.yaml` là file được gen tự động, ánh xạ TICKET-ID → tất cả file liên quan:
21
26
 
@@ -30,8 +35,8 @@ features:
30
35
  be: "free-trial-specs/specs/tech-docs/auth/FT-001-UC1-auth-api.md"
31
36
  web: "free-trial-specs/specs/tech-docs/auth/FT-001-UC1-login-web.md"
32
37
  bdd:
33
- be: "free-trial-be/specs/bdd/auth/system/FT-001-UC1-login-system.feature"
34
- web: "free-trial-web/specs/bdd/auth/web/FT-001-UC1-login-web.feature"
38
+ be: "free-trial-specs/specs/bdd/auth/system/FT-001-UC1-login-system.feature"
39
+ web: "free-trial-specs/specs/bdd/auth/web/FT-001-UC1-login-web.feature"
35
40
  ```
36
41
 
37
42
  **Quan trọng:**
@@ -94,7 +99,7 @@ Khi làm việc với umbrella repo, VS Code Living Docs panel cần được đ
94
99
  # Chạy sau mỗi codegen session — hoặc khi cần refresh trạng thái coverage
95
100
  /sync # hoặc /validate-traces
96
101
 
97
- # → Đọc TSVs từ: user-service/.trace/, order-service/.trace/, ...
102
+ # → Đọc TSVs từ MỘT chỗ: {spec_source}/.trace/ (mỗi scenario mang @trace.service)
98
103
  # → Ghi canonical: {spec_source}/.living-docs/trace-report.json (+ TSV mirror)
99
104
  # → Ghi panel mirror: ./.trace (workspace hiện tại — panel luôn có data)
100
105
  # → Panel cập nhật ngay sau khi lệnh hoàn tất
@@ -117,7 +122,7 @@ Panel hiển thị trạng thái cross-service:
117
122
  >
118
123
  > **`qc_status`:** kết quả pipeline QC chính thức (`/qc-run-test`). Dashboard hiển thị hai cột cạnh nhau để phân biệt rõ hai luồng.
119
124
 
120
- > **Prerequisite:** Mỗi service submodule cần `.agent/project-context.yaml` với `paths.trace_dir`. Nếu thiếu → panel trống → báo Dev team.
125
+ > **Prerequisite:** umbrella cần `setup.spec_source` trỏ đúng spec submodule → trace TSV authoritative dồn về `{spec_source}/.trace/`. Nếu thiếu → panel trống → báo Dev team. (Chỉ chế độ không có `spec_source` mới cần `paths.trace_dir` per-service.)
121
126
 
122
127
  ---
123
128
 
@@ -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
 
@@ -48,24 +49,20 @@ Chạy QC automation pipeline (6 bước — ghi kết quả chính thức vào
48
49
  ├─ /qc-review {UC-ID} → review test design trước khi chạy
49
50
  ├─ /qc-run-test {UC-ID} → sinh + chạy pytest-playwright
50
51
  │ → ghi qc_status (pass/fail/skip) per scenario
51
- │ → vào {service}/.trace/{UC-ID}.tsv ← AUTHORITATIVE
52
+ │ → vào {spec_source}/.trace/{UC-ID}.tsv ← AUTHORITATIVE (spec repo)
52
53
  └─ /qc-report {UC-ID} → report pytest-html + Playwright trace evidence
53
54
  → reports/<feature>/report.html ← LOCAL, gitignored
54
55
 
55
56
 
56
- Commit TSV vào service submodule + update umbrella pointer
57
- cd {service}
57
+ Commit TSV vào spec repo (1 tầng trace dồn về specs, giống feedback/)
58
+ cd {spec_source}
58
59
  git add .trace/{UC-ID}.tsv
59
60
  git commit -m "qc: record qc_status for {UC-ID} — pass/fail"
60
- git push
61
- cd .. ← umbrella root
62
- git add {service}
63
- git commit -m "chore: update {service} submodule pointer — {UC-ID} qc_status"
64
61
  git push
65
62
 
66
63
 
67
64
  /validate-traces (hoặc /sync)
68
- 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
69
66
 
70
67
 
71
68
  Kết quả:
@@ -56,10 +56,11 @@ 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)
65
66
  → QC analysis / test-cases ghi vào {qc_dir}/{UC-ID}/ (mặc định docs/,
@@ -219,7 +220,7 @@ spec-driven-dev/
219
220
 
220
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.
221
222
 
222
- > **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).
223
224
 
224
225
  ---
225
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
 
@@ -184,7 +196,7 @@ Load toàn bộ project context vào working memory theo thứ tự ưu tiên ng
184
196
  | Step | Priority | What loads |
185
197
  |------|----------|-----------|
186
198
  | 1 | PROJECT-CONFIG | `project-context.yaml` → stack, conventions, domains, services, paths |
187
- | 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 |
188
200
  | 1.6 | SERVICE CONVENTIONS | *(umbrella only)* load `{service_root}/.agent/project-context.yaml` → override `test_command`, `build_command`, `paths.trace_dir` |
189
201
  | 2 | PROJECT-CONFIG | `.agent/modules/{module}/stack-profile.yaml` → layer patterns |
190
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
 
@@ -111,21 +111,21 @@ Living Docs (VS Code panel) đọc trace TSV và hiển thị traceability healt
111
111
 
112
112
  | Vị trí | Vai trò | Commit? |
113
113
  |--------|---------|---------|
114
- | `{service}/.trace/*.tsv` | **Authoritative** — nguồn sự thật per-service | ✅ Committed trong service submodule |
115
- | `{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 |
116
- | `./.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 |
117
117
 
118
- **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ẻ.
119
119
 
120
- 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):
121
121
  ```
122
122
  # spec module
123
123
  .living-docs/
124
- # workspace / umbrella root (mirror)
124
+ # workspace không phải spec repo (panel mirror)
125
125
  .trace/
126
126
  ```
127
127
 
128
- > **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.)
129
129
 
130
130
  ---
131
131
 
@@ -135,10 +135,10 @@ Chạy `/validate-traces {domain}` bất cứ lúc nào (đặc biệt **sau m
135
135
 
136
136
  ```
137
137
  /validate-traces {domain}
138
- → Reads .trace/*.tsv authoritative (committed) trong từng service:
139
- user-service/.trace/, order-service/.trace/, ...
140
- → Writes canonical trace-report.json + TSV mirror → {spec_source}/.living-docs/ (gitignored)
141
- → 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ẻ)
142
142
  → Living Docs panel cập nhật ngay
143
143
  ```
144
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,10 +1,10 @@
1
1
  [📚 Docs](../README.md) › [Operations](README.md) › Bug Flow
2
2
 
3
- # Bug Flow — PO · Dev · Tester · QC
3
+ # Bug Flow — PO · Dev · QC/Tester
4
4
 
5
- > Cách **PO, Dev, Tester, và QC 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
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: [Guide · QC Automation](../02-guides/qc-automation.md#khi-qc-tìm-thấy-bug--spec-gap--đẩy-lên-specs).
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).
8
8
 
9
9
  ---
10
10
 
@@ -359,4 +359,4 @@ Trước khi đánh "Resolved":
359
359
 
360
360
  ---
361
361
 
362
- *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).