Description
The LLMProvider concept is threaded through approximately 8 functions as a bare string, including secret selection logic and gateway routing decisions. Using a named type improves type safety, enables exhaustive switch checking, and documents intent at call sites.
Current State
// Currently — bare string driving secret selection and gateway routing
func selectSecret(provider string) string { ... }
func routeToGateway(provider string) url.URL { ... }
// EngineConfig.LLMProvider is string
Suggested Changes
- Add
type LLMProvider string with its constants (likely in pkg/types or pkg/cli)
- Update
EngineConfig.LLMProvider field from string to LLMProvider
- Update the ~8 functions that accept/return provider values
- Add a
String() string method for logging compatibility
Files Affected
- Likely
pkg/cli/ or pkg/types/ for the type definition
- ~8 functions across compiler/gateway/secret-selection code (exact files to be identified at implementation time via
grep -r "LLMProvider" --include=*.go)
Success Criteria
type LLMProvider string defined with named constants
EngineConfig.LLMProvider is LLMProvider not string
- No bare
string arguments for provider values at key routing/selection call sites
go build ./... and make test-unit pass
Source
Extracted from discussion #47781 — Typist Go Type Consistency Analysis
Priority
Medium — Improves type safety at gateway routing and secret selection boundaries
🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · sonnet46 · 42.7 AIC · ⌖ 5.66 AIC · ⊞ 7.2K · ◷
Description
The
LLMProviderconcept is threaded through approximately 8 functions as a barestring, including secret selection logic and gateway routing decisions. Using a named type improves type safety, enables exhaustive switch checking, and documents intent at call sites.Current State
Suggested Changes
type LLMProvider stringwith its constants (likely inpkg/typesorpkg/cli)EngineConfig.LLMProviderfield fromstringtoLLMProviderString() stringmethod for logging compatibilityFiles Affected
pkg/cli/orpkg/types/for the type definitiongrep -r "LLMProvider" --include=*.go)Success Criteria
type LLMProvider stringdefined with named constantsEngineConfig.LLMProviderisLLMProvidernotstringstringarguments for provider values at key routing/selection call sitesgo build ./...andmake test-unitpassSource
Extracted from discussion #47781 — Typist Go Type Consistency Analysis
Priority
Medium — Improves type safety at gateway routing and secret selection boundaries