Warden performs authentication checks before starting analysis. Here’s how it works:
src/sdk/auth.ts
export function verifyAuth({ apiKey }: { apiKey?: string }): void { // Direct API auth — no subprocess needed if (apiKey) return; try { execFileNonInteractive('claude', ['--version'], { timeout: 5000 }); } catch (error) { const isNotFound = error instanceof ExecError ? error.stderr.includes('ENOENT') : (error as NodeJS.ErrnoException).code === 'ENOENT'; if (isNotFound) { throw new WardenAuthenticationError( 'Claude Code CLI not found on PATH.\n' + 'Either install Claude Code (https://claude.ai/install.sh) or set an API key.', { cause: error } ); } }}
For GitHub Actions and other CI environments, use the API key method:
src/sdk/types.ts
export interface SkillRunnerOptions { apiKey?: string; /** Path to Claude Code CLI executable. Required in CI environments. */ pathToClaudeCodeExecutable?: string; // ... other options}
In CI environments where the Claude Code CLI is unavailable, always use WARDEN_ANTHROPIC_API_KEY for reliable authentication.