Skip to content

Commit 9d7b719

Browse files
committed
fix(auth): display $schema and provider config in auth list
Display $schema field if present in auth.json Display configured providers from provider section Show whether each provider has credentials configured Fixes anomalyco#4533
1 parent f2100dc commit 9d7b719

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

  • packages/opencode/src/cli/cmd

‎packages/opencode/src/cli/cmd/auth.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { Instance } from "../../project/instance"
1313
import type { Hooks } from "@opencode-ai/plugin"
1414
import { Process } from "../../util/process"
1515
import { text } from "node:stream/consumers"
16+
import { Filesystem } from "../../util/filesystem"
1617

1718
type PluginAuth = NonNullable<Hooks["auth"]>
1819

@@ -214,6 +215,20 @@ export const AuthListCommand = cmd({
214215
const results = Object.entries(await Auth.all())
215216
const database = await ModelsDev.get()
216217

218+
const rawAuth = await Filesystem.readJson<Record<string, unknown>>(authPath).catch(() => ({}))
219+
if (rawAuth.$schema) {
220+
prompts.log.info(`Schema ${UI.Style.TEXT_DIM}${rawAuth.$schema}`)
221+
}
222+
223+
if (rawAuth.provider) {
224+
const providerSection = rawAuth.provider as Record<string, unknown>
225+
for (const [providerID, config] of Object.entries(providerSection)) {
226+
const name = (config as any)?.name || providerID
227+
const hasCredentials = results.some(([id]) => id === providerID)
228+
prompts.log.info(`${name} ${UI.Style.TEXT_DIM}${hasCredentials ? "(configured)" : "(not configured)"}`)
229+
}
230+
}
231+
217232
for (const [providerID, result] of results) {
218233
const name = database[providerID]?.name || providerID
219234
prompts.log.info(`${name} ${UI.Style.TEXT_DIM}${result.type}`)

0 commit comments

Comments
 (0)