dsh-plugin-pwsh7 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/LICENSE +21 -21
- package/README.md +219 -186
- package/README.zh.md +208 -176
- package/cordis.patch.yml +16 -16
- package/icon.svg +28 -28
- package/index.js +126 -126
- package/lib/executors/pwsh.mjs +20 -20
- package/lib/install.mjs +978 -978
- package/lib/paths.mjs +327 -327
- package/lib/shipped.mjs +115 -115
- package/lib/state.mjs +129 -129
- package/lib/status.mjs +187 -187
- package/locale/en.json +6 -6
- package/locale/zh.json +6 -6
- package/package.json +62 -60
package/README.zh.md
CHANGED
|
@@ -1,176 +1,208 @@
|
|
|
1
|
-
# dsh-plugin-pwsh7
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/dsh-plugin-pwsh7)
|
|
4
|
-
[](LICENSE)
|
|
5
|
-
|
|
6
|
-
Windows 上的 DeepSeek Harness(DSH)插件:把模型侧的 **`pwsh` 工具路由到 PowerShell 7**
|
|
7
|
-
(`pwsh.exe`,主版本 >= 7),不再落到 Windows PowerShell 5.1。
|
|
8
|
-
|
|
9
|
-
- 执行器继承 DSH 自带 `dsh-pwsh-sandbox` 的全部行为:沙箱模式、`sandbox_permissions` 升权、
|
|
10
|
-
拒绝/runner 失败标记、后台任务、输出上限与 exit marker;本插件只替换可执行文件解析。
|
|
11
|
-
- 找不到 PowerShell 7 时,提供模型可调用的 **`shell_router`** 工具做检测、诊断和
|
|
12
|
-
**用户级自动下载安装**(默认不需要管理员权限)。
|
|
13
|
-
|
|
14
|
-
[English](README.md) | 中文
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## 它做什么
|
|
19
|
-
|
|
20
|
-
Windows 预设把 `pwsh-sandbox` 行挂到 `ctx.shell`,但可执行文件解析在部分环境里会落到
|
|
21
|
-
Windows PowerShell 5.1。本插件保留官方执行器,只覆盖 `pwshPath` 解析:
|
|
22
|
-
|
|
23
|
-
1. **替换 `pwsh-sandbox` 行**:`RouterPwshExecutor extends SandboxPwshExecutor`。显式
|
|
24
|
-
`config.pwshPath` 优先;否则使用插件检测到的 PowerShell 7。
|
|
25
|
-
2. **注册 `shell_router` 工具**(`status` / `diagnose` / `install`),并附一段描述路由与安装方式的
|
|
26
|
-
系统提示小节。
|
|
27
|
-
|
|
28
|
-
## 环境要求
|
|
29
|
-
|
|
30
|
-
- Windows 10/11。
|
|
31
|
-
- 支持 bundle 的 DSH profile(`@deepseek-ai/dsh-base` / Web profile)。已在 DSH desktop
|
|
32
|
-
0.2.1-rc.2 上验证。
|
|
33
|
-
- Node.js >= 22 仅运行仓库测试时需要。
|
|
34
|
-
|
|
35
|
-
## 安装
|
|
36
|
-
|
|
37
|
-
通过 DSH 插件管理器从 npm 安装:
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
plugin_manager action=install_bundle target=dsh-plugin-pwsh7@0.1.0
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
或从本地目录安装(目录安装会链接源码,便于开发):
|
|
44
|
-
|
|
45
|
-
```
|
|
46
|
-
plugin_manager action=install_bundle target=D:\path\to\dsh-plugin-pwsh7
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
新 bundle 通过 HMR 立即生效;之后修改插件源码需要重启 DSH 才会加载新模块。
|
|
50
|
-
|
|
51
|
-
## 使用
|
|
52
|
-
|
|
53
|
-
模型工具 `shell_router`:
|
|
54
|
-
|
|
55
|
-
| 动作 | 说明 |
|
|
56
|
-
|---|---|
|
|
57
|
-
| `status`(默认) | 报告解析到的 PowerShell 7 路径与版本、配置文件、当前沙箱策略、`@deepseek-ai/*` 加载状态。 |
|
|
58
|
-
| `diagnose` | 在**当前沙箱策略**下真实运行 PowerShell 7 命令(版本 + 工作区写入),输出退出码、stdout/stderr、拒绝/runner 失败判定与具体修复建议。 |
|
|
59
|
-
| `install` | 确保 PowerShell 7 可用。`method: "auto"`(默认)优先用户级便携 zip,失败回退 winget;`portable`/`winget` 强制单一方式。已有可用安装时只刷新配置,不会重复下载。 |
|
|
60
|
-
|
|
61
|
-
### 显式指定路径
|
|
62
|
-
|
|
63
|
-
`pwsh` 可执行文件解析顺序:
|
|
64
|
-
|
|
65
|
-
1. 环境变量 `DSH_PWSH_PATH`
|
|
66
|
-
2. `%LOCALAPPDATA%\dsh\pwsh7\config.json` 的 `pwshPath`
|
|
67
|
-
3. `%ProgramFiles%\PowerShell\7\pwsh.exe`
|
|
68
|
-
4. `%LOCALAPPDATA%\dsh\pwsh7\powershell7\…\pwsh.exe`(便携安装,新版本优先)
|
|
69
|
-
5. `%LOCALAPPDATA%\Programs\PowerShell\7\pwsh.exe`
|
|
70
|
-
6. `PATH` 各目录
|
|
71
|
-
7. `%LOCALAPPDATA%\Microsoft\WindowsApps\pwsh.exe`(Store 别名)
|
|
72
|
-
8. `%ProgramFiles(x86)%\PowerShell\7\pwsh.exe`
|
|
73
|
-
|
|
74
|
-
官方 `pwsh-sandbox` 行本身仍支持 `pwshPath` 配置字段;显式配置优先于自动检测。
|
|
75
|
-
|
|
76
|
-
### 配置文件
|
|
77
|
-
|
|
78
|
-
`%LOCALAPPDATA%\dsh\pwsh7\config.json`:
|
|
79
|
-
|
|
80
|
-
```json
|
|
81
|
-
{
|
|
82
|
-
"version": 1,
|
|
83
|
-
"pwshPath": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
|
|
84
|
-
"installed": {
|
|
85
|
-
"pwsh": {
|
|
86
|
-
"path": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
|
|
87
|
-
"version": "7.6.7",
|
|
88
|
-
"method": "existing",
|
|
89
|
-
"at": "2026-10-17T00:00:00.000Z"
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
"updatedAt": "2026-10-17T00:00:00.000Z"
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## 自动安装
|
|
97
|
-
|
|
98
|
-
默认用户级、无管理员权限:
|
|
99
|
-
|
|
100
|
-
| 组件 | 来源 | 安装位置 |
|
|
101
|
-
|---|---|---|
|
|
102
|
-
| PowerShell 7 | GitHub `PowerShell/PowerShell` 最新 release 的 `PowerShell-*-win-x64.zip` | `%LOCALAPPDATA%\dsh\pwsh7\powershell7\<version>\` |
|
|
103
|
-
|
|
104
|
-
- HTTPS 流式下载到 `%LOCALAPPDATA%\dsh\pwsh7\tmp`,支持进度回调与取消。
|
|
105
|
-
- 解包使用 Windows 自带 `tar.exe`(bsdtar);不会执行任何下载来的安装器。
|
|
106
|
-
- 解包后先真实运行一次新 `pwsh.exe` 验证主版本 >= 7,再写入 `config.json`。
|
|
107
|
-
- `auto` 失败回退 `winget install Microsoft.PowerShell`;需要 UAC 提升时返回明确的手动命令,
|
|
108
|
-
不会卡在提权提示上。
|
|
109
|
-
- 不写入安装目录与临时目录以外的位置。
|
|
110
|
-
- 已在本机实测:下载 106,364,316 字节(约 31s),解压后 244.8 MB,验证为 `7.6.7`。
|
|
111
|
-
|
|
112
|
-
## 沙箱
|
|
113
|
-
|
|
114
|
-
- 执行器通过 `ctx.sandbox.confine()` 走 Windows ACL restricted-token runner,
|
|
115
|
-
`workspace-write` / `read-only` / `danger-full-access` 与官方执行器一致。
|
|
116
|
-
- PowerShell 7 在三种模式下都可用(已实测:`workspace-write` 下工作区内可写、工作区外写入被拒;
|
|
117
|
-
`danger-full-access` 不受限)。
|
|
118
|
-
- 若出现 `SetNamedSecurityInfoW failed (Win32 5)` / `grantWrite(<workspace>)`,说明工作区 DACL
|
|
119
|
-
缺少权限。可运行 DSH 内置的 **`diagnose-windows-sandbox-acl`** skill 对工作区根目录做诊断+修复
|
|
120
|
-
(先备份、再校验),或临时把会话切到完全权限。
|
|
121
|
-
|
|
122
|
-
## 故障排查
|
|
123
|
-
|
|
124
|
-
1. 先跑 `shell_router action="status"`:确认 PowerShell 7 的解析路径与版本。
|
|
125
|
-
2. 再跑 `shell_router action="diagnose"`:在当前沙箱模式下真实执行命令并分类失败。
|
|
126
|
-
3. 常见原因:
|
|
127
|
-
- **仍然是 Windows PowerShell 5.1**:检测没找到 PowerShell 7。设置 `DSH_PWSH_PATH` 或
|
|
128
|
-
`config.json` 的 `pwshPath`,再查看 `status`。
|
|
129
|
-
- **PowerShell 7 装在自定义位置**:设置 `DSH_PWSH_PATH` 或 `config.json`。
|
|
130
|
-
- **沙箱 / ACL 失败**:见上一节。
|
|
131
|
-
|
|
132
|
-
## 结构
|
|
133
|
-
|
|
134
|
-
| 路径 | 作用 |
|
|
135
|
-
|---|---|
|
|
136
|
-
| `index.js` | 插件入口:`shell_router` 工具、系统提示小节、配置热重载时刷新检测 |
|
|
137
|
-
| `lib/shipped.mjs` | 从运行中的 DSH 安装(Electron `app.asar`)加载 `@deepseek-ai/*` 包 |
|
|
138
|
-
| `lib/paths.mjs` | PowerShell 7 路径探测、版本探测、`config.json` 读写 |
|
|
139
|
-
| `lib/install.mjs` | 用户级便携安装(官方 zip)+ winget 回退 |
|
|
140
|
-
| `lib/state.mjs` | 进程内解析缓存(executor 与工具共用) |
|
|
141
|
-
| `lib/status.mjs` | `status` / `diagnose` 实现 |
|
|
142
|
-
| `lib/executors/pwsh.mjs` | PowerShell 7 执行器(继承官方 `SandboxPwshExecutor`) |
|
|
143
|
-
| `cordis.patch.yml` | bundle patch:Windows 上替换 `pwsh-sandbox` 并插入插件行 |
|
|
144
|
-
| `locale/en.json`, `locale/zh.json`, `icon.svg` | 插件管理页显示元数据 |
|
|
145
|
-
|
|
146
|
-
`package.json` 的 `files` 只打包运行所需文件;`test/` 保留在仓库中,不进入 npm 包。
|
|
147
|
-
|
|
148
|
-
## 开发
|
|
149
|
-
|
|
150
|
-
```powershell
|
|
151
|
-
# 纯 Node 单元测试(不需要 DSH 运行)
|
|
152
|
-
node --test test/paths.test.mjs test/install.test.mjs
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
- 49 tests:48 pass,0 fail,1 skipped(网络用例默认跳过)。
|
|
156
|
-
- 设置 `DSH_PWSH7_NETWORK_TESTS=1` 会启用真实 GitHub release / HEAD 校验:30/30 pass。
|
|
157
|
-
- 环境变量覆盖前缀为 `DSH_PWSH7_*`(`APP_ROOT`、`TAR`、`NETWORK_TESTS`)。
|
|
158
|
-
|
|
159
|
-
##
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
1
|
+
# dsh-plugin-pwsh7
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/dsh-plugin-pwsh7)
|
|
4
|
+
[](https://github.com/drliuhuan/dsh-plugin-pwsh7/blob/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
Windows 上的 DeepSeek Harness(DSH)插件:把模型侧的 **`pwsh` 工具路由到 PowerShell 7**
|
|
7
|
+
(`pwsh.exe`,主版本 >= 7),不再落到 Windows PowerShell 5.1。
|
|
8
|
+
|
|
9
|
+
- 执行器继承 DSH 自带 `dsh-pwsh-sandbox` 的全部行为:沙箱模式、`sandbox_permissions` 升权、
|
|
10
|
+
拒绝/runner 失败标记、后台任务、输出上限与 exit marker;本插件只替换可执行文件解析。
|
|
11
|
+
- 找不到 PowerShell 7 时,提供模型可调用的 **`shell_router`** 工具做检测、诊断和
|
|
12
|
+
**用户级自动下载安装**(默认不需要管理员权限)。
|
|
13
|
+
|
|
14
|
+
[English](https://github.com/drliuhuan/dsh-plugin-pwsh7/blob/main/README.md) | 中文
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 它做什么
|
|
19
|
+
|
|
20
|
+
Windows 预设把 `pwsh-sandbox` 行挂到 `ctx.shell`,但可执行文件解析在部分环境里会落到
|
|
21
|
+
Windows PowerShell 5.1。本插件保留官方执行器,只覆盖 `pwshPath` 解析:
|
|
22
|
+
|
|
23
|
+
1. **替换 `pwsh-sandbox` 行**:`RouterPwshExecutor extends SandboxPwshExecutor`。显式
|
|
24
|
+
`config.pwshPath` 优先;否则使用插件检测到的 PowerShell 7。
|
|
25
|
+
2. **注册 `shell_router` 工具**(`status` / `diagnose` / `install`),并附一段描述路由与安装方式的
|
|
26
|
+
系统提示小节。
|
|
27
|
+
|
|
28
|
+
## 环境要求
|
|
29
|
+
|
|
30
|
+
- Windows 10/11。
|
|
31
|
+
- 支持 bundle 的 DSH profile(`@deepseek-ai/dsh-base` / Web profile)。已在 DSH desktop
|
|
32
|
+
0.2.1-rc.2 上验证。
|
|
33
|
+
- Node.js >= 22 仅运行仓库测试时需要。
|
|
34
|
+
|
|
35
|
+
## 安装
|
|
36
|
+
|
|
37
|
+
通过 DSH 插件管理器从 npm 安装:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
plugin_manager action=install_bundle target=dsh-plugin-pwsh7@0.1.0
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
或从本地目录安装(目录安装会链接源码,便于开发):
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
plugin_manager action=install_bundle target=D:\path\to\dsh-plugin-pwsh7
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
新 bundle 通过 HMR 立即生效;之后修改插件源码需要重启 DSH 才会加载新模块。
|
|
50
|
+
|
|
51
|
+
## 使用
|
|
52
|
+
|
|
53
|
+
模型工具 `shell_router`:
|
|
54
|
+
|
|
55
|
+
| 动作 | 说明 |
|
|
56
|
+
|---|---|
|
|
57
|
+
| `status`(默认) | 报告解析到的 PowerShell 7 路径与版本、配置文件、当前沙箱策略、`@deepseek-ai/*` 加载状态。 |
|
|
58
|
+
| `diagnose` | 在**当前沙箱策略**下真实运行 PowerShell 7 命令(版本 + 工作区写入),输出退出码、stdout/stderr、拒绝/runner 失败判定与具体修复建议。 |
|
|
59
|
+
| `install` | 确保 PowerShell 7 可用。`method: "auto"`(默认)优先用户级便携 zip,失败回退 winget;`portable`/`winget` 强制单一方式。已有可用安装时只刷新配置,不会重复下载。 |
|
|
60
|
+
|
|
61
|
+
### 显式指定路径
|
|
62
|
+
|
|
63
|
+
`pwsh` 可执行文件解析顺序:
|
|
64
|
+
|
|
65
|
+
1. 环境变量 `DSH_PWSH_PATH`
|
|
66
|
+
2. `%LOCALAPPDATA%\dsh\pwsh7\config.json` 的 `pwshPath`
|
|
67
|
+
3. `%ProgramFiles%\PowerShell\7\pwsh.exe`
|
|
68
|
+
4. `%LOCALAPPDATA%\dsh\pwsh7\powershell7\…\pwsh.exe`(便携安装,新版本优先)
|
|
69
|
+
5. `%LOCALAPPDATA%\Programs\PowerShell\7\pwsh.exe`
|
|
70
|
+
6. `PATH` 各目录
|
|
71
|
+
7. `%LOCALAPPDATA%\Microsoft\WindowsApps\pwsh.exe`(Store 别名)
|
|
72
|
+
8. `%ProgramFiles(x86)%\PowerShell\7\pwsh.exe`
|
|
73
|
+
|
|
74
|
+
官方 `pwsh-sandbox` 行本身仍支持 `pwshPath` 配置字段;显式配置优先于自动检测。
|
|
75
|
+
|
|
76
|
+
### 配置文件
|
|
77
|
+
|
|
78
|
+
`%LOCALAPPDATA%\dsh\pwsh7\config.json`:
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"version": 1,
|
|
83
|
+
"pwshPath": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
|
|
84
|
+
"installed": {
|
|
85
|
+
"pwsh": {
|
|
86
|
+
"path": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
|
|
87
|
+
"version": "7.6.7",
|
|
88
|
+
"method": "existing",
|
|
89
|
+
"at": "2026-10-17T00:00:00.000Z"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"updatedAt": "2026-10-17T00:00:00.000Z"
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## 自动安装
|
|
97
|
+
|
|
98
|
+
默认用户级、无管理员权限:
|
|
99
|
+
|
|
100
|
+
| 组件 | 来源 | 安装位置 |
|
|
101
|
+
|---|---|---|
|
|
102
|
+
| PowerShell 7 | GitHub `PowerShell/PowerShell` 最新 release 的 `PowerShell-*-win-x64.zip` | `%LOCALAPPDATA%\dsh\pwsh7\powershell7\<version>\` |
|
|
103
|
+
|
|
104
|
+
- HTTPS 流式下载到 `%LOCALAPPDATA%\dsh\pwsh7\tmp`,支持进度回调与取消。
|
|
105
|
+
- 解包使用 Windows 自带 `tar.exe`(bsdtar);不会执行任何下载来的安装器。
|
|
106
|
+
- 解包后先真实运行一次新 `pwsh.exe` 验证主版本 >= 7,再写入 `config.json`。
|
|
107
|
+
- `auto` 失败回退 `winget install Microsoft.PowerShell`;需要 UAC 提升时返回明确的手动命令,
|
|
108
|
+
不会卡在提权提示上。
|
|
109
|
+
- 不写入安装目录与临时目录以外的位置。
|
|
110
|
+
- 已在本机实测:下载 106,364,316 字节(约 31s),解压后 244.8 MB,验证为 `7.6.7`。
|
|
111
|
+
|
|
112
|
+
## 沙箱
|
|
113
|
+
|
|
114
|
+
- 执行器通过 `ctx.sandbox.confine()` 走 Windows ACL restricted-token runner,
|
|
115
|
+
`workspace-write` / `read-only` / `danger-full-access` 与官方执行器一致。
|
|
116
|
+
- PowerShell 7 在三种模式下都可用(已实测:`workspace-write` 下工作区内可写、工作区外写入被拒;
|
|
117
|
+
`danger-full-access` 不受限)。
|
|
118
|
+
- 若出现 `SetNamedSecurityInfoW failed (Win32 5)` / `grantWrite(<workspace>)`,说明工作区 DACL
|
|
119
|
+
缺少权限。可运行 DSH 内置的 **`diagnose-windows-sandbox-acl`** skill 对工作区根目录做诊断+修复
|
|
120
|
+
(先备份、再校验),或临时把会话切到完全权限。
|
|
121
|
+
|
|
122
|
+
## 故障排查
|
|
123
|
+
|
|
124
|
+
1. 先跑 `shell_router action="status"`:确认 PowerShell 7 的解析路径与版本。
|
|
125
|
+
2. 再跑 `shell_router action="diagnose"`:在当前沙箱模式下真实执行命令并分类失败。
|
|
126
|
+
3. 常见原因:
|
|
127
|
+
- **仍然是 Windows PowerShell 5.1**:检测没找到 PowerShell 7。设置 `DSH_PWSH_PATH` 或
|
|
128
|
+
`config.json` 的 `pwshPath`,再查看 `status`。
|
|
129
|
+
- **PowerShell 7 装在自定义位置**:设置 `DSH_PWSH_PATH` 或 `config.json`。
|
|
130
|
+
- **沙箱 / ACL 失败**:见上一节。
|
|
131
|
+
|
|
132
|
+
## 结构
|
|
133
|
+
|
|
134
|
+
| 路径 | 作用 |
|
|
135
|
+
|---|---|
|
|
136
|
+
| `index.js` | 插件入口:`shell_router` 工具、系统提示小节、配置热重载时刷新检测 |
|
|
137
|
+
| `lib/shipped.mjs` | 从运行中的 DSH 安装(Electron `app.asar`)加载 `@deepseek-ai/*` 包 |
|
|
138
|
+
| `lib/paths.mjs` | PowerShell 7 路径探测、版本探测、`config.json` 读写 |
|
|
139
|
+
| `lib/install.mjs` | 用户级便携安装(官方 zip)+ winget 回退 |
|
|
140
|
+
| `lib/state.mjs` | 进程内解析缓存(executor 与工具共用) |
|
|
141
|
+
| `lib/status.mjs` | `status` / `diagnose` 实现 |
|
|
142
|
+
| `lib/executors/pwsh.mjs` | PowerShell 7 执行器(继承官方 `SandboxPwshExecutor`) |
|
|
143
|
+
| `cordis.patch.yml` | bundle patch:Windows 上替换 `pwsh-sandbox` 并插入插件行 |
|
|
144
|
+
| `locale/en.json`, `locale/zh.json`, `icon.svg` | 插件管理页显示元数据 |
|
|
145
|
+
|
|
146
|
+
`package.json` 的 `files` 只打包运行所需文件;`test/` 保留在仓库中,不进入 npm 包。
|
|
147
|
+
|
|
148
|
+
## 开发
|
|
149
|
+
|
|
150
|
+
```powershell
|
|
151
|
+
# 纯 Node 单元测试(不需要 DSH 运行)
|
|
152
|
+
node --test test/paths.test.mjs test/install.test.mjs
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
- 49 tests:48 pass,0 fail,1 skipped(网络用例默认跳过)。
|
|
156
|
+
- 设置 `DSH_PWSH7_NETWORK_TESTS=1` 会启用真实 GitHub release / HEAD 校验:30/30 pass。
|
|
157
|
+
- 环境变量覆盖前缀为 `DSH_PWSH7_*`(`APP_ROOT`、`TAR`、`NETWORK_TESTS`)。
|
|
158
|
+
|
|
159
|
+
## 发布(维护者)
|
|
160
|
+
|
|
161
|
+
发布由 GitHub Actions 通过 npm **Trusted Publishing**(OIDC)完成——不需要 npm token、OTP 或仓库
|
|
162
|
+
secret。
|
|
163
|
+
|
|
164
|
+
1. 修改 `package.json` 的 `version`,提交并推送到 `main`。
|
|
165
|
+
2. 创建并推送同名 tag,然后发布对应的 GitHub Release(例如 `v0.2.0`)。
|
|
166
|
+
3. [`.github/workflows/publish.yml`](.github/workflows/publish.yml) 在 `release: published` 时运行:
|
|
167
|
+
校验 tag 与 `package.json` 版本一致、跑测试、以 provenance 发布
|
|
168
|
+
(`npm publish --access public --provenance`)。
|
|
169
|
+
|
|
170
|
+
npm 侧的一次性配置(本仓库已完成):
|
|
171
|
+
|
|
172
|
+
```powershell
|
|
173
|
+
npx npm@12 trust github dsh-plugin-pwsh7 `
|
|
174
|
+
--file publish.yml `
|
|
175
|
+
--repo drliuhuan/dsh-plugin-pwsh7 `
|
|
176
|
+
--allow-publish --yes
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
手动 dry run:**Actions → Publish to npm → Run workflow**,保持 `dry_run` 勾选;工作流只会执行
|
|
180
|
+
`npm publish --dry-run --provenance`,不会真的发布。
|
|
181
|
+
|
|
182
|
+
仅 `drliuhuan/dsh-plugin-pwsh7` 仓库中的 `publish.yml` 被授权发布。查看或撤销:
|
|
183
|
+
|
|
184
|
+
```powershell
|
|
185
|
+
npx npm@12 trust list dsh-plugin-pwsh7
|
|
186
|
+
npx npm@12 trust revoke dsh-plugin-pwsh7 --id <trust-id>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## 版本说明
|
|
190
|
+
|
|
191
|
+
`0.1.0` 是第一个公开发布版本。`0.1.1` 是第一个通过 npm **Trusted Publishing**(OIDC)由
|
|
192
|
+
GitHub Actions 发布的版本,并修正了 npm 页面 README 的跨文件链接。更早的内部迭代
|
|
193
|
+
(0.2.x/0.3.x)曾包含 MSYS2 bash 路由并使用过不同的包名;由于 MSYS2/Cygwin 无法在 DSH Windows
|
|
194
|
+
ACL 沙箱中启动,该部分已被移除。历史实测证据保留在构建工作区的 `sandbox-recon/FINDINGS.md`,
|
|
195
|
+
不在本包内。
|
|
196
|
+
|
|
197
|
+
## 卸载
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
plugin_manager action=remove_bundle target=dsh-plugin-pwsh7
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
卸载后原生 Windows 预设恢复,`pwsh` 回到 DSH 原有解析。用户级目录
|
|
204
|
+
`%LOCALAPPDATA%\dsh\pwsh7\` 不会自动删除,可按需手动清理。
|
|
205
|
+
|
|
206
|
+
## License
|
|
207
|
+
|
|
208
|
+
MIT,见 [LICENSE](https://github.com/drliuhuan/dsh-plugin-pwsh7/blob/main/LICENSE)。
|
package/cordis.patch.yml
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
# dsh-plugin-pwsh7 — bundle patch.
|
|
2
|
-
#
|
|
3
|
-
# Windows only:
|
|
4
|
-
# Replace the host pwsh executor with one that resolves PowerShell 7 explicitly, keeping the
|
|
5
|
-
# stock sandbox executor behavior (escalation, denial facts, jobs, output caps).
|
|
6
|
-
#
|
|
7
|
-
# On other platforms the rows are disabled: the stock POSIX composition stays untouched.
|
|
8
|
-
|
|
9
|
-
- id: pwsh-sandbox
|
|
10
|
-
name: 'dsh-plugin-pwsh7/pwsh-executor'
|
|
11
|
-
disabled: !!js process.platform !== 'win32'
|
|
12
|
-
|
|
13
|
-
- insert:
|
|
14
|
-
- id: pwsh7-router
|
|
15
|
-
name: 'dsh-plugin-pwsh7'
|
|
16
|
-
disabled: !!js process.platform !== 'win32'
|
|
1
|
+
# dsh-plugin-pwsh7 — bundle patch.
|
|
2
|
+
#
|
|
3
|
+
# Windows only:
|
|
4
|
+
# Replace the host pwsh executor with one that resolves PowerShell 7 explicitly, keeping the
|
|
5
|
+
# stock sandbox executor behavior (escalation, denial facts, jobs, output caps).
|
|
6
|
+
#
|
|
7
|
+
# On other platforms the rows are disabled: the stock POSIX composition stays untouched.
|
|
8
|
+
|
|
9
|
+
- id: pwsh-sandbox
|
|
10
|
+
name: 'dsh-plugin-pwsh7/pwsh-executor'
|
|
11
|
+
disabled: !!js process.platform !== 'win32'
|
|
12
|
+
|
|
13
|
+
- insert:
|
|
14
|
+
- id: pwsh7-router
|
|
15
|
+
name: 'dsh-plugin-pwsh7'
|
|
16
|
+
disabled: !!js process.platform !== 'win32'
|
package/icon.svg
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128" role="img" aria-label="PowerShell 7 Router">
|
|
2
|
-
<defs>
|
|
3
|
-
<linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
|
|
4
|
-
<stop offset="0" stop-color="#071b30"/>
|
|
5
|
-
<stop offset="1" stop-color="#0f4f72"/>
|
|
6
|
-
</linearGradient>
|
|
7
|
-
<linearGradient id="seven" x1="0" y1="0" x2="1" y2="1">
|
|
8
|
-
<stop offset="0" stop-color="#ffe28f"/>
|
|
9
|
-
<stop offset="1" stop-color="#efa62b"/>
|
|
10
|
-
</linearGradient>
|
|
11
|
-
</defs>
|
|
12
|
-
|
|
13
|
-
<rect x="5" y="5" width="118" height="118" rx="26" fill="url(#bg)"/>
|
|
14
|
-
<path d="M22 24h84M22 96h84" stroke="#7fd8ff" stroke-opacity="0.10" stroke-width="2"/>
|
|
15
|
-
|
|
16
|
-
<!-- Terminal window: PowerShell prompt chevron + cursor. -->
|
|
17
|
-
<rect x="18" y="30" width="54" height="40" rx="9" fill="#0a2942" stroke="#5fd2ff" stroke-width="3"/>
|
|
18
|
-
<path d="M29 43l10 8-10 8" fill="none" stroke="#a6ecff" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
19
|
-
<path d="M45 59h13" stroke="#a6ecff" stroke-width="5" stroke-linecap="round"/>
|
|
20
|
-
|
|
21
|
-
<!-- PowerShell 7 numeral, drawn as a path so no font is required. -->
|
|
22
|
-
<path d="M76 30h36L94 90H83l15-50H76z" fill="url(#seven)"/>
|
|
23
|
-
|
|
24
|
-
<!-- Routing line: the prompt path leads to PowerShell 7. -->
|
|
25
|
-
<circle cx="24" cy="105" r="4" fill="#5fd2ff"/>
|
|
26
|
-
<path d="M30 105h58" fill="none" stroke="#ffcf5c" stroke-width="4" stroke-linecap="round"/>
|
|
27
|
-
<path d="M83 100l7 5-7 5" fill="none" stroke="#ffcf5c" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
|
|
28
|
-
</svg>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128" role="img" aria-label="PowerShell 7 Router">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
|
|
4
|
+
<stop offset="0" stop-color="#071b30"/>
|
|
5
|
+
<stop offset="1" stop-color="#0f4f72"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
<linearGradient id="seven" x1="0" y1="0" x2="1" y2="1">
|
|
8
|
+
<stop offset="0" stop-color="#ffe28f"/>
|
|
9
|
+
<stop offset="1" stop-color="#efa62b"/>
|
|
10
|
+
</linearGradient>
|
|
11
|
+
</defs>
|
|
12
|
+
|
|
13
|
+
<rect x="5" y="5" width="118" height="118" rx="26" fill="url(#bg)"/>
|
|
14
|
+
<path d="M22 24h84M22 96h84" stroke="#7fd8ff" stroke-opacity="0.10" stroke-width="2"/>
|
|
15
|
+
|
|
16
|
+
<!-- Terminal window: PowerShell prompt chevron + cursor. -->
|
|
17
|
+
<rect x="18" y="30" width="54" height="40" rx="9" fill="#0a2942" stroke="#5fd2ff" stroke-width="3"/>
|
|
18
|
+
<path d="M29 43l10 8-10 8" fill="none" stroke="#a6ecff" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
19
|
+
<path d="M45 59h13" stroke="#a6ecff" stroke-width="5" stroke-linecap="round"/>
|
|
20
|
+
|
|
21
|
+
<!-- PowerShell 7 numeral, drawn as a path so no font is required. -->
|
|
22
|
+
<path d="M76 30h36L94 90H83l15-50H76z" fill="url(#seven)"/>
|
|
23
|
+
|
|
24
|
+
<!-- Routing line: the prompt path leads to PowerShell 7. -->
|
|
25
|
+
<circle cx="24" cy="105" r="4" fill="#5fd2ff"/>
|
|
26
|
+
<path d="M30 105h58" fill="none" stroke="#ffcf5c" stroke-width="4" stroke-linecap="round"/>
|
|
27
|
+
<path d="M83 100l7 5-7 5" fill="none" stroke="#ffcf5c" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
|
|
28
|
+
</svg>
|