UNPKG

mcp-adr-analysis-server

Version:

MCP server for analyzing Architectural Decision Records and project architecture

104 lines 3.98 kB
/** * Enterprise Location-based filtering system with Tree-sitter intelligence * * Determines if files are in appropriate locations based on their type and content * Enhanced with AI-powered code analysis for multi-language DevOps stacks */ import { type CodeAnalysisResult } from './tree-sitter-analyzer.js'; /** * Rule for validating file locations based on type and content */ export interface LocationRule { /** Name of the location rule */ name: string; /** Description of what the rule validates */ description: string; /** Pattern to match file names */ filePattern: RegExp; /** Optional pattern to match file content */ contentPattern?: RegExp; /** Paths where files matching this rule are allowed */ allowedPaths: string[]; /** Paths where files matching this rule are blocked */ blockedPaths: string[]; /** Severity level of violations */ severity: 'error' | 'warning' | 'info'; /** Category of the rule */ category: 'development' | 'security' | 'temporary' | 'testing'; } /** * Result of location validation for a file */ export interface LocationValidationResult { /** Whether the file location is valid */ isValid: boolean; /** Rule that was matched (if any) */ rule?: LocationRule; /** Current path of the file */ currentPath: string; /** Suggested alternative paths */ suggestedPaths: string[]; /** Severity of the validation result */ severity: 'error' | 'warning' | 'info'; /** Human-readable validation message */ message: string; /** Tree-sitter analysis results (if available) */ treeSitterAnalysis?: CodeAnalysisResult; /** AI-powered intelligent reasons for the validation */ intelligentReasons?: string[]; } /** * Default location rules for common development artifacts */ export declare const DEFAULT_LOCATION_RULES: LocationRule[]; /** * Enhanced file location validation with tree-sitter intelligence */ export declare function validateFileLocationIntelligent(filePath: string, content?: string, customRules?: LocationRule[]): Promise<LocationValidationResult>; /** * Legacy function for backward compatibility * Validate file location against rules */ export declare function validateFileLocation(filePath: string, content?: string, customRules?: LocationRule[]): LocationValidationResult; /** * Get location suggestions for a file (backward compatible overloads) */ export declare function getLocationSuggestions(filePath: string, categoryOrDescription?: 'development' | 'security' | 'temporary' | 'testing' | string): string[] | { suggestions: string[]; category: string; }; /** * Check if a file should be ignored based on common patterns */ export declare function shouldIgnoreFile(filePath: string): { shouldIgnore: boolean; reason: string; severity: 'error' | 'warning' | 'info'; }; /** * Create a custom location rule */ export declare function createLocationRule(name: string, description: string, filePattern: string, allowedPaths: string[], blockedPaths?: string[], severity?: 'error' | 'warning' | 'info', category?: 'development' | 'security' | 'temporary' | 'testing', contentPattern?: string): LocationRule; /** * Load location rules from project configuration */ export declare function loadLocationRules(_projectPath: string): LocationRule[]; /** * Validate multiple files at once */ export declare function validateMultipleFiles(filePaths: string[], fileContents?: string[], customRules?: LocationRule[]): LocationValidationResult[]; /** * Get summary statistics for location validation */ export declare function getLocationValidationSummary(results: Array<LocationValidationResult & { filePath: string; }>): { totalFiles: number; validFiles: number; invalidFiles: number; errorCount: number; warningCount: number; infoCount: number; categorySummary: Record<string, number>; }; //# sourceMappingURL=location-filter.d.ts.map