fix: improve trans windows route hints

This commit is contained in:
Codex
2026-06-27 02:05:42 +00:00
parent 3b2399c902
commit 4b71bed594
6 changed files with 100 additions and 5 deletions
+3 -1
View File
@@ -16,6 +16,8 @@ trans D601:k3s:namespace:workload[:container] logs --tail 120
trans D601:win ps <<'PS'
trans D601:win/c/test cat README.md
trans D601:win/c/test rg -i needle .
trans D601:win/c/test git diff --check
trans D601:win/c/test git commit -m 'fix: update docs'
trans gh:/owner/repo/issue/<number> cat
```
@@ -27,7 +29,7 @@ Host workspace、k3s、Windows、GitHub issue/PR routesh/bash/argv/apply-patc
- Host/WSL 与 Windows route 的 `apply-patch` 优先走 fs adapter bulk update path;不要为了规避旧的 `read-b64-block` / `write-b64-argv` 慢路径改用临时脚本写文件。
- `sh`/`bash` 必须显式声明 shell;单进程命令优先 direct argv 或已知 operation。
- 普通 trans/ssh 短连接硬预算 60s;长 CI/CD、trace、logs、build、硬件流程必须 submit-and-poll。
- Windows route 使用 `win ps``win cmd` 或只读 fs 操作 `pwd|ls|cat|head|tail|stat|wc|rg`;不要把 POSIX shell 当 Windows shell。
- Windows route `win` 是 route planeoperation 直接写 `ps``cmd``git` 或只读 fs 操作 `pwd|ls|cat|head|tail|stat|wc|rg`;不要写成 `trans D601:win/... win ps`,也不要把 POSIX shell 当 Windows shell。
- 扩展 Windows helper 时保持 operation-scoped PowerShell payload;不要把多操作大脚本塞进 single `EncodedCommand`
## 何时读取 reference
@@ -62,9 +62,12 @@ trans D601:win/c/test tail -n 40 README.md
trans D601:win/c/test stat README.md
trans D601:win/c/test wc README.md
trans D601:win/c/test rg -i needle .
trans D601:win/c/test git status --short --branch
trans D601:win/c/test git diff --check
trans D601:win/c/test git commit -m 'fix: update docs'
```
Windows operation 必须显式区分:`ps` 走 PowerShell`cmd` 走 cmd.exe`pwd|ls|cat|head|tail|stat|wc|rg` 是 Windows 文件系统只读 helper,带 UTF-8/binary 检查和输出上限,不表示 Windows route 有 POSIX `sh`/`bash`。其中 `rg` 是受限 UTF-8 正则搜索子集,支持 `-i/--ignore-case``-F/--fixed-strings``-n``-m/--max-count``--max-files``--max-bytes`
Windows route 里的 `win` 只表示 route plane,后面 operation 直接写 `ps``cmd``git` 或 fs helper;不要写成 `trans D601:win/... win ps`。Windows operation 必须显式区分:`ps` 走 PowerShell`cmd` 走 cmd.exe。`git` 是 Windows cmd convenience wrapper,会通过 Windows cmd 在 route cwd 下执行,支持 `git status``git diff` 和非交互 `git commit -m ...` 等常规 argv 形态;会打开编辑器或需要复杂 shell 审阅的命令请用 `ps``cmd` 包装`pwd|ls|cat|head|tail|stat|wc|rg` 是 Windows 文件系统只读 helper,带 UTF-8/binary 检查和输出上限,不表示 Windows route 有 POSIX `sh`/`bash`。其中 `rg` 是受限 UTF-8 正则搜索子集,支持 `-i/--ignore-case``-F/--fixed-strings``-n``-m/--max-count``--max-files``--max-bytes`
扩展 Windows helper 时保持 operation-scoped PowerShell payload。不要把多 operation 的大 switch 一次性塞进 single `EncodedCommand`;超过 Windows/WSL argv 限制时,常见表现是 `/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe: Invalid argument`,stderr 不会指出真实原因。需要更长逻辑时优先拆短 helper 或切到临时脚本/受控 stdin 路径。