diff --git a/cli/src/utils/detect.ts b/cli/src/utils/detect.ts index b15274c..ccc94b3 100755 --- a/cli/src/utils/detect.ts +++ b/cli/src/utils/detect.ts @@ -19,7 +19,10 @@ export function detectAIType(cwd: string = process.cwd()): DetectionResult { if (existsSync(join(cwd, '.windsurf'))) { detected.push('windsurf'); } - if (existsSync(join(cwd, '.agents')) || existsSync(join(cwd, '.agent'))) { + if (existsSync(join(cwd, '.agents'))) { + detected.push('antigravity'); + detected.push('codex'); + } else if (existsSync(join(cwd, '.agent'))) { detected.push('antigravity'); } if (existsSync(join(cwd, '.github'))) { @@ -28,7 +31,7 @@ export function detectAIType(cwd: string = process.cwd()): DetectionResult { if (existsSync(join(cwd, '.kiro'))) { detected.push('kiro'); } - if (existsSync(join(cwd, '.codex'))) { + if (existsSync(join(cwd, '.codex')) && !detected.includes('codex')) { detected.push('codex'); } if (existsSync(join(cwd, '.roo'))) { @@ -72,6 +75,13 @@ export function detectAIType(cwd: string = process.cwd()): DetectionResult { let suggested: AIType | null = null; if (detected.length === 1) { suggested = detected[0]; + } else if ( + detected.length === 2 && + detected.includes('antigravity') && + detected.includes('codex') + ) { + // Both platforms share `.agents`; avoid suggesting an install for every AI. + suggested = 'codex'; } else if (detected.length > 1) { suggested = 'all'; } diff --git a/cli/src/utils/template.ts b/cli/src/utils/template.ts index 273e703..743e833 100755 --- a/cli/src/utils/template.ts +++ b/cli/src/utils/template.ts @@ -294,10 +294,20 @@ export async function generatePlatformFiles( */ export async function generateAllPlatformFiles(targetDir: string, isGlobal = false, force = false): Promise { const allFolders = new Set(); + const generatedSkillFiles = new Set(); for (const aiType of Object.keys(AI_TO_PLATFORM)) { try { + const config = await loadPlatformConfig(aiType); + const skillFile = join( + config.folderStructure.root, + config.folderStructure.skillPath, + config.folderStructure.filename + ); + if (generatedSkillFiles.has(skillFile)) continue; + const folders = await generatePlatformFiles(targetDir, aiType, isGlobal, force); + generatedSkillFiles.add(skillFile); folders.forEach(f => allFolders.add(f)); } catch { // Skip if generation fails for a platform