ironflow_engine/lib.rs
1//! # ironflow-engine
2//!
3//! Workflow orchestration engine for **ironflow**.
4//!
5//! Workflows are defined as Rust-native handlers implementing
6//! [`WorkflowHandler`](handler::WorkflowHandler). Handlers receive a
7//! [`WorkflowContext`](context::WorkflowContext) and can chain step outputs,
8//! use native `if`/`else`/`match` for conditional branching, and execute
9//! steps in parallel.
10//!
11//! Handlers can be executed inline or enqueued for a background worker.
12//!
13//! ## Custom operations
14//!
15//! Implement [`Operation`](operation::Operation) to define custom step types
16//! (e.g. GitLab, Gmail, Slack) that integrate into the workflow lifecycle.
17//! Call [`WorkflowContext::operation()`](context::WorkflowContext::operation)
18//! inside a handler to execute them with full step tracking.
19//!
20//! # Example
21//!
22//! ```no_run
23//! use ironflow_engine::prelude::*;
24//! use std::future::Future;
25//! use std::pin::Pin;
26//!
27//! struct DeployWorkflow;
28//!
29//! impl WorkflowHandler for DeployWorkflow {
30//! fn name(&self) -> &str { "deploy" }
31//! fn execute<'a>(&'a self, ctx: &'a mut WorkflowContext) -> HandlerFuture<'a> {
32//! Box::pin(async move {
33//! let build = ctx.shell("build", ShellConfig::new("cargo build")).await?;
34//! ctx.agent("review", AgentStepConfig::new(
35//! &format!("Review: {}", build.output["stdout"])
36//! )).await?;
37//! Ok(())
38//! })
39//! }
40//! }
41//! ```
42
43pub mod artifact;
44pub mod budget;
45pub mod config;
46pub mod context;
47pub mod engine;
48pub mod error;
49pub mod executor;
50pub mod fsm;
51pub mod handler;
52pub mod log_sender;
53pub mod notify;
54pub mod operation;
55pub mod retry_policy;
56pub mod run_creator;
57pub mod schedule;
58
59/// Convenience re-exports.
60pub mod prelude {
61 pub use crate::artifact::{ArtifactSink, ArtifactUpload, DirectArtifactSink};
62 pub use crate::budget::BudgetConfig;
63 pub use crate::config::{AgentStepConfig, ApprovalConfig, HttpConfig, ShellConfig, StepConfig};
64 pub use crate::context::WorkflowContext;
65 pub use crate::engine::{Engine, EnqueueOptions};
66 pub use crate::error::EngineError;
67 pub use crate::fsm::{RunEvent, RunFsm, StepEvent, StepFsm};
68 pub use crate::handler::{HandlerFuture, WorkflowHandler};
69 pub use crate::notify::{
70 Event, EventPublisher, EventSubscriber, WebhookSubscriber, WorkflowEvent, WorkflowEventBus,
71 };
72 pub use crate::operation::Operation;
73 pub use crate::run_creator::{CreateRunOpts, RunCreator};
74 pub use crate::schedule::CronSchedule;
75}