Skip to main content

systemprompt_cli/commands/build/
mod.rs

1//! The `build` command group for compiling the workspace and MCP extensions.
2//!
3//! [`BuildCommands`] dispatches to the core workspace build and the MCP
4//! extension build; [`types`] holds the shared result rows surfaced by both.
5
6mod core;
7mod mcp;
8pub mod types;
9
10use anyhow::{Context, Result};
11use clap::Subcommand;
12
13use crate::CliConfig;
14use crate::shared::render_result;
15
16#[derive(Debug, Clone, Copy, Subcommand)]
17pub enum BuildCommands {
18    #[command(about = "Build Rust workspace (systemprompt-core)")]
19    Core(core::CoreArgs),
20
21    #[command(about = "Build MCP extensions")]
22    Mcp(mcp::McpArgs),
23}
24
25pub fn execute(cmd: BuildCommands, config: &CliConfig) -> Result<()> {
26    match cmd {
27        BuildCommands::Core(args) => {
28            let result = core::execute(args, config).context("Failed to build core")?;
29            render_result(&result);
30            Ok(())
31        },
32        BuildCommands::Mcp(args) => {
33            let result = mcp::execute(args, config).context("Failed to build MCP extensions")?;
34            render_result(&result);
35            Ok(())
36        },
37    }
38}