Skip to content

feat: show this reply's Diff on written-file cards - #840

Closed
Kitten9533 wants to merge 1 commit into
agegr:mainfrom
Kitten9533:feat/turn-written-file-diff
Closed

Kitten9533 wants to merge 1 commit into
agegr:mainfrom
Kitten9533:feat/turn-written-file-diff

Conversation

@Kitten9533

@Kitten9533 Kitten9533 commented Sep 14, 2026

Copy link
Copy Markdown

Problem

#378 already puts a small file card under the reply for each file the assistant wrote or edited. Clicking it opens the file.

You can jump to the file, but you still cannot see what this reply changed. You have to unfold the edit / write tool cards, or use Explorer's Git Diff, which shows everything since the last commit, not just this reply.

Solution

The file cards stay. Click a card to see this reply's added and removed lines for that file. The small icon on the right still opens the file.

  • Only successful write / edit calls from this reply are listed.
  • If the same file is written and then edited, the card shows both steps in order.
  • Failed or unfinished calls are omitted.
  • The +N / -N numbers match the expanded view. Path header lines in the patch are not counted.
  • Only one card is expanded at a time. If there is nothing to preview, it says there is no Diff to show. Explorer Git Diff is unchanged.

Changes

New: components/SplitPatchView.tsx — extracted from MessageView and reused when a file card is expanded.

Edited:

  • lib/turn-written-files.ts — attach this reply's patch and line counts
  • lib/patch.ts — count added/removed lines the same way the expanded view does
  • components/TurnWrittenFiles.tsx — expandable file card, open-file icon, +N/-N
  • components/MessageView.tsx — use the extracted split view
  • lib/i18n/messages/{en,zh-CN,zh-TW}.ts — Show / Hide / no Diff labels

Net: 10 files, +646 / −241.

Tests

node --experimental-strip-types --test lib/turn-written-files.test.mjs lib/patch.test.mjs components/TurnWrittenFiles.test.mjs components/MessageView.test.mjs

57/57 pass. tsc --noEmit and eslint on the touched files are clean.


问题

#378 已经在回复下方用文件卡片列出这次真正写入或修改的文件。点卡片会打开文件。

文件能一键打开,但还是看不到这次回复改了什么。只能去翻折叠的 edit / write 工具卡,或者看 Explorer 的 Git Diff。后者是相对上一次提交的全部改动,不是这次回复。

解决方案

文件卡片还在。点卡片可以看到这次回复对该文件新增和删除了哪些行。右侧小图标仍用来打开文件。

  • 只列出这次回复里成功的 write / edit
  • 同一文件先写入再修改时,按顺序一起显示。
  • 失败或还没完成的调用不进列表。
  • 卡片上的 +N / -N 和展开后看到的增删行一致。patch 里的文件路径行不算进去。
  • 同时只展开一个卡片。没有可预览内容时提示「没有可显示的 Diff」。Explorer 的 Git Diff 不变。

测试

相关测试 57/57 通过。tsc --noEmit 与触及文件的 eslint 干净。

@Kitten9533 Kitten9533 changed the title feat: expand turn-written file chips to show this-turn diffs feat: expand turn-written file cards to show this-turn diffs Sep 14, 2026
@Kitten9533
Kitten9533 force-pushed the feat/turn-written-file-diff branch from 7cb134d to 6ead281 Compare September 14, 2026 02:16
Clicking a file card expands this reply's write/edit Diff. A small
icon still opens the file. Line counts match the expanded view.
Button labels use Diff in English, Simplified Chinese, and
Traditional Chinese, without jargon such as "turn" or "本轮".
@Kitten9533
Kitten9533 force-pushed the feat/turn-written-file-diff branch from 6ead281 to e928f4f Compare September 14, 2026 02:19
@Kitten9533 Kitten9533 changed the title feat: expand turn-written file cards to show this-turn diffs feat: show this reply's Diff on written-file cards Sep 14, 2026
@Kitten9533 Kitten9533 closed this Sep 14, 2026
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