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,98 +1,98 @@
1
- ---
2
- name: dw-requirements
3
- description: "BA skill: Thu thập, phân tích và viết requirements document + user stories. Dùng ở đầu feature trước khi dev bắt đầu."
4
- argument-hint: "[feature-name]"
5
- allowed-tools:
6
- - Read
7
- - Write
8
- - Glob
9
- ---
10
-
11
- # Thu Thập & Viết Requirements
12
-
13
- Feature: **$ARGUMENTS**
14
-
15
- ## Đọc Config
16
-
17
- Đọc `.dw/config/dw.config.yml` → `paths.tasks`, `team.roles`, `workflow.default_depth`.
18
- Skill này dành cho depth: `standard` hoặc `thorough`.
19
-
20
- ## Quy Trình
21
-
22
- ### 1. Thu thập thông tin
23
-
24
- Hỏi (hoặc đọc từ conversation context):
25
- - **Business goal**: Mục tiêu kinh doanh là gì?
26
- - **User problems**: Người dùng đang gặp vấn đề gì?
27
- - **Stakeholders**: Ai bị ảnh hưởng? (end user, admin, ops)
28
- - **Scope**: In-scope là gì? Out-of-scope là gì?
29
- - **Constraints**: Deadline? Tech constraints? Budget?
30
- - **Success criteria**: Làm sao biết feature thành công?
31
-
32
- ### 2. Phân tích & cấu trúc
33
-
34
- Tổ chức yêu cầu thành:
35
- - **Functional requirements**: Hệ thống PHẢI làm gì
36
- - **Non-functional requirements**: Performance, security, scalability
37
- - **User stories**: As [who], I want [what], so that [why]
38
- - **Acceptance criteria**: Điều kiện pass/fail
39
-
40
- ### 3. Tạo Requirements Doc
41
-
42
- Ghi ra `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-requirements.md`:
43
-
44
- ```markdown
45
- # Requirements: [Feature Name]
46
-
47
- ## Ngày: [date] | Author: BA | Status: Draft
48
-
49
- ## Business Context
50
- **Goal**: [Mục tiêu kinh doanh]
51
- **Problem**: [Vấn đề cần giải quyết]
52
- **Success Metrics**: [Đo lường thành công bằng gì]
53
-
54
- ## Stakeholders
55
- | Role | Nhu cầu | Priority |
56
- |------|---------|---------|
57
- | End User | | Must-have |
58
- | Admin | | |
59
-
60
- ## User Stories
61
-
62
- ### Epic: [Tên epic]
63
-
64
- **US-001**: Tiêu đề ngắn gọn
65
- - **As**: [role]
66
- - **I want**: [action/feature]
67
- - **So that**: [business value]
68
- - **Acceptance Criteria**:
69
- - [ ] Given [context], when [action], then [result]
70
- - [ ] Given [context], when [edge case], then [expected behavior]
71
- - **Priority**: Must-have / Should-have / Nice-to-have
72
- - **Estimate**: [rough size]
73
-
74
- ## Functional Requirements
75
- | # | Requirement | Priority | Notes |
76
- |---|------------|---------|-------|
77
-
78
- ## Non-Functional Requirements
79
- | # | Requirement | Metric |
80
- |---|------------|--------|
81
- | NFR-1 | Performance: page load < 2s | p95 |
82
- | NFR-2 | Availability: 99.9% uptime | |
83
-
84
- ## Out of Scope
85
- - [Điều này KHÔNG bao gồm]
86
-
87
- ## Open Questions
88
- - [ ] [Câu hỏi cần BA/PM làm rõ]
89
-
90
- ## Dependencies
91
- - [Feature/system khác cần có trước]
92
- ```
93
-
94
- ## Sau Khi Tạo
95
-
96
- - Thông báo dev: "Requirements doc sẵn sàng tại [path]"
97
- - Gợi ý: "TL có thể chạy `/dw-arch-review $ARGUMENTS` để review technical feasibility"
98
- - Gợi ý: "Dev có thể chạy `/dw-task-init $ARGUMENTS` để bắt đầu implementation"
1
+ ---
2
+ name: dw:requirements
3
+ description: "BA skill: Thu thập, phân tích và viết requirements document + user stories. Dùng ở đầu feature trước khi dev bắt đầu."
4
+ argument-hint: "[feature-name]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Glob
9
+ ---
10
+
11
+ # Thu Thập & Viết Requirements
12
+
13
+ Feature: **$ARGUMENTS**
14
+
15
+ ## Đọc Config
16
+
17
+ Đọc `.dw/config/dw.config.yml` → `paths.tasks`, `team.roles`, `workflow.default_depth`.
18
+ Skill này dành cho depth: `standard` hoặc `thorough`.
19
+
20
+ ## Quy Trình
21
+
22
+ ### 1. Thu thập thông tin
23
+
24
+ Hỏi (hoặc đọc từ conversation context):
25
+ - **Business goal**: Mục tiêu kinh doanh là gì?
26
+ - **User problems**: Người dùng đang gặp vấn đề gì?
27
+ - **Stakeholders**: Ai bị ảnh hưởng? (end user, admin, ops)
28
+ - **Scope**: In-scope là gì? Out-of-scope là gì?
29
+ - **Constraints**: Deadline? Tech constraints? Budget?
30
+ - **Success criteria**: Làm sao biết feature thành công?
31
+
32
+ ### 2. Phân tích & cấu trúc
33
+
34
+ Tổ chức yêu cầu thành:
35
+ - **Functional requirements**: Hệ thống PHẢI làm gì
36
+ - **Non-functional requirements**: Performance, security, scalability
37
+ - **User stories**: As [who], I want [what], so that [why]
38
+ - **Acceptance criteria**: Điều kiện pass/fail
39
+
40
+ ### 3. Tạo Requirements Doc
41
+
42
+ Ghi ra `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-requirements.md`:
43
+
44
+ ```markdown
45
+ # Requirements: [Feature Name]
46
+
47
+ ## Ngày: [date] | Author: BA | Status: Draft
48
+
49
+ ## Business Context
50
+ **Goal**: [Mục tiêu kinh doanh]
51
+ **Problem**: [Vấn đề cần giải quyết]
52
+ **Success Metrics**: [Đo lường thành công bằng gì]
53
+
54
+ ## Stakeholders
55
+ | Role | Nhu cầu | Priority |
56
+ |------|---------|---------|
57
+ | End User | | Must-have |
58
+ | Admin | | |
59
+
60
+ ## User Stories
61
+
62
+ ### Epic: [Tên epic]
63
+
64
+ **US-001**: Tiêu đề ngắn gọn
65
+ - **As**: [role]
66
+ - **I want**: [action/feature]
67
+ - **So that**: [business value]
68
+ - **Acceptance Criteria**:
69
+ - [ ] Given [context], when [action], then [result]
70
+ - [ ] Given [context], when [edge case], then [expected behavior]
71
+ - **Priority**: Must-have / Should-have / Nice-to-have
72
+ - **Estimate**: [rough size]
73
+
74
+ ## Functional Requirements
75
+ | # | Requirement | Priority | Notes |
76
+ |---|------------|---------|-------|
77
+
78
+ ## Non-Functional Requirements
79
+ | # | Requirement | Metric |
80
+ |---|------------|--------|
81
+ | NFR-1 | Performance: page load < 2s | p95 |
82
+ | NFR-2 | Availability: 99.9% uptime | |
83
+
84
+ ## Out of Scope
85
+ - [Điều này KHÔNG bao gồm]
86
+
87
+ ## Open Questions
88
+ - [ ] [Câu hỏi cần BA/PM làm rõ]
89
+
90
+ ## Dependencies
91
+ - [Feature/system khác cần có trước]
92
+ ```
93
+
94
+ ## Sau Khi Tạo
95
+
96
+ - Thông báo dev: "Requirements doc sẵn sàng tại [path]"
97
+ - Gợi ý: "TL có thể chạy `/dw:arch-review $ARGUMENTS` để review technical feasibility"
98
+ - Gợi ý: "Dev có thể chạy `/dw:task-init $ARGUMENTS` để bắt đầu implementation"
@@ -1,114 +1,128 @@
1
- ---
2
- name: dw-research
3
- description: "Khảo sát và phân tích codebase trước khi lập kế hoạch. Tìm patterns, dependencies, và ảnh hưởng của thay đổi. Dùng khi cần hiểu code trước khi implement."
4
- argument-hint: "[task-name]"
5
- context: fork
6
- agent: researcher
7
- allowed-tools:
8
- - Read
9
- - Grep
10
- - Glob
11
- - "Bash(git log *)"
12
- - "Bash(git diff *)"
13
- - "Bash(git show *)"
14
- - "Bash(git blame *)"
15
- - "Bash(ls *)"
16
- - "Bash(wc *)"
17
- ---
18
-
19
- # Khảo Sát Codebase
20
-
21
- Task: **$ARGUMENTS**
22
-
23
- ## Đọc Config
24
-
25
- Đọc `.dw/config/dw.config.yml` → lấy `paths.tasks` để biết output location.
26
-
27
- ## Bước 1: Đọc yêu cầu
28
-
29
- - Đọc file `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-plan.md` nếu đã có mô tả yêu cầu
30
- - Hoặc lấy yêu cầu từ conversation context
31
-
32
- ## Bước 2: Khảo sát
33
-
34
- Thực hiện các bước sau (không cần theo thứ tự cứng):
35
-
36
- 1. **Tìm files liên quan**: Dùng Glob + Grep để tìm files theo keywords từ yêu cầu
37
- 2. **Đọc code**: Đọc các files tìm được, hiểu logic hiện tại
38
- 3. **Trace data flow**: Theo dõi luồng dữ liệu từ input → processing → output
39
- 4. **Xác định dependencies**:
40
- - Upstream: modules/APIs code hiện tại gọi đến
41
- - Downstream: modules/APIs gọi đến code hiện tại
42
- 5. **Tìm patterns**: Conventions, design patterns đang dùng trong project
43
- 6. **Kiểm tra tests**: Đã có test coverage cho khu vực liên quan?
44
- 7. **Git history**: Xem lịch sử thay đổi gần đây của files liên quan
45
-
46
- ## Bước 3: Áp dụng duy phản biện
47
-
48
- Từ framework `.claude/skills/dw-thinking/THINKING.md`:
49
- - **Giả định**: Những gì đang giả định là đúng? Cần kiểm chứng?
50
- - **Dependencies**: Module nào bị ảnh hưởng nếu thay đổi?
51
- - **Edge cases**: Trường hợp biên nào cần xem xét?
52
- - **Rủi ro**: Rủi ro kỹ thuật, bảo mật, performance?
53
-
54
- ## Bước 4: Ghi kết quả
55
-
56
- Ghi vào `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-context.md` theo cấu trúc:
57
-
58
- ```markdown
59
- # Context: [Task Name]
60
-
61
- ## Ngày khảo sát: [date]
62
-
63
- ## Yêu Cầu Gốc
64
- [Copy yêu cầu]
65
-
66
- ## Files Liên Quan
67
- | File | Vai trò | Cần thay đổi? | Ghi chú |
68
- |------|---------|----------------|---------|
69
-
70
- ## Kiến Trúc Hiện Tại
71
- [Mô tả luồng, diagram nếu cần]
72
-
73
- ## Dependencies
74
- **Upstream**: ...
75
- **Downstream**: ...
76
-
77
- ## Patterns & Conventions
78
- - [Pattern]: [mô tả]
79
-
80
- ## Giả Định & Hạn Chế
81
- - Giả định: ...
82
- - Hạn chế: ...
83
- - Chưa rõ: ...
84
-
85
- ## Test Coverage Hiện Tại
86
- [Có test không? Coverage ở đâu?]
87
-
88
- ## Ghi Chú
89
- [Bất kỳ thông tin bổ sung]
90
- ```
91
-
92
- ## Bước 5: Tạo Report (optional — standard/thorough depth)
93
-
94
- Nếu task `.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
109
-
110
- Khi hoàn thành, trả về tóm tắt:
111
- - Số files khảo sát
112
- - Key findings (3-5 bullets)
113
- - Risks & unknowns
114
- - Gợi ý: "Tiếp theo chạy `/dw-plan $ARGUMENTS`"
1
+ ---
2
+ name: dw:research
3
+ description: "Khảo sát và phân tích codebase trước khi lập kế hoạch. Tìm patterns, dependencies, và ảnh hưởng của thay đổi. Dùng khi cần hiểu code trước khi implement."
4
+ argument-hint: "[task-name]"
5
+ context: fork
6
+ agent: researcher
7
+ allowed-tools:
8
+ - Read
9
+ - Grep
10
+ - Glob
11
+ - "Bash(git log *)"
12
+ - "Bash(git diff *)"
13
+ - "Bash(git show *)"
14
+ - "Bash(git blame *)"
15
+ - "Bash(ls *)"
16
+ - "Bash(wc *)"
17
+ ---
18
+
19
+ # Khảo Sát Codebase
20
+
21
+ Task: **$ARGUMENTS**
22
+
23
+ ## Đọc Config
24
+
25
+ Đọc `.dw/config/dw.config.yml` → lấy `paths.tasks` để biết output location.
26
+
27
+ ## Detect Task Format (v1 vs v2)
28
+
29
+ Kiểm tra `{paths.tasks}/$ARGUMENTS/`:
30
+ - Nếu `spec.md` + `tracking.md` **v2 format**. Output ghi vào spec.md section "## Research Findings".
31
+ - Nếu có `-context.md`/`-plan.md`/`-progress.md` → **v1 format** (legacy). Output ghi vào `$ARGUMENTS-context.md` như cũ.
32
+ - Nếu chưa có gì → gợi ý user chạy `/dw:task-init $ARGUMENTS` trước.
33
+
34
+ Trong các bước dưới, "context file" = `spec.md` (v2) hoặc `$ARGUMENTS-context.md` (v1).
35
+
36
+ ## Bước 1: Đọc yêu cầu
37
+
38
+ - **v2**: Đọc `{paths.tasks}/$ARGUMENTS/spec.md` lấy Intent + Scope.
39
+ - **v1**: Đọc `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-plan.md` nếu đã có mô tả yêu cầu.
40
+ - Hoặc lấy yêu cầu từ conversation context.
41
+
42
+ ## Bước 2: Khảo sát
43
+
44
+ Thực hiện các bước sau (không cần theo thứ tự cứng):
45
+
46
+ 1. **Tìm files liên quan**: Dùng Glob + Grep để tìm files theo keywords từ yêu cầu
47
+ 2. **Đọc code**: Đọc các files tìm được, hiểu logic hiện tại
48
+ 3. **Trace data flow**: Theo dõi luồng dữ liệu từ input → processing → output
49
+ 4. **Xác định dependencies**:
50
+ - Upstream: modules/APIs code hiện tại gọi đến
51
+ - Downstream: modules/APIs gọi đến code hiện tại
52
+ 5. **Tìm patterns**: Conventions, design patterns đang dùng trong project
53
+ 6. **Kiểm tra tests**: Đã có test coverage cho khu vực liên quan?
54
+ 7. **Git history**: Xem lịch sử thay đổi gần đây của files liên quan
55
+
56
+ ## Bước 3: Áp dụng tư duy phản biện
57
+
58
+ Từ framework `.claude/skills/dw-thinking/THINKING.md`:
59
+ - **Giả định**: Những gì đang giả định là đúng? Cần kiểm chứng?
60
+ - **Dependencies**: Module nào bị ảnh hưởng nếu thay đổi?
61
+ - **Edge cases**: Trường hợp biên nào cần xem xét?
62
+ - **Rủi ro**: Rủi ro kỹ thuật, bảo mật, performance?
63
+
64
+ ## Bước 4: Ghi kết quả
65
+
66
+ **v2 format**: Append (hoặc replace nếu đã có) section `## Research Findings` vào `spec.md`, đặt ngay sau section `## Intent`. Giữ frontmatter và các section khác không đổi.
67
+
68
+ **v1 format** (legacy): Ghi vào `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-context.md`.
69
+
70
+ Cấu trúc nội dung (dùng chung cho cả 2 format):
71
+
72
+ ```markdown
73
+ # Context: [Task Name]
74
+
75
+ ## Ngày khảo sát: [date]
76
+
77
+ ## Yêu Cầu Gốc
78
+ [Copy yêu cầu]
79
+
80
+ ## Files Liên Quan
81
+ | File | Vai trò | Cần thay đổi? | Ghi chú |
82
+ |------|---------|----------------|---------|
83
+
84
+ ## Kiến Trúc Hiện Tại
85
+ [Mô tả luồng, diagram nếu cần]
86
+
87
+ ## Dependencies
88
+ **Upstream**: ...
89
+ **Downstream**: ...
90
+
91
+ ## Patterns & Conventions
92
+ - [Pattern]: [mô tả]
93
+
94
+ ## Giả Định & Hạn Chế
95
+ - Giả định: ...
96
+ - Hạn chế: ...
97
+ - Chưa rõ: ...
98
+
99
+ ## Test Coverage Hiện Tại
100
+ [Có test không? Coverage ở đâu?]
101
+
102
+ ## Ghi Chú
103
+ [Bất kỳ thông tin bổ sung]
104
+ ```
105
+
106
+ ## Bước 5: Tạo Report (optionalstandard/thorough depth)
107
+
108
+ Nếu task `.dw/tasks/$ARGUMENTS/reports/` directory (hoặc depth ≥ standard), tạo report:
109
+
110
+ ```
111
+ .dw/tasks/$ARGUMENTS/reports/[YYMMDD-HHMM]-from-researcher-to-planner-findings.md
112
+ ```
113
+
114
+ Dùng template `.claude/templates/agent-report.md` với:
115
+ - `status: DONE` (hoặc `DONE_WITH_CONCERNS` nếu có risks lớn)
116
+ - Summary: top 3 findings
117
+ - Details: key files, patterns, dependencies
118
+ - Next Steps: những gì planner cần biết
119
+
120
+ > Quick depth tasks: bỏ qua bước này — tracking.md (v2) / progress.md (v1) đã đủ.
121
+
122
+ ## Bước 6: Tóm tắt
123
+
124
+ Khi hoàn thành, trả về tóm tắt:
125
+ - Số files khảo sát
126
+ - Key findings (3-5 bullets)
127
+ - Risks & unknowns
128
+ - Gợi ý: "Tiếp theo chạy `/dw:plan $ARGUMENTS`"