import { findCheckById, formatSuggestions, formatExplainTerminal, formatExplainJson, formatExplainMarkdown, } from "../core/audit/explainCheck.js";
import { logger } from "../utils/logger.js";
export async function explainCommand(checkId, options) {
    const result = findCheckById(checkId);
    if (!result.match) {
        logger.error(`Unknown check ID: ${checkId}`);
        logger.info(formatSuggestions(result.suggestions));
        process.exit(1);
    }
    const validFormats = ["terminal", "json", "md"];
    const format = options.format ?? "terminal";
    if (!validFormats.includes(format)) {
        logger.error(`Invalid format: ${format}. Use terminal, json, or md.`);
        process.exit(1);
    }
    switch (format) {
        case "json":
            console.log(formatExplainJson(result.match));
            break;
        case "md":
            console.log(formatExplainMarkdown(result.match));
            break;
        default:
            console.log(formatExplainTerminal(result.match));
            break;
    }
}
//# sourceMappingURL=explain.js.map