clibuilder
Build a command line application out of typed commands, config files, and plugins.
clibuilder builds command line applications from commands. Each command declares its own
arguments and options with the t type descriptors, and its config with any
Standard Schema. The types of
what run() receives are inferred from those declarations — no separate type definition to keep in
sync.
import { cli, t } from 'clibuilder'
cli({ name: 'greet', version: '1.0.0' }) .default({ arguments: [{ name: 'name', description: 'who to greet' }], options: { times: { description: 'how many times', type: t.int(), default: 1 } }, run(args) { // args.name is string, args.times is number for (let i = 0; i < args.times; i++) this.ui.info(`hello, ${args.name}`) } }) .parse(process.argv) .catch(e => process.exit(e?.code || 1))What you get
Section titled “What you get”Commands & sub-commandsNest commands to any depth — my-cli repo create — with aliases and a generated help message.
Typed arguments & optionsDeclare with `t`; run(args) is typed from the declaration, and input is validated before it runs.
Built on args-minusclibuilder parses with args-minus, a dependency-free parser you can also use on its own in Node.js, Deno and Bun.
Config filesJSON, YAML, cjs, or mjs — resolved by convention from the CLI name and validated per command.
PluginsShip commands as separate packages and let a config file load them into your CLI.
TestingtestCommand() runs a command in-process and hands back its result and its UI messages.
ESM, and require() tooESM-only. require() still works through require(esm) on Node 20.19 or later.
Install
Section titled “Install”npm install clibuilderSee Installation for other package managers, then walk through Your First CLI.