ccjk 2.2.4 → 2.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/auto-updater.mjs +15 -1
- package/dist/chunks/ccjk-config.mjs +77 -13
- package/dist/chunks/ccr.mjs +7 -10
- package/dist/chunks/ccu.mjs +4 -4
- package/dist/chunks/check-updates.mjs +4 -7
- package/dist/chunks/claude-code-config-manager.mjs +8 -11
- package/dist/chunks/claude-code-incremental-manager.mjs +4 -7
- package/dist/chunks/codex.mjs +496 -17
- package/dist/chunks/commands.mjs +392 -89
- package/dist/chunks/commands2.mjs +109 -0
- package/dist/chunks/config-consolidator.mjs +2 -2
- package/dist/chunks/config-switch.mjs +5 -8
- package/dist/chunks/doctor.mjs +6 -6
- package/dist/chunks/features.mjs +654 -35
- package/dist/chunks/help.mjs +339 -0
- package/dist/chunks/index.mjs +323 -10
- package/dist/chunks/index2.mjs +3 -3
- package/dist/chunks/index3.mjs +1171 -0
- package/dist/chunks/init.mjs +21 -24
- package/dist/chunks/installer.mjs +178 -0
- package/dist/chunks/interview.mjs +6 -6
- package/dist/chunks/mcp-performance.mjs +82 -2
- package/dist/chunks/mcp.mjs +500 -0
- package/dist/chunks/menu.mjs +10 -10
- package/dist/chunks/notification.mjs +5 -5
- package/dist/chunks/onboarding.mjs +6 -6
- package/dist/chunks/package.mjs +1 -1
- package/dist/chunks/platform.mjs +10 -10
- package/dist/chunks/prompts.mjs +7 -8
- package/dist/chunks/session.mjs +2 -2
- package/dist/chunks/skills-sync.mjs +2 -2
- package/dist/chunks/uninstall.mjs +4 -5
- package/dist/chunks/update.mjs +4 -7
- package/dist/chunks/upgrade-manager.mjs +2 -2
- package/dist/chunks/version-checker.mjs +88 -7
- package/dist/cli.mjs +293 -53
- package/dist/i18n/locales/en/agentBrowser.json +79 -0
- package/dist/i18n/locales/en/mcp.json +2 -4
- package/dist/i18n/locales/en/updater.json +3 -1
- package/dist/i18n/locales/zh/agentBrowser.json +79 -0
- package/dist/i18n/locales/zh-CN/common.json +1 -1
- package/dist/i18n/locales/zh-CN/mcp.json +2 -4
- package/dist/i18n/locales/zh-CN/updater.json +3 -1
- package/dist/index.d.mts +8 -584
- package/dist/index.d.ts +8 -584
- package/dist/index.mjs +9 -13
- package/dist/shared/{ccjk.DJM5aVQJ.mjs → ccjk.ByTIGCUC.mjs} +3 -3
- package/dist/shared/{ccjk.qYAnUMuy.mjs → ccjk.CGTmRqsu.mjs} +2 -3
- package/dist/shared/{ccjk.CUdzQluX.mjs → ccjk.CURU8gbR.mjs} +1 -1
- package/dist/{chunks/mcp-market.mjs → shared/ccjk.D-RZS4E2.mjs} +6 -65
- package/dist/shared/{ccjk.B7169qud.mjs → ccjk.tB4-Y4Qb.mjs} +3 -3
- package/package.json +4 -1
- package/templates/common/skills/en/agent-browser.md +258 -0
- package/templates/common/skills/zh-CN/agent-browser.md +260 -0
- package/dist/chunks/claude-config.mjs +0 -228
- package/dist/chunks/features2.mjs +0 -661
- package/dist/chunks/json-config.mjs +0 -59
- package/dist/chunks/mcp-doctor.mjs +0 -160
- package/dist/chunks/mcp-profile.mjs +0 -220
- package/dist/chunks/mcp-release.mjs +0 -138
- package/dist/chunks/shencha.mjs +0 -320
- package/dist/chunks/tools.mjs +0 -169
- package/dist/shared/ccjk.COdsoe-Y.mjs +0 -64
- package/dist/shared/ccjk.DwDtZ5cK.mjs +0 -266
- package/dist/shared/ccjk.n_AtlHzB.mjs +0 -186
package/dist/chunks/codex.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import process__default from 'node:process';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
3
|
import ansis from 'ansis';
|
|
4
4
|
import dayjs from 'dayjs';
|
|
@@ -8,16 +8,495 @@ import { join, dirname } from 'pathe';
|
|
|
8
8
|
import semver from 'semver';
|
|
9
9
|
import { parse } from 'smol-toml';
|
|
10
10
|
import { x } from 'tinyexec';
|
|
11
|
-
import {
|
|
11
|
+
import { CLAUDE_VSC_CONFIG_FILE, CLAUDE_DIR, ClAUDE_CONFIG_FILE, SETTINGS_FILE, AI_OUTPUT_LANGUAGES, SUPPORTED_LANGS, CODEX_DIR, CODEX_AGENTS_FILE, CODEX_CONFIG_FILE, CODEX_PROMPTS_DIR, CODEX_AUTH_FILE, ZCF_CONFIG_FILE } from './constants.mjs';
|
|
12
12
|
import { ensureI18nInitialized, i18n, format } from './index2.mjs';
|
|
13
|
-
import { updateZcfConfig, readZcfConfig, readDefaultTomlConfig, updateTomlConfig } from './ccjk-config.mjs';
|
|
14
|
-
import { i as deepMerge, s as setPrimaryApiKey, c as addCompletedOnboarding } from './claude-config.mjs';
|
|
15
|
-
import { ensureDir, exists, copyDir, writeFileAtomic, copyFile, readFile, writeFile } from './fs-operations.mjs';
|
|
16
|
-
import { readJsonConfig, writeJsonConfig } from './json-config.mjs';
|
|
13
|
+
import { r as readJsonConfig, w as writeJsonConfig, b as backupJsonConfig, u as updateZcfConfig, a as readZcfConfig, c as readDefaultTomlConfig, d as updateTomlConfig } from './ccjk-config.mjs';
|
|
17
14
|
import { isWindows, getMcpCommand, getSystemRoot, wrapCommandWithSudo, normalizeTomlPath } from './platform.mjs';
|
|
15
|
+
import { ensureDir, exists, copyDir, writeFileAtomic, copyFile, readFile, writeFile } from './fs-operations.mjs';
|
|
18
16
|
import { p as promptBoolean, a as addNumbersToChoices } from '../shared/ccjk.DhBeLRzf.mjs';
|
|
19
17
|
import { resolveAiOutputLanguage } from './prompts.mjs';
|
|
20
|
-
import
|
|
18
|
+
import 'node:child_process';
|
|
19
|
+
import { homedir } from 'node:os';
|
|
20
|
+
|
|
21
|
+
const PLAYWRIGHT_PROFILES_DIR = join(homedir(), ".ccjk", "playwright");
|
|
22
|
+
function createPlaywrightMcpConfig(options = {}) {
|
|
23
|
+
const {
|
|
24
|
+
profile = "default",
|
|
25
|
+
headless = false,
|
|
26
|
+
browser = "chromium",
|
|
27
|
+
userDataDir
|
|
28
|
+
} = options;
|
|
29
|
+
const resolvedUserDataDir = userDataDir || join(PLAYWRIGHT_PROFILES_DIR, profile);
|
|
30
|
+
const args = ["-y", "@playwright/mcp@latest"];
|
|
31
|
+
args.push("--browser", browser);
|
|
32
|
+
args.push("--user-data-dir", resolvedUserDataDir);
|
|
33
|
+
if (headless) {
|
|
34
|
+
args.push("--headless");
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
type: "stdio",
|
|
38
|
+
command: "npx",
|
|
39
|
+
args,
|
|
40
|
+
env: {}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const MCP_SERVICE_CONFIGS = [
|
|
44
|
+
// Documentation and Search Services - Universal (no GUI required)
|
|
45
|
+
{
|
|
46
|
+
id: "context7",
|
|
47
|
+
requiresApiKey: false,
|
|
48
|
+
config: {
|
|
49
|
+
type: "stdio",
|
|
50
|
+
command: "npx",
|
|
51
|
+
args: ["-y", "@upstash/context7-mcp@latest"],
|
|
52
|
+
env: {}
|
|
53
|
+
}
|
|
54
|
+
// Works on all platforms - no special requirements
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "open-websearch",
|
|
58
|
+
requiresApiKey: false,
|
|
59
|
+
config: {
|
|
60
|
+
type: "stdio",
|
|
61
|
+
command: "npx",
|
|
62
|
+
args: ["-y", "open-websearch@latest"],
|
|
63
|
+
env: {
|
|
64
|
+
MODE: "stdio",
|
|
65
|
+
DEFAULT_SEARCH_ENGINE: "duckduckgo",
|
|
66
|
+
ALLOWED_SEARCH_ENGINES: "duckduckgo,bing,brave"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// Works on all platforms - no special requirements
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: "mcp-deepwiki",
|
|
73
|
+
requiresApiKey: false,
|
|
74
|
+
config: {
|
|
75
|
+
type: "stdio",
|
|
76
|
+
command: "npx",
|
|
77
|
+
args: ["-y", "mcp-deepwiki@latest"],
|
|
78
|
+
env: {}
|
|
79
|
+
}
|
|
80
|
+
// Works on all platforms - no special requirements
|
|
81
|
+
},
|
|
82
|
+
// Development Workflow Services
|
|
83
|
+
{
|
|
84
|
+
id: "spec-workflow",
|
|
85
|
+
requiresApiKey: false,
|
|
86
|
+
config: {
|
|
87
|
+
type: "stdio",
|
|
88
|
+
command: "npx",
|
|
89
|
+
args: ["-y", "@pimzino/spec-workflow-mcp@latest"],
|
|
90
|
+
env: {}
|
|
91
|
+
}
|
|
92
|
+
// Works on all platforms - no special requirements
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: "serena",
|
|
96
|
+
requiresApiKey: false,
|
|
97
|
+
config: {
|
|
98
|
+
type: "stdio",
|
|
99
|
+
command: "uvx",
|
|
100
|
+
args: ["--from", "git+https://github.com/oraios/serena", "serena", "start-mcp-server", "--context", "ide-assistant", "--enable-web-dashboard", "false"],
|
|
101
|
+
env: {}
|
|
102
|
+
},
|
|
103
|
+
platformRequirements: {
|
|
104
|
+
requiredCommands: ["uvx"]
|
|
105
|
+
// Requires uv/uvx to be installed
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
// Browser and Automation Services - Require GUI environment
|
|
109
|
+
{
|
|
110
|
+
id: "Playwright",
|
|
111
|
+
requiresApiKey: false,
|
|
112
|
+
config: createPlaywrightMcpConfig(),
|
|
113
|
+
// Uses default profile with chromium browser
|
|
114
|
+
platformRequirements: {
|
|
115
|
+
platforms: ["macos", "windows"],
|
|
116
|
+
// GUI required - exclude headless Linux/WSL/Termux
|
|
117
|
+
requiresGui: true
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: "puppeteer",
|
|
122
|
+
requiresApiKey: false,
|
|
123
|
+
config: {
|
|
124
|
+
type: "stdio",
|
|
125
|
+
command: "npx",
|
|
126
|
+
args: ["-y", "@anthropic-ai/mcp-server-puppeteer@latest"],
|
|
127
|
+
env: {}
|
|
128
|
+
},
|
|
129
|
+
platformRequirements: {
|
|
130
|
+
platforms: ["macos", "windows"],
|
|
131
|
+
// GUI required - exclude headless Linux/WSL/Termux
|
|
132
|
+
requiresGui: true
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
// Anthropic Official MCP Services - Universal
|
|
136
|
+
{
|
|
137
|
+
id: "filesystem",
|
|
138
|
+
requiresApiKey: false,
|
|
139
|
+
config: {
|
|
140
|
+
type: "stdio",
|
|
141
|
+
command: "npx",
|
|
142
|
+
args: ["-y", "@anthropic-ai/mcp-server-filesystem@latest", "."],
|
|
143
|
+
env: {}
|
|
144
|
+
}
|
|
145
|
+
// Works on all platforms - no special requirements
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: "memory",
|
|
149
|
+
requiresApiKey: false,
|
|
150
|
+
config: {
|
|
151
|
+
type: "stdio",
|
|
152
|
+
command: "npx",
|
|
153
|
+
args: ["-y", "@anthropic-ai/mcp-server-memory@latest"],
|
|
154
|
+
env: {}
|
|
155
|
+
}
|
|
156
|
+
// Works on all platforms - no special requirements
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: "sequential-thinking",
|
|
160
|
+
requiresApiKey: false,
|
|
161
|
+
config: {
|
|
162
|
+
type: "stdio",
|
|
163
|
+
command: "npx",
|
|
164
|
+
args: ["-y", "@anthropic-ai/mcp-server-sequential-thinking@latest"],
|
|
165
|
+
env: {}
|
|
166
|
+
}
|
|
167
|
+
// Works on all platforms - no special requirements
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
id: "fetch",
|
|
171
|
+
requiresApiKey: false,
|
|
172
|
+
config: {
|
|
173
|
+
type: "stdio",
|
|
174
|
+
command: "npx",
|
|
175
|
+
args: ["-y", "@anthropic-ai/mcp-server-fetch@latest"],
|
|
176
|
+
env: {}
|
|
177
|
+
}
|
|
178
|
+
// Works on all platforms - no special requirements
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
id: "sqlite",
|
|
182
|
+
requiresApiKey: false,
|
|
183
|
+
config: {
|
|
184
|
+
type: "stdio",
|
|
185
|
+
command: "npx",
|
|
186
|
+
args: ["-y", "@anthropic-ai/mcp-server-sqlite@latest"],
|
|
187
|
+
env: {}
|
|
188
|
+
}
|
|
189
|
+
// Works on all platforms - no special requirements
|
|
190
|
+
}
|
|
191
|
+
];
|
|
192
|
+
async function getMcpServices() {
|
|
193
|
+
ensureI18nInitialized();
|
|
194
|
+
const mcpServiceList = [
|
|
195
|
+
// Documentation and Search Services
|
|
196
|
+
{
|
|
197
|
+
id: "context7",
|
|
198
|
+
name: i18n.t("mcp:services.context7.name"),
|
|
199
|
+
description: i18n.t("mcp:services.context7.description")
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
id: "open-websearch",
|
|
203
|
+
name: i18n.t("mcp:services.open-websearch.name"),
|
|
204
|
+
description: i18n.t("mcp:services.open-websearch.description")
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
id: "mcp-deepwiki",
|
|
208
|
+
name: i18n.t("mcp:services.mcp-deepwiki.name"),
|
|
209
|
+
description: i18n.t("mcp:services.mcp-deepwiki.description")
|
|
210
|
+
},
|
|
211
|
+
// Development Workflow Services
|
|
212
|
+
{
|
|
213
|
+
id: "spec-workflow",
|
|
214
|
+
name: i18n.t("mcp:services.spec-workflow.name"),
|
|
215
|
+
description: i18n.t("mcp:services.spec-workflow.description")
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
id: "serena",
|
|
219
|
+
name: i18n.t("mcp:services.serena.name"),
|
|
220
|
+
description: i18n.t("mcp:services.serena.description")
|
|
221
|
+
},
|
|
222
|
+
// Browser and Automation Services
|
|
223
|
+
{
|
|
224
|
+
id: "Playwright",
|
|
225
|
+
name: i18n.t("mcp:services.playwright.name"),
|
|
226
|
+
description: i18n.t("mcp:services.playwright.description")
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
id: "puppeteer",
|
|
230
|
+
name: i18n.t("mcp:services.puppeteer.name"),
|
|
231
|
+
description: i18n.t("mcp:services.puppeteer.description")
|
|
232
|
+
},
|
|
233
|
+
// Anthropic Official MCP Services
|
|
234
|
+
{
|
|
235
|
+
id: "filesystem",
|
|
236
|
+
name: i18n.t("mcp:services.filesystem.name"),
|
|
237
|
+
description: i18n.t("mcp:services.filesystem.description")
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
id: "memory",
|
|
241
|
+
name: i18n.t("mcp:services.memory.name"),
|
|
242
|
+
description: i18n.t("mcp:services.memory.description")
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
id: "sequential-thinking",
|
|
246
|
+
name: i18n.t("mcp:services.sequential-thinking.name"),
|
|
247
|
+
description: i18n.t("mcp:services.sequential-thinking.description")
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
id: "fetch",
|
|
251
|
+
name: i18n.t("mcp:services.fetch.name"),
|
|
252
|
+
description: i18n.t("mcp:services.fetch.description")
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
id: "sqlite",
|
|
256
|
+
name: i18n.t("mcp:services.sqlite.name"),
|
|
257
|
+
description: i18n.t("mcp:services.sqlite.description")
|
|
258
|
+
}
|
|
259
|
+
];
|
|
260
|
+
return MCP_SERVICE_CONFIGS.map((config) => {
|
|
261
|
+
const serviceInfo = mcpServiceList.find((s) => s.id === config.id);
|
|
262
|
+
const service = {
|
|
263
|
+
id: config.id,
|
|
264
|
+
name: serviceInfo?.name || config.id,
|
|
265
|
+
description: serviceInfo?.description || "",
|
|
266
|
+
requiresApiKey: config.requiresApiKey,
|
|
267
|
+
config: config.config
|
|
268
|
+
};
|
|
269
|
+
if (config.apiKeyEnvVar) {
|
|
270
|
+
service.apiKeyEnvVar = config.apiKeyEnvVar;
|
|
271
|
+
}
|
|
272
|
+
return service;
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
async function getMcpService(id) {
|
|
276
|
+
const services = await getMcpServices();
|
|
277
|
+
return services.find((service) => service.id === id);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function mergeArraysUnique(arr1, arr2) {
|
|
281
|
+
const combined = [...arr1 || [], ...arr2 || []];
|
|
282
|
+
return [...new Set(combined)];
|
|
283
|
+
}
|
|
284
|
+
function isPlainObject(value) {
|
|
285
|
+
return value !== null && typeof value === "object" && value.constructor === Object && Object.prototype.toString.call(value) === "[object Object]";
|
|
286
|
+
}
|
|
287
|
+
function deepMerge(target, source, options = {}) {
|
|
288
|
+
const { mergeArrays = false, arrayMergeStrategy = "replace" } = options;
|
|
289
|
+
const result = { ...target };
|
|
290
|
+
for (const key in source) {
|
|
291
|
+
const sourceValue = source[key];
|
|
292
|
+
const targetValue = result[key];
|
|
293
|
+
if (sourceValue === void 0) {
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
if (isPlainObject(sourceValue) && isPlainObject(targetValue)) {
|
|
297
|
+
result[key] = deepMerge(targetValue, sourceValue, options);
|
|
298
|
+
} else if (Array.isArray(sourceValue)) {
|
|
299
|
+
if (!mergeArrays || !Array.isArray(targetValue)) {
|
|
300
|
+
result[key] = sourceValue;
|
|
301
|
+
} else {
|
|
302
|
+
switch (arrayMergeStrategy) {
|
|
303
|
+
case "concat":
|
|
304
|
+
result[key] = [...targetValue, ...sourceValue];
|
|
305
|
+
break;
|
|
306
|
+
case "unique":
|
|
307
|
+
result[key] = mergeArraysUnique(targetValue, sourceValue);
|
|
308
|
+
break;
|
|
309
|
+
case "replace":
|
|
310
|
+
default:
|
|
311
|
+
result[key] = sourceValue;
|
|
312
|
+
break;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
} else {
|
|
316
|
+
result[key] = sourceValue;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return result;
|
|
320
|
+
}
|
|
321
|
+
function deepClone(obj) {
|
|
322
|
+
if (obj === null || typeof obj !== "object") {
|
|
323
|
+
return obj;
|
|
324
|
+
}
|
|
325
|
+
if (obj instanceof Date) {
|
|
326
|
+
return new Date(obj.getTime());
|
|
327
|
+
}
|
|
328
|
+
if (Array.isArray(obj)) {
|
|
329
|
+
return obj.map((item) => deepClone(item));
|
|
330
|
+
}
|
|
331
|
+
if (isPlainObject(obj)) {
|
|
332
|
+
const cloned = {};
|
|
333
|
+
for (const key in obj) {
|
|
334
|
+
cloned[key] = deepClone(obj[key]);
|
|
335
|
+
}
|
|
336
|
+
return cloned;
|
|
337
|
+
}
|
|
338
|
+
return obj;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function getMcpConfigPath() {
|
|
342
|
+
return ClAUDE_CONFIG_FILE;
|
|
343
|
+
}
|
|
344
|
+
function readMcpConfig() {
|
|
345
|
+
return readJsonConfig(ClAUDE_CONFIG_FILE);
|
|
346
|
+
}
|
|
347
|
+
function writeMcpConfig(config) {
|
|
348
|
+
writeJsonConfig(ClAUDE_CONFIG_FILE, config);
|
|
349
|
+
}
|
|
350
|
+
function backupMcpConfig() {
|
|
351
|
+
const backupBaseDir = join(CLAUDE_DIR, "backup");
|
|
352
|
+
return backupJsonConfig(ClAUDE_CONFIG_FILE, backupBaseDir);
|
|
353
|
+
}
|
|
354
|
+
function mergeMcpServers(existing, newServers) {
|
|
355
|
+
const config = existing || { mcpServers: {} };
|
|
356
|
+
if (!config.mcpServers) {
|
|
357
|
+
config.mcpServers = {};
|
|
358
|
+
}
|
|
359
|
+
Object.assign(config.mcpServers, newServers);
|
|
360
|
+
return config;
|
|
361
|
+
}
|
|
362
|
+
function applyPlatformCommand(config) {
|
|
363
|
+
if (isWindows() && config.command) {
|
|
364
|
+
const mcpCmd = getMcpCommand(config.command);
|
|
365
|
+
if (mcpCmd[0] === "cmd") {
|
|
366
|
+
config.command = mcpCmd[0];
|
|
367
|
+
config.args = [...mcpCmd.slice(1), ...config.args || []];
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
function buildMcpServerConfig(baseConfig, apiKey, placeholder = "YOUR_EXA_API_KEY", envVarName) {
|
|
372
|
+
const config = deepClone(baseConfig);
|
|
373
|
+
applyPlatformCommand(config);
|
|
374
|
+
if (!apiKey) {
|
|
375
|
+
return config;
|
|
376
|
+
}
|
|
377
|
+
if (envVarName && config.env) {
|
|
378
|
+
config.env[envVarName] = apiKey;
|
|
379
|
+
return config;
|
|
380
|
+
}
|
|
381
|
+
if (config.args) {
|
|
382
|
+
config.args = config.args.map((arg) => arg.replace(placeholder, apiKey));
|
|
383
|
+
}
|
|
384
|
+
if (config.url) {
|
|
385
|
+
config.url = config.url.replace(placeholder, apiKey);
|
|
386
|
+
}
|
|
387
|
+
return config;
|
|
388
|
+
}
|
|
389
|
+
function fixWindowsMcpConfig(config) {
|
|
390
|
+
if (!isWindows() || !config.mcpServers) {
|
|
391
|
+
return config;
|
|
392
|
+
}
|
|
393
|
+
const fixed = { ...config };
|
|
394
|
+
for (const [, serverConfig] of Object.entries(fixed.mcpServers)) {
|
|
395
|
+
if (serverConfig && typeof serverConfig === "object" && "command" in serverConfig) {
|
|
396
|
+
applyPlatformCommand(serverConfig);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
return fixed;
|
|
400
|
+
}
|
|
401
|
+
function addCompletedOnboarding() {
|
|
402
|
+
try {
|
|
403
|
+
let config = readMcpConfig();
|
|
404
|
+
if (!config) {
|
|
405
|
+
config = { mcpServers: {} };
|
|
406
|
+
}
|
|
407
|
+
if (config.hasCompletedOnboarding === true) {
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
config.hasCompletedOnboarding = true;
|
|
411
|
+
writeMcpConfig(config);
|
|
412
|
+
} catch (error) {
|
|
413
|
+
console.error("Failed to add onboarding flag", error);
|
|
414
|
+
throw error;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
function ensureApiKeyApproved(config, apiKey) {
|
|
418
|
+
if (!apiKey || typeof apiKey !== "string" || apiKey.trim() === "") {
|
|
419
|
+
return config;
|
|
420
|
+
}
|
|
421
|
+
const truncatedApiKey = apiKey.substring(0, 20);
|
|
422
|
+
const updatedConfig = { ...config };
|
|
423
|
+
if (!updatedConfig.customApiKeyResponses) {
|
|
424
|
+
updatedConfig.customApiKeyResponses = {
|
|
425
|
+
approved: [],
|
|
426
|
+
rejected: []
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
if (!Array.isArray(updatedConfig.customApiKeyResponses.approved)) {
|
|
430
|
+
updatedConfig.customApiKeyResponses.approved = [];
|
|
431
|
+
}
|
|
432
|
+
if (!Array.isArray(updatedConfig.customApiKeyResponses.rejected)) {
|
|
433
|
+
updatedConfig.customApiKeyResponses.rejected = [];
|
|
434
|
+
}
|
|
435
|
+
const rejectedIndex = updatedConfig.customApiKeyResponses.rejected.indexOf(truncatedApiKey);
|
|
436
|
+
if (rejectedIndex > -1) {
|
|
437
|
+
updatedConfig.customApiKeyResponses.rejected.splice(rejectedIndex, 1);
|
|
438
|
+
}
|
|
439
|
+
if (!updatedConfig.customApiKeyResponses.approved.includes(truncatedApiKey)) {
|
|
440
|
+
updatedConfig.customApiKeyResponses.approved.push(truncatedApiKey);
|
|
441
|
+
}
|
|
442
|
+
return updatedConfig;
|
|
443
|
+
}
|
|
444
|
+
function removeApiKeyFromRejected(config, apiKey) {
|
|
445
|
+
if (!config.customApiKeyResponses || !Array.isArray(config.customApiKeyResponses.rejected)) {
|
|
446
|
+
return config;
|
|
447
|
+
}
|
|
448
|
+
const truncatedApiKey = apiKey.substring(0, 20);
|
|
449
|
+
const updatedConfig = { ...config };
|
|
450
|
+
if (updatedConfig.customApiKeyResponses) {
|
|
451
|
+
const rejectedIndex = updatedConfig.customApiKeyResponses.rejected.indexOf(truncatedApiKey);
|
|
452
|
+
if (rejectedIndex > -1) {
|
|
453
|
+
updatedConfig.customApiKeyResponses.rejected.splice(rejectedIndex, 1);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
return updatedConfig;
|
|
457
|
+
}
|
|
458
|
+
function manageApiKeyApproval(apiKey) {
|
|
459
|
+
try {
|
|
460
|
+
let config = readMcpConfig();
|
|
461
|
+
if (!config) {
|
|
462
|
+
config = { mcpServers: {} };
|
|
463
|
+
}
|
|
464
|
+
const updatedConfig = ensureApiKeyApproved(config, apiKey);
|
|
465
|
+
writeMcpConfig(updatedConfig);
|
|
466
|
+
} catch (error) {
|
|
467
|
+
ensureI18nInitialized();
|
|
468
|
+
console.error(i18n.t("mcp:apiKeyApprovalFailed"), error);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
function setPrimaryApiKey() {
|
|
472
|
+
try {
|
|
473
|
+
let config = readJsonConfig(CLAUDE_VSC_CONFIG_FILE);
|
|
474
|
+
if (!config) {
|
|
475
|
+
config = {};
|
|
476
|
+
}
|
|
477
|
+
config.primaryApiKey = "ccjk";
|
|
478
|
+
writeJsonConfig(CLAUDE_VSC_CONFIG_FILE, config);
|
|
479
|
+
} catch (error) {
|
|
480
|
+
ensureI18nInitialized();
|
|
481
|
+
console.error(i18n.t("mcp:primaryApiKeySetFailed"), error);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
const claudeConfig = {
|
|
486
|
+
__proto__: null,
|
|
487
|
+
addCompletedOnboarding: addCompletedOnboarding,
|
|
488
|
+
backupMcpConfig: backupMcpConfig,
|
|
489
|
+
buildMcpServerConfig: buildMcpServerConfig,
|
|
490
|
+
ensureApiKeyApproved: ensureApiKeyApproved,
|
|
491
|
+
fixWindowsMcpConfig: fixWindowsMcpConfig,
|
|
492
|
+
getMcpConfigPath: getMcpConfigPath,
|
|
493
|
+
manageApiKeyApproval: manageApiKeyApproval,
|
|
494
|
+
mergeMcpServers: mergeMcpServers,
|
|
495
|
+
readMcpConfig: readMcpConfig,
|
|
496
|
+
removeApiKeyFromRejected: removeApiKeyFromRejected,
|
|
497
|
+
setPrimaryApiKey: setPrimaryApiKey,
|
|
498
|
+
writeMcpConfig: writeMcpConfig
|
|
499
|
+
};
|
|
21
500
|
|
|
22
501
|
const MODEL_ENV_KEYS = [
|
|
23
502
|
"ANTHROPIC_MODEL",
|
|
@@ -711,7 +1190,7 @@ function createBackupDirectory(timestamp) {
|
|
|
711
1190
|
function backupCodexFiles() {
|
|
712
1191
|
if (!exists(CODEX_DIR))
|
|
713
1192
|
return null;
|
|
714
|
-
if (
|
|
1193
|
+
if (process__default.env.CCJK_CODEX_SKIP_PROMPT_SINGLE_BACKUP === "true" && cachedSkipPromptBackup)
|
|
715
1194
|
return cachedSkipPromptBackup;
|
|
716
1195
|
const timestamp = dayjs().format("YYYY-MM-DD_HH-mm-ss");
|
|
717
1196
|
const backupDir = createBackupDirectory(timestamp);
|
|
@@ -719,7 +1198,7 @@ function backupCodexFiles() {
|
|
|
719
1198
|
return !path.includes("/backup");
|
|
720
1199
|
};
|
|
721
1200
|
copyDir(CODEX_DIR, backupDir, { filter });
|
|
722
|
-
if (
|
|
1201
|
+
if (process__default.env.CCJK_CODEX_SKIP_PROMPT_SINGLE_BACKUP === "true")
|
|
723
1202
|
cachedSkipPromptBackup = backupDir;
|
|
724
1203
|
return backupDir;
|
|
725
1204
|
}
|
|
@@ -740,7 +1219,7 @@ function backupCodexConfig() {
|
|
|
740
1219
|
}
|
|
741
1220
|
}
|
|
742
1221
|
function backupCodexAgents() {
|
|
743
|
-
if (
|
|
1222
|
+
if (process__default.env.CCJK_CODEX_SKIP_PROMPT_SINGLE_BACKUP === "true" && cachedSkipPromptBackup)
|
|
744
1223
|
return cachedSkipPromptBackup;
|
|
745
1224
|
if (!exists(CODEX_AGENTS_FILE))
|
|
746
1225
|
return null;
|
|
@@ -755,7 +1234,7 @@ function backupCodexAgents() {
|
|
|
755
1234
|
}
|
|
756
1235
|
}
|
|
757
1236
|
function backupCodexPrompts() {
|
|
758
|
-
if (
|
|
1237
|
+
if (process__default.env.CCJK_CODEX_SKIP_PROMPT_SINGLE_BACKUP === "true" && cachedSkipPromptBackup)
|
|
759
1238
|
return cachedSkipPromptBackup;
|
|
760
1239
|
if (!exists(CODEX_PROMPTS_DIR))
|
|
761
1240
|
return null;
|
|
@@ -997,7 +1476,7 @@ function parseCodexConfig(content) {
|
|
|
997
1476
|
modelProviderCommented
|
|
998
1477
|
};
|
|
999
1478
|
} catch (error) {
|
|
1000
|
-
if (
|
|
1479
|
+
if (process__default.env.NODE_ENV === "development" || process__default.env.DEBUG) {
|
|
1001
1480
|
console.warn("TOML parsing failed, falling back to basic parsing:", error);
|
|
1002
1481
|
}
|
|
1003
1482
|
const cleaned = content.replace(/^\s*#\s*---\s*model provider added by CCJK\s*---\s*$/gim, "").replace(/^\s*#\s*---\s*MCP servers added by CCJK\s*---\s*$/gim, "").replace(/^\[model_providers\.[^\]]+\][\s\S]*?(?=^\[|$)/gim, "").replace(/^\[mcp_servers\.[^\]]+\][\s\S]*?(?=^\[|$)/gim, "").replace(/^\s*(?:#\s*)?model_provider\s*=.*$/gim, "").replace(/^\s*model\s*=.*$/gim, "").replace(/\n{3,}/g, "\n\n");
|
|
@@ -1319,7 +1798,7 @@ async function runCodexSystemPromptSelection(skipPrompt = false) {
|
|
|
1319
1798
|
ensureI18nInitialized();
|
|
1320
1799
|
const rootDir = getRootDir();
|
|
1321
1800
|
const zcfConfig = readZcfConfig();
|
|
1322
|
-
const { readDefaultTomlConfig: readDefaultTomlConfig2 } = await import('./ccjk-config.mjs');
|
|
1801
|
+
const { readDefaultTomlConfig: readDefaultTomlConfig2 } = await import('./ccjk-config.mjs').then(function (n) { return n.h; });
|
|
1323
1802
|
const tomlConfig = readDefaultTomlConfig2();
|
|
1324
1803
|
const { resolveTemplateLanguage } = await import('./prompts.mjs');
|
|
1325
1804
|
const preferredLang = await resolveTemplateLanguage(
|
|
@@ -1374,7 +1853,7 @@ async function runCodexSystemPromptSelection(skipPrompt = false) {
|
|
|
1374
1853
|
}
|
|
1375
1854
|
writeFileAtomic(CODEX_AGENTS_FILE, content);
|
|
1376
1855
|
try {
|
|
1377
|
-
const { updateTomlConfig: updateTomlConfig2 } = await import('./ccjk-config.mjs');
|
|
1856
|
+
const { updateTomlConfig: updateTomlConfig2 } = await import('./ccjk-config.mjs').then(function (n) { return n.h; });
|
|
1378
1857
|
const { ZCF_CONFIG_FILE: ZCF_CONFIG_FILE2 } = await import('./constants.mjs');
|
|
1379
1858
|
updateTomlConfig2(ZCF_CONFIG_FILE2, {
|
|
1380
1859
|
codex: {
|
|
@@ -1638,7 +2117,7 @@ async function configureCodexApi(options) {
|
|
|
1638
2117
|
}
|
|
1639
2118
|
const managementMode = detectConfigManagementMode();
|
|
1640
2119
|
if (managementMode.mode === "management" && managementMode.hasProviders) {
|
|
1641
|
-
const { default: { configureIncrementalManagement } } = await import('./index.mjs').then(function (n) { return n.
|
|
2120
|
+
const { default: { configureIncrementalManagement } } = await import('./index.mjs').then(function (n) { return n.aG; });
|
|
1642
2121
|
await configureIncrementalManagement();
|
|
1643
2122
|
return;
|
|
1644
2123
|
}
|
|
@@ -1902,7 +2381,7 @@ async function runCodexUpdate(force = false, skipPrompt = false) {
|
|
|
1902
2381
|
}
|
|
1903
2382
|
async function runCodexUninstall() {
|
|
1904
2383
|
ensureI18nInitialized();
|
|
1905
|
-
const { CodexUninstaller } = await import('./index.mjs').then(function (n) { return n.
|
|
2384
|
+
const { CodexUninstaller } = await import('./index.mjs').then(function (n) { return n.aH; });
|
|
1906
2385
|
const zcfConfig = readZcfConfig();
|
|
1907
2386
|
const preferredLang = zcfConfig?.preferredLang;
|
|
1908
2387
|
const uninstallLang = preferredLang && SUPPORTED_LANGS.includes(preferredLang) ? preferredLang : "en";
|
|
@@ -2131,4 +2610,4 @@ const codex = {
|
|
|
2131
2610
|
writeCodexConfig: writeCodexConfig
|
|
2132
2611
|
};
|
|
2133
2612
|
|
|
2134
|
-
export {
|
|
2613
|
+
export { backupExistingConfig as $, createBackupDirectory as A, ensureEnvKeyMigration as B, getBackupMessage as C, getCodexVersion as D, getCurrentCodexProvider as E, installCodexCli as F, isCodexInstalled as G, listCodexProviders as H, migrateEnvKeyInContent as I, migrateEnvKeyToTempEnvKey as J, needsEnvKeyMigration as K, parseCodexConfig as L, renderCodexConfig as M, runCodexFullInit as N, runCodexSystemPromptSelection as O, runCodexUninstall as P, runCodexUpdate as Q, runCodexWorkflowImport as R, runCodexWorkflowImportWithLanguageSelection as S, runCodexWorkflowSelection as T, switchCodexProvider as U, switchToProvider as V, shouldShowManagementMode as W, getAvailableManagementActions as X, configureCodexMcp as Y, applyCodexPlatformCommand as Z, ensureClaudeDir as _, writeAuthFile as a, copyConfigFiles as a0, configureApi as a1, mergeConfigs as a2, updateCustomModel as a3, updateDefaultModel as a4, mergeSettingsFile as a5, getExistingModelConfig as a6, getExistingApiConfig as a7, applyAiLanguageDirective as a8, switchToOfficialLogin$1 as a9, promptApiConfigurationAction as aa, MCP_SERVICE_CONFIGS as ab, selectMcpServices as ac, getMcpServices as ad, clearModelEnv as ae, getMcpService as af, claudeConfig as ag, config as ah, codex as ai, backupCodexComplete as b, cleanupPermissions as c, detectConfigManagementMode as d, readMcpConfig as e, writeMcpConfig as f, getMcpConfigPath as g, backupMcpConfig as h, mergeMcpServers as i, buildMcpServerConfig as j, fixWindowsMcpConfig as k, addCompletedOnboarding as l, mergeAndCleanPermissions as m, ensureApiKeyApproved as n, removeApiKeyFromRejected as o, manageApiKeyApproval as p, backupCodexAgents as q, readCodexConfig as r, setPrimaryApiKey as s, backupCodexConfig as t, backupCodexFiles as u, backupCodexPrompts as v, writeCodexConfig as w, checkCodexUpdate as x, switchToOfficialLogin as y, configureCodexApi as z };
|