Skip to main content

planspec_core/
lib.rs

1//! # PlanSpec Core
2//!
3//! Core types and validation for the PlanSpec declarative work orchestration system.
4//!
5//! ## Overview
6//!
7//! This crate provides the foundational types for PlanSpec resources:
8//! - [`Goal`] - High-level objectives with acceptance criteria
9//! - [`Plan`] - DAGs of work with embedded nodes and edges
10//! - [`Capability`] - Reusable abilities that agents can provide
11//! - [`Binding`] - Resolution of capabilities to provider targets
12//! - [`Execution`] - Intent to run a Plan with specific bindings
13//!
14//! ## Example
15//!
16//! ```rust
17//! use planspec_core::{Goal, GoalSpec, ObjectMeta};
18//!
19//! let goal = Goal {
20//!     api_version: "planspec.io/v1alpha1".to_string(),
21//!     kind: "Goal".to_string(),
22//!     metadata: ObjectMeta::new("my-goal", "default"),
23//!     spec: GoalSpec {
24//!         description: "Implement feature X".to_string(),
25//!         ..Default::default()
26//!     },
27//!     status: None,
28//! };
29//! ```
30
31mod resource;
32pub mod types;
33pub mod validate;
34
35#[cfg(test)]
36mod tests;
37
38// Re-export commonly used types at crate root
39pub use resource::Resource;
40pub use types::api::{
41    AppliedResource, ApplyAction, ApplyError, ApplyResult, ListMeta, ResourceList, Status,
42    StatusCause, StatusDetails, StatusReason, StatusResult, WatchEvent, WatchEventType,
43};
44pub use types::binding::{
45    Binding, BindingPhase, BindingRule, BindingSelector, BindingSpec, BindingStatus, BindingTarget,
46};
47pub use types::capability::{
48    Capability, CapabilityInput, CapabilityOutput, CapabilityParamType, CapabilityPhase,
49    CapabilityRequirement, CapabilitySpec, CapabilityStatus,
50};
51pub use types::context::{ContextFormat, ContextItem};
52pub use types::execution::{
53    Artifact, Execution, ExecutionPhase, ExecutionSpec, ExecutionStatus, NodePhase, NodeStatus,
54};
55pub use types::gate::{
56    Gate, GatePhase, GateSpec, GateStatus, GateType, Resolution, ResolutionOutcome, ReviewAction,
57    ReviewActionType, TargetRef,
58};
59pub use types::goal::{AcceptanceCriterion, Goal, GoalPhase, GoalSpec, GoalStatus, LabelSelector};
60pub use types::meta::{Condition, ConditionStatus, ObjectMeta, ObjectReference, OwnerReference};
61pub use types::plan::{
62    AcceptanceCriteria, Edge, EdgeType, EstimatedEffort, ExpectedResponse, Graph, GraphError, Node,
63    NodeKind, Plan, PlanPhase, PlanSpec, PlanStatus,
64};
65pub use validate::{ValidationError, Validator};
66
67/// The API version for all PlanSpec resources
68pub const API_VERSION: &str = "planspec.io/v1alpha1";