@minniexcode/codex-switch 0.0.12 → 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.
- package/README.AI.md +110 -110
- package/README.CN.md +179 -179
- package/README.md +183 -183
- package/dist/app/add-provider.js +9 -3
- package/dist/app/edit-provider.js +17 -3
- package/dist/app/run-doctor.js +4 -0
- package/dist/cli/output.js +8 -0
- package/dist/commands/registry.js +9 -4
- package/dist/domain/config.js +26 -1
- package/dist/domain/providers.js +16 -0
- package/docs/Design/codex-switch-v0.1.0-design.md +152 -0
- package/docs/PRD/codex-switch-prd-v0.1.0.md +217 -205
- package/docs/Tests/testing.md +31 -78
- package/docs/cli-usage.md +223 -223
- package/docs/codex-switch-command-design.md +649 -649
- package/docs/codex-switch-product-overview.md +86 -86
- package/docs/codex-switch-technical-architecture.md +1115 -1115
- package/package.json +51 -51
package/README.AI.md
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
# AI README
|
|
2
|
-
|
|
3
|
-
This file summarizes the current operational contract for AI agents, automation scripts, and contributors.
|
|
4
|
-
|
|
5
|
-
## Package Context
|
|
6
|
-
|
|
7
|
-
- Package: `@minniexcode/codex-switch`
|
|
8
|
-
- CLI name: `codexs`
|
|
9
|
-
- Current repository version: `0.0
|
|
10
|
-
- Version status:
|
|
11
|
-
|
|
12
|
-
## Product Role
|
|
13
|
-
|
|
14
|
-
`codex-switch` is a local-first TypeScript CLI that manages provider and profile state for Codex while keeping tool-managed state separate from the target Codex runtime.
|
|
15
|
-
|
|
16
|
-
The managed source of truth is the tool home. Runtime files under the target Codex directory are projected outputs, not the main registry.
|
|
17
|
-
|
|
18
|
-
## Primary Workflows
|
|
19
|
-
|
|
20
|
-
Direct provider workflow:
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
codexs init
|
|
24
|
-
codexs add <provider> --profile <name> --api-key <key>
|
|
25
|
-
codexs switch <provider>
|
|
26
|
-
codexs status
|
|
27
|
-
codexs doctor
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
GitHub Copilot workflow:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
codexs init
|
|
34
|
-
codexs login copilot
|
|
35
|
-
codexs add <provider> --copilot --profile <name>
|
|
36
|
-
codexs switch <provider>
|
|
37
|
-
codexs status
|
|
38
|
-
codexs doctor
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Advanced adopt workflow:
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
codexs init
|
|
45
|
-
codexs migrate
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
`migrate` is not a fresh-install default. It is an advanced adopt helper for existing runtime state.
|
|
49
|
-
|
|
50
|
-
## Important Paths
|
|
51
|
-
|
|
52
|
-
Tool home:
|
|
53
|
-
|
|
54
|
-
```text
|
|
55
|
-
~/.config/codex-switch/
|
|
56
|
-
codex-switch.json
|
|
57
|
-
providers.json
|
|
58
|
-
backups/
|
|
59
|
-
runtime/
|
|
60
|
-
runtimes/
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
Target Codex runtime:
|
|
64
|
-
|
|
65
|
-
```text
|
|
66
|
-
~/.codex/
|
|
67
|
-
config.toml
|
|
68
|
-
auth.json
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Operational meaning:
|
|
72
|
-
|
|
73
|
-
- `providers.json` is the managed provider registry.
|
|
74
|
-
- `codex-switch.json` stores tool-level metadata such as the default target Codex directory.
|
|
75
|
-
- `config.toml` is the active runtime routing file.
|
|
76
|
-
- `auth.json` is the active auth projection file.
|
|
77
|
-
|
|
78
|
-
## Command Notes
|
|
79
|
-
|
|
80
|
-
Shared flags:
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
--json
|
|
84
|
-
--codex-dir <path>
|
|
85
|
-
--help
|
|
86
|
-
--version
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Relevant environment variables:
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
CODEXS_HOME
|
|
93
|
-
CODEXS_CODEX_DIR
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
Important behavioral constraints:
|
|
97
|
-
|
|
98
|
-
- Prefer `--json` for programmatic invocation whenever the command supports it.
|
|
99
|
-
- `login copilot` requires a real TTY and does not support `--json`.
|
|
100
|
-
- `login copilot` currently installs the local Copilot SDK when needed, tries the bundled runtime CLI first, falls back to `PATH` when necessary, and rechecks auth readiness before reporting success.
|
|
101
|
-
- `add --copilot` assumes SDK install and upstream Copilot auth are already ready.
|
|
102
|
-
- `migrate`
|
|
103
|
-
- `status` is the main dual-path summary command.
|
|
104
|
-
- `doctor` is the deeper repair-oriented diagnostic command.
|
|
105
|
-
|
|
106
|
-
## Safety Notes
|
|
107
|
-
|
|
108
|
-
- Treat `providers.json` as sensitive because it may contain API keys.
|
|
109
|
-
- Human-readable output may mask secrets, but JSON output can expose full provider payloads.
|
|
110
|
-
- Managed write operations rely on backup and rollback flow; do not describe manual file edits as the primary workflow.
|
|
1
|
+
# AI README
|
|
2
|
+
|
|
3
|
+
This file summarizes the current operational contract for AI agents, automation scripts, and contributors.
|
|
4
|
+
|
|
5
|
+
## Package Context
|
|
6
|
+
|
|
7
|
+
- Package: `@minniexcode/codex-switch`
|
|
8
|
+
- CLI name: `codexs`
|
|
9
|
+
- Current repository version: `0.1.0`
|
|
10
|
+
- Version status: stable release line
|
|
11
|
+
|
|
12
|
+
## Product Role
|
|
13
|
+
|
|
14
|
+
`codex-switch` is a local-first TypeScript CLI that manages provider and profile state for Codex while keeping tool-managed state separate from the target Codex runtime.
|
|
15
|
+
|
|
16
|
+
The managed source of truth is the tool home. Runtime files under the target Codex directory are projected outputs, not the main registry.
|
|
17
|
+
|
|
18
|
+
## Primary Workflows
|
|
19
|
+
|
|
20
|
+
Direct provider workflow:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
codexs init
|
|
24
|
+
codexs add <provider> --profile <name> --api-key <key>
|
|
25
|
+
codexs switch <provider>
|
|
26
|
+
codexs status
|
|
27
|
+
codexs doctor
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
GitHub Copilot workflow:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
codexs init
|
|
34
|
+
codexs login copilot
|
|
35
|
+
codexs add <provider> --copilot --profile <name>
|
|
36
|
+
codexs switch <provider>
|
|
37
|
+
codexs status
|
|
38
|
+
codexs doctor
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Advanced adopt workflow:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
codexs init
|
|
45
|
+
codexs migrate
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`migrate` is not a fresh-install default. It is an advanced adopt helper for existing runtime state.
|
|
49
|
+
|
|
50
|
+
## Important Paths
|
|
51
|
+
|
|
52
|
+
Tool home:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
~/.config/codex-switch/
|
|
56
|
+
codex-switch.json
|
|
57
|
+
providers.json
|
|
58
|
+
backups/
|
|
59
|
+
runtime/
|
|
60
|
+
runtimes/
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Target Codex runtime:
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
~/.codex/
|
|
67
|
+
config.toml
|
|
68
|
+
auth.json
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Operational meaning:
|
|
72
|
+
|
|
73
|
+
- `providers.json` is the managed provider registry.
|
|
74
|
+
- `codex-switch.json` stores tool-level metadata such as the default target Codex directory.
|
|
75
|
+
- `config.toml` is the active runtime routing file.
|
|
76
|
+
- `auth.json` is the active auth projection file.
|
|
77
|
+
|
|
78
|
+
## Command Notes
|
|
79
|
+
|
|
80
|
+
Shared flags:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
--json
|
|
84
|
+
--codex-dir <path>
|
|
85
|
+
--help
|
|
86
|
+
--version
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Relevant environment variables:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
CODEXS_HOME
|
|
93
|
+
CODEXS_CODEX_DIR
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Important behavioral constraints:
|
|
97
|
+
|
|
98
|
+
- Prefer `--json` for programmatic invocation whenever the command supports it.
|
|
99
|
+
- `login copilot` requires a real TTY and does not support `--json`.
|
|
100
|
+
- `login copilot` currently installs the local Copilot SDK when needed, tries the bundled runtime CLI first, falls back to `PATH` when necessary, and rechecks auth readiness before reporting success.
|
|
101
|
+
- `add --copilot` assumes SDK install and upstream Copilot auth are already ready.
|
|
102
|
+
- `migrate` remains interactive when provider adoption requires human input.
|
|
103
|
+
- `status` is the main dual-path summary command.
|
|
104
|
+
- `doctor` is the deeper repair-oriented diagnostic command.
|
|
105
|
+
|
|
106
|
+
## Safety Notes
|
|
107
|
+
|
|
108
|
+
- Treat `providers.json` as sensitive because it may contain API keys.
|
|
109
|
+
- Human-readable output may mask secrets, but JSON output can expose full provider payloads.
|
|
110
|
+
- Managed write operations rely on backup and rollback flow; do not describe manual file edits as the primary workflow.
|
package/README.CN.md
CHANGED
|
@@ -1,179 +1,179 @@
|
|
|
1
|
-
# @minniexcode/codex-switch
|
|
2
|
-
|
|
3
|
-
`@minniexcode/codex-switch` 是一个本地优先的 CLI,用来安全地管理和切换 Codex 的 provider 与 profile 配置。
|
|
4
|
-
|
|
5
|
-
它把 `codex-switch` 自己的工具状态和目标 Codex runtime 明确分开,让 provider 管理、备份与 runtime 投影有一套受管流程,而不是依赖手工改文件。
|
|
6
|
-
|
|
7
|
-
## 版本定位
|
|
8
|
-
|
|
9
|
-
当前包版本:`0.0
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## 安装
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm install -g @minniexcode/codex-switch
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
不全局安装时也可以直接运行:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npx @minniexcode/codex-switch --help
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
CLI 命令名:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
codexs --help
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## 主工作流
|
|
32
|
-
|
|
33
|
-
Direct provider 主路径:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
codexs init
|
|
37
|
-
codexs add my-provider --profile my-provider --api-key sk-xxx
|
|
38
|
-
codexs switch my-provider
|
|
39
|
-
codexs status
|
|
40
|
-
codexs doctor
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
GitHub Copilot 主路径:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
codexs init
|
|
47
|
-
codexs login copilot
|
|
48
|
-
codexs add copilot-main --copilot --profile copilot-main
|
|
49
|
-
codexs switch copilot-main
|
|
50
|
-
codexs status
|
|
51
|
-
codexs doctor
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
说明:
|
|
55
|
-
|
|
56
|
-
- `init` 负责初始化 `codex-switch` 的 tool home 与受管状态文件。
|
|
57
|
-
- `login copilot` 负责上游 Copilot onboarding 和登录可用性检查。
|
|
58
|
-
- `add --copilot` 不负责替你登录,它假设上游 Copilot 已经 ready。
|
|
59
|
-
- `status` 是切换后的主读取命令。
|
|
60
|
-
- `doctor` 是主诊断命令,用于解释问题和下一步修复动作。
|
|
61
|
-
|
|
62
|
-
## Advanced Adopt 路径
|
|
63
|
-
|
|
64
|
-
如果你已经有现成的 Codex runtime 状态,希望把它 adopt 到受管 `providers.json`,再使用:
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
codexs init
|
|
68
|
-
codexs migrate
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
`migrate` 是高级 adopt helper,不是 fresh install 的默认第一步。
|
|
72
|
-
|
|
73
|
-
## 命令面
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
codexs init
|
|
77
|
-
codexs login copilot
|
|
78
|
-
codexs migrate
|
|
79
|
-
codexs list
|
|
80
|
-
codexs show <provider>
|
|
81
|
-
codexs current
|
|
82
|
-
codexs status
|
|
83
|
-
codexs config show [profile]
|
|
84
|
-
codexs config list-profiles
|
|
85
|
-
codexs add <provider> --profile <name> --api-key <key>
|
|
86
|
-
codexs add <provider> --copilot --profile <name>
|
|
87
|
-
codexs edit <provider>
|
|
88
|
-
codexs switch <provider>
|
|
89
|
-
codexs remove <provider> [--force] [--switch-to <profile>]
|
|
90
|
-
codexs import <file>
|
|
91
|
-
codexs export <file> [--force]
|
|
92
|
-
codexs bridge start [provider]
|
|
93
|
-
codexs bridge status [provider]
|
|
94
|
-
codexs bridge stop [provider]
|
|
95
|
-
codexs backups list
|
|
96
|
-
codexs rollback [backup-id]
|
|
97
|
-
codexs doctor
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
`setup` 仍然存在,但只作为已弃用兼容入口,用来提示调用方改用 `init` 或 `migrate`。
|
|
101
|
-
|
|
102
|
-
## 双路径模型
|
|
103
|
-
|
|
104
|
-
tool home:
|
|
105
|
-
|
|
106
|
-
```text
|
|
107
|
-
~/.config/codex-switch/
|
|
108
|
-
codex-switch.json
|
|
109
|
-
providers.json
|
|
110
|
-
backups/
|
|
111
|
-
runtime/
|
|
112
|
-
runtimes/
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
目标 Codex runtime:
|
|
116
|
-
|
|
117
|
-
```text
|
|
118
|
-
~/.codex/
|
|
119
|
-
config.toml
|
|
120
|
-
auth.json
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
关键边界:
|
|
124
|
-
|
|
125
|
-
- `providers.json` 是受管 provider 注册表,位于 tool home。
|
|
126
|
-
- `codex-switch.json` 保存工具级元数据,例如 `defaultCodexDir`。
|
|
127
|
-
- `config.toml` 仍然是目标 runtime 里的活动路由文件。
|
|
128
|
-
- `auth.json` 仍然是目标 runtime 里的活动认证投影文件。
|
|
129
|
-
- Direct provider 切换会改写活动 runtime 中的 `OPENAI_API_KEY`。
|
|
130
|
-
- Copilot provider 保持上游 GitHub 登录留在官方 Copilot runtime 中,`codex-switch` 只管理本地 bridge 状态与路由。
|
|
131
|
-
|
|
132
|
-
路径控制:
|
|
133
|
-
|
|
134
|
-
- `--codex-dir <path>` 显式指定目标 Codex runtime 目录。
|
|
135
|
-
- `CODEXS_CODEX_DIR` 在未传 `--codex-dir` 时提供默认目标目录。
|
|
136
|
-
- `CODEXS_HOME` 用于覆盖 tool home 位置。
|
|
137
|
-
|
|
138
|
-
## 自动化说明
|
|
139
|
-
|
|
140
|
-
这个 CLI 同时支持人类终端使用和非交互自动化。
|
|
141
|
-
|
|
142
|
-
全局参数:
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
--json
|
|
146
|
-
--codex-dir <path>
|
|
147
|
-
--help
|
|
148
|
-
--version
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
当前实现边界:
|
|
152
|
-
|
|
153
|
-
- `login copilot` 必须运行在真实 TTY 下,不支持 `--json`。
|
|
154
|
-
- `migrate`
|
|
155
|
-
- 自动化调用应尽量显式传参,并优先使用 `--json`。
|
|
156
|
-
|
|
157
|
-
## 本地开发
|
|
158
|
-
|
|
159
|
-
```bash
|
|
160
|
-
npm run build
|
|
161
|
-
npm test
|
|
162
|
-
npx tsc --noEmit
|
|
163
|
-
node dist/cli.js --help
|
|
164
|
-
npm pack --dry-run
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
## 相关文档
|
|
168
|
-
|
|
169
|
-
- [English README](./README.md)
|
|
170
|
-
- [AI README](./README.AI.md)
|
|
171
|
-
- [详细 CLI 文档](./docs/cli-usage.md)
|
|
172
|
-
- [产品概览](./docs/codex-switch-product-overview.md)
|
|
173
|
-
- [测试说明](./docs/Tests/testing.md)
|
|
174
|
-
- [PRD 0.0
|
|
175
|
-
- [Release Gate PRD 0.1.0](./docs/PRD/codex-switch-prd-v0.1.0.md)
|
|
176
|
-
|
|
177
|
-
## License
|
|
178
|
-
|
|
179
|
-
MIT
|
|
1
|
+
# @minniexcode/codex-switch
|
|
2
|
+
|
|
3
|
+
`@minniexcode/codex-switch` 是一个本地优先的 CLI,用来安全地管理和切换 Codex 的 provider 与 profile 配置。
|
|
4
|
+
|
|
5
|
+
它把 `codex-switch` 自己的工具状态和目标 Codex runtime 明确分开,让 provider 管理、备份与 runtime 投影有一套受管流程,而不是依赖手工改文件。
|
|
6
|
+
|
|
7
|
+
## 版本定位
|
|
8
|
+
|
|
9
|
+
当前包版本:`0.1.0`
|
|
10
|
+
|
|
11
|
+
这是第一条稳定发布线。这个版本的重点不是继续扩命令面,而是把主工作流、帮助文案、实际行为和发布文档统一到同一套契约上。
|
|
12
|
+
|
|
13
|
+
## 安装
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g @minniexcode/codex-switch
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
不全局安装时也可以直接运行:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx @minniexcode/codex-switch --help
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
CLI 命令名:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
codexs --help
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 主工作流
|
|
32
|
+
|
|
33
|
+
Direct provider 主路径:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
codexs init
|
|
37
|
+
codexs add my-provider --profile my-provider --api-key sk-xxx
|
|
38
|
+
codexs switch my-provider
|
|
39
|
+
codexs status
|
|
40
|
+
codexs doctor
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
GitHub Copilot 主路径:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
codexs init
|
|
47
|
+
codexs login copilot
|
|
48
|
+
codexs add copilot-main --copilot --profile copilot-main
|
|
49
|
+
codexs switch copilot-main
|
|
50
|
+
codexs status
|
|
51
|
+
codexs doctor
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
说明:
|
|
55
|
+
|
|
56
|
+
- `init` 负责初始化 `codex-switch` 的 tool home 与受管状态文件。
|
|
57
|
+
- `login copilot` 负责上游 Copilot onboarding 和登录可用性检查。
|
|
58
|
+
- `add --copilot` 不负责替你登录,它假设上游 Copilot 已经 ready。
|
|
59
|
+
- `status` 是切换后的主读取命令。
|
|
60
|
+
- `doctor` 是主诊断命令,用于解释问题和下一步修复动作。
|
|
61
|
+
|
|
62
|
+
## Advanced Adopt 路径
|
|
63
|
+
|
|
64
|
+
如果你已经有现成的 Codex runtime 状态,希望把它 adopt 到受管 `providers.json`,再使用:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
codexs init
|
|
68
|
+
codexs migrate
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`migrate` 是高级 adopt helper,不是 fresh install 的默认第一步。
|
|
72
|
+
|
|
73
|
+
## 命令面
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
codexs init
|
|
77
|
+
codexs login copilot
|
|
78
|
+
codexs migrate
|
|
79
|
+
codexs list
|
|
80
|
+
codexs show <provider>
|
|
81
|
+
codexs current
|
|
82
|
+
codexs status
|
|
83
|
+
codexs config show [profile]
|
|
84
|
+
codexs config list-profiles
|
|
85
|
+
codexs add <provider> --profile <name> --api-key <key>
|
|
86
|
+
codexs add <provider> --copilot --profile <name>
|
|
87
|
+
codexs edit <provider>
|
|
88
|
+
codexs switch <provider>
|
|
89
|
+
codexs remove <provider> [--force] [--switch-to <profile>]
|
|
90
|
+
codexs import <file>
|
|
91
|
+
codexs export <file> [--force]
|
|
92
|
+
codexs bridge start [provider]
|
|
93
|
+
codexs bridge status [provider]
|
|
94
|
+
codexs bridge stop [provider]
|
|
95
|
+
codexs backups list
|
|
96
|
+
codexs rollback [backup-id]
|
|
97
|
+
codexs doctor
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`setup` 仍然存在,但只作为已弃用兼容入口,用来提示调用方改用 `init` 或 `migrate`。
|
|
101
|
+
|
|
102
|
+
## 双路径模型
|
|
103
|
+
|
|
104
|
+
tool home:
|
|
105
|
+
|
|
106
|
+
```text
|
|
107
|
+
~/.config/codex-switch/
|
|
108
|
+
codex-switch.json
|
|
109
|
+
providers.json
|
|
110
|
+
backups/
|
|
111
|
+
runtime/
|
|
112
|
+
runtimes/
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
目标 Codex runtime:
|
|
116
|
+
|
|
117
|
+
```text
|
|
118
|
+
~/.codex/
|
|
119
|
+
config.toml
|
|
120
|
+
auth.json
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
关键边界:
|
|
124
|
+
|
|
125
|
+
- `providers.json` 是受管 provider 注册表,位于 tool home。
|
|
126
|
+
- `codex-switch.json` 保存工具级元数据,例如 `defaultCodexDir`。
|
|
127
|
+
- `config.toml` 仍然是目标 runtime 里的活动路由文件。
|
|
128
|
+
- `auth.json` 仍然是目标 runtime 里的活动认证投影文件。
|
|
129
|
+
- Direct provider 切换会改写活动 runtime 中的 `OPENAI_API_KEY`。
|
|
130
|
+
- Copilot provider 保持上游 GitHub 登录留在官方 Copilot runtime 中,`codex-switch` 只管理本地 bridge 状态与路由。
|
|
131
|
+
|
|
132
|
+
路径控制:
|
|
133
|
+
|
|
134
|
+
- `--codex-dir <path>` 显式指定目标 Codex runtime 目录。
|
|
135
|
+
- `CODEXS_CODEX_DIR` 在未传 `--codex-dir` 时提供默认目标目录。
|
|
136
|
+
- `CODEXS_HOME` 用于覆盖 tool home 位置。
|
|
137
|
+
|
|
138
|
+
## 自动化说明
|
|
139
|
+
|
|
140
|
+
这个 CLI 同时支持人类终端使用和非交互自动化。
|
|
141
|
+
|
|
142
|
+
全局参数:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
--json
|
|
146
|
+
--codex-dir <path>
|
|
147
|
+
--help
|
|
148
|
+
--version
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
当前实现边界:
|
|
152
|
+
|
|
153
|
+
- `login copilot` 必须运行在真实 TTY 下,不支持 `--json`。
|
|
154
|
+
- `migrate` 在需要人工补齐 adopt 信息时仍然保持交互式语义。
|
|
155
|
+
- 自动化调用应尽量显式传参,并优先使用 `--json`。
|
|
156
|
+
|
|
157
|
+
## 本地开发
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
npm run build
|
|
161
|
+
npm test
|
|
162
|
+
npx tsc --noEmit
|
|
163
|
+
node dist/cli.js --help
|
|
164
|
+
npm pack --dry-run
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## 相关文档
|
|
168
|
+
|
|
169
|
+
- [English README](./README.md)
|
|
170
|
+
- [AI README](./README.AI.md)
|
|
171
|
+
- [详细 CLI 文档](./docs/cli-usage.md)
|
|
172
|
+
- [产品概览](./docs/codex-switch-product-overview.md)
|
|
173
|
+
- [测试说明](./docs/Tests/testing.md)
|
|
174
|
+
- [Release PRD 0.1.0](./docs/PRD/codex-switch-prd-v0.1.0.md)
|
|
175
|
+
- [Release Gate PRD 0.1.0](./docs/PRD/codex-switch-prd-v0.1.0.md)
|
|
176
|
+
|
|
177
|
+
## License
|
|
178
|
+
|
|
179
|
+
MIT
|