Skip to main content
Glama

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
NameRequiredDescriptionDefault
codeYes

Implementation Reference

  • 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,
      };
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sctg-development/heroui-migration-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server