"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.QuestionsAnswerCommand = void 0;
const commander_1 = require("commander");
const chalk_1 = __importDefault(require("chalk"));
const QuestionGraphEngine_1 = require("../services/QuestionGraphEngine");
exports.QuestionsAnswerCommand = new commander_1.Command("questions:answer")
    .description("Answer a blocking or pending question")
    .argument("<question-id>", "ID of the question to answer")
    .argument("<answer>", "answer value")
    .option("--resolved-by <name>", "who/what resolved this question")
    .action(async (questionId, answer, options) => {
    const engine = new QuestionGraphEngine_1.QuestionGraphEngine();
    await engine.load();
    const success = engine.answerQuestion(questionId, answer, options.resolvedBy || "user");
    if (!success) {
        console.error(chalk_1.default.red(`Question "${questionId}" not found`));
        process.exit(1);
    }
    await engine.save();
    console.log(chalk_1.default.green(`\n  ✓ Question "${questionId}" answered\n`));
    // Check if compilation is still blocked
    if (engine.isCompilationBlocked()) {
        const blockers = engine.getBlockers();
        console.log(chalk_1.default.yellow(`  ⚠ ${blockers.length} blocking question(s) still remain`));
        for (const q of blockers) {
            console.log(`     · ${q.text} ${chalk_1.default.cyan(`(${q.id})`)}`);
        }
    }
    else {
        console.log(chalk_1.default.green("  ✓ All blocking questions resolved — ready to execute\n"));
    }
});
//# sourceMappingURL=questions-answer.js.map