fix(converters): preserve Codex config on no-MCP install (#564)

This commit is contained in:
alexph-dev
2026-04-16 00:06:42 +07:00
committed by GitHub
parent ee8e402897
commit ed778e62f1
2 changed files with 65 additions and 7 deletions

View File

@@ -524,6 +524,53 @@ describe("mergeCodexConfig", () => {
expect(result).toContain("[mcp_servers.new]")
})
test("preserves unmarked legacy content when no MCP servers are incoming", () => {
const existing = [
'model = "gpt-5.4"',
"",
"# Generated by compound-plugin",
"",
"[projects.example]",
'trust_level = "trusted"',
].join("\n")
const result = mergeCodexConfig(existing, null)!
expect(result).toContain("# Generated by compound-plugin")
expect(result).toContain("[projects.example]")
expect(result).toContain('trust_level = "trusted"')
})
test("strips bounded legacy MCP block when no MCP servers are incoming", () => {
const existing = [
"[user]",
'model = "gpt-5.4"',
"",
"# MCP servers synced from Claude Code",
"",
"[mcp_servers.old]",
'command = "old"',
].join("\n")
const result = mergeCodexConfig(existing, null)!
expect(result).toContain("[user]")
expect(result).not.toContain("# MCP servers synced from Claude Code")
expect(result).not.toContain("[mcp_servers.old]")
})
test("returns existing content byte-for-byte when no MCP servers or managed blocks exist", () => {
const existing = [
'model = "gpt-5.4"',
"",
"# Generated by compound-plugin",
"",
"[projects.example]",
'trust_level = "trusted"',
"",
].join("\n")
expect(mergeCodexConfig(existing, null)).toBe(existing)
})
test("preserves user config before unmarked legacy format", () => {
const existing = [
"[user]",