dw-kit 1.4.0 → 1.6.0-rc.1
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/agents/executor.md +80 -80
- package/.claude/hooks/pre-commit-gate.sh +59 -0
- package/.claude/hooks/stop-check.sh +111 -31
- package/.claude/rules/commit-standards.md +48 -37
- package/.claude/rules/dw.md +47 -11
- package/.claude/skills/dw-commit/SKILL.md +7 -4
- package/.claude/skills/dw-decision/SKILL.md +5 -4
- package/.claude/skills/dw-execute/SKILL.md +18 -5
- package/.claude/skills/dw-handoff/SKILL.md +8 -3
- package/.claude/skills/dw-plan/SKILL.md +15 -2
- package/.claude/skills/dw-research/SKILL.md +7 -5
- package/.claude/skills/dw-retroactive/SKILL.md +75 -63
- package/.claude/skills/dw-task-init/SKILL.md +40 -35
- package/.dw/adapters/generic/AGENT.md +171 -169
- package/.dw/core/WORKFLOW.md +450 -450
- package/.dw/core/schemas/agent-claim.schema.json +127 -0
- package/.dw/core/schemas/agent-report.schema.json +72 -0
- package/.dw/core/schemas/task-frontmatter.schema.json +78 -0
- package/.dw/core/templates/v3/task.md +188 -0
- package/CLAUDE.md +2 -2
- package/MIGRATION-v1.5.md +330 -0
- package/README.md +17 -0
- package/package.json +3 -2
- package/src/cli.mjs +161 -0
- package/src/commands/agent-claim.mjs +235 -0
- package/src/commands/agent-inspect.mjs +123 -0
- package/src/commands/doctor.mjs +64 -0
- package/src/commands/lint-task.mjs +112 -0
- package/src/commands/task-migrate.mjs +366 -0
- package/src/commands/task-new.mjs +90 -0
- package/src/commands/task-render.mjs +235 -0
- package/src/commands/task-rotate.mjs +168 -0
- package/src/commands/task-show.mjs +137 -0
- package/src/commands/task-view.mjs +386 -0
- package/src/commands/task-watch.mjs +223 -0
- package/src/lib/active-index.mjs +19 -1
- package/src/lib/agent-claim.mjs +173 -0
- package/src/lib/agent-conflict.mjs +137 -0
- package/src/lib/agent-events.mjs +43 -0
- package/src/lib/agent-report.mjs +96 -0
- package/src/lib/frontmatter.mjs +72 -0
- package/src/lib/lint-rules.mjs +149 -0
- package/src/lib/timeline-parser.mjs +80 -0
|
@@ -18,14 +18,20 @@ Task: **$ARGUMENTS**
|
|
|
18
18
|
- `tracking.log_work` → ghi effort tracking không
|
|
19
19
|
- `workflow.default_depth` → `thorough` = cần docs-update, review bắt buộc
|
|
20
20
|
|
|
21
|
-
## Detect Task Format (
|
|
21
|
+
## Detect Task Format (v3 / v2 / v1)
|
|
22
22
|
|
|
23
|
-
Kiểm tra `{paths.tasks}/$ARGUMENTS
|
|
24
|
-
- **
|
|
23
|
+
Kiểm tra `{paths.tasks}/$ARGUMENTS/` theo thứ tự ưu tiên:
|
|
24
|
+
- **v3** (default, per ADR-0008): có `task.md` → đọc/ghi 1 file này.
|
|
25
|
+
- **v2**: có `spec.md` + `tracking.md` → đọc/ghi 2 files; gợi ý migrate: `dw task migrate $ARGUMENTS`.
|
|
25
26
|
- **v1** (legacy): có `-context.md`/`-plan.md`/`-progress.md` → đọc/ghi bộ 3 files.
|
|
26
27
|
|
|
27
28
|
## Trước Khi Bắt Đầu
|
|
28
29
|
|
|
30
|
+
**v3:**
|
|
31
|
+
1. Đọc `{paths.tasks}/$ARGUMENTS/task.md` — Sections 1-5: Snapshot, Intent & Scope (incl. Subtasks + Success Criteria), Subtask Tracker, Timeline/Changelog, Handoff.
|
|
32
|
+
2. Xác nhận frontmatter `status: Approved` hoặc `In Progress`.
|
|
33
|
+
3. Optional: `dw task show $ARGUMENTS` để quick ANSI snapshot.
|
|
34
|
+
|
|
29
35
|
**v2:**
|
|
30
36
|
1. Đọc `{paths.tasks}/$ARGUMENTS/spec.md` — Intent, Scope, Subtasks, Success Criteria, Research Findings.
|
|
31
37
|
2. Đọc `{paths.tasks}/$ARGUMENTS/tracking.md` — Subtask Progress table, Changelog, Handoff Notes.
|
|
@@ -64,6 +70,13 @@ Nếu có progress → tiếp tục từ subtask cuối cùng chưa done.
|
|
|
64
70
|
- Nếu `quality.block_on_fail = false` → cảnh báo, cho phép tiếp tục
|
|
65
71
|
|
|
66
72
|
### Step 5: Cập nhật Progress
|
|
73
|
+
|
|
74
|
+
**v3** (default): Cập nhật `{paths.tasks}/$ARGUMENTS/task.md`:
|
|
75
|
+
- Section 3 (Subtask Tracker): update row với status `✅ Done`, Date, Notes (commit SHA). **Đây là single source of truth — KHÔNG paste status vào Section 2**.
|
|
76
|
+
- Section 4 (Timeline/Changelog): append entry với heading `### {date} — ST-N complete`, body: actions taken / decisions / pain points.
|
|
77
|
+
- Update frontmatter `last_updated`. Update Section 1 Snapshot fields (Phase, Status).
|
|
78
|
+
- Lint check: `dw task lint $ARGUMENTS` — báo drift markers nếu rò vào Section 2.
|
|
79
|
+
|
|
67
80
|
**v2**: Cập nhật `{paths.tasks}/$ARGUMENTS/tracking.md`:
|
|
68
81
|
- Update row trong section `## Subtask Progress` table với status `✅ Done`, Date, Notes (commit SHA).
|
|
69
82
|
- Append entry vào `## Changelog` theo format:
|
|
@@ -79,7 +92,7 @@ Nếu có progress → tiếp tục từ subtask cuối cùng chưa done.
|
|
|
79
92
|
```
|
|
80
93
|
|
|
81
94
|
Nếu `tracking.log_work = true`, ghi effort thực tế:
|
|
82
|
-
- **v2**: thêm cột "Actual" vào Subtask
|
|
95
|
+
- **v3/v2**: thêm cột "Actual" vào Subtask Tracker table hoặc ghi trong Changelog entry.
|
|
83
96
|
- **v1**:
|
|
84
97
|
```markdown
|
|
85
98
|
### Effort Log
|
|
@@ -114,7 +127,7 @@ Subtask ST-N of $ARGUMENTS
|
|
|
114
127
|
|
|
115
128
|
## Khi Hoàn Thành Tất Cả Subtasks
|
|
116
129
|
|
|
117
|
-
1. Cập nhật status: **v2** `tracking.md` frontmatter `status: Done` · **v1** progress.md `Trạng thái: Done`.
|
|
130
|
+
1. Cập nhật status: **v3** `task.md` frontmatter `status: Done` · **v2** `tracking.md` frontmatter `status: Done` · **v1** progress.md `Trạng thái: Done`.
|
|
118
131
|
2. Tóm tắt: subtasks completed, commits, issues encountered
|
|
119
132
|
3. Luôn gợi ý: "Tiếp theo: `/dw:review $ARGUMENTS`"
|
|
120
133
|
4. Nếu `workflow.default_depth = thorough`: "Cần chạy `/dw:docs-update $ARGUMENTS`"
|
|
@@ -23,8 +23,9 @@ git stash list # stashed work
|
|
|
23
23
|
|
|
24
24
|
### 2. Task progress
|
|
25
25
|
|
|
26
|
-
**Detect format**: Nếu có `tracking.md` → v2. Nếu có `-progress.md` → v1.
|
|
26
|
+
**Detect format**: Nếu có `task.md` → v3 (default). Nếu có `tracking.md` → v2. Nếu có `-progress.md` → v1.
|
|
27
27
|
|
|
28
|
+
- **v3** (default): Đọc `{paths.tasks}/$ARGUMENTS/task.md` — Section 3 Subtask Tracker, Section 4 Changelog, Section 5 Handoff & Friction.
|
|
28
29
|
- **v2**: Đọc `{paths.tasks}/$ARGUMENTS/tracking.md` — Subtask Progress table, Changelog, Handoff Notes (nếu đã có).
|
|
29
30
|
- **v1**: Đọc `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-progress.md`.
|
|
30
31
|
|
|
@@ -40,11 +41,13 @@ Tìm:
|
|
|
40
41
|
|
|
41
42
|
## Viết Handoff Notes
|
|
42
43
|
|
|
44
|
+
**v3** (default): Update `## 5. Handoff & Friction` section trong `{paths.tasks}/$ARGUMENTS/task.md`. Replace nội dung "For next session" hoặc append new entry. Cũng update frontmatter `last_updated` và Section 1 Snapshot (Phase, Status, Blockers). KHÔNG paste status markers vào Section 2 (drift prevention per lint).
|
|
45
|
+
|
|
43
46
|
**v2**: Replace (hoặc append nếu muốn giữ lịch sử) section `## Handoff Notes` trong `{paths.tasks}/$ARGUMENTS/tracking.md`. Cũng update frontmatter `last_updated`.
|
|
44
47
|
|
|
45
48
|
**v1**: Ghi vào mục "Handoff Notes" trong `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-progress.md`.
|
|
46
49
|
|
|
47
|
-
Format (chung cho
|
|
50
|
+
Format (chung cho 3 format):
|
|
48
51
|
|
|
49
52
|
```markdown
|
|
50
53
|
## Handoff Notes
|
|
@@ -86,7 +89,9 @@ Sau khi ghi xong, hiển thị:
|
|
|
86
89
|
- Tóm tắt handoff notes
|
|
87
90
|
- Lệnh để người/agent tiếp theo bắt đầu:
|
|
88
91
|
```
|
|
89
|
-
Đọc: {paths.tasks}/$ARGUMENTS/
|
|
92
|
+
Đọc: {paths.tasks}/$ARGUMENTS/task.md (v3 default)
|
|
93
|
+
hoặc {paths.tasks}/$ARGUMENTS/tracking.md (v2)
|
|
90
94
|
hoặc {paths.tasks}/$ARGUMENTS/$ARGUMENTS-progress.md (v1 legacy)
|
|
95
|
+
Snapshot: dw task show $ARGUMENTS
|
|
91
96
|
Tiếp tục: /dw:execute $ARGUMENTS
|
|
92
97
|
```
|
|
@@ -28,15 +28,17 @@ Task: **$ARGUMENTS**
|
|
|
28
28
|
- CHỈ đọc, phân tích, và viết plan
|
|
29
29
|
- DỪNG LẠI cuối cùng để chờ user/TL approve
|
|
30
30
|
|
|
31
|
-
## Detect Task Format (
|
|
31
|
+
## Detect Task Format (v3 / v2 / v1)
|
|
32
32
|
|
|
33
|
-
Kiểm tra `{paths.tasks}/$ARGUMENTS
|
|
33
|
+
Kiểm tra `{paths.tasks}/$ARGUMENTS/` theo thứ tự ưu tiên:
|
|
34
|
+
- **v3** (default per ADR-0008): có `task.md` → plan output update Section 2 (Intent & Scope subsections Subtasks/Out of Scope/Success Criteria/Risk Register/Dependencies).
|
|
34
35
|
- **v2**: có `spec.md` + `tracking.md` → plan output update trực tiếp vào `spec.md` (sections Scope/Subtasks/Risks/Success Criteria).
|
|
35
36
|
- **v1** (legacy): có `-context.md`/`-plan.md`/`-progress.md` → plan output ghi vào `$ARGUMENTS-plan.md`.
|
|
36
37
|
- Chưa có gì → gợi ý `/dw:task-init $ARGUMENTS` trước.
|
|
37
38
|
|
|
38
39
|
## Bước 1: Đọc Context
|
|
39
40
|
|
|
41
|
+
- **v3** (default): Đọc `{paths.tasks}/$ARGUMENTS/task.md` Section 2 (đã có Research Findings subsection nếu chạy `/dw:research`).
|
|
40
42
|
- **v2**: Đọc `{paths.tasks}/$ARGUMENTS/spec.md` (bao gồm section `## Research Findings` nếu đã chạy `/dw:research`).
|
|
41
43
|
- **v1**: Đọc `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-context.md` — file research đã tạo.
|
|
42
44
|
- Nếu chưa có research findings → thông báo: "Cần chạy `/dw:research $ARGUMENTS` trước."
|
|
@@ -71,6 +73,17 @@ Thứ tự subtasks theo dependency graph:
|
|
|
71
73
|
|
|
72
74
|
## Bước 4: Viết plan
|
|
73
75
|
|
|
76
|
+
**v3** (default): Update `task.md` trực tiếp — điền vào Section 2 subsections:
|
|
77
|
+
- `### Subtasks (in scope)`: ST-1, ST-2, ... với Acceptance criteria. KHÔNG dùng status markers (✅🟡) ở đây — drift markers trigger lint error.
|
|
78
|
+
- `### Out of Scope`: các điểm loại trừ rõ ràng.
|
|
79
|
+
- `### Success Criteria`: checkbox list measurable.
|
|
80
|
+
- `### Dependencies`: upstream blockers / external.
|
|
81
|
+
- `### Risk Register` (optional, thorough only): table | ID | Risk | Severity | Mitigation | Owner |.
|
|
82
|
+
|
|
83
|
+
Section 3 (Subtask Tracker): khởi tạo với 1 row per ST, status `⬜ Pending`. Đây là single source of truth cho status.
|
|
84
|
+
Frontmatter: đổi `status: Draft` → `status: Approved` chỉ SAU khi user approve.
|
|
85
|
+
Update Section 1 Snapshot fields (Phase, Status, Next milestone).
|
|
86
|
+
|
|
74
87
|
**v2**: Update `spec.md` trực tiếp — điền vào các section có sẵn:
|
|
75
88
|
- `## Scope → In Scope`: thêm ST-1, ST-2, ... với mô tả + acceptance + effort
|
|
76
89
|
- `## Scope → Out of Scope`: các điểm loại trừ rõ ràng
|
|
@@ -24,17 +24,17 @@ Task: **$ARGUMENTS**
|
|
|
24
24
|
|
|
25
25
|
Đọc `.dw/config/dw.config.yml` → lấy `paths.tasks` để biết output location.
|
|
26
26
|
|
|
27
|
-
## Detect Task Format (
|
|
27
|
+
## Detect Task Format (v3 / v2 / v1)
|
|
28
28
|
|
|
29
|
-
Kiểm tra `{paths.tasks}/$ARGUMENTS
|
|
29
|
+
Kiểm tra `{paths.tasks}/$ARGUMENTS/` theo thứ tự ưu tiên:
|
|
30
|
+
- Nếu có `task.md` → **v3 format** (default per ADR-0008). Output ghi vào Section 2 (Intent & Scope) subsection "## Research Findings" hoặc Appendage `research.md`.
|
|
30
31
|
- Nếu có `spec.md` + `tracking.md` → **v2 format**. Output ghi vào spec.md section "## Research Findings".
|
|
31
32
|
- Nếu có `-context.md`/`-plan.md`/`-progress.md` → **v1 format** (legacy). Output ghi vào `$ARGUMENTS-context.md` như cũ.
|
|
32
33
|
- Nếu chưa có gì → gợi ý user chạy `/dw:task-init $ARGUMENTS` trước.
|
|
33
34
|
|
|
34
|
-
Trong các bước dưới, "context file" = `spec.md` (v2) hoặc `$ARGUMENTS-context.md` (v1).
|
|
35
|
-
|
|
36
35
|
## Bước 1: Đọc yêu cầu
|
|
37
36
|
|
|
37
|
+
- **v3** (default): Đọc `{paths.tasks}/$ARGUMENTS/task.md` Section 2 (Intent + Scope + Subtasks).
|
|
38
38
|
- **v2**: Đọc `{paths.tasks}/$ARGUMENTS/spec.md` lấy Intent + Scope.
|
|
39
39
|
- **v1**: Đọc `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-plan.md` nếu đã có mô tả yêu cầu.
|
|
40
40
|
- Hoặc lấy yêu cầu từ conversation context.
|
|
@@ -63,6 +63,8 @@ Từ framework `.claude/skills/dw-thinking/THINKING.md`:
|
|
|
63
63
|
|
|
64
64
|
## Bước 4: Ghi kết quả
|
|
65
65
|
|
|
66
|
+
**v3 format** (default): Trong `{paths.tasks}/$ARGUMENTS/task.md`, append subsection `### Research Findings` dưới Section 2 "Intent & Scope" (sau `### Why Now`, trước `### Subtasks`). Hoặc tạo appendage file `research.md` trong cùng folder nếu research dài (>100 dòng). KHÔNG paste status markers vào Section 2.
|
|
67
|
+
|
|
66
68
|
**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
69
|
|
|
68
70
|
**v1 format** (legacy): Ghi vào `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-context.md`.
|
|
@@ -117,7 +119,7 @@ Dùng template `.claude/templates/agent-report.md` với:
|
|
|
117
119
|
- Details: key files, patterns, dependencies
|
|
118
120
|
- Next Steps: những gì planner cần biết
|
|
119
121
|
|
|
120
|
-
> Quick depth tasks: bỏ qua bước này — tracking.md (v2) / progress.md (v1) đã đủ.
|
|
122
|
+
> Quick depth tasks: bỏ qua bước này — task.md (v3) / tracking.md (v2) / progress.md (v1) đã đủ.
|
|
121
123
|
|
|
122
124
|
## Bước 6: Tóm tắt
|
|
123
125
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dw:retroactive
|
|
3
|
-
description: "Retroactively document một feature/task đã được implement trước khi dùng dw. Reverse-engineer từ code + git history, tạo
|
|
3
|
+
description: "Retroactively document một feature/task đã được implement trước khi dùng dw. Reverse-engineer từ code + git history, tạo task.md (v3 format, As-Built flavor)."
|
|
4
4
|
argument-hint: "[feature-name]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
|
@@ -19,7 +19,7 @@ allowed-tools:
|
|
|
19
19
|
|
|
20
20
|
Feature: **$ARGUMENTS**
|
|
21
21
|
|
|
22
|
-
> Reverse-engineer feature đã tồn tại từ code + git history. Tạo task docs
|
|
22
|
+
> Reverse-engineer feature đã tồn tại từ code + git history. Tạo task docs v3 format (`task.md`) với flavor As-Built — để AI và team có context đầy đủ khi làm task liên quan.
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
@@ -32,7 +32,7 @@ Feature: **$ARGUMENTS**
|
|
|
32
32
|
## Kiểm tra đã có docs chưa
|
|
33
33
|
|
|
34
34
|
Kiểm tra `{paths.tasks}/$ARGUMENTS/` đã tồn tại chưa:
|
|
35
|
-
- Nếu có `spec.md`
|
|
35
|
+
- Nếu có `task.md` / `spec.md` / `tracking.md` → hỏi user: "Đã có task docs cho `$ARGUMENTS`. Overwrite hay skip?"
|
|
36
36
|
- Nếu chưa → tiếp tục
|
|
37
37
|
|
|
38
38
|
---
|
|
@@ -80,80 +80,93 @@ Từ framework `.dw/core/THINKING.md`:
|
|
|
80
80
|
|
|
81
81
|
---
|
|
82
82
|
|
|
83
|
-
## Bước 5: Tạo task docs (
|
|
83
|
+
## Bước 5: Tạo task docs (v3 format, As-Built flavor)
|
|
84
84
|
|
|
85
|
-
Tạo thư mục `{paths.tasks}/$ARGUMENTS/` và **
|
|
85
|
+
Tạo thư mục `{paths.tasks}/$ARGUMENTS/` và **1 file** theo template v3 tại `.dw/core/templates/v3/task.md`.
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
Cách nhanh: `dw task new $ARGUMENTS --depth thorough --adr none --target "as-built"` → sau đó edit Section 2-5.
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
**Frontmatter:**
|
|
89
|
+
### Điền frontmatter:
|
|
92
90
|
- `task_id: $ARGUMENTS`
|
|
93
|
-
- `created: [
|
|
91
|
+
- `created: [first-commit-date từ git]`
|
|
92
|
+
- `last_updated: [today]`
|
|
94
93
|
- `status: Done` ← đã implement
|
|
94
|
+
- `phase: Maintained (pre-dw)`
|
|
95
95
|
- `owner: [main author từ git shortlog]`
|
|
96
|
-
- `depth:
|
|
96
|
+
- `depth: thorough`
|
|
97
97
|
- `related_adr: none`
|
|
98
|
-
- `target_ship: [first-commit-date]`
|
|
98
|
+
- `target_ship: as-built ([first-commit-date])`
|
|
99
|
+
- `schema_version: v3.0`
|
|
100
|
+
- `blockers: none`
|
|
99
101
|
|
|
100
|
-
|
|
102
|
+
### Body sections (lấp bằng findings retroactive):
|
|
101
103
|
|
|
102
|
-
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
- **Acceptance**: đánh dấu `[x]` các items đã done (feature đang chạy prod)
|
|
114
|
-
|
|
115
|
-
**Thêm note trên đầu Intent**:
|
|
104
|
+
**Section 1 — Snapshot:**
|
|
105
|
+
- Phase: `Maintained (pre-dw)`
|
|
106
|
+
- Status: `Done`
|
|
107
|
+
- Next milestone: `— (maintained as-is)`
|
|
108
|
+
- Owner: maintainer chính
|
|
109
|
+
- Blockers: `none`
|
|
110
|
+
- Last updated: today
|
|
111
|
+
|
|
112
|
+
**Section 2 — Intent & Scope:**
|
|
113
|
+
|
|
114
|
+
Thêm note trên đầu Intent:
|
|
116
115
|
```markdown
|
|
117
116
|
> ⚠ As-Built Documentation — Generated retroactively from code + git history.
|
|
118
117
|
> Verbal context (Slack threads, meetings) có thể thiếu. Cần human review bổ sung.
|
|
119
118
|
```
|
|
120
119
|
|
|
121
|
-
|
|
120
|
+
- `### Intent`: 1-2 paragraphs mô tả feature làm gì (dựa trên code).
|
|
121
|
+
- `### Why Now`: "As-built documentation — feature pre-dw adoption" + lý do document hóa.
|
|
122
|
+
- `### Subtasks (in scope)`: liệt kê component đã implement dưới dạng **ST-1, ST-2...** với:
|
|
123
|
+
- Concrete action = mô tả component đã implement
|
|
124
|
+
- Acceptance = how it was verified (tests / manual check)
|
|
125
|
+
- `### Out of Scope`: những gì rõ ràng KHÔNG nằm trong feature (suy từ code boundaries).
|
|
126
|
+
- `### Success Criteria`: current behavior được kiểm chứng bằng gì (tests, prod metrics nếu biết).
|
|
127
|
+
- `### Dependencies`: upstream modules/services + downstream consumers.
|
|
128
|
+
- `### Risk Register` (optional): tech debt, antipatterns, security concerns phát hiện.
|
|
129
|
+
- `### Known Unknowns`: câu hỏi cần human review (verbal decisions không có trong code).
|
|
122
130
|
|
|
123
|
-
|
|
131
|
+
**KHÔNG dùng status markers** (`✅` `🟡` `← START HERE`) trong Section 2 — drift prevention per lint.
|
|
124
132
|
|
|
125
|
-
|
|
133
|
+
**Section 3 — Subtask Tracker:**
|
|
126
134
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
-
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
Map các component đã tìm ở Bước 2 thành table:
|
|
136
|
+
```
|
|
137
|
+
| ST | Subtask | Status | Date | Notes |
|
|
138
|
+
|------|---------|--------|------|-------|
|
|
139
|
+
| ST-1 | [tên] | ✅ Done | [first-commit-date] | [commit SHA] |
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Section 4 — Timeline / Changelog:**
|
|
143
|
+
|
|
144
|
+
Parse git log ra entries:
|
|
145
|
+
```markdown
|
|
146
|
+
### YYYY-MM-DD — [commit subject]
|
|
147
|
+
**Actions taken:** [summary]
|
|
148
|
+
```
|
|
134
149
|
|
|
135
|
-
**
|
|
136
|
-
|
|
137
|
-
- **
|
|
138
|
-
-
|
|
139
|
-
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
- **Don't do:** [stable contracts không nên thay đổi]
|
|
148
|
-
- **Watch out:** [tech debt + gotchas]
|
|
149
|
-
- **Friction Journal**: để trống hoặc nhập tech debt đã ghi nhận từ Bước 4
|
|
150
|
-
- **Agent Debate Log**: bỏ qua (không applicable cho retroactive)
|
|
151
|
-
|
|
152
|
-
Ghi vào `{paths.tasks}/$ARGUMENTS/tracking.md`.
|
|
150
|
+
**Section 5 — Handoff & Friction:**
|
|
151
|
+
|
|
152
|
+
- **For next session:**
|
|
153
|
+
- Read first: `task.md` (as-built) + key files từ Bước 2
|
|
154
|
+
- Current state: Done, maintained
|
|
155
|
+
- Don't do: [stable contracts không nên thay đổi]
|
|
156
|
+
- Watch out: [tech debt + gotchas]
|
|
157
|
+
- **Friction Journal:** tech debt đã ghi nhận từ Bước 4
|
|
158
|
+
|
|
159
|
+
**Section 6 — Annexes:** (none, hoặc `architecture.md` nếu cần diagram dài).
|
|
160
|
+
|
|
161
|
+
Ghi vào `{paths.tasks}/$ARGUMENTS/task.md`.
|
|
153
162
|
|
|
154
163
|
### 5c. Cập nhật ACTIVE.md
|
|
155
164
|
|
|
156
|
-
Chạy `dw active`
|
|
165
|
+
Chạy `dw active` để regenerate team index.
|
|
166
|
+
|
|
167
|
+
### 5d. Lint check
|
|
168
|
+
|
|
169
|
+
Chạy `dw task lint $ARGUMENTS` — verify frontmatter schema valid + no drift markers in Section 2.
|
|
157
170
|
|
|
158
171
|
---
|
|
159
172
|
|
|
@@ -167,9 +180,8 @@ Chạy `dw active` (hoặc `writeActiveIndex`) để regenerate team index.
|
|
|
167
180
|
║ Git commits : [N, từ [date] đến [date]]
|
|
168
181
|
║ Maintainer chính : [author]
|
|
169
182
|
╠══════════════════════════════════════════════════════╣
|
|
170
|
-
║ Docs đã tạo (
|
|
171
|
-
║ {paths.tasks}/$ARGUMENTS/
|
|
172
|
-
║ {paths.tasks}/$ARGUMENTS/tracking.md (Done, maintained)
|
|
183
|
+
║ Docs đã tạo (v3 format):
|
|
184
|
+
║ {paths.tasks}/$ARGUMENTS/task.md (As-Built, Done)
|
|
173
185
|
╠══════════════════════════════════════════════════════╣
|
|
174
186
|
║ Key findings:
|
|
175
187
|
║ • [Finding 1]
|
|
@@ -179,8 +191,8 @@ Chạy `dw active` (hoặc `writeActiveIndex`) để regenerate team index.
|
|
|
179
191
|
║ • [Warning nếu có]
|
|
180
192
|
╠══════════════════════════════════════════════════════╣
|
|
181
193
|
║ Tiếp theo:
|
|
194
|
+
║ → Snapshot: dw task show $ARGUMENTS
|
|
182
195
|
║ → Task liên quan: /dw:research $ARGUMENTS
|
|
183
|
-
║ (AI đọc spec.md làm foundation)
|
|
184
196
|
║ → Human review: điền Known Unknowns + Handoff Notes
|
|
185
197
|
╚══════════════════════════════════════════════════════╝
|
|
186
198
|
```
|
|
@@ -189,7 +201,7 @@ Chạy `dw active` (hoặc `writeActiveIndex`) để regenerate team index.
|
|
|
189
201
|
|
|
190
202
|
## Lưu ý
|
|
191
203
|
|
|
192
|
-
- **As-built ≠ forward plan**:
|
|
204
|
+
- **As-built ≠ forward plan**: task.md mô tả hiện trạng, không phải kế hoạch tương lai.
|
|
193
205
|
- **Best-effort**: AI chỉ thấy code + git — context ẩn (verbal decisions, Slack threads) có thể thiếu. Human review là bắt buộc cho phần `Known Unknowns`.
|
|
194
|
-
- **
|
|
195
|
-
- **Tools khác vẫn đọc được**: `dw active`,
|
|
206
|
+
- **v3 format** (ADR-0008): Chỉ tạo 1 file `task.md`. Không tạo legacy v2 (`spec.md` + `tracking.md`) hoặc v1 (`context + plan + progress`) nữa.
|
|
207
|
+
- **Tools khác vẫn đọc được**: `dw active`, stop-check hook, `/dw:dashboard` đều support v3 song song với v2/v1 legacy.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dw:task-init
|
|
3
|
-
description: "Khởi tạo bộ documentation cho task mới. Tạo
|
|
3
|
+
description: "Khởi tạo bộ documentation cho task mới (v3 1-file task.md theo ADR-0008). Tạo qua `dw task new` hoặc render template thủ công."
|
|
4
4
|
argument-hint: "[task-name]"
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -11,61 +11,66 @@ argument-hint: "[task-name]"
|
|
|
11
11
|
Đọc `.dw/config/dw.config.yml`:
|
|
12
12
|
- `paths.tasks` → thư mục chứa task docs (mặc định: `.dw/tasks`)
|
|
13
13
|
- `workflow.default_depth` → `quick | standard | thorough`
|
|
14
|
-
- `project.language` → ngôn ngữ note thêm
|
|
14
|
+
- `project.language` → ngôn ngữ note thêm
|
|
15
15
|
|
|
16
|
-
## Tạo
|
|
16
|
+
## Tạo Task (v3 format — default)
|
|
17
|
+
|
|
18
|
+
Cách nhanh nhất: chạy CLI
|
|
17
19
|
|
|
18
20
|
```
|
|
19
|
-
{
|
|
20
|
-
├── spec.md # Intent + subtasks + success criteria (stable after approve)
|
|
21
|
-
└── tracking.md # Progress + changelog + handoff (mutable)
|
|
21
|
+
dw task new $ARGUMENTS --depth {default_depth} [--title "..."] [--adr ADR-NNNN]
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- `{
|
|
28
|
-
-
|
|
29
|
-
- `status` → `Draft`
|
|
30
|
-
- `depth` → giá trị `workflow.default_depth` từ config
|
|
31
|
-
- `owner` → để trống (user tự điền)
|
|
32
|
-
- `related_adr` → `none`
|
|
33
|
-
- `target_ship` → `none`
|
|
34
|
-
|
|
35
|
-
Ghi vào `{paths.tasks}/$ARGUMENTS/spec.md`.
|
|
24
|
+
Lệnh này:
|
|
25
|
+
- Đọc template `.dw/core/templates/v3/task.md`
|
|
26
|
+
- Điền frontmatter (task_id, created/last_updated = today, status: Draft, depth, owner, schema_version: v3.0)
|
|
27
|
+
- Tạo `{paths.tasks}/$ARGUMENTS/task.md`
|
|
28
|
+
- Log telemetry event `task.new`
|
|
36
29
|
|
|
37
|
-
###
|
|
30
|
+
### Nếu CLI không khả dụng — manual fallback
|
|
38
31
|
|
|
39
|
-
Đọc template từ `.dw/core/templates/
|
|
32
|
+
Đọc template từ `.dw/core/templates/v3/task.md`, điền vào:
|
|
40
33
|
- `{task-name}` → `$ARGUMENTS`
|
|
41
|
-
- `{YYYY-MM-DD}` (
|
|
42
|
-
- `status` →
|
|
43
|
-
- `
|
|
44
|
-
- `
|
|
34
|
+
- `{YYYY-MM-DD}` → ngày hiện tại (3 chỗ: created, last_updated, optional changelog entry)
|
|
35
|
+
- `status: Draft` → giữ nguyên
|
|
36
|
+
- `depth` → giá trị `workflow.default_depth` từ config
|
|
37
|
+
- `owner` → từ env DW_OWNER hoặc để trống
|
|
38
|
+
- `related_adr: {ADR-NNNN | none}` → `none` (hoặc ADR nếu task liên quan)
|
|
39
|
+
- `target_ship: {milestone or TBD}` → `TBD`
|
|
40
|
+
- `# Timeline: {Task Title}` → tiêu đề task
|
|
45
41
|
|
|
46
|
-
Ghi vào `{paths.tasks}/$ARGUMENTS/
|
|
42
|
+
Ghi vào `{paths.tasks}/$ARGUMENTS/task.md` (chỉ 1 file).
|
|
47
43
|
|
|
48
|
-
|
|
44
|
+
## Cập Nhật ACTIVE.md
|
|
49
45
|
|
|
50
|
-
|
|
46
|
+
Chạy `dw active` để regenerate `{paths.tasks}/ACTIVE.md` — team index sẽ thấy task mới.
|
|
51
47
|
|
|
52
48
|
## Sau Khi Tạo
|
|
53
49
|
|
|
54
50
|
Hiển thị cho user:
|
|
55
51
|
|
|
56
|
-
1.
|
|
57
|
-
- `{paths.tasks}/$ARGUMENTS/spec.md`
|
|
58
|
-
- `{paths.tasks}/$ARGUMENTS/tracking.md`
|
|
52
|
+
1. File đã tạo: `{paths.tasks}/$ARGUMENTS/task.md`
|
|
59
53
|
|
|
60
54
|
2. Workflow tiếp theo theo `workflow.default_depth`:
|
|
61
55
|
- **quick**: "Code ngay hoặc `/dw:research $ARGUMENTS` nếu cần khảo sát."
|
|
62
56
|
- **standard**: "`/dw:research $ARGUMENTS` → `/dw:plan $ARGUMENTS` → approve → `/dw:execute $ARGUMENTS`"
|
|
63
57
|
- **thorough**: "`/dw:requirements $ARGUMENTS` → `/dw:research $ARGUMENTS` → `/dw:estimate $ARGUMENTS` → `/dw:plan $ARGUMENTS`"
|
|
64
58
|
|
|
65
|
-
3.
|
|
59
|
+
3. Useful commands:
|
|
60
|
+
- `dw task show $ARGUMENTS` — terminal snapshot
|
|
61
|
+
- `dw task lint $ARGUMENTS` — drift check
|
|
62
|
+
- `dw active` — team index
|
|
63
|
+
|
|
64
|
+
## v3 Format Rules (per ADR-0008)
|
|
65
|
+
|
|
66
|
+
- **Single source of truth:** `task.md` chứa Snapshot + Intent + Subtask Tracker + Changelog + Handoff. Không có file thứ 2 cho status.
|
|
67
|
+
- **Section 2 (Intent & Scope) frozen sau approve** — không status markers (`✅🟡🔴`), không dates inline. Status lives only in Section 3.
|
|
68
|
+
- **Section 3 (Subtask Tracker) = single source of truth** cho subtask status (⬜🟡✅🔴⏸).
|
|
69
|
+
- **Section 4 auto-rotate** > 400 dòng → `timeline-history.md` (qua stop-check hook).
|
|
70
|
+
- **Appendages allowed**: `baseline.md`, `experiment-{id}.md`, `debate-r{N}.md`, `timeline-history.md`. Tránh tên generic (`notes.md`, `extra.md` — lint warn).
|
|
71
|
+
- **Lint default strict**: `dw task lint` chạy schema validate + drift check.
|
|
66
72
|
|
|
67
|
-
##
|
|
73
|
+
## Legacy Format Support
|
|
68
74
|
|
|
69
|
-
- `spec.md`
|
|
70
|
-
- `
|
|
71
|
-
- Legacy 3-file format (`context + plan + progress`) vẫn được đọc bởi các skill khác để backward compat, nhưng **không tạo mới** cho task mới.
|
|
75
|
+
- **v2 (deprecated)**: 2-file `spec.md` + `tracking.md`. Đọc-only (backward compat); migrate qua `dw task migrate $ARGUMENTS` (dry-run trước).
|
|
76
|
+
- **v1 (legacy)**: 3-file `context.md` + `plan.md` + `progress.md`. Đọc-only; không tạo mới.
|