ast-grep
A strong pick. 3rd of 9 JavaScript parsers and codemods.
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
Overall7.5
How strongly do we recommend it for a new project today?
Claude Opus 5.5: 7.0, likely 6.0 to 8.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.
- npm downloads ratio: ~8.9x vs 4.1 median
- thoughtworks.com/radar/tools/ast-grep: Radar Trial
- ast-grep.github.io/advanced/tool-comparison.html: Syntax-only limits
- github releasesLastYear: 23 releases
GPT-6.2 Sol: 7.9, likely 6.8 to 8.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.
- github.com/codemod/benchmark/blob/main/README.md: Measured a speed advantage for simple structural searches and rewrites.
- thoughtworks.com/radar/tools/ast-grep: Reports successful team use for checking agent-generated code.
- github.releasesLastYear, github.latestRelease, dependents: 23 releases in a year and a small visible base of Node binding dependents.
- babeljs.io/docs/babel-parser: Documents Babel AST output and its ESTree compatibility option.
- ts-morph.com/navigation/finding-references: Shows the compiler-backed reference lookup needed for symbol-aware changes.
Needed by many4.8
How many developers need a tool for this job?
Claude Opus 5.5: 5.0, likely 4.0 to 6.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.
- thoughtworks.com/radar/tools/ast-grep: Used for search, lint and rewriting, with or without agents
- github description: CLI for structural search, lint and rewriting
GPT-6.2 Sol: 4.6, likely 3.4 to 5.9
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.
- thoughtworks.com/radar/tools/ast-grep: Documents structural search, rewriting, and custom rules across more than 20 languages.
- ast-grep.github.io/guide/api-usage/js-api: The native Node package ships JavaScript ecosystem grammars by default.
- 2025.stateofjs.com/en-US/other-tools: The survey gives no ast-grep-specific usage estimate.
Helps a lot7.6
How well does it do the job for those who need it?
Claude Opus 5.5: 7.0, likely 6.0 to 8.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.
- dev.to/herrington_darkholme/how-fast-is-your-code-search-tool-a-benchmark-of-five-ast-tools-590j: Benchmark: 43ms/11MB vs jscodeshift 754ms/153MB
- ast-grep.github.io/advanced/tool-comparison.html: Self-described as syntax-level only, no type or data-flow info
- ast-grep.github.io/guide/api-usage/js-api.html: JS API is stable, but replace does not fill in metavariables
- ast-grep.github.io/blog/ast-grep-agent.html: Rule generation is hard for AI
GPT-6.2 Sol: 8.2, likely 7.1 to 9.1
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.
- ast-grep.github.io/guide/quick-start: Shows wildcard patterns and interactive patch review on TypeScript.
- ast-grep.github.io/guide/api-usage/js-api: Documents typed traversal, captures, and text edits.
- github.com/codemod/benchmark/blob/main/README.md: Ast-grep led three tasks on 500 generated files. The benchmark author builds on ast-grep.
- justin.poehnelt.com/posts/finishing-agent-migrations-ast-grep: Rules improved agent migration completion, while some runs still took behavioral shortcuts.
- ast-grep.github.io/guide/rule-config/atomic-rule.html: Ambiguous snippets can require a larger syntax context.
- github.com/ast-grep/ast-grep/issues/2413: Users describe relying on external tools for semantic analysis.
- ts-morph.com/navigation/finding-references: Shows compiler-backed reference lookup.
Holds up over time7.3
Will it still be a good choice in two years?
Claude Opus 5.5: 7.0, likely 6.0 to 8.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.
- github commitsLastYear / releasesLastYear: 698 commits, 23 releases
- github openIssues/closedIssues: 36 open vs 739 closed
- github.com/ast-grep/ast-grep/releases: Recent releases add rule strictness and require Node 20
- codemod-i9syuung7-codemod.vercel.app/blog/jssg: Codemod builds jssg on ast-grep
GPT-6.2 Sol: 7.5, likely 6.2 to 8.6
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.
- github.commitsLastYear, github.releasesLastYear, github.contributors: 698 commits, 23 releases, and 106 contributors in total.
- github.openIssues, github.closedIssues, github.openPullRequests, github.mergedPullRequests: 36 open issues and 10 open PRs, with substantial closure and merge history.
- github.com/ast-grep/ast-grep/releases/tag/0.51.3: Lead-maintainer signature, recent fixes, and a Node.js 20 minimum.
- github.com/ast-grep/ast-grep/issues/2992: Documents the security-driven change to custom grammar loading.
- github.com/sponsors/HerringtonDarkholme: The lead maintainer receives public sponsorship.
Used widely4.7
How many use it, and is that growing?
Claude Opus 5.5: 5.0, likely 4.0 to 6.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.
- npm downloadsLast4Weeks / downloadsSame4WeeksYearAgo: 23.3M vs 2.6M, ratio ~8.9
- dependents: 177 repos, 25 packages: low vs peers
- github stars: 16.7k stars, growing quickly
GPT-6.2 Sol: 4.4, likely 2.9 to 6.1
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.
- npm.downloadsLast4Weeks, npm.downloadsSame4WeeksYearAgo, medianDownloadsRatio: 8.9 times year-over-year growth versus the 4.1 times catalog median.
- dependents, peers: 177 tracked repositories and 25 packages. jscodeshift has 154,569 tracked repositories and ts-morph has 20,857.
- github.stars, bluesky: 16,650 stars and 33 Bluesky links, more links than most peers. The top posts are automated.
- github.com/adonisjs/eslint-ast-grep: An ESLint integration pulls in the Node binding for its users.
- ast-grep.github.io/guide/quick-start: The CLI has separate distribution channels.
Vouched for6.8
Who stands behind it being good?
Claude Opus 5.5: 6.0, likely 5.0 to 7.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.
- thoughtworks.com/radar/tools/ast-grep: Trial ring, Nov 2026
- hermes-agent.nousresearch.com/docs/user-guide/skills/optional/software-development/software-development-ast-grep: Agent frameworks ship ast-grep skills
- hackerNews top: 93-point HN story in July 2026; others small
GPT-6.2 Sol: 7.6, likely 6.4 to 8.5
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.
- thoughtworks.com/radar/tools/ast-grep: November 2026 Trial rating and firsthand use in an agent workflow.
- codemod.com/blog/jssg: Codemod builds its JavaScript transformation runtime around ast-grep.
- github.com/adonisjs/eslint-ast-grep: AdonisJS runs ast-grep YAML rules inside ESLint through the native binding.
- justin.poehnelt.com/posts/finishing-agent-migrations-ast-grep: Firsthand account of a large production migration and 212 agent benchmark runs.
- 2025.stateofjs.com/en-US/other-tools: No ast-grep-specific satisfaction or retention data.
Safe7.7
How safe is it to depend on?
Claude Opus 5.5: 8.0, likely 7.0 to 9.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.
- advisories total: 0 advisories
- npm dependencies: 0 dependencies
- scorecard: No Scorecard data
- npm license: MIT
GPT-6.2 Sol: 7.3, likely 6.1 to 8.4
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.
- npm.license, npm.dependencies, advisories, scorecard: MIT, zero regular dependencies, no collected OSV records, and no Scorecard result.
- raw.githubusercontent.com/ast-grep/ast-grep/0.51.3/crates/napi/package.json: The manifest lists native build targets and no regular runtime dependencies.
- github.com/ast-grep/ast-grep/security: Lists two related custom grammar advisories and one Rust configuration advisory.
- fereidani.com/ast-grep-customlanguages-librarypath-loads-native-code-from-untrusted-projects: The reporter dates the fix release to October 9 and public disclosure to October 13.
- github.com/ast-grep/ast-grep/security/advisories/GHSA-fj5f-4qw6-hhpg: The Rust configuration issue affected 0.51.0 and was patched in 0.51.1.
- raw.githubusercontent.com/ast-grep/ast-grep/0.51.3/.github/workflows/napi.yml: GitHub Actions builds platform binaries and publishes using an npm token.
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
- npm downloads, 4 weeks
- 23M ×8.9 in a year
- GitHub stars
- 17k
- Commits, 12 months
- 698
- npm version
- 0.51.3 Nov 2026
- Versions, 12 months
- 23
- Advisories, 24 months
- 0 of 0 ever
- OpenSSF Scorecard
- None
- Licence
- MIT
Read on 21 November 2026 from GitHub (ast-grep/ast-grep), npm (@ast-grep/napi), OSV and the OpenSSF Scorecard.
JavaScript parsers and codemods
- 8.0Babel parser
- 7.8Oxc parser
- 7.5ast-grep
- 7.1Acorn
- 7.1Recast
- 7.0ts-morph
- 6.4jscodeshift
- 6.3Meriyah
- 2.4Esprima