UNPKG

@bobmatnyc/ai-code-review

Version:

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

74 lines (73 loc) 3.12 kB
/** * @fileoverview Multi-pass review strategy implementation. * * This strategy analyzes large codebases by splitting files into multiple chunks * and processing them sequentially, maintaining context between passes to ensure * a cohesive review. It's automatically used when token counts exceed model limits. */ import { BaseReviewStrategy } from './ReviewStrategy'; import { FileInfo, ReviewOptions, ReviewResult, ReviewType } from '../types/review'; import { ProjectDocs } from '../utils/projectDocs'; import { ApiClientConfig } from '../core/ApiClientSelector'; /** * Strategy for performing multi-pass reviews of large codebases */ export declare class MultiPassReviewStrategy extends BaseReviewStrategy { /** * Create a new multi-pass review strategy * @param reviewType Type of review to perform */ constructor(reviewType: ReviewType); /** * Execute the multi-pass review strategy * @param files Files to review * @param projectName Project name * @param projectDocs Project documentation * @param options Review options * @param apiClientConfig API client configuration * @returns Promise resolving to the review result */ execute(files: FileInfo[], projectName: string, projectDocs: ProjectDocs | null, options: ReviewOptions, apiClientConfig: ApiClientConfig): Promise<ReviewResult>; /** * Generate a summary for the multi-pass review * @param result Consolidated review result * @param tokenAnalysis Token analysis result * @param context Review context * @param files All files in the review * @param modelName Model name * @returns Summary string */ private generateMultiPassSummary; /** * Update the review context with findings from a review result * @param context Review context to update * @param result Review result to extract findings from * @param files Files included in this pass */ private updateContextFromReviewResult; /** * Generate a consolidated report from the multi-pass review results * @param multiPassResult Combined result from all passes * @param apiClientConfig API client configuration * @param files All files included in the review * @param projectName Name of the project * @param projectDocs Project documentation * @param options Review options * @returns Promise resolving to a consolidated review result, or undefined if consolidation fails */ private generateConsolidatedReport; /** * Creates a fallback consolidation when AI consolidation fails * @param multiPassResult The combined result from all passes * @param modelName The name of the model * @returns A basic consolidated review content */ private createFallbackConsolidation; /** * Update the review context with findings from multiple review results * @param context Review context to update * @param result Review result to extract findings from * @param files Files included in this pass */ private updateContextFromReviewResults; }