Skip to content
@pyreon/loom
tools · monorepo health

Find the imports that only work by luck.

Loom reads every package.json and every source import in your workspace, then names the runtime cycles, undeclared imports, version splits and the blast radius of each package. One command fails CI on real errors; another opens the whole graph in your browser.

npx @pyreon/loom scan .
Documentation
reads
npm, bun, yarn and pnpm workspaces
finding codes
8each graded error, warning or info
network
nonemanifests and source only
our own repo
129 packages751 internal edges, 0 cycles
The loom observatory run on the Pyreon monorepo: a dependency graph layered by resolution depth fanning out from @pyreon/docs, a package list on the left, and a detail panel with metrics and the 42 packages it depends on; the status bar reads 148 internal packages, 858 edges, 0 cycles, 0 errors.The loom observatory run on the Pyreon monorepo: a dependency graph layered by resolution depth fanning out from @pyreon/docs, a package list on the left, and a detail panel with metrics and the 42 packages it depends on; the status bar reads 148 internal packages, 858 edges, 0 cycles, 0 errors.
  • 751 internal dependency edges mapped across Pyreon's own 129-package workspace, with 0 runtime cycles and 0 errorsloom scan . on main (7cc82420e), 2026-11-18
  • 98 workspace packages downstream of @pyreon/reactivity: its blast radius, countedreport.graph.reach from the same scan
  • 374 ms warm scan of the whole Pyreon monorepo (overnight run, one run)benchmark record 2026-11-05, §11

synthetic · author-run · M3 Max · record of 2026-11-05

Every result, including where we lose →
why teams pick it

The bugs that hide between package.json files.

  1. Imports that work by luck

    A package imports something its manifest never declares, and it resolves only because a neighbour installed it. Loom calls that phantom-dep: an error in a published package, a warning in a private one. Type-only imports are tracked apart, so import type from a devDependency is never flagged.

  2. Cycles without the noise

    Cycles are computed over runtime edges (dependencies, peerDependencies and optionalDependencies) only. Test utilities that depend on each other through devDependencies never show up as circular, so a cycle finding is worth reading.

  3. Version drift with context

    Cross-major drift is an error, same-major a warning, a split that a root override already pins is info. Peer ranges count as contracts, and a range like >=5.0.0 <7.0.0 that contains the others reads as policy, not disagreement.

  4. Blast radius, counted

    Every package gets its transitive dependents. In Pyreon's own repo, a change to @pyreon/reactivity reaches 98 of 129 packages. Rank the list, gate on it, or hand it to your AI assistant.

the difference

Green CI. Three errors.

your workspace

Everything installs and builds, because hoisting puts a transitive nanoid and the devDependency zod where the imports look for them. On a stricter install, or for a consumer of @acme/app, it breaks.

// package.json (root)
{ "workspaces": ["packages/*"], "devDependencies": { "vite": "^7.0.0" } }
// packages/app/package.json
{ "dependencies": { "@acme/auth": "workspace:*", "date-fns": "^2.30.0" } }
// packages/auth/package.json
{ "dependencies": { "@acme/data": "workspace:*", "date-fns": "^3.6.0" } }
// packages/data/package.json
{ "dependencies": { "@acme/auth": "workspace:*" },
  "devDependencies": { "zod": "^3.23.0" } }

// packages/app/src/index.ts
import { nanoid } from 'nanoid'   // declared nowhere: vite → postcss hoists it

// packages/data/src/index.ts
import { z } from 'zod'           // a devDependency

// install, build, test: all green
loom scan

Real output on that workspace, wrapped to fit, the cycle and zod lines cut short. Exit code 1, so CI stops here.

$ npx @pyreon/loom scan . --no-write
loom: 3 workspace package(s), 2 external dep(s), 3 internal edge(s), depth 2, 1 cycle(s).

ERROR · 3
  ✗ cycle — Runtime dependency cycle: @acme/auth → @acme/data → @acme/auth
  ✗ phantom-dep [nanoid] — `@acme/app` imports `nanoid` in shipping source
    but never declares it — resolvable only through hoisting luck
  ✗ version-drift [date-fns] — `date-fns` is declared with 2 different
    ranges (^2.30.0 · ^3.6.0) — the majors differ, so packages are
    building against different APIs

