Weavatrix Refactor
Native MCP server for repository intelligence with proven, transactional refactoring.
One process answers both halves: every read-only operation of the
weavatrix-rust engine and the eleven
refactor tools from
weavatrix-rust-refactor. A refactor
session therefore stays in one evidence chain, on one graph revision, with no second process to
keep in step.
weavatrix-rust reusable read-only evidence engine
|
+-- weavatrix read-only MCP host
|
+-- weavatrix-rust-refactor refactor operations
|
+-- weavatrix-refactor this MCP host
1.0 is the engine change. Versions 0.1.x were a JavaScript package hosting the
weavatrix-jsengine. That implementation continues asweavatrix-refactor-js, which picks up the version line at 0.1.6 whereweavatrix-refactor@0.1.5left off. Installweavatrix-refactor-js, or pinweavatrix-refactor@0.1.5, to stay on it. The two keep separate state directories on purpose, so they never share a lock, a token store, or a rollback journal.
Run it
For an MCP client:
Every analysis and preview tool works as configured above. Source writes fail closed. Add
"env": {"WEAVATRIX_ALLOW_SOURCE_EDITS": "1"} only for a session in which apply and rollback are
deliberately authorized.
The three write gates
Repository source changes require all three:
- this package is installed, so refactor tools exist in the catalog at all;
- the server was started with
WEAVATRIX_ALLOW_SOURCE_EDITS=1, read once at startup — a gate that a tool argument could flip would not be a gate; - the apply call presents a valid, unexpired, single-use token bound to that exact plan and repository.
The command line is not a way around this: weavatrix-refactor tool <writing-tool> refuses with
the same WRITE_GATE_CLOSED status.
The contract is frozen
The eleven tool names, their schemas and all 47 result states were recorded from the shipping
JavaScript implementation into
contract/refactor-tools.v1.json, which is compiled into
weavatrix-rust-refactor as the only source of the tool catalog. A client written against 0.1.x
sees the same names, the same arguments and the same statuses here.
The rewrite is finished
All eleven refactor operations are native Rust. Dispatch has no fallback arm, so a tool added to the contract fails to compile rather than answering "not supported" at run time. See docs/rust-migration.md for how it was done.
| Area | State |
|---|---|
| MCP host, merged catalog, write gate | done |
| Safety kernel (containment, UTF-16 ranges, fingerprints, tokens, locking, atomic write, rollback) | provided by weavatrix-edit / weavatrix-worktree |
| Graph-native planners (rename, related rename, bulk replace, symbol edit, move, delete readiness) | done |
| Signature change and import organisation | done |
NOT_SUPPORTED survives only as a per-call answer where an engine cannot prove
something about the input it was given. It is never the answer for a whole tool.
Every planner is PARTIAL, on purpose
Call sites come from graph edges. That proves the sites a plan edits; it cannot prove
the absence of other references, so nothing here claims COMPLETE. A same-named
occurrence the graph does not vouch for is reported as an UNPROVEN_OCCURRENCE
rather than edited — the difference between renaming a symbol and find-replacing a
string, and the reason a second declaration sharing the name comes out untouched.
License
MIT.