import { join } from 'node:path';
import { copyDirWithVersionCheck } from '../../../init/tools/shared/copy-helpers.js';
import { BRAINSTORM_SKILLS } from '../../../init/tools/shared/skill-manifest.js';
export { BRAINSTORM_SKILLS };
export async function installBrainstorm(options) {
    const force = options.force ?? false;
    const result = {
        copiedSkills: [],
        updatedSkills: [],
        skippedSkills: [],
        outdatedSkills: [],
    };
    for (const skill of BRAINSTORM_SKILLS) {
        const source = join(options.assetsRoot, 'skills', skill);
        const destination = join(options.targetRoot, '.agents', 'skills', skill);
        // The visual-companion bundle (scripts/, references/) ships under the
        // skill directory and copies along with it via copyDirWithVersionCheck.
        const copyResult = await copyDirWithVersionCheck(source, destination, force);
        if (copyResult.status === 'copied') {
            result.copiedSkills.push(skill);
        }
        else if (copyResult.status === 'updated') {
            result.updatedSkills.push(skill);
        }
        else if (copyResult.status === 'outdated') {
            result.outdatedSkills.push({
                name: skill,
                installed: copyResult.installedVersion ?? null,
                bundled: copyResult.bundledVersion ?? null,
            });
        }
        else {
            result.skippedSkills.push(skill);
        }
    }
    return result;
}
