/** * Command Registry - Slash Command Management * * Provides a registry for slash commands with: * - Command registration and discovery * - Help text generation * - Category organization * - Command execution delegation * * Usage: * ```typescript * const registry = new CommandRegistry(); * * registry.register({ * name: '/help', * aliases: ['/?'], * description: 'Show help information', * category: 'navigation', * handler: async (context) => { * context.showHelp(); * }, * }); * * await registry.execute('/help', '', context); * ``` */ export type CommandCategory = 'navigation' | 'model' | 'context' | 'session' | 'tools' | 'development' | 'security' | 'advanced' | 'learning' | 'ui'; export interface CommandContext { /** The shell instance for accessing shell methods */ shell: unknown; /** Current input/arguments */ input: string; /** Raw command string */ rawCommand: string; } export interface CommandDefinition { /** Primary command name (e.g., '/help') */ name: string; /** Alternative names for the command */ aliases?: string[]; /** Short description for help text */ description: string; /** Category for organization */ category: CommandCategory; /** Whether command is async */ async?: boolean; /** Whether command is hidden from help */ hidden?: boolean; /** Usage example */ usage?: string; /** Handler function */ handler: (context: CommandContext) => void | Promise; } export interface CommandMatch { command: CommandDefinition; matchedName: string; } export declare class CommandRegistry { private commands; private aliasMap; /** * Register a command */ register(command: CommandDefinition): this; /** * Register multiple commands */ registerAll(commands: CommandDefinition[]): this; /** * Find a command by name or alias */ find(commandName: string): CommandMatch | null; /** * Check if a command exists */ has(commandName: string): boolean; /** * Execute a command */ execute(commandName: string, input: string, shell: unknown): Promise; /** * Get all commands in a category */ getByCategory(category: CommandCategory): CommandDefinition[]; /** * Get all categories with their commands */ getAllCategories(): Map; /** * Get all registered commands */ getAll(): CommandDefinition[]; /** * Get all visible commands (excluding hidden) */ getVisible(): CommandDefinition[]; /** * Generate help text for all commands */ generateHelpText(): string; /** * Generate compact help text (just command names) */ generateCompactHelp(): string; /** * Normalize command name */ private normalizeName; /** * Format category name for display */ private formatCategoryName; } /** * Create a standard set of commands for the shell * * This is meant to be extended/customized by the shell implementation */ export declare function createBaseCommands(): CommandDefinition[]; export declare function getCommandRegistry(): CommandRegistry; export declare function resetCommandRegistry(): void; //# sourceMappingURL=commandRegistry.d.ts.map