ccjk 12.0.0 → 12.0.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/agent-teams.mjs +17 -18
- package/dist/chunks/agent.mjs +105 -102
- package/dist/chunks/agents.mjs +87 -77
- package/dist/chunks/api-cli.mjs +41 -27
- package/dist/chunks/api-providers.mjs +2 -4
- package/dist/chunks/api.mjs +22 -11
- package/dist/chunks/auto-bootstrap.mjs +3 -5
- package/dist/chunks/auto-init.mjs +3 -4
- package/dist/chunks/auto-updater.mjs +103 -91
- package/dist/chunks/banner.mjs +41 -42
- package/dist/chunks/boost.mjs +30 -31
- package/dist/chunks/ccjk-agents.mjs +6 -9
- package/dist/chunks/ccjk-all.mjs +703 -85
- package/dist/chunks/ccjk-config.mjs +6 -6
- package/dist/chunks/ccjk-hooks.mjs +20 -9
- package/dist/chunks/ccjk-mcp.mjs +64 -52
- package/dist/chunks/ccjk-setup.mjs +35 -25
- package/dist/chunks/ccjk-skills.mjs +51 -41
- package/dist/chunks/ccr.mjs +42 -32
- package/dist/chunks/ccu.mjs +16 -12
- package/dist/chunks/check-updates.mjs +30 -19
- package/dist/chunks/claude-code-config-manager.mjs +25 -10
- package/dist/chunks/claude-code-incremental-manager.mjs +65 -51
- package/dist/chunks/claude-config.mjs +2 -2
- package/dist/chunks/claude-wrapper.mjs +9 -6
- package/dist/chunks/cleanup-migration.mjs +1 -1
- package/dist/chunks/cli-hook.mjs +10 -3
- package/dist/chunks/cloud-sync.mjs +1 -1
- package/dist/chunks/codex-config-switch.mjs +58 -45
- package/dist/chunks/codex-provider-manager.mjs +29 -16
- package/dist/chunks/codex-uninstaller.mjs +5 -6
- package/dist/chunks/codex.mjs +89 -89
- package/dist/chunks/commands.mjs +28 -29
- package/dist/chunks/commands2.mjs +4 -3
- package/dist/chunks/commit.mjs +42 -23
- package/dist/chunks/completion.mjs +46 -47
- package/dist/chunks/config-consolidator.mjs +12 -13
- package/dist/chunks/config-switch.mjs +66 -53
- package/dist/chunks/config.mjs +10 -10
- package/dist/chunks/config2.mjs +53 -42
- package/dist/chunks/config3.mjs +107 -93
- package/dist/chunks/constants.mjs +2 -4
- package/dist/chunks/context-loader.mjs +5 -4
- package/dist/chunks/context.mjs +77 -76
- package/dist/chunks/convoy-manager.mjs +4 -4
- package/dist/chunks/dashboard.mjs +28 -29
- package/dist/chunks/doctor.mjs +68 -54
- package/dist/chunks/evolution.mjs +37 -38
- package/dist/chunks/features.mjs +103 -92
- package/dist/chunks/fs-operations.mjs +1 -1
- package/dist/chunks/health-alerts.mjs +1 -1
- package/dist/chunks/health-check.mjs +1 -1
- package/dist/chunks/help.mjs +117 -116
- package/dist/chunks/hook-installer.mjs +3 -2
- package/dist/chunks/index.mjs +20 -6
- package/dist/chunks/index10.mjs +1171 -0
- package/dist/chunks/index11.mjs +1008 -0
- package/dist/chunks/index12.mjs +193 -0
- package/dist/chunks/index13.mjs +218 -0
- package/dist/chunks/index14.mjs +663 -0
- package/dist/chunks/index2.mjs +19 -10
- package/dist/chunks/index3.mjs +19079 -164
- package/dist/chunks/index4.mjs +8 -1171
- package/dist/chunks/index5.mjs +7479 -884
- package/dist/chunks/index6.mjs +160 -184
- package/dist/chunks/index7.mjs +3573 -653
- package/dist/chunks/index8.mjs +19 -0
- package/dist/chunks/index9.mjs +616 -0
- package/dist/chunks/init.mjs +173 -173
- package/dist/chunks/installer.mjs +92 -82
- package/dist/chunks/installer2.mjs +3 -2
- package/dist/chunks/interview.mjs +118 -107
- package/dist/chunks/json-config.mjs +3 -2
- package/dist/chunks/linux.mjs +3863 -0
- package/dist/chunks/macos.mjs +69 -0
- package/dist/chunks/main.mjs +635 -0
- package/dist/chunks/marketplace.mjs +69 -66
- package/dist/chunks/mcp-cli.mjs +61 -48
- package/dist/chunks/mcp.mjs +140 -127
- package/dist/chunks/menu.mjs +85 -85
- package/dist/chunks/metrics-display.mjs +41 -40
- package/dist/chunks/migrator.mjs +4 -5
- package/dist/chunks/monitor.mjs +95 -95
- package/dist/chunks/notification.mjs +151 -141
- package/dist/chunks/onboarding.mjs +26 -15
- package/dist/chunks/package.mjs +1 -1
- package/dist/chunks/paradigm.mjs +24 -23
- package/dist/chunks/permission-manager.mjs +10 -11
- package/dist/chunks/permissions.mjs +72 -57
- package/dist/chunks/persistence-manager.mjs +97 -84
- package/dist/chunks/persistence.mjs +1 -1
- package/dist/chunks/platform.mjs +29 -29
- package/dist/chunks/plugin.mjs +104 -105
- package/dist/chunks/prompts.mjs +36 -25
- package/dist/chunks/providers.mjs +68 -69
- package/dist/chunks/quick-actions.mjs +71 -72
- package/dist/chunks/quick-provider.mjs +56 -40
- package/dist/chunks/quick-setup.mjs +71 -60
- package/dist/chunks/remote.mjs +21 -12
- package/dist/chunks/session.mjs +116 -103
- package/dist/chunks/sessions.mjs +29 -28
- package/dist/chunks/silent-updater.mjs +8 -10
- package/dist/chunks/simple-config.mjs +13 -10
- package/dist/chunks/skill.mjs +8560 -103
- package/dist/chunks/skills-sync.mjs +5212 -79
- package/dist/chunks/skills.mjs +105 -94
- package/dist/chunks/slash-commands.mjs +36 -37
- package/dist/chunks/smart-defaults.mjs +7 -3
- package/dist/chunks/smart-guide.mjs +1 -1
- package/dist/chunks/startup.mjs +2 -4
- package/dist/chunks/stats.mjs +41 -42
- package/dist/chunks/status.mjs +49 -50
- package/dist/chunks/team.mjs +24 -12
- package/dist/chunks/thinking.mjs +74 -63
- package/dist/chunks/trace.mjs +20 -19
- package/dist/chunks/uninstall.mjs +69 -56
- package/dist/chunks/update.mjs +39 -28
- package/dist/chunks/upgrade-manager.mjs +24 -18
- package/dist/chunks/version-checker.mjs +45 -41
- package/dist/chunks/vim.mjs +81 -69
- package/dist/chunks/windows.mjs +14 -0
- package/dist/chunks/workflows.mjs +15 -15
- package/dist/chunks/wsl.mjs +129 -0
- package/dist/chunks/zero-config.mjs +45 -34
- package/dist/cli.mjs +20 -20
- package/dist/index.mjs +41 -31
- package/dist/shared/ccjk.BAGoDD49.mjs +36 -0
- package/dist/shared/ccjk.BBtCGd_g.mjs +899 -0
- package/dist/shared/{ccjk.CGcy7cNM.mjs → ccjk.BDKUdmLk.mjs} +1 -1
- package/dist/shared/{ccjk.DtMBiwVG.mjs → ccjk.BFxsJM0k.mjs} +1 -1
- package/dist/shared/{ccjk.j4uut26D.mjs → ccjk.BIxuVL3_.mjs} +5 -5
- package/dist/shared/ccjk.BRZ9ww8S.mjs +142 -0
- package/dist/shared/{ccjk.CN0edl87.mjs → ccjk.BSYWk9ML.mjs} +1 -1
- package/dist/shared/{ccjk.Dk1HDseQ.mjs → ccjk.BnpWvs9V.mjs} +75 -75
- package/dist/shared/ccjk.BoApaI4j.mjs +28 -0
- package/dist/shared/{ccjk.DKojSRzw.mjs → ccjk.BrPUmTqm.mjs} +1 -1
- package/dist/shared/{ccjk.C10pepYx.mjs → ccjk.BxSmJ8B7.mjs} +1 -1
- package/dist/shared/ccjk.Bx_rmYfN.mjs +69 -0
- package/dist/shared/ccjk.COweQ1RR.mjs +5 -0
- package/dist/shared/{ccjk.BN90X6oc.mjs → ccjk.CePkJq2S.mjs} +17 -17
- package/dist/shared/{ccjk.Bvoex4TZ.mjs → ccjk.CfKKcvWy.mjs} +1 -1
- package/dist/shared/ccjk.Cjgrln_h.mjs +297 -0
- package/dist/shared/ccjk.CxpGa6MC.mjs +2724 -0
- package/dist/shared/{ccjk.DfwJOEok.mjs → ccjk.D5MFQT7w.mjs} +1 -1
- package/dist/shared/{ccjk.cChAaGgT.mjs → ccjk.DG_o24cZ.mjs} +6 -6
- package/dist/shared/{ccjk.bhFAMRyc.mjs → ccjk.DLLw-h4Y.mjs} +32 -32
- package/dist/shared/ccjk.DOwtZMk8.mjs +4019 -0
- package/dist/shared/{ccjk.BsXQugfY.mjs → ccjk.DTdjs-qK.mjs} +13 -13
- package/dist/shared/{ccjk.Bdhyg3X-.mjs → ccjk.DsYaCCx4.mjs} +1 -1
- package/dist/shared/ccjk.KfSWcGlE.mjs +38 -0
- package/dist/shared/ccjk.RyizuzOI.mjs +21 -0
- package/dist/shared/{ccjk.h7_W-wTs.mjs → ccjk.SPoXMvZD.mjs} +1 -1
- package/dist/shared/ccjk.T_cX87dY.mjs +15 -0
- package/dist/shared/{ccjk.CrB6OYHv.mjs → ccjk._dESH4Rk.mjs} +2 -2
- package/dist/shared/ccjk.bQ7Dh1g4.mjs +249 -0
- package/dist/shared/{ccjk.CBhIZiPz.mjs → ccjk.hoqrwWdN.mjs} +1 -1
- package/dist/shared/{ccjk.BNwRnWYx.mjs → ccjk.s7OCVzdd.mjs} +1230 -33
- package/dist/shared/{ccjk.BOIUTf5z.mjs → ccjk.waa2ikKJ.mjs} +8 -9
- package/package.json +31 -30
- package/dist/shared/ccjk.DHbrGcgg.mjs +0 -13
- package/dist/shared/ccjk.DntgA8fQ.mjs +0 -42
|
@@ -1,23 +1,38 @@
|
|
|
1
|
-
import { ensureI18nInitialized, i18n } from './
|
|
1
|
+
import { ensureI18nInitialized, i18n } from './index5.mjs';
|
|
2
2
|
import { a as readCodexConfig, e as backupCodexComplete, w as writeCodexConfig, f as writeAuthFile } from './codex.mjs';
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'node:process';
|
|
5
5
|
import 'node:url';
|
|
6
|
-
import '
|
|
7
|
-
import '
|
|
8
|
-
import '
|
|
9
|
-
import '
|
|
10
|
-
import '
|
|
11
|
-
import '
|
|
12
|
-
import '
|
|
13
|
-
import '
|
|
14
|
-
import '
|
|
15
|
-
import '
|
|
16
|
-
import '
|
|
6
|
+
import '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
7
|
+
import './index2.mjs';
|
|
8
|
+
import '../shared/ccjk.BAGoDD49.mjs';
|
|
9
|
+
import '../shared/ccjk.RyizuzOI.mjs';
|
|
10
|
+
import './index3.mjs';
|
|
11
|
+
import 'node:readline';
|
|
12
|
+
import 'stream';
|
|
13
|
+
import 'node:tty';
|
|
14
|
+
import 'node:async_hooks';
|
|
15
|
+
import '../shared/ccjk.Cjgrln_h.mjs';
|
|
16
|
+
import 'node:util';
|
|
17
|
+
import 'tty';
|
|
18
|
+
import 'fs';
|
|
19
|
+
import 'child_process';
|
|
20
|
+
import 'node:path';
|
|
17
21
|
import 'node:os';
|
|
22
|
+
import 'node:crypto';
|
|
23
|
+
import 'buffer';
|
|
24
|
+
import 'string_decoder';
|
|
25
|
+
import './index7.mjs';
|
|
26
|
+
import '../shared/ccjk.CxpGa6MC.mjs';
|
|
27
|
+
import '../shared/ccjk.BBtCGd_g.mjs';
|
|
28
|
+
import './main.mjs';
|
|
29
|
+
import 'module';
|
|
30
|
+
import 'node:child_process';
|
|
31
|
+
import 'node:stream';
|
|
32
|
+
import './constants.mjs';
|
|
18
33
|
import './ccjk-config.mjs';
|
|
34
|
+
import './index6.mjs';
|
|
19
35
|
import './fs-operations.mjs';
|
|
20
|
-
import 'node:crypto';
|
|
21
36
|
import 'node:fs/promises';
|
|
22
37
|
import './json-config.mjs';
|
|
23
38
|
import './config.mjs';
|
|
@@ -27,9 +42,7 @@ import '../shared/ccjk.BiCrMV5O.mjs';
|
|
|
27
42
|
import '../shared/ccjk.BFQ7yr5S.mjs';
|
|
28
43
|
import './prompts.mjs';
|
|
29
44
|
import './package.mjs';
|
|
30
|
-
import '../shared/ccjk.
|
|
31
|
-
import 'inquirer-toggle';
|
|
32
|
-
import 'node:child_process';
|
|
45
|
+
import '../shared/ccjk.DOwtZMk8.mjs';
|
|
33
46
|
|
|
34
47
|
async function addProviderToExisting(provider, apiKey, allowOverwrite = false) {
|
|
35
48
|
ensureI18nInitialized();
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { promises } from 'node:fs';
|
|
2
|
-
import { join } from 'pathe';
|
|
3
2
|
import { CODEX_DIR, CODEX_CONFIG_FILE, CODEX_AUTH_FILE, CODEX_AGENTS_FILE, CODEX_PROMPTS_DIR } from './constants.mjs';
|
|
4
|
-
import { i18n } from './
|
|
3
|
+
import { i18n } from './index5.mjs';
|
|
5
4
|
import { writeFileAtomic } from './fs-operations.mjs';
|
|
6
|
-
import { m as moveToTrash } from '../shared/ccjk.
|
|
5
|
+
import { m as moveToTrash } from '../shared/ccjk.BRZ9ww8S.mjs';
|
|
6
|
+
import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
7
7
|
import 'node:os';
|
|
8
8
|
import 'node:process';
|
|
9
9
|
import 'node:url';
|
|
10
|
-
import 'i18next';
|
|
11
|
-
import 'i18next-fs-backend';
|
|
12
10
|
import 'node:crypto';
|
|
13
11
|
import 'node:fs/promises';
|
|
14
|
-
import '
|
|
12
|
+
import 'node:path';
|
|
13
|
+
import 'globby';
|
|
15
14
|
|
|
16
15
|
async function pathExists(p) {
|
|
17
16
|
try {
|
package/dist/chunks/codex.mjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import process__default from 'node:process';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
|
-
import
|
|
4
|
-
import dayjs from '
|
|
5
|
-
import inquirer from '
|
|
6
|
-
import ora from '
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import { x } from 'tinyexec';
|
|
3
|
+
import a from './index2.mjs';
|
|
4
|
+
import { d as dayjs } from '../shared/ccjk.RyizuzOI.mjs';
|
|
5
|
+
import { i as inquirer } from './index3.mjs';
|
|
6
|
+
import ora from './index7.mjs';
|
|
7
|
+
import { a as semver } from '../shared/ccjk.CxpGa6MC.mjs';
|
|
8
|
+
import { p as parse } from '../shared/ccjk.BBtCGd_g.mjs';
|
|
9
|
+
import { x as K } from './main.mjs';
|
|
11
10
|
import { CODEX_AUTH_FILE, SUPPORTED_LANGS, CODEX_DIR, CODEX_AGENTS_FILE, CODEX_PROMPTS_DIR, CODEX_CONFIG_FILE, AI_OUTPUT_LANGUAGES, ZCF_CONFIG_FILE } from './constants.mjs';
|
|
12
|
-
import { ensureI18nInitialized, i18n, format } from './
|
|
11
|
+
import { ensureI18nInitialized, i18n, format } from './index5.mjs';
|
|
13
12
|
import { updateZcfConfig, readZcfConfig, readDefaultTomlConfig, updateTomlConfig } from './ccjk-config.mjs';
|
|
14
13
|
import { a as applyAiLanguageDirective } from './config.mjs';
|
|
15
14
|
import { exists, readFile, ensureDir, writeFileAtomic, writeFile, copyFile, copyDir } from './fs-operations.mjs';
|
|
@@ -17,9 +16,10 @@ import { readJsonConfig, writeJsonConfig } from './json-config.mjs';
|
|
|
17
16
|
import { i as isWindows, m as getMcpCommand, l as getSystemRoot, w as wrapCommandWithSudo, n as normalizeTomlPath } from './platform.mjs';
|
|
18
17
|
import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
|
|
19
18
|
import { resolveAiOutputLanguage } from './prompts.mjs';
|
|
20
|
-
import { p as promptBoolean } from '../shared/ccjk.
|
|
19
|
+
import { p as promptBoolean } from '../shared/ccjk.DOwtZMk8.mjs';
|
|
21
20
|
import 'node:child_process';
|
|
22
21
|
import { homedir } from 'node:os';
|
|
22
|
+
import { j as join, d as dirname } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
23
23
|
|
|
24
24
|
const PLAYWRIGHT_PROFILES_DIR = join(homedir(), ".ccjk", "playwright");
|
|
25
25
|
function createPlaywrightMcpConfig(options = {}) {
|
|
@@ -331,7 +331,7 @@ async function selectMcpServices() {
|
|
|
331
331
|
MCP_SERVICE_CONFIGS.filter((c) => c.defaultSelected).map((c) => c.id)
|
|
332
332
|
);
|
|
333
333
|
const choices = mcpServices.map((service) => ({
|
|
334
|
-
name: `${service.name} - ${
|
|
334
|
+
name: `${service.name} - ${a.gray(service.description)}`,
|
|
335
335
|
value: service.id,
|
|
336
336
|
checked: defaultSelectedIds.has(service.id)
|
|
337
337
|
}));
|
|
@@ -342,7 +342,7 @@ async function selectMcpServices() {
|
|
|
342
342
|
choices
|
|
343
343
|
});
|
|
344
344
|
if (services === void 0) {
|
|
345
|
-
console.log(
|
|
345
|
+
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
346
346
|
return void 0;
|
|
347
347
|
}
|
|
348
348
|
return services;
|
|
@@ -392,13 +392,13 @@ async function configureCodexMcp(options) {
|
|
|
392
392
|
const existingConfig = readCodexConfig();
|
|
393
393
|
const backupPath = backupCodexComplete();
|
|
394
394
|
if (backupPath)
|
|
395
|
-
console.log(
|
|
395
|
+
console.log(a.gray(getBackupMessage(backupPath)));
|
|
396
396
|
if (skipPrompt) {
|
|
397
397
|
const { runCodexWorkflowSelection } = await Promise.resolve().then(function () { return codex; });
|
|
398
398
|
await runCodexWorkflowSelection({ skipPrompt: true, workflows: options?.workflows ?? [] });
|
|
399
399
|
if (options?.mcpServices === false) {
|
|
400
400
|
updateZcfConfig({ codeToolType: "codex" });
|
|
401
|
-
console.log(
|
|
401
|
+
console.log(a.green(i18n.t("codex:mcpConfigured")));
|
|
402
402
|
return;
|
|
403
403
|
}
|
|
404
404
|
const defaultServiceIds = Array.isArray(options?.mcpServices) ? options.mcpServices : MCP_SERVICE_CONFIGS.filter((service) => !service.requiresApiKey).map((service) => service.id);
|
|
@@ -464,7 +464,7 @@ async function configureCodexMcp(options) {
|
|
|
464
464
|
otherConfig: existingConfig?.otherConfig || []
|
|
465
465
|
});
|
|
466
466
|
updateZcfConfig({ codeToolType: "codex" });
|
|
467
|
-
console.log(
|
|
467
|
+
console.log(a.green(i18n.t("codex:mcpConfigured")));
|
|
468
468
|
return;
|
|
469
469
|
}
|
|
470
470
|
const selectedIds = await selectMcpServices();
|
|
@@ -475,7 +475,7 @@ async function configureCodexMcp(options) {
|
|
|
475
475
|
const selection = [];
|
|
476
476
|
const existingServices = existingConfig?.mcpServices || [];
|
|
477
477
|
if (selectedIds.length === 0) {
|
|
478
|
-
console.log(
|
|
478
|
+
console.log(a.yellow(i18n.t("codex:noMcpConfigured")));
|
|
479
479
|
const preserved = (existingServices || []).map((svc) => {
|
|
480
480
|
if (isWindows()) {
|
|
481
481
|
const systemRoot = getSystemRoot();
|
|
@@ -574,7 +574,7 @@ async function configureCodexMcp(options) {
|
|
|
574
574
|
otherConfig: existingConfig?.otherConfig || []
|
|
575
575
|
});
|
|
576
576
|
updateZcfConfig({ codeToolType: "codex" });
|
|
577
|
-
console.log(
|
|
577
|
+
console.log(a.green(i18n.t("codex:mcpConfigured")));
|
|
578
578
|
}
|
|
579
579
|
|
|
580
580
|
let cachedSkipPromptBackup = null;
|
|
@@ -591,14 +591,14 @@ function getRootDir() {
|
|
|
591
591
|
}
|
|
592
592
|
async function detectCodexInstallMethod() {
|
|
593
593
|
try {
|
|
594
|
-
const brewResult = await
|
|
594
|
+
const brewResult = await K("brew", ["list", "--cask", "codex"], { throwOnError: false });
|
|
595
595
|
if (brewResult.exitCode === 0) {
|
|
596
596
|
return "homebrew";
|
|
597
597
|
}
|
|
598
598
|
} catch {
|
|
599
599
|
}
|
|
600
600
|
try {
|
|
601
|
-
const npmResult = await
|
|
601
|
+
const npmResult = await K("npm", ["list", "-g", "@openai/codex"], { throwOnError: false });
|
|
602
602
|
if (npmResult.exitCode === 0 && npmResult.stdout.includes("@openai/codex")) {
|
|
603
603
|
return "npm";
|
|
604
604
|
}
|
|
@@ -608,35 +608,35 @@ async function detectCodexInstallMethod() {
|
|
|
608
608
|
}
|
|
609
609
|
async function executeCodexInstallation(isUpdate, skipMethodSelection = false) {
|
|
610
610
|
if (isUpdate) {
|
|
611
|
-
console.log(
|
|
611
|
+
console.log(a.green(i18n.t("codex:updatingCli")));
|
|
612
612
|
const installMethod = await detectCodexInstallMethod();
|
|
613
613
|
if (installMethod === "homebrew") {
|
|
614
|
-
console.log(
|
|
615
|
-
const result = await
|
|
614
|
+
console.log(a.gray(i18n.t("codex:detectedHomebrew")));
|
|
615
|
+
const result = await K("brew", ["upgrade", "--cask", "codex"]);
|
|
616
616
|
if (result.exitCode !== 0) {
|
|
617
617
|
throw new Error(`Failed to update codex via Homebrew: exit code ${result.exitCode}`);
|
|
618
618
|
}
|
|
619
619
|
} else if (installMethod === "npm") {
|
|
620
|
-
console.log(
|
|
620
|
+
console.log(a.gray(i18n.t("codex:detectedNpm")));
|
|
621
621
|
const { command, args, usedSudo } = wrapCommandWithSudo("npm", ["install", "-g", "@openai/codex@latest"]);
|
|
622
622
|
if (usedSudo)
|
|
623
|
-
console.log(
|
|
624
|
-
const result = await
|
|
623
|
+
console.log(a.yellow(i18n.t("codex:usingSudo")));
|
|
624
|
+
const result = await K(command, args);
|
|
625
625
|
if (result.exitCode !== 0) {
|
|
626
626
|
throw new Error(`Failed to update codex CLI: exit code ${result.exitCode}`);
|
|
627
627
|
}
|
|
628
628
|
} else {
|
|
629
|
-
console.log(
|
|
630
|
-
console.log(
|
|
629
|
+
console.log(a.yellow(i18n.t("codex:unknownInstallMethod")));
|
|
630
|
+
console.log(a.gray(i18n.t("codex:fallingBackToNpm")));
|
|
631
631
|
const { command, args, usedSudo } = wrapCommandWithSudo("npm", ["install", "-g", "@openai/codex@latest"]);
|
|
632
632
|
if (usedSudo)
|
|
633
|
-
console.log(
|
|
634
|
-
const result = await
|
|
633
|
+
console.log(a.yellow(i18n.t("codex:usingSudo")));
|
|
634
|
+
const result = await K(command, args);
|
|
635
635
|
if (result.exitCode !== 0) {
|
|
636
636
|
throw new Error(`Failed to update codex CLI: exit code ${result.exitCode}`);
|
|
637
637
|
}
|
|
638
638
|
}
|
|
639
|
-
console.log(
|
|
639
|
+
console.log(a.green(i18n.t("codex:updateSuccess")));
|
|
640
640
|
} else {
|
|
641
641
|
const { installCodex } = await import('./installer.mjs');
|
|
642
642
|
await installCodex(skipMethodSelection);
|
|
@@ -655,7 +655,7 @@ function getUninstallOptions() {
|
|
|
655
655
|
];
|
|
656
656
|
}
|
|
657
657
|
function handleUninstallCancellation() {
|
|
658
|
-
console.log(
|
|
658
|
+
console.log(a.yellow(i18n.t("codex:uninstallCancelled")));
|
|
659
659
|
}
|
|
660
660
|
function createBackupDirectory(timestamp) {
|
|
661
661
|
const backupBaseDir = join(CODEX_DIR, "backup");
|
|
@@ -752,7 +752,7 @@ function migrateEnvKeyToTempEnvKey() {
|
|
|
752
752
|
return false;
|
|
753
753
|
const backupPath = backupCodexConfig();
|
|
754
754
|
if (backupPath) {
|
|
755
|
-
console.log(
|
|
755
|
+
console.log(a.gray(getBackupMessage(backupPath)));
|
|
756
756
|
}
|
|
757
757
|
const migratedContent = migrateEnvKeyInContent(content);
|
|
758
758
|
writeFileAtomic(CODEX_CONFIG_FILE, migratedContent);
|
|
@@ -762,10 +762,10 @@ function migrateEnvKeyToTempEnvKey() {
|
|
|
762
762
|
}
|
|
763
763
|
});
|
|
764
764
|
const message = i18n.isInitialized ? i18n.t("codex:envKeyMigrationComplete") : "\u2714 env_key to temp_env_key migration completed";
|
|
765
|
-
console.log(
|
|
765
|
+
console.log(a.green(message));
|
|
766
766
|
return true;
|
|
767
767
|
} catch (error) {
|
|
768
|
-
console.error(
|
|
768
|
+
console.error(a.yellow(`env_key migration warning: ${error.message}`));
|
|
769
769
|
return false;
|
|
770
770
|
}
|
|
771
771
|
}
|
|
@@ -1145,14 +1145,14 @@ function writeAuthFile(newEntries) {
|
|
|
1145
1145
|
}
|
|
1146
1146
|
async function isCodexInstalled() {
|
|
1147
1147
|
try {
|
|
1148
|
-
const npmResult = await
|
|
1148
|
+
const npmResult = await K("npm", ["list", "-g", "--depth=0"]);
|
|
1149
1149
|
if (npmResult.exitCode === 0 && npmResult.stdout.includes("@openai/codex@")) {
|
|
1150
1150
|
return true;
|
|
1151
1151
|
}
|
|
1152
1152
|
} catch {
|
|
1153
1153
|
}
|
|
1154
1154
|
try {
|
|
1155
|
-
const brewResult = await
|
|
1155
|
+
const brewResult = await K("brew", ["list", "--cask", "codex"], { throwOnError: false });
|
|
1156
1156
|
if (brewResult.exitCode === 0) {
|
|
1157
1157
|
return true;
|
|
1158
1158
|
}
|
|
@@ -1162,7 +1162,7 @@ async function isCodexInstalled() {
|
|
|
1162
1162
|
}
|
|
1163
1163
|
async function getCodexVersion() {
|
|
1164
1164
|
try {
|
|
1165
|
-
const npmResult = await
|
|
1165
|
+
const npmResult = await K("npm", ["list", "-g", "--depth=0"]);
|
|
1166
1166
|
if (npmResult.exitCode === 0) {
|
|
1167
1167
|
const match = npmResult.stdout.match(/@openai\/codex@(\S+)/);
|
|
1168
1168
|
if (match) {
|
|
@@ -1172,7 +1172,7 @@ async function getCodexVersion() {
|
|
|
1172
1172
|
} catch {
|
|
1173
1173
|
}
|
|
1174
1174
|
try {
|
|
1175
|
-
const brewResult = await
|
|
1175
|
+
const brewResult = await K("brew", ["info", "--cask", "codex", "--json=v2"], { throwOnError: false });
|
|
1176
1176
|
if (brewResult.exitCode === 0) {
|
|
1177
1177
|
const info = JSON.parse(brewResult.stdout);
|
|
1178
1178
|
if (info.casks && Array.isArray(info.casks) && info.casks.length > 0) {
|
|
@@ -1197,7 +1197,7 @@ async function checkCodexUpdate() {
|
|
|
1197
1197
|
needsUpdate: false
|
|
1198
1198
|
};
|
|
1199
1199
|
}
|
|
1200
|
-
const result = await
|
|
1200
|
+
const result = await K("npm", ["view", "@openai/codex", "--json"]);
|
|
1201
1201
|
if (result.exitCode !== 0) {
|
|
1202
1202
|
return {
|
|
1203
1203
|
installed: true,
|
|
@@ -1216,7 +1216,7 @@ async function checkCodexUpdate() {
|
|
|
1216
1216
|
needsUpdate: false
|
|
1217
1217
|
};
|
|
1218
1218
|
}
|
|
1219
|
-
const needsUpdate =
|
|
1219
|
+
const needsUpdate = semver.gt(latestVersion, currentVersion);
|
|
1220
1220
|
return {
|
|
1221
1221
|
installed: true,
|
|
1222
1222
|
currentVersion,
|
|
@@ -1240,7 +1240,7 @@ async function installCodexCli(skipMethodSelection = false) {
|
|
|
1240
1240
|
await executeCodexInstallation(true, skipMethodSelection);
|
|
1241
1241
|
return;
|
|
1242
1242
|
} else {
|
|
1243
|
-
console.log(
|
|
1243
|
+
console.log(a.yellow(i18n.t("codex:alreadyInstalled")));
|
|
1244
1244
|
return;
|
|
1245
1245
|
}
|
|
1246
1246
|
}
|
|
@@ -1261,7 +1261,7 @@ async function runCodexWorkflowImportWithLanguageSelection(options) {
|
|
|
1261
1261
|
await runCodexSystemPromptSelection(skipPrompt);
|
|
1262
1262
|
ensureCodexAgentsLanguageDirective(aiOutputLang);
|
|
1263
1263
|
await runCodexWorkflowSelection(options);
|
|
1264
|
-
console.log(
|
|
1264
|
+
console.log(a.green(i18n.t("codex:workflowInstall")));
|
|
1265
1265
|
return aiOutputLang;
|
|
1266
1266
|
}
|
|
1267
1267
|
async function runCodexSystemPromptSelection(skipPrompt = false) {
|
|
@@ -1319,7 +1319,7 @@ async function runCodexSystemPromptSelection(skipPrompt = false) {
|
|
|
1319
1319
|
ensureDir(CODEX_DIR);
|
|
1320
1320
|
const backupPath = backupCodexAgents();
|
|
1321
1321
|
if (backupPath) {
|
|
1322
|
-
console.log(
|
|
1322
|
+
console.log(a.gray(getBackupMessage(backupPath)));
|
|
1323
1323
|
}
|
|
1324
1324
|
writeFileAtomic(CODEX_AGENTS_FILE, content);
|
|
1325
1325
|
try {
|
|
@@ -1355,7 +1355,7 @@ async function runCodexWorkflowSelection(options) {
|
|
|
1355
1355
|
ensureDir(CODEX_PROMPTS_DIR);
|
|
1356
1356
|
const backupPath2 = backupCodexPrompts();
|
|
1357
1357
|
if (backupPath2) {
|
|
1358
|
-
console.log(
|
|
1358
|
+
console.log(a.gray(getBackupMessage(backupPath2)));
|
|
1359
1359
|
}
|
|
1360
1360
|
let workflowsToInstall;
|
|
1361
1361
|
if (presetWorkflows.length > 0) {
|
|
@@ -1390,7 +1390,7 @@ async function runCodexWorkflowSelection(options) {
|
|
|
1390
1390
|
ensureDir(CODEX_PROMPTS_DIR);
|
|
1391
1391
|
const backupPath = backupCodexPrompts();
|
|
1392
1392
|
if (backupPath) {
|
|
1393
|
-
console.log(
|
|
1393
|
+
console.log(a.gray(getBackupMessage(backupPath)));
|
|
1394
1394
|
}
|
|
1395
1395
|
const finalWorkflowPaths = expandSelectedWorkflowPaths(workflows, workflowSrc, preferredLang);
|
|
1396
1396
|
for (const workflowPath of finalWorkflowPaths) {
|
|
@@ -1454,13 +1454,13 @@ function createApiConfigChoices(providers, currentProvider, isCommented) {
|
|
|
1454
1454
|
const choices = [];
|
|
1455
1455
|
const isOfficialMode = !currentProvider || isCommented;
|
|
1456
1456
|
choices.push({
|
|
1457
|
-
name: isOfficialMode ? `${
|
|
1457
|
+
name: isOfficialMode ? `${a.green("\u25CF ")}${i18n.t("codex:useOfficialLogin")} ${a.yellow("(\u5F53\u524D)")}` : ` ${i18n.t("codex:useOfficialLogin")}`,
|
|
1458
1458
|
value: "official"
|
|
1459
1459
|
});
|
|
1460
1460
|
providers.forEach((provider) => {
|
|
1461
1461
|
const isCurrent = currentProvider === provider.id && !isCommented;
|
|
1462
1462
|
choices.push({
|
|
1463
|
-
name: isCurrent ? `${
|
|
1463
|
+
name: isCurrent ? `${a.green("\u25CF ")}${provider.name} - ${a.gray(provider.id)} ${a.yellow("(\u5F53\u524D)")}` : ` ${provider.name} - ${a.gray(provider.id)}`,
|
|
1464
1464
|
value: provider.id
|
|
1465
1465
|
});
|
|
1466
1466
|
});
|
|
@@ -1470,7 +1470,7 @@ async function applyCustomApiConfig(customApiConfig) {
|
|
|
1470
1470
|
const { type, token, baseUrl, model } = customApiConfig;
|
|
1471
1471
|
const backupPath = backupCodexComplete();
|
|
1472
1472
|
if (backupPath) {
|
|
1473
|
-
console.log(
|
|
1473
|
+
console.log(a.gray(getBackupMessage(backupPath)));
|
|
1474
1474
|
}
|
|
1475
1475
|
const existingConfig = readCodexConfig();
|
|
1476
1476
|
const existingAuth = readJsonConfig(CODEX_AUTH_FILE, { defaultValue: {} }) || {};
|
|
@@ -1507,7 +1507,7 @@ async function applyCustomApiConfig(customApiConfig) {
|
|
|
1507
1507
|
writeCodexConfig(configData);
|
|
1508
1508
|
writeJsonConfig(CODEX_AUTH_FILE, authEntries);
|
|
1509
1509
|
updateZcfConfig({ codeToolType: "codex" });
|
|
1510
|
-
console.log(
|
|
1510
|
+
console.log(a.green(`\u2714 ${i18n.t("codex:apiConfigured")}`));
|
|
1511
1511
|
}
|
|
1512
1512
|
async function configureCodexApi(options) {
|
|
1513
1513
|
ensureI18nInitialized();
|
|
@@ -1546,7 +1546,7 @@ async function configureCodexApi(options) {
|
|
|
1546
1546
|
default: "custom"
|
|
1547
1547
|
}]);
|
|
1548
1548
|
if (!mode) {
|
|
1549
|
-
console.log(
|
|
1549
|
+
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
1550
1550
|
return;
|
|
1551
1551
|
}
|
|
1552
1552
|
if (mode === "official") {
|
|
@@ -1558,7 +1558,7 @@ async function configureCodexApi(options) {
|
|
|
1558
1558
|
}
|
|
1559
1559
|
if (mode === "switch") {
|
|
1560
1560
|
if (!hasProviders) {
|
|
1561
|
-
console.log(
|
|
1561
|
+
console.log(a.yellow(i18n.t("codex:noProvidersAvailable")));
|
|
1562
1562
|
return;
|
|
1563
1563
|
}
|
|
1564
1564
|
const currentProvider = existingConfig?.modelProvider;
|
|
@@ -1571,7 +1571,7 @@ async function configureCodexApi(options) {
|
|
|
1571
1571
|
choices: addNumbersToChoices(choices)
|
|
1572
1572
|
}]);
|
|
1573
1573
|
if (!selectedConfig) {
|
|
1574
|
-
console.log(
|
|
1574
|
+
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
1575
1575
|
return;
|
|
1576
1576
|
}
|
|
1577
1577
|
let success = false;
|
|
@@ -1593,7 +1593,7 @@ async function configureCodexApi(options) {
|
|
|
1593
1593
|
}
|
|
1594
1594
|
const backupPath = backupCodexComplete();
|
|
1595
1595
|
if (backupPath) {
|
|
1596
|
-
console.log(
|
|
1596
|
+
console.log(a.gray(getBackupMessage(backupPath)));
|
|
1597
1597
|
}
|
|
1598
1598
|
const providers = [];
|
|
1599
1599
|
const authEntries = {};
|
|
@@ -1624,7 +1624,7 @@ async function configureCodexApi(options) {
|
|
|
1624
1624
|
prefilledBaseUrl = provider.codex.baseUrl;
|
|
1625
1625
|
prefilledWireApi = provider.codex.wireApi;
|
|
1626
1626
|
prefilledModel = provider.codex.defaultModel;
|
|
1627
|
-
console.log(
|
|
1627
|
+
console.log(a.gray(i18n.t("api:providerSelected", { name: provider.name })));
|
|
1628
1628
|
}
|
|
1629
1629
|
}
|
|
1630
1630
|
const answers = await inquirer.prompt([
|
|
@@ -1696,7 +1696,7 @@ async function configureCodexApi(options) {
|
|
|
1696
1696
|
defaultValue: false
|
|
1697
1697
|
});
|
|
1698
1698
|
if (!shouldOverwrite) {
|
|
1699
|
-
console.log(
|
|
1699
|
+
console.log(a.yellow(i18n.t("codex:providerDuplicateSkipped")));
|
|
1700
1700
|
continue;
|
|
1701
1701
|
}
|
|
1702
1702
|
if (sessionProvider) {
|
|
@@ -1727,7 +1727,7 @@ async function configureCodexApi(options) {
|
|
|
1727
1727
|
addMore = addAnother;
|
|
1728
1728
|
}
|
|
1729
1729
|
if (providers.length === 0) {
|
|
1730
|
-
console.log(
|
|
1730
|
+
console.log(a.yellow(i18n.t("codex:noProvidersConfigured")));
|
|
1731
1731
|
return;
|
|
1732
1732
|
}
|
|
1733
1733
|
const { defaultProvider } = await inquirer.prompt([{
|
|
@@ -1753,7 +1753,7 @@ async function configureCodexApi(options) {
|
|
|
1753
1753
|
});
|
|
1754
1754
|
writeAuthFile(authEntries);
|
|
1755
1755
|
updateZcfConfig({ codeToolType: "codex" });
|
|
1756
|
-
console.log(
|
|
1756
|
+
console.log(a.green(i18n.t("codex:apiConfigured")));
|
|
1757
1757
|
}
|
|
1758
1758
|
async function runCodexFullInit(options) {
|
|
1759
1759
|
ensureI18nInitialized();
|
|
@@ -1780,9 +1780,9 @@ function ensureCodexAgentsLanguageDirective(aiOutputLang) {
|
|
|
1780
1780
|
`;
|
|
1781
1781
|
const backupPath = backupCodexAgents();
|
|
1782
1782
|
if (backupPath)
|
|
1783
|
-
console.log(
|
|
1783
|
+
console.log(a.gray(getBackupMessage(backupPath)));
|
|
1784
1784
|
writeFileAtomic(CODEX_AGENTS_FILE, updatedContent);
|
|
1785
|
-
console.log(
|
|
1785
|
+
console.log(a.gray(` ${i18n.t("configuration:addedLanguageDirective")}: ${targetLabel}`));
|
|
1786
1786
|
}
|
|
1787
1787
|
function resolveCodexLanguageLabel(aiOutputLang) {
|
|
1788
1788
|
const directive = AI_OUTPUT_LANGUAGES[aiOutputLang]?.directive;
|
|
@@ -1800,7 +1800,7 @@ function normalizeLanguageLabel(label) {
|
|
|
1800
1800
|
}
|
|
1801
1801
|
async function runCodexUpdate(force = false, skipPrompt = false) {
|
|
1802
1802
|
ensureI18nInitialized();
|
|
1803
|
-
console.log(
|
|
1803
|
+
console.log(a.bold.cyan(`
|
|
1804
1804
|
\u{1F50D} ${i18n.t("updater:checkingTools")}
|
|
1805
1805
|
`));
|
|
1806
1806
|
const spinner = ora(i18n.t("updater:checkingVersion")).start();
|
|
@@ -1808,30 +1808,30 @@ async function runCodexUpdate(force = false, skipPrompt = false) {
|
|
|
1808
1808
|
const { installed, currentVersion, latestVersion, needsUpdate } = await checkCodexUpdate();
|
|
1809
1809
|
spinner.stop();
|
|
1810
1810
|
if (!installed) {
|
|
1811
|
-
console.log(
|
|
1811
|
+
console.log(a.yellow(i18n.t("codex:notInstalled")));
|
|
1812
1812
|
return false;
|
|
1813
1813
|
}
|
|
1814
1814
|
if (!needsUpdate && !force) {
|
|
1815
|
-
console.log(
|
|
1815
|
+
console.log(a.green(format(i18n.t("codex:upToDate"), { version: currentVersion || "" })));
|
|
1816
1816
|
return true;
|
|
1817
1817
|
}
|
|
1818
1818
|
if (!latestVersion) {
|
|
1819
|
-
console.log(
|
|
1819
|
+
console.log(a.yellow(i18n.t("codex:cannotCheckVersion")));
|
|
1820
1820
|
return false;
|
|
1821
1821
|
}
|
|
1822
|
-
console.log(
|
|
1823
|
-
console.log(
|
|
1822
|
+
console.log(a.green(format(i18n.t("codex:currentVersion"), { version: currentVersion || "" })));
|
|
1823
|
+
console.log(a.green(format(i18n.t("codex:latestVersion"), { version: latestVersion })));
|
|
1824
1824
|
if (!skipPrompt) {
|
|
1825
1825
|
const confirm = await promptBoolean({
|
|
1826
1826
|
message: i18n.t("codex:confirmUpdate"),
|
|
1827
1827
|
defaultValue: true
|
|
1828
1828
|
});
|
|
1829
1829
|
if (!confirm) {
|
|
1830
|
-
console.log(
|
|
1830
|
+
console.log(a.gray(i18n.t("codex:updateSkipped")));
|
|
1831
1831
|
return true;
|
|
1832
1832
|
}
|
|
1833
1833
|
} else {
|
|
1834
|
-
console.log(
|
|
1834
|
+
console.log(a.green(i18n.t("codex:autoUpdating")));
|
|
1835
1835
|
}
|
|
1836
1836
|
const updateSpinner = ora(i18n.t("codex:updating")).start();
|
|
1837
1837
|
try {
|
|
@@ -1840,12 +1840,12 @@ async function runCodexUpdate(force = false, skipPrompt = false) {
|
|
|
1840
1840
|
return true;
|
|
1841
1841
|
} catch (error) {
|
|
1842
1842
|
updateSpinner.fail(i18n.t("codex:updateFailed"));
|
|
1843
|
-
console.error(
|
|
1843
|
+
console.error(a.red(error instanceof Error ? error.message : String(error)));
|
|
1844
1844
|
return false;
|
|
1845
1845
|
}
|
|
1846
1846
|
} catch (error) {
|
|
1847
1847
|
spinner.fail(i18n.t("codex:checkFailed"));
|
|
1848
|
-
console.error(
|
|
1848
|
+
console.error(a.red(error instanceof Error ? error.message : String(error)));
|
|
1849
1849
|
return false;
|
|
1850
1850
|
}
|
|
1851
1851
|
}
|
|
@@ -1896,25 +1896,25 @@ async function runCodexUninstall() {
|
|
|
1896
1896
|
const results = await uninstaller.customUninstall(items);
|
|
1897
1897
|
displayUninstallResults(results);
|
|
1898
1898
|
}
|
|
1899
|
-
console.log(
|
|
1899
|
+
console.log(a.green(i18n.t("codex:uninstallSuccess")));
|
|
1900
1900
|
} catch (error) {
|
|
1901
|
-
console.error(
|
|
1901
|
+
console.error(a.red(i18n.t("codex:errorDuringUninstall", { error: error.message })));
|
|
1902
1902
|
throw error;
|
|
1903
1903
|
}
|
|
1904
1904
|
}
|
|
1905
1905
|
function displayUninstallResults(results) {
|
|
1906
1906
|
for (const result of results) {
|
|
1907
1907
|
for (const item of result.removed) {
|
|
1908
|
-
console.log(
|
|
1908
|
+
console.log(a.green(`\u2714 ${i18n.t("codex:removedItem", { item })}`));
|
|
1909
1909
|
}
|
|
1910
1910
|
for (const config of result.removedConfigs) {
|
|
1911
|
-
console.log(
|
|
1911
|
+
console.log(a.green(`\u2714 ${i18n.t("codex:removedConfig", { config })}`));
|
|
1912
1912
|
}
|
|
1913
1913
|
for (const warning of result.warnings) {
|
|
1914
|
-
console.log(
|
|
1914
|
+
console.log(a.yellow(`\u26A0\uFE0F ${warning}`));
|
|
1915
1915
|
}
|
|
1916
1916
|
for (const error of result.errors) {
|
|
1917
|
-
console.log(
|
|
1917
|
+
console.log(a.red(`\u274C ${error}`));
|
|
1918
1918
|
}
|
|
1919
1919
|
}
|
|
1920
1920
|
}
|
|
@@ -1926,17 +1926,17 @@ async function switchCodexProvider(providerId) {
|
|
|
1926
1926
|
ensureI18nInitialized();
|
|
1927
1927
|
const existingConfig = readCodexConfig();
|
|
1928
1928
|
if (!existingConfig) {
|
|
1929
|
-
console.log(
|
|
1929
|
+
console.log(a.red(i18n.t("codex:configNotFound")));
|
|
1930
1930
|
return false;
|
|
1931
1931
|
}
|
|
1932
1932
|
const providerExists = existingConfig.providers.some((provider) => provider.id === providerId);
|
|
1933
1933
|
if (!providerExists) {
|
|
1934
|
-
console.log(
|
|
1934
|
+
console.log(a.red(i18n.t("codex:providerNotFound", { provider: providerId })));
|
|
1935
1935
|
return false;
|
|
1936
1936
|
}
|
|
1937
1937
|
const backupPath = backupCodexComplete();
|
|
1938
1938
|
if (backupPath) {
|
|
1939
|
-
console.log(
|
|
1939
|
+
console.log(a.gray(getBackupMessage(backupPath)));
|
|
1940
1940
|
}
|
|
1941
1941
|
const updatedConfig = {
|
|
1942
1942
|
...existingConfig,
|
|
@@ -1944,10 +1944,10 @@ async function switchCodexProvider(providerId) {
|
|
|
1944
1944
|
};
|
|
1945
1945
|
try {
|
|
1946
1946
|
writeCodexConfig(updatedConfig);
|
|
1947
|
-
console.log(
|
|
1947
|
+
console.log(a.green(i18n.t("codex:providerSwitchSuccess", { provider: providerId })));
|
|
1948
1948
|
return true;
|
|
1949
1949
|
} catch (error) {
|
|
1950
|
-
console.error(
|
|
1950
|
+
console.error(a.red(i18n.t("codex:errorSwitchingProvider", { error: error.message })));
|
|
1951
1951
|
return false;
|
|
1952
1952
|
}
|
|
1953
1953
|
}
|
|
@@ -1955,12 +1955,12 @@ async function switchToOfficialLogin() {
|
|
|
1955
1955
|
ensureI18nInitialized();
|
|
1956
1956
|
const existingConfig = readCodexConfig();
|
|
1957
1957
|
if (!existingConfig) {
|
|
1958
|
-
console.log(
|
|
1958
|
+
console.log(a.red(i18n.t("codex:configNotFound")));
|
|
1959
1959
|
return false;
|
|
1960
1960
|
}
|
|
1961
1961
|
const backupPath = backupCodexComplete();
|
|
1962
1962
|
if (backupPath) {
|
|
1963
|
-
console.log(
|
|
1963
|
+
console.log(a.gray(getBackupMessage(backupPath)));
|
|
1964
1964
|
}
|
|
1965
1965
|
try {
|
|
1966
1966
|
let preservedModelProvider = existingConfig.modelProvider;
|
|
@@ -1983,10 +1983,10 @@ async function switchToOfficialLogin() {
|
|
|
1983
1983
|
const auth = readJsonConfig(CODEX_AUTH_FILE, { defaultValue: {} }) || {};
|
|
1984
1984
|
auth.OPENAI_API_KEY = null;
|
|
1985
1985
|
writeJsonConfig(CODEX_AUTH_FILE, auth, { pretty: true });
|
|
1986
|
-
console.log(
|
|
1986
|
+
console.log(a.green(i18n.t("codex:officialConfigured")));
|
|
1987
1987
|
return true;
|
|
1988
1988
|
} catch (error) {
|
|
1989
|
-
console.error(
|
|
1989
|
+
console.error(a.red(i18n.t("codex:errorSwitchingToOfficialLogin", { error: error.message })));
|
|
1990
1990
|
return false;
|
|
1991
1991
|
}
|
|
1992
1992
|
}
|
|
@@ -1994,17 +1994,17 @@ async function switchToProvider(providerId) {
|
|
|
1994
1994
|
ensureI18nInitialized();
|
|
1995
1995
|
const existingConfig = readCodexConfig();
|
|
1996
1996
|
if (!existingConfig) {
|
|
1997
|
-
console.log(
|
|
1997
|
+
console.log(a.red(i18n.t("codex:configNotFound")));
|
|
1998
1998
|
return false;
|
|
1999
1999
|
}
|
|
2000
2000
|
const provider = existingConfig.providers.find((p) => p.id === providerId);
|
|
2001
2001
|
if (!provider) {
|
|
2002
|
-
console.log(
|
|
2002
|
+
console.log(a.red(i18n.t("codex:providerNotFound", { provider: providerId })));
|
|
2003
2003
|
return false;
|
|
2004
2004
|
}
|
|
2005
2005
|
const backupPath = backupCodexComplete();
|
|
2006
2006
|
if (backupPath) {
|
|
2007
|
-
console.log(
|
|
2007
|
+
console.log(a.gray(getBackupMessage(backupPath)));
|
|
2008
2008
|
}
|
|
2009
2009
|
try {
|
|
2010
2010
|
let targetModel = existingConfig.model;
|
|
@@ -2028,10 +2028,10 @@ async function switchToProvider(providerId) {
|
|
|
2028
2028
|
const envValue = auth[provider.tempEnvKey] || null;
|
|
2029
2029
|
auth.OPENAI_API_KEY = envValue;
|
|
2030
2030
|
writeJsonConfig(CODEX_AUTH_FILE, auth, { pretty: true });
|
|
2031
|
-
console.log(
|
|
2031
|
+
console.log(a.green(i18n.t("codex:providerSwitchSuccess", { provider: providerId })));
|
|
2032
2032
|
return true;
|
|
2033
2033
|
} catch (error) {
|
|
2034
|
-
console.error(
|
|
2034
|
+
console.error(a.red(i18n.t("codex:errorSwitchingProvider", { error: error.message })));
|
|
2035
2035
|
return false;
|
|
2036
2036
|
}
|
|
2037
2037
|
}
|