feat: add tran win cmd route

This commit is contained in:
Codex
2026-05-25 18:02:40 +00:00
parent 974a7ac666
commit a1841adcaa
8 changed files with 160 additions and 11 deletions
+13
View File
@@ -12,6 +12,19 @@ Windows 透传用于让 WSL provider 通过 UniDesk 的 Host SSH / WSL SSH 维
- WSL wrapper 负责路径转换、当前目录转换、Windows 进程启动、UTF-8 输出和 cmd/PowerShell 差异。
- skill wrapper 负责把用户仍然熟悉的 `keil``serial-monitor``board-comm` 命令映射到正确运行侧,避免维护两套互相分叉的 skill。
## UniDesk Win Route
简单 Windows `cmd.exe` 命令不需要依赖节点侧 `win-cmd` wrapper。UniDesk CLI 内置 `win` route
```bash
tran <PROVIDER_ID>:win cmd ver
tran <PROVIDER_ID>:win/c/test cmd cd
```
`<PROVIDER_ID>:win` 只定位到 WSL provider 的 Windows host cmd 执行面,后面的 `cmd <command-line>` 才是操作。`<PROVIDER_ID>:win/<drive>/<path>` 使用 slash 语法设置 Windows cwd,例如 `D601:win/c/test` 会在 Windows cmd 内执行 `cd /d "C:\test"`。该入口固定在运行用户命令前设置 `chcp 65001>nul``PYTHONUTF8=1``PYTHONIOENCODING=utf-8`,因此中文 stdout/stderr 和 Python 子进程默认按 UTF-8 处理。
长期命名只允许 `win`,不允许 `win32``win` route 仍复用 provider-gateway 的 Host SSH / WSL SSH 维护桥抵达目标 WSL provider,但不会依赖 WSL 登录 shell 的 Windows `PATH`,也不再通过节点侧 `win-cmd` wrapper 二次转发。CLI 固定从 `/mnt/c/Windows` 启动 Windows PowerShell UTF-8 launcher,再由 launcher 执行 `C:\Windows\System32\cmd.exe /d /s /c <command-line>`PowerShell 只负责把 Console/Input/OutputEncoding 设为 UTF-8 并保留 cmd 的 exit code,用户命令语义仍属于 Windows `cmd.exe`。需要 Keil、串口、Windows Node/npm 或复杂路径转换时,继续使用下文的 skill/wrapper 入口,直到对应能力被纳入 UniDesk 内置 route。
## Skill Discovery
先用 UniDesk SSH 透传内置的 skill 发现入口确认目标节点上 WSL 与 Windows 两侧 skill 的实际位置: