/** * Recipe-pick + recipe-run helpers for the `fit` command. * * `selectRecipe()` decides between a named recipe (looked up in the * current scope's recipe registry) and an ad-hoc recipe constructed from * `--check` / `--tags`. `runRecipeOrAdHoc()` then executes the chosen * shape via `FitnessRecipeService`. */ import { FitnessRecipeService } from '../../recipes/service.js'; import type { FitnessRecipeResult } from '../../recipes/types.js'; import type { ErrorResult, FitOptions } from '@opensip-cli/contracts'; /** * Tool-scoped recipe defaults for `fit` (ADR-0022), read from the project * config by the caller: `toolRecipe` is `fitness.recipe`. */ export interface FitRecipeDefaults { readonly toolRecipe?: string; } /** * Flatten the (repeatable, possibly comma-separated) `--tags` values into a * trimmed, non-empty tag-filter list. `--tags a,b --tags c` → `['a','b','c']`. */ export declare function tagFiltersFrom(tags: readonly string[] | undefined): string[]; /** * Decide which recipe to execute. `--check` and `--tags` each create an * ad-hoc recipe (recipeName=undefined); otherwise resolve a named recipe with * tool-scoped precedence (ADR-0022): `--recipe` flag > `fitness.recipe` > * built-in `default`. A config-sourced unknown name tolerantly falls back to * `default` with a warning (the default may belong to another tool); an explicit * `--recipe` typo returns an `ErrorResult`. * * **Precondition:** must run *after* `ensureChecksLoaded` so that any * user-defined recipes (loaded as `.mjs` plugins under * `/opensip-cli/fit/recipes/`) are present in the scope's recipe * registry by the time the lookup runs. Inverting the two * lines silently breaks recipe lookup for plugin-provided recipes. */ export declare function selectRecipe(args: FitOptions, defaults?: FitRecipeDefaults): { recipeName: string | undefined; } | { error: ErrorResult; }; /** * Run the recipe (or ad-hoc selector built from `--check` / `--tags`). * * @throws {Error} When neither `args.check` nor `args.tags` is set but * `recipeName` is `undefined` — an invariant violation in the caller * (`selectRecipe` returns `recipeName` non-`undefined` in that branch). */ export declare function runRecipeOrAdHoc(service: FitnessRecipeService, args: FitOptions, recipeName: string | undefined): Promise; //# sourceMappingURL=recipe-selector.d.ts.map