spec-lite 1.4.7 → 1.5.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/README.md +8 -4
- package/bin/cli.js +22 -1
- package/package.json +1 -1
- package/skills/artifact-audit/SKILL.md +189 -0
- package/skills/artifact-migrate/SKILL.md +156 -0
- package/skills/plan/SKILL.md +3 -2
- package/skills/spec-brownfield-component/SKILL.md +3 -0
- package/skills/spec-brownfield-feature/SKILL.md +3 -0
- package/skills/spec-brownfield-init/SKILL.md +2 -1
- package/skills/spec-frd/SKILL.md +2 -1
- package/skills/spec-new/SKILL.md +3 -2
- package/skills/spec-prd/SKILL.md +3 -1
- package/skills/spec-sad/SKILL.md +2 -2
- package/skills/spec-tech/SKILL.md +3 -2
- package/skills/spec-test/SKILL.md +3 -2
- package/skills/spec-tsd/SKILL.md +2 -1
- package/skills-overview.md +22 -21
- package/templates/integrations/plan-template.md +4 -0
- package/templates/integrations/spec-template.md +4 -0
- package/templates/integrations/tech-template.md +4 -0
- package/templates/integrations/techdebt-template.md +4 -0
- package/templates/integrations/test-template.md +4 -0
- package/templates/integrations/todo-template.md +4 -0
- package/templates/main/component/cdd-template.md +4 -0
- package/templates/main/component/crd-template.md +4 -0
- package/templates/main/domain-template.md +4 -0
- package/templates/main/feature/fdd-template.md +4 -0
- package/templates/main/feature/frd-template.md +6 -1
- package/templates/main/feature/tsd-template.md +4 -0
- package/templates/main/prd-template.md +4 -0
- package/templates/main/sad-template.md +4 -0
- package/skills/spec-frd-update/SKILL.md +0 -398
package/README.md
CHANGED
|
@@ -151,10 +151,13 @@ Sau khi có findings, hỏi user severity tier muốn xử lý (Critical / Criti
|
|
|
151
151
|
|
|
152
152
|
Skill ad-hoc dùng khi template đã được update và artifacts hiện có cần migrate. Không phải pipeline — chạy khi cần.
|
|
153
153
|
|
|
154
|
-
|
|
155
|
-
Migrate `feature/*/frd.md` hiện có sang format mới nhất của [frd-template.md](.claude/templates/main/feature/frd-template.md). Detect 8 migration vectors: fix Mermaid syntax `[{...}]` → `["..."]`, rename `Feature-level AC` → `Feature AC` với 4 nhóm chuẩn, rename `AC-F{NNN}-*` (Feature AC) → `FAC-F{NNN}-*` + cascade ID remap qua `fdd.md`/`tsd.md`/`integrations/*/{spec,tech,test}.md`, insert US/AC stability notes + Verification Rules, derive Mermaid User Flows từ User Stories, v.v.
|
|
154
|
+
Mỗi template mang `template_version` (số nguyên) trong frontmatter; artifact copy nó lúc được tạo. Khi template đổi structure, artifact cũ thành "lỗi thời" — hai skill dưới phát hiện và migrate. Quy ước đầy đủ: [conventions.md](conventions.md) §7.
|
|
156
155
|
|
|
157
|
-
|
|
156
|
+
#### `/artifact-audit [type]`
|
|
157
|
+
Phát hiện artifact lỗi thời. So `template_version` của artifact với version đọc thẳng từ template. Versioned: `==` → up-to-date; `!=` → out-dated `(vX → vY)` → migrate. Legacy thiếu version → presence-check (đủ required `##` headings + không còn section đã `migrations.remove`): conform → stamp version; lệch → out-dated. Chỉ phát hiện + stamp, KHÔNG migrate. Scope theo arg (1 type / list) hoặc toàn bộ.
|
|
158
|
+
|
|
159
|
+
#### `/artifact-migrate [path]`
|
|
160
|
+
Migrate artifact lỗi thời lên structure mới (generic mọi type). Tự chạy `/artifact-audit` (classify-only) để phát hiện, rồi áp delta từ block `migrations` của template: **add** required section thiếu (skeleton từ template; nội dung mới → interview hoặc `NEEDS_CLARIFY`, không bịa), **remove** section đã `migrations.remove` (có confirm; giữ content tác giả khác), **update** section đổi format (giữ section + ngữ nghĩa, vd ASCII → Mermaid; show cũ + đề xuất mới, không bịa). Rename = remove+add → hỏi carry-over. Single-artifact, không cascade. Pre-flight git clean — rollback dùng git, không `.bak`. No-op nếu đã up-to-date.
|
|
158
161
|
|
|
159
162
|
---
|
|
160
163
|
|
|
@@ -169,7 +172,8 @@ Pre-flight yêu cầu git working tree clean — rollback dùng `git checkout --
|
|
|
169
172
|
| `/spec-brownfield-component` | `.specs/main/component/{C-XXX}-*/crd.md + cdd.md` |
|
|
170
173
|
| `/spec-brownfield-feature` | `.specs/main/feature/{F-XXX}-*/frd.md + fdd.md` |
|
|
171
174
|
| `/spec-tsd` | `.specs/main/feature/{F-XXX}-*/tsd.md` |
|
|
172
|
-
| `/
|
|
175
|
+
| `/artifact-audit` | *(báo cáo out-dated; + stamp `template_version` cho artifact legacy conform)* |
|
|
176
|
+
| `/artifact-migrate` | *(modify in-place artifact lỗi thời lên structure mới + set `template_version`)* |
|
|
173
177
|
| `/spec-new` | `.specs/integrations/{slug}/spec.md` |
|
|
174
178
|
| `/spec-tech` | `.specs/integrations/{slug}/tech.md` |
|
|
175
179
|
| `/spec-test` | `.specs/integrations/{slug}/test.md`, cascade: `feature/{F-XXX}/tsd.md` |
|
package/bin/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { cpSync, mkdirSync, existsSync } from 'fs'
|
|
2
|
+
import { cpSync, mkdirSync, existsSync, readFileSync, writeFileSync } from 'fs'
|
|
3
3
|
import { join, dirname } from 'path'
|
|
4
4
|
import { fileURLToPath } from 'url'
|
|
5
5
|
|
|
@@ -11,6 +11,8 @@ if (command === 'install') {
|
|
|
11
11
|
const pkgRoot = join(__dirname, '..')
|
|
12
12
|
const claudeDir = join(cwd, '.claude')
|
|
13
13
|
|
|
14
|
+
const pkg = JSON.parse(readFileSync(join(pkgRoot, 'package.json'), 'utf8'))
|
|
15
|
+
|
|
14
16
|
mkdirSync(claudeDir, { recursive: true })
|
|
15
17
|
|
|
16
18
|
// Copy skills → .claude/skills/
|
|
@@ -28,6 +30,25 @@ if (command === 'install') {
|
|
|
28
30
|
// Copy references → .claude/references/
|
|
29
31
|
cpSync(join(pkgRoot, 'references'), join(claudeDir, 'references'), { recursive: true })
|
|
30
32
|
console.log('✓ references → .claude/references/')
|
|
33
|
+
|
|
34
|
+
// Write install metadata → .claude/spec-lite.json
|
|
35
|
+
const metaPath = join(claudeDir, 'spec-lite.json')
|
|
36
|
+
const prev = existsSync(metaPath)
|
|
37
|
+
? JSON.parse(readFileSync(metaPath, 'utf8'))
|
|
38
|
+
: null
|
|
39
|
+
const now = new Date().toISOString()
|
|
40
|
+
const meta = {
|
|
41
|
+
name: pkg.name,
|
|
42
|
+
version: pkg.version,
|
|
43
|
+
installedAt: prev?.installedAt ?? now,
|
|
44
|
+
updatedAt: now,
|
|
45
|
+
contents: ['skills', 'templates', 'references'],
|
|
46
|
+
}
|
|
47
|
+
writeFileSync(metaPath, JSON.stringify(meta, null, 2) + '\n')
|
|
48
|
+
const action = prev
|
|
49
|
+
? `updated ${prev.version} → ${pkg.version}`
|
|
50
|
+
: `installed ${pkg.version}`
|
|
51
|
+
console.log(`✓ spec-lite.json → .claude/spec-lite.json (${action})`)
|
|
31
52
|
} else {
|
|
32
53
|
console.log('Usage: npx spec-lite install')
|
|
33
54
|
process.exit(1)
|
package/package.json
CHANGED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: artifact-audit
|
|
3
|
+
description: Audit artifacts trong .specs/ xem có lỗi thời so với template không. So `template_version` của artifact với `template_version` hiện tại đọc thẳng từ template (.claude/templates/). Versioned khớp → up-to-date, lệch → out-dated (in vX → vY). Artifact thiếu version (sinh trước versioning) → đối chiếu structure với template: khớp thì stamp version, lệch thì flag out-dated. KHÔNG tự migrate — chỉ stamp khi chắc chắn khớp + báo cáo. Nhận tùy chọn 1 hay nhiều type làm scope (vd `frd`, `frd,spec`); không có arg → audit mọi type.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# artifact-audit
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Trả lời một câu hỏi: **artifact nào trong `.specs/` đã lỗi thời so với template mới nhất?**
|
|
11
|
+
|
|
12
|
+
Cơ chế (xem `conventions.md` §7 Template Versioning):
|
|
13
|
+
- **Nguồn sự thật** = `template_version` trong frontmatter template đang cài (`.claude/templates/...`). Đọc thẳng lúc chạy — không manifest, không cache.
|
|
14
|
+
- Mỗi artifact mang `template_version` (copy lúc CREATE bởi skill sinh nó). Audit so số artifact với số template.
|
|
15
|
+
|
|
16
|
+
Skill này **chỉ phát hiện + stamp legacy**, **KHÔNG migrate**. Việc đưa structure artifact lên format mới là của `/artifact-migrate` (generic cho mọi type).
|
|
17
|
+
|
|
18
|
+
## When to Use
|
|
19
|
+
|
|
20
|
+
- Sau khi `git pull` kit mới (template có thể đã bump version) → xem artifact nào cần migrate.
|
|
21
|
+
- Audit định kỳ một type cụ thể (`/artifact-audit frd`) hoặc toàn repo (`/artifact-audit`).
|
|
22
|
+
- Sau khi bump `template_version` của một template → tìm mọi artifact giờ thành `out-dated`.
|
|
23
|
+
- Onboarding repo cũ → stamp version cho artifact legacy khớp structure, lọc ra cái cần migrate.
|
|
24
|
+
|
|
25
|
+
## When NOT to Use
|
|
26
|
+
|
|
27
|
+
- Muốn **migrate** artifact lên format mới → `/artifact-migrate` (skill này chỉ flag, không sửa structure).
|
|
28
|
+
- Muốn đổi **nội dung** artifact → integration changeset (`/spec-new`) hoặc edit tay.
|
|
29
|
+
- Chưa cài template vào `.claude/templates/` → skill không có nguồn version để so; dừng.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Type → template map
|
|
34
|
+
|
|
35
|
+
Type của artifact resolve theo **filename** (integration artifact không có field `type` trong frontmatter). Mỗi type map tới đúng một template:
|
|
36
|
+
|
|
37
|
+
| Filename | type | Template (`.claude/templates/...`) |
|
|
38
|
+
| --- | --- | --- |
|
|
39
|
+
| `prd.md` | prd | `main/prd-template.md` |
|
|
40
|
+
| `domain.md` | domain | `main/domain-template.md` |
|
|
41
|
+
| `sad.md` | sad | `main/sad-template.md` |
|
|
42
|
+
| `frd.md` | frd | `main/feature/frd-template.md` |
|
|
43
|
+
| `fdd.md` | fdd | `main/feature/fdd-template.md` |
|
|
44
|
+
| `tsd.md` | tsd | `main/feature/tsd-template.md` |
|
|
45
|
+
| `crd.md` | crd | `main/component/crd-template.md` |
|
|
46
|
+
| `cdd.md` | cdd | `main/component/cdd-template.md` |
|
|
47
|
+
| `spec.md` | spec | `integrations/spec-template.md` |
|
|
48
|
+
| `tech.md` | tech | `integrations/tech-template.md` |
|
|
49
|
+
| `test.md` | test | `integrations/test-template.md` |
|
|
50
|
+
| `plan.md` | plan | `integrations/plan-template.md` |
|
|
51
|
+
| `todo.md` | todo | `integrations/todo-template.md` |
|
|
52
|
+
| `techdebt.md` | techdebt | `integrations/techdebt-template.md` |
|
|
53
|
+
|
|
54
|
+
File không khớp bảng (vd `notes.md`, `*.bak`) → bỏ qua, không phải artifact có template.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Process
|
|
59
|
+
|
|
60
|
+
### Bước 0: Resolve scope
|
|
61
|
+
|
|
62
|
+
- **ARGUMENT là 1 type hoặc list** (vd `frd`, `frd,spec,tech`) → chỉ audit các type đó. Type lạ (không có trong map) → cảnh báo và bỏ qua type đó.
|
|
63
|
+
- **Không có ARGUMENT** → audit **mọi** type trong map.
|
|
64
|
+
|
|
65
|
+
### Bước 1: Đọc current version của template
|
|
66
|
+
|
|
67
|
+
Cho mỗi type trong scope, đọc frontmatter template tương ứng tại `.claude/templates/...` → lấy `template_version`.
|
|
68
|
+
|
|
69
|
+
- Template thiếu field `template_version` → không audit được type đó (chưa versioned ở phía template); cảnh báo, skip type.
|
|
70
|
+
- Template không tồn tại tại `.claude/templates/` → báo kit chưa cài đủ; dừng.
|
|
71
|
+
|
|
72
|
+
Lưu bảng `currentVersion[type]`.
|
|
73
|
+
|
|
74
|
+
### Bước 2: Discover artifacts
|
|
75
|
+
|
|
76
|
+
Quét artifacts trong:
|
|
77
|
+
- `.specs/main/**` (prd, domain, sad, và feature/component artifacts)
|
|
78
|
+
- `.specs/integrations/**` (spec, tech, test, plan, todo, techdebt)
|
|
79
|
+
|
|
80
|
+
**Bỏ qua** (đã đóng băng — không audit/migrate):
|
|
81
|
+
- `.specs/archive/**`, `.specs/removed/**`, file `*.bak.*`, file không khớp type map.
|
|
82
|
+
- **Integration folder đã `done`**: nếu `.specs/integrations/{X}/spec.md` có `status: done` → bỏ qua **toàn bộ folder đó** (spec/tech/test/plan/todo/techdebt). Integration artifacts là **immutable sau khi done** (conventions §7 Versioning) — không migrate record bất biến. Folder integration đang active (spec chưa `done`) và mọi **main artifact** thì vẫn audit/migrate bình thường.
|
|
83
|
+
|
|
84
|
+
Với mỗi file khớp: resolve type theo filename, đọc frontmatter để lấy `template_version` (có thể thiếu).
|
|
85
|
+
|
|
86
|
+
### Bước 3: Classify
|
|
87
|
+
|
|
88
|
+
Cho mỗi artifact:
|
|
89
|
+
|
|
90
|
+
**3a. Có `template_version`** → so với `currentVersion[type]`:
|
|
91
|
+
- `==` → **up-to-date**.
|
|
92
|
+
- `!=` → **out-dated** → cần migrate. Ghi `(vX → vY)`.
|
|
93
|
+
|
|
94
|
+
Version compare bắt **mọi** loại delta của các bump ở giữa — `add` / `remove` / **`update` (format)** — kể cả thay đổi format mà presence-check không thấy được. Số version là tín hiệu tổng.
|
|
95
|
+
|
|
96
|
+
**3b. Thiếu `template_version`** (unversioned — sinh trước versioning) → chưa kết luận được bằng số. Áp **conformance check** (xem `conventions.md` §7 "Conformance model — required-emptyable").
|
|
97
|
+
|
|
98
|
+
> **Điểm mù:** presence-check chỉ thấy heading có/không → **KHÔNG phát hiện được format-update** (vd section vẫn đó nhưng dùng ASCII diagram thay vì Mermaid). Artifact unversioned đủ heading sẽ bị stamp thành conform dù format cũ. Đây là giới hạn cố hữu của nhánh unversioned (format-update chỉ bắt được qua version compare ở 3a). Chấp nhận vì là edge-case pre-versioning.
|
|
99
|
+
|
|
100
|
+
**Presence-check, quan hệ BAO HÀM (superset).** Conformance = artifact **chứa đủ mọi heading required** của template (body rỗng OK). Template là skeleton tối thiểu; artifact đã điền luôn chứa nhiều hơn. KHÔNG đòi giống hệt template.
|
|
101
|
+
- **Required heading** = các heading **`##`** của template body, TRỪ cái đánh dấu `*(nếu có)*` (conditional). Heading `###` là instance/sub (vd `### US-F{NNN}-001`, `### Flow 1`) → KHÔNG tính. Phân biệt bằng level nên deterministic.
|
|
102
|
+
|
|
103
|
+
**Hai dấu hiệu out-dated** (artifact tụt sau template) — đọc `remove` từ block `migrations` của template để biết tên section deprecated cần dò:
|
|
104
|
+
1. **Thiếu** một required heading mà template hiện tại có.
|
|
105
|
+
2. **Còn chứa** một section mà `migrations.remove` ghi đã bỏ (deprecated còn sót).
|
|
106
|
+
|
|
107
|
+
(Đổi tên section được biểu diễn bằng remove + add ở block `migrations`, nên rơi vào cả 2 dấu hiệu: tên cũ nằm trong `remove` → dấu hiệu 2; tên mới là required heading bị thiếu → dấu hiệu 1.)
|
|
108
|
+
|
|
109
|
+
**KHÔNG phải out-dated** (authoring bình thường, vẫn **stamp**):
|
|
110
|
+
- Artifact **thêm** sub-section / heading con không có trong template (vd dưới `### Feature Acceptance Criteria` có thêm `#### NFR AC`). Required heading vẫn có mặt → conform.
|
|
111
|
+
- Body rỗng của một required-emptyable section.
|
|
112
|
+
- Thêm nội dung/bảng/ghi chú riêng **không nằm trong `migrations.remove`**; khác thứ tự; số item nhiều/ít hơn ví dụ.
|
|
113
|
+
|
|
114
|
+
> **Quan trọng — phân biệt dấu hiệu 2 với superset:** section "thừa" (có trong artifact, không trong template) chỉ là out-dated khi tên nó **nằm trong `migrations.remove`** (đã khai báo deprecated). Section thừa **không** được khai báo remove → là content tác giả → **giữ, conform** (superset). Đây là cách removal vẫn detect được bằng presence-check mà không xóa nhầm content.
|
|
115
|
+
|
|
116
|
+
Kết luận:
|
|
117
|
+
- **Conform** (đủ required heading, không dính 1–2) → **stamp** `template_version: <currentVersion>`. Lần audit sau so bằng số.
|
|
118
|
+
- **Out-dated** (dính ≥1 trong 1–2) → KHÔNG stamp. Tóm tắt đúng dấu hiệu (thiếu required heading gì / section deprecated nào còn sót) để `/artifact-migrate` xử lý.
|
|
119
|
+
|
|
120
|
+
> Nguyên tắc thận trọng — chỉ về việc **có stamp hay không**: nếu nghi ngờ một required heading có thực sự thiếu hay không (diễn đạt khác) → flag out-dated thay vì stamp (thà flag thừa còn hơn giấu artifact lỗi thời). **Nội dung thừa không khai báo remove KHÔNG bao giờ là lý do nghi ngờ** — chỉ thiếu-required / deprecated-còn-sót mới tính.
|
|
121
|
+
|
|
122
|
+
### Bước 4: Confirm trước khi stamp
|
|
123
|
+
|
|
124
|
+
> **Chế độ classify-only** (khi `/artifact-migrate` gọi audit làm bước phát hiện): **bỏ qua Bước 4–5** — KHÔNG stamp, KHÔNG confirm, chỉ trả phân loại (up-to-date / legacy-conformant / out-dated) cho caller. Mọi ghi (stamp + migrate) do `/artifact-migrate` điều phối trong một luồng confirm duy nhất. Phần dưới chỉ áp dụng khi audit chạy **standalone**.
|
|
125
|
+
|
|
126
|
+
Nếu Bước 3b có artifact cần stamp → hiển thị danh sách **sẽ stamp** + danh sách **out-dated** trước, xin confirm:
|
|
127
|
+
|
|
128
|
+
> Sẽ ghi `template_version` vào {N} artifact legacy khớp structure (additive frontmatter change). {M} artifact out-dated sẽ KHÔNG bị đụng. Tiếp tục? [y/n]
|
|
129
|
+
|
|
130
|
+
`y` → ghi stamp (chỉ thêm field `template_version` vào frontmatter, không đụng nội dung khác). `n` → bỏ qua stamp, vẫn in báo cáo.
|
|
131
|
+
|
|
132
|
+
Stamp là thay đổi additive an toàn; khuyến nghị commit riêng để diff sạch.
|
|
133
|
+
|
|
134
|
+
### Bước 5: Report
|
|
135
|
+
|
|
136
|
+
In bảng phân nhóm (xem Output Format). Skill **không** migrate, **không** đổi nội dung artifact ngoài việc stamp ở Bước 4.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Output Format
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
ARTIFACT AUDIT — scope: {all | frd, spec}
|
|
144
|
+
Current template versions: prd v1 · domain v1 · sad v1 · frd v2 · spec v1 · ...
|
|
145
|
+
|
|
146
|
+
OUT-DATED ({n}) — cần migrate:
|
|
147
|
+
feature/F-002-payment/frd.md frd v1 → v2 → /artifact-migrate
|
|
148
|
+
feature/F-003-x/frd.md frd unversioned, lệch structure (thiếu: Verification Rules) → migrate
|
|
149
|
+
|
|
150
|
+
STAMPED ({n}) — legacy khớp structure, vừa ghi template_version:
|
|
151
|
+
feature/F-001-auth/frd.md frd → v2
|
|
152
|
+
integrations/001-checkout/spec.md spec → v1
|
|
153
|
+
|
|
154
|
+
UP-TO-DATE ({n}): {đếm, liệt kê path ngắn gọn hoặc gập lại nếu nhiều}
|
|
155
|
+
|
|
156
|
+
Bước tiếp theo (nếu có out-dated):
|
|
157
|
+
- /artifact-migrate [path]
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Common Rationalizations
|
|
163
|
+
|
|
164
|
+
| Rationalization | Reality |
|
|
165
|
+
| --- | --- |
|
|
166
|
+
| "Cứ stamp hết cho gọn rồi tính sau" | Stamp nhầm artifact lệch structure = giấu luôn nó khỏi audit lần sau. Chỉ stamp khi structure khớp chắc chắn. |
|
|
167
|
+
| "Audit luôn tiện migrate luôn" | Hai trách nhiệm khác nhau. Audit chỉ phát hiện; migrate (đổi structure) là `/artifact-migrate` với dry-run + confirm. |
|
|
168
|
+
| "Thiếu version thì coi như out-dated hết" | Sai — legacy khớp structure chỉ là chưa stamp, không phải lỗi thời. Phải đối chiếu structure trước khi kết luận. |
|
|
169
|
+
| "Artifact có thêm `#### NFR AC` mà template không có → lệch → out-dated" | Sai — template là skeleton tối thiểu; thừa sub-section/nội dung là authoring bình thường. Conformance là quan hệ bao hàm: section bắt buộc còn đó → conform. Chỉ thiếu/đổi-tên/đổi-format mới là out-dated. |
|
|
170
|
+
|
|
171
|
+
## Red Flags
|
|
172
|
+
|
|
173
|
+
- Stamp `template_version` cho artifact mà chưa đối chiếu structure với template.
|
|
174
|
+
- Tự sửa structure / nội dung artifact (vượt phạm vi — đó là migration skill).
|
|
175
|
+
- Flag out-dated chỉ vì artifact có thêm sub-section / nội dung ngoài template (thừa ≠ lỗi thời; chỉ thiếu/đổi-tên/đổi-format mới tính).
|
|
176
|
+
- Audit/stamp artifact đóng băng: `.specs/archive/`, `.specs/removed/`, hoặc integration folder có spec.md `status: done` (immutable record — bỏ qua).
|
|
177
|
+
- Đọc version từ một manifest/cache thay vì đọc thẳng frontmatter template.
|
|
178
|
+
|
|
179
|
+
## Verification
|
|
180
|
+
|
|
181
|
+
- [ ] Scope resolve đúng từ argument (1 type / list / mọi type)
|
|
182
|
+
- [ ] Current version đọc thẳng từ frontmatter template tại `.claude/templates/...` (không manifest)
|
|
183
|
+
- [ ] Bỏ qua `.specs/archive/`, `.specs/removed/`, `*.bak.*`, file không khớp type map, và integration folder có spec.md `status: done`
|
|
184
|
+
- [ ] Versioned: `==` → up-to-date; `!=` → out-dated `(vX → vY)` → migrate
|
|
185
|
+
- [ ] Unversioned: conformance là quan hệ bao hàm (artifact chứa đủ structure bắt buộc; thừa sub-section/nội dung không khai báo remove KHÔNG phải lỗi thời); 2 dấu hiệu out-dated = thiếu required heading / section `migrations.remove` còn sót
|
|
186
|
+
- [ ] Conform → stamp; out-dated → tóm tắt đúng dấu hiệu (thiếu required heading gì / section deprecated nào còn sót). Lưu ý: presence-check KHÔNG bắt format-update (blind spot unversioned)
|
|
187
|
+
- [ ] Có confirm trước khi ghi stamp; stamp chỉ thêm field `template_version`, không đụng nội dung khác
|
|
188
|
+
- [ ] KHÔNG migrate / không sửa structure artifact
|
|
189
|
+
- [ ] Report phân nhóm out-dated / stamped / up-to-date + bước tiếp theo
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: artifact-migrate
|
|
3
|
+
description: Migrate artifact trong .specs/ lên structure template mới nhất. Generic cho mọi type. Tự chạy /artifact-audit (classify-only, scoped) để phát hiện out-dated, rồi áp delta từ block `migrations` của template — add section thiếu, remove section deprecated, update format section (vd ASCII→Mermaid) — set template_version = current. Tương tác: confirm add/remove/update, hỏi carry-over khi rename, section nội dung mới thì interview hoặc NEEDS_CLARIFY (không bịa). Single-artifact, KHÔNG cascade. Nhận tùy chọn 1 artifact (path); không có arg → quét toàn bộ, migrate từng cái có confirm + skip.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# artifact-migrate
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Đưa một artifact (hoặc toàn bộ) **lỗi thời** lên đúng structure của template mới nhất, rồi cập nhật `template_version`. Đây là vế **fix** đối xứng với `/artifact-audit` (vế **detect**).
|
|
11
|
+
|
|
12
|
+
Cơ chế (xem `conventions.md` §7 Template Versioning):
|
|
13
|
+
- **Required section hiện tại** = body `##` headings của template (deterministic theo level; `###` = instance).
|
|
14
|
+
- **Delta giữa các version** = đọc từ block `migrations` của template: mỗi entry `to: N` ghi `add` (section thêm) + `remove` (section bỏ) + `update` (section giữ nhưng đổi format/cách thể hiện, vd ASCII → Mermaid). `remove` và `update` không suy lại được từ body → block `migrations` là nguồn duy nhất.
|
|
15
|
+
- Migrate **single-artifact, KHÔNG cascade**. ID format đổi (hiếm, cross-artifact) → xử lý tay theo `note`.
|
|
16
|
+
|
|
17
|
+
## When to Use
|
|
18
|
+
|
|
19
|
+
- Sau `git pull` kit mới, `/artifact-audit` báo có artifact out-dated → migrate chúng lên template mới.
|
|
20
|
+
- Onboarding repo cũ: artifact legacy thiếu version / lệch structure.
|
|
21
|
+
- Sau khi bump `template_version` một template → migrate các artifact cùng type.
|
|
22
|
+
|
|
23
|
+
## When NOT to Use
|
|
24
|
+
|
|
25
|
+
- Chỉ muốn **biết** artifact nào lỗi thời (không sửa) → `/artifact-audit`.
|
|
26
|
+
- Muốn đổi **nội dung** artifact (thêm US, đổi AC) → integration changeset (`/spec-new`) hoặc edit tay.
|
|
27
|
+
- Working tree đang dirty → commit/stash trước (skill rollback dựa git, không tạo `.bak`).
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Type → template map
|
|
32
|
+
|
|
33
|
+
Resolve type theo **filename** (giống `/artifact-audit` — integration artifact không có field `type`). Mỗi type map tới đúng một template tại `.claude/templates/...`:
|
|
34
|
+
|
|
35
|
+
`prd.md`→`main/prd-template.md` · `domain.md`→`main/domain-template.md` · `sad.md`→`main/sad-template.md` · `frd.md`→`main/feature/frd-template.md` · `fdd.md`→`main/feature/fdd-template.md` · `tsd.md`→`main/feature/tsd-template.md` · `crd.md`→`main/component/crd-template.md` · `cdd.md`→`main/component/cdd-template.md` · `spec.md`→`integrations/spec-template.md` · `tech.md`→`integrations/tech-template.md` · `test.md`→`integrations/test-template.md` · `plan.md`→`integrations/plan-template.md` · `todo.md`→`integrations/todo-template.md` · `techdebt.md`→`integrations/techdebt-template.md`
|
|
36
|
+
|
|
37
|
+
File không khớp map → bỏ qua.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Process
|
|
42
|
+
|
|
43
|
+
### Bước 0: Resolve scope
|
|
44
|
+
|
|
45
|
+
- **ARGUMENT là path tới 1 artifact** → migrate riêng nó. Nếu artifact thuộc integration folder đã `done` (spec.md `status: done`) hoặc nằm trong `.specs/archive`/`.specs/removed` → **DỪNG**, báo "artifact đóng băng (immutable record) — không migrate".
|
|
46
|
+
- **Không có ARGUMENT** → quét `.specs/main/**` + `.specs/integrations/**`, áp **đúng skip list của `/artifact-audit`** (bỏ archive/removed, `*.bak.*`, và **integration folder có spec.md `status: done`**).
|
|
47
|
+
|
|
48
|
+
### Bước 1: Pre-flight — working tree clean
|
|
49
|
+
|
|
50
|
+
Chạy `git status --porcelain`. Output không rỗng → **DỪNG**:
|
|
51
|
+
> ⛔ Working tree không clean. Skill không tạo `.bak` — rollback dựa git. Hãy commit/stash trước rồi chạy lại.
|
|
52
|
+
|
|
53
|
+
Không phải git repo → cảnh báo, yêu cầu confirm (default no) vì không rollback được.
|
|
54
|
+
|
|
55
|
+
### Bước 2: Detect — tự chạy `/artifact-audit` (classify-only, scoped)
|
|
56
|
+
|
|
57
|
+
Dùng **chính conformance check của `/artifact-audit`** (presence-check, conventions §7) làm bước phát hiện — một nguồn phán đoán duy nhất, không tự cài lại logic. Scoped theo Bước 0:
|
|
58
|
+
- Có arg → audit đúng artifact/type đó.
|
|
59
|
+
- Không arg → audit toàn bộ scope.
|
|
60
|
+
|
|
61
|
+
Audit chạy **classify-only** ở đây: chỉ phân loại, **không tự stamp/confirm** (migrate sẽ điều phối mọi ghi vào một luồng confirm). Kết quả mỗi artifact:
|
|
62
|
+
- **up-to-date** (versioned, version `==` template) → bỏ qua. Target đơn lẻ → **no-op sớm**, thoát.
|
|
63
|
+
- **legacy-conformant** (thiếu version nhưng đủ required `##`, không dính `migrations.remove`) → chỉ cần **stamp** version (không đổi structure).
|
|
64
|
+
- **out-dated** (versioned `!=` template, HOẶC unversioned thiếu required `##`, HOẶC còn section trong `migrations.remove`) → cần migrate structure.
|
|
65
|
+
|
|
66
|
+
Không arg → in danh sách phân nhóm trước, rồi xử lý **từng artifact một, có confirm + cho skip** (không bulk-auto).
|
|
67
|
+
|
|
68
|
+
### Bước 3: Lập transform plan cho từng artifact
|
|
69
|
+
|
|
70
|
+
Resolve type→template, đọc template: `template_version` hiện tại + block `migrations` + body `##` headings.
|
|
71
|
+
|
|
72
|
+
Gộp delta các entry `to:` > version artifact (hoặc tất cả nếu artifact unversioned):
|
|
73
|
+
|
|
74
|
+
1. **Sections cần ADD** = required `##` của template mà artifact **thiếu**. (Phát hiện bằng so `##` body, deterministic; `migrations.add` để tham khảo delta.)
|
|
75
|
+
2. **Sections cần REMOVE** = section trong **`migrations.remove`** mà artifact **còn chứa**.
|
|
76
|
+
3. **Sections cần UPDATE format** = section trong **`migrations.update`** (giữ section, đổi cách thể hiện — vd ASCII → Mermaid). Section vẫn còn → không add/remove; chỉ transform format theo mô tả `change`. (Không suy được từ presence-check → bắt buộc dựa `migrations.update`.)
|
|
77
|
+
4. **Rename phát hiện được** khi một `remove` (tên cũ) đi kèm một `add` (tên mới) trong cùng entry — đánh dấu để hỏi carry-over content.
|
|
78
|
+
5. **ID format** (nếu `note` đề cập, cross-artifact) → liệt kê để người dùng sửa tay; skill không tự remap.
|
|
79
|
+
|
|
80
|
+
### Bước 4: Dry-run + confirm (một luồng)
|
|
81
|
+
|
|
82
|
+
Trình bày cho user **trước khi ghi**:
|
|
83
|
+
- sections sẽ ADD (kèm skeleton lấy từ body template) + sections sẽ REMOVE (kèm reason).
|
|
84
|
+
- sections sẽ UPDATE format → show **nội dung hiện tại** + **đề xuất bản chuyển format** (vd ASCII diagram → Mermaid tương ứng), giữ nguyên ngữ nghĩa.
|
|
85
|
+
- cặp rename phát hiện được → hỏi: "carry-over nội dung từ {cũ} sang {mới}?".
|
|
86
|
+
- artifact legacy-conformant trong scope → sẽ stamp version (gộp vào cùng confirm).
|
|
87
|
+
|
|
88
|
+
User confirm (toàn bộ / từng item / skip artifact). **Section nội dung mới** (vd Verification Rules) → **interview user điền** hoặc chèn `**[NEEDS_CLARIFY]**` — **KHÔNG tự bịa nội dung**. Với UPDATE format: chuyển *cách thể hiện*, **không bịa thêm/bớt thông tin** so với bản cũ; phần không chắc → giữ + `[NEEDS_CLARIFY]`.
|
|
89
|
+
|
|
90
|
+
### Bước 5: Apply (atomic mỗi artifact)
|
|
91
|
+
|
|
92
|
+
- Chèn section ADD theo đúng thứ tự body template; nếu là rename + user đồng ý carry-over → move nội dung từ section cũ sang.
|
|
93
|
+
- Xóa section REMOVE (đã confirm).
|
|
94
|
+
- Áp UPDATE format: thay nội dung section bằng bản chuyển format đã confirm (giữ section + ngữ nghĩa).
|
|
95
|
+
- **Giữ nguyên** mọi sub-section / content tác giả **không nằm trong `remove`/`update`** (superset rule).
|
|
96
|
+
- Set frontmatter `template_version` = current.
|
|
97
|
+
- Nếu template có `## Change History` (main artifact) → append entry, operation = `manual`:
|
|
98
|
+
```markdown
|
|
99
|
+
### {YYYY-MM-DD} — manual — migrate
|
|
100
|
+
|
|
101
|
+
- **Migration**: v{cũ} → v{current} qua /artifact-migrate (add: {...}; remove: {...}; update: {...})
|
|
102
|
+
```
|
|
103
|
+
- **Single-artifact, KHÔNG cascade.** Apply fail → rollback bằng git (`git checkout -- {file}`); báo user.
|
|
104
|
+
|
|
105
|
+
### Bước 6: Report
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
ARTIFACT MIGRATE — scope: {file | all}
|
|
109
|
+
|
|
110
|
+
MIGRATED ({n}):
|
|
111
|
+
feature/F-002-payment/frd.md v0 → v1 +User Flows, −Components Consumed, ~System Overview (ASCII→Mermaid)
|
|
112
|
+
STAMPED ({n}) — legacy conform, chỉ set version:
|
|
113
|
+
feature/F-001-auth/frd.md → v1
|
|
114
|
+
SKIPPED / up-to-date ({n})
|
|
115
|
+
|
|
116
|
+
{nếu có} NEEDS_CLARIFY còn lại:
|
|
117
|
+
feature/F-002-payment/frd.md → Verification Rules (chờ điền)
|
|
118
|
+
{nếu có} Cần sửa tay (ID remap theo note):
|
|
119
|
+
...
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Common Rationalizations
|
|
125
|
+
|
|
126
|
+
| Rationalization | Reality |
|
|
127
|
+
| --- | --- |
|
|
128
|
+
| "Tự đoán nội dung cho section mới cho nhanh" | Section nội dung mới = quyết định của BA/owner. Bịa = sai mà không ai review. Interview hoặc NEEDS_CLARIFY. |
|
|
129
|
+
| "Section thừa chắc là rác, xóa luôn" | Chỉ xóa section nằm trong `migrations.remove`. Thừa khác là content tác giả → giữ (superset). |
|
|
130
|
+
| "Format đổi thì xóa section rồi thêm lại" | remove+add làm **mất nội dung**. Format-update giữ section + ngữ nghĩa, chỉ chuyển cách thể hiện (dùng op `update`). |
|
|
131
|
+
| "Chuyển format thì tiện viết lại nội dung cho đẹp" | UPDATE chỉ đổi *cách thể hiện*, KHÔNG thêm/bớt thông tin. Phần không chắc → giữ + NEEDS_CLARIFY. |
|
|
132
|
+
| "Migrate tiện remap ID luôn" | Không có op remap; cascade đã bỏ. ID đổi (hiếm) ghi ở `note`, người dùng sửa tay. |
|
|
133
|
+
| "Khỏi chạy audit, tự check structure cho nhanh" | Phải dùng audit classify-only → một nguồn phán đoán duy nhất, không lệch giữa hai skill. |
|
|
134
|
+
|
|
135
|
+
## Red Flags
|
|
136
|
+
|
|
137
|
+
- Bịa nội dung cho section ADD thay vì interview / NEEDS_CLARIFY.
|
|
138
|
+
- Xóa section không nằm trong `migrations.remove` (vi phạm superset).
|
|
139
|
+
- Tự remap ID / đụng tới artifact khác (migrate là single-artifact, không cascade).
|
|
140
|
+
- Chạy khi working tree dirty (mất đường rollback).
|
|
141
|
+
- Migrate artifact đóng băng: integration folder đã `done`, `.specs/archive`, `.specs/removed` (immutable record — phải skip).
|
|
142
|
+
- Migrate artifact đã up-to-date (phải no-op sớm).
|
|
143
|
+
- Tự cài lại logic detect thay vì dùng audit classify-only.
|
|
144
|
+
|
|
145
|
+
## Verification
|
|
146
|
+
|
|
147
|
+
- [ ] Pre-flight: working tree clean (hoặc user confirm khi không phải git repo)
|
|
148
|
+
- [ ] Detect bằng `/artifact-audit` classify-only, scoped theo target; version `==` → up-to-date → no-op sớm; `!=` → migrate
|
|
149
|
+
- [ ] Required `##` thiếu → ADD (skeleton từ body template); section `migrations.remove` còn sót → REMOVE (confirm)
|
|
150
|
+
- [ ] Section `migrations.update` → chuyển format (giữ section + ngữ nghĩa); show cũ + đề xuất mới, confirm; KHÔNG thêm/bớt thông tin
|
|
151
|
+
- [ ] Rename (remove+add) → hỏi carry-over content; section nội dung mới → interview / NEEDS_CLARIFY (KHÔNG bịa)
|
|
152
|
+
- [ ] Giữ content tác giả không nằm trong `remove`/`update` (superset)
|
|
153
|
+
- [ ] Set `template_version` = current; main artifact có Change History entry operation `manual`/migrate
|
|
154
|
+
- [ ] Single-artifact, KHÔNG cascade; ID remap (nếu có) chỉ báo để sửa tay
|
|
155
|
+
- [ ] Không arg → liệt kê trước, migrate từng cái có confirm + skip
|
|
156
|
+
- [ ] Apply fail → rollback git; user được thông báo
|
package/skills/plan/SKILL.md
CHANGED
|
@@ -118,7 +118,7 @@ Invoke `planning-and-task-breakdown` với context đã load. Skill đó sẽ th
|
|
|
118
118
|
|
|
119
119
|
### plan.md
|
|
120
120
|
|
|
121
|
-
Dùng `.claude/templates/integrations/plan-template.md` làm skeleton, điền nội dung từ breakdown vào từng section.
|
|
121
|
+
Dùng `.claude/templates/integrations/plan-template.md` làm skeleton, điền nội dung từ breakdown vào từng section. Frontmatter lấy `template_version` từ template (xem `conventions.md` §7).
|
|
122
122
|
|
|
123
123
|
**Lưu ý format:**
|
|
124
124
|
- Task ID dùng `·` (middle dot), không dùng `—`
|
|
@@ -128,7 +128,7 @@ Dùng `.claude/templates/integrations/plan-template.md` làm skeleton, điền n
|
|
|
128
128
|
|
|
129
129
|
### todo.md
|
|
130
130
|
|
|
131
|
-
Dùng `.claude/templates/integrations/todo-template.md` làm skeleton, điền nội dung từ breakdown vào từng section.
|
|
131
|
+
Dùng `.claude/templates/integrations/todo-template.md` làm skeleton, điền nội dung từ breakdown vào từng section. Frontmatter lấy `template_version` từ template.
|
|
132
132
|
|
|
133
133
|
---
|
|
134
134
|
|
|
@@ -146,3 +146,4 @@ Nếu trong quá trình breakdown phát hiện delta cần cập nhật `sad.md`
|
|
|
146
146
|
- [ ] plan.md có section **Dependency Graph**
|
|
147
147
|
- [ ] Mỗi task có đủ: Mục tiêu / depends / Các bước / Verification
|
|
148
148
|
- [ ] Không viết code trong suốt quá trình
|
|
149
|
+
- [ ] plan.md + todo.md có `template_version` copy từ template tương ứng
|
|
@@ -221,6 +221,8 @@ Ghi tất cả? [y] hoặc review từng file trước [r]:
|
|
|
221
221
|
- `y` → ghi tất cả
|
|
222
222
|
- `r` → hiển thị lần lượt từng file, user confirm / skip / edit từng cái
|
|
223
223
|
|
|
224
|
+
**Stamp `template_version`:** frontmatter mỗi `crd.md`/`cdd.md` lấy `template_version` từ template tương ứng (xem `conventions.md` §7).
|
|
225
|
+
|
|
224
226
|
**Change History:** Append entry vào section `## Change History` cuối mỗi `crd.md`/`cdd.md` vừa ghi (theo `conventions.md` §5.5):
|
|
225
227
|
|
|
226
228
|
```markdown
|
|
@@ -304,4 +306,5 @@ Bước tiếp theo:
|
|
|
304
306
|
- [ ] prd.md Component Index đã được update
|
|
305
307
|
- [ ] sad.md Components table đã được update — danh sách C-XXX khớp với prd.md
|
|
306
308
|
- [ ] Shared Entities đã được cascade vào domain.md (nếu có)
|
|
309
|
+
- [ ] Mỗi crd.md/cdd.md có `template_version` copy từ template tương ứng
|
|
307
310
|
- [ ] NEEDS_CLARIFY items được list đầy đủ trong summary
|
|
@@ -225,6 +225,8 @@ Sẽ tạo {N} features ({2N} files):
|
|
|
225
225
|
Ghi tất cả? [y] hoặc review từng file trước [r]:
|
|
226
226
|
```
|
|
227
227
|
|
|
228
|
+
**Stamp `template_version`:** frontmatter mỗi `frd.md`/`fdd.md` lấy `template_version` từ template tương ứng (xem `conventions.md` §7).
|
|
229
|
+
|
|
228
230
|
**Change History:** Append entry vào section `## Change History` cuối mỗi `frd.md`/`fdd.md` vừa ghi (theo `conventions.md` §5.5):
|
|
229
231
|
|
|
230
232
|
```markdown
|
|
@@ -307,4 +309,5 @@ grep "NEEDS_CLARIFY" để tìm và fill in khi có thêm context.
|
|
|
307
309
|
- [ ] Feature không có tests → AC section có NEEDS_CLARIFY rõ ràng
|
|
308
310
|
- [ ] Verification Rules: rule reverse-engineer từ code đã đánh dấu source; field thiếu validation đã NEEDS_CLARIFY; không chứa regex/code/error message
|
|
309
311
|
- [ ] prd.md Feature Index đã được update
|
|
312
|
+
- [ ] Mỗi frd.md/fdd.md có `template_version` copy từ template tương ứng
|
|
310
313
|
- [ ] NEEDS_CLARIFY items được list đầy đủ trong summary
|
|
@@ -272,7 +272,7 @@ Confirm? [y] Bỏ qua [n] Chỉnh sửa [e]:
|
|
|
272
272
|
|
|
273
273
|
### Bước 9: Save
|
|
274
274
|
|
|
275
|
-
Tạo `.specs/main/` nếu chưa có. Ghi các files đã được confirm.
|
|
275
|
+
Tạo `.specs/main/` nếu chưa có. Ghi các files đã được confirm. Frontmatter mỗi file (`prd.md`/`domain.md`/`sad.md`) lấy `template_version` từ template tương ứng (xem `conventions.md` §7).
|
|
276
276
|
|
|
277
277
|
**Change History:** Append entry vào section `## Change History` cuối mỗi file vừa ghi (`prd.md`, `domain.md`, `sad.md`) theo `conventions.md` §5.5:
|
|
278
278
|
|
|
@@ -320,3 +320,4 @@ Format chuẩn — dùng nhất quán trong tất cả artifacts:
|
|
|
320
320
|
- [ ] sad.md có Architectural Guardrails section
|
|
321
321
|
- [ ] NEEDS_CLARIFY items được list đầy đủ trong summary cuối
|
|
322
322
|
- [ ] User đã confirm từng file trước khi ghi
|
|
323
|
+
- [ ] Mỗi file (prd/domain/sad) có `template_version` copy từ template tương ứng
|
package/skills/spec-frd/SKILL.md
CHANGED
|
@@ -223,7 +223,7 @@ Dùng `.claude/templates/main/feature/frd-template.md` làm skeleton, điền n
|
|
|
223
223
|
|
|
224
224
|
**ID assignment** (luôn là create — frd mới): US `US-F{NNN}-001+`, Story AC `AC-F{NNN}-001+`, Feature AC `FAC-F{NNN}-001+` (counter độc lập với Story AC), VR `VR-F{NNN}-001+`. `NNN` = số của F-XXX. Flow đánh số từ 1.
|
|
225
225
|
|
|
226
|
-
**Frontmatter** frd mới: theo template, `status: draft`, `owner: BA`, `feature_id: F-XXX
|
|
226
|
+
**Frontmatter** frd mới: theo template, `status: draft`, `owner: BA`, `feature_id: F-XXX`, `template_version` copy từ `frd-template.md` (xem `conventions.md` §7 — chỉ set lúc CREATE; thay đổi sau qua `/spec-new` không đụng version).
|
|
227
227
|
|
|
228
228
|
Hiển thị **toàn bộ draft** cho user — chưa ghi file. Kèm:
|
|
229
229
|
- danh sách component candidate (nếu có) và VR còn `TBD`;
|
|
@@ -360,6 +360,7 @@ Bước tiếp theo:
|
|
|
360
360
|
- [ ] **Create-only gate**: frd.md của feature mục tiêu CHƯA tồn tại; nếu đã có đã redirect `/spec-new`
|
|
361
361
|
- [ ] Feature mục tiêu có trong Index, HOẶC feature mới đơn lẻ đã được user đồng ý register (Bước 1b)
|
|
362
362
|
- [ ] frd.md có đủ 7 core sections (luôn create mới); `Open Questions` chứa câu hỏi clarify + component candidate còn mở, hoặc đã xóa nếu rỗng
|
|
363
|
+
- [ ] Frontmatter có `template_version` copy từ `frd-template.md`
|
|
363
364
|
- [ ] Mỗi User Story có persona + priority + ít nhất 1 AC Given/When/Then
|
|
364
365
|
- [ ] Feature AC dùng ID `FAC-F{NNN}-{seq}` (counter độc lập với `AC-F{NNN}`), Then đo được
|
|
365
366
|
- [ ] Verification Rules đã confirm với BA (không tự assert); không chứa regex/code/error message; semantic type
|
package/skills/spec-new/SKILL.md
CHANGED
|
@@ -343,7 +343,7 @@ Chỉ tiến hành Bước 7 sau khi user confirm. Nếu user yêu cầu chỉnh
|
|
|
343
343
|
|
|
344
344
|
Tạo thư mục `.specs/integrations/{NNN}-{slug}/` nếu chưa có.
|
|
345
345
|
|
|
346
|
-
**[7.1] Ghi spec.md** với status `approved` (không phải `draft` — human đã confirm ở Bước 6 chính là approval). Frontmatter `features` và `components` phải được điền theo những gì đã nhận diện ở Bước 2.
|
|
346
|
+
**[7.1] Ghi spec.md** với status `approved` (không phải `draft` — human đã confirm ở Bước 6 chính là approval). Frontmatter `features` và `components` phải được điền theo những gì đã nhận diện ở Bước 2; `template_version` lấy từ `spec-template.md` (xem `conventions.md` §7).
|
|
347
347
|
|
|
348
348
|
**[7.2] Auto-apply mỗi Changes block** vào main artifact tương ứng. Thứ tự apply (để tránh forward reference): `prd.md` → `domain.md` → `sad.md` → `component/*/crd.md` → `feature/*/frd.md`.
|
|
349
349
|
|
|
@@ -352,7 +352,7 @@ Cho từng block:
|
|
|
352
352
|
- **Operation=create:**
|
|
353
353
|
- Tạo file mới tại path tương ứng
|
|
354
354
|
- Nội dung = nội dung của Changes block (theo format của template gốc)
|
|
355
|
-
- Frontmatter của artifact mới: lấy từ template (status `draft` cho artifact mới — separate lifecycle với spec.md)
|
|
355
|
+
- Frontmatter của artifact mới: lấy từ template, gồm `template_version` (status `draft` cho artifact mới — separate lifecycle với spec.md). `template_version` chỉ stamp ở operation=create; **operation=update KHÔNG đụng** version của artifact hiện có.
|
|
356
356
|
|
|
357
357
|
- **Operation=update:**
|
|
358
358
|
- Đọc artifact hiện tại
|
|
@@ -443,3 +443,4 @@ Sau khi user confirm (Bước 7):
|
|
|
443
443
|
- [ ] Auto-apply chạy theo thứ tự prd → domain → sad → crd → frd
|
|
444
444
|
- [ ] Mỗi artifact bị touched có entry mới được append vào `## Change History` (xem `conventions.md` §5.5)
|
|
445
445
|
- [ ] Fail-safe: nếu apply fail thì không ghi spec.md (rollback luôn Change History entries)
|
|
446
|
+
- [ ] Artifact create (spec.md + frd/crd mới) có `template_version` copy từ template; artifact update giữ nguyên version cũ
|
package/skills/spec-prd/SKILL.md
CHANGED
|
@@ -279,6 +279,8 @@ Chỉ ghi file sau khi user confirm. Nếu user yêu cầu chỉnh sửa → c
|
|
|
279
279
|
|
|
280
280
|
Nếu `domain.md` đã tồn tại với nội dung thực → không đụng tới.
|
|
281
281
|
|
|
282
|
+
**5b'. Stamp `template_version`:** frontmatter `prd.md` (lúc create) và `domain.md` (lúc scaffold) lấy `template_version` từ template tương ứng (xem `conventions.md` §7 Template Versioning). Lần chạy sau update `prd.md` → giữ nguyên `template_version` hiện có, KHÔNG đụng.
|
|
283
|
+
|
|
282
284
|
**5c. Append Change History entry** vào mỗi artifact vừa ghi/scaffold (theo `conventions.md` §5.5):
|
|
283
285
|
|
|
284
286
|
```markdown
|
|
@@ -323,7 +325,7 @@ Bước tiếp theo:
|
|
|
323
325
|
|
|
324
326
|
Trước khi kết thúc, kiểm tra:
|
|
325
327
|
|
|
326
|
-
- [ ] Frontmatter đầy đủ và đúng schema (id, type,
|
|
328
|
+
- [ ] Frontmatter đầy đủ và đúng schema (id, type, status, owner, project_name, `template_version`) — `template_version` copy từ template lúc create, update không đụng
|
|
327
329
|
- [ ] Problem Statement từ góc nhìn business, không mention tech stack
|
|
328
330
|
- [ ] Mỗi persona có: tên vai trò, mục tiêu, pain point
|
|
329
331
|
- [ ] Out of Scope có ít nhất 1 item với lý do
|
package/skills/spec-sad/SKILL.md
CHANGED
|
@@ -191,7 +191,7 @@ Chỉ ghi file sau khi user confirm. Nếu user yêu cầu chỉnh sửa → c
|
|
|
191
191
|
|
|
192
192
|
### Bước 5: Save
|
|
193
193
|
|
|
194
|
-
Ghi nội dung đã được confirm vào `.specs/main/sad.md`.
|
|
194
|
+
Ghi nội dung đã được confirm vào `.specs/main/sad.md`. Frontmatter lấy `template_version` từ `sad-template.md` lúc create (xem `conventions.md` §7); lần chạy update sau giữ nguyên, không đụng.
|
|
195
195
|
|
|
196
196
|
**Change History:** Append entry vào section `## Change History` cuối `sad.md` (theo `conventions.md` §5.5):
|
|
197
197
|
|
|
@@ -246,7 +246,7 @@ Bước tiếp theo:
|
|
|
246
246
|
|
|
247
247
|
Trước khi kết thúc, kiểm tra:
|
|
248
248
|
|
|
249
|
-
- [ ] Frontmatter đầy đủ và đúng schema
|
|
249
|
+
- [ ] Frontmatter đầy đủ và đúng schema (gồm `template_version` copy từ template lúc create; update không đụng)
|
|
250
250
|
- [ ] Architectural Style có lý do gắn với NFRs hoặc constraints
|
|
251
251
|
- [ ] System Overview có diagram + Components table; danh sách C-XXX khớp với `prd.md > Components` (hoặc cả hai cùng rỗng nếu Component Index chưa được điền)
|
|
252
252
|
- [ ] Mỗi tech stack item có lý do chọn rõ ràng
|
|
@@ -216,7 +216,7 @@ Chỉ ghi file sau khi user confirm. Nếu user yêu cầu chỉnh sửa → c
|
|
|
216
216
|
|
|
217
217
|
### Bước 6: Save + Auto-cascade
|
|
218
218
|
|
|
219
|
-
**[6.1] Ghi `.specs/integrations/{slug}/tech.md`** với status `approved` (không phải `draft` — human đã confirm ở Bước 5 chính là approval). Frontmatter `features` và `components` mirror từ `spec.md
|
|
219
|
+
**[6.1] Ghi `.specs/integrations/{slug}/tech.md`** với status `approved` (không phải `draft` — human đã confirm ở Bước 5 chính là approval). Frontmatter `features` và `components` mirror từ `spec.md`; `template_version` lấy từ `tech-template.md` (xem `conventions.md` §7).
|
|
220
220
|
|
|
221
221
|
**[6.2] Auto-apply mỗi Changes block** vào main artifact tương ứng. Thứ tự apply (để tránh forward reference): `sad.md` → `domain.md` → `component/*/cdd.md` → `feature/*/fdd.md`.
|
|
222
222
|
|
|
@@ -225,7 +225,7 @@ Cho từng block:
|
|
|
225
225
|
- **Operation=create:**
|
|
226
226
|
- Tạo file mới tại path tương ứng
|
|
227
227
|
- Nội dung = nội dung của Changes block (theo format của template gốc — `cdd-template.md` hoặc `fdd-template.md`)
|
|
228
|
-
- Frontmatter: lấy từ template (status `draft` cho artifact mới — separate lifecycle với tech.md)
|
|
228
|
+
- Frontmatter: lấy từ template, gồm `template_version` (status `draft` cho artifact mới — separate lifecycle với tech.md). `template_version` chỉ stamp ở operation=create; **operation=update KHÔNG đụng** `template_version` của artifact hiện có.
|
|
229
229
|
|
|
230
230
|
- **Operation=update:**
|
|
231
231
|
- Đọc artifact hiện tại
|
|
@@ -315,3 +315,4 @@ Sau khi user confirm (Bước 6):
|
|
|
315
315
|
- [ ] Auto-apply chạy theo thứ tự sad → domain → cdd → fdd
|
|
316
316
|
- [ ] Mỗi artifact bị touched có entry mới được append vào `## Change History` (conventions §5.5)
|
|
317
317
|
- [ ] Fail-safe: nếu apply fail thì không ghi tech.md (rollback luôn Change History entries)
|
|
318
|
+
- [ ] Artifact create (tech.md + cdd/fdd mới) có `template_version` copy từ template; artifact update giữ nguyên version cũ
|
|
@@ -284,7 +284,7 @@ Chỉ tiến hành Bước 6 sau khi QC confirm.
|
|
|
284
284
|
|
|
285
285
|
### Bước 6: Save + Auto-cascade
|
|
286
286
|
|
|
287
|
-
**[6.1] Ghi `.specs/integrations/{slug}/test.md`** với status `approved` (không phải `draft` — human đã confirm ở Bước 5 chính là approval). Frontmatter `features` mirror từ `spec.md
|
|
287
|
+
**[6.1] Ghi `.specs/integrations/{slug}/test.md`** với status `approved` (không phải `draft` — human đã confirm ở Bước 5 chính là approval). Frontmatter `features` mirror từ `spec.md`; `template_version` lấy từ `test-template.md` (xem `conventions.md` §7).
|
|
288
288
|
|
|
289
289
|
**[6.2] Auto-apply mỗi Changes block** vào `feature/{F-XXX}/tsd.md` tương ứng. Thứ tự apply: theo thứ tự xuất hiện trong frontmatter `features` (deterministic, không có forward reference giữa các feature tsd.md). Bỏ qua feature có operation `no-op` trong Cascade Summary.
|
|
290
290
|
|
|
@@ -293,7 +293,7 @@ Cho từng block:
|
|
|
293
293
|
- **Operation=create:**
|
|
294
294
|
- Tạo file `.specs/main/feature/{F-XXX}-{slug}/tsd.md`
|
|
295
295
|
- Nội dung = nội dung của Changes block (theo format `templates/main/feature/tsd-template.md`)
|
|
296
|
-
- Frontmatter của tsd.md mới: status `draft` (separate lifecycle với integration test.md)
|
|
296
|
+
- Frontmatter của tsd.md mới: status `draft` + `template_version` copy từ `tsd-template.md` (separate lifecycle với integration test.md). Chỉ stamp ở operation=create; **operation=update KHÔNG đụng** version của tsd.md hiện có.
|
|
297
297
|
|
|
298
298
|
- **Operation=update:**
|
|
299
299
|
- Đọc tsd.md hiện tại
|
|
@@ -381,3 +381,4 @@ Sau khi QC confirm (Bước 6):
|
|
|
381
381
|
- [ ] Mỗi tsd.md bị touched có entry mới trong `## Change History` (conventions §5.5)
|
|
382
382
|
- [ ] Fail-safe: nếu apply fail thì không ghi integration test.md (rollback luôn Change History entries)
|
|
383
383
|
- [ ] Mỗi feature tsd.md mới có status `draft` (separate lifecycle)
|
|
384
|
+
- [ ] test.md + tsd.md create có `template_version` copy từ template; tsd.md update giữ nguyên version cũ
|