From 369583589472b1b2dda9b8ecc9f9c79f29e6e378 Mon Sep 17 00:00:00 2001 From: "Ola.Hulleberg" Date: Tue, 9 Sep 2025 18:30:14 +0200 Subject: [PATCH 1/5] feat: add GitHub Enterprise Server support for Copilot authentication --- packages/opencode/src/auth/github-copilot.ts | 62 +++++++++---- packages/opencode/src/auth/index.ts | 1 + packages/opencode/src/cli/cmd/auth.ts | 91 ++++++++++++++++++++ packages/opencode/src/cli/cmd/github.ts | 50 ++++++++--- packages/opencode/src/config/config.ts | 1 + packages/opencode/src/provider/provider.ts | 41 +++++++++ 6 files changed, 218 insertions(+), 28 deletions(-) diff --git a/packages/opencode/src/auth/github-copilot.ts b/packages/opencode/src/auth/github-copilot.ts index c9d90cd56c..1532cf1bb9 100644 --- a/packages/opencode/src/auth/github-copilot.ts +++ b/packages/opencode/src/auth/github-copilot.ts @@ -1,12 +1,33 @@ import z from "zod/v4" import { Auth } from "./index" import { NamedError } from "../util/error" +import { Config } from "../config/config" export namespace AuthGithubCopilot { const CLIENT_ID = "Iv1.b507a08c87ecfe98" - const DEVICE_CODE_URL = "https://github.com/login/device/code" - const ACCESS_TOKEN_URL = "https://github.com/login/oauth/access_token" - const COPILOT_API_KEY_URL = "https://api.github.com/copilot_internal/v2/token" + + async function getBaseUrl(providerID: string, enterpriseUrl?: string): Promise { + if (enterpriseUrl) { + return enterpriseUrl.replace(/^https?:\/\//, "").replace(/\/$/, "") + } + + const config = await Config.get() + const providerConfig = config.provider?.[providerID] + const configUrl = providerConfig?.options?.githubEnterpriseUrl + + return configUrl ? configUrl.replace(/^https?:\/\//, "").replace(/\/$/, "") : "github.com" + } + + async function getUrls(providerID = "github-copilot", enterpriseUrl?: string) { + const baseUrl = await getBaseUrl(providerID, enterpriseUrl) + const apiDomain = baseUrl === "github.com" ? "api.github.com" : `api.${baseUrl}` + + return { + DEVICE_CODE_URL: `https://${baseUrl}/login/device/code`, + ACCESS_TOKEN_URL: `https://${baseUrl}/login/oauth/access_token`, + COPILOT_API_KEY_URL: `https://${apiDomain}/copilot_internal/v2/token`, + } + } interface DeviceCodeResponse { device_code: string @@ -31,8 +52,9 @@ export namespace AuthGithubCopilot { } } - export async function authorize() { - const deviceResponse = await fetch(DEVICE_CODE_URL, { + export async function authorize(providerID = "github-copilot", enterpriseUrl?: string) { + const urls = await getUrls(providerID, enterpriseUrl) + const deviceResponse = await fetch(urls.DEVICE_CODE_URL, { method: "POST", headers: { Accept: "application/json", @@ -54,8 +76,9 @@ export namespace AuthGithubCopilot { } } - export async function poll(device_code: string) { - const response = await fetch(ACCESS_TOKEN_URL, { + export async function poll(device_code: string, providerID = "github-copilot", enterpriseUrl?: string) { + const urls = await getUrls(providerID, enterpriseUrl) + const response = await fetch(urls.ACCESS_TOKEN_URL, { method: "POST", headers: { Accept: "application/json", @@ -74,12 +97,12 @@ export namespace AuthGithubCopilot { const data: AccessTokenResponse = await response.json() if (data.access_token) { - // Store the GitHub OAuth token - await Auth.set("github-copilot", { + await Auth.set(providerID, { type: "oauth", refresh: data.access_token, access: "", expires: 0, + ...(providerID === "github-copilot-enterprise" && enterpriseUrl ? { enterpriseUrl } : {}), }) return "complete" } @@ -91,18 +114,22 @@ export namespace AuthGithubCopilot { return "pending" } - export async function access() { - const info = await Auth.get("github-copilot") + export async function access(providerID = "github-copilot", enterpriseUrl?: string) { + const info = await Auth.get(providerID) if (!info || info.type !== "oauth") return if (info.access && info.expires > Date.now()) return info.access - // Get new Copilot API token - const response = await fetch(COPILOT_API_KEY_URL, { + if (!enterpriseUrl && "enterpriseUrl" in info && info.enterpriseUrl) { + enterpriseUrl = info.enterpriseUrl + } + + const urls = await getUrls(providerID, enterpriseUrl) + const response = await fetch(urls.COPILOT_API_KEY_URL, { headers: { Accept: "application/json", Authorization: `Bearer ${info.refresh}`, "User-Agent": "GitHubCopilotChat/0.26.7", - "Editor-Version": "vscode/1.99.3", + "Editor-Version": "vscode/1.103.2", "Editor-Plugin-Version": "copilot-chat/0.26.7", }, }) @@ -111,10 +138,9 @@ export namespace AuthGithubCopilot { const tokenData: CopilotTokenResponse = await response.json() - // Store the Copilot API token - await Auth.set("github-copilot", { - type: "oauth", - refresh: info.refresh, + // Store the Copilot API token, preserving all existing auth data + await Auth.set(providerID, { + ...info, access: tokenData.token, expires: tokenData.expires_at * 1000, }) diff --git a/packages/opencode/src/auth/index.ts b/packages/opencode/src/auth/index.ts index ef9846a375..1ce4f43ca2 100644 --- a/packages/opencode/src/auth/index.ts +++ b/packages/opencode/src/auth/index.ts @@ -10,6 +10,7 @@ export namespace Auth { refresh: z.string(), access: z.string(), expires: z.number(), + enterpriseUrl: z.string().optional(), }) .meta({ ref: "OAuth" }) diff --git a/packages/opencode/src/cli/cmd/auth.ts b/packages/opencode/src/cli/cmd/auth.ts index 382232f5ac..275dea591c 100644 --- a/packages/opencode/src/cli/cmd/auth.ts +++ b/packages/opencode/src/cli/cmd/auth.ts @@ -9,6 +9,7 @@ import os from "os" import { Global } from "../../global" import { Plugin } from "../../plugin" import { Instance } from "../../project/instance" +import { AuthGithubCopilot } from "../../auth/github-copilot" export const AuthCommand = cmd({ command: "auth", @@ -137,6 +138,10 @@ export const AuthLoginCommand = cmd({ if (prompts.isCancel(provider)) throw new UI.CancelledError() + if (provider === "github-copilot") { + return await handleGithubCopilotAuth(provider) + } + const plugin = await Plugin.list().then((x) => x.find((x) => x.auth?.provider === provider)) if (plugin && plugin.auth) { let index = 0 @@ -292,3 +297,89 @@ export const AuthLogoutCommand = cmd({ prompts.outro("Logout successful") }, }) + +async function handleGithubCopilotAuth(providerID: string) { + try { + const deploymentType = await prompts.select({ + message: "Select GitHub deployment type", + options: [ + { + label: "GitHub.com", + value: "github.com", + hint: "Public", + }, + { + label: "GitHub Enterprise Server", + value: "enterprise", + hint: "Enterprise", + }, + ], + }) + + if (prompts.isCancel(deploymentType)) throw new UI.CancelledError() + + let enterpriseUrl: string | undefined + let actualProviderID = providerID + + if (deploymentType === "enterprise") { + const enterpriseHost = await prompts.text({ + message: "Enter your GitHub Enterprise Server domain", + placeholder: "company.ghe.com", + validate: (value) => { + if (!value) return "Domain is required" + if (value.includes("://")) { + return "Please enter just the domain (without https://)" + } + try { + // Test if it's a valid domain by trying to create a URL + new URL(`https://${value}`) + return undefined + } catch { + return "Please enter a valid domain" + } + }, + }) + + if (prompts.isCancel(enterpriseHost)) throw new UI.CancelledError() + + enterpriseUrl = `https://${enterpriseHost}` + + actualProviderID = "github-copilot-enterprise" + } + + const authorize = await AuthGithubCopilot.authorize(actualProviderID, enterpriseUrl) + + prompts.log.info(`Go to: ${authorize.verification}`) + prompts.log.info(`Enter code: ${authorize.user}`) + + const spinner = prompts.spinner() + spinner.start("Waiting for authorization...") + + let attempts = 0 + const maxAttempts = Math.ceil(authorize.expiry / authorize.interval) + + while (attempts < maxAttempts) { + await new Promise((resolve) => setTimeout(resolve, authorize.interval * 1000)) + + const result = await AuthGithubCopilot.poll(authorize.device, actualProviderID, enterpriseUrl) + + if (result === "complete") { + spinner.stop("Login successful") + prompts.outro("Done") + return + } else if (result === "failed") { + spinner.stop("Failed to authorize", 1) + prompts.outro("Authentication failed") + return + } + + attempts++ + } + + spinner.stop("Authorization timed out", 1) + prompts.outro("Please try again") + } catch (error) { + prompts.log.error(`Authentication failed: ${error instanceof Error ? error.message : String(error)}`) + prompts.outro("Done") + } +} diff --git a/packages/opencode/src/cli/cmd/github.ts b/packages/opencode/src/cli/cmd/github.ts index 916ced6cb4..3991f83b91 100644 --- a/packages/opencode/src/cli/cmd/github.ts +++ b/packages/opencode/src/cli/cmd/github.ts @@ -78,17 +78,38 @@ export const GithubInstallCommand = cmd({ // match https or git pattern // ie. https://github.com/sst/opencode.git // ie. https://github.com/sst/opencode + // ie. https://company.ghe.com/sst/opencode.git + // ie. https://company.ghe.com/sst/opencode // ie. git@github.com:sst/opencode.git // ie. git@github.com:sst/opencode + // ie. git@company.ghe.com:sst/opencode.git + // ie. git@company.ghe.com:sst/opencode // ie. ssh://git@github.com/sst/opencode.git // ie. ssh://git@github.com/sst/opencode - const parsed = info.match(/^(?:(?:https?|ssh):\/\/)?(?:git@)?github\.com[:/]([^/]+)\/([^/.]+?)(?:\.git)?$/) - if (!parsed) { - prompts.log.error(`Could not find git repository. Please run this command from a git repository.`) + // ie. ssh://git@company.ghe.com/sst/opencode.git + // ie. ssh://git@company.ghe.com/sst/opencode + const githubComMatch = info.match( + /^(?:(?:https?|ssh):\/\/)?(?:git@)?github\.com[:/]([^/]+)\/([^/.]+?)(?:\.git)?$/, + ) + const gheMatch = info.match( + /^(?:(?:https?|ssh):\/\/)?(?:git@)?([^:/]+\.ghe\.com)[:/]([^/]+)\/([^/.]+?)(?:\.git)?$/, + ) + + let owner: string, repo: string, githubHost: string + + if (githubComMatch) { + ;[, owner, repo] = githubComMatch + githubHost = "github.com" + } else if (gheMatch) { + ;[, githubHost, owner, repo] = gheMatch + } else { + prompts.log.error( + `Could not find GitHub repository. Please run this command from a GitHub or GitHub Enterprise repository.`, + ) throw new UI.CancelledError() } - const [, owner, repo] = parsed - return { owner, repo, root: Instance.worktree } + + return { owner, repo, root: Instance.worktree, githubHost } } async function promptProvider() { @@ -96,10 +117,11 @@ export const GithubInstallCommand = cmd({ opencode: 0, anthropic: 1, "github-copilot": 2, - openai: 3, - google: 4, - openrouter: 5, - vercel: 6, + "github-copilot-enterprise": 3, + openai: 4, + google: 5, + openrouter: 6, + vercel: 7, } let provider = await prompts.select({ message: "Select provider", @@ -149,7 +171,15 @@ export const GithubInstallCommand = cmd({ const s = prompts.spinner() s.start("Installing GitHub app") - // Get installation + // For GitHub Enterprise, we can't automatically detect installations + if (app.githubHost !== "github.com") { + s.stop("GitHub Enterprise detected") + prompts.log.warn("For GitHub Enterprise, you need to:") + prompts.log.warn(`- Contact your GitHub Enterprise administrator to install the opencode agent app`) + prompts.log.info("Skipping app installation for GitHub Enterprise...") + return + } + const installation = await getInstallation() if (installation) return s.stop("GitHub app already installed") diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts index 7d86845e36..572c546392 100644 --- a/packages/opencode/src/config/config.ts +++ b/packages/opencode/src/config/config.ts @@ -420,6 +420,7 @@ export namespace Config { .object({ apiKey: z.string().optional(), baseURL: z.string().optional(), + githubEnterpriseUrl: z.string().optional().describe("GitHub Enterprise Server URL for copilot authentication"), timeout: z .union([ z diff --git a/packages/opencode/src/provider/provider.ts b/packages/opencode/src/provider/provider.ts index 14f6ec09a1..37c2654883 100644 --- a/packages/opencode/src/provider/provider.ts +++ b/packages/opencode/src/provider/provider.ts @@ -143,6 +143,32 @@ export namespace Provider { }, } }, + "github-copilot-enterprise": async (provider) => { + const { AuthGithubCopilot } = await import("../auth/github-copilot") + const { Auth } = await import("../auth") + + const authInfo = await Auth.get("github-copilot-enterprise") + const enterpriseUrl = authInfo && "enterpriseUrl" in authInfo ? authInfo.enterpriseUrl : undefined + + let baseURL = provider?.api + if (enterpriseUrl) { + const domain = enterpriseUrl.replace(/^https?:\/\//, "") + baseURL = `https://copilot-api.${domain}` + } + + const token = await AuthGithubCopilot.access("github-copilot-enterprise") + + return { + autoload: false, + options: { + baseURL, + ...(token && { apiKey: token }), + headers: { + "Editor-Version": "vscode/1.103.2", + }, + }, + } + }, } const state = Instance.state(async () => { @@ -191,6 +217,18 @@ export namespace Provider { const configProviders = Object.entries(config.provider ?? {}) + // Add GitHub Copilot Enterprise provider that inherits from GitHub Copilot + if (database["github-copilot"]) { + const githubCopilot = database["github-copilot"] + database["github-copilot-enterprise"] = { + ...githubCopilot, + id: "github-copilot-enterprise", + name: "GitHub Copilot Enterprise", + // Enterprise uses a different API endpoint - will be set dynamically based on auth + api: undefined, + } + } + for (const [providerID, provider] of configProviders) { const existing = database[providerID] const parsed: ModelsDev.Provider = { @@ -262,6 +300,9 @@ export namespace Provider { if (provider.type === "api") { mergeProvider(providerID, { apiKey: provider.key }, "api") } + if (providerID === "github-copilot-enterprise" && provider.type === "oauth") { + mergeProvider(providerID, {}, "api") + } } // load custom From 3c9f3e33d22e5afa5c3c219efd3d894bb08ad19d Mon Sep 17 00:00:00 2001 From: "Ola.Hulleberg" Date: Wed, 10 Sep 2025 11:04:23 +0200 Subject: [PATCH 2/5] remove useless enterpriseUrl parameter from AuthGithubCopilot.access() --- packages/opencode/src/auth/github-copilot.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/opencode/src/auth/github-copilot.ts b/packages/opencode/src/auth/github-copilot.ts index 1532cf1bb9..b6194b5252 100644 --- a/packages/opencode/src/auth/github-copilot.ts +++ b/packages/opencode/src/auth/github-copilot.ts @@ -114,16 +114,12 @@ export namespace AuthGithubCopilot { return "pending" } - export async function access(providerID = "github-copilot", enterpriseUrl?: string) { + export async function access(providerID = "github-copilot") { const info = await Auth.get(providerID) if (!info || info.type !== "oauth") return if (info.access && info.expires > Date.now()) return info.access - if (!enterpriseUrl && "enterpriseUrl" in info && info.enterpriseUrl) { - enterpriseUrl = info.enterpriseUrl - } - - const urls = await getUrls(providerID, enterpriseUrl) + const urls = await getUrls(providerID, info.enterpriseUrl) const response = await fetch(urls.COPILOT_API_KEY_URL, { headers: { Accept: "application/json", From 3453fa5d95d5bc13d10dfc1202aa2a0d65032e7f Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 11 Sep 2025 14:59:06 +0000 Subject: [PATCH 3/5] chore: format code --- packages/opencode/src/config/config.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts index 572c546392..ceb314f54a 100644 --- a/packages/opencode/src/config/config.ts +++ b/packages/opencode/src/config/config.ts @@ -420,7 +420,10 @@ export namespace Config { .object({ apiKey: z.string().optional(), baseURL: z.string().optional(), - githubEnterpriseUrl: z.string().optional().describe("GitHub Enterprise Server URL for copilot authentication"), + githubEnterpriseUrl: z + .string() + .optional() + .describe("GitHub Enterprise Server URL for copilot authentication"), timeout: z .union([ z From 96a7b34fb01b2c02652103831b6eeed02d24d9c5 Mon Sep 17 00:00:00 2001 From: Ola Hulleberg Date: Sat, 13 Sep 2025 14:37:30 +0200 Subject: [PATCH 4/5] refactor: clean up GitHub Copilot Enterprise URL handling and improve UX - Extract URL normalization utilities to reduce code duplication - Simplify API domain construction logic - Improve enterprise URL handling consistency between CLI and config - Allow flexible URL input in auth process with better validation - Simplify provider logic to only use auth-stored enterpriseUrl - Update CLI labels for clearer enterprise deployment options - Remove confusing 'Server' terminology, use 'Enterprise' with descriptive hint --- packages/opencode/src/auth/github-copilot.ts | 10 ++++----- packages/opencode/src/cli/cmd/auth.ts | 22 +++++++++----------- packages/opencode/src/config/config.ts | 2 +- packages/opencode/src/provider/provider.ts | 5 +++-- packages/opencode/src/util/url.ts | 7 +++++++ 5 files changed, 25 insertions(+), 21 deletions(-) create mode 100644 packages/opencode/src/util/url.ts diff --git a/packages/opencode/src/auth/github-copilot.ts b/packages/opencode/src/auth/github-copilot.ts index b6194b5252..89aed74799 100644 --- a/packages/opencode/src/auth/github-copilot.ts +++ b/packages/opencode/src/auth/github-copilot.ts @@ -2,30 +2,28 @@ import z from "zod/v4" import { Auth } from "./index" import { NamedError } from "../util/error" import { Config } from "../config/config" +import { normalizeDomain } from "../util/url" export namespace AuthGithubCopilot { const CLIENT_ID = "Iv1.b507a08c87ecfe98" async function getBaseUrl(providerID: string, enterpriseUrl?: string): Promise { - if (enterpriseUrl) { - return enterpriseUrl.replace(/^https?:\/\//, "").replace(/\/$/, "") - } + if (enterpriseUrl) return normalizeDomain(enterpriseUrl) const config = await Config.get() const providerConfig = config.provider?.[providerID] const configUrl = providerConfig?.options?.githubEnterpriseUrl - return configUrl ? configUrl.replace(/^https?:\/\//, "").replace(/\/$/, "") : "github.com" + return configUrl ? normalizeDomain(configUrl) : "github.com" } async function getUrls(providerID = "github-copilot", enterpriseUrl?: string) { const baseUrl = await getBaseUrl(providerID, enterpriseUrl) - const apiDomain = baseUrl === "github.com" ? "api.github.com" : `api.${baseUrl}` return { DEVICE_CODE_URL: `https://${baseUrl}/login/device/code`, ACCESS_TOKEN_URL: `https://${baseUrl}/login/oauth/access_token`, - COPILOT_API_KEY_URL: `https://${apiDomain}/copilot_internal/v2/token`, + COPILOT_API_KEY_URL: `https://api.${baseUrl}/copilot_internal/v2/token`, } } diff --git a/packages/opencode/src/cli/cmd/auth.ts b/packages/opencode/src/cli/cmd/auth.ts index 275dea591c..bada1b6dfe 100644 --- a/packages/opencode/src/cli/cmd/auth.ts +++ b/packages/opencode/src/cli/cmd/auth.ts @@ -309,9 +309,9 @@ async function handleGithubCopilotAuth(providerID: string) { hint: "Public", }, { - label: "GitHub Enterprise Server", + label: "GitHub Enterprise", value: "enterprise", - hint: "Enterprise", + hint: "Data residency or self-hosted", }, ], }) @@ -323,26 +323,24 @@ async function handleGithubCopilotAuth(providerID: string) { if (deploymentType === "enterprise") { const enterpriseHost = await prompts.text({ - message: "Enter your GitHub Enterprise Server domain", - placeholder: "company.ghe.com", + message: "Enter your GitHub Enterprise URL or domain", + placeholder: "company.ghe.com or https://company.ghe.com", validate: (value) => { - if (!value) return "Domain is required" - if (value.includes("://")) { - return "Please enter just the domain (without https://)" - } + if (!value) return "URL or domain is required" try { - // Test if it's a valid domain by trying to create a URL - new URL(`https://${value}`) + // Test if it's a valid URL + const url = value.includes("://") ? new URL(value) : new URL(`https://${value}`) + if (!url.hostname) return "Please enter a valid URL or domain" return undefined } catch { - return "Please enter a valid domain" + return "Please enter a valid URL (e.g., company.ghe.com or https://company.ghe.com)" } }, }) if (prompts.isCancel(enterpriseHost)) throw new UI.CancelledError() - enterpriseUrl = `https://${enterpriseHost}` + enterpriseUrl = enterpriseHost.includes("://") ? enterpriseHost : `https://${enterpriseHost}` actualProviderID = "github-copilot-enterprise" } diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts index ceb314f54a..39d8111ac3 100644 --- a/packages/opencode/src/config/config.ts +++ b/packages/opencode/src/config/config.ts @@ -423,7 +423,7 @@ export namespace Config { githubEnterpriseUrl: z .string() .optional() - .describe("GitHub Enterprise Server URL for copilot authentication"), + .describe("GitHub Enterprise URL for copilot authentication"), timeout: z .union([ z diff --git a/packages/opencode/src/provider/provider.ts b/packages/opencode/src/provider/provider.ts index 37c2654883..a336a910a1 100644 --- a/packages/opencode/src/provider/provider.ts +++ b/packages/opencode/src/provider/provider.ts @@ -146,14 +146,15 @@ export namespace Provider { "github-copilot-enterprise": async (provider) => { const { AuthGithubCopilot } = await import("../auth/github-copilot") const { Auth } = await import("../auth") + const { normalizeDomain, buildCopilotApiUrl } = await import("../util/url") const authInfo = await Auth.get("github-copilot-enterprise") const enterpriseUrl = authInfo && "enterpriseUrl" in authInfo ? authInfo.enterpriseUrl : undefined let baseURL = provider?.api if (enterpriseUrl) { - const domain = enterpriseUrl.replace(/^https?:\/\//, "") - baseURL = `https://copilot-api.${domain}` + const domain = normalizeDomain(enterpriseUrl) + baseURL = buildCopilotApiUrl(domain) } const token = await AuthGithubCopilot.access("github-copilot-enterprise") diff --git a/packages/opencode/src/util/url.ts b/packages/opencode/src/util/url.ts new file mode 100644 index 0000000000..a7226cabe0 --- /dev/null +++ b/packages/opencode/src/util/url.ts @@ -0,0 +1,7 @@ +export function normalizeDomain(url: string): string { + return url.replace(/^https?:\/\//, "").replace(/\/$/, "") +} + +export function buildCopilotApiUrl(domain: string): string { + return `https://copilot-api.${domain}` +} From 28bd07cec3b0ef2846db3693a776ba22b33bcc5b Mon Sep 17 00:00:00 2001 From: Ola Hulleberg Date: Sun, 14 Sep 2025 12:02:23 +0200 Subject: [PATCH 5/5] fix: correct GitHub Copilot authentication issue from recent changes --- packages/opencode/src/auth/github-copilot.ts | 2 +- packages/opencode/src/config/config.ts | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/opencode/src/auth/github-copilot.ts b/packages/opencode/src/auth/github-copilot.ts index 89aed74799..ded07e78a5 100644 --- a/packages/opencode/src/auth/github-copilot.ts +++ b/packages/opencode/src/auth/github-copilot.ts @@ -12,7 +12,7 @@ export namespace AuthGithubCopilot { const config = await Config.get() const providerConfig = config.provider?.[providerID] - const configUrl = providerConfig?.options?.githubEnterpriseUrl + const configUrl = providerConfig?.options?.enterpriseUrl return configUrl ? normalizeDomain(configUrl) : "github.com" } diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts index 39d8111ac3..983445bc3f 100644 --- a/packages/opencode/src/config/config.ts +++ b/packages/opencode/src/config/config.ts @@ -420,10 +420,7 @@ export namespace Config { .object({ apiKey: z.string().optional(), baseURL: z.string().optional(), - githubEnterpriseUrl: z - .string() - .optional() - .describe("GitHub Enterprise URL for copilot authentication"), + enterpriseUrl: z.string().optional().describe("GitHub Enterprise URL for copilot authentication"), timeout: z .union([ z