use std::path::PathBuf;
use clap::Parser;
use codex_web::WebOptions;
#[derive(Debug, Parser)]
#[command(name = "typeduck-codex-web", version)]
struct Cli {
#[arg(long, default_value_t = 0)]
port: u16,
#[arg(long)]
no_open: bool,
#[arg(long = "cd", short = 'C', value_name = "DIR")]
cwd: Option<PathBuf>,
#[arg(long, default_value = "codex", value_name = "PATH")]
codex_bin: PathBuf,
#[arg(short = 'c', value_name = "KEY=VALUE")]
config_overrides: Vec<String>,
#[arg(long, default_value_t = false)]
strict_config: bool,
}
#[tokio::main]
async fn main() -> std::io::Result<()> {
let cli = Cli::parse();
codex_web::run(WebOptions {
port: cli.port,
open_browser: !cli.no_open,
cwd: cli.cwd.unwrap_or(std::env::current_dir()?),
codex_executable: cli.codex_bin,
config_overrides: cli.config_overrides,
strict_config: cli.strict_config,
})
.await
}