ccjk 13.6.5 → 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.
- package/dist/chunks/api-cli.mjs +4 -2
- package/dist/chunks/api-config-selector.mjs +7 -7
- package/dist/chunks/auto-fix.mjs +3 -1
- package/dist/chunks/auto-updater.mjs +100 -2
- package/dist/chunks/banner.mjs +0 -16
- package/dist/chunks/ccjk-all.mjs +5 -2
- package/dist/chunks/ccjk-mcp.mjs +6 -3
- package/dist/chunks/ccjk-setup.mjs +4 -1
- package/dist/chunks/ccr.mjs +5 -5
- package/dist/chunks/check-updates.mjs +12 -2
- package/dist/chunks/claude-code-incremental-manager.mjs +45 -21
- package/dist/chunks/claude-wrapper.mjs +1 -1
- package/dist/chunks/cli-hook.mjs +4 -5
- package/dist/chunks/codex-config-switch.mjs +3 -3
- package/dist/chunks/codex-provider-manager.mjs +1 -1
- package/dist/chunks/codex.mjs +4 -360
- package/dist/chunks/config-switch.mjs +22 -11
- package/dist/chunks/config.mjs +1104 -5
- package/dist/chunks/config2.mjs +6 -4
- package/dist/chunks/config3.mjs +4 -2
- package/dist/chunks/constants.mjs +1 -1
- package/dist/chunks/doctor.mjs +2 -2
- package/dist/chunks/evolution.mjs +47 -27
- package/dist/chunks/features.mjs +76 -12
- package/dist/chunks/index10.mjs +78 -24
- package/dist/chunks/init.mjs +18 -35
- package/dist/chunks/installer.mjs +3 -3
- package/dist/chunks/mcp-cli.mjs +16 -16
- package/dist/chunks/mcp.mjs +9 -9
- package/dist/chunks/memory-check.mjs +1 -1
- package/dist/chunks/package.mjs +1 -1
- package/dist/chunks/platform.mjs +1 -1
- package/dist/chunks/quick-setup.mjs +11 -10
- package/dist/chunks/research.mjs +225 -27
- package/dist/chunks/slash-commands.mjs +1 -1
- package/dist/chunks/smart-defaults.mjs +2 -2
- package/dist/chunks/uninstall.mjs +1 -1
- package/dist/chunks/update.mjs +16 -16
- package/dist/chunks/version-checker.mjs +11 -1
- package/dist/cli.mjs +5 -1
- package/dist/i18n/locales/en/cli.json +0 -4
- package/dist/i18n/locales/en/menu.json +10 -3
- package/dist/i18n/locales/en/notification.json +2 -2
- package/dist/i18n/locales/zh-CN/cli.json +0 -4
- package/dist/i18n/locales/zh-CN/menu.json +10 -3
- package/dist/i18n/locales/zh-CN/notification.json +2 -2
- package/dist/index.mjs +3 -2
- package/dist/shared/{ccjk.C4m4ypdk.mjs → ccjk.B6VCKdyy.mjs} +4 -3
- package/dist/shared/ccjk.BI-hdI7P.mjs +30 -0
- package/dist/shared/{ccjk.DvAP4XfP.mjs → ccjk.CVjfbEIj.mjs} +2 -2
- package/dist/shared/ccjk.DKXs7Fbm.mjs +361 -0
- package/dist/shared/{ccjk.BP5hsTZQ.mjs → ccjk.Dh6Be-ef.mjs} +2 -2
- package/package.json +3 -1
- package/templates/common/workflow/essential/en/feat.md +68 -291
- package/templates/common/workflow/sixStep/en/workflow.md +56 -330
- package/dist/chunks/claude-code-config-manager.mjs +0 -809
- package/dist/chunks/claude-config.mjs +0 -253
package/dist/chunks/codex.mjs
CHANGED
|
@@ -11,14 +11,14 @@ import { x as K } from './main.mjs';
|
|
|
11
11
|
import { CODEX_CONFIG_FILE, CODEX_AUTH_FILE, CODEX_DIR, SUPPORTED_LANGS, CODEX_AGENTS_FILE, CODEX_PROMPTS_DIR, ZCF_CONFIG_FILE, AI_OUTPUT_LANGUAGES } from './constants.mjs';
|
|
12
12
|
import { ensureI18nInitialized, i18n, format } from './index2.mjs';
|
|
13
13
|
import { updateZcfConfig, readZcfConfig, readDefaultTomlConfig, updateTomlConfig } from './ccjk-config.mjs';
|
|
14
|
-
import {
|
|
14
|
+
import { t as applyAiLanguageDirective } from './config.mjs';
|
|
15
15
|
import { exists, readFile, ensureDir, writeFileAtomic, writeFile, copyDir, copyFile } from './fs-operations.mjs';
|
|
16
16
|
import { readJsonConfig, writeJsonConfig } from './json-config.mjs';
|
|
17
|
-
import {
|
|
17
|
+
import { i as isWindows, m as getMcpCommand, l as getSystemRoot, w as wrapCommandWithSudo, n as normalizeTomlPath } from './platform.mjs';
|
|
18
18
|
import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
|
|
19
19
|
import { resolveAiOutputLanguage } from './prompts.mjs';
|
|
20
20
|
import { p as promptBoolean } from '../shared/ccjk.DZ2LLOa-.mjs';
|
|
21
|
-
import {
|
|
21
|
+
import { M as MCP_SERVICE_CONFIGS, i as isMcpServiceCompatible, g as getMcpServices, b as getMcpServicesWithCompatibility } from '../shared/ccjk.DKXs7Fbm.mjs';
|
|
22
22
|
import { j as join, d as dirname } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
23
23
|
|
|
24
24
|
function detectConfigManagementMode() {
|
|
@@ -49,362 +49,6 @@ function detectConfigManagementMode() {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
const MCP_SERVICE_CONFIGS = [
|
|
53
|
-
// Documentation and research services
|
|
54
|
-
{
|
|
55
|
-
id: "context7",
|
|
56
|
-
requiresApiKey: false,
|
|
57
|
-
defaultSelected: true,
|
|
58
|
-
config: {
|
|
59
|
-
type: "stdio",
|
|
60
|
-
command: "npx",
|
|
61
|
-
args: ["-y", "@upstash/context7-mcp@latest"],
|
|
62
|
-
env: {}
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
id: "open-websearch",
|
|
67
|
-
requiresApiKey: false,
|
|
68
|
-
config: {
|
|
69
|
-
type: "stdio",
|
|
70
|
-
command: "npx",
|
|
71
|
-
args: ["-y", "open-websearch@latest"],
|
|
72
|
-
env: {
|
|
73
|
-
MODE: "stdio",
|
|
74
|
-
DEFAULT_SEARCH_ENGINE: "duckduckgo",
|
|
75
|
-
ALLOWED_SEARCH_ENGINES: "duckduckgo,bing,brave"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
id: "mcp-deepwiki",
|
|
81
|
-
requiresApiKey: false,
|
|
82
|
-
config: {
|
|
83
|
-
type: "stdio",
|
|
84
|
-
command: "npx",
|
|
85
|
-
args: ["-y", "mcp-deepwiki@latest"],
|
|
86
|
-
env: {}
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
id: "spec-workflow",
|
|
91
|
-
requiresApiKey: false,
|
|
92
|
-
config: {
|
|
93
|
-
type: "stdio",
|
|
94
|
-
command: "npx",
|
|
95
|
-
args: ["-y", "@pimzino/spec-workflow-mcp@latest"],
|
|
96
|
-
env: {}
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
id: "serena",
|
|
101
|
-
requiresApiKey: false,
|
|
102
|
-
config: {
|
|
103
|
-
type: "stdio",
|
|
104
|
-
command: "uvx",
|
|
105
|
-
args: ["--from", "git+https://github.com/oraios/serena", "serena", "start-mcp-server", "--context", "ide-assistant", "--enable-web-dashboard", "false"],
|
|
106
|
-
env: {}
|
|
107
|
-
},
|
|
108
|
-
platformRequirements: {
|
|
109
|
-
requiredCommands: ["uvx"]
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
id: "Playwright",
|
|
114
|
-
requiresApiKey: false,
|
|
115
|
-
config: {
|
|
116
|
-
type: "stdio",
|
|
117
|
-
command: "npx",
|
|
118
|
-
args: ["-y", "@playwright/mcp@latest", "--browser", "chromium"],
|
|
119
|
-
env: {}
|
|
120
|
-
},
|
|
121
|
-
platformRequirements: {
|
|
122
|
-
platforms: ["macos", "windows"],
|
|
123
|
-
requiresGui: true
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
id: "intent-engine",
|
|
128
|
-
requiresApiKey: false,
|
|
129
|
-
config: {
|
|
130
|
-
type: "stdio",
|
|
131
|
-
command: "npx",
|
|
132
|
-
args: ["-y", "@origintask/intent-engine@latest", "mcp"],
|
|
133
|
-
env: {}
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
id: "sqlite",
|
|
138
|
-
requiresApiKey: false,
|
|
139
|
-
config: {
|
|
140
|
-
type: "stdio",
|
|
141
|
-
command: "npx",
|
|
142
|
-
args: ["-y", "@anthropic-ai/mcp-server-sqlite@latest"],
|
|
143
|
-
env: {}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
];
|
|
147
|
-
async function getMcpServices() {
|
|
148
|
-
ensureI18nInitialized();
|
|
149
|
-
const mcpServiceList = [
|
|
150
|
-
{
|
|
151
|
-
id: "context7",
|
|
152
|
-
name: i18n.t("mcp:services.context7.name"),
|
|
153
|
-
description: i18n.t("mcp:services.context7.description")
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
id: "open-websearch",
|
|
157
|
-
name: i18n.t("mcp:services.open-websearch.name"),
|
|
158
|
-
description: i18n.t("mcp:services.open-websearch.description")
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
id: "mcp-deepwiki",
|
|
162
|
-
name: i18n.t("mcp:services.mcp-deepwiki.name"),
|
|
163
|
-
description: i18n.t("mcp:services.mcp-deepwiki.description")
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
id: "spec-workflow",
|
|
167
|
-
name: i18n.t("mcp:services.spec-workflow.name"),
|
|
168
|
-
description: i18n.t("mcp:services.spec-workflow.description")
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
id: "serena",
|
|
172
|
-
name: i18n.t("mcp:services.serena.name"),
|
|
173
|
-
description: i18n.t("mcp:services.serena.description")
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
id: "Playwright",
|
|
177
|
-
name: i18n.t("mcp:services.Playwright.name"),
|
|
178
|
-
description: i18n.t("mcp:services.Playwright.description")
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
id: "intent-engine",
|
|
182
|
-
name: i18n.t("mcp:services.intent-engine.name"),
|
|
183
|
-
description: i18n.t("mcp:services.intent-engine.description")
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
id: "sqlite",
|
|
187
|
-
name: i18n.t("mcp:services.sqlite.name"),
|
|
188
|
-
description: i18n.t("mcp:services.sqlite.description")
|
|
189
|
-
}
|
|
190
|
-
];
|
|
191
|
-
return MCP_SERVICE_CONFIGS.map((config) => {
|
|
192
|
-
const serviceInfo = mcpServiceList.find((s) => s.id === config.id);
|
|
193
|
-
const service = {
|
|
194
|
-
id: config.id,
|
|
195
|
-
name: serviceInfo?.name || config.id,
|
|
196
|
-
description: serviceInfo?.description || "",
|
|
197
|
-
requiresApiKey: config.requiresApiKey,
|
|
198
|
-
config: config.config
|
|
199
|
-
};
|
|
200
|
-
if (config.apiKeyEnvVar) {
|
|
201
|
-
service.apiKeyEnvVar = config.apiKeyEnvVar;
|
|
202
|
-
}
|
|
203
|
-
return service;
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
async function getMcpService(id) {
|
|
207
|
-
const services = await getMcpServices();
|
|
208
|
-
return services.find((service) => service.id === id);
|
|
209
|
-
}
|
|
210
|
-
function detectPlatform() {
|
|
211
|
-
const platform = process__default.platform;
|
|
212
|
-
const env = process__default.env;
|
|
213
|
-
const isWsl = !!(env.WSL_DISTRO_NAME || env.WSLENV || env.PATH && env.PATH.includes("/mnt/c/"));
|
|
214
|
-
const isTermux = !!(env.TERMUX_VERSION || env.PREFIX?.includes("com.termux"));
|
|
215
|
-
const isHeadless = !!(env.SSH_CLIENT || env.SSH_TTY || env.SSH_CONNECTION || !env.DISPLAY && platform === "linux");
|
|
216
|
-
const hasGui = (() => {
|
|
217
|
-
if (platform === "darwin")
|
|
218
|
-
return true;
|
|
219
|
-
if (platform === "win32")
|
|
220
|
-
return !isHeadless;
|
|
221
|
-
if (isWsl || isTermux)
|
|
222
|
-
return false;
|
|
223
|
-
if (platform === "linux")
|
|
224
|
-
return !!env.DISPLAY || !!env.WAYLAND_DISPLAY;
|
|
225
|
-
return false;
|
|
226
|
-
})();
|
|
227
|
-
let detectedPlatform;
|
|
228
|
-
if (platform === "darwin") {
|
|
229
|
-
detectedPlatform = "macos";
|
|
230
|
-
} else if (platform === "win32") {
|
|
231
|
-
detectedPlatform = "windows";
|
|
232
|
-
} else if (isWsl) {
|
|
233
|
-
detectedPlatform = "wsl";
|
|
234
|
-
} else if (isTermux) {
|
|
235
|
-
detectedPlatform = "termux";
|
|
236
|
-
} else if (platform === "linux") {
|
|
237
|
-
detectedPlatform = "linux";
|
|
238
|
-
} else {
|
|
239
|
-
detectedPlatform = "unknown";
|
|
240
|
-
}
|
|
241
|
-
return {
|
|
242
|
-
platform: detectedPlatform,
|
|
243
|
-
hasGui,
|
|
244
|
-
isHeadless
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
function isCommandAvailable(command) {
|
|
248
|
-
try {
|
|
249
|
-
execSync(`which ${command}`, { stdio: "ignore" });
|
|
250
|
-
return true;
|
|
251
|
-
} catch {
|
|
252
|
-
return false;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
function isMcpServiceCompatible(serviceId) {
|
|
256
|
-
const config = MCP_SERVICE_CONFIGS.find((c) => c.id === serviceId);
|
|
257
|
-
if (!config) {
|
|
258
|
-
return { compatible: false, reason: "Service not found" };
|
|
259
|
-
}
|
|
260
|
-
const requirements = config.platformRequirements;
|
|
261
|
-
if (!requirements) {
|
|
262
|
-
return { compatible: true };
|
|
263
|
-
}
|
|
264
|
-
const { platform, hasGui } = detectPlatform();
|
|
265
|
-
if (requirements.platforms && requirements.platforms.length > 0) {
|
|
266
|
-
if (platform !== "unknown" && !requirements.platforms.includes(platform)) {
|
|
267
|
-
return {
|
|
268
|
-
compatible: false,
|
|
269
|
-
reason: `Not supported on ${platform}. Requires: ${requirements.platforms.join(", ")}`
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
if (requirements.requiresGui && !hasGui) {
|
|
274
|
-
return {
|
|
275
|
-
compatible: false,
|
|
276
|
-
reason: "Requires GUI environment (X11/Wayland/Desktop)"
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
if (requirements.requiredCommands) {
|
|
280
|
-
for (const cmd of requirements.requiredCommands) {
|
|
281
|
-
if (!isCommandAvailable(cmd)) {
|
|
282
|
-
return {
|
|
283
|
-
compatible: false,
|
|
284
|
-
reason: `Required command not found: ${cmd}`
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
return { compatible: true };
|
|
290
|
-
}
|
|
291
|
-
async function getMcpServicesWithCompatibility() {
|
|
292
|
-
const allServices = await getMcpServices();
|
|
293
|
-
return allServices.map((service) => {
|
|
294
|
-
const { compatible, reason } = isMcpServiceCompatible(service.id);
|
|
295
|
-
return {
|
|
296
|
-
...service,
|
|
297
|
-
compatible,
|
|
298
|
-
incompatibleReason: reason
|
|
299
|
-
};
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
const DEFAULT_MCP_TOOL_SEARCH_CONFIG = {
|
|
303
|
-
mcpAutoEnableThreshold: 10,
|
|
304
|
-
excludedServices: ["mcp-search", "context7"]
|
|
305
|
-
};
|
|
306
|
-
function getMcpToolSearchConfig() {
|
|
307
|
-
const env = process__default.env;
|
|
308
|
-
return {
|
|
309
|
-
mcpAutoEnableThreshold: env.MCP_AUTO_THRESHOLD || DEFAULT_MCP_TOOL_SEARCH_CONFIG.mcpAutoEnableThreshold,
|
|
310
|
-
dynamicServiceDiscovery: env.MCP_DYNAMIC_DISCOVERY !== "false",
|
|
311
|
-
listChangedNotifications: env.MCP_LIST_CHANGED !== "false",
|
|
312
|
-
excludedServices: env.MCP_EXCLUDED_SERVICES?.split(",").map((s) => s.trim()).filter(Boolean) || DEFAULT_MCP_TOOL_SEARCH_CONFIG.excludedServices
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
class DynamicMcpServiceRegistry {
|
|
316
|
-
_services = /* @__PURE__ */ new Map();
|
|
317
|
-
_listeners = /* @__PURE__ */ new Set();
|
|
318
|
-
_enabled = false;
|
|
319
|
-
/**
|
|
320
|
-
* Enable dynamic service discovery
|
|
321
|
-
*/
|
|
322
|
-
enable() {
|
|
323
|
-
this._enabled = true;
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* Disable dynamic service discovery
|
|
327
|
-
*/
|
|
328
|
-
disable() {
|
|
329
|
-
this._enabled = false;
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* Check if dynamic discovery is enabled
|
|
333
|
-
*/
|
|
334
|
-
isEnabled() {
|
|
335
|
-
return this._enabled;
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* Add a service dynamically
|
|
339
|
-
*/
|
|
340
|
-
addService(serviceId, config) {
|
|
341
|
-
if (!this._enabled) {
|
|
342
|
-
return false;
|
|
343
|
-
}
|
|
344
|
-
const isUpdate = this._services.has(serviceId);
|
|
345
|
-
this._services.set(serviceId, config);
|
|
346
|
-
this._notify({
|
|
347
|
-
type: isUpdate ? "updated" : "added",
|
|
348
|
-
serviceId,
|
|
349
|
-
timestamp: Date.now(),
|
|
350
|
-
config
|
|
351
|
-
});
|
|
352
|
-
return true;
|
|
353
|
-
}
|
|
354
|
-
/**
|
|
355
|
-
* Remove a service dynamically
|
|
356
|
-
*/
|
|
357
|
-
removeService(serviceId) {
|
|
358
|
-
if (!this._enabled || !this._services.has(serviceId)) {
|
|
359
|
-
return false;
|
|
360
|
-
}
|
|
361
|
-
const config = this._services.get(serviceId);
|
|
362
|
-
this._services.delete(serviceId);
|
|
363
|
-
this._notify({
|
|
364
|
-
type: "removed",
|
|
365
|
-
serviceId,
|
|
366
|
-
timestamp: Date.now(),
|
|
367
|
-
config
|
|
368
|
-
});
|
|
369
|
-
return true;
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* Get a service configuration
|
|
373
|
-
*/
|
|
374
|
-
getService(serviceId) {
|
|
375
|
-
return this._services.get(serviceId);
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* List all dynamically registered services
|
|
379
|
-
*/
|
|
380
|
-
listServices() {
|
|
381
|
-
return new Map(this._services);
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* Subscribe to list change notifications
|
|
385
|
-
*/
|
|
386
|
-
subscribe(listener) {
|
|
387
|
-
this._listeners.add(listener);
|
|
388
|
-
return () => this._listeners.delete(listener);
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Notify all listeners of a change
|
|
392
|
-
*/
|
|
393
|
-
_notify(notification) {
|
|
394
|
-
const toolSearchConfig = getMcpToolSearchConfig();
|
|
395
|
-
if (toolSearchConfig.listChangedNotifications) {
|
|
396
|
-
for (const listener of Array.from(this._listeners)) {
|
|
397
|
-
try {
|
|
398
|
-
listener(notification);
|
|
399
|
-
} catch (error) {
|
|
400
|
-
console.error("Error notifying MCP list change listener:", error);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
const dynamicMcpRegistry = new DynamicMcpServiceRegistry();
|
|
407
|
-
|
|
408
52
|
function applyCodexPlatformCommand(config) {
|
|
409
53
|
if (isWindows() && config.command) {
|
|
410
54
|
const mcpCmd = getMcpCommand(config.command);
|
|
@@ -2425,4 +2069,4 @@ const codex = {
|
|
|
2425
2069
|
writeCodexConfig: writeCodexConfig
|
|
2426
2070
|
};
|
|
2427
2071
|
|
|
2428
|
-
export {
|
|
2072
|
+
export { switchToOfficialLogin as a, switchToProvider as b, runCodexUpdate as c, detectConfigManagementMode as d, backupCodexComplete as e, writeAuthFile as f, applyCodexPlatformCommand as g, runCodexFullInit as h, runCodexUninstall as i, configureCodexAiMemoryFeature as j, configureCodexDefaultModelFeature as k, listCodexProviders as l, configureCodexMcp as m, configureCodexApi as n, configureCodexPresetFeature as o, runCodexWorkflowImportWithLanguageSelection as p, codex as q, readCodexConfig as r, switchCodexProvider as s, writeCodexConfig as w };
|
|
@@ -4,7 +4,7 @@ import { i as inquirer } from './index6.mjs';
|
|
|
4
4
|
import { resolveCodeToolType, isCodeToolType, DEFAULT_CODE_TOOL_TYPE } from './constants.mjs';
|
|
5
5
|
import { ensureI18nInitialized, i18n } from './index2.mjs';
|
|
6
6
|
import { readZcfConfig } from './ccjk-config.mjs';
|
|
7
|
-
import { ClaudeCodeConfigManager } from './
|
|
7
|
+
import { C as ClaudeCodeConfigManager, s as setMyclaudeActiveProviderProfile, j as syncMyclaudeProviderProfilesFromClaudeConfig } from './config.mjs';
|
|
8
8
|
import { s as switchCodexProvider, l as listCodexProviders, r as readCodexConfig, a as switchToOfficialLogin, b as switchToProvider } from './codex.mjs';
|
|
9
9
|
import { h as handleGeneralError } from '../shared/ccjk.DGllfVCZ.mjs';
|
|
10
10
|
import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
|
|
@@ -32,8 +32,6 @@ import './fs-operations.mjs';
|
|
|
32
32
|
import 'node:fs/promises';
|
|
33
33
|
import './json-config.mjs';
|
|
34
34
|
import '../shared/ccjk.RyizuzOI.mjs';
|
|
35
|
-
import './config.mjs';
|
|
36
|
-
import './claude-config.mjs';
|
|
37
35
|
import './platform.mjs';
|
|
38
36
|
import './main.mjs';
|
|
39
37
|
import 'module';
|
|
@@ -46,6 +44,7 @@ import '../shared/ccjk.CxpGa6MC.mjs';
|
|
|
46
44
|
import './prompts.mjs';
|
|
47
45
|
import '../shared/ccjk.gDEDGD_t.mjs';
|
|
48
46
|
import '../shared/ccjk.DZ2LLOa-.mjs';
|
|
47
|
+
import '../shared/ccjk.DKXs7Fbm.mjs';
|
|
49
48
|
|
|
50
49
|
async function configSwitchCommand(options) {
|
|
51
50
|
try {
|
|
@@ -78,9 +77,18 @@ function resolveCodeType(codeType) {
|
|
|
78
77
|
}
|
|
79
78
|
return DEFAULT_CODE_TOOL_TYPE;
|
|
80
79
|
}
|
|
80
|
+
function syncMyclaudeStateIfNeeded(codeType, currentProfileId) {
|
|
81
|
+
if (codeType !== "myclaude") {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (currentProfileId !== void 0) {
|
|
85
|
+
setMyclaudeActiveProviderProfile(currentProfileId);
|
|
86
|
+
}
|
|
87
|
+
syncMyclaudeProviderProfilesFromClaudeConfig(ClaudeCodeConfigManager.readConfig());
|
|
88
|
+
}
|
|
81
89
|
async function handleList(codeType) {
|
|
82
90
|
const targetCodeType = resolveCodeType(codeType);
|
|
83
|
-
if (targetCodeType === "claude-code") {
|
|
91
|
+
if (targetCodeType === "claude-code" || targetCodeType === "myclaude") {
|
|
84
92
|
await listClaudeCodeProfiles();
|
|
85
93
|
} else if (targetCodeType === "codex") {
|
|
86
94
|
await listCodexProvidersWithDisplay();
|
|
@@ -133,18 +141,19 @@ async function listClaudeCodeProfiles() {
|
|
|
133
141
|
}
|
|
134
142
|
async function handleDirectSwitch(codeType, target) {
|
|
135
143
|
const resolvedCodeType = resolveCodeType(codeType);
|
|
136
|
-
if (resolvedCodeType === "claude-code") {
|
|
137
|
-
await handleClaudeCodeDirectSwitch(target);
|
|
144
|
+
if (resolvedCodeType === "claude-code" || resolvedCodeType === "myclaude") {
|
|
145
|
+
await handleClaudeCodeDirectSwitch(target, resolvedCodeType);
|
|
138
146
|
} else if (resolvedCodeType === "codex") {
|
|
139
147
|
await switchCodexProvider(target);
|
|
140
148
|
}
|
|
141
149
|
}
|
|
142
|
-
async function handleClaudeCodeDirectSwitch(target) {
|
|
150
|
+
async function handleClaudeCodeDirectSwitch(target, codeType = "claude-code") {
|
|
143
151
|
if (target === "official") {
|
|
144
152
|
const result = await ClaudeCodeConfigManager.switchToOfficial();
|
|
145
153
|
if (result.success) {
|
|
146
154
|
try {
|
|
147
155
|
await ClaudeCodeConfigManager.applyProfileSettings(null);
|
|
156
|
+
syncMyclaudeStateIfNeeded(codeType, "");
|
|
148
157
|
console.log(a.green(i18n.t("multi-config:successfullySwitchedToOfficial")));
|
|
149
158
|
} catch (error) {
|
|
150
159
|
const reason = error instanceof Error ? error.message : String(error);
|
|
@@ -159,6 +168,7 @@ async function handleClaudeCodeDirectSwitch(target) {
|
|
|
159
168
|
try {
|
|
160
169
|
const profile = ClaudeCodeConfigManager.getProfileById("ccr-proxy");
|
|
161
170
|
await ClaudeCodeConfigManager.applyProfileSettings(profile);
|
|
171
|
+
syncMyclaudeStateIfNeeded(codeType, "ccr-proxy");
|
|
162
172
|
console.log(a.green(i18n.t("multi-config:successfullySwitchedToCcr")));
|
|
163
173
|
} catch (error) {
|
|
164
174
|
const reason = error instanceof Error ? error.message : String(error);
|
|
@@ -191,6 +201,7 @@ async function handleClaudeCodeDirectSwitch(target) {
|
|
|
191
201
|
if (result.success) {
|
|
192
202
|
try {
|
|
193
203
|
await ClaudeCodeConfigManager.applyProfileSettings({ ...resolvedProfile, id: resolvedId });
|
|
204
|
+
syncMyclaudeStateIfNeeded(codeType, resolvedId);
|
|
194
205
|
console.log(a.green(i18n.t("multi-config:successfullySwitchedToProfile", { name: resolvedProfile.name })));
|
|
195
206
|
} catch (error) {
|
|
196
207
|
const reason = error instanceof Error ? error.message : String(error);
|
|
@@ -203,13 +214,13 @@ async function handleClaudeCodeDirectSwitch(target) {
|
|
|
203
214
|
}
|
|
204
215
|
async function handleInteractiveSwitch(codeType) {
|
|
205
216
|
const resolvedCodeType = resolveCodeType(codeType);
|
|
206
|
-
if (resolvedCodeType === "claude-code") {
|
|
207
|
-
await handleClaudeCodeInteractiveSwitch();
|
|
217
|
+
if (resolvedCodeType === "claude-code" || resolvedCodeType === "myclaude") {
|
|
218
|
+
await handleClaudeCodeInteractiveSwitch(resolvedCodeType);
|
|
208
219
|
} else if (resolvedCodeType === "codex") {
|
|
209
220
|
await handleCodexInteractiveSwitch();
|
|
210
221
|
}
|
|
211
222
|
}
|
|
212
|
-
async function handleClaudeCodeInteractiveSwitch() {
|
|
223
|
+
async function handleClaudeCodeInteractiveSwitch(codeType = "claude-code") {
|
|
213
224
|
const config = ClaudeCodeConfigManager.readConfig();
|
|
214
225
|
if (!config || !config.profiles || Object.keys(config.profiles).length === 0) {
|
|
215
226
|
console.log(a.yellow(i18n.t("multi-config:noClaudeCodeProfilesAvailable")));
|
|
@@ -249,7 +260,7 @@ async function handleClaudeCodeInteractiveSwitch() {
|
|
|
249
260
|
console.log(a.yellow(i18n.t("multi-config:cancelled")));
|
|
250
261
|
return;
|
|
251
262
|
}
|
|
252
|
-
await handleClaudeCodeDirectSwitch(selectedConfig);
|
|
263
|
+
await handleClaudeCodeDirectSwitch(selectedConfig, codeType);
|
|
253
264
|
} catch (error) {
|
|
254
265
|
if (error.name === "ExitPromptError") {
|
|
255
266
|
console.log(a.green(`
|