@laoyuehanni/dsh-git-worktree 0.4.14 → 0.4.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -2
- package/README.zh.md +7 -2
- package/docs/DETAIL.md +4 -2
- package/docs/DETAIL.zh.md +4 -2
- package/lib/client.js +2490 -380
- package/lib/deferred-worktree.d.ts +104 -0
- package/lib/deferred-worktree.js +292 -0
- package/lib/git.d.ts +19 -0
- package/lib/git.js +81 -4
- package/lib/index.d.ts +13 -0
- package/lib/index.js +162 -4
- package/lib/normalize.d.ts +13 -0
- package/lib/normalize.js +51 -0
- package/lib/routes.d.ts +33 -2
- package/lib/routes.js +250 -79
- package/lib/wire.d.ts +99 -3
- package/lib/wire.js +11 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -130,10 +130,15 @@ Existing worktree folders and plugin settings carry over untouched.
|
|
|
130
130
|
- **Worktree isolation**: in a blank session, right-click any branch row for **Create worktree** or **New branch and worktree** (or flip the worktree toggle when picking a remote branch). Isolates into `<repo>/.dsh/gitworktree/<branch>/` (locally ignored via `.git/info/exclude` so `git status` stays clean) and registers a real workspace; recreating the same branch reuses its existing worktree wherever it lives. Once a session starts, the directory is locked and worktree creation verbs hide.
|
|
131
131
|
- **Worktree quick hop**: the main checkout's blank-session menu groups live worktree branches under **Worktrees** (hover shows the path); **Go to this worktree** jumps straight into that directory for a fresh session.
|
|
132
132
|
- **Safe worktree removal**: available from the **Worktrees** row menu and the manager dialog (disabled while a session is running). The confirmation dialog counts uncommitted files (red) and ahead commits, warns that workspace sessions will be archived, removes the git worktree (keeping the branch), and archives sessions / drops workspace registration only after git succeeds.
|
|
133
|
-
- **Worktree manager & legacy storage**: open from **Settings → Plugins** to view every worktree across both per-repository `.dsh/gitworktree` layouts and the read-only legacy central root (`~/.dsh/gitworktree` by default, auto-migrating `~/.dsh/gitworktree/settings.json`), grouped by repository with source badges and orphan directories included.
|
|
133
|
+
- **Worktree manager & legacy storage**: open from **Settings → Plugins** to view every worktree across both per-repository `.dsh/gitworktree` layouts and the read-only legacy central root (`~/.dsh/gitworktree` by default, auto-migrating `~/.dsh/gitworktree/settings.json`), grouped by repository with source badges and orphan directories included; each row shows whether it is attached as a standalone workspace or a session directory.
|
|
134
|
+
- **Blank name = random branch**: when cutting a new branch into a worktree, leave the name empty to get `<base>-<4 hex>`, avoiding existing branches and folders.
|
|
135
|
+
- **Official entry takeover** (setting "Take over official new-worktree entry", on by default): hides DSH's own new-worktree control in the top-right of blank sessions so worktrees are created from the branch menu, and withdraws any leftover official worktree request on that session to prevent nested creation. The changes and review panels are unaffected.
|
|
136
|
+
- **Session directory mode** (setting "Switch worktree directory in current workspace", off by default): worktrees are no longer registered as standalone workspaces; the session's working directory moves inside its repository workspace, as DSH's own worktrees do. A new worktree is created only when the first message is sent: a pending bar above the composer can be cancelled until then, creation reports each phase, and a failure offers Retry or Continue without worktree. Opening an existing worktree that already has a standalone workspace enters that workspace.
|
|
137
|
+
- **Official worktree management** (setting "Manage official worktrees", off by default): the manager also lists `<repo>/.agents/worktrees` under a "DSH official" group, which can be opened and removed manually but is never auto-pruned.
|
|
134
138
|
|
|
135
139
|
> [!NOTE]
|
|
136
|
-
> - **Native sidebar untouched**: worktrees are ordinary registered workspaces, and the workspace tree nests per-repository layouts under their repository automatically (legacy centrally-stored worktrees keep their old location).
|
|
140
|
+
> - **Native sidebar untouched**: worktrees are ordinary registered workspaces, and the workspace tree nests per-repository layouts under their repository automatically (legacy centrally-stored worktrees keep their old location). Session directory mode adds no workspace; worktree sessions in both modes show a worktree badge on their row.
|
|
141
|
+
> - A pending worktree in session directory mode lives only in the dsh server's memory: restarting dsh or reloading the plugin drops the pending bar, and the worktree must be chosen again.
|
|
137
142
|
> - **`git clean -xdff` (double `-f`)** deletes in-repository worktree directories (a single `-f` skips nested repos); `git worktree prune` restores registrations afterwards, but uncommitted work inside them is lost.
|
|
138
143
|
> - If every workspace of a repository is deregistered, its worktrees no longer appear in the manager or auto-prune; re-register any directory of that repository to bring them back.
|
|
139
144
|
|
package/README.zh.md
CHANGED
|
@@ -130,10 +130,15 @@ dsh plugin --profile web add @laoyuehanni/dsh-git-worktree
|
|
|
130
130
|
- **Worktree 隔离**:未开始的会话中,右键任意分支即可**「创建工作树」**或**「新建分支并创建工作树」**,隔离至 `<repo>/.dsh/gitworktree/<分支>/`(通过 `.git/info/exclude` 本地忽略,源仓库 `git status` 保持干净)并注册为真实工作区;重复创建同一分支自动复用已有 worktree。会话启动后目录锁定,工作树选项自动隐藏。
|
|
131
131
|
- **工作树快捷入口**:主仓库空白会话把被 worktree 占用的分支归入**「工作树」**分组(hover 显示路径),右键「跳到此工作树」直接进入对应目录开启新会话。
|
|
132
132
|
- **安全删除工作树**:在「工作树」分组右键或管理弹窗中操作(有运行中会话时禁用)。确认弹窗会用红色标出未提交文件数、领先提交数,并提示对应工作区会话将归档;确认后先删 git worktree(分支保留),仅在 git 成功后才归档会话并注销工作区,失败则 DSH 侧零变更且支持原地重试。
|
|
133
|
-
- **工作树管理 & 历史位置只读**:在 **设置 → 插件** 中打开管理弹窗,跨仓库列出各仓库 `.dsh/gitworktree` 与只读历史集中根(默认 `~/.dsh/gitworktree`,旧版 `settings.json`
|
|
133
|
+
- **工作树管理 & 历史位置只读**:在 **设置 → 插件** 中打开管理弹窗,跨仓库列出各仓库 `.dsh/gitworktree` 与只读历史集中根(默认 `~/.dsh/gitworktree`,旧版 `settings.json` 自动迁入)下的全部工作树(含孤儿目录),按仓库分组并带来源标识;每行标出接入形态「独立工作区 / 会话目录」。
|
|
134
|
+
- **留空即随机分支**:「新建分支并创建工作树」时分支名可留空,自动以 `<基分支>-<4位十六进制>` 命名并避开已有分支与目录。
|
|
135
|
+
- **接管官方入口**(设置「接管官方新建工作树入口」,默认开):隐藏空白会话右上角 DSH 官方的新建工作树按钮,统一由左下角分支菜单创建,并撤销该会话上残留的官方工作树请求,避免嵌套创建;右侧变更与评审面板不受影响。
|
|
136
|
+
- **会话目录模式**(设置「在当前工作区下切换工作树目录」,默认关):开启后工作树不再注册为独立工作区,而是在所属仓库工作区下切换会话工作目录(与 DSH 官方方式一致)。新建工作树延迟到发送首条消息时才执行,输入框上方显示待建条,可随时取消;创建过程分步显示进度,失败可「重试」或「不使用工作树继续」。打开已有工作树时,若它已有独立工作区则直接进入该工作区。
|
|
137
|
+
- **纳管官方工作树**(设置「管理官方创建的工作树」,默认关):管理弹窗一并列出 `<repo>/.agents/worktrees` 下的官方工作树(「DSH 官方」分组),可打开与手动删除,但始终不参与自动清理。
|
|
134
138
|
|
|
135
139
|
> [!NOTE]
|
|
136
|
-
> -
|
|
140
|
+
> - **不影响原生侧边栏**:工作树即普通注册工作区,工作区树会自动把各仓库内的新建工作树归到对应仓库之下(旧的集中存放工作树保持原位)。会话目录模式下不新增工作区;两种模式下的工作树会话行均会显示工作树角标。
|
|
141
|
+
> - 会话目录模式的待建状态只保存在 dsh 服务进程内存中:重启 dsh 或重载插件后待建条消失,需要重新选择。
|
|
137
142
|
> - **`git clean -xdff`(双 `-f`)** 会删掉仓库内的工作树目录(单 `-f` 会跳过嵌套仓库);删后可通过 `git worktree prune` 恢复注册,但其中未提交的改动会丢失。
|
|
138
143
|
> - 某仓库的工作区全部注销后,其工作树不再出现在管理弹窗与自动清理中;重新注册该仓库任一目录即可找回。
|
|
139
144
|
|
package/docs/DETAIL.md
CHANGED
|
@@ -5,7 +5,8 @@ The composer tool row gains a branch button: it opens the repository's branch me
|
|
|
5
5
|
- **Inspect and switch branches**: local and remote branches in collapsible groups, `/` folding like folders, with arrows marking how far each row leads or trails its upstream. Picking a branch switches immediately; picking a remote branch checks it out with a tracking branch.
|
|
6
6
|
- **Act on any branch**: right-click a row to check out, create, create-and-check-out from it, rename, delete, or copy it; the current branch can fast-forward to its upstream or open the compact push window (pending-commit list, Git tags, force-with-lease, enabled after the remote check).
|
|
7
7
|
- **Read the history**: the graph button next to the menu expands the commit graph in place — browsing never checks out, selecting a commit shows its author, date, full message, and file summary; more pages load at the end, and loaded titles and hashes are searchable.
|
|
8
|
-
- **Isolate into a worktree**: tick Worktree on a blank session (or right-click a branch and pick Create worktree) and the session starts at `<repo>/.dsh/gitworktree/<branch>` registered as a real workspace, reusing the directory when it already exists; branches held by worktrees collect in the Worktrees group, and Jump to this worktree opens a new session inside.
|
|
8
|
+
- **Isolate into a worktree**: tick Worktree on a blank session (or right-click a branch and pick Create worktree) and the session starts at `<repo>/.dsh/gitworktree/<branch>` registered as a real workspace, reusing the directory when it already exists; branches held by worktrees collect in the Worktrees group, and Jump to this worktree opens a new session inside. Leave the new branch name blank to get a random `<base>-<4 hex>` name.
|
|
9
|
+
- **Stay in one workspace if you prefer**: turn on "Switch worktree directory in current workspace" and worktrees open by moving the session's directory under its repository, as DSH's own worktrees do; a new worktree is created only when you send the first message, with Retry or Continue without worktree if it fails.
|
|
9
10
|
- **Sync remotes**: the toolbar refresh fetches every remote and prunes stale tracking branches; pushes and updates show a cancellable floating progress card that survives switching sessions.
|
|
10
11
|
|
|
11
12
|
## Some limits
|
|
@@ -13,4 +14,5 @@ The composer tool row gains a branch button: it opens the repository's branch me
|
|
|
13
14
|
- The directory is fixed once a session starts; inside a worktree session the branch menu shows only its own branch — go back to the main repository for the rest.
|
|
14
15
|
- Delete worktree first lists uncommitted files and ahead commits; after confirmation it removes the git worktree, archives its sessions, and unregisters the workspace — the branch itself stays. It is disabled while a session is running.
|
|
15
16
|
- Every git command runs outside your sessions; the plugin never stashes, rewrites history, or touches the main checkout for you.
|
|
16
|
-
- The plugin's configuration page (Settings → Plugins) opens the cross-repository worktree manager.
|
|
17
|
+
- The plugin's configuration page (Settings → Plugins) opens the cross-repository worktree manager; it can also include DSH's own worktrees under `<repo>/.agents/worktrees`, which are never auto-pruned.
|
|
18
|
+
- By default the plugin hides DSH's own new-worktree button on blank sessions so there is a single entry; turn the takeover off in the settings to bring it back.
|
package/docs/DETAIL.zh.md
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
- **看分支、切分支**:本地与远程分支分组展示,`/` 按文件夹层级折叠,行上箭头标出与上游的领先/落后。选中即切换(免确认);选远程分支直接检出并自动建跟踪。
|
|
6
6
|
- **分支上的操作**:右键任意分支行——签出、新建、从它新建并检出、重命名、删除、复制;当前分支可快进更新到上游,或打开紧凑的推送窗口(待推送清单、Git 标记、force-with-lease,远程校验通过后才能推)。
|
|
7
7
|
- **看提交历史**:菜单旁的图谱按钮原位展开提交图谱:浏览不检出,选中看作者、时间、正文与文件摘要;滚到底自动加载,可按标题或哈希搜索。
|
|
8
|
-
- **隔离进工作树**:空白会话勾选「工作树」(或右键分支行「创建工作树」),会话在 `<repo>/.dsh/gitworktree/<分支>`
|
|
8
|
+
- **隔离进工作树**:空白会话勾选「工作树」(或右键分支行「创建工作树」),会话在 `<repo>/.dsh/gitworktree/<分支>` 开始并注册为真实工作区,重复创建复用已有目录;被占用的分支收进「工作树」分组,「跳到此工作树」直接进去开新会话。新分支名留空即自动生成 `<基分支>-<4位十六进制>`。
|
|
9
|
+
- **想留在同一个工作区也行**:开启「在当前工作区下切换工作树目录」后,工作树改为在所属仓库下切换会话目录(同 DSH 官方方式);新建工作树延迟到发送首条消息时才执行,失败可「重试」或「不使用工作树继续」。
|
|
9
10
|
- **同步远程**:工具栏刷新按钮 fetch 全部远程并清理失效跟踪分支;推送、更新期间有可取消的悬浮进度卡片,切换会话也在。
|
|
10
11
|
|
|
11
12
|
## 一些边界
|
|
@@ -13,4 +14,5 @@
|
|
|
13
14
|
- 会话开始后目录固定;工作树会话的分支菜单只显示自己的分支,其余操作请回主仓库发起。
|
|
14
15
|
- 「删除工作树」会先列出未提交文件数与领先提交数,确认后删除 git 工作树、归档其会话并注销工作区——分支本身保留;有会话正在运行时不可删。
|
|
15
16
|
- 所有 git 操作由插件在会话之外执行;绝不替你 stash、改写历史或动主检出的文件。
|
|
16
|
-
- 设置 →
|
|
17
|
+
- 设置 → 插件里本插件的配置页可打开跨仓库的工作树管理弹窗;也可一并纳管 `<repo>/.agents/worktrees` 下的 DSH 官方工作树,它们永不参与自动清理。
|
|
18
|
+
- 插件默认隐藏空白会话右上角 DSH 官方的新建工作树按钮,保持单一入口;在设置中关闭「接管官方新建工作树入口」即可恢复。
|