mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-09-01 09:09:19 +00:00
Add CLI subcommands for WASM tool management
Introduces a new CLI module with subcommands for managing WASM tools: - `tool install`: Build and install tools from source or .wasm files - `tool list`: List installed tools with optional verbose output - `tool remove`: Remove installed tools - `tool info`: Show detailed tool information including capabilities The install command supports building from Cargo source directories using cargo-component, or installing pre-compiled .wasm files directly. It auto-detects capabilities JSON sidecar files and validates them before installation. Co-Authored-By: Claude Opus 4.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
9232e623e8
commit
d1cb748914
@@ -0,0 +1,53 @@
|
||||
//! CLI command handling.
|
||||
//!
|
||||
//! Provides subcommands for:
|
||||
//! - Running the agent (`run`)
|
||||
//! - Managing WASM tools (`tool install`, `tool list`, `tool remove`)
|
||||
//! - Managing secrets (`secret set`, `secret list`, `secret remove`)
|
||||
|
||||
mod tool;
|
||||
|
||||
pub use tool::{ToolCommand, run_tool_command};
|
||||
|
||||
use clap::{Parser, Subcommand};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(name = "near-agent")]
|
||||
#[command(about = "LLM-powered autonomous agent for the NEAR AI marketplace")]
|
||||
#[command(version)]
|
||||
pub struct Cli {
|
||||
#[command(subcommand)]
|
||||
pub command: Option<Command>,
|
||||
|
||||
/// Run in interactive CLI mode only (disable other channels)
|
||||
#[arg(long, global = true)]
|
||||
pub cli_only: bool,
|
||||
|
||||
/// Skip database connection (for testing)
|
||||
#[arg(long, global = true)]
|
||||
pub no_db: bool,
|
||||
|
||||
/// Configuration file path (optional, uses env vars by default)
|
||||
#[arg(short, long, global = true)]
|
||||
pub config: Option<std::path::PathBuf>,
|
||||
}
|
||||
|
||||
#[derive(Subcommand, Debug)]
|
||||
pub enum Command {
|
||||
/// Run the agent (default if no subcommand given)
|
||||
Run,
|
||||
|
||||
/// Manage WASM tools
|
||||
#[command(subcommand)]
|
||||
Tool(ToolCommand),
|
||||
// Future: Secret management
|
||||
// #[command(subcommand)]
|
||||
// Secret(SecretCommand),
|
||||
}
|
||||
|
||||
impl Cli {
|
||||
/// Check if we should run the agent (default behavior or explicit `run` command).
|
||||
pub fn should_run_agent(&self) -> bool {
|
||||
matches!(self.command, None | Some(Command::Run))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user