/** * File discovery utilities for markdown sources. * * Provides secure file discovery with path validation * to prevent path traversal attacks. */ export interface DiscoveryOptions { /** File patterns to include (default: **\/*.md) */ include?: string[]; /** File patterns to exclude */ exclude?: string[]; /** Also include .mdx files (default: true) */ includeMdx?: boolean; /** Whether to follow symlinks (default: false for security) */ followSymlinks?: boolean; } export interface ValidatePathOptions { /** Whether to follow and validate symlinks (default: false) */ followSymlinks?: boolean; } /** * Security: Validate that a path is within the expected base directory. * * Prevents path traversal attacks (e.g., ../../etc/passwd). * When followSymlinks is false (default), symlinks pointing outside * the base directory are rejected for security. * * @param basePath - The trusted base directory * @param targetPath - The path to validate * @param options - Validation options * @returns The resolved absolute path if valid * @throws Error if path traversal is detected or symlink points outside base */ export declare function validatePath(basePath: string, targetPath: string, options?: ValidatePathOptions): string; /** * Find all markdown files in a directory recursively. * * @param dir - Base directory to search (used for path validation) * @param options - Discovery options * @returns Array of absolute file paths */ export declare function findMarkdownFiles(dir: string, options?: DiscoveryOptions): string[]; /** * Get the relative path from a base directory. */ export declare function getRelativePath(basePath: string, filePath: string): string; /** * Convert file path to URL path. * * Removes file extension and index files, converts to URL format. * * @param filePath - Relative file path * @returns URL-friendly path */ export declare function filePathToUrlPath(filePath: string): string; //# sourceMappingURL=discovery.d.ts.map