@sienklogic/plan-build-run 2.34.0 → 2.38.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/CHANGELOG.md +683 -0
- package/dashboard/public/css/command-center.css +152 -65
- package/dashboard/public/css/explorer.css +22 -41
- package/dashboard/public/css/layout.css +119 -1
- package/dashboard/public/css/tokens.css +13 -0
- package/dashboard/src/components/Layout.tsx +32 -6
- package/dashboard/src/components/explorer/tabs/PhasesTab.tsx +11 -1
- package/dashboard/src/components/explorer/tabs/TodosTab.tsx +18 -2
- package/dashboard/src/components/partials/AttentionPanel.tsx +7 -1
- package/dashboard/src/components/partials/CurrentPhaseCard.tsx +26 -24
- package/dashboard/src/components/partials/QuickActions.tsx +21 -11
- package/dashboard/src/components/partials/StatCardGrid.tsx +67 -0
- package/dashboard/src/components/partials/StatusHeader.tsx +1 -0
- package/dashboard/src/routes/command-center.routes.tsx +8 -7
- package/dashboard/src/routes/index.routes.tsx +32 -29
- package/package.json +2 -2
- package/plugins/copilot-pbr/agents/audit.agent.md +129 -16
- package/plugins/copilot-pbr/agents/codebase-mapper.agent.md +49 -1
- package/plugins/copilot-pbr/agents/debugger.agent.md +50 -1
- package/plugins/copilot-pbr/agents/dev-sync.agent.md +23 -0
- package/plugins/copilot-pbr/agents/executor.agent.md +153 -8
- package/plugins/copilot-pbr/agents/general.agent.md +46 -1
- package/plugins/copilot-pbr/agents/integration-checker.agent.md +55 -2
- package/plugins/copilot-pbr/agents/plan-checker.agent.md +50 -2
- package/plugins/copilot-pbr/agents/planner.agent.md +80 -1
- package/plugins/copilot-pbr/agents/researcher.agent.md +50 -2
- package/plugins/copilot-pbr/agents/synthesizer.agent.md +49 -1
- package/plugins/copilot-pbr/agents/verifier.agent.md +114 -13
- package/plugins/copilot-pbr/commands/test.md +5 -0
- package/plugins/copilot-pbr/hooks/hooks.json +11 -0
- package/plugins/copilot-pbr/plugin.json +1 -1
- package/plugins/copilot-pbr/references/agent-contracts.md +27 -0
- package/plugins/copilot-pbr/references/checkpoints.md +32 -1
- package/plugins/copilot-pbr/references/context-quality-tiers.md +45 -0
- package/plugins/copilot-pbr/references/pbr-tools-cli.md +115 -0
- package/plugins/copilot-pbr/references/questioning.md +21 -1
- package/plugins/copilot-pbr/references/verification-patterns.md +96 -18
- package/plugins/copilot-pbr/skills/audit/SKILL.md +19 -3
- package/plugins/copilot-pbr/skills/begin/SKILL.md +57 -4
- package/plugins/copilot-pbr/skills/build/SKILL.md +39 -2
- package/plugins/copilot-pbr/skills/config/SKILL.md +12 -2
- package/plugins/copilot-pbr/skills/debug/SKILL.md +12 -1
- package/plugins/copilot-pbr/skills/explore/SKILL.md +13 -2
- package/plugins/copilot-pbr/skills/health/SKILL.md +13 -5
- package/plugins/copilot-pbr/skills/import/SKILL.md +26 -1
- package/plugins/copilot-pbr/skills/milestone/SKILL.md +15 -3
- package/plugins/copilot-pbr/skills/plan/SKILL.md +50 -0
- package/plugins/copilot-pbr/skills/quick/SKILL.md +21 -0
- package/plugins/copilot-pbr/skills/review/SKILL.md +45 -0
- package/plugins/copilot-pbr/skills/scan/SKILL.md +20 -0
- package/plugins/copilot-pbr/skills/setup/SKILL.md +9 -1
- package/plugins/copilot-pbr/skills/shared/context-budget.md +10 -0
- package/plugins/copilot-pbr/skills/shared/universal-anti-patterns.md +6 -0
- package/plugins/copilot-pbr/skills/test/SKILL.md +210 -0
- package/plugins/copilot-pbr/templates/SUMMARY-complex.md.tmpl +95 -0
- package/plugins/copilot-pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
- package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
- package/plugins/cursor-pbr/agents/audit.md +52 -5
- package/plugins/cursor-pbr/agents/codebase-mapper.md +49 -1
- package/plugins/cursor-pbr/agents/debugger.md +50 -1
- package/plugins/cursor-pbr/agents/dev-sync.md +23 -0
- package/plugins/cursor-pbr/agents/executor.md +153 -8
- package/plugins/cursor-pbr/agents/general.md +46 -1
- package/plugins/cursor-pbr/agents/integration-checker.md +54 -1
- package/plugins/cursor-pbr/agents/plan-checker.md +49 -1
- package/plugins/cursor-pbr/agents/planner.md +80 -1
- package/plugins/cursor-pbr/agents/researcher.md +49 -1
- package/plugins/cursor-pbr/agents/synthesizer.md +49 -1
- package/plugins/cursor-pbr/agents/verifier.md +113 -12
- package/plugins/cursor-pbr/commands/test.md +5 -0
- package/plugins/cursor-pbr/hooks/hooks.json +9 -0
- package/plugins/cursor-pbr/references/agent-contracts.md +27 -0
- package/plugins/cursor-pbr/references/checkpoints.md +32 -1
- package/plugins/cursor-pbr/references/context-quality-tiers.md +45 -0
- package/plugins/cursor-pbr/references/pbr-tools-cli.md +115 -0
- package/plugins/cursor-pbr/references/questioning.md +21 -1
- package/plugins/cursor-pbr/references/verification-patterns.md +96 -18
- package/plugins/cursor-pbr/skills/audit/SKILL.md +19 -3
- package/plugins/cursor-pbr/skills/begin/SKILL.md +57 -4
- package/plugins/cursor-pbr/skills/build/SKILL.md +37 -2
- package/plugins/cursor-pbr/skills/config/SKILL.md +12 -2
- package/plugins/cursor-pbr/skills/debug/SKILL.md +12 -1
- package/plugins/cursor-pbr/skills/explore/SKILL.md +13 -2
- package/plugins/cursor-pbr/skills/health/SKILL.md +14 -5
- package/plugins/cursor-pbr/skills/import/SKILL.md +26 -1
- package/plugins/cursor-pbr/skills/milestone/SKILL.md +15 -3
- package/plugins/cursor-pbr/skills/plan/SKILL.md +50 -0
- package/plugins/cursor-pbr/skills/quick/SKILL.md +21 -0
- package/plugins/cursor-pbr/skills/review/SKILL.md +45 -0
- package/plugins/cursor-pbr/skills/scan/SKILL.md +20 -0
- package/plugins/cursor-pbr/skills/setup/SKILL.md +9 -1
- package/plugins/cursor-pbr/skills/shared/context-budget.md +10 -0
- package/plugins/cursor-pbr/skills/shared/universal-anti-patterns.md +6 -0
- package/plugins/cursor-pbr/skills/test/SKILL.md +211 -0
- package/plugins/cursor-pbr/templates/SUMMARY-complex.md.tmpl +95 -0
- package/plugins/cursor-pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
- package/plugins/pbr/.claude-plugin/plugin.json +1 -1
- package/plugins/pbr/agents/audit.md +45 -0
- package/plugins/pbr/agents/codebase-mapper.md +48 -0
- package/plugins/pbr/agents/debugger.md +49 -0
- package/plugins/pbr/agents/dev-sync.md +23 -0
- package/plugins/pbr/agents/executor.md +151 -6
- package/plugins/pbr/agents/general.md +45 -0
- package/plugins/pbr/agents/integration-checker.md +53 -0
- package/plugins/pbr/agents/plan-checker.md +48 -0
- package/plugins/pbr/agents/planner.md +78 -1
- package/plugins/pbr/agents/researcher.md +48 -0
- package/plugins/pbr/agents/synthesizer.md +48 -0
- package/plugins/pbr/agents/verifier.md +112 -11
- package/plugins/pbr/commands/test.md +5 -0
- package/plugins/pbr/hooks/hooks.json +9 -0
- package/plugins/pbr/references/agent-contracts.md +27 -0
- package/plugins/pbr/references/checkpoints.md +32 -0
- package/plugins/pbr/references/context-quality-tiers.md +45 -0
- package/plugins/pbr/references/pbr-tools-cli.md +115 -0
- package/plugins/pbr/references/questioning.md +21 -0
- package/plugins/pbr/references/verification-patterns.md +96 -17
- package/plugins/pbr/scripts/check-plan-format.js +13 -1
- package/plugins/pbr/scripts/check-state-sync.js +26 -7
- package/plugins/pbr/scripts/check-subagent-output.js +30 -2
- package/plugins/pbr/scripts/config-schema.json +11 -1
- package/plugins/pbr/scripts/context-bridge.js +265 -0
- package/plugins/pbr/scripts/lib/config.js +271 -0
- package/plugins/pbr/scripts/lib/core.js +587 -0
- package/plugins/pbr/scripts/lib/history.js +73 -0
- package/plugins/pbr/scripts/lib/init.js +166 -0
- package/plugins/pbr/scripts/lib/migrate.js +169 -0
- package/plugins/pbr/scripts/lib/phase.js +364 -0
- package/plugins/pbr/scripts/lib/roadmap.js +175 -0
- package/plugins/pbr/scripts/lib/state.js +397 -0
- package/plugins/pbr/scripts/lib/todo.js +300 -0
- package/plugins/pbr/scripts/pbr-tools.js +425 -1310
- package/plugins/pbr/scripts/post-write-dispatch.js +5 -4
- package/plugins/pbr/scripts/pre-write-dispatch.js +1 -1
- package/plugins/pbr/scripts/progress-tracker.js +1 -1
- package/plugins/pbr/scripts/suggest-compact.js +1 -1
- package/plugins/pbr/scripts/track-context-budget.js +53 -2
- package/plugins/pbr/scripts/validate-task.js +20 -28
- package/plugins/pbr/skills/audit/SKILL.md +19 -3
- package/plugins/pbr/skills/begin/SKILL.md +48 -2
- package/plugins/pbr/skills/build/SKILL.md +39 -2
- package/plugins/pbr/skills/config/SKILL.md +12 -2
- package/plugins/pbr/skills/debug/SKILL.md +12 -1
- package/plugins/pbr/skills/debug/templates/continuation-prompt.md.tmpl +12 -1
- package/plugins/pbr/skills/debug/templates/initial-investigation-prompt.md.tmpl +12 -5
- package/plugins/pbr/skills/explore/SKILL.md +13 -2
- package/plugins/pbr/skills/health/SKILL.md +14 -3
- package/plugins/pbr/skills/help/SKILL.md +2 -0
- package/plugins/pbr/skills/import/SKILL.md +26 -1
- package/plugins/pbr/skills/milestone/SKILL.md +15 -3
- package/plugins/pbr/skills/plan/SKILL.md +52 -2
- package/plugins/pbr/skills/quick/SKILL.md +21 -0
- package/plugins/pbr/skills/review/SKILL.md +46 -0
- package/plugins/pbr/skills/scan/SKILL.md +20 -0
- package/plugins/pbr/skills/setup/SKILL.md +9 -1
- package/plugins/pbr/skills/shared/context-budget.md +10 -0
- package/plugins/pbr/skills/shared/universal-anti-patterns.md +6 -0
- package/plugins/pbr/skills/test/SKILL.md +212 -0
- package/plugins/pbr/templates/SUMMARY-complex.md.tmpl +95 -0
- package/plugins/pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
|
@@ -17,10 +17,16 @@ Then proceed to Step 1.
|
|
|
17
17
|
|
|
18
18
|
# /pbr:health — Planning Directory Diagnostics
|
|
19
19
|
|
|
20
|
-
You are running the **health** skill. Your job is to validate the integrity of the `.planning/` directory, report problems, and suggest targeted fixes.
|
|
20
|
+
You are running the **health** skill. Your job is to validate the integrity of the `.planning/` directory, report problems, and suggest targeted fixes.
|
|
21
21
|
|
|
22
22
|
This skill runs **inline**. It is read-only by default, but offers an optional **auto-fix** flow for common corruption patterns (see the Auto-Fix section below).
|
|
23
23
|
|
|
24
|
+
## Argument Parsing
|
|
25
|
+
|
|
26
|
+
Check if the user passed `--repair`:
|
|
27
|
+
- `--repair`: Skip the AskUserQuestion prompt in the Auto-Fix section and automatically apply ALL fixes (equivalent to selecting "Fix all"). Still create backups before any destructive operations.
|
|
28
|
+
- No flag: Use the interactive AskUserQuestion flow as described below (default behavior).
|
|
29
|
+
|
|
24
30
|
---
|
|
25
31
|
|
|
26
32
|
## How Checks Work
|
|
@@ -184,7 +190,11 @@ cp .planning/STATE.md .planning/backups/STATE-$(date +%Y%m%dT%H%M%S).md
|
|
|
184
190
|
|
|
185
191
|
This ensures the user can recover the original STATE.md if the fix produces incorrect results.
|
|
186
192
|
|
|
187
|
-
1. Count the auto-fixable issues
|
|
193
|
+
1. Count the auto-fixable issues.
|
|
194
|
+
|
|
195
|
+
**If `--repair` flag was passed**: Skip the question and go directly to "Fix all" (step 2). Display: "Auto-repair mode: applying {N} fixes..."
|
|
196
|
+
|
|
197
|
+
**Otherwise**: Present the choice:
|
|
188
198
|
|
|
189
199
|
Use AskUserQuestion:
|
|
190
200
|
question: "Found {N} auto-fixable issues. How should we handle them?"
|
|
@@ -194,7 +204,7 @@ This ensures the user can recover the original STATE.md if the fix produces inco
|
|
|
194
204
|
- label: "Review each" description: "Show each fix and confirm individually"
|
|
195
205
|
- label: "Skip" description: "Do nothing — just report"
|
|
196
206
|
|
|
197
|
-
2. If "Fix all": Apply all fixes in order, then display a summary:
|
|
207
|
+
2. If "Fix all" (or `--repair`): Apply all fixes in order, then display a summary:
|
|
198
208
|
```
|
|
199
209
|
Auto-fix results:
|
|
200
210
|
- Fixed: {description of fix 1}
|
|
@@ -213,8 +223,6 @@ This ensures the user can recover the original STATE.md if the fix produces inco
|
|
|
213
223
|
|
|
214
224
|
4. If "Skip": Do nothing, continue to the rest of the output.
|
|
215
225
|
|
|
216
|
-
**Note:** When auto-fix is active, the health skill is no longer strictly read-only. The `allowed-tools` frontmatter must include `Write` and `AskUserQuestion` for auto-fix to work. Update the frontmatter accordingly.
|
|
217
|
-
|
|
218
226
|
---
|
|
219
227
|
|
|
220
228
|
## Bonus: Recent Decisions
|
|
@@ -275,6 +275,13 @@ Task({
|
|
|
275
275
|
```
|
|
276
276
|
You are the plan-checker agent.
|
|
277
277
|
|
|
278
|
+
<files_to_read>
|
|
279
|
+
CRITICAL: Read these files BEFORE any other action:
|
|
280
|
+
1. .planning/CONTEXT.md — locked decisions and constraints (if exists)
|
|
281
|
+
2. .planning/STATE.md — current project state and progress
|
|
282
|
+
3. .planning/ROADMAP.md — phase structure, goals, and dependencies
|
|
283
|
+
</files_to_read>
|
|
284
|
+
|
|
278
285
|
<plans_to_check>
|
|
279
286
|
{For each generated PLAN.md:}
|
|
280
287
|
--- Plan File: {filename} ---
|
|
@@ -305,7 +312,15 @@ Run all verification dimensions on these plans. Return your structured report.
|
|
|
305
312
|
Do NOT write any files. Return your findings as your response text.
|
|
306
313
|
```
|
|
307
314
|
|
|
308
|
-
**Process checker results —
|
|
315
|
+
**Process checker results — completion marker check:**
|
|
316
|
+
|
|
317
|
+
After the plan-checker completes, check for completion markers in the Task() output:
|
|
318
|
+
|
|
319
|
+
- If `## CHECK PASSED` is present: skip the revision loop entirely and proceed to Step 7.
|
|
320
|
+
- If `## ISSUES FOUND` is present: enter the revision loop below.
|
|
321
|
+
- If neither marker is found: treat as issues found and enter the revision loop.
|
|
322
|
+
|
|
323
|
+
**Revision loop:**
|
|
309
324
|
|
|
310
325
|
Reference: `skills/shared/revision-loop.md` for the full Check-Revise-Escalate pattern (max 3 iterations).
|
|
311
326
|
|
|
@@ -325,6 +340,16 @@ If existing plans are being replaced (user confirmed in Step 1):
|
|
|
325
340
|
|
|
326
341
|
---
|
|
327
342
|
|
|
343
|
+
**Step 7b — Spot-check artifacts:**
|
|
344
|
+
|
|
345
|
+
After writing plan files, verify they landed on disk:
|
|
346
|
+
|
|
347
|
+
1. Glob `.planning/phases/{NN}-{slug}/PLAN-*.md` to confirm files exist
|
|
348
|
+
2. Count matches — must equal the number of plans generated in Step 5
|
|
349
|
+
3. If any are missing: re-attempt the write. If still missing, display an error listing the missing files.
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
328
353
|
### Step 8: Update All State (inline)
|
|
329
354
|
|
|
330
355
|
Perform all state updates in this order:
|
|
@@ -486,6 +486,12 @@ Verify milestone completion with cross-phase integration checks.
|
|
|
486
486
|
```
|
|
487
487
|
You are integration-checker. Perform cross-phase integration verification.
|
|
488
488
|
|
|
489
|
+
<files_to_read>
|
|
490
|
+
CRITICAL: Read these files BEFORE any other action:
|
|
491
|
+
1. .planning/ROADMAP.md — phase structure, goals, and dependencies
|
|
492
|
+
2. .planning/phases/{NN}-{slug}/SUMMARY.md — for each milestone phase (read all)
|
|
493
|
+
</files_to_read>
|
|
494
|
+
|
|
489
495
|
Milestone: {version or "current"}
|
|
490
496
|
Phases to check: {list of phase directories}
|
|
491
497
|
|
|
@@ -505,20 +511,26 @@ Verify milestone completion with cross-phase integration checks.
|
|
|
505
511
|
5. Return findings as a structured report
|
|
506
512
|
```
|
|
507
513
|
|
|
508
|
-
4. **Check
|
|
514
|
+
4. **Check integration-checker completion:**
|
|
515
|
+
|
|
516
|
+
After the integration-checker completes, check for `## INTEGRATION CHECK COMPLETE` in the Task() output. If the marker is absent, warn: `⚠ Integration checker did not return completion marker — results may be incomplete.` Proceed with whatever findings were returned but note the incomplete status in the audit report.
|
|
517
|
+
|
|
518
|
+
5. **Check requirements coverage:**
|
|
509
519
|
- Read REQUIREMENTS.md
|
|
510
520
|
- For each requirement tagged for this milestone:
|
|
511
521
|
- Search VERIFICATION.md files for coverage
|
|
512
522
|
- Search SUMMARY.md `provides` fields
|
|
513
523
|
- Flag uncovered requirements
|
|
514
524
|
|
|
515
|
-
|
|
525
|
+
6. **Write audit report:**
|
|
516
526
|
|
|
517
527
|
Create `.planning/{version}-MILESTONE-AUDIT.md` using the template:
|
|
518
528
|
|
|
519
529
|
Read `skills/milestone/templates/audit-report.md.tmpl` for the audit report format. Fill in all `{variable}` placeholders with actual data from the audit.
|
|
520
530
|
|
|
521
|
-
|
|
531
|
+
**Spot-check:** After writing, verify `.planning/{version}-MILESTONE-AUDIT.md` exists on disk using Glob. If missing, re-attempt the write. If still missing, display an error and include findings inline.
|
|
532
|
+
|
|
533
|
+
7. **Report to user** using branded banners:
|
|
522
534
|
|
|
523
535
|
**If PASSED:**
|
|
524
536
|
```
|
|
@@ -3,6 +3,8 @@ name: plan
|
|
|
3
3
|
description: "Create a detailed plan for a phase. Research, plan, and verify before building."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
**STOP — DO NOT READ THIS FILE. You are already reading it. This prompt was injected into your context by Claude Code's plugin system. Using the Read tool on this SKILL.md file wastes ~7,600 tokens. Begin executing Step 1 immediately.**
|
|
7
|
+
|
|
6
8
|
# /pbr:plan — Phase Planning
|
|
7
9
|
|
|
8
10
|
You are the orchestrator for `/pbr:plan`. This skill creates detailed, executable plans for a specific phase. Plans are the bridge between the roadmap and actual code — they must be specific enough for an executor agent to follow mechanically. Your job is to stay lean, delegate heavy work to agents, and keep the user's main context window clean.
|
|
@@ -135,6 +137,8 @@ Reference: `skills/shared/config-loading.md` for the tooling shortcut (`state lo
|
|
|
135
137
|
|
|
136
138
|
### Step 2: Load Context (inline)
|
|
137
139
|
|
|
140
|
+
**Init-first pattern**: When spawning agents, pass the output of `node plugins/pbr/scripts/pbr-tools.js init plan-phase {N}` as context rather than having the agent read multiple files separately. This reduces file reads and prevents context-loading failures.
|
|
141
|
+
|
|
138
142
|
Read context file PATHS and metadata. Build lean context bundles for agent prompts — include paths and one-line descriptions, NOT full file bodies. Agents have the Read tool and will pull file contents on-demand.
|
|
139
143
|
|
|
140
144
|
```
|
|
@@ -221,8 +225,22 @@ Read `skills/plan/templates/researcher-prompt.md.tmpl` and use it as the prompt
|
|
|
221
225
|
- `{dependencies from roadmap}` - dependency list
|
|
222
226
|
- Fill `<project_context>` and `<prior_work>` blocks per the shared partial (`templates/prompt-partials/phase-project-context.md.tmpl`): Decision Summary for context, manifest table for prior work
|
|
223
227
|
|
|
228
|
+
**Prepend this block to the researcher prompt before sending:**
|
|
229
|
+
```
|
|
230
|
+
<files_to_read>
|
|
231
|
+
CRITICAL: Read these files BEFORE any other action:
|
|
232
|
+
1. .planning/ROADMAP.md — phase goals, dependencies, and structure
|
|
233
|
+
2. .planning/REQUIREMENTS.md — scoped requirements for this phase (if exists)
|
|
234
|
+
</files_to_read>
|
|
235
|
+
```
|
|
236
|
+
|
|
224
237
|
Wait for the researcher to complete before proceeding.
|
|
225
238
|
|
|
239
|
+
After the researcher completes, check the agent output for a completion marker:
|
|
240
|
+
- If `## RESEARCH COMPLETE` is present: proceed to planner
|
|
241
|
+
- If `## RESEARCH BLOCKED` is present: warn the user that research could not complete, ask if they want to proceed with limited context or stop
|
|
242
|
+
- If neither marker is present: warn that researcher may not have completed successfully, but proceed
|
|
243
|
+
|
|
226
244
|
---
|
|
227
245
|
|
|
228
246
|
### Step 4.5: Seed Scanning (inline, before planning)
|
|
@@ -336,6 +354,16 @@ Read `skills/plan/templates/planner-prompt.md.tmpl` and use it as the prompt tem
|
|
|
336
354
|
- `<config>` - max tasks, parallelization, TDD mode from config.json
|
|
337
355
|
- `<planning_instructions>` - phase-specific planning rules and output path
|
|
338
356
|
|
|
357
|
+
**Prepend this block to the planner prompt before sending:**
|
|
358
|
+
```
|
|
359
|
+
<files_to_read>
|
|
360
|
+
CRITICAL: Read these files BEFORE any other action:
|
|
361
|
+
1. .planning/CONTEXT.md — locked decisions and constraints (if exists)
|
|
362
|
+
2. .planning/ROADMAP.md — phase goals, dependencies, and structure
|
|
363
|
+
3. .planning/phases/{NN}-{slug}/RESEARCH.md — research findings (if exists)
|
|
364
|
+
</files_to_read>
|
|
365
|
+
```
|
|
366
|
+
|
|
339
367
|
Wait for the planner to complete.
|
|
340
368
|
|
|
341
369
|
After the planner returns, read the plan files it created to extract counts. Display a completion summary:
|
|
@@ -346,6 +374,17 @@ Planner created {N} plan(s) across {M} wave(s)
|
|
|
346
374
|
|
|
347
375
|
Where `{N}` is the number of PLAN.md files written and `{M}` is the number of distinct wave values across those plans (from frontmatter).
|
|
348
376
|
|
|
377
|
+
### Step 5b: Spot-Check Planner Output
|
|
378
|
+
|
|
379
|
+
CRITICAL: Verify planner output before proceeding.
|
|
380
|
+
|
|
381
|
+
1. **PLAN files exist**: Check `.planning/phases/{NN}-{slug}/PLAN-*.md` files exist on disk
|
|
382
|
+
2. **Valid frontmatter**: Read first 20 lines of each PLAN file — verify `depends_on`, `files_modified`, `must_haves` fields present
|
|
383
|
+
3. **Task structure**: Verify at least one `<task>` block exists in each plan file
|
|
384
|
+
4. **Plan count matches**: Number of PLAN files matches what the planner reported
|
|
385
|
+
|
|
386
|
+
If ANY spot-check fails, present the user with options: **Retry** / **Continue anyway** / **Abort**
|
|
387
|
+
|
|
349
388
|
---
|
|
350
389
|
|
|
351
390
|
### Step 6: Plan Validation (delegated, conditional)
|
|
@@ -372,6 +411,15 @@ Read `skills/plan/templates/checker-prompt.md.tmpl` and use it as the prompt tem
|
|
|
372
411
|
- `<phase_context>` - phase goal and requirement IDs
|
|
373
412
|
- `<context>` - file paths to project-level and phase-level CONTEXT.md files (checker reads via Read tool)
|
|
374
413
|
|
|
414
|
+
**Prepend this block to the checker prompt before sending:**
|
|
415
|
+
```
|
|
416
|
+
<files_to_read>
|
|
417
|
+
CRITICAL: Read these files BEFORE any other action:
|
|
418
|
+
1. .planning/phases/{NN}-{slug}/PLAN-*.md — plan files to validate
|
|
419
|
+
2. .planning/CONTEXT.md — locked decisions to check against (if exists)
|
|
420
|
+
</files_to_read>
|
|
421
|
+
```
|
|
422
|
+
|
|
375
423
|
**Process checker results:**
|
|
376
424
|
|
|
377
425
|
After the plan checker returns, display its result:
|
|
@@ -463,6 +511,8 @@ Use the approve-revise-abort pattern from `skills/shared/gate-prompts.md`:
|
|
|
463
511
|
5. Update the `Status` column to `planned`
|
|
464
512
|
6. Save the file — do NOT skip this step
|
|
465
513
|
- Update STATE.md **(CRITICAL — update BOTH frontmatter AND body)**: set `status: "planned"`, `plans_total`, `last_command` in frontmatter AND update `Status:`, `Plan:` lines in body `## Current Position`
|
|
514
|
+
|
|
515
|
+
**Tooling shortcut**: `node ${PLUGIN_ROOT}/scripts/pbr-tools.js state patch '{"status":"planned","last_command":"/pbr:plan {N}"}'`
|
|
466
516
|
- **If `features.auto_advance` is `true` AND `mode` is `autonomous`:** Chain directly to build. This continues the build->review->plan->build cycle automatically.
|
|
467
517
|
- **Otherwise:** Suggest next action: `/pbr:build {N}`
|
|
468
518
|
|
|
@@ -44,6 +44,8 @@ Additionally for this skill:
|
|
|
44
44
|
|
|
45
45
|
### Step 1: Check Project Context
|
|
46
46
|
|
|
47
|
+
**Init-first pattern**: When spawning agents, pass the output of `node plugins/pbr/scripts/pbr-tools.js init quick "{description}"` as context rather than having the agent read multiple files separately. This reduces file reads and prevents context-loading failures.
|
|
48
|
+
|
|
47
49
|
1. Check if `.planning/` directory exists
|
|
48
50
|
- If yes: read config.json for settings
|
|
49
51
|
- If no: create **both** `.planning/` and `.planning/quick/` directories, then warn "No Plan-Build-Run project found. This will create a standalone quick task. Consider running `/pbr:begin` first for full project tracking."
|
|
@@ -167,9 +169,17 @@ Display to the user: `◐ Spawning executor...`
|
|
|
167
169
|
|
|
168
170
|
Spawn a `Task(agent_type: "pbr:executor")` with the following prompt:
|
|
169
171
|
|
|
172
|
+
> **Completion markers**: After executor completes, check for `## PLAN COMPLETE` or `## PLAN FAILED`. Route accordingly.
|
|
173
|
+
|
|
170
174
|
```
|
|
171
175
|
You are executor. Execute the following quick task plan.
|
|
172
176
|
|
|
177
|
+
<files_to_read>
|
|
178
|
+
CRITICAL: Read these files BEFORE any other action:
|
|
179
|
+
1. .planning/quick/{NNN}-{slug}/PLAN.md — the quick task plan with task details
|
|
180
|
+
2. .planning/STATE.md — current project state and progress (if exists)
|
|
181
|
+
</files_to_read>
|
|
182
|
+
|
|
173
183
|
Plan file: .planning/quick/{NNN}-{slug}/PLAN.md
|
|
174
184
|
Phase: quick
|
|
175
185
|
Plan ID: {NNN}
|
|
@@ -192,6 +202,17 @@ After the executor completes:
|
|
|
192
202
|
- `partial` — some tasks completed, others failed
|
|
193
203
|
- `failed` — task failed entirely
|
|
194
204
|
|
|
205
|
+
### Step 8b: Spot-Check Executor Output
|
|
206
|
+
|
|
207
|
+
CRITICAL: Verify executor output before proceeding.
|
|
208
|
+
|
|
209
|
+
1. **SUMMARY.md exists**: Check `.planning/quick/{NNN}-{slug}/SUMMARY.md` exists
|
|
210
|
+
2. **Key files exist**: Verify first 2 files from SUMMARY.md `key_files` frontmatter exist on disk
|
|
211
|
+
3. **Commits present**: Run `git log --oneline -5` and verify at least one commit matches the task scope
|
|
212
|
+
4. **Self-check status**: Look for `## Self-Check: FAILED` in SUMMARY.md — if present, warn the user
|
|
213
|
+
|
|
214
|
+
If ANY spot-check fails, present the user with options: **Retry** / **Continue anyway** / **Abort**
|
|
215
|
+
|
|
195
216
|
### Step 9: Update STATE.md
|
|
196
217
|
|
|
197
218
|
If STATE.md exists, update the Quick Tasks section.
|
|
@@ -60,6 +60,8 @@ Execute these steps in order.
|
|
|
60
60
|
|
|
61
61
|
### Step 1: Parse and Validate (inline)
|
|
62
62
|
|
|
63
|
+
**Init-first pattern**: When spawning agents, pass the output of `node plugins/pbr/scripts/pbr-tools.js init verify-work {N}` as context rather than having the agent read multiple files separately. This reduces file reads and prevents context-loading failures.
|
|
64
|
+
|
|
63
65
|
1. Parse `$ARGUMENTS` for phase number and `--auto-fix` flag
|
|
64
66
|
2. Read `.planning/config.json`
|
|
65
67
|
**CRITICAL: Write .active-skill NOW.** Write the text "review" to `.planning/.active-skill` using the Write tool.
|
|
@@ -154,6 +156,16 @@ Invoke the `@verifier` agent to run three-layer checks.
|
|
|
154
156
|
|
|
155
157
|
Read `skills/review/templates/verifier-prompt.md.tmpl` and use its content as the verifier prompt.
|
|
156
158
|
|
|
159
|
+
**Prepend this block to the verifier prompt before sending:**
|
|
160
|
+
```
|
|
161
|
+
<files_to_read>
|
|
162
|
+
CRITICAL: Read these files BEFORE any other action:
|
|
163
|
+
1. .planning/phases/{NN}-{slug}/PLAN-*.md — must-haves to verify against
|
|
164
|
+
2. .planning/phases/{NN}-{slug}/SUMMARY-*.md — executor build summaries
|
|
165
|
+
3. .planning/phases/{NN}-{slug}/VERIFICATION.md — prior verification results (if exists)
|
|
166
|
+
</files_to_read>
|
|
167
|
+
```
|
|
168
|
+
|
|
157
169
|
**Placeholders to fill before sending:**
|
|
158
170
|
- `{For each PLAN.md file in the phase directory:}` — inline each plan's must_haves frontmatter block
|
|
159
171
|
- `{For each SUMMARY.md file in the phase directory:}` — provide manifest table with file paths and status from frontmatter. The verifier reads full content from disk via Read tool.
|
|
@@ -180,6 +192,17 @@ Then show a brief table of must-haves with pass/fail status:
|
|
|
180
192
|
|
|
181
193
|
Then display the overall verdict (`PASSED`, `GAPS FOUND`, or `HUMAN NEEDED`) before proceeding to the full results presentation.
|
|
182
194
|
|
|
195
|
+
### Step 3a: Spot-Check Verifier Output
|
|
196
|
+
|
|
197
|
+
CRITICAL: Verify verifier output before proceeding.
|
|
198
|
+
|
|
199
|
+
1. **VERIFICATION.md exists**: Check `.planning/phases/{NN}-{slug}/VERIFICATION.md` exists on disk
|
|
200
|
+
2. **Status field present**: Read VERIFICATION.md frontmatter — verify `status` field is present and is one of: pass, fail, partial
|
|
201
|
+
3. **Must-haves checked**: Verify `must_haves_checked` count > 0 in frontmatter
|
|
202
|
+
4. **Completion marker**: Look for `## VERIFICATION COMPLETE` in the Task() output
|
|
203
|
+
|
|
204
|
+
If ANY spot-check fails, present the user with options: **Retry** / **Continue anyway** / **Abort**
|
|
205
|
+
|
|
183
206
|
---
|
|
184
207
|
|
|
185
208
|
### Step 3b: Local LLM Verification Quality Check (optional, advisory)
|
|
@@ -367,6 +390,16 @@ Invoke the `@debugger` agent to analyze each failure.
|
|
|
367
390
|
|
|
368
391
|
Read `skills/review/templates/debugger-prompt.md.tmpl` and use its content as the debugger prompt.
|
|
369
392
|
|
|
393
|
+
**Prepend this block to the debugger prompt before sending:**
|
|
394
|
+
```
|
|
395
|
+
<files_to_read>
|
|
396
|
+
CRITICAL: Read these files BEFORE any other action:
|
|
397
|
+
1. .planning/phases/{NN}-{slug}/VERIFICATION.md — gaps and failure details
|
|
398
|
+
2. .planning/phases/{NN}-{slug}/SUMMARY-*.md — what was built
|
|
399
|
+
3. .planning/phases/{NN}-{slug}/PLAN-*.md — original plan must-haves
|
|
400
|
+
</files_to_read>
|
|
401
|
+
```
|
|
402
|
+
|
|
370
403
|
**Placeholders to fill before sending:**
|
|
371
404
|
- `[Inline the VERIFICATION.md content]` — provide file path; debugger reads via Read tool
|
|
372
405
|
- `[Inline all SUMMARY.md files for the phase]` — provide manifest table of file paths
|
|
@@ -382,6 +415,16 @@ Invoke the `@planner` agent in gap-closure mode.
|
|
|
382
415
|
|
|
383
416
|
Read `skills/review/templates/gap-planner-prompt.md.tmpl` and use its content as the gap planner prompt.
|
|
384
417
|
|
|
418
|
+
**Prepend this block to the gap planner prompt before sending:**
|
|
419
|
+
```
|
|
420
|
+
<files_to_read>
|
|
421
|
+
CRITICAL: Read these files BEFORE any other action:
|
|
422
|
+
1. .planning/phases/{NN}-{slug}/VERIFICATION.md — gaps to close
|
|
423
|
+
2. .planning/phases/{NN}-{slug}/PLAN-*.md — existing plans for context
|
|
424
|
+
3. .planning/CONTEXT.md — locked decisions and constraints (if exists)
|
|
425
|
+
</files_to_read>
|
|
426
|
+
```
|
|
427
|
+
|
|
385
428
|
**Placeholders to fill before sending:**
|
|
386
429
|
- `[Inline VERIFICATION.md]` — provide file path; planner reads via Read tool
|
|
387
430
|
- `[Inline the debugger's root cause analysis]` — keep inline (already in conversation context)
|
|
@@ -562,6 +605,8 @@ After review completes, always present a clear next action using the completion
|
|
|
562
605
|
- **If gaps remain:** Use the "Gaps Found" template. Fill in phase number, name, gap count, and gap summaries.
|
|
563
606
|
- **If final phase:** Use the "Milestone Complete" template. Fill in phase count.
|
|
564
607
|
|
|
608
|
+
Include `<sub>/clear first → fresh context window</sub>` inside the Next Up routing block of the completion template.
|
|
609
|
+
|
|
565
610
|
---
|
|
566
611
|
|
|
567
612
|
## Notes
|
|
@@ -123,6 +123,14 @@ For each agent, read `skills/scan/templates/mapper-prompt.md.tmpl` and fill in t
|
|
|
123
123
|
- `{scale}`: detected scale from Step 2
|
|
124
124
|
- `{output_path}`: `.planning/codebase/`
|
|
125
125
|
|
|
126
|
+
**Prepend this block to each mapper prompt before sending:**
|
|
127
|
+
```
|
|
128
|
+
<files_to_read>
|
|
129
|
+
CRITICAL: Read these files BEFORE any other action:
|
|
130
|
+
1. .planning/codebase/RECON.md — baseline reconnaissance data (if exists)
|
|
131
|
+
</files_to_read>
|
|
132
|
+
```
|
|
133
|
+
|
|
126
134
|
| Agent | Focus | Output Files | When |
|
|
127
135
|
|-------|-------|-------------|------|
|
|
128
136
|
| 1 | tech | STACK.md, INTEGRATIONS.md | Always |
|
|
@@ -142,6 +150,18 @@ All agents run in parallel. As each completes, display:
|
|
|
142
150
|
|
|
143
151
|
(Only display lines for the focus areas that were actually spawned.)
|
|
144
152
|
|
|
153
|
+
### Step 4b: Check Completion Markers
|
|
154
|
+
|
|
155
|
+
After each codebase-mapper Task() completes, check the Task() output for the `## MAPPING COMPLETE` marker:
|
|
156
|
+
|
|
157
|
+
- If `## MAPPING COMPLETE` is present: the mapper finished successfully, proceed normally
|
|
158
|
+
- If the marker is missing: warn the user that the mapper may not have completed successfully:
|
|
159
|
+
```
|
|
160
|
+
⚠ Codebase mapper ({focus_area}) did not report MAPPING COMPLETE.
|
|
161
|
+
Output may be incomplete — check .planning/codebase/ for partial results.
|
|
162
|
+
```
|
|
163
|
+
Continue to Step 5 verification regardless (the file existence checks will catch truly missing output).
|
|
164
|
+
|
|
145
165
|
### Step 5: Verify Output
|
|
146
166
|
|
|
147
167
|
After all agents complete, verify the expected files exist:
|
|
@@ -71,7 +71,15 @@ mkdir -p .planning/phases .planning/todos/pending .planning/todos/done .planning
|
|
|
71
71
|
|
|
72
72
|
**CRITICAL: Write .planning/config.json NOW. Do NOT skip this step.**
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
Before writing config.json, check for user-level defaults:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
node "${PLUGIN_ROOT}/scripts/pbr-tools.js" config load-defaults
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
If user defaults exist (the output has keys like `mode`, `features`, etc.), inform the user: "Found your saved preferences from ~/.claude/pbr-defaults.json. These will be merged into your project config (project-specific settings take precedence)." Then deep-merge user defaults into the config below before writing.
|
|
81
|
+
|
|
82
|
+
Create `.planning/config.json` with defaults (merged with user defaults if they exist):
|
|
75
83
|
```json
|
|
76
84
|
{
|
|
77
85
|
"version": 2,
|
|
@@ -17,6 +17,16 @@ Every skill that spawns agents or reads significant content must follow these ru
|
|
|
17
17
|
4. **Delegate** heavy work to agents — the orchestrator routes, it doesn't execute
|
|
18
18
|
5. **Before spawning agents**: If you've already consumed significant context (large file reads, multiple subagent results), warn the user: "Context budget is getting heavy. Consider running `/pbr:pause` to checkpoint progress." Suggest pause proactively rather than waiting for compaction.
|
|
19
19
|
|
|
20
|
+
## Context Degradation Awareness
|
|
21
|
+
|
|
22
|
+
Quality degrades gradually before panic thresholds fire. Watch for these early warning signs:
|
|
23
|
+
|
|
24
|
+
- **Silent partial completion** — agent claims task is done but implementation is incomplete. Self-check catches file existence but not semantic completeness. Always verify agent output meets the plan's must_haves, not just that files exist.
|
|
25
|
+
- **Increasing vagueness** — agent starts using phrases like "appropriate handling" or "standard patterns" instead of specific code. This indicates context pressure even before budget warnings fire.
|
|
26
|
+
- **Skipped steps** — agent omits protocol steps it would normally follow. If an agent's success criteria has 8 items but it only reports 5, suspect context pressure.
|
|
27
|
+
|
|
28
|
+
When delegating to agents, the orchestrator cannot verify semantic correctness of agent output — only structural completeness. This is a fundamental limitation. Mitigate with must_haves.truths and spot-check verification.
|
|
29
|
+
|
|
20
30
|
## Customization
|
|
21
31
|
|
|
22
32
|
Skills should add skill-specific rules below the reference line. Common skill-specific additions:
|
|
@@ -36,3 +36,9 @@ These rules prevent context rot -- quality degradation as the context window fil
|
|
|
36
36
|
14. **Do not** suggest multiple next actions without clear priority -- one primary suggestion, alternatives listed secondary.
|
|
37
37
|
15. **Do not** use `git add .` or `git add -A` -- stage specific files only.
|
|
38
38
|
16. **Do not** include sensitive information (API keys, passwords, tokens) in planning documents or commits.
|
|
39
|
+
|
|
40
|
+
## Error Recovery Rules (apply to every skill)
|
|
41
|
+
|
|
42
|
+
17. **Git lock detection**: Before any git operation, if it fails with "Unable to create lock file", check for stale `.git/index.lock` and advise the user to remove it (do not remove automatically — another process may hold it legitimately).
|
|
43
|
+
18. **Config fallback awareness**: `configLoad()` returns `null` silently on invalid JSON. If your skill depends on config values, check for null and warn the user: "config.json is invalid or missing — running with defaults. Run `/pbr:health` to diagnose."
|
|
44
|
+
19. **Partial state recovery**: If STATE.md references a phase directory that doesn't exist, do not proceed silently. Warn the user and suggest `/pbr:health` to diagnose the mismatch.
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test
|
|
3
|
+
description: "Generate tests for completed phase code. Detects test framework and targets key files."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
**STOP — DO NOT READ THIS FILE. You are already reading it. This prompt was injected into your context by the plugin system. Using the Read tool on this SKILL.md file wastes ~7,600 tokens. Begin executing Step 1 immediately.**
|
|
7
|
+
|
|
8
|
+
# /pbr:test — Post-Phase Test Generation
|
|
9
|
+
|
|
10
|
+
You are the orchestrator for `/pbr:test`. This skill generates tests for code that was built WITHOUT TDD mode. It targets key files from completed phases and creates meaningful test coverage.
|
|
11
|
+
|
|
12
|
+
## Context Budget
|
|
13
|
+
|
|
14
|
+
Reference: `skills/shared/context-budget.md` for the universal orchestrator rules.
|
|
15
|
+
|
|
16
|
+
Additionally for this skill:
|
|
17
|
+
- **Delegate** all test writing to executor agents — never write test code in the main context
|
|
18
|
+
- Read only SUMMARY.md frontmatter for `key_files` lists — do not read full summaries
|
|
19
|
+
|
|
20
|
+
## Step 0 — Immediate Output
|
|
21
|
+
|
|
22
|
+
**Before ANY tool calls**, display this banner:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
26
|
+
║ PLAN-BUILD-RUN ► GENERATING TESTS FOR PHASE {N} ║
|
|
27
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Where `{N}` is the phase number from `$ARGUMENTS`. Then proceed to Step 1.
|
|
31
|
+
|
|
32
|
+
## Prerequisites
|
|
33
|
+
|
|
34
|
+
- `.planning/config.json` exists
|
|
35
|
+
- Phase has been built: SUMMARY.md files exist in `.planning/phases/{NN}-{slug}/`
|
|
36
|
+
- Phase should NOT already have TDD coverage (check if `features.tdd_mode` is false in config — if TDD mode is enabled, warn user that tests should already exist and ask to proceed anyway)
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Argument Parsing
|
|
41
|
+
|
|
42
|
+
Parse `$ARGUMENTS` according to `skills/shared/phase-argument-parsing.md`.
|
|
43
|
+
|
|
44
|
+
| Argument | Meaning |
|
|
45
|
+
|----------|---------|
|
|
46
|
+
| `3` | Generate tests for phase 3 |
|
|
47
|
+
| (no number) | Use current phase from STATE.md |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Step 1 — Gather Context
|
|
52
|
+
|
|
53
|
+
**CRITICAL: Run init command to load project state efficiently.**
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
node "${PLUGIN_ROOT}/scripts/pbr-tools.js" init execute-phase {phase_number}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
This returns STATE.md snapshot, phase plans, ROADMAP excerpt, and config — all in one call.
|
|
60
|
+
|
|
61
|
+
## Step 2 — Detect Test Framework
|
|
62
|
+
|
|
63
|
+
Scan the project root for test framework indicators:
|
|
64
|
+
|
|
65
|
+
1. Check `package.json` for `jest`, `vitest`, `mocha`, `ava` in devDependencies
|
|
66
|
+
2. Check for `pytest.ini`, `pyproject.toml` (with `[tool.pytest]`), `setup.cfg` (with `[tool:pytest]`)
|
|
67
|
+
3. Check for `jest.config.*`, `vitest.config.*`, `.mocharc.*`
|
|
68
|
+
4. Check for existing test directories: `tests/`, `test/`, `__tests__/`, `spec/`
|
|
69
|
+
5. Check for existing test file patterns: `*.test.*`, `*.spec.*`, `test_*.py`
|
|
70
|
+
|
|
71
|
+
If no test framework is detected, ask the user:
|
|
72
|
+
|
|
73
|
+
Use AskUserQuestion:
|
|
74
|
+
question: "No test framework detected. Which should I use?"
|
|
75
|
+
header: "Framework"
|
|
76
|
+
options:
|
|
77
|
+
- label: "Jest" description: "JavaScript/TypeScript testing (most common)"
|
|
78
|
+
- label: "Vitest" description: "Vite-native testing (faster, ESM-friendly)"
|
|
79
|
+
- label: "pytest" description: "Python testing framework"
|
|
80
|
+
multiSelect: false
|
|
81
|
+
|
|
82
|
+
## Step 3 — Collect Target Files
|
|
83
|
+
|
|
84
|
+
Read SUMMARY.md frontmatter from each plan in the phase to extract `key_files`:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
node "${PLUGIN_ROOT}/scripts/pbr-tools.js" frontmatter .planning/phases/{NN}-{slug}/SUMMARY.md
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Collect all `key_files` across all plans in the phase. Filter to only source files (exclude config, docs, assets). Group by:
|
|
91
|
+
- **High priority**: Files with business logic, API endpoints, data models
|
|
92
|
+
- **Medium priority**: Utility functions, helpers, middleware
|
|
93
|
+
- **Low priority**: Config, types-only files, constants
|
|
94
|
+
|
|
95
|
+
Present the file list to the user:
|
|
96
|
+
|
|
97
|
+
Use AskUserQuestion:
|
|
98
|
+
question: "Found {N} source files from phase {P}. Generate tests for which?"
|
|
99
|
+
header: "Scope"
|
|
100
|
+
options:
|
|
101
|
+
- label: "High priority only" description: "{X} files — business logic, APIs, models"
|
|
102
|
+
- label: "High + Medium" description: "{Y} files — adds utilities and helpers"
|
|
103
|
+
- label: "All files" description: "{Z} files — comprehensive coverage"
|
|
104
|
+
multiSelect: false
|
|
105
|
+
|
|
106
|
+
## Step 4 — Generate Test Plans
|
|
107
|
+
|
|
108
|
+
For each target file, create a lightweight test plan (NOT a full PBR PLAN.md — just a task list):
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
File: src/auth/login.js
|
|
112
|
+
Tests to generate:
|
|
113
|
+
- Happy path: valid credentials return token
|
|
114
|
+
- Error: invalid password returns 401
|
|
115
|
+
- Error: missing email returns 400
|
|
116
|
+
- Edge: expired session handling
|
|
117
|
+
Framework: jest
|
|
118
|
+
Output: tests/auth/login.test.js
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Step 5 — Spawn Executor Agents
|
|
122
|
+
|
|
123
|
+
**CRITICAL: Delegate ALL test writing to agents. Do NOT write test code in the main context.**
|
|
124
|
+
|
|
125
|
+
For each target file (or batch of related files), spawn an executor agent:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
Spawn agent_type: "pbr:executor"
|
|
129
|
+
|
|
130
|
+
Task: Generate tests for the following file(s):
|
|
131
|
+
|
|
132
|
+
<files_to_test>
|
|
133
|
+
{file_path}: {brief description from SUMMARY}
|
|
134
|
+
</files_to_test>
|
|
135
|
+
|
|
136
|
+
<test_framework>
|
|
137
|
+
{detected framework name and version}
|
|
138
|
+
Existing test directory: {path}
|
|
139
|
+
Test file naming: {pattern, e.g., *.test.js}
|
|
140
|
+
</test_framework>
|
|
141
|
+
|
|
142
|
+
<test_plan>
|
|
143
|
+
{test plan from Step 4}
|
|
144
|
+
</test_plan>
|
|
145
|
+
|
|
146
|
+
Instructions:
|
|
147
|
+
1. Read each source file to understand the implementation
|
|
148
|
+
2. Write test files following the project's existing test patterns
|
|
149
|
+
3. Each test file should cover: happy path, error cases, edge cases
|
|
150
|
+
4. Use the project's existing mocking patterns if any exist
|
|
151
|
+
5. Run the tests to verify they pass: {test command}
|
|
152
|
+
6. Commit with format: test({phase}-tests): add tests for {file}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Spawn up to `parallelization.max_concurrent_agents` agents in parallel for independent files.
|
|
156
|
+
|
|
157
|
+
## Step 6 — Verify and Report
|
|
158
|
+
|
|
159
|
+
After all agents complete, check results:
|
|
160
|
+
|
|
161
|
+
1. Glob for new test files created in this session
|
|
162
|
+
2. Run the test suite to verify all new tests pass:
|
|
163
|
+
```bash
|
|
164
|
+
{test_command}
|
|
165
|
+
```
|
|
166
|
+
3. Count: files tested, tests written, tests passing
|
|
167
|
+
|
|
168
|
+
Display completion:
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
172
|
+
║ PLAN-BUILD-RUN ► TESTS GENERATED ✓ ║
|
|
173
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
174
|
+
|
|
175
|
+
Phase {N}: {X} test files created, {Y} tests passing
|
|
176
|
+
|
|
177
|
+
Files tested:
|
|
178
|
+
- src/auth/login.js → tests/auth/login.test.js (8 tests)
|
|
179
|
+
- src/api/users.js → tests/api/users.test.js (12 tests)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
184
|
+
║ ▶ NEXT UP ║
|
|
185
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
186
|
+
|
|
187
|
+
**Run coverage check** to see how much is covered
|
|
188
|
+
|
|
189
|
+
`npm test -- --coverage`
|
|
190
|
+
|
|
191
|
+
<sub>`/clear` first → fresh context window</sub>
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
**Also available:**
|
|
196
|
+
- `/pbr:review {N}` — verify the full phase
|
|
197
|
+
- `/pbr:continue` — execute next logical step
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Anti-Patterns
|
|
205
|
+
|
|
206
|
+
1. **DO NOT** write test code in the main orchestrator context — always delegate to executor agents
|
|
207
|
+
2. **DO NOT** generate tests for files not listed in SUMMARY.md key_files — stay scoped to the phase
|
|
208
|
+
3. **DO NOT** skip running the tests — always verify they pass before reporting success
|
|
209
|
+
4. **DO NOT** generate trivial tests (testing getters/setters, testing constants) — focus on behavior
|
|
210
|
+
5. **DO NOT** read full source files in the orchestrator — let the executor agents read them
|