Dependency Analysis
Reflex tracks file-level dependencies by extracting import/require/use statements from your code. This powers reverse lookups, circular dependency detection, hotspot analysis, and more.
Per-file dependencies with rfx deps
Section titled “Per-file dependencies with rfx deps”See what a specific file imports:
rfx deps src/auth/handler.rssrc/auth/handler.rs├── src/auth/credentials.rs (internal)├── src/auth/session.rs (internal)├── src/models/user.rs (internal)├── anyhow (external)└── std::collections::HashMap (stdlib)Reverse dependencies
Section titled “Reverse dependencies”Find every file that imports a given file:
rfx deps src/auth/handler.rs --reverseThis answers “what breaks if I change this file?” — essential for safe refactoring.
Deeper traversal
Section titled “Deeper traversal”Explore transitive dependencies:
rfx deps src/main.rs --depth 3Output formats
Section titled “Output formats”# Tree view (default)rfx deps src/main.rs --format tree
# Table viewrfx deps src/main.rs --format table
# JSON for scriptingrfx deps src/main.rs --jsonCodebase analysis with rfx analyze
Section titled “Codebase analysis with rfx analyze”Analyze your entire dependency graph:
Circular dependencies
Section titled “Circular dependencies”rfx analyze --circularFinds dependency cycles (A → B → C → A) that can cause build issues and architectural problems.
Hotspots
Section titled “Hotspots”rfx analyze --hotspotsIdentifies files with the highest fan-in (most depended upon). These are your highest-impact files — changes here affect the most code.
Unused files
Section titled “Unused files”rfx analyze --unusedFinds files that nothing imports — potential dead code candidates.
Isolated subgraphs
Section titled “Isolated subgraphs”rfx analyze --islandsDetects disconnected clusters of files that have no dependency relationship with the rest of your codebase.
Pagination
Section titled “Pagination”For large results, use --limit and --offset:
rfx analyze --hotspots --limit 20 --offset 0rfx analyze --hotspots --limit 20 --offset 20Or get everything at once:
rfx analyze --hotspots --all --jsonDependency types
Section titled “Dependency types”Reflex classifies every dependency into one of three types:
| Type | Description | Example |
|---|---|---|
internal | Files within your project | use crate::auth::handler |
external | Third-party packages | use anyhow::Result |
stdlib | Standard library | use std::collections::HashMap |
Supported languages
Section titled “Supported languages”Dependency extraction works across all 15 supported languages. See Supported Languages for the full matrix of what import syntax each language supports.
| Language | Import syntax |
|---|---|
| Rust | use, mod, extern crate |
| TypeScript/JavaScript | import, require() |
| Python | import, from...import |
| Go | import |
| Java/Kotlin | import |
| C/C++ | #include |
| C# | using |
| PHP | use, require, include |
| Ruby | require, require_relative |
| Vue/Svelte | imports from <script> blocks |
| Zig | @import() |
Adding dependency context to searches
Section titled “Adding dependency context to searches”Add --dependencies to a regular query to see import context alongside search results:
rfx query "handleRequest" --dependenciesThis enriches each result with the file’s direct dependencies, useful for understanding the context around a match.
Next steps
Section titled “Next steps”- AI Integration — dependency data is available through MCP tools
- CLI Commands — full
rfx depsandrfx analyzereference - Architecture — how the dependency index works internally