# benjamn/recast

JavaScript syntax tree transformer, nondestructive pretty-printer, and automatic source map generator

Repository: https://github.com/benjamn/recast
Canonical: https://ross.abutalabs.com/products/recast
Language: TypeScript
License: MIT
License Family: permissive
Last push: 2026-08-21T18:07:46+00:00

## Health v2 (maintenance only)
Score: 67/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 98, release rhythm 8, longevity 100
- inputs: {"age_days": 5094, "days_push": 12, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 5255, forks 363 (observed 2026-08-28T04:09:13.736091+00:00)

## What it is
Recast is a JavaScript syntax tree (AST) transformer and nondestructive pretty-printer that preserves original formatting where possible. It also generates source maps automatically when reprinting modified syntax trees.

## Use cases
- write codemods that refactor JavaScript code automatically
- transform a JavaScript AST and reprint it without losing formatting
- generate source maps for code transformations
- parse and manipulate JavaScript source code programmatically
- build custom linters or code analysis tools
- migrate legacy JavaScript syntax to newer standards

## When to choose
- you need to modify JavaScript code while preserving original formatting and comments
- you are building codemods or automated refactoring tools
- you need automatic source map generation for transformed code
- you want a stable, widely-used AST manipulation library

## When to avoid
- you only need to parse JavaScript without reprinting it
- you are transforming non-JavaScript languages
- you need a full-featured bundler or transpiler rather than an AST transformer

## Facets
- artifact type: library
- maturity: stable
- function: parser, serialization, developer-tools
- domain: parsers, developer-tools, programming-languages
- platform: -
- tags: ast, source-maps, codemod, pretty-printer, javascript, nodejs

## Member repositories
- benjamn/recast (main) score 67

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:13.736091+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:59:32.775587+00:00, confidence not recorded.
  - readme: https://github.com/benjamn/recast (fetched 2026-08-28T04:09:13.736091+00:00, sha c87ac830fd14)
- Data as of 2026-08-30T08:39:29.467469+00:00.
