use clap::Parser;
use debugger::commands::Commands;
use debugger::common::logging;
use debugger::{cli, daemon};
#[derive(Parser)]
#[command(name = "debugger", about = "LLM-friendly debugger CLI")]
#[command(version, long_about = None)]
struct Cli {
#[command(subcommand)]
command: Commands,
}
#[tokio::main]
async fn main() {
let cli = Cli::parse();
let is_daemon = matches!(cli.command, Commands::Daemon);
if is_daemon {
if let Some(log_path) = logging::init_daemon() {
eprintln!("Daemon logging to: {}", log_path.display());
}
} else {
logging::init_cli();
}
let result = match cli.command {
Commands::Daemon => daemon::run().await,
command => cli::dispatch(command).await,
};
if let Err(e) = result {
eprintln!("Error: {e}");
std::process::exit(1);
}
}