[PR #2522] feat(provider): add GitHub Enterprise support for Copilot #10339

Closed
opened 2026-02-16 18:14:58 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/2522

State: closed
Merged: Yes


Solves

Summary

Add universal prompts support for OAuth and API authentication methods, enabling plugins to provide better configuration UX. This enables the GitHub Copilot plugin to support both GitHub.com and GitHub Enterprise deployments with a unified auth flow.

Changes

This PR extends the plugin authentication system to support more advanced auth flows:

  • Universal prompts: OAuth and API auth methods can now include preliminary prompts for configuration
  • Select and text prompts: Support both select dropdowns and text input with validation
  • Conditional prompts: Prompts can be conditionally shown based on previous inputs
  • Provider override: Auth methods can specify which provider ID to save credentials under
  • Custom fetch preservation: Preserve custom fetch functions when wrapping with timeout logic
  • Enterprise provider registration: Automatically register github-copilot-enterprise provider
  • Enterprise-only auth support: Allow github-copilot plugin to load when user only has enterprise auth (doesn't affect normal GitHub.com users)

Implementation Details

Plugin Interface (packages/plugin/src/index.ts):

  • Added prompts field to OAuth and API auth method types
  • Support for select prompts (with options and hints) and text prompts (with validation)
  • condition function allows prompts to be shown based on previous input values
  • Added optional provider field to auth success results for override

Auth Command (packages/opencode/src/cli/cmd/auth.ts):

  • Process prompts before calling authorize() for all auth types
  • Pass collected inputs to authorize() function
  • Preserve extra OAuth fields (like enterpriseUrl) when saving auth results

Provider (packages/opencode/src/provider/provider.ts):

  • Register github-copilot-enterprise provider that inherits from github-copilot
  • Load auth for both github-copilot and github-copilot-enterprise when plugin exists
  • Check for enterprise auth as fallback if normal auth doesn't exist (allows enterprise-only usage)
  • Preserve custom fetch functions when wrapping with timeout logic (fixes #TBD)

Related

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/2522 **State:** closed **Merged:** Yes --- ## Solves - #664 - #355 ## Summary Add universal prompts support for OAuth and API authentication methods, enabling plugins to provide better configuration UX. This enables the GitHub Copilot plugin to support both GitHub.com and GitHub Enterprise deployments with a unified auth flow. ## Changes This PR extends the plugin authentication system to support more advanced auth flows: - **Universal prompts**: OAuth and API auth methods can now include preliminary prompts for configuration - **Select and text prompts**: Support both select dropdowns and text input with validation - **Conditional prompts**: Prompts can be conditionally shown based on previous inputs - **Provider override**: Auth methods can specify which provider ID to save credentials under - **Custom fetch preservation**: Preserve custom fetch functions when wrapping with timeout logic - **Enterprise provider registration**: Automatically register github-copilot-enterprise provider - **Enterprise-only auth support**: Allow github-copilot plugin to load when user only has enterprise auth (doesn't affect normal GitHub.com users) ## Implementation Details **Plugin Interface** (`packages/plugin/src/index.ts`): - Added `prompts` field to OAuth and API auth method types - Support for select prompts (with options and hints) and text prompts (with validation) - `condition` function allows prompts to be shown based on previous input values - Added optional `provider` field to auth success results for override **Auth Command** (`packages/opencode/src/cli/cmd/auth.ts`): - Process prompts before calling `authorize()` for all auth types - Pass collected inputs to `authorize()` function - Preserve extra OAuth fields (like `enterpriseUrl`) when saving auth results **Provider** (`packages/opencode/src/provider/provider.ts`): - Register `github-copilot-enterprise` provider that inherits from `github-copilot` - Load auth for both github-copilot and github-copilot-enterprise when plugin exists - Check for enterprise auth as fallback if normal auth doesn't exist (allows enterprise-only usage) - Preserve custom fetch functions when wrapping with timeout logic (fixes #TBD) ## Related - Plugin implementation: https://github.com/sst/opencode-copilot-auth/pull/4
yindo added the pull-request label 2026-02-16 18:14:58 -05:00
yindo closed this issue 2026-02-16 18:14:58 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10339