The open source coding agent.
TypeScript
fix(auth): Respect disabled/enabled providers config in auth login (#4940)
Stephen Collings1eaf5c31d378
diff --git a/packages/opencode/src/cli/cmd/auth.ts b/packages/opencode/src/cli/cmd/auth.tsindex ae24fbef599..1f37ec8058e 100644--- a/packages/opencode/src/cli/cmd/auth.ts+++ b/packages/opencode/src/cli/cmd/auth.ts@@ -6,6 +6,7 @@ import { ModelsDev } from "../../provider/models"import { map, pipe, sortBy, values } from "remeda"import path from "path"import os from "os"+import { Config } from "../../config/config"import { Global } from "../../global"import { Plugin } from "../../plugin"import { Instance } from "../../project/instance"@@ -103,7 +104,22 @@ export const AuthLoginCommand = cmd({return}await ModelsDev.refresh().catch(() => {})- const providers = await ModelsDev.get()++ const config = await Config.get()++ const disabled = new Set(config.disabled_providers ?? [])+ const enabled = config.enabled_providers ? new Set(config.enabled_providers) : undefined++ const providers = await ModelsDev.get().then((x) => {+ const filtered: Record<string, (typeof x)[string]> = {}+ for (const [key, value] of Object.entries(x)) {+ if ((enabled ? enabled.has(key) : true) && !disabled.has(key)) {+ filtered[key] = value+ }+ }+ return filtered+ })+const priority: Record<string, number> = {opencode: 0,anthropic: 1,