crawk
Dependency crawler for Rust. It crawls so you don't have to untangle
Features
- Module listing: See which modules are defined in a crate.
- Module usage: See which modules are used by a given module in a crate.
- Dependency graph: Visualize inter-module dependencies, detect cycles, find orphan modules.
- Dependency explanation: See why one module depends on another — lists concrete references that create the dependency edge.
Installation
Cargo
# or, faster with binstall:
Nix
# Run without installing
# Install into profile
# Development shell
Quick Start
CLI
Module listing - list subcommand
# List all modules in the current crate:
# List only a module subtree (root included):
# Show only modules up to a given nesting depth:
# Filter listed modules and render them as a table:
# Analyze a crate located at a custom path and show source files:
Module usage - use subcommand
# Analyze which internal modules a given module depends on:
# Recursively analyze all submodules of a module:
# Expand grouped imports (`a::{x, y}` → `a::x`, `a::y`) and resolve glob imports:
# Limit dependency path depth and group output by source module:
# Analyze a crate located at a custom path, including test modules:
Dependency graph - deps subcommand
# Show full inter-module dependency graph:
# Detect dependency cycles:
# Find modules with no incoming dependencies:
# Export as Graphviz dot format:
# Annotate edges with API symbol names:
# Find all shortest dependency paths between two modules:
# Analyze a crate at a custom path:
Dependency explanation - why subcommand
# Explain why module 'analyzer' depends on module 'reference':
# Include submodules of the source module:
# Include test modules in the search:
# Group output by source submodule (useful with -r):
# Analyze a crate at a custom path:
CLI Options
Please refer to crawk command CLI help for a comprehensive list of options:
# General help for crawk (including global options and subcommands)
# Help for the 'list' subcommand (including options specific to listing modules)
# Help for the 'use' subcommand (including options specific to module usage analysis)
# Help for the 'deps' subcommand (including options specific to dependency graph)
# Help for the 'why' subcommand (including options specific to dependency explanation)
Note: option -h gives short help, while --help provides detailed information about available options and their usage.
License
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
Why "crawk"?
The name crawk playfully blends crawl and awk, capturing the tool's mission to crawl Rust code for module dependency analysis.
It sounds action-oriented, evoking exploration of crate structures.
It was created to help me understand and manage the often complex web of module dependencies in my projects.