Skip to main content

normalize_rules/
lib.rs

1//! Rule orchestration for normalize: syntax rules, fact rules, native checks, and SARIF engines.
2//!
3//! This crate owns all rule management logic extracted from the main `normalize` crate:
4//! - `runner` — unified run, list, show, tags, enable/disable, add/update/remove
5//! - `cmd_rules` — syntax rule runner (tree-sitter based)
6//! - `loader` — diagnostic formatting helpers for fact rules
7//! - `service` — `RulesService` with `#[cli]` registration (feature-gated)
8//!
9//! The `RulesRunConfig` struct allows callers to pass rule config without depending on
10//! `normalize`'s `NormalizeConfig` (which would create a circular dependency).
11
12pub mod cmd_rules;
13pub mod loader;
14pub mod runner;
15
16#[cfg(feature = "cli")]
17pub mod service;
18#[cfg(feature = "cli")]
19pub mod setup;
20
21pub use runner::{
22    ListFilters, RuleEntry, RuleInfoReport, RuleKind, RuleOverride, RulesConfig, RulesListReport,
23    RulesRunConfig, RulesTagsReport, SarifTool, TagEntry, abi_diagnostic_to_issue, add_rule,
24    apply_native_rules_config, build_list_report, build_relations_from_index,
25    collect_fact_diagnostics, collect_fact_diagnostics_incremental, enable_disable,
26    finding_to_issue, list_tags, list_tags_structured, remove_rule, run_rules_report,
27    run_sarif_tools, show_rule, show_rule_structured, try_rules_via_daemon, update_rules,
28};
29
30pub use loader::format_diagnostic;
31
32#[cfg(feature = "cli")]
33pub use service::{
34    CompileError, CompileWarning, FixtureCaseResult, FixtureExpectedFinding, RuleShowReport,
35    RulesCompileReport, RulesFixtureTestReport, RulesService, RulesTestReport, RulesValidateReport,
36    load_rules_config,
37};