UNPKG

@dollhousemcp/mcp-server

Version:

DollhouseMCP - A Model Context Protocol (MCP) server that enables dynamic AI persona management from markdown files, allowing Claude and other compatible AI assistants to activate and switch between different behavioral personas.

91 lines 2.91 kB
import { IFileOperationsService } from '../services/FileOperationsService.js'; export interface CopyOptions { onProgress?: (copied: number, total: number, currentFile: string) => void; excludePatterns?: string[]; maxRetries?: number; } export interface FileStats { totalFiles: number; totalSize: number; } /** * Cross-platform file operations utility * Centralizes common file operations with progress reporting and error handling */ export declare class FileOperations { /** * Recursively copy a directory with progress reporting * Works cross-platform without relying on shell commands */ static copyDirectory(src: string, dest: string, options?: CopyOptions): Promise<void>; /** * Calculate directory statistics for progress reporting */ private static calculateDirectoryStats; /** * Internal recursive copy implementation */ private static copyDirectoryRecursive; /** * Copy a single file with retry logic */ private static copyFileWithRetry; /** * Check if a file/directory should be excluded * * FIX: ReDoS vulnerability - replaced unsafe glob-to-regex conversion * Previously: Used pattern.replace with .* which could cause catastrophic backtracking * Now: Uses safe glob matching with proper escaping and bounded patterns * SonarCloud: Resolves DOS vulnerability hotspot */ private static shouldExclude; /** * Remove a directory with progress reporting */ static removeDirectory(dir: string, options?: { onProgress?: (removed: number, total: number) => void; }): Promise<void>; /** * Internal recursive remove implementation */ private static removeDirectoryRecursive; /** * Create a transaction manager for atomic file operations */ static createTransaction(): FileTransaction; } /** * Transaction manager for atomic file operations * Ensures all operations succeed or all are rolled back */ export declare class FileTransaction { private readonly operations; private completed; private readonly fileOps; constructor(fileOperations?: IFileOperationsService); /** * Add a move operation to the transaction */ addMove(source: string, destination: string): Promise<void>; /** * Add a copy operation to the transaction */ addCopy(source: string, destination: string): Promise<void>; /** * Add a delete operation to the transaction */ addDelete(deletePath: string, backupPath?: string): Promise<void>; /** * Commit the transaction (mark as successful) */ commit(): void; /** * Rollback all operations in reverse order */ rollback(): Promise<void>; /** * Check if any operations have been performed */ hasOperations(): boolean; } //# sourceMappingURL=fileOperations.d.ts.map