@edupia-tutor/spec-driven-docs 0.14.0 → 0.14.1

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 (141) hide show
  1. package/commands/debug.md +435 -435
  2. package/commands/debug.tmpl +111 -111
  3. package/commands/define-product.md +330 -327
  4. package/commands/define-product.tmpl +50 -47
  5. package/commands/dev-gen-test.md +364 -364
  6. package/commands/dev-gen-test.tmpl +63 -63
  7. package/commands/dev-run-test.md +375 -375
  8. package/commands/dev-run-test.tmpl +74 -74
  9. package/commands/dev-smoke-test.md +340 -340
  10. package/commands/dev-smoke-test.tmpl +60 -60
  11. package/commands/fix-bug.md +402 -402
  12. package/commands/fix-bug.tmpl +78 -78
  13. package/commands/generate-bdd.md +512 -512
  14. package/commands/generate-bdd.tmpl +211 -211
  15. package/commands/generate-code.md +480 -482
  16. package/commands/generate-code.tmpl +179 -181
  17. package/commands/generate-design-spec.md +495 -495
  18. package/commands/generate-design-spec.tmpl +219 -219
  19. package/commands/generate-prd.md +445 -396
  20. package/commands/generate-prd.tmpl +45 -198
  21. package/commands/generate-spec-manifest.md +337 -337
  22. package/commands/generate-spec-manifest.tmpl +57 -57
  23. package/commands/generate-tech-docs.md +364 -364
  24. package/commands/generate-tech-docs.tmpl +84 -84
  25. package/commands/learn.md +346 -346
  26. package/commands/learn.tmpl +22 -22
  27. package/commands/map-testids.md +321 -321
  28. package/commands/map-testids.tmpl +41 -41
  29. package/commands/propose-scenario.md +334 -334
  30. package/commands/propose-scenario.tmpl +54 -54
  31. package/commands/qc-analyze.md +322 -323
  32. package/commands/qc-analyze.tmpl +42 -43
  33. package/commands/qc-design-test.md +303 -303
  34. package/commands/qc-design-test.tmpl +23 -23
  35. package/commands/qc-plan.md +296 -296
  36. package/commands/qc-plan.tmpl +16 -16
  37. package/commands/qc-report.md +301 -301
  38. package/commands/qc-report.tmpl +21 -21
  39. package/commands/qc-review.md +297 -297
  40. package/commands/qc-review.tmpl +17 -17
  41. package/commands/qc-run-test.md +336 -336
  42. package/commands/qc-run-test.tmpl +35 -35
  43. package/commands/refine-prd.md +426 -428
  44. package/commands/refine-prd.tmpl +61 -61
  45. package/commands/report-bug.md +350 -350
  46. package/commands/report-bug.tmpl +70 -70
  47. package/commands/review-code.md +363 -363
  48. package/commands/review-code.tmpl +39 -39
  49. package/commands/review-context.md +577 -579
  50. package/commands/review-context.tmpl +212 -212
  51. package/commands/review-tech-docs.md +426 -426
  52. package/commands/review-tech-docs.tmpl +146 -146
  53. package/commands/setup-ai-first.md +237 -237
  54. package/commands/setup-ai-first.tmpl +131 -131
  55. package/commands/sync.md +145 -145
  56. package/commands/sync.tmpl +93 -93
  57. package/commands/update-framework.md +88 -88
  58. package/commands/update-framework.tmpl +36 -36
  59. package/commands/validate-traces.md +379 -379
  60. package/commands/validate-traces.tmpl +99 -99
  61. package/core/FRAMEWORK_VERSION +1 -1
  62. package/core/commands/debug.md +435 -435
  63. package/core/commands/define-product.md +330 -327
  64. package/core/commands/dev-gen-test.md +364 -364
  65. package/core/commands/dev-run-test.md +375 -375
  66. package/core/commands/dev-smoke-test.md +340 -340
  67. package/core/commands/fix-bug.md +402 -402
  68. package/core/commands/generate-bdd.md +512 -512
  69. package/core/commands/generate-code.md +480 -482
  70. package/core/commands/generate-design-spec.md +495 -495
  71. package/core/commands/generate-prd.md +445 -396
  72. package/core/commands/generate-spec-manifest.md +337 -337
  73. package/core/commands/generate-tech-docs.md +364 -364
  74. package/core/commands/learn.md +346 -346
  75. package/core/commands/map-testids.md +321 -321
  76. package/core/commands/propose-scenario.md +334 -334
  77. package/core/commands/qc-analyze.md +322 -323
  78. package/core/commands/qc-design-test.md +303 -303
  79. package/core/commands/qc-plan.md +296 -296
  80. package/core/commands/qc-report.md +301 -301
  81. package/core/commands/qc-review.md +297 -297
  82. package/core/commands/qc-run-test.md +336 -336
  83. package/core/commands/refine-prd.md +426 -428
  84. package/core/commands/report-bug.md +350 -350
  85. package/core/commands/review-code.md +363 -363
  86. package/core/commands/review-context.md +577 -579
  87. package/core/commands/review-tech-docs.md +426 -426
  88. package/core/commands/setup-ai-first.md +237 -237
  89. package/core/commands/sync.md +145 -145
  90. package/core/commands/update-framework.md +88 -88
  91. package/core/commands/validate-traces.md +379 -379
  92. package/core/skills/code/SKILL.md +388 -388
  93. package/core/skills/debug/SKILL.md +390 -390
  94. package/core/skills/design-spec/SKILL.md +316 -316
  95. package/core/skills/discovery/SKILL.md +7 -547
  96. package/core/skills/prd/SKILL.md +298 -394
  97. package/core/skills/setup-ai-first/SKILL.md +79 -79
  98. package/core/skills/spec/SKILL.md +176 -176
  99. package/core/skills/test/SKILL.md +602 -602
  100. package/core/steps/capture-lesson.md +44 -44
  101. package/core/steps/context-loader.md +174 -174
  102. package/core/steps/gate.md +54 -54
  103. package/core/steps/report-footer.md +52 -52
  104. package/core/steps/review-fanout.md +85 -87
  105. package/core/steps/spawn-agent.md +45 -45
  106. package/core/steps/trace-mirror.md +21 -21
  107. package/core/templates/architecture.template.md +37 -37
  108. package/core/templates/design-spec.template.md +77 -77
  109. package/core/templates/platform-guide.template.md +47 -47
  110. package/core/templates/prd.template.md +106 -231
  111. package/core/templates/product-definition.template.md +101 -88
  112. package/docs/04-operations/publishing.md +20 -3
  113. package/package.json +1 -1
  114. package/skills/code/SKILL.md +388 -388
  115. package/skills/code/SKILL.tmpl +56 -56
  116. package/skills/debug/SKILL.md +390 -390
  117. package/skills/debug/SKILL.tmpl +60 -60
  118. package/skills/design-spec/SKILL.md +316 -316
  119. package/skills/design-spec/SKILL.tmpl +36 -36
  120. package/skills/discovery/SKILL.md +7 -547
  121. package/skills/discovery/SKILL.tmpl +7 -140
  122. package/skills/prd/SKILL.md +298 -394
  123. package/skills/prd/SKILL.tmpl +40 -151
  124. package/skills/setup-ai-first/SKILL.md +79 -79
  125. package/skills/setup-ai-first/SKILL.tmpl +27 -27
  126. package/skills/spec/SKILL.md +176 -176
  127. package/skills/spec/SKILL.tmpl +18 -18
  128. package/skills/test/SKILL.md +602 -602
  129. package/skills/test/SKILL.tmpl +44 -44
  130. package/steps/capture-lesson.md +44 -44
  131. package/steps/context-loader.md +174 -174
  132. package/steps/gate.md +54 -54
  133. package/steps/report-footer.md +52 -52
  134. package/steps/review-fanout.md +85 -87
  135. package/steps/spawn-agent.md +45 -45
  136. package/steps/trace-mirror.md +21 -21
  137. package/templates/architecture.template.md +37 -37
  138. package/templates/design-spec.template.md +77 -77
  139. package/templates/platform-guide.template.md +47 -47
  140. package/templates/prd.template.md +106 -231
  141. package/templates/product-definition.template.md +101 -88
