import type { Host } from "../host/host.js"; type Rule = { /** Matches the path itself, relative to the directory the .gitignore lives in. */ matchesSelf: (relativePath: string) => boolean; /** Matches a path somewhere under a directory the pattern names. */ matchesUnder: (relativePath: string) => boolean; /** A `!pattern` rule: a match un-ignores instead of ignoring. */ negated: boolean; /** A trailing `/`: the rule names directories only. */ directoriesOnly: boolean; }; /** The rules of one .gitignore file, scoped to the directory holding it. */ export type GitignoreFile = { dir: string; rules: Rule[]; }; export declare function parseGitignore(dir: string, text: string): GitignoreFile; /** The .gitignore files that already apply to `dir` before a walk enters * it: those in its ancestors up to and including the repository root (the * nearest ancestor holding a `.git` entry), outermost first. A search * rooted in a subdirectory would otherwise miss the root file, where * rules like `**\/*.js` usually live. With no repository above `dir`, * nothing applies. */ export declare function readAncestorGitignores(host: Host, dir: string): Promise; /** Whether the .gitignore files above `dir` ignore it or everything in * it. A search rooted at `dir` that respects .gitignore applies those * files to every entry, so where this is true it finds nothing: with * `**\/dist/*` above it, a search of `dist` comes back empty. A rule that * ignores only some entries (`.*`, `*.js`) leaves this false, since the * search still finds the rest. The repository root's own .gitignore is * not "above" a search rooted there. */ export declare function ignoredFromAbove(host: Host, dir: string): Promise; /** `ignoredFromAbove` for Agency code, which has no host to pass. */ export declare function _ignoredFromAbove(dir: string): Promise; /** The directories strictly above `dir`, an absolute path, up to and * including the repository root, outermost first. Null when no ancestor * holds a `.git` entry, and empty when `dir` is itself a repository root: * git never lets an enclosing repository's rules reach inside. */ export declare function repositoryAncestors(host: Host, dir: string): Promise; /** `repositoryAncestors` for Agency code, which has no host to pass. */ export declare function _repositoryAncestors(dir: string): Promise; /** The .gitignore in `dir`, or null when there is none. */ export declare function readGitignore(host: Host, dir: string): Promise; /** * Whether git would ignore `fullPath`, given the .gitignore files on the * path from the walk root down to its parent (outermost first). The last * matching rule wins, and a deeper file's rules come after a shallower * file's, which is how git resolves the same question. */ export declare function isIgnored(fullPath: string, isDirectory: boolean, files: GitignoreFile[]): boolean; export {};