moon project-graph [id] (or moon pg) command generates and serves a visual graph of all configured projects as nodes, with dependencies between them as edges. The graph can be viewed in a browser or exported to Graphviz DOT format or JSON.
Synopsis
Arguments
[id]- Optional ID or alias of a project to focus the graph on, as defined inprojects. When specified, only shows the focused project and its dependencies.
Options
| Option | Type | Default | Description |
|---|---|---|---|
--dependents | boolean | false | Include direct dependents of the focused project |
--dot | boolean | false | Print the graph in DOT format |
--json | boolean | false | Print the graph in JSON format |
--host | string | 127.0.0.1 | The host address for the web server |
--port | number | 0 | The port to bind to (0 = random available port) |
--host and --port options
Example output
Interactive visualization
By default, the command starts a local web server that displays an interactive graph:- Zoom and pan
- Click nodes to see project details
- Hover to see dependency information
- Filter and search functionality
DOT format output
Export the graph in Graphviz DOT format for external visualization:JSON format output
Export the graph structure as JSON:Usage examples
View full project graph
Focus on a specific project
Show only the dependencies of a specific project:Include dependents
Show both dependencies and dependents of a project:Export to DOT file
Export to JSON for analysis
Serve on custom host and port
Understanding the graph
Node types
- Workspace root - Black circle representing the workspace root
- Projects - Gray circles representing individual projects
Edge types
- Workspace membership - Lines from workspace to projects (no arrowhead)
- Dependencies - Arrows between projects showing dependency relationships
- Production - Solid line
- Development - Dashed line (if applicable)
- Peer - Dotted line (if applicable)
Focus mode
When focusing on a specific project:- The focused project is highlighted
- Only its dependencies are shown by default
- Use
--dependentsto also show projects that depend on it
Related commands
moon project- Display information about a specific projectmoon projects- List all projectsmoon task-graph- Visualize task dependencies
Configuration
projectsin.moon/workspace.*