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:
- Website: https://structuredmerge.org
- Implementations: https://structuredmerge.org/implementations.html
- Specification: https://github.com/structuredmerge/structuredmerge-spec
- Shared fixtures: https://github.com/structuredmerge/structuredmerge-fixtures
Install
Install the gems your tool needs:
bundle add ast-merge json-mergeCommand
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/smorggit 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 --gitattributesmerge-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:
plain-mergejson-mergeyaml-mergetoml-mergemarkdown-mergeruby-mergego-mergerust-mergetypescript-mergebinary-mergezip-merge
Provider and recipe gems:
psych-mergecitrus-toml-mergeparslet-toml-mergecommonmarker-mergekramdown-mergemarkly-mergeprism-mergekettle-jem
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 checkbundle exec rake- package-specific
bundle exec rspeccommands
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.