dw-kit 1.2.0 → 1.3.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.
Files changed (63) 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 +91 -74
  8. package/.claude/hooks/stop-check.sh +88 -36
  9. package/.claude/hooks/telemetry-log.sh +34 -0
  10. package/.claude/rules/code-style.md +37 -37
  11. package/.claude/rules/commit-standards.md +37 -37
  12. package/.claude/rules/dw.md +136 -0
  13. package/.claude/settings.json +120 -99
  14. package/.claude/skills/dw-arch-review/SKILL.md +119 -119
  15. package/.claude/skills/dw-archive/SKILL.md +81 -81
  16. package/.claude/skills/dw-commit/SKILL.md +81 -81
  17. package/.claude/skills/dw-config-init/SKILL.md +91 -91
  18. package/.claude/skills/dw-config-validate/SKILL.md +75 -75
  19. package/.claude/skills/dw-dashboard/SKILL.md +209 -209
  20. package/.claude/skills/dw-debug/SKILL.md +97 -97
  21. package/.claude/skills/dw-decision/SKILL.md +116 -0
  22. package/.claude/skills/dw-docs-update/SKILL.md +125 -125
  23. package/.claude/skills/dw-estimate/SKILL.md +90 -90
  24. package/.claude/skills/dw-execute/SKILL.md +98 -98
  25. package/.claude/skills/dw-flow/SKILL.md +274 -274
  26. package/.claude/skills/dw-handoff/SKILL.md +81 -81
  27. package/.claude/skills/dw-kit-report/SKILL.md +152 -152
  28. package/.claude/skills/dw-log-work/SKILL.md +69 -69
  29. package/.claude/skills/dw-onboard/SKILL.md +201 -201
  30. package/.claude/skills/dw-plan/SKILL.md +125 -125
  31. package/.claude/skills/dw-prompt/SKILL.md +62 -62
  32. package/.claude/skills/dw-requirements/SKILL.md +98 -98
  33. package/.claude/skills/dw-research/SKILL.md +114 -114
  34. package/.claude/skills/dw-retroactive/SKILL.md +311 -311
  35. package/.claude/skills/dw-review/SKILL.md +66 -66
  36. package/.claude/skills/dw-rollback/SKILL.md +90 -90
  37. package/.claude/skills/dw-sprint-review/SKILL.md +99 -99
  38. package/.claude/skills/dw-task-init/SKILL.md +59 -59
  39. package/.claude/skills/dw-test-plan/SKILL.md +113 -113
  40. package/.claude/skills/dw-thinking/SKILL.md +70 -70
  41. package/.claude/skills/dw-upgrade/SKILL.md +72 -72
  42. package/.dw/config/dw.config.yml +82 -82
  43. package/.dw/core/PILLARS.md +122 -0
  44. package/.dw/core/templates/v2/spec.md +68 -0
  45. package/.dw/core/templates/v2/tracking.md +62 -0
  46. package/.dw/core/v14-evaluation-protocol.md +118 -0
  47. package/CLAUDE.md +42 -39
  48. package/MIGRATION-v1.3.md +201 -0
  49. package/README.md +43 -6
  50. package/package.json +86 -84
  51. package/src/cli.mjs +45 -9
  52. package/src/commands/dashboard.mjs +116 -0
  53. package/src/commands/doctor.mjs +165 -149
  54. package/src/commands/init.mjs +339 -332
  55. package/src/commands/metrics.mjs +165 -0
  56. package/src/commands/upgrade.mjs +297 -262
  57. package/src/lib/active-index.mjs +87 -0
  58. package/src/lib/copy.mjs +118 -110
  59. package/src/lib/cut-analysis.mjs +161 -0
  60. package/src/lib/telemetry.mjs +80 -0
  61. package/.claude/rules/dw-core.md +0 -100
  62. package/.claude/rules/dw-skills.md +0 -53
  63. package/.claude/rules/workflow-rules.md +0 -77
