Skip to content

CommandSchema ​

Runtime descriptor produced by CommandBuilder.

Consumers (parser, help generator, CLI dispatcher) read this to understand the command's shape — flags, args, aliases, subcommands, middleware, and interactive resolver.

Signatures ​

ts
interface CommandSchema {}

Members ​

Properties ​

aliases ​

Alternative names for this command.

ts
aliases: readonly string[];

args ​

Ordered positional arg entries (name + schema).

ts
args: readonly CommandArgEntry[];

commands ​

Nested subcommand schemas (for help rendering and completion).

Pure data — no execution closures. Populated by .command() on CommandBuilder. Empty for leaf commands.

ts
commands: readonly CommandSchema[];

description ​

Human-readable description for help text.

ts
description: string | undefined;

examples ​

Usage examples for help text.

ts
examples: readonly CommandExample[];

flags ​

Named flag schemas, keyed by flag name.

ts
flags: Readonly<Record<string, FlagSchema>>;

hasAction ​

Whether an action handler has been registered.

ts
hasAction: boolean;

hidden ​

Whether this command is hidden from help listings.

ts
hidden: boolean;

interactive ​

Command-level interactive resolver for schema-driven prompt control.

When set, called after CLI/env/config resolution with partially resolved flag values. Returns prompt configs for flags that need interactive input. Takes precedence over per-flag .prompt() configs for flags it returns configs for; flags not mentioned fall back to their per-flag configs.

ts
interactive: ErasedInteractiveResolver | undefined;

middleware ​

Middleware handlers to run before the action handler.

Executed in registration order — first middleware registered runs first and calls next() to proceed to subsequent middleware, ending with the action handler. Context accumulates via intersection at the type level and via object spread at runtime.

ts
middleware: readonly ErasedMiddlewareHandler[];

name ​

The command name (used for dispatch, e.g. 'deploy').

ts
name: string;

See Also ​

Released under the MIT License.