UNPKG

vibe-coder-mcp

Version:

Production-ready MCP server with complete agent integration, multi-transport support, and comprehensive development automation tools for AI-assisted workflows.

277 lines 18.5 kB
import { ContextCuratorLLMTask } from '../types/llm-tasks.js'; import { IntentAnalysisResult, FileDiscoveryResult } from '../types/llm-tasks.js'; export declare const RELEVANCE_SCORING_SYSTEM_PROMPT = "You are an expert software architect and relevance analyst specializing in scoring file relevance for development tasks.\n\n\uD83D\uDEA8 CRITICAL INSTRUCTION: You MUST score ALL files provided in the input. Never return a single file response. Always return a complete fileScores array with every file from the input list.\n\nYour task is to analyze discovered files and assign detailed relevance scores based on their importance to the specific development request.\n\n## SCORING STRATEGIES\n\n**Semantic Similarity**: \n- Analyze conceptual relationships between files and task requirements\n- Consider functional overlap and domain relevance\n- Evaluate how files contribute to the overall system behavior\n- Focus on meaning and purpose rather than surface-level matches\n\n**Keyword Density**:\n- Analyze frequency and importance of task-related keywords in file content\n- Consider file names, function names, class names, and comments\n- Weight keywords by their specificity and relevance to the task\n- Factor in keyword context and usage patterns\n\n**Structural Importance**:\n- Evaluate files based on their architectural significance\n- Consider dependency relationships and import/export patterns\n- Assess impact on system structure and component interactions\n- Factor in file size, complexity, and centrality in the codebase\n\n**Hybrid**:\n- Combine semantic, keyword, and structural analysis\n- Weight different factors based on task type and context\n- Provide balanced assessment considering multiple relevance dimensions\n- Optimize for comprehensive understanding of file importance\n\n## RELEVANCE SCORING CRITERIA\n\n**Score Range**: 0.0 to 1.0\n- **0.9-1.0**: Critical files that are central to the task\n- **0.7-0.8**: Important files that will likely need modification\n- **0.5-0.6**: Supporting files that provide necessary context\n- **0.3-0.4**: Reference files that may be consulted\n- **0.0-0.2**: Minimally relevant or background files\n\n## CONFIDENCE ASSESSMENT\n\nRate confidence (0.0 to 1.0) based on:\n- Quality and completeness of available file information\n- Clarity of the relationship between file and task\n- Consistency of relevance indicators across different analysis methods\n- Certainty about the file's role in the development task\n\n## RELEVANCE CATEGORIES\n\nAssign files to relevant categories:\n- **core**: Files central to the main functionality being developed/modified\n- **integration**: Files that handle connections between components\n- **configuration**: Files that control system behavior and settings\n- **testing**: Files related to testing the functionality\n- **documentation**: Files that document the functionality\n- **utilities**: Helper files and utility functions\n- **dependencies**: External or internal dependencies\n- **infrastructure**: Build, deployment, and development infrastructure\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\n\uD83D\uDEA8 CRITICAL: You MUST score ALL files in the input list. Respond with a valid JSON object matching this exact structure with a fileScores array containing EVERY file:\n\n{\n \"fileScores\": [\n {\n \"filePath\": \"relative/path/to/file.ext\",\n \"relevanceScore\": 0.0-1.0,\n \"confidence\": 0.0-1.0,\n \"reasoning\": \"Detailed explanation of relevance assessment\",\n \"categories\": [\"category1\", \"category2\"],\n \"modificationLikelihood\": \"very_high|high|medium|low|very_low\",\n \"estimatedTokens\": number\n }\n ],\n \"overallMetrics\": {\n \"averageRelevance\": 0.0-1.0,\n \"totalFilesScored\": number,\n \"highRelevanceCount\": number,\n \"processingTimeMs\": number\n },\n \"scoringStrategy\": \"semantic_similarity|keyword_density|structural_importance|hybrid\"\n}\n\n## SCORING GUIDELINES\n\n1. **Be Precise**: Provide accurate relevance scores based on thorough analysis\n2. **Be Comprehensive**: Consider all aspects of file relevance to the task\n3. **Provide Clear Reasoning**: Explain the rationale behind each relevance score\n4. **Categorize Appropriately**: Assign meaningful categories that reflect file roles\n5. **Assess Realistically**: Provide honest confidence scores and modification likelihood\n6. **Consider Context**: Factor in the specific development task and codebase context\n7. **Preserve Token Estimates**: ALWAYS include the exact estimatedTokens value from the file discovery results for each file\n\nIMPORTANT: For each file, you MUST preserve the exact estimatedTokens value provided in the file discovery results. Do not modify or recalculate these values.\n\nAnalyze the discovered files and development context to provide detailed relevance scoring for the task."; export declare function buildRelevanceScoringPrompt(originalPrompt: string, intentAnalysis: IntentAnalysisResult, refinedPrompt: string, fileDiscoveryResult: FileDiscoveryResult, scoringStrategy: 'semantic_similarity' | 'keyword_density' | 'structural_importance' | 'hybrid', additionalContext?: { codemapContent?: string; priorityWeights?: { semantic: number; keyword: number; structural: number; }; categoryFilters?: string[]; minRelevanceThreshold?: number; }): string; export declare const RELEVANCE_SCORING_RESPONSE_SCHEMA: { readonly type: "object"; readonly properties: { readonly fileScores: { readonly type: "array"; readonly items: { readonly type: "object"; readonly properties: { readonly filePath: { readonly type: "string"; readonly minLength: 1; readonly description: "Relative path to the file"; }; readonly relevanceScore: { readonly type: "number"; readonly minimum: 0; readonly maximum: 1; readonly description: "Relevance score from 0.0 to 1.0"; }; readonly confidence: { readonly type: "number"; readonly minimum: 0; readonly maximum: 1; readonly description: "Confidence score from 0.0 to 1.0"; }; readonly reasoning: { readonly type: "string"; readonly minLength: 1; readonly description: "Detailed explanation of relevance assessment"; }; readonly categories: { readonly type: "array"; readonly items: { readonly type: "string"; }; readonly minItems: 1; readonly description: "Relevance categories 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 estimatedTokens: { readonly type: "number"; readonly minimum: 0; readonly description: "Estimated token count for the file (preserve from file discovery)"; }; }; readonly required: readonly ["filePath", "relevanceScore", "confidence", "reasoning", "categories", "modificationLikelihood", "estimatedTokens"]; readonly additionalProperties: false; }; readonly description: "Individual file relevance scores"; }; readonly overallMetrics: { readonly type: "object"; readonly properties: { readonly averageRelevance: { readonly type: "number"; readonly minimum: 0; readonly maximum: 1; readonly description: "Average relevance score across all files"; }; readonly totalFilesScored: { readonly type: "number"; readonly minimum: 0; readonly description: "Total number of files scored"; }; readonly highRelevanceCount: { readonly type: "number"; readonly minimum: 0; readonly description: "Number of files with high relevance (>= 0.7)"; }; readonly processingTimeMs: { readonly type: "number"; readonly minimum: 0; readonly description: "Processing time in milliseconds"; }; }; readonly required: readonly ["averageRelevance", "totalFilesScored", "highRelevanceCount", "processingTimeMs"]; readonly additionalProperties: false; readonly description: "Overall scoring metrics"; }; readonly scoringStrategy: { readonly type: "string"; readonly enum: readonly ["semantic_similarity", "keyword_density", "structural_importance", "hybrid"]; readonly description: "Strategy used for relevance scoring"; }; }; readonly required: readonly ["fileScores", "overallMetrics", "scoringStrategy"]; readonly additionalProperties: false; }; export declare const RELEVANCE_SCORING_EXAMPLES: { readonly semantic_similarity_refactoring: { readonly originalPrompt: "Refactor the authentication module to use JWT tokens"; readonly scoringStrategy: "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 fileDiscoveryResult: { readonly relevantFiles: readonly [{ readonly path: "src/auth/authentication.ts"; readonly priority: "high"; readonly reasoning: "Core authentication module"; 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"; readonly confidence: 0.9; readonly estimatedTokens: 600; readonly modificationLikelihood: "high"; }]; readonly totalFilesAnalyzed: 150; readonly processingTimeMs: 2500; readonly searchStrategy: "semantic_similarity"; readonly coverageMetrics: { readonly totalTokens: 1400; readonly averageConfidence: 0.925; }; }; readonly expectedResponse: { readonly fileScores: readonly [{ readonly filePath: "src/auth/authentication.ts"; readonly relevanceScore: 0.95; readonly confidence: 0.9; readonly reasoning: "Core authentication module that directly handles user authentication logic and will be central to JWT token implementation"; readonly categories: readonly ["core", "authentication"]; readonly modificationLikelihood: "very_high"; }, { readonly filePath: "src/auth/middleware/auth-middleware.ts"; readonly relevanceScore: 0.85; readonly confidence: 0.85; readonly reasoning: "Authentication middleware that validates tokens and will need updates for JWT token validation"; readonly categories: readonly ["integration", "authentication"]; readonly modificationLikelihood: "high"; }]; readonly overallMetrics: { readonly averageRelevance: 0.9; readonly totalFilesScored: 2; readonly highRelevanceCount: 2; readonly processingTimeMs: 1800; }; readonly scoringStrategy: "semantic_similarity"; }; }; readonly keyword_density_feature: { readonly originalPrompt: "Add user dashboard with analytics charts"; readonly scoringStrategy: "keyword_density"; 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 fileDiscoveryResult: { readonly relevantFiles: readonly [{ readonly path: "src/components/Dashboard.tsx"; readonly priority: "high"; readonly reasoning: "Existing dashboard component"; 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"; readonly confidence: 0.85; readonly estimatedTokens: 900; readonly modificationLikelihood: "high"; }]; readonly totalFilesAnalyzed: 200; readonly processingTimeMs: 1800; readonly searchStrategy: "keyword_matching"; readonly coverageMetrics: { readonly totalTokens: 2100; readonly averageConfidence: 0.875; }; }; readonly expectedResponse: { readonly fileScores: readonly [{ readonly filePath: "src/components/Dashboard.tsx"; readonly relevanceScore: 0.92; readonly confidence: 0.88; readonly reasoning: "Contains high density of dashboard-related keywords and will be the primary component for the new analytics dashboard"; readonly categories: readonly ["core", "ui-components"]; readonly modificationLikelihood: "very_high"; }, { readonly filePath: "src/services/analytics-service.ts"; readonly relevanceScore: 0.88; readonly confidence: 0.82; readonly reasoning: "High keyword density for analytics and data processing, essential for dashboard data aggregation"; readonly categories: readonly ["core", "integration"]; readonly modificationLikelihood: "high"; }]; readonly overallMetrics: { readonly averageRelevance: 0.9; readonly totalFilesScored: 2; readonly highRelevanceCount: 2; readonly processingTimeMs: 1600; }; readonly scoringStrategy: "keyword_density"; }; }; }; export declare function getRelevanceScoringTaskId(): ContextCuratorLLMTask; export declare function enhanceRelevanceScoringResponse(response: unknown, scoringStrategy: 'semantic_similarity' | 'keyword_density' | 'structural_importance' | 'hybrid', processingTimeMs: number, expectedFiles?: Array<{ path: string; estimatedTokens: number; }>): unknown; export declare function validateRelevanceScoringResponse(response: unknown): boolean; export declare function calculateOverallMetrics(fileScores: Array<{ relevanceScore: number; }>, processingTimeMs: number): { averageRelevance: number; totalFilesScored: number; highRelevanceCount: number; processingTimeMs: number; }; export declare function filterFilesByRelevance<T extends { relevanceScore: number; }>(files: T[], minRelevance: number): T[]; export declare function sortFilesByRelevance<T extends { relevanceScore: number; }>(files: T[]): T[]; export declare function filterFilesByCategory<T extends { categories: string[]; }>(files: T[], targetCategory: string): T[]; export declare function getHighRelevanceFiles<T extends { relevanceScore: number; }>(files: T[]): T[]; export declare function getRecommendedScoringStrategy(taskType: string, fileCount: number, hasCodemap?: boolean): 'semantic_similarity' | 'keyword_density' | 'structural_importance' | 'hybrid'; export declare function calculateCategoryDistribution(fileScores: Array<{ categories: string[]; }>): Record<string, number>; export declare function getRelevanceStatistics(fileScores: Array<{ relevanceScore: number; }>): { min: number; max: number; mean: number; median: number; standardDeviation: number; }; //# sourceMappingURL=relevance-scoring.d.ts.map