`morph-cli` helps modernize large codebases using structured AST transforms, safe dry-runs, rollback support, migration planning, review workflows, and incremental analysis.
Built for developers who want safer large-scale migrations without relying on fragile regex replacements.
- ----
- ------
- -----
- ------
Large migrations are painful.
Most migration tooling:
- ---
`morph-cli` focuses on:
- ----
```bash
cargo install morph-cli
From Source
Binary:
Quick Start
Scan a project
Generate migration recommendations
Run a dry-run migration
Apply changes
Review changes interactively
Verify migration output
Rollback a migration
Example Workflow
# Analyze repository
# Generate migration plan
# Run migration safely
# Verify results
# Export report
Supported Recipes
| Recipe | Description |
|---|---|
commonjs-to-esm |
Convert CommonJS modules to ESM |
js-to-ts |
Migrate JavaScript projects to TypeScript |
react-class-to-hooks |
Convert React class components to hooks |
express-to-fastify |
Migrate Express applications to Fastify |
Safety Features
morph-cli is designed to be conservative by default.
Features include:
- Dry-run execution
- Confidence scoring
- Verification checks
- Rollback support
- Review mode
- Risk detection
- Execution safeguards
- Incremental checkpoints
Unsafe or unsupported patterns are skipped with warnings instead of being forcefully rewritten.
Monorepo Support
morph-cli supports:
- npm workspaces
- pnpm workspaces
- yarn workspaces
You can scope migrations to specific packages:
Presets
Built-in migration presets:
Examples:
modern-nodetypescript-adoptionreact-modernization
Reports & Sessions
morph-cli stores:
- migration sessions
- dry-run snapshots
- scan summaries
- validation reports
Useful commands:
Watch Mode
Incrementally analyze repositories during development:
Configuration
Example morph-cli.toml:
= true
= [
"dist",
"build",
"node_modules"
]
[]
= true
= false
[]
= false
= true
Philosophy
morph-cli is built around a few core principles:
- AST-based transforms over regex hacks
- Conservative migrations over risky rewrites
- Explainable automation
- Safe incremental modernization
- Human review when confidence is low
Project Status
morph-cli is currently under active development.
Some advanced framework patterns and ecosystem edge cases may still require manual migration work.
Always review important migrations before deploying to production.
Roadmap
Planned areas of improvement:
- Better transform coverage
- Real-world repository validation
- Stronger semantic verification
- Plugin runtime support
- AI-assisted migration suggestions
- Expanded ecosystem recipes
Contributing
Contributions are welcome.
Before contributing:
- keep changes focused
- avoid broad unrelated refactors
- preserve existing behavior where possible
License
MIT License
Author
Built by Shreyaj Dinesh
GitHub: https://github.com/s0r0j