fix(converters): preserve Codex config on no-MCP install (#564)
This commit is contained in:
@@ -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]",
|
||||
|
||||
Reference in New Issue
Block a user