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.
Files changed (59) hide show
  1. package/.claude/hooks/post-write.sh +64 -58
  2. package/.claude/hooks/pre-commit-gate.sh +96 -90
  3. package/.claude/hooks/privacy-block.sh +99 -94
  4. package/.claude/hooks/progress-ping.sh +53 -47
  5. package/.claude/hooks/safety-guard.sh +60 -54
  6. package/.claude/hooks/scout-block.sh +88 -82
  7. package/.claude/hooks/session-init.sh +6 -0
  8. package/.claude/hooks/stop-check.sh +88 -36
  9. package/.claude/hooks/telemetry-log.sh +34 -0
  10. package/.claude/rules/dw.md +138 -0
  11. package/.claude/settings.json +28 -1
  12. package/.claude/skills/dw-arch-review/SKILL.md +119 -119
  13. package/.claude/skills/dw-archive/SKILL.md +81 -81
  14. package/.claude/skills/dw-commit/SKILL.md +81 -81
  15. package/.claude/skills/dw-config-init/SKILL.md +91 -91
  16. package/.claude/skills/dw-config-validate/SKILL.md +75 -75
  17. package/.claude/skills/dw-dashboard/SKILL.md +209 -209
  18. package/.claude/skills/dw-debug/SKILL.md +97 -97
  19. package/.claude/skills/dw-decision/SKILL.md +116 -0
  20. package/.claude/skills/dw-docs-update/SKILL.md +125 -125
  21. package/.claude/skills/dw-estimate/SKILL.md +90 -90
  22. package/.claude/skills/dw-execute/SKILL.md +121 -98
  23. package/.claude/skills/dw-flow/SKILL.md +274 -274
  24. package/.claude/skills/dw-handoff/SKILL.md +92 -81
  25. package/.claude/skills/dw-kit-report/SKILL.md +152 -152
  26. package/.claude/skills/dw-log-work/SKILL.md +69 -69
  27. package/.claude/skills/dw-onboard/SKILL.md +201 -201
  28. package/.claude/skills/dw-plan/SKILL.md +222 -125
  29. package/.claude/skills/dw-prompt/SKILL.md +62 -62
  30. package/.claude/skills/dw-requirements/SKILL.md +98 -98
  31. package/.claude/skills/dw-research/SKILL.md +128 -114
  32. package/.claude/skills/dw-retroactive/SKILL.md +195 -311
  33. package/.claude/skills/dw-review/SKILL.md +66 -66
  34. package/.claude/skills/dw-rollback/SKILL.md +90 -90
  35. package/.claude/skills/dw-sprint-review/SKILL.md +99 -99
  36. package/.claude/skills/dw-task-init/SKILL.md +71 -59
  37. package/.claude/skills/dw-test-plan/SKILL.md +113 -113
  38. package/.claude/skills/dw-thinking/SKILL.md +70 -70
  39. package/.claude/skills/dw-upgrade/SKILL.md +72 -72
  40. package/.dw/core/PILLARS.md +122 -0
  41. package/.dw/core/ROLES.md +257 -257
  42. package/.dw/core/templates/v2/spec.md +68 -0
  43. package/.dw/core/templates/v2/tracking.md +62 -0
  44. package/.dw/core/v14-evaluation-protocol.md +118 -0
  45. package/CLAUDE.md +42 -39
  46. package/MIGRATION-v1.3.md +202 -0
  47. package/README.md +35 -6
  48. package/package.json +4 -2
  49. package/src/cli.mjs +29 -1
  50. package/src/commands/dashboard.mjs +116 -0
  51. package/src/commands/doctor.mjs +165 -149
  52. package/src/commands/init.mjs +339 -332
  53. package/src/commands/metrics.mjs +185 -0
  54. package/src/lib/active-index.mjs +87 -0
  55. package/src/lib/cut-analysis.mjs +240 -0
  56. package/src/lib/telemetry.mjs +80 -0
  57. package/.claude/rules/dw-core.md +0 -100
  58. package/.claude/rules/dw-skills.md +0 -53
  59. package/.claude/rules/workflow-rules.md +0 -77
