AI Framework Migration
The Problem
Framework migrations are the projects everyone puts off. Migrating from React Class Components to Hooks, Express to Fastify, or JavaScript to TypeScript means touching hundreds of files with similar transformations. The work takes weeks and blocks other development.
How Stoneforge solves it
AI framework migration with Stoneforge breaks large migrations into parallel tasks. You define the transformation pattern once, and automated code migration agents apply it across your codebase concurrently.
Plan the migration dependency graph
Migrations have dependencies: you can’t migrate components before migrating the shared utilities they import. Stoneforge’s Director agent analyzes your import graph and creates a dependency-ordered plan for the AI framework migration.
# Create a plan for the migration
sf plan create --title "Migrate from JavaScript to TypeScript"
# The Director breaks this into dependency-ordered tasks:
# Phase 1 (parallel): Add tsconfig.json, install dependencies
# Phase 2 (parallel): Migrate src/types/ and src/utils/ (no deps)
# Phase 3 (parallel): Migrate src/services/ (depends on types)
# Phase 4 (parallel): Migrate src/components/ (depends on utils)
# Phase 5 (parallel): Migrate src/pages/ (depends on components)
# Phase 6: Update build config and CI pipeline
Consistent automated code migration at scale
Consistency matters in migrations. Every file should be transformed the same way. Stoneforge supports this through workspace prompts where you define the transformation rules each agent follows.
# .stoneforge/prompts/worker.md:
# "TypeScript migration rules:
# - Use strict mode, no implicit any
# - Prefer interface over type for object shapes
# - Use unknown instead of any for external data
# - Add return types to all exported functions
# - Convert require() to import statements
# - Preserve existing JSDoc as TSDoc"
Incremental, not big-bang
Each phase produces small, mergeable PRs. Your codebase transitions incrementally instead of through a long-lived migration branch that goes stale. If something goes wrong, you roll back one PR, not the entire migration. This approach works hand-in-hand with AI code refactoring for broader codebase improvements.
Parallel execution within phases
Within each phase of an AI framework migration, agents work in parallel. If Phase 3 has 15 service files to migrate, three agents can handle five files each. The dependency system ensures phases execute in the right order while allowing parallelism within each phase.
# Start the migration
sf serve
# Dashboard shows parallel progress:
# Worker-1: Migrating src/services/auth.js → auth.ts (45%)
# Worker-2: Migrating src/services/billing.js → billing.ts (72%)
# Worker-3: Migrating src/services/users.js → users.ts (100% ✓)
Test-driven automated code migration
Agents run existing tests against migrated code and fix any failures before submitting a merge request. For TypeScript migrations, they also check for type errors with tsc --noEmit. Pair with AI test generation to fill coverage gaps exposed during migration.
Related documentation
Frequently asked questions
What types of AI framework migration does Stoneforge handle?
How does automated code migration ensure consistency?
Can I run an AI framework migration incrementally?
How does automated code migration handle edge cases?
What if the AI framework migration breaks existing tests?
Ready to get started?
Set up Stoneforge in under 30 seconds and start orchestrating AI agents in parallel.