//! hephaes — the CLI front-end (a thin client over `hephaes-core`).
//!
//! MCP (`hephaes mcp`) and web (`hephaes serve`) front-ends live alongside it;
//! see `hephaes_interfaces_plan.md`. The terminal interface is frozen and
//! snapshot-gated.

// Re-export core modules at the crate root so the existing `crate::config`,
// `crate::agent`, `crate::engine`, … paths in the command/onboarding code keep
// resolving unchanged after the workspace split.
pub use hephaes_core::{agent, config, engine, providers, repo, secret, state, util, wiki};

mod cli;
mod commands;
mod onboarding;
mod progress_term;

use clap::Parser;
use owo_colors::OwoColorize;

#[tokio::main]
async fn main() {
    // Load `.env` if present so API keys can be sourced from it (decision #7).
    // Non-fatal: a missing .env is the common case.
    let _ = dotenvy::dotenv();

    let cli = cli::Cli::parse();
    if let Err(err) = commands::run(cli).await {
        eprintln!("{} {:#}", "error:".red().bold(), err);
        std::process::exit(1);
    }
}
