GoGoCode is an AST-based code transformation toolkit that enables developers to query, match, and rewrite JavaScript source code using jQuery-style selectors and wildcard patterns. At its core, it provides a programmatic code refactoring library that manipulates parsed AST nodes, allowing precise structural modifications without worrying about formatting differences. The toolkit also functions as a JavaScript AST query engine, finding code patterns through snippet-based matching with wildcards that capture unknown or variable-length fragments.
What distinguishes GoGoCode is its callback-driven dynamic replacement system, where transformation callbacks receive matched wildcard values and return context-aware replacement code. The jQuery-style selector syntax makes AST traversal intuitive without manual tree walking, while the wildcard-based pattern matching handles both fixed and variable-length code fragments during queries. The toolkit includes a multi-framework migration engine that automates upgrading Vue 2 components to Vue 3 syntax, converting Element UI imports to Element Plus equivalents, and migrating iView to iView 4, with full Vue template-aware parsing for single-file component transformations.
The code transformation capabilities cover AST node insertion, deletion, and replacement, along with positional code insertion methods like append, prepend, before, and after. For querying, it supports code existence checks, matched node iteration, and AST-to-code generation for output or inspection. The framework migration tools specifically handle Vue template transformations alongside JavaScript, enabling full-stack code modifications in a single pass.