@@ -1,11 +1,11 @@
1
1
  # /validate-traces — Traceability Coverage Matrix
2
2
 
3
- Read-only check of coverage between specs, code, and testsincluding PRD version drift.
3
+ Check read-only độ phủ giữa spec, code, testgồm cả PRD version drift.
4
4
 
5
5
  ## Gate
6
6
  {{include:steps/gate.md}}
7
7
 
8
- *Note: For this command, the target in Step 1 is a domain name or specific UC-ID from `$ARGUMENTS`. There is no single file to resolvethe command scans multiple directories.*
8
+ *Lưu ý: Với lệnh này, target Bước 1 một tên domain hoặc UC-ID cụ thể từ `$ARGUMENTS`. Không một file đơn để phân giải lệnh quét nhiều thư mục.*
9
9
 
10
10
  ## Context
11
11
  {{include:steps/context-loader.md}}
@@ -16,86 +16,86 @@ Read-only check of coverage between specs, code, and tests — including PRD ver
16
16
 
17
17
  ### Step 0 — Umbrella Mode Detection
18
18
 
19
- Check whether `services` array exists in `project-context.yaml`.
19
+ Kiểm tra mảng `services` tồn tại trong `project-context.yaml` không.
20
20
 
21
- **If `services` exists (umbrella mode):**
22
- - Resolve the trace dir(s):
23
- - **If `setup.spec_source` is set (consolidated trace):** `all_trace_dirs = [ {spec_source}/.trace ]` — a **single** authoritative location in the spec repo. Scenarios carry their owning service via the `@trace.service` field, so no per-service split is needed. This is the common case.
24
- - **Else (no spec_source — legacy per-service trace):** one dir per service — `services[N].trace_dir` if set, else `{services[N].path}/.trace`; `all_trace_dirs = [ dir1, dir2, … ]`, tagged by service name on read.
25
- - Step 1 reads TSVs from `all_trace_dirs`.
26
- - **Resolve the Living Docs home (generated report location):**
27
- - If `setup.spec_source` is set → `living_docs_dir = {spec_source}/.living-docs`
28
- *(the shared specs module — mounted inside every service/umbrella workspace, so the panel resolves it no matter which submodule the dev is standing in)*
29
- - Else (umbrella without a separate spec repo) → `living_docs_dir = .living-docs` at umbrella root
30
- - **Resolve the panel mirror:** `panel_mirror = ./.trace` at the **current workspace root** (wherever this command runs). The VS Code panel reads `.trace/trace-report.json` from the open workspacewriting the report here is what makes the view non-empty when a dev opens a service submodule directly.
21
+ **Nếu `services` tồn tại (umbrella mode):**
22
+ - Phân giải trace dir:
23
+ - **Nếu `setup.spec_source` được set (consolidated trace):** `all_trace_dirs = [ {spec_source}/.trace ]` — một vị trí authoritative **duy nhất** trong spec repo. Scenario mang service sở hữu qua field `@trace.service`, nên không cần tách theo service. Đây trường hợp phổ biến.
24
+ - **Else (không spec_source — legacy per-service trace):** một dir mỗi service — `services[N].trace_dir` nếu set, else `{services[N].path}/.trace`; `all_trace_dirs = [ dir1, dir2, … ]`, gắn tag tên service khi đọc.
25
+ - Step 1 đọc TSV từ `all_trace_dirs`.
26
+ - **Phân giải Living Docs home (vị trí report sinh ra):**
27
+ - Nếu `setup.spec_source` được set → `living_docs_dir = {spec_source}/.living-docs`
28
+ *(specs module dùng chung mount trong mọi service/umbrella workspace, nên panel phân giải bất kể dev đứng submodule nào)*
29
+ - Else (umbrella không spec repo riêng) → `living_docs_dir = .living-docs` umbrella root
30
+ - **Phân giải panel mirror:** `panel_mirror = ./.trace` **gốc workspace hiện tại** (nơi lệnh chạy). Panel VS Code đọc `.trace/trace-report.json` từ workspace đang mởghi report đây cái làm view không rỗng khi dev mở một service submodule trực tiếp.
31
31
 
