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.
153 lines • 3.81 kB
TypeScript
/**
* MUSHCODE validation engine
* Validates syntax, security, and best practices
*/
import { SyntaxError, SecurityWarning, CodeImprovement } from '../types/knowledge.js';
import { MushcodeKnowledgeBase } from '../knowledge/base.js';
export interface ValidationRequest {
code: string;
serverType?: string | undefined;
strictMode?: boolean | undefined;
checkSecurity?: boolean | undefined;
checkBestPractices?: boolean | undefined;
}
export interface ValidationResult {
isValid: boolean;
syntaxErrors: SyntaxError[];
securityWarnings: SecurityWarning[];
bestPracticeSuggestions: CodeImprovement[];
compatibilityNotes: string[];
totalLines: number;
complexityScore: number;
securityScore: number;
maintainabilityScore: number;
}
export declare class MushcodeValidator {
private knowledgeBase;
constructor(knowledgeBase: MushcodeKnowledgeBase);
/**
* Validate MUSHCODE for syntax, security, and best practices
*/
validate(request: ValidationRequest): Promise<ValidationResult>;
/**
* Create validation context with all necessary information
*/
private createValidationContext;
/**
* Validate the validation request
*/
private validateRequest;
/**
* Validate MUSHCODE syntax
*/
private validateSyntax;
/**
* Validate basic syntax rules
*/
private validateBasicSyntax;
/**
* Check for invalid characters
*/
private checkInvalidCharacters;
/**
* Validate bracket and parentheses matching
*/
private validateBracketMatching;
/**
* Validate function syntax
*/
private validateFunctionSyntax;
/**
* Validate attribute syntax
*/
private validateAttributeSyntax;
/**
* Validate string literals
*/
private validateStringLiterals;
/**
* Validate regex patterns
*/
private validateRegexPatterns;
/**
* Validate variable references
*/
private validateVariableReferences;
/**
* Validate command syntax
*/
private validateCommandSyntax;
/**
* Validate global syntax issues
*/
private validateGlobalSyntax;
/**
* Calculate maximum nesting depth
*/
private calculateMaxNestingDepth;
/**
* Validate security vulnerabilities
*/
private validateSecurity;
/**
* Check for common security issues not covered by rules
*/
private checkCommonSecurityIssues;
/**
* Validate best practices
*/
private validateBestPractices;
/**
* Check code style best practices
*/
private checkCodeStyle;
/**
* Check performance best practices
*/
private checkPerformance;
/**
* Check maintainability best practices
*/
private checkMaintainability;
/**
* Check readability best practices
*/
private checkReadability;
/**
* Check server compatibility
*/
private checkCompatibility;
/**
* Calculate quality scores for the code
*/
private calculateQualityScores;
/**
* Calculate complexity score (0-100)
*/
private calculateComplexityScore;
/**
* Calculate security score (0-100, higher is better)
*/
private calculateSecurityScore;
/**
* Calculate maintainability score (0-100)
*/
private calculateMaintainabilityScore;
/**
* Calculate line complexity
*/
private calculateLineComplexity;
/**
* Get line number from character index
*/
private getLineNumber;
/**
* Get column number from character index
*/
private getColumnNumber;
/**
* Get code snippet around a line
*/
private getCodeSnippet;
}
//# sourceMappingURL=validator.d.ts.map