/** * Phase 143 (T1+T2) — the cross-worktree handoff candidate picker. * * Pure menu render + pick resolution (mirrors `start/menu.ts` + * `start/render.ts`'s split), plus an impure TTY prompt for `cadence resume` * when 2+ candidates exist and neither `--pick` nor `--path` named one * directly. * * The prompt takes the caller's already-computed `Interactivity` (from the * shared `resolveInteractivity(env, isTTY)` seam in `gates/interactivity.ts`) * rather than reading `process.stdin.isTTY`/env itself — that keeps this * module fully unit-testable without touching real stdin, and matches how * `gates/approve.ts` consumes the same seam. */ import type { HandoffCandidate } from '@manehorizons/cadence-types'; import type { CommandIO } from '../services/io.js'; import type { Interactivity } from '../gates/interactivity.js'; import { type Prompter } from '../verify/prompter.js'; /** Render the numbered candidate menu as terminal text. */ export declare function renderCandidateMenu(candidates: HandoffCandidate[]): string; /** * Resolve a 1-based pick against the candidate list. `undefined` for any * non-positive/non-integer/out-of-range index — including any pick against * an empty list. */ export declare function resolvePick(candidates: HandoffCandidate[], n: number): HandoffCandidate | undefined; export interface PromptForPickDeps { /** Prompter factory — defaults to a real `StdinPrompter`. Tests inject a * `ScriptedPrompter`-returning factory instead. */ createPrompter?: () => Prompter; } /** * Interactive candidate picker. `interactivity` is the caller's own * `resolveInteractivity(env, isTTY)` result: * - `bypass` — non-TTY (the default off a real terminal): print the * menu and return `null` without ever touching stdin, * so `cadence resume` never hangs waiting on input (AC-7). * - `interactive` / `require-tty` — print the menu, then walk a prompt loop * (mirrors `cli/commands/start.ts`'s `readlinePick`). * A `require-tty` prompter construction failure (real * stdin forced but not actually a TTY) is caught and * reported rather than thrown, so a caller doesn't need * its own try/catch around this function. * Returns the picked candidate, or `null` on an empty list, a bypass, a * prompter-construction failure, or the user quitting (`q`/empty answer). */ export declare function promptForPick(candidates: HandoffCandidate[], interactivity: Interactivity, io: CommandIO, deps?: PromptForPickDeps): Promise; //# sourceMappingURL=pick.d.ts.map