
Weavatrix Refactor Js
io.github.sergii-ziborov由 GitHub 帳號 sergii-ziborov 發布v0.1.6更新於 Oct 24, 2026
Transactional refactoring MCP with 11 evidence-backed tools, hash-bound previews, and rollback.
概覽
本機 MCP 伺服器,為編碼助理提供有證據支撐、交易化的 JavaScript/TypeScript 重構,包含雜湊綁定的預覽、原子寫入與回復。
- 可以做什麼
- 預覽、確認並套用跨語言符號重新命名,涵蓋 JS/TS、SQL、Python、Rust、Go、Java、C# 與 Solidity,並支援多個符號合併為一次交易
- 為簽章修改、符號本體編輯、批次取代與匯入清理產生可證明的編輯計畫,再以原子方式套用
- 審查結構性變更:檔案與符號搬移的架構與循環相依投影,以及刪除就緒度檢查
- 回復最近一次套用,並透過內建的唯讀程式碼智慧工具(相依圖、影響範圍、稽核、架構、端點)檢視結果
- 適用情境
- 當助理需要在程式碼庫中進行真實的多檔案原始碼修改,且希望每項變更都被證明、預覽並可回復,而不是盲目寫入時使用。適合重視過期檔案偵測、來源證據與回復的重構情境。
- 執行需求
- 透過 npx(Node.js)在本機執行,需傳入儲存庫路徑參數;僅限桌面端,stdio 傳輸。寫入原始碼還需設定 WEAVATRIX_ALLOW_SOURCE_EDITS=1 並提供有效的單次確認權杖。可選 WEAVATRIX_PRECISION(lsp 或 off)與 WEAVATRIX_REFACTOR_HOME 用於回復快照儲存。未宣告驗證。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Weavatrix Refactor Js,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Weavatrix Refactor JS
Part of the Weavatrix ecosystem. This repository preserves the explicit JavaScript refactoring line.
This is the JavaScript refactoring engine of Weavatrix, continued as
weavatrix-refactor-js. Theweavatrix-refactorpackage ships the native Rust MCP host built on weavatrix-rust and theweavatrix-edit/weavatrix-refactor-plan/weavatrix-worktreecrates. This package continues that version line:[email protected]was the last JavaScript release under the old name, and[email protected]picks up from it. Installweavatrix-refactor-js, or pin[email protected], to stay on the JavaScript implementation.
Evidence-backed, transactional refactoring for coding agents.
weavatrix-refactor-js is the write-capable member of the JavaScript family. It
combines the complete read-only weavatrix-js code-intelligence MCP with 11
refactoring tools that can prove a change, preview it against the current
working tree, apply it atomically, refresh the graph, and roll it back.
Engine boundary: this package hosts the
weavatrix-jsengine. It does not use the nativeweavatrix-rustengine, and installing both packages does not silently upgrade this one's analysis layer. Its state lives in~/.weavatrix-refactor-js, kept separate from the Rust host's so the two never share a lock, a token store, or a rollback journal.
It is substantially more than a rename wrapper:
- semantic JS/TS rename through the bundled language server;
- SQL table and field rename with schema-aware evidence;
- strict graph-plus-lexical rename for Python, Rust, Go, Java, C#, and Solidity;
- several related JS/TS renames merged into one atomic transaction;
- signature, symbol-body, import, bulk-replace, move, and delete-safety workflows;
- byte-exact file hashes,
beforetext, provenance, uncertainty, and graph revision in every applyable plan; - stale-tree detection, repository locking, rollback bundles, and automatic rollback after a mid-write failure;
- architecture and cycle projection before structural moves;
- post-change blast-radius and verification tools inherited from the core.
Why this is a separate package
The MIT weavatrix-js core is physically read-only: its published artifact has no
repository source-write path. This package is the explicit write
boundary. Installing it and selecting its refactor profile makes the edit
capability visible; without this package, the server cannot modify source.
The split is a safety property, not packaging cosmetics:
Architecture
The implementation is a ports-and-adapters system with one-way boundaries:
- Model validates the frozen
weavatrix.edit-plan.v1envelope and applies byte-exact edits as pure string transformations. - Platform adapters own real-path containment, atomic replacement, repository locks, single-use tokens, and durable rollback bundles.
- Plan engines compute rename, signature, symbol, import, move, delete, and bulk-replace evidence without owning the write workflow.
- Application workflows bind a preview to the current repository, issue and consume confirmation tokens, apply under a lock, and restore on failure.
- MCP adapter composes the 11 refactor tools with the read-only
weavatrix-jscatalog and exposes one stdio server.
The checked-in strict architecture contract enforces zero runtime cycles, files no longer than 300 lines, and functions no longer than 100 lines. It has no exceptions or ratchet baseline.
What makes the refactor workflow different
An ordinary editor rename answers: "Which text edits should I make now?" Weavatrix Refactor also answers:
The system fails closed when proof is insufficient. It never upgrades an
INFERRED edge into an applyable edit and never hides an ambiguous reference.
The complete rename workflow
rename_symbol and rename_related_symbols are complete operations, not
PLANNED-only helpers. Each method owns both phases.
1. Preview
Call the rename method normally:
The method computes the rename, validates every plan file against the working
tree, and returns PREVIEW_OK with a short-lived confirmToken. Preview never
writes source and does not require the environment write gate.
2. Apply through the same method
Repeat the same operation inputs and add the confirmation:
The tool recomputes the deterministic plan, verifies that the token belongs to
that plan and repository, takes the repository lock, rechecks hashes and
before text, writes a rollback bundle, and applies every edit bottom-up.
The same contract applies to a coordinated set:
rename_related_symbols detects overlapping edits, chains, swaps, shadowing
risk, and per-sub-rename failure before it issues a token. Apply is one atomic
multi-file operation.
Refactoring tools
Complete write workflows
Proven plan producers
These plans are applied with apply_edit_plan, using the same preview, token,
atomic-write, and rollback protocol as rename.
Structural review and safety tools
Language and proof matrix
Edit-plan proof envelope
Every applyable plan uses weavatrix.edit-plan.v1. Its load-bearing fields are:
- operation and graph revision;
- repository-relative target paths only;
- sha256 of every target file;
- exact 1-based line and UTF-16 character ranges;
- exact
beforeandaftertext; - per-edit provenance;
uncertainReferences,notModified, warnings, and completeness.
The applier additionally protects against:
- absolute paths, traversal,
.gitcasing/trailing-dot tricks, NTFS streams, and escaping symlinks/junctions; - non-UTF-8 or oversized files;
- overlapping edits, stale ranges, lone surrogates, and edits that split surrogate pairs;
- two writers interleaving in the same repository;
- token reuse, expiry, repository mismatch, or plan mismatch;
- partial writes and incomplete rollback.
createdAt is provenance metadata and is the only field excluded from the
confirmation fingerprint. This allows a rename method to recompute the same
plan on its apply call; every executable field remains token-bound.
Result states agents can act on
Planner-specific states such as NOT_FOUND, NO_CHANGE, CONFLICT,
BLOCKED, UNPROVEN, and NOT_SUPPORTED remain visible instead of being
collapsed into a generic failure.
The three write gates
Repository source changes require all three:
weavatrix-refactor-jsis installed and therefactorprofile selectsedit;- the server starts with
WEAVATRIX_ALLOW_SOURCE_EDITS=1; - the apply call presents a valid, unexpired, single-use token bound to the exact plan and repository.
Preview and every read-only analysis remain available while the environment gate is closed.
End-to-end change proof
The package includes all 34 read-only core tools in the same MCP server. A strong refactor session can therefore stay in one evidence chain:
inspect_symbol,context_bundle, orget_dependentsidentifies the exact target;rename_symbol,change_signature,move_symbol, or another refactor tool previews the change;- the write workflow applies atomically;
- the next graph call auto-refreshes changed files and reverse importers;
verified_changecompares callers, imports, and references against the merge base;change_impact,verify_architecture,coverage_map,run_audit, andfind_duplicatesinspect the consequences.
Useful inherited surfaces include:
- architecture maps and navigation:
module_map,query_graph,shortest_path,context_bundle; - impact and proof:
change_impact,get_dependents,prepare_change,verified_change; - health:
run_audit,find_dead_code,find_duplicates,coverage_map,hot_path_review; - contracts:
list_endpoints,trace_endpoint,trace_api_contract; - target architecture:
get_architecture_contract,verify_architecture,explain_architecture_violation; - repository control:
open_repo,rebuild_graph,graph_diff,list_known_repos.
See the weavatrix-js README for the complete JavaScript host catalog.
Run it
Start the merged read-only-plus-refactor MCP server for one repository:
For an MCP client, the minimal configuration is:
On Windows, use npx.cmd when the client does not resolve command shims.
With no environment override, every analysis and preview tool works but source
writes fail closed. Add "env": {"WEAVATRIX_ALLOW_SOURCE_EDITS": "1"} only
for a session in which apply and rollback are deliberately authorized.
Applications that already host weavatrix-js can compose the same extension:
The exported extension registers tools and the refactor capability profile;
it does not silently open the write gate.
Scope and honest limits
- Related multi-symbol rename is currently JS/TS-only.
move_filecannot rename the file throughapply_edit_plan; it is a review plan because file relocation has different filesystem semantics.move_symbolis a topology/architecture dry-run, not byte-edit synthesis.- Graph+lexical language backends cannot prove reference completeness and stay
PARTIALeven when every known reference was located. delete_readinessnever auto-deletes, and public/exported APIs cannot receive an automatic clean verdict.- Tests, typechecking, runtime checks, and human review remain the release authority. Weavatrix supplies bounded evidence; it does not fabricate proof.
Package boundary
The refactor package extends the legacy JavaScript core only through
weavatrix-js/extension-api and weavatrix-js/analysis-kit; it does not copy
or relicense that core. The canonical weavatrix package is the native Rust
engine and is not this JavaScript extension host.
License
MIT.
來源:README.md,提交 01eb296
工具
0版本歷史
1- v0.1.6最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分