/** * fit command — run fitness checks. * * Thin orchestrator. `executeFit` sequences the five extracted phases: * 1. {@link ensureChecksLoaded} — plugin + check-pack discovery * 2. {@link loadFitConfig} — opensip-cli.config.yml parse * 3. {@link selectRecipe} — recipe-name lookup vs. ad-hoc * 4. {@link validateLanguagesAgainstAdapters} — warn on unknown languages * 5. {@link runRecipeOrAdHoc} — drive FitnessRecipeService * * Each phase lives in a sibling module under `./fit/`: * - `fit/check-loader.ts` — discovery + lifecycle singletons * - `fit/display-registry.ts` — merged check display map * - `fit/config-loader.ts` — config parse + language validation * - `fit/recipe-selector.ts` — recipe-pick + run * - `fit/result-builders.ts` — SignalEnvelope / RunPresentation / session persist * * This file re-exports the public surface (`executeFit`, * `ensureChecksLoaded`, and the display accessors) so existing consumers * (`opensip-cli`, `report-data.ts`, the fitness `index.ts` barrel) keep * resolving the same names. */ import type { FitOptions, SignalEnvelope, RunPresentation, ErrorResult } from '@opensip-cli/contracts'; export { ensureChecksLoaded, getEnabledCheckCount, getLoadWarnings, getPluginLoadErrors, } from './fit/check-loader.js'; export { getDisplayName, getIcon } from './fit/display-registry.js'; /** * Optional dependencies threaded through `executeFit`. Both fields are * optional so test harnesses and the JSON/gate paths can call * `executeFit(args)` exactly as before. * * - `onProgress` — wired to `FitnessRecipeService` callbacks; FitView * drives the live progress bar from this callback. * * Persistence is NOT done here (ADR-0028): the engine is worker-safe — it returns * the envelope + result and the host persists. The datastore handle cannot cross * the worker boundary. The fit modes (json / non-TTY live / gate) RETURN a * `ToolSessionContribution` and the host run plane writes the generic session row * after the handler resolves (host-owned-run-timing Phase 3); the TTY live runner * returns its contribution to the host via `renderLive`. */ export interface ExecuteFitOptions { onProgress?: (completed: number, total: number) => void; } /** * Run a fitness session end-to-end. Sequences the phase helpers in this * package in a fixed order: * * 1. `ensureChecksLoaded` — loads check packs and fit-domain plugins * (must run first; populates the scope's check + recipe registries * for downstream phases). * 2. `loadFitConfig` — resolves `signalersConfig` + `targetsConfig` * from `opensip-cli.config.yml`. Sequenced before `selectRecipe` * so a missing/invalid config surfaces before recipe-name * validation — the config tells the user what recipes exist, so * the config error is the more useful message of the two. * 3. `selectRecipe` — looks up the requested recipe in the scope's * recipe registry (populated by step 1). Has a hard * precondition on `ensureChecksLoaded`; see its JSDoc. * 4. `validateLanguagesAgainstAdapters` — warns on unknown languages. * 5. Build scope-based file map → run recipe → build outputs. * * The phase helpers read from per-run scope state set by step 1 * (`scope.fitness.load`; see the accessors block in * `./fit/check-loader.ts`). The ordering here is the contract that lets * those reads be safe. */ export declare function executeFit(args: FitOptions, opts?: ExecuteFitOptions): Promise<{ result: RunPresentation; envelope: SignalEnvelope; warnings?: readonly string[]; runOutcome?: 'degraded'; } | { result: ErrorResult; envelope?: undefined; warnings?: undefined; }>; //# sourceMappingURL=fit.d.ts.map