import { type ResolveShellOpts, type ShellResolution } from "@kenkaiiii/gg-engine/internal/core/shell.js"; import { type VerifyCommand } from "@kenkaiiii/gg-engine/internal/core/verify-commands.js"; export declare const CHECK_TIMEOUT_MS: number; export declare const CHECK_TAIL_BYTES: number; /** A check, run in `dir` (relative to the root, forward slashes) when it belongs to a subproject. */ export interface FixCheck extends VerifyCommand { readonly dir?: string; } /** The command as shown and reported: where it runs, when that isn't the root. */ export declare const checkLabel: (c: FixCheck) => string; /** * The project's checks: the root's, then each subproject's (a tracked manifest in a subfolder) for * the languages nothing above it checks yet. A package.json outside the root's workspace is a * project of its own: the root's JavaScript checks don't reach it, so it runs its own. * Throws a FixAllGuardError when there are none at all. */ export declare function resolveFixChecks(cwd: string): Promise; /** * What a fresh worktree runs before its first checks: the root's setup (`.gg/worktree.json`, else * its lockfile's install), then the install of each subproject with checks and a lockfile of its * own. Each runs like a check (label `setup`), in its folder. */ export declare function resolveSetupSteps(root: string, checks: readonly FixCheck[]): Promise; /** The build a folder's checks may need first (its `build` script), run like a check, or null. */ export declare function resolveBuildStep(root: string, dir?: string): FixCheck | null; /** * Whether the checks run on every one of these files: a source file needs a check for its language * in its folder or above; any other file, any check there. */ export declare function fixChecksCover(checks: readonly FixCheck[], files: readonly string[]): boolean; /** What the uncovered files are, for the user: "Swift", "Swift and Kotlin". */ export declare function uncheckedKinds(checks: readonly FixCheck[], files: readonly string[]): string; /** * The checks for one fix: in a pnpm or npm workspace whose root typecheck and test scripts just run * every package's own, those two run only in the packages the fix changed plus every package that * depends on them (directly or not). Lint and format run as they are. Anything else (a change * outside every package, a root script doing more, other tools) keeps the full checks. */ export declare function scopeFixChecks(root: string, commands: readonly FixCheck[], changed: readonly string[]): FixCheck[]; export type CheckResult = { readonly ok: true; } | { readonly ok: false; readonly command: string; /** The last of its output, colour codes removed. */ readonly tail: string; readonly timedOut: boolean; readonly aborted: boolean; }; export interface RunChecksOptions { readonly timeoutMs?: number; readonly signal?: AbortSignal; /** Told before each command starts: its place in the list, and the command. */ readonly onCommand?: (index: number, command: VerifyCommand) => void; readonly shell?: ResolveShellOpts; } /** The executable and args one check runs as (Git Bash, bash, or the `cmd` fallback on Windows). */ export declare function checkSpawn(command: string, opts?: ResolveShellOpts): ShellResolution; /** The last `max` bytes of `text`, starting on a whole line where it can. */ export declare function outputTail(text: string, max?: number): string; /** Run each check in order; the first failure ends it. */ export declare function runFixChecks(cwd: string, commands: readonly FixCheck[], opts?: RunChecksOptions): Promise;