@cerbur/clutch-dsh-worktree 0.1.3 → 0.1.4

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.
Files changed (73) hide show
  1. package/README.md +247 -107
  2. package/README.zh.md +297 -0
  3. package/lib/client/WorktreeSurface.d.ts +2 -30
  4. package/lib/client/WorktreeSurface.d.ts.map +1 -1
  5. package/lib/client/WorktreeSurface.js +31 -318
  6. package/lib/client/WorktreeSurface.js.map +1 -1
  7. package/lib/client/worktree-surface-dialogs.d.ts +7 -0
  8. package/lib/client/worktree-surface-dialogs.d.ts.map +1 -0
  9. package/lib/client/worktree-surface-dialogs.js +86 -0
  10. package/lib/client/worktree-surface-dialogs.js.map +1 -0
  11. package/lib/client/worktree-surface-rows.d.ts +9 -0
  12. package/lib/client/worktree-surface-rows.d.ts.map +1 -0
  13. package/lib/client/worktree-surface-rows.js +223 -0
  14. package/lib/client/worktree-surface-rows.js.map +1 -0
  15. package/lib/client/worktree-surface-selectors.d.ts +9 -0
  16. package/lib/client/worktree-surface-selectors.d.ts.map +1 -0
  17. package/lib/client/worktree-surface-selectors.js +28 -0
  18. package/lib/client/worktree-surface-selectors.js.map +1 -0
  19. package/lib/client/worktree-surface-types.d.ts +233 -0
  20. package/lib/client/worktree-surface-types.d.ts.map +1 -0
  21. package/lib/client/worktree-surface-types.js +2 -0
  22. package/lib/client/worktree-surface-types.js.map +1 -0
  23. package/lib/client/worktree-view-actions.d.ts +34 -0
  24. package/lib/client/worktree-view-actions.d.ts.map +1 -0
  25. package/lib/client/worktree-view-actions.js +69 -0
  26. package/lib/client/worktree-view-actions.js.map +1 -0
  27. package/lib/client/worktree-view-errors.d.ts +20 -0
  28. package/lib/client/worktree-view-errors.d.ts.map +1 -0
  29. package/lib/client/worktree-view-errors.js +65 -0
  30. package/lib/client/worktree-view-errors.js.map +1 -0
  31. package/lib/client/worktree-view-read.d.ts +48 -0
  32. package/lib/client/worktree-view-read.d.ts.map +1 -0
  33. package/lib/client/worktree-view-read.js +134 -0
  34. package/lib/client/worktree-view-read.js.map +1 -0
  35. package/lib/client/worktree-view.d.ts +4 -97
  36. package/lib/client/worktree-view.d.ts.map +1 -1
  37. package/lib/client/worktree-view.js +4 -263
  38. package/lib/client/worktree-view.js.map +1 -1
  39. package/lib/client.js +404 -324
  40. package/lib/client.js.map +1 -1
  41. package/lib/manage/manager-context.d.ts +11 -0
  42. package/lib/manage/manager-context.d.ts.map +1 -0
  43. package/lib/manage/manager-context.js +2 -0
  44. package/lib/manage/manager-context.js.map +1 -0
  45. package/lib/manage/manager-sessions.d.ts +18 -0
  46. package/lib/manage/manager-sessions.d.ts.map +1 -0
  47. package/lib/manage/manager-sessions.js +91 -0
  48. package/lib/manage/manager-sessions.js.map +1 -0
  49. package/lib/manage/manager-support.d.ts +18 -0
  50. package/lib/manage/manager-support.d.ts.map +1 -0
  51. package/lib/manage/manager-support.js +174 -0
  52. package/lib/manage/manager-support.js.map +1 -0
  53. package/lib/manage/manager-worktrees.d.ts +27 -0
  54. package/lib/manage/manager-worktrees.d.ts.map +1 -0
  55. package/lib/manage/manager-worktrees.js +259 -0
  56. package/lib/manage/manager-worktrees.js.map +1 -0
  57. package/lib/manage/manager.d.ts +23 -65
  58. package/lib/manage/manager.d.ts.map +1 -1
  59. package/lib/manage/manager.js +32 -565
  60. package/lib/manage/manager.js.map +1 -1
  61. package/lib/provider/sidecar-persistence.d.ts +18 -0
  62. package/lib/provider/sidecar-persistence.d.ts.map +1 -0
  63. package/lib/provider/sidecar-persistence.js +162 -0
  64. package/lib/provider/sidecar-persistence.js.map +1 -0
  65. package/lib/provider/sidecar-schema.d.ts +6 -0
  66. package/lib/provider/sidecar-schema.d.ts.map +1 -0
  67. package/lib/provider/sidecar-schema.js +123 -0
  68. package/lib/provider/sidecar-schema.js.map +1 -0
  69. package/lib/provider/sidecar.d.ts +10 -67
  70. package/lib/provider/sidecar.d.ts.map +1 -1
  71. package/lib/provider/sidecar.js +21 -346
  72. package/lib/provider/sidecar.js.map +1 -1
  73. package/package.json +1 -1
