/**
 * Cline Adapter
 */
import * as path from 'path';
import * as fs from '../../utils/fs-native.js';
import { AdapterBase } from '../adapter-base.js';
export class ClineAdapter extends AdapterBase {
    constructor() {
        super(...arguments);
        this.name = 'cline';
        this.description = 'Cline adapter — skills installed in .cline/skills/';
        this.automationLevel = 'semi';
    }
    async detect() {
        return await this.fileExists('.clinerules') || await this.fileExists('.cline');
    }
    getFiles() {
        return [];
    }
    async install(options) {
        console.log('\n📦 Installing Cline Adapter\n');
        await fs.ensureDir(path.join(options.projectPath, '.cline/skills'));
        console.log('\n✨ Cline adapter installed!');
        console.log('   Run `specweave refresh-plugins` to install skills.');
    }
    supportsPlugins() {
        return true;
    }
    getSkillsDirectory() {
        return '.cline/skills';
    }
    async compilePlugin(plugin) {
        const skillsDir = '.cline/skills';
        console.log(`\n📦 Installing plugin skills for Cline: ${plugin.manifest.name}`);
        await this.writeSkillFiles(plugin, skillsDir);
        console.log(`   ✓ ${plugin.skills.length} skill(s) written to ${skillsDir}/`);
        console.log(`\n✅ Plugin ${plugin.manifest.name} installed for Cline!`);
    }
    async unloadPlugin(pluginName) {
        console.log(`\n🗑️  Unloading plugin from Cline: ${pluginName}`);
        await this.removeSkillFiles(pluginName, '.cline/skills');
        console.log(`   ✓ Removed from .cline/skills/`);
        console.log(`\n✅ Plugin ${pluginName} unloaded!`);
    }
    async getInstalledPlugins() {
        return await this.listInstalledPluginsInDir('.cline/skills');
    }
    async postInstall(options) {
        console.log(this.getInstructions());
    }
    getInstructions() {
        return `
Cline Adapter

Skills installed in .cline/skills/.
Run: specweave refresh-plugins
    `;
    }
}
//# sourceMappingURL=adapter.js.map