ast-merge 3.1.0 → 4.0.1

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: e6af6467980a8e2076bd454a35bea42e18064fed0651704754f459353a85087a
4
+ data.tar.gz: 1d89bad2aa237d11aafd957f68391d8ca83248cc0f7946bad54e788cc1fa05c2
5
5
  SHA512:
6
- metadata.gz: 41981f4b37122e224ecc1b3047156ec15871742fbca09b8203acb91c27df7acf61164871c2ee7eac07db32a12acccc7c8dda3b83b8cd7dafd8f86ade604a82a6
7
- data.tar.gz: 29c07de568c15bc8a78b6363c438e6c7902af5f24d8d441aaa9f9417bceeedb62107f40e95a226864be3492b16373ae4493efa0ed956c780448bf4a3168980b9
6
+ metadata.gz: a45b949a5b6b835ba26d0422eb855daa9a62e513131bf06627abe8b68dba2daae28dd835f51fce43758c36f652fb44851885adcec3f82a64519bc2baed6f77f9
7
+ data.tar.gz: c2a7c05cedc23b3552f5eaef980cc890cf034060efe82f51f0c7acc98cba5b5df3bc2441a96bcde188c48391baebe5474dd76f735e5a2dbda053ff85b07a6748
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -30,6 +30,110 @@ Please file a bug if you notice a violation of semantic versioning.
30
30
 
31
31
  ### Security
32
32
 
