vibe-coder-mcp
Version:
Production-ready MCP server with complete agent integration, multi-transport support, and comprehensive development automation tools for AI-assisted workflows.
390 lines • 24 kB
TypeScript
import { IntentAnalysisResult } from '../types/llm-tasks.js';
export declare const FILE_DISCOVERY_SYSTEM_PROMPT = "You are an expert software architect and codebase analyst specializing in intelligent file discovery for development tasks.\n\nYour task is to analyze a development request and identify the most relevant files that need to be examined, modified, or referenced during implementation.\n\n## CRITICAL FORMAT REQUIREMENT\n\nYou MUST respond with ONLY a valid JSON object. Do not include any text before or after the JSON.\nDo not include markdown code blocks (no ```json or ```).\nThe response must be parseable by JSON.parse() without any preprocessing.\n\n## DISCOVERY STRATEGIES\n\n**Semantic Similarity**: \n- Use natural language understanding to identify files based on conceptual relevance\n- Consider functional relationships and domain concepts\n- Identify files that serve similar purposes or handle related functionality\n- Look for files that would be conceptually impacted by the requested changes\n\n**Keyword Matching**:\n- Search for files containing specific keywords, function names, or class names\n- Match file names, directory structures, and content patterns\n- Identify files based on naming conventions and technical terminology\n- Focus on exact matches and variations of key terms\n\n**Semantic and Keyword Combined**:\n- Leverage both semantic understanding and keyword matching\n- Use semantic analysis to expand keyword searches with related concepts\n- Apply contextual understanding to filter and prioritize keyword matches\n- Balance precision of keywords with breadth of semantic understanding\n\n**Structural Analysis**:\n- Analyze architectural patterns and dependency relationships\n- Identify files based on their role in the system architecture\n- Consider import/export relationships and module dependencies\n- Focus on structural impact and architectural significance\n\n## FILE PRIORITIZATION CRITERIA\n\n**High Priority**: Core files that will definitely need modification or are central to the task\n**Medium Priority**: Supporting files that may need updates or provide important context\n**Low Priority**: Reference files that provide background understanding but unlikely to change\n\n## CONFIDENCE ASSESSMENT\n\nRate confidence (0.0 to 1.0) based on:\n- Strength of relationship between file and task requirements\n- Clarity of the file's role in the requested changes\n- Quality of available information about the file's purpose\n- Certainty about the file's relevance to the development task\n\n## MODIFICATION LIKELIHOOD\n\nAssess how likely each file is to be modified:\n- **very_high**: File will almost certainly be modified\n- **high**: File will likely be modified\n- **medium**: File may be modified depending on implementation approach\n- **low**: File unlikely to be modified but provides important context\n- **very_low**: File provides background context only\n\n## RESPONSE FORMAT\n\nCRITICAL: Respond with a valid JSON object matching this exact structure:\n\n{\n \"relevantFiles\": [\n {\n \"path\": \"relative/path/to/file.ext\",\n \"priority\": \"high|medium|low\",\n \"reasoning\": \"Detailed explanation of why this file is relevant\",\n \"confidence\": 0.0-1.0,\n \"estimatedTokens\": number,\n \"modificationLikelihood\": \"very_high|high|medium|low|very_low\"\n }\n ],\n \"totalFilesAnalyzed\": number,\n \"processingTimeMs\": number,\n \"searchStrategy\": \"semantic_similarity|keyword_matching|semantic_and_keyword|structural_analysis\",\n \"coverageMetrics\": {\n \"totalTokens\": number,\n \"averageConfidence\": 0.0-1.0\n }\n}\n\nCOMMON FORMAT ERRORS TO AVOID:\n1. DO NOT return a single file object when asked for multiple files\n2. DO NOT return just the array without the wrapper object\n3. DO NOT use single quotes - JSON requires double quotes\n4. DO NOT include comments in the JSON\n5. DO NOT forget any required fields\n6. DO NOT use trailing commas\n7. DO NOT return text explanations before or after the JSON\n\n## DISCOVERY GUIDELINES\n\n1. **Be Comprehensive**: Include all files that could be relevant to the task\n2. **Prioritize Effectively**: Rank files by their importance to the development task\n3. **Provide Clear Reasoning**: Explain why each file is relevant and how it relates to the task\n4. **Estimate Accurately**: Provide realistic token estimates and confidence scores\n5. **Consider Dependencies**: Include files that are architecturally connected\n6. **Balance Breadth and Focus**: Cover all relevant areas without including irrelevant files\n\n## CRITICAL: ANTI-HALLUCINATION REQUIREMENTS\n\n**MANDATORY**: Only recommend files that ACTUALLY EXIST in the provided codebase context. DO NOT:\n- Suggest files that don't exist in the codebase summary\n- Assume standard file structures (routes/, models/, controllers/) unless they're shown in the codebase\n- Create hypothetical file paths based on general software patterns\n- Recommend files from typical frameworks unless they exist in this specific project\n\n**REQUIRED**: Every file path you suggest must be verifiable in the codebase context provided.\nIf you need to suggest new files, clearly indicate they are \"NEW FILE SUGGESTIONS\" and ensure they fit the existing project structure.\nBase all recommendations on the ACTUAL architecture and file organization shown in the codebase summary.\n\nAnalyze the development request, intent analysis, and codebase context to identify the most relevant files for the task.";
export declare function buildFileDiscoveryPrompt(originalPrompt: string, intentAnalysis: IntentAnalysisResult, codemapContent: string, searchStrategy: 'semantic_similarity' | 'keyword_matching' | 'semantic_and_keyword' | 'structural_analysis', additionalContext?: {
filePatterns?: string[];
excludePatterns?: string[];
focusDirectories?: string[];
maxFiles?: number;
tokenBudget?: number;
}): string;
export declare const FILE_DISCOVERY_RESPONSE_SCHEMA: {
readonly type: "object";
readonly properties: {
readonly relevantFiles: {
readonly type: "array";
readonly items: {
readonly type: "object";
readonly properties: {
readonly path: {
readonly type: "string";
readonly minLength: 1;
readonly description: "Relative path to the file";
};
readonly priority: {
readonly type: "string";
readonly enum: readonly ["high", "medium", "low"];
readonly description: "Priority level of the file for the task";
};
readonly reasoning: {
readonly type: "string";
readonly minLength: 1;
readonly description: "Detailed explanation of why this file is relevant";
};
readonly confidence: {
readonly type: "number";
readonly minimum: 0;
readonly maximum: 1;
readonly description: "Confidence score from 0.0 to 1.0";
};
readonly estimatedTokens: {
readonly type: "number";
readonly minimum: 0;
readonly description: "Estimated token count for the file";
};
readonly modificationLikelihood: {
readonly type: "string";
readonly enum: readonly ["very_high", "high", "medium", "low", "very_low"];
readonly description: "Likelihood that this file will be modified";
};
};
readonly required: readonly ["path", "priority", "reasoning", "confidence", "estimatedTokens", "modificationLikelihood"];
readonly additionalProperties: false;
};
readonly description: "List of relevant files found";
};
readonly totalFilesAnalyzed: {
readonly type: "number";
readonly minimum: 0;
readonly description: "Total number of files analyzed";
};
readonly processingTimeMs: {
readonly type: "number";
readonly minimum: 0;
readonly description: "Processing time in milliseconds";
};
readonly searchStrategy: {
readonly type: "string";
readonly enum: readonly ["semantic_similarity", "keyword_matching", "semantic_and_keyword", "structural_analysis"];
readonly description: "Strategy used for file discovery";
};
readonly coverageMetrics: {
readonly type: "object";
readonly properties: {
readonly totalTokens: {
readonly type: "number";
readonly minimum: 0;
readonly description: "Total estimated tokens for all relevant files";
};
readonly averageConfidence: {
readonly type: "number";
readonly minimum: 0;
readonly maximum: 1;
readonly description: "Average confidence score across all files";
};
};
readonly required: readonly ["totalTokens", "averageConfidence"];
readonly additionalProperties: false;
readonly description: "Coverage metrics for the discovery results";
};
};
readonly required: readonly ["relevantFiles", "totalFilesAnalyzed", "processingTimeMs", "searchStrategy", "coverageMetrics"];
readonly additionalProperties: false;
};
export declare const FILE_DISCOVERY_EXAMPLES: {
readonly semantic_similarity_refactoring: {
readonly originalPrompt: "Refactor the authentication module to use JWT tokens";
readonly searchStrategy: "semantic_similarity";
readonly intentAnalysis: {
readonly taskType: "refactoring";
readonly confidence: 0.9;
readonly reasoning: readonly ["Request explicitly mentions refactoring existing authentication"];
readonly architecturalComponents: readonly ["authentication", "security", "token-management"];
readonly scopeAssessment: {
readonly complexity: "moderate";
readonly estimatedFiles: 8;
readonly riskLevel: "medium";
};
readonly suggestedFocusAreas: readonly ["security-patterns", "token-validation"];
readonly estimatedEffort: "medium";
};
readonly expectedResponse: {
readonly relevantFiles: readonly [{
readonly path: "src/auth/authentication.ts";
readonly priority: "high";
readonly reasoning: "Core authentication module that needs JWT token implementation";
readonly confidence: 0.95;
readonly estimatedTokens: 800;
readonly modificationLikelihood: "very_high";
}, {
readonly path: "src/auth/middleware/auth-middleware.ts";
readonly priority: "high";
readonly reasoning: "Authentication middleware that validates tokens and needs JWT integration";
readonly confidence: 0.9;
readonly estimatedTokens: 600;
readonly modificationLikelihood: "high";
}, {
readonly path: "src/auth/types/auth-types.ts";
readonly priority: "medium";
readonly reasoning: "Type definitions for authentication that may need JWT token types";
readonly confidence: 0.8;
readonly estimatedTokens: 300;
readonly modificationLikelihood: "medium";
}];
readonly totalFilesAnalyzed: 150;
readonly processingTimeMs: 2500;
readonly searchStrategy: "semantic_similarity";
readonly coverageMetrics: {
readonly totalTokens: 1700;
readonly averageConfidence: 0.88;
};
};
};
readonly keyword_matching_feature: {
readonly originalPrompt: "Add user dashboard with analytics charts";
readonly searchStrategy: "keyword_matching";
readonly intentAnalysis: {
readonly taskType: "feature_addition";
readonly confidence: 0.95;
readonly reasoning: readonly ["Request is for adding new dashboard functionality"];
readonly architecturalComponents: readonly ["frontend", "ui-components", "analytics", "data-visualization"];
readonly scopeAssessment: {
readonly complexity: "complex";
readonly estimatedFiles: 15;
readonly riskLevel: "medium";
};
readonly suggestedFocusAreas: readonly ["ui-design", "data-aggregation"];
readonly estimatedEffort: "high";
};
readonly expectedResponse: {
readonly relevantFiles: readonly [{
readonly path: "src/components/Dashboard.tsx";
readonly priority: "high";
readonly reasoning: "Existing dashboard component that needs analytics integration";
readonly confidence: 0.9;
readonly estimatedTokens: 1200;
readonly modificationLikelihood: "very_high";
}, {
readonly path: "src/services/analytics-service.ts";
readonly priority: "high";
readonly reasoning: "Analytics service for data processing and chart data preparation";
readonly confidence: 0.85;
readonly estimatedTokens: 900;
readonly modificationLikelihood: "high";
}, {
readonly path: "src/components/charts/ChartComponents.tsx";
readonly priority: "medium";
readonly reasoning: "Chart components library for rendering analytics visualizations";
readonly confidence: 0.8;
readonly estimatedTokens: 700;
readonly modificationLikelihood: "medium";
}];
readonly totalFilesAnalyzed: 200;
readonly processingTimeMs: 1800;
readonly searchStrategy: "keyword_matching";
readonly coverageMetrics: {
readonly totalTokens: 2800;
readonly averageConfidence: 0.85;
};
};
};
readonly semantic_and_keyword_bugfix: {
readonly originalPrompt: "Fix memory leak in file upload component";
readonly searchStrategy: "semantic_and_keyword";
readonly intentAnalysis: {
readonly taskType: "bug_fix";
readonly confidence: 0.95;
readonly reasoning: readonly ["Request explicitly mentions fixing a specific issue"];
readonly architecturalComponents: readonly ["file-upload", "memory-management", "frontend"];
readonly scopeAssessment: {
readonly complexity: "moderate";
readonly estimatedFiles: 3;
readonly riskLevel: "high";
};
readonly suggestedFocusAreas: readonly ["memory-profiling", "resource-cleanup"];
readonly estimatedEffort: "medium";
};
readonly expectedResponse: {
readonly relevantFiles: readonly [{
readonly path: "src/components/FileUpload.tsx";
readonly priority: "high";
readonly reasoning: "Main file upload component where memory leak is occurring";
readonly confidence: 0.98;
readonly estimatedTokens: 1000;
readonly modificationLikelihood: "very_high";
}, {
readonly path: "src/hooks/useFileUpload.ts";
readonly priority: "high";
readonly reasoning: "Custom hook managing file upload state and potential memory leaks";
readonly confidence: 0.9;
readonly estimatedTokens: 600;
readonly modificationLikelihood: "high";
}, {
readonly path: "src/utils/file-utils.ts";
readonly priority: "medium";
readonly reasoning: "File utility functions that may have resource cleanup issues";
readonly confidence: 0.75;
readonly estimatedTokens: 400;
readonly modificationLikelihood: "medium";
}];
readonly totalFilesAnalyzed: 80;
readonly processingTimeMs: 1200;
readonly searchStrategy: "semantic_and_keyword";
readonly coverageMetrics: {
readonly totalTokens: 2000;
readonly averageConfidence: 0.88;
};
};
};
readonly structural_analysis_general: {
readonly originalPrompt: "Update API documentation and add OpenAPI schema";
readonly searchStrategy: "structural_analysis";
readonly intentAnalysis: {
readonly taskType: "general";
readonly confidence: 0.85;
readonly reasoning: readonly ["Request involves documentation and API schema updates"];
readonly architecturalComponents: readonly ["documentation", "api-schema", "backend"];
readonly scopeAssessment: {
readonly complexity: "simple";
readonly estimatedFiles: 5;
readonly riskLevel: "low";
};
readonly suggestedFocusAreas: readonly ["api-documentation", "schema-validation"];
readonly estimatedEffort: "low";
};
readonly expectedResponse: {
readonly relevantFiles: readonly [{
readonly path: "docs/api/openapi.yaml";
readonly priority: "high";
readonly reasoning: "Main OpenAPI schema file that needs updates and enhancements";
readonly confidence: 0.95;
readonly estimatedTokens: 1500;
readonly modificationLikelihood: "very_high";
}, {
readonly path: "src/routes/api-routes.ts";
readonly priority: "medium";
readonly reasoning: "API route definitions that should align with OpenAPI schema";
readonly confidence: 0.8;
readonly estimatedTokens: 800;
readonly modificationLikelihood: "low";
}, {
readonly path: "docs/README.md";
readonly priority: "medium";
readonly reasoning: "Main documentation file that may need API documentation links";
readonly confidence: 0.7;
readonly estimatedTokens: 600;
readonly modificationLikelihood: "medium";
}];
readonly totalFilesAnalyzed: 120;
readonly processingTimeMs: 1500;
readonly searchStrategy: "structural_analysis";
readonly coverageMetrics: {
readonly totalTokens: 2900;
readonly averageConfidence: 0.82;
};
};
};
};
export declare const FILE_DISCOVERY_FORMAT_EXAMPLES: {
readonly emptyResponse: {
readonly description: "Valid response when no relevant files are found";
readonly response: {
readonly relevantFiles: readonly [];
readonly totalFilesAnalyzed: 100;
readonly processingTimeMs: 1000;
readonly searchStrategy: "semantic_similarity";
readonly coverageMetrics: {
readonly totalTokens: 0;
readonly averageConfidence: 0;
};
};
};
readonly singleFileResponse: {
readonly description: "Valid response with just one relevant file";
readonly response: {
readonly relevantFiles: readonly [{
readonly path: "src/config/settings.ts";
readonly priority: "high";
readonly reasoning: "Configuration file that needs updating";
readonly confidence: 0.9;
readonly estimatedTokens: 300;
readonly modificationLikelihood: "high";
}];
readonly totalFilesAnalyzed: 50;
readonly processingTimeMs: 800;
readonly searchStrategy: "keyword_matching";
readonly coverageMetrics: {
readonly totalTokens: 300;
readonly averageConfidence: 0.9;
};
};
};
readonly commonErrors: {
readonly singleObjectError: {
readonly description: "WRONG: LLM returns single file object instead of array";
readonly incorrectResponse: {
readonly path: "src/auth/login.ts";
readonly priority: "high";
readonly reasoning: "Login module needs update";
readonly confidence: 0.9;
readonly estimatedTokens: 500;
readonly modificationLikelihood: "high";
};
readonly correctResponse: {
readonly relevantFiles: readonly [{
readonly path: "src/auth/login.ts";
readonly priority: "high";
readonly reasoning: "Login module needs update";
readonly confidence: 0.9;
readonly estimatedTokens: 500;
readonly modificationLikelihood: "high";
}];
readonly totalFilesAnalyzed: 80;
readonly processingTimeMs: 1200;
readonly searchStrategy: "semantic_similarity";
readonly coverageMetrics: {
readonly totalTokens: 500;
readonly averageConfidence: 0.9;
};
};
};
readonly textExplanationError: {
readonly description: "WRONG: Including explanatory text with JSON";
readonly incorrectResponse: "Based on my analysis, here are the relevant files:\n{\n \"relevantFiles\": [...],\n \"totalFilesAnalyzed\": 100,\n ...\n}";
readonly correctResponse: "Return ONLY the JSON object without any text";
};
readonly wrongFieldNameError: {
readonly description: "WRONG: Using incorrect field names";
readonly incorrectResponse: {
readonly fileScores: readonly [];
readonly totalFiles: 100;
readonly timeMs: 1000;
readonly strategy: "semantic_similarity";
readonly metrics: {
readonly tokens: 1000;
readonly confidence: 0.8;
};
};
};
};
};
export declare function getFileDiscoveryTaskId(strategy?: string): string;
export declare function validateFileDiscoveryResponse(response: unknown): boolean;
export declare function calculateCoverageMetrics(relevantFiles: Array<{
estimatedTokens: number;
confidence: number;
}>): {
totalTokens: number;
averageConfidence: number;
};
export declare function filterFilesByPriority(files: Array<{
priority: 'high' | 'medium' | 'low';
[key: string]: unknown;
}>, priority: 'high' | 'medium' | 'low'): Array<{
priority: 'high' | 'medium' | 'low';
[key: string]: unknown;
}>;
export declare function sortFilesByConfidence<T extends {
confidence: number;
}>(files: T[]): T[];
export declare function getRecommendedSearchStrategy(taskType: string): 'semantic_similarity' | 'keyword_matching' | 'semantic_and_keyword' | 'structural_analysis';
//# sourceMappingURL=file-discovery.d.ts.map