repolith_core/lib.rs
1//! Core types, traits, manifest parser, and plan computation for repolith.
2//!
3//! This crate is the foundation of the workspace. It carries **no `tokio`
4//! runtime dependency** — only lightweight runtime-agnostic combinators
5//! from `futures` (used inside `Plan::compute` to fan probes out
6//! concurrently). The orchestrator + executor live one crate up in
7//! `repolith-engine`, which pulls in `tokio`. The split lets downstream
8//! consumers (CLI, future TUI/LSP, telemetry) pull the lightweight types
9//! here without dragging the runtime tree.
10//!
11//! # Modules at a glance
12//!
13//! - [`types`] — value types: `ActionId`, `Sha256`, `BuildEvent`, `Ctx`
14//! (carries the `CancellationToken`), `BuildError`, `ExecMode`.
15//! - [`action`] — `trait Action`: `id`, `deps`, `input_hash`, `execute`.
16//! - [`cache`] — `trait Cache` + `CacheError`. Implementations live in
17//! `repolith-cache`.
18//! - [`plan`] — `Plan::compute` (Kahn topological sort + cascading
19//! staleness via `ChangeReason`).
20//! - [`manifest`] — `Manifest::from_toml` (parse + validate
21//! `repolith.toml`).
22//!
23//! # Typical use
24//!
25//! ```ignore
26//! use repolith_core::manifest::Manifest;
27//!
28//! let toml = std::fs::read_to_string("repolith.toml")?;
29//! let manifest = Manifest::from_toml(&toml)?;
30//! for id in manifest.action_ids() {
31//! println!("{id}");
32//! }
33//! ```
34//!
35//! Actually executing the plan happens through `repolith-engine`'s
36//! `Orchestrator`, which consumes the types defined here.
37
38/// Value types used across the workspace.
39pub mod types;
40
41/// `Action` trait — one unit of orchestrated work.
42pub mod action;
43
44/// `Cache` trait + `CacheError`. Concrete backends live in dependent crates.
45pub mod cache;
46
47/// Layered execution plan with cascading staleness reasons.
48pub mod plan;
49
50/// Manifest schema and parser (`repolith.toml`).
51pub mod manifest;
52
53/// Run-time path containment (`contain_within`) — shared by actions that
54/// resolve user-supplied relative paths (docker, federation).
55pub mod paths;