/** * Lightweight argument parser for the adapters CLI. * * Zero external dependencies. Handles: * - Long flags (--flag, --flag=value, --no-flag for booleans) * - Short flags (-a, -a value, combined -abc) * - Positional arguments * - -- terminator * - Repeatable flags (--tag x --tag y) */ /** Parsed CLI arguments. */ export interface ParsedArgs { /** The command (e.g., 'run', 'adapters'). */ command: string | undefined; /** The subcommand (e.g., 'list', 'show'). */ subcommand: string | undefined; /** Remaining positional arguments after command/subcommand. */ positionals: string[]; /** Named flags. Boolean flags are true/false. String/number flags are strings. */ flags: Record; } /** Known flag definition for the parser. */ export interface FlagDef { /** Short alias (single character). */ short?: string; /** Flag type. */ type: 'boolean' | 'string' | 'number'; /** Whether the flag can be specified multiple times. */ repeatable?: boolean; } /** * Global flags recognized by all commands. */ export declare const GLOBAL_FLAGS: Record; /** * Parse argv into structured args. * * @param argv - Arguments (typically process.argv.slice(2)) * @param extraFlags - Additional command-specific flag definitions */ export declare function parseArgs(argv: string[], extraFlags?: Record): ParsedArgs; /** * Get a flag value as a string, or undefined. */ export declare function flagStr(flags: Record, name: string): string | undefined; /** * Get a flag value as a number, or undefined. */ export declare function flagNum(flags: Record, name: string): number | undefined; /** * Get a flag value as a boolean. */ export declare function flagBool(flags: Record, name: string): boolean | undefined; /** * Get a flag value as a string array (for repeatable flags). */ export declare function flagArr(flags: Record, name: string): string[];