Skip to main content

cruxx_script/
lib.rs

1/// cruxx-script: YAML-driven pipeline scripting for the cruxx agentic DSL.
2///
3/// Define agent pipelines declaratively in YAML files, register step handlers
4/// in Rust, and execute without recompilation.
5pub mod expr;
6pub mod registry;
7pub mod runner;
8pub mod schema;
9
10use schema::PipelineDef;
11
12/// Load a pipeline definition from a YAML string.
13pub fn load(yaml: &str) -> Result<PipelineDef, serde_saphyr::Error> {
14    serde_saphyr::from_str(yaml)
15}
16
17/// Load a pipeline definition from a file path.
18pub fn load_file(path: impl AsRef<std::path::Path>) -> Result<PipelineDef, LoadError> {
19    let contents = std::fs::read_to_string(path)?;
20    Ok(serde_saphyr::from_str(&contents)?)
21}
22
23#[derive(Debug, thiserror::Error)]
24pub enum LoadError {
25    #[error("IO error: {0}")]
26    Io(#[from] std::io::Error),
27    #[error("YAML parse error: {0}")]
28    Yaml(#[from] serde_saphyr::Error),
29}
30
31pub use registry::HandlerRegistry;
32pub use runner::Runner;