/** * run-outcome is the pure verdict layer for a run: it maps a completed run (or * the typed error that halted it) into a CLI-facing view — the lifecycle status * to persist, the process exit code, and the human-facing message. Extracted * from the CLI composition root so the run's most consequential branching (its * halt states) is a directly-tested module rather than untested logic trapped * in main.ts's try/catch. * * Pure (no I/O): the caller owns persistence (writeStatus) and output (write). * `status` is the lifecycle status to persist, or null when the success path * has already persisted it (finalizeIssue does this for a completed run). */ import type { IssueStatus } from "../domain/issue-status.ts"; import type { DoneDecision } from "../domain/done-gate.ts"; /** The CLI-facing view of a run outcome: what to persist, exit with, and print. */ export interface RunOutcomeView { /** Lifecycle status to persist, or null when already persisted (success path). */ status: IssueStatus | null; /** Process exit code. */ exitCode: number; /** Human-facing message to write to stdout. */ message: string; } /** Marker the caller checks: an unrecognized error must propagate unchanged. */ export interface Rethrow { rethrow: true; } export declare function isRethrow(c: RunOutcomeView | Rethrow): c is Rethrow; /** * Classifies a SUCCESSFUL run (runDiablo returned, final verification passed). * The done gate's decision (done vs needs-human) shapes the message; either way * the status was already persisted by finalizeIssue, so `status` is null and the * exit code is 0 (a held done-gate is a clean, expected outcome, not a failure). */ export declare function classifyRunSuccess(noun: string, target: string, decision: DoneDecision, commit: string | undefined): RunOutcomeView; /** * Classifies a run that threw. Each typed halt maps to its (status, exitCode, * message); an unrecognized error returns a Rethrow marker so the caller * propagates it unchanged (a real crash must not be swallowed as needs-human). */ export declare function classifyRunError(err: unknown, noun: string, target: string): RunOutcomeView | Rethrow;