ccjk 12.0.7 → 12.0.8
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/package.json +1 -1
- package/dist/chunks/agent-teams.mjs +0 -136
- package/dist/chunks/agent.mjs +0 -1439
- package/dist/chunks/agents.mjs +0 -3778
- package/dist/chunks/api-cli.mjs +0 -132
- package/dist/chunks/api-providers.mjs +0 -129
- package/dist/chunks/api.mjs +0 -112
- package/dist/chunks/auto-bootstrap.mjs +0 -358
- package/dist/chunks/auto-init.mjs +0 -7584
- package/dist/chunks/auto-updater.mjs +0 -410
- package/dist/chunks/banner.mjs +0 -188
- package/dist/chunks/bash.mjs +0 -187
- package/dist/chunks/boost.mjs +0 -397
- package/dist/chunks/ccjk-agents.mjs +0 -414
- package/dist/chunks/ccjk-all.mjs +0 -1028
- package/dist/chunks/ccjk-config.mjs +0 -261
- package/dist/chunks/ccjk-hooks.mjs +0 -1074
- package/dist/chunks/ccjk-mcp.mjs +0 -761
- package/dist/chunks/ccjk-setup.mjs +0 -763
- package/dist/chunks/ccjk-skills.mjs +0 -514
- package/dist/chunks/ccr.mjs +0 -98
- package/dist/chunks/ccu.mjs +0 -40
- package/dist/chunks/check-updates.mjs +0 -108
- package/dist/chunks/claude-code-config-manager.mjs +0 -750
- package/dist/chunks/claude-code-incremental-manager.mjs +0 -623
- package/dist/chunks/claude-config.mjs +0 -236
- package/dist/chunks/claude-wrapper.mjs +0 -85
- package/dist/chunks/cleanup-migration.mjs +0 -20
- package/dist/chunks/cli-hook.mjs +0 -2285
- package/dist/chunks/cloud-sync.mjs +0 -29
- package/dist/chunks/codex-config-switch.mjs +0 -451
- package/dist/chunks/codex-provider-manager.mjs +0 -236
- package/dist/chunks/codex-uninstaller.mjs +0 -404
- package/dist/chunks/codex.mjs +0 -2077
- package/dist/chunks/commands.mjs +0 -108
- package/dist/chunks/commands2.mjs +0 -413
- package/dist/chunks/commit.mjs +0 -138
- package/dist/chunks/completion.mjs +0 -515
- package/dist/chunks/config-consolidator.mjs +0 -172
- package/dist/chunks/config-switch.mjs +0 -317
- package/dist/chunks/config.mjs +0 -379
- package/dist/chunks/config2.mjs +0 -477
- package/dist/chunks/config3.mjs +0 -470
- package/dist/chunks/constants.mjs +0 -133
- package/dist/chunks/context-loader.mjs +0 -343
- package/dist/chunks/context.mjs +0 -372
- package/dist/chunks/convoy-manager.mjs +0 -880
- package/dist/chunks/dashboard.mjs +0 -476
- package/dist/chunks/doctor.mjs +0 -964
- package/dist/chunks/evolution.mjs +0 -382
- package/dist/chunks/features.mjs +0 -698
- package/dist/chunks/fish.mjs +0 -181
- package/dist/chunks/fs-operations.mjs +0 -192
- package/dist/chunks/health-alerts.mjs +0 -304
- package/dist/chunks/health-check.mjs +0 -532
- package/dist/chunks/help.mjs +0 -340
- package/dist/chunks/hook-installer.mjs +0 -45
- package/dist/chunks/index.mjs +0 -24
- package/dist/chunks/index10.mjs +0 -1171
- package/dist/chunks/index11.mjs +0 -1008
- package/dist/chunks/index12.mjs +0 -193
- package/dist/chunks/index13.mjs +0 -218
- package/dist/chunks/index14.mjs +0 -663
- package/dist/chunks/index2.mjs +0 -19
- package/dist/chunks/index3.mjs +0 -19092
- package/dist/chunks/index4.mjs +0 -8
- package/dist/chunks/index5.mjs +0 -7600
- package/dist/chunks/index6.mjs +0 -171
- package/dist/chunks/index7.mjs +0 -3583
- package/dist/chunks/index8.mjs +0 -19
- package/dist/chunks/index9.mjs +0 -616
- package/dist/chunks/init.mjs +0 -1606
- package/dist/chunks/installer.mjs +0 -690
- package/dist/chunks/installer2.mjs +0 -179
- package/dist/chunks/interview.mjs +0 -2927
- package/dist/chunks/json-config.mjs +0 -60
- package/dist/chunks/linux.mjs +0 -3863
- package/dist/chunks/macos.mjs +0 -69
- package/dist/chunks/main.mjs +0 -635
- package/dist/chunks/manager.mjs +0 -1048
- package/dist/chunks/marketplace.mjs +0 -949
- package/dist/chunks/mcp-cli.mjs +0 -204
- package/dist/chunks/mcp-performance.mjs +0 -187
- package/dist/chunks/mcp.mjs +0 -1231
- package/dist/chunks/menu.mjs +0 -652
- package/dist/chunks/metrics-display.mjs +0 -153
- package/dist/chunks/migrator.mjs +0 -178
- package/dist/chunks/monitor.mjs +0 -1856
- package/dist/chunks/notification.mjs +0 -1864
- package/dist/chunks/onboarding.mjs +0 -385
- package/dist/chunks/package.mjs +0 -3
- package/dist/chunks/paradigm.mjs +0 -74
- package/dist/chunks/permission-manager.mjs +0 -132
- package/dist/chunks/permissions.mjs +0 -265
- package/dist/chunks/persistence-manager.mjs +0 -794
- package/dist/chunks/persistence.mjs +0 -667
- package/dist/chunks/platform.mjs +0 -391
- package/dist/chunks/plugin.mjs +0 -1936
- package/dist/chunks/powershell.mjs +0 -213
- package/dist/chunks/prompts.mjs +0 -241
- package/dist/chunks/providers.mjs +0 -260
- package/dist/chunks/quick-actions.mjs +0 -320
- package/dist/chunks/quick-provider.mjs +0 -682
- package/dist/chunks/quick-setup.mjs +0 -412
- package/dist/chunks/remote.mjs +0 -497
- package/dist/chunks/session.mjs +0 -878
- package/dist/chunks/sessions.mjs +0 -106
- package/dist/chunks/silent-updater.mjs +0 -396
- package/dist/chunks/simple-config.mjs +0 -98
- package/dist/chunks/skill.mjs +0 -117
- package/dist/chunks/skill2.mjs +0 -9003
- package/dist/chunks/skills-sync.mjs +0 -6460
- package/dist/chunks/skills.mjs +0 -567
- package/dist/chunks/slash-commands.mjs +0 -207
- package/dist/chunks/smart-defaults.mjs +0 -412
- package/dist/chunks/smart-guide.mjs +0 -194
- package/dist/chunks/startup.mjs +0 -487
- package/dist/chunks/stats.mjs +0 -410
- package/dist/chunks/status.mjs +0 -289
- package/dist/chunks/team.mjs +0 -63
- package/dist/chunks/thinking.mjs +0 -626
- package/dist/chunks/trace.mjs +0 -57
- package/dist/chunks/uninstall.mjs +0 -849
- package/dist/chunks/update.mjs +0 -167
- package/dist/chunks/upgrade-manager.mjs +0 -204
- package/dist/chunks/version-checker.mjs +0 -881
- package/dist/chunks/vim.mjs +0 -903
- package/dist/chunks/windows.mjs +0 -14
- package/dist/chunks/workflows.mjs +0 -633
- package/dist/chunks/wsl.mjs +0 -129
- package/dist/chunks/zero-config.mjs +0 -374
- package/dist/chunks/zsh.mjs +0 -182
- package/dist/cli.d.mts +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.mjs +0 -2199
- package/dist/i18n/locales/en/agent-teams.json +0 -18
- package/dist/i18n/locales/en/agentBrowser.json +0 -79
- package/dist/i18n/locales/en/agents.json +0 -135
- package/dist/i18n/locales/en/api.json +0 -63
- package/dist/i18n/locales/en/ccjk-agents.json +0 -33
- package/dist/i18n/locales/en/ccjk-all.json +0 -23
- package/dist/i18n/locales/en/ccjk-skills.json +0 -22
- package/dist/i18n/locales/en/ccjk.json +0 -276
- package/dist/i18n/locales/en/ccr.json +0 -65
- package/dist/i18n/locales/en/claude-md.json +0 -73
- package/dist/i18n/locales/en/cli.json +0 -152
- package/dist/i18n/locales/en/cloud-setup.json +0 -31
- package/dist/i18n/locales/en/cloud-sync.json +0 -147
- package/dist/i18n/locales/en/cloud.json +0 -40
- package/dist/i18n/locales/en/cloudPlugins.json +0 -118
- package/dist/i18n/locales/en/codex.json +0 -127
- package/dist/i18n/locales/en/cometix.json +0 -29
- package/dist/i18n/locales/en/common.json +0 -68
- package/dist/i18n/locales/en/config.json +0 -108
- package/dist/i18n/locales/en/configuration.json +0 -226
- package/dist/i18n/locales/en/context.json +0 -85
- package/dist/i18n/locales/en/dashboard.json +0 -78
- package/dist/i18n/locales/en/errors.json +0 -26
- package/dist/i18n/locales/en/evolution.json +0 -54
- package/dist/i18n/locales/en/hooks.json +0 -74
- package/dist/i18n/locales/en/hooksSync.json +0 -133
- package/dist/i18n/locales/en/installation.json +0 -83
- package/dist/i18n/locales/en/interview.json +0 -104
- package/dist/i18n/locales/en/language.json +0 -19
- package/dist/i18n/locales/en/lsp.json +0 -78
- package/dist/i18n/locales/en/marketplace.json +0 -116
- package/dist/i18n/locales/en/mcp.json +0 -178
- package/dist/i18n/locales/en/memory.json +0 -92
- package/dist/i18n/locales/en/menu.json +0 -143
- package/dist/i18n/locales/en/multi-config.json +0 -79
- package/dist/i18n/locales/en/notification.json +0 -307
- package/dist/i18n/locales/en/permissions.json +0 -95
- package/dist/i18n/locales/en/persistence.json +0 -127
- package/dist/i18n/locales/en/plugins.json +0 -146
- package/dist/i18n/locales/en/quick-actions.json +0 -78
- package/dist/i18n/locales/en/registry.json +0 -54
- package/dist/i18n/locales/en/remote.json +0 -93
- package/dist/i18n/locales/en/sandbox.json +0 -44
- package/dist/i18n/locales/en/setup.json +0 -44
- package/dist/i18n/locales/en/shencha.json +0 -14
- package/dist/i18n/locales/en/skills.json +0 -100
- package/dist/i18n/locales/en/skillsSync.json +0 -74
- package/dist/i18n/locales/en/smartGuide.json +0 -49
- package/dist/i18n/locales/en/stats.json +0 -20
- package/dist/i18n/locales/en/subagent.json +0 -69
- package/dist/i18n/locales/en/superpowers.json +0 -117
- package/dist/i18n/locales/en/team.json +0 -7
- package/dist/i18n/locales/en/thinking.json +0 -65
- package/dist/i18n/locales/en/tools.json +0 -42
- package/dist/i18n/locales/en/uninstall.json +0 -56
- package/dist/i18n/locales/en/updater.json +0 -29
- package/dist/i18n/locales/en/vim.json +0 -169
- package/dist/i18n/locales/en/workflow.json +0 -55
- package/dist/i18n/locales/en/workspace.json +0 -108
- package/dist/i18n/locales/zh-CN/agent-teams.json +0 -18
- package/dist/i18n/locales/zh-CN/agentBrowser.json +0 -79
- package/dist/i18n/locales/zh-CN/agents.json +0 -135
- package/dist/i18n/locales/zh-CN/api.json +0 -63
- package/dist/i18n/locales/zh-CN/ccjk-agents.json +0 -33
- package/dist/i18n/locales/zh-CN/ccjk-all.json +0 -23
- package/dist/i18n/locales/zh-CN/ccjk-skills.json +0 -22
- package/dist/i18n/locales/zh-CN/ccjk.json +0 -276
- package/dist/i18n/locales/zh-CN/ccr.json +0 -65
- package/dist/i18n/locales/zh-CN/claude-md.json +0 -73
- package/dist/i18n/locales/zh-CN/cli.json +0 -152
- package/dist/i18n/locales/zh-CN/cloud-setup.json +0 -31
- package/dist/i18n/locales/zh-CN/cloud-sync.json +0 -147
- package/dist/i18n/locales/zh-CN/cloud.json +0 -40
- package/dist/i18n/locales/zh-CN/cloudPlugins.json +0 -118
- package/dist/i18n/locales/zh-CN/codex.json +0 -127
- package/dist/i18n/locales/zh-CN/cometix.json +0 -29
- package/dist/i18n/locales/zh-CN/common.json +0 -68
- package/dist/i18n/locales/zh-CN/config.json +0 -108
- package/dist/i18n/locales/zh-CN/configuration.json +0 -224
- package/dist/i18n/locales/zh-CN/context.json +0 -85
- package/dist/i18n/locales/zh-CN/dashboard.json +0 -78
- package/dist/i18n/locales/zh-CN/errors.json +0 -26
- package/dist/i18n/locales/zh-CN/evolution.json +0 -54
- package/dist/i18n/locales/zh-CN/hooks.json +0 -74
- package/dist/i18n/locales/zh-CN/hooksSync.json +0 -133
- package/dist/i18n/locales/zh-CN/installation.json +0 -83
- package/dist/i18n/locales/zh-CN/interview.json +0 -104
- package/dist/i18n/locales/zh-CN/language.json +0 -19
- package/dist/i18n/locales/zh-CN/lsp.json +0 -78
- package/dist/i18n/locales/zh-CN/marketplace.json +0 -116
- package/dist/i18n/locales/zh-CN/mcp.json +0 -178
- package/dist/i18n/locales/zh-CN/memory.json +0 -92
- package/dist/i18n/locales/zh-CN/menu.json +0 -143
- package/dist/i18n/locales/zh-CN/multi-config.json +0 -79
- package/dist/i18n/locales/zh-CN/notification.json +0 -307
- package/dist/i18n/locales/zh-CN/permissions.json +0 -95
- package/dist/i18n/locales/zh-CN/persistence.json +0 -127
- package/dist/i18n/locales/zh-CN/plugins.json +0 -146
- package/dist/i18n/locales/zh-CN/quick-actions.json +0 -78
- package/dist/i18n/locales/zh-CN/registry.json +0 -54
- package/dist/i18n/locales/zh-CN/remote.json +0 -93
- package/dist/i18n/locales/zh-CN/sandbox.json +0 -44
- package/dist/i18n/locales/zh-CN/setup.json +0 -44
- package/dist/i18n/locales/zh-CN/shencha.json +0 -14
- package/dist/i18n/locales/zh-CN/skills.json +0 -100
- package/dist/i18n/locales/zh-CN/skillsSync.json +0 -74
- package/dist/i18n/locales/zh-CN/smartGuide.json +0 -49
- package/dist/i18n/locales/zh-CN/stats.json +0 -20
- package/dist/i18n/locales/zh-CN/subagent.json +0 -69
- package/dist/i18n/locales/zh-CN/superpowers.json +0 -117
- package/dist/i18n/locales/zh-CN/team.json +0 -7
- package/dist/i18n/locales/zh-CN/thinking.json +0 -65
- package/dist/i18n/locales/zh-CN/tools.json +0 -42
- package/dist/i18n/locales/zh-CN/uninstall.json +0 -56
- package/dist/i18n/locales/zh-CN/updater.json +0 -29
- package/dist/i18n/locales/zh-CN/vim.json +0 -169
- package/dist/i18n/locales/zh-CN/workflow.json +0 -55
- package/dist/i18n/locales/zh-CN/workspace.json +0 -108
- package/dist/index.d.mts +0 -5295
- package/dist/index.d.ts +0 -5295
- package/dist/index.mjs +0 -4941
- package/dist/shared/ccjk.B364Fu0N.mjs +0 -1819
- package/dist/shared/ccjk.BAGoDD49.mjs +0 -36
- package/dist/shared/ccjk.BBtCGd_g.mjs +0 -899
- package/dist/shared/ccjk.BFQ7yr5S.mjs +0 -16
- package/dist/shared/ccjk.BFxsJM0k.mjs +0 -599
- package/dist/shared/ccjk.BIxuVL3_.mjs +0 -25
- package/dist/shared/ccjk.BRZ9ww8S.mjs +0 -142
- package/dist/shared/ccjk.BoApaI4j.mjs +0 -28
- package/dist/shared/ccjk.BrPUmTqm.mjs +0 -266
- package/dist/shared/ccjk.BtB1e5jm.mjs +0 -171
- package/dist/shared/ccjk.BwfbSKN2.mjs +0 -1051
- package/dist/shared/ccjk.BxSmJ8B7.mjs +0 -243
- package/dist/shared/ccjk.Bx_rmYfN.mjs +0 -69
- package/dist/shared/ccjk.C2jHOZVP.mjs +0 -52
- package/dist/shared/ccjk.CL4Yat0G.mjs +0 -303
- package/dist/shared/ccjk.COweQ1RR.mjs +0 -5
- package/dist/shared/ccjk.CePkJq2S.mjs +0 -223
- package/dist/shared/ccjk.CfKKcvWy.mjs +0 -126
- package/dist/shared/ccjk.Cjgrln_h.mjs +0 -297
- package/dist/shared/ccjk.Cjj8SVrn.mjs +0 -54
- package/dist/shared/ccjk.CxpGa6MC.mjs +0 -2724
- package/dist/shared/ccjk.D5MFQT7w.mjs +0 -400
- package/dist/shared/ccjk.D6ycHbak.mjs +0 -270
- package/dist/shared/ccjk.D8ZLYSZZ.mjs +0 -299
- package/dist/shared/ccjk.DG_o24cZ.mjs +0 -88
- package/dist/shared/ccjk.DLLw-h4Y.mjs +0 -460
- package/dist/shared/ccjk.DOwtZMk8.mjs +0 -4019
- package/dist/shared/ccjk.DS7UESmF.mjs +0 -2451
- package/dist/shared/ccjk.DTdjs-qK.mjs +0 -1447
- package/dist/shared/ccjk.DXRAZcix.mjs +0 -66
- package/dist/shared/ccjk.DsYaCCx4.mjs +0 -317
- package/dist/shared/ccjk.J8YiPsOw.mjs +0 -259
- package/dist/shared/ccjk.KfSWcGlE.mjs +0 -38
- package/dist/shared/ccjk.RyizuzOI.mjs +0 -21
- package/dist/shared/ccjk.SPoXMvZD.mjs +0 -1242
- package/dist/shared/ccjk.T_cX87dY.mjs +0 -15
- package/dist/shared/ccjk.UIvifqNE.mjs +0 -1486
- package/dist/shared/ccjk._dESH4Rk.mjs +0 -111
- package/dist/shared/ccjk.bQ7Dh1g4.mjs +0 -249
- package/dist/shared/ccjk.c-ETfBZ_.mjs +0 -617
- package/dist/shared/ccjk.gDEDGD_t.mjs +0 -38
- package/dist/shared/ccjk.hoqrwWdN.mjs +0 -333
- package/dist/shared/ccjk.waa2ikKJ.mjs +0 -351
|
@@ -1,623 +0,0 @@
|
|
|
1
|
-
import a from './index2.mjs';
|
|
2
|
-
import { i as inquirer } from './index3.mjs';
|
|
3
|
-
import { ensureI18nInitialized, i18n } from './index5.mjs';
|
|
4
|
-
import { ClaudeCodeConfigManager } from './claude-code-config-manager.mjs';
|
|
5
|
-
import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
|
|
6
|
-
import { p as promptBoolean } from '../shared/ccjk.DOwtZMk8.mjs';
|
|
7
|
-
import { v as validateApiKey } from '../shared/ccjk.BwfbSKN2.mjs';
|
|
8
|
-
import '../shared/ccjk.BAGoDD49.mjs';
|
|
9
|
-
import 'node:readline';
|
|
10
|
-
import 'stream';
|
|
11
|
-
import 'node:tty';
|
|
12
|
-
import 'node:process';
|
|
13
|
-
import 'node:async_hooks';
|
|
14
|
-
import '../shared/ccjk.Cjgrln_h.mjs';
|
|
15
|
-
import 'node:util';
|
|
16
|
-
import 'tty';
|
|
17
|
-
import 'fs';
|
|
18
|
-
import 'child_process';
|
|
19
|
-
import 'node:path';
|
|
20
|
-
import 'node:os';
|
|
21
|
-
import 'node:crypto';
|
|
22
|
-
import 'buffer';
|
|
23
|
-
import 'string_decoder';
|
|
24
|
-
import 'node:fs';
|
|
25
|
-
import 'node:url';
|
|
26
|
-
import '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
27
|
-
import '../shared/ccjk.RyizuzOI.mjs';
|
|
28
|
-
import './constants.mjs';
|
|
29
|
-
import './ccjk-config.mjs';
|
|
30
|
-
import '../shared/ccjk.BBtCGd_g.mjs';
|
|
31
|
-
import './index6.mjs';
|
|
32
|
-
import './fs-operations.mjs';
|
|
33
|
-
import 'node:fs/promises';
|
|
34
|
-
import './json-config.mjs';
|
|
35
|
-
import './config.mjs';
|
|
36
|
-
import './claude-config.mjs';
|
|
37
|
-
import './platform.mjs';
|
|
38
|
-
import './main.mjs';
|
|
39
|
-
import 'module';
|
|
40
|
-
import 'node:child_process';
|
|
41
|
-
import 'node:stream';
|
|
42
|
-
import '../shared/ccjk.DXRAZcix.mjs';
|
|
43
|
-
|
|
44
|
-
function getAuthTypeLabel(authType) {
|
|
45
|
-
ensureI18nInitialized();
|
|
46
|
-
switch (authType) {
|
|
47
|
-
case "api_key":
|
|
48
|
-
return i18n.t("multi-config:authType.api_key");
|
|
49
|
-
case "auth_token":
|
|
50
|
-
return i18n.t("multi-config:authType.auth_token");
|
|
51
|
-
case "ccr_proxy":
|
|
52
|
-
return i18n.t("multi-config:authType.ccr_proxy");
|
|
53
|
-
default:
|
|
54
|
-
return authType;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
async function configureIncrementalManagement() {
|
|
58
|
-
ensureI18nInitialized();
|
|
59
|
-
const config = ClaudeCodeConfigManager.readConfig();
|
|
60
|
-
if (!config || !config.profiles || Object.keys(config.profiles).length === 0) {
|
|
61
|
-
await handleAddProfile();
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
const profiles = Object.values(config.profiles);
|
|
65
|
-
const currentProfile = config.currentProfileId ? config.profiles[config.currentProfileId] : null;
|
|
66
|
-
console.log(a.green(i18n.t("multi-config:incrementalManagementTitle")));
|
|
67
|
-
console.log(a.gray(i18n.t("multi-config:currentProfileCount", { count: profiles.length })));
|
|
68
|
-
if (currentProfile) {
|
|
69
|
-
console.log(a.gray(i18n.t("multi-config:currentDefaultProfile", { profile: currentProfile.name })));
|
|
70
|
-
}
|
|
71
|
-
const choices = [
|
|
72
|
-
{ name: i18n.t("multi-config:addProfile"), value: "add" },
|
|
73
|
-
{ name: i18n.t("multi-config:editProfile"), value: "edit" },
|
|
74
|
-
{ name: i18n.t("multi-config:copyProfile"), value: "copy" },
|
|
75
|
-
{ name: i18n.t("multi-config:deleteProfile"), value: "delete" },
|
|
76
|
-
{ name: i18n.t("common:skip"), value: "skip" }
|
|
77
|
-
];
|
|
78
|
-
const { action } = await inquirer.prompt([{
|
|
79
|
-
type: "list",
|
|
80
|
-
name: "action",
|
|
81
|
-
message: i18n.t("multi-config:selectAction"),
|
|
82
|
-
choices: addNumbersToChoices(choices)
|
|
83
|
-
}]);
|
|
84
|
-
if (!action || action === "skip") {
|
|
85
|
-
console.log(a.yellow(i18n.t("common:skip")));
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
switch (action) {
|
|
89
|
-
case "add":
|
|
90
|
-
await handleAddProfile();
|
|
91
|
-
break;
|
|
92
|
-
case "edit":
|
|
93
|
-
await handleEditProfile(profiles);
|
|
94
|
-
break;
|
|
95
|
-
case "copy":
|
|
96
|
-
await handleCopyProfile(profiles);
|
|
97
|
-
break;
|
|
98
|
-
case "delete":
|
|
99
|
-
await handleDeleteProfile(profiles);
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
async function promptContinueAdding() {
|
|
104
|
-
return await promptBoolean({
|
|
105
|
-
message: i18n.t("multi-config:addAnotherProfilePrompt"),
|
|
106
|
-
defaultValue: false
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
async function handleAddProfile() {
|
|
110
|
-
console.log(a.green(`
|
|
111
|
-
${i18n.t("multi-config:addingNewProfile")}`));
|
|
112
|
-
const { getApiProviders } = await import('./api-providers.mjs');
|
|
113
|
-
const providers = getApiProviders("claude-code");
|
|
114
|
-
const providerChoices = [
|
|
115
|
-
{ name: i18n.t("api:customProvider"), value: "custom" },
|
|
116
|
-
...providers.map((p) => ({ name: p.name, value: p.id }))
|
|
117
|
-
];
|
|
118
|
-
const { selectedProvider } = await inquirer.prompt([{
|
|
119
|
-
type: "list",
|
|
120
|
-
name: "selectedProvider",
|
|
121
|
-
message: i18n.t("api:selectApiProvider"),
|
|
122
|
-
choices: addNumbersToChoices(providerChoices)
|
|
123
|
-
}]);
|
|
124
|
-
let prefilledBaseUrl;
|
|
125
|
-
let prefilledAuthType;
|
|
126
|
-
let prefilledDefaultModels;
|
|
127
|
-
if (selectedProvider !== "custom") {
|
|
128
|
-
const provider = providers.find((p) => p.id === selectedProvider);
|
|
129
|
-
if (provider?.claudeCode) {
|
|
130
|
-
prefilledBaseUrl = provider.claudeCode.baseUrl;
|
|
131
|
-
prefilledAuthType = provider.claudeCode.authType;
|
|
132
|
-
prefilledDefaultModels = provider.claudeCode.defaultModels;
|
|
133
|
-
console.log(a.gray(i18n.t("api:providerSelected", { name: provider.name })));
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
const answers = await inquirer.prompt([
|
|
137
|
-
{
|
|
138
|
-
type: "input",
|
|
139
|
-
name: "profileName",
|
|
140
|
-
message: i18n.t("multi-config:profileNamePrompt"),
|
|
141
|
-
default: selectedProvider !== "custom" ? providers.find((p) => p.id === selectedProvider)?.name : void 0,
|
|
142
|
-
validate: (input) => {
|
|
143
|
-
const trimmed = input.trim();
|
|
144
|
-
if (!trimmed) {
|
|
145
|
-
return i18n.t("multi-config:profileNameRequired");
|
|
146
|
-
}
|
|
147
|
-
if (!/^[\w\-\s.\u4E00-\u9FA5]+$/.test(trimmed)) {
|
|
148
|
-
return i18n.t("multi-config:profileNameInvalid");
|
|
149
|
-
}
|
|
150
|
-
return true;
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
type: "list",
|
|
155
|
-
name: "authType",
|
|
156
|
-
message: i18n.t("multi-config:authTypePrompt"),
|
|
157
|
-
choices: [
|
|
158
|
-
{ name: i18n.t("multi-config:authType.api_key"), value: "api_key" },
|
|
159
|
-
{ name: i18n.t("multi-config:authType.auth_token"), value: "auth_token" }
|
|
160
|
-
],
|
|
161
|
-
default: prefilledAuthType || "api_key",
|
|
162
|
-
when: () => selectedProvider === "custom"
|
|
163
|
-
// Only ask if custom
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
type: "input",
|
|
167
|
-
name: "baseUrl",
|
|
168
|
-
message: i18n.t("multi-config:baseUrlPrompt"),
|
|
169
|
-
default: prefilledBaseUrl || "https://api.anthropic.com",
|
|
170
|
-
when: (answers2) => selectedProvider === "custom" && answers2.authType !== "ccr_proxy",
|
|
171
|
-
validate: (input) => {
|
|
172
|
-
const trimmed = input.trim();
|
|
173
|
-
if (!trimmed) {
|
|
174
|
-
return i18n.t("multi-config:baseUrlRequired");
|
|
175
|
-
}
|
|
176
|
-
try {
|
|
177
|
-
new URL(trimmed);
|
|
178
|
-
return true;
|
|
179
|
-
} catch {
|
|
180
|
-
return i18n.t("multi-config:baseUrlInvalid");
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
type: "input",
|
|
186
|
-
name: "apiKey",
|
|
187
|
-
message: selectedProvider !== "custom" ? i18n.t("api:enterProviderApiKey", { provider: providers.find((p) => p.id === selectedProvider)?.name || selectedProvider }) : i18n.t("multi-config:apiKeyPrompt"),
|
|
188
|
-
when: (answers2) => selectedProvider === "custom" ? answers2.authType !== "ccr_proxy" : true,
|
|
189
|
-
validate: (input) => {
|
|
190
|
-
const trimmed = input.trim();
|
|
191
|
-
if (!trimmed) {
|
|
192
|
-
return i18n.t("multi-config:apiKeyRequired");
|
|
193
|
-
}
|
|
194
|
-
const validation = validateApiKey(trimmed);
|
|
195
|
-
if (!validation.isValid) {
|
|
196
|
-
return validation.error || "Invalid API key format";
|
|
197
|
-
}
|
|
198
|
-
return true;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
]);
|
|
202
|
-
let modelConfig = null;
|
|
203
|
-
if (selectedProvider === "custom") {
|
|
204
|
-
const { promptCustomModels } = await import('./features.mjs');
|
|
205
|
-
modelConfig = await promptCustomModels();
|
|
206
|
-
}
|
|
207
|
-
const setAsDefault = await promptBoolean({
|
|
208
|
-
message: i18n.t("multi-config:setAsDefaultPrompt"),
|
|
209
|
-
defaultValue: true
|
|
210
|
-
});
|
|
211
|
-
const profileName = answers.profileName.trim();
|
|
212
|
-
const profileId = ClaudeCodeConfigManager.generateProfileId(profileName);
|
|
213
|
-
const profile = {
|
|
214
|
-
id: profileId,
|
|
215
|
-
name: profileName,
|
|
216
|
-
authType: selectedProvider === "custom" ? answers.authType : prefilledAuthType
|
|
217
|
-
};
|
|
218
|
-
if (profile.authType !== "ccr_proxy") {
|
|
219
|
-
profile.apiKey = answers.apiKey.trim();
|
|
220
|
-
profile.baseUrl = selectedProvider === "custom" ? answers.baseUrl.trim() : prefilledBaseUrl;
|
|
221
|
-
}
|
|
222
|
-
if (modelConfig) {
|
|
223
|
-
if (modelConfig.primaryModel.trim()) {
|
|
224
|
-
profile.primaryModel = modelConfig.primaryModel.trim();
|
|
225
|
-
}
|
|
226
|
-
if (modelConfig.haikuModel.trim())
|
|
227
|
-
profile.defaultHaikuModel = modelConfig.haikuModel.trim();
|
|
228
|
-
if (modelConfig.sonnetModel.trim())
|
|
229
|
-
profile.defaultSonnetModel = modelConfig.sonnetModel.trim();
|
|
230
|
-
if (modelConfig.opusModel.trim())
|
|
231
|
-
profile.defaultOpusModel = modelConfig.opusModel.trim();
|
|
232
|
-
} else if (prefilledDefaultModels?.length) {
|
|
233
|
-
if (prefilledDefaultModels[0]?.trim())
|
|
234
|
-
profile.primaryModel = prefilledDefaultModels[0].trim();
|
|
235
|
-
if (prefilledDefaultModels[1]?.trim())
|
|
236
|
-
profile.defaultHaikuModel = prefilledDefaultModels[1].trim();
|
|
237
|
-
if (prefilledDefaultModels[2]?.trim())
|
|
238
|
-
profile.defaultSonnetModel = prefilledDefaultModels[2].trim();
|
|
239
|
-
if (prefilledDefaultModels[3]?.trim())
|
|
240
|
-
profile.defaultOpusModel = prefilledDefaultModels[3].trim();
|
|
241
|
-
}
|
|
242
|
-
const existingProfile = ClaudeCodeConfigManager.getProfileByName(profile.name);
|
|
243
|
-
if (existingProfile) {
|
|
244
|
-
const overwrite = await promptBoolean({
|
|
245
|
-
message: i18n.t("multi-config:profileDuplicatePrompt", {
|
|
246
|
-
name: profile.name,
|
|
247
|
-
source: i18n.t("multi-config:existingConfig")
|
|
248
|
-
}),
|
|
249
|
-
defaultValue: false
|
|
250
|
-
});
|
|
251
|
-
if (!overwrite) {
|
|
252
|
-
console.log(a.yellow(i18n.t("multi-config:profileDuplicateSkipped", { name: profile.name })));
|
|
253
|
-
const shouldContinue2 = await promptContinueAdding();
|
|
254
|
-
if (shouldContinue2) {
|
|
255
|
-
await handleAddProfile();
|
|
256
|
-
}
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
const updateResult = await ClaudeCodeConfigManager.updateProfile(existingProfile.id, {
|
|
260
|
-
name: profile.name,
|
|
261
|
-
authType: profile.authType,
|
|
262
|
-
apiKey: profile.apiKey,
|
|
263
|
-
baseUrl: profile.baseUrl,
|
|
264
|
-
primaryModel: profile.primaryModel,
|
|
265
|
-
defaultHaikuModel: profile.defaultHaikuModel,
|
|
266
|
-
defaultSonnetModel: profile.defaultSonnetModel,
|
|
267
|
-
defaultOpusModel: profile.defaultOpusModel
|
|
268
|
-
});
|
|
269
|
-
if (updateResult.success) {
|
|
270
|
-
console.log(a.green(i18n.t("multi-config:profileUpdated", { name: profile.name })));
|
|
271
|
-
if (updateResult.backupPath) {
|
|
272
|
-
console.log(a.gray(i18n.t("common:backupCreated", { path: updateResult.backupPath })));
|
|
273
|
-
}
|
|
274
|
-
if (setAsDefault) {
|
|
275
|
-
const switchResult = await ClaudeCodeConfigManager.switchProfile(existingProfile.id);
|
|
276
|
-
if (switchResult.success) {
|
|
277
|
-
console.log(a.green(i18n.t("multi-config:profileSetAsDefault", { name: profile.name })));
|
|
278
|
-
await ClaudeCodeConfigManager.applyProfileSettings({ ...profile, id: existingProfile.id });
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
} else {
|
|
282
|
-
console.log(a.red(i18n.t("multi-config:profileUpdateFailed", { error: updateResult.error || "" })));
|
|
283
|
-
}
|
|
284
|
-
} else {
|
|
285
|
-
const result = await ClaudeCodeConfigManager.addProfile(profile);
|
|
286
|
-
if (result.success) {
|
|
287
|
-
const runtimeProfile = result.addedProfile || { ...profile, id: profileId };
|
|
288
|
-
console.log(a.green(i18n.t("multi-config:profileAdded", { name: runtimeProfile.name })));
|
|
289
|
-
if (result.backupPath) {
|
|
290
|
-
console.log(a.gray(i18n.t("common:backupCreated", { path: result.backupPath })));
|
|
291
|
-
}
|
|
292
|
-
if (setAsDefault) {
|
|
293
|
-
const switchResult = await ClaudeCodeConfigManager.switchProfile(runtimeProfile.id);
|
|
294
|
-
if (switchResult.success) {
|
|
295
|
-
console.log(a.green(i18n.t("multi-config:profileSetAsDefault", { name: runtimeProfile.name })));
|
|
296
|
-
await ClaudeCodeConfigManager.applyProfileSettings(runtimeProfile);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
} else {
|
|
300
|
-
console.log(a.red(i18n.t("multi-config:profileAddFailed", { error: result.error })));
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
const shouldContinue = await promptContinueAdding();
|
|
304
|
-
if (shouldContinue) {
|
|
305
|
-
await handleAddProfile();
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
async function handleEditProfile(profiles) {
|
|
309
|
-
const choices = profiles.map((profile) => ({
|
|
310
|
-
name: `${profile.name} (${getAuthTypeLabel(profile.authType)})`,
|
|
311
|
-
value: profile.id
|
|
312
|
-
}));
|
|
313
|
-
const { selectedProfileId } = await inquirer.prompt([{
|
|
314
|
-
type: "list",
|
|
315
|
-
name: "selectedProfileId",
|
|
316
|
-
message: i18n.t("multi-config:selectProfileToEdit"),
|
|
317
|
-
choices: addNumbersToChoices(choices)
|
|
318
|
-
}]);
|
|
319
|
-
if (!selectedProfileId) {
|
|
320
|
-
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
const selectedProfile = profiles.find((p) => p.id === selectedProfileId);
|
|
324
|
-
if (!selectedProfile) {
|
|
325
|
-
console.log(a.red(i18n.t("multi-config:profileNotFound")));
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
console.log(a.green(`
|
|
329
|
-
${i18n.t("multi-config:editingProfile", { name: selectedProfile.name })}`));
|
|
330
|
-
const answers = await inquirer.prompt([
|
|
331
|
-
{
|
|
332
|
-
type: "input",
|
|
333
|
-
name: "profileName",
|
|
334
|
-
message: i18n.t("multi-config:profileNamePrompt"),
|
|
335
|
-
default: selectedProfile.name,
|
|
336
|
-
validate: (input) => {
|
|
337
|
-
const trimmed = input.trim();
|
|
338
|
-
if (!trimmed) {
|
|
339
|
-
return i18n.t("multi-config:profileNameRequired");
|
|
340
|
-
}
|
|
341
|
-
if (!/^[\w\-\s\u4E00-\u9FA5]+$/.test(trimmed)) {
|
|
342
|
-
return i18n.t("multi-config:profileNameInvalid");
|
|
343
|
-
}
|
|
344
|
-
return true;
|
|
345
|
-
}
|
|
346
|
-
},
|
|
347
|
-
{
|
|
348
|
-
type: "input",
|
|
349
|
-
name: "baseUrl",
|
|
350
|
-
message: i18n.t("multi-config:baseUrlPrompt"),
|
|
351
|
-
default: selectedProfile.baseUrl || "https://api.anthropic.com",
|
|
352
|
-
when: () => selectedProfile.authType !== "ccr_proxy",
|
|
353
|
-
validate: (input) => {
|
|
354
|
-
const trimmed = input.trim();
|
|
355
|
-
if (!trimmed) {
|
|
356
|
-
return i18n.t("multi-config:baseUrlRequired");
|
|
357
|
-
}
|
|
358
|
-
try {
|
|
359
|
-
new URL(trimmed);
|
|
360
|
-
return true;
|
|
361
|
-
} catch {
|
|
362
|
-
return i18n.t("multi-config:baseUrlInvalid");
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
},
|
|
366
|
-
{
|
|
367
|
-
type: "input",
|
|
368
|
-
name: "apiKey",
|
|
369
|
-
message: i18n.t("multi-config:apiKeyPrompt"),
|
|
370
|
-
default: selectedProfile.apiKey,
|
|
371
|
-
when: () => selectedProfile.authType !== "ccr_proxy",
|
|
372
|
-
validate: (input) => {
|
|
373
|
-
const trimmed = input.trim();
|
|
374
|
-
if (!trimmed) {
|
|
375
|
-
return i18n.t("multi-config:apiKeyRequired");
|
|
376
|
-
}
|
|
377
|
-
const validation = validateApiKey(trimmed);
|
|
378
|
-
if (!validation.isValid) {
|
|
379
|
-
return validation.error || "Invalid API key format";
|
|
380
|
-
}
|
|
381
|
-
return true;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
]);
|
|
385
|
-
let modelConfig = null;
|
|
386
|
-
if (selectedProfile.authType !== "ccr_proxy") {
|
|
387
|
-
const { promptCustomModels } = await import('./features.mjs');
|
|
388
|
-
modelConfig = await promptCustomModels(
|
|
389
|
-
selectedProfile.primaryModel,
|
|
390
|
-
selectedProfile.defaultHaikuModel,
|
|
391
|
-
selectedProfile.defaultSonnetModel,
|
|
392
|
-
selectedProfile.defaultOpusModel
|
|
393
|
-
);
|
|
394
|
-
}
|
|
395
|
-
const updateData = {
|
|
396
|
-
name: answers.profileName.trim()
|
|
397
|
-
};
|
|
398
|
-
if (selectedProfile.authType !== "ccr_proxy") {
|
|
399
|
-
updateData.apiKey = answers.apiKey.trim();
|
|
400
|
-
updateData.baseUrl = answers.baseUrl.trim();
|
|
401
|
-
if (modelConfig) {
|
|
402
|
-
if (modelConfig.primaryModel.trim()) {
|
|
403
|
-
updateData.primaryModel = modelConfig.primaryModel.trim();
|
|
404
|
-
}
|
|
405
|
-
if (modelConfig.haikuModel.trim())
|
|
406
|
-
updateData.defaultHaikuModel = modelConfig.haikuModel.trim();
|
|
407
|
-
if (modelConfig.sonnetModel.trim())
|
|
408
|
-
updateData.defaultSonnetModel = modelConfig.sonnetModel.trim();
|
|
409
|
-
if (modelConfig.opusModel.trim())
|
|
410
|
-
updateData.defaultOpusModel = modelConfig.opusModel.trim();
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
const result = await ClaudeCodeConfigManager.updateProfile(selectedProfile.id, updateData);
|
|
414
|
-
if (result.success) {
|
|
415
|
-
console.log(a.green(i18n.t("multi-config:profileUpdated", { name: updateData.name })));
|
|
416
|
-
if (result.backupPath) {
|
|
417
|
-
console.log(a.gray(i18n.t("common:backupCreated", { path: result.backupPath })));
|
|
418
|
-
}
|
|
419
|
-
const currentConfig = ClaudeCodeConfigManager.readConfig();
|
|
420
|
-
if (currentConfig?.currentProfileId === selectedProfile.id) {
|
|
421
|
-
const updatedProfile = ClaudeCodeConfigManager.getProfileById(selectedProfile.id);
|
|
422
|
-
if (updatedProfile) {
|
|
423
|
-
await ClaudeCodeConfigManager.applyProfileSettings(updatedProfile);
|
|
424
|
-
console.log(a.green(i18n.t("multi-config:settingsApplied")));
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
} else {
|
|
428
|
-
console.log(a.red(i18n.t("multi-config:profileUpdateFailed", { error: result.error })));
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
async function handleCopyProfile(profiles) {
|
|
432
|
-
const choices = profiles.map((profile) => ({
|
|
433
|
-
name: `${profile.name} (${getAuthTypeLabel(profile.authType)})`,
|
|
434
|
-
value: profile.id
|
|
435
|
-
}));
|
|
436
|
-
const { selectedProfileId } = await inquirer.prompt([{
|
|
437
|
-
type: "list",
|
|
438
|
-
name: "selectedProfileId",
|
|
439
|
-
message: i18n.t("multi-config:selectProfileToCopy"),
|
|
440
|
-
choices: addNumbersToChoices(choices)
|
|
441
|
-
}]);
|
|
442
|
-
if (!selectedProfileId) {
|
|
443
|
-
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
444
|
-
return;
|
|
445
|
-
}
|
|
446
|
-
const selectedProfile = profiles.find((p) => p.id === selectedProfileId);
|
|
447
|
-
if (!selectedProfile) {
|
|
448
|
-
console.log(a.red(i18n.t("multi-config:profileNotFound")));
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
console.log(a.green(`
|
|
452
|
-
${i18n.t("multi-config:copyingProfile", { name: selectedProfile.name })}`));
|
|
453
|
-
const copiedName = `${selectedProfile.name}-copy`;
|
|
454
|
-
const questions = [
|
|
455
|
-
{
|
|
456
|
-
type: "input",
|
|
457
|
-
name: "profileName",
|
|
458
|
-
message: i18n.t("multi-config:profileNamePrompt"),
|
|
459
|
-
default: copiedName,
|
|
460
|
-
validate: (input) => {
|
|
461
|
-
const trimmed = input.trim();
|
|
462
|
-
if (!trimmed) {
|
|
463
|
-
return i18n.t("multi-config:profileNameRequired");
|
|
464
|
-
}
|
|
465
|
-
if (!/^[\w\-\s.\u4E00-\u9FA5]+$/.test(trimmed)) {
|
|
466
|
-
return i18n.t("multi-config:profileNameInvalid");
|
|
467
|
-
}
|
|
468
|
-
return true;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
];
|
|
472
|
-
if (selectedProfile.authType !== "ccr_proxy") {
|
|
473
|
-
questions.push(
|
|
474
|
-
{
|
|
475
|
-
type: "input",
|
|
476
|
-
name: "baseUrl",
|
|
477
|
-
message: i18n.t("multi-config:baseUrlPrompt"),
|
|
478
|
-
default: selectedProfile.baseUrl || "https://api.anthropic.com",
|
|
479
|
-
validate: (input) => {
|
|
480
|
-
const trimmed = input.trim();
|
|
481
|
-
if (!trimmed) {
|
|
482
|
-
return i18n.t("multi-config:baseUrlRequired");
|
|
483
|
-
}
|
|
484
|
-
try {
|
|
485
|
-
new URL(trimmed);
|
|
486
|
-
return true;
|
|
487
|
-
} catch {
|
|
488
|
-
return i18n.t("multi-config:baseUrlInvalid");
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
},
|
|
492
|
-
{
|
|
493
|
-
type: "input",
|
|
494
|
-
name: "apiKey",
|
|
495
|
-
message: i18n.t("multi-config:apiKeyPrompt"),
|
|
496
|
-
default: selectedProfile.apiKey,
|
|
497
|
-
validate: (input) => {
|
|
498
|
-
const trimmed = input.trim();
|
|
499
|
-
if (!trimmed) {
|
|
500
|
-
return i18n.t("multi-config:apiKeyRequired");
|
|
501
|
-
}
|
|
502
|
-
const validation = validateApiKey(trimmed);
|
|
503
|
-
if (!validation.isValid) {
|
|
504
|
-
return validation.error || "Invalid API key format";
|
|
505
|
-
}
|
|
506
|
-
return true;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
);
|
|
510
|
-
}
|
|
511
|
-
const answers = await inquirer.prompt(questions);
|
|
512
|
-
let modelConfig = null;
|
|
513
|
-
if (selectedProfile.authType !== "ccr_proxy") {
|
|
514
|
-
const { promptCustomModels } = await import('./features.mjs');
|
|
515
|
-
modelConfig = await promptCustomModels(
|
|
516
|
-
selectedProfile.primaryModel,
|
|
517
|
-
selectedProfile.defaultHaikuModel,
|
|
518
|
-
selectedProfile.defaultSonnetModel,
|
|
519
|
-
selectedProfile.defaultOpusModel
|
|
520
|
-
);
|
|
521
|
-
}
|
|
522
|
-
const setAsDefault = await promptBoolean({
|
|
523
|
-
message: i18n.t("multi-config:setAsDefaultPrompt"),
|
|
524
|
-
defaultValue: false
|
|
525
|
-
});
|
|
526
|
-
const profileName = answers.profileName.trim();
|
|
527
|
-
const profileId = ClaudeCodeConfigManager.generateProfileId(profileName);
|
|
528
|
-
const copiedProfile = {
|
|
529
|
-
id: profileId,
|
|
530
|
-
name: profileName,
|
|
531
|
-
authType: selectedProfile.authType
|
|
532
|
-
};
|
|
533
|
-
if (selectedProfile.authType !== "ccr_proxy") {
|
|
534
|
-
copiedProfile.apiKey = answers.apiKey.trim();
|
|
535
|
-
copiedProfile.baseUrl = answers.baseUrl.trim();
|
|
536
|
-
if (modelConfig) {
|
|
537
|
-
if (modelConfig.primaryModel.trim()) {
|
|
538
|
-
copiedProfile.primaryModel = modelConfig.primaryModel.trim();
|
|
539
|
-
}
|
|
540
|
-
if (modelConfig.haikuModel.trim())
|
|
541
|
-
copiedProfile.defaultHaikuModel = modelConfig.haikuModel.trim();
|
|
542
|
-
if (modelConfig.sonnetModel.trim())
|
|
543
|
-
copiedProfile.defaultSonnetModel = modelConfig.sonnetModel.trim();
|
|
544
|
-
if (modelConfig.opusModel.trim())
|
|
545
|
-
copiedProfile.defaultOpusModel = modelConfig.opusModel.trim();
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
const result = await ClaudeCodeConfigManager.addProfile(copiedProfile);
|
|
549
|
-
if (result.success) {
|
|
550
|
-
const runtimeProfile = result.addedProfile || { ...copiedProfile, id: profileId };
|
|
551
|
-
console.log(a.green(i18n.t("multi-config:profileCopied", { name: runtimeProfile.name })));
|
|
552
|
-
if (result.backupPath) {
|
|
553
|
-
console.log(a.gray(i18n.t("common:backupCreated", { path: result.backupPath })));
|
|
554
|
-
}
|
|
555
|
-
if (setAsDefault) {
|
|
556
|
-
const switchResult = await ClaudeCodeConfigManager.switchProfile(runtimeProfile.id);
|
|
557
|
-
if (switchResult.success) {
|
|
558
|
-
console.log(a.green(i18n.t("multi-config:profileSetAsDefault", { name: runtimeProfile.name })));
|
|
559
|
-
await ClaudeCodeConfigManager.applyProfileSettings(runtimeProfile);
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
} else {
|
|
563
|
-
console.log(a.red(i18n.t("multi-config:profileCopyFailed", { error: result.error })));
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
async function handleDeleteProfile(profiles) {
|
|
567
|
-
if (profiles.length <= 1) {
|
|
568
|
-
console.log(a.yellow(i18n.t("multi-config:cannotDeleteLast")));
|
|
569
|
-
return;
|
|
570
|
-
}
|
|
571
|
-
const choices = profiles.map((profile) => ({
|
|
572
|
-
name: `${profile.name} (${getAuthTypeLabel(profile.authType)})`,
|
|
573
|
-
value: profile.id
|
|
574
|
-
}));
|
|
575
|
-
const { selectedProfileIds } = await inquirer.prompt({
|
|
576
|
-
type: "checkbox",
|
|
577
|
-
name: "selectedProfileIds",
|
|
578
|
-
message: i18n.t("multi-config:selectProfilesToDelete"),
|
|
579
|
-
choices: addNumbersToChoices(choices),
|
|
580
|
-
validate: (input) => {
|
|
581
|
-
if (input.length === 0) {
|
|
582
|
-
return i18n.t("multi-config:selectAtLeastOne");
|
|
583
|
-
}
|
|
584
|
-
if (input.length >= profiles.length) {
|
|
585
|
-
return i18n.t("multi-config:cannotDeleteAll");
|
|
586
|
-
}
|
|
587
|
-
return true;
|
|
588
|
-
}
|
|
589
|
-
});
|
|
590
|
-
if (!selectedProfileIds || selectedProfileIds.length === 0) {
|
|
591
|
-
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
592
|
-
return;
|
|
593
|
-
}
|
|
594
|
-
const selectedNames = selectedProfileIds.map(
|
|
595
|
-
(id) => profiles.find((p) => p.id === id)?.name || id
|
|
596
|
-
);
|
|
597
|
-
const confirmed = await promptBoolean({
|
|
598
|
-
message: i18n.t("multi-config:confirmDeleteProfiles", { providers: selectedNames.join(", ") }),
|
|
599
|
-
defaultValue: false
|
|
600
|
-
});
|
|
601
|
-
if (!confirmed) {
|
|
602
|
-
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
603
|
-
return;
|
|
604
|
-
}
|
|
605
|
-
const result = await ClaudeCodeConfigManager.deleteProfiles(selectedProfileIds);
|
|
606
|
-
if (result.success) {
|
|
607
|
-
console.log(a.green(i18n.t("multi-config:profilesDeleted", { count: selectedProfileIds.length })));
|
|
608
|
-
if (result.backupPath) {
|
|
609
|
-
console.log(a.gray(i18n.t("common:backupCreated", { path: result.backupPath })));
|
|
610
|
-
}
|
|
611
|
-
if (result.newCurrentProfileId) {
|
|
612
|
-
const newProfile = ClaudeCodeConfigManager.getProfileById(result.newCurrentProfileId);
|
|
613
|
-
if (newProfile) {
|
|
614
|
-
console.log(a.green(i18n.t("multi-config:newDefaultProfile", { profile: newProfile.name })));
|
|
615
|
-
await ClaudeCodeConfigManager.applyProfileSettings(newProfile);
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
} else {
|
|
619
|
-
console.log(a.red(i18n.t("multi-config:profilesDeleteFailed", { error: result.error })));
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
export { configureIncrementalManagement, getAuthTypeLabel };
|