import { installSkill, isSkillInstalled } from '../../engine/skill-registry/installer.js';
/**
 * Auto-install recommended skills into the project's .claude/skills/ directory.
 *
 * - Already-installed skills are skipped without error.
 * - Failed installs are collected in `failed` and do not block the rest.
 * - The default source is 'anthropic'; skills may override via `skill.source`.
 */
export async function autoInstallRecommendedSkills(projectPath, skills) {
    const summary = { installed: [], skipped: [], failed: [] };
    for (const skill of skills) {
        try {
            const alreadyInstalled = await isSkillInstalled(projectPath, skill.name);
            if (alreadyInstalled) {
                summary.skipped.push(skill.name);
                continue;
            }
            await installSkill(skill.name, skill.source ?? 'anthropic', projectPath);
            summary.installed.push(skill.name);
        }
        catch (error) {
            // Non-blocking — continue with remaining skills
            summary.failed.push({ name: skill.name, error: String(error) });
        }
    }
    return summary;
}
//# sourceMappingURL=skill-auto-installer.js.map