ZCode 内置终端的目标不是维护一份固定字体清单,而是尽量继承用户系统终端已经生效的 profile。这样使用 oh-my-zsh、oh-my-posh、Nerd Font、kubectl 代理和自定义 Kube 配置时,内置终端更接近用户直接打开系统终端的效果。
packages/services/src/runtime-tools/runtimeCommandEnv.ts:负责登录 shell 环境继承。packages/services/src/terminal/terminalProfile.ts:负责终端字体 profile 检测,内部通过 detector 注册表扩展不同终端来源。packages/services/src/terminal/terminalService.ts:创建 PTY 时返回解析后的字体 profile。packages/ui/src/terminal/TerminalSession.tsx:把服务端返回的字体和受限 profile theme 应用到 xterm。新增 WezTerm 或其他终端来源时,在 terminalProfile.ts 中增加一个 TerminalFontDetector,实现 detect(env) 并注册到 TERMINAL_FONT_DETECTORS。主流程不需要变更。
iTerm2 和 macOS Terminal 属于 best-effort detector:只尝试读取本机 plist,读取失败、格式异常或字段不存在时返回 null,继续尝试下一个 detector,不影响终端启动。
macOS profile detector 可能会读取到 background / foreground / cursor / cursorAccent,但 UI 合并阶段会丢弃这些字段。原因是这些字段属于 ZCode 窗口主题的基础可读性边界,不应该被某个系统终端 profile 覆盖;否则浅色 app 中可能出现深色终端块,或光标和当前 terminal 背景撞色后不可见,和 Windows 目前只继承字体的行为也不一致。