@educa-corp/sdd-framework 0.4.2 → 0.6.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 (149) hide show
  1. package/bin/build.js +113 -19
  2. package/bin/gate-trace.js +464 -0
  3. package/bin/index.js +418 -146
  4. package/bin/lint-trace.js +602 -0
  5. package/bin/self-check.js +499 -6
  6. package/bin/trace-schema.json +1449 -692
  7. package/commands/debug.md +123 -510
  8. package/commands/debug.tmpl +3 -0
  9. package/commands/define-product.md +86 -509
  10. package/commands/dev-gen-test.md +120 -516
  11. package/commands/dev-run-test.md +120 -516
  12. package/commands/dev-smoke-test.md +86 -509
  13. package/commands/extend-prd.md +486 -0
  14. package/commands/extend-prd.tmpl +273 -0
  15. package/commands/fix-bug.md +152 -515
  16. package/commands/generate-architecture.md +94 -514
  17. package/commands/generate-architecture.tmpl +3 -0
  18. package/commands/generate-bdd.md +138 -519
  19. package/commands/generate-bdd.tmpl +18 -3
  20. package/commands/generate-code.md +156 -523
  21. package/commands/generate-code.tmpl +36 -7
  22. package/commands/generate-design-spec.md +86 -509
  23. package/commands/generate-prd.md +114 -509
  24. package/commands/generate-prd.tmpl +28 -0
  25. package/commands/generate-spec-manifest.md +86 -509
  26. package/commands/generate-tech-docs.md +86 -509
  27. package/commands/learn.md +172 -495
  28. package/commands/learn.tmpl +70 -3
  29. package/commands/map-testids.md +86 -509
  30. package/commands/propose-scenario.md +136 -508
  31. package/commands/propose-scenario.tmpl +52 -1
  32. package/commands/qc-analyze.md +86 -509
  33. package/commands/qc-design-test.md +87 -509
  34. package/commands/qc-design-test.tmpl +1 -0
  35. package/commands/qc-plan.md +86 -509
  36. package/commands/qc-report.md +86 -509
  37. package/commands/qc-review.md +86 -509
  38. package/commands/qc-run-test.md +133 -517
  39. package/commands/qc-run-test.tmpl +13 -1
  40. package/commands/refine-prd.md +99 -519
  41. package/commands/refine-prd.tmpl +3 -0
  42. package/commands/report-bug.md +86 -509
  43. package/commands/review-code.md +127 -513
  44. package/commands/review-code.tmpl +7 -3
  45. package/commands/review-context.md +96 -515
  46. package/commands/review-context.tmpl +6 -2
  47. package/commands/review-tech-docs.md +90 -510
  48. package/commands/review-tech-docs.tmpl +3 -0
  49. package/commands/setup-ai-first.md +166 -137
  50. package/commands/setup-ai-first.tmpl +72 -0
  51. package/commands/sync.md +86 -118
  52. package/commands/sync.tmpl +84 -16
  53. package/commands/update-framework.md +16 -102
  54. package/commands/update-framework.tmpl +14 -0
  55. package/commands/validate-traces.md +458 -531
  56. package/commands/validate-traces.tmpl +381 -31
  57. package/core/FRAMEWORK_VERSION +1 -1
  58. package/core/README.md +20 -0
  59. package/core/commands/debug.md +123 -510
  60. package/core/commands/define-product.md +86 -509
  61. package/core/commands/dev-gen-test.md +120 -516
  62. package/core/commands/dev-run-test.md +120 -516
  63. package/core/commands/dev-smoke-test.md +86 -509
  64. package/core/commands/extend-prd.md +486 -0
  65. package/core/commands/fix-bug.md +152 -515
  66. package/core/commands/generate-architecture.md +94 -514
  67. package/core/commands/generate-bdd.md +138 -519
  68. package/core/commands/generate-code.md +156 -523
  69. package/core/commands/generate-design-spec.md +86 -509
  70. package/core/commands/generate-prd.md +114 -509
  71. package/core/commands/generate-spec-manifest.md +86 -509
  72. package/core/commands/generate-tech-docs.md +86 -509
  73. package/core/commands/learn.md +172 -495
  74. package/core/commands/map-testids.md +86 -509
  75. package/core/commands/propose-scenario.md +136 -508
  76. package/core/commands/qc-analyze.md +86 -509
  77. package/core/commands/qc-design-test.md +87 -509
  78. package/core/commands/qc-plan.md +86 -509
  79. package/core/commands/qc-report.md +86 -509
  80. package/core/commands/qc-review.md +86 -509
  81. package/core/commands/qc-run-test.md +133 -517
  82. package/core/commands/refine-prd.md +99 -519
  83. package/core/commands/report-bug.md +86 -509
  84. package/core/commands/review-code.md +127 -513
  85. package/core/commands/review-context.md +96 -515
  86. package/core/commands/review-tech-docs.md +90 -510
  87. package/core/commands/setup-ai-first.md +166 -137
  88. package/core/commands/sync.md +86 -118
  89. package/core/commands/update-framework.md +16 -102
  90. package/core/commands/validate-traces.md +458 -531
  91. package/core/hooks/data-guard.js +174 -83
  92. package/core/hooks/settings.json +2 -1
  93. package/core/rules/workflow.md +48 -4
  94. package/core/steps/capture-lesson.md +34 -1
  95. package/core/steps/context-loader.md +24 -3
  96. package/core/steps/gate.md +92 -35
  97. package/core/steps/report-footer.md +26 -2
  98. package/core/steps/trace-mirror.md +34 -7
  99. package/core/templates/README.md +24 -1
  100. package/core/templates/ci/trace-gate.yml +146 -0
  101. package/core/templates/feature.template +1 -1
  102. package/core/templates/hooks/pre-push +61 -0
  103. package/docs/01-getting-started/installation.md +18 -1
  104. package/docs/01-getting-started/what-is-sdd.md +4 -2
  105. package/docs/02-concepts/architecture.md +48 -5
  106. package/docs/02-concepts/pipeline-steps/02-specification.md +39 -3
  107. package/docs/02-concepts/pipeline-steps/04-bdd.md +24 -2
  108. package/docs/02-concepts/pipeline-steps/05-tech-docs.md +18 -1
  109. package/docs/02-concepts/pipeline-steps/06-code.md +35 -4
  110. package/docs/02-concepts/pipeline-steps/09-validate-traces.md +137 -12
  111. package/docs/02-concepts/pipeline-steps/10-feedback-loop.md +59 -3
  112. package/docs/02-concepts/roles-and-hitl.md +1 -1
  113. package/docs/02-concepts/traceability.md +183 -117
  114. package/docs/03-guides/architect.md +63 -0
  115. package/docs/03-guides/developer.md +20 -4
  116. package/docs/03-guides/product-owner.md +72 -68
  117. package/docs/03-guides/tester-qa.md +81 -70
  118. package/docs/04-reference/commands.md +134 -105
  119. package/docs/04-reference/configuration.md +146 -94
  120. package/docs/04-reference/model-selection.md +32 -19
  121. package/docs/04-reference/trace-schema.md +26 -9
  122. package/docs/explain/02-generate-prd.md +80 -78
  123. package/docs/explain/02b-extend-prd.md +125 -0
  124. package/docs/explain/03-refine-prd.md +86 -86
  125. package/docs/explain/04-review-context.md +18 -1
  126. package/docs/explain/06-generate-bdd.md +23 -0
  127. package/docs/explain/08-review-tech-docs.md +20 -5
  128. package/docs/explain/10-review-code.md +36 -2
  129. package/docs/explain/19-qc-run-test.md +87 -67
  130. package/docs/explain/21-validate-traces.md +75 -68
  131. package/docs/explain/23-fix-bug.md +19 -3
  132. package/docs/explain/26-propose-scenario.md +70 -63
  133. package/docs/explain/27-learn.md +5 -3
  134. package/docs/explain/README.md +135 -134
  135. package/hooks/data-guard.js +174 -83
  136. package/hooks/settings.json +2 -1
  137. package/package.json +53 -50
  138. package/rules/workflow.md +48 -4
  139. package/steps/capture-lesson.md +34 -1
  140. package/steps/context-loader.md +24 -3
  141. package/steps/gate.md +92 -35
  142. package/steps/report-footer.md +26 -2
  143. package/steps/trace-mirror.md +34 -7
  144. package/templates/README.md +24 -1
  145. package/templates/ci/trace-gate.yml +146 -0
  146. package/templates/feature.template +1 -1
  147. package/templates/hooks/pre-push +61 -0
  148. package/scripts/init.sh +0 -49
  149. package/scripts/upgrade.sh +0 -94
@@ -3,8 +3,10 @@
3
3
  Bắt một lỗi mà AI cứ lặp lại để nó **không bị lặp nữa**. Lesson được lưu trong file
4
4
  lessons của dự án này và nạp vào context ở đầu mỗi lệnh.
5
5
 
6
- Usage: `/learn {free-text}` — lý tưởng diễn đạt kiểu "AI làm X, nên làm Y".
7
- dụ: `/learn AI cứ gọi repository trực tiếp từ controller phải đi qua service layer`
6
+ Usage:
7
+ - `/learn {free-text}` ghi lesson mới. tưởng diễn đạt kiểu "AI làm X, nên làm Y".
8
+ Ví dụ: `/learn AI cứ gọi repository trực tiếp từ controller — nó phải đi qua service layer`
9
+ - **`/learn --review`** — rà lại lesson đang có, đề nghị retire cái đã hết đúng.
8
10
 
9
11
  > Đây là **bộ nhớ dự án**, không phải fine-tune model. Lesson trở thành guardrail đang hoạt động nhờ
10
12
  > được inject vào context mỗi lần chạy (xem context-loader Bước 6.7).
@@ -19,6 +21,53 @@ Ví dụ: `/learn AI cứ gọi repository trực tiếp từ controller — nó
19
21
 
20
22
  ---
21
23
 
24
+ ## Step 0 — Chế độ `--review` *(nếu `$ARGUMENTS` chứa `--review`)*
25
+
26
+ *Chạy nhánh này rồi DỪNG — không đi tiếp Step 1/2.*
27
+
28
+ Đọc `lessons_path` (đã phân giải ở context-loader Bước 6.7), parse **mọi** lesson kể cả
29
+ `Status: retired`. Với mỗi lesson `active`, phân loại:
30
+
31
+ **🔴 Đề nghị retire — kiểm được bằng máy.** `Scope` là một **file glob** (vd `*ServiceImpl.java`)
32
+ mà glob đó **không còn khớp file nào** trong repo → code lesson canh đã không còn tồn tại.
33
+
34
+ **⚠️ Rà lại — không tự kiểm được.** `Scope` là `all` hoặc một domain (không phải glob file), **và**
35
+ `Date` cũ hơn 6 tháng. Không suy ra được nó còn đúng hay không — chỉ liệt kê theo tuổi để người quyết.
36
+
37
+ **✅ Còn sống.** Scope là glob và còn khớp ≥1 file.
38
+
39
+ In:
40
+
41
+ ```
42
+ /learn --review — {tổng} lesson ({n_active} active · {n_retired} retired)
43
+
44
+ 🔴 Đề nghị retire — Scope không còn khớp file nào:
45
+ L-003 [code-gen] *RestTemplate*.java · ghi 2026-08 · 0 file khớp
46
+ Rule: Luôn dùng WebClient thay RestTemplate
47
+ L-011 [tests] *LegacyApiTest.java · ghi 2026-11 · 0 file khớp
48
+
49
+ ⚠️ Rà lại — scope rộng, không tự kiểm được:
50
+ L-002 [general] scope: all · ghi 2026-07 (13 tháng)
51
+
52
+ ✅ {n} lesson còn sống, scope vẫn khớp
53
+
54
+ Retire cái nào? (nhập id cách nhau bởi dấu phẩy, hoặc Enter để bỏ qua)
55
+ ```
56
+
57
+ Người dùng nhập id → với mỗi id, **đổi `Status: active` → `retired`** và **chèn** dòng
58
+ `- **Retired**: {hôm nay} — {lý do ngắn}` ngay dưới. **KHÔNG xoá dòng nào** (xem
59
+ `capture-lesson.md` §Retire — lesson retired ở lại làm lịch sử).
60
+
61
+ Không có lesson nào → in `Chưa có lesson nào được ghi nhận.` rồi dừng.
62
+
63
+ > **Vì sao lệnh này tồn tại (GAPS-v3 G46):** trước nó, file lessons **chỉ có đường vào** —
64
+ > `/learn`, `/review-code`, `/fix-bug`, `/debug` đều ghi thêm được, không gì gỡ ra. Mỗi lesson
65
+ > được nạp làm *"ràng buộc cứng, cùng mức ưu tiên với CLAUDE.md"*, **vĩnh viễn**, kể cả khi code
66
+ > nó canh đã bị xoá. Nhóm 🔴 ở trên là **cơ học, không phải phỏng đoán**: glob không khớp file
67
+ > nào thì lesson đó đã chết, không cần tranh luận.
68
+
69
+ ---
70
+
22
71
  ## Step 1 — Parse Lesson
23
72
 
24
73
  Đọc `$ARGUMENTS` như một mô tả free-text.
@@ -53,7 +102,7 @@ Hiện lesson đã parse và hỏi `Lưu lesson này? (Y/N)` trước khi ghi.
53
102
  Scope : {scope}
54
103
  File : {lessons_path}
55
104
 
56
- Guardrail này giờ được nạp ở đầu mỗi lệnh.
105
+ Guardrail này giờ được nạp ở đầu mỗi lệnh có category khớp (+ general).
57
106
  Commit {lessons_path} để team dùng chung.
58
107
 
59
108
  ---
@@ -61,3 +110,21 @@ Status : ✅ Complete
61
110
  Output Artifacts: updated {lessons_path}
62
111
  Next : tiếp tục làm việc — AI sẽ tôn trọng lesson này từ giờ
63
112
  ```
113
+
114
+ **Chế độ `--review`** dùng report riêng:
115
+
116
+ ```
117
+ /learn --review — {n} lesson đã retire
118
+
119
+ 🔻 L-003 [code-gen] active → retired
120
+ lý do: Scope *RestTemplate*.java không còn khớp file nào
121
+ 🔻 L-011 [tests] active → retired
122
+
123
+ Chúng vẫn ở lại trong {lessons_path} làm lịch sử — chỉ thôi được nạp làm ràng buộc.
124
+ Còn lại {n_active} guardrail đang hoạt động.
125
+
126
+ ---
127
+ Status : ✅ Complete
128
+ Output Artifacts: updated {lessons_path}
129
+ Next : commit {lessons_path}
130
+ ```