Large-scale codemods and migrations
Deterministic output, real pattern matching, and py() when you need an existing Python library.
The problem
Framework upgrades touch thousands of files. AST-aware tools exist in every ecosystem but rarely share one runtime with the AI step that handles the odd files regex cannot. Teams run a codemod, then a separate ChatGPT pass, and hope the outputs merge.
Why Ecko
- Pattern matching
- Match syntax shapes deterministically for the 95% case. Commit the transform; review the diff in git.
- AI for the long tail
- Send only unmatched files to
aiwith typed output, still in the same program. - py() bridge
- Call lib2to3, libcst, or a vendor parser through
py()when rewriting someone else's language syntax.
In practice
fn migrate(src: str) -> str {
match parse(src) {
OldCall(args) => rewrite(args)
_ => ai "Modernise this syntax" from src
}
}
Try it on your workload.