# Recast: 7.1 out of 10

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

Recast parses JavaScript or TypeScript into an AST and prints it back, reprinting only the nodes you changed so the rest of the file keeps its formatting. jscodeshift and other popular tools build on it. It is still the standard low-level engine for code changes that must keep the source's formatting. Its API is low-level, its printer has long-standing bugs, and it depends on the stale ast-types package.

**Best for:** Authors of codemod frameworks, CLIs and build plugins who must edit users' source files and keep their formatting and comments.

## Scores

- **Overall: 7.1** (likely 6.0 to 8.1)
  - Claude Opus 5.5 (6.5): For a tool that must edit source files and keep their formatting, Recast is still the standard engine, and its 2026 revival makes it a safer bet than it was. Most people writing codemods should pick jscodeshift, which wraps it, or ts-morph for type-aware TypeScript changes. Its printer bugs, the stale ast-types dependency and reliance on one maintainer keep it from a higher score.
  - GPT-6.2 Sol (7.6): Recast is a strong starting point for custom JavaScript and TypeScript rewrites where unrelated formatting changes make diffs harder to review. Pick jscodeshift when you need a ready-made batch runner, ast-grep for fast pattern rewrites, or ts-morph when edits depend on TypeScript symbols. Recent printer fixes support adopting Recast today, while Babel 8 adapter friction and a concentrated maintenance team temper the two-year outlook.
- **Needed by many: 4.3** (likely 3.2 to 5.4)
  - Claude Opus 5.5 (4.0): Few developers write code that rewrites source code. Those who do are mostly authors of tools, codemods and scaffolding CLIs. Recast's narrower job, format-preserving reprinting, matters most to that group. Many developers run tools built on it without knowing it.
  - GPT-6.2 Sol (4.5): Recast works across frameworks and serves teams writing migrations, upgrade tools, and source editors for JavaScript or TypeScript. Most application teams need to write their own AST transforms only occasionally. The survey measures language use, so the share of developers who need formatting-preserving rewrites remains an estimate.
- **Helps a lot: 7.1** (likely 6.1 to 8.2)
  - Claude Opus 5.5 (6.5): No other JavaScript tool reprints only the changed nodes as well as Recast does. That is why jscodeshift and magicast build on it. It ships types and works with several parsers. The API is low-level, and printing bugs stay open for years: lost BigInt suffixes, extra parentheses, comment placement and Babel cases that lose formatting. A peer such as jscodeshift or ts-morph is easier for most codemod work.
  - GPT-6.2 Sol (7.7): Recast keeps untouched text intact and gives developers and coding agents clear examples for visitors and node builders. Transforms must start with Recast's parse API and preserve original node references. Source review shows that its bundled adapters pass options that Babel 8 rejects, so parser choice matters even for simple input. A 500-file benchmark favored ast-grep for a simple rewrite, while ts-morph provides the symbol references needed for cross-file TypeScript refactors.
- **Holds up over time: 6.5** (likely 5.1 to 7.8)
  - Claude Opus 5.5 (6.0): Maintenance picked up in 2026: 81 commits and releases 0.24.0 to 0.24.3, with many outside pull requests merged and automated releases. One maintainer, eventualbuddha, did most of the merges, and the original author is not active. The stale ast-types dependency and missing oxc support show risk as the ecosystem moves to Rust-based parsers. The tool is so deeply embedded that someone will likely keep it working.
  - GPT-6.2 Sol (6.9): Recast recorded 81 commits in the past year and shipped three GitHub patch releases in November, including fixes for comment and template literal printing. Several contributors supplied fixes, but recent merges cluster around one maintainer and the Oxc adapter remains under review. The 0.24 line also raises the declared minimum to Node.js 22, and long-term staffing and funding are unclear.
- **Used widely: 6.7** (likely 5.5 to 7.8)
  - Claude Opus 5.5 (7.0): It has about 240M downloads in 4 weeks and about 477k dependent repositories. Most of that comes through jscodeshift, magicast and other tools, not direct choices. Downloads grew 3.7x in a year, below the 4.1 median, so it is slowly losing ground. Direct users are probably in the tens of thousands of projects.
  - GPT-6.2 Sol (6.3): Ecosyste.ms finds about 477,000 dependent repositories, above jscodeshift and ts-morph but below Acorn and Babel parser. Four-week installs rose from 64.6 million to 240 million, or 3.72×, below the catalog median of 4.1× and behind ts-morph and ast-grep. Downstream installs through tools such as jscodeshift and sparse public discussion make direct adoption hard to estimate.
- **Vouched for: 7.2** (likely 6.1 to 8.2)
  - Claude Opus 5.5 (6.5): Meta's jscodeshift, UnJS magicast and many framework CLIs build on it, and Chromium DevTools vendors it. Houdini maintainers report it works well. It has no survey data and no independent benchmark, and most endorsements come from embedding, not from recent reviews.
  - GPT-6.2 Sol (7.8): Meta's jscodeshift builds on Recast, and both Next.js and monday.com's Vibe use that stack for migrations. Houdini also declares a direct dependency. These integrations show that teams rely on Recast for real tooling, though several use older release lines and there is little direct evidence of broad satisfaction with 0.24.3.
- **Safe: 7.4** (likely 6.3 to 8.5)
  - Claude Opus 5.5 (7.5): It has no advisories ever, 5 dependencies and an MIT licence. Releases now come from GitHub Actions. The OpenSSF Scorecard is 5.5, with weak token permissions, no security policy and only partly pinned dependencies. As a dev-time tool, it usually does not run in production.
  - GPT-6.2 Sol (7.3): Recast has a permissive MIT license, five direct runtime dependencies, and zero advisories in the supplied OSV snapshot. Its GitHub Actions release workflow runs tests before publishing through npm trusted publishing. The 5.5 OpenSSF Scorecard flags weak token permissions, pinning, and branch protection, and gives no credit for a security policy or fuzzing. The current set of people with release authority is unclear.

## Good

- It keeps the original formatting and comments of unchanged code, so diffs stay minimal and easy to review.
- You can plug in Babel, TypeScript, Acorn, Esprima or Flow parsers, and it generates source maps automatically.
- It is proven at scale: jscodeshift, magicast and many CLIs run on it, and ecosyste.ms counts about 477k dependent repositories.
- It is small and low-risk to install: 5 dependencies, an MIT licence and no known advisories.

## Bad

- The API is low-level. It has no collection API, no CLI runner and no type-aware analysis; jscodeshift and ts-morph add those.
- The printer has long-standing bugs that stay open for years, around comments, parentheses, JSX and newlines.
- It depends on ast-types, which is stale, and it does not support oxc-parser.
- It is still at version 0.x, and in 2026 one maintainer did most of the work.

## The numbers

- Downloads, 4 weeks: 240M
- In a year: ×3.7
- GitHub stars: 5.3k
- Commits, 12 months: 81
- Last npm release: Nov 2026
- Advisories, 24 months: 0
- Licence: MIT
- GitHub: https://github.com/benjamn/recast
- npm: https://www.npmjs.com/package/recast

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.
