Autonomous Code Migration Assistant - Analyze, transform, and migrate codebases automatically with AI-powered intelligence.
ShiftForge is a CLI tool and local service that automatically generates migration pull requests for framework upgrades, runtime updates, and library migrations. Powered by Claude Sonnet 4.5 for intelligent code analysis and recommendations.
π Portfolio Project - Demonstrating AST transformations, multi-agent AI orchestration, and automated code migration techniques.
- π€ AI-Powered Analysis - Claude Sonnet 4.5 provides deep code insights, security analysis, and migration recommendations
- π― AST-Based Transformations - Precise code modifications preserving formatting and comments
- π Multi-Agent Architecture - Analyzer, Migrator, Validator, and PR Generator agents work autonomously
- β Iterative Validation - Automatically fix issues with test, lint, and type checking
- π¦ Production Ready - TypeScript, comprehensive tests, and extensive documentation
- π Static Code Analysis - Detect framework versions, dependencies, and migration opportunities
- π€ AI-Powered Intelligence - Claude Sonnet 4.5 analyzes code for technical debt, security issues, and optimal migration paths
- π― AST-Based Transformations - Precise code modifications using Abstract Syntax Trees (ts-morph, jscodeshift)
- β Automated Validation - Run tests, lints, and type checks with iterative auto-repair
- π¦ PR Generation - Create migration branches with AI-generated, detailed pull request descriptions
- π MCP Server - REST API for editor integrations and CI/CD pipelines
- π¨ Interactive Wizard - Step-by-step guided migration with preview and rollback
- β‘ Parallel Processing - Fast file processing with configurable concurrency
- Node.js - Node 14/16/18 β Node 20
- React - React 17/18 β React 19
- Express β Fastify - Framework migration with API transformations
- More coming soon!
- Node.js >= 18.0.0
- npm, yarn, or pnpm
- Git repository
# Clone the repository
git clone https://github.com/yourusername/shiftforge.git
cd shiftforge
# Install dependencies
npm install
# Build the project
npm run build
# Link globally (optional)
npm linkGet intelligent insights about your codebase:
# Analyze with AI (requires ANTHROPIC_API_KEY)
shiftforge ai-scan --path ./my-project
# Save full AI report
shiftforge ai-scan --path ./my-project --output ai-report.jsonWhat you get:
- π Deep code analysis (technical debt, security vulnerabilities, performance issues)
- π― Smart migration suggestions with effort estimates and benefits
- π‘ Actionable recommendations prioritized by impact
β οΈ Risk analysis with mitigation strategies
See AI_FEATURES.md for setup instructions and detailed capabilities.
Let ShiftForge guide you through the migration:
shiftforge wizardThe wizard will:
- Analyze your project
- Suggest available migrations
- Let you configure options
- Preview changes before applying
- Execute migration with validation
- Optionally create a PR
shiftforge scan
# Scan specific directory
shiftforge scan --path ./my-project
# Save analysis to file
shiftforge scan --output analysis.json# Run migration
shiftforge run --target node20
# Dry run (preview changes)
shiftforge run --target react19 --dry-run
# Auto-fix validation issues
shiftforge run --target fastify --auto-fix# Run all checks
shiftforge validate
# Attempt auto-fix
shiftforge validate --fix# Create PR branch
shiftforge pr --title "Migrate to Node 20"
# Push to remote
shiftforge pr --title "Upgrade React to 19" --pushStart the REST API server:
npm run serverServer runs on http://localhost:3000
POST /analyze - Analyze a project
curl -X POST http://localhost:3000/analyze \
-H "Content-Type: application/json" \
-d '{"projectPath": "/path/to/project"}'POST /suggest - Get migration suggestions
curl -X POST http://localhost:3000/suggest \
-H "Content-Type: application/json" \
-d '{"projectPath": "/path/to/project"}'POST /migrate - Run migration
curl -X POST http://localhost:3000/migrate \
-H "Content-Type: application/json" \
-d '{
"projectPath": "/path/to/project",
"target": "node20",
"dryRun": true
}'POST /validate - Validate project
curl -X POST http://localhost:3000/validate \
-H "Content-Type: application/json" \
-d '{"projectPath": "/path/to/project"}'# 1. Analyze the project
shiftforge scan
# 2. Preview the migration
shiftforge run --target fastify --dry-run
# 3. Execute the migration
shiftforge run --target fastify
# 4. Validate the changes
shiftforge validate
# 5. Create a PR
shiftforge pr --title "Migrate from Express to Fastify" --pushBefore:
const express = require('express');
const app = express();
app.get('/hello', (req, res) => {
res.json({ message: 'Hello World' });
});
app.listen(3000, () => {
console.log('Server running on port 3000');
});After:
const fastify = require('fastify');
const app = Fastify({ logger: true });
app.get('/hello', (request, reply) => {
reply.send({ message: 'Hello World' });
});
app.listen({ port: 3000 }, (err, address) => {
if (err) {
app.log.error(err);
process.exit(1);
}
console.log('Server running on port 3000');
});shiftforge run --target node20Transformations:
- β
Updates
package.jsonengines field - β
Replaces
new Buffer()withBuffer.from() - β Flags deprecated APIs for manual review
- β Updates documentation
shiftforge run --target react19 --auto-fixTransformations:
- β Updates React and ReactDOM imports
- β
Replaces
ReactDOM.render()withcreateRoot() - β Removes unnecessary React imports (new JSX transform)
- β Updates deprecated lifecycle methods
- β Replaces string refs with callback refs
shiftforge/
βββ src/
β βββ cli/ # CLI commands (scan, run, validate, pr)
β βββ core/
β β βββ analyzer/ # Static analysis engine
β β βββ migrator/ # Code transformation engine
β β βββ validator/ # Test/lint/type validation
β β βββ pr-generator/ # Git & PR creation
β βββ agents/ # LLM agent orchestration (future)
β βββ transformers/ # Language-specific transforms
β β βββ javascript/ # ExpressβFastify, Node, React
β β βββ typescript/ # TypeScript-specific
β β βββ java/ # Java migrations (future)
β βββ server/ # MCP REST API server
β βββ types/ # TypeScript type definitions
βββ migrations/ # Migration configurations
βββ examples/ # Example projects
# Install dependencies
npm install
# Run in development mode
npm run dev
# Run tests
npm test
# Lint code
npm run lint
# Type check
npm run typecheck
# Build
npm run build- AI Integration - Claude Sonnet 4.5 for intelligent analysis β
- Interactive Wizard - Guided migration experience β
- Parallel Processing - Fast concurrent file processing β
- Integration Tests - Comprehensive test coverage β
- More Migrations
- Python 2 β Python 3
- Java 8 β Java 17
- Vue 2 β Vue 3
- Webpack β Vite
- GitHub Actions Integration - Automated PR creation in CI
- VS Code Extension - Editor integration
- Custom Migration Rules - User-defined transformations via config
- Rollback Support - One-command rollback on failures
- Codebase Learning - Train on your codebase patterns
- Language: TypeScript 5.3
- AST Parsing: ts-morph, jscodeshift, @babel/parser
- AI: Anthropic Claude API (Sonnet 4.5)
- CLI: Commander.js, chalk, ora, prompts
- Git: simple-git
- Testing: Jest, ts-jest
- Build: TypeScript compiler
Contributions are welcome! Please read CONTRIBUTING.md for guidelines.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
See CODE_OF_CONDUCT.md for community guidelines.
MIT License - see LICENSE file for details.
- Built with TypeScript, Commander.js, ts-morph, and jscodeshift
- AI powered by Anthropic Claude Sonnet 4.5
- Inspired by Facebook's jscodeshift and Google's Refaster
- AST transformation techniques from the codemods community
- AI Features Guide - Complete AI capabilities and setup
- Architecture Documentation - Technical design and decisions
- Quick Start Guide - Get started in 5 minutes
- Contributing Guidelines - How to contribute
Built as a portfolio project demonstrating advanced TypeScript, AST manipulation, AI integration, and automated code transformation.