Module: Ast::Crispr
- Defined in:
- lib/ast/crispr.rb,
lib/ast/crispr.rb,
lib/ast/crispr/version.rb,
sig/ast/crispr.rbs
Defined Under Namespace
Modules: Adapters, OperationProfilable, OperationSupport, ProfileReportCompatibility, Selectors, Version Classes: Delete, DeleteBatch, DestinationProfile, DestinationResolution, DocumentContext, Error, Insert, Limit, Match, MatchProfile, MergeReplace, Move, OperationProfile, OwnerSelector, Replace, SelectionProfile, StructureProfile
Constant Summary collapse
- PACKAGE_NAME =
'ast-crispr'- Context =
DocumentContext- Target =
OwnerSelector- Targets =
Selectors- VERSION =
Current gem version exposed at the traditional constant location.
Version::VERSION
Class Method Summary collapse
- .ast_merge_contract_anchor ⇒ Object
- .batch_operation_report(profiles) ⇒ Object
- .boundary_report ⇒ Object
- .delete_operation ⇒ Object
- .destination_profile(resolution_kind: 'append_fallback', resolution_source: 'none', anchor_boundary: 'none', used_if_missing: false) ⇒ Object
- .insert_operation ⇒ Object
- .limit(spec = nil) ⇒ Object
- .match_profile(start_boundary: 'owner_start', end_boundary: 'owner_end', payload_kind: 'structural_owner_body') ⇒ Object
- .move_operation ⇒ Object
- .operation_profile(operation_kind: 'replace', source_requirement: 'required', destination_requirement: 'none', replacement_source: 'explicit_text', captures_source_text: false, supports_if_missing: false) ⇒ Object
- .replace_operation ⇒ Object
- .selection_profile(owner_scope: 'shared_default', owner_selector: 'line_bound_statements', selector_kind: 'owner_filter', selection_intent: 'predicate_filter', comment_region: nil, include_trailing_gap: false) ⇒ Object
Class Method Details
.ast_merge_contract_anchor ⇒ Object
1686 1687 1688 |
# File 'lib/ast/crispr.rb', line 1686 def ast_merge_contract_anchor 'Ast::Merge.structured_edit' end |
.batch_operation_report(profiles) ⇒ Object
1862 1863 1864 1865 1866 1867 1868 |
# File 'lib/ast/crispr.rb', line 1862 def batch_operation_report(profiles) { operation_count: profiles.length, operation_kinds: profiles.map { |profile| profile.operation_kind.to_s }, operation_profiles: profiles.map(&:report) } end |
.boundary_report ⇒ Object
1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 |
# File 'lib/ast/crispr.rb', line 1690 def boundary_report { package: PACKAGE_NAME, layer: 'structural_edit_tool', status: 'active_thin_package', base_contract_package: 'ast-merge', relationship: { ast_merge: [ 'owns portable structured-edit envelope contracts', 'owns transport, report, replay, review, and provider handoff vocabulary', 'remains the substrate for provider-neutral fixtures' ], ast_crispr: [ 'owns ergonomic structural-edit selectors, profiles, and operation helpers', 'wraps ast-merge contracts instead of forking them', 'may grow compatibility helpers for old ast-crispr concepts after fixture-backed review' ], provider_packages: [ 'own parser-specific execution and metadata projection', 'may expose provider adapters consumed by ast-crispr', 'keep raw parser details behind normalized tree metadata or semantic sidecars' ], ast_template: [ 'orchestrates template and directory workflows', 'invokes structural edits through ast-merge or ast-crispr registries/envelopes', 'does not own parser-specific selectors' ] }, implementations: [ { language: 'go', package_name: 'astcrispr', import: 'github.com/structuredmerge/structuredmerge-go/astcrispr' }, { language: 'ruby', package_name: 'ast-crispr', require: 'ast/crispr' }, { language: 'rust', package_name: 'ast-crispr', crate: 'ast_crispr' }, { language: 'typescript', package_name: '@structuredmerge/ast-crispr', import: '@structuredmerge/ast-crispr' } ], initial_exports: [ 'package identity', 'boundary report', 'ast-merge structured-edit contract anchor', 'limit helpers', 'match profile helpers', 'selection profile helpers', 'destination profile helpers', 'operation profile helpers', 'replace/delete/insert/move helpers', 'batch operation helpers' ], future_exports: [], metadata: { source: 'legacy_crispr_reference', decision: 'Keep ast-merge as the base contract layer and revive ast-crispr as a separate thin package in every implementation.' } } end |
.delete_operation ⇒ Object
1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 |
# File 'lib/ast/crispr.rb', line 1829 def delete_operation OperationProfile.new( operation_kind: 'delete', source_requirement: 'required', destination_requirement: 'none', replacement_source: 'none', captures_source_text: true, supports_if_missing: false ) end |
.destination_profile(resolution_kind: 'append_fallback', resolution_source: 'none', anchor_boundary: 'none', used_if_missing: false) ⇒ Object
1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 |
# File 'lib/ast/crispr.rb', line 1786 def destination_profile( resolution_kind: 'append_fallback', resolution_source: 'none', anchor_boundary: 'none', used_if_missing: false ) DestinationProfile.new( resolution_kind: resolution_kind, resolution_source: resolution_source, anchor_boundary: anchor_boundary, used_if_missing: used_if_missing ) end |
.insert_operation ⇒ Object
1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 |
# File 'lib/ast/crispr.rb', line 1840 def insert_operation OperationProfile.new( operation_kind: 'insert', source_requirement: 'none', destination_requirement: 'optional', replacement_source: 'explicit_text', captures_source_text: false, supports_if_missing: true ) end |
.limit(spec = nil) ⇒ Object
1760 1761 1762 |
# File 'lib/ast/crispr.rb', line 1760 def limit(spec = nil) Limit.coerce(spec) end |
.match_profile(start_boundary: 'owner_start', end_boundary: 'owner_end', payload_kind: 'structural_owner_body') ⇒ Object
1764 1765 1766 |
# File 'lib/ast/crispr.rb', line 1764 def match_profile(start_boundary: 'owner_start', end_boundary: 'owner_end', payload_kind: 'structural_owner_body') MatchProfile.new(start_boundary: start_boundary, end_boundary: end_boundary, payload_kind: payload_kind) end |
.move_operation ⇒ Object
1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 |
# File 'lib/ast/crispr.rb', line 1851 def move_operation OperationProfile.new( operation_kind: 'move', source_requirement: 'optional', destination_requirement: 'optional', replacement_source: 'captured_text_or_explicit', captures_source_text: true, supports_if_missing: true ) end |
.operation_profile(operation_kind: 'replace', source_requirement: 'required', destination_requirement: 'none', replacement_source: 'explicit_text', captures_source_text: false, supports_if_missing: false) ⇒ Object
1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 |
# File 'lib/ast/crispr.rb', line 1800 def operation_profile( operation_kind: 'replace', source_requirement: 'required', destination_requirement: 'none', replacement_source: 'explicit_text', captures_source_text: false, supports_if_missing: false ) OperationProfile.new( operation_kind: operation_kind, source_requirement: source_requirement, destination_requirement: destination_requirement, replacement_source: replacement_source, captures_source_text: captures_source_text, supports_if_missing: supports_if_missing ) end |
.replace_operation ⇒ Object
1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 |
# File 'lib/ast/crispr.rb', line 1818 def replace_operation OperationProfile.new( operation_kind: 'replace', source_requirement: 'required', destination_requirement: 'none', replacement_source: 'explicit_text', captures_source_text: true, supports_if_missing: false ) end |
.selection_profile(owner_scope: 'shared_default', owner_selector: 'line_bound_statements', selector_kind: 'owner_filter', selection_intent: 'predicate_filter', comment_region: nil, include_trailing_gap: false) ⇒ Object
1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 |
# File 'lib/ast/crispr.rb', line 1768 def selection_profile( owner_scope: 'shared_default', owner_selector: 'line_bound_statements', selector_kind: 'owner_filter', selection_intent: 'predicate_filter', comment_region: nil, include_trailing_gap: false ) SelectionProfile.new( owner_scope: owner_scope, owner_selector: owner_selector, selector_kind: selector_kind, selection_intent: selection_intent, comment_region: comment_region, include_trailing_gap: include_trailing_gap ) end |