Repository navigation
feat(desktop): 远程工作区里打开和新建 Git 工作树:用同一连接为另一个主机文件夹开新会话 (#2231) - #2294
Merged
Merged
Conversation
Resolve the feature matrix.
xiaoyumuxi
marked this pull request as ready for review
November 22, 2026 01:19
…trees # Conflicts: # shared/i18n/features/remote-connections.json # shared/platform-feature-matrix/features/remote-workspace.json
…trees # Conflicts: # shared/platform-feature-matrix/features/remote-workspace.json
…trees # Conflicts: # shared/i18n/features/remote-connections.json # shared/platform-feature-matrix/features/remote-workspace.json
This was referenced Nov 22, 2026
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.
关联 Issue / Linked issue
PR 类型 / Type
改动说明 / What changes
背景 / Why
#2283 起,受信任的远程工作区已能在主机上列出、锁定、解锁和删除 Git 工作树,但“打开”和“新建”仍被拒绝。原因如下:
这是 #2231 计划里 #40 这一阶段,补上远程工作区里打开和新建工作树。
改动 / Changes
打开工作树:用同一个连接为另一个主机文件夹开新会话
desktop/internal/workbench/remote_worktree.go(新):openRemoteWorktree把列表里的占位路径换回主机路径。换不回来说明列表已过期:记为拒绝git_worktree_open/not_host_path,并重新读取列表。openRemoteHostFolder先找打开这个主机文件夹、会话还活着的标签页。找到就直接切过去,不再连接。remoteReopen:连接 ID 或 WSL 发行版与用户,加上主机文件夹。connectRemoteReopen在窗口读完已保存的连接后,选中同一个连接,像用户点“连接”一样连接,并直接打开这个文件夹。连接步骤、OpenSSH 的提问和从未决定过的文件夹的信任询问,都和手动打开时一样出现。desktop.remote.worktree.connectionRemoved),记为拒绝connection_removed,不连接。desktop/internal/workbench/remote.go:reopen字段,loadRemote读完列表后执行它。desktop/internal/workbench/gitworktree.go:openWorktree遇到远程工作区时改走openRemoteWorktree。新建工作树:对话框显示和接收主机路径
desktop/internal/remoteplaceholder/remoteplaceholder.go:新增HostNamedPath(root, host)。它把任何主机绝对路径映射为占位根旁.lithe-remote-host下的本机路径;Core 收到后,按工作区绑定映射回主机。gitworktree.go:beginCreateWorktree不再拒绝远程工作区。HostNamedPath发送(worktreeHostNamed)。这样 Core 按仓库路径推出的建议也落在.lithe-remote-host下,显示前再换回主机路径(worktreeShown)。Core 的建议规则和路径映射都不用改。openRemoteHostFolder。gitworktree_view.go:远程工作区的路径输入框下说明“路径是主机上的文件夹,由主机上的 Git 创建”(新词条desktop.remote.worktree.destination)。i18n、矩阵、Note、截图
shared/i18n/features/remote-connections.json:新增上面两个中英词条,并提交了生成结果desktop/internal/i18n/shared.generated.go。shared/platform-feature-matrix/features/remote-workspace.json:HostNamedPath的做法。.agents/notes/implemented/feature/2026-11-22-remote-workspace-git-worktrees.md,记录决策和被否方案(切换会话根目录、后台直接连接、让 Core 收原始主机路径、新窗口打开)。docs/assets/remote-worktrees/:无头截图及说明。测试
remote_worktree_test.go(新,3 个测试):HostNamedPath路径,并选中新工作树。remoteplaceholder_test.go:新增TestHostNamedPathNamesEveryHostPathBelowTheSibling。remote_git_test.go:测试内核的主机仓库可以带分支。新增GitReferenceTree的替身:Core 的git.referenceTree只按传入的名字计算,产品里在真实会话上照常工作;但测试内核里的会话 ID 是假的,真实 Core 找不到这个会话。所以替身让分支树在测试里也能算出来。产品代码没有改动。remote_worktree_visual_test.go(新):TestVisualRemoteWorktrees。不在本 PR 范围内 / Out of scope
类型专属:feat
多平台对齐
pending)platform-specific),理由:范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/remote-workspace.json:验证动作、notes、两端证据路径;两端验证状态保持pending./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh(validated 221 platform capabilities)和./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD(passed).artifacts/下生成的矩阵视图插件归属 / Plugin ownership
develop-lithe第三节的自查命令,结果为空UI 验证 / UI evidence
LITHE_VISUAL_OUTPUT_DIR=… ../scripts/desktop/desktop-go.sh test -tags vivahead,lithevisual ./internal/workbench/ -run TestVisualRemoteWorktrees,提交 a3fff89。场景为工作树列表和新建工作树对话框,覆盖浅色英文与深色中文,窗口 1200×760(2x)统一日志系统 / Structured logging
app.action.performed(git.worktree.open、remote.connect)和操作拒绝事件(git_worktree_open,原因not_host_path/connection_removed),没有新增事件界面文案 / i18n
shared/i18n/features/remote-connections.json补齐中英文,并提交了生成结果node scripts/i18n/verify-app-language-localization.mjs(passed)和node scripts/i18n/generate-i18n.mjs --check(passed)逻辑归属 / Logic placement
git.worktreePreview、git.createWorktree及工作区绑定的路径映射),桌面端只选择发送哪个占位路径,以及连接窗口的流程性能与内存 / Performance and memory
设置 / Settings
N/A:没有新增或修改设置。
插件契约 / Plugin contract
N/A:不涉及插件契约和宿主方法。
发行包与资源 / Bundle and resources
zsh scripts/desktop/verify/verify-runtime-bundle-immutability.sh(static checks passed)无用代码与重构 / Dead code and refactoring
验证 / Verification
../scripts/desktop/desktop-go.sh test ./internal/workbench/ -run 'TestRemote|TestWorktree|TestHostNamed|TestGit' -count=1../scripts/desktop/desktop-go.sh test ./internal/remoteplaceholder/ ./internal/core/ -count=1../scripts/desktop/desktop-go.sh vet ./internal/workbench/ ./internal/remoteplaceholder/,gofmt -l internal/TestVisualRemoteWorktrees(vivahead,lithevisual)node scripts/i18n/generate-i18n.mjs --check,node scripts/i18n/verify-app-language-localization.mjs./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh,…-change.sh origin/main HEAD./scripts/agent-notes/verify-agent-notes.shzsh scripts/desktop/verify/verify-runtime-bundle-immutability.sh未能执行的检查和原因:
提交前确认 / Final checks
main(994b67331)创建,目标分支main