"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FeatureListCommand = void 0;
const commander_1 = require("commander");
const chalk_1 = __importDefault(require("chalk"));
const FeatureGraphCompiler_1 = require("../services/FeatureGraphCompiler");
exports.FeatureListCommand = new commander_1.Command("feature:list")
    .description("List all features with completeness scores and status")
    .option("--status <status>", "filter by status (planned, in-progress, completed)")
    .option("--priority <priority>", "filter by priority (high, medium, low)")
    .option("--json", "output as JSON")
    .action(async (options) => {
    const compiler = new FeatureGraphCompiler_1.FeatureGraphCompiler();
    const graph = await compiler.compileFromContext();
    let features = Array.from(graph.nodes.values());
    if (options.status) {
        features = features.filter((f) => f.status === options.status);
    }
    if (options.priority) {
        features = features.filter((f) => f.priority === options.priority);
    }
    if (options.json) {
        console.log(JSON.stringify(features, null, 2));
        return;
    }
    console.log(chalk_1.default.bold("\n📋 Feature List"));
    console.log(chalk_1.default.dim("─".repeat(60)));
    for (const node of features) {
        const statusIcon = node.status === "completed"
            ? chalk_1.default.green("✓")
            : node.status === "in-progress"
                ? chalk_1.default.yellow("●")
                : chalk_1.default.dim("○");
        const priorityColor = node.priority === "high"
            ? chalk_1.default.red
            : node.priority === "medium"
                ? chalk_1.default.yellow
                : chalk_1.default.dim;
        const completenessColor = node.completeness.overall >= 80
            ? chalk_1.default.green
            : node.completeness.overall >= 50
                ? chalk_1.default.yellow
                : chalk_1.default.red;
        console.log(`  ${statusIcon} ${chalk_1.default.bold(node.name)} ${chalk_1.default.dim(`(${node.id})`)}`);
        console.log(`     Priority: ${priorityColor(node.priority)} | Status: ${node.status} | Completeness: ${completenessColor(`${node.completeness.overall}%`)}`);
    }
    console.log(chalk_1.default.dim("─".repeat(60)));
    console.log(`  ${features.length} features total`);
    console.log();
});
//# sourceMappingURL=feature-list.js.map