ccjk 13.6.7 → 14.0.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.
Files changed (38) hide show
  1. package/dist/chunks/api-cli.mjs +4 -2
  2. package/dist/chunks/api-config-selector.mjs +2 -4
  3. package/dist/chunks/auto-fix.mjs +3 -1
  4. package/dist/chunks/ccjk-all.mjs +5 -2
  5. package/dist/chunks/ccjk-mcp.mjs +5 -2
  6. package/dist/chunks/ccjk-setup.mjs +4 -1
  7. package/dist/chunks/ccr.mjs +3 -5
  8. package/dist/chunks/check-updates.mjs +0 -1
  9. package/dist/chunks/claude-code-incremental-manager.mjs +4 -6
  10. package/dist/chunks/codex-config-switch.mjs +0 -1
  11. package/dist/chunks/codex-provider-manager.mjs +0 -1
  12. package/dist/chunks/codex.mjs +2 -2
  13. package/dist/chunks/config-switch.mjs +2 -4
  14. package/dist/chunks/config.mjs +1104 -5
  15. package/dist/chunks/config2.mjs +6 -4
  16. package/dist/chunks/config3.mjs +4 -2
  17. package/dist/chunks/doctor.mjs +1 -1
  18. package/dist/chunks/evolution.mjs +47 -27
  19. package/dist/chunks/features.mjs +2 -3
  20. package/dist/chunks/index10.mjs +64 -10
  21. package/dist/chunks/init.mjs +6 -7
  22. package/dist/chunks/installer.mjs +2 -2
  23. package/dist/chunks/mcp-cli.mjs +18 -19
  24. package/dist/chunks/mcp.mjs +6 -7
  25. package/dist/chunks/package.mjs +1 -1
  26. package/dist/chunks/platform.mjs +1 -1
  27. package/dist/chunks/quick-setup.mjs +1 -2
  28. package/dist/chunks/slash-commands.mjs +1 -1
  29. package/dist/chunks/update.mjs +4 -5
  30. package/dist/i18n/locales/en/menu.json +7 -0
  31. package/dist/i18n/locales/zh-CN/menu.json +7 -0
  32. package/dist/index.mjs +3 -2
  33. package/dist/shared/{ccjk.DHaUdzX3.mjs → ccjk.B6VCKdyy.mjs} +2 -2
  34. package/dist/shared/{ccjk.B4aXNclK.mjs → ccjk.CVjfbEIj.mjs} +1 -1
  35. package/dist/shared/{ccjk.Dz0ssUQx.mjs → ccjk.Dh6Be-ef.mjs} +1 -1
  36. package/package.json +1 -1
  37. package/dist/chunks/claude-code-config-manager.mjs +0 -811
  38. package/dist/chunks/claude-config.mjs +0 -286
@@ -2,13 +2,1112 @@ import a from './index5.mjs';
2
2
  import { d as dayjs } from '../shared/ccjk.RyizuzOI.mjs';
3
3
  import { i as inquirer } from './index6.mjs';
4
4
  import { fileURLToPath } from 'node:url';
5
- import { CLAUDE_DIR, SETTINGS_FILE, CLAUDE_VSC_CONFIG_FILE, AI_OUTPUT_LANGUAGES } from './constants.mjs';
5
+ import { ZCF_CONFIG_FILE, ZCF_CONFIG_DIR, SETTINGS_FILE, CLAUDE_VSC_CONFIG_FILE, CLAUDE_DIR, ClAUDE_CONFIG_FILE, AI_OUTPUT_LANGUAGES } from './constants.mjs';
6
6
  import { ensureI18nInitialized, i18n } from './index2.mjs';
7
- import { d as setPrimaryApiKey, e as addCompletedOnboarding, g as deepMerge } from './claude-config.mjs';
8
- import { exists, ensureDir, copyDir, writeFileAtomic, copyFile } from './fs-operations.mjs';
9
- import { readJsonConfig, writeJsonConfig } from './json-config.mjs';
7
+ import { existsSync, readFileSync } from 'node:fs';
8
+ import { readJsonConfig, writeJsonConfig, backupJsonConfig } from './json-config.mjs';
9
+ import { i as isWindows, m as getMcpCommand } from './platform.mjs';
10
+ import { ensureDir, exists, copyFile, copyDir, writeFileAtomic } from './fs-operations.mjs';
10
11
  import { m as mergeAndCleanPermissions } from '../shared/ccjk.DScm_NnL.mjs';
11
12
  import { j as join, d as dirname } from '../shared/ccjk.bQ7Dh1g4.mjs';
13
+ import { readDefaultTomlConfig, createDefaultTomlConfig, writeTomlConfig } from './ccjk-config.mjs';
14
+
15
+ function mergeArraysUnique(arr1, arr2) {
16
+ const combined = [...arr1 || [], ...arr2 || []];
17
+ return [...new Set(combined)];
18
+ }
19
+ function isPlainObject(value) {
20
+ return value !== null && typeof value === "object" && value.constructor === Object && Object.prototype.toString.call(value) === "[object Object]";
21
+ }
22
+ function deepMerge(target, source, options = {}) {
23
+ const { mergeArrays = false, arrayMergeStrategy = "replace" } = options;
24
+ const result = { ...target };
25
+ for (const key in source) {
26
+ const sourceValue = source[key];
27
+ const targetValue = result[key];
28
+ if (sourceValue === void 0) {
29
+ continue;
30
+ }
31
+ if (isPlainObject(sourceValue) && isPlainObject(targetValue)) {
32
+ result[key] = deepMerge(targetValue, sourceValue, options);
33
+ } else if (Array.isArray(sourceValue)) {
34
+ if (!mergeArrays || !Array.isArray(targetValue)) {
35
+ result[key] = sourceValue;
36
+ } else {
37
+ switch (arrayMergeStrategy) {
38
+ case "concat":
39
+ result[key] = [...targetValue, ...sourceValue];
40
+ break;
41
+ case "unique":
42
+ result[key] = mergeArraysUnique(targetValue, sourceValue);
43
+ break;
44
+ case "replace":
45
+ default:
46
+ result[key] = sourceValue;
47
+ break;
48
+ }
49
+ }
50
+ } else {
51
+ result[key] = sourceValue;
52
+ }
53
+ }
54
+ return result;
55
+ }
56
+ function deepClone(obj) {
57
+ if (obj === null || typeof obj !== "object") {
58
+ return obj;
59
+ }
60
+ if (obj instanceof Date) {
61
+ return new Date(obj.getTime());
62
+ }
63
+ if (Array.isArray(obj)) {
64
+ return obj.map((item) => deepClone(item));
65
+ }
66
+ if (isPlainObject(obj)) {
67
+ const cloned = {};
68
+ for (const key in obj) {
69
+ cloned[key] = deepClone(obj[key]);
70
+ }
71
+ return cloned;
72
+ }
73
+ return obj;
74
+ }
75
+
76
+ class ClaudeCodeConfigManager {
77
+ static CONFIG_FILE = ZCF_CONFIG_FILE;
78
+ static LEGACY_CONFIG_FILE = join(ZCF_CONFIG_DIR, "claude-code-configs.json");
79
+ /**
80
+ * Ensure configuration directory exists
81
+ */
82
+ static ensureConfigDir() {
83
+ ensureDir(ZCF_CONFIG_DIR);
84
+ }
85
+ /**
86
+ * Read TOML configuration
87
+ */
88
+ static readTomlConfig() {
89
+ return readDefaultTomlConfig();
90
+ }
91
+ /**
92
+ * Load TOML configuration, falling back to default when missing
93
+ */
94
+ static loadTomlConfig() {
95
+ const existingConfig = this.readTomlConfig();
96
+ if (existingConfig) {
97
+ return existingConfig;
98
+ }
99
+ return createDefaultTomlConfig();
100
+ }
101
+ /**
102
+ * Migrate legacy JSON-based configuration into TOML storage
103
+ */
104
+ static migrateFromLegacyConfig() {
105
+ if (!exists(this.LEGACY_CONFIG_FILE)) {
106
+ return null;
107
+ }
108
+ try {
109
+ const legacyConfig = readJsonConfig(this.LEGACY_CONFIG_FILE);
110
+ if (!legacyConfig) {
111
+ return null;
112
+ }
113
+ const normalizedProfiles = {};
114
+ const existingKeys = /* @__PURE__ */ new Set();
115
+ let migratedCurrentKey = "";
116
+ Object.entries(legacyConfig.profiles || {}).forEach(([legacyKey, profile]) => {
117
+ const sourceProfile = profile;
118
+ const name = sourceProfile.name?.trim() || legacyKey;
119
+ const baseKey = this.generateProfileId(name);
120
+ let uniqueKey = baseKey || legacyKey;
121
+ let suffix = 2;
122
+ while (existingKeys.has(uniqueKey)) {
123
+ uniqueKey = `${baseKey || legacyKey}-${suffix++}`;
124
+ }
125
+ existingKeys.add(uniqueKey);
126
+ const sanitizedProfile = this.sanitizeProfile({
127
+ ...sourceProfile,
128
+ name
129
+ });
130
+ normalizedProfiles[uniqueKey] = {
131
+ ...sanitizedProfile,
132
+ id: uniqueKey
133
+ };
134
+ if (legacyConfig.currentProfileId === legacyKey || legacyConfig.currentProfileId === sourceProfile.id) {
135
+ migratedCurrentKey = uniqueKey;
136
+ }
137
+ });
138
+ if (!migratedCurrentKey && legacyConfig.currentProfileId) {
139
+ const fallbackKey = this.generateProfileId(legacyConfig.currentProfileId);
140
+ if (existingKeys.has(fallbackKey)) {
141
+ migratedCurrentKey = fallbackKey;
142
+ }
143
+ }
144
+ if (!migratedCurrentKey && existingKeys.size > 0) {
145
+ migratedCurrentKey = Array.from(existingKeys)[0];
146
+ }
147
+ const migratedConfig = {
148
+ currentProfileId: migratedCurrentKey,
149
+ profiles: normalizedProfiles
150
+ };
151
+ this.writeConfig(migratedConfig);
152
+ return migratedConfig;
153
+ } catch (error) {
154
+ console.error("Failed to migrate legacy Claude Code config:", error);
155
+ return null;
156
+ }
157
+ }
158
+ /**
159
+ * Read configuration
160
+ */
161
+ static readConfig() {
162
+ try {
163
+ const tomlConfig = readDefaultTomlConfig();
164
+ if (!tomlConfig || !tomlConfig.claudeCode) {
165
+ return this.migrateFromLegacyConfig();
166
+ }
167
+ const { claudeCode } = tomlConfig;
168
+ const rawProfiles = claudeCode.profiles || {};
169
+ const sanitizedProfiles = Object.fromEntries(
170
+ Object.entries(rawProfiles).map(([key, profile]) => {
171
+ const storedProfile = this.sanitizeProfile({
172
+ ...profile,
173
+ name: profile.name || key
174
+ });
175
+ return [key, { ...storedProfile, id: key }];
176
+ })
177
+ );
178
+ const configData = {
179
+ currentProfileId: claudeCode.currentProfile || "",
180
+ profiles: sanitizedProfiles
181
+ };
182
+ if (Object.keys(configData.profiles).length === 0) {
183
+ const migrated = this.migrateFromLegacyConfig();
184
+ if (migrated) {
185
+ return migrated;
186
+ }
187
+ }
188
+ return configData;
189
+ } catch (error) {
190
+ console.error("Failed to read Claude Code config:", error);
191
+ return null;
192
+ }
193
+ }
194
+ /**
195
+ * Write configuration
196
+ */
197
+ static writeConfig(config) {
198
+ try {
199
+ this.ensureConfigDir();
200
+ const keyMap = /* @__PURE__ */ new Map();
201
+ const sanitizedProfiles = Object.fromEntries(
202
+ Object.entries(config.profiles).map(([key, profile]) => {
203
+ const normalizedName = profile.name?.trim() || key;
204
+ const profileKey = this.generateProfileId(normalizedName);
205
+ keyMap.set(key, profileKey);
206
+ const sanitizedProfile = this.sanitizeProfile({
207
+ ...profile,
208
+ name: normalizedName
209
+ });
210
+ return [profileKey, sanitizedProfile];
211
+ })
212
+ );
213
+ const tomlConfig = this.loadTomlConfig();
214
+ const nextTomlConfig = {
215
+ ...tomlConfig,
216
+ claudeCode: {
217
+ ...tomlConfig.claudeCode,
218
+ currentProfile: keyMap.get(config.currentProfileId) || config.currentProfileId,
219
+ profiles: sanitizedProfiles
220
+ }
221
+ };
222
+ writeTomlConfig(this.CONFIG_FILE, nextTomlConfig);
223
+ } catch (error) {
224
+ console.error("Failed to write Claude Code config:", error);
225
+ throw new Error(`Failed to write config: ${error instanceof Error ? error.message : String(error)}`);
226
+ }
227
+ }
228
+ /**
229
+ * Create empty configuration
230
+ */
231
+ static createEmptyConfig() {
232
+ return {
233
+ currentProfileId: "",
234
+ profiles: {}
235
+ };
236
+ }
237
+ static settingsMatchProfile(settings, profile) {
238
+ const env = settings?.env || {};
239
+ if (!profile) {
240
+ return !settings?.model && !env.ANTHROPIC_MODEL && !env.ANTHROPIC_DEFAULT_HAIKU_MODEL && !env.ANTHROPIC_DEFAULT_SONNET_MODEL && !env.ANTHROPIC_DEFAULT_OPUS_MODEL;
241
+ }
242
+ const expectedPrimary = profile.primaryModel?.trim();
243
+ const expectedHaiku = profile.defaultHaikuModel?.trim();
244
+ const expectedSonnet = profile.defaultSonnetModel?.trim();
245
+ const expectedOpus = profile.defaultOpusModel?.trim();
246
+ const hasExplicitModelConfig = Boolean(expectedPrimary || expectedHaiku || expectedSonnet || expectedOpus);
247
+ if (!hasExplicitModelConfig) {
248
+ return !settings?.model && (env.ANTHROPIC_MODEL === "" || env.ANTHROPIC_MODEL === void 0) && env.ANTHROPIC_DEFAULT_HAIKU_MODEL === void 0 && env.ANTHROPIC_DEFAULT_SONNET_MODEL === void 0 && env.ANTHROPIC_DEFAULT_OPUS_MODEL === void 0;
249
+ }
250
+ const hasAdaptiveRouting = Boolean(expectedHaiku || expectedSonnet || expectedOpus);
251
+ if (hasAdaptiveRouting) {
252
+ return !settings?.model && env.ANTHROPIC_MODEL === void 0 && env.ANTHROPIC_DEFAULT_HAIKU_MODEL === expectedHaiku && env.ANTHROPIC_SMALL_FAST_MODEL === expectedHaiku && env.ANTHROPIC_DEFAULT_SONNET_MODEL === expectedSonnet && env.ANTHROPIC_DEFAULT_OPUS_MODEL === expectedOpus;
253
+ }
254
+ return settings?.model === expectedPrimary && env.ANTHROPIC_MODEL === void 0 && env.ANTHROPIC_DEFAULT_HAIKU_MODEL === expectedHaiku && env.ANTHROPIC_SMALL_FAST_MODEL === expectedHaiku && env.ANTHROPIC_DEFAULT_SONNET_MODEL === expectedSonnet && env.ANTHROPIC_DEFAULT_OPUS_MODEL === expectedOpus;
255
+ }
256
+ static async syncCurrentProfileToSettings() {
257
+ const currentProfile = this.getCurrentProfile();
258
+ await this.applyProfileSettings(currentProfile);
259
+ }
260
+ /**
261
+ * Apply profile settings to Claude Code runtime
262
+ */
263
+ static async applyProfileSettings(profile) {
264
+ const { ensureI18nInitialized, i18n } = await import('./index2.mjs');
265
+ ensureI18nInitialized();
266
+ try {
267
+ if (!profile) {
268
+ const { switchToOfficialLogin } = await Promise.resolve().then(function () { return config; });
269
+ switchToOfficialLogin();
270
+ return;
271
+ }
272
+ const { readJsonConfig: readJsonConfig2, writeJsonConfig } = await import('./json-config.mjs');
273
+ const settings = readJsonConfig2(SETTINGS_FILE) || {};
274
+ if (!settings.env)
275
+ settings.env = {};
276
+ let shouldRestartCcr = false;
277
+ if (profile.authType === "api_key") {
278
+ settings.env.ANTHROPIC_API_KEY = profile.apiKey;
279
+ delete settings.env.ANTHROPIC_AUTH_TOKEN;
280
+ } else if (profile.authType === "auth_token") {
281
+ settings.env.ANTHROPIC_AUTH_TOKEN = profile.apiKey;
282
+ delete settings.env.ANTHROPIC_API_KEY;
283
+ } else if (profile.authType === "ccr_proxy") {
284
+ const { readCcrConfig } = await import('./config2.mjs');
285
+ const ccrConfig = readCcrConfig();
286
+ if (!ccrConfig) {
287
+ throw new Error(i18n.t("ccr:ccrNotConfigured") || "CCR proxy configuration not found");
288
+ }
289
+ const host = ccrConfig.HOST || "127.0.0.1";
290
+ const port = ccrConfig.PORT || 3456;
291
+ const apiKey = ccrConfig.APIKEY || "sk-ccjk-x-ccr";
292
+ settings.env.ANTHROPIC_BASE_URL = `http://${host}:${port}`;
293
+ settings.env.ANTHROPIC_API_KEY = apiKey;
294
+ delete settings.env.ANTHROPIC_AUTH_TOKEN;
295
+ shouldRestartCcr = true;
296
+ }
297
+ if (profile.authType !== "ccr_proxy") {
298
+ if (profile.baseUrl)
299
+ settings.env.ANTHROPIC_BASE_URL = profile.baseUrl;
300
+ else
301
+ delete settings.env.ANTHROPIC_BASE_URL;
302
+ }
303
+ const hasModelConfig = Boolean(
304
+ profile.primaryModel || profile.defaultHaikuModel || profile.defaultSonnetModel || profile.defaultOpusModel
305
+ );
306
+ const modelMode = hasModelConfig ? "override" : "reset";
307
+ overwriteModelSettings(settings, {
308
+ primaryModel: profile.primaryModel,
309
+ haikuModel: profile.defaultHaikuModel,
310
+ sonnetModel: profile.defaultSonnetModel,
311
+ opusModel: profile.defaultOpusModel
312
+ }, modelMode);
313
+ writeJsonConfig(SETTINGS_FILE, settings);
314
+ const { setPrimaryApiKey, addCompletedOnboarding } = await Promise.resolve().then(function () { return claudeConfig; });
315
+ setPrimaryApiKey();
316
+ addCompletedOnboarding();
317
+ let verifiedSettings = readJsonConfig2(SETTINGS_FILE) || {};
318
+ if (!this.settingsMatchProfile(verifiedSettings, profile)) {
319
+ const repairedSettings = readJsonConfig2(SETTINGS_FILE) || {};
320
+ repairedSettings.env = repairedSettings.env || {};
321
+ if (profile?.authType === "api_key") {
322
+ repairedSettings.env.ANTHROPIC_API_KEY = profile.apiKey;
323
+ delete repairedSettings.env.ANTHROPIC_AUTH_TOKEN;
324
+ } else if (profile?.authType === "auth_token") {
325
+ repairedSettings.env.ANTHROPIC_AUTH_TOKEN = profile.apiKey;
326
+ delete repairedSettings.env.ANTHROPIC_API_KEY;
327
+ }
328
+ if (profile?.authType !== "ccr_proxy") {
329
+ if (profile?.baseUrl)
330
+ repairedSettings.env.ANTHROPIC_BASE_URL = profile.baseUrl;
331
+ else
332
+ delete repairedSettings.env.ANTHROPIC_BASE_URL;
333
+ }
334
+ overwriteModelSettings(repairedSettings, {
335
+ primaryModel: profile?.primaryModel,
336
+ haikuModel: profile?.defaultHaikuModel,
337
+ sonnetModel: profile?.defaultSonnetModel,
338
+ opusModel: profile?.defaultOpusModel
339
+ }, profile ? modelMode : "reset");
340
+ writeJsonConfig(SETTINGS_FILE, repairedSettings);
341
+ verifiedSettings = readJsonConfig2(SETTINGS_FILE) || {};
342
+ }
343
+ if (!this.settingsMatchProfile(verifiedSettings, profile)) {
344
+ throw new Error("settings.json verification failed after applying current profile");
345
+ }
346
+ if (shouldRestartCcr) {
347
+ const { runCcrRestart } = await import('./commands.mjs');
348
+ await runCcrRestart();
349
+ }
350
+ } catch (error) {
351
+ const reason = error instanceof Error ? error.message : String(error);
352
+ throw new Error(`${i18n.t("multi-config:failedToApplySettings")}: ${reason}`);
353
+ }
354
+ }
355
+ static async applyCurrentProfile() {
356
+ await this.syncCurrentProfileToSettings();
357
+ }
358
+ /**
359
+ * Remove unsupported fields from profile payload
360
+ */
361
+ static sanitizeProfile(profile) {
362
+ const sanitized = {
363
+ name: profile.name,
364
+ authType: profile.authType
365
+ };
366
+ if (profile.provider)
367
+ sanitized.provider = profile.provider;
368
+ if (profile.apiKey)
369
+ sanitized.apiKey = profile.apiKey;
370
+ if (profile.baseUrl)
371
+ sanitized.baseUrl = profile.baseUrl;
372
+ if (profile.primaryModel)
373
+ sanitized.primaryModel = profile.primaryModel;
374
+ if (profile.defaultHaikuModel)
375
+ sanitized.defaultHaikuModel = profile.defaultHaikuModel;
376
+ if (profile.defaultSonnetModel)
377
+ sanitized.defaultSonnetModel = profile.defaultSonnetModel;
378
+ if (profile.defaultOpusModel)
379
+ sanitized.defaultOpusModel = profile.defaultOpusModel;
380
+ return sanitized;
381
+ }
382
+ /**
383
+ * Backup configuration
384
+ */
385
+ static backupConfig() {
386
+ try {
387
+ if (!exists(this.CONFIG_FILE)) {
388
+ return null;
389
+ }
390
+ const timestamp = dayjs().format("YYYY-MM-DD_HH-mm-ss");
391
+ const backupPath = join(ZCF_CONFIG_DIR, `config.backup.${timestamp}.toml`);
392
+ copyFile(this.CONFIG_FILE, backupPath);
393
+ return backupPath;
394
+ } catch (error) {
395
+ console.error("Failed to backup Claude Code config:", error);
396
+ return null;
397
+ }
398
+ }
399
+ /**
400
+ * Add configuration
401
+ */
402
+ static async addProfile(profile) {
403
+ try {
404
+ const validationErrors = this.validateProfile(profile);
405
+ if (validationErrors.length > 0) {
406
+ return {
407
+ success: false,
408
+ error: `Validation failed: ${validationErrors.join(", ")}`
409
+ };
410
+ }
411
+ const backupPath = this.backupConfig();
412
+ let config = this.readConfig();
413
+ if (!config) {
414
+ config = this.createEmptyConfig();
415
+ }
416
+ if (profile.id && config.profiles[profile.id]) {
417
+ return {
418
+ success: false,
419
+ error: `Profile with ID "${profile.id}" already exists`,
420
+ backupPath: backupPath || void 0
421
+ };
422
+ }
423
+ const normalizedName = profile.name.trim();
424
+ const profileKey = this.generateProfileId(normalizedName);
425
+ const existingNames = Object.values(config.profiles).map((p) => p.name || "");
426
+ if (config.profiles[profileKey] || existingNames.some((name) => name.toLowerCase() === normalizedName.toLowerCase())) {
427
+ return {
428
+ success: false,
429
+ error: `Profile with name "${profile.name}" already exists`,
430
+ backupPath: backupPath || void 0
431
+ };
432
+ }
433
+ const sanitizedProfile = this.sanitizeProfile({
434
+ ...profile,
435
+ name: normalizedName
436
+ });
437
+ const runtimeProfile = {
438
+ ...sanitizedProfile,
439
+ id: profileKey
440
+ };
441
+ config.profiles[profileKey] = runtimeProfile;
442
+ if (!config.currentProfileId) {
443
+ config.currentProfileId = profileKey;
444
+ }
445
+ this.writeConfig(config);
446
+ if (config.currentProfileId === profileKey) {
447
+ await this.syncCurrentProfileToSettings();
448
+ }
449
+ return {
450
+ success: true,
451
+ backupPath: backupPath || void 0,
452
+ addedProfile: runtimeProfile
453
+ };
454
+ } catch (error) {
455
+ return {
456
+ success: false,
457
+ error: error instanceof Error ? error.message : String(error)
458
+ };
459
+ }
460
+ }
461
+ /**
462
+ * Update configuration
463
+ */
464
+ static async updateProfile(id, data) {
465
+ try {
466
+ const validationErrors = this.validateProfile(data, true);
467
+ if (validationErrors.length > 0) {
468
+ return {
469
+ success: false,
470
+ error: `Validation failed: ${validationErrors.join(", ")}`
471
+ };
472
+ }
473
+ const backupPath = this.backupConfig();
474
+ const config = this.readConfig();
475
+ if (!config || !config.profiles[id]) {
476
+ return {
477
+ success: false,
478
+ error: `Profile with ID "${id}" not found`,
479
+ backupPath: backupPath || void 0
480
+ };
481
+ }
482
+ const existingProfile = config.profiles[id];
483
+ const nextName = data.name !== void 0 ? data.name.trim() : existingProfile.name;
484
+ const nextKey = this.generateProfileId(nextName);
485
+ const nameChanged = nextKey !== id;
486
+ if (nameChanged) {
487
+ const duplicateName = Object.entries(config.profiles).some(([key, profile]) => key !== id && (profile.name || "").toLowerCase() === nextName.toLowerCase());
488
+ if (duplicateName || config.profiles[nextKey]) {
489
+ return {
490
+ success: false,
491
+ error: `Profile with name "${data.name}" already exists`,
492
+ backupPath: backupPath || void 0
493
+ };
494
+ }
495
+ }
496
+ const mergedProfile = this.sanitizeProfile({
497
+ ...existingProfile,
498
+ ...data,
499
+ name: nextName
500
+ });
501
+ if (nameChanged) {
502
+ delete config.profiles[id];
503
+ config.profiles[nextKey] = {
504
+ ...mergedProfile,
505
+ id: nextKey
506
+ };
507
+ if (config.currentProfileId === id) {
508
+ config.currentProfileId = nextKey;
509
+ }
510
+ } else {
511
+ config.profiles[id] = {
512
+ ...mergedProfile,
513
+ id
514
+ };
515
+ }
516
+ this.writeConfig(config);
517
+ if (config.currentProfileId === (nameChanged ? nextKey : id)) {
518
+ await this.syncCurrentProfileToSettings();
519
+ }
520
+ return {
521
+ success: true,
522
+ backupPath: backupPath || void 0,
523
+ updatedProfile: {
524
+ ...mergedProfile,
525
+ id: nameChanged ? nextKey : id
526
+ }
527
+ };
528
+ } catch (error) {
529
+ return {
530
+ success: false,
531
+ error: error instanceof Error ? error.message : String(error)
532
+ };
533
+ }
534
+ }
535
+ /**
536
+ * Delete configuration
537
+ */
538
+ static async deleteProfile(id) {
539
+ try {
540
+ const backupPath = this.backupConfig();
541
+ const config = this.readConfig();
542
+ if (!config || !config.profiles[id]) {
543
+ return {
544
+ success: false,
545
+ error: `Profile with ID "${id}" not found`,
546
+ backupPath: backupPath || void 0
547
+ };
548
+ }
549
+ const profileCount = Object.keys(config.profiles).length;
550
+ if (profileCount === 1) {
551
+ return {
552
+ success: false,
553
+ error: "Cannot delete the last profile. At least one profile must remain.",
554
+ backupPath: backupPath || void 0
555
+ };
556
+ }
557
+ delete config.profiles[id];
558
+ if (config.currentProfileId === id) {
559
+ const remainingIds = Object.keys(config.profiles);
560
+ config.currentProfileId = remainingIds[0];
561
+ }
562
+ this.writeConfig(config);
563
+ if (config.currentProfileId) {
564
+ await this.syncCurrentProfileToSettings();
565
+ }
566
+ return {
567
+ success: true,
568
+ backupPath: backupPath || void 0,
569
+ remainingProfiles: Object.entries(config.profiles).map(([key, profile]) => ({
570
+ ...profile,
571
+ id: key
572
+ }))
573
+ };
574
+ } catch (error) {
575
+ return {
576
+ success: false,
577
+ error: error instanceof Error ? error.message : String(error)
578
+ };
579
+ }
580
+ }
581
+ /**
582
+ * Delete multiple configurations
583
+ */
584
+ static async deleteProfiles(ids) {
585
+ try {
586
+ const backupPath = this.backupConfig();
587
+ const config = this.readConfig();
588
+ if (!config) {
589
+ return {
590
+ success: false,
591
+ error: "No configuration found",
592
+ backupPath: backupPath || void 0
593
+ };
594
+ }
595
+ const missingIds = ids.filter((id) => !config.profiles[id]);
596
+ if (missingIds.length > 0) {
597
+ return {
598
+ success: false,
599
+ error: `Profiles not found: ${missingIds.join(", ")}`,
600
+ backupPath: backupPath || void 0
601
+ };
602
+ }
603
+ const remainingCount = Object.keys(config.profiles).length - ids.length;
604
+ if (remainingCount === 0) {
605
+ return {
606
+ success: false,
607
+ error: "Cannot delete all profiles. At least one profile must remain.",
608
+ backupPath: backupPath || void 0
609
+ };
610
+ }
611
+ let newCurrentProfileId;
612
+ ids.forEach((id) => {
613
+ delete config.profiles[id];
614
+ });
615
+ if (ids.includes(config.currentProfileId)) {
616
+ const remainingIds = Object.keys(config.profiles);
617
+ config.currentProfileId = remainingIds[0];
618
+ newCurrentProfileId = config.currentProfileId;
619
+ }
620
+ this.writeConfig(config);
621
+ if (config.currentProfileId) {
622
+ await this.syncCurrentProfileToSettings();
623
+ }
624
+ return {
625
+ success: true,
626
+ backupPath: backupPath || void 0,
627
+ newCurrentProfileId,
628
+ deletedProfiles: ids,
629
+ remainingProfiles: Object.entries(config.profiles).map(([key, profile]) => ({
630
+ ...profile,
631
+ id: key
632
+ }))
633
+ };
634
+ } catch (error) {
635
+ return {
636
+ success: false,
637
+ error: error instanceof Error ? error.message : String(error)
638
+ };
639
+ }
640
+ }
641
+ /**
642
+ * Generate profile ID from name
643
+ */
644
+ static generateProfileId(name) {
645
+ return name.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "profile";
646
+ }
647
+ /**
648
+ * Switch configuration
649
+ */
650
+ static async switchProfile(id) {
651
+ try {
652
+ const config = this.readConfig();
653
+ if (!config || !config.profiles[id]) {
654
+ return {
655
+ success: false,
656
+ error: "Profile not found"
657
+ };
658
+ }
659
+ if (config.currentProfileId === id) {
660
+ return { success: true };
661
+ }
662
+ config.currentProfileId = id;
663
+ this.writeConfig(config);
664
+ await this.syncCurrentProfileToSettings();
665
+ return { success: true };
666
+ } catch (error) {
667
+ return {
668
+ success: false,
669
+ error: error instanceof Error ? error.message : String(error)
670
+ };
671
+ }
672
+ }
673
+ /**
674
+ * List all configurations
675
+ */
676
+ static listProfiles() {
677
+ const config = this.readConfig();
678
+ if (!config) {
679
+ return [];
680
+ }
681
+ return Object.values(config.profiles);
682
+ }
683
+ /**
684
+ * Get current configuration
685
+ */
686
+ static getCurrentProfile() {
687
+ const config = this.readConfig();
688
+ if (!config || !config.currentProfileId) {
689
+ return null;
690
+ }
691
+ return config.profiles[config.currentProfileId] || null;
692
+ }
693
+ /**
694
+ * Get configuration by ID
695
+ */
696
+ static getProfileById(id) {
697
+ const config = this.readConfig();
698
+ if (!config) {
699
+ return null;
700
+ }
701
+ return config.profiles[id] || null;
702
+ }
703
+ /**
704
+ * Get configuration by name
705
+ */
706
+ static getProfileByName(name) {
707
+ const config = this.readConfig();
708
+ if (!config) {
709
+ return null;
710
+ }
711
+ return Object.values(config.profiles).find((p) => p.name === name) || null;
712
+ }
713
+ /**
714
+ * Sync CCR configuration
715
+ */
716
+ static async syncCcrProfile() {
717
+ try {
718
+ const { readCcrConfig } = await import('./config2.mjs');
719
+ const ccrConfig = readCcrConfig();
720
+ if (!ccrConfig) {
721
+ await this.ensureCcrProfileExists(ccrConfig);
722
+ return;
723
+ }
724
+ await this.ensureCcrProfileExists(ccrConfig);
725
+ } catch (error) {
726
+ console.error("Failed to sync CCR profile:", error);
727
+ }
728
+ }
729
+ /**
730
+ * 确保CCR配置文件存在
731
+ */
732
+ static async ensureCcrProfileExists(ccrConfig) {
733
+ const config = this.readConfig() || this.createEmptyConfig();
734
+ const ccrProfileId = "ccr-proxy";
735
+ const existingCcrProfile = config.profiles[ccrProfileId];
736
+ if (!ccrConfig) {
737
+ if (existingCcrProfile) {
738
+ delete config.profiles[ccrProfileId];
739
+ if (config.currentProfileId === ccrProfileId) {
740
+ const remainingIds = Object.keys(config.profiles);
741
+ config.currentProfileId = remainingIds[0] || "";
742
+ }
743
+ this.writeConfig(config);
744
+ }
745
+ return;
746
+ }
747
+ const host = ccrConfig.HOST || "127.0.0.1";
748
+ const port = ccrConfig.PORT || 3456;
749
+ const apiKey = ccrConfig.APIKEY || "sk-ccjk-x-ccr";
750
+ const baseUrl = `http://${host}:${port}`;
751
+ const ccrProfile = {
752
+ name: "CCR Proxy",
753
+ authType: "ccr_proxy",
754
+ baseUrl,
755
+ apiKey
756
+ };
757
+ config.profiles[ccrProfileId] = {
758
+ ...ccrProfile,
759
+ id: ccrProfileId
760
+ };
761
+ if (!config.currentProfileId) {
762
+ config.currentProfileId = ccrProfileId;
763
+ }
764
+ this.writeConfig(config);
765
+ }
766
+ /**
767
+ * Switch to official login
768
+ */
769
+ static async switchToOfficial() {
770
+ try {
771
+ const config = this.readConfig();
772
+ if (!config) {
773
+ return { success: true };
774
+ }
775
+ config.currentProfileId = "";
776
+ this.writeConfig(config);
777
+ await this.applyProfileSettings(null);
778
+ return { success: true };
779
+ } catch (error) {
780
+ return {
781
+ success: false,
782
+ error: error instanceof Error ? error.message : String(error)
783
+ };
784
+ }
785
+ }
786
+ /**
787
+ * Switch to CCR proxy
788
+ */
789
+ static async switchToCcr() {
790
+ try {
791
+ await this.syncCcrProfile();
792
+ const config = this.readConfig();
793
+ if (!config || !config.profiles["ccr-proxy"]) {
794
+ return {
795
+ success: false,
796
+ error: "CCR proxy configuration not found. Please configure CCR first."
797
+ };
798
+ }
799
+ return await this.switchProfile("ccr-proxy");
800
+ } catch (error) {
801
+ return {
802
+ success: false,
803
+ error: error instanceof Error ? error.message : String(error)
804
+ };
805
+ }
806
+ }
807
+ /**
808
+ * Validate configuration
809
+ */
810
+ static validateProfile(profile, isUpdate = false) {
811
+ const errors = [];
812
+ if (!isUpdate && (!profile.name || typeof profile.name !== "string" || profile.name.trim() === "")) {
813
+ errors.push("Profile name is required");
814
+ }
815
+ if (profile.name && typeof profile.name !== "string") {
816
+ errors.push("Profile name must be a string");
817
+ }
818
+ if (profile.authType && !["api_key", "auth_token", "ccr_proxy"].includes(profile.authType)) {
819
+ errors.push("Invalid auth type. Must be one of: api_key, auth_token, ccr_proxy");
820
+ }
821
+ if (profile.authType === "api_key" || profile.authType === "auth_token") {
822
+ if (!profile.apiKey || typeof profile.apiKey !== "string" || profile.apiKey.trim() === "") {
823
+ errors.push("API key is required for api_key and auth_token types");
824
+ }
825
+ }
826
+ if (profile.baseUrl) {
827
+ try {
828
+ new URL(profile.baseUrl);
829
+ } catch {
830
+ errors.push("Invalid base URL format");
831
+ }
832
+ }
833
+ return errors;
834
+ }
835
+ /**
836
+ * 检查是否为最后一个配置
837
+ */
838
+ static isLastProfile(id) {
839
+ const config = this.readConfig();
840
+ if (!config || !config.profiles[id]) {
841
+ return false;
842
+ }
843
+ return Object.keys(config.profiles).length === 1;
844
+ }
845
+ }
846
+
847
+ const claudeCodeConfigManager = {
848
+ __proto__: null,
849
+ ClaudeCodeConfigManager: ClaudeCodeConfigManager
850
+ };
851
+
852
+ function readMcpConfig() {
853
+ return readJsonConfig(ClAUDE_CONFIG_FILE);
854
+ }
855
+ function writeMcpConfig(config) {
856
+ writeJsonConfig(ClAUDE_CONFIG_FILE, config);
857
+ }
858
+ function backupMcpConfig() {
859
+ const backupBaseDir = join(CLAUDE_DIR, "backup");
860
+ return backupJsonConfig(ClAUDE_CONFIG_FILE, backupBaseDir);
861
+ }
862
+ function mergeMcpServers(existing, newServers) {
863
+ const config = existing || { mcpServers: {} };
864
+ if (!config.mcpServers) {
865
+ config.mcpServers = {};
866
+ }
867
+ Object.assign(config.mcpServers, newServers);
868
+ return config;
869
+ }
870
+ function replaceMcpServers(existing, newServers) {
871
+ const config = existing ? { ...existing } : { mcpServers: {} };
872
+ config.mcpServers = { ...newServers };
873
+ return config;
874
+ }
875
+ function applyPlatformCommand(config) {
876
+ if (isWindows() && config.command) {
877
+ const mcpCmd = getMcpCommand(config.command);
878
+ if (mcpCmd[0] === "cmd") {
879
+ config.command = mcpCmd[0];
880
+ config.args = [...mcpCmd.slice(1), ...config.args || []];
881
+ }
882
+ }
883
+ }
884
+ function buildMcpServerConfig(baseConfig, apiKey, placeholder = "YOUR_EXA_API_KEY", envVarName) {
885
+ const config = deepClone(baseConfig);
886
+ applyPlatformCommand(config);
887
+ if (!apiKey) {
888
+ return config;
889
+ }
890
+ if (envVarName && config.env) {
891
+ config.env[envVarName] = apiKey;
892
+ return config;
893
+ }
894
+ if (config.args) {
895
+ config.args = config.args.map((arg) => arg.replace(placeholder, apiKey));
896
+ }
897
+ if (config.url) {
898
+ config.url = config.url.replace(placeholder, apiKey);
899
+ }
900
+ return config;
901
+ }
902
+ function fixWindowsMcpConfig(config) {
903
+ if (!isWindows() || !config.mcpServers) {
904
+ return config;
905
+ }
906
+ const fixed = { ...config };
907
+ for (const [, serverConfig] of Object.entries(fixed.mcpServers)) {
908
+ if (serverConfig && typeof serverConfig === "object" && "command" in serverConfig) {
909
+ applyPlatformCommand(serverConfig);
910
+ }
911
+ }
912
+ return fixed;
913
+ }
914
+ function addCompletedOnboarding() {
915
+ try {
916
+ let config = readMcpConfig();
917
+ if (!config) {
918
+ config = { mcpServers: {} };
919
+ }
920
+ if (config.hasCompletedOnboarding === true) {
921
+ return;
922
+ }
923
+ config.hasCompletedOnboarding = true;
924
+ writeMcpConfig(config);
925
+ } catch (error) {
926
+ console.error("Failed to add onboarding flag", error);
927
+ throw error;
928
+ }
929
+ }
930
+ function ensureApiKeyApproved(config, apiKey) {
931
+ if (!apiKey || typeof apiKey !== "string" || apiKey.trim() === "") {
932
+ return config;
933
+ }
934
+ const truncatedApiKey = apiKey.substring(0, 20);
935
+ const updatedConfig = { ...config };
936
+ if (!updatedConfig.customApiKeyResponses) {
937
+ updatedConfig.customApiKeyResponses = {
938
+ approved: [],
939
+ rejected: []
940
+ };
941
+ }
942
+ if (!Array.isArray(updatedConfig.customApiKeyResponses.approved)) {
943
+ updatedConfig.customApiKeyResponses.approved = [];
944
+ }
945
+ if (!Array.isArray(updatedConfig.customApiKeyResponses.rejected)) {
946
+ updatedConfig.customApiKeyResponses.rejected = [];
947
+ }
948
+ const rejectedIndex = updatedConfig.customApiKeyResponses.rejected.indexOf(truncatedApiKey);
949
+ if (rejectedIndex > -1) {
950
+ updatedConfig.customApiKeyResponses.rejected.splice(rejectedIndex, 1);
951
+ }
952
+ if (!updatedConfig.customApiKeyResponses.approved.includes(truncatedApiKey)) {
953
+ updatedConfig.customApiKeyResponses.approved.push(truncatedApiKey);
954
+ }
955
+ return updatedConfig;
956
+ }
957
+ function manageApiKeyApproval(apiKey) {
958
+ try {
959
+ let config = readMcpConfig();
960
+ if (!config) {
961
+ config = { mcpServers: {} };
962
+ }
963
+ const updatedConfig = ensureApiKeyApproved(config, apiKey);
964
+ writeMcpConfig(updatedConfig);
965
+ } catch (error) {
966
+ ensureI18nInitialized();
967
+ console.error(i18n.t("mcp:apiKeyApprovalFailed"), error);
968
+ }
969
+ }
970
+ function setPrimaryApiKey() {
971
+ try {
972
+ let config = readJsonConfig(CLAUDE_VSC_CONFIG_FILE);
973
+ if (!config) {
974
+ config = {};
975
+ }
976
+ config.primaryApiKey = "ccjk";
977
+ writeJsonConfig(CLAUDE_VSC_CONFIG_FILE, config);
978
+ } catch (error) {
979
+ ensureI18nInitialized();
980
+ console.error(i18n.t("mcp:primaryApiKeySetFailed"), error);
981
+ }
982
+ }
983
+ function setMyclaudeProviderProfiles(profiles, activeProfileId) {
984
+ const config = readMcpConfig() || { mcpServers: {} };
985
+ config.myclaudeProviderProfiles = profiles;
986
+ config.myclaudeActiveProviderProfileId = activeProfileId ?? profiles[0]?.id;
987
+ writeMcpConfig(config);
988
+ }
989
+ function setMyclaudeActiveProviderProfile(activeProfileId) {
990
+ const config = readMcpConfig() || { mcpServers: {} };
991
+ config.myclaudeActiveProviderProfileId = activeProfileId ?? "";
992
+ writeMcpConfig(config);
993
+ }
994
+ function toMyclaudeProviderProfile(profile, existing) {
995
+ return {
996
+ id: profile.id || existing?.id || profile.name,
997
+ name: profile.name,
998
+ provider: profile.provider || existing?.provider || "custom",
999
+ apiKey: profile.apiKey,
1000
+ baseUrl: profile.baseUrl,
1001
+ model: profile.primaryModel,
1002
+ fastModel: profile.defaultHaikuModel,
1003
+ authType: profile.authType,
1004
+ primaryModel: profile.primaryModel,
1005
+ defaultHaikuModel: profile.defaultHaikuModel,
1006
+ defaultSonnetModel: profile.defaultSonnetModel,
1007
+ defaultOpusModel: profile.defaultOpusModel
1008
+ };
1009
+ }
1010
+ function syncMyclaudeActiveProfileToSettings(profile) {
1011
+ const settings = readJsonConfig(SETTINGS_FILE) || {};
1012
+ settings.env = settings.env || {};
1013
+ if (profile?.authType === "auth_token") {
1014
+ settings.env.ANTHROPIC_AUTH_TOKEN = profile.apiKey;
1015
+ delete settings.env.ANTHROPIC_API_KEY;
1016
+ } else if (profile?.apiKey) {
1017
+ settings.env.ANTHROPIC_API_KEY = profile.apiKey;
1018
+ delete settings.env.ANTHROPIC_AUTH_TOKEN;
1019
+ } else {
1020
+ delete settings.env.ANTHROPIC_API_KEY;
1021
+ delete settings.env.ANTHROPIC_AUTH_TOKEN;
1022
+ }
1023
+ if (profile?.baseUrl) {
1024
+ settings.env.ANTHROPIC_BASE_URL = profile.baseUrl;
1025
+ } else {
1026
+ delete settings.env.ANTHROPIC_BASE_URL;
1027
+ }
1028
+ overwriteModelSettings(settings, {
1029
+ primaryModel: typeof profile?.primaryModel === "string" ? profile.primaryModel : typeof profile?.model === "string" ? profile.model : void 0,
1030
+ haikuModel: typeof profile?.defaultHaikuModel === "string" ? profile.defaultHaikuModel : typeof profile?.fastModel === "string" ? profile.fastModel : void 0,
1031
+ sonnetModel: typeof profile?.defaultSonnetModel === "string" ? profile.defaultSonnetModel : void 0,
1032
+ opusModel: typeof profile?.defaultOpusModel === "string" ? profile.defaultOpusModel : void 0
1033
+ }, profile ? "override" : "reset");
1034
+ writeJsonConfig(SETTINGS_FILE, settings);
1035
+ }
1036
+ function syncMyclaudeProviderProfilesFromClaudeConfig(configData) {
1037
+ if (!configData) {
1038
+ clearMyclaudeProviderProfiles();
1039
+ return {
1040
+ activeProfileId: "",
1041
+ activeProfile: null,
1042
+ profiles: []
1043
+ };
1044
+ }
1045
+ const existingProfiles = readMcpConfig()?.myclaudeProviderProfiles || [];
1046
+ const existingById = new Map(existingProfiles.map((profile) => [String(profile.id), profile]));
1047
+ const profiles = Object.entries(configData.profiles).map(([id, profile]) => toMyclaudeProviderProfile({ ...profile, id }, existingById.get(id)));
1048
+ const activeProfileId = configData.currentProfileId ?? "";
1049
+ const activeProfile = profiles.find((profile) => profile.id === activeProfileId) || null;
1050
+ setMyclaudeProviderProfiles(profiles, activeProfileId);
1051
+ syncMyclaudeActiveProfileToSettings(activeProfile);
1052
+ return {
1053
+ activeProfileId,
1054
+ activeProfile,
1055
+ profiles
1056
+ };
1057
+ }
1058
+ function syncMyclaudeProviderProfilesFromCurrentClaudeConfig() {
1059
+ const configData = ClaudeCodeConfigManager.readConfig();
1060
+ return syncMyclaudeProviderProfilesFromClaudeConfig(configData);
1061
+ }
1062
+ function clearMyclaudeProviderProfiles() {
1063
+ const config = readMcpConfig();
1064
+ if (config) {
1065
+ delete config.myclaudeProviderProfiles;
1066
+ delete config.myclaudeActiveProviderProfileId;
1067
+ writeMcpConfig(config);
1068
+ }
1069
+ syncMyclaudeActiveProfileToSettings(null);
1070
+ }
1071
+ function syncMcpPermissions() {
1072
+ const mcpConfig = readMcpConfig();
1073
+ const mcpServerIds = Object.keys(mcpConfig?.mcpServers || {});
1074
+ const settingsPath = join(CLAUDE_DIR, "settings.json");
1075
+ if (!existsSync(settingsPath))
1076
+ return;
1077
+ try {
1078
+ const settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
1079
+ if (!settings.permissions?.allow)
1080
+ return;
1081
+ const nonMcpPerms = settings.permissions.allow.filter(
1082
+ (p) => !p.startsWith("mcp__")
1083
+ );
1084
+ const mcpPerms = mcpServerIds.map((id) => `mcp__${id}`);
1085
+ settings.permissions.allow = [...nonMcpPerms, ...mcpPerms];
1086
+ writeJsonConfig(settingsPath, settings);
1087
+ } catch {
1088
+ }
1089
+ }
1090
+
1091
+ const claudeConfig = {
1092
+ __proto__: null,
1093
+ addCompletedOnboarding: addCompletedOnboarding,
1094
+ backupMcpConfig: backupMcpConfig,
1095
+ buildMcpServerConfig: buildMcpServerConfig,
1096
+ clearMyclaudeProviderProfiles: clearMyclaudeProviderProfiles,
1097
+ ensureApiKeyApproved: ensureApiKeyApproved,
1098
+ fixWindowsMcpConfig: fixWindowsMcpConfig,
1099
+ manageApiKeyApproval: manageApiKeyApproval,
1100
+ mergeMcpServers: mergeMcpServers,
1101
+ readMcpConfig: readMcpConfig,
1102
+ replaceMcpServers: replaceMcpServers,
1103
+ setMyclaudeActiveProviderProfile: setMyclaudeActiveProviderProfile,
1104
+ setMyclaudeProviderProfiles: setMyclaudeProviderProfiles,
1105
+ setPrimaryApiKey: setPrimaryApiKey,
1106
+ syncMcpPermissions: syncMcpPermissions,
1107
+ syncMyclaudeProviderProfilesFromClaudeConfig: syncMyclaudeProviderProfilesFromClaudeConfig,
1108
+ syncMyclaudeProviderProfilesFromCurrentClaudeConfig: syncMyclaudeProviderProfilesFromCurrentClaudeConfig,
1109
+ writeMcpConfig: writeMcpConfig
1110
+ };
12
1111
 
