
Hacker News · Feb 26, 2026 · Collected from RSS
Article URL: https://github.com/jayu/rev-dep Comments URL: https://news.ycombinator.com/item?id=47170299 Points: 18 # Comments: 3
Rev-dep Capabilities • Installation • Exploratory Toolkit • CLI Reference Dependency analysis and optimization toolkit for modern JavaScript and TypeScript codebases. Enforce dependency graph hygiene and remove unused code with a very fast CLI. About 📣 As codebases scale, maintaining a mental map of dependencies becomes impossible. Rev-dep is a high-speed static analysis tool designed to enforce architecture integrity and dependency hygiene across large-scale JS/TS projects. Think of Rev-dep as a high-speed linter for your dependency graph. Consolidate fragmented, sequential checks from multiple slow tools into a single, high-performance engine. Rev-dep executes a full suite of governance checks—including circularity, orphans, module boundaries and more, in one parallelized pass. Implemented in Go to bypass the performance bottlenecks of Node-based analysis, it can audit a 500k+ LoC project in approximately 500ms. Automated Codebase Governance Rev-dep moves beyond passive scanning to active enforcement, answering (and failing CI for) the hard questions: Architecture Integrity: "Is my 'Domain A' illegally importing from 'Domain B'?". Dead Code & Bloat: "Are these files unreachable, or are these node_modules unused?". Refactoring Safety: "Which entry points actually use this utility, and are there circular chains?". Workspace Hygiene: "Are my imports consistent and are all dependencies declared?". Rev-dep serves as a high-speed gatekeeper for your CI, ensuring your dependency graph remains lean and your architecture stays intact as you iterate. Why Rev-dep? 🤔 🏗️ First-class monorepo support Designed for modern workspaces (pnpm, yarn, npm). Rev-dep natively resolves package.json exports/imports maps, TypeScript aliases and traces dependencies across package boundaries. 🛡️ Config-Based Codebase Governance Move beyond passive scanning. Use the configuration engine to enforce Module Boundaries and Import Conventions. Execute a full suite of hygiene checks (circularity, orphans, unused modules and more) in a single, parallelized pass that serves as a high-speed gatekeeper for your CI. 🔍 Exploratory Toolkit CLI toolkit that helps debug issues with dependencies between files. Understand transitive relation between files and fix issues. ⚡ Built for Speed and CI Efficiency Implemented in Go to eliminate the performance tax of Node-based analysis. By processing files in parallel, Rev-dep offers 10x-200x faster execution than alternatives, significantly reducing CI costs and developer wait-states. Rev-dep can audit a 500k+ LoC project in around 500ms. See the performance comparison Capabilities 🚀 Governance and maintenance (config-based) 🛡️ Use rev-dep config run to execute multiple checks in one pass for all packages. Available checks: moduleBoundaries - enforce architecture boundaries between modules. importConventions - enforce import style conventions (offers autofix). unusedExportsDetection - detect exports that are never used (offers autofix). orphanFilesDetection - detect dead/orphan files (offers autofix). unusedNodeModulesDetection - detect dependencies declared but not used. missingNodeModulesDetection - detect imports missing from package json. unresolvedImportsDetection - detect unresolved import requests. circularImportsDetection - detect circular imports. devDepsUsageOnProdDetection - detect dev dependencies used in production code. restrictedImportsDetection - block importing denied files/modules from selected entry points. Exploratory analysis (CLI-based) 🔍 Use CLI commands for ad-hoc dependency exploration: entry-points - discover project entry points. files - list dependency tree files for a given entry point. resolve - trace dependency paths between files (who imports this file). imported-by - list direct importers of a file. circular - list circular dependency chains. node-modules - inspect used, unused, missing, and installed node modules. lines-of-code - count effective LOC. list-cwd-files - list all source code files in CWD Installation 📦 Install locally to set up project check scripts yarn add -D rev-dep npm install -D rev-dep pnpm add -D rev-dep Create config file for a quick start: npx rev-dep config init Install globally to use as a CLI tool: yarn global add rev-dep npm install -g rev-dep pnpm global add rev-dep Quick Examples 💡 A few instant-use examples to get a feel for the tool: # Detect unused node modules rev-dep node-modules unused # Detect circular imports/dependencies rev-dep circular # List all entry points in the project rev-dep entry-points # Check which files an entry point imports rev-dep files --entry-point src/index.ts # Find every entry point that depends on a file rev-dep resolve --file src/utils/math.ts # Resolve dependency path between files rev-dep resolve --file src/utils/math.ts --entry-point src/index.ts Config-Based Checks 🛡️ Rev-dep provides a configuration system for orchestrating project checks. The config approach is designed for speed and is the preferred way of implementing project checks because it can execute all checks in a single pass, significantly faster than multiple running individual commands separately. Available checks are: moduleBoundaries - enforce architecture boundaries between modules. importConventions - enforce import style conventions (offers autofix). unusedExportsDetection - detect exports that are never used (offers autofix). orphanFilesDetection - detect dead/orphan files (offers autofix). unusedNodeModulesDetection - detect dependencies declared but not used. missingNodeModulesDetection - detect imports missing from package json. unresolvedImportsDetection - detect unresolved import requests. circularImportsDetection - detect circular imports. devDepsUsageOnProdDetection - detect dev dependencies used in production code. restrictedImportsDetection - block importing denied files/modules from selected entry points. Checks are grouped in rules. You can have multiple rules, eg. for each monorepo package. Getting Started Initialize a configuration file in your project: # Create a default configuration file rev-dep config init Behavior of rev-dep config init: Monorepo root: Running rev-dep config init at the workspace root creates a root rule and a rule for each discovered workspace package. Monorepo workspace package or regular projects: Running rev-dep config init inside a directory creates config with a single rule with path: "." for this directory. Run all configured checks (dry run, not fixes applied yet): # Execute all rules and checks defined in the config rev-dep config run List all detected issues: # Lists all detected issues, by default lists first five issues for each check rev-dep config run --list-all-issues Fix all fixable checks: # Fix checks configured with autofix rev-dep config run --fix Configuration Structure The configuration file (rev-dep.config.json(c) or .rev-dep.config.json(c)) allows you to define multiple rules, each targeting different parts of your codebase with specific checks enabled. Quick Start Configuration Comprehensive Config Example Here's a comprehensive example showing all available properties: Available Properties Root Level Properties configVersion (required): Configuration version string $schema (optional): JSON schema reference for validation conditionNames (optional): Array of condition names for exports resolution ignoreFiles (optional): Global file patterns to ignore across all rules. Git ignored files are skipped by default. rules (required): Array of rule objects Rule Properties Each rule can contain the following properties: path (required): Target directory path for this rule (either . or path starting with sub directory name) followMonorepoPackages (optional): Enable monorepo package resolution (default: true) moduleBoundaries (optional): Array of module boundary rules circularImportsDetection (optional): Circular import detection configuration orphanFilesDetection (optional): Orphan files detection configuration unusedNodeModulesDetection (optional): Unused node modules detection configuration missingNodeModulesDetection (optional): Missing node modules detection configuration unusedExportsDetection (optional): Unused exports detection configuration unresolvedImportsDetection (optional): Unresolved imports detection configuration devDepsUsageOnProdDetection (optional): Restricted dev dependencies usage detection configuration restrictedImportsDetection (optional): Restrict importing denied files/modules from selected entry points importConventions (optional): Array of import convention rules Module Boundary Properties name (required): Name of the boundary pattern (required): Glob pattern for files in this boundary allow (optional): Array of allowed import patterns deny (optional): Array of denied import patterns (overrides allow) Import Convention Properties rule (required): Type of the rule, currently only relative-internal-absolute-external autofix (optional): Whether to automatically fix import convention violations (default: false) domains (required): Array of domain definitions. Can be a string (glob pattern) or an object with: path (required): Directory with the domain files alias (optional): Alias to be used for absolute imports of code from this domain enabled (optional): Set to false to skip checks for this domain (default: true) Detection Options Properties CircularImportsDetection: enabled (required): Enable/disable circular import detection ignoreTypeImports (optional): Exclude type-only imports when building graph (default: false) OrphanFilesDetection: enabled (required): Enable/disable orphan files detection validEntryPoints (optional): Array of valid entry point patterns (eg. ["src/index.ts", "src/main.ts"]) ignoreTypeImports (optional): Exclude type-only imports when building graph (default: false) graphExclude (optional): File patterns to exclude from graph analysis autofix (optional): Delete detected orphan files automatically when running rev-dep config run --fix (de