Skip to content

feat(chat): show the lines each edit adds and removes, with its diff - #264

Merged
httpsphl merged 1 commit into
mainfrom
feat/edit-diffs
Oct 22, 2026
Merged

httpsphl merged 1 commit into
mainfrom
feat/edit-diffs

Conversation

@httpsphl

Copy link
Copy Markdown
Owner

What

Each file edit in the chat now says how much it changed, and opens to its diff.

  • Daemon (botloft_core::edits): counts the lines a Write, Edit or MultiEdit call adds and removes, from its whole input, before the chat cuts it at 4 KB. They go in the tool item as lines: { added, removed }; older items and other tools have null.
  • App: the tool line shows +N −M (a zero side is left out; nothing on a failed call). Opened, it shows "Changes": one block per replacement, with shared lines, removed lines marked − and added lines marked +. The app compares lines the way the daemon counts them, so the diff and the numbers agree. When the input was cut, the line opens to the input as before, with a note that the change is too long to show.
  • No counts for an Edit with replace_all (the input does not say how many matches) or when the input has no texts: Codex and Antigravity send only the path.
  • The pnpm dev preview has a real edit in the Writer's chat.
  • Spec 8.2 and 15.3 updated.

Tests

  • edits.rs: edits, moved lines, MultiEdit, Write, no texts, replace_all, a huge edit past the comparison limit.
  • tests/chat.rs: an edit bigger than 4 KB keeps its counts after the input is cut, and through the update when it finishes.
  • editDiff.test.tsx: line splitting and counts match the daemon's cases; counts and diff on the line; the cut-input note; no counts on a failed call.
  • cargo fmt, clippy -D warnings, cargo test --workspace and pnpm check pass locally.

Manual test with the real Claude Code

Not done yet. With the dev daemon, ask an agent to edit a file (one Edit, then a new file with Write) and check that the line shows +N −M matching the change and that opening it shows the diff.

The daemon counts the lines a Write, Edit or MultiEdit call adds and
removes from its whole input, before the chat cuts it at 4 KB, and keeps
them in the tool item (`lines`). The tool line shows "+N -M", and opening
it shows the diff of each replacement instead of the raw input. The app
compares lines the same way the daemon counts them, so both agree.

No counts for an Edit with replace_all (the input does not say how many
matches) or when the input has no texts (Codex and Antigravity send only
the path). Spec 8.2 and 15.3 updated.
@httpsphl
httpsphl enabled auto-merge October 22, 2026 15:42
@httpsphl
httpsphl merged commit 4dfcc94 into main Oct 22, 2026
6 of 8 checks passed
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.

1 participant