feat(windows): 工作区 Diff 支持按修改块回滚 (#688) - #1015
Merged
Merged
Conversation
Unstaged single-file working-tree reviews now offer a Rollback action next to Stage on every change block, matching macOS "Discard this change block". - Add git_discard_hunk: the host rebuilds the hunk patch and routes it to git.apply in discard mode (git apply --reverse, worktree only). - Add discardHunk(repoPath, hunk) to git-status-api, emitting a working-tree change event so the review reloads. - The hunk action owner exposes several actions per patch, asks for confirmation through the existing confirmBeforeDiscard setting, rejects clicks while the dialog is open, and drops answers for a replaced patch. - Rollback is withheld from staged, multi-file, history, comparison and truncated reviews, new/deleted/renamed/binary files, and files with staged edits (their HEAD-to-worktree snapshot also contains staged blocks). - Refresh records live staged state so eligibility follows Git status. - Core test reverse-applies a rebuilt full-context block in a real repo. Co-Authored-By: Claude <noreply@anthropic.com>
…-revert # Conflicts: # docs/development/platform-parity-matrix.csv # docs/development/platform-parity-matrix.md
Regenerate both feature matrix views, bound Git fixture setup and apply requests, disable user hooks/signing during setup, and clean the temporary repository on assertion failures. Document the existing CRLF and missing-final-newline limitations.
1lck
added a commit
that referenced
this pull request
Oct 1, 2026
Adds visual Git change markers in the editor gutter with click-to-peek inline diff viewer for Windows. **New components:** - GitGutterController: manages gutter decorations, peek widget lifecycle, and Monaco integration - GitGutterPeekWidget: inline diff viewer with prev/next navigation, displays HEAD vs working tree - git-gutter-changes: computes line-level diff markers (added/modified/deleted) from Git status and file diff - use-git-gutter-base: React hook providing gutter data and navigation actions **Settings:** - New toggle "git.showGutterChanges" (default true) in Git Settings panel - Search index updated for "gutter" and "inline diff" keywords **Behavior:** - Green bar: added lines; Blue bar: modified lines; Red triangle: deleted lines - Click marker opens inline diff at that change - Up/Down arrows navigate between changes - Widget closes on Escape, editor blur, or file change - Peek models disposed on widget close to prevent leaks **Not included (for follow-up):** - Revert/stage actions in peek widget (depends on PR #1015 merge) - macOS implementation (Windows-only for now) Refs #681 Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1lck
added a commit
that referenced
this pull request
Oct 3, 2026
* feat(windows): add explorer Git context menu for diff, add and commit (#975) Add an IDEA-style Git submenu to the project file tree context menu on Windows, reusing the existing git-diff/git-status API layer without any new Tauri commands: - Files with Git changes get a Git submenu: Show Diff opens the file's working-tree (or staged) diff buffer, Add stages the file, and Commit File… stages it and focuses the Source Control commit panel. - Directories inside a repository get Show Diff, which routes to the owning repository's changes panel. - Menu visibility is driven by the file's real Git status via async repository discovery (nested repositories supported); clean files show no Git entries. - Pure menu capability/builder logic lives in file-context-menu-git-file-items.ts with unit tests. - Adds the git-explorer-context-actions platform feature matrix entry (Windows implemented / macOS partial) and an implemented agent note. * test(windows): cover explorer Git context menu wiring contracts (#975) Extract the context menu wiring invariants into the lib and pin them with unit tests: - hasGitDiffContent guards the empty-diff fallback chain. - buildGitFileDiffBuffer pins the diff://<staged|unstaged>/<encoded> virtual buffer contract shared with use-git-diff-data.ts; changing either side would silently break stage/unstage inside the diff view. - findGitStatusFileForPath covers status entry matching, including repositoryRelativePath preference over decorated paths and Windows separator normalization. - isVirtualWorkspacePath keeps remote/wsl/diff paths Git-free. The hook now consumes these helpers instead of local duplicates. 19 tests total, up from 8. * docs(notes): 精简 Windows 文件树 Git 右键菜单笔记 (#975) * fix(windows): dev 文件监视器忽略 Rust target 目录 tauri dev 启动时 vite watcher 会监视 src-tauri/target 下的构建产物, 与 cargo 并发写入在 Windows 上触发 EBUSY 使 watcher 崩溃、拽死 beforeDevCommand。 为 server.watch 增加 **/target/** 忽略,与 test.exclude 的既有排除意图一致。 * fix(windows): 文件树 Git 菜单改用幂等打开源代码管理面板 (#975) 按 PR #989 review 意见:Commit File… 与目录"显示差异"原先调用 toggleSourceControlSidebar(),在 Git 面板已打开的场景会把它反向关闭。 改为直接 setIsSidebarVisible(true) + setActiveView("git") 的幂等打开, 顺序为先 visible 后 view,保证工作区会话快照记录打开状态。 快捷键 Ctrl+Shift+G 的 toggle 语义不受影响。 * fix(windows): Git 菜单动作更名为暂存并打开提交以对齐语义 (#975) 按 PR #989 review 意见①(方案 B):提交面板提交的是当前暂存区全部 内容,无法保证只提交右键的单个文件,故菜单动作由 Commit File… 更名为 Stage and Open Commit…(暂存并打开提交…),行为零改动。 同步修正原注释中"暂存区即只含此文件"的不实表述,并更新功能矩阵 条目与 Agent Note 的措辞。 * fix(windows): Show Diff 改用携带仓库身份的 workingTreeTargets 缓冲 (#975) 按 PR #989 review 意见③:原实现的 diff://staged|unstaged/<相对路径> buffer 不携带所属仓库,后续刷新/切换会误用工作区根目录,嵌套/多 仓库场景可能读错仓库。改用与 Git 面板单文件 diff 一致的 createSingleFileWorkingTreeDiff 载荷(workingTreeTargets 显式携带 repoPath),刷新按 target.repoPath 重读。取数与 staged 回退链不变, 仅替换打开段;lib 中 buildGitFileDiffBuffer 由 buildWorkingTreeDiffTarget 取代,测试同步 20 个。 * feat(macos): 文件树右键新增 Git 菜单(Add / Stage and Open Commit…)(#975) 按 reviewer 邀请对齐 Windows 端实现,只新增不改既有: - GitFileContextMenuPlan 纯逻辑判定可见性(无变更不显示;已暂存或 canToggleStaging=false 隐藏 Add),附 swift-testing 单测 5 例; - ProjectTreeActions 追加 stageChange / stageAndOpenCommit(复用 setStaging 与 selectedSidebar=.changes 既有 API); - fileContextMenuItems 追加 Git 子菜单(Add / Stage and Open Commit…), Show Diff 复用既有独立菜单项不重复;目录端已有 Show Git Diff 不动。 矩阵 git-explorer-context-actions 的 macos 由 partial 更新为 implemented(verification 保持 pending,待 macOS CI 与实机验证)。 * feat(windows): add Git gutter with inline diff peek for editor (#1018) Adds visual Git change markers in the editor gutter with click-to-peek inline diff viewer for Windows. **New components:** - GitGutterController: manages gutter decorations, peek widget lifecycle, and Monaco integration - GitGutterPeekWidget: inline diff viewer with prev/next navigation, displays HEAD vs working tree - git-gutter-changes: computes line-level diff markers (added/modified/deleted) from Git status and file diff - use-git-gutter-base: React hook providing gutter data and navigation actions **Settings:** - New toggle "git.showGutterChanges" (default true) in Git Settings panel - Search index updated for "gutter" and "inline diff" keywords **Behavior:** - Green bar: added lines; Blue bar: modified lines; Red triangle: deleted lines - Click marker opens inline diff at that change - Up/Down arrows navigate between changes - Widget closes on Escape, editor blur, or file change - Peek models disposed on widget close to prevent leaks **Not included (for follow-up):** - Revert/stage actions in peek widget (depends on PR #1015 merge) - macOS implementation (Windows-only for now) Refs #681 Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * docs: update README WeChat group QR code (#1020) * fix(agent): 统一权限菜单与英文思考强度显示 (#1008) * Merge pull request #1023 from Mucheen/fix/agent-selector-labels fix(macos): 收紧 Agent 配置菜单并修复双行说明裁剪 * fix:macOS 项目树支持多选与批量文件操作 (#991) * fix(macOS): 支持项目树多选与批量文件操作 (#987) * docs: 记录 #987 macOS 项目树手动验证结果 * docs: 添加 #987 项目树多选手动验证截图 * fix(macOS): 处理 #991 审查意见并补齐项目树批量操作边界 - 批量删除:每项删除前重新检查未保存文档;废纸篓操作期间被改脏的文档保持打开, 仅关闭未修改的文档;中途失败或被未保存文档阻止时提示剩余项目未移动。 - 快捷键归属:点击项目树后若键盘焦点移到文本框(如全局搜索)或其他控件, ⌘A/⌘C/⌘V 交还给当前焦点,不再误复制或粘贴文件。 - Control 点击恢复为 macOS 右键菜单,⌘ 点击负责增减选择;移除为此新增的 litheContextMenu(capturesControlClick:) 参数。 - 单选高亮跟随活动编辑器文档;去掉 ProjectFileTreeContent 中冗余的可见节点比较。 - 中文“拷贝”与“复制(创建副本)”区分;补齐粘贴校验和批量删除提示的中英文案。 - 新增单元、焦点与应用级集成测试;功能矩阵改回待验证。 * fix(macOS): 项目树快捷键被处理后不再同时传给编辑器 本地事件监听里的 `self?.handle(event) ?? event` 会把表示“已处理”的 nil 展平成原事件,导致 ⌘A/⌘C/⌘V 在项目树处理后仍传给编辑器:⌘A 同时全选编辑器文本, ⌘V 同时把剪贴板文本粘进编辑器。改为直接返回 handle 的结果并补回归测试。 粘贴完成的提示由“已复制文件”改为“已粘贴文件”,避免复制和粘贴各弹一条相同提示。 * fix(macOS): 项目树 ⌘A 按焦点所在目录全选 焦点在展开的子目录内时,⌘A 只选中该目录下的可见项目;焦点在项目顶层时选中项目下全部可见项目(含子目录及其展开内容,不含根行);焦点在根行或无焦点时选中整棵可见树。重复 ⌘A 保持同一范围,并补充同名前缀目录不被误选的测试。 * fix(macOS): 项目树 ⌘A 选中焦点项的同级项目 点击文件夹后按 ⌘A,选中与该文件夹同级的项目,而不是它的内容;焦点在文件上时选中同目录文件;无焦点或焦点在项目行时选中项目顶层项目。同级关系按显示的树结构计算,压缩显示的 Java 包也使用其显示父节点。批量操作会自动包含已选文件夹的内容。 * fix(macOS): 已选文件夹下的展开内容同时显示为选中 文件夹被选中时,其下展开的文件和子目录也显示选中高亮,与批量操作会包含文件夹内容保持一致。这些子项只用于显示,不会重复加入操作集合;在多选组内右键这些子项仍保持整组,单独选中一个文件夹时右键其中的文件则以该文件为目标。 * ci: 重新触发 macOS Plugin CI 上次运行在 960 秒时限内仍在冷编译 LitheTests(Rust 4m39s,正常约 3m),尚未进入测试执行。同一提交的 macOS 主 Swift lane 已通过,本地按相同过滤条件运行 59 项插件测试全部通过。 * fix(macOS): 项目树 Shift/⌘ 点击从鼠标按下事件读取修饰键 SwiftUI Button 的动作在鼠标抬起后才执行,此时 NSApp.currentEvent 已不再是这次点击, 读到的修饰键为空,Shift 点击因此退化成普通单选、范围不生效。 - 新增 ProjectTreeModifiedClick 覆盖在每一行上:只在带 ⌘/Shift 的左键按下时命中, 直接用该 mouseDown 事件的修饰键更新选择,并且不再传给 Button,因此不会打开文件或折叠目录。 - 普通点击和 Control 点击(右键菜单)都穿透到原有的 Button 和右键捕获视图,行为不变。 - selectRow 改为接收修饰键参数,Button 动作只做普通单选。 - 新增窗口级回归测试,覆盖 Shift 正向/反向范围选择、⌘ 取消选择、修饰点击不触发打开,以及 Control+Shift 不被捕获。 * test(macOS): 项目树修饰点击回归改为经窗口命中测试分发 审查指出原测试直接调用 overlay.mouseDown,绕过 hitTest 和窗口分发,即使 生产 hitTest 恒返回 nil 也会通过。 - 测试改为把合成的鼠标按下/抬起事件交给 NSWindow.sendEvent,由窗口命中测试 决定交给覆盖层还是底层 Button;覆盖新增普通点击建立锚点、Shift 正反向范围、 ⌘ 增减选择、修饰点击不触发 Button(不打开文件、不折叠目录)以及 Control 点击穿透到底层行。 - ProjectTreeModifiedClickView 的当前事件来源改为可替换的 currentEvent,默认仍是 NSApp.currentEvent。测试进程里经 NSApp 事件队列取出事件会让 swift-testing 的 主队列提前退出,后续测试不再执行,所以测试只替换这一处查询。 - 反向验证:hitTest 恒返回 nil、或捕获 Control 点击时,新测试均失败。 * fix(macOS): 批量文件操作在整批结束前持有操作锁 处理 #991 审查的 P2/P3: - 批量创建副本和批量移到废纸篓原来逐项调用单项入口,每项结束后都会先释放 isPerformingProjectItemOperation 再 await 刷新。刷新期间用户可以启动别的文件操作, 原批次的后续项随后被入口守卫静默跳过。现在由外层批次持有操作锁直到整批结束, 内层拆成不自行加锁、不刷新的单项实现,整批完成后只刷新一次。 - 单项粘贴和单项删除仍通过同一实现,行为不变。 - 中文“Copied files”改为“已拷贝文件”,与菜单“拷贝”一致。 - 新增回归:第一组复制暂停时操作锁保持占用、插入的粘贴被拒绝,批量复制和 批量删除各只在最后一项完成后刷新一次。恢复旧实现时该测试失败。 --------- Co-authored-by: Lichenkang <2188718831@qq.com> * fix(agent): 修复 Claude 鉴权、会话切换和品牌图标 (#1007) * fix(agent): 修复 Claude 鉴权、会话切换和品牌图标 通过 Claude 适配器公开会话参数传递 API Key 路由,同时覆盖新建与历史恢复,清除冲突鉴权并保留 Codex gateway 行为。 直接观察所选 Agent 连接,等待会话设置确认后展示模型,防止旧配置闪现及准备期间提交。 统一底栏、模型入口与 Agent 菜单品牌图标,保留原生单选勾选,并补充回归、共享契约、Agent Note 与功能矩阵。 * test(git): bound graph frame sampling to visible viewports 修复 PR #1007 CI:原用例重复绘制完整 1000 行历史,CI 耗时 11.791 秒超过未调整的 10 秒上限。改为开头、中段、末段 40 行视口采样,校验实际像素,保留完整结构、单帧预算与 Release 基线;同步 CI 文档和中文工程笔记。 * feat(agent): 显示 Agent 思考、计划与斜杠命令补全 (#1016) * feat(agent): 显示 Agent 思考、计划与斜杠命令补全 共享 Host 原本就透传 ACP SessionUpdate,但 macOS 只处理消息、工具、 标题、配置和用量,其余更新被丢弃。本次补齐四类标准更新: - agent_thought_chunk:独立的可折叠思考块,流式输出时展开、回复或 工具到达后收起;缓冲按角色切分,思考与回复不再混在一起;导出 Markdown 以引用块保留,历史消息数不计思考 - plan:计划栏固定在活动统计栏上方,显示进度与当前步骤;每次整体 替换,空计划清除 - available_commands_update:输入 / 弹出 Agent 上报的命令补全,前缀 优先;Codex 的 $Skill 补全为 $name(codex-acp 不解析 /$name), 输入 $ 只列 Skill;macOS 14+ 支持方向键与 Tab - current_mode_update:Agent 自行切换模式时同步权限模式选择器 另外把模型层的兜底文案、stopReason 提示和工具证据标题改为本地化, 补齐 zh-Hans 翻译。 fixture 新增四类事件样例并加入 Rust 往返测试;更新功能矩阵与 shared-acp Agent Note。真实 Agent 已在协议层确认 Codex/Claude 会上报 命令列表、Claude 会上报思考,界面层验证仍待完成。 * fix(agent): 修复命令补全布局和思考搜索展开 为输入区保留可编辑行,空间不足时在对话布局中显示可点击的命令浮层。搜索临时展开匹配思考块,清空后恢复手动选择。补充三项回归测试并同步功能矩阵与架构笔记。 * fix(ci): release Windows Bun install process trees before retry --------- Co-authored-by: Yao Jingxi <23722032@bjtu.edu.cn> * feat(windows): 活动栏/标题栏/Run 面板图标替换为 IDEA 图标,并对齐 Commit 面板与共用控件 (#1025) * feat(windows): 共用 UI 组件补齐 IDEA 风格交互基础能力 - 滚动条:修复 ScrollArea 滑块带 flex-1 被拉满整条轨道的问题,改由 Base UI 按可视比例计算滑块长度(全局所有滚动区域受益) - 触控板:ScrollArea 的滚轮转发支持横向滑动,仅横向可滚动的容器才 处理,纵向列表行为不变 - 树行 SidebarTreeRow: - 新增 leadingAction 左侧操作位(位于展开箭头之后、图标之前), 渲染在行按钮外并按缩进定位,避免按钮嵌套交互元素 - 新增 variant="idea":16px 细线 chevron(IDEA expui 路径、 tree-chevron 颜色、悬停不变色),箭头/复选框/图标/文字 4px 间距, 图标与文字垂直居中 - 文字区增加 data-sidebar-tree-label 供横向滚动测量 - 复选框:支持 indeterminate 半选状态,显示短横 - 拖动会话 document-resize-session:新增 axis: "y",可驱动纵向高度 - 新增对应单测(横向滑动、纵向拖动) * feat(windows): 默认主题 Git 状态配色与表单控件 token 对齐 IDEA 配色取自 intellij-community expUI 明暗配色方案(FILESTATUS_* 与 *_LINES_COLOR): - modified / renamed:#0033B3 / #70AEFF;暂存修改为浅蓝派生 #2652BE / #85BAFF - added:#067D17 / #73BD79;untracked:#B23247 / #E88F89 - 新增可选 token git-file-deleted(删除文件灰 #6C707E / #6F737A); git-deleted 仍为红色,继续用于 diff 删除行与 -N 计数 - 新增可选 token git-gutter-added/modified/deleted,编辑器 gutter 使用 IDEA 浅色行标记(#7FC784/#88ADF7/#767A8A,暗色 #549159/#375FAD/#868A91) - 变更列表、提交文件树、文件树的状态颜色统一走 git-* token, 不再使用 text-info / 灰色 / 红色临时映射 - 新增 IDEA 表单控件 token:control-border、checkbox-border、 checkbox-background、tree-chevron - 以上新 token 在其他主题中未定义时,均回退到原有颜色 - rebase / patch / 历史改写对话框的警告文案与操作横幅由误用的 text-git-modified 改回 text-warning,避免随 modified 变蓝 * feat(windows): Commit 面板对齐 IntelliJ(提交区、变更列表、Amend 与视图选项) 面板与入口 - 侧栏 git 入口与面板标题由 Changes / Source Control 更名为 Commit(提交), 图标换为 IntelliJ commit 图标;中英文案、tooltip、aria 同步 - 移除面板内 Changes / History 标签栏与 git-commit-history 组件,提交历史 统一通过底部 Git Log 工具窗浏览;命令面板去掉 "Git: Show History" - 清理仅服务于标签的设置 rememberLastGitPanelMode / gitLastPanelMode / gitSidebarTabOrder,并加入 RETIRED_SETTINGS_KEYS 清理升级用户的残留键 - Git 数据控制器不再读取 `git log --all`;"与提交比较"选择器打开时才按需 加载最近 50 条提交 提交区(对齐 NonModalCommitPanel / CommitInputBorder / CommitLegendComponent) - 布局:顶部左侧 Amend、右侧已选文件图例(N 添加 / N 修改 / N 删除,未跟踪 计入添加并显示为“新增+未跟踪”,重命名计入修改,按状态着色);中间提交 说明框;底部 Commit 与 Commit and Push... 线框按钮,右侧推送/拉取计数、 AI 与设置 - 与变更列表之间只有一条分割线、无外框;拖动分割线或聚焦后按上/下方向键 调整说明框高度(变更列表至少 96px,说明框最小 48px),松手后持久化 - 说明框:占位文字 "Commit Message / 提交说明";4px 圆角、1px 控件边框, 聚焦 2px 强调色,出错时错误色 - 按钮不再因未选文件或说明为空而置灰;点击后按 IntelliJ CommitProgressPanel 文案提示(请选择要提交的文件 / 请填写提交说明 / 二者合并),修正后消失; 焦点在提交区内时 Commit 变为蓝色默认按钮 - Amend:勾选时读取当前 HEAD 的完整说明(标题 + 正文,新增 getHeadCommitMessage,不再取 `git log --all` 列表首条);空草稿自动载入、 不覆盖已输入内容、取消勾选且未编辑时恢复原草稿;HEAD 无提交时提示; Amend 模式下主按钮显示 Amend Commit,Commit and Push... 禁用(修正后 需要强制推送),多仓库确认对话框按钮同步 变更列表 - 分组改为 IntelliJ 的 "Changes / 更改" 与 "Unversioned Files / 未版本控制 的文件" 两个可展开树节点,节点名后显示灰色 "N 个文件" - 文件、文件夹、分组节点的包含复选框移到左侧(箭头之后、图标之前), IDEA 新 UI 样式,分组与文件夹支持三态;文件夹名后紧跟灰色文件数 - 去掉文件行末尾的暂存 +/- 按钮及其工具代码 - 长文件名不截断,改为横向滚动:按文字真实小数宽度判断截断并留 1px 余量, 面板从隐藏切回显示、侧栏改宽或字体加载完成后重新测量;状态刷新不再重置宽度 - 参考 IntelliJ ExpandableItemsHandler:名称超出可视右边缘时,悬停该行在 行上方弹出完整名称(含文件数或目录),移开、滚动或点击即消失 - 工具栏新增 View Options(眼睛图标),菜单直接列出 "Directory / 目录" 与 "Flat List / 平铺显示" 并勾选当前项,两次点击切换 其他 - 新增/更新单测:提交面板 Amend 与提示、拖动高度、分组节点与三态、复选框 位置、行宽测量、悬停提示判断、视图选项切换、数据控制器不读取历史 - 更新 platform-feature-matrix 的 git-status-commit、git-history 行,新增 git-status-colors-idea-alignment 行,并重新生成视图 * feat(windows): 活动栏、标题栏菜单与 Run 面板图标替换为 IDEA 图标 - 活动栏 Project / Git Log / Terminal / Run / Diagnostics 改用 IntelliJ expui toolwindows 图标 (project、vcs、terminal、run、problems),亮色与暗色各一套 - 标题栏紧凑菜单开关新增 MenuIcon(expui/general/menu),不影响其他使用 ListIcon 的位置 - 新增 RunToolWindowIcon / ProblemsToolWindowIcon,避免改动全局 25 处使用的 WarningIcon - Run 面板标题、空状态与命令面板统一使用 RunToolWindowIcon,移除自绘 RunIcon - generate-idea-icons.ts 支持映射项 destination 字段,用于终端图标这类 位于 platform/icons/src 之外(Jewel showcase 资源)的素材 - 更新 icons.test.tsx 的导出数量与双色渲染断言 * test(windows): svg-editor 测试结束后还原 locale-provider mock bun 的 mock.module 在同一进程内会泄漏到后续测试文件。svg-editor.test.tsx 把 @/i18n/locale-provider 替换成只含 useTranslation 的桩且不还原,导致全量运行时 Commit 面板等依赖真实 LocaleProvider 的测试拿到桩而失败。 在安装 happy-dom 之前保存真实模块,并在 afterAll 中还原。buffer.store 的 mock 无法同样处理(导入真实模块会触发 Tauri 窗口 API),保持不变。 * fix(windows): Amend 按实际暂存仓库读取 HEAD,提交说明分隔条从显示高度起算 - Amend 目标由有暂存文件的仓库决定,而不是活动仓库:单仓库参与时读取该仓库的 HEAD, 多仓库同时有暂存文件时禁用 Amend 并给出提示;目标仓库变化时撤销已加载的说明, 并在说明未被修改时恢复原草稿 - 提交说明编辑框最多显示视口的 60%,拖动与方向键调整改为从实际显示高度开始, 渲染与交互共用同一上限常量 - 补充 A 活动 / B 暂存、活动仓库无 HEAD、多仓库禁用、目标变化,以及窗口缩小后 拖动与键盘调整的回归测试 * fix(git): Amend 绑定到明确的仓库与 HEAD,由 Core 拒绝多仓库改写 Core 建立提交计划时会重新读取所有仓库的暂存状态,而界面只基于缓存的状态读取 并展示了某一个仓库的提交说明。若读取之后又有别的仓库被暂存(例如外部终端, 且关闭了自动刷新),一个全局 amend 会让两个仓库共用同一条说明并同时被改写。 - Core: amend 时有暂存更改的仓库最多一个,否则 invalid_request 且不写入 - Core: 新增可选 amendTarget{repositoryId, expectedHead},拒绝未知目标、 不一致的暂存仓库以及 HEAD 已移动(新提交或切分支)的请求;重试时目标 已提交则跳过 HEAD 检查 - Core: 约束只在 prepare 校验,不写入 Plan,避免 macOS 的计划模型丢弃未知 字段后 amend 悄悄变成普通提交;validate_session 兜底拒绝涉及多个暂存仓库的 amend 续接。缺省 amendTarget 时保持单仓库下限,macOS 无需改动 - Windows: getHeadCommitMessage 同时返回 HEAD hash;面板记录读取说明的仓库与 hash,提交与重试时转换为仓库标识发送,无法确认时提示重新加载 - 补充 Rust 单元与真实 Git 集成回归、前端面板与 API 测试 - 更新 rust-core-api 契约与工作区提交 Agent Note * fix(git): 重试沿用计划记录的 Amend 仓库,父仓库不再被误改写 子仓库 Amend 成功而父仓库提交被钩子拒绝后,父仓库已暂存了新的子模块引用。 重试时 Core 根据当前暂存区重新推断 Amend 目标,会把它当作唯一的暂存仓库并 改写其原 HEAD,用户确认的“新增父引用提交”变成了历史改写。 - Core: Plan 新增 amendRepositoryId,首次建立计划时确定;step 只 Amend 该 仓库,其余仓库(含只记录子模块引用的父仓库)做普通提交 - Core: 重试沿用 previous.plan 记录的仓库,指定不同 amendTarget 时拒绝; validate_session 拒绝指向未知仓库或非 Amend 计划的续接 - Core: 字段缺失(丢弃未知字段的客户端)时退回按暂存路径判断并限制为一个仓库, 行为与此前一致 - Windows: 重试不再根据组件 ref 推断目标,直接交还上一次计划 - 补充真实 Git 回归(子 Amend 成功、父钩子失败、恢复后重试)及单元、前端测试 - 更新 rust-core-api 契约与工作区提交 Agent Note * revert(windows): 移除 Commit 面板的 Amend 功能 Amend 在多仓库工作区里需要把“每个仓库的提交意图”做成 Swift 与 Rust 共享的 模型,当前 PR 内无法在 macOS 缺少构建验证的情况下安全完成,且反复引入回归。 本次先移除,Windows 提交面板恢复为只做普通提交。 - Windows: 删除 Amend 复选框、HEAD 说明读取、目标仓库推断、重试目标处理, 以及确认框的 Amend Commit 文案和相关 i18n 键 - Core: workspace_commit 及其测试、共享契约与 Agent Note 还原为与 preview 一致, macOS 的 amend 布尔字段保持不变,Swift 无需改动 - 测试: 删除全部 Amend 用例,新增“提交始终为普通提交且不显示 Amend”断言 - 矩阵: 去掉功能说明中的 Amend 描述并重新生成 - 保留与 Amend 无关的修复:提交说明分隔条按实际显示高度调整、图标替换、 svg-editor 测试的 locale mock 还原 * feat(agent): 显示 Agent 思考、计划与斜杠命令补全 (#1016) * feat(agent): 显示 Agent 思考、计划与斜杠命令补全 共享 Host 原本就透传 ACP SessionUpdate,但 macOS 只处理消息、工具、 标题、配置和用量,其余更新被丢弃。本次补齐四类标准更新: - agent_thought_chunk:独立的可折叠思考块,流式输出时展开、回复或 工具到达后收起;缓冲按角色切分,思考与回复不再混在一起;导出 Markdown 以引用块保留,历史消息数不计思考 - plan:计划栏固定在活动统计栏上方,显示进度与当前步骤;每次整体 替换,空计划清除 - available_commands_update:输入 / 弹出 Agent 上报的命令补全,前缀 优先;Codex 的 $Skill 补全为 $name(codex-acp 不解析 /$name), 输入 $ 只列 Skill;macOS 14+ 支持方向键与 Tab - current_mode_update:Agent 自行切换模式时同步权限模式选择器 另外把模型层的兜底文案、stopReason 提示和工具证据标题改为本地化, 补齐 zh-Hans 翻译。 fixture 新增四类事件样例并加入 Rust 往返测试;更新功能矩阵与 shared-acp Agent Note。真实 Agent 已在协议层确认 Codex/Claude 会上报 命令列表、Claude 会上报思考,界面层验证仍待完成。 * fix(agent): 修复命令补全布局和思考搜索展开 为输入区保留可编辑行,空间不足时在对话布局中显示可点击的命令浮层。搜索临时展开匹配思考块,清空后恢复手动选择。补充三项回归测试并同步功能矩阵与架构笔记。 * fix(ci): release Windows Bun install process trees before retry --------- Co-authored-by: Yao Jingxi <23722032@bjtu.edu.cn> --------- Co-authored-by: muchen <145200703+Mucheen@users.noreply.github.com> Co-authored-by: Yao Jingxi <23722032@bjtu.edu.cn> Co-authored-by: lick <2188718831@qq.com> * refactor(matrix): split capability records and generate views in CI (#1026) * Merge pull request #1029 from 1lck/fix/macos-release-reliability fix(release): 修复 macOS 发布超时与 Sparkle 基线下载重试 * Merge pull request #1004 from 1lck/codex/plugin-package-signing feat(macos): 修复 PHP 插件下载逻辑问题——Part1 --------- Co-authored-by: genhaosan <3042136826@qq.com> Co-authored-by: lick <2188718831@qq.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: muchen <145200703+Mucheen@users.noreply.github.com> Co-authored-by: sinth <2235390062@qq.com> Co-authored-by: Yao Jingxi <23722032@bjtu.edu.cn> Co-authored-by: 若水 <frankw.wang@qq.com> Co-authored-by: Xiaoyumuxi <3075514079@qq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #688
需求
在 Windows 工作区 Diff 窗口里按修改块回滚(丢弃工作区中这一块的修改),对标 IDEA / VS Code 的块级回滚和 macOS 的 "Discard this change block"。只对工作区未暂存修改提供,必须先确认,文案走 i18n。
方案
frontend/editor/src/diff-review.ts现成的多 action 能力渲染。共享渲染器没改,所以 macOS 对照入口不受影响。没有复刻 IDEA 分隔带上的箭头:那需要在两侧编辑器之间额外绘制并跟随 Monaco 的对齐和折叠,收益抵不上 macOS 对照入口的回归风险(权衡已写进 Agent Note)。hunk-N),适配器用monacoDiffHunk从原始补丁取出同一块,完整上下文补丁按 Git 3 行上下文重新切块。不使用 Monaco 重新计算的显示范围。git_discard_hunk复用hunk_patch(),翻译为git.apply的discard模式(git apply --reverse,只写工作区、不动索引)。Core 没有任何改动。confirmBeforeDiscard,与文件/仓库回滚共用)。开启时弹出showConfirmDialog,标题「回滚修改块」,确认按钮「回滚」;关闭该设置则直接回滚,和产品其他回滚入口一致。改动清单
windows/tauri/src-tauri/src/platform.rs:git_stage_hunk | git_unstage_hunk分支加上git_discard_hunk,模式改为 match 映射stage/unstage/discard;新增 Rust 单测translates_hunk_discard_to_reverse_worktree_apply(完整 payload、stage/unstage 模式不变、缺少 hunk 时报错)。windows/tauri/src/features/git/api/git-status-api.ts:新增导出discardHunk(repoPath, hunk),调用git_discard_hunk,成功后发出source: "discard-hunk"、scopes: ["working-tree"]的 Git 变更事件;失败返回false。接口与stageHunk/unstageHunk同形,方便 [Feature] 文件变更行旁边添加有变跟标识按钮,点击按钮可以查看变更差异 #681 的内联差异弹窗复用。windows/tauri/src/features/git/utils/monaco-diff-hunk-actions.ts:DiffStagingContext新增可选canDiscardworkingTreeStagingContext根据workingTreeTargets[sectionKey]判断能否回滚(未暂存、有刷新目标、非未跟踪、无暂存修改)HunkActionID、MonacoDiffHunkOperations(discard、confirmDiscard可选)actions列表(保留原action字段,兼容旧调用)apply支持discard:先确认,pending 覆盖确认期间,补丁被替换后作废,确认取消返回cancelledcanDiscardDiff,排除新增/删除/重命名/二进制/图片文件windows/tauri/src/features/git/components/diff/monaco-git-diff.tsx:把discardHunk和确认函数(读confirmBeforeDiscard,用showConfirmDialog)接入 owner;按owner.actions生成按钮列表;用 ref 读取当前翻译函数,避免切换语言时重建 owner。windows/tauri/src/features/git/types/git-diff.types.ts:WorkingTreeDiffTarget新增可选hasStagedChanges(带注释说明原因)。windows/tauri/src/features/git/hooks/use-git-diff-actions.ts:打开未暂存单文件 Diff 时,如果 Git 状态显示该文件也有暂存修改,写入hasStagedChanges: true。windows/tauri/src/features/git/services/working-tree-diff-refresh.ts:刷新时根据最新状态写入hasStagedChanges。windows/tauri/src/i18n/locale.ts:中英文新增git.diff.rollbackHunk、git.diff.rollbackHunkConfirm;按钮文字复用已有的git.rollback(回滚 / Rollback)。monaco-diff-hunk-actions.test.ts新增 7 个用例:资格判定、确认后路由到原始分块和所属仓库、完整上下文切块、确认取消不写入、确认期间拒绝重复点击且补丁替换后作废、失败可重试、各类不提供回滚的 reviewgit-status-api.test.ts:discardHunk的命令、仓库和事件,以及失败时不发事件(按命令路由 mock,不依赖随机顺序)working-tree-diff-refresh.test.ts:最后一块回滚后关闭 Diff;暂存后记录hasStagedChangesrust/lithe-core/src/tests/git.rs:新增git_apply_discard_reverts_one_rebuilt_hunk_and_keeps_the_index,用真实 git 仓库验证重建的完整上下文分块只恢复所选块、重复提交的旧补丁不写入、MM 文件暂存区不变shared/platform-feature-matrix.json与生成的docs/development/platform-parity-matrix.{md,csv}:git-diff-review行的验证步骤补上 Windows 块级回滚。.agents/notes/implemented/architecture/2026-09-15-macos-monaco-feasibility-probe.md:「只读差异视图」一节补充 Windows 按块回滚的位置取舍、资格规则、确认与生命周期。Review 修复与合并验证(2961c982,Linux)
preview@006449ba,解决两份生成矩阵冲突,从合并后的 JSON 源重新生成;保留已合并的 feat(windows): JDK 8 超长 classpath 自动改用临时 manifest JAR #1012/feat(windows): 工作台布局与 Git Log 体验调整(参考 IDEA),Core 提交日期携带时区偏移 #1013/fix(git): Windows Git Log 提交详情显示完整提交信息 (#771) #1014 功能与修复。Command::output()无本地超时,断言失败也不清理仓库。现在复用 Core 的 5 秒请求超时与进程树清理,fixture 禁用用户 hooks/提交签名,临时仓库由 RAII 所有者清理。cargo check --tests通过,涵盖宿主及新增翻译测试的编译;不等同于 Windows 原生测试执行。core.autocrlf=false、涉及文件末尾无换行时,丢失格式信息的重建补丁被 Git 拒绝,文件保持原字节。该限制已补入 Agent Note,未改动共享补丁解析器。原实现验证(本地 macOS 实际执行)
bun test新增和受影响的 4 个测试文件:54 pass / 0 fail--randomize --seed=1/3/7各一轮:均为 101 pass / 0 failgit-status-api、working-tree-diff-refresh):57 pass / 0 failbun test src/platform:93 pass / 0 failbun run typecheck:通过bunx vp lint改动的前端文件:无问题cargo test --manifest-path windows/tauri/src-tauri/Cargo.toml platform:::38 pass(含新增的翻译测试)cargo test --manifest-path rust/lithe-core/Cargo.toml --lib tests::git:118 pass(含新增的 discard 真实仓库测试)rustfmt --check:通过./scripts/verify-platform-feature-matrix-change.sh origin/preview HEAD、./scripts/verify-platform-feature-matrix.sh、./scripts/verify-agent-notes.sh、./scripts/verify-windows-boundaries.sh、./scripts/verify-rust-core-comments.sh、./scripts/verify-runtime-bundle-immutability.sh、write-stable-tests/verify-test-stability.sh:全部通过./scripts/probe-macos-monaco.sh --workbench-tests未覆盖
verificationStatus保持pending。cargo test在 macOS 上有 5 个用例失败(debug::adapter_identifier、run::*路径相关、project_window_registry),它们依赖 Windows 路径语义。我在临时 worktree 里用未改动的origin/preview复现了同样的失败,与本 PR 无关。\r和\ No newline at end of file标记,hunk_patch()重建的补丁因此在两种情况下无法应用:core.autocrlf=false且工作区为 CRLF 的文件,以及涉及“文件末尾无换行”那一行的修改块。我用临时仓库实测:git apply --reverse直接拒绝,文件不被修改,界面显示“Git 操作失败”,可以改用文件级回滚。core.autocrlf=true(工作区 CRLF、索引 LF)的情况实测可以正常回滚。要修复得在解析阶段保留原始补丁行,会同时影响暂存和显示,建议单独开 issue。monaco-git-diff.tsx里确认框的接线(读取confirmBeforeDiscard、调用showConfirmDialog)没有组件级测试;确认、取消、过期等逻辑都在createMonacoDiffHunkActions中,已有单测覆盖。🤖 Generated with Claude Code