/** * Testable orchestration for `hikoutei adopt`. * * The flow owns presentation and sequencing only: it renders the dry-run * report (human or `--json`), asks for confirmation in adopt mode unless * `--yes`, calls the INJECTABLE runner (the production runner wraps * `createTypedSheetsWithSync()`; tests inject a fake), and maps outcomes to * exit codes. It never imports the sync module graph itself. * * Exit codes: 0 success (a READY dry-run also succeeds), 1 failure (a BLOCKED * dry-run, sync-disabled env, or runner error), 2 argument errors (handled by * the parser, not here). */ import type { AdoptOptions } from "./adoptArgs.js"; import type { HikouteiEntity } from "../sync-engine/api/entity.js"; import type { AdoptSpec, AdoptionEntityReport, TypedSheetsWithSyncResult } from "hikoutei"; /** Machine-readable CLI error prefix, shared with adoptMain.ts. */ export declare const ADOPT_ERROR_PREFIX = "hikoutei-adopt"; /** What the flow asks the runner to execute. */ export interface AdoptRunnerInput { readonly spec: AdoptSpec; readonly dbName: string; readonly env: Readonly>; readonly entities: readonly HikouteiEntity[]; } /** Injectable adoption execution; production wraps the public API factory. */ export type AdoptRunner = (input: AdoptRunnerInput) => Promise; export interface RunAdoptCliInput { readonly options: AdoptOptions; readonly entities: readonly HikouteiEntity[]; readonly runner: AdoptRunner; /** Line/chunk source; `process.stdin` in the real CLI. */ readonly input: AsyncIterable; readonly output: { readonly write: (text: string) => void; }; readonly error: { readonly write: (text: string) => void; }; /** * Releases the shared stdin stream so the CLI process can exit after the * flow settles. The single-chunk confirmation read leaves the shared async * iterator OPEN (`next()` without `return()`), which keeps a Node process * alive forever on an open stdin pipe — the exact bug class the setup CLI * fixed with its finalizer (see test/cli-setup.test.ts subprocess * regression). Production passes `createStdinFinalizer()`; tests may count * invocations instead. */ readonly finalizeStdin?: () => void; } /** Exit code 0: success (a READY dry-run included). */ export declare const ADOPT_SUCCESS_EXIT_CODE = 0; /** Exit code 1: runtime failure or a BLOCKED dry-run. */ export declare const ADOPT_RUNTIME_ERROR_EXIT_CODE = 1; /** * Runs the adopt flow. Never throws: every failure becomes a non-zero exit * code with a machine-readable `hikoutei-adopt::` line on stderr. */ export declare function runAdoptCli(input: RunAdoptCliInput): Promise; /** Renders one entity's dry-run report as aligned human-readable text. */ export declare function renderAdoptionReport(entity: AdoptionEntityReport, ok: boolean): string; //# sourceMappingURL=adoptFlow.d.ts.map