@educa-corp/sdd-framework 0.1.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 (382) hide show
  1. package/bin/build.js +230 -0
  2. package/bin/index.js +609 -0
  3. package/commands/debug.md +835 -0
  4. package/commands/debug.tmpl +257 -0
  5. package/commands/define-product.md +746 -0
  6. package/commands/define-product.tmpl +191 -0
  7. package/commands/dev-gen-test.md +1015 -0
  8. package/commands/dev-gen-test.tmpl +490 -0
  9. package/commands/dev-run-test.md +749 -0
  10. package/commands/dev-run-test.tmpl +224 -0
  11. package/commands/dev-smoke-test.md +716 -0
  12. package/commands/dev-smoke-test.tmpl +217 -0
  13. package/commands/fix-bug.md +749 -0
  14. package/commands/fix-bug.tmpl +171 -0
  15. package/commands/generate-bdd.md +1144 -0
  16. package/commands/generate-bdd.tmpl +499 -0
  17. package/commands/generate-code.md +1038 -0
  18. package/commands/generate-code.tmpl +513 -0
  19. package/commands/generate-design-spec.md +1079 -0
  20. package/commands/generate-design-spec.tmpl +524 -0
  21. package/commands/generate-prd.md +945 -0
  22. package/commands/generate-prd.tmpl +166 -0
  23. package/commands/generate-spec-manifest.md +663 -0
  24. package/commands/generate-spec-manifest.tmpl +164 -0
  25. package/commands/generate-tech-docs.md +1249 -0
  26. package/commands/generate-tech-docs.tmpl +252 -0
  27. package/commands/learn.md +641 -0
  28. package/commands/learn.tmpl +63 -0
  29. package/commands/map-testids.md +580 -0
  30. package/commands/map-testids.tmpl +81 -0
  31. package/commands/propose-scenario.md +632 -0
  32. package/commands/propose-scenario.tmpl +133 -0
  33. package/commands/qc-analyze.md +611 -0
  34. package/commands/qc-analyze.tmpl +112 -0
  35. package/commands/qc-design-test.md +567 -0
  36. package/commands/qc-design-test.tmpl +68 -0
  37. package/commands/qc-plan.md +548 -0
  38. package/commands/qc-plan.tmpl +49 -0
  39. package/commands/qc-report.md +559 -0
  40. package/commands/qc-report.tmpl +60 -0
  41. package/commands/qc-review.md +552 -0
  42. package/commands/qc-review.tmpl +53 -0
  43. package/commands/qc-run-test.md +609 -0
  44. package/commands/qc-run-test.tmpl +84 -0
  45. package/commands/refine-prd.md +992 -0
  46. package/commands/refine-prd.tmpl +278 -0
  47. package/commands/report-bug.md +647 -0
  48. package/commands/report-bug.tmpl +148 -0
  49. package/commands/review-code.md +682 -0
  50. package/commands/review-code.tmpl +104 -0
  51. package/commands/review-context.md +1202 -0
  52. package/commands/review-context.tmpl +488 -0
  53. package/commands/review-tech-docs.md +871 -0
  54. package/commands/review-tech-docs.tmpl +372 -0
  55. package/commands/setup-ai-first.md +546 -0
  56. package/commands/setup-ai-first.tmpl +358 -0
  57. package/commands/sync.md +451 -0
  58. package/commands/sync.tmpl +351 -0
  59. package/commands/update-framework.md +251 -0
  60. package/commands/update-framework.tmpl +151 -0
  61. package/commands/validate-traces.md +928 -0
  62. package/commands/validate-traces.tmpl +429 -0
  63. package/core/FRAMEWORK_VERSION +1 -0
  64. package/core/commands/debug.md +835 -0
  65. package/core/commands/define-product.md +746 -0
  66. package/core/commands/dev-gen-test.md +1015 -0
  67. package/core/commands/dev-run-test.md +749 -0
  68. package/core/commands/dev-smoke-test.md +716 -0
  69. package/core/commands/fix-bug.md +749 -0
  70. package/core/commands/generate-bdd.md +1144 -0
  71. package/core/commands/generate-code.md +1038 -0
  72. package/core/commands/generate-design-spec.md +1079 -0
  73. package/core/commands/generate-prd.md +945 -0
  74. package/core/commands/generate-spec-manifest.md +663 -0
  75. package/core/commands/generate-tech-docs.md +1249 -0
  76. package/core/commands/learn.md +641 -0
  77. package/core/commands/map-testids.md +580 -0
  78. package/core/commands/propose-scenario.md +632 -0
  79. package/core/commands/qc-analyze.md +611 -0
  80. package/core/commands/qc-design-test.md +567 -0
  81. package/core/commands/qc-plan.md +548 -0
  82. package/core/commands/qc-report.md +559 -0
  83. package/core/commands/qc-review.md +552 -0
  84. package/core/commands/qc-run-test.md +609 -0
  85. package/core/commands/refine-prd.md +992 -0
  86. package/core/commands/report-bug.md +647 -0
  87. package/core/commands/review-code.md +682 -0
  88. package/core/commands/review-context.md +1202 -0
  89. package/core/commands/review-tech-docs.md +871 -0
  90. package/core/commands/setup-ai-first.md +546 -0
  91. package/core/commands/sync.md +451 -0
  92. package/core/commands/update-framework.md +251 -0
  93. package/core/commands/validate-traces.md +928 -0
  94. package/core/hooks/data-guard.js +141 -0
  95. package/core/hooks/settings.json +18 -0
  96. package/core/modules/android-compose/module.yaml +13 -0
  97. package/core/modules/android-compose/stack-profile.yaml +57 -0
  98. package/core/modules/angular/architecture-snippets/component-patterns.md +187 -0
  99. package/core/modules/angular/module.yaml +6 -0
  100. package/core/modules/angular/stack-profile.yaml +38 -0
  101. package/core/modules/context-engineering/architecture-snippets/context-design.md +119 -0
  102. package/core/modules/context-engineering/module.yaml +9 -0
  103. package/core/modules/context-engineering/stack-profile.yaml +61 -0
  104. package/core/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
  105. package/core/modules/dotnet/module.yaml +6 -0
  106. package/core/modules/dotnet/stack-profile.yaml +50 -0
  107. package/core/modules/flutter/module.yaml +14 -0
  108. package/core/modules/flutter/stack-profile.yaml +59 -0
  109. package/core/modules/golang/architecture-snippets/domain-layout.md +283 -0
  110. package/core/modules/golang/module.yaml +6 -0
  111. package/core/modules/golang/stack-profile.yaml +40 -0
  112. package/core/modules/ios-swiftui/module.yaml +13 -0
  113. package/core/modules/ios-swiftui/stack-profile.yaml +55 -0
  114. package/core/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
  115. package/core/modules/java-spring/module.yaml +15 -0
  116. package/core/modules/java-spring/stack-profile.yaml +28 -0
  117. package/core/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
  118. package/core/modules/nextjs/module.yaml +14 -0
  119. package/core/modules/nextjs/stack-profile.yaml +74 -0
  120. package/core/modules/nuxt/module.yaml +14 -0
  121. package/core/modules/nuxt/stack-profile.yaml +58 -0
  122. package/core/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
  123. package/core/modules/php-laravel/module.yaml +15 -0
  124. package/core/modules/php-laravel/stack-profile.yaml +56 -0
  125. package/core/modules/qc-playwright/stack-profile.yaml +66 -0
  126. package/core/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
  127. package/core/modules/react/module.yaml +14 -0
  128. package/core/modules/react/stack-profile.yaml +63 -0
  129. package/core/modules/react-native/module.yaml +14 -0
  130. package/core/modules/react-native/stack-profile.yaml +56 -0
  131. package/core/modules/vue/module.yaml +14 -0
  132. package/core/modules/vue/stack-profile.yaml +65 -0
  133. package/core/rules/data-protection.md +80 -0
  134. package/core/rules/workflow.md +44 -0
  135. package/core/skills/code/SKILL.md +19 -0
  136. package/core/skills/debug/SKILL.md +19 -0
  137. package/core/skills/design-spec/SKILL.md +11 -0
  138. package/core/skills/discovery/SKILL.md +14 -0
  139. package/core/skills/prd/SKILL.md +19 -0
  140. package/core/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  141. package/core/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
  142. package/core/skills/qc/qa-analyst/business-rules.md +59 -0
  143. package/core/skills/qc/qa-analyst/data-flow.md +64 -0
  144. package/core/skills/qc/qa-analyst/spec-breakdown.md +61 -0
  145. package/core/skills/qc/qa-designer/e2e/journey.md +41 -0
  146. package/core/skills/qc/qa-designer/exploratory/charter.md +68 -0
  147. package/core/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  148. package/core/skills/qc/qa-designer/functional/api.md +45 -0
  149. package/core/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  150. package/core/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  151. package/core/skills/qc/qa-designer/integration/api.md +42 -0
  152. package/core/skills/qc/qa-designer/integration/db.md +39 -0
  153. package/core/skills/qc/qa-designer/integration/gui.md +40 -0
  154. package/core/skills/qc/qa-designer/integration/kafka.md +40 -0
  155. package/core/skills/qc/qa-designer/non-functional.md +40 -0
  156. package/core/skills/qc/qa-planner/test-plan.md +120 -0
  157. package/core/skills/qc/qa-reviewer/script/e2e.md +87 -0
  158. package/core/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  159. package/core/skills/qc/qa-reviewer/script/functional.md +101 -0
  160. package/core/skills/qc/qa-reviewer/script/integration.md +91 -0
  161. package/core/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  162. package/core/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  163. package/core/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  164. package/core/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  165. package/core/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  166. package/core/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  167. package/core/skills/qc/qa-runner/e2e.md +49 -0
  168. package/core/skills/qc/qa-runner/exploratory/session.md +36 -0
  169. package/core/skills/qc/qa-runner/functional/api.md +35 -0
  170. package/core/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  171. package/core/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  172. package/core/skills/qc/qa-runner/integration.md +47 -0
  173. package/core/skills/qc/qa-runner/non-functional.md +49 -0
  174. package/core/skills/qc/qa-runner/report/report.md +37 -0
  175. package/core/skills/setup-ai-first/SKILL.md +11 -0
  176. package/core/skills/spec/SKILL.md +19 -0
  177. package/core/skills/test/SKILL.md +18 -0
  178. package/core/steps/business-language.md +56 -0
  179. package/core/steps/capture-lesson.md +79 -0
  180. package/core/steps/context-loader.md +311 -0
  181. package/core/steps/gate.md +88 -0
  182. package/core/steps/report-footer.md +100 -0
  183. package/core/steps/review-fanout.md +159 -0
  184. package/core/steps/spawn-agent.md +129 -0
  185. package/core/steps/trace-mirror.md +26 -0
  186. package/core/templates/architecture.template.md +113 -0
  187. package/core/templates/design-spec.template.md +217 -0
  188. package/core/templates/feature.template +120 -0
  189. package/core/templates/platform-guide.template.md +145 -0
  190. package/core/templates/prd.template.md +224 -0
  191. package/core/templates/product-definition.template.md +188 -0
  192. package/core/templates/project-context.yaml +161 -0
  193. package/core/templates/tech-design.template.md +498 -0
  194. package/docs/01-getting-started/README.md +19 -0
  195. package/docs/01-getting-started/core-concepts.md +102 -0
  196. package/docs/01-getting-started/installation.md +156 -0
  197. package/docs/01-getting-started/quickstart.md +86 -0
  198. package/docs/02-guides/README.md +26 -0
  199. package/docs/02-guides/bdd-input-checklist.md +68 -0
  200. package/docs/02-guides/developer/README.md +49 -0
  201. package/docs/02-guides/developer/bdd-and-trace.md +126 -0
  202. package/docs/02-guides/developer/commands.md +76 -0
  203. package/docs/02-guides/developer/pr-checklist.md +16 -0
  204. package/docs/02-guides/developer/scenarios.md +460 -0
  205. package/docs/02-guides/developer/workflow.md +121 -0
  206. package/docs/02-guides/prd-input-checklist.md +94 -0
  207. package/docs/02-guides/product-owner/README.md +81 -0
  208. package/docs/02-guides/product-owner/commands.md +30 -0
  209. package/docs/02-guides/product-owner/handoff-checklist.md +42 -0
  210. package/docs/02-guides/product-owner/prd-writing-rules.md +45 -0
  211. package/docs/02-guides/product-owner/scenarios.md +438 -0
  212. package/docs/02-guides/tech-docs-input-checklist.md +109 -0
  213. package/docs/02-guides/tester/README.md +75 -0
  214. package/docs/02-guides/tester/bug-reporting.md +117 -0
  215. package/docs/02-guides/tester/qc-automation.md +165 -0
  216. package/docs/02-guides/tester/reading-specs.md +79 -0
  217. package/docs/02-guides/tester/scenarios.md +186 -0
  218. package/docs/02-guides/tester/spec-manifest.md +130 -0
  219. package/docs/02-guides/tester/test-checklist.md +31 -0
  220. package/docs/02-guides/tester/workflow.md +77 -0
  221. package/docs/03-concepts/README.md +20 -0
  222. package/docs/03-concepts/architecture.md +248 -0
  223. package/docs/03-concepts/mechanisms-explained.md +124 -0
  224. package/docs/03-concepts/pipeline.md +278 -0
  225. package/docs/03-concepts/traceability.md +152 -0
  226. package/docs/04-operations/README.md +33 -0
  227. package/docs/04-operations/bug-flow.md +364 -0
  228. package/docs/04-operations/publishing.md +154 -0
  229. package/docs/04-operations/sync-and-update.md +522 -0
  230. package/docs/05-reference/README.md +34 -0
  231. package/docs/05-reference/command-cheatsheet.md +147 -0
  232. package/docs/05-reference/commands.md +234 -0
  233. package/docs/05-reference/model-selection.md +74 -0
  234. package/docs/05-reference/modules.md +110 -0
  235. package/docs/05-reference/trace-schema.md +154 -0
  236. package/docs/06-commands/README.md +75 -0
  237. package/docs/06-commands/explain-debug.md +32 -0
  238. package/docs/06-commands/explain-define-product.md +43 -0
  239. package/docs/06-commands/explain-dev-gen-test.md +28 -0
  240. package/docs/06-commands/explain-dev-run-test.md +24 -0
  241. package/docs/06-commands/explain-dev-smoke-test.md +25 -0
  242. package/docs/06-commands/explain-fix-bug.md +28 -0
  243. package/docs/06-commands/explain-generate-bdd.md +45 -0
  244. package/docs/06-commands/explain-generate-code.md +53 -0
  245. package/docs/06-commands/explain-generate-design-spec.md +54 -0
  246. package/docs/06-commands/explain-generate-prd.md +45 -0
  247. package/docs/06-commands/explain-generate-spec-manifest.md +20 -0
  248. package/docs/06-commands/explain-generate-tech-docs.md +56 -0
  249. package/docs/06-commands/explain-learn.md +21 -0
  250. package/docs/06-commands/explain-map-testids.md +28 -0
  251. package/docs/06-commands/explain-propose-scenario.md +24 -0
  252. package/docs/06-commands/explain-qc-analyze.md +22 -0
  253. package/docs/06-commands/explain-qc-design-test.md +20 -0
  254. package/docs/06-commands/explain-qc-plan.md +21 -0
  255. package/docs/06-commands/explain-qc-report.md +23 -0
  256. package/docs/06-commands/explain-qc-review.md +24 -0
  257. package/docs/06-commands/explain-qc-run-test.md +27 -0
  258. package/docs/06-commands/explain-refine-prd.md +51 -0
  259. package/docs/06-commands/explain-report-bug.md +24 -0
  260. package/docs/06-commands/explain-review-code.md +45 -0
  261. package/docs/06-commands/explain-review-context.md +68 -0
  262. package/docs/06-commands/explain-review-tech-docs.md +45 -0
  263. package/docs/06-commands/explain-setup-ai-first.md +25 -0
  264. package/docs/06-commands/explain-sync.md +24 -0
  265. package/docs/06-commands/explain-update-framework.md +22 -0
  266. package/docs/06-commands/explain-validate-traces.md +25 -0
  267. package/docs/README.md +53 -0
  268. package/docs/t-sample.md +826 -0
  269. package/hooks/data-guard.js +141 -0
  270. package/hooks/settings.json +18 -0
  271. package/modules/android-compose/module.yaml +13 -0
  272. package/modules/android-compose/stack-profile.yaml +57 -0
  273. package/modules/angular/architecture-snippets/component-patterns.md +187 -0
  274. package/modules/angular/module.yaml +6 -0
  275. package/modules/angular/stack-profile.yaml +38 -0
  276. package/modules/context-engineering/architecture-snippets/context-design.md +119 -0
  277. package/modules/context-engineering/module.yaml +9 -0
  278. package/modules/context-engineering/stack-profile.yaml +61 -0
  279. package/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
  280. package/modules/dotnet/module.yaml +6 -0
  281. package/modules/dotnet/stack-profile.yaml +50 -0
  282. package/modules/flutter/module.yaml +14 -0
  283. package/modules/flutter/stack-profile.yaml +59 -0
  284. package/modules/golang/architecture-snippets/domain-layout.md +283 -0
  285. package/modules/golang/module.yaml +6 -0
  286. package/modules/golang/stack-profile.yaml +40 -0
  287. package/modules/ios-swiftui/module.yaml +13 -0
  288. package/modules/ios-swiftui/stack-profile.yaml +55 -0
  289. package/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
  290. package/modules/java-spring/module.yaml +15 -0
  291. package/modules/java-spring/stack-profile.yaml +28 -0
  292. package/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
  293. package/modules/nextjs/module.yaml +14 -0
  294. package/modules/nextjs/stack-profile.yaml +74 -0
  295. package/modules/nuxt/module.yaml +14 -0
  296. package/modules/nuxt/stack-profile.yaml +58 -0
  297. package/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
  298. package/modules/php-laravel/module.yaml +15 -0
  299. package/modules/php-laravel/stack-profile.yaml +56 -0
  300. package/modules/qc-playwright/stack-profile.yaml +66 -0
  301. package/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
  302. package/modules/react/module.yaml +14 -0
  303. package/modules/react/stack-profile.yaml +63 -0
  304. package/modules/react-native/module.yaml +14 -0
  305. package/modules/react-native/stack-profile.yaml +56 -0
  306. package/modules/vue/module.yaml +14 -0
  307. package/modules/vue/stack-profile.yaml +65 -0
  308. package/package.json +49 -0
  309. package/readme.txt +1 -0
  310. package/rules/data-protection.md +80 -0
  311. package/rules/workflow.md +44 -0
  312. package/scripts/init.sh +49 -0
  313. package/scripts/migrate-specs.js +258 -0
  314. package/scripts/rename-prd-files.js +174 -0
  315. package/scripts/upgrade.sh +94 -0
  316. package/skills/code/SKILL.md +19 -0
  317. package/skills/code/SKILL.tmpl +19 -0
  318. package/skills/debug/SKILL.md +19 -0
  319. package/skills/debug/SKILL.tmpl +19 -0
  320. package/skills/design-spec/SKILL.md +11 -0
  321. package/skills/design-spec/SKILL.tmpl +11 -0
  322. package/skills/discovery/SKILL.md +14 -0
  323. package/skills/discovery/SKILL.tmpl +14 -0
  324. package/skills/prd/SKILL.md +19 -0
  325. package/skills/prd/SKILL.tmpl +19 -0
  326. package/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  327. package/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
  328. package/skills/qc/qa-analyst/business-rules.md +59 -0
  329. package/skills/qc/qa-analyst/data-flow.md +64 -0
  330. package/skills/qc/qa-analyst/spec-breakdown.md +61 -0
  331. package/skills/qc/qa-designer/e2e/journey.md +41 -0
  332. package/skills/qc/qa-designer/exploratory/charter.md +68 -0
  333. package/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  334. package/skills/qc/qa-designer/functional/api.md +45 -0
  335. package/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  336. package/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  337. package/skills/qc/qa-designer/integration/api.md +42 -0
  338. package/skills/qc/qa-designer/integration/db.md +39 -0
  339. package/skills/qc/qa-designer/integration/gui.md +40 -0
  340. package/skills/qc/qa-designer/integration/kafka.md +40 -0
  341. package/skills/qc/qa-designer/non-functional.md +40 -0
  342. package/skills/qc/qa-planner/test-plan.md +120 -0
  343. package/skills/qc/qa-reviewer/script/e2e.md +87 -0
  344. package/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  345. package/skills/qc/qa-reviewer/script/functional.md +101 -0
  346. package/skills/qc/qa-reviewer/script/integration.md +91 -0
  347. package/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  348. package/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  349. package/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  350. package/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  351. package/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  352. package/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  353. package/skills/qc/qa-runner/e2e.md +49 -0
  354. package/skills/qc/qa-runner/exploratory/session.md +36 -0
  355. package/skills/qc/qa-runner/functional/api.md +35 -0
  356. package/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  357. package/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  358. package/skills/qc/qa-runner/integration.md +47 -0
  359. package/skills/qc/qa-runner/non-functional.md +49 -0
  360. package/skills/qc/qa-runner/report/report.md +37 -0
  361. package/skills/setup-ai-first/SKILL.md +11 -0
  362. package/skills/setup-ai-first/SKILL.tmpl +11 -0
  363. package/skills/spec/SKILL.md +19 -0
  364. package/skills/spec/SKILL.tmpl +19 -0
  365. package/skills/test/SKILL.md +18 -0
  366. package/skills/test/SKILL.tmpl +18 -0
  367. package/steps/business-language.md +56 -0
  368. package/steps/capture-lesson.md +79 -0
  369. package/steps/context-loader.md +311 -0
  370. package/steps/gate.md +88 -0
  371. package/steps/report-footer.md +100 -0
  372. package/steps/review-fanout.md +159 -0
  373. package/steps/spawn-agent.md +129 -0
  374. package/steps/trace-mirror.md +26 -0
  375. package/templates/architecture.template.md +113 -0
  376. package/templates/design-spec.template.md +217 -0
  377. package/templates/feature.template +120 -0
  378. package/templates/platform-guide.template.md +145 -0
  379. package/templates/prd.template.md +224 -0
  380. package/templates/product-definition.template.md +188 -0
  381. package/templates/project-context.yaml +161 -0
  382. package/templates/tech-design.template.md +498 -0
