import { join, resolve } from 'path'; import { homedir } from 'os'; export function getOpencodeAdapter() { return { name: 'opencode', getBaseDir(scope, explicitTarget) { if (scope === 'project') { return explicitTarget ? resolve(explicitTarget) : process.cwd(); } const platform = process.platform; if (platform === 'win32') { return join(process.env.APPDATA || homedir(), 'opencode'); } else if (platform === 'darwin') { return join(homedir(), 'Library', 'Application Support', 'opencode'); } else { return join(homedir(), '.config', 'opencode'); } }, getInstallTasks(manifest, scope, baseDir) { const tasks = []; const configDir = scope === 'project' ? join(baseDir, '.opencode') : baseDir; for (const agent of manifest.agents) { tasks.push({ type: 'file', source: agent.source, target: join(configDir, 'agents', `${agent.name}.md`), recipe: { ...agent, recipeType: 'agent', platform: 'opencode' } }); } for (const skill of manifest.skills) { tasks.push({ type: 'file', source: skill.source, target: join(configDir, 'skills', skill.name, 'SKILL.md'), recipe: { ...skill, recipeType: 'skill', platform: 'opencode' } }); } for (const command of manifest.commands) { tasks.push({ type: 'file', source: command.source, target: join(configDir, 'commands', `${command.name}.md`), recipe: { ...command, recipeType: 'command', platform: 'opencode' } }); } return tasks; } }; }