@brunosps00/dev-workflow 0.13.0 → 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.
- package/README.md +106 -122
- package/lib/constants.js +16 -36
- package/lib/migrate-skills.js +11 -4
- package/lib/removed-commands.js +30 -0
- package/package.json +1 -1
- package/scaffold/en/agent-instructions.md +27 -16
- package/scaffold/en/commands/dw-adr.md +2 -2
- package/scaffold/en/commands/dw-analyze-project.md +7 -7
- package/scaffold/en/commands/dw-autopilot.md +20 -20
- package/scaffold/en/commands/dw-brainstorm.md +160 -9
- package/scaffold/en/commands/dw-bugfix.md +7 -6
- package/scaffold/en/commands/dw-commit.md +1 -1
- package/scaffold/en/commands/dw-dockerize.md +9 -9
- package/scaffold/en/commands/dw-find-skills.md +4 -4
- package/scaffold/en/commands/dw-functional-doc.md +2 -2
- package/scaffold/en/commands/dw-generate-pr.md +4 -4
- package/scaffold/en/commands/dw-help.md +95 -351
- package/scaffold/en/commands/dw-intel.md +76 -12
- package/scaffold/en/commands/dw-new-project.md +9 -9
- package/scaffold/en/commands/dw-plan.md +175 -0
- package/scaffold/en/commands/dw-qa.md +166 -0
- package/scaffold/en/commands/dw-redesign-ui.md +7 -7
- package/scaffold/en/commands/dw-review.md +198 -0
- package/scaffold/en/commands/dw-run.md +176 -0
- package/scaffold/en/commands/dw-secure-audit.md +222 -0
- package/scaffold/en/commands/dw-update.md +1 -1
- package/scaffold/en/references/playwright-patterns.md +1 -1
- package/scaffold/en/references/refactoring-catalog.md +1 -1
- package/scaffold/en/templates/brainstorm-matrix.md +1 -1
- package/scaffold/en/templates/idea-onepager.md +3 -3
- package/scaffold/en/templates/project-onepager.md +5 -5
- package/scaffold/pt-br/agent-instructions.md +27 -16
- package/scaffold/pt-br/commands/dw-adr.md +2 -2
- package/scaffold/pt-br/commands/dw-analyze-project.md +7 -7
- package/scaffold/pt-br/commands/dw-autopilot.md +20 -20
- package/scaffold/pt-br/commands/dw-brainstorm.md +160 -9
- package/scaffold/pt-br/commands/dw-bugfix.md +10 -9
- package/scaffold/pt-br/commands/dw-commit.md +1 -1
- package/scaffold/pt-br/commands/dw-dockerize.md +9 -9
- package/scaffold/pt-br/commands/dw-find-skills.md +4 -4
- package/scaffold/pt-br/commands/dw-functional-doc.md +2 -2
- package/scaffold/pt-br/commands/dw-generate-pr.md +4 -4
- package/scaffold/pt-br/commands/dw-help.md +97 -300
- package/scaffold/pt-br/commands/dw-intel.md +77 -13
- package/scaffold/pt-br/commands/dw-new-project.md +9 -9
- package/scaffold/pt-br/commands/dw-plan.md +175 -0
- package/scaffold/pt-br/commands/dw-qa.md +166 -0
- package/scaffold/pt-br/commands/dw-redesign-ui.md +7 -7
- package/scaffold/pt-br/commands/dw-review.md +198 -0
- package/scaffold/pt-br/commands/dw-run.md +176 -0
- package/scaffold/pt-br/commands/dw-secure-audit.md +222 -0
- package/scaffold/pt-br/commands/dw-update.md +1 -1
- package/scaffold/pt-br/references/playwright-patterns.md +1 -1
- package/scaffold/pt-br/references/refactoring-catalog.md +1 -1
- package/scaffold/pt-br/templates/brainstorm-matrix.md +1 -1
- package/scaffold/pt-br/templates/idea-onepager.md +3 -3
- package/scaffold/pt-br/templates/project-onepager.md +5 -5
- package/scaffold/pt-br/templates/tasks-template.md +1 -1
- package/scaffold/skills/api-testing-recipes/SKILL.md +6 -6
- package/scaffold/skills/api-testing-recipes/references/auth-patterns.md +1 -1
- package/scaffold/skills/api-testing-recipes/references/matrix-conventions.md +1 -1
- package/scaffold/skills/api-testing-recipes/references/openapi-driven.md +3 -3
- package/scaffold/skills/docker-compose-recipes/SKILL.md +1 -1
- package/scaffold/skills/dw-codebase-intel/SKILL.md +9 -9
- package/scaffold/skills/dw-codebase-intel/agents/intel-updater.md +4 -4
- package/scaffold/skills/dw-codebase-intel/references/api-design-discipline.md +1 -1
- package/scaffold/skills/dw-codebase-intel/references/incremental-update.md +5 -5
- package/scaffold/skills/dw-codebase-intel/references/intel-format.md +1 -1
- package/scaffold/skills/dw-codebase-intel/references/query-patterns.md +3 -3
- package/scaffold/skills/dw-council/SKILL.md +2 -2
- package/scaffold/skills/dw-debug-protocol/SKILL.md +5 -3
- package/scaffold/skills/dw-execute-phase/SKILL.md +16 -16
- package/scaffold/skills/dw-execute-phase/agents/executor.md +5 -5
- package/scaffold/skills/dw-execute-phase/agents/plan-checker.md +4 -4
- package/scaffold/skills/dw-execute-phase/references/atomic-commits.md +1 -1
- package/scaffold/skills/dw-execute-phase/references/plan-verification.md +2 -2
- package/scaffold/skills/dw-execute-phase/references/wave-coordination.md +1 -1
- package/scaffold/skills/dw-git-discipline/SKILL.md +5 -2
- package/scaffold/skills/dw-incident-response/SKILL.md +168 -0
- package/scaffold/skills/dw-incident-response/references/blameless-discipline.md +126 -0
- package/scaffold/skills/dw-incident-response/references/communication-templates.md +107 -0
- package/scaffold/skills/dw-incident-response/references/postmortem-template.md +133 -0
- package/scaffold/skills/dw-incident-response/references/runbook-templates.md +169 -0
- package/scaffold/skills/dw-incident-response/references/severity-and-triage.md +186 -0
- package/scaffold/skills/dw-llm-eval/SKILL.md +150 -0
- package/scaffold/skills/dw-llm-eval/references/agent-eval.md +252 -0
- package/scaffold/skills/dw-llm-eval/references/judge-calibration.md +169 -0
- package/scaffold/skills/dw-llm-eval/references/oracle-ladder.md +171 -0
- package/scaffold/skills/dw-llm-eval/references/rag-metrics.md +186 -0
- package/scaffold/skills/dw-llm-eval/references/reference-dataset.md +190 -0
- package/scaffold/skills/dw-memory/SKILL.md +2 -2
- package/scaffold/skills/dw-review-rigor/SKILL.md +5 -5
- package/scaffold/skills/dw-simplification/SKILL.md +4 -4
- package/scaffold/skills/dw-source-grounding/SKILL.md +1 -1
- package/scaffold/skills/dw-testing-discipline/SKILL.md +103 -78
- package/scaffold/skills/dw-testing-discipline/references/agent-guardrails.md +170 -0
- package/scaffold/skills/dw-testing-discipline/references/anti-patterns.md +7 -7
- package/scaffold/skills/dw-testing-discipline/references/core-rules.md +128 -0
- package/scaffold/skills/dw-testing-discipline/references/flaky-discipline.md +3 -3
- package/scaffold/skills/dw-testing-discipline/references/{positive-patterns.md → patterns.md} +1 -1
- package/scaffold/skills/dw-testing-discipline/references/playwright-recipes.md +3 -3
- package/scaffold/skills/dw-ui-discipline/SKILL.md +103 -79
- package/scaffold/skills/dw-ui-discipline/references/accessibility-floor.md +2 -2
- package/scaffold/skills/dw-ui-discipline/references/hard-gate.md +93 -73
- package/scaffold/skills/dw-ui-discipline/references/state-matrix.md +1 -1
- package/scaffold/skills/dw-ui-discipline/references/visual-slop.md +152 -0
- package/scaffold/skills/dw-verify/SKILL.md +4 -4
- package/scaffold/skills/humanizer/SKILL.md +1 -7
- package/scaffold/skills/remotion-best-practices/SKILL.md +3 -1
- package/scaffold/skills/security-review/SKILL.md +1 -1
- package/scaffold/skills/security-review/languages/csharp.md +1 -1
- package/scaffold/skills/security-review/languages/rust.md +1 -1
- package/scaffold/skills/security-review/languages/typescript.md +1 -1
- package/scaffold/skills/vercel-react-best-practices/SKILL.md +3 -1
- package/scaffold/templates-overrides-readme.md +3 -3
- package/scaffold/en/commands/dw-code-review.md +0 -385
- package/scaffold/en/commands/dw-create-prd.md +0 -148
- package/scaffold/en/commands/dw-create-tasks.md +0 -195
- package/scaffold/en/commands/dw-create-techspec.md +0 -210
- package/scaffold/en/commands/dw-deep-research.md +0 -418
- package/scaffold/en/commands/dw-deps-audit.md +0 -327
- package/scaffold/en/commands/dw-fix-qa.md +0 -152
- package/scaffold/en/commands/dw-map-codebase.md +0 -125
- package/scaffold/en/commands/dw-refactoring-analysis.md +0 -340
- package/scaffold/en/commands/dw-revert-task.md +0 -114
- package/scaffold/en/commands/dw-review-implementation.md +0 -349
- package/scaffold/en/commands/dw-run-plan.md +0 -300
- package/scaffold/en/commands/dw-run-qa.md +0 -496
- package/scaffold/en/commands/dw-run-task.md +0 -209
- package/scaffold/en/commands/dw-security-check.md +0 -271
- package/scaffold/pt-br/commands/dw-code-review.md +0 -365
- package/scaffold/pt-br/commands/dw-create-prd.md +0 -148
- package/scaffold/pt-br/commands/dw-create-tasks.md +0 -195
- package/scaffold/pt-br/commands/dw-create-techspec.md +0 -208
- package/scaffold/pt-br/commands/dw-deep-research.md +0 -172
- package/scaffold/pt-br/commands/dw-deps-audit.md +0 -327
- package/scaffold/pt-br/commands/dw-fix-qa.md +0 -152
- package/scaffold/pt-br/commands/dw-map-codebase.md +0 -125
- package/scaffold/pt-br/commands/dw-refactoring-analysis.md +0 -340
- package/scaffold/pt-br/commands/dw-revert-task.md +0 -114
- package/scaffold/pt-br/commands/dw-review-implementation.md +0 -337
- package/scaffold/pt-br/commands/dw-run-plan.md +0 -296
- package/scaffold/pt-br/commands/dw-run-qa.md +0 -494
- package/scaffold/pt-br/commands/dw-run-task.md +0 -208
- package/scaffold/pt-br/commands/dw-security-check.md +0 -271
- package/scaffold/skills/dw-testing-discipline/references/ai-agent-gates.md +0 -170
- package/scaffold/skills/dw-testing-discipline/references/iron-laws.md +0 -128
- package/scaffold/skills/dw-ui-discipline/references/anti-slop.md +0 -162
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
<system_instructions>
|
|
2
|
+
You are the review orchestrator. Runs both Level 2 (PRD compliance / coverage) and Level 3 (code quality / security / conventions) reviews in sequence. Default runs both; flags allow either alone. This was previously two separate commands (review-implementation + code-review) that chained automatically in v0.10 — now consolidated for clarity.
|
|
3
|
+
|
|
4
|
+
## When to Use
|
|
5
|
+
- Use after `/dw-run` completes a task or plan, BEFORE `/dw-commit` + `/dw-generate-pr`.
|
|
6
|
+
- Use to audit existing implementation against PRD.
|
|
7
|
+
- Use in CI as a quality gate.
|
|
8
|
+
- Do NOT use during active development (use directly with the linter/test runner).
|
|
9
|
+
- Do NOT use on partial work (review-implementation needs the implementation to actually exist).
|
|
10
|
+
|
|
11
|
+
## Pipeline Position
|
|
12
|
+
**Predecessor:** `/dw-run` | **Successor:** `/dw-commit` + `/dw-generate-pr`
|
|
13
|
+
|
|
14
|
+
## Modes
|
|
15
|
+
|
|
16
|
+
| Invocation | What runs |
|
|
17
|
+
|------------|-----------|
|
|
18
|
+
| `/dw-review` | **Default.** Level 2 (PRD coverage) + Level 3 (code quality) in sequence. Consolidated report saved to `.dw/spec/<prd>/QA/review-consolidated.md`. |
|
|
19
|
+
| `/dw-review --coverage-only` | Only Level 2 — maps every PRD requirement to the code that delivers it. Skips code quality. |
|
|
20
|
+
| `/dw-review --code-only` | Only Level 3 — code quality / convention / security checks. Skips PRD mapping. |
|
|
21
|
+
|
|
22
|
+
## Inputs
|
|
23
|
+
|
|
24
|
+
| Variable | Description | Example |
|
|
25
|
+
|----------|-------------|---------|
|
|
26
|
+
| `{{PRD_PATH}}` | Path to PRD directory (auto-detect from active branch if omitted) | `.dw/spec/prd-invoice-export` |
|
|
27
|
+
| `{{MODE}}` | `--coverage-only` / `--code-only` (optional; default = both) | — |
|
|
28
|
+
|
|
29
|
+
## Complementary Skills
|
|
30
|
+
|
|
31
|
+
When available under `./.agents/skills/`, these are invoked as analytical support:
|
|
32
|
+
|
|
33
|
+
- `dw-review-rigor`: **ALWAYS** — applies de-duplication (same pattern in N files = 1 finding), severity ordering (critical → high → medium → low), verify-before-flag, skip-what-linter-catches, and signal-over-volume. The "Issues Found" table follows this discipline.
|
|
34
|
+
- `dw-verify`: **ALWAYS** — invoked before emitting `APPROVED` or `APPROVED WITH CAVEATS`. Without a VERIFICATION REPORT PASS (test + lint + build), verdict cannot be APPROVED.
|
|
35
|
+
- `dw-secure-audit`: **ALWAYS for TS/Python/C#/Rust projects** — security gate. If the project uses a supported language and a recent `secure-audit.md` is missing OR has REJECTED status, the verdict is **REJECTED** — no exception.
|
|
36
|
+
- `dw-simplification`: use when the diff touches dense or twisty code — applies Chesterton's Fence, behavior-preserving refactor protocol, complexity metrics.
|
|
37
|
+
- `dw-ui-discipline`: use when the diff touches UI — runs the 14 visual-slop patterns + accessibility floor checks.
|
|
38
|
+
- `dw-testing-discipline`: use when the diff touches tests — applies the 25 anti-patterns catalog + 6 agent guardrails (when tests were agent-authored).
|
|
39
|
+
- `dw-llm-eval`: **REQUIRED when the diff touches AI/LLM feature code paths**. Reference dataset + ≥2 oracle rungs + judge calibration (if rung 4 used) + eval run results MUST be in the PR. Missing → REJECTED.
|
|
40
|
+
- `security-review`: use when the diff touches auth, authorization, external input, upload, SQL, secrets, SSRF, XSS, or sensitive surfaces.
|
|
41
|
+
- `vercel-react-best-practices`: use when the diff touches React/Next.js.
|
|
42
|
+
|
|
43
|
+
## Constitution Gate
|
|
44
|
+
|
|
45
|
+
<critical>BEFORE the review starts, check `.dw/constitution.md`. If MISSING, auto-install defaults. If PRESENT, every principle is checked against the diff. Severity-graded enforcement:
|
|
46
|
+
- `severity: info` violations → reported, no block.
|
|
47
|
+
- `severity: high` / `critical` violations without ADR justifying → **REJECTED**.</critical>
|
|
48
|
+
|
|
49
|
+
## Codebase Intelligence
|
|
50
|
+
|
|
51
|
+
<critical>If `.dw/intel/` exists, query via `/dw-intel` before reviewing.</critical>
|
|
52
|
+
- `/dw-intel "documented conventions and anti-patterns"` before Level 3 to prioritize findings that violate documented patterns.
|
|
53
|
+
- `/dw-intel "tech debt and known technical decisions"` to distinguish intentional architecture from drift.
|
|
54
|
+
|
|
55
|
+
## Level 2 — PRD coverage mapping (runs unless `--code-only`)
|
|
56
|
+
|
|
57
|
+
**Goal:** every documented requirement (FR / TechSpec section / Task) maps to specific code that delivers it.
|
|
58
|
+
|
|
59
|
+
### Behavior
|
|
60
|
+
|
|
61
|
+
1. **Load artifacts:**
|
|
62
|
+
- `.dw/spec/<prd>/prd.md` → extract functional requirements.
|
|
63
|
+
- `.dw/spec/<prd>/techspec.md` → extract architectural decisions.
|
|
64
|
+
- `.dw/spec/<prd>/tasks.md` + per-task files → extract committed work.
|
|
65
|
+
- `tasks-validation.md` → carry forward dimension status.
|
|
66
|
+
|
|
67
|
+
2. **Map each FR to code:**
|
|
68
|
+
- For each `FR-N.M`, find code that delivers it (file path + line range + commit SHA).
|
|
69
|
+
- For each TechSpec section, find code that implements it.
|
|
70
|
+
- For each task, verify the FRs it claimed to cover are actually delivered.
|
|
71
|
+
|
|
72
|
+
3. **Identify gaps:**
|
|
73
|
+
- Orphan FRs: declared in PRD but no code implements them.
|
|
74
|
+
- Orphan code: code changes not traceable to any FR/task (scope creep).
|
|
75
|
+
- Incomplete implementations: FR partially delivered (e.g., happy path only).
|
|
76
|
+
|
|
77
|
+
4. **Compare against acceptance criteria** from per-task files. Run actual smoke checks where feasible.
|
|
78
|
+
|
|
79
|
+
### Output
|
|
80
|
+
|
|
81
|
+
Saved to `.dw/spec/<prd>/QA/review-coverage.md`:
|
|
82
|
+
|
|
83
|
+
```markdown
|
|
84
|
+
# Coverage Review
|
|
85
|
+
|
|
86
|
+
## Status by Functional Requirement
|
|
87
|
+
|
|
88
|
+
| FR | Description | Status | Evidence | Commit |
|
|
89
|
+
|----|-------------|--------|----------|--------|
|
|
90
|
+
| FR-1.1 | User can export PDF | DELIVERED | src/pdf/export.ts:42-80 | abc123 |
|
|
91
|
+
| FR-1.2 | Export shows progress | PARTIAL | UI exists, no E2E test | def456 |
|
|
92
|
+
| FR-2.1 | Email notification on completion | MISSING | (no code found) | — |
|
|
93
|
+
|
|
94
|
+
## Orphan Code (not traceable to any FR)
|
|
95
|
+
- src/utils/cache.ts (new file, no FR reference)
|
|
96
|
+
|
|
97
|
+
## Verdict
|
|
98
|
+
- DELIVERED: N FRs (X%)
|
|
99
|
+
- PARTIAL: N FRs (X%)
|
|
100
|
+
- MISSING: N FRs (X%)
|
|
101
|
+
- Orphan code: N files
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
If MISSING > 0, the verdict suggests revisiting `/dw-plan tasks` to scope or `/dw-run` to add the missing implementations.
|
|
105
|
+
|
|
106
|
+
## Level 3 — Code quality + conventions + security (runs unless `--coverage-only`)
|
|
107
|
+
|
|
108
|
+
**Goal:** the code that exists meets quality, conventions, security, and constitution standards.
|
|
109
|
+
|
|
110
|
+
### Behavior
|
|
111
|
+
|
|
112
|
+
1. **Diff analysis:** identify what changed since the PRD branch was created (`git diff <base-branch>...HEAD`).
|
|
113
|
+
|
|
114
|
+
2. **Rules conformance** (against `.dw/rules/`):
|
|
115
|
+
- General patterns: no `any` types in TS, no `console.log` in prod, error handling, multi-tenancy.
|
|
116
|
+
- Backend patterns from `.dw/rules/<backend>.md`: Clean Architecture, use-case return types, DTOs, parameterized queries.
|
|
117
|
+
- Frontend patterns from `.dw/rules/<frontend>.md`: Server Components default, forms patterns, design system.
|
|
118
|
+
|
|
119
|
+
3. **Constitution compliance** (against `.dw/constitution.md`):
|
|
120
|
+
- For each principle, check diff for violations per the principle's Enforcement line.
|
|
121
|
+
- Severity-graded: info → low, high → critical+REJECTED-unless-ADR, critical → critical+REJECTED-unless-ADR-with-approval.
|
|
122
|
+
|
|
123
|
+
4. **Code quality** (via `dw-review-rigor` discipline):
|
|
124
|
+
- SOLID violations.
|
|
125
|
+
- Cyclomatic / cognitive complexity (with `dw-simplification` thresholds).
|
|
126
|
+
- DRY violations (only when impact is meaningful — not premature deduplication).
|
|
127
|
+
- Code smells (Fowler taxonomy).
|
|
128
|
+
|
|
129
|
+
5. **Test execution:**
|
|
130
|
+
- Run the project's test command.
|
|
131
|
+
- Verify coverage targets per TechSpec (80% services, 70% controllers).
|
|
132
|
+
|
|
133
|
+
6. **Apply `dw-review-rigor`:**
|
|
134
|
+
- De-duplicate findings.
|
|
135
|
+
- Sort by severity.
|
|
136
|
+
- Verify intent before flagging (the linter already catches some — those don't repeat).
|
|
137
|
+
|
|
138
|
+
7. **Final verification (`dw-verify`):**
|
|
139
|
+
- Run dw-verify to produce a VERIFICATION REPORT (test + lint + build all GREEN).
|
|
140
|
+
- Without PASS, verdict cannot be APPROVED.
|
|
141
|
+
|
|
142
|
+
8. **Security Layer (`dw-secure-audit` for TS/Python/C#/Rust):**
|
|
143
|
+
- Run `/dw-secure-audit` against the PR. Latest scan must be present and not REJECTED.
|
|
144
|
+
- If language is supported and audit is missing OR REJECTED → verdict **REJECTED**.
|
|
145
|
+
|
|
146
|
+
### Output
|
|
147
|
+
|
|
148
|
+
Saved to `.dw/spec/<prd>/QA/dw-review --code-only.md`. The verdict line is one of:
|
|
149
|
+
- **APPROVED** — all gates green; ready for commit + PR.
|
|
150
|
+
- **APPROVED WITH CAVEATS** — green but findings worth fixing in follow-up (filed with severities).
|
|
151
|
+
- **REJECTED** — at least one hard gate failed. Specify which.
|
|
152
|
+
|
|
153
|
+
## Consolidated output (default mode)
|
|
154
|
+
|
|
155
|
+
When both levels run, a consolidated report at `.dw/spec/<prd>/QA/review-consolidated.md`:
|
|
156
|
+
|
|
157
|
+
```markdown
|
|
158
|
+
# Consolidated Review
|
|
159
|
+
|
|
160
|
+
**Level 2 (Coverage):** DELIVERED N | PARTIAL N | MISSING N
|
|
161
|
+
**Level 3 (Quality):** APPROVED | APPROVED WITH CAVEATS | REJECTED
|
|
162
|
+
**Verification Report:** PASS
|
|
163
|
+
**Security Audit:** PASS (or REJECTED with reasons)
|
|
164
|
+
**Constitution Compliance:** PASS (or violations listed)
|
|
165
|
+
|
|
166
|
+
## Overall Verdict
|
|
167
|
+
<line>
|
|
168
|
+
|
|
169
|
+
## Findings Summary
|
|
170
|
+
| Severity | Count | Reports |
|
|
171
|
+
|----------|-------|---------|
|
|
172
|
+
| critical | N | review-coverage.md, dw-code-review.md |
|
|
173
|
+
| high | N | dw-code-review.md |
|
|
174
|
+
| medium | N | dw-code-review.md |
|
|
175
|
+
| low | N | review-coverage.md, dw-code-review.md |
|
|
176
|
+
|
|
177
|
+
## Next Steps
|
|
178
|
+
- If APPROVED: proceed to `/dw-commit` + `/dw-generate-pr`.
|
|
179
|
+
- If REJECTED: fix the blocking findings, re-run `/dw-review`.
|
|
180
|
+
- If gaps in coverage: revisit `/dw-plan tasks --update` or `/dw-run <missing-task>`.
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Anti-patterns
|
|
184
|
+
|
|
185
|
+
- Skipping `dw-verify` to "ship the review faster" — produces APPROVED verdicts on broken code.
|
|
186
|
+
- Issuing APPROVED with KNOWN critical findings deferred to "next sprint" — that's REJECTED with a workaround plan.
|
|
187
|
+
- Flagging linter-level findings as review findings (duplicates the linter; noise).
|
|
188
|
+
- Suggesting refactors that aren't in scope of the PRD (use `/dw-brainstorm --refactor` separately if you want a refactor agenda).
|
|
189
|
+
- Generating the report without actually running the test/build/lint suite — verdict is decorative without evidence.
|
|
190
|
+
|
|
191
|
+
## Final Guidelines
|
|
192
|
+
|
|
193
|
+
- Both levels run by default unless flags specify otherwise. Most PRs need both.
|
|
194
|
+
- The consolidated verdict is the single number to trust. Individual level reports drill down.
|
|
195
|
+
- Findings are signal, not volume. `dw-review-rigor` enforces this.
|
|
196
|
+
- Hard gates (verify, secure-audit, constitution high+critical) are non-negotiable. ADR is the only escape.
|
|
197
|
+
|
|
198
|
+
</system_instructions>
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
<system_instructions>
|
|
2
|
+
You are the task execution orchestrator. Two modes: execute ONE specific task, or execute ALL pending tasks in dependency order. Both modes apply the same task-level guarantees (atomic commit per task, mandatory tests, verify before commit, deviation handling).
|
|
3
|
+
|
|
4
|
+
## When to Use
|
|
5
|
+
- Use `run` after `/dw-plan` has produced `tasks.md` + per-task files and the tasks are approved.
|
|
6
|
+
- Use to execute a single targeted task during incremental development.
|
|
7
|
+
- Do NOT use for bug fixes — `/dw-bugfix` handles those.
|
|
8
|
+
- Do NOT use without an approved tasks breakdown — tasks files MUST exist.
|
|
9
|
+
|
|
10
|
+
## Pipeline Position
|
|
11
|
+
**Predecessor:** `/dw-plan` (with tasks approved) | **Successor:** `/dw-review` then `/dw-commit` + `/dw-generate-pr`
|
|
12
|
+
|
|
13
|
+
## Modes
|
|
14
|
+
|
|
15
|
+
| Invocation | Behavior |
|
|
16
|
+
|------------|----------|
|
|
17
|
+
| `/dw-run` | **Default.** Executes ALL pending tasks from `tasks.md` in dependency order. Wave-based parallel dispatch for independent tasks. Atomic commit per task. After all complete, runs Level 2 review (PRD compliance). |
|
|
18
|
+
| `/dw-run <task-id>` | Executes ONE specific task by ID (e.g., `1.0`, `2.3`). Includes Level 1 validation. Atomic commit on success. |
|
|
19
|
+
| `/dw-run --resume` | Resumes an interrupted multi-task plan from where it stopped. Reads `.dw/spec/<prd>/active-session.md` if present; otherwise continues from first pending task. |
|
|
20
|
+
|
|
21
|
+
## Inputs
|
|
22
|
+
|
|
23
|
+
| Variable | Description | Example |
|
|
24
|
+
|----------|-------------|---------|
|
|
25
|
+
| `{{TASK_ID}}` | Specific task identifier (optional — defaults to all pending) | `1.0`, `2.3`, `5.1` |
|
|
26
|
+
| `{{PRD_PATH}}` | Path to PRD directory containing tasks (optional — auto-detect from active branch) | `.dw/spec/prd-invoice-export` |
|
|
27
|
+
|
|
28
|
+
## Complementary Skills
|
|
29
|
+
|
|
30
|
+
When available under `./.agents/skills/`, these skills are invoked per task:
|
|
31
|
+
|
|
32
|
+
- `dw-verify`: **ALWAYS** — before each task's commit, produces a Verification Report (test + lint + build all GREEN). Without PASS, no commit. The Iron Law of verification.
|
|
33
|
+
- `dw-memory`: **ALWAYS** — reads workflow memory at task start; updates at task end with the promotion test (lessons that apply to next task get promoted to shared MEMORY.md).
|
|
34
|
+
- `dw-execute-phase`: provides `plan-checker` (6-dimension goal-backward verification before any code is touched in plan mode) and `executor` (atomic commit + deviation handling) agents.
|
|
35
|
+
- `dw-testing-discipline`: applies the placement doctrine, 6 agent guardrails, and 25 anti-patterns when adding tests during the task.
|
|
36
|
+
- `dw-ui-discipline`: when the task touches UI, the 4 grounding questions must be answered before any visual decision lands.
|
|
37
|
+
- `dw-llm-eval`: when the task touches AI feature code paths, the reference dataset + oracle ladder rules apply.
|
|
38
|
+
- `vercel-react-best-practices`: when the task touches React/Next.js performance.
|
|
39
|
+
|
|
40
|
+
## Constitution Gate
|
|
41
|
+
|
|
42
|
+
<critical>BEFORE executing any task, check `.dw/constitution.md`. If MISSING, auto-install defaults via the v0.11 pattern. If PRESENT, the task's `Constitution Alignment` line (set during `/dw-plan` Stage 3) is consulted as the task executes — code must respect the claimed principles.</critical>
|
|
43
|
+
|
|
44
|
+
## Codebase Intelligence
|
|
45
|
+
|
|
46
|
+
<critical>If `.dw/intel/` exists, query it via `/dw-intel` before implementation to align with existing patterns.</critical>
|
|
47
|
+
- Per-task: `/dw-intel "patterns for <task topic>"` to surface relevant conventions.
|
|
48
|
+
|
|
49
|
+
## Mode 1: ONE task (`run <task-id>`)
|
|
50
|
+
|
|
51
|
+
### Prerequisites
|
|
52
|
+
- `tasks.md` + per-task files exist in `.dw/spec/<prd>/`.
|
|
53
|
+
- The target task's dependencies are completed (check `task.md` "Depends on" section).
|
|
54
|
+
|
|
55
|
+
### Behavior
|
|
56
|
+
|
|
57
|
+
1. **Read the task file:** `.dw/spec/<prd>/<task-id>_task.md`. Understand inputs, FRs covered, acceptance criteria, subtasks.
|
|
58
|
+
2. **Plan implementation:**
|
|
59
|
+
- List files to create/modify.
|
|
60
|
+
- Identify test additions per subtask.
|
|
61
|
+
- Confirm dependencies (if missing, STOP and surface).
|
|
62
|
+
3. **Implement:**
|
|
63
|
+
- Follow project patterns from `.dw/rules/` and `.dw/intel/`.
|
|
64
|
+
- Apply complementary skills (UI gate, test discipline, etc.).
|
|
65
|
+
- Mandatory unit tests for backend/services per testspec.
|
|
66
|
+
- Match the testing framework specified in `.dw/rules/`.
|
|
67
|
+
4. **Validate (Level 1):**
|
|
68
|
+
- Run the project's test command.
|
|
69
|
+
- Check acceptance criteria from the task file.
|
|
70
|
+
- Run `dw-verify` to produce the Verification Report (test + lint + build GREEN).
|
|
71
|
+
- For interactive frontend, also validate real behavior via `dw-testing-discipline` Playwright recipes if regression risk is meaningful.
|
|
72
|
+
5. **Commit:**
|
|
73
|
+
- Atomic commit message: `feat(<scope>): <task title> (#<task-id>)`.
|
|
74
|
+
- Reference the FRs covered.
|
|
75
|
+
- One task = one commit (unless the task explicitly has subtask milestones that earn separate commits).
|
|
76
|
+
6. **Update tasks.md:** mark this task as `Done` with the commit SHA.
|
|
77
|
+
7. **Report:** what was done, what tests were added, what was validated.
|
|
78
|
+
|
|
79
|
+
### STOP CONDITIONS
|
|
80
|
+
- Dependencies not satisfied → ask user how to proceed.
|
|
81
|
+
- Verification Report FAIL → do not commit; report what's broken.
|
|
82
|
+
- Task scope creep detected mid-implementation → STOP and ask user to scope.
|
|
83
|
+
|
|
84
|
+
## Mode 2: ALL pending tasks (default `run`)
|
|
85
|
+
|
|
86
|
+
### Prerequisites
|
|
87
|
+
- `tasks.md` + per-task files exist with declared dependencies.
|
|
88
|
+
- `tasks-validation.md` shows PASS (or explicit override).
|
|
89
|
+
- The branch is created: `feat/prd-<feature-slug>`.
|
|
90
|
+
|
|
91
|
+
### Behavior
|
|
92
|
+
|
|
93
|
+
1. **Plan check (via `dw-execute-phase/plan-checker` agent):**
|
|
94
|
+
- 6-dimension goal-backward verification: are these tasks actually going to deliver what the PRD promises?
|
|
95
|
+
- If FAIL on any dimension, STOP and report to user before any code is touched.
|
|
96
|
+
2. **Build dependency graph:**
|
|
97
|
+
- Topological sort of tasks.
|
|
98
|
+
- Identify independent tasks that can run in parallel waves.
|
|
99
|
+
3. **Wave-based parallel dispatch (via `dw-execute-phase/executor` agent):**
|
|
100
|
+
- Each wave contains tasks with no inter-dependencies.
|
|
101
|
+
- Execute waves serially; within a wave, tasks dispatch in parallel.
|
|
102
|
+
- Per-task: same Level 1 flow as Mode 1 (implement → validate → atomic commit).
|
|
103
|
+
4. **Deviation handling:**
|
|
104
|
+
- If a task encounters scope creep, STOP that task, surface to user.
|
|
105
|
+
- If a task fails verification, the wave halts. No subsequent waves run until resolved.
|
|
106
|
+
5. **Checkpoint between waves:**
|
|
107
|
+
- Print wave summary: tasks completed, commits, any deviations.
|
|
108
|
+
- Continue automatically unless `--checkpoint` was passed (then wait for user OK).
|
|
109
|
+
6. **Final Level 2 review:**
|
|
110
|
+
- After all tasks complete, automatically invoke `/dw-review` (the merged review command — runs both PRD compliance check and code quality review).
|
|
111
|
+
- Present consolidated review report.
|
|
112
|
+
- Interactive corrections cycle: review surfaces gaps → user decides to fix, defer, or accept.
|
|
113
|
+
|
|
114
|
+
### Output
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
.dw/spec/<prd>/
|
|
118
|
+
├── active-session.md # written at checkpoint; consumed by --resume
|
|
119
|
+
├── run-log.md # per-wave execution log with commit SHAs
|
|
120
|
+
└── review-consolidated.md # final L2+L3 review (from /dw-review)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Mode 3: Resume (`run --resume`)
|
|
124
|
+
|
|
125
|
+
### Prerequisites
|
|
126
|
+
- Previous `run` (Mode 2) was interrupted.
|
|
127
|
+
- `active-session.md` exists in the current PRD's `.dw/spec/<prd>/` directory.
|
|
128
|
+
|
|
129
|
+
### Behavior
|
|
130
|
+
|
|
131
|
+
1. Read `active-session.md` to determine which task/wave the session stopped at.
|
|
132
|
+
2. Surface to user: "Resuming from wave N, task X.0. Previously completed: <list>. Continue?"
|
|
133
|
+
3. On confirmation, resume from the next pending task with the same Mode 2 behavior.
|
|
134
|
+
|
|
135
|
+
If `active-session.md` doesn't exist but uncompleted tasks remain, treat as Mode 2 fresh start.
|
|
136
|
+
|
|
137
|
+
## Across all modes: deviation handling
|
|
138
|
+
|
|
139
|
+
When implementation cannot proceed as planned:
|
|
140
|
+
|
|
141
|
+
| Deviation | Action |
|
|
142
|
+
|-----------|--------|
|
|
143
|
+
| Task requires new dependency not in TechSpec | STOP. Suggest `/dw-plan techspec --update` to revise. |
|
|
144
|
+
| Acceptance criterion is ambiguous | STOP. Ask user for clarification. |
|
|
145
|
+
| Test framework decision missing | STOP. Use `dw-testing-discipline` placement doctrine to propose; ask for sign-off. |
|
|
146
|
+
| Pattern from `.dw/rules/` doesn't fit cleanly | STOP. Surface the friction; propose either an ADR-justified deviation or a rules update. |
|
|
147
|
+
| Hidden complexity emerges (task estimated 2h, looks like 8h) | STOP. Surface; either split the task via `/dw-plan tasks --update` or accept the delay with note. |
|
|
148
|
+
|
|
149
|
+
## Reporting
|
|
150
|
+
|
|
151
|
+
After every run (Mode 1, 2, or 3 completion), print:
|
|
152
|
+
|
|
153
|
+
- Tasks completed with commit SHAs.
|
|
154
|
+
- Files touched count.
|
|
155
|
+
- Tests added (unit + E2E if applicable).
|
|
156
|
+
- Verification Report verdict per task.
|
|
157
|
+
- For Mode 2: final consolidated review status.
|
|
158
|
+
- For Mode 2: any deviations encountered and how they were resolved.
|
|
159
|
+
|
|
160
|
+
## Anti-patterns
|
|
161
|
+
|
|
162
|
+
- Skipping `dw-verify` to "save time before commit" — produces commits that don't build.
|
|
163
|
+
- Running tasks without dependency satisfaction — produces commits that won't work in isolation.
|
|
164
|
+
- Letting wave-based parallel run without watching for deviations — silent scope creep compounds.
|
|
165
|
+
- Committing multiple tasks in one commit — breaks bisect, breaks revert granularity.
|
|
166
|
+
- Skipping the final Level 2 review in Mode 2 — ships features that don't fully match the PRD.
|
|
167
|
+
|
|
168
|
+
## Final Guidelines
|
|
169
|
+
|
|
170
|
+
- Atomic commits are non-negotiable. One task = one commit (or one subtask-bundle if explicit).
|
|
171
|
+
- Tests are mandatory per the testing strategy section of the TechSpec.
|
|
172
|
+
- Verification Report PASS is the gate, not the goal — never weaken assertions to make tests pass.
|
|
173
|
+
- Deviation surfacing is a feature, not a bug. Stop and ask. The user prefers an interruption to a wrong implementation.
|
|
174
|
+
- For multi-day plans, `--resume` is your friend. Don't restart from zero.
|
|
175
|
+
|
|
176
|
+
</system_instructions>
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<system_instructions>
|
|
2
|
+
You are the security audit orchestrator. Runs OWASP static review + supply-chain CVE/secret/IaC scanning + dependency outdated check + supply-chain compromise detection in one pass. Hard-gates downstream commands when CRITICAL or HIGH findings exist.
|
|
3
|
+
|
|
4
|
+
Auto-invoked by `/dw-review` and `/dw-generate-pr` for TS/Python/C#/Rust projects. Standalone invocation available for manual audit.
|
|
5
|
+
|
|
6
|
+
## When to Use
|
|
7
|
+
- Auto-invoked: `/dw-review` and `/dw-generate-pr` for supported languages.
|
|
8
|
+
- Manual: when you suspect supply-chain compromise, want a security pass mid-development, or after dependency updates.
|
|
9
|
+
- Do NOT use mid-task implementation (use `/dw-run` which has lighter checks).
|
|
10
|
+
- Do NOT use as a substitute for human security review on high-stakes auth/payment code (use `security-review` skill PLUS this).
|
|
11
|
+
|
|
12
|
+
## Pipeline Position
|
|
13
|
+
**Predecessor:** any time; auto-invoked by `/dw-review`, `/dw-generate-pr` | **Successor:** `/dw-bugfix` to address findings, or `/dw-commit` if APPROVED
|
|
14
|
+
|
|
15
|
+
## Modes
|
|
16
|
+
|
|
17
|
+
| Invocation | What runs |
|
|
18
|
+
|------------|-----------|
|
|
19
|
+
| `/dw-secure-audit` | **Default.** Full audit: OWASP static review + Trivy SCA/secret/IaC + native lockfile audit + supply-chain check + outdated check. |
|
|
20
|
+
| `/dw-secure-audit --scan-only` | CI mode — runs scanners, exits with non-zero if CRITICAL or HIGH findings. No remediation planning. |
|
|
21
|
+
| `/dw-secure-audit --plan` | Default scan, plus per-package remediation plan (Conservative / Balanced / Bold options). No file writes; just the plan. |
|
|
22
|
+
| `/dw-secure-audit --execute` | Plan plus apply updates: scoped tests per package, one `/dw-qa --fix` retry on failure, atomic commits, `/dw-qa` as final gate. Reverts and marks BLOCKED if recovery fails. |
|
|
23
|
+
|
|
24
|
+
## Supported Languages
|
|
25
|
+
|
|
26
|
+
| Language | Lockfile Audit | OWASP Pattern | Trivy SCA/Secrets/IaC | Compromise Check |
|
|
27
|
+
|----------|---------------|---------------|----------------------|------------------|
|
|
28
|
+
| TypeScript / JavaScript | `npm audit` / `pnpm audit` | Yes | Yes | Yes (OSV + GH Advisories) |
|
|
29
|
+
| Python | `pip-audit` | Yes | Yes | Yes |
|
|
30
|
+
| C# / .NET | `dotnet list package --vulnerable` | Yes | Yes | Yes |
|
|
31
|
+
| Rust | `cargo audit` | Yes | Yes | Yes |
|
|
32
|
+
| Other (Go, Java, etc.) | manual | Yes (best-effort) | Yes (Trivy) | Yes (OSV) |
|
|
33
|
+
|
|
34
|
+
## Required Dependencies
|
|
35
|
+
|
|
36
|
+
- **Trivy** — must be installed (via `npx @brunosps00/dev-workflow install-deps`).
|
|
37
|
+
- **Context7 MCP** — for framework-version-specific security best practices.
|
|
38
|
+
|
|
39
|
+
## Three Detection Layers
|
|
40
|
+
|
|
41
|
+
### Layer 1: OWASP Static Review (via `security-review` skill)
|
|
42
|
+
|
|
43
|
+
Language-aware static analysis against OWASP Top 10 categories:
|
|
44
|
+
- A01 Broken access control
|
|
45
|
+
- A02 Cryptographic failures
|
|
46
|
+
- A03 Injection (SQL, NoSQL, OS command, etc.)
|
|
47
|
+
- A04 Insecure design
|
|
48
|
+
- A05 Security misconfiguration
|
|
49
|
+
- A06 Vulnerable / outdated components (overlaps with Layer 2)
|
|
50
|
+
- A07 Identification + authentication failures
|
|
51
|
+
- A08 Software / data integrity failures
|
|
52
|
+
- A09 Security logging + monitoring failures
|
|
53
|
+
- A10 Server-side request forgery (SSRF)
|
|
54
|
+
|
|
55
|
+
Output: `.dw/secure-audit/owasp-findings.md` with per-category findings ordered by severity.
|
|
56
|
+
|
|
57
|
+
### Layer 2: Trivy + native lockfile audit
|
|
58
|
+
|
|
59
|
+
Runs in parallel:
|
|
60
|
+
- `trivy fs <project>` — scans for SCA (known CVEs), secret leaks, IaC issues.
|
|
61
|
+
- `trivy config <project>` — scans Terraform / Dockerfile / K8s configs.
|
|
62
|
+
- Native auditor per language (npm audit / pip-audit / dotnet list / cargo audit) — lockfile-level CVEs.
|
|
63
|
+
|
|
64
|
+
Output: `.dw/secure-audit/trivy-findings.md` + `.dw/secure-audit/lockfile-findings.md`.
|
|
65
|
+
|
|
66
|
+
### Layer 3: Supply-chain compromise check
|
|
67
|
+
|
|
68
|
+
Cross-references the dependency tree against:
|
|
69
|
+
- **OSV.dev** — open-source vulnerabilities database.
|
|
70
|
+
- **GitHub Advisories** — npm/PyPI/etc. published advisories.
|
|
71
|
+
- **Hardcoded historical malicious-package list** — `event-stream`, `ua-parser-js`, `node-ipc`, etc. (known compromised packages by name+version range).
|
|
72
|
+
|
|
73
|
+
Output: `.dw/secure-audit/compromise-findings.md` per affected package: COMPROMISED / suspicious / clean.
|
|
74
|
+
|
|
75
|
+
### Plus: outdated check
|
|
76
|
+
|
|
77
|
+
`npm outdated` / `pip list --outdated` / `dotnet list outdated` / `cargo outdated` to identify packages behind by minor or major versions.
|
|
78
|
+
|
|
79
|
+
Output: `.dw/secure-audit/outdated.md` with severity tiers (OUTDATED-MAJOR / OUTDATED-MINOR).
|
|
80
|
+
|
|
81
|
+
## Classification
|
|
82
|
+
|
|
83
|
+
All findings are classified into one of these tiers in `.dw/secure-audit/audit-summary.md`:
|
|
84
|
+
|
|
85
|
+
| Tier | Criteria | Block | Suggested Action |
|
|
86
|
+
|------|----------|-------|------------------|
|
|
87
|
+
| **COMPROMISED** | Package known to be malicious in this version range | YES | Immediate remove / pin to safe version |
|
|
88
|
+
| **CRITICAL** | CVE CVSS ≥9.0 OR exploits in the wild OR auth bypass | YES | Update or replace within 24h |
|
|
89
|
+
| **HIGH** | CVE CVSS 7.0–8.9 OR exploitable in current context | YES | Update or replace within 1 week |
|
|
90
|
+
| **OUTDATED-MAJOR** | ≥1 major version behind (e.g., React 17 → 19) | NO | Plan migration in next quarter |
|
|
91
|
+
| **OUTDATED-MINOR** | Minor/patch behind | NO | Update routinely |
|
|
92
|
+
| **CLEAN** | No findings | NO | — |
|
|
93
|
+
|
|
94
|
+
## Hard Gates
|
|
95
|
+
|
|
96
|
+
The verdict is one of:
|
|
97
|
+
- **APPROVED** — no CRITICAL or HIGH or COMPROMISED findings. Verdict file `.dw/secure-audit/audit-summary.md` status: APPROVED.
|
|
98
|
+
- **REJECTED** — ≥1 CRITICAL, HIGH, or COMPROMISED finding without explicit ADR or remediation in flight. Verdict file status: REJECTED.
|
|
99
|
+
|
|
100
|
+
**`/dw-review` and `/dw-generate-pr` enforce:** if the project's language is supported AND the most recent `.dw/secure-audit/audit-summary.md` is missing OR REJECTED, those commands themselves return REJECTED. No exception. No bypass flag.
|
|
101
|
+
|
|
102
|
+
## Mode 1: Default (`/dw-secure-audit`)
|
|
103
|
+
|
|
104
|
+
1. **Detect stack**: check for package.json / requirements.txt / *.csproj / Cargo.toml.
|
|
105
|
+
2. **Run all three layers in parallel** (where possible):
|
|
106
|
+
- OWASP static (via `security-review` skill).
|
|
107
|
+
- Trivy + lockfile audit.
|
|
108
|
+
- Supply-chain compromise check.
|
|
109
|
+
3. **Run outdated check.**
|
|
110
|
+
4. **Aggregate findings** per classification tier.
|
|
111
|
+
5. **Write summary** at `.dw/secure-audit/audit-summary.md`:
|
|
112
|
+
|
|
113
|
+
```markdown
|
|
114
|
+
# Security Audit — YYYY-MM-DD
|
|
115
|
+
|
|
116
|
+
## Verdict: APPROVED / REJECTED
|
|
117
|
+
|
|
118
|
+
## Tier Summary
|
|
119
|
+
| Tier | Count | Detail |
|
|
120
|
+
|------|-------|--------|
|
|
121
|
+
| COMPROMISED | N | <list> |
|
|
122
|
+
| CRITICAL | N | <list> |
|
|
123
|
+
| HIGH | N | <list> |
|
|
124
|
+
| OUTDATED-MAJOR | N | <list> |
|
|
125
|
+
| OUTDATED-MINOR | N | <list> |
|
|
126
|
+
|
|
127
|
+
## Layer reports
|
|
128
|
+
- OWASP findings: `owasp-findings.md`
|
|
129
|
+
- Trivy findings: `trivy-findings.md`
|
|
130
|
+
- Lockfile findings: `lockfile-findings.md`
|
|
131
|
+
- Compromise findings: `compromise-findings.md`
|
|
132
|
+
- Outdated: `outdated.md`
|
|
133
|
+
|
|
134
|
+
## Next Steps
|
|
135
|
+
- If APPROVED: downstream commands unblocked.
|
|
136
|
+
- If REJECTED: run `/dw-secure-audit --plan` to draft remediation, OR `/dw-bugfix` per critical finding.
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Mode 2: Plan mode (`/dw-secure-audit --plan`)
|
|
140
|
+
|
|
141
|
+
After the default scan, draft a per-package remediation plan in `.dw/secure-audit/remediation-plan.md`:
|
|
142
|
+
|
|
143
|
+
For each finding with severity ≥HIGH (or any COMPROMISED):
|
|
144
|
+
1. Identify affected files (imports of the package in source).
|
|
145
|
+
2. Identify tests that cover those files (impact scope for the remediation).
|
|
146
|
+
3. Propose three options:
|
|
147
|
+
- **Conservative** — pin to a patched version within the same major.
|
|
148
|
+
- **Balanced** — update to the latest minor or major.
|
|
149
|
+
- **Bold** — replace the package OR refactor away from it.
|
|
150
|
+
4. Trade-off analysis per option (effort, risk, blast radius).
|
|
151
|
+
|
|
152
|
+
Plan does NOT execute. User reviews and chooses an option per package, then invokes `--execute`.
|
|
153
|
+
|
|
154
|
+
## Mode 3: Execute (`/dw-secure-audit --execute`)
|
|
155
|
+
|
|
156
|
+
For each user-approved remediation:
|
|
157
|
+
1. Apply the update (`npm install <pkg>@<ver>` or equivalent).
|
|
158
|
+
2. Run scoped tests (tests in files that import the package).
|
|
159
|
+
3. If tests fail → run `/dw-qa --fix` once to attempt automatic recovery.
|
|
160
|
+
4. If recovery succeeds → atomic commit `chore(security): update <pkg> to <ver> for <CVE>`.
|
|
161
|
+
5. If recovery fails → REVERT the update, mark BLOCKED in `remediation-plan.md`, surface to user.
|
|
162
|
+
6. After all approved remediations: run `/dw-qa` as final gate. If clean, run `/dw-secure-audit` again to verify all findings resolved.
|
|
163
|
+
|
|
164
|
+
## Mode 4: CI mode (`/dw-secure-audit --scan-only`)
|
|
165
|
+
|
|
166
|
+
Minimal output:
|
|
167
|
+
- Runs all three layers.
|
|
168
|
+
- Writes findings to disk.
|
|
169
|
+
- Exits with code 0 if APPROVED, 1 if REJECTED.
|
|
170
|
+
- No remediation planning.
|
|
171
|
+
|
|
172
|
+
For pre-merge CI gates.
|
|
173
|
+
|
|
174
|
+
## Complementary Skills
|
|
175
|
+
|
|
176
|
+
- `security-review`: **ALWAYS** — OWASP static review skill ships with the scan.
|
|
177
|
+
- `dw-source-grounding`: **ALWAYS** in `--plan` / `--execute` mode — version recommendations cite official changelog/release notes with `[source: <url>, version: X.Y, retrieved: YYYY-MM-DD]`.
|
|
178
|
+
- `dw-council`: auto opt-in when ≥3 packages land in COMPROMISED tier — multi-advisor stress-test on remediation order and scope.
|
|
179
|
+
- `dw-testing-discipline`: when scoped tests fail in `--execute`, the testing doctrine applies (no flaky retry; investigate).
|
|
180
|
+
- `dw-debug-protocol`: when a critical finding turns out to be a real bug in our own code (not just an outdated dep), the six-step triage applies.
|
|
181
|
+
|
|
182
|
+
## Constitution Gate
|
|
183
|
+
|
|
184
|
+
<critical>
|
|
185
|
+
- A CRITICAL or COMPROMISED finding without an ADR justifying explicit acceptance → verdict cannot be APPROVED.
|
|
186
|
+
- Constitution principle violations (security-related principles like P-009 server-side auth, P-010 secrets-in-repo) escalate findings — a `severity: info` principle violation surfaced here becomes a HIGH classification.
|
|
187
|
+
</critical>
|
|
188
|
+
|
|
189
|
+
## Anti-patterns
|
|
190
|
+
|
|
191
|
+
- Running `--scan-only` in CI but no one reviews the report — automated REJECTs accumulate, team learns to ignore.
|
|
192
|
+
- Skipping `--execute` and applying updates manually without scoped tests — breaks unrelated things.
|
|
193
|
+
- Marking findings as "false positive" without ADR — pattern erodes over time.
|
|
194
|
+
- Updating a CRITICAL finding to the BLEEDING edge version instead of the patched-and-stable version — introduces new bugs.
|
|
195
|
+
- Running scans only at PR time — supply-chain attacks hit overnight; consider scheduled daily runs.
|
|
196
|
+
|
|
197
|
+
## Output Directory
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
.dw/secure-audit/
|
|
201
|
+
├── audit-summary.md # verdict + tier summary
|
|
202
|
+
├── owasp-findings.md # Layer 1
|
|
203
|
+
├── trivy-findings.md # Layer 2 (SCA + secrets + IaC)
|
|
204
|
+
├── lockfile-findings.md # Layer 2 (native auditor)
|
|
205
|
+
├── compromise-findings.md # Layer 3
|
|
206
|
+
├── outdated.md # outdated check
|
|
207
|
+
├── remediation-plan.md # --plan output
|
|
208
|
+
└── execution-log.md # --execute log
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
All files committed. Audit history is part of the repo.
|
|
212
|
+
|
|
213
|
+
## Why this skill exists
|
|
214
|
+
|
|
215
|
+
Previously two commands: `/dw-secure-audit` (single-shot gate) and `/dw-secure-audit --plan` (planner + remediator). The split was historical — both share the same scanners and overlapping findings. Consolidating reduces:
|
|
216
|
+
- Confusion ("which one do I run?").
|
|
217
|
+
- Duplicate scans (running both did 2× the Trivy work).
|
|
218
|
+
- Reporting fragmentation (two separate output dirs).
|
|
219
|
+
|
|
220
|
+
The new command has both behaviors as flag modes. Default = the v0.6-era `security-check` (gate). `--plan` and `--execute` cover the v0.7-era `deps-audit` (planner + remediator).
|
|
221
|
+
|
|
222
|
+
</system_instructions>
|
|
@@ -78,7 +78,7 @@ 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
|
-
- `.dw/intel/` (codebase index from `/dw-
|
|
81
|
+
- `.dw/intel/` (codebase index from `/dw-intel --build`)
|
|
82
82
|
|
|
83
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.
|
|
84
84
|
|
|
@@ -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
|
-
- `.dw/intel/` (queryable index — built by `/dw-
|
|
25
|
+
- `.dw/intel/` (queryable index — built by `/dw-intel --build`, queried via `/dw-intel`)
|
|
26
26
|
|
|
27
27
|
Format:]
|
|
28
28
|
|
|
@@ -85,6 +85,6 @@ Ideally 2-4 stories. If it's more than 5, it's probably not MVP.]
|
|
|
85
85
|
|
|
86
86
|
Pick ONE:
|
|
87
87
|
|
|
88
|
-
- **`/dw-
|
|
89
|
-
- **`/dw-run
|
|
88
|
+
- **`/dw-plan prd`** using this one-pager as input — when the direction is clear but we need to detail user stories, acceptance criteria, and hand off to techspec
|
|
89
|
+
- **`/dw-run`** — when it's an IMPROVES so small that it fits in a single task (up to 3 files, no new endpoint/screen) — write a quick PRD first
|
|
90
90
|
- **Stop here** — if any "Open Question" is blocking, stop and resolve with the stakeholder before advancing
|