dsh-code-server-app 0.1.27 → 0.1.31
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.en.md +64 -29
- package/README.md +60 -28
- package/lib/client.js +3 -3
- package/lib/index.js +1 -1
- package/package.json +5 -5
- package/scripts/setup-code-server.mjs +10 -7
package/README.en.md
CHANGED
|
@@ -10,7 +10,22 @@
|
|
|
10
10
|
> - Microsoft **open-source** extensions (Python, TypeScript debugger, ESLint, …) are mirrored on Open VSX and install normally by search;
|
|
11
11
|
> - **If you need a proprietary Microsoft extension**: download the `.vsix` from the Marketplace page and install it manually with `code-server --install-extension <file>` (or drop it into `--extensions-dir`).
|
|
12
12
|
|
|
13
|
-
A static profile plugin (npm package with host + client bundle) that
|
|
13
|
+
A static profile plugin (npm package with host + client bundle) that installs the latest [code-server](https://github.com/coder/code-server) **on demand into a dedicated profile directory** (installing the plugin itself is script-free and does not install code-server), auto-discovered and used on startup — no global npm install, no `bin` configuration.
|
|
14
|
+
|
|
15
|
+
## UI carrier (chosen by the DSH version, feature-detected at runtime)
|
|
16
|
+
|
|
17
|
+
| DSH version | Carrier | Entry points |
|
|
18
|
+
|---|---|---|
|
|
19
|
+
| **>= 0.1.5-alpha.1** (has `sidebarRight` / `sidebarRightTabs`) | **Right-sidebar tab** (kind `code-server`, chip `Code Server`); the floating window is **no longer used** | ① the **Code Server box** on the sidebar's guide ("开始") page; ② the icon button beside each turn's artifacts; ③ Settings → Plugins → Code Server → **"Open in right sidebar"** |
|
|
20
|
+
| older (no sidebar service) | floating ball + internal floating window (unchanged) | the bottom-right floating ball |
|
|
21
|
+
|
|
22
|
+
- Detection: `ctx.inject(['sidebarRightTabs','sidebarRight'], …)` registers the tab type only when the services are ready; if they never appear (or registration fails) nothing is registered and the floating ball fallback stays in place. No version comparison, and the plugin's own activation is never blocked.
|
|
23
|
+
- The sidebar tab hosts the code-server page (iframe) and follows the current session workspace; the panel can be collapsed/split/floated/fullscreened by DSH's right sidebar.
|
|
24
|
+
- **Known trade-off**: DSH renders only the active tab's body, so switching away and back remounts the iframe (a full code-server reload; unsaved editor buffers are lost). Float the tab into its own panel or keep it active for long-running sessions.
|
|
25
|
+
- In sidebar mode the settings card hides "Reserve space above the composer" (floating-window geometry only). "Open in a window (new tab)" still applies to every entry point.
|
|
26
|
+
- `windowedOpen` has the highest priority: when on, entry buttons always open a browser tab.
|
|
27
|
+
|
|
28
|
+
## Floating ball / window (legacy-DSH fallback path only)
|
|
14
29
|
|
|
15
30
|
- **Floating ball** (bottom-right, official code-server icon, above the composer): click to **expand the floating window and light it up** (blue glow), click again to **collapse**; **drag to any position** (remembered across refreshes; no accidental click after drag);
|
|
16
31
|
no sidebar button, no window control button group (the ball is the only entry/toggle); the ball carries a status dot (green = running / amber = starting / red = error);
|
|
@@ -29,12 +44,12 @@ A static profile plugin (npm package with host + client bundle) that ships the l
|
|
|
29
44
|
while `file:///C:/...` reports "Workspace does not exist".
|
|
30
45
|
- Process lifecycle is managed by the host plugin: startup writes `$DSH_HOME/code-server/pid.json`, stop kills the tree (`taskkill /T` or process-group SIGKILL),
|
|
31
46
|
crash/exit updates status live; after a DSH host restart the plugin **adopts** a still-running instance (verifies pid + `/healthz`), without duplicate start or killing unrelated processes;
|
|
32
|
-
- `node_modules` (dependencies, including code-server) is git-ignored; after cloning, follow "Install plugin (code-server
|
|
47
|
+
- `node_modules` (dependencies, including code-server) is git-ignored; after cloning, follow "Install the plugin (script-free install; code-server installed on demand)" below — `pnpm pack` + `dsh plugin --profile web add`.
|
|
33
48
|
|
|
34
49
|
> Verified locally (BM: Windows 11 ARM64): `code-server@4.134.0` (with Code 1.135.0)
|
|
35
50
|
> shipped with the plugin, auto-discovered → started → healthz 200 → cwd switch restart while running → stopped → fully recycled.
|
|
36
51
|
|
|
37
|
-
## Install the plugin (code-server
|
|
52
|
+
## Install the plugin (script-free install; code-server installed on demand)
|
|
38
53
|
|
|
39
54
|
```powershell
|
|
40
55
|
# 1) Pack (in the plugin workspace)
|
|
@@ -43,34 +58,47 @@ cd C:\Users\User\Desktop\dsh-code-server-app
|
|
|
43
58
|
pnpm install # esbuild + motion (pack only)
|
|
44
59
|
pnpm run build:client # src/factory.js → lib/client.js
|
|
45
60
|
pnpm pack
|
|
46
|
-
|
|
47
|
-
# 2) One-time: approve the plugin postinstall (pnpm only honors the host root config)
|
|
48
|
-
cd C:\Users\User\.dsh\profiles\web
|
|
49
|
-
pnpm approve-builds dsh-code-server-app # interactive 'yes'; if it fails, edit pnpm-workspace.yaml manually
|
|
50
61
|
```
|
|
51
62
|
|
|
52
|
-
> If `approve-builds` rejects the `file:` spec (unknown), set the `dsh-code-server-app@file:...tgz` entry
|
|
53
|
-
> in `pnpm-workspace.yaml`'s `allowBuilds` to `true` (equivalent to interactive approval, once only).
|
|
54
|
-
|
|
55
63
|
```powershell
|
|
56
|
-
#
|
|
57
|
-
dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app\dsh-code-server-app-0.1.
|
|
64
|
+
# 2) Install (published tarball; the plugin has no postinstall → no pnpm approve-builds / allowBuilds needed)
|
|
65
|
+
dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app\dsh-code-server-app-0.1.31.tgz
|
|
58
66
|
```
|
|
59
67
|
|
|
68
|
+
> Installation only drops plugin files: **no package scripts run and code-server is not installed**
|
|
69
|
+
> (pnpm prints no build-scripts approval prompt). code-server is installed **on first use**: the startup
|
|
70
|
+
> install-guide modal's "Install" button, Settings → Plugins → Code Server → "Install environment",
|
|
71
|
+
> or manually `node <plugin-dir>\scripts\setup-code-server.mjs` (`npm run setup:code-server`).
|
|
72
|
+
|
|
60
73
|
### Install mechanism
|
|
61
74
|
|
|
62
|
-
- **
|
|
63
|
-
|
|
64
|
-
|
|
75
|
+
- **Script-free install**: `package.json` has no `postinstall`, so pnpm runs no package script while
|
|
76
|
+
installing the plugin (no `pnpm approve-builds` / `allowBuilds` approval needed) and does not install code-server;
|
|
77
|
+
- **code-server is not in `dependencies`** (pnpm never touches it; no script-approval issues); instead
|
|
78
|
+
`scripts/setup-code-server.mjs` installs **the latest** `code-server` **with npm into a dedicated profile
|
|
79
|
+
directory** on demand (version not pinned; npm `latest` is used at install time):
|
|
80
|
+
- Triggers: host `POST /code-server/setup` (startup guide modal "Install" / settings card "Install environment"),
|
|
81
|
+
or manually `npm run setup:code-server`;
|
|
65
82
|
- Install root: `<profile>\.code-server-app` (e.g. `C:\Users\User\.dsh\profiles\web\.code-server-app`),
|
|
66
83
|
a standalone project isolated from the profile dependency tree (avoids ERESOLVE);
|
|
67
84
|
- The install root carries its own `package.json` with `allowScripts`: `code-server: false` (skips the official `sh ./postinstall.sh`
|
|
68
85
|
— Windows has no `sh`, it would fail; `argon2/unrs-resolver: true` builds native modules; both without version pins);
|
|
69
86
|
- Afterwards it installs VS Code internal dependencies (144 packages) + `bin\code-server.cmd`;
|
|
70
87
|
- **code-server lands at** `<profile>\.code-server-app\node_modules\code-server\`;
|
|
71
|
-
idempotent and self-healing (
|
|
72
|
-
**
|
|
73
|
-
- **Pin a version**: set the env var `DSHCS_CODE_SERVER_VERSION` (e.g. `4.134.0`)
|
|
88
|
+
idempotent and self-healing (every on-demand run checks first: skips when instantiated and equal to npm latest;
|
|
89
|
+
**auto-upgrades when the installed version differs**).
|
|
90
|
+
- **Pin a version**: set the env var `DSHCS_CODE_SERVER_VERSION` (it must be visible to the **process that runs setup** — the `dsh web` process for UI-triggered installs; e.g. `4.134.0`); unset it to follow latest.
|
|
91
|
+
- **Why no install-time setup**: installation stays fast and succeeds even without a C++ toolchain (a missing
|
|
92
|
+
toolchain surfaces later in the "Install" flow, with logs in the top banner and the settings card); code-server
|
|
93
|
+
upgrades now happen only during on-demand installs and **no longer on every plugin reinstall**.
|
|
94
|
+
|
|
95
|
+
> **Migration note when upgrading from ≤ 0.1.28**: the old plugin shipped a `postinstall`, so the profile's
|
|
96
|
+
> `pnpm-workspace.yaml` may still carry `allowBuilds: dsh-code-server-app@file:...<old version>.tgz: true`
|
|
97
|
+
> entries and pnpm 11 may have recorded an `ignoredBuilds` entry in `node_modules/.modules.yaml` — after which
|
|
98
|
+
> every install reports `[ERR_PNPM_IGNORED_BUILDS] Ignored build scripts: dsh-code-server-app@file:...`
|
|
99
|
+
> even though the new version has no install scripts at all. Fix: collapse those entries in the profile's
|
|
100
|
+
> `pnpm-workspace.yaml` into a single `dsh-code-server-app: false` ("never build") and re-run the install;
|
|
101
|
+
> this machine's 0.1.29 upgrade already performed that migration.
|
|
74
102
|
|
|
75
103
|
> **Uninstall**: the code-server directory is independent of the plugin package — first
|
|
76
104
|
> `Remove-Item -Recurse -Force <profile>\.code-server-app`, then `dsh plugin --profile web remove dsh-code-server-app`.
|
|
@@ -84,8 +112,10 @@ dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app\dsh-code-
|
|
|
84
112
|
dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app
|
|
85
113
|
```
|
|
86
114
|
|
|
87
|
-
> A source path installs via `link:`;
|
|
88
|
-
>
|
|
115
|
+
> A source path installs via `link:`; when the profile layout is unavailable, the host's
|
|
116
|
+
> `scripts/setup-code-server.mjs` falls back to installing code-server into the **plugin workspace node_modules**
|
|
117
|
+
> (the host supports both layouts). The install itself runs no scripts; on first use click "Install" or run
|
|
118
|
+
> `npm run setup:code-server` manually.
|
|
89
119
|
>
|
|
90
120
|
> **Changing the client bundle**: edit `src/factory.js` then run `pnpm run build:client`
|
|
91
121
|
> to regenerate `lib/client.js` (that artifact is not tracked; a browser refresh picks it up — no host restart needed).
|
|
@@ -93,7 +123,7 @@ dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app
|
|
|
93
123
|
|
|
94
124
|
### Environment requirements (packages that need building + toolchain)
|
|
95
125
|
|
|
96
|
-
During
|
|
126
|
+
During the on-demand install (`scripts/setup-code-server.mjs` → npm self-installs code-server + VS Code internal deps), **only one package really needs local compilation** (installing the plugin itself needs no toolchain):
|
|
97
127
|
|
|
98
128
|
| Package | Build method | ARM64 local compile | x64 local compile |
|
|
99
129
|
|---|---|---|---|
|
|
@@ -123,15 +153,17 @@ During installation (`postinstall` → `scripts/setup-code-server.mjs` → npm s
|
|
|
123
153
|
- **VS needs the Spectre-mitigated libraries** (MSB8040): Visual Studio Installer → Individual components →
|
|
124
154
|
"MSVC v18x Spectre-mitigated libraries for ARM64" (same for x86/x64).
|
|
125
155
|
- **node-gyp 13.x** (9.x does not recognize VS 2026): `npm install -g node-gyp@latest`.
|
|
126
|
-
- Latest code-server requires **Node v24** (
|
|
156
|
+
- Latest code-server requires **Node v24** (v24.13.1 verified here; a lower version fails at startup).
|
|
127
157
|
- If you don't need the self-contained install (e.g. a global code-server already exists), skip it:
|
|
128
158
|
the plugin falls back to a configured/PATH `bin` (see the "Config" table).
|
|
129
159
|
|
|
130
160
|
### Upgrading the code-server version
|
|
131
161
|
|
|
132
|
-
- **Automatic by default**:
|
|
133
|
-
- **
|
|
134
|
-
|
|
162
|
+
- **Automatic by default**: the script does not pin the version — during an on-demand install, if the installed version differs from npm latest it reinstalls to latest (no manual edits).
|
|
163
|
+
- **How to trigger**: Settings → Plugins → Code Server → "Install environment", or `npm run setup:code-server`;
|
|
164
|
+
**it no longer upgrades on plugin reinstall** (reinstalling the plugin neither installs nor upgrades code-server).
|
|
165
|
+
- **To pin**: set the env var `DSHCS_CODE_SERVER_VERSION` (e.g. `4.134.0`; must be in the `dsh web` process environment); unset it to follow latest again.
|
|
166
|
+
- Measured locally: installed `4.135.0`, npm latest `4.136.2` — the next on-demand install will upgrade to `4.136.2`.
|
|
135
167
|
|
|
136
168
|
### Compatibility with the old runtime-directory install
|
|
137
169
|
|
|
@@ -146,8 +178,8 @@ persisted via the official settings domain (`settingsScope`, namespace `code-ser
|
|
|
146
178
|
|
|
147
179
|
| Key | Default | Description |
|
|
148
180
|
|---|---|---|
|
|
149
|
-
| `reserveComposer` | `true` | Whether the window **reserves space above the composer**: on, the window's initial/drag/resize/maximize stop above the composer (never covers it); off, it may cover the composer (maximize to viewport bottom) |
|
|
150
|
-
| `windowedOpen` | `false` | **Open in a window**: on,
|
|
181
|
+
| `reserveComposer` | `true` | Whether the window **reserves space above the composer**: on, the window's initial/drag/resize/maximize stop above the composer (never covers it); off, it may cover the composer (maximize to viewport bottom). **Applies to the legacy floating window only** — hidden in sidebar mode |
|
|
182
|
+
| `windowedOpen` | `false` | **Open in a window**: on, every entry point (artifact button / settings card / floating ball) opens code-server in a browser **new tab** (auto-starts and follows the active workspace); off (default) uses the right-sidebar tab (or the internal floating window on older DSH) |
|
|
151
183
|
|
|
152
184
|
> Card changes take effect immediately via `scope.watch` (the host status API returns `reserveComposer` and
|
|
153
185
|
> `windowedOpen`; the client applies them at once); no dsh restart needed. **After adding new setting keys, restart dsh web before first use**,
|
|
@@ -189,7 +221,9 @@ User-level override example (write in `$DSH_HOME/profiles/web/cordis.patch.yml`,
|
|
|
189
221
|
## Artifact open buttons
|
|
190
222
|
|
|
191
223
|
Each produced file (written/edited) in a turn is shown as a chip with a **code-server icon button** next to it
|
|
192
|
-
in the conversation's turn tail; clicking either opens the file in code-server
|
|
224
|
+
in the conversation's turn tail; clicking either opens the file in code-server — in the right-sidebar tab on
|
|
225
|
+
DSH >= 0.1.5-alpha.1 (opening/expanding the column and focusing the tab), or in the floating window on older hosts
|
|
226
|
+
(when `windowedOpen` is on, both open a browser tab instead).
|
|
193
227
|
The `dshcs-open-file` extension is installed as a **built-in** extension of code-server (in `lib/vscode/extensions`),
|
|
194
228
|
so users cannot remove it from the extensions panel.
|
|
195
229
|
|
|
@@ -197,6 +231,7 @@ so users cannot remove it from the extensions panel.
|
|
|
197
231
|
|
|
198
232
|
- **No sub-path**: the code-server front-end uses root paths/WebSocket/Service Worker, so it must be a direct iframe on its own port;
|
|
199
233
|
no DSH webServer reverse proxy; `--base-path` is not officially supported.
|
|
200
|
-
- **Single instance across sessions**: one shared code-server per host; switching cwd requires a restart (the
|
|
234
|
+
- **Single instance across sessions**: one shared code-server per host; switching cwd requires a restart (the sidebar tab / floating window handles it and hints).
|
|
235
|
+
- **Sidebar tab switching reloads**: DSH's right sidebar renders only the active tab's body, so switching away and back remounts the iframe (a full code-server reload); keep the tab active or float it for long-running sessions.
|
|
201
236
|
- **Remote access**: default is loopback + no auth. Cross-machine access requires `host` + `auth: password` + `passwordToken`,
|
|
202
237
|
and the browser must be able to reach that host directly (the plugin's "open in new tab" builds the URL from `host:port`).
|
package/README.md
CHANGED
|
@@ -11,9 +11,27 @@
|
|
|
11
11
|
> - **需要微软专有扩展时**:从 Marketplace 网页下载 `.vsix`,用 `code-server --install-extension <文件>`(或放入 `--extensions-dir`)手动安装,即可在插件列表使用。
|
|
12
12
|
|
|
13
13
|
静态 profile 插件(npm 包形态,host + client bundle),把最新版 [code-server](https://github.com/coder/code-server)
|
|
14
|
-
|
|
14
|
+
**按需安装到 profile 专用目录**(安装插件本身零脚本、不装 code-server),插件启动时自动发现并使用它,
|
|
15
15
|
无需全局 npm 安装、无需配置 `bin`。
|
|
16
16
|
|
|
17
|
+
## UI 载体(DSH 版本决定,运行时特性检测)
|
|
18
|
+
|
|
19
|
+
| DSH 版本 | 载体 | 入口 |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| **≥ 0.1.5-alpha.1**(有 `sidebarRight` / `sidebarRightTabs` 服务) | **右侧栏标签**(kind=`code-server`,标签名 `Code Server`),**不再使用悬浮窗** | ① 右侧栏「开始」页的 **Code Server 入口框**;② 每轮产物旁的图标按钮;③ 设置 → 插件 → Code Server → **「在右侧栏打开」** |
|
|
22
|
+
| 更早(无右侧栏服务) | 悬浮球 + 内部浮动窗口(与旧版一致) | 右下角悬浮球 |
|
|
23
|
+
|
|
24
|
+
- 检测方式:`ctx.inject(['sidebarRightTabs','sidebarRight'], …)`——服务就绪才注册标签类型;
|
|
25
|
+
服务缺失/注册失败则整段不生效,自动回退悬浮球(不按版本号硬判,也不影响插件激活)。
|
|
26
|
+
- 侧栏标签内即 code-server 页面(iframe),跟随当前会话工作区;面板可折叠/分屏/浮动/全屏(由 DSH 右侧栏提供)。
|
|
27
|
+
- **已知取舍**:DSH 只渲染「当前激活标签」的 body,切到别的标签再切回会重挂 iframe
|
|
28
|
+
(code-server 整页重载,未保存的编辑缓冲区会丢);需要长驻会话时请把该标签**浮动**出来或保持激活。
|
|
29
|
+
- 设置卡片在侧栏模式下隐藏「保留输入框上方空间」(只对浮窗有意义);
|
|
30
|
+
「窗口化打开(新标签页)」仍然生效(开启后各入口改为浏览器新标签页打开)。
|
|
31
|
+
- `windowedOpen` 优先级最高:开启时入口按钮一律新开浏览器标签页。
|
|
32
|
+
|
|
33
|
+
## 悬浮球 / 浮窗(仅旧版 DSH 回退路径)
|
|
34
|
+
|
|
17
35
|
- **右下角悬浮球**(code-server 官方图标,输入框上方):点击**展开浮窗并亮起**(蓝色光环),再点击**收起并复原**;
|
|
18
36
|
**可按住拖动到任意位置**(松手后记忆,刷新不丢;拖完不会误触发点击);
|
|
19
37
|
无侧栏按钮、无窗口控制按钮组(球是唯一入口/开关);球上带运行状态点(绿=运行 / 黄=启动中 / 红=错误);
|
|
@@ -22,7 +40,7 @@
|
|
|
22
40
|
**最大化后按住顶部细条向下拖 = 恢复**并继续跟手拖动)、双击最大化、8 向缩放、Esc 关闭(与球收起等效),
|
|
23
41
|
初始位置在输入框上方靠右,最大化与缩放都止于输入栏上方,不遮挡 composer;
|
|
24
42
|
- 窗口内直接是 code-server 页面(iframe);未运行/启动失败时显示状态说明与错误信息;
|
|
25
|
-
- code-server
|
|
43
|
+
- code-server 服务目录**跟随活动工作区/会话**:打开期间切换 DSH 会话/工作区,code-server 自动重启到新目录
|
|
26
44
|
(解析优先级:当前会话 cwd → 会话所属 workspace.path → recentWorkspace.path → 首个 workspace.path);
|
|
27
45
|
打开目录显示在 code-server 页面内(`?folder=<cwd>`,跟随切换时页面自动重新加载);
|
|
28
46
|
实现要点:iframe src 必须带 `?folder=<cwd>`——code-server 前端会记住“最近工作区”并自行恢复,
|
|
@@ -33,12 +51,12 @@
|
|
|
33
51
|
- process 生命周期由 host 插件管理:启动写 `$DSH_HOME/code-server/pid.json`,停止树级终止(taskkill /T 或进程组 SIGKILL),
|
|
34
52
|
崩溃/退出实时更新状态;DSH host 重启后自动 adopt 仍在运行的实例(校验 pid + /healthz),不重复启动、不误杀别的进程;
|
|
35
53
|
- `node_modules`(依赖,含 code-server)已被 `.gitignore` 排除,推送/克隆仓库后按下方
|
|
36
|
-
"安装插件(code-server
|
|
54
|
+
"安装插件(安装期零脚本,code-server 按需安装)"执行 `pnpm pack` + `dsh plugin --profile web add` 即可。
|
|
37
55
|
|
|
38
56
|
> 本机(BM: Windows 11 ARM64)实测:`code-server@4.134.0`(with Code 1.135.0)
|
|
39
57
|
> 随插件依赖安装并完成自动发现 → 启动 → healthz 200 → 运行中切换 cwd 重启 → 停止 → 回收全链路验证。
|
|
40
58
|
|
|
41
|
-
## 安装插件(code-server
|
|
59
|
+
## 安装插件(安装期零脚本,code-server 按需安装)
|
|
42
60
|
|
|
43
61
|
```powershell
|
|
44
62
|
# 1) 打包(在插件工作区)
|
|
@@ -47,34 +65,43 @@ cd C:\Users\User\Desktop\dsh-code-server-app
|
|
|
47
65
|
pnpm install # esbuild + motion(仅打包用)
|
|
48
66
|
pnpm run build:client # src/factory.js → lib/client.js
|
|
49
67
|
pnpm pack
|
|
50
|
-
|
|
51
|
-
# 2) 一次性前置:批准插件 postinstall 许可(pnpm 只认宿主根配置,无包内声明路径)
|
|
52
|
-
cd C:\Users\User\.dsh\profiles\web
|
|
53
|
-
pnpm approve-builds dsh-code-server-app # 交互选 yes;失败时手动编辑 pnpm-workspace.yaml
|
|
54
68
|
```
|
|
55
69
|
|
|
56
|
-
> 若 `approve-builds` 不接受 file: spec(提示 unknown),把 `pnpm-workspace.yaml` 的
|
|
57
|
-
> `allowBuilds` 中 `dsh-code-server-app@file:...tgz`改为 `true`
|
|
58
|
-
> (等价于交互批准,仅此一次;之后安装无需再次处理)。
|
|
59
|
-
|
|
60
70
|
```powershell
|
|
61
|
-
#
|
|
62
|
-
dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app\dsh-code-server-app-0.1.
|
|
71
|
+
# 2) 安装(发布形态 tarball;插件无 postinstall → 无需 pnpm approve-builds / allowBuilds)
|
|
72
|
+
dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app\dsh-code-server-app-0.1.31.tgz
|
|
63
73
|
```
|
|
64
74
|
|
|
75
|
+
> 安装只落插件文件,**不执行任何包脚本、不安装 code-server**(pnpm 不会提示 build scripts 许可)。
|
|
76
|
+
> code-server 在**首次使用时按需安装**:启动安装指引弹窗「开始安装」→ 设置 → 插件 → Code Server
|
|
77
|
+
> → 「安装环境」,或手动 `node <插件目录>\scripts\setup-code-server.mjs`(`npm run setup:code-server`)。
|
|
78
|
+
|
|
65
79
|
### 安装机制
|
|
66
80
|
|
|
67
|
-
-
|
|
68
|
-
-
|
|
81
|
+
- **安装期零脚本**:`package.json` 无 `postinstall`,pnpm 安装插件时不执行任何包脚本
|
|
82
|
+
(无需 `pnpm approve-builds` / `allowBuilds` 批准),也不安装 code-server;
|
|
83
|
+
- **code-server 不在 `dependencies`**(pnpm 不触碰它、无脚本许可问题),改由
|
|
84
|
+
`scripts/setup-code-server.mjs` 在 **profile 专用目录**用 **npm** 按需安装
|
|
69
85
|
**最新版** `code-server`(不锁版本,安装时取 npm latest):
|
|
86
|
+
- 触发方式:host `POST /code-server/setup`(启动安装指引弹窗「开始安装」/ 设置卡片「安装环境」)
|
|
87
|
+
或手动 `npm run setup:code-server`;
|
|
70
88
|
- 安装根:`<profile>\.code-server-app`(如 `C:\Users\User\.dsh\profiles\web\.code-server-app`),
|
|
71
89
|
独立项目,与 profile 依赖树隔离(避开 ERESOLVE);
|
|
72
90
|
- 安装根自带 `package.json`(allowScripts:`code-server: false` 跳过官方 `sh ./postinstall.sh`
|
|
73
91
|
——Windows 无 sh 会失败、`argon2/unrs-resolver: true` native 构建,均不带版本号);
|
|
74
92
|
- 装完补装 VS Code 内部依赖(144 包)+ `bin\code-server.cmd`;
|
|
75
93
|
- **code-server 落在** `<profile>\.code-server-app\node_modules\code-server\`;
|
|
76
|
-
幂等自愈(
|
|
77
|
-
- **锁版本**:设置环境变量 `DSHCS_CODE_SERVER_VERSION`(
|
|
94
|
+
幂等自愈(每次按需调用先检测:已实例化且版本与 npm latest 一致则跳过;**不一致则自动升级到最新**)。
|
|
95
|
+
- **锁版本**:设置环境变量 `DSHCS_CODE_SERVER_VERSION`(需出现在**执行 setup 的进程**环境中,UI 触发即 dsh web 进程)可钉住某个版本(如 `4.134.0`);缺省跟随 npm latest。
|
|
96
|
+
- **为什么安装期不装**:安装快、没有 C++ 工具链也能装成功(缺工具链的失败延后到「开始安装」,错误显示在
|
|
97
|
+
顶部横幅与设置卡片日志);code-server 升级只发生在按需安装时,**不再随每次重装插件自动升级**。
|
|
98
|
+
|
|
99
|
+
> **从旧版本升级的迁移提示(≤ 0.1.28)**:旧版插件带 `postinstall`,profile 的 `pnpm-workspace.yaml`
|
|
100
|
+
> 里曾有 `allowBuilds: dsh-code-server-app@file:...<旧版本>.tgz: true` 条目,pnpm 11 还可能在
|
|
101
|
+
> `node_modules/.modules.yaml` 留下 `ignoredBuilds` 记录——于是每次安装后都会报
|
|
102
|
+
> `[ERR_PNPM_IGNORED_BUILDS] Ignored build scripts: dsh-code-server-app@file:...`(即使新版本已无任何
|
|
103
|
+
> 安装脚本)。处理:把 profile 的 `pnpm-workspace.yaml` 中该包相关条目合并为一条
|
|
104
|
+
> `dsh-code-server-app: false`(显式声明"永不构建"),重跑安装即可;本机 0.1.29 升级已完成该迁移。
|
|
78
105
|
|
|
79
106
|
> **卸载**:code-server 目录独立于插件包——先手动删除
|
|
80
107
|
> `Remove-Item -Recurse -Force <profile>\.code-server-app`,再 `dsh plugin --profile web remove dsh-code-server-app`。
|
|
@@ -88,8 +115,9 @@ dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app\dsh-code-
|
|
|
88
115
|
dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app
|
|
89
116
|
```
|
|
90
117
|
|
|
91
|
-
> 源码路径以 `link:`
|
|
92
|
-
>
|
|
118
|
+
> 源码路径以 `link:` 安装;host 的 `scripts/setup-code-server.mjs` 在 profile 布局不可用时回退把
|
|
119
|
+
> code-server 装到**插件工作区 node_modules**(两种布局 host 都支持)。
|
|
120
|
+
> 安装本身不跑脚本,首次使用需点「开始安装」或手动 `npm run setup:code-server`。
|
|
93
121
|
>
|
|
94
122
|
> **改动 client bundle**:编辑 `src/factory.js` 后执行 `pnpm run build:client`
|
|
95
123
|
> 重新生成 `lib/client.js`(仓库不跟踪该产物;浏览器刷新即生效,host 无需重启)。
|
|
@@ -97,7 +125,7 @@ dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app
|
|
|
97
125
|
|
|
98
126
|
### 安装环境要求(需要编译的包与工具链)
|
|
99
127
|
|
|
100
|
-
|
|
128
|
+
按需安装过程(`scripts/setup-code-server.mjs` → npm 自装 code-server + VS Code 内部依赖)中,**真正需要本地编译的只有一个包**(安装插件本身不需要任何工具链):
|
|
101
129
|
|
|
102
130
|
| 包 | 构建方式 | ARM64 本地编译 | x64 本地编译 |
|
|
103
131
|
|---|---|---|---|
|
|
@@ -127,15 +155,17 @@ dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app
|
|
|
127
155
|
- **VS 需 Spectre 缓解库组件**(MSB8040):Visual Studio Installer → 单个组件 →
|
|
128
156
|
"适用于 ARM64 的 MSVC v18x Spectre-mitigated 库"(x86/x64 同理)。
|
|
129
157
|
- **node-gyp 13.x**(旧版 9.x 不识别 VS 2026):`npm install -g node-gyp@latest`。
|
|
130
|
-
- code-server 最新版要求 **Node v24**(
|
|
158
|
+
- code-server 最新版要求 **Node v24**(本机 v24.13.1 通过;版本不足时启动会报错)。
|
|
131
159
|
- 若不需要插件自足(例如已有全局 code-server),可跳过安装:
|
|
132
160
|
插件会回退到 PATH/配置的 `bin`(见"配置"表)。
|
|
133
161
|
|
|
134
162
|
### 升级 code-server 版本
|
|
135
163
|
|
|
136
|
-
-
|
|
137
|
-
-
|
|
138
|
-
|
|
164
|
+
- **默认自动**:脚本不锁版本——按需安装时若已装版本与 npm latest 不一致则自动重装到最新(无需手动改)。
|
|
165
|
+
- **触发检查**:设置 → 插件 → Code Server → 「安装环境」,或手动 `npm run setup:code-server`;
|
|
166
|
+
**不再随插件重装自动升级**(重装插件本身不安装/升级 code-server)。
|
|
167
|
+
- **想钉住版本**:设环境变量 `DSHCS_CODE_SERVER_VERSION`(如 `4.134.0`;需在 dsh web 进程环境中);去掉它回到跟随 latest。
|
|
168
|
+
- 本机当前实测:已装 `4.135.0`,npm latest `4.136.2`——下次按需安装会升级到 `4.136.2`。
|
|
139
169
|
|
|
140
170
|
### 兼容旧的 runtime 目录安装
|
|
141
171
|
|
|
@@ -150,8 +180,8 @@ host 探测顺序:`<profile>\.code-server-app`(专用目录)> 插件包内 `node
|
|
|
150
180
|
|
|
151
181
|
| 键 | 默认 | 说明 |
|
|
152
182
|
|---|---|---|
|
|
153
|
-
| `reserveComposer` | `true` | 窗口是否**保留输入框上方空间**:开启时窗口初始/拖动/缩放/最大化都止于输入栏上方(不遮挡 composer);关闭后允许盖住输入框(最大化到视口底) |
|
|
154
|
-
| `windowedOpen` | `false` |
|
|
183
|
+
| `reserveComposer` | `true` | 窗口是否**保留输入框上方空间**:开启时窗口初始/拖动/缩放/最大化都止于输入栏上方(不遮挡 composer);关闭后允许盖住输入框(最大化到视口底)。**仅对旧版 DSH 的浮窗生效**——右侧栏模式下该行隐藏 |
|
|
184
|
+
| `windowedOpen` | `false` | **窗口化打开**:开启后各入口(产物按钮 / 设置卡 / 悬浮球)在浏览器**新标签页**打开 code-server(自动启动并跟随当前工作区目录);关闭(默认)使用右侧栏标签(旧版 DSH 为内部浮动窗口) |
|
|
155
185
|
|
|
156
186
|
> 卡片改动经 `scope.watch` 实时生效(host 端 status API 同步返回 `reserveComposer` 与
|
|
157
187
|
> `windowedOpen`,客户端立即生效);无需重启 dsh。**新增设置键后首次使用前需重启 dsh web**,
|
|
@@ -193,6 +223,8 @@ host 探测顺序:`<profile>\.code-server-app`(专用目录)> 插件包内 `node
|
|
|
193
223
|
|
|
194
224
|
- **子路径不支持**:code-server 前端使用根路径/WebSocket/Service Worker,因此必须独立端口
|
|
195
225
|
iframe 直连,不做 DSH webServer 反向代理;`--base-path` 官方不支持。
|
|
196
|
-
- **跨会话单实例**:host 级共享一份 code-server;切换 cwd 需重启实例(
|
|
226
|
+
- **跨会话单实例**:host 级共享一份 code-server;切换 cwd 需重启实例(右侧栏标签/浮窗自动处理并提示)。
|
|
227
|
+
- **侧栏标签切换重载**:DSH 右侧栏只渲染当前激活标签的 body,切走再切回会重挂 iframe(code-server 整页重载);
|
|
228
|
+
长驻会话请保持该标签激活或将其浮动为独立面板。
|
|
197
229
|
- **远程访问**:默认仅回环 + 无认证。跨机访问需改 `host` + `auth: password` + `passwordToken`,
|
|
198
230
|
且浏览器必须能直接到达该主机(本插件的“在新标签打开”按 `host:port` 拼 URL)。
|