Skip to content

ActionParams

The bag of values received by an action handler.

  • args: fully resolved positional arguments
  • flags: fully resolved flags
  • sources: which stage produced each of those values
  • ctx: derive/middleware-provided context
  • out: output channel
  • meta: CLI program metadata (name, bin, version, command)

The C parameter defaults to Record<string, never>, making ctx property access a type error until derive or middleware extends it.

Signatures

ts
interface ActionParams<F extends Record<string, FlagBuilder<FlagConfig>>, A extends Record<string, ArgBuilder<ArgConfig>>, C extends Record<string, unknown>> {}

Members

Properties

args

Fully resolved positional argument values, typed from .arg() definitions.

ts
args: Readonly<InferArgs<ActionParams.A>>;

ctx

Middleware/derive-provided context, typed from .middleware() and .derive() chains.

ts
ctx: Readonly<ActionParams.C>;

flags

Fully resolved flag values, typed from .flag() definitions.

ts
flags: Readonly<InferFlags<ActionParams.F>>;

meta

Runtime metadata about the CLI program and current command.

ts
meta: CommandMeta;

out

Structured output channel for stdout, stderr, JSON, tables, and spinners.

ts
out: Out;

sources

Where each resolved value came from, keyed like flags and args.

An input that resolved no value has no record. wasExplicit answers the explicit-versus-defaulted question; read stage for the rest.

ts
sources: InputSources<ActionParams.F, ActionParams.A>;

See Also

Released under the MIT License.