import type { RiskSeverity } from "../types.js"; import type { RiskRule } from "./rules.js"; /** * Metadata-bearing wrapper around a `RiskRule`. The bare function form is what * the analyzer actually invokes; the surrounding fields exist so the UI can * group, filter, and explain findings without re-deriving structure from the * `RiskFlag.type` discriminator. * * `id` is the stable identifier (kebab-case). `severity` is the rule's * *default* severity — individual findings emitted by `run` may override it on * a per-finding basis (e.g. a future rule that classifies approvals * differently by value tier). `category` is a coarse UI grouping. `docs` is an * optional URL or markdown blob with detection rationale + remediation. */ export interface Rule { id: string; severity: RiskSeverity; category: string; title: string; description: string; docs?: string; run: RiskRule; } /** * Identity helper that anchors type inference at the definition site. Lets * consumers write `defineRule({ ... })` and get full editor IntelliSense for * the metadata fields, plus a single import path to migrate against if the * shape evolves. */ export declare function defineRule(rule: Rule): Rule; export declare const RULE_DELEGATECALL_UNRECOGNIZED: Rule; export declare const RULE_LARGE_APPROVAL: Rule; export declare const RULE_TOKEN_SENT_TO_TOKEN_CONTRACT: Rule; /** * The metadata-bearing built-in registry. Order is preserved in * `analyzeRisks` output. Parallels `BUILTIN_RULES` (which is the same data in * bare-function form) — keep both shapes in sync when adding new rules. */ export declare const BUILTIN_RULE_DEFS: readonly Rule[]; /** * Look up a built-in rule by id. Returns `undefined` for unknown ids so * consumers can build their own merge/override logic without exception * handling. */ export declare function getRuleById(id: string): Rule | undefined; //# sourceMappingURL=defineRule.d.ts.map