kiromi-ai-cli 0.2.2

Operator and developer CLI for the kiromi-ai-memory store: append, search, snapshot, regenerate, migrate-scheme, gc, audit-tail.
// SPDX-License-Identifier: Apache-2.0 OR MIT
//! `kiromi-ai-memory` — operator CLI binary.
//!
//! The binary is the only place in the workspace allowed to print to stdio.
// `deny` rather than `forbid` so the test module can opt in to a single
// `unsafe { std::env::set_var(...) }` call required by the edition-2024
// stdlib API. Production code stays unsafe-free.
#![deny(unsafe_code)]
#![allow(clippy::print_stdout, clippy::print_stderr)]
#![cfg_attr(
    test,
    allow(
        clippy::unwrap_used,
        clippy::expect_used,
        clippy::panic,
        clippy::missing_panics_doc
    )
)]

mod cli;
mod cmd;
mod config;
mod embedder;
mod error;
mod logging;
mod output;
mod runtime;
mod uri;

use clap::Parser;

use crate::cli::Cli;
use crate::error::{CliError, ExitCode};

#[tokio::main(flavor = "multi_thread", worker_threads = 2)]
async fn main() -> std::process::ExitCode {
    let cli = Cli::parse();
    logging::init(cli.globals.verbose);
    match run(cli).await {
        Ok(()) => ExitCode::Success.into_proc(),
        Err(e) => {
            eprintln!("error: {e}");
            let mut src = std::error::Error::source(&e);
            while let Some(s) = src {
                eprintln!("  caused by: {s}");
                src = s.source();
            }
            e.kind.into_proc()
        }
    }
}

async fn run(cli: Cli) -> Result<(), CliError> {
    cmd::run(cli).await
}