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//!
6//! Copyright (c) systemprompt.io — Business Source License 1.1.
7//! See <https://systemprompt.io> for licensing details.
8
9mod core;
10pub mod mcp;
11pub mod types;
12
13use anyhow::{Context, Result};
14use clap::Subcommand;
15
16use crate::context::CommandContext;
17use crate::shared::render_result;
18
19#[derive(Debug, Clone, Copy, Subcommand)]
20pub enum BuildCommands {
21    #[command(about = "Build Rust workspace (systemprompt-core)")]
22    Core(core::CoreArgs),
23
24    #[command(about = "Build MCP extensions")]
25    Mcp(mcp::McpArgs),
26}
27
28pub fn execute(cmd: BuildCommands, ctx: &CommandContext) -> Result<()> {
29    match cmd {
30        BuildCommands::Core(args) => {
31            let result = core::execute(args, &ctx.cli).context("Failed to build core")?;
32            render_result(&result, &ctx.cli);
33            Ok(())
34        },
35        BuildCommands::Mcp(args) => {
36            let result = mcp::execute(args, &ctx.cli).context("Failed to build MCP extensions")?;
37            render_result(&result, &ctx.cli);
38            Ok(())
39        },
40    }
41}