From 1ee0e7961818cd77940a9034368734fb2c9935aa Mon Sep 17 00:00:00 2001 From: ParthSareen Date: Mon, 26 Jan 2026 17:17:47 -0800 Subject: [PATCH] feat(auth): wire Ollama into auth choice flow - Add 'ollama' to AuthChoice type - Add Ollama group to auth choice options and prompt - Register Ollama handler in applyAuthChoice - Map ollama auth choice to ollama provider --- src/commands/auth-choice-options.ts | 14 +++++++++++++- src/commands/auth-choice-prompt.ts | 5 +++++ src/commands/auth-choice.apply.ts | 2 ++ src/commands/auth-choice.preferred-provider.ts | 1 + src/commands/onboard-types.ts | 1 + 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/commands/auth-choice-options.ts b/src/commands/auth-choice-options.ts index f13eef365..3faf50894 100644 --- a/src/commands/auth-choice-options.ts +++ b/src/commands/auth-choice-options.ts @@ -22,7 +22,8 @@ export type AuthChoiceGroupId = | "minimax" | "synthetic" | "venice" - | "qwen"; + | "qwen" + | "ollama"; export type AuthChoiceGroup = { value: AuthChoiceGroupId; @@ -91,6 +92,12 @@ const AUTH_CHOICE_GROUP_DEFS: { hint: "API key", choices: ["openrouter-api-key"], }, + { + value: "ollama", + label: "Ollama", + hint: "Open-source model runner", + choices: ["ollama"], + }, { value: "ai-gateway", label: "Vercel AI Gateway", @@ -238,6 +245,11 @@ export function buildAuthChoiceOptions(params: { label: "MiniMax M2.1 Lightning", hint: "Faster, higher output cost", }); + options.push({ + value: "ollama", + label: "Ollama", + hint: "Open-source model runner (llama, qwen, etc.)", + }); if (params.includeSkip) { options.push({ value: "skip", label: "Skip for now" }); } diff --git a/src/commands/auth-choice-prompt.ts b/src/commands/auth-choice-prompt.ts index 82756229e..8a7fed880 100644 --- a/src/commands/auth-choice-prompt.ts +++ b/src/commands/auth-choice-prompt.ts @@ -44,6 +44,11 @@ export async function promptAuthChoiceGrouped(params: { continue; } + // Auto-select if there's only one option in the group + if (group.options.length === 1) { + return group.options[0].value; + } + const methodSelection = (await params.prompter.select({ message: `${group.label} auth method`, options: [...group.options, { value: BACK_VALUE, label: "Back" }], diff --git a/src/commands/auth-choice.apply.ts b/src/commands/auth-choice.apply.ts index 89ff3f380..cb389fe49 100644 --- a/src/commands/auth-choice.apply.ts +++ b/src/commands/auth-choice.apply.ts @@ -9,6 +9,7 @@ import { applyAuthChoiceGoogleAntigravity } from "./auth-choice.apply.google-ant import { applyAuthChoiceGoogleGeminiCli } from "./auth-choice.apply.google-gemini-cli.js"; import { applyAuthChoiceMiniMax } from "./auth-choice.apply.minimax.js"; import { applyAuthChoiceOAuth } from "./auth-choice.apply.oauth.js"; +import { applyAuthChoiceOllama } from "./auth-choice.apply.ollama.js"; import { applyAuthChoiceOpenAI } from "./auth-choice.apply.openai.js"; import { applyAuthChoiceQwenPortal } from "./auth-choice.apply.qwen-portal.js"; import type { AuthChoice } from "./onboard-types.js"; @@ -46,6 +47,7 @@ export async function applyAuthChoice( applyAuthChoiceGoogleGeminiCli, applyAuthChoiceCopilotProxy, applyAuthChoiceQwenPortal, + applyAuthChoiceOllama, ]; for (const handler of handlers) { diff --git a/src/commands/auth-choice.preferred-provider.ts b/src/commands/auth-choice.preferred-provider.ts index 6fe26b59a..d74517479 100644 --- a/src/commands/auth-choice.preferred-provider.ts +++ b/src/commands/auth-choice.preferred-provider.ts @@ -28,6 +28,7 @@ const PREFERRED_PROVIDER_BY_AUTH_CHOICE: Partial> = { minimax: "lmstudio", "opencode-zen": "opencode", "qwen-portal": "qwen-portal", + ollama: "ollama", }; export function resolvePreferredProviderForAuthChoice(choice: AuthChoice): string | undefined { diff --git a/src/commands/onboard-types.ts b/src/commands/onboard-types.ts index 84c15afc4..7b3b401f8 100644 --- a/src/commands/onboard-types.ts +++ b/src/commands/onboard-types.ts @@ -31,6 +31,7 @@ export type AuthChoice = | "github-copilot" | "copilot-proxy" | "qwen-portal" + | "ollama" | "skip"; export type GatewayAuthChoice = "off" | "token" | "password"; export type ResetScope = "config" | "config+creds+sessions" | "full";