CLI FORGE

A type-safe CLI builder for Node.js with first-class TypeScript support

hello-world.ts
import { cli } from 'cli-forge';

cli('hello')
  .option('name', { type: 'string' })
  .command('greet', {
    handler: (args) => {
      // args.name is fully typed
      console.log(`Hello, ${args.name}!`)
    }
  })
  .forge();
6
Option Types
∞
Nesting Depth
100%
Type Inference
0
Runtime Cost

Features

Type Safety

Full type inference for parsed arguments based on your option definitions.

Flexible Options

Strings, numbers, booleans, arrays, and nested objects with full TypeScript inference.

Command Hierarchy

Unlimited nesting with inherited options and lazy subcommand building.

Middleware

Transform arguments between parsing and handler execution.

Auto Documentation

Generate documentation automatically from your CLI definition.

Test Harness

Built-in test harness for unit testing your CLI commands.