@minniexcode/codex-switch 0.0.9 → 0.0.11
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.
- package/README.AI.md +52 -13
- package/README.CN.md +94 -39
- package/README.md +75 -33
- package/dist/app/add-provider.js +29 -26
- package/dist/app/bridge.js +15 -15
- package/dist/app/edit-provider.js +2 -18
- package/dist/app/get-status.js +35 -13
- package/dist/app/import-providers.js +1 -1
- package/dist/app/init-codex.js +13 -14
- package/dist/app/list-providers.js +0 -1
- package/dist/app/remove-provider.js +1 -1
- package/dist/app/run-doctor.js +21 -39
- package/dist/app/run-mutation.js +3 -2
- package/dist/app/setup-codex.js +30 -18
- package/dist/app/show-config.js +1 -5
- package/dist/app/switch-provider.js +16 -33
- package/dist/cli/output.js +4 -6
- package/dist/cli.js +35 -3
- package/dist/commands/args.js +2 -2
- package/dist/commands/dispatch.js +40 -0
- package/dist/commands/handlers.js +202 -84
- package/dist/commands/help.js +2 -0
- package/dist/commands/registry.js +33 -12
- package/dist/domain/backups.js +4 -4
- package/dist/domain/config.js +102 -61
- package/dist/domain/providers.js +12 -5
- package/dist/domain/runtime-state.js +81 -4
- package/dist/domain/setup.js +58 -3
- package/dist/interaction/add-interactive.js +55 -1
- package/dist/interaction/interactive.js +1 -5
- package/dist/runtime/copilot-adapter.js +56 -13
- package/dist/runtime/copilot-bridge.js +392 -44
- package/dist/runtime/copilot-cli.js +142 -0
- package/dist/runtime/copilot-installer.js +59 -11
- package/dist/runtime/copilot-sdk-loader.js +5 -5
- package/dist/storage/auth-repo.js +28 -77
- package/dist/storage/backup-repo.js +4 -4
- package/dist/storage/codex-paths.js +34 -8
- package/dist/storage/config-repo.js +1 -36
- package/dist/storage/lock-repo.js +2 -4
- package/dist/storage/runtime-state-repo.js +43 -10
- package/dist/storage/tool-config-repo.js +111 -0
- package/docs/Design/codex-switch-copilot-integration-design.md +517 -0
- package/docs/Design/codex-switch-v0.0.10-design.md +669 -0
- package/docs/Design/codex-switch-v0.0.11-design.md +824 -0
- package/docs/PRD/codex-switch-prd-v0.0.10.md +406 -0
- package/docs/PRD/codex-switch-prd-v0.0.11.md +577 -0
- package/docs/cli-usage.md +166 -271
- package/docs/codex-switch-product-overview.md +2 -2
- package/docs/codex-switch-technical-architecture.md +6 -5
- package/package.json +1 -1
package/README.AI.md
CHANGED
|
@@ -4,7 +4,7 @@ This file is for AI agents, automation scripts, and contributors who need a comp
|
|
|
4
4
|
|
|
5
5
|
## Repository Purpose
|
|
6
6
|
|
|
7
|
-
`@minniexcode/codex-switch` is a local-first TypeScript CLI for managing provider/profile state for Codex
|
|
7
|
+
`@minniexcode/codex-switch` is a local-first TypeScript CLI for managing provider/profile state for Codex while keeping codex-switch tool state separate from the target Codex runtime.
|
|
8
8
|
|
|
9
9
|
Primary goals:
|
|
10
10
|
|
|
@@ -13,22 +13,29 @@ Primary goals:
|
|
|
13
13
|
- rollback on failure
|
|
14
14
|
- stable machine-readable CLI output
|
|
15
15
|
- support for both human TTY usage and agent automation
|
|
16
|
+
- explicit onboarding for interactive upstreams such as GitHub Copilot
|
|
16
17
|
|
|
17
18
|
## Main Command Surface
|
|
18
19
|
|
|
19
20
|
```bash
|
|
20
21
|
codexs init
|
|
22
|
+
codexs login copilot
|
|
21
23
|
codexs migrate
|
|
22
24
|
codexs list
|
|
23
25
|
codexs show <provider>
|
|
24
26
|
codexs current
|
|
25
27
|
codexs status
|
|
28
|
+
codexs config show [profile]
|
|
29
|
+
codexs config list-profiles
|
|
26
30
|
codexs edit <provider>
|
|
27
31
|
codexs switch <provider>
|
|
28
32
|
codexs import <file>
|
|
29
33
|
codexs export <file>
|
|
30
34
|
codexs add <provider>
|
|
31
35
|
codexs remove <provider>
|
|
36
|
+
codexs bridge start [provider]
|
|
37
|
+
codexs bridge status [provider]
|
|
38
|
+
codexs bridge stop [provider]
|
|
32
39
|
codexs backups list
|
|
33
40
|
codexs doctor
|
|
34
41
|
codexs rollback [backup-id]
|
|
@@ -41,22 +48,43 @@ Shared flags:
|
|
|
41
48
|
--codex-dir <path>
|
|
42
49
|
```
|
|
43
50
|
|
|
44
|
-
|
|
51
|
+
Relevant environment variables:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
CODEXS_HOME
|
|
55
|
+
CODEXS_CODEX_DIR
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Important Files
|
|
59
|
+
|
|
60
|
+
Tool home:
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
~/.config/codex-switch/
|
|
64
|
+
codex-switch.json
|
|
65
|
+
providers.json
|
|
66
|
+
backups/
|
|
67
|
+
runtime/
|
|
68
|
+
runtimes/
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Target Codex runtime:
|
|
45
72
|
|
|
46
73
|
```text
|
|
47
74
|
~/.codex/
|
|
48
75
|
config.toml
|
|
49
76
|
auth.json
|
|
50
|
-
providers.json
|
|
51
|
-
backups/
|
|
52
77
|
```
|
|
53
78
|
|
|
54
79
|
Operational model:
|
|
55
80
|
|
|
56
81
|
- `providers.json` is the management-state source of truth
|
|
57
|
-
- `
|
|
58
|
-
- `
|
|
59
|
-
-
|
|
82
|
+
- `codex-switch.json` stores tool-level metadata such as `defaultCodexDir`
|
|
83
|
+
- `config.toml` remains the managed runtime-routing file in the target Codex directory
|
|
84
|
+
- `auth.json` remains the active auth projection file
|
|
85
|
+
- `runtime/` stores managed bridge runtime state
|
|
86
|
+
- `runtimes/` stores optional local runtimes such as the Copilot SDK install
|
|
87
|
+
- mutating commands back up first and run under a lightweight file lock in the tool home
|
|
60
88
|
|
|
61
89
|
## Project Structure
|
|
62
90
|
|
|
@@ -64,8 +92,11 @@ Operational model:
|
|
|
64
92
|
src/
|
|
65
93
|
app/
|
|
66
94
|
cli/
|
|
95
|
+
commands/
|
|
67
96
|
domain/
|
|
68
|
-
|
|
97
|
+
interaction/
|
|
98
|
+
runtime/
|
|
99
|
+
storage/
|
|
69
100
|
tests/
|
|
70
101
|
docs/
|
|
71
102
|
dist/
|
|
@@ -73,10 +104,13 @@ dist/
|
|
|
73
104
|
|
|
74
105
|
Layer intent:
|
|
75
106
|
|
|
76
|
-
- `cli`:
|
|
107
|
+
- `cli`: output shaping and thin CLI-facing utilities
|
|
108
|
+
- `commands`: argument parsing, help rendering, and command dispatch
|
|
77
109
|
- `app`: command orchestration and use-case logic
|
|
78
110
|
- `domain`: pure domain rules and shared models
|
|
79
|
-
- `
|
|
111
|
+
- `interaction`: TTY-only prompt flows
|
|
112
|
+
- `runtime`: Codex/Copilot runtime probing and local bridge management
|
|
113
|
+
- `storage`: filesystem-backed repositories and path resolution
|
|
80
114
|
|
|
81
115
|
## Command Entry Point
|
|
82
116
|
|
|
@@ -86,6 +120,7 @@ Use `codexs` directly for runtime interaction:
|
|
|
86
120
|
codexs --help
|
|
87
121
|
codexs list --json
|
|
88
122
|
codexs status --json
|
|
123
|
+
codexs config list-profiles --json
|
|
89
124
|
```
|
|
90
125
|
|
|
91
126
|
## Current Version Context
|
|
@@ -93,12 +128,14 @@ codexs status --json
|
|
|
93
128
|
Current package version in this repository:
|
|
94
129
|
|
|
95
130
|
```text
|
|
96
|
-
0.0.
|
|
131
|
+
0.0.11
|
|
97
132
|
```
|
|
98
133
|
|
|
99
134
|
Recent version summary:
|
|
100
135
|
|
|
101
|
-
- `0.0.
|
|
136
|
+
- `0.0.11`: tool-home split, `login copilot`, managed bridge commands, and config inspection commands
|
|
137
|
+
- `0.0.10`: `init` / `migrate` command split finalized and `setup` deprecated
|
|
138
|
+
- `0.0.7`: command-surface refactor and setup split groundwork
|
|
102
139
|
- `0.0.4`: setup/show/edit/backups list/specific rollback/import merge and clearer CLI semantics
|
|
103
140
|
- `0.0.3`: interactive TTY flows and improved help
|
|
104
141
|
- `0.0.2`: mutation orchestration, backups, rollback, locks, drift detection improvements
|
|
@@ -109,5 +146,7 @@ Recent version summary:
|
|
|
109
146
|
- Prefer `--json` when invoking commands programmatically
|
|
110
147
|
- Treat `providers.json` as sensitive because it may contain API keys
|
|
111
148
|
- Do not assume silent write-back from runtime files into `providers.json`
|
|
112
|
-
- Prefer `init` for repeatable
|
|
149
|
+
- Prefer `init` for repeatable tool-home setup and `migrate` for human-led adopt flows
|
|
150
|
+
- `login copilot` requires a real TTY and should not be used under `--json`
|
|
151
|
+
- `add --copilot` assumes SDK install and upstream auth readiness are already satisfied
|
|
113
152
|
- Use `docs/` for deeper product and architecture context
|
package/README.CN.md
CHANGED
|
@@ -2,45 +2,61 @@
|
|
|
2
2
|
|
|
3
3
|
`@minniexcode/codex-switch` 是一个本地优先的 CLI,用来安全地管理和切换 Codex 的 provider/profile 配置。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
从 `0.0.11` 开始,它不再把整个管理态都塞进 `~/.codex/`,而是把工具自己的状态拆到独立的 tool home 里,同时继续对目标 Codex runtime 做受控写入。
|
|
6
6
|
|
|
7
7
|
## 这个仓库是做什么的
|
|
8
8
|
|
|
9
9
|
这个仓库包含 `codex-switch` 的 CLI 实现、npm 包配置,以及相关产品和技术文档。
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
项目目标:
|
|
12
12
|
|
|
13
|
-
- 在本地完成
|
|
13
|
+
- 在本地完成 provider/profile 管理与切换
|
|
14
14
|
- 写入前先备份
|
|
15
15
|
- 出错时可回滚
|
|
16
16
|
- 同时兼顾终端用户和 AI/自动化调用
|
|
17
|
+
- 为 GitHub Copilot 这类交互式上游登录提供独立入口
|
|
17
18
|
|
|
18
19
|
## 现在可以做什么
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
当前公开命令面如下:
|
|
21
22
|
|
|
22
23
|
```bash
|
|
24
|
+
codexs init
|
|
25
|
+
codexs login copilot
|
|
26
|
+
codexs migrate
|
|
23
27
|
codexs list
|
|
28
|
+
codexs show <provider>
|
|
24
29
|
codexs current
|
|
25
|
-
codexs switch <provider>
|
|
26
30
|
codexs status
|
|
31
|
+
codexs config show [profile]
|
|
32
|
+
codexs config list-profiles
|
|
33
|
+
codexs edit <provider>
|
|
34
|
+
codexs switch <provider>
|
|
27
35
|
codexs import <file>
|
|
28
36
|
codexs export <file>
|
|
29
37
|
codexs add <provider>
|
|
30
38
|
codexs remove <provider>
|
|
39
|
+
codexs bridge start [provider]
|
|
40
|
+
codexs bridge status [provider]
|
|
41
|
+
codexs bridge stop [provider]
|
|
42
|
+
codexs backups list
|
|
31
43
|
codexs doctor
|
|
32
|
-
codexs rollback
|
|
44
|
+
codexs rollback [backup-id]
|
|
45
|
+
codexs setup
|
|
33
46
|
```
|
|
34
47
|
|
|
35
48
|
对应能力包括:
|
|
36
49
|
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
50
|
+
- 初始化独立的 tool home 与空的受管 `providers.json`
|
|
51
|
+
- 从已有 `config.toml` adopt 可管理的 runtime profile
|
|
52
|
+
- 查看本地已管理 provider
|
|
53
|
+
- 查看结构化 config profile 视图
|
|
54
|
+
- 编辑、切换、导入、导出、删除 provider
|
|
55
|
+
- 为 GitHub Copilot 完成上游 SDK 安装与登录检查
|
|
56
|
+
- 显式启动、查看和停止本地 Copilot bridge
|
|
42
57
|
- 检查配置漂移和常见本地问题
|
|
43
58
|
- 在变更前自动备份,并在失败时回滚
|
|
59
|
+
- 保留 `setup` 作为弃用入口,并引导到 `init` / `migrate`
|
|
44
60
|
|
|
45
61
|
## 简单用法
|
|
46
62
|
|
|
@@ -65,18 +81,29 @@ codexs --help
|
|
|
65
81
|
典型使用方式:
|
|
66
82
|
|
|
67
83
|
```bash
|
|
84
|
+
codexs init
|
|
85
|
+
codexs migrate
|
|
68
86
|
codexs list
|
|
69
|
-
codexs
|
|
87
|
+
codexs config show
|
|
70
88
|
codexs add my-provider --profile my-provider --api-key sk-xxx
|
|
71
89
|
codexs switch my-provider
|
|
72
90
|
codexs status
|
|
73
91
|
```
|
|
74
92
|
|
|
93
|
+
GitHub Copilot 路径:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
codexs login copilot
|
|
97
|
+
codexs add copilot-main --copilot --profile copilot-main
|
|
98
|
+
codexs bridge start copilot-main
|
|
99
|
+
```
|
|
100
|
+
|
|
75
101
|
给脚本或 AI 使用时建议加上:
|
|
76
102
|
|
|
77
103
|
```bash
|
|
78
104
|
codexs list --json
|
|
79
105
|
codexs status --json
|
|
106
|
+
codexs config list-profiles --json
|
|
80
107
|
```
|
|
81
108
|
|
|
82
109
|
通用参数:
|
|
@@ -86,6 +113,13 @@ codexs status --json
|
|
|
86
113
|
--codex-dir <path>
|
|
87
114
|
```
|
|
88
115
|
|
|
116
|
+
环境变量:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
CODEXS_HOME
|
|
120
|
+
CODEXS_CODEX_DIR
|
|
121
|
+
```
|
|
122
|
+
|
|
89
123
|
## 交互式体验
|
|
90
124
|
|
|
91
125
|
这个 CLI 同时支持显式命令和交互式终端流程。
|
|
@@ -94,57 +128,77 @@ codexs status --json
|
|
|
94
128
|
- `codexs switch` 在未传 provider 时可以弹出选择列表
|
|
95
129
|
- `codexs remove` 支持交互式选择和确认删除
|
|
96
130
|
- `import`、`export`、`rollback` 在交互模式下会要求确认
|
|
131
|
+
- `login copilot` 必须在真实 TTY 中执行
|
|
132
|
+
- `migrate` 当前仍保留交互式 adopt 语义
|
|
97
133
|
- `--json` 模式保持非交互,适合自动化
|
|
98
134
|
|
|
99
135
|
## 管理哪些文件
|
|
100
136
|
|
|
101
|
-
`codex-switch`
|
|
137
|
+
从 `0.0.11` 开始,`codex-switch` 使用双路径模型。
|
|
138
|
+
|
|
139
|
+
tool home:
|
|
140
|
+
|
|
141
|
+
```text
|
|
142
|
+
~/.config/codex-switch/
|
|
143
|
+
codex-switch.json
|
|
144
|
+
providers.json
|
|
145
|
+
backups/
|
|
146
|
+
runtime/
|
|
147
|
+
runtimes/
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
目标 Codex runtime:
|
|
102
151
|
|
|
103
152
|
```text
|
|
104
153
|
~/.codex/
|
|
105
154
|
config.toml
|
|
106
155
|
auth.json
|
|
107
|
-
providers.json
|
|
108
|
-
backups/
|
|
109
156
|
```
|
|
110
157
|
|
|
111
158
|
存储模型:
|
|
112
159
|
|
|
113
|
-
- `providers.json`
|
|
114
|
-
- `
|
|
160
|
+
- `providers.json` 是管理态的单一事实来源,位于 tool home
|
|
161
|
+
- `codex-switch.json` 存放工具级配置,例如 `defaultCodexDir`
|
|
162
|
+
- `config.toml` 是目标 Codex runtime 的受管路由文件
|
|
163
|
+
- `auth.json` 是当前认证投影文件
|
|
115
164
|
- `backups/latest.json` 记录最近一次可回滚窗口
|
|
165
|
+
- `runtime/` 保存受管 bridge runtime state
|
|
166
|
+
- `runtimes/` 用于存放可选本地 runtime,例如 Copilot SDK
|
|
116
167
|
|
|
117
|
-
注意:`providers.json` 可能包含 API key
|
|
168
|
+
注意:`providers.json` 可能包含 API key,本地使用时应视为敏感文件。
|
|
118
169
|
|
|
119
|
-
##
|
|
170
|
+
## 最近版本更新
|
|
120
171
|
|
|
121
|
-
|
|
122
|
-
- [AI README](./README.AI.md)
|
|
123
|
-
- [产品概览](./docs/codex-switch-product-overview.md)
|
|
124
|
-
- [产品调研](./docs/codex-switch-product-research.md)
|
|
125
|
-
- [PRD](./docs/codex-switch-prd.md)
|
|
126
|
-
- [技术架构](./docs/codex-switch-technical-architecture.md)
|
|
127
|
-
- [命令设计](./docs/codex-switch-command-design.md)
|
|
172
|
+
### 0.0.11
|
|
128
173
|
|
|
129
|
-
|
|
174
|
+
- 引入独立 tool home,正式把管理态从 `~/.codex` 中拆出
|
|
175
|
+
- 新增 `login copilot`,把 GitHub Copilot 上游登录从 `add --copilot` 中解耦
|
|
176
|
+
- 新增 `bridge start/status/stop` 与 `config show/list-profiles`
|
|
177
|
+
- README、CLI usage 和发布元数据统一按新命令契约更新
|
|
130
178
|
|
|
131
|
-
### 0.0.
|
|
179
|
+
### 0.0.10
|
|
132
180
|
|
|
133
|
-
-
|
|
134
|
-
-
|
|
135
|
-
-
|
|
181
|
+
- 正式拆分 `setup`:新增 `init` 和 `migrate`,`setup` 变为弃用命令
|
|
182
|
+
- 收紧迁移、诊断、回滚和发布正确性边界
|
|
183
|
+
- 清理 provider/runtime 管理语义,CLI 聚焦静态 profile 与 `base_url` 层配置
|
|
136
184
|
|
|
137
|
-
### 0.0.
|
|
185
|
+
### 0.0.7
|
|
138
186
|
|
|
139
|
-
-
|
|
140
|
-
-
|
|
141
|
-
-
|
|
187
|
+
- 完成 command-surface 重构
|
|
188
|
+
- 校正 env key / auth mirror 相关模型
|
|
189
|
+
- 推进 `setup` 向 `init` + `migrate` 的拆分
|
|
142
190
|
|
|
143
|
-
|
|
191
|
+
## 相关文档
|
|
144
192
|
|
|
145
|
-
-
|
|
146
|
-
-
|
|
147
|
-
-
|
|
193
|
+
- [English README](./README.md)
|
|
194
|
+
- [AI README](./README.AI.md)
|
|
195
|
+
- [详细 CLI 文档](./docs/cli-usage.md)
|
|
196
|
+
- [产品概览](./docs/codex-switch-product-overview.md)
|
|
197
|
+
- [产品调研](./docs/codex-switch-product-research.md)
|
|
198
|
+
- [PRD 0.0.11](./docs/PRD/codex-switch-prd-v0.0.11.md)
|
|
199
|
+
- [技术架构](./docs/codex-switch-technical-architecture.md)
|
|
200
|
+
- [0.0.11 设计文档](./docs/Design/codex-switch-v0.0.11-design.md)
|
|
201
|
+
- [测试说明](./docs/Tests/testing.md)
|
|
148
202
|
|
|
149
203
|
## 本地开发
|
|
150
204
|
|
|
@@ -152,6 +206,7 @@ codexs status --json
|
|
|
152
206
|
npm install
|
|
153
207
|
npm run build
|
|
154
208
|
npm test
|
|
209
|
+
npx tsc --noEmit
|
|
155
210
|
node dist/cli.js --help
|
|
156
211
|
```
|
|
157
212
|
|
package/README.md
CHANGED
|
@@ -8,17 +8,20 @@ It is designed for users who work with multiple Codex providers, API keys, or pr
|
|
|
8
8
|
|
|
9
9
|
## Overview
|
|
10
10
|
|
|
11
|
-
What it does
|
|
11
|
+
What it does in `0.0.11`:
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
13
|
+
- Initializes a dedicated `codex-switch` tool home
|
|
14
|
+
- Adopts unmanaged runtime profiles from an existing Codex directory
|
|
15
|
+
- Lists, shows, adds, edits, and removes provider records
|
|
16
|
+
- Switches the active provider/profile safely
|
|
17
|
+
- Supports explicit GitHub Copilot upstream onboarding
|
|
18
|
+
- Manages the local Copilot bridge runtime explicitly
|
|
19
|
+
- Imports and exports provider definitions
|
|
20
|
+
- Runs diagnostics and detects local drift
|
|
21
|
+
- Lists backups and rolls back to a previous managed state
|
|
22
|
+
- Inspects `config.toml` profiles through structured read commands
|
|
20
23
|
|
|
21
|
-
Current version: `0.0.
|
|
24
|
+
Current version: `0.0.11`
|
|
22
25
|
|
|
23
26
|
## Install
|
|
24
27
|
|
|
@@ -42,27 +45,36 @@ codexs --help
|
|
|
42
45
|
|
|
43
46
|
## Quick Start
|
|
44
47
|
|
|
45
|
-
|
|
48
|
+
Initialize tool state and adopt an existing Codex runtime:
|
|
46
49
|
|
|
47
50
|
```bash
|
|
48
51
|
codexs init
|
|
49
52
|
codexs migrate
|
|
50
53
|
```
|
|
51
54
|
|
|
52
|
-
Inspect managed providers:
|
|
55
|
+
Inspect managed providers and config:
|
|
53
56
|
|
|
54
57
|
```bash
|
|
55
58
|
codexs list
|
|
56
59
|
codexs show my-provider
|
|
60
|
+
codexs config show
|
|
57
61
|
```
|
|
58
62
|
|
|
59
|
-
Add and switch:
|
|
63
|
+
Add and switch a direct provider:
|
|
60
64
|
|
|
61
65
|
```bash
|
|
62
66
|
codexs add my-provider --profile my-provider --api-key sk-xxx
|
|
63
67
|
codexs switch my-provider
|
|
64
68
|
```
|
|
65
69
|
|
|
70
|
+
Prepare GitHub Copilot and manage its bridge:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
codexs login copilot
|
|
74
|
+
codexs add copilot-main --copilot --profile copilot-main
|
|
75
|
+
codexs bridge start copilot-main
|
|
76
|
+
```
|
|
77
|
+
|
|
66
78
|
Check runtime state:
|
|
67
79
|
|
|
68
80
|
```bash
|
|
@@ -75,17 +87,24 @@ codexs doctor
|
|
|
75
87
|
|
|
76
88
|
```bash
|
|
77
89
|
codexs init
|
|
90
|
+
codexs login copilot
|
|
78
91
|
codexs migrate
|
|
79
92
|
codexs list
|
|
80
93
|
codexs show <provider>
|
|
81
94
|
codexs current
|
|
82
95
|
codexs status
|
|
96
|
+
codexs config show [profile]
|
|
97
|
+
codexs config list-profiles
|
|
83
98
|
codexs add <provider> --profile <name> --api-key <key>
|
|
84
|
-
codexs
|
|
99
|
+
codexs add <provider> --copilot --profile <name>
|
|
100
|
+
codexs edit <provider>
|
|
85
101
|
codexs switch <provider>
|
|
86
|
-
codexs
|
|
102
|
+
codexs bridge start [provider]
|
|
103
|
+
codexs bridge status [provider]
|
|
104
|
+
codexs bridge stop [provider]
|
|
105
|
+
codexs remove <provider> [--force] [--switch-to <profile>]
|
|
87
106
|
codexs import <file> [--merge]
|
|
88
|
-
codexs export <file>
|
|
107
|
+
codexs export <file> [--force]
|
|
89
108
|
codexs backups list
|
|
90
109
|
codexs rollback [backup-id]
|
|
91
110
|
codexs doctor
|
|
@@ -94,40 +113,61 @@ codexs doctor
|
|
|
94
113
|
Command help:
|
|
95
114
|
|
|
96
115
|
```bash
|
|
97
|
-
codexs help switch
|
|
98
116
|
codexs help init
|
|
117
|
+
codexs help login
|
|
118
|
+
codexs help add
|
|
119
|
+
codexs help bridge
|
|
120
|
+
codexs help config
|
|
99
121
|
codexs help migrate
|
|
100
|
-
codexs help setup
|
|
101
122
|
```
|
|
102
123
|
|
|
103
124
|
## How It Works
|
|
104
125
|
|
|
105
|
-
|
|
126
|
+
Starting in `0.0.11`, `codex-switch` uses a dual-path model.
|
|
106
127
|
|
|
107
|
-
|
|
128
|
+
Tool home:
|
|
129
|
+
|
|
130
|
+
```text
|
|
131
|
+
~/.config/codex-switch/
|
|
132
|
+
codex-switch.json
|
|
133
|
+
providers.json
|
|
134
|
+
backups/
|
|
135
|
+
runtime/
|
|
136
|
+
runtimes/
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Target Codex runtime:
|
|
108
140
|
|
|
109
141
|
```text
|
|
110
142
|
~/.codex/
|
|
111
143
|
config.toml
|
|
112
144
|
auth.json
|
|
113
|
-
providers.json
|
|
114
|
-
backups/
|
|
115
145
|
```
|
|
116
146
|
|
|
117
147
|
Notes:
|
|
118
148
|
|
|
119
|
-
- `providers.json` is the managed provider registry
|
|
120
|
-
- `
|
|
121
|
-
-
|
|
122
|
-
-
|
|
149
|
+
- `providers.json` is the managed provider registry and now lives under the tool home
|
|
150
|
+
- `codex-switch.json` stores tool-level metadata such as `defaultCodexDir`
|
|
151
|
+
- `config.toml` is still the active runtime-routing file in the target Codex directory
|
|
152
|
+
- `auth.json` is the active auth projection file
|
|
153
|
+
- direct-provider switches rewrite `OPENAI_API_KEY`
|
|
154
|
+
- Copilot bridge providers keep upstream login in the official Copilot runtime while `codex-switch` manages the local bridge secret, bridge state, and routing
|
|
155
|
+
- mutating commands back up before writing and rollback stays available after failed or undesired changes
|
|
156
|
+
|
|
157
|
+
Path overrides and resolution:
|
|
158
|
+
|
|
159
|
+
- `--codex-dir <path>` explicitly targets a Codex runtime directory
|
|
160
|
+
- `CODEXS_CODEX_DIR` sets the default target when `--codex-dir` is not passed
|
|
161
|
+
- `CODEXS_HOME` overrides the tool home location
|
|
123
162
|
|
|
124
163
|
## Automation
|
|
125
164
|
|
|
126
165
|
This CLI supports both human TTY use and non-interactive automation.
|
|
127
166
|
|
|
128
167
|
Current exceptions:
|
|
129
|
-
|
|
130
|
-
- `
|
|
168
|
+
|
|
169
|
+
- `login copilot` requires a real TTY and does not support `--json`
|
|
170
|
+
- `migrate` remains intentionally interactive for adopt profile selection and provider detail collection
|
|
131
171
|
|
|
132
172
|
Recommended global flags:
|
|
133
173
|
|
|
@@ -143,6 +183,7 @@ Recommendations:
|
|
|
143
183
|
- use `--json` for stable machine-readable output
|
|
144
184
|
- pass all required arguments explicitly in scripts or CI
|
|
145
185
|
- use `--codex-dir <path>` for sandbox or test environments
|
|
186
|
+
- use `CODEXS_HOME` when you want tool state isolated from your default workstation setup
|
|
146
187
|
|
|
147
188
|
## Testing
|
|
148
189
|
|
|
@@ -151,24 +192,25 @@ Build and test locally:
|
|
|
151
192
|
```bash
|
|
152
193
|
npm run build
|
|
153
194
|
npm test
|
|
195
|
+
npx tsc --noEmit
|
|
154
196
|
```
|
|
155
197
|
|
|
156
198
|
The repository includes a development fixture under `dev-codex/local-sandbox` plus dedicated test docs:
|
|
157
199
|
|
|
158
|
-
- [Testing Guide](./docs/testing.md)
|
|
159
|
-
- [
|
|
200
|
+
- [Testing Guide](./docs/Tests/testing.md)
|
|
201
|
+
- [Bridge Testing Notes](./docs/Tests/testing-bridge-v0.0.9.md)
|
|
202
|
+
- [Test Report for 0.0.7](./docs/Tests/test-report-0.0.7.md)
|
|
160
203
|
|
|
161
204
|
## Documentation
|
|
162
205
|
|
|
163
206
|
- [Chinese README](./README.CN.md)
|
|
164
207
|
- [AI README](./README.AI.md)
|
|
165
208
|
- [Detailed CLI Usage](./docs/cli-usage.md)
|
|
166
|
-
- [Testing Guide](./docs/testing.md)
|
|
167
|
-
- [Test Report for 0.0.5](./docs/test-report-0.0.5.md)
|
|
209
|
+
- [Testing Guide](./docs/Tests/testing.md)
|
|
168
210
|
- [Product Overview](./docs/codex-switch-product-overview.md)
|
|
169
211
|
- [Technical Architecture](./docs/codex-switch-technical-architecture.md)
|
|
170
|
-
- [
|
|
171
|
-
- [Design Doc 0.0.
|
|
212
|
+
- [PRD 0.0.11](./docs/PRD/codex-switch-prd-v0.0.11.md)
|
|
213
|
+
- [Design Doc 0.0.11](./docs/Design/codex-switch-v0.0.11-design.md)
|
|
172
214
|
|
|
173
215
|
## License
|
|
174
216
|
|