Overview
Incur CLIs are created usingCli.create(), which can produce either a single-command CLI (one action) or a multi-command CLI (router with subcommands).
Single-Command CLI
Pass arun function directly to Cli.create() to create a CLI that performs one action.
Even single-command CLIs can register subcommands later using
.command(). The root handler runs when no subcommand matches.Multi-Command CLI
Omit therun function to create a router CLI that delegates to subcommands.
Configuration Options
Required Options
The CLI binary name. Used in help text, error messages, and CTAs.
Common Options
A short description of what the CLI does. Shown in help output.
The CLI version string. Displayed with
--version.The root command handler. When provided, creates a single-command CLI. Accepts a context object with
args, options, env, and helper functions like ok() and error().Advanced Options
Zod schema for positional arguments. Keys define the argument order.
Zod schema for named options/flags.
Zod schema for environment variables. Keys are variable names (e.g.
NPM_TOKEN).Zod schema for middleware variables. Enables typed dependency injection.
Zod schema for the return value. Enforces output shape validation.
Default output format. Overridden by
--format or --json flags.Controls when output data is displayed.
'all'— displays to both humans and agents (default)'agent-only'— suppresses data in TTY mode, only returns to agents
Map of option names to single-character aliases.
Alternative binary names for this CLI (e.g. shorter aliases in package.json
bin).Command Groups
Create separate CLI instances and mount them as command groups using.command(cli).
outputPolicy and middleware from their parent CLI unless explicitly overridden.
CLI Name in Context
The CLI name is available in therun context as c.name. Useful for composing help text and error messages.
Single-Object Syntax
You can pass all options, includingname, as a single object:
package.json or other sources.
Next Steps
Commands
Learn how to register and define commands
Schemas
Explore Zod schema validation and type inference

