gitmyhub

vorpal

JavaScript ★ 5.6k updated 2y ago

Node's framework for interactive CLIs

Vorpal is a Node.js library for building interactive command-line apps with a persistent shell prompt, built-in tab-completion, command history, and piping, though the project is no longer actively maintained.

JavaScriptNode.jssetup: easycomplexity 2/5

Vorpal is a Node.js framework for building interactive command-line applications. Rather than a simple script that runs once and exits, a Vorpal app launches its own persistent prompt where users type commands and get responses, similar to how a shell like Bash works but built entirely within your application.

You define commands with a short API: give a command a name, describe what arguments and options it accepts, and attach a function that runs when it is called. Vorpal handles the rest: it provides built-in help output, persistent command history, tab-based auto-completion (including custom completions per command), and the ability to pipe commands together. You can also define "modes" that change the prompt and behavior temporarily while the user is inside a particular workflow.

The library is installed via npm and targets Node.js developers who want to ship a polished interactive tool rather than a flat script. A small ecosystem of community extensions adds features like paging output through a pager, importing new commands at runtime, or adding a built-in read-eval-print loop (REPL) to inspect state.

The project notes that it is now in "open open source" mode: the original author is not actively maintaining it and is looking for volunteers to take over. This is worth knowing before adopting it for a production project, as it may not receive regular updates. The README includes a quick-start example that turns a plain Node file into a working CLI in about ten lines of code.

Where it fits