/** * recipe-options.ts — asking a recipe's own questions, and acting on the answers. * * A recipe may declare options in its config. They are asked at scaffold time, * recorded in the scaffolded app's litro.recipe.json, and some of them change * what is on disk afterwards. * * The prompts are injected rather than imported so the whole path — flag * handling, defaults, and the effect an answer has on the scaffolded files — * is testable without a terminal. */ import type { LitroRecipe } from './types.js'; /** The prompt surface a caller supplies. The CLI passes its readline helpers. */ export interface OptionPrompts { text(question: string, defaultVal: string): Promise; select(question: string, choices: string[], defaultVal?: string): Promise; } /** * Answers given on the command line, keyed by option. A key present here is * not asked for. */ export type RecipeOptionFlags = Record; /** True when the recipe declares an option with this key. */ export declare function declaresOption(recipe: LitroRecipe, key: string): boolean; /** * Refuse a flag the chosen recipe has no question for. * * Ignoring it silently is worse than failing: a CI job that passes `--no-blog` * to a recipe without a blog option would publish a site with the blog still * in it and no sign that anything went wrong. */ export declare function assertFlagsApply(recipe: LitroRecipe, flags: RecipeOptionFlags): void; /** * Resolve every option the recipe declares, asking only what no flag answered. */ export declare function resolveRecipeOptions(recipe: LitroRecipe, flags: RecipeOptionFlags, prompts: OptionPrompts): Promise>; /** * Act on the answers, once the templates are on disk. * * @param skip Option keys another step owns. `--for-repo` takes 'blog', * because it removes the blog itself and has a repository URL to * repoint the Blog button at. */ export declare function applyRecipeOptions(recipe: LitroRecipe, resolved: Record, projectDir: string, skip?: string[]): Promise; //# sourceMappingURL=recipe-options.d.ts.map