dw-kit 1.9.0 → 1.9.2

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 (53) hide show
  1. package/.claude/agents/planner.md +100 -100
  2. package/.claude/agents/quality-checker.md +86 -86
  3. package/.claude/agents/researcher.md +93 -93
  4. package/.claude/agents/reviewer.md +126 -126
  5. package/.claude/hooks/supply-chain-scan.sh +0 -0
  6. package/.claude/rules/code-style.md +37 -37
  7. package/.claude/settings.json +2 -28
  8. package/.claude/skills/dw-kit-report/SKILL.md +38 -7
  9. package/.claude/skills/dw-plan/template-plan.md +47 -47
  10. package/.claude/skills/dw-research/template-research.md +51 -51
  11. package/.claude/skills/dw-review/checklist.md +88 -88
  12. package/.claude/skills/dw-thinking/THINKING.md +91 -91
  13. package/.claude/templates/agent-report.md +35 -35
  14. package/.claude/templates/en/task-context.md +77 -73
  15. package/.claude/templates/en/task-plan.md +83 -79
  16. package/.claude/templates/en/task-progress.md +69 -65
  17. package/.claude/templates/pr-template.md +56 -56
  18. package/.claude/templates/task-context.md +77 -73
  19. package/.claude/templates/task-plan.md +83 -79
  20. package/.claude/templates/task-progress.md +69 -65
  21. package/.dw/adapters/claude-cli/extensions/README.md +36 -36
  22. package/.dw/adapters/claude-cli/generated/README.md +23 -23
  23. package/.dw/adapters/claude-cli/overrides/README.md +37 -37
  24. package/.dw/adapters/generic/README.md +21 -21
  25. package/.dw/config/presets/enterprise.yml +52 -52
  26. package/.dw/config/presets/small-team.yml +39 -39
  27. package/.dw/config/presets/solo-quick.yml +37 -37
  28. package/.dw/core/AGENTS.md +53 -53
  29. package/.dw/core/QUALITY.md +220 -220
  30. package/.dw/core/THINKING.md +126 -126
  31. package/.dw/core/WORKFLOW.md +17 -12
  32. package/.dw/core/templates/v2/spec.md +2 -0
  33. package/.dw/core/templates/v2/tracking.md +2 -0
  34. package/.dw/core/templates/v3/task.md +15 -22
  35. package/.dw/core/templates/vi/task-context.md +96 -92
  36. package/.dw/core/templates/vi/task-plan.md +97 -93
  37. package/.dw/core/templates/vi/task-progress.md +60 -56
  38. package/LICENSE +201 -201
  39. package/NOTICE +26 -26
  40. package/README.md +1 -1
  41. package/bin/dw.mjs +28 -28
  42. package/package.json +1 -1
  43. package/src/commands/claude-vn-fix.mjs +267 -267
  44. package/src/commands/prompt.mjs +112 -112
  45. package/src/commands/validate.mjs +102 -102
  46. package/src/lib/clipboard.mjs +24 -24
  47. package/src/lib/goal-store.mjs +2 -14
  48. package/src/lib/platform.mjs +39 -39
  49. package/src/lib/prompt-suggest.mjs +84 -84
  50. package/src/lib/timeline-parser.mjs +54 -15
  51. package/src/lib/ui.mjs +66 -66
  52. package/src/lib/update-checker.mjs +73 -73
  53. package/.dw/security/advisory-snapshot.json +0 -157
