dw-kit 1.0.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 (90) hide show
  1. package/.claude/agents/executor.md +80 -0
  2. package/.claude/agents/planner.md +100 -0
  3. package/.claude/agents/quality-checker.md +86 -0
  4. package/.claude/agents/researcher.md +93 -0
  5. package/.claude/agents/reviewer.md +126 -0
  6. package/.claude/hooks/post-write.sh +62 -0
  7. package/.claude/hooks/pre-commit-gate.sh +90 -0
  8. package/.claude/hooks/progress-ping.sh +47 -0
  9. package/.claude/hooks/safety-guard.sh +54 -0
  10. package/.claude/rules/code-style.md +37 -0
  11. package/.claude/rules/commit-standards.md +37 -0
  12. package/.claude/rules/workflow-rules.md +62 -0
  13. package/.claude/settings.json +71 -0
  14. package/.claude/settings.local.json +12 -0
  15. package/.claude/skills/dw-arch-review/SKILL.md +119 -0
  16. package/.claude/skills/dw-archive/SKILL.md +81 -0
  17. package/.claude/skills/dw-commit/SKILL.md +81 -0
  18. package/.claude/skills/dw-config-init/SKILL.md +91 -0
  19. package/.claude/skills/dw-config-validate/SKILL.md +75 -0
  20. package/.claude/skills/dw-dashboard/SKILL.md +209 -0
  21. package/.claude/skills/dw-debug/SKILL.md +97 -0
  22. package/.claude/skills/dw-docs-update/SKILL.md +125 -0
  23. package/.claude/skills/dw-estimate/SKILL.md +90 -0
  24. package/.claude/skills/dw-execute/SKILL.md +98 -0
  25. package/.claude/skills/dw-flow/SKILL.md +274 -0
  26. package/.claude/skills/dw-handoff/SKILL.md +81 -0
  27. package/.claude/skills/dw-log-work/SKILL.md +69 -0
  28. package/.claude/skills/dw-plan/SKILL.md +125 -0
  29. package/.claude/skills/dw-plan/template-plan.md +47 -0
  30. package/.claude/skills/dw-requirements/SKILL.md +98 -0
  31. package/.claude/skills/dw-research/SKILL.md +98 -0
  32. package/.claude/skills/dw-research/template-research.md +51 -0
  33. package/.claude/skills/dw-review/SKILL.md +66 -0
  34. package/.claude/skills/dw-review/checklist.md +88 -0
  35. package/.claude/skills/dw-rollback/SKILL.md +90 -0
  36. package/.claude/skills/dw-sprint-review/SKILL.md +99 -0
  37. package/.claude/skills/dw-task-init/SKILL.md +59 -0
  38. package/.claude/skills/dw-test-plan/SKILL.md +113 -0
  39. package/.claude/skills/dw-thinking/SKILL.md +70 -0
  40. package/.claude/skills/dw-thinking/THINKING.md +91 -0
  41. package/.claude/skills/dw-upgrade/SKILL.md +82 -0
  42. package/.claude/templates/en/task-context.md +73 -0
  43. package/.claude/templates/en/task-plan.md +79 -0
  44. package/.claude/templates/en/task-progress.md +65 -0
  45. package/.claude/templates/pr-template.md +56 -0
  46. package/.claude/templates/task-context.md +73 -0
  47. package/.claude/templates/task-plan.md +79 -0
  48. package/.claude/templates/task-progress.md +65 -0
  49. package/.dw/adapters/claude-cli/extensions/.gitkeep +0 -0
  50. package/.dw/adapters/claude-cli/extensions/README.md +36 -0
  51. package/.dw/adapters/claude-cli/generated/README.md +23 -0
  52. package/.dw/adapters/claude-cli/generated/agents/.gitkeep +0 -0
  53. package/.dw/adapters/claude-cli/generated/skills/.gitkeep +0 -0
  54. package/.dw/adapters/claude-cli/overrides/README.md +35 -0
  55. package/.dw/adapters/claude-cli/overrides/agents/.gitkeep +0 -0
  56. package/.dw/adapters/claude-cli/overrides/skills/.gitkeep +0 -0
  57. package/.dw/adapters/generic/AGENT.md +169 -0
  58. package/.dw/adapters/generic/README.md +21 -0
  59. package/.dw/config/config.schema.json +121 -0
  60. package/.dw/config/dw.config.yml +82 -0
  61. package/.dw/config/presets/enterprise.yml +52 -0
  62. package/.dw/config/presets/small-team.yml +39 -0
  63. package/.dw/config/presets/solo-quick.yml +37 -0
  64. package/.dw/core/QUALITY.md +220 -0
  65. package/.dw/core/ROLES.md +257 -0
  66. package/.dw/core/THINKING.md +126 -0
  67. package/.dw/core/WORKFLOW.md +450 -0
  68. package/.dw/core/templates/vi/task-context.md +92 -0
  69. package/.dw/core/templates/vi/task-plan.md +93 -0
  70. package/.dw/core/templates/vi/task-progress.md +56 -0
  71. package/CLAUDE.md +98 -0
  72. package/LICENSE +21 -0
  73. package/README.md +183 -0
  74. package/bin/dw.mjs +28 -0
  75. package/package.json +52 -0
  76. package/scripts/e2e-local-check.sh +76 -0
  77. package/scripts/migrate-v03-to-v1.sh +243 -0
  78. package/scripts/upgrade.sh +246 -0
  79. package/setup.sh +382 -0
  80. package/src/cli.mjs +68 -0
  81. package/src/commands/doctor.mjs +149 -0
  82. package/src/commands/init.mjs +332 -0
  83. package/src/commands/migrate.mjs +215 -0
  84. package/src/commands/upgrade.mjs +262 -0
  85. package/src/commands/validate.mjs +102 -0
  86. package/src/lib/config.mjs +75 -0
  87. package/src/lib/copy.mjs +110 -0
  88. package/src/lib/platform.mjs +39 -0
  89. package/src/lib/ui.mjs +66 -0
  90. package/src/smoke-test.mjs +315 -0
