@cerbur/clutch-dsh-worktree 0.1.3 → 0.1.5

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