Feature: Add codegraph export command#630
Open
Michael2150 wants to merge 1 commit into
Open
Conversation
Introduce a new `codegraph export` CLI command and export pipeline. The CLI supports formats: dot, mermaid, cytoscape (JSON), and self-contained interactive HTML; options include --format, --output, --kind, --edge-kind, --all-kinds, --limit, and --title. The command validates formats/kinds, deduplicates nodes, applies a node limit (with warning), filters edges to the exported node set, and writes to stdout or a file. Add a new src/export/index.ts that implements the formatters (DOT, Mermaid, Cytoscape JSON, HTML with a Cytoscape viewer), colour palette, escaping helpers, and edge bounding. Update src/index.ts to expose getAllNodes() and findEdgesBetweenNodes() used by the exporter. Update CHANGELOG.md to document the new feature.
codegraph export commandcodegraph export command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
codegraph exportcommandAdds a new
codegraph exportCLI command that lets you dump your indexed graph to a file for visualization or further processing.What's in this PR
--kindto pick specific node types,--edge-kindto filter relationship types,--all-kindsto include everything, and--limitto cap node count (defaults to 1000 with a warning when truncated).CodeGraph:getAllNodes()andfindEdgesBetweenNodes(), which the exporter uses internally but are also handy for anyone embedding the library.Why
There was no way to get the graph data out of CodeGraph in a format you could hand to an external tool. DOT and Mermaid cover the "render it as a diagram" use case; Cytoscape JSON covers the "load it into my own viz tool" case; and the HTML format is the zero-friction option when you just want to poke around without setting anything up.
Usage