openfunctions-rs 0.1.0

A universal framework for creating and managing LLM tools and agents
Documentation
//! The `build` command for compiling tools and agents.

use crate::core::{Builder, Config};
use anyhow::Result;
use clap::Args;

/// A command for building tools and agents.
#[derive(Args, Debug)]
pub struct BuildCommand {
    /// The specific target to build (a tool or agent name).
    /// If not provided, all tools and agents will be built.
    pub target: Option<String>,
}

impl BuildCommand {
    /// Executes the `build` command.
    pub async fn execute(&self, config: &Config) -> Result<()> {
        let builder = Builder::new(config.clone());
        if let Some(target) = &self.target {
            builder.build_target(target).await?;
        } else {
            builder.build_all().await?;
        }
        Ok(())
    }
}