Skip to Content
vitus·labs
Tools Atlas

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-atlas

Requirements

  • Node.js >= 22
  • git on the PATH for 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 atlas

Run it from the monorepo root. With the defaults this:

  • scans packages/* for package.json files
  • writes ./atlas.html and opens it in your browser
  • writes ./atlas-report.md next 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
FlagNotes
--dep-typesAny of dependencies, devDependencies, peerDependencies. Unknown values are rejected.
--reportmarkdown or json. Unknown values are rejected. To write both formats, set report: true in the config file.
--include / --excludeMatched 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',
  },
}
OptionTypeDefaultDescription
workspacesstring[]['packages/*']Glob patterns for workspace package directories
depTypesDepType[]['dependencies', 'peerDependencies', 'devDependencies']Dependency fields used to build graph edges
includestring[][]Only include packages whose name matches
excludestring[][]Exclude packages whose name matches
outputPathstring'./atlas.html'HTML output path (resolved against the current directory)
echartsCdnstringjsDelivr ECharts 5.6.1Script URL for ECharts. The SRI integrity attribute is only emitted for the default URL
openbooleantrueOpen the HTML in the browser after writing
titlestring'Atlas — Dependency Graph'Page title
reportboolean | 'markdown' | 'json''markdown'Report format; true writes both, false disables

Analyses

AnalysisWhat it computes
CyclesCircular dependencies, found by DFS with white/gray/black coloring. Each cycle is normalized (rotated to start at its alphabetically smallest package) and deduplicated
ImpactFor every package, the sorted list of packages that depend on it directly or transitively (reverse BFS)
DepthLongest dependency chain per package, the maximum depth, and the critical path. Cycle edges are ignored so the graph is acyclic
Bundle sizeBytes on disk of each package's lib/ directory (own size) and own + all reachable workspace deps (transitive size). Symlinks are not followed
Version driftExternal dependencies (not workspace packages) declared with more than one version range across packages, over all three dependency fields
Health score0–100 score per package with a list of contributing factors (see below)
Change frequencyCommits 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:

FactorEffect
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 Hotspots

Suggestions 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.

Edit on GitHub

Last updated on

On this page