package/README.md CHANGED
@@ -1,51 +1,87 @@
1
1
  # @cerbur/clutch-dsh-worktree
2
2
 
3
- `@cerbur/clutch-dsh-worktree` DSH Web UI 增加按 Git Worktree 组织 Session 的视角,同时继续由 DSH 管理原始 Project/Workspace Session 数据。
3
+ `@cerbur/clutch-dsh-worktree` adds a Git Worktree view to the DSH Web UI. It groups
4
+ Sessions as Workspace → Worktree → Session while keeping DSH as the source of truth for
5
+ Project/Workspace identity, Session metadata, native lists, and conversation history.
6
+ The plugin stores only external Worktree/Session relationship metadata.
7
+
8
+ ## Screenshots
9
+
10
+ ![English Worktree sidebar and blank-session Hero](assets/screenshots/screenshots-en.png)
11
+
12
+ The English screenshot shows Worktree mode in the Sidebar, a Workspace tree with Main and
13
+ Worktree rows, and the read-only blank-session Hero context.
14
+
15
+ ## Capabilities
16
+
17
+ - Enter Worktree mode from the DSH Sidebar footer and browse Workspace → Worktree → Session.
18
+ - Search Workspaces and create a Git Worktree and branch from an existing local branch.
19
+ - Create a normal Session from Main or a Session whose runtime cwd is an active Worktree, then
20
+ open it directly.
21
+ - See ready, repair, active, and detached Worktree states, including retryable operation errors.
22
+ - Remove an active Worktree from its options menu with confirmation. Main and detached rows do
23
+ not expose that menu.
24
+ - Continue using DSH-native Workspace rename/delete/reorder and Session menus. Worktree rows can
25
+ be reordered within their owning Workspace; order is stored in the plugin sidecar and Main is
26
+ fixed first.
27
+ - Keep the current local branch or Worktree branch visible as read-only context in the existing
28
+ Conversation title row and in the blank-session Hero.
29
+ - Keep Worktree Sessions in the original DSH Project/Workspace view; the plugin does not copy
30
+ Session content or modify messages, prompts, transcripts, or history.
31
+
32
+ ### Compatibility and prerequisites
33
+
34
+ - The DSH CLI and the target Web profile must use `dsh-v0.1.0-rc.8`.
35
+ - The target profile, such as `web` or `demo`, must already start successfully, and the plugin
36
+ must be installed into the same profile that launches the Web UI.
37
+ - DSH Client must provide the native `@deepseek-ai/dsh-client-ui-conversation` package and its
38
+ `conversation.session.header.actions` seat.
39
+ - A Workspace must be inside a Git repository with an initial commit and at least one local
40
+ branch. If a prerequisite is missing, the create dialog shows copyable setup commands; the
41
+ plugin does not run them or modify Workspace files.
42
+ - The package declares an installable `dsh.bundle` and provides `cordis.patch.yml`; its browser
43
+ UI is declared through the `dsh.client` metadata.
44
+
45
+ ## Installation
46
+
47
+ Use the npm package for the normal user installation. Use a repository checkout to develop or
48
+ validate local source, or use the GitHub source path when installing the source package through a
49
+ marketplace entry.
50
+
51
+ ### Install from npm (recommended)
52
+
53
+ With an installed DSH CLI:
4
54
 
