Repository navigation
Description
Context
Three follow-up items raised during review of #5029 (llm localhost reverse proxy). None are blockers for that PR but should land before the stack grows further with #5033 and #5035.
1. Extract shared OIDC config type
File: pkg/llm/config.go — OIDCConfig
OIDCConfig mirrors RegistryOAuthConfig field-for-field (Issuer, ClientID, Scopes, Audience, CallbackPort, CachedRefreshTokenRef, CachedTokenExpiry). Parallel types with the same shape drift over time — validation added to one gets missed in the other.
Proposal: Extract a shared OIDC config type (e.g. in pkg/oidc or pkg/networking) that both embed, before #5033 and #5035 build further on llm.OIDCConfig. The longer the stack grows on separate types, the harder consolidation becomes.
2. Move business logic from CLI layer into pkg/llm/
File: cmd/thv/app/llm.go
Per CLAUDE.md/cli-commands convention, CLI commands should be thin wrappers — business logic belongs in pkg/. Currently living in the CLI layer:
deleteLLMSecrets— secret enumeration + deletion- Config mutation/validation orchestration in
config set(partial-vs-full validation branch) - Formatting decisions in
config show
Proposal: Move these to pkg/llm/ (e.g. a ResetConfig, DeleteCachedTokens, or SetFields method on Config). CLI commands then just parse flags and delegate. Sets the right pattern before more commands land in #5033/#5035.
3. Add E2E tests for thv llm config commands
File: cmd/thv/app/llm.go — config set/show/reset
Per project convention, CLI commands are primarily tested via E2E tests in test/e2e/. Currently no E2E coverage exists for the config subcommands.
Suggested test cases:
thv llm config set --gateway-url https://example.com --issuer https://auth.example.com --client-id testsucceeds andthv llm config show --format jsonreflects the valuesthv llm config set --gateway-url http://example.comfails (HTTPS enforcement)thv llm config resetclears the configthv llm config showon a clean config prints the "not configured" message
Should land before the stack is complete to avoid accumulating untested CLI surface.
Activity
llm: extract shared OIDC config, move business logic to pkg/llm, add …
llm: extract shared OIDC config, move business logic to pkg/llm, add …