@minniexcode/codex-switch 0.1.0 → 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.
- package/README.AI.md +141 -110
- package/README.CN.md +213 -179
- package/README.md +215 -183
- package/dist/app/add-provider.js +15 -23
- package/dist/app/edit-provider.js +30 -65
- package/dist/app/get-current-profile.js +15 -3
- package/dist/app/get-status.js +11 -8
- package/dist/app/list-config-profiles.js +3 -1
- package/dist/app/list-providers.js +10 -4
- package/dist/app/remove-provider.js +52 -19
- package/dist/app/run-doctor.js +26 -29
- package/dist/app/setup-codex.js +3 -3
- package/dist/app/show-config.js +3 -1
- package/dist/app/switch-provider.js +36 -5
- package/dist/cli/output.js +29 -19
- package/dist/commands/handlers.js +2 -2
- package/dist/commands/help.js +3 -3
- package/dist/commands/registry.js +29 -29
- package/dist/domain/config.js +249 -209
- package/dist/domain/providers.js +7 -0
- package/dist/domain/runtime-state.js +15 -15
- package/dist/domain/setup.js +3 -1
- package/dist/interaction/interactive.js +2 -2
- package/dist/runtime/codex-version.js +7 -0
- package/dist/storage/config-repo.js +6 -14
- package/docs/Design/codex-switch-v0.1.1-design.md +33 -0
- package/docs/Reference/codex-config-reference.md +41 -0
- package/docs/Reference/codex-config-reference.zh-CN.md +41 -0
- package/docs/cli-usage.md +282 -223
- package/docs/codex-switch-command-design.md +1 -1
- package/docs/codex-switch-product-overview.md +13 -12
- package/docs/codex-switch-technical-architecture.md +1 -1
- package/package.json +2 -2
|
@@ -20,11 +20,11 @@ exports.COMMANDS = [
|
|
|
20
20
|
tokens: ["config", "show"],
|
|
21
21
|
handler: handlers_1.handleRegisteredCommand,
|
|
22
22
|
group: "read",
|
|
23
|
-
summary: "Show the
|
|
23
|
+
summary: "Show the current route summary and legacy profile view.",
|
|
24
24
|
usage: ["codexs config show [profile] [--json] [--codex-dir <path>]"],
|
|
25
25
|
details: [
|
|
26
|
-
"Returns
|
|
27
|
-
"Passing [profile] narrows the
|
|
26
|
+
"Returns current top-level model/model_provider together with recognizable legacy profile sections.",
|
|
27
|
+
"Passing [profile] narrows the legacy profile view to one section while preserving the same shape.",
|
|
28
28
|
],
|
|
29
29
|
examples: ["codexs config show", "codexs config show packycode --json"],
|
|
30
30
|
},
|
|
@@ -33,11 +33,11 @@ exports.COMMANDS = [
|
|
|
33
33
|
tokens: ["config", "list-profiles"],
|
|
34
34
|
handler: handlers_1.handleRegisteredCommand,
|
|
35
35
|
group: "read",
|
|
36
|
-
summary: "List recognizable config profiles with managed-state hints.",
|
|
36
|
+
summary: "List recognizable legacy config profiles with managed-state hints.",
|
|
37
37
|
usage: ["codexs config list-profiles [--json] [--codex-dir <path>]"],
|
|
38
38
|
details: [
|
|
39
|
-
"Lists managed, unmanaged, and orphaned
|
|
40
|
-
"Use config show for richer single-profile details.",
|
|
39
|
+
"Lists managed, unmanaged, and orphaned legacy profile sections in one stable view.",
|
|
40
|
+
"Use config show for the current route summary and richer single-profile details.",
|
|
41
41
|
],
|
|
42
42
|
examples: ["codexs config list-profiles", "codexs config list-profiles --json"],
|
|
43
43
|
},
|
|
@@ -123,7 +123,7 @@ exports.COMMANDS = [
|
|
|
123
123
|
summary: "Adopt existing Codex runtime profiles into managed providers.json state.",
|
|
124
124
|
usage: ["codexs migrate [--json] [--codex-dir <path>] [--merge|--overwrite]"],
|
|
125
125
|
details: [
|
|
126
|
-
"Reads config.toml profiles, collects complete provider records, then writes providers.json under managed backup flow.",
|
|
126
|
+
"Reads legacy config.toml profiles, collects complete provider records, then writes providers.json under managed backup flow.",
|
|
127
127
|
"TTY mode can collect missing provider details and choose merge or overwrite when providers.json already exists.",
|
|
128
128
|
"Migrate adopts only runtime profiles that already expose model, model_provider, and matching base_url.",
|
|
129
129
|
"Non-TTY and --json runs still fail fast because migrate profile selection and provider details remain interactive in this release.",
|
|
@@ -141,7 +141,7 @@ exports.COMMANDS = [
|
|
|
141
141
|
details: [
|
|
142
142
|
"setup no longer performs initialization or migration work.",
|
|
143
143
|
"Use init for the primary fresh-install workflow.",
|
|
144
|
-
"Use migrate only when adopting from existing config.toml profiles.",
|
|
144
|
+
"Use migrate only when adopting from existing legacy config.toml profiles.",
|
|
145
145
|
],
|
|
146
146
|
examples: ["codexs help init", "codexs help migrate"],
|
|
147
147
|
},
|
|
@@ -150,11 +150,11 @@ exports.COMMANDS = [
|
|
|
150
150
|
tokens: ["list"],
|
|
151
151
|
handler: handlers_1.handleRegisteredCommand,
|
|
152
152
|
group: "read",
|
|
153
|
-
summary: "List managed providers with
|
|
153
|
+
summary: "List managed providers with model-provider routing and current-state hints.",
|
|
154
154
|
usage: ["codexs list [--json] [--codex-dir <path>]"],
|
|
155
155
|
details: [
|
|
156
|
-
"Reads providers.json and prints provider-to-
|
|
157
|
-
"When the active
|
|
156
|
+
"Reads providers.json and prints provider-to-model-provider mappings together with provider type.",
|
|
157
|
+
"When the active model_provider is shared by multiple providers, list surfaces the ambiguity instead of inventing one current provider.",
|
|
158
158
|
"Use --json for machine-readable automation output.",
|
|
159
159
|
],
|
|
160
160
|
examples: ["codexs list", "codexs list --json"],
|
|
@@ -178,9 +178,9 @@ exports.COMMANDS = [
|
|
|
178
178
|
tokens: ["current"],
|
|
179
179
|
handler: handlers_1.handleRegisteredCommand,
|
|
180
180
|
group: "read",
|
|
181
|
-
summary: "Show the active top-level
|
|
181
|
+
summary: "Show the active top-level model/model_provider route from config.toml.",
|
|
182
182
|
usage: ["codexs current [--json] [--codex-dir <path>]"],
|
|
183
|
-
details: ["Reads the currently active top-level
|
|
183
|
+
details: ["Reads the currently active top-level model and model_provider.", "Fails when config.toml is missing or has no top-level model_provider."],
|
|
184
184
|
examples: ["codexs current", "codexs current --json"],
|
|
185
185
|
},
|
|
186
186
|
{
|
|
@@ -191,7 +191,7 @@ exports.COMMANDS = [
|
|
|
191
191
|
summary: "Show tool-home, target-runtime, provider-path, and runtime-health status.",
|
|
192
192
|
usage: ["codexs status [--json] [--codex-dir <path>]"],
|
|
193
193
|
details: [
|
|
194
|
-
"Reports the target Codex runtime, tool-home storage roles, current
|
|
194
|
+
"Reports the target Codex runtime, tool-home storage roles, current model, current model_provider, and whether the live route is mapped.",
|
|
195
195
|
"When the active provider uses a local runtime bridge, status also reports bridge, Copilot SDK, and upstream auth state.",
|
|
196
196
|
"Surfaces dual-path config consistency signals without mutating any files.",
|
|
197
197
|
"Organizes the human-readable view around current state, health impact, and next step.",
|
|
@@ -206,14 +206,15 @@ exports.COMMANDS = [
|
|
|
206
206
|
group: "write",
|
|
207
207
|
summary: "Update fields on a single provider record.",
|
|
208
208
|
usage: [
|
|
209
|
-
"codexs edit <provider> [--profile <
|
|
210
|
-
"codexs edit <provider> --profile <
|
|
209
|
+
"codexs edit <provider> [--profile <model-provider-id>] [--api-key <key>] [--base-url <url>] [--model <name>] [--note <text>] [--tag <tag> ...] [--json] [--codex-dir <path>]",
|
|
210
|
+
"codexs edit <provider> --profile <model-provider-id> --model <name> --base-url <url>",
|
|
211
211
|
],
|
|
212
212
|
details: [
|
|
213
213
|
"Passed flags replace only the selected fields and keep the rest unchanged.",
|
|
214
214
|
"TTY mode can first select a provider, then prompt for fields when no editable options were provided.",
|
|
215
215
|
"Interactive tags use preset multi-select only.",
|
|
216
|
-
"
|
|
216
|
+
"--profile is a CLI alias for the stored model_provider id.",
|
|
217
|
+
"When rebinding to a new direct model_provider id, the command must be able to project base_url from --base-url, the provider record, or an existing model_providers section.",
|
|
217
218
|
"Backs up providers.json and config.toml before writing.",
|
|
218
219
|
],
|
|
219
220
|
examples: ["codexs edit packycode --note primary", "codexs edit packycode --tag daily --tag paid --json"],
|
|
@@ -225,27 +226,26 @@ exports.COMMANDS = [
|
|
|
225
226
|
group: "write",
|
|
226
227
|
summary: "Add a managed provider for the primary direct or Copilot workflows.",
|
|
227
228
|
usage: [
|
|
228
|
-
"codexs add <provider> --profile <name> --api-key <key> [--base-url <url>] [--note <text>] [--tag <tag> ...]",
|
|
229
|
-
"codexs add <provider> --copilot --profile <name> [--bridge-host <host>] [--bridge-port <port>] [--bridge-api-key <secret>]
|
|
230
|
-
"codexs add <provider> --
|
|
231
|
-
"codexs add [--profile <name>] [--api-key <key>] [--base-url <url>] [--note <text>] [--tag <tag> ...]",
|
|
229
|
+
"codexs add <provider> --profile <model-provider-id> --model <name> --api-key <key> [--base-url <url>] [--note <text>] [--tag <tag> ...]",
|
|
230
|
+
"codexs add <provider> --copilot --profile <model-provider-id> --model <name> [--bridge-host <host>] [--bridge-port <port>] [--bridge-api-key <secret>]",
|
|
231
|
+
"codexs add [--profile <model-provider-id>] [--model <name>] [--api-key <key>] [--base-url <url>] [--note <text>] [--tag <tag> ...]",
|
|
232
232
|
],
|
|
233
233
|
details: [
|
|
234
234
|
"Prompts only for missing required values when stdin/stdout are TTYs and --json is not set.",
|
|
235
|
-
"Interactive add collects provider name,
|
|
235
|
+
"Interactive add collects provider name, model_provider id, model, and apiKey progressively as plain text inputs.",
|
|
236
236
|
"Confirm API key when prompted interactively because the hidden prompt asks twice before writing.",
|
|
237
237
|
"Interactive tags use preset multi-select only.",
|
|
238
238
|
"Automation and non-TTY environments must pass all required values explicitly.",
|
|
239
|
-
"
|
|
240
|
-
"
|
|
239
|
+
"--profile is a CLI alias for the stored model_provider id.",
|
|
240
|
+
"The command projects only model_providers sections and does not create legacy profiles sections.",
|
|
241
241
|
"Use --copilot to create a GitHub Copilot bridge provider backed by the official SDK.",
|
|
242
242
|
"Copilot providers require SDK install and login readiness to already be satisfied via codexs login copilot.",
|
|
243
243
|
"For Copilot providers, provider apiKey stores only the local bridge secret; upstream GitHub Copilot auth stays shared in the official runtime login.",
|
|
244
244
|
"--install-copilot-sdk is kept only as a rejected compatibility flag that points to codexs login copilot.",
|
|
245
245
|
],
|
|
246
246
|
examples: [
|
|
247
|
-
"codexs add packycode --profile packycode --api-key sk-xxx",
|
|
248
|
-
"codexs add copilot-main --copilot --profile copilot-main",
|
|
247
|
+
"codexs add packycode --profile packycode --model gpt-5 --api-key sk-xxx --base-url https://api.example/v1",
|
|
248
|
+
"codexs add copilot-main --copilot --profile copilot-main --model gpt-5",
|
|
249
249
|
"codexs add",
|
|
250
250
|
],
|
|
251
251
|
},
|
|
@@ -273,12 +273,12 @@ exports.COMMANDS = [
|
|
|
273
273
|
handler: handlers_1.handleRegisteredCommand,
|
|
274
274
|
group: "write",
|
|
275
275
|
summary: "Remove a provider from providers.json.",
|
|
276
|
-
usage: ["codexs remove <provider> [--force] [--switch-to <
|
|
276
|
+
usage: ["codexs remove <provider> [--force] [--switch-to <provider>] [--json] [--codex-dir <path>]"],
|
|
277
277
|
details: [
|
|
278
278
|
"TTY mode can select a missing provider interactively and always asks for deletion confirmation.",
|
|
279
279
|
"Non-TTY and --json automation still require both <provider> and --force.",
|
|
280
280
|
"The confirmation prompt includes the provider name and cancels without writing when declined.",
|
|
281
|
-
"When removing the
|
|
281
|
+
"When removing the only provider linked to the active model_provider route, pass --switch-to <provider-name> first.",
|
|
282
282
|
"Backs up providers.json and config.toml before removing the record.",
|
|
283
283
|
],
|
|
284
284
|
examples: ["codexs remove freemodel", "codexs remove freemodel --force --json"],
|
|
@@ -332,7 +332,7 @@ exports.COMMANDS = [
|
|
|
332
332
|
summary: "Run issue-first diagnostics across tool-home and target-runtime state.",
|
|
333
333
|
usage: ["codexs doctor [--json] [--codex-dir <path>]"],
|
|
334
334
|
details: [
|
|
335
|
-
"Checks the expected config files, provider/
|
|
335
|
+
"Checks the expected config files, provider/model-provider consistency, and Codex CLI availability.",
|
|
336
336
|
"Copilot bridge providers add runtime dependency, auth, and bridge health diagnostics.",
|
|
337
337
|
"Returns structured issues so users and AI agents can act on them.",
|
|
338
338
|
],
|