Skip to content

Commit 5cd1ff5

Browse files
hujunchengclaude
andcommitted
Teach CLI diagnose about CrossModel env auth
`codexbar diagnose` resolved no API auth for an env-only CrossModel setup because CLIDiagnoseCommand's env-auth switch had no `.crossmodel` case and fell through to false, even though CROSSMODEL_API_KEY is a supported token source. Add the case and a focused diagnostic test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c75d9f1 commit 5cd1ff5

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

Sources/CodexBarCLI/CLIDiagnoseCommand.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ extension CodexBarCLI {
225225
ChutesSettingsReader.apiKey(environment: environment) != nil
226226
case .crof:
227227
CrofSettingsReader.apiKey(environment: environment) != nil
228+
case .crossmodel:
229+
CrossModelSettingsReader.apiToken(environment: environment) != nil
228230
case .deepgram:
229231
DeepgramSettingsReader.apiKey(environment: environment) != nil
230232
case .deepseek:

Tests/CodexBarTests/CLIDiagnoseCommandTests.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,19 @@ struct CLIDiagnoseCommandTests {
115115
#expect(summary.modes == ["api"])
116116
}
117117

118+
@Test
119+
func `generic diagnose auth summary detects CrossModel environment credentials`() {
120+
let summary = CodexBarCLI._diagnosticAuthSummaryForTesting(
121+
provider: .crossmodel,
122+
account: nil,
123+
config: nil,
124+
environment: [CrossModelSettingsReader.envKey: "cm-test"],
125+
settings: nil)
126+
127+
#expect(summary.configured)
128+
#expect(summary.modes == ["api"])
129+
}
130+
118131
@Test
119132
func `generic diagnose auth summary requires complete Bedrock credentials`() {
120133
let partial = CodexBarCLI._diagnosticAuthSummaryForTesting(

0 commit comments

Comments
 (0)