use anyhow::Result;
use clap::{Parser, Subcommand};
use tracing_subscriber::EnvFilter;
use kindly_tools::{
dev::DevCommand, install::InstallCommand, mcp::McpCommand, monitor::MonitorCommand,
shield::ShieldCommand, wrap::WrapCommand, Execute,
};
#[derive(Parser)]
#[command(
name = "kindly-tools",
about = "Development tools and utilities for KindlyGuard ecosystem",
version,
author
)]
struct Cli {
#[command(subcommand)]
command: Commands,
#[arg(short, long, global = true)]
verbose: bool,
}
#[derive(Subcommand)]
enum Commands {
Scan {
path: String,
#[arg(short, long, default_value = "table")]
format: String,
#[arg(short, long)]
recursive: bool,
#[arg(short, long)]
extensions: Option<String>,
#[arg(long, default_value = "10")]
max_size_mb: u64,
#[arg(short, long)]
config: Option<String>,
},
Install(InstallCommand),
Mcp(McpCommand),
Dev(DevCommand),
Wrap(WrapCommand),
Monitor(MonitorCommand),
Shield(ShieldCommand),
}
#[tokio::main]
async fn main() -> Result<()> {
let cli = Cli::parse();
let filter = if cli.verbose {
EnvFilter::new("kindly_tools=debug,info")
} else {
EnvFilter::new("kindly_tools=info,warn")
};
tracing_subscriber::fmt()
.with_env_filter(filter)
.with_target(false)
.init();
match cli.command {
Commands::Scan {
path,
format,
recursive,
extensions,
max_size_mb,
config,
} => {
use kindly_tools::commands::scan;
scan::execute(path, format, recursive, extensions, max_size_mb, config).await
},
Commands::Install(cmd) => cmd.execute().await,
Commands::Mcp(cmd) => cmd.execute().await,
Commands::Dev(cmd) => cmd.execute().await,
Commands::Wrap(cmd) => cmd.execute().await,
Commands::Monitor(cmd) => cmd.execute().await,
Commands::Shield(cmd) => cmd.execute().await,
}
}