Preserve migration history during config migration

This commit is contained in:
YeonGyu-Kim
2026-04-25 00:41:19 +09:00
parent fbd4cfba9e
commit 33ac355645
4 changed files with 93 additions and 3 deletions
@@ -35,6 +35,31 @@ describe("migrateLegacyConfigFile", () => {
})
})
describe("#given a legacy config sidecar exists", () => {
describe("#when migrating the config file", () => {
it("#then copies applied migration history to the canonical sidecar", () => {
const legacyPath = join(testDir, "oh-my-opencode.json")
const legacySidecarPath = `${legacyPath}.migrations.json`
const canonicalSidecarPath = join(testDir, "oh-my-openagent.json.migrations.json")
writeFileSync(legacyPath, '{ "agents": { "oracle": { "model": "anthropic/claude-opus-4-6" } } }')
writeFileSync(
legacySidecarPath,
JSON.stringify({
appliedMigrations: [
"model-version:anthropic/claude-opus-4-6->anthropic/claude-opus-4-7",
],
}),
)
const result = migrateLegacyConfigFile(legacyPath)
expect(result).toBe(true)
expect(existsSync(canonicalSidecarPath)).toBe(true)
expect(readFileSync(canonicalSidecarPath, "utf-8")).toBe(readFileSync(legacySidecarPath, "utf-8"))
})
})
})
describe("#given oh-my-opencode.json exists but oh-my-openagent.json does not", () => {
describe("#when migrating the config file", () => {
it("#then copies to oh-my-openagent.json", () => {