import { $ as ArgParseFn, $t as WithoutElementEligibility, A as Out, An as PromptResult, At as DefaultValueOptions, B as MiddlewareHandler, Bn as ProgressHandle, Bt as FlagKind, Cn as StandardSchemaV1Types, Ct as SplitOptions, D as InteractiveParams, Dn as PromptConfig, Dt as BooleanFlagDefinition, En as MultiselectPromptConfig, Et as ArrayFlagDefinition, F as InputSources, Fn as HelpDescription, Ft as FlagDefinition, G as ArgConfig, Gn as TableFormat, Gt as InferFlag, H as middleware, Hn as SpinnerHandle, Ht as FlagParseFn, I as ResolutionProvenance, In as HelpTheme, It as FlagDefinitionBase, J as ArgDefinitionBase, Jt as NumberFlagDefinition, K as ArgDefaultValue, Kn as TableOptions, Kt as InferFlags, L as SourcesOf, Ln as HelpThemeFactory, Lt as FlagDefinitionByKind, M as createCommandSchema, Mn as SelectPromptConfig, Mt as EnumFlagDefinition, N as group, Nn as NumberConstraintViolation, Nt as FlagBuilder, O as InteractiveResolver, On as PromptConfigBase, Ot as CountFlagDefinition, P as resolveExampleCommand, Pn as NumberConstraints, Pt as FlagConfig, Q as ArgKind, Qt as WithPresence, R as wasExplicit, Rn as ActivityEvent, Rt as FlagDefinitionOverrides, S as DeriveParams, Sn as StandardSchemaV1SuccessResult, St as SplitFormat, T as ExampleMeta, Tn as InputPromptConfig, Tt as SplitSetting, U as Verbosity, Un as SpinnerOptions, Ut as FlagPresence, V as MiddlewareParams, Vn as ProgressOptions, Vt as FlagNegation, W as ArgBuilder, Wn as TableColumn, Wt as FlagSchema, X as ArgDefinitionOverrides, Xt as StringElementConfig, Y as ArgDefinitionByKind, Yt as ResolvedValue, Z as ArgFactory, Zt as StringFlagDefinition, _ as CommandDefinition, _n as StandardSchemaV1Issue, _t as DUPLICATE_KEYS, a as WriteFn, an as PathFlagOptions, at as InferArg, b as CommandSchema, bn as StandardSchemaV1Props, bt as SourceSplitBinding, c as ResolvedMultiselectPromptConfig, cn as StringConstraints, ct as NumberArgDefinition, d as resolvePromptConfig, dn as StdinOptions, dt as StringArgElementConfig, en as createFlagSchema, et as ArgPresence, f as ActionHandler, fn as StdinWhen, ft as WithArgPresence, g as CommandBuilder, gn as StandardSchemaV1FailureResult, gt as createArgSchema, h as CommandArgEntryDefinition, hn as StandardSchemaV1, ht as arg, i as createOutput, in as PathChecks, it as EnumArgDefinition, j as command, jn as SelectChoice, jt as DuplicatePolicy, k as InteractiveResult, kn as PromptKind, kt as CustomFlagDefinition, l as ResolvedPromptConfig, ln as StdinBinding, lt as ResolvedArgValue, m as CommandArgEntry, mn as InferStandardOutput, mt as WithoutArgElementEligibility, n as OutputOptions, nn as getFlagNegatedName, nt as BooleanArgDefinition, o as PromptEngine, on as UrlFlagOptions, ot as InferArgs, p as ActionParams, pn as InferStandardInput, pt as WithVariadic, q as ArgDefinition, qn as TableStream, qt as KeyValueFlagDefinition, rn as DateFlagOptions, rt as CustomArgDefinition, s as ReadFn, sn as StringConstraintViolation, st as KeyValueArgDefinition, tn as flag, tt as ArgSchema, u as ResolvedSelectPromptConfig, un as StdinConsume, ut as StringArgDefinition, v as CommandExample, vn as StandardSchemaV1Options, vt as DuplicateKeys, w as ExampleCommand, wn as ConfirmPromptConfig, wt as SplitPolicy, x as DeriveHandler, xn as StandardSchemaV1Result, xt as SplitBinding, y as CommandMeta, yn as StandardSchemaV1PathSegment, yt as SPLIT_FORMATS, z as Middleware, zn as Fallback, zt as FlagFactory } from "./index-BziI2aKc.mjs"; import { A as ErrorCode, B as BuiltinMode, C as includesBeforeSeparator, D as CLIError, E as tokenize, F as ValidationErrorCode, H as Builtins, I as ValidationErrorOptions, L as isCLIError, M as ParseErrorCode, N as ParseErrorOptions, O as CLIErrorJSON, P as ValidationError, R as isParseError, S as Token, T as stripBeforeSeparator, U as BuiltinsConfig, V as BuiltinName, _ as ResolutionProvenanceRecord, b as ParseOptions, c as formatHelp, d as CLIPluginHooks, f as PluginCommandContext, g as DeprecationWarning, h as resolve, j as ParseError, k as CLIErrorOptions, l as BeforeParseParams, m as plugin, n as RunResult, p as ResolvedCommandParams, s as HelpOptions, u as CLIPlugin, v as ResolveOptions, w as parse, x as ParseResult, y as ResolveResult, z as isValidationError } from "./index-DWsnGZlx.mjs"; import { C as SHELLS, S as HelpLinks, T as CompletionOptions, _ as ResolvedManifestSettings, a as CLIRunOptions, b as isMainModule, c as CompletionsFlagConfig, d as DefaultCommandOptions, f as HelpConfig, g as RenderContextOptions, h as RenderContext, i as CLIOptions, l as ConfigSettings, m as ManifestSettings, n as CLIDefinition, o as CLISchema, p as InferNameOption, r as CLIExecuteOptions, s as CompletionRegistrationOptions, t as CLIBuilder, u as ConfigSettingsDefinition, v as cli, w as Shell, x as resolveRenderContext, y as createCLISchema } from "./index-DXROeDPC.mjs"; import { n as RuntimeAdapter } from "./adapter-D0hbBNVB.mjs"; import { a as ConfigNotFound, d as PackageRepositoryUrlOptions, g as PackageRepository, h as PackageJsonData, i as ConfigFound, m as PackageJsonAdapter, n as ConfigDiscoveryOptions, o as ConfigSearchPathOptions, p as ManifestDiscoveryOptions, r as ConfigDiscoveryResult, s as FormatLoader, t as ConfigAdapter } from "./index-DOfClfYR.mjs"; import { D as DEFINITION_SCHEMA_URL, O as DEFINITION_SCHEMA_VERSION, S as StdinBindingFragmentV1, _ as JsonSchemaOptions, a as CommandDefinitionFragmentV1, b as SourceSplitFragmentV1, c as ExampleDefinitionFragmentV1, d as FlagNegationFragmentV1, f as FlagPathChecksFragmentV1, g as InputSchemaProperty, h as InputSchemaDocument, i as CommandDefinitionDocumentV1, l as FlagDefinitionFragmentV1, m as InputSchemaBranch, n as ArgElementFragmentV1, o as DefinitionDocument, p as FlagStringConstraintsFragmentV1, r as CommandDefinitionDocument, s as DefinitionDocumentV1, t as ArgDefinitionFragmentV1, u as FlagElementFragmentV1, v as PromptChoiceFragmentV1, x as SplitPolicyFragmentV1, y as PromptDefinitionFragmentV1 } from "./index-DyoaS234.mjs"; import { Colors } from "ansispeck"; //#region src/core/help/ansi.d.ts /** * Measure the visible column width of `text`, ignoring ANSI/OSC escapes. * * Escape sequences (SGR colors, OSC 8 hyperlinks) occupy zero columns when * rendered, so `.length` overcounts whenever they are present. Help * formatting uses this for padding and wrapping; exported for custom help * renderers that mix colors or links into aligned output. * * @param text - Text possibly containing terminal escapes. * @returns Number of visible characters. * * @example * ```ts * visibleWidth('plain'); // 5 * visibleWidth(osc8('https://x.dev', 'x')); // 1 * ``` */ declare function visibleWidth(text: string): number; /** * Wrap `text` in an [OSC 8 hyperlink](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) * pointing at `url`. * * Supporting terminals render `text` as a clickable link; others show it * plain. `text` defaults to the URL, so an omitted label degrades to a * usable address. The framework's help layer decides *whether* to link * (`help.hyperlinks`); this always emits when called. * * @param url - Link target (string or `URL` instance). * @param text - Visible link text. * @returns The OSC 8 escape sequence wrapping `text`. * * @example * ```ts * cli('mycli').version(osc8('https://github.com/me/mycli/releases/tag/v1.0.0', '1.0.0')); * osc8('https://dreamcli.kjanat.dev'); // linked, displayed as the URL * ``` */ declare function osc8(url: string | URL, text?: string): string; //#endregion //#region src/core/read-flags/index.d.ts /** * A record of flag definitions keyed by canonical flag name. * * The object key is the `--name` spelling and the key on the resolved record. */ type FlagMap = Readonly>>; /** * External state and behavior toggles accepted by {@linkcode readFlags}. * * Extends {@linkcode ResolveOptions}, so `env`, `config`, `prompter`, `stat`, * and `mkdir` carry the meaning they have during command resolution. */ interface ReadFlagsOptions extends ResolveOptions { /** * User arguments only, without the binary and script entries. * @defaultValue the runtime adapter's argv past its binary and script entries */ readonly argv?: readonly string[]; /** * Runtime source for argv, environment, and filesystem primitives. * @defaultValue {@linkcode createAdapter | createAdapter()}, built on the * first fact the caller left out */ readonly adapter?: RuntimeAdapter; /** * Parser behavior such as kebab/camel case parity. * @defaultValue `undefined`, which keeps the parser defaults */ readonly parse?: ParseOptions; /** * Reject argv content the definitions do not declare. * * `false` drops undeclared input from argv before parsing: unknown long * flags together with their inline `=value`, unknown characters inside a * short group, positional arguments, and the `--` separator, which can only * introduce positionals here. A value token of a declared flag is kept by * walking the same consumption rules the parser applies. Misuse of a * declared flag still fails: a missing value, a bad coercion, or a violated * duplicate policy throws in either mode. * @defaultValue `true` */ readonly strict?: boolean; /** * The built-in `--help`/`-h` handling. * * While `'on'`, a pre-separator `--help` or `-h` prints generated help for * the definitions to the adapter's stdout and exits the process with * code 0. The built-in yields automatically when any definition claims the * `help` or `h` spelling through its name, an alias, a negated form, or a * case-parity counterpart; those spellings then parse as the definition's * own. `'off'` removes the built-in, and the spellings parse like any other * token. * @defaultValue `'on'` */ readonly help?: 'on' | 'off'; /** * Receiver for notices produced by `.deprecated()` flags. * @defaultValue `undefined`, which drops the notices */ readonly onDeprecation?: (warning: DeprecationWarning) => void; /** * Receiver for the provenance of the resolved values, keyed by flag name. * * Called once with the whole record, before {@linkcode readFlags} returns the * values. A flag that resolved no value has no record, so the same reader * works for optional flags. * @defaultValue `undefined`, which drops the record */ readonly onSources?: (sources: SourcesOf) => void; } /** * Evaluate a record of flag definitions and return the resolved values. * * The record is compiled into an anonymous command schema with no positional * arguments, parsed once, and run through the CLI, env, config, prompt, default * resolution chain. Aliases, negated spellings, duplicate policy, case parity, * unknown-flag rejection, coercion, constraints, Standard Schema validators, and * `flag.path()` checks behave exactly as they do inside a command. * * A pre-separator `--help` or `-h` prints generated help to the adapter's * stdout and exits with code 0, unless {@linkcode ReadFlagsOptions.help} is * `'off'` or a definition claims either spelling. With * {@linkcode ReadFlagsOptions.strict} set to `false`, undeclared argv content * is dropped instead of rejected, so a script can read its own flags out of an * argv it shares with another consumer. * * Anything the caller leaves out comes from the runtime adapter, which is built * on first use, so a call given `argv` and `env` reads nothing from the host * unless a `flag.path()` check needs the adapter's filesystem primitives. * `config` has no application name to discover a file from and stays * caller-supplied. `prompter` stays caller-supplied as well, so a `.prompt()` * flag with no prompter falls through to its default. * * @param definitions - Flag builders keyed by canonical flag name. * @param options - Injected runtime state and behavior toggles. * @returns The resolved flag values, typed from the definitions. * @throws {ParseError} For unknown flags, missing values, and bad input. * @throws {ValidationError} For missing required flags and failed validators. * @throws {CLIError} With code `'FLAG_NAME_COLLISION'` when two definitions share * a name, an alias, or a negated spelling. * @throws {CLIError} With code `'INVALID_SCHEMA'` for the definition key * `__proto__`, which JavaScript cannot carry as a plain record key, and for a * definitions record whose prototype is replaced, which hides the entries a * key check would read. * * @example * ```ts * import { flag, readFlags } from '@kjanat/dreamcli'; * * const options = await readFlags({ * watch: flag.boolean().alias('w').env('WATCH').default(false), * minify: flag.boolean().env('MINIFY').default(true), * target: flag.enum(['node', 'browser']).env('TARGET').default('node'), * }); * * options.watch; // boolean * options.minify; // boolean * options.target; // 'node' | 'browser' * ``` * * @example * ```ts * const values = await readFlags( * { watch: flag.boolean().alias('w').env('WATCH') }, * { argv: [], env: { WATCH: 'true' } }, * ); * * values.watch; // true * ``` * * @example * ```ts * const values = await readFlags( * { watch: flag.boolean() }, * { argv: ['build', '--watch', '--unknown'], env: {}, strict: false }, * ); * * values.watch; // true, with 'build' and '--unknown' dropped * ``` */ declare function readFlags(definitions: F, options?: ReadFlagsOptions): Promise>; //#endregion export { type ActionHandler, type ActionParams, type ActivityEvent, ArgBuilder, type ArgConfig, type ArgDefaultValue, type ArgDefinition, type ArgDefinitionBase, type ArgDefinitionByKind, type ArgDefinitionFragmentV1, type ArgDefinitionOverrides, type ArgElementFragmentV1, type ArgFactory, type ArgKind, type ArgParseFn, type ArgPresence, type ArgSchema, type ArrayFlagDefinition, type BeforeParseParams, type BooleanArgDefinition, type BooleanFlagDefinition, type BuiltinMode, type BuiltinName, type Builtins, type BuiltinsConfig, CLIBuilder, type CLIDefinition, CLIError, type CLIErrorJSON, type CLIErrorOptions, type CLIExecuteOptions, type CLIOptions, type CLIPlugin, type CLIPluginHooks, type CLIRunOptions, type CLISchema, type Colors, type CommandArgEntry, type CommandArgEntryDefinition, CommandBuilder, type CommandDefinition, type CommandDefinitionDocument, type CommandDefinitionDocumentV1, type CommandDefinitionFragmentV1, type CommandExample, type CommandMeta, type CommandSchema, type CompletionOptions, type CompletionRegistrationOptions, type CompletionsFlagConfig, type ConfigAdapter, type ConfigDiscoveryOptions, type ConfigDiscoveryResult, type ConfigFound, type ConfigNotFound, type ConfigSearchPathOptions, type ConfigSettings, type ConfigSettingsDefinition, type ConfirmPromptConfig, type CountFlagDefinition, type CustomArgDefinition, type CustomFlagDefinition, DEFINITION_SCHEMA_URL, DEFINITION_SCHEMA_VERSION, DUPLICATE_KEYS, type DateFlagOptions, type DefaultCommandOptions, type DefaultValueOptions, type DefinitionDocument, type DefinitionDocumentV1, type DeprecationWarning, type DeriveHandler, type DeriveParams, type DuplicateKeys, type DuplicatePolicy, type EnumArgDefinition, type EnumFlagDefinition, type ErrorCode, type ExampleCommand, type ExampleDefinitionFragmentV1, type ExampleMeta, type Fallback, FlagBuilder, type FlagConfig, type FlagDefinition, type FlagDefinitionBase, type FlagDefinitionByKind, type FlagDefinitionFragmentV1, type FlagDefinitionOverrides, type FlagElementFragmentV1, type FlagFactory, type FlagKind, type FlagMap, type FlagNegation, type FlagNegationFragmentV1, type FlagParseFn, type FlagPathChecksFragmentV1, type FlagPresence, type FlagSchema, type FlagStringConstraintsFragmentV1, type FormatLoader, type HelpConfig, type HelpDescription, type HelpLinks, type HelpOptions, type HelpTheme, type HelpThemeFactory, type InferArg, type InferArgs, type InferFlag, type InferFlags, type InferNameOption, type InferStandardInput, type InferStandardOutput, type InputPromptConfig, type InputSchemaBranch, type InputSchemaDocument, type InputSchemaProperty, type InputSources, type InteractiveParams, type InteractiveResolver, type InteractiveResult, type JsonSchemaOptions, type KeyValueArgDefinition, type KeyValueFlagDefinition, type ManifestDiscoveryOptions, type ManifestSettings, type Middleware, type MiddlewareHandler, type MiddlewareParams, type MultiselectPromptConfig, type NumberArgDefinition, type NumberConstraintViolation, type NumberConstraints, type NumberFlagDefinition, type Out, type OutputOptions, type PackageJsonAdapter, type PackageJsonData, type PackageRepository, type PackageRepositoryUrlOptions, ParseError, type ParseErrorCode, type ParseErrorOptions, type ParseOptions, type ParseResult, type PathChecks, type PathFlagOptions, type PluginCommandContext, type ProgressHandle, type ProgressOptions, type PromptChoiceFragmentV1, type PromptConfig, type PromptConfigBase, type PromptDefinitionFragmentV1, type PromptEngine, type PromptKind, type PromptResult, type ReadFlagsOptions, type ReadFn, type RenderContext, type RenderContextOptions, type ResolutionProvenance, type ResolutionProvenanceRecord, type ResolveOptions, type ResolveResult, type ResolvedArgValue, type ResolvedCommandParams, type ResolvedManifestSettings, type ResolvedMultiselectPromptConfig, type ResolvedPromptConfig, type ResolvedSelectPromptConfig, type ResolvedValue, type RunResult, SHELLS, SPLIT_FORMATS, type SelectChoice, type SelectPromptConfig, type Shell, type SourceSplitBinding, type SourceSplitFragmentV1, type SourcesOf, type SpinnerHandle, type SpinnerOptions, type SplitBinding, type SplitFormat, type SplitOptions, type SplitPolicy, type SplitPolicyFragmentV1, type SplitSetting, type StandardSchemaV1, type StandardSchemaV1FailureResult, type StandardSchemaV1Issue, type StandardSchemaV1Options, type StandardSchemaV1PathSegment, type StandardSchemaV1Props, type StandardSchemaV1Result, type StandardSchemaV1SuccessResult, type StandardSchemaV1Types, type StdinBinding, type StdinBindingFragmentV1, type StdinConsume, type StdinOptions, type StdinWhen, type StringArgDefinition, type StringArgElementConfig, type StringConstraintViolation, type StringConstraints, type StringElementConfig, type StringFlagDefinition, type TableColumn, type TableFormat, type TableOptions, type TableStream, type Token, type UrlFlagOptions, ValidationError, type ValidationErrorCode, type ValidationErrorOptions, type Verbosity, type WithArgPresence, type WithPresence, type WithVariadic, type WithoutArgElementEligibility, type WithoutElementEligibility, type WriteFn, arg, cli, command, createArgSchema, createCLISchema, createCommandSchema, createFlagSchema, createOutput, flag, formatHelp, getFlagNegatedName, group, includesBeforeSeparator, isCLIError, isMainModule, isParseError, isValidationError, middleware, osc8, parse, plugin, readFlags, resolve, resolveExampleCommand, resolvePromptConfig, resolveRenderContext, stripBeforeSeparator, tokenize, visibleWidth, wasExplicit };