π Murder your node_modules. Free your disk. Lightning fast.
$ modkill --path ~/Projects --depth 4
β Scan complete: 42 candidate(s)
Project (relative path below) Size Age
β old-project 1.98 GB 482d
old-project/frontend
β abandoned-poc 856 MB 127d
experiments/abandoned-poc
β― active-project 328 MB 3d
work/active-project
Total to free: 2.8 GB
? Proceed to delete 2 folders? (y/N)Every developer's disk is littered with forgotten node_modules folders:
- Gigabytes wasted: Each project can have 100MB-2GB of dependencies
- Accumulation: Old projects, experiments, tutorials pile up over months
- Hidden bloat: Nested in various directories, hard to find manually
modkill solves this with:
- β‘ Fast parallel scanning using optimized filesystem traversal
- π§ Smart detection of abandoned projects by age and size
- π‘οΈ Safe by default with dry-run, trash, and restore logs
- π¨ Beautiful UX with interactive selection and progress indicators
- π§ Flexible with JSON output for automation
# Quick one-time use
npx @lisandrof/modkill
# Global install
npm install -g @lisandrof/modkill
# Using Yarn
yarn global add @lisandrof/modkill
# Using pnpm
pnpm add -g @lisandrof/modkill- Node.js 18.0.0 or higher
- macOS, Linux, or Windows
- 50MB free RAM
# Interactive mode - select what to delete
modkill
# Scan your entire home directory
modkill --path ~ --depth 4
# Auto-clean old modules (>30 days)
modkill --auto
# Preview without deleting anything
modkill --dry-run
# Clean current project only
modkill --current| Command | Description |
|---|---|
modkill |
Interactive mode with checkbox selection |
modkill --auto |
Automatically clean old modules (>30 days) |
modkill --dry-run |
Preview what would be deleted |
modkill --current |
Clean only current directory |
| Option | Type | Default | Description |
|---|---|---|---|
--path <dir> |
string | . |
Root directory to scan |
--depth <n> |
number | 6 |
Max recursion depth |
--min-age <days> |
number | 0 |
Only show modules older than N days |
--min-size <mb> |
number | 0 |
Only show modules larger than N MB |
--sort <by> |
string | size |
One of: size, age, name, path |
--json |
boolean | false |
Output JSON for scripting |
--yes |
boolean | false |
Skip confirmation (interactive mode only) |
--help |
boolean | false |
Show help |
# Auto-clean with age and size filters
modkill --path ~/Projects --min-age 60 --min-size 100
# Auto-clean with custom thresholds
modkill --auto --min-age 90 --min-size 200
# Generate JSON report for analysis
modkill --dry-run --json --path ~ > report.json
# Clean current directory (no confirmation by design)
modkill --current
# Auto-clean only large modules (>200MB)
modkill --min-size 200
# Focus on abandoned projects (oldest first, interactive)
modkill --path ~ --sort age
# Deep scan of an external drive
modkill --path /Volumes/Backup --depth 10- Project name with color coding:
- π΄ Red: >60 days old
- π‘ Yellow: 30-60 days old
- π’ Green: <30 days old
- Size in human-readable format (KB, MB, GB)
- Age in days or months
- Path shown as subtitle (relative to scan root)
- Space: Select/deselect item
- A: Toggle all
- I: Invert selection
- Enter: Proceed with deletion
- Ctrl+C: Cancel
- β Interactive preview with confirmation prompt
- ποΈ Moves to OS trash (recoverable)
- π Creates restore log in system temp directory (
modkill-restore-[timestamp].log) β οΈ Dry-run mode available for risk-free preview- π« Skips system directories automatically
- Filter: applies
--min-ageand--min-sizewhen provided - Sorting: default by
size(use--sort age|name|pathto override) - Pre-selection (interactive): auto-selects items older than 30 days
- Scoring: weighted formula
ageScoreΓ0.5 + sizeScoreΓ0.4 + orphanBonusΓ0.1 - Colors: π’ β€30d, π‘ 31β60d, π΄ >60d
[
{
"path": "/absolute/path/to/node_modules",
"sizeBytes": 134217728,
"mtimeMs": 1699564800000,
"hasPackageJson": true,
"ageDays": 45.5,
"score": 67.3
}
]Fields:
path: Absolute path to node_modules foldersizeBytes: Total size in bytesmtimeMs: Last modified timestamp (milliseconds)hasPackageJson: Whether parent has package.jsonageDays: Days since last modificationscore: Heuristic priority score (weighted by age, size, and orphan status)
| Metric | Result |
|---|---|
| Scan home (277GB) | 52.7s |
| Memory usage (peak) | <50MB |
| Single project scan | 0.21s |
| Parallel scanning | β Ready |
Tested on M-series Mac:
# Scan home directory (277GB, depth 6)
β Found 54 node_modules totaling 18GB in 52.7s
# Scan projects directory
β Found 11 node_modules totaling 4.7GB in 47.9s
# Scan current project
β Found 1 node_modules in 0.21s# Clone repository
git clone https://github.com/udede/modkill.git
cd modkill
# Install dependencies
npm install
# Build
npm run build
# Run tests
npm test
# Link for local testing
npm link| Script | Description |
|---|---|
npm run dev |
Watch mode with auto-rebuild |
npm run build |
Build for production |
npm test |
Run all tests |
npm run lint |
Lint and fix code |
npm run format |
Format with Prettier |
npm run bench |
Run benchmarks |
modkill/
βββ src/
β βββ cli.ts # CLI entry point
β βββ core/ # Core logic
β β βββ scanner.ts # Filesystem traversal
β β βββ analyzer.ts # Filtering & scoring
β β βββ cleaner.ts # Safe deletion
β βββ commands/ # Command handlers
β βββ ui/ # UI components
βββ tests/ # Test suites
βββ dist/ # Built files
# Run all tests
npm test
# Run with coverage
npm run test:coverage
# Run specific suite
npm test scanner
# E2E tests
npm run test:e2eWe love contributions! This project uses automated releases with changesets.
- Fork the repository
- Create your feature branch (
git checkout -b feat/amazing-feature) - Make your changes
- Add tests for new features
- Create a changeset:
npm run changeset - Commit your changes (including the changeset file)
- Push and open a Pull Request
For detailed guidelines, see:
- π Contributing Guide
- π Release Process
- βοΈ Setup Guide (for maintainers)
This project uses GitHub Actions for automated releases:
- β CI runs on every PR
- β Changesets bot creates release PRs automatically
- β Packages publish to npm automatically when release PR is merged
- β Changelog is auto-generated
No manual npm publish needed! π
See CHANGELOG.md for version history.
| Feature | modkill | npkill | node-prune |
|---|---|---|---|
| Speed | β‘β‘β‘β‘β‘ Parallel | β‘β‘β‘ | β‘β‘ |
| Interactive UI | β Rich & colorful | β Basic | β |
| Safe deletion | β Trash + log | ||
| JSON output | β | β | β |
| Custom filters | β Age, size | β | |
| Monorepo aware | β Depth control | β | |
| Windows support | β | β |
Permission denied
# Run with sudo if scanning system directories
sudo modkill --path /usr/localSlow scanning
# Reduce depth for faster scans
modkill --depth 3
# Auto-clean only large folders (>100MB) for faster cleanup
modkill --min-size 100Not finding modules
# Increase depth
modkill --depth 10
# Check specific path
modkill --path ./my-projectMIT Β© Francesco Lisandro
Made with β€οΈ by developers, for developers
β Star on GitHub
