/** * RAG-Powered Error Debugging Tool * * Provides intelligent error debugging using Retrieval-Augmented Generation * to analyze errors, find relevant context, and suggest fixes. * * @module @wundr/mcp-server/tools/error-debugger-rag */ import type { RagToolResult } from './rag/types'; import { extractIdentifiers, type IdentifierExtractionResult, type ExtractedIdentifier } from './error-debugger-rag/identifier-extractor'; import { generateFixSuggestion, type FixSuggestion, type FixSuggestionResult, type RagContextResult, type WorkingExample, type FixConfidence, type FixCategory } from './error-debugger-rag/fix-suggester'; /** * Supported error types */ export type ErrorType = 'lint' | 'typecheck' | 'build'; /** * Debug result for a single error */ export interface ErrorDebugResult { /** Original error message */ errorMessage: string; /** Error type */ errorType: ErrorType; /** Extracted identifiers from the error */ identifiers: ExtractedIdentifier[]; /** File path if extracted */ filePath?: string; /** Line number if extracted */ lineNumber?: number; /** Column number if extracted */ columnNumber?: number; /** Error code if extracted (e.g., TS2304) */ errorCode?: string; /** RAG search results providing context */ ragContext: RagContextResult[]; /** Working examples found that don't have the error */ workingExamples: WorkingExample[]; /** Generated fix suggestions */ suggestions: FixSuggestion[]; /** Whether a confident fix was found */ hasConfidentFix: boolean; /** Summary of the analysis */ summary: string; } /** * Input for the error debugger */ export interface ErrorDebuggerRagInput { /** Type of errors being debugged */ errorType: ErrorType; /** Array of error messages to debug */ errorMessages: string[]; /** Path to search for context */ targetPath: string; /** Maximum suggestions per error */ maxSuggestionsPerError?: number; } /** * Output from the error debugger */ export interface ErrorDebuggerRagOutput { /** Debug results for each error */ results: ErrorDebugResult[]; /** Total number of errors analyzed */ totalErrors: number; /** Number of errors with confident fixes */ errorsWithConfidentFixes: number; /** Overall summary */ summary: string; /** Total execution time in milliseconds */ executionTimeMs: number; } /** * Debug errors using RAG-powered analysis * * Analyzes error messages, extracts key identifiers, searches for relevant * context and working examples using RAG, and generates actionable fix suggestions. * * @param input - Debug parameters including error type, messages, and target path * @returns Debug results with fix suggestions for each error * * @example * ```typescript * const result = await debugErrorsWithRag({ * errorType: 'typecheck', * errorMessages: [ * "error TS2304: Cannot find name 'UserProfile'", * "error TS2339: Property 'email' does not exist on type 'User'" * ], * targetPath: '/path/to/project/src', * maxSuggestionsPerError: 3 * }); * * console.log(result.results[0].suggestions[0].title); * // => "Import or define the type 'UserProfile'" * ``` */ export declare function debugErrorsWithRag(input: ErrorDebuggerRagInput): Promise>; export type { IdentifierExtractionResult, ExtractedIdentifier, FixSuggestion, FixSuggestionResult, RagContextResult, WorkingExample, FixConfidence, FixCategory, }; export { extractIdentifiers } from './error-debugger-rag/identifier-extractor'; export { generateFixSuggestion } from './error-debugger-rag/fix-suggester'; declare const _default: { debugErrorsWithRag: typeof debugErrorsWithRag; extractIdentifiers: typeof extractIdentifiers; generateFixSuggestion: typeof generateFixSuggestion; }; export default _default; //# sourceMappingURL=error-debugger-rag.d.ts.map