Command Categories
Dependency Analysis
Trace and analyze dependencies between files
Node Modules Management
Manage and optimize npm packages
Configuration
Initialize and run config-based checks
File Discovery
List and filter project files
Dependency Analysis Commands
Commands for exploring and understanding your dependency graph.resolve
Trace and display the dependency path between files in your project.
-f, --file- Target file to check for dependencies--module- Target node module name to check for dependencies-p, --entry-points- Entry point file(s) or glob pattern(s) to start analysis from-a, --all- Show all possible resolution paths, not just the first one--compact-summary- Display a compact summary of found paths--graph-exclude- Glob patterns to exclude files from dependency analysis
entry-points
Discover and list all entry points in the project. Entry points are files that are not imported by any other file.
-n, --count- Only display the number of entry points found--print-deps-count- Show the number of dependencies for each entry point--graph-exclude- Exclude files matching these glob patterns from analysis--result-exclude- Exclude files matching these glob patterns from results--result-include- Only include files matching these glob patterns in results
files
List all files in the dependency tree of an entry point.
-p, --entry-point- Entry point file to analyze (required)-n, --count- Only display the count of files in the dependency tree
imported-by
List all files that directly import the specified file.
-f, --file- Target file to find importers for (required)-n, --count- Only display the count of importing files--list-imports- List the import identifiers used by each file
circular
Detect circular dependencies in your project.
-t, --ignore-type-imports- Exclude type imports from the analysis
unresolved
List unresolved imports in the project.
--ignore- Map of file path to exact import request to ignore--ignore-files- File path glob patterns to ignore in unresolved output--ignore-imports- Import requests to ignore globally in unresolved output--custom-asset-extensions- Additional asset extensions treated as resolvable
Node Modules Commands
Commands for analyzing and managing npm dependencies.node-modules used
List all npm packages imported in your code.
-p, --entry-points- Entry point file(s) to start analysis from-n, --count- Only display the count of modules--group-by-module- Organize output by npm package name--group-by-file- Organize output by project file path--group-by-entry-point- Organize output by entry point file path--group-by-module-files-count- Organize by package and show count of files using it
node-modules unused
Find installed packages that aren’t imported in your code.
-i, --include-modules- List of modules to include in the output-e, --exclude-modules- List of modules to exclude from the output--zero-exit-code- Always return zero exit code
node-modules missing
Find imported packages not listed in package.json.
-p, --entry-points- Entry point file(s) to start analysis from--group-by-module- Organize output by npm package name--group-by-file- Organize output by project file path
node-modules installed
List all installed npm packages in the project.
-i, --include-modules- List of modules to include in the output-e, --exclude-modules- List of modules to exclude from the output
node-modules installed-duplicates
Find and optimize duplicate package installations.
--optimize- Automatically create symlinks to deduplicate packages--size-stats- Print node modules dirs size before and after optimization--verbose- Show detailed information about each optimization--isolate- Create symlinks only within the same top-level node_module directories
node-modules analyze-size
Analyze disk usage of node_modules.
node-modules dirs-size
Calculate cumulative files size in node_modules directories.
node-modules prune-docs
Remove markdown/docs-like files from installed node_modules packages.
--patterns- Glob patterns of files to remove--defaults- Use default prune patterns (LICENSE, README.md, docs/**)
Configuration Commands
Commands for config-based codebase governance.config init
Initialize a new rev-dep.config.json file.
config run
Execute all checks defined in your configuration file.
--fix- Automatically fix fixable issues--list-all-issues- List all issues instead of limiting output--rules- Subset of rules to run (comma-separated list of rule paths)
File Discovery Commands
Commands for listing and filtering project files.list-cwd-files
List all files in the current working directory.
--include- Only include files matching these glob patterns--exclude- Exclude files matching these glob patterns--count- Only display the count of matching files
lines-of-code
Count actual lines of code in the project excluding comments and blank lines.
Shared Flags
These flags are available across most commands:Working Directory
-c, --cwd- Working directory for the command (default: current directory)
Configuration Files
--package-json- Path to package.json (default: ./package.json)--tsconfig-json- Path to tsconfig.json (default: ./tsconfig.json)
Import Resolution
--condition-names- List of conditions for package.json imports resolution (e.g. node, imports, default)--follow-monorepo-packages- Enable resolution of imports from monorepo workspace packages. Pass without value to follow all, or pass specific package names
Type Imports
-t, --ignore-type-imports- Exclude type imports from the analysis
Output Control
-v, --verbose- Show warnings and verbose output-n, --count- Only display the count (available on many commands)
Monorepo Support
Rev-dep provides first-class monorepo support with the--follow-monorepo-packages flag:
- Detect workspace packages automatically
- Resolve imports between packages within the workspace
- Follow package.json exports for proper module resolution
Conditional Exports
Control which conditional exports are resolved using--condition-names:
node- Node.js environmentimport- ES modulesrequire- CommonJSdefault- Fallback condition
Exit Codes
Most rev-dep commands use exit codes to indicate results:0- Success or no issues found> 0- Number of issues found (for detection commands likecircular,unused,missing)
--zero-exit-code to always return 0, useful for CI pipelines where you want to log issues without failing the build.
Performance Tips
- Use config-based checks - Running
rev-dep config runis faster than running individual commands sequentially - Exclude unnecessary files - Use
--graph-excludeto skip test files or build artifacts - Use glob patterns - Specify multiple entry points with patterns instead of running commands multiple times
- Leverage parallel execution - The config approach runs all checks in parallel for maximum speed
Common Workflows
Find and Remove Unused Code
Reduce Bundle Size
Enforce Architecture
Debug Import Issues
Next Steps
Configuration Guide
Learn about config-based checks
Configuration Commands
Detailed documentation for configuration commands
