Project

tree_haver

0.0
No release in over 3 years
Backend registry, parser request/result contracts, and tree-sitter language-pack integration for Structured Merge.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

StructuredMerge Ruby

StructuredMerge Ruby provides Ruby gems for building merge-aware tools that need portable structured-merge contracts, fixture-backed behavior, and Ruby-native integration points.

The monorepo includes the core AST/review contracts, parser substrate support, format-specific merge gems, binary/ZIP planning helpers, provider adapters, and a Ruby packaging recipe gem.

Project links:

Install

Install the gems your tool needs:

bundle add ast-merge json-merge

Command

The Ruby implementation ships the implementation-specific smorg-rb command. Use that name in git configuration unless a package manager or local install has provided a smorg symlink.

Package-manager formulas may expose the selected implementation as smorg. For a local user-created symlink:

ln -s "$(command -v smorg-rb)" ~/.local/bin/smorg
git config merge.smorg-rb.driver 'smorg-rb merge-driver %O %A %B %P'
git config diff.smorg-rb.command 'smorg-rb diff-driver'
smorg-rb conflicts diff path/to/file-with-conflicts.go
smorg-rb languages --gitattributes

merge-driver updates Git's %A file by default, or writes to --output when used outside git. diff-driver accepts both the two-argument local form and the seven- or nine-argument forms Git passes to external diff commands. conflicts diff reports conflict-marker regions in a file that already contains Git conflict markers.

Current semantic merge-driver coverage is fixture-backed for JSON. Other language and format paths should be treated as git-compatible command surfaces until their ast-merge-git coverage is promoted.

Gems

Core:

  • tree_haver - parser substrate, byte ranges, backend adapters, and binary tree contracts.
  • ast-merge - AST merge contracts, diagnostics, planning, review, replay, and nested-merge vocabulary.
  • ast-template - template/session transport contracts.

Format libraries:

Provider and recipe gems:

Portability

The Ruby gems are developed against the shared StructuredMerge fixtures. Those fixtures define the cross-language behavior expected from the Go, TypeScript, Rust, and Ruby implementations. Conformance checks live in gem specs and in the shared spec/fixture tooling rather than in a static status document.

Development

Common checks:

  • mise run check
  • bundle exec rake
  • package-specific bundle exec rspec commands

Bundler path gems are the default isolation mechanism inside this monorepo. When this repository needs to consume sibling workspace projects outside the monorepo itself, prefer nomono-driven Bundler wiring rather than manual Ruby load-path changes.