$ show npm/read
This is a small, focused npm library for reading user input from stdin. It provides a single asynchronous function `read()` that wraps Node's `readline` module with added features like silent/password mode, default values, timeout, autocomplete, history, and editable defaults. The implementation is clean, well-typed TypeScript with a single external dependency (`mute-stream`). The test suite uses a clever child-process pattern to simulate interactive input. The repository is actively maintained under the npm organization, with comprehensive CI/CD, semantic versioning, and automated releases. It is a mature, production-grade utility for CLI tools that need user input, but it is not architecturally complexβessentially a thin but robust wrapper around readline.
The LLM identified 1 files worth highlighting for reuse:
A reusable test utility that spawns a child process, monitors stdout for expected prompts, and writes predefined responses. It uses regex matching to detect prompts and feeds input line by line, then collects stdout and stderr. This pattern is directly applicable to testing any CLI tool that reads from stdin, not just this library. It demonstrates a clean, self-contained approach to automated interactive testing that can be extracted into a standalone package.