/** * Production wiring for `hikoutei infer`. * * Owns the real-world dependencies the pure core avoids: resolving the * spreadsheet id and credentials, reading one tab range through the Sheets * API (read-only — no writes, no provisioning), and mapping outcomes to * exit codes. Tests drive `runInferCli` with a fake reader and never touch * the network or credentials. * * Exit codes: 0 success, 1 runtime failure (tab not found, empty tab, * missing credentials, read failure), 2 argument errors. */ import { type InferOptions } from "./inferArgs.js"; import { type InferTabGrid, type InferTabReader } from "./infer.js"; export interface RunInferCliInput { readonly options: InferOptions; readonly env: Readonly>; readonly reader: InferTabReader; readonly output: { readonly write: (text: string) => void; }; readonly error: { readonly write: (text: string) => void; }; } /** * Runs the infer flow. Never throws: every failure becomes a non-zero exit * code with a machine-readable `hikoutei-infer::` line on stderr. */ export declare function runInferCli(input: RunInferCliInput): Promise; /** * Writes the descriptor-file JSON text to `path`. * * Parent directories are never created: a missing parent fails with * `emit_parent_missing`. An existing file is left untouched unless `force` * is set (`emit_exists` otherwise). Throws `InferError` with a stable code * so the flow maps it to the machine-readable stderr line; the path itself * is never echoed (it may embed user directory layout). */ export declare function emitDescriptorFile(path: string, json: string, options: { readonly force: boolean; }): Promise; /** * Extracts the spreadsheet ID from a Google Sheets URL. * * Accepts `/spreadsheets/d/` and a top-level `/d/` right after the * host (with query/fragment/trailing suffixes tolerated); anything deeper * (e.g. `/document/d/`) is rejected. Mirrors the sync engine's * `parseSpreadsheetIdFromUrl` without importing its module graph. */ export declare function parseInferSpreadsheetId(url: string): string | undefined; /** * Validates the raw `spreadsheets.get` grid payload for one tab. * * Untrusted SDK data: the response must list the requested tab and carry * grid rows; a tab without a header row is `empty_tab`. Throws `InferError` * (`tab_not_found`, `empty_tab`, `malformed_grid`); never echoes payloads. */ export declare function extractInferGrid(data: unknown, tabName: string, limit: number): InferTabGrid; /** * Runs the `hikoutei infer` CLI with the given argument vector (without the * leading "infer" subcommand). Exported so the bin router can delegate and * tests can drive it with injected argv. */ export declare function runInferMain(argv: readonly string[]): Promise; //# sourceMappingURL=inferMain.d.ts.map