perf-lens
Version:
AI-powered frontend performance optimizer
47 lines • 1.84 kB
TypeScript
import type { AIModelConfig, AnalysisConfig } from '../types/config.js';
import { type Finding } from '../ai/schema.js';
interface CodeAnalysisResult {
critical: string[];
warnings: string[];
suggestions: string[];
findings: Finding[];
fileSpecificIssues: Record<string, {
critical: string[];
warnings: string[];
suggestions: string[];
}>;
}
interface LighthouseContext {
metrics: string;
analysis: {
coreWebVitals: string;
performanceOpportunities: string;
diagnostics: string;
};
}
interface CodeAnalysisConfig extends AnalysisConfig {
lighthouseContext?: LighthouseContext;
ai?: AIModelConfig;
verbose?: boolean;
noCache?: boolean;
}
/**
* Builds the stable Lighthouse context string shared by every batch prompt.
* It sits in the cached system prefix, so keep it byte-identical across calls.
*/
export declare function buildLighthouseContext(lighthouseContext?: LighthouseContext): string | undefined;
/**
* Analyzes the codebase for performance issues
* @param {CodeAnalysisConfig} config - Configuration for codebase analysis
* @returns {Promise<CodeAnalysisResult>} Complete analysis results including critical issues, warnings, and suggestions
*/
export declare function analyzeCodebase(config: CodeAnalysisConfig): Promise<CodeAnalysisResult>;
/**
* Agent-mode analysis: instead of batching every file into prompts, the model
* investigates the codebase itself through tool use and reports findings.
* @param {CodeAnalysisConfig} config - Same configuration as analyzeCodebase
* @returns {Promise<CodeAnalysisResult>} Analysis results in the same report shape
*/
export declare function analyzeCodebaseWithAgent(config: CodeAnalysisConfig): Promise<CodeAnalysisResult>;
export {};
//# sourceMappingURL=codeAnalysis.d.ts.map