— Tooling · @vitus-labs/tools-atlas

See your monorepo. Then fix it.

vl_atlas scans your workspace packages, draws how they depend on each other as an interactive page, and writes a report with a suggestion next to each finding: the cycle to break, the versions to align, the busy package everything depends on. People read the page; assistants read the Markdown or JSON.

@vitus-labs/tools-atlasv2.9.1 · MIT
npm i -D @vitus-labs/tools-atlas
analyses per run
7
graph views: force, tree, matrix
3
health score per package
0–100

— Why tools · atlas

Questions you were answering with grep.

01

Seven analyses, one command

Cycles, transitive impact, chain depth with the critical path, bundle size, version drift, a health score and git change frequency, all computed from the same package graph.

02

A report that says what to do

Each cycle and deep chain comes with a suggestion, each drift with the dependency to align, and hotspots with the reason they are risky. Markdown for people and pull requests, JSON for scripts and AI assistants.

03

A score you can read

Every package starts at 100. A cycle costs 20 (40 at most), no dependents 15, depth over 3 costs 10, each drift 5 (20 at most). Dependents earn up to 20 back and recent commits 5. The reasons are listed next to the number.

04

Hotspots from git history

Commits from the last 90 days are counted per package. A package with at least 3 dependents and 10 commits is flagged: it changes often and breaks a lot when it does.

— Before / after

From shell one-liners to a report.

The usual audit is a handful of commands that each answer one question, and nothing answers cycles or transitive impact.

beforeAd-hoc auditing
terminal
# who depends on @acme/core?
grep -l '"@acme/core"' packages/*/package.json

# which react ranges are in use?
for f in packages/*/package.json; do
  jq -r '.dependencies.react // .peerDependencies.react // empty' "$f"
done | sort | uniq -c

# what changed most this quarter?
git log --since=90.days --name-only --format= -- packages \
  | cut -d/ -f2 | sort | uniq -c | sort -rn

# cycles? transitive impact? chain depth? nobody checks.

Each question is its own script, and the output is raw text you still have to interpret.

after@vitus-labs/tools-atlas
terminal · atlas-report.md
npx vl_atlas --no-open

# writes atlas.html (force, tree and matrix views)
# and atlas-report.md, with findings like:

# ## Circular Dependencies
# 1. @vitus-labs/elements -> @vitus-labs/rocketstyle -> @vitus-labs/elements
#    Suggestion: Extract shared types/interfaces into a
#    separate package to break this cycle.

One run writes the interactive page and the report. Below, a finding from the UI system repo.

— Features

