gabriel / muse public
feat BREAKING task/cohen-transform #1 / 1
gabriel · 63 days ago · Apr 13, 2026 · Diff

feat: Cohen Transform — muse checkout -m and muse diff --conflict

Named in honour of Bram Cohen (creator of BitTorrent, Manyana CRDT weave), whose conflict-presentation insight is the direct inspiration.

New: muse/core/cohen_transform.py - Three-way line merge with sync-region algorithm (same approach as Bazaar merge3) - classify_action(): 'inserted' / 'deleted' / 'modified' - annotate_hunk_action(): rewrites @@ headers with [side: action] labels - compute_regions(): decomposes three sequences into MergeRegion objects - three_way_merge_lines(): full diff3-style merge with Cohen action labels - format_conflict_diff(): two-sided labeled diff for conflict review (base→ours and base→theirs, each hunk annotated with its action)

New: muse checkout -m / --merge - Carries uncommitted working-tree changes across a branch switch via three-way merge (base=HEAD, ours=workdir, theirs=target branch) - Clean merges written silently; conflicts written with diff3 + action labels - Binary files detected and left at target version with conflict record - MERGE_STATE.json written on conflict (same format as muse merge, so muse checkout --ours/--theirs works identically for resolution)

New: muse diff --conflict - Reads MERGE_STATE, renders format_conflict_diff() for each conflict path - Per-hunk action annotations show what each side did at a glance - JSON mode: {status: 'conflict', conflicts: [{path, ours_diff, theirs_diff}]} - --path filter supported; exits non-zero when conflicts remain

Fix: agent-config regex in run_set() - Old: r"\[agent-config\][^\[]*" — broke on [ inside array values - New: r"^\[agent-config\].*?(?=^\[|\Z)" with DOTALL|MULTILINE

New tests: 131 tests across 3 files (89 unit + 42 integration) - test_core_cohen_transform.py: unit/integration/stress/data-integrity/security - test_cmd_checkout.py: TestCheckoutMerge* — parser, clean, conflict, errors - test_cmd_diff.py: TestDiffConflict* — parser, no-merge, output, security - test_core_snapshot.py: TestNestedRepoWalk — 16 boundary tests - test_cmd_agent_config.py: expanded to 75 tests covering all set() paths

sha256:2087dbb987c55a1ca7d5f8a956f9cef32356c609c98f18a48eb2f13b0c95e7ab sha
sha256:57e89f87044e4c8581eb6daacfa41a8d483d0289dc6bd0d2c324faa8d9e18c05 snapshot
← Older Oldest on task/cohen-transform
All commits
Newer → Latest on task/cohen-transform

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:2087dbb987c55a1ca7d5f8a956f9cef32356c609c98f18a48eb2f13b0c95e7ab --body "your comment"