@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.
- package/README.AI.md +37 -6
- package/README.CN.md +45 -11
- package/README.md +45 -13
- package/dist/app/add-provider.js +22 -24
- package/dist/app/edit-provider.js +34 -55
- 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 +29 -28
- 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 +36 -18
- package/dist/commands/handlers.js +2 -2
- package/dist/commands/help.js +3 -3
- package/dist/commands/registry.js +35 -30
- package/dist/domain/config.js +250 -185
- package/dist/domain/providers.js +23 -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.0-design.md +152 -0
- package/docs/Design/codex-switch-v0.1.1-design.md +33 -0
- package/docs/PRD/codex-switch-prd-v0.1.0.md +217 -205
- package/docs/Reference/codex-config-reference.md +41 -0
- package/docs/Reference/codex-config-reference.zh-CN.md +41 -0
- package/docs/Tests/testing.md +31 -78
- package/docs/cli-usage.md +86 -27
- package/docs/codex-switch-command-design.md +649 -649
- package/docs/codex-switch-product-overview.md +81 -80
- package/docs/codex-switch-technical-architecture.md +1115 -1115
- package/package.json +51 -51
|
@@ -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,9 +150,13 @@ exports.COMMANDS = [
|
|
|
150
150
|
tokens: ["list"],
|
|
151
151
|
handler: handlers_1.handleRegisteredCommand,
|
|
152
152
|
group: "read",
|
|
153
|
-
summary: "List
|
|
153
|
+
summary: "List managed providers with model-provider routing and current-state hints.",
|
|
154
154
|
usage: ["codexs list [--json] [--codex-dir <path>]"],
|
|
155
|
-
details: [
|
|
155
|
+
details: [
|
|
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
|
+
"Use --json for machine-readable automation output.",
|
|
159
|
+
],
|
|
156
160
|
examples: ["codexs list", "codexs list --json"],
|
|
157
161
|
},
|
|
158
162
|
{
|
|
@@ -174,9 +178,9 @@ exports.COMMANDS = [
|
|
|
174
178
|
tokens: ["current"],
|
|
175
179
|
handler: handlers_1.handleRegisteredCommand,
|
|
176
180
|
group: "read",
|
|
177
|
-
summary: "Show the active top-level
|
|
181
|
+
summary: "Show the active top-level model/model_provider route from config.toml.",
|
|
178
182
|
usage: ["codexs current [--json] [--codex-dir <path>]"],
|
|
179
|
-
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."],
|
|
180
184
|
examples: ["codexs current", "codexs current --json"],
|
|
181
185
|
},
|
|
182
186
|
{
|
|
@@ -184,12 +188,13 @@ exports.COMMANDS = [
|
|
|
184
188
|
tokens: ["status"],
|
|
185
189
|
handler: handlers_1.handleRegisteredCommand,
|
|
186
190
|
group: "read",
|
|
187
|
-
summary: "Show tool-home, target-runtime, provider, and runtime-health status.",
|
|
191
|
+
summary: "Show tool-home, target-runtime, provider-path, and runtime-health status.",
|
|
188
192
|
usage: ["codexs status [--json] [--codex-dir <path>]"],
|
|
189
193
|
details: [
|
|
190
|
-
"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.",
|
|
191
195
|
"When the active provider uses a local runtime bridge, status also reports bridge, Copilot SDK, and upstream auth state.",
|
|
192
196
|
"Surfaces dual-path config consistency signals without mutating any files.",
|
|
197
|
+
"Organizes the human-readable view around current state, health impact, and next step.",
|
|
193
198
|
"Use doctor for deeper diagnostics.",
|
|
194
199
|
],
|
|
195
200
|
examples: ["codexs status", "codexs status --json --codex-dir ./.tmp-codex"],
|
|
@@ -201,14 +206,15 @@ exports.COMMANDS = [
|
|
|
201
206
|
group: "write",
|
|
202
207
|
summary: "Update fields on a single provider record.",
|
|
203
208
|
usage: [
|
|
204
|
-
"codexs edit <provider> [--profile <
|
|
205
|
-
"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>",
|
|
206
211
|
],
|
|
207
212
|
details: [
|
|
208
213
|
"Passed flags replace only the selected fields and keep the rest unchanged.",
|
|
209
214
|
"TTY mode can first select a provider, then prompt for fields when no editable options were provided.",
|
|
210
215
|
"Interactive tags use preset multi-select only.",
|
|
211
|
-
"
|
|
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.",
|
|
212
218
|
"Backs up providers.json and config.toml before writing.",
|
|
213
219
|
],
|
|
214
220
|
examples: ["codexs edit packycode --note primary", "codexs edit packycode --tag daily --tag paid --json"],
|
|
@@ -220,27 +226,26 @@ exports.COMMANDS = [
|
|
|
220
226
|
group: "write",
|
|
221
227
|
summary: "Add a managed provider for the primary direct or Copilot workflows.",
|
|
222
228
|
usage: [
|
|
223
|
-
"codexs add <provider> --profile <name> --api-key <key> [--base-url <url>] [--note <text>] [--tag <tag> ...]",
|
|
224
|
-
"codexs add <provider> --copilot --profile <name> [--bridge-host <host>] [--bridge-port <port>] [--bridge-api-key <secret>]
|
|
225
|
-
"codexs add <provider> --
|
|
226
|
-
"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> ...]",
|
|
227
232
|
],
|
|
228
233
|
details: [
|
|
229
234
|
"Prompts only for missing required values when stdin/stdout are TTYs and --json is not set.",
|
|
230
|
-
"Interactive add collects provider name,
|
|
235
|
+
"Interactive add collects provider name, model_provider id, model, and apiKey progressively as plain text inputs.",
|
|
231
236
|
"Confirm API key when prompted interactively because the hidden prompt asks twice before writing.",
|
|
232
237
|
"Interactive tags use preset multi-select only.",
|
|
233
238
|
"Automation and non-TTY environments must pass all required values explicitly.",
|
|
234
|
-
"
|
|
235
|
-
"
|
|
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.",
|
|
236
241
|
"Use --copilot to create a GitHub Copilot bridge provider backed by the official SDK.",
|
|
237
242
|
"Copilot providers require SDK install and login readiness to already be satisfied via codexs login copilot.",
|
|
238
243
|
"For Copilot providers, provider apiKey stores only the local bridge secret; upstream GitHub Copilot auth stays shared in the official runtime login.",
|
|
239
244
|
"--install-copilot-sdk is kept only as a rejected compatibility flag that points to codexs login copilot.",
|
|
240
245
|
],
|
|
241
246
|
examples: [
|
|
242
|
-
"codexs add packycode --profile packycode --api-key sk-xxx",
|
|
243
|
-
"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",
|
|
244
249
|
"codexs add",
|
|
245
250
|
],
|
|
246
251
|
},
|
|
@@ -268,12 +273,12 @@ exports.COMMANDS = [
|
|
|
268
273
|
handler: handlers_1.handleRegisteredCommand,
|
|
269
274
|
group: "write",
|
|
270
275
|
summary: "Remove a provider from providers.json.",
|
|
271
|
-
usage: ["codexs remove <provider> [--force] [--switch-to <
|
|
276
|
+
usage: ["codexs remove <provider> [--force] [--switch-to <provider>] [--json] [--codex-dir <path>]"],
|
|
272
277
|
details: [
|
|
273
278
|
"TTY mode can select a missing provider interactively and always asks for deletion confirmation.",
|
|
274
279
|
"Non-TTY and --json automation still require both <provider> and --force.",
|
|
275
280
|
"The confirmation prompt includes the provider name and cancels without writing when declined.",
|
|
276
|
-
"When removing the
|
|
281
|
+
"When removing the only provider linked to the active model_provider route, pass --switch-to <provider-name> first.",
|
|
277
282
|
"Backs up providers.json and config.toml before removing the record.",
|
|
278
283
|
],
|
|
279
284
|
examples: ["codexs remove freemodel", "codexs remove freemodel --force --json"],
|
|
@@ -324,10 +329,10 @@ exports.COMMANDS = [
|
|
|
324
329
|
tokens: ["doctor"],
|
|
325
330
|
handler: handlers_1.handleRegisteredCommand,
|
|
326
331
|
group: "recovery",
|
|
327
|
-
summary: "Run
|
|
332
|
+
summary: "Run issue-first diagnostics across tool-home and target-runtime state.",
|
|
328
333
|
usage: ["codexs doctor [--json] [--codex-dir <path>]"],
|
|
329
334
|
details: [
|
|
330
|
-
"Checks the expected config files, provider/
|
|
335
|
+
"Checks the expected config files, provider/model-provider consistency, and Codex CLI availability.",
|
|
331
336
|
"Copilot bridge providers add runtime dependency, auth, and bridge health diagnostics.",
|
|
332
337
|
"Returns structured issues so users and AI agents can act on them.",
|
|
333
338
|
],
|