2026-03-18 22:44:52 -04:00
|
|
|
// cli.rs — Command-line argument parsing
|
|
|
|
|
//
|
|
|
|
|
// All fields are Option<T> so unset args don't override config file
|
|
|
|
|
// values. The layering order is:
|
|
|
|
|
// defaults < config file < CLI args
|
|
|
|
|
//
|
|
|
|
|
// Subcommands:
|
|
|
|
|
// (none) Launch the TUI agent
|
|
|
|
|
// read Print new output since last check and exit
|
|
|
|
|
// write <msg> Send a message to the running agent
|
|
|
|
|
|
|
|
|
|
use clap::{Parser, Subcommand};
|
|
|
|
|
use std::path::PathBuf;
|
|
|
|
|
|
|
|
|
|
#[derive(Parser, Debug)]
|
|
|
|
|
#[command(name = "poc-agent", about = "Substrate-independent AI agent")]
|
|
|
|
|
pub struct CliArgs {
|
|
|
|
|
/// Select active backend ("anthropic" or "openrouter")
|
|
|
|
|
#[arg(long)]
|
|
|
|
|
pub backend: Option<String>,
|
|
|
|
|
|
|
|
|
|
/// Model override
|
|
|
|
|
#[arg(short, long)]
|
|
|
|
|
pub model: Option<String>,
|
|
|
|
|
|
|
|
|
|
/// API key override
|
|
|
|
|
#[arg(long)]
|
|
|
|
|
pub api_key: Option<String>,
|
|
|
|
|
|
|
|
|
|
/// Base URL override
|
|
|
|
|
#[arg(long)]
|
|
|
|
|
pub api_base: Option<String>,
|
|
|
|
|
|
|
|
|
|
/// Enable debug logging
|
|
|
|
|
#[arg(long)]
|
|
|
|
|
pub debug: bool,
|
|
|
|
|
|
|
|
|
|
/// Print effective config with provenance and exit
|
|
|
|
|
#[arg(long)]
|
|
|
|
|
pub show_config: bool,
|
|
|
|
|
|
|
|
|
|
/// Override all prompt assembly with this file
|
|
|
|
|
#[arg(long)]
|
|
|
|
|
pub system_prompt_file: Option<PathBuf>,
|
|
|
|
|
|
|
|
|
|
/// Project memory directory
|
|
|
|
|
#[arg(long)]
|
|
|
|
|
pub memory_project: Option<PathBuf>,
|
|
|
|
|
|
|
|
|
|
/// Max consecutive DMN turns
|
|
|
|
|
#[arg(long)]
|
|
|
|
|
pub dmn_max_turns: Option<u32>,
|
|
|
|
|
|
|
|
|
|
#[command(subcommand)]
|
|
|
|
|
pub command: Option<SubCmd>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Subcommand, Debug)]
|
|
|
|
|
pub enum SubCmd {
|
|
|
|
|
/// Print new output since last read and exit
|
|
|
|
|
Read {
|
|
|
|
|
/// Stream output continuously instead of exiting
|
|
|
|
|
#[arg(short, long)]
|
|
|
|
|
follow: bool,
|
2026-03-21 23:39:12 -04:00
|
|
|
/// Block until a complete response is received, then exit
|
|
|
|
|
#[arg(long)]
|
|
|
|
|
block: bool,
|
2026-03-18 22:44:52 -04:00
|
|
|
},
|
|
|
|
|
/// Send a message to the running agent
|
|
|
|
|
Write {
|
|
|
|
|
/// The message to send
|
|
|
|
|
message: Vec<String>,
|
|
|
|
|
},
|
|
|
|
|
}
|