1 unstable release
| 0.1.0 | Mar 29, 2026 |
|---|
#2698 in Command line utilities
57KB
1.5K
SLoC
reap
Intelligent stale dev process killer. Finds and kills orphaned dev processes (next dev, vite, jest, pnpm run dev, headless Chrome, etc.) without touching real applications.
Every dev accumulates zombie processes -- old dev servers, forgotten test runners, headless browsers from builds that crashed. reap uses a weighted scoring system to identify them with high confidence, so you don't have to killall node and nuke everything.
Install
cargo install reaport
Or build from source:
git clone https://github.com/vignesh07/reap.git
cd reap
cargo build --release
cp target/release/reap /usr/local/bin/
Usage
reap scan # List stale dev processes
reap scan --all # Include lower-scoring processes
reap scan --json # Machine-readable output
reap kill # Interactive confirm then kill
reap kill --pick # Confirm each process individually (y/n)
reap kill --force # No confirmation
reap kill --dry-run # Show what would be killed
Example
$ reap scan
reap: found 19 stale dev processes
PID AGE CPU MEM SCORE PROJECT COMMAND
50347 5d4h 0.0% 5MB 19.5 remotion-video [dup] /home/user/remotion-video/node_modules/.remotion/chro...
51068 5d4h 0.0% 5MB 19.5 remotion-video [dup] /home/user/remotion-video/node_modules/.remotion/chro...
24254 9d3h 0.0% 528KB 16.0 my-app [dup] node /home/user/my-app/node_modules/.bin/concurre...
30630 9d2h 0.0% 5MB 12.0 web node /home/user/my-app/node_modules/.bin/vite
46794 6d2h 0.0% 564KB 7.0 wedding-app node ./node_modules/.bin/next dev -p 3000
46795 6d2h 0.0% 55MB 7.0 wedding-app next-server (v16.1.5)
+ 14 child processes will also be terminated
Total memory recoverable: ~116MB
$ reap kill --dry-run
Will kill 19 processes:
PID 50347 5d4h remotion-video chrome-headless-shell ...
dev tool: chrome-headless (+4.0)
exe in node_modules (+2.0)
cwd in project dir (+2.0)
orphaned (ppid=1) (+3.0)
no terminal (+1.5)
age > 24h + orphaned (+3.0)
duplicate dev server (+4.0)
+ 3 child processes
[DRY RUN] No processes were killed.
$ reap kill --pick
reap: 19 stale dev processes found
Confirm each process (y/n/q):
PID 50347 5d4h remotion-video chrome-headless-shell ... (+3 children)
Kill? [Y/n] y
PID 24254 9d3h my-app node .../concurrently ... (+1 children)
Kill? [Y/n] y
PID 30630 9d2h web node .../vite
Kill? [Y/n] n
PID 46794 6d2h wedding-app node ./node_modules/.bin/next dev -p 3000
Kill? [Y/n] y
Selected 3 of 4 processes.
SIGTERM PID 50347 (chrome-headless-shell)... killed
SIGTERM PID 24254 (node)... killed
SIGTERM PID 46794 (node)... killed
reap: killed 3/3 processes
How It Works
Processes accumulate staleness points from multiple signals. Only processes scoring 6.0 or above get flagged. This avoids false positives from any single heuristic.
Scoring Signals
| Signal | Weight | Description |
|---|---|---|
| Dev tool pattern match | 5.0 | Command matches next dev, vite, jest, pnpm run dev, etc. |
| Orphaned (ppid=1) | 3.0 | Parent died, reparented to init -- but only with dev context |
| No controlling terminal | 1.5 | No TTY attached -- only with dev context |
| Age > 4h + orphaned | 2.0 | Long-running with no parent |
| Age > 24h + orphaned | 3.0 | |
| Age > 7d | 5.0 | Almost certainly stale |
| CWD in project dir | 2.0 | Directory contains package.json, Cargo.toml, etc. |
| Duplicate dev server | 4.0 | 2+ dev servers for the same project |
| Exe in node_modules/ | 2.0 | esbuild, vite bins inside node_modules |
Age and orphan signals only apply to processes that already have dev context (pattern match, node_modules exe, or project directory). A random daemon that's old and orphaned won't be flagged.
Processes younger than 5 minutes are never flagged.
What's Protected
These are never killed regardless of score:
- Root-owned processes and system users (uid < 500)
- Processes under
/Applications/,/System/,/usr/bin/,/usr/lib/systemd/ - Databases: postgres, redis, mongo, mysql
- Process managers: pm2, Docker, systemd, supervisord
- Terminal multiplexers: tmux, screen
- Editors: vim, nvim, emacs, VS Code helpers
- Login shells, SSH/GPG agents
- Your own process tree (reap never kills itself or ancestors)
Dev Tools Detected
JS/TS: next dev, vite, vitest, jest, tsc --watch, webpack serve, nodemon, storybook, expo start, remix dev, astro dev, nuxt dev, parcel, concurrently, tsx watch, turbo dev
Package managers: npm/pnpm/yarn/bun run (dev|test|start|serve|watch)
Rust: cargo watch, cargo test
Python: pytest, uvicorn, flask run, manage.py runserver
Go: go test, go run, air
Browsers: chrome-headless-shell, puppeteer, playwright
Safety
- Never kills self or any ancestor process
- Never kills root-owned or system-user processes
- Never kills processes under system paths
- SIGTERM first, waits 5 seconds, SIGKILL only if still alive
- Kills process trees: parent first, then surviving children
Platform Support
- macOS -- fully tested
- Linux -- supported (protected paths and patterns for systemd, snap, etc.)
License
MIT
Dependencies
~9–20MB
~239K SLoC