5
- English marketplace description:
6
-
7
- > Adds a Worktree view to DSH Web UI that groups Sessions by Git worktree while keeping DSH as the source of truth.
8
-
9
- ## 功能
10
-
11
- 从 DSH Sidebar footer 打开 Worktree mode 后,可以:
12
-
13
- - 按 Workspace → Worktree → Session 查看会话;
14
- - 搜索 Workspace,并从已有 local branch 创建新的 Git Worktree 和 branch;
15
- - 在 Main 或指定 Worktree 下创建 Session,并直接打开新 Session;
16
- - 查看 active、detached 和 repair 状态;
17
- - 通过 active Worktree 的选项菜单移除 Worktree,并在确认弹窗中完成操作;
18
- - 继续使用 DSH 原生的 Workspace rename/delete/reorder 和 Session 菜单、排序能力;Worktree 可在所属 Workspace 内拖动排序,顺序持久化在 plugin sidecar,Main 固定在第一位。
19
- - 在已有 Session 的 Conversation 标题行显示只读上下文:`Session title → Agent mode → current branch / Worktree branch`。
20
- - 在新建会话的 Hero 标题后以只读浮层显示 `Workspace (current branch / Worktree branch)`;重新选择 Workspace 后随当前分支上下文更新。
21
-
22
- Worktree Session 仍属于原始 DSH Project/Workspace,因此切回原生 Project/Session 视角时仍可由 DSH 展示。插件不复制 Session 内容,也不修改消息、prompt、transcript 或历史记录。
55
+ ```bash
56
+ dsh plugin --profile web add @cerbur/clutch-dsh-worktree
57
+ dsh web
58
+ ```
23
59
 
24
- ## 兼容性与前置条件
60
+ When using a `deepseek-harness` source checkout without a standalone `dsh` command, use the
61
+ equivalent forwarding form:
25
62
 
26
- - DSH CLI 和目标 Web profile 使用 `dsh-v0.1.0-rc.8`;
27
- - 已有可启动的 DSH profile,例如 `web` 或 `demo`;
28
- - plugin 安装在实际启动 Web UI 的同一个 profile;
29
- - DSH Client 必须提供原生 `@deepseek-ai/dsh-client-ui-conversation` package 的 `conversation.session.header.actions` seat;
30
- - 要使用 Worktree 功能,目标 Workspace 必须位于 Git repository 中,且至少有一个初始 commit 和本地 branch;如果前置条件不满足,创建弹窗会显示可复制的 Git 命令,但插件不会自动修改 Workspace。
63
+ ```bash
64
+ cd /path/to/deepseek-harness
65
+ pnpm dsh plugin --profile web add @cerbur/clutch-dsh-worktree
66
+ pnpm dsh web
67
+ ```
31
68
 
32
- package manifest 已声明可安装的 `dsh.bundle`,并随 package 提供 `cordis.patch.yml`;Web UI 使用另行声明的 `dsh.client` browser entry。
69
+ To inspect the currently published version on the official registry:
33
70
 
34
- ## 安装
71
+ ```bash
72
+ npm view @cerbur/clutch-dsh-worktree version --registry=https://registry.npmjs.org/
73
+ ```
35
74
 
36
- ### 从本地 checkout 安装
75
+ ### Install from a repository checkout
37
76
 
38
- 先在 `clutch-dsh` 根目录构建 package:
77
+ Build the package from the `clutch-dsh` checkout, then install its absolute path into the DSH
78
+ profile:
39
79
 
40
80
  ```bash
41
81
  cd /path/to/clutch-dsh
42
82
  pnpm install
43
83
  pnpm --filter @cerbur/clutch-dsh-worktree build
44
- ```
45
84
 
46
- 再在本地 `deepseek-harness` 根目录构建 DSH,并把 package 安装到目标 profile:
47
-
48
- ```bash
49
85
  cd /path/to/deepseek-harness
50
86
  pnpm install
51
87
  pnpm run build
@@ -54,101 +90,191 @@ pnpm dsh web --dump-config
54
90
  pnpm dsh web
55
91
  ```
