/** * Smart Typecheck Tool - 70% Token Reduction * * Wraps TypeScript compiler type checking to provide: * - Incremental type checking * - Cached type information * - Error categorization and ranking * - Suggestion prioritization */ import { CacheEngine } from '../../core/cache-engine.js'; import { MetricsCollector } from '../../core/metrics.js'; import { TokenCounter } from '../../core/token-counter.js'; interface SmartTypeCheckOptions { /** * Force full type check (ignore cache) */ force?: boolean; /** * Watch mode */ watch?: boolean; /** * Project root directory */ projectRoot?: string; /** * TypeScript config file */ tsconfig?: string; /** * Maximum cache age in seconds (default: 3600 = 1 hour) */ maxCacheAge?: number; } interface SmartTypeCheckOutput { /** * Typecheck summary */ summary: { success: boolean; errorCount: number; filesChecked: number; duration: number; fromCache: boolean; }; /** * Errors categorized and ranked */ errorsByCategory: Array<{ category: string; count: number; severity: 'critical' | 'high' | 'medium' | 'low'; errors: Array<{ file: string; location: string; code: string; message: string; }>; }>; /** * Ranked suggestions (most impactful first) */ suggestions: Array<{ type: 'fix' | 'refactor' | 'config'; priority: number; message: string; impact: string; }>; /** * Token reduction _metrics */ _metrics: { originalTokens: number; compactedTokens: number; reductionPercentage: number; }; } export declare class SmartTypeCheck { private cache; private cacheNamespace; private projectRoot; constructor(cache: CacheEngine, _tokenCounter: TokenCounter, _metrics: MetricsCollector, projectRoot?: string); /** * Run type check with smart caching and output reduction */ run(options?: SmartTypeCheckOptions): Promise; /** * Run TypeScript compiler in type-check only mode */ private runTsc; /** * Parse TypeScript type check output */ private parseTypeCheckOutput; /** * Categorize TypeScript error by code and message */ private categorizeError; /** * Determine error severity based on category and code */ private determineSeverity; /** * Count files checked from output */ private countCheckedFiles; /** * Generate cache key */ private generateCacheKey; /** * Get cached result if available and fresh */ private getCachedResult; /** * Cache type check result */ private cacheResult; /** * Generate optimization suggestions based on error patterns */ private generateSuggestions; /** * Transform type check output to smart output */ private transformOutput; /** * Format cached output */ private formatCachedOutput; /** * Estimate original output size */ private estimateOriginalOutputSize; /** * Estimate compact output size */ private estimateCompactSize; /** * Close cache connection */ close(): void; } /** * Factory function for creating SmartTypeCheck with injected dependencies (for benchmarks) */ export declare function getSmartTypeCheckTool(cache: CacheEngine, tokenCounter: TokenCounter, _metrics: MetricsCollector): SmartTypeCheck; /** * CLI-friendly function for running smart type check */ export declare function runSmartTypeCheck(options?: SmartTypeCheckOptions): Promise; export declare const SMART_TYPECHECK_TOOL_DEFINITION: { name: string; description: string; inputSchema: { type: string; properties: { force: { type: string; description: string; default: boolean; }; watch: { type: string; description: string; default: boolean; }; projectRoot: { type: string; description: string; }; tsconfig: { type: string; description: string; }; maxCacheAge: { type: string; description: string; default: number; }; }; }; }; export {}; //# sourceMappingURL=smart-typecheck.d.ts.map