Skip to content

Workflows

Copy-paste recipes for common tasks. Each flow respects the safety model: discover and measure before you delete.

Audit disk usage

Find where node_modules lives and how much disk it uses.

bash
# 1. Discover paths (read-only)
nodehunter scan ~/Projects -D 5

# 2. Measure physical disk
nodehunter size ~/Projects --full

# 3. Rank largest projects
nodehunter list ~/Projects --top 10

Narrow scope with -p or -D if the walk is slow. See Discovery flags.

Investigate a package

Understand duplication before changing dependencies.

bash
nodehunter find react ~/company
nodehunter why react ~/company
nodehunter inspect ~/company --focus duplicates

Use --json when feeding results into scripts. See JSON output.

Safe local cleanup

Remove one project's node_modules after review.

bash
nodehunter size ~/Projects/old-client
nodehunter delete ~/Projects/old-client
# confirm at prompt — default is no

Never alias delete to a shorter command you might run by habit.

Monorepo shallow pass

Limit depth when you only care about top-level apps.

bash
nodehunter size ~/monorepo -D 3 --top 15
nodehunter inspect ~/monorepo -D 3 --focus drift

CI: measure without logs

Emit one JSON object for gates or artifacts.

bash
nodehunter size ./checkout --json --silent > size.json
test "$(jq -r .ok size.json)" = "true"

CI: automated delete (use with care)

Only after a scoped preview step you trust.

bash
# Preview (separate job or earlier step)
nodehunter size "$TARGET" --json --silent > preview.json

# Delete — requires explicit --yes and a narrow TARGET
nodehunter delete "$TARGET" --yes --json --silent

Refused deletes in piped shells without --yes are intentional. See Safety model.

When nothing matches

bash
nodehunter scan ~/proj -D 2    # try deeper
nodehunter scan ~/proj -nd     # include default-ignored dirs