pai
    Preparing search index...

    Function jsonEdit

    • Applies changes to a JSON or JSONC file's text with jsonc-parser's modify and applyEdits, as Vercel's setup does, so comments, key order and formatting stay as they were. Only the text an edit inserts is formatted, in the file's own indent (none in a one-line file), so removing what was added gives back the same bytes. A new file is written in full. If the edited text doesn't read back as expected, the file is written in full instead, as Vercel's does.

      Parameters

      • file: string
      • text: string | null
      • changes: JsonChange[]

      Returns string

      CliError setup_unreadable when the file is not valid JSON or JSONC.

      Compatibility export. Use planSetup, applySetup, and restoreSetup for agent setup.