What a run gives you.

  • Force view

    a force-directed graph, nodes sized by impact, cycle members in red

  • Tree view

    a layered layout by dependency depth

  • Matrix view

    an N×N heatmap of who depends on whom

  • Sidebar

    search, filters, a dependency-type legend and the analysis panels

  • --report

    markdown or json; report: true in config writes both

  • --workspaces

    glob patterns for package folders; ! patterns exclude

  • --dep-types

    any of dependencies, peerDependencies, devDependencies

  • --include · --exclude

    exact package names, or * wildcards such as @acme/*

  • Typed edges

    one edge per pair, with its strongest type and every type it appears under

  • echartsCdn

    swap the chart script URL; the default one is pinned with an SRI hash

  • generateAtlas()

    the same run from code, returning the paths it wrote

— API

One command. One function. Typed results.

Every name links to its reference in the docs.

— Honest limits

Read the numbers with care.

Where it isn't the right fit, and what to reach for instead.

  • Workspaces come from its config

    Packages are found with the workspaces globs in Atlas config (default packages/*), not your package manager's workspace list. Set them, or pass -w, when packages live in apps/ or libs/.

  • Bundle size is bytes on disk

    It sums the shipped JavaScript in each package's lib/ (.js, .mjs, .cjs, minus paths your files field negates), uncompressed and without tree-shaking. Build first, and use a tool like size-limit for real budgets.

  • Drift compares range strings

    Installed specs are compared with installed specs and peer ranges with peer ranges, as written: ^18.2.0 and ^18.3.0 are drift even when both install the same version. Treat the list as things to review, not errors.

  • Entry packages count as orphans

    A package nothing else in the repo depends on loses 15 points as an orphan, even when it is a public entry point by design. Compare scores within a repo; don't chase 100.

  • The page needs the network

    The HTML loads ECharts from jsDelivr. For offline or locked-down viewing, point echartsCdn at a copy you host. Outside a git repository there is no change frequency and no hotspots.

— Recipes

Copy, paste, ship.

01

A JSON report in CI

No browser, no HTML to look at: keep the JSON next to the build artifacts, for a dashboard script or an assistant to read.

terminal
npx vl_atlas --no-open --report json -o reports/atlas.html
# → reports/atlas.html
# → reports/atlas-report.json
02

A repo that isn't packages/*

Several workspace roots, an excluded legacy folder, production edges only, and both report formats.

vl-tools.config.mjs
export default {
  atlas: {
    workspaces: ['apps/*', 'libs/*', '!libs/legacy-*'],
    depTypes: ['dependencies', 'peerDependencies'],
    exclude: ['@acme/e2e-*'],
    report: true,
  },
}
03

Fail the build on a new cycle

generateAtlas() takes the complete config (defaults are applied only by the CLI) and returns the paths it wrote.

scripts/atlas-check.ts
import { readFileSync } from 'node:fs'
import { generateAtlas } from '@vitus-labs/tools-atlas'

const { reportPath } = 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: 'Dependency graph',
  report: 'json',
})

const report = JSON.parse(readFileSync(reportPath!, 'utf8'))
if (report.summary.cycles > 0) process.exit(1)

— FAQ

Questions, answered.

Does it read external dependencies?

Edges only connect packages inside the workspace. External dependencies appear in the version drift analysis, not in the graph.

Where do the files go?

The page goes to outputPath (default ./atlas.html); the report sits next to it as atlas-report.md or atlas-report.json.

Why does the report matter for AI assistants?

It is plain Markdown or JSON with findings and suggestions already worked out, so an assistant can act on it without parsing manifests or git history itself.

Who uses it?

The Vitus Labs UI system runs it as its atlas script. The cycle in the example above is a real one there: a story-only link between elements and rocketstyle.

— @vitus-labs/tools-atlas

Map it once. Then keep it healthy.

npm i -D @vitus-labs/tools-atlas
Sources · 36 claims, each traced to v2.9.1 code or docs
  1. CLI vl_atlastools:packages/atlas/package.json
  2. Seven analyses: cycles, impact, depth, bundle size, version drift, health score, change frequencytools:packages/atlas/src/generateAtlas.ts
  3. Analysis list and methods (DFS cycles, reverse BFS impact, critical path)tools:packages/atlas/README.md
  4. Three views: force (sized by impact, cycle nodes red), tree, matrix; sidebar with search/filter and legendtools:packages/atlas/README.md
  5. Matrix view is an NxN heatmaptools:packages/atlas/README.md
  6. Health score 0-100 per packagetools:packages/atlas/src/analysis/health-score.ts
  7. Cycle penalty 20 each, max 40tools:packages/atlas/src/analysis/health-score.ts
  8. Orphan penalty 15tools:packages/atlas/src/analysis/health-score.ts
  9. Depth > 3 penalty 10tools:packages/atlas/src/analysis/health-score.ts
  10. Drift penalty 5 each, max 20tools:packages/atlas/src/analysis/health-score.ts
  11. Dependents bonus up to 20; recent commits +5tools:packages/atlas/src/analysis/health-score.ts
  12. Change frequency counts commits from the last 90 daystools:packages/atlas/src/analysis/change-frequency.ts
  13. Hotspot = at least 3 dependents and 10 commitstools:packages/atlas/src/analysis/change-frequency.ts
  14. No git repository → no change frequencytools:packages/atlas/src/analysis/change-frequency.ts
  15. Report suggestions for cycles, deep chains, drifttools:packages/atlas/src/renderer/report.ts
  16. Drift suggestion names the dependency to aligntools:packages/atlas/src/renderer/report.ts
  17. report: true writes both formats; files are <name>-report.md / .json next to the HTMLtools:packages/atlas/src/renderer/renderer.ts
  18. Report formats markdown/json validated by the CLI; --no-open, -otools:packages/atlas/src/bin/run-atlas.ts
  19. Default outputPath ./atlas.html, workspaces packages/*, ECharts from jsDelivrtools:packages/atlas/src/config/baseConfig.ts
  20. SRI hash only for the default ECharts URLtools:packages/atlas/src/renderer/template.ts
  21. Workspace globs from Atlas config; ! patterns excludetools:packages/atlas/src/scanner/scanner.ts
  22. include/exclude: exact names or * wildcardstools:packages/atlas/README.md
  23. Dependency types: dependencies, devDependencies, peerDependenciestools:packages/atlas/src/types.ts
  24. One edge per pair with strongest type plus all typestools:packages/atlas/src/types.ts
  25. Edges only between workspace packagestools:packages/atlas/src/scanner/scanner.ts
  26. Bundle size sums shipped .js / .mjs / .cjs under lib/ (raw bytes)tools:packages/atlas/src/analysis/bundle-size.ts
  27. Paths excluded by !-negated package.json files entries are skippedtools:packages/atlas/src/analysis/bundle-size.ts
  28. File sizes are read with statSync (uncompressed)tools:packages/atlas/src/analysis/bundle-size.ts
  29. Drift compares install specs (dependencies + devDependencies) with each other and peer ranges only with peer rangestools:packages/atlas/src/analysis/version-drift.ts
  30. Specs are compared as written (string keys per dependency)tools:packages/atlas/src/analysis/version-drift.ts
  31. generateAtlas takes a complete config; defaults only applied by the CLItools:packages/atlas/README.md
  32. generateAtlas returns the written pathstools:packages/atlas/src/renderer/renderer.ts
  33. JSON report has summary.cyclestools:packages/atlas/src/renderer/report.ts
  34. Exported typestools:packages/atlas/src/index.ts
  35. UI system runs vl_atlas as its atlas scriptui-system:package.json
  36. elements ↔ rocketstyle cycle in the UI system is story-onlyui-system:CLAUDE.md