fix: address code review findings for gemini target
- Extract named GeminiMcpServer type (eliminates NonNullable indexing) - Deep-merge mcpServers in settings.json (preserves existing entries) - Warn when existing settings.json cannot be parsed - Add test for uniqueName dedup (agent/skill name collision) - Add test for TOML triple-quote escaping Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -37,11 +37,14 @@ export async function writeGeminiBundle(outputRoot: string, bundle: GeminiBundle
|
||||
try {
|
||||
existingSettings = await readJson<Record<string, unknown>>(settingsPath)
|
||||
} catch {
|
||||
// If existing file is invalid JSON, start fresh
|
||||
console.warn("Warning: existing settings.json could not be parsed and will be replaced.")
|
||||
}
|
||||
}
|
||||
|
||||
const merged = { ...existingSettings, mcpServers: bundle.mcpServers }
|
||||
const existingMcp = (existingSettings.mcpServers && typeof existingSettings.mcpServers === "object")
|
||||
? existingSettings.mcpServers as Record<string, unknown>
|
||||
: {}
|
||||
const merged = { ...existingSettings, mcpServers: { ...existingMcp, ...bundle.mcpServers } }
|
||||
await writeJson(settingsPath, merged)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user