@torka/claude-workflows 0.12.0 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +8 -0
- package/README.md +52 -5
- package/bmad-workflows/bmm/workflows/4-implementation/implement-epic-with-subagents/steps/step-01b-continue.md +9 -2
- package/bmad-workflows/bmm/workflows/4-implementation/implement-epic-with-subagents/steps/step-02-orchestrate.md +108 -2
- package/bmad-workflows/bmm/workflows/4-implementation/implement-epic-with-subagents/steps/step-03-complete.md +35 -1
- package/commands/deep-audit.md +530 -0
- package/commands/dev-story-backend.md +12 -11
- package/commands/dev-story-fullstack.md +6 -2
- package/commands/dev-story-ui.md +4 -4
- package/commands/github-pr-resolve.md +132 -24
- package/commands/plan-parallelization.md +20 -3
- package/examples/settings.local.example.json +17 -0
- package/install.js +14 -3
- package/package.json +1 -1
- package/skills/deep-audit/INSPIRATIONS.md +26 -0
- package/skills/deep-audit/SKILL.md +313 -0
- package/skills/deep-audit/agents/api-contract-reviewer.md +42 -0
- package/skills/deep-audit/agents/architecture-and-complexity.md +59 -0
- package/skills/deep-audit/agents/code-health.md +55 -0
- package/skills/deep-audit/agents/data-layer-reviewer.md +50 -0
- package/skills/deep-audit/agents/documentation-health.md +44 -0
- package/skills/deep-audit/agents/performance-profiler.md +42 -0
- package/skills/deep-audit/agents/refactoring-planner.md +161 -0
- package/skills/deep-audit/agents/security-and-error-handling.md +56 -0
- package/skills/deep-audit/agents/seo-accessibility-auditor.md +53 -0
- package/skills/deep-audit/agents/test-strategy-analyst.md +61 -0
- package/skills/deep-audit/agents/type-design-analyzer.md +49 -0
- package/skills/deep-audit/templates/report-template.md +152 -0
- package/skills/designer-founder/SKILL.md +8 -7
- package/skills/designer-founder/steps/step-01-context.md +94 -45
- package/skills/designer-founder/steps/step-02-scope.md +6 -23
- package/skills/designer-founder/steps/step-03-design.md +29 -58
- package/skills/designer-founder/steps/step-04-artifacts.md +137 -113
- package/skills/designer-founder/steps/step-05-epic-linking.md +81 -53
- package/skills/designer-founder/steps/step-06-validate.md +181 -0
- package/skills/designer-founder/templates/component-strategy.md +4 -0
- package/skills/designer-founder/tools/magicpatterns.md +52 -19
- package/skills/designer-founder/tools/stitch.md +97 -67
- package/uninstall.js +24 -0
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Multi-agent codebase audit across security, architecture, error handling, and more'
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /deep-audit
|
|
6
|
+
|
|
7
|
+
Comprehensive multi-agent codebase audit. Spawns parallel review agents across multiple dimensions and produces a consolidated report.
|
|
8
|
+
|
|
9
|
+
**Usage:**
|
|
10
|
+
```
|
|
11
|
+
/deep-audit # Quick mode + auto refactoring plan
|
|
12
|
+
/deep-audit --full # Full mode + auto refactoring plan
|
|
13
|
+
/deep-audit --review-before-plan # Pause after findings, ask before plan
|
|
14
|
+
/deep-audit --pr 42 # Audit a specific PR diff
|
|
15
|
+
/deep-audit --since abc123f # Audit changes since a commit hash
|
|
16
|
+
/deep-audit --since 2025-01-15 # Audit changes since a date
|
|
17
|
+
/deep-audit --full --pr 42 # Full mode on a specific PR
|
|
18
|
+
/deep-audit --agent security-and-error-handling # Run only one agent
|
|
19
|
+
/deep-audit --agent performance-profiler --pr 42 # Single agent on a PR
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
<workflow CRITICAL="TRUE">
|
|
23
|
+
|
|
24
|
+
IT IS CRITICAL THAT YOU FOLLOW THIS WORKFLOW EXACTLY.
|
|
25
|
+
|
|
26
|
+
## Phase 0: Argument Parsing
|
|
27
|
+
|
|
28
|
+
Parse `$ARGUMENTS` to determine:
|
|
29
|
+
|
|
30
|
+
1. **Mode**: Check for `--full` flag
|
|
31
|
+
- If `--full` present → `mode = "full"` (10 agents)
|
|
32
|
+
- Otherwise → `mode = "quick"` (3 agents)
|
|
33
|
+
|
|
34
|
+
2. **Single Agent**: Check for `--agent <name>` flag
|
|
35
|
+
- If `--agent <name>` present → `single_agent = "<name>"`
|
|
36
|
+
- Otherwise → `single_agent = null`
|
|
37
|
+
- If both `--full` and `--agent` are present: warn that `--full` is ignored in single-agent mode, set `mode = "single"`, ignore `--full`
|
|
38
|
+
- If `--agent` is present without `--full`: set `mode = "single"`
|
|
39
|
+
|
|
40
|
+
3. **Review Before Plan**: Check for `--review-before-plan` flag
|
|
41
|
+
- If `--review-before-plan` present → `review_before_plan = true`
|
|
42
|
+
- Otherwise → `review_before_plan = false`
|
|
43
|
+
|
|
44
|
+
4. **Scope**: Check for scope flags (mutually exclusive)
|
|
45
|
+
- `--pr <number>` → `scope = "pr"`, `scope_value = <number>`
|
|
46
|
+
- `--since <value>` → detect format:
|
|
47
|
+
- If matches date pattern (YYYY-MM-DD) → `scope = "since-date"`, `scope_value = <date>`
|
|
48
|
+
- Otherwise → `scope = "since-commit"`, `scope_value = <hash>`
|
|
49
|
+
- No scope flag → `scope = "full-project"`
|
|
50
|
+
|
|
51
|
+
If conflicting scope flags are provided, warn the user and use the first one.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Phase 1: Scope Resolution & Resume Detection
|
|
56
|
+
|
|
57
|
+
### Step 1: Record current state
|
|
58
|
+
|
|
59
|
+
Run these commands to capture the current project context:
|
|
60
|
+
- `git rev-parse HEAD` → `current_commit`
|
|
61
|
+
- `git rev-parse --show-toplevel` → `project_root`
|
|
62
|
+
- Detect project stack by scanning for key files:
|
|
63
|
+
- `package.json` → Node.js/JavaScript
|
|
64
|
+
- `tsconfig.json` → TypeScript
|
|
65
|
+
- `next.config.*` → Next.js
|
|
66
|
+
- `requirements.txt` / `pyproject.toml` → Python
|
|
67
|
+
- `go.mod` → Go
|
|
68
|
+
- `Cargo.toml` → Rust
|
|
69
|
+
- `pom.xml` / `build.gradle` → Java
|
|
70
|
+
- Store as `detected_stack` (comma-separated list)
|
|
71
|
+
|
|
72
|
+
### Step 2: Check for resume
|
|
73
|
+
|
|
74
|
+
Check if `_bmad-output/deep-audit/state.json` exists:
|
|
75
|
+
|
|
76
|
+
- **If exists AND `status` != "completed"**:
|
|
77
|
+
- Read `state.json` → `previous_state`
|
|
78
|
+
- If `previous_state.start_commit` == `current_commit`:
|
|
79
|
+
- **AUTO-RESUME**: Set `resume = true`
|
|
80
|
+
- Identify which agents are still pending from `previous_state.agents`
|
|
81
|
+
- Print: `Resuming interrupted audit (same commit). X of Y agents remaining.`
|
|
82
|
+
- If commits differ:
|
|
83
|
+
- **FRESH START**: Set `resume = false`
|
|
84
|
+
- Print: `Previous audit was on a different commit. Starting fresh.`
|
|
85
|
+
- **If no state.json OR status == "completed"**:
|
|
86
|
+
- **FRESH START**: Set `resume = false`
|
|
87
|
+
|
|
88
|
+
### Step 3: Build scope context
|
|
89
|
+
|
|
90
|
+
Generate the `scope_context` string that will be injected into every agent prompt:
|
|
91
|
+
|
|
92
|
+
**For `full-project`:**
|
|
93
|
+
```
|
|
94
|
+
SCOPE: Full project audit
|
|
95
|
+
PROJECT ROOT: <project_root>
|
|
96
|
+
STACK: <detected_stack>
|
|
97
|
+
INSTRUCTIONS: Review the entire codebase. Focus on source files, configuration, and infrastructure. Skip node_modules, dist, build, .git, and vendor directories.
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**For `pr`:**
|
|
101
|
+
- Run: `gh pr diff <number> --name-only` → file list
|
|
102
|
+
- Run: `gh pr diff <number>` → full diff
|
|
103
|
+
- Build scope_context with the diff and file list:
|
|
104
|
+
```
|
|
105
|
+
SCOPE: PR #<number> audit
|
|
106
|
+
PROJECT ROOT: <project_root>
|
|
107
|
+
STACK: <detected_stack>
|
|
108
|
+
CHANGED FILES:
|
|
109
|
+
<file list>
|
|
110
|
+
DIFF:
|
|
111
|
+
<full diff>
|
|
112
|
+
INSTRUCTIONS: Focus your review on the changed files and their immediate dependencies. For architectural review, also consider how changes fit into the broader codebase.
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**For `since-commit` or `since-date`:**
|
|
116
|
+
- For commit: `git diff <hash>...HEAD --name-only` and `git diff <hash>...HEAD`
|
|
117
|
+
- For date: `git log --since="<date>" --format="%H" | tail -1` → oldest_hash, then `git diff <oldest_hash>...HEAD --name-only` and `git diff <oldest_hash>...HEAD`
|
|
118
|
+
- Build scope_context similarly to PR scope.
|
|
119
|
+
|
|
120
|
+
Store `scope_context` for injection into agent prompts.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Phase 2: Load Agent Definitions
|
|
125
|
+
|
|
126
|
+
Read the SKILL.md file at the path relative to this command:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
skills/deep-audit/SKILL.md
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
From SKILL.md, build the complete agent roster (used for both mode selection and `--agent` validation):
|
|
133
|
+
|
|
134
|
+
**Quick mode agents:**
|
|
135
|
+
```
|
|
136
|
+
quick_agents = [
|
|
137
|
+
{ file: "security-and-error-handling.md", model: "opus", dimensions: ["Security", "Error Handling"] },
|
|
138
|
+
{ file: "architecture-and-complexity.md", model: "opus", dimensions: ["Architecture", "Simplification"] },
|
|
139
|
+
{ file: "code-health.md", model: "sonnet", dimensions: ["AI Slop Detection", "Dependency Health"] }
|
|
140
|
+
]
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Full mode additional agents:**
|
|
144
|
+
```
|
|
145
|
+
full_agents = [
|
|
146
|
+
{ file: "performance-profiler.md", model: "sonnet", dimensions: ["Performance"] },
|
|
147
|
+
{ file: "test-strategy-analyst.md", model: "opus", dimensions: ["Test Coverage", "Test Efficiency"] },
|
|
148
|
+
{ file: "type-design-analyzer.md", model: "sonnet", dimensions: ["Type Design"] },
|
|
149
|
+
{ file: "data-layer-reviewer.md", model: "opus", dimensions: ["Data Layer & Database"] },
|
|
150
|
+
{ file: "api-contract-reviewer.md", model: "sonnet", dimensions: ["API Contracts & Interface Consistency"] },
|
|
151
|
+
{ file: "seo-accessibility-auditor.md", model: "sonnet", dimensions: ["SEO & Accessibility"] },
|
|
152
|
+
{ file: "documentation-health.md", model: "sonnet", dimensions: ["Documentation Health"] }
|
|
153
|
+
]
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Build the active agent list based on mode:**
|
|
157
|
+
|
|
158
|
+
- **If `mode = "single"`**: Search both `quick_agents` and `full_agents` for an agent whose filename (without `.md`) matches `single_agent`. If found → `agents = [matched_agent]`. If NOT found → print the error below and **STOP** (do not proceed):
|
|
159
|
+
```
|
|
160
|
+
Unknown agent: "<single_agent>"
|
|
161
|
+
|
|
162
|
+
Available agents:
|
|
163
|
+
Quick mode: security-and-error-handling, architecture-and-complexity, code-health
|
|
164
|
+
Full mode: performance-profiler, test-strategy-analyst, type-design-analyzer,
|
|
165
|
+
data-layer-reviewer, api-contract-reviewer, seo-accessibility-auditor,
|
|
166
|
+
documentation-health
|
|
167
|
+
```
|
|
168
|
+
- **If `mode = "quick"`**: `agents = quick_agents`
|
|
169
|
+
- **If `mode = "full"`**: `agents = quick_agents + full_agents`
|
|
170
|
+
|
|
171
|
+
**Refactoring planner** — added when mode is NOT "single" (runs separately in Phase 6, NOT in Phase 4):
|
|
172
|
+
```
|
|
173
|
+
planner_agent = { file: "refactoring-planner.md", model: "opus", dimensions: ["Refactoring"] }
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Include this agent in `state.agents` for tracking when mode is not "single", but do NOT spawn it in Phase 4.
|
|
177
|
+
|
|
178
|
+
If resuming: filter `agents` to only those with status "pending" in `previous_state.agents`.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Phase 3: Initialize State
|
|
183
|
+
|
|
184
|
+
Create `_bmad-output/deep-audit/` directory if it doesn't exist.
|
|
185
|
+
|
|
186
|
+
Write `_bmad-output/deep-audit/state.json`:
|
|
187
|
+
|
|
188
|
+
```json
|
|
189
|
+
{
|
|
190
|
+
"status": "in_progress",
|
|
191
|
+
"mode": "<quick|full|single>",
|
|
192
|
+
"scope": "<scope type>",
|
|
193
|
+
"scope_value": "<scope value or null>",
|
|
194
|
+
"review_before_plan": false,
|
|
195
|
+
"start_commit": "<current_commit>",
|
|
196
|
+
"start_time": "<ISO timestamp>",
|
|
197
|
+
"detected_stack": "<detected_stack>",
|
|
198
|
+
"agents": {
|
|
199
|
+
"<agent-file-name>": {
|
|
200
|
+
"status": "pending",
|
|
201
|
+
"model": "<model>",
|
|
202
|
+
"dimensions": ["<dim1>", "<dim2>"],
|
|
203
|
+
"started_at": null,
|
|
204
|
+
"completed_at": null,
|
|
205
|
+
"findings_count": 0,
|
|
206
|
+
"raw_output": null
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
"findings": [],
|
|
210
|
+
"refactoring_plan": null,
|
|
211
|
+
"report_path": null
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Note: The `agents` object includes the `refactoring-planner` entry with `status: "pending"`. It is tracked like all agents but spawned in Phase 6, not Phase 4.
|
|
216
|
+
|
|
217
|
+
If resuming, merge pending agent statuses into the existing state (keep completed agents' data intact).
|
|
218
|
+
|
|
219
|
+
Print status:
|
|
220
|
+
```
|
|
221
|
+
Deep Audit — <mode> mode
|
|
222
|
+
Scope: <scope description>
|
|
223
|
+
Stack: <detected_stack>
|
|
224
|
+
Agent(s): <count> (<list of agent names>)
|
|
225
|
+
Commit: <short hash>
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Phase 4: Spawn Agents (Batched Parallel)
|
|
231
|
+
|
|
232
|
+
Spawn agents in batches of up to 5 at a time using the Task tool.
|
|
233
|
+
|
|
234
|
+
For each agent in the current batch:
|
|
235
|
+
|
|
236
|
+
1. Read the agent prompt file from `skills/deep-audit/agents/<agent-file>`
|
|
237
|
+
2. Construct the full prompt by combining:
|
|
238
|
+
- The agent prompt file content
|
|
239
|
+
- The scope_context from Phase 1
|
|
240
|
+
- A reminder to follow SKILL.md output format exactly
|
|
241
|
+
|
|
242
|
+
3. Spawn via Task tool:
|
|
243
|
+
```
|
|
244
|
+
Tool: Task
|
|
245
|
+
subagent_type: general-purpose
|
|
246
|
+
model: <agent.model>
|
|
247
|
+
description: "deep-audit: <agent-name>"
|
|
248
|
+
prompt: |
|
|
249
|
+
<agent prompt content>
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
## Scope Context (injected by orchestrator)
|
|
253
|
+
<scope_context>
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
## Output Format Reminder
|
|
257
|
+
You MUST produce output using the exact format defined above:
|
|
258
|
+
- === FINDING === blocks for each finding (confidence >= 80 only)
|
|
259
|
+
- === DIMENSION SUMMARY === blocks for each dimension you cover
|
|
260
|
+
Produce NO other output besides these blocks.
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
4. After each batch completes, for each agent response:
|
|
264
|
+
- Parse `=== FINDING ===` blocks: extract agent, severity, confidence, file, line, dimension, title, description, suggestion
|
|
265
|
+
- Parse `=== DIMENSION SUMMARY ===` blocks: extract dimension, score, p1_count, p2_count, p3_count, assessment
|
|
266
|
+
- Store parsed findings in state.json `findings` array
|
|
267
|
+
- Store raw output in agent's `raw_output` field
|
|
268
|
+
- Update agent status to "completed" with timestamp and findings_count
|
|
269
|
+
- Write updated state.json to disk
|
|
270
|
+
|
|
271
|
+
5. Print progress after each batch:
|
|
272
|
+
```
|
|
273
|
+
Batch N complete: <agents in batch>
|
|
274
|
+
Findings so far: X P1, Y P2, Z P3
|
|
275
|
+
Remaining agents: <count>
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
If any agent fails (Task tool returns error):
|
|
279
|
+
- Log the error in the agent's state
|
|
280
|
+
- Set agent status to "failed"
|
|
281
|
+
- Continue with remaining agents (do not abort the audit)
|
|
282
|
+
- Report failed agents in the final summary
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Phase 5: Deduplicate Findings
|
|
287
|
+
|
|
288
|
+
After all agents complete:
|
|
289
|
+
|
|
290
|
+
1. Sort all findings by severity (P1 → P2 → P3), then by file path, then by line number
|
|
291
|
+
2. Deduplicate: merge findings that share ALL of these properties:
|
|
292
|
+
- Same file (exact path match)
|
|
293
|
+
- Same or overlapping line range (within 5 lines)
|
|
294
|
+
- Similar title (>70% word overlap)
|
|
295
|
+
- If merged, keep the higher severity and higher confidence, combine descriptions
|
|
296
|
+
3. Assign sequential IDs: F-001, F-002, F-003, ...
|
|
297
|
+
4. Store deduplicated findings back in state.json
|
|
298
|
+
|
|
299
|
+
Print dedup results:
|
|
300
|
+
```
|
|
301
|
+
Deduplication: <original count> findings → <deduped count> findings (<removed count> duplicates merged)
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## Phase 6: Refactoring Planner
|
|
307
|
+
|
|
308
|
+
Skip this phase if `mode = "single"` (single-agent audits don't warrant cross-cutting refactoring plans). There is no planner agent in state.json to update.
|
|
309
|
+
|
|
310
|
+
Also skip this phase if the deduplicated findings count is 0. Set the planner agent status to "skipped" in state.json and continue.
|
|
311
|
+
|
|
312
|
+
### Step 1: Confirm (if --review-before-plan)
|
|
313
|
+
|
|
314
|
+
If `review_before_plan` is true:
|
|
315
|
+
|
|
316
|
+
1. Print a findings summary to the user:
|
|
317
|
+
```
|
|
318
|
+
FINDINGS SUMMARY: X total (Y critical, Z important, W minor)
|
|
319
|
+
|
|
320
|
+
Top findings:
|
|
321
|
+
1. F-001: <title> (P1)
|
|
322
|
+
2. F-002: <title> (P1)
|
|
323
|
+
3. F-003: <title> (P2)
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
2. Ask the user: **"Generate refactoring plan from these findings? (Y/n)"**
|
|
327
|
+
|
|
328
|
+
3. If the user says no → set planner agent status to "skipped" in state.json, skip to Phase 7.
|
|
329
|
+
|
|
330
|
+
If `review_before_plan` is false, proceed directly to Step 2.
|
|
331
|
+
|
|
332
|
+
### Step 2: Generate plan
|
|
333
|
+
|
|
334
|
+
1. Serialize all deduplicated findings from Phase 5 into a single text block using the `=== FINDING ===` format. Include the assigned `id` field (F-001, etc.) so the planner can reference them.
|
|
335
|
+
|
|
336
|
+
2. Read the agent prompt from `skills/deep-audit/agents/refactoring-planner.md`
|
|
337
|
+
|
|
338
|
+
3. Spawn via Task tool (same pattern as Phase 4):
|
|
339
|
+
```
|
|
340
|
+
Tool: Task
|
|
341
|
+
subagent_type: general-purpose
|
|
342
|
+
model: opus
|
|
343
|
+
description: "deep-audit: refactoring-planner"
|
|
344
|
+
prompt: |
|
|
345
|
+
<agent prompt content>
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
## Input Findings (injected by orchestrator)
|
|
349
|
+
|
|
350
|
+
<serialized findings payload>
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
## Output Format Reminder
|
|
354
|
+
You MUST produce output using the exact format defined above:
|
|
355
|
+
- === THEME === blocks for each refactoring theme
|
|
356
|
+
- Exactly one === EXECUTION ORDER === block at the end
|
|
357
|
+
Produce NO other output besides these blocks.
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
4. Parse the response:
|
|
361
|
+
- Extract all `=== THEME ===` blocks: id, name, effort, risk, finding_ids, dependencies, coverage_gate, blast_radius, warnings, phase, summary, steps, files, tests_before, tests_after
|
|
362
|
+
- Extract the single `=== EXECUTION ORDER ===` block: phase_1 through phase_4, quick_wins, total_effort, summary
|
|
363
|
+
|
|
364
|
+
5. Store parsed data in `state.refactoring_plan`:
|
|
365
|
+
```json
|
|
366
|
+
{
|
|
367
|
+
"themes": [ ...parsed theme objects... ],
|
|
368
|
+
"execution_order": { ...parsed execution order... }
|
|
369
|
+
}
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
6. Update planner agent status in `state.agents` to "completed" with timestamps and raw_output.
|
|
373
|
+
|
|
374
|
+
7. Write updated state.json to disk.
|
|
375
|
+
|
|
376
|
+
If the planner agent fails (Task tool returns error):
|
|
377
|
+
- Set planner agent status to "failed" in state.json
|
|
378
|
+
- Log a warning but continue to Phase 7 (the report generates without the roadmap section)
|
|
379
|
+
|
|
380
|
+
Print progress:
|
|
381
|
+
```
|
|
382
|
+
Refactoring Planner: <theme_count> themes (<quick_win_count> quick wins), total effort: <total_effort>
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## Phase 7: Generate Report
|
|
388
|
+
|
|
389
|
+
Read the report template from:
|
|
390
|
+
```
|
|
391
|
+
skills/deep-audit/templates/report-template.md
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
Fill in the template:
|
|
395
|
+
|
|
396
|
+
1. **Header fields**: date, mode, scope description, agent count, detected stack, duration (now - start_time), commit hash
|
|
397
|
+
|
|
398
|
+
2. **Scorecard**: Build from DIMENSION SUMMARY data
|
|
399
|
+
- For each dimension, fill in: score, P1/P2/P3 counts, assessment
|
|
400
|
+
- Calculate overall health score using the weighted formula from SKILL.md:
|
|
401
|
+
- `weighted_sum = sum(score * weight for each dimension)`
|
|
402
|
+
- `total_weight = sum(weights for audited dimensions)`
|
|
403
|
+
- `overall_score = weighted_sum / total_weight` (round to 1 decimal)
|
|
404
|
+
- Map overall score to label: 9-10 "Excellent", 7-8 "Good", 5-6 "Adequate", 3-4 "Concerning", 1-2 "Critical"
|
|
405
|
+
|
|
406
|
+
3. **Findings sections**: Group deduplicated findings by severity
|
|
407
|
+
- For each finding, render:
|
|
408
|
+
```
|
|
409
|
+
#### F-NNN: <title> (<severity>)
|
|
410
|
+
|
|
411
|
+
| | |
|
|
412
|
+
|---|---|
|
|
413
|
+
| **File** | `<file>:<line>` |
|
|
414
|
+
| **Dimension** | <dimension> |
|
|
415
|
+
| **Confidence** | <confidence>% |
|
|
416
|
+
| **Agent** | <agent> |
|
|
417
|
+
|
|
418
|
+
<description>
|
|
419
|
+
|
|
420
|
+
**Suggestion:** <suggestion>
|
|
421
|
+
|
|
422
|
+
---
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
4. **Action Plan**: Select the top 5 findings (by severity, then confidence) and format as a numbered action list with brief description of what to fix and why.
|
|
426
|
+
|
|
427
|
+
5. **Refactoring Roadmap** (only if `state.refactoring_plan` is not null):
|
|
428
|
+
- Fill the `{{#IF_REFACTOR_PLAN}}` conditional block
|
|
429
|
+
- Set `{{THEME_COUNT}}`, `{{QUICK_WIN_COUNT}}`, `{{TOTAL_EFFORT}}`, `{{EXECUTION_SUMMARY}}`
|
|
430
|
+
- Render `{{QUICK_WIN_ITEMS}}`: themes flagged as quick wins
|
|
431
|
+
- Render `{{PHASE_1_THEMES}}` through `{{PHASE_4_THEMES}}`: themes grouped by phase
|
|
432
|
+
- For each theme, render using the Theme Detail Template (see report-template.md)
|
|
433
|
+
|
|
434
|
+
6. **Statistics**: Total findings, per-severity counts, agent count, dimension count, per-agent breakdown table.
|
|
435
|
+
|
|
436
|
+
### Write the report
|
|
437
|
+
|
|
438
|
+
Determine the output path:
|
|
439
|
+
- Base: `_bmad-output/deep-audit/deep-audit-<YYYY-MM-DD>.md`
|
|
440
|
+
- If file exists, append suffix: `-2`, `-3`, etc.
|
|
441
|
+
|
|
442
|
+
Write the filled report to the output path.
|
|
443
|
+
|
|
444
|
+
Update state.json with `report_path`.
|
|
445
|
+
|
|
446
|
+
---
|
|
447
|
+
|
|
448
|
+
## Phase 8: Finalize State
|
|
449
|
+
|
|
450
|
+
Update `_bmad-output/deep-audit/state.json`:
|
|
451
|
+
- Set `status = "completed"`
|
|
452
|
+
- Set `end_time` to current ISO timestamp
|
|
453
|
+
- Set `report_path` to the report file path
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
## Phase 9: Present Summary
|
|
458
|
+
|
|
459
|
+
Print a concise summary to the user:
|
|
460
|
+
|
|
461
|
+
```
|
|
462
|
+
═══════════════════════════════════════════════════
|
|
463
|
+
DEEP AUDIT COMPLETE
|
|
464
|
+
═══════════════════════════════════════════════════
|
|
465
|
+
|
|
466
|
+
Mode: <quick|full|single> (<agent_count> agent(s))
|
|
467
|
+
Scope: <scope description>
|
|
468
|
+
Duration: <duration>
|
|
469
|
+
|
|
470
|
+
SCORECARD
|
|
471
|
+
─────────────────────────────────────────────────
|
|
472
|
+
<dimension> <score>/10 (<P1> P1, <P2> P2, <P3> P3)
|
|
473
|
+
<dimension> <score>/10 (<P1> P1, <P2> P2, <P3> P3)
|
|
474
|
+
...
|
|
475
|
+
─────────────────────────────────────────────────
|
|
476
|
+
Overall Health: <overall>/10 — <label>
|
|
477
|
+
|
|
478
|
+
FINDINGS: <total> total (<P1_count> critical, <P2_count> important, <P3_count> minor)
|
|
479
|
+
|
|
480
|
+
TOP ACTIONS
|
|
481
|
+
1. <action 1>
|
|
482
|
+
2. <action 2>
|
|
483
|
+
3. <action 3>
|
|
484
|
+
|
|
485
|
+
Report: <report_path>
|
|
486
|
+
State: _bmad-output/deep-audit/state.json
|
|
487
|
+
═══════════════════════════════════════════════════
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
If `state.refactoring_plan` is not null, add after TOP ACTIONS and before Report:
|
|
491
|
+
```
|
|
492
|
+
REFACTORING ROADMAP
|
|
493
|
+
─────────────────────────────────────────────────
|
|
494
|
+
<theme_count> themes across 4 phases | <quick_win_count> quick wins
|
|
495
|
+
Total effort: <total_effort>
|
|
496
|
+
|
|
497
|
+
QUICK WINS (do these now)
|
|
498
|
+
1. T-NNN: <theme name> (<effort>, <risk> risk)
|
|
499
|
+
2. T-NNN: <theme name> (<effort>, <risk> risk)
|
|
500
|
+
...
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
If any agents failed (including the planner), add a section:
|
|
504
|
+
```
|
|
505
|
+
WARNINGS
|
|
506
|
+
- Agent <name> failed: <error summary>
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
</workflow>
|
|
510
|
+
|
|
511
|
+
## Error Recovery
|
|
512
|
+
|
|
513
|
+
If the workflow fails at any point:
|
|
514
|
+
|
|
515
|
+
1. **State is preserved**: `state.json` tracks which agents completed. Re-running `/deep-audit` with the same commit will auto-resume from where it left off.
|
|
516
|
+
|
|
517
|
+
2. **Manual recovery**: Read `_bmad-output/deep-audit/state.json` to see:
|
|
518
|
+
- Which agents completed successfully (their findings are preserved)
|
|
519
|
+
- Which agents were pending when the failure occurred
|
|
520
|
+
- The raw output from each completed agent
|
|
521
|
+
|
|
522
|
+
3. **Force fresh start**: Delete `_bmad-output/deep-audit/state.json` and re-run.
|
|
523
|
+
|
|
524
|
+
## Safety Rules
|
|
525
|
+
|
|
526
|
+
- NEVER modify source code. This is a read-only audit.
|
|
527
|
+
- NEVER execute project code or tests. Only use git, gh, and file reading tools.
|
|
528
|
+
- NEVER share audit findings outside the local report file.
|
|
529
|
+
- If a scope flag points to a non-existent PR or commit, inform the user and stop.
|
|
530
|
+
- If the project has no source files (empty repo), inform the user and stop.
|
|
@@ -189,8 +189,8 @@ Dev Agent Record update:
|
|
|
189
189
|
- Extract functions if needed
|
|
190
190
|
- Ensure consistent style
|
|
191
191
|
|
|
192
|
-
2. After EACH refactor, run tests:
|
|
193
|
-
npm test
|
|
192
|
+
2. After EACH refactor, run targeted tests:
|
|
193
|
+
npm test -- --filter "{test-file}"
|
|
194
194
|
|
|
195
195
|
- Tests MUST stay green
|
|
196
196
|
- IF tests fail: revert last change, try different approach
|
|
@@ -198,19 +198,20 @@ Dev Agent Record update:
|
|
|
198
198
|
3. Log: "REFACTOR: Code improved, tests still green"
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
-
### 6.4
|
|
201
|
+
### 6.4 Task Completion Check
|
|
202
202
|
|
|
203
203
|
```
|
|
204
|
-
|
|
205
|
-
|
|
204
|
+
IMPORTANT: Do NOT run the full test suite after each individual task.
|
|
205
|
+
The full suite runs ONCE at Step 8.1 (Final Verification) after ALL tasks are complete.
|
|
206
206
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
- New tests pass
|
|
207
|
+
1. Verify targeted tests for this task pass:
|
|
208
|
+
npm test -- --filter "{test-file}"
|
|
210
209
|
|
|
211
|
-
|
|
210
|
+
2. IF targeted tests fail:
|
|
212
211
|
- Fix immediately
|
|
213
212
|
- Do not proceed with failing tests
|
|
213
|
+
|
|
214
|
+
3. Proceed to next task (or Step 7 validation gates)
|
|
214
215
|
```
|
|
215
216
|
|
|
216
217
|
---
|
|
@@ -224,8 +225,8 @@ Dev Agent Record update:
|
|
|
224
225
|
```
|
|
225
226
|
- [ ] Tests exist for the functionality (written FIRST)
|
|
226
227
|
- [ ] TDD cycle completed (red → green → refactor)
|
|
227
|
-
- [ ] All tests pass 100%
|
|
228
|
-
- [ ] No regressions (full suite
|
|
228
|
+
- [ ] All targeted tests pass 100%
|
|
229
|
+
- [ ] No regressions in targeted tests (full suite verified at Step 8.1)
|
|
229
230
|
- [ ] Acceptance criteria for this task satisfied
|
|
230
231
|
```
|
|
231
232
|
|
|
@@ -217,7 +217,9 @@ IF task type is UI:
|
|
|
217
217
|
- E2E tests for user flows
|
|
218
218
|
- Unit tests for component logic
|
|
219
219
|
|
|
220
|
-
6. Run
|
|
220
|
+
6. Run targeted tests for affected test files:
|
|
221
|
+
npm test -- --filter "{test-file}"
|
|
222
|
+
(The full suite runs ONCE at Step 8.1 Final Verification after ALL tasks are complete.)
|
|
221
223
|
```
|
|
222
224
|
|
|
223
225
|
### 6.3 Backend Task Execution (TDD)
|
|
@@ -240,7 +242,9 @@ IF task type is BACKEND:
|
|
|
240
242
|
- Remove duplication
|
|
241
243
|
- Improve naming
|
|
242
244
|
|
|
243
|
-
4. Run
|
|
245
|
+
4. Run targeted tests for affected test files:
|
|
246
|
+
npm test -- --filter "{test-file}"
|
|
247
|
+
(The full suite runs ONCE at Step 8.1 Final Verification after ALL tasks are complete.)
|
|
244
248
|
```
|
|
245
249
|
|
|
246
250
|
### 6.4 Track Task Type Counts
|
package/commands/dev-story-ui.md
CHANGED
|
@@ -300,11 +300,11 @@ Now that UI is visually correct, add tests:
|
|
|
300
300
|
- Utility functions
|
|
301
301
|
- Location: co-located with component (Component.test.tsx)
|
|
302
302
|
|
|
303
|
-
3. Run
|
|
304
|
-
npm test
|
|
305
|
-
|
|
303
|
+
3. Run targeted tests for the tests you just wrote:
|
|
304
|
+
npm test -- --filter "{test-file}"
|
|
305
|
+
(The full suite runs ONCE at Step 11.1 Final Verification after ALL tasks are complete.)
|
|
306
306
|
|
|
307
|
-
4. Ensure
|
|
307
|
+
4. Ensure targeted tests pass before marking task complete
|
|
308
308
|
```
|
|
309
309
|
|
|
310
310
|
---
|