Nexus is a Rust-based CLI tool for analyzing and visualizing code dependencies in source files. It builds a dependency graph from Rust code and supports circular dependency detection.
- Analyze Rust project structure by parsing
modandusedeclarations - Generate dependency graph in DOT format
- Detect circular dependencies
- Traverse entire source directory
- Modular parser system (currently supports Rust, Javascript, Python and Java)
nexus/
├── src/
│ ├── main.rs # CLI entrypoint
│ ├── graph/ # Graph construction and cycle detection
│ ├── parsers/ # Rust parser module
│ ├── utils/ # File system walking logic
│ └── analyzer/ # Central analyzer logic
cargo build --releasecargo run -- --path ./src| Flag | Description | Default |
|---|---|---|
--path, -p |
Path to the source code directory | (required) |
--output, -o |
Output file path | output.dot |
--format |
Output format: dot or json |
dot |
--detect-cycles |
Enable or disable circular dependency check | true |
Example:
cargo run -- --path ./src --output graph.dot --format dot --detect-cycles falseThe tool outputs a .dot file representing the dependency graph. You can render it using Graphviz:
dot -Tpng output.dot -o graph.png