Build beautiful CLIs with TypeScript
The modern CLI framework for TypeScript
A complete replacement for Commander.js + Inquirer with better DX.
npx create-easycli my-cli
cd my-cli
pnpm dev hello World
| Feature | Commander.js | Inquirer | EasyCLI |
|---|---|---|---|
| Type inference | Manual | Manual | Automatic |
| UI components | None | Prompts only | 15+ components |
| Error handling | Basic | None | Rich errors with hints |
| Signal handling | Manual | Partial | Built-in |
| Scaffolding | None | None | npx create-easycli |
--flag a --flag b into arraysargs: { name: { type: "string", optional: true } }my-cli db migrate, my-cli db seedimport { defineCLI } from "easycli-core";
import { colors, spinner, box } from "easycli-ui";
const cli = defineCLI({
name: "deploy",
version: "1.0.0",
commands: {
up: {
description: "Deploy to environment",
args: { env: ["staging", "production"] },
flags: {
force: { type: "boolean", alias: "f" },
replicas: { type: "number", default: 3 }
},
async run({ env, force, replicas }, ctx) {
if (!force) {
const proceed = await ctx.ask.confirm(`Deploy to ${env}?`);
if (!proceed) return;
}
const s = spinner(`Deploying to ${env}...`);
s.start();
await deploy(env, replicas);
s.success("Deployed!");
console.log(box([
`Environment: ${colors.cyan(env)}`,
`Replicas: ${replicas}`
], { borderStyle: "rounded" }));
}
}
}
});
cli.run();
| Package | Description |
|---|---|
easycli-core |
CLI definition, parsing, routing |
easycli-ui |
Colors, spinners, progress, tables, boxes |
easycli-prompts |
Interactive prompts, sanitization |
easycli-help |
Help text generation |
easycli-config |
Config file loading |
easycli-plugins |
Plugin system |
create-easycli |
Project scaffolder |
$ my-cli deploy up production --replicas 5
╭──────────────────────────╮
│ Deploying to production │
╰──────────────────────────╯
? Deploy to production? (y/n) y
⠋ Deploying to production...
✔ Deployed!
╭─────────────────────────╮
│ Environment: production │
│ Replicas: 5 │
╰─────────────────────────╯
MIT License - see LICENSE