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
@@ -1,286 +0,0 @@
1
- import { existsSync, readFileSync } from 'node:fs';
2
- import { CLAUDE_VSC_CONFIG_FILE, CLAUDE_DIR, ClAUDE_CONFIG_FILE } from './constants.mjs';
3
- import { ensureI18nInitialized, i18n } from './index2.mjs';
4
- import { readJsonConfig, writeJsonConfig, backupJsonConfig } from './json-config.mjs';
5
- import { i as isWindows, l as getMcpCommand } from './platform.mjs';
6
- import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
7
-
8
- function mergeArraysUnique(arr1, arr2) {
9
- const combined = [...arr1 || [], ...arr2 || []];
10
- return [...new Set(combined)];
11
- }
12
- function isPlainObject(value) {
13
- return value !== null && typeof value === "object" && value.constructor === Object && Object.prototype.toString.call(value) === "[object Object]";
14
- }
15
- function deepMerge(target, source, options = {}) {
16
- const { mergeArrays = false, arrayMergeStrategy = "replace" } = options;
17
- const result = { ...target };
18
- for (const key in source) {
19
- const sourceValue = source[key];
20
- const targetValue = result[key];
21
- if (sourceValue === void 0) {
22
- continue;
23
- }
24
- if (isPlainObject(sourceValue) && isPlainObject(targetValue)) {
25
- result[key] = deepMerge(targetValue, sourceValue, options);
26
- } else if (Array.isArray(sourceValue)) {
27
- if (!mergeArrays || !Array.isArray(targetValue)) {
28
- result[key] = sourceValue;
29
- } else {
30
- switch (arrayMergeStrategy) {
31
- case "concat":
32
- result[key] = [...targetValue, ...sourceValue];
33
- break;
34
- case "unique":
35
- result[key] = mergeArraysUnique(targetValue, sourceValue);
36
- break;
37
- case "replace":
38
- default:
39
- result[key] = sourceValue;
40
- break;
41
- }
42
- }
43
- } else {
44
- result[key] = sourceValue;
45
- }
46
- }
47
- return result;
48
- }
49
- function deepClone(obj) {
50
- if (obj === null || typeof obj !== "object") {
51
- return obj;
52
- }
53
- if (obj instanceof Date) {
54
- return new Date(obj.getTime());
55
- }
56
- if (Array.isArray(obj)) {
57
- return obj.map((item) => deepClone(item));
58
- }
59
- if (isPlainObject(obj)) {
60
- const cloned = {};
61
- for (const key in obj) {
62
- cloned[key] = deepClone(obj[key]);
63
- }
64
- return cloned;
65
- }
66
- return obj;
67
- }
68
-
69
- function readMcpConfig() {
70
- return readJsonConfig(ClAUDE_CONFIG_FILE);
71
- }
72
- function writeMcpConfig(config) {
73
- writeJsonConfig(ClAUDE_CONFIG_FILE, config);
74
- }
75
- function backupMcpConfig() {
76
- const backupBaseDir = join(CLAUDE_DIR, "backup");
77
- return backupJsonConfig(ClAUDE_CONFIG_FILE, backupBaseDir);
78
- }
79
- function mergeMcpServers(existing, newServers) {
80
- const config = existing || { mcpServers: {} };
81
- if (!config.mcpServers) {
82
- config.mcpServers = {};
83
- }
84
- Object.assign(config.mcpServers, newServers);
85
- return config;
86
- }
87
- function replaceMcpServers(existing, newServers) {
88
- const config = existing ? { ...existing } : { mcpServers: {} };
89
- config.mcpServers = { ...newServers };
90
- return config;
91
- }
92
- function applyPlatformCommand(config) {
93
- if (isWindows() && config.command) {
94
- const mcpCmd = getMcpCommand(config.command);
95
- if (mcpCmd[0] === "cmd") {
96
- config.command = mcpCmd[0];
97
- config.args = [...mcpCmd.slice(1), ...config.args || []];
98
- }
99
- }
100
- }
101
- function buildMcpServerConfig(baseConfig, apiKey, placeholder = "YOUR_EXA_API_KEY", envVarName) {
102
- const config = deepClone(baseConfig);
103
- applyPlatformCommand(config);
104
- if (!apiKey) {
105
- return config;
106
- }
107
- if (envVarName && config.env) {
108
- config.env[envVarName] = apiKey;
109
- return config;
110
- }
111
- if (config.args) {
112
- config.args = config.args.map((arg) => arg.replace(placeholder, apiKey));
113
- }
114
- if (config.url) {
115
- config.url = config.url.replace(placeholder, apiKey);
116
- }
117
- return config;
118
- }
119
- function fixWindowsMcpConfig(config) {
120
- if (!isWindows() || !config.mcpServers) {
121
- return config;
122
- }
123
- const fixed = { ...config };
124
- for (const [, serverConfig] of Object.entries(fixed.mcpServers)) {
125
- if (serverConfig && typeof serverConfig === "object" && "command" in serverConfig) {
126
- applyPlatformCommand(serverConfig);
127
- }
128
- }
129
- return fixed;
130
- }
131
- function addCompletedOnboarding() {
132
- try {
133
- let config = readMcpConfig();
134
- if (!config) {
135
- config = { mcpServers: {} };
136
- }
137
- if (config.hasCompletedOnboarding === true) {
138
- return;
139
- }
140
- config.hasCompletedOnboarding = true;
141
- writeMcpConfig(config);
142
- } catch (error) {
143
- console.error("Failed to add onboarding flag", error);
144
- throw error;
145
- }
146
- }
147
- function ensureApiKeyApproved(config, apiKey) {
148
- if (!apiKey || typeof apiKey !== "string" || apiKey.trim() === "") {
149
- return config;
150
- }
151
- const truncatedApiKey = apiKey.substring(0, 20);
152
- const updatedConfig = { ...config };
153
- if (!updatedConfig.customApiKeyResponses) {
154
- updatedConfig.customApiKeyResponses = {
155
- approved: [],
156
- rejected: []
157
- };
158
- }
159
- if (!Array.isArray(updatedConfig.customApiKeyResponses.approved)) {
160
- updatedConfig.customApiKeyResponses.approved = [];
161
- }
162
- if (!Array.isArray(updatedConfig.customApiKeyResponses.rejected)) {
163
- updatedConfig.customApiKeyResponses.rejected = [];
164
- }
165
- const rejectedIndex = updatedConfig.customApiKeyResponses.rejected.indexOf(truncatedApiKey);
166
- if (rejectedIndex > -1) {
167
- updatedConfig.customApiKeyResponses.rejected.splice(rejectedIndex, 1);
168
- }
169
- if (!updatedConfig.customApiKeyResponses.approved.includes(truncatedApiKey)) {
170
- updatedConfig.customApiKeyResponses.approved.push(truncatedApiKey);
171
- }
172
- return updatedConfig;
173
- }
174
- function manageApiKeyApproval(apiKey) {
175
- try {
176
- let config = readMcpConfig();
177
- if (!config) {
178
- config = { mcpServers: {} };
179
- }
180
- const updatedConfig = ensureApiKeyApproved(config, apiKey);
181
- writeMcpConfig(updatedConfig);
182
- } catch (error) {
183
- ensureI18nInitialized();
184
- console.error(i18n.t("mcp:apiKeyApprovalFailed"), error);
185
- }
186
- }
187
- function setPrimaryApiKey() {
188
- try {
189
- let config = readJsonConfig(CLAUDE_VSC_CONFIG_FILE);
190
- if (!config) {
191
- config = {};
192
- }
193
- config.primaryApiKey = "ccjk";
194
- writeJsonConfig(CLAUDE_VSC_CONFIG_FILE, config);
195
- } catch (error) {
196
- ensureI18nInitialized();
197
- console.error(i18n.t("mcp:primaryApiKeySetFailed"), error);
198
- }
199
- }
200
- function setMyclaudeProviderProfiles(profiles, activeProfileId) {
201
- const config = readMcpConfig() || { mcpServers: {} };
202
- config.myclaudeProviderProfiles = profiles;
203
- config.myclaudeActiveProviderProfileId = activeProfileId ?? profiles[0]?.id;
204
- writeMcpConfig(config);
205
- }
206
- function setMyclaudeActiveProviderProfile(activeProfileId) {
207
- const config = readMcpConfig() || { mcpServers: {} };
208
- config.myclaudeActiveProviderProfileId = activeProfileId ?? "";
209
- writeMcpConfig(config);
210
- }
211
- function toMyclaudeProviderProfile(profile, existing) {
212
- return {
213
- id: profile.id || existing?.id || profile.name,
214
- name: profile.name,
215
- provider: profile.provider || existing?.provider || "custom",
216
- apiKey: profile.apiKey,
217
- baseUrl: profile.baseUrl,
218
- model: profile.primaryModel,
219
- fastModel: profile.defaultHaikuModel,
220
- authType: profile.authType,
221
- primaryModel: profile.primaryModel,
222
- defaultHaikuModel: profile.defaultHaikuModel,
223
- defaultSonnetModel: profile.defaultSonnetModel,
224
- defaultOpusModel: profile.defaultOpusModel
225
- };
226
- }
227
- function syncMyclaudeProviderProfilesFromClaudeConfig(configData) {
228
- if (!configData) {
229
- clearMyclaudeProviderProfiles();
230
- return;
231
- }
232
- const existingProfiles = readMcpConfig()?.myclaudeProviderProfiles || [];
233
- const existingById = new Map(existingProfiles.map((profile) => [String(profile.id), profile]));
234
- const profiles = Object.entries(configData.profiles).map(([id, profile]) => toMyclaudeProviderProfile({ ...profile, id }, existingById.get(id)));
235
- setMyclaudeProviderProfiles(profiles, configData.currentProfileId ?? "");
236
- }
237
- function clearMyclaudeProviderProfiles() {
238
- const config = readMcpConfig();
239
- if (!config) {
240
- return;
241
- }
242
- delete config.myclaudeProviderProfiles;
243
- delete config.myclaudeActiveProviderProfileId;
244
- writeMcpConfig(config);
245
- }
246
- function syncMcpPermissions() {
247
- const mcpConfig = readMcpConfig();
248
- const mcpServerIds = Object.keys(mcpConfig?.mcpServers || {});
249
- const settingsPath = join(CLAUDE_DIR, "settings.json");
250
- if (!existsSync(settingsPath))
251
- return;
252
- try {
253
- const settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
254
- if (!settings.permissions?.allow)
255
- return;
256
- const nonMcpPerms = settings.permissions.allow.filter(
257
- (p) => !p.startsWith("mcp__")
258
- );
259
- const mcpPerms = mcpServerIds.map((id) => `mcp__${id}`);
260
- settings.permissions.allow = [...nonMcpPerms, ...mcpPerms];
261
- writeJsonConfig(settingsPath, settings);
262
- } catch {
263
- }
264
- }
265
-
266
- const claudeConfig = {
267
- __proto__: null,
268
- addCompletedOnboarding: addCompletedOnboarding,
269
- backupMcpConfig: backupMcpConfig,
270
- buildMcpServerConfig: buildMcpServerConfig,
271
- clearMyclaudeProviderProfiles: clearMyclaudeProviderProfiles,
272
- ensureApiKeyApproved: ensureApiKeyApproved,
273
- fixWindowsMcpConfig: fixWindowsMcpConfig,
274
- manageApiKeyApproval: manageApiKeyApproval,
275
- mergeMcpServers: mergeMcpServers,
276
- readMcpConfig: readMcpConfig,
277
- replaceMcpServers: replaceMcpServers,
278
- setMyclaudeActiveProviderProfile: setMyclaudeActiveProviderProfile,
279
- setMyclaudeProviderProfiles: setMyclaudeProviderProfiles,
280
- setPrimaryApiKey: setPrimaryApiKey,
281
- syncMcpPermissions: syncMcpPermissions,
282
- syncMyclaudeProviderProfilesFromClaudeConfig: syncMyclaudeProviderProfilesFromClaudeConfig,
283
- writeMcpConfig: writeMcpConfig
284
- };
285
-
286
- export { buildMcpServerConfig as a, backupMcpConfig as b, syncMyclaudeProviderProfilesFromClaudeConfig as c, setPrimaryApiKey as d, addCompletedOnboarding as e, fixWindowsMcpConfig as f, deepMerge as g, setMyclaudeProviderProfiles as h, clearMyclaudeProviderProfiles as i, replaceMcpServers as j, syncMcpPermissions as k, claudeConfig as l, mergeMcpServers as m, readMcpConfig as r, setMyclaudeActiveProviderProfile as s, writeMcpConfig as w };