Skip to content

Windows 安装器:可选生成 CLI service shim - #87

Open
534A4D21 wants to merge 2 commits into
Qjzn:mainfrom
534A4D21:codex/cli-shim
Open

Windows 安装器:可选生成 CLI service shim#87
534A4D21 wants to merge 2 commits into
Qjzn:mainfrom
534A4D21:codex/cli-shim

Conversation

@534A4D21

@534A4D21 534A4D21 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

变更摘要

  • 为 Windows bootstrap 和安装器新增可选参数 -CreateCliShim
  • 生成面向当前用户的 cx-codex.cmd,指向受管的 Release CLI
  • 卸载时保护无关的同名 shim,并补充安装文档

背景与方案

官方 Windows 安装器目前会生成 cx-codex-start.cmd,但没有提供简洁的 cx-codex CLI 命令。本变更增加可选 shim,且不安装 npm 全局包。

指定 -CreateCliShim 后,安装器会生成:

%USERPROFILE%\.local\bin\cx-codex.cmd

该 shim 调用当前受管安装目录中的:

%LOCALAPPDATA%\CX-Codex\dist-cli\index.js

默认安装行为保持不变。卸载时,仅当 shim 内容明确指向当前受管的 CX-Codex 安装目录才会删除;如果检测到是其他来源,则保留并提示。

验证结果

  • bootstrap、安装器和卸载器脚本的 PowerShell 语法解析通过
  • release-capabilities.json JSON 解析通过
  • 修改文件均无 BOM
  • git diff --check 通过
  • 按当前仓库约束未运行单元测试

@Qjzn Qjzn left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

暂不建议合入 main。主要阻塞点:

  1. -CreateCliShim 安装路径会无条件 Set-Content 到 %USERPROFILE%.local\bin\cx-codex.cmd,如果用户已有同名命令,会被覆盖。
  2. 卸载侧已经有“非 CX-Codex shim 保留”的保护,但安装侧缺少同等级的所有权校验,因此风险不对称。
  3. 建议补齐:安装时检测已有 shim;若不是当前 CX-Codex 管理的 shim,则保留并输出 warning,或增加显式 -ForceCliShim 才允许覆盖;同时补一个 smoke 用例覆盖“已有外部 shim 不被覆盖”和“已有 CX-Codex shim 可更新”。

补充:main 的依赖安全告警已通过 #89 组合处理;本 PR 后续 rebase 到最新 main 后再重新跑 CI。

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