use crate::cli::CheckIgnoresArgs;
use crate::commands::ignores;
use crate::domain::config::validate;
use crate::errors::{Error, Result};
use crate::io::{configfs, files};
pub fn run(args: CheckIgnoresArgs) -> Result<i32> {
let cwd = match &args.cwd {
Some(d) => d.clone(),
None => std::env::current_dir().map_err(|e| Error::Io(e.to_string()))?,
};
let loaded = configfs::load_with_targets(&args.config, &cwd, &args.files)?;
let scopes = loaded.scopes;
let config = loaded.config;
validate(&config)?;
let cli_files = files::from_cli(&cwd, &args.files);
let targets = ignores::target_files(&cwd, &config, &scopes, &cli_files)?;
let known = ignores::known_rules(&config);
ignores::check(&cwd, &targets, &known)?;
println!(
"llmlint: ignore directives OK ({} file(s) scanned)",
targets.len()
);
Ok(0)
}