ast-merge 3.0.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +95 -1
- data/README.md +258 -186
- data/exe/ast-merge-recipe +20 -0
- data/lib/ast/merge/conflict_resolver_base.rb +47 -1
- data/lib/ast/merge/diff_mapper_base.rb +245 -0
- data/lib/ast/merge/emitter_base.rb +123 -0
- data/lib/ast/merge/freeze_node_base.rb +9 -0
- data/lib/ast/merge/navigable/injection_point.rb +132 -0
- data/lib/ast/merge/navigable/injection_point_finder.rb +98 -0
- data/lib/ast/merge/navigable/statement.rb +380 -0
- data/lib/ast/merge/navigable.rb +20 -0
- data/lib/ast/merge/node_typing.rb +21 -0
- data/lib/ast/merge/partial_template_merger_base.rb +4 -2
- data/lib/ast/merge/recipe/preset.rb +18 -0
- data/lib/ast/merge/recipe/runner.rb +8 -1
- data/lib/ast/merge/version.rb +1 -1
- data/lib/ast/merge.rb +3 -3
- data.tar.gz.sig +0 -0
- metadata +34 -9
- metadata.gz.sig +0 -0
- data/lib/ast/merge/navigable_statement.rb +0 -625
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 871eebc1f2c69aa75278023c250fd90905cf2fb4e23677fbcfd49633bad5ebb1
|
|
4
|
+
data.tar.gz: 3804ee9f9f61effc21c49862a96b0092481067813c79b1b4fdb09a748b935570
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 340c3feee108349b603db2150baa68467b45c7414be0d1fdcfaac10038d3cfca2dc893dc81a489adae66bbfc8d9474f7128e7f0817abc9703ba6694719a48b91
|
|
7
|
+
data.tar.gz: 5f135b944efe203fe0f83cf2d141e18de4e64be096a3293c0db09b3f5672790b6cdbad6956ef511c657b43c0e0b162050ec57d46d7da659895554c16e2eac6c4
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -30,6 +30,96 @@ 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
|
+
|
|
97
|
+
## [3.1.0] - 2026-01-08
|
|
98
|
+
|
|
99
|
+
- TAG: [v3.1.0][3.1.0t]
|
|
100
|
+
- COVERAGE: 96.89% -- 2465/2544 lines in 47 files
|
|
101
|
+
- BRANCH COVERAGE: 89.62% -- 794/886 branches in 47 files
|
|
102
|
+
- 98.75% documented
|
|
103
|
+
|
|
104
|
+
### Added
|
|
105
|
+
|
|
106
|
+
- `Ast::Merge::EmitterBase` - Abstract base class for format-specific emitters
|
|
107
|
+
- Provides common infrastructure for converting AST structures back to text
|
|
108
|
+
- Tracks indentation level with configurable `indent_size` (default: 2 spaces)
|
|
109
|
+
- Manages output lines collection with `#lines` accessor
|
|
110
|
+
- `#emit_blank_line` - Emit an empty line
|
|
111
|
+
- `#emit_leading_comments` - Emit comments from CommentTracker
|
|
112
|
+
- `#emit_raw_lines` - Emit lines without modification (preserves exact formatting)
|
|
113
|
+
- `#to_s` - Get output as a single string with trailing newline
|
|
114
|
+
- `#clear` - Reset emitter state
|
|
115
|
+
- `#indent` / `#dedent` - Increase/decrease indentation level
|
|
116
|
+
- Subclass hooks: `#initialize_subclass_state`, `#clear_subclass_state`, `#emit_tracked_comment`
|
|
117
|
+
- Used by jsonc-merge, json-merge, bash-merge, toml-merge, and psych-merge emitters
|
|
118
|
+
|
|
119
|
+
### Changed
|
|
120
|
+
|
|
121
|
+
- tree_haver v4.0.0
|
|
122
|
+
|
|
33
123
|
## [3.0.0] - 2026-01-05
|
|
34
124
|
|
|
35
125
|
- TAG: [v3.0.0][3.0.0t]
|
|
@@ -507,7 +597,11 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
507
597
|
|
|
508
598
|
- Initial release
|
|
509
599
|
|
|
510
|
-
[Unreleased]: https://github.com/kettle-rb/ast-merge/compare/
|
|
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
|
|
603
|
+
[3.1.0]: https://github.com/kettle-rb/ast-merge/compare/v3.0.0...v3.1.0
|
|
604
|
+
[3.1.0t]: https://github.com/kettle-rb/ast-merge/releases/tag/v3.1.0
|
|
511
605
|
[3.0.0]: https://github.com/kettle-rb/ast-merge/compare/v2.0.10...v3.0.0
|
|
512
606
|
[3.0.0t]: https://github.com/kettle-rb/ast-merge/releases/tag/v3.0.0
|
|
513
607
|
[2.0.10]: https://github.com/kettle-rb/ast-merge/compare/v2.0.9...v2.0.10
|