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,122 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
Create `.continue-here.md` handoff file to preserve complete work state across sessions. Enables seamless resumption with full context restoration.
|
|
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
|
+
<step name="detect">
|
|
12
|
+
Find current phase directory from most recently modified files:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Find most recent phase directory with work
|
|
16
|
+
ls -lt .planning/phases/*/plan.md 2>/dev/null | head -1 | grep -oP 'phases/\K[^/]+'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
If no active phase detected, ask user which phase they're pausing work on.
|
|
20
|
+
</step>
|
|
21
|
+
|
|
22
|
+
<step name="gather">
|
|
23
|
+
**Collect complete state for handoff:**
|
|
24
|
+
|
|
25
|
+
1. **Current position**: Which phase, which plan, which task
|
|
26
|
+
2. **Work completed**: What got done this session
|
|
27
|
+
3. **Work remaining**: What's left in current plan/phase
|
|
28
|
+
4. **Decisions made**: Key decisions and rationale
|
|
29
|
+
5. **Blockers/issues**: Anything stuck
|
|
30
|
+
6. **Mental context**: The approach, next steps, "vibe"
|
|
31
|
+
7. **Files modified**: What's changed but not committed
|
|
32
|
+
|
|
33
|
+
Ask user for clarifications if needed via conversational questions.
|
|
34
|
+
</step>
|
|
35
|
+
|
|
36
|
+
<step name="write">
|
|
37
|
+
**Write handoff to `.planning/phases/XX-name/.continue-here.md`:**
|
|
38
|
+
|
|
39
|
+
```markdown
|
|
40
|
+
---
|
|
41
|
+
phase: XX-name
|
|
42
|
+
task: 3
|
|
43
|
+
total_tasks: 7
|
|
44
|
+
status: in_progress
|
|
45
|
+
last_updated: [timestamp from current-timestamp]
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
<current_state>
|
|
49
|
+
[Where exactly are we? Immediate context]
|
|
50
|
+
</current_state>
|
|
51
|
+
|
|
52
|
+
<completed_work>
|
|
53
|
+
|
|
54
|
+
- Task 1: [name] - Done
|
|
55
|
+
- Task 2: [name] - Done
|
|
56
|
+
- Task 3: [name] - In progress, [what's done]
|
|
57
|
+
</completed_work>
|
|
58
|
+
|
|
59
|
+
<remaining_work>
|
|
60
|
+
|
|
61
|
+
- Task 3: [what's left]
|
|
62
|
+
- Task 4: Not started
|
|
63
|
+
- Task 5: Not started
|
|
64
|
+
</remaining_work>
|
|
65
|
+
|
|
66
|
+
<decisions_made>
|
|
67
|
+
|
|
68
|
+
- Decided to use [X] because [reason]
|
|
69
|
+
- Chose [approach] over [alternative] because [reason]
|
|
70
|
+
</decisions_made>
|
|
71
|
+
|
|
72
|
+
<blockers>
|
|
73
|
+
- [Blocker 1]: [status/workaround]
|
|
74
|
+
</blockers>
|
|
75
|
+
|
|
76
|
+
<context>
|
|
77
|
+
[Mental state, what were you thinking, the plan]
|
|
78
|
+
</context>
|
|
79
|
+
|
|
80
|
+
<next_action>
|
|
81
|
+
Start with: [specific first action when resuming]
|
|
82
|
+
</next_action>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Be specific enough for a fresh Claude to understand immediately.
|
|
86
|
+
|
|
87
|
+
Use `current-timestamp` for last_updated field. You can use init todos (which provides timestamps) or call directly:
|
|
88
|
+
```bash
|
|
89
|
+
timestamp=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs current-timestamp full --raw)
|
|
90
|
+
```
|
|
91
|
+
</step>
|
|
92
|
+
|
|
93
|
+
<step name="commit">
|
|
94
|
+
```bash
|
|
95
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "wip: [phase-name] paused at task [X]/[Y]" --files .planning/phases/*/.continue-here.md
|
|
96
|
+
```
|
|
97
|
+
</step>
|
|
98
|
+
|
|
99
|
+
<step name="confirm">
|
|
100
|
+
```
|
|
101
|
+
✓ Handoff created: .planning/phases/[XX-name]/.continue-here.md
|
|
102
|
+
|
|
103
|
+
Current state:
|
|
104
|
+
|
|
105
|
+
- Phase: [XX-name]
|
|
106
|
+
- Task: [X] of [Y]
|
|
107
|
+
- Status: [in_progress/blocked]
|
|
108
|
+
- Committed as WIP
|
|
109
|
+
|
|
110
|
+
To resume: /pan:resume
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
</step>
|
|
114
|
+
|
|
115
|
+
</process>
|
|
116
|
+
|
|
117
|
+
<success_criteria>
|
|
118
|
+
- [ ] .continue-here.md created in correct phase directory
|
|
119
|
+
- [ ] All sections filled with specific content
|
|
120
|
+
- [ ] Committed as WIP
|
|
121
|
+
- [ ] User knows location and how to resume
|
|
122
|
+
</success_criteria>
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
Generate unit and E2E tests for a completed phase based on its summary.md, context.md, and implementation. Classifies each changed file into TDD (unit), E2E (browser), or Skip categories, presents a test plan for user approval, then generates tests following RED-GREEN conventions.
|
|
3
|
+
|
|
4
|
+
Users currently hand-craft `/pan:quick` prompts for test generation after each phase. This workflow standardizes the process with proper classification, quality gates, and gap reporting.
|
|
5
|
+
</purpose>
|
|
6
|
+
|
|
7
|
+
<required_reading>
|
|
8
|
+
Read all files referenced by the invoking prompt's execution_context before starting.
|
|
9
|
+
</required_reading>
|
|
10
|
+
|
|
11
|
+
<process>
|
|
12
|
+
|
|
13
|
+
<step name="parse_arguments">
|
|
14
|
+
Parse `$ARGUMENTS` for:
|
|
15
|
+
- Phase number (integer, decimal, or letter-suffix) → store as `$PHASE_ARG`
|
|
16
|
+
- Remaining text after phase number → store as `$EXTRA_INSTRUCTIONS` (optional)
|
|
17
|
+
|
|
18
|
+
Example: `/pan:phase-tests 12 focus on edge cases` → `$PHASE_ARG=12`, `$EXTRA_INSTRUCTIONS="focus on edge cases"`
|
|
19
|
+
|
|
20
|
+
If no phase argument provided:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
ERROR: Phase number required
|
|
24
|
+
Usage: /pan:phase-tests <phase> [additional instructions]
|
|
25
|
+
Example: /pan:phase-tests 12
|
|
26
|
+
Example: /pan:phase-tests 12 focus on edge cases in the pricing module
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Exit.
|
|
30
|
+
</step>
|
|
31
|
+
|
|
32
|
+
<step name="init_context">
|
|
33
|
+
Load phase operation context:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
INIT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs init phase-op "${PHASE_ARG}")
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Extract from init JSON: `phase_dir`, `phase_number`, `phase_name`.
|
|
40
|
+
|
|
41
|
+
Verify the phase directory exists. If not:
|
|
42
|
+
```
|
|
43
|
+
ERROR: Phase directory not found for phase ${PHASE_ARG}
|
|
44
|
+
Ensure the phase exists in .planning/phases/
|
|
45
|
+
```
|
|
46
|
+
Exit.
|
|
47
|
+
|
|
48
|
+
Read the phase artifacts (in order of priority):
|
|
49
|
+
1. `${phase_dir}/*-summary.md` — what was implemented, files changed
|
|
50
|
+
2. `${phase_dir}/context.md` — acceptance criteria, decisions
|
|
51
|
+
3. `${phase_dir}/*-verification.md` — user-verified scenarios (if UAT was done)
|
|
52
|
+
|
|
53
|
+
If no summary.md exists:
|
|
54
|
+
```
|
|
55
|
+
ERROR: No summary.md found for phase ${PHASE_ARG}
|
|
56
|
+
This command works on completed phases. Run /pan:exec-phase first.
|
|
57
|
+
```
|
|
58
|
+
Exit.
|
|
59
|
+
|
|
60
|
+
Present banner:
|
|
61
|
+
```
|
|
62
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
63
|
+
PAN ► ADD TESTS — Phase ${phase_number}: ${phase_name}
|
|
64
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
65
|
+
```
|
|
66
|
+
</step>
|
|
67
|
+
|
|
68
|
+
<step name="analyze_implementation">
|
|
69
|
+
Extract the list of files modified by the phase from summary.md ("Files Changed" or equivalent section).
|
|
70
|
+
|
|
71
|
+
**CRITICAL: Project Scope Boundary**
|
|
72
|
+
Skip any files inside PAN infrastructure directories — these are NOT project source code:
|
|
73
|
+
- `.claude/`, `.github/copilot-instructions.md`, `.opencode/`, `.gemini/`, `.codex/`, `.planning/`
|
|
74
|
+
If all changed files are inside these directories, report "No project source files to test" and exit.
|
|
75
|
+
|
|
76
|
+
For each file, classify into one of four categories:
|
|
77
|
+
|
|
78
|
+
| Category | Criteria | Test Type |
|
|
79
|
+
|----------|----------|-----------|
|
|
80
|
+
| **TDD** | Pure functions where `expect(fn(input)).toBe(output)` is writable | Unit tests (T1) |
|
|
81
|
+
| **Integration** | Code that interacts with databases, APIs, queues, or external services | Integration tests (T2) |
|
|
82
|
+
| **E2E** | UI behavior verifiable by browser automation | Playwright/E2E tests (T3/T4) |
|
|
83
|
+
| **Skip** | Not meaningfully testable or already covered | None |
|
|
84
|
+
|
|
85
|
+
**TDD classification — apply when:**
|
|
86
|
+
- Business logic: calculations, pricing, tax rules, validation
|
|
87
|
+
- Data transformations: mapping, filtering, aggregation, formatting
|
|
88
|
+
- Parsers: CSV, JSON, XML, custom format parsing
|
|
89
|
+
- Validators: input validation, schema validation, business rules
|
|
90
|
+
- State machines: status transitions, workflow steps
|
|
91
|
+
- Utilities: string manipulation, date handling, number formatting
|
|
92
|
+
|
|
93
|
+
**E2E classification — apply when:**
|
|
94
|
+
- Keyboard shortcuts: key bindings, modifier keys, chord sequences
|
|
95
|
+
- Navigation: page transitions, routing, breadcrumbs, back/forward
|
|
96
|
+
- Form interactions: submit, validation errors, field focus, autocomplete
|
|
97
|
+
- Selection: row selection, multi-select, shift-click ranges
|
|
98
|
+
- Drag and drop: reordering, moving between containers
|
|
99
|
+
- Modal dialogs: open, close, confirm, cancel
|
|
100
|
+
- Data grids: sorting, filtering, inline editing, column resize
|
|
101
|
+
|
|
102
|
+
**Integration classification — apply when:**
|
|
103
|
+
- Database access: queries, transactions, migrations, connection pooling
|
|
104
|
+
- External APIs: HTTP clients, REST calls, GraphQL queries, gRPC
|
|
105
|
+
- Message queues: publish/subscribe, event handlers, dead-letter queues
|
|
106
|
+
- File storage: S3, blob storage, file system with specific paths
|
|
107
|
+
- Cache layers: Redis, Memcached, in-memory cache with external backing
|
|
108
|
+
- Authentication: OAuth flows, JWT validation against external IdP
|
|
109
|
+
|
|
110
|
+
**Infrastructure detection for Integration tests:**
|
|
111
|
+
```bash
|
|
112
|
+
# Detect Docker/testcontainer references in phase files
|
|
113
|
+
grep -rli "docker\|testcontainer\|docker-compose\|container" "$PHASE_DIR"/ 2>/dev/null
|
|
114
|
+
# Detect database connection strings or service references
|
|
115
|
+
grep -rli "connection.*string\|DbContext\|createConnection\|mongoose\|prisma\|knex" "$PHASE_DIR"/../ 2>/dev/null | head -10
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
If Integration files are detected, note required infrastructure services (database type, message broker, etc.) for the test plan step.
|
|
119
|
+
|
|
120
|
+
**Skip classification — apply when:**
|
|
121
|
+
- UI layout/styling: CSS classes, visual appearance, responsive breakpoints
|
|
122
|
+
- Configuration: config files, environment variables, feature flags
|
|
123
|
+
- Glue code: dependency injection setup, middleware registration, routing tables
|
|
124
|
+
- Migrations: database migrations, schema changes
|
|
125
|
+
- Simple CRUD: basic create/read/update/delete with no business logic
|
|
126
|
+
- Type definitions: records, DTOs, interfaces with no logic
|
|
127
|
+
|
|
128
|
+
Read each file to verify classification. Don't classify based on filename alone.
|
|
129
|
+
</step>
|
|
130
|
+
|
|
131
|
+
<step name="present_classification">
|
|
132
|
+
Present the classification to the user for confirmation before proceeding:
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
AskUserQuestion(
|
|
136
|
+
header: "Test Classification",
|
|
137
|
+
question: |
|
|
138
|
+
## Files classified for testing
|
|
139
|
+
|
|
140
|
+
### TDD (Unit Tests) — {N} files
|
|
141
|
+
{list of files with brief reason}
|
|
142
|
+
|
|
143
|
+
### Integration Tests — {I} files
|
|
144
|
+
{list of files with infrastructure requirements}
|
|
145
|
+
|
|
146
|
+
### E2E (Browser Tests) — {M} files
|
|
147
|
+
{list of files with brief reason}
|
|
148
|
+
|
|
149
|
+
### Skip — {K} files
|
|
150
|
+
{list of files with brief reason}
|
|
151
|
+
|
|
152
|
+
{if $EXTRA_INSTRUCTIONS: "Additional instructions: ${EXTRA_INSTRUCTIONS}"}
|
|
153
|
+
|
|
154
|
+
How would you like to proceed?
|
|
155
|
+
options:
|
|
156
|
+
- "Approve and generate test plan"
|
|
157
|
+
- "Adjust classification (I'll specify changes)"
|
|
158
|
+
- "Cancel"
|
|
159
|
+
)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
If user selects "Adjust classification": apply their changes and re-present.
|
|
163
|
+
If user selects "Cancel": exit gracefully.
|
|
164
|
+
</step>
|
|
165
|
+
|
|
166
|
+
<step name="discover_test_structure">
|
|
167
|
+
Before generating the test plan, discover the project's existing test structure:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Find existing test directories
|
|
171
|
+
find . -type d -name "*test*" -o -name "*spec*" -o -name "*__tests__*" 2>/dev/null | head -20
|
|
172
|
+
# Find existing test files for convention matching
|
|
173
|
+
find . -type f \( -name "*.test.*" -o -name "*.spec.*" -o -name "*Tests.fs" -o -name "*Test.fs" \) 2>/dev/null | head -20
|
|
174
|
+
# Check for test runners
|
|
175
|
+
ls package.json *.sln 2>/dev/null
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Identify:
|
|
179
|
+
- Test directory structure (where unit tests live, where E2E tests live)
|
|
180
|
+
- Naming conventions (`.test.ts`, `.spec.ts`, `*Tests.fs`, etc.)
|
|
181
|
+
- Test runner commands (how to execute unit tests, how to execute E2E tests)
|
|
182
|
+
- Test framework (xUnit, NUnit, Jest, Playwright, etc.)
|
|
183
|
+
|
|
184
|
+
If test structure is ambiguous, ask the user:
|
|
185
|
+
```
|
|
186
|
+
AskUserQuestion(
|
|
187
|
+
header: "Test Structure",
|
|
188
|
+
question: "I found multiple test locations. Where should I create tests?",
|
|
189
|
+
options: [list discovered locations]
|
|
190
|
+
)
|
|
191
|
+
```
|
|
192
|
+
</step>
|
|
193
|
+
|
|
194
|
+
<step name="generate_test_plan">
|
|
195
|
+
For each approved file, create a detailed test plan.
|
|
196
|
+
|
|
197
|
+
**For TDD files**, plan tests following RED-GREEN-REFACTOR:
|
|
198
|
+
1. Identify testable functions/methods in the file
|
|
199
|
+
2. For each function: list input scenarios, expected outputs, edge cases
|
|
200
|
+
3. Note: since code already exists, tests may pass immediately — that's OK, but verify they test the RIGHT behavior
|
|
201
|
+
|
|
202
|
+
**For E2E files**, plan tests following RED-GREEN gates:
|
|
203
|
+
1. Identify user scenarios from context.md/verification.md
|
|
204
|
+
2. For each scenario: describe the user action, expected outcome, assertions
|
|
205
|
+
3. Note: RED gate means confirming the test would fail if the feature were broken
|
|
206
|
+
|
|
207
|
+
Present the complete test plan:
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
AskUserQuestion(
|
|
211
|
+
header: "Test Plan",
|
|
212
|
+
question: |
|
|
213
|
+
## Test Generation Plan
|
|
214
|
+
|
|
215
|
+
### Unit Tests ({N} tests across {M} files)
|
|
216
|
+
{for each file: test file path, list of test cases}
|
|
217
|
+
|
|
218
|
+
### Integration Tests ({I} tests across {J} files)
|
|
219
|
+
{for each file: test file path, required services, setup}
|
|
220
|
+
|
|
221
|
+
### E2E Tests ({P} tests across {Q} files)
|
|
222
|
+
{for each file: test file path, list of test scenarios}
|
|
223
|
+
|
|
224
|
+
### Infrastructure (if Integration tests exist)
|
|
225
|
+
```yaml
|
|
226
|
+
# docker-compose.test.yml (auto-generated)
|
|
227
|
+
services:
|
|
228
|
+
{detected services with healthchecks}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Test Commands
|
|
232
|
+
- Unit: {discovered test command}
|
|
233
|
+
- Integration: {discovered integration command or "npm run test:integration"}
|
|
234
|
+
- E2E: {discovered e2e command}
|
|
235
|
+
|
|
236
|
+
Ready to generate?
|
|
237
|
+
options:
|
|
238
|
+
- "Generate all"
|
|
239
|
+
- "Cherry-pick (I'll specify which)"
|
|
240
|
+
- "Adjust plan"
|
|
241
|
+
)
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
If "Cherry-pick": ask user which tests to include.
|
|
245
|
+
If "Adjust plan": apply changes and re-present.
|
|
246
|
+
</step>
|
|
247
|
+
|
|
248
|
+
<step name="execute_tdd_generation">
|
|
249
|
+
For each approved TDD test:
|
|
250
|
+
|
|
251
|
+
1. **Create test file** following discovered project conventions (directory, naming, imports)
|
|
252
|
+
|
|
253
|
+
2. **Write test** with clear arrange/act/assert structure:
|
|
254
|
+
```
|
|
255
|
+
// Arrange — set up inputs and expected outputs
|
|
256
|
+
// Act — call the function under test
|
|
257
|
+
// Assert — verify the output matches expectations
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
3. **Run the test**:
|
|
261
|
+
```bash
|
|
262
|
+
{discovered test command}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
4. **Evaluate result:**
|
|
266
|
+
- **Test passes**: Good — the implementation satisfies the test. Verify the test checks meaningful behavior (not just that it compiles).
|
|
267
|
+
- **Test fails with assertion error**: This may be a genuine bug discovered by the test. Flag it:
|
|
268
|
+
```
|
|
269
|
+
⚠️ Potential bug found: {test name}
|
|
270
|
+
Expected: {expected}
|
|
271
|
+
Actual: {actual}
|
|
272
|
+
File: {implementation file}
|
|
273
|
+
```
|
|
274
|
+
Do NOT fix the implementation — this is a test-generation command, not a fix command. Record the finding.
|
|
275
|
+
- **Test fails with error (import, syntax, etc.)**: This is a test error. Fix the test and re-run.
|
|
276
|
+
</step>
|
|
277
|
+
|
|
278
|
+
<step name="execute_e2e_generation">
|
|
279
|
+
For each approved E2E test:
|
|
280
|
+
|
|
281
|
+
1. **Check for existing tests** covering the same scenario:
|
|
282
|
+
```bash
|
|
283
|
+
grep -r "{scenario keyword}" {e2e test directory} 2>/dev/null
|
|
284
|
+
```
|
|
285
|
+
If found, extend rather than duplicate.
|
|
286
|
+
|
|
287
|
+
2. **Create test file** targeting the user scenario from context.md/verification.md
|
|
288
|
+
|
|
289
|
+
3. **Run the E2E test**:
|
|
290
|
+
```bash
|
|
291
|
+
{discovered e2e command}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
4. **Evaluate result:**
|
|
295
|
+
- **GREEN (passes)**: Record success
|
|
296
|
+
- **RED (fails)**: Determine if it's a test issue or a genuine application bug. Flag bugs:
|
|
297
|
+
```
|
|
298
|
+
⚠️ E2E failure: {test name}
|
|
299
|
+
Scenario: {description}
|
|
300
|
+
Error: {error message}
|
|
301
|
+
```
|
|
302
|
+
- **Cannot run**: Report blocker. Do NOT mark as complete.
|
|
303
|
+
```
|
|
304
|
+
🛑 E2E blocker: {reason tests cannot run}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
**No-skip rule:** If E2E tests cannot execute (missing dependencies, environment issues), report the blocker and mark the test as incomplete. Never mark success without actually running the test.
|
|
308
|
+
</step>
|
|
309
|
+
|
|
310
|
+
<step name="summary_and_commit">
|
|
311
|
+
Create a test coverage report and present to user:
|
|
312
|
+
|
|
313
|
+
```
|
|
314
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
315
|
+
PAN ► TEST GENERATION COMPLETE
|
|
316
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
317
|
+
|
|
318
|
+
## Results
|
|
319
|
+
|
|
320
|
+
| Category | Generated | Passing | Failing | Blocked |
|
|
321
|
+
|----------|-----------|---------|---------|---------|
|
|
322
|
+
| Unit | {N} | {n1} | {n2} | {n3} |
|
|
323
|
+
| E2E | {M} | {m1} | {m2} | {m3} |
|
|
324
|
+
|
|
325
|
+
## Files Created/Modified
|
|
326
|
+
{list of test files with paths}
|
|
327
|
+
|
|
328
|
+
## Coverage Gaps
|
|
329
|
+
{areas that couldn't be tested and why}
|
|
330
|
+
|
|
331
|
+
## Bugs Discovered
|
|
332
|
+
{any assertion failures that indicate implementation bugs}
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
Record test generation in project state:
|
|
336
|
+
```bash
|
|
337
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs state-snapshot
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
If there are passing tests to commit:
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
git add {test files}
|
|
344
|
+
git commit -m "test(phase-${phase_number}): add unit and E2E tests from add-tests command"
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
Present next steps:
|
|
348
|
+
|
|
349
|
+
```
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## ▶ Next Up
|
|
353
|
+
|
|
354
|
+
{if bugs discovered:}
|
|
355
|
+
**Fix discovered bugs:** `/pan:quick fix the {N} test failures discovered in phase ${phase_number}`
|
|
356
|
+
|
|
357
|
+
{if blocked tests:}
|
|
358
|
+
**Resolve test blockers:** {description of what's needed}
|
|
359
|
+
|
|
360
|
+
{otherwise:}
|
|
361
|
+
**All tests passing!** Phase ${phase_number} is fully tested.
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
**Also available:**
|
|
366
|
+
- `/pan:phase-tests {next_phase}` — test another phase
|
|
367
|
+
- `/pan:verify-phase {phase_number}` — run UAT verification
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
```
|
|
371
|
+
</step>
|
|
372
|
+
|
|
373
|
+
</process>
|
|
374
|
+
|
|
375
|
+
<success_criteria>
|
|
376
|
+
- [ ] Phase artifacts loaded (summary.md, context.md, optionally verification.md)
|
|
377
|
+
- [ ] All changed files classified into TDD/E2E/Skip categories
|
|
378
|
+
- [ ] Classification presented to user and approved
|
|
379
|
+
- [ ] Project test structure discovered (directories, conventions, runners)
|
|
380
|
+
- [ ] Test plan presented to user and approved
|
|
381
|
+
- [ ] TDD tests generated with arrange/act/assert structure
|
|
382
|
+
- [ ] E2E tests generated targeting user scenarios
|
|
383
|
+
- [ ] All tests executed — no untested tests marked as passing
|
|
384
|
+
- [ ] Bugs discovered by tests flagged (not fixed)
|
|
385
|
+
- [ ] Test files committed with proper message
|
|
386
|
+
- [ ] Coverage gaps documented
|
|
387
|
+
- [ ] Next steps presented to user
|
|
388
|
+
</success_criteria>
|