UNPKG

docfs

Version:

MCP server for accessing local file system content with intelligent search and listing tools

38 lines 1.52 kB
/** * Filesystem utilities for safe file operations within allowed directories */ import type { Ignore } from 'ignore'; import type { FileInfo, ListFilesOptions, SearchResult, SearchFilesOptions, DirTreeNode } from '../types/index.js'; /** * Validates if a path is within the allowed root directories */ export declare function validatePathAccess(targetPath: string, allowedRoots: string[]): string; /** * Checks if a file or directory exists */ export declare function pathExists(path: string): Promise<boolean>; /** * Gets file information with error handling */ export declare function getFileInfo(path: string): Promise<FileInfo>; export declare function clearFileInfoCache(): void; /** * Lists files in a directory with filtering options */ export declare function listFiles(rootPath: string, options?: ListFilesOptions): Promise<FileInfo[]>; /** * Builds a nested directory tree structure */ export declare function getDirectoryTree(rootPath: string, options?: { maxDepth?: number; includeHidden?: boolean; }, currentDepth?: number, matcher?: Ignore, basePath?: string): Promise<DirTreeNode>; /** * Searches for text content within files */ export declare function searchInFiles(rootPaths: string[], options: SearchFilesOptions): Promise<SearchResult[]>; /** * Reads file content with optional line range */ export declare function readFileContent(filePath: string, startLine?: number, endLine?: number, encoding?: BufferEncoding): Promise<string>; //# sourceMappingURL=filesystem.d.ts.map