dsp-cli 0.1.3

AI-agent-friendly command-line interface for the DaSCH Service Platform (DSP)
Documentation
use std::process::ExitCode;

use clap::Parser;

use dsp_cli::cli::Cli;
use dsp_cli::diagnostic::ExitCategory;

fn main() -> ExitCode {
    // Must precede `Cli::parse()` so clap's `env =` attributes see `.env` values.
    dotenvy::dotenv().ok();

    let cli = Cli::parse();

    dsp_cli::diagnostic::init_tracing(cli.verbose);

    // Computed before `run(cli)` moves `cli`.
    let notice_fmt = cli.output_format();
    let result = dsp_cli::run(cli);

    let code = match &result {
        Ok(()) => ExitCategory::Success as u8,
        Err(diag) => {
            eprintln!("Error: {diag}");
            diag.exit_category() as u8
        }
    };

    // Runs regardless of the command's outcome (gated + rate-limited internally);
    // the advisory is deliberately the last thing written to stderr (ADR-0015).
    // Never touches `code` or the exit path.
    dsp_cli::update::maybe_notify(notice_fmt);

    ExitCode::from(code)
}