32
- **If no `services` key (single-service mode):**
32
+ **Nếu không có key `services` (single-service mode):**
33
33
  - Set `all_trace_dirs = [ {paths.trace_dir} ]`
34
- - No umbrella sync needed
34
+ - Không cần umbrella sync
35
35
 
36
36
  ---
37
37
 
38
- ### Step 1 — Load TSV data
38
+ ### Step 1 — Nạp dữ liệu TSV
39
39
 
40
- **Umbrella mode:** read all `{trace_dir}/**/*.tsv` files from every dir in `all_trace_dirs`. For each TSV, tag its rows with the originating service name.
40
+ **Umbrella mode:** đọc tất cả file `{trace_dir}/**/*.tsv` từ mọi dir trong `all_trace_dirs`. Với mỗi TSV, gắn tag row với tên service gốc.
41
41
 
42
- **Single-service mode:** read all `{paths.trace_dir}/{domain}/**/*.tsv` files matching the target domain (or `{paths.trace_dir}/**/*.tsv` for all domains if no domain filter).
42
+ **Single-service mode:** đọc tất cả file `{paths.trace_dir}/{domain}/**/*.tsv` khớp domain target (hoặc `{paths.trace_dir}/**/*.tsv` cho mọi domain nếu không domain filter).
43
43
 
