Anybuild documentation
Rust SDK
Use the same detection and orchestration pipeline without spawning the CLI.
Project facade
Rust
use anybuild::{Anybuild, BuildOptions, RunOptions};
let project = Anybuild::new(".") .with_subdir("apps/web") .with_env("ANYBUILD_NODE_VERSION", "22");
let plan = project.plan(Default::default())?;let build = project.build(BuildOptions::default())?;let run = project.run(RunOptions::default().start())?;
# Ok::<(), anybuild::Error>(())Operations and outcomes
| Method | Outcome |
|---|---|
| generate | GeneratedAnybuild: path, content, provider, effective config. |
| plan | ProjectPlan: provider, config, services, evaluated Serve. |
| build | BuildOutcome: plan and state directory. |
| run | RunOutcome: executed and skipped command names. |
| deploy | DeployOutcome: published identity or written config path. |
| auto | AutoOutcome combining optional generation, build, run, and deploy. |
Typed execution options
| Type | Choices |
|---|---|
BuildEnvironment | Local or Docker(DockerOptions). |
RuntimeEnvironment | Local or Wasmer(WasmerOptions). |
GenerationPolicy | IfMissing, Always, or Temporary. |
DeployTarget | Publish { owner, name } or WriteConfig { path }. |
ProcessIo | Inherit subprocess streams or emit them as Events. |
Environment isolation
Anybuild::new snapshots the process environment. Per-instance with_env values override that snapshot, and inherit_process_env(false) creates a deterministic empty base environment without mutating global process state.
Events and process I/O
The SDK is silent for Anybuild-generated output until an EventHandler is installed. ProcessIo::Inherit keeps subprocesses interactive; ProcessIo::Events captures stdout and stderr as redacted structured events.
Errors
anybuild::Error exposes an ErrorKind, operation name, project path, and underlying source. Error kinds are non-exhaustive so callers can handle broad categories safely.