mod api;
mod commands;
mod config;
use anyhow::Result;
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(
name = "zeroski",
version,
about = "CLI for the Zero runtime (zero.ski) — @-protocol, streaming chat, trace feed",
long_about = None,
)]
struct Cli {
#[arg(long, global = true)]
base: Option<String>,
#[arg(long, global = true)]
key: Option<String>,
#[command(subcommand)]
cmd: Cmd,
}
#[derive(Subcommand)]
enum Cmd {
Chat {
#[arg(trailing_var_arg = true)]
text: Vec<String>,
#[arg(long)]
model: Option<String>,
},
At {
cmd: String,
#[arg(trailing_var_arg = true)]
text: Vec<String>,
#[arg(long)]
json: Option<String>,
},
Me,
Traces {
#[arg(long)]
agent: Option<String>,
#[arg(long, default_value_t = 20)]
limit: u32,
},
Config,
}
#[tokio::main]
async fn main() -> Result<()> {
let cli = Cli::parse();
let cfg = config::Config::resolve(cli.base, cli.key)?;
match cli.cmd {
Cmd::Chat { text, model } => commands::chat::run(&cfg, text, model).await,
Cmd::At { cmd, text, json } => commands::at::run(&cfg, cmd, text, json).await,
Cmd::Me => commands::me::run(&cfg).await,
Cmd::Traces { agent, limit } => commands::traces::run(&cfg, agent, limit).await,
Cmd::Config => commands::config_cmd::run(&cfg),
}
}