@jacks001314/codex-go-linux-arm64 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +225 -0
  2. package/package.json +19 -0
  3. package/vendor/codex +0 -0
package/README.md ADDED
@@ -0,0 +1,225 @@
1
+ # Codex Go
2
+
3
+ Parity candidate for Rust baseline `1e20272fa5`: `go-1e20272fa5-parity.1`.
4
+ See [release notes](./docs/release_notes_1e20272fa5.md) and [sync plan](./plan.md).
5
+
6
+ `codex_go` 是 Codex CLI 的 Go 实现,目标是逐步对齐 Rust 版 Codex CLI 的命令行行为、配置语义、认证、模型请求、TUI、app-server、MCP、插件、沙箱和会话能力。
7
+
8
+ 当前仓库是迁移中的工程版本。开发时以 Rust 版本为行为基线,进度和待办以 [plan.md](./plan.md) 为准。
9
+
10
+ ## 环境要求
11
+
12
+ - Go 1.26.2+
13
+ - 推荐使用 Go toolchain 1.26.2
14
+ - Windows、Linux 或 macOS
15
+
16
+ 模块信息见 [go.mod](./go.mod)。
17
+
18
+ ## 快速开始
19
+
20
+ 构建 CLI:
21
+
22
+ ```powershell
23
+ go build -o .\bin\codex.exe .\cmd\codex
24
+ ```
25
+
26
+ 直接运行:
27
+
28
+ ```powershell
29
+ go run .\cmd\codex -- "解释当前目录的代码结构"
30
+ ```
31
+
32
+ 非交互执行:
33
+
34
+ ```powershell
35
+ go run .\cmd\codex exec "用一句话总结这个项目"
36
+ ```
37
+
38
+ 登录状态:
39
+
40
+ ```powershell
41
+ go run .\cmd\codex login status
42
+ ```
43
+
44
+ 使用 API key 登录时从 stdin 读取密钥:
45
+
46
+ ```powershell
47
+ $env:OPENAI_API_KEY | go run .\cmd\codex login --with-api-key
48
+ ```
49
+
50
+ ## 常用命令
51
+
52
+ ```text
53
+ codex [OPTIONS] [PROMPT] 启动交互式 TUI,或用 PROMPT 开始会话
54
+ codex exec [OPTIONS] [PROMPT] 非交互执行
55
+ codex review [OPTIONS] 代码审查
56
+ codex login 登录 ChatGPT
57
+ codex login --with-api-key 从 stdin 保存 API key
58
+ codex login status 查看登录状态
59
+ codex logout 退出登录
60
+ codex features list 查看功能开关
61
+ codex mcp ... 管理 MCP server 配置和登录
62
+ codex plugin ... 管理插件和 marketplace
63
+ codex app-server ... 启动或管理 app-server
64
+ codex mcp-server 以 MCP server 方式运行 Codex
65
+ codex sandbox -- COMMAND 在权限配置下运行命令
66
+ codex doctor 环境诊断
67
+ codex completion [SHELL] 生成 shell completion
68
+ ```
69
+
70
+ 根级常用选项:
71
+
72
+ ```text
73
+ -c, --config KEY=VALUE 覆盖配置
74
+ --enable FEATURE 启用功能开关
75
+ --disable FEATURE 禁用功能开关
76
+ -m, --model MODEL 指定模型
77
+ -p, --profile PROFILE 使用配置 profile
78
+ -C, --cd DIR 指定工作目录
79
+ --add-dir DIR 增加可访问目录
80
+ --sandbox PROFILE 指定沙箱策略
81
+ --ask-for-approval POLICY 指定审批策略
82
+ ```
83
+
84
+ ## 测试与检查
85
+
86
+ 包加载检查:
87
+
88
+ ```powershell
89
+ go list -buildvcs=false ./...
90
+ ```
91
+
92
+ 运行全部测试:
93
+
94
+ ```powershell
95
+ go test ./...
96
+ ```
97
+
98
+ 如果本机 Go 缓存目录受限,可以临时指定缓存:
99
+
100
+ ```powershell
101
+ $env:GOCACHE = Join-Path $env:TEMP 'codex_go_gocache'
102
+ go test ./...
103
+ ```
104
+
105
+ 格式化:
106
+
107
+ ```powershell
108
+ go fmt ./...
109
+ ```
110
+
111
+ ## 编译、安装与发布
112
+
113
+ ### npm 安装
114
+
115
+ 发布后的全局安装命令:
116
+
117
+ ```powershell
118
+ npm install -g @jacks001314/codex-go
119
+ gcode --version
120
+ ```
121
+
122
+ npm 对外暴露的命令名为 `gcode`,避免与官方 `codex` 命令冲突;底层原生二进制仍名为 `codex`。主包会根据当前操作系统和 CPU 架构自动安装对应的原生二进制包。发布新版本时先构建七个 tarball,再按“六个平台包、主包”的顺序发布:
123
+
124
+ ```powershell
125
+ node .\npm\scripts\build-packages.mjs --version 0.1.0
126
+ node .\npm\scripts\publish-packages.mjs --directory .\dist\v0.1.0\npm
127
+ ```
128
+
129
+ 如果 npm 账号要求发布时进行双因素认证,请传入认证器当前生成的 OTP:
130
+
131
+ ```powershell
132
+ node .\npm\scripts\publish-packages.mjs --directory .\dist\v0.1.0\npm --otp 123456
133
+ ```
134
+
135
+ 发布需要登录 npm 账号 `jacks001314`;预发布可追加 `--tag next`。CI 发布应使用启用了 `Bypass 2FA` 的 granular access token,避免交互式 OTP 过期。
136
+
137
+ 编译当前平台的开发版本:
138
+
139
+ ```powershell
140
+ .\scripts\build.ps1
141
+ ```
142
+
143
+ 编译指定版本和目标平台:
144
+
145
+ ```powershell
146
+ .\scripts\build.ps1 -Version 0.1.0 -GOOS linux -GOARCH amd64 -CGO off
147
+ ```
148
+
149
+ 从当前源码安装。Windows 默认安装到 `%LOCALAPPDATA%\Programs\CodexGo\bin`,
150
+ 其他系统默认安装到 `~/.local/bin`:
151
+
152
+ ```powershell
153
+ .\scripts\install.ps1 -Version 0.1.0
154
+ ```
155
+
156
+ 也可以指定安装目录:
157
+
158
+ ```powershell
159
+ .\scripts\install.ps1 -InstallDir C:\Tools\CodexGo -Force
160
+ ```
161
+
162
+ 生成 Windows、Linux 和 macOS 的 amd64/arm64 发布包及 SHA-256 校验清单:
163
+
164
+ ```powershell
165
+ .\scripts\release.ps1 -Version 0.1.0
166
+ ```
167
+
168
+ 发布产物默认写入 `dist/v<版本号>`。可用 `-Targets windows/amd64,linux/amd64`
169
+ 限制目标平台,或用 `-SkipTests` 跳过发布前的全包编译检查。
170
+
171
+ Linux、macOS、WSL 或其他 POSIX Shell 环境可以使用对应的 Shell 脚本:
172
+
173
+ ```sh
174
+ ./scripts/build.sh --version 0.1.0
175
+ ./scripts/install.sh --version 0.1.0
176
+ ./scripts/release.sh --version 0.1.0
177
+ ```
178
+
179
+ 指定发布目标:
180
+
181
+ ```sh
182
+ ./scripts/release.sh --version 0.1.0 \
183
+ --targets 'linux/amd64 linux/arm64 darwin/arm64'
184
+ ```
185
+
186
+ ## 目录结构
187
+
188
+ ```text
189
+ cmd/codex 可执行入口
190
+ app 顶层命令分发和运行时拼装
191
+ cli 命令行解析、参数校验、dispatch alias
192
+ config 配置加载、profile、feature override、权限配置
193
+ auth 登录凭据、auth.json、OAuth/API key/access token
194
+ model 模型 provider、Responses 请求/流式事件、模型 catalog
195
+ codexapi OpenAI/Codex API 客户端辅助
196
+ turn agent loop、tool dispatch、turn runtime
197
+ tool shell/apply_patch/MCP/tool_search/agent 工具运行时
198
+ exec codex exec/review 的非交互运行
199
+ appserver JSON-RPC app-server、thread/turn/runtime 服务
200
+ mcp MCP client/server、OAuth、resource、tool runtime
201
+ tui 终端 UI 状态、渲染、组件和 Bubble Tea adapter
202
+ session 会话存储、resume/fork/archive/delete
203
+ rollout rollout JSONL 记录和恢复
204
+ sandbox 权限 profile、Linux/Windows 沙箱、执行计划
205
+ review review 目标解析和 git diff 采集
206
+ doctor 环境诊断
207
+ plugin 插件 manifest、marketplace、安装流程
208
+ agent 多 agent graph、身份、registry、工具
209
+ utils 路径、JSON、ANSI、LRU、截断等共享工具
210
+ docs 设计和技术选型文档
211
+ ```
212
+
213
+ ## 开发约定
214
+
215
+ - 以 Rust 版 Codex 的行为和协议形状为基线。
216
+ - 新功能优先放入已有功能包,避免无必要地新增目录。
217
+ - 结构体参数和结构体返回值默认优先使用指针,简单标量按 Go 惯例传值。
218
+ - 代码变更后至少运行相关包测试;模块收口时运行 `go list -buildvcs=false ./...` 和 `go test ./...`。
219
+ - 迁移进度、验收项和工作日志维护在 [plan.md](./plan.md)。
220
+
221
+ ## 参考文档
222
+
223
+ - [plan.md](./plan.md):迁移进度和待办
224
+ - [desgn.md](./desgn.md):迁移设计草案
225
+ - [docs/tui_tech_selection.md](./docs/tui_tech_selection.md):TUI 技术选型
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@jacks001314/codex-go-linux-arm64",
3
+ "version": "0.1.0",
4
+ "description": "Native binary for @jacks001314/codex-go (linux-arm64)",
5
+ "license": "Apache-2.0",
6
+ "os": [
7
+ "linux"
8
+ ],
9
+ "cpu": [
10
+ "arm64"
11
+ ],
12
+ "files": [
13
+ "vendor"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/jacks001314/codex_go.git"
18
+ }
19
+ }
package/vendor/codex ADDED
Binary file