dw-kit 1.0.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/hooks/post-write.sh +9 -11
- package/.claude/hooks/privacy-block.sh +94 -0
- package/.claude/hooks/scout-block.sh +82 -0
- package/.claude/hooks/session-init.sh +74 -0
- package/.claude/hooks/stop-check.sh +36 -0
- package/.claude/rules/code-style.md +37 -37
- package/.claude/rules/commit-standards.md +37 -37
- package/.claude/rules/dw-core.md +100 -0
- package/.claude/rules/dw-skills.md +53 -0
- package/.claude/rules/workflow-rules.md +15 -0
- package/.claude/settings.json +30 -2
- package/.claude/skills/dw-kit-report/SKILL.md +152 -0
- package/.claude/skills/dw-onboard/SKILL.md +201 -0
- package/.claude/skills/dw-research/SKILL.md +17 -1
- package/.claude/skills/dw-retroactive/SKILL.md +311 -0
- package/.claude/templates/agent-report.md +35 -0
- package/.dw/core/AGENTS.md +53 -0
- package/CLAUDE.md +27 -87
- package/README.md +119 -139
- package/package.json +36 -4
- package/src/cli.mjs +92 -92
- package/src/commands/init.mjs +17 -17
- package/src/commands/prompt.mjs +2 -15
- package/src/lib/config.mjs +31 -2
- package/.claude/settings.local.json +0 -13
- package/scripts/e2e-local-check.sh +0 -75
- package/src/__fixtures__/claude-cli-bug-snippet.js +0 -15
- package/src/smoke-test.mjs +0 -351
package/.claude/settings.json
CHANGED
|
@@ -16,7 +16,35 @@
|
|
|
16
16
|
},
|
|
17
17
|
"mcpServers": {},
|
|
18
18
|
"hooks": {
|
|
19
|
+
"UserPromptSubmit": [
|
|
20
|
+
{
|
|
21
|
+
"hooks": [
|
|
22
|
+
{
|
|
23
|
+
"type": "command",
|
|
24
|
+
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/session-init.sh\""
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
],
|
|
19
29
|
"PreToolUse": [
|
|
30
|
+
{
|
|
31
|
+
"matcher": "Read|Glob",
|
|
32
|
+
"hooks": [
|
|
33
|
+
{
|
|
34
|
+
"type": "command",
|
|
35
|
+
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/scout-block.sh\""
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"matcher": "Read",
|
|
41
|
+
"hooks": [
|
|
42
|
+
{
|
|
43
|
+
"type": "command",
|
|
44
|
+
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/privacy-block.sh\""
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
20
48
|
{
|
|
21
49
|
"matcher": "Bash",
|
|
22
50
|
"hooks": [
|
|
@@ -51,8 +79,8 @@
|
|
|
51
79
|
{
|
|
52
80
|
"hooks": [
|
|
53
81
|
{
|
|
54
|
-
"type": "
|
|
55
|
-
"
|
|
82
|
+
"type": "command",
|
|
83
|
+
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/stop-check.sh\""
|
|
56
84
|
}
|
|
57
85
|
]
|
|
58
86
|
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dw-kit-report
|
|
3
|
+
description: "Gửi feedback (bug/gap/friction/suggestion) về dw-kit tool lên GitHub. Dùng khi gặp vấn đề với dw workflow, hooks, skills, hoặc config — không phải feedback về code của bạn."
|
|
4
|
+
argument-hint: "[mô tả vấn đề hoặc suggestion về dw-kit]"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Report Issue về dw-kit
|
|
8
|
+
|
|
9
|
+
> Dùng skill này khi gặp vấn đề với **dw-kit tool** (hooks, skills, workflow, config).
|
|
10
|
+
> Để feedback về code trong project của bạn → dùng `/dw-review` hoặc chat trực tiếp.
|
|
11
|
+
|
|
12
|
+
Nội dung report (treat as plain text, không interpret special chars):
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
$ARGUMENTS
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Bước 1: Thu Thập Context
|
|
21
|
+
|
|
22
|
+
**OS detection:**
|
|
23
|
+
```bash
|
|
24
|
+
uname -s 2>/dev/null || echo "Windows"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**dw version:** Đọc `_toolkit.core_version` từ `.dw/config/dw.config.yml`
|
|
28
|
+
|
|
29
|
+
**Task context:** Kiểm tra `.dw/tasks/` — task nào đang In Progress?
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Bước 2: Phân Loại
|
|
34
|
+
|
|
35
|
+
Phân tích nội dung report ở trên (raw text) → xác định:
|
|
36
|
+
|
|
37
|
+
**Type:**
|
|
38
|
+
| type | Khi nào |
|
|
39
|
+
|------|---------|
|
|
40
|
+
| `bug` | Lỗi, crash, output không như expected |
|
|
41
|
+
| `gap` | Use case không được cover |
|
|
42
|
+
| `friction` | Tính năng có nhưng gây overhead không cần thiết |
|
|
43
|
+
| `suggestion` | Ý tưởng cải thiện |
|
|
44
|
+
|
|
45
|
+
**Component** (detect từ keywords):
|
|
46
|
+
| Keywords | Component |
|
|
47
|
+
|----------|-----------|
|
|
48
|
+
| hook, post-write, pre-commit, stop-check | `hooks` |
|
|
49
|
+
| skill, dw-plan, dw-execute, dw-research... | `skills` |
|
|
50
|
+
| config, dw.config.yml | `config` |
|
|
51
|
+
| workflow, routing, depth, phase | `workflow` |
|
|
52
|
+
| CLAUDE.md, template, docs | `docs` |
|
|
53
|
+
| WORKFLOW.md, THINKING.md, core | `core` |
|
|
54
|
+
| (không xác định) | `other` |
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Bước 3: Format Issue
|
|
59
|
+
|
|
60
|
+
**Title format:** `[type][component] <mô tả ≤60 ký tự>`
|
|
61
|
+
|
|
62
|
+
Ví dụ:
|
|
63
|
+
```
|
|
64
|
+
[bug][hooks] post-write.sh fails with CRLF on Ubuntu
|
|
65
|
+
[gap][skills] need way to preserve original Claude behavior
|
|
66
|
+
[friction][workflow] research phase too heavy for 1-file hotfix
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Body:**
|
|
70
|
+
```markdown
|
|
71
|
+
## Type
|
|
72
|
+
**[TYPE]** — bug | gap | friction | suggestion
|
|
73
|
+
|
|
74
|
+
## Component
|
|
75
|
+
**[COMPONENT]**
|
|
76
|
+
|
|
77
|
+
## Environment
|
|
78
|
+
- OS: [detected]
|
|
79
|
+
- dw version: [từ config]
|
|
80
|
+
- Shell: [bash/zsh/powershell nếu relevant]
|
|
81
|
+
|
|
82
|
+
## Description
|
|
83
|
+
[Nội dung từ $ARGUMENTS — đầy đủ, rõ ràng]
|
|
84
|
+
|
|
85
|
+
## Context
|
|
86
|
+
- Task khi gặp vấn đề: [task name hoặc "general usage"]
|
|
87
|
+
- Command/skill liên quan: [nếu biết]
|
|
88
|
+
- Bước reproduce (nếu là bug):
|
|
89
|
+
1. ...
|
|
90
|
+
2. ...
|
|
91
|
+
|
|
92
|
+
## Impact
|
|
93
|
+
- [ ] Blocking — không thể làm việc
|
|
94
|
+
- [ ] Degraded — làm được nhưng friction cao
|
|
95
|
+
- [ ] Minor — annoying, có workaround dễ
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
*Reported via `/dw-kit-report` | Project: [project.name từ config]*
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Bước 4: Gửi Lên GitHub
|
|
104
|
+
|
|
105
|
+
**Kiểm tra `gh` CLI:**
|
|
106
|
+
```bash
|
|
107
|
+
gh --version 2>/dev/null
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Nếu `gh` available — tạo Issue:**
|
|
111
|
+
```bash
|
|
112
|
+
gh issue create \
|
|
113
|
+
--repo dv-workflow/dv-workflow \
|
|
114
|
+
--title "[type][component] <short description>" \
|
|
115
|
+
--label "type: [type]" \
|
|
116
|
+
--label "component: [component]" \
|
|
117
|
+
--body "<formatted body>"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Sau khi tạo: in ra Issue URL.
|
|
121
|
+
|
|
122
|
+
**Nếu `gh` KHÔNG available:**
|
|
123
|
+
|
|
124
|
+
In ra:
|
|
125
|
+
```
|
|
126
|
+
─────────────────────────────────────────────
|
|
127
|
+
dw-kit: gh CLI không tìm thấy
|
|
128
|
+
─────────────────────────────────────────────
|
|
129
|
+
Tạo Issue thủ công tại:
|
|
130
|
+
https://github.com/dv-workflow/dv-workflow/issues/new
|
|
131
|
+
|
|
132
|
+
Copy nội dung sau:
|
|
133
|
+
|
|
134
|
+
TITLE: [formatted title]
|
|
135
|
+
|
|
136
|
+
BODY:
|
|
137
|
+
[formatted body]
|
|
138
|
+
─────────────────────────────────────────────
|
|
139
|
+
Cài gh CLI: https://cli.github.com
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Bước 5: Xác Nhận
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
✓ Issue đã được gửi: https://github.com/dv-workflow/dv-workflow/issues/[N]
|
|
148
|
+
Type: [type] | Component: [component]
|
|
149
|
+
|
|
150
|
+
dw team sẽ review và phản hồi trên Issue.
|
|
151
|
+
Cảm ơn bạn đã giúp dw tốt hơn!
|
|
152
|
+
```
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dw-onboard
|
|
3
|
+
description: "Onboard dw-kit vào project đang chạy. Scan codebase, tạo project map và context docs cho các modules hiện có. Chạy một lần khi adopt dw vào existing project."
|
|
4
|
+
argument-hint: ""
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Grep
|
|
8
|
+
- Glob
|
|
9
|
+
- Write
|
|
10
|
+
- "Bash(git log *)"
|
|
11
|
+
- "Bash(git shortlog *)"
|
|
12
|
+
- "Bash(ls *)"
|
|
13
|
+
- "Bash(wc *)"
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# dw-onboard — Onboard Existing Project vào dw-kit
|
|
17
|
+
|
|
18
|
+
> Dùng khi adopt dw-kit vào project đã chạy. Chạy **một lần**. Output là project map và context docs cho các modules hiện có — làm nền tảng cho AI trong các sessions sau.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Đọc Config
|
|
23
|
+
|
|
24
|
+
Đọc `.dw/config/dw.config.yml`:
|
|
25
|
+
- `paths.tasks` → base tasks path
|
|
26
|
+
- `project.language` → ngôn ngữ output
|
|
27
|
+
- `project.name` → tên project
|
|
28
|
+
|
|
29
|
+
## Bước 1: Khám phá cấu trúc project
|
|
30
|
+
|
|
31
|
+
Scan top-level structure của codebase:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Glob: src/**, app/**, lib/**, packages/**, services/**, modules/**
|
|
35
|
+
Bash: ls -la (top level)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Xác định:
|
|
39
|
+
- **Project type**: monorepo / single app / microservices / library
|
|
40
|
+
- **Tech stack**: ngôn ngữ, framework chính (từ package.json, go.mod, requirements.txt, Cargo.toml, v.v.)
|
|
41
|
+
- **Entry points**: main files, index files, routers
|
|
42
|
+
- **Major directories**: mỗi dir là 1 potential module
|
|
43
|
+
|
|
44
|
+
## Bước 2: Phân loại modules
|
|
45
|
+
|
|
46
|
+
Với mỗi major directory/module, xác định:
|
|
47
|
+
|
|
48
|
+
| Module | Type | Vai trò | Files | Phức tạp? |
|
|
49
|
+
|--------|------|---------|-------|-----------|
|
|
50
|
+
| [dir] | feature/service/util/infra | [mô tả 1 dòng] | [số files] | Cao/TB/Thấp |
|
|
51
|
+
|
|
52
|
+
**Phức tạp = Cao** nếu: nhiều files (>10), có DB/API, business logic phức tạp.
|
|
53
|
+
→ Modules phức tạp Cao: recommend `/dw-retroactive [module]` sau.
|
|
54
|
+
|
|
55
|
+
## Bước 3: Phân tích nhanh từng module
|
|
56
|
+
|
|
57
|
+
Với mỗi module (không cần đọc toàn bộ — chỉ đọc đủ để hiểu):
|
|
58
|
+
|
|
59
|
+
1. **Entry file**: đọc file chính (index, main, router, controller)
|
|
60
|
+
2. **Exports/Public API**: function/class/endpoint nào được expose?
|
|
61
|
+
3. **Dependencies**: module này gọi đến module nào khác?
|
|
62
|
+
4. **Git activity**: `git shortlog --since="6 months ago" -- [path]` → ai đang maintain?
|
|
63
|
+
|
|
64
|
+
Ghi tóm tắt ngắn gọn (3-5 dòng) per module.
|
|
65
|
+
|
|
66
|
+
## Bước 4: Check git history toàn project
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
git log --oneline --since="3 months ago" | head -30
|
|
70
|
+
git shortlog -sn --since="3 months ago" | head -10
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Xác định:
|
|
74
|
+
- Modules nào đang active development
|
|
75
|
+
- Modules nào stable / ít thay đổi
|
|
76
|
+
- Contributors chính
|
|
77
|
+
|
|
78
|
+
## Bước 5: Tạo output
|
|
79
|
+
|
|
80
|
+
### 5a. Project Map
|
|
81
|
+
|
|
82
|
+
Tạo `.dw/context/project-map.md`:
|
|
83
|
+
|
|
84
|
+
```markdown
|
|
85
|
+
# Project Map: [project.name]
|
|
86
|
+
|
|
87
|
+
## Ngày tạo: [date]
|
|
88
|
+
## Tạo bởi: dw-onboard
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Tech Stack
|
|
93
|
+
|
|
94
|
+
- **Ngôn ngữ**: [language]
|
|
95
|
+
- **Framework**: [framework]
|
|
96
|
+
- **Database**: [db nếu có]
|
|
97
|
+
- **Infrastructure**: [docker, k8s, cloud nếu có]
|
|
98
|
+
|
|
99
|
+
## Cấu Trúc Tổng Quan
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
[ASCII tree của top-level structure]
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Modules
|
|
106
|
+
|
|
107
|
+
| Module | Type | Vai trò | Phức tạp | Active? | Deep-dive? |
|
|
108
|
+
|--------|------|---------|----------|---------|------------|
|
|
109
|
+
| [name] | [type] | [mô tả ngắn] | Cao/TB/Thấp | Có/Không | `/dw-retroactive [name]` |
|
|
110
|
+
|
|
111
|
+
## Dependencies giữa Modules
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
[Module A] → [Module B] → [Module C]
|
|
115
|
+
↓
|
|
116
|
+
[Module D]
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Entry Points chính
|
|
120
|
+
|
|
121
|
+
- [file/endpoint]: [mô tả]
|
|
122
|
+
|
|
123
|
+
## Conventions phát hiện
|
|
124
|
+
|
|
125
|
+
- [Convention 1]: [mô tả]
|
|
126
|
+
- [Convention 2]
|
|
127
|
+
|
|
128
|
+
## Git Activity (3 tháng gần nhất)
|
|
129
|
+
|
|
130
|
+
- **Active modules**: [danh sách]
|
|
131
|
+
- **Stable modules**: [danh sách]
|
|
132
|
+
- **Top contributors**: [tên]
|
|
133
|
+
|
|
134
|
+
## Gợi ý Deep-dive
|
|
135
|
+
|
|
136
|
+
Các modules phức tạp nên chạy `/dw-retroactive` để AI có context đầy đủ:
|
|
137
|
+
- [ ] `/dw-retroactive [module-a]` — [lý do: nhiều files, core business logic]
|
|
138
|
+
- [ ] `/dw-retroactive [module-b]`
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### 5b. Module context docs
|
|
142
|
+
|
|
143
|
+
Với mỗi module **phức tạp Cao**: tạo `.dw/context/modules/[module-name].md`:
|
|
144
|
+
|
|
145
|
+
```markdown
|
|
146
|
+
# Module: [module-name]
|
|
147
|
+
|
|
148
|
+
## Vai trò
|
|
149
|
+
[1-2 câu mô tả]
|
|
150
|
+
|
|
151
|
+
## Files chính
|
|
152
|
+
| File | Vai trò |
|
|
153
|
+
|------|---------|
|
|
154
|
+
| [file] | [vai trò] |
|
|
155
|
+
|
|
156
|
+
## Public API / Exports
|
|
157
|
+
- [function/endpoint]: [mô tả]
|
|
158
|
+
|
|
159
|
+
## Dependencies
|
|
160
|
+
- Upstream: [modules gọi đến đây]
|
|
161
|
+
- Downstream: [modules được đây gọi]
|
|
162
|
+
|
|
163
|
+
## Conventions riêng
|
|
164
|
+
- [Convention đặc thù của module này]
|
|
165
|
+
|
|
166
|
+
## Lưu ý cho AI
|
|
167
|
+
- [Gotchas, tech debt, context quan trọng]
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Với modules **phức tạp TB/Thấp**: chỉ ghi entry trong project-map.md, không tạo file riêng.
|
|
171
|
+
|
|
172
|
+
## Bước 6: Báo cáo kết quả
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
╔══════════════════════════════════════════════════════╗
|
|
176
|
+
║ ✅ dw-onboard complete: [project.name]
|
|
177
|
+
╠══════════════════════════════════════════════════════╣
|
|
178
|
+
║ Modules discovered : [N]
|
|
179
|
+
║ Docs tạo :
|
|
180
|
+
║ .dw/context/project-map.md
|
|
181
|
+
║ .dw/context/modules/[X files]
|
|
182
|
+
║ Tech stack : [summary]
|
|
183
|
+
╠══════════════════════════════════════════════════════╣
|
|
184
|
+
║ Gợi ý tiếp theo:
|
|
185
|
+
║ Modules phức tạp cần deep-dive:
|
|
186
|
+
║ → /dw-retroactive [module-a]
|
|
187
|
+
║ → /dw-retroactive [module-b]
|
|
188
|
+
║
|
|
189
|
+
║ Khi bắt đầu task mới liên quan module đã có:
|
|
190
|
+
║ → AI sẽ tự đọc .dw/context/ để có context
|
|
191
|
+
╚══════════════════════════════════════════════════════╝
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Lưu ý
|
|
197
|
+
|
|
198
|
+
- **Không tạo `.dw/tasks/`** — onboard output vào `.dw/context/`, tách khỏi task docs
|
|
199
|
+
- **Không đọc toàn bộ code** — chỉ cần đủ để hiểu vai trò và interface của module
|
|
200
|
+
- **Không analyze chi tiết logic** — đó là việc của `/dw-retroactive` khi cần deep-dive
|
|
201
|
+
- Nếu project đã có `.dw/context/project-map.md` → hỏi user: "Đã có project map. Update hay skip?"
|
|
@@ -89,7 +89,23 @@ Ghi vào `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-context.md` theo cấu trúc:
|
|
|
89
89
|
[Bất kỳ thông tin bổ sung]
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
## Bước 5:
|
|
92
|
+
## Bước 5: Tạo Report (optional — standard/thorough depth)
|
|
93
|
+
|
|
94
|
+
Nếu task có `.dw/tasks/$ARGUMENTS/reports/` directory (hoặc depth ≥ standard), tạo report:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
.dw/tasks/$ARGUMENTS/reports/[YYMMDD-HHMM]-from-researcher-to-planner-findings.md
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Dùng template `.claude/templates/agent-report.md` với:
|
|
101
|
+
- `status: DONE` (hoặc `DONE_WITH_CONCERNS` nếu có risks lớn)
|
|
102
|
+
- Summary: top 3 findings
|
|
103
|
+
- Details: key files, patterns, dependencies
|
|
104
|
+
- Next Steps: những gì planner cần biết
|
|
105
|
+
|
|
106
|
+
> Quick depth tasks: bỏ qua bước này — progress.md đã đủ.
|
|
107
|
+
|
|
108
|
+
## Bước 6: Tóm tắt
|
|
93
109
|
|
|
94
110
|
Khi hoàn thành, trả về tóm tắt:
|
|
95
111
|
- Số files khảo sát
|