"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SemanticsDefineCommand = void 0;
const commander_1 = require("commander");
const chalk_1 = __importDefault(require("chalk"));
const LivingDictionary_1 = require("../services/LivingDictionary");
exports.SemanticsDefineCommand = new commander_1.Command("semantics:define")
    .description("Add or update a term definition in the semantic dictionary")
    .argument("<term>", "term to define")
    .argument("<definition>", "definition text")
    .option("--category <category>", "category (entity, action, concept, ui, architecture)", "concept")
    .option("--aliases <aliases>", "comma-separated aliases")
    .option("--source <source>", "source label", "user")
    .option("--context <context>", "usage context")
    .action(async (term, definition, options) => {
    const categories = ["entity", "action", "concept", "ui", "architecture"];
    const category = categories.includes(options.category)
        ? options.category
        : "concept";
    const aliases = options.aliases
        ? options.aliases.split(",").map((a) => a.trim())
        : [];
    const dict = new LivingDictionary_1.LivingDictionary();
    await dict.load();
    const entry = dict.defineTerm(term, definition, category, options.source, options.context || "", aliases);
    await dict.save();
    console.log(chalk_1.default.green(`\n  ✓ Term defined: ${chalk_1.default.bold(entry.term)}`));
    console.log(`     ${chalk_1.default.dim("Definition:")} ${entry.definition}`);
    console.log(`     ${chalk_1.default.dim("Category:")}   ${entry.category}`);
    if (aliases.length > 0) {
        console.log(`     ${chalk_1.default.dim("Aliases:")}    ${aliases.join(", ")}`);
    }
    console.log();
});
//# sourceMappingURL=semantics-define.js.map