/** * Per-rule configuration: enable/disable, severity overrides, and free-form * options. Configuration is persisted as JSON (default * `~/.npm-safe/rules.json`) and can be managed at runtime through the * {@link RuleConfigManager}. */ import { Severity } from './types.js'; /** Free-form options passed to a rule at match time. */ export type RuleOptions = Readonly>; /** Per-rule configuration overrides. */ export interface RuleConfig { /** Whether the rule is enabled. Defaults to the rule's own default. */ readonly enabled?: boolean; /** Severity override applied to findings produced by the rule. */ readonly severity?: Severity; /** Free-form options made available to the rule implementation. */ readonly options?: RuleOptions; } /** Shape of the persisted rules configuration file. */ export interface RuleConfigFile { /** Per-rule overrides keyed by rule id. */ readonly rules: Readonly>; } /** Default location of the rules configuration file. */ export declare function getDefaultRulesConfigPath(): string; /** * Loads, mutates, and persists per-rule configuration. Thread-safe per * instance; concurrent instances may race on the file, which is acceptable * for a single-user desktop tool. */ export declare class RuleConfigManager { private readonly filePath; private config; /** * @param filePath - Path to the JSON config file. */ constructor(filePath?: string); /** Load (or initialize) the config file. */ private load; /** Persist the current configuration to disk. */ private save; /** Get the configuration for a single rule, or `undefined` if unset. */ getRule(ruleId: string): RuleConfig | undefined; /** Whether a rule is enabled, honoring config overrides. */ isEnabled(ruleId: string, defaultEnabled: boolean): boolean; /** Severity override for a rule, or `undefined` if not overridden. */ getSeverityOverride(ruleId: string): Severity | undefined; /** Options for a rule, or `{}` if none are configured. */ getOptions(ruleId: string): RuleOptions; /** Enable or disable a rule (persisted). */ setEnabled(ruleId: string, enabled: boolean): void; /** Override a rule's severity (persisted). `undefined` clears the override. */ setSeverity(ruleId: string, severity: Severity | undefined): void; /** Set a rule's options (persisted). */ setOptions(ruleId: string, options: RuleOptions): void; /** All configured rule ids. */ getConfiguredRuleIds(): string[]; /** Mutable view of the rules map for writing. */ private mutableRules; } //# sourceMappingURL=rule-config.d.ts.map