/** * CLI Command Parser * Advanced argument parsing with validation and type coercion * * File-size sweep: the class's method BODIES are grouped into sibling * modules — flag tokenizing/merging/coercion in parser-flags.ts, short-flag * alias and boolean/array flag-scope building in parser-aliases.ts, and * default application + flag validation in parser-validate.ts — mixed onto * CommandParser.prototype below. Each stays a real method here (same * signature, same visibility) so callers and TypeScript see no difference; * the body is just `return theSiblingImpl.call(this, ...args)`. Fields those * bodies read/write moved from `private` to `protected` (compile-time only; * no runtime change) — TypeScript allows a standalone function typed * `this: CommandParser` to reach `protected` members but not `private` ones, * so `protected` is the minimum visibility the split needs. The two * `private static` members with no external references (RESERVED_FLAG_KEYS, * asChain) don't have that this-typed escape hatch for static access, so * they moved wholesale into the sibling file that uses them instead. */ import type { Command, CommandOption, ParsedFlags } from './types.js'; export interface ParseResult { command: string[]; flags: ParsedFlags; positional: string[]; raw: string[]; } export interface ParserOptions { stopAtFirstNonFlag?: boolean; allowUnknownFlags?: boolean; booleanFlags?: string[]; stringFlags?: string[]; arrayFlags?: string[]; aliases?: Record; defaults?: Record; } export declare class CommandParser { protected options: ParserOptions; protected commands: Map; protected globalOptions: CommandOption[]; constructor(options?: ParserOptions); private initializeGlobalOptions; registerCommand(command: Command): void; getCommand(name: string): Command | undefined; getAllCommands(): Command[]; protected setFlagSafe(flags: ParsedFlags, key: string, value: string | number | boolean): void; private mergeParsedFlags; parse(args: string[]): ParseResult; protected camelToKebab(key: string): string; private mirrorFlagKeys; protected looksLikeNegativeNumber(value: string): boolean; private parseFlag; protected setBooleanFlag(flags: ParsedFlags, key: string, args: string[], nextIndex: number): number; protected parseValue(value: string): string | number | boolean; protected normalizeKey(key: string): string; protected buildAliases(): Record; private buildScopedAliases; private getScopedBooleanFlags; private getScopedArrayFlags; protected getBooleanFlags(): Set; private applyDefaults; validateFlags(flags: ParsedFlags, command?: Command): string[]; getGlobalOptions(): CommandOption[]; } export declare const commandParser: CommandParser; //# sourceMappingURL=parser.d.ts.map