# AST Grep

> Use the ast-grep plugin to parse and manipulate code

These runtime helpers provide a friendly wrapper around the [ast-grep](https://ast-grep.github.io/).

## Installation

[Section titled “Installation”](#installation)

* npm

  ```sh
  npm i -D @genaiscript/plugin-ast-grep
  ```

* pnpm

  ```sh
  pnpm add -D @genaiscript/plugin-ast-grep
  ```

* yarn

  ```sh
  yarn add -D @genaiscript/plugin-ast-grep
  ```

If you are using the plugin in a Node.JS environment, without a `.genai...` entry file, you will need to initialize the [runtime](/genaiscript/reference/runtime) before using the plugin:

```ts
import { initialize } from "@genaiscript/runtime";


await initialize();
```

## Usage

[Section titled “Usage”](#usage)

See the [ast-grep](/genaiscript/reference/scripts/ast-grep) script for examples of how to use the plugin.