@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.
35 lines • 1.54 kB
TypeScript
export type FileChangeHandler = (relativePath: string) => void;
/**
* Thin wrapper over fs.watch that fan-outs change events to interested managers.
*
* This service is managed as a singleton by the DI container.
* Inject it via constructor injection rather than using a static getInstance() method.
*/
export declare class FileWatchService {
private readonly watchers;
private readonly debounceTimers;
/**
* Watch a directory for changes. If the directory doesn't exist, it will be created.
*
* @param dirPath - Path to directory to watch
* @param handler - Callback function invoked when files change
* @returns Cleanup function to stop watching
*
* @remarks
* This method ensures the directory exists before setting up the watcher.
* fs.watch throws ENOENT if the directory doesn't exist, so we create it
* with recursive:true to handle test scenarios and edge cases gracefully.
*
* File watching is optional functionality. If fs.watch() fails due to permission
* restrictions or platform limitations, a no-op cleanup function is returned and
* the application continues without file watching for that directory.
*/
watchDirectory(dirPath: string, handler: FileChangeHandler): () => void;
private detachHandler;
/**
* Dispose of all file watchers. Called during graceful shutdown.
* This method is invoked by the DI container's dispose() method.
*/
dispose(): void;
}
//# sourceMappingURL=FileWatchService.d.ts.map