@voltage12/dsh-simple-worktree 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +104 -2
- package/cordis.patch.yml +4 -0
- package/docs/create-dialog-worktree.png +0 -0
- package/docs/create-dialog.png +0 -0
- package/docs/created-workspace.png +0 -0
- package/docs/delete-dialog.png +0 -0
- package/docs/git-missing.png +0 -0
- package/docs/non-git-toast.png +0 -0
- package/lib/client.js +752 -0
- package/lib/index.js +389 -0
- package/package.json +83 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 xiejinyang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,105 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @voltage12/dsh-simple-worktree
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
DSH Web 插件(非官方):在会话输入框工具行一键创建 git worktree,并在会话「…」菜单里把它连同工作区一起收掉。
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## 功能
|
|
8
|
+
|
|
9
|
+
### 新建 Worktree
|
|
10
|
+
|
|
11
|
+
- 入口在 `conversation.input.left`(模型选择、权限预设那一排),是一个无底色、28×28 的分支图标按钮。
|
|
12
|
+
- 按钮始终可点;当前会话目录不是 git 仓库、或系统里找不到 git 命令时,点击只弹出一条提示,不会打开创建窗口。
|
|
13
|
+
- 弹窗两个互斥选项:
|
|
14
|
+
- **新建分支**(默认):分支名输入框 + 「基于分支」下拉框(默认当前分支)。
|
|
15
|
+
- **已有分支**:列出全部本地分支,无默认;已被其他 worktree 检出的分支置灰并标注。
|
|
16
|
+
- 创建位置固定为**主仓库根目录** `<repo>/.agents/worktree/<分支名>`,分支名里的 `/` 拍平成 `-`。
|
|
17
|
+
- 目录重名自动加 `-2`、`-3`… 后缀;分支重名直接报错。
|
|
18
|
+
- 自动创建 `.agents/worktree/` 目录,并确保仓库根 `.gitignore` 含 `.agents/worktree/`。
|
|
19
|
+
- 创建成功后注册为 Workspace,在其中新建 Session 并自动激活。
|
|
20
|
+
- 如果当前会话本身就在 worktree 中(不是主仓库),弹窗底部会多出「删除当前 Worktree」;它与「…」菜单里的「删除 Worktree」走**完全相同**的确认、归档、注销、删除流程。
|
|
21
|
+
- git 失败时弹窗保留、显示原始错误,可改名重试。
|
|
22
|
+
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
### 删除 Worktree
|
|
26
|
+
|
|
27
|
+
- 入口在侧边栏会话行的「…」菜单:`sidebar.workspaces.session.menu.item`。
|
|
28
|
+
- **常驻显示**:主仓库会话也会出现;不在 worktree 中时点击只弹提示,不执行删除。
|
|
29
|
+
- 弹窗会列出:
|
|
30
|
+
- 该工作区下将被归档的会话数(含当前会话);
|
|
31
|
+
- workspace 注册将被移除;
|
|
32
|
+
- worktree 目录(未提交改动会丢失);
|
|
33
|
+
- 未提交改动数、未推送提交数;
|
|
34
|
+
- 分支会保留。
|
|
35
|
+
- 确认后按顺序执行:归档会话 → 注销 Workspace → `git worktree remove --force` 并清理残留目录。
|
|
36
|
+
- 有会话正在运行时拒绝删除并提示。
|
|
37
|
+
- 分支**不会**被删除。
|
|
38
|
+
|
|
39
|
+
> DSH 的会话只能归档、不能物理删除;这里的“删除会话”即归档。
|
|
40
|
+
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
## 安装
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
dsh plugin --profile desktop add @voltage12/dsh-simple-worktree
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
插件声明了 `dsh.bundle`,`dsh plugin add` 会把它加进 profile 的 bundles 列表。**装完需要重启 DeepSeek Harness**(host 半边在启动时组合)。
|
|
50
|
+
|
|
51
|
+
如果 npm 镜像尚未同步到新版本,可以临时指定官方源:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
dsh plugin --profile desktop add @voltage12/dsh-simple-worktree --registry=https://registry.npmjs.org/
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
卸载:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
dsh plugin --profile desktop remove @voltage12/dsh-simple-worktree
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## 兼容性
|
|
64
|
+
|
|
65
|
+
- 实测 DSH `0.2.1-rc.2`。
|
|
66
|
+
- 插件通过 `engines.dsh` 声明兼容范围 `>=0.2.1-rc.2 <0.3.0`。DSH 在安装和启动前会做兼容性检查,不匹配时会禁用该插件并提示,而不是直接崩溃。
|
|
67
|
+
- DSH 升级后请重新验证;如需放宽范围,会随插件新版本发布。
|
|
68
|
+
- 界面文案固定中文(中英文字典内容一致),不跟随应用语言切换。
|
|
69
|
+
|
|
70
|
+
## 安全说明
|
|
71
|
+
|
|
72
|
+
这是一个**非官方**插件,host 半边会:
|
|
73
|
+
|
|
74
|
+
- 调用 PATH 中的 `git` 命令;
|
|
75
|
+
- 在仓库根目录创建 `.agents/worktree/` 并修改仓库的 `.gitignore`;
|
|
76
|
+
- 在删除流程中移除 worktree 目录;
|
|
77
|
+
- 注册 `/plugin/simple-worktree/*` 下的本地 HTTP 路由。
|
|
78
|
+
|
|
79
|
+
只应在你信任的 DSH 安装中启用。不要把 DSH 的 Web 服务直接暴露到不可信网络;如果通过反向代理或隧道对外提供访问,请先确认 DSH 自身的访问控制。
|
|
80
|
+
|
|
81
|
+
## 开发
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
pnpm install
|
|
85
|
+
pnpm build # lib/index.js (host) + lib/client.js (web client)
|
|
86
|
+
pnpm typecheck
|
|
87
|
+
pnpm pack # 发布前构建并检查 tarball
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
- host 半:`src/host/index.js`,四条 `/plugin/simple-worktree/*` 路由(probe/create/inspect/remove),只依赖 Node 内置模块。
|
|
91
|
+
- client 半:`src/client/index.tsx`,由 esbuild 打成 DSH 的 `window.__ModuleLoader__.load({ id, factory })` 结构;模块 id 直接取 `package.json` 的包名。
|
|
92
|
+
- `lib/` 是构建产物;改 client 后重启进程或刷新页面,改 host 后需要重启宿主。
|
|
93
|
+
|
|
94
|
+
## 已知边界
|
|
95
|
+
|
|
96
|
+
- worktree 只包含已提交内容,当前未提交改动不会带过去。
|
|
97
|
+
- workspace/session 注册失败时不回滚已经建好的 worktree,会报错并给出路径。
|
|
98
|
+
- 目录名冲突后缀最多尝试 200 次。
|
|
99
|
+
- **git 以「分支」为单位判断占用,不看 commit**:两个不同分支指向同一个 commit 时,各自都可以有 worktree;只有同一个分支已被某个 worktree 检出时才会被拒绝(git 自身也拒绝)。「新建分支」模式要求分支名尚不存在;如果要为已存在的分支建 worktree,请用「已有分支」模式。
|
|
100
|
+
- 插件依赖 PATH 中的 `git`;找不到 git 时,新建和删除两个入口点击后都会提示「未找到 git 命令」,不会静默失败。
|
|
101
|
+
- DSH 对还没有消息的 blank session 不渲染会话行「…」菜单,所以发第一条消息前看不到菜单里的「删除 Worktree」。但空白会话本身是真实存在的(有 session id、cwd 和持久化日志),可以先在新建弹窗底部用「删除当前 Worktree」删掉它。
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
MIT
|
package/cordis.patch.yml
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|