Skip to main content

Crate weavatrix_rust_refactor

Crate weavatrix_rust_refactor 

Source
Expand description

Evidence-backed refactor operations for Weavatrix.

This crate is to weavatrix_rust what a writer is to a reader: it consumes the read-only evidence graph and produces weavatrix.edit-plan.v1 envelopes, then applies them through weavatrix_worktree’s crash-recoverable transaction. It owns no protocol; the MCP host (weavatrix-refactor) composes this catalog with the read-only one.

§The contract is frozen, not re-derived

The eleven tool names, their schemas and every result state were recorded from the shipping JavaScript implementation into contract/refactor-tools.v1.json. An operation here is conformant when it answers with a status from that file — never a new one, never a renamed one. That is what makes this an incremental replacement rather than a second protocol.

§Safety boundary

Producing a plan is a read. Applying one requires all three gates: the host exposes the edit capability, WEAVATRIX_ALLOW_SOURCE_EDITS=1 is set, and the call presents a single-use token bound to that exact plan and repository. Nothing in this crate writes without them.

Re-exports§

pub use contract::ResultState;
pub use contract::ToolContract;
pub use operations::Operation;
pub use operations::call;
pub use operations::catalog;
pub use operations::catalog_names;

Modules§

contract
The frozen tool contract, embedded rather than restated.
coordinates
Graph positions to edit-plan positions.
declaration
The full source range of a declaration.
envelope
Reading a weavatrix.edit-plan.v1 envelope into the typed plan the worktree applies.
evidence
Risk signals that make an absence of references unprovable.
operations
The refactor operation surface.
plan
Building a weavatrix.edit-plan.v1 envelope.
resolve
Turning what an agent typed into exactly one graph node.
specifier
Relative import specifiers, and what moving a file does to them.
token
Gate three: a confirmation bound to one plan, one repository, and one use.

Constants§

CONTRACT_VERSION
Version of the frozen tool contract this crate implements.
VERSION
Version of this crate, reported by the host beside the engine version.