use anyhow::Result;
use clap::Parser;

mod client;
mod commands;
mod error;
mod output;

use commands::Commands;

#[derive(Parser)]
#[command(name = "vapora")]
#[command(about = "VAPORA CLI - Intelligent Development Orchestration", long_about = None)]
#[command(version)]
struct Cli {
    /// Backend API URL
    #[arg(long, env = "VAPORA_API_URL", default_value = "http://localhost:8001")]
    api_url: String,

    #[command(subcommand)]
    command: Commands,
}

#[tokio::main]
async fn main() -> Result<()> {
    let cli = Cli::parse();

    let client = client::VaporaClient::new(&cli.api_url);

    cli.command.execute(client).await
}
