diff --git a/src/commands/migrate.test.ts b/src/commands/migrate.test.ts index 3a81998e524..da241cfc9b1 100644 --- a/src/commands/migrate.test.ts +++ b/src/commands/migrate.test.ts @@ -617,6 +617,32 @@ describe("migrateApplyCommand", () => { expect(mocks.provider.apply).toHaveBeenCalledTimes(1); }); + it("lets --no-auth-credentials override explicit secret import", async () => { + const planned = authPlan("skipped"); + const applied: MigrationApplyResult = { + ...planned, + items: planned.items, + }; + mocks.provider.plan.mockImplementation(async (ctx) => { + expect(ctx.includeSecrets).toBe(false); + return planned; + }); + mocks.provider.apply.mockImplementation(async (ctx) => { + expect(ctx.includeSecrets).toBe(false); + return applied; + }); + + await migrateApplyCommand(runtime, { + provider: "hermes", + yes: true, + includeSecrets: true, + authCredentials: false, + }); + + expect(mocks.provider.plan).toHaveBeenCalledTimes(1); + expect(mocks.provider.apply).toHaveBeenCalledTimes(1); + }); + it("prompts for Codex skills before interactive default apply", async () => { Object.defineProperty(process.stdin, "isTTY", { configurable: true, diff --git a/src/commands/migrate.ts b/src/commands/migrate.ts index 84aca86571a..6c4a9c5c540 100644 --- a/src/commands/migrate.ts +++ b/src/commands/migrate.ts @@ -69,12 +69,12 @@ function hasPlannedAuthCredentialItem(plan: MigrationPlan): boolean { function resolveDefaultIncludeSecrets( opts: T, ): T { - if (opts.includeSecrets !== undefined) { - return opts; - } if (opts.authCredentials === false) { return { ...opts, includeSecrets: false }; } + if (opts.includeSecrets !== undefined) { + return opts; + } return opts; }