UNPKG

@memory-bank/mcp

Version:

Memory-enabled Co-Pilot (MCP) server for managing project documentation and context

89 lines 2.85 kB
import type { IConfigProvider } from '../../config/index.js'; import type { IFileSystemService } from '../../storage/interfaces/IFileSystemService.js'; /** * Base class: Provides common functionality for file system based memory bank repositories */ export declare abstract class FileSystemMemoryBankRepositoryBase { protected readonly fileSystemService: IFileSystemService; protected readonly configProvider: IConfigProvider; /** * Constructor * @param fileSystemService File system service * @param configProvider Configuration provider */ constructor(fileSystemService: IFileSystemService, configProvider: IConfigProvider); /** * Check if directory exists * @param dirPath Directory path * @returns true if directory exists */ protected directoryExists(dirPath: string): Promise<boolean>; /** * Check if file exists * @param filePath File path * @returns true if file exists */ protected fileExists(filePath: string): Promise<boolean>; /** * Create directory * @param dirPath Directory path */ protected createDirectory(dirPath: string): Promise<void>; /** * Write file * @param filePath File path * @param content File content */ protected writeFile(filePath: string, content: string): Promise<void>; /** * Read file * @param filePath File path * @returns File content */ protected readFile(filePath: string): Promise<string>; /** * Delete file * @param filePath File path * @returns true if deletion was successful */ protected deleteFile(filePath: string): Promise<boolean>; /** * List files * @param dirPath Directory path * @returns Array of file paths */ protected listFiles(dirPath: string): Promise<string[]>; /** * Get file stats * @param filePath File path * @returns File stats information */ protected getFileStats(filePath: string): Promise<{ lastModified: Date; }>; /** * Generate UUID * @returns UUID string */ protected generateUUID(): string; /** * Check if path is valid (path traversal protection) * @param requestedPath Path * @param basePath Base path * @returns true if path is valid */ protected isValidPath(requestedPath: string, basePath: string): boolean; /** * Log an error * @param message Error message * @param error Error object */ protected logError(message: string, error: unknown): void; /** * Log debug information * @param message Debug message * @param context Optional context */ protected logDebug(message: string, context?: Record<string, unknown>): void; } //# sourceMappingURL=FileSystemMemoryBankRepositoryBase.d.ts.map