pan-wizard 3.36.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.
- package/CHANGELOG.md +3645 -0
- package/README.md +36 -48
- package/agents/pan-conductor.md +2 -3
- package/agents/pan-counterfactual.md +1 -2
- package/agents/pan-debugger.md +14 -3
- package/agents/pan-design-checker.md +1 -2
- package/agents/pan-designer.md +1 -2
- package/agents/pan-document_code.md +1 -2
- package/agents/pan-hardener.md +2 -3
- package/agents/pan-integration-checker.md +1 -2
- package/agents/pan-knowledge.md +1 -2
- package/agents/pan-meta-reviewer.md +3 -3
- package/agents/pan-optimizer.md +4 -4
- package/agents/pan-phase-researcher.md +79 -488
- package/agents/pan-plan-checker.md +12 -2
- package/agents/pan-planner.md +10 -6
- package/agents/pan-previewer.md +1 -2
- package/agents/pan-project-researcher.md +70 -499
- package/agents/pan-release.md +1 -1
- package/agents/pan-reviewer.md +9 -3
- package/agents/pan-roadmapper.md +12 -7
- package/agents/pan-verifier.md +7 -2
- package/bin/install-lib.cjs +134 -14
- package/bin/install.js +59 -12
- package/commands/pan/army.md +1 -1
- package/commands/pan/autodev.md +76 -0
- package/commands/pan/exec-phase.md +3 -4
- package/commands/pan/focus-auto.md +14 -7
- package/commands/pan/focus-design.md +4 -5
- package/commands/pan/focus-docs.md +24 -0
- package/commands/pan/learn.md +13 -6
- package/commands/pan/milestone-audit.md +8 -1
- package/commands/pan/milestone-done.md +10 -5
- package/commands/pan/milestone-new.md +2 -2
- package/commands/pan/new-project.md +15 -12
- package/commands/pan/plan-phase.md +15 -9
- package/commands/pan/quick.md +1 -1
- package/commands/pan/review-deep.md +11 -5
- package/commands/pan/settings.md +6 -0
- package/commands/pan/verify-phase.md +6 -2
- package/docs/AGENTS.md +917 -0
- package/docs/ARCHITECTURE.md +1054 -0
- package/docs/CLI-REFERENCE.md +4582 -0
- package/docs/COMPARISON.md +116 -0
- package/docs/DEVELOPMENT.md +490 -0
- package/docs/ECOSYSTEM-REVIEW-2026-06.md +107 -0
- package/docs/ECOSYSTEM-REVIEW-2026-08.md +349 -0
- package/docs/EXAMPLES.md +584 -0
- package/docs/FAQ.md +254 -0
- package/docs/FIELD-HARVEST-2026-07.md +88 -0
- package/docs/FIELD-REPORT-army-2026-06.md +121 -0
- package/docs/HOOKS.md +638 -0
- package/docs/IMPROVEMENT-TODO.md +246 -0
- package/docs/INTERNALS.md +485 -0
- package/docs/MIGRATION-v2-to-v3.md +258 -0
- package/docs/SECURITY-HARDENING.md +230 -0
- package/docs/SKILLS-ENHANCEMENT-PLAN-V2.md +122 -0
- package/docs/SKILLS-FULL-TEXT.md +9685 -0
- package/docs/SKILLS-REFERENCE.md +1037 -0
- package/docs/TROUBLESHOOTING.md +1084 -0
- package/docs/USER-GUIDE.md +1437 -0
- package/docs/archive/SKILLS-ENHANCEMENT-PLAN.md +230 -0
- package/docs/audits/AUDIT-2026-08-e2e-ROADMAP.md +117 -0
- package/docs/audits/AUDIT-2026-08-e2e-VERIFICATION.md +693 -0
- package/docs/audits/AUDIT-2026-08-e2e.md +1546 -0
- package/docs/audits/OUTSTANDING-2026-08.md +275 -0
- package/docs/audits/STABILITY-TEST-2026-08.md +640 -0
- package/docs/branding/README-brand-draft.md +119 -0
- package/docs/branding/handoff/IMPLEMENTATION.md +205 -0
- package/docs/branding/handoff/README-brand-draft.md +119 -0
- package/docs/branding/handoff/image-prompts.md +46 -0
- package/docs/branding/image-prompts.md +46 -0
- package/docs/branding/nano-banana-prompts.txt +60 -0
- package/docs/context-monitor.md +13 -0
- package/docs/decisions/ADR-0001-strategic-feature-prioritization.md +83 -0
- package/docs/decisions/ADR-0002-copilot-cli-runtime.md +71 -0
- package/docs/decisions/ADR-0003-smart-execution.md +84 -0
- package/docs/decisions/ADR-0004-copilot-cli-interaction.md +89 -0
- package/docs/decisions/ADR-0005-command-naming.md +80 -0
- package/docs/decisions/ADR-0006-focus-commands.md +101 -0
- package/docs/decisions/ADR-0007-ship-v1.md +73 -0
- package/docs/decisions/ADR-0008-map-codebase-mermaid-togaf.md +80 -0
- package/docs/decisions/ADR-0009-production-deployment-checklist.md +68 -0
- package/docs/decisions/ADR-0010-standards-integration.md +79 -0
- package/docs/decisions/ADR-0011-help-commands-rewrite.md +64 -0
- package/docs/decisions/ADR-0012-contributors-attribution-index.md +42 -0
- package/docs/decisions/ADR-0013-strategic-feature-additions.md +53 -0
- package/docs/decisions/ADR-0014-internal-cleanup-code-quality.md +53 -0
- package/docs/decisions/ADR-0015-focus-auto-runner.md +296 -0
- package/docs/decisions/ADR-0016-enhanced-doc-sync.md +54 -0
- package/docs/decisions/ADR-0017-enhanced-focus-design.md +69 -0
- package/docs/decisions/ADR-0018-user-reality-testing.md +84 -0
- package/docs/decisions/ADR-0019-end-to-end-user-acceptance-testing.md +113 -0
- package/docs/decisions/ADR-0020-ai-drift-prevention.md +55 -0
- package/docs/decisions/ADR-0021-codebase-mapper-v2.md +76 -0
- package/docs/decisions/ADR-0022-lifecycle-completeness.md +63 -0
- package/docs/decisions/ADR-0023-opus-4-7-adoption.md +89 -0
- package/docs/decisions/ADR-0024-spec-b-v2-completion.md +137 -0
- package/docs/decisions/ADR-0025-behavioral-guardrails-layer.md +129 -0
- package/docs/decisions/ADR-0026-self-improvement-loop.md +171 -0
- package/docs/decisions/ADR-0027-doc-code-link-graph.md +164 -0
- package/docs/decisions/ADR-0028-unified-agents-skills-target.md +46 -0
- package/docs/decisions/ADR-0029-experiment-evaluator.md +76 -0
- package/docs/decisions/ADR-0030-planning-concurrency.md +37 -0
- package/docs/decisions/ADR-0031-focus-auto-backlog-source.md +47 -0
- package/docs/decisions/ADR-0032-squad-model.md +64 -0
- package/docs/decisions/ADR-0033-army-campaign.md +40 -0
- package/docs/decisions/ADR-0034-scheduled-campaigns.md +57 -0
- package/docs/decisions/ADR-0035-army-hud-dashboard.md +40 -0
- package/docs/decisions/ADR-0036-agentic-memory-architecture.md +106 -0
- package/docs/decisions/ADR-0037-pin-security-agents-to-opus.md +51 -0
- package/docs/decisions/ADR-0038-skill-aligned-decomposition.md +41 -0
- package/docs/decisions/ADR-0039-worktree-as-project-variant.md +37 -0
- package/docs/decisions/ADR-0040-memory-injection-defense.md +55 -0
- package/docs/decisions/ADR-0041-mcp-dual-era-bridge.md +47 -0
- package/docs/decisions/ADR-0042-design-parity-both-flows.md +45 -0
- package/docs/decisions/ADR-0043-addressable-planning-roots.md +56 -0
- package/docs/decisions/ADR-0044-bound-the-cached-context.md +104 -0
- package/docs/decisions/ADR-0045-agent-plugins-bundle.md +76 -0
- package/docs/decisions/ADR-0046-subagent-frontmatter-decisions.md +39 -0
- package/docs/decisions/ADR-0047-pan-harness.md +76 -0
- package/docs/decisions/ADR-0048-one-core-per-project.md +43 -0
- package/docs/decisions/ADR-0049-machine-verdicts-and-findings-ledger.md +116 -0
- package/docs/specs/ai_drift_prevention_featureai.md +286 -0
- package/docs/specs/codebase_mapper_v2_featureai.md +930 -0
- package/docs/specs/command_naming_optimization_featureai.md +930 -0
- package/docs/specs/comp_analysis_markdown_v1.md +149 -0
- package/docs/specs/continuous_autonomous_execution_featureai.md +304 -0
- package/docs/specs/contributors_attribution_index_featureai.md +476 -0
- package/docs/specs/copilot_cli_interaction_featureai.md +868 -0
- package/docs/specs/copilot_cli_runtime_featureai.md +647 -0
- package/docs/specs/custom-skills-assessment.md +461 -0
- package/docs/specs/deployment_audit_findings_featureai.md +243 -0
- package/docs/specs/doc_code_link_graph_featureai.md +253 -0
- package/docs/specs/documentation_alignment_cleanup_featureai.md +69 -0
- package/docs/specs/e2e_visual_testing_featureai.md +615 -0
- package/docs/specs/end_to_end_user_acceptance_testing_featureai.md +810 -0
- package/docs/specs/evidence-loop-plan.md +76 -0
- package/docs/specs/evidence_loop_featureai.md +497 -0
- package/docs/specs/focus-auto-optimize-category.md +449 -0
- package/docs/specs/focus-auto-optimize-superplan.md +188 -0
- package/docs/specs/focus_auto_runner_featureai.md +1102 -0
- package/docs/specs/focus_design_v2_featureai.md +197 -0
- package/docs/specs/focus_sync_v2_featureai.md +202 -0
- package/docs/specs/git_integration_overhaul_featureai.md +326 -0
- package/docs/specs/glm_zai_provider_featureai.md +200 -0
- package/docs/specs/googlecli_adoption_featureai.md +661 -0
- package/docs/specs/help_commands_rewrite_featureai.md +860 -0
- package/docs/specs/industry_analysis_strategic_additions_featureai.md +231 -0
- package/docs/specs/industry_comparison_and_feature_gaps_featureai.md +674 -0
- package/docs/specs/internal_cleanup_code_quality_featureai.md +486 -0
- package/docs/specs/investigations/README.md +31 -0
- package/docs/specs/investigations/digests/2026-09-28.md +47 -0
- package/docs/specs/investigations/digests/2026-10-08.md +62 -0
- package/docs/specs/investigations/digests/2026-10-10.md +61 -0
- package/docs/specs/investigations/features/debugger-red-loop-first.md +55 -0
- package/docs/specs/investigations/features/harness-cross-host-behaviour.md +93 -0
- package/docs/specs/investigations/features/optimize-apply-regression-gate.md +66 -0
- package/docs/specs/investigations/features/reviewer-smell-baseline.md +57 -0
- package/docs/specs/investigations/features/trace-failure-capture.md +69 -0
- package/docs/specs/lifecycle_completeness_featureai.md +754 -0
- package/docs/specs/local-first-ci.md +42 -0
- package/docs/specs/map_codebase_mermaid_togaf_featureai.md +805 -0
- package/docs/specs/market-delta-2026-09-superplan.md +310 -0
- package/docs/specs/market-ideas-2026-09.md +131 -0
- package/docs/specs/market-ideas-2026-10.md +428 -0
- package/docs/specs/market-ideas-ledger.md +177 -0
- package/docs/specs/memory-optimization-2026-10.md +285 -0
- package/docs/specs/multi-track-planning-roots.md +143 -0
- package/docs/specs/multi_model_routing_featureai.md +687 -0
- package/docs/specs/multi_model_routing_superplan.md +197 -0
- package/docs/specs/opus_47_existing_enhancements_featureai.md +247 -0
- package/docs/specs/opus_47_extended_features_featureai.md +363 -0
- package/docs/specs/opus_47_extended_features_v2_featureai.md +397 -0
- package/docs/specs/pan_focus_commands_featureai.md +2336 -0
- package/docs/specs/pan_zcode_mcp_bridge_featureai.md +120 -0
- package/docs/specs/product-excellence-superplan.md +315 -0
- package/docs/specs/product_excellence_program_2026_q4_featureai.md +365 -0
- package/docs/specs/production_deployment_readiness_featureai.md +433 -0
- package/docs/specs/production_readiness_ship_v1_featureai.md +698 -0
- package/docs/specs/real_test_enforcement_featureai.md +213 -0
- package/docs/specs/reality-check-2026-09-superplan.md +362 -0
- package/docs/specs/right-sized-ceremony.md +74 -0
- package/docs/specs/roadmap_and_competition_2026_q4_featureai.md +390 -0
- package/docs/specs/self_improvement_loop_featureai.md +875 -0
- package/docs/specs/skill-aligned-decomposition.md +155 -0
- package/docs/specs/standards_integration_featureai.md +833 -0
- package/docs/specs/testing-system-redesign-2026-09.md +267 -0
- package/docs/specs/user_reality_testing_system_featureai.md +788 -0
- package/docs/specs/watch-triggers.json +22 -0
- package/docs/specs/workflow-integration-redesign.md +742 -0
- package/docs/specs/workflow_state_consistency_featureai.md +183 -0
- package/hooks/dist/pan-context-monitor.js +9 -2
- package/hooks/dist/pan-cost-logger.js +5 -0
- package/hooks/dist/pan-guard.js +28 -5
- package/hooks/dist/pan-stop-guard.js +9 -9
- package/hooks/dist/pan-trace-logger.js +5 -0
- package/package.json +10 -2
- package/pan-wizard-core/bin/lib/agents-md.cjs +57 -8
- package/pan-wizard-core/bin/lib/autodev-report.cjs +180 -0
- package/pan-wizard-core/bin/lib/autodev.cjs +642 -0
- package/pan-wizard-core/bin/lib/ci.cjs +143 -0
- package/pan-wizard-core/bin/lib/commands.cjs +1 -1
- package/pan-wizard-core/bin/lib/config.cjs +31 -2
- package/pan-wizard-core/bin/lib/constants.cjs +27 -1
- package/pan-wizard-core/bin/lib/core.cjs +22 -10
- package/pan-wizard-core/bin/lib/cost.cjs +14 -4
- package/pan-wizard-core/bin/lib/cross-family.cjs +164 -0
- package/pan-wizard-core/bin/lib/debug-cases.cjs +104 -0
- package/pan-wizard-core/bin/lib/failure-class.cjs +81 -0
- package/pan-wizard-core/bin/lib/findings.cjs +34 -4
- package/pan-wizard-core/bin/lib/focus.cjs +1 -1
- package/pan-wizard-core/bin/lib/hosts.cjs +88 -0
- package/pan-wizard-core/bin/lib/init.cjs +7 -2
- package/pan-wizard-core/bin/lib/knowledge.cjs +2 -0
- package/pan-wizard-core/bin/lib/merge.cjs +50 -0
- package/pan-wizard-core/bin/lib/mutate.cjs +16 -5
- package/pan-wizard-core/bin/lib/next-action.cjs +112 -0
- package/pan-wizard-core/bin/lib/optimize.cjs +2 -2
- package/pan-wizard-core/bin/lib/phase.cjs +48 -4
- package/pan-wizard-core/bin/lib/plan-lint.cjs +150 -1
- package/pan-wizard-core/bin/lib/preview.cjs +23 -4
- package/pan-wizard-core/bin/lib/requirements-lint.cjs +130 -0
- package/pan-wizard-core/bin/lib/research-lint.cjs +150 -3
- package/pan-wizard-core/bin/lib/review-deep.cjs +14 -22
- package/pan-wizard-core/bin/lib/review-vote.cjs +105 -0
- package/pan-wizard-core/bin/lib/runner.cjs +2 -16
- package/pan-wizard-core/bin/lib/sizing.cjs +356 -0
- package/pan-wizard-core/bin/lib/squads.cjs +1 -1
- package/pan-wizard-core/bin/lib/state-write.cjs +247 -0
- package/pan-wizard-core/bin/lib/uat.cjs +149 -0
- package/pan-wizard-core/bin/lib/verdict.cjs +26 -3
- package/pan-wizard-core/bin/lib/verify-plan-set.cjs +30 -1
- package/pan-wizard-core/bin/lib/verify-preflight.cjs +2 -2
- package/pan-wizard-core/bin/lib/verify-red.cjs +37 -1
- package/pan-wizard-core/bin/lib/verify-retro.cjs +3 -2
- package/pan-wizard-core/bin/lib/verify.cjs +59 -4
- package/pan-wizard-core/bin/lib/worktree.cjs +70 -0
- package/pan-wizard-core/bin/pan-tools.cjs +168 -27
- package/pan-wizard-core/learnings/universal/autonomous-loop.md +2 -2
- package/pan-wizard-core/references/continuation-format.md +3 -3
- package/pan-wizard-core/references/guardrails.md +1 -1
- package/pan-wizard-core/references/model-profiles.md +2 -3
- package/pan-wizard-core/references/questioning.md +24 -0
- package/pan-wizard-core/references/ui-brand.md +4 -6
- package/pan-wizard-core/references/verdict-contract.md +2 -1
- package/pan-wizard-core/templates/config.json +5 -1
- package/pan-wizard-core/templates/debug.md +1 -0
- package/pan-wizard-core/templates/discovery.md +2 -2
- package/pan-wizard-core/templates/requirements.md +9 -0
- package/pan-wizard-core/workflows/add-phase.md +4 -6
- package/pan-wizard-core/workflows/assumptions.md +19 -1
- package/pan-wizard-core/workflows/diagnose-issues.md +2 -0
- package/pan-wizard-core/workflows/discuss-phase.md +4 -2
- package/pan-wizard-core/workflows/exec-lean.md +69 -0
- package/pan-wizard-core/workflows/exec-phase.md +36 -8
- package/{commands/pan → pan-wizard-core/workflows}/focus-doc-audit.md +13 -29
- package/{commands/pan → pan-wizard-core/workflows}/focus-drift-walking.md +3 -18
- package/{commands/pan → pan-wizard-core/workflows}/focus-exec.md +8 -23
- package/{commands/pan → pan-wizard-core/workflows}/focus-plan.md +6 -20
- package/{commands/pan → pan-wizard-core/workflows}/focus-scan.md +3 -16
- package/{commands/pan → pan-wizard-core/workflows}/focus-sync.md +7 -21
- package/pan-wizard-core/workflows/health.md +6 -0
- package/pan-wizard-core/workflows/help.md +31 -53
- package/pan-wizard-core/workflows/insert-phase.md +4 -6
- package/pan-wizard-core/workflows/learn.md +3 -3
- package/pan-wizard-core/workflows/milestone-audit.md +2 -2
- package/pan-wizard-core/workflows/milestone-new.md +38 -95
- package/pan-wizard-core/workflows/new-project.md +96 -258
- package/pan-wizard-core/workflows/optimize.md +107 -5
- package/pan-wizard-core/workflows/phase-tests.md +10 -0
- package/pan-wizard-core/workflows/plan-phase.md +86 -43
- package/pan-wizard-core/workflows/profile.md +50 -0
- package/pan-wizard-core/workflows/progress.md +10 -0
- package/pan-wizard-core/workflows/quick.md +34 -43
- package/pan-wizard-core/workflows/research-phase.md +118 -40
- package/pan-wizard-core/workflows/resume-project.md +18 -2
- package/pan-wizard-core/workflows/settings.md +21 -24
- package/pan-wizard-core/workflows/todo-check.md +6 -2
- package/pan-wizard-core/workflows/transition.md +22 -4
- package/pan-wizard-core/workflows/uat-walkthrough.md +90 -0
- package/pan-wizard-core/workflows/update.md +1 -1
- package/pan-wizard-core/workflows/verify-phase.md +2 -2
- package/scripts/build-agent-plugin.js +35 -15
- package/scripts/build-plugin.js +10 -1
- package/scripts/deprecate-old-versions.js +70 -3
- package/scripts/generate-skills-docs.py +1 -1
- package/scripts/git-hooks/pre-push +27 -0
- package/scripts/install-git-hooks.js +7 -5
- package/scripts/install-pre-push.cjs +38 -0
- package/scripts/land.cjs +151 -0
- package/scripts/local-ci.cjs +501 -0
- package/scripts/local-schedule.cjs +277 -0
- package/scripts/prompt-lint.cjs +32 -0
- package/scripts/prompt-rules.cjs +156 -0
- package/scripts/run-tests.cjs +7 -1
- package/scripts/test-quality-lint.cjs +3 -3
- package/scripts/test-surface.cjs +9 -2
- package/agents/pan-research-synthesizer.md +0 -246
- package/commands/pan/audit-deployment.md +0 -386
- package/commands/pan/dashboard.md +0 -22
- package/commands/pan/discord.md +0 -19
- package/commands/pan/mcp-bridge.md +0 -143
- package/commands/pan/milestone-cleanup.md +0 -19
- package/commands/pan/milestone-gaps.md +0 -35
- package/commands/pan/optimize.md +0 -115
- package/commands/pan/profile.md +0 -76
- package/commands/pan/research-phase.md +0 -189
- package/pan-wizard-core/bin/lib/bridge.cjs +0 -269
- package/pan-wizard-core/templates/research-project/architecture.md +0 -210
- package/pan-wizard-core/templates/research-project/features.md +0 -153
- package/pan-wizard-core/templates/research-project/pitfalls.md +0 -206
- package/pan-wizard-core/templates/research-project/stack.md +0 -126
- package/pan-wizard-core/templates/research-project/summary.md +0 -170
|
@@ -0,0 +1,805 @@
|
|
|
1
|
+
# Enhance map-codebase with Mermaid Diagrams & TOGAF-Aligned Structure — featureAI Specification
|
|
2
|
+
|
|
3
|
+
**Generated:** 2026-03-01
|
|
4
|
+
**Mode:** `--internal` (Phases 0, 1, 3, 3.5, 4, 5, 6, 7, 8, 9, 10 — skips Phase 2 competitive intel)
|
|
5
|
+
**Scope:** Enhance `/pan:map-codebase` to produce visual Mermaid diagrams and restructure output using TOGAF architecture layers
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Phase 0: Problem Framing & Demand Validation
|
|
10
|
+
|
|
11
|
+
### 0.1 Problem Statement
|
|
12
|
+
|
|
13
|
+
`/pan:map-codebase` currently produces 7 text-only markdown files that describe a codebase in prose. This has two limitations: (1) **No visual architecture diagrams** — developers and AI agents lose spatial understanding of system relationships, component boundaries, and data flows that diagrams communicate 10x faster than text; (2) **Ad-hoc document structure** — the current 7-file split (STACK, INTEGRATIONS, ARCHITECTURE, STRUCTURE, CONVENTIONS, TESTING, CONCERNS) was designed pragmatically but doesn't map to any standard enterprise architecture framework, making it harder to ensure coverage and communicate with stakeholders who think in architectural layers.
|
|
14
|
+
|
|
15
|
+
TOGAF's Architecture Development Method provides a proven taxonomy (Business, Application, Data, Technology architecture domains) that would give the codebase map a principled structure. Mermaid diagrams (text-based, renders natively in GitHub, VS Code, and most markdown viewers) would add visual communication without introducing any runtime dependency.
|
|
16
|
+
|
|
17
|
+
### 0.2 Demand Evidence
|
|
18
|
+
|
|
19
|
+
| Evidence Type | Source | Finding |
|
|
20
|
+
|--------------|--------|---------|
|
|
21
|
+
| Personal pain (user-stated) | This conversation | User explicitly requested: "update map-codebase to draw images of the architecture and workflows, also to break it down using TOGAF structure" |
|
|
22
|
+
| Industry standard | TOGAF 10 (The Open Group) | Most widely adopted enterprise architecture framework globally |
|
|
23
|
+
| Mermaid ubiquity | GitHub, GitLab, VS Code, Notion, Obsidian | Mermaid renders natively in all major markdown platforms — zero-friction diagrams |
|
|
24
|
+
| AI agent comprehension | Claude, Copilot, Gemini | AI models parse Mermaid diagram syntax well and can reason about system structure from diagrams |
|
|
25
|
+
|
|
26
|
+
### 0.3 Scope Definition
|
|
27
|
+
|
|
28
|
+
| In Scope | Out of Scope (and why) |
|
|
29
|
+
|----------|------------------------|
|
|
30
|
+
| Mermaid diagram blocks embedded in existing .md files | Raster image generation (PNG/SVG) — requires external tooling (`mmdc`), adds runtime dep |
|
|
31
|
+
| TOGAF-aligned document structure (4 architecture domains) | Full TOGAF ADM process (phases A-H) — overkill for codebase mapping |
|
|
32
|
+
| Updated templates for each document | New pan-tools.cjs commands — no new CLI needed |
|
|
33
|
+
| Updated mapper agent prompts to generate diagrams | C4 model diagrams — Mermaid C4 syntax is unstable; use standard flowchart/sequence instead |
|
|
34
|
+
| Updated mapper agent templates with Mermaid examples | Interactive diagram tools (D2, PlantUML) — adds dependencies |
|
|
35
|
+
| Backward compatibility (old 7-file names still work) | TOGAF metamodel, ArchiMate notation — too formal for codebase analysis |
|
|
36
|
+
|
|
37
|
+
### 0.4 Success Criteria
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
SC-1: Each ARCHITECTURE.md and STRUCTURE.md contains at least 2 Mermaid diagram blocks
|
|
41
|
+
SC-2: Documents map cleanly to TOGAF domains (Business/Application/Data/Technology)
|
|
42
|
+
SC-3: Mermaid diagrams render correctly in GitHub markdown preview
|
|
43
|
+
SC-4: No new runtime dependencies introduced
|
|
44
|
+
SC-5: All 875 existing tests pass with zero regressions
|
|
45
|
+
SC-6: Existing consumers of codebase docs (plan-phase, exec-phase) continue working
|
|
46
|
+
SC-7: Mapper agents generate diagrams autonomously (no manual editing required)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 0.5 User Stories
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
As a developer onboarding to a new project, I want visual architecture diagrams
|
|
53
|
+
in the codebase map, so that I can understand system structure in seconds
|
|
54
|
+
instead of reading 200 lines of prose.
|
|
55
|
+
|
|
56
|
+
As an architect reviewing a PAN-managed project, I want the codebase analysis
|
|
57
|
+
organized by TOGAF domains, so that I can verify coverage across all
|
|
58
|
+
architecture layers instead of guessing which ad-hoc file covers what.
|
|
59
|
+
|
|
60
|
+
As a Claude Code agent planning a phase, I want Mermaid diagrams showing
|
|
61
|
+
component relationships and data flows, so that I can generate more accurate
|
|
62
|
+
implementation plans instead of inferring structure from text descriptions.
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 0.6 Cannibalization Check
|
|
66
|
+
|
|
67
|
+
| Existing Command/Agent | Overlap? | Impact |
|
|
68
|
+
|-----------------------|----------|--------|
|
|
69
|
+
| `/pan:map-codebase` | Full — this IS the enhancement target | Enhancement, not replacement |
|
|
70
|
+
| `pan-document_code` agent | Full — agents get updated prompts | Backward-compatible update |
|
|
71
|
+
| Codebase templates (`pan-wizard-core/templates/codebase/`) | Full — templates get updated | New fields added, no fields removed |
|
|
72
|
+
|
|
73
|
+
This is an enhancement to existing capabilities, not a new command.
|
|
74
|
+
|
|
75
|
+
### 0.7 Cognitive Load Assessment
|
|
76
|
+
|
|
77
|
+
| Metric | Before | After | Delta |
|
|
78
|
+
|--------|--------|-------|-------|
|
|
79
|
+
| Commands a new user must learn | 37 | 37 | +0 |
|
|
80
|
+
| New concepts introduced | 0 | 1 (TOGAF domain mapping — but transparent to user) | +0.5 |
|
|
81
|
+
| Score | — | — | **neutral (0)** — same command, richer output |
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Phase 1: Internal Reconnaissance
|
|
86
|
+
|
|
87
|
+
### 1.1 Current System Inventory
|
|
88
|
+
|
|
89
|
+
**Workflow:** [map-codebase.md](../../pan-wizard-core/workflows/map-codebase.md) (316 lines)
|
|
90
|
+
- Orchestrates 4 parallel `pan-document_code` agents
|
|
91
|
+
- Each agent writes directly to `.planning/codebase/`
|
|
92
|
+
- Orchestrator collects confirmations (file paths + line counts), not content
|
|
93
|
+
- Includes secret scanning, commit, and next-step offering
|
|
94
|
+
|
|
95
|
+
**Agent:** [pan-document_code.md](../../agents/pan-document_code.md)
|
|
96
|
+
- 4 focus areas: `tech`, `arch`, `quality`, `concerns`
|
|
97
|
+
- Uses templates from agent definition (inline) AND from `pan-wizard-core/templates/codebase/`
|
|
98
|
+
- Explores with Read, Bash, Grep, Glob; writes with Write
|
|
99
|
+
- Has `<forbidden_files>` block (never reads .env, credentials, etc.)
|
|
100
|
+
- Returns only confirmation, not document content
|
|
101
|
+
|
|
102
|
+
**Templates:** `pan-wizard-core/templates/codebase/` (7 files)
|
|
103
|
+
- `architecture.md` — Pattern, layers, data flow, abstractions, entry points
|
|
104
|
+
- `stack.md` — Languages, runtime, frameworks, dependencies, config
|
|
105
|
+
- `structure.md` — Directory layout, key locations, naming conventions
|
|
106
|
+
- `conventions.md` — Code style, naming, imports, error handling
|
|
107
|
+
- `testing.md` — Framework, organization, mocking, fixtures, coverage
|
|
108
|
+
- `integrations.md` — APIs, databases, auth, monitoring, CI/CD
|
|
109
|
+
- `concerns.md` — Tech debt, bugs, security, performance, fragile areas
|
|
110
|
+
|
|
111
|
+
**Core module:** [init.cjs](../../pan-wizard-core/bin/lib/init.cjs) line 683
|
|
112
|
+
- `cmdInitMapCodebase()` — returns mapper_model, commit_docs, codebase_dir, existing_maps
|
|
113
|
+
- `CODEBASE_DIR = 'codebase'` in constants.cjs
|
|
114
|
+
|
|
115
|
+
**Consumers:** plan-phase and exec-phase load codebase docs based on phase type:
|
|
116
|
+
| Phase Type | Documents Loaded |
|
|
117
|
+
|------------|------------------|
|
|
118
|
+
| UI/frontend | CONVENTIONS.md, STRUCTURE.md |
|
|
119
|
+
| API/backend | ARCHITECTURE.md, CONVENTIONS.md |
|
|
120
|
+
| Database/models | ARCHITECTURE.md, STACK.md |
|
|
121
|
+
| Testing | TESTING.md, CONVENTIONS.md |
|
|
122
|
+
| Integration/external | INTEGRATIONS.md, STACK.md |
|
|
123
|
+
| Refactor/cleanup | CONCERNS.md, ARCHITECTURE.md |
|
|
124
|
+
| Setup/config | STACK.md, STRUCTURE.md |
|
|
125
|
+
|
|
126
|
+
**Key constraint:** Consumers load by filename. Renaming files would break the consumer mapping.
|
|
127
|
+
|
|
128
|
+
### 1.2 Current Diagram Usage
|
|
129
|
+
|
|
130
|
+
The entire codebase uses **zero Mermaid diagrams**. The research-project ARCHITECTURE template explicitly says "Use ASCII box-drawing diagrams" — this is the pattern being upgraded.
|
|
131
|
+
|
|
132
|
+
### 1.3 Convention Enforcement Checklist
|
|
133
|
+
|
|
134
|
+
- [x] No new functions needed in `cmd*` pattern — this changes templates and agent prompts only
|
|
135
|
+
- [x] No file reads/writes in core modules change
|
|
136
|
+
- [x] No new JSON output formats
|
|
137
|
+
- [x] No new CLI commands
|
|
138
|
+
- [x] Zero runtime dependencies maintained (Mermaid is text, not a dependency)
|
|
139
|
+
- [x] CommonJS module format preserved
|
|
140
|
+
|
|
141
|
+
### 1.4 Dependency & Integration Map
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
[This Enhancement]
|
|
145
|
+
├── modifies: pan-document_code agent (prompts + templates)
|
|
146
|
+
├── modifies: pan-wizard-core/templates/codebase/*.md (7 templates)
|
|
147
|
+
├── modifies: pan-wizard-core/workflows/map-codebase.md (agent prompts)
|
|
148
|
+
├── preserves: init.cjs cmdInitMapCodebase() — unchanged
|
|
149
|
+
├── preserves: constants.cjs CODEBASE_DIR — unchanged
|
|
150
|
+
├── preserves: all 7 filenames (ARCHITECTURE.md, etc.) — consumer compatibility
|
|
151
|
+
├── conflicts with: nothing
|
|
152
|
+
└── enables: richer context for plan-phase and exec-phase agents
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Phase 3: Strategic Analysis
|
|
158
|
+
|
|
159
|
+
### 3.1 Blue Ocean Four Actions Framework
|
|
160
|
+
|
|
161
|
+
| Action | Decision |
|
|
162
|
+
|--------|----------|
|
|
163
|
+
| **ELIMINATE** | ASCII box-drawing diagrams (replaced by Mermaid which renders natively) |
|
|
164
|
+
| **REDUCE** | Prose descriptions of relationships (diagrams show this better) |
|
|
165
|
+
| **RAISE** | Visual communication quality, architecture coverage completeness |
|
|
166
|
+
| **CREATE** | TOGAF-aligned layer taxonomy, standardized diagram types per document |
|
|
167
|
+
|
|
168
|
+
### 3.2 Wardley Evolution Assessment
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
Genesis ──── Custom-Built ──── Product ──── Commodity
|
|
172
|
+
↑
|
|
173
|
+
Mermaid diagrams
|
|
174
|
+
(commodity — text-to-diagram)
|
|
175
|
+
↑
|
|
176
|
+
TOGAF structure
|
|
177
|
+
(product — well-known framework)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Both components are mature. We're adopting commoditized tools, not inventing new ones.
|
|
181
|
+
|
|
182
|
+
### 3.3 Strategic Moat Analysis
|
|
183
|
+
|
|
184
|
+
| Moat Type | Contribution | Score (0-5) |
|
|
185
|
+
|-----------|-------------|-------------|
|
|
186
|
+
| **Context Engineering** | Diagrams give AI agents spatial understanding of codebases | 5 |
|
|
187
|
+
| **Cross-Platform** | Mermaid renders in GitHub, VS Code, all markdown viewers | 5 |
|
|
188
|
+
| **Developer Experience** | Visual > text for architecture comprehension | 4 |
|
|
189
|
+
| **Zero Dependencies** | Mermaid is text, not a dependency | 5 |
|
|
190
|
+
| **State Persistence** | Diagrams persist in .planning/ across sessions | 4 |
|
|
191
|
+
| **Verification Quality** | TOGAF ensures no architecture layer is missed | 4 |
|
|
192
|
+
| **Total** | | **27/30** |
|
|
193
|
+
|
|
194
|
+
### 3.4 Strategic Recommendation
|
|
195
|
+
|
|
196
|
+
**Build — enhance map-codebase with Mermaid diagrams and TOGAF-aligned sections.** This is a pure quality improvement with zero new dependencies, zero new commands, and zero breaking changes. The unique angle is that no competing AI workflow tool produces structured architecture diagrams automatically. Mermaid syntax is already well-understood by Claude, so the mapper agents can generate high-quality diagrams without new tooling. The TOGAF alignment provides principled coverage that ad-hoc document structures cannot guarantee.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Phase 3.5: Architecture & Implementation Assessment
|
|
201
|
+
|
|
202
|
+
### 3.5.1 Feature Type Classification
|
|
203
|
+
|
|
204
|
+
**Core Enhancement** — modifies existing templates and agent prompts. No new modules, commands, or agents.
|
|
205
|
+
|
|
206
|
+
### 3.5.2 Layer Violation Check
|
|
207
|
+
|
|
208
|
+
- [x] No command .md files change CLI routing
|
|
209
|
+
- [x] No core modules gain new dependencies
|
|
210
|
+
- [x] No upward dependencies introduced
|
|
211
|
+
- [x] Agent prompts only reference Write tool (existing pattern)
|
|
212
|
+
|
|
213
|
+
### 3.5.3 Output Contract Design
|
|
214
|
+
|
|
215
|
+
No JSON output changes. The `cmdInitMapCodebase()` output is unchanged. The only change is the *content* of the `.planning/codebase/*.md` files written by agents.
|
|
216
|
+
|
|
217
|
+
### 3.5.4 State Transition Modeling
|
|
218
|
+
|
|
219
|
+
No state file mutations. `.planning/codebase/` files are overwritten on each mapping run.
|
|
220
|
+
|
|
221
|
+
### 3.5.5 Breaking Change Assessment
|
|
222
|
+
|
|
223
|
+
| Question | Answer |
|
|
224
|
+
|----------|--------|
|
|
225
|
+
| Changes any existing command's output schema? | **No** |
|
|
226
|
+
| Changes file formats? | **Yes — content within existing .md files** (sections added, no sections removed) |
|
|
227
|
+
| Changes directory structure? | **No** — same 7 filenames in same directory |
|
|
228
|
+
| Changes installer output? | **No** |
|
|
229
|
+
|
|
230
|
+
**Migration:** None needed. New content is additive. Consumers load files by name, not by section heading. Adding Mermaid blocks and TOGAF sections won't break any existing consumer.
|
|
231
|
+
|
|
232
|
+
### 3.5.6 TOGAF Domain → Document Mapping
|
|
233
|
+
|
|
234
|
+
**The key design decision:** How to map TOGAF's 4 architecture domains onto the existing 7 documents WITHOUT renaming files (which would break consumers).
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
TOGAF Domain Current Documents TOGAF Section Added
|
|
238
|
+
───────────────────── ──────────────────── ───────────────────
|
|
239
|
+
Business Architecture → (not covered — NEW) → Added as section in ARCHITECTURE.md
|
|
240
|
+
Application Arch. → ARCHITECTURE.md → Existing content restructured
|
|
241
|
+
STRUCTURE.md under "Application Architecture"
|
|
242
|
+
Data Architecture → INTEGRATIONS.md → Added "Data Architecture" section
|
|
243
|
+
(partially in STACK.md) with entity diagrams
|
|
244
|
+
Technology Architecture→ STACK.md → Existing content + deployment diagram
|
|
245
|
+
INTEGRATIONS.md under "Technology Architecture"
|
|
246
|
+
Cross-Cutting → CONVENTIONS.md → Unchanged (already cross-cutting)
|
|
247
|
+
TESTING.md Unchanged
|
|
248
|
+
CONCERNS.md Unchanged (risk/debt register)
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### 3.5.7 Diagram Types Per Document
|
|
252
|
+
|
|
253
|
+
| Document | Diagram Type | Mermaid Syntax | What It Shows |
|
|
254
|
+
|----------|-------------|----------------|---------------|
|
|
255
|
+
| ARCHITECTURE.md | **Flowchart (LR)** | `graph LR` | Layer dependencies, component relationships |
|
|
256
|
+
| ARCHITECTURE.md | **Sequence diagram** | `sequenceDiagram` | Primary data flow / request lifecycle |
|
|
257
|
+
| STRUCTURE.md | **Flowchart (TD)** | `graph TD` | Directory tree as visual hierarchy |
|
|
258
|
+
| INTEGRATIONS.md | **Flowchart** | `graph LR` | External service connections |
|
|
259
|
+
| INTEGRATIONS.md | **ER diagram** | `erDiagram` | Data entity relationships (if DB detected) |
|
|
260
|
+
| STACK.md | **Flowchart** | `graph TD` | Deployment/infrastructure topology |
|
|
261
|
+
| CONCERNS.md | **Quadrant chart** | `quadrantChart` | Risk impact vs probability |
|
|
262
|
+
| TESTING.md | *(none — text is sufficient)* | — | — |
|
|
263
|
+
| CONVENTIONS.md | *(none — text is sufficient)* | — | — |
|
|
264
|
+
|
|
265
|
+
**Minimum: 5 diagrams across 4 files. Maximum: 8 diagrams across 5 files.**
|
|
266
|
+
|
|
267
|
+
### 3.5.8 Performance Budget
|
|
268
|
+
|
|
269
|
+
| Operation | Cost | Notes |
|
|
270
|
+
|-----------|------|-------|
|
|
271
|
+
| Mapper agent Mermaid generation | ~0ms | Text generation, no computation |
|
|
272
|
+
| Template changes | 0ms | Static markdown files |
|
|
273
|
+
| Consumer impact | 0ms | Consumers ignore Mermaid blocks (just markdown) |
|
|
274
|
+
| **Total** | **+0ms** | Pure content change, no runtime cost |
|
|
275
|
+
|
|
276
|
+
### 3.5.9 Cross-Platform Considerations
|
|
277
|
+
|
|
278
|
+
| Platform | Consideration |
|
|
279
|
+
|----------|---------------|
|
|
280
|
+
| GitHub | Mermaid renders natively in markdown preview since 2022 |
|
|
281
|
+
| VS Code | Mermaid renders with built-in markdown preview or Mermaid extension |
|
|
282
|
+
| GitLab | Native Mermaid rendering in markdown |
|
|
283
|
+
| Obsidian | Native Mermaid rendering |
|
|
284
|
+
| Raw terminal | Mermaid blocks display as text (graceful degradation — still readable) |
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Phase 4: Design Synthesis
|
|
289
|
+
|
|
290
|
+
### 4.1 Guide-Level Explanation
|
|
291
|
+
|
|
292
|
+
**Enhanced Codebase Mapping with Visual Diagrams**
|
|
293
|
+
|
|
294
|
+
When you run `/pan:map-codebase`, the system now produces the same 7 documents but with **embedded Mermaid architecture diagrams** and **TOGAF-aligned sections**.
|
|
295
|
+
|
|
296
|
+
**Example: ARCHITECTURE.md now includes:**
|
|
297
|
+
|
|
298
|
+
````markdown
|
|
299
|
+
## Application Architecture
|
|
300
|
+
|
|
301
|
+
### Component Relationships
|
|
302
|
+
|
|
303
|
+
```mermaid
|
|
304
|
+
graph LR
|
|
305
|
+
CLI[CLI Entry] --> Dispatcher[pan-tools.cjs]
|
|
306
|
+
Dispatcher --> State[state.cjs]
|
|
307
|
+
Dispatcher --> Phase[phase.cjs]
|
|
308
|
+
Dispatcher --> Config[config.cjs]
|
|
309
|
+
Phase --> Core[core.cjs]
|
|
310
|
+
State --> Core
|
|
311
|
+
Core --> Utils[utils.cjs]
|
|
312
|
+
Core --> Constants[constants.cjs]
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Request Lifecycle
|
|
316
|
+
|
|
317
|
+
```mermaid
|
|
318
|
+
sequenceDiagram
|
|
319
|
+
participant U as User
|
|
320
|
+
participant C as Command .md
|
|
321
|
+
participant A as Agent
|
|
322
|
+
participant P as pan-tools.cjs
|
|
323
|
+
participant L as lib/*.cjs
|
|
324
|
+
U->>C: /pan:plan-phase 1
|
|
325
|
+
C->>A: spawn pan-planner
|
|
326
|
+
A->>P: node pan-tools.cjs find-phase 1
|
|
327
|
+
P->>L: phase.cjs → cmdFindPhase()
|
|
328
|
+
L-->>P: {directory, name, status}
|
|
329
|
+
P-->>A: JSON result
|
|
330
|
+
A->>A: Create plan.md
|
|
331
|
+
A-->>C: Plan complete
|
|
332
|
+
C-->>U: Phase 1 planned
|
|
333
|
+
```
|
|
334
|
+
````
|
|
335
|
+
|
|
336
|
+
**These diagrams render as visual graphics** in GitHub, VS Code, and any Mermaid-aware markdown viewer. In plain terminals, they display as readable text.
|
|
337
|
+
|
|
338
|
+
**TOGAF alignment** means each document now has clear sections mapping to architecture domains:
|
|
339
|
+
- **Business Architecture** (what the system does) — in ARCHITECTURE.md
|
|
340
|
+
- **Application Architecture** (how components interact) — in ARCHITECTURE.md + STRUCTURE.md
|
|
341
|
+
- **Data Architecture** (entities, storage, flows) — in INTEGRATIONS.md
|
|
342
|
+
- **Technology Architecture** (stack, deployment, infrastructure) — in STACK.md
|
|
343
|
+
|
|
344
|
+
**What does NOT change:**
|
|
345
|
+
- Same 7 filenames (backward compatible)
|
|
346
|
+
- Same 4 mapper agents
|
|
347
|
+
- Same workflow (orchestrator spawns agents, collects confirmations)
|
|
348
|
+
- Same consumers work unchanged
|
|
349
|
+
|
|
350
|
+
### 4.2 Reference-Level Explanation
|
|
351
|
+
|
|
352
|
+
#### 4.2.1 Files Modified
|
|
353
|
+
|
|
354
|
+
| File | Change Type | Description |
|
|
355
|
+
|------|------------|-------------|
|
|
356
|
+
| `pan-wizard-core/templates/codebase/architecture.md` | Major update | Add TOGAF sections, Mermaid flowchart + sequence diagram examples |
|
|
357
|
+
| `pan-wizard-core/templates/codebase/structure.md` | Minor update | Add Mermaid directory tree diagram example |
|
|
358
|
+
| `pan-wizard-core/templates/codebase/stack.md` | Minor update | Add "Technology Architecture" TOGAF header, deployment diagram example |
|
|
359
|
+
| `pan-wizard-core/templates/codebase/integrations.md` | Moderate update | Add "Data Architecture" section, ER diagram example |
|
|
360
|
+
| `pan-wizard-core/templates/codebase/concerns.md` | Minor update | Add risk quadrant chart example |
|
|
361
|
+
| `pan-wizard-core/templates/codebase/conventions.md` | No change | Already cross-cutting, diagrams not useful here |
|
|
362
|
+
| `pan-wizard-core/templates/codebase/testing.md` | No change | Test patterns are better as text |
|
|
363
|
+
| `.claude/agents/pan-document_code.md` | Moderate update | Add Mermaid generation instructions to agent prompts |
|
|
364
|
+
| `pan-wizard-core/workflows/map-codebase.md` | Minor update | Update agent prompts to mention diagram generation |
|
|
365
|
+
|
|
366
|
+
#### 4.2.2 Mermaid Syntax Standards
|
|
367
|
+
|
|
368
|
+
All diagrams must follow these conventions for consistency:
|
|
369
|
+
|
|
370
|
+
```
|
|
371
|
+
1. Use descriptive node IDs: `Auth[Authentication]` not `A[Authentication]`
|
|
372
|
+
2. Use LR (left-right) for dependency/flow diagrams
|
|
373
|
+
3. Use TD (top-down) for hierarchy/tree diagrams
|
|
374
|
+
4. Use sequenceDiagram for request lifecycles
|
|
375
|
+
5. Use erDiagram for data relationships (only when DB/ORM detected)
|
|
376
|
+
6. Use quadrantChart for risk assessment (concerns only)
|
|
377
|
+
7. Maximum 15 nodes per diagram (beyond that, split into multiple)
|
|
378
|
+
8. Always include a "### [Diagram Title]" heading before each ```mermaid block
|
|
379
|
+
9. Wrap diagram in standard markdown code fence: ```mermaid ... ```
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
#### 4.2.3 TOGAF Section Structure
|
|
383
|
+
|
|
384
|
+
Each document gets a TOGAF domain header where appropriate:
|
|
385
|
+
|
|
386
|
+
```markdown
|
|
387
|
+
## Business Architecture
|
|
388
|
+
<!-- What the system does, capabilities, user-facing processes -->
|
|
389
|
+
|
|
390
|
+
## Application Architecture
|
|
391
|
+
<!-- How components interact, layers, abstractions -->
|
|
392
|
+
|
|
393
|
+
## Data Architecture
|
|
394
|
+
<!-- Entities, storage, data flows, schemas -->
|
|
395
|
+
|
|
396
|
+
## Technology Architecture
|
|
397
|
+
<!-- Stack, deployment, infrastructure, runtime -->
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
Not every document needs all 4 sections. The mapping in 3.5.6 shows which domain goes where.
|
|
401
|
+
|
|
402
|
+
### 4.3 Design Decisions
|
|
403
|
+
|
|
404
|
+
| Decision | Rationale | What We Did NOT Do |
|
|
405
|
+
|----------|-----------|-------------------|
|
|
406
|
+
| Mermaid (not PlantUML) | Renders natively in GitHub/VS Code, no Java dep | Did not use PlantUML (requires Java runtime) |
|
|
407
|
+
| Mermaid (not D2) | Wider rendering support, AI models understand it better | Did not use D2 (fewer renderers) |
|
|
408
|
+
| Embedded in .md (not separate .mmd files) | Single-file consumption, no extra tooling | Did not create separate diagram files |
|
|
409
|
+
| TOGAF sections (not full TOGAF ADM) | Lightweight taxonomy, not heavy process | Did not implement ArchiMate notation |
|
|
410
|
+
| Same 7 filenames | Backward compatibility with consumers | Did not rename files to TOGAF domains |
|
|
411
|
+
| No image generation | Zero dependency constraint | Did not add mmdc/d2 as dependencies |
|
|
412
|
+
|
|
413
|
+
### 4.4 Drawbacks & Alternatives
|
|
414
|
+
|
|
415
|
+
| Decision Point | Chosen | Alternative | Why Not | Drawback of Chosen |
|
|
416
|
+
|----------------|--------|------------|---------|-------------------|
|
|
417
|
+
| Diagram format | Mermaid text in markdown | PNG/SVG image files | Adds runtime dep (mmdc) | Diagrams are text-only in terminals |
|
|
418
|
+
| TOGAF mapping | Sections within existing files | New file per TOGAF domain | Breaks consumer compatibility | TOGAF purists may want separate files |
|
|
419
|
+
| Diagram count | 5-8 per mapping | 1 per document (minimal) | Misses cross-document relationships | More content for agents to generate |
|
|
420
|
+
| Template approach | Updated templates + agent prompts | New "diagram-only" agent | Over-engineering for a content change | All mapping agents need updating |
|
|
421
|
+
|
|
422
|
+
### 4.5 Feature Ladder
|
|
423
|
+
|
|
424
|
+
| Version | Scope | Value Delivered | Effort |
|
|
425
|
+
|---------|-------|----------------|--------|
|
|
426
|
+
| **v0 (MVP)** | Add Mermaid diagram examples to 4 templates + update agent prompts | Agents generate diagrams automatically | **S** |
|
|
427
|
+
| **v1 (Complete)** | TOGAF section headers + diagram standards + all 7 templates reviewed | Full TOGAF-aligned output with visual diagrams | **M** |
|
|
428
|
+
| **v2 (Enhanced)** | Optional `--render` flag that runs mmdc to produce PNG/SVG alongside markdown | Image files for presentations/docs | **L** (adds optional dep) |
|
|
429
|
+
|
|
430
|
+
### 4.6 Adoption Analysis
|
|
431
|
+
|
|
432
|
+
| Question | Answer |
|
|
433
|
+
|----------|--------|
|
|
434
|
+
| How does the user discover this? | Same `/pan:map-codebase` command — output is automatically richer |
|
|
435
|
+
| What's the learning curve? | Zero — diagrams appear in existing files |
|
|
436
|
+
| Does it require changing existing workflows? | No — drop-in enhancement |
|
|
437
|
+
| What's the "aha moment"? | Opening ARCHITECTURE.md in GitHub/VS Code and seeing rendered diagrams |
|
|
438
|
+
|
|
439
|
+
---
|
|
440
|
+
|
|
441
|
+
## Phase 5: Architecture Decision Record
|
|
442
|
+
|
|
443
|
+
```markdown
|
|
444
|
+
# ADR-0008: Enhance map-codebase with Mermaid Diagrams and TOGAF Structure
|
|
445
|
+
|
|
446
|
+
## Status
|
|
447
|
+
Proposed
|
|
448
|
+
|
|
449
|
+
## Context
|
|
450
|
+
/pan:map-codebase produces 7 text-only markdown files describing a codebase.
|
|
451
|
+
Developers and AI agents struggle to quickly understand system structure from
|
|
452
|
+
prose alone. Visual diagrams communicate architecture 10x faster than text.
|
|
453
|
+
The current 7-file structure was designed pragmatically without mapping to any
|
|
454
|
+
standard architecture framework.
|
|
455
|
+
|
|
456
|
+
## Decision
|
|
457
|
+
1. Add Mermaid diagram blocks to 5 of 7 codebase document templates
|
|
458
|
+
2. Restructure document sections to align with TOGAF architecture domains
|
|
459
|
+
3. Keep all 7 existing filenames unchanged (backward compatibility)
|
|
460
|
+
4. Update mapper agent prompts to generate diagrams as part of exploration
|
|
461
|
+
|
|
462
|
+
Mermaid was chosen over PlantUML (requires Java), D2 (fewer renderers), and
|
|
463
|
+
PNG generation (would add runtime dependency). Mermaid renders natively in
|
|
464
|
+
GitHub, VS Code, GitLab, and Obsidian.
|
|
465
|
+
|
|
466
|
+
## Consequences
|
|
467
|
+
|
|
468
|
+
### Positive
|
|
469
|
+
- Visual architecture diagrams generated automatically by mapper agents
|
|
470
|
+
- TOGAF alignment ensures no architecture layer is accidentally omitted
|
|
471
|
+
- Renders in GitHub markdown preview — zero additional tooling
|
|
472
|
+
- AI agents can parse Mermaid syntax for better planning
|
|
473
|
+
- Zero new runtime dependencies
|
|
474
|
+
|
|
475
|
+
### Negative
|
|
476
|
+
- Mapper agents use slightly more tokens generating diagrams (~10-15% more per agent)
|
|
477
|
+
- Diagrams show as text in plain terminals (graceful degradation)
|
|
478
|
+
- Template changes require updating installed instances via /pan:update
|
|
479
|
+
|
|
480
|
+
### Neutral
|
|
481
|
+
- Existing consumers (plan-phase, exec-phase) continue working unchanged
|
|
482
|
+
- Same 4 mapper agents, same workflow, same filenames
|
|
483
|
+
|
|
484
|
+
## Options Considered
|
|
485
|
+
1. PNG/SVG generation with mmdc CLI — rejected (adds runtime dependency)
|
|
486
|
+
2. Separate .mmd diagram files — rejected (consumers load .md files by name)
|
|
487
|
+
3. PlantUML — rejected (requires Java runtime)
|
|
488
|
+
4. Mermaid in existing markdown — chosen (zero deps, native rendering)
|
|
489
|
+
5. Full TOGAF ADM process — rejected (too heavyweight for codebase mapping)
|
|
490
|
+
6. TOGAF domain sections in existing files — chosen (lightweight, backward-compatible)
|
|
491
|
+
|
|
492
|
+
## Links
|
|
493
|
+
- Spec: docs/specs/map_codebase_mermaid_togaf_featureai.md
|
|
494
|
+
- Current workflow: pan-wizard-core/workflows/map-codebase.md
|
|
495
|
+
- Current agent: .claude/agents/pan-document_code.md
|
|
496
|
+
- Templates: pan-wizard-core/templates/codebase/*.md
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
---
|
|
500
|
+
|
|
501
|
+
## Phase 6: Error Handling & Diagnostics Design
|
|
502
|
+
|
|
503
|
+
### 6.1 Failure Mode Analysis
|
|
504
|
+
|
|
505
|
+
| Failure Mode | Category | Detection | Recovery | User Sees |
|
|
506
|
+
|-------------|----------|-----------|----------|-----------|
|
|
507
|
+
| Agent generates invalid Mermaid syntax | AI generation error | GitHub/VS Code shows syntax error in preview | User manually fixes or re-runs mapping | Raw Mermaid text with error annotation |
|
|
508
|
+
| Agent skips diagram generation | AI instruction-following | Document has no ```mermaid blocks | Template examples guide the agent; re-run with explicit prompt | Text-only document (graceful degradation) |
|
|
509
|
+
| Mermaid renderer not available | Environment | Terminal-only viewing | Text blocks are still readable | ```mermaid blocks display as text |
|
|
510
|
+
| Template file corrupted during install | Installer error | Agent falls back to inline templates | Agent has templates in its own prompt | Slightly different format |
|
|
511
|
+
|
|
512
|
+
### 6.2 Diagnostic Support
|
|
513
|
+
|
|
514
|
+
| Diagnostic | How | When |
|
|
515
|
+
|------------|-----|------|
|
|
516
|
+
| Verify diagrams present | `grep -c 'mermaid' .planning/codebase/*.md` | After mapping |
|
|
517
|
+
| Validate Mermaid syntax | Paste into mermaid.live | Manual verification |
|
|
518
|
+
| Count diagrams per doc | `grep -c '```mermaid' .planning/codebase/ARCHITECTURE.md` | After mapping |
|
|
519
|
+
|
|
520
|
+
---
|
|
521
|
+
|
|
522
|
+
## Phase 7: Security & Threat Model
|
|
523
|
+
|
|
524
|
+
### 7.1 Asset & Attack Surface
|
|
525
|
+
|
|
526
|
+
| Asset | Accessed How | Trust Level |
|
|
527
|
+
|-------|-------------|-------------|
|
|
528
|
+
| Codebase source files | Read by mapper agents | User-controlled |
|
|
529
|
+
| `.planning/codebase/*.md` output | Written by mapper agents | System-generated |
|
|
530
|
+
| Mermaid diagram content | Generated from codebase analysis | System-generated from user code |
|
|
531
|
+
|
|
532
|
+
### 7.2 Mermaid Injection Risk
|
|
533
|
+
|
|
534
|
+
**Threat:** Could Mermaid syntax in generated documents execute code?
|
|
535
|
+
|
|
536
|
+
**Analysis:** Mermaid is a **declarative diagramming language**. It does not execute code. GitHub's Mermaid renderer is sandboxed. VS Code's preview is sandboxed. There is no injection vector from Mermaid syntax.
|
|
537
|
+
|
|
538
|
+
**However:** Mermaid `click` callbacks exist in the spec but are disabled by default in all major renderers. Our templates should **never** include `click` directives.
|
|
539
|
+
|
|
540
|
+
### 7.3 Secret Exposure in Diagrams
|
|
541
|
+
|
|
542
|
+
**Existing mitigation:** The mapper agent already has a `<forbidden_files>` block preventing reading .env, credentials, keys. The workflow already runs a secret scan (`grep -E` for API key patterns) before committing.
|
|
543
|
+
|
|
544
|
+
**New consideration:** Diagrams could accidentally include:
|
|
545
|
+
- Database connection strings in ER diagram labels
|
|
546
|
+
- API endpoint URLs with embedded tokens
|
|
547
|
+
|
|
548
|
+
**Mitigation:** Add explicit instruction to agent prompt: "Never include actual credentials, connection strings, or API keys in Mermaid diagram labels. Use generic labels like 'PostgreSQL DB' not 'postgres://user:pass@host/db'."
|
|
549
|
+
|
|
550
|
+
### 7.4 Output Sanitization
|
|
551
|
+
|
|
552
|
+
- [x] No absolute paths in diagrams (use relative paths or component names)
|
|
553
|
+
- [x] No environment variable values in diagram labels
|
|
554
|
+
- [x] No API keys or tokens in diagram labels
|
|
555
|
+
- [x] Existing secret scan still runs before commit
|
|
556
|
+
|
|
557
|
+
---
|
|
558
|
+
|
|
559
|
+
## Phase 8: Implementation Roadmap
|
|
560
|
+
|
|
561
|
+
### 8.1 Implementation Tasks
|
|
562
|
+
|
|
563
|
+
```
|
|
564
|
+
### Task 1: Update ARCHITECTURE.md template
|
|
565
|
+
Files: pan-wizard-core/templates/codebase/architecture.md
|
|
566
|
+
Changes:
|
|
567
|
+
- Add TOGAF "Business Architecture" section (capabilities, user processes)
|
|
568
|
+
- Restructure existing content under "Application Architecture"
|
|
569
|
+
- Add Mermaid flowchart example (component relationships)
|
|
570
|
+
- Add Mermaid sequence diagram example (request lifecycle)
|
|
571
|
+
- Update good_examples section with Mermaid
|
|
572
|
+
Estimate: S
|
|
573
|
+
Priority: P0
|
|
574
|
+
|
|
575
|
+
### Task 2: Update STRUCTURE.md template
|
|
576
|
+
Files: pan-wizard-core/templates/codebase/structure.md (in agent)
|
|
577
|
+
Changes:
|
|
578
|
+
- Add Mermaid graph TD example (directory hierarchy diagram)
|
|
579
|
+
- Keep existing directory listing format as complement
|
|
580
|
+
Estimate: XS
|
|
581
|
+
Priority: P0
|
|
582
|
+
|
|
583
|
+
### Task 3: Update STACK.md template
|
|
584
|
+
Files: pan-wizard-core/templates/codebase/stack.md
|
|
585
|
+
Changes:
|
|
586
|
+
- Add "Technology Architecture" TOGAF header
|
|
587
|
+
- Add Mermaid flowchart example (deployment/infrastructure topology)
|
|
588
|
+
Estimate: XS
|
|
589
|
+
Priority: P0
|
|
590
|
+
|
|
591
|
+
### Task 4: Update INTEGRATIONS.md template
|
|
592
|
+
Files: pan-wizard-core/templates/codebase/integrations.md
|
|
593
|
+
Changes:
|
|
594
|
+
- Add "Data Architecture" TOGAF section
|
|
595
|
+
- Add Mermaid ER diagram example (entity relationships, only when DB detected)
|
|
596
|
+
- Add Mermaid flowchart example (external service connections)
|
|
597
|
+
Estimate: S
|
|
598
|
+
Priority: P0
|
|
599
|
+
|
|
600
|
+
### Task 5: Update CONCERNS.md template
|
|
601
|
+
Files: pan-wizard-core/templates/codebase/concerns.md
|
|
602
|
+
Changes:
|
|
603
|
+
- Add Mermaid quadrant chart example (risk impact vs probability)
|
|
604
|
+
Estimate: XS
|
|
605
|
+
Priority: P1
|
|
606
|
+
|
|
607
|
+
### Task 6: Update pan-document_code agent
|
|
608
|
+
Files: .claude/agents/pan-document_code.md (+ all runtime copies)
|
|
609
|
+
Changes:
|
|
610
|
+
- Add <diagram_guidelines> section with Mermaid syntax standards
|
|
611
|
+
- Add "MUST generate at least 1 Mermaid diagram per document" rule
|
|
612
|
+
- Add security rule: "Never include credentials in diagram labels"
|
|
613
|
+
- Update inline templates to match updated template files
|
|
614
|
+
- Add Mermaid examples for each focus area
|
|
615
|
+
Estimate: M
|
|
616
|
+
Priority: P0
|
|
617
|
+
|
|
618
|
+
### Task 7: Update map-codebase workflow agent prompts
|
|
619
|
+
Files: pan-wizard-core/workflows/map-codebase.md
|
|
620
|
+
Changes:
|
|
621
|
+
- Update agent spawn prompts to mention diagram generation
|
|
622
|
+
- Add note about TOGAF-aligned sections
|
|
623
|
+
Estimate: XS
|
|
624
|
+
Priority: P1
|
|
625
|
+
|
|
626
|
+
### Task 8: Update installer to copy updated templates
|
|
627
|
+
Files: bin/install.js (if templates are copied during install)
|
|
628
|
+
Verify: Updated templates ship with new install/update
|
|
629
|
+
Estimate: XS
|
|
630
|
+
Priority: P1
|
|
631
|
+
|
|
632
|
+
### Task 9: Tests — template validation
|
|
633
|
+
Files: tests/map-codebase.test.cjs (new) or add to existing test file
|
|
634
|
+
Tests:
|
|
635
|
+
- Each template file contains at least one ```mermaid code fence
|
|
636
|
+
- Each template file contains TOGAF domain headers where expected
|
|
637
|
+
- Agent definition contains diagram_guidelines section
|
|
638
|
+
- No ```mermaid block contains 'click' directive
|
|
639
|
+
Estimate: S
|
|
640
|
+
Priority: P0
|
|
641
|
+
|
|
642
|
+
### Task 10: Documentation
|
|
643
|
+
Files: docs/USER-GUIDE.md, docs/ARCHITECTURE.md, CHANGELOG.md
|
|
644
|
+
Changes:
|
|
645
|
+
- Note Mermaid diagram support in map-codebase section
|
|
646
|
+
- Mention TOGAF alignment in architecture docs
|
|
647
|
+
- CHANGELOG entry
|
|
648
|
+
Estimate: XS
|
|
649
|
+
Priority: P2
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
### 8.2 Dependency Graph
|
|
653
|
+
|
|
654
|
+
```
|
|
655
|
+
Task 1 (ARCHITECTURE template) ─┐
|
|
656
|
+
Task 2 (STRUCTURE template) ────┤
|
|
657
|
+
Task 3 (STACK template) ────────┤ (all parallel, independent)
|
|
658
|
+
Task 4 (INTEGRATIONS template) ─┤
|
|
659
|
+
Task 5 (CONCERNS template) ─────┘
|
|
660
|
+
│
|
|
661
|
+
▼
|
|
662
|
+
Task 6 (Update agent) ── depends on templates being finalized
|
|
663
|
+
│
|
|
664
|
+
▼
|
|
665
|
+
Task 7 (Update workflow) ── depends on agent update
|
|
666
|
+
│
|
|
667
|
+
▼
|
|
668
|
+
Task 8 (Installer check) ─┐
|
|
669
|
+
Task 9 (Tests) ────────────┤ (parallel)
|
|
670
|
+
Task 10 (Docs) ────────────┘
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
### 8.3 Risk Register
|
|
674
|
+
|
|
675
|
+
| Risk | Probability | Impact | Mitigation |
|
|
676
|
+
|------|------------|--------|------------|
|
|
677
|
+
| Agents generate broken Mermaid | Medium | Low | Good examples in templates; Mermaid is forgiving |
|
|
678
|
+
| Agents skip diagrams entirely | Low | Medium | "MUST generate" rule in agent prompt + test assertion |
|
|
679
|
+
| Existing consumers confused by new sections | Very Low | Low | Consumers load by filename, not section headers |
|
|
680
|
+
| Templates too long for agent context | Low | Medium | Keep examples concise, max 15 nodes per diagram |
|
|
681
|
+
| Users on terminals can't see diagrams | Medium | Low | Diagrams display as readable text in terminals |
|
|
682
|
+
|
|
683
|
+
### 8.4 Cognitive Complexity Budget
|
|
684
|
+
|
|
685
|
+
No new functions — only template and prompt content changes. All modifications are to markdown files, not code.
|
|
686
|
+
|
|
687
|
+
---
|
|
688
|
+
|
|
689
|
+
## Phase 9: Test Plan
|
|
690
|
+
|
|
691
|
+
### 9.1 Test Pyramid
|
|
692
|
+
|
|
693
|
+
| Level | Pattern | Count | What It Catches |
|
|
694
|
+
|-------|---------|-------|-----------------|
|
|
695
|
+
| **Unit** | Template content validation | 8 | Missing diagrams, missing TOGAF headers, forbidden click directives |
|
|
696
|
+
| **Integration** | `runPanTools('init map-codebase', tmpDir)` | 2 | init context still returns correct shape |
|
|
697
|
+
| **E2E** | Full map-codebase run on PAN Wizard's own codebase | 1 | Diagrams actually generated by agents |
|
|
698
|
+
|
|
699
|
+
### 9.2 Template Validation Tests
|
|
700
|
+
|
|
701
|
+
```javascript
|
|
702
|
+
// Test: architecture.md template contains Mermaid examples
|
|
703
|
+
test('architecture template has Mermaid flowchart example', () => {
|
|
704
|
+
const content = fs.readFileSync('pan-wizard-core/templates/codebase/architecture.md', 'utf8');
|
|
705
|
+
assert.ok(content.includes('```mermaid'), 'Should contain Mermaid code fence');
|
|
706
|
+
assert.ok(content.includes('graph'), 'Should contain flowchart or sequence diagram');
|
|
707
|
+
});
|
|
708
|
+
|
|
709
|
+
// Test: no template contains click directive (security)
|
|
710
|
+
test('no template contains Mermaid click directive', () => {
|
|
711
|
+
const templates = fs.readdirSync('pan-wizard-core/templates/codebase/');
|
|
712
|
+
for (const file of templates) {
|
|
713
|
+
const content = fs.readFileSync(`pan-wizard-core/templates/codebase/${file}`, 'utf8');
|
|
714
|
+
assert.ok(!content.includes('click '), `${file} should not contain Mermaid click directive`);
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
// Test: architecture template has TOGAF sections
|
|
719
|
+
test('architecture template has TOGAF domain sections', () => {
|
|
720
|
+
const content = fs.readFileSync('pan-wizard-core/templates/codebase/architecture.md', 'utf8');
|
|
721
|
+
assert.ok(content.includes('Business Architecture') || content.includes('Application Architecture'));
|
|
722
|
+
});
|
|
723
|
+
|
|
724
|
+
// Test: agent definition has diagram guidelines
|
|
725
|
+
test('mapper agent has diagram guidelines', () => {
|
|
726
|
+
const content = fs.readFileSync('.claude/agents/pan-document_code.md', 'utf8');
|
|
727
|
+
assert.ok(content.includes('mermaid') || content.includes('Mermaid') || content.includes('diagram'));
|
|
728
|
+
});
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
### 9.3 Regression Verification
|
|
732
|
+
|
|
733
|
+
- [ ] Full suite: `npm test` — all 875 existing tests pass
|
|
734
|
+
- [ ] `runPanTools('init map-codebase', tmpDir)` returns same JSON shape
|
|
735
|
+
- [ ] No existing test expectations changed
|
|
736
|
+
|
|
737
|
+
### 9.4 Performance Validation
|
|
738
|
+
|
|
739
|
+
- [ ] `npm test` runtime unchanged (~8s)
|
|
740
|
+
- [ ] Template files < 500 lines each (reasonable agent context consumption)
|
|
741
|
+
- [ ] Total template size increase < 50% (from Mermaid examples)
|
|
742
|
+
|
|
743
|
+
---
|
|
744
|
+
|
|
745
|
+
## Phase 10: Output Artifacts
|
|
746
|
+
|
|
747
|
+
### 10.1 Documents Created
|
|
748
|
+
|
|
749
|
+
- **Spec:** `docs/specs/map_codebase_mermaid_togaf_featureai.md` (this file)
|
|
750
|
+
- **ADR:** `docs/decisions/ADR-0008-map-codebase-mermaid-togaf.md` (to be created)
|
|
751
|
+
|
|
752
|
+
### 10.2 Report Summary
|
|
753
|
+
|
|
754
|
+
```
|
|
755
|
+
## /pan:focus-design --internal Complete — Enhance map-codebase with Mermaid + TOGAF
|
|
756
|
+
|
|
757
|
+
### Problem & Evidence
|
|
758
|
+
Codebase maps are text-only with ad-hoc structure — no visual diagrams, no standard
|
|
759
|
+
architecture framework. User explicitly requested this enhancement.
|
|
760
|
+
|
|
761
|
+
### Strategic Assessment
|
|
762
|
+
- Blue Ocean: ELIMINATE ASCII diagrams, REDUCE prose, RAISE visual quality, CREATE TOGAF alignment
|
|
763
|
+
- Wardley: Both Mermaid (commodity) and TOGAF (product) are mature — adoption, not invention
|
|
764
|
+
- Moat Score: 27/30 — strongest in Context Engineering (5), Cross-Platform (5), Zero Deps (5)
|
|
765
|
+
- Cognitive Load: 0 (neutral — same command, richer output)
|
|
766
|
+
- Recommendation: Build — pure quality improvement, zero new dependencies
|
|
767
|
+
|
|
768
|
+
### Design Summary
|
|
769
|
+
- Feature Type: Core Enhancement (templates + agent prompts)
|
|
770
|
+
- Modules Affected: 0 code modules; 7 templates, 1 agent, 1 workflow
|
|
771
|
+
- Output Schema Changes: None (JSON from init unchanged)
|
|
772
|
+
- Breaking Changes: None (same 7 filenames)
|
|
773
|
+
- Layer Violations: None
|
|
774
|
+
- Diagram Types: flowchart (LR/TD), sequenceDiagram, erDiagram, quadrantChart
|
|
775
|
+
- TOGAF Domains: Business, Application, Data, Technology mapped to existing files
|
|
776
|
+
|
|
777
|
+
### Feature Ladder
|
|
778
|
+
- v0 (MVP): Mermaid examples in 4 templates + agent prompt update — S effort
|
|
779
|
+
- v1 (Complete): All 7 templates + TOGAF sections + tests + docs — M effort
|
|
780
|
+
- v2 (Enhanced): Optional --render flag for PNG/SVG generation — L effort
|
|
781
|
+
|
|
782
|
+
### Implementation
|
|
783
|
+
- Tasks: 10 tasks (6 P0, 2 P1, 2 P2)
|
|
784
|
+
- Complexity: S-M (content changes, no new code)
|
|
785
|
+
- Files to create: 1 (test file or additions to existing)
|
|
786
|
+
- Files to modify: 9 (7 templates + 1 agent + 1 workflow)
|
|
787
|
+
- Tests planned: 11 (8 unit, 2 integration, 1 e2e)
|
|
788
|
+
|
|
789
|
+
### Security
|
|
790
|
+
- Mermaid is declarative — no code execution
|
|
791
|
+
- Forbidden: `click` directives in templates
|
|
792
|
+
- Forbidden: credentials/tokens in diagram labels
|
|
793
|
+
- Existing secret scan catches leaked keys
|
|
794
|
+
|
|
795
|
+
### Adoption
|
|
796
|
+
- Discovery: Automatic — same /pan:map-codebase command
|
|
797
|
+
- Learning curve: Zero — diagrams just appear
|
|
798
|
+
- Aha moment: Opening ARCHITECTURE.md in GitHub and seeing rendered diagrams
|
|
799
|
+
|
|
800
|
+
### Next Step
|
|
801
|
+
Execute implementation roadmap:
|
|
802
|
+
Tasks 1-5 (templates) — parallel, S effort total
|
|
803
|
+
Task 6 (agent update) — M effort, after templates
|
|
804
|
+
Tasks 7-10 (workflow, installer, tests, docs) — S effort total
|
|
805
|
+
```
|