Codemod CLI
$ codemod Official Med RiskCodemod CLI automates framework upgrades and AST-based codebase migrations via local workflows or registry recipes. It supports --dry-run, --no-interactive, and --format json / --format jsonl machine-readable output for CI and coding agents.
npm install -g codemod codemod --dry-run --format jsonl executes multi-file AST transforms directly on the local repository without proxying file trees through MCP.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Provides --format json / --format jsonl, --dry-run, and --no-interactive flags built specifically for automation.
- Supports
--dry-run,--format jsonl, and--no-interactive
--dry-run prevents disk mutations safely, though executing remote registry codemod packages runs JavaScript/AST code locally.
--dry-runverifies transforms prior to writing- Registry recipes execute local scripts
Runs via npm install -g codemod or npx codemod across macOS, Linux, and Windows (Node.js required).
- Cross-platform npm/npx distribution
Combines curated framework upgrade recipes with workflow orchestration and AST engines.
- Supports
jscodeshift,ast-grep, and multi-step workflows
Actively maintained official CLI by Codemod (codemod/codemod) under Apache-2.0.
- Official
codemod/codemodrepository
Structured documentation at docs.codemod.com covering CLI flags, workflows, and JSONL control.
- Official docs at docs.codemod.com
Security, Auth & Guardrails
No auth needed for local workflows; optional registry/cloud login stores tokens in ~/.codemod or uses API key env vars.
CLI is Apache-2.0 open-source and free for local/registry runs; hosted Codemod enterprise features are paid.
# Codemod CLI Agent Rules - Always run with `--dry-run --format jsonl` and `--no-interactive` before applying changes. - Inspect third-party registry recipes before running them locally, as codemod recipes execute Node/AST logic.
Agent-Ready Command Recipes
Safe Read-Only Queries
codemod workflow run -w ./codemod.yaml --target ./src --dry-run --format jsonl
Simulates the migration workflow with --dry-run and emits structured JSONL events without writing files.
Controlled Writes & Previews
codemod workflow run -w ./codemod.yaml --target ./src --no-interactive
Applies the reviewed workflow across ./src without interactive prompts.
Strengths for Agents
- + First-class
--dry-run,--no-interactive, and--format jsonlflags for agent orchestration. - + Curated registry recipes accelerate common framework upgrades.
Caveats & Pitfalls
- ! CLI flags have evolved across major versions (
codemodvscodemod@next); check--helpif subcommand syntax differs. - ! Executing external registry recipes runs third-party transform code locally.