@minniexcode/codex-switch 0.0.12 → 0.1.1

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 (36) hide show
  1. package/README.AI.md +37 -6
  2. package/README.CN.md +45 -11
  3. package/README.md +45 -13
  4. package/dist/app/add-provider.js +22 -24
  5. package/dist/app/edit-provider.js +34 -55
  6. package/dist/app/get-current-profile.js +15 -3
  7. package/dist/app/get-status.js +11 -8
  8. package/dist/app/list-config-profiles.js +3 -1
  9. package/dist/app/list-providers.js +10 -4
  10. package/dist/app/remove-provider.js +52 -19
  11. package/dist/app/run-doctor.js +29 -28
  12. package/dist/app/setup-codex.js +3 -3
  13. package/dist/app/show-config.js +3 -1
  14. package/dist/app/switch-provider.js +36 -5
  15. package/dist/cli/output.js +36 -18
  16. package/dist/commands/handlers.js +2 -2
  17. package/dist/commands/help.js +3 -3
  18. package/dist/commands/registry.js +35 -30
  19. package/dist/domain/config.js +250 -185
  20. package/dist/domain/providers.js +23 -0
  21. package/dist/domain/runtime-state.js +15 -15
  22. package/dist/domain/setup.js +3 -1
  23. package/dist/interaction/interactive.js +2 -2
  24. package/dist/runtime/codex-version.js +7 -0
  25. package/dist/storage/config-repo.js +6 -14
  26. package/docs/Design/codex-switch-v0.1.0-design.md +152 -0
  27. package/docs/Design/codex-switch-v0.1.1-design.md +33 -0
  28. package/docs/PRD/codex-switch-prd-v0.1.0.md +217 -205
  29. package/docs/Reference/codex-config-reference.md +41 -0
  30. package/docs/Reference/codex-config-reference.zh-CN.md +41 -0
  31. package/docs/Tests/testing.md +31 -78
  32. package/docs/cli-usage.md +86 -27
  33. package/docs/codex-switch-command-design.md +649 -649
  34. package/docs/codex-switch-product-overview.md +81 -80
  35. package/docs/codex-switch-technical-architecture.md +1115 -1115
  36. package/package.json +51 -51
