import { z } from "zod"; import { Colors } from "picocolors/types"; //#region ../utils/dist/result-Dg2-rfn6.d.ts //#region src/fp/result.d.ts /** * A Result tuple representing either success `[null, TValue]` or failure `[TError, null]`. * Used throughout the codebase as the standard error-handling mechanism instead of throw. */ type Result = readonly [TError, null] | readonly [null, TValue]; /** * A Promise that resolves to a {@link Result} tuple. */ //#endregion //#region ../utils/dist/tag.d.ts //#region src/tag.d.ts /** * Property key used to brand objects with a tag string. * * Defined via `Object.defineProperty` as non-enumerable, non-writable, and * non-configurable, so it does not appear in `Object.keys`, `JSON.stringify`, * `for...in`, or spread. */ declare const TAG: "__tag"; /** * Nominal type brand that carries a tag string on the {@link TAG} property. * * @private */ interface NominalTag { readonly [TAG]: TTag; } /** * Intersect a plain object type with a nominal tag brand. * * Used to brand plain data objects with a discriminator that is hidden from * enumeration, serialization, and spread — while remaining accessible via * the {@link TAG} key for runtime type-narrowing. */ type Tagged = TObj & NominalTag; /** * Create a shallow copy of `obj` with a non-enumerable {@link TAG} property. * * The original object is not mutated. The tag is defined as non-enumerable, * non-writable, and non-configurable via `Object.defineProperty`. * * @param obj - The source object to copy and tag. * @param tag - The tag string to brand the copy with. * @returns A new object with all own enumerable properties of `obj` plus the hidden tag. */ //#endregion //#region ../core/dist/index-Czo1Ep-m.d.ts //#region src/types/utility.d.ts /** * A value that can be provided directly or as a zero-argument function that * produces the value. Resolved once at registration time via {@link resolveValue}. */ type Resolvable = T | (() => T); /** * Merge two types, with TBase overriding TOverride. */ type Merge = Omit & TOverride; /** * String keys of a record. */ type StringKeyOf = Extract; /** * A record with string keys and unknown values. Used as the default constraint * for args, config, and general-purpose record types throughout the framework. */ type AnyRecord = Record; /** * Recursively makes all properties readonly. * Primitives and functions pass through unchanged. * Arrays become readonly tuples, objects get readonly properties at every depth. */ type DeepReadonly = TType extends ((...args: unknown[]) => unknown) ? TType : TType extends readonly unknown[] ? { readonly [Key in keyof TType]: DeepReadonly } : TType extends object ? { readonly [Key in keyof TType]: DeepReadonly } : TType; /** * Detects the `any` type using the intersection trick. * `0 extends 1 & T` is only true when T is `any`. */ type IsAny = 0 extends 1 & T ? true : false; /** * Converts a union `A | B | C` to an intersection `A & B & C` * via the standard contravariant trick. */ type UnionToIntersection = (U extends unknown ? (x: U) => void : never) extends ((x: infer I) => void) ? I : never; //#endregion //#region src/lib/dotdir/types.d.ts /** * The scope of a dot directory — either project-local or user-global. */ type DotDirectoryLocation = "local" | "global"; /** * Error returned by dot directory operations. */ interface DotDirectoryError { readonly type: "no_project_root" | "protected_file" | "path_traversal" | "fs_error" | "parse_error"; readonly message: string; } /** * A file registered as protected by middleware. */ interface ProtectedFileEntry { readonly location: DotDirectoryLocation; readonly filename: string; } /** * Base options for any operation that touches file contents. */ interface AccessOptions { readonly dangerouslyAccessProtectedFile?: boolean; } /** * Options for write operations. Extends {@link AccessOptions}. */ interface WriteOptions extends AccessOptions {} /** * Options for reading and parsing JSON files, with optional Zod validation. * * @typeParam T - The expected parsed type. */ interface ReadJsonOptions extends AccessOptions { readonly schema?: z.ZodType; } /** * A scoped filesystem handle for a single dot directory. * * Provides read, write, exists, remove, and path resolution operations * that respect the shared protection registry. */ interface DotDirectoryClient { readonly dir: string; readonly ensure: () => Result; readonly read: (filename: string, options?: AccessOptions) => Result; readonly write: (filename: string, content: string, options?: WriteOptions) => Result; readonly readJson: (filename: string, options?: ReadJsonOptions) => Result; readonly writeJson: (filename: string, data: unknown, options?: WriteOptions) => Result; readonly exists: (filename: string) => boolean; readonly remove: (filename: string, options?: AccessOptions) => Result; readonly path: (filename: string) => Result; } /** * Root dot directory manager for obtaining scoped {@link DotDirectoryClient} * handles and managing the protection registry. */ interface DotDirectory { readonly global: () => DotDirectoryClient; readonly local: () => Result; readonly protect: (entry: ProtectedFileEntry) => void; } //#endregion //#region src/context/types.d.ts /** * Typed in-memory key-value store shape carried on `ctx.store`. * * Consumers extend this interface via declaration merging to register * typed keys without threading generics through every handler: * * ```ts * declare module '@kidd-cli/core' { * interface StoreMap { myKey: MyType } * } * ``` */ interface StoreMap { [key: string]: unknown; } /** * Typed key-value store available on every {@link CommandContext}. * * Provides `get`, `set`, `has`, `delete`, and `clear` over an in-memory * `Map`. The generic `TMap` constrains keys and values so consumers * receive compile-time safety for registered store keys. * * @typeParam TMap - Key-value shape (defaults to {@link StoreMap}). */ interface Store { get>(key: TKey): TMap[TKey] | undefined; set>(key: TKey, value: TMap[TKey]): void; has(key: string): boolean; delete(key: string): boolean; clear(): void; } /** * Action types for key alias mappings. */ /** * Options for a yes/no confirmation prompt. */ interface ConfirmOptions { readonly message: string; readonly active?: string; readonly inactive?: string; readonly initialValue?: boolean; /** * Display active/inactive options vertically instead of inline. */ readonly vertical?: boolean; } /** * Options for a free-text input prompt. */ interface TextOptions { readonly message: string; readonly placeholder?: string; readonly defaultValue?: string; readonly initialValue?: string; readonly validate?: (value: string | undefined) => string | Error | undefined; } /** * Options for a masked password input prompt. */ interface PasswordOptions { readonly message: string; readonly mask?: string; readonly validate?: (value: string | undefined) => string | Error | undefined; /** * Clear the input when validation fails. */ readonly clearOnError?: boolean; } /** * A single option in a select or multi-select prompt. * * @typeParam TValue - The value type returned when this option is selected. */ interface SelectOption { readonly value: TValue; readonly label: string; readonly hint?: string; readonly disabled?: boolean; } /** * Options for a single-select prompt. * * @typeParam TValue - The value type of each selectable option. */ interface SelectOptions { readonly message: string; readonly options: SelectOption[]; readonly initialValue?: TValue; readonly maxItems?: number; } /** * Options for a multi-select prompt. * * @typeParam TValue - The value type of each selectable option. */ interface MultiSelectOptions { readonly message: string; readonly options: SelectOption[]; readonly initialValues?: TValue[]; readonly required?: boolean; readonly cursorAt?: TValue; readonly maxItems?: number; } /** * Options for a grouped multi-select prompt. * * @typeParam TValue - The value type of each selectable option. */ interface GroupMultiSelectOptions { readonly message: string; readonly options: Record[]>; readonly initialValues?: TValue[]; readonly required?: boolean; readonly selectableGroups?: boolean; /** * Position the cursor at a specific value on mount. */ readonly cursorAt?: TValue; /** * Number of blank lines between groups. */ readonly groupSpacing?: number; } /** * Options for a type-ahead autocomplete prompt. * * @typeParam TValue - The value type of each selectable option. */ interface AutocompleteOptions { readonly message: string; readonly options: SelectOption[]; readonly placeholder?: string; readonly maxItems?: number; readonly initialValue?: TValue; readonly validate?: (value: TValue) => string | Error | undefined; readonly filter?: (search: string, option: SelectOption) => boolean; /** * Pre-fill the text input with an initial user query. */ readonly initialUserInput?: string; } /** * Options for a type-ahead autocomplete multi-select prompt. * * @typeParam TValue - The value type of each selectable option. */ interface AutocompleteMultiSelectOptions { readonly message: string; readonly options: SelectOption[]; readonly placeholder?: string; readonly maxItems?: number; readonly initialValues?: TValue[]; readonly required?: boolean; } /** * Options for a key-press selection prompt. * * @typeParam TValue - The value type (must be a string for key matching). */ interface SelectKeyOptions { readonly message: string; readonly options: SelectOption[]; readonly initialValue?: TValue; /** * Whether key matching is case-sensitive. */ readonly caseSensitive?: boolean; } /** * Options for a filesystem path autocomplete prompt. */ interface PathOptions { readonly message: string; readonly root?: string; readonly directory?: boolean; readonly initialValue?: string; readonly validate?: (value: string | undefined) => string | Error | undefined; } /** * Options for the {@link Prompts.group} method. * * @typeParam TResult - The shape of the accumulated results object. */ interface PromptGroupOptions { readonly onCancel?: (params: { readonly results: Partial; }) => void; } /** * A record of prompt functions that share accumulated results. * * Each function receives the results collected so far and returns a * prompt result or `undefined` to skip. * * @typeParam TResult - The shape of the accumulated results object. */ type PromptGroup = { [K in keyof TResult]: (opts: { readonly results: Partial; }) => Promise | undefined }; /** * Async iterable streaming log methods. * * Each method streams content token-by-token with a styled prefix. */ interface StreamLog { readonly info: (iterable: AsyncIterable) => Promise; readonly success: (iterable: AsyncIterable) => Promise; readonly error: (iterable: AsyncIterable) => Promise; readonly warn: (iterable: AsyncIterable) => Promise; readonly step: (iterable: AsyncIterable) => Promise; readonly message: (iterable: AsyncIterable) => Promise; } /** * Options for styled log messages (info, success, error, warn, step, message). */ interface LogMessageOptions { /** * Custom symbol prefix. */ readonly symbol?: string; /** * Number of blank lines before the message. */ readonly spacing?: number; /** * Secondary symbol for continuation lines. */ readonly secondarySymbol?: string; } /** * Options for a boxed note display. */ interface NoteOptions { /** * Custom line formatter applied to each line of the note body. */ readonly format?: (line: string) => string; } /** * Options for a bordered box display. */ interface BoxOptions { readonly width?: number | "auto"; readonly contentAlign?: "left" | "center" | "right"; readonly titleAlign?: "left" | "center" | "right"; readonly contentPadding?: number; readonly titlePadding?: number; readonly rounded?: boolean; /** * Custom border styling function. */ readonly formatBorder?: (text: string) => string; } /** * Structured logging API backed by `@clack/prompts` for styled terminal output. * * Provides info, success, error, warning, step, message, intro/outro, * note, box, stream, and raw output methods. Does not include prompts or * status indicators — those are separate on `ctx.prompts` and `ctx.status`. */ interface Log { /** * Log an informational message. */ readonly info: (message: string, opts?: LogMessageOptions) => void; /** * Log a success message. */ readonly success: (message: string, opts?: LogMessageOptions) => void; /** * Log an error message. */ readonly error: (message: string, opts?: LogMessageOptions) => void; /** * Log a warning message. */ readonly warn: (message: string, opts?: LogMessageOptions) => void; /** * Log a step indicator message. */ readonly step: (message: string, opts?: LogMessageOptions) => void; /** * Log a message with optional styling. */ readonly message: (message: string, opts?: LogMessageOptions) => void; /** * Print an intro banner with an optional title. */ readonly intro: (title?: string) => void; /** * Print an outro banner with an optional closing message. */ readonly outro: (message?: string) => void; /** * Display a boxed note with an optional title and formatting options. */ readonly note: (message?: string, title?: string, opts?: NoteOptions) => void; /** * Display a bordered box with an optional title and formatting options. */ readonly box: (message: string, title?: string, opts?: BoxOptions) => void; /** * Write a blank line to the output stream. */ readonly newline: () => void; /** * Write raw text followed by a newline to the output stream. */ readonly raw: (text: string) => void; /** * Streaming log methods for async iterables (token-by-token output). */ readonly stream: StreamLog; } /** * Interactive prompt methods available on the context. * * Each method suspends execution until the user provides input. * Cancellation (Ctrl-C) throws a ContextError with code `PROMPT_CANCELLED`. */ interface Prompts { confirm(opts: ConfirmOptions): Promise; text(opts: TextOptions): Promise; select(opts: SelectOptions): Promise; multiselect(opts: MultiSelectOptions): Promise; password(opts: PasswordOptions): Promise; autocomplete(opts: AutocompleteOptions): Promise; autocompleteMultiselect(opts: AutocompleteMultiSelectOptions): Promise; groupMultiselect(opts: GroupMultiSelectOptions): Promise; selectKey(opts: SelectKeyOptions): Promise; path(opts: PathOptions): Promise; group(prompts: PromptGroup, opts?: PromptGroupOptions): Promise; } /** * Terminal spinner for indicating long-running operations. */ interface Spinner { start(message?: string): void; stop(message?: string): void; message(message?: string): void; /** * End the spinner with a cancellation message. */ cancel(message?: string): void; /** * End the spinner with an error message. */ error(message?: string): void; /** * Clear the spinner from the terminal without a final message. */ clear(): void; /** * Whether the spinner was cancelled by the user. */ readonly isCancelled: boolean; } /** * A progress bar handle for tracking completion of an operation. */ interface ProgressBar { start(message?: string): void; advance(step?: number, message?: string): void; stop(message?: string): void; /** * Update the progress bar message without advancing. */ message(message?: string): void; /** * End the progress bar with a cancellation message. */ cancel(message?: string): void; /** * End the progress bar with an error message. */ error(message?: string): void; /** * Clear the progress bar from the terminal without a final message. */ clear(): void; /** * Whether the progress bar was cancelled by the user. */ readonly isCancelled: boolean; } /** * Options for creating a progress bar. */ interface ProgressOptions { readonly max?: number; readonly size?: number; readonly style?: "light" | "heavy" | "block"; } /** * A single task definition for the sequential task runner. */ interface TaskDef { readonly title: string; readonly task: (message: (msg: string) => void) => Promise; readonly enabled?: boolean; } /** * Options for a task log message call. */ interface TaskLogMessageOptions { /** * Pass `true` to skip line-level formatting and emit raw text. */ readonly raw?: boolean; } /** * Options for a task log completion call (success/error). */ interface TaskLogCompletionOptions { /** * When `true`, the accumulated log lines are retained after completion. */ readonly showLog?: boolean; } /** * Options for creating a task log. */ interface TaskLogOptions { readonly title: string; readonly limit?: number; readonly retainLog?: boolean; /** * Number of blank lines between groups. */ readonly spacing?: number; } /** * A task log sub-group handle returned by {@link TaskLogHandle.group}. */ interface TaskLogGroupHandle { message(line: string, opts?: TaskLogMessageOptions): void; success(message: string): void; error(message: string): void; } /** * A task log handle for streaming sub-process output. */ interface TaskLogHandle { message(line: string, opts?: TaskLogMessageOptions): void; success(message: string, opts?: TaskLogCompletionOptions): void; error(message: string, opts?: TaskLogCompletionOptions): void; /** * Create a named sub-group within this task log. */ group(name: string): TaskLogGroupHandle; } /** * Live stateful status indicators for in-flight work. * * Each method creates or runs an indicator that occupies terminal space * during an async operation and resolves when complete. */ interface Status { /** * Pre-created spinner for indicating long-running operations. */ readonly spinner: Spinner; /** * Create a progress bar for tracking completion. */ progress(opts?: ProgressOptions): ProgressBar; /** * Run a sequence of tasks with per-task spinners. */ tasks(tasks: readonly TaskDef[]): Promise; /** * Create a task log for streaming sub-process output. */ taskLog(opts: TaskLogOptions): TaskLogHandle; } /** * Pure string formatters for data serialization (no I/O). */ interface Format { /** * Serialize a value as pretty-printed JSON. */ json(data: unknown): string; /** * Format an array of objects as an aligned text table. */ table(rows: readonly Record[]): string; } /** * CLI metadata available on the context. Deeply immutable at the type level. */ interface Meta { /** * CLI name as defined in `cli({ name })`. */ readonly name: string; /** * CLI version as defined in `cli({ version })`. */ readonly version: string; /** * The resolved command path (e.g. `['deploy', 'preview']`). */ readonly command: readonly string[]; /** * Resolved directory names for file-backed stores. * * `local` resolves relative to the project root, `global` resolves * relative to the user's home directory. */ readonly dirs: ResolvedDirs; } /** * Keys on {@link CommandContext} that are stripped from {@link ScreenContext}. * * `log` and `status` are **not** stripped — they are swapped with * React-backed implementations by `screen()` so they render through * the `` component. * * Only properties that have no screen-safe equivalent are omitted: * `colors`, `fail`, `format`, `prompts`. */ /** * The context object threaded through every handler, middleware, and hook. * * Contains framework-level primitives: parsed args, CLI metadata, a key-value * store, formatting helpers, logging, prompts, status indicators, and a fail * function. Additional capabilities (e.g. `config`, `report`, `auth`) are * added by middleware via `decorateContext`. * * All data properties (args, meta) are deeply readonly — attempting to mutate * any nested property produces a compile-time error. Use `ctx.store` for * mutable state that flows between middleware and handlers. * * @typeParam TArgs - Parsed args type (inferred from the command's zod/yargs args definition). */ interface CommandContext { /** * Parsed and validated args for this command. Deeply immutable. */ readonly args: DeepReadonly>; /** * Color formatting utilities (picocolors). Use for coloring summary * values, diagnostic output, and other terminal text. */ readonly colors: Colors; /** * Dot directory manager for reading/writing files in the CLI's * dot directories (e.g. `~/.myapp/`, `/.myapp/`). */ readonly dotdir: DotDirectory; /** * Pure string formatters for data serialization (no I/O). */ readonly format: Format; /** * Structured logger for styled terminal output. */ readonly log: Log; /** * Interactive prompts (confirm, text, select, multiselect, password, autocomplete, path, group). */ readonly prompts: Prompts; /** * Live status indicators for in-flight work (spinner, progress, tasks, taskLog). */ readonly status: Status; /** * In-memory key-value store (mutable — use this for middleware-to-handler data flow). */ readonly store: Store>; /** * Throw a user-facing error with a clean message (no stack in production). */ readonly fail: (message: string, options?: { code?: string; exitCode?: number; }) => never; /** * CLI metadata (name, version, resolved command path). Deeply immutable. */ readonly meta: DeepReadonly; /** * Raw invocation data not processed by the arg parser. * * `argv` is a normalized token array where `argv[0]` is always the CLI * name regardless of invocation mode (`node script.js …` vs compiled * binary). Middleware can inspect the full invocation without guessing * the preamble offset. */ readonly raw: { readonly argv: readonly string[]; }; } //#endregion //#region src/types/middleware.d.ts /** * Environment descriptor for typed middleware. * Middleware declares the context variables it provides via the `Variables` property. * * @example * ```ts * middleware<{ Variables: { user: User } }>(async (ctx, next) => { * decorateContext(ctx, 'user', await fetchUser()) * await next() * }) * ``` */ interface MiddlewareEnv { readonly Variables?: AnyRecord; } /** * Extracts the `Variables` from a {@link MiddlewareEnv}, guarding against `any`. * Returns an empty object when `TEnv` is `any` or has no `Variables`. */ type ExtractVariables = IsAny extends true ? {} : TEnv extends { readonly Variables: infer TVars extends AnyRecord; } ? TVars : {}; /** * Extracts the `TEnv` type parameter from a {@link Middleware} instance. */ type MiddlewareEnvOf = T extends Middleware ? TEnv : MiddlewareEnv; /** * Walks a readonly middleware tuple and intersects all `Variables` from each element. * Produces the merged context variables type for a command handler. * * @example * ```ts * type Vars = InferVariables<[Middleware<{ Variables: { user: User } }>, Middleware<{ Variables: { org: Org } }>]> * // { user: User } & { org: Org } * ``` */ type InferVariables[]> = UnionToIntersection>>; /** * The next() function passed to middleware. Call it to continue to the next middleware or handler. */ type NextFunction = () => Promise; /** * A middleware function receives ctx and next. * * The `_TEnv` generic is phantom — it carries the environment type through * {@link Middleware} for type inference without affecting the runtime signature. */ type MiddlewareFn<_TEnv extends MiddlewareEnv = MiddlewareEnv> = (ctx: CommandContext, next: NextFunction) => Promise | void; /** * A middleware object wrapping a MiddlewareFn. Returned by the middleware() factory. */ type Middleware = Tagged<{ readonly handler: MiddlewareFn; }, "Middleware">; //#endregion //#region src/types/cli.d.ts /** * Global args merged into every ctx.args. */ interface KiddArgs {} /** * Global store keys merged into every ctx.store. */ interface KiddStore {} /** * Directory name overrides for file-backed stores (auth, config). * * Both `local` and `global` default to `.` when omitted. * Local resolves relative to the project root, global resolves relative * to the user's home directory. */ /** * Resolved directory names where both local and global are guaranteed strings. */ interface ResolvedDirs { readonly local: string; readonly global: string; } /** * Help output customization options. * * Used at both the CLI level and per-command level to control how help * text is displayed. */ interface HelpOptions { /** * Header text displayed above help output when the CLI is invoked * without a command. Not shown on `--help`. */ readonly header?: string; /** * Footer text displayed below help output (e.g., docs URL, bug report link). * Shown on all help output. */ readonly footer?: string; /** * Display order for subcommands. * Subcommands listed appear first in the specified order; omitted subcommands * fall back to alphabetical sort. */ readonly order?: readonly string[]; } /** * Options passed to `cli()`. */ //#endregion //#region src/types/command.d.ts /** * Yargs-native arg format -- accepted as an alternative to zod. * Converted to a zod schema internally before parsing. */ interface YargsArgDef { readonly type: "string" | "number" | "boolean" | "array"; readonly description?: string; readonly required?: boolean; readonly default?: unknown; readonly alias?: string | string[]; readonly choices?: readonly string[]; /** * When `true`, the flag is omitted from help output but remains functional. * Accepts a boolean or a function that returns a boolean, resolved at registration time. */ readonly hidden?: Resolvable; /** * Marks the flag as deprecated. A string value is used as the deprecation message; * `true` uses a default message. Resolved at registration time. */ readonly deprecated?: Resolvable; /** * Group heading under which this flag appears in help output. */ readonly group?: string; } /** * Arg definitions accepted by `command()`. * * Either a zod object schema (recommended) or a record of yargs-native arg * definitions. Both produce the same typed `ctx.args` -- yargs format is * converted to zod internally before parsing. */ type ArgsDef = z.ZodObject | Record; /** * Map a single yargs arg def to its TypeScript type. * * @private */ type YargsArgValue = TDef["required"] extends true ? YargsArgBaseType : TDef["default"] extends undefined ? YargsArgBaseType | undefined : YargsArgBaseType; /** * Map a yargs type string to its corresponding TypeScript type. * * @private */ type YargsArgBaseType = TType extends "string" ? string : TType extends "number" ? number : TType extends "boolean" ? boolean : TType extends "array" ? string[] : unknown; /** * Resolve the parsed args type from either format. */ type InferArgs = TDef extends z.ZodObject ? z.infer : TDef extends Record ? { [Key in keyof TDef]: YargsArgValue } : AnyRecord; /** * Merge inferred types from options and positionals into a single args type. * * Produces the intersection of both inferred types, giving the handler a * unified `ctx.args` containing all flags and positional values. */ type InferArgsMerged = InferSingleArgsDef & InferSingleArgsDef; /** * Infer the parsed type from a single args definition. * * Handles the Zod vs yargs-native distinction for a single `ArgsDef`. * * @private */ type InferSingleArgsDef = TDef extends z.ZodObject ? z.infer : InferArgs; /** * Handler function for a command. Receives the fully typed context. * * @typeParam TArgs - Parsed args type. * @typeParam TVars - Context variables contributed by typed middleware. */ type HandlerFn = (ctx: CommandContext & Readonly) => Promise | void; /** * Internal render function signature used by `screen()` commands. * * The runtime detects this property on a Command and delegates to it * instead of calling `handler`. Not part of the public `command()` API. * * @private */ type ScreenRenderFn = (ctx: CommandContext) => Promise | void; /** * Structured configuration for a command's subcommands. * * Groups the command source (inline map or directory path) into a single * cohesive object. */ /** * A resolved command object. Returned by command(). */ type Command[] = readonly Middleware[]> = Tagged<{ readonly name?: string; readonly aliases?: readonly string[]; readonly description?: string; readonly hidden?: boolean; readonly deprecated?: string | boolean; readonly options?: TOptionsDef; readonly positionals?: TPositionalsDef; readonly middleware?: TMiddleware; readonly commands?: CommandMap | Promise; readonly render?: ScreenRenderFn; readonly strict?: boolean; readonly help?: HelpOptions; readonly handler?: HandlerFn, InferVariables>; }, "Command">; /** * A map of command name to resolved {@link Command}. Used for subcommands and the manifest. */ interface CommandMap { readonly [name: string]: Command; } /** * Options accepted by `autoload()`. */ //#endregion //#region ../core/dist/types-oRrHau6b.d.ts //#region src/lib/format/types.d.ts /** * Status for a single check row (e.g. test file, lint check). */ type CheckStatus = "pass" | "fail" | "warn" | "skip" | "fix"; /** * Severity level for a finding. */ type FindingSeverity = "error" | "warning" | "hint"; /** * Input for a single pass/fail/warn check row. */ interface CheckInput { /** * Status of the check. */ readonly status: CheckStatus; /** * Display name (e.g. file path, test name). */ readonly name: string; /** * Optional detail text shown after the name. */ readonly detail?: string; /** * Duration in milliseconds. */ readonly duration?: number; /** * Optional hint shown at the end. */ readonly hint?: string; } /** * A labeled row in a summary block. */ interface SummaryStat { /** * Row label (e.g. "Tests", "Duration"). */ readonly label: string; /** * Row value — can contain pre-colored text. */ readonly value: string; } /** * Summary block: labeled rows aligned in a block. * * ``` * Tests 3 passed | 2 failed (5) * Duration 5.63s * ``` */ interface SummaryBlockInput { /** * Display as a multi-row summary block. */ readonly style: "tally"; /** * One or more labeled stat rows. */ readonly stats: readonly SummaryStat[]; } /** * Summary inline: pipe-separated one-liner. * * ``` * 1 error | 3 warnings | 95 files | in 142ms * ``` */ interface SummaryInlineInput { /** * Display as a single-line stats footer. */ readonly style: "inline"; /** * Pre-formatted stat segments to join with pipes. */ readonly stats: readonly string[]; } /** * Discriminated union for summary output. */ type SummaryInput = SummaryBlockInput | SummaryInlineInput; /** * Annotation applied to a line in a code frame. */ interface CodeFrameAnnotation { /** * 1-based line number to annotate. */ readonly line: number; /** * 1-based column where the annotation starts. */ readonly column: number; /** * Length of the annotated span. */ readonly length: number; /** * Message shown on the annotation line. */ readonly message: string; } /** * Input for a standalone annotated code snippet. */ interface CodeFrameInput { /** * File path displayed above the frame. */ readonly filePath: string; /** * Source lines to display. */ readonly lines: readonly string[]; /** * 1-based line number of the first line in `lines`. */ readonly startLine: number; /** * Annotation to render below the target line. */ readonly annotation: CodeFrameAnnotation; } /** * Input for a full finding (lint error/warning). */ interface FindingInput { /** * Severity of the finding. */ readonly severity: FindingSeverity; /** * Rule identifier (e.g. "no-unused-vars"). */ readonly rule: string; /** * Optional category (e.g. "correctness", "style"). */ readonly category?: string; /** * Finding message. */ readonly message: string; /** * Optional code frame showing the problematic code. */ readonly frame?: CodeFrameInput; /** * Optional help text with a suggested fix. */ readonly help?: string; } //#endregion //#endregion //#region ../core/dist/types-B36kA7b5.d.ts //#region src/middleware/report/types.d.ts /** * Structured reporting API for checks, findings, and summaries. * * Provides methods to write pass/fail rows, lint-style findings with * optional code frames, and summary blocks to the output stream. */ interface Report { /** * Write a single pass/fail/warn/skip/fix check row. */ readonly check: (input: CheckInput) => void; /** * Write a finding with optional code frame. */ readonly finding: (input: FindingInput) => void; /** * Write a summary block or inline stats. */ readonly summary: (input: SummaryInput) => void; } /** * Configuration options for the {@link report} middleware factory. */ /** * Augments the base {@link CommandContext} with an optional `report` property. * * When a consumer imports `@kidd-cli/core/report`, this declaration merges * `report` onto `CommandContext` so that `ctx.report` is typed without manual casting. */ declare module "@kidd-cli/core" { interface CommandContext { readonly report: Report; } } //#endregion //#endregion export { Command as t }; //# sourceMappingURL=index-DncR1eRv.d.ts.map