UNPKG

mushcode-mcp-server

Version:

A specialized Model Context Protocol server for MUSHCODE development assistance. Provides AI-powered code generation, validation, optimization, and examples for MUD development.

91 lines 2.97 kB
/** * Optimized pattern matcher with caching and performance improvements */ import { MushcodePattern, PatternMatch, SecurityRule, CodeExample } from '../types/knowledge.js'; import { OptimizedKnowledgeBase } from './optimized-base.js'; import { PatternMatcher } from './matcher.js'; /** * Optimized pattern matcher with caching and improved algorithms */ export declare class OptimizedPatternMatcher extends PatternMatcher { private optimizedKnowledgeBase; private patternMatchCache; private securityViolationCache; private optimizationCache; private similarExamplesCache; private compiledSecurityPatterns; private codeTermsCache; constructor(optimizedKnowledgeBase: OptimizedKnowledgeBase); /** * Find patterns matching a natural language description with caching */ findPatternsForGeneration(description: string, serverType?: string, functionType?: string, difficulty?: string): PatternMatch[]; /** * Find security violations with optimized regex compilation and caching */ findSecurityViolations(code: string, serverType?: string): SecurityRule[]; /** * Find optimization patterns with caching and improved term extraction */ findOptimizationPatterns(code: string, serverType?: string): PatternMatch[]; /** * Find similar examples with caching */ findSimilarExamples(code: string, serverType?: string, limit?: number): CodeExample[]; /** * Fast pattern lookup by function name using knowledge base indexes */ findPatternsByFunction(functionName: string): MushcodePattern[]; /** * Fast tag-based search using knowledge base indexes */ findByTags(tags: string[]): { patterns: MushcodePattern[]; examples: CodeExample[]; }; /** * Get cache statistics for monitoring */ getCacheStats(): Record<string, any>; /** * Clear all caches */ clearCaches(): void; /** * Pre-compile security patterns for better performance */ private precompileSecurityPatterns; /** * Get code terms with caching */ private getCodeTermsCached; /** * Calculate optimized code pattern relevance with weighted scoring */ private calculateOptimizedCodePatternRelevance; /** * Calculate optimized example code relevance */ private calculateOptimizedExampleCodeRelevance; /** * Generate cache key for pattern matching */ private generatePatternCacheKey; /** * Generate cache key for security violations */ private generateSecurityCacheKey; /** * Generate cache key for optimization patterns */ private generateOptimizationCacheKey; /** * Generate cache key for similar examples */ private generateSimilarExamplesCacheKey; /** * Generate a hash for code content */ private generateCodeHash; } //# sourceMappingURL=optimized-matcher.d.ts.map