/** * Shared I/O helpers for the ported hula workflow scripts. * * Every ported script preserves the same output contract as its original * `.sh` predecessor: a single structured JSON object on **stdout**, and every * human-readable log / progress line on **stderr**. These helpers make that * split explicit so no script accidentally writes a log line to stdout (which * would corrupt the JSON the calling skill parses). */ /** * Write a single compact JSON object to stdout, terminated by a newline. * Mirrors the `printf '{...}\n'` contract of the original bash scripts. * `JSON.stringify` handles all escaping (quotes, backslashes, control chars), * replacing the hand-rolled `json_escape()` helper. */ export declare function emitJson(obj: Record): void; /** * Write a human-readable log/progress line to stderr (the `>&2` of the bash * scripts). Never use `console.log`/`logger.info` inside a ported script — they * write to stdout and would break the JSON contract. */ export declare function logStderr(msg: string): void; /** * A user- or tool-level error that maps to the JSON error contract * `{"status":"error","code":,"message":"..."}` and a matching process exit * code. Ported from each script's `die()` helper. * - code 1 = user error (bad args, missing resource) * - code 2 = tool error (git/gh/hula subprocess failure) */ export declare class ScriptError extends Error { readonly code: number; constructor(code: number, message: string); } /** * Throw a {@link ScriptError}. Convenience wrapper matching the bash `die`. */ export declare function fail(code: number, message: string): never; /** * Run a ported script body and translate its outcome into the shared contract. * * On success the body is responsible for emitting its own success JSON (so it * controls the exact shape) and `runScript` returns 0. On a thrown * {@link ScriptError} (or any other error) it emits the standard error JSON to * stdout and returns the associated exit code — exactly as the bash `die()` * did. This is the single place the error contract lives. */ export declare function runScript(body: (args: string[]) => Promise, args: string[]): Promise; //# sourceMappingURL=io.d.ts.map