MCPcopy Create free account
hub / github.com/arctic-cli/interface / fn

Function fn

packages/arctic/src/cli/cmd/auth.ts:535–767  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

533 await Instance.provide({
534 directory: process.cwd(),
535 async fn() {
536 UI.empty()
537 prompts.intro("Add credential")
538
539 await ModelsDev.refresh().catch(() => {})
540 const config = await Config.get()
541 const disabled = new Set(config.disabled_providers ?? [])
542 const enabled = config.enabled_providers ? new Set(config.enabled_providers) : undefined
543
544 const providers = await ModelsDev.get().then((x) => {
545 const filtered: Record<string, (typeof x)[string]> = {}
546 for (const [key, value] of Object.entries(x)) {
547 if ((enabled ? enabled.has(key) : true) && !disabled.has(key)) {
548 filtered[key] = value
549 }
550 }
551 return filtered
552 })
553
554 providers["codex"] = {
555 id: "codex",
556 name: "Codex",
557 env: [],
558 models: {},
559 }
560 providers["antigravity"] = {
561 id: "antigravity",
562 name: "Antigravity",
563 env: [],
564 models: {},
565 }
566 providers["ollama"] = {
567 id: "ollama",
568 name: "Ollama",
569 env: [],
570 models: {},
571 }
572 providers["alibaba"] = {
573 id: "alibaba",
574 name: "Alibaba (Qwen Code)",
575 env: [],
576 models: {},
577 }
578 providers["minimax-coding-plan"] = {
579 id: "minimax-coding-plan",
580 name: "MiniMax Coding Plan",
581 env: [],
582 models: {},
583 }
584
585 let provider = args.url
586
587 // If args.url is provided but not a known provider, treat it as a URL
588 if (provider && !providers[provider]) {
589 const wellknown = await fetch(`${args.url}/.well-known/arctic`)
590 .then((x) => x.json() as any)
591 .catch(() => undefined)
592 if (wellknown) {

Callers

nothing calls this directly

Calls 12

handlePluginAuthFunction · 0.85
handleCodexDeviceLoginFunction · 0.85
handleOllamaLoginFunction · 0.85
handleAlibabaLoginFunction · 0.85
spawnMethod · 0.80
checkExistingConnectionFunction · 0.70
jsonMethod · 0.65
textMethod · 0.65
fetchFunction · 0.50
getMethod · 0.45
setMethod · 0.45
listMethod · 0.45

Tested by

no test coverage detected