woaru
Version:
Universal Project Setup Autopilot - Analyze and automatically configure development tools for ANY programming language
104 lines • 3.54 kB
TypeScript
/**
* Type definition for AI provider configuration
*/
interface AiProviderConfig {
enabled: boolean;
model?: string;
id?: string;
providerType?: string;
[key: string]: unknown;
}
/**
* Sanitizes provider ID to prevent injection attacks
* @param providerId - The provider ID to sanitize
* @returns Sanitized provider ID safe for logging and processing
*/
export declare function sanitizeProviderId(providerId: unknown): string;
/**
* Error class for AI configuration related errors
*/
export declare class AiConfigurationError extends Error {
readonly code?: string | undefined;
constructor(message: string, code?: string | undefined);
}
/**
* Shows standardized error message for missing AI configuration
* Implements secure error display with i18n support
*
* @param customMessage - Optional custom error message to display
*/
export declare function displayAiConfigurationError(customMessage?: string): Promise<void>;
/**
* Helper function for validating a single AI provider
* Implements comprehensive security validation
*
* @param providerId - The provider ID to validate (will be sanitized)
* @param provider - The provider configuration object
* @returns Promise<boolean> indicating if provider is valid and active
*/
export declare function validateSingleProvider(providerId: string): Promise<boolean>;
export declare function validateAiProvider(providerId: unknown, provider: unknown): Promise<boolean>;
/**
* Helper function to get all active AI providers
* Implements comprehensive validation and error handling
*
* @returns Promise<Array<ActiveProvider>> List of validated active providers
*/
export interface ActiveProvider {
id: string;
provider: AiProviderConfig;
}
export declare function getActiveProviders(): Promise<ActiveProvider[]>;
export declare function getActiveAiProviders(): Promise<ActiveProvider[]>;
/**
* Simple boolean check for AI configuration status (used by CLI)
* Does not throw errors, just returns true/false
*
* @returns boolean indicating if AI is configured
*/
export declare function ensureAiIsConfigured(): boolean;
/**
* Async version for comprehensive validation
* Validates that at least one AI provider is configured and active
* Implements comprehensive security validation and error handling
*
* @throws {AiConfigurationError} When AI is not properly configured
*/
export declare function ensureAiIsConfiguredAsync(): Promise<void>;
/**
* Gracefully handles AI configuration errors without hard exit
* Allows calling code to decide how to handle the error
*
* @param feature - The feature name that requires AI configuration
* @returns Promise<boolean> indicating if AI is available
*/
export declare function checkAiAvailability(feature?: string): Promise<boolean>;
/**
* Quick AI readiness check for CLI commands
*/
export declare function isAiReady(): Promise<boolean>;
/**
* AI status information structure
*/
export interface AiStatusInfo {
status: 'active' | 'warning' | 'not_configured';
icon: string;
message: string;
providers: Array<{
id: string;
status: 'active' | 'disabled' | 'missing_key';
icon: string;
model?: string;
}>;
setupRequired: boolean;
}
/**
* Get comprehensive AI model status
*/
export declare function checkAiModelStatus(): Promise<AiStatusInfo>;
/**
* Display AI status with visual indicators
*/
export declare function displayAiStatus(compact?: boolean): Promise<void>;
export {};
//# sourceMappingURL=ai-helpers.d.ts.map