@@ -1,119 +1,119 @@
1
- ---
2
- name: dw-arch-review
3
- description: "TL skill: Review kiến trúc và technical feasibility của plan. Approve hoặc request changes trước khi dev execute."
4
- argument-hint: "[task-name]"
5
- context: fork
6
- agent: planner
7
- allowed-tools:
8
- - Read
9
- - Grep
10
- - Glob
11
- - "Bash(git log *)"
12
- - "Bash(git diff *)"
13
- ---
14
-
15
- # Architecture Review
16
-
17
- Task: **$ARGUMENTS**
18
-
19
- ## Đọc Config
20
-
21
- Đọc `.dw/config/dw.config.yml` → `paths.tasks`, `workflow.default_depth`.
22
- Skill này dành cho depth: `thorough` (TL role). Với `standard`, tùy TL quyết định.
23
-
24
- ## Role: Tech Lead
25
-
26
- Bạn đang thực hiện với vai trò **Tech Lead**. Đây là checkpoint quan trọng trước khi team bắt đầu implement.
27
-
28
- ## Đọc Tài Liệu
29
-
30
- 1. Đọc requirements (nếu có): `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-requirements.md`
31
- 2. Đọc plan: `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-plan.md`
32
- 3. Đọc context: `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-context.md`
33
- 4. Đọc living docs (nếu có): `.dw/docs/ARCHITECTURE.md`, `.dw/docs/DECISIONS.md`
34
-
35
- ## Review Checklist
36
-
37
- ### Technical Feasibility
38
- - [ ] Approach có khả thi trong codebase hiện tại không?
39
- - [ ] Có tech debt nào block implementation không?
40
- - [ ] Dependencies ngoài (libs, services) có sẵn sàng không?
41
-
42
- ### Architecture Alignment
43
- - [ ] Giải pháp có phù hợp với kiến trúc hiện tại không?
44
- - [ ] Có vi phạm principles (SOLID, DRY, separation of concerns) không?
45
- - [ ] API design có nhất quán với patterns hiện tại không?
46
-
47
- ### Scale & Performance
48
- - [ ] Có performance implications không?
49
- - [ ] Query patterns có tối ưu không (N+1, missing index)?
50
- - [ ] Caching strategy phù hợp?
51
-
52
- ### Security
53
- - [ ] Authentication & authorization đúng không?
54
- - [ ] Input validation đầy đủ chưa?
55
- - [ ] Sensitive data được handle đúng không?
56
-
57
- ### Testing
58
- - [ ] Plan có unit test strategy không?
59
- - [ ] Integration test coverage đủ không?
60
- - [ ] Có cần E2E tests không?
61
-
62
- ### Maintainability
63
- - [ ] Code sẽ dễ maintain không?
64
- - [ ] Có tạo tech debt không cần thiết không?
65
- - [ ] Documentation plan đủ không?
66
-
67
- ### Subtask Breakdown
68
- - [ ] Subtasks có đủ nhỏ và độc lập không?
69
- - [ ] Dependency graph hợp lý không?
70
- - [ ] Estimate có realistic không?
71
-
72
- ## Output — Architecture Decision
73
-
74
- ```markdown
75
- # Architecture Review: [Task Name]
76
-
77
- ## Reviewer: TL | Date: [date]
78
-
79
- ## Quyết Định
80
- **✅ APPROVED** / **🔄 APPROVED WITH CHANGES** / **❌ NEEDS REWORK**
81
-
82
- ## Technical Assessment
83
-
84
- ### Strengths
85
- - [Điểm tốt của approach]
86
-
87
- ### Concerns
88
-
89
- #### 🔴 Must Fix (trước khi execute)
90
- - [ ] **[Concern 1]**: [mô tả] → Proposed fix: [gợi ý]
91
-
92
- #### 🟡 Should Fix
93
- - [ ] **[Concern 2]**: [mô tả]
94
-
95
- #### 🔵 Nice to Have
96
- - [ ] **[Suggestion]**: [mô tả]
97
-
98
- ## Architecture Decisions
99
-
100
- ### Decision: [Tiêu đề]
101
- - **Context**: [tại sao cần quyết định]
102
- - **Decision**: [đã chọn gì]
103
- - **Consequences**: [ảnh hưởng]
104
-
105
- ## Điều Chỉnh Plan
106
-
107
- [Nếu có thay đổi cần ghi vào plan]
108
-
109
- ## Next Steps
110
-
111
- [Sau khi dev fix concerns] → có thể bắt đầu `/dw-execute $ARGUMENTS`
112
- ```
113
-
114
- ## Cập Nhật Plan
115
-
116
- Nếu có changes → ghi nhận vào plan file:
117
- - Thêm architectural decisions vào DECISIONS.md
118
- - Cập nhật subtasks nếu cần
119
- - Đổi trạng thái plan: Draft → Approved (hoặc ghi rõ cần rework gì)
1
+ ---
2
+ name: dw:arch-review
3
+ description: "TL skill: Review kiến trúc và technical feasibility của plan. Approve hoặc request changes trước khi dev execute."
4
+ argument-hint: "[task-name]"
5
+ context: fork
6
+ agent: planner
7
+ allowed-tools:
8
+ - Read
9
+ - Grep
10
+ - Glob
11
+ - "Bash(git log *)"
12
+ - "Bash(git diff *)"
13
+ ---
14
+
15
+ # Architecture Review
16
+
17
+ Task: **$ARGUMENTS**
18
+
19
+ ## Đọc Config
20
+
21
+ Đọc `.dw/config/dw.config.yml` → `paths.tasks`, `workflow.default_depth`.
22
+ Skill này dành cho depth: `thorough` (TL role). Với `standard`, tùy TL quyết định.
23
+
24
+ ## Role: Tech Lead
25
+
26
+ Bạn đang thực hiện với vai trò **Tech Lead**. Đây là checkpoint quan trọng trước khi team bắt đầu implement.
27
+
28
+ ## Đọc Tài Liệu
29
+
30
+ 1. Đọc requirements (nếu có): `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-requirements.md`
31
+ 2. Đọc plan: `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-plan.md`
32
+ 3. Đọc context: `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-context.md`
33
+ 4. Đọc living docs (nếu có): `.dw/docs/ARCHITECTURE.md`, `.dw/docs/DECISIONS.md`
34
+
35
+ ## Review Checklist
36
+
37
+ ### Technical Feasibility
38
+ - [ ] Approach có khả thi trong codebase hiện tại không?
39
+ - [ ] Có tech debt nào block implementation không?
40
+ - [ ] Dependencies ngoài (libs, services) có sẵn sàng không?
41
+
42
+ ### Architecture Alignment
43
+ - [ ] Giải pháp có phù hợp với kiến trúc hiện tại không?
44
+ - [ ] Có vi phạm principles (SOLID, DRY, separation of concerns) không?
45
+ - [ ] API design có nhất quán với patterns hiện tại không?
46
+
47
+ ### Scale & Performance
48
+ - [ ] Có performance implications không?
49
+ - [ ] Query patterns có tối ưu không (N+1, missing index)?
50
+ - [ ] Caching strategy phù hợp?
51
+
52
+ ### Security
53
+ - [ ] Authentication & authorization đúng không?
54
+ - [ ] Input validation đầy đủ chưa?
55
+ - [ ] Sensitive data được handle đúng không?
56
+
57
+ ### Testing
58
+ - [ ] Plan có unit test strategy không?
59
+ - [ ] Integration test coverage đủ không?
60
+ - [ ] Có cần E2E tests không?
61
+
62
+ ### Maintainability
63
+ - [ ] Code sẽ dễ maintain không?
64
+ - [ ] Có tạo tech debt không cần thiết không?
65
+ - [ ] Documentation plan đủ không?
66
+
67
+ ### Subtask Breakdown
68
+ - [ ] Subtasks có đủ nhỏ và độc lập không?
69
+ - [ ] Dependency graph hợp lý không?
70
+ - [ ] Estimate có realistic không?
71
+
72
+ ## Output — Architecture Decision
73
+
74
+ ```markdown
75
+ # Architecture Review: [Task Name]
76
+
77
+ ## Reviewer: TL | Date: [date]
78
+
79
+ ## Quyết Định
80
+ **✅ APPROVED** / **🔄 APPROVED WITH CHANGES** / **❌ NEEDS REWORK**
81
+
82
+ ## Technical Assessment
83
+
84
+ ### Strengths
85
+ - [Điểm tốt của approach]
86
+
87
+ ### Concerns
88
+
89
+ #### 🔴 Must Fix (trước khi execute)
90
+ - [ ] **[Concern 1]**: [mô tả] → Proposed fix: [gợi ý]
91
+
92
+ #### 🟡 Should Fix
93
+ - [ ] **[Concern 2]**: [mô tả]
94
+
95
+ #### 🔵 Nice to Have
96
+ - [ ] **[Suggestion]**: [mô tả]
97
+
98
+ ## Architecture Decisions
99
+
100
+ ### Decision: [Tiêu đề]
101
+ - **Context**: [tại sao cần quyết định]
102
+ - **Decision**: [đã chọn gì]
103
+ - **Consequences**: [ảnh hưởng]
104
+
105
+ ## Điều Chỉnh Plan
106
+
107
+ [Nếu có thay đổi cần ghi vào plan]
108
+
109
+ ## Next Steps
110
+
111
+ [Sau khi dev fix concerns] → có thể bắt đầu `/dw:execute $ARGUMENTS`
112
+ ```
113
+
114
+ ## Cập Nhật Plan
115
+
116
+ Nếu có changes → ghi nhận vào plan file:
117
+ - Thêm architectural decisions vào DECISIONS.md
118
+ - Cập nhật subtasks nếu cần
119
+ - Đổi trạng thái plan: Draft → Approved (hoặc ghi rõ cần rework gì)
@@ -1,81 +1,81 @@
1
- ---
2
- name: dw-archive
3
- description: "Move task docs đã hoàn thành vào archive. Giữ .dw/tasks/ gọn gàng. Dùng sau khi task Done và đã merge PR."
4
- argument-hint: "[task-name | --all-done | --older-than-days N]"
5
- ---
6
-
7
- # Archive Tasks: $ARGUMENTS
8
-
9
- ## Parse Arguments
10
-
11
- - `[task-name]` — archive 1 task cụ thể
12
- - `--all-done` — archive tất cả tasks có status Done
13
- - `--older-than-days N` — archive tasks Done đã N ngày
14
-
15
- ## Bước 1: Đọc config
16
-
17
- `paths.tasks` → thư mục tasks.
18
- Archive destination: `{paths.tasks}/archive/`
19
-
20
- ## Bước 2: Tìm tasks cần archive
21
-
22
- ### Nếu `[task-name]`:
23
- Đọc `{paths.tasks}/[task-name]/[task-name]-progress.md` → kiểm tra status.
24
- Nếu status không phải Done → warn: "Task chưa Done. Archive anyway? (y/n)"
25
-
26
- ### Nếu `--all-done`:
27
- ```bash
28
- grep -r "^## Trạng thái: Done" {paths.tasks}/*/ # hoặc "Status: Done" (en)
29
- ```
30
- Liệt kê tất cả tasks Done.
31
-
32
- ### Nếu `--older-than-days N`:
33
- Kết hợp: tasks Done VÀ completion date > N ngày trước.
34
-
35
- ## Bước 3: Preview và confirm
36
-
37
- ```
38
- Tasks sẽ được archive:
39
-
40
- [task-name-1] — Done — [completion date]
41
- [task-name-2] — Done — [completion date]
42
-
43
- Destination: {paths.tasks}/archive/
44
-
45
- Tiếp tục? (y/n)
46
- ```
47
-
48
- ## Bước 4: Archive
49
-
50
- ```bash
51
- mkdir -p {paths.tasks}/archive/[YYYY-MM]/
52
- mv {paths.tasks}/[task-name] {paths.tasks}/archive/[YYYY-MM]/
53
- ```
54
-
55
- Tổ chức theo tháng hoàn thành để dễ tìm kiếm sau.
56
-
57
- ## Bước 5: Cập nhật archive index
58
-
59
- Ghi/cập nhật `{paths.tasks}/archive/README.md`:
60
-
61
- ```markdown
62
- # Task Archive
63
-
64
- | Task | Completion Date | Month | Summary |
65
- |------|----------------|-------|---------|
66
- | [task-name] | [date] | [YYYY-MM] | [1-line summary từ progress.md] |
67
- ```
68
-
69
- ## Bước 6: Thông báo
70
-
71
- ```
72
- Archive hoàn tất.
73
-
74
- Đã archive X task(s):
75
- ✓ [task-name-1] → archive/[YYYY-MM]/
76
- ✓ [task-name-2] → archive/[YYYY-MM]/
77
-
78
- Index cập nhật: {paths.tasks}/archive/README.md
79
-
80
- .dw/tasks/ hiện còn: [N] active tasks
81
- ```
1
+ ---
2
+ name: dw:archive
3
+ description: "Move task docs đã hoàn thành vào archive. Giữ .dw/tasks/ gọn gàng. Dùng sau khi task Done và đã merge PR."
4
+ argument-hint: "[task-name | --all-done | --older-than-days N]"
5
+ ---
6
+
7
+ # Archive Tasks: $ARGUMENTS
8
+
9
+ ## Parse Arguments
10
+
11
+ - `[task-name]` — archive 1 task cụ thể
12
+ - `--all-done` — archive tất cả tasks có status Done
13
+ - `--older-than-days N` — archive tasks Done đã N ngày
14
+
15
+ ## Bước 1: Đọc config
16
+
17
+ `paths.tasks` → thư mục tasks.
18
+ Archive destination: `{paths.tasks}/archive/`
19
+
20
+ ## Bước 2: Tìm tasks cần archive
21
+
22
+ ### Nếu `[task-name]`:
23
+ Đọc `{paths.tasks}/[task-name]/[task-name]-progress.md` → kiểm tra status.
24
+ Nếu status không phải Done → warn: "Task chưa Done. Archive anyway? (y/n)"
25
+
26
+ ### Nếu `--all-done`:
27
+ ```bash
28
+ grep -r "^## Trạng thái: Done" {paths.tasks}/*/ # hoặc "Status: Done" (en)
29
+ ```
30
+ Liệt kê tất cả tasks Done.
31
+
32
+ ### Nếu `--older-than-days N`:
33
+ Kết hợp: tasks Done VÀ completion date > N ngày trước.
34
+
35
+ ## Bước 3: Preview và confirm
36
+
37
+ ```
38
+ Tasks sẽ được archive:
39
+
40
+ [task-name-1] — Done — [completion date]
41
+ [task-name-2] — Done — [completion date]
42
+
43
+ Destination: {paths.tasks}/archive/
44
+
45
+ Tiếp tục? (y/n)
46
+ ```
47
+
48
+ ## Bước 4: Archive
49
+
50
+ ```bash
51
+ mkdir -p {paths.tasks}/archive/[YYYY-MM]/
52
+ mv {paths.tasks}/[task-name] {paths.tasks}/archive/[YYYY-MM]/
53
+ ```
54
+
55
+ Tổ chức theo tháng hoàn thành để dễ tìm kiếm sau.
56
+
57
+ ## Bước 5: Cập nhật archive index
58
+
59
+ Ghi/cập nhật `{paths.tasks}/archive/README.md`:
60
+
61
+ ```markdown
62
+ # Task Archive
63
+
64
+ | Task | Completion Date | Month | Summary |
65
+ |------|----------------|-------|---------|
66
+ | [task-name] | [date] | [YYYY-MM] | [1-line summary từ progress.md] |
67
+ ```
68
+
69
+ ## Bước 6: Thông báo
70
+
71
+ ```
72
+ Archive hoàn tất.
73
+
74
+ Đã archive X task(s):
75
+ ✓ [task-name-1] → archive/[YYYY-MM]/
76
+ ✓ [task-name-2] → archive/[YYYY-MM]/
77
+
78
+ Index cập nhật: {paths.tasks}/archive/README.md
79
+
80
+ .dw/tasks/ hiện còn: [N] active tasks
81
+ ```
@@ -1,81 +1,81 @@
1
- ---
2
- name: dw-commit
3
- description: "Tạo commit thông minh với quality checks tùy theo config. Chạy tests/lint trước commit nếu flags bật."
4
- argument-hint: "[commit message]"
5
- ---
6
-
7
- # Smart Commit
8
-
9
- Message: **$ARGUMENTS**
10
-
11
- ## Đọc Config
12
-
13
- Đọc `.dw/config/dw.config.yml` → lấy:
14
- - `quality.test_command` → lệnh chạy tests (bỏ qua nếu rỗng)
15
- - `quality.lint_command` → lệnh chạy linter (bỏ qua nếu rỗng)
16
- - `quality.block_on_fail` → block commit nếu fail
17
- - `workflow.default_depth` → `thorough` = gợi ý `/dw-docs-update` sau commit
18
- - `tracking.log_work` → ghi metrics effort
19
-
20
- ## Quy Trình
21
-
22
- ### 1. Kiểm tra trạng thái
23
- ```bash
24
- git status
25
- git diff --staged --stat
26
- ```
27
- Nếu không có changes → thông báo "Không có gì để commit."
28
-
29
- ### 2. Quality Checks
30
-
31
- **Nếu `quality.test_command` không rỗng:**
32
- - Chạy: `quality.test_command` (hoặc tests liên quan đến files changed)
33
- - Nếu FAIL:
34
- - `quality.block_on_fail = true` → **DỪNG**, báo lỗi, yêu cầu fix
35
- - `quality.block_on_fail = false` → cảnh báo, hỏi user có muốn tiếp tục
36
-
37
- **Nếu `quality.lint_command` không rỗng:**
38
- - Chạy: `quality.lint_command`
39
- - Xử lý tương tự tests
40
-
41
- ### 3. Kiểm tra sensitive files
42
- - Scan staged files cho: `.env`, passwords, tokens, API keys
43
- - Nếu phát hiện → **CẢNH BÁO** và hỏi user
44
-
45
- ### 4. Kiểm tra leftover debug code
46
- - Grep staged files cho: `console.log`, `debugger`, `TODO:`, `FIXME:`
47
- - Nếu có → cảnh báo (không block)
48
-
49
- ### 5. Tạo commit message
50
-
51
- Nếu có `$ARGUMENTS` → dùng làm mô tả:
52
- ```
53
- <auto-detect-type>(<auto-detect-scope>): $ARGUMENTS
54
-
55
- Co-Authored-By: Claude <noreply@anthropic.com>
56
- ```
57
-
58
- Nếu KHÔNG có `$ARGUMENTS` → phân tích diff và tạo message tự động:
59
- - Detect type từ loại thay đổi (feat/fix/refactor/test/docs/chore)
60
- - Detect scope từ files/directories changed
61
- - Viết mô tả ngắn gọn
62
-
63
- ### 6. Thực hiện commit
64
- ```bash
65
- git add [relevant files]
66
- git commit -m "<message>"
67
- ```
68
-
69
- ### 7. Post-commit
70
-
71
- **Nếu `workflow.default_depth = thorough`:**
72
- - Thông báo: "Living docs cần cập nhật. Chạy `/dw-docs-update`?"
73
-
74
- **Nếu `tracking.log_work = true`:**
75
- - Ghi commit vào `.dw/metrics/`: timestamp, type, scope, files changed
76
-
77
- ### 8. Hiển thị kết quả
78
- - Commit hash
79
- - Files committed
80
- - Quality check results (nếu có)
81
- - Next steps
1
+ ---
2
+ name: dw:commit
3
+ description: "Tạo commit thông minh với quality checks tùy theo config. Chạy tests/lint trước commit nếu flags bật."
4
+ argument-hint: "[commit message]"
5
+ ---
6
+
7
+ # Smart Commit
8
+
9
+ Message: **$ARGUMENTS**
10
+
11
+ ## Đọc Config
12
+
13
+ Đọc `.dw/config/dw.config.yml` → lấy:
14
+ - `quality.test_command` → lệnh chạy tests (bỏ qua nếu rỗng)
15
+ - `quality.lint_command` → lệnh chạy linter (bỏ qua nếu rỗng)
16
+ - `quality.block_on_fail` → block commit nếu fail
17
+ - `workflow.default_depth` → `thorough` = gợi ý `/dw:docs-update` sau commit
18
+ - `tracking.log_work` → ghi metrics effort
19
+
20
+ ## Quy Trình
21
+
22
+ ### 1. Kiểm tra trạng thái
23
+ ```bash
24
+ git status
25
+ git diff --staged --stat
26
+ ```
27
+ Nếu không có changes → thông báo "Không có gì để commit."
28
+
29
+ ### 2. Quality Checks
30
+
31
+ **Nếu `quality.test_command` không rỗng:**
32
+ - Chạy: `quality.test_command` (hoặc tests liên quan đến files changed)
33
+ - Nếu FAIL:
34
+ - `quality.block_on_fail = true` → **DỪNG**, báo lỗi, yêu cầu fix
35
+ - `quality.block_on_fail = false` → cảnh báo, hỏi user có muốn tiếp tục
36
+
37
+ **Nếu `quality.lint_command` không rỗng:**
38
+ - Chạy: `quality.lint_command`
39
+ - Xử lý tương tự tests
40
+
41
+ ### 3. Kiểm tra sensitive files
42
+ - Scan staged files cho: `.env`, passwords, tokens, API keys
43
+ - Nếu phát hiện → **CẢNH BÁO** và hỏi user
44
+
45
+ ### 4. Kiểm tra leftover debug code
46
+ - Grep staged files cho: `console.log`, `debugger`, `TODO:`, `FIXME:`
47
+ - Nếu có → cảnh báo (không block)
48
+
49
+ ### 5. Tạo commit message
50
+
51
+ Nếu có `$ARGUMENTS` → dùng làm mô tả:
52
+ ```
53
+ <auto-detect-type>(<auto-detect-scope>): $ARGUMENTS
54
+
55
+ Co-Authored-By: Claude <noreply@anthropic.com>
56
+ ```
57
+
58
+ Nếu KHÔNG có `$ARGUMENTS` → phân tích diff và tạo message tự động:
59
+ - Detect type từ loại thay đổi (feat/fix/refactor/test/docs/chore)
60
+ - Detect scope từ files/directories changed
61
+ - Viết mô tả ngắn gọn
62
+
63
+ ### 6. Thực hiện commit
64
+ ```bash
65
+ git add [relevant files]
66
+ git commit -m "<message>"
67
+ ```
68
+
69
+ ### 7. Post-commit
70
+
71
+ **Nếu `workflow.default_depth = thorough`:**
72
+ - Thông báo: "Living docs cần cập nhật. Chạy `/dw:docs-update`?"
73
+
74
+ **Nếu `tracking.log_work = true`:**
75
+ - Ghi commit vào `.dw/metrics/`: timestamp, type, scope, files changed
76
+
77
+ ### 8. Hiển thị kết quả
78
+ - Commit hash
79
+ - Files committed
80
+ - Quality check results (nếu có)
81
+ - Next steps