UNPKG

ctrlshiftleft

Version:

AI-powered toolkit for embedding QA and security testing into development workflows

98 lines (88 loc) 2.37 kB
/** * Type definitions for AI-Enhanced Security Analyzer * This addresses the TypeScript error: "Could not find a declaration file for module '../ai-security-analyzer.js'" */ /** * Options for AI security analysis */ export interface AISecurityAnalysisOptions { /** Output format (markdown or json) */ format?: 'markdown' | 'json'; /** Output file path */ output?: string; /** OpenAI model to use */ model?: string; /** Additional context about the code */ context?: string; } /** * Issues organized by severity */ export interface IssuesBySeverity { CRITICAL?: number; HIGH?: number; MEDIUM?: number; LOW?: number; INFO?: number; [key: string]: number | undefined; } /** * Result from AI security analysis */ export interface AISecurityAnalysisResult { /** Security score (0-100) */ score: number; /** Number of issues found */ issuesFound: number; /** Raw markdown content if format is markdown */ markdown?: string; /** JSON result if format is json */ json?: any; /** Issues organized by severity */ issuesBySeverity: IssuesBySeverity; /** Error message if analysis failed */ error?: string; } /** * Set the OpenAI API key * @param apiKey OpenAI API key */ export function setApiKey(apiKey: string): void; /** * Analyze a file for security vulnerabilities using AI * @param filePath Path to the file to analyze * @param options Analysis options * @returns Promise resolving to analysis result */ export function analyzeWithAI( filePath: string, options?: AISecurityAnalysisOptions ): Promise<AISecurityAnalysisResult>; /** * Analyze a source code string for security vulnerabilities using AI * @param code Source code to analyze * @param options Analysis options * @returns Promise resolving to analysis result */ export function analyzeCodeWithAI( code: string, options?: AISecurityAnalysisOptions ): Promise<AISecurityAnalysisResult>; /** * Check if AI analysis is available (OpenAI API key is set) * @returns Boolean indicating if AI analysis is available */ export function isAIAvailable(): boolean; /** * Get the current OpenAI model being used * @returns Model name */ export function getCurrentModel(): string; // Default export for CommonJS compatibility export default { setApiKey, analyzeWithAI, analyzeCodeWithAI, isAIAvailable, getCurrentModel };