/** * Async installer abstraction. Defaults to real npm; tests inject a fake. * Both args are positional for clarity. */ export type CliInstaller = (npmPackage: string, version: string, prefix: string) => Promise; export interface CliDependencySpec { npm: string; version: string; } export interface CliInstallOpts { /** Baseline-image commands (already on PATH); skip install if present. */ baselineCommands: ReadonlySet; /** Override installer (for tests). Defaults to `npmInstall`. */ installer?: CliInstaller; } export interface CliInstallResult { installed: string[]; /** name = the cliDependencies key (e.g. "bi"), NOT the npm package name. */ failed: Array<{ name: string; reason: string; }>; } /** * Real npm installer — runs `npm install --prefix @`. * `prefix` controls where node_modules lives; `.bin` symlinks are placed under * `/node_modules/.bin`. * * MED-12: Touch `/package.json` first so npm 9+ doesn't auto-create * one and emit a noisy warning (or race with concurrent installs). The file * is minimal — name + private:true — and is harmless if already present. */ export declare const npmInstall: CliInstaller; /** * Install npm-based CLI dependencies serially under `cliRoot`. * * Idempotency: each CLI gets a marker `/.installed--` * after successful install. Subsequent calls skip the install when marker is * present (baseline guard runs first — if `name` is in baselineCommands set, * skip without writing a marker). * * Serial: must NOT run installs in parallel — concurrent npm install under * the same prefix races on node_modules/.package-lock.json (spec R18). * * Compensation: on installer failure, the marker is NOT written. Subsequent * calls will retry. Failed list returned to caller for surfacing in logs. * * @param cliRoot absolute path; typically `${HOME}/.optima/cli/` (per-user EFS via init_user symlink) * @param deps keyed by cliDependencies entry name (NOT npm package name) */ export declare function installCliDependencies(cliRoot: string, deps: Record, opts: CliInstallOpts): Promise; //# sourceMappingURL=cli-installer.d.ts.map