/** * hashline-core.ts — binary discovery + subprocess glue for the hashline CLI. * * This package is a THIN WRAPPER: it never reimplements hashing, staleness * detection, or merge recovery. The hashline Rust binary (`crates/core`, * v0.9.1) is the single source of truth for hashes and edit validation. * Everything here is pure subprocess plumbing: resolve the binary, spawn it, * and parse its stdout/JSON payloads. * * CLI contract pinned by `integration/CONTRACT.md` and the golden fixtures * in `integration/fixtures/`. If the contract shape changes, bump * `MIN_HASHLINE_VERSION`. */ /** Minimum hashline binary version this package is compatible with. */ export declare const MIN_HASHLINE_VERSION = "0.9.12"; /** Result of a spawned hashline invocation. */ export interface HashlineRunResult { stdout: string; stderr: string; exitCode: number; } /** Minimal child-process shape the seam exposes (a subset of child_process.ChildProcess). */ export interface SpawnSeamChild { stdout: NodeJS.ReadableStream | null; stderr: NodeJS.ReadableStream | null; stdin: NodeJS.WritableStream | null; on: (event: string, cb: (...args: unknown[]) => void) => void; kill?: (signal?: NodeJS.Signals | number) => void; } /** * Injectable spawn seam. Defaults to `child_process.spawn`; tests inject a * fake (or set HASHLINE_BIN to a fixture stub binary). */ export type SpawnFn = (cmd: string, args: string[], options: { cwd?: string; env?: NodeJS.ProcessEnv; }) => SpawnSeamChild; /** Test-only: inject a fake spawn implementation. */ export declare function setSpawnForTests(fn: SpawnFn | null): void; /** * Spawn the hashline binary with `args`, optionally writing `stdinText` to * stdin (the `patch -` envelope form), and drain stdout+stderr to EOF. * Resolves with the captured streams and exit code. Rejects only when the * binary could not be spawned at all (e.g. ENOENT — binary not on PATH). */ export declare function runHashline(args: string[], stdinText?: string, signal?: AbortSignal, opts?: { cwd?: string; env?: NodeJS.ProcessEnv; hashlineBin?: string; }): Promise; /** Resolve the hashline binary: HASHLINE_BIN env → PATH → Windows probes. */ export declare function resolveHashlineBin(): string; /** * Probe `hashline --version` and return the full version banner (e.g. * `hashline 0.9.1`), or null when the binary is missing/unparseable. Never * throws — callers degrade to a warning. */ export declare function probeHashlineVersion(opts?: { signal?: AbortSignal; }): Promise; /** `read --json` payload. `n` is 1-based; no phantom trailing line. */ export interface ReadLine { n: number; hash: string; content: string; } export interface ReadResult { path: string; hash: string; lines: ReadLine[]; } export declare function parseReadJson(raw: string): ReadResult; /** `patch --json` success payload. Lines use key `line` and include a phantom trailing empty line when the file ends with `\n`. */ export interface PatchLine { line: number; hash: string; content: string; } export interface PatchSuccessResult { success: boolean; file: string; edits_applied: number; lines: PatchLine[]; } /** `patch --json --dry-run` payload. */ export interface PatchDryRunResult { success: boolean; file: string; dry_run: true; edits_applied: number; diff: string[]; } /** Binary's structured error payload (stderr, `--json` mode). */ export interface ErrorPayload { kind: string; error: string; hint?: string; command?: string | null; } export declare function parseErrorPayload(stderr: string): ErrorPayload | null; //# sourceMappingURL=hashline-core.d.ts.map