import type { MountView } from '../../../view/types.ts';
import { FileStat, LineFacts, type PathSpec, type StatFn, type ReaddirFn, type ReadStreamFn } from '../../../types.ts';
import type { CommandFnResult, Context } from '../../config.ts';
import { FlagView } from '../../spec/flag_view.ts';
import type { FlagValue } from '../../spec/types.ts';
import { FileTypes } from '../rg_filetypes.ts';
import { IgnoreRules } from '../rg_glob.ts';
import type { DispatchFn } from '../../../runtime/types.ts';
import { type Haystack, WalkFilter } from '../rg_scan.ts';
import { type RgFlags } from '../rg_search.ts';
import { type LinkResolver } from '../utils/links.ts';
export declare const RG_NO_PATTERN = "rg: ripgrep requires at least one pattern to execute a search";
export declare const NOTHING_SEARCHED: string;
/**
 * What rg's scan reads, every value checked as ripgrep 14.1.1 checks it. The
 * separators are byte views, and null where the line asks for none
 * (--no-context-separator) or for ripgrep's own. Mirrors Python's `RgValues`.
 */
export interface RgValues {
    readonly threads: number | null;
    readonly encoding: string;
    readonly dfa_size_limit: number | null;
    readonly regex_size_limit: number | null;
    readonly passthru: boolean;
    readonly context_before: number;
    readonly context_after: number;
    readonly sort: string | null;
    readonly sort_reverse: boolean;
    readonly engine: string;
    readonly max_columns: number | null;
    readonly path_separator: string | null;
    readonly max_count: number | null;
    readonly max_depth: number | null;
    readonly max_filesize: number | null;
    readonly context_separator: string | null;
    readonly field_match_separator: string;
    readonly field_context_separator: string;
}
export type { RgFlags } from '../rg_search.ts';
export declare function filenameFlag(fl: FlagView): string | null;
/**
 * Convert the raw flag bag into RgFlags, the only string-keyed reads.
 * Options that override one another are read in line order, the last one
 * winning as it does in ripgrep: -i/-s/-S, -w/-x, -n/-N, -H/-I, every option
 * and its --no- negation, --hidden/--no-hidden/-uu, the output modes
 * -c/--count-matches/-l/--files-without-match, --heading/--no-heading,
 * --passthru and the context options, --sort/--sortr/--sort-files/
 * --no-sort-files, and --context-separator/--no-context-separator. Every
 * value is read by mirage-rs (`RgValues`), and one ripgrep refuses throws its
 * words. Mirrors Python's `parse_flags`.
 */
export declare function parseFlags(fl: FlagView): RgFlags;
export declare function walkFilter(f: RgFlags, types?: FileTypes, ignores?: IgnoreRules): WalkFilter;
/**
 * --ignore-file's rules, each file read through the dispatcher. A file
 * ripgrep cannot read is reported in `notes` and skipped, the search going on
 * with its exit status untouched (14.1.1); --no-ignore-files drops every one.
 * Mirrors Python's ignore_rules.
 */
export declare function ignoreRules(fl: FlagView, dispatch: DispatchFn | undefined, notes: string[]): Promise<IgnoreRules>;
export declare function filtersFiles(f: RgFlags): boolean;
/**
 * The haystacks in --sort/--sortr order, where that is a global one.
 * Ascending path order is the walk's own (each directory in name order,
 * operands as typed), so only --sortr path and the time keys reorder the
 * whole list. Like ripgrep, a haystack with no timestamp sorts after every
 * one that has one, and ties keep walk order.
 */
export declare function sortHaystacks(found: Haystack[], f: RgFlags): Haystack[];
/**
 * Run ripgrep-style search over backend paths or stdin. Interprets the flags
 * itself (Python `rg` parity), so backend wrappers only wire paths, texts,
 * the bag, and backend I/O. An empty `paths` searches stdin as an implicit
 * `-`. `unbounded` is the walk to take when no `--max-depth` bounds it (one
 * the mount answers whole), else `readdir` and `stat`.
 */
export declare function rgGeneric(paths: PathSpec[], texts: string[], ctx: Context, stat: StatFn, readdir: ReaddirFn, stream: ReadStreamFn, unbounded?: [ReaddirFn, StatFn]): Promise<CommandFnResult>;
export declare function jsonSummary(f: RgFlags): boolean;
export declare function headed(f: RgFlags): boolean;
export declare function runsParallel(f: RgFlags): boolean;
export declare function printedPath(path: string, f: RgFlags): string;
export declare function betweenFiles(f: RgFlags): string;
export declare function haystacks(paths: readonly PathSpec[], rd: (path: string) => Promise<string[]>, st: (path: string) => Promise<FileStat>, cwd: string, walk: WalkFilter, f: RgFlags, warnings: string[], boundary: MountView | null, resolver: LinkResolver | null, stopped: ReadonlySet<string>): AsyncGenerator<Haystack>;
export declare function labelFlags(bag: Record<string, FlagValue>): Record<string, FlagValue>;
/**
 * An rg line reads below every path it names, and walks into the mounts
 * below them unless it lists its types (`--type-list`, which reads no path)
 * or keeps to one filesystem. Mirrors Python's `facts`.
 */
export declare function facts(fl: FlagView, _operands: readonly (string | PathSpec)[]): LineFacts;
//# sourceMappingURL=rg.d.ts.map