import type { CompiledRule, RuleTimeoutOutcome, TimeoutMode, TotemConfig, TotemFinding, Violation } from '@mmnto/totem'; import type { ShieldFormat } from './shield.js'; /** * File-level AST parse failure outcome (mmnto-ai/totem#1982). Parallel of * {@link RuleTimeoutOutcome} but scoped to the FILE level — when ast-grep's * native parser refuses a language (e.g. "rust is not supported in napi" * on Windows), the failure cascades to every rule on that file. Granularity * is therefore file, not rule. * * The proper per-file graceful-degrade lives in `mmnto-ai/totem#1786`; this * outcome shape exists for the operator-escape `--ast-parse-mode lenient` * gap-bridge. */ export interface AstParseFailureOutcome { file: string; /** Language the parser was invoked with (e.g. 'rust', 'python'). */ language: string; /** First 200 chars of the underlying error message. */ message: string; mode: TimeoutMode; } export interface RunCompiledRulesOptions { diff: string; cwd: string; totemDir: string; format: ShieldFormat; outPath?: string; exportPaths?: string[]; ignorePatterns?: string[]; tag: string; /** Absolute path to config root — used for cache paths instead of cwd */ configRoot?: string; /** * Loaded totem config (mmnto-ai/totem-strategy#971, Prop 309). Only its * `targets` are consumed — the lesson-kind ingest targets whose globs decide * whether a zero-compiled-rules run is a legitimate empty-corpus skip * (mmnto-ai/totem#1831) or a DISARMED enforcement gate that must fail loud. * A caller that omits it opts out of the corpus-bearing hard-error and keeps * the unconditional empty-corpus skip (e.g. `shield estimate`, whose forecast * path is not the enforcement gate). */ config?: Pick; /** True if we are linting staged changes only */ isStaged?: boolean; /** * Bounded regex execution timeout mode (mmnto-ai/totem#1641). `strict` * (default) surfaces regex timeouts as lint errors that contribute to * the non-zero exit code. `lenient` skips the timing-out rule-file pair * with a visible warning and excludes timeouts from the exit code. */ regexTimeoutMode?: TimeoutMode; /** * AST parse failure mode (mmnto-ai/totem#1982). `strict` (default) * surfaces a `TotemParseError` from the AST pipeline (e.g. ast-grep * native parser refusing an unsupported language) as a lint error. * `lenient` skips ALL AST rules for the rest of the run with a visible * warning and records the failure in `astParseFailures`. Note the * asymmetry vs. `regexTimeoutMode`: AST lenient is run-wide because * the parse failure escapes the per-file loop in core; per-file * graceful-degrade is `mmnto-ai/totem#1786`'s lane. */ astParseMode?: TimeoutMode; } export interface RunCompiledRulesResult { violations: Violation[]; /** Unified findings (ADR-071) — same data as violations, normalized shape */ findings: TotemFinding[]; rules: CompiledRule[]; output: string; /** * Any regex rule-file pairs that timed out during bounded evaluation * (mmnto-ai/totem#1641). Empty on healthy runs. Strict mode expects the * CLI caller to fail non-zero when non-empty; lenient mode emits * warnings only. */ regexTimeouts: RuleTimeoutOutcome[]; /** * AST parse failures captured in lenient mode (mmnto-ai/totem#1982). * Always empty in strict mode (parse errors propagate). Always empty * on healthy runs. */ astParseFailures: AstParseFailureOutcome[]; } /** * Compiled-rules execution engine used by `totem lint`. Loads rules, extracts additions, enriches * with AST context, records metrics, and formats output. */ export declare function runCompiledRules(options: RunCompiledRulesOptions): Promise; //# sourceMappingURL=run-compiled-rules.d.ts.map