In large projects, dependencies grow quickly.
Because of reusable components, shared utilities, and modular architecture, it becomes hard to answer a simple question:
๐ โIf I change this file, what else will it affect?โ
I faced this problem multiple times while working on real projects.
So I decided to build something to solve it.
Thatโs how DevScope was born.
๐งฉ The Problem
As projects scale:
Files become interconnected
Imports grow complex
Refactoring becomes risky
Even a small change can break multiple parts of the applicationโand you may not even realize it.
๐ก The Solution
DevScope is a lightweight CLI tool that:
Builds a dependency graph of your project
Tracks relationships between files
Identifies impacted files instantly
โก Getting Started
Install globally:
npm install -g @maheshdev/dev-scope
Run inside your project:
dev-scope analyze
This generates a clean dependency tree:
src/index.ts
โโโ src/commands/overview.ts
โโโ src/commands/impact.ts
โโโ src/commands/analyze.ts
๐ Impact Analysis
Want to know what breaks if you change a file?
dev-scope impact <file_name>
dev-scope impact src/graph/buildGraph.ts
Output:
Affected:
โโโ src/commands/analyze.ts
โโโ src/index.ts
โโโ src/commands/impact.ts
โโโ src/commands/overview.ts
This is extremely useful before refactoring.
๐ Project Insights
You can also run:
dev-scope overview
This gives insights like:
Total files & dependencies
Leaf files (no dependencies)
Most used files
Unused files
๐ง How It Works (Simplified)
At its core, DevScope uses two main ideas:
- Dependency Graph
Each file is treated as a node.
Imports between files create edges.
Example:
A โ B โ C
This means:
A depends on B
B depends on C
- Reverse Traversal (DFS)
To find impacted files:
Start from the changed file
Traverse backwards through dependencies
Collect all files that depend on it
This is done using Depth First Search (DFS).
๐ฏ Why I Built This
While working on projects, I often struggled with:
Understanding large codebases quickly
Safe refactoring
Identifying unused files
I wanted something:
Simple
Fast
No UI overhead
Just works in terminal
โ๏ธ Tech Stack
TypeScript
Node.js
Commander (CLI)
๐ Try It Yourself
npm install -g @maheshdev/dev-scope
Start exploring your codebase:
dev-scope analyze
dev-scope impact
๐ฎ Whatโs Next
Iโm planning to improve:
More language support
Better visualization
Performance optimizations
๐ค Feedback
This is just the beginning.
If you try it, Iโd love to hear your thoughts!
Top comments (0)