diff --git a/.changeset/fix-migration-default-yolo.md b/.changeset/fix-migration-default-yolo.md new file mode 100644 index 0000000000..453b9811a5 --- /dev/null +++ b/.changeset/fix-migration-default-yolo.md @@ -0,0 +1,6 @@ +--- +"@moonshot-ai/migration-legacy": patch +"@moonshot-ai/kimi-code": patch +--- + +Fix migration mapping the legacy `default_yolo` key to the dead `yolo` field instead of `default_permission_mode`. diff --git a/packages/migration-legacy/src/steps/config.ts b/packages/migration-legacy/src/steps/config.ts index 29c2b64630..72dd8e1689 100644 --- a/packages/migration-legacy/src/steps/config.ts +++ b/packages/migration-legacy/src/steps/config.ts @@ -310,8 +310,8 @@ export async function migrateConfigStep(input: ConfigStepInput): Promise { - // A target with e.g. `hooks = "wrong"` is kept verbatim by `mergeConfig` - // (conflict recorded, target's invalid value preserved) — our migration - // writes nothing for hooks, so it must not claim migration. An - // `Array.isArray(...)` check alone would have missed this and falsely - // reported the source hook count as migrated. + it('maps default_yolo to default_permission_mode = "yolo"', async () => { await writeFile( join(src, 'config.toml'), - '[[hooks]]\nevent = "PreToolUse"\ncommand = "echo a"\n', + 'default_yolo = true\n', ); - await writeFile(join(tgt, 'config.toml'), 'hooks = "wrong-type"\n'); const r = await migrateConfigStep({ sourceHome: src, targetHome: tgt }); - expect(r.migratedHooks).toBe(0); + expect(r.migrated).toBe(true); + const written = await readFile(join(tgt, 'config.toml'), 'utf-8'); + expect(written).toContain('default_permission_mode = "yolo"'); + expect(written).not.toContain('yolo = true'); }); });