@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.
53 lines • 1.76 kB
TypeScript
/**
* Utility class for efficient file discovery operations
* Provides optimized file search with caching and security
*
* IMPLEMENTATION (PR #503 - PR #496 Recommendation):
* 1. PERFORMANCE: Single readdir operation instead of multiple file checks
* 2. PERFORMANCE: 5-second cache TTL for repeated searches
* 3. SECURITY: Unicode normalization for all search inputs
* 4. MEMORY: Efficient cache management with 100 entry limit
*
* This addresses the PR #496 review recommendation to extract file discovery
* logic to a reusable utility class for better performance and maintainability.
*/
export interface FileSearchOptions {
extensions?: string[];
partialMatch?: boolean;
maxResults?: number;
cacheResults?: boolean;
}
export declare class FileDiscoveryUtil {
private static readonly CACHE_TTL;
private static cache;
/**
* Find files in a directory with optimized search
* Uses single readdir operation and filters results
*/
static findFiles(directory: string, searchName: string, options?: FileSearchOptions): Promise<string[]>;
/**
* Build search patterns for different file extensions
*/
private static buildSearchPatterns;
/**
* Check if filename matches pattern
*/
private static matchesPattern;
/**
* Get cached results if still valid
*/
private static getCached;
/**
* Cache results with timestamp
*/
private static setCached;
/**
* Clear the cache
*/
static clearCache(): void;
/**
* Find a single file (convenience method)
*/
static findFile(directory: string, searchName: string, options?: FileSearchOptions): Promise<string | null>;
}
//# sourceMappingURL=FileDiscoveryUtil.d.ts.map