pan-wizard 2.8.1
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/LICENSE +21 -0
- package/README.md +772 -0
- package/agents/pan-debugger.md +1246 -0
- package/agents/pan-document_code.md +965 -0
- package/agents/pan-executor.md +469 -0
- package/agents/pan-integration-checker.md +443 -0
- package/agents/pan-phase-researcher.md +572 -0
- package/agents/pan-plan-checker.md +763 -0
- package/agents/pan-planner.md +1297 -0
- package/agents/pan-project-researcher.md +647 -0
- package/agents/pan-research-synthesizer.md +239 -0
- package/agents/pan-reviewer.md +112 -0
- package/agents/pan-roadmapper.md +642 -0
- package/agents/pan-verifier.md +672 -0
- package/assets/pan-logo-2000-transparent.svg +30 -0
- package/assets/pan-logo-2000.svg +43 -0
- package/assets/terminal.svg +119 -0
- package/bin/install-lib.cjs +616 -0
- package/bin/install.js +1936 -0
- package/commands/pan/add-phase.md +44 -0
- package/commands/pan/assumptions.md +47 -0
- package/commands/pan/audit-deployment.md +378 -0
- package/commands/pan/debug.md +168 -0
- package/commands/pan/discord.md +19 -0
- package/commands/pan/discuss-phase.md +84 -0
- package/commands/pan/exec-phase.md +45 -0
- package/commands/pan/focus-auto.md +323 -0
- package/commands/pan/focus-design.md +816 -0
- package/commands/pan/focus-exec.md +316 -0
- package/commands/pan/focus-plan.md +101 -0
- package/commands/pan/focus-scan.md +272 -0
- package/commands/pan/focus-sync.md +104 -0
- package/commands/pan/health.md +23 -0
- package/commands/pan/help.md +23 -0
- package/commands/pan/insert-phase.md +33 -0
- package/commands/pan/map-codebase.md +72 -0
- package/commands/pan/milestone-audit.md +37 -0
- package/commands/pan/milestone-cleanup.md +19 -0
- package/commands/pan/milestone-done.md +137 -0
- package/commands/pan/milestone-gaps.md +35 -0
- package/commands/pan/milestone-new.md +45 -0
- package/commands/pan/new-project.md +43 -0
- package/commands/pan/patches.md +110 -0
- package/commands/pan/pause.md +39 -0
- package/commands/pan/phase-budget.md +23 -0
- package/commands/pan/phase-tests.md +42 -0
- package/commands/pan/plan-phase.md +46 -0
- package/commands/pan/profile.md +36 -0
- package/commands/pan/progress.md +25 -0
- package/commands/pan/quick.md +42 -0
- package/commands/pan/remove-phase.md +32 -0
- package/commands/pan/research-phase.md +190 -0
- package/commands/pan/resume.md +41 -0
- package/commands/pan/retro.md +33 -0
- package/commands/pan/settings.md +37 -0
- package/commands/pan/todo-add.md +48 -0
- package/commands/pan/todo-check.md +46 -0
- package/commands/pan/update.md +38 -0
- package/commands/pan/verify-phase.md +39 -0
- package/hooks/dist/pan-check-update.js +62 -0
- package/hooks/dist/pan-context-monitor.js +122 -0
- package/hooks/dist/pan-statusline.js +108 -0
- package/package.json +66 -0
- package/pan-wizard-core/bin/lib/codebase.cjs +746 -0
- package/pan-wizard-core/bin/lib/commands.cjs +1435 -0
- package/pan-wizard-core/bin/lib/config.cjs +611 -0
- package/pan-wizard-core/bin/lib/constants.cjs +696 -0
- package/pan-wizard-core/bin/lib/context-budget.cjs +150 -0
- package/pan-wizard-core/bin/lib/core.cjs +650 -0
- package/pan-wizard-core/bin/lib/focus.cjs +900 -0
- package/pan-wizard-core/bin/lib/frontmatter.cjs +442 -0
- package/pan-wizard-core/bin/lib/init.cjs +881 -0
- package/pan-wizard-core/bin/lib/milestone.cjs +276 -0
- package/pan-wizard-core/bin/lib/phase.cjs +1212 -0
- package/pan-wizard-core/bin/lib/roadmap.cjs +470 -0
- package/pan-wizard-core/bin/lib/state.cjs +1029 -0
- package/pan-wizard-core/bin/lib/template.cjs +314 -0
- package/pan-wizard-core/bin/lib/utils.cjs +171 -0
- package/pan-wizard-core/bin/lib/verify.cjs +1808 -0
- package/pan-wizard-core/bin/pan-tools.cjs +773 -0
- package/pan-wizard-core/references/checkpoints.md +776 -0
- package/pan-wizard-core/references/continuation-format.md +249 -0
- package/pan-wizard-core/references/decimal-phase-calculation.md +65 -0
- package/pan-wizard-core/references/git-integration.md +248 -0
- package/pan-wizard-core/references/git-planning-commit.md +38 -0
- package/pan-wizard-core/references/model-profile-resolution.md +34 -0
- package/pan-wizard-core/references/model-profiles.md +111 -0
- package/pan-wizard-core/references/phase-argument-parsing.md +61 -0
- package/pan-wizard-core/references/planning-config.md +196 -0
- package/pan-wizard-core/references/questioning.md +145 -0
- package/pan-wizard-core/references/tdd.md +263 -0
- package/pan-wizard-core/references/ui-brand.md +160 -0
- package/pan-wizard-core/references/verification-patterns.md +612 -0
- package/pan-wizard-core/templates/codebase/architecture.md +283 -0
- package/pan-wizard-core/templates/codebase/best-practices.md +133 -0
- package/pan-wizard-core/templates/codebase/concerns.md +325 -0
- package/pan-wizard-core/templates/codebase/conventions.md +307 -0
- package/pan-wizard-core/templates/codebase/integrations.md +305 -0
- package/pan-wizard-core/templates/codebase/relationships.md +124 -0
- package/pan-wizard-core/templates/codebase/stack.md +199 -0
- package/pan-wizard-core/templates/codebase/structure.md +298 -0
- package/pan-wizard-core/templates/codebase/testing.md +480 -0
- package/pan-wizard-core/templates/config.json +37 -0
- package/pan-wizard-core/templates/context.md +283 -0
- package/pan-wizard-core/templates/continue-here.md +78 -0
- package/pan-wizard-core/templates/debug-subagent-prompt.md +91 -0
- package/pan-wizard-core/templates/debug.md +164 -0
- package/pan-wizard-core/templates/discovery.md +146 -0
- package/pan-wizard-core/templates/milestone-archive.md +123 -0
- package/pan-wizard-core/templates/milestone.md +115 -0
- package/pan-wizard-core/templates/phase-prompt.md +593 -0
- package/pan-wizard-core/templates/planner-subagent-prompt.md +117 -0
- package/pan-wizard-core/templates/project.md +184 -0
- package/pan-wizard-core/templates/requirements.md +231 -0
- package/pan-wizard-core/templates/research-project/architecture.md +204 -0
- package/pan-wizard-core/templates/research-project/features.md +147 -0
- package/pan-wizard-core/templates/research-project/pitfalls.md +200 -0
- package/pan-wizard-core/templates/research-project/stack.md +120 -0
- package/pan-wizard-core/templates/research-project/summary.md +170 -0
- package/pan-wizard-core/templates/research.md +552 -0
- package/pan-wizard-core/templates/retrospective.md +54 -0
- package/pan-wizard-core/templates/roadmap.md +202 -0
- package/pan-wizard-core/templates/standards.md +24 -0
- package/pan-wizard-core/templates/state.md +176 -0
- package/pan-wizard-core/templates/summary-complex.md +59 -0
- package/pan-wizard-core/templates/summary-minimal.md +41 -0
- package/pan-wizard-core/templates/summary-standard.md +49 -0
- package/pan-wizard-core/templates/summary.md +249 -0
- package/pan-wizard-core/templates/uat.md +247 -0
- package/pan-wizard-core/templates/user-setup.md +311 -0
- package/pan-wizard-core/templates/validation.md +76 -0
- package/pan-wizard-core/templates/verification-report.md +322 -0
- package/pan-wizard-core/workflows/add-phase.md +111 -0
- package/pan-wizard-core/workflows/assumptions.md +178 -0
- package/pan-wizard-core/workflows/diagnose-issues.md +219 -0
- package/pan-wizard-core/workflows/discuss-phase.md +542 -0
- package/pan-wizard-core/workflows/exec-phase.md +572 -0
- package/pan-wizard-core/workflows/execute-plan.md +448 -0
- package/pan-wizard-core/workflows/health.md +156 -0
- package/pan-wizard-core/workflows/help.md +431 -0
- package/pan-wizard-core/workflows/insert-phase.md +129 -0
- package/pan-wizard-core/workflows/map-codebase.md +401 -0
- package/pan-wizard-core/workflows/milestone-audit.md +297 -0
- package/pan-wizard-core/workflows/milestone-cleanup.md +152 -0
- package/pan-wizard-core/workflows/milestone-gaps.md +274 -0
- package/pan-wizard-core/workflows/milestone-new.md +382 -0
- package/pan-wizard-core/workflows/new-project.md +1178 -0
- package/pan-wizard-core/workflows/pause.md +122 -0
- package/pan-wizard-core/workflows/phase-tests.md +388 -0
- package/pan-wizard-core/workflows/plan-phase.md +569 -0
- package/pan-wizard-core/workflows/profile.md +115 -0
- package/pan-wizard-core/workflows/progress.md +381 -0
- package/pan-wizard-core/workflows/quick.md +453 -0
- package/pan-wizard-core/workflows/remove-phase.md +154 -0
- package/pan-wizard-core/workflows/research-phase.md +73 -0
- package/pan-wizard-core/workflows/resume-project.md +306 -0
- package/pan-wizard-core/workflows/retro.md +121 -0
- package/pan-wizard-core/workflows/settings.md +213 -0
- package/pan-wizard-core/workflows/todo-add.md +157 -0
- package/pan-wizard-core/workflows/todo-check.md +176 -0
- package/pan-wizard-core/workflows/transition.md +544 -0
- package/pan-wizard-core/workflows/update.md +219 -0
- package/pan-wizard-core/workflows/verify-phase.md +301 -0
- package/scripts/build-hooks.js +43 -0
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
Orchestrate parallel codebase mapper agents to analyze codebase and produce structured documents in .planning/codebase/
|
|
3
|
+
|
|
4
|
+
Each agent has fresh context, explores a specific focus area, and **writes documents directly**. The orchestrator only receives confirmation + line counts, then writes a summary.
|
|
5
|
+
|
|
6
|
+
Output: .planning/codebase/ folder with 9 structured documents about the codebase state.
|
|
7
|
+
</purpose>
|
|
8
|
+
|
|
9
|
+
<philosophy>
|
|
10
|
+
**Why dedicated mapper agents:**
|
|
11
|
+
- Fresh context per domain (no token contamination)
|
|
12
|
+
- Agents write documents directly (no context transfer back to orchestrator)
|
|
13
|
+
- Orchestrator only summarizes what was created (minimal context usage)
|
|
14
|
+
- Faster execution (agents run simultaneously)
|
|
15
|
+
|
|
16
|
+
**Pre-computed analysis:**
|
|
17
|
+
Before spawning agents, run `codebase analyze-imports` and `codebase detect-languages` to provide structured data to relationship and practices agents. This avoids expensive LLM re-scanning.
|
|
18
|
+
|
|
19
|
+
**Document quality over length:**
|
|
20
|
+
Include enough detail to be useful as reference. Prioritize practical examples (especially code patterns) over arbitrary brevity.
|
|
21
|
+
|
|
22
|
+
**Always include file paths:**
|
|
23
|
+
Documents are reference material for Claude when planning/executing. Always include actual file paths formatted with backticks: `src/services/user.ts`.
|
|
24
|
+
|
|
25
|
+
**Lowercase filenames:**
|
|
26
|
+
All output documents use lowercase filenames (stack.md, not STACK.md) to align with PAN's .planning/ convention.
|
|
27
|
+
</philosophy>
|
|
28
|
+
|
|
29
|
+
<process>
|
|
30
|
+
|
|
31
|
+
<step name="init_context" priority="first">
|
|
32
|
+
Load codebase mapping context:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
INIT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs init map-codebase)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Extract from init JSON: `mapper_model`, `commit_docs`, `codebase_dir`, `existing_maps`, `has_maps`, `codebase_dir_exists`, `supported_languages`, `file_count`, `focus_areas`.
|
|
39
|
+
</step>
|
|
40
|
+
|
|
41
|
+
<step name="pre_compute">
|
|
42
|
+
Run pre-computed analysis for relationship and practices agents:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
LANG_DATA=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs codebase detect-languages)
|
|
46
|
+
IMPORT_DATA=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs codebase analyze-imports)
|
|
47
|
+
PRACTICES_DATA=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs codebase best-practices)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
These JSON results will be embedded in agent prompts to avoid redundant scanning.
|
|
51
|
+
</step>
|
|
52
|
+
|
|
53
|
+
<step name="check_existing">
|
|
54
|
+
Check if .planning/codebase/ already exists using `has_maps` from init context.
|
|
55
|
+
|
|
56
|
+
If `codebase_dir_exists` is true:
|
|
57
|
+
```bash
|
|
58
|
+
ls -la .planning/codebase/
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**If exists:**
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
.planning/codebase/ already exists with these documents:
|
|
65
|
+
[List files found]
|
|
66
|
+
|
|
67
|
+
What's next?
|
|
68
|
+
1. Refresh - Delete existing and remap codebase
|
|
69
|
+
2. Update - Keep existing, only update specific documents
|
|
70
|
+
3. Skip - Use existing codebase map as-is
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Wait for user response.
|
|
74
|
+
|
|
75
|
+
If "Refresh": Delete .planning/codebase/, continue to create_structure
|
|
76
|
+
If "Update": Ask which documents to update, continue to spawn_agents (filtered)
|
|
77
|
+
If "Skip": Exit workflow
|
|
78
|
+
|
|
79
|
+
**If doesn't exist:**
|
|
80
|
+
Continue to create_structure.
|
|
81
|
+
</step>
|
|
82
|
+
|
|
83
|
+
<step name="create_structure">
|
|
84
|
+
Create .planning/codebase/ directory:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
mkdir -p .planning/codebase
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Expected output files (all lowercase):**
|
|
91
|
+
- stack.md (from tech mapper)
|
|
92
|
+
- integrations.md (from tech mapper)
|
|
93
|
+
- architecture.md (from arch mapper)
|
|
94
|
+
- structure.md (from arch mapper)
|
|
95
|
+
- conventions.md (from quality mapper)
|
|
96
|
+
- testing.md (from quality mapper)
|
|
97
|
+
- concerns.md (from concerns mapper)
|
|
98
|
+
- relationships.md (from relationships mapper)
|
|
99
|
+
- best-practices.md (from practices mapper)
|
|
100
|
+
|
|
101
|
+
Continue to spawn_agents.
|
|
102
|
+
</step>
|
|
103
|
+
|
|
104
|
+
<step name="spawn_agents">
|
|
105
|
+
Spawn 6 parallel pan-document_code agents.
|
|
106
|
+
|
|
107
|
+
Use Task tool with `subagent_type="pan-document_code"`, `model="{mapper_model}"`, and `run_in_background=true` for parallel execution.
|
|
108
|
+
|
|
109
|
+
**CRITICAL:** Use the dedicated `pan-document_code` agent, NOT `Explore`. The mapper agent writes documents directly.
|
|
110
|
+
|
|
111
|
+
**CRITICAL: Project Scope Boundary — include this line in EVERY agent prompt:**
|
|
112
|
+
> SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure directories: .claude/, .github/copilot-instructions.md, .opencode/, .gemini/, .codex/, .planning/
|
|
113
|
+
|
|
114
|
+
**Agent 1: Tech Focus**
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
Task(
|
|
118
|
+
subagent_type="pan-document_code",
|
|
119
|
+
model="{mapper_model}",
|
|
120
|
+
run_in_background=true,
|
|
121
|
+
description="Map codebase tech stack",
|
|
122
|
+
prompt="Focus: tech
|
|
123
|
+
SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure directories: .claude/, .github/copilot-instructions.md, .opencode/, .gemini/, .codex/, .planning/
|
|
124
|
+
|
|
125
|
+
Analyze this codebase for technology stack and external integrations.
|
|
126
|
+
|
|
127
|
+
Write these documents to .planning/codebase/:
|
|
128
|
+
- stack.md - Technology Architecture: languages, runtime, frameworks, dependencies, deployment topology diagram
|
|
129
|
+
- integrations.md - Data Architecture: external APIs, databases, auth providers, webhooks, service map and ER diagrams
|
|
130
|
+
|
|
131
|
+
Include Mermaid diagrams where the template specifies them. Fill TOGAF sections based on findings.
|
|
132
|
+
Explore thoroughly. Write documents directly using templates. Return confirmation only."
|
|
133
|
+
)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Agent 2: Architecture Focus**
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
Task(
|
|
140
|
+
subagent_type="pan-document_code",
|
|
141
|
+
model="{mapper_model}",
|
|
142
|
+
run_in_background=true,
|
|
143
|
+
description="Map codebase architecture",
|
|
144
|
+
prompt="Focus: arch
|
|
145
|
+
SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure directories: .claude/, .github/copilot-instructions.md, .opencode/, .gemini/, .codex/, .planning/
|
|
146
|
+
|
|
147
|
+
Analyze this codebase architecture and directory structure.
|
|
148
|
+
|
|
149
|
+
Write these documents to .planning/codebase/:
|
|
150
|
+
- architecture.md - Business & Application Architecture: pattern, layers, component relationship diagram, request lifecycle sequence diagram, data flow
|
|
151
|
+
- structure.md - Directory layout with visual hierarchy diagram, key locations, naming conventions
|
|
152
|
+
|
|
153
|
+
Include Mermaid diagrams where the template specifies them. Fill TOGAF sections based on findings.
|
|
154
|
+
Explore thoroughly. Write documents directly using templates. Return confirmation only."
|
|
155
|
+
)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Agent 3: Quality Focus**
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
Task(
|
|
162
|
+
subagent_type="pan-document_code",
|
|
163
|
+
model="{mapper_model}",
|
|
164
|
+
run_in_background=true,
|
|
165
|
+
description="Map codebase conventions",
|
|
166
|
+
prompt="Focus: quality
|
|
167
|
+
SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure directories: .claude/, .github/copilot-instructions.md, .opencode/, .gemini/, .codex/, .planning/
|
|
168
|
+
|
|
169
|
+
Analyze this codebase for coding conventions and testing patterns.
|
|
170
|
+
|
|
171
|
+
Write these documents to .planning/codebase/:
|
|
172
|
+
- conventions.md - Code style, naming, patterns, error handling
|
|
173
|
+
- testing.md - Framework, structure, mocking, coverage
|
|
174
|
+
|
|
175
|
+
Explore thoroughly. Write documents directly using templates. Return confirmation only."
|
|
176
|
+
)
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**Agent 4: Concerns Focus**
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
Task(
|
|
183
|
+
subagent_type="pan-document_code",
|
|
184
|
+
model="{mapper_model}",
|
|
185
|
+
run_in_background=true,
|
|
186
|
+
description="Map codebase concerns",
|
|
187
|
+
prompt="Focus: concerns
|
|
188
|
+
SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure directories: .claude/, .github/copilot-instructions.md, .opencode/, .gemini/, .codex/, .planning/
|
|
189
|
+
|
|
190
|
+
Analyze this codebase for technical debt, known issues, and areas of concern.
|
|
191
|
+
|
|
192
|
+
Write this document to .planning/codebase/:
|
|
193
|
+
- concerns.md - Risk overview with quadrant chart, tech debt, bugs, security, performance, fragile areas
|
|
194
|
+
|
|
195
|
+
Include Mermaid risk quadrant chart where the template specifies it.
|
|
196
|
+
Explore thoroughly. Write document directly using template. Return confirmation only."
|
|
197
|
+
)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
**Agent 5: Relationships Focus**
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
Task(
|
|
204
|
+
subagent_type="pan-document_code",
|
|
205
|
+
model="{mapper_model}",
|
|
206
|
+
run_in_background=true,
|
|
207
|
+
description="Map module relationships",
|
|
208
|
+
prompt="Focus: relationships
|
|
209
|
+
SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure directories: .claude/, .github/copilot-instructions.md, .opencode/, .gemini/, .codex/, .planning/
|
|
210
|
+
|
|
211
|
+
Analyze module dependencies using pre-computed import analysis.
|
|
212
|
+
|
|
213
|
+
Pre-computed data (from `codebase analyze-imports`):
|
|
214
|
+
{IMPORT_DATA}
|
|
215
|
+
|
|
216
|
+
Write this document to .planning/codebase/:
|
|
217
|
+
- relationships.md - Module dependency graph (Mermaid), circular dependencies, high-coupling modules, orphan modules, entry points, layer boundaries and violations, import patterns
|
|
218
|
+
|
|
219
|
+
Use the pre-computed dependency graph and circular dependency data. Enrich with your own exploration of the codebase to understand architectural layers and coupling patterns.
|
|
220
|
+
Write document directly using template. Return confirmation only."
|
|
221
|
+
)
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Agent 6: Practices Focus**
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
Task(
|
|
228
|
+
subagent_type="pan-document_code",
|
|
229
|
+
model="{mapper_model}",
|
|
230
|
+
run_in_background=true,
|
|
231
|
+
description="Map best practices",
|
|
232
|
+
prompt="Focus: practices
|
|
233
|
+
SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure directories: .claude/, .github/copilot-instructions.md, .opencode/, .gemini/, .codex/, .planning/
|
|
234
|
+
|
|
235
|
+
Assess codebase best practices using pre-computed analysis.
|
|
236
|
+
|
|
237
|
+
Pre-computed language data (from `codebase detect-languages`):
|
|
238
|
+
{LANG_DATA}
|
|
239
|
+
|
|
240
|
+
Pre-computed best practices scores (from `codebase best-practices`):
|
|
241
|
+
{PRACTICES_DATA}
|
|
242
|
+
|
|
243
|
+
Write this document to .planning/codebase/:
|
|
244
|
+
- best-practices.md - Scored assessment across 5 categories (Error Handling, Testing, Naming Conventions, Security, Performance), detected patterns with code examples, recommendations
|
|
245
|
+
|
|
246
|
+
Use the pre-computed scores as a starting point. Explore the codebase to find specific code examples for each category and provide actionable recommendations.
|
|
247
|
+
Write document directly using template. Return confirmation only."
|
|
248
|
+
)
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Continue to collect_confirmations.
|
|
252
|
+
</step>
|
|
253
|
+
|
|
254
|
+
<step name="collect_confirmations">
|
|
255
|
+
Wait for all 6 agents to complete.
|
|
256
|
+
|
|
257
|
+
Read each agent's output file to collect confirmations.
|
|
258
|
+
|
|
259
|
+
**Expected confirmation format from each agent:**
|
|
260
|
+
```
|
|
261
|
+
## Mapping Complete
|
|
262
|
+
|
|
263
|
+
**Focus:** {focus}
|
|
264
|
+
**Documents written:**
|
|
265
|
+
- `.planning/codebase/{doc1}.md` ({N} lines)
|
|
266
|
+
- `.planning/codebase/{doc2}.md` ({N} lines)
|
|
267
|
+
|
|
268
|
+
Ready for orchestrator summary.
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**What you receive:** Just file paths and line counts. NOT document contents.
|
|
272
|
+
|
|
273
|
+
If any agent failed, note the failure and continue with successful documents.
|
|
274
|
+
|
|
275
|
+
Continue to verify_output.
|
|
276
|
+
</step>
|
|
277
|
+
|
|
278
|
+
<step name="verify_output">
|
|
279
|
+
Verify all documents created successfully:
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
ls -la .planning/codebase/
|
|
283
|
+
wc -l .planning/codebase/*.md
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
**Verification checklist:**
|
|
287
|
+
- All 9 documents exist (lowercase filenames)
|
|
288
|
+
- No empty documents (each should have >20 lines)
|
|
289
|
+
|
|
290
|
+
If any documents missing or empty, note which agents may have failed.
|
|
291
|
+
|
|
292
|
+
Continue to scan_for_secrets.
|
|
293
|
+
</step>
|
|
294
|
+
|
|
295
|
+
<step name="scan_for_secrets">
|
|
296
|
+
**CRITICAL SECURITY CHECK:** Scan output files for accidentally leaked secrets before committing.
|
|
297
|
+
|
|
298
|
+
Run secret pattern detection:
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
# Check for common API key patterns in generated docs
|
|
302
|
+
grep -E '(sk-[a-zA-Z0-9]{20,}|sk_live_[a-zA-Z0-9]+|sk_test_[a-zA-Z0-9]+|ghp_[a-zA-Z0-9]{36}|gho_[a-zA-Z0-9]{36}|glpat-[a-zA-Z0-9_-]+|AKIA[A-Z0-9]{16}|xox[baprs]-[a-zA-Z0-9-]+|-----BEGIN.*PRIVATE KEY|eyJ[a-zA-Z0-9_-]+\.eyJ[a-zA-Z0-9_-]+\.)' .planning/codebase/*.md 2>/dev/null && SECRETS_FOUND=true || SECRETS_FOUND=false
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
**If SECRETS_FOUND=true:**
|
|
306
|
+
|
|
307
|
+
```
|
|
308
|
+
SECURITY ALERT: Potential secrets detected in codebase documents!
|
|
309
|
+
|
|
310
|
+
Found patterns that look like API keys or tokens in:
|
|
311
|
+
[show grep output]
|
|
312
|
+
|
|
313
|
+
This would expose credentials if committed.
|
|
314
|
+
|
|
315
|
+
**Action required:**
|
|
316
|
+
1. Review the flagged content above
|
|
317
|
+
2. If these are real secrets, they must be removed before committing
|
|
318
|
+
3. Consider adding sensitive files to Claude Code "Deny" permissions
|
|
319
|
+
|
|
320
|
+
Pausing before commit. Reply "safe to proceed" if the flagged content is not actually sensitive, or edit the files first.
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Wait for user confirmation before continuing to commit_codebase_map.
|
|
324
|
+
|
|
325
|
+
**If SECRETS_FOUND=false:**
|
|
326
|
+
|
|
327
|
+
Continue to commit_codebase_map.
|
|
328
|
+
</step>
|
|
329
|
+
|
|
330
|
+
<step name="commit_codebase_map">
|
|
331
|
+
Commit the codebase map:
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs: map existing codebase" --files .planning/codebase/*.md
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
Continue to offer_next.
|
|
338
|
+
</step>
|
|
339
|
+
|
|
340
|
+
<step name="offer_next">
|
|
341
|
+
Present completion summary and next steps.
|
|
342
|
+
|
|
343
|
+
**Get line counts:**
|
|
344
|
+
```bash
|
|
345
|
+
wc -l .planning/codebase/*.md
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
**Output format:**
|
|
349
|
+
|
|
350
|
+
```
|
|
351
|
+
Codebase mapping complete.
|
|
352
|
+
|
|
353
|
+
Created .planning/codebase/:
|
|
354
|
+
- stack.md ([N] lines) - Technologies and dependencies
|
|
355
|
+
- architecture.md ([N] lines) - System design and patterns
|
|
356
|
+
- structure.md ([N] lines) - Directory layout and organization
|
|
357
|
+
- conventions.md ([N] lines) - Code style and patterns
|
|
358
|
+
- testing.md ([N] lines) - Test structure and practices
|
|
359
|
+
- integrations.md ([N] lines) - External services and APIs
|
|
360
|
+
- concerns.md ([N] lines) - Technical debt and issues
|
|
361
|
+
- relationships.md ([N] lines) - Module dependencies and coupling
|
|
362
|
+
- best-practices.md ([N] lines) - Best practices assessment and scores
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
## Next Up
|
|
368
|
+
|
|
369
|
+
**Initialize project** — use codebase context for planning
|
|
370
|
+
|
|
371
|
+
`/pan:new-project`
|
|
372
|
+
|
|
373
|
+
<sub>`/clear` first - fresh context window</sub>
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
377
|
+
**Also available:**
|
|
378
|
+
- Re-run mapping: `/pan:map-codebase`
|
|
379
|
+
- Review specific file: `cat .planning/codebase/stack.md`
|
|
380
|
+
- Edit any document before proceeding
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
End workflow.
|
|
386
|
+
</step>
|
|
387
|
+
|
|
388
|
+
</process>
|
|
389
|
+
|
|
390
|
+
<success_criteria>
|
|
391
|
+
- .planning/codebase/ directory created
|
|
392
|
+
- Pre-computed analysis run before agents spawn (detect-languages, analyze-imports, best-practices)
|
|
393
|
+
- 6 parallel pan-document_code agents spawned with run_in_background=true
|
|
394
|
+
- Agents write documents directly (orchestrator doesn't receive document contents)
|
|
395
|
+
- Relationships agent receives pre-computed import/dependency data
|
|
396
|
+
- Practices agent receives pre-computed language and best-practices data
|
|
397
|
+
- Read agent output files to collect confirmations
|
|
398
|
+
- All 9 codebase documents exist (lowercase filenames)
|
|
399
|
+
- Clear completion summary with line counts
|
|
400
|
+
- User offered clear next steps in PAN style
|
|
401
|
+
</success_criteria>
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
Verify milestone achieved its definition of done by aggregating phase verifications, checking cross-phase integration, and assessing requirements coverage. Reads existing verification.md files (phases already verified during execute-phase), aggregates tech debt and deferred gaps, then spawns integration checker for cross-phase wiring.
|
|
3
|
+
</purpose>
|
|
4
|
+
|
|
5
|
+
<required_reading>
|
|
6
|
+
Read all files referenced by the invoking prompt's execution_context before starting.
|
|
7
|
+
</required_reading>
|
|
8
|
+
|
|
9
|
+
<process>
|
|
10
|
+
|
|
11
|
+
## 0. Initialize Milestone Context
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
INIT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs init milestone-op)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Extract from init JSON: `milestone_version`, `milestone_name`, `phase_count`, `completed_phases`, `commit_docs`.
|
|
18
|
+
|
|
19
|
+
Resolve integration checker model:
|
|
20
|
+
```bash
|
|
21
|
+
CHECKER_MODEL=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs resolve-model pan-integration-checker --raw)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 1. Determine Milestone Scope
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Get phases in milestone (sorted numerically, handles decimals)
|
|
28
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phases list
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- Parse version from arguments or detect current from roadmap.md
|
|
32
|
+
- Identify all phase directories in scope
|
|
33
|
+
- Extract milestone definition of done from roadmap.md
|
|
34
|
+
- Extract requirements mapped to this milestone from requirements.md
|
|
35
|
+
|
|
36
|
+
## 2. Read All Phase Verifications
|
|
37
|
+
|
|
38
|
+
For each phase directory, read the verification.md:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# For each phase, use find-phase to resolve the directory (handles archived phases)
|
|
42
|
+
PHASE_INFO=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs find-phase 01 --raw)
|
|
43
|
+
# Extract directory from JSON, then read verification.md from that directory
|
|
44
|
+
# Repeat for each phase number from roadmap.md
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
From each verification.md, extract:
|
|
48
|
+
- **Status:** passed | gaps_found
|
|
49
|
+
- **Critical gaps:** (if any — these are blockers)
|
|
50
|
+
- **Non-critical gaps:** tech debt, deferred items, warnings
|
|
51
|
+
- **Anti-patterns found:** TODOs, stubs, placeholders
|
|
52
|
+
- **Requirements coverage:** which requirements satisfied/blocked
|
|
53
|
+
|
|
54
|
+
If a phase is missing verification.md, flag it as "unverified phase" — this is a blocker.
|
|
55
|
+
|
|
56
|
+
## 3. Spawn Integration Checker
|
|
57
|
+
|
|
58
|
+
With phase context collected:
|
|
59
|
+
|
|
60
|
+
Extract `MILESTONE_REQ_IDS` from requirements.md traceability table — all REQ-IDs assigned to phases in this milestone.
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
Task(
|
|
64
|
+
prompt="Check cross-phase integration and E2E flows.
|
|
65
|
+
|
|
66
|
+
Phases: {phase_dirs}
|
|
67
|
+
Phase exports: {from SUMMARYs}
|
|
68
|
+
API routes: {routes created}
|
|
69
|
+
|
|
70
|
+
Milestone Requirements:
|
|
71
|
+
{MILESTONE_REQ_IDS — list each REQ-ID with description and assigned phase}
|
|
72
|
+
|
|
73
|
+
MUST map each integration finding to affected requirement IDs where applicable.
|
|
74
|
+
|
|
75
|
+
Verify cross-phase wiring and E2E user flows.",
|
|
76
|
+
subagent_type="pan-integration-checker",
|
|
77
|
+
model="{integration_checker_model}"
|
|
78
|
+
)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## 4. Collect Results
|
|
82
|
+
|
|
83
|
+
Combine:
|
|
84
|
+
- Phase-level gaps and tech debt (from step 2)
|
|
85
|
+
- Integration checker's report (wiring gaps, broken flows)
|
|
86
|
+
|
|
87
|
+
## 5. Check Requirements Coverage (3-Source Cross-Reference)
|
|
88
|
+
|
|
89
|
+
MUST cross-reference three independent sources for each requirement:
|
|
90
|
+
|
|
91
|
+
### 5a. Parse requirements.md Traceability Table
|
|
92
|
+
|
|
93
|
+
Extract all REQ-IDs mapped to milestone phases from the traceability table:
|
|
94
|
+
- Requirement ID, description, assigned phase, current status, checked-off state (`[x]` vs `[ ]`)
|
|
95
|
+
|
|
96
|
+
### 5b. Parse Phase verification.md Requirements Tables
|
|
97
|
+
|
|
98
|
+
For each phase's verification.md, extract the expanded requirements table:
|
|
99
|
+
- Requirement | Source Plan | Description | Status | Evidence
|
|
100
|
+
- Map each entry back to its REQ-ID
|
|
101
|
+
|
|
102
|
+
### 5c. Extract summary.md Frontmatter Cross-Check
|
|
103
|
+
|
|
104
|
+
For each phase's summary.md, extract `requirements-completed` from YAML frontmatter:
|
|
105
|
+
```bash
|
|
106
|
+
for summary in .planning/phases/*-*/*-summary.md; do
|
|
107
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs summary-extract "$summary" --fields requirements_completed | jq -r '.requirements_completed'
|
|
108
|
+
done
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 5d. Status Determination Matrix
|
|
112
|
+
|
|
113
|
+
For each REQ-ID, determine status using all three sources:
|
|
114
|
+
|
|
115
|
+
| verification.md Status | SUMMARY Frontmatter | requirements.md | → Final Status |
|
|
116
|
+
|------------------------|---------------------|-----------------|----------------|
|
|
117
|
+
| passed | listed | `[x]` | **satisfied** |
|
|
118
|
+
| passed | listed | `[ ]` | **satisfied** (update checkbox) |
|
|
119
|
+
| passed | missing | any | **partial** (verify manually) |
|
|
120
|
+
| gaps_found | any | any | **unsatisfied** |
|
|
121
|
+
| missing | listed | any | **partial** (verification gap) |
|
|
122
|
+
| missing | missing | any | **unsatisfied** |
|
|
123
|
+
|
|
124
|
+
### 5e. FAIL Gate and Orphan Detection
|
|
125
|
+
|
|
126
|
+
**REQUIRED:** Any `unsatisfied` requirement MUST force `gaps_found` status on the milestone audit.
|
|
127
|
+
|
|
128
|
+
**Orphan detection:** Requirements present in requirements.md traceability table but absent from ALL phase verification.md files MUST be flagged as orphaned. Orphaned requirements are treated as `unsatisfied` — they were assigned but never verified by any phase.
|
|
129
|
+
|
|
130
|
+
## 6. Aggregate into v{version}-milestone-audit.md
|
|
131
|
+
|
|
132
|
+
Create `.planning/v{version}-v{version}-milestone-audit.md` with:
|
|
133
|
+
|
|
134
|
+
```yaml
|
|
135
|
+
---
|
|
136
|
+
milestone: {version}
|
|
137
|
+
audited: {timestamp}
|
|
138
|
+
status: passed | gaps_found | tech_debt
|
|
139
|
+
scores:
|
|
140
|
+
requirements: N/M
|
|
141
|
+
phases: N/M
|
|
142
|
+
integration: N/M
|
|
143
|
+
flows: N/M
|
|
144
|
+
gaps: # Critical blockers
|
|
145
|
+
requirements:
|
|
146
|
+
- id: "{REQ-ID}"
|
|
147
|
+
status: "unsatisfied | partial | orphaned"
|
|
148
|
+
phase: "{assigned phase}"
|
|
149
|
+
claimed_by_plans: ["{plan files that reference this requirement}"]
|
|
150
|
+
completed_by_plans: ["{plan files whose SUMMARY marks it complete}"]
|
|
151
|
+
verification_status: "passed | gaps_found | missing | orphaned"
|
|
152
|
+
evidence: "{specific evidence or lack thereof}"
|
|
153
|
+
integration: [...]
|
|
154
|
+
flows: [...]
|
|
155
|
+
tech_debt: # Non-critical, deferred
|
|
156
|
+
- phase: 01-auth
|
|
157
|
+
items:
|
|
158
|
+
- "TODO: add rate limiting"
|
|
159
|
+
- "Warning: no password strength validation"
|
|
160
|
+
- phase: 03-dashboard
|
|
161
|
+
items:
|
|
162
|
+
- "Deferred: mobile responsive layout"
|
|
163
|
+
---
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Plus full markdown report with tables for requirements, phases, integration, tech debt.
|
|
167
|
+
|
|
168
|
+
**Status values:**
|
|
169
|
+
- `passed` — all requirements met, no critical gaps, minimal tech debt
|
|
170
|
+
- `gaps_found` — critical blockers exist
|
|
171
|
+
- `tech_debt` — no blockers but accumulated deferred items need review
|
|
172
|
+
|
|
173
|
+
## 7. Present Results
|
|
174
|
+
|
|
175
|
+
Route by status (see `<offer_next>`).
|
|
176
|
+
|
|
177
|
+
</process>
|
|
178
|
+
|
|
179
|
+
<offer_next>
|
|
180
|
+
Output this markdown directly (not as a code block). Route based on status:
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
**If passed:**
|
|
185
|
+
|
|
186
|
+
## ✓ Milestone {version} — Audit Passed
|
|
187
|
+
|
|
188
|
+
**Score:** {N}/{M} requirements satisfied
|
|
189
|
+
**Report:** .planning/v{version}-milestone-audit.md
|
|
190
|
+
|
|
191
|
+
All requirements covered. Cross-phase integration verified. E2E flows complete.
|
|
192
|
+
|
|
193
|
+
───────────────────────────────────────────────────────────────
|
|
194
|
+
|
|
195
|
+
## ▶ Next Up
|
|
196
|
+
|
|
197
|
+
**Complete milestone** — archive and tag
|
|
198
|
+
|
|
199
|
+
/pan:milestone-done {version}
|
|
200
|
+
|
|
201
|
+
<sub>/clear first → fresh context window</sub>
|
|
202
|
+
|
|
203
|
+
───────────────────────────────────────────────────────────────
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
**If gaps_found:**
|
|
208
|
+
|
|
209
|
+
## ⚠ Milestone {version} — Gaps Found
|
|
210
|
+
|
|
211
|
+
**Score:** {N}/{M} requirements satisfied
|
|
212
|
+
**Report:** .planning/v{version}-milestone-audit.md
|
|
213
|
+
|
|
214
|
+
### Unsatisfied Requirements
|
|
215
|
+
|
|
216
|
+
{For each unsatisfied requirement:}
|
|
217
|
+
- **{REQ-ID}: {description}** (Phase {X})
|
|
218
|
+
- {reason}
|
|
219
|
+
|
|
220
|
+
### Cross-Phase Issues
|
|
221
|
+
|
|
222
|
+
{For each integration gap:}
|
|
223
|
+
- **{from} → {to}:** {issue}
|
|
224
|
+
|
|
225
|
+
### Broken Flows
|
|
226
|
+
|
|
227
|
+
{For each flow gap:}
|
|
228
|
+
- **{flow name}:** breaks at {step}
|
|
229
|
+
|
|
230
|
+
───────────────────────────────────────────────────────────────
|
|
231
|
+
|
|
232
|
+
## ▶ Next Up
|
|
233
|
+
|
|
234
|
+
**Plan gap closure** — create phases to complete milestone
|
|
235
|
+
|
|
236
|
+
/pan:milestone-gaps
|
|
237
|
+
|
|
238
|
+
<sub>/clear first → fresh context window</sub>
|
|
239
|
+
|
|
240
|
+
───────────────────────────────────────────────────────────────
|
|
241
|
+
|
|
242
|
+
**Also available:**
|
|
243
|
+
- cat .planning/v{version}-milestone-audit.md — see full report
|
|
244
|
+
- /pan:milestone-done {version} — proceed anyway (accept tech debt)
|
|
245
|
+
|
|
246
|
+
───────────────────────────────────────────────────────────────
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
**If tech_debt (no blockers but accumulated debt):**
|
|
251
|
+
|
|
252
|
+
## ⚡ Milestone {version} — Tech Debt Review
|
|
253
|
+
|
|
254
|
+
**Score:** {N}/{M} requirements satisfied
|
|
255
|
+
**Report:** .planning/v{version}-milestone-audit.md
|
|
256
|
+
|
|
257
|
+
All requirements met. No critical blockers. Accumulated tech debt needs review.
|
|
258
|
+
|
|
259
|
+
### Tech Debt by Phase
|
|
260
|
+
|
|
261
|
+
{For each phase with debt:}
|
|
262
|
+
**Phase {X}: {name}**
|
|
263
|
+
- {item 1}
|
|
264
|
+
- {item 2}
|
|
265
|
+
|
|
266
|
+
### Total: {N} items across {M} phases
|
|
267
|
+
|
|
268
|
+
───────────────────────────────────────────────────────────────
|
|
269
|
+
|
|
270
|
+
## ▶ Options
|
|
271
|
+
|
|
272
|
+
**A. Complete milestone** — accept debt, track in backlog
|
|
273
|
+
|
|
274
|
+
/pan:milestone-done {version}
|
|
275
|
+
|
|
276
|
+
**B. Plan cleanup phase** — address debt before completing
|
|
277
|
+
|
|
278
|
+
/pan:milestone-gaps
|
|
279
|
+
|
|
280
|
+
<sub>/clear first → fresh context window</sub>
|
|
281
|
+
|
|
282
|
+
───────────────────────────────────────────────────────────────
|
|
283
|
+
</offer_next>
|
|
284
|
+
|
|
285
|
+
<success_criteria>
|
|
286
|
+
- [ ] Milestone scope identified
|
|
287
|
+
- [ ] All phase verification.md files read
|
|
288
|
+
- [ ] summary.md `requirements-completed` frontmatter extracted for each phase
|
|
289
|
+
- [ ] requirements.md traceability table parsed for all milestone REQ-IDs
|
|
290
|
+
- [ ] 3-source cross-reference completed (VERIFICATION + SUMMARY + traceability)
|
|
291
|
+
- [ ] Orphaned requirements detected (in traceability but absent from all VERIFICATIONs)
|
|
292
|
+
- [ ] Tech debt and deferred gaps aggregated
|
|
293
|
+
- [ ] Integration checker spawned with milestone requirement IDs
|
|
294
|
+
- [ ] v{version}-milestone-audit.md created with structured requirement gap objects
|
|
295
|
+
- [ ] FAIL gate enforced — any unsatisfied requirement forces gaps_found status
|
|
296
|
+
- [ ] Results presented with actionable next steps
|
|
297
|
+
</success_criteria>
|