import { auditClaudeMd, auditRules, auditMemory, auditSettings, calculateScore, pickQuickWins, } from '../engine/claude-config-auditor/index.js';
export async function handleAuditClaudeConfig(params) {
    const { projectPath, includeGlobal = true } = params;
    const [claudeMdFindings, rulesFindings, memoryFindings, settingsFindings] = await Promise.all([
        auditClaudeMd(projectPath, includeGlobal),
        auditRules(projectPath, includeGlobal),
        auditMemory(projectPath),
        auditSettings(projectPath),
    ]);
    const allFindings = [
        ...claudeMdFindings,
        ...rulesFindings,
        ...memoryFindings,
        ...settingsFindings,
    ];
    const { score, grade } = calculateScore(allFindings);
    const quickWins = pickQuickWins(allFindings);
    const criticalCount = allFindings.filter((f) => f.severity === 'critical').length;
    const warnCount = allFindings.filter((f) => f.severity === 'warn').length;
    const infoCount = allFindings.filter((f) => f.severity === 'info').length;
    const topQuickWin = quickWins[0]?.suggestion ?? 'none';
    const summary = allFindings.length === 0
        ? `Your Claude Code workspace configuration is excellent! Score: ${String(score)}/100 (${grade}).`
        : `Claude Code workspace audit: ${String(score)}/100 (${grade}). Found ${String(criticalCount)} critical, ${String(warnCount)} warnings, ${String(infoCount)} info items.${quickWins.length > 0 ? ` Top quick win: ${topQuickWin}` : ''}`;
    return {
        content: [
            {
                type: 'text',
                text: JSON.stringify({ score, grade, findings: allFindings, quickWins, summary }, null, 2),
            },
        ],
    };
}
//# sourceMappingURL=audit-claude-config.js.map