@brunosps00/dev-workflow 0.8.0 → 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 (73) hide show
  1. package/README.md +18 -14
  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-fix-qa.md +34 -13
  17. package/scaffold/en/commands/dw-help.md +5 -2
  18. package/scaffold/en/commands/dw-intel.md +98 -29
  19. package/scaffold/en/commands/dw-map-codebase.md +125 -0
  20. package/scaffold/en/commands/dw-new-project.md +1 -1
  21. package/scaffold/en/commands/dw-plan-checker.md +144 -0
  22. package/scaffold/en/commands/dw-quick.md +30 -12
  23. package/scaffold/en/commands/dw-redesign-ui.md +5 -9
  24. package/scaffold/en/commands/dw-refactoring-analysis.md +6 -5
  25. package/scaffold/en/commands/dw-resume.md +10 -8
  26. package/scaffold/en/commands/dw-run-plan.md +14 -20
  27. package/scaffold/en/commands/dw-run-qa.md +124 -23
  28. package/scaffold/en/commands/dw-run-task.md +5 -4
  29. package/scaffold/en/commands/dw-update.md +3 -1
  30. package/scaffold/en/templates/idea-onepager.md +1 -1
  31. package/scaffold/pt-br/commands/dw-analyze-project.md +6 -11
  32. package/scaffold/pt-br/commands/dw-autopilot.md +6 -13
  33. package/scaffold/pt-br/commands/dw-brainstorm.md +1 -1
  34. package/scaffold/pt-br/commands/dw-code-review.md +6 -5
  35. package/scaffold/pt-br/commands/dw-create-prd.md +5 -4
  36. package/scaffold/pt-br/commands/dw-create-techspec.md +5 -4
  37. package/scaffold/pt-br/commands/dw-execute-phase.md +149 -0
  38. package/scaffold/pt-br/commands/dw-fix-qa.md +34 -13
  39. package/scaffold/pt-br/commands/dw-help.md +5 -2
  40. package/scaffold/pt-br/commands/dw-intel.md +98 -29
  41. package/scaffold/pt-br/commands/dw-map-codebase.md +125 -0
  42. package/scaffold/pt-br/commands/dw-new-project.md +1 -1
  43. package/scaffold/pt-br/commands/dw-plan-checker.md +144 -0
  44. package/scaffold/pt-br/commands/dw-quick.md +30 -12
  45. package/scaffold/pt-br/commands/dw-redesign-ui.md +5 -9
  46. package/scaffold/pt-br/commands/dw-refactoring-analysis.md +6 -5
  47. package/scaffold/pt-br/commands/dw-resume.md +10 -8
  48. package/scaffold/pt-br/commands/dw-run-plan.md +16 -22
  49. package/scaffold/pt-br/commands/dw-run-qa.md +124 -23
  50. package/scaffold/pt-br/commands/dw-run-task.md +5 -4
  51. package/scaffold/pt-br/commands/dw-update.md +3 -1
  52. package/scaffold/pt-br/templates/idea-onepager.md +1 -1
  53. package/scaffold/skills/api-testing-recipes/SKILL.md +104 -0
  54. package/scaffold/skills/api-testing-recipes/recipes/dotnet-webapp-factory.md +168 -0
  55. package/scaffold/skills/api-testing-recipes/recipes/http-rest-client.md +130 -0
  56. package/scaffold/skills/api-testing-recipes/recipes/pytest-httpx.md +157 -0
  57. package/scaffold/skills/api-testing-recipes/recipes/rust-reqwest.md +173 -0
  58. package/scaffold/skills/api-testing-recipes/recipes/supertest-node.md +153 -0
  59. package/scaffold/skills/api-testing-recipes/references/auth-patterns.md +138 -0
  60. package/scaffold/skills/api-testing-recipes/references/log-conventions.md +117 -0
  61. package/scaffold/skills/api-testing-recipes/references/matrix-conventions.md +68 -0
  62. package/scaffold/skills/api-testing-recipes/references/openapi-driven.md +97 -0
  63. package/scaffold/skills/dw-codebase-intel/SKILL.md +101 -0
  64. package/scaffold/skills/dw-codebase-intel/agents/intel-updater.md +318 -0
  65. package/scaffold/skills/dw-codebase-intel/references/incremental-update.md +79 -0
  66. package/scaffold/skills/dw-codebase-intel/references/intel-format.md +208 -0
  67. package/scaffold/skills/dw-codebase-intel/references/query-patterns.md +148 -0
  68. package/scaffold/skills/dw-execute-phase/SKILL.md +133 -0
  69. package/scaffold/skills/dw-execute-phase/agents/executor.md +264 -0
  70. package/scaffold/skills/dw-execute-phase/agents/plan-checker.md +215 -0
  71. package/scaffold/skills/dw-execute-phase/references/atomic-commits.md +143 -0
  72. package/scaffold/skills/dw-execute-phase/references/plan-verification.md +156 -0
  73. package/scaffold/skills/dw-execute-phase/references/wave-coordination.md +102 -0
