Expand description
Pattern inference engine.
This module implements the core algorithm that derives a transformation pattern from one or more before/after example pairs. The process works as follows:
- Parse both the before and after code into tree-sitter ASTs.
- Walk the two trees in parallel, performing a structural diff.
- Where leaf nodes differ (identifiers, literals, etc.), extract them as
PatternVars. - Where the structure is identical, preserve it verbatim in the template.
- Assemble the
before_templateandafter_templateand compute a confidence score.
Structsยง
- Pattern
Inferrer - The pattern inference engine.