Plugin
codebase-to-mermaid
Reads an unfamiliar codebase end-to-end and produces validated Mermaid diagrams of how the system actually flows. Every node and edge is cited to a real file:line. No invented modules. No decorative arrows. Auto-classifies the project archetype (HTTP service, CLI, data pipeline, SPA, Next.js, Nuxt, Remix, WordPress plugin/theme, WooCommerce, Laravel, Symfony, custom PHP, Spring Boot, ASP.NET Core, Go service/CLI, Rust web/CLI/WASM, Bash, WP-CLI, htmx, Alpine, Livewire, Vue SPA, C/C++/Qt/Unity, monorepo) and picks the right diagram kind (flowchart TD/LR, sequenceDiagram, classDiagram). Splits diagrams at the 40-node cap into overview plus per-archetype drill-downs. Flags destructive steps (wp db reset, wp search-replace, rm -rf, aws s3 rm --recursive) with a distinct node style. Writes raw Mermaid to flow.mmd or flow-<archetype>.mmd next to the code for direct render via mmdc -i flow.mmd -o flow.svg or by pasting into mermaid.live, plus prints a Markdown report with diagram, legend (node → file:line), and notes. Five-phase procedure: Discover (glob layout, read manifests, grep framework signals), Classify (archetype table), Draft (node ids, citations, edge labels, subgraphs), Validate (every node cited, every edge greppable, Mermaid syntax check), Emit (Write tool plus chat report). Includes /codebase-to-mermaid slash command with current-dir-vs-path picker. Progressive disclosure splits the bulky framework signal grep cheat sheet (19+ languages, 22+ frameworks), archetype table, and 24 worked few-shot examples into separate reference files loaded on demand. Refuses code review, refactor proposals, bug hunts, and security/performance audits - scope-locked to diagram + legend + notes.