Llinuxctrl
CLI Reference

CLI Commands

Install spyglass globally and run it from anywhere in your project:

npm install -g @linuxctrl/spyglass

spyglass graph

Display the dependency tree with npm download counts, disk size, and outdated version warnings. Works with npm, yarn, pnpm, and bun workspaces.

spyglass graph
spyglass graph --path ./packages/core
spyglass graph --production
spyglass graph --no-npm

Example output:

spyglass — Dependency Graph
  ──────────────────────────────────────────────────

    ● hono 4.12.25    46.1M/wk   1.4 MB   (! 4.12.26 available)
    ● react 19.2.7    145.6M/wk  167.6 KB
    ● @types/node 22.20.0  368.0M/wk  2.3 MB
       └── undici-types 6.21.0

  ──────────────────────────────────────────────────
  Summary
    Packages:   3 roots, 4 total
    Disk:       24.1 MB
    Outdated:   1

spyglass circular

Detect circular dependencies in your project. Walks the full dependency tree and reports any cycles found.

spyglass circular
spyglass circular --path ./packages/core

Each cycle is reported as a chain: a → b → c → a. Fixing circular deps can improve startup time and prevent runtime errors.

spyglass unused

Find dependencies listed in package.json that are not actually used anywhere in the dependency tree. Also shows npm download counts for each unused package.

spyglass unused
spyglass unused --production
spyglass unused --no-npm

With --production, only checks dependencies (skips devDependencies).

spyglass why <package>

Trace why a specific package is in your dependency tree. Shows the full resolution path with version, outdated warning, description, and weekly downloads from npm.

spyglass why react
spyglass why next
spyglass why lodash

Example output:

spyglass — Why typescript?

    └── typescript 5.9.3  (! 6.0.3 available)

  TypeScript is a language for application scale JavaScript development
  215.9M weekly downloads

Options

FlagDescription
--path <dir>Root project directory (default: current dir)
--productionOnly check dependencies, skip devDependencies
--no-npmSkip npm registry lookups for faster results