Skip to main content

Clipanion

Type-safe CLI library with no runtime dependencies

ts
import {Command, Option, runExit} from 'clipanion';
 
runExit(class MainCommand extends Command {
name = Option.String();
 
async execute() {
this.context.stdout.write(`Hello ${this.name}!\n`);
}
})
ts
import {Command, Option, runExit} from 'clipanion';
 
runExit(class MainCommand extends Command {
name = Option.String();
 
async execute() {
this.context.stdout.write(`Hello ${this.name}!\n`);
}
})

Type Safe

Clipanion provides type inference for the options you declare: no duplicated types to write and keep in sync.

Tooling Integration

Because it uses standard ES6 classes, tools like ESLint can easily lint your options to detect the unused ones.

Feature Complete

Clipanion supports subcommands, arrays, counters, execution contexts, error handling, option proxying, and much more.

Soundness

Clipanion unifies your commands into a proper state machine. It gives little room for bugs, and unlocks command overloads.

Tree Shaking

The core is implemented using a functional approach, letting most bundlers only keep what you actually use.

Battle Tested

Clipanion is used to power Yarn - likely one of the most complex CLI used everyday by the JavaScript community.