Introducing jssg: precise, scalable codemod runtime

3 min read

jssg is a modern, language-agnostic code search and transformation runtime. You author transforms in JavaScript/TypeScript with a clear, typed contract, while the matching engine is ast-grep, so it can analyze and edit any language ast-grep supports. jssg runs on QuickJS and can target AWS LLRT for Node.js compatible execution.

If you have used jscodeshift, the authoring model will feel familiar, with stronger pattern capabilities and better operational primitives for large migrations.

What jssg provides

  • Expressive search with ast-grep: Author rule configs, compose patterns with matches, constraints, and stopBy, and target exactly what you intend across large repos.
  • Predictable transforms: A typed transform function that returns explicit edits, with first-class support for JS/TS/JSX/TSX.
  • Structured match data: Access captured bindings to drive precise edits.
  • Dynamic parsing: analyze embedded languages such as TSX inside MDX.
  • Runtime configuration: Read parameters at runtime for safe, configurable migrations.
  • Sharding at scale: Use matrix strategy and values to split work by directory, team, or any key.
  • Persistent state: Track progress across long-running or multi-repo transformations.
  • Testing and CI: Structure codemod tests and run them in CI for repeatability.
  • From CLI to enterprise: Start locally, then adopt centralized state, orchestration, and insights when needed.

Ecosystem integration

We built jssg (JavaScript ast-grep), a modern successor to jscodeshift, powered by ast-grep. jssg keeps the familiar authoring model while upgrading the engine to ast-grep. It’s faster, polyglot, ships with built-in tests, and provides a modern, typed developer experience. jssg codemods also integrate with:

  • Codemod CLI: richer utilities than jscodeshift CLI (scaffold init, jssg test, workflow runner, caching).
  • Codemod Registry: discover, publish, and version public, private, and pro codemods.
  • Codemod Workflow: chain multi-step migrations (including AI-assisted steps) across repos.
  • Codemod MCP: run jssg codemods directly from your coding agent or IDE assistant.

Getting started

  1. Scaffold a codemod using Codemod CLI
1npx codemod init my-codemod
2cd my-codemod
  1. Build your first transform

If you’re just getting started with jssg, we recommend using Codemod Studio or MCP

1// src/transform.ts
2import { Transform, TSX } from 'codemod:ast-grep';
3
4const transform: Transform<TSX> = async (root, options) => {
5 // Use ast-grep rules to find targets, compute edits, and return them
6 return [];
7};
8
9export default transform;
  1. Test locally
1npx codemod jssg test
  1. Run via a workflow
1npx codemod workflow run -w ./workflow.yaml

When to use jssg

  • Precise code transformations and refactors
  • Codebase hygiene and architectural pattern enforcement
  • Cross-repo consistency work with sharded execution
  • Parameterized transformations for team workflows

Nest steps

Learn more in jssg docs →

Contribute to jssg →

Start migrating in seconds

Save days of manual work by running automation recipes to automate framework upgrades, right from your CLI, IDE or web app.

Get started