terminal-opener

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Terminal Opener

终端启动工具

Use
scripts/open-terminal.js
to preserve an executable and every argument as separate process entries. Never interpolate a shell command string. Keep every spawn on
shell: false
. Default to a non-launching plan. Use
--launch
only after the user explicitly requests a real window and the argv has been reviewed. The launched process inherits the full environment of the calling process, including secret-bearing variables. The launcher does not filter the environment. Run it from a shell whose environment is safe to expose to the target command.
使用
scripts/open-terminal.js
将可执行文件及其每个参数保留为独立的进程条目。切勿拼接Shell命令字符串。所有进程启动都保持
shell: false
配置。默认采用非启动模式。仅当用户明确请求真实窗口且参数数组(argv)已审核通过后,才使用
--launch
参数。启动的进程会继承调用进程的完整环境,包括包含密钥的变量。启动器不会过滤环境变量,请从环境安全的Shell中运行它,确保目标命令可以安全访问这些环境变量。

Launch a command

启动命令

Pass launcher options before
--
, then pass exactly one executable followed by its argument array:
bash
node skills/terminal-opener/scripts/open-terminal.js \
  --launch \
  --cwd /absolute/host/path \
  -- ssh -t example.test command-with-arguments
Run normal mode first. Let WezTerm try its mux with a new window, then let the launcher fall back to a detached
wezterm start
process if the mux is not available. When fallback is used, read
muxFailure
from JSON output (or the human-readable failure line) to diagnose why the mux path failed.
--
之前传入启动器选项,然后传入一个可执行文件及其参数数组:
bash
node skills/terminal-opener/scripts/open-terminal.js \
  --launch \
  --cwd /absolute/host/path \
  -- ssh -t example.test command-with-arguments
先运行普通模式。让WezTerm尝试通过其多路复用器(mux)打开新窗口,如果多路复用器不可用,则启动器会回退到分离的
wezterm start
进程。使用回退模式时,可从JSON输出(或人类可读的失败信息行)中读取
muxFailure
来诊断多路复用器路径失败的原因。

Recover from terminal configuration

从终端配置中恢复

Add
--recover
or
--standalone
when user configuration or mux state may interfere with the requested command. Start a detached WezTerm process with:
text
--skip-config start --always-new-process
Expect recovery mode to skip all user terminal configuration intentionally.
当用户配置或多路复用器状态可能干扰请求的命令时,添加
--recover
--standalone
参数。启动一个分离的WezTerm进程,使用以下参数:
text
--skip-config start --always-new-process
恢复模式会有意跳过所有用户终端配置。

Inspect before launch

启动前检查

Omit
--launch
(or add
--dry-run
) and add
--json
to inspect the exact executable, argv, working directory, terminal adapter, primary launch, and fallback without opening a window. Treat the JSON plan as the composition boundary for callers.
Run
--detect --json
without a command to probe terminal availability. Follow the returned
action
when the adapter is missing or unsupported. Use WezTerm for the current adapter; treat other requested terminals as unsupported plans, not as commands to execute.
省略
--launch
(或添加
--dry-run
)并添加
--json
参数,即可在不打开窗口的情况下查看确切的可执行文件、参数数组、工作目录、终端适配器、主启动方案和回退方案。将JSON方案作为调用方的组合边界。
运行
--detect --json
且不传入命令,即可探测终端可用性。当适配器缺失或不被支持时,按照返回的
action
操作。当前使用WezTerm作为适配器;其他请求的终端视为不支持的方案,而非可执行的命令。