WARNING · 1
  ▲ prod-import-of-dev-dep [zod] — `@acme/data` imports `zod` in shipping
    source but declares it only in devDependencies
loom: 3 error(s)                                   # exit code 1
coming from

Coming from syncpack + knip?

Two tools, two configs, one scan

syncpack + knip
# version drift
npx syncpack lint

# undeclared and unused dependencies
npx knip
Pyreon

On the same three-package workspace as above: syncpack lint flagged the date-fns split and knip flagged the undeclared nanoid import. loom scan flagged both, plus the @acme/auth ↔ @acme/data cycle and zod imported from devDependencies. knip also finds unused files and exports, which Loom does not.

# drift, cycles, phantom deps, dev deps in
# shipping code, peer mismatches, unused deps
npx @pyreon/loom scan .
try it

The observatory, live.

A sample workspace in the observatory. Click a package to see what depends on it, then switch to the matrix, cycles and impact views.

14 packages · 22 edges · 1 cycle · 4 errors · 1 warnings · 6 info

@acme/ui

2.0.0

needed by

8 packages depend on it, directly or through others.

depends on
findings · 3
  • errorinternal-range `@acme/dashboard` declares workspace member `@acme/ui` as `^1.0.0` (not `workspace:`) — a version slip silently installs the REGISTRY copy instead of linking the workspace; as a peer range it also misses the workspace copy (2.0.0) by a major
  • errorphantom-dep `@acme/ui` imports `clsx` in shipping source but never declares it — resolvable only through hoisting luck
  • infounused-dep `@acme/ui` declares `lodash-es` as a dependency but no source file imports it — lexical evidence only (bins/plugins/CSS load without an import statement); verify before removing

real output · the loom scan report of a sample workspace (its files are in docs/scripts/capture-loom-demo.ts), captured 2026-11-23

benchmarks

The whole monorepo, scanned in 374 ms.

A warm loom scan of the Pyreon monorepo itself. Almost all of it (98.3%) is reading source imports.

Pyreon-only (no competitor)Pyreonrival · lower is better
  • warm scan of the Pyreon monorepo
    measured98.3% import scanning
Apple M3 Max · record of 2026-11-05 · overnight run, one run, warm cache · author-run, syntheticFull method, every loss →
what's included

Dependency analysis as data.

  • Workspace discovery npm, bun and yarn workspaces (array and object forms), pnpm-workspace.yaml, nested globs like packages/*/*, ** and negations.
  • Runtime and dev edges, apart dependencies and peers drive cycles, depth and reach; devDependencies are tracked on their own.
  • 8 finding codes version-drift, internal-range, cycle, phantom-dep, phantom-type-dep, prod-import-of-dev-dep, unused-dep, stale-ignore.
  • Type-aware import scan import type, export type and every import in a .d.ts are counted apart from runtime imports.
  • tsconfig paths understood aliases like ~/* or @app/* are read from the package and root tsconfig (one relative extends hop), so they do not scan as missing packages.
  • Severity follows the audience a private package has no consumers, so its phantom import is a warning and its dev-dep import is info.
  • Ignores need a reason an ignore entry without one is rejected: “an unexplained suppression is a lie waiting to age”. Ignored findings stay in the report as info, reason attached.
  • Adopt it gradually severity overrides per code, strict, and devPaths for code that never ships, in package.json or pyreon.config.*.
  • Observatory and static site loom dev serves graph, matrix, cycles, impact and manifest views with ⌘K search; loom build prerenders one page per view that opens from file://.
  • Feeds doctor and your assistant pyreon doctor runs it as the dependency-fabric gate when Loom is installed, and the MCP tool get_dependency_fabric serves loom-report.json to your AI.
recipes

Things to build with it.

Gate CI on the dependency fabric

One step. It exits 1 on any error finding; --no-write skips loom-report.json when you only want the verdict.

# .github/workflows/ci.yml
- name: Dependency fabric
  run: npx @pyreon/loom scan . --no-write
  # exits 1 on any error finding
  # add --strict to fail on warnings too
Rank packages by blast radius

The graph behind loom scan, as data. On this repo the top of the list is the compiler's seven per-platform binaries (108 dependents each) and @pyreon/compiler (107); @pyreon/reactivity reaches 98.

// scripts/blast-radius.ts
import { buildReport, loadSharedLoomConfig, mergeLoomSettings, readManifestLoomSection, validateLoomSection } from '@pyreon/loom/core'

// the settings `loom scan` applies: pyreon.config.* merged with the package.json `loom` key
const shared = await loadSharedLoomConfig('.')
const manifest = validateLoomSection(readManifestLoomSection('.'), 'package.json')
const report = buildReport('.', { settings: mergeLoomSettings(shared, manifest) })

// The ten packages whose change reaches the most of the workspace.
const top = Object.entries(report.graph.reach)
  .sort(([, a], [, b]) => b - a)
  .slice(0, 10)
for (const [pkg, dependents] of top) console.log(`${dependents}\t${pkg}`)

const errors = report.issues.filter((i) => i.severity === 'error')
if (errors.length > 0) process.exitCode = 1
Adopt it on an existing repo

Raise a code to error once it is clean, mark files that never ship but sit outside the test and script folders loom already skips, and wave one finding through with a reason that shows up in every report.

// package.json (root)
{
  "workspaces": ["packages/*"],
  "loom": {
    "devPaths": ["src/manifest.ts", "**/*.gen.ts"],
    "severity": { "prod-import-of-dev-dep": "error" },
    "ignore": [
      {
        "pkg": "@acme/app",
        "dep": "nanoid",
        "code": "phantom-dep",
        "reason": "provided by the host app at runtime"
      }
    ]
  }
}
api

