dsh-better-sidebar 0.10.1 → 0.10.3
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 +100 -23
- package/README_EN.md +100 -23
- package/cordis.patch.yml +19 -0
- package/lib/client-docx.js +154 -154
- package/lib/client-editor.js +152 -152
- package/lib/client-pptx.js +154 -154
- package/lib/client-registry.js +230 -217
- package/lib/client-terminal.js +154 -154
- package/lib/client-xlsx.js +152 -152
- package/lib/client.js +228 -215
- package/lib/types/client/intercept.d.ts +14 -1
- package/package.json +17 -12
- package/scripts/install.ps1 +242 -0
- package/scripts/install.sh +171 -60
- package/src/client/Sidebar.tsx +15 -11
- package/src/client/intercept.tsx +16 -3
- package/src/client/layout.css +19 -14
package/README.md
CHANGED
|
@@ -35,42 +35,116 @@ https://github.com/user-attachments/assets/23187822-047e-45cc-b480-fe997bd55b86
|
|
|
35
35
|
|
|
36
36
|
## 🚀 安装
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
**前置**:已装好 DSH(`dsh web` 能正常运行),Node.js ≥ 20、pnpm ≥ 10。
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
**macOS / Linux**(Windows 装了 Git Bash 或 WSL 也可):
|
|
41
41
|
|
|
42
42
|
```sh
|
|
43
43
|
curl -fsSL https://raw.githubusercontent.com/omdsh-dev/DSH-better-sidebar/main/scripts/install.sh | bash
|
|
44
|
-
# 指定版本: curl -fsSL <同上> | bash -s 0.10.1
|
|
45
|
-
# 装完自动重启 DSH: curl -fsSL <同上> | bash -s -- --restart
|
|
46
44
|
```
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
**Windows(PowerShell 5.1+ / pwsh)**:
|
|
49
47
|
|
|
50
|
-
|
|
48
|
+
```powershell
|
|
49
|
+
irm https://raw.githubusercontent.com/omdsh-dev/DSH-better-sidebar/main/scripts/install.ps1 | iex
|
|
50
|
+
```
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
装完**重启 DSH 并硬刷新**(Cmd/Ctrl+Shift+R)即可看到侧边栏。
|
|
53
|
+
|
|
54
|
+
<details>
|
|
55
|
+
<summary><b>指定版本 / 装完自动重启(可选)</b></summary>
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
# macOS / Linux
|
|
59
|
+
curl -fsSL https://raw.githubusercontent.com/omdsh-dev/DSH-better-sidebar/main/scripts/install.sh | bash -s 0.10.3 --restart
|
|
60
|
+
|
|
61
|
+
# Windows PowerShell
|
|
62
|
+
& ([scriptblock]::Create((irm 'https://raw.githubusercontent.com/omdsh-dev/DSH-better-sidebar/main/scripts/install.ps1'))) -Version 0.10.3 -Restart
|
|
60
63
|
```
|
|
61
64
|
|
|
62
|
-
|
|
65
|
+
不确定的话,可先加 `--dry-run`(PowerShell 用 `-DryRun`)预览步骤再执行。
|
|
63
66
|
|
|
64
|
-
>
|
|
67
|
+
</details>
|
|
65
68
|
|
|
66
|
-
|
|
69
|
+
<details>
|
|
70
|
+
<summary><b>手动安装(逐步命令,想看清每一步)</b></summary>
|
|
67
71
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
与一键脚本等价。**第 ③ 步可重复执行;①② 只需做一次。**
|
|
73
|
+
|
|
74
|
+
**macOS / Linux(bash)**:
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
cd ~/.dsh/profiles/web
|
|
78
|
+
|
|
79
|
+
# ① 放行 node-pty / protobufjs 的构建脚本(pnpm 11 默认拦截;pnpm 10 可跳过)
|
|
80
|
+
pnpm approve-builds --all
|
|
81
|
+
|
|
82
|
+
# ② 放行「发布不足 24h」的新版本(装老版本可跳过;若已有该键,把下面那行并入其下即可)
|
|
83
|
+
cat >> pnpm-workspace.yaml <<'EOF'
|
|
84
|
+
minimumReleaseAgeExclude:
|
|
85
|
+
- dsh-better-sidebar
|
|
86
|
+
EOF
|
|
87
|
+
|
|
88
|
+
# ③ 安装并自动挂载(不带 @版本 = npm 的 latest;固定版本写 dsh-better-sidebar@0.10.3)
|
|
89
|
+
npx -y --package @deepseek-ai/dsh dsh plugin --profile web add dsh-better-sidebar
|
|
72
90
|
```
|
|
73
91
|
|
|
92
|
+
**Windows(PowerShell)**:
|
|
93
|
+
|
|
94
|
+
```powershell
|
|
95
|
+
cd ~\.dsh\profiles\web
|
|
96
|
+
|
|
97
|
+
# ① 放行构建脚本
|
|
98
|
+
pnpm approve-builds --all
|
|
99
|
+
|
|
100
|
+
# ② 放行新版本(一次性;若已有该键,把 - dsh-better-sidebar 并入其下即可)
|
|
101
|
+
Add-Content -Path pnpm-workspace.yaml -Value "`nminimumReleaseAgeExclude:`n - dsh-better-sidebar"
|
|
102
|
+
|
|
103
|
+
# ③ 安装并自动挂载
|
|
104
|
+
npx -y --package @deepseek-ai/dsh dsh plugin --profile web add dsh-better-sidebar
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
</details>
|
|
108
|
+
|
|
109
|
+
<details>
|
|
110
|
+
<summary><b>脚本内部做了什么(技术细节)</b></summary>
|
|
111
|
+
|
|
112
|
+
一键脚本自动完成 4 件事(全部幂等,可安全重复执行):
|
|
113
|
+
|
|
114
|
+
1. 预写 `allowBuilds`(node-pty / protobufjs),规避 pnpm 11 的构建脚本拦截;
|
|
115
|
+
2. 预写 `minimumReleaseAgeExclude`,放行「发布不足 24 小时」的新版本;
|
|
116
|
+
3. 执行 `dsh plugin --profile web add dsh-better-sidebar`:登记依赖 → 识别包内 `dsh.bundle.patch` → 自动注册进 `dsh.profile.bundles` 挂载;
|
|
117
|
+
4. 清理旧版残留的手动挂载行,避免「双挂载」(页面出现两个侧边栏)。
|
|
118
|
+
|
|
119
|
+
`curl | bash` / `irm | iex` 会执行远程代码——脚本已随仓库开源(`scripts/install.sh` / `scripts/install.ps1`),可先下载审阅。插件以 npm 包 `dsh-better-sidebar@0.10.3` 发布,通过 `dsh.bundle.patch`(随包的 `cordis.patch.yml`)由官方 CLI 自动挂载,**不修改 DSH 源码**。
|
|
120
|
+
|
|
121
|
+
</details>
|
|
122
|
+
|
|
123
|
+
<details>
|
|
124
|
+
<summary><b>更新</b></summary>
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
dsh plugin --profile web add dsh-better-sidebar
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
或重跑一次一键脚本;也可把 `~/.dsh/profiles/web/package.json` 里的版本号改高后 `pnpm install`。改完**重启 DSH 并硬刷新**(Cmd/Ctrl+Shift+R)。
|
|
131
|
+
|
|
132
|
+
</details>
|
|
133
|
+
|
|
134
|
+
<details>
|
|
135
|
+
<summary><b>常见问题</b></summary>
|
|
136
|
+
|
|
137
|
+
| 现象 | 原因与解决 |
|
|
138
|
+
|---|---|
|
|
139
|
+
| 报 `Ignored build scripts` | pnpm 11 拦截构建脚本。跑 `pnpm approve-builds --all`(一键脚本已自动处理)。 |
|
|
140
|
+
| 报 `minimum release age` / 版本不足 24h | 装的版本发布不足 24 小时。等 24h 或重跑一次(pnpm 会自动补 `minimumReleaseAgeExclude`);一键脚本已自动处理。 |
|
|
141
|
+
| 报「找不到 profile 目录」 | 先跑一次 `dsh web`,让它初始化 `~/.dsh/profiles/web`。 |
|
|
142
|
+
| 页面出现**两个侧边栏** | 双挂载:`~/.dsh/profiles/web/cordis.patch.yml` 还留着旧的手动挂载行,删掉那段 `- insert: ... better-sidebar ...`(一键脚本会自动清)。 |
|
|
143
|
+
| Windows 下终端无法使用 | `node-pty` 依赖预编译二进制;若当前 Node 版本没有对应产物,需装编译工具链(VS Build Tools)。主流 Node 版本一般已有预编译。 |
|
|
144
|
+
| Windows 没有 bash / curl | 直接用 PowerShell 一键命令;或安装 Git Bash / WSL 再跑 bash 命令。 |
|
|
145
|
+
|
|
146
|
+
</details>
|
|
147
|
+
|
|
74
148
|
<details>
|
|
75
149
|
<summary><b>从源码安装 / 开发(可选,替代 npm 方式)</b></summary>
|
|
76
150
|
|
|
@@ -80,12 +154,15 @@ curl -fsSL https://raw.githubusercontent.com/omdsh-dev/DSH-better-sidebar/main/s
|
|
|
80
154
|
1. git clone https://github.com/omdsh-dev/DSH-better-sidebar.git ~/Code/DSH-better-sidebar
|
|
81
155
|
cd ~/Code/DSH-better-sidebar && pnpm install && pnpm build
|
|
82
156
|
2. ~/.dsh/profiles/web/package.json 的 dependencies 写 "dsh-better-sidebar": "link:<克隆目录绝对路径>"
|
|
83
|
-
3. ~/.dsh/profiles/web/cordis.patch.yml
|
|
157
|
+
3. ~/.dsh/profiles/web/cordis.patch.yml 追加挂载行:
|
|
158
|
+
- insert:
|
|
159
|
+
- id: better-sidebar
|
|
160
|
+
name: 'dsh-better-sidebar'
|
|
84
161
|
4. 在 ~/.dsh/profiles/web 执行 pnpm install
|
|
85
162
|
5. 重启 DSH 并硬刷新
|
|
86
163
|
```
|
|
87
164
|
|
|
88
|
-
更新:`git pull && pnpm install && pnpm build` → 重启 DSH(仅 client 改动可硬刷新)。切回 npm 通道时,把依赖改回 `"dsh-better-sidebar": "^0.10.
|
|
165
|
+
更新:`git pull && pnpm install && pnpm build` → 重启 DSH(仅 client 改动可硬刷新)。切回 npm 通道时,把依赖改回 `"dsh-better-sidebar": "^0.10.3"` 再 `pnpm install`。
|
|
89
166
|
|
|
90
167
|
</details>
|
|
91
168
|
|
package/README_EN.md
CHANGED
|
@@ -35,42 +35,116 @@ https://github.com/user-attachments/assets/23187822-047e-45cc-b480-fe997bd55b86
|
|
|
35
35
|
|
|
36
36
|
## 🚀 Installation
|
|
37
37
|
|
|
38
|
-
Prerequisites
|
|
38
|
+
**Prerequisites**: DSH installed (`dsh web` boots), Node.js ≥ 20, pnpm ≥ 10.
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
**macOS / Linux** (also works in Git Bash / WSL on Windows):
|
|
41
41
|
|
|
42
42
|
```sh
|
|
43
43
|
curl -fsSL https://raw.githubusercontent.com/omdsh-dev/DSH-better-sidebar/main/scripts/install.sh | bash
|
|
44
|
-
# Pick a version: curl -fsSL <same URL> | bash -s 0.10.1
|
|
45
|
-
# Auto-restart DSH: curl -fsSL <same URL> | bash -s -- --restart
|
|
46
44
|
```
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
**Windows (PowerShell 5.1+ / pwsh)**:
|
|
49
47
|
|
|
50
|
-
|
|
48
|
+
```powershell
|
|
49
|
+
irm https://raw.githubusercontent.com/omdsh-dev/DSH-better-sidebar/main/scripts/install.ps1 | iex
|
|
50
|
+
```
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
Then **restart DSH and hard-refresh** (Cmd/Ctrl+Shift+R) to see the sidebar.
|
|
53
|
+
|
|
54
|
+
<details>
|
|
55
|
+
<summary><b>Pin a version / auto-restart (optional)</b></summary>
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
# macOS / Linux
|
|
59
|
+
curl -fsSL https://raw.githubusercontent.com/omdsh-dev/DSH-better-sidebar/main/scripts/install.sh | bash -s 0.10.3 --restart
|
|
60
|
+
|
|
61
|
+
# Windows PowerShell
|
|
62
|
+
& ([scriptblock]::Create((irm 'https://raw.githubusercontent.com/omdsh-dev/DSH-better-sidebar/main/scripts/install.ps1'))) -Version 0.10.3 -Restart
|
|
60
63
|
```
|
|
61
64
|
|
|
62
|
-
|
|
65
|
+
Not sure? Add `--dry-run` (`-DryRun` in PowerShell) to preview before running.
|
|
63
66
|
|
|
64
|
-
>
|
|
67
|
+
</details>
|
|
65
68
|
|
|
66
|
-
|
|
69
|
+
<details>
|
|
70
|
+
<summary><b>Manual install (step by step)</b></summary>
|
|
67
71
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
Equivalent to the one-click script. **Step ③ is repeatable; ①② only need to run once.**
|
|
73
|
+
|
|
74
|
+
**macOS / Linux (bash)**:
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
cd ~/.dsh/profiles/web
|
|
78
|
+
|
|
79
|
+
# ① Allow node-pty / protobufjs build scripts (pnpm 11 blocks them by default; skip on pnpm 10)
|
|
80
|
+
pnpm approve-builds --all
|
|
81
|
+
|
|
82
|
+
# ② Allow versions published less than 24h ago (skip for older releases; if the key already exists, merge the line under it instead)
|
|
83
|
+
cat >> pnpm-workspace.yaml <<'EOF'
|
|
84
|
+
minimumReleaseAgeExclude:
|
|
85
|
+
- dsh-better-sidebar
|
|
86
|
+
EOF
|
|
87
|
+
|
|
88
|
+
# ③ Install and auto-mount (no @version = npm's latest; pin with dsh-better-sidebar@0.10.3)
|
|
89
|
+
npx -y --package @deepseek-ai/dsh dsh plugin --profile web add dsh-better-sidebar
|
|
72
90
|
```
|
|
73
91
|
|
|
92
|
+
**Windows (PowerShell)**:
|
|
93
|
+
|
|
94
|
+
```powershell
|
|
95
|
+
cd ~\.dsh\profiles\web
|
|
96
|
+
|
|
97
|
+
# ① Allow build scripts
|
|
98
|
+
pnpm approve-builds --all
|
|
99
|
+
|
|
100
|
+
# ② Allow fresh releases (once; if the key already exists, merge - dsh-better-sidebar under it instead)
|
|
101
|
+
Add-Content -Path pnpm-workspace.yaml -Value "`nminimumReleaseAgeExclude:`n - dsh-better-sidebar"
|
|
102
|
+
|
|
103
|
+
# ③ Install and auto-mount
|
|
104
|
+
npx -y --package @deepseek-ai/dsh dsh plugin --profile web add dsh-better-sidebar
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
</details>
|
|
108
|
+
|
|
109
|
+
<details>
|
|
110
|
+
<summary><b>What the script does (technical details)</b></summary>
|
|
111
|
+
|
|
112
|
+
The one-click script does four things, all idempotent (safe to re-run):
|
|
113
|
+
|
|
114
|
+
1. Pre-writes `allowBuilds` (node-pty / protobufjs) to dodge pnpm 11's build-script block;
|
|
115
|
+
2. Pre-writes `minimumReleaseAgeExclude` to allow versions younger than 24 hours;
|
|
116
|
+
3. Runs `dsh plugin --profile web add dsh-better-sidebar`: registers the dependency → detects `dsh.bundle.patch` → auto-appends the plugin to `dsh.profile.bundles`;
|
|
117
|
+
4. Removes any leftover hand-written mount line to avoid double-mounting (two sidebars on the page).
|
|
118
|
+
|
|
119
|
+
`curl | bash` / `irm | iex` executes remote code — the scripts are open source in the repo (`scripts/install.sh` / `scripts/install.ps1`); download and review them first if you prefer. The plugin ships as npm package `dsh-better-sidebar@0.10.3` and mounts via `dsh.bundle.patch` (the shipped `cordis.patch.yml`), so the DSH source is never modified.
|
|
120
|
+
|
|
121
|
+
</details>
|
|
122
|
+
|
|
123
|
+
<details>
|
|
124
|
+
<summary><b>Updating</b></summary>
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
dsh plugin --profile web add dsh-better-sidebar
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
or re-run the one-click script; or bump the version in `~/.dsh/profiles/web/package.json` (e.g. `"^0.10.3"`) and run `pnpm install`. Then restart DSH and hard-refresh (Cmd/Ctrl+Shift+R).
|
|
131
|
+
|
|
132
|
+
</details>
|
|
133
|
+
|
|
134
|
+
<details>
|
|
135
|
+
<summary><b>Troubleshooting</b></summary>
|
|
136
|
+
|
|
137
|
+
| Symptom | Cause & fix |
|
|
138
|
+
|---|---|
|
|
139
|
+
| `Ignored build scripts` | pnpm 11 blocked build scripts. Run `pnpm approve-builds --all` (the one-click script handles it). |
|
|
140
|
+
| `minimum release age` / version `< 24h` | The release is younger than 24 hours. Wait, or re-run once (pnpm auto-adds `minimumReleaseAgeExclude`); the one-click script handles it. |
|
|
141
|
+
| "profile directory not found" | Run `dsh web` once so it initializes `~/.dsh/profiles/web`. |
|
|
142
|
+
| Two sidebars on the page | Double-mount: `~/.dsh/profiles/web/cordis.patch.yml` still has the old hand-written `- insert: ... better-sidebar ...` line — delete it (the one-click script cleans it). |
|
|
143
|
+
| Terminal fails on Windows | `node-pty` relies on prebuilt binaries; if none match your Node version, install a build toolchain (VS Build Tools). Mainstream Node versions are usually covered. |
|
|
144
|
+
| No bash / curl on Windows | Use the PowerShell one-click command, or install Git Bash / WSL and run the bash commands. |
|
|
145
|
+
|
|
146
|
+
</details>
|
|
147
|
+
|
|
74
148
|
<details>
|
|
75
149
|
<summary><b>Install from source / develop (optional — alternative to the npm flow)</b></summary>
|
|
76
150
|
|
|
@@ -80,12 +154,15 @@ To debug local changes or track the dev branch, point the dependency at a local
|
|
|
80
154
|
1. git clone https://github.com/omdsh-dev/DSH-better-sidebar.git ~/Code/DSH-better-sidebar
|
|
81
155
|
cd ~/Code/DSH-better-sidebar && pnpm install && pnpm build
|
|
82
156
|
2. In ~/.dsh/profiles/web/package.json dependencies write "dsh-better-sidebar": "link:<absolute path of the clone>"
|
|
83
|
-
3. Append
|
|
157
|
+
3. Append this mount line to ~/.dsh/profiles/web/cordis.patch.yml:
|
|
158
|
+
- insert:
|
|
159
|
+
- id: better-sidebar
|
|
160
|
+
name: 'dsh-better-sidebar'
|
|
84
161
|
4. Run pnpm install in ~/.dsh/profiles/web
|
|
85
162
|
5. Restart DSH and hard-refresh
|
|
86
163
|
```
|
|
87
164
|
|
|
88
|
-
Update: `git pull && pnpm install && pnpm build` → restart DSH (client-only changes can just hard-refresh). To switch back to the npm channel, restore `"dsh-better-sidebar": "^0.10.
|
|
165
|
+
Update: `git pull && pnpm install && pnpm build` → restart DSH (client-only changes can just hard-refresh). To switch back to the npm channel, restore `"dsh-better-sidebar": "^0.10.3"` and re-run `pnpm install`.
|
|
89
166
|
|
|
90
167
|
</details>
|
|
91
168
|
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# dsh-better-sidebar bundle patch
|
|
2
|
+
#
|
|
3
|
+
# This file is the `dsh.bundle.patch` layer of the published npm package: when
|
|
4
|
+
# the plugin is installed through the official CLI —
|
|
5
|
+
#
|
|
6
|
+
# dsh plugin --profile <name> add dsh-better-sidebar@<version>
|
|
7
|
+
#
|
|
8
|
+
# — the command reconciles `dsh.profile.bundles` against installed packages
|
|
9
|
+
# and, seeing this declaration, appends `dsh-better-sidebar` to the bundle
|
|
10
|
+
# stack. The profile boot then merges THIS patch (a single `insert` of the
|
|
11
|
+
# plugin row) exactly like the manual cordis.patch.yml mount line used
|
|
12
|
+
# before. No profile file edits needed — one command installs and mounts.
|
|
13
|
+
#
|
|
14
|
+
# If the profile still carries the old manual mount line in its own
|
|
15
|
+
# cordis.patch.yml, remove it before switching to the bundle channel to
|
|
16
|
+
# avoid double-mounting (two Node halves, two sidebars).
|
|
17
|
+
- insert:
|
|
18
|
+
- id: better-sidebar
|
|
19
|
+
name: 'dsh-better-sidebar'
|