/** * Pure command-line parsing for `hikoutei adopt`. * * This module owns flag syntax and defaults only; it never touches the * filesystem, imports user modules, or contacts Google Sheets. The result is * an explicit union so the CLI entry can branch on help / valid / invalid * without inspecting message text. * * Adoption (MVP, design `design/existing-sheet-adoption-design.md`): one * entity at a time; the adopted tab becomes that entity's User_Input route. * The entity definitions are the APPLICATION's — the CLI loads them from a * module (`--entities`) that registers them as an import side effect. */ import { type SetupFailure } from "./errors.js"; /** One entity's spec parsed from a single repeatable `--adopt` flag. */ export interface AdoptCliEntitySpec { /** Entity name to adopt (must match a registered descriptor name). */ readonly entityName: string; /** The existing spreadsheet tab that becomes the User_Input route. */ readonly tabName: string; /** §12 columnMap: sheet header → property bindings (from inline `;Header=prop` pairs). */ readonly columnMap?: Readonly>; } /** Parsed and defaulted adoption options handed to the adopt flow. */ export interface AdoptOptions { /** * Multi-entity adoption from repeated `--adopt` flags (mutually exclusive * with the legacy single `--entity`/`--tab` path). When present, the legacy * `entityName`/`tabName`/`columnMap` fields are absent. */ readonly adopts?: readonly AdoptCliEntitySpec[]; /** * Descriptor-file path (`--descriptor`), an alternative to `--entity` for * the legacy single-entity path. The entity name and the header→property * columnMap come from the file; the CLI registers the file through the * same `defineTypedSheetsEntity` builder adopt requires. Mutually * exclusive with `--entity` and `--adopt`. */ readonly descriptorPath?: string; /** Entity name to adopt (legacy single-entity path; absent with `--adopt`). */ readonly entityName?: string; /** The existing spreadsheet tab that becomes the User_Input route. */ readonly tabName?: string; /** PK source: a sheet header, or `"auto"` (default). */ readonly identityFrom: string | "auto"; /** Fresh System_State tab name; default `_System`. */ readonly systemTabName?: string; /** Fresh Sync_Conflicts tab name; default `_Conflicts`. */ readonly conflictsTabName?: string; /** `dry-run` (default) analyzes read-only; `adopt` performs the migration. */ readonly mode: "dry-run" | "adopt"; /** SQLite database path (default `./hikoutei.sqlite`). */ readonly db: string; /** Spreadsheet URL; falls back to `HIKOUTEI_SYNC_SPREADSHEET_URL`. */ readonly spreadsheetUrl?: string; /** Service-account key file; falls back to `GOOGLE_APPLICATION_CREDENTIALS`. */ readonly credentialsPath?: string; /** Module that registers the application entities on import. */ readonly entitiesModule?: string; /** §12 columnMap: sheet header → property bindings (from repeated --map). */ readonly columnMap?: Readonly>; /** Skip the interactive confirmation in adopt mode. */ readonly yes: boolean; /** Emit machine-readable JSON instead of a human report. */ readonly json: boolean; } /** Discriminated result of `parseAdoptArgs`. */ export type AdoptArgsParseResult = { readonly status: "help"; readonly helpText: string; } | { readonly status: "valid"; readonly options: AdoptOptions; } | { readonly status: "invalid"; readonly failure: SetupFailure; }; export declare const ADOPT_HELP_TEXT: string; /** Parses and defaults `hikoutei adopt` arguments. */ export declare function parseAdoptArgs(argv: readonly string[]): AdoptArgsParseResult; //# sourceMappingURL=adoptArgs.d.ts.map