faf-cli
Version:
😽 TURBO-CAT: The Rapid Catalytic Converter • Project DNA ✨ for ANY AI • Fully Integrated with React, Next.js, Svelte, TypeScript, Vite & n8n • FREE FOREVER • 10,000+ developers • Championship Edition
152 lines • 3.96 kB
TypeScript
/**
* 🏎️ NATIVE CLI PARSER - COMMANDER DESTROYER
* Zero-dependency argument parsing
*
* "The ONE thing commander was doing - we do it BETTER!"
* DC VICTORY #3 INCOMING!
*/
export interface ParsedArgs {
command: string | null;
options: Record<string, any>;
args: string[];
rawArgs: string[];
}
export interface CommandDefinition {
name: string;
fullSignature?: string;
description: string;
options?: OptionDefinition[];
action?: (...args: any[]) => void | Promise<void>;
aliases?: string[];
}
export interface OptionDefinition {
flags: string;
description: string;
defaultValue?: any;
type?: 'boolean' | 'string' | 'number';
}
/**
* 🚀 The FAF CLI Parser - Championship Grade
*/
export declare class NativeCliParser {
private commands;
private globalOptions;
private versionString;
private descriptionText;
private programName;
private shortFlags;
constructor();
/**
* Set CLI name (commander compatibility)
*/
name(nameStr: string): this;
setName(nameStr: string): this;
/**
* Set CLI description
*/
description(desc: string): this;
setDescription(desc: string): this;
/**
* Set version
*/
version(ver: string): this;
setVersion(ver: string): this;
/**
* Add help text (commander compatibility)
*/
addHelpText(position: 'before' | 'after', text: string): this;
/**
* Add a global option
*/
option(flags: string, description: string, defaultValue?: any): this;
/**
* Add a command
*/
command(nameAndArgs: string): CommandBuilder;
/**
* Parse flags string to extract short/long mappings
*/
private parseFlags;
/**
* 🎯 THE CORE PARSER - This is what commander was doing!
*/
parse(argv?: string[]): ParsedArgs;
/**
* Execute parsed command
*
* 🏁 FIXED: Commander standard is args first, options last!
*/
execute(parsed: ParsedArgs): Promise<void>;
/**
* Parse and execute in one call (like commander's parse())
*/
run(argv?: string[]): Promise<void>;
/**
* Show help text
*/
private showHelp;
/**
* Helper to parse values (string, number, boolean)
*/
private parseValue;
/**
* Check if flag is typically boolean
*/
private isBooleanFlag;
/**
* Extract long flag from flags string
*/
private extractLongFlag;
/**
* Get parsed options (for compatibility)
*/
opts(): Record<string, any>;
/**
* Action method (commander compatibility)
*/
action(fn: (...args: any[]) => void | Promise<void>): this;
private programAction?;
/**
* Show help (commander compatibility)
*/
help(): string;
}
/**
* Command Builder for fluent API
*/
declare class CommandBuilder {
private command;
private parser;
constructor(command: CommandDefinition, parser: NativeCliParser);
description(desc: string): this;
option(flags: string, description: string, defaultValue?: any): this;
action(fn: (...args: any[]) => void | Promise<void>): this;
alias(alias: string): this;
addHelpText(position: 'before' | 'after', text: string): this;
}
/**
* 🏁 Export a singleton instance for drop-in replacement
*/
export declare const program: NativeCliParser;
/**
* Export the class as Command for compatibility
*/
export declare const Command: typeof NativeCliParser;
export {};
/**
* DC VICTORY STATUS:
*
* ✅ Parses all flag formats
* ✅ Maps short to long flags
* ✅ Handles values (string/number/boolean)
* ✅ Generates help text
* ✅ Routes commands
* ✅ Drop-in commander replacement
* ✅ FIXED: Correct argument order (args first, options last)
*
* Total lines: ~300 (vs 9,500 bytes of commander)
* Dependencies: ZERO
*
* COMMANDER IS GOING DOWN! 🎯
*/
//# sourceMappingURL=native-cli-parser.d.ts.map