rewrite_file
Apply heuristic migrations to rewrite code for upgrading HeroUI v2 and NextUI projects to v3 beta, returning transformed source with diagnostics.
Instructions
Apply heuristic migrations to code and return the rewritten source plus diagnostics.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes |
Implementation Reference
- src/core/migration.ts:364-375 (handler)The `rewriteFile` function executes the logic for rewriting file content based on migration rules.
export function rewriteFile(code: string): RewriteFileResult { const { migratedCode, warnings, astEdits } = transformCode(code); // convert warning strings into generic edits const warningEdits = warnings.map((w) => ({ type: "warning", description: w, confidence: 0.5 })); return { rewrittenCode: migratedCode, edits: [...astEdits, ...warningEdits], warnings, manualReviewRequired: warnings.length > 0, confidence: 0.5, }; }