feat(cli): add weave apply to materialize entity edits onto files#123
Merged
Conversation
weave tracks entity edits in the CRDT (via the MCP tools and claim flows) but had no way to write them back to the working files, so an edit stayed in the CRDT and never reached disk. `weave apply <files...>` closes that loop: it reconstructs each file from its authoritative CRDT entity content plus the interstitial text between entities, and writes it out. This is the write side of weave. Paired with sem on the read side, an agent reads and understands code with sem, edits entities in weave's CRDT, and runs `weave apply` to project those edits onto the files, entirely in entity space and immune to line drift. Reuses the existing find_repo_root and reconstruct_file_from_crdt; the command only wires them to disk.
There was a problem hiding this comment.
inspect review
Triage: 4 entities analyzed | 0 critical, 0 high, 3 medium, 1 low
Verdict: standard_review
Findings (0)
Reviewed by inspect | Entity-level triage found 0 high-risk changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
weave tracks entity edits in the CRDT (via the MCP tools and claim flows) but had no way to write them back to the working files, so an edit stayed in the CRDT and never reached disk.
weave apply <files...>closes that loop: it reconstructs each file from its authoritative CRDT entity content plus the interstitial text between entities, and writes it out.Why
This is the write side of weave. Paired with sem on the read side, an agent reads and understands code with sem, edits entities in weave's CRDT, and runs
weave applyto project those edits onto the files, entirely in entity space and immune to line drift.How
Reuses the existing
find_repo_rootandreconstruct_file_from_crdt; the command only wires them to disk. Verified end to end locally: edit an entity via the MCP,weave apply <file>, and sem confirms the structural edit landed with untouched entities and whitespace preserved.Follow-up (not in this PR)
sync_from_filesshould gain an authority guard so a local entity edit is never clobbered by a re-sync, making the CRDT genuinely the source of truth under concurrent activity.