Skip to content

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.

See what a specific file imports:

Terminal window
rfx deps src/auth/handler.rs
src/auth/handler.rs
├── src/auth/credentials.rs (internal)
├── src/auth/session.rs (internal)
├── src/models/user.rs (internal)
├── anyhow (external)
└── std::collections::HashMap (stdlib)

Find every file that imports a given file:

Terminal window
rfx deps src/auth/handler.rs --reverse

This answers “what breaks if I change this file?” — essential for safe refactoring.

Explore transitive dependencies:

Terminal window
rfx deps src/main.rs --depth 3
Terminal window
# Tree view (default)
rfx deps src/main.rs --format tree
# Table view
rfx deps src/main.rs --format table
# JSON for scripting
rfx deps src/main.rs --json

Analyze your entire dependency graph:

Terminal window
rfx analyze --circular

Finds dependency cycles (A → B → C → A) that can cause build issues and architectural problems.

Terminal window
rfx analyze --hotspots

Identifies files with the highest fan-in (most depended upon). These are your highest-impact files — changes here affect the most code.

Terminal window
rfx analyze --unused

Finds files that nothing imports — potential dead code candidates.

Terminal window
rfx analyze --islands

Detects disconnected clusters of files that have no dependency relationship with the rest of your codebase.

For large results, use --limit and --offset:

Terminal window
rfx analyze --hotspots --limit 20 --offset 0
rfx analyze --hotspots --limit 20 --offset 20

Or get everything at once:

Terminal window
rfx analyze --hotspots --all --json

Reflex classifies every dependency into one of three types:

TypeDescriptionExample
internalFiles within your projectuse crate::auth::handler
externalThird-party packagesuse anyhow::Result
stdlibStandard libraryuse std::collections::HashMap

Dependency extraction works across all 15 supported languages. See Supported Languages for the full matrix of what import syntax each language supports.

LanguageImport syntax
Rustuse, mod, extern crate
TypeScript/JavaScriptimport, require()
Pythonimport, from...import
Goimport
Java/Kotlinimport
C/C++#include
C#using
PHPuse, require, include
Rubyrequire, require_relative
Vue/Svelteimports from <script> blocks
Zig@import()

Add --dependencies to a regular query to see import context alongside search results:

Terminal window
rfx query "handleRequest" --dependencies

This enriches each result with the file’s direct dependencies, useful for understanding the context around a match.