247820260216更新文件前后分隔栏0553d33c

tools-only2026-10-26查看 737复制 1426

通过添加可见的变更通道(`-│`、`+│`、` │`)以及明确的 `Before`/`After` 标题,提升了 `update_file` 并排差异对比的可读性。

Download (.md)

📘如何使用这个技能

  1. 1
    复制技能内容·点击上方「Copy SKILL.md」复制全部内容,或 Download 下载到本地
  2. 2
    打开你的 AI 客户端·支持 Claude Code、Trae、Cursor、ChatGPT、DeepSeek、Kimi 等任意 AI 助手
  3. 3
    粘贴为系统提示/知识文件·Claude Code:放入 .claude/skills/ 目录;普通对话:作为首条消息发送并说「请严格按这份技能文档执行」
  4. 4
    直接提出你的需求·AI 会按技能定义的工作流、格式和约束来处理,无需再解释背景

💡 提示:技能生效后,每次对话只需一句需求,AI 会按 SKILL.md 的流程执行。

SKILL.md1487 chars
---
title: Update file side-by-side diff now has explicit before/after separation lane
type: delta
link: update-file-before-after-separator-lane
path: src/tunacode/ui/renderers/tools/update_file.py
depth: 0
seams: [A, M]
ontological_relations:
  - affects: [[ui]]
  - affects: [[tool-renderers]]
  - improves: [[update-file-diff-clarity]]
tags:
  - ui
  - diff
  - update_file
  - rendering
created_at: 2026-02-16T14:05:49-06:00
updated_at: 2026-02-16T14:05:49-06:00
uuid: 0291d339-2bd4-481b-bdda-c879e54447a4
---

# Update file side-by-side diff now has explicit before/after separation lane

## Summary

Improved readability of `update_file` side-by-side diffs by adding a visible change lane (`-│`, `+│`, ` │`) and explicit `Before`/`After` captions.

## Changes

- `src/tunacode/ui/renderers/tools/update_file.py`
  - Added symbolic constants for side-by-side layout widths and divider glyphs.
  - Changed middle diff column to a 2-character lane that combines change direction with a vertical separator.
  - Styled lane markers by direction (`delete` red, `insert` green, context dim).
  - Updated caption to: `Before: a/<file> │ After: b/<file>`.

- `tests/unit/ui/test_update_file_renderer.py`
  - Added assertion that rendered output includes:
    - `Before: a/file.py`
    - `After: b/file.py`
    - `-│` and `+│` markers

## Behavioral Impact

No tool contract changes. The renderer still parses unified diffs and retains unified-diff fallback when side-by-side parsing fails.
来源:skillsdirectory

评论0

登录后参与评论

还没有评论,来抢沙发吧