concept-analyzer 0.1.1

A unified pipeline that analyzes code repositories and extracts first-principles instructions for AI agents
Documentation
//! CLI for running concept analysis in a single call
//!
//! Usage:
//!   cargo run --bin analyze-repo -- <repo-path> <s3-bucket> <s3-key>
//!
//! Environment variables:
//!   - LLM_API_KEY: Your OpenAI API key
//!   - AWS_REGION: AWS region for S3
//!   - AWS_ACCESS_KEY_ID: AWS access key
//!   - AWS_SECRET_ACCESS_KEY: AWS secret key

use anyhow::{Context, Result};
use clap::Parser;
use concept_analyzer::api::run_cli_analysis;

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
    /// Path to the repository or corpus to analyze
    #[arg(help = "Path to repository (e.g., ./my-project or /path/to/corpus)")]
    repo_path: String,

    /// S3 bucket to publish results to
    #[arg(help = "S3 bucket name (e.g., my-analysis-bucket)")]
    s3_bucket: String,

    /// S3 key (path within bucket) for the output
    #[arg(help = "S3 key/path (e.g., analyses/my-project.json)")]
    s3_key: String,

    /// LLM API key (can also use LLM_API_KEY env var)
    #[arg(long, env = "LLM_API_KEY", hide_env_values = true)]
    llm_api_key: String,
}

#[tokio::main]
async fn main() -> Result<()> {
    // Initialize logging
    env_logger::init();

    // Parse command line arguments
    let args = Args::parse();

    // Run the analysis
    run_cli_analysis(
        &args.repo_path,
        &args.s3_bucket,
        &args.s3_key,
        &args.llm_api_key,
    )
    .await
    .context("Repository analysis failed")?;

    Ok(())
}