@dreki-gg/pi-ast-grep

Structural (AST-based) code search and rewrite tool for pi, powered by ast-grep

Packages

Package details

extension

Install @dreki-gg/pi-ast-grep from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@dreki-gg/pi-ast-grep
Package
@dreki-gg/pi-ast-grep
Version
0.2.0
Published
Jul 10, 2026
Downloads
80/mo · 12/wk
Author
jalbarrang
License
MIT
Types
extension
Size
4.5 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./extensions/ast-grep"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@dreki-gg/pi-ast-grep

Structural (AST-based) code search and rewrite tool for pi, powered by ast-grep.

Registers the ast_grep tool. Prefer it over text grep when matching code shape — call shapes like console.log($A), function/class definitions, imports, or refactors.

Requirements

ast-grep (alias sg) must be installed on your PATH.

Parameters

  • pattern — ast-grep pattern, e.g. console.log($A)
  • langts, tsx, js, jsx, py, go, rust, java, …
  • path — file or dir to search (default .)
  • rewrite — replacement pattern
  • updateAll — apply the rewrite to disk (default false = dry-run diff)