@@ -1,205 +1,217 @@
1
- # codex-switch `0.1.0` Release Gate PRD
2
-
3
- ## 文档信息
4
-
5
- - 状态:Release Gate Draft
6
- - 产品名:`codex-switch`
7
- - CLI 命令名:`codexs`
8
- - 当前预发布基线:`0.0.12` beta
9
- - 目标版本:`0.1.0`
10
- - 文档定位:定义 `codex-switch` 何时可以从 `0.0.x` 进入第一个正式稳定发布版本
11
- - 关联 beta PRD:[`./codex-switch-prd-v0.0.12.md`](./codex-switch-prd-v0.0.12.md)
12
- - 关联长期演进稿:[`./codex-switch-prd-v0.0.5-to-v0.1.0.md`](./codex-switch-prd-v0.0.5-to-v0.1.0.md)
13
-
14
- ## 一句话定义
15
-
16
- `0.1.0` 不是“功能再多一点”的版本,而是 `codex-switch` 第一条可正式对外承诺的稳定产品线:命令入口稳定、输出契约稳定、主工作流清晰、恢复与诊断可信、文档与包内容一致。
17
-
18
- ## 发布语义
19
-
20
- 一旦进入 `0.1.0`,这个版本就不再只是“作者自己知道怎么用”的工具,而需要满足:
21
-
22
- - 新用户看 README 与 help 就能走通主路径
23
- - 自动化调用方可以信赖 `--json` 的稳定契约
24
- - direct provider 和 Copilot provider 都有明确、可解释、可恢复的工作流
25
- - 文档、包内容、help、测试和实际行为是同一套事实
26
-
27
- `0.1.0` 不是自动升级目标。只有当 release gate 满足时,才允许发布。
28
-
29
- ## `0.1.0` 必须稳定的内容
30
-
31
- ### 1. CLI 命令面
32
-
33
- 以下命令面在 `0.1.0` 时视为稳定:
34
-
35
- - `init`
36
- - `login`
37
- - `list`
38
- - `show`
39
- - `current`
40
- - `status`
41
- - `doctor`
42
- - `config show`
43
- - `config list-profiles`
44
- - `add`
45
- - `edit`
46
- - `switch`
47
- - `remove`
48
- - `import`
49
- - `export`
50
- - `bridge start`
51
- - `bridge status`
52
- - `bridge stop`
53
- - `backups list`
54
- - `rollback`
55
-
56
- 说明:
57
-
58
- - `setup` 可以继续保留为 deprecated entry
59
- - `migrate` 可以继续保留,但其“高级 adopt 工具”定位必须明确
60
-
61
- ### 2. JSON Envelope
62
-
63
- `--json` 顶层 envelope 在 `0.1.0` 前必须冻结为:
64
-
65
- ```json
66
- {
67
- "ok": true,
68
- "command": "list",
69
- "data": {},
70
- "warnings": [],
71
- "error": null
72
- }
73
- ```
74
-
75
- 要求:
76
-
77
- - 顶层字段不改名
78
- - 顶层 shape 不重排
79
- - 新信息只允许追加到 `data`、`warnings` 或 `error.details`
80
-
81
- ### 3. 双路径模型
82
-
83
- `0.1.0` 前必须把以下边界视为正式产品 contract:
84
-
85
- - tool home:
86
- - `codex-switch.json`
87
- - `providers.json`
88
- - `backups/`
89
- - `runtime/`
90
- - `runtimes/`
91
- - target Codex runtime:
92
- - `config.toml`
93
- - `auth.json`
94
-
95
- 其中:
96
-
97
- - `providers.json` 是管理态 SSOT
98
- - `config.toml` 是受管 runtime routing 文件
99
- - `auth.json` 是受管 auth projection 文件
100
-
101
- ### 4. 主工作流
102
-
103
- #### Direct Provider
104
-
105
- 正式推荐路径必须清晰稳定:
106
-
107
- ```bash
108
- codexs init
109
- codexs add <provider> --profile <name> --api-key <key>
110
- codexs switch <provider>
111
- codexs status
112
- codexs doctor
113
- ```
114
-
115
- #### Copilot Provider
116
-
117
- 正式推荐路径必须清晰稳定:
118
-
119
- ```bash
120
- codexs init
121
- codexs login copilot
122
- codexs add <provider> --copilot --profile <name>
123
- codexs switch <provider>
124
- codexs status
125
- codexs doctor
126
- ```
127
-
128
- #### `migrate`
129
-
130
- `migrate` 在 `0.1.0` 可以保留,但必须满足:
131
-
132
- - 产品定位明确为高级 adopt helper
133
- - 不与 fresh install 主路径混淆
134
- - 文档不把它写成所有用户都应先执行的默认第一步
135
-
136
- ## Release Gate
137
-
138
- 只有以下条件全部满足,才允许发布 `0.1.0`:
139
-
140
- ### A. 工作流可信
141
-
142
- - direct provider 主路径可在 fresh tool home 下稳定走通
143
- - Copilot 主路径可在 fresh tool home 下稳定走通
144
- - `switch` 成功语义仍然等于 config + auth 投影都正确
145
- - `rollback` 对受管写操作仍然可信
146
-
147
- ### B. 输出可信
148
-
149
- - `--json` 读命令输出稳定
150
- - 非交互模式不会意外 prompt
151
- - 错误码和 issue code 对常见失败场景足够稳定
152
- - `status` 与 `doctor` 输出能解释下一步修复动作
153
-
154
- ### C. 文档可信
155
-
156
- - README、README.CN、README.AI、CLI usage、product overview、PRD、changelog 与实际行为一致
157
- - 不再残留旧 `~/.codex/providers.json` / `backups/` 叙述
158
- - 主路径在所有面向用户的文档中一致
159
-
160
- ### D. 包内容可信
161
-
162
- - `npm pack --dry-run` 结果合理
163
- - tarball 中包含正确的 README、LICENSE、docs、dist
164
- - `codexs --help`、`codexs --version`、安装指引与 npm 包元数据一致
165
-
166
- ### E. 结构可信
167
-
168
- - 不再保留明显误导性的历史目录语义
169
- - 关键稳定模块有足够 JSDoc 和边界说明
170
- - 新问题不再需要反复回到超大入口文件做修补
171
-
172
- ## 明确不要求 `0.1.0` 完成的内容
173
-
174
- 以下内容不是 `0.1.0` 的发布前置条件:
175
-
176
- - 新 upstream
177
- - GUI / TUI
178
- - daemon / background supervisor
179
- - plugin system
180
- - 多账号平台
181
- - 自动迁移旧状态
182
- - `migrate` 的完整非交互产品化
183
- - 通用 `config.toml` 编辑器
184
-
185
- ## 若 Release Gate 未通过
186
-
187
- 如果以下任一问题仍明显存在,则不应强行发布 `0.1.0`:
188
-
189
- - 文档和行为仍有明显漂移
190
- - `migrate` 与主路径仍然混淆
191
- - Copilot 路径仍需要过多背景知识才能理解
192
- - 回滚与诊断场景仍存在不稳定或不可解释行为
193
- - 包内容、安装体验或帮助页仍像开发中工具
194
-
195
- 此时应继续发布:
196
-
197
- - `0.0.13`
198
- - `0.0.14`
199
- - 其他后续 beta / rc 版本
200
-
201
- 而不是为了版本号好看提前进入 `0.1.0`。
202
-
203
- ## 结论
204
-
205
- `0.1.0` 的意义,不在于“项目终于到 1.0 之前先过一个数字门槛”,而在于 `codex-switch` 首次具备了可以向外明确承诺的稳定产品边界。只有当工作流、输出、恢复、文档和包发布面都同时稳定时,这个版本号才成立。
1
+ # codex-switch `0.1.0` Release Gate PRD
2
+
3
+ ## 文档信息
4
+
5
+ - 状态:Release Gate
6
+ - 产品名:`codex-switch`
7
+ - CLI 命令名:`codexs`
8
+ - 当前稳定基线:`0.0.12`
9
+ - 目标版本:`0.1.0`
10
+ - 文档定位:定义 `codex-switch` 第一次稳定发布前必须满足的门槛
11
+ - 关联 beta PRD:[`./codex-switch-prd-v0.0.12.md`](./codex-switch-prd-v0.0.12.md)
12
+ - 关联实现约束设计:[`../Design/codex-switch-v0.1.0-design.md`](../Design/codex-switch-v0.1.0-design.md)
13
+ - 关联长期演进稿:[`./codex-switch-prd-v0.0.5-to-v0.1.0.md`](./codex-switch-prd-v0.0.5-to-v0.1.0.md)
14
+
15
+ ## 1. 定位
16
+
17
+ `0.1.0` 是 `codex-switch` 的第一条稳定发布线,不是继续扩 feature surface 的版本,也不是把 `0.0.12` 再包装一次。
18
+
19
+ 这个版本的判断标准只有一个:当前仓库已经足够稳定,能把命令面、输出契约、主工作流、诊断语义和文档事实对外固定下来,并且不需要再依赖开发期解释来“补全理解”。
20
+
21
+ ## 2. 当前阻塞项
22
+
23
+ 以下问题仍然阻止 `0.1.0` 成为真正可发布的稳定版本:
24
+
25
+ 1. `tests/` 被忽略,导致测试无法被版本化和审阅。
26
+ 2. README 里仍有失效的 `docs/Tests/testing.md` 链接,用户会直接遇到死链。
27
+ 3. 版本叙事仍停留在 `0.0.12`,对外材料没有把 `0.1.0` 讲成稳定发布线。
28
+ 4. 发布故事和实现状态还没有完全对齐,尤其是主工作流、`migrate` 定位和 `setup` 定位。
29
+
30
+ 这些阻塞项必须先被收口,`0.1.0` 才能成立。
31
+
32
+ ## 3. `0.1.0` 的稳定合同
33
+
34
+ `0.1.0` 必须把以下内容视为稳定合同,不再当作可随意重写的草案。
35
+
36
+ ### 3.1 命令面
37
+
38
+ 稳定命令面包括:
39
+
40
+ - `init`
41
+ - `login`
42
+ - `list`
43
+ - `show`
44
+ - `current`
45
+ - `status`
46
+ - `doctor`
47
+ - `config show`
48
+ - `config list-profiles`
49
+ - `add`
50
+ - `edit`
51
+ - `switch`
52
+ - `remove`
53
+ - `import`
54
+ - `export`
55
+ - `bridge start`
56
+ - `bridge status`
57
+ - `bridge stop`
58
+ - `backups list`
59
+ - `rollback`
60
+
61
+ 其中:
62
+
63
+ - `migrate` 只能是高级 adopt helper。
64
+ - `setup` 只能是 deprecated entry。
65
+
66
+ ### 3.2 `--json` envelope
67
+
68
+ `--json` 的顶层 envelope 必须保持不变:
69
+
70
+ ```json
71
+ {
72
+ "ok": true,
73
+ "command": "list",
74
+ "data": {},
75
+ "warnings": [],
76
+ "error": null
77
+ }
78
+ ```
79
+
80
+ 约束如下:
81
+
82
+ - 顶层字段名不变。
83
+ - 顶层字段顺序和 shape 不变。
84
+ - 新信息只能继续追加到 `data`、`warnings` 或 `error.details`。
85
+
86
+ ### 3.3 dual-path model
87
+
88
+ `0.1.0` 必须把以下分层固定为正式合同:
89
+
90
+ - tool home:
91
+ - `codex-switch.json`
92
+ - `providers.json`
93
+ - `backups/`
94
+ - `runtime/`
95
+ - `runtimes/`
96
+ - target Codex runtime:
97
+ - `config.toml`
98
+ - `auth.json`
99
+
100
+ 含义必须稳定:
101
+
102
+ - `providers.json` 是管理态 SSOT。
103
+ - `config.toml` 是受管 runtime routing 文件。
104
+ - `auth.json` 是受管 auth projection 文件。
105
+
106
+ ### 3.4 主工作流
107
+
108
+ Direct provider 主路径:
109
+
110
+ ```bash
111
+ codexs init
112
+ codexs add <provider> --profile <name> --api-key <key>
113
+ codexs switch <provider>
114
+ codexs status
115
+ codexs doctor
116
+ ```
117
+
118
+ Copilot provider 主路径:
119
+
120
+ ```bash
121
+ codexs init
122
+ codexs login copilot
123
+ codexs add <provider> --copilot --profile <name>
124
+ codexs switch <provider>
125
+ codexs status
126
+ codexs doctor
127
+ ```
128
+
129
+ `migrate` 的定位必须明确为:
130
+
131
+ - 面向已有 runtime state 的高级 adopt helper。
132
+ - 不应与 fresh install 主路径混淆。
133
+ - 不应被写成所有新用户都应先执行的默认步骤。
134
+
135
+ ## 4. Release Gate
136
+
137
+ 只有以下条件全部满足,才允许发布 `0.1.0`。
138
+
139
+ ### 4.1 工作流
140
+
141
+ - fresh tool home 下 direct provider 主路径可稳定走通。
142
+ - fresh tool home 下 Copilot 主路径可稳定走通。
143
+ - `switch` 的成功语义仍然等于 config auth projection 都正确。
144
+ - `rollback` 对受管写操作仍然可信。
145
+
146
+ ### 4.2 输出与语义
147
+
148
+ - `--json` 读命令输出稳定。
149
+ - 非交互模式不会意外触发 prompt。
150
+ - 错误码和 issue code 对常见失败场景足够稳定。
151
+ - `status` `doctor` 能清楚说明下一步修复动作。
152
+ - `list`、`status`、`doctor` 的人类可读输出和交互提示一致。
153
+
154
+ ### 4.3 文档
155
+
156
+ - README、README.CN、README.AI、CLI usage、product overview、PRD、design 和 changelog 与实际行为一致。
157
+ - `docs/Tests/testing.md` 不能继续停留在忽略状态,测试回归必须落仓库并可版本化。
158
+ - 主路径在所有面向用户的文档中必须一致。
159
+ - `0.1.0` 的定位必须压过旧的 `0.0.12` 叙事。
160
+
161
+ ### 4.4 包内容
162
+
163
+ - `npm pack --dry-run` 结果合理。
164
+ - tarball 中包含正确的 README、LICENSE、docs、dist。
165
+ - `codexs --help`、`codexs --version`、安装指引与 npm 包元数据一致。
166
+
167
+ ### 4.5 结构
168
+
169
+ - 不再保留明显误导性的历史目录语义。
170
+ - 稳定模块的边界说明足够清楚。
171
+ - 新问题不再需要反复回到超大入口文件修补。
172
+
173
+ ## 5. 可执行验证清单
174
+
175
+ `0.1.0` 的发布前验证必须至少覆盖以下项目:
176
+
177
+ ```bash
178
+ npm run build
179
+ npm test
180
+ npx tsc --noEmit
181
+ npm pack --dry-run
182
+ node dist/cli.js --help
183
+ node dist/cli.js --version
184
+ ```
185
+
186
+ 同时必须做以下行为验证:
187
+
188
+ - fresh direct provider flow。
189
+ - fresh Copilot provider flow。
190
+ - `list/status/doctor` 语义检查。
191
+ - `--json` 输出检查。
192
+ - `migrate` 作为高级 adopt helper 的检查。
193
+ - `setup` 作为 deprecated entry 的检查。
194
+
195
+ ## 6. 明确不在范围内
196
+
197
+ `0.1.0` 不要求完成以下内容:
198
+
199
+ - upstream。
200
+ - GUI / TUI。
201
+ - daemon。
202
+ - plugin system。
203
+ - auto migration。
204
+ - 兼容层。
205
+ - dual-read / dual-write。
206
+ - `migrate` 的完整非交互产品化。
207
+ - 旧状态的自动升级保留逻辑。
208
+
209
+ ## 7. 若 Gate 未通过
210
+
211
+ 如果任何阻塞项仍然存在,就不要强行发布 `0.1.0`。
212
+
213
+ 此时应继续发布 beta 或 rc 版本,而不是为了版本号好看提前进入稳定线。
214
+
215
+ ## 8. 结论
216
+
217
+ `0.1.0` 的本质不是“功能更多”,而是“承诺更稳”。当命令面、输出契约、主工作流、诊断语义、包内容和文档事实完全一致时,这个版本号才成立。
@@ -137,6 +137,12 @@ model_reasoning_effort = "high"
137
137
  approval_policy = "never"