44
- Each file gives the persisted trace state for that UC.
44
+ Mỗi file cho trace state đã lưu của UC đó.
45
45
 
46
- **If no `.tsv` files found** in any of the trace dirs:
47
- - Scan all `{paths.specs_dir}/**/*.feature` files in the target domain to build an in-memory list of all scenarios.
48
- - Treat all scenarios as `UNTRACKED` (no code generated yet).
49
- - Print: "⚠️ No trace files found. All {N} scenarios across {M} UCs are UNTRACKED."
50
- - Suggest: "Run `/generate-bdd {prd-file}` to initialize trace state, or `/generate-code {feature-file}` to generate code."
51
- - **Skip Steps 2–6 entirely.** Proceed directly to Step 7 using this in-memory statedo NOT abort.
46
+ **Nếu không tìm thấy file `.tsv` nào** trong bất kỳ trace dir nào:
47
+ - Quét tất cả file `{paths.specs_dir}/**/*.feature` trong domain target để dựng list in-memory mọi scenario.
48
+ - Coi mọi scenario `UNTRACKED` (chưa sinh code).
49
+ - In: "⚠️ No trace files found. All {N} scenarios across {M} UCs are UNTRACKED."
50
+ - Đề xuất: "Run `/generate-bdd {prd-file}` to initialize trace state, or `/generate-code {feature-file}` to generate code."
51
+ - **Bỏ qua hoàn toàn Step 2–6.** Đi thẳng tới Step 7 dùng state in-memory nàyĐỪNG abort.
52
52
 
53
- ### Step 2 — Reconcile with current `.feature` files
53
+ ### Step 2 — Reconcile với file `.feature` hiện tại
54
54
 
55
- For each `.tsv` row, read the corresponding `.feature` file and get the **current** `@trace.sc_version` for that SC.
56
- If the `.feature` SC version differs from the `.tsv` `spec_ver` update `spec_ver` in memory (will be written back).
55
+ Với mỗi row `.tsv`, đọc file `.feature` tương ứng lấy `@trace.sc_version` **hiện tại** cho SC đó.
56
+ Nếu version SC trong `.feature` khác `spec_ver` của `.tsv` → cập nhật `spec_ver` trong memory (sẽ ghi lại).
57
57
 
58
- Also detect SCs present in `.feature` but missing from `.tsv` → add as new rows with `status: UNTRACKED`.
58
+ Cũng phát hiện SC trong `.feature` nhưng thiếu trong `.tsv` → thêm row mới với `status: UNTRACKED`.
59
59
 
