ccguard
Version:
Automated enforcement of net-negative LOC, complexity constraints, and quality standards for Claude code
36 lines • 1.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CommandRegistry = void 0;
class CommandRegistry {
commands = new Map();
register(command) {
// Register main command name
this.commands.set(command.name.toLowerCase(), command);
// Register aliases
if (command.aliases) {
for (const alias of command.aliases) {
this.commands.set(alias.toLowerCase(), command);
}
}
}
get(name) {
return this.commands.get(name.toLowerCase());
}
getAll() {
// Return unique commands (avoid duplicates from aliases)
const uniqueCommands = new Map();
for (const command of this.commands.values()) {
uniqueCommands.set(command.name, command);
}
return Array.from(uniqueCommands.values());
}
static createWithDefaults(commands) {
const registry = new CommandRegistry();
for (const command of commands) {
registry.register(command);
}
return registry;
}
}
exports.CommandRegistry = CommandRegistry;
//# sourceMappingURL=CommandRegistry.js.map