import type { CompiledRule, Violation } from './compiler.js'; /** Default rule category when none is specified on the compiled rule. */ export declare const DEFAULT_RULE_CATEGORY = "architecture"; export interface SarifLog { $schema: string; version: '2.1.0'; runs: SarifRun[]; } export interface SarifRun { tool: { driver: { name: string; version: string; informationUri: string; rules: SarifReportingDescriptor[]; properties: Record; }; }; results: SarifResult[]; invocations: SarifInvocation[]; } export interface SarifReportingDescriptor { id: string; shortDescription: { text: string; }; fullDescription?: { text: string; }; helpUri?: string; properties?: Record; } export interface SarifResult { ruleId: string; ruleIndex: number; level: 'error' | 'warning' | 'note'; message: { text: string; }; locations: SarifLocation[]; /** SARIF properties bag — Trap Ledger metadata */ properties?: Record; } export interface SarifLocation { physicalLocation: { artifactLocation: { uri: string; }; region: { startLine: number; }; }; } export interface SarifInvocation { executionSuccessful: boolean; properties?: Record; } export interface SarifOptions { /** Tool version (e.g., "0.31.0") */ version: string; /** Git commit SHA being evaluated */ commitHash?: string; } /** * Build a unique, stable rule ID from a CompiledRule. * Format: `totem/` — deterministic across runs. */ export declare function ruleId(rule: CompiledRule): string; /** * Replace unpaired UTF-16 surrogate code units with U+FFFD so a string is * well-formed Unicode. Lone surrogates are legal in JS strings and the SARIF * file we emit parses fine, but `github/codeql-action/upload-sarif` re-serializes * the document (fingerprint injection) with JSON.stringify and GitHub's SARIF * ingestion parser rejects the resulting bare `\ud83c`-style escapes ("unexpected * end of hex escape"), silently dropping the entire analysis under * continue-on-error (mmnto-ai/totem#2296). Frozen rule patterns encode astral * ranges as surrogate-pair ranges (e.g. the emoji-in-markdown detector), which * leaves lone surrogates in `pattern`. Well-forming is lossless for enforcement — * the SARIF pattern/description fields are documentation, not executable, and the * compiled rules themselves are never touched (compile freeze unaffected). * * Implemented by hand rather than via `String.prototype.toWellFormed()` (Node ≥ * 20) because the workspace targets the ES2022 lib, which does not type it. */ export declare function wellFormedUnicode(value: string): string; /** * Convert Totem violations + rules into a SARIF 2.1.0 log. * Produces output compatible with `github/codeql-action/upload-sarif`. */ export declare function buildSarifLog(violations: Violation[], rules: CompiledRule[], options: SarifOptions): SarifLog; //# sourceMappingURL=sarif.d.ts.map