pkg/llmproxy/config (struct SDKConfig, functions)
↑
└── imports ──→ sdk/config (aliases to internal/config)
↓
internal/config (struct SDKConfig)
sdk/config (aliases to internal/config)
↑
└── imports ──→ pkg/llmproxy/config
pkg/llmproxy/configandsdk/configboth try to alias tointernal/config- But internal code imports one or the other expecting specific struct definitions
- Creates type mismatches when functions expect struct vs alias
pkg/llmproxy/config/config.go- Has full Config/SDKConfig structspkg/llmproxy/config/sdk_config.go- Aliases to internal/configinternal/config/config.go- Full structs + functionsinternal/config/sdk_config.go- Struct definitionssdk/config/config.go- Aliases to internal/config- ~50+ files importing these packages get type mismatches
Make internal/config the single source of truth for all config types. Both pkg/llmproxy/config and sdk/config re-export from internal.
- Check
internal/config/config.gohas all types (Config, SDKConfig, etc.) - Check
internal/config/has all helper functions (LoadConfig, NormalizeHeaders, etc.) - List all type definitions needed
- Create
pkg/llmproxy/config/config_internal.gothat re-exports all types from internal - Keep only type aliases, no struct definitions
- Remove duplicate function definitions
- Add imports re-export wrapper
- Verify sdk/config uses aliases to internal/config
- Add missing type re-exports
- Find packages importing wrong config package
- Update imports to use internal/config for internal code, sdk/config for external SDK users
-
go build ./... -
go vet ./... - Run key test suites
Current: Has full struct definitions + functions Target: Re-export everything from internal/config
// Add at top of file:
import internalconfig "github.com/router-for-me/CLIProxyAPI/v6/internal/config"
// Replace all type definitions with aliases:
type SDKConfig = internalconfig.SDKConfig
type Config = internalconfig.Config
// ... all other types
// Replace function implementations with re-exports:
func LoadConfig(...) = internalconfig.LoadConfig
func LoadConfigOptional(...) = internalconfig.LoadConfigOptional
// ... all other functionsCurrent: Aliases to internal/config Target: Delete this file (merge into config.go)
Current: Aliases to internal/config Target: Already correct, verify no changes needed
- Type mismatch in function signatures - Add explicit type casts
- Missing methods on aliased types - Methods on embedded types should work via alias
- YAML tags - Type aliases preserve tags from source struct
- Keep backup branch
- Can revert to pre-plan state if issues occur
- Step 1-2: 15 min
- Step 3: 10 min
- Step 4: 15 min
- Step 5: 10 min
- Total: ~50 minutes
go build ./...passesgo vet ./...passes- SDK tests pass
- Internal tests pass
- No runtime behavior changes