import { G as ArgConfig, Nt as FlagBuilder, Pt as FlagConfig, W as ArgBuilder, g as CommandBuilder, r as createCaptureOutput, t as CapturedOutput } from "./index-BziI2aKc.mjs"; import { U as BuiltinsConfig, a as TestPrompterOptions, i as TestAnswer, n as RunResult, o as createTestPrompter, r as PROMPT_CANCEL, t as RunOptions } from "./index-DWsnGZlx.mjs"; import { a as createTestAdapter, i as TestAdapterOptions } from "./adapter-D0hbBNVB.mjs"; import "./index-DndPmT8J.mjs"; //#region src/core/testkit/index.d.ts /** * Options for {@linkcode runCommand}. * * Extends {@linkcode RunOptions} with the CLI-root state `runCommand()` mirrors, * following the way `CLIRunOptions` extends `CLIExecuteOptions` with the fields * only that layer needs. */ interface RunCommandOptions extends RunOptions { /** * Which built-in flags the harness mirrors, matching the CLI the command is * registered on. * * A command that owns a released built-in (`cli(...).builtins({ json: 'off' })` * plus a `json` flag) must be tested with the same setting, otherwise the * harness strips the token before `parse()` sees it. * * @defaultValue every built-in `'on'`, mirroring an unconfigured CLI root */ readonly builtins?: BuiltinsConfig; } /** * Run a command builder against the given argv with injected options. * * This is the testkit wrapper around the shared executor: * 1. Apply the CLI root-flag layer (detect/strip `--json` and `--quiet`/`-q`) so * copied real argv works * 2. Create or reuse capture output * 3. Build standalone schema/meta defaults when CLI dispatch did not * 4. Delegate parse -> resolve -> execute to the shared executor * 5. Return the structured result with captured buffers * * Errors are normalized by the shared executor into structured {@linkcode RunResult}s * with appropriate exit codes. The function never throws. * * @param cmd - The command builder (must have an action handler) * @param argv - Raw argv strings (NOT including the command name itself). * CLI-level `--json` and `--quiet`/`-q` before the `--` separator are honored * and stripped here, just like the real CLI root — so `['--json']` enables * JSON mode and `['--quiet']` sets quiet verbosity rather than failing as * unknown flags. Equivalent to `{ jsonMode: true }` / `{ verbosity: 'quiet' }`. * Both accept an explicit value (`--json=false`), and an invalid one fails * with the same `INVALID_VALUE` error the CLI root produces. Pass * `options.builtins` to mirror a CLI that released one of these tokens to its * commands. * @param options - Injectable runtime state * @returns Structured run result with exit code and captured output */ declare function runCommand>, A extends Record>, C extends Record = Record>(cmd: CommandBuilder, argv: readonly string[], options?: RunCommandOptions): Promise; //#endregion export { type CapturedOutput, PROMPT_CANCEL, type RunCommandOptions, type RunOptions, type RunResult, type TestAdapterOptions, type TestAnswer, type TestPrompterOptions, createCaptureOutput, createTestAdapter, createTestPrompter, runCommand };