@educa-corp/sdd-framework 0.6.0 → 0.7.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/gate-trace.js +25 -2
- package/bin/index.js +32 -5
- package/bin/lint-trace.js +41 -0
- package/bin/self-check.js +430 -3
- package/bin/trace-schema.json +391 -30
- package/core/FRAMEWORK_VERSION +1 -1
- package/{commands/extend-prd.md → core/commands/amend-prd.md} +205 -173
- package/core/commands/dev-run-test.md +47 -9
- package/core/commands/extend-prd.md +39 -12
- package/core/commands/generate-bdd.md +43 -4
- package/core/commands/generate-code.md +33 -0
- package/core/commands/generate-tech-docs.md +34 -2
- package/core/commands/qc-run-test.md +29 -3
- package/core/commands/refine-prd.md +13 -2
- package/core/commands/review-context.md +43 -8
- package/core/commands/sync.md +105 -1
- package/core/commands/validate-traces.md +284 -11
- package/core/rules/workflow.md +34 -0
- package/core/steps/context-loader.md +26 -5
- package/core/templates/feature.template +1 -1
- package/docs/02-concepts/architecture.md +36 -0
- package/docs/04-reference/commands.md +148 -134
- package/docs/04-reference/trace-schema.md +39 -0
- package/docs/explain/02b-extend-prd.md +1 -1
- package/docs/explain/02c-amend-prd.md +152 -0
- package/docs/explain/28-sync.md +25 -0
- package/docs/explain/README.md +136 -135
- package/package.json +1 -8
- package/commands/debug.md +0 -529
- package/commands/debug.tmpl +0 -260
- package/commands/define-product.md +0 -438
- package/commands/define-product.tmpl +0 -225
- package/commands/dev-gen-test.md +0 -700
- package/commands/dev-gen-test.tmpl +0 -490
- package/commands/dev-run-test.md +0 -435
- package/commands/dev-run-test.tmpl +0 -225
- package/commands/dev-smoke-test.md +0 -374
- package/commands/dev-smoke-test.tmpl +0 -217
- package/commands/extend-prd.tmpl +0 -273
- package/commands/fix-bug.md +0 -519
- package/commands/fix-bug.tmpl +0 -197
- package/commands/generate-architecture.md +0 -354
- package/commands/generate-architecture.tmpl +0 -197
- package/commands/generate-bdd.md +0 -923
- package/commands/generate-bdd.tmpl +0 -590
- package/commands/generate-code.md +0 -859
- package/commands/generate-code.tmpl +0 -649
- package/commands/generate-design-spec.md +0 -737
- package/commands/generate-design-spec.tmpl +0 -524
- package/commands/generate-prd.md +0 -722
- package/commands/generate-prd.tmpl +0 -226
- package/commands/generate-spec-manifest.md +0 -321
- package/commands/generate-spec-manifest.tmpl +0 -164
- package/commands/generate-tech-docs.md +0 -920
- package/commands/generate-tech-docs.tmpl +0 -273
- package/commands/learn.md +0 -399
- package/commands/learn.tmpl +0 -130
- package/commands/map-testids.md +0 -238
- package/commands/map-testids.tmpl +0 -81
- package/commands/propose-scenario.md +0 -359
- package/commands/propose-scenario.tmpl +0 -202
- package/commands/qc-analyze.md +0 -269
- package/commands/qc-analyze.tmpl +0 -112
- package/commands/qc-design-test.md +0 -226
- package/commands/qc-design-test.tmpl +0 -69
- package/commands/qc-plan.md +0 -206
- package/commands/qc-plan.tmpl +0 -49
- package/commands/qc-report.md +0 -217
- package/commands/qc-report.tmpl +0 -60
- package/commands/qc-review.md +0 -210
- package/commands/qc-review.tmpl +0 -53
- package/commands/qc-run-test.md +0 -326
- package/commands/qc-run-test.tmpl +0 -116
- package/commands/refine-prd.md +0 -653
- package/commands/refine-prd.tmpl +0 -281
- package/commands/report-bug.md +0 -305
- package/commands/report-bug.tmpl +0 -148
- package/commands/review-code.md +0 -415
- package/commands/review-code.tmpl +0 -146
- package/commands/review-context.md +0 -902
- package/commands/review-context.tmpl +0 -530
- package/commands/review-tech-docs.md +0 -561
- package/commands/review-tech-docs.tmpl +0 -404
- package/commands/setup-ai-first.md +0 -602
- package/commands/setup-ai-first.tmpl +0 -450
- package/commands/sync.md +0 -430
- package/commands/sync.tmpl +0 -429
- package/commands/update-framework.md +0 -203
- package/commands/update-framework.tmpl +0 -202
- package/commands/validate-traces.md +0 -1077
- package/commands/validate-traces.tmpl +0 -920
- package/hooks/data-guard.js +0 -232
- package/hooks/settings.json +0 -19
- package/modules/android-compose/module.yaml +0 -13
- package/modules/android-compose/stack-profile.yaml +0 -57
- package/modules/angular/architecture-snippets/component-patterns.md +0 -187
- package/modules/angular/module.yaml +0 -6
- package/modules/angular/stack-profile.yaml +0 -38
- package/modules/context-engineering/architecture-snippets/context-design.md +0 -119
- package/modules/context-engineering/module.yaml +0 -9
- package/modules/context-engineering/stack-profile.yaml +0 -61
- package/modules/dotnet/architecture-snippets/clean-arch.md +0 -160
- package/modules/dotnet/module.yaml +0 -6
- package/modules/dotnet/stack-profile.yaml +0 -50
- package/modules/flutter/module.yaml +0 -14
- package/modules/flutter/stack-profile.yaml +0 -59
- package/modules/golang/architecture-snippets/domain-layout.md +0 -283
- package/modules/golang/module.yaml +0 -6
- package/modules/golang/stack-profile.yaml +0 -40
- package/modules/ios-swiftui/module.yaml +0 -13
- package/modules/ios-swiftui/stack-profile.yaml +0 -55
- package/modules/java-spring/architecture-snippets/layered-arch.md +0 -201
- package/modules/java-spring/module.yaml +0 -15
- package/modules/java-spring/stack-profile.yaml +0 -28
- package/modules/nextjs/architecture-snippets/app-router-patterns.md +0 -269
- package/modules/nextjs/module.yaml +0 -14
- package/modules/nextjs/stack-profile.yaml +0 -74
- package/modules/nuxt/module.yaml +0 -14
- package/modules/nuxt/stack-profile.yaml +0 -58
- package/modules/phaser-game/architecture-snippets/phaser-scene-patterns.md +0 -646
- package/modules/phaser-game/module.yaml +0 -15
- package/modules/phaser-game/stack-profile.yaml +0 -90
- package/modules/php-laravel/architecture-snippets/service-repository.md +0 -302
- package/modules/php-laravel/module.yaml +0 -15
- package/modules/php-laravel/stack-profile.yaml +0 -56
- package/modules/qc-playwright/stack-profile.yaml +0 -66
- package/modules/react/architecture-snippets/hooks-query-patterns.md +0 -254
- package/modules/react/module.yaml +0 -14
- package/modules/react/stack-profile.yaml +0 -63
- package/modules/react-native/module.yaml +0 -14
- package/modules/react-native/stack-profile.yaml +0 -56
- package/modules/vue/module.yaml +0 -14
- package/modules/vue/stack-profile.yaml +0 -65
- package/rules/data-protection.md +0 -80
- package/rules/workflow.md +0 -99
- package/skills/code/SKILL.md +0 -19
- package/skills/code/SKILL.tmpl +0 -19
- package/skills/debug/SKILL.md +0 -19
- package/skills/debug/SKILL.tmpl +0 -19
- package/skills/design-spec/SKILL.md +0 -11
- package/skills/design-spec/SKILL.tmpl +0 -11
- package/skills/discovery/SKILL.md +0 -14
- package/skills/discovery/SKILL.tmpl +0 -14
- package/skills/prd/SKILL.md +0 -19
- package/skills/prd/SKILL.tmpl +0 -19
- package/skills/qc/qa-analyst/DOC_GAPS.template.md +0 -63
- package/skills/qc/qa-analyst/acceptance-criteria.md +0 -60
- package/skills/qc/qa-analyst/business-rules.md +0 -59
- package/skills/qc/qa-analyst/data-flow.md +0 -64
- package/skills/qc/qa-analyst/spec-breakdown.md +0 -61
- package/skills/qc/qa-designer/e2e/journey.md +0 -41
- package/skills/qc/qa-designer/exploratory/charter.md +0 -68
- package/skills/qc/qa-designer/exploratory/explore-to-functional.md +0 -43
- package/skills/qc/qa-designer/functional/api.md +0 -45
- package/skills/qc/qa-designer/functional/gui-feature.md +0 -46
- package/skills/qc/qa-designer/functional/gui-screen.md +0 -52
- package/skills/qc/qa-designer/integration/api.md +0 -42
- package/skills/qc/qa-designer/integration/db.md +0 -39
- package/skills/qc/qa-designer/integration/gui.md +0 -40
- package/skills/qc/qa-designer/integration/kafka.md +0 -40
- package/skills/qc/qa-designer/non-functional.md +0 -40
- package/skills/qc/qa-planner/test-plan.md +0 -120
- package/skills/qc/qa-reviewer/script/e2e.md +0 -87
- package/skills/qc/qa-reviewer/script/exploratory.md +0 -45
- package/skills/qc/qa-reviewer/script/functional.md +0 -101
- package/skills/qc/qa-reviewer/script/integration.md +0 -91
- package/skills/qc/qa-reviewer/script/non-functional.md +0 -126
- package/skills/qc/qa-reviewer/test-case/e2e.md +0 -73
- package/skills/qc/qa-reviewer/test-case/exploratory.md +0 -43
- package/skills/qc/qa-reviewer/test-case/functional.md +0 -76
- package/skills/qc/qa-reviewer/test-case/integration.md +0 -69
- package/skills/qc/qa-reviewer/test-case/non-functional.md +0 -73
- package/skills/qc/qa-runner/e2e.md +0 -49
- package/skills/qc/qa-runner/exploratory/session.md +0 -36
- package/skills/qc/qa-runner/functional/api.md +0 -35
- package/skills/qc/qa-runner/functional/gui-feature.md +0 -51
- package/skills/qc/qa-runner/functional/gui-screen.md +0 -55
- package/skills/qc/qa-runner/integration.md +0 -47
- package/skills/qc/qa-runner/non-functional.md +0 -49
- package/skills/qc/qa-runner/report/report.md +0 -37
- package/skills/setup-ai-first/SKILL.md +0 -19
- package/skills/setup-ai-first/SKILL.tmpl +0 -19
- package/skills/spec/SKILL.md +0 -19
- package/skills/spec/SKILL.tmpl +0 -19
- package/skills/test/SKILL.md +0 -18
- package/skills/test/SKILL.tmpl +0 -18
- package/steps/business-language.md +0 -56
- package/steps/capture-lesson.md +0 -112
- package/steps/context-loader.md +0 -406
- package/steps/gate.md +0 -151
- package/steps/report-footer.md +0 -125
- package/steps/review-fanout.md +0 -159
- package/steps/spawn-agent.md +0 -129
- package/steps/trace-mirror.md +0 -53
- package/templates/README.md +0 -70
- package/templates/architecture.template.md +0 -394
- package/templates/ci/trace-gate.yml +0 -146
- package/templates/design-spec.template.md +0 -217
- package/templates/feature.template +0 -123
- package/templates/hooks/pre-push +0 -61
- package/templates/platform-guide.template.md +0 -145
- package/templates/prd.template.md +0 -283
- package/templates/product-definition.template.md +0 -188
- package/templates/project-context.yaml +0 -212
- package/templates/tech-design.template.md +0 -490
package/commands/sync.tmpl
DELETED
|
@@ -1,429 +0,0 @@
|
|
|
1
|
-
# /sync — Sync & Refresh Umbrella Project
|
|
2
|
-
|
|
3
|
-
Một lệnh cho cả **setup lần đầu** lẫn **cập nhật hằng ngày** một umbrella repo có git submodule.
|
|
4
|
-
An toàn chạy lặp lại — tự phát hiện cần làm gì.
|
|
5
|
-
|
|
6
|
-
**Argument tuỳ chọn:** `/sync [spec-branch]` — branch của spec submodule để pull (vd `/sync develop`). Nếu bỏ, branch được phân giải tự động (xem Step 0-D).
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## Step 0 — Pre-flight Checks
|
|
11
|
-
|
|
12
|
-
**A. Git repo check**
|
|
13
|
-
|
|
14
|
-
Xác minh thư mục hiện tại nằm trong git repo. Nếu không → dừng:
|
|
15
|
-
```
|
|
16
|
-
❌ Not a git repository. Open Claude Code from umbrella root and retry.
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
**B. Đọc project config sớm**
|
|
20
|
-
|
|
21
|
-
Đọc `.agent/project-context.yaml` trước khi chạy lệnh git nào. Trích:
|
|
22
|
-
- `setup.spec_source` → path của spec submodule (vd `"my-project-specs"`)
|
|
23
|
-
- `services` → map domain → `{path, module, ...}` cho mỗi service submodule
|
|
24
|
-
|
|
25
|
-
Cần cái này để phân biệt spec vs service submodule ở Step 1.
|
|
26
|
-
|
|
27
|
-
Nếu `.agent/project-context.yaml` không tồn tại → cảnh báo và set `spec_source = null`, `services = {}`.
|
|
28
|
-
|
|
29
|
-
**C. Submodule status scan**
|
|
30
|
-
|
|
31
|
-
Chạy `git submodule status --recursive` và phân loại mỗi entry theo ký tự đầu:
|
|
32
|
-
|
|
33
|
-
| Char | Ý nghĩa | Hành động |
|
|
34
|
-
|------|---------|--------|
|
|
35
|
-
| `-` | Chưa init | → **Setup mode** |
|
|
36
|
-
| ` ` | Khớp pointer đã ghi | → OK |
|
|
37
|
-
| `+` | Ahead của pointer đã ghi (local advance chưa commit) | → cảnh báo từng submodule |
|
|
38
|
-
| `U` | Merge conflict | → **STOP** |
|
|
39
|
-
|
|
40
|
-
Nếu **bất kỳ** entry nào có `U`:
|
|
41
|
-
```
|
|
42
|
-
❌ Merge conflict in submodule: {path}
|
|
43
|
-
Resolve manually before running /sync:
|
|
44
|
-
cd {path} && git status
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Nếu **bất kỳ** entry nào có `+` (commit đang checkout khác pointer đã ghi):
|
|
48
|
-
```
|
|
49
|
-
ℹ️ {path} is ahead of the umbrella's recorded pointer.
|
|
50
|
-
/sync classifies it in Step 1b — if you're on a branch there, it stays untouched.
|
|
51
|
-
```
|
|
52
|
-
Đừng xử lý `+` ở đây — Step 1b quyết định cách xử lý đúng cho từng submodule.
|
|
53
|
-
|
|
54
|
-
In mode phát hiện: `Mode: Setup (first-time init)` hoặc `Mode: Update (sync latest)`.
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## Step 1 — Umbrella Pull
|
|
59
|
-
|
|
60
|
-
Ghi branch umbrella hiện tại trước (đây là cái `git pull` cập nhật):
|
|
61
|
-
`git rev-parse --abbrev-ref HEAD` → lưu thành `umbrella_branch` và hiển thị.
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
# 1. Pull latest umbrella (includes updated submodule pointer records)
|
|
65
|
-
git pull
|
|
66
|
-
|
|
67
|
-
# 2. Sync .gitmodules config into local git config
|
|
68
|
-
# (needed when new submodules were added since last clone)
|
|
69
|
-
git submodule sync --recursive
|
|
70
|
-
|
|
71
|
-
# 3. Initialize any NOT-yet-cloned submodules ONLY (the '-' entries from Step 0-C).
|
|
72
|
-
# Do NOT run a blanket `git submodule update --recursive` — that would detach
|
|
73
|
-
# a submodule you are actively working in. Per-submodule handling is Step 1b.
|
|
74
|
-
git submodule update --init {paths that were '-' in Step 0-C}
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Nếu `git pull` exit khác 0 → in lỗi và dừng với `❌`.
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
## Step 1b — Phân loại & Sync từng Submodule
|
|
82
|
-
|
|
83
|
-
**Ý tưởng cốt lõi:** `/sync` không bao giờ áp một branch lên submodule. Nó **kiểm tra checkout hiện tại của từng submodule** và tôn trọng nó. Đây là cách nó biết submodule nào bạn đang làm vs cái nào là dependency thụ động.
|
|
84
|
-
|
|
85
|
-
Với mỗi submodule (dùng `git submodule foreach` hoặc lặp các path), đọc state:
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
# Inside each submodule:
|
|
89
|
-
git symbolic-ref --short -q HEAD # → branch name, or empty/non-zero if DETACHED
|
|
90
|
-
git status --porcelain # → non-empty means uncommitted local changes
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
Phân loại vào một trong bốn case và xử lý tương ứng:
|
|
94
|
-
|
|
95
|
-
| Case | State phát hiện | Hành động |
|
|
96
|
-
|------|----------------|--------|
|
|
97
|
-
| **Spec submodule** | `path == spec_source` | Advance tới `spec_branch` (Step 1c bên dưới) |
|
|
98
|
-
| **Active (on a branch)** | HEAD là một branch, không detached | **KHÔNG checkout.** Đây là nơi bạn (hoặc đồng đội) đang code. Chỉ `git -C {path} fetch` và report branch + ahead/behind. Để working tree y nguyên. |
|
|
99
|
-
| **Passive (detached, clean)** | Detached HEAD, không có thay đổi local | An toàn align về pointer đã ghi của umbrella: `git submodule update {path}` |
|
|
100
|
-
| **Dirty (uncommitted changes)** | `git status --porcelain` non-empty | **Đừng đụng.** Cảnh báo: `⚠️ {path} has uncommitted changes — skipped. Commit or stash before syncing this submodule.` |
|
|
101
|
-
|
|
102
|
-
> **Vì sao quan trọng:** Một `git submodule update` toàn bộ checkout mọi submodule về **detached HEAD** ở pointer đã ghi. Nếu bạn đang checkout `feature/FEAT-01` trong `user-service/` và đang làm dở, cái đó sẽ âm thầm chuyển bạn khỏi branch. Phân loại trước bảo vệ công việc đang làm của bạn.
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
## Step 1c — Advance Spec Submodule *(chỉ khi `spec_source` được cấu hình)*
|
|
107
|
-
|
|
108
|
-
Spec submodule là submodule duy nhất ta cố ý advance tới một branch HEAD (PO push spec liên tục).
|
|
109
|
-
|
|
110
|
-
**Phân giải spec branch** (giờ submodule đã init), theo thứ tự ưu tiên:
|
|
111
|
-
|
|
112
|
-
1. **Command argument** — nếu `$ARGUMENTS` chứa tên branch → dùng nó (override một lần)
|
|
113
|
-
2. **`.gitmodules` config** — `git config -f .gitmodules --get submodule.{spec_source}.branch`. Nếu set → dùng nó (default committed của team)
|
|
114
|
-
3. **Remote default** — else branch default của spec repo: `git -C {spec_source} rev-parse --abbrev-ref origin/HEAD` (bỏ prefix `origin/`)
|
|
115
|
-
|
|
116
|
-
Lưu thành `spec_branch` + `spec_branch_source` (argument | .gitmodules | remote-default). Nếu nó rơi xuống remote-default mà không có gì pin, thêm hint này vào output:
|
|
117
|
-
```
|
|
118
|
-
ℹ️ Spec submodule branch not pinned in .gitmodules — using remote default '{spec_branch}'.
|
|
119
|
-
To pin it for the whole team:
|
|
120
|
-
git config -f .gitmodules submodule.{spec_source}.branch {spec_branch}
|
|
121
|
-
git add .gitmodules && git commit -m "chore: pin spec submodule branch"
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
Rồi kiểm tra an toàn: nếu spec submodule có thay đổi chưa commit → cảnh báo và skip (dev nên coi spec là read-only). Ngược lại dùng **explicit checkout** (không phải `--remote` trần) để branch rõ ràng:
|
|
125
|
-
|
|
126
|
-
```bash
|
|
127
|
-
cd {spec_source}
|
|
128
|
-
git fetch origin
|
|
129
|
-
git checkout {spec_branch} # branch resolved in Step 0-D
|
|
130
|
-
git pull origin {spec_branch}
|
|
131
|
-
cd - # back to umbrella root
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
In: `Spec submodule {spec_source}: pulled branch '{spec_branch}' (source: {spec_branch_source})`
|
|
135
|
-
|
|
136
|
-
> **Vì sao không `--remote` cho service submodule?** Service submodule bị version-lock bởi pointer đã ghi của umbrella — cố ý để mọi dev làm từ cùng commit. `--remote` sẽ bỏ qua lock này và tạo pointer drift chưa commit. Spec submodule là ngoại lệ: PO push liên tục, nên ta advance nó tới branch HEAD — nhưng làm bằng explicit `checkout {spec_branch}` thay vì `--remote` để nó không bao giờ âm thầm theo sai branch.
|
|
137
|
-
|
|
138
|
-
Nếu `git pull` hoặc `git submodule update` exit khác 0 → in lỗi và dừng với `❌`.
|
|
139
|
-
|
|
140
|
-
Thu từ output:
|
|
141
|
-
- Submodule nào đổi SHA
|
|
142
|
-
- Cái nào đã up to date
|
|
143
|
-
- `{old_sha}..{new_sha}` của spec submodule (cần cho Step 1d)
|
|
144
|
-
|
|
145
|
-
---
|
|
146
|
-
|
|
147
|
-
## Step 1d — Surface Feedback của Tester/QC *(bug report / scenario proposal / PRD change request)*
|
|
148
|
-
|
|
149
|
-
`/report-bug`, `/propose-scenario` của tester & QC (gồm cả PRD change request Case B) commit feedback vào spec repo. Step này cho PO/Dev biết cái gì tới trong **lần** pull này, để họ được thông báo qua routine bình thường. Nó phủ cả hai đối tượng:
|
|
150
|
-
|
|
151
|
-
- **Dev/tester trong umbrella** → feedback tới qua spec submodule advance (Step 1c)
|
|
152
|
-
- **PO làm trực tiếp trong spec repo** → feedback tới qua `git pull` của umbrella/current-repo (Step 1)
|
|
153
|
-
|
|
154
|
-
Chọn repo + range đã pull feedback:
|
|
155
|
-
- Umbrella có `spec_source` → `REPO={spec_source}`, range = spec submodule `{old_sha}..{new_sha}`
|
|
156
|
-
- Ngược lại (chạy trong chính spec repo) → `REPO=.`, range = `{old_sha}..{new_sha}` của `git pull` từ Step 1
|
|
157
|
-
|
|
158
|
-
Nếu `feedback/` không tồn tại trong REPO → skip âm thầm.
|
|
159
|
-
|
|
160
|
-
```bash
|
|
161
|
-
git -C {REPO} diff --name-status {old_sha}..{new_sha} -- feedback/bug-reports/ feedback/bdd-proposals/ feedback/prd-change-requests/
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
Với mỗi entry, đọc title/summary + `State` và report. **Bug report: chỉ surface `State: Open`** là cần chú ý; liệt kê `Fixed`/`Closed` riêng (hoặc bỏ) để PO/PM thấy cái gì còn pending:
|
|
165
|
-
```
|
|
166
|
-
📥 New feedback (pulled this sync):
|
|
167
|
-
Bug reports (open):
|
|
168
|
-
BUG-20260608-01 FT-001 — account locks after 6 fails (spec says 5) [layer: Code · waiting: dev]
|
|
169
|
-
Bug reports (fixed, awaiting QC re-verify): BUG-20260605-02
|
|
170
|
-
Scenario proposals:
|
|
171
|
-
FT-001-trailing-spaces.md → maps to AC2 (pending review)
|
|
172
|
-
PRD change requests:
|
|
173
|
-
FT-001-bulk-export.md → new requirement, needs an AC (waiting: PO)
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
Nếu không có gì đổi → in `📥 Feedback: none new this sync`.
|
|
177
|
-
|
|
178
|
-
Nếu người đọc là PO/Dev, thêm một dòng nudge:
|
|
179
|
-
`→ Review feedback/ then act: /fix-bug {BUG-ID} · promote proposal via /generate-bdd · or add an AC to the PRD.`
|
|
180
|
-
|
|
181
|
-
---
|
|
182
|
-
|
|
183
|
-
## Step 2 — Post-sync State Check
|
|
184
|
-
|
|
185
|
-
Chạy `git status --short` và kiểm tra entry submodule bị modified (dòng bắt đầu bằng ` M` mà path khớp một submodule).
|
|
186
|
-
|
|
187
|
-
Nếu pointer submodule nào đổi (thường là spec submodule sau `--remote`):
|
|
188
|
-
```
|
|
189
|
-
⚠️ Submodule pointer(s) updated — commit to lock new version into umbrella:
|
|
190
|
-
git add {spec_source} && git commit -m "chore: sync {spec_source} to latest"
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
Nếu không có thay đổi → `✅ Umbrella state clean — no commit needed`.
|
|
194
|
-
|
|
195
|
-
---
|
|
196
|
-
|
|
197
|
-
## Step 3 — Bootstrap Service Configs
|
|
198
|
-
|
|
199
|
-
*Skip nếu `services` rỗng.*
|
|
200
|
-
|
|
201
|
-
**Trước tiên — làm phẳng `services` thành danh sách submodule.** Một giá trị trong `services` có thể lồng tới ba tầng (xem `context-loader.md` Bước 1.5), nên duyệt nông sẽ **bỏ sót** submodule:
|
|
202
|
-
|
|
203
|
-
| Dạng | Cách lấy submodule |
|
|
204
|
-
|---|---|
|
|
205
|
-
| `services.{domain}.path` (2a) | một entry |
|
|
206
|
-
| `services.{domain}.{platform}.path` (2b) | một entry mỗi platform |
|
|
207
|
-
| `…by_prd_slug.{slug}.path` (2c) | một entry mỗi `slug` — ở cấp domain hoặc cấp platform |
|
|
208
|
-
|
|
209
|
-
Kết quả là tập các cặp `{path, module}` **duy nhất theo `path`** (nhiều domain/platform/slug có thể trỏ chung một submodule — chỉ xử lý một lần). Mọi bước dưới đây chạy trên danh sách đã làm phẳng này.
|
|
210
|
-
|
|
211
|
-
Với mỗi entry trong danh sách đó:
|
|
212
|
-
|
|
213
|
-
**A. Nếu `{service.path}/.agent/project-context.yaml` đã tồn tại:**
|
|
214
|
-
- Đọc `conventions.test_command` và `conventions.build_command`
|
|
215
|
-
- Report: `✅ {service.path} — test: {test_command} | build: {build_command}`
|
|
216
|
-
|
|
217
|
-
**B. Nếu thiếu — tự tạo:**
|
|
218
|
-
|
|
219
|
-
1. Xác định `module` từ umbrella `services[].module` (authoritative). Nếu không set, auto-detect từ file trong `{service.path}/`:
|
|
220
|
-
|
|
221
|
-
| File có mặt | Module phát hiện | test_command | build_command |
|
|
222
|
-
|---|---|---|---|
|
|
223
|
-
| `pom.xml` | `java-spring` | `mvn test` | `mvn compile` |
|
|
224
|
-
| `build.gradle` or `build.gradle.kts` | `java-spring` | `./gradlew test` | `./gradlew build` |
|
|
225
|
-
| `go.mod` | `golang` | `go test ./...` | `go build ./...` |
|
|
226
|
-
| `*.csproj` or `*.sln` | `dotnet` | `dotnet test` | `dotnet build` |
|
|
227
|
-
| `composer.json` | `php-laravel` | `php artisan test` | `composer install` |
|
|
228
|
-
| `pubspec.yaml` | `flutter` | `flutter test` | `flutter build apk` |
|
|
229
|
-
| `angular.json` | `angular` | `npx ng test --watch=false` | `npm run build` |
|
|
230
|
-
| `next.config.*` | `nextjs` | `npx vitest run` | `npm run build` |
|
|
231
|
-
| `package.json` + `nest-cli.json` | `nestjs` | `npm test` | `npm run build` |
|
|
232
|
-
| `package.json` (fallback) | `react` | `npx vitest run` | `npm run build` |
|
|
233
|
-
| `requirements.txt` or `pyproject.toml` | `context-engineering` | `pytest tests/ -v` | `pip install -r requirements.txt` |
|
|
234
|
-
| *(none matched)* | `unknown` | `{{TEST_COMMAND}}` | `{{BUILD_COMMAND}}` |
|
|
235
|
-
|
|
236
|
-
2. Tạo thư mục `{service.path}/.agent/` nếu chưa có.
|
|
237
|
-
|
|
238
|
-
3. Ghi `{service.path}/.agent/project-context.yaml`:
|
|
239
|
-
|
|
240
|
-
```yaml
|
|
241
|
-
# Auto-generated by /sync — review and update as needed
|
|
242
|
-
tech_stack:
|
|
243
|
-
language: "{detected or from module}"
|
|
244
|
-
framework: "{detected or from module}"
|
|
245
|
-
module: "{module}"
|
|
246
|
-
|
|
247
|
-
conventions:
|
|
248
|
-
test_command: "{test_command}"
|
|
249
|
-
build_command: "{build_command}"
|
|
250
|
-
|
|
251
|
-
paths:
|
|
252
|
-
trace_dir: ".trace"
|
|
253
|
-
lessons_file: ".agent/project-lessons.md" # per-service guardrails (see /learn)
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
4. Report:
|
|
257
|
-
- Nếu auto-detect: `✅ Created {service.path}/.agent/project-context.yaml (module: {module}, test: {test_command})`
|
|
258
|
-
- Nếu unknown/placeholder: `⚠️ Created {service.path}/.agent/project-context.yaml — fill in {{TEST_COMMAND}} and {{BUILD_COMMAND}}`
|
|
259
|
-
|
|
260
|
-
---
|
|
261
|
-
|
|
262
|
-
## Step 4 — Check luật git cho sổ trace
|
|
263
|
-
|
|
264
|
-
*Step 4a/4b kiểm **có được commit hay không** (hai chiều ngược nhau — nhầm chiều là mất dữ liệu).
|
|
265
|
-
Step 4c kiểm **merge thế nào khi hai người cùng ghi**. Cả hai đều là đường mất sổ, và 4c không
|
|
266
|
-
cần ai làm sai gì cả — chỉ cần hai người làm việc cùng lúc.*
|
|
267
|
-
|
|
268
|
-
*Đọc bảng trước:*
|
|
269
|
-
|
|
270
|
-
| Đường dẫn | Vai trò | Kỳ vọng |
|
|
271
|
-
|---|---|---|
|
|
272
|
-
| `{paths.trace_dir}` (`.trace/` hoặc `{spec_source}/.trace/`) | **AUTHORITATIVE** — TSV + `trace-history.jsonl`, không regenerate được | **PHẢI commit** — gitignore nó là **lỗi nghiêm trọng** |
|
|
273
|
-
| `.trace-mirror/` | bản sao tiện cho panel VS Code | phải gitignore |
|
|
274
|
-
| `.living-docs/` | report sinh ra | phải gitignore |
|
|
275
|
-
|
|
276
|
-
**4a. Cảnh báo mềm — mirror chưa gitignore.**
|
|
277
|
-
Kiểm `.trace-mirror/` trong `.gitignore` của repo hiện tại (hoặc `.git/info/exclude`), và `.living-docs/` trong `.gitignore` của **specs module** (khi `setup.spec_source` được set). Thiếu cái nào:
|
|
278
|
-
```
|
|
279
|
-
⚠️ Mirror chưa gitignore — chúng được sinh ra, đừng bao giờ commit:
|
|
280
|
-
echo ".trace-mirror/" >> .gitignore
|
|
281
|
-
echo ".living-docs/" >> {spec_source}/.gitignore # specs module (nếu có spec_source)
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
**4b. 🔴 Báo động — sổ gốc ĐANG bị bỏ qua.**
|
|
285
|
-
Phân giải `{paths.trace_dir}`; nếu nó nằm trong một git repo, chạy `git -C {repo} check-ignore -q {trace_dir}`. **Trúng** (exit 0) → in ngay, mức chặn:
|
|
286
|
-
```
|
|
287
|
-
🔴 NGUY HIỂM — sổ gốc trace ĐANG bị git bỏ qua: {paths.trace_dir}
|
|
288
|
-
Toàn bộ trạng thái theo dõi (spec_ver · gen_ver · implemented_by · test_count ·
|
|
289
|
-
dev_selftest · qc_status) VÀ trace-history.jsonl KHÔNG được lưu vào git.
|
|
290
|
-
Người khác clone repo về sẽ không thấy gì, và lịch sử thì KHÔNG dựng lại được.
|
|
291
|
-
|
|
292
|
-
Sửa:
|
|
293
|
-
1. Gỡ dòng khớp `.trace` khỏi .gitignore của {repo}
|
|
294
|
-
2. git -C {repo} add -f {trace_dir} && git -C {repo} commit -m "restore trace state"
|
|
295
|
-
Nguyên nhân thường gặp: bản trước v0.4.3 gọi panel mirror là `.trace` (trùng tên sổ gốc),
|
|
296
|
-
nên gợi ý "gitignore .trace/" của chính lệnh này có thể đã nhắm trúng sổ gốc.
|
|
297
|
-
```
|
|
298
|
-
> **Vì sao cần báo động này:** trước v0.4.3, mirror và sổ gốc **cùng tên `.trace`**. Khi dev mở thẳng spec repo làm workspace thì hai path bằng nhau — và Step 4 (bản cũ) gợi ý gitignore theo **tên**, không theo vai trò. Làm theo là mất sổ gốc, **im lặng**: máy vẫn chạy, dashboard vẫn có số; chỉ người thứ hai clone về mới phát hiện. Bản v0.4.3 đổi tên mirror thành `.trace-mirror` để cái bẫy biến mất, nhưng **dự án đã dính từ trước thì vẫn dính** — 4b là để tìm ra chúng.
|
|
299
|
-
|
|
300
|
-
**4c. Luật merge cho sổ trace.**
|
|
301
|
-
|
|
302
|
-
Sổ trace **phải commit** (4b) và **được nhiều người ghi trên nhiều nhánh song song**. Git cần biết
|
|
303
|
-
merge nó thế nào — mặc định thì không biết, và mặc định là đường mất row.
|
|
304
|
-
|
|
305
|
-
Kiểm `{paths.trace_dir}/.gitattributes` có tồn tại và có đủ hai dòng dưới. **Thiếu → tạo/bổ sung
|
|
306
|
-
ngay** (đây là hành động ghi duy nhất của Step 4; nó chỉ thêm file luật, không đụng dữ liệu):
|
|
307
|
-
|
|
308
|
-
```gitattributes
|
|
309
|
-
# Sổ trace — dữ liệu KHÔNG regenerate được. Hai luật, hai lý do khác nhau:
|
|
310
|
-
#
|
|
311
|
-
# merge=union — giữ row của CẢ HAI nhánh thay vì bắt người chọn một bên. Trùng sc_id sau
|
|
312
|
-
# union là ca ĐÚNG VÀ ĐƯỢC MONG ĐỢI: `--lint-trace` T4 bắt nó, rồi /validate-traces
|
|
313
|
-
# reconcile về một row. Mất row thì KHÔNG có gì bắt được. Đánh đổi có chủ ý — đừng "dọn".
|
|
314
|
-
# (union là driver built-in của git: không ai cần chạy git config gì thêm.)
|
|
315
|
-
#
|
|
316
|
-
# text eol=lf — BẮT BUỘC đi kèm union, không phải cho đẹp. Thiếu nó: một máy ghi CRLF →
|
|
317
|
-
# git thấy MỌI dòng đã đổi → union giữ cả hai bản → NHÂN ĐÔI CẢ FILE, gồm cả dòng header.
|
|
318
|
-
# Team mixed Windows/macOS gặp ca này mà không ai làm gì sai.
|
|
319
|
-
*.tsv text eol=lf merge=union
|
|
320
|
-
*.jsonl text eol=lf merge=union
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
> **Vì sao đặt `.gitattributes` BÊN TRONG `{paths.trace_dir}` thay vì gốc repo:** `trace_dir` là
|
|
324
|
-
> đường dẫn **cấu hình được** (`.trace/`, `../.trace`, `{spec_source}/.trace/`), nên một luật ở gốc
|
|
325
|
-
> repo phải nhắc lại đúng đường dẫn đó và sẽ lệch ngay khi ai đổi config. Đặt trong thư mục thì
|
|
326
|
-
> pattern là `*.tsv` thuần — không phụ thuộc `trace_dir` tên gì, nằm ở đâu, và **đi theo sổ** khi
|
|
327
|
-
> spec repo được mount vào một umbrella khác. Git đọc `.gitattributes` ở mọi cấp thư mục.
|
|
328
|
-
|
|
329
|
-
> **KHÔNG thêm `*.json`.** `trace-report.json` có thể nằm cùng thư mục và union trên JSON tạo ra
|
|
330
|
-
> **JSON không hợp lệ** — panel VS Code parse lỗi. Nó là file **sinh lại được**: conflict ở đó thì
|
|
331
|
-
> chạy lại `/validate-traces`, đừng merge tay.
|
|
332
|
-
|
|
333
|
-
In vào report:
|
|
334
|
-
```
|
|
335
|
-
✅ {paths.trace_dir}/.gitattributes (merge=union + eol=lf)
|
|
336
|
-
(hoặc: ✅ vừa tạo — sổ trace giờ merge được khi hai người cùng ghi)
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
---
|
|
340
|
-
|
|
341
|
-
## Step 5 — Refresh Living Docs *(chỉ umbrella mode)*
|
|
342
|
-
|
|
343
|
-
*Skip nếu `services` rỗng.*
|
|
344
|
-
|
|
345
|
-
**Phân giải Living Docs home (cùng quy tắc như `/validate-traces`):**
|
|
346
|
-
- `living_docs_dir` = `{spec_source}/.living-docs` nếu `setup.spec_source` được set, else `.living-docs` ở umbrella root. *(Specs module được mount trong mọi service workspace, nên panel phân giải nó kể cả khi dev mở một service submodule đơn.)*
|
|
347
|
-
- `panel_mirror` = `./.trace-mirror` ở gốc workspace hiện tại. *(Cố ý KHÁC tên `.trace` — xem Step 4.)*
|
|
348
|
-
|
|
349
|
-
1. Với mỗi service trong danh sách **đã làm phẳng** ở Step 3 (gồm cả các submodule nằm dưới `by_prd_slug` — bỏ sót chúng là mất trace của các repo chia theo feature): nếu `{service.path}/.trace/` có file `.tsv` → copy chúng vào `{living_docs_dir}/{service-name}/` (tạo dir nếu cần).
|
|
350
|
-
2. Ghi merged `{living_docs_dir}/trace-report.json`:
|
|
351
|
-
- Tổng hợp TSV `.trace/` của mỗi service, thêm field `"service"` **và `"platform"`** (suy từ tên file `{UC-ID}-{platform}.tsv`) cho mỗi row, tính lại summary totals. **Không dedupe theo `sc_id` giữa các platform** — `web·SC1` và `system·SC1` là 2 row khác nhau; nhờ field `platform` dashboard hiển thị tách bạch coverage từng platform.
|
|
352
|
-
3. **Mirror tới panel location:** copy `{living_docs_dir}/trace-report.json` (+ TSV namespaced) → `{panel_mirror}/` để panel trong repo đang mở không rỗng. Skip nếu `panel_mirror` đã bằng `living_docs_dir`, hoặc nếu `{paths.trace_dir}` đã nằm trong workspace hiện tại (panel đọc thẳng ở đó). **KHÔNG** copy `trace-history.jsonl` — nó là dữ liệu tích luỹ, không phải thứ sinh lại được.
|
|
353
|
-
|
|
354
|
-
In kết quả sync:
|
|
355
|
-
```
|
|
356
|
-
Living Docs → {living_docs_dir}/ synced (canonical, specs module)
|
|
357
|
-
{service-name}: {N} TSVs
|
|
358
|
-
trace-report.json: {total} scenarios across {S} services
|
|
359
|
-
Panel mirror → {panel_mirror}/ (current workspace)
|
|
360
|
-
```
|
|
361
|
-
|
|
362
|
-
Nếu không tìm thấy dir `.trace/` → `Living Docs: no trace data yet — run /generate-bdd then /generate-code first.`
|
|
363
|
-
|
|
364
|
-
---
|
|
365
|
-
|
|
366
|
-
## Step 6 — Refresh Spec Manifest *(nếu có spec_source)*
|
|
367
|
-
|
|
368
|
-
*Skip nếu `setup.spec_source` vắng.*
|
|
369
|
-
|
|
370
|
-
Nếu `spec-manifest.yaml` tồn tại HOẶC `setup.spec_source` được cấu hình:
|
|
371
|
-
- Re-scan các file PRD `{spec_source}/specs/*/*/*.md` (file `.md` ở gốc mỗi feature folder = PRD; tech-docs/design-spec `.md` nằm sâu hơn nên không bị quét nhầm)
|
|
372
|
-
- Rebuild `spec-manifest.yaml` map TICKET-ID → path PRD/BDD/tech-doc
|
|
373
|
-
- In: `spec-manifest.yaml refreshed — {N} features indexed`
|
|
374
|
-
|
|
375
|
-
---
|
|
376
|
-
|
|
377
|
-
## Output
|
|
378
|
-
|
|
379
|
-
{{include:steps/report-footer.md}}
|
|
380
|
-
|
|
381
|
-
```
|
|
382
|
-
/sync — {Setup | Update}
|
|
383
|
-
|
|
384
|
-
Git
|
|
385
|
-
✅ git pull — umbrella on branch '{umbrella_branch}'
|
|
386
|
-
✅ submodule sync — .gitmodules config refreshed
|
|
387
|
-
|
|
388
|
-
Submodules (each handled by its current state)
|
|
389
|
-
✅ {spec_source} [spec] — pulled branch '{spec_branch}' ({spec_branch_source}) → {new-sha}
|
|
390
|
-
✋ user-service [active] — on 'feature/FEAT-01' — left untouched, fetched (↓2 behind origin)
|
|
391
|
-
✅ order-service [passive] — aligned to umbrella pointer {sha}
|
|
392
|
-
⚠️ payment-service [dirty] — uncommitted changes, skipped (commit/stash first)
|
|
393
|
-
|
|
394
|
-
Umbrella state
|
|
395
|
-
⚠️ Pointer changed: git add {spec_source} && git commit -m "chore: sync specs"
|
|
396
|
-
(or: ✅ Clean — no commit needed)
|
|
397
|
-
|
|
398
|
-
Tester feedback (pulled this sync)
|
|
399
|
-
📥 1 bug report: BUG-20260608-01 FT-001 [Code]
|
|
400
|
-
1 proposal: FT-001-trailing-spaces → AC2 (pending review)
|
|
401
|
-
(or: 📥 none new this sync)
|
|
402
|
-
→ /fix-bug {BUG-ID} · promote proposal into BDD · or update PRD
|
|
403
|
-
|
|
404
|
-
Service Configs
|
|
405
|
-
✅ user-service — test: mvn test | build: mvn compile
|
|
406
|
-
✅ order-service — test: mvn test | build: mvn compile
|
|
407
|
-
⚠️ payment-service — .agent/project-context.yaml missing
|
|
408
|
-
→ create it so /dev-run-test works correctly
|
|
409
|
-
|
|
410
|
-
Luật git cho sổ trace
|
|
411
|
-
✅ .trace-mirror/ + .living-docs/ gitignored (mirror — sinh lại được)
|
|
412
|
-
✅ {paths.trace_dir}/ KHÔNG bị gitignore (sổ gốc — phải commit)
|
|
413
|
-
✅ {paths.trace_dir}/.gitattributes (merge=union + eol=lf — hai người ghi song song)
|
|
414
|
-
(hoặc: ⚠️ Thêm .trace-mirror/ vào .gitignore)
|
|
415
|
-
(hoặc: 🔴 NGUY HIỂM — sổ gốc {paths.trace_dir} đang bị gitignore, xem Step 4b)
|
|
416
|
-
(hoặc: ✅ vừa tạo .gitattributes — trước đó merge song song sẽ conflict và mất row)
|
|
417
|
-
|
|
418
|
-
Living Docs
|
|
419
|
-
✅ {panel_mirror}/ synced — {N} TSVs across {S} services
|
|
420
|
-
(chạy /validate-traces để có report coverage đầy đủ)
|
|
421
|
-
|
|
422
|
-
Spec Manifest
|
|
423
|
-
✅ spec-manifest.yaml — {N} features indexed
|
|
424
|
-
|
|
425
|
-
---
|
|
426
|
-
Status : ✅ Complete | ⚠️ Warnings
|
|
427
|
-
Output Artifacts: updated .trace-mirror/ (panel mirror), spec-manifest.yaml
|
|
428
|
-
Next : /validate-traces (full coverage check) | /generate-code {UC-ID} (start coding)
|
|
429
|
-
```
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
# /update-framework — Cập nhật SDD Framework Framework
|
|
2
|
-
|
|
3
|
-
Nâng cấp **framework tooling** (`.agent/commands/`, `steps/`, `modules/`, `hooks/`, `rules/`, `templates/`, `skills/`) lên version mới nhất publish trên npm.
|
|
4
|
-
|
|
5
|
-
> **Không giống `/sync`.**
|
|
6
|
-
> - `/sync` → pull **nội dung dự án** (code/specs submodule) + làm mới Living Docs. Chạy hằng ngày.
|
|
7
|
-
> - `/update-framework` → nâng cấp **chính các file command của framework**. Chạy thỉnh thoảng, khi có version framework mới.
|
|
8
|
-
|
|
9
|
-
Lệnh này wrap `npx @educa-corp/sdd-framework@latest --init`. Cần network + npm access.
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## Step 0 — Phát hiện trạng thái hiện tại
|
|
14
|
-
|
|
15
|
-
1. Đọc `.agent/FRAMEWORK_VERSION` → version đang cài.
|
|
16
|
-
- Nếu thiếu → dự án này không được cài qua `--init`. Dừng:
|
|
17
|
-
```
|
|
18
|
-
❌ .agent/FRAMEWORK_VERSION not found.
|
|
19
|
-
This project was not set up with the framework installer.
|
|
20
|
-
Run: npx @educa-corp/sdd-framework --init
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
2. Đọc `.agent/project-context.yaml` → trích `setup.mode` (`umbrella` / vắng = single) và `services`.
|
|
24
|
-
|
|
25
|
-
3. Liệt kê `.agent/modules/` → ghi tên các module đã cài (phải truyền lại khi nâng cấp để chúng cũng update).
|
|
26
|
-
|
|
27
|
-
In:
|
|
28
|
-
```
|
|
29
|
-
Current framework : v{current}
|
|
30
|
-
Mode : {umbrella | single-service}
|
|
31
|
-
Installed modules : {list or "none"}
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## Step 1 — Kiểm tra version mới nhất
|
|
37
|
-
|
|
38
|
-
Chạy:
|
|
39
|
-
```bash
|
|
40
|
-
npm view @educa-corp/sdd-framework version
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
So `current` vs `latest`:
|
|
44
|
-
|
|
45
|
-
| Kết quả | Hành động |
|
|
46
|
-
|--------|--------|
|
|
47
|
-
| Network/registry không tới được | Cảnh báo `⚠️ Could not reach npm registry — check connection.` và dừng |
|
|
48
|
-
| `current == latest` | In `✅ Already up to date (v{current}). Nothing to do.` và dừng |
|
|
49
|
-
| `latest > current` | In `Update available: v{current} → v{latest}` và tiếp tục |
|
|
50
|
-
|
|
51
|
-
Hỏi: `Proceed with upgrade? (Y/N)` — chờ `Y`.
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
## Step 2 — Umbrella Awareness *(chỉ umbrella mode)*
|
|
56
|
-
|
|
57
|
-
Nếu `setup.mode == umbrella`, in note này trước khi nâng cấp:
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
ℹ️ Umbrella mode — framework tooling lives ONLY at this umbrella root.
|
|
61
|
-
Service submodules contain just .agent/project-context.yaml (config), not
|
|
62
|
-
command files — they read commands from the umbrella root. No per-service
|
|
63
|
-
framework update is needed here.
|
|
64
|
-
|
|
65
|
-
Exception: if a teammate opens Claude Code directly INSIDE a service repo
|
|
66
|
-
(outside the umbrella), that repo has its own .agent/ — its owning team runs
|
|
67
|
-
/update-framework there independently.
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
## Step 3 — Pre-flight Git Check
|
|
73
|
-
|
|
74
|
-
Chạy `git status --short .agent/ .claude/commands/`.
|
|
75
|
-
|
|
76
|
-
Nếu có thay đổi chưa commit trong các path đó:
|
|
77
|
-
```
|
|
78
|
-
⚠️ Uncommitted changes in .agent/ or .claude/commands/.
|
|
79
|
-
The upgrade overwrites framework files. Commit or stash first so you can
|
|
80
|
-
cleanly review the upgrade diff:
|
|
81
|
-
git add .agent/ .claude/commands/ && git commit -m "wip" (or git stash)
|
|
82
|
-
```
|
|
83
|
-
Hỏi có tiếp tục không `(Y/N)`. Mặc định dừng.
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## Step 4 — Chạy nâng cấp
|
|
88
|
-
|
|
89
|
-
Dựng module flag từ Step 0 (một `--module {name}` cho mỗi module đã cài), rồi chạy:
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
npx -y @educa-corp/sdd-framework@latest --init {--module X ...}
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
Cái này **ghi đè** (làm mới về version mới):
|
|
96
|
-
- `.agent/commands/`, `.agent/steps/`, `.agent/hooks/`, `.agent/rules/`, `.agent/templates/`, `.agent/skills/`, `.agent/modules/{installed}/`
|
|
97
|
-
- `.agent/FRAMEWORK_VERSION`
|
|
98
|
-
- `.claude/commands/` shortcuts
|
|
99
|
-
|
|
100
|
-
Cái này **KHÔNG đụng tới** (nội dung của bạn an toàn):
|
|
101
|
-
- `.agent/project-context.yaml`
|
|
102
|
-
- `CLAUDE.md`
|
|
103
|
-
- `specs/domain-knowledge/` (business-dictionary, core-entities)
|
|
104
|
-
- `.trace/`
|
|
105
|
-
|
|
106
|
-
Nếu lệnh npx exit khác 0 → in lỗi và dừng với `❌`.
|
|
107
|
-
|
|
108
|
-
---
|
|
109
|
-
|
|
110
|
-
## Step 5 — Review Changes
|
|
111
|
-
|
|
112
|
-
Chạy:
|
|
113
|
-
```bash
|
|
114
|
-
git diff --stat .agent/ .claude/commands/
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
Tóm tắt cho người dùng:
|
|
118
|
-
- **New commands** — file `.md` giờ có mà trước không
|
|
119
|
-
- **Updated commands** — file có nội dung thay đổi
|
|
120
|
-
- **Removed commands** — file bị xoá trong version mới
|
|
121
|
-
|
|
122
|
-
> **Từ v0.5.1, "Removed" là trạng thái CÓ THẬT.** Trước đó `installCore` chỉ copy, không có
|
|
123
|
-
> nhánh xoá nào — nên lệnh bị bỏ ở version mới nằm lại trong `.agent/commands/` và
|
|
124
|
-
> `.claude/commands/` **vĩnh viễn**: vẫn hiện trong menu `/`, vẫn chạy được, vẫn mang logic
|
|
125
|
-
> của version cũ, kể cả khi framework đã bỏ nó *vì nó sai*. Step này từng hứa báo cáo một
|
|
126
|
-
> trạng thái mà installer không thể tạo ra (GAPS-v3 G44).
|
|
127
|
-
> Giờ installer tự in ra ngay sau bước cài — đọc các dòng đó, chúng chính xác hơn `git diff`:
|
|
128
|
-
> ```
|
|
129
|
-
> 🗑️ {n} file framework đã bị BỎ ở version này — đã gỡ khỏi .agent/
|
|
130
|
-
> 🗑️ {n} shortcut của lệnh đã bị bỏ — đã gỡ khỏi .claude/commands/
|
|
131
|
-
> ⚠️ {n} file framework đã bị bỏ NHƯNG bạn đã sửa — GIỮ LẠI
|
|
132
|
-
> ```
|
|
133
|
-
> **Chỉ file còn nguyên bản mới bị gỡ.** File bạn đã sửa luôn được giữ + backup — thà để lại
|
|
134
|
-
> một file lạc còn hơn xoá thứ ai đó đã bỏ công viết.
|
|
135
|
-
|
|
136
|
-
Nếu có command mới xuất hiện (vd một slash command mới), nêu rõ để user biết nó giờ đã có.
|
|
137
|
-
|
|
138
|
-
**Kiểm file bị ghi đè.** `--init` copy `core/` → `.agent/` **vô điều kiện** — mọi thứ project đã sửa trong `.agent/` (trừ `project-context.yaml`) bị ghi đè. Từ v0.4.2 lệnh cài tự cứu chúng. Kiểm:
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
ls -d .agent/.overwritten-*/ 2>/dev/null
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
Nếu có → nêu **nổi bật** trong report (đây là thứ dễ trôi nhất trong một diff nâng cấp lớn):
|
|
145
|
-
```
|
|
146
|
-
⚠️ {n} file bạn sửa trong .agent/ đã bị bản nâng cấp ghi đè.
|
|
147
|
-
Bản cũ: .agent/.overwritten-{version}-{date}/
|
|
148
|
-
Xem diff: diff -r .agent/.overwritten-{version}-{date}/ .agent/
|
|
149
|
-
Sửa trực tiếp trong .agent/ KHÔNG bền — nó là mirror sinh ra. Muốn giữ thay đổi:
|
|
150
|
-
chuyển vào repo framework rồi phát hành, hoặc đặt ở CLAUDE.md /
|
|
151
|
-
.agent/project-context.yaml / .agent/project-lessons.md (ba chỗ không bị ghi đè).
|
|
152
|
-
Xử lý xong thì xoá thư mục backup.
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
Nếu **không** có thư mục nào → không in gì. *(Ranh giới vùng-sửa-được đầy đủ: `.agent/README.md`.)*
|
|
156
|
-
|
|
157
|
-
---
|
|
158
|
-
|
|
159
|
-
## Step 5.5 — Kiểm bố cục spec cần migrate
|
|
160
|
-
|
|
161
|
-
*Chỉ quét, KHÔNG tự chuyển file — di chuyển spec là việc người dùng chốt.*
|
|
162
|
-
|
|
163
|
-
Một số version thay đổi **bố cục** spec, không chỉ nội dung command. Quét nhanh hai dạng cũ và in hướng dẫn nếu gặp:
|
|
164
|
-
|
|
165
|
-
| Phát hiện | Nghĩa | Lệnh migrate (dry-run trước) |
|
|
166
|
-
|---|---|---|
|
|
167
|
-
| Có file `.feature` **trực tiếp** dưới `{paths.specs_dir}/*/*/bdd/` (không trong subfolder platform) | Bố cục phẳng trước v0.4.1. `web`/`system` cùng UC va tên nhau; `/validate-traces` không thấy file; System BDD Synthesis luôn rơi về Backend-only. | `npx @educa-corp/sdd-framework --migrate-bdd-platform` → xem plan → thêm `--apply` |
|
|
168
|
-
| Có `{paths.specs_dir}/prd/` hoặc `{paths.specs_dir}/bdd/` ở cấp gốc | Bố cục artifact-type-first (rất cũ) | `npx @educa-corp/sdd-framework --migrate-specs` → `--apply` |
|
|
169
|
-
| Có `{paths.trace_dir}/*.tsv` phẳng (không có `{domain}/{prd-slug}/`) | Trace layout cũ | `--migrate-specs` (xử luôn) |
|
|
170
|
-
|
|
171
|
-
Nếu sạch cả ba → không in gì.
|
|
172
|
-
|
|
173
|
-
Sau migrate, nhắc chạy `/validate-traces` để reconcile sổ trace với bố cục mới.
|
|
174
|
-
|
|
175
|
-
---
|
|
176
|
-
|
|
177
|
-
## Output
|
|
178
|
-
|
|
179
|
-
**Đọc `.agent/steps/report-footer.md`** và áp đúng khuôn footer trong đó (Status Badge ·
|
|
180
|
-
Output Artifacts · Next) cho report cuối, kèm khối bên dưới.
|
|
181
|
-
|
|
182
|
-
```
|
|
183
|
-
/update-framework — v{current} → v{latest}
|
|
184
|
-
|
|
185
|
-
✅ Framework upgraded
|
|
186
|
-
Updated : {N} command files, {M} step files
|
|
187
|
-
New : {list any new commands, e.g. /some-new-command}
|
|
188
|
-
Removed : {list any removed commands, or "none"}
|
|
189
|
-
|
|
190
|
-
Your content was preserved:
|
|
191
|
-
project-context.yaml, CLAUDE.md, domain-knowledge/, .trace/ — untouched
|
|
192
|
-
|
|
193
|
-
Review & commit:
|
|
194
|
-
git diff .agent/
|
|
195
|
-
git add .agent/ .claude/commands/
|
|
196
|
-
git commit -m "chore: upgrade spec-driven-docs v{current} → v{latest}"
|
|
197
|
-
{umbrella mode: this is the umbrella root — service submodules need no framework update}
|
|
198
|
-
|
|
199
|
-
---
|
|
200
|
-
Status : ✅ Complete | ⚠️ Warnings
|
|
201
|
-
Output Artifacts: refreshed .agent/ framework files, .claude/commands/ shortcuts
|
|
202
|
-
Next : review git diff, then commit | /sync to refresh project content
|
|
203
|
-
```
|