@aaswe/codebase-ai
Version:
AI-Assisted Software Engineering (AASWE) - Rich codebase context for IDE LLMs
124 lines • 3.9 kB
TypeScript
import { Neo4jDatabaseService } from '../layer2/neo4j-database/Neo4jDatabaseService';
export interface MultiLanguageCodeEntity {
id: string;
name: string;
type: 'File' | 'Class' | 'Method' | 'Function' | 'Interface' | 'Module' | 'Package';
language: string;
sourceCode: string;
filePath: string;
startLine: number;
endLine: number;
version: string;
lastModified: Date;
metadata: Record<string, any>;
}
export interface MultiLanguageCodeRelationship {
from: string;
to: string;
type: 'IMPORTS' | 'EXTENDS' | 'IMPLEMENTS' | 'CALLS' | 'USES' | 'CONTAINS' | 'DEPENDS_ON' | 'INHERITS';
language: string;
metadata: Record<string, any>;
version: string;
}
export interface VersionedMultiLanguageGraph {
version: string;
timestamp: Date;
entities: MultiLanguageCodeEntity[];
relationships: MultiLanguageCodeRelationship[];
languages: string[];
ttlSyncHash: string;
gitCommit?: string | undefined;
statistics: {
totalFiles: number;
totalClasses: number;
totalMethods: number;
totalLines: number;
languageBreakdown: Record<string, number>;
};
}
/**
* MultiLanguageCodeGraphAnalyzer - Advanced multi-language code graph analysis
*
* This service creates comprehensive code graphs for ANY programming language by:
* 1. Using @codegraph-js/codegraph for multi-language AST analysis
* 2. Supporting TypeScript, JavaScript, Python, Java, Go, Rust, C++, C#, etc.
* 3. Storing actual source code content with relationships in Neo4j
* 4. Maintaining version synchronization with TTL files
* 5. Providing rich multi-language context for LLM queries
*/
export declare class MultiLanguageCodeGraphAnalyzer {
private neo4jService;
private currentVersion;
private supportedLanguages;
constructor(neo4jService: Neo4jDatabaseService);
/**
* Analyze entire multi-language codebase and create versioned code graph
*/
analyzeMultiLanguageCodebase(projectPath: string): Promise<VersionedMultiLanguageGraph>;
/**
* Discover source files by programming language
*/
private discoverSourceFiles;
/**
* Analyze files for a specific programming language
*/
private analyzeLanguageFiles;
/**
* Analyze file using enhanced pattern-based analysis
* (CodeGraph integration can be added later when API is better understood)
*/
private analyzeFileWithCodeGraph;
/**
* Enhanced pattern-based analysis for multiple languages
*/
private enhancedPatternAnalysis;
/**
* Create file entity
*/
private createFileEntity;
/**
* Create code entity from analysis result
*/
private createCodeEntity;
/**
* Store versioned multi-language graph in Neo4j
*/
private storeVersionedMultiLanguageGraph;
/**
* Generate TTL sync hash for version correlation
*/
private generateTTLSyncHash;
/**
* Find all TTL files in the project
*/
private findTTLFiles;
/**
* Find files recursively
*/
private findFilesRecursive;
/**
* Get current Git commit hash
*/
private getCurrentGitCommit;
/**
* Generate version string
*/
private generateVersion;
/**
* Calculate complexity (simplified)
*/
private calculateComplexity;
/**
* Query multi-language code graph
*/
queryMultiLanguageCodeGraph(query: string, language?: string, version?: string): Promise<any[]>;
/**
* Search code patterns across all languages
*/
searchMultiLanguageCodePatterns(pattern: string, languages?: string[], entityType?: string, version?: string): Promise<any[]>;
/**
* Get language statistics
*/
getLanguageStatistics(version?: string): Promise<any>;
}
//# sourceMappingURL=MultiLanguageCodeGraphAnalyzer.d.ts.map