138
138
  ```
139
139
 
140
+ Important `codex-switch` note:
141
+
142
+ - official Codex still supports profiles
143
+ - `codex-switch` `0.1.1` does not treat top-level `profile` as the recommended managed runtime selector
144
+ - in `codex-switch`, legacy `profile` and `[profiles.*]` are mainly inspect-and-adopt inputs for `migrate`, `doctor`, and `config` inspection flows
145
+
140
146
  ## 4. `config.toml` by topic
141
147
 
142
148
  ### 4.1 Model, reasoning, and response style
@@ -194,6 +200,8 @@ Core keys:
194
200
  - `model_providers.<id>.env_http_headers`
195
201
  - `model_providers.<id>.query_params`
196
202
  - `model_providers.<id>.request_max_retries`
203
+ - `model_providers.<id>.wire_api`
204
+ - `model_providers.<id>.requires_openai_auth`
197
205
 
198
206
  Authentication options for custom providers include:
199
207
 
@@ -214,6 +222,22 @@ Related Bedrock keys:
214
222
  - `model_providers.amazon-bedrock.aws.profile`
215
223
  - `model_providers.amazon-bedrock.aws.region`
216
224
 
225
+ #### `codex-switch` 0.1.1 managed projection
226
+
227
+ When `codex-switch` manages a direct OpenAI-compatible route for Codex `0.134.0+`, it intentionally projects a narrower runtime shape than the full official provider schema:
228
+
229
+ - top-level `model` is the active model selector
230
+ - top-level `model_provider` is the active route selector
231
+ - projected `[model_providers.<id>]` keeps `base_url`
232
+ - projected `[model_providers.<id>]` fixes `wire_api = "responses"`
233
+ - projected `[model_providers.<id>]` fixes `requires_openai_auth = true`
234
+ - projected runtime config does not keep `env_key`
235
+ - projected runtime config does not keep `env_key_instructions`
236
+
237
+ Authentication is projected through `auth.json` with `OPENAI_API_KEY`, not through `env_key` in the managed runtime config.
238
+
239
+ That is a `codex-switch` product decision, not a limitation of Codex itself. If you hand-write or independently manage Codex config, `env_key` remains a valid official mechanism.
240
+
217
241
  ### 4.3.1 `openai_base_url` vs custom providers
218
242
 
219
243
  If you only want to point the built-in OpenAI provider to a proxy, router, or residency-specific endpoint, use:
@@ -539,6 +563,23 @@ env_key = "OPENAI_API_KEY"
539
563
  http_headers = { "X-Team" = "platform" }
540
564
  ```
