ast-merge v4.0.0 released!
4.0.0 - 2026-01-11
- TAG: v4.0.0
- COVERAGE: 96.52% – 2555/2647 lines in 51 files
- BRANCH COVERAGE: 87.62% – 814/929 branches in 51 files
- 98.80% documented
Added
Recipe::Preset#normalize_whitespace- option to collapse excessive blank lines in merged outputRecipe::Preset#rehydrate_link_references- option to convert inline links to reference styleRecipe::Runner::Result#problems- access document problems found during mergeexe/ast-merge-recipe --show-problems- flag to display document problems in CLI outputAst::Merge::DiffMapperBase- Abstract base class for mapping unified git diffs to AST node pathsDiffHunkstruct for representing diff hunks with line numbers and contentDiffLinestruct for individual diff lines with type (:context,:addition,:removal)DiffMappingstruct for mapping changes to AST paths with operation typeDiffParseResultstruct for parsed diff with file paths and hunks#parse_diff(diff_text)- Parse unified git diff format into structured hunks#determine_operation(hunk)- Detect:add,:remove, or:modifyfrom hunk content- Abstract
#map_hunk_to_pathsfor format-specific implementations - Abstract
#create_analysisfor format-specific file analysis
Ast::Merge::ConflictResolverBase- New options for advanced merge control:recursive: true | false | Integer- Control recursive merging of nested structurestrue(default): Unlimited depth recursive mergingfalse: Disabled, replace entire matched nodesInteger > 0: Maximum recursion depth0: Invalid, raisesArgumentError
remove_template_missing_nodes: false- Whentrue, removes destination nodes not present in template#should_recurse?(depth)- Helper to check if recursion should continue at given depth#validate_recursive!- Validation for recursive parameter
exe/ast-merge-diff- CLI executable for applying git diffs via AST-aware merging- Auto-detects format from file extension (
.yml,.yaml,.json,.rb, etc.) --diff FILE- Path to unified diff file (use-for stdin, default: stdin)--original FILE- Original file for AST path mapping (required)--destination FILE- Destination file to merge into (required)--format FORMAT- Override format auto-detection--dry-run- Preview changes without writing--verbose- Detailed output--add-only- Only apply additions from diff--remove-only- Only apply removals from diff- Uses bundler/inline with dynamic gem loading based on detected format
- Auto-detects format from file extension (
Changed
- BREAKING: Upgrade to tree_haver v5.0.0
- BREAKING: Refactored navigation classes into
Ast::Merge::NavigablenamespaceAst::Merge::NavigableStatement→Ast::Merge::Navigable::StatementAst::Merge::InjectionPoint→Ast::Merge::Navigable::InjectionPointAst::Merge::InjectionPointFinder→Ast::Merge::Navigable::InjectionPointFinder- Each class is now in its own file under
lib/ast/merge/navigable/ - Uses autoload for lazy loading
bin/fix_readme_formatting- Rewritten to use SmartMerger API- Now uses
Markdown::Merge::SmartMergerwithnormalize_whitespace: :link_refsandrehydrate_link_references: true - The
:link_refsmode collapses excessive blank lines AND removes blank lines between consecutive link reference definitions - Merges empty template with destination to apply cleanup transformations
- Reports duplicate link definitions, link ref spacing fixes, and other problems from
MergeResult#problems - Removed custom regex-based link rehydration and whitespace normalization
- Now uses
Fixed
Ast::Merge::PartialTemplateMergerBase#normalize_matchernow preservessame_or_shallowerkey from boundary configAst::Merge::PartialTemplateMergerBase#mergenow passesboundary_same_or_shallowertoInjectionPointFinder#find
Many paths lead to being a sponsor or a backer of this project. Are you on such a path?