# ast-grep: 7.5 out of 10

A strong pick. 3rd of 9 in [JavaScript parsers and codemods](https://elestia.ai/opensource/parsers/index.md).

ast-grep is a fast, Rust-based tool for structural search, linting and rewriting. It ships as a CLI and as a Node API (@ast-grep/napi) built on tree-sitter. It is a strong pick today for pattern-based codemods and lint rules, and is popular in AI-agent workflows. It only sees syntax, though, so deep type-aware TypeScript refactors still fit ts-morph better.

**Best for:** Teams and coding agents that want fast, pattern-based search, lint rules and rewrites across large or multi-language codebases.

## Scores

- **Overall: 7.5** (likely 6.4 to 8.5)
  - Claude Opus 5.5 (7.0): For pattern-based codemods, custom lint rules and agent-driven rewrites, ast-grep is fast, well maintained and growing fast, and it is the strongest pick for that kind of work. It is not a full parser or type-aware refactoring tool, so ts-morph, Babel/Recast or Oxc fit better when you need ESTree output, type information or exact formatting control. Being 0.x and resting on one lead maintainer keeps it below the top band.
  - GPT-6.2 Sol (7.9): Choose ast-grep for fast structural search, repeatable syntax-driven rewrites, and CI rules that prevent old patterns from returning. Its active release cadence and reported use make it a strong choice for new migration tooling. Babel parser fits Babel and ESTree tooling, and ts-morph fits type-aware refactors. Limited visibility into direct adoption and backup maintenance keeps the range wide.
- **Needed by many: 4.8** (likely 3.7 to 6.0)
  - Claude Opus 5.5 (5.0): Structural search and codemods are an occasional need for many developers, not a daily one in most projects. Lint rules and agent tooling widen the need somewhat, and so does support for many languages. Unlike Acorn or Babel, it is not a general-purpose parser that other tools build on.
  - GPT-6.2 Sol (4.6): Structural search, custom lint, and bulk rewrites are useful across frameworks and especially valuable during migrations. Most application developers only need a dedicated tool for this work occasionally. Its support for mixed-language repositories broadens its appeal, but there is little survey data on how often teams need it.
- **Helps a lot: 7.6** (likely 6.6 to 8.6)
  - Claude Opus 5.5 (7.0): It is very fast, its pattern syntax is intuitive, it has YAML rules with built-in tests, and its typed JS API works well for search-and-replace codemods. On the other hand, it works on syntax only, the JS API has gaps such as metavariables not being filled in by replace, and complex transforms are harder than with jscodeshift or ts-morph. The maintainers also note that AI agents struggle to write ast-grep rules.
  - GPT-6.2 Sol (8.2): Code-like patterns, interactive previews, and a documented, typed Node API make syntax-driven edits quick to write and review. Codemod’s synthetic benchmark put the CLI ahead of Recast and jscodeshift on all three tasks, and a practitioner found the rules useful for checking agent migrations. Ambiguous patterns need care, and type-aware changes still need a tool like ts-morph. Benchmark coverage is limited for complex rewrites.
- **Holds up over time: 7.3** (likely 6.1 to 8.3)
  - Claude Opus 5.5 (7.0): Activity is high: 698 commits, 23 releases, a release five days before readAt, 106 contributors, and only 36 open issues against 739 closed. Codemod sponsors it and builds its runtime on it. Two things keep the score from going higher: it depends mostly on one lead maintainer, and as a 0.x project its minor releases keep tightening behaviour.
  - GPT-6.2 Sol (7.5): The project shipped 23 releases in a year, and its recent releases show ongoing fixes and dependency updates. The latest upgrade raised the Node minimum, and an earlier security release changed how custom grammars load. Public sponsorship and a broad contributor list help, but release signing centers on a lead maintainer and backup release access is unclear.
- **Used widely: 4.7** (likely 3.5 to 6.1)
  - Claude Opus 5.5 (5.0): Downloads grew about 8.9x in a year, from 2.6M to 23.3M per 4 weeks, which is well above the 4.1 median. Part of that comes from tools that bundle it, such as codemod runners and agent harnesses. ecosyste.ms counts only 177 repo and 25 package dependents, far below jscodeshift or ts-morph, so direct choices likely number in the tens of thousands. The CLI package is not counted here.
  - GPT-6.2 Sol (4.4): Four-week downloads rose from 2.61 million to 23.26 million, about 8.9 times year over year and above the catalog’s 4.1 times baseline. The Node binding has far fewer tracked dependent repositories than jscodeshift or ts-morph, and downstream tools can install it automatically. The 16,650 stars and 33 Bluesky links cover the whole project, including the CLI, whose standalone use the package count misses.
- **Vouched for: 6.8** (likely 5.7 to 7.8)
  - Claude Opus 5.5 (6.0): Thoughtworks put it in the Trial ring of its Technology Radar in November 2026. Codemod builds its jssg runtime on it, and many agent frameworks ship ast-grep skills. Independent user write-ups are scarce, it does not appear in surveys, and the benchmarks come from parties tied to the project.
  - GPT-6.2 Sol (7.6): Thoughtworks placed ast-grep in Trial after a team used it to check code written by an agent. Codemod uses it as its matching engine, AdonisJS wraps the Node binding for ESLint, and a practitioner reported using its rules in a 348,000-line TypeScript and Svelte migration. These are concrete uses, with limited evidence on broader production adoption or developer retention.
- **Safe: 7.7** (likely 6.6 to 8.7)
  - Claude Opus 5.5 (8.0): It has no advisories ever, zero runtime dependencies and an MIT licence. It ships prebuilt native binaries per platform, which are opaque compared with plain JS, and there is no OpenSSF Scorecard data, so the range stays moderate.
  - GPT-6.2 Sol (7.3): The MIT-licensed Node package declares zero regular npm dependencies and ships platform-specific native binaries. GitHub records issues missed by the bundle’s advisory count. The custom grammar loading issue was fixed in 0.50.0 before public disclosure, and the Rust configuration memory-corruption issue was fixed in 0.51.1. Token-based npm publishing and the missing Scorecard leave uncertainty about release controls.

## Good

- Code-like patterns and YAML rules make simple codemods much shorter to write than AST-visitor code in jscodeshift.
- Native Rust speed: independent benchmarks show it runs over ten times faster and uses far less memory than jscodeshift.
- Very active development: 23 releases and about 700 commits in the last year, with typed Node, Python and WASM bindings.
- It is the backbone of Codemod's jssg runtime and of many AI-agent skills and MCP servers.

## Bad

- It works on syntax only: no type information, scope or data-flow analysis, unlike ts-morph.
- It is still 0.x, and recent minor releases tightened rule validation, deprecated the `sg` command and raised the minimum to Node 20.
- Complex multi-step transforms are harder to express than in a full AST API like jscodeshift or Recast.
- It ships prebuilt native binaries per platform, and its tree-sitter parse trees differ from ESTree, so ESTree-based tools cannot reuse them.

## The numbers

- Downloads, 4 weeks: 23M
- In a year: ×8.9
- GitHub stars: 17k
- Commits, 12 months: 698
- Last npm release: Nov 2026
- Advisories, 24 months: 0
- Licence: MIT
- GitHub: https://github.com/ast-grep/ast-grep
- npm: https://www.npmjs.com/package/@ast-grep/napi

Scores run from 0 to 10 and are the mean of the scores of AI reviewers (Claude Opus 5.5, GPT-6.2 Sol), made on 22 November 2026 from GitHub, npm, OSV, OpenSSF Scorecard, ecosyste.ms, Hacker News and Bluesky data and a web search. The ecosyste.ms count of repositories that use a project is far too low for projects that grew in the last few years, and some reviews quote it. Overall is the reviewers' own judgement for a new project today, not an average of the parts. An AI wrote them and can be wrong.
