systemprompt-cli 0.1.22

systemprompt.io OS - CLI for agent orchestration, AI operations, and system management
Documentation
pub mod types;

mod capabilities;
mod config;
mod list;
mod run;
mod show;
mod validate;

pub mod mcp;

use anyhow::{Context, Result};
use clap::Subcommand;

use crate::CliConfig;
use crate::descriptor::{CommandDescriptor, DescribeCommand};
use crate::shared::render_result;

#[derive(Debug, Subcommand)]
pub enum PluginsCommands {
    #[command(about = "List all discovered extensions")]
    List(list::ListArgs),

    #[command(about = "Show detailed extension information")]
    Show(show::ShowArgs),

    #[command(about = "Run a CLI extension command", trailing_var_arg = true)]
    Run(run::RunArgs),

    #[command(about = "Validate extension dependencies and configurations")]
    Validate(validate::ValidateArgs),

    #[command(about = "Show extension configuration")]
    Config(config::ConfigArgs),

    #[command(about = "List capabilities across all extensions")]
    Capabilities(capabilities::CapabilitiesArgs),

    #[command(subcommand, about = "MCP server management")]
    Mcp(mcp::McpCommands),
}

impl DescribeCommand for PluginsCommands {
    fn descriptor(&self) -> CommandDescriptor {
        match self {
            Self::Mcp(
                mcp::McpCommands::Logs(_)
                | mcp::McpCommands::List(_)
                | mcp::McpCommands::ListPackages(_),
            )
            | Self::Run(_) => CommandDescriptor::PROFILE_ONLY,
            Self::Mcp(_) => CommandDescriptor::FULL,
            _ => CommandDescriptor::PROFILE_ONLY.with_remote_eligible(),
        }
    }
}

pub async fn execute(cmd: PluginsCommands, config: &CliConfig) -> Result<()> {
    match cmd {
        PluginsCommands::List(args) => {
            render_result(&list::execute(&args, config));
            Ok(())
        },
        PluginsCommands::Show(args) => {
            let result = show::execute(&args, config).context("Failed to show extension")?;
            render_result(&result);
            Ok(())
        },
        PluginsCommands::Run(args) => run::execute(args, config).await,
        PluginsCommands::Validate(args) => {
            render_result(&validate::execute(&args, config));
            Ok(())
        },
        PluginsCommands::Config(args) => {
            let result =
                config::execute(&args, config).context("Failed to get extension config")?;
            render_result(&result);
            Ok(())
        },
        PluginsCommands::Capabilities(args) => {
            capabilities::execute(args, config);
            Ok(())
        },
        PluginsCommands::Mcp(cmd) => mcp::execute_with_config(cmd, config).await,
    }
}