@@ -0,0 +1,429 @@
1
+ # /validate-traces — Traceability Coverage Matrix
2
+
3
+ Check read-only độ phủ giữa spec, code, và test — gồm cả PRD version drift.
4
+
5
+ ## Gate
6
+ {{include:steps/gate.md}}
7
+
8
+ *Lưu ý: Với lệnh này, target ở Bước 1 là một tên domain hoặc UC-ID cụ thể từ `$ARGUMENTS`. Không có một file đơn để phân giải — lệnh quét nhiều thư mục.*
9
+
10
+ ## Context
11
+ {{include:steps/context-loader.md}}
12
+
13
+ ---
14
+
15
+ ## Process
16
+
17
+ ### Step 0 — Umbrella Mode Detection
18
+
19
+ Kiểm tra mảng `services` có tồn tại trong `project-context.yaml` không.
20
+
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 là trường hợp phổ biến.
24
+ - **Else (không có 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 nó bất kể dev đứng ở submodule nào)*
29
+ - Else (umbrella không có 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 là cái làm view không rỗng khi dev mở một service submodule trực tiếp.
31
+
32
+ **Nếu không có key `services` (single-service mode):**
33
+ - Set `all_trace_dirs = [ {paths.trace_dir} ]`
34
+ - Không cần umbrella sync
35
+
36
+ ---
37
+
38
+ ### Step 1 — Nạp dữ liệu TSV
39
+
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
+
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 có domain filter).
43
+
44
+ Mỗi file cho trace state đã lưu của UC đó.
45
+
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 là `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
+
53
+ ### Step 2 — Reconcile với file `.feature` hiện tại
54
+
55
+ Mỗi file trace là `{UC-ID}-{platform}.tsv` (một sổ / UC × platform). Với mỗi row, đọc file `.feature` **của đúng platform đó** (`{specs_dir}/{domain}/{prd-slug}/bdd/{platform}/{UC-ID}*.feature` — platform lấy từ tên file TSV) và 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
+
58
+ Cũng phát hiện SC có trong `.feature` (platform đó) nhưng thiếu trong `.tsv` → thêm row mới với `status: UNTRACKED`. *(sc_id trùng số giữa các platform là 2 scenario khác nhau → mỗi sổ platform giữ tập SC riêng, không dedupe chéo platform.)*
59
+
60
+ ### Step 3 — Tính `status` theo từng scenario
61
+
62
+ Áp dụng quy tắc theo thứ tự ưu tiên (first-match-wins):
63
+
64
+ | Rule | Status | Điều kiện |
65
+ |------|--------|-----------|
66
+ | 1 | `UNTRACKED` | `implemented_by == —` (chưa sinh code) |
67
+ | 2 | `DRIFT` | `implemented_by != —` AND `spec_ver != gen_ver` (spec đã đổi sau lần codegen — code cũ, **ưu tiên regen trước khi test**) |
68
+ | 3 | `GAP` | `implemented_by != —` AND (`test_count == —` OR `test_count == 0`) |
69
+ | 4 | `OK` | tất cả: `spec_ver == gen_ver`, `implemented_by != —`, `test_count > 0` |
70
+
71
+ > **Vì sao DRIFT xét trước GAP:** một scenario đã có code, chưa test, **và** spec vừa drift phải hiện `DRIFT` (không phải `GAP`) — vì `generate-code` xử `GAP` = "skip codegen, chạy /dev-gen-test" còn `DRIFT` = "regenerate". Nếu GAP thắng, code lỗi thời bị bỏ qua và test lại sinh trên code cũ. UNTRACKED vẫn phải là Rule 1 để scenario chưa code (gen_ver `—`) không lọt vào DRIFT.
72
+
73
+ ### Step 4 — PRD version drift check
74
+
75
+ Với mỗi UC, so:
76
+ - PRD `| **Version** |` hiện tại từ `{paths.specs_dir}/{domain}/{prd-slug}/{TICKET-ID}-{prd-slug}.md`
77
+ - `prd_version` lưu trong `.tsv` (version tại thời điểm sinh BDD)
78
+ - `@trace.prd_version` trong các file code implement UC đó
79
+
80
+ Nếu layer nào sau version PRD hiện tại → gắn cờ `PRD_DRIFT` và trích các changelog entry kể từ version đó.
81
+
82
+ ### Step 5 — Tech-doc revision drift check
83
+
84
+ Mỗi PRD có **một** tech-doc gộp `{paths.tech_docs_dir}/{domain}/{prd-slug}/tech-docs/{TICKET-ID}-tech-design.md` với một `@trace.revision` chung. So revision đó vs hai cột đã lưu:
85
+
86
+ - **Backend drift:** `@trace.revision` của doc vs `tech_doc_revision` trong `.tsv`.
87
+ Code sinh từ revision cũ hơn → gắn cờ `TECHDOC_DRIFT`.
88
+ - **FE integration drift:** `@trace.revision` của doc vs `fe_tech_doc_revision` trong `.tsv` (row FE `--phase=integration`, theo từng platform).
89
+ Code FE wire theo revision cũ hơn (§4.5.4 đã đổi) → gắn cờ `FE_TECHDOC_DRIFT`.
90
+
91
+ Skip cột nào chưa có revision đã lưu (`—`), hoặc cả UC chưa có tech-doc.
92
+
93
+ ### Step 5b — Seam & Stub Audit (mồ côi khi ghép luồng)
94
+
95
+ *Bắt lỗi "gen từng BDD thì đúng, ghép cả luồng thì hỏng": chỗ giả lập còn rỗng trong khi hàng thật đã tồn tại ở nơi khác — luồng chạy vào no-op / hàm thật không ai gọi. Build vẫn xanh, test từng-UC vẫn xanh, nên không cổng nào khác bắt được. Hai loại: `seam` (port cross-UC chưa nối) và `stub` (method trắng nội-feature chưa lấp).*
96
+
97
+ **Nguồn (dùng cái nào có, hợp nhất):**
98
+ 1. Sổ chung `{trace_dir}/{domain}/{prd-slug}/_seams.tsv` — do `/generate-code` ghi (cột `kind` phân biệt `seam`/`stub`).
99
+ 2. Quét code dưới `{code_base_package}` (từ CLAUDE.md §2 đã nạp) — bắt cả chỗ sinh **trước khi** có sổ:
100
+ - **seam:** class mang `@trace.seam_pending` HOẶC tên khớp `*Stub*Adapter`.
101
+ - **stub:** method mang `@trace.stub` (thân còn placeholder — `throw UnsupportedOperationException` / TODO / rỗng).
102
+
103
+ **Audit A — Seam (port cross-UC).** Với mỗi seam:
104
+ - Tìm **hàng thật**: class KHÁC (không `*Stub*`/`*Mock*`) implement cùng port/interface dưới `{code_base_package}`.
105
+ - Tìm **binding hiện tại**: stub có còn được tham chiếu như adapter đang dùng không (được inject / `@Primary` / đăng ký trong config) — hàng thật thì KHÔNG có đường vào?
106
+
107
+ | Điều kiện | Cờ | Ý nghĩa |
108
+ |---|---|---|
109
+ | Hàng thật CHƯA tồn tại | `SEAM_PENDING` | Bình thường — owner UC chưa gen. Chỉ nhắc. |
110
+ | Hàng thật ĐÃ tồn tại **và** stub vẫn là binding đang dùng | `SEAM_UNWIRED` 🔴 | **Lỗi thật** — hàng thật mồ côi, luồng chạy vào stub rỗng. |
111
+ | Binding đã trỏ hàng thật (stub chỉ còn cho test) | *(sạch)* | Đã nối xong. |
112
+
113
+ **Audit B — Stub (method trắng nội-feature).** Với mỗi method còn tag `@trace.stub`:
114
+ - Đọc `@trace.stub_owner` (UC lẽ ra phải lấp) + `@trace.stub_for` (trách nhiệm).
115
+ - **Owner đã gen chưa?** = có bất kỳ `@trace.implements={stub_owner}-*` nào trong codebase không.
116
+ - **Có hàng thật song song không?** = method KHÁC mang `@trace.implements` với thân thật cùng trách nhiệm `stub_for` (dấu hiệu BDD owner đã đẻ hàm song song thay vì lấp).
117
+
118
+ | Điều kiện | Cờ | Ý nghĩa |
119
+ |---|---|---|
120
+ | `stub_owner` chưa gen **và** không có hàng song song | `STUB_PENDING` | Bình thường — owner BDD chưa chạy. Chỉ nhắc. |
121
+ | `stub_owner` ĐÃ gen (hoặc có method song song cùng `stub_for`) mà method vẫn còn `@trace.stub` rỗng | `STUB_UNRESOLVED` 🔴 | **Lỗi thật** — hàm trắng mồ côi (caller chạy vào rỗng) và/hoặc hàm thật mồ côi (không ai gọi). Fill-before-create đã trượt. |
122
+ | Không còn method nào mang `@trace.stub` cho trách nhiệm đó | *(sạch)* | Đã lấp xong. |
123
+
124
+ - **Cập nhật sổ `_seams.tsv`** (nếu tồn tại): theo `kind`,
125
+ - `seam`: `PENDING`→`READY` khi hàng thật xuất hiện mà chưa nối; `→RESOLVED` khi binding đã trỏ hàng thật.
126
+ - `stub`: `PENDING`→`READY` khi phát hiện `STUB_UNRESOLVED`; `→RESOLVED` khi method đã được lấp (hết `@trace.stub`).
127
+ `READY` = đồng nghĩa cờ 🔴 tương ứng (`SEAM_UNWIRED` / `STUB_UNRESOLVED`).
128
+
129
+ Không tìm thấy seam/stub nào → bỏ qua im lặng.
130
+
131
+ ### Step 6 — Ghi status lại vào TSV
132
+
133
+ *Bỏ qua step này nếu không có file TSV nào (đã xử lý bởi path no-TSV của Step 1).*
134
+
135
+ Với mỗi file `.tsv` đã xử lý: ghi `spec_ver`, `status`, `last_updated` đã cập nhật lại disk.
136
+ Đồng thời **đồng bộ `uc_status` ← `@trace.status`** của file `.feature` tương ứng (header `.feature` là nguồn-sự-thật về duyệt BDD — người đặt `approved` sau khi review sạch, giống PO đặt PRD Metadata `Status`). Nhờ vậy `approved_ucs` trên dashboard phản ánh đúng thay vì luôn = 0.
137
+ **Đừ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.
138
+
139
+ ### Step 7 — Tính aggregate cho dashboard
140
+
141
+ ```
142
+ total_prds = count distinct PRD files in {paths.specs_dir}/{domain}/*/*.md (file .md ở gốc mỗi feature folder = PRD)
143
+ approved_prds = PRDs with | Status | approved
144
+ total_ucs = count distinct UC-IDs across all .tsv files (strip the -{platform} suffix from the filename)
145
+ approved_ucs = UCs with uc_status == approved
146
+ draft_ucs = UCs with uc_status == draft
147
+ total_scs = total rows across all .tsv files (a UC's SCs are counted per platform — no cross-platform dedupe by sc_id)
148
+ code_coverage = rows where implemented_by != — / total_scs
149
+ test_coverage = rows where test_count > 0 / total_scs
150
+ drift_count = rows where status == DRIFT
151
+ untracked_count = rows where status == UNTRACKED
152
+ gap_count = rows where status == GAP
153
+ seam_unwired_count = số seam bị cờ SEAM_UNWIRED (hàng thật đã có nhưng consumer còn wire vào stub — Step 5b)
154
+ stub_unresolved_count = số stub bị cờ STUB_UNRESOLVED (method còn trắng dù owner đã gen / có hàm song song — Step 5b)
155
+ dev_selftest_passing = rows where dev_selftest == pass
156
+ dev_selftest_failing = rows where dev_selftest == fail
157
+ dev_selftest_not_run = rows where dev_selftest in (not_run, —)
158
+ # NOTE: dev_selftest is the DEV self-check signal (did the dev run their own smoke tests),
159
+ # NOT official coverage — keep it labeled as such on the dashboard.
160
+ qc_passing = rows where qc_status == pass
161
+ qc_failing = rows where qc_status == fail
162
+ qc_skipped = rows where qc_status == skip
163
+ qc_not_run = rows where qc_status in (not_run, —)
164
+ # qc_status is the OFFICIAL QC automation result (set by /qc-run-test),
165
+ # shown alongside — never merged with — dev_selftest.
166
+ waiting_dev = rows where qc_owner == dev # PM view: QC-found, waiting on dev to fix
167
+ waiting_po = rows where qc_owner == po # PM view: blocked, waiting on PO to confirm/clarify
168
+ # qc_owner + qc_blocked_by trả lời "case nào đang chờ ai" — surface as a "Waiting on" column.
169
+ tech_docs_count = count .md files in {paths.tech_docs_dir}/{domain}/*/tech-docs/
170
+ ```
171
+
172
+ ### Step 8 — Ghi JSON report
173
+
174
+ Ghi `{paths.trace_dir}/trace-report.json` (ghi đè nếu tồn tại). File này là source of truth duy nhất cho web dashboard — nó chứa snapshot đầy đủ tại thời điểm `/validate-traces` chạy lần cuối.
175
+
176
+ Schema:
177
+
178
+ ```json
179
+ {
180
+ "generated_at": "<ISO-8601 timestamp>",
181
+ "domain": "<domain argument, or 'all' if no filter>",
182
+ "summary": {
183
+ "total_prds": 0,
184
+ "approved_prds": 0,
185
+ "total_ucs": 0,
186
+ "approved_ucs": 0,
187
+ "draft_ucs": 0,
188
+ "total_scs": 0,
189
+ "coded_scs": 0,
190
+ "tested_scs": 0,
191
+ "code_coverage_pct": 0,
192
+ "test_coverage_pct": 0,
193
+ "drift_count": 0,
194
+ "gap_count": 0,
195
+ "untracked_count": 0,
196
+ "seam_unwired_count": 0,
197
+ "stub_unresolved_count": 0,
198
+ "dev_selftest_passing": 0,
199
+ "dev_selftest_failing": 0,
200
+ "dev_selftest_not_run": 0,
201
+ "qc_passing": 0,
202
+ "qc_failing": 0,
203
+ "qc_skipped": 0,
204
+ "qc_not_run": 0,
205
+ "waiting_dev": 0,
206
+ "waiting_po": 0,
207
+ "tech_docs_count": 0
208
+ },
209
+ "prds": [
210
+ {
211
+ "prd_id": "<e.g. PAY>",
212
+ "prd_status": "approved | draft | other",
213
+ "total_scs": 0,
214
+ "coded_scs": 0,
215
+ "tested_scs": 0,
216
+ "drift_count": 0,
217
+ "gap_count": 0,
218
+ "untracked_count": 0,
219
+ "ucs": [
220
+ {
221
+ "uc_id": "<e.g. PAY-UC01>",
222
+ "uc_status": "approved | draft | other",
223
+ "scenarios": [
224
+ {
225
+ "sc_id": "<e.g. PAY-UC01-SC1>",
226
+ "sc_title": "<title>",
227
+ "spec_ver": "<current version from .feature>",
228
+ "gen_ver": "<version at codegen time>",
229
+ "implemented_by": "<ClassName.method or null>",
230
+ "test_count": 0,
231
+ "test_classes": ["<TestClass1>", "<TestClass2>"],
232
+ "dev_selftest": "pass | fail | not_run",
233
+ "dev_selftest_at": "<YYYY-MM-DD or null>",
234
+ "qc_status": "pass | fail | skip | not_run",
235
+ "qc_run_at": "<YYYY-MM-DD or null>",
236
+ "qc_owner": "dev | po | null",
237
+ "qc_blocked_by": "<BUG-id / GAP-id or null>",
238
+ "prd_version": "<prd version when BDD was generated>",
239
+ "bdd_version": "<bdd version when code was generated>",
240
+ "tech_doc_revision": 0,
241
+ "fe_tech_doc_revision": 0,
242
+ "status": "OK | DRIFT | GAP | UNTRACKED",
243
+ "last_updated": "<YYYY-MM-DD>"
244
+ }
245
+ ]
246
+ }
247
+ ]
248
+ }
249
+ ],
250
+ "issues": {
251
+ "drift": [
252
+ {
253
+ "sc_id": "<SC-ID>",
254
+ "sc_title": "<title>",
255
+ "spec_ver": "<current>",
256
+ "gen_ver": "<at codegen>",
257
+ "fix": "/generate-code <UC-ID>"
258
+ }
259
+ ],
260
+ "gap": [
261
+ {
262
+ "sc_id": "<SC-ID>",
263
+ "sc_title": "<title>",
264
+ "implemented_by": "<method>",
265
+ "fix": "/dev-gen-test <UC-ID>"
266
+ }
267
+ ],
268
+ "untracked": [
269
+ {
270
+ "sc_id": "<SC-ID>",
271
+ "sc_title": "<title>",
272
+ "fix": "/generate-code <UC-ID>"
273
+ }
274
+ ],
275
+ "prd_version_drift": [
276
+ {
277
+ "uc_id": "<UC-ID>",
278
+ "code_prd_version": "<version in code tag>",
279
+ "current_prd_version": "<version in PRD file>",
280
+ "changelog_since": ["<v1.1: ...>", "<v1.2: ...>"],
281
+ "fix": "/generate-bdd <prd-file> then /generate-code <UC-ID>"
282
+ }
283
+ ],
284
+ "techdoc_drift": [
285
+ {
286
+ "uc_id": "<UC-ID>",
287
+ "code_revision": 0,
288
+ "current_revision": 0,
289
+ "fix": "/generate-code <UC-ID>"
290
+ }
291
+ ],
292
+ "fe_techdoc_drift": [
293
+ {
294
+ "uc_id": "<UC-ID>",
295
+ "platform": "web | app",
296
+ "code_revision": 0,
297
+ "current_revision": 0,
298
+ "fix": "/generate-code <UC-ID> --phase=integration"
299
+ }
300
+ ],
301
+ "seam_unwired": [
302
+ {
303
+ "port": "<PortName>",
304
+ "consumer_uc": "<UC còn gọi stub>",
305
+ "owner_uc": "<UC sở hữu hàng thật>",
306
+ "stub_class": "<StubClass>",
307
+ "real_class": "<RealClass>",
308
+ "fix": "Trỏ binding của <consumer_uc> sang <RealClass> (xoá/thay stub), build lại"
309
+ }
310
+ ],
311
+ "stub_unresolved": [
312
+ {
313
+ "artifact": "<ClassName#method>",
314
+ "stub_for": "<trách nhiệm>",
315
+ "consumer_uc": "<UC để trắng>",
316
+ "owner_uc": "<UC lẽ ra phải lấp>",
317
+ "parallel_impl": "<ClassName#method hàm song song, hoặc null>",
318
+ "fix": "/generate-code <owner_uc> — lấp logic vào <ClassName#method> tại chỗ (Fill-before-create), xoá hàm song song nếu có, build lại"
319
+ }
320
+ ]
321
+ }
322
+ }
323
+ ```
324
+
325
+ **Rules:**
326
+ - `implemented_by`: dùng `null` (không phải `"—"`) trong JSON khi không có giá trị
327
+ - `test_count`: dùng integer `0` (không phải `"—"`) khi không có test
328
+ - `test_classes`: dùng `[]` (không phải `"—"`) khi không có test class
329
+ - `tech_doc_revision` / `fe_tech_doc_revision`: dùng integer; `0` nếu chưa sinh
330
+ - `code_coverage_pct` / `test_coverage_pct`: làm tròn về integer gần nhất (0–100)
331
+ - Luôn ghi vào `{paths.trace_dir}/trace-report.json` bất kể domain filter — nếu có domain filter, chỉ gồm các PRD đó trong `prds[]` nhưng ghi domain vào field `domain`
332
+ - **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`
333
+ - **Backward-compat:** TSV cũ có thể thiếu cột mới hơn trong header — coi cột vắng nào là 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.
334
+
335
+ ### Step 8b — Living Docs Sync *(chỉ umbrella mode)*
336
+
337
+ *Bỏ qua step này ở single-service mode.*
338
+
339
+ **Với `spec_source` được set,** các trace TSV authoritative đã sống ở **một** chỗ —
340
+ `{spec_source}/.trace/` (committed trong spec repo). **Không có merge theo service**:
341
+ mỗi scenario row mang service sở hữu qua `@trace.service`. Step này chỉ
342
+ (re)generate report và làm mới panel local.
343
+
344
+ 1. **Ghi report** vào `{living_docs_dir}/trace-report.json` (`mkdir -p` trước) — dựng
345
+ trực tiếp từ `{spec_source}/.trace/*.tsv`, với field `"service"` mỗi scenario row và
346
+ các summary aggregate. *(Umbrella legacy không-`spec_source` vẫn merge mọi `trace-report.json`
347
+ theo service thành một document, namespace theo service.)*
348
+
349
+ 2. **Mirror tới panel location** `{panel_mirror}` (`./.trace` ở gốc workspace hiện tại)
350
+ để dev mở *repo này* thấy data ngay: copy
351
+ `{living_docs_dir}/trace-report.json` (+ các file `{UC-ID}-{platform}.tsv`) → `{panel_mirror}/`.
352
+ Nếu `panel_mirror` đã phân giải về `{spec_source}/.trace`, skip.
353
+
354
+ 3. **In sync summary:**
355
+ ```
356
+ Living Docs → {living_docs_dir}/trace-report.json ({total} scenarios across {S} services)
357
+ Trace (authoritative) → {spec_source}/.trace/ (committed in spec repo)
358
+ Panel mirror → {panel_mirror}/trace-report.json (current workspace)
359
+ ```
360
+
361
+ > **Lưu ý:** trace state committed, authoritative là `{spec_source}/.trace/*.tsv` (trong
362
+ > spec repo — một chỗ cho PM). Report (`.living-docs/`) và panel mirror
363
+ > (`./.trace` ở workspace không phải spec repo) là **sinh ra** — gitignore chúng;
364
+ > chúng được regenerate bởi `/validate-traces` hoặc `/sync`.
365
+
366
+ ## Output
367
+
368
+ {{include:steps/report-footer.md}}
369
+
370
+ ```
371
+ /validate-traces — {domain}
372
+
373
+ 📄 {paths.trace_dir}/trace-report.json ← updated
374
+
375
+ ┌─────────────────────────────────────────────────────────────────────────────────────┐
376
+ │ PRDs Use Cases Scenarios Code Cov. Test Cov. Drift Untracked Gap │
377
+ │ {N} {N} {N} {N}% {N}% {N} {N} {N} │
378
+ │ {A} appr {A} appr {X}/{T} SCs {X}/{T} SCs │
379
+ └─────────────────────────────────────────────────────────────────────────────────────┘
380
+ {nếu seam_unwired_count > 0 hoặc stub_unresolved_count > 0, in dòng GATE — ngược lại bỏ}
381
+ 🔴 GATE — luồng ghép có MỒ CÔI: {seam_unwired_count} SEAM_UNWIRED + {stub_unresolved_count} STUB_UNRESOLVED.
382
+ Build/test từng-UC vẫn xanh nhưng luồng to chạy vào no-op / hàm thật không ai gọi.
383
+ KHÔNG coi là pass tới khi cả hai = 0 (xem Seam & Stub Audit bên dưới).
384
+
385
+ | UC-ID | SC | Title (truncated) | Spec | Gen | Code | Tests | Status |
386
+ |-------------|------|------------------------------|-------|-------|----------------------|----------------|----------|
387
+ | {UC}-UC1 | SC1 | {title...} | v1.0 | v1.0 | ✅ {Controller.fn} | ✅ 10 tests | OK |
388
+ | {UC}-UC1 | SC2 | {title...} | v1.1 | v1.0 | ✅ {Controller.fn} | ✅ 3 tests | DRIFT |
389
+ | {UC}-UC1 | SC6 | {title...} | v1.0 | — | — | — | UNTRACKED|
390
+ | {UC}-UC2 | SC1 | {title...} | v1.0 | v1.0 | ✅ {Controller.fn} | — | GAP |
391
+
392
+ Drift Detail:
393
+ {UC}-UC1-SC2 — spec v1.1 nhưng code sinh từ v1.0
394
+ → Chạy lại: /generate-code {UC-ID}
395
+
396
+ PRD Version Drift:
397
+ {UC}-UC2 — code ở PRD v1.0, PRD giờ ở v1.2
398
+ Thay đổi kể từ v1.0:
399
+ v1.1: {changelog entry}
400
+ v1.2: {changelog entry}
401
+ → /generate-bdd {prd-file} then /generate-code {UC-ID}
402
+
403
+ Tech-Doc Revision Drift:
404
+ {UC}-UC3 — code sinh từ tech-doc revision 2, giờ ở revision 4
405
+ → Review thay đổi tech-doc rồi /generate-code {UC-ID}
406
+
407
+ Seam & Stub Audit (mồ côi khi ghép luồng):
408
+ 🔴 SEAM_UNWIRED — {port}: {consumer_uc} còn gọi {stub_class} rỗng,
409
+ hàng thật {real_class} ({owner_uc}) chưa được nối → luồng ghép chạy vào no-op
410
+ → Trỏ binding {consumer_uc} sang {real_class}, xoá/thay stub, build lại
411
+ ⓘ SEAM_PENDING — {port}: {consumer_uc} đang dùng stub, owner {owner_uc} chưa gen (chưa phải lỗi)
412
+ 🔴 STUB_UNRESOLVED — {ClassName#method} ({stub_for}): {consumer_uc} để trắng, owner {owner_uc} đã gen
413
+ {parallel_impl → "đẻ hàm song song " + parallel_impl | ""}→ hàm trắng mồ côi / hàm thật không ai gọi
414
+ → /generate-code {owner_uc} lấp logic vào {ClassName#method} tại chỗ, xoá hàm song song, build lại
415
+ ⓘ STUB_PENDING — {ClassName#method} ({stub_for}): owner {owner_uc} chưa gen (chưa phải lỗi)
416
+
417
+ Recommendations:
418
+ - /generate-code {UC-ID} cho scenario DRIFT và UNTRACKED
419
+ - /dev-gen-test {UC-ID} cho GAP (thiếu test)
420
+ - /generate-bdd {prd-file} cho PRD version drift
421
+ - Nối binding thủ công cho mỗi SEAM_UNWIRED 🔴 (hàng thật đã có, còn kẹt stub)
422
+ - /generate-code {owner_uc} cho mỗi STUB_UNRESOLVED 🔴 (lấp method trắng tại chỗ + xoá hàm song song)
423
+
424
+ [Chỉ umbrella mode]
425
+ Living Docs canonical → {living_docs_dir}/ (specs module — shared, gitignored)
426
+ Panel mirror → {panel_mirror}/trace-report.json (current workspace)
427
+ Tip: chạy /validate-traces (hoặc /sync) sau mỗi phiên codegen để làm mới panel.
428
+ Cả hai là mirror sinh ra — đừng commit (.living-docs/ + .trace/ trong .gitignore).
429
+ ```
@@ -0,0 +1 @@
1
+ 0.1.0