weavatrix_rust_refactor/lib.rs
1//! Evidence-backed refactor operations for Weavatrix.
2//!
3//! This crate is to [`weavatrix_rust`] what a writer is to a reader: it consumes the read-only
4//! evidence graph and produces `weavatrix.edit-plan.v1` envelopes, then applies them through
5//! [`weavatrix_worktree`]'s crash-recoverable transaction. It owns no protocol; the MCP host
6//! (`weavatrix-refactor`) composes this catalog with the read-only one.
7//!
8//! # The contract is frozen, not re-derived
9//!
10//! The eleven tool names, their schemas and every result state were recorded from the shipping
11//! JavaScript implementation into `contract/refactor-tools.v1.json`. An operation here is
12//! conformant when it answers with a status from that file — never a new one, never a renamed
13//! one. That is what makes this an incremental replacement rather than a second protocol.
14//!
15//! # Safety boundary
16//!
17//! Producing a plan is a read. Applying one requires all three gates: the host exposes the edit
18//! capability, `WEAVATRIX_ALLOW_SOURCE_EDITS=1` is set, and the call presents a single-use token
19//! bound to that exact plan and repository. Nothing in this crate writes without them.
20
21pub mod contract;
22pub mod coordinates;
23pub mod declaration;
24pub mod envelope;
25pub mod evidence;
26pub mod operations;
27pub mod plan;
28pub mod resolve;
29pub mod specifier;
30#[cfg(test)]
31mod test_support;
32pub mod token;
33
34/// Version of this crate, reported by the host beside the engine version.
35pub const VERSION: &str = env!("CARGO_PKG_VERSION");
36
37/// Version of the frozen tool contract this crate implements.
38pub const CONTRACT_VERSION: u32 = 1;
39
40pub use contract::{ResultState, ToolContract};
41pub use operations::{Operation, call, catalog, catalog_names};