33
+ ## [4.0.1] - 2026-01-11
34
+
35
+ - TAG: [v4.0.1][4.0.1t]
36
+ - COVERAGE: 96.45% -- 2553/2647 lines in 51 files
37
+ - BRANCH COVERAGE: 87.41% -- 812/929 branches in 51 files
38
+ - 98.80% documented
39
+
40
+ ### Added
41
+
42
+ - **`Ast::Merge::RSpec::MergeGemRegistry`** - Fully dynamic merge gem registration for RSpec dependency tags
43
+ - `register(tag_name, require_path:, merger_class:, test_source:, category:)` - Register a merge gem
44
+ - `available?(tag_name)` - Check if a merge gem is available and functional
45
+ - `registered_gems` - Get all registered gem tag names
46
+ - `gems_by_category(category)` - Filter gems by category (:markdown, :data, :code, :config, :other)
47
+ - `summary` - Get availability status of all registered gems
48
+ - Automatically defines `*_available?` methods on `DependencyTags` at registration time
49
+ - External merge gems can now get full RSpec tag support without modifying ast-merge
50
+
51
+ ### Changed
52
+
53
+ - Upgrade to [tree_haver v5.0.1](https://github.com/kettle-rb/tree_haver/releases/tag/v5.0.1)
54
+ - **`Ast::Merge::AstNode` now inherits from `TreeHaver::Base::Node`**
55
+ - Ensures synthetic nodes stay in sync with the canonical Node API
56
+ - Inherits `Comparable`, `Enumerable` from base class
57
+ - Retains all existing methods and behavior (Point, Location, signature, etc.)
58
+ - Constructor calls `super(self, source: source)` to properly initialize base class
59
+ - **RSpec Dependency Tags refactored to use MergeGemRegistry**
60
+ - Removed hardcoded merge gem availability checks
61
+ - Removed `MERGE_GEM_TEST_SOURCES` constant
62
+ - `*_available?` methods are now defined dynamically when gems register
63
+ - `any_markdown_merge_available?` now queries registry by category
64
+ - RSpec exclusion filters are configured dynamically from registry
65
+ - `Ast::Merge::Testing::TestableNode` now delegates to `TreeHaver::RSpec::TestableNode`
66
+ - The TestableNode implementation has been moved to tree_haver for sharing across all merge gems
67
+ - `spec/support/testable_node.rb` now requires and re-exports the tree_haver version
68
+ - Backward compatible: existing tests continue to work unchanged
69
+ - `spec/ast/merge/node_wrapper_base_spec.rb` refactored to use `TestableNode` instead of mocks
70
+ - Real TreeHaver::Node behavior for most tests
71
+ - Mocks only retained for edge case testing (e.g., invalid end_line before start_line)
72
+
73
+ ## [4.0.0] - 2026-01-11
74
+
75
+ - TAG: [v4.0.0][4.0.0t]
76
+ - COVERAGE: 96.52% -- 2555/2647 lines in 51 files
77
+ - BRANCH COVERAGE: 87.62% -- 814/929 branches in 51 files
78
+ - 98.80% documented
79
+
80
+ ### Added
81
+
82
+ - `Recipe::Preset#normalize_whitespace` - option to collapse excessive blank lines in merged output
83
+ - `Recipe::Preset#rehydrate_link_references` - option to convert inline links to reference style
84
+ - `Recipe::Runner::Result#problems` - access document problems found during merge
85
+ - `exe/ast-merge-recipe --show-problems` - flag to display document problems in CLI output
86
+ - `Ast::Merge::DiffMapperBase` - Abstract base class for mapping unified git diffs to AST node paths
87
+ - `DiffHunk` struct for representing diff hunks with line numbers and content
88
+ - `DiffLine` struct for individual diff lines with type (`:context`, `:addition`, `:removal`)
89
+ - `DiffMapping` struct for mapping changes to AST paths with operation type
90
+ - `DiffParseResult` struct for parsed diff with file paths and hunks
91
+ - `#parse_diff(diff_text)` - Parse unified git diff format into structured hunks
92
+ - `#determine_operation(hunk)` - Detect `:add`, `:remove`, or `:modify` from hunk content
93
+ - Abstract `#map_hunk_to_paths` for format-specific implementations
94
+ - Abstract `#create_analysis` for format-specific file analysis
95
+ - `Ast::Merge::ConflictResolverBase` - New options for advanced merge control:
96
+ - `recursive: true | false | Integer` - Control recursive merging of nested structures
97
+ - `true` (default): Unlimited depth recursive merging
98
+ - `false`: Disabled, replace entire matched nodes
99
+ - `Integer > 0`: Maximum recursion depth
100
+ - `0`: Invalid, raises `ArgumentError`
101
+ - `remove_template_missing_nodes: false` - When `true`, removes destination nodes not present in template
102
+ - `#should_recurse?(depth)` - Helper to check if recursion should continue at given depth
103
+ - `#validate_recursive!` - Validation for recursive parameter
104
+ - `exe/ast-merge-diff` - CLI executable for applying git diffs via AST-aware merging
105
+ - Auto-detects format from file extension (`.yml`, `.yaml`, `.json`, `.rb`, etc.)
106
+ - `--diff FILE` - Path to unified diff file (use `-` for stdin, default: stdin)
107
+ - `--original FILE` - Original file for AST path mapping (required)
108
+ - `--destination FILE` - Destination file to merge into (required)
109
+ - `--format FORMAT` - Override format auto-detection
110
+ - `--dry-run` - Preview changes without writing
111
+ - `--verbose` - Detailed output
112
+ - `--add-only` - Only apply additions from diff
113
+ - `--remove-only` - Only apply removals from diff
114
+ - Uses bundler/inline with dynamic gem loading based on detected format
115
+
116
+ ### Changed
117
+
118
+ - **BREAKING**: Upgrade to [tree_haver v5.0.0](https://github.com/kettle-rb/tree_haver/releases/tag/v5.0.0)
119
+ - **BREAKING**: Refactored navigation classes into `Ast::Merge::Navigable` namespace
120
+ - `Ast::Merge::NavigableStatement` → `Ast::Merge::Navigable::Statement`
121
+ - `Ast::Merge::InjectionPoint` → `Ast::Merge::Navigable::InjectionPoint`
122
+ - `Ast::Merge::InjectionPointFinder` → `Ast::Merge::Navigable::InjectionPointFinder`
123
+ - Each class is now in its own file under `lib/ast/merge/navigable/`
124
+ - Uses autoload for lazy loading
125
+ - `bin/fix_readme_formatting` - Rewritten to use SmartMerger API
126
+ - Now uses `Markdown::Merge::SmartMerger` with `normalize_whitespace: :link_refs` and `rehydrate_link_references: true`
127
+ - The `:link_refs` mode collapses excessive blank lines AND removes blank lines between consecutive link reference definitions
128
+ - Merges empty template with destination to apply cleanup transformations
129
+ - Reports duplicate link definitions, link ref spacing fixes, and other problems from `MergeResult#problems`
130
+ - Removed custom regex-based link rehydration and whitespace normalization
131
+
132
+ ### Fixed
133
+
134
+ - `Ast::Merge::PartialTemplateMergerBase#normalize_matcher` now preserves `same_or_shallower` key from boundary config
135
+ - `Ast::Merge::PartialTemplateMergerBase#merge` now passes `boundary_same_or_shallower` to `InjectionPointFinder#find`
136
+
33
137
  ## [3.1.0] - 2026-01-08
34
138
 
35
139
  - TAG: [v3.1.0][3.1.0t]
@@ -533,7 +637,11 @@ Please file a bug if you notice a violation of semantic versioning.
533
637
 
534
638
  - Initial release
535
639
 
536
- [Unreleased]: https://github.com/kettle-rb/ast-merge/compare/v3.1.0...HEAD
640
+ [Unreleased]: https://github.com/kettle-rb/ast-merge/compare/v4.0.1...HEAD
641
+ [4.0.1]: https://github.com/kettle-rb/ast-merge/compare/v4.0.0...v4.0.1
642
+ [4.0.1t]: https://github.com/kettle-rb/ast-merge/releases/tag/v4.0.1
643
+ [4.0.0]: https://github.com/kettle-rb/ast-merge/compare/v3.1.0...v4.0.0
644
+ [4.0.0t]: https://github.com/kettle-rb/ast-merge/releases/tag/v4.0.0
537
645
  [3.1.0]: https://github.com/kettle-rb/ast-merge/compare/v3.0.0...v3.1.0
538
646
  [3.1.0t]: https://github.com/kettle-rb/ast-merge/releases/tag/v3.1.0
539
647
  [3.0.0]: https://github.com/kettle-rb/ast-merge/compare/v2.0.10...v3.0.0