diff options
| author | paul@buetow.org <paul@buetow.org> | 2026-02-06 16:35:45 +0200 |
|---|---|---|
| committer | paul@buetow.org <paul@buetow.org> | 2026-02-06 16:35:45 +0200 |
| commit | 12a249282d5dd9dc2ee1e66f08d6acc26dd29eba (patch) | |
| tree | 5e9ae4fbd1696d1b668dfe0be791004a87fc7a6a /internal/appconfig | |
| parent | 89dc2aab0b6be2620766a4b4b750fa888641b89d (diff) | |
Remove GitHub Copilot provider support
Remove all GitHub Copilot integration from the codebase to streamline
the supported provider set to OpenAI, OpenRouter, Anthropic, and Ollama.
Changes:
- Delete core Copilot implementation (copilot.go) and all related tests
- Remove Copilot configuration fields from App struct and Config
- Remove Copilot from provider factory and API key handling
- Update all test files to replace Copilot references with other providers
- Remove Copilot documentation from README, configuration guide, and examples
- Remove Copilot section from config.toml.example
All tests pass successfully after removal.
Co-authored-by: Cursor <cursoragent@cursor.com>
Diffstat (limited to 'internal/appconfig')
| -rw-r--r-- | internal/appconfig/config.go | 51 | ||||
| -rw-r--r-- | internal/appconfig/config_env_model_test.go | 8 | ||||
| -rw-r--r-- | internal/appconfig/config_test.go | 41 |
3 files changed, 18 insertions, 82 deletions
diff --git a/internal/appconfig/config.go b/internal/appconfig/config.go index c9af85e..3077d42 100644 --- a/internal/appconfig/config.go +++ b/internal/appconfig/config.go @@ -69,12 +69,8 @@ type App struct { OllamaModel string `json:"ollama_model" toml:"ollama_model"` // Default temperature for Ollama requests (nil means use provider default) OllamaTemperature *float64 `json:"ollama_temperature" toml:"ollama_temperature"` - CopilotBaseURL string `json:"copilot_base_url" toml:"copilot_base_url"` - CopilotModel string `json:"copilot_model" toml:"copilot_model"` - // Default temperature for Copilot requests (nil means use provider default) - CopilotTemperature *float64 `json:"copilot_temperature" toml:"copilot_temperature"` - AnthropicBaseURL string `json:"anthropic_base_url" toml:"anthropic_base_url"` - AnthropicModel string `json:"anthropic_model" toml:"anthropic_model"` + AnthropicBaseURL string `json:"anthropic_base_url" toml:"anthropic_base_url"` + AnthropicModel string `json:"anthropic_model" toml:"anthropic_model"` // Default temperature for Anthropic requests (nil means use provider default) AnthropicTemperature *float64 `json:"anthropic_temperature" toml:"anthropic_temperature"` @@ -146,7 +142,6 @@ func newDefaultConfig() App { CodingTemperature: &t, OpenAITemperature: &t, OllamaTemperature: &t, - CopilotTemperature: &t, AnthropicTemperature: &t, ManualInvokeMinPrefix: 0, CompletionDebounceMs: 800, @@ -244,7 +239,6 @@ type fileConfig struct { Provider sectionProvider `toml:"provider"` OpenAI sectionOpenAI `toml:"openai"` OpenRouter sectionOpenRouter `toml:"openrouter"` - Copilot sectionCopilot `toml:"copilot"` Ollama sectionOllama `toml:"ollama"` Anthropic sectionAnthropic `toml:"anthropic"` Prompts sectionPrompts `toml:"prompts"` @@ -333,12 +327,6 @@ type sectionOpenRouter struct { Temperature *float64 `toml:"temperature"` } -type sectionCopilot struct { - Model string `toml:"model"` - BaseURL string `toml:"base_url"` - Temperature *float64 `toml:"temperature"` -} - type sectionOllama struct { Model string `toml:"model"` BaseURL string `toml:"base_url"` @@ -489,16 +477,6 @@ func (fc *fileConfig) toApp() App { out.mergeProviderFields(&tmp) } - // copilot - if (fc.Copilot != sectionCopilot{}) || fc.Copilot.Temperature != nil { - tmp := App{ - CopilotBaseURL: fc.Copilot.BaseURL, - CopilotModel: fc.Copilot.Model, - CopilotTemperature: fc.Copilot.Temperature, - } - out.mergeProviderFields(&tmp) - } - // ollama if (fc.Ollama != sectionOllama{}) || fc.Ollama.Temperature != nil { tmp := App{ @@ -658,10 +636,9 @@ func loadFromFile(path string, logger *log.Logger) (*App, error) { "chat_suffix": {}, "chat_prefixes": {}, "coding_temperature": {}, "provider": {}, "openai_model": {}, "openai_base_url": {}, "openai_temperature": {}, "ollama_model": {}, "ollama_base_url": {}, "ollama_temperature": {}, - "copilot_model": {}, "copilot_base_url": {}, "copilot_temperature": {}, } for k := range raw { - if _, isTable := map[string]struct{}{"general": {}, "logging": {}, "completion": {}, "triggers": {}, "inline": {}, "chat": {}, "provider": {}, "models": {}, "openai": {}, "copilot": {}, "ollama": {}, "prompts": {}}[k]; isTable { + if _, isTable := map[string]struct{}{"general": {}, "logging": {}, "completion": {}, "triggers": {}, "inline": {}, "chat": {}, "provider": {}, "models": {}, "openai": {}, "ollama": {}, "prompts": {}}[k]; isTable { continue } if _, isLegacy := legacy[k]; isLegacy { @@ -1103,15 +1080,6 @@ func (a *App) mergeProviderFields(other *App) { if other.OllamaTemperature != nil { // allow explicit 0.0 a.OllamaTemperature = other.OllamaTemperature } - if s := strings.TrimSpace(other.CopilotBaseURL); s != "" { - a.CopilotBaseURL = s - } - if s := strings.TrimSpace(other.CopilotModel); s != "" { - a.CopilotModel = s - } - if other.CopilotTemperature != nil { // allow explicit 0.0 - a.CopilotTemperature = other.CopilotTemperature - } if s := strings.TrimSpace(other.AnthropicBaseURL); s != "" { a.AnthropicBaseURL = s } @@ -1331,19 +1299,6 @@ func loadFromEnv(logger *log.Logger) *App { any = true } - if s := getenv("HEXAI_COPILOT_BASE_URL"); s != "" { - out.CopilotBaseURL = s - any = true - } - if model, ok := pickModel("copilot", getenv("HEXAI_COPILOT_MODEL")); ok { - out.CopilotModel = model - any = true - } - if f, ok := parseFloatPtr("HEXAI_COPILOT_TEMPERATURE"); ok { - out.CopilotTemperature = f - any = true - } - if s := getenv("HEXAI_ANTHROPIC_BASE_URL"); s != "" { out.AnthropicBaseURL = s any = true diff --git a/internal/appconfig/config_env_model_test.go b/internal/appconfig/config_env_model_test.go index 7038819..e10fa5d 100644 --- a/internal/appconfig/config_env_model_test.go +++ b/internal/appconfig/config_env_model_test.go @@ -37,9 +37,9 @@ func TestEnv_ModelForce_OverridesProviderSpecific(t *testing.T) { } func TestEnv_SurfaceModelOverrides(t *testing.T) { - t.Setenv("HEXAI_MODEL_COMPLETION", "gpt-c") + t.Setenv("HEXAI_MODEL_COMPLETION", "claude-c") t.Setenv("HEXAI_TEMPERATURE_COMPLETION", "0.44") - t.Setenv("HEXAI_PROVIDER_COMPLETION", "copilot") + t.Setenv("HEXAI_PROVIDER_COMPLETION", "anthropic") t.Setenv("HEXAI_MODEL_CLI", "gpt-cli") t.Setenv("HEXAI_TEMPERATURE_CLI", "0.22") t.Setenv("HEXAI_PROVIDER_CLI", "ollama") @@ -48,13 +48,13 @@ func TestEnv_SurfaceModelOverrides(t *testing.T) { t.Fatalf("expected single completion entry, got %+v", cfg.CompletionConfigs) } comp := cfg.CompletionConfigs[0] - if comp.Model != "gpt-c" { + if comp.Model != "claude-c" { t.Fatalf("expected completion model override, got %+v", comp) } if comp.Temperature == nil || *comp.Temperature != 0.44 { t.Fatalf("expected completion temperature override, got %+v", comp) } - if comp.Provider != "copilot" { + if comp.Provider != "anthropic" { t.Fatalf("expected completion provider override, got %+v", comp) } if len(cfg.CLIConfigs) != 1 { diff --git a/internal/appconfig/config_test.go b/internal/appconfig/config_test.go index 2c00f68..ff9616b 100644 --- a/internal/appconfig/config_test.go +++ b/internal/appconfig/config_test.go @@ -75,8 +75,8 @@ func TestParseSurfaceModels_CodeActionWarns(t *testing.T) { model = "gpt-4o" [[models.code_action]] - provider = "copilot" - model = "cpt" + provider = "anthropic" + model = "claude" `) var buf bytes.Buffer logger := log.New(&buf, "", 0) @@ -121,9 +121,9 @@ model = "gpt-file-complete" provider = "openai" [[models.code_action]] -model = "gpt-file-action" +model = "claude-file-action" temperature = 0.45 -provider = "copilot" +provider = "anthropic" [[models.chat]] model = "gpt-file-chat" @@ -146,11 +146,6 @@ temperature = 0.0 base_url = "http://ollama" model = "llama" temperature = 0.0 - -[copilot] -base_url = "http://copilot" -model = "ghost" -temperature = 0.0 `) if _, err := loadFromFile(cfgPath, newLogger()); err != nil { @@ -175,18 +170,15 @@ temperature = 0.0 withEnv(t, "HEXAI_OLLAMA_BASE_URL", "http://ollama-override") withEnv(t, "HEXAI_OLLAMA_MODEL", "mistral") withEnv(t, "HEXAI_OLLAMA_TEMPERATURE", "0.6") - withEnv(t, "HEXAI_COPILOT_BASE_URL", "http://copilot-override") - withEnv(t, "HEXAI_COPILOT_MODEL", "ghost-override") - withEnv(t, "HEXAI_COPILOT_TEMPERATURE", "0.3") withEnv(t, "HEXAI_MODEL_COMPLETION", "env-completion") withEnv(t, "HEXAI_TEMPERATURE_COMPLETION", "0.33") - withEnv(t, "HEXAI_PROVIDER_COMPLETION", "copilot") + withEnv(t, "HEXAI_PROVIDER_COMPLETION", "ollama") withEnv(t, "HEXAI_MODEL_CODE_ACTION", "env-action") withEnv(t, "HEXAI_TEMPERATURE_CODE_ACTION", "0.55") withEnv(t, "HEXAI_PROVIDER_CODE_ACTION", "openai") withEnv(t, "HEXAI_MODEL_CHAT", "env-chat") withEnv(t, "HEXAI_TEMPERATURE_CHAT", "0.66") - withEnv(t, "HEXAI_PROVIDER_CHAT", "copilot") + withEnv(t, "HEXAI_PROVIDER_CHAT", "anthropic") withEnv(t, "HEXAI_MODEL_CLI", "env-cli") withEnv(t, "HEXAI_TEMPERATURE_CLI", "0.77") withEnv(t, "HEXAI_PROVIDER_CLI", "ollama") @@ -217,16 +209,13 @@ temperature = 0.0 if cfg.OllamaBaseURL != "http://ollama-override" || cfg.OllamaModel != "mistral" || cfg.OllamaTemperature == nil || *cfg.OllamaTemperature != 0.6 { t.Fatalf("ollama overrides not applied: %+v", cfg) } - if cfg.CopilotBaseURL != "http://copilot-override" || cfg.CopilotModel != "ghost-override" || cfg.CopilotTemperature == nil || *cfg.CopilotTemperature != 0.3 { - t.Fatalf("copilot overrides not applied: %+v", cfg) - } if len(cfg.CompletionConfigs) != 1 || cfg.CompletionConfigs[0].Model != "env-completion" { t.Fatalf("completion overrides not applied: %+v", cfg.CompletionConfigs) } if cfg.CompletionConfigs[0].Temperature == nil || *cfg.CompletionConfigs[0].Temperature != 0.33 { t.Fatalf("completion temperature override missing: %+v", cfg.CompletionConfigs[0]) } - if cfg.CompletionConfigs[0].Provider != "copilot" { + if cfg.CompletionConfigs[0].Provider != "ollama" { t.Fatalf("completion provider override not applied: %+v", cfg.CompletionConfigs[0]) } if len(cfg.CodeActionConfigs) != 1 || cfg.CodeActionConfigs[0].Model != "env-action" { @@ -244,7 +233,7 @@ temperature = 0.0 if cfg.ChatConfigs[0].Temperature == nil || *cfg.ChatConfigs[0].Temperature != 0.66 { t.Fatalf("chat temp override missing: %+v", cfg.ChatConfigs[0]) } - if cfg.ChatConfigs[0].Provider != "copilot" { + if cfg.ChatConfigs[0].Provider != "anthropic" { t.Fatalf("chat provider override not applied: %+v", cfg.ChatConfigs[0]) } if len(cfg.CLIConfigs) != 1 || cfg.CLIConfigs[0].Model != "env-cli" { @@ -260,7 +249,7 @@ temperature = 0.0 // Ensure file values would have applied absent env // Spot-check: reset env and reload for _, k := range []string{ - "HEXAI_MAX_TOKENS", "HEXAI_CONTEXT_MODE", "HEXAI_CONTEXT_WINDOW_LINES", "HEXAI_MAX_CONTEXT_TOKENS", "HEXAI_LOG_PREVIEW_LIMIT", "HEXAI_CODING_TEMPERATURE", "HEXAI_MANUAL_INVOKE_MIN_PREFIX", "HEXAI_COMPLETION_DEBOUNCE_MS", "HEXAI_COMPLETION_THROTTLE_MS", "HEXAI_TRIGGER_CHARACTERS", "HEXAI_PROVIDER", "HEXAI_OPENAI_BASE_URL", "HEXAI_OPENAI_MODEL", "HEXAI_OPENAI_TEMPERATURE", "HEXAI_OLLAMA_BASE_URL", "HEXAI_OLLAMA_MODEL", "HEXAI_OLLAMA_TEMPERATURE", "HEXAI_COPILOT_BASE_URL", "HEXAI_COPILOT_MODEL", "HEXAI_COPILOT_TEMPERATURE", "HEXAI_MODEL_COMPLETION", "HEXAI_TEMPERATURE_COMPLETION", "HEXAI_MODEL_CODE_ACTION", "HEXAI_TEMPERATURE_CODE_ACTION", "HEXAI_MODEL_CHAT", "HEXAI_TEMPERATURE_CHAT", "HEXAI_MODEL_CLI", "HEXAI_TEMPERATURE_CLI", "HEXAI_PROVIDER_COMPLETION", "HEXAI_PROVIDER_CODE_ACTION", "HEXAI_PROVIDER_CHAT", "HEXAI_PROVIDER_CLI", + "HEXAI_MAX_TOKENS", "HEXAI_CONTEXT_MODE", "HEXAI_CONTEXT_WINDOW_LINES", "HEXAI_MAX_CONTEXT_TOKENS", "HEXAI_LOG_PREVIEW_LIMIT", "HEXAI_CODING_TEMPERATURE", "HEXAI_MANUAL_INVOKE_MIN_PREFIX", "HEXAI_COMPLETION_DEBOUNCE_MS", "HEXAI_COMPLETION_THROTTLE_MS", "HEXAI_TRIGGER_CHARACTERS", "HEXAI_PROVIDER", "HEXAI_OPENAI_BASE_URL", "HEXAI_OPENAI_MODEL", "HEXAI_OPENAI_TEMPERATURE", "HEXAI_OLLAMA_BASE_URL", "HEXAI_OLLAMA_MODEL", "HEXAI_OLLAMA_TEMPERATURE", "HEXAI_MODEL_COMPLETION", "HEXAI_TEMPERATURE_COMPLETION", "HEXAI_MODEL_CODE_ACTION", "HEXAI_TEMPERATURE_CODE_ACTION", "HEXAI_MODEL_CHAT", "HEXAI_TEMPERATURE_CHAT", "HEXAI_MODEL_CLI", "HEXAI_TEMPERATURE_CLI", "HEXAI_PROVIDER_COMPLETION", "HEXAI_PROVIDER_CODE_ACTION", "HEXAI_PROVIDER_CHAT", "HEXAI_PROVIDER_CLI", } { t.Setenv(k, "") } @@ -283,13 +272,13 @@ temperature = 0.0 if cfg2.CompletionConfigs[0].Provider != "openai" { t.Fatalf("file merge (completion provider) not applied: %+v", cfg2.CompletionConfigs[0]) } - if len(cfg2.CodeActionConfigs) != 1 || cfg2.CodeActionConfigs[0].Model != "gpt-file-action" { + if len(cfg2.CodeActionConfigs) != 1 || cfg2.CodeActionConfigs[0].Model != "claude-file-action" { t.Fatalf("file merge (code action) not applied: %+v", cfg2.CodeActionConfigs) } if cfg2.CodeActionConfigs[0].Temperature == nil || *cfg2.CodeActionConfigs[0].Temperature != 0.45 { t.Fatalf("expected code action temp 0.45, got %+v", cfg2.CodeActionConfigs[0]) } - if cfg2.CodeActionConfigs[0].Provider != "copilot" { + if cfg2.CodeActionConfigs[0].Provider != "anthropic" { t.Fatalf("file merge (code action provider) not applied: %+v", cfg2.CodeActionConfigs[0]) } if len(cfg2.ChatConfigs) != 1 || cfg2.ChatConfigs[0].Model != "gpt-file-chat" { @@ -384,11 +373,6 @@ temperature = 0.0 model = "mistral" base_url = "http://ollama" temperature = 0.0 - -[copilot] -model = "ghost" -base_url = "http://copilot" -temperature = 0.0 ` writeFile(t, cfgPath, content) @@ -418,9 +402,6 @@ temperature = 0.0 if cfg.OllamaModel != "mistral" || cfg.OllamaBaseURL != "http://ollama" || cfg.OllamaTemperature == nil || *cfg.OllamaTemperature != 0.0 { t.Fatalf("sectioned ollama wrong: %+v", cfg) } - if cfg.CopilotModel != "ghost" || cfg.CopilotBaseURL != "http://copilot" || cfg.CopilotTemperature == nil || *cfg.CopilotTemperature != 0.0 { - t.Fatalf("sectioned copilot wrong: %+v", cfg) - } } func TestLoad_FileTables_Prompts_AllSections(t *testing.T) { |
