codemod
Codemod
Use pinned ts-morph for TypeScript and TSX migrations. A codemod is a complete migration recipe, not merely a rename
map: it combines deterministic AST transforms with enough semantic guidance for an agent to rewrite call sites that
cannot be changed mechanically.
Establish whether a migration exists
Before authoring a recipe for repository-owned API work, determine whether the affected surface exists on the remote default branch, a released tag, or another externally consumed canary. If the symbol or call shape exists only in the current unmerged branch or worktree, there is no consumer migration to preserve: edit the source and its in-repository call sites directly, and do not create or archive a codemod. A public-looking declaration is not a migration surface until it has been merged or otherwise shared with consumers.
Use a codemod once compatibility evidence exists, or when the user explicitly asks to preserve a migration recipe. When history is ambiguous, inspect the remote default branch and release/canary history before choosing the heavier workflow.