aicm
Version:
A TypeScript CLI tool for managing AI IDE rules across different projects and teams
41 lines (40 loc) • 1.78 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.listCommand = listCommand;
const chalk_1 = __importDefault(require("chalk"));
const config_1 = require("../utils/config");
async function listCommand() {
const config = await (0, config_1.loadConfig)();
if (!config) {
console.log(chalk_1.default.red("Configuration file not found!"));
console.log(`Run ${chalk_1.default.blue("npx aicm init")} to create one.`);
return;
}
const hasRules = config.rules && config.rules.length > 0;
const hasCommands = config.commands && config.commands.length > 0;
if (!hasRules && !hasCommands) {
console.log(chalk_1.default.yellow("No rules or commands defined in configuration."));
console.log(`Edit your ${chalk_1.default.blue("aicm.json")} file to add rules or commands.`);
return;
}
if (hasRules) {
console.log(chalk_1.default.blue("Configured Rules:"));
console.log(chalk_1.default.dim("─".repeat(50)));
for (const rule of config.rules) {
console.log(`${chalk_1.default.bold(rule.name)} - ${rule.sourcePath} ${rule.presetName ? `[${rule.presetName}]` : ""}`);
}
}
if (hasCommands) {
if (hasRules) {
console.log();
}
console.log(chalk_1.default.blue("Configured Commands:"));
console.log(chalk_1.default.dim("─".repeat(50)));
for (const command of config.commands) {
console.log(`${chalk_1.default.bold(command.name)} - ${command.sourcePath} ${command.presetName ? `[${command.presetName}]` : ""}`);
}
}
}