/** * Neutral helpers shared across every CLI task family. Anything * deploy-specific belongs in `src/deploy/tasks/shared.ts`; anything * serialization-specific belongs in `src/serialization/tasks/shared.ts`. */ import type { RootConfiguration } from "../config/types.js"; import { Logger } from "../shared/logger.js"; import type { CommonOptions } from "./cli-options.js"; export declare const toLogger: (options: CommonOptions) => Logger; export declare const applyIfDefined: (target: T, key: keyof T, value: T[keyof T] | undefined) => void; export declare const inputError: (message: string, hint?: string) => Error; export declare const confirmDestructive: (message: string, force?: boolean) => Promise; export declare const selectMatch: (list: T[], label: string, selection?: string) => T; export declare const selectFromList: (logger: Logger, label: string, list: T[]) => Promise; export declare const resolveApiTimeoutMs: (root: RootConfiguration) => number | undefined; /** * `Promise.all`-style fan-out, but with a concurrency cap. Use this when * mapping over an unbounded list (recipe files, environment fetches, * etc.) where `Promise.all(items.map(fn))` would race N parallel * I/O calls — fine for small N, a footgun for workspaces with hundreds * of items. Order of the returned array matches the input order. * * Defaults to 8: enough to saturate the file-system on a normal laptop, * conservative enough not to thrash a slow disk or thunder-herd a remote * API. Pass a lower limit when each task hits the same upstream. */ export declare const mapWithConcurrency: (items: readonly T[], fn: (item: T, index: number) => Promise, concurrency?: number) => Promise;