# @ast-grep/napi

> Search and Rewrite code at large scale using precise AST pattern

Latest version **0.51.0** (published 2026-10-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ast-grep/napi
pnpm add @ast-grep/napi
yarn add @ast-grep/napi
bun add @ast-grep/napi
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score; high quality score; popular repo.

Warnings: low downloads; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.51.0 |
| Published | 2026-10-15 |
| First published | 2022-09-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 10 |
| Dependencies | 0 |
| Unpacked size | 356.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16319 |
| Maintainers | herringtondarkholme |
| Keywords | ast, pattern, codemod, search, rewrite |

## Links

- npm: https://www.npmjs.com/package/@ast-grep/napi
- Repository: https://github.com/ast-grep/ast-grep
- Homepage: https://ast-grep.github.io
- Issues: https://github.com/ast-grep/ast-grep/issues
- npm.io page: https://npm.io/package/@ast-grep/napi

## Recent versions

- 0.51.0 (latest) — 2026-10-15
- 0.7.2 (next) — 2023-07-09
- 0.50.0 — 2026-10-09
- 0.45.3 — 2026-08-31
- 0.45.2 — 2026-08-23
- 0.45.1 — 2026-08-07
- 0.45.0 — 2026-07-23
- 0.44.1 — 2026-07-04
- 0.44.0 — 2026-06-22
- 0.43.0 — 2026-05-25
- 0.42.3 — 2026-05-19
- 0.42.2 — 2026-05-10
- 0.42.1 — 2026-04-04
- 0.42.0 — 2026-03-16
- 0.41.1 — 2026-03-10
- … 164 more at https://npm.io/package/@ast-grep/napi/versions

## README

# @ast-grep/napi

<p align=center>
  <img src="https://ast-grep.github.io/logo.svg" alt="ast-grep"/>
</p>

## ast-grep(sg)

ast-grep(sg) is a CLI tool for code structural search, lint, and rewriting.

This npm package is for programmatic usage of ast-grep.
Please see the [API usage guide](https://ast-grep.github.io/guide/api-usage.html) and [API reference](https://ast-grep.github.io/reference/api.html).

Other resources include [ast-grep's official site](https://ast-grep.github.io/) and [repository](https://github.com/ast-grep/ast-grep).

## Support matrix

### Operating Systems

|                  | node14 | node16 | node18 |
| ---------------- | ------ | ------ | ------ |
| Windows x64      | ✓      | ✓      | ✓      |
| macOS x64        | ✓      | ✓      | ✓      |
| macOS arm64      | ✓      | ✓      | ✓      |
| Linux x64 gnu    | ✓      | ✓      | ✓      |
| Windows x32      | ✓      | ✓      | ✓      |
| Windows arm64    | ✓      | ✓      | ✓      |
<!-- | Linux arm gnu    | ✓      | ✓      | ✓      | -->
<!-- | Linux x64 musl   | ✓      | ✓      | ✓      | -->
<!-- | Linux arm64 gnu  | ✓      | ✓      | ✓      | -->
<!-- | Linux arm64 musl | ✓      | ✓      | ✓      | -->
<!-- | Android arm64    | ✓      | ✓      | ✓      | -->
<!-- | Android armv7    | ✓      | ✓      | ✓      | -->
<!-- | FreeBSD x64      | ✓      | ✓      | ✓      | -->

---
_Source: https://npm.io/package/@ast-grep/napi · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