541
565
 
566
+ This is an official Codex-style custom provider example.
567
+
568
+ If you are using `codex-switch` managed direct-provider projection instead, the runtime projection is intentionally narrower:
569
+
570
+ ```toml
571
+ model = "gpt-5.4"
572
+ model_provider = "proxy"
573
+
574
+ [model_providers.proxy]
575
+ name = "proxy"
576
+ base_url = "https://proxy.example.com/v1"
577
+ wire_api = "responses"
578
+ requires_openai_auth = true
579
+ ```
580
+
581
+ In that managed projection, `OPENAI_API_KEY` is expected in `auth.json` rather than through `env_key` in `config.toml`.
582
+
542
583
  ### 6.4 Locked-down shell environment
543
584
 
544
585
  ```toml
@@ -149,6 +149,12 @@ model_reasoning_effort = "high"
149
149
  approval_policy = "never"
150
150
  ```
151
151
 
152
+ 对 `codex-switch` 0.1.1 的补充说明:
153
+
154
+ - 官方 Codex 仍然支持 profiles
155
+ - `codex-switch` 不再把顶层 `profile` 视为推荐的受管 runtime selector
156
+ - 在 `codex-switch` 里,legacy `profile` 和 `[profiles.*]` 主要用于 `migrate`、`doctor` 和 `config` 检视的 adopt / inspect 场景
157
+
152
158
  ## 4. `config.toml` 主题整理
