@brunosps00/dev-workflow 0.8.1 → 0.9.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 (59) hide show
  1. package/README.md +16 -12
  2. package/bin/dev-workflow.js +1 -1
  3. package/lib/constants.js +8 -2
  4. package/lib/init.js +6 -0
  5. package/lib/install-deps.js +0 -5
  6. package/lib/migrate-gsd.js +164 -0
  7. package/lib/uninstall.js +2 -2
  8. package/package.json +1 -1
  9. package/scaffold/en/commands/dw-analyze-project.md +6 -11
  10. package/scaffold/en/commands/dw-autopilot.md +6 -13
  11. package/scaffold/en/commands/dw-brainstorm.md +1 -1
  12. package/scaffold/en/commands/dw-code-review.md +6 -5
  13. package/scaffold/en/commands/dw-create-prd.md +5 -4
  14. package/scaffold/en/commands/dw-create-techspec.md +5 -4
  15. package/scaffold/en/commands/dw-execute-phase.md +149 -0
  16. package/scaffold/en/commands/dw-help.md +5 -2
  17. package/scaffold/en/commands/dw-intel.md +98 -29
  18. package/scaffold/en/commands/dw-map-codebase.md +125 -0
  19. package/scaffold/en/commands/dw-new-project.md +1 -1
  20. package/scaffold/en/commands/dw-plan-checker.md +144 -0
  21. package/scaffold/en/commands/dw-quick.md +30 -12
  22. package/scaffold/en/commands/dw-redesign-ui.md +5 -9
  23. package/scaffold/en/commands/dw-refactoring-analysis.md +6 -5
  24. package/scaffold/en/commands/dw-resume.md +10 -8
  25. package/scaffold/en/commands/dw-run-plan.md +14 -20
  26. package/scaffold/en/commands/dw-run-task.md +5 -4
  27. package/scaffold/en/commands/dw-update.md +3 -1
  28. package/scaffold/en/templates/idea-onepager.md +1 -1
  29. package/scaffold/pt-br/commands/dw-analyze-project.md +6 -11
  30. package/scaffold/pt-br/commands/dw-autopilot.md +6 -13
  31. package/scaffold/pt-br/commands/dw-brainstorm.md +1 -1
  32. package/scaffold/pt-br/commands/dw-code-review.md +6 -5
  33. package/scaffold/pt-br/commands/dw-create-prd.md +5 -4
  34. package/scaffold/pt-br/commands/dw-create-techspec.md +5 -4
  35. package/scaffold/pt-br/commands/dw-execute-phase.md +149 -0
  36. package/scaffold/pt-br/commands/dw-help.md +5 -2
  37. package/scaffold/pt-br/commands/dw-intel.md +98 -29
  38. package/scaffold/pt-br/commands/dw-map-codebase.md +125 -0
  39. package/scaffold/pt-br/commands/dw-new-project.md +1 -1
  40. package/scaffold/pt-br/commands/dw-plan-checker.md +144 -0
  41. package/scaffold/pt-br/commands/dw-quick.md +30 -12
  42. package/scaffold/pt-br/commands/dw-redesign-ui.md +5 -9
  43. package/scaffold/pt-br/commands/dw-refactoring-analysis.md +6 -5
  44. package/scaffold/pt-br/commands/dw-resume.md +10 -8
  45. package/scaffold/pt-br/commands/dw-run-plan.md +16 -22
  46. package/scaffold/pt-br/commands/dw-run-task.md +5 -4
  47. package/scaffold/pt-br/commands/dw-update.md +3 -1
  48. package/scaffold/pt-br/templates/idea-onepager.md +1 -1
  49. package/scaffold/skills/dw-codebase-intel/SKILL.md +101 -0
  50. package/scaffold/skills/dw-codebase-intel/agents/intel-updater.md +318 -0
  51. package/scaffold/skills/dw-codebase-intel/references/incremental-update.md +79 -0
  52. package/scaffold/skills/dw-codebase-intel/references/intel-format.md +208 -0
  53. package/scaffold/skills/dw-codebase-intel/references/query-patterns.md +148 -0
  54. package/scaffold/skills/dw-execute-phase/SKILL.md +133 -0
  55. package/scaffold/skills/dw-execute-phase/agents/executor.md +264 -0
  56. package/scaffold/skills/dw-execute-phase/agents/plan-checker.md +215 -0
  57. package/scaffold/skills/dw-execute-phase/references/atomic-commits.md +143 -0
  58. package/scaffold/skills/dw-execute-phase/references/plan-verification.md +156 -0
  59. package/scaffold/skills/dw-execute-phase/references/wave-coordination.md +102 -0
