prune

CLI Reference

All Prune commands, flags, and exit codes.

Prune is invoked as:

prune <command> [flags]

If no command is given, Prune prints usage to stderr and exits.


Commands

version

Prints the installed version of Prune and exits.

prune version

Output:

prune version  0.3.0-beta.1

No flags are accepted by this command.


init

Generates a prune.yaml configuration file with default values in the current directory.

prune init

Flags:

FlagTypeDefaultDescription
--outstringprune.yamlOutput path for the generated configuration file

Example — write config to a custom path:

prune init --out config/prune.yaml

Output on success:

✅ Created prune.yaml

This command does not overwrite an existing file — it will fail if the destination path already exists.


scan

Analyzes the project and reports dead code findings.

prune scan [flags]

Flags:

FlagTypeDefaultDescription
--configstringprune.yamlPath to the Prune configuration file
--formatstringprettyOutput format: pretty, json, ndjson, or table (alias for pretty)
--min-confidencestringsafeMinimum confidence level to include in output: safe, likely_dead, or review
--pathsstring (repeatable)(from config)Override scan paths. Can be specified multiple times
--fail-on-findingsboolfalseExit with a non-zero status code if any findings match the confidence filter
--streamboolfalseEnable streaming mode — emit findings incrementally as files are processed
--stream-intervalint250Interval in milliseconds between streaming flushes
--compactboolfalseShow only summary counts, without individual findings
--onlystring""Show only findings with this confidence level: safe, review, or likely_dead
--deletableboolfalseShow only files that are safe to delete (no living imports)

Examples:

# Basic scan using default config
prune scan

# Scan using a specific config file
prune scan --config path/to/prune.yaml

# Output as JSON
prune scan --format json

# Fail the process if any findings are found (for CI/CD)
prune scan --fail-on-findings

# Override scan paths
prune scan --paths src/components --paths src/lib

# Show only summary counts
prune scan --compact

# Show only findings with likely_dead confidence
prune scan --only likely_dead

# Show only files safe to delete
prune scan --deletable

# Stream findings as NDJSON in real time
prune scan --stream --format ndjson

# Stream with a faster flush interval
prune scan --stream --stream-interval 100

Notes on streaming:

When --stream is enabled and --format is json, the format is automatically promoted to ndjson. The pretty and table formats are not supported in streaming mode — only ndjson produces streamed output; for other formats, the stream flag enables batched collection but output is still printed once after completion.


rules

Lists all available rule IDs and their descriptions.

prune rules

No flags are accepted.

Output:

RULE ID                     DESCRIPTION
unused_function             Function declared but never used
unused_variable             Variable declared but never used
unused_export               Exported symbol never imported
unused_file                 File never imported or referenced
possible_dynamic_usage      Possible dynamic usage detected via pattern match
suspicious_dynamic_usage    Dynamic usage that blocks certainty

help

Prints the top-level usage message to stdout.

prune help
# or
prune -h
# or
prune --help

Exit Codes

CodeCondition
0Command completed successfully. In scan, this means no error occurred — findings may still be present.
1An error occurred (unrecognized command, config load failure, I/O error, etc.)
1--fail-on-findings is set and at least one finding passes the --min-confidence filter

The scan command exits 0 even if there are findings, unless --fail-on-findings is explicitly set. This makes it safe to use in report-only mode without affecting pipeline status.

On this page