153
159
 
154
160
  ### 4.1 模型、推理强度与输出风格
@@ -206,6 +212,8 @@ Codex 把“当前使用哪个 provider”和“provider 怎么定义”拆开
206
212
  - `model_providers.<id>.env_http_headers`
207
213
  - `model_providers.<id>.query_params`
208
214
  - `model_providers.<id>.request_max_retries`
215
+ - `model_providers.<id>.wire_api`
216
+ - `model_providers.<id>.requires_openai_auth`
209
217
 
210
218
  自定义 provider 的认证方式包括:
211
219
 
@@ -229,6 +237,22 @@ Bedrock 相关 key:
229
237
  - `model_providers.amazon-bedrock.aws.profile`
230
238
  - `model_providers.amazon-bedrock.aws.region`
231
239
 
240
+ #### `codex-switch` 0.1.1 的受管投影
241
+
242
+ 当 `codex-switch` 为 Codex `0.134.0+` 管理一个 direct OpenAI-compatible route 时,它会有意把运行态投影限制在一组更窄的字段上:
243
+
244
+ - 顶层 `model` 是活动模型选择器
245
+ - 顶层 `model_provider` 是活动路由选择器
246
+ - 投影后的 `[model_providers.<id>]` 保留 `base_url`
247
+ - 投影后的 `[model_providers.<id>]` 固定写 `wire_api = "responses"`
248
+ - 投影后的 `[model_providers.<id>]` 固定写 `requires_openai_auth = true`
249
+ - 受管运行态投影不会保留 `env_key`
250
+ - 受管运行态投影不会保留 `env_key_instructions`
251
+
252
+ 认证信息会通过 `auth.json` 里的 `OPENAI_API_KEY` 投影,而不是通过运行态 `config.toml` 中的 `env_key`。
253
+
254
+ 这属于 `codex-switch` 的产品约束,不是 Codex 官方能力限制。如果你是手工维护或独立维护 Codex config,`env_key` 仍然是官方支持的方式。
255
+
232
256
  ### 4.3.1 `openai_base_url` 和自定义 provider 的区别
