* feat(server): branch off a pull request and list every git worktree A workspace.create worktree source with action "branch-off" and a checkoutSource used to check the pull request out, because core took any change request as a checkout. Branch-off now fetches the pull request's head into a remote-tracking ref (origin/<head> for a same-repo head, paseo-pr-<N>/<head> otherwise) and starts the new branch there, with no upstream and no remote added. A request with no action still checks the pull request out, as older clients expect. checkout.worktrees.list returns all git worktrees of the repository, not only the ones Paseo created, so the New workspace screen can offer any of them. Bare and prunable entries are left out. Hosts advertise both through server_info.features: worktreeRefActions and checkoutWorktreeList. Older hosts ignore the branch-off action on a pull request, so the app must gate on the flag. * feat(app): pick an existing worktree, and branch off or check out a ref Isolation now offers Project directory (was "Local"), New worktree, and Existing worktree. Existing worktree is a local workspace at the chosen worktree's path, not a third isolation value, so plugins, preferences, and the create request still see "local". The list comes from checkout.worktrees.list, so it includes worktrees Paseo did not create. The ref picker gains Branches / Pull requests pills and a Branch off / Check out toggle with a tooltip per action. Branches default to Branch off and pull requests to Check out. On a host without worktreeRefActions the toggle is hidden and the defaults apply. Git keeps a branch in one worktree at a time. Picking a held branch in Check out mode moves to the worktree that holds it, and creating from a held branch that was never picked fails with an explanation. Without this the server would silently check out a "<branch>-1" copy. * docs: describe Existing worktree and Branch off / Check out * fix(server): give a fork pull request branch-off a base the repository has A branch off a fork's pull request stored the fork's head as its base, under refs/remotes/paseo-pr-<N>. Create PR then asked for a pull request into a branch the base repository does not have, and the ref piled up in base branch pickers because no remote owns it. The new branch now starts at the fetched head, kept under refs/paseo/change-requests/<N>, and its base is the pull request's base branch. A same-repository branch-off still stacks on the pull request's branch. A routed create_workspace with a prNumber and no mode checks the pull request out again, as before branch-off could start from a pull request. The worktree list skips a locked worktree whose directory is gone, since it cannot be opened. * fix(app): start an existing worktree's agent in that worktree Existing worktree created the workspace at the worktree, but the composer and terminal still used the project directory, so the daemon rejected the first agent as outside the workspace. The screen now derives one working directory from the isolation and uses it for the workspace, the composer, and the terminal. A worktree that left the list is no longer a choice. The ref picker names change requests the way the project's forge does, so a GitLab project shows Merge requests. The schedule form uses the isolation labels Project directory and New worktree. * fix(server): compare a fork pull request branch-off against the remote base The base was stored as the bare branch name, which resolves to the local branch first. A local main behind origin/main put upstream commits in the workspace's changes for its whole life, and a base branch the clone never fetched failed creation. The base branch is now fetched from origin and stored as its remote-tracking ref. * fix(server): take a pull request's base and a checked-out branch from the remote that has them A fork branch-off fetched its base from origin. In a clone whose base repository is upstream, origin is the user's fork or missing, so the base was stale or the create failed. The base now comes from the remote that served the pull request, and a failed base fetch falls back to the bare branch name. Check out of a branch that only a remote other than origin has failed with an unknown branch. The local branch is now created from the one remote-tracking ref with that name, tracking it, as git does. The fork branch-off test passes a git identity to commit-tree, which CI runners do not have. * fix(server): branch off a pull request from the remote that serves it A same-repository pull request's head was fetched into refs/remotes/origin. In a fork clone, upstream serves the pull request and origin is the fork, so the base refresh replaced the head with the fork's branch of the same name and the new branch started from code that is not the pull request. The head now lands under refs/paseo/change-requests/<N>, the branch starts there, and the base is fetched from the remote that served the head. A routed create_workspace that branches off a pull request is refused, as it is on the local host. * fix(app): branch off a plugin's base ref whatever the branch action setBaseRef chose the base but kept the user's Check out switch, so a plugin's base became a checkout or a held-branch error. A base is what a new worktree starts from, so setBaseRef switches branches back to Branch off.
3.9 KiB
title, description, nav
| title | description | nav |
|---|---|---|
| 工作区 | 了解 Paseo 如何把工作目录、Agent、终端和浏览器组织成工作区。 | 工作区 |
工作区
Paseo 围绕工作区组织,而不是围绕聊天。
工作区是任务发生的地方。它有一个工作目录,可以同时包含多个正在运行的会话。在应用中,每个会话以一个标签页打开。
项目包含工作区
侧边栏从项目开始。项目可以是一个 git 仓库、一个 GitHub 项目,或者运行 Paseo daemon 的机器上的任意目录。
每个项目中都有工作区。例如:
my-app
├── main
├── fix-login-flow
└── redesign-settings
每个工作区都是一个独立的工作场所。你可以为主检出保留一个,为某个功能再创建一个,或者把一个 GitHub PR 作为另一个工作区打开。
使用 CLI 项目命令注册、列出、重命名或删除项目。
工作区包含会话
Agent 以会话的形式在工作区中运行。一个工作区可以同时打开一个或多个 Agent 会话,以及终端、浏览器和 diff。
这一点很重要,因为真实的开发很少能装进一段长长的聊天。你可能让一个 Agent 实现某个功能,打开一个终端运行服务,再启动另一个 Agent 审查 diff,同时在旁边开着浏览器。它们都属于同一个任务,所以应该放在一起。
在 Paseo 中,工作区是稳定的容器,会话是你在其中运行的东西。
选择隔离方式
创建工作区时,隔离 决定它在哪个目录中工作:
- 项目目录 使用项目自己的目录,例如你的主检出。当会话应该共享磁盘上已有的文件时使用。
- 新建 worktree 创建一个 git worktree,带有自己的目录和分支。当任务需要一份独立的文件副本时使用。
- 已有 worktree 使用磁盘上已有的 git worktree,并沿用它当前检出的分支。想在某个分支上继续工作而不再复制一份时使用。列表显示仓库的所有 git worktree,包括不是 Paseo 创建的。
工作区是产品概念;git worktree 是隔离其文件的一种方式。多个工作区可以使用同一个 worktree。对于 Paseo 创建的 worktree,Paseo 会在最后一个使用它的工作区被归档后删除它。Paseo 不会删除不是它创建的 worktree。
创建工作区
关于从启动并行 Agent 到审查和测试其改动的桌面端完整流程,请参见运行并行任务。
你可以在应用中或通过 CLI 创建工作区:
paseo workspace create --isolation local --path ~/dev/my-app --title main
paseo workspace create --isolation worktree --path ~/dev/my-app --base origin/main
你也可以创建工作区而不立即启动 Agent。工作区及其工作目录依然就绪;你可以打开终端、运行服务或浏览文件,稍后再启动 Agent。
无论哪种方式,工作区创建后都可以向其中添加更多会话。在 Agent 旁边打开一个终端,启动第二个 Agent 审查改动,或打开一个浏览器标签页检查本地服务。每个会话都是同一个工作区中的一个标签页。
创建 Agent 和创建工作区是两个独立的操作。如果你想让 Agent 位于某个已有的工作区,请传入工作区 ID。在人工操作的 shell 中直接运行 paseo run 会创建一个新的本地工作区;当某个 Agent 运行它时,Paseo 会识别调用者,并在调用者的工作区中创建一个子 Agent。
Worktree
Paseo 中的每个工作区都由一个工作目录支撑。当这个目录是 git worktree 时,每个任务都会获得独立的分支和隔离的环境。
如果想了解配置 setup 钩子、脚本和服务的细节,请继续阅读 Git worktree。