Whobreaks
Find out what breaks before you touch a file. Dependency graph + impact analysis + MCP server for AI coding tools.
Installation
npx whobreaksAsk AI about Whobreaks
Powered by Claude ยท Grounded in docs
I know everything about Whobreaks. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
whobreaks
Find out what breaks before you touch a file.
whobreaks builds a real-time dependency graph of your codebase and tells you the blast radius of any change โ before you make it. Works as a CLI, HTTP API, and MCP server for AI coding tools.
# Without whobreaks:
AI edits UserService.ts โ breaks 14 files โ you spend 2 hours fixing
# With whobreaks:
AI queries whobreaks first โ knows 14 files depend on UserService โ makes safe changes
Quick start
npx whobreaks .
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ ๐ฅ whobreaks v0.1.0 โ
โ Scanning your codebase... โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
๐ Found 247 files
โฑ๏ธ Analyzed in 1.2s
โโ Summary โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ Files: 247 โ
โ Edges: 1,847 โ
โ Avg depth: 4.2 โ
โ Max depth: 11 โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๏ธ Issues Found:
๐ Circular Dependencies (3)
src/services/auth.ts โ src/services/user.ts
src/models/order.ts โ src/models/product.ts โ src/models/order.ts
๐๏ธ Orphan Files โ imported by nothing (12)
src/utils/old-helpers.ts
src/components/DeprecatedButton.tsx
๐ธ๏ธ God Modules โ imported by 20+ files (2)
src/utils/helpers.ts โ 89 dependents
src/lib/api-client.ts โ 47 dependents
๐ฃ High-Impact Files โ editing these affects the most files
src/types/index.ts โ 142 files affected
src/utils/helpers.ts โ 89 files affected
๐ Output: .whobreaks/graph.json
MCP setup
whobreaks runs as an MCP server so AI tools (Claude Code, Cursor, Windsurf) can query it before editing files. Set it up once; the AI uses it automatically.
Claude Code
claude mcp add whobreaks npx whobreaks mcp
That's it. Verify:
claude mcp list
# whobreaks: npx whobreaks mcp
Cursor
Create .cursor/mcp.json in your project root:
{
"mcpServers": {
"whobreaks": {
"command": "npx",
"args": ["whobreaks", "mcp"]
}
}
}
VS Code (Copilot / GitHub Copilot Chat)
Create .vscode/mcp.json in your project root:
{
"servers": {
"whobreaks": {
"type": "stdio",
"command": "npx",
"args": ["whobreaks", "mcp"]
}
}
}
Windsurf
Create .windsurf/mcp_config.json in your project root:
{
"mcpServers": {
"whobreaks": {
"command": "npx",
"args": ["whobreaks", "mcp"]
}
}
}
Tell the AI to use it (CLAUDE.md / .cursorrules)
Drop this in your CLAUDE.md or .cursorrules:
## Architectural awareness
This project has whobreaks running as an MCP server.
Before editing any file, call:
- `get_impact` โ see how many files depend on it and which exports are critical
- `get_context` โ understand what it imports/exports and its risk level
Before creating a new file or moving an export, call:
- `find_related` โ check if similar functionality already exists
Files with 20+ dependents are god modules โ treat export changes as breaking changes.
Files in circular dependencies require extra care โ changes propagate in both directions.
Available MCP tools
| Tool | When to use |
|---|---|
get_impact | Before editing any file โ see direct + transitive dependents and critical exports |
get_context | Before editing โ full picture: imports, exports, risk level, line count |
find_related | Before creating something new โ check if it already exists |
get_impact("src/services/user.ts")
โ Editing this file will affect 14 files:
Direct dependents (3): auth.ts, dashboard.ts, settings.ts
Transitive (11): app.tsx, router.ts, ... +9 more
High-usage exports: getUserById, UserSchema
get_context("src/services/user.ts")
โ ## src/services/user.ts
Imports from (2): db/client.ts, utils/crypto.ts
Imported by (3): auth.ts, dashboard.ts, settings.ts
Exports: getUserById (function), UserSchema (type), updateUser (function)
Risk level: MEDIUM (3 dependents)
Lines: 187
Watch mode + live dashboard
npx whobreaks watch . --port 3001
Starts a file watcher and HTTP server. Open http://localhost:3001 for the interactive dependency graph dashboard.
The dashboard auto-reloads when files change. Every node is sized by dependent count, colored by risk, and clickable for a full impact analysis panel.
HTTP API
Available when running whobreaks watch or whobreaks . --port <n>.
| Endpoint | Description |
|---|---|
GET / | Interactive dashboard |
GET /health | Status, file count, edge count, last update |
GET /graph | Full dependency graph (JSON) |
GET /summary | Architecture summary (circulars, orphans, god modules) |
GET /impact?file=src/foo.ts | Impact analysis โ what breaks if this changes |
GET /dependents?file=src/foo.ts | Files that import this file |
GET /dependencies?file=src/foo.ts | Files this file imports |
GET /node?file=src/foo.ts | Full node record with export list |
Output files
Every scan writes to .whobreaks/ in your project root:
| File | Contents |
|---|---|
graph.json | Full dependency graph, machine-readable |
summary.md | Human-readable architecture overview |
Add .whobreaks/ to .gitignore or commit summary.md as living documentation.
Commands
npx whobreaks [path] # One-shot scan (default: current directory)
npx whobreaks watch [path] # Watch mode + HTTP API + dashboard
npx whobreaks mcp # MCP server (uses current directory)
Options:
| Flag | Default | Description |
|---|---|---|
--port <n> | 3001 | HTTP server port (watch mode) |
--max-files <n> | unlimited | Cap files scanned (useful for huge monorepos) |
--help | Show help |
How it works
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ whobreaks โ
โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ Watcher โโโ Analyzer โโโ Graph Store โ โ
โ โ(chokidar) โ โ (regex) โ โ (in-memory) โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโดโโโโโ โ
โ โ โ โ
โ โโโโโโโผโโโ โโโโโโโโโผโโโ โ
โ โ CLI โ โ MCP/HTTP โ โ
โ โ Output โ โ Server โ โ
โ โโโโโโโโโโ โโโโโโโโโโโโ โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโ โ
โ โ Web Dashboard โ โ
โ โ (D3 force graph) โ โ
โ โโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- Watcher โ chokidar watches
**/*.{ts,tsx,js,jsx}, debounces rapid changes - Analyzer โ regex-based import/export extraction on raw source text. Strips comments, extracts
import/exportstatements, resolves specifiers viatsconfig.jsonpaths, workspace package names, and filesystem probing. No compiler overhead โ scans 2,500 files in ~2.5s. - Graph Store โ in-memory
Map<string, FileNode>with forward and reverse indexes. Incremental updates on file change. - MCP Server โ @modelcontextprotocol/sdk exposes the graph to Claude Code, Cursor, Windsurf, and any MCP-compatible client.
- Dashboard โ single HTML file, D3 force-directed graph, served by the built-in HTTP server. No build step.
Compared to alternatives
| Tool | Weakness vs whobreaks |
|---|---|
code-graph-context | Requires Docker + Neo4j + OpenAI key |
typescript-graph | One-shot only, no watch mode, no AI integration |
madge | Only detects circular deps, no impact analysis |
ts-codebase-analyzer | Library only โ no CLI, no watch, no MCP |
whobreaks: npx whobreaks . โ no Docker, no API keys, no database. Zero config.
Development
git clone https://github.com/f1729/whobreaks
cd whobreaks
npm install
npm run build
node dist/index.js .
npm run dev # tsc --watch
License
MIT
