pan-wizard 3.35.0 → 3.37.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.
Files changed (339) hide show
  1. package/CHANGELOG.md +3645 -0
  2. package/README.md +46 -52
  3. package/agents/pan-conductor.md +2 -3
  4. package/agents/pan-counterfactual.md +1 -2
  5. package/agents/pan-debugger.md +14 -3
  6. package/agents/pan-design-checker.md +1 -2
  7. package/agents/pan-designer.md +2 -3
  8. package/agents/pan-document_code.md +1 -2
  9. package/agents/pan-executor.md +25 -0
  10. package/agents/pan-hardener.md +4 -3
  11. package/agents/pan-integration-checker.md +1 -2
  12. package/agents/pan-knowledge.md +1 -2
  13. package/agents/pan-meta-reviewer.md +3 -3
  14. package/agents/pan-optimizer.md +4 -4
  15. package/agents/pan-phase-researcher.md +80 -475
  16. package/agents/pan-plan-checker.md +40 -3
  17. package/agents/pan-planner.md +21 -7
  18. package/agents/pan-previewer.md +3 -2
  19. package/agents/pan-project-researcher.md +72 -493
  20. package/agents/pan-release.md +1 -1
  21. package/agents/pan-reviewer.md +14 -3
  22. package/agents/pan-roadmapper.md +12 -7
  23. package/agents/pan-verifier.md +9 -4
  24. package/bin/install-lib.cjs +134 -14
  25. package/bin/install.js +59 -12
  26. package/commands/pan/army.md +1 -1
  27. package/commands/pan/autodev.md +76 -0
  28. package/commands/pan/cost.md +21 -1
  29. package/commands/pan/exec-phase.md +3 -4
  30. package/commands/pan/focus-auto.md +14 -7
  31. package/commands/pan/focus-design.md +4 -5
  32. package/commands/pan/focus-docs.md +24 -0
  33. package/commands/pan/learn.md +13 -6
  34. package/commands/pan/milestone-audit.md +8 -1
  35. package/commands/pan/milestone-done.md +10 -5
  36. package/commands/pan/milestone-new.md +2 -2
  37. package/commands/pan/new-project.md +15 -12
  38. package/commands/pan/plan-phase.md +15 -9
  39. package/commands/pan/preview.md +1 -1
  40. package/commands/pan/quick.md +1 -1
  41. package/commands/pan/review-deep.md +11 -5
  42. package/commands/pan/settings.md +6 -0
  43. package/commands/pan/verify-phase.md +6 -2
  44. package/docs/AGENTS.md +917 -0
  45. package/docs/ARCHITECTURE.md +1054 -0
  46. package/docs/CLI-REFERENCE.md +4582 -0
  47. package/docs/COMPARISON.md +116 -0
  48. package/docs/DEVELOPMENT.md +490 -0
  49. package/docs/ECOSYSTEM-REVIEW-2026-06.md +107 -0
  50. package/docs/ECOSYSTEM-REVIEW-2026-08.md +349 -0
  51. package/docs/EXAMPLES.md +584 -0
  52. package/docs/FAQ.md +254 -0
  53. package/docs/FIELD-HARVEST-2026-07.md +88 -0
  54. package/docs/FIELD-REPORT-army-2026-06.md +121 -0
  55. package/docs/HOOKS.md +638 -0
  56. package/docs/IMPROVEMENT-TODO.md +246 -0
  57. package/docs/INTERNALS.md +485 -0
  58. package/docs/MIGRATION-v2-to-v3.md +258 -0
  59. package/docs/SECURITY-HARDENING.md +230 -0
  60. package/docs/SKILLS-ENHANCEMENT-PLAN-V2.md +122 -0
  61. package/docs/SKILLS-FULL-TEXT.md +9685 -0
  62. package/docs/SKILLS-REFERENCE.md +1037 -0
  63. package/docs/TROUBLESHOOTING.md +1084 -0
  64. package/docs/USER-GUIDE.md +1437 -0
  65. package/docs/archive/SKILLS-ENHANCEMENT-PLAN.md +230 -0
  66. package/docs/audits/AUDIT-2026-08-e2e-ROADMAP.md +117 -0
  67. package/docs/audits/AUDIT-2026-08-e2e-VERIFICATION.md +693 -0
  68. package/docs/audits/AUDIT-2026-08-e2e.md +1546 -0
  69. package/docs/audits/OUTSTANDING-2026-08.md +275 -0
  70. package/docs/audits/STABILITY-TEST-2026-08.md +640 -0
  71. package/docs/branding/README-brand-draft.md +119 -0
  72. package/docs/branding/handoff/IMPLEMENTATION.md +205 -0
  73. package/docs/branding/handoff/README-brand-draft.md +119 -0
  74. package/docs/branding/handoff/image-prompts.md +46 -0
  75. package/docs/branding/image-prompts.md +46 -0
  76. package/docs/branding/nano-banana-prompts.txt +60 -0
  77. package/docs/context-monitor.md +13 -0
  78. package/docs/decisions/ADR-0001-strategic-feature-prioritization.md +83 -0
  79. package/docs/decisions/ADR-0002-copilot-cli-runtime.md +71 -0
  80. package/docs/decisions/ADR-0003-smart-execution.md +84 -0
  81. package/docs/decisions/ADR-0004-copilot-cli-interaction.md +89 -0
  82. package/docs/decisions/ADR-0005-command-naming.md +80 -0
  83. package/docs/decisions/ADR-0006-focus-commands.md +101 -0
  84. package/docs/decisions/ADR-0007-ship-v1.md +73 -0
  85. package/docs/decisions/ADR-0008-map-codebase-mermaid-togaf.md +80 -0
  86. package/docs/decisions/ADR-0009-production-deployment-checklist.md +68 -0
  87. package/docs/decisions/ADR-0010-standards-integration.md +79 -0
  88. package/docs/decisions/ADR-0011-help-commands-rewrite.md +64 -0
  89. package/docs/decisions/ADR-0012-contributors-attribution-index.md +42 -0
  90. package/docs/decisions/ADR-0013-strategic-feature-additions.md +53 -0
  91. package/docs/decisions/ADR-0014-internal-cleanup-code-quality.md +53 -0
  92. package/docs/decisions/ADR-0015-focus-auto-runner.md +296 -0
  93. package/docs/decisions/ADR-0016-enhanced-doc-sync.md +54 -0
  94. package/docs/decisions/ADR-0017-enhanced-focus-design.md +69 -0
  95. package/docs/decisions/ADR-0018-user-reality-testing.md +84 -0
  96. package/docs/decisions/ADR-0019-end-to-end-user-acceptance-testing.md +113 -0
  97. package/docs/decisions/ADR-0020-ai-drift-prevention.md +55 -0
  98. package/docs/decisions/ADR-0021-codebase-mapper-v2.md +76 -0
  99. package/docs/decisions/ADR-0022-lifecycle-completeness.md +63 -0
  100. package/docs/decisions/ADR-0023-opus-4-7-adoption.md +89 -0
  101. package/docs/decisions/ADR-0024-spec-b-v2-completion.md +137 -0
  102. package/docs/decisions/ADR-0025-behavioral-guardrails-layer.md +129 -0
  103. package/docs/decisions/ADR-0026-self-improvement-loop.md +171 -0
  104. package/docs/decisions/ADR-0027-doc-code-link-graph.md +164 -0
  105. package/docs/decisions/ADR-0028-unified-agents-skills-target.md +46 -0
  106. package/docs/decisions/ADR-0029-experiment-evaluator.md +76 -0
  107. package/docs/decisions/ADR-0030-planning-concurrency.md +37 -0
  108. package/docs/decisions/ADR-0031-focus-auto-backlog-source.md +47 -0
  109. package/docs/decisions/ADR-0032-squad-model.md +64 -0
  110. package/docs/decisions/ADR-0033-army-campaign.md +40 -0
  111. package/docs/decisions/ADR-0034-scheduled-campaigns.md +57 -0
  112. package/docs/decisions/ADR-0035-army-hud-dashboard.md +40 -0
  113. package/docs/decisions/ADR-0036-agentic-memory-architecture.md +106 -0
  114. package/docs/decisions/ADR-0037-pin-security-agents-to-opus.md +51 -0
  115. package/docs/decisions/ADR-0038-skill-aligned-decomposition.md +41 -0
  116. package/docs/decisions/ADR-0039-worktree-as-project-variant.md +37 -0
  117. package/docs/decisions/ADR-0040-memory-injection-defense.md +55 -0
  118. package/docs/decisions/ADR-0041-mcp-dual-era-bridge.md +47 -0
  119. package/docs/decisions/ADR-0042-design-parity-both-flows.md +45 -0
  120. package/docs/decisions/ADR-0043-addressable-planning-roots.md +56 -0
  121. package/docs/decisions/ADR-0044-bound-the-cached-context.md +104 -0
  122. package/docs/decisions/ADR-0045-agent-plugins-bundle.md +76 -0
  123. package/docs/decisions/ADR-0046-subagent-frontmatter-decisions.md +39 -0
  124. package/docs/decisions/ADR-0047-pan-harness.md +76 -0
  125. package/docs/decisions/ADR-0048-one-core-per-project.md +43 -0
  126. package/docs/decisions/ADR-0049-machine-verdicts-and-findings-ledger.md +116 -0
  127. package/docs/specs/ai_drift_prevention_featureai.md +286 -0
  128. package/docs/specs/codebase_mapper_v2_featureai.md +930 -0
  129. package/docs/specs/command_naming_optimization_featureai.md +930 -0
  130. package/docs/specs/comp_analysis_markdown_v1.md +149 -0
  131. package/docs/specs/continuous_autonomous_execution_featureai.md +304 -0
  132. package/docs/specs/contributors_attribution_index_featureai.md +476 -0
  133. package/docs/specs/copilot_cli_interaction_featureai.md +868 -0
  134. package/docs/specs/copilot_cli_runtime_featureai.md +647 -0
  135. package/docs/specs/custom-skills-assessment.md +461 -0
  136. package/docs/specs/deployment_audit_findings_featureai.md +243 -0
  137. package/docs/specs/doc_code_link_graph_featureai.md +253 -0
  138. package/docs/specs/documentation_alignment_cleanup_featureai.md +69 -0
  139. package/docs/specs/e2e_visual_testing_featureai.md +615 -0
  140. package/docs/specs/end_to_end_user_acceptance_testing_featureai.md +810 -0
  141. package/docs/specs/evidence-loop-plan.md +76 -0
  142. package/docs/specs/evidence_loop_featureai.md +497 -0
  143. package/docs/specs/focus-auto-optimize-category.md +449 -0
  144. package/docs/specs/focus-auto-optimize-superplan.md +188 -0
  145. package/docs/specs/focus_auto_runner_featureai.md +1102 -0
  146. package/docs/specs/focus_design_v2_featureai.md +197 -0
  147. package/docs/specs/focus_sync_v2_featureai.md +202 -0
  148. package/docs/specs/git_integration_overhaul_featureai.md +326 -0
  149. package/docs/specs/glm_zai_provider_featureai.md +200 -0
  150. package/docs/specs/googlecli_adoption_featureai.md +661 -0
  151. package/docs/specs/help_commands_rewrite_featureai.md +860 -0
  152. package/docs/specs/industry_analysis_strategic_additions_featureai.md +231 -0
  153. package/docs/specs/industry_comparison_and_feature_gaps_featureai.md +674 -0
  154. package/docs/specs/internal_cleanup_code_quality_featureai.md +486 -0
  155. package/docs/specs/investigations/README.md +31 -0
  156. package/docs/specs/investigations/digests/2026-09-28.md +47 -0
  157. package/docs/specs/investigations/digests/2026-10-08.md +62 -0
  158. package/docs/specs/investigations/digests/2026-10-10.md +61 -0
  159. package/docs/specs/investigations/features/debugger-red-loop-first.md +55 -0
  160. package/docs/specs/investigations/features/harness-cross-host-behaviour.md +93 -0
  161. package/docs/specs/investigations/features/optimize-apply-regression-gate.md +66 -0
  162. package/docs/specs/investigations/features/reviewer-smell-baseline.md +57 -0
  163. package/docs/specs/investigations/features/trace-failure-capture.md +69 -0
  164. package/docs/specs/lifecycle_completeness_featureai.md +754 -0
  165. package/docs/specs/local-first-ci.md +42 -0
  166. package/docs/specs/map_codebase_mermaid_togaf_featureai.md +805 -0
  167. package/docs/specs/market-delta-2026-09-superplan.md +310 -0
  168. package/docs/specs/market-ideas-2026-09.md +131 -0
  169. package/docs/specs/market-ideas-2026-10.md +428 -0
  170. package/docs/specs/market-ideas-ledger.md +177 -0
  171. package/docs/specs/memory-optimization-2026-10.md +285 -0
  172. package/docs/specs/multi-track-planning-roots.md +143 -0
  173. package/docs/specs/multi_model_routing_featureai.md +687 -0
  174. package/docs/specs/multi_model_routing_superplan.md +197 -0
  175. package/docs/specs/opus_47_existing_enhancements_featureai.md +247 -0
  176. package/docs/specs/opus_47_extended_features_featureai.md +363 -0
  177. package/docs/specs/opus_47_extended_features_v2_featureai.md +397 -0
  178. package/docs/specs/pan_focus_commands_featureai.md +2336 -0
  179. package/docs/specs/pan_zcode_mcp_bridge_featureai.md +120 -0
  180. package/docs/specs/product-excellence-superplan.md +315 -0
  181. package/docs/specs/product_excellence_program_2026_q4_featureai.md +365 -0
  182. package/docs/specs/production_deployment_readiness_featureai.md +433 -0
  183. package/docs/specs/production_readiness_ship_v1_featureai.md +698 -0
  184. package/docs/specs/real_test_enforcement_featureai.md +213 -0
  185. package/docs/specs/reality-check-2026-09-superplan.md +362 -0
  186. package/docs/specs/right-sized-ceremony.md +74 -0
  187. package/docs/specs/roadmap_and_competition_2026_q4_featureai.md +390 -0
  188. package/docs/specs/self_improvement_loop_featureai.md +875 -0
  189. package/docs/specs/skill-aligned-decomposition.md +155 -0
  190. package/docs/specs/standards_integration_featureai.md +833 -0
  191. package/docs/specs/testing-system-redesign-2026-09.md +267 -0
  192. package/docs/specs/user_reality_testing_system_featureai.md +788 -0
  193. package/docs/specs/watch-triggers.json +22 -0
  194. package/docs/specs/workflow-integration-redesign.md +742 -0
  195. package/docs/specs/workflow_state_consistency_featureai.md +183 -0
  196. package/hooks/dist/pan-context-monitor.js +9 -2
  197. package/hooks/dist/pan-cost-logger.js +5 -0
  198. package/hooks/dist/pan-guard.js +28 -5
  199. package/hooks/dist/pan-stop-guard.js +9 -9
  200. package/hooks/dist/pan-trace-logger.js +5 -0
  201. package/package.json +10 -2
  202. package/pan-wizard-core/bin/lib/agents-md.cjs +57 -8
  203. package/pan-wizard-core/bin/lib/autodev-report.cjs +180 -0
  204. package/pan-wizard-core/bin/lib/autodev.cjs +642 -0
  205. package/pan-wizard-core/bin/lib/ci.cjs +143 -0
  206. package/pan-wizard-core/bin/lib/commands.cjs +1 -1
  207. package/pan-wizard-core/bin/lib/config.cjs +41 -5
  208. package/pan-wizard-core/bin/lib/constants.cjs +27 -1
  209. package/pan-wizard-core/bin/lib/core.cjs +31 -14
  210. package/pan-wizard-core/bin/lib/cost.cjs +160 -4
  211. package/pan-wizard-core/bin/lib/cross-family.cjs +164 -0
  212. package/pan-wizard-core/bin/lib/debug-cases.cjs +104 -0
  213. package/pan-wizard-core/bin/lib/doc-lint.cjs +5 -3
  214. package/pan-wizard-core/bin/lib/failure-class.cjs +81 -0
  215. package/pan-wizard-core/bin/lib/findings.cjs +148 -9
  216. package/pan-wizard-core/bin/lib/focus.cjs +1 -1
  217. package/pan-wizard-core/bin/lib/git.cjs +1 -1
  218. package/pan-wizard-core/bin/lib/hosts.cjs +88 -0
  219. package/pan-wizard-core/bin/lib/init.cjs +7 -2
  220. package/pan-wizard-core/bin/lib/knowledge.cjs +2 -0
  221. package/pan-wizard-core/bin/lib/merge.cjs +50 -0
  222. package/pan-wizard-core/bin/lib/mutate.cjs +268 -0
  223. package/pan-wizard-core/bin/lib/next-action.cjs +112 -0
  224. package/pan-wizard-core/bin/lib/optimize.cjs +2 -2
  225. package/pan-wizard-core/bin/lib/phase-gate.cjs +15 -9
  226. package/pan-wizard-core/bin/lib/phase-remove.cjs +91 -11
  227. package/pan-wizard-core/bin/lib/phase.cjs +85 -13
  228. package/pan-wizard-core/bin/lib/plan-lint.cjs +310 -0
  229. package/pan-wizard-core/bin/lib/preview.cjs +26 -4
  230. package/pan-wizard-core/bin/lib/requirements-lint.cjs +130 -0
  231. package/pan-wizard-core/bin/lib/research-lint.cjs +268 -0
  232. package/pan-wizard-core/bin/lib/review-deep.cjs +14 -22
  233. package/pan-wizard-core/bin/lib/review-vote.cjs +105 -0
  234. package/pan-wizard-core/bin/lib/roadmap.cjs +1 -0
  235. package/pan-wizard-core/bin/lib/runner.cjs +2 -16
  236. package/pan-wizard-core/bin/lib/sizing.cjs +356 -0
  237. package/pan-wizard-core/bin/lib/squads.cjs +1 -1
  238. package/pan-wizard-core/bin/lib/state-write.cjs +247 -0
  239. package/pan-wizard-core/bin/lib/test-gate.cjs +433 -0
  240. package/pan-wizard-core/bin/lib/uat.cjs +149 -0
  241. package/pan-wizard-core/bin/lib/usage.cjs +104 -0
  242. package/pan-wizard-core/bin/lib/verdict.cjs +26 -3
  243. package/pan-wizard-core/bin/lib/verify-plan-set.cjs +30 -1
  244. package/pan-wizard-core/bin/lib/verify-preflight.cjs +2 -2
  245. package/pan-wizard-core/bin/lib/verify-red.cjs +174 -0
  246. package/pan-wizard-core/bin/lib/verify-retro.cjs +3 -2
  247. package/pan-wizard-core/bin/lib/verify-scope.cjs +143 -2
  248. package/pan-wizard-core/bin/lib/verify.cjs +86 -31
  249. package/pan-wizard-core/bin/lib/worktree.cjs +70 -0
  250. package/pan-wizard-core/bin/pan-tools.cjs +257 -28
  251. package/pan-wizard-core/learnings/universal/autonomous-loop.md +2 -2
  252. package/pan-wizard-core/mcp/orchestrator.cjs +4 -1
  253. package/pan-wizard-core/references/continuation-format.md +3 -3
  254. package/pan-wizard-core/references/design-methodology.md +1 -1
  255. package/pan-wizard-core/references/guardrails.md +1 -1
  256. package/pan-wizard-core/references/handoff-decisions.md +1 -1
  257. package/pan-wizard-core/references/model-profiles.md +2 -3
  258. package/pan-wizard-core/references/questioning.md +24 -0
  259. package/pan-wizard-core/references/ui-brand.md +4 -6
  260. package/pan-wizard-core/references/verdict-contract.md +2 -1
  261. package/pan-wizard-core/templates/config.json +10 -2
  262. package/pan-wizard-core/templates/debug.md +1 -0
  263. package/pan-wizard-core/templates/design.md +5 -4
  264. package/pan-wizard-core/templates/discovery.md +2 -2
  265. package/pan-wizard-core/templates/phase-prompt.md +7 -0
  266. package/pan-wizard-core/templates/requirements.md +9 -0
  267. package/pan-wizard-core/templates/research.md +10 -0
  268. package/pan-wizard-core/templates/summary-complex.md +5 -1
  269. package/pan-wizard-core/templates/summary-minimal.md +4 -0
  270. package/pan-wizard-core/templates/summary-standard.md +5 -1
  271. package/pan-wizard-core/templates/summary.md +8 -1
  272. package/pan-wizard-core/workflows/add-phase.md +4 -6
  273. package/pan-wizard-core/workflows/assumptions.md +19 -1
  274. package/pan-wizard-core/workflows/diagnose-issues.md +2 -0
  275. package/pan-wizard-core/workflows/discuss-phase.md +4 -2
  276. package/pan-wizard-core/workflows/exec-lean.md +69 -0
  277. package/pan-wizard-core/workflows/exec-phase.md +79 -15
  278. package/pan-wizard-core/workflows/execute-plan.md +3 -1
  279. package/{commands/pan → pan-wizard-core/workflows}/focus-doc-audit.md +13 -29
  280. package/{commands/pan → pan-wizard-core/workflows}/focus-drift-walking.md +3 -18
  281. package/{commands/pan → pan-wizard-core/workflows}/focus-exec.md +8 -23
  282. package/{commands/pan → pan-wizard-core/workflows}/focus-plan.md +6 -20
  283. package/{commands/pan → pan-wizard-core/workflows}/focus-scan.md +3 -16
  284. package/{commands/pan → pan-wizard-core/workflows}/focus-sync.md +7 -21
  285. package/pan-wizard-core/workflows/health.md +6 -0
  286. package/pan-wizard-core/workflows/help.md +114 -77
  287. package/pan-wizard-core/workflows/insert-phase.md +4 -6
  288. package/pan-wizard-core/workflows/learn.md +3 -3
  289. package/pan-wizard-core/workflows/milestone-audit.md +2 -2
  290. package/pan-wizard-core/workflows/milestone-new.md +38 -95
  291. package/pan-wizard-core/workflows/new-project.md +96 -258
  292. package/pan-wizard-core/workflows/optimize.md +107 -5
  293. package/pan-wizard-core/workflows/phase-tests.md +10 -0
  294. package/pan-wizard-core/workflows/plan-phase.md +106 -45
  295. package/pan-wizard-core/workflows/profile.md +50 -0
  296. package/pan-wizard-core/workflows/progress.md +10 -0
  297. package/pan-wizard-core/workflows/quick.md +34 -43
  298. package/pan-wizard-core/workflows/remove-phase.md +11 -1
  299. package/pan-wizard-core/workflows/research-phase.md +118 -40
  300. package/pan-wizard-core/workflows/resume-project.md +18 -2
  301. package/pan-wizard-core/workflows/settings.md +33 -19
  302. package/pan-wizard-core/workflows/todo-check.md +6 -2
  303. package/pan-wizard-core/workflows/transition.md +22 -4
  304. package/pan-wizard-core/workflows/uat-walkthrough.md +90 -0
  305. package/pan-wizard-core/workflows/update.md +1 -1
  306. package/pan-wizard-core/workflows/verify-phase.md +39 -46
  307. package/scripts/build-agent-plugin.js +35 -15
  308. package/scripts/build-help.cjs +106 -0
  309. package/scripts/build-plugin.js +10 -1
  310. package/scripts/deprecate-old-versions.js +70 -3
  311. package/scripts/generate-skills-docs.py +1 -1
  312. package/scripts/git-hooks/pre-push +27 -0
  313. package/scripts/install-git-hooks.js +7 -5
  314. package/scripts/install-pre-push.cjs +38 -0
  315. package/scripts/land.cjs +151 -0
  316. package/scripts/local-ci.cjs +501 -0
  317. package/scripts/local-schedule.cjs +277 -0
  318. package/scripts/mutation-probe.cjs +7 -80
  319. package/scripts/prompt-lint.cjs +32 -0
  320. package/scripts/prompt-rules.cjs +156 -0
  321. package/scripts/run-tests.cjs +7 -1
  322. package/scripts/test-quality-lint.cjs +3 -3
  323. package/scripts/test-surface.cjs +175 -6
  324. package/agents/pan-research-synthesizer.md +0 -246
  325. package/commands/pan/audit-deployment.md +0 -386
  326. package/commands/pan/dashboard.md +0 -22
  327. package/commands/pan/discord.md +0 -19
  328. package/commands/pan/mcp-bridge.md +0 -143
  329. package/commands/pan/milestone-cleanup.md +0 -19
  330. package/commands/pan/milestone-gaps.md +0 -35
  331. package/commands/pan/optimize.md +0 -115
  332. package/commands/pan/profile.md +0 -76
  333. package/commands/pan/research-phase.md +0 -189
  334. package/pan-wizard-core/bin/lib/bridge.cjs +0 -269
  335. package/pan-wizard-core/templates/research-project/architecture.md +0 -204
  336. package/pan-wizard-core/templates/research-project/features.md +0 -147
  337. package/pan-wizard-core/templates/research-project/pitfalls.md +0 -200
  338. package/pan-wizard-core/templates/research-project/stack.md +0 -120
  339. package/pan-wizard-core/templates/research-project/summary.md +0 -170
