/** * @fileoverview Core types for fitness recipes * * Defines FitnessRecipe, CheckSelector, RecipeCheckResult, and related * types used throughout the recipe execution system. */ import type { DirectiveEntry } from '../framework/directive-inventory.js'; import type { RecipeUnitConfigMap, Signal } from '@opensip-cli/core'; /** * Per-check configuration map. * * Keys are check slugs; values are check-specific config objects whose shape * is declared by the consuming check. The recipe service projects this map * into module-level state before execution so each check can read its slice * via `getCheckConfig(slug)`. See `check-config.ts`. */ export type RecipeCheckConfigMap = RecipeUnitConfigMap; /** Selector that specifies checks by explicit slug list */ interface ExplicitCheckSelector { readonly type: 'explicit'; readonly checkIds: readonly string[]; readonly config?: RecipeCheckConfigMap; } /** Selector that matches checks via glob patterns */ interface PatternCheckSelector { readonly type: 'pattern'; readonly include: readonly string[]; readonly exclude?: readonly string[]; readonly config?: RecipeCheckConfigMap; } /** Selector that includes all checks with specified tags */ interface TagsCheckSelector { readonly type: 'tags'; readonly include: readonly string[]; readonly exclude?: readonly string[]; readonly config?: RecipeCheckConfigMap; } /** Selector that includes all checks with optional exclusions */ interface AllCheckSelector { readonly type: 'all'; readonly exclude?: readonly string[]; readonly config?: RecipeCheckConfigMap; } /** Union of all check selector types used by recipes */ export type CheckSelector = ExplicitCheckSelector | PatternCheckSelector | TagsCheckSelector | AllCheckSelector; /** Execution configuration for a fitness recipe */ interface FitnessExecutionOptions { readonly mode: 'parallel' | 'sequential'; readonly stopOnFirstFailure: boolean; readonly timeout?: number; readonly maxParallel?: number; readonly retryOnFailure?: boolean; readonly maxRetries?: number; readonly successThreshold?: number; } /** Reporting output configuration for a fitness recipe */ interface FitnessReportingOptions { readonly format: 'table' | 'json' | 'unified'; readonly verbose: boolean; readonly outputPath?: string; } /** Complete recipe definition: checks, execution, and reporting */ export interface FitnessRecipe { readonly id: string; readonly name: string; readonly displayName: string; readonly description: string; readonly checks: CheckSelector; readonly execution: FitnessExecutionOptions; readonly reporting: FitnessReportingOptions; readonly tags?: readonly string[]; readonly includeDisabled?: readonly string[]; readonly fileFilter?: string; } /** Result of a single check within a recipe execution */ export interface RecipeCheckResult { readonly checkId: string; readonly checkSlug: string; readonly passed: boolean; readonly violationCount: number; readonly errorCount: number; readonly warningCount: number; readonly ignoredCount: number; readonly durationMs: number; readonly totalItems?: number | undefined; readonly itemType?: string | undefined; readonly skipped: boolean; readonly skipReason?: string; readonly error?: string; readonly timedOut?: boolean; appliedDirectives?: readonly DirectiveEntry[] | undefined; /** Signals after recipe-level filtering, before envelope identity normalization. */ readonly effectiveSignals: readonly Signal[]; } /** Aggregated summary of a complete recipe run */ export interface RecipeRunSummary { readonly totalChecks: number; readonly passedChecks: number; readonly failedChecks: number; readonly skippedChecks: number; readonly erroredChecks: number; readonly totalViolations: number; readonly totalErrors: number; readonly totalWarnings: number; readonly totalIgnored: number; } /** Ignore directive counts by type. */ export interface IgnoresByType { file: number; line: number; block: number; total: number; } /** Complete result of a recipe execution including all check results and summary */ export interface FitnessRecipeResult { readonly recipeId: string; readonly recipeName: string; readonly sessionId: string; readonly success: boolean; readonly startedAt: Date; readonly completedAt: Date; readonly durationMs: number; readonly checkResults: readonly RecipeCheckResult[]; readonly summary: RecipeRunSummary; readonly ignoreCounts?: IgnoresByType | undefined; readonly directives?: readonly DirectiveEntry[] | undefined; } /** Input definition used by defineRecipe() to create a FitnessRecipe */ export interface FitnessRecipeDefinition { readonly name: string; readonly displayName: string; readonly description: string; readonly checks: CheckSelector; readonly execution?: Partial; readonly reporting?: Partial; readonly tags?: readonly string[]; readonly includeDisabled?: readonly string[]; } /** Default maximum parallelism based on available CPU cores */ export declare const DEFAULT_MAX_PARALLEL: number; /** Return the effective max parallelism for a recipe, falling back to the system default */ export declare function getEffectiveMaxParallel(recipe: FitnessRecipe): number; /** Create a frozen FitnessRecipe from a definition, applying defaults for missing options */ export declare function defineRecipe(definition: FitnessRecipeDefinition): FitnessRecipe; export {}; //# sourceMappingURL=types.d.ts.map