ccjk 13.6.7 → 14.0.1

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 (51) 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 +5 -8
  8. package/dist/chunks/check-updates.mjs +1 -4
  9. package/dist/chunks/claude-code-incremental-manager.mjs +4 -6
  10. package/dist/chunks/code-type-resolver.mjs +878 -0
  11. package/dist/chunks/codex-config-switch.mjs +0 -1
  12. package/dist/chunks/codex-provider-manager.mjs +0 -1
  13. package/dist/chunks/codex.mjs +2 -2
  14. package/dist/chunks/config-switch.mjs +2 -4
  15. package/dist/chunks/config.mjs +1144 -5
  16. package/dist/chunks/config2.mjs +6 -4
  17. package/dist/chunks/config3.mjs +4 -2
  18. package/dist/chunks/doctor.mjs +1 -1
  19. package/dist/chunks/evolution.mjs +47 -27
  20. package/dist/chunks/features.mjs +2 -3
  21. package/dist/chunks/index10.mjs +115 -12
  22. package/dist/chunks/init.mjs +44 -17
  23. package/dist/chunks/installer.mjs +2 -2
  24. package/dist/chunks/mcp-cli.mjs +18 -19
  25. package/dist/chunks/mcp.mjs +6 -7
  26. package/dist/chunks/package.mjs +1 -1
  27. package/dist/chunks/platform.mjs +1 -1
  28. package/dist/chunks/quick-setup.mjs +2 -5
  29. package/dist/chunks/slash-commands.mjs +1 -1
  30. package/dist/chunks/status.mjs +63 -16
  31. package/dist/chunks/uninstall.mjs +1 -3
  32. package/dist/chunks/update.mjs +4 -5
  33. package/dist/cli.mjs +58 -17
  34. package/dist/i18n/locales/en/configuration.json +6 -2
  35. package/dist/i18n/locales/en/menu.json +7 -0
  36. package/dist/i18n/locales/zh-CN/configuration.json +6 -2
  37. package/dist/i18n/locales/zh-CN/menu.json +7 -0
  38. package/dist/index.d.mts +64 -17
  39. package/dist/index.d.ts +64 -17
  40. package/dist/index.mjs +12 -720
  41. package/dist/shared/{ccjk.DHaUdzX3.mjs → ccjk.B6VCKdyy.mjs} +2 -2
  42. package/dist/shared/ccjk.BO45TPXJ.mjs +807 -0
  43. package/dist/shared/{ccjk.B4aXNclK.mjs → ccjk.CVjfbEIj.mjs} +1 -1
  44. package/dist/shared/{ccjk.Dz0ssUQx.mjs → ccjk.Dh6Be-ef.mjs} +1 -1
  45. package/package.json +1 -1
  46. package/dist/chunks/claude-code-config-manager.mjs +0 -811
  47. package/dist/chunks/claude-config.mjs +0 -286
  48. package/dist/chunks/intent-engine.mjs +0 -142
  49. package/dist/chunks/smart-defaults.mjs +0 -425
  50. package/dist/shared/ccjk.DJuyfrlL.mjs +0 -348
  51. package/dist/shared/ccjk.yYQMbHH3.mjs +0 -115