13
1112
  const MODEL_ENV_KEYS = [
14
1113
  "ANTHROPIC_MODEL",
@@ -438,4 +1537,4 @@ const config = {
438
1537
  updateDefaultModel: updateDefaultModel
439
1538
  };
440
1539
 
441
- export { getExistingCustomModelConfig as a, backupExistingConfig as b, updateDefaultModel as c, getExistingApiConfig as d, configureApi as e, copyConfigFiles as f, getExistingModelConfig as g, applyAiLanguageDirective as h, ensureClaudeDir as i, config as j, overwriteModelSettings as o, promptApiConfigurationAction as p, switchToOfficialLogin as s, updateCustomModel as u };
1540
+ export { syncMcpPermissions as A, config as B, ClaudeCodeConfigManager as C, claudeCodeConfigManager as D, claudeConfig as E, getExistingCustomModelConfig as a, backupExistingConfig as b, updateDefaultModel as c, backupMcpConfig as d, buildMcpServerConfig as e, fixWindowsMcpConfig as f, getExistingModelConfig as g, getExistingApiConfig as h, configureApi as i, syncMyclaudeProviderProfilesFromClaudeConfig as j, copyConfigFiles as k, setPrimaryApiKey as l, mergeMcpServers as m, addCompletedOnboarding as n, deepMerge as o, promptApiConfigurationAction as p, switchToOfficialLogin as q, readMcpConfig as r, setMyclaudeActiveProviderProfile as s, applyAiLanguageDirective as t, updateCustomModel as u, setMyclaudeProviderProfiles as v, writeMcpConfig as w, ensureClaudeDir as x, clearMyclaudeProviderProfiles as y, replaceMcpServers as z };