@@ -1,311 +1,195 @@
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 đầy đủ context + as-built plan + progress docs. Dùng khi cần AI hiểu sâu một module cũ."
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 đầy đủ task docs như thể đã đi qua workflow dw — để AI (và team) có context đầy đủ khi làm việc liên quan feature này.
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 rồi → 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: "Không tìm thấy files liên quan `$ARGUMENTS`. Bạn có thể cung cấp thêm keyword hoặc path không?"
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
- - Vai trò của file trong feature này
59
- - Logic chính / business rules
60
- - Input/Output/Side effects
61
- - Error handling patterns
62
- 3. **Trace data flow**: đầu vào từ đâu → xử lý gì → kết quả đi đâu
63
- 4. **Tìm dependencies**: module này gọi gì? Ai gọi module này?
64
- 5. **Tìm tests**: test files liên quan, coverage hiện tại
65
-
66
- ## Bước 3: Phân tích git history
67
-
68
- ```bash
69
- # Commits liên quan feature
70
- git log --oneline --follow -- [files-found]
71
-
72
- # Ai đã implement
73
- git shortlog -sn -- [files-found]
74
-
75
- # Thay đổi đáng kể
76
- git log --oneline --diff-filter=A -- [files-found] # khi files được tạo
77
-
78
- # Context của lần commit đầu tiên
79
- git show [first-commit] --stat
80
- ```
81
-
82
- Xác định:
83
- - Feature được tạo khi nào
84
- - Ai implement (để biết ai có thể được hỏi)
85
- - breaking changes nào đã được fix sau đó không
86
- - Tech debt nào đang tồn tại (TODO, FIXME trong code)
87
-
88
- ## Bước 4: Áp dụng tư duy phản biện
89
-
90
- Từ framework `core/THINKING.md` (hoặc `.claude/skills/dw-thinking/THINKING.md`):
91
-
92
- - **Giả định**: Code đang giả định gì về input, state, environment?
93
- - **Failure modes**: Điều gì có thể làm feature này fail? Edge cases nào?
94
- - **Tech debt**: TODO/FIXME? Có antipatterns? Code mùi?
95
- - **Security**: điểm nào đáng lo ngại về auth, validation, data exposure?
96
-
97
- ## Bước 5: Tạo task docs
98
-
99
- Tạo thư mục `{paths.tasks}/$ARGUMENTS/` và 3 files:
100
-
101
- ### 5a. Context doc
102
-
103
- Tạo `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-context.md`:
104
-
105
- ```markdown
106
- # Context: $ARGUMENTS
107
-
108
- ## Ngày khảo sát: [date]
109
- ## Loại: Retroactive Documentation
110
- ## Người thực hiện: agent (dw-retroactive)
111
-
112
- ---
113
-
114
- ## Mô Tả Feature
115
-
116
- [2-3 câu mô tả feature làm gì, phục vụ ai]
117
-
118
- ## Codebase Analysis
119
-
120
- ### Files Liên Quan
121
-
122
- | # | File | Vai trò | Ghi chú |
123
- |---|------|---------|---------|
124
- | 1 | [file] | [vai trò] | |
125
-
126
- ### Kiến Trúc
127
-
128
- ```
129
- [ASCII diagram hoặc tả luồng]
130
- Input [Module] → Output
131
-
132
- [Dependencies]
133
- ```
134
-
135
- ### Data Flow
136
-
137
- - **Input**: [từ đâu, format gì]
138
- - **Processing**: [logic chính]
139
- - **Output**: [đi đâu, format gì]
140
- - **Side effects**: [DB writes, events, external calls]
141
-
142
- ## Dependencies
143
-
144
- ### Upstream (feature phụ thuộc vào)
145
- - [ ] [Module/Service] [vai trò]
146
-
147
- ### Downstream (ai phụ thuộc vào feature này)
148
- - [ ] [Module/Service] [ảnh hưởng thế nào]
149
-
150
- ## Git History
151
-
152
- - **Tạo lần đầu**: [date] bởi [author]
153
- - **Commits**: [N commits]
154
- - **Maintainer chính**: [author]
155
- - **Thay đổi đáng kể**: [mô tả nếu có]
156
-
157
- ## Test Coverage
158
-
159
- - [ ] Có tests: [Có/Không]
160
- - Test files: [danh sách]
161
- - Coverage: [mô tả]
162
- - Gaps: [thiếu test ở đâu]
163
-
164
- ## Giả Định & Hạn Chế
165
-
166
- | # | Giả định/Hạn chế | Mức độ rủi ro |
167
- |---|-----------------|--------------|
168
- | 1 | [giả định trong code] | Cao/TB/Thấp |
169
-
170
- ## Tech Debt & Warnings
171
-
172
- - [ ] [TODO/FIXME đang có]
173
- - [ ] [Antipatterns phát hiện]
174
- - [ ] [Security concerns]
175
-
176
- ## Ghi Chú Cho AI
177
-
178
- > Context quan trọng khi làm task liên quan feature này:
179
- - [Gotcha 1]
180
- - [Gotcha 2]
181
- ```
182
-
183
- ### 5b. As-Built Plan doc
184
-
185
- Tạo `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-plan.md`:
186
-
187
- ```markdown
188
- # As-Built Plan: $ARGUMENTS
189
-
190
- ## Ngày tạo: [date]
191
- ## Loại: As-Built (Retroactive) — không phải forward plan
192
- ## Trạng thái: Done (implemented trước khi adopt dw)
193
- ## Implemented by: [author từ git history]
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 `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/` **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 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-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."
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."