import { MemoryBankStatus } from '../types/index.js'; import { ProgressTracker } from './ProgressTracker.js'; import { ModeManager } from '../utils/ModeManager.js'; /** * Class responsible for managing Memory Bank operations * * This class handles all operations related to Memory Bank directories, * including initialization, file operations, and status tracking. */ export declare class MemoryBankManager { private memoryBankDir; private relativeMemoryBankPath; private customPath; private progressTracker; private modeManager; private rulesLoader; private projectPath; private userId; private folderName; private fileSystem; private isRemote; private remoteConfig; private language; /** * List of allowed core files for the Memory Bank */ static readonly ALLOWED_CORE_FILES: string[]; /** * Creates a new MemoryBankManager instance * * @param projectPath Optional project path to use instead of current directory * @param userId Optional GitHub profile URL for tracking changes * @param folderName Optional folder name for the Memory Bank (default: 'memory-bank') * @param debugMode Optional flag to enable debug mode * @param remoteConfig Optional remote server configuration */ constructor(projectPath?: string, userId?: string, folderName?: string, debugMode?: boolean, remoteConfig?: { sshKeyPath: string; remoteUser: string; remoteHost: string; remotePath: string; }); /** * Gets the language used for the Memory Bank * * @returns The language code (always 'en' for English) */ getLanguage(): string; /** * Sets the language for the Memory Bank * * Note: This method is provided for API consistency, but the Memory Bank * will always use English (en) regardless of the language parameter. * This is a deliberate design decision to ensure consistency across all Memory Banks. * * @param language - Language code (ignored, always sets to 'en') */ setLanguage(language: string): void; /** * Gets the project path * * @returns The project path */ getProjectPath(): string; /** * Finds a Memory Bank directory in the provided directory * * Combines the provided directory with the folder name to create the Memory Bank path. * * @param startDir - Starting directory for the search * @param customPath - Optional custom path (ignored in this implementation) * @returns Path to the Memory Bank directory or null if not found */ findMemoryBankDir(startDir: string, customPath?: string): Promise; /** * Checks if a directory is a valid Memory Bank * * @param dirPath - Directory path to check * @returns True if it's a valid Memory Bank, false otherwise */ isMemoryBank(dirPath: string): Promise; /** * Validates if all required .mcprules files exist in the project root * * @param projectDir - Project directory to check * @returns Object with validation results */ validateMcpRules(projectDir: string): Promise<{ valid: boolean; missingFiles: string[]; existingFiles: string[]; }>; /** * Initializes the Memory Bank * * @param createIfNotExists - Whether to create the Memory Bank if it doesn't exist * @returns Path to the Memory Bank directory * @throws Error if initialization fails */ initialize(createIfNotExists?: boolean): Promise; /** * Reads a file from the Memory Bank * * @param filename - Name of the file to read * @returns File contents as a string * @throws Error if file reading fails or filename is invalid */ readFile(filename: string): Promise; /** * Writes content to a file in the Memory Bank * * @param filename - Name of the file to write * @param content - Content to write * @throws Error if file writing fails or filename is invalid */ writeFile(filename: string, content: string): Promise; /** * Lists files in the Memory Bank * * @returns Array of file names * @throws Error if directory reading fails */ listFiles(): Promise; /** * Gets the status of the Memory Bank * * @returns Status object with information about the Memory Bank * @throws Error if the Memory Bank directory is not set */ getStatus(): Promise; /** * Initializes a Memory Bank at the given path * * This method sets the custom path and then calls the initialize method. * It exists for backwards compatibility with tests and older code. * * @param dirPath - Directory path where the Memory Bank will be initialized * @returns Path to the Memory Bank directory * @throws Error if initialization fails */ initializeMemoryBank(dirPath: string): Promise; /** * Sets a custom path for the Memory Bank * * @param customPath - Custom path to use */ setCustomPath(customPath?: string): Promise; /** * Gets the custom path for the Memory Bank * * @returns Custom path or null if not set */ getCustomPath(): string | null; /** * Gets the Memory Bank directory * * @returns Memory Bank directory or null if not set */ getMemoryBankDir(): string | null; /** * Gets the Memory Bank folder name * * @returns The folder name (default: 'memory-bank') */ getFolderName(): string; /** * Sets the Memory Bank directory * * @param dir - Directory path */ setMemoryBankDir(dir: string): void; /** * Gets the path to use for FileSystem operations * For non-remote: returns relative path * For remote: returns the full path * * @returns Path for filesystem operations */ private getFileSystemPath; /** * Gets the ProgressTracker * * @returns ProgressTracker or null if not available */ getProgressTracker(): ProgressTracker | null; /** * Creates a backup of the Memory Bank * * Supports both local and remote file systems through FileSystemInterface. * For remote: creates backup on the remote server. * For local: creates backup locally. * * @param backupDir - Directory where the backup will be stored (relative for remote, absolute for local) * @returns Path to the backup directory * @throws Error if the Memory Bank directory is not set or backup fails */ createBackup(backupDir?: string): Promise; /** * Migrates Memory Bank files from camelCase to kebab-case naming convention. * Delegates to MigrationUtils.migrateFileNamingConvention(). * * @returns Object with migrated file list and any errors */ migrateFileNaming(): Promise<{ migrated: string[]; errors: string[]; }>; /** * Lists available backups of the Memory Bank * * Scans the parent directory for backup folders matching the pattern * `memory-bank-backup-TIMESTAMP`. * * @returns Array of backup info objects sorted by timestamp (newest first) */ listBackups(): Promise>; /** * Restores the Memory Bank from a backup * * Creates a backup of the current state before restoring, then copies * all files from the specified backup to the Memory Bank directory. * * @param backupId - The backup ID (folder name) to restore from * @param createPreRestoreBackup - Whether to backup current state before restore (default: true) * @returns Object with restore status and pre-restore backup path (if created) */ restoreBackup(backupId: string, createPreRestoreBackup?: boolean): Promise<{ success: boolean; preRestoreBackupPath?: string; restoredFiles: string[]; }>; /** * Initializes the mode manager * * @param initialMode Initial mode to set (optional) * @returns Promise that resolves when initialization is complete */ initializeModeManager(initialMode?: string): Promise; /** * Gets the mode manager * * @returns Mode manager or null if not initialized */ getModeManager(): ModeManager | null; /** * Switches to a specific mode * * @param mode Mode name * @returns True if the mode was successfully switched, false otherwise */ switchMode(mode: string): Promise; /** * Checks if a text matches the UMB trigger * * @param text Text to check * @returns True if the text matches the UMB trigger, false otherwise */ checkUmbTrigger(text: string): boolean; /** * Activates UMB mode * * @returns True if UMB mode was activated, false otherwise */ activateUmbMode(): boolean; /** * Checks if UMB mode is active * * @returns True if UMB mode is active, false otherwise */ isUmbModeActive(): boolean; /** * Completes UMB mode * * @returns True if UMB mode was deactivated, false otherwise */ completeUmbMode(): Promise; /** * Gets the status prefix for responses * * @returns Status prefix string */ getStatusPrefix(): string; /** * Gets the current mode state * * @returns Current mode state or null if mode manager not initialized */ getCurrentModeState(): { name: string; isUmbActive: boolean; memoryBankStatus: 'ACTIVE' | 'INACTIVE'; } | null; /** * Detects mode triggers in the given text * * @param text - Text to check for mode triggers * @returns Array of mode names that were triggered */ detectModeTriggers(text: string): string[]; } //# sourceMappingURL=MemoryBankManager.d.ts.map