zcf 3.3.3 → 3.4.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.md +19 -867
- package/dist/chunks/claude-code-config-manager.mjs +8 -7
- package/dist/chunks/claude-code-incremental-manager.mjs +19 -33
- package/dist/chunks/codex-config-switch.mjs +16 -23
- package/dist/chunks/codex-provider-manager.mjs +21 -24
- package/dist/chunks/codex-uninstaller.mjs +12 -6
- package/dist/chunks/commands.mjs +2 -1
- package/dist/chunks/features.mjs +21 -30
- package/dist/chunks/simple-config.mjs +679 -170
- package/dist/cli.mjs +46 -34
- package/dist/i18n/locales/en/codex.json +17 -3
- package/dist/i18n/locales/en/common.json +3 -1
- package/dist/i18n/locales/en/configuration.json +2 -0
- package/dist/i18n/locales/en/installation.json +15 -1
- package/dist/i18n/locales/en/uninstall.json +2 -2
- package/dist/i18n/locales/zh-CN/codex.json +17 -3
- package/dist/i18n/locales/zh-CN/common.json +3 -1
- package/dist/i18n/locales/zh-CN/configuration.json +2 -0
- package/dist/i18n/locales/zh-CN/installation.json +15 -1
- package/dist/i18n/locales/zh-CN/uninstall.json +2 -2
- package/dist/index.d.mts +54 -8
- package/dist/index.d.ts +54 -8
- package/dist/index.mjs +2 -1
- package/package.json +2 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
2
|
import { join } from 'pathe';
|
|
3
|
-
import { q as ZCF_CONFIG_FILE, Z as ZCF_CONFIG_DIR,
|
|
3
|
+
import { q as ZCF_CONFIG_FILE, Z as ZCF_CONFIG_DIR, am as ensureDir, an as readDefaultTomlConfig, ao as createDefaultTomlConfig, ap as exists, aq as readJsonConfig, ar as writeTomlConfig, S as SETTINGS_FILE, as as copyFile } from './simple-config.mjs';
|
|
4
4
|
import 'node:fs';
|
|
5
5
|
import 'node:process';
|
|
6
6
|
import 'ansis';
|
|
@@ -9,6 +9,7 @@ import 'node:child_process';
|
|
|
9
9
|
import 'node:os';
|
|
10
10
|
import 'node:util';
|
|
11
11
|
import 'node:url';
|
|
12
|
+
import 'inquirer-toggle';
|
|
12
13
|
import 'ora';
|
|
13
14
|
import 'semver';
|
|
14
15
|
import 'smol-toml';
|
|
@@ -182,15 +183,15 @@ class ClaudeCodeConfigManager {
|
|
|
182
183
|
* Apply profile settings to Claude Code runtime
|
|
183
184
|
*/
|
|
184
185
|
static async applyProfileSettings(profile) {
|
|
185
|
-
const { ensureI18nInitialized, i18n } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
186
|
+
const { ensureI18nInitialized, i18n } = await import('./simple-config.mjs').then(function (n) { return n.bc; });
|
|
186
187
|
ensureI18nInitialized();
|
|
187
188
|
try {
|
|
188
189
|
if (!profile) {
|
|
189
|
-
const { switchToOfficialLogin } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
190
|
+
const { switchToOfficialLogin } = await import('./simple-config.mjs').then(function (n) { return n.bg; });
|
|
190
191
|
switchToOfficialLogin();
|
|
191
192
|
return;
|
|
192
193
|
}
|
|
193
|
-
const { readJsonConfig: readJsonConfig2, writeJsonConfig } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
194
|
+
const { readJsonConfig: readJsonConfig2, writeJsonConfig } = await import('./simple-config.mjs').then(function (n) { return n.be; });
|
|
194
195
|
const settings = readJsonConfig2(SETTINGS_FILE) || {};
|
|
195
196
|
if (!settings.env)
|
|
196
197
|
settings.env = {};
|
|
@@ -202,7 +203,7 @@ class ClaudeCodeConfigManager {
|
|
|
202
203
|
settings.env.ANTHROPIC_AUTH_TOKEN = profile.apiKey;
|
|
203
204
|
delete settings.env.ANTHROPIC_API_KEY;
|
|
204
205
|
} else if (profile.authType === "ccr_proxy") {
|
|
205
|
-
const { readCcrConfig } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
206
|
+
const { readCcrConfig } = await import('./simple-config.mjs').then(function (n) { return n.bh; });
|
|
206
207
|
const ccrConfig = readCcrConfig();
|
|
207
208
|
if (!ccrConfig) {
|
|
208
209
|
throw new Error(i18n.t("ccr:ccrNotConfigured") || "CCR proxy configuration not found");
|
|
@@ -232,7 +233,7 @@ class ClaudeCodeConfigManager {
|
|
|
232
233
|
delete settings.env.ANTHROPIC_SMALL_FAST_MODEL;
|
|
233
234
|
}
|
|
234
235
|
writeJsonConfig(SETTINGS_FILE, settings);
|
|
235
|
-
const { setPrimaryApiKey, addCompletedOnboarding } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
236
|
+
const { setPrimaryApiKey, addCompletedOnboarding } = await import('./simple-config.mjs').then(function (n) { return n.bf; });
|
|
236
237
|
setPrimaryApiKey();
|
|
237
238
|
addCompletedOnboarding();
|
|
238
239
|
if (shouldRestartCcr) {
|
|
@@ -589,7 +590,7 @@ class ClaudeCodeConfigManager {
|
|
|
589
590
|
*/
|
|
590
591
|
static async syncCcrProfile() {
|
|
591
592
|
try {
|
|
592
|
-
const { readCcrConfig } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
593
|
+
const { readCcrConfig } = await import('./simple-config.mjs').then(function (n) { return n.bh; });
|
|
593
594
|
const ccrConfig = readCcrConfig();
|
|
594
595
|
if (!ccrConfig) {
|
|
595
596
|
await this.ensureCcrProfileExists(ccrConfig);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ansis from 'ansis';
|
|
2
2
|
import inquirer from 'inquirer';
|
|
3
|
-
import {
|
|
3
|
+
import { ah as ensureI18nInitialized, ai as i18n, aj as addNumbersToChoices, ak as validateApiKey, al as promptBoolean } from './simple-config.mjs';
|
|
4
4
|
import { ClaudeCodeConfigManager } from './claude-code-config-manager.mjs';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
import 'node:process';
|
|
@@ -10,6 +10,7 @@ import 'node:util';
|
|
|
10
10
|
import 'dayjs';
|
|
11
11
|
import 'pathe';
|
|
12
12
|
import 'node:url';
|
|
13
|
+
import 'inquirer-toggle';
|
|
13
14
|
import 'ora';
|
|
14
15
|
import 'semver';
|
|
15
16
|
import 'smol-toml';
|
|
@@ -78,13 +79,10 @@ async function configureIncrementalManagement() {
|
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
async function promptContinueAdding() {
|
|
81
|
-
|
|
82
|
-
type: "confirm",
|
|
83
|
-
name: "continueAdding",
|
|
82
|
+
return await promptBoolean({
|
|
84
83
|
message: i18n.t("multi-config:addAnotherProfilePrompt"),
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
return continueAdding;
|
|
84
|
+
defaultValue: false
|
|
85
|
+
});
|
|
88
86
|
}
|
|
89
87
|
async function handleAddProfile() {
|
|
90
88
|
console.log(ansis.cyan(`
|
|
@@ -184,14 +182,10 @@ ${i18n.t("multi-config:addingNewProfile")}`));
|
|
|
184
182
|
const { promptCustomModels } = await import('./features.mjs');
|
|
185
183
|
modelConfig = await promptCustomModels();
|
|
186
184
|
}
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
message: i18n.t("multi-config:setAsDefaultPrompt"),
|
|
192
|
-
default: true
|
|
193
|
-
}
|
|
194
|
-
]);
|
|
185
|
+
const setAsDefault = await promptBoolean({
|
|
186
|
+
message: i18n.t("multi-config:setAsDefaultPrompt"),
|
|
187
|
+
defaultValue: true
|
|
188
|
+
});
|
|
195
189
|
const profileName = answers.profileName.trim();
|
|
196
190
|
const profileId = ClaudeCodeConfigManager.generateProfileId(profileName);
|
|
197
191
|
const profile = {
|
|
@@ -220,15 +214,13 @@ ${i18n.t("multi-config:addingNewProfile")}`));
|
|
|
220
214
|
}
|
|
221
215
|
const existingProfile = ClaudeCodeConfigManager.getProfileByName(profile.name);
|
|
222
216
|
if (existingProfile) {
|
|
223
|
-
const
|
|
224
|
-
type: "confirm",
|
|
225
|
-
name: "overwrite",
|
|
217
|
+
const overwrite = await promptBoolean({
|
|
226
218
|
message: i18n.t("multi-config:profileDuplicatePrompt", {
|
|
227
219
|
name: profile.name,
|
|
228
220
|
source: i18n.t("multi-config:existingConfig")
|
|
229
221
|
}),
|
|
230
|
-
|
|
231
|
-
}
|
|
222
|
+
defaultValue: false
|
|
223
|
+
});
|
|
232
224
|
if (!overwrite) {
|
|
233
225
|
console.log(ansis.yellow(i18n.t("multi-config:profileDuplicateSkipped", { name: profile.name })));
|
|
234
226
|
const shouldContinue2 = await promptContinueAdding();
|
|
@@ -491,14 +483,10 @@ ${i18n.t("multi-config:copyingProfile", { name: selectedProfile.name })}`));
|
|
|
491
483
|
selectedProfile.fastModel
|
|
492
484
|
);
|
|
493
485
|
}
|
|
494
|
-
const
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
message: i18n.t("multi-config:setAsDefaultPrompt"),
|
|
499
|
-
default: false
|
|
500
|
-
}
|
|
501
|
-
]);
|
|
486
|
+
const setAsDefault = await promptBoolean({
|
|
487
|
+
message: i18n.t("multi-config:setAsDefaultPrompt"),
|
|
488
|
+
defaultValue: false
|
|
489
|
+
});
|
|
502
490
|
const profileName = answers.profileName.trim();
|
|
503
491
|
const profileId = ClaudeCodeConfigManager.generateProfileId(profileName);
|
|
504
492
|
const copiedProfile = {
|
|
@@ -567,12 +555,10 @@ async function handleDeleteProfile(profiles) {
|
|
|
567
555
|
const selectedNames = selectedProfileIds.map(
|
|
568
556
|
(id) => profiles.find((p) => p.id === id)?.name || id
|
|
569
557
|
);
|
|
570
|
-
const
|
|
571
|
-
type: "confirm",
|
|
572
|
-
name: "confirmed",
|
|
558
|
+
const confirmed = await promptBoolean({
|
|
573
559
|
message: i18n.t("multi-config:confirmDeleteProfiles", { providers: selectedNames.join(", ") }),
|
|
574
|
-
|
|
575
|
-
}
|
|
560
|
+
defaultValue: false
|
|
561
|
+
});
|
|
576
562
|
if (!confirmed) {
|
|
577
563
|
console.log(ansis.yellow(i18n.t("common:cancelled")));
|
|
578
564
|
return;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ansis from 'ansis';
|
|
2
2
|
import inquirer from 'inquirer';
|
|
3
|
-
import {
|
|
3
|
+
import { ah as ensureI18nInitialized, at as detectConfigManagementMode, ai as i18n, aj as addNumbersToChoices, al as promptBoolean, aq as readJsonConfig, l as CODEX_AUTH_FILE } from './simple-config.mjs';
|
|
4
4
|
import { deleteProviders, addProviderToExisting, editExistingProvider } from './codex-provider-manager.mjs';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
import 'node:process';
|
|
@@ -10,6 +10,7 @@ import 'node:util';
|
|
|
10
10
|
import 'dayjs';
|
|
11
11
|
import 'pathe';
|
|
12
12
|
import 'node:url';
|
|
13
|
+
import 'inquirer-toggle';
|
|
13
14
|
import 'ora';
|
|
14
15
|
import 'semver';
|
|
15
16
|
import 'smol-toml';
|
|
@@ -132,15 +133,13 @@ async function handleAddProvider() {
|
|
|
132
133
|
const managementMode = detectConfigManagementMode();
|
|
133
134
|
const existingProvider = managementMode.providers?.find((p) => p.id === providerId);
|
|
134
135
|
if (existingProvider) {
|
|
135
|
-
const
|
|
136
|
-
type: "confirm",
|
|
137
|
-
name: "shouldOverwrite",
|
|
136
|
+
const shouldOverwrite = await promptBoolean({
|
|
138
137
|
message: i18n.t("codex:providerDuplicatePrompt", {
|
|
139
138
|
name: existingProvider.name,
|
|
140
139
|
source: i18n.t("codex:existingConfig")
|
|
141
140
|
}),
|
|
142
|
-
|
|
143
|
-
}
|
|
141
|
+
defaultValue: false
|
|
142
|
+
});
|
|
144
143
|
if (!shouldOverwrite) {
|
|
145
144
|
console.log(ansis.yellow(i18n.t("codex:providerDuplicateSkipped")));
|
|
146
145
|
return;
|
|
@@ -162,14 +161,12 @@ async function handleAddProvider() {
|
|
|
162
161
|
if (result.backupPath) {
|
|
163
162
|
console.log(ansis.gray(i18n.t("common:backupCreated", { path: result.backupPath })));
|
|
164
163
|
}
|
|
165
|
-
const
|
|
166
|
-
type: "confirm",
|
|
167
|
-
name: "setAsDefault",
|
|
164
|
+
const setAsDefault = await promptBoolean({
|
|
168
165
|
message: i18n.t("multi-config:setAsDefaultPrompt"),
|
|
169
|
-
|
|
170
|
-
}
|
|
166
|
+
defaultValue: true
|
|
167
|
+
});
|
|
171
168
|
if (setAsDefault) {
|
|
172
|
-
const { switchToProvider } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
169
|
+
const { switchToProvider } = await import('./simple-config.mjs').then(function (n) { return n.bj; });
|
|
173
170
|
const switched = await switchToProvider(provider.id);
|
|
174
171
|
if (switched) {
|
|
175
172
|
console.log(ansis.green(i18n.t("multi-config:profileSetAsDefault", { name: provider.name })));
|
|
@@ -359,14 +356,12 @@ ${i18n.t("codex:copyingProvider", { name: provider.name })}`));
|
|
|
359
356
|
if (result.backupPath) {
|
|
360
357
|
console.log(ansis.gray(i18n.t("common:backupCreated", { path: result.backupPath })));
|
|
361
358
|
}
|
|
362
|
-
const
|
|
363
|
-
type: "confirm",
|
|
364
|
-
name: "setAsDefault",
|
|
359
|
+
const setAsDefault = await promptBoolean({
|
|
365
360
|
message: i18n.t("multi-config:setAsDefaultPrompt"),
|
|
366
|
-
|
|
367
|
-
}
|
|
361
|
+
defaultValue: false
|
|
362
|
+
});
|
|
368
363
|
if (setAsDefault) {
|
|
369
|
-
const { switchToProvider } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
364
|
+
const { switchToProvider } = await import('./simple-config.mjs').then(function (n) { return n.bj; });
|
|
370
365
|
const switched = await switchToProvider(copiedProvider.id);
|
|
371
366
|
if (switched) {
|
|
372
367
|
console.log(ansis.green(i18n.t("multi-config:profileSetAsDefault", { name: copiedProvider.name })));
|
|
@@ -404,12 +399,10 @@ async function handleDeleteProvider(providers) {
|
|
|
404
399
|
const selectedNames = selectedProviderIds.map(
|
|
405
400
|
(id) => providers.find((p) => p.id === id)?.name || id
|
|
406
401
|
).join(", ");
|
|
407
|
-
const
|
|
408
|
-
type: "confirm",
|
|
409
|
-
name: "confirmDelete",
|
|
402
|
+
const confirmDelete = await promptBoolean({
|
|
410
403
|
message: i18n.t("codex:confirmDeleteProviders", { providers: selectedNames }),
|
|
411
|
-
|
|
412
|
-
}
|
|
404
|
+
defaultValue: false
|
|
405
|
+
});
|
|
413
406
|
if (!confirmDelete) {
|
|
414
407
|
console.log(ansis.yellow(i18n.t("common:cancelled")));
|
|
415
408
|
return;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ah as ensureI18nInitialized, au as readCodexConfig, ai as i18n, av as backupCodexComplete, aw as writeCodexConfig, ax as writeAuthFile } from './simple-config.mjs';
|
|
2
2
|
import 'node:fs';
|
|
3
3
|
import 'node:process';
|
|
4
4
|
import 'ansis';
|
|
@@ -9,6 +9,7 @@ import 'node:util';
|
|
|
9
9
|
import 'dayjs';
|
|
10
10
|
import 'pathe';
|
|
11
11
|
import 'node:url';
|
|
12
|
+
import 'inquirer-toggle';
|
|
12
13
|
import 'ora';
|
|
13
14
|
import 'semver';
|
|
14
15
|
import 'smol-toml';
|
|
@@ -17,36 +18,28 @@ import 'node:fs/promises';
|
|
|
17
18
|
import 'i18next';
|
|
18
19
|
import 'i18next-fs-backend';
|
|
19
20
|
|
|
20
|
-
const ERROR_MESSAGES = {
|
|
21
|
-
NO_CONFIG: "No existing configuration found",
|
|
22
|
-
BACKUP_FAILED: "Failed to create backup",
|
|
23
|
-
PROVIDER_EXISTS: (id) => `Provider with ID "${id}" already exists`,
|
|
24
|
-
PROVIDER_NOT_FOUND: (id) => `Provider with ID "${id}" not found`,
|
|
25
|
-
NO_PROVIDERS_SPECIFIED: "No providers specified for deletion",
|
|
26
|
-
PROVIDERS_NOT_FOUND: (providers) => `Some providers not found: ${providers.join(", ")}`,
|
|
27
|
-
CANNOT_DELETE_ALL: "Cannot delete all providers. At least one provider must remain."
|
|
28
|
-
};
|
|
29
21
|
async function addProviderToExisting(provider, apiKey, allowOverwrite = false) {
|
|
22
|
+
ensureI18nInitialized();
|
|
30
23
|
try {
|
|
31
24
|
const existingConfig = readCodexConfig();
|
|
32
25
|
if (!existingConfig) {
|
|
33
26
|
return {
|
|
34
27
|
success: false,
|
|
35
|
-
error:
|
|
28
|
+
error: i18n.t("codex:providerManager.noConfig")
|
|
36
29
|
};
|
|
37
30
|
}
|
|
38
31
|
const existingProviderIndex = existingConfig.providers.findIndex((p) => p.id === provider.id);
|
|
39
32
|
if (existingProviderIndex !== -1 && !allowOverwrite) {
|
|
40
33
|
return {
|
|
41
34
|
success: false,
|
|
42
|
-
error:
|
|
35
|
+
error: i18n.t("codex:providerManager.providerExists", { id: provider.id })
|
|
43
36
|
};
|
|
44
37
|
}
|
|
45
38
|
const backupPath = backupCodexComplete();
|
|
46
39
|
if (!backupPath) {
|
|
47
40
|
return {
|
|
48
41
|
success: false,
|
|
49
|
-
error:
|
|
42
|
+
error: i18n.t("codex:providerManager.backupFailed")
|
|
50
43
|
};
|
|
51
44
|
}
|
|
52
45
|
let updatedConfig;
|
|
@@ -75,31 +68,32 @@ async function addProviderToExisting(provider, apiKey, allowOverwrite = false) {
|
|
|
75
68
|
} catch (error) {
|
|
76
69
|
return {
|
|
77
70
|
success: false,
|
|
78
|
-
error: error instanceof Error ? error.message : "
|
|
71
|
+
error: error instanceof Error ? error.message : i18n.t("codex:providerManager.unknownError")
|
|
79
72
|
};
|
|
80
73
|
}
|
|
81
74
|
}
|
|
82
75
|
async function editExistingProvider(providerId, updates) {
|
|
76
|
+
ensureI18nInitialized();
|
|
83
77
|
try {
|
|
84
78
|
const existingConfig = readCodexConfig();
|
|
85
79
|
if (!existingConfig) {
|
|
86
80
|
return {
|
|
87
81
|
success: false,
|
|
88
|
-
error:
|
|
82
|
+
error: i18n.t("codex:providerManager.noConfig")
|
|
89
83
|
};
|
|
90
84
|
}
|
|
91
85
|
const providerIndex = existingConfig.providers.findIndex((p) => p.id === providerId);
|
|
92
86
|
if (providerIndex === -1) {
|
|
93
87
|
return {
|
|
94
88
|
success: false,
|
|
95
|
-
error:
|
|
89
|
+
error: i18n.t("codex:providerManager.providerNotFound", { id: providerId })
|
|
96
90
|
};
|
|
97
91
|
}
|
|
98
92
|
const backupPath = backupCodexComplete();
|
|
99
93
|
if (!backupPath) {
|
|
100
94
|
return {
|
|
101
95
|
success: false,
|
|
102
|
-
error:
|
|
96
|
+
error: i18n.t("codex:providerManager.backupFailed")
|
|
103
97
|
};
|
|
104
98
|
}
|
|
105
99
|
const updatedProvider = {
|
|
@@ -129,23 +123,24 @@ async function editExistingProvider(providerId, updates) {
|
|
|
129
123
|
} catch (error) {
|
|
130
124
|
return {
|
|
131
125
|
success: false,
|
|
132
|
-
error: error instanceof Error ? error.message : "
|
|
126
|
+
error: error instanceof Error ? error.message : i18n.t("codex:providerManager.unknownError")
|
|
133
127
|
};
|
|
134
128
|
}
|
|
135
129
|
}
|
|
136
130
|
async function deleteProviders(providerIds) {
|
|
131
|
+
ensureI18nInitialized();
|
|
137
132
|
try {
|
|
138
133
|
const existingConfig = readCodexConfig();
|
|
139
134
|
if (!existingConfig) {
|
|
140
135
|
return {
|
|
141
136
|
success: false,
|
|
142
|
-
error:
|
|
137
|
+
error: i18n.t("codex:providerManager.noConfig")
|
|
143
138
|
};
|
|
144
139
|
}
|
|
145
140
|
if (!providerIds || providerIds.length === 0) {
|
|
146
141
|
return {
|
|
147
142
|
success: false,
|
|
148
|
-
error:
|
|
143
|
+
error: i18n.t("codex:providerManager.noProvidersSpecified")
|
|
149
144
|
};
|
|
150
145
|
}
|
|
151
146
|
const notFoundProviders = providerIds.filter(
|
|
@@ -154,7 +149,9 @@ async function deleteProviders(providerIds) {
|
|
|
154
149
|
if (notFoundProviders.length > 0) {
|
|
155
150
|
return {
|
|
156
151
|
success: false,
|
|
157
|
-
error:
|
|
152
|
+
error: i18n.t("codex:providerManager.providersNotFound", {
|
|
153
|
+
providers: notFoundProviders.join(", ")
|
|
154
|
+
})
|
|
158
155
|
};
|
|
159
156
|
}
|
|
160
157
|
const remainingProviders = existingConfig.providers.filter(
|
|
@@ -163,14 +160,14 @@ async function deleteProviders(providerIds) {
|
|
|
163
160
|
if (remainingProviders.length === 0) {
|
|
164
161
|
return {
|
|
165
162
|
success: false,
|
|
166
|
-
error:
|
|
163
|
+
error: i18n.t("codex:providerManager.cannotDeleteAll")
|
|
167
164
|
};
|
|
168
165
|
}
|
|
169
166
|
const backupPath = backupCodexComplete();
|
|
170
167
|
if (!backupPath) {
|
|
171
168
|
return {
|
|
172
169
|
success: false,
|
|
173
|
-
error:
|
|
170
|
+
error: i18n.t("codex:providerManager.backupFailed")
|
|
174
171
|
};
|
|
175
172
|
}
|
|
176
173
|
let newDefaultProvider = existingConfig.modelProvider;
|
|
@@ -196,7 +193,7 @@ async function deleteProviders(providerIds) {
|
|
|
196
193
|
} catch (error) {
|
|
197
194
|
return {
|
|
198
195
|
success: false,
|
|
199
|
-
error: error instanceof Error ? error.message : "
|
|
196
|
+
error: error instanceof Error ? error.message : i18n.t("codex:providerManager.unknownError")
|
|
200
197
|
};
|
|
201
198
|
}
|
|
202
199
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { pathExists } from 'fs-extra';
|
|
2
2
|
import { join } from 'pathe';
|
|
3
|
-
import {
|
|
4
|
-
import { j as CODEX_DIR, k as CODEX_CONFIG_FILE, ab as i18n, l as CODEX_AUTH_FILE, n as CODEX_AGENTS_FILE, p as CODEX_PROMPTS_DIR } from './simple-config.mjs';
|
|
3
|
+
import { j as CODEX_DIR, k as CODEX_CONFIG_FILE, ai as i18n, l as CODEX_AUTH_FILE, n as CODEX_AGENTS_FILE, p as CODEX_PROMPTS_DIR } from './simple-config.mjs';
|
|
5
4
|
import { m as moveToTrash } from '../shared/zcf.DGjQxTq_.mjs';
|
|
6
5
|
import 'node:fs';
|
|
7
6
|
import 'node:process';
|
|
@@ -12,9 +11,11 @@ import 'node:os';
|
|
|
12
11
|
import 'node:util';
|
|
13
12
|
import 'dayjs';
|
|
14
13
|
import 'node:url';
|
|
14
|
+
import 'inquirer-toggle';
|
|
15
15
|
import 'ora';
|
|
16
16
|
import 'semver';
|
|
17
17
|
import 'smol-toml';
|
|
18
|
+
import 'tinyexec';
|
|
18
19
|
import 'node:fs/promises';
|
|
19
20
|
import 'i18next';
|
|
20
21
|
import 'i18next-fs-backend';
|
|
@@ -154,15 +155,20 @@ class CodexUninstaller {
|
|
|
154
155
|
warnings: []
|
|
155
156
|
};
|
|
156
157
|
try {
|
|
157
|
-
await
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
const { uninstallCodeTool } = await import('./simple-config.mjs').then(function (n) { return n.bk; });
|
|
159
|
+
const success = await uninstallCodeTool("codex");
|
|
160
|
+
if (success) {
|
|
161
|
+
result.removed.push("@openai/codex");
|
|
162
|
+
result.success = true;
|
|
163
|
+
} else {
|
|
164
|
+
result.errors.push(i18n.t("uninstall:uninstallFailed", { codeType: i18n.t("common:codex"), message: "" }));
|
|
165
|
+
}
|
|
160
166
|
} catch (error) {
|
|
161
167
|
if (error.message.includes("not found") || error.message.includes("not installed")) {
|
|
162
168
|
result.warnings.push(i18n.t("codex:packageNotFound"));
|
|
163
169
|
result.success = true;
|
|
164
170
|
} else {
|
|
165
|
-
result.errors.push(
|
|
171
|
+
result.errors.push(i18n.t("uninstall:uninstallFailed", { codeType: i18n.t("common:codex"), message: `: ${error.message}` }));
|
|
166
172
|
}
|
|
167
173
|
}
|
|
168
174
|
return result;
|
package/dist/chunks/commands.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { exec } from 'node:child_process';
|
|
2
2
|
import { promisify } from 'node:util';
|
|
3
3
|
import ansis from 'ansis';
|
|
4
|
-
import {
|
|
4
|
+
import { ah as ensureI18nInitialized, ai as i18n } from './simple-config.mjs';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
import 'node:process';
|
|
7
7
|
import 'inquirer';
|
|
@@ -9,6 +9,7 @@ import 'node:os';
|
|
|
9
9
|
import 'dayjs';
|
|
10
10
|
import 'pathe';
|
|
11
11
|
import 'node:url';
|
|
12
|
+
import 'inquirer-toggle';
|
|
12
13
|
import 'ora';
|
|
13
14
|
import 'semver';
|
|
14
15
|
import 'smol-toml';
|
package/dist/chunks/features.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ansis from 'ansis';
|
|
2
2
|
import inquirer from 'inquirer';
|
|
3
|
-
import {
|
|
3
|
+
import { ai as i18n, ah as ensureI18nInitialized, x as SUPPORTED_LANGS, aj as addNumbersToChoices, y as LANG_LABELS, ay as updateZcfConfig, az as changeLanguage, aA as readZcfConfig, al as promptBoolean, o as openSettingsJson, d as importRecommendedPermissions, b as importRecommendedEnv, a1 as applyAiLanguageDirective, aB as configureOutputStyle, $ as getExistingModelConfig, X as updateCustomModel, Y as updateDefaultModel, aC as isWindows, F as readMcpConfig, K as fixWindowsMcpConfig, G as writeMcpConfig, aD as selectMcpServices, H as backupMcpConfig, aE as getMcpServices, J as buildMcpServerConfig, I as mergeMcpServers, aF as isCcrInstalled, aG as installCcr, aH as setupCcrConfiguration, a0 as getExistingApiConfig, a3 as promptApiConfigurationAction, aI as modifyApiConfigPartially, ak as validateApiKey, V as configureApi, aJ as formatApiKeyDisplay, a2 as switchToOfficialLogin } from './simple-config.mjs';
|
|
4
4
|
import 'node:fs';
|
|
5
5
|
import 'node:process';
|
|
6
6
|
import 'node:child_process';
|
|
@@ -9,6 +9,7 @@ import 'node:util';
|
|
|
9
9
|
import 'dayjs';
|
|
10
10
|
import 'pathe';
|
|
11
11
|
import 'node:url';
|
|
12
|
+
import 'inquirer-toggle';
|
|
12
13
|
import 'ora';
|
|
13
14
|
import 'semver';
|
|
14
15
|
import 'smol-toml';
|
|
@@ -177,11 +178,9 @@ async function configureApiFeature() {
|
|
|
177
178
|
async function configureMcpFeature() {
|
|
178
179
|
ensureI18nInitialized();
|
|
179
180
|
if (isWindows()) {
|
|
180
|
-
const
|
|
181
|
-
type: "confirm",
|
|
182
|
-
name: "fixWindows",
|
|
181
|
+
const fixWindows = await promptBoolean({
|
|
183
182
|
message: i18n.t("configuration:fixWindowsMcp") || "Fix Windows MCP configuration?",
|
|
184
|
-
|
|
183
|
+
defaultValue: true
|
|
185
184
|
});
|
|
186
185
|
if (fixWindows) {
|
|
187
186
|
const existingConfig = readMcpConfig() || { mcpServers: {} };
|
|
@@ -236,11 +235,9 @@ ${ansis.blue(`\u2139 ${i18n.t("configuration:existingModelConfig") || "Existing
|
|
|
236
235
|
const modelDisplay = existingModel === "default" ? i18n.t("configuration:defaultModelOption") || "Default (Let Claude Code choose)" : existingModel.charAt(0).toUpperCase() + existingModel.slice(1);
|
|
237
236
|
console.log(ansis.gray(` ${i18n.t("configuration:currentModel") || "Current model"}: ${modelDisplay}
|
|
238
237
|
`));
|
|
239
|
-
const
|
|
240
|
-
type: "confirm",
|
|
241
|
-
name: "modify",
|
|
238
|
+
const modify = await promptBoolean({
|
|
242
239
|
message: i18n.t("configuration:modifyModel") || "Modify model configuration?",
|
|
243
|
-
|
|
240
|
+
defaultValue: false
|
|
244
241
|
});
|
|
245
242
|
if (!modify) {
|
|
246
243
|
console.log(ansis.green(`\u2714 ${i18n.t("configuration:keepModel") || "Keeping existing model configuration"}`));
|
|
@@ -333,18 +330,16 @@ ${ansis.blue(`\u2139 ${i18n.t("configuration:existingLanguageConfig") || "Existi
|
|
|
333
330
|
);
|
|
334
331
|
console.log(ansis.gray(` ${i18n.t("configuration:currentLanguage") || "Current language"}: ${existingLang}
|
|
335
332
|
`));
|
|
336
|
-
const
|
|
337
|
-
type: "confirm",
|
|
338
|
-
name: "modify",
|
|
333
|
+
const modify = await promptBoolean({
|
|
339
334
|
message: i18n.t("configuration:modifyLanguage") || "Modify AI output language?",
|
|
340
|
-
|
|
335
|
+
defaultValue: false
|
|
341
336
|
});
|
|
342
337
|
if (!modify) {
|
|
343
338
|
console.log(ansis.green(`\u2714 ${i18n.t("configuration:keepLanguage") || "Keeping existing language configuration"}`));
|
|
344
339
|
return;
|
|
345
340
|
}
|
|
346
341
|
}
|
|
347
|
-
const { selectAiOutputLanguage } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
342
|
+
const { selectAiOutputLanguage } = await import('./simple-config.mjs').then(function (n) { return n.bi; });
|
|
348
343
|
const aiOutputLang = await selectAiOutputLanguage();
|
|
349
344
|
applyAiLanguageDirective(aiOutputLang);
|
|
350
345
|
updateZcfConfig({ aiOutputLang });
|
|
@@ -377,7 +372,7 @@ async function changeScriptLanguageFeature(currentLang) {
|
|
|
377
372
|
}
|
|
378
373
|
async function configureCodexDefaultModelFeature() {
|
|
379
374
|
ensureI18nInitialized();
|
|
380
|
-
const { readCodexConfig } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
375
|
+
const { readCodexConfig } = await import('./simple-config.mjs').then(function (n) { return n.bj; });
|
|
381
376
|
const existingConfig = readCodexConfig();
|
|
382
377
|
const currentModel = existingConfig?.model;
|
|
383
378
|
if (currentModel) {
|
|
@@ -386,11 +381,9 @@ ${ansis.blue(`\u2139 ${i18n.t("configuration:existingModelConfig") || "Existing
|
|
|
386
381
|
const modelDisplay = currentModel === "gpt-5-codex" ? "GPT-5-Codex" : currentModel === "gpt-5" ? "GPT-5" : currentModel.charAt(0).toUpperCase() + currentModel.slice(1);
|
|
387
382
|
console.log(ansis.gray(` ${i18n.t("configuration:currentModel") || "Current model"}: ${modelDisplay}
|
|
388
383
|
`));
|
|
389
|
-
const
|
|
390
|
-
type: "confirm",
|
|
391
|
-
name: "modify",
|
|
384
|
+
const modify = await promptBoolean({
|
|
392
385
|
message: i18n.t("configuration:modifyModel") || "Modify model configuration?",
|
|
393
|
-
|
|
386
|
+
defaultValue: false
|
|
394
387
|
});
|
|
395
388
|
if (!modify) {
|
|
396
389
|
console.log(ansis.green(`\u2714 ${i18n.t("configuration:keepModel") || "Keeping existing model configuration"}`));
|
|
@@ -470,11 +463,9 @@ ${ansis.blue(`\u2139 ${i18n.t("configuration:existingLanguageConfig") || "Existi
|
|
|
470
463
|
);
|
|
471
464
|
console.log(ansis.gray(` ${i18n.t("configuration:currentLanguage") || "Current language"}: ${existingLang}
|
|
472
465
|
`));
|
|
473
|
-
const
|
|
474
|
-
type: "confirm",
|
|
475
|
-
name: "modify",
|
|
466
|
+
const modify = await promptBoolean({
|
|
476
467
|
message: i18n.t("configuration:modifyLanguage") || "Modify AI output language?",
|
|
477
|
-
|
|
468
|
+
defaultValue: false
|
|
478
469
|
});
|
|
479
470
|
if (!modify) {
|
|
480
471
|
console.log(ansis.green(`\u2714 ${i18n.t("configuration:keepLanguage") || "Keeping existing language configuration"}`));
|
|
@@ -482,7 +473,7 @@ ${ansis.blue(`\u2139 ${i18n.t("configuration:existingLanguageConfig") || "Existi
|
|
|
482
473
|
return;
|
|
483
474
|
}
|
|
484
475
|
}
|
|
485
|
-
const { selectAiOutputLanguage } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
476
|
+
const { selectAiOutputLanguage } = await import('./simple-config.mjs').then(function (n) { return n.bi; });
|
|
486
477
|
const aiOutputLang = await selectAiOutputLanguage();
|
|
487
478
|
await updateCodexLanguageDirective(aiOutputLang);
|
|
488
479
|
updateZcfConfig({ aiOutputLang });
|
|
@@ -490,14 +481,14 @@ ${ansis.blue(`\u2139 ${i18n.t("configuration:existingLanguageConfig") || "Existi
|
|
|
490
481
|
} else if (option === "systemPrompt") {
|
|
491
482
|
const zcfConfig = readZcfConfig();
|
|
492
483
|
const currentLang = zcfConfig?.aiOutputLang || "English";
|
|
493
|
-
const { runCodexSystemPromptSelection } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
484
|
+
const { runCodexSystemPromptSelection } = await import('./simple-config.mjs').then(function (n) { return n.bj; });
|
|
494
485
|
await runCodexSystemPromptSelection();
|
|
495
486
|
await ensureLanguageDirectiveInAgents(currentLang);
|
|
496
487
|
console.log(ansis.green(`\u2714 ${i18n.t("configuration:systemPromptConfigured")}`));
|
|
497
488
|
}
|
|
498
489
|
}
|
|
499
490
|
async function updateCodexModelProvider(modelProvider) {
|
|
500
|
-
const { readCodexConfig, writeCodexConfig, backupCodexConfig, getBackupMessage } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
491
|
+
const { readCodexConfig, writeCodexConfig, backupCodexConfig, getBackupMessage } = await import('./simple-config.mjs').then(function (n) { return n.bj; });
|
|
501
492
|
const backupPath = backupCodexConfig();
|
|
502
493
|
if (backupPath) {
|
|
503
494
|
console.log(ansis.gray(getBackupMessage(backupPath)));
|
|
@@ -518,7 +509,7 @@ async function updateCodexModelProvider(modelProvider) {
|
|
|
518
509
|
writeCodexConfig(updatedConfig);
|
|
519
510
|
}
|
|
520
511
|
async function ensureLanguageDirectiveInAgents(aiOutputLang) {
|
|
521
|
-
const { readFile, writeFile, exists } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
512
|
+
const { readFile, writeFile, exists } = await import('./simple-config.mjs').then(function (n) { return n.bd; });
|
|
522
513
|
const { homedir } = await import('node:os');
|
|
523
514
|
const { join } = await import('pathe');
|
|
524
515
|
const CODEX_AGENTS_FILE = join(homedir(), ".codex", "AGENTS.md");
|
|
@@ -536,7 +527,7 @@ async function ensureLanguageDirectiveInAgents(aiOutputLang) {
|
|
|
536
527
|
const langLabel = languageLabels[aiOutputLang] || aiOutputLang;
|
|
537
528
|
const hasLanguageDirective = /\*\*Most Important:\s*Always respond in [^*]+\*\*/i.test(content);
|
|
538
529
|
if (!hasLanguageDirective) {
|
|
539
|
-
const { backupCodexAgents, getBackupMessage } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
530
|
+
const { backupCodexAgents, getBackupMessage } = await import('./simple-config.mjs').then(function (n) { return n.bj; });
|
|
540
531
|
const backupPath = backupCodexAgents();
|
|
541
532
|
if (backupPath) {
|
|
542
533
|
console.log(ansis.gray(getBackupMessage(backupPath)));
|
|
@@ -553,8 +544,8 @@ async function ensureLanguageDirectiveInAgents(aiOutputLang) {
|
|
|
553
544
|
}
|
|
554
545
|
}
|
|
555
546
|
async function updateCodexLanguageDirective(aiOutputLang) {
|
|
556
|
-
const { readFile, writeFile, exists } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
557
|
-
const { backupCodexAgents, getBackupMessage } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
547
|
+
const { readFile, writeFile, exists } = await import('./simple-config.mjs').then(function (n) { return n.bd; });
|
|
548
|
+
const { backupCodexAgents, getBackupMessage } = await import('./simple-config.mjs').then(function (n) { return n.bj; });
|
|
558
549
|
const { homedir } = await import('node:os');
|
|
559
550
|
const { join } = await import('pathe');
|
|
560
551
|
const CODEX_AGENTS_FILE = join(homedir(), ".codex", "AGENTS.md");
|