/** * Agent-discoverable help: machine-readable command tree for --help --json. * * Static command registry mirroring bin.ts yargs definitions. * yargs v18 doesn't expose public APIs for command introspection, * so we maintain a parallel typed registry. */ export interface OptionSchema { name: string; type: 'string' | 'boolean' | 'number' | 'array'; description: string; required: boolean; default?: unknown; alias?: string; choices?: string[]; hidden: boolean; } export interface PositionalSchema { name: string; type: string; description: string; required: boolean; } export interface CommandSchema { name: string; description: string; commands?: CommandSchema[]; options?: OptionSchema[]; positionals?: PositionalSchema[]; examples?: string[]; } export interface HelpOutput { name: string; version: string; description: string; commands: CommandSchema[]; options: OptionSchema[]; } /** * Extract the requested command from raw argv before yargs parses --help. * * This intentionally matches only known command names so option values from * global flags like `--mode agent` are not mistaken for commands. */ export declare function extractHelpJsonCommand(argv: string[]): string | undefined; /** * Build a machine-readable command tree for --help --json output. * * @param subcommand - Optional command name to return a subtree for (e.g. "env"). * Returns full tree if omitted or if command not found. */ /** * Top-level command names (first token of each registered command). Used by * telemetry to recognise real commands without trusting arbitrary argv tokens * (so option values / secrets are never recorded as a command name). */ export declare function getTopLevelCommandNames(): string[]; export declare function buildCommandTree(subcommand?: string): HelpOutput | CommandSchema;