omnicoach 0.3.0

Lightweight, high-signal static analysis and command linter for Python and Rust
//! Orchestration runner for command lint evaluation.

architecture_component!(CommandLintRunner);

use crate::command_lint::command::InterceptedCommand;
use crate::command_lint::rules::COMMAND_RULES;
use crate::command_lint::vcs::JjCliClient;
use crate::config::Config;
use crate::diagnostic::Diagnostic;

/// Evaluates all enabled command rules against the provided raw command string.
#[must_use]
pub fn run_command_lint(raw_cmd: &str, config: &Config) -> Vec<Diagnostic> {
    let commands = InterceptedCommand::parse_all(raw_cmd);
    let jj_client = JjCliClient;
    let mut all_diagnostics = Vec::new();

    for cmd in &commands {
        for rule in COMMAND_RULES {
            if config.is_rule_enabled(rule.declaration.name) {
                all_diagnostics.extend(rule.check_command(cmd, &jj_client));
            }
        }
    }

    all_diagnostics
}