@op1/ast-grep
v0.3.0
Published
AST-aware code search and replace tools for OpenCode - powered by ast-grep
Maintainers
Readme
@op1/ast-grep
AST-aware code search and replace for OpenCode, powered by ast-grep.
Features
- 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
Installation
bun add @op1/ast-grepConfiguration
{
"plugin": ["@op1/ast-grep"]
}Tools
| Tool | Description |
|------|-------------|
| ast_grep_search | Search code patterns |
| ast_grep_replace | Replace patterns (dry-run by default) |
Pattern Examples
| Pattern | Matches |
|---------|---------|
| console.log($MSG) | Any console.log call |
| function $NAME($$$) { $$$ } | Any function |
| async function $NAME($$$) { $$$ } | Async functions |
Supported Languages
bash, c, cpp, csharp, css, go, html, java, javascript, json, kotlin, python, ruby, rust, typescript, tsx, yaml, and more.
License
MIT
