$ show voidcosmos/npkill
npkill is a TypeScript CLI/TUI application that scans filesystems to find node_modules (and other ecosystem build/dependency directories) consuming disk space, then interactively or programmatically deletes them. The core engine (Npkill class) exposes RxJS observable streams for scanning, size calculation, newest-file detection, deletion, and logging, with a worker_threads-based parallel directory traversal. The CLI layer adds a raw-mode interactive terminal UI with cursor navigation, multi-select deletion, search filtering, JSON/NDJSON output modes, --dry-run, .npkillrc config file support, and user-defined profiles. It ships both as a bin executable and as a programmatic Node library per API.md.
The LLM identified 6 files worth highlighting for reuse:
Parallelizes filesystem directory traversal and size computation across Node worker_threads using MessageChannel/MessagePort communication with round-robin job dispatch. Encapsulates a reusable pattern for CPU-bound filesystem scanning that could be extracted into any Node project needing concurrent directory analysis.
The Npkill core class exposes a fully observable API (startScan$, getSize$, getNewestFile$, delete$, getLogs$) using RxJS, decoupling the scanning engine from the CLI/UI layer. This is a clean, library-grade abstraction that could be reused programmatically via API.md or extracted as a standalone Node package.
A fully self-contained interactive terminal results list with cursor movement, scrolling, search filtering, multi-select/range selection, deletion status rendering, and a custom-drawn scrollbar. Each UI component exposes RxJS Subjects (delete$, openFolder$, goBack$) for controller decoupling, demonstrating a composable TUI component pattern reusable in other CLI projects.
Implements layered merging of CLI arguments, .npkillrc config file values, built-in defaults, and profile expansion into target directory lists. Modular validator classes (config-validator, profile-validator, property-validators) separate concerns cleanly and form a reusable configuration-validation pipeline for CLI tools.
Utility functions for converting and formatting byte sizes (formatSize, convertGbToBytes, etc.). A small, isolated, dependency-free module that could be dropped into any project needing human-readable disk size formatting.
Renders adaptive statistics in the TUI header with ANSI-aware text handling. Demonstrates a reusable pattern for terminal UI components that must handle escape codes when truncating or aligning text.