56
92
 
57
- 建议使用绝对路径。`--dump-config` 输出中应能看到 `@cerbur/clutch-dsh-worktree` bundle layer
58
-
59
- 如果 profile 之前安装过旧的 unscoped package,先移除旧条目:
93
+ The `--dump-config` output should include the plugin bundle layer. If the profile still contains
94
+ an old unscoped installation, remove it first:
60
95
 
61
96
  ```bash
62
97
  pnpm dsh plugin --profile web remove clutch-dsh-worktree
63
98
  ```
64
99
 
65
- ### npm registry 安装
66
-
67
- 已发布的 package 可以直接通过 DSH CLI 安装:
68
-
69
- ```bash
70
- dsh plugin --profile web add @cerbur/clutch-dsh-worktree
71
- dsh web
72
- ```
73
-
74
- 如果使用的是 `deepseek-harness` 源码 checkout、系统没有独立的 `dsh` 命令,使用等价的转发形式:
100
+ To update a local checkout, rebuild the package and restart DSH:
75
101
 
76
102
  ```bash
103
+ cd /path/to/clutch-dsh
104
+ pnpm --filter @cerbur/clutch-dsh-worktree build
77
105
  cd /path/to/deepseek-harness
78
- pnpm dsh plugin --profile web add @cerbur/clutch-dsh-worktree
79
106
  pnpm dsh web
80
107
  ```
81
108
 
82
- 安装前可以查看官方 npm registry 的当前发布版本:
109
+ After changing `package.json`, `cordis.patch.yml`, or the profile bundle members, run the plugin
110
+ add command again.
111
+
112
+ ### Install from GitHub source
113
+
114
+ The source path generated by `awesome-dsh-plugin` is:
83
115
 
84
116
  ```bash
85
- npm view @cerbur/clutch-dsh-worktree version --registry=https://registry.npmjs.org/
117
+ dsh plugin --profile web add "github:Cerbur/clutch-dsh#path:/packages/clutch-dsh-worktree"
86
118
  ```
87
119
 
88
- 从本地 checkout 更新时,只需重新构建 package 并重启 DSH:
120
+ This is a source Git dependency, not a prebuilt npm package. Its `prepare` lifecycle generates
121
+ `lib/`. The current DSH profile uses pnpm 11 `allowBuilds`: on the first Git installation, pnpm
122
+ intentionally rejects the build and prints a complete key containing the package name, Git URL,
123
+ resolved commit, and subdirectory path. Copy that complete key into the profile's
124
+ `pnpm-workspace.yaml`, for example:
89
125
 
90
- ```bash
91
- cd /path/to/clutch-dsh
92
- pnpm --filter @cerbur/clutch-dsh-worktree build
93
- cd /path/to/deepseek-harness
94
- pnpm dsh web
126
+ ```yaml
127
+ allowBuilds:
128
+ '@cerbur/clutch-dsh-worktree@git+https://github.com/Cerbur/clutch-dsh#<resolved-commit>&path:/packages/clutch-dsh-worktree': true
95
129
  ```
96
130
 
97
- 修改 `package.json`、`cordis.patch.yml` profile bundle 成员后,需要重新执行 `dsh plugin add`。
131
+ Use the exact package key printed by pnpm: `<resolved-commit>`, the Git URL, and the path must
132
+ match the error output. A package-name-only entry is not enough for a direct Git dependency, and
133
+ `onlyBuiltDependencies` is not the configuration used by the current pnpm 11 Git prepare flow.
134
+ After saving the allowlist, rerun the original install command. A new commit requires a new key.
135
+ The allowlist belongs to the profile owner who trusts that Git commit; do not add it to this
136
+ plugin package.
98
137
 
99
- ### 卸载
138
+ After authorization, Git prepare runs `pnpm install` in the checked-out monorepo and then
139
+ `pnpm run build`, so the profile must be able to reach its configured registry. Registry DNS,
140
+ mirror, or lockfile errors after authorization are installation-environment errors, not
141
+ `allowBuilds` rejections. Use the npm installation above to avoid source-build authorization.
142
+
143
+ ### Uninstall
100
144
 
101
145
  ```bash