@@ -0,0 +1,54 @@
1
+ #!/bin/bash
2
+ # .claude/hooks/safety-guard.sh
3
+ # Intercept destructive Bash commands trước khi execute.
4
+ # exit 0 = allow, exit 2 = block
5
+ #
6
+ # Được gọi bởi PreToolUse hook cho tất cả Bash commands.
7
+
8
+ INPUT=$(cat)
9
+
10
+ COMMAND=$(echo "$INPUT" | grep -o '"command"[[:space:]]*:[[:space:]]*"[^"]*"' \
11
+ | sed 's/"command"[[:space:]]*:[[:space:]]*"//;s/"$//' | head -1)
12
+
13
+ [ -z "$COMMAND" ] && exit 0
14
+
15
+ # ── Pattern 1: rm -rf với path quá rộng ──────────────────────────────────────
16
+ # Block: rm -rf / | rm -rf * | rm -rf . (nguy hiểm)
17
+ # Allow: rm -rf ./specific/path | rm -rf /tmp/specific-file
18
+ if echo "$COMMAND" | grep -qE 'rm\s+-rf?\s+(\/\s*$|\*|\.(\s|$))'; then
19
+ echo "🚨 BLOCKED: rm -rf với path nguy hiểm ($COMMAND)" >&2
20
+ echo " Chỉ định path cụ thể hơn để proceed." >&2
21
+ exit 2
22
+ fi
23
+
24
+ # ── Pattern 2: git push --force lên main/master ───────────────────────────────
25
+ if echo "$COMMAND" | grep -qE 'git\s+push\s+.*--force'; then
26
+ BRANCH=$(echo "$COMMAND" | grep -oE '(main|master|develop|dev)' | head -1)
27
+ if [ -n "$BRANCH" ]; then
28
+ echo "🚨 BLOCKED: git push --force lên $BRANCH" >&2
29
+ echo " Force push lên protected branch không được phép." >&2
30
+ exit 2
31
+ fi
32
+ # Force push lên non-protected branch: warn nhưng allow
33
+ echo "⚠ Warning: git push --force (non-protected branch)" >&2
34
+ echo " Proceed nếu intentional." >&2
35
+ exit 0
36
+ fi
37
+
38
+ # ── Pattern 3: Destructive SQL không có WHERE ─────────────────────────────────
39
+ if echo "$COMMAND" | grep -qiE '(DELETE\s+FROM|UPDATE\s+\w+\s+SET)' \
40
+ && ! echo "$COMMAND" | grep -qi 'WHERE'; then
41
+ echo "🚨 BLOCKED: Destructive SQL không có WHERE clause" >&2
42
+ echo " Thêm WHERE clause hoặc confirm intentional." >&2
43
+ exit 2
44
+ fi
45
+
46
+ # ── Pattern 4: DROP TABLE / DROP DATABASE ────────────────────────────────────
47
+ if echo "$COMMAND" | grep -qiE 'DROP\s+(TABLE|DATABASE|SCHEMA)'; then
48
+ echo "⚠ Warning: DROP statement detected ($COMMAND)" >&2
49
+ echo " Đây có phải migration script đã được review không?" >&2
50
+ # Warn but allow — user có thể đang chạy migration
51
+ exit 0
52
+ fi
53
+
54
+ exit 0
@@ -0,0 +1,37 @@
1
+ # Code Style & Conventions
2
+
3
+ ## Nguyên tắc chung
4
+ - Đặt tên biến/hàm rõ ràng, tự giải thích (self-documenting)
5
+ - Ưu tiên đơn giản, dễ đọc hơn clever code
6
+ - Mỗi function làm MỘT việc
7
+ - Comments giải thích WHY, không phải WHAT
8
+ - Xử lý errors ở đầu function (guard clauses / early return)
9
+
10
+ ## Naming Conventions
11
+ - Variables/Functions: camelCase
12
+ - Classes/Components: PascalCase
13
+ - Constants: UPPER_SNAKE_CASE
14
+ - Files: kebab-case hoặc theo convention của framework
15
+ - Directories: kebab-case
16
+
17
+ ## File Organization
18
+ - 1 component/class per file (trừ khi strongly related)
19
+ - Group imports: external → internal → relative
20
+ - Export ở cuối file hoặc inline (nhất quán trong project)
21
+
22
+ ## Error Handling
23
+ - KHÔNG swallow errors (catch rỗng)
24
+ - Log đủ context để debug (error message, input data, stack)
25
+ - Dùng custom error types cho domain errors
26
+ - Validate input ở boundary (API, form, external data)
27
+
28
+ ## Testing
29
+ - Test file cùng tên với source: `foo.ts` → `foo.test.ts` hoặc `foo.spec.ts`
30
+ - Mỗi test case kiểm tra MỘT behavior
31
+ - Test name mô tả expected behavior: "should return error when input is empty"
32
+ - Arrange → Act → Assert pattern
33
+ - KHÔNG mock internal implementation details
34
+
35
+ ## NOTE
36
+ Đây là quy tắc mặc định. Team tùy chỉnh theo stack cụ thể của dự án.
37
+ Thêm framework-specific rules vào file này hoặc tạo file riêng trong `.claude/rules/`.
@@ -0,0 +1,37 @@
1
+ # Commit Standards
2
+
3
+ ## Format
4
+ ```
5
+ <type>(<scope>): <mô tả tiếng Việt hoặc tiếng Anh>
6
+
7
+ [Body - chi tiết thay đổi, lý do]
8
+ [Blank line]
9
+ [Footer - breaking changes, references]
10
+
11
+ Co-Authored-By: Claude <noreply@anthropic.com>
12
+ ```
13
+
14
+ ## Types
15
+ | Type | Khi nào dùng |
16
+ |------|-------------|
17
+ | `feat` | Tính năng mới |
18
+ | `fix` | Sửa lỗi |
19
+ | `refactor` | Tái cấu trúc, không thay đổi behavior |
20
+ | `test` | Thêm/sửa tests |
21
+ | `docs` | Tài liệu, comments |
22
+ | `chore` | Build, config, dependencies |
23
+ | `style` | Format, whitespace (không thay đổi logic) |
24
+ | `perf` | Cải thiện performance |
25
+
26
+ ## Quy tắc
27
+ - Mỗi commit = 1 subtask hoặc 1 đơn vị logic hoàn chỉnh
28
+ - Mô tả ngắn <= 72 ký tự
29
+ - Dùng thì hiện tại: "thêm", "sửa", "cập nhật" (không phải "đã thêm")
30
+ - KHÔNG commit files chứa secrets (.env, credentials, tokens)
31
+ - KHÔNG commit console.log/debugger còn sót
32
+
33
+ ## Branch Naming
34
+ ```
35
+ <type>/<task-name>
36
+ ```
37
+ Ví dụ: `feat/user-auth`, `fix/login-redirect`, `refactor/api-structure`
@@ -0,0 +1,62 @@
1
+ # Workflow Rules
2
+
3
+ ## Config-Driven Behavior
4
+
5
+ Trước khi thực hiện bất kỳ skill nào, PHẢI đọc `.dw/config/dw.config.yml`:
6
+
7
+ 1. Kiểm tra `flags.<skill_name>` — nếu `false` → KHÔNG chạy, thông báo user
8
+ 2. Kiểm tra `level` — nếu skill yêu cầu level cao hơn → thông báo và hỏi user
9
+ 3. Nếu flag = `"skip"` → cho phép nhưng không enforce
10
+
11
+ ## Level Requirements
12
+
13
+ | Skill | Level 1 | Level 2 | Level 3 |
14
+ |-------|---------|---------|---------|
15
+ | task-init | yes | yes | yes |
16
+ | research | yes | yes | yes |
17
+ | plan | skip | yes | yes |
18
+ | execute | yes | yes | yes |
19
+ | commit | yes | yes | yes |
20
+ | review | no | yes | yes |
21
+ | debug | yes | yes | yes |
22
+ | estimate | no | skip | yes |
23
+ | log-work | no | skip | yes |
24
+ | living-docs | no | no | yes |
25
+ | dashboard | no | no | yes |
26
+ | handoff | skip | yes | yes |
27
+
28
+ ## Flag Behavior
29
+
30
+ - `true` : Skill hoạt động và được enforce trong workflow
31
+ - `false` : Skill bị tắt, skip trong workflow chain
32
+ - `"skip"` : Skill có sẵn nhưng optional, user tự quyết định
33
+
34
+ ## Collaboration Rules
35
+
36
+ ### Khi làm việc cùng Human Dev
37
+ - DỪNG và hỏi trước khi: thay đổi architecture, xóa code, thay đổi API contract
38
+ - Ghi rõ trong progress: quyết định nào do agent, quyết định nào cần human
39
+ - Nếu phát hiện conflict với plan → DỪNG, cập nhật progress, hỏi user
40
+
41
+ ### Khi bàn giao giữa sessions
42
+ - Luôn cập nhật progress file trước khi kết thúc
43
+ - Ghi rõ: đang ở subtask nào, blockers, context quan trọng
44
+ - Commit work-in-progress nếu có thay đổi đáng kể
45
+
46
+ ## Multi-Role Workflow
47
+
48
+ ```
49
+ BA: /dw-requirements → output: requirements doc
50
+
51
+ TL: /dw-arch-review → output: architecture decision + approve
52
+
53
+ Dev+Agent: /dw-task-init → /dw-research → /dw-plan → [TL approve] → /dw-execute
54
+
55
+ QC: /dw-test-plan → manual/auto testing
56
+
57
+ Dev+Agent: /dw-review → /dw-commit → PR
58
+
59
+ PM: /dw-dashboard → project health view
60
+ ```
61
+
62
+ Không phải mọi task đều cần full chain. Routing complexity quyết định.
@@ -0,0 +1,71 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Read(*)",
5
+ "Grep(*)",
6
+ "Glob(*)",
7
+ "Bash(git log *)",
8
+ "Bash(git diff *)",
9
+ "Bash(git show *)",
10
+ "Bash(git status)",
11
+ "Bash(git blame *)",
12
+ "Bash(git stash list)",
13
+ "Bash(ls *)",
14
+ "Bash(wc *)"
15
+ ]
16
+ },
17
+ "mcpServers": {},
18
+ "hooks": {
19
+ "PreToolUse": [
20
+ {
21
+ "matcher": "Bash",
22
+ "hooks": [
23
+ {
24
+ "type": "command",
25
+ "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/pre-commit-gate.sh\""
26
+ }
27
+ ]
28
+ },
29
+ {
30
+ "matcher": "Bash",
31
+ "hooks": [
32
+ {
33
+ "type": "command",
34
+ "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/safety-guard.sh\""
35
+ }
36
+ ]
37
+ }
38
+ ],
39
+ "PostToolUse": [
40
+ {
41
+ "matcher": "Write|Edit",
42
+ "hooks": [
43
+ {
44
+ "type": "command",
45
+ "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/post-write.sh\""
46
+ }
47
+ ]
48
+ }
49
+ ],
50
+ "Stop": [
51
+ {
52
+ "hooks": [
53
+ {
54
+ "type": "prompt",
55
+ "prompt": "Trước khi kết thúc, kiểm tra: (1) Có uncommitted changes quan trọng không? (2) Task đang làm dở chưa cập nhật progress? (3) Có blocker nào chưa ghi lại? Nếu có vấn đề, trả về {\"decision\": \"block\", \"reason\": \"[mô tả]\"}. Nếu OK, trả về {\"decision\": \"allow\"}."
56
+ }
57
+ ]
58
+ }
59
+ ],
60
+ "Notification": [
61
+ {
62
+ "hooks": [
63
+ {
64
+ "type": "command",
65
+ "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/progress-ping.sh\""
66
+ }
67
+ ]
68
+ }
69
+ ]
70
+ }
71
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "WebFetch(domain:alexop.dev)",
5
+ "WebFetch(domain:github.com)",
6
+ "WebFetch(domain:docs.anthropic.com)",
7
+ "Bash(grep -rL \"^name:\" .claude/skills/dw-*/SKILL.md)",
8
+ "Bash(grep -c '\\\\$ARGUMENTS\\\\|context: fork\\\\|allowed-tools' .dw/adapters/generic/AGENT.md)",
9
+ "Bash(grep [v1.0.0] CHANGELOG.md)"
10
+ ]
11
+ }
12
+ }
@@ -0,0 +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ì)
@@ -0,0 +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
+ ```
@@ -0,0 +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
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: dw-config-init
3
+ description: "Khởi tạo dv-workflow-kit cho dự án mới. Tạo config file, thư mục, và cấu trúc cần thiết."
4
+ argument-hint: "[project-name]"
5
+ ---
6
+
7
+ # Khởi Tạo dv-workflow-kit
8
+
9
+ Thiết lập toolkit cho dự án: **$ARGUMENTS**
10
+
11
+ ## Quy Trình
12
+
13
+ ### 1. Hỏi thông tin cơ bản
14
+
15
+ Nếu chưa có đủ thông tin, hỏi user:
16
+ - **Project type**: `new-product` hay `old-maintenance`?
17
+ - **Level**: 1 (lite), 2 (standard), hay 3 (full)?
18
+ - **Team roles**: Những role nào tham gia? (dev, techlead, ba, qc, pm)
19
+
20
+ ### 2. Tạo config file
21
+
22
+ Copy `.dw/config/dw.config.yml` vào root dự án.
23
+ Cập nhật các giá trị:
24
+ - `project.name` = tên dự án
25
+ - `project.type` = loại dự án
26
+ - `level` = level đã chọn
27
+
28
+ Nếu **new-product**:
29
+ ```yaml
30
+ level: 2
31
+ flags:
32
+ research: true
33
+ plan: true
34
+ execute: true
35
+ commit: true
36
+ review: true
37
+ living_docs: false # Bật lên level 3
38
+ estimation: true
39
+ log_work: true
40
+ ```
41
+
42
+ Nếu **old-maintenance**:
43
+ ```yaml
44
+ level: 1
45
+ flags:
46
+ research: true
47
+ plan: "skip" # Optional cho bug fixes
48
+ execute: true
49
+ commit: true
50
+ review: "skip"
51
+ debug: true
52
+ estimation: "skip"
53
+ log_work: "skip"
54
+ ```
55
+
56
+ ### 3. Tạo thư mục
57
+
58
+ ```bash
59
+ mkdir -p .dw/tasks .dw/docs .dw/metrics .dw/reports
60
+ ```
61
+
62
+ ### 4. Auto-enable role flags
63
+
64
+ Nếu team có `ba` → bật `requirements_skill: true`
65
+ Nếu team có `qc` → bật `test_plan_skill: true`
66
+ Nếu team có `techlead` → bật `arch_review_skill: true`
67
+ Nếu team có `pm` → bật `dashboard_skill: true`
68
+
69
+ ### 5. Validate config
70
+
71
+ Sau khi tạo hoặc khi user gọi `/dw-config-init` trên config đã có, kiểm tra:
72
+
73
+ **Known keys** (nếu có key nào ngoài danh sách → warn typo):
74
+ - Top-level: `project`, `level`, `team`, `flags`, `routing`, `estimation`, `metrics`, `paths`
75
+ - `flags` keys: `research`, `plan`, `execute`, `commit`, `review`, `debug`, `living_docs`, `docs_update_on_commit`, `estimation`, `log_work`, `metrics_tracking`, `dora_metrics`, `pre_commit_tests`, `pre_commit_lint`, `block_commit_on_fail`, `handoff`, `thinking_framework`, `requirements_skill`, `test_plan_skill`, `arch_review_skill`, `dashboard_skill`
76
+
77
+ **Level check**:
78
+ - Nếu `level: 3` → hiển thị warning: "Level 3 đang ở trạng thái beta — một số features (living docs automation, DORA calculation, dashboard HTML export) chưa fully automated."
79
+
80
+ **Flag value check**:
81
+ - Mỗi flag phải là `true`, `false`, hoặc `"skip"` — nếu giá trị khác → warn
82
+
83
+ Hiển thị kết quả validation trước khi thông báo hoàn tất.
84
+
85
+ ### 6. Thông báo kết quả
86
+
87
+ Hiển thị:
88
+ - Config đã tạo với settings gì
89
+ - Danh sách skills có sẵn (dựa trên flags)
90
+ - Hướng dẫn bước tiếp theo
91
+ - Gợi ý: "Chạy `/dw-task-init [tên-task]` để bắt đầu task đầu tiên"