Skip to main content

ready_set_sdk/
lib.rs

1//! # ready-set-sdk
2//!
3//! Shared conventions and helpers for `ready-set` plugins.
4//!
5//! The SDK is the typed Rust mirror of the contracts under
6//! [`docs/contracts/`](https://github.com/pulsearc-ai/ready-set/tree/main/docs/contracts).
7//! Plugins are not required to use the SDK — any binary on PATH can be a
8//! plugin — but using it makes plugins consistent with first-party tools and
9//! saves writing the same boilerplate.
10//!
11//! ## What lives here
12//!
13//! - [`context`]: per-invocation state ([`Context`]), populated from the
14//!   `READY_SET_*` env contract.
15//! - [`capability`]: product capability descriptors and lifecycle reports.
16//! - [`output`]: human/JSON output formatting ([`Output`]).
17//! - [`exit_code`]: documented process exit codes ([`ExitCode`]).
18//! - [`change_log`]: append-only JSONL change log for reversibility.
19//! - [`describe`]: `__describe` subcommand support.
20//! - [`manifest`]: plugin manifest sidecar parsing.
21//! - [`sandbox`]: per-platform sandbox trait (no-op stubs in v0.1.0).
22//! - [`config`]: `.ready-set.toml` loader.
23//! - [`fs`]: filesystem helpers (atomic writes, hashing).
24//! - [`dispatch`]: cross-plugin dispatch helper.
25//! - [`logging`]: tracing setup honoring the env contract.
26//! - [`error`]: SDK-wide error type.
27//!
28//! ## Minimal plugin shape
29//!
30//! ```no_run
31//! use ready_set_sdk::prelude::*;
32//! use ready_set_sdk::describe::{Describe, Stability, Platform};
33//!
34//! fn describe() -> Describe {
35//!     Describe {
36//!         description: "Example plugin".into(),
37//!         version: "0.1.0".parse().unwrap(),
38//!         stability: Stability::Experimental,
39//!         min_dispatcher_version: "0.1.0".parse().unwrap(),
40//!         platforms: vec![Platform::Linux, Platform::Macos, Platform::Windows],
41//!         requires_cargo_workspace: false,
42//!         capabilities: Vec::new(),
43//!     }
44//! }
45//!
46//! fn main() -> std::process::ExitCode {
47//!     let descr = describe();
48//!     if let Some(code) = descr.handle_arg0_describe(std::env::args_os()) {
49//!         return code.into();
50//!     }
51//!     let ctx = Context::from_env();
52//!     let mut out = Output::for_context(&ctx, std::io::stdout());
53//!     out.human("hello world");
54//!     ExitCode::Ok.into()
55//! }
56//! ```
57
58#![forbid(unsafe_code)]
59#![warn(missing_docs)]
60
61pub mod capability;
62pub mod change_log;
63pub mod config;
64pub mod context;
65pub mod describe;
66pub mod dispatch;
67pub mod error;
68pub mod exit_code;
69pub mod fs;
70pub mod lifecycle;
71pub mod logging;
72pub mod manifest;
73pub mod output;
74pub mod prelude;
75pub mod sandbox;
76
77pub use capability::{
78    CapabilityAction, CapabilityActionKind, CapabilityDescriptor, CapabilityId,
79    CapabilityRelevance, CapabilityReport, CapabilityRunReport, CapabilityState, CapabilityVerb,
80    NextAction, ProviderId, RunStatus,
81};
82pub use context::Context;
83pub use error::{Error, Result};
84pub use exit_code::ExitCode;
85pub use lifecycle::{LifecycleRequest, LifecycleRequestError, parse_lifecycle_request};
86pub use output::{Output, OutputMode};