import type { CompiledRule, DiffAddition, FailSoftAttestation, RuleEventCallback, Violation } from './compiler-schema.js';
/**
 * Check if a file path matches a single glob pattern.
 * Supports: `*.ext`, `**\/*.ext`, `dir/**\/*.ext`, `dir/**`, literal filenames.
 */
export declare function matchesGlob(filePath: string, glob: string): boolean;
/**
 * Multi-glob file matcher with positive/negative split. Returns true when
 * `filePath` matches ANY positive glob AND no negative (`!`-prefixed) glob.
 * If `globs` contains no positive entries, every file is a positive match
 * by default and only the negative filter applies.
 *
 * Exported for cross-module reuse (Stage 4 verifier consolidation per
 * mmnto-ai/totem#1758) so both rule-engine classification and Stage 4
 * baseline classification share a single source of truth on glob semantics.
 */
export declare function fileMatchesGlobs(filePath: string, globs: readonly string[]): boolean;
/** Injectable logger for core library diagnostics. */
export interface CoreLogger {
    warn(message: string): void;
}
/**
 * Per-invocation execution context for the rule engine (mmnto/totem#1441).
 * Replaces module-level `coreLogger` + `shieldContextDeprecationWarned` state
 * so concurrent / federated rule evaluations cannot bleed logger configuration
 * or deprecation-warning latching across each other. Callers instantiate one
 * ctx per linting invocation; the engine threads it through every helper that
 * can reach the legacy `shield-context:` directive path.
 */
export interface RuleEngineContext {
    logger: CoreLogger;
    state: {
        hasWarnedShieldContext: boolean;
    };
}
export declare function isSuppressed(ctx: RuleEngineContext, line: string, precedingLine: string | null): boolean;
/**
 * Extract justification text from totem-context: directives.
 * Checks both the current line and the preceding line.
 * Returns empty string for plain totem-ignore (no justification).
 *
 * @param ctx - Per-invocation rule engine context. Required so that the legacy
 *   `shield-context:` deprecation path (reached via `matchContextDirective`)
 *   uses the caller's logger and per-ctx latch instead of module state.
 * @param line - The line being evaluated.
 * @param precedingLine - The line immediately before, or null at start of file.
 * @returns The justification text, or empty string if the line carries a plain
 *   `totem-ignore` or no directive at all.
 */
export declare function extractJustification(ctx: RuleEngineContext, line: string, precedingLine: string | null): string;
/**
 * Parse a `// totem-context:` justification as a Tenet-4 shape-2 fail-soft
 * attestation. Returns null unless the justification LEADS with `fail-soft`.
 * A leading `fail-soft` with a non-empty `backstop=<name>` yields the named
 * backstop; a leading `fail-soft` with no/empty backstop yields
 * `{ backstop: null }` (malformed — callers surface a non-blocking WARN, never
 * block: the lint establishes token-PRESENCE only, loudness + accounting are
 * verified at review/ADR level — Tenet 13/19).
 */
export declare function parseFailSoftAttestation(justification: string): FailSoftAttestation | null;
/**
 * Apply compiled regex-engine rules against pre-extracted diff additions.
 * Skips additions with non-code AST context (strings, comments, regex).
 *
 * @param ctx - Per-invocation rule engine context. Replaces the module-level
 *   logger / deprecation-warning latch that existed pre-#1441. Callers build
 *   one ctx per linting invocation: `{ logger, state: { hasWarnedShieldContext: false } }`.
 * @param rules - The full rule list. This function filters to regex-engine
 *   rules internally.
 * @param additions - The diff additions to evaluate.
 * @param onRuleEvent - Optional observability callback for metrics collection
 *   on trigger / suppress / failure events.
 * @returns All regex-based violations found.
 */
export declare function applyRulesToAdditions(ctx: RuleEngineContext, rules: CompiledRule[], additions: DiffAddition[], onRuleEvent?: RuleEventCallback): Violation[];
/**
 * Apply AST-engine compiled rules against pre-extracted diff additions.
 * Handles both Tree-sitter S-expression ('ast') and ast-grep ('ast-grep') engines.
 * Async because it reads files and runs Tree-sitter queries.
 * Handles fileGlobs filtering and suppression same as regex rules.
 *
 * @param ctx - Per-invocation rule engine context (see {@link RuleEngineContext}).
 * @param rules - The full rule list. This function filters to ast / ast-grep
 *   rules internally.
 * @param additions - The diff additions to evaluate.
 * @param workingDirectory - Absolute path used to resolve file reads. Callers
 *   must pass the repo root, not `process.cwd()` (#1304).
 * @param onRuleEvent - Optional observability callback for trigger / suppress
 *   / failure events.
 * @param onWarn - Optional AST-path warning sink ("AST query skipped",
 *   "Skipped file outside project", etc.). Follow-up #1552 tracks consolidating
 *   this into `ctx.logger.warn`.
 * @param readStrategy - Optional async reader for staged / virtual file
 *   content. When omitted, reads from disk.
 * @returns All AST-based violations found.
 */
export declare function applyAstRulesToAdditions(ctx: RuleEngineContext, rules: CompiledRule[], additions: DiffAddition[], workingDirectory: string, onRuleEvent?: RuleEventCallback, onWarn?: (msg: string) => void, readStrategy?: (filePath: string) => Promise<string | null>): Promise<Violation[]>;
/**
 * Apply **regex-engine** compiled rules against added lines from a diff.
 * This is a convenience wrapper that only handles 'regex' engine rules.
 * For 'ast' and 'ast-grep' rules, call `applyAstRulesToAdditions` separately.
 *
 * @param ctx - Per-invocation rule engine context (see {@link RuleEngineContext}).
 * @param rules - The full list of compiled rules. This function filters to regex rules.
 * @param diff - The unified diff string.
 * @param excludeFiles - File paths to skip (e.g., compiled-rules.json to avoid self-matches).
 * @returns All regex-based violations found.
 */
export declare function applyRules(ctx: RuleEngineContext, rules: CompiledRule[], diff: string, excludeFiles?: string[]): Violation[];
//# sourceMappingURL=rule-engine.d.ts.map