code-auditor-mcp
Version:
Multi-language code quality auditor with MCP server - Analyze TypeScript, JavaScript, and Go code for SOLID principles, DRY violations, security patterns, and more
181 lines • 4.55 kB
TypeScript
/**
* Runtime Manager
* Detects available language runtimes and manages analyzer processes
*/
export interface RuntimeInfo {
name: string;
command: string;
version: string;
available: boolean;
minVersion?: string;
analyzer?: LanguageAnalyzer;
executablePath?: string;
}
export interface LanguageAnalyzer {
name: string;
runtime: string;
command: string;
supports: string[];
analyze(files: string[], options?: any): Promise<AnalysisResult>;
}
export interface AnalysisResult {
violations: any[];
indexEntries: any[];
metrics: AnalysisMetrics;
errors?: any[];
}
export interface AnalysisMetrics {
filesAnalyzed: number;
executionTime: number;
memoryUsage?: number;
}
export interface RuntimeConfig {
enabled: boolean;
minVersion?: string;
command?: string;
analyzer?: string;
timeout?: number;
}
export declare class RuntimeManager {
private runtimes;
private initialized;
private config;
constructor(config?: Record<string, RuntimeConfig>);
/**
* Initialize runtime detection
*/
initialize(): Promise<void>;
/**
* Check if a specific runtime is available
*/
hasRuntime(name: string): boolean;
/**
* Get fallback runtime for a language if the primary is unavailable
*/
getFallbackRuntime(language: string): RuntimeInfo | null;
/**
* Get file extensions for a language
*/
private getLanguageExtensions;
/**
* Attempt to analyze with fallback runtime if primary fails
*/
analyzeWithFallback(language: string, files: string[], options?: any): Promise<AnalysisResult | null>;
/**
* Get installation suggestions for missing runtimes
*/
private getRuntimeInstallationSuggestions;
/**
* Get runtime information
*/
getRuntime(name: string): RuntimeInfo | undefined;
/**
* Get all available runtimes
*/
getAvailableRuntimes(): RuntimeInfo[];
/**
* Spawn analyzer for a specific language
*/
spawnAnalyzer(language: string, files: string[], options?: any): Promise<AnalysisResult | null>;
/**
* Run a function with timeout
*/
private runWithTimeout;
/**
* Spawn multiple analyzers in parallel with concurrency control
*/
spawnMultipleAnalyzers(languageFilePairs: Array<{
language: string;
files: string[];
}>, options?: {
maxConcurrency?: number;
timeout?: number;
}): Promise<Array<{
language: string;
result: AnalysisResult | null;
}>>;
/**
* Kill all running analyzer processes (for cleanup)
*/
killAllAnalyzers(): Promise<void>;
/**
* Detect Node.js runtime
*/
private detectNodeRuntime;
/**
* Detect Go runtime
*/
private detectGoRuntime;
/**
* Detect Python runtime
*/
private detectPythonRuntime;
/**
* Detect Rust runtime
*/
private detectRustRuntime;
/**
* Detect Deno runtime
*/
private detectDenoRuntime;
/**
* Detect Bun runtime
*/
private detectBunRuntime;
/**
* Check if a file exists
*/
private fileExists;
/**
* Check version compatibility with detailed reporting
*/
private checkVersionCompatibility;
/**
* Get detailed version compatibility report
*/
getVersionCompatibilityReport(): Array<{
runtime: string;
currentVersion: string;
minVersion?: string;
compatible: boolean;
status: 'compatible' | 'incompatible' | 'unknown';
recommendations?: string[];
}>;
/**
* Validate all runtime versions and return summary
*/
validateRuntimeVersions(): Promise<{
compatible: number;
incompatible: number;
unknown: number;
issues: Array<{
runtime: string;
issue: string;
recommendations: string[];
}>;
}>;
/**
* Compare semantic versions with enhanced parsing
*/
private compareVersions;
/**
* Log runtime status
*/
private logRuntimeStatus;
/**
* Get runtime statistics
*/
getStats(): {
total: number;
available: number;
withAnalyzers: number;
runtimes: {
[k: string]: {
available: boolean;
version: string;
hasAnalyzer: boolean;
};
};
};
}
//# sourceMappingURL=RuntimeManager.d.ts.map