Skip to content

feat: add structured edit previews to fix-plan JSON#45

Open
gke0op wants to merge 1 commit into
vercel-labs:mainfrom
gke0op:fix-plan-edit-previews
Open

feat: add structured edit previews to fix-plan JSON#45
gke0op wants to merge 1 commit into
vercel-labs:mainfrom
gke0op:fix-plan-edit-previews

Conversation

@gke0op
Copy link
Copy Markdown

@gke0op gke0op commented May 17, 2026

Summary

zero fix --plan --json now includes an edits array on each fix object, showing the exact line, old text, and new text that would change.

This closes the gap between --plan (no edit info) and --patch/--apply (which include patches). Agents can now preview the exact diff before deciding to apply.

Example output

Before:

{
  "fixes": [{
    "id": "make-binding-mutable",
    "appliesEdits": false
  }]
}

After:

{
  "fixes": [{
    "id": "make-binding-mutable",
    "appliesEdits": false,
    "edits": [{
      "line": 4,
      "old": "    let dst: [4]u8 = [0, 0, 0, 0]",
      "new": "    let mut dst: [4]u8 = [0, 0, 0, 0]"
    }]
  }]
}

Changes

  • print_fix_plan_json now takes an optional const SourceInput *input parameter
  • Uses existing find_make_binding_mutable_edit to compute the edit preview
  • Adds edits array to each fix object when an edit is available
  • All three call sites updated to pass &input
  • Forward declaration added for find_make_binding_mutable_edit

Testing

  • All 9 CLI tests pass (npm run test:zero)
  • All 8 docs tests pass (npm run docs:test)
  • Command contracts pass (npm run command-contracts:local)
  • Manual verification of --plan, --patch, and --apply modes

Closes #6

zero fix --plan --json now includes an edits array on each fix object,
showing the exact line, old text, and new text that would change.

This closes the gap between --plan (no edit info) and --patch/--apply
(which include patches). Agents can now preview the exact diff before
deciding to apply.

Closes vercel-labs#6
@vercel
Copy link
Copy Markdown

vercel Bot commented May 17, 2026

@gke0op is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add structured edit previews to fix-plan JSON

1 participant