102
146
  cd /path/to/deepseek-harness
103
147
  pnpm dsh plugin --profile web remove @cerbur/clutch-dsh-worktree
104
148
  ```
105
149
 
106
- ## 使用说明
107
-
108
- 1. 启动 DSH Web UI,在 Sidebar footer 打开 Worktree mode
109
- 2. 使用 Workspace 的 `+` 选择基线 local branch,填写新的 Worktree name;默认 branch 名为 `dsh/<8位随机串>`。如果 Workspace 没有 Git、没有首次 commit 或没有本地 branch,弹窗会先显示对应的可复制修复命令。
110
- 3. 使用 Main 旁边的 `+` 创建普通 DSH Session。
111
- 4. 使用 Worktree 旁边的 `+` 创建 cwd 指向该 Worktree 的 Session;插件完成关系绑定后打开它。
112
- 5. 观察 Worktree ready、repair detached 状态;active Worktree 的选项菜单提供 Remove Worktree 入口,Main detached Worktree 不显示该选项。
113
-
114
- Workspace 删除只删除 DSH 的 Workspace registration;其目录、Session、Git Worktree 和 plugin sidecar 会保留。
115
-
116
- ## 界面语言
117
-
118
- Worktree mode 跟随 DSH 当前界面语言。语言选择和偏好持久化由 DSH 提供;插件不增加
119
- 独立的语言设置。当前插件随 DSH 提供中文和 English 文案,切换 DSH 语言后,Worktree
120
- 入口、Workspace/Worktree/Session 树、菜单、弹窗、状态和重试提示会同步切换。
121
-
122
- Workspace、Session、branch、path 以及 DSH/Host 返回的原始错误信息保持原值,便于
123
- 诊断和继续使用 DSH 原生数据。
124
-
125
- Worktree mode Main 分组会显示当前 local branch:English `Local (branch)`,中文为
126
- `本地(branch)`;如果 DSH 没有返回当前分支,则显示 `Local` `本地`。branch 名称保持
127
- DSH/Git 原值。
128
-
129
- ## 当前限制
130
-
131
- DSH rc.8 的原生 `session.create` 不能同时接收 `workspaceId` 和独立 `cwd`。Worktree Session 因此先以 `cwd` 创建,再由插件保存关系,并在当前浏览器内投影 Workspace membership;这不会修改 DSH 源码或 Session metadata。需要 DSH 原生持久 attach 时,仍需 DSH 提供同时支持 Workspace 与独立 cwd 的 API。
132
-
133
- Worktree `+` 会优先复用当前 active Worktree、相同绝对路径下未归档的 blank Session;已绑定的直接打开,未绑定的先保存 binding 再投影和打开。没有可复用候选时才按 `create bind project open` 创建;同一 Client 内对同一 Worktree 的并发点击会合并为一次流程。binding 失败会保留原 Session ID 供恢复,指向缺失 Session 或错误 cwd 的关系则显示可重试的 repair 状态。
134
-
135
- 未发送第一条 prompt provisional blank Session 遵循 DSH 原生显示规则:仅在当前选中的视角中显示本地化的“新会话”/“New Session”,不显示生成的 Session ID,也不显示重命名、Fork 或归档菜单。首条 prompt 被接受后,原生 Session summary 转为普通会话,Worktree 行恢复显示真实标题和菜单;隐藏 blank 行不会删除 Session 或 Worktree binding。
136
-
137
- Worktree 顺序按每个 Workspace 独立持久化在 plugin sidecar `worktrees` 数组中,使用与 DSH 原生 `insertBefore` 相同的 source/anchor 语义。Main 是固定的本地视角,不参与 Worktree 拖动;排序不会修改 DSH Workspace、Session 或 Git Worktree 数据。
138
-
139
- 如果 Connection、Gateway Worktree 操作失败,界面会保留可重试的错误,不把失败伪装为空列表。Git 前置条件失败会按 Workspace 独立显示 setup 提示和可复制命令;插件不会自动执行这些命令,也不会写入 README commit。删除 Worktree 不会删除 Session;detached 关系会保留,直到显式解绑。Main 与 Worktree 分组共用一个参数化 split-row;Main 使用相同的 branch/tree icon 和 action rail,但不传入 Worktree remove 菜单。
140
-
141
- Conversation 上下文显示在已有 Session 的原生标题行;新建会话的空白 Hero 使用 plugin-only `shell.overlay` 在原生标题后显示 `Workspace (branch)`。浮层只在原生 `[data-phase="hero"]` 和标题锚点存在时显示,重新选择 Workspace 后会重新读取对应的 local branch 或 active Worktree branch。它仅供展示,不会写回 DSH Workspace 或 Session;binding 处于 detached、invalid、repair unavailable 状态时,标签会消失。由于 rc.8 没有 Hero 标题的 additive slot,浮层位置依赖原生 Hero 的 DOM 结构,未来应优先迁移到正式 slot。
142
-
143
- ## 版本与发布
144
-
145
- 本地路径和 Git 依赖安装读取当前 checkout,npm 安装读取 registry;两者不是同一个安装来源。`packages/clutch-dsh-worktree/package.json` `version` 是本地和 npm 的唯一版本源。不要在 README 或市场条目中复制当前版本号;发布修复或新功能时,先递增 package version,再通过 `prepare` 从当前源码生成 `lib/`,然后打包并发布新的 npm version。完整的版本同步、发布、registry 验证和本地/Git/registry 安装流程见 [`docs/RELEASING.md`](docs/RELEASING.md)。
146
-
147
- ## 开发与验证
148
-
149
- 在 workspace 根目录执行:
150
+ ## Usage
151
+
152
+ ### Open Worktree mode
153
+
154
+ 1. Start the DSH Web UI and select Worktree from the Sidebar footer. Worktree mode is an
155
+ additive surface; it does not add a separate Workspace/Worktree tab.
156
+ 2. Use the Workspace tree to search, expand, and select the Main or Worktree view. Each group
157
+ initially shows five rows; use Expand more/Collapse for additional rows.
158
+
159
+ ![Worktree sidebar and blank-session Hero while using Worktree mode](assets/screenshots/screenshots-en.png)
160
+
161
+ The screenshot above illustrates the Sidebar entry point and the visual context shown in the
162
+ blank-session Hero. The displayed language follows DSH's current language setting.
163
+
164
+ ### Create a Worktree
165
+
166
+ 1. Select a Workspace, press its `+`, choose a baseline local branch, and enter a Worktree name.
167
+ The default branch name is `dsh/<8-character-random-string>`.
168
+ 2. The target Worktree path must be absolute, belong to the same Project, and differ from the
169
+ Project root. Relative paths, a different Project, or the Project root are rejected.
170
+ 3. If Git, an initial commit, or a local branch is missing, follow the copyable commands in the
171
+ dialog and retry. The plugin only renders those commands; it does not run them or edit
172
+ business files.
173
+
174
+ ### Create Main and Worktree Sessions
175
+
176
+ - Use Main's `+` to create a normal DSH Session in the Project-root view.
177
+ - Use a Worktree's `+` to create or reuse a Session with that Worktree as its runtime cwd. On
178
+ rc.8, the native call is `session.create({ cwd: worktreePath })`; the plugin then saves the
179
+ external binding, applies a browser-local `{ workspaceId, sessionId }` membership projection,
180
+ and opens the Session.
181
+ - The connector reuses an unarchived blank Session with the exact target cwd when possible. An
182
+ already-bound Session opens directly; an unbound candidate is bound before projection and
183
+ opening. Otherwise the flow is `create bind project open`, and concurrent clicks for the
184
+ same Worktree are coalesced.
185
+ - If binding fails after DSH has created the Session, the Session ID remains available for Retry
186
+ or Open recovery. The plugin does not delete or mutate that DSH Session.
187
+ - A provisional blank Session follows DSH's native display rules: it is shown only in the
188
+ selected view, uses the localized `New Session` label, hides its generated ID, and has no
189
+ Rename, Fork, or Archive menu. After the first prompt is accepted, it becomes an ordinary
190
+ Session row; hiding the blank row does not delete the Session or its Worktree binding.
191
+
192
+ ### Reorder and manage Worktrees
193
+
194
+ - Drag Worktrees within their owning Workspace. The ordered `worktrees` array is persisted in
195
+ the plugin sidecar; Main is a fixed first row and Worktrees cannot move across Workspaces.
196
+ - Use the active Worktree options menu and confirmation dialog to remove a Worktree. Main and
197
+ detached Worktrees do not show this menu.
198
+ - Removing a Worktree does not delete its Sessions. The relationship remains detached until it
199
+ is explicitly unbound. Deleting a Workspace removes only DSH's Workspace registration; its
200
+ directory, Sessions, Git Worktrees, and plugin sidecar remain.
201
+ - DSH-native Workspace rename/delete/reorder and Session menus remain available. Session drag
202
+ ordering is limited to the current visual Main or Worktree group.
203
+ - The Main group shows the current local branch as `Local (branch)` and falls back to `Local` if
204
+ DSH reports no current branch. Branch names, paths, Workspace names, Session titles, and raw
205
+ DSH/Git errors keep their original values.
206
+ - Existing Sessions show read-only context in the form `Session title` → `Agent mode` →
207
+ `current branch / Worktree branch`. The blank Hero shows `Workspace (branch)` after the native
208
+ title when its anchors are available.
209
+
210
+ ### Understand status and recovery messages
211
+
212
+ - `ready` means the Worktree is available. `repair` identifies a missing or invalid Worktree,
213
+ Session, binding, or cwd. `detached` means the Git Worktree was removed while the relationship
214
+ was retained. An active binding pointing to a missing Worktree produces an explicit repair
215
+ warning or error; it never silently falls back to another Worktree.
216
+ - Worktree health is a runtime Git projection and is not written to the sidecar. Git readiness
217
+ failures are shown per Workspace with setup instructions; Connection, Gateway, and unexpected
218
+ Worktree-domain failures remain visible as retryable errors rather than empty lists.
219
+ - Refreshing an already-ready view preserves its current projection until replacement data is
220
+ available. Initial entry and explicit Retry may show a loading state.
221
+
222
+ ## Language behavior
223
+
224
+ Worktree mode follows DSH's current interface language. DSH owns the language preference; the
225
+ plugin does not add an independent language setting. The Worktree entry point, Workspace →
226
+ Worktree → Session tree, menus, dialogs, statuses, and retry messages are localized in English
227
+ and Chinese.
228
+
229
+ Workspace names, Session titles, branch names, paths, and raw DSH/Host error messages remain
230
+ unchanged for diagnosis and continued use of native DSH data. The Main group is localized as
231
+ `Local (branch)` in English and `本地(branch)` in Chinese, with `Local`/`本地` as the fallback
232
+ when no current branch is reported.
233
+
234
+ ## Data boundaries and current limitations
235
+
236
+ DSH owns the original Project/Workspace identity and root, Session identity and metadata, native
237
+ Project/Session lists, messages, prompts, transcripts, and history. The plugin does not copy or
238
+ rewrite any of those values. Its external index lives in the DSH host's plugin data directory or
239
+ an independent sidecar store and may contain only relationship facts such as:
240
+
241
+ - `projectId`, `worktreeId`, and `sessionId`;
242
+ - an absolute Worktree path, branch, and lifecycle state;
243
+ - binding status and schema version.
244
+
245
+ The index is not written into a Project working tree or DSH's raw data directory. It does not
246
+ store a copy of `projectRoot` or any Session content. If the sidecar is unavailable or corrupt,
247
+ the native Project/Session view remains readable and the plugin becomes degraded/read-only; an
248
+ empty index must never overwrite the native DSH lists.
249
+
250
+ Each Session has at most one active Worktree binding, while a Worktree may have multiple bound
251
+ Sessions. Rebinding the same Session to the same Worktree is idempotent; binding it to two active
252
+ Worktrees is a conflict. A Session with no binding, a Main binding, or a detached binding runs
253
+ with the Project root as cwd. An active Worktree binding runs with that Worktree path. The cwd is
254
+ derived for each execution and is never persisted back into DSH Session metadata.
255
+
256
+ Worktree creation creates the Git Worktree before recording its external relationship. If the
257
+ sidecar write fails, the new Git Worktree is cleaned up when possible. A failed Worktree deletion
258
+ does not change the sidecar state, so the relationship remains retryable. Session creation uses
259
+ the native DSH API before binding; a binding failure never deletes or modifies the already-created
260
+ Session.
261
+
262
+ The rc.8 `session.create` API cannot receive `workspaceId` and an independent cwd together. The
263
+ Worktree flow therefore uses a browser-local membership projection rather than a persistent DSH
264
+ attach, and it does not modify DSH source, Session metadata, or native Workspace storage. The
265
+ projection is replayed after native list refreshes and removed when the binding disappears or the
266
+ Client is disposed.
267
+
268
+ The blank Hero context is visual only. Because rc.8 has no additive Hero headline slot, its
269
+ placement depends on the native `[data-phase="hero"]` and title anchors; it disappears when those
270
+ anchors are unavailable and should move to a formal DSH slot when one exists.
271
+
272
+ ## Development and verification
273
+
274
+ From the workspace root:
150
275
 
151
276
  ```bash
