/** * Bounded-execution variant of `applyRulesToAdditions` (mmnto-ai/totem#1641). * * Routes every regex rule through the persistent-worker `RegexEvaluator` * so a catastrophic-backtracking pattern terminates at the configured * timeout rather than hanging the lint process indefinitely. Engine layer * is policy-free: it records `RuleTimeoutOutcome` entries and lets the * caller (CLI) decide whether to surface them as exit-code contributors * (strict) or as skipped warnings (lenient). * * Scope: regex-engine rules only. ast / ast-grep rules are not ReDoS- * susceptible and are evaluated by `applyAstRulesToAdditions` / the * compound-rule pipeline under separate bounds. */ import type { CompiledRule, DiffAddition, RuleEventCallback, Violation } from '../compiler-schema.js'; import { type RuleEngineContext } from '../rule-engine.js'; import type { RegexEvaluator } from './evaluator.js'; export type TimeoutMode = 'strict' | 'lenient'; export interface RuleTimeoutOutcome { ruleHash: string; file: string; elapsedMs: number; mode: TimeoutMode; } export interface BoundedApplyOptions { evaluator: RegexEvaluator; timeoutMode: TimeoutMode; repoRoot: string; /** * Prop 310 § Design 8 — whole-file reader for a `requires: {scope: file}` * check. Same shape as the ast path's shipped `readStrategy` 7th parameter, so * `totem lint --staged` threads the SAME `git show :` reader into both * dispatchers and the requirement is evaluated against the bytes being * committed. Omitted ⇒ the worktree file is read. * * Reached only after a record-path rule with a file-scoped requirement has * matched its target, so it adds no IO to the legacy corpus. */ readStrategy?: (filePath: string) => Promise; } export interface BoundedApplyResult { violations: Violation[]; timeoutOutcomes: RuleTimeoutOutcome[]; } export declare function applyRulesToAdditionsBounded(ctx: RuleEngineContext, rules: readonly CompiledRule[], additions: readonly DiffAddition[], options: BoundedApplyOptions, onRuleEvent?: RuleEventCallback): Promise; //# sourceMappingURL=apply-rules-bounded.d.ts.map