( configuredAuthType: AuthType | undefined, useExternalAuth: boolean | undefined, nonInteractiveConfig: Config, )
| 8 | import { AuthType, Config } from '@anus-dev/anus-core'; |
| 9 | |
| 10 | export async function validateNonInteractiveAuth( |
| 11 | configuredAuthType: AuthType | undefined, |
| 12 | useExternalAuth: boolean | undefined, |
| 13 | nonInteractiveConfig: Config, |
| 14 | ) { |
| 15 | // Check for Grok API key |
| 16 | const hasGrokKey = !!process.env['GROK_API_KEY']; |
| 17 | const isGrokAuth = configuredAuthType === AuthType.USE_GROK; |
| 18 | |
| 19 | if (hasGrokKey || isGrokAuth) { |
| 20 | await nonInteractiveConfig.refreshAuth(AuthType.USE_GROK); |
| 21 | return nonInteractiveConfig; |
| 22 | } |
| 23 | |
| 24 | // No Grok key found |
| 25 | console.error( |
| 26 | 'Please set your GROK_API_KEY environment variable (OpenRouter API key). Get your API key from https://openrouter.ai/keys', |
| 27 | ); |
| 28 | process.exit(1); |
| 29 | } |
no test coverage detected