dw-kit 1.2.1 → 1.3.4
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/.claude/hooks/post-write.sh +64 -58
- package/.claude/hooks/pre-commit-gate.sh +96 -90
- package/.claude/hooks/privacy-block.sh +99 -94
- package/.claude/hooks/progress-ping.sh +53 -47
- package/.claude/hooks/safety-guard.sh +60 -54
- package/.claude/hooks/scout-block.sh +88 -82
- package/.claude/hooks/session-init.sh +6 -0
- package/.claude/hooks/stop-check.sh +88 -36
- package/.claude/hooks/telemetry-log.sh +34 -0
- package/.claude/rules/dw.md +138 -0
- package/.claude/settings.json +28 -1
- package/.claude/skills/dw-arch-review/SKILL.md +119 -119
- package/.claude/skills/dw-archive/SKILL.md +81 -81
- package/.claude/skills/dw-commit/SKILL.md +81 -81
- package/.claude/skills/dw-config-init/SKILL.md +91 -91
- package/.claude/skills/dw-config-validate/SKILL.md +75 -75
- package/.claude/skills/dw-dashboard/SKILL.md +209 -209
- package/.claude/skills/dw-debug/SKILL.md +97 -97
- package/.claude/skills/dw-decision/SKILL.md +116 -0
- package/.claude/skills/dw-docs-update/SKILL.md +125 -125
- package/.claude/skills/dw-estimate/SKILL.md +90 -90
- package/.claude/skills/dw-execute/SKILL.md +121 -98
- package/.claude/skills/dw-flow/SKILL.md +274 -274
- package/.claude/skills/dw-handoff/SKILL.md +92 -81
- package/.claude/skills/dw-kit-report/SKILL.md +152 -152
- package/.claude/skills/dw-log-work/SKILL.md +69 -69
- package/.claude/skills/dw-onboard/SKILL.md +201 -201
- package/.claude/skills/dw-plan/SKILL.md +222 -125
- package/.claude/skills/dw-prompt/SKILL.md +62 -62
- package/.claude/skills/dw-requirements/SKILL.md +98 -98
- package/.claude/skills/dw-research/SKILL.md +128 -114
- package/.claude/skills/dw-retroactive/SKILL.md +195 -311
- package/.claude/skills/dw-review/SKILL.md +66 -66
- package/.claude/skills/dw-rollback/SKILL.md +90 -90
- package/.claude/skills/dw-sprint-review/SKILL.md +99 -99
- package/.claude/skills/dw-task-init/SKILL.md +71 -59
- package/.claude/skills/dw-test-plan/SKILL.md +113 -113
- package/.claude/skills/dw-thinking/SKILL.md +70 -70
- package/.claude/skills/dw-upgrade/SKILL.md +72 -72
- package/.dw/core/PILLARS.md +122 -0
- package/.dw/core/ROLES.md +257 -257
- package/.dw/core/templates/v2/spec.md +68 -0
- package/.dw/core/templates/v2/tracking.md +62 -0
- package/.dw/core/v14-evaluation-protocol.md +118 -0
- package/CLAUDE.md +42 -39
- package/MIGRATION-v1.3.md +202 -0
- package/README.md +35 -6
- package/package.json +4 -2
- package/src/cli.mjs +29 -1
- package/src/commands/dashboard.mjs +116 -0
- package/src/commands/doctor.mjs +165 -149
- package/src/commands/init.mjs +339 -332
- package/src/commands/metrics.mjs +185 -0
- package/src/lib/active-index.mjs +87 -0
- package/src/lib/cut-analysis.mjs +240 -0
- package/src/lib/telemetry.mjs +80 -0
- package/.claude/rules/dw-core.md +0 -100
- package/.claude/rules/dw-skills.md +0 -53
- package/.claude/rules/workflow-rules.md +0 -77
|
@@ -1,311 +1,195 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: dw
|
|
3
|
-
description: "Retroactively document một feature/task đã được implement trước khi dùng dw. Reverse-engineer từ code + git history, tạo
|
|
4
|
-
argument-hint: "[feature-name]"
|
|
5
|
-
allowed-tools:
|
|
6
|
-
- Read
|
|
7
|
-
- Grep
|
|
8
|
-
- Glob
|
|
9
|
-
- Write
|
|
10
|
-
- "Bash(git log *)"
|
|
11
|
-
- "Bash(git diff *)"
|
|
12
|
-
- "Bash(git show *)"
|
|
13
|
-
- "Bash(git blame *)"
|
|
14
|
-
- "Bash(git shortlog *)"
|
|
15
|
-
- "Bash(ls *)"
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
# dw-retroactive — Retroactive Documentation
|
|
19
|
-
|
|
20
|
-
Feature: **$ARGUMENTS**
|
|
21
|
-
|
|
22
|
-
> Reverse-engineer feature đã tồn tại từ code
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## Đọc Config
|
|
27
|
-
|
|
28
|
-
Đọc `.dw/config/dw.config.yml`:
|
|
29
|
-
- `paths.tasks` → output location (mặc định `.dw/tasks`)
|
|
30
|
-
- `project.language` → ngôn ngữ docs
|
|
31
|
-
|
|
32
|
-
## Kiểm tra đã có docs chưa
|
|
33
|
-
|
|
34
|
-
Kiểm tra `{paths.tasks}/$ARGUMENTS/` đã tồn tại chưa:
|
|
35
|
-
- Nếu
|
|
36
|
-
- Nếu chưa → tiếp tục
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
## Bước 1: Tìm files liên quan
|
|
41
|
-
|
|
42
|
-
Dùng tên `$ARGUMENTS` như keyword để tìm:
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
Glob: **/*$ARGUMENTS*
|
|
46
|
-
Grep: "$ARGUMENTS" trong toàn codebase (case-insensitive)
|
|
47
|
-
Grep: tên function/class/route liên quan (nếu có thể suy ra từ tên)
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Nếu không tìm được → hỏi user
|
|
51
|
-
|
|
52
|
-
## Bước 2: Đọc và phân tích code
|
|
53
|
-
|
|
54
|
-
Với mỗi file tìm được:
|
|
55
|
-
|
|
56
|
-
1. **Đọc toàn bộ file** (hoặc phần liên quan)
|
|
57
|
-
2. Xác định:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
- **
|
|
138
|
-
- **
|
|
139
|
-
- **
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
##
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
> ⚠ Đây là tài liệu retroactive — mô tả những gì ĐÃ được implement,
|
|
198
|
-
> không phải plan cho việc sẽ làm. Dùng để AI và team hiểu context.
|
|
199
|
-
|
|
200
|
-
## Tóm Tắt Giải Pháp Đã Implement
|
|
201
|
-
|
|
202
|
-
[Mô tả approach được dùng, dựa trên code analysis]
|
|
203
|
-
|
|
204
|
-
## Những Gì Đã Implement
|
|
205
|
-
|
|
206
|
-
### Component 1: [Tên]
|
|
207
|
-
- **Mô tả**: [làm gì]
|
|
208
|
-
- **Files**: [danh sách]
|
|
209
|
-
- **Cách hoạt động**: [tóm tắt logic]
|
|
210
|
-
|
|
211
|
-
### Component 2: [Tên]
|
|
212
|
-
...
|
|
213
|
-
|
|
214
|
-
## Quyết Định Kỹ Thuật Đáng Chú Ý
|
|
215
|
-
|
|
216
|
-
| Quyết định | Approach đã dùng | Lý do suy đoán |
|
|
217
|
-
|-----------|-----------------|----------------|
|
|
218
|
-
| [decision] | [approach] | [inferred from code/commits] |
|
|
219
|
-
|
|
220
|
-
## Rủi Ro & Hạn Chế Đã Biết
|
|
221
|
-
|
|
222
|
-
| # | Mô tả | Mức độ | Trạng thái |
|
|
223
|
-
|---|-------|--------|-----------|
|
|
224
|
-
| 1 | [risk] | Cao/TB/Thấp | Open/Resolved |
|
|
225
|
-
|
|
226
|
-
## Edge Cases
|
|
227
|
-
|
|
228
|
-
- [ ] [Edge case được xử lý hay chưa?]
|
|
229
|
-
|
|
230
|
-
## Tác Động Hệ Thống
|
|
231
|
-
|
|
232
|
-
- **Modules ảnh hưởng**: [danh sách]
|
|
233
|
-
- **API**: [endpoints liên quan]
|
|
234
|
-
- **Database**: [schema/tables liên quan]
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### 5c. Progress doc
|
|
238
|
-
|
|
239
|
-
Tạo `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-progress.md`:
|
|
240
|
-
|
|
241
|
-
```markdown
|
|
242
|
-
# Progress: $ARGUMENTS
|
|
243
|
-
|
|
244
|
-
## Trạng thái: Done (Pre-dw Implementation)
|
|
245
|
-
## Loại: Retroactive Documentation
|
|
246
|
-
## Documented on: [date]
|
|
247
|
-
|
|
248
|
-
---
|
|
249
|
-
|
|
250
|
-
> Feature này đã được implement trước khi adopt dw-kit.
|
|
251
|
-
> File này được tạo retroactively để AI có context khi làm task liên quan.
|
|
252
|
-
|
|
253
|
-
## Implementation History (từ git)
|
|
254
|
-
|
|
255
|
-
| Thời điểm | Sự kiện | Author |
|
|
256
|
-
|-----------|---------|--------|
|
|
257
|
-
| [date] | Feature được tạo | [author] |
|
|
258
|
-
| [date] | [notable change] | [author] |
|
|
259
|
-
|
|
260
|
-
## Known Issues / Open Items
|
|
261
|
-
|
|
262
|
-
- [ ] [Issue đang mở nếu có]
|
|
263
|
-
- [ ] [Tech debt cần xử lý]
|
|
264
|
-
|
|
265
|
-
## Handoff Notes cho AI
|
|
266
|
-
|
|
267
|
-
Khi làm task liên quan feature này:
|
|
268
|
-
- **Đọc trước**: `$ARGUMENTS-context.md` để hiểu architecture
|
|
269
|
-
- **Cẩn thận**: [warning 1]
|
|
270
|
-
- **Không thay đổi**: [phần nào là stable contract]
|
|
271
|
-
- **Có thể refactor**: [phần nào an toàn để thay đổi]
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
---
|
|
275
|
-
|
|
276
|
-
## Bước 6: Báo cáo kết quả
|
|
277
|
-
|
|
278
|
-
```
|
|
279
|
-
╔══════════════════════════════════════════════════════╗
|
|
280
|
-
║ ✅ dw-retroactive complete: $ARGUMENTS
|
|
281
|
-
╠══════════════════════════════════════════════════════╣
|
|
282
|
-
║ Files khảo sát : [N files]
|
|
283
|
-
║ Git commits : [N commits, từ [date] đến [date]]
|
|
284
|
-
║ Maintainer chính : [author]
|
|
285
|
-
╠══════════════════════════════════════════════════════╣
|
|
286
|
-
║ Docs đã tạo:
|
|
287
|
-
║ {paths.tasks}/$ARGUMENTS/$ARGUMENTS-context.md
|
|
288
|
-
║ {paths.tasks}/$ARGUMENTS/$ARGUMENTS-plan.md (as-built)
|
|
289
|
-
║ {paths.tasks}/$ARGUMENTS/$ARGUMENTS-progress.md
|
|
290
|
-
╠══════════════════════════════════════════════════════╣
|
|
291
|
-
║ Key findings:
|
|
292
|
-
║ • [Finding 1]
|
|
293
|
-
║ • [Finding 2]
|
|
294
|
-
║ • [Finding 3]
|
|
295
|
-
╠══════════════════════════════════════════════════════╣
|
|
296
|
-
║ Tech debt / warnings:
|
|
297
|
-
║ • [Warning nếu có]
|
|
298
|
-
╠══════════════════════════════════════════════════════╣
|
|
299
|
-
║ Tiếp theo:
|
|
300
|
-
║ → Khi cần task liên quan: /dw-research $ARGUMENTS
|
|
301
|
-
║ (AI sẽ đọc context docs vừa tạo làm foundation)
|
|
302
|
-
╚══════════════════════════════════════════════════════╝
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
---
|
|
306
|
-
|
|
307
|
-
## Lưu ý
|
|
308
|
-
|
|
309
|
-
- **As-built ≠ forward plan**: Docs này mô tả hiện trạng, không phải kế hoạch
|
|
310
|
-
- **Best-effort**: AI chỉ thấy được những gì có trong code và git — context ẩn (verbal decisions, Slack threads) có thể thiếu. Cần human review và bổ sung.
|
|
311
|
-
- **Sau khi tạo**: Khuyến khích dev liên quan review và bổ sung `## Ghi Chú Cho AI` section
|
|
1
|
+
---
|
|
2
|
+
name: dw:retroactive
|
|
3
|
+
description: "Retroactively document một feature/task đã được implement trước khi dùng dw. Reverse-engineer từ code + git history, tạo spec.md + tracking.md (v2 format, As-Built flavor)."
|
|
4
|
+
argument-hint: "[feature-name]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Grep
|
|
8
|
+
- Glob
|
|
9
|
+
- Write
|
|
10
|
+
- "Bash(git log *)"
|
|
11
|
+
- "Bash(git diff *)"
|
|
12
|
+
- "Bash(git show *)"
|
|
13
|
+
- "Bash(git blame *)"
|
|
14
|
+
- "Bash(git shortlog *)"
|
|
15
|
+
- "Bash(ls *)"
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# dw-retroactive — Retroactive Documentation
|
|
19
|
+
|
|
20
|
+
Feature: **$ARGUMENTS**
|
|
21
|
+
|
|
22
|
+
> Reverse-engineer feature đã tồn tại từ code + git history. Tạo task docs v2 format (`spec.md` + `tracking.md`) với flavor As-Built — để AI và team có context đầy đủ khi làm task liên quan.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Đọc Config
|
|
27
|
+
|
|
28
|
+
Đọc `.dw/config/dw.config.yml`:
|
|
29
|
+
- `paths.tasks` → output location (mặc định `.dw/tasks`)
|
|
30
|
+
- `project.language` → ngôn ngữ docs (vi/en)
|
|
31
|
+
|
|
32
|
+
## Kiểm tra đã có docs chưa
|
|
33
|
+
|
|
34
|
+
Kiểm tra `{paths.tasks}/$ARGUMENTS/` đã tồn tại chưa:
|
|
35
|
+
- Nếu có `spec.md` hoặc `tracking.md` → hỏi user: "Đã có task docs cho `$ARGUMENTS`. Overwrite hay skip?"
|
|
36
|
+
- Nếu chưa → tiếp tục
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Bước 1: Tìm files liên quan
|
|
41
|
+
|
|
42
|
+
Dùng tên `$ARGUMENTS` như keyword để tìm:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
Glob: **/*$ARGUMENTS*
|
|
46
|
+
Grep: "$ARGUMENTS" trong toàn codebase (case-insensitive)
|
|
47
|
+
Grep: tên function/class/route liên quan (nếu có thể suy ra từ tên)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Nếu không tìm được → hỏi user cung cấp thêm keyword hoặc path.
|
|
51
|
+
|
|
52
|
+
## Bước 2: Đọc và phân tích code
|
|
53
|
+
|
|
54
|
+
Với mỗi file tìm được:
|
|
55
|
+
|
|
56
|
+
1. **Đọc toàn bộ file** (hoặc phần liên quan)
|
|
57
|
+
2. Xác định: vai trò trong feature, logic chính, I/O, side effects, error handling
|
|
58
|
+
3. **Trace data flow**: input → xử lý → output
|
|
59
|
+
4. **Dependencies**: upstream (gọi ai) / downstream (ai gọi)
|
|
60
|
+
5. **Tests**: test files liên quan, coverage hiện tại
|
|
61
|
+
|
|
62
|
+
## Bước 3: Phân tích git history
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
git log --oneline --follow -- [files-found]
|
|
66
|
+
git shortlog -sn -- [files-found]
|
|
67
|
+
git log --oneline --diff-filter=A -- [files-found]
|
|
68
|
+
git show [first-commit] --stat
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Xác định: thời điểm tạo, maintainer chính, breaking changes, tech debt (TODO/FIXME).
|
|
72
|
+
|
|
73
|
+
## Bước 4: Áp dụng tư duy phản biện
|
|
74
|
+
|
|
75
|
+
Từ framework `.dw/core/THINKING.md`:
|
|
76
|
+
- **Giả định** trong code về input/state/environment
|
|
77
|
+
- **Failure modes** + edge cases
|
|
78
|
+
- **Tech debt** (TODO/FIXME/antipatterns)
|
|
79
|
+
- **Security** (auth, validation, data exposure)
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Bước 5: Tạo task docs (v2 format, As-Built flavor)
|
|
84
|
+
|
|
85
|
+
Tạo thư mục `{paths.tasks}/$ARGUMENTS/` và **2 files** theo template v2 tại `.dw/core/templates/v2/`.
|
|
86
|
+
|
|
87
|
+
### 5a. spec.md (As-Built)
|
|
88
|
+
|
|
89
|
+
Đọc template `.dw/core/templates/v2/spec.md`, điền:
|
|
90
|
+
|
|
91
|
+
**Frontmatter:**
|
|
92
|
+
- `task_id: $ARGUMENTS`
|
|
93
|
+
- `created: [today]`
|
|
94
|
+
- `status: Done` ← đã implement
|
|
95
|
+
- `owner: [main author từ git shortlog]`
|
|
96
|
+
- `depth: retroactive`
|
|
97
|
+
- `related_adr: none`
|
|
98
|
+
- `target_ship: [first-commit-date]`
|
|
99
|
+
|
|
100
|
+
**Body sections** (lấp bằng findings retroactive):
|
|
101
|
+
|
|
102
|
+
- **Intent**: 1-2 paragraphs mô tả feature làm gì (dựa trên code)
|
|
103
|
+
- **Why Now**: "As-built documentation — feature pre-dw adoption" + lý do document hóa
|
|
104
|
+
- **Scope → In Scope**: liệt kê component đã implement dưới dạng ST-1, ST-2... với:
|
|
105
|
+
- Concrete action = mô tả component đã implement
|
|
106
|
+
- Acceptance = how it was verified (tests / manual check)
|
|
107
|
+
- Effort = `as-built`
|
|
108
|
+
- **Scope → Out of Scope**: những gì rõ ràng KHÔNG nằm trong feature (suy từ code boundaries)
|
|
109
|
+
- **Risks & Mitigations**: tech debt, antipatterns, security concerns phát hiện
|
|
110
|
+
- **Success Criteria**: current behavior được kiểm chứng bằng gì (tests, prod metrics nếu biết)
|
|
111
|
+
- **Dependencies**: upstream modules/services + downstream consumers
|
|
112
|
+
- **Known Unknowns**: câu hỏi cần human review (verbal decisions không có trong code)
|
|
113
|
+
- **Acceptance**: đánh dấu `[x]` các items đã done (feature đang chạy prod)
|
|
114
|
+
|
|
115
|
+
**Thêm note trên đầu Intent**:
|
|
116
|
+
```markdown
|
|
117
|
+
> ⚠ As-Built Documentation — Generated retroactively from code + git history.
|
|
118
|
+
> Verbal context (Slack threads, meetings) có thể thiếu. Cần human review bổ sung.
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Ghi vào `{paths.tasks}/$ARGUMENTS/spec.md`.
|
|
122
|
+
|
|
123
|
+
### 5b. tracking.md (As-Built)
|
|
124
|
+
|
|
125
|
+
Đọc template `.dw/core/templates/v2/tracking.md`, điền:
|
|
126
|
+
|
|
127
|
+
**Frontmatter:**
|
|
128
|
+
- `task_id: $ARGUMENTS`
|
|
129
|
+
- `started: [first-commit-date từ git]`
|
|
130
|
+
- `last_updated: [today]`
|
|
131
|
+
- `status: Done`
|
|
132
|
+
- `current_phase: Maintained`
|
|
133
|
+
- `blockers: none`
|
|
134
|
+
|
|
135
|
+
**Body sections:**
|
|
136
|
+
|
|
137
|
+
- **Status Snapshot**: Phase `Done (pre-dw)` · Next milestone `— (maintained as-is)`
|
|
138
|
+
- **Subtask Progress** table: map các component đã tìm ở Bước 2 thành ST-N với status ✅ Done, Date = commit date đầu tiên của component, Notes = commit SHA hoặc file path
|
|
139
|
+
- **Changelog**: parse git log ra thành entries theo ngày. Format:
|
|
140
|
+
```
|
|
141
|
+
### YYYY-MM-DD — [commit subject]
|
|
142
|
+
**Actions taken:** [summary]
|
|
143
|
+
```
|
|
144
|
+
- **Handoff Notes**: cho next session/agent:
|
|
145
|
+
- **Read first:** `spec.md` (as-built) + key files từ bước 2
|
|
146
|
+
- **Current state:** Done, maintained
|
|
147
|
+
- **Don't do:** [stable contracts không nên thay đổi]
|
|
148
|
+
- **Watch out:** [tech debt + gotchas]
|
|
149
|
+
- **Friction Journal**: để trống hoặc nhập tech debt đã ghi nhận từ Bước 4
|
|
150
|
+
- **Agent Debate Log**: bỏ qua (không applicable cho retroactive)
|
|
151
|
+
|
|
152
|
+
Ghi vào `{paths.tasks}/$ARGUMENTS/tracking.md`.
|
|
153
|
+
|
|
154
|
+
### 5c. Cập nhật ACTIVE.md
|
|
155
|
+
|
|
156
|
+
Chạy `dw active` (hoặc `writeActiveIndex`) để regenerate team index.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Bước 6: Báo cáo kết quả
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
╔══════════════════════════════════════════════════════╗
|
|
164
|
+
║ ✅ dw:retroactive complete: $ARGUMENTS
|
|
165
|
+
╠══════════════════════════════════════════════════════╣
|
|
166
|
+
║ Files khảo sát : [N files]
|
|
167
|
+
║ Git commits : [N, từ [date] đến [date]]
|
|
168
|
+
║ Maintainer chính : [author]
|
|
169
|
+
╠══════════════════════════════════════════════════════╣
|
|
170
|
+
║ Docs đã tạo (v2 format):
|
|
171
|
+
║ {paths.tasks}/$ARGUMENTS/spec.md (As-Built)
|
|
172
|
+
║ {paths.tasks}/$ARGUMENTS/tracking.md (Done, maintained)
|
|
173
|
+
╠══════════════════════════════════════════════════════╣
|
|
174
|
+
║ Key findings:
|
|
175
|
+
║ • [Finding 1]
|
|
176
|
+
║ • [Finding 2]
|
|
177
|
+
╠══════════════════════════════════════════════════════╣
|
|
178
|
+
║ Tech debt / warnings:
|
|
179
|
+
║ • [Warning nếu có]
|
|
180
|
+
╠══════════════════════════════════════════════════════╣
|
|
181
|
+
║ Tiếp theo:
|
|
182
|
+
║ → Task liên quan: /dw:research $ARGUMENTS
|
|
183
|
+
║ (AI đọc spec.md làm foundation)
|
|
184
|
+
║ → Human review: điền Known Unknowns + Handoff Notes
|
|
185
|
+
╚══════════════════════════════════════════════════════╝
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Lưu ý
|
|
191
|
+
|
|
192
|
+
- **As-built ≠ forward plan**: spec.md mô tả hiện trạng, không phải kế hoạch tương lai.
|
|
193
|
+
- **Best-effort**: AI chỉ thấy code + git — context ẩn (verbal decisions, Slack threads) có thể thiếu. Human review là bắt buộc cho phần `Known Unknowns`.
|
|
194
|
+
- **v2 format**: Chỉ tạo 2 files (`spec.md` + `tracking.md`). Không dùng lại v1 3-file format (`context + plan + progress`) nữa.
|
|
195
|
+
- **Tools khác vẫn đọc được**: `dw active`, `session-init` hook, `/dw:dashboard` đều hỗ trợ v2 format song song với legacy v1.
|
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: dw
|
|
3
|
-
description: "Review code thay đổi gần đây hoặc cả task. Kiểm tra correctness, security, conventions, test coverage. Tạo báo cáo phân loại Critical/Warning/Suggestion."
|
|
4
|
-
argument-hint: "[task-name | branch | file]"
|
|
5
|
-
context: fork
|
|
6
|
-
agent: reviewer
|
|
7
|
-
allowed-tools:
|
|
8
|
-
- Read
|
|
9
|
-
- Grep
|
|
10
|
-
- Glob
|
|
11
|
-
- "Bash(git diff *)"
|
|
12
|
-
- "Bash(git log *)"
|
|
13
|
-
- "Bash(git show *)"
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
# Code Review
|
|
17
|
-
|
|
18
|
-
Target: **$ARGUMENTS**
|
|
19
|
-
|
|
20
|
-
## Đọc Config
|
|
21
|
-
|
|
22
|
-
Đọc `.dw/config/dw.config.yml` → `paths.tasks`, `workflow.default_depth`.
|
|
23
|
-
|
|
24
|
-
## Xác Định Scope
|
|
25
|
-
|
|
26
|
-
- Nếu có argument = task-name: review tất cả commits liên quan đến task
|
|
27
|
-
- Nếu có argument = branch: `git diff main...$ARGUMENTS`
|
|
28
|
-
- Nếu không có argument: `git diff HEAD~1` (commit gần nhất)
|
|
29
|
-
|
|
30
|
-
## Quy Trình
|
|
31
|
-
|
|
32
|
-
### 1. Lấy diff
|
|
33
|
-
```bash
|
|
34
|
-
git diff [scope] --name-only # danh sách files changed
|
|
35
|
-
git diff [scope] # nội dung thay đổi
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### 2. Đọc files liên quan
|
|
39
|
-
Đọc toàn bộ files đã changed để hiểu full context (không chỉ diff).
|
|
40
|
-
|
|
41
|
-
### 3. Review theo reviewer agent
|
|
42
|
-
|
|
43
|
-
Agent `reviewer` sẽ kiểm tra:
|
|
44
|
-
- **Correctness**: Logic, edge cases, error handling
|
|
45
|
-
- **Security**: Input validation, auth, data exposure
|
|
46
|
-
- **Performance**: N+1, unnecessary calls, complexity
|
|
47
|
-
- **Tests**: Coverage, test quality
|
|
48
|
-
- **Conventions**: Naming, structure, code style (`.claude/rules/code-style.md`)
|
|
49
|
-
|
|
50
|
-
### 4. Kiểm tra checklist cụ thể
|
|
51
|
-
|
|
52
|
-
Nếu có plan file (`{paths.tasks}/$ARGUMENTS/$ARGUMENTS-plan.md`):
|
|
53
|
-
- Đối chiếu acceptance criteria từng subtask
|
|
54
|
-
- Kiểm tra scope có vượt plan không
|
|
55
|
-
|
|
56
|
-
### 5. Output
|
|
57
|
-
|
|
58
|
-
Tạo báo cáo đầy đủ theo format của reviewer agent.
|
|
59
|
-
|
|
60
|
-
## Sau Review
|
|
61
|
-
|
|
62
|
-
- Nếu có Critical issues: "Cần fix trước khi merge"
|
|
63
|
-
- Nếu chỉ có Warnings: "Khuyến khích fix, nhưng có thể proceed"
|
|
64
|
-
- Nếu pass: "Approved — có thể chạy `/dw
|
|
65
|
-
|
|
66
|
-
Nếu team có TL: "Gợi ý gửi báo cáo này cho TL để final approve."
|
|
1
|
+
---
|
|
2
|
+
name: dw:review
|
|
3
|
+
description: "Review code thay đổi gần đây hoặc cả task. Kiểm tra correctness, security, conventions, test coverage. Tạo báo cáo phân loại Critical/Warning/Suggestion."
|
|
4
|
+
argument-hint: "[task-name | branch | file]"
|
|
5
|
+
context: fork
|
|
6
|
+
agent: reviewer
|
|
7
|
+
allowed-tools:
|
|
8
|
+
- Read
|
|
9
|
+
- Grep
|
|
10
|
+
- Glob
|
|
11
|
+
- "Bash(git diff *)"
|
|
12
|
+
- "Bash(git log *)"
|
|
13
|
+
- "Bash(git show *)"
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Code Review
|
|
17
|
+
|
|
18
|
+
Target: **$ARGUMENTS**
|
|
19
|
+
|
|
20
|
+
## Đọc Config
|
|
21
|
+
|
|
22
|
+
Đọc `.dw/config/dw.config.yml` → `paths.tasks`, `workflow.default_depth`.
|
|
23
|
+
|
|
24
|
+
## Xác Định Scope
|
|
25
|
+
|
|
26
|
+
- Nếu có argument = task-name: review tất cả commits liên quan đến task
|
|
27
|
+
- Nếu có argument = branch: `git diff main...$ARGUMENTS`
|
|
28
|
+
- Nếu không có argument: `git diff HEAD~1` (commit gần nhất)
|
|
29
|
+
|
|
30
|
+
## Quy Trình
|
|
31
|
+
|
|
32
|
+
### 1. Lấy diff
|
|
33
|
+
```bash
|
|
34
|
+
git diff [scope] --name-only # danh sách files changed
|
|
35
|
+
git diff [scope] # nội dung thay đổi
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 2. Đọc files liên quan
|
|
39
|
+
Đọc toàn bộ files đã changed để hiểu full context (không chỉ diff).
|
|
40
|
+
|
|
41
|
+
### 3. Review theo reviewer agent
|
|
42
|
+
|
|
43
|
+
Agent `reviewer` sẽ kiểm tra:
|
|
44
|
+
- **Correctness**: Logic, edge cases, error handling
|
|
45
|
+
- **Security**: Input validation, auth, data exposure
|
|
46
|
+
- **Performance**: N+1, unnecessary calls, complexity
|
|
47
|
+
- **Tests**: Coverage, test quality
|
|
48
|
+
- **Conventions**: Naming, structure, code style (`.claude/rules/code-style.md`)
|
|
49
|
+
|
|
50
|
+
### 4. Kiểm tra checklist cụ thể
|
|
51
|
+
|
|
52
|
+
Nếu có plan file (`{paths.tasks}/$ARGUMENTS/$ARGUMENTS-plan.md`):
|
|
53
|
+
- Đối chiếu acceptance criteria từng subtask
|
|
54
|
+
- Kiểm tra scope có vượt plan không
|
|
55
|
+
|
|
56
|
+
### 5. Output
|
|
57
|
+
|
|
58
|
+
Tạo báo cáo đầy đủ theo format của reviewer agent.
|
|
59
|
+
|
|
60
|
+
## Sau Review
|
|
61
|
+
|
|
62
|
+
- Nếu có Critical issues: "Cần fix trước khi merge"
|
|
63
|
+
- Nếu chỉ có Warnings: "Khuyến khích fix, nhưng có thể proceed"
|
|
64
|
+
- Nếu pass: "Approved — có thể chạy `/dw:commit`"
|
|
65
|
+
|
|
66
|
+
Nếu team có TL: "Gợi ý gửi báo cáo này cho TL để final approve."
|