Three commands, one report.

Every export has a reference page with its signature, an example and the mistakes people make with it.

entries · 5
  • @pyreon/loom
  • @pyreon/loom/core
  • @pyreon/loom/ui
  • @pyreon/loom/dev
  • @pyreon/loom/cli
flags · 7
  • --strict
  • --json
  • --no-imports
  • --no-write
  • --port
  • --out
  • --base
@pyreon/loom/core · 10
  • buildReport
  • scanWorkspace
  • analyzeGraph
  • externalUsage
  • detectVersionDrift
  • detectInternalRange
  • detectCycles
  • detectPhantoms
  • detectUnused
  • ISSUE_CODES
@pyreon/loom/ui · /dev · 3
  • Observatory
  • mountObservatory
  • startDevServer
config (loom key) · 4
  • devPaths
  • ignore
  • strict
  • severity
good to know

Good to know before you start.

Declared truth only

Loom reads manifests and source, never the lockfile or the registry, so it does not report outdated versions or duplicate installs.

A package graph, not a module graph

Cycles are found between workspace packages from their declared runtime dependencies. For import loops between files inside one package, pair it with a file-level tool.

The import scan is lexical

Comments and template literals are stripped, but a package name in an ordinary string (a code generator emitting imports, say) can read as an import. Ignore it with a reason; this repo does that for its own generator.

unused-dep is a lead, not a verdict

Bins, plugin autoloads and CSS imports load without an import statement. That is why the finding is info: check before you delete.

The UI has peers

loom scan needs nothing else. loom dev needs vite and @pyreon/vite-plugin, and loom build also @pyreon/zero; each names the install when they are missing.

questions

What people ask first.

Does it need a config file?

No. It reads the workspaces field of your root package.json, or pnpm-workspace.yaml. The loom config key is optional.

Is it only for Pyreon projects?

No. loom scan reads any npm, bun, yarn or pnpm workspace. The example on this page has no Pyreon package in it.

Will it slow CI down?

A warm scan of the Pyreon monorepo took 374 ms in our overnight benchmark run, and 98.3% of that is the import scan. --no-imports skips it if you only want drift, ranges, cycles and peers.

What if I run it inside one package by mistake?

It fails and names the workspace root to scan instead. An empty scan never reads as a pass.

Is the report format stable?

Finding codes are stable identifiers in loom-report.json, but the README still says the API and the findings vocabulary may still move. Pin the version you gate on.

The graph was always there. Now you can read it.

npx @pyreon/loom scan .
Read the Loom guide