/** * Run a program without a shell: arguments are an array, so branch names, messages and paths never * need quoting and cannot inject anything. Never throws: a failure is a non-zero `code`. * * Programs run with no way to ask you anything. A child that keeps pi's controlling terminal can * open /dev/tty and draw an ssh passphrase, credential or gpg prompt over pi's screen, then wait * for a key pi will never forward. So on POSIX the child gets its own session (no controlling * terminal), git is told not to prompt, and a prompt fails at once with a message instead of * hanging until the timeout. stdin stays a pipe, so `commit -F -` and `gh --body-file -` work. */ export interface RunResult { code: number; stdout: string; stderr: string; } export interface RunOptions { timeoutMs?: number; /** Written to the program's stdin. */ input?: string; env?: Record; } /** Exit code reported when the program had to be stopped for running too long (as timeout(1) does). */ export declare const TIMED_OUT = 124; export declare function run(cmd: string, args: string[], cwd: string, opts?: RunOptions): Promise; /** * Flags for a git diff whose output is parsed or sent to the model: no colour, no external diff * program, and a/ b/ prefixes whatever diff.noprefix or diff.mnemonicPrefix says. */ export declare const PLAIN_DIFF: string[]; export declare const git: (cwd: string, args: string[], opts?: RunOptions) => Promise; /** stdout of a git command, trimmed; undefined when it failed. */ export declare function gitOut(cwd: string, args: string[]): Promise; /** * The useful part of a failed command, for a notification. Output from git, hooks and gh is * cleaned of escape sequences first, so it cannot move the cursor or retitle the window, and a * failure that reads like a missing sign-in gets a one-line hint. */ export declare function failure(r: RunResult, max?: number): string;