/** * CLI glue for the `contextatlas generate-adrs` subcommand. * * Wraps the Strategy-pattern Generator dispatch with CLI-specific * concerns: * - Config load + adapter lifecycle + db open (mirrors * `src/extraction/cli-runner.ts` setup phase) * - `--reference-context ` CLI flag wiring into * `GeneratorContext.referenceContextPath` (per Travis Step * 2.2.a.1 Observation 2 interface-level lock) * - Exit-code mapping per ADR-12 (0 success, 1 pipeline failure, * 2 setup error) * * Step 2.2.a.1 ships dispatcher infrastructure against skeleton * generators. `AnthropicAPIDirectGenerator.generate()` throws a * Step-2.2.a.2-pending error after API-key setup-error check. * Step 2.2.a.2 lands substantive generation work; this runner does * not change. */ import type { ExtractionClient } from "../extraction/anthropic-client.js"; import { type Generator } from "./generator.js"; export interface GenerateAdrsCliOptions { configRoot: string; configFile: string | null; contextatlasVersion: string; /** * Git HEAD SHA of the contextatlas binary itself (atlas schema * v1.3+ inheritance). When omitted the runner leaves it null; * Step 2.2.a.2 may wire up `resolveContextatlasCommitSha` if * generated ADRs persist provenance. */ contextatlasCommitSha?: string | null; /** * `--reference-context ` CLI flag value (per Travis * Observation 2 + Step 2.1.a Travis SECOND substantive reframe). * When set, populates `GeneratorContext.referenceContextPath` * for downstream prompt-input handling at Step 2.2.a.2. */ referenceContextPath?: string; /** * `--budget-warn ` CLI flag value, mirrors `index` * subcommand semantics. Optional. */ budgetWarnOverride?: number | null; /** * True when `--yes` / `--no-confirm` CLI flag was passed. Bypasses * the pre-flight cost-estimate confirmation prompt; required for * CI/CD / non-interactive usage per v0.7 Step 2.2.a.2 Lock 3. */ skipConfirmation?: boolean; /** * Test seam — confirmation callback override. When provided, the * runner forwards it via `GeneratorContext.confirmProceed`. Default * (when omitted): generator uses its built-in readline-based stdin * prompt. */ confirmProceed?: () => Promise; /** * Test seam — inject a fake ExtractionClient (Generator * implementations may reuse the same client shape if backed by * @anthropic-ai/sdk; mirrored from extraction cli-runner). */ clientOverride?: ExtractionClient; /** Test seam — replace `process.env` access. */ readEnv?: (name: string) => string | undefined; /** Test seam — replace stdout write. */ writeStdout?: (chunk: string) => void; /** Test seam — replace stderr write. */ writeStderr?: (chunk: string) => void; /** * Test seam — inject a fake Generator instead of resolving via * `getGenerator(config)`. Lets tests exercise the post-generation * validate-adrs gate path (v0.7 Step 2.4.a β-2) without making * real Anthropic API calls. Production callers omit; only tests * supply. */ generatorOverride?: Generator; } export type GenerateAdrsExitCode = 0 | 1 | 2; export interface GenerateAdrsCliResult { exitCode: GenerateAdrsExitCode; } /** * Run the `generate-adrs` subcommand end-to-end. Never throws — all * error paths map to exit codes + error messages logged to stderr. * * Step 2.2.a.1 skeleton: the runner reaches `generator.generate()` * which throws (after API-key setup check). The runner catches + * maps to exit code per ADR-12 discipline. */ export declare function runGenerateAdrsSubcommand(options: GenerateAdrsCliOptions): Promise; //# sourceMappingURL=cli-runner.d.ts.map