{"id":33711474,"url":"https://github.com/kettle-rb/prism-merge","last_synced_at":"2026-02-22T14:47:00.817Z","repository":{"id":327473381,"uuid":"1108676640","full_name":"kettle-rb/prism-merge","owner":"kettle-rb","description":"☯️ Intelligently merges two versions of a Ruby file using Prism AST analysis. It's like a smart \"git merge\" specifically designed for Ruby code.","archived":false,"fork":false,"pushed_at":"2026-02-17T05:13:29.000Z","size":801,"stargazers_count":17,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-17T09:44:24.456Z","etag":null,"topics":["merge","prism","ruby","template"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kettle-rb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"buy_me_a_coffee":"pboling","community_bridge":null,"github":["pboling"],"issuehunt":"pboling","ko_fi":"pboling","liberapay":"pboling","open_collective":"kettle-rb","patreon":"galtzo","polar":"pboling","thanks_dev":"u/gh/pboling","tidelift":"rubygems/prism-merge"}},"created_at":"2025-12-02T19:08:56.000Z","updated_at":"2026-02-17T05:00:48.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/kettle-rb/prism-merge","commit_stats":null,"previous_names":["kettle-rb/prism-merge"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/kettle-rb/prism-merge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kettle-rb%2Fprism-merge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kettle-rb%2Fprism-merge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kettle-rb%2Fprism-merge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kettle-rb%2Fprism-merge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kettle-rb","download_url":"https://codeload.github.com/kettle-rb/prism-merge/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kettle-rb%2Fprism-merge/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29617075,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T13:04:20.082Z","status":"ssl_error","status_checked_at":"2026-02-19T13:03:33.775Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["merge","prism","ruby","template"],"created_at":"2025-12-04T03:03:11.867Z","updated_at":"2026-02-22T14:47:00.804Z","avatar_url":"https://github.com/kettle-rb.png","language":"Ruby","funding_links":["https://buymeacoffee.com/pboling","https://github.com/sponsors/pboling","https://issuehunt.io/r/pboling","https://ko-fi.com/pboling","https://liberapay.com/pboling","https://opencollective.com/kettle-rb","https://patreon.com/galtzo","https://polar.sh/pboling","https://thanks.dev/u/gh/pboling","https://tidelift.com/funding/github/rubygems/prism-merge","https://tidelift.com/badges/package/rubygems/prism-merge","https://liberapay.com/pboling/donate","https://ko-fi.com/O5O86SNP4","https://img.buymeacoffee.com/button-api/?text=Buy%20me%20a%20latte\u0026emoji=\u0026slug=pboling\u0026button_colour=FFDD00\u0026font_colour=000000\u0026font_family=Cookie\u0026outline_colour=000000\u0026coffee_colour=ffffff","https://www.buymeacoffee.com/pboling","https://www.paypal.com/paypalme/peterboling","https://tidelift.com/subscription/pkg/rubygems-prism-merge?utm_source=rubygems-prism-merge\u0026utm_medium=referral\u0026utm_campaign=readme","https://blog.tidelift.com/tidelift-joins-sonar"],"categories":["Ruby"],"sub_categories":[],"readme":"[![Galtzo FLOSS Logo by Aboling0, CC BY-SA 4.0][🖼️galtzo-i]][🖼️galtzo-discord] [![ruby-lang Logo, Yukihiro Matsumoto, Ruby Visual Identity Team, CC BY-SA 2.5][🖼️ruby-lang-i]][🖼️ruby-lang] [![kettle-rb Logo by Aboling0, CC BY-SA 4.0][🖼️kettle-rb-i]][🖼️kettle-rb]\n\n[🖼️galtzo-i]: https://logos.galtzo.com/assets/images/galtzo-floss/avatar-192px.svg\n[🖼️galtzo-discord]: https://discord.gg/3qme4XHNKN\n[🖼️ruby-lang-i]: https://logos.galtzo.com/assets/images/ruby-lang/avatar-192px.svg\n[🖼️ruby-lang]: https://www.ruby-lang.org/\n[🖼️kettle-rb-i]: https://logos.galtzo.com/assets/images/kettle-rb/avatar-192px.svg\n[🖼️kettle-rb]: https://github.com/kettle-rb\n\n# ☯️ Prism::Merge\n\n[![Version][👽versioni]][👽version] [![GitHub tag (latest SemVer)][⛳️tag-img]][⛳️tag] [![License: MIT][📄license-img]][📄license-ref] [![Downloads Rank][👽dl-ranki]][👽dl-rank] [![Open Source Helpers][👽oss-helpi]][👽oss-help] [![CodeCov Test Coverage][🏀codecovi]][🏀codecov] [![Coveralls Test Coverage][🏀coveralls-img]][🏀coveralls] [![QLTY Test Coverage][🏀qlty-covi]][🏀qlty-cov] [![QLTY Maintainability][🏀qlty-mnti]][🏀qlty-mnt] [![CI Heads][🚎3-hd-wfi]][🚎3-hd-wf] [![CI Runtime Dependencies @ HEAD][🚎12-crh-wfi]][🚎12-crh-wf] [![CI Current][🚎11-c-wfi]][🚎11-c-wf] [![CI Truffle Ruby][🚎9-t-wfi]][🚎9-t-wf] [![Deps Locked][🚎13-🔒️-wfi]][🚎13-🔒️-wf] [![Deps Unlocked][🚎14-🔓️-wfi]][🚎14-🔓️-wf] [![CI Supported][🚎6-s-wfi]][🚎6-s-wf] [![CI Test Coverage][🚎2-cov-wfi]][🚎2-cov-wf] [![CI Style][🚎5-st-wfi]][🚎5-st-wf] [![CodeQL][🖐codeQL-img]][🖐codeQL] [![Apache SkyWalking Eyes License Compatibility Check][🚎15-🪪-wfi]][🚎15-🪪-wf]\n\n`if ci_badges.map(\u0026:color).detect { it != \"green\"}` ☝️ [let me know][🖼️galtzo-discord], as I may have missed the [discord notification][🖼️galtzo-discord].\n\n---\n\n`if ci_badges.map(\u0026:color).all? { it == \"green\"}` 👇️ send money so I can do more of this. FLOSS maintenance is now my full-time job.\n\n[![OpenCollective Backers][🖇osc-backers-i]][🖇osc-backers] [![OpenCollective Sponsors][🖇osc-sponsors-i]][🖇osc-sponsors] [![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor] [![Liberapay Goal Progress][⛳liberapay-img]][⛳liberapay] [![Donate on PayPal][🖇paypal-img]][🖇paypal] [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] [![Donate on Polar][🖇polar-img]][🖇polar] [![Donate at ko-fi.com][🖇kofi-img]][🖇kofi]\n\n\u003cdetails\u003e\n    \u003csummary\u003e👣 How will this project approach the September 2025 hostile takeover of RubyGems? 🚑️\u003c/summary\u003e\n\nI've summarized my thoughts in [this blog post](https://dev.to/galtzo/hostile-takeover-of-rubygems-my-thoughts-5hlo).\n\n\u003c/details\u003e\n\n## 🌻 Synopsis\n\nPrism::Merge is a standalone Ruby module that intelligently merges two versions of a Ruby file using Prism AST analysis. It's like a smart \"git merge\" specifically designed for Ruby code. I wrote this to aid in my comprehensive gem templating tool [kettle-dev][kettle-dev].\n\n### Key Features\n\n- **AST-Aware**: Uses Prism parser to understand Ruby structure\n- **Intelligent**: Matches nodes by structural signatures\n- **Fuzzy Method Matching**: `MethodMatchRefiner` matches similar method names and signatures\n  (e.g., `process_user` ↔ `process_users`) using Levenshtein distance\n- **Recursive Merge**: Automatically merges class and module bodies recursively, intelligently combining nested methods and constants\n- **Comment-Preserving**: Comments are properly attached to relevant nodes and/or placement\n- **Freeze Block Support**: Respects freeze markers (default: `prism-merge:freeze` / `prism-merge:unfreeze`) for template merge control - customizable to match your project's conventions\n- **Full Provenance**: Tracks origin of every line\n- **Standalone**: No dependencies other than `prism` and `version_gem` (which is a tiny tool all my gems depend on)\n- **Customizable**:\n  - `signature_generator` - callable custom signature generators\n  - `preference` - setting of `:template`, `:destination`, or a Hash for per-node-type preferences\n  - `node_typing` - Hash mapping node types to callables for per-node-type merge customization (see [ast-merge][ast-merge] docs)\n  - `add_template_only_nodes` - setting to retain nodes that do not exist in destination\n  - `freeze_token` - customize freeze block markers (default: `\"prism-merge\"`)\n  - `match_refiners` - array of refiners for fuzzy matching (e.g., `MethodMatchRefiner`)\n\n### Example\n\n```ruby\nrequire \"prism/merge\"\n\ntemplate = File.read(\"template.rb\")\ndestination = File.read(\"destination.rb\")\n\nmerger = Prism::Merge::SmartMerger.new(template, destination)\nresult = merger.merge\n\nFile.write(\"merged.rb\", result)\n```\n\n### The `*-merge` Gem Family\n\nThe `*-merge` gem family provides intelligent, AST-based merging for various file formats. At the foundation is [tree_haver][tree_haver], which provides a unified cross-Ruby parsing API that works seamlessly across MRI, JRuby, and TruffleRuby.\n\n| Gem                                      |                                                         Version / CI                                                         | Language\u003cbr\u003e/ Format | Parser Backend(s)                                                                                     | Description                                                                      |\n|------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------:|----------------------|-------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------|\n| [tree_haver][tree_haver]                 |                 [![Version][tree_haver-gem-i]][tree_haver-gem] \u003cbr/\u003e [![CI][tree_haver-ci-i]][tree_haver-ci]                 | Multi                | Supported Backends: MRI C, Rust, FFI, Java, Prism, Psych, Commonmarker, Markly, Citrus, Parslet       | **Foundation**: Cross-Ruby adapter for parsing libraries (like Faraday for HTTP) |\n| [ast-merge][ast-merge]                   |                   [![Version][ast-merge-gem-i]][ast-merge-gem] \u003cbr/\u003e [![CI][ast-merge-ci-i]][ast-merge-ci]                   | Text                 | internal                                                                                              | **Infrastructure**: Shared base classes and merge logic for all `*-merge` gems   |\n| [bash-merge][bash-merge]                 |                 [![Version][bash-merge-gem-i]][bash-merge-gem] \u003cbr/\u003e [![CI][bash-merge-ci-i]][bash-merge-ci]                 | Bash                 | [tree-sitter-bash][ts-bash] (via tree_haver)                                                          | Smart merge for Bash scripts                                                     |\n| [commonmarker-merge][commonmarker-merge] | [![Version][commonmarker-merge-gem-i]][commonmarker-merge-gem] \u003cbr/\u003e [![CI][commonmarker-merge-ci-i]][commonmarker-merge-ci] | Markdown             | [Commonmarker][commonmarker] (via tree_haver)                                                         | Smart merge for Markdown (CommonMark via comrak Rust)                            |\n| [dotenv-merge][dotenv-merge]             |             [![Version][dotenv-merge-gem-i]][dotenv-merge-gem] \u003cbr/\u003e [![CI][dotenv-merge-ci-i]][dotenv-merge-ci]             | Dotenv               | internal                                                                                              | Smart merge for `.env` files                                                     |\n| [json-merge][json-merge]                 |                 [![Version][json-merge-gem-i]][json-merge-gem] \u003cbr/\u003e [![CI][json-merge-ci-i]][json-merge-ci]                 | JSON                 | [tree-sitter-json][ts-json] (via tree_haver)                                                          | Smart merge for JSON files                                                       |\n| [jsonc-merge][jsonc-merge]               |               [![Version][jsonc-merge-gem-i]][jsonc-merge-gem] \u003cbr/\u003e [![CI][jsonc-merge-ci-i]][jsonc-merge-ci]               | JSONC                | [tree-sitter-jsonc][ts-jsonc] (via tree_haver)                                                        | ⚠️ Proof of concept; Smart merge for JSON with Comments                          |\n| [markdown-merge][markdown-merge]         |         [![Version][markdown-merge-gem-i]][markdown-merge-gem] \u003cbr/\u003e [![CI][markdown-merge-ci-i]][markdown-merge-ci]         | Markdown             | [Commonmarker][commonmarker] / [Markly][markly] (via tree_haver), [Parslet][parslet]                  | **Foundation**: Shared base for Markdown mergers with inner code block merging   |\n| [markly-merge][markly-merge]             |             [![Version][markly-merge-gem-i]][markly-merge-gem] \u003cbr/\u003e [![CI][markly-merge-ci-i]][markly-merge-ci]             | Markdown             | [Markly][markly] (via tree_haver)                                                                     | Smart merge for Markdown (CommonMark via cmark-gfm C)                            |\n| [prism-merge][prism-merge]               |               [![Version][prism-merge-gem-i]][prism-merge-gem] \u003cbr/\u003e [![CI][prism-merge-ci-i]][prism-merge-ci]               | Ruby                 | [Prism][prism] (`prism` std lib gem)                                                                  | Smart merge for Ruby source files                                                |\n| [psych-merge][psych-merge]               |               [![Version][psych-merge-gem-i]][psych-merge-gem] \u003cbr/\u003e [![CI][psych-merge-ci-i]][psych-merge-ci]               | YAML                 | [Psych][psych] (`psych` std lib gem)                                                                  | Smart merge for YAML files                                                       |\n| [rbs-merge][rbs-merge]                   |                   [![Version][rbs-merge-gem-i]][rbs-merge-gem] \u003cbr/\u003e [![CI][rbs-merge-ci-i]][rbs-merge-ci]                   | RBS                  | [tree-sitter-rbs][ts-rbs] (via tree_haver), [RBS][rbs] (`rbs` std lib gem)                            | Smart merge for Ruby type signatures                                             |\n| [toml-merge][toml-merge]                 |                 [![Version][toml-merge-gem-i]][toml-merge-gem] \u003cbr/\u003e [![CI][toml-merge-ci-i]][toml-merge-ci]                 | TOML                 | [Parslet + toml][toml], [Citrus + toml-rb][toml-rb], [tree-sitter-toml][ts-toml] (all via tree_haver) | Smart merge for TOML files                                                       |\n\n#### Backend Platform Compatibility\n\ntree_haver supports multiple parsing backends, but not all backends work on all Ruby platforms:\n\n| Platform 👉️\u003cbr\u003e TreeHaver Backend 👇️          | MRI | JRuby | TruffleRuby | Notes                                                                      |\n|-------------------------------------------------|:---:|:-----:|:-----------:|----------------------------------------------------------------------------|\n| **MRI** ([ruby_tree_sitter][ruby_tree_sitter])  |  ✅  |   ❌   |      ❌      | C extension, MRI only                                                      |\n| **Rust** ([tree_stump][tree_stump])             |  ✅  |   ❌   |      ❌      | Rust extension via magnus/rb-sys, MRI only                                 |\n| **FFI** ([ffi][ffi])                            |  ✅  |   ✅   |      ❌      | TruffleRuby's FFI doesn't support `STRUCT_BY_VALUE`                        |\n| **Java** ([jtreesitter][jtreesitter])           |  ❌  |   ✅   |      ❌      | JRuby only, requires grammar JARs                                          |\n| **Prism** ([prism][prism])                      |  ✅  |   ✅   |      ✅      | Ruby parsing, stdlib in Ruby 3.4+                                          |\n| **Psych** ([psych][psych])                      |  ✅  |   ✅   |      ✅      | YAML parsing, stdlib                                                       |\n| **Citrus** ([citrus][citrus])                   |  ✅  |   ✅   |      ✅      | Pure Ruby PEG parser, no native dependencies                               |\n| **Parslet** ([parslet][parslet])                |  ✅  |   ✅   |      ✅      | Pure Ruby PEG parser, no native dependencies                               |\n| **Commonmarker** ([commonmarker][commonmarker]) |  ✅  |   ❌   |      ❓      | Rust extension for Markdown (via [commonmarker-merge][commonmarker-merge]) |\n| **Markly** ([markly][markly])                   |  ✅  |   ❌   |      ❓      | C extension for Markdown  (via [markly-merge][markly-merge])               |\n\n**Legend**: ✅ = Works, ❌ = Does not work, ❓ = Untested\n\n**Why some backends don't work on certain platforms**:\n\n- **JRuby**: Runs on the JVM; cannot load native C/Rust extensions (`.so` files)\n- **TruffleRuby**: Has C API emulation via Sulong/LLVM, but it doesn't expose all MRI internals that native extensions require (e.g., `RBasic.flags`, `rb_gc_writebarrier`)\n- **FFI on TruffleRuby**: TruffleRuby's FFI implementation doesn't support returning structs by value, which tree-sitter's C API requires\n\n**Example implementations** for the gem templating use case:\n\n| Gem                      | Purpose         | Description                                   |\n|--------------------------|-----------------|-----------------------------------------------|\n| [kettle-dev][kettle-dev] | Gem Development | Gem templating tool using `*-merge` gems      |\n| [kettle-jem][kettle-jem] | Gem Templating  | Gem template library with smart merge support |\n\n[tree_haver]: https://github.com/kettle-rb/tree_haver\n[ast-merge]: https://github.com/kettle-rb/ast-merge\n[prism-merge]: https://github.com/kettle-rb/prism-merge\n[psych-merge]: https://github.com/kettle-rb/psych-merge\n[json-merge]: https://github.com/kettle-rb/json-merge\n[jsonc-merge]: https://github.com/kettle-rb/jsonc-merge\n[bash-merge]: https://github.com/kettle-rb/bash-merge\n[rbs-merge]: https://github.com/kettle-rb/rbs-merge\n[dotenv-merge]: https://github.com/kettle-rb/dotenv-merge\n[toml-merge]: https://github.com/kettle-rb/toml-merge\n[markdown-merge]: https://github.com/kettle-rb/markdown-merge\n[markly-merge]: https://github.com/kettle-rb/markly-merge\n[commonmarker-merge]: https://github.com/kettle-rb/commonmarker-merge\n[kettle-dev]: https://github.com/kettle-rb/kettle-dev\n[kettle-jem]: https://github.com/kettle-rb/kettle-jem\n[tree_haver-gem]: https://bestgems.org/gems/tree_haver\n[ast-merge-gem]: https://bestgems.org/gems/ast-merge\n[prism-merge-gem]: https://bestgems.org/gems/prism-merge\n[psych-merge-gem]: https://bestgems.org/gems/psych-merge\n[json-merge-gem]: https://bestgems.org/gems/json-merge\n[jsonc-merge-gem]: https://bestgems.org/gems/jsonc-merge\n[bash-merge-gem]: https://bestgems.org/gems/bash-merge\n[rbs-merge-gem]: https://bestgems.org/gems/rbs-merge\n[dotenv-merge-gem]: https://bestgems.org/gems/dotenv-merge\n[toml-merge-gem]: https://bestgems.org/gems/toml-merge\n[markdown-merge-gem]: https://bestgems.org/gems/markdown-merge\n[markly-merge-gem]: https://bestgems.org/gems/markly-merge\n[commonmarker-merge-gem]: https://bestgems.org/gems/commonmarker-merge\n[kettle-dev-gem]: https://bestgems.org/gems/kettle-dev\n[kettle-jem-gem]: https://bestgems.org/gems/kettle-jem\n[tree_haver-gem-i]: https://img.shields.io/gem/v/tree_haver.svg\n[ast-merge-gem-i]: https://img.shields.io/gem/v/ast-merge.svg\n[prism-merge-gem-i]: https://img.shields.io/gem/v/prism-merge.svg\n[psych-merge-gem-i]: https://img.shields.io/gem/v/psych-merge.svg\n[json-merge-gem-i]: https://img.shields.io/gem/v/json-merge.svg\n[jsonc-merge-gem-i]: https://img.shields.io/gem/v/jsonc-merge.svg\n[bash-merge-gem-i]: https://img.shields.io/gem/v/bash-merge.svg\n[rbs-merge-gem-i]: https://img.shields.io/gem/v/rbs-merge.svg\n[dotenv-merge-gem-i]: https://img.shields.io/gem/v/dotenv-merge.svg\n[toml-merge-gem-i]: https://img.shields.io/gem/v/toml-merge.svg\n[markdown-merge-gem-i]: https://img.shields.io/gem/v/markdown-merge.svg\n[markly-merge-gem-i]: https://img.shields.io/gem/v/markly-merge.svg\n[commonmarker-merge-gem-i]: https://img.shields.io/gem/v/commonmarker-merge.svg\n[kettle-dev-gem-i]: https://img.shields.io/gem/v/kettle-dev.svg\n[kettle-jem-gem-i]: https://img.shields.io/gem/v/kettle-jem.svg\n[tree_haver-ci-i]: https://github.com/kettle-rb/tree_haver/actions/workflows/current.yml/badge.svg\n[ast-merge-ci-i]: https://github.com/kettle-rb/ast-merge/actions/workflows/current.yml/badge.svg\n[prism-merge-ci-i]: https://github.com/kettle-rb/prism-merge/actions/workflows/current.yml/badge.svg\n[psych-merge-ci-i]: https://github.com/kettle-rb/psych-merge/actions/workflows/current.yml/badge.svg\n[json-merge-ci-i]: https://github.com/kettle-rb/json-merge/actions/workflows/current.yml/badge.svg\n[jsonc-merge-ci-i]: https://github.com/kettle-rb/jsonc-merge/actions/workflows/current.yml/badge.svg\n[bash-merge-ci-i]: https://github.com/kettle-rb/bash-merge/actions/workflows/current.yml/badge.svg\n[rbs-merge-ci-i]: https://github.com/kettle-rb/rbs-merge/actions/workflows/current.yml/badge.svg\n[dotenv-merge-ci-i]: https://github.com/kettle-rb/dotenv-merge/actions/workflows/current.yml/badge.svg\n[toml-merge-ci-i]: https://github.com/kettle-rb/toml-merge/actions/workflows/current.yml/badge.svg\n[markdown-merge-ci-i]: https://github.com/kettle-rb/markdown-merge/actions/workflows/current.yml/badge.svg\n[markly-merge-ci-i]: https://github.com/kettle-rb/markly-merge/actions/workflows/current.yml/badge.svg\n[commonmarker-merge-ci-i]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/current.yml/badge.svg\n[kettle-dev-ci-i]: https://github.com/kettle-rb/kettle-dev/actions/workflows/current.yml/badge.svg\n[kettle-jem-ci-i]: https://github.com/kettle-rb/kettle-jem/actions/workflows/current.yml/badge.svg\n[tree_haver-ci]: https://github.com/kettle-rb/tree_haver/actions/workflows/current.yml\n[ast-merge-ci]: https://github.com/kettle-rb/ast-merge/actions/workflows/current.yml\n[prism-merge-ci]: https://github.com/kettle-rb/prism-merge/actions/workflows/current.yml\n[psych-merge-ci]: https://github.com/kettle-rb/psych-merge/actions/workflows/current.yml\n[json-merge-ci]: https://github.com/kettle-rb/json-merge/actions/workflows/current.yml\n[jsonc-merge-ci]: https://github.com/kettle-rb/jsonc-merge/actions/workflows/current.yml\n[bash-merge-ci]: https://github.com/kettle-rb/bash-merge/actions/workflows/current.yml\n[rbs-merge-ci]: https://github.com/kettle-rb/rbs-merge/actions/workflows/current.yml\n[dotenv-merge-ci]: https://github.com/kettle-rb/dotenv-merge/actions/workflows/current.yml\n[toml-merge-ci]: https://github.com/kettle-rb/toml-merge/actions/workflows/current.yml\n[markdown-merge-ci]: https://github.com/kettle-rb/markdown-merge/actions/workflows/current.yml\n[markly-merge-ci]: https://github.com/kettle-rb/markly-merge/actions/workflows/current.yml\n[commonmarker-merge-ci]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/current.yml\n[kettle-dev-ci]: https://github.com/kettle-rb/kettle-dev/actions/workflows/current.yml\n[kettle-jem-ci]: https://github.com/kettle-rb/kettle-jem/actions/workflows/current.yml\n[prism]: https://github.com/ruby/prism\n[psych]: https://github.com/ruby/psych\n[ffi]: https://github.com/ffi/ffi\n[ts-json]: https://github.com/tree-sitter/tree-sitter-json\n[ts-jsonc]: https://gitlab.com/WhyNotHugo/tree-sitter-jsonc\n[ts-bash]: https://github.com/tree-sitter/tree-sitter-bash\n[ts-rbs]: https://github.com/joker1007/tree-sitter-rbs\n[ts-toml]: https://github.com/tree-sitter-grammars/tree-sitter-toml\n[dotenv]: https://github.com/bkeepers/dotenv\n[rbs]: https://github.com/ruby/rbs\n[toml-rb]: https://github.com/emancu/toml-rb\n[toml]: https://github.com/jm/toml\n[markly]: https://github.com/ioquatix/markly\n[commonmarker]: https://github.com/gjtorikian/commonmarker\n[ruby_tree_sitter]: https://github.com/Faveod/ruby-tree-sitter\n[tree_stump]: https://github.com/joker1007/tree_stump\n[jtreesitter]: https://central.sonatype.com/artifact/io.github.tree-sitter/jtreesitter\n[citrus]: https://github.com/mjackson/citrus\n[parslet]: https://github.com/kschiess/parslet\n\n## 💡 Info you can shake a stick at\n\n| Tokens to Remember      | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace]                                                                                                                                                                                                                                                                          |\n|-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Works with JRuby        | [![JRuby 10.0 Compat][💎jruby-c-i]][🚎11-c-wf] [![JRuby HEAD Compat][💎jruby-headi]][🚎3-hd-wf]                                                                                                          |\n| Works with Truffle Ruby | [![Truffle Ruby 23.1 Compat][💎truby-23.1i]][🚎9-t-wf] [![Truffle Ruby 24.1 Compat][💎truby-c-i]][🚎11-c-wf]                                                                                                                                                            |\n| Works with MRI Ruby 3   | [![Ruby 3.2 Compat][💎ruby-3.2i]][🚎6-s-wf] [![Ruby 3.3 Compat][💎ruby-3.3i]][🚎6-s-wf] [![Ruby 3.4 Compat][💎ruby-c-i]][🚎11-c-wf] [![Ruby HEAD Compat][💎ruby-headi]][🚎3-hd-wf]                                                                                         |\n| Support \u0026 Community     | [![Join Me on Daily.dev's RubyFriends][✉️ruby-friends-img]][✉️ruby-friends] [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite] [![Get help from me on Upwork][👨🏼‍🏫expsup-upwork-img]][👨🏼‍🏫expsup-upwork] [![Get help from me on Codementor][👨🏼‍🏫expsup-codementor-img]][👨🏼‍🏫expsup-codementor]                                       |\n| Source                  | [![Source on GitLab.com][📜src-gl-img]][📜src-gl] [![Source on CodeBerg.org][📜src-cb-img]][📜src-cb] [![Source on Github.com][📜src-gh-img]][📜src-gh] [![The best SHA: dQw4w9WgXcQ!][🧮kloc-img]][🧮kloc]                                                                                                                                                         |\n| Documentation           | [![Current release on RubyDoc.info][📜docs-cr-rd-img]][🚎yard-current] [![YARD on Galtzo.com][📜docs-head-rd-img]][🚎yard-head] [![Maintainer Blog][🚂maint-blog-img]][🚂maint-blog] [![GitLab Wiki][📜gl-wiki-img]][📜gl-wiki] [![GitHub Wiki][📜gh-wiki-img]][📜gh-wiki]                                                                                          |\n| Compliance              | [![License: MIT][📄license-img]][📄license-ref] [![Compatible with Apache Software Projects: Verified by SkyWalking Eyes][📄license-compat-img]][📄license-compat] [![📄ilo-declaration-img]][📄ilo-declaration] [![Security Policy][🔐security-img]][🔐security] [![Contributor Covenant 2.1][🪇conduct-img]][🪇conduct] [![SemVer 2.0.0][📌semver-img]][📌semver] |\n| Style                   | [![Enforced Code Style Linter][💎rlts-img]][💎rlts] [![Keep-A-Changelog 1.0.0][📗keep-changelog-img]][📗keep-changelog] [![Gitmoji Commits][📌gitmoji-img]][📌gitmoji] [![Compatibility appraised by: appraisal2][💎appraisal2-img]][💎appraisal2]                                                                                                                  |\n| Maintainer 🎖️          | [![Follow Me on LinkedIn][💖🖇linkedin-img]][💖🖇linkedin] [![Follow Me on Ruby.Social][💖🐘ruby-mast-img]][💖🐘ruby-mast] [![Follow Me on Bluesky][💖🦋bluesky-img]][💖🦋bluesky] [![Contact Maintainer][🚂maint-contact-img]][🚂maint-contact] [![My technical writing][💖💁🏼‍♂️devto-img]][💖💁🏼‍♂️devto]                                                      |\n| `...` 💖                | [![Find Me on WellFound:][💖✌️wellfound-img]][💖✌️wellfound] [![Find Me on CrunchBase][💖💲crunchbase-img]][💖💲crunchbase] [![My LinkTree][💖🌳linktree-img]][💖🌳linktree] [![More About Me][💖💁🏼‍♂️aboutme-img]][💖💁🏼‍♂️aboutme] [🧊][💖🧊berg] [🐙][💖🐙hub]  [🛖][💖🛖hut] [🧪][💖🧪lab]                                                                   |\n\n### Compatibility\n\nCompatible with MRI Ruby 3.2.0+, and concordant releases of JRuby, and TruffleRuby.\n\n| 🚚 _Amazing_ test matrix was brought to you by | 🔎 appraisal2 🔎 and the color 💚 green 💚             |\n|------------------------------------------------|--------------------------------------------------------|\n| 👟 Check it out!                               | ✨ [github.com/appraisal-rb/appraisal2][💎appraisal2] ✨ |\n\n### Federated DVCS\n\n\u003cdetails markdown=\"1\"\u003e\n  \u003csummary\u003eFind this repo on federated forges (Coming soon!)\u003c/summary\u003e\n\n| Federated [DVCS][💎d-in-dvcs] Repository        | Status                                                                | Issues                    | PRs                      | Wiki                      | CI                       | Discussions                  |\n|-------------------------------------------------|-----------------------------------------------------------------------|---------------------------|--------------------------|---------------------------|--------------------------|------------------------------|\n| 🧪 [kettle-rb/prism-merge on GitLab][📜src-gl]   | The Truth                                                             | [💚][🤝gl-issues]         | [💚][🤝gl-pulls]         | [💚][📜gl-wiki]           | 🐭 Tiny Matrix           | ➖                            |\n| 🧊 [kettle-rb/prism-merge on CodeBerg][📜src-cb] | An Ethical Mirror ([Donate][🤝cb-donate])                             | [💚][🤝cb-issues]         | [💚][🤝cb-pulls]         | ➖                         | ⭕️ No Matrix             | ➖                            |\n| 🐙 [kettle-rb/prism-merge on GitHub][📜src-gh]   | Another Mirror                                                        | [💚][🤝gh-issues]         | [💚][🤝gh-pulls]         | [💚][📜gh-wiki]           | 💯 Full Matrix           | [💚][gh-discussions]         |\n| 🎮️ [Discord Server][✉️discord-invite]          | [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite] | [Let's][✉️discord-invite] | [talk][✉️discord-invite] | [about][✉️discord-invite] | [this][✉️discord-invite] | [library!][✉️discord-invite] |\n\n\u003c/details\u003e\n\n[gh-discussions]: https://github.com/kettle-rb/prism-merge/discussions\n\n### Enterprise Support [![Tidelift](https://tidelift.com/badges/package/rubygems/prism-merge)][🏙️entsup-tidelift]\n\nAvailable as part of the Tidelift Subscription.\n\n\u003cdetails markdown=\"1\"\u003e\n  \u003csummary\u003eNeed enterprise-level guarantees?\u003c/summary\u003e\n\nThe maintainers of this and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.\n\n[![Get help from me on Tidelift][🏙️entsup-tidelift-img]][🏙️entsup-tidelift]\n\n- 💡Subscribe for support guarantees covering _all_ your FLOSS dependencies\n- 💡Tidelift is part of [Sonar][🏙️entsup-tidelift-sonar]\n- 💡Tidelift pays maintainers to maintain the software you depend on!\u003cbr/\u003e📊`@`Pointy Haired Boss: An [enterprise support][🏙️entsup-tidelift] subscription is \"[never gonna let you down][🧮kloc]\", and *supports* open source maintainers\n\nAlternatively:\n\n- [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite]\n- [![Get help from me on Upwork][👨🏼‍🏫expsup-upwork-img]][👨🏼‍🏫expsup-upwork]\n- [![Get help from me on Codementor][👨🏼‍🏫expsup-codementor-img]][👨🏼‍🏫expsup-codementor]\n\n\u003c/details\u003e\n\n## ✨ Installation\n\nInstall the gem and add to the application's Gemfile by executing:\n\n```console\nbundle add prism-merge\n```\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n\n```console\ngem install prism-merge\n```\n\n### 🔒 Secure Installation\n\n\u003cdetails markdown=\"1\"\u003e\n  \u003csummary\u003eFor Medium or High Security Installations\u003c/summary\u003e\n\nThis gem is cryptographically signed, and has verifiable [SHA-256 and SHA-512][💎SHA_checksums] checksums by\n[stone_checksums][💎stone_checksums]. Be sure the gem you install hasn’t been tampered with\nby following the instructions below.\n\nAdd my public key (if you haven’t already, expires 2045-04-29) as a trusted certificate:\n\n```console\ngem cert --add \u003c(curl -Ls https://raw.github.com/galtzo-floss/certs/main/pboling.pem)\n```\n\nYou only need to do that once.  Then proceed to install with:\n\n```console\ngem install prism-merge -P HighSecurity\n```\n\nThe `HighSecurity` trust profile will verify signed gems, and not allow the installation of unsigned dependencies.\n\nIf you want to up your security game full-time:\n\n```console\nbundle config set --global trust-policy MediumSecurity\n```\n\n`MediumSecurity` instead of `HighSecurity` is necessary if not all the gems you use are signed.\n\nNOTE: Be prepared to track down certs for signed gems and add them the same way you added mine.\n\n\u003c/details\u003e\n\n## ⚙️ Configuration\n\nPrism::Merge works out of the box with zero configuration, but offers customization options for advanced use cases.\n\n### Signature Match Preference\n\nControl which version to use when nodes have matching signatures but different content:\n\n```ruby\n# Use template version (for version files, configs where template has updates)\nmerger = Prism::Merge::SmartMerger.new(\n  template,\n  destination,\n  preference: :template,\n)\n\n# Use destination version (for Appraisals, configs with customizations)\nmerger = Prism::Merge::SmartMerger.new(\n  template,\n  destination,\n  preference: :destination,  # This is the default\n)\n```\n\n**When to use each:**\n\n- **`:template`** - Template contains canonical/updated values\n  - Version files (`VERSION = \"2.0.0\"` should replace `VERSION = \"1.0.0\"`)\n  - Configuration updates (`API_ENDPOINT` should be updated)\n  - Conditional bodies (`if ENV[\"DEBUG\"]` should use template's implementation)\n\n- **`:destination`** (default) - Destination contains customizations\n  - Appraisals files (destination has project-specific gem versions)\n  - Project-specific configurations\n  - Custom implementations\n\n### Template-Only Nodes\n\nControl whether to add nodes that only exist in the template:\n\n```ruby\n# Add template-only nodes (for merging new features/constants)\nmerger = Prism::Merge::SmartMerger.new(\n  template,\n  destination,\n  add_template_only_nodes: true,\n)\n\n# Skip template-only nodes (for templates with placeholder content)\nmerger = Prism::Merge::SmartMerger.new(\n  template,\n  destination,\n  add_template_only_nodes: false,  # This is the default\n)\n```\n\n**When to use each:**\n\n- **`true`** - Template has new content to add\n  - New constants (`NAME = \"myapp\"` should be added to destination)\n  - New methods/classes from template\n  - Required configuration options\n\n- **`false`** (default) - Template has placeholder/example content\n  - Appraisals templates with ruby version blocks not in destination\n  - Example configurations that shouldn't be added\n  - Template-only nodes would create unwanted additions\n\n### Combined Configuration\n\nFor different merge scenarios:\n\n```ruby\n# Scenario 1: Version file merge (template wins, add new constants)\nmerger = Prism::Merge::SmartMerger.new(\n  template_content,\n  dest_content,\n  preference: :template,\n  add_template_only_nodes: true,\n)\n# Result: VERSION updated to template value, NAME constant added\n\n# Scenario 2: Appraisals merge (destination wins, skip template-only blocks)\nmerger = Prism::Merge::SmartMerger.new(\n  template_content,\n  dest_content,\n  preference: :destination,       # default\n  add_template_only_nodes: false, # default\n)\n# Result: Destination gem versions preserved, template-only ruby blocks skipped\n\n# Scenario 3: Config merge (mix and match)\nmerger = Prism::Merge::SmartMerger.new(\n  template_content,\n  dest_content,\n  preference: :destination,       # Keep custom values\n  add_template_only_nodes: true,  # But add new required configs\n)\n# Result: Existing configs keep destination values, new configs added from template\n```\n\n### Recursion Depth Limit\n\nPrism::Merge automatically detects when block bodies contain only literals or simple expressions (no mergeable statements) and treats them atomically. However, as a safety valve for edge cases, you can limit recursion depth:\n\n```ruby\n# Limit recursive merging to 3 levels deep\nmerger = Prism::Merge::SmartMerger.new(\n  template,\n  destination,\n  max_recursion_depth: 3,\n)\n\n# Disable recursive merging entirely (treat all nodes atomically)\nmerger = Prism::Merge::SmartMerger.new(\n  template,\n  destination,\n  max_recursion_depth: 0,\n)\n```\n\n**When to use:**\n\n- **`Float::INFINITY`** (default) - Normal operation, recursion terminates naturally based on content analysis.\n  - NOTE: If you get `stack level too deep (SystemStackError)`, please file a [bug][🤝gh-issues]!\n- **Finite value** - Safety valve if you encounter edge cases with unexpected deep recursion\n- **`0`** - Disable recursive merging entirely; all matching nodes are treated atomically\n\n### Per-Node-Type Preferences\n\nFor advanced use cases, you can specify different preferences for different node types using a Hash:\n\n```ruby\nmerger = Prism::Merge::SmartMerger.new(\n  template,\n  destination,\n  preference: {\n    default: :destination,    # Default for unspecified types\n    lint_gem: :template,      # Use template versions for lint gems\n    test_gem: :destination,   # Keep destination versions for test gems\n  },\n)\n```\n\nThis is especially powerful when combined with the `node_typing` option (see below) to create custom node categories.\n\n### Node Typing\n\nThe `node_typing` option allows you to transform nodes and add custom `merge_type` attributes that can be used for per-node-type preferences:\n\n```ruby\n# Define a node typing config that categorizes gem calls\nnode_typing = {\n  CallNode: -\u003e(node) {\n    # Only process gem() calls\n    return node unless node.name == :gem\n    first_arg = node.arguments\u0026.arguments\u0026.first\n    return node unless first_arg.is_a?(Prism::StringNode)\n\n    gem_name = first_arg.unescaped\n\n    # Categorize gems by type\n    if gem_name.start_with?(\"rubocop\", \"standard\")\n      Ast::Merge::NodeTyping.with_merge_type(node, :lint_gem)\n    elsif gem_name.start_with?(\"rspec\", \"minitest\", \"test-\")\n      Ast::Merge::NodeTyping.with_merge_type(node, :test_gem)\n    else\n      node  # Return unchanged for other gems\n    end\n  },\n}\n\n# Use the node typing with per-type preferences\nmerger = Prism::Merge::SmartMerger.new(\n  template,\n  destination,\n  node_typing: node_typing,\n  preference: {\n    default: :destination,    # Default: keep destination versions\n    lint_gem: :template,      # But use template versions for linters\n  },\n)\n```\n\n#### How Node Typing Works\n\n1. **Node Processing**: During analysis, each node is passed through the typing config for its type\n2. **Type Wrapping**: The config can wrap nodes with `Ast::Merge::NodeTyping.with_merge_type(node, :type)`\n3. **Preference Lookup**: During conflict resolution, wrapped nodes have their `merge_type` checked against the preference Hash\n4. **Transparent Delegation**: Wrapped nodes delegate all methods to the original node, so existing logic works unchanged\n\n#### Node Typing Return Values\n\nYour typing callable can return:\n\n- **The original node** - Node is processed normally with default preference\n- **A wrapped node** (using `NodeTyping.with_merge_type`) - Node uses the type-specific preference\n- **`nil`** - Node is skipped (use with caution)\n\n#### Integration with Signature Generator\n\nNode typing works alongside `signature_generator`. Nodes are first processed through the typing config, then the (potentially wrapped) node is passed to the signature generator:\n\n```ruby\nnode_typing = {\n  CallNode: -\u003e(node) {\n    # Categorize gem calls\n    return node unless node.name == :gem\n    gem_name = node.arguments\u0026.arguments\u0026.first\u0026.unescaped\n    return node unless gem_name\n\n    if gem_name.match?(/^(rubocop|standard)/)\n      Ast::Merge::NodeTyping.with_merge_type(node, :lint_gem)\n    else\n      node\n    end\n  },\n}\n\nsignature_generator = -\u003e(node) {\n  # Custom signature for gem calls\n  if node.is_a?(Prism::CallNode) \u0026\u0026 node.name == :gem\n    first_arg = node.arguments\u0026.arguments\u0026.first\n    return [:gem, first_arg.unescaped] if first_arg.is_a?(Prism::StringNode)\n  end\n  node  # Fall through to default\n}\n\nmerger = Prism::Merge::SmartMerger.new(\n  template,\n  destination,\n  node_typing: node_typing,\n  signature_generator: signature_generator,\n  preference: {default: :destination, lint_gem: :template},\n)\n```\n\n### Method Match Refiner\n\nWhen Ruby method definitions don't match by exact signature (name + parameters), the\n`MethodMatchRefiner` uses fuzzy matching to pair methods with:\n\n- Similar names (e.g., `process_user` vs `process_users`)\n- Same name but different parameter signatures\n- Renamed methods that perform similar functions\n\n```ruby\n# Enable method fuzzy matching\nmerger = Prism::Merge::SmartMerger.new(\n  template,\n  destination,\n  match_refiners: [\n    Prism::Merge::MethodMatchRefiner.new(threshold: 0.6),\n  ],\n)\n```\n\n#### MethodMatchRefiner Options\n\n| Option | Default | Description |\n|--------|---------|-------------|\n| `threshold` | 0.5 | Minimum similarity score (0.0-1.0) to accept a match |\n| `name_weight` | 0.7 | Weight for method name similarity |\n| `params_weight` | 0.3 | Weight for parameter similarity |\n\n```ruby\n# Custom weights for name-centric matching\nrefiner = Prism::Merge::MethodMatchRefiner.new(\n  threshold: 0.6,\n  name_weight: 0.8,   # Focus more on method names\n  params_weight: 0.2,  # Less focus on parameters\n)\n\nmerger = Prism::Merge::SmartMerger.new(\n  template,\n  destination,\n  match_refiners: [refiner],\n)\n```\n\n#### Fuzzy Method Matching Example\n\n```ruby\ntemplate = \u003c\u003c~RUBY\n  class UserService\n    def process_user(user)\n      validate(user)\n      save(user)\n    end\n\n    def find_user_by_email(email)\n      User.find_by(email: email)\n    end\n  end\nRUBY\n\ndestination = \u003c\u003c~RUBY\n  class UserService\n    def process_users(users)\n      users.each { |u| validate(u); save(u) }\n    end\n\n    def find_by_email(email)\n      User.where(email: email).first\n    end\n  end\nRUBY\n\n# Default merge won't match methods (names/params differ)\n# Use MethodMatchRefiner for fuzzy matching\nmerger = Prism::Merge::SmartMerger.new(\n  template,\n  destination,\n  match_refiners: [\n    Prism::Merge::MethodMatchRefiner.new(threshold: 0.5),\n  ],\n)\n\n# Methods are matched despite name differences:\n# - process_user ↔ process_users (similar: \"process_user\")\n# - find_user_by_email ↔ find_by_email (similar: \"find\", \"email\")\n```\n\n### Custom Signature Generator\n\nBy default, Prism::Merge uses intelligent structural signatures to match nodes. The signature determines how nodes are matched between template and destination files.\n\n#### Default Signature Matching\n\n| Node Type | Signature Format | Matching Behavior |\n|-----------|-----------------|-------------------|\n| `DefNode` | `[:def, name, params]` | Methods match by name and parameter names |\n| `ClassNode` | `[:class, name]` | Classes match by name |\n| `ModuleNode` | `[:module, name]` | Modules match by name |\n| `SingletonClassNode` | `[:singleton_class, expr]` | Singleton classes match by expression (`class \u003c\u003c self`) |\n| `ConstantWriteNode` | `[:const, name]` | Constants match by name only (not value) |\n| `ConstantPathWriteNode` | `[:const, target]` | Namespaced constants match by full path |\n| `LocalVariableWriteNode` | `[:local_var, name]` | Local variables match by name |\n| `InstanceVariableWriteNode` | `[:ivar, name]` | Instance variables match by name |\n| `ClassVariableWriteNode` | `[:cvar, name]` | Class variables match by name |\n| `GlobalVariableWriteNode` | `[:gvar, name]` | Global variables match by name |\n| `MultiWriteNode` | `[:multi_write, targets]` | Multiple assignment matches by target names |\n| `IfNode` / `UnlessNode` | `[:if, condition]` | Conditionals match by condition expression |\n| `CaseNode` | `[:case, predicate]` | Case statements match by the expression being switched |\n| `CaseMatchNode` | `[:case_match, predicate]` | Pattern matching cases match by expression |\n| `WhileNode` / `UntilNode` | `[:while, condition]` | Loops match by condition |\n| `ForNode` | `[:for, index, collection]` | For loops match by index variable and collection |\n| `BeginNode` | `[:begin, first_stmt]` | Begin blocks match by first statement (partial) |\n| `CallNode` (regular) | `[:call, name, first_arg]` | Method calls match by name and first argument |\n| `CallNode` (assignment) | `[:call, :method=, receiver]` | Assignment calls (`x.y = z`) match by receiver, not value |\n| `CallNode` (with block) | `[:call_with_block, name, first_arg]` | Block calls match by name and first argument |\n| `SuperNode` | `[:super, :with_block]` | Super calls match by presence of block |\n| `LambdaNode` | `[:lambda, params]` | Lambdas match by parameter signature |\n| `PreExecutionNode` | `[:pre_execution, line]` | BEGIN blocks match by line number |\n| `PostExecutionNode` | `[:post_execution, line]` | END blocks match by line number |\n\n#### Recursive Merge Support\n\nThe following node types support **recursive body merging**, where nested content is intelligently combined:\n\n- `ClassNode` - class bodies are recursively merged\n- `ModuleNode` - module bodies are recursively merged\n- `SingletonClassNode` - singleton class bodies are recursively merged\n- `CallNode` with block - block bodies are recursively merged **only when the body contains mergeable statements** (e.g., `describe do ... end` with nested `it` blocks). Blocks containing only literals or simple expressions (like `git_source(:github) { |repo| \"https://...\" }`) are treated atomically.\n- `BeginNode` - begin/rescue/ensure blocks are recursively merged\n\n#### Custom Signature Generator\n\nYou can provide a custom signature generator to control how nodes are matched between template and destination files. The signature generator is a callable (lambda/proc) that receives a `Prism::Node` (or `FreezeNodeBase` subclass) and returns one of three types of values:\n\n| Return Value | Behavior |\n|--------------|----------|\n| **Array** (e.g., `[:gem, \"foo\"]`) | Used as the node's signature for matching. Nodes with identical signatures are considered matches. |\n| **`nil`** | The node gets no signature and won't be matched by signature. Useful for nodes you want to skip or handle specially. |\n| **`Prism::Node` or `FreezeNodeBase` subclass** | Falls through to the default signature computation using the returned node. Return the original node unchanged for simple fallthrough, or return a modified node to influence default matching. |\n\n##### Basic Example\n\n```ruby\nsignature_generator = lambda do |node|\n  case node\n  when Prism::CallNode\n    # Match method calls by name only, ignoring arguments\n    [:call, node.name]\n  when Prism::DefNode\n    # Match method definitions by name and parameters\n    [:def, node.name, node.parameters\u0026.slice]\n  when Prism::ClassNode\n    # Match classes by name\n    [:class, node.constant_path.slice]\n  else\n    # Default matching - return node to fall through\n    node\n  end\nend\n```\n\n##### Fallthrough Example (Recommended Pattern)\n\nThe fallthrough pattern allows you to customize only specific node types while delegating everything else to the built-in signature logic:\n\n```ruby\nsignature_generator = -\u003e(node) {\n  # Only customize CallNode signatures for specific methods\n  if node.is_a?(Prism::CallNode)\n    # source() calls - match by method name only (there's usually just one)\n    return [:source] if node.name == :source\n\n    # gem() calls - match by gem name (first argument)\n    if node.name == :gem\n      first_arg = node.arguments\u0026.arguments\u0026.first\n      if first_arg.is_a?(Prism::StringNode)\n        return [:gem, first_arg.unescaped]\n      end\n    end\n  end\n\n  # Return the node to fall through to default signature computation\n  # This preserves correct handling for FreezeNodeBase subclasses, classes, modules, etc.\n  node\n}\n\nmerger = Prism::Merge::SmartMerger.new(\n  template_content,\n  destination_content,\n  signature_generator: signature_generator,\n  preference: :template,\n  add_template_only_nodes: true,\n)\n```\n\n##### Why Fallthrough Matters\n\nWhen you provide a custom signature generator, it's called for **all** node types, including internal types like `FreezeNodeBase` subclasses. If your generator returns `nil` for node types it doesn't recognize, those nodes won't be matched properly:\n\n```ruby\n# ❌ Bad: Returns nil for unrecognized nodes\nsignature_generator = -\u003e(node) {\n  return unless node.is_a?(Prism::CallNode)  # FreezeNodeBase subclasses get nil!\n  [:call, node.name]\n}\n\n# ✅ Good: Falls through for unrecognized nodes\nsignature_generator = -\u003e(node) {\n  if node.is_a?(Prism::CallNode)\n    return [:call, node.name]\n  end\n  node  # FreezeNodeBase subclasses and others use default signatures\n}\n```\n\n### Freeze Blocks\n\nProtect sections in the destination file from being overwritten by the template using freeze markers.\n\nBy default, Prism::Merge uses `prism-merge` as the freeze token:\n\n```ruby\n# In your destination.rb file\n# prism-merge:freeze\ngem \"custom-gem\", path: \"../custom\"\n# Add any custom configuration you want to preserve\n# prism-merge:unfreeze\n```\n\nYou can customize the freeze token to match your project's conventions:\n\n```ruby\n# Use a custom freeze token (e.g., for kettle-dev projects)\nmerger = Prism::Merge::SmartMerger.new(\n  template,\n  destination,\n  freeze_token: \"kettle-dev\",  # Now uses # kettle-dev:freeze / # kettle-dev:unfreeze\n)\n```\n\nFreeze blocks are **always preserved** from the destination file during merge, regardless of template content. They can be placed inside:\n\n- Class and module bodies (`class Foo ... end`, `module Bar ... end`)\n- Singleton class bodies (`class \u003c\u003c self ... end`)\n- Method definitions (`def method_name ... end`)\n- Lambda/proc bodies (`-\u003e { ... }`)\n- Block-based DSLs (e.g., RSpec `describe`/`context` blocks)\n\nThis allows you to protect entire methods, portions of method implementations, or sections within DSL blocks.\n\n#### Inline Freeze Comments\n\nIn addition to freeze blocks (with matching `freeze`/`unfreeze` markers), you can freeze a **single Ruby statement** by placing a freeze comment immediately before it:\n\n```ruby\n# prism-merge:freeze\ngem \"my-custom-gem\", path: \"../local-fork\"\n```\n\nWhen a freeze comment appears in the leading comments of a Ruby statement, that **entire statement is frozen**. This has important implications:\n\n##### Simple Statements\n\nFor simple statements like method calls, assignments, or single expressions, the entire line is frozen:\n\n```ruby\n# prism-merge:freeze\ngem \"example\", \"~\u003e 1.0\"  # This entire gem declaration is frozen\n\n# prism-merge:freeze\nVERSION = \"1.2.3\"  # This constant assignment is frozen\n```\n\n##### Block Statements\n\n**⚠️ Important:** When a freeze comment precedes a block-based statement (like a class, module, method definition, or DSL block), the **entire block is frozen**, preventing any template updates to that section:\n\n```ruby\n# prism-merge:freeze\nclass MyCustomClass\n  # EVERYTHING inside this class is frozen!\n  # Template changes to this class will be ignored.\n  def custom_method\n    # ...\n  end\nend\n\n# prism-merge:freeze\nmodule MyModule\n  # The entire module body is frozen\nend\n\n# prism-merge:freeze\ndef my_method(arg)\n  # The entire method body is frozen\nend\n\n# prism-merge:freeze\ndescribe \"My Feature\" do\n  # All specs inside this describe block are frozen\n  it \"does something\" do\n    # ...\n  end\nend\n```\n\n##### Matching Behavior\n\nFrozen statements are matched by their **structural identity**, not their content. This means:\n\n- A frozen `gem \"example\"` in the destination will match `gem \"example\"` in the template (by gem name)\n- A frozen `def my_method` will match `def my_method` in the template (by method name)\n- A frozen `class Foo` will match `class Foo` in the template (by class name)\n\nThe destination's frozen version is always preserved, regardless of changes in the template.\n\n### Integration with Existing Systems\n\nIf you're integrating with an existing system that has its own signature logic:\n\n```ruby\n# Use your existing signature function\nmy_signature_func = -\u003e(node) { MySystem.calculate_signature(node) }\n\nmerger = Prism::Merge::SmartMerger.new(\n  template,\n  destination,\n  signature_generator: my_signature_func,\n)\n```\n\n## 🔧 Basic Usage\n\n### Simple Merge\n\nThe most basic usage merges two Ruby files:\n\n```ruby\nrequire \"prism/merge\"\n\ntemplate = File.read(\"template.rb\")\ndestination = File.read(\"destination.rb\")\n\nmerger = Prism::Merge::SmartMerger.new(template, destination)\nresult = merger.merge\n\nFile.write(\"merged.rb\", result)\n```\n\n### Understanding the Merge\n\nPrism::Merge intelligently combines files by:\n\n1. **Finding Anchors**: Identifies matching sections between files\n2. **Detecting Boundaries**: Locates areas where files differ\n3. **Resolving Conflicts**: Uses structural signatures to merge differences\n4. **Preserving Context**: Maintains comments and freeze blocks\n\nExample:\n\n```ruby\n# template.rb\nVERSION = \"2.0.0\"\n\ndef greet(name)\n  puts \"Hello, #{name}!\"\nend\n\n# destination.rb\nVERSION = \"1.0.0\"\n\ndef greet(name)\n  puts \"Hello, #{name}!\"\nend\n\ndef custom_method\n  # This is destination-only\nend\n\n# After merge:\n# - VERSION from template (2.0.0) replaces destination (1.0.0)\n# - greet method matches, template version kept\n# - custom_method is preserved (destination-only)\n```\n\n### How Prism::Merge Compares to Other Merge Strategies\n\nPrism::Merge uses a **single-pass, AST-aware** algorithm that differs fundamentally from line-based merge tools like `git merge` and IDE smart merges:\n\n| Aspect | Git Merge (3-way) | IDE Smart Merge | Prism::Merge |\n|--------|-------------------|-----------------|--------------|\n| **Input** | 3 files (base, ours, theirs) | 2-3 files | 2 files (template, destination) |\n| **Unit of comparison** | Lines of text | Lines + some syntax awareness | AST nodes (Ruby structures) |\n| **Passes** | Multi-pass (LCS algorithm) | Multi-pass | Single-pass with anchors |\n| **Conflict handling** | Manual resolution with markers (`\u003c\u003c\u003c\u003c\u003c\u003c\u003c`) | Interactive resolution | Automatic via signature matching |\n| **Language awareness** | None (text-only) | Basic (indentation, brackets) | Full Ruby AST understanding |\n| **Comment handling** | Treated as text | Treated as text | Attached to relevant nodes |\n| **Structural matching** | Line equality only | Line + heuristics | Node signatures (type + identifier) |\n| **Recursive merge** | No | Sometimes | Yes (class/module bodies) |\n| **Freeze blocks** | No | No | Yes (preserve destination sections) |\n\n#### Key Differences Explained\n\n**Git Merge (3-way merge):**\n\n- Requires a common ancestor (base) to detect changes from each side\n- Uses Longest Common Subsequence (LCS) algorithm in multiple passes\n- Produces conflict markers when both sides modify the same lines\n- Language-agnostic: treats Ruby, Python, and prose identically\n\n**IDE Smart Merge:**\n\n- Often uses 3-way merge as foundation\n- Adds heuristics for common patterns (moved blocks, reformatting)\n- May understand basic syntax for better conflict detection\n- Still fundamentally line-based with enhancements\n\n**Prism::Merge:**\n\n- Uses 2 files: template (source of truth) and destination (customized version)\n- Single-pass algorithm that builds a timeline of anchors (matches) and boundaries (differences)\n- Matches by **structural signature** (e.g., `[:def, :method_name]`), not line content\n- Automatically resolves conflicts based on configurable preference\n- Never produces conflict markers - always produces valid, runnable Ruby\n\n#### When to Use Each\n\n| Scenario | Best Tool |\n|----------|-----------|\n| Merging git branches with divergent changes | Git Merge |\n| Resolving complex conflicts interactively | IDE Smart Merge |\n| Updating project files from a template | **Prism::Merge** |\n| Maintaining customizations across template updates | **Prism::Merge** |\n| Merging non-Ruby files | Git Merge / IDE |\n\n### With Debug Information\n\nGet detailed information about merge decisions:\n\n```ruby\nmerger = Prism::Merge::SmartMerger.new(template, destination)\ndebug_result = merger.merge_with_debug\n\nputs debug_result[:content]      # Final merged content\nputs debug_result[:statistics]   # Decision counts\nputs debug_result[:debug]        # Line-by-line provenance\n```\n\nThe debug output shows:\n\n```ruby\ndebug_result[:statistics]\n# =\u003e {\n#   kept_template: 42,        # Lines from template (no conflict)\n#   kept_destination: 8,      # Lines from destination (no conflict)\n#   replaced: 5,              # Template replaced matching destination\n#   appended: 3,              # Destination-only content added\n#   freeze_block: 2           # Lines from freeze blocks\n# }\n```\n\n### Error Handling\n\nPrism::Merge raises exceptions when files have syntax errors:\n\n```ruby\nbegin\n  merger = Prism::Merge::SmartMerger.new(template, destination)\n  result = merger.merge\nrescue Prism::Merge::TemplateParseError =\u003e e\n  puts \"Template has syntax errors\"\n  puts \"Content: #{e.content}\"\n  puts \"Parse errors: #{e.parse_result.errors}\"\nrescue Prism::Merge::DestinationParseError =\u003e e\n  puts \"Destination has syntax errors\"\n  puts \"Content: #{e.content}\"\n  puts \"Parse errors: #{e.parse_result.errors}\"\nend\n```\n\n### Validating Before Merge\n\nCheck if files are valid before attempting a merge:\n\n```ruby\ntemplate_analysis = Prism::Merge::FileAnalysis.new(template_content)\ndest_analysis = Prism::Merge::FileAnalysis.new(dest_content)\n\nif template_analysis.valid? \u0026\u0026 dest_analysis.valid?\n  merger = Prism::Merge::SmartMerger.new(template_content, dest_content)\n  result = merger.merge\nelse\n  puts \"Files have syntax errors\" unless template_analysis.valid?\n  puts \"Cannot merge\"\nend\n```\n\n### Working with Freeze Blocks\n\nProtect custom sections from template updates:\n\n```ruby\n# destination.rb\nclass MyApp\n  # prism-merge:freeze\n  CUSTOM_CONFIG = {\n    api_key: ENV.fetch(\"API_KEY\"),\n    endpoint: \"https://custom.example.com\",\n  }\n  # prism-merge:unfreeze\n\n  VERSION = \"1.0.0\"\nend\n\n# template.rb\nclass MyApp\n  CUSTOM_CONFIG = {}  # Template wants to reset this\n\n  VERSION = \"2.0.0\"\nend\n\n# Merge with default freeze token\nmerger = Prism::Merge::SmartMerger.new(template, destination)\nresult = merger.merge\n\n# Or use a custom freeze token if your project uses a different convention\nmerger = Prism::Merge::SmartMerger.new(\n  template,\n  destination,\n  freeze_token: \"kettle-dev\",  # for kettle-dev projects\n)\nresult = merger.merge\n\n# After merge, CUSTOM_CONFIG keeps destination values\n# but VERSION is updated to 2.0.0\n```\n\n### Advanced: Inspect Merge Components\n\nFor debugging or understanding the merge process:\n\n```ruby\n# Analyze files separately\ntemplate_analysis = Prism::Merge::FileAnalysis.new(template)\ndest_analysis = Prism::Merge::FileAnalysis.new(destination)\n\nputs \"Template statements: #{template_analysis.statements.length}\"\nputs \"Template freeze blocks: #{template_analysis.freeze_blocks.length}\"\n\n# See what anchors and boundaries are found\naligner = Prism::Merge::FileAligner.new(template_analysis, dest_analysis)\nboundaries = aligner.align\n\nputs \"Anchors (matching sections): #{aligner.anchors.length}\"\naligner.anchors.each do |anchor|\n  puts \"  Lines #{anchor.template_start}-#{anchor.template_end} match\"\nend\n\nputs \"Boundaries (differences): #{boundaries.length}\"\nboundaries.each do |boundary|\n  puts \"  Template #{boundary.template_range} vs Dest #{boundary.dest_range}\"\nend\n```\n\n### Integration Example\n\nUse Prism::Merge in your own templating system:\n\n```ruby\nclass MyTemplateEngine\n  def merge_ruby_file(template_path, destination_path)\n    template = File.read(template_path)\n    destination = File.exist?(destination_path) ? File.read(destination_path) : \"\"\n\n    merger = Prism::Merge::SmartMerger.new(template, destination)\n    merged_content = merger.merge\n\n    File.write(destination_path, merged_content)\n\n    # Return statistics for reporting\n    debug_result = merger.merge_with_debug\n    debug_result[:statistics]\n  rescue Prism::Merge::Error =\u003e e\n    puts \"Merge failed: #{e.message}\"\n    # Fall back to template only\n    File.write(destination_path, template)\n    nil\n  end\nend\n```\n\n### Testing Your Merges\n\nExample RSpec test:\n\n```ruby\nrequire \"prism/merge\"\n\nRSpec.describe(\"Ruby file merging\") do\n  it \"updates VERSION from template\" do\n    template = \u003c\u003c~RUBY\n      VERSION = \"2.0.0\"\n      def hello; end\n    RUBY\n\n    destination = \u003c\u003c~RUBY\n      VERSION = \"1.0.0\"\n      def hello; end\n      def custom; end\n    RUBY\n\n    merger = Prism::Merge::SmartMerger.new(template, destination)\n    result = merger.merge\n\n    # Template version wins\n    expect(result).to(include('VERSION = \"2.0.0\"'))\n    # Destination-only method preserved\n    expect(result).to(include(\"def custom\"))\n  end\n\n  it \"preserves freeze blocks\" do\n    template = \u003c\u003c~RUBY\n      CONFIG = {}\n    RUBY\n\n    destination = \u003c\u003c~RUBY\n      # prism-merge:freeze\n      CONFIG = { key: \"secret\" }\n      # prism-merge:unfreeze\n    RUBY\n\n    merger = Prism::Merge::SmartMerger.new(template, destination)\n    result = merger.merge\n\n    # Freeze block content preserved\n    expect(result).to(include('CONFIG = { key: \"secret\" }'))\n  end\n\n  it \"works with custom freeze tokens\" do\n    template = \u003c\u003c~RUBY\n      CONFIG = {}\n    RUBY\n\n    destination = \u003c\u003c~RUBY\n      # my-app:freeze\n      CONFIG = { key: \"secret\" }\n      # my-app:unfreeze\n    RUBY\n\n    merger = Prism::Merge::SmartMerger.new(\n      template,\n      destination,\n      freeze_token: \"my-app\",  # Match your project's freeze token\n    )\n    result = merger.merge\n\n    # Freeze block content preserved\n    expect(result).to(include('CONFIG = { key: \"secret\" }'))\n  end\nend\n```\n\n## 🦷 FLOSS Funding\n\nWhile kettle-rb tools are free software and will always be, the project would benefit immensely from some funding.\nRaising a monthly budget of... \"dollars\" would make the project more sustainable.\n\nWe welcome both individual and corporate sponsors! We also offer a\nwide array of funding channels to account for your preferences\n(although currently [Open Collective][🖇osc] is our preferred funding platform).\n\n**If you're working in a company that's making significant use of kettle-rb tools we'd\nappreciate it if you suggest to your company to become a kettle-rb sponsor.**\n\nYou can support the development of kettle-rb tools via\n[GitHub Sponsors][🖇sponsor],\n[Liberapay][⛳liberapay],\n[PayPal][🖇paypal],\n[Open Collective][🖇osc]\nand [Tidelift][🏙️entsup-tidelift].\n\n| 📍 NOTE                                                                                                                                                                                                              |\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| If doing a sponsorship in the form of donation is problematic for your company \u003cbr/\u003e from an accounting standpoint, we'd recommend the use of Tidelift, \u003cbr/\u003e where you can get a support-like subscription instead. |\n\n### Open Collective for Individuals\n\nSupport us with a monthly donation and help us continue our activities. [[Become a backer][🖇osc-backers]]\n\nNOTE: [kettle-readme-backers][kettle-readme-backers] updates this list every day, automatically.\n\n\u003c!-- OPENCOLLECTIVE-INDIVIDUALS:START --\u003e\nNo backers yet. Be the first!\n\u003c!-- OPENCOLLECTIVE-INDIVIDUALS:END --\u003e\n\n### Open Collective for Organizations\n\nBecome a sponsor and get your logo on our README on GitHub with a link to your site. [[Become a sponsor][🖇osc-sponsors]]\n\nNOTE: [kettle-readme-backers][kettle-readme-backers] updates this list every day, automatically.\n\n\u003c!-- OPENCOLLECTIVE-ORGANIZATIONS:START --\u003e\nNo sponsors yet. Be the first!\n\u003c!-- OPENCOLLECTIVE-ORGANIZATIONS:END --\u003e\n\n[kettle-readme-backers]: https://github.com/kettle-rb/prism-merge/blob/main/exe/kettle-readme-backers\n\n### Another way to support open-source\n\nI’m driven by a passion to foster a thriving open-source community – a space where people can tackle complex problems, no matter how small.  Revitalizing libraries that have fallen into disrepair, and building new libraries focused on solving real-world challenges, are my passions.  I was recently affected by layoffs, and the tech jobs market is unwelcoming. I’m reaching out here because your support would significantly aid my efforts to provide for my family, and my farm (11 🐔 chickens, 2 🐶 dogs, 3 🐰 rabbits, 8 🐈‍ cats).\n\nIf you work at a company that uses my work, please encourage them to support me as a corporate sponsor. My work on gems you use might show up in `bundle fund`.\n\nI’m developing a new library, [floss_funding][🖇floss-funding-gem], designed to empower open-source developers like myself to get paid for the work we do, in a sustainable way. Please give it a look.\n\n**[Floss-Funding.dev][🖇floss-funding.dev]: 👉️ No network calls. 👉️ No tracking. 👉️ No oversight. 👉️ Minimal crypto hashing. 💡 Easily disabled nags**\n\n[![OpenCollective Backers][🖇osc-backers-i]][🖇osc-backers] [![OpenCollective Sponsors][🖇osc-sponsors-i]][🖇osc-sponsors] [![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor] [![Liberapay Goal Progress][⛳liberapay-img]][⛳liberapay] [![Donate on PayPal][🖇paypal-img]][🖇paypal] [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] [![Donate on Polar][🖇polar-img]][🖇polar] [![Donate to my FLOSS efforts at ko-fi.com][🖇kofi-img]][🖇kofi] [![Donate to my FLOSS efforts using Patreon][🖇patreon-img]][🖇patreon]\n\n## 🔐 Security\n\nSee [SECURITY.md][🔐security].\n\n## 🤝 Contributing\n\nIf you need some ideas of where to help, you could work on adding more code coverage,\nor if it is already 💯 (see [below](#code-coverage)) check [reek](REEK), [issues][🤝gh-issues], or [PRs][🤝gh-pulls],\nor use the gem and think about how it could be better.\n\nWe [![Keep A Changelog][📗keep-changelog-img]][📗keep-changelog] so if you make changes, remember to update it.\n\nSee [CONTRIBUTING.md][🤝contributing] for more detailed instructions.\n\n### 🚀 Release Instructions\n\nSee [CONTRIBUTING.md][🤝contributing].\n\n### Code Coverage\n\n[![Coverage Graph][🏀codecov-g]][🏀codecov]\n\n[![Coveralls Test Coverage][🏀coveralls-img]][🏀coveralls]\n\n[![QLTY Test Coverage][🏀qlty-covi]][🏀qlty-cov]\n\n### 🪇 Code of Conduct\n\nEveryone interacting with this project's codebases, issue trackers,\nchat rooms and mailing lists agrees to follow the [![Contributor Covenant 2.1][🪇conduct-img]][🪇conduct].\n\n## 🌈 Contributors\n\n[![Contributors][🖐contributors-img]][🖐contributors]\n\nMade with [contributors-img][🖐contrib-rocks].\n\nAlso see GitLab Contributors: [https://gitlab.com/kettle-rb/prism-merge/-/graphs/main][🚎contributors-gl]\n\n\u003cdetails\u003e\n    \u003csummary\u003e⭐️ Star History\u003c/summary\u003e\n\n\u003ca href=\"https://star-history.com/#kettle-rb/prism-merge\u0026Date\"\u003e\n \u003cpicture\u003e\n   \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://api.star-history.com/svg?repos=kettle-rb/prism-merge\u0026type=Date\u0026theme=dark\" /\u003e\n   \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://api.star-history.com/svg?repos=kettle-rb/prism-merge\u0026type=Date\" /\u003e\n   \u003cimg alt=\"Star History Chart\" src=\"https://api.star-history.com/svg?repos=kettle-rb/prism-merge\u0026type=Date\" /\u003e\n \u003c/picture\u003e\n\u003c/a\u003e\n\n\u003c/details\u003e\n\n## 📌 Versioning\n\nThis Library adheres to [![Semantic Versioning 2.0.0][📌semver-img]][📌semver].\nViolations of this scheme should be reported as bugs.\nSpecifically, if a minor or patch version is released that breaks backward compatibility,\na new version should be immediately released that restores compatibility.\nBreaking changes to the public API will only be introduced with new major versions.\n\n\u003e dropping support for a platform is both obviously and objectively a breaking change \u003cbr/\u003e\n\u003e—Jordan Harband ([@ljharb](https://github.com/ljharb), maintainer of SemVer) [in SemVer issue 716][📌semver-breaking]\n\nI understand that policy doesn't work universally (\"exceptions to every rule!\"),\nbut it is the policy here.\nAs such, in many cases it is good to specify a dependency on this library using\nthe [Pessimistic Version Constraint][📌pvc] with two digits of precision.\n\nFor example:\n\n```ruby\nspec.add_dependency(\"prism-merge\", \"~\u003e 1.0\")\n```\n\n\u003cdetails markdown=\"1\"\u003e\n\u003csummary\u003e📌 Is \"Platform Support\" part of the public API? More details inside.\u003c/summary\u003e\n\nSemVer should, IMO, but doesn't explicitly, say that dropping support for specific Platforms\nis a *breaking change* to an API, and for that reason the bike shedding is endless.\n\nTo get a better understanding of how SemVer is intended to work over a project's lifetime,\nread this article from the creator of SemVer:\n\n- [\"Major Version Numbers are Not Sacred\"][📌major-versions-not-sacred]\n\n\u003c/details\u003e\n\nSee [CHANGELOG.md][📌changelog] for a list of releases.\n\n## 📄 License\n\nThe gem is available as open source under the terms of\nthe [MIT License][📄license] [![License: MIT][📄license-img]][📄license-ref].\nSee [LICENSE.txt][📄license] for the official [Copyright Notice][📄copyright-notice-explainer].\n\n### © Copyright\n\n\u003cul\u003e\n    \u003cli\u003e\n        Copyright (c) 2025 Peter H. Boling, of\n        \u003ca href=\"https://discord.gg/3qme4XHNKN\"\u003e\n            Galtzo.com\n            \u003cpicture\u003e\n              \u003cimg src=\"https://logos.galtzo.com/assets/images/galtzo-floss/avatar-128px-blank.svg\" alt=\"Galtzo.com Logo (Wordless) by Aboling0, CC BY-SA 4.0\" width=\"24\"\u003e\n            \u003c/picture\u003e\n        \u003c/a\u003e, and prism-merge contributors.\n    \u003c/li\u003e\n\u003c/ul\u003e\n\n## 🤑 A request for help\n\nMaintainers have teeth and need to pay their dentists.\nAfter getting laid off in an RIF in March, and encountering difficulty finding a new one,\nI began spending most of my time building open source tools.\nI'm hoping to be able to pay for my kids' health insurance this month,\nso if you value the work I am doing, I need your support.\nPlease consider sponsoring me or the project.\n\nTo join the community or get help 👇️ Join the Discord.\n\n[![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite]\n\nTo say \"thanks!\" ☝️ Join the Discord or 👇️ send money.\n\n[![Sponsor kettle-rb/prism-merge on Open Source Collective][🖇osc-all-bottom-img]][🖇osc] 💌 [![Sponsor me on GitHub Sponsors][🖇sponsor-bottom-img]][🖇sponsor] 💌 [![Sponsor me on Liberapay][⛳liberapay-bottom-img]][⛳liberapay] 💌 [![Donate on PayPal][🖇paypal-bottom-img]][🖇paypal]\n\n### Please give the project a star ⭐ ♥.\n\nThanks for RTFM. ☺️\n\n[⛳liberapay-img]: https://img.shields.io/liberapay/goal/pboling.svg?logo=liberapay\u0026color=a51611\u0026style=flat\n[⛳liberapay-bottom-img]: https://img.shields.io/liberapay/goal/pboling.svg?style=for-the-badge\u0026logo=liberapay\u0026color=a51611\n[⛳liberapay]: https://liberapay.com/pboling/donate\n[🖇osc-all-img]: https://img.shields.io/opencollective/all/kettle-rb\n[🖇osc-sponsors-img]: https://img.shields.io/opencollective/sponsors/kettle-rb\n[🖇osc-backers-img]: https://img.shields.io/opencollective/backers/kettle-rb\n[🖇osc-backers]: https://opencollective.com/kettle-rb#backer\n[🖇osc-backers-i]: https://opencollective.com/kettle-rb/backers/badge.svg?style=flat\n[🖇osc-sponsors]: https://opencollective.com/kettle-rb#sponsor\n[🖇osc-sponsors-i]: https://opencollective.com/kettle-rb/sponsors/badge.svg?style=flat\n[🖇osc-all-bottom-img]: https://img.shields.io/opencollective/all/kettle-rb?style=for-the-badge\n[🖇osc-sponsors-bottom-img]: https://img.shields.io/opencollective/sponsors/kettle-rb?style=for-the-badge\n[🖇osc-backers-bottom-img]: https://img.shields.io/opencollective/backers/kettle-rb?style=for-the-badge\n[🖇osc]: https://opencollective.com/kettle-rb\n[🖇sponsor-img]: https://img.shields.io/badge/Sponsor_Me!-pboling.svg?style=social\u0026logo=github\n[🖇sponsor-bottom-img]: https://img.shields.io/badge/Sponsor_Me!-pboling-blue?style=for-the-badge\u0026logo=github\n[🖇sponsor]: https://github.com/sponsors/pboling\n[🖇polar-img]: https://img.shields.io/badge/polar-donate-a51611.svg?style=flat\n[🖇polar]: https://polar.sh/pboling\n[🖇kofi-img]: https://img.shields.io/badge/ko--fi-%E2%9C%93-a51611.svg?style=flat\n[🖇kofi]: https://ko-fi.com/O5O86SNP4\n[🖇patreon-img]: https://img.shields.io/badge/patreon-donate-a51611.svg?style=flat\n[🖇patreon]: https://patreon.com/galtzo\n[🖇buyme-small-img]: https://img.shields.io/badge/buy_me_a_coffee-%E2%9C%93-a51611.svg?style=flat\n[🖇buyme-img]: https://img.buymeacoffee.com/button-api/?text=Buy%20me%20a%20latte\u0026emoji=\u0026slug=pboling\u0026button_colour=FFDD00\u0026font_colour=000000\u0026font_family=Cookie\u0026outline_colour=000000\u0026coffee_colour=ffffff\n[🖇buyme]: https://www.buymeacoffee.com/pboling\n[🖇paypal-img]: https://img.shields.io/badge/donate-paypal-a51611.svg?style=flat\u0026logo=paypal\n[🖇paypal-bottom-img]: https://img.shields.io/badge/donate-paypal-a51611.svg?style=for-the-badge\u0026logo=paypal\u0026color=0A0A0A\n[🖇paypal]: https://www.paypal.com/paypalme/peterboling\n[🖇floss-funding.dev]: https://floss-funding.dev\n[🖇floss-funding-gem]: https://github.com/galtzo-floss/floss_funding\n[✉️discord-invite]: https://discord.gg/3qme4XHNKN\n[✉️discord-invite-img-ftb]: https://img.shields.io/discord/1373797679469170758?style=for-the-badge\u0026logo=discord\n[✉️ruby-friends-img]: https://img.shields.io/badge/daily.dev-%F0%9F%92%8E_Ruby_Friends-0A0A0A?style=for-the-badge\u0026logo=dailydotdev\u0026logoColor=white\n[✉️ruby-friends]: https://app.daily.dev/squads/rubyfriends\n[✇bundle-group-pattern]: https://gist.github.com/pboling/4564780\n[⛳️gem-namespace]: https://github.com/kettle-rb/prism-merge\n[⛳️namespace-img]: https://img.shields.io/badge/namespace-Prism::Merge-3C2D2D.svg?style=square\u0026logo=ruby\u0026logoColor=white\n[⛳️gem-name]: https://bestgems.org/gems/prism-merge\n[⛳️name-img]: https://img.shields.io/badge/name-prism--merge-3C2D2D.svg?style=square\u0026logo=rubygems\u0026logoColor=red\n[⛳️tag-img]: https://img.shields.io/github/tag/kettle-rb/prism-merge.svg\n[⛳️tag]: http://github.com/kettle-rb/prism-merge/releases\n[🚂maint-blog]: http://www.railsbling.com/tags/prism-merge\n[🚂maint-blog-img]: https://img.shields.io/badge/blog-railsbling-0093D0.svg?style=for-the-badge\u0026logo=rubyonrails\u0026logoColor=orange\n[🚂maint-contact]: http://www.railsbling.com/contact\n[🚂maint-contact-img]: https://img.shields.io/badge/Contact-Maintainer-0093D0.svg?style=flat\u0026logo=rubyonrails\u0026logoColor=red\n[💖🖇linkedin]: http://www.linkedin.com/in/peterboling\n[💖🖇linkedin-img]: https://img.shields.io/badge/PeterBoling-LinkedIn-0B66C2?style=flat\u0026logo=newjapanprowrestling\n[💖✌️wellfound]: https://wellfound.com/u/peter-boling\n[💖✌️wellfound-img]: https://img.shields.io/badge/peter--boling-orange?style=flat\u0026logo=wellfound\n[💖💲crunchbase]: https://www.crunchbase.com/person/peter-boling\n[💖💲crunchbase-img]: https://img.shields.io/badge/peter--boling-purple?style=flat\u0026logo=crunchbase\n[💖🐘ruby-mast]: https://ruby.social/@galtzo\n[💖🐘ruby-mast-img]: https://img.shields.io/mastodon/follow/109447111526622197?domain=https://ruby.social\u0026style=flat\u0026logo=mastodon\u0026label=Ruby%20@galtzo\n[💖🦋bluesky]: https://bsky.app/profile/galtzo.com\n[💖🦋bluesky-img]: https://img.shields.io/badge/@galtzo.com-0285FF?style=flat\u0026logo=bluesky\u0026logoColor=white\n[💖🌳linktree]: https://linktr.ee/galtzo\n[💖🌳linktree-img]: https://img.shields.io/badge/galtzo-purple?style=flat\u0026logo=linktree\n[💖💁🏼‍♂️devto]: https://dev.to/galtzo\n[💖💁🏼‍♂️devto-img]: https://img.shields.io/badge/dev.to-0A0A0A?style=flat\u0026logo=devdotto\u0026logoColor=white\n[💖💁🏼‍♂️aboutme]: https://about.me/peter.boling\n[💖💁🏼‍♂️aboutme-img]: https://img.shields.io/badge/about.me-0A0A0A?style=flat\u0026logo=aboutme\u0026logoColor=white\n[💖🧊berg]: https://codeberg.org/pboling\n[💖🐙hub]: https://github.org/pboling\n[💖🛖hut]: https://sr.ht/~galtzo/\n[💖🧪lab]: https://gitlab.com/pboling\n[👨🏼‍🏫expsup-upwork]: https://www.upwork.com/freelancers/~014942e9b056abdf86?mp_source=share\n[👨🏼‍🏫expsup-upwork-img]: https://img.shields.io/badge/UpWork-13544E?style=for-the-badge\u0026logo=Upwork\u0026logoColor=white\n[👨🏼‍🏫expsup-codementor]: https://www.codementor.io/peterboling?utm_source=github\u0026utm_medium=button\u0026utm_term=peterboling\u0026utm_campaign=github\n[👨🏼‍🏫expsup-codementor-img]: https://img.shields.io/badge/CodeMentor-Get_Help-1abc9c?style=for-the-badge\u0026logo=CodeMentor\u0026logoColor=white\n[🏙️entsup-tidelift]: https://tidelift.com/subscription/pkg/rubygems-prism-merge?utm_source=rubygems-prism-merge\u0026utm_medium=referral\u0026utm_campaign=readme\n[🏙️entsup-tidelift-img]: https://img.shields.io/badge/Tidelift_and_Sonar-Enterprise_Support-FD3456?style=for-the-badge\u0026logo=sonar\u0026logoColor=white\n[🏙️entsup-tidelift-sonar]: https://blog.tidelift.com/tidelift-joins-sonar\n[💁🏼‍♂️peterboling]: http://www.peterboling.com\n[🚂railsbling]: http://www.railsbling.com\n[📜src-gl-img]: https://img.shields.io/badge/GitLab-FBA326?style=for-the-badge\u0026logo=Gitlab\u0026logoColor=orange\n[📜src-gl]: https://gitlab.com/kettle-rb/prism-merge/\n[📜src-cb-img]: https://img.shields.io/badge/CodeBerg-4893CC?style=for-the-badge\u0026logo=CodeBerg\u0026logoColor=blue\n[📜src-cb]: https://codeberg.org/kettle-rb/prism-merge\n[📜src-gh-img]: https://img.shields.io/badge/GitHub-238636?style=for-the-badge\u0026logo=Github\u0026logoColor=green\n[📜src-gh]: https://github.com/kettle-rb/prism-merge\n[📜docs-cr-rd-img]: https://img.shields.io/badge/RubyDoc-Current_Release-943CD2?style=for-the-badge\u0026logo=readthedocs\u0026logoColor=white\n[📜docs-head-rd-img]: https://img.shields.io/badge/YARD_on_Galtzo.com-HEAD-943CD2?style=for-the-badge\u0026logo=readthedocs\u0026logoColor=white\n[📜gl-wiki]: https://gitlab.com/kettle-rb/prism-merge/-/wikis/home\n[📜gh-wiki]: https://github.com/kettle-rb/prism-merge/wiki\n[📜gl-wiki-img]: https://img.shields.io/badge/wiki-examples-943CD2.svg?style=for-the-badge\u0026logo=gitlab\u0026logoColor=white\n[📜gh-wiki-img]: https://img.shields.io/badge/wiki-examples-943CD2.svg?style=for-the-badge\u0026logo=github\u0026logoColor=white\n[👽dl-rank]: https://bestgems.org/gems/prism-merge\n[👽dl-ranki]: https://img.shields.io/gem/rd/prism-merge.svg\n[👽oss-help]: https://www.codetriage.com/kettle-rb/prism-merge\n[👽oss-helpi]: https://www.codetriage.com/kettle-rb/prism-merge/badges/users.svg\n[👽version]: https://bestgems.org/gems/prism-merge\n[👽versioni]: https://img.shields.io/gem/v/prism-merge.svg\n[🏀qlty-mnt]: https://qlty.sh/gh/kettle-rb/projects/prism-merge\n[🏀qlty-mnti]: https://qlty.sh/gh/kettle-rb/projects/prism-merge/maintainability.svg\n[🏀qlty-cov]: https://qlty.sh/gh/kettle-rb/projects/prism-merge/metrics/code?sort=coverageRating\n[🏀qlty-covi]: https://qlty.sh/gh/kettle-rb/projects/prism-merge/coverage.svg\n[🏀codecov]: https://codecov.io/gh/kettle-rb/prism-merge\n[🏀codecovi]: https://codecov.io/gh/kettle-rb/prism-merge/graph/badge.svg\n[🏀coveralls]: https://coveralls.io/github/kettle-rb/prism-merge?branch=main\n[🏀coveralls-img]: https://coveralls.io/repos/github/kettle-rb/prism-merge/badge.svg?branch=main\n[🖐codeQL]: https://github.com/kettle-rb/prism-merge/security/code-scanning\n[🖐codeQL-img]: https://github.com/kettle-rb/prism-merge/actions/workflows/codeql-analysis.yml/badge.svg\n[🚎2-cov-wf]: https://github.com/kettle-rb/prism-merge/actions/workflows/coverage.yml\n[🚎2-cov-wfi]: https://github.com/kettle-rb/prism-merge/actions/workflows/coverage.yml/badge.svg\n[🚎3-hd-wf]: https://github.com/kettle-rb/prism-merge/actions/workflows/heads.yml\n[🚎3-hd-wfi]: https://github.com/kettle-rb/prism-merge/actions/workflows/heads.yml/badge.svg\n[🚎5-st-wf]: https://github.com/kettle-rb/prism-merge/actions/workflows/style.yml\n[🚎5-st-wfi]: https://github.com/kettle-rb/prism-merge/actions/workflows/style.yml/badge.svg\n[🚎6-s-wf]: https://github.com/kettle-rb/prism-merge/actions/workflows/supported.yml\n[🚎6-s-wfi]: https://github.com/kettle-rb/prism-merge/actions/workflows/supported.yml/badge.svg\n[🚎9-t-wf]: https://github.com/kettle-rb/prism-merge/actions/workflows/truffle.yml\n[🚎9-t-wfi]: https://github.com/kettle-rb/prism-merge/actions/workflows/truffle.yml/badge.svg\n[🚎11-c-wf]: https://github.com/kettle-rb/prism-merge/actions/workflows/current.yml\n[🚎11-c-wfi]: https://github.com/kettle-rb/prism-merge/actions/workflows/current.yml/badge.svg\n[🚎12-crh-wf]: https://github.com/kettle-rb/prism-merge/actions/workflows/dep-heads.yml\n[🚎12-crh-wfi]: https://github.com/kettle-rb/prism-merge/actions/workflows/dep-heads.yml/badge.svg\n[🚎13-🔒️-wf]: https://github.com/kettle-rb/prism-merge/actions/workflows/locked_deps.yml\n[🚎13-🔒️-wfi]: https://github.com/kettle-rb/prism-merge/actions/workflows/locked_deps.yml/badge.svg\n[🚎14-🔓️-wf]: https://github.com/kettle-rb/prism-merge/actions/workflows/unlocked_deps.yml\n[🚎14-🔓️-wfi]: https://github.com/kettle-rb/prism-merge/actions/workflows/unlocked_deps.yml/badge.svg\n[🚎15-🪪-wf]: https://github.com/kettle-rb/prism-merge/actions/workflows/license-eye.yml\n[🚎15-🪪-wfi]: https://github.com/kettle-rb/prism-merge/actions/workflows/license-eye.yml/badge.svg\n[💎ruby-3.2i]: https://img.shields.io/badge/Ruby-3.2-CC342D?style=for-the-badge\u0026logo=ruby\u0026logoColor=white\n[💎ruby-3.3i]: https://img.shields.io/badge/Ruby-3.3-CC342D?style=for-the-badge\u0026logo=ruby\u0026logoColor=white\n[💎ruby-c-i]: https://img.shields.io/badge/Ruby-current-CC342D?style=for-the-badge\u0026logo=ruby\u0026logoColor=green\n[💎ruby-headi]: https://img.shields.io/badge/Ruby-HEAD-CC342D?style=for-the-badge\u0026logo=ruby\u0026logoColor=blue\n[💎truby-23.1i]: https://img.shields.io/badge/Truffle_Ruby-23.1-34BCB1?style=for-the-badge\u0026logo=ruby\u0026logoColor=pink\n[💎truby-c-i]: https://img.shields.io/badge/Truffle_Ruby-current-34BCB1?style=for-the-badge\u0026logo=ruby\u0026logoColor=green\n[💎truby-headi]: https://img.shields.io/badge/Truffle_Ruby-HEAD-34BCB1?style=for-the-badge\u0026logo=ruby\u0026logoColor=blue\n[💎jruby-c-i]: https://img.shields.io/badge/JRuby-current-FBE742?style=for-the-badge\u0026logo=ruby\u0026logoColor=green\n[💎jruby-headi]: https://img.shields.io/badge/JRuby-HEAD-FBE742?style=for-the-badge\u0026logo=ruby\u0026logoColor=blue\n[🤝gh-issues]: https://github.com/kettle-rb/prism-merge/issues\n[🤝gh-pulls]: https://github.com/kettle-rb/prism-merge/pulls\n[🤝gl-issues]: https://gitlab.com/kettle-rb/prism-merge/-/issues\n[🤝gl-pulls]: https://gitlab.com/kettle-rb/prism-merge/-/merge_requests\n[🤝cb-issues]: https://codeberg.org/kettle-rb/prism-merge/issues\n[🤝cb-pulls]: https://codeberg.org/kettle-rb/prism-merge/pulls\n[🤝cb-donate]: https://donate.codeberg.org/\n[🤝contributing]: CONTRIBUTING.md\n[🏀codecov-g]: https://codecov.io/gh/kettle-rb/prism-merge/graphs/tree.svg\n[🖐contrib-rocks]: https://contrib.rocks\n[🖐contributors]: https://github.com/kettle-rb/prism-merge/graphs/contributors\n[🖐contributors-img]: https://contrib.rocks/image?repo=kettle-rb/prism-merge\n[🚎contributors-gl]: https://gitlab.com/kettle-rb/prism-merge/-/graphs/main\n[🪇conduct]: CODE_OF_CONDUCT.md\n[🪇conduct-img]: https://img.shields.io/badge/Contributor_Covenant-2.1-259D6C.svg\n[📌pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint\n[📌semver]: https://semver.org/spec/v2.0.0.html\n[📌semver-img]: https://img.shields.io/badge/semver-2.0.0-259D6C.svg?style=flat\n[📌semver-breaking]: https://github.com/semver/semver/issues/716#issuecomment-869336139\n[📌major-versions-not-sacred]: https://tom.preston-werner.com/2022/05/23/major-version-numbers-are-not-sacred.html\n[📌changelog]: CHANGELOG.md\n[📗keep-changelog]: https://keepachangelog.com/en/1.0.0/\n[📗keep-changelog-img]: https://img.shields.io/badge/keep--a--changelog-1.0.0-34495e.svg?style=flat\n[📌gitmoji]: https://gitmoji.dev\n[📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square\n[🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ\n[🧮kloc-img]: https://img.shields.io/badge/KLOC-0.830-FFDD67.svg?style=for-the-badge\u0026logo=YouTube\u0026logoColor=blue\n[🔐security]: SECURITY.md\n[🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat\n[📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year\n[📄license]: LICENSE.txt\n[📄license-ref]: https://opensource.org/licenses/MIT\n[📄license-img]: https://img.shields.io/badge/License-MIT-259D6C.svg\n[📄license-compat]: https://dev.to/galtzo/how-to-check-license-compatibility-41h0\n[📄license-compat-img]: https://img.shields.io/badge/Apache_Compatible:_Category_A-%E2%9C%93-259D6C.svg?style=flat\u0026logo=Apache\n[📄ilo-declaration]: https://www.ilo.org/declaration/lang--en/index.htm\n[📄ilo-declaration-img]: https://img.shields.io/badge/ILO_Fundamental_Principles-✓-259D6C.svg?style=flat\n[🚎yard-current]: http://rubydoc.info/gems/prism-merge\n[🚎yard-head]: https://prism-merge.galtzo.com\n[💎stone_checksums]: https://github.com/galtzo-floss/stone_checksums\n[💎SHA_checksums]: https://gitlab.com/kettle-rb/prism-merge/-/tree/main/checksums\n[💎rlts]: https://github.com/rubocop-lts/rubocop-lts\n[💎rlts-img]: https://img.shields.io/badge/code_style_\u0026_linting-rubocop--lts-34495e.svg?plastic\u0026logo=ruby\u0026logoColor=white\n[💎appraisal2]: https://github.com/appraisal-rb/appraisal2\n[💎appraisal2-img]: https://img.shields.io/badge/appraised_by-appraisal2-34495e.svg?plastic\u0026logo=ruby\u0026logoColor=white\n[💎d-in-dvcs]: https://railsbling.com/posts/dvcs/put_the_d_in_dvcs/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkettle-rb%2Fprism-merge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkettle-rb%2Fprism-merge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkettle-rb%2Fprism-merge/lists"}