/** * Project Analysis Engine * Analyzes project structure, dependencies, and patterns to make intelligent suggestions */ export interface ProjectAnalysis { projectInfo: ProjectInfo; dependencies: DependencyAnalysis; structure: ProjectStructure; patterns: CodePatterns; suggestions: ProjectSuggestions; confidence: number; } export interface ProjectInfo { name: string; type: ProjectType; framework?: string; language: string[]; packageManager: 'npm' | 'yarn' | 'pnpm' | 'bun'; buildSystem?: string; testFramework?: string[]; uiLibrary?: string; stateManagement?: string; authentication?: string; } export interface DependencyAnalysis { production: Record; development: Record; frameworks: Framework[]; uiLibraries: UILibrary[]; testingFrameworks: TestingFramework[]; buildTools: BuildTool[]; linters: LintingTool[]; security: SecurityTool[]; cortexPackages: CortexPackage[]; } export interface ProjectStructure { directories: DirectoryInfo[]; fileTypes: Record; configFiles: ConfigFile[]; documentationFiles: string[]; testFiles: TestFile[]; codeComplexity: ComplexityMetrics; } export interface CodePatterns { architecturalPatterns: ArchitecturalPattern[]; designPatterns: DesignPattern[]; commonUtilities: Utility[]; reusableComponents: Component[]; configurationPatterns: ConfigPattern[]; testingPatterns: TestingPattern[]; extractablePackages: ExtractablePackage[]; } export interface ProjectSuggestions { recommendedRules: RuleSuggestion[]; missingDependencies: MissingDependency[]; improvementOpportunities: Improvement[]; consistencyIssues: ConsistencyIssue[]; extractionOpportunities: ExtractionOpportunity[]; bestPracticeViolations: BestPracticeViolation[]; performanceOptimizations: PerformanceOptimization[]; } export type ProjectType = 'nextjs' | 'flutter' | 'frontend' | 'backend' | 'fullstack' | 'mobile' | 'desktop' | 'library' | 'monorepo'; export interface Framework { name: string; version: string; type: 'frontend' | 'backend' | 'fullstack' | 'mobile' | 'desktop'; confidence: number; } export interface UILibrary { name: string; type: 'component-library' | 'css-framework' | 'design-system'; usage: 'primary' | 'secondary'; } export interface TestingFramework { name: string; type: 'unit' | 'integration' | 'e2e' | 'visual'; coverage?: number; } export interface BuildTool { name: string; type: 'bundler' | 'transpiler' | 'minifier' | 'preprocessor'; config?: string; } export interface LintingTool { name: string; type: 'linter' | 'formatter' | 'type-checker'; config?: string; } export interface SecurityTool { name: string; type: 'vulnerability-scanner' | 'secrets-scanner' | 'dependency-checker'; config?: string; } export interface CortexPackage { name: string; version: string; namespace: string; usage: 'direct' | 'indirect'; modificationOpportunity?: string; } export interface DirectoryInfo { path: string; purpose: 'source' | 'tests' | 'config' | 'docs' | 'build' | 'assets' | 'scripts'; fileCount: number; significance: number; } export interface ConfigFile { name: string; path: string; type: 'build' | 'test' | 'lint' | 'env' | 'deployment' | 'database' | 'ci-cd'; framework?: string; } export interface TestFile { path: string; type: 'unit' | 'integration' | 'e2e'; framework: string; coverage?: number; } export interface ComplexityMetrics { totalFiles: number; linesOfCode: number; cyclomatic: number; maintainabilityIndex: number; technicalDebt: 'low' | 'medium' | 'high'; } export interface ArchitecturalPattern { name: string; type: 'mvc' | 'mvvm' | 'clean' | 'hexagonal' | 'microservices' | 'monolith'; confidence: number; files: string[]; } export interface DesignPattern { name: string; type: 'creational' | 'structural' | 'behavioral'; occurrences: number; files: string[]; } export interface Utility { name: string; category: 'validation' | 'formatting' | 'data-processing' | 'api' | 'ui'; reusability: number; files: string[]; extractionCandidate: boolean; } export interface Component { name: string; type: 'ui-component' | 'hook' | 'service' | 'util'; complexity: 'low' | 'medium' | 'high'; reusability: number; dependencies: string[]; extractionCandidate: boolean; } export interface ConfigPattern { name: string; standardization: number; consistency: number; bestPractice: boolean; } export interface TestingPattern { name: string; coverage: number; quality: 'low' | 'medium' | 'high'; consistency: number; } export interface ExtractablePackage { name: string; description: string; files: string[]; dependencies: string[]; reusabilityScore: number; complexityScore: number; extractionEffort: 'low' | 'medium' | 'high'; businessValue: number; } export interface RuleSuggestion { ruleId: string; reason: string; confidence: number; priority: 'critical' | 'high' | 'medium' | 'low'; evidence: string[]; } export interface MissingDependency { name: string; type: 'production' | 'development'; reason: string; suggestedVersion?: string; alternatives: string[]; } export interface Improvement { category: 'performance' | 'security' | 'maintainability' | 'scalability'; title: string; description: string; impact: 'high' | 'medium' | 'low'; effort: 'low' | 'medium' | 'high'; files?: string[]; } export interface ConsistencyIssue { category: 'naming' | 'structure' | 'patterns' | 'configuration'; description: string; files: string[]; suggestedFix: string; severity: 'error' | 'warning' | 'info'; } export interface ExtractionOpportunity { type: 'component' | 'utility' | 'service' | 'configuration'; name: string; description: string; files: string[]; reusabilityScore: number; extractionEffort: 'low' | 'medium' | 'high'; suggestedPackageName: string; } export interface BestPracticeViolation { rule: string; description: string; files: string[]; severity: 'error' | 'warning' | 'info'; suggestedFix: string; references: string[]; } export interface PerformanceOptimization { type: 'bundle-size' | 'runtime' | 'memory' | 'network'; description: string; impact: 'high' | 'medium' | 'low'; implementation: string; files?: string[]; } export declare class ProjectAnalyzer { private projectPath; private analysis; constructor(projectPath: string); /** * Perform comprehensive project analysis */ analyze(): Promise; /** * Analyze basic project information */ private analyzeProjectInfo; /** * Analyze project dependencies */ private analyzeDependencies; /** * Analyze project structure */ private analyzeProjectStructure; /** * Analyze code patterns and architecture */ private analyzeCodePatterns; /** * Generate suggestions based on analysis */ private generateSuggestions; private getAllFiles; private analyzeDirectories; private analyzeFileTypes; private analyzeConfigFiles; private findDocumentationFiles; private analyzeTestFiles; private calculateComplexity; private calculateDirectorySignificance; private calculateConfidence; private detectArchitecturalPatterns; private detectDesignPatterns; private detectUtilities; private detectReusableComponents; private detectConfigurationPatterns; private detectTestingPatterns; private detectExtractablePackages; private recommendRules; private detectMissingDependencies; private detectImprovements; private detectConsistencyIssues; private detectExtractionOpportunities; private detectBestPracticeViolations; private detectPerformanceOptimizations; } export interface ProjectContext { rootPath: string; projectInfo: ProjectInfo; dependencies: DependencyAnalysis; structure: ProjectStructure; patterns: CodePatterns; } export default ProjectAnalyzer; //# sourceMappingURL=project-analyzer.d.ts.map