/**
 * Gitignore support for workspace tools.
 *
 * Applies every `.gitignore` relative to the directory that holds it, the way
 * git does, so a multi-repo workspace root without its own `.gitignore` still
 * honors each repository's rules. `node_modules` is skipped by default.
 */
import type { FileEntry, WorkspaceFilesystem } from './filesystem/index.js';
export type IgnoreFilter = (relativePath: string) => boolean;
export interface WorkspaceIgnore {
    /** Whether `path` (in the same form the caller walks with) should be skipped. */
    ignores(path: string, isDirectory: boolean): boolean;
    /**
     * Read the `.gitignore` of each listed directory that has one, so its rules
     * apply to everything below it. Call with a directory's listing before
     * filtering its children.
     */
    addListings(listings: Array<[directory: string, entries: readonly Pick<FileEntry, 'name' | 'type'>[] | undefined]>): Promise<void>;
    /**
     * Read the `.gitignore` of every directory between the target and each of
     * `filePaths`, for results that didn't come from a walk (native grep).
     * Directories already ignored are not read into.
     */
    addParentsOf(filePaths: readonly string[]): Promise<void>;
}
export interface LoadWorkspaceIgnoreOptions {
    /** Apply `.gitignore` files (default: true). `node_modules` is skipped either way. */
    gitignore?: boolean;
    /**
     * The path the caller asked for, when it differs from `target` (e.g. a glob
     * whose static base is `target`). `node_modules` is not skipped when it
     * points inside one.
     */
    requestedPath?: string;
}
/**
 * Load ignore rules for a walk rooted at `target`: the workspace root's
 * `.gitignore` plus those of `target`'s ancestors. The walk adds nested ones
 * with {@link WorkspaceIgnore.addListings}.
 *
 * When `target` is itself ignored (e.g. `dist` or `node_modules/x`), nothing
 * below it is filtered, so callers can still look inside on purpose.
 * Missing nested `.gitignore` files are skipped, and so are unreadable ones;
 * an unreadable root `.gitignore` throws.
 */
export declare function loadWorkspaceIgnore(filesystem: WorkspaceFilesystem, target: string, options?: LoadWorkspaceIgnoreOptions): Promise<WorkspaceIgnore>;
//# sourceMappingURL=gitignore.d.ts.map