Graph data was exported as bespoke LSP JSON, CLI ASCII trees, and unused edge arrays. Multiple presentation paths diverged from the same domain graphs.
Graph visualization
Platform spec feature
Graph visualization
Spec standingStandard
-
All user-visible compiler graphs are emitted as Mermaid flowcharts via mermaid-builder.
Context
Decision
beskid_graphrenders all tooling graphs to Mermaid flowcharts usingmermaid-builderonly.- No DOT, GraphViz, or hand-rolled ASCII graph renderers in compiler presentation code.
- CLI uses
graphs-tuito display Mermaid in the terminal; VS Code uses bundled Mermaid.js.
Consequences
- Domain graphs in
beskid_analysis(daggy, module tree) stay for compile correctness. - All consumers share one Mermaid string from Salsa memoization.
Status
Accepted — reference implementation in
compiler/crates/beskid_graph/. -
beskid_queries graph_mermaid tracked queries memoize Mermaid output with revision fingerprints.
Context
LSP
getProjectGraphrebuilt domain graphs from disk on every call. CLI printed a flattened ASCII tree fromCompilePlan, losing multi-hop structure.Decision
graph_fingerprintandgraph_mermaidare#[salsa::tracked]queries inbeskid_queries::graph.- LSP and CLI must read graphs through
compilation_db, not ad-hoc rebuilds. - Invalidation follows
ManifestGenerationId,FileText, and assembly/composition revision inputs per graph kind.
Consequences
- Extension and CLI share the same cached Mermaid revision.
- Manifest or lock edits invalidate project/workspace graphs without full process restart.
Status
Accepted — extends ADR D-COMP-BUILD-0021.
0 revisions (git unavailable at build; counts may be empty)
No commits recorded for this path.
| Section id | Required | Found |
|---|---|---|
what-this-feature-specifies | yes | yes |
implementation-anchors | yes | yes |
Full tree: run pnpm verify:platform-spec-layout (writes src/generated/platform-spec-layout-report.json).
What this feature specifies
A single Mermaid-only presentation layer (beskid_graph) for compiler graph domains. CLI, LSP, and VS Code must consume cached Mermaid strings from beskid_queries — no duplicate graph builders in TypeScript or hand-rolled ASCII renderers.
Graph kinds
| Kind | Source | When available |
|---|---|---|
projectDeps | ProjectGraph | Always for a resolved Project.proj |
workspace | Multiple member graphs | When opened folder contains Workspace.proj |
moduleTree | ModuleGraph from program assembly | After entry resolves |
importClosure | Unit import edges | After program assembly |
hostComposition | DI registration DAG | When entry launches a native host |
Implementation anchors
compiler/crates/beskid_graph/— IR, adapters, Mermaid render viamermaid-buildercompiler/crates/beskid_queries/src/graph.rs— Salsagraph_mermaid/graph_fingerprintcompiler/crates/beskid_lsp/src/commands/project_explorer/graph.rs—beskid.getGraphcompiler/crates/beskid_cli/src/commands/graph.rs—beskid graph+graphs-tuibeskid_vscode/src/graphs/— Graph Explorer webview panel
Consumers
| Consumer | Default output |
|---|---|
CLI beskid graph | Terminal TUI via graphs-tui; --mermaid for raw string |
LSP beskid.getGraph | JSON payload with mermaid, revision, warnings, metadata |
| VS Code Graph Explorer | Interactive Mermaid webview; Projects tree remains for navigation |