Skip to content

Fix Windows Codex CLI commands / 修复 Windows CLI 命令与版本检测 - #20

Merged
VallierDev merged 1 commit into
VallierDev:mainfrom
eerraa:fix/windows-cli-commands
Sep 19, 2026
Merged

VallierDev merged 1 commit into
VallierDev:mainfrom
eerraa:fix/windows-cli-commands

Conversation

@eerraa

@eerraa eerraa commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

English · 简体中文

English

Give Windows users a command their shell can run, and let version discovery find npm's codex.cmd without rewriting Windows PATH as a Unix path.

Two Windows-specific mismatches

Entry point Existing behavior Narrow correction
Proxy page: displayed/copied local and LAN launch commands OPENAI_BASE_URL=... codex is POSIX syntax, not PowerShell syntax. Use $env:OPENAI_BASE_URL='...'; codex on Windows, escape literal apostrophes, and use the same formatter for the displayed and copied text.
Native Codex version probe Appends Unix directories with : to inherited PATH and invokes codex without explicit handling of npm's Windows command shim. Run the fixed codex --version command through the Windows system cmd.exe, preserve inherited PATH, and suppress a console window.

Scope and compatibility

The changes are 4 files, one commit. The existing non-Windows launch-command format and version-probe path are retained.

This does not create terminals, terminate processes, write persistent environment variables or config.toml, replace the clipboard API, or change providers, credentials, or request routing. It adds no package dependency or Korean localization. The task is to correct shell syntax and executable lookup, not to redesign proxy setup.

Verification

Local Windows validation at head bf091be passed:

npm run build
node --test scripts/windows-cli.test.mjs
cargo test --locked --manifest-path src-tauri/Cargo.toml --lib codex_ua::windows_tests

The 3 frontend tests check PowerShell quoting, unchanged non-Windows output, and consistent display/copy formatting. The native test checks fixed Windows command arguments and that the probe does not rewrite PATH. These are command-construction tests; they do not claim to cover every Codex installation layout or a live authenticated Codex session.

Independent review: one commit directly on upstream main (f64a44a), with no dependency on the clipboard, tray, or other split PRs.


简体中文

让 Windows 用户复制到的是 PowerShell 能执行的命令,并让版本检测能处理 npm 的 codex.cmd,而不是按 Unix 方式改写 Windows PATH。

两处 Windows 平台不匹配

入口 现有行为 本次修正
代理页:本机/LAN 启动命令的显示与复制 OPENAI_BASE_URL=... codex 是 POSIX 写法,不是 PowerShell 写法。 Windows 下生成 $env:OPENAI_BASE_URL='...'; codex,正确处理单引号,并让显示和复制共用同一格式化函数。
原生 Codex 版本检测 使用 : 向继承的 PATH 追加 Unix 目录,且未显式处理 npm 在 Windows 上的命令入口。 通过 Windows 系统 cmd.exe 执行固定的 codex --version 命令,保留继承的 PATH,并避免弹出控制台窗口。

修改边界与兼容性

**4 个文件、1 个提交。**非 Windows 的启动命令格式和版本检测路径保持原有行为。

不创建终端、不结束进程、不写持久化环境变量或 config.toml,不替换剪贴板 API,也不改 Provider、凭据或请求路由。不增加依赖或韩语本地化。这次只解决命令语法与程序查找,不重新设计代理配置流程。

验证依据

在 Windows 上针对当前提交 bf091be 完成本地验证:

npm run build
node --test scripts/windows-cli.test.mjs
cargo test --locked --manifest-path src-tauri/Cargo.toml --lib codex_ua::windows_tests

3 个前端测试覆盖 PowerShell 引号处理、非 Windows 输出保持不变,以及显示/复制内容一致;原生测试检查固定的 Windows 命令参数和 PATH 不被改写。验证范围是命令构造,不宣称覆盖所有 Codex 安装方式或真实已登录的 Codex 会话。

**可独立审阅和合并:**直接基于 upstream main(f64a44a)的单个提交,不依赖剪贴板、托盘或其他拆分 PR。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants