@educa-corp/sdd-framework 0.5.0 → 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.
- package/bin/build.js +113 -19
- package/bin/gate-trace.js +464 -0
- package/bin/index.js +418 -146
- package/bin/lint-trace.js +602 -0
- package/bin/self-check.js +376 -1
- package/bin/trace-schema.json +252 -2
- package/commands/debug.md +123 -511
- package/commands/debug.tmpl +3 -0
- package/commands/define-product.md +86 -510
- package/commands/dev-gen-test.md +86 -510
- package/commands/dev-run-test.md +86 -510
- package/commands/dev-smoke-test.md +86 -510
- package/commands/extend-prd.md +89 -510
- package/commands/extend-prd.tmpl +3 -0
- package/commands/fix-bug.md +118 -509
- package/commands/generate-architecture.md +94 -515
- package/commands/generate-architecture.tmpl +3 -0
- package/commands/generate-bdd.md +85 -509
- package/commands/generate-code.md +86 -510
- package/commands/generate-design-spec.md +86 -510
- package/commands/generate-prd.md +89 -510
- package/commands/generate-prd.tmpl +3 -0
- package/commands/generate-spec-manifest.md +86 -510
- package/commands/generate-tech-docs.md +86 -510
- package/commands/learn.md +172 -496
- package/commands/learn.tmpl +70 -3
- package/commands/map-testids.md +86 -510
- package/commands/propose-scenario.md +86 -510
- package/commands/qc-analyze.md +86 -510
- package/commands/qc-design-test.md +86 -510
- package/commands/qc-plan.md +86 -510
- package/commands/qc-report.md +86 -510
- package/commands/qc-review.md +86 -510
- package/commands/qc-run-test.md +86 -510
- package/commands/refine-prd.md +99 -520
- package/commands/refine-prd.tmpl +3 -0
- package/commands/report-bug.md +86 -510
- package/commands/review-code.md +123 -511
- package/commands/review-code.tmpl +3 -0
- package/commands/review-context.md +93 -514
- package/commands/review-context.tmpl +3 -0
- package/commands/review-tech-docs.md +90 -511
- package/commands/review-tech-docs.tmpl +3 -0
- package/commands/setup-ai-first.md +166 -138
- package/commands/setup-ai-first.tmpl +72 -0
- package/commands/sync.md +50 -106
- package/commands/sync.tmpl +48 -3
- package/commands/update-framework.md +16 -103
- package/commands/update-framework.tmpl +14 -0
- package/commands/validate-traces.md +153 -511
- package/commands/validate-traces.tmpl +67 -1
- package/core/FRAMEWORK_VERSION +1 -1
- package/core/README.md +20 -0
- package/core/commands/debug.md +123 -511
- package/core/commands/define-product.md +86 -510
- package/core/commands/dev-gen-test.md +86 -510
- package/core/commands/dev-run-test.md +86 -510
- package/core/commands/dev-smoke-test.md +86 -510
- package/core/commands/extend-prd.md +89 -510
- package/core/commands/fix-bug.md +118 -509
- package/core/commands/generate-architecture.md +94 -515
- package/core/commands/generate-bdd.md +85 -509
- package/core/commands/generate-code.md +86 -510
- package/core/commands/generate-design-spec.md +86 -510
- package/core/commands/generate-prd.md +89 -510
- package/core/commands/generate-spec-manifest.md +86 -510
- package/core/commands/generate-tech-docs.md +86 -510
- package/core/commands/learn.md +172 -496
- package/core/commands/map-testids.md +86 -510
- package/core/commands/propose-scenario.md +86 -510
- package/core/commands/qc-analyze.md +86 -510
- package/core/commands/qc-design-test.md +86 -510
- package/core/commands/qc-plan.md +86 -510
- package/core/commands/qc-report.md +86 -510
- package/core/commands/qc-review.md +86 -510
- package/core/commands/qc-run-test.md +86 -510
- package/core/commands/refine-prd.md +99 -520
- package/core/commands/report-bug.md +86 -510
- package/core/commands/review-code.md +123 -511
- package/core/commands/review-context.md +93 -514
- package/core/commands/review-tech-docs.md +90 -511
- package/core/commands/setup-ai-first.md +166 -138
- package/core/commands/sync.md +50 -106
- package/core/commands/update-framework.md +16 -103
- package/core/commands/validate-traces.md +153 -511
- package/core/hooks/data-guard.js +174 -83
- package/core/hooks/settings.json +2 -1
- package/core/rules/workflow.md +30 -4
- package/core/steps/capture-lesson.md +34 -1
- package/core/steps/context-loader.md +24 -3
- package/core/steps/gate.md +92 -35
- package/core/steps/report-footer.md +23 -0
- package/core/templates/README.md +24 -1
- package/core/templates/ci/trace-gate.yml +146 -0
- package/core/templates/hooks/pre-push +61 -0
- package/docs/02-concepts/architecture.md +25 -6
- package/docs/02-concepts/traceability.md +57 -0
- package/docs/03-guides/architect.md +63 -0
- package/docs/04-reference/commands.md +1 -1
- package/docs/04-reference/model-selection.md +32 -19
- package/docs/explain/21-validate-traces.md +2 -1
- package/docs/explain/27-learn.md +5 -3
- package/hooks/data-guard.js +174 -83
- package/hooks/settings.json +2 -1
- package/package.json +5 -2
- package/rules/workflow.md +30 -4
- package/steps/capture-lesson.md +34 -1
- package/steps/context-loader.md +24 -3
- package/steps/gate.md +92 -35
- package/steps/report-footer.md +23 -0
- package/templates/README.md +24 -1
- package/templates/ci/trace-gate.yml +146 -0
- package/templates/hooks/pre-push +61 -0
- package/scripts/init.sh +0 -49
- package/scripts/upgrade.sh +0 -94
package/commands/learn.tmpl
CHANGED
|
@@ -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:
|
|
7
|
-
|
|
6
|
+
Usage:
|
|
7
|
+
- `/learn {free-text}` — ghi lesson mới. Lý 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
|
+
```
|