ccjk 13.5.7 → 13.6.0
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 +3 -3
- package/dist/chunks/agent.mjs +2 -2
- package/dist/chunks/agents.mjs +3 -3
- package/dist/chunks/api-cli.mjs +5 -5
- package/dist/chunks/api-providers.mjs +1 -1
- package/dist/chunks/api.mjs +4 -4
- package/dist/chunks/auto-bootstrap.mjs +1 -1
- package/dist/chunks/auto-fix.mjs +17 -5
- package/dist/chunks/auto-fixer.mjs +3 -3
- package/dist/chunks/auto-init.mjs +3 -3
- package/dist/chunks/auto-updater.mjs +7 -7
- package/dist/chunks/banner.mjs +2 -2
- package/dist/chunks/boost.mjs +5 -5
- package/dist/chunks/ccjk-agents.mjs +2 -2
- package/dist/chunks/ccjk-all.mjs +6 -6
- package/dist/chunks/ccjk-config.mjs +2 -2
- package/dist/chunks/ccjk-hooks.mjs +3 -3
- package/dist/chunks/ccjk-mcp.mjs +4 -4
- package/dist/chunks/ccjk-setup.mjs +4 -4
- package/dist/chunks/ccjk-skills.mjs +4 -4
- package/dist/chunks/ccr.mjs +16 -16
- package/dist/chunks/ccu.mjs +2 -2
- package/dist/chunks/check-updates.mjs +8 -8
- package/dist/chunks/claude-code-config-manager.mjs +5 -5
- package/dist/chunks/claude-code-incremental-manager.mjs +6 -6
- package/dist/chunks/claude-config.mjs +2 -2
- package/dist/chunks/claude-wrapper.mjs +1 -1
- package/dist/chunks/cli-hook.mjs +5 -5
- package/dist/chunks/codex-config-switch.mjs +6 -6
- package/dist/chunks/codex-provider-manager.mjs +7 -7
- package/dist/chunks/codex-uninstaller.mjs +2 -2
- package/dist/chunks/codex.mjs +7 -7
- package/dist/chunks/commands.mjs +2 -2
- package/dist/chunks/commands2.mjs +2 -2
- package/dist/chunks/commit.mjs +3 -3
- package/dist/chunks/completion.mjs +2 -2
- package/dist/chunks/config-consolidator.mjs +2 -2
- package/dist/chunks/config-switch.mjs +8 -8
- package/dist/chunks/config.mjs +20 -9
- package/dist/chunks/config2.mjs +4 -4
- package/dist/chunks/config3.mjs +3 -3
- package/dist/chunks/constants.mjs +1 -1
- package/dist/chunks/context.mjs +3 -3
- package/dist/chunks/dashboard.mjs +2 -2
- package/dist/chunks/doctor.mjs +4 -4
- package/dist/chunks/evolution.mjs +2 -2
- package/dist/chunks/features.mjs +8 -8
- package/dist/chunks/help.mjs +1 -1
- package/dist/chunks/impact.mjs +1 -1
- package/dist/chunks/index.mjs +18 -19
- package/dist/chunks/index10.mjs +5145 -528
- package/dist/chunks/index11.mjs +1061 -569
- package/dist/chunks/index12.mjs +193 -1146
- package/dist/chunks/index13.mjs +607 -937
- package/dist/chunks/index14.mjs +951 -136
- package/dist/chunks/index15.mjs +185 -209
- package/dist/chunks/index2.mjs +7623 -12
- package/dist/chunks/index3.mjs +160 -19081
- package/dist/chunks/index4.mjs +19 -18
- package/dist/chunks/index5.mjs +12 -7623
- package/dist/chunks/index6.mjs +19077 -156
- package/dist/chunks/index7.mjs +565 -1551
- package/dist/chunks/index8.mjs +1535 -5166
- package/dist/chunks/init.mjs +1107 -1101
- package/dist/chunks/installer.mjs +5 -5
- package/dist/chunks/installer2.mjs +2 -2
- package/dist/chunks/interview.mjs +4 -4
- package/dist/chunks/manager.mjs +1 -1
- package/dist/chunks/marketplace.mjs +3 -3
- package/dist/chunks/mcp-cli.mjs +9 -9
- package/dist/chunks/mcp.mjs +10 -10
- package/dist/chunks/memory-check.mjs +2 -2
- package/dist/chunks/memory-paths.mjs +2 -2
- package/dist/chunks/memory-sync.mjs +2 -2
- package/dist/chunks/memory.mjs +4 -4
- package/dist/chunks/metrics-display.mjs +1 -1
- package/dist/chunks/migrator.mjs +1 -1
- package/dist/chunks/monitor.mjs +2 -2
- package/dist/chunks/notification.mjs +4 -4
- package/dist/chunks/onboarding.mjs +4 -4
- package/dist/chunks/package.mjs +1 -1
- package/dist/chunks/paradigm.mjs +1 -1
- package/dist/chunks/permission-manager.mjs +2 -2
- package/dist/chunks/permissions.mjs +3 -3
- package/dist/chunks/persistence-manager.mjs +3 -3
- package/dist/chunks/platform.mjs +1 -1
- package/dist/chunks/plugin.mjs +2 -2
- package/dist/chunks/prompts.mjs +5 -5
- package/dist/chunks/providers.mjs +2 -2
- package/dist/chunks/quick-actions.mjs +3 -3
- package/dist/chunks/quick-provider.mjs +4 -4
- package/dist/chunks/quick-setup.mjs +11 -11
- package/dist/chunks/remote.mjs +5 -5
- package/dist/chunks/session-manager.mjs +1 -1
- package/dist/chunks/session.mjs +2 -2
- package/dist/chunks/sessions.mjs +1 -1
- package/dist/chunks/silent-updater.mjs +1 -1
- package/dist/chunks/simple-config.mjs +1 -1
- package/dist/chunks/skill2.mjs +3 -3
- package/dist/chunks/skills-sync.mjs +5 -5
- package/dist/chunks/skills.mjs +3 -3
- package/dist/chunks/slash-commands.mjs +3 -3
- package/dist/chunks/startup.mjs +1 -1
- package/dist/chunks/stats.mjs +2 -2
- package/dist/chunks/status.mjs +3 -3
- package/dist/chunks/team.mjs +3 -3
- package/dist/chunks/thinking.mjs +4 -4
- package/dist/chunks/trace.mjs +2 -2
- package/dist/chunks/uninstall.mjs +8 -8
- package/dist/chunks/update.mjs +12 -12
- package/dist/chunks/upgrade-manager.mjs +3 -3
- package/dist/chunks/upgrade.mjs +1 -1
- package/dist/chunks/version-checker.mjs +4 -4
- package/dist/chunks/vim.mjs +3 -3
- package/dist/chunks/workflows.mjs +1 -1
- package/dist/chunks/wsl.mjs +1 -1
- package/dist/chunks/zero-config.mjs +3 -3
- package/dist/cli.mjs +195 -185
- package/dist/index.mjs +8 -8
- package/dist/shared/{ccjk.BJMRY2Ra.mjs → ccjk.8oaxX4iR.mjs} +1 -1
- package/dist/shared/{ccjk.8VhZ_dEO.mjs → ccjk.Bq8TqZG_.mjs} +1 -1
- package/dist/shared/{ccjk.Bb9Mpi2O.mjs → ccjk.C1hANZTu.mjs} +1 -1
- package/dist/shared/{ccjk.KpFl2RDA.mjs → ccjk.C4m4ypdk.mjs} +5 -5
- package/dist/shared/{ccjk.I6IuYdc_.mjs → ccjk.CQd7SKNC.mjs} +2 -2
- package/dist/shared/{ccjk.Cjj8SVrn.mjs → ccjk.CiKtBUW_.mjs} +1 -1
- package/dist/shared/{ccjk.DKBI0lAR.mjs → ccjk.Cv13QsGp.mjs} +3 -3
- package/dist/shared/{ccjk.D8BqKRwH.mjs → ccjk.CwsecBYP.mjs} +4 -4
- package/dist/shared/{ccjk.DCw2WnZU.mjs → ccjk.D75wivnp.mjs} +1 -1
- package/dist/shared/{ccjk.DZ4ehAHg.mjs → ccjk.DDq2hqA5.mjs} +24 -4
- package/dist/shared/{ccjk.BIxuVL3_.mjs → ccjk.DGllfVCZ.mjs} +3 -3
- package/dist/shared/{ccjk.BWFpnOr3.mjs → ccjk.DZ2LLOa-.mjs} +1 -1
- package/dist/shared/{ccjk.eDO9cM5o.mjs → ccjk.DbigonEQ.mjs} +1 -1
- package/dist/shared/{ccjk.CIObNAcl.mjs → ccjk.Dhu8ia5S.mjs} +1 -1
- package/dist/shared/{ccjk.CHUEFqmw.mjs → ccjk.DlTXS9rP.mjs} +1 -1
- package/dist/shared/{ccjk.CxAFICpL.mjs → ccjk.DvAP4XfP.mjs} +4 -4
- package/dist/shared/{ccjk.BOu1yav7.mjs → ccjk.KPLeMP-o.mjs} +1 -1
- package/dist/shared/{ccjk.D8ZLYSZZ.mjs → ccjk.vO3d1ABk.mjs} +1 -1
- package/dist/templates/claude-code/common/settings.json +0 -1
- package/package.json +68 -65
- package/templates/claude-code/common/settings.json +0 -1
package/dist/chunks/init.mjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import process__default from 'node:process';
|
|
3
|
-
import a from './
|
|
4
|
-
import { i as inquirer } from './
|
|
3
|
+
import a from './index5.mjs';
|
|
4
|
+
import { i as inquirer } from './index6.mjs';
|
|
5
5
|
import { g as getMcpServices, M as MCP_SERVICE_CONFIGS, k as runCodexFullInit } from './codex.mjs';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { ensureI18nInitialized, i18n } from './index5.mjs';
|
|
6
|
+
import { SETTINGS_FILE, API_DEFAULT_URL, DEFAULT_CODE_TOOL_TYPE, CODE_TOOL_BANNERS } from './constants.mjs';
|
|
7
|
+
import { ensureI18nInitialized, i18n } from './index2.mjs';
|
|
9
8
|
import { displayBannerWithInfo, padToDisplayWidth } from './banner.mjs';
|
|
10
9
|
import { readZcfConfig, updateZcfConfig } from './ccjk-config.mjs';
|
|
11
10
|
import { readCcrConfig, backupCcrConfig, createDefaultCcrConfig, writeCcrConfig, configureCcrProxy, setupCcrConfiguration } from './config2.mjs';
|
|
@@ -14,20 +13,21 @@ import { promisify } from 'node:util';
|
|
|
14
13
|
import { updateCcr } from './auto-updater.mjs';
|
|
15
14
|
import { w as wrapCommandWithSudo, k as isWindows, i as isTermux } from './platform.mjs';
|
|
16
15
|
import { a as addCompletedOnboarding, s as setPrimaryApiKey, c as backupMcpConfig, b as buildMcpServerConfig, r as readMcpConfig, e as replaceMcpServers, f as fixWindowsMcpConfig, w as writeMcpConfig, g as syncMcpPermissions } from './claude-config.mjs';
|
|
17
|
-
import { r as resolveCodeType } from '../shared/ccjk.
|
|
16
|
+
import { r as resolveCodeType } from '../shared/ccjk.CiKtBUW_.mjs';
|
|
18
17
|
import { exists } from './fs-operations.mjs';
|
|
19
18
|
import { readJsonConfig, writeJsonConfig } from './json-config.mjs';
|
|
20
|
-
import { p as promptApiConfigurationAction, i as ensureClaudeDir, f as getExistingApiConfig, s as switchToOfficialLogin, b as backupExistingConfig,
|
|
21
|
-
import { n as needsMigration, m as migrateSettingsForTokenRetrieval, d as displayMigrationResult, p as promptMigration } from '../shared/ccjk.
|
|
22
|
-
import {
|
|
19
|
+
import { p as promptApiConfigurationAction, i as ensureClaudeDir, f as getExistingApiConfig, s as switchToOfficialLogin, b as backupExistingConfig, d as copyConfigFiles, h as applyAiLanguageDirective, e as configureApi } from './config.mjs';
|
|
20
|
+
import { n as needsMigration, m as migrateSettingsForTokenRetrieval, d as displayMigrationResult, p as promptMigration } from '../shared/ccjk.DDq2hqA5.mjs';
|
|
21
|
+
import { W as WORKFLOW_CONFIG_BASE, m as modifyApiConfigPartially, c as configureApiCompletely, s as selectAndInstallWorkflows, a as configureOutputStyle, f as formatApiKeyDisplay } from '../shared/ccjk.CwsecBYP.mjs';
|
|
22
|
+
import { a as handleExitPromptError, h as handleGeneralError } from '../shared/ccjk.DGllfVCZ.mjs';
|
|
23
23
|
import { getInstallationStatus, installClaudeCode } from './installer.mjs';
|
|
24
24
|
import { p as parseOrchestrationLevel, w as writeOrchestrationPolicy } from './smart-defaults.mjs';
|
|
25
25
|
import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
|
|
26
26
|
import { resolveAiOutputLanguage } from './prompts.mjs';
|
|
27
27
|
import { g as getRuntimeVersion } from '../shared/ccjk.gDEDGD_t.mjs';
|
|
28
|
-
import {
|
|
29
|
-
import { p as promptBoolean } from '../shared/ccjk.BWFpnOr3.mjs';
|
|
28
|
+
import { p as promptBoolean } from '../shared/ccjk.DZ2LLOa-.mjs';
|
|
30
29
|
import { checkClaudeCodeVersionAndPrompt } from './version-checker.mjs';
|
|
30
|
+
import { c as checkSuperpowersInstalled, i as installSuperpowers } from '../shared/ccjk.Bq8TqZG_.mjs';
|
|
31
31
|
|
|
32
32
|
const execAsync$1 = promisify(exec);
|
|
33
33
|
async function isCcrInstalled() {
|
|
@@ -347,7 +347,6 @@ class ProgressTracker {
|
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
-
const ccjkVersion = getRuntimeVersion();
|
|
351
350
|
async function validateSkipPromptOptions(options) {
|
|
352
351
|
if (options.allLang) {
|
|
353
352
|
if (options.allLang === "zh-CN" || options.allLang === "en") {
|
|
@@ -561,6 +560,7 @@ async function silentInit(options = {}) {
|
|
|
561
560
|
console.log(` Code Tool: ${defaults.codeToolType}`);
|
|
562
561
|
console.log(` API Provider: ${defaults.apiProvider || "anthropic"}`);
|
|
563
562
|
console.log(` MCP Services: ${topMcpServices.join(", ")}`);
|
|
563
|
+
const { init } = await Promise.resolve().then(function () { return init$1; });
|
|
564
564
|
await init(options);
|
|
565
565
|
console.log("\u2713 CCJK initialized successfully");
|
|
566
566
|
} catch (error) {
|
|
@@ -619,1177 +619,1183 @@ ${i18n.t("superpowers:title")}`));
|
|
|
619
619
|
console.error(a.red(`${i18n.t("superpowers:installFailed")}: ${errorMessage}`));
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
|
-
async function
|
|
623
|
-
options.initSource = options.initSource || "init";
|
|
624
|
-
options.orchestration = parseOrchestrationLevel(options.orchestration);
|
|
625
|
-
try {
|
|
626
|
-
const { cleanupZcfNamespace } = await import('./cleanup-migration.mjs');
|
|
627
|
-
const { removed } = cleanupZcfNamespace();
|
|
628
|
-
if (removed.length > 0) {
|
|
629
|
-
console.log(a.dim(`Cleaned up legacy zcf namespace: ${removed.join(", ")}`));
|
|
630
|
-
}
|
|
631
|
-
} catch {
|
|
632
|
-
}
|
|
633
|
-
if (options.silent) {
|
|
634
|
-
return await silentInit(options);
|
|
635
|
-
}
|
|
636
|
-
if (options.smart) {
|
|
637
|
-
return await smartInit(options);
|
|
638
|
-
}
|
|
639
|
-
if (options.skipPrompt) {
|
|
640
|
-
await validateSkipPromptOptions(options);
|
|
641
|
-
}
|
|
622
|
+
async function smartInit(options = {}) {
|
|
642
623
|
try {
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
if (
|
|
652
|
-
|
|
624
|
+
console.log(a.bold.green("\n\u{1F9E0} Smart Initialization Mode\n"));
|
|
625
|
+
console.log(a.gray("Analyzing your project to generate optimal configuration...\n"));
|
|
626
|
+
const { analyzeProject } = await import('./index13.mjs');
|
|
627
|
+
const analysis = await analyzeProject();
|
|
628
|
+
console.log(a.cyan("\u{1F4CA} Project Analysis:"));
|
|
629
|
+
console.log(a.gray(` \u2022 Type: ${analysis.projectType}`));
|
|
630
|
+
console.log(a.gray(` \u2022 Languages: ${analysis.techStack.languages.join(", ")}`));
|
|
631
|
+
console.log(a.gray(` \u2022 Runtime: ${analysis.techStack.runtime}`));
|
|
632
|
+
if (analysis.frameworks.length > 0) {
|
|
633
|
+
console.log(a.gray(` \u2022 Frameworks: ${analysis.frameworks.join(", ")}`));
|
|
653
634
|
}
|
|
654
|
-
if (
|
|
655
|
-
|
|
656
|
-
const zcfConfig = readZcfConfig();
|
|
657
|
-
if (!options.skipPrompt && !options.skipBanner)
|
|
658
|
-
tracker.nextStep();
|
|
659
|
-
let codeToolType;
|
|
660
|
-
try {
|
|
661
|
-
codeToolType = await resolveCodeType(options.codeType);
|
|
662
|
-
} catch (error) {
|
|
663
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
664
|
-
console.error(a.red(`${i18n.t("errors:generalError")} ${errorMessage}`));
|
|
665
|
-
codeToolType = DEFAULT_CODE_TOOL_TYPE;
|
|
635
|
+
if (analysis.buildTool) {
|
|
636
|
+
console.log(a.gray(` \u2022 Build Tool: ${analysis.buildTool}`));
|
|
666
637
|
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
message: i18n.t("api:selectApiMode"),
|
|
673
|
-
choices: [
|
|
674
|
-
{
|
|
675
|
-
name: i18n.t("api:useOfficialLogin"),
|
|
676
|
-
value: "official"
|
|
677
|
-
},
|
|
678
|
-
{
|
|
679
|
-
name: i18n.t("api:customApiConfig"),
|
|
680
|
-
value: "custom"
|
|
681
|
-
},
|
|
682
|
-
{
|
|
683
|
-
name: i18n.t("api:useCcrProxy"),
|
|
684
|
-
value: "ccr"
|
|
685
|
-
},
|
|
686
|
-
{
|
|
687
|
-
name: i18n.t("api:skipApi"),
|
|
688
|
-
value: "skip"
|
|
689
|
-
}
|
|
690
|
-
]
|
|
691
|
-
});
|
|
692
|
-
return apiMode;
|
|
638
|
+
console.log(a.gray(` \u2022 Has Tests: ${analysis.hasTests ? "Yes" : "No"}`));
|
|
639
|
+
console.log(a.gray(` \u2022 Has Database: ${analysis.hasDatabase ? "Yes" : "No"}`));
|
|
640
|
+
console.log(a.gray(` \u2022 Has API: ${analysis.hasApi ? "Yes" : "No"}`));
|
|
641
|
+
if (analysis.cicd.length > 0) {
|
|
642
|
+
console.log(a.gray(` \u2022 CI/CD: ${analysis.cicd.join(", ")}`));
|
|
693
643
|
}
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
const customConfigAction = await promptApiConfigurationAction();
|
|
702
|
-
if (customConfigAction === "modify-partial") {
|
|
703
|
-
await modifyApiConfigPartially(existingConfig);
|
|
704
|
-
return null;
|
|
705
|
-
} else if (customConfigAction === "modify-all") {
|
|
706
|
-
return await configureApiCompletely();
|
|
707
|
-
} else if (customConfigAction === "keep-existing") {
|
|
708
|
-
try {
|
|
709
|
-
addCompletedOnboarding();
|
|
710
|
-
} catch (error) {
|
|
711
|
-
console.error(a.red(i18n.t("errors:failedToSetOnboarding")), error);
|
|
712
|
-
}
|
|
713
|
-
try {
|
|
714
|
-
setPrimaryApiKey();
|
|
715
|
-
} catch (error) {
|
|
716
|
-
const { ensureI18nInitialized, i18n: i18nModule } = await import('./index5.mjs');
|
|
717
|
-
ensureI18nInitialized();
|
|
718
|
-
console.error(i18nModule.t("mcp:primaryApiKeySetFailed"), error);
|
|
719
|
-
}
|
|
720
|
-
return null;
|
|
721
|
-
}
|
|
722
|
-
} else {
|
|
723
|
-
const { apiChoice } = await inquirer.prompt({
|
|
724
|
-
type: "list",
|
|
725
|
-
name: "apiChoice",
|
|
726
|
-
message: i18n.t("api:configureApi"),
|
|
727
|
-
choices: [
|
|
728
|
-
{
|
|
729
|
-
name: `${i18n.t("api:useAuthToken")} - ${a.gray(i18n.t("api:authTokenDesc"))}`,
|
|
730
|
-
value: "auth_token",
|
|
731
|
-
short: i18n.t("api:useAuthToken")
|
|
732
|
-
},
|
|
733
|
-
{
|
|
734
|
-
name: `${i18n.t("api:useApiKey")} - ${a.gray(i18n.t("api:apiKeyDesc"))}`,
|
|
735
|
-
value: "api_key",
|
|
736
|
-
short: i18n.t("api:useApiKey")
|
|
737
|
-
}
|
|
738
|
-
]
|
|
739
|
-
});
|
|
740
|
-
if (!apiChoice) {
|
|
741
|
-
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
742
|
-
process__default.exit(0);
|
|
743
|
-
}
|
|
744
|
-
return await configureApiCompletely(apiChoice);
|
|
745
|
-
}
|
|
644
|
+
console.log("");
|
|
645
|
+
const { selectTemplates } = await import('./index13.mjs');
|
|
646
|
+
const selection = await selectTemplates(analysis);
|
|
647
|
+
console.log(a.cyan("\u{1F3AF} Template Selection:"));
|
|
648
|
+
console.log(a.gray(` \u2022 Agents: ${selection.agents.length} selected`));
|
|
649
|
+
for (const agent of selection.agents) {
|
|
650
|
+
console.log(a.gray(` - ${agent.name} (${agent.category})`));
|
|
746
651
|
}
|
|
747
|
-
|
|
748
|
-
|
|
652
|
+
console.log(a.gray(` \u2022 Skills: ${selection.skills.length} selected`));
|
|
653
|
+
for (const skill of selection.skills) {
|
|
654
|
+
console.log(a.gray(` - ${skill.name} (${skill.category})`));
|
|
749
655
|
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
656
|
+
console.log("");
|
|
657
|
+
console.log(a.cyan("\u{1F4A1} Reasoning:"));
|
|
658
|
+
console.log(
|
|
659
|
+
a.gray(
|
|
660
|
+
selection.reasoning.split("\n").map((line) => ` ${line}`).join("\n")
|
|
661
|
+
)
|
|
662
|
+
);
|
|
663
|
+
console.log("");
|
|
664
|
+
if (!options.skipPrompt && !options.yes) {
|
|
665
|
+
const shouldContinue = await promptBoolean({
|
|
666
|
+
message: "Proceed with this configuration?",
|
|
667
|
+
defaultValue: true
|
|
668
|
+
});
|
|
669
|
+
if (!shouldContinue) {
|
|
670
|
+
console.log(a.yellow("Smart initialization cancelled."));
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
754
673
|
}
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
674
|
+
console.log(a.gray("\n\u{1F527} Generating configurations...\n"));
|
|
675
|
+
const { generateConfigs, writeConfigs } = await import('./index13.mjs');
|
|
676
|
+
const config = await generateConfigs(selection);
|
|
677
|
+
await writeConfigs(config);
|
|
678
|
+
console.log(a.green("\u2714 Configurations generated successfully!"));
|
|
679
|
+
console.log(a.gray(` \u2022 ${config.agents.length} agents installed`));
|
|
680
|
+
console.log(a.gray(` \u2022 ${config.skills.length} skills installed`));
|
|
681
|
+
console.log("");
|
|
682
|
+
console.log(a.gray("Running standard initialization...\n"));
|
|
683
|
+
options.smart = false;
|
|
684
|
+
options.skipPrompt = options.skipPrompt ?? false;
|
|
685
|
+
const { init } = await Promise.resolve().then(function () { return init$1; });
|
|
686
|
+
await init(options);
|
|
687
|
+
console.log("");
|
|
688
|
+
console.log(a.bold.green("\u2705 Smart Initialization Complete!"));
|
|
689
|
+
console.log("");
|
|
690
|
+
console.log(a.cyan("\u{1F3AF} What was configured:"));
|
|
691
|
+
console.log(a.gray(" \u2022 Project-specific agents and skills"));
|
|
692
|
+
console.log(a.gray(" \u2022 Claude Code base configuration"));
|
|
693
|
+
console.log(a.gray(" \u2022 MCP services"));
|
|
694
|
+
console.log(a.gray(" \u2022 Workflows and output styles"));
|
|
695
|
+
console.log("");
|
|
696
|
+
console.log(a.cyan("\u{1F680} Next Steps:"));
|
|
697
|
+
console.log(a.gray(" 1. Run: claude"));
|
|
698
|
+
console.log(a.gray(" 2. Start coding with AI assistance!"));
|
|
699
|
+
console.log(a.gray(" 3. Use generated skills with their triggers"));
|
|
700
|
+
console.log("");
|
|
701
|
+
} catch (error) {
|
|
702
|
+
console.error(
|
|
703
|
+
a.red("\u274C Smart initialization failed:"),
|
|
704
|
+
error instanceof Error ? error.message : error
|
|
705
|
+
);
|
|
706
|
+
throw error;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
async function handleMultiConfigurations(options, codeToolType) {
|
|
711
|
+
const { ensureI18nInitialized } = await import('./index2.mjs');
|
|
712
|
+
ensureI18nInitialized();
|
|
713
|
+
try {
|
|
714
|
+
let configs = [];
|
|
715
|
+
if (options.apiConfigs) {
|
|
716
|
+
try {
|
|
717
|
+
configs = JSON.parse(options.apiConfigs);
|
|
718
|
+
} catch (error) {
|
|
719
|
+
throw new Error(
|
|
720
|
+
i18n.t("multi-config:invalidJson", {
|
|
721
|
+
error: error instanceof Error ? error.message : String(error)
|
|
722
|
+
})
|
|
723
|
+
);
|
|
763
724
|
}
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
725
|
+
}
|
|
726
|
+
if (options.apiConfigsFile) {
|
|
727
|
+
try {
|
|
728
|
+
const { readFile } = await import('./fs-operations.mjs');
|
|
729
|
+
const fileContent = readFile(options.apiConfigsFile);
|
|
730
|
+
configs = JSON.parse(fileContent);
|
|
731
|
+
} catch (error) {
|
|
732
|
+
throw new Error(
|
|
733
|
+
i18n.t("multi-config:fileReadFailed", {
|
|
734
|
+
error: error instanceof Error ? error.message : String(error)
|
|
735
|
+
})
|
|
771
736
|
);
|
|
772
737
|
}
|
|
773
738
|
}
|
|
774
|
-
|
|
775
|
-
|
|
739
|
+
await validateApiConfigs(configs);
|
|
740
|
+
if (codeToolType === "claude-code") {
|
|
741
|
+
await handleClaudeCodeConfigs(configs);
|
|
742
|
+
} else if (codeToolType === "codex") {
|
|
743
|
+
await handleCodexConfigs(configs);
|
|
776
744
|
}
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
selectedWorkflows = [options.workflows];
|
|
794
|
-
} else if (options.workflows === true) {
|
|
795
|
-
selectedWorkflows = [];
|
|
796
|
-
}
|
|
797
|
-
if (hasApiConfigs) {
|
|
798
|
-
await handleMultiConfigurations(options, "codex");
|
|
799
|
-
}
|
|
800
|
-
const resolvedAiOutputLang = await runCodexFullInit({
|
|
801
|
-
aiOutputLang: options.aiOutputLang,
|
|
802
|
-
skipPrompt: options.skipPrompt,
|
|
803
|
-
apiMode,
|
|
804
|
-
customApiConfig,
|
|
805
|
-
workflows: selectedWorkflows
|
|
806
|
-
});
|
|
807
|
-
updateZcfConfig({
|
|
808
|
-
version: ccjkVersion,
|
|
809
|
-
preferredLang: i18n.language,
|
|
810
|
-
// CCJK界面语言
|
|
811
|
-
templateLang: configLang,
|
|
812
|
-
// 模板语言
|
|
813
|
-
aiOutputLang: resolvedAiOutputLang ?? options.aiOutputLang ?? zcfConfig?.aiOutputLang ?? "en",
|
|
814
|
-
codeToolType
|
|
815
|
-
});
|
|
816
|
-
console.log(a.green(i18n.t("codex:setupComplete")));
|
|
817
|
-
return;
|
|
745
|
+
console.log(a.green(`\u2714 ${i18n.t("multi-config:configsAddedSuccessfully")}`));
|
|
746
|
+
} catch (error) {
|
|
747
|
+
displayError(error, "Multi-config setup");
|
|
748
|
+
throw error;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
async function validateApiConfigs(configs) {
|
|
752
|
+
if (!Array.isArray(configs)) {
|
|
753
|
+
throw new TypeError(i18n.t("multi-config:mustBeArray"));
|
|
754
|
+
}
|
|
755
|
+
const { getValidProviderIds } = await import('./api-providers.mjs');
|
|
756
|
+
const validProviders = [...getValidProviderIds(), "custom"];
|
|
757
|
+
const names = /* @__PURE__ */ new Set();
|
|
758
|
+
for (const config of configs) {
|
|
759
|
+
if (config.provider && !config.type) {
|
|
760
|
+
config.type = "api_key";
|
|
818
761
|
}
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
options.aiOutputLang,
|
|
822
|
-
zcfConfig,
|
|
823
|
-
options.skipPrompt
|
|
824
|
-
);
|
|
825
|
-
const installationStatus = await getInstallationStatus();
|
|
826
|
-
if (installationStatus.hasGlobal) {
|
|
827
|
-
const { verifyInstallation, displayVerificationResult } = await import('./installer.mjs');
|
|
828
|
-
const verification = await verifyInstallation("claude-code");
|
|
829
|
-
if (verification.symlinkCreated) {
|
|
830
|
-
console.log(a.green(`\u2714 ${i18n.t("installation:alreadyInstalled")}`));
|
|
831
|
-
displayVerificationResult(verification, "claude-code");
|
|
832
|
-
} else if (!verification.success) {
|
|
833
|
-
console.log(a.yellow(`\u26A0 ${i18n.t("installation:verificationFailed")}`));
|
|
834
|
-
if (verification.error) {
|
|
835
|
-
console.log(a.gray(` ${verification.error}`));
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
} else {
|
|
839
|
-
if (options.skipPrompt) {
|
|
840
|
-
await installClaudeCode(true);
|
|
841
|
-
} else {
|
|
842
|
-
const shouldInstall = await promptBoolean({
|
|
843
|
-
message: i18n.t("installation:installPrompt"),
|
|
844
|
-
defaultValue: true
|
|
845
|
-
});
|
|
846
|
-
if (shouldInstall) {
|
|
847
|
-
await installClaudeCode(false);
|
|
848
|
-
} else {
|
|
849
|
-
console.log(a.yellow(i18n.t("common:skip")));
|
|
850
|
-
}
|
|
851
|
-
}
|
|
762
|
+
if (config.provider && !config.name) {
|
|
763
|
+
config.name = config.provider.toUpperCase();
|
|
852
764
|
}
|
|
853
|
-
if (
|
|
854
|
-
|
|
765
|
+
if (!config.provider && !config.type) {
|
|
766
|
+
throw new Error(i18n.t("multi-config:providerOrTypeRequired"));
|
|
855
767
|
}
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
const shouldMigrate = await promptMigration();
|
|
864
|
-
if (shouldMigrate) {
|
|
865
|
-
const result = migrateSettingsForTokenRetrieval();
|
|
866
|
-
displayMigrationResult(result);
|
|
867
|
-
}
|
|
868
|
-
}
|
|
768
|
+
if (config.provider && !validProviders.includes(config.provider)) {
|
|
769
|
+
throw new Error(
|
|
770
|
+
i18n.t("errors:invalidProvider", {
|
|
771
|
+
provider: config.provider,
|
|
772
|
+
validProviders: validProviders.join(", ")
|
|
773
|
+
})
|
|
774
|
+
);
|
|
869
775
|
}
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
if (options.skipPrompt) {
|
|
873
|
-
action = options.configAction || "backup";
|
|
874
|
-
if (action === "skip") {
|
|
875
|
-
console.log(a.yellow(i18n.t("common:skip")));
|
|
876
|
-
return;
|
|
877
|
-
}
|
|
878
|
-
} else {
|
|
879
|
-
const { action: userAction } = await inquirer.prompt({
|
|
880
|
-
type: "list",
|
|
881
|
-
name: "action",
|
|
882
|
-
message: i18n.t("configuration:existingConfig"),
|
|
883
|
-
choices: addNumbersToChoices([
|
|
884
|
-
{ name: i18n.t("configuration:backupAndOverwrite"), value: "backup" },
|
|
885
|
-
{ name: i18n.t("configuration:updateDocsOnly"), value: "docs-only" },
|
|
886
|
-
{ name: i18n.t("configuration:mergeConfig"), value: "merge" },
|
|
887
|
-
{ name: i18n.t("common:skip"), value: "skip" }
|
|
888
|
-
])
|
|
889
|
-
});
|
|
890
|
-
if (!userAction) {
|
|
891
|
-
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
892
|
-
process__default.exit(0);
|
|
893
|
-
}
|
|
894
|
-
action = userAction;
|
|
895
|
-
if (action === "skip") {
|
|
896
|
-
console.log(a.yellow(i18n.t("common:skip")));
|
|
897
|
-
return;
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
} else if (options.skipPrompt && options.configAction) {
|
|
901
|
-
action = options.configAction;
|
|
776
|
+
if (!config.name || typeof config.name !== "string" || config.name.trim() === "") {
|
|
777
|
+
throw new Error(i18n.t("multi-config:mustHaveValidName"));
|
|
902
778
|
}
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
779
|
+
if (!["api_key", "auth_token", "ccr_proxy"].includes(config.type)) {
|
|
780
|
+
throw new Error(i18n.t("multi-config:invalidAuthType", { type: config.type }));
|
|
781
|
+
}
|
|
782
|
+
if (names.has(config.name)) {
|
|
783
|
+
throw new Error(i18n.t("multi-config:duplicateName", { name: config.name }));
|
|
784
|
+
}
|
|
785
|
+
names.add(config.name);
|
|
786
|
+
if (config.type !== "ccr_proxy" && !config.key) {
|
|
787
|
+
throw new Error(i18n.t("multi-config:configApiKeyRequired", { name: config.name }));
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
async function handleClaudeCodeConfigs(configs) {
|
|
792
|
+
const { ClaudeCodeConfigManager } = await import('./claude-code-config-manager.mjs');
|
|
793
|
+
const addedProfiles = [];
|
|
794
|
+
for (const config of configs) {
|
|
795
|
+
if (config.type === "ccr_proxy") {
|
|
796
|
+
throw new Error(i18n.t("multi-config:ccrProxyReserved", { name: config.name }));
|
|
797
|
+
}
|
|
798
|
+
const profile = await convertToClaudeCodeProfile(config);
|
|
799
|
+
const result = await ClaudeCodeConfigManager.addProfile(profile);
|
|
800
|
+
if (!result.success) {
|
|
801
|
+
throw new Error(
|
|
802
|
+
i18n.t("multi-config:configProfileAddFailed", { name: config.name, error: result.error })
|
|
911
803
|
);
|
|
804
|
+
}
|
|
805
|
+
const storedProfile = result.addedProfile || ClaudeCodeConfigManager.getProfileByName(config.name) || profile;
|
|
806
|
+
addedProfiles.push(storedProfile);
|
|
807
|
+
console.log(a.green(`\u2714 ${i18n.t("multi-config:profileAdded", { name: config.name })}`));
|
|
808
|
+
}
|
|
809
|
+
if (addedProfiles.length > 0) {
|
|
810
|
+
const summary = addedProfiles.map((profile) => `${profile.name} [${profile.authType}]`).join(", ");
|
|
811
|
+
console.log(a.gray(` \u2022 ${ClaudeCodeConfigManager.CONFIG_FILE}: ${summary}`));
|
|
812
|
+
}
|
|
813
|
+
const defaultConfig = configs.find((c) => c.default);
|
|
814
|
+
if (defaultConfig) {
|
|
815
|
+
const profile = addedProfiles.find((p) => p.name === defaultConfig.name) || ClaudeCodeConfigManager.getProfileByName(defaultConfig.name);
|
|
816
|
+
if (profile && profile.id) {
|
|
817
|
+
await ClaudeCodeConfigManager.switchProfile(profile.id);
|
|
818
|
+
await ClaudeCodeConfigManager.applyProfileSettings(profile);
|
|
912
819
|
console.log(
|
|
913
|
-
a.
|
|
914
|
-
isZh ? "\u53EF\u540C\u6B65\u4F18\u5316\u89C4\u5212\u3001\u9A8C\u8BC1\u3001\u5B50\u4EE3\u7406\u4E0E\u89C4\u5219\u6267\u884C\u8D28\u91CF\uFF0C\u5EFA\u8BAE\u9996\u6B21\u5B89\u88C5\u7ACB\u5373\u542F\u7528\u3002" : "Improves planning, verification, subagent strategy, and rule execution quality. Recommended on first install."
|
|
915
|
-
)
|
|
820
|
+
a.green(`\u2714 ${i18n.t("multi-config:defaultProfileSet", { name: defaultConfig.name })}`)
|
|
916
821
|
);
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
console.log(
|
|
943
|
-
a.green(
|
|
944
|
-
`\u2714 ${isZh ? "\u5DF2\u8BBE\u4E3A\u9ED8\u8BA4\u9996\u9009" : "Set as default first choice"}: ${orchestrationChoice}`
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
await ClaudeCodeConfigManager.syncCcrProfile();
|
|
825
|
+
}
|
|
826
|
+
async function handleCodexConfigs(configs) {
|
|
827
|
+
const { addProviderToExisting } = await import('./codex-provider-manager.mjs');
|
|
828
|
+
const addedProviderIds = [];
|
|
829
|
+
for (const config of configs) {
|
|
830
|
+
try {
|
|
831
|
+
const provider = await convertToCodexProvider(config);
|
|
832
|
+
const result = await addProviderToExisting(provider, config.key || "");
|
|
833
|
+
if (!result.success) {
|
|
834
|
+
throw new Error(
|
|
835
|
+
i18n.t("multi-config:providerAddFailed", { name: config.name, error: result.error })
|
|
836
|
+
);
|
|
837
|
+
}
|
|
838
|
+
addedProviderIds.push(provider.id);
|
|
839
|
+
console.log(a.green(`\u2714 ${i18n.t("multi-config:providerAdded", { name: config.name })}`));
|
|
840
|
+
} catch (error) {
|
|
841
|
+
console.error(
|
|
842
|
+
a.red(
|
|
843
|
+
i18n.t("multi-config:providerAddFailed", {
|
|
844
|
+
name: config.name,
|
|
845
|
+
error: error instanceof Error ? error.message : String(error)
|
|
846
|
+
})
|
|
945
847
|
)
|
|
946
848
|
);
|
|
849
|
+
throw error;
|
|
947
850
|
}
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
} else if (options.provider && options.apiKey) {
|
|
957
|
-
const { getProviderPreset } = await import('./api-providers.mjs');
|
|
958
|
-
const preset = options.provider !== "custom" ? getProviderPreset(options.provider) : null;
|
|
959
|
-
apiConfig = {
|
|
960
|
-
authType: preset?.claudeCode?.authType || "api_key",
|
|
961
|
-
key: options.apiKey,
|
|
962
|
-
url: preset?.claudeCode?.baseUrl || options.apiUrl || API_DEFAULT_URL
|
|
963
|
-
};
|
|
964
|
-
await saveSingleConfigToToml(apiConfig, options.provider, options);
|
|
965
|
-
} else if (options.apiType === "auth_token" && options.apiKey) {
|
|
966
|
-
apiConfig = {
|
|
967
|
-
authType: "auth_token",
|
|
968
|
-
key: options.apiKey,
|
|
969
|
-
url: options.apiUrl || API_DEFAULT_URL
|
|
970
|
-
};
|
|
971
|
-
await saveSingleConfigToToml(apiConfig, void 0, options);
|
|
972
|
-
} else if (options.apiType === "api_key" && options.apiKey) {
|
|
973
|
-
apiConfig = {
|
|
974
|
-
authType: "api_key",
|
|
975
|
-
key: options.apiKey,
|
|
976
|
-
url: options.apiUrl || API_DEFAULT_URL
|
|
977
|
-
};
|
|
978
|
-
await saveSingleConfigToToml(apiConfig, void 0, options);
|
|
979
|
-
} else if (options.apiType === "ccr_proxy") {
|
|
980
|
-
const ccrStatus = await isCcrInstalled();
|
|
981
|
-
if (!ccrStatus.hasCorrectPackage) {
|
|
982
|
-
await installCcr();
|
|
983
|
-
} else {
|
|
984
|
-
console.log(a.green(`\u2714 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
|
|
985
|
-
}
|
|
986
|
-
const existingCcrConfig = readCcrConfig();
|
|
987
|
-
if (existingCcrConfig) {
|
|
988
|
-
const backupPath = await backupCcrConfig();
|
|
989
|
-
if (backupPath) {
|
|
990
|
-
console.log(a.gray(`\u2714 ${i18n.t("ccr:ccrBackupSuccess")}: ${backupPath}`));
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
const defaultCcrConfig = createDefaultCcrConfig();
|
|
994
|
-
writeCcrConfig(defaultCcrConfig);
|
|
995
|
-
console.log(a.green(`\u2714 ${i18n.t("ccr:ccrConfigSuccess")}`));
|
|
996
|
-
await configureCcrProxy(defaultCcrConfig);
|
|
997
|
-
console.log(a.green(`\u2714 ${i18n.t("ccr:proxyConfigSuccess")}`));
|
|
998
|
-
try {
|
|
999
|
-
addCompletedOnboarding();
|
|
1000
|
-
} catch (error) {
|
|
1001
|
-
console.error(a.red(i18n.t("errors:failedToSetOnboarding")), error);
|
|
1002
|
-
}
|
|
1003
|
-
apiConfig = null;
|
|
1004
|
-
}
|
|
1005
|
-
} else {
|
|
1006
|
-
const existingApiConfig = getExistingApiConfig();
|
|
1007
|
-
const apiMode = await selectApiConfigurationMode();
|
|
1008
|
-
switch (apiMode) {
|
|
1009
|
-
case "official": {
|
|
1010
|
-
const success = switchToOfficialLogin();
|
|
1011
|
-
if (success) {
|
|
1012
|
-
console.log(a.green(`\u2714 ${i18n.t("api:officialLoginConfigured")}`));
|
|
1013
|
-
apiConfig = null;
|
|
1014
|
-
} else {
|
|
1015
|
-
console.log(a.red(i18n.t("api:officialLoginFailed")));
|
|
1016
|
-
}
|
|
1017
|
-
break;
|
|
1018
|
-
}
|
|
1019
|
-
case "custom":
|
|
1020
|
-
apiConfig = await handleCustomApiConfiguration(existingApiConfig);
|
|
1021
|
-
break;
|
|
1022
|
-
case "ccr": {
|
|
1023
|
-
const ccrStatus = await isCcrInstalled();
|
|
1024
|
-
if (!ccrStatus.hasCorrectPackage) {
|
|
1025
|
-
await installCcr();
|
|
1026
|
-
} else {
|
|
1027
|
-
console.log(a.green(`\u2714 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
|
|
1028
|
-
}
|
|
1029
|
-
const ccrConfigured = await setupCcrConfiguration();
|
|
1030
|
-
if (ccrConfigured) {
|
|
1031
|
-
console.log(a.green(`\u2714 ${i18n.t("ccr:ccrSetupComplete")}`));
|
|
1032
|
-
apiConfig = null;
|
|
1033
|
-
}
|
|
1034
|
-
break;
|
|
1035
|
-
}
|
|
1036
|
-
case "skip":
|
|
1037
|
-
apiConfig = null;
|
|
1038
|
-
break;
|
|
1039
|
-
default:
|
|
1040
|
-
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
1041
|
-
process__default.exit(0);
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
if (["backup", "docs-only", "merge"].includes(action)) {
|
|
1046
|
-
const backupDir = backupExistingConfig();
|
|
1047
|
-
if (backupDir) {
|
|
1048
|
-
console.log(a.gray(`\u2714 ${i18n.t("configuration:backupSuccess")}: ${backupDir}`));
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
if (action === "docs-only") {
|
|
1052
|
-
copyConfigFiles(true);
|
|
1053
|
-
if (options.skipPrompt) {
|
|
1054
|
-
if (options.workflows !== false) {
|
|
1055
|
-
await selectAndInstallWorkflows(configLang, options.workflows);
|
|
1056
|
-
}
|
|
1057
|
-
} else {
|
|
1058
|
-
await selectAndInstallWorkflows(configLang);
|
|
1059
|
-
}
|
|
1060
|
-
} else if (["backup", "merge", "new"].includes(action)) {
|
|
1061
|
-
copyConfigFiles(false);
|
|
1062
|
-
if (options.skipPrompt) {
|
|
1063
|
-
if (options.workflows !== false) {
|
|
1064
|
-
await selectAndInstallWorkflows(configLang, options.workflows);
|
|
1065
|
-
}
|
|
1066
|
-
} else {
|
|
1067
|
-
await selectAndInstallWorkflows(configLang);
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
|
-
applyAiLanguageDirective(aiOutputLang);
|
|
1071
|
-
if (options.skipPrompt) {
|
|
1072
|
-
if (options.outputStyles !== false) {
|
|
1073
|
-
await configureOutputStyle(options.outputStyles, options.defaultOutputStyle);
|
|
1074
|
-
}
|
|
1075
|
-
} else {
|
|
1076
|
-
await configureOutputStyle();
|
|
1077
|
-
}
|
|
1078
|
-
if (apiConfig && action !== "docs-only") {
|
|
1079
|
-
const configuredApi = configureApi(apiConfig);
|
|
1080
|
-
if (configuredApi) {
|
|
1081
|
-
console.log(a.green(`\u2714 ${i18n.t("api:apiConfigSuccess")}`));
|
|
1082
|
-
console.log(a.gray(` URL: ${configuredApi.url}`));
|
|
1083
|
-
console.log(a.gray(` Key: ${formatApiKeyDisplay(configuredApi.key)}`));
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
|
-
const hasModelParams = options.apiModel || options.apiHaikuModel || options.apiSonnetModel || options.apiOpusModel;
|
|
1087
|
-
if (hasModelParams && action !== "docs-only" && codeToolType === "claude-code") {
|
|
1088
|
-
if (options.skipPrompt) {
|
|
1089
|
-
const { updateCustomModel } = await import('./config.mjs').then(function (n) { return n.j; });
|
|
1090
|
-
updateCustomModel(
|
|
1091
|
-
options.apiModel || void 0,
|
|
1092
|
-
options.apiHaikuModel || void 0,
|
|
1093
|
-
options.apiSonnetModel || void 0,
|
|
1094
|
-
options.apiOpusModel || void 0
|
|
1095
|
-
);
|
|
1096
|
-
console.log(a.green(`\u2714 ${i18n.t("api:modelConfigSuccess")}`));
|
|
1097
|
-
if (options.apiModel) {
|
|
1098
|
-
console.log(a.gray(` ${i18n.t("api:primaryModel")}: ${options.apiModel}`));
|
|
1099
|
-
}
|
|
1100
|
-
if (options.apiHaikuModel)
|
|
1101
|
-
console.log(a.gray(` Haiku: ${options.apiHaikuModel}`));
|
|
1102
|
-
if (options.apiSonnetModel)
|
|
1103
|
-
console.log(a.gray(` Sonnet: ${options.apiSonnetModel}`));
|
|
1104
|
-
if (options.apiOpusModel)
|
|
1105
|
-
console.log(a.gray(` Opus: ${options.apiOpusModel}`));
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
if (!options.skipPrompt && !options.skipBanner)
|
|
1109
|
-
tracker.nextStep("Installing MCP services");
|
|
1110
|
-
if (action !== "docs-only") {
|
|
1111
|
-
let shouldConfigureMcp = false;
|
|
1112
|
-
if (options.skipPrompt) {
|
|
1113
|
-
shouldConfigureMcp = options.mcpServices !== false;
|
|
1114
|
-
} else {
|
|
1115
|
-
const userChoice = await promptBoolean({
|
|
1116
|
-
message: i18n.t("mcp:configureMcp"),
|
|
1117
|
-
defaultValue: true
|
|
1118
|
-
});
|
|
1119
|
-
shouldConfigureMcp = userChoice;
|
|
1120
|
-
}
|
|
1121
|
-
if (shouldConfigureMcp) {
|
|
1122
|
-
if (isWindows()) {
|
|
1123
|
-
console.log(a.green(`\u2139 ${i18n.t("installation:windowsDetected")}`));
|
|
1124
|
-
}
|
|
1125
|
-
let selectedServices;
|
|
1126
|
-
if (options.skipPrompt) {
|
|
1127
|
-
selectedServices = options.mcpServices;
|
|
1128
|
-
} else {
|
|
1129
|
-
selectedServices = await selectMcpServices();
|
|
1130
|
-
if (selectedServices === void 0) {
|
|
1131
|
-
process__default.exit(0);
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
if (selectedServices.length > 0) {
|
|
1135
|
-
const mcpBackupPath = backupMcpConfig();
|
|
1136
|
-
if (mcpBackupPath) {
|
|
1137
|
-
console.log(a.gray(`\u2714 ${i18n.t("mcp:mcpBackupSuccess")}: ${mcpBackupPath}`));
|
|
1138
|
-
}
|
|
1139
|
-
const newServers = {};
|
|
1140
|
-
for (const serviceId of selectedServices) {
|
|
1141
|
-
const services = await getMcpServices();
|
|
1142
|
-
const service = services.find((s) => s.id === serviceId);
|
|
1143
|
-
if (!service)
|
|
1144
|
-
continue;
|
|
1145
|
-
let config = service.config;
|
|
1146
|
-
if (service.id === "serena" && Array.isArray(config.args)) {
|
|
1147
|
-
const adjusted = { ...config, args: [...config.args || []] };
|
|
1148
|
-
const idx = adjusted.args.indexOf("--context");
|
|
1149
|
-
if (idx >= 0 && idx + 1 < adjusted.args.length) {
|
|
1150
|
-
adjusted.args[idx + 1] = codeToolType === "codex" ? "codex" : "ide-assistant";
|
|
1151
|
-
} else {
|
|
1152
|
-
adjusted.args.push(
|
|
1153
|
-
"--context",
|
|
1154
|
-
codeToolType === "codex" ? "codex" : "ide-assistant"
|
|
1155
|
-
);
|
|
1156
|
-
}
|
|
1157
|
-
config = adjusted;
|
|
1158
|
-
}
|
|
1159
|
-
if (service.requiresApiKey) {
|
|
1160
|
-
if (options.skipPrompt) {
|
|
1161
|
-
console.log(
|
|
1162
|
-
a.yellow(`${i18n.t("common:skip")}: ${service.name} (requires API key)`)
|
|
1163
|
-
);
|
|
1164
|
-
continue;
|
|
1165
|
-
} else {
|
|
1166
|
-
const response = await inquirer.prompt({
|
|
1167
|
-
type: "input",
|
|
1168
|
-
name: "apiKey",
|
|
1169
|
-
message: service.apiKeyPrompt,
|
|
1170
|
-
validate: (value) => !!value || i18n.t("api:keyRequired")
|
|
1171
|
-
});
|
|
1172
|
-
if (!response.apiKey) {
|
|
1173
|
-
console.log(a.yellow(`${i18n.t("common:skip")}: ${service.name}`));
|
|
1174
|
-
continue;
|
|
1175
|
-
}
|
|
1176
|
-
config = buildMcpServerConfig(
|
|
1177
|
-
service.config,
|
|
1178
|
-
response.apiKey,
|
|
1179
|
-
service.apiKeyPlaceholder,
|
|
1180
|
-
service.apiKeyEnvVar
|
|
1181
|
-
);
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
newServers[service.id] = config;
|
|
1185
|
-
}
|
|
1186
|
-
const existingConfig = readMcpConfig();
|
|
1187
|
-
let mergedConfig = replaceMcpServers(existingConfig, newServers);
|
|
1188
|
-
mergedConfig = fixWindowsMcpConfig(mergedConfig);
|
|
1189
|
-
try {
|
|
1190
|
-
writeMcpConfig(mergedConfig);
|
|
1191
|
-
syncMcpPermissions();
|
|
1192
|
-
console.log(a.green(`\u2714 ${i18n.t("mcp:mcpConfigSuccess")}`));
|
|
1193
|
-
const { checkMcpPerformance, formatPerformanceWarning } = await import('./mcp-performance.mjs').then(function (n) { return n.e; });
|
|
1194
|
-
const serviceCount = Object.keys(newServers).length;
|
|
1195
|
-
const perfWarning = checkMcpPerformance(serviceCount);
|
|
1196
|
-
if (perfWarning) {
|
|
1197
|
-
console.log("");
|
|
1198
|
-
console.log(formatPerformanceWarning(perfWarning, i18n.language));
|
|
1199
|
-
}
|
|
1200
|
-
} catch (error) {
|
|
1201
|
-
displayError(error, "MCP configuration");
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
|
-
const cometixInstalled = await isCometixLineInstalled();
|
|
1207
|
-
if (!cometixInstalled) {
|
|
1208
|
-
let shouldInstallCometix = false;
|
|
1209
|
-
if (options.skipPrompt) {
|
|
1210
|
-
shouldInstallCometix = options.installCometixLine !== false;
|
|
1211
|
-
} else {
|
|
1212
|
-
const userChoice = await promptBoolean({
|
|
1213
|
-
message: i18n.t("cometix:installCometixPrompt"),
|
|
1214
|
-
defaultValue: true
|
|
1215
|
-
});
|
|
1216
|
-
shouldInstallCometix = userChoice;
|
|
1217
|
-
}
|
|
1218
|
-
if (shouldInstallCometix) {
|
|
1219
|
-
await installCometixLine();
|
|
1220
|
-
} else {
|
|
1221
|
-
console.log(a.yellow(i18n.t("cometix:cometixSkipped")));
|
|
1222
|
-
}
|
|
1223
|
-
} else {
|
|
1224
|
-
console.log(a.green(`\u2714 ${i18n.t("cometix:cometixAlreadyInstalled")}`));
|
|
1225
|
-
}
|
|
1226
|
-
if (!options.skipPrompt || options.installSuperpowers) {
|
|
1227
|
-
await handleSuperpowersInstallation(options);
|
|
1228
|
-
}
|
|
1229
|
-
let agentBrowserReady = false;
|
|
1230
|
-
try {
|
|
1231
|
-
const isZh = i18n.language === "zh-CN";
|
|
1232
|
-
let shouldInstallAgentBrowser = false;
|
|
1233
|
-
if (options.skipPrompt) {
|
|
1234
|
-
shouldInstallAgentBrowser = options.installAgentBrowser !== false;
|
|
1235
|
-
} else {
|
|
1236
|
-
shouldInstallAgentBrowser = await promptBoolean({
|
|
1237
|
-
message: isZh ? "\u5B89\u88C5 Agent Browser \u6D4F\u89C8\u5668\u81EA\u52A8\u5316\u6A21\u5757\uFF1F\uFF08\u63A8\u8350\uFF0C\u6D4F\u89C8\u5668\u4EFB\u52A1\u53EF\u65E0\u7F1D\u4F7F\u7528\uFF09" : "Install Agent Browser module? (recommended for seamless browser automation)",
|
|
1238
|
-
defaultValue: true
|
|
1239
|
-
});
|
|
1240
|
-
}
|
|
1241
|
-
if (shouldInstallAgentBrowser) {
|
|
1242
|
-
const { checkAgentBrowserInstalled, installAgentBrowser } = await import('./installer2.mjs');
|
|
1243
|
-
const installed = await checkAgentBrowserInstalled();
|
|
1244
|
-
const success = installed ? true : await installAgentBrowser();
|
|
1245
|
-
if (success) {
|
|
1246
|
-
const { addSkill } = await import('./manager.mjs');
|
|
1247
|
-
const { browserSkill } = await import('./skill.mjs');
|
|
1248
|
-
addSkill(browserSkill);
|
|
1249
|
-
agentBrowserReady = true;
|
|
1250
|
-
console.log(
|
|
1251
|
-
a.green(
|
|
1252
|
-
`\u2714 ${isZh ? "Agent Browser \u5DF2\u5C31\u7EEA\uFF0C\u6D4F\u89C8\u5668 Skill \u5DF2\u542F\u7528" : "Agent Browser ready, browser skill enabled"}`
|
|
1253
|
-
)
|
|
1254
|
-
);
|
|
1255
|
-
console.log(
|
|
1256
|
-
a.gray(
|
|
1257
|
-
` ${isZh ? "\u53EF\u76F4\u63A5\u4F7F\u7528:" : "Use directly:"} ccjk browser start https://example.com`
|
|
1258
|
-
)
|
|
1259
|
-
);
|
|
1260
|
-
}
|
|
1261
|
-
} else {
|
|
1262
|
-
console.log(
|
|
1263
|
-
a.yellow(
|
|
1264
|
-
isZh ? "\u26A0 \u5DF2\u8DF3\u8FC7 Agent Browser \u5B89\u88C5" : "\u26A0 Agent Browser installation skipped"
|
|
1265
|
-
)
|
|
1266
|
-
);
|
|
1267
|
-
}
|
|
1268
|
-
} catch (error) {
|
|
1269
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
1270
|
-
console.log(a.gray(`\u2139 Agent Browser setup skipped: ${msg}`));
|
|
1271
|
-
}
|
|
1272
|
-
try {
|
|
1273
|
-
const { injectSmartGuide } = await import('./smart-guide.mjs');
|
|
1274
|
-
const smartGuideSuccess = await injectSmartGuide(configLang);
|
|
1275
|
-
if (smartGuideSuccess) {
|
|
1276
|
-
console.log(a.green(`\u2714 ${i18n.t("smartGuide:enabled")}`));
|
|
1277
|
-
}
|
|
1278
|
-
} catch {
|
|
1279
|
-
console.log(a.gray(`\u2139 ${i18n.t("smartGuide:skipped")}`));
|
|
1280
|
-
}
|
|
1281
|
-
try {
|
|
1282
|
-
const finalOrchestrationLevel = parseOrchestrationLevel(options.orchestration);
|
|
1283
|
-
const policyPath = writeOrchestrationPolicy({
|
|
1284
|
-
level: finalOrchestrationLevel,
|
|
1285
|
-
language: configLang,
|
|
1286
|
-
source: options.initSource
|
|
1287
|
-
});
|
|
1288
|
-
console.log(
|
|
1289
|
-
a.green(`\u2714 Workflow orchestration: ${finalOrchestrationLevel} (${policyPath})`)
|
|
1290
|
-
);
|
|
1291
|
-
} catch (error) {
|
|
1292
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
1293
|
-
console.log(a.gray(`\u2139 Workflow orchestration skipped: ${msg}`));
|
|
1294
|
-
}
|
|
1295
|
-
if (!options.skipPrompt && !options.skipBanner)
|
|
1296
|
-
tracker.nextStep("Finalizing setup");
|
|
1297
|
-
updateZcfConfig({
|
|
1298
|
-
version: ccjkVersion,
|
|
1299
|
-
preferredLang: i18n.language,
|
|
1300
|
-
// CCJK界面语言
|
|
1301
|
-
templateLang: configLang,
|
|
1302
|
-
// 模板语言
|
|
1303
|
-
aiOutputLang,
|
|
1304
|
-
codeToolType
|
|
1305
|
-
});
|
|
1306
|
-
if (!options.skipPrompt) {
|
|
1307
|
-
const { importRecommendedEnv, importRecommendedPermissions } = await import('./simple-config.mjs');
|
|
1308
|
-
const confirmImport = await promptBoolean({
|
|
1309
|
-
message: i18n.t("configuration:recommendImportEnvPerm") || "\u5BFC\u5165 CCJK \u63A8\u8350\u7684\u73AF\u5883\u53D8\u91CF\u548C\u6743\u9650\u914D\u7F6E\uFF1F\uFF08\u63A8\u8350\uFF0C\u53EF\u51CF\u5C11\u6743\u9650\u5F39\u7A97\uFF09",
|
|
1310
|
-
defaultValue: true
|
|
1311
|
-
});
|
|
1312
|
-
if (confirmImport) {
|
|
1313
|
-
try {
|
|
1314
|
-
await importRecommendedEnv();
|
|
1315
|
-
console.log(a.green(`\u2714 ${i18n.t("configuration:envImportSuccess")}`));
|
|
1316
|
-
} catch (error) {
|
|
1317
|
-
console.error(a.yellow(`\u26A0 ${i18n.t("configuration:envImportFailed")}: ${error}`));
|
|
1318
|
-
}
|
|
1319
|
-
try {
|
|
1320
|
-
await importRecommendedPermissions();
|
|
1321
|
-
console.log(
|
|
1322
|
-
a.green(`\u2714 ${i18n.t("configuration:permissionsImportSuccess") || "\u6743\u9650\u914D\u7F6E\u5DF2\u5BFC\u5165"}`)
|
|
1323
|
-
);
|
|
1324
|
-
} catch (error) {
|
|
1325
|
-
console.error(
|
|
1326
|
-
a.yellow(`\u26A0 ${i18n.t("configuration:permissionsImportFailed")}: ${error}`)
|
|
1327
|
-
);
|
|
1328
|
-
}
|
|
1329
|
-
console.log();
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
if (!options.skipPrompt && !options.skipBanner)
|
|
1333
|
-
tracker.complete();
|
|
1334
|
-
console.log("");
|
|
1335
|
-
console.log(
|
|
1336
|
-
a.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")
|
|
1337
|
-
);
|
|
1338
|
-
console.log(
|
|
1339
|
-
a.bold.green("\u2551") + a.bold.white(padToDisplayWidth(` ${i18n.t("configuration:setupCompleteTitle")}`, 62)) + a.bold.green("\u2551")
|
|
1340
|
-
);
|
|
1341
|
-
console.log(
|
|
1342
|
-
a.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")
|
|
1343
|
-
);
|
|
1344
|
-
console.log(
|
|
1345
|
-
`${a.bold.green("\u2551")} ${a.bold.green("\u2551")}`
|
|
1346
|
-
);
|
|
1347
|
-
console.log(
|
|
1348
|
-
a.bold.green("\u2551") + a.green(padToDisplayWidth(` ${i18n.t("configuration:nextSteps")}`, 62)) + a.bold.green("\u2551")
|
|
1349
|
-
);
|
|
1350
|
-
console.log(
|
|
1351
|
-
`${a.bold.green("\u2551")} ${a.bold.green("\u2551")}`
|
|
1352
|
-
);
|
|
1353
|
-
console.log(
|
|
1354
|
-
a.bold.green("\u2551") + padToDisplayWidth(` ${i18n.t("configuration:guidanceStep1")}`, 62) + a.bold.green("\u2551")
|
|
1355
|
-
);
|
|
1356
|
-
console.log(
|
|
1357
|
-
a.bold.green("\u2551") + a.dim(padToDisplayWidth(` ${i18n.t("configuration:guidanceStep1Detail")}`, 62)) + a.bold.green("\u2551")
|
|
1358
|
-
);
|
|
1359
|
-
console.log(
|
|
1360
|
-
a.bold.green("\u2551") + a.dim(padToDisplayWidth(` ${i18n.t("configuration:guidanceStep1Detail2")}`, 62)) + a.bold.green("\u2551")
|
|
1361
|
-
);
|
|
1362
|
-
console.log(
|
|
1363
|
-
`${a.bold.green("\u2551")} ${a.bold.green("\u2551")}`
|
|
1364
|
-
);
|
|
1365
|
-
console.log(
|
|
1366
|
-
a.bold.green("\u2551") + padToDisplayWidth(` ${i18n.t("configuration:guidanceStep2")}`, 62) + a.bold.green("\u2551")
|
|
1367
|
-
);
|
|
1368
|
-
console.log(
|
|
1369
|
-
a.bold.green("\u2551") + a.green(padToDisplayWidth(` ${i18n.t("configuration:guidanceStep2Example")}`, 62)) + a.bold.green("\u2551")
|
|
1370
|
-
);
|
|
1371
|
-
console.log(
|
|
1372
|
-
`${a.bold.green("\u2551")} ${a.bold.green("\u2551")}`
|
|
1373
|
-
);
|
|
1374
|
-
console.log(
|
|
1375
|
-
a.bold.green("\u2551") + padToDisplayWidth(` ${i18n.t("configuration:guidanceStep3")} `, 44) + a.yellow(padToDisplayWidth(i18n.t("configuration:guidanceStep3Command"), 18)) + a.bold.green("\u2551")
|
|
1376
|
-
);
|
|
1377
|
-
console.log(
|
|
1378
|
-
a.bold.green("\u2551") + padToDisplayWidth(` ${i18n.t("configuration:guidanceStep4")} `, 44) + a.yellow(padToDisplayWidth(i18n.t("configuration:guidanceStep4Command"), 18)) + a.bold.green("\u2551")
|
|
1379
|
-
);
|
|
1380
|
-
console.log(
|
|
1381
|
-
`${a.bold.green("\u2551")} ${a.bold.green("\u2551")}`
|
|
1382
|
-
);
|
|
1383
|
-
console.log(
|
|
1384
|
-
a.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")
|
|
1385
|
-
);
|
|
1386
|
-
if (isNewInstall || ["backup", "merge", "new"].includes(action)) {
|
|
1387
|
-
const isZh = i18n.language === "zh-CN";
|
|
1388
|
-
console.log(
|
|
1389
|
-
a.cyan(
|
|
1390
|
-
isZh ? "\u{1F9E0} \u4E0A\u4E0B\u6587\u4F18\u5316\u5DF2\u542F\u7528\uFF08\u9ED8\u8BA4\uFF09" : "\u{1F9E0} Context optimization is enabled (default)"
|
|
1391
|
-
)
|
|
1392
|
-
);
|
|
851
|
+
}
|
|
852
|
+
const defaultConfig = configs.find((c) => c.default);
|
|
853
|
+
if (defaultConfig) {
|
|
854
|
+
const { switchCodexProvider } = await import('./codex.mjs').then(function (n) { return n.v; });
|
|
855
|
+
const displayName = defaultConfig.name || defaultConfig.provider || "custom";
|
|
856
|
+
const providerId = displayName.toLowerCase().replace(/[^a-z0-9]/g, "-");
|
|
857
|
+
if (addedProviderIds.includes(providerId)) {
|
|
858
|
+
await switchCodexProvider(providerId);
|
|
1393
859
|
console.log(
|
|
1394
|
-
a.
|
|
1395
|
-
isZh ? " \u5EFA\u8BAE\u7ACB\u5373\u8FD0\u884C: ccjk morning \u67E5\u770B\u5065\u5EB7\u5206\u4E0E\u6536\u76CA\u6458\u8981" : " Recommended now: ccjk morning to view health score and value summary"
|
|
1396
|
-
)
|
|
860
|
+
a.green(`\u2714 ${i18n.t("multi-config:defaultProviderSet", { name: displayName })}`)
|
|
1397
861
|
);
|
|
862
|
+
} else {
|
|
1398
863
|
console.log(
|
|
1399
|
-
a.
|
|
1400
|
-
|
|
864
|
+
a.red(
|
|
865
|
+
i18n.t("multi-config:providerAddFailed", {
|
|
866
|
+
name: displayName,
|
|
867
|
+
error: "provider not added"
|
|
868
|
+
})
|
|
1401
869
|
)
|
|
1402
870
|
);
|
|
1403
|
-
if (agentBrowserReady) {
|
|
1404
|
-
console.log(
|
|
1405
|
-
a.cyan(
|
|
1406
|
-
isZh ? "\u{1F310} \u6D4F\u89C8\u5668\u81EA\u52A8\u5316\u5DF2\u5C31\u7EEA\uFF08\u65E0\u7F1D\uFF09" : "\u{1F310} Browser automation is ready (seamless)"
|
|
1407
|
-
)
|
|
1408
|
-
);
|
|
1409
|
-
console.log(
|
|
1410
|
-
a.dim(
|
|
1411
|
-
isZh ? " \u76F4\u63A5\u5F00\u59CB: ccjk browser start https://example.com" : " Start directly: ccjk browser start https://example.com"
|
|
1412
|
-
)
|
|
1413
|
-
);
|
|
1414
|
-
console.log(
|
|
1415
|
-
a.dim(
|
|
1416
|
-
isZh ? " \u5E38\u7528\u64CD\u4F5C: ccjk browser status | ccjk browser stop" : " Common actions: ccjk browser status | ccjk browser stop"
|
|
1417
|
-
)
|
|
1418
|
-
);
|
|
1419
|
-
}
|
|
1420
|
-
}
|
|
1421
|
-
console.log("");
|
|
1422
|
-
} catch (error) {
|
|
1423
|
-
if (!handleExitPromptError(error)) {
|
|
1424
|
-
displayError(error, "Initialization");
|
|
1425
|
-
handleGeneralError(error);
|
|
1426
871
|
}
|
|
1427
872
|
}
|
|
1428
873
|
}
|
|
1429
|
-
async function
|
|
1430
|
-
const { ensureI18nInitialized } = await import('./index5.mjs');
|
|
1431
|
-
ensureI18nInitialized();
|
|
874
|
+
async function saveSingleConfigToToml(apiConfig, provider, options) {
|
|
1432
875
|
try {
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
})
|
|
1442
|
-
);
|
|
876
|
+
const { ClaudeCodeConfigManager } = await import('./claude-code-config-manager.mjs');
|
|
877
|
+
const profile = await convertSingleConfigToProfile(apiConfig, provider, options);
|
|
878
|
+
const result = await ClaudeCodeConfigManager.addProfile(profile);
|
|
879
|
+
if (result.success) {
|
|
880
|
+
const savedProfile = result.addedProfile || ClaudeCodeConfigManager.getProfileByName(profile.name) || profile;
|
|
881
|
+
if (savedProfile.id) {
|
|
882
|
+
await ClaudeCodeConfigManager.switchProfile(savedProfile.id);
|
|
883
|
+
await ClaudeCodeConfigManager.applyProfileSettings(savedProfile);
|
|
1443
884
|
}
|
|
885
|
+
console.log(
|
|
886
|
+
a.green(`\u2714 ${i18n.t("configuration:singleConfigSaved", { name: profile.name })}`)
|
|
887
|
+
);
|
|
888
|
+
} else {
|
|
889
|
+
console.warn(
|
|
890
|
+
a.yellow(`${i18n.t("configuration:singleConfigSaveFailed")}: ${result.error}`)
|
|
891
|
+
);
|
|
1444
892
|
}
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
893
|
+
} catch (error) {
|
|
894
|
+
console.warn(
|
|
895
|
+
a.yellow(
|
|
896
|
+
`${i18n.t("configuration:singleConfigSaveFailed")}: ${error instanceof Error ? error.message : String(error)}`
|
|
897
|
+
)
|
|
898
|
+
);
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
async function buildClaudeCodeProfile(params) {
|
|
902
|
+
const { ClaudeCodeConfigManager } = await import('./claude-code-config-manager.mjs');
|
|
903
|
+
let {
|
|
904
|
+
url: baseUrl,
|
|
905
|
+
authType,
|
|
906
|
+
primaryModel,
|
|
907
|
+
defaultHaikuModel,
|
|
908
|
+
defaultSonnetModel,
|
|
909
|
+
defaultOpusModel
|
|
910
|
+
} = params;
|
|
911
|
+
baseUrl = baseUrl || API_DEFAULT_URL;
|
|
912
|
+
if (params.provider && params.provider !== "custom") {
|
|
913
|
+
const { getProviderPreset } = await import('./api-providers.mjs');
|
|
914
|
+
const preset = getProviderPreset(params.provider);
|
|
915
|
+
if (preset?.claudeCode) {
|
|
916
|
+
baseUrl = params.url || preset.claudeCode.baseUrl;
|
|
917
|
+
authType = preset.claudeCode.authType;
|
|
1457
918
|
}
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
919
|
+
}
|
|
920
|
+
return {
|
|
921
|
+
name: params.name,
|
|
922
|
+
authType,
|
|
923
|
+
apiKey: params.key,
|
|
924
|
+
baseUrl,
|
|
925
|
+
primaryModel,
|
|
926
|
+
defaultHaikuModel,
|
|
927
|
+
defaultSonnetModel,
|
|
928
|
+
defaultOpusModel,
|
|
929
|
+
id: ClaudeCodeConfigManager.generateProfileId(params.name)
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
async function convertSingleConfigToProfile(apiConfig, provider, options) {
|
|
933
|
+
return buildClaudeCodeProfile({
|
|
934
|
+
name: provider && provider !== "custom" ? provider : "custom-config",
|
|
935
|
+
key: apiConfig.key,
|
|
936
|
+
authType: apiConfig.authType,
|
|
937
|
+
url: apiConfig.url,
|
|
938
|
+
provider,
|
|
939
|
+
primaryModel: options?.apiModel,
|
|
940
|
+
defaultHaikuModel: options?.apiHaikuModel,
|
|
941
|
+
defaultSonnetModel: options?.apiSonnetModel,
|
|
942
|
+
defaultOpusModel: options?.apiOpusModel
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
async function convertToClaudeCodeProfile(config) {
|
|
946
|
+
return buildClaudeCodeProfile({
|
|
947
|
+
name: config.name,
|
|
948
|
+
key: config.key,
|
|
949
|
+
authType: (config.type === "ccr_proxy" ? "api_key" : config.type) || "api_key",
|
|
950
|
+
url: config.url,
|
|
951
|
+
provider: config.provider,
|
|
952
|
+
primaryModel: config.primaryModel,
|
|
953
|
+
defaultHaikuModel: config.defaultHaikuModel,
|
|
954
|
+
defaultSonnetModel: config.defaultSonnetModel,
|
|
955
|
+
defaultOpusModel: config.defaultOpusModel
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
async function convertToCodexProvider(config) {
|
|
959
|
+
const displayName = config.name || config.provider || "custom";
|
|
960
|
+
const providerId = displayName.toLowerCase().replace(/[^a-z0-9]/g, "-");
|
|
961
|
+
let baseUrl = config.url || API_DEFAULT_URL;
|
|
962
|
+
let model = config.primaryModel || "gpt-5-codex";
|
|
963
|
+
let wireApi = "responses";
|
|
964
|
+
if (config.provider && config.provider !== "custom") {
|
|
965
|
+
const { getProviderPreset } = await import('./api-providers.mjs');
|
|
966
|
+
const preset = getProviderPreset(config.provider);
|
|
967
|
+
if (preset?.codex) {
|
|
968
|
+
baseUrl = config.url || preset.codex.baseUrl;
|
|
969
|
+
model = config.primaryModel || preset.codex.defaultModel || model;
|
|
970
|
+
wireApi = preset.codex.wireApi;
|
|
1463
971
|
}
|
|
1464
|
-
console.log(a.green(`\u2714 ${i18n.t("multi-config:configsAddedSuccessfully")}`));
|
|
1465
|
-
} catch (error) {
|
|
1466
|
-
displayError(error, "Multi-config setup");
|
|
1467
|
-
throw error;
|
|
1468
972
|
}
|
|
973
|
+
return {
|
|
974
|
+
id: providerId,
|
|
975
|
+
name: displayName,
|
|
976
|
+
baseUrl,
|
|
977
|
+
wireApi,
|
|
978
|
+
tempEnvKey: `${displayName}_API_KEY`.replace(/\W/g, "_").toUpperCase(),
|
|
979
|
+
requiresOpenaiAuth: false,
|
|
980
|
+
model
|
|
981
|
+
};
|
|
1469
982
|
}
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
983
|
+
|
|
984
|
+
const ccjkVersion = getRuntimeVersion();
|
|
985
|
+
async function init(options = {}) {
|
|
986
|
+
options.initSource = options.initSource || "init";
|
|
987
|
+
options.orchestration = parseOrchestrationLevel(options.orchestration);
|
|
988
|
+
try {
|
|
989
|
+
const { cleanupZcfNamespace } = await import('./cleanup-migration.mjs');
|
|
990
|
+
const { removed } = cleanupZcfNamespace();
|
|
991
|
+
if (removed.length > 0) {
|
|
992
|
+
console.log(a.dim(`Cleaned up legacy zcf namespace: ${removed.join(", ")}`));
|
|
993
|
+
}
|
|
994
|
+
} catch {
|
|
995
|
+
}
|
|
996
|
+
if (options.silent) {
|
|
997
|
+
return await silentInit(options);
|
|
998
|
+
}
|
|
999
|
+
if (options.smart) {
|
|
1000
|
+
return await smartInit(options);
|
|
1473
1001
|
}
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1002
|
+
if (options.skipPrompt) {
|
|
1003
|
+
await validateSkipPromptOptions(options);
|
|
1004
|
+
}
|
|
1005
|
+
try {
|
|
1006
|
+
const tracker = new ProgressTracker([
|
|
1007
|
+
"Reading configuration",
|
|
1008
|
+
"Selecting code tool",
|
|
1009
|
+
"Configuring API",
|
|
1010
|
+
"Installing MCP services",
|
|
1011
|
+
"Setting up workflows",
|
|
1012
|
+
"Finalizing setup"
|
|
1013
|
+
]);
|
|
1014
|
+
if (!options.skipPrompt && !options.skipBanner) {
|
|
1015
|
+
tracker.start();
|
|
1483
1016
|
}
|
|
1484
|
-
if (!
|
|
1485
|
-
|
|
1017
|
+
if (!options.skipPrompt && !options.skipBanner)
|
|
1018
|
+
tracker.nextStep();
|
|
1019
|
+
const zcfConfig = readZcfConfig();
|
|
1020
|
+
if (!options.skipPrompt && !options.skipBanner)
|
|
1021
|
+
tracker.nextStep();
|
|
1022
|
+
let codeToolType;
|
|
1023
|
+
try {
|
|
1024
|
+
codeToolType = await resolveCodeType(options.codeType);
|
|
1025
|
+
} catch (error) {
|
|
1026
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1027
|
+
console.error(a.red(`${i18n.t("errors:generalError")} ${errorMessage}`));
|
|
1028
|
+
codeToolType = DEFAULT_CODE_TOOL_TYPE;
|
|
1486
1029
|
}
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1030
|
+
options.codeType = codeToolType;
|
|
1031
|
+
async function selectApiConfigurationMode() {
|
|
1032
|
+
const { apiMode } = await inquirer.prompt({
|
|
1033
|
+
type: "list",
|
|
1034
|
+
name: "apiMode",
|
|
1035
|
+
message: i18n.t("api:selectApiMode"),
|
|
1036
|
+
choices: [
|
|
1037
|
+
{
|
|
1038
|
+
name: i18n.t("api:useOfficialLogin"),
|
|
1039
|
+
value: "official"
|
|
1040
|
+
},
|
|
1041
|
+
{
|
|
1042
|
+
name: i18n.t("api:customApiConfig"),
|
|
1043
|
+
value: "custom"
|
|
1044
|
+
},
|
|
1045
|
+
{
|
|
1046
|
+
name: i18n.t("api:useCcrProxy"),
|
|
1047
|
+
value: "ccr"
|
|
1048
|
+
},
|
|
1049
|
+
{
|
|
1050
|
+
name: i18n.t("api:skipApi"),
|
|
1051
|
+
value: "skip"
|
|
1052
|
+
}
|
|
1053
|
+
]
|
|
1054
|
+
});
|
|
1055
|
+
return apiMode;
|
|
1494
1056
|
}
|
|
1495
|
-
|
|
1496
|
-
|
|
1057
|
+
async function handleCustomApiConfiguration(existingConfig) {
|
|
1058
|
+
if (codeToolType === "claude-code") {
|
|
1059
|
+
const { configureIncrementalManagement } = await import('./claude-code-incremental-manager.mjs');
|
|
1060
|
+
await configureIncrementalManagement();
|
|
1061
|
+
return null;
|
|
1062
|
+
}
|
|
1063
|
+
if (existingConfig) {
|
|
1064
|
+
const customConfigAction = await promptApiConfigurationAction();
|
|
1065
|
+
if (customConfigAction === "modify-partial") {
|
|
1066
|
+
await modifyApiConfigPartially(existingConfig);
|
|
1067
|
+
return null;
|
|
1068
|
+
} else if (customConfigAction === "modify-all") {
|
|
1069
|
+
return await configureApiCompletely();
|
|
1070
|
+
} else if (customConfigAction === "keep-existing") {
|
|
1071
|
+
try {
|
|
1072
|
+
addCompletedOnboarding();
|
|
1073
|
+
} catch (error) {
|
|
1074
|
+
console.error(a.red(i18n.t("errors:failedToSetOnboarding")), error);
|
|
1075
|
+
}
|
|
1076
|
+
try {
|
|
1077
|
+
setPrimaryApiKey();
|
|
1078
|
+
} catch (error) {
|
|
1079
|
+
const { ensureI18nInitialized, i18n: i18nModule } = await import('./index2.mjs');
|
|
1080
|
+
ensureI18nInitialized();
|
|
1081
|
+
console.error(i18nModule.t("mcp:primaryApiKeySetFailed"), error);
|
|
1082
|
+
}
|
|
1083
|
+
return null;
|
|
1084
|
+
}
|
|
1085
|
+
} else {
|
|
1086
|
+
const { apiChoice } = await inquirer.prompt({
|
|
1087
|
+
type: "list",
|
|
1088
|
+
name: "apiChoice",
|
|
1089
|
+
message: i18n.t("api:configureApi"),
|
|
1090
|
+
choices: [
|
|
1091
|
+
{
|
|
1092
|
+
name: `${i18n.t("api:useAuthToken")} - ${a.gray(i18n.t("api:authTokenDesc"))}`,
|
|
1093
|
+
value: "auth_token",
|
|
1094
|
+
short: i18n.t("api:useAuthToken")
|
|
1095
|
+
},
|
|
1096
|
+
{
|
|
1097
|
+
name: `${i18n.t("api:useApiKey")} - ${a.gray(i18n.t("api:apiKeyDesc"))}`,
|
|
1098
|
+
value: "api_key",
|
|
1099
|
+
short: i18n.t("api:useApiKey")
|
|
1100
|
+
}
|
|
1101
|
+
]
|
|
1102
|
+
});
|
|
1103
|
+
if (!apiChoice) {
|
|
1104
|
+
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
1105
|
+
process__default.exit(0);
|
|
1106
|
+
}
|
|
1107
|
+
return await configureApiCompletely(apiChoice);
|
|
1108
|
+
}
|
|
1497
1109
|
}
|
|
1498
|
-
if (!
|
|
1499
|
-
|
|
1110
|
+
if (!options.skipBanner) {
|
|
1111
|
+
displayBannerWithInfo(CODE_TOOL_BANNERS[codeToolType] || "CCJK");
|
|
1500
1112
|
}
|
|
1501
|
-
if (
|
|
1502
|
-
|
|
1113
|
+
if (isTermux()) {
|
|
1114
|
+
console.log(a.yellow(`
|
|
1115
|
+
\u2139 ${i18n.t("installation:termuxDetected")}`));
|
|
1116
|
+
console.log(a.gray(i18n.t("installation:termuxEnvironmentInfo")));
|
|
1503
1117
|
}
|
|
1504
|
-
|
|
1505
|
-
if (
|
|
1506
|
-
|
|
1118
|
+
let configLang = options.configLang;
|
|
1119
|
+
if (codeToolType === "codex") {
|
|
1120
|
+
if (!configLang) {
|
|
1121
|
+
if (options.skipPrompt) {
|
|
1122
|
+
configLang = zcfConfig?.templateLang || "en";
|
|
1123
|
+
} else {
|
|
1124
|
+
configLang = zcfConfig?.templateLang || i18n.language || "en";
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
} else {
|
|
1128
|
+
if (!configLang) {
|
|
1129
|
+
const { resolveTemplateLanguage } = await import('./prompts.mjs');
|
|
1130
|
+
configLang = await resolveTemplateLanguage(
|
|
1131
|
+
options.configLang,
|
|
1132
|
+
zcfConfig,
|
|
1133
|
+
options.skipPrompt
|
|
1134
|
+
);
|
|
1135
|
+
}
|
|
1507
1136
|
}
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
async function handleClaudeCodeConfigs(configs) {
|
|
1511
|
-
const { ClaudeCodeConfigManager } = await import('./claude-code-config-manager.mjs');
|
|
1512
|
-
const addedProfiles = [];
|
|
1513
|
-
for (const config of configs) {
|
|
1514
|
-
if (config.type === "ccr_proxy") {
|
|
1515
|
-
throw new Error(i18n.t("multi-config:ccrProxyReserved", { name: config.name }));
|
|
1137
|
+
if (!configLang) {
|
|
1138
|
+
configLang = "en";
|
|
1516
1139
|
}
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1140
|
+
if (codeToolType === "codex") {
|
|
1141
|
+
if (options.skipPrompt)
|
|
1142
|
+
process__default.env.CCJK_CODEX_SKIP_PROMPT_SINGLE_BACKUP = "true";
|
|
1143
|
+
const hasApiConfigs = Boolean(options.apiConfigs || options.apiConfigsFile);
|
|
1144
|
+
const apiMode = hasApiConfigs ? "skip" : options.apiType === "auth_token" ? "official" : options.apiType === "api_key" ? "custom" : options.apiType === "skip" ? "skip" : options.skipPrompt ? "skip" : void 0;
|
|
1145
|
+
const customApiConfig = !hasApiConfigs && options.apiType === "api_key" && options.apiKey ? {
|
|
1146
|
+
type: "api_key",
|
|
1147
|
+
token: options.apiKey,
|
|
1148
|
+
baseUrl: options.apiUrl,
|
|
1149
|
+
model: options.apiModel
|
|
1150
|
+
// Add model parameter for Codex
|
|
1151
|
+
} : void 0;
|
|
1152
|
+
let selectedWorkflows;
|
|
1153
|
+
if (Array.isArray(options.workflows)) {
|
|
1154
|
+
selectedWorkflows = options.workflows;
|
|
1155
|
+
} else if (typeof options.workflows === "string") {
|
|
1156
|
+
selectedWorkflows = [options.workflows];
|
|
1157
|
+
} else if (options.workflows === true) {
|
|
1158
|
+
selectedWorkflows = [];
|
|
1159
|
+
}
|
|
1160
|
+
if (hasApiConfigs) {
|
|
1161
|
+
await handleMultiConfigurations(options, "codex");
|
|
1162
|
+
}
|
|
1163
|
+
const resolvedAiOutputLang = await runCodexFullInit({
|
|
1164
|
+
aiOutputLang: options.aiOutputLang,
|
|
1165
|
+
skipPrompt: options.skipPrompt,
|
|
1166
|
+
apiMode,
|
|
1167
|
+
customApiConfig,
|
|
1168
|
+
workflows: selectedWorkflows
|
|
1169
|
+
});
|
|
1170
|
+
updateZcfConfig({
|
|
1171
|
+
version: ccjkVersion,
|
|
1172
|
+
preferredLang: i18n.language,
|
|
1173
|
+
// CCJK界面语言
|
|
1174
|
+
templateLang: configLang,
|
|
1175
|
+
// 模板语言
|
|
1176
|
+
aiOutputLang: resolvedAiOutputLang ?? options.aiOutputLang ?? zcfConfig?.aiOutputLang ?? "en",
|
|
1177
|
+
codeToolType
|
|
1178
|
+
});
|
|
1179
|
+
console.log(a.green(i18n.t("codex:setupComplete")));
|
|
1180
|
+
return;
|
|
1523
1181
|
}
|
|
1524
|
-
const
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1182
|
+
const aiOutputLang = await resolveAiOutputLanguage(
|
|
1183
|
+
i18n.language,
|
|
1184
|
+
options.aiOutputLang,
|
|
1185
|
+
zcfConfig,
|
|
1186
|
+
options.skipPrompt
|
|
1187
|
+
);
|
|
1188
|
+
const installationStatus = await getInstallationStatus();
|
|
1189
|
+
if (installationStatus.hasGlobal) {
|
|
1190
|
+
const { verifyInstallation, displayVerificationResult } = await import('./installer.mjs');
|
|
1191
|
+
const verification = await verifyInstallation("claude-code");
|
|
1192
|
+
if (verification.symlinkCreated) {
|
|
1193
|
+
console.log(a.green(`\u2714 ${i18n.t("installation:alreadyInstalled")}`));
|
|
1194
|
+
displayVerificationResult(verification, "claude-code");
|
|
1195
|
+
} else if (!verification.success) {
|
|
1196
|
+
console.log(a.yellow(`\u26A0 ${i18n.t("installation:verificationFailed")}`));
|
|
1197
|
+
if (verification.error) {
|
|
1198
|
+
console.log(a.gray(` ${verification.error}`));
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
} else {
|
|
1202
|
+
if (options.skipPrompt) {
|
|
1203
|
+
await installClaudeCode(true);
|
|
1204
|
+
} else {
|
|
1205
|
+
const shouldInstall = await promptBoolean({
|
|
1206
|
+
message: i18n.t("installation:installPrompt"),
|
|
1207
|
+
defaultValue: true
|
|
1208
|
+
});
|
|
1209
|
+
if (shouldInstall) {
|
|
1210
|
+
await installClaudeCode(false);
|
|
1211
|
+
} else {
|
|
1212
|
+
console.log(a.yellow(i18n.t("common:skip")));
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1541
1215
|
}
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
}
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1216
|
+
if (installationStatus.hasGlobal) {
|
|
1217
|
+
await checkClaudeCodeVersionAndPrompt(options.skipPrompt);
|
|
1218
|
+
}
|
|
1219
|
+
ensureClaudeDir();
|
|
1220
|
+
if (existsSync(SETTINGS_FILE) && needsMigration()) {
|
|
1221
|
+
if (options.skipPrompt) {
|
|
1222
|
+
console.log(a.yellow("\n\u26A0\uFE0F Problematic configuration detected. Auto-fixing...\n"));
|
|
1223
|
+
const result = migrateSettingsForTokenRetrieval();
|
|
1224
|
+
displayMigrationResult(result);
|
|
1225
|
+
} else {
|
|
1226
|
+
const shouldMigrate = await promptMigration();
|
|
1227
|
+
if (shouldMigrate) {
|
|
1228
|
+
const result = migrateSettingsForTokenRetrieval();
|
|
1229
|
+
displayMigrationResult(result);
|
|
1230
|
+
}
|
|
1556
1231
|
}
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1232
|
+
}
|
|
1233
|
+
let action = "new";
|
|
1234
|
+
if (existsSync(SETTINGS_FILE) && !options.force) {
|
|
1235
|
+
if (options.skipPrompt) {
|
|
1236
|
+
action = options.configAction || "backup";
|
|
1237
|
+
if (action === "skip") {
|
|
1238
|
+
console.log(a.yellow(i18n.t("common:skip")));
|
|
1239
|
+
return;
|
|
1240
|
+
}
|
|
1241
|
+
} else {
|
|
1242
|
+
const { action: userAction } = await inquirer.prompt({
|
|
1243
|
+
type: "list",
|
|
1244
|
+
name: "action",
|
|
1245
|
+
message: i18n.t("configuration:existingConfig"),
|
|
1246
|
+
choices: addNumbersToChoices([
|
|
1247
|
+
{ name: i18n.t("configuration:backupAndOverwrite"), value: "backup" },
|
|
1248
|
+
{ name: i18n.t("configuration:updateDocsOnly"), value: "docs-only" },
|
|
1249
|
+
{ name: i18n.t("configuration:mergeConfig"), value: "merge" },
|
|
1250
|
+
{ name: i18n.t("common:skip"), value: "skip" }
|
|
1251
|
+
])
|
|
1252
|
+
});
|
|
1253
|
+
if (!userAction) {
|
|
1254
|
+
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
1255
|
+
process__default.exit(0);
|
|
1256
|
+
}
|
|
1257
|
+
action = userAction;
|
|
1258
|
+
if (action === "skip") {
|
|
1259
|
+
console.log(a.yellow(i18n.t("common:skip")));
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
} else if (options.skipPrompt && options.configAction) {
|
|
1264
|
+
action = options.configAction;
|
|
1265
|
+
}
|
|
1266
|
+
const isNewInstall = !existsSync(SETTINGS_FILE);
|
|
1267
|
+
if (!options.skipPrompt && (isNewInstall || ["backup", "merge", "new"].includes(action))) {
|
|
1268
|
+
const isZh = i18n.language === "zh-CN";
|
|
1269
|
+
console.log("");
|
|
1270
|
+
console.log(
|
|
1271
|
+
a.bold.cyan(
|
|
1272
|
+
isZh ? "\u{1F48E} \u9876\u7EA7\u5927\u795E\u7F16\u6392\u7406\u5FF5\uFF08\u9ED8\u8BA4\u9996\u9009\uFF09" : "\u{1F48E} Expert Workflow Orchestration (Default First Choice)"
|
|
1566
1273
|
)
|
|
1567
1274
|
);
|
|
1568
|
-
throw error;
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
const defaultConfig = configs.find((c) => c.default);
|
|
1572
|
-
if (defaultConfig) {
|
|
1573
|
-
const { switchCodexProvider } = await import('./codex.mjs').then(function (n) { return n.v; });
|
|
1574
|
-
const displayName = defaultConfig.name || defaultConfig.provider || "custom";
|
|
1575
|
-
const providerId = displayName.toLowerCase().replace(/[^a-z0-9]/g, "-");
|
|
1576
|
-
if (addedProviderIds.includes(providerId)) {
|
|
1577
|
-
await switchCodexProvider(providerId);
|
|
1578
1275
|
console.log(
|
|
1579
|
-
a.
|
|
1276
|
+
a.dim(
|
|
1277
|
+
isZh ? "\u53EF\u540C\u6B65\u4F18\u5316\u89C4\u5212\u3001\u9A8C\u8BC1\u3001\u5B50\u4EE3\u7406\u4E0E\u89C4\u5219\u6267\u884C\u8D28\u91CF\uFF0C\u5EFA\u8BAE\u9996\u6B21\u5B89\u88C5\u7ACB\u5373\u542F\u7528\u3002" : "Improves planning, verification, subagent strategy, and rule execution quality. Recommended on first install."
|
|
1278
|
+
)
|
|
1580
1279
|
);
|
|
1581
|
-
|
|
1280
|
+
const { orchestrationChoice } = await inquirer.prompt({
|
|
1281
|
+
type: "list",
|
|
1282
|
+
name: "orchestrationChoice",
|
|
1283
|
+
message: isZh ? "\u8BF7\u9009\u62E9\u9ED8\u8BA4\u7F16\u6392\u7EA7\u522B\uFF1A" : "Select default orchestration level:",
|
|
1284
|
+
default: "max",
|
|
1285
|
+
choices: addNumbersToChoices([
|
|
1286
|
+
{
|
|
1287
|
+
name: isZh ? "\u9876\u7EA7\u6A21\u5F0F\uFF08\u63A8\u8350\uFF09- \u6700\u5927\u5316\u8D28\u91CF\u4E0E\u6D41\u7A0B\u7EA6\u675F" : "Expert Mode (Recommended) - Maximum quality and workflow enforcement",
|
|
1288
|
+
value: "max"
|
|
1289
|
+
},
|
|
1290
|
+
{
|
|
1291
|
+
name: isZh ? "\u6807\u51C6\u6A21\u5F0F - \u5E73\u8861\u8D28\u91CF\u4E0E\u901F\u5EA6" : "Standard Mode - Balanced quality and speed",
|
|
1292
|
+
value: "standard"
|
|
1293
|
+
},
|
|
1294
|
+
{
|
|
1295
|
+
name: isZh ? "\u8F7B\u91CF\u6A21\u5F0F - \u66F4\u5C11\u6D41\u7A0B\uFF0C\u66F4\u5FEB\u6267\u884C" : "Minimal Mode - Lighter process, faster execution",
|
|
1296
|
+
value: "minimal"
|
|
1297
|
+
},
|
|
1298
|
+
{
|
|
1299
|
+
name: isZh ? "\u5173\u95ED - \u4E0D\u542F\u7528\u7F16\u6392\u7B56\u7565" : "Off - Disable orchestration policy",
|
|
1300
|
+
value: "off"
|
|
1301
|
+
}
|
|
1302
|
+
])
|
|
1303
|
+
});
|
|
1304
|
+
options.orchestration = orchestrationChoice;
|
|
1582
1305
|
console.log(
|
|
1583
|
-
a.
|
|
1584
|
-
|
|
1585
|
-
name: displayName,
|
|
1586
|
-
error: "provider not added"
|
|
1587
|
-
})
|
|
1306
|
+
a.green(
|
|
1307
|
+
`\u2714 ${isZh ? "\u5DF2\u8BBE\u4E3A\u9ED8\u8BA4\u9996\u9009" : "Set as default first choice"}: ${orchestrationChoice}`
|
|
1588
1308
|
)
|
|
1589
1309
|
);
|
|
1590
1310
|
}
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1311
|
+
if (!options.skipPrompt && !options.skipBanner)
|
|
1312
|
+
tracker.nextStep("Configuring API");
|
|
1313
|
+
let apiConfig = null;
|
|
1314
|
+
if (action !== "docs-only" && (isNewInstall || ["backup", "merge", "new"].includes(action))) {
|
|
1315
|
+
if (options.skipPrompt) {
|
|
1316
|
+
if (options.apiConfigs || options.apiConfigsFile) {
|
|
1317
|
+
await handleMultiConfigurations(options, codeToolType);
|
|
1318
|
+
apiConfig = null;
|
|
1319
|
+
} else if (options.provider && options.apiKey) {
|
|
1320
|
+
const { getProviderPreset } = await import('./api-providers.mjs');
|
|
1321
|
+
const preset = options.provider !== "custom" ? getProviderPreset(options.provider) : null;
|
|
1322
|
+
apiConfig = {
|
|
1323
|
+
authType: preset?.claudeCode?.authType || "api_key",
|
|
1324
|
+
key: options.apiKey,
|
|
1325
|
+
url: preset?.claudeCode?.baseUrl || options.apiUrl || API_DEFAULT_URL
|
|
1326
|
+
};
|
|
1327
|
+
await saveSingleConfigToToml(apiConfig, options.provider, options);
|
|
1328
|
+
} else if (options.apiType === "auth_token" && options.apiKey) {
|
|
1329
|
+
apiConfig = {
|
|
1330
|
+
authType: "auth_token",
|
|
1331
|
+
key: options.apiKey,
|
|
1332
|
+
url: options.apiUrl || API_DEFAULT_URL
|
|
1333
|
+
};
|
|
1334
|
+
await saveSingleConfigToToml(apiConfig, void 0, options);
|
|
1335
|
+
} else if (options.apiType === "api_key" && options.apiKey) {
|
|
1336
|
+
apiConfig = {
|
|
1337
|
+
authType: "api_key",
|
|
1338
|
+
key: options.apiKey,
|
|
1339
|
+
url: options.apiUrl || API_DEFAULT_URL
|
|
1340
|
+
};
|
|
1341
|
+
await saveSingleConfigToToml(apiConfig, void 0, options);
|
|
1342
|
+
} else if (options.apiType === "ccr_proxy") {
|
|
1343
|
+
const ccrStatus = await isCcrInstalled();
|
|
1344
|
+
if (!ccrStatus.hasCorrectPackage) {
|
|
1345
|
+
await installCcr();
|
|
1346
|
+
} else {
|
|
1347
|
+
console.log(a.green(`\u2714 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
|
|
1348
|
+
}
|
|
1349
|
+
const existingCcrConfig = readCcrConfig();
|
|
1350
|
+
if (existingCcrConfig) {
|
|
1351
|
+
const backupPath = await backupCcrConfig();
|
|
1352
|
+
if (backupPath) {
|
|
1353
|
+
console.log(a.gray(`\u2714 ${i18n.t("ccr:ccrBackupSuccess")}: ${backupPath}`));
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
const defaultCcrConfig = createDefaultCcrConfig();
|
|
1357
|
+
writeCcrConfig(defaultCcrConfig);
|
|
1358
|
+
console.log(a.green(`\u2714 ${i18n.t("ccr:ccrConfigSuccess")}`));
|
|
1359
|
+
await configureCcrProxy(defaultCcrConfig);
|
|
1360
|
+
console.log(a.green(`\u2714 ${i18n.t("ccr:proxyConfigSuccess")}`));
|
|
1361
|
+
try {
|
|
1362
|
+
addCompletedOnboarding();
|
|
1363
|
+
} catch (error) {
|
|
1364
|
+
console.error(a.red(i18n.t("errors:failedToSetOnboarding")), error);
|
|
1365
|
+
}
|
|
1366
|
+
apiConfig = null;
|
|
1367
|
+
}
|
|
1368
|
+
} else {
|
|
1369
|
+
const existingApiConfig = getExistingApiConfig();
|
|
1370
|
+
const apiMode = await selectApiConfigurationMode();
|
|
1371
|
+
switch (apiMode) {
|
|
1372
|
+
case "official": {
|
|
1373
|
+
const success = switchToOfficialLogin();
|
|
1374
|
+
if (success) {
|
|
1375
|
+
console.log(a.green(`\u2714 ${i18n.t("api:officialLoginConfigured")}`));
|
|
1376
|
+
apiConfig = null;
|
|
1377
|
+
} else {
|
|
1378
|
+
console.log(a.red(i18n.t("api:officialLoginFailed")));
|
|
1379
|
+
}
|
|
1380
|
+
break;
|
|
1381
|
+
}
|
|
1382
|
+
case "custom":
|
|
1383
|
+
apiConfig = await handleCustomApiConfiguration(existingApiConfig);
|
|
1384
|
+
break;
|
|
1385
|
+
case "ccr": {
|
|
1386
|
+
const ccrStatus = await isCcrInstalled();
|
|
1387
|
+
if (!ccrStatus.hasCorrectPackage) {
|
|
1388
|
+
await installCcr();
|
|
1389
|
+
} else {
|
|
1390
|
+
console.log(a.green(`\u2714 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
|
|
1391
|
+
}
|
|
1392
|
+
const ccrConfigured = await setupCcrConfiguration();
|
|
1393
|
+
if (ccrConfigured) {
|
|
1394
|
+
console.log(a.green(`\u2714 ${i18n.t("ccr:ccrSetupComplete")}`));
|
|
1395
|
+
apiConfig = null;
|
|
1396
|
+
}
|
|
1397
|
+
break;
|
|
1398
|
+
}
|
|
1399
|
+
case "skip":
|
|
1400
|
+
apiConfig = null;
|
|
1401
|
+
break;
|
|
1402
|
+
default:
|
|
1403
|
+
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
1404
|
+
process__default.exit(0);
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
if (["backup", "docs-only", "merge"].includes(action)) {
|
|
1409
|
+
const backupDir = backupExistingConfig();
|
|
1410
|
+
if (backupDir) {
|
|
1411
|
+
console.log(a.gray(`\u2714 ${i18n.t("configuration:backupSuccess")}: ${backupDir}`));
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
if (action === "docs-only") {
|
|
1415
|
+
copyConfigFiles(true);
|
|
1416
|
+
if (options.skipPrompt) {
|
|
1417
|
+
if (options.workflows !== false) {
|
|
1418
|
+
await selectAndInstallWorkflows(configLang, options.workflows);
|
|
1419
|
+
}
|
|
1420
|
+
} else {
|
|
1421
|
+
await selectAndInstallWorkflows(configLang);
|
|
1422
|
+
}
|
|
1423
|
+
} else if (["backup", "merge", "new"].includes(action)) {
|
|
1424
|
+
copyConfigFiles(false);
|
|
1425
|
+
if (options.skipPrompt) {
|
|
1426
|
+
if (options.workflows !== false) {
|
|
1427
|
+
await selectAndInstallWorkflows(configLang, options.workflows);
|
|
1428
|
+
}
|
|
1429
|
+
} else {
|
|
1430
|
+
await selectAndInstallWorkflows(configLang);
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
applyAiLanguageDirective(aiOutputLang);
|
|
1434
|
+
if (options.skipPrompt) {
|
|
1435
|
+
if (options.outputStyles !== false) {
|
|
1436
|
+
await configureOutputStyle(options.outputStyles, options.defaultOutputStyle);
|
|
1603
1437
|
}
|
|
1604
|
-
console.log(
|
|
1605
|
-
a.green(`\u2714 ${i18n.t("configuration:singleConfigSaved", { name: profile.name })}`)
|
|
1606
|
-
);
|
|
1607
1438
|
} else {
|
|
1608
|
-
|
|
1609
|
-
a.yellow(`${i18n.t("configuration:singleConfigSaveFailed")}: ${result.error}`)
|
|
1610
|
-
);
|
|
1439
|
+
await configureOutputStyle();
|
|
1611
1440
|
}
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
}
|
|
1620
|
-
async function buildClaudeCodeProfile(params) {
|
|
1621
|
-
const { ClaudeCodeConfigManager } = await import('./claude-code-config-manager.mjs');
|
|
1622
|
-
let {
|
|
1623
|
-
url: baseUrl,
|
|
1624
|
-
authType,
|
|
1625
|
-
primaryModel,
|
|
1626
|
-
defaultHaikuModel,
|
|
1627
|
-
defaultSonnetModel,
|
|
1628
|
-
defaultOpusModel
|
|
1629
|
-
} = params;
|
|
1630
|
-
baseUrl = baseUrl || API_DEFAULT_URL;
|
|
1631
|
-
if (params.provider && params.provider !== "custom") {
|
|
1632
|
-
const { getProviderPreset } = await import('./api-providers.mjs');
|
|
1633
|
-
const preset = getProviderPreset(params.provider);
|
|
1634
|
-
if (preset?.claudeCode) {
|
|
1635
|
-
baseUrl = params.url || preset.claudeCode.baseUrl;
|
|
1636
|
-
authType = preset.claudeCode.authType;
|
|
1441
|
+
if (apiConfig && action !== "docs-only") {
|
|
1442
|
+
const configuredApi = configureApi(apiConfig);
|
|
1443
|
+
if (configuredApi) {
|
|
1444
|
+
console.log(a.green(`\u2714 ${i18n.t("api:apiConfigSuccess")}`));
|
|
1445
|
+
console.log(a.gray(` URL: ${configuredApi.url}`));
|
|
1446
|
+
console.log(a.gray(` Key: ${formatApiKeyDisplay(configuredApi.key)}`));
|
|
1447
|
+
}
|
|
1637
1448
|
}
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
}
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
defaultHaikuModel: options?.apiHaikuModel,
|
|
1660
|
-
defaultSonnetModel: options?.apiSonnetModel,
|
|
1661
|
-
defaultOpusModel: options?.apiOpusModel
|
|
1662
|
-
});
|
|
1663
|
-
}
|
|
1664
|
-
async function convertToClaudeCodeProfile(config) {
|
|
1665
|
-
return buildClaudeCodeProfile({
|
|
1666
|
-
name: config.name,
|
|
1667
|
-
key: config.key,
|
|
1668
|
-
authType: (config.type === "ccr_proxy" ? "api_key" : config.type) || "api_key",
|
|
1669
|
-
url: config.url,
|
|
1670
|
-
provider: config.provider,
|
|
1671
|
-
primaryModel: config.primaryModel,
|
|
1672
|
-
defaultHaikuModel: config.defaultHaikuModel,
|
|
1673
|
-
defaultSonnetModel: config.defaultSonnetModel,
|
|
1674
|
-
defaultOpusModel: config.defaultOpusModel
|
|
1675
|
-
});
|
|
1676
|
-
}
|
|
1677
|
-
async function convertToCodexProvider(config) {
|
|
1678
|
-
const displayName = config.name || config.provider || "custom";
|
|
1679
|
-
const providerId = displayName.toLowerCase().replace(/[^a-z0-9]/g, "-");
|
|
1680
|
-
let baseUrl = config.url || API_DEFAULT_URL;
|
|
1681
|
-
let model = config.primaryModel || "gpt-5-codex";
|
|
1682
|
-
let wireApi = "responses";
|
|
1683
|
-
if (config.provider && config.provider !== "custom") {
|
|
1684
|
-
const { getProviderPreset } = await import('./api-providers.mjs');
|
|
1685
|
-
const preset = getProviderPreset(config.provider);
|
|
1686
|
-
if (preset?.codex) {
|
|
1687
|
-
baseUrl = config.url || preset.codex.baseUrl;
|
|
1688
|
-
model = config.primaryModel || preset.codex.defaultModel || model;
|
|
1689
|
-
wireApi = preset.codex.wireApi;
|
|
1449
|
+
const hasModelParams = options.apiModel || options.apiHaikuModel || options.apiSonnetModel || options.apiOpusModel;
|
|
1450
|
+
if (hasModelParams && action !== "docs-only" && codeToolType === "claude-code") {
|
|
1451
|
+
if (options.skipPrompt) {
|
|
1452
|
+
const { updateCustomModel } = await import('./config.mjs').then(function (n) { return n.j; });
|
|
1453
|
+
updateCustomModel(
|
|
1454
|
+
options.apiModel || void 0,
|
|
1455
|
+
options.apiHaikuModel || void 0,
|
|
1456
|
+
options.apiSonnetModel || void 0,
|
|
1457
|
+
options.apiOpusModel || void 0
|
|
1458
|
+
);
|
|
1459
|
+
console.log(a.green(`\u2714 ${i18n.t("api:modelConfigSuccess")}`));
|
|
1460
|
+
if (options.apiModel) {
|
|
1461
|
+
console.log(a.gray(` ${i18n.t("api:primaryModel")}: ${options.apiModel}`));
|
|
1462
|
+
}
|
|
1463
|
+
if (options.apiHaikuModel)
|
|
1464
|
+
console.log(a.gray(` Haiku: ${options.apiHaikuModel}`));
|
|
1465
|
+
if (options.apiSonnetModel)
|
|
1466
|
+
console.log(a.gray(` Sonnet: ${options.apiSonnetModel}`));
|
|
1467
|
+
if (options.apiOpusModel)
|
|
1468
|
+
console.log(a.gray(` Opus: ${options.apiOpusModel}`));
|
|
1469
|
+
}
|
|
1690
1470
|
}
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
}
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1471
|
+
if (!options.skipPrompt && !options.skipBanner)
|
|
1472
|
+
tracker.nextStep("Installing MCP services");
|
|
1473
|
+
if (action !== "docs-only") {
|
|
1474
|
+
let shouldConfigureMcp = false;
|
|
1475
|
+
if (options.skipPrompt) {
|
|
1476
|
+
shouldConfigureMcp = options.mcpServices !== false;
|
|
1477
|
+
} else {
|
|
1478
|
+
const userChoice = await promptBoolean({
|
|
1479
|
+
message: i18n.t("mcp:configureMcp"),
|
|
1480
|
+
defaultValue: true
|
|
1481
|
+
});
|
|
1482
|
+
shouldConfigureMcp = userChoice;
|
|
1483
|
+
}
|
|
1484
|
+
if (shouldConfigureMcp) {
|
|
1485
|
+
if (isWindows()) {
|
|
1486
|
+
console.log(a.green(`\u2139 ${i18n.t("installation:windowsDetected")}`));
|
|
1487
|
+
}
|
|
1488
|
+
let selectedServices;
|
|
1489
|
+
if (options.skipPrompt) {
|
|
1490
|
+
selectedServices = options.mcpServices;
|
|
1491
|
+
} else {
|
|
1492
|
+
selectedServices = await selectMcpServices();
|
|
1493
|
+
if (selectedServices === void 0) {
|
|
1494
|
+
process__default.exit(0);
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
if (selectedServices.length > 0) {
|
|
1498
|
+
const mcpBackupPath = backupMcpConfig();
|
|
1499
|
+
if (mcpBackupPath) {
|
|
1500
|
+
console.log(a.gray(`\u2714 ${i18n.t("mcp:mcpBackupSuccess")}: ${mcpBackupPath}`));
|
|
1501
|
+
}
|
|
1502
|
+
const newServers = {};
|
|
1503
|
+
for (const serviceId of selectedServices) {
|
|
1504
|
+
const services = await getMcpServices();
|
|
1505
|
+
const service = services.find((s) => s.id === serviceId);
|
|
1506
|
+
if (!service)
|
|
1507
|
+
continue;
|
|
1508
|
+
let config = service.config;
|
|
1509
|
+
if (service.id === "serena" && Array.isArray(config.args)) {
|
|
1510
|
+
const adjusted = { ...config, args: [...config.args || []] };
|
|
1511
|
+
const idx = adjusted.args.indexOf("--context");
|
|
1512
|
+
if (idx >= 0 && idx + 1 < adjusted.args.length) {
|
|
1513
|
+
adjusted.args[idx + 1] = codeToolType === "codex" ? "codex" : "ide-assistant";
|
|
1514
|
+
} else {
|
|
1515
|
+
adjusted.args.push(
|
|
1516
|
+
"--context",
|
|
1517
|
+
codeToolType === "codex" ? "codex" : "ide-assistant"
|
|
1518
|
+
);
|
|
1519
|
+
}
|
|
1520
|
+
config = adjusted;
|
|
1521
|
+
}
|
|
1522
|
+
if (service.requiresApiKey) {
|
|
1523
|
+
if (options.skipPrompt) {
|
|
1524
|
+
console.log(
|
|
1525
|
+
a.yellow(`${i18n.t("common:skip")}: ${service.name} (requires API key)`)
|
|
1526
|
+
);
|
|
1527
|
+
continue;
|
|
1528
|
+
} else {
|
|
1529
|
+
const response = await inquirer.prompt({
|
|
1530
|
+
type: "input",
|
|
1531
|
+
name: "apiKey",
|
|
1532
|
+
message: service.apiKeyPrompt,
|
|
1533
|
+
validate: (value) => !!value || i18n.t("api:keyRequired")
|
|
1534
|
+
});
|
|
1535
|
+
if (!response.apiKey) {
|
|
1536
|
+
console.log(a.yellow(`${i18n.t("common:skip")}: ${service.name}`));
|
|
1537
|
+
continue;
|
|
1538
|
+
}
|
|
1539
|
+
config = buildMcpServerConfig(
|
|
1540
|
+
service.config,
|
|
1541
|
+
response.apiKey,
|
|
1542
|
+
service.apiKeyPlaceholder,
|
|
1543
|
+
service.apiKeyEnvVar
|
|
1544
|
+
);
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
newServers[service.id] = config;
|
|
1548
|
+
}
|
|
1549
|
+
const existingConfig = readMcpConfig();
|
|
1550
|
+
let mergedConfig = replaceMcpServers(existingConfig, newServers);
|
|
1551
|
+
mergedConfig = fixWindowsMcpConfig(mergedConfig);
|
|
1552
|
+
try {
|
|
1553
|
+
writeMcpConfig(mergedConfig);
|
|
1554
|
+
syncMcpPermissions();
|
|
1555
|
+
console.log(a.green(`\u2714 ${i18n.t("mcp:mcpConfigSuccess")}`));
|
|
1556
|
+
const { checkMcpPerformance, formatPerformanceWarning } = await import('./mcp-performance.mjs').then(function (n) { return n.e; });
|
|
1557
|
+
const serviceCount = Object.keys(newServers).length;
|
|
1558
|
+
const perfWarning = checkMcpPerformance(serviceCount);
|
|
1559
|
+
if (perfWarning) {
|
|
1560
|
+
console.log("");
|
|
1561
|
+
console.log(formatPerformanceWarning(perfWarning, i18n.language));
|
|
1562
|
+
}
|
|
1563
|
+
} catch (error) {
|
|
1564
|
+
displayError(error, "MCP configuration");
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
const cometixInstalled = await isCometixLineInstalled();
|
|
1570
|
+
if (!cometixInstalled) {
|
|
1571
|
+
let shouldInstallCometix = false;
|
|
1572
|
+
if (options.skipPrompt) {
|
|
1573
|
+
shouldInstallCometix = options.installCometixLine !== false;
|
|
1574
|
+
} else {
|
|
1575
|
+
const userChoice = await promptBoolean({
|
|
1576
|
+
message: i18n.t("cometix:installCometixPrompt"),
|
|
1577
|
+
defaultValue: true
|
|
1578
|
+
});
|
|
1579
|
+
shouldInstallCometix = userChoice;
|
|
1580
|
+
}
|
|
1581
|
+
if (shouldInstallCometix) {
|
|
1582
|
+
await installCometixLine();
|
|
1583
|
+
} else {
|
|
1584
|
+
console.log(a.yellow(i18n.t("cometix:cometixSkipped")));
|
|
1585
|
+
}
|
|
1586
|
+
} else {
|
|
1587
|
+
console.log(a.green(`\u2714 ${i18n.t("cometix:cometixAlreadyInstalled")}`));
|
|
1714
1588
|
}
|
|
1715
|
-
if (
|
|
1716
|
-
|
|
1589
|
+
if (!options.skipPrompt || options.installSuperpowers) {
|
|
1590
|
+
await handleSuperpowersInstallation(options);
|
|
1717
1591
|
}
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1592
|
+
let agentBrowserReady = false;
|
|
1593
|
+
try {
|
|
1594
|
+
const isZh = i18n.language === "zh-CN";
|
|
1595
|
+
let shouldInstallAgentBrowser = false;
|
|
1596
|
+
if (options.skipPrompt) {
|
|
1597
|
+
shouldInstallAgentBrowser = options.installAgentBrowser !== false;
|
|
1598
|
+
} else {
|
|
1599
|
+
shouldInstallAgentBrowser = await promptBoolean({
|
|
1600
|
+
message: isZh ? "\u5B89\u88C5 Agent Browser \u6D4F\u89C8\u5668\u81EA\u52A8\u5316\u6A21\u5757\uFF1F\uFF08\u63A8\u8350\uFF0C\u6D4F\u89C8\u5668\u4EFB\u52A1\u53EF\u65E0\u7F1D\u4F7F\u7528\uFF09" : "Install Agent Browser module? (recommended for seamless browser automation)",
|
|
1601
|
+
defaultValue: true
|
|
1602
|
+
});
|
|
1603
|
+
}
|
|
1604
|
+
if (shouldInstallAgentBrowser) {
|
|
1605
|
+
const { checkAgentBrowserInstalled, installAgentBrowser } = await import('./installer2.mjs');
|
|
1606
|
+
const installed = await checkAgentBrowserInstalled();
|
|
1607
|
+
const success = installed ? true : await installAgentBrowser();
|
|
1608
|
+
if (success) {
|
|
1609
|
+
const { addSkill } = await import('./manager.mjs');
|
|
1610
|
+
const { browserSkill } = await import('./skill.mjs');
|
|
1611
|
+
addSkill(browserSkill);
|
|
1612
|
+
agentBrowserReady = true;
|
|
1613
|
+
console.log(
|
|
1614
|
+
a.green(
|
|
1615
|
+
`\u2714 ${isZh ? "Agent Browser \u5DF2\u5C31\u7EEA\uFF0C\u6D4F\u89C8\u5668 Skill \u5DF2\u542F\u7528" : "Agent Browser ready, browser skill enabled"}`
|
|
1616
|
+
)
|
|
1617
|
+
);
|
|
1618
|
+
console.log(
|
|
1619
|
+
a.gray(
|
|
1620
|
+
` ${isZh ? "\u53EF\u76F4\u63A5\u4F7F\u7528:" : "Use directly:"} ccjk browser start https://example.com`
|
|
1621
|
+
)
|
|
1622
|
+
);
|
|
1623
|
+
}
|
|
1624
|
+
} else {
|
|
1625
|
+
console.log(
|
|
1626
|
+
a.yellow(
|
|
1627
|
+
isZh ? "\u26A0 \u5DF2\u8DF3\u8FC7 Agent Browser \u5B89\u88C5" : "\u26A0 Agent Browser installation skipped"
|
|
1628
|
+
)
|
|
1629
|
+
);
|
|
1630
|
+
}
|
|
1631
|
+
} catch (error) {
|
|
1632
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
1633
|
+
console.log(a.gray(`\u2139 Agent Browser setup skipped: ${msg}`));
|
|
1723
1634
|
}
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1635
|
+
try {
|
|
1636
|
+
const { injectSmartGuide } = await import('./smart-guide.mjs');
|
|
1637
|
+
const smartGuideSuccess = await injectSmartGuide(configLang);
|
|
1638
|
+
if (smartGuideSuccess) {
|
|
1639
|
+
console.log(a.green(`\u2714 ${i18n.t("smartGuide:enabled")}`));
|
|
1640
|
+
}
|
|
1641
|
+
} catch {
|
|
1642
|
+
console.log(a.gray(`\u2139 ${i18n.t("smartGuide:skipped")}`));
|
|
1731
1643
|
}
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1644
|
+
try {
|
|
1645
|
+
const finalOrchestrationLevel = parseOrchestrationLevel(options.orchestration);
|
|
1646
|
+
const policyPath = writeOrchestrationPolicy({
|
|
1647
|
+
level: finalOrchestrationLevel,
|
|
1648
|
+
language: configLang,
|
|
1649
|
+
source: options.initSource
|
|
1650
|
+
});
|
|
1651
|
+
console.log(
|
|
1652
|
+
a.green(`\u2714 Workflow orchestration: ${finalOrchestrationLevel} (${policyPath})`)
|
|
1653
|
+
);
|
|
1654
|
+
} catch (error) {
|
|
1655
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
1656
|
+
console.log(a.gray(`\u2139 Workflow orchestration skipped: ${msg}`));
|
|
1735
1657
|
}
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1658
|
+
if (!options.skipPrompt && !options.skipBanner)
|
|
1659
|
+
tracker.nextStep("Finalizing setup");
|
|
1660
|
+
updateZcfConfig({
|
|
1661
|
+
version: ccjkVersion,
|
|
1662
|
+
preferredLang: i18n.language,
|
|
1663
|
+
// CCJK界面语言
|
|
1664
|
+
templateLang: configLang,
|
|
1665
|
+
// 模板语言
|
|
1666
|
+
aiOutputLang,
|
|
1667
|
+
codeToolType
|
|
1668
|
+
});
|
|
1669
|
+
if (!options.skipPrompt) {
|
|
1670
|
+
const { importRecommendedEnv, importRecommendedPermissions } = await import('./simple-config.mjs');
|
|
1671
|
+
const confirmImport = await promptBoolean({
|
|
1672
|
+
message: i18n.t("configuration:recommendImportEnvPerm") || "\u5BFC\u5165 CCJK \u63A8\u8350\u7684\u73AF\u5883\u53D8\u91CF\u548C\u6743\u9650\u914D\u7F6E\uFF1F\uFF08\u63A8\u8350\uFF0C\u53EF\u51CF\u5C11\u6743\u9650\u5F39\u7A97\uFF09",
|
|
1747
1673
|
defaultValue: true
|
|
1748
1674
|
});
|
|
1749
|
-
if (
|
|
1750
|
-
|
|
1751
|
-
|
|
1675
|
+
if (confirmImport) {
|
|
1676
|
+
try {
|
|
1677
|
+
await importRecommendedEnv();
|
|
1678
|
+
console.log(a.green(`\u2714 ${i18n.t("configuration:envImportSuccess")}`));
|
|
1679
|
+
} catch (error) {
|
|
1680
|
+
console.error(a.yellow(`\u26A0 ${i18n.t("configuration:envImportFailed")}: ${error}`));
|
|
1681
|
+
}
|
|
1682
|
+
try {
|
|
1683
|
+
await importRecommendedPermissions();
|
|
1684
|
+
console.log(
|
|
1685
|
+
a.green(`\u2714 ${i18n.t("configuration:permissionsImportSuccess") || "\u6743\u9650\u914D\u7F6E\u5DF2\u5BFC\u5165"}`)
|
|
1686
|
+
);
|
|
1687
|
+
} catch (error) {
|
|
1688
|
+
console.error(
|
|
1689
|
+
a.yellow(`\u26A0 ${i18n.t("configuration:permissionsImportFailed")}: ${error}`)
|
|
1690
|
+
);
|
|
1691
|
+
}
|
|
1692
|
+
console.log();
|
|
1752
1693
|
}
|
|
1753
1694
|
}
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
const config = await generateConfigs(selection);
|
|
1757
|
-
await writeConfigs(config);
|
|
1758
|
-
console.log(a.green("\u2714 Configurations generated successfully!"));
|
|
1759
|
-
console.log(a.gray(` \u2022 ${config.agents.length} agents installed`));
|
|
1760
|
-
console.log(a.gray(` \u2022 ${config.skills.length} skills installed`));
|
|
1761
|
-
console.log("");
|
|
1762
|
-
console.log(a.gray("Running standard initialization...\n"));
|
|
1763
|
-
options.smart = false;
|
|
1764
|
-
options.skipPrompt = options.skipPrompt ?? false;
|
|
1765
|
-
await init(options);
|
|
1766
|
-
console.log("");
|
|
1767
|
-
console.log(a.bold.green("\u2705 Smart Initialization Complete!"));
|
|
1768
|
-
console.log("");
|
|
1769
|
-
console.log(a.cyan("\u{1F3AF} What was configured:"));
|
|
1770
|
-
console.log(a.gray(" \u2022 Project-specific agents and skills"));
|
|
1771
|
-
console.log(a.gray(" \u2022 Claude Code base configuration"));
|
|
1772
|
-
console.log(a.gray(" \u2022 MCP services"));
|
|
1773
|
-
console.log(a.gray(" \u2022 Workflows and output styles"));
|
|
1695
|
+
if (!options.skipPrompt && !options.skipBanner)
|
|
1696
|
+
tracker.complete();
|
|
1774
1697
|
console.log("");
|
|
1775
|
-
console.log(
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
console.log(
|
|
1698
|
+
console.log(
|
|
1699
|
+
a.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")
|
|
1700
|
+
);
|
|
1701
|
+
console.log(
|
|
1702
|
+
a.bold.green("\u2551") + a.bold.white(padToDisplayWidth(` ${i18n.t("configuration:setupCompleteTitle")}`, 62)) + a.bold.green("\u2551")
|
|
1703
|
+
);
|
|
1704
|
+
console.log(
|
|
1705
|
+
a.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")
|
|
1706
|
+
);
|
|
1707
|
+
console.log(
|
|
1708
|
+
`${a.bold.green("\u2551")} ${a.bold.green("\u2551")}`
|
|
1709
|
+
);
|
|
1710
|
+
console.log(
|
|
1711
|
+
a.bold.green("\u2551") + a.green(padToDisplayWidth(` ${i18n.t("configuration:nextSteps")}`, 62)) + a.bold.green("\u2551")
|
|
1712
|
+
);
|
|
1713
|
+
console.log(
|
|
1714
|
+
`${a.bold.green("\u2551")} ${a.bold.green("\u2551")}`
|
|
1715
|
+
);
|
|
1716
|
+
console.log(
|
|
1717
|
+
a.bold.green("\u2551") + padToDisplayWidth(` ${i18n.t("configuration:guidanceStep1")}`, 62) + a.bold.green("\u2551")
|
|
1718
|
+
);
|
|
1719
|
+
console.log(
|
|
1720
|
+
a.bold.green("\u2551") + a.dim(padToDisplayWidth(` ${i18n.t("configuration:guidanceStep1Detail")}`, 62)) + a.bold.green("\u2551")
|
|
1721
|
+
);
|
|
1722
|
+
console.log(
|
|
1723
|
+
a.bold.green("\u2551") + a.dim(padToDisplayWidth(` ${i18n.t("configuration:guidanceStep1Detail2")}`, 62)) + a.bold.green("\u2551")
|
|
1724
|
+
);
|
|
1725
|
+
console.log(
|
|
1726
|
+
`${a.bold.green("\u2551")} ${a.bold.green("\u2551")}`
|
|
1727
|
+
);
|
|
1728
|
+
console.log(
|
|
1729
|
+
a.bold.green("\u2551") + padToDisplayWidth(` ${i18n.t("configuration:guidanceStep2")}`, 62) + a.bold.green("\u2551")
|
|
1730
|
+
);
|
|
1731
|
+
console.log(
|
|
1732
|
+
a.bold.green("\u2551") + a.green(padToDisplayWidth(` ${i18n.t("configuration:guidanceStep2Example")}`, 62)) + a.bold.green("\u2551")
|
|
1733
|
+
);
|
|
1734
|
+
console.log(
|
|
1735
|
+
`${a.bold.green("\u2551")} ${a.bold.green("\u2551")}`
|
|
1736
|
+
);
|
|
1737
|
+
console.log(
|
|
1738
|
+
a.bold.green("\u2551") + padToDisplayWidth(` ${i18n.t("configuration:guidanceStep3")} `, 44) + a.yellow(padToDisplayWidth(i18n.t("configuration:guidanceStep3Command"), 18)) + a.bold.green("\u2551")
|
|
1739
|
+
);
|
|
1740
|
+
console.log(
|
|
1741
|
+
a.bold.green("\u2551") + padToDisplayWidth(` ${i18n.t("configuration:guidanceStep4")} `, 44) + a.yellow(padToDisplayWidth(i18n.t("configuration:guidanceStep4Command"), 18)) + a.bold.green("\u2551")
|
|
1742
|
+
);
|
|
1743
|
+
console.log(
|
|
1744
|
+
`${a.bold.green("\u2551")} ${a.bold.green("\u2551")}`
|
|
1745
|
+
);
|
|
1746
|
+
console.log(
|
|
1747
|
+
a.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")
|
|
1748
|
+
);
|
|
1749
|
+
if (isNewInstall || ["backup", "merge", "new"].includes(action)) {
|
|
1750
|
+
const isZh = i18n.language === "zh-CN";
|
|
1751
|
+
console.log(
|
|
1752
|
+
a.cyan(
|
|
1753
|
+
isZh ? "\u{1F9E0} \u4E0A\u4E0B\u6587\u4F18\u5316\u5DF2\u542F\u7528\uFF08\u9ED8\u8BA4\uFF09" : "\u{1F9E0} Context optimization is enabled (default)"
|
|
1754
|
+
)
|
|
1755
|
+
);
|
|
1756
|
+
console.log(
|
|
1757
|
+
a.dim(
|
|
1758
|
+
isZh ? " \u5EFA\u8BAE\u7ACB\u5373\u8FD0\u884C: ccjk morning \u67E5\u770B\u5065\u5EB7\u5206\u4E0E\u6536\u76CA\u6458\u8981" : " Recommended now: ccjk morning to view health score and value summary"
|
|
1759
|
+
)
|
|
1760
|
+
);
|
|
1761
|
+
console.log(
|
|
1762
|
+
a.dim(
|
|
1763
|
+
isZh ? " \u6DF1\u5EA6\u590D\u76D8: ccjk review | \u4E0A\u4E0B\u6587\u8BE6\u60C5: ccjk context --show" : " Deep review: ccjk review | Context details: ccjk context --show"
|
|
1764
|
+
)
|
|
1765
|
+
);
|
|
1766
|
+
if (agentBrowserReady) {
|
|
1767
|
+
console.log(
|
|
1768
|
+
a.cyan(
|
|
1769
|
+
isZh ? "\u{1F310} \u6D4F\u89C8\u5668\u81EA\u52A8\u5316\u5DF2\u5C31\u7EEA\uFF08\u65E0\u7F1D\uFF09" : "\u{1F310} Browser automation is ready (seamless)"
|
|
1770
|
+
)
|
|
1771
|
+
);
|
|
1772
|
+
console.log(
|
|
1773
|
+
a.dim(
|
|
1774
|
+
isZh ? " \u76F4\u63A5\u5F00\u59CB: ccjk browser start https://example.com" : " Start directly: ccjk browser start https://example.com"
|
|
1775
|
+
)
|
|
1776
|
+
);
|
|
1777
|
+
console.log(
|
|
1778
|
+
a.dim(
|
|
1779
|
+
isZh ? " \u5E38\u7528\u64CD\u4F5C: ccjk browser status | ccjk browser stop" : " Common actions: ccjk browser status | ccjk browser stop"
|
|
1780
|
+
)
|
|
1781
|
+
);
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1779
1784
|
console.log("");
|
|
1780
1785
|
} catch (error) {
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
error
|
|
1784
|
-
|
|
1785
|
-
throw error;
|
|
1786
|
+
if (!handleExitPromptError(error)) {
|
|
1787
|
+
displayError(error, "Initialization");
|
|
1788
|
+
handleGeneralError(error);
|
|
1789
|
+
}
|
|
1786
1790
|
}
|
|
1787
1791
|
}
|
|
1788
1792
|
|
|
1789
1793
|
const init$1 = {
|
|
1790
1794
|
__proto__: null,
|
|
1795
|
+
convertSingleConfigToProfile: convertSingleConfigToProfile,
|
|
1791
1796
|
handleMultiConfigurations: handleMultiConfigurations,
|
|
1792
1797
|
init: init,
|
|
1798
|
+
saveSingleConfigToToml: saveSingleConfigToToml,
|
|
1793
1799
|
silentInit: silentInit,
|
|
1794
1800
|
smartInit: smartInit,
|
|
1795
1801
|
validateApiConfigs: validateApiConfigs,
|