UNPKG

@xec-sh/cli

Version:

Xec: The Universal Shell for TypeScript

67 lines (66 loc) 2.67 kB
import { Command } from 'commander'; import { CommandRegistry } from '@xec-sh/core'; export interface CliCommand { name: string; type: 'built-in' | 'dynamic'; path: string; description?: string; loaded: boolean; error?: string; aliases?: string[]; usage?: string; } export declare class CliCommandManager { private commands; private registry; private commandDirs; private scriptLoader; private initialized; constructor(); private initializeCommandDirs; private ensureInitialized; discoverAndLoad(program: Command): Promise<CliCommand[]>; discoverAll(): Promise<CliCommand[]>; private discoverBuiltInCommands; private discoverDynamicCommands; private discoverCommandsInDirectory; private loadDynamicCommands; private isCommandFile; private extractCommandMetadata; private parseDescription; private buildRegistry; private registerCommandsRecursively; private extractCommandInfo; private reportLoadingSummary; findCommand(program: Command, nameOrAlias: string): Command | null; addCommandDirectory(dir: string): void; getCommands(): CliCommand[]; getBuiltInCommands(): CliCommand[]; getDynamicCommands(): CliCommand[]; getLoadedCommands(): CliCommand[]; getFailedCommands(): CliCommand[]; getCommand(name: string): CliCommand | undefined; hasCommand(name: string): boolean; getCommandDirectories(): string[]; getRegistry(): CommandRegistry; static generateCommandTemplate(name: string, description?: string): string; static validateCommandFile(filePath: string): Promise<{ valid: boolean; error?: string; }>; } export declare function getCliCommandManager(): CliCommandManager; export declare function discoverAndLoadCommands(program: Command): Promise<CliCommand[]>; export declare function discoverAllCommands(): Promise<CliCommand[]>; export declare function loadDynamicCommands(program: Command): Promise<string[]>; export declare function buildCommandRegistry(program: Command): CommandRegistry; export declare function registerCliCommands(program: Command): CommandRegistry; export declare function findCommand(program: Command, nameOrAlias: string): Command | null; export { getCliCommandManager as getCommandManager }; export { getCliCommandManager as getDynamicCommandLoader }; export { getCliCommandManager as getCommandDiscovery }; export type { CommandSuggestion } from '@xec-sh/core'; export type DiscoveredCommand = CliCommand; export type DynamicCommand = CliCommand; export { CliCommandManager as CommandManager }; export { CliCommandManager as DynamicCommandLoader };