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,274 +1,274 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: dw
|
|
3
|
-
description: "Orchestrator: chạy toàn bộ workflow từ đầu đến cuối cho một task, tự động kết nối các phases, dừng tại các human checkpoints để confirm/feedback. Mạnh nhất khi bạn muốn AI tự drive cả task."
|
|
4
|
-
argument-hint: "[task-name] hoặc DW_DEPTH=[depth] [task-name]"
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# dw-flow — Full Task Workflow Orchestrator
|
|
8
|
-
|
|
9
|
-
Task: **$ARGUMENTS**
|
|
10
|
-
|
|
11
|
-
> AI sẽ tự động chạy qua tất cả phases phù hợp với depth của project.
|
|
12
|
-
> Bạn chỉ cần xem kết quả và phản hồi tại các **[CHECKPOINT]**.
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## Bước 0: Khởi động
|
|
17
|
-
|
|
18
|
-
### Parse arguments
|
|
19
|
-
|
|
20
|
-
Kiểm tra `$ARGUMENTS` có dạng `DW_DEPTH=[depth] [task-name]` không:
|
|
21
|
-
- Nếu có (ví dụ: `DW_DEPTH=quick fix-bug-123`) → dùng `quick` làm depth, `fix-bug-123` làm task-name
|
|
22
|
-
- Nếu không → task-name = `$ARGUMENTS` toàn bộ
|
|
23
|
-
|
|
24
|
-
### Đọc config
|
|
25
|
-
|
|
26
|
-
Đọc `.dw/config/dw.config.yml`:
|
|
27
|
-
- `workflow.default_depth` → depth mặc định (dùng nếu không có DW_DEPTH override)
|
|
28
|
-
- `paths.tasks` → location task docs (dùng làm base path — thay thế `{paths.tasks}` trong toàn bộ file này)
|
|
29
|
-
- `tracking.estimation`, `tracking.log_work`
|
|
30
|
-
- `team.roles` → ai cần approve gì
|
|
31
|
-
|
|
32
|
-
**Depth cuối cùng** = DW_DEPTH override (nếu có) → `workflow.default_depth` từ config.
|
|
33
|
-
|
|
34
|
-
### Kiểm tra task docs
|
|
35
|
-
|
|
36
|
-
Kiểm tra task đã có docs chưa (`{paths.tasks}/[task-name]/`):
|
|
37
|
-
- Nếu chưa → tạo mới (follow instructions trong `.claude/skills/dw-task-init/SKILL.md`)
|
|
38
|
-
- Nếu rồi → đọc progress, hỏi: "Task đã có docs. Tiếp tục từ phase nào?"
|
|
39
|
-
- Options: `research | plan | gate-c | execute | review | fresh-start`
|
|
40
|
-
- Nếu chọn `execute` → kiểm tra plan status trước (xem mục "Resume Handling")
|
|
41
|
-
- Nếu chọn `gate-c` → đọc plan và hiển thị GATE C như thể vừa xong phase Plan
|
|
42
|
-
|
|
43
|
-
Hiển thị kế hoạch trước khi bắt đầu:
|
|
44
|
-
|
|
45
|
-
```
|
|
46
|
-
╔══════════════════════════════════════════════════════╗
|
|
47
|
-
║ dw-flow: [task-name]
|
|
48
|
-
║ Depth: [quick|standard|thorough]
|
|
49
|
-
║ Pipeline:
|
|
50
|
-
║ [danh sách phases sẽ chạy dựa trên depth]
|
|
51
|
-
╚══════════════════════════════════════════════════════╝
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
---
|
|
55
|
-
|
|
56
|
-
## Pipeline theo Depth
|
|
57
|
-
|
|
58
|
-
### quick
|
|
59
|
-
```
|
|
60
|
-
[1] Task Init → [2] Research (optional) → [GATE Q1: Confirm Scope]
|
|
61
|
-
→ [3] Execute → [GATE Q2: Approve Changes] → [4] Commit
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### standard *(mặc định)*
|
|
65
|
-
```
|
|
66
|
-
[1] Task Init → [2] Research → [GATE A: Confirm Scope]
|
|
67
|
-
→ [3] Plan → [GATE C: Approve Plan ← HARD GATE]
|
|
68
|
-
→ [4] Execute → [5] Review → [GATE D: Approve Changes] → [6] Commit
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### thorough
|
|
72
|
-
```
|
|
73
|
-
[1] Task Init → [2] Requirements → [GATE A: Confirm Scope]
|
|
74
|
-
→ [3] Estimate → [4] Research → [5] Arch Review → [GATE B: TL Approve Architecture]
|
|
75
|
-
→ [6] Plan → [GATE C: Approve Plan ← HARD GATE] → [7] Test Plan
|
|
76
|
-
→ [8] Execute → [9] Review → [GATE D: Approve Changes]
|
|
77
|
-
→ [10] Docs Update → [11] Log Work → [12] Commit
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
> ⚠ **Thorough depth** chạy 12 phases — chỉ dùng cho critical tasks. Nếu bị gián đoạn giữa chừng, dùng `stop` + resume thay vì restart.
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
## Thực Hiện Từng Phase
|
|
85
|
-
|
|
86
|
-
Với **mỗi phase**, làm như sau:
|
|
87
|
-
1. Thông báo bắt đầu phase: `▶ Phase N: [tên phase]`
|
|
88
|
-
2. Follow **toàn bộ instructions** trong SKILL.md tương ứng (đường dẫn bên dưới)
|
|
89
|
-
3. Hiển thị output đầy đủ
|
|
90
|
-
4. Sau phase, nếu có GATE → hiển thị checkpoint (xem mục CHECKPOINTS)
|
|
91
|
-
5. Nếu không có GATE → thông báo "✓ Phase N complete" và chuyển ngay phase tiếp theo
|
|
92
|
-
|
|
93
|
-
### Quy tắc khi follow sub-skill trong flow context
|
|
94
|
-
|
|
95
|
-
Khi đọc và follow bất kỳ SKILL.md nào bên dưới, áp dụng các quy tắc sau:
|
|
96
|
-
- **BỎ QUA** phần "Tiếp theo: /dw
|
|
97
|
-
- **BỎ QUA** lệnh "DỪNG chờ approve" trong dw-plan và các skills tương tự — dw-flow sẽ hiển thị GATE thay thế
|
|
98
|
-
- **CHỈ** lấy output, ghi files, hiển thị kết quả — không tự dừng workflow
|
|
99
|
-
|
|
100
|
-
### SKILL.md references (đọc và follow từng file này):
|
|
101
|
-
- Task Init → `.claude/skills/dw-task-init/SKILL.md`
|
|
102
|
-
- Requirements → `.claude/skills/dw-requirements/SKILL.md`
|
|
103
|
-
- Estimate → `.claude/skills/dw-estimate/SKILL.md`
|
|
104
|
-
- Research → `.claude/skills/dw-research/SKILL.md`
|
|
105
|
-
- Arch Review → `.claude/skills/dw-arch-review/SKILL.md`
|
|
106
|
-
- Plan → `.claude/skills/dw-plan/SKILL.md`
|
|
107
|
-
- Test Plan → `.claude/skills/dw-test-plan/SKILL.md`
|
|
108
|
-
- Execute → `.claude/skills/dw-execute/SKILL.md`
|
|
109
|
-
- Review → `.claude/skills/dw-review/SKILL.md`
|
|
110
|
-
- Docs Update → `.claude/skills/dw-docs-update/SKILL.md`
|
|
111
|
-
- Log Work → `.claude/skills/dw-log-work/SKILL.md`
|
|
112
|
-
- Commit → `.claude/skills/dw-commit/SKILL.md`
|
|
113
|
-
|
|
114
|
-
---
|
|
115
|
-
|
|
116
|
-
## CHECKPOINTS (Human Gates)
|
|
117
|
-
|
|
118
|
-
Tại mỗi GATE, **dừng lại** và hiển thị:
|
|
119
|
-
|
|
120
|
-
```
|
|
121
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
122
|
-
[GATE X] — [Tên gate]
|
|
123
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
124
|
-
[Tóm tắt output phase vừa xong — 3-5 bullets]
|
|
125
|
-
|
|
126
|
-
Options:
|
|
127
|
-
→ ok / continue Tiếp tục phase tiếp theo
|
|
128
|
-
→ revise: [feedback] AI chỉnh sửa phase này rồi hỏi lại
|
|
129
|
-
→ skip [phase-name] Bỏ qua phase tiếp theo
|
|
130
|
-
→ stop Dừng workflow tại đây
|
|
131
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### Xử lý response:
|
|
135
|
-
|
|
136
|
-
**`ok` / `continue` / `approved` / _(bất kỳ affirmative)_**
|
|
137
|
-
→ Chuyển ngay phase tiếp theo, không hỏi thêm.
|
|
138
|
-
|
|
139
|
-
**`revise: [nội dung]`**
|
|
140
|
-
→ Đọc feedback, chỉnh sửa output của phase vừa xong.
|
|
141
|
-
→ Hiển thị lại output đã chỉnh.
|
|
142
|
-
→ Hỏi lại checkpoint (cùng options).
|
|
143
|
-
→ Có thể revise nhiều lần.
|
|
144
|
-
|
|
145
|
-
**`skip [phase-name]`**
|
|
146
|
-
→ Bỏ qua phase được chỉ định.
|
|
147
|
-
→ Thông báo: "Skipped [phase-name]. Continuing with [next-phase]..."
|
|
148
|
-
|
|
149
|
-
**`stop`**
|
|
150
|
-
→ Dừng workflow.
|
|
151
|
-
→ Tóm tắt những gì đã hoàn thành.
|
|
152
|
-
→ Hướng dẫn resume: "Để tiếp tục: `/dw
|
|
153
|
-
|
|
154
|
-
**Feedback tự do** (không dùng keyword trên)
|
|
155
|
-
→ Interpret là `revise: [feedback]`
|
|
156
|
-
→ AI tự hiểu và điều chỉnh.
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
## GATE Descriptions
|
|
161
|
-
|
|
162
|
-
### GATE Q1 — Confirm Scope (quick only)
|
|
163
|
-
Sau Research (nếu có) hoặc Task Init.
|
|
164
|
-
Tóm tắt: phạm vi task, approach dự kiến, files sẽ thay đổi.
|
|
165
|
-
→ User confirm để tiếp tục Execute trực tiếp.
|
|
166
|
-
|
|
167
|
-
### GATE Q2 — Approve Changes (quick only)
|
|
168
|
-
Sau Review (nếu có) hoặc Execute.
|
|
169
|
-
Tóm tắt: thay đổi đã thực hiện, issues phát hiện (nếu review được chạy).
|
|
170
|
-
→ User confirm để commit.
|
|
171
|
-
|
|
172
|
-
### GATE A — Confirm Scope / Approve Research (standard + thorough)
|
|
173
|
-
Sau Research (hoặc Requirements với thorough).
|
|
174
|
-
Tóm tắt: phạm vi task, risks chính, approach gợi ý.
|
|
175
|
-
→ User confirm để tiếp tục Plan.
|
|
176
|
-
|
|
177
|
-
### GATE B — Approve Architecture (thorough only)
|
|
178
|
-
Sau Arch Review.
|
|
179
|
-
Tóm tắt: TL decisions, must-fix concerns.
|
|
180
|
-
→ Cần TL approve rõ ràng trước khi plan.
|
|
181
|
-
|
|
182
|
-
### GATE C — Approve Plan (standard + thorough) ← HARD GATE
|
|
183
|
-
Sau Plan. **Bắt buộc approve** — không tự ý skip.
|
|
184
|
-
Hiển thị:
|
|
185
|
-
- Số subtasks
|
|
186
|
-
- Estimated effort (nếu có)
|
|
187
|
-
- Top risks
|
|
188
|
-
- Files sẽ thay đổi
|
|
189
|
-
|
|
190
|
-
**Sau khi user approve GATE C:**
|
|
191
|
-
→ Cập nhật `{paths.tasks}/[task-name]/[task-name]-plan.md`: đổi `Trạng thái: Draft → cần approve` thành `Trạng thái: Approved`
|
|
192
|
-
→ Sau đó mới proceed sang Execute
|
|
193
|
-
|
|
194
|
-
→ Chỉ execute khi có explicit "approved" / "ok"
|
|
195
|
-
|
|
196
|
-
### GATE D — Approve Changes (standard + thorough)
|
|
197
|
-
Sau Review.
|
|
198
|
-
Tóm tắt: issues tìm được (Critical/Warning/Suggestion).
|
|
199
|
-
→ Nếu có Critical → **phải fix trước** khi commit.
|
|
200
|
-
→ Nếu chỉ Warning → user chọn.
|
|
201
|
-
|
|
202
|
-
---
|
|
203
|
-
|
|
204
|
-
## Resume Handling
|
|
205
|
-
|
|
206
|
-
Khi user chọn resume từ `execute` mà plan chưa có `Trạng thái: Approved`:
|
|
207
|
-
1. Đọc plan file
|
|
208
|
-
2. Nếu status là `Draft` hoặc `cần approve` → **hiển thị GATE C** với nội dung plan hiện tại
|
|
209
|
-
3. Chỉ tiến vào Execute sau khi user approve GATE C và plan status đã được cập nhật
|
|
210
|
-
|
|
211
|
-
Khi user chọn `gate-c` trực tiếp:
|
|
212
|
-
→ Đọc plan file, hiển thị GATE C, xử lý như bình thường.
|
|
213
|
-
|
|
214
|
-
---
|
|
215
|
-
|
|
216
|
-
## Progress Tracking
|
|
217
|
-
|
|
218
|
-
Cập nhật `{paths.tasks}/[task-name]/[task-name]-progress.md` sau **mỗi phase** hoàn thành.
|
|
219
|
-
*(Lưu ý: `{paths.tasks}` là template — thay bằng giá trị `paths.tasks` đã đọc từ config)*
|
|
220
|
-
|
|
221
|
-
```markdown
|
|
222
|
-
## Flow Progress
|
|
223
|
-
| Phase | Status | Timestamp | Notes |
|
|
224
|
-
|-------|--------|-----------|-------|
|
|
225
|
-
| task-init | ✓ Done | [time] | |
|
|
226
|
-
| research | ✓ Done | [time] | [key finding] |
|
|
227
|
-
| plan | ✓ Done | [time] | [N subtasks] |
|
|
228
|
-
| execute | 🔄 In Progress | [time] | ST-2/4 done |
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
---
|
|
232
|
-
|
|
233
|
-
## Khi Gặp Vấn Đề Trong Execute
|
|
234
|
-
|
|
235
|
-
Nếu trong phase Execute, phát hiện:
|
|
236
|
-
- **Scope vượt plan** → DỪNG, hiển thị mini-GATE:
|
|
237
|
-
```
|
|
238
|
-
⚠ Scope Issue Detected
|
|
239
|
-
→ extend-plan: [mô tả] Cập nhật plan rồi tiếp tục
|
|
240
|
-
→ skip-subtask Bỏ qua subtask này
|
|
241
|
-
→ stop Dừng để review lại
|
|
242
|
-
```
|
|
243
|
-
- **Test fail không rõ** → Tự động chạy debug routine (`.claude/skills/dw-debug/SKILL.md`), báo kết quả
|
|
244
|
-
- **Blocker** → Dừng, mô tả blocker rõ ràng, đề xuất options
|
|
245
|
-
|
|
246
|
-
---
|
|
247
|
-
|
|
248
|
-
## Summary khi Hoàn Thành
|
|
249
|
-
|
|
250
|
-
```
|
|
251
|
-
╔══════════════════════════════════════════════════════╗
|
|
252
|
-
║ ✅ dw-flow complete: [task-name]
|
|
253
|
-
╠══════════════════════════════════════════════════════╣
|
|
254
|
-
║ Phases completed : [list]
|
|
255
|
-
║ Subtasks done : N/N
|
|
256
|
-
║ Commits : [N commits, hashes]
|
|
257
|
-
║ Effort : [Xh actual vs Yh estimated] (nếu tracking)
|
|
258
|
-
║ Issues found : [N Critical fixed, N Warnings]
|
|
259
|
-
╠══════════════════════════════════════════════════════╣
|
|
260
|
-
║ Còn lại (nếu có) :
|
|
261
|
-
║ - [ ] Chờ TL review PR
|
|
262
|
-
║ - [ ] Update DECISIONS.md (nếu có arch decision)
|
|
263
|
-
╚══════════════════════════════════════════════════════╝
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
---
|
|
267
|
-
|
|
268
|
-
## Tips
|
|
269
|
-
|
|
270
|
-
- Muốn chạy nhanh nhất? Override depth: `/dw
|
|
271
|
-
- Muốn dừng và tiếp tục sau? Gõ `stop` tại bất kỳ GATE nào
|
|
272
|
-
- Muốn bỏ một phase? `skip docs-update` hoặc `skip log-work`
|
|
273
|
-
- Muốn xem lại plan trước khi approve? File ở `.dw/tasks/[task-name]/[task-name]-plan.md`
|
|
274
|
-
- Dừng giữa plan và execute? Resume bằng `gate-c` để re-confirm plan trước khi execute
|
|
1
|
+
---
|
|
2
|
+
name: dw:flow
|
|
3
|
+
description: "Orchestrator: chạy toàn bộ workflow từ đầu đến cuối cho một task, tự động kết nối các phases, dừng tại các human checkpoints để confirm/feedback. Mạnh nhất khi bạn muốn AI tự drive cả task."
|
|
4
|
+
argument-hint: "[task-name] hoặc DW_DEPTH=[depth] [task-name]"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# dw-flow — Full Task Workflow Orchestrator
|
|
8
|
+
|
|
9
|
+
Task: **$ARGUMENTS**
|
|
10
|
+
|
|
11
|
+
> AI sẽ tự động chạy qua tất cả phases phù hợp với depth của project.
|
|
12
|
+
> Bạn chỉ cần xem kết quả và phản hồi tại các **[CHECKPOINT]**.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Bước 0: Khởi động
|
|
17
|
+
|
|
18
|
+
### Parse arguments
|
|
19
|
+
|
|
20
|
+
Kiểm tra `$ARGUMENTS` có dạng `DW_DEPTH=[depth] [task-name]` không:
|
|
21
|
+
- Nếu có (ví dụ: `DW_DEPTH=quick fix-bug-123`) → dùng `quick` làm depth, `fix-bug-123` làm task-name
|
|
22
|
+
- Nếu không → task-name = `$ARGUMENTS` toàn bộ
|
|
23
|
+
|
|
24
|
+
### Đọc config
|
|
25
|
+
|
|
26
|
+
Đọc `.dw/config/dw.config.yml`:
|
|
27
|
+
- `workflow.default_depth` → depth mặc định (dùng nếu không có DW_DEPTH override)
|
|
28
|
+
- `paths.tasks` → location task docs (dùng làm base path — thay thế `{paths.tasks}` trong toàn bộ file này)
|
|
29
|
+
- `tracking.estimation`, `tracking.log_work`
|
|
30
|
+
- `team.roles` → ai cần approve gì
|
|
31
|
+
|
|
32
|
+
**Depth cuối cùng** = DW_DEPTH override (nếu có) → `workflow.default_depth` từ config.
|
|
33
|
+
|
|
34
|
+
### Kiểm tra task docs
|
|
35
|
+
|
|
36
|
+
Kiểm tra task đã có docs chưa (`{paths.tasks}/[task-name]/`):
|
|
37
|
+
- Nếu chưa → tạo mới (follow instructions trong `.claude/skills/dw-task-init/SKILL.md`)
|
|
38
|
+
- Nếu rồi → đọc progress, hỏi: "Task đã có docs. Tiếp tục từ phase nào?"
|
|
39
|
+
- Options: `research | plan | gate-c | execute | review | fresh-start`
|
|
40
|
+
- Nếu chọn `execute` → kiểm tra plan status trước (xem mục "Resume Handling")
|
|
41
|
+
- Nếu chọn `gate-c` → đọc plan và hiển thị GATE C như thể vừa xong phase Plan
|
|
42
|
+
|
|
43
|
+
Hiển thị kế hoạch trước khi bắt đầu:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
╔══════════════════════════════════════════════════════╗
|
|
47
|
+
║ dw-flow: [task-name]
|
|
48
|
+
║ Depth: [quick|standard|thorough]
|
|
49
|
+
║ Pipeline:
|
|
50
|
+
║ [danh sách phases sẽ chạy dựa trên depth]
|
|
51
|
+
╚══════════════════════════════════════════════════════╝
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Pipeline theo Depth
|
|
57
|
+
|
|
58
|
+
### quick
|
|
59
|
+
```
|
|
60
|
+
[1] Task Init → [2] Research (optional) → [GATE Q1: Confirm Scope]
|
|
61
|
+
→ [3] Execute → [GATE Q2: Approve Changes] → [4] Commit
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### standard *(mặc định)*
|
|
65
|
+
```
|
|
66
|
+
[1] Task Init → [2] Research → [GATE A: Confirm Scope]
|
|
67
|
+
→ [3] Plan → [GATE C: Approve Plan ← HARD GATE]
|
|
68
|
+
→ [4] Execute → [5] Review → [GATE D: Approve Changes] → [6] Commit
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### thorough
|
|
72
|
+
```
|
|
73
|
+
[1] Task Init → [2] Requirements → [GATE A: Confirm Scope]
|
|
74
|
+
→ [3] Estimate → [4] Research → [5] Arch Review → [GATE B: TL Approve Architecture]
|
|
75
|
+
→ [6] Plan → [GATE C: Approve Plan ← HARD GATE] → [7] Test Plan
|
|
76
|
+
→ [8] Execute → [9] Review → [GATE D: Approve Changes]
|
|
77
|
+
→ [10] Docs Update → [11] Log Work → [12] Commit
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
> ⚠ **Thorough depth** chạy 12 phases — chỉ dùng cho critical tasks. Nếu bị gián đoạn giữa chừng, dùng `stop` + resume thay vì restart.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Thực Hiện Từng Phase
|
|
85
|
+
|
|
86
|
+
Với **mỗi phase**, làm như sau:
|
|
87
|
+
1. Thông báo bắt đầu phase: `▶ Phase N: [tên phase]`
|
|
88
|
+
2. Follow **toàn bộ instructions** trong SKILL.md tương ứng (đường dẫn bên dưới)
|
|
89
|
+
3. Hiển thị output đầy đủ
|
|
90
|
+
4. Sau phase, nếu có GATE → hiển thị checkpoint (xem mục CHECKPOINTS)
|
|
91
|
+
5. Nếu không có GATE → thông báo "✓ Phase N complete" và chuyển ngay phase tiếp theo
|
|
92
|
+
|
|
93
|
+
### Quy tắc khi follow sub-skill trong flow context
|
|
94
|
+
|
|
95
|
+
Khi đọc và follow bất kỳ SKILL.md nào bên dưới, áp dụng các quy tắc sau:
|
|
96
|
+
- **BỎ QUA** phần "Tiếp theo: /dw:xxx" ở cuối mỗi skill — dw-flow tự handle next step
|
|
97
|
+
- **BỎ QUA** lệnh "DỪNG chờ approve" trong dw-plan và các skills tương tự — dw-flow sẽ hiển thị GATE thay thế
|
|
98
|
+
- **CHỈ** lấy output, ghi files, hiển thị kết quả — không tự dừng workflow
|
|
99
|
+
|
|
100
|
+
### SKILL.md references (đọc và follow từng file này):
|
|
101
|
+
- Task Init → `.claude/skills/dw-task-init/SKILL.md`
|
|
102
|
+
- Requirements → `.claude/skills/dw-requirements/SKILL.md`
|
|
103
|
+
- Estimate → `.claude/skills/dw-estimate/SKILL.md`
|
|
104
|
+
- Research → `.claude/skills/dw-research/SKILL.md`
|
|
105
|
+
- Arch Review → `.claude/skills/dw-arch-review/SKILL.md`
|
|
106
|
+
- Plan → `.claude/skills/dw-plan/SKILL.md`
|
|
107
|
+
- Test Plan → `.claude/skills/dw-test-plan/SKILL.md`
|
|
108
|
+
- Execute → `.claude/skills/dw-execute/SKILL.md`
|
|
109
|
+
- Review → `.claude/skills/dw-review/SKILL.md`
|
|
110
|
+
- Docs Update → `.claude/skills/dw-docs-update/SKILL.md`
|
|
111
|
+
- Log Work → `.claude/skills/dw-log-work/SKILL.md`
|
|
112
|
+
- Commit → `.claude/skills/dw-commit/SKILL.md`
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## CHECKPOINTS (Human Gates)
|
|
117
|
+
|
|
118
|
+
Tại mỗi GATE, **dừng lại** và hiển thị:
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
122
|
+
[GATE X] — [Tên gate]
|
|
123
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
124
|
+
[Tóm tắt output phase vừa xong — 3-5 bullets]
|
|
125
|
+
|
|
126
|
+
Options:
|
|
127
|
+
→ ok / continue Tiếp tục phase tiếp theo
|
|
128
|
+
→ revise: [feedback] AI chỉnh sửa phase này rồi hỏi lại
|
|
129
|
+
→ skip [phase-name] Bỏ qua phase tiếp theo
|
|
130
|
+
→ stop Dừng workflow tại đây
|
|
131
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Xử lý response:
|
|
135
|
+
|
|
136
|
+
**`ok` / `continue` / `approved` / _(bất kỳ affirmative)_**
|
|
137
|
+
→ Chuyển ngay phase tiếp theo, không hỏi thêm.
|
|
138
|
+
|
|
139
|
+
**`revise: [nội dung]`**
|
|
140
|
+
→ Đọc feedback, chỉnh sửa output của phase vừa xong.
|
|
141
|
+
→ Hiển thị lại output đã chỉnh.
|
|
142
|
+
→ Hỏi lại checkpoint (cùng options).
|
|
143
|
+
→ Có thể revise nhiều lần.
|
|
144
|
+
|
|
145
|
+
**`skip [phase-name]`**
|
|
146
|
+
→ Bỏ qua phase được chỉ định.
|
|
147
|
+
→ Thông báo: "Skipped [phase-name]. Continuing with [next-phase]..."
|
|
148
|
+
|
|
149
|
+
**`stop`**
|
|
150
|
+
→ Dừng workflow.
|
|
151
|
+
→ Tóm tắt những gì đã hoàn thành.
|
|
152
|
+
→ Hướng dẫn resume: "Để tiếp tục: `/dw:flow [task-name]` → chọn phase"
|
|
153
|
+
|
|
154
|
+
**Feedback tự do** (không dùng keyword trên)
|
|
155
|
+
→ Interpret là `revise: [feedback]`
|
|
156
|
+
→ AI tự hiểu và điều chỉnh.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## GATE Descriptions
|
|
161
|
+
|
|
162
|
+
### GATE Q1 — Confirm Scope (quick only)
|
|
163
|
+
Sau Research (nếu có) hoặc Task Init.
|
|
164
|
+
Tóm tắt: phạm vi task, approach dự kiến, files sẽ thay đổi.
|
|
165
|
+
→ User confirm để tiếp tục Execute trực tiếp.
|
|
166
|
+
|
|
167
|
+
### GATE Q2 — Approve Changes (quick only)
|
|
168
|
+
Sau Review (nếu có) hoặc Execute.
|
|
169
|
+
Tóm tắt: thay đổi đã thực hiện, issues phát hiện (nếu review được chạy).
|
|
170
|
+
→ User confirm để commit.
|
|
171
|
+
|
|
172
|
+
### GATE A — Confirm Scope / Approve Research (standard + thorough)
|
|
173
|
+
Sau Research (hoặc Requirements với thorough).
|
|
174
|
+
Tóm tắt: phạm vi task, risks chính, approach gợi ý.
|
|
175
|
+
→ User confirm để tiếp tục Plan.
|
|
176
|
+
|
|
177
|
+
### GATE B — Approve Architecture (thorough only)
|
|
178
|
+
Sau Arch Review.
|
|
179
|
+
Tóm tắt: TL decisions, must-fix concerns.
|
|
180
|
+
→ Cần TL approve rõ ràng trước khi plan.
|
|
181
|
+
|
|
182
|
+
### GATE C — Approve Plan (standard + thorough) ← HARD GATE
|
|
183
|
+
Sau Plan. **Bắt buộc approve** — không tự ý skip.
|
|
184
|
+
Hiển thị:
|
|
185
|
+
- Số subtasks
|
|
186
|
+
- Estimated effort (nếu có)
|
|
187
|
+
- Top risks
|
|
188
|
+
- Files sẽ thay đổi
|
|
189
|
+
|
|
190
|
+
**Sau khi user approve GATE C:**
|
|
191
|
+
→ Cập nhật `{paths.tasks}/[task-name]/[task-name]-plan.md`: đổi `Trạng thái: Draft → cần approve` thành `Trạng thái: Approved`
|
|
192
|
+
→ Sau đó mới proceed sang Execute
|
|
193
|
+
|
|
194
|
+
→ Chỉ execute khi có explicit "approved" / "ok"
|
|
195
|
+
|
|
196
|
+
### GATE D — Approve Changes (standard + thorough)
|
|
197
|
+
Sau Review.
|
|
198
|
+
Tóm tắt: issues tìm được (Critical/Warning/Suggestion).
|
|
199
|
+
→ Nếu có Critical → **phải fix trước** khi commit.
|
|
200
|
+
→ Nếu chỉ Warning → user chọn.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Resume Handling
|
|
205
|
+
|
|
206
|
+
Khi user chọn resume từ `execute` mà plan chưa có `Trạng thái: Approved`:
|
|
207
|
+
1. Đọc plan file
|
|
208
|
+
2. Nếu status là `Draft` hoặc `cần approve` → **hiển thị GATE C** với nội dung plan hiện tại
|
|
209
|
+
3. Chỉ tiến vào Execute sau khi user approve GATE C và plan status đã được cập nhật
|
|
210
|
+
|
|
211
|
+
Khi user chọn `gate-c` trực tiếp:
|
|
212
|
+
→ Đọc plan file, hiển thị GATE C, xử lý như bình thường.
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Progress Tracking
|
|
217
|
+
|
|
218
|
+
Cập nhật `{paths.tasks}/[task-name]/[task-name]-progress.md` sau **mỗi phase** hoàn thành.
|
|
219
|
+
*(Lưu ý: `{paths.tasks}` là template — thay bằng giá trị `paths.tasks` đã đọc từ config)*
|
|
220
|
+
|
|
221
|
+
```markdown
|
|
222
|
+
## Flow Progress
|
|
223
|
+
| Phase | Status | Timestamp | Notes |
|
|
224
|
+
|-------|--------|-----------|-------|
|
|
225
|
+
| task-init | ✓ Done | [time] | |
|
|
226
|
+
| research | ✓ Done | [time] | [key finding] |
|
|
227
|
+
| plan | ✓ Done | [time] | [N subtasks] |
|
|
228
|
+
| execute | 🔄 In Progress | [time] | ST-2/4 done |
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Khi Gặp Vấn Đề Trong Execute
|
|
234
|
+
|
|
235
|
+
Nếu trong phase Execute, phát hiện:
|
|
236
|
+
- **Scope vượt plan** → DỪNG, hiển thị mini-GATE:
|
|
237
|
+
```
|
|
238
|
+
⚠ Scope Issue Detected
|
|
239
|
+
→ extend-plan: [mô tả] Cập nhật plan rồi tiếp tục
|
|
240
|
+
→ skip-subtask Bỏ qua subtask này
|
|
241
|
+
→ stop Dừng để review lại
|
|
242
|
+
```
|
|
243
|
+
- **Test fail không rõ** → Tự động chạy debug routine (`.claude/skills/dw-debug/SKILL.md`), báo kết quả
|
|
244
|
+
- **Blocker** → Dừng, mô tả blocker rõ ràng, đề xuất options
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Summary khi Hoàn Thành
|
|
249
|
+
|
|
250
|
+
```
|
|
251
|
+
╔══════════════════════════════════════════════════════╗
|
|
252
|
+
║ ✅ dw-flow complete: [task-name]
|
|
253
|
+
╠══════════════════════════════════════════════════════╣
|
|
254
|
+
║ Phases completed : [list]
|
|
255
|
+
║ Subtasks done : N/N
|
|
256
|
+
║ Commits : [N commits, hashes]
|
|
257
|
+
║ Effort : [Xh actual vs Yh estimated] (nếu tracking)
|
|
258
|
+
║ Issues found : [N Critical fixed, N Warnings]
|
|
259
|
+
╠══════════════════════════════════════════════════════╣
|
|
260
|
+
║ Còn lại (nếu có) :
|
|
261
|
+
║ - [ ] Chờ TL review PR
|
|
262
|
+
║ - [ ] Update DECISIONS.md (nếu có arch decision)
|
|
263
|
+
╚══════════════════════════════════════════════════════╝
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Tips
|
|
269
|
+
|
|
270
|
+
- Muốn chạy nhanh nhất? Override depth: `/dw:flow DW_DEPTH=quick fix-bug-123`
|
|
271
|
+
- Muốn dừng và tiếp tục sau? Gõ `stop` tại bất kỳ GATE nào
|
|
272
|
+
- Muốn bỏ một phase? `skip docs-update` hoặc `skip log-work`
|
|
273
|
+
- Muốn xem lại plan trước khi approve? File ở `.dw/tasks/[task-name]/[task-name]-plan.md`
|
|
274
|
+
- Dừng giữa plan và execute? Resume bằng `gate-c` để re-confirm plan trước khi execute
|