use std::path::PathBuf;
use clap::{Parser, Subcommand, ValueEnum};
#[derive(Parser, Debug)]
#[command(name = "sql-query-analyzer")]
#[command(version, about, long_about = None)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands
}
#[derive(Subcommand, Debug)]
pub enum Commands {
Analyze {
#[arg(short, long)]
schema: PathBuf,
#[arg(short, long)]
queries: PathBuf,
#[arg(short, long, value_enum, default_value = "ollama")]
provider: Provider,
#[arg(short, long, env = "LLM_API_KEY", hide_env_values = true)]
api_key: Option<String>,
#[arg(short, long)]
model: Option<String>,
#[arg(long, default_value = "http://localhost:11434")]
ollama_url: String,
#[arg(long, value_enum, default_value = "generic")]
dialect: Dialect,
#[arg(short = 'f', long, value_enum, default_value = "text")]
output_format: Format,
#[arg(short, long)]
verbose: bool,
#[arg(long)]
dry_run: bool,
#[arg(long)]
no_color: bool
}
}
#[derive(Debug, Clone, ValueEnum)]
pub enum Provider {
OpenAI,
Anthropic,
Ollama
}
impl Provider {
pub fn default_model(&self) -> &str {
match self {
Self::OpenAI => "gpt-4",
Self::Anthropic => "claude-sonnet-4-20250514",
Self::Ollama => "llama3.2"
}
}
}
#[derive(Debug, Clone, ValueEnum)]
#[non_exhaustive]
pub enum Dialect {
Generic,
Mysql,
Postgresql,
Sqlite,
Clickhouse
}
#[derive(Debug, Clone, ValueEnum)]
pub enum Format {
Text,
Json,
Yaml,
Sarif
}