The modern framework for building type-safe, beautiful CLI applications.
A complete replacement for Commander.js + Inquirer with better DX.
npx create-easycli my-app
cd my-app
pnpm dev hello World| Feature | Description |
|---|---|
| Type Safety | Full TypeScript inference from schema to handler |
| UI Components | Colors, spinners, progress bars, tables, boxes |
| Prompts | Text, password, confirm, select, multiselect |
| Signal Handling | Graceful SIGINT/SIGTERM with cleanup hooks |
| Input Sanitization | Built-in injection attack protection |
| Array Flags | --file a.ts --file b.ts collects into arrays |
| Optional Args | { type: "string", optional: true } |
| Subcommands | cli db migrate, cli db seed |
| Rich Errors | Errors with hints and exit codes |
import { defineCLI } from "easycli-core";
import { colors, spinner, box } from "easycli-ui";
const cli = defineCLI({
name: "deploy-cli",
version: "1.0.0",
commands: {
up: {
description: "Deploy to environment",
args: { env: ["staging", "production"] },
flags: {
force: { type: "boolean", alias: "f" },
file: { type: "string", array: true, alias: "F" }
},
async run({ env, force, file }, ctx) {
if (!force) {
const proceed = await ctx.ask.confirm(`Deploy to ${env}?`);
if (!proceed) return;
}
const s = spinner(`Deploying ${file?.length || 0} files to ${env}...`);
s.start();
await deploy(env);
s.success("Deployed!");
console.log(box(`Environment: ${colors.cyan(env)}`, {
borderStyle: "rounded",
borderColor: "green"
}));
}
}
}
});
cli.run();Usage:
deploy-cli up production --force --file api.ts --file worker.ts| Package | Description | Install |
|---|---|---|
easycli-core |
CLI definition, parsing, routing | pnpm add easycli-core |
easycli-ui |
Colors, spinners, progress, tables, boxes | pnpm add easycli-ui |
easycli-prompts |
Interactive prompts, sanitization | pnpm add easycli-prompts |
easycli-help |
Help text generation | pnpm add easycli-help |
easycli-config |
Config file loading | pnpm add easycli-config |
easycli-plugins |
Plugin system | pnpm add easycli-plugins |
create-easycli |
Project scaffolder | npx create-easycli |
import { colors } from "easycli-ui";
console.log(colors.green("Success!"));
console.log(colors.bold(colors.red("Error!")));
console.log(colors.bgCyan(colors.white("Highlight")));import { spinner } from "easycli-ui";
const s = spinner("Loading...");
s.start();
await doWork();
s.success("Done!");import { progress } from "easycli-ui";
const bar = progress(100);
for (let i = 0; i <= 100; i += 10) {
bar.update(i);
await delay(100);
}
bar.complete();import { table } from "easycli-ui";
table([
{ Name: "api", Status: "Running", Port: 3000 },
{ Name: "worker", Status: "Stopped", Port: 3001 }
]);import { box } from "easycli-ui";
console.log(box("Hello World!", {
title: "Greeting",
borderStyle: "rounded",
borderColor: "cyan",
padding: 1
}));| Document | Description |
|---|---|
| Getting Started | Setup in 5 minutes |
| Tutorial | Build a CLI from scratch |
| API Reference | Complete API docs |
| Building Beautiful CLIs | Full feature guide |
| Why EasyCLI? | Framework comparison |
| Example | Description |
|---|---|
| simple-app | Basic CLI with one command |
| myapp | Full-featured demo |
| test-features | Tests all production features |
| deploy-cli | Deployment tool example |
Contributions welcome! Please read CONTRIBUTING.md.
MIT - Avijit