60
- ### Step 3 — Compute `status` per scenario
60
+ ### Step 3 — Tính `status` theo từng scenario
61
61
 
62
- Apply rules in priority order:
62
+ Áp dụng quy tắc theo thứ tự ưu tiên:
63
63
 
64
- | Rule | Status | Condition |
64
+ | Rule | Status | Điều kiện |
65
65
  |------|--------|-----------|
66
- | 1 | `UNTRACKED` | `implemented_by == —` (no code generated yet) |
66
+ | 1 | `UNTRACKED` | `implemented_by == —` (chưa sinh code) |
67
67
  | 2 | `GAP` | `implemented_by != —` AND (`test_count == —` OR `test_count == 0`) |
68
- | 3 | `DRIFT` | `spec_ver != gen_ver` (scenario updated since last codegen) |
69
- | 4 | `OK` | all of: `spec_ver == gen_ver`, `implemented_by != —`, `test_count > 0` |
68
+ | 3 | `DRIFT` | `spec_ver != gen_ver` (scenario cập nhật từ lần codegen trước) |
69
+ | 4 | `OK` | tất cả: `spec_ver == gen_ver`, `implemented_by != —`, `test_count > 0` |
70
70
 
71
71
  ### Step 4 — PRD version drift check
72
72
 
73
- For each UC, compare:
74
- - Current PRD `| **Version** |` from `{paths.specs_dir}/{domain}/{prd-slug}/prd.md`
75
- - `prd_version` stored in `.tsv` (version at time of BDD generation)
76
- - `@trace.prd_version` in the code files implementing that UC
73
+ Với mỗi UC, so:
74
+ - PRD `| **Version** |` hiện tại từ `{paths.specs_dir}/{domain}/{prd-slug}/prd.md`
75
+ - `prd_version` lưu trong `.tsv` (version tại thời điểm sinh BDD)
76
+ - `@trace.prd_version` trong các file code implement UC đó
77
77
 
78
- If any layer is behind current PRD versionflag `PRD_DRIFT` and extract changelog entries since that version.
78
+ Nếu layer nào sau version PRD hiện tại gắn cờ `PRD_DRIFT` trích các changelog entry kể từ version đó.
79
79
 
80
80
  ### Step 5 — Tech-doc revision drift check
81
81
 
82
- For each UC that has a tech-doc, compare the stored revision against the current doc — for **both** tech-doc kinds:
82
+ Với mỗi UC tech-doc, so revision đã lưu vs doc hiện tại cho **cả hai** loại tech-doc:
83
83
 
84
- - **BE contract:** `@trace.revision` in `{paths.tech_docs_dir}/{domain}/{prd-slug}/tech-docs/{UC-ID}-tech-design.md` vs `tech_doc_revision` in `.tsv`.
85
- Code generated from an older revisionflag `TECHDOC_DRIFT`.
86
- - **FE tech-design:** `@trace.revision` in `{paths.tech_docs_dir}/{domain}/{prd-slug}/tech-docs/{UC-ID}-tech-design-{platform}.md` vs `fe_tech_doc_revision` in `.tsv` (per platform row).
87
- FE code generated from an older revision flag `FE_TECHDOC_DRIFT`.
84
+ - **BE contract:** `@trace.revision` trong `{paths.tech_docs_dir}/{domain}/{prd-slug}/tech-docs/{UC-ID}-tech-design.md` vs `tech_doc_revision` trong `.tsv`.
85
+ Code sinh từ revision hơngắn cờ `TECHDOC_DRIFT`.
86
+ - **FE tech-design:** `@trace.revision` trong `{paths.tech_docs_dir}/{domain}/{prd-slug}/tech-docs/{UC-ID}-tech-design-{platform}.md` vs `fe_tech_doc_revision` trong `.tsv` (theo từng row platform).
87
+ Code FE sinh từ revision hơngắn cờ `FE_TECHDOC_DRIFT`.
88
88
 
89
- Skip whichever kind has no doc / no stored revision (`—`).
89
+ Skip loại nào không doc / không revision đã lưu (`—`).
90
90
 