@@ -0,0 +1,156 @@
1
+ # Plan verification — the 6-dimension goal-backward analysis
2
+
3
+ The `dw-plan-checker` agent verifies that a `tasks.md` will achieve the PRD goal BEFORE execution starts. This document details each dimension's checks, examples, and pass/fail criteria.
4
+
5
+ ## Why pre-execution verification
6
+
7
+ Mid-execution discovery of plan flaws is expensive: context burned, partial commits to revert, deviation logs to resolve. Pre-execution verification catches the same flaws at zero implementation cost. The trade-off: 1-2 minutes of plan-checker time vs. potentially 30+ minutes of mid-execution rework.
8
+
9
+ ## The 6 dimensions
10
+
11
+ ### 1. Requirement Coverage
12
+
13
+ **Goal:** every PRD requirement (RF-XX) has at least one task addressing it.
14
+
15
+ **Steps:**
16
+ 1. Extract numbered requirements from `prd.md`. Pattern: `### RF-NN` or `**RF-NN:**` or numbered list under "Functional Requirements".
17
+ 2. Build `Set<RF>` of expected requirements.
18
+ 3. Scan `tasks.md` and `<NN>_task.md` files for `Closes RF-XX` / `RF: RF-XX` / `Requirement: RF-XX` markers.
19
+ 4. Compute `uncovered = expected - addressed`.
20
+
21
+ **Pass:** `uncovered` is empty.
22
+ **Revise:** uncovered non-empty AND fixable by adding tasks.
23
+ **Block:** PRD has no numbered requirements (`expected` is empty) — verifying intent is impossible.
24
+
25
+ **Common failures:**
26
+ - Planner forgot a non-obvious requirement (e.g., audit logging) buried in PRD prose
27
+ - Compound requirement ("user can sign up AND verify email") only addressed for one half
28
+ - Requirement covered indirectly but no task explicitly marks the closure
29
+
30
+ ### 2. Task Completeness
31
+
32
+ **Goal:** each task has all four parts: files, action, verification, done criteria.
33
+
34
+ **Steps:**
35
+ For each task in `tasks.md`:
36
+ - Open `<NN>_task.md` (or inline section)
37
+ - Check for required sections:
38
+ - `## Files` (or `Files to create/modify:`) — explicit paths
39
+ - `## Action` (or `Implement:`) — what to do, concrete
40
+ - `## Verification` (or `Verify:`) — how to know it worked (linter, tests, build, manual)
41
+ - `## Done` (or `Done when:`) — criteria for marking `[x]`
42
+
43
+ **Pass:** all four sections present in every task.
44
+ **Revise:** ≥1 task missing one section.
45
+
46
+ **Common failures:**
47
+ - "Files: TBD" or "Files: see techspec" — too vague
48
+ - No verification → executor can't decide when to commit
49
+ - Done criteria absent → executor commits but can't mark `[x]` confidently
50
+
51
+ ### 3. Dependency Soundness
52
+
53
+ **Goal:** `Depends on:` graph is acyclic, references valid, waves are reasonable.
54
+
55
+ **Steps:**
56
+ 1. Parse every task's `Depends on:` field (none / comma-separated task numbers).
57
+ 2. Build directed graph (node = task, edge = depends-on relation).
58
+ 3. Topological sort:
59
+ - Cycle → BLOCK with the cycle path
60
+ - Reference to non-existent task number → REVISE with the dangling ref
61
+ 4. Compute wave widths. Any wave > 8 tasks → REVISE (split with synthetic barrier).
62
+
63
+ **Pass:** topological sort succeeds, all refs valid, waves ≤ 8 wide.
64
+
65
+ **Common failures:**
66
+ - Bidirectional dependency (`02 depends on 03; 03 depends on 02`) — likely planner confusion; needs re-think
67
+ - Typo in `Depends on: 02` when the task is actually numbered `2.5` or `03`
68
+ - 10 independent test files all in wave 1 → split into smaller waves
69
+
70
+ ### 4. Artifact Wiring
71
+
72
+ **Goal:** every artifact produced by a task is consumed by a downstream task OR is a leaf deliverable referenced in PRD's user stories.
73
+
74
+ **Steps:**
75
+ 1. For each task, identify what it PRODUCES:
76
+ - New files (from `Files: + src/foo.ts`)
77
+ - New exports (from `Implement: export function bar()`)
78
+ - New endpoints (from `Action: add POST /api/baz`)
79
+ 2. For each downstream task (later in topo order), identify what it CONSUMES:
80
+ - Imports (from `Files: src/quux.ts (modify) — imports bar`)
81
+ - References (from `Action: call /api/baz`)
82
+ 3. Cross-reference: every produced artifact should be either consumed downstream OR explicitly mentioned in PRD as a user-facing deliverable.
83
+
84
+ **Pass:** zero orphan artifacts.
85
+ **Revise:** ≥1 artifact created without consumer or PRD reference — likely incomplete plan.
86
+
87
+ **Common failures:**
88
+ - Task creates a service but no task wires it into the router
89
+ - Task creates a migration file but no task runs it (`prisma migrate deploy`)
90
+ - Task creates a config but no task reads it
91
+
92
+ ### 5. Context Budget
93
+
94
+ **Goal:** the phase fits in a practical execution window.
95
+
96
+ **Steps:**
97
+ 1. Count tasks. Practical limit: 12 tasks per phase before quality degrades.
98
+ 2. Estimate aggregate file changes: sum of files mentioned in `Files:` across all tasks. Limit: 30 files per phase.
99
+ 3. Check parallelism setup: are wave-1 tasks running in parallel? (frontmatter `parallel: true` or default).
100
+
101
+ **Pass:** ≤12 tasks, ≤30 aggregate files, wave 1 has parallel execution if multi-task.
102
+
103
+ **Revise:** > 12 tasks → suggest splitting into 2 phases. > 30 files → reduce scope or split.
104
+
105
+ **Common failures:**
106
+ - Mega-phase with 20 tasks because the planner couldn't decompose
107
+ - Single-task waves where parallelism was forgotten
108
+
109
+ ### 6. Constraint Compliance
110
+
111
+ **Goal:** tasks honor locked decisions and project conventions.
112
+
113
+ **Steps:**
114
+ 1. Read `.dw/rules/index.md` and `.dw/rules/<module>.md` for relevant modules.
115
+ 2. Read `CONTEXT.md` if exists; extract `## Decisions` (LOCKED) section.
116
+ 3. Read `./CLAUDE.md` for project hard constraints.
117
+ 4. For each task, check if its `Action` or `Files` violate:
118
+ - A locked decision
119
+ - A project rule (forbidden pattern, mandated tool)
120
+ - A CLAUDE.md directive
121
+
122
+ **Pass:** zero violations.
123
+ **Block:** ≥1 hard violation. The plan must change before execution.
124
+
125
+ **Common failures:**
126
+ - Locked decision says "framework: Fastify" but task says "use Express"
127
+ - Project rules forbid raw SQL; task uses `pg.query()` directly
128
+ - CLAUDE.md says "no env files committed"; task adds `.env.production`
129
+
130
+ ## Verdict resolution
131
+
132
+ After running all 6 dimensions:
133
+
134
+ | Outcome | Verdict |
135
+ |---------|---------|
136
+ | All 6 PASS | PASS — proceed to execution |
137
+ | Any REVISE, no BLOCK | REVISE — re-plan |
138
+ | Any BLOCK | BLOCK — surface to user, no auto-replan |
139
+
140
+ `PASS` is the only state that allows `/dw-execute-phase` to proceed.
141
+
142
+ ## Bounded revision loop
143
+
144
+ The plan-checker is part of a bounded quality loop:
145
+
146
+ 1. `/dw-create-tasks` produces v1 of `tasks.md`
147
+ 2. `/dw-plan-checker` runs → REVISE
148
+ 3. `/dw-create-tasks --revise` produces v2 (consumes plan-checker's issues as input)
149
+ 4. `/dw-plan-checker` runs → PASS or REVISE again
150
+ 5. After 3 revisions without reaching PASS → escalate to user (something fundamental is wrong)
151
+
152
+ The escalation cap prevents infinite loops where the planner can't satisfy the verifier. At 3 strikes, the user sees the diff between PRD and the failing tasks.md and decides next step.
153
+
154
+ ## Time budget
155
+
156
+ Plan-checker target: 1-2 minutes. The 6 dimensions are mostly file reads and grep operations; no heavy analysis. If plan-checker exceeds 5 minutes, it's a sign the agent is over-thinking — bias toward issuing REVISE for ambiguous cases rather than analyzing them deeply.
@@ -0,0 +1,102 @@
1
+ # Wave coordination — how the executor parallelizes tasks
2
+
3
+ Tasks within a phase have dependencies. Some can run in parallel; others must wait. The executor groups tasks into **waves** and runs each wave as parallel subagent dispatches, with sequential ordering between waves.
4
+
5
+ ## Wave computation
6
+
7
+ Input: `tasks.md` with each task carrying a `Depends on:` field (none, or comma-separated task numbers).
8
+
9
+ Algorithm: topological sort.
10
+
11
+ 1. Build dependency graph: node per task, edge from each `Depends on:` to the dependent task.
12
+ 2. Cycle check: if a cycle exists → abort with `EXEC-FAILED: dependency cycle`.
13
+ 3. Wave assignment:
14
+ - Wave 1 = tasks with zero dependencies
15
+ - Wave N = tasks whose all dependencies are in waves 1..N-1
16
+ 4. Output: ordered list of waves, each wave a list of task numbers.
17
+
18
+ ## Example
19
+
20
+ ```
21
+ tasks.md:
22
+ - 01 Create user schema Depends on: none
23
+ - 02 Create user model Depends on: 01
24
+ - 03 Create order schema Depends on: none
25
+ - 04 Wire auth middleware Depends on: 02
26
+ - 05 Add login endpoint Depends on: 04
27
+ - 06 Add order endpoint Depends on: 02, 03
28
+ - 07 Wire validation rules Depends on: 04, 06
29
+
30
+ Computed waves:
31
+ Wave 1: [01, 03] (no deps; can run in parallel)
32
+ Wave 2: [02] (depends on 01)
33
+ Wave 3: [04, 06] (depend on wave 2)
34
+ Wave 4: [05, 07] (depend on wave 3)
35
+ ```
36
+
37
+ ## Parallel execution within a wave
38
+
39
+ Within a wave, the executor dispatches tasks in parallel via subagent calls (one subagent per task). Each subagent:
40
+
41
+ 1. Reads its `<NN>_task.md`
42
+ 2. Implements
43
+ 3. Verifies (lint/tests/build)
44
+ 4. Commits atomically (per `atomic-commits.md`)
45
+ 5. Marks `[x]` in `tasks.md`
46
+ 6. Returns success or deviation status to the orchestrating executor
47
+
48
+ The orchestrating executor:
49
+
50
+ - Spawns N subagents in parallel (single message, N tool calls)
51
+ - Waits for all to return
52
+ - If all PASS → proceed to next wave
53
+ - If ANY return deviation/blocked → resolve before next wave (see deviation rules in `agents/executor.md`)
54
+
55
+ ## Wave width limits
56
+
57
+ Practical caps to keep context budget sane:
58
+
59
+ - **Soft cap: 5 tasks per wave** — tested as the upper bound where parallel execution stays efficient
60
+ - **Hard cap: 8 tasks per wave** — beyond this, the orchestrator's context fills with subagent results faster than tasks complete
61
+
62
+ If a wave exceeds the hard cap, the planner should split: introduce a synthetic dependency to bisect the wave. Example: if Wave 3 has 10 independent tasks, force tasks 06-10 to depend on a "wave 3a barrier" so they go to Wave 3.5.
63
+
64
+ The plan-checker (Dimension 5) flags wide waves before execution.
65
+
66
+ ## Cross-wave atomicity
67
+
68
+ Each wave is a checkpoint:
69
+
70
+ - After all tasks in a wave commit, run a `git status` check — should be clean (everything committed).
71
+ - If any task in a wave failed permanently (Rule 3 deviation), abort BEFORE starting the next wave. Leave the partial work committed; surface to user via `EXEC-BLOCKED`.
72
+ - Don't run waves N+1 with broken commits in wave N. The dependencies aren't satisfied.
73
+
74
+ ## Order within a wave
75
+
76
+ Within a wave, order doesn't matter logically (no deps between same-wave tasks). But for **commit history readability**, the executor should commit in numeric order of task number (01 commit before 02 even if both are wave 1). The parallel subagent results may arrive out of order; the executor collects and commits sequentially.
77
+
78
+ This means: subagents return their changes (files written, but NOT committed). The executor commits them in numeric order.
79
+
80
+ (Alternative: subagents commit independently and accept commit interleaving. Pick this if commit-order doesn't matter for the project; the orchestrator sets a flag.)
81
+
82
+ ## When to NOT use waves
83
+
84
+ Single-task changes (`/dw-quick`, `/dw-run-task`) bypass waves entirely. Waves are for `/dw-run-plan` and `/dw-execute-phase` — phase-scale execution.
85
+
86
+ ## Verification of wave structure (pre-execution)
87
+
88
+ The plan-checker (Dimension 3 in `plan-checker.md`) verifies:
89
+ - Topological sort succeeds (no cycles)
90
+ - All `Depends on:` references point to existing tasks
91
+ - No wave exceeds the hard cap (8 tasks)
92
+
93
+ If these fail, plan-checker returns REVISE before any code is touched.
94
+
95
+ ## Resume after checkpoint
96
+
97
+ If the executor checkpoints mid-phase, `active-session.md` records:
98
+ - `last_completed_task`
99
+ - `last_wave_completed`
100
+ - `remaining_tasks`
101
+
102
+ `/dw-resume` reads this, recomputes waves from `tasks.md`, skips already-committed tasks, and resumes from the wave containing `last_completed_task + 1`.