@@ -1,220 +1,220 @@
1
- <!-- core-version: 1.0 -->
2
-
3
- # Quality Strategy — 4-Layer Framework
4
-
5
- > **Nguyên tắc**: Quality là constant. Ceremony adapts.
6
- > Không có "quality level" — chỉ có depth phù hợp với context.
7
-
8
- ---
9
-
10
- ## Overview
11
-
12
- ```
13
- Layer 1: Requirements Clarity → trước khi code
14
- Layer 2: Test-Driven Development → trong khi code
15
- Layer 3: Cross-Review → sau khi code
16
- Layer 4: Automated Gates + QA → trước khi merge
17
- ```
18
-
19
- Mỗi layer build on top of layer trước. Skip layer sớm → vấn đề phát sinh muộn hơn với chi phí cao hơn.
20
-
21
- ---
22
-
23
- ## Layer 1: Requirements Clarity (Trước Khi Code)
24
-
25
- **Mục tiêu**: Đảm bảo hiểu đúng và đủ TRƯỚC khi bắt đầu implement.
26
-
27
- ### Given/When/Then Format
28
-
29
- Mỗi feature/subtask nên có acceptance criteria theo format:
30
-
31
- ```
32
- Given [trạng thái ban đầu / precondition]
33
- When [hành động / trigger]
34
- Then [kết quả mong đợi / postcondition]
35
- ```
36
-
37
- Ví dụ:
38
- ```
39
- Given user đã đăng nhập và có items trong cart
40
- When user logout rồi login lại
41
- Then cart items vẫn còn nguyên
42
- ```
43
-
44
- ### Checklist Requirements Clarity
45
-
46
- - [ ] Business logic được mô tả bằng Given/When/Then
47
- - [ ] Edge cases được identify upfront (không phải sau khi code xong)
48
- - [ ] Acceptance criteria per subtask: testable và specific (không mơ hồ)
49
- - [ ] Out-of-scope được ghi rõ (tránh scope creep)
50
- - [ ] Nếu có TL: TL đã review requirements trước khi dev bắt đầu
51
-
52
- ### Red Flags
53
-
54
- - Acceptance criteria dùng "should work" / "hoạt động đúng" — không đo lường được
55
- - Edge cases không được hỏi khi plan, chỉ phát hiện khi test
56
- - "Tôi hiểu rồi" mà không có written acceptance criteria
57
-
58
- ---
59
-
60
- ## Layer 2: Test-Driven Development (Trong Khi Code)
61
-
62
- **Mục tiêu**: Tests là specification, không phải afterthought.
63
-
64
- ### TDD Cycle Per Subtask
65
-
66
- ```
67
- RED → Viết test trước (failing) — test mô tả behavior mong muốn
68
- GREEN → Implement tối thiểu để test pass — không over-engineer
69
- REFACTOR → Cải thiện code structure, không thay đổi behavior
70
- COMMIT → Một subtask = một commit
71
- ```
72
-
73
- ### Test Coverage Priorities
74
-
75
- 1. **Happy path**: nominal flow với input hợp lệ
76
- 2. **Error cases**: invalid input, missing data, permission denied
77
- 3. **Edge cases**: boundary values, empty collections, concurrent operations
78
- 4. **Regression**: verify fixed bugs không tái xuất hiện
79
-
80
- ### Test Naming Convention
81
-
82
- ```
83
- should [expected behavior] when [condition]
84
-
85
- Ví dụ:
86
- - should return empty cart when user has no items
87
- - should throw AuthError when token is expired
88
- - should preserve cart when user re-logs in
89
- ```
90
-
91
- ### Checklist TDD
92
-
93
- - [ ] Test file tạo TRƯỚC khi implement
94
- - [ ] Test fail first (RED) đã verify
95
- - [ ] Implement minimal để pass (GREEN)
96
- - [ ] Refactor nếu code smell (không thay đổi tests)
97
- - [ ] Coverage: happy + error + edge cases
98
- - [ ] Tests independent (không phụ thuộc thứ tự run)
99
- - [ ] Không mock internal implementation — chỉ mock external boundaries
100
-
101
- ---
102
-
103
- ## Layer 3: Cross-Review (Sau Khi Code)
104
-
105
- **Mục tiêu**: Phát hiện issues mà người viết không thấy.
106
-
107
- ### TL Architecture Review (nếu có techlead)
108
-
109
- Tập trung vào:
110
- - Architecture decisions đúng không? Có alternatives tốt hơn?
111
- - Patterns nhất quán với codebase không?
112
- - Scalability và performance implications?
113
- - Security design đúng không?
114
-
115
- Output: Approve hoặc Request Changes với lý do cụ thể.
116
-
117
- ### Peer Code Review Checklist
118
-
119
- ```
120
- CORRECTNESS
121
- [ ] Logic đúng? Edge cases handled?
122
- [ ] Error handling đầy đủ? Logged đủ context?
123
- [ ] No silent failures
124
-
125
- SECURITY
126
- [ ] Input validation ở boundaries?
127
- [ ] No SQL injection / XSS / command injection?
128
- [ ] Auth/authz checks đúng?
129
- [ ] No sensitive data in logs/responses
130
-
131
- PERFORMANCE
132
- [ ] N+1 queries?
133
- [ ] Missing indexes?
134
- [ ] Unnecessary loops trong hot path?
135
-
136
- MAINTAINABILITY
137
- [ ] Naming rõ ràng, self-documenting?
138
- [ ] Functions làm 1 việc?
139
- [ ] No dead code?
140
- [ ] Complex logic có comment (WHY, không WHAT)?
141
-
142
- TESTS
143
- [ ] Tests cover happy path + error + edge cases?
144
- [ ] Test names mô tả behavior?
145
- [ ] No flaky tests?
146
- ```
147
-
148
- ### A/B Testing Cho Uncertain Decisions
149
-
150
- Khi có 2 approaches và không rõ approach nào tốt hơn:
151
- 1. Prototype cả 2 (minimal implementation)
152
- 2. So sánh: performance, readability, testability, maintainability
153
- 3. TL decide và ghi lý do vào task docs
154
- 4. Loại bỏ prototype không chọn
155
-
156
- ### Review Output Format
157
-
158
- Reviewer phân loại theo mức độ:
159
-
160
- | Mức độ | Ký hiệu | Ý nghĩa |
161
- |--------|---------|---------|
162
- | Critical | 🔴 | Phải sửa trước khi merge. Block merge. |
163
- | Warning | 🟡 | Nên sửa. Không block nhưng ưu tiên cao. |
164
- | Suggestion | 🔵 | Cân nhắc. Không block. |
165
- | Positive | ✅ | Ghi nhận điểm tốt. |
166
-
167
- ---
168
-
169
- ## Layer 4: Automated Gates + QA Confirmation (Trước Merge)
170
-
171
- **Mục tiêu**: Machine-verifiable checks và human QA sign-off.
172
-
173
- ### Automated Gates
174
-
175
- Chạy tự động, block nếu fail (nếu `block_on_fail: true`):
176
-
177
- ```bash
178
- # Quality check script
179
- {quality.test_command} # unit + integration tests
180
- {quality.lint_command} # code style + static analysis
181
- ```
182
-
183
- Mandatory (luôn chạy, không configurable):
184
- - No debug code: `console.log`, `debugger`, `var_dump`, `dd()`
185
- - No sensitive data: passwords, API keys, tokens trong diff
186
-
187
- ### QA Confirmation (thorough depth + có qc role)
188
-
189
- QA không phải developer — QA là independent verification:
190
-
191
- 1. QA nhận test plan (từ Phase 3)
192
- 2. QA verify acceptance criteria từ Layer 1
193
- 3. QA chạy regression checklist
194
- 4. QA sign-off là **explicit gate** — không implied, không assumed
195
- 5. Nếu QA find issues → developer fix → QA re-verify
196
-
197
- ### Merge Checklist
198
-
199
- Trước khi merge PR:
200
-
201
- - [ ] Layer 1: Tất cả acceptance criteria pass
202
- - [ ] Layer 2: Tests pass locally và CI
203
- - [ ] Layer 3: Code review approved (0 CRITICAL, warnings resolved hoặc acknowledged)
204
- - [ ] Layer 4: Automated gates pass + QA sign-off (nếu required)
205
- - [ ] No debug code, no sensitive data
206
- - [ ] Commit messages follow convention
207
- - [ ] Branch up to date với main
208
-
209
- ---
210
-
211
- ## Quality Anti-Patterns
212
-
213
- | Anti-pattern | Vấn đề | Fix |
214
- |-------------|--------|-----|
215
- | Tests sau khi code xong | Tests được viết để match implementation, không verify behavior | Test-first |
216
- | Mock everything | Tests pass nhưng integration fails | Chỉ mock external boundaries |
217
- | "It works on my machine" | Không có automated gate | CI/CD + pre-commit hooks |
218
- | Skip review vì "urgent" | Bugs slip to production, harder to fix | Fast review còn tốt hơn no review |
219
- | LGTM without reading | Review là ceremony, không quality gate | Structured checklist |
220
- | QA là formality | Issues found late, expensive to fix | QA reviews against acceptance criteria |
1
+ <!-- core-version: 1.0 -->
2
+
3
+ # Quality Strategy — 4-Layer Framework
4
+
5
+ > **Nguyên tắc**: Quality là constant. Ceremony adapts.
6
+ > Không có "quality level" — chỉ có depth phù hợp với context.
7
+
8
+ ---
9
+
10
+ ## Overview
11
+
12
+ ```
13
+ Layer 1: Requirements Clarity → trước khi code
14
+ Layer 2: Test-Driven Development → trong khi code
15
+ Layer 3: Cross-Review → sau khi code
16
+ Layer 4: Automated Gates + QA → trước khi merge
17
+ ```
18
+
19
+ Mỗi layer build on top of layer trước. Skip layer sớm → vấn đề phát sinh muộn hơn với chi phí cao hơn.
20
+
21
+ ---
22
+
23
+ ## Layer 1: Requirements Clarity (Trước Khi Code)
24
+
25
+ **Mục tiêu**: Đảm bảo hiểu đúng và đủ TRƯỚC khi bắt đầu implement.
26
+
27
+ ### Given/When/Then Format
28
+
29
+ Mỗi feature/subtask nên có acceptance criteria theo format:
30
+
31
+ ```
32
+ Given [trạng thái ban đầu / precondition]
33
+ When [hành động / trigger]
34
+ Then [kết quả mong đợi / postcondition]
35
+ ```
36
+
37
+ Ví dụ:
38
+ ```
39
+ Given user đã đăng nhập và có items trong cart
40
+ When user logout rồi login lại
41
+ Then cart items vẫn còn nguyên
42
+ ```
43
+
44
+ ### Checklist Requirements Clarity
45
+
46
+ - [ ] Business logic được mô tả bằng Given/When/Then
47
+ - [ ] Edge cases được identify upfront (không phải sau khi code xong)
48
+ - [ ] Acceptance criteria per subtask: testable và specific (không mơ hồ)
49
+ - [ ] Out-of-scope được ghi rõ (tránh scope creep)
50
+ - [ ] Nếu có TL: TL đã review requirements trước khi dev bắt đầu
51
+
52
+ ### Red Flags
53
+
54
+ - Acceptance criteria dùng "should work" / "hoạt động đúng" — không đo lường được
55
+ - Edge cases không được hỏi khi plan, chỉ phát hiện khi test
56
+ - "Tôi hiểu rồi" mà không có written acceptance criteria
57
+
58
+ ---
59
+
60
+ ## Layer 2: Test-Driven Development (Trong Khi Code)
61
+
62
+ **Mục tiêu**: Tests là specification, không phải afterthought.
63
+
64
+ ### TDD Cycle Per Subtask
65
+
66
+ ```
67
+ RED → Viết test trước (failing) — test mô tả behavior mong muốn
68
+ GREEN → Implement tối thiểu để test pass — không over-engineer
69
+ REFACTOR → Cải thiện code structure, không thay đổi behavior
70
+ COMMIT → Một subtask = một commit
71
+ ```
72
+
73
+ ### Test Coverage Priorities
74
+
75
+ 1. **Happy path**: nominal flow với input hợp lệ
76
+ 2. **Error cases**: invalid input, missing data, permission denied
77
+ 3. **Edge cases**: boundary values, empty collections, concurrent operations
78
+ 4. **Regression**: verify fixed bugs không tái xuất hiện
79
+
80
+ ### Test Naming Convention
81
+
82
+ ```
83
+ should [expected behavior] when [condition]
84
+
85
+ Ví dụ:
86
+ - should return empty cart when user has no items
87
+ - should throw AuthError when token is expired
88
+ - should preserve cart when user re-logs in
89
+ ```
90
+
91
+ ### Checklist TDD
92
+
93
+ - [ ] Test file tạo TRƯỚC khi implement
94
+ - [ ] Test fail first (RED) đã verify
95
+ - [ ] Implement minimal để pass (GREEN)
96
+ - [ ] Refactor nếu code smell (không thay đổi tests)
97
+ - [ ] Coverage: happy + error + edge cases
98
+ - [ ] Tests independent (không phụ thuộc thứ tự run)
99
+ - [ ] Không mock internal implementation — chỉ mock external boundaries
100
+
101
+ ---
102
+
103
+ ## Layer 3: Cross-Review (Sau Khi Code)
104
+
105
+ **Mục tiêu**: Phát hiện issues mà người viết không thấy.
106
+
107
+ ### TL Architecture Review (nếu có techlead)
108
+
109
+ Tập trung vào:
110
+ - Architecture decisions đúng không? Có alternatives tốt hơn?
111
+ - Patterns nhất quán với codebase không?
112
+ - Scalability và performance implications?
113
+ - Security design đúng không?
114
+
115
+ Output: Approve hoặc Request Changes với lý do cụ thể.
116
+
117
+ ### Peer Code Review Checklist
118
+
119
+ ```
120
+ CORRECTNESS
121
+ [ ] Logic đúng? Edge cases handled?
122
+ [ ] Error handling đầy đủ? Logged đủ context?
123
+ [ ] No silent failures
124
+
125
+ SECURITY
126
+ [ ] Input validation ở boundaries?
127
+ [ ] No SQL injection / XSS / command injection?
128
+ [ ] Auth/authz checks đúng?
129
+ [ ] No sensitive data in logs/responses
130
+
131
+ PERFORMANCE
132
+ [ ] N+1 queries?
133
+ [ ] Missing indexes?
134
+ [ ] Unnecessary loops trong hot path?
135
+
136
+ MAINTAINABILITY
137
+ [ ] Naming rõ ràng, self-documenting?
138
+ [ ] Functions làm 1 việc?
139
+ [ ] No dead code?
140
+ [ ] Complex logic có comment (WHY, không WHAT)?
141
+
142
+ TESTS
143
+ [ ] Tests cover happy path + error + edge cases?
144
+ [ ] Test names mô tả behavior?
145
+ [ ] No flaky tests?
146
+ ```
147
+
148
+ ### A/B Testing Cho Uncertain Decisions
149
+
150
+ Khi có 2 approaches và không rõ approach nào tốt hơn:
151
+ 1. Prototype cả 2 (minimal implementation)
152
+ 2. So sánh: performance, readability, testability, maintainability
153
+ 3. TL decide và ghi lý do vào task docs
154
+ 4. Loại bỏ prototype không chọn
155
+
156
+ ### Review Output Format
157
+
158
+ Reviewer phân loại theo mức độ:
159
+
160
+ | Mức độ | Ký hiệu | Ý nghĩa |
161
+ |--------|---------|---------|
162
+ | Critical | 🔴 | Phải sửa trước khi merge. Block merge. |
163
+ | Warning | 🟡 | Nên sửa. Không block nhưng ưu tiên cao. |
164
+ | Suggestion | 🔵 | Cân nhắc. Không block. |
165
+ | Positive | ✅ | Ghi nhận điểm tốt. |
166
+
167
+ ---
168
+
169
+ ## Layer 4: Automated Gates + QA Confirmation (Trước Merge)
170
+
171
+ **Mục tiêu**: Machine-verifiable checks và human QA sign-off.
172
+
173
+ ### Automated Gates
174
+
175
+ Chạy tự động, block nếu fail (nếu `block_on_fail: true`):
176
+
177
+ ```bash
178
+ # Quality check script
179
+ {quality.test_command} # unit + integration tests
180
+ {quality.lint_command} # code style + static analysis
181
+ ```
182
+
183
+ Mandatory (luôn chạy, không configurable):
184
+ - No debug code: `console.log`, `debugger`, `var_dump`, `dd()`
185
+ - No sensitive data: passwords, API keys, tokens trong diff
186
+
187
+ ### QA Confirmation (thorough depth + có qc role)
188
+
189
+ QA không phải developer — QA là independent verification:
190
+
191
+ 1. QA nhận test plan (từ Phase 3)
192
+ 2. QA verify acceptance criteria từ Layer 1
193
+ 3. QA chạy regression checklist
194
+ 4. QA sign-off là **explicit gate** — không implied, không assumed
195
+ 5. Nếu QA find issues → developer fix → QA re-verify
196
+
197
+ ### Merge Checklist
198
+
199
+ Trước khi merge PR:
200
+
201
+ - [ ] Layer 1: Tất cả acceptance criteria pass
202
+ - [ ] Layer 2: Tests pass locally và CI
203
+ - [ ] Layer 3: Code review approved (0 CRITICAL, warnings resolved hoặc acknowledged)
204
+ - [ ] Layer 4: Automated gates pass + QA sign-off (nếu required)
205
+ - [ ] No debug code, no sensitive data
206
+ - [ ] Commit messages follow convention
207
+ - [ ] Branch up to date với main
208
+
209
+ ---
210
+
211
+ ## Quality Anti-Patterns
212
+
213
+ | Anti-pattern | Vấn đề | Fix |
214
+ |-------------|--------|-----|
215
+ | Tests sau khi code xong | Tests được viết để match implementation, không verify behavior | Test-first |
216
+ | Mock everything | Tests pass nhưng integration fails | Chỉ mock external boundaries |
217
+ | "It works on my machine" | Không có automated gate | CI/CD + pre-commit hooks |
218
+ | Skip review vì "urgent" | Bugs slip to production, harder to fix | Fast review còn tốt hơn no review |
219
+ | LGTM without reading | Review là ceremony, không quality gate | Structured checklist |
220
+ | QA là formality | Issues found late, expensive to fix | QA reviews against acceptance criteria |