/**
 * Slash command registry for Pi Agent.
 * Simplified version matching the compiled JavaScript.
 */
class CommandRegistryImpl {
    commands = new Map();
    register(command) {
        this.commands.set(command.name, command);
        if (command.aliases) {
            for (const alias of command.aliases) {
                this.commands.set(alias, command);
            }
        }
    }
    get(name) {
        return this.commands.get(name.toLowerCase());
    }
    getAll() {
        // Deduplicate (aliases point to same object)
        const seen = new Set();
        const result = [];
        for (const cmd of this.commands.values()) {
            if (!seen.has(cmd)) {
                seen.add(cmd);
                result.push(cmd);
            }
        }
        return result;
    }
    getVisible() {
        return this.getAll().filter(cmd => !cmd.isHidden);
    }
    getCompletions(prefix) {
        const lower = prefix.toLowerCase();
        const names = [];
        for (const cmd of this.getVisible()) {
            if (('/' + cmd.name).startsWith(lower)) {
                names.push('/' + cmd.name);
            }
            if (cmd.aliases) {
                for (const alias of cmd.aliases) {
                    if (('/' + alias).startsWith(lower)) {
                        names.push('/' + alias);
                    }
                }
            }
        }
        return names.sort();
    }
}
export const commandRegistry = new CommandRegistryImpl();
//# sourceMappingURL=registry.js.map