import { type Config } from "../config.js"; import { DeliveryLog } from "../delivery-log.js"; import { type Secrets } from "../env.js"; import { JobStore } from "../jobs.js"; import { type Paths } from "../paths.js"; import { SkillRegistry } from "../registry.js"; export type FlagValue = string | boolean | string[]; export type Flags = Record; export interface CliIO { stdout: (text: string) => void; stderr: (text: string) => void; env: NodeJS.ProcessEnv; isTTY: boolean; stdin?: () => Promise; /** Opens a link in the person's browser (`cloud login`); false when it could not. Without it nothing is ever opened. */ openUrl?: (url: string) => boolean; /** How the CLI waits between polls (`cloud login`); tests pass a quick one. */ sleep?: (ms: number) => Promise; } export declare class UsageError extends Error { readonly usage?: string | undefined; constructor(message: string, usage?: string | undefined); } export declare class CommandError extends Error { readonly exitCode: number; constructor(message: string, exitCode?: number); } /** `positionalIndexes`: where each positional sat in `argv` (a command that reads its own arguments starts after one). */ export declare function parseArgs(argv: string[]): { flags: Flags; positionals: string[]; positionalIndexes: number[]; }; export declare function str(flags: Flags, ...names: string[]): string | undefined; export declare function list(flags: Flags, ...names: string[]): string[]; export declare function bool(flags: Flags, ...names: string[]): boolean; export declare function num(flags: Flags, ...names: string[]): number | undefined; export interface Ctx { paths: Paths; flags: Flags; args: string[]; /** The command line without the command's name, as given: for a command that reads its words with its own rules. */ rawArgs: string[]; json: boolean; io: CliIO; /** Prints the human text, or the JSON value when --json is set. */ print(human: string, data?: unknown): void; warn(text: string): void; config(): Config; secrets(): Secrets; registry(): SkillRegistry; store(): JobStore; deliveryLog(): DeliveryLog; } export declare function createCtx(flags: Flags, args: string[], io: CliIO, rawArgs?: string[]): Ctx; export declare function table(rows: string[][], header?: string[]): string; export declare function relativeTime(iso: string | undefined, now?: number): string; export declare function formatDuration(ms: number | undefined): string; /** Reads a `--payload` value: a JSON literal, `@file`/path to a file, or `-` for stdin. */ export declare function readPayloadArg(ctx: Ctx, value: string | undefined): Promise<{ payload: unknown; raw: string; }>; export declare function parseHeaderFlags(values: string[]): Record; /** Asks at the terminal without echoing the answer (a secret never shows on screen or in scrollback). */ export declare function promptHidden(question: string): Promise;