Introduction
What Prune is, what problem it solves, and who it is for.
Prune is a static analysis tool for JavaScript and TypeScript projects. It identifies dead code by building a dependency graph from defined entrypoints and detecting any code that is unreachable from those roots.
It is written in Go, uses Tree-sitter for parsing, and is designed to run as a CLI command in local development and CI/CD pipelines.
What Problem It Solves
As a JavaScript or TypeScript project grows, it accumulates code that is no longer used: functions never called, variables never referenced, exports never imported, files never loaded. This dead code is not inert — it increases cognitive overhead, slows down reviewers, and can mask real bugs when developers assume that existing code is exercised.
Prune traces the dependency graph starting from your configured entrypoints and reports everything unreachable from those roots. It does not rely on runtime instrumentation or heuristics alone — it parses every file using Tree-sitter AST analysis to extract imports, exports, declarations, and usages at the syntax level.
What It Detects
| Finding Kind | Description |
|---|---|
unused_file | A file that is never imported by any other file reachable from entrypoints |
unused_export | An exported symbol (function, class, const) that is never imported |
unused_function | A function declared in a file but never referenced |
unused_variable | A variable declared in a file but never referenced |
possible_dynamic_usage | A possible dynamic usage detected via pattern match (e.g. feature flags) |
suspicious_dynamic_usage | A call to eval, Function, require, or import() that blocks static certainty |
Each finding is assigned a confidence level (safe, likely_dead, or review) based on context, and these levels are configurable per rule in prune.yaml.
Who It Is For
- Teams working on large JavaScript or TypeScript frontend codebases
- Engineers performing refactors and needing to identify safe deletion candidates
- CI/CD pipelines enforcing code hygiene standards
- Anyone who wants to understand what code is actually reachable in a project