/** * RAG-Enhanced Refactoring Impact Analysis Tool * * Analyzes the potential impact of refactoring operations using * Retrieval-Augmented Generation to find affected files, tests, * and documentation. * * @module @wundr/mcp-server/tools/refactoring-rag */ import { z } from 'zod'; import type { McpToolResult } from './registry.js'; /** * Input schema for refactoring impact analysis */ export declare const RefactoringImpactInputSchema: z.ZodObject<{ targetPath: z.ZodString; refactoringTarget: z.ZodString; refactoringType: z.ZodEnum<["rename", "move", "extract", "inline", "change-signature", "restructure", "deprecate", "delete"]>; searchScope: z.ZodDefault>>; storeName: z.ZodOptional; forceReindex: z.ZodDefault>; includePatterns: z.ZodDefault>>; excludePatterns: z.ZodDefault>>; includeTests: z.ZodDefault>; includeDocs: z.ZodDefault>; maxResults: z.ZodDefault>; }, "strip", z.ZodTypeAny, { includePatterns: string[]; excludePatterns: string[]; maxResults: number; includeDocs: boolean; targetPath: string; forceReindex: boolean; refactoringTarget: string; refactoringType: "delete" | "rename" | "move" | "extract" | "inline" | "change-signature" | "restructure" | "deprecate"; searchScope: "local" | "project" | "workspace"; includeTests: boolean; storeName?: string | undefined; }, { targetPath: string; refactoringTarget: string; refactoringType: "delete" | "rename" | "move" | "extract" | "inline" | "change-signature" | "restructure" | "deprecate"; includePatterns?: string[] | undefined; excludePatterns?: string[] | undefined; maxResults?: number | undefined; storeName?: string | undefined; includeDocs?: boolean | undefined; forceReindex?: boolean | undefined; searchScope?: "local" | "project" | "workspace" | undefined; includeTests?: boolean | undefined; }>; export type RefactoringImpactInput = z.infer; /** * Impact type classification */ export type ImpactType = 'direct' | 'indirect' | 'potential'; /** * Impact severity level */ export type ImpactSeverity = 'high' | 'medium' | 'low'; /** * Information about an impacted file */ export interface ImpactedFile { /** Absolute file path */ filePath: string; /** Relative path from target */ relativePath: string; /** Type of impact */ impactType: ImpactType; /** Severity of impact */ severity: ImpactSeverity; /** Relevance score from RAG search (0-1) */ relevanceScore: number; /** Estimated lines affected */ estimatedLinesAffected: number; /** Specific locations within the file */ locations: Array<{ lineStart: number; lineEnd: number; snippet: string; reason: string; }>; /** File type classification */ fileType: 'source' | 'test' | 'documentation' | 'config' | 'other'; /** Detected programming language */ language?: string; /** Additional notes about this file's impact */ notes?: string; } /** * Information about a test that needs updating */ export interface TestToUpdate { /** Test file path */ filePath: string; /** Test names/descriptions that may be affected */ affectedTests: string[]; /** Reason for update */ reason: string; /** Priority of update */ priority: 'critical' | 'important' | 'optional'; /** Estimated effort (in relative units) */ estimatedEffort: number; } /** * Information about documentation that needs updating */ export interface DocToUpdate { /** Documentation file path */ filePath: string; /** Sections that may need updating */ affectedSections: string[]; /** Reason for update */ reason: string; /** Type of documentation */ docType: 'api' | 'readme' | 'guide' | 'comment' | 'other'; } /** * Estimated scope of refactoring */ export type RefactoringScope = 'small' | 'medium' | 'large'; /** * Refactoring impact analysis report */ export interface RefactoringImpactReport { /** Target being refactored */ refactoringTarget: string; /** Type of refactoring */ refactoringType: string; /** Analysis timestamp */ analyzedAt: string; /** Estimated overall scope */ estimatedScope: RefactoringScope; /** Risk assessment */ riskLevel: 'low' | 'medium' | 'high'; /** All impacted files */ impactedFiles: ImpactedFile[]; /** Tests that need updating */ testsToUpdate: TestToUpdate[]; /** Documentation that needs updating */ docsToUpdate: DocToUpdate[]; /** Summary statistics */ summary: { totalFilesAffected: number; directImpacts: number; indirectImpacts: number; potentialImpacts: number; testsAffected: number; docsAffected: number; estimatedTotalLinesAffected: number; }; /** Recommendations for the refactoring */ recommendations: string[]; /** Potential risks identified */ risks: string[]; /** Suggested execution order */ suggestedOrder: string[]; /** Metadata */ metadata: { analysisTimeMs: number; storeId: string; wasReindexed: boolean; }; } /** * Output from refactoring impact analysis */ export interface RefactoringImpactOutput { report: RefactoringImpactReport; } /** * Analyze the impact of a refactoring operation using RAG search * * @param input - Refactoring impact analysis input * @returns Impact analysis report with affected files, tests, and docs */ export declare function analyzeRefactoringImpact(input: RefactoringImpactInput): Promise>; /** * Tool definition for MCP registration */ export declare const refactoringImpactTool: { name: string; description: string; inputSchema: { type: string; properties: { targetPath: { type: string; description: string; }; refactoringTarget: { type: string; description: string; }; refactoringType: { type: string; enum: string[]; description: string; }; searchScope: { type: string; enum: string[]; description: string; default: string; }; storeName: { type: string; description: string; }; forceReindex: { type: string; description: string; default: boolean; }; includePatterns: { type: string; items: { type: string; }; description: string; default: string[]; }; excludePatterns: { type: string; items: { type: string; }; description: string; default: string[]; }; includeTests: { type: string; description: string; default: boolean; }; includeDocs: { type: string; description: string; default: boolean; }; maxResults: { type: string; description: string; default: number; }; }; required: string[]; }; category: string; }; //# sourceMappingURL=refactoring-rag.d.ts.map