nm-wipe
v1.0.0
Published
Interactive node_modules cleaner CLI for macOS
Maintainers
Readme
nm-wipe
Interactive node_modules cleaner CLI for macOS and Linux.
nm-wipe scans a directory tree for node_modules folders, lets you interactively filter and select them, and then deletes them (or simulates deletion in dry‑run mode). It’s designed to safely reclaim disk space from old projects.
Warning
This tool deletes directories. Always start with--dry-rununtil you’re comfortable with what it will remove.
Install
npm install -g nm-wipe
# or
pnpm add -g nm-wipe
# or
yarn global add nm-wipeAfter installation you’ll have an nm-wipe binary on your PATH.
Usage
nm-wipe [root] [--dry-run]root(optional): directory to scan.- Defaults to your desktop:
~/Desktop.
- Defaults to your desktop:
--dry-run: simulate deletions without removing anything.--help/-h: show help.--version/-v: show version.
Examples
# Safely preview what would be deleted under ~/Desktop
nm-wipe --dry-run
# Scan a specific projects folder (recommended: first run with --dry-run)
nm-wipe ~/dev --dry-run
# Actually delete selected node_modules under ~/dev
nm-wipe ~/devInteractive flow
- Scan:
nm-wipescansroot(default~/Desktop) up to a configurable depth fornode_modulesfolders. - Filter & sort:
- Filter by:
- Path segment (e.g.
Axon,core,cenizaslabs-ai). - Size (e.g.
>500M,<1G,>2G). - Age (last modified) (e.g.
30d,6m,1y).
- Path segment (e.g.
- Sort by:
- Writable first (default).
- Size (largest / smallest first).
- Path A→Z.
- Filter by:
- Select:
- Use the checkbox UI to select which
node_modulesfolders to delete. - Read‑only or no‑access directories are shown but disabled.
- Use the checkbox UI to select which
- Confirm:
nm-wipeshows how many folders are selected and an approximate total size to be freed.- You must confirm before anything is deleted.
- Wipe:
- Deletions run one by one with a progress spinner.
- Failures are reported and can be retried.
Environment variables
WIPEIT_DEPTH
Maximum directory depth to scan from the root (default8, hard‑capped at50).WIPEIT_DEPTH=12 nm-wipe ~/dev --dry-run
Safety characteristics
- Never follows symlinks.
- Never recurses into
node_modulescontents (only removes the directory itself). - Uses filesystem permission checks to show whether a directory is writable, read‑only, or not accessible.
- Uses
du -shto estimate sizes; timeouts and permission errors degrade gracefully without crashing the CLI.
Development
This repo uses TypeScript and ships compiled JavaScript in dist/.
Prerequisites:
- Node.js 18+
Install dependencies (recommended: bun, but npm/pnpm also work):
bun installBuild and stamp the CLI:
bun run build
bun run postbuildRun in dev mode (TS directly with tsx):
bun run devRun the built CLI locally:
node dist/index.js --dry-runLicense
MIT © Boopathy Ganesh K