@@ -0,0 +1,144 @@
1
+ <system_instructions>
2
+ You are a plan verification orchestrator. Your job is to spawn the `dw-plan-checker` agent (from the `dw-execute-phase` bundled skill) to verify that a phase's `tasks.md` will achieve the PRD goal — BEFORE any code is touched.
3
+
4
+ This is a standalone manual gate. `/dw-execute-phase` and `/dw-autopilot` invoke the same agent automatically; this command lets you run just the gate to inspect the plan quality without committing to execution.
5
+
6
+ <critical>This command is read-only. Plan-checker NEVER modifies files.</critical>
7
+ <critical>Output one of three verdicts: PASS, REVISE, BLOCK. No middle ground.</critical>
8
+
9
+ ## When to Use
10
+
11
+ - Before invoking `/dw-execute-phase` if you want to inspect the plan quality first
12
+ - After a partial execution to verify remaining tasks still make sense
13
+ - After manual edits to `tasks.md` (always re-verify before re-executing)
14
+ - During `/dw-create-tasks` revisions to confirm the planner addressed prior REVISE issues
15
+ - NOT for verifying implementation correctness (use `/dw-run-qa`)
16
+ - NOT for code-quality review (use `/dw-code-review`)
17
+
18
+ ## Pipeline Position
19
+
20
+ **Predecessor:** `/dw-create-tasks` (or manual edits to `tasks.md`) | **Successor:** `/dw-execute-phase` if PASS; `/dw-create-tasks --revise` if REVISE; manual intervention if BLOCK
21
+
22
+ ## Complementary Skills
23
+
24
+ | Skill | Trigger |
25
+ |-------|---------|
26
+ | `dw-execute-phase` | **ALWAYS** — source of `dw-plan-checker` agent and `references/plan-verification.md` |
27
+ | `dw-codebase-intel` | Optional — agent reads `.dw/intel/` to verify plan against actual codebase facts |
28
+
29
+ ## Input Variables
30
+
31
+ | Variable | Description | Example |
32
+ |----------|-------------|---------|
33
+ | `{{PRD_PATH}}` | Path to the PRD folder containing `tasks.md` | `.dw/spec/prd-checkout-v2` |
34
+
35
+ ## File Locations
36
+
37
+ - Inputs (read-only): `{{PRD_PATH}}/{prd.md, techspec.md, tasks.md, <NN>_task.md}`, `.dw/rules/*.md`, `.dw/intel/*` (if exists), `./CLAUDE.md`
38
+ - Audit log (append-only): `.dw/audit/plan-checks-<YYYY-MM-DD>.log` (records each verdict for `--skip-check` audit trail)
39
+
40
+ ## Required Behavior
41
+
42
+ ### 1. Load context
43
+
44
+ Verify the PRD path exists and contains `tasks.md`. Read `prd.md`, `techspec.md`, `tasks.md`, and any `<NN>_task.md` files referenced.
45
+
46
+ ### 2. Spawn the agent
47
+
48
+ Spawn `dw-plan-checker` agent with:
49
+
50
+ - `prd_path: {{PRD_PATH}}`
51
+ - `required_reading:` block citing `.agents/skills/dw-execute-phase/SKILL.md` and `.agents/skills/dw-execute-phase/references/plan-verification.md`
52
+
53
+ The agent runs the 6-dimension verification:
54
+
55
+ 1. **Requirement Coverage** — every RF-XX has a task
56
+ 2. **Task Completeness** — files / action / verification / done present
57
+ 3. **Dependency Soundness** — no cycles, no broken refs, waves ≤ 8 wide
58
+ 4. **Artifact Wiring** — every produced artifact is consumed downstream or referenced in PRD
59
+ 5. **Context Budget** — ≤ 12 tasks, ≤ 30 aggregate files
60
+ 6. **Constraint Compliance** — no violations of `.dw/rules/`, CONTEXT.md `## Decisions`, CLAUDE.md
61
+
62
+ ### 3. Process verdict
63
+
64
+ **PASS:**
65
+
66
+ - Append to `.dw/audit/plan-checks-<YYYY-MM-DD>.log`:
67
+ ```
68
+ <ISO-8601> PASS {{PRD_PATH}} <task_count> tasks, <wave_count> waves
69
+ ```
70
+ - Print: `Plan verification PASS — proceed to /dw-execute-phase {{PRD_PATH}}`
71
+
72
+ **REVISE:**
73
+
74
+ - Append to audit log with `REVISE` verdict
75
+ - Print the issues per dimension
76
+ - Suggest: `/dw-create-tasks --revise --issues <generated-issues-file>` OR manual edits
77
+ - Exit status: `PLAN-CHECK-REVISE`
78
+
79
+ **BLOCK:**
80
+
81
+ - Append to audit log with `BLOCK` verdict
82
+ - Print the conflicting issues with file:line
83
+ - Suggest: resolve the locked-decision conflict (update CONTEXT.md, OR change the plan to honor it)
84
+ - Exit status: `PLAN-CHECK-BLOCK`
85
+
86
+ ### 4. Output format
87
+
88
+ ```markdown
89
+ # Plan Verification — <prd-slug>
90
+
91
+ **Verdict:** PASS | REVISE | BLOCK
92
+ **PRD:** {{PRD_PATH}}
93
+ **Tasks file:** {{PRD_PATH}}/tasks.md (<N> tasks across <M> waves)
94
+ **Verified at:** <ISO-8601>
95
+
96
+ ## Dimensions
97
+
98
+ | # | Dimension | Status | Issues |
99
+ |---|-----------|--------|--------|
100
+ | 1 | Requirement Coverage | ✓ / ✗ | <count> |
101
+ | 2 | Task Completeness | ✓ / ✗ | <count> |
102
+ | 3 | Dependency Soundness | ✓ / ✗ | <count> |
103
+ | 4 | Artifact Wiring | ✓ / ✗ | <count> |
104
+ | 5 | Context Budget | ✓ / ✗ | <count> |
105
+ | 6 | Constraint Compliance | ✓ / ✗ | <count> |
106
+
107
+ ## Issues (REVISE/BLOCK only)
108
+
109
+ [detailed issues per dimension; cite file:line]
110
+
111
+ ## Recommendation
112
+
113
+ - PASS → `/dw-execute-phase {{PRD_PATH}}`
114
+ - REVISE → `/dw-create-tasks --revise` and re-run this command
115
+ - BLOCK → resolve [list of locked-decision conflicts] then re-plan
116
+ ```
117
+
118
+ ## Critical Rules
119
+
120
+ - <critical>The agent owns verification logic. NEVER inline checks in this command.</critical>
121
+ - <critical>Read-only. Plan-checker MUST NOT modify any file in the project.</critical>
122
+ - <critical>Audit log is append-only. NEVER edit prior entries.</critical>
123
+ - <critical>BLOCK is reserved for hard conflicts (locked decisions, cycles). REVISE is for fixable issues.</critical>
124
+ - Do NOT auto-trigger `/dw-create-tasks` on REVISE. The user decides whether to re-run.
125
+
126
+ ## Error Handling
127
+
128
+ - `tasks.md` missing → exit `PLAN-CHECK-FAILED` with hint: "Run `/dw-create-tasks {{PRD_PATH}}` first"
129
+ - `prd.md` missing → exit `PLAN-CHECK-FAILED`: "PRD not found; is the path correct?"
130
+ - Agent times out (>5 min) → exit `PLAN-CHECK-TIMEOUT`: "Plan too large; consider splitting via `/dw-create-tasks --split`"
131
+ - Cycle detected in dependencies → BLOCK with the cycle path; do NOT attempt to break it automatically
132
+
133
+ ## Integration With Other dw-* Commands
134
+
135
+ - **`/dw-create-tasks`** — predecessor; produces the `tasks.md` this command verifies
136
+ - **`/dw-execute-phase`** — wraps this command as a gate before execution
137
+ - **`/dw-autopilot`** — wraps `/dw-create-tasks` → this command → `/dw-execute-phase` with hard gates between
138
+ - **`/dw-resume`** — when resuming after a checkpoint, this command verifies the remaining tasks still satisfy the goal
139
+
140
+ ## Inspired by
141
+
142
+ `dw-plan-checker` is dev-workflow-native. The 6-dimension goal-backward verification protocol is adapted from [`get-shit-done-cc`](https://github.com/gsd-build/get-shit-done) (`/gsd-plan-phase`, `gsd-plan-checker`) by gsd-build (MIT license). dev-workflow specifics: verifies `tasks.md` (not GSD's PLAN.md), uses dev-workflow's PRD/TechSpec/Tasks vocabulary, audit log for `--skip-check` trail.
143
+
144
+ </system_instructions>
@@ -38,26 +38,44 @@ You are a quick task executor. This command exists to implement one-off changes
38
38
  8. Invoke `dw-verify` and include the VERIFICATION REPORT in the output before committing. Without PASS, DO NOT commit.
39
39
  9. Create atomic semantic commit with the change
40
40
 
41
- ## GSD Integration
41
+ ## Task Tracking
42
42
 
43
- <critical>When GSD is installed, delegation to /gsd-quick is MANDATORY for tracking.</critical>
43
+ <critical>Every `/dw-quick` execution writes a tracking entry to `.dw/spec/quick/<slug>.md` so the change is discoverable later.</critical>
44
44
 
45
- If GSD (get-shit-done-cc) is installed in the project:
46
- - Delegate to `/gsd-quick` for tracking in `.planning/quick/`
47
- - The task is registered in history for future lookup via `/dw-intel`
45
+ Tracking format (single file per quick task):
48
46
 
49
- If GSD is NOT installed:
50
- - Execute directly with Level 1 validation
51
- - No history tracking (only git log)
47
+ ```markdown
48
+ ---
49
+ type: quick-task
50
+ schema_version: "1.0"
51
+ status: COMPLETE | PARTIAL | ABORTED
52
+ date: YYYY-MM-DD
53
+ files_touched: [...]
54
+ commit: <SHA>
55
+ ---
56
+
57
+ # Quick Task — <slug>
58
+
59
+ ## Description
60
+ <one-line description from the user's prompt>
61
+
62
+ ## Files
63
+ <list>
64
+
65
+ ## Verification
66
+ <dw-verify report excerpt>
67
+ ```
68
+
69
+ Subsequent `/dw-intel` queries surface these via the file index.
52
70
 
53
71
  ## Codebase Intelligence
54
72
 
55
- If `.planning/intel/` exists, query before implementing:
56
- - Internally run: `/gsd-intel "implementation patterns in [target area]"`
73
+ If `.dw/intel/` exists, query before implementing:
74
+ - Internally run: `/dw-intel "implementation patterns in [target area]"`
57
75
  - Follow the patterns found
58
76
 
59
- If `.planning/intel/` does NOT exist:
60
- - Use only `.dw/rules/` as context
77
+ If `.dw/intel/` does NOT exist:
78
+ - Use only `.dw/rules/` as context (or grep directly if `.dw/rules/` is also absent)
61
79
 
62
80
  ## Response Format
63
81
 
@@ -64,17 +64,13 @@ Use diagnostic tools based on the project's framework:
64
64
  7. **VALIDATE**: capture after-state in BOTH resolutions (mobile and desktop), compare before/after, verify accessibility (WCAG 2.2 via `ui-ux-pro-max`), run react-doctor `--diff` if React. If `webapp-testing` is available, capture screenshots at 375px viewport (mobile) and 1440px viewport (desktop).
65
65
  8. **PERSIST CONTRACT**: if the user approved a direction, generate `design-contract.md` in the PRD directory (`.dw/spec/prd-[name]/design-contract.md`) with: approved direction, color palette, typography pairing, layout rules, accessibility rules, and component rules. This contract will be read by `dw-run-task` and `dw-run-plan` to ensure visual consistency.
66
66
 
67
- ## GSD Integration
67
+ ## Codebase Intelligence
68
68
 
69
- <critical>When GSD is installed, registering the design contract in .planning/ and querying .planning/intel/ are MANDATORY.</critical>
69
+ <critical>If `.dw/intel/` exists, querying it via `/dw-intel` is MANDATORY in the audit phase to surface existing UI patterns.</critical>
70
70
 
71
- If GSD (get-shit-done-cc) is installed in the project:
72
- - After generating the design contract, register in `.planning/` for cross-session persistence
73
- - Query `.planning/intel/` in the audit phase for existing UI patterns
74
-
75
- If GSD is NOT installed:
76
- - The design contract works normally (file-based in `.dw/spec/`)
77
- - Audit uses only `.dw/rules/` for context
71
+ - Audit phase: internally run `/dw-intel "UI components, design patterns, layout conventions"` before proposing redesign directions
72
+ - The design contract (`.dw/spec/prd-[name]/design-contract.md`) is the single source of truth for visual consistency — it's read by `/dw-run-task` and `/dw-run-plan` and persists across sessions naturally (no separate registration needed)
73
+ - If `.dw/intel/` does NOT exist, fall back to `.dw/rules/` and direct grep over `apps/web/src/` (or equivalent frontend root)
78
74
 
79
75
  ## Preferred Response Format
80
76
 
@@ -31,13 +31,14 @@ For Angular projects, use `ng lint` as an analytical complement.
31
31
 
32
32
  ## Codebase Intelligence
33
33
 
34
- <critical>If `.planning/intel/` exists, querying it is MANDATORY before writing requirements. Do NOT skip this step.</critical>
35
- - Internally run: `/gsd-intel "tech debt, decision spaces, and known technical debt"`
36
- - Contextualize findings with already documented decisions
34
+ <critical>If `.dw/intel/` exists, querying it via `/dw-intel` is MANDATORY before flagging refactoring opportunities. Do NOT skip this step.</critical>
35
+ - Internally run: `/dw-intel "tech debt and known technical decisions"`
36
+ - Contextualize findings with documented decisions in `.dw/rules/`
37
37
  - Avoid flagging as a smell something that is an intentional recorded decision
38
38
 
39
- If `.planning/intel/` does NOT exist:
40
- - Use `.dw/rules/` as context (current behavior)
39
+ If `.dw/intel/` does NOT exist:
40
+ - Use `.dw/rules/` as context, falling back to grep
41
+ - Suggest running `/dw-map-codebase` to enrich downstream context
41
42
 
42
43
  ## Input Variables
43
44
 
@@ -40,17 +40,19 @@ You are a session continuity assistant. This command exists to restore context f
40
40
  6. Present the summary in the format below (including a "From where we left off" bullet list based on memory)
41
41
  7. Suggest the next command to execute
42
42
 
43
- ## GSD Integration
43
+ ## Cross-Session State
44
44
 
45
- <critical>When GSD is installed, delegation to /gsd-resume-work is MANDATORY, not optional.</critical>
45
+ <critical>If `.dw/spec/active-session.md` exists (written by `/dw-execute-phase` at checkpoint), reading it is MANDATORY to restore the last-known position.</critical>
46
46
 
47
- If GSD (get-shit-done-cc) is installed in the project:
48
- - Delegate to `/gsd-resume-work` for cross-session state restoration from `.planning/STATE.md`
49
- - Incorporate additional context: persistent threads, backlog, notes
47
+ Read order for cross-session context:
50
48
 
51
- If GSD is NOT installed:
52
- - Use only `.dw/spec/` and git log as context sources
53
- - Full functionality, just without advanced cross-session persistence
49
+ 1. `.dw/spec/active-session.md` last completed task, next task, blockers, open deviations (written by `/dw-execute-phase` when it checkpoints at 70% context budget OR when the user signals stop)
50
+ 2. `.dw/spec/prd-*/SUMMARY.md` completed phase summaries (most recent ones)
51
+ 3. Latest commits via `git log --oneline -20` — what landed on the current branch
52
+ 4. Open deviations via `.dw/spec/prd-*/deviations.md` — any unresolved Rule 1/2/3 entries
53
+ 5. Active PRD detection — the directory under `.dw/spec/` whose `tasks.md` has the most recent uncompleted task
54
+
55
+ If `.dw/spec/active-session.md` is absent (no checkpoint was written; clean session boundary), fall back to git log + `tasks.md` state across active PRDs.
54
56
 
55
57
  ## Response Format
56
58
 
@@ -159,36 +159,30 @@ If a task FAILS during execution:
159
159
  4. Wait for manual intervention from the user
160
160
  5. **DO NOT** automatically continue to the next task
161
161
 
162
- ## GSD Integration
162
+ ## Plan Verification + Parallel Execution
163
163
 
164
- <critical>When GSD is installed, plan verification and parallel execution are MANDATORY, not optional. The command MUST NOT skip these steps.</critical>
164
+ <critical>Plan verification and wave-based parallel execution are MANDATORY, not optional. Both are now native to dev-workflow via the `dw-execute-phase` bundled skill.</critical>
165
165
 
166
166
  ### Plan Verification (Pre-Execution)
167
167
 
168
- If GSD (get-shit-done-cc) is installed in the project:
169
- - Before starting execution, delegate to GSD's plan-checker agent
170
- - The verifier analyzes: cyclic dependencies, task viability, risks, PRD requirements coverage
171
- - If FAIL: present issues found and suggest fixes. Maximum 3 correction cycles
168
+ Before starting execution, delegate to `/dw-plan-checker {{PRD_PATH}}`:
169
+ - The plan-checker agent verifies the 6 dimensions (requirement coverage, task completeness, dependency soundness, artifact wiring, context budget, constraint compliance)
170
+ - If REVISE: present issues found and suggest fixes. Maximum 3 correction cycles via `/dw-create-tasks --revise`
171
+ - If BLOCK: surface conflict to user, do NOT auto-replan
172
172
  - If PASS: proceed to execution
173
173
 
174
- If GSD is NOT installed:
175
- - Skip verification and execute directly (current behavior)
176
-
177
174
  ### Parallel Execution (Wave-Based)
178
175
 
179
- If GSD (get-shit-done-cc) is installed in the project:
180
- - Analyze each task's `blockedBy` field to build the dependency graph
181
- - Group tasks into waves:
182
- - Wave 1: tasks with no dependencies (can run in parallel)
176
+ After plan-checker PASS, delegate to `/dw-execute-phase {{PRD_PATH}}`:
177
+ - The executor agent analyzes each task's `Depends on:` field to build the dependency graph
178
+ - Groups tasks into waves:
179
+ - Wave 1: tasks with no dependencies (run in parallel)
183
180
  - Wave 2: tasks that depend on Wave 1 tasks
184
181
  - Wave N: and so on
185
- - Delegate each wave to GSD's parallel execution engine (`/gsd-execute-phase`)
186
- - Each task runs in an isolated worktree with fresh context
187
- - Results are merged after the wave completes
188
- - If any task in a wave fails: pause the wave, report, await user decision
189
-
190
- If GSD is NOT installed:
191
- - Execute sequentially as today (current behavior)
182
+ - Each wave dispatches subagents in parallel (one per task)
183
+ - Results merged after the wave completes
184
+ - If any task in a wave fails permanently (Rule 3 deviation): pause the wave, report, await user decision
185
+ - The executor commits atomically per task and writes `SUMMARY.md` after the final wave
192
186
 
193
187
  ### Design Contracts
194
188
 
@@ -9,7 +9,7 @@ You are an AI assistant specialized in Quality Assurance. Your task is to valida
9
9
  ## Pipeline Position
10
10
  **Predecessor:** `/dw-run-plan` or `/dw-run-task` | **Successor:** `/dw-code-review` (auto-fixes bugs internally before completing)
11
11
 
12
- <critical>Use the Playwright MCP to execute all E2E tests</critical>
12
+ <critical>In UI mode, use the Playwright MCP for all E2E tests. In API mode (no UI in the project, OR `--api` flag), use the bundled `api-testing-recipes` skill to generate `.http` / pytest+httpx / supertest / WebApplicationFactory / reqwest scripts and capture request/response logs as evidence.</critical>
13
13
  <critical>Verify ALL requirements from the PRD and TechSpec before approving</critical>
14
14
  <critical>QA is NOT complete until ALL checks pass</critical>
15
15
  <critical>Document ALL bugs found with screenshot evidence</critical>
@@ -20,9 +20,10 @@ You are an AI assistant specialized in Quality Assurance. Your task is to valida
20
20
 
21
21
  When available in the project under `./.agents/skills/`, use these skills as operational support without replacing this command:
22
22
 
23
- - `webapp-testing`: support for structuring test flows, retests, screenshots, and logs when complementary to Playwright MCP
24
- - `vercel-react-best-practices`: use only if the frontend under test is React/Next.js and there is indication of regression related to rendering, fetching, hydration, or perceived performance
25
- - `ui-ux-pro-max`: use when validating design consistency, color palettes, typography, spacing, and visual hierarchy against industry standards
23
+ - `webapp-testing`: (UI mode) support for structuring test flows, retests, screenshots, and logs when complementary to Playwright MCP
24
+ - `vercel-react-best-practices`: (UI mode) use only if the frontend under test is React/Next.js and there is indication of regression related to rendering, fetching, hydration, or perceived performance
25
+ - `ui-ux-pro-max`: (UI mode) use when validating design consistency, color palettes, typography, spacing, and visual hierarchy against industry standards
26
+ - `api-testing-recipes`: **(API mode — ALWAYS)** validated snippets for `.http`, pytest+httpx, supertest, WebApplicationFactory, reqwest. Composes per-RF test files in `QA/scripts/api/` and JSONL logs in `QA/logs/api/` per its references
26
27
 
27
28
  ## Analysis Tools
28
29
 
@@ -38,12 +39,13 @@ When available in the project under `./.agents/skills/`, use these skills as ope
38
39
  ## Objectives
39
40
 
40
41
  1. Validate implementation against PRD, TechSpec, and Tasks
41
- 2. Execute E2E tests with Playwright MCP
42
- 3. Cover positive, negative, boundary, and relevant regression scenarios
43
- 4. Verify accessibility (WCAG 2.2)
44
- 5. Perform visual checks
45
- 6. Document bugs found
46
- 7. Generate final QA report
42
+ 2. **Detect mode** (UI vs API-only) and pick the right execution path
43
+ 3. Execute E2E tests via Playwright MCP (UI mode) OR via the `api-testing-recipes` skill (API mode)
44
+ 4. Cover positive, negative, boundary, and relevant regression scenarios
45
+ 5. Verify accessibility (UI mode = WCAG 2.2; API mode = error-shape and surface contracts)
46
+ 6. Perform visual checks (UI mode only — skipped in API mode)
47
+ 7. Document bugs found
48
+ 8. Generate final QA report
47
49
 
48
50
  ## File Locations
49
51
 
@@ -56,10 +58,13 @@ When available in the project under `./.agents/skills/`, use these skills as ope
56
58
  - Evidence folder (required): `{{PRD_PATH}}/QA/`
57
59
  - Output Report: `{{PRD_PATH}}/QA/qa-report.md`
58
60
  - Bugs found: `{{PRD_PATH}}/QA/bugs.md`
59
- - Screenshots: `{{PRD_PATH}}/QA/screenshots/`
60
- - Logs (console/network): `{{PRD_PATH}}/QA/logs/`
61
- - Playwright test scripts: `{{PRD_PATH}}/QA/scripts/`
61
+ - Screenshots (UI mode): `{{PRD_PATH}}/QA/screenshots/`
62
+ - Logs — UI (console/network): `{{PRD_PATH}}/QA/logs/`
63
+ - Logs API (JSONL request/response): `{{PRD_PATH}}/QA/logs/api/`
64
+ - Playwright test scripts (UI mode): `{{PRD_PATH}}/QA/scripts/`
65
+ - API test scripts (API mode — `.http` / pytest+httpx / supertest / etc.): `{{PRD_PATH}}/QA/scripts/api/`
62
66
  - Consolidated checklist: `{{PRD_PATH}}/QA/checklist.md`
67
+ - API-testing recipes (skill): `.agents/skills/api-testing-recipes/`
63
68
 
64
69
  ## Multi-Project Context
65
70
 
@@ -74,6 +79,43 @@ Refer to `.dw/rules/` for project-specific URLs and frameworks.
74
79
 
75
80
  ## Process Steps
76
81
 
82
+ ### 0. Mode Detection (UI vs API) -- Required FIRST
83
+
84
+ Decide whether the project has a testable UI or is API-only before any browser/API setup. The chosen mode drives every subsequent step.
85
+
86
+ **Auto-detection (same matrix used by `/dw-dockerize`):**
87
+
88
+ | Signal | UI mode | API mode |
89
+ |--------|---------|----------|
90
+ | `package.json` deps | `next`, `vite`, `react`, `vue`, `svelte`, `@angular/*`, `nuxt`, `astro`, `solid-js`, `remix` | none of the above |
91
+ | `pyproject.toml` / `requirements*.txt` | `jinja2`, `django` (full), `flask` + `flask_login`/`render_template` | `fastapi`, `flask` (JSON only), `starlette`, `litestar` |
92
+ | `*.csproj` | `Microsoft.AspNetCore.Mvc`, Razor, Blazor | `Microsoft.AspNetCore.Mvc.Core` only, minimal API templates |
93
+ | `Cargo.toml` | `yew`, `leptos`, `dioxus`, `sycamore` | `axum`, `actix-web`, `rocket`, `warp` (no template engine) |
94
+
95
+ If NO UI signals match → **API mode**. If at least one matches → **UI mode** (default).
96
+
97
+ **Manual override (flags):**
98
+
99
+ - `--api` forces API mode (useful when running headless API tests inside a fullstack project where the UI is irrelevant for this run).
100
+ - `--ui` forces UI mode (raises a clear error if no UI dep is detected — this prevents accidentally running browser tests against a backend-only repo).
101
+ - `--from-openapi <path-or-url>` adds an OpenAPI baseline on top of API mode (see `.agents/skills/api-testing-recipes/references/openapi-driven.md`).
102
+
103
+ **Effect on subsequent steps:**
104
+
105
+ | Step | UI mode | API mode |
106
+ |------|---------|----------|
107
+ | 2 — Environment Preparation | full Playwright + browser setup | API client setup, no browser; create `QA/scripts/api/` and `QA/logs/api/` |
108
+ | 3 — Menu Page Verification | required, blocking | **skipped** |
109
+ | 4 — E2E Tests | Playwright MCP | `api-testing-recipes` skill (recipe per stack) |
110
+ | 5 — Accessibility | WCAG 2.2 with browser tools | API-surface checks (error shape, status semantics, leak detection) |
111
+ | 6 — Visual Checks | required (mobile + desktop) | **skipped** |
112
+ | 7-8 — Bug Documentation + Report | screenshots as evidence | JSONL logs as evidence (`evidence_type: api-log`) |
113
+ | 9 — Fix-Retest Loop | unchanged shape; replays Playwright | unchanged shape; replays the recipe and writes new log line |
114
+
115
+ Record the chosen mode in the QA report frontmatter (`mode: ui | api | mixed`). When in doubt, ask the user before proceeding — never silently fall back.
116
+
117
+ <critical>If neither UI nor API signal is detectable (e.g., empty repo), abort with: "Cannot determine QA mode. Run `/dw-analyze-project` first OR pass `--ui` or `--api` explicitly."</critical>
118
+
77
119
  ### 1. Documentation Analysis (Required)
78
120
 
79
121
  - Read the PRD and extract ALL numbered functional requirements (RF-XX)
@@ -109,9 +151,11 @@ If NO credentials are found, STOP and ask the user before continuing. Do NOT gue
109
151
  - Confirm the page loaded correctly with `browser_snapshot`
110
152
  - If persistent session, auth import, or network inspection beyond MCP is needed, complement with `webapp-testing`
111
153
 
112
- ### 3. Menu Page Verification (Required -- Execute BEFORE RF tests)
154
+ ### 3. Menu Page Verification (UI mode only -- Required, Execute BEFORE RF tests)
113
155
 
114
- <critical>BEFORE testing individual RFs, verify that EACH menu item in the module leads to a FUNCTIONAL and UNIQUE page. This verification is blocking -- if it fails, QA CANNOT be approved.</critical>
156
+ **In API mode, this step is SKIPPED.** API surfaces have no menus; the equivalent check (every advertised endpoint exists and answers) is folded into Step 4-API.
157
+
158
+ <critical>(UI mode) BEFORE testing individual RFs, verify that EACH menu item in the module leads to a FUNCTIONAL and UNIQUE page. This verification is blocking -- if it fails, QA CANNOT be approved.</critical>
115
159
 
116
160
  For each menu item in the module:
117
161
  1. Navigate to the page via `browser_navigate`
@@ -146,7 +190,11 @@ digraph menu_check {
146
190
  }
147
191
  ```
148
192
 
149
- ### 4. E2E Tests with Playwright MCP (Required)
193
+ ### 4. E2E Tests (Required, mode-aware)
194
+
195
+ This step has two branches; pick the one matching the mode chosen in Step 0.
196
+
197
+ #### 4-UI (UI mode) -- Playwright MCP
150
198
 
151
199
  Use Playwright MCP tools to test each flow:
152
200
 
@@ -179,6 +227,39 @@ For each functional requirement from the PRD:
179
227
  <critical>It is not enough to validate only the happy path. Each requirement must be exercised against its boundary states and most likely regressions</critical>
180
228
  <critical>If a requirement cannot be fully validated via E2E, QA must be marked as REJECTED or BLOCKED, never APPROVED</critical>
181
229
 
230
+ #### 4-API (API mode) -- `api-testing-recipes` skill
231
+
232
+ Use the bundled `api-testing-recipes` skill to compose tests. The skill picks the right recipe per stack (default `.http` / REST Client; `pytest+httpx`, `supertest`, `WebApplicationFactory`, `reqwest` per language) and writes scripts and JSONL logs as evidence.
233
+
234
+ Process:
235
+
236
+ 1. **Read** `.agents/skills/api-testing-recipes/SKILL.md` and select the recipe that matches the project's primary backend stack. Default to `recipes/http-rest-client.md` unless the project already runs `pytest`/`vitest`/`dotnet test`/`cargo test`, in which case prefer the matching stack-specific recipe so QA tests live alongside unit tests.
237
+ 2. **For each functional requirement (RF-XX) in the PRD**, derive the matrix per `.agents/skills/api-testing-recipes/references/matrix-conventions.md`:
238
+ - 200 happy path
239
+ - 4xx -- validation (missing field, wrong type, out of range)
240
+ - 4xx -- auth (no token, expired, malformed)
241
+ - 4xx -- authorization (valid token, wrong role)
242
+ - 4xx -- not found
243
+ - 4xx -- conflict
244
+ - 5xx -- server error (only if synthetically reproducible)
245
+ - **Contract drift** (response shape vs OpenAPI / TS types) -- mandatory
246
+ - **Authorization cross-tenant** (token from another org) -- mandatory if multi-tenant
247
+ 3. **Generate one file per RF** at `{{PRD_PATH}}/QA/scripts/api/RF-XX-[slug].<ext>` using the recipe's structure. Wire credentials via the patterns in `.agents/skills/api-testing-recipes/references/auth-patterns.md` (NEVER hardcode tokens).
248
+ 4. **Execute** each request (`curl` for `.http`; the project's runner for stack-specific). For EACH request, append a JSONL line to `{{PRD_PATH}}/QA/logs/api/RF-XX-[slug].log` per `references/log-conventions.md`. Redact `Authorization`/`Cookie`/`X-API-Key` headers and any response field matching `password*`/`secret*`/`*_hash`/`token*`.
249
+ 5. **Assert** per matrix expectation:
250
+ - Status code matches expected
251
+ - Response body matches schema (use `jq` for `.http` mode, framework matchers per stack)
252
+ - Required headers present (e.g., `Content-Type: application/json`)
253
+ - No leaked internal fields
254
+ 6. **Mark the requirement** as PASSED or FAILED with a one-line summary citing the log file path and (if FAILED) the failing JSONL line number.
255
+ 7. **Optional**: if the project exposes an OpenAPI spec (`openapi.yaml`, `openapi.json`, runtime `/openapi.json`), follow `references/openapi-driven.md` to generate a baseline. Add the `--from-openapi <path-or-url>` flag to make this explicit.
256
+
257
+ OpenAPI baseline note: if `--from-openapi` is used, the generated tests live alongside hand-derived ones with filename pattern `openapi-RF-XX-[path-slug].<ext>`. Tag any unmapped spec endpoint as a documentation gap in the QA report (`openapi-no-rf-*`).
258
+
259
+ <critical>(API mode) Every endpoint that mutates or reads tenant-scoped data MUST have a cross-tenant denial test. Skipping is allowed only for explicitly single-tenant systems and must be recorded as a `pytest.skip`/`it.skip`/equivalent with a reason.</critical>
260
+ <critical>(API mode) Logs are evidence. Every PASS or FAIL claim in the QA report must cite a JSONL line under `QA/logs/api/`. No log = no evidence = QA cannot be APPROVED.</critical>
261
+ <critical>(API mode) NEVER hardcode tokens or credentials in committed scripts. Use `@variable`/env-var references.</critical>
262
+
182
263
  ### 4.1. Required Minimum Matrix per Requirement
183
264
 
184
265
  For each RF, QA must explicitly answer:
@@ -201,9 +282,9 @@ Examples of edge cases that must be considered whenever relevant:
201
282
  - re-entrance/repeated actions
202
283
  - API failures, loading, and intermediate states
203
284
 
204
- ### 5. Accessibility Checks (Required)
285
+ ### 5. Accessibility / API-Surface Checks (Required, mode-aware)
205
286
 
206
- Verify for each screen/component (WCAG 2.2):
287
+ In **UI mode**, verify each screen/component against WCAG 2.2:
207
288
 
208
289
  - [ ] Keyboard navigation works (Tab, Enter, Escape)
209
290
  - [ ] Interactive elements have descriptive labels
@@ -217,13 +298,26 @@ Verify for each screen/component (WCAG 2.2):
217
298
  Use `browser_press_key` to test keyboard navigation.
218
299
  Use `browser_snapshot` to verify labels and semantic structure.
219
300
 
220
- ### 6. Visual Checks (Required)
301
+ **In API mode**, the WCAG checklist above is REPLACED by API-surface checks:
302
+
303
+ - [ ] Every endpoint returns the correct `Content-Type` header
304
+ - [ ] Errors follow a consistent shape (e.g., `{ "error": { "code": "...", "message": "..." } }`)
305
+ - [ ] `401` (auth missing/invalid) is distinct from `403` (auth present but unauthorized)
306
+ - [ ] Error responses do NOT leak stack traces, internal IDs, SQL fragments, or environment hints
307
+ - [ ] Sensitive fields (`password*`, `*_hash`, `secret*`, `token*`) NEVER appear in any response body
308
+ - [ ] Rate-limited endpoints return `429` with a `Retry-After` header (when applicable)
309
+
310
+ Each check FAILED becomes a HIGH severity bug in `QA/bugs.md` with `evidence_type: api-log` pointing to the failing JSONL line.
311
+
312
+ ### 6. Visual Checks (UI mode only -- Required)
313
+
314
+ **In API mode, this step is SKIPPED.** The QA report omits the "Visual" section entirely.
221
315
 
222
316
  - Capture screenshots of main screens with `browser_take_screenshot` and save to `{{PRD_PATH}}/QA/screenshots/`
223
317
  - Check layouts in different states (empty, with data, error, loading)
224
318
  - Document visual inconsistencies found
225
319
 
226
- ### 6.1. Mobile Validation (Required)
320
+ ### 6.1. Mobile Validation (UI mode only -- Required)
227
321
 
228
322
  <critical>ALL visual checks MUST include tests at mobile viewport (375px) IN ADDITION to desktop (1440px). QA approval REQUIRES that BOTH resolutions are functional and visually acceptable. If the mobile layout is broken, unusable, or visually degraded, QA CANNOT be approved.</critical>
229
323
 
@@ -246,13 +340,15 @@ For each bug found, create an entry in `{{PRD_PATH}}/QA/bugs.md`:
246
340
 
247
341
  - **Severity:** High/Medium/Low
248
342
  - **Affected RF:** RF-XX
249
- - **Component:** [component/page]
343
+ - **Component:** [component/page or endpoint path]
344
+ - **Mode:** ui | api
250
345
  - **Steps to Reproduce:**
251
346
  1. [step 1]
252
347
  2. [step 2]
253
348
  - **Expected Result:** [what should happen]
254
349
  - **Actual Result:** [what happens]
255
- - **Screenshot:** `QA/screenshots/[file].png`
350
+ - **Evidence type:** screenshot | api-log
351
+ - **Evidence path:** `QA/screenshots/[file].png` (UI mode) OR `QA/logs/api/RF-XX-[slug].log#L<line>` (API mode)
256
352
  - **Status:** Open
257
353
  ```
258
354
 
@@ -296,10 +392,15 @@ Generate report in `{{PRD_PATH}}/QA/qa-report.md`:
296
392
  [Final QA assessment]
297
393
  ```
298
394
 
299
- ### 9. QA Fix-Retest Loop (Automatic)
395
+ ### 9. QA Fix-Retest Loop (Automatic, mode-aware)
300
396
 
301
397
  <critical>QA does NOT end at the first report. If bugs are found, enter an automatic fix-retest loop until QA is APPROVED or explicitly BLOCKED.</critical>
302
398
 
399
+ **Mode-aware behavior:** the loop's structure (max 5 cycles, atomic commit per fix, regression checks, exit criteria) is identical in both modes. What changes is the EVIDENCE replayed:
400
+
401
+ - UI mode: re-run the Playwright flow, capture new `BUG-NN-retest.png` screenshot.
402
+ - API mode: re-run the same `.http`/recipe via the recipe's runner, append a new line to `QA/logs/api/BUG-NN-retest.log` with `verdict: "PASS"` (closes the bug) or `verdict: "FAIL"` (keeps the cycle going).
403
+
303
404
  After generating the initial QA report:
304
405
 
305
406
  ```dot
@@ -25,15 +25,16 @@ When available in the project at `./.agents/skills/`, use these skills as specia
25
25
 
26
26
  ## Codebase Intelligence
27
27
 
28
- <critical>If `.planning/intel/` exists, querying it is MANDATORY before writing requirements. Do NOT skip this step.</critical>
29
- - Internally run: `/gsd-intel "implementation patterns in [task target area]"`
28
+ <critical>If `.dw/intel/` exists, querying it via `/dw-intel` is MANDATORY before writing code. Do NOT skip this step.</critical>
29
+ - Internally run: `/dw-intel "implementation patterns in [task target area]"`
30
30
  - Follow conventions found for file structure, naming, and error handling
31
31
 
32
32
  If `design-contract.md` exists in the PRD directory:
33
33
  - Read the contract and ensure all frontend implementation follows the approved design rules
34
34
 
35
- If `.planning/intel/` does NOT exist:
36
- - Use `.dw/rules/` as context (current behavior)
35
+ If `.dw/intel/` does NOT exist:
36
+ - Use `.dw/rules/` as context, falling back to direct grep
37
+ - Suggest running `/dw-map-codebase` after the task to enrich downstream context
37
38
 
38
39
  ## File Locations
39
40
 
@@ -78,7 +78,9 @@ npx -y @brunosps00/dev-workflow@latest update --lang=$DETECTED_LANG
78
78
  The `update` command overwrites managed files and PRESERVES:
79
79
  - `.dw/rules/` (user rules)
80
80
  - `.dw/spec/` (in-progress PRDs and tasks)
81
- - `.planning/` (user data)
81
+ - `.dw/intel/` (codebase index from `/dw-map-codebase`)
82
+
83
+ The `update` command also runs the GSD migration step automatically — if a project has legacy `.planning/` (from prior GSD usage), the contents are migrated to `.dw/intel/`, `.dw/spec/active-session.md`, `.dw/spec/quick/`, etc., and `.planning/` is renamed to `.planning.gsd-archive-<DATE>/` for inspection. The `.claude/commands/gsd/`, `.claude/agents/gsd-*.md`, `.claude/hooks/gsd-*.js`, and `.claude/gsd-file-manifest.json` files are removed during the migration.
82
84
 
83
85
  If the update fails (network error, permission, package unavailable): report the error to the user and STOP. Do NOT attempt manual workarounds like copying files by hand.
84
86
 
@@ -22,7 +22,7 @@ Focus on the problem, not the solution. Avoid jumping into "how to implement".]
22
22
  Sources:
23
23
  - PRDs in `.dw/spec/prd-*/prd.md` (features already delivered or in development)
24
24
  - `.dw/rules/index.md` (product overview)
25
- - `.planning/intel/` if GSD is installed
25
+ - `.dw/intel/` (queryable index built by `/dw-map-codebase`, queried via `/dw-intel`)
26
26
 
27
27
  Format:]
28
28