ast-merge 3.1.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ce2b23f374b6f178709f84a66ccbed7b997a05d170d7b1f63ede714fc844469
4
- data.tar.gz: d0ae1bc694c669108b5ddaac372424c02f8528f3c59642ced6fb7bb1af67dcf4
3
+ metadata.gz: 871eebc1f2c69aa75278023c250fd90905cf2fb4e23677fbcfd49633bad5ebb1
4
+ data.tar.gz: 3804ee9f9f61effc21c49862a96b0092481067813c79b1b4fdb09a748b935570
5
5
  SHA512:
6
- metadata.gz: 41981f4b37122e224ecc1b3047156ec15871742fbca09b8203acb91c27df7acf61164871c2ee7eac07db32a12acccc7c8dda3b83b8cd7dafd8f86ade604a82a6
7
- data.tar.gz: 29c07de568c15bc8a78b6363c438e6c7902af5f24d8d441aaa9f9417bceeedb62107f40e95a226864be3492b16373ae4493efa0ed956c780448bf4a3168980b9
6
+ metadata.gz: 340c3feee108349b603db2150baa68467b45c7414be0d1fdcfaac10038d3cfca2dc893dc81a489adae66bbfc8d9474f7128e7f0817abc9703ba6694719a48b91
7
+ data.tar.gz: 5f135b944efe203fe0f83cf2d141e18de4e64be096a3293c0db09b3f5672790b6cdbad6956ef511c657b43c0e0b162050ec57d46d7da659895554c16e2eac6c4
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -30,6 +30,70 @@ Please file a bug if you notice a violation of semantic versioning.
30
30
 
31
31
  ### Security
32
32
 
33
+ ## [4.0.0] - 2026-01-11
34
+
35
+ - TAG: [v4.0.0][4.0.0t]
36
+ - COVERAGE: 96.52% -- 2555/2647 lines in 51 files
37
+ - BRANCH COVERAGE: 87.62% -- 814/929 branches in 51 files
38
+ - 98.80% documented
39
+
40
+ ### Added
41
+
42
+ - `Recipe::Preset#normalize_whitespace` - option to collapse excessive blank lines in merged output
43
+ - `Recipe::Preset#rehydrate_link_references` - option to convert inline links to reference style
44
+ - `Recipe::Runner::Result#problems` - access document problems found during merge
45
+ - `exe/ast-merge-recipe --show-problems` - flag to display document problems in CLI output
46
+ - `Ast::Merge::DiffMapperBase` - Abstract base class for mapping unified git diffs to AST node paths
47
+ - `DiffHunk` struct for representing diff hunks with line numbers and content
48
+ - `DiffLine` struct for individual diff lines with type (`:context`, `:addition`, `:removal`)
49
+ - `DiffMapping` struct for mapping changes to AST paths with operation type
50
+ - `DiffParseResult` struct for parsed diff with file paths and hunks
51
+ - `#parse_diff(diff_text)` - Parse unified git diff format into structured hunks
52
+ - `#determine_operation(hunk)` - Detect `:add`, `:remove`, or `:modify` from hunk content
53
+ - Abstract `#map_hunk_to_paths` for format-specific implementations
54
+ - Abstract `#create_analysis` for format-specific file analysis
55
+ - `Ast::Merge::ConflictResolverBase` - New options for advanced merge control:
56
+ - `recursive: true | false | Integer` - Control recursive merging of nested structures
57
+ - `true` (default): Unlimited depth recursive merging
58
+ - `false`: Disabled, replace entire matched nodes
59
+ - `Integer > 0`: Maximum recursion depth
60
+ - `0`: Invalid, raises `ArgumentError`
61
+ - `remove_template_missing_nodes: false` - When `true`, removes destination nodes not present in template
62
+ - `#should_recurse?(depth)` - Helper to check if recursion should continue at given depth
63
+ - `#validate_recursive!` - Validation for recursive parameter
64
+ - `exe/ast-merge-diff` - CLI executable for applying git diffs via AST-aware merging
65
+ - Auto-detects format from file extension (`.yml`, `.yaml`, `.json`, `.rb`, etc.)
66
+ - `--diff FILE` - Path to unified diff file (use `-` for stdin, default: stdin)
67
+ - `--original FILE` - Original file for AST path mapping (required)
68
+ - `--destination FILE` - Destination file to merge into (required)
69
+ - `--format FORMAT` - Override format auto-detection
70
+ - `--dry-run` - Preview changes without writing
71
+ - `--verbose` - Detailed output
72
+ - `--add-only` - Only apply additions from diff
73
+ - `--remove-only` - Only apply removals from diff
74
+ - Uses bundler/inline with dynamic gem loading based on detected format
75
+
76
+ ### Changed
77
+
78
+ - **BREAKING**: Upgrade to [tree_haver v5.0.0](https://github.com/kettle-rb/tree_haver/releases/tag/v5.0.0)
79
+ - **BREAKING**: Refactored navigation classes into `Ast::Merge::Navigable` namespace
80
+ - `Ast::Merge::NavigableStatement` → `Ast::Merge::Navigable::Statement`
81
+ - `Ast::Merge::InjectionPoint` → `Ast::Merge::Navigable::InjectionPoint`
82
+ - `Ast::Merge::InjectionPointFinder` → `Ast::Merge::Navigable::InjectionPointFinder`
83
+ - Each class is now in its own file under `lib/ast/merge/navigable/`
84
+ - Uses autoload for lazy loading
85
+ - `bin/fix_readme_formatting` - Rewritten to use SmartMerger API
86
+ - Now uses `Markdown::Merge::SmartMerger` with `normalize_whitespace: :link_refs` and `rehydrate_link_references: true`
87
+ - The `:link_refs` mode collapses excessive blank lines AND removes blank lines between consecutive link reference definitions
88
+ - Merges empty template with destination to apply cleanup transformations
89
+ - Reports duplicate link definitions, link ref spacing fixes, and other problems from `MergeResult#problems`
90
+ - Removed custom regex-based link rehydration and whitespace normalization
91
+
92
+ ### Fixed
93
+
94
+ - `Ast::Merge::PartialTemplateMergerBase#normalize_matcher` now preserves `same_or_shallower` key from boundary config
95
+ - `Ast::Merge::PartialTemplateMergerBase#merge` now passes `boundary_same_or_shallower` to `InjectionPointFinder#find`
96
+
33
97
  ## [3.1.0] - 2026-01-08
34
98
 
35
99
  - TAG: [v3.1.0][3.1.0t]
@@ -533,7 +597,9 @@ Please file a bug if you notice a violation of semantic versioning.
533
597
 
534
598
  - Initial release
535
599
 
536
- [Unreleased]: https://github.com/kettle-rb/ast-merge/compare/v3.1.0...HEAD
600
+ [Unreleased]: https://github.com/kettle-rb/ast-merge/compare/v4.0.0...HEAD
601
+ [4.0.0]: https://github.com/kettle-rb/ast-merge/compare/v3.1.0...v4.0.0
602
+ [4.0.0t]: https://github.com/kettle-rb/ast-merge/releases/tag/v4.0.0
537
603
  [3.1.0]: https://github.com/kettle-rb/ast-merge/compare/v3.0.0...v3.1.0
538
604
  [3.1.0t]: https://github.com/kettle-rb/ast-merge/releases/tag/v3.1.0
539
605
  [3.0.0]: https://github.com/kettle-rb/ast-merge/compare/v2.0.10...v3.0.0