feat: support Windows cmd stdin scripts

This commit is contained in:
Codex
2026-06-06 02:05:29 +00:00
parent 0bae3af934
commit df8be84690
2 changed files with 42 additions and 2 deletions
+2
View File
@@ -168,6 +168,7 @@ export function sshHelp(): unknown {
"trans <providerId> find <path...> [--contains TEXT] [--limit N]",
"trans <providerId> glob [--root DIR] [--pattern PATTERN]",
"trans D601:/home/ubuntu/workspace/hwlab-dev git status --short --branch",
"trans D601:win/c/test cmd <<'CMD'",
"trans D601:win cmd ver",
"trans D601:win/c/test cmd cd",
"trans D601:win skills [--scope agents|codex|all] [--limit N]",
@@ -191,6 +192,7 @@ export function sshHelp(): unknown {
notes: [
"trans --help and trans <route> --help print this JSON help and never open an interactive session; the underlying ssh subcommand keeps the same help behavior.",
"For non-interactive remote commands, prefer argv for a single process and script/stdin for shell logic.",
"For Windows routes, prefer `trans <provider>:win/<drive>/<path> cmd <<'CMD'` for multi-step cmd.exe logic; `cmd` with no command-line arguments reads the UTF-8 batch body from stdin, injects UTF-8/Python encoding defaults, runs it from a temp .cmd file, and deletes the temp file.",
"`argv` executes direct argv tokens only: `trans <route> argv ls -la` is valid, but `trans <route> argv 'ls -la'` is rejected because the single string would be treated as an executable path; use `script -- 'ls -la'` for one-line shell logic.",
"For one-line remote shell logic without a heredoc, use `script -- '<command && command>'`; outer shell operators written outside trans, such as `trans G14:/repo sed ... && sed ...`, are parsed by the local shell before UniDesk starts and therefore cannot be redirected by the CLI. The explicit `shell '<command>'` operation remains available for the same sh -c path.",
"When a one-line shell command is easier to type through the script path, `script -- '<command && command>'` runs that single string through the remote shell without waiting for stdin. When `script --` is followed by multiple tokens, it stays a direct argv form for commands such as `trans D601:/work script -- sed -n '1,20p' file`.",