/** * Smart Refactor Tool * * Provides intelligent refactoring suggestions with code examples * Analyzes code patterns and suggests improvements * Target: 75-85% token reduction through suggestion summarization */ import { CacheEngine } from '../../core/cache-engine.js'; import { MetricsCollector } from '../../core/metrics.js'; import { TokenCounter } from '../../core/token-counter.js'; export interface SmartRefactorOptions { filePath?: string; fileContent?: string; projectRoot?: string; refactorTypes?: Array<'extract-method' | 'simplify-conditional' | 'remove-duplication' | 'improve-naming' | 'reduce-complexity' | 'extract-constant'>; minComplexityForExtraction?: number; force?: boolean; maxCacheAge?: number; } export interface RefactorSuggestion { type: string; severity: 'info' | 'warning' | 'error'; location: { line: number; column: number; endLine?: number; endColumn?: number; }; message: string; suggestion: string; codeExample?: { before: string; after: string; }; impact: { complexity?: number; readability?: 'low' | 'medium' | 'high'; maintainability?: 'low' | 'medium' | 'high'; }; } export interface SmartRefactorResult { summary: { file: string; totalSuggestions: number; bySeverity: Record; byType: Record; estimatedImpact: 'low' | 'medium' | 'high'; fromCache: boolean; duration: number; }; suggestions: RefactorSuggestion[]; metrics: { originalTokens: number; compactedTokens: number; reductionPercentage: number; }; } export declare class SmartRefactorTool { private cache; private metrics; private tokenCounter; private cacheNamespace; private projectRoot; private complexityTool; constructor(cache: CacheEngine, tokenCounter: TokenCounter, metrics: MetricsCollector, projectRoot?: string); run(options?: SmartRefactorOptions): Promise; private suggestExtractMethod; private suggestSimplifyConditional; private suggestRemoveDuplication; private suggestImproveNaming; private suggestReduceComplexity; private suggestExtractConstant; private countNestedIfs; private countLogicalOperators; private calculateEstimatedImpact; private compactResult; private generateCacheKey; private getCachedResult; private cacheResult; } export declare function getSmartRefactorTool(cache: CacheEngine, tokenCounter: TokenCounter, metrics: MetricsCollector, projectRoot?: string): SmartRefactorTool; export declare function runSmartRefactor(options: SmartRefactorOptions): Promise; export declare const SMART_REFACTOR_TOOL_DEFINITION: { name: string; description: string; inputSchema: { type: string; properties: { filePath: { type: string; description: string; }; fileContent: { type: string; description: string; }; projectRoot: { type: string; description: string; }; refactorTypes: { type: string; description: string; items: { type: string; enum: string[]; }; }; minComplexityForExtraction: { type: string; description: string; default: number; }; force: { type: string; description: string; default: boolean; }; maxCacheAge: { type: string; description: string; default: number; }; }; }; }; //# sourceMappingURL=smart-refactor.d.ts.map