use crate::output;
use clap::Parser;
use rust_llm_tidy::rules::registry::KNOWN_FIX_OPS;
use std::path::PathBuf;
#[derive(Parser)]
#[command(
name = "rust-llm-tidy",
about = "Fix, reorder, narrow visibility, and lint allowed source files",
version
)]
pub(crate) struct Cli {
pub(crate) paths: Vec<PathBuf>,
#[arg(long)]
pub(crate) dry_run: bool,
#[arg(long)]
pub(crate) checks_only: bool,
#[arg(long, value_name = "REF")]
pub(crate) diff_base: Option<String>,
#[arg(long)]
pub(crate) all_lines: bool,
#[arg(long)]
pub(crate) validate: bool,
#[arg(long, value_name = "RULE")]
pub(crate) include: Vec<String>,
#[arg(long, value_name = "RULE")]
pub(crate) exclude: Vec<String>,
#[arg(long, value_name = "EXT")]
pub(crate) extension: Vec<String>,
#[arg(long, global = true)]
pub(crate) config: Option<PathBuf>,
#[arg(long, global = true, conflicts_with = "config")]
pub(crate) no_config: bool,
#[arg(long, value_name = "MODE", default_value = "text")]
pub(crate) output_mode: output::OutputMode,
#[arg(long, conflicts_with = "output_mode")]
pub(crate) json: bool,
}
pub(crate) fn checks_only_selection(include: &[String], exclude: &mut Vec<String>) -> Vec<String> {
exclude.extend(
KNOWN_FIX_OPS
.iter()
.filter(|op| **op != "lints")
.copied()
.map(String::from),
);
let selected: Vec<String> = include
.iter()
.filter(|rule| rule.as_str() == "lints" || !KNOWN_FIX_OPS.contains(&rule.as_str()))
.cloned()
.collect();
if selected.is_empty() && !include.is_empty() {
vec![String::from("lints")]
} else {
selected
}
}