FlagSchema
The runtime descriptor stored inside every FlagBuilder. Consumers (parser, help generator, resolution chain) read this to understand the flag's shape without touching generics.
- Import:
@kjanat/dreamcli - Export kind: interface
- Declared in:
src/core/schema/flag.ts - Source link:
src/core/schema/flag.ts:297
Signatures
interface FlagSchema<K extends FlagKind> {}Members
Properties
schemaBrand
Type-only seal produced by createFlagSchema.
schemaBrand: "flag";completion
Callback used to complete this input's values.
completion?: CompletionHandler | undefined;completionValues
Static shell completion suggestions for this flag.
completionValues: readonly string[] | undefined;kind
What kind of value this flag accepts.
kind: K;presence
Current presence state.
presence: FlagPresence;defaultValue
Runtime default value (if any).
defaultValue: unknown;defaultDescription
Human-readable replacement for the default value in help, or false to omit the default annotation.
defaultDescription: string | false | undefined;sensitive
Whether values from this input must be kept out of user-facing projections.
sensitive: boolean;aliases
Short/long aliases (e.g. [{ name: 'f', hidden: false }] for --force).
aliases: readonly FlagAlias[];stdin
Stdin binding set by .stdin() (undefined when the flag never reads stdin). See StdinBinding.
stdin: StdinBinding | undefined;envVar
Environment variable name for v0.2+ resolution.
envVar: string | undefined;envIndexed
Indexed environment family read as the env source, set by .env() with an IndexedEnvBinding (undefined otherwise). A flag declares at most one env source, so this and FlagSchema.envVar are never both set.
envIndexed: IndexedEnvBinding | undefined;envAbsolute
Whether the env source is read exactly as written, outside the CLI-wide namespace set by CLIBuilder.envPrefix() (set by .env(…, { absolute: true })). Applies to FlagSchema.envVar and FlagSchema.envIndexed alike.
envAbsolute: boolean;envFromName
Whether .env() was called without a name. Registration on a command replaces it with the derived FlagSchema.envVar.
envFromName: boolean;configPath
Dotted config path for v0.2+ resolution (e.g. 'deploy.region').
configPath: string | undefined;description
Human-readable description for help text.
description: HelpDescription | undefined;group
Named section in command help.
group: string | undefined;advanced
Whether the flag is shown only in full text help.
advanced?: true | undefined;enumValues
Allowed literal values when kind === 'enum'.
enumValues: readonly string[] | undefined;numberConstraints
Numeric constraints when kind === 'number' (undefined otherwise).
Enforced at the parse and resolution boundaries. finite defaults to true, so Infinity is rejected even when no constraints object is set.
numberConstraints: NumberConstraints | undefined;stringConstraints
String constraints when kind === 'string' (undefined otherwise).
Enforced at the parse and resolution boundaries, in fixed order: nonEmpty → minLength → maxLength → pattern.
stringConstraints: StringConstraints | undefined;elementSchema
Element schema when kind === 'array' or kind === 'keyValue'.
elementSchema: FlagSchema | undefined;separator
CLI value separator for a collection kind (undefined otherwise).
When set, each CLI occurrence is split on this separator before element coercion, so --tag a,b --tag c yields ['a', 'b', 'c']. Other sources decode through FlagSchema.split.
separator: string | undefined;split
Env and stdin split policies for a collection kind (undefined otherwise).
A source the binding leaves out takes its default: comma-delimited for env, line-delimited for stdin.
split: SourceSplitBinding | undefined;duplicateKeys
How a repeated key combines when kind === 'keyValue'.
duplicateKeys: DuplicateKeys;unique
Deduplicate resolved array values when kind === 'array'.
Applied after all sources resolve, preserving first-seen order. Uses SameValueZero semantics (like Set).
unique: boolean;pathChecks
Filesystem checks for path-valued flags (set by flag.path()).
Validated after resolution through the runtime adapter.
pathChecks: PathChecks | undefined;valueHint
Help placeholder label (e.g. 'url' renders as <url>).
Set by the sugar factories (flag.url(), flag.date(), …) so help output names the expected value shape; undefined falls back to the kind-derived hint.
valueHint: string | undefined;prompt
Interactive prompt configuration for v0.3+ resolution.
prompt: PromptConfig | undefined;parseFn
Custom parse function (only when kind === 'custom').
parseFn: FlagParseFn<unknown> | undefined;standard
Standard Schema v1 validator applied to each resolved value.
When set, the value from any source (CLI, env, config, prompt, default) is validated after resolution via ~standard.validate. Sync and async validators are both awaited; issues surface as a CONSTRAINT_VIOLATEDValidationError. On a collection this validates every element, whether it rides here or on FlagSchema.elementSchema.
standard: StandardSchemaV1 | undefined;aggregateStandard
Standard Schema v1 validator applied to the completed collection.
Set by .standard() on a collection builder, so the array or record the aggregation produced is validated as a whole after every element passed.
aggregateStandard: StandardSchemaV1 | undefined;deprecated
Deprecation marker.
undefined— not deprecated (default)true— deprecated with no migration messagestring— deprecated with a reason/migration message
When a deprecated flag is used, a warning is emitted to stderr. Help text shows [deprecated] or [deprecated: <reason>].
deprecated: string | true | undefined;propagate
Whether this flag propagates to subcommands in nested command trees.
When true, the flag is automatically available to all descendant commands. A child command that defines a flag with the same name shadows the propagated parent flag.
propagate: boolean;negation
Negation settings when kind === 'boolean' and .negatable() was called (undefined otherwise). See FlagNegation.
negation: FlagNegation | undefined;separateValue
Whether a long boolean flag may consume a separate boolean literal.
separateValue: true | undefined;variadic
Whether one long array flag occurrence consumes multiple argv tokens.
variadic: true | undefined;duplicates
Duplicate policy for repeated CLI occurrences. See DuplicatePolicy.
duplicates: DuplicatePolicy;