-
Notifications
You must be signed in to change notification settings - Fork 0
Exports Workspaces and Editor
Three ways to get value out of a graph: export it to a file, save the view to return to later, and jump from a node to its source in your editor.
Export the current graph for docs, diagrams, or other tools (lib/export/). The browser download is handled by lib/client/download.ts, which uses a native Save-As dialog on desktop and a normal browser download on the web.
| Format | Use it for |
|---|---|
| DOT (Graphviz) | Re-layout or post-process with the Graphviz toolchain (rankdir is set from the current direction) |
| GraphML | Import into yEd, Gephi, and other graph tools (label/kind/filePath/line travel as data keys) |
| Mermaid | Drop a diagram straight into Markdown docs |
| JSON | The raw graph for your own scripts |
| SVG | A vector snapshot of the current view |
| Standalone HTML report | A single self-contained file with the insights + a figure, no external assets — good for sharing a review |
SVG can also be rasterized to PNG in the browser (svgToPngBlob) when you need a bitmap.
A workspace captures the current view so you can restore or share it later (lib/workspace/):
- What's saved: filters, layout (engine + direction + density), camera (pan/zoom), and pins.
-
Where: persisted in
localStorageunder a versioned key (polygraph.workspaces.v1), so saved views survive reloads. - Operations: list / save / load / delete named workspaces. Storage failures degrade gracefully to no-ops.
Workspaces are the lightweight way to keep a curated view (e.g. "the auth subsystem, force layout, externals on") without re-deriving it each time.
Desktop-only. A selected node's detail panel shows an inline source preview — a syntax-highlighted slice of the file (via Shiki) — and an Open in editor action.
-
Editors: VS Code (
--goto file:line:column) and JetBrains IDEs (--line N --column N file). The command builders live inlib/editor/commands.tsand are pure, returning an argv array. -
How it opens: the Tauri shell (
src-tauri/src/lib.rs) exposesspawn_detached, which launches the editor with an argv array and no shell — so there's no command-injection surface. -
Where it reads:
read_source_sliceserves the preview, with reads constrained to the scanned project root via a canonicalized-path check (you can't escape the root with..or a symlink).
This is the last step of the core loop: select → blast radius → edge evidence → open in editor at the exact line.
PolyGraph — explore, audit, enforce, and compare software architecture across 26 languages, 100% locally. Repository · Releases · Issues · Licensed Apache-2.0 OR MIT
📖 Using PolyGraph
- Installation
- Getting Started
- The Graph Model
- Layouts & Navigation
- Impact Analysis & Insights
- Query Language
- CLI: Rules & Diff
- Exports, Workspaces & Editor
- Troubleshooting & FAQ
🔧 Internals & Contributing