UNPKG

xc-mcp

Version:

MCP server that wraps Xcode command-line tools for iOS/macOS development workflows

119 lines 3.12 kB
export interface PersistenceConfig { enabled: boolean; cacheDir: string; schemaVersion: string; } export interface SerializedData { version: string; timestamp: Date; data: unknown; } /** * PersistenceManager handles opt-in file-based persistence for XC-MCP cache systems. * Provides atomic file operations, smart storage location selection, and graceful degradation. */ export declare class PersistenceManager { private enabled; private cacheDir; private readonly schemaVersion; private readonly saveQueue; /** * Enable persistence with optional custom cache directory */ enable(userCacheDir?: string): Promise<{ success: boolean; cacheDir: string; message?: string; }>; /** * Disable persistence with option to clear existing data */ disable(clearData?: boolean): Promise<{ success: boolean; message?: string; }>; /** * Get current persistence status and storage information */ getStatus(includeStorageInfo?: boolean): Promise<{ enabled: boolean; cacheDir?: string; schemaVersion: string; storageInfo?: { diskUsage: number; fileCount: number; lastSave?: Date; isWritable: boolean; }; }>; /** * Check if persistence is currently enabled */ isEnabled(): boolean; /** * Save state for a specific cache type with debouncing */ saveState(cacheType: string, data: unknown): Promise<void>; /** * Load state for a specific cache type */ loadState<T>(cacheType: string): Promise<T | null>; /** * Determine the best storage location based on priority */ private determineStorageLocation; /** * Ensure directory exists and is writable */ private ensureDirectoryWritable; /** * Create the required directory structure */ private createDirectoryStructure; /** * Smart .gitignore handling that preserves existing content */ private ensureGitignore; /** * Write schema version file */ private writeVersionFile; /** * Perform the actual state save with atomic writes */ private doSaveState; /** * Get cache file path for a specific cache type */ private getCacheFilePath; /** * Serialize data with support for Map and Date objects */ private serialize; /** * Deserialize data with support for Map and Date objects */ private deserialize; /** * Validate cache data structure */ private validateCacheData; /** * File locking for concurrent access protection */ private withFileLock; /** * Get storage information for status reporting */ private getStorageInfo; /** * Recursively get all files in a directory */ private getAllFiles; /** * Clear all persisted data */ private clearAllData; } export declare const persistenceManager: PersistenceManager; //# sourceMappingURL=persistence.d.ts.map