@@ -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 };
@@ -1,142 +0,0 @@
1
- import process__default from 'node:process';
2
-
3
- const INTENT_RULES = [
4
- {
5
- keywords: ["commit", "\u63D0\u4EA4", "\u63D0\u4EA4\u4EE3\u7801", "git commit", "\u4FDD\u5B58\u66F4\u6539"],
6
- skill: "commit",
7
- confidence: 0.9,
8
- description: "Smart commit with AI-generated messages"
9
- },
10
- {
11
- keywords: ["github", "gh", "pr", "pull request", "merge request", "\u5408\u5E76\u8BF7\u6C42"],
12
- skill: "github",
13
- confidence: 0.85,
14
- description: "GitHub operations"
15
- },
16
- {
17
- keywords: ["review", "\u5BA1\u67E5", "code review", "\u4EE3\u7801\u5BA1\u67E5", "\u68C0\u67E5\u4EE3\u7801"],
18
- skill: "review",
19
- confidence: 0.85,
20
- description: "Code review"
21
- },
22
- {
23
- keywords: ["test", "\u6D4B\u8BD5", "run test", "\u8FD0\u884C\u6D4B\u8BD5", "testing"],
24
- skill: "test",
25
- confidence: 0.8,
26
- description: "Run tests"
27
- },
28
- {
29
- keywords: ["doc", "\u6587\u6863", "documentation", "\u751F\u6210\u6587\u6863", "generate doc"],
30
- skill: "doc",
31
- confidence: 0.8,
32
- description: "Generate documentation"
33
- },
34
- {
35
- keywords: ["deploy", "\u90E8\u7F72", "deployment", "\u53D1\u5E03", "release"],
36
- skill: "deploy",
37
- confidence: 0.85,
38
- description: "Deploy application"
39
- },
40
- {
41
- keywords: ["fix", "\u4FEE\u590D", "bug", "debug", "\u8C03\u8BD5", "error", "\u9519\u8BEF"],
42
- skill: "fix",
43
- confidence: 0.75,
44
- description: "Fix bugs and errors"
45
- },
46
- {
47
- keywords: ["refactor", "\u91CD\u6784", "optimize", "\u4F18\u5316", "improve", "\u6539\u8FDB"],
48
- skill: "refactor",
49
- confidence: 0.75,
50
- description: "Refactor code"
51
- }
52
- ];
53
- function recognizeIntent(input) {
54
- const normalizedInput = input.toLowerCase().trim();
55
- let bestMatch = null;
56
- let highestScore = 0;
57
- for (const rule of INTENT_RULES) {
58
- const matchedKeywords = [];
59
- let score = 0;
60
- for (const keyword of rule.keywords) {
61
- if (normalizedInput.includes(keyword.toLowerCase())) {
62
- matchedKeywords.push(keyword);
63
- if (normalizedInput === keyword.toLowerCase()) {
64
- score += 1;
65
- } else {
66
- score += 0.5;
67
- }
68
- }
69
- }
70
- const confidence = score / rule.keywords.length;
71
- if (confidence >= rule.confidence && score > highestScore) {
72
- highestScore = score;
73
- bestMatch = {
74
- skill: rule.skill,
75
- confidence,
76
- description: rule.description,
77
- matchedKeywords
78
- };
79
- }
80
- }
81
- return bestMatch;
82
- }
83
- function shouldTriggerSkill(args) {
84
- if (args.length > 0 && args[0].startsWith("/")) {
85
- return null;
86
- }
87
- const knownCommands = [
88
- "init",
89
- "update",
90
- "doctor",
91
- "help",
92
- "mcp",
93
- "skill",
94
- "agent",
95
- "hook",
96
- "memory",
97
- "quick-setup",
98
- "config",
99
- "template",
100
- "brain",
101
- "session"
102
- ];
103
- if (args.length > 0 && knownCommands.includes(args[0])) {
104
- return null;
105
- }
106
- const input = args.join(" ");
107
- return recognizeIntent(input);
108
- }
109
- async function executeSkill(skillName, _originalArgs) {
110
- try {
111
- const { executeSlashCommand } = await import('./slash-commands.mjs');
112
- const skillCommand = `/${skillName}`;
113
- const handled = await executeSlashCommand(skillCommand);
114
- return handled;
115
- } catch (error) {
116
- console.error(`Failed to execute skill "${skillName}":`, error);
117
- return false;
118
- }
119
- }
120
- async function handleIntentRecognition() {
121
- const args = process__default.argv.slice(2);
122
- const intent = shouldTriggerSkill(args);
123
- if (!intent) {
124
- return false;
125
- }
126
- if (intent.confidence >= 0.9) {
127
- console.log(`\u{1F3AF} Detected intent: ${intent.description}`);
128
- console.log(` Executing skill: /${intent.skill}
129
- `);
130
- return await executeSkill(intent.skill);
131
- }
132
- if (intent.confidence >= 0.7) {
133
- console.log(`\u{1F914} Did you mean: /${intent.skill} (${intent.description})?`);
134
- console.log(` Matched keywords: ${intent.matchedKeywords.join(", ")}`);
135
- console.log(` Confidence: ${(intent.confidence * 100).toFixed(0)}%
136
- `);
137
- return await executeSkill(intent.skill);
138
- }
139
- return false;
140
- }
141
-
142
- export { executeSkill, handleIntentRecognition, recognizeIntent, shouldTriggerSkill };