UNPKG

@bobmatnyc/ai-code-review

Version:

A TypeScript-based tool for automated code reviews using AI models from Google Gemini, Anthropic Claude, and OpenRouter

69 lines (68 loc) 2.35 kB
/** * @fileoverview Environment variable loading and validation utilities. * * This module provides utilities for loading, validating, and accessing environment * variables used by the code review tool. It handles loading from .env.local files, * provides clear error messages for missing variables, and manages API key precedence. * * Key responsibilities: * - Loading environment variables from .env.local * - Validating required environment variables * - Managing API key precedence (GOOGLE_GENERATIVE_AI_KEY vs GOOGLE_AI_STUDIO_KEY) * - Providing clear error messages for configuration issues * - Logging environment variable status without exposing sensitive values */ /** * Load environment variables from .env.local file * @param envFilePath Optional custom path to .env file * @returns Object containing information about the loading process */ export declare function loadEnvVariables(envFilePath?: string): Promise<{ success: boolean; message: string; envFile?: string; }>; /** * Get the Google API key with proper precedence handling * @returns Object containing the API key and information about which key was used */ export declare function getGoogleApiKey(): { apiKey: string | undefined; source: string; message: string; }; /** * Get the OpenRouter API key with proper precedence handling * @returns Object containing the API key and information about which key was used */ export declare function getOpenRouterApiKey(): { apiKey: string | undefined; source: string; message: string; }; /** * Get the Anthropic API key with proper precedence handling * @returns Object containing the API key and information about which key was used */ export declare function getAnthropicApiKey(): { apiKey: string | undefined; source: string; message: string; }; /** * Get the OpenAI API key with proper precedence handling * @returns Object containing the API key and information about which key was used */ export declare function getOpenAIApiKey(): { apiKey: string | undefined; source: string; message: string; }; /** * Validate that required environment variables are present * @returns Object containing validation result and error message if applicable */ export declare function validateRequiredEnvVars(): { valid: boolean; message: string; };