minni 0.1.0

Local memory, task, and codebase indexing tool for AI agents
Documentation
use anyhow::Result;
use clap::Parser;
use minni::cli::{self, Cli, Commands};

fn main() -> Result<()> {
    let cli = Cli::parse();
    let project_root = std::env::current_dir()?;

    match cli.command {
        Commands::Init => cli::init::run()?,
        Commands::Index { path, force } => cli::index::run(path, force)?,
        Commands::Search {
            query,
            limit,
            json,
            path,
            lang,
            chunk_type,
            symbol,
            before,
            after,
            context,
        } => cli::search::run(
            &query, limit, json, path, lang, chunk_type, symbol, before, after, context,
        )?,
        Commands::Research {
            question,
            passes,
            limit,
            json,
        } => cli::research::run(&question, passes, limit, json)?,
        Commands::Context { command } => cli::context::run(command)?,
        Commands::Journal { command } => cli::journal::run(command)?,
        Commands::Eval {
            file,
            json,
            min_mrr,
        } => {
            let default_path = std::path::PathBuf::from("eval/queries.json");
            let file = file.as_deref().unwrap_or(&default_path);
            cli::eval::run(file, json, min_mrr)?;
        }
        Commands::Status => cli::status::run()?,
        Commands::Refs { symbol, json } => cli::refs::run(&symbol, json)?,
        Commands::Doctor => {
            let all_ok = cli::doctor::run()?;
            if !all_ok {
                std::process::exit(1);
            }
        }
        Commands::Task { command } => cli::task::run(command, &project_root)?,
    }

    Ok(())
}