@jacks001314/codex-go-darwin-x64
v1.1.5
Published
Native binary for @jacks001314/codex-go (darwin-x64)
Readme
Codex Go
The current alignment candidate is Rust main at 3f65e9f13165d85d1b1fbe20ce06c55758f927b9; see the
2026-11-25 sync record. Per-commit certification for the candidate window is still in progress, so parity/commits.json records every upstream commit with its audit status.
parity.json records the current SDK and implementation evidence. Candidate baseline, commit, domain, and contract state live under parity/; only parity/baseline.json with certificationReady: true denotes a fully certified release.
codex_go 是 Codex CLI 的 Go 实现,目标是逐步对齐 Rust 版 Codex CLI 的命令行行为、配置语义、认证、模型请求、TUI、app-server、MCP、插件、沙箱和会话能力。
当前仓库是迁移中的工程版本。开发时以 Rust 版本为行为基线,进度和待办以 update/plan_2026_11_08_ledger.md 与 parity/README.md 为准。
环境要求
- Go 1.26.2+
- 推荐使用 Go toolchain 1.26.2
- Windows、Linux 或 macOS
模块信息见 go.mod。
快速开始
构建 CLI:
go build -o .\bin\codex.exe .\cmd\codex直接运行:
go run .\cmd\codex -- "解释当前目录的代码结构"非交互执行:
go run .\cmd\codex exec "用一句话总结这个项目"登录状态:
go run .\cmd\codex login status使用 API key 登录时从 stdin 读取密钥:
$env:OPENAI_API_KEY | go run .\cmd\codex login --with-api-key常用命令
codex [OPTIONS] [PROMPT] 启动交互式 TUI,或用 PROMPT 开始会话
codex exec [OPTIONS] [PROMPT] 非交互执行
codex review [OPTIONS] 代码审查
codex login 登录 ChatGPT
codex login --with-api-key 从 stdin 保存 API key
codex login status 查看登录状态
codex logout 退出登录
codex features list 查看功能开关
codex mcp ... 管理 MCP server 配置和登录
codex plugin ... 管理插件和 marketplace
codex app-server ... 启动或管理 app-server
codex sandbox -- COMMAND 在权限配置下运行命令
codex doctor 环境诊断
codex completion [SHELL] 生成 shell completion根级常用选项:
-c, --config KEY=VALUE 覆盖配置
--enable FEATURE 启用功能开关
--disable FEATURE 禁用功能开关
-m, --model MODEL 指定模型
-p, --profile PROFILE 使用配置 profile
-C, --cd DIR 指定工作目录
--add-dir DIR 增加可访问目录
--sandbox PROFILE 指定沙箱策略
--ask-for-approval POLICY 指定审批策略测试与检查
包加载检查:
go list -buildvcs=false ./...运行全部测试:
go test ./...如果本机 Go 缓存目录受限,可以临时指定缓存:
$env:GOCACHE = Join-Path $env:TEMP 'codex_go_gocache'
go test ./...格式化:
go fmt ./...编译、安装与发布
npm 安装
发布后的全局安装命令:
npm install -g @jacks001314/codex-go
gcode --versionnpm 对外暴露的命令名为 gcode,避免与官方 codex 命令冲突;底层原生二进制仍名为 codex。主包会根据当前操作系统和 CPU 架构自动安装对应的原生二进制包。发布新版本时先构建七个 tarball,再按“六个平台包、主包”的顺序发布:
node .\npm\scripts\build-packages.mjs --version 0.1.0
node .\npm\scripts\publish-packages.mjs --directory .\dist\v0.1.0\npm如果 npm 账号要求发布时进行双因素认证,请传入认证器当前生成的 OTP:
node .\npm\scripts\publish-packages.mjs --directory .\dist\v0.1.0\npm --otp 123456发布需要登录 npm 账号 jacks001314;预发布可追加 --tag next。CI 发布应使用启用了 Bypass 2FA 的 granular access token,避免交互式 OTP 过期。
编译当前平台的开发版本:
.\scripts\build.ps1Windows builds also write codex-command-runner.exe and
codex-windows-sandbox-setup.exe under bin\codex-resources. NPM platform
packages use the official vendor/<target-triple>/bin layout with a sibling
codex-resources directory.
编译指定版本和目标平台:
.\scripts\build.ps1 -Version 0.1.0 -GOOS linux -GOARCH amd64 -CGO off从当前源码安装。Windows 默认安装到 %LOCALAPPDATA%\Programs\CodexGo\bin,
其他系统默认安装到 ~/.local/bin:
.\scripts\install.ps1 -Version 0.1.0也可以指定安装目录:
.\scripts\install.ps1 -InstallDir C:\Tools\CodexGo -Force生成 Windows、Linux 和 macOS 的 amd64/arm64 发布包及 SHA-256 校验清单:
.\scripts\release.ps1 -Version 0.1.0发布产物默认写入 dist/v<版本号>。可用 -Targets windows/amd64,linux/amd64
限制目标平台,或用 -SkipTests 跳过发布前的全包编译检查。
Linux、macOS、WSL 或其他 POSIX Shell 环境可以使用对应的 Shell 脚本:
./scripts/build.sh --version 0.1.0
./scripts/install.sh --version 0.1.0
./scripts/release.sh --version 0.1.0指定发布目标:
./scripts/release.sh --version 0.1.0 \
--targets 'linux/amd64 linux/arm64 darwin/arm64'目录结构
cmd/codex 可执行入口
app 顶层命令分发和运行时拼装
cli 命令行解析、参数校验、dispatch alias
config 配置加载、profile、feature override、权限配置
auth 登录凭据、auth.json、OAuth/API key/access token
model 模型 provider、Responses 请求/流式事件、模型 catalog
codexapi OpenAI/Codex API 客户端辅助
turn agent loop、tool dispatch、turn runtime
tool shell/apply_patch/MCP/tool_search/agent 工具运行时
exec codex exec/review 的非交互运行
appserver JSON-RPC app-server、thread/turn/runtime 服务
mcp MCP client/server、OAuth、resource、tool runtime
tui 终端 UI 状态、渲染、组件和 Bubble Tea adapter
session 会话存储、resume/fork/archive/delete
rollout rollout JSONL 记录和恢复
sandbox 权限 profile、Linux/Windows 沙箱、执行计划
review review 目标解析和 git diff 采集
doctor 环境诊断
plugin 插件 manifest、marketplace、安装流程
agent 多 agent graph、身份、registry、工具
utils 路径、JSON、ANSI、LRU、截断等共享工具
docs 设计和技术选型文档开发约定
- 以 Rust 版 Codex 的行为和协议形状为基线。
- 新功能优先放入已有功能包,避免无必要地新增目录。
- 结构体参数和结构体返回值默认优先使用指针,简单标量按 Go 惯例传值。
- 代码变更后至少运行相关包测试;模块收口时运行
go list -buildvcs=false ./...和go test ./...。 - 迁移进度、验收项和工作日志维护在 update/(最新一轮见 plan_2026_11_08_ledger.md)。
参考文档
- update/plan_2026_11_08_ledger.md:迁移进度和待办(当前对齐轮次)
- parity/README.md:对齐控制面(基线、提交账本、领域与契约)
- tui_alignment.md:TUI 对齐与选型记录
许可证
本项目基于上游 OpenAI Codex 的 Apache-2.0 许可实现,同样以 Apache License 2.0 发布。
分发二进制或 npm 包时必须一并携带 LICENSE 与 NOTICE(scripts/release.ps1、scripts/release.sh、npm/scripts/build-packages.mjs 已自动打包)。
