ccjk 5.2.0 → 5.2.2
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/dist/chunks/api.mjs +6 -6
- package/dist/chunks/auto-updater.mjs +80 -133
- package/dist/chunks/ccm.mjs +7 -7
- package/dist/chunks/ccr.mjs +7 -4
- package/dist/chunks/ccu.mjs +6 -6
- package/dist/chunks/check-updates.mjs +3 -3
- package/dist/chunks/claude-code-incremental-manager.mjs +38 -38
- package/dist/chunks/cloud-v5.mjs +1651 -0
- package/dist/chunks/codex.mjs +70 -70
- package/dist/chunks/commands.mjs +25 -25
- package/dist/chunks/commit.mjs +16 -16
- package/dist/chunks/config-consolidator.mjs +9 -9
- package/dist/chunks/config-switch.mjs +39 -39
- package/dist/chunks/config.mjs +5 -5
- package/dist/chunks/config2.mjs +85 -85
- package/dist/chunks/context.mjs +2 -2
- package/dist/chunks/doctor.mjs +31 -31
- package/dist/chunks/features.mjs +84 -83
- package/dist/chunks/help.mjs +116 -116
- package/dist/chunks/index4.mjs +46 -46
- package/dist/chunks/init.mjs +214 -191
- package/dist/chunks/interview.mjs +102 -102
- package/dist/chunks/manager.mjs +238 -0
- package/dist/chunks/marketplace.mjs +59 -59
- package/dist/chunks/mcp.mjs +82 -82
- package/dist/chunks/menu.mjs +441 -379
- package/dist/chunks/notification.mjs +112 -112
- package/dist/chunks/onboarding.mjs +7 -7
- package/dist/chunks/package.mjs +1 -1
- package/dist/chunks/permission-manager.mjs +8 -8
- package/dist/chunks/plugin.mjs +100 -100
- package/dist/chunks/prompts.mjs +15 -15
- package/dist/chunks/providers.mjs +65 -65
- package/dist/chunks/session.mjs +83 -83
- package/dist/chunks/skills-sync.mjs +72 -72
- package/dist/chunks/skills.mjs +88 -88
- package/dist/chunks/team.mjs +6 -6
- package/dist/chunks/uninstall.mjs +35 -35
- package/dist/chunks/update.mjs +6 -6
- package/dist/chunks/upgrade-manager.mjs +4 -4
- package/dist/chunks/workflows2.mjs +13 -13
- package/dist/cli.mjs +21 -0
- package/dist/i18n/locales/en/menu.json +16 -1
- package/dist/i18n/locales/en/skills.json +29 -0
- package/dist/i18n/locales/zh-CN/menu.json +16 -1
- package/dist/i18n/locales/zh-CN/skills.json +29 -0
- package/dist/index.mjs +4 -4
- package/dist/shared/{ccjk.f40us0yY.mjs → ccjk.BiJujy5w.mjs} +4 -4
- package/dist/shared/{ccjk.CQzwtnZ1.mjs → ccjk.C_3BYaWc.mjs} +50 -50
- package/dist/shared/{ccjk.Zwx-YR_P.mjs → ccjk.DjD9Rzxq.mjs} +32 -32
- package/dist/shared/{ccjk.DtWIPt8E.mjs → ccjk.XgW1H2t3.mjs} +68 -68
- package/dist/shared/{ccjk.BlPCiSHj.mjs → ccjk.tI4PJA0c.mjs} +30 -30
- package/package.json +3 -3
package/dist/chunks/codex.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import process__default from 'node:process';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
|
-
import
|
|
3
|
+
import ansis__default from 'ansis';
|
|
4
4
|
import dayjs from 'dayjs';
|
|
5
5
|
import inquirer from 'inquirer';
|
|
6
6
|
import ora from 'ora';
|
|
@@ -244,7 +244,7 @@ async function selectMcpServices() {
|
|
|
244
244
|
ensureI18nInitialized();
|
|
245
245
|
const mcpServices = await getMcpServices();
|
|
246
246
|
const choices = mcpServices.map((service) => ({
|
|
247
|
-
name: `${service.name} - ${
|
|
247
|
+
name: `${service.name} - ${ansis__default.gray(service.description)}`,
|
|
248
248
|
value: service.id,
|
|
249
249
|
selected: false
|
|
250
250
|
}));
|
|
@@ -255,7 +255,7 @@ async function selectMcpServices() {
|
|
|
255
255
|
choices
|
|
256
256
|
});
|
|
257
257
|
if (services === void 0) {
|
|
258
|
-
console.log(
|
|
258
|
+
console.log(ansis__default.yellow(i18n.t("common:cancelled")));
|
|
259
259
|
return void 0;
|
|
260
260
|
}
|
|
261
261
|
return services;
|
|
@@ -277,13 +277,13 @@ async function configureCodexMcp(options) {
|
|
|
277
277
|
const existingConfig = readCodexConfig();
|
|
278
278
|
const backupPath = backupCodexComplete();
|
|
279
279
|
if (backupPath)
|
|
280
|
-
console.log(
|
|
280
|
+
console.log(ansis__default.gray(getBackupMessage(backupPath)));
|
|
281
281
|
if (skipPrompt) {
|
|
282
282
|
const { runCodexWorkflowSelection } = await Promise.resolve().then(function () { return codex; });
|
|
283
283
|
await runCodexWorkflowSelection({ skipPrompt: true, workflows: options?.workflows ?? [] });
|
|
284
284
|
if (options?.mcpServices === false) {
|
|
285
285
|
updateZcfConfig({ codeToolType: "codex" });
|
|
286
|
-
console.log(
|
|
286
|
+
console.log(ansis__default.green(i18n.t("codex:mcpConfigured")));
|
|
287
287
|
return;
|
|
288
288
|
}
|
|
289
289
|
const defaultServiceIds = Array.isArray(options?.mcpServices) ? options.mcpServices : MCP_SERVICE_CONFIGS.filter((service) => !service.requiresApiKey).map((service) => service.id);
|
|
@@ -349,7 +349,7 @@ async function configureCodexMcp(options) {
|
|
|
349
349
|
otherConfig: existingConfig?.otherConfig || []
|
|
350
350
|
});
|
|
351
351
|
updateZcfConfig({ codeToolType: "codex" });
|
|
352
|
-
console.log(
|
|
352
|
+
console.log(ansis__default.green(i18n.t("codex:mcpConfigured")));
|
|
353
353
|
return;
|
|
354
354
|
}
|
|
355
355
|
const selectedIds = await selectMcpServices();
|
|
@@ -360,7 +360,7 @@ async function configureCodexMcp(options) {
|
|
|
360
360
|
const selection = [];
|
|
361
361
|
const existingServices = existingConfig?.mcpServices || [];
|
|
362
362
|
if (selectedIds.length === 0) {
|
|
363
|
-
console.log(
|
|
363
|
+
console.log(ansis__default.yellow(i18n.t("codex:noMcpConfigured")));
|
|
364
364
|
const preserved = (existingServices || []).map((svc) => {
|
|
365
365
|
if (isWindows()) {
|
|
366
366
|
const systemRoot = getSystemRoot();
|
|
@@ -459,7 +459,7 @@ async function configureCodexMcp(options) {
|
|
|
459
459
|
otherConfig: existingConfig?.otherConfig || []
|
|
460
460
|
});
|
|
461
461
|
updateZcfConfig({ codeToolType: "codex" });
|
|
462
|
-
console.log(
|
|
462
|
+
console.log(ansis__default.green(i18n.t("codex:mcpConfigured")));
|
|
463
463
|
}
|
|
464
464
|
|
|
465
465
|
let cachedSkipPromptBackup = null;
|
|
@@ -493,35 +493,35 @@ async function detectCodexInstallMethod() {
|
|
|
493
493
|
}
|
|
494
494
|
async function executeCodexInstallation(isUpdate, skipMethodSelection = false) {
|
|
495
495
|
if (isUpdate) {
|
|
496
|
-
console.log(
|
|
496
|
+
console.log(ansis__default.green(i18n.t("codex:updatingCli")));
|
|
497
497
|
const installMethod = await detectCodexInstallMethod();
|
|
498
498
|
if (installMethod === "homebrew") {
|
|
499
|
-
console.log(
|
|
499
|
+
console.log(ansis__default.gray(i18n.t("codex:detectedHomebrew")));
|
|
500
500
|
const result = await x("brew", ["upgrade", "--cask", "codex"]);
|
|
501
501
|
if (result.exitCode !== 0) {
|
|
502
502
|
throw new Error(`Failed to update codex via Homebrew: exit code ${result.exitCode}`);
|
|
503
503
|
}
|
|
504
504
|
} else if (installMethod === "npm") {
|
|
505
|
-
console.log(
|
|
505
|
+
console.log(ansis__default.gray(i18n.t("codex:detectedNpm")));
|
|
506
506
|
const { command, args, usedSudo } = wrapCommandWithSudo("npm", ["install", "-g", "@openai/codex@latest"]);
|
|
507
507
|
if (usedSudo)
|
|
508
|
-
console.log(
|
|
508
|
+
console.log(ansis__default.yellow(i18n.t("codex:usingSudo")));
|
|
509
509
|
const result = await x(command, args);
|
|
510
510
|
if (result.exitCode !== 0) {
|
|
511
511
|
throw new Error(`Failed to update codex CLI: exit code ${result.exitCode}`);
|
|
512
512
|
}
|
|
513
513
|
} else {
|
|
514
|
-
console.log(
|
|
515
|
-
console.log(
|
|
514
|
+
console.log(ansis__default.yellow(i18n.t("codex:unknownInstallMethod")));
|
|
515
|
+
console.log(ansis__default.gray(i18n.t("codex:fallingBackToNpm")));
|
|
516
516
|
const { command, args, usedSudo } = wrapCommandWithSudo("npm", ["install", "-g", "@openai/codex@latest"]);
|
|
517
517
|
if (usedSudo)
|
|
518
|
-
console.log(
|
|
518
|
+
console.log(ansis__default.yellow(i18n.t("codex:usingSudo")));
|
|
519
519
|
const result = await x(command, args);
|
|
520
520
|
if (result.exitCode !== 0) {
|
|
521
521
|
throw new Error(`Failed to update codex CLI: exit code ${result.exitCode}`);
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
|
-
console.log(
|
|
524
|
+
console.log(ansis__default.green(i18n.t("codex:updateSuccess")));
|
|
525
525
|
} else {
|
|
526
526
|
const { installCodex } = await import('./init.mjs').then(function (n) { return n.G; });
|
|
527
527
|
await installCodex(skipMethodSelection);
|
|
@@ -540,7 +540,7 @@ function getUninstallOptions() {
|
|
|
540
540
|
];
|
|
541
541
|
}
|
|
542
542
|
function handleUninstallCancellation() {
|
|
543
|
-
console.log(
|
|
543
|
+
console.log(ansis__default.yellow(i18n.t("codex:uninstallCancelled")));
|
|
544
544
|
}
|
|
545
545
|
function createBackupDirectory(timestamp) {
|
|
546
546
|
const backupBaseDir = join(CODEX_DIR, "backup");
|
|
@@ -637,7 +637,7 @@ function migrateEnvKeyToTempEnvKey() {
|
|
|
637
637
|
return false;
|
|
638
638
|
const backupPath = backupCodexConfig();
|
|
639
639
|
if (backupPath) {
|
|
640
|
-
console.log(
|
|
640
|
+
console.log(ansis__default.gray(getBackupMessage(backupPath)));
|
|
641
641
|
}
|
|
642
642
|
const migratedContent = migrateEnvKeyInContent(content);
|
|
643
643
|
writeFileAtomic(CODEX_CONFIG_FILE, migratedContent);
|
|
@@ -647,10 +647,10 @@ function migrateEnvKeyToTempEnvKey() {
|
|
|
647
647
|
}
|
|
648
648
|
});
|
|
649
649
|
const message = i18n.isInitialized ? i18n.t("codex:envKeyMigrationComplete") : "\u2714 env_key to temp_env_key migration completed";
|
|
650
|
-
console.log(
|
|
650
|
+
console.log(ansis__default.green(message));
|
|
651
651
|
return true;
|
|
652
652
|
} catch (error) {
|
|
653
|
-
console.error(
|
|
653
|
+
console.error(ansis__default.yellow(`env_key migration warning: ${error.message}`));
|
|
654
654
|
return false;
|
|
655
655
|
}
|
|
656
656
|
}
|
|
@@ -1125,7 +1125,7 @@ async function installCodexCli(skipMethodSelection = false) {
|
|
|
1125
1125
|
await executeCodexInstallation(true, skipMethodSelection);
|
|
1126
1126
|
return;
|
|
1127
1127
|
} else {
|
|
1128
|
-
console.log(
|
|
1128
|
+
console.log(ansis__default.yellow(i18n.t("codex:alreadyInstalled")));
|
|
1129
1129
|
return;
|
|
1130
1130
|
}
|
|
1131
1131
|
}
|
|
@@ -1135,7 +1135,7 @@ async function runCodexWorkflowImport() {
|
|
|
1135
1135
|
ensureI18nInitialized();
|
|
1136
1136
|
await runCodexSystemPromptSelection();
|
|
1137
1137
|
await runCodexWorkflowSelection();
|
|
1138
|
-
console.log(
|
|
1138
|
+
console.log(ansis__default.green(i18n.t("codex:workflowInstall")));
|
|
1139
1139
|
}
|
|
1140
1140
|
async function runCodexWorkflowImportWithLanguageSelection(options) {
|
|
1141
1141
|
ensureI18nInitialized();
|
|
@@ -1152,7 +1152,7 @@ async function runCodexWorkflowImportWithLanguageSelection(options) {
|
|
|
1152
1152
|
await runCodexSystemPromptSelection(skipPrompt);
|
|
1153
1153
|
ensureCodexAgentsLanguageDirective(aiOutputLang);
|
|
1154
1154
|
await runCodexWorkflowSelection(options);
|
|
1155
|
-
console.log(
|
|
1155
|
+
console.log(ansis__default.green(i18n.t("codex:workflowInstall")));
|
|
1156
1156
|
return aiOutputLang;
|
|
1157
1157
|
}
|
|
1158
1158
|
async function runCodexSystemPromptSelection(skipPrompt = false) {
|
|
@@ -1210,7 +1210,7 @@ async function runCodexSystemPromptSelection(skipPrompt = false) {
|
|
|
1210
1210
|
ensureDir(CODEX_DIR);
|
|
1211
1211
|
const backupPath = backupCodexAgents();
|
|
1212
1212
|
if (backupPath) {
|
|
1213
|
-
console.log(
|
|
1213
|
+
console.log(ansis__default.gray(getBackupMessage(backupPath)));
|
|
1214
1214
|
}
|
|
1215
1215
|
writeFileAtomic(CODEX_AGENTS_FILE, content);
|
|
1216
1216
|
try {
|
|
@@ -1246,7 +1246,7 @@ async function runCodexWorkflowSelection(options) {
|
|
|
1246
1246
|
ensureDir(CODEX_PROMPTS_DIR);
|
|
1247
1247
|
const backupPath2 = backupCodexPrompts();
|
|
1248
1248
|
if (backupPath2) {
|
|
1249
|
-
console.log(
|
|
1249
|
+
console.log(ansis__default.gray(getBackupMessage(backupPath2)));
|
|
1250
1250
|
}
|
|
1251
1251
|
let workflowsToInstall;
|
|
1252
1252
|
if (presetWorkflows.length > 0) {
|
|
@@ -1281,7 +1281,7 @@ async function runCodexWorkflowSelection(options) {
|
|
|
1281
1281
|
ensureDir(CODEX_PROMPTS_DIR);
|
|
1282
1282
|
const backupPath = backupCodexPrompts();
|
|
1283
1283
|
if (backupPath) {
|
|
1284
|
-
console.log(
|
|
1284
|
+
console.log(ansis__default.gray(getBackupMessage(backupPath)));
|
|
1285
1285
|
}
|
|
1286
1286
|
const finalWorkflowPaths = expandSelectedWorkflowPaths(workflows, workflowSrc, preferredLang);
|
|
1287
1287
|
for (const workflowPath of finalWorkflowPaths) {
|
|
@@ -1345,13 +1345,13 @@ function createApiConfigChoices(providers, currentProvider, isCommented) {
|
|
|
1345
1345
|
const choices = [];
|
|
1346
1346
|
const isOfficialMode = !currentProvider || isCommented;
|
|
1347
1347
|
choices.push({
|
|
1348
|
-
name: isOfficialMode ? `${
|
|
1348
|
+
name: isOfficialMode ? `${ansis__default.green("\u25CF ")}${i18n.t("codex:useOfficialLogin")} ${ansis__default.yellow("(\u5F53\u524D)")}` : ` ${i18n.t("codex:useOfficialLogin")}`,
|
|
1349
1349
|
value: "official"
|
|
1350
1350
|
});
|
|
1351
1351
|
providers.forEach((provider) => {
|
|
1352
1352
|
const isCurrent = currentProvider === provider.id && !isCommented;
|
|
1353
1353
|
choices.push({
|
|
1354
|
-
name: isCurrent ? `${
|
|
1354
|
+
name: isCurrent ? `${ansis__default.green("\u25CF ")}${provider.name} - ${ansis__default.gray(provider.id)} ${ansis__default.yellow("(\u5F53\u524D)")}` : ` ${provider.name} - ${ansis__default.gray(provider.id)}`,
|
|
1355
1355
|
value: provider.id
|
|
1356
1356
|
});
|
|
1357
1357
|
});
|
|
@@ -1361,7 +1361,7 @@ async function applyCustomApiConfig(customApiConfig) {
|
|
|
1361
1361
|
const { type, token, baseUrl, model } = customApiConfig;
|
|
1362
1362
|
const backupPath = backupCodexComplete();
|
|
1363
1363
|
if (backupPath) {
|
|
1364
|
-
console.log(
|
|
1364
|
+
console.log(ansis__default.gray(getBackupMessage(backupPath)));
|
|
1365
1365
|
}
|
|
1366
1366
|
const existingConfig = readCodexConfig();
|
|
1367
1367
|
const existingAuth = readJsonConfig(CODEX_AUTH_FILE, { defaultValue: {} }) || {};
|
|
@@ -1398,7 +1398,7 @@ async function applyCustomApiConfig(customApiConfig) {
|
|
|
1398
1398
|
writeCodexConfig(configData);
|
|
1399
1399
|
writeJsonConfig(CODEX_AUTH_FILE, authEntries);
|
|
1400
1400
|
updateZcfConfig({ codeToolType: "codex" });
|
|
1401
|
-
console.log(
|
|
1401
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("codex:apiConfigured")}`));
|
|
1402
1402
|
}
|
|
1403
1403
|
async function configureCodexApi(options) {
|
|
1404
1404
|
ensureI18nInitialized();
|
|
@@ -1437,7 +1437,7 @@ async function configureCodexApi(options) {
|
|
|
1437
1437
|
default: "custom"
|
|
1438
1438
|
}]);
|
|
1439
1439
|
if (!mode) {
|
|
1440
|
-
console.log(
|
|
1440
|
+
console.log(ansis__default.yellow(i18n.t("common:cancelled")));
|
|
1441
1441
|
return;
|
|
1442
1442
|
}
|
|
1443
1443
|
if (mode === "official") {
|
|
@@ -1449,7 +1449,7 @@ async function configureCodexApi(options) {
|
|
|
1449
1449
|
}
|
|
1450
1450
|
if (mode === "switch") {
|
|
1451
1451
|
if (!hasProviders) {
|
|
1452
|
-
console.log(
|
|
1452
|
+
console.log(ansis__default.yellow(i18n.t("codex:noProvidersAvailable")));
|
|
1453
1453
|
return;
|
|
1454
1454
|
}
|
|
1455
1455
|
const currentProvider = existingConfig?.modelProvider;
|
|
@@ -1462,7 +1462,7 @@ async function configureCodexApi(options) {
|
|
|
1462
1462
|
choices: addNumbersToChoices(choices)
|
|
1463
1463
|
}]);
|
|
1464
1464
|
if (!selectedConfig) {
|
|
1465
|
-
console.log(
|
|
1465
|
+
console.log(ansis__default.yellow(i18n.t("common:cancelled")));
|
|
1466
1466
|
return;
|
|
1467
1467
|
}
|
|
1468
1468
|
let success = false;
|
|
@@ -1484,7 +1484,7 @@ async function configureCodexApi(options) {
|
|
|
1484
1484
|
}
|
|
1485
1485
|
const backupPath = backupCodexComplete();
|
|
1486
1486
|
if (backupPath) {
|
|
1487
|
-
console.log(
|
|
1487
|
+
console.log(ansis__default.gray(getBackupMessage(backupPath)));
|
|
1488
1488
|
}
|
|
1489
1489
|
const providers = [];
|
|
1490
1490
|
const authEntries = {};
|
|
@@ -1515,7 +1515,7 @@ async function configureCodexApi(options) {
|
|
|
1515
1515
|
prefilledBaseUrl = provider.codex.baseUrl;
|
|
1516
1516
|
prefilledWireApi = provider.codex.wireApi;
|
|
1517
1517
|
prefilledModel = provider.codex.defaultModel;
|
|
1518
|
-
console.log(
|
|
1518
|
+
console.log(ansis__default.gray(i18n.t("api:providerSelected", { name: provider.name })));
|
|
1519
1519
|
}
|
|
1520
1520
|
}
|
|
1521
1521
|
const answers = await inquirer.prompt([
|
|
@@ -1587,7 +1587,7 @@ async function configureCodexApi(options) {
|
|
|
1587
1587
|
defaultValue: false
|
|
1588
1588
|
});
|
|
1589
1589
|
if (!shouldOverwrite) {
|
|
1590
|
-
console.log(
|
|
1590
|
+
console.log(ansis__default.yellow(i18n.t("codex:providerDuplicateSkipped")));
|
|
1591
1591
|
continue;
|
|
1592
1592
|
}
|
|
1593
1593
|
if (sessionProvider) {
|
|
@@ -1618,7 +1618,7 @@ async function configureCodexApi(options) {
|
|
|
1618
1618
|
addMore = addAnother;
|
|
1619
1619
|
}
|
|
1620
1620
|
if (providers.length === 0) {
|
|
1621
|
-
console.log(
|
|
1621
|
+
console.log(ansis__default.yellow(i18n.t("codex:noProvidersConfigured")));
|
|
1622
1622
|
return;
|
|
1623
1623
|
}
|
|
1624
1624
|
const { defaultProvider } = await inquirer.prompt([{
|
|
@@ -1644,7 +1644,7 @@ async function configureCodexApi(options) {
|
|
|
1644
1644
|
});
|
|
1645
1645
|
writeAuthFile(authEntries);
|
|
1646
1646
|
updateZcfConfig({ codeToolType: "codex" });
|
|
1647
|
-
console.log(
|
|
1647
|
+
console.log(ansis__default.green(i18n.t("codex:apiConfigured")));
|
|
1648
1648
|
}
|
|
1649
1649
|
async function runCodexFullInit(options) {
|
|
1650
1650
|
ensureI18nInitialized();
|
|
@@ -1671,9 +1671,9 @@ function ensureCodexAgentsLanguageDirective(aiOutputLang) {
|
|
|
1671
1671
|
`;
|
|
1672
1672
|
const backupPath = backupCodexAgents();
|
|
1673
1673
|
if (backupPath)
|
|
1674
|
-
console.log(
|
|
1674
|
+
console.log(ansis__default.gray(getBackupMessage(backupPath)));
|
|
1675
1675
|
writeFileAtomic(CODEX_AGENTS_FILE, updatedContent);
|
|
1676
|
-
console.log(
|
|
1676
|
+
console.log(ansis__default.gray(` ${i18n.t("configuration:addedLanguageDirective")}: ${targetLabel}`));
|
|
1677
1677
|
}
|
|
1678
1678
|
function resolveCodexLanguageLabel(aiOutputLang) {
|
|
1679
1679
|
const directive = AI_OUTPUT_LANGUAGES[aiOutputLang]?.directive;
|
|
@@ -1691,7 +1691,7 @@ function normalizeLanguageLabel(label) {
|
|
|
1691
1691
|
}
|
|
1692
1692
|
async function runCodexUpdate(force = false, skipPrompt = false) {
|
|
1693
1693
|
ensureI18nInitialized();
|
|
1694
|
-
console.log(
|
|
1694
|
+
console.log(ansis__default.bold.cyan(`
|
|
1695
1695
|
\u{1F50D} ${i18n.t("updater:checkingTools")}
|
|
1696
1696
|
`));
|
|
1697
1697
|
const spinner = ora(i18n.t("updater:checkingVersion")).start();
|
|
@@ -1699,30 +1699,30 @@ async function runCodexUpdate(force = false, skipPrompt = false) {
|
|
|
1699
1699
|
const { installed, currentVersion, latestVersion, needsUpdate } = await checkCodexUpdate();
|
|
1700
1700
|
spinner.stop();
|
|
1701
1701
|
if (!installed) {
|
|
1702
|
-
console.log(
|
|
1702
|
+
console.log(ansis__default.yellow(i18n.t("codex:notInstalled")));
|
|
1703
1703
|
return false;
|
|
1704
1704
|
}
|
|
1705
1705
|
if (!needsUpdate && !force) {
|
|
1706
|
-
console.log(
|
|
1706
|
+
console.log(ansis__default.green(format(i18n.t("codex:upToDate"), { version: currentVersion || "" })));
|
|
1707
1707
|
return true;
|
|
1708
1708
|
}
|
|
1709
1709
|
if (!latestVersion) {
|
|
1710
|
-
console.log(
|
|
1710
|
+
console.log(ansis__default.yellow(i18n.t("codex:cannotCheckVersion")));
|
|
1711
1711
|
return false;
|
|
1712
1712
|
}
|
|
1713
|
-
console.log(
|
|
1714
|
-
console.log(
|
|
1713
|
+
console.log(ansis__default.green(format(i18n.t("codex:currentVersion"), { version: currentVersion || "" })));
|
|
1714
|
+
console.log(ansis__default.green(format(i18n.t("codex:latestVersion"), { version: latestVersion })));
|
|
1715
1715
|
if (!skipPrompt) {
|
|
1716
1716
|
const confirm = await promptBoolean({
|
|
1717
1717
|
message: i18n.t("codex:confirmUpdate"),
|
|
1718
1718
|
defaultValue: true
|
|
1719
1719
|
});
|
|
1720
1720
|
if (!confirm) {
|
|
1721
|
-
console.log(
|
|
1721
|
+
console.log(ansis__default.gray(i18n.t("codex:updateSkipped")));
|
|
1722
1722
|
return true;
|
|
1723
1723
|
}
|
|
1724
1724
|
} else {
|
|
1725
|
-
console.log(
|
|
1725
|
+
console.log(ansis__default.green(i18n.t("codex:autoUpdating")));
|
|
1726
1726
|
}
|
|
1727
1727
|
const updateSpinner = ora(i18n.t("codex:updating")).start();
|
|
1728
1728
|
try {
|
|
@@ -1731,12 +1731,12 @@ async function runCodexUpdate(force = false, skipPrompt = false) {
|
|
|
1731
1731
|
return true;
|
|
1732
1732
|
} catch (error) {
|
|
1733
1733
|
updateSpinner.fail(i18n.t("codex:updateFailed"));
|
|
1734
|
-
console.error(
|
|
1734
|
+
console.error(ansis__default.red(error instanceof Error ? error.message : String(error)));
|
|
1735
1735
|
return false;
|
|
1736
1736
|
}
|
|
1737
1737
|
} catch (error) {
|
|
1738
1738
|
spinner.fail(i18n.t("codex:checkFailed"));
|
|
1739
|
-
console.error(
|
|
1739
|
+
console.error(ansis__default.red(error instanceof Error ? error.message : String(error)));
|
|
1740
1740
|
return false;
|
|
1741
1741
|
}
|
|
1742
1742
|
}
|
|
@@ -1787,25 +1787,25 @@ async function runCodexUninstall() {
|
|
|
1787
1787
|
const results = await uninstaller.customUninstall(items);
|
|
1788
1788
|
displayUninstallResults(results);
|
|
1789
1789
|
}
|
|
1790
|
-
console.log(
|
|
1790
|
+
console.log(ansis__default.green(i18n.t("codex:uninstallSuccess")));
|
|
1791
1791
|
} catch (error) {
|
|
1792
|
-
console.error(
|
|
1792
|
+
console.error(ansis__default.red(i18n.t("codex:errorDuringUninstall", { error: error.message })));
|
|
1793
1793
|
throw error;
|
|
1794
1794
|
}
|
|
1795
1795
|
}
|
|
1796
1796
|
function displayUninstallResults(results) {
|
|
1797
1797
|
for (const result of results) {
|
|
1798
1798
|
for (const item of result.removed) {
|
|
1799
|
-
console.log(
|
|
1799
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("codex:removedItem", { item })}`));
|
|
1800
1800
|
}
|
|
1801
1801
|
for (const config of result.removedConfigs) {
|
|
1802
|
-
console.log(
|
|
1802
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("codex:removedConfig", { config })}`));
|
|
1803
1803
|
}
|
|
1804
1804
|
for (const warning of result.warnings) {
|
|
1805
|
-
console.log(
|
|
1805
|
+
console.log(ansis__default.yellow(`\u26A0\uFE0F ${warning}`));
|
|
1806
1806
|
}
|
|
1807
1807
|
for (const error of result.errors) {
|
|
1808
|
-
console.log(
|
|
1808
|
+
console.log(ansis__default.red(`\u274C ${error}`));
|
|
1809
1809
|
}
|
|
1810
1810
|
}
|
|
1811
1811
|
}
|
|
@@ -1821,17 +1821,17 @@ async function switchCodexProvider(providerId) {
|
|
|
1821
1821
|
ensureI18nInitialized();
|
|
1822
1822
|
const existingConfig = readCodexConfig();
|
|
1823
1823
|
if (!existingConfig) {
|
|
1824
|
-
console.log(
|
|
1824
|
+
console.log(ansis__default.red(i18n.t("codex:configNotFound")));
|
|
1825
1825
|
return false;
|
|
1826
1826
|
}
|
|
1827
1827
|
const providerExists = existingConfig.providers.some((provider) => provider.id === providerId);
|
|
1828
1828
|
if (!providerExists) {
|
|
1829
|
-
console.log(
|
|
1829
|
+
console.log(ansis__default.red(i18n.t("codex:providerNotFound", { provider: providerId })));
|
|
1830
1830
|
return false;
|
|
1831
1831
|
}
|
|
1832
1832
|
const backupPath = backupCodexComplete();
|
|
1833
1833
|
if (backupPath) {
|
|
1834
|
-
console.log(
|
|
1834
|
+
console.log(ansis__default.gray(getBackupMessage(backupPath)));
|
|
1835
1835
|
}
|
|
1836
1836
|
const updatedConfig = {
|
|
1837
1837
|
...existingConfig,
|
|
@@ -1839,10 +1839,10 @@ async function switchCodexProvider(providerId) {
|
|
|
1839
1839
|
};
|
|
1840
1840
|
try {
|
|
1841
1841
|
writeCodexConfig(updatedConfig);
|
|
1842
|
-
console.log(
|
|
1842
|
+
console.log(ansis__default.green(i18n.t("codex:providerSwitchSuccess", { provider: providerId })));
|
|
1843
1843
|
return true;
|
|
1844
1844
|
} catch (error) {
|
|
1845
|
-
console.error(
|
|
1845
|
+
console.error(ansis__default.red(i18n.t("codex:errorSwitchingProvider", { error: error.message })));
|
|
1846
1846
|
return false;
|
|
1847
1847
|
}
|
|
1848
1848
|
}
|
|
@@ -1850,12 +1850,12 @@ async function switchToOfficialLogin() {
|
|
|
1850
1850
|
ensureI18nInitialized();
|
|
1851
1851
|
const existingConfig = readCodexConfig();
|
|
1852
1852
|
if (!existingConfig) {
|
|
1853
|
-
console.log(
|
|
1853
|
+
console.log(ansis__default.red(i18n.t("codex:configNotFound")));
|
|
1854
1854
|
return false;
|
|
1855
1855
|
}
|
|
1856
1856
|
const backupPath = backupCodexComplete();
|
|
1857
1857
|
if (backupPath) {
|
|
1858
|
-
console.log(
|
|
1858
|
+
console.log(ansis__default.gray(getBackupMessage(backupPath)));
|
|
1859
1859
|
}
|
|
1860
1860
|
try {
|
|
1861
1861
|
let preservedModelProvider = existingConfig.modelProvider;
|
|
@@ -1878,10 +1878,10 @@ async function switchToOfficialLogin() {
|
|
|
1878
1878
|
const auth = readJsonConfig(CODEX_AUTH_FILE, { defaultValue: {} }) || {};
|
|
1879
1879
|
auth.OPENAI_API_KEY = null;
|
|
1880
1880
|
writeJsonConfig(CODEX_AUTH_FILE, auth, { pretty: true });
|
|
1881
|
-
console.log(
|
|
1881
|
+
console.log(ansis__default.green(i18n.t("codex:officialConfigured")));
|
|
1882
1882
|
return true;
|
|
1883
1883
|
} catch (error) {
|
|
1884
|
-
console.error(
|
|
1884
|
+
console.error(ansis__default.red(i18n.t("codex:errorSwitchingToOfficialLogin", { error: error.message })));
|
|
1885
1885
|
return false;
|
|
1886
1886
|
}
|
|
1887
1887
|
}
|
|
@@ -1889,17 +1889,17 @@ async function switchToProvider(providerId) {
|
|
|
1889
1889
|
ensureI18nInitialized();
|
|
1890
1890
|
const existingConfig = readCodexConfig();
|
|
1891
1891
|
if (!existingConfig) {
|
|
1892
|
-
console.log(
|
|
1892
|
+
console.log(ansis__default.red(i18n.t("codex:configNotFound")));
|
|
1893
1893
|
return false;
|
|
1894
1894
|
}
|
|
1895
1895
|
const provider = existingConfig.providers.find((p) => p.id === providerId);
|
|
1896
1896
|
if (!provider) {
|
|
1897
|
-
console.log(
|
|
1897
|
+
console.log(ansis__default.red(i18n.t("codex:providerNotFound", { provider: providerId })));
|
|
1898
1898
|
return false;
|
|
1899
1899
|
}
|
|
1900
1900
|
const backupPath = backupCodexComplete();
|
|
1901
1901
|
if (backupPath) {
|
|
1902
|
-
console.log(
|
|
1902
|
+
console.log(ansis__default.gray(getBackupMessage(backupPath)));
|
|
1903
1903
|
}
|
|
1904
1904
|
try {
|
|
1905
1905
|
let targetModel = existingConfig.model;
|
|
@@ -1923,10 +1923,10 @@ async function switchToProvider(providerId) {
|
|
|
1923
1923
|
const envValue = auth[provider.tempEnvKey] || null;
|
|
1924
1924
|
auth.OPENAI_API_KEY = envValue;
|
|
1925
1925
|
writeJsonConfig(CODEX_AUTH_FILE, auth, { pretty: true });
|
|
1926
|
-
console.log(
|
|
1926
|
+
console.log(ansis__default.green(i18n.t("codex:providerSwitchSuccess", { provider: providerId })));
|
|
1927
1927
|
return true;
|
|
1928
1928
|
} catch (error) {
|
|
1929
|
-
console.error(
|
|
1929
|
+
console.error(ansis__default.red(i18n.t("codex:errorSwitchingProvider", { error: error.message })));
|
|
1930
1930
|
return false;
|
|
1931
1931
|
}
|
|
1932
1932
|
}
|
package/dist/chunks/commands.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { exec } from 'node:child_process';
|
|
2
2
|
import { promisify } from 'node:util';
|
|
3
|
-
import
|
|
3
|
+
import ansis__default from 'ansis';
|
|
4
4
|
import { ensureI18nInitialized, i18n } from './index2.mjs';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
import 'node:process';
|
|
@@ -12,12 +12,12 @@ import 'pathe';
|
|
|
12
12
|
const execAsync = promisify(exec);
|
|
13
13
|
async function runCcrUi(apiKey) {
|
|
14
14
|
ensureI18nInitialized();
|
|
15
|
-
console.log(
|
|
15
|
+
console.log(ansis__default.green(`
|
|
16
16
|
\u{1F5A5}\uFE0F ${i18n.t("ccr:startingCcrUi")}`));
|
|
17
17
|
if (apiKey) {
|
|
18
|
-
console.log(
|
|
18
|
+
console.log(ansis__default.bold.green(`
|
|
19
19
|
\u{1F511} ${i18n.t("ccr:ccrUiApiKey") || "CCR UI API Key"}: ${apiKey}`));
|
|
20
|
-
console.log(
|
|
20
|
+
console.log(ansis__default.gray(` ${i18n.t("ccr:ccrUiApiKeyHint") || "Use this API key to login to CCR UI"}
|
|
21
21
|
`));
|
|
22
22
|
}
|
|
23
23
|
try {
|
|
@@ -25,83 +25,83 @@ async function runCcrUi(apiKey) {
|
|
|
25
25
|
if (stdout)
|
|
26
26
|
console.log(stdout);
|
|
27
27
|
if (stderr)
|
|
28
|
-
console.error(
|
|
29
|
-
console.log(
|
|
28
|
+
console.error(ansis__default.yellow(stderr));
|
|
29
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("ccr:ccrUiStarted")}`));
|
|
30
30
|
} catch (error) {
|
|
31
|
-
console.error(
|
|
31
|
+
console.error(ansis__default.red(`\u2716 ${i18n.t("ccr:ccrCommandFailed")}: ${error instanceof Error ? error.message : String(error)}`));
|
|
32
32
|
throw error;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
async function runCcrStatus() {
|
|
36
36
|
ensureI18nInitialized();
|
|
37
|
-
console.log(
|
|
37
|
+
console.log(ansis__default.green(`
|
|
38
38
|
\u{1F4CA} ${i18n.t("ccr:checkingCcrStatus")}`));
|
|
39
39
|
try {
|
|
40
40
|
const { stdout, stderr } = await execAsync("ccr status");
|
|
41
41
|
if (stdout) {
|
|
42
42
|
console.log(`
|
|
43
|
-
${
|
|
43
|
+
${ansis__default.bold(i18n.t("ccr:ccrStatusTitle"))}`);
|
|
44
44
|
console.log(stdout);
|
|
45
45
|
}
|
|
46
46
|
if (stderr)
|
|
47
|
-
console.error(
|
|
47
|
+
console.error(ansis__default.yellow(stderr));
|
|
48
48
|
} catch (error) {
|
|
49
|
-
console.error(
|
|
49
|
+
console.error(ansis__default.red(`\u2716 ${i18n.t("ccr:ccrCommandFailed")}: ${error instanceof Error ? error.message : String(error)}`));
|
|
50
50
|
throw error;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
async function runCcrRestart() {
|
|
54
54
|
ensureI18nInitialized();
|
|
55
|
-
console.log(
|
|
55
|
+
console.log(ansis__default.green(`
|
|
56
56
|
\u{1F504} ${i18n.t("ccr:restartingCcr")}`));
|
|
57
57
|
try {
|
|
58
58
|
const { stdout, stderr } = await execAsync("ccr restart");
|
|
59
59
|
if (stdout)
|
|
60
60
|
console.log(stdout);
|
|
61
61
|
if (stderr)
|
|
62
|
-
console.error(
|
|
63
|
-
console.log(
|
|
62
|
+
console.error(ansis__default.yellow(stderr));
|
|
63
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("ccr:ccrRestarted")}`));
|
|
64
64
|
} catch (error) {
|
|
65
|
-
console.error(
|
|
65
|
+
console.error(ansis__default.red(`\u2716 ${i18n.t("ccr:ccrCommandFailed")}: ${error instanceof Error ? error.message : String(error)}`));
|
|
66
66
|
throw error;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
async function runCcrStart() {
|
|
70
70
|
ensureI18nInitialized();
|
|
71
|
-
console.log(
|
|
71
|
+
console.log(ansis__default.green(`
|
|
72
72
|
\u25B6\uFE0F ${i18n.t("ccr:startingCcr")}`));
|
|
73
73
|
try {
|
|
74
74
|
const { stdout, stderr } = await execAsync("ccr start");
|
|
75
75
|
if (stdout)
|
|
76
76
|
console.log(stdout);
|
|
77
77
|
if (stderr)
|
|
78
|
-
console.error(
|
|
79
|
-
console.log(
|
|
78
|
+
console.error(ansis__default.yellow(stderr));
|
|
79
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("ccr:ccrStarted")}`));
|
|
80
80
|
} catch (error) {
|
|
81
81
|
if (error.stdout && error.stdout.includes("Loaded JSON config from:")) {
|
|
82
82
|
console.log(error.stdout);
|
|
83
83
|
if (error.stderr)
|
|
84
|
-
console.error(
|
|
85
|
-
console.log(
|
|
84
|
+
console.error(ansis__default.yellow(error.stderr));
|
|
85
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("ccr:ccrStarted")}`));
|
|
86
86
|
} else {
|
|
87
|
-
console.error(
|
|
87
|
+
console.error(ansis__default.red(`\u2716 ${i18n.t("ccr:ccrCommandFailed")}: ${error instanceof Error ? error.message : String(error)}`));
|
|
88
88
|
throw error;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
async function runCcrStop() {
|
|
93
93
|
ensureI18nInitialized();
|
|
94
|
-
console.log(
|
|
94
|
+
console.log(ansis__default.green(`
|
|
95
95
|
\u23F9\uFE0F ${i18n.t("ccr:stoppingCcr")}`));
|
|
96
96
|
try {
|
|
97
97
|
const { stdout, stderr } = await execAsync("ccr stop");
|
|
98
98
|
if (stdout)
|
|
99
99
|
console.log(stdout);
|
|
100
100
|
if (stderr)
|
|
101
|
-
console.error(
|
|
102
|
-
console.log(
|
|
101
|
+
console.error(ansis__default.yellow(stderr));
|
|
102
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("ccr:ccrStopped")}`));
|
|
103
103
|
} catch (error) {
|
|
104
|
-
console.error(
|
|
104
|
+
console.error(ansis__default.red(`\u2716 ${i18n.t("ccr:ccrCommandFailed")}: ${error instanceof Error ? error.message : String(error)}`));
|
|
105
105
|
throw error;
|
|
106
106
|
}
|
|
107
107
|
}
|