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/init.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as nodeFs from 'node:fs';
|
|
2
2
|
import { existsSync, copyFileSync, mkdirSync } from 'node:fs';
|
|
3
3
|
import process__default from 'node:process';
|
|
4
|
-
import
|
|
4
|
+
import ansis__default from 'ansis';
|
|
5
5
|
import inquirer from 'inquirer';
|
|
6
6
|
import { version } from './package.mjs';
|
|
7
7
|
import { m as runCodexFullInit, s as selectMcpServices, g as getMcpServices, M as MCP_SERVICE_CONFIGS } from './codex.mjs';
|
|
8
8
|
import { WORKFLOW_CONFIG_BASE } from './workflows.mjs';
|
|
9
9
|
import { SETTINGS_FILE, DEFAULT_CODE_TOOL_TYPE, CODE_TOOL_BANNERS, API_DEFAULT_URL } from './constants.mjs';
|
|
10
10
|
import { ensureI18nInitialized, i18n } from './index2.mjs';
|
|
11
|
-
import {
|
|
11
|
+
import { getBuiltinSkills } from './manager.mjs';
|
|
12
|
+
import { a as displayBannerWithInfo, p as padToDisplayWidth } from '../shared/ccjk.DjD9Rzxq.mjs';
|
|
12
13
|
import { readZcfConfig, updateZcfConfig } from './ccjk-config.mjs';
|
|
13
14
|
import { exec } from 'node:child_process';
|
|
14
15
|
import { homedir } from 'node:os';
|
|
@@ -22,8 +23,8 @@ import { updateCcr, updateClaudeCode } from './auto-updater.mjs';
|
|
|
22
23
|
import { wrapCommandWithSudo, isWindows, findCommandPath, getPlatform, getHomebrewCommandPaths, isTermux, getTermuxPrefix, isWSL, getWSLInfo, commandExists, getRecommendedInstallMethods } from './platform.mjs';
|
|
23
24
|
import { r as resolveCodeType } from '../shared/ccjk.CUdzQluX.mjs';
|
|
24
25
|
import { exists, ensureDir } from './fs-operations.mjs';
|
|
25
|
-
import { m as modifyApiConfigPartially, b as configureApiCompletely, n as needsMigration, a as migrateSettingsForTokenRetrieval, d as displayMigrationResult, p as promptMigration, s as selectAndInstallWorkflows, c as configureOutputStyle, f as formatApiKeyDisplay } from '../shared/ccjk.
|
|
26
|
-
import { a as handleExitPromptError, h as handleGeneralError } from '../shared/ccjk.
|
|
26
|
+
import { m as modifyApiConfigPartially, b as configureApiCompletely, n as needsMigration, a as migrateSettingsForTokenRetrieval, d as displayMigrationResult, p as promptMigration, s as selectAndInstallWorkflows, c as configureOutputStyle, f as formatApiKeyDisplay } from '../shared/ccjk.XgW1H2t3.mjs';
|
|
27
|
+
import { a as handleExitPromptError, h as handleGeneralError } from '../shared/ccjk.BiJujy5w.mjs';
|
|
27
28
|
import ora from 'ora';
|
|
28
29
|
import { exec as exec$1 } from 'tinyexec';
|
|
29
30
|
import { resolveAiOutputLanguage } from './prompts.mjs';
|
|
@@ -196,12 +197,12 @@ async function backupCcrConfig() {
|
|
|
196
197
|
const timestamp = `${dayjs().format("YYYY-MM-DDTHH-mm-ss-SSS")}Z`;
|
|
197
198
|
const backupFileName = `config.json.${timestamp}.bak`;
|
|
198
199
|
const backupPath = join(CCR_BACKUP_DIR, backupFileName);
|
|
199
|
-
console.log(
|
|
200
|
+
console.log(ansis__default.green(`${i18n.t("ccr:backupCcrConfig")}`));
|
|
200
201
|
copyFileSync(CCR_CONFIG_FILE, backupPath);
|
|
201
|
-
console.log(
|
|
202
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("ccr:ccrBackupSuccess").replace("{path}", backupPath)}`));
|
|
202
203
|
return backupPath;
|
|
203
204
|
} catch (error) {
|
|
204
|
-
console.error(
|
|
205
|
+
console.error(ansis__default.red(`${i18n.t("ccr:ccrBackupFailed")}:`), error.message);
|
|
205
206
|
return null;
|
|
206
207
|
}
|
|
207
208
|
}
|
|
@@ -236,10 +237,10 @@ async function configureCcrProxy(ccrConfig) {
|
|
|
236
237
|
}
|
|
237
238
|
async function selectCcrPreset() {
|
|
238
239
|
ensureI18nInitialized();
|
|
239
|
-
console.log(
|
|
240
|
+
console.log(ansis__default.green(`${i18n.t("ccr:fetchingPresets")}`));
|
|
240
241
|
const presets = await fetchProviderPresets();
|
|
241
242
|
if (!presets || presets.length === 0) {
|
|
242
|
-
console.log(
|
|
243
|
+
console.log(ansis__default.yellow(`${i18n.t("ccr:noPresetsAvailable")}`));
|
|
243
244
|
return null;
|
|
244
245
|
}
|
|
245
246
|
try {
|
|
@@ -262,7 +263,7 @@ async function selectCcrPreset() {
|
|
|
262
263
|
return preset;
|
|
263
264
|
} catch (error) {
|
|
264
265
|
if (error.name === "ExitPromptError") {
|
|
265
|
-
console.log(
|
|
266
|
+
console.log(ansis__default.yellow(i18n.t("common:cancelled")));
|
|
266
267
|
return null;
|
|
267
268
|
}
|
|
268
269
|
throw error;
|
|
@@ -344,14 +345,14 @@ async function configureCcrWithPreset(preset) {
|
|
|
344
345
|
async function restartAndCheckCcrStatus() {
|
|
345
346
|
ensureI18nInitialized();
|
|
346
347
|
try {
|
|
347
|
-
console.log(
|
|
348
|
+
console.log(ansis__default.green(`${i18n.t("ccr:restartingCcr")}`));
|
|
348
349
|
await execAsync$3("ccr restart");
|
|
349
|
-
console.log(
|
|
350
|
-
console.log(
|
|
350
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("ccr:ccrRestartSuccess")}`));
|
|
351
|
+
console.log(ansis__default.green(`${i18n.t("ccr:checkingCcrStatus")}`));
|
|
351
352
|
const { stdout } = await execAsync$3("ccr status");
|
|
352
|
-
console.log(
|
|
353
|
+
console.log(ansis__default.gray(stdout));
|
|
353
354
|
} catch (error) {
|
|
354
|
-
console.error(
|
|
355
|
+
console.error(ansis__default.red(`${i18n.t("ccr:ccrRestartFailed")}:`), error.message || error);
|
|
355
356
|
if (process__default.env.DEBUG) {
|
|
356
357
|
console.error("Full error:", error);
|
|
357
358
|
}
|
|
@@ -359,14 +360,14 @@ async function restartAndCheckCcrStatus() {
|
|
|
359
360
|
}
|
|
360
361
|
async function showConfigurationTips(apiKey) {
|
|
361
362
|
ensureI18nInitialized();
|
|
362
|
-
console.log(
|
|
363
|
+
console.log(ansis__default.bold.cyan(`
|
|
363
364
|
\u{1F4CC} ${i18n.t("ccr:configTips")}:`));
|
|
364
|
-
console.log(
|
|
365
|
-
console.log(
|
|
366
|
-
console.log(
|
|
365
|
+
console.log(ansis__default.green(` \u2022 ${i18n.t("ccr:advancedConfigTip")}`));
|
|
366
|
+
console.log(ansis__default.green(` \u2022 ${i18n.t("ccr:manualConfigTip")}`));
|
|
367
|
+
console.log(ansis__default.bold.yellow(` \u2022 ${i18n.t("ccr:useClaudeCommand")}`));
|
|
367
368
|
if (apiKey) {
|
|
368
|
-
console.log(
|
|
369
|
-
console.log(
|
|
369
|
+
console.log(ansis__default.bold.green(` \u2022 ${i18n.t("ccr:ccrUiApiKey") || "CCR UI API Key"}: ${apiKey}`));
|
|
370
|
+
console.log(ansis__default.gray(` ${i18n.t("ccr:ccrUiApiKeyHint") || "Use this API key to login to CCR UI"}`));
|
|
370
371
|
}
|
|
371
372
|
console.log("");
|
|
372
373
|
}
|
|
@@ -391,7 +392,7 @@ async function setupCcrConfiguration() {
|
|
|
391
392
|
try {
|
|
392
393
|
const existingConfig = readCcrConfig();
|
|
393
394
|
if (existingConfig) {
|
|
394
|
-
console.log(
|
|
395
|
+
console.log(ansis__default.green(`\u2139 ${i18n.t("ccr:existingCcrConfig")}`));
|
|
395
396
|
let shouldBackupAndReconfigure = false;
|
|
396
397
|
try {
|
|
397
398
|
shouldBackupAndReconfigure = await promptBoolean({
|
|
@@ -400,21 +401,21 @@ async function setupCcrConfiguration() {
|
|
|
400
401
|
});
|
|
401
402
|
} catch (error) {
|
|
402
403
|
if (error.name === "ExitPromptError") {
|
|
403
|
-
console.log(
|
|
404
|
+
console.log(ansis__default.yellow(i18n.t("common:cancelled")));
|
|
404
405
|
return false;
|
|
405
406
|
}
|
|
406
407
|
throw error;
|
|
407
408
|
}
|
|
408
409
|
if (!shouldBackupAndReconfigure) {
|
|
409
|
-
console.log(
|
|
410
|
+
console.log(ansis__default.yellow(`${i18n.t("ccr:keepingExistingConfig")}`));
|
|
410
411
|
await configureCcrProxy(existingConfig);
|
|
411
412
|
try {
|
|
412
413
|
const { manageApiKeyApproval } = await import('./config.mjs').then(function (n) { return n.C; });
|
|
413
414
|
const apiKey = existingConfig.APIKEY || "sk-ccjk-x-ccr";
|
|
414
415
|
manageApiKeyApproval(apiKey);
|
|
415
|
-
console.log(
|
|
416
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("ccr:apiKeyApprovalSuccess")}`));
|
|
416
417
|
} catch (error) {
|
|
417
|
-
console.error(
|
|
418
|
+
console.error(ansis__default.red(`${i18n.t("ccr:apiKeyApprovalFailed")}:`), error);
|
|
418
419
|
}
|
|
419
420
|
return true;
|
|
420
421
|
}
|
|
@@ -426,37 +427,37 @@ async function setupCcrConfiguration() {
|
|
|
426
427
|
}
|
|
427
428
|
let config;
|
|
428
429
|
if (preset === "skip") {
|
|
429
|
-
console.log(
|
|
430
|
+
console.log(ansis__default.yellow(`${i18n.t("ccr:skipConfiguring")}`));
|
|
430
431
|
config = createDefaultCcrConfig();
|
|
431
432
|
} else {
|
|
432
433
|
config = await configureCcrWithPreset(preset);
|
|
433
434
|
}
|
|
434
435
|
writeCcrConfig(config);
|
|
435
|
-
console.log(
|
|
436
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("ccr:ccrConfigSuccess")}`));
|
|
436
437
|
await configureCcrProxy(config);
|
|
437
|
-
console.log(
|
|
438
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("ccr:proxyConfigSuccess")}`));
|
|
438
439
|
await restartAndCheckCcrStatus();
|
|
439
440
|
await showConfigurationTips(config.APIKEY);
|
|
440
441
|
try {
|
|
441
442
|
addCompletedOnboarding();
|
|
442
443
|
} catch (error) {
|
|
443
|
-
console.error(
|
|
444
|
+
console.error(ansis__default.red(i18n.t("errors:failedToSetOnboarding")), error);
|
|
444
445
|
}
|
|
445
446
|
try {
|
|
446
447
|
const { manageApiKeyApproval } = await import('./config.mjs').then(function (n) { return n.C; });
|
|
447
448
|
const apiKey = config.APIKEY || "sk-ccjk-x-ccr";
|
|
448
449
|
manageApiKeyApproval(apiKey);
|
|
449
|
-
console.log(
|
|
450
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("ccr:apiKeyApprovalSuccess")}`));
|
|
450
451
|
} catch (error) {
|
|
451
|
-
console.error(
|
|
452
|
+
console.error(ansis__default.red(`${i18n.t("ccr:apiKeyApprovalFailed")}:`), error);
|
|
452
453
|
}
|
|
453
454
|
return true;
|
|
454
455
|
} catch (error) {
|
|
455
456
|
if (error.name === "ExitPromptError") {
|
|
456
|
-
console.log(
|
|
457
|
+
console.log(ansis__default.yellow(i18n.t("common:cancelled")));
|
|
457
458
|
return false;
|
|
458
459
|
}
|
|
459
|
-
console.error(
|
|
460
|
+
console.error(ansis__default.red(`${i18n.t("ccr:ccrConfigFailed")}:`), error);
|
|
460
461
|
return false;
|
|
461
462
|
}
|
|
462
463
|
}
|
|
@@ -464,7 +465,7 @@ async function configureCcrFeature() {
|
|
|
464
465
|
ensureI18nInitialized();
|
|
465
466
|
const backupDir = backupExistingConfig();
|
|
466
467
|
if (backupDir) {
|
|
467
|
-
console.log(
|
|
468
|
+
console.log(ansis__default.gray(`\u2714 ${i18n.t("configuration:backupSuccess")}: ${backupDir}`));
|
|
468
469
|
}
|
|
469
470
|
await setupCcrConfiguration();
|
|
470
471
|
}
|
|
@@ -515,39 +516,39 @@ async function installCcr() {
|
|
|
515
516
|
ensureI18nInitialized();
|
|
516
517
|
const { isInstalled, hasCorrectPackage } = await isCcrInstalled();
|
|
517
518
|
if (hasCorrectPackage) {
|
|
518
|
-
console.log(
|
|
519
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
|
|
519
520
|
await updateCcr();
|
|
520
521
|
return;
|
|
521
522
|
}
|
|
522
523
|
if (isInstalled && !hasCorrectPackage) {
|
|
523
524
|
try {
|
|
524
525
|
await execAsync$2("npm list -g claude-code-router");
|
|
525
|
-
console.log(
|
|
526
|
+
console.log(ansis__default.yellow(`\u26A0 ${i18n.t("ccr:detectedIncorrectPackage")}`));
|
|
526
527
|
try {
|
|
527
528
|
await execAsync$2("npm uninstall -g claude-code-router");
|
|
528
|
-
console.log(
|
|
529
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("ccr:uninstalledIncorrectPackage")}`));
|
|
529
530
|
} catch {
|
|
530
|
-
console.log(
|
|
531
|
+
console.log(ansis__default.yellow(`\u26A0 ${i18n.t("ccr:failedToUninstallIncorrectPackage")}`));
|
|
531
532
|
}
|
|
532
533
|
} catch {
|
|
533
534
|
}
|
|
534
535
|
}
|
|
535
|
-
console.log(
|
|
536
|
+
console.log(ansis__default.green(`\u{1F4E6} ${i18n.t("ccr:installingCcr")}`));
|
|
536
537
|
try {
|
|
537
538
|
const installArgs = ["install", "-g", "@musistudio/claude-code-router", "--force"];
|
|
538
539
|
const { command, args, usedSudo } = wrapCommandWithSudo("npm", installArgs);
|
|
539
540
|
if (usedSudo) {
|
|
540
|
-
console.log(
|
|
541
|
+
console.log(ansis__default.yellow(`\u2139 ${i18n.t("installation:usingSudo")}`));
|
|
541
542
|
}
|
|
542
543
|
await execAsync$2([command, ...args].join(" "));
|
|
543
|
-
console.log(
|
|
544
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("ccr:ccrInstallSuccess")}`));
|
|
544
545
|
} catch (error) {
|
|
545
546
|
if (error.message?.includes("EEXIST")) {
|
|
546
|
-
console.log(
|
|
547
|
+
console.log(ansis__default.yellow(`\u26A0 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
|
|
547
548
|
await updateCcr();
|
|
548
549
|
return;
|
|
549
550
|
}
|
|
550
|
-
console.error(
|
|
551
|
+
console.error(ansis__default.red(`\u2716 ${i18n.t("ccr:ccrInstallFailed")}`));
|
|
551
552
|
throw error;
|
|
552
553
|
}
|
|
553
554
|
}
|
|
@@ -612,45 +613,45 @@ async function installCometixLine() {
|
|
|
612
613
|
const installArgs = ["install", "-g", COMETIX_PACKAGE_NAME];
|
|
613
614
|
const { command, args, usedSudo } = wrapCommandWithSudo("npm", installArgs);
|
|
614
615
|
if (usedSudo) {
|
|
615
|
-
console.log(
|
|
616
|
+
console.log(ansis__default.yellow(`\u2139 ${i18n.t("installation:usingSudo")}`));
|
|
616
617
|
}
|
|
617
618
|
await execAsync$1([command, ...args].join(" "));
|
|
618
619
|
};
|
|
619
620
|
const isInstalled = await isCometixLineInstalled();
|
|
620
621
|
if (isInstalled) {
|
|
621
|
-
console.log(
|
|
622
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("cometix:cometixAlreadyInstalled")}`));
|
|
622
623
|
try {
|
|
623
|
-
console.log(
|
|
624
|
+
console.log(ansis__default.green(`${i18n.t("cometix:installingOrUpdating")}`));
|
|
624
625
|
await runInstallCommand();
|
|
625
|
-
console.log(
|
|
626
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("cometix:installUpdateSuccess")}`));
|
|
626
627
|
} catch (error) {
|
|
627
|
-
console.log(
|
|
628
|
+
console.log(ansis__default.yellow(`\u26A0 ${i18n.t("cometix:installUpdateFailed")}: ${error}`));
|
|
628
629
|
}
|
|
629
630
|
if (!hasCCometixLineConfig()) {
|
|
630
631
|
try {
|
|
631
632
|
addCCometixLineConfig();
|
|
632
|
-
console.log(
|
|
633
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("cometix:statusLineConfigured") || "Claude Code statusLine configured"}`));
|
|
633
634
|
} catch (error) {
|
|
634
|
-
console.log(
|
|
635
|
+
console.log(ansis__default.yellow(`\u26A0 ${i18n.t("cometix:statusLineConfigFailed") || "Failed to configure statusLine"}: ${error}`));
|
|
635
636
|
}
|
|
636
637
|
} else {
|
|
637
|
-
console.log(
|
|
638
|
+
console.log(ansis__default.green(`\u2139 ${i18n.t("cometix:statusLineAlreadyConfigured") || "Claude Code statusLine already configured"}`));
|
|
638
639
|
}
|
|
639
640
|
return;
|
|
640
641
|
}
|
|
641
642
|
try {
|
|
642
|
-
console.log(
|
|
643
|
+
console.log(ansis__default.green(`${i18n.t("cometix:installingCometix")}`));
|
|
643
644
|
await runInstallCommand();
|
|
644
|
-
console.log(
|
|
645
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("cometix:cometixInstallSuccess")}`));
|
|
645
646
|
try {
|
|
646
647
|
addCCometixLineConfig();
|
|
647
|
-
console.log(
|
|
648
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("cometix:statusLineConfigured") || "Claude Code statusLine configured"}`));
|
|
648
649
|
} catch (configError) {
|
|
649
|
-
console.log(
|
|
650
|
-
console.log(
|
|
650
|
+
console.log(ansis__default.yellow(`\u26A0 ${i18n.t("cometix:statusLineConfigFailed") || "Failed to configure statusLine"}: ${configError}`));
|
|
651
|
+
console.log(ansis__default.green(`\u{1F4A1} ${i18n.t("cometix:statusLineManualConfig") || "Please manually add statusLine configuration to Claude Code settings"}`));
|
|
651
652
|
}
|
|
652
653
|
} catch (error) {
|
|
653
|
-
console.error(
|
|
654
|
+
console.error(ansis__default.red(`\u2717 ${i18n.t("cometix:cometixInstallFailed")}: ${error}`));
|
|
654
655
|
throw error;
|
|
655
656
|
}
|
|
656
657
|
}
|
|
@@ -663,10 +664,10 @@ async function installClaudeCode(skipMethodSelection = false) {
|
|
|
663
664
|
const codeType = "claude-code";
|
|
664
665
|
const installed = await isClaudeCodeInstalled();
|
|
665
666
|
if (installed) {
|
|
666
|
-
console.log(
|
|
667
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("installation:alreadyInstalled")}`));
|
|
667
668
|
const version = await detectInstalledVersion(codeType);
|
|
668
669
|
if (version) {
|
|
669
|
-
console.log(
|
|
670
|
+
console.log(ansis__default.gray(` ${i18n.t("installation:detectedVersion", { version })}`));
|
|
670
671
|
}
|
|
671
672
|
const verification = await verifyInstallation(codeType);
|
|
672
673
|
if (verification.symlinkCreated) {
|
|
@@ -676,27 +677,27 @@ async function installClaudeCode(skipMethodSelection = false) {
|
|
|
676
677
|
return;
|
|
677
678
|
}
|
|
678
679
|
if (isTermux()) {
|
|
679
|
-
console.log(
|
|
680
|
+
console.log(ansis__default.yellow(`\u2139 ${i18n.t("installation:termuxDetected")}`));
|
|
680
681
|
const termuxPrefix = getTermuxPrefix();
|
|
681
|
-
console.log(
|
|
682
|
-
console.log(
|
|
683
|
-
console.log(
|
|
682
|
+
console.log(ansis__default.gray(i18n.t("installation:termuxPathInfo", { path: termuxPrefix })));
|
|
683
|
+
console.log(ansis__default.gray(`Node.js: ${termuxPrefix}/bin/node`));
|
|
684
|
+
console.log(ansis__default.gray(`npm: ${termuxPrefix}/bin/npm`));
|
|
684
685
|
}
|
|
685
686
|
if (isWSL()) {
|
|
686
687
|
const wslInfo = getWSLInfo();
|
|
687
688
|
if (wslInfo?.distro) {
|
|
688
|
-
console.log(
|
|
689
|
+
console.log(ansis__default.yellow(`\u2139 ${i18n.t("installation:wslDetected", { distro: wslInfo.distro })}`));
|
|
689
690
|
} else {
|
|
690
|
-
console.log(
|
|
691
|
+
console.log(ansis__default.yellow(`\u2139 ${i18n.t("installation:wslDetectedGeneric")}`));
|
|
691
692
|
}
|
|
692
|
-
console.log(
|
|
693
|
+
console.log(ansis__default.gray(i18n.t("installation:wslPathInfo", { path: `${homedir()}/.claude/` })));
|
|
693
694
|
}
|
|
694
695
|
if (skipMethodSelection) {
|
|
695
696
|
console.log(i18n.t("installation:installing"));
|
|
696
697
|
try {
|
|
697
698
|
const { command, args, usedSudo } = wrapCommandWithSudo("npm", ["install", "-g", "@anthropic-ai/claude-code", "--force"]);
|
|
698
699
|
if (usedSudo) {
|
|
699
|
-
console.log(
|
|
700
|
+
console.log(ansis__default.yellow(`\u2139 ${i18n.t("installation:usingSudo")}`));
|
|
700
701
|
}
|
|
701
702
|
await exec$1(command, args);
|
|
702
703
|
console.log(`\u2714 ${i18n.t("installation:installSuccess")}`);
|
|
@@ -704,17 +705,17 @@ async function installClaudeCode(skipMethodSelection = false) {
|
|
|
704
705
|
const verification = await verifyInstallation(codeType);
|
|
705
706
|
displayVerificationResult(verification, codeType);
|
|
706
707
|
if (isTermux()) {
|
|
707
|
-
console.log(
|
|
708
|
+
console.log(ansis__default.gray(`
|
|
708
709
|
Claude Code installed to: ${getTermuxPrefix()}/bin/claude`));
|
|
709
710
|
}
|
|
710
711
|
if (isWSL()) {
|
|
711
|
-
console.log(
|
|
712
|
+
console.log(ansis__default.gray(`
|
|
712
713
|
${i18n.t("installation:wslInstallSuccess")}`));
|
|
713
714
|
}
|
|
714
715
|
} catch (error) {
|
|
715
716
|
console.error(`\u2716 ${i18n.t("installation:installFailed")}`);
|
|
716
717
|
if (isTermux()) {
|
|
717
|
-
console.error(
|
|
718
|
+
console.error(ansis__default.yellow(`
|
|
718
719
|
${i18n.t("installation:termuxInstallHint")}
|
|
719
720
|
`));
|
|
720
721
|
}
|
|
@@ -724,23 +725,23 @@ ${i18n.t("installation:termuxInstallHint")}
|
|
|
724
725
|
}
|
|
725
726
|
const method = await selectInstallMethod(codeType);
|
|
726
727
|
if (!method) {
|
|
727
|
-
console.log(
|
|
728
|
+
console.log(ansis__default.yellow(i18n.t("common:cancelled")));
|
|
728
729
|
return;
|
|
729
730
|
}
|
|
730
731
|
const success = await executeInstallMethod(method, codeType);
|
|
731
732
|
if (!success) {
|
|
732
733
|
const retrySuccess = await handleInstallFailure(codeType, [method]);
|
|
733
734
|
if (!retrySuccess) {
|
|
734
|
-
console.error(
|
|
735
|
+
console.error(ansis__default.red(`\u2716 ${i18n.t("installation:installFailed")}`));
|
|
735
736
|
throw new Error(i18n.t("installation:installFailed"));
|
|
736
737
|
}
|
|
737
738
|
}
|
|
738
739
|
if (isTermux()) {
|
|
739
|
-
console.log(
|
|
740
|
+
console.log(ansis__default.gray(`
|
|
740
741
|
Claude Code installed to: ${getTermuxPrefix()}/bin/claude`));
|
|
741
742
|
}
|
|
742
743
|
if (isWSL()) {
|
|
743
|
-
console.log(
|
|
744
|
+
console.log(ansis__default.gray(`
|
|
744
745
|
${i18n.t("installation:wslInstallSuccess")}`));
|
|
745
746
|
}
|
|
746
747
|
}
|
|
@@ -753,10 +754,10 @@ async function installCodex(skipMethodSelection = false) {
|
|
|
753
754
|
const codeTypeName = i18n.t("common:codex");
|
|
754
755
|
const installed = await isCodexInstalled();
|
|
755
756
|
if (installed) {
|
|
756
|
-
console.log(
|
|
757
|
+
console.log(ansis__default.green(`\u2714 ${codeTypeName} ${i18n.t("installation:alreadyInstalled")}`));
|
|
757
758
|
const version = await detectInstalledVersion(codeType);
|
|
758
759
|
if (version) {
|
|
759
|
-
console.log(
|
|
760
|
+
console.log(ansis__default.gray(` ${i18n.t("installation:detectedVersion", { version })}`));
|
|
760
761
|
}
|
|
761
762
|
return;
|
|
762
763
|
}
|
|
@@ -765,28 +766,28 @@ async function installCodex(skipMethodSelection = false) {
|
|
|
765
766
|
try {
|
|
766
767
|
const { command, args, usedSudo } = wrapCommandWithSudo("npm", ["install", "-g", "@openai/codex", "--force"]);
|
|
767
768
|
if (usedSudo) {
|
|
768
|
-
console.log(
|
|
769
|
+
console.log(ansis__default.yellow(`\u2139 ${i18n.t("installation:usingSudo")}`));
|
|
769
770
|
}
|
|
770
771
|
await exec$1(command, args);
|
|
771
|
-
console.log(
|
|
772
|
+
console.log(ansis__default.green(`\u2714 ${codeTypeName} ${i18n.t("installation:installSuccess")}`));
|
|
772
773
|
const verification = await verifyInstallation(codeType);
|
|
773
774
|
displayVerificationResult(verification, codeType);
|
|
774
775
|
} catch (error) {
|
|
775
|
-
console.error(
|
|
776
|
+
console.error(ansis__default.red(`\u2716 ${codeTypeName} ${i18n.t("installation:installFailed")}`));
|
|
776
777
|
throw error;
|
|
777
778
|
}
|
|
778
779
|
return;
|
|
779
780
|
}
|
|
780
781
|
const method = await selectInstallMethod(codeType);
|
|
781
782
|
if (!method) {
|
|
782
|
-
console.log(
|
|
783
|
+
console.log(ansis__default.yellow(i18n.t("common:cancelled")));
|
|
783
784
|
return;
|
|
784
785
|
}
|
|
785
786
|
const success = await executeInstallMethod(method, codeType);
|
|
786
787
|
if (!success) {
|
|
787
788
|
const retrySuccess = await handleInstallFailure(codeType, [method]);
|
|
788
789
|
if (!retrySuccess) {
|
|
789
|
-
console.error(
|
|
790
|
+
console.error(ansis__default.red(`\u2716 ${codeTypeName} ${i18n.t("installation:installFailed")}`));
|
|
790
791
|
throw new Error(i18n.t("installation:installFailed"));
|
|
791
792
|
}
|
|
792
793
|
}
|
|
@@ -914,7 +915,7 @@ async function uninstallCodeTool(codeType) {
|
|
|
914
915
|
} catch (error) {
|
|
915
916
|
spinner.fail(i18n.t("installation:uninstallFailed", { method, codeType: codeTypeName }));
|
|
916
917
|
if (error instanceof Error) {
|
|
917
|
-
console.error(
|
|
918
|
+
console.error(ansis__default.gray(error.message));
|
|
918
919
|
}
|
|
919
920
|
return false;
|
|
920
921
|
}
|
|
@@ -981,7 +982,7 @@ function getInstallMethodOptions(codeType, recommendedMethods) {
|
|
|
981
982
|
return availableMethods.map((method) => {
|
|
982
983
|
const isTopRecommended = method === topRecommended;
|
|
983
984
|
const methodLabel = getInstallMethodLabel(method);
|
|
984
|
-
const title = isTopRecommended ? `${methodLabel} ${
|
|
985
|
+
const title = isTopRecommended ? `${methodLabel} ${ansis__default.green(`[${i18n.t("installation:recommendedMethod")}]`)}` : methodLabel;
|
|
985
986
|
return {
|
|
986
987
|
title,
|
|
987
988
|
value: method
|
|
@@ -994,7 +995,7 @@ async function selectInstallMethod(codeType, excludeMethods = []) {
|
|
|
994
995
|
const recommendedMethods = getRecommendedInstallMethods(codeType);
|
|
995
996
|
const methodOptions = getInstallMethodOptions(codeType, recommendedMethods).filter((option) => !excludeMethods.includes(option.value));
|
|
996
997
|
if (methodOptions.length === 0) {
|
|
997
|
-
console.log(
|
|
998
|
+
console.log(ansis__default.yellow(i18n.t("installation:noMoreMethods")));
|
|
998
999
|
return null;
|
|
999
1000
|
}
|
|
1000
1001
|
const response = await inquirer.prompt({
|
|
@@ -1074,7 +1075,7 @@ async function executeInstallMethod(method, codeType) {
|
|
|
1074
1075
|
} catch (error) {
|
|
1075
1076
|
spinner.fail(i18n.t("installation:installMethodFailed", { method }));
|
|
1076
1077
|
if (error instanceof Error) {
|
|
1077
|
-
console.error(
|
|
1078
|
+
console.error(ansis__default.gray(error.message));
|
|
1078
1079
|
}
|
|
1079
1080
|
return false;
|
|
1080
1081
|
}
|
|
@@ -1283,33 +1284,33 @@ function displayVerificationResult(result, codeType) {
|
|
|
1283
1284
|
const codeTypeName = codeType === "claude-code" ? i18n.t("common:claudeCode") : i18n.t("common:codex");
|
|
1284
1285
|
if (result.success) {
|
|
1285
1286
|
if (result.symlinkCreated) {
|
|
1286
|
-
console.log(
|
|
1287
|
-
console.log(
|
|
1287
|
+
console.log(ansis__default.green(`\u2714 ${codeTypeName} ${i18n.t("installation:verificationSuccess")}`));
|
|
1288
|
+
console.log(ansis__default.gray(` ${i18n.t("installation:symlinkCreated", { path: result.commandPath })}`));
|
|
1288
1289
|
} else if (result.commandPath) {
|
|
1289
|
-
console.log(
|
|
1290
|
-
console.log(
|
|
1290
|
+
console.log(ansis__default.green(`\u2714 ${codeTypeName} ${i18n.t("installation:verificationSuccess")}`));
|
|
1291
|
+
console.log(ansis__default.gray(` ${i18n.t("installation:foundAtPath", { path: result.commandPath })}`));
|
|
1291
1292
|
}
|
|
1292
1293
|
if (result.version) {
|
|
1293
|
-
console.log(
|
|
1294
|
+
console.log(ansis__default.gray(` ${i18n.t("installation:detectedVersion", { version: result.version })}`));
|
|
1294
1295
|
}
|
|
1295
1296
|
if (result.error === "PATH_UPDATE_NEEDED") {
|
|
1296
|
-
console.log(
|
|
1297
|
+
console.log(ansis__default.yellow(`
|
|
1297
1298
|
\u26A0 ${i18n.t("installation:pathUpdateNeeded")}`));
|
|
1298
|
-
console.log(
|
|
1299
|
-
console.log(
|
|
1300
|
-
console.log(
|
|
1301
|
-
console.log(
|
|
1299
|
+
console.log(ansis__default.gray(` ${i18n.t("installation:pathUpdateHint")}`));
|
|
1300
|
+
console.log(ansis__default.green(` export PATH="$HOME/.local/bin:$PATH"`));
|
|
1301
|
+
console.log(ansis__default.gray(` ${i18n.t("installation:pathUpdatePermanent")}`));
|
|
1302
|
+
console.log(ansis__default.green(` echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc`));
|
|
1302
1303
|
}
|
|
1303
1304
|
} else {
|
|
1304
|
-
console.log(
|
|
1305
|
+
console.log(ansis__default.yellow(`\u26A0 ${codeTypeName} ${i18n.t("installation:verificationFailed")}`));
|
|
1305
1306
|
if (result.commandPath) {
|
|
1306
|
-
console.log(
|
|
1307
|
+
console.log(ansis__default.gray(` ${i18n.t("installation:foundAtPath", { path: result.commandPath })}`));
|
|
1307
1308
|
}
|
|
1308
1309
|
if (result.error && result.error !== "PATH_UPDATE_NEEDED") {
|
|
1309
|
-
console.log(
|
|
1310
|
+
console.log(ansis__default.gray(` ${result.error}`));
|
|
1310
1311
|
}
|
|
1311
1312
|
if (result.needsSymlink && !result.symlinkCreated) {
|
|
1312
|
-
console.log(
|
|
1313
|
+
console.log(ansis__default.yellow(` ${i18n.t("installation:manualSymlinkHint")}`));
|
|
1313
1314
|
}
|
|
1314
1315
|
}
|
|
1315
1316
|
}
|
|
@@ -1672,48 +1673,48 @@ async function handleCCMInstallation(options) {
|
|
|
1672
1673
|
const { isCCMSupported, isCCMInstalled, installCCM, getCCMSupportMessage } = await import('./index.mjs');
|
|
1673
1674
|
if (!isCCMSupported()) {
|
|
1674
1675
|
if (!options.skipPrompt) {
|
|
1675
|
-
console.log(
|
|
1676
|
+
console.log(ansis__default.yellow(`
|
|
1676
1677
|
\u2139 ${getCCMSupportMessage()}`));
|
|
1677
1678
|
}
|
|
1678
1679
|
return;
|
|
1679
1680
|
}
|
|
1680
1681
|
const isInstalled = await isCCMInstalled();
|
|
1681
1682
|
if (isInstalled) {
|
|
1682
|
-
console.log(
|
|
1683
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("ccm.alreadyInstalled")}`));
|
|
1683
1684
|
return;
|
|
1684
1685
|
}
|
|
1685
1686
|
let shouldInstall = false;
|
|
1686
1687
|
if (options.skipPrompt) {
|
|
1687
1688
|
shouldInstall = true;
|
|
1688
1689
|
} else {
|
|
1689
|
-
console.log(
|
|
1690
|
+
console.log(ansis__default.green(`
|
|
1690
1691
|
${i18n.t("ccm.menu.title")}`));
|
|
1691
|
-
console.log(
|
|
1692
|
+
console.log(ansis__default.gray(i18n.t("ccm.menu.description")));
|
|
1692
1693
|
shouldInstall = await promptBoolean({
|
|
1693
1694
|
message: i18n.t("ccm.installPrompt"),
|
|
1694
1695
|
defaultValue: true
|
|
1695
1696
|
});
|
|
1696
1697
|
}
|
|
1697
1698
|
if (!shouldInstall) {
|
|
1698
|
-
console.log(
|
|
1699
|
+
console.log(ansis__default.yellow(i18n.t("common:skip")));
|
|
1699
1700
|
return;
|
|
1700
1701
|
}
|
|
1701
1702
|
await installCCM({ silent: options.skipPrompt });
|
|
1702
1703
|
} catch (error) {
|
|
1703
1704
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1704
|
-
console.error(
|
|
1705
|
+
console.error(ansis__default.red(`${i18n.t("ccm.installError")} ${errorMessage}`));
|
|
1705
1706
|
}
|
|
1706
1707
|
}
|
|
1707
1708
|
async function handleSuperpowersInstallation(options) {
|
|
1708
1709
|
try {
|
|
1709
1710
|
const status = await checkSuperpowersInstalled();
|
|
1710
1711
|
if (status.installed) {
|
|
1711
|
-
console.log(
|
|
1712
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("superpowers:alreadyInstalled")}`));
|
|
1712
1713
|
if (status.version) {
|
|
1713
|
-
console.log(
|
|
1714
|
+
console.log(ansis__default.gray(` ${i18n.t("superpowers:status.version", { version: status.version })}`));
|
|
1714
1715
|
}
|
|
1715
1716
|
if (status.skillCount) {
|
|
1716
|
-
console.log(
|
|
1717
|
+
console.log(ansis__default.gray(` ${i18n.t("superpowers:status.skillCount", { count: status.skillCount })}`));
|
|
1717
1718
|
}
|
|
1718
1719
|
return;
|
|
1719
1720
|
}
|
|
@@ -1721,17 +1722,17 @@ async function handleSuperpowersInstallation(options) {
|
|
|
1721
1722
|
if (options.skipPrompt) {
|
|
1722
1723
|
shouldInstall = options.installSuperpowers === true;
|
|
1723
1724
|
} else {
|
|
1724
|
-
console.log(
|
|
1725
|
+
console.log(ansis__default.green(`
|
|
1725
1726
|
${i18n.t("superpowers:title")}`));
|
|
1726
|
-
console.log(
|
|
1727
|
-
console.log(
|
|
1727
|
+
console.log(ansis__default.gray(i18n.t("superpowers:description")));
|
|
1728
|
+
console.log(ansis__default.gray(i18n.t("superpowers:installPromptDescription")));
|
|
1728
1729
|
shouldInstall = await promptBoolean({
|
|
1729
1730
|
message: i18n.t("superpowers:installPrompt"),
|
|
1730
1731
|
defaultValue: false
|
|
1731
1732
|
});
|
|
1732
1733
|
}
|
|
1733
1734
|
if (!shouldInstall) {
|
|
1734
|
-
console.log(
|
|
1735
|
+
console.log(ansis__default.yellow(i18n.t("common:skip")));
|
|
1735
1736
|
return;
|
|
1736
1737
|
}
|
|
1737
1738
|
const result = await installSuperpowers({
|
|
@@ -1739,18 +1740,39 @@ ${i18n.t("superpowers:title")}`));
|
|
|
1739
1740
|
skipPrompt: options.skipPrompt
|
|
1740
1741
|
});
|
|
1741
1742
|
if (result.success) {
|
|
1742
|
-
console.log(
|
|
1743
|
+
console.log(ansis__default.green(`\u2714 ${result.message}`));
|
|
1743
1744
|
} else {
|
|
1744
|
-
console.error(
|
|
1745
|
+
console.error(ansis__default.red(`\u2716 ${result.message}`));
|
|
1745
1746
|
if (result.error) {
|
|
1746
|
-
console.error(
|
|
1747
|
+
console.error(ansis__default.gray(` ${result.error}`));
|
|
1747
1748
|
}
|
|
1748
1749
|
}
|
|
1749
1750
|
} catch (error) {
|
|
1750
1751
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1751
|
-
console.error(
|
|
1752
|
+
console.error(ansis__default.red(`${i18n.t("superpowers:installFailed")}: ${errorMessage}`));
|
|
1752
1753
|
}
|
|
1753
1754
|
}
|
|
1755
|
+
function showValueDrivenWelcome() {
|
|
1756
|
+
const skills = getBuiltinSkills();
|
|
1757
|
+
const dailySkills = skills.slice(0, 3);
|
|
1758
|
+
console.log("");
|
|
1759
|
+
console.log(ansis__default.bold.cyan("\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E"));
|
|
1760
|
+
console.log(ansis__default.bold.cyan("\u2502") + ansis__default.bold.white(" \u{1F4A1} \u7ACB\u5373\u4F53\u9A8C\u5F3A\u5927\u7684 AI \u5F00\u53D1\u80FD\u529B ") + ansis__default.bold.cyan(" \u2502"));
|
|
1761
|
+
console.log(ansis__default.bold.cyan("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524"));
|
|
1762
|
+
dailySkills.forEach((skill) => {
|
|
1763
|
+
const triggers = skill.triggers[0];
|
|
1764
|
+
const name = skill.name["zh-CN"] || skill.name.en || skill.id;
|
|
1765
|
+
const desc = skill.description["zh-CN"] || skill.description.en || "";
|
|
1766
|
+
console.log(`${ansis__default.bold.cyan("\u2502")} ${ansis__default.green(triggers.padEnd(14))} \u2192 ${ansis__default.white(name)}`);
|
|
1767
|
+
if (desc.length < 35) {
|
|
1768
|
+
console.log(`${ansis__default.bold.cyan("\u2502")} ${ansis__default.dim(desc.padEnd(50))} ${ansis__default.bold.cyan("\u2502")}`);
|
|
1769
|
+
}
|
|
1770
|
+
});
|
|
1771
|
+
console.log(ansis__default.bold.cyan("\u2502 \u2502"));
|
|
1772
|
+
console.log(`${ansis__default.bold.cyan("\u2502")} ${ansis__default.yellow("\u66F4\u591A\u529F\u80FD:")} ${ansis__default.dim("ccjk menu")} ${ansis__default.yellow("\u67E5\u770B\u6280\u80FD:")} ${ansis__default.dim("ccjk skills")}${ansis__default.bold.cyan(" \u2502")}`);
|
|
1773
|
+
console.log(ansis__default.bold.cyan("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F"));
|
|
1774
|
+
console.log("");
|
|
1775
|
+
}
|
|
1754
1776
|
async function init(options = {}) {
|
|
1755
1777
|
if (options.skipPrompt) {
|
|
1756
1778
|
await validateSkipPromptOptions(options);
|
|
@@ -1762,7 +1784,7 @@ async function init(options = {}) {
|
|
|
1762
1784
|
codeToolType = await resolveCodeType(options.codeType);
|
|
1763
1785
|
} catch (error) {
|
|
1764
1786
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1765
|
-
console.error(
|
|
1787
|
+
console.error(ansis__default.red(`${i18n.t("errors:generalError")} ${errorMessage}`));
|
|
1766
1788
|
codeToolType = DEFAULT_CODE_TOOL_TYPE;
|
|
1767
1789
|
}
|
|
1768
1790
|
options.codeType = codeToolType;
|
|
@@ -1809,7 +1831,7 @@ async function init(options = {}) {
|
|
|
1809
1831
|
try {
|
|
1810
1832
|
addCompletedOnboarding();
|
|
1811
1833
|
} catch (error) {
|
|
1812
|
-
console.error(
|
|
1834
|
+
console.error(ansis__default.red(i18n.t("errors:failedToSetOnboarding")), error);
|
|
1813
1835
|
}
|
|
1814
1836
|
try {
|
|
1815
1837
|
setPrimaryApiKey();
|
|
@@ -1827,19 +1849,19 @@ async function init(options = {}) {
|
|
|
1827
1849
|
message: i18n.t("api:configureApi"),
|
|
1828
1850
|
choices: [
|
|
1829
1851
|
{
|
|
1830
|
-
name: `${i18n.t("api:useAuthToken")} - ${
|
|
1852
|
+
name: `${i18n.t("api:useAuthToken")} - ${ansis__default.gray(i18n.t("api:authTokenDesc"))}`,
|
|
1831
1853
|
value: "auth_token",
|
|
1832
1854
|
short: i18n.t("api:useAuthToken")
|
|
1833
1855
|
},
|
|
1834
1856
|
{
|
|
1835
|
-
name: `${i18n.t("api:useApiKey")} - ${
|
|
1857
|
+
name: `${i18n.t("api:useApiKey")} - ${ansis__default.gray(i18n.t("api:apiKeyDesc"))}`,
|
|
1836
1858
|
value: "api_key",
|
|
1837
1859
|
short: i18n.t("api:useApiKey")
|
|
1838
1860
|
}
|
|
1839
1861
|
]
|
|
1840
1862
|
});
|
|
1841
1863
|
if (!apiChoice) {
|
|
1842
|
-
console.log(
|
|
1864
|
+
console.log(ansis__default.yellow(i18n.t("common:cancelled")));
|
|
1843
1865
|
process__default.exit(0);
|
|
1844
1866
|
}
|
|
1845
1867
|
return await configureApiCompletely(apiChoice);
|
|
@@ -1849,9 +1871,9 @@ async function init(options = {}) {
|
|
|
1849
1871
|
displayBannerWithInfo(CODE_TOOL_BANNERS[codeToolType] || "CCJK");
|
|
1850
1872
|
}
|
|
1851
1873
|
if (isTermux()) {
|
|
1852
|
-
console.log(
|
|
1874
|
+
console.log(ansis__default.yellow(`
|
|
1853
1875
|
\u2139 ${i18n.t("installation:termuxDetected")}`));
|
|
1854
|
-
console.log(
|
|
1876
|
+
console.log(ansis__default.gray(i18n.t("installation:termuxEnvironmentInfo")));
|
|
1855
1877
|
}
|
|
1856
1878
|
let configLang = options.configLang;
|
|
1857
1879
|
if (codeToolType === "codex") {
|
|
@@ -1914,7 +1936,7 @@ async function init(options = {}) {
|
|
|
1914
1936
|
aiOutputLang: resolvedAiOutputLang ?? options.aiOutputLang ?? zcfConfig?.aiOutputLang ?? "en",
|
|
1915
1937
|
codeToolType
|
|
1916
1938
|
});
|
|
1917
|
-
console.log(
|
|
1939
|
+
console.log(ansis__default.green(i18n.t("codex:setupComplete")));
|
|
1918
1940
|
return;
|
|
1919
1941
|
}
|
|
1920
1942
|
const aiOutputLang = await resolveAiOutputLanguage(i18n.language, options.aiOutputLang, zcfConfig, options.skipPrompt);
|
|
@@ -1923,12 +1945,12 @@ async function init(options = {}) {
|
|
|
1923
1945
|
const { verifyInstallation, displayVerificationResult } = await Promise.resolve().then(function () { return installer; });
|
|
1924
1946
|
const verification = await verifyInstallation("claude-code");
|
|
1925
1947
|
if (verification.symlinkCreated) {
|
|
1926
|
-
console.log(
|
|
1948
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("installation:alreadyInstalled")}`));
|
|
1927
1949
|
displayVerificationResult(verification, "claude-code");
|
|
1928
1950
|
} else if (!verification.success) {
|
|
1929
|
-
console.log(
|
|
1951
|
+
console.log(ansis__default.yellow(`\u26A0 ${i18n.t("installation:verificationFailed")}`));
|
|
1930
1952
|
if (verification.error) {
|
|
1931
|
-
console.log(
|
|
1953
|
+
console.log(ansis__default.gray(` ${verification.error}`));
|
|
1932
1954
|
}
|
|
1933
1955
|
}
|
|
1934
1956
|
} else {
|
|
@@ -1942,7 +1964,7 @@ async function init(options = {}) {
|
|
|
1942
1964
|
if (shouldInstall) {
|
|
1943
1965
|
await installClaudeCode(false);
|
|
1944
1966
|
} else {
|
|
1945
|
-
console.log(
|
|
1967
|
+
console.log(ansis__default.yellow(i18n.t("common:skip")));
|
|
1946
1968
|
}
|
|
1947
1969
|
}
|
|
1948
1970
|
}
|
|
@@ -1952,7 +1974,7 @@ async function init(options = {}) {
|
|
|
1952
1974
|
ensureClaudeDir();
|
|
1953
1975
|
if (existsSync(SETTINGS_FILE) && needsMigration()) {
|
|
1954
1976
|
if (options.skipPrompt) {
|
|
1955
|
-
console.log(
|
|
1977
|
+
console.log(ansis__default.yellow("\n\u26A0\uFE0F Problematic configuration detected. Auto-fixing...\n"));
|
|
1956
1978
|
const result = migrateSettingsForTokenRetrieval();
|
|
1957
1979
|
displayMigrationResult(result);
|
|
1958
1980
|
} else {
|
|
@@ -1968,7 +1990,7 @@ async function init(options = {}) {
|
|
|
1968
1990
|
if (options.skipPrompt) {
|
|
1969
1991
|
action = options.configAction || "backup";
|
|
1970
1992
|
if (action === "skip") {
|
|
1971
|
-
console.log(
|
|
1993
|
+
console.log(ansis__default.yellow(i18n.t("common:skip")));
|
|
1972
1994
|
return;
|
|
1973
1995
|
}
|
|
1974
1996
|
} else {
|
|
@@ -1984,12 +2006,12 @@ async function init(options = {}) {
|
|
|
1984
2006
|
])
|
|
1985
2007
|
});
|
|
1986
2008
|
if (!userAction) {
|
|
1987
|
-
console.log(
|
|
2009
|
+
console.log(ansis__default.yellow(i18n.t("common:cancelled")));
|
|
1988
2010
|
process__default.exit(0);
|
|
1989
2011
|
}
|
|
1990
2012
|
action = userAction;
|
|
1991
2013
|
if (action === "skip") {
|
|
1992
|
-
console.log(
|
|
2014
|
+
console.log(ansis__default.yellow(i18n.t("common:skip")));
|
|
1993
2015
|
return;
|
|
1994
2016
|
}
|
|
1995
2017
|
}
|
|
@@ -2038,24 +2060,24 @@ async function init(options = {}) {
|
|
|
2038
2060
|
if (!ccrStatus.hasCorrectPackage) {
|
|
2039
2061
|
await installCcr();
|
|
2040
2062
|
} else {
|
|
2041
|
-
console.log(
|
|
2063
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
|
|
2042
2064
|
}
|
|
2043
2065
|
const existingCcrConfig = readCcrConfig();
|
|
2044
2066
|
if (existingCcrConfig) {
|
|
2045
2067
|
const backupPath = await backupCcrConfig();
|
|
2046
2068
|
if (backupPath) {
|
|
2047
|
-
console.log(
|
|
2069
|
+
console.log(ansis__default.gray(`\u2714 ${i18n.t("ccr:ccrBackupSuccess")}: ${backupPath}`));
|
|
2048
2070
|
}
|
|
2049
2071
|
}
|
|
2050
2072
|
const defaultCcrConfig = createDefaultCcrConfig();
|
|
2051
2073
|
writeCcrConfig(defaultCcrConfig);
|
|
2052
|
-
console.log(
|
|
2074
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("ccr:ccrConfigSuccess")}`));
|
|
2053
2075
|
await configureCcrProxy(defaultCcrConfig);
|
|
2054
|
-
console.log(
|
|
2076
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("ccr:proxyConfigSuccess")}`));
|
|
2055
2077
|
try {
|
|
2056
2078
|
addCompletedOnboarding();
|
|
2057
2079
|
} catch (error) {
|
|
2058
|
-
console.error(
|
|
2080
|
+
console.error(ansis__default.red(i18n.t("errors:failedToSetOnboarding")), error);
|
|
2059
2081
|
}
|
|
2060
2082
|
apiConfig = null;
|
|
2061
2083
|
}
|
|
@@ -2066,10 +2088,10 @@ async function init(options = {}) {
|
|
|
2066
2088
|
case "official": {
|
|
2067
2089
|
const success = switchToOfficialLogin();
|
|
2068
2090
|
if (success) {
|
|
2069
|
-
console.log(
|
|
2091
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("api:officialLoginConfigured")}`));
|
|
2070
2092
|
apiConfig = null;
|
|
2071
2093
|
} else {
|
|
2072
|
-
console.log(
|
|
2094
|
+
console.log(ansis__default.red(i18n.t("api:officialLoginFailed")));
|
|
2073
2095
|
}
|
|
2074
2096
|
break;
|
|
2075
2097
|
}
|
|
@@ -2081,11 +2103,11 @@ async function init(options = {}) {
|
|
|
2081
2103
|
if (!ccrStatus.hasCorrectPackage) {
|
|
2082
2104
|
await installCcr();
|
|
2083
2105
|
} else {
|
|
2084
|
-
console.log(
|
|
2106
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
|
|
2085
2107
|
}
|
|
2086
2108
|
const ccrConfigured = await setupCcrConfiguration();
|
|
2087
2109
|
if (ccrConfigured) {
|
|
2088
|
-
console.log(
|
|
2110
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("ccr:ccrSetupComplete")}`));
|
|
2089
2111
|
apiConfig = null;
|
|
2090
2112
|
}
|
|
2091
2113
|
break;
|
|
@@ -2094,7 +2116,7 @@ async function init(options = {}) {
|
|
|
2094
2116
|
apiConfig = null;
|
|
2095
2117
|
break;
|
|
2096
2118
|
default:
|
|
2097
|
-
console.log(
|
|
2119
|
+
console.log(ansis__default.yellow(i18n.t("common:cancelled")));
|
|
2098
2120
|
process__default.exit(0);
|
|
2099
2121
|
}
|
|
2100
2122
|
}
|
|
@@ -2102,7 +2124,7 @@ async function init(options = {}) {
|
|
|
2102
2124
|
if (["backup", "docs-only", "merge"].includes(action)) {
|
|
2103
2125
|
const backupDir = backupExistingConfig();
|
|
2104
2126
|
if (backupDir) {
|
|
2105
|
-
console.log(
|
|
2127
|
+
console.log(ansis__default.gray(`\u2714 ${i18n.t("configuration:backupSuccess")}: ${backupDir}`));
|
|
2106
2128
|
}
|
|
2107
2129
|
}
|
|
2108
2130
|
if (action === "docs-only") {
|
|
@@ -2140,9 +2162,9 @@ async function init(options = {}) {
|
|
|
2140
2162
|
if (apiConfig && action !== "docs-only") {
|
|
2141
2163
|
const configuredApi = configureApi(apiConfig);
|
|
2142
2164
|
if (configuredApi) {
|
|
2143
|
-
console.log(
|
|
2144
|
-
console.log(
|
|
2145
|
-
console.log(
|
|
2165
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("api:apiConfigSuccess")}`));
|
|
2166
|
+
console.log(ansis__default.gray(` URL: ${configuredApi.url}`));
|
|
2167
|
+
console.log(ansis__default.gray(` Key: ${formatApiKeyDisplay(configuredApi.key)}`));
|
|
2146
2168
|
}
|
|
2147
2169
|
}
|
|
2148
2170
|
const hasModelParams = options.apiModel || options.apiHaikuModel || options.apiSonnetModel || options.apiOpusModel;
|
|
@@ -2155,16 +2177,16 @@ async function init(options = {}) {
|
|
|
2155
2177
|
options.apiSonnetModel || void 0,
|
|
2156
2178
|
options.apiOpusModel || void 0
|
|
2157
2179
|
);
|
|
2158
|
-
console.log(
|
|
2180
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("api:modelConfigSuccess")}`));
|
|
2159
2181
|
if (options.apiModel) {
|
|
2160
|
-
console.log(
|
|
2182
|
+
console.log(ansis__default.gray(` ${i18n.t("api:primaryModel")}: ${options.apiModel}`));
|
|
2161
2183
|
}
|
|
2162
2184
|
if (options.apiHaikuModel)
|
|
2163
|
-
console.log(
|
|
2185
|
+
console.log(ansis__default.gray(` Haiku: ${options.apiHaikuModel}`));
|
|
2164
2186
|
if (options.apiSonnetModel)
|
|
2165
|
-
console.log(
|
|
2187
|
+
console.log(ansis__default.gray(` Sonnet: ${options.apiSonnetModel}`));
|
|
2166
2188
|
if (options.apiOpusModel)
|
|
2167
|
-
console.log(
|
|
2189
|
+
console.log(ansis__default.gray(` Opus: ${options.apiOpusModel}`));
|
|
2168
2190
|
}
|
|
2169
2191
|
}
|
|
2170
2192
|
if (action !== "docs-only") {
|
|
@@ -2180,7 +2202,7 @@ async function init(options = {}) {
|
|
|
2180
2202
|
}
|
|
2181
2203
|
if (shouldConfigureMcp) {
|
|
2182
2204
|
if (isWindows()) {
|
|
2183
|
-
console.log(
|
|
2205
|
+
console.log(ansis__default.green(`\u2139 ${i18n.t("installation:windowsDetected")}`));
|
|
2184
2206
|
}
|
|
2185
2207
|
let selectedServices;
|
|
2186
2208
|
if (options.skipPrompt) {
|
|
@@ -2194,7 +2216,7 @@ async function init(options = {}) {
|
|
|
2194
2216
|
if (selectedServices.length > 0) {
|
|
2195
2217
|
const mcpBackupPath = backupMcpConfig();
|
|
2196
2218
|
if (mcpBackupPath) {
|
|
2197
|
-
console.log(
|
|
2219
|
+
console.log(ansis__default.gray(`\u2714 ${i18n.t("mcp:mcpBackupSuccess")}: ${mcpBackupPath}`));
|
|
2198
2220
|
}
|
|
2199
2221
|
const newServers = {};
|
|
2200
2222
|
for (const serviceId of selectedServices) {
|
|
@@ -2215,7 +2237,7 @@ async function init(options = {}) {
|
|
|
2215
2237
|
}
|
|
2216
2238
|
if (service.requiresApiKey) {
|
|
2217
2239
|
if (options.skipPrompt) {
|
|
2218
|
-
console.log(
|
|
2240
|
+
console.log(ansis__default.yellow(`${i18n.t("common:skip")}: ${service.name} (requires API key)`));
|
|
2219
2241
|
continue;
|
|
2220
2242
|
} else {
|
|
2221
2243
|
const response = await inquirer.prompt({
|
|
@@ -2225,7 +2247,7 @@ async function init(options = {}) {
|
|
|
2225
2247
|
validate: (value) => !!value || i18n.t("api:keyRequired")
|
|
2226
2248
|
});
|
|
2227
2249
|
if (!response.apiKey) {
|
|
2228
|
-
console.log(
|
|
2250
|
+
console.log(ansis__default.yellow(`${i18n.t("common:skip")}: ${service.name}`));
|
|
2229
2251
|
continue;
|
|
2230
2252
|
}
|
|
2231
2253
|
config = buildMcpServerConfig(service.config, response.apiKey, service.apiKeyPlaceholder, service.apiKeyEnvVar);
|
|
@@ -2238,7 +2260,7 @@ async function init(options = {}) {
|
|
|
2238
2260
|
mergedConfig = fixWindowsMcpConfig(mergedConfig);
|
|
2239
2261
|
try {
|
|
2240
2262
|
writeMcpConfig(mergedConfig);
|
|
2241
|
-
console.log(
|
|
2263
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("mcp:mcpConfigSuccess")}`));
|
|
2242
2264
|
const { checkMcpPerformance, formatPerformanceWarning } = await import('./mcp-performance.mjs').then(function (n) { return n.e; });
|
|
2243
2265
|
const serviceCount = Object.keys(newServers).length;
|
|
2244
2266
|
const perfWarning = checkMcpPerformance(serviceCount);
|
|
@@ -2247,7 +2269,7 @@ async function init(options = {}) {
|
|
|
2247
2269
|
console.log(formatPerformanceWarning(perfWarning, i18n.language));
|
|
2248
2270
|
}
|
|
2249
2271
|
} catch (error) {
|
|
2250
|
-
console.error(
|
|
2272
|
+
console.error(ansis__default.red(`${i18n.t("errors:failedToWriteMcpConfig")} ${error}`));
|
|
2251
2273
|
}
|
|
2252
2274
|
}
|
|
2253
2275
|
}
|
|
@@ -2267,10 +2289,10 @@ async function init(options = {}) {
|
|
|
2267
2289
|
if (shouldInstallCometix) {
|
|
2268
2290
|
await installCometixLine();
|
|
2269
2291
|
} else {
|
|
2270
|
-
console.log(
|
|
2292
|
+
console.log(ansis__default.yellow(i18n.t("cometix:cometixSkipped")));
|
|
2271
2293
|
}
|
|
2272
2294
|
} else {
|
|
2273
|
-
console.log(
|
|
2295
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("cometix:cometixAlreadyInstalled")}`));
|
|
2274
2296
|
}
|
|
2275
2297
|
if (!options.skipPrompt || options.installSuperpowers) {
|
|
2276
2298
|
await handleSuperpowersInstallation(options);
|
|
@@ -2280,10 +2302,10 @@ async function init(options = {}) {
|
|
|
2280
2302
|
const { injectSmartGuide } = await import('./smart-guide.mjs');
|
|
2281
2303
|
const smartGuideSuccess = await injectSmartGuide(configLang);
|
|
2282
2304
|
if (smartGuideSuccess) {
|
|
2283
|
-
console.log(
|
|
2305
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("smartGuide:enabled")}`));
|
|
2284
2306
|
}
|
|
2285
2307
|
} catch {
|
|
2286
|
-
console.log(
|
|
2308
|
+
console.log(ansis__default.gray(`\u2139 ${i18n.t("smartGuide:skipped")}`));
|
|
2287
2309
|
}
|
|
2288
2310
|
updateZcfConfig({
|
|
2289
2311
|
version,
|
|
@@ -2295,24 +2317,25 @@ async function init(options = {}) {
|
|
|
2295
2317
|
codeToolType
|
|
2296
2318
|
});
|
|
2297
2319
|
console.log("");
|
|
2298
|
-
console.log(
|
|
2299
|
-
console.log(
|
|
2300
|
-
console.log(
|
|
2301
|
-
console.log(`${
|
|
2302
|
-
console.log(
|
|
2303
|
-
console.log(`${
|
|
2304
|
-
console.log(
|
|
2305
|
-
console.log(
|
|
2306
|
-
console.log(
|
|
2307
|
-
console.log(`${
|
|
2308
|
-
console.log(
|
|
2309
|
-
console.log(
|
|
2310
|
-
console.log(`${
|
|
2311
|
-
console.log(
|
|
2312
|
-
console.log(
|
|
2313
|
-
console.log(`${
|
|
2314
|
-
console.log(
|
|
2320
|
+
console.log(ansis__default.bold.green("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"));
|
|
2321
|
+
console.log(ansis__default.bold.green("\u2551") + ansis__default.bold.white(padToDisplayWidth(` ${i18n.t("configuration:setupCompleteTitle")}`, 62)) + ansis__default.bold.green("\u2551"));
|
|
2322
|
+
console.log(ansis__default.bold.green("\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563"));
|
|
2323
|
+
console.log(`${ansis__default.bold.green("\u2551")} ${ansis__default.bold.green("\u2551")}`);
|
|
2324
|
+
console.log(ansis__default.bold.green("\u2551") + ansis__default.green(padToDisplayWidth(` ${i18n.t("configuration:nextSteps")}`, 62)) + ansis__default.bold.green("\u2551"));
|
|
2325
|
+
console.log(`${ansis__default.bold.green("\u2551")} ${ansis__default.bold.green("\u2551")}`);
|
|
2326
|
+
console.log(ansis__default.bold.green("\u2551") + padToDisplayWidth(` ${i18n.t("configuration:guidanceStep1")}`, 62) + ansis__default.bold.green("\u2551"));
|
|
2327
|
+
console.log(ansis__default.bold.green("\u2551") + ansis__default.dim(padToDisplayWidth(` ${i18n.t("configuration:guidanceStep1Detail")}`, 62)) + ansis__default.bold.green("\u2551"));
|
|
2328
|
+
console.log(ansis__default.bold.green("\u2551") + ansis__default.dim(padToDisplayWidth(` ${i18n.t("configuration:guidanceStep1Detail2")}`, 62)) + ansis__default.bold.green("\u2551"));
|
|
2329
|
+
console.log(`${ansis__default.bold.green("\u2551")} ${ansis__default.bold.green("\u2551")}`);
|
|
2330
|
+
console.log(ansis__default.bold.green("\u2551") + padToDisplayWidth(` ${i18n.t("configuration:guidanceStep2")}`, 62) + ansis__default.bold.green("\u2551"));
|
|
2331
|
+
console.log(ansis__default.bold.green("\u2551") + ansis__default.green(padToDisplayWidth(` ${i18n.t("configuration:guidanceStep2Example")}`, 62)) + ansis__default.bold.green("\u2551"));
|
|
2332
|
+
console.log(`${ansis__default.bold.green("\u2551")} ${ansis__default.bold.green("\u2551")}`);
|
|
2333
|
+
console.log(ansis__default.bold.green("\u2551") + padToDisplayWidth(` ${i18n.t("configuration:guidanceStep3")} `, 44) + ansis__default.yellow(padToDisplayWidth(i18n.t("configuration:guidanceStep3Command"), 18)) + ansis__default.bold.green("\u2551"));
|
|
2334
|
+
console.log(ansis__default.bold.green("\u2551") + padToDisplayWidth(` ${i18n.t("configuration:guidanceStep4")} `, 44) + ansis__default.yellow(padToDisplayWidth(i18n.t("configuration:guidanceStep4Command"), 18)) + ansis__default.bold.green("\u2551"));
|
|
2335
|
+
console.log(`${ansis__default.bold.green("\u2551")} ${ansis__default.bold.green("\u2551")}`);
|
|
2336
|
+
console.log(ansis__default.bold.green("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"));
|
|
2315
2337
|
console.log("");
|
|
2338
|
+
showValueDrivenWelcome();
|
|
2316
2339
|
} catch (error) {
|
|
2317
2340
|
if (!handleExitPromptError(error)) {
|
|
2318
2341
|
handleGeneralError(error);
|
|
@@ -2346,9 +2369,9 @@ async function handleMultiConfigurations(options, codeToolType) {
|
|
|
2346
2369
|
} else if (codeToolType === "codex") {
|
|
2347
2370
|
await handleCodexConfigs(configs);
|
|
2348
2371
|
}
|
|
2349
|
-
console.log(
|
|
2372
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("multi-config:configsAddedSuccessfully")}`));
|
|
2350
2373
|
} catch (error) {
|
|
2351
|
-
console.error(
|
|
2374
|
+
console.error(ansis__default.red(`${i18n.t("multi-config:configsFailed")}: ${error instanceof Error ? error.message : String(error)}`));
|
|
2352
2375
|
throw error;
|
|
2353
2376
|
}
|
|
2354
2377
|
}
|
|
@@ -2404,11 +2427,11 @@ async function handleClaudeCodeConfigs(configs) {
|
|
|
2404
2427
|
}
|
|
2405
2428
|
const storedProfile = result.addedProfile || ClaudeCodeConfigManager.getProfileByName(config.name) || profile;
|
|
2406
2429
|
addedProfiles.push(storedProfile);
|
|
2407
|
-
console.log(
|
|
2430
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("multi-config:profileAdded", { name: config.name })}`));
|
|
2408
2431
|
}
|
|
2409
2432
|
if (addedProfiles.length > 0) {
|
|
2410
2433
|
const summary = addedProfiles.map((profile) => `${profile.name} [${profile.authType}]`).join(", ");
|
|
2411
|
-
console.log(
|
|
2434
|
+
console.log(ansis__default.gray(` \u2022 ${ClaudeCodeConfigManager.CONFIG_FILE}: ${summary}`));
|
|
2412
2435
|
}
|
|
2413
2436
|
const defaultConfig = configs.find((c) => c.default);
|
|
2414
2437
|
if (defaultConfig) {
|
|
@@ -2416,7 +2439,7 @@ async function handleClaudeCodeConfigs(configs) {
|
|
|
2416
2439
|
if (profile && profile.id) {
|
|
2417
2440
|
await ClaudeCodeConfigManager.switchProfile(profile.id);
|
|
2418
2441
|
await ClaudeCodeConfigManager.applyProfileSettings(profile);
|
|
2419
|
-
console.log(
|
|
2442
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("multi-config:defaultProfileSet", { name: defaultConfig.name })}`));
|
|
2420
2443
|
}
|
|
2421
2444
|
}
|
|
2422
2445
|
await ClaudeCodeConfigManager.syncCcrProfile();
|
|
@@ -2432,9 +2455,9 @@ async function handleCodexConfigs(configs) {
|
|
|
2432
2455
|
throw new Error(i18n.t("multi-config:providerAddFailed", { name: config.name, error: result.error }));
|
|
2433
2456
|
}
|
|
2434
2457
|
addedProviderIds.push(provider.id);
|
|
2435
|
-
console.log(
|
|
2458
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("multi-config:providerAdded", { name: config.name })}`));
|
|
2436
2459
|
} catch (error) {
|
|
2437
|
-
console.error(
|
|
2460
|
+
console.error(ansis__default.red(i18n.t("multi-config:providerAddFailed", {
|
|
2438
2461
|
name: config.name,
|
|
2439
2462
|
error: error instanceof Error ? error.message : String(error)
|
|
2440
2463
|
})));
|
|
@@ -2448,9 +2471,9 @@ async function handleCodexConfigs(configs) {
|
|
|
2448
2471
|
const providerId = displayName.toLowerCase().replace(/[^a-z0-9]/g, "-");
|
|
2449
2472
|
if (addedProviderIds.includes(providerId)) {
|
|
2450
2473
|
await switchCodexProvider(providerId);
|
|
2451
|
-
console.log(
|
|
2474
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("multi-config:defaultProviderSet", { name: displayName })}`));
|
|
2452
2475
|
} else {
|
|
2453
|
-
console.log(
|
|
2476
|
+
console.log(ansis__default.red(i18n.t("multi-config:providerAddFailed", { name: displayName, error: "provider not added" })));
|
|
2454
2477
|
}
|
|
2455
2478
|
}
|
|
2456
2479
|
}
|
|
@@ -2465,12 +2488,12 @@ async function saveSingleConfigToToml(apiConfig, provider, options) {
|
|
|
2465
2488
|
await ClaudeCodeConfigManager.switchProfile(savedProfile.id);
|
|
2466
2489
|
await ClaudeCodeConfigManager.applyProfileSettings(savedProfile);
|
|
2467
2490
|
}
|
|
2468
|
-
console.log(
|
|
2491
|
+
console.log(ansis__default.green(`\u2714 ${i18n.t("configuration:singleConfigSaved", { name: profile.name })}`));
|
|
2469
2492
|
} else {
|
|
2470
|
-
console.warn(
|
|
2493
|
+
console.warn(ansis__default.yellow(`${i18n.t("configuration:singleConfigSaveFailed")}: ${result.error}`));
|
|
2471
2494
|
}
|
|
2472
2495
|
} catch (error) {
|
|
2473
|
-
console.warn(
|
|
2496
|
+
console.warn(ansis__default.yellow(`${i18n.t("configuration:singleConfigSaveFailed")}: ${error instanceof Error ? error.message : String(error)}`));
|
|
2474
2497
|
}
|
|
2475
2498
|
}
|
|
2476
2499
|
async function convertSingleConfigToProfile(apiConfig, provider, options) {
|