Skip to content
CodeMorph
Esc
  • No results for ""

Batch migration

How CodeMorph converts your project batch by batch, what happens to each file, how the repair loop works and how to steer, pause and resume.

Once you have a plan, batch migration converts it, one batch at a time, from the leaves up. Conversion uses your Anthropic key; see Settings and API keys.

Batches converting leaf modules first

Starting

Click Start migration under your plan in the Migrate tab, or give Morph an instruction in the box at the bottom of the panel:

Migrate the api folder, strict mode, keep tests green

Morph works through the plan in dependency order. Even if you ask for one folder, anything that folder depends on is converted first.

What happens to each file

  1. Context is gathered. The file itself, plus the typed versions of the files it imports, so real signatures are available instead of guesses.
  2. The file is converted. .js becomes .ts and .jsx becomes .tsx. Parameters and return values get types inferred from real usage; objects that cross module boundaries get exported interfaces; require and module.exports become import and export where it's safe.
  3. The project is type-checked. Not just the new file, because a change can break files that import it.
  4. Errors are repaired. If tsc reports errors, the exact diagnostics go back to the model for another attempt, a bounded number of times.
  5. The file is queued for review, either cleanly typed or marked as needing your attention.

Watching progress

  • Batch rows in the Migrate tab show progress as files complete, for example Batch 3 · api/ + middleware/ · 3/17.
  • A progress bar tracks the whole run.
  • Explorer dots go grey (not migrated), orange (converting) and green (TypeScript).
  • The status bar shows typed files out of total.
  • The CODEMORPH output panel logs each file:
[codemorph] batch 1/4 · lib/ · utilities
[codemorph] utils/catchAsync.ts · tsc 0 errors · 0 repairs
[codemorph] utils/logger.ts · tsc 0 errors · 1 repairs
[codemorph] models/payment.ts · needs review · 2 any

Files that need review

A file that still has errors after its repair attempts is left for you, with its remaining diagnostics. CodeMorph will not force it through with any or @ts-ignore. You can:

  • Fix it by hand in the editor.
  • Ask Morph about it: "Why does payment.ts need review?"
  • Give an instruction for another attempt: "Type meta as a record of strings."
  • Reject it and leave it as JavaScript for now.

Reviewing as you go

Converted files arrive as diffs for you to accept or reject. You can review while later files are still converting. See Review and accept diffs.

Steering a run

Useful instructions while a migration is running or between batches:

InstructionEffect
"Only lib and utils for now"Limits the run to the leaf batches
"Use strict mode"Holds every file to strict type-checking
"Prefer interfaces for exported object types"Sets a style preference for the run
"Leave config/ as CommonJS"Skips module syntax changes where tools expect require

Pausing and resuming

Stop at any batch boundary and come back later. The graph and plan are stored locally, so a paused migration resumes where it stopped. If you've changed a lot of code in the meantime, run Scan & Plan again first.

After the last batch

When every batch is accepted, run Verify across the whole project, commit, and consider tightening your tsconfig.json. See the guide Turning on strict mode.

Something unclear or out of date? Tell us.