MCPcopy Index your code
hub / github.com/anomalyco/opencode / resolvePluginProviders

Function resolvePluginProviders

packages/opencode/src/cli/cmd/providers.ts:212–237  ·  view source on GitHub ↗
(input: {
  hooks: Hooks[]
  existingProviders: Record<string, unknown>
  disabled: Set<string>
  enabled?: Set<string>
  providerNames: Record<string, string | undefined>
})

Source from the content-addressed store, hash-verified

210})
211
212export function resolvePluginProviders(input: {
213 hooks: Hooks[]
214 existingProviders: Record<string, unknown>
215 disabled: Set<string>
216 enabled?: Set<string>
217 providerNames: Record<string, string | undefined>
218}): Array<{ id: string; name: string }> {
219 const seen = new Set<string>()
220 const result: Array<{ id: string; name: string }> = []
221
222 for (const hook of input.hooks) {
223 if (!hook.auth) continue
224 const id = hook.auth.provider
225 if (seen.has(id)) continue
226 seen.add(id)
227 if (Object.hasOwn(input.existingProviders, id)) continue
228 if (input.disabled.has(id)) continue
229 if (input.enabled && !input.enabled.has(id)) continue
230 result.push({
231 id,
232 name: input.providerNames[id] ?? id,
233 })
234 }
235
236 return result
237}
238
239export const ProvidersCommand = cmd({
240 command: "providers",

Callers 2

providers.tsFile · 0.85

Calls 2

pushMethod · 0.80
addMethod · 0.65

Tested by

no test coverage detected