/** * File walker utilities for Scampi codebase mapping * * Provides recursive directory walking with extension filtering, * directory exclusion, and graceful error handling. */ /** * Metadata for a discovered file */ export interface FileInfo { /** Absolute path to the file */ path: string; /** File size in bytes */ size: number; /** Last modification time as Unix timestamp (milliseconds) */ mtime: number; } /** * Default file extensions to include in walks * Covers common source code file types */ export declare const DEFAULT_EXTENSIONS: readonly string[]; /** * Default directories to ignore during walks * Includes dependency folders, build outputs, and VCS directories */ export declare const DEFAULT_IGNORE_DIRS: readonly string[]; /** * Options for the walkDirectory function */ export interface WalkOptions { /** * File extensions to include (with leading dot) * @default DEFAULT_EXTENSIONS */ extensions?: readonly string[]; /** * Directory names to ignore * @default DEFAULT_IGNORE_DIRS */ ignoreDirs?: readonly string[]; /** * Maximum depth to recurse (-1 for unlimited) * @default -1 */ maxDepth?: number; /** * Follow symbolic links * @default false */ followSymlinks?: boolean; /** * Maximum file size in bytes to include (0 for no limit) * @default 0 */ maxFileSize?: number; /** * Callback for permission/access errors * If not provided, errors are silently skipped */ onError?: (error: Error, path: string) => void; } /** * Recursively walk a directory and return matching files * * @param dir - Directory path to walk * @param options - Walk configuration options * @returns Array of FileInfo objects for matching files * * @example * ```ts * const files = await walkDirectory('./src'); * console.log(files); * // [ * // { path: '/abs/path/src/index.ts', size: 1234, mtime: 1706500000000 }, * // { path: '/abs/path/src/utils/helpers.ts', size: 567, mtime: 1706499000000 } * // ] * ``` * * @example * ```ts * // Custom options * const files = await walkDirectory('./project', { * extensions: ['.ts', '.js'], * ignoreDirs: ['node_modules', 'dist', 'test'], * maxDepth: 3, * maxFileSize: 1024 * 1024, // 1MB * onError: (err, path) => console.warn(`Skipping ${path}: ${err.message}`) * }); * ``` */ export declare function walkDirectory(dir: string, options?: WalkOptions): Promise; /** * Synchronous version of walkDirectory * * @param dir - Directory path to walk * @param options - Walk configuration options * @returns Array of FileInfo objects for matching files */ export declare function walkDirectorySync(dir: string, options?: WalkOptions): FileInfo[]; //# sourceMappingURL=files.d.ts.map