91
- ### Step 6 — Write status back to TSV
91
+ ### Step 6 — Ghi status lại vào TSV
92
92
 
93
- *Skip this step if no TSV files existed (handled by Step 1 no-TSV path).*
93
+ *Bỏ qua step này nếu không có file TSV nào (đã xử bởi path no-TSV của Step 1).*
94
94
 
95
- For each `.tsv` file processed: write updated `spec_ver`, `status`, `last_updated` back to disk.
96
- Do **not** modify `dev_selftest`/`dev_selftest_at` (owned by `/dev-run-test`) or `qc_status`/`qc_run_at`/`qc_owner`/`qc_blocked_by` (owned by `/qc-run-test` + `/report-bug`); this command only reads them for the report.
95
+ Với mỗi file `.tsv` đã xử lý: ghi `spec_ver`, `status`, `last_updated` đã cập nhật lại disk.
96
+ **Đừng** sửa `dev_selftest`/`dev_selftest_at` (do `/dev-run-test` sở hữu) hay `qc_status`/`qc_run_at`/`qc_owner`/`qc_blocked_by` (do `/qc-run-test` + `/report-bug` sở hữu); lệnh này chỉ đọc chúng cho report.
97
97
 
98
- ### Step 7 — Compute dashboard aggregates
98
+ ### Step 7 — Tính aggregate cho dashboard
99
99
 
100
100
  ```
101
101
  total_prds = count distinct PRD files in {paths.specs_dir}/{domain}/*/prd.md
@@ -122,13 +122,13 @@ qc_not_run = rows where qc_status in (not_run, —)
122
122
  # shown alongside — never merged with — dev_selftest.
123
123
  waiting_dev = rows where qc_owner == dev # PM view: QC-found, waiting on dev to fix
124
124
  waiting_po = rows where qc_owner == po # PM view: blocked, waiting on PO to confirm/clarify
125
- # qc_owner + qc_blocked_by answer "case nào đang chờ ai" — surface as a "Waiting on" column.
125
+ # qc_owner + qc_blocked_by trả lời "case nào đang chờ ai" — surface as a "Waiting on" column.
126
126
  tech_docs_count = count .md files in {paths.tech_docs_dir}/{domain}/*/tech-docs/
127
127
  ```
128
128
 
129
- ### Step 8 — Write JSON report
129
+ ### Step 8 — Ghi JSON report
130
130
 
131
- Write `{paths.trace_dir}/trace-report.json` (overwrite if exists). This file is the single source of truth for web dashboardsit contains the full snapshot at the time `/validate-traces` was last run.
131
+ Ghi `{paths.trace_dir}/trace-report.json` (ghi đè nếu tồn tại). File này source of truth duy nhất cho web dashboard chứa snapshot đầy đủ tại thời điểm `/validate-traces` chạy lần cuối.
132
132
 
133
133
  Schema:
134
134
 
