export type FormatMode = 'check' | 'write'; export interface FormatTargets { /** Paths relative to the working directory, as `git ls-files` emits them. */ files: string[]; /** Absolute paths to every `.prettierignore` governing the repository, root-most first. */ ignorePaths: string[]; } export type ResolveTargetsResult = { ok: true; targets: FormatTargets; } | { ok: false; error: string; }; /** * Formats or checks the files git reports for `cwd`, and returns the exit code to report. * * Trailing arguments are git pathspecs, not Prettier flags; an unrecognized option is rejected rather * than passed along, since git would read it as a pathspec matching nothing and the run would report * success over an empty selection. */ export declare function runFmt(argv: string[], cwd?: string): number; /** * Resolves what Prettier should format and which ignore files govern it, using git rather than Prettier's * own discovery. Prettier reads `.gitignore` and `.prettierignore` from the working directory only, so a * pattern in `packages//.gitignore` is invisible to a root-level run; git knows the whole hierarchy, * along with `.git/info/exclude` and `core.excludesFile`, which Prettier cannot read under any flag. * * File selection is anchored at `cwd` and ignore discovery at the repository root. That split is the point: * scoping still follows where the caller stands, while the rules applied to a given file no longer do. * * `pathspecs` narrow the selection and are passed to git verbatim, so they carry git pathspec semantics * rather than shell glob semantics. */ export declare function resolveFormatTargets(cwd: string, pathspecs?: string[]): ResolveTargetsResult; /** @internal */ export interface RunPrettierOptions { cliPath: string; mode: FormatMode; files: string[]; ignorePaths: string[]; cwd: string; /** Overridable so the multi-batch path is reachable without a fixture that hits the real ceiling. */ budgetBytes?: number; } /** * Runs Prettier over the selection, returning the first non-zero exit code. Every batch runs even after * one fails, so a check reports every offending file rather than only those in the first batch. * * The CLI runs under this process's own Node rather than through its shebang, so it does not depend on * the file's execute bit or on PATH holding a `node`. * * @internal */ export declare function runPrettier(options: RunPrettierOptions): number;