MCPcopy Create free account
hub / github.com/anus-dev/ANUS / validateNonInteractiveAuth

Function validateNonInteractiveAuth

packages/cli/src/validateNonInterActiveAuth.ts:10–29  ·  view source on GitHub ↗
(
  configuredAuthType: AuthType | undefined,
  useExternalAuth: boolean | undefined,
  nonInteractiveConfig: Config,
)

Source from the content-addressed store, hash-verified

8import { AuthType, Config } from '@anus-dev/anus-core';
9
10export 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}

Callers 2

mainFunction · 0.85

Calls 1

refreshAuthMethod · 0.80

Tested by

no test coverage detected