ghostdep π»
A fast, cross-language phantom dependency detector.
ghostdep scans your project and finds two things:
- Phantom dependencies β packages you import in code but forgot to add to your manifest
- Unused dependencies β packages declared in your manifest that nothing actually imports
It works across Go, JavaScript/TypeScript, Python, Rust, and Java. Single binary, zero runtime dependencies, built in Rust.
Why does this matter?
Phantom dependencies are a real problem:
- Your code works locally because some transitive dep happens to provide the package
- CI breaks, or worse β production breaks when that transitive dep gets removed
- Supply chain attacks can exploit undeclared dependencies
Unused dependencies are less dangerous but still annoying:
- Bloated install times
- Larger container images
- Confusing dependency lists for new contributors
ghostdep catches both in milliseconds.
How it works
source files βββ AST parser βββ import list βββ
ββββ matching engine βββ findings
manifest file βββ manifest parser βββ dep list β
- Walks your project directory
- Parses source files using tree-sitter (Go, Python, Rust, Java) or OXC (JS/TS) to extract imports
- Parses your manifest file to get declared dependencies
- Cross-references the two lists
- Reports whatβs missing and whatβs unused
Quick example
$ ghostdep -p my-project
[phantom] axios at src/api.js:3 (confidence: high)
[unused] lodash at package.json (confidence: high)
Found 1 phantom and 1 unused dependencies (12 files scanned in 3ms)