WEAVATRIX REFACTOR 0.1.5
MIT · EXPLICIT WRITE BOUNDARY

Refactor with evidence, not blind text replacement.

Weavatrix Refactor composes the full read-only Core with 11 tools that identify a change, expose uncertainty, preview against the current tree, apply atomically, refresh the graph and roll back.

Install 0.1.5 See every method ↓
# preview and analysis remain read-only
$ npx -y weavatrix-refactor <repoRoot>

# enable only the sessions allowed to apply and roll back source edits
$ WEAVATRIX_ALLOW_SOURCE_EDITS=1 npx -y weavatrix-refactor <repoRoot>

Rename is complete, not PLANNED

rename_symbol and rename_related_symbols own their full two-phase operation. The same method previews first, then applies the exact recomputed plan when called with its single-use confirmation token.

PHASE 1 · READ-ONLY

Preview the exact operation

rename_symbol
symbol: src/users.ts#getUser@12
new_name: getCustomer

PREVIEW_OK
confirmToken: short-lived, plan-bound
completeness + uncovered references
PHASE 2 · ATOMIC WRITE

Confirm through the same method

rename_symbol
same symbol + same new_name
mode: apply
confirm_token: <preview token>

APPLIED
all files written or all restored
durable rollback bundle retained

Coordinated rename: rename_related_symbols validates up to 50 JS/TS renames together, rejects overlaps, chains, swaps, shadowing and any failed sub-rename, then commits the set as one transaction.

All 11 Refactor methods

Four complete write workflows, four applyable plan producers and three structural review tools. Every uncertainty stays visible instead of being converted into a guessed edit.

rename_symbol

Cross-language preview/confirm/apply rename using exact JS/TS LSP, schema-aware SQL or strict graph-plus-lexical evidence.

rename_related_symbols

Several JS/TS renames in one language-server session, one conflict check and one atomic multi-file transaction.

apply_edit_plan

Generic two-phase executor for hash-bound weavatrix.edit-plan.v1 envelopes.

rollback_last_apply

Restores the latest pre-apply bundle and refuses to overwrite files that drifted after apply.

change_signature

Adds or removes JS/TS parameters with byte-exact declaration and call-argument surgery; spreads stay uncertain.

edit_symbol

Replaces a symbol body or inserts before/after its parser range, with a JS/TS parse gate.

bulk_replace

Two-stage literal or regex replacement over selected, stable occurrence IDs and exact expected counts.

organize_imports

Removes only provably unused named JS/TS imports; side-effect, default and namespace imports fail safe.

move_file

Builds a relocate review, import rewrites and architecture projection without pretending file relocation is a text edit.

move_symbol

Projects cycles, boundaries, target dependencies and blast radius before a declaration is moved.

delete_readiness

Returns safe, unsafe or UNPROVEN with references and dynamic risks; deletion is never automated.

One proof chain from target to rollback

The write layer does not replace Core analysis. It carries the same graph, provenance and revision through the edit and back into verification.

  1. IDENTIFYStable symbol ID, parser range, callers and blast radius.
  2. PLANExact before/after text, sha256, provenance and uncertainty.
  3. CONFIRMShort-lived token bound to repository and executable plan.
  4. APPLYLock, stale-tree recheck, bottom-up edits, all-or-nothing write.
  5. VERIFYRefresh graph; inspect impact, architecture, tests and rollback.

Three write gates

Install the separate package, select its refactor profile, start with WEAVATRIX_ALLOW_SOURCE_EDITS=1, then present the exact single-use token.

Stale-tree protection

Under the repository lock, every file hash and exact before string must still match the preview.

Transactional recovery

A mid-write failure restores already-written files. The durable rollback bundle remains retryable after an incomplete restore.

Path and encoding boundary

Traversal, escaping links, NTFS streams, non-UTF-8 files, invalid ranges, overlaps and split surrogate pairs are rejected before writing.

Language support says exactly what is proven

A backend never claims more certainty than its evidence supports. Graph-plus-lexical rename remains PARTIAL even when every known reference is found.

SurfaceBackendApplyable proofCompleteness
JavaScript / TypeScript renameBundled language serverEXACT_LSPCOMPLETE when boundary is proven
SQL tables / fieldsSchema-aware scannerEXTRACTED / LEXICAL_EXACTSkipped and ambiguous uses reported
Python / Rust / GoGraph + exact lexical locationEXTRACTED / LEXICAL_EXACTPARTIAL
Java / C# / SolidityGraph + exact lexical locationEXTRACTED / LEXICAL_EXACTPARTIAL
JS/TS signatures and importsParser + graph calls/referencesEXTRACTED / RESOLVEDUnproven reach stays explicit

Honest limits: related multi-symbol rename is JS/TS-only; move_file and move_symbol are review/projection tools; exported deletion cannot receive an automatic clean verdict; tests, typechecking, runtime checks and review remain the release authority.