@context-sync/server
Version:
MCP server for AI context sync with persistent memory, workspace file access, and intelligent code operations
83 lines • 2.21 kB
TypeScript
import type { Storage } from './storage.js';
import { ProjectDetector } from './project-detector.js';
export interface FileContent {
path: string;
content: string;
language: string;
size: number;
}
export interface ProjectSnapshot {
rootPath: string;
files: FileContent[];
structure: string;
summary: string;
}
export declare class WorkspaceDetector {
private storage;
private projectDetector;
private currentWorkspace;
private fileCache;
private fileWatcher;
private readonly MAX_FILE_SIZE;
private readonly WARN_FILE_SIZE;
constructor(storage: Storage, projectDetector: ProjectDetector);
/**
* Set the current workspace (called when IDE opens a folder)
*/
setWorkspace(workspacePath: string): void;
/**
* Set up file watcher for cache invalidation
*/
private setupFileWatcher;
/**
* Invalidate cached file content
*/
private invalidateFileCache;
/**
* Get current workspace
*/
getCurrentWorkspace(): string | null;
/**
* Read a file from the workspace
*/
readFile(relativePath: string): Promise<FileContent | null>;
/**
* Get project structure (file tree)
*/
getProjectStructure(maxDepth?: number): Promise<string>;
private buildStructure;
/**
* Scan important files (main entry points, configs, etc.)
*/
scanImportantFiles(): Promise<FileContent[]>;
/**
* Create a snapshot of the project for context
*/
createSnapshot(): Promise<ProjectSnapshot>;
/**
* Generate a summary of the project
*/
private generateSummary;
/**
* Check if file/folder should be ignored
*/
private shouldIgnore;
/**
* Detect programming language from file extension
*/
private detectLanguage;
/**
* Get icon for file type
*/
private getFileIcon;
/**
* Search for files matching a pattern
*/
searchFiles(pattern: string, maxResults?: number): Promise<FileContent[]>;
private searchRecursive;
/**
* Dispose resources (cleanup file watcher)
*/
dispose(): void;
}
//# sourceMappingURL=workspace-detector.d.ts.map