fix(cli): support OpenCode ai type (#84)

This commit is contained in:
September999999999
2026-01-17 10:48:00 +08:00
committed by GitHub
parent e7c27e60af
commit 319a9393cd
5 changed files with 263 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
export type AIType = 'claude' | 'cursor' | 'windsurf' | 'antigravity' | 'copilot' | 'kiro' | 'roocode' | 'codex' | 'qoder' | 'gemini' | 'trae' | 'all';
export type AIType = 'claude' | 'cursor' | 'windsurf' | 'antigravity' | 'copilot' | 'kiro' | 'roocode' | 'codex' | 'qoder' | 'gemini' | 'trae' | 'opencode' | 'all';
export interface Release {
tag_name: string;
@@ -20,7 +20,7 @@ export interface InstallConfig {
force?: boolean;
}
export const AI_TYPES: AIType[] = ['claude', 'cursor', 'windsurf', 'antigravity', 'copilot', 'roocode', 'kiro', 'codex', 'qoder', 'gemini', 'trae', 'all'];
export const AI_TYPES: AIType[] = ['claude', 'cursor', 'windsurf', 'antigravity', 'copilot', 'roocode', 'kiro', 'codex', 'qoder', 'gemini', 'trae', 'opencode', 'all'];
export const AI_FOLDERS: Record<Exclude<AIType, 'all'>, string[]> = {
claude: ['.claude'],
@@ -34,4 +34,5 @@ export const AI_FOLDERS: Record<Exclude<AIType, 'all'>, string[]> = {
qoder: ['.qoder', '.shared'],
gemini: ['.gemini', '.shared'],
trae: ['.trae', '.shared'],
opencode: ['.opencode', '.shared'],
};

View File

@@ -43,7 +43,9 @@ export function detectAIType(cwd: string = process.cwd()): DetectionResult {
if (existsSync(join(cwd, '.trae'))) {
detected.push('trae');
}
if (existsSync(join(cwd, '.opencode'))) {
detected.push('opencode');
}
// Suggest based on what's detected
let suggested: AIType | null = null;
@@ -80,6 +82,8 @@ export function getAITypeDescription(aiType: AIType): string {
return 'Gemini CLI (.gemini/skills/ + .shared/)';
case 'trae':
return 'Trae (.trae/skills/ + .shared/)';
case 'opencode':
return 'OpenCode (.opencode/skills/ + .shared/)';
case 'all':
return 'All AI assistants';
}

View File

@@ -40,7 +40,7 @@ export async function copyFolders(
const copiedFolders: string[] = [];
const foldersToCopy = aiType === 'all'
? ['.claude', '.cursor', '.windsurf', '.agent', '.github', '.kiro', '.roo','.codex', '.gemini', '.trae', '.shared']
? Object.values(AI_FOLDERS).flat()
: AI_FOLDERS[aiType];
// Deduplicate folders (e.g., .shared might be listed multiple times)