/** * Custom Rule Engine * * Allows projects to define custom validation rules that are * checked during certification alongside built-in checks. * * Rules are defined in `.vaspera/hardening-rules.yaml` or `.vaspera/hardening-rules.json` * * @module certification/rules */ import { Finding, Severity, AgentType } from "./types.js"; /** * Custom rule definition */ export interface CustomRule { /** Unique rule ID (e.g., "trade-001") */ id: string; /** Human-readable rule name */ name: string; /** Rule description */ description: string; /** Regex pattern to search for (as string) */ pattern: string; /** Severity if pattern is found */ severity: Severity; /** Error message to display */ message: string; /** Agent type this rule belongs to */ agent?: AgentType; /** Category for grouping */ category?: string; /** File glob patterns to include */ includeFiles?: string[]; /** File glob patterns to exclude */ excludeFiles?: string[]; /** Whether this rule is enabled */ enabled?: boolean; /** Confidence level for matches (0-100) */ confidence?: number; /** Tags for filtering */ tags?: string[]; } /** * Custom rules configuration file format */ export interface CustomRulesConfig { version?: string; rules: CustomRule[]; } /** * Result of evaluating a custom rule */ export interface RuleMatch { rule: CustomRule; file: string; line: number; matchedText: string; context: string; } /** * Built-in rule templates that can be extended */ export declare const RULE_TEMPLATES: Record>; /** * Load custom rules from project configuration */ export declare function loadCustomRules(projectPath: string): Promise; /** * Check a file against custom rules */ export declare function checkFileAgainstRules(filePath: string, content: string, rules: CustomRule[]): Promise; /** * Convert rule matches to findings */ export declare function matchesToFindings(matches: RuleMatch[]): Finding[]; /** * Get all available rule templates */ export declare function listRuleTemplates(): Array<{ id: string; name: string; severity: Severity; category: string; }>; /** * Generate a sample rules configuration file */ export declare function generateSampleConfig(): string; //# sourceMappingURL=rules.d.ts.map