Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

jscodeshift

$ jscodeshift Official Med Risk
Meta · Files & Search · MIT · macos / linux / windows

Meta's jscodeshift executes JS/TS AST transformation scripts in parallel across worker processes using recast and Babel/TypeScript parsers. Passing -d (--dry) and -p (--print) enables safe diff inspection before applying in-place edits.

FCRS-1.0 Score
83 /100
Good
Medium Confidence
Zero-Friction Install
npm install -g jscodeshift
CLI vs MCP Decision CLI Preferred vs MCP

jscodeshift spawns local Node worker pools directly against source trees; MCP cannot efficiently proxy arbitrary Recast AST transforms.

Agent-Readiness Checklist

— JSON Output
— Field Filtering
✓ Non-Interactive
✓ Dry-Run
— Read-Only Mode
— NO_COLOR Clean
— Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 19 / 25

Non-interactive CLI with -d (--dry) dry-run, -p stdout print, and --silent, though it emits text summaries rather than --json.

  • Supports -d (--dry), -p (--print), and --run-in-band
  • Outputs plain-text worker stats; no --json flag
Trust & Safety 22 / 25

-d guarantees zero disk writes; omits -d writes matched files in-place and runs user-authored transform JS.

  • Dedicated -d (--dry) flag prevents file modification
  • Requires running transform files via Node.js
Setup & Portability 13 / 15

Universally installable via npm install -g jscodeshift or npx jscodeshift wherever Node.js is present.

  • Cross-platform npm/npx package
Utility & Efficiency 13 / 15

Industry-standard parallel AST codemod runner preserving formatting and comments via recast.

  • Multi-worker JS/TS/Flow AST transforms with formatting preservation
Maintenance & Lineage 8 / 10

Official Meta open-source project (meta/jscodeshift) under MIT with mature ecosystem adoption.

  • Official Meta repository under MIT
Docs & Verifiability 8 / 10

Clear CLI flag list and transform API examples in the README and --help.

  • Documented CLI flags and transform examples on GitHub

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

None required; executes local JS/TS transform modules on local source files.

Side Effects
Read-Only Local Write
Cost & Quotas

100% free, offline, and open-source (MIT).

Copyable Guardrail for CLAUDE.md / AGENTS.md
# jscodeshift Agent Rules
- ALWAYS pass `-d` (`--dry`) first (with `-p` on a sample file) before omitting `-d` to write changes.
- Specify `--parser=tsx` and `--extensions=ts,tsx` explicitly when targeting TypeScript codebases.

Agent-Ready Command Recipes

Safe Read-Only Queries

Dry-run an AST transform and print output
jscodeshift -t transform.js --extensions=ts,tsx --parser=tsx -d -p src/

Simulates the codemod with -d (--dry) and prints transformed files (-p) without writing to disk.

Controlled Writes & Previews

Apply TypeScript AST codemod in-place
jscodeshift -t transform.js --extensions=ts,tsx --parser=tsx src/

Runs the verified transform in parallel across src/ and writes formatted AST edits in-place.

Strengths for Agents

  • + Preserves untouched formatting and comments during complex JS/TS AST rewrites via recast.
  • + -d (--dry) + -p provides safe verification before in-place writes.

Caveats & Pitfalls

  • ! No --json output; defaults to modifying files in-place if -d is forgotten.
  • ! Default parser is babel (JS), so TypeScript files fail unless --parser=ts or --parser=tsx is specified.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI