type PathModule = typeof import('path'); type FsModule = typeof import('fs'); type OsModule = typeof import('os'); /** * Load Node.js modules asynchronously using dynamic import(). * Must be called before using getNodeModules(). * Safe to call multiple times (subsequent calls are no-ops). */ export declare function loadNodeModules(): Promise; /** * Inject mock modules for testing. Only use in test environments. * @internal */ export declare function _injectModulesForTesting(mocks: { path?: PathModule; fs?: FsModule; os?: OsModule; }): void; /** * Reset injected modules. Only use in test environments. * @internal */ export declare function _resetModulesForTesting(): void; /** * Information about a file or directory */ export interface FileInfo { /** File or directory name */ name: string; /** Full absolute path */ absolutePath: string; /** Path relative to base path */ relativePath: string; /** Whether this is a directory */ isDirectory: boolean; /** Last modification time */ modTime: Date; } /** * Formatted file search result for display */ export interface FileSearchResult { /** Display string (with trailing slash for directories) */ display: string; /** Absolute path value */ value: string; /** Description (relative path) */ description?: string; } /** * Configuration for the file search engine */ export interface FileSearchEngineConfig { /** Base path for searches (default: current directory) */ basePath?: string; /** Optional file filter pattern */ filter?: string; /** Cache timeout in milliseconds (default: 5000) */ cacheTimeout?: number; /** Maximum cache entries before eviction (default: 100) */ maxCacheEntries?: number; } /** * File search engine with fuzzy matching and caching. * Provides real-time directory navigation and file selection. * * Note: This class is only available in Node.js environments. * It will throw an error if instantiated in a browser. */ export declare class FileSearchEngine { private basePath; private filter?; private cache; private cacheTimeout; private cacheTimestamps; private maxCacheEntries; /** * Create a FileSearchEngine instance, loading Node.js modules first. * This is the preferred way to create a FileSearchEngine in ESM contexts. */ static create(config?: FileSearchEngineConfig): Promise; constructor(config?: FileSearchEngineConfig); /** * Search for files matching the query. * Supports directory navigation and fuzzy matching. * * @param query - Search query (can include path components) * @param signal - Optional AbortSignal to cancel the search * @returns Array of matching files */ search(query: string, signal?: AbortSignal): Promise; /** * List all files in a directory. * * @param dirPath - Directory path to list * @returns Array of files in the directory */ listDirectory(dirPath: string): Promise; /** * Parse a search query into path and search term components. * * @param query - The search query * @returns Object with searchPath and searchTerm */ parseSearchQuery(query: string): { searchPath: string; searchTerm: string; }; /** * Normalize a path input, handling home directory and separators. * * @param input - The input path * @returns Normalized path */ normalizePathInput(input: string): string; /** * Resolve an input path to an absolute path. * * @param input - The input path * @returns Absolute path */ resolveToAbsolutePath(input: string): string; /** * Format a FileInfo object for display. * * @param fileInfo - The file info to format * @returns Formatted search result */ formatFileInfo(fileInfo: FileInfo): FileSearchResult; /** * Check if the filesystem is case-sensitive. * * @returns true if case-sensitive (Linux), false otherwise (macOS, Windows) */ isFileSystemCaseSensitive(): boolean; /** * Clear the directory cache. */ clearCache(): void; /** * Get the current base path. */ getBasePath(): string; /** * Set a new base path. * * @param basePath - New base path */ setBasePath(basePath: string): void; private getCandidatePaths; private matchesFilter; private filterAndSort; /** * Sort results with directories first, then alphabetically. */ private sortResults; /** * Simple fuzzy matching - checks if all characters in pattern * appear in str in the same order. */ private fuzzyMatch; private getFromCache; private addToCache; } /** * Create a new FileSearchEngine instance, loading Node.js modules first. * * @param config - Configuration options * @returns Promise resolving to FileSearchEngine instance */ export declare function createFileSearchEngine(config?: FileSearchEngineConfig): Promise; export {}; //# sourceMappingURL=file-search-engine.d.ts.map