Skip to content

Latest commit

 

History

683 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StructuredMerge Rust

StructuredMerge Rust provides Cargo crates for native tools that need portable structured-merge contracts, fixture-backed behavior, and embeddable merge components.

The workspace includes the core AST/review contracts, parser substrate support, format-specific merge crates, binary/ZIP planning helpers, provider adapters, and a Rust packaging recipe crate.

Project links:

The distribution architecture defines how the Rust kernel, parser providers, application bundles, and Alef-generated host adapters fit together.

Behavioral Authority

The mature Ruby implementation is the StructuredMerge behavioral golden master. This Rust implementation is a conformance consumer and currently lags Ruby in behavior and defect fixes. Shared specifications and fixtures are portable evidence admitted from reviewed Ruby behavior; historical Rust behavior does not override Ruby when they disagree.

Names containing parity describe only the dimensions asserted by their cited fixtures. They do not claim complete behavioral equivalence with Ruby unless a versioned conformance profile explicitly says so.

Package Family

StructuredMerge Rust is a layered crate family. The lower layers provide parser, range, AST, merge, and template contracts; format crates apply those contracts to specific languages and data formats; provider crates bind a format family to a parser or serializer; workflow crates package Rust project maintenance and Git-driver behavior.

Each crate README keeps this section short and links here. This root guide is the implementation inventory for Rust users who need to choose crates, understand backend coverage, or wire a focused backend into a test suite.

The family is intentionally layered:

Crate Layer What it provides
tree-haver Parser substrate Parser backend registry, byte ranges, node wrappers, source locations, and binary tree contracts.
ast-merge Merge substrate AST merge contracts, diagnostics, planning, review, replay, and nested merge vocabulary.
ast-template Template substrate Template/session transport contracts.
ast-crispr Structured edits AST edit recipes for generated blocks and template-owned regions.
ast-merge-git Git integration Merge-driver, diff-driver, conflict inspection, and language registry plumbing for smorg-rs.
plain-merge Text Plain-text fallback contracts.
json-merge JSON and JSONC Object/array-aware JSON merge behavior using tree-sitter-language-pack where selected.
yaml-merge YAML YAML-family merge contracts.
toml-merge TOML TOML-family merge contracts.
markdown-merge Markdown Markdown-family merge contracts.
ruby-merge Ruby source Ruby source merge contracts.
go-merge Go source Go source merge contracts.
rust-merge Rust source Rust source merge contracts.
typescript-merge TypeScript source TypeScript source merge contracts.
binary-merge Binary Binary tree planning contracts.
zip-merge Archives ZIP archive planning helpers.
yaml-serde-merge YAML provider Uses serde_yaml as the YAML parser/emitter provider path.
pest-toml-merge TOML provider Uses Pest with pest_grammars as the TOML parser provider path.
pulldown-cmark-merge Markdown provider Uses pulldown-cmark as the Markdown parser provider path.
kettle-rusty Recipe tooling Cargo workspace maintenance and package recipe helpers.

Install

Add the crates your tool needs:

[dependencies]
ast-merge = "0.1"
tree-haver = "0.1"

Binary and ZIP use StructuredMerge-prefixed package names on crates.io:

structuredmerge-binary-merge = "0.1"
structuredmerge-zip-merge = "0.1"

Command

The Rust implementation ships the implementation-specific smorg-rs 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-rs)" ~/.local/bin/smorg
git config merge.smorg-rs.driver 'smorg-rs merge-driver %O %A %B %P'
git config diff.smorg-rs.command 'smorg-rs diff-driver'
smorg-rs conflicts diff path/to/file-with-conflicts.go
smorg-rs 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.

Semantic merge-driver coverage is fixture-backed for JSON. Other language and format paths are git-compatible command surfaces without semantic driver coverage.

Crates

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 crates:

Portability

The Rust crates are developed against the shared StructuredMerge fixtures. Those fixtures encode portable behavior derived from the Ruby golden master and reviewed for cross-runtime use. Conformance checks live in crate tests and in the shared spec/fixture tooling rather than in a static status document.

Development

Common checks:

  • mise run check
  • cargo test

About

Rust implementation of the StructuredMerge contract

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages