Quick Start
Run your first dead code scan in under two minutes.
This guide walks through the minimum steps to get Prune scanning a JavaScript or TypeScript project.
Step 1 — Initialize a configuration file
Inside your project root, run:
prune initThis creates a prune.yaml file in the current directory with sensible defaults. The default configuration assumes a project in the js-ts language mode and scans the current directory for .js, .jsx, .ts, and .tsx files.
version: 1
version: 2
project:
name: prune
language: js-ts
ts_config:
enabled: true
baseUrl: .
paths:
"@/*":
- src/*
scan:
paths:
- .
include:
- '**/*.js'
- '**/*.jsx'
- '**/*.ts'
- '**/*.tsx'
exclude:
- node_modules/**
- dist/**
- build/**
- .next/**
- out/**
- coverage/**
entrypoints:
files:
- src/index.ts
- src/main.tsx
patterns:
- src/pages/**
- src/routes/**
# ...rules and report sections omitted for brevityStep 2 — Edit the entrypoints
Open prune.yaml and update entrypoints.files and entrypoints.patterns to match your project structure. Entrypoints are the roots of the dependency graph — code reachable from them is considered alive.
entrypoints:
files:
- src/index.ts # main application entry
patterns:
- src/pages/** # Next.js page files (each is an entry)
- src/routes/** # React Router route filesStep 3 — Run a scan
prune scanPrune reads prune.yaml from the current directory, walks the declared scan paths, parses every matching file, and prints findings to stdout.
Example output (pretty format):
Prune 0.3.0-beta.1 — 4 issues found in 340ms
✔ SAFE (2)
src/utils/legacy.ts
└─ unused file: legacy.ts
src/components/Button.tsx
└─ unused export: OldButtonVariant
⚠ LIKELY DEAD (1)
src/lib/helpers.ts
└─ unused function: formatDeprecated
⚠ REVIEW (1)
src/loader.ts
└─ suspicious dynamic usage: require
─────────────────────────────────
Summary
Files 1
Exports 1
Functions 1
Dynamic 1
SAFE 2
LIKELY DEAD 1
REVIEW 1
Total 4
Done in 340msIf no dead code is found:
✨ No dead code found!
Scan finished in 280msStep 4 — Filter by confidence
Use --min-confidence to suppress noise:
# Show only findings that are definitely safe to delete
prune scan --min-confidence safe
# Include likely dead code (but not review-level warnings)
prune scan --min-confidence likely_deadThe three confidence levels are ordered: safe < likely_dead < review. Passing --min-confidence safe shows everything at or above safe (i.e., all findings).
The --min-confidence flag filters which findings are printed. It does not affect what Prune analyzes.