AST-aware code search and replace tools for OpenCode - powered by ast-grep
npm install @op1/ast-grepAST-aware code search and replace for OpenCode, powered by ast-grep.
- 25 Languages - TypeScript, Python, Go, Rust, Java, and more
- Meta-variables - $VAR (single node), $$$ (multiple nodes)
- Auto-download - Downloads ast-grep binary if needed
- Dry-run Default - Safe replacements
``bash`
bun add @op1/ast-grep
`json`
{
"plugin": ["@op1/ast-grep"]
}
| Tool | Description |
|------|-------------|
| ast_grep_search | Search code patterns |ast_grep_replace
| | Replace patterns (dry-run by default) |
| Pattern | Matches |
|---------|---------|
| console.log($MSG) | Any console.log call |function $NAME($$$) { $$$ }
| | Any function |async function $NAME($$$) { $$$ }` | Async functions |
|
bash, c, cpp, csharp, css, go, html, java, javascript, json, kotlin, python, ruby, rust, typescript, tsx, yaml, and more.
MIT