233
257
 
234
258
  如果你只是想把内置 `openai` provider 指向公司网关、路由层或者某个数据驻留 endpoint,官方建议直接用:
@@ -568,6 +592,23 @@ env_key = "OPENAI_API_KEY"
568
592
  http_headers = { "X-Team" = "platform" }
569
593
  ```
570
594
 
595
+ 这段是官方 Codex 风格的自定义 provider 示例。
596
+
597
+ 如果你走的是 `codex-switch` 的受管 direct-provider 投影,运行态会被有意收窄为:
598
+
599
+ ```toml
600
+ model = "gpt-5.4"
601
+ model_provider = "proxy"
602
+
603
+ [model_providers.proxy]
604
+ name = "proxy"
605
+ base_url = "https://proxy.example.com/v1"
606
+ wire_api = "responses"
607
+ requires_openai_auth = true
608
+ ```
609
+
610
+ 在这种受管投影下,`OPENAI_API_KEY` 预期写在 `auth.json`,而不是通过 `config.toml` 里的 `env_key` 暴露。
611
+
571
612
  ### 6.4 最小暴露的 shell 环境策略
572
613
 
573
614
  ```toml
@@ -1,78 +1,31 @@
1
- # Testing Guide
2
-
3
- Version under test: `0.0.12`
4
-
5
- 这份文档同时是测试说明和 beta release checklist。
6
-
7
- ## Active Suites
8
-
9
- - `tests/commands.spec.js`: argument parsing, help rendering, and command registry contract
10
- - `tests/cli-e2e.spec.js`: built CLI help/version plus human-readable and JSON output behavior
11
- - `tests/interaction.spec.js`: prompt boundaries
12
- - `tests/runtime.spec.js`: runtime probing behavior
13
- - `tests/workflows.spec.js`: file-backed mutation and rollback behavior
14
-
15
- ## Required Commands
16
-
17
- ```bash
18
- npm run build
19
- npm test
20
- npx tsc --noEmit
21
- npm pack --dry-run
22
- ```
23
-
24
- ## Release Checklist
25
-
26
- Read checks:
27
-
28
- - built CLI `--help`
29
- - built CLI `--version`
30
- - `list --json`
31
- - `status --json`
32
- - `doctor --json`
33
-
34
- Primary workflow checks:
35
-
36
- - fresh tool home direct path
37
- - fresh tool home Copilot path
38
- - read commands in `--json`
39
- - write commands in sandbox
40
-
41
- Specific `0.0.12` checks:
42
-
43
- - top-level help shows direct primary workflow before `migrate`
44
- - `migrate` is clearly presented as advanced adopt
45
- - `setup` remains deprecation-only
46
- - human-readable `init` output shows tool home, tool config, and providers registry
47
- - human-readable `status` output shows tool home and target runtime
48
- - human-readable `doctor` output is repair-oriented
49
- - `--version` matches `package.json.version`
50
-
51
- ## Test Limits
52
-
53
- - `login copilot` depends on SDK install, official CLI invocation, and auth recheck. Automation should distinguish mocked coverage from real-environment validation.
54
- - `migrate` remains intentionally interactive for adopt detail collection. Non-interactive tests should verify the current failure contract rather than force a fake full automation path.
55
-
56
- ## Reporting Template
57
-
58
- ```text
59
- Version under test: 0.0.12
60
- Build: PASS/FAIL
61
- Suite results:
62
- - commands: PASS/FAIL
63
- - cli-e2e: PASS/FAIL
64
- - interaction: PASS/FAIL
65
- - runtime: PASS/FAIL
66
- - workflows: PASS/FAIL
67
-
68
- Release checks:
69
- - help/version: PASS/FAIL
70
- - direct path: PASS/FAIL
71
- - copilot path: PASS/FAIL
72
- - json reads: PASS/FAIL
73
- - sandbox writes: PASS/FAIL
74
-
75
- Open risks:
76
- - <risk 1>
77
- - <risk 2>
78
- ```
1
+ # codex-switch Testing Guide
2
+
3
+ This guide records the release gate for `0.1.0`.
4
+
5
+ ## Required checks
6
+
7
+ Run these commands before publishing or reviewing release changes:
8
+
9
+ ```bash
10
+ npm run build
11
+ npm test
12
+ npx tsc --noEmit
13
+ npm pack --dry-run
14
+ node dist/cli.js --help
15
+ node dist/cli.js --version
16
+ ```
17
+
18
+ ## Release scenarios
19
+
20
+ - Fresh direct-provider flow: `init -> add -> switch -> status -> doctor`
21
+ - Fresh Copilot flow: `init -> login copilot -> add --copilot -> switch -> status -> doctor`
22
+ - Ambiguous active profile: `list`, `status`, and provider pickers must surface ambiguity instead of inventing a unique current provider
23
+ - `--json` envelope: top-level `ok`, `command`, `data`, `warnings`, and `error` must remain stable
24
+ - `migrate`: advanced adopt helper only
25
+ - `setup`: deprecated entry only
26
+
27
+ ## Fixture guidance
28
+
29
+ - Prefer isolated temp directories for mutating tests.
30
+ - Keep fixtures small and realistic.
31
+ - Use `dev-codex/local-sandbox` only when a test needs a representative Codex directory layout.