Skip to content

CLISchema ​

Runtime descriptor for the CLI program.

Stores the program name, version, description, and registered command schemas.
Sealed by createCLISchema and rebuilt by each CLIBuilder step.

Signatures ​

ts
interface CLISchema {}

Members ​

Properties ​

schemaBrand ​

Type-only seal produced by createCLISchema.

ts
schemaBrand: "cli";

name ​

Program name (used in help text, usage lines, and completion scripts).

ts
name: string;

inheritName ​

Whether .run() should replace name with the invoked program name.

Set via the cli({ inherit: true }) factory form.

ts
inheritName: boolean;

version ​

Program version (shown by --version).

ts
version: string | undefined;

versionAlias ​

Configured short version alias, without a leading dash.

ts
versionAlias?: string | undefined;

description ​

Program description (shown in root help).

ts
description: string | undefined;

commands ​

Schemas of the registered commands, in registration order.

ts
commands: readonly CommandSchema[];

defaultCommand ​

Schema of the default command dispatched when no subcommand matches.

When set, the CLI root behaves like a hybrid command group: subcommands dispatch by name as usual, but empty argv or flags-only argv falls through to this command instead of showing root help.

Set via the .default() builder method or the defaultCommand field of CLIDefinition.

ts
defaultCommand: CommandSchema | undefined;

defaultCommandRouted ​

Whether the default command is also exposed as a named top-level route.

Set by .default(cmd, { route: true }). When true, mycli <name> dispatches to the default command (in addition to the bare/flags-only root surface behavior) and the command is listed in the root Commands: section. When false (the default), the default is the root surface only.

ts
defaultCommandRouted: boolean;

configSettings ​

Config discovery settings.

When defined, .run() auto-discovers and loads a config file before command dispatch.

Set via the .config() builder method.

ts
configSettings: ConfigSettings | undefined;

packageJsonSettings ​

Manifest auto-discovery settings. When defined, .run() discovers the nearest manifest (package.json, deno.json, jsr.json, …) and merges metadata before dispatch.

Set via the .manifest() builder method.

ts
packageJsonSettings: ResolvedManifestSettings | undefined;

OSC 8 hyperlink targets for the root-help header (name/version).

Set via the .links() builder method. Fields left undefined are derived from manifest metadata (repository / homepage) when manifest discovery (.manifest()) is active.

ts
helpLinks: HelpLinks | undefined;

hasBuiltInCompletions ​

Whether built-in .completions() registration (command or flag) is active.

ts
hasBuiltInCompletions: boolean;

completionsFlag ​

Eager --completions <shell> flag configuration.

Set when .completions({ as: 'flag' }) is used instead of the default completions subcommand. When defined, the planner intercepts --completions <shell> before dispatch, prints the script, and exits; root help advertises the flag in its Flags: section.

ts
completionsFlag: CompletionsFlagConfig | undefined;

helpConfig ​

Consumer-configured root-help defaults.

Set via the .help() builder method and merged under runtime options.help (runtime wins) before rendering.

ts
helpConfig: HelpConfig | undefined;

flagSettings ​

Flag-parsing behavior settings (ParseOptions).

Set via the cli(name, { flags }) / cli({ flags }) factory forms.

ts
flagSettings: ParseOptions | undefined;

builtins ​

Which built-in flags the root still owns.

Every built-in starts 'on'. Set via the .builtins() builder method or the builtins field of CLIDefinition; a built-in set to 'off' releases its tokens to the commands.

ts
builtins: Builtins;

envPrefix ​

CLI-wide environment namespace prepended to every relative env binding (undefined when none is set). .env('TOKEN') reads <envPrefix>TOKEN; a binding declared with { absolute: true } is read as written.

Set via the .envPrefix() builder method or the envPrefix field of CLIDefinition. Fixed when declared, so neither manifest name inference nor an inherited invocation name changes it.

ts
envPrefix: string | undefined;

See Also ​

Released under the MIT License.