Tools Atlas
Dependency graph visualizer and monorepo health analyzer — cycle detection, impact analysis, bundle sizes, and health scores.
@vitus-labs/tools-atlas scans the workspace packages of a monorepo, analyzes their dependency graph, and writes a standalone interactive HTML page (rendered with ECharts) plus an AI-readable Markdown and/or JSON report with actionable suggestions. It detects circular dependencies, maps transitive impact, measures dependency depth, sizes lib/ output, flags external version drift, scores package health, and finds change hotspots from git history.
Installation
npm install @vitus-labs/tools-atlasRequirements
- Node.js
>= 22 giton thePATHfor the change-frequency analysis (skipped automatically outside a git repository)
Quick Start
Add a script to your package.json:
{
"scripts": {
"atlas": "vl_atlas"
}
}bun run atlasRun it from the monorepo root. With the defaults this:
- scans
packages/*forpackage.jsonfiles - writes
./atlas.htmland opens it in your browser - writes
./atlas-report.mdnext to the HTML file
CLI Options
vl_atlas [options]
-o, --output <path> Output HTML path (default: ./atlas.html)
-w, --workspaces <globs...> Workspace patterns (default: packages/*)
--dep-types <types...> Dependency types to include
--include <patterns...> Only include matching packages
--exclude <patterns...> Exclude matching packages
--no-open Do not auto-open the HTML
--title <title> Page title
--report <format> Generate report: markdown, json
--no-report Skip report generation| Flag | Notes |
|---|---|
--dep-types | Any of dependencies, devDependencies, peerDependencies. Unknown values are rejected. |
--report | markdown or json. Unknown values are rejected. To write both formats, set report: true in the config file. |
--include / --exclude | Matched against package names. A pattern containing * is a wildcard (@vitus-labs/*); a pattern without * is an exact name match. |
CLI flags override values from the config file; anything not passed on the command line falls back to the config file, then to the built-in defaults.
Since 2.8.0, --include / --exclude patterns without * match the exact package name. Earlier versions did substring matching, so --exclude core removed every package whose name contained "core".
Workspace patterns
Each positive pattern is resolved to <pattern>/package.json with tinyglobby; node_modules is always ignored. Explicit paths, nested globs (packages/*/x), **, and !-negated patterns are supported:
vl_atlas -w 'packages/*' 'apps/*' '!packages/legacy'Configuration
Defaults can be set in vl-tools.config.mjs under the atlas key (loaded via @vitus-labs/tools-core, cascading from the current directory upward):
// vl-tools.config.mjs
export default {
atlas: {
workspaces: ['packages/*'],
depTypes: ['dependencies', 'peerDependencies', 'devDependencies'],
include: [],
exclude: [],
outputPath: './atlas.html',
echartsCdn: 'https://cdn.jsdelivr.net/npm/echarts@5.6.1/dist/echarts.min.js',
open: true,
title: 'Atlas — Dependency Graph',
report: 'markdown',
},
}| Option | Type | Default | Description |
|---|---|---|---|
workspaces | string[] | ['packages/*'] | Glob patterns for workspace package directories |
depTypes | DepType[] | ['dependencies', 'peerDependencies', 'devDependencies'] | Dependency fields used to build graph edges |
include | string[] | [] | Only include packages whose name matches |
exclude | string[] | [] | Exclude packages whose name matches |
outputPath | string | './atlas.html' | HTML output path (resolved against the current directory) |
echartsCdn | string | jsDelivr ECharts 5.6.1 | Script URL for ECharts. The SRI integrity attribute is only emitted for the default URL |
open | boolean | true | Open the HTML in the browser after writing |
title | string | 'Atlas — Dependency Graph' | Page title |
report | boolean | 'markdown' | 'json' | 'markdown' | Report format; true writes both, false disables |
Analyses
| Analysis | What it computes |
|---|---|
| Cycles | Circular dependencies, found by DFS with white/gray/black coloring. Each cycle is normalized (rotated to start at its alphabetically smallest package) and deduplicated |
| Impact | For every package, the sorted list of packages that depend on it directly or transitively (reverse BFS) |
| Depth | Longest dependency chain per package, the maximum depth, and the critical path. Cycle edges are ignored so the graph is acyclic |
| Bundle size | Bytes on disk of each package's lib/ directory (own size) and own + all reachable workspace deps (transitive size). Symlinks are not followed |
| Version drift | External dependencies (not workspace packages) declared with more than one version range across packages, over all three dependency fields |
| Health score | 0–100 score per package with a list of contributing factors (see below) |
| Change frequency | Commits touching each package in the last 90 days, plus last-changed date, from a single git log. Hotspots are packages with ≥ 3 dependents and ≥ 10 commits |
Workspace dependencies that appear under several dependency fields produce a single edge; its depType is the strongest one (dependencies > peerDependencies > devDependencies) and depTypes lists all of them.
Health score
Every package starts at 100. Penalties and bonuses are applied, then the result is clamped to 0–100:
| Factor | Effect |
|---|---|
| In one or more cycles | −20 per cycle, max −40 |
| No dependents (orphan), when there is more than one package | −15 |
| Dependency depth > 3 | −10 |
| Involved in version drift | −5 per drifted dependency, max −20 |
| Has dependents | +5 per transitive dependent, max +20 |
| Changed in the last 90 days | +5 |
Packages with no penalties report the factor healthy.
Visualization
The HTML page is a single standalone file with a sidebar and three switchable chart views:
- Force — force-directed graph. Nodes are sized by impact; packages in a cycle get a red border.
- Tree — hierarchical layout by dependency depth.
- Matrix — N×N heatmap of dependency relationships.
The sidebar has a package search/filter, a dependency-type legend, and analysis panels (health, hotspots, and more). The title and embedded data are HTML-escaped.
Reports
Report files are written next to the HTML output, replacing .html with -report.md / -report.json (e.g. atlas-report.md). The Markdown report is structured for LLM consumption and contains these sections (empty sections are omitted):
# Atlas — Dependency Analysis Report
## Summary
- 12 packages, 25 dependencies
- Max dependency depth: 3
- Critical path: @scope/app -> @scope/ui -> @scope/core
## Circular Dependencies
## High-Impact Packages
## Deeply Nested Chains
## Dependency Type Distribution
## Packages With No Dependents
## Version Drift
## Bundle Size
## Health Scores
## Change Frequency HotspotsSuggestions are included for cycles ("extract shared types/interfaces into a separate package"), deep chains (depth > 3), and version drift ("align all packages to the same version"). The JSON report holds the same data — see AtlasReport JSON.
Programmatic Usage
import { generateAtlas } from '@vitus-labs/tools-atlas'
const result = await generateAtlas({
workspaces: ['packages/*'],
depTypes: ['dependencies', 'peerDependencies'],
include: [],
exclude: [],
outputPath: './atlas.html',
echartsCdn: 'https://cdn.jsdelivr.net/npm/echarts@5.6.1/dist/echarts.min.js',
open: false,
title: 'My Monorepo',
report: 'json',
})
console.log(result.htmlPath, result.reportPaths)generateAtlas() takes a complete AtlasConfig — it does not read vl-tools.config.mjs or apply defaults; only the CLI does. See the API reference.
Last updated on