v0.1.1
dsh-diff-stat v0.1.1
Third release. Long diff lines are readable again — the horizontal scrollbar the window always promised now actually appears — and the diff width follows the chat column instead of a fixed 720px cap, so the desktop harness's user-resizable conversation column is honored. Every finding of a full line-by-line review is closed too: fence-API link-swap hardening, display-layer BOM handling, fetch timeouts, i18n consistency, memoized card stats, and a deterministic release tarball selection.
Install / 安装
# from npm / 从 npm 安装
dsh plugin --profile web add dsh-diff-stat
# or from GitHub / 或从 GitHub 安装
dsh plugin --profile web add github:HaoyueQin/dsh-diff-statUninstall:
dsh plugin --profile web remove dsh-diff-statHighlights / 亮点
- Long lines are fully readable again: the diff window's scroll container carried
width: max-content, which made it as wide as its widest line — no scrollbar ever appeared and long rows were clipped silently by the rounded shell. The container now follows its parent and each row carries the content width instead, so the horizontal scrollbar appears and the add/del row tint tracks the line tail while scrolling. - Diff width tracks the chat column: the turn card's review diff dropped its 720px pixel cap — the surface is a block-level child of the column, so it follows
--dsh-chat-content-width(the desktop harness lets the user resize that column to 40–95%; sidebars and narrow windows shrink it too). Standard 748pxdsh weblayout is pixel-identical to before (698px), verified against long rows and the flex chain. - Theme-adaptive file silhouettes: the neutral file icon's fold highlight uses
currentColorat 35% instead of a hardcoded white stroke that vanished on light themes.
Fixes / 修复
- Path link tooltip: a truncated path on the inline edit/write row now shows its full text on hover (
title), matching the turn card's file name. - Per-render LCS cost removed: the turn card recomputed every file's diff statistics on each render; they are now memoized per file list — one DP pass per file (parity with the mutation row).
- i18n consistency: the file preview's hardcoded Chinese strings route through the
diff-statdictionary; the never-usedwhenGlassReadyexport was removed with its whole surface. - Argument-key parity:
callTimeDiffsforwritenow accepts thepathargument key as a fallback (the row's path extraction already did) — a write schema variant can no longer produce a diff-less card. - Dispatch dedupe precision: code-dispatch sub-call dedupe is keyed by
rootCallId + subCallIdinstead of the sub id alone, so equal sub ids under different roots stay distinct. - Event-shape guard: a
tool/resultwith an empty content array returns instead of throwing; dispatchisErrorsemantics align with the officialchildResult(only an explicittruecounts as errored). - Fence-API link-swap hardening: the host read/write sequence re-verifies
realpathafter the read and before the destructive undo step — a symlink swapped in mid-flight is rejected (bytes already read are never returned) instead of landing elsewhere. - BOM in the display layer only:
files.readstrips a leading UTF-8 BOM for rendering so the first diff line carries no invisible U+FEFF; undo paths keep the original bytes byte-for-byte. - Fetch timeout: fence-API calls abort after 10s — a hung host no longer leaves a pane in "loading" forever.
- Deterministic release assets: the release workflow selects the versioned tarball by name shape (
dsh-diff-stat-<version>.tgz) instead of trusting directory order.
Infrastructure / 基建
- Check-script coverage: the alignment check gained
writeargument-key fallback assertions for bothfile_pathandpathshapes, so the parity fix cannot regress.
中文说明
第三个版本。本版把「长行截断」从根上修掉,diff 宽度改为跟随会话列(不再固定 720px),并逐条闭环了整库代码审查的每一项发现:
- 长行完整可读:diff 窗的滚动容器此前带
width: max-content,容器自身被最宽的行撑开——滚动条永远不出现,长行被圆角外壳静默裁剪。现容器恢复跟随父级,行宽只在行上生效;横向滚动条正常出现,+/−染色在滚动时铺到行尾。 - diff 宽度跟随会话列:轮末卡审查 diff 不再有 720px 像素上限——作为消息列的块级子元素,宽度跟随
--dsh-chat-content-width(desktop 壳允许用户把会话列调到 40–95%,侧边栏插件开合与窄窗同样自适应)。标准dsh web的 748px 布局与旧版逐像素一致(698px),已用超长行与 flex 链路实测验证。 - 文件图标主题自适应:中性文件轮廓的折角高亮由硬编码白描边(浅色主题下不可见)改为
currentColor35% 透明度。
修复:
- 行内 edit/write 行的路径被省略后 hover 可见全文(
title),与轮末卡文件名一致。 - 轮末卡每渲染重算各文件 diff 统计 → 按文件列表记忆化(每文件一趟 DP,与接管行口径对齐)。
- 内嵌查看的硬编码中文改走
diff-stat字典;未被使用的whenGlassReady导出整体删除。 callTimeDiffs的 write 分支兜底path参数键(行摘要早已如此)——参数键变体不再产生无 diff 的卡片。- code-dispatch 子调用去重键由 subCallId 改为 rootCallId+subCallId:不同 root 下的相同子 id 不再互相误伤。
tool/result内容为空数组时安全返回而非抛错;dispatch 的isError语义与官方childResult对齐(仅显式true视为失败)。- 围栏 API 链接交换加固:host 读取后、撤销写前复验
realpath——中途被替换的符号链接被整体拒绝(已读字节绝不返回),而不是落到别处。 - BOM 只在显示层剥离:
files.read渲染前剥首部 UTF-8 BOM(首行不再带隐形 U+FEFF);撤销路径保留原字节。 - 请求超时:围栏 API 调用 10s 中止——host 挂起不再让面板永久转圈。
- 构建产物确定性:发布工作流按名称形态选择版本化 tarball(
dsh-diff-stat-<version>.tgz),不依赖目录排序。
基建:
- 检查脚本新增
write参数键兜底断言(file_path与path两种形态),防止对齐修复回退。