ProjectContextManager.d.ts•2.52 kB
/**
* ProjectContextManager
*
* Manages project-level context including:
* - Project structure analysis
* - Framework and dependency detection
* - Git history and recent changes
* - Context caching
*/
export interface ProjectContextConfig {
projectPath: string;
ignorePatterns: string[];
cacheTTL: number;
maxContextSize: number;
}
export interface ProjectContext {
timestamp: number;
projectName: string;
frameworks: string[];
dependencies: Record<string, string>;
devDependencies: Record<string, string>;
fileStructure: FileStructure;
recentChanges: GitChange[];
branchInfo: GitBranchInfo;
patterns: CodePattern[];
}
export interface FileStructure {
directories: Record<string, FileStructure>;
files: string[];
}
export interface GitChange {
file: string;
status: string;
date: string;
author: string;
message: string;
}
export interface GitBranchInfo {
currentBranch: string;
branches: string[];
remotes: string[];
}
export interface CodePattern {
type: string;
pattern: string;
examples: string[];
}
export declare class ProjectContextManager {
private config;
private context;
private lastUpdateTime;
private fileWatcher;
private git;
private log;
constructor(config?: Partial<ProjectContextConfig>);
/**
* Get the project context, refreshing if needed
*/
getContext(forceRefresh?: boolean): Promise<ProjectContext>;
/**
* Analyze the entire project and build context
*/
private analyzeProject;
/**
* Detect frameworks used in the project
*/
private detectFrameworks;
/**
* Build file structure recursively
*/
private buildFileStructure;
/**
* Check if a path should be ignored
*/
private shouldIgnore;
/**
* Detect code patterns in the project
*/
private detectCodePatterns;
/**
* Detect React component patterns
*/
private detectReactPatterns;
/**
* Detect Express route patterns
*/
private detectExpressPatterns;
/**
* Detect generic code patterns
*/
private detectGenericPatterns;
/**
* Extract a code snippet from the content starting at the given index
*/
private extractCodeSnippet;
/**
* Set up file watcher to trigger context updates
*/
private setupFileWatcher;
/**
* Clean up resources
*/
dispose(): void;
}
export default ProjectContextManager;