277
+ cd /path/to/clutch-dsh
152
278
  pnpm install
153
279
  pnpm run check:workspace
154
280
  pnpm run check:patches
@@ -157,23 +283,37 @@ pnpm --filter @cerbur/clutch-dsh-worktree build
157
283
  pnpm --filter @cerbur/clutch-dsh-worktree test
158
284
  ```
159
285
 
160
- 完整 workspace 校验:
286
+ For the bilingual README contract and formatting:
287
+
288
+ ```bash
289
+ cd /path/to/clutch-dsh/packages/clutch-dsh-worktree
290
+ node --test test/readme-parity.test.mjs
291
+ pnpm exec prettier --check README.md README.zh.md test/readme-parity.test.mjs
292
+ ```
293
+
294
+ The full workspace check is:
161
295
 
162
296
  ```bash
297
+ cd /path/to/clutch-dsh
163
298
  pnpm run check
164
299
  ```
165
300
 
166
- 维护者请先阅读 [AGENTS.md](AGENTS.md) 了解数据边界、模块权责、生命周期和验证约束;发布流程见 [`docs/RELEASING.md`](docs/RELEASING.md);浏览器 Consumer 的实现说明位于 [`src/client/README.md`](src/client/README.md)
301
+ Do not commit generated `lib/`, coverage, sidecar data, or local credentials. See [AGENTS.md](AGENTS.md)
302
+ for package data boundaries and lifecycle rules, [docs/RELEASING.md](docs/RELEASING.md) for
303
+ version and installation-source details, and [src/client/README.md](src/client/README.md) for
304
+ the browser Consumer boundary.
167
305
 
168
- ## 插件市场条目建议
306
+ ## Marketplace description
169
307
 
170
- `awesome-dsh-plugin` 提交时,建议使用 `git` 分类,并保持描述与实际代码一致:
308
+ When submitting to `awesome-dsh-plugin`, use the `git` category and keep the description aligned
309
+ with the package:
171
310
 
172
311
  ```yaml
173
312
  category: git
174
313
  description:
175
314
  en: Adds a Worktree view to DSH Web UI that groups Sessions by Git worktree while keeping DSH as the source of truth.
176
- zh: 为 DSH Web UI 增加按 Git Worktree 组织 Session 的视角,同时继续由 DSH 管理原始 Project 和 Session 数据。
315
+ zh: 为 DSH Web UI 增加按 Git Worktree 组织 Session 的视角,同时继续由 DSH 管理原始 Project/Workspace 和 Session 数据。
177
316
  ```
178
317
 
179
- 市场投稿还需要在外部仓库中确认 `dsh-plugin` topic、仓库年龄和提交数;这些不是 package README 可以代替设置的内容。
318
+ Marketplace submission also requires external checks such as the `dsh-plugin` topic, repository
319
+ age, and commit count. A package README cannot set those external properties.