@@ -0,0 +1,810 @@
1
+ # End-to-End User Acceptance Testing — Feature Specification
2
+
3
+ **Mode:** `--internal` | **Date:** 2026-03-04 | **ADR:** ADR-0019
4
+
5
+ ---
6
+
7
+ ## Phase 0: Problem Framing & Demand Validation
8
+
9
+ ### 0.1 Problem Statement
10
+
11
+ PAN Wizard has 1,466 tests (1,419 unit + 47 scenario) that validate internal modules and basic install-then-run flows. However, **zero tests replicate the actual user journey**: a developer installs PAN into a project folder, opens it in VS Code, and invokes PAN commands through Claude Code or Copilot CLI. The existing scenario tests (ADR-0018) prove that `pan-tools.cjs` works from an installed path, but they don't validate:
12
+
13
+ 1. **Settings/config schema correctness** — Is the generated `settings.json` (Claude) or `config.json` (Copilot) structurally valid for the host tool to consume?
14
+ 2. **Command discoverability** — Are `.md` command files correctly placed where Claude Code / Copilot CLI expects them?
15
+ 3. **Hook registration integrity** — Are hooks registered with correct event names (PascalCase for Claude, camelCase for Copilot) and valid file references?
16
+ 4. **Agent structural validity** — Do agent `.md` files have the required frontmatter and XML structure tags?
17
+ 5. **Multi-command user workflows** — Does a realistic sequence like `install → /pan:new-project → /pan:discuss-phase → /pan:plan-phase → /pan:exec-phase → /pan:verify-phase` produce coherent state transitions?
18
+ 6. **IDE integration surface** — Does the installed structure match what VS Code extensions for Claude Code or Copilot CLI expect to find?
19
+
20
+ The gap: ADR-0018 tests prove "pan-tools works from installed location." This spec addresses "the installed structure is correct for the host tool to consume, and a user can complete a full workflow."
21
+
22
+ ### 0.2 Demand Evidence
23
+
24
+ | Evidence Type | Source | Finding |
25
+ |--------------|--------|---------|
26
+ | Personal pain (user-stated) | This conversation | "it works well from a system test but contain no end state user test, where the panwizard is install into a folder opened up with VSCODE and is called via claude or copilot, now do a document for that" |
27
+ | ADR-0018 gap | ADR-0018 consequences | ADR-0018 explicitly defers: "No test validates that converted TOML/SKILL.md files are syntactically valid" and "No test validates hook execution" |
28
+ | Release risk | Production experience | Every release risks breaking the IDE integration surface — settings.json schema changes, hook key renames, command file misplacement — with no automated guard |
29
+
30
+ ### 0.2.5 Before/After State
31
+
32
+ **Current behavior (before):**
33
+ - `npm run test:scenarios` runs 47 tests across 4 files
34
+ - `runtime-matrix.test.cjs`: install 5 runtimes + run `generate-slug`, `current-timestamp`, `state json`, `config-ensure-section` from installed path
35
+ - `workflow-init.test.cjs`: phase add/list, state mutations, validate health from Claude installed path
36
+ - `state-integrity.test.cjs`: state add-decision → add-blocker → state-snapshot consistency
37
+ - `cross-platform-paths.test.cjs`: JSON output has forward slashes, no absolute paths leaked
38
+ - **No test validates**: settings.json schema, hook key names, command file placement, agent file structure, multi-step user workflow coherence, or IDE integration surface
39
+
40
+ **Desired behavior (after):**
41
+ - New scenario test files that validate the **host tool integration contract**:
42
+ - Settings.json / config.json contain required keys with correct types
43
+ - Command `.md` files exist at correct paths for each runtime
44
+ - Hook entries reference existing files and use correct event key names
45
+ - Agent files have valid frontmatter and required XML structure tags
46
+ - A realistic multi-command workflow produces coherent state (install → init state → add phase → plan-like operations → snapshot shows expected state)
47
+ - Copilot config.json uses camelCase hooks, Claude settings.json uses PascalCase
48
+
49
+ **Delta:**
50
+ - New `tests/scenarios/settings-schema.test.cjs` — validates generated settings/config files
51
+ - New `tests/scenarios/command-discovery.test.cjs` — validates command file placement and discoverability
52
+ - New `tests/scenarios/hook-registration.test.cjs` — validates hook entries and file references
53
+ - New `tests/scenarios/agent-structure.test.cjs` — validates agent file format
54
+ - New `tests/scenarios/user-workflow-e2e.test.cjs` — full user journey simulation
55
+ - Existing scenario count grows from 47 to ~80+
56
+
57
+ ### 0.3 Scope Definition
58
+
59
+ | In Scope | Out of Scope (and why) |
60
+ |----------|------------------------|
61
+ | Settings.json / config.json schema validation | LLM response testing — non-deterministic |
62
+ | Command file placement per runtime | VS Code extension internals — third-party code |
63
+ | Hook registration format per runtime | Actual hook execution — requires real event triggers |
64
+ | Agent file structural validation | Agent behavior validation — requires LLM |
65
+ | Multi-command workflow state coherence | Interactive readline prompts — requires stdin mock |
66
+ | Claude + Copilot host tool contract | OpenCode TOML validation — separate runtime format |
67
+ | Gemini TOML basic structure | Full TOML spec compliance — needs TOML parser (runtime dep) |
68
+
69
+ ### 0.4 Success Criteria
70
+
71
+ | ID | Criterion | Verification Method | Pass Condition |
72
+ |----|-----------|-------------------|----------------|
73
+ | SC-1 | Claude settings.json has valid hook keys | Test: parse JSON, check `hooks.SessionStart`, `hooks.PostToolUse` exist as arrays | Arrays with `>=1` entry each |
74
+ | SC-2 | Copilot config.json has valid hook keys | Test: parse JSON, check `hooks.sessionStart`, `hooks.postToolUse` exist as arrays | Arrays with `>=1` entry each |
75
+ | SC-3 | Command files discoverable per runtime | Test: glob for command files in expected paths | >= 30 commands found per runtime |
76
+ | SC-4 | Hook file references resolve to existing files | Test: extract paths from hook entries, verify file exists | All referenced files exist |
77
+ | SC-5 | Agent files have valid structure | Test: read agent .md files, check frontmatter + XML tags | All agents have `name`, `description` in frontmatter + `<objective>` tag |
78
+ | SC-6 | Multi-command workflow produces coherent state | Test: install → init state → add phase → list phases → snapshot | Snapshot reflects added phase |
79
+ | SC-7 | No regression in existing 1,466 tests | `npm run test:all` | All tests pass, count >= 1466 |
80
+
81
+ ### 0.5 User Stories
82
+
83
+ ```
84
+ As a PAN Wizard maintainer, I want tests that validate the settings.json schema
85
+ matches what Claude Code expects, so that installer changes don't silently break
86
+ hook registration, instead of discovering broken hooks after users install.
87
+ ```
88
+
89
+ ```
90
+ As a PAN Wizard maintainer, I want tests that verify command files are placed
91
+ where each runtime expects them, so that renamed or moved commands are caught
92
+ before release, instead of users getting "command not found" errors.
93
+ ```
94
+
95
+ ```
96
+ As a developer using PAN on Copilot CLI, I want confidence that config.json
97
+ uses the correct camelCase hook keys, so that hooks actually fire when I use
98
+ the tool, instead of silently failing because the key names are wrong.
99
+ ```
100
+
101
+ ### 0.6 Cannibalization Check
102
+
103
+ | Existing Command/Agent | Overlap? | Impact |
104
+ |-----------------------|----------|--------|
105
+ | `runtime-matrix.test.cjs` (ADR-0018) | Partial | Existing tests install + run commands. New tests ADD schema/structure validation on top. No replacement needed. |
106
+ | `workflow-init.test.cjs` (ADR-0018) | Partial | Existing tests run phase operations. New `user-workflow-e2e` adds a longer, more realistic sequence. Complementary. |
107
+ | `tests/installer-functions.test.cjs` | None | Tests install-lib.cjs pure functions. New tests validate the OUTPUT of the full installer. |
108
+ | `validate health` command | None | Validates `.planning/` structure. New tests validate runtime config directory structure. |
109
+
110
+ No full overlap — new tests validate the **host tool integration surface**, not pan-tools behavior.
111
+
112
+ ### 0.7 Cognitive Load Assessment
113
+
114
+ | Metric | Before | After | Delta |
115
+ |--------|--------|-------|-------|
116
+ | Commands a new user must learn | 0 (internal) | 0 (internal) | 0 |
117
+ | New concepts introduced | 0 | 1 (host tool integration contract) | +1 |
118
+ | Score | — | — | neutral (0) — internal tooling, developer-only |
119
+
120
+ ---
121
+
122
+ ## Phase 0.8: Autonomous Codebase Investigation — Summary
123
+
124
+ ### Files Read & Patterns Discovered
125
+
126
+ **Settings.json Schema (Claude Code — via `bin/install.js` lines 1578-1669):**
127
+ ```json
128
+ {
129
+ "hooks": {
130
+ "SessionStart": [{ "hooks": [{ "type": "command", "command": "node .claude/hooks/pan-check-update.js" }] }],
131
+ "PostToolUse": [{ "hooks": [{ "type": "command", "command": "node .claude/hooks/pan-context-monitor.js" }] }]
132
+ },
133
+ "statusLine": {
134
+ "type": "command",
135
+ "command": "node .claude/hooks/pan-statusline.js"
136
+ }
137
+ }
138
+ ```
139
+
140
+ **Config.json Schema (Copilot CLI — via `bin/install.js` lines 1538-1575):**
141
+ ```json
142
+ {
143
+ "hooks": {
144
+ "sessionStart": [{ "command": "node .github/hooks/pan-check-update.js" }],
145
+ "postToolUse": [{ "command": "node .github/hooks/pan-context-monitor.js" }]
146
+ },
147
+ "statusLine": {
148
+ "command": "node .github/hooks/pan-statusline.js"
149
+ }
150
+ }
151
+ ```
152
+
153
+ **Key Difference:** Claude uses PascalCase event keys + nested `{hooks: [{type, command}]}` structure. Copilot uses camelCase keys + flat `{command}` structure. This is a prime source of integration bugs.
154
+
155
+ **Command File Paths by Runtime:**
156
+ - Claude: `.claude/commands/pan/*.md`
157
+ - OpenCode: `.opencode/command/pan-*.md` (flat, hyphenated)
158
+ - Gemini: `.gemini/commands/pan/*.md` (converted to TOML extension)
159
+ - Codex: `.codex/skills/pan-*/SKILL.md` (one dir per command)
160
+ - Copilot: `.github/skills/pan-*/SKILL.md` (one dir per command)
161
+
162
+ **Agent File Structure (from `agents/*.md`):**
163
+ - Frontmatter: `name`, `description`, `tools` (optional list), `color` (optional)
164
+ - Body: XML tags including `<objective>`, `<context>`, `<process>`, `<constraints>`
165
+
166
+ **Hook Files (from `hooks/dist/`):**
167
+ - `pan-statusline.js`, `pan-context-monitor.js`, `pan-check-update.js`
168
+ - All compiled by esbuild from `hooks/` source
169
+
170
+ ### Impact Analysis
171
+
172
+ | Affected Area | Specific Item | How Affected | Risk Level |
173
+ |--------------|---------------|-------------|------------|
174
+ | Test directory | `tests/scenarios/` | 5 new test files added | Low |
175
+ | Package.json | `scripts` | No change needed — existing `test:scenarios` glob picks up new files | Low |
176
+ | Core modules | None | Tests are read-only against installed dirs | Low |
177
+ | Installer | None | Tests validate output, don't modify installer | Low |
178
+
179
+ Zero High-risk items — these are purely additive tests.
180
+
181
+ ---
182
+
183
+ ## Phase 1: Internal Reconnaissance — Summary
184
+
185
+ ### 1.1 Existing Capabilities Inventory
186
+
187
+ | Capability | Status | Location | Relevance |
188
+ |------------|--------|----------|-----------|
189
+ | Scenario runner (createScenarioRunner) | Complete | `tests/helpers.cjs:59-108` | Base for all new tests |
190
+ | Runtime matrix install + run | Complete | `tests/scenarios/runtime-matrix.test.cjs` | Template for schema/structure tests |
191
+ | Multi-step workflow test | Complete | `tests/scenarios/workflow-init.test.cjs` | Template for e2e workflow |
192
+ | Settings.json schema validation | Missing | — | Core deliverable |
193
+ | Command discoverability test | Missing | — | Core deliverable |
194
+ | Hook registration validation | Missing | — | Core deliverable |
195
+ | Agent structure validation | Missing | — | Core deliverable |
196
+ | Full user journey e2e | Missing | — | Core deliverable |
197
+
198
+ ### 1.3 Convention Enforcement Checklist
199
+
200
+ - [x] CommonJS only (`.cjs` with `require()`)
201
+ - [x] Zero runtime dependencies — only `node:test`, `node:assert`, `node:fs`, `node:path`
202
+ - [x] Functions stay within complexity budget (50 lines max)
203
+ - [x] Tests use `test()` not `it()`
204
+ - [x] Tests use `node:assert/strict`
205
+ - [x] Tests follow `before()/after()` lifecycle with createScenarioRunner
206
+ - [x] Cleanup guaranteed by `after()` hooks
207
+
208
+ ### 1.4 Dependency & Integration Map
209
+
210
+ ```
211
+ [E2E User Acceptance Tests (new)]
212
+ ├── depends on: tests/helpers.cjs (createScenarioRunner, RUNTIME_DIR)
213
+ ├── depends on: bin/install.js (installer under test — not modified)
214
+ ├── depends on: pan-wizard-core/bin/pan-tools.cjs (CLI under test)
215
+ ├── reads: .claude/settings.json, .github/config.json (generated by installer)
216
+ ├── reads: command .md files, agent .md files, hook .js files
217
+ ├── extends: runtime-matrix.test.cjs (same install pattern)
218
+ ├── conflicts with: nothing
219
+ └── enables: regression detection for IDE integration surface
220
+ ```
221
+
222
+ No circular dependencies.
223
+
224
+ ---
225
+
226
+ ## Phase 3: Strategic Analysis
227
+
228
+ ### 3.1 Blue Ocean Four Actions Framework
229
+
230
+ | Action | Question | Decisions |
231
+ |--------|----------|-----------|
232
+ | **ELIMINATE** | What testing complexity can we drop? | Eliminate need for running actual VS Code or Claude Code process — validate the file contracts instead. Eliminate LLM-dependent testing — focus on deterministic structural checks. |
233
+ | **REDUCE** | What should decrease? | Reduce reliance on manual "install and try it" testing. Reduce chance of shipping broken settings.json schemas. |
234
+ | **RAISE** | What should be raised? | Raise confidence that installed directories are consumable by host tools. Raise hook registration correctness from "trust the installer code" to "verified by test." |
235
+ | **CREATE** | What doesn't exist? | Create host-tool-contract validation tests. Create command discoverability tests. Create hook reference integrity tests. Create agent structural validation tests. |
236
+
237
+ ### 3.2 Wardley Evolution Assessment
238
+
239
+ ```
240
+ Genesis ──── Custom-Built ──── Product ──── Commodity
241
+ ^
242
+ [Host Tool Contract Testing]
243
+ ```
244
+
245
+ Testing that "file structures match what AI tools expect" is deeply custom-built. No framework exists for validating Claude Code settings.json or Copilot CLI config.json schemas. This must be purpose-built and maintained as host tool schemas evolve.
246
+
247
+ ### 3.3 Strategic Moat Analysis
248
+
249
+ | Moat Type | Contribution | Score (0-5) |
250
+ |-----------|-------------|-------------|
251
+ | **Context Engineering** | Validates commands, agents, hooks are correctly structured for AI consumption | 5 |
252
+ | **Cross-Platform** | Tests run on all 3 platforms via CI | 4 |
253
+ | **Developer Experience** | Catches broken installs before users do | 5 |
254
+ | **Zero Dependencies** | Uses only Node.js builtins | 5 |
255
+ | **State Persistence** | Validates state transitions across multi-command sequences | 3 |
256
+ | **Verification Quality** | Directly verifies the user-facing integration surface | 5 |
257
+ | **Total** | | **27/30** |
258
+
259
+ ### 3.4 Strategic Recommendation
260
+
261
+ **Build it.** This closes the last gap in the testing pyramid: ADR-0018 proved pan-tools works from installed paths, but nothing proves the installed directory is correct for the HOST TOOL. A broken `settings.json` hook key means hooks silently don't fire. A misplaced command `.md` means the command doesn't appear in Claude Code. These are invisible failures — users blame PAN, not the integration surface. The unique angle: contract-based testing of AI tool integration points. No other project tests this because no other project supports 5 runtimes.
262
+
263
+ ---
264
+
265
+ ## Phase 3.5: Architecture & Implementation Pattern Assessment
266
+
267
+ ### 3.5.1 Feature Type Classification
268
+
269
+ **Type: Test Infrastructure (additive)**
270
+ - Create: `tests/scenarios/settings-schema.test.cjs`
271
+ - Create: `tests/scenarios/command-discovery.test.cjs`
272
+ - Create: `tests/scenarios/hook-registration.test.cjs`
273
+ - Create: `tests/scenarios/agent-structure.test.cjs`
274
+ - Create: `tests/scenarios/user-workflow-e2e.test.cjs`
275
+
276
+ ### 3.5.2 Layer Violation Check
277
+
278
+ - [x] Tests only read generated files — no writes to installed dirs
279
+ - [x] Tests use `createScenarioRunner` from helpers.cjs — same pattern as existing tests
280
+ - [x] No test file imports agent/command/hook files as modules — they read them as plain text
281
+ - [x] No upward dependencies
282
+
283
+ ### 3.5.3 Output Contract Design
284
+
285
+ N/A — tests produce node:test TAP output. No custom JSON contract needed.
286
+
287
+ ### 3.5.4 State Transition Modeling
288
+
289
+ N/A — tests are read-only against generated dirs. The `user-workflow-e2e` test creates temp `.planning/` state, which is cleaned up after.
290
+
291
+ ### 3.5.5 Breaking Change Assessment
292
+
293
+ | Question | Answer |
294
+ |----------|--------|
295
+ | Changes any existing command's output schema? | No |
296
+ | Changes file formats? | No |
297
+ | Changes directory structure? | No — new test files only |
298
+ | Changes installer output? | No |
299
+
300
+ ### 3.5.6 Composability Analysis
301
+
302
+ | Interaction | Works? | How |
303
+ |-------------|--------|-----|
304
+ | CI runs new tests automatically | Yes | `npm run test:scenarios` glob picks up new files in `tests/scenarios/` |
305
+ | Developer runs single test file | Yes | `node --test tests/scenarios/settings-schema.test.cjs` |
306
+ | Existing test:all includes new tests | Yes | Glob: `tests/scenarios/*.test.cjs` |
307
+
308
+ ### 3.5.7 Performance Budget
309
+
310
+ | Operation | Cost | Notes |
311
+ |-----------|------|-------|
312
+ | Install per runtime (~200ms) | ~1000ms for 5 | Shared per describe block |
313
+ | Read + validate settings.json | ~5ms per runtime | JSON parse + key checks |
314
+ | Glob command files | ~20ms per runtime | fs.readdirSync |
315
+ | Read agent .md files | ~50ms for 11 agents | fs.readFileSync x 11 |
316
+ | Multi-command workflow | ~500ms | 5 x execSync ~100ms each |
317
+ | **Total new test time** | **~3-5s** | Minimal addition to existing ~15s scenarios |
318
+
319
+ ### 3.5.8 Cross-Platform Considerations
320
+
321
+ | Platform | Consideration |
322
+ |----------|---------------|
323
+ | Windows | Path separators in hook commands — installer should produce forward slashes |
324
+ | Mac/Linux | POSIX paths — no issues |
325
+ | All | Use `path.join()` for file reads, compare with normalized patterns |
326
+ | CI | GitHub Actions already configured (ADR-0018) |
327
+
328
+ ---
329
+
330
+ ## Phase 4: Design Synthesis
331
+
332
+ ### 4.1 Guide-Level Explanation
333
+
334
+ **End-to-End User Acceptance Tests** validate that PAN Wizard's installed directory structure is correct for the host AI tool to consume. They bridge the gap between "pan-tools commands work" (ADR-0018) and "the user can actually use PAN from Claude Code / Copilot CLI."
335
+
336
+ **Example 1: Settings.json Schema Validation**
337
+ ```javascript
338
+ // tests/scenarios/settings-schema.test.cjs
339
+ describe('Claude settings.json schema', () => {
340
+ let runner;
341
+ before(() => { runner = createScenarioRunner('claude'); });
342
+ after(() => { if (runner) runner.cleanup(); });
343
+
344
+ test('hooks use PascalCase event keys', () => {
345
+ const settings = JSON.parse(
346
+ fs.readFileSync(path.join(runner.tmpDir, '.claude', 'settings.json'), 'utf8'));
347
+ assert.ok(settings.hooks.SessionStart, 'SessionStart hook missing');
348
+ assert.ok(settings.hooks.PostToolUse, 'PostToolUse hook missing');
349
+ // Verify NO camelCase keys leaked
350
+ assert.equal(settings.hooks.sessionStart, undefined, 'camelCase sessionStart should not exist');
351
+ });
352
+ });
353
+ ```
354
+
355
+ **Example 2: Command Discoverability**
356
+ ```javascript
357
+ // tests/scenarios/command-discovery.test.cjs
358
+ describe('Claude command discoverability', () => {
359
+ test('command files exist in .claude/commands/pan/', () => {
360
+ const cmdDir = path.join(runner.tmpDir, '.claude', 'commands', 'pan');
361
+ const files = fs.readdirSync(cmdDir).filter(f => f.endsWith('.md'));
362
+ assert.ok(files.length >= 30, `Expected >= 30 commands, found ${files.length}`);
363
+ assert.ok(files.includes('plan-phase.md'), 'plan-phase.md should exist');
364
+ assert.ok(files.includes('exec-phase.md'), 'exec-phase.md should exist');
365
+ });
366
+ });
367
+ ```
368
+
369
+ **Example 3: Full User Workflow**
370
+ ```javascript
371
+ // tests/scenarios/user-workflow-e2e.test.cjs
372
+ describe('Full user workflow: install → init → plan → verify', () => {
373
+ test('complete lifecycle produces coherent state', () => {
374
+ // Setup project structure
375
+ setupProject(runner.tmpDir);
376
+
377
+ // 1. Config ensure
378
+ const config = runner.run('config-ensure-section');
379
+ assert.ok(config.success);
380
+
381
+ // 2. Add phase
382
+ const phase = runner.run('phase add authentication');
383
+ assert.ok(phase.success);
384
+
385
+ // 3. List phases — should include added phase
386
+ const list = runner.run('phases list');
387
+ const parsed = JSON.parse(list.output);
388
+ assert.ok(parsed.directories.length >= 1);
389
+
390
+ // 4. State snapshot — should be consistent
391
+ const snapshot = runner.run('state-snapshot');
392
+ assert.ok(snapshot.success);
393
+ const state = JSON.parse(snapshot.output);
394
+ assert.ok(state.status);
395
+
396
+ // 5. Validate health — should pass
397
+ const health = runner.run('validate health');
398
+ assert.ok(health.success);
399
+ });
400
+ });
401
+ ```
402
+
403
+ **What these tests do NOT test:**
404
+ - LLM responses (non-deterministic)
405
+ - VS Code extension behavior (third-party)
406
+ - Actual hook execution (requires real event triggers)
407
+ - Interactive readline prompts (requires stdin)
408
+
409
+ ### 4.2 Reference-Level Explanation
410
+
411
+ #### 4.2.1 Test File Specifications
412
+
413
+ **`settings-schema.test.cjs`** — Host tool config validation
414
+ ```
415
+ Runtimes tested: claude, copilot
416
+ Reads: .claude/settings.json, .github/config.json
417
+ Validates:
418
+ - JSON is parseable
419
+ - Hook event keys use correct casing (PascalCase for Claude, camelCase for Copilot)
420
+ - Hook entries are arrays (not objects or strings)
421
+ - statusLine key exists with command field
422
+ - No unexpected top-level keys
423
+ - Hook command strings are non-empty
424
+ ```
425
+
426
+ **`command-discovery.test.cjs`** — Command file placement
427
+ ```
428
+ Runtimes tested: claude, copilot, codex
429
+ Validates:
430
+ - Claude: .claude/commands/pan/*.md — count >= 30
431
+ - Copilot: .github/skills/pan-*/SKILL.md — count >= 30
432
+ - Codex: .codex/skills/pan-*/SKILL.md — count >= 30
433
+ - Known critical commands exist (plan-phase, exec-phase, verify-phase, new-project, quick)
434
+ - No empty command files (size > 100 bytes)
435
+ ```
436
+
437
+ **`hook-registration.test.cjs`** — Hook file reference integrity
438
+ ```
439
+ Runtimes tested: claude, copilot
440
+ Validates:
441
+ - Each hook entry's command field references a file that exists on disk
442
+ - hook .js files are non-empty (> 100 bytes)
443
+ - 3 expected hooks present: pan-check-update.js, pan-context-monitor.js, pan-statusline.js
444
+ - No duplicate hook entries (deduplication worked)
445
+ ```
446
+
447
+ **`agent-structure.test.cjs`** — Agent file format
448
+ ```
449
+ Runtimes tested: claude
450
+ Validates:
451
+ - All .md files in .claude/agents/ have content
452
+ - Frontmatter contains 'name' field
453
+ - Body contains <objective> XML tag
454
+ - Agent count matches expected (>= 10)
455
+ ```
456
+
457
+ **`user-workflow-e2e.test.cjs`** — Full user journey
458
+ ```
459
+ Runtime: claude
460
+ Workflow:
461
+ 1. Install (done by createScenarioRunner)
462
+ 2. Setup .planning/ structure (roadmap.md, state.md)
463
+ 3. config-ensure-section → config.json exists
464
+ 4. phase add → new phase directory created
465
+ 5. phase add (second) → two phases exist
466
+ 6. phases list → returns both phases
467
+ 7. state add-decision → decision recorded
468
+ 8. state-snapshot → reflects decisions and phases
469
+ 9. validate health → passes
470
+ 10. generate-slug → utility works in context
471
+ Validates:
472
+ - Each step succeeds
473
+ - State is consistent across operations
474
+ - No state corruption from interleaved operations
475
+ - Final snapshot reflects all accumulated changes
476
+ ```
477
+
478
+ #### 4.2.2 Settings.json Contract (Claude Code)
479
+
480
+ Expected structure after install:
481
+ ```json
482
+ {
483
+ "hooks": {
484
+ "SessionStart": [
485
+ {
486
+ "hooks": [
487
+ { "type": "command", "command": "node .claude/hooks/pan-check-update.js" }
488
+ ]
489
+ }
490
+ ],
491
+ "PostToolUse": [
492
+ {
493
+ "hooks": [
494
+ { "type": "command", "command": "node .claude/hooks/pan-context-monitor.js" }
495
+ ]
496
+ }
497
+ ]
498
+ },
499
+ "statusLine": {
500
+ "type": "command",
501
+ "command": "node .claude/hooks/pan-statusline.js"
502
+ }
503
+ }
504
+ ```
505
+
506
+ #### 4.2.3 Config.json Contract (Copilot CLI)
507
+
508
+ Expected structure after install:
509
+ ```json
510
+ {
511
+ "hooks": {
512
+ "sessionStart": [
513
+ { "command": "node .github/hooks/pan-check-update.js" }
514
+ ],
515
+ "postToolUse": [
516
+ { "command": "node .github/hooks/pan-context-monitor.js" }
517
+ ]
518
+ },
519
+ "statusLine": {
520
+ "command": "node .github/hooks/pan-statusline.js"
521
+ }
522
+ }
523
+ ```
524
+
525
+ ### 4.3 Design Decisions
526
+
527
+ | Decision | Rationale | What We Did NOT Do (and Why) |
528
+ |----------|-----------|-------------------------------|
529
+ | Validate file contracts, not runtime behavior | Host tools consume files — if files are correct, tools work. Avoids non-deterministic testing. | Didn't start actual Claude Code / Copilot process — requires full IDE, not automatable |
530
+ | Test Claude + Copilot schemas separately | Different key casing and hook structure — both must be validated independently. | Didn't create a generic "validate any runtime config" — too abstract, each runtime is different |
531
+ | Read agent .md files as plain text, not parse frontmatter | We need to verify structure exists, not parse it perfectly. Regex for key fields is sufficient. | Didn't add a YAML parser — runtime dependency |
532
+ | Test command count thresholds, not exact counts | Command count changes with each release. Threshold (>=30) catches catastrophic failures. | Didn't hardcode exact command list — too brittle |
533
+
534
+ ### 4.4 Drawbacks & Alternatives
535
+
536
+ | Decision Point | Chosen | Alternative | Why Not | Drawback of Chosen |
537
+ |----------------|--------|------------|---------|-------------------|
538
+ | Schema validation | Manual JSON parse + key checks | JSON Schema library | Runtime dependency | Must maintain key expectations manually |
539
+ | Command discovery | fs.readdirSync + count | Start Claude Code and check /pan:help | Requires Claude Code installed, non-deterministic | Doesn't test actual tool discovery |
540
+ | Hook validation | Extract command from JSON, check file exists | Run hook command and check exit code | Some hooks have side effects | Doesn't test hook execution logic |
541
+ | Agent validation | Regex for frontmatter + XML tags | YAML parser + XML parser | Two runtime dependencies | Regex may miss edge cases |
542
+ | User workflow | 10-step command sequence | Full new-project interactive flow | Requires stdin mocking | Shorter workflow, less coverage |
543
+
544
+ ### 4.5 Feature Ladder
545
+
546
+ | Version | Scope | Value Delivered | Effort |
547
+ |---------|-------|----------------|--------|
548
+ | **v0 (MVP)** | Settings schema + command discovery + hook registration tests | Host tool contract validated for Claude + Copilot | S (2 pts) |
549
+ | **v1 (Complete)** | + agent structure + user workflow e2e + all 5 runtimes | Full integration surface validated | M (4 pts) |
550
+ | **v2 (Enhanced)** | + TOML syntax validation for Gemini + SKILL.md format validation for Codex + golden file comparison | Runtime-specific format correctness | M (4 pts) |
551
+
552
+ ### 4.6 Adoption Analysis
553
+
554
+ | Question | Answer |
555
+ |----------|--------|
556
+ | How does the user discover this feature? | Internal — `npm run test:scenarios` automatically includes new files |
557
+ | What's the learning curve? | Minimal — same `createScenarioRunner` pattern as existing scenario tests |
558
+ | Does it require changing existing workflows? | No — additive tests only |
559
+ | What's the "aha moment"? | First time a test catches a broken settings.json key after an installer refactor |
560
+
561
+ ---
562
+
563
+ ## Phase 5: Architecture Decision Record
564
+
565
+ See `docs/decisions/ADR-0019-end-to-end-user-acceptance-testing.md` (saved separately).
566
+
567
+ ---
568
+
569
+ ## Phase 6: Error Handling & Diagnostics Design
570
+
571
+ ### 6.1 Failure Mode Analysis
572
+
573
+ | Failure Mode | Category | Detection Pattern | Recovery | User Sees |
574
+ |-------------|----------|-------------------|----------|-----------|
575
+ | Settings.json not found after install | Installer bug | fs.readFileSync throws ENOENT | Test fails with "settings.json missing at {path}" | Actionable test failure |
576
+ | Hook key has wrong casing | Installer bug | `settings.hooks.SessionStart === undefined` | Test fails with "Expected PascalCase key SessionStart, not found" | Shows which key is wrong |
577
+ | Command .md file missing | Installer bug | readdirSync returns fewer than threshold | Test fails with "Expected >= 30 commands, found N" | Shows count mismatch |
578
+ | Hook references nonexistent file | Installer bug | fs.accessSync throws ENOENT | Test fails with "Hook references {path} which does not exist" | Shows exact missing file |
579
+ | Agent .md missing frontmatter | Agent file bug | Regex doesn't match | Test fails with "Agent {name} missing 'name' in frontmatter" | Shows which agent |
580
+ | State corruption in workflow | Core module bug | JSON.parse or field assertion fails | Test fails with "Expected status field in snapshot, got {actual}" | Shows state inconsistency |
581
+ | Installer fails for runtime | Environment | createScenarioRunner throws | Test describe block fails entirely | "Installer failed for {runtime}: {error}" |
582
+
583
+ ### 6.2 Diagnostic Output
584
+
585
+ All tests use standard node:test assertions with descriptive messages:
586
+ ```javascript
587
+ assert.ok(settings.hooks.SessionStart,
588
+ 'Claude settings.json missing hooks.SessionStart — installer may not be registering PascalCase keys');
589
+ ```
590
+
591
+ The assertion message IS the diagnostic — no separate diagnostic framework needed.
592
+
593
+ ---
594
+
595
+ ## Phase 7: Security & Threat Model
596
+
597
+ ### 7.1 Asset & Input Inventory
598
+
599
+ | Asset | Accessed How | Trust Level |
600
+ |-------|-------------|-------------|
601
+ | Temp directories | Created by createScenarioRunner | System-generated, trusted |
602
+ | settings.json / config.json | Read from temp installed dir | Generated by installer, trusted |
603
+ | Command .md files | Read from temp installed dir | Copied by installer, trusted |
604
+ | Agent .md files | Read from temp installed dir | Copied by installer, trusted |
605
+ | Hook .js files | Read from temp installed dir | Compiled by esbuild + copied by installer, trusted |
606
+
607
+ ### 7.2 Path Safety
608
+
609
+ - All temp dirs created via `fs.mkdtempSync` — OS-guaranteed unique
610
+ - All paths resolved relative to `runner.tmpDir` — no escape possible
611
+ - No user-supplied paths — all test paths are hardcoded or derived from RUNTIME_DIR
612
+ - Cleanup guaranteed by `after()` hooks in every describe block
613
+
614
+ ### 7.3 Output Sanitization
615
+
616
+ - [x] No absolute paths in assertion messages
617
+ - [x] No environment variables exposed
618
+ - [x] No stack traces in custom messages
619
+ - [x] Temp directories cleaned up after test
620
+
621
+ ### 7.5 Privilege Scope
622
+
623
+ ```
624
+ Reads from: temp directories (os.tmpdir()), bin/install.js (execSync)
625
+ Writes to: temp directories only
626
+ Executes shell: Yes — node bin/install.js, node pan-tools.cjs (via createScenarioRunner)
627
+ Reads outside project: No
628
+ ```
629
+
630
+ ---
631
+
632
+ ## Phase 8: Implementation Roadmap
633
+
634
+ ### 8.1 Implementation Tasks
635
+
636
+ ```
637
+ ### Task 1: Settings/config schema validation tests
638
+ Files: tests/scenarios/settings-schema.test.cjs (new)
639
+ Tests: ~12 tests (6 per runtime x 2 runtimes: Claude, Copilot)
640
+ Validates: JSON parseable, hook keys correct casing, arrays not objects,
641
+ statusLine present, hook commands non-empty, no camelCase leak in Claude,
642
+ no PascalCase leak in Copilot
643
+ Estimate: S
644
+ Priority: P2
645
+
646
+ ### Task 2: Command discoverability tests
647
+ Files: tests/scenarios/command-discovery.test.cjs (new)
648
+ Tests: ~10 tests (3-4 per runtime x 3 runtimes: Claude, Copilot, Codex)
649
+ Validates: Command dir exists, >= 30 commands, critical commands present,
650
+ no empty files, correct directory structure per runtime
651
+ Estimate: S
652
+ Priority: P2
653
+
654
+ ### Task 3: Hook registration integrity tests
655
+ Files: tests/scenarios/hook-registration.test.cjs (new)
656
+ Tests: ~10 tests (5 per runtime x 2 runtimes: Claude, Copilot)
657
+ Validates: Each hook entry references existing file, 3 expected hooks present,
658
+ no duplicate entries, hook files > 100 bytes
659
+ Estimate: S
660
+ Priority: P2
661
+
662
+ ### Task 4: Agent structure validation tests
663
+ Files: tests/scenarios/agent-structure.test.cjs (new)
664
+ Tests: ~8 tests
665
+ Validates: Agent count >= 10, frontmatter has 'name', body has <objective>,
666
+ no empty agent files, agents dir exists
667
+ Estimate: S
668
+ Priority: P3
669
+
670
+ ### Task 5: Full user workflow e2e test
671
+ Files: tests/scenarios/user-workflow-e2e.test.cjs (new)
672
+ Tests: ~10 tests (10-step workflow)
673
+ Validates: Install → config → phase add → list → state mutation → snapshot →
674
+ health check — all consistent and non-corrupting
675
+ Estimate: M
676
+ Priority: P3
677
+ ```
678
+
679
+ ### 8.2 Dependency Graph
680
+
681
+ ```
682
+ Task 1 (settings schema) ──────┐
683
+ Task 2 (command discovery) ─────┤
684
+ Task 3 (hook registration) ─────┤── All independent, can be built in parallel
685
+ Task 4 (agent structure) ───────┤
686
+ Task 5 (user workflow e2e) ─────┘
687
+ ```
688
+
689
+ All tasks depend only on `createScenarioRunner` from `tests/helpers.cjs` which already exists. No task depends on another task. All 5 can be built independently.
690
+
691
+ ### 8.3 Risk Register
692
+
693
+ | Risk | Probability | Impact | Mitigation |
694
+ |------|------------|--------|------------|
695
+ | Settings.json schema changes in future Claude Code releases | Medium | Medium | Tests document expected schema; update when Claude Code changes |
696
+ | Copilot CLI config.json format undocumented/unstable | Medium | Medium | Tests validate current known format; flag changes early |
697
+ | Agent file format changes | Low | Low | Tests use loose matching (contains key, not exact format) |
698
+ | Command count threshold too high/low | Low | Low | Use >= 30 (well below actual ~38); update if commands removed |
699
+ | Test flakiness from install timing | Low | Medium | createScenarioRunner already handles this with 30s timeout |
700
+
701
+ ### 8.4 Cognitive Complexity Budget
702
+
703
+ - Max lines per function: 50
704
+ - Max nesting depth: 3 levels
705
+ - Max parameters: 4
706
+ - All test files follow identical pattern: `before(install) → test(validate) → after(cleanup)`
707
+
708
+ ---
709
+
710
+ ## Phase 9: Test Plan
711
+
712
+ ### 9.1 Test Pyramid
713
+
714
+ | Level | Pattern | Minimum Count | What It Catches |
715
+ |-------|---------|---------------|-----------------|
716
+ | **Integration** | Settings/config schema validation | 12+ | Hook key casing, missing keys, wrong types |
717
+ | **Integration** | Command file discoverability | 10+ | Missing commands, wrong paths, empty files |
718
+ | **Integration** | Hook registration integrity | 10+ | Broken file references, missing hooks, duplicates |
719
+ | **Integration** | Agent structural validation | 8+ | Missing frontmatter, missing XML tags |
720
+ | **E2E** | Full user workflow | 10+ | State corruption, inconsistent operations, workflow breaks |
721
+
722
+ **Total new tests: ~50+**
723
+
724
+ ### 9.2 Assertion Density Requirements
725
+
726
+ Every test asserts:
727
+ - (a) Primary condition (key exists, file found, command succeeds)
728
+ - (b) Value correctness (correct casing, correct type, correct count range)
729
+ - (c) Negative condition where applicable (no wrong-cased keys, no duplicate hooks)
730
+
731
+ ### 9.3 Boundary Value Analysis
732
+
733
+ - [x] Empty settings.json before install → installer creates correct structure
734
+ - [x] Pre-existing settings.json with other hooks → PAN hooks added without removing others
735
+ - [x] Runtime with no hook support (Codex) → no settings.json expected
736
+ - [x] Agent files with minimal frontmatter (just name) → still passes
737
+ - [x] Command files with only `---` frontmatter → caught by size check (> 100 bytes)
738
+ - [x] Copilot flat hook structure vs Claude nested hook structure → both validated independently
739
+
740
+ ### 9.4 Regression Verification
741
+
742
+ - [x] All existing 1,466 tests pass unchanged
743
+ - [x] Existing 47 scenario tests pass unchanged
744
+ - [x] `npm run test:scenarios` glob includes new files automatically
745
+ - [x] No existing test expectations changed
746
+
747
+ ### 9.5 Performance Validation
748
+
749
+ - [x] Each new test file completes in < 5s
750
+ - [x] Total new test time < 10s
751
+ - [x] `npm run test:all` still completes in < 100s total
752
+ - [x] No regression in existing test suite runtime
753
+
754
+ ---
755
+
756
+ ## Phase 10: Report Summary
757
+
758
+ ### Problem & Evidence
759
+ 1,466 tests validate internals but zero tests validate the host tool integration surface — settings.json schema, command discoverability, hook registration, agent structure. User explicitly requested: "no end state user test, where the panwizard is installed into a folder opened up with VSCODE and is called via claude or copilot."
760
+
761
+ ### Investigation Depth
762
+ - Read `bin/install.js` (settings.json + config.json generation logic, lines 1520-1669)
763
+ - Read all 4 existing scenario test files (47 tests)
764
+ - Read `tests/helpers.cjs` (createScenarioRunner implementation)
765
+ - Read `install-lib.cjs` (extracted pure functions)
766
+ - Traced hook registration for Claude (PascalCase) vs Copilot (camelCase)
767
+ - Traced command file paths for all 5 runtimes
768
+
769
+ ### Strategic Assessment
770
+ - **Blue Ocean:** CREATE host-tool-contract validation — no other project tests this
771
+ - **Wardley:** Custom-built — no off-the-shelf framework for AI tool config validation
772
+ - **Moat Score:** 27/30
773
+ - **Cognitive Load:** 0 (internal tooling)
774
+ - **Recommendation:** Build — closes the last gap in the testing pyramid
775
+
776
+ ### Design Summary
777
+ - **Type:** Test infrastructure (5 new scenario test files, purely additive)
778
+ - **Modules affected:** None modified — tests read installed directories only
779
+ - **Breaking changes:** None
780
+ - **Error handling:** Descriptive assertion messages are the diagnostics
781
+
782
+ ### Feature Ladder
783
+ - **v0 (MVP):** Settings schema + command discovery + hook registration = S effort
784
+ - **v1 (Complete):** + agent structure + user workflow e2e = M effort
785
+ - **v2 (Enhanced):** + TOML/SKILL.md format validation + golden files = M effort
786
+
787
+ ### Implementation Tasks
788
+ - 5 tasks, all independent (parallelizable)
789
+ - Total: ~50 new tests across 5 files
790
+ - Zero files modified — purely additive
791
+
792
+ ### Security
793
+ - All operations in temp directories — no production risk
794
+ - No user-supplied paths — all hardcoded
795
+
796
+ ### Acceptance Criteria
797
+ - 7 criteria, 6 machine-checkable (SC-1 through SC-6), 1 regression (SC-7)
798
+
799
+ ### Documents Created
800
+ - Spec: `docs/specs/end_to_end_user_acceptance_testing_featureai.md`
801
+ - ADR: `docs/decisions/ADR-0019-end-to-end-user-acceptance-testing.md`
802
+
803
+ ### Next Step
804
+ Implement the 5 test files. Recommended order: Task 1 (settings schema) → Task 3 (hook registration) → Task 2 (command discovery) → Task 4 (agent structure) → Task 5 (user workflow e2e). Or implement all 5 in parallel since they have no dependencies on each other.
805
+
806
+ ---
807
+
808
+ ## Post-Implementation Note (2026-03-04)
809
+
810
+ All 5 tasks implemented and verified. Counts at spec time: 1,466 tests (1,419 unit + 47 scenario), 42 test files. Counts after implementation: 1,518 tests (1,419 unit + 99 scenario), 52 test files (43 unit + 9 scenario). Commit: cd86512.