UNPKG

@bobmatnyc/ai-code-review

Version:

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

66 lines (65 loc) 2.1 kB
/** * @fileoverview AI-guided chunking service for intelligent code analysis * * This module provides AI-powered recommendations for optimal code chunking * strategies based on semantic analysis results. It integrates with various * AI providers to generate intelligent chunking plans that improve code * review effectiveness while respecting token limits and semantic coherence. */ import { SemanticAnalysis, ChunkingRecommendation } from './types'; /** * Configuration for AI-guided chunking */ export interface AiGuidedChunkingConfig { /** Whether AI-guided chunking is enabled */ enabled: boolean; /** AI model to use for chunking recommendations */ model?: string; /** Maximum time to wait for AI response (ms) */ timeout: number; /** Whether to use cached results */ useCache: boolean; /** Fallback to rule-based chunking on AI failure */ fallbackEnabled: boolean; /** Review types that should use AI guidance */ enabledReviewTypes: string[]; } /** * Service for generating AI-guided code chunking recommendations */ export declare class AiGuidedChunking { private config; constructor(config?: Partial<AiGuidedChunkingConfig>); /** * Generate AI-guided chunking recommendation */ generateChunkingRecommendation(analysis: SemanticAnalysis, reviewType: string): Promise<ChunkingRecommendation>; /** * Generate enhanced rule-based chunking recommendation */ private generateEnhancedRuleBasedChunking; /** * Map AI type string to ReviewUnit */ private mapTypeToReviewUnit; /** * Determine review focus based on declarations */ private determineReviewFocus; /** * Estimate token count for a line range */ private estimateTokens; /** * Update configuration */ updateConfig(config: Partial<AiGuidedChunkingConfig>): void; /** * Check if enhanced rule-based chunking is available */ isAvailable(): boolean; } /** * Default instance for easy import */ export declare const aiGuidedChunking: AiGuidedChunking;