@@ -258,45 +258,45 @@ Schema:
258
258
  ```
259
259
 
260
260
  **Rules:**
261
- - `implemented_by`: use `null` (not `"—"`) in JSON when no value
262
- - `test_count`: use integer `0` (not `"—"`) when no tests
263
- - `test_classes`: use `[]` (not `"—"`) when no test classes
264
- - `tech_doc_revision` / `fe_tech_doc_revision`: use integer; `0` if not yet generated
265
- - `code_coverage_pct` / `test_coverage_pct`: round to nearest integer (0–100)
266
- - Always write to `{paths.trace_dir}/trace-report.json` regardless of domain filter — if a domain filter was applied, include only those PRDs in `prds[]` but note the domain in the `domain` field
267
- - **TSV `"—"` mapping**: when reading TSV files, map dash values to JSON types: `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`; `qc_owner: "—"` → `null`; `qc_blocked_by: "—"` → `null`
268
- - **Backward-compat:** older TSVs may be missing newer columns from the header — treat any absent column as its empty value (do not error): `qc_owner`/`qc_blocked_by` (pre-19-col) → `null`; `fe_tech_doc_revision` (pre-22-col) → `0`. The next `/generate-bdd` re-gen upgrades the header to the current 22-column layout.
269
-
270
- ### Step 8b — Living Docs Sync *(umbrella mode only)*
271
-
272
- *Skip this step in single-service mode.*
273
-
274
- **With `spec_source` set,** the authoritative trace TSVs already live in **one** place
275
- `{spec_source}/.trace/` (committed in the spec repo). There is **no per-service merge**:
276
- each scenario row carries its owning service via `@trace.service`. This step just
277
- (re)generates the report and refreshes the local panel.
278
-
279
- 1. **Write the report** to `{living_docs_dir}/trace-report.json` (`mkdir -p` first) — built
280
- directly from `{spec_source}/.trace/*.tsv`, with a `"service"` field per scenario row and
281
- the summary aggregates. *(Legacy no-`spec_source` umbrellas still merge every per-service
282
- `trace-report.json` into one document, namespaced by service.)*
283
-
284
- 2. **Mirror to the panel location** `{panel_mirror}` (`./.trace` at the current workspace
285
- root) so a dev who opened *this* repo sees data immediately: copy
286
- `{living_docs_dir}/trace-report.json` (+ the `{UC-ID}.tsv` files) → `{panel_mirror}/`.
287
- If `panel_mirror` already resolves to `{spec_source}/.trace`, skip.
288
-
289
- 3. **Print sync summary:**
261
+ - `implemented_by`: dùng `null` (không phải `"—"`) trong JSON khi không có giá trị
262
+ - `test_count`: dùng integer `0` (không phải `"—"`) khi không có test
263
+ - `test_classes`: dùng `[]` (không phải `"—"`) khi không test class
264
+ - `tech_doc_revision` / `fe_tech_doc_revision`: dùng integer; `0` nếu chưa sinh
265
+ - `code_coverage_pct` / `test_coverage_pct`: làm tròn về integer gần nhất (0–100)
266
+ - Luôn ghi vào `{paths.trace_dir}/trace-report.json` bất kể domain filter — nếu domain filter, chỉ gồm các PRD đó trong `prds[]` nhưng ghi domain vào field `domain`
267
+ - **TSV `"—"` mapping**: khi đọc file TSV, map giá trị dash sang kiểu JSON: `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`; `qc_owner: "—"` → `null`; `qc_blocked_by: "—"` → `null`
268
+ - **Backward-compat:** TSV thể thiếu cột mới hơn trong header — coi cột vắng nào giá trị rỗng của nó (đừng báo lỗi): `qc_owner`/`qc_blocked_by` (pre-19-col) → `null`; `fe_tech_doc_revision` (pre-22-col) → `0`. Lần `/generate-bdd` gen lại tiếp theo nâng header lên layout 22 cột hiện tại.
269
+
270
+ ### Step 8b — Living Docs Sync *(chỉ umbrella mode)*
271
+
272
+ *Bỏ qua step này single-service mode.*
273
+
274
+ **Với `spec_source` được set,** các trace TSV authoritative đã sống **một** chỗ
275
+ `{spec_source}/.trace/` (committed trong spec repo). **Không merge theo service**:
276
+ mỗi scenario row mang service sở hữu qua `@trace.service`. Step này chỉ
277
+ (re)generate report làm mới panel local.
278
+
279
+ 1. **Ghi report** vào `{living_docs_dir}/trace-report.json` (`mkdir -p` trước) — dựng
280
+ trực tiếp từ `{spec_source}/.trace/*.tsv`, với field `"service"` mỗi scenario row
281
+ các summary aggregate. *(Umbrella legacy không-`spec_source` vẫn merge mọi `trace-report.json`
282
+ theo service thành một document, namespace theo service.)*
283
+
284
+ 2. **Mirror tới panel location** `{panel_mirror}` (`./.trace` gốc workspace hiện tại)
285
+ để dev mở *repo này* thấy data ngay: copy
286
+ `{living_docs_dir}/trace-report.json` (+ các file `{UC-ID}.tsv`) → `{panel_mirror}/`.
287
+ Nếu `panel_mirror` đã phân giải về `{spec_source}/.trace`, skip.
288
+
289
+ 3. **In sync summary:**
290
290
  ```
291
291
  Living Docs → {living_docs_dir}/trace-report.json ({total} scenarios across {S} services)
292
292
  Trace (authoritative) → {spec_source}/.trace/ (committed in spec repo)
293
293
  Panel mirror → {panel_mirror}/trace-report.json (current workspace)
294
294
  ```
295
295
 
296
- > **Note:** the committed, authoritative trace state is `{spec_source}/.trace/*.tsv` (in the
297
- > spec repo — one place for the PM). The report (`.living-docs/`) and the panel mirror
298
- > (`./.trace` at a workspace that is not the spec repo) are **generated** — gitignore them;
299
- > they are regenerated by `/validate-traces` or `/sync`.
296
+ > **Lưu ý:** trace state committed, authoritative `{spec_source}/.trace/*.tsv` (trong
297
+ > spec repo — một chỗ cho PM). Report (`.living-docs/`) panel mirror
298
+ > (`./.trace` workspace không phải spec repo) **sinh ra** — gitignore chúng;
299
+ > chúng được regenerate bởi `/validate-traces` hoặc `/sync`.
300
300
 
301
301
  ## Output
302
302
 
@@ -321,28 +321,28 @@ each scenario row carries its owning service via `@trace.service`. This step jus
321
321
  | {UC}-UC2 | SC1 | {title...} | v1.0 | v1.0 | ✅ {Controller.fn} | — | GAP |
322
322
 
323
323
  Drift Detail:
324
- {UC}-UC1-SC2 — spec v1.1 but code generated from v1.0
325
- Re-run: /generate-code {UC-ID}
324
+ {UC}-UC1-SC2 — spec v1.1 nhưng code sinh từ v1.0
325
+ Chạy lại: /generate-code {UC-ID}
326
326
 
327
327
  PRD Version Drift:
328
- {UC}-UC2 — code at PRD v1.0, PRD now at v1.2
329
- Changes since v1.0:
328
+ {UC}-UC2 — code PRD v1.0, PRD giờ v1.2
329
+ Thay đổi kể từ v1.0:
330
330
  v1.1: {changelog entry}
331
331
  v1.2: {changelog entry}
332
332
  → /generate-bdd {prd-file} then /generate-code {UC-ID}
333
333
 
334
334
  Tech-Doc Revision Drift:
335
- {UC}-UC3 — code generated from tech-doc revision 2, now at revision 4
336
- → Review tech-doc changes then /generate-code {UC-ID}
335
+ {UC}-UC3 — code sinh từ tech-doc revision 2, giờ revision 4
336
+ → Review thay đổi tech-doc rồi /generate-code {UC-ID}
337
337
 
338
338
  Recommendations:
339
- - /generate-code {UC-ID} for DRIFT and UNTRACKED scenarios
340
- - /dev-gen-test {UC-ID} for GAP (missing tests)
341
- - /generate-bdd {prd-file} for PRD version drift
339
+ - /generate-code {UC-ID} cho scenario DRIFT UNTRACKED
340
+ - /dev-gen-test {UC-ID} cho GAP (thiếu test)
341
+ - /generate-bdd {prd-file} cho PRD version drift
342
342
 
343
- [Umbrella mode only]
343
+ [Chỉ umbrella mode]
344
344
  Living Docs canonical → {living_docs_dir}/ (specs module — shared, gitignored)
345
345
  Panel mirror → {panel_mirror}/trace-report.json (current workspace)
346
- Tip: run /validate-traces (or /sync) after each codegen session to refresh the panel.
347
- Both are generated mirrorsdo not commit (.living-docs/ + .trace/ in .gitignore).
346
+ Tip: chạy /validate-traces (hoặc /sync) sau mỗi phiên codegen để làm mới panel.
347
+ Cả hai mirror sinh ra đừng commit (.living-docs/ + .trace/ trong .gitignore).
348
348
  ```
@@ -1 +1 @@
1
- 0.14.0
1
+ 0.14.1