"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.QuestionsGenerateCommand = void 0;
const commander_1 = require("commander");
const chalk_1 = __importDefault(require("chalk"));
const QuestionGraphEngine_1 = require("../services/QuestionGraphEngine");
exports.QuestionsGenerateCommand = new commander_1.Command("questions:generate")
    .description("Harvest questions from all sources (prompt, context, intent)")
    .argument("[prompt]", "natural language prompt to extract questions from")
    .option("--from-context", "scan context.json for gaps")
    .option("--json", "output as JSON")
    .action(async (prompt, options) => {
    const engine = new QuestionGraphEngine_1.QuestionGraphEngine();
    await engine.load();
    const generated = [];
    if (prompt) {
        const promptQuestions = await engine.harvestFromPrompt(prompt);
        generated.push(...promptQuestions);
    }
    if (options.fromContext) {
        // Future: scan context.json features for ownership gaps
        console.log(chalk_1.default.dim("  Scanning context.json for gaps..."));
    }
    await engine.save();
    if (options.json) {
        console.log(JSON.stringify(generated, null, 2));
        return;
    }
    if (generated.length === 0) {
        console.log(chalk_1.default.dim("\n  No new questions generated\n"));
        return;
    }
    console.log(chalk_1.default.green(`\n  ✓ Generated ${generated.length} new question(s)\n`));
    for (const q of generated) {
        const severityColor = q.severity === "blocking"
            ? chalk_1.default.red("● blocking")
            : q.severity === "important"
                ? chalk_1.default.yellow("● important")
                : chalk_1.default.dim("○ optional");
        console.log(`  ${severityColor} ${q.text}`);
        console.log(`     ${chalk_1.default.dim("ID:")} ${chalk_1.default.cyan(q.id)}`);
    }
    // Show overall count
    console.log();
    const counts = engine.countBySeverity();
    console.log(chalk_1.default.dim(`  Total: ${Array.from(engine.getGraph().nodes.values()).length} questions | ${counts.blocking} blocking`));
    console.log();
});
//# sourceMappingURL=questions-generate.js.map