ccjk 12.0.7 → 12.0.8
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/package.json +1 -1
- package/dist/chunks/agent-teams.mjs +0 -136
- package/dist/chunks/agent.mjs +0 -1439
- package/dist/chunks/agents.mjs +0 -3778
- package/dist/chunks/api-cli.mjs +0 -132
- package/dist/chunks/api-providers.mjs +0 -129
- package/dist/chunks/api.mjs +0 -112
- package/dist/chunks/auto-bootstrap.mjs +0 -358
- package/dist/chunks/auto-init.mjs +0 -7584
- package/dist/chunks/auto-updater.mjs +0 -410
- package/dist/chunks/banner.mjs +0 -188
- package/dist/chunks/bash.mjs +0 -187
- package/dist/chunks/boost.mjs +0 -397
- package/dist/chunks/ccjk-agents.mjs +0 -414
- package/dist/chunks/ccjk-all.mjs +0 -1028
- package/dist/chunks/ccjk-config.mjs +0 -261
- package/dist/chunks/ccjk-hooks.mjs +0 -1074
- package/dist/chunks/ccjk-mcp.mjs +0 -761
- package/dist/chunks/ccjk-setup.mjs +0 -763
- package/dist/chunks/ccjk-skills.mjs +0 -514
- package/dist/chunks/ccr.mjs +0 -98
- package/dist/chunks/ccu.mjs +0 -40
- package/dist/chunks/check-updates.mjs +0 -108
- package/dist/chunks/claude-code-config-manager.mjs +0 -750
- package/dist/chunks/claude-code-incremental-manager.mjs +0 -623
- package/dist/chunks/claude-config.mjs +0 -236
- package/dist/chunks/claude-wrapper.mjs +0 -85
- package/dist/chunks/cleanup-migration.mjs +0 -20
- package/dist/chunks/cli-hook.mjs +0 -2285
- package/dist/chunks/cloud-sync.mjs +0 -29
- package/dist/chunks/codex-config-switch.mjs +0 -451
- package/dist/chunks/codex-provider-manager.mjs +0 -236
- package/dist/chunks/codex-uninstaller.mjs +0 -404
- package/dist/chunks/codex.mjs +0 -2077
- package/dist/chunks/commands.mjs +0 -108
- package/dist/chunks/commands2.mjs +0 -413
- package/dist/chunks/commit.mjs +0 -138
- package/dist/chunks/completion.mjs +0 -515
- package/dist/chunks/config-consolidator.mjs +0 -172
- package/dist/chunks/config-switch.mjs +0 -317
- package/dist/chunks/config.mjs +0 -379
- package/dist/chunks/config2.mjs +0 -477
- package/dist/chunks/config3.mjs +0 -470
- package/dist/chunks/constants.mjs +0 -133
- package/dist/chunks/context-loader.mjs +0 -343
- package/dist/chunks/context.mjs +0 -372
- package/dist/chunks/convoy-manager.mjs +0 -880
- package/dist/chunks/dashboard.mjs +0 -476
- package/dist/chunks/doctor.mjs +0 -964
- package/dist/chunks/evolution.mjs +0 -382
- package/dist/chunks/features.mjs +0 -698
- package/dist/chunks/fish.mjs +0 -181
- package/dist/chunks/fs-operations.mjs +0 -192
- package/dist/chunks/health-alerts.mjs +0 -304
- package/dist/chunks/health-check.mjs +0 -532
- package/dist/chunks/help.mjs +0 -340
- package/dist/chunks/hook-installer.mjs +0 -45
- package/dist/chunks/index.mjs +0 -24
- package/dist/chunks/index10.mjs +0 -1171
- package/dist/chunks/index11.mjs +0 -1008
- package/dist/chunks/index12.mjs +0 -193
- package/dist/chunks/index13.mjs +0 -218
- package/dist/chunks/index14.mjs +0 -663
- package/dist/chunks/index2.mjs +0 -19
- package/dist/chunks/index3.mjs +0 -19092
- package/dist/chunks/index4.mjs +0 -8
- package/dist/chunks/index5.mjs +0 -7600
- package/dist/chunks/index6.mjs +0 -171
- package/dist/chunks/index7.mjs +0 -3583
- package/dist/chunks/index8.mjs +0 -19
- package/dist/chunks/index9.mjs +0 -616
- package/dist/chunks/init.mjs +0 -1606
- package/dist/chunks/installer.mjs +0 -690
- package/dist/chunks/installer2.mjs +0 -179
- package/dist/chunks/interview.mjs +0 -2927
- package/dist/chunks/json-config.mjs +0 -60
- package/dist/chunks/linux.mjs +0 -3863
- package/dist/chunks/macos.mjs +0 -69
- package/dist/chunks/main.mjs +0 -635
- package/dist/chunks/manager.mjs +0 -1048
- package/dist/chunks/marketplace.mjs +0 -949
- package/dist/chunks/mcp-cli.mjs +0 -204
- package/dist/chunks/mcp-performance.mjs +0 -187
- package/dist/chunks/mcp.mjs +0 -1231
- package/dist/chunks/menu.mjs +0 -652
- package/dist/chunks/metrics-display.mjs +0 -153
- package/dist/chunks/migrator.mjs +0 -178
- package/dist/chunks/monitor.mjs +0 -1856
- package/dist/chunks/notification.mjs +0 -1864
- package/dist/chunks/onboarding.mjs +0 -385
- package/dist/chunks/package.mjs +0 -3
- package/dist/chunks/paradigm.mjs +0 -74
- package/dist/chunks/permission-manager.mjs +0 -132
- package/dist/chunks/permissions.mjs +0 -265
- package/dist/chunks/persistence-manager.mjs +0 -794
- package/dist/chunks/persistence.mjs +0 -667
- package/dist/chunks/platform.mjs +0 -391
- package/dist/chunks/plugin.mjs +0 -1936
- package/dist/chunks/powershell.mjs +0 -213
- package/dist/chunks/prompts.mjs +0 -241
- package/dist/chunks/providers.mjs +0 -260
- package/dist/chunks/quick-actions.mjs +0 -320
- package/dist/chunks/quick-provider.mjs +0 -682
- package/dist/chunks/quick-setup.mjs +0 -412
- package/dist/chunks/remote.mjs +0 -497
- package/dist/chunks/session.mjs +0 -878
- package/dist/chunks/sessions.mjs +0 -106
- package/dist/chunks/silent-updater.mjs +0 -396
- package/dist/chunks/simple-config.mjs +0 -98
- package/dist/chunks/skill.mjs +0 -117
- package/dist/chunks/skill2.mjs +0 -9003
- package/dist/chunks/skills-sync.mjs +0 -6460
- package/dist/chunks/skills.mjs +0 -567
- package/dist/chunks/slash-commands.mjs +0 -207
- package/dist/chunks/smart-defaults.mjs +0 -412
- package/dist/chunks/smart-guide.mjs +0 -194
- package/dist/chunks/startup.mjs +0 -487
- package/dist/chunks/stats.mjs +0 -410
- package/dist/chunks/status.mjs +0 -289
- package/dist/chunks/team.mjs +0 -63
- package/dist/chunks/thinking.mjs +0 -626
- package/dist/chunks/trace.mjs +0 -57
- package/dist/chunks/uninstall.mjs +0 -849
- package/dist/chunks/update.mjs +0 -167
- package/dist/chunks/upgrade-manager.mjs +0 -204
- package/dist/chunks/version-checker.mjs +0 -881
- package/dist/chunks/vim.mjs +0 -903
- package/dist/chunks/windows.mjs +0 -14
- package/dist/chunks/workflows.mjs +0 -633
- package/dist/chunks/wsl.mjs +0 -129
- package/dist/chunks/zero-config.mjs +0 -374
- package/dist/chunks/zsh.mjs +0 -182
- package/dist/cli.d.mts +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.mjs +0 -2199
- package/dist/i18n/locales/en/agent-teams.json +0 -18
- package/dist/i18n/locales/en/agentBrowser.json +0 -79
- package/dist/i18n/locales/en/agents.json +0 -135
- package/dist/i18n/locales/en/api.json +0 -63
- package/dist/i18n/locales/en/ccjk-agents.json +0 -33
- package/dist/i18n/locales/en/ccjk-all.json +0 -23
- package/dist/i18n/locales/en/ccjk-skills.json +0 -22
- package/dist/i18n/locales/en/ccjk.json +0 -276
- package/dist/i18n/locales/en/ccr.json +0 -65
- package/dist/i18n/locales/en/claude-md.json +0 -73
- package/dist/i18n/locales/en/cli.json +0 -152
- package/dist/i18n/locales/en/cloud-setup.json +0 -31
- package/dist/i18n/locales/en/cloud-sync.json +0 -147
- package/dist/i18n/locales/en/cloud.json +0 -40
- package/dist/i18n/locales/en/cloudPlugins.json +0 -118
- package/dist/i18n/locales/en/codex.json +0 -127
- package/dist/i18n/locales/en/cometix.json +0 -29
- package/dist/i18n/locales/en/common.json +0 -68
- package/dist/i18n/locales/en/config.json +0 -108
- package/dist/i18n/locales/en/configuration.json +0 -226
- package/dist/i18n/locales/en/context.json +0 -85
- package/dist/i18n/locales/en/dashboard.json +0 -78
- package/dist/i18n/locales/en/errors.json +0 -26
- package/dist/i18n/locales/en/evolution.json +0 -54
- package/dist/i18n/locales/en/hooks.json +0 -74
- package/dist/i18n/locales/en/hooksSync.json +0 -133
- package/dist/i18n/locales/en/installation.json +0 -83
- package/dist/i18n/locales/en/interview.json +0 -104
- package/dist/i18n/locales/en/language.json +0 -19
- package/dist/i18n/locales/en/lsp.json +0 -78
- package/dist/i18n/locales/en/marketplace.json +0 -116
- package/dist/i18n/locales/en/mcp.json +0 -178
- package/dist/i18n/locales/en/memory.json +0 -92
- package/dist/i18n/locales/en/menu.json +0 -143
- package/dist/i18n/locales/en/multi-config.json +0 -79
- package/dist/i18n/locales/en/notification.json +0 -307
- package/dist/i18n/locales/en/permissions.json +0 -95
- package/dist/i18n/locales/en/persistence.json +0 -127
- package/dist/i18n/locales/en/plugins.json +0 -146
- package/dist/i18n/locales/en/quick-actions.json +0 -78
- package/dist/i18n/locales/en/registry.json +0 -54
- package/dist/i18n/locales/en/remote.json +0 -93
- package/dist/i18n/locales/en/sandbox.json +0 -44
- package/dist/i18n/locales/en/setup.json +0 -44
- package/dist/i18n/locales/en/shencha.json +0 -14
- package/dist/i18n/locales/en/skills.json +0 -100
- package/dist/i18n/locales/en/skillsSync.json +0 -74
- package/dist/i18n/locales/en/smartGuide.json +0 -49
- package/dist/i18n/locales/en/stats.json +0 -20
- package/dist/i18n/locales/en/subagent.json +0 -69
- package/dist/i18n/locales/en/superpowers.json +0 -117
- package/dist/i18n/locales/en/team.json +0 -7
- package/dist/i18n/locales/en/thinking.json +0 -65
- package/dist/i18n/locales/en/tools.json +0 -42
- package/dist/i18n/locales/en/uninstall.json +0 -56
- package/dist/i18n/locales/en/updater.json +0 -29
- package/dist/i18n/locales/en/vim.json +0 -169
- package/dist/i18n/locales/en/workflow.json +0 -55
- package/dist/i18n/locales/en/workspace.json +0 -108
- package/dist/i18n/locales/zh-CN/agent-teams.json +0 -18
- package/dist/i18n/locales/zh-CN/agentBrowser.json +0 -79
- package/dist/i18n/locales/zh-CN/agents.json +0 -135
- package/dist/i18n/locales/zh-CN/api.json +0 -63
- package/dist/i18n/locales/zh-CN/ccjk-agents.json +0 -33
- package/dist/i18n/locales/zh-CN/ccjk-all.json +0 -23
- package/dist/i18n/locales/zh-CN/ccjk-skills.json +0 -22
- package/dist/i18n/locales/zh-CN/ccjk.json +0 -276
- package/dist/i18n/locales/zh-CN/ccr.json +0 -65
- package/dist/i18n/locales/zh-CN/claude-md.json +0 -73
- package/dist/i18n/locales/zh-CN/cli.json +0 -152
- package/dist/i18n/locales/zh-CN/cloud-setup.json +0 -31
- package/dist/i18n/locales/zh-CN/cloud-sync.json +0 -147
- package/dist/i18n/locales/zh-CN/cloud.json +0 -40
- package/dist/i18n/locales/zh-CN/cloudPlugins.json +0 -118
- package/dist/i18n/locales/zh-CN/codex.json +0 -127
- package/dist/i18n/locales/zh-CN/cometix.json +0 -29
- package/dist/i18n/locales/zh-CN/common.json +0 -68
- package/dist/i18n/locales/zh-CN/config.json +0 -108
- package/dist/i18n/locales/zh-CN/configuration.json +0 -224
- package/dist/i18n/locales/zh-CN/context.json +0 -85
- package/dist/i18n/locales/zh-CN/dashboard.json +0 -78
- package/dist/i18n/locales/zh-CN/errors.json +0 -26
- package/dist/i18n/locales/zh-CN/evolution.json +0 -54
- package/dist/i18n/locales/zh-CN/hooks.json +0 -74
- package/dist/i18n/locales/zh-CN/hooksSync.json +0 -133
- package/dist/i18n/locales/zh-CN/installation.json +0 -83
- package/dist/i18n/locales/zh-CN/interview.json +0 -104
- package/dist/i18n/locales/zh-CN/language.json +0 -19
- package/dist/i18n/locales/zh-CN/lsp.json +0 -78
- package/dist/i18n/locales/zh-CN/marketplace.json +0 -116
- package/dist/i18n/locales/zh-CN/mcp.json +0 -178
- package/dist/i18n/locales/zh-CN/memory.json +0 -92
- package/dist/i18n/locales/zh-CN/menu.json +0 -143
- package/dist/i18n/locales/zh-CN/multi-config.json +0 -79
- package/dist/i18n/locales/zh-CN/notification.json +0 -307
- package/dist/i18n/locales/zh-CN/permissions.json +0 -95
- package/dist/i18n/locales/zh-CN/persistence.json +0 -127
- package/dist/i18n/locales/zh-CN/plugins.json +0 -146
- package/dist/i18n/locales/zh-CN/quick-actions.json +0 -78
- package/dist/i18n/locales/zh-CN/registry.json +0 -54
- package/dist/i18n/locales/zh-CN/remote.json +0 -93
- package/dist/i18n/locales/zh-CN/sandbox.json +0 -44
- package/dist/i18n/locales/zh-CN/setup.json +0 -44
- package/dist/i18n/locales/zh-CN/shencha.json +0 -14
- package/dist/i18n/locales/zh-CN/skills.json +0 -100
- package/dist/i18n/locales/zh-CN/skillsSync.json +0 -74
- package/dist/i18n/locales/zh-CN/smartGuide.json +0 -49
- package/dist/i18n/locales/zh-CN/stats.json +0 -20
- package/dist/i18n/locales/zh-CN/subagent.json +0 -69
- package/dist/i18n/locales/zh-CN/superpowers.json +0 -117
- package/dist/i18n/locales/zh-CN/team.json +0 -7
- package/dist/i18n/locales/zh-CN/thinking.json +0 -65
- package/dist/i18n/locales/zh-CN/tools.json +0 -42
- package/dist/i18n/locales/zh-CN/uninstall.json +0 -56
- package/dist/i18n/locales/zh-CN/updater.json +0 -29
- package/dist/i18n/locales/zh-CN/vim.json +0 -169
- package/dist/i18n/locales/zh-CN/workflow.json +0 -55
- package/dist/i18n/locales/zh-CN/workspace.json +0 -108
- package/dist/index.d.mts +0 -5295
- package/dist/index.d.ts +0 -5295
- package/dist/index.mjs +0 -4941
- package/dist/shared/ccjk.B364Fu0N.mjs +0 -1819
- package/dist/shared/ccjk.BAGoDD49.mjs +0 -36
- package/dist/shared/ccjk.BBtCGd_g.mjs +0 -899
- package/dist/shared/ccjk.BFQ7yr5S.mjs +0 -16
- package/dist/shared/ccjk.BFxsJM0k.mjs +0 -599
- package/dist/shared/ccjk.BIxuVL3_.mjs +0 -25
- package/dist/shared/ccjk.BRZ9ww8S.mjs +0 -142
- package/dist/shared/ccjk.BoApaI4j.mjs +0 -28
- package/dist/shared/ccjk.BrPUmTqm.mjs +0 -266
- package/dist/shared/ccjk.BtB1e5jm.mjs +0 -171
- package/dist/shared/ccjk.BwfbSKN2.mjs +0 -1051
- package/dist/shared/ccjk.BxSmJ8B7.mjs +0 -243
- package/dist/shared/ccjk.Bx_rmYfN.mjs +0 -69
- package/dist/shared/ccjk.C2jHOZVP.mjs +0 -52
- package/dist/shared/ccjk.CL4Yat0G.mjs +0 -303
- package/dist/shared/ccjk.COweQ1RR.mjs +0 -5
- package/dist/shared/ccjk.CePkJq2S.mjs +0 -223
- package/dist/shared/ccjk.CfKKcvWy.mjs +0 -126
- package/dist/shared/ccjk.Cjgrln_h.mjs +0 -297
- package/dist/shared/ccjk.Cjj8SVrn.mjs +0 -54
- package/dist/shared/ccjk.CxpGa6MC.mjs +0 -2724
- package/dist/shared/ccjk.D5MFQT7w.mjs +0 -400
- package/dist/shared/ccjk.D6ycHbak.mjs +0 -270
- package/dist/shared/ccjk.D8ZLYSZZ.mjs +0 -299
- package/dist/shared/ccjk.DG_o24cZ.mjs +0 -88
- package/dist/shared/ccjk.DLLw-h4Y.mjs +0 -460
- package/dist/shared/ccjk.DOwtZMk8.mjs +0 -4019
- package/dist/shared/ccjk.DS7UESmF.mjs +0 -2451
- package/dist/shared/ccjk.DTdjs-qK.mjs +0 -1447
- package/dist/shared/ccjk.DXRAZcix.mjs +0 -66
- package/dist/shared/ccjk.DsYaCCx4.mjs +0 -317
- package/dist/shared/ccjk.J8YiPsOw.mjs +0 -259
- package/dist/shared/ccjk.KfSWcGlE.mjs +0 -38
- package/dist/shared/ccjk.RyizuzOI.mjs +0 -21
- package/dist/shared/ccjk.SPoXMvZD.mjs +0 -1242
- package/dist/shared/ccjk.T_cX87dY.mjs +0 -15
- package/dist/shared/ccjk.UIvifqNE.mjs +0 -1486
- package/dist/shared/ccjk._dESH4Rk.mjs +0 -111
- package/dist/shared/ccjk.bQ7Dh1g4.mjs +0 -249
- package/dist/shared/ccjk.c-ETfBZ_.mjs +0 -617
- package/dist/shared/ccjk.gDEDGD_t.mjs +0 -38
- package/dist/shared/ccjk.hoqrwWdN.mjs +0 -333
- package/dist/shared/ccjk.waa2ikKJ.mjs +0 -351
package/dist/chunks/config3.mjs
DELETED
|
@@ -1,470 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import process__default from 'node:process';
|
|
3
|
-
import a from './index2.mjs';
|
|
4
|
-
import { i as inquirer } from './index3.mjs';
|
|
5
|
-
import { getApiProviderPresets } from './api-providers.mjs';
|
|
6
|
-
import { SETTINGS_FILE } from './constants.mjs';
|
|
7
|
-
import { i18n } from './index5.mjs';
|
|
8
|
-
import { b as backupExistingConfig } from './config.mjs';
|
|
9
|
-
import '../shared/ccjk.BAGoDD49.mjs';
|
|
10
|
-
import 'node:readline';
|
|
11
|
-
import 'stream';
|
|
12
|
-
import 'node:tty';
|
|
13
|
-
import 'node:async_hooks';
|
|
14
|
-
import '../shared/ccjk.Cjgrln_h.mjs';
|
|
15
|
-
import 'node:util';
|
|
16
|
-
import 'tty';
|
|
17
|
-
import 'fs';
|
|
18
|
-
import 'child_process';
|
|
19
|
-
import 'node:path';
|
|
20
|
-
import 'node:os';
|
|
21
|
-
import 'node:crypto';
|
|
22
|
-
import 'buffer';
|
|
23
|
-
import 'string_decoder';
|
|
24
|
-
import '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
25
|
-
import 'node:url';
|
|
26
|
-
import '../shared/ccjk.RyizuzOI.mjs';
|
|
27
|
-
import './claude-config.mjs';
|
|
28
|
-
import './json-config.mjs';
|
|
29
|
-
import './fs-operations.mjs';
|
|
30
|
-
import 'node:fs/promises';
|
|
31
|
-
import './platform.mjs';
|
|
32
|
-
import './main.mjs';
|
|
33
|
-
import 'module';
|
|
34
|
-
import 'node:child_process';
|
|
35
|
-
import 'node:stream';
|
|
36
|
-
import '../shared/ccjk.DXRAZcix.mjs';
|
|
37
|
-
|
|
38
|
-
async function getConfig(key, options = {}) {
|
|
39
|
-
const isZh = i18n.language === "zh-CN";
|
|
40
|
-
try {
|
|
41
|
-
const config = readClaudeConfig();
|
|
42
|
-
if (!config) {
|
|
43
|
-
console.log(a.yellow(isZh ? "\u26A0\uFE0F \u914D\u7F6E\u6587\u4EF6\u4E0D\u5B58\u5728" : "\u26A0\uFE0F Configuration file not found"));
|
|
44
|
-
console.log(a.dim(isZh ? '\u8FD0\u884C "ccjk init" \u521D\u59CB\u5316\u914D\u7F6E' : 'Run "ccjk init" to initialize configuration'));
|
|
45
|
-
console.log("");
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const value = getNestedValue(config, key);
|
|
49
|
-
if (value === void 0) {
|
|
50
|
-
console.log(a.yellow(isZh ? `\u26A0\uFE0F \u914D\u7F6E\u9879 "${key}" \u4E0D\u5B58\u5728` : `\u26A0\uFE0F Configuration key "${key}" not found`));
|
|
51
|
-
console.log("");
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
if (options.json) {
|
|
55
|
-
console.log(JSON.stringify(value, null, 2));
|
|
56
|
-
} else {
|
|
57
|
-
console.log("");
|
|
58
|
-
console.log(a.bold.cyan(isZh ? `\u{1F4CB} \u914D\u7F6E\u9879: ${key}` : `\u{1F4CB} Configuration: ${key}`));
|
|
59
|
-
console.log(a.dim("\u2500".repeat(60)));
|
|
60
|
-
console.log("");
|
|
61
|
-
displayValue(value, 0);
|
|
62
|
-
console.log("");
|
|
63
|
-
}
|
|
64
|
-
} catch (error) {
|
|
65
|
-
console.error(a.red(isZh ? "\u274C \u8BFB\u53D6\u914D\u7F6E\u5931\u8D25" : "\u274C Failed to read configuration"));
|
|
66
|
-
if (error instanceof Error) {
|
|
67
|
-
console.error(a.dim(error.message));
|
|
68
|
-
}
|
|
69
|
-
console.log("");
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
async function setConfig(key, value, _options = {}) {
|
|
73
|
-
const isZh = i18n.language === "zh-CN";
|
|
74
|
-
try {
|
|
75
|
-
const config = readClaudeConfig();
|
|
76
|
-
if (!config) {
|
|
77
|
-
console.log(a.yellow(isZh ? "\u26A0\uFE0F \u914D\u7F6E\u6587\u4EF6\u4E0D\u5B58\u5728" : "\u26A0\uFE0F Configuration file not found"));
|
|
78
|
-
console.log(a.dim(isZh ? '\u8FD0\u884C "ccjk init" \u521D\u59CB\u5316\u914D\u7F6E' : 'Run "ccjk init" to initialize configuration'));
|
|
79
|
-
console.log("");
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
const backupPath = backupExistingConfig();
|
|
83
|
-
if (backupPath) {
|
|
84
|
-
console.log(a.dim(isZh ? `\u{1F4E6} \u5DF2\u5907\u4EFD\u914D\u7F6E\u5230: ${backupPath}` : `\u{1F4E6} Configuration backed up to: ${backupPath}`));
|
|
85
|
-
}
|
|
86
|
-
let parsedValue = value;
|
|
87
|
-
try {
|
|
88
|
-
parsedValue = JSON.parse(value);
|
|
89
|
-
} catch {
|
|
90
|
-
}
|
|
91
|
-
setNestedValue(config, key, parsedValue);
|
|
92
|
-
writeClaudeConfig(config);
|
|
93
|
-
console.log("");
|
|
94
|
-
console.log(a.green(isZh ? `\u2705 \u914D\u7F6E\u9879 "${key}" \u5DF2\u66F4\u65B0` : `\u2705 Configuration "${key}" updated`));
|
|
95
|
-
console.log("");
|
|
96
|
-
console.log(a.bold(isZh ? "\u65B0\u503C:" : "New value:"));
|
|
97
|
-
displayValue(parsedValue, 0);
|
|
98
|
-
console.log("");
|
|
99
|
-
} catch (error) {
|
|
100
|
-
console.error(a.red(isZh ? "\u274C \u8BBE\u7F6E\u914D\u7F6E\u5931\u8D25" : "\u274C Failed to set configuration"));
|
|
101
|
-
if (error instanceof Error) {
|
|
102
|
-
console.error(a.dim(error.message));
|
|
103
|
-
}
|
|
104
|
-
console.log("");
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
async function listConfig(options = {}) {
|
|
108
|
-
const isZh = i18n.language === "zh-CN";
|
|
109
|
-
try {
|
|
110
|
-
const config = readClaudeConfig();
|
|
111
|
-
if (!config) {
|
|
112
|
-
console.log(a.yellow(isZh ? "\u26A0\uFE0F \u914D\u7F6E\u6587\u4EF6\u4E0D\u5B58\u5728" : "\u26A0\uFE0F Configuration file not found"));
|
|
113
|
-
console.log(a.dim(isZh ? '\u8FD0\u884C "ccjk init" \u521D\u59CB\u5316\u914D\u7F6E' : 'Run "ccjk init" to initialize configuration'));
|
|
114
|
-
console.log("");
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
if (options.json) {
|
|
118
|
-
console.log(JSON.stringify(config, null, 2));
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
console.log("");
|
|
122
|
-
console.log(a.bold.cyan(isZh ? "\u{1F4CB} Claude Code \u914D\u7F6E" : "\u{1F4CB} Claude Code Configuration"));
|
|
123
|
-
console.log(a.dim("\u2500".repeat(60)));
|
|
124
|
-
console.log("");
|
|
125
|
-
displayConfigSection(isZh ? "API \u914D\u7F6E" : "API Configuration", {
|
|
126
|
-
baseUrl: config.baseUrl,
|
|
127
|
-
apiKey: config.apiKey ? "***" : void 0,
|
|
128
|
-
authToken: config.authToken ? "***" : void 0,
|
|
129
|
-
model: config.model,
|
|
130
|
-
fastModel: config.fastModel
|
|
131
|
-
}, isZh);
|
|
132
|
-
if (config.mcpServers && Object.keys(config.mcpServers).length > 0) {
|
|
133
|
-
displayConfigSection(isZh ? "MCP \u670D\u52A1" : "MCP Services", {
|
|
134
|
-
count: Object.keys(config.mcpServers).length,
|
|
135
|
-
services: Object.keys(config.mcpServers)
|
|
136
|
-
}, isZh);
|
|
137
|
-
}
|
|
138
|
-
if (config.customInstructions) {
|
|
139
|
-
displayConfigSection(isZh ? "\u81EA\u5B9A\u4E49\u6307\u4EE4" : "Custom Instructions", {
|
|
140
|
-
length: config.customInstructions.length,
|
|
141
|
-
preview: `${config.customInstructions.substring(0, 100)}...`
|
|
142
|
-
}, isZh);
|
|
143
|
-
}
|
|
144
|
-
console.log("");
|
|
145
|
-
console.log(a.dim("\u2500".repeat(60)));
|
|
146
|
-
console.log(a.dim(isZh ? `\u914D\u7F6E\u6587\u4EF6: ${SETTINGS_FILE}` : `Config file: ${SETTINGS_FILE}`));
|
|
147
|
-
console.log("");
|
|
148
|
-
} catch (error) {
|
|
149
|
-
console.error(a.red(isZh ? "\u274C \u8BFB\u53D6\u914D\u7F6E\u5931\u8D25" : "\u274C Failed to read configuration"));
|
|
150
|
-
if (error instanceof Error) {
|
|
151
|
-
console.error(a.dim(error.message));
|
|
152
|
-
}
|
|
153
|
-
console.log("");
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
async function resetConfig(_options = {}) {
|
|
157
|
-
const isZh = i18n.language === "zh-CN";
|
|
158
|
-
try {
|
|
159
|
-
const config = readClaudeConfig();
|
|
160
|
-
if (!config) {
|
|
161
|
-
console.log(a.yellow(isZh ? "\u26A0\uFE0F \u914D\u7F6E\u6587\u4EF6\u4E0D\u5B58\u5728" : "\u26A0\uFE0F Configuration file not found"));
|
|
162
|
-
console.log("");
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
const { confirm } = await inquirer.prompt({
|
|
166
|
-
type: "confirm",
|
|
167
|
-
name: "confirm",
|
|
168
|
-
message: isZh ? "\u786E\u5B9A\u8981\u91CD\u7F6E\u914D\u7F6E\u5417\uFF1F\u8FD9\u5C06\u5220\u9664\u6240\u6709\u81EA\u5B9A\u4E49\u8BBE\u7F6E\u3002" : "Are you sure you want to reset configuration? This will remove all custom settings.",
|
|
169
|
-
default: false
|
|
170
|
-
});
|
|
171
|
-
if (!confirm) {
|
|
172
|
-
console.log(a.yellow(isZh ? "\u5DF2\u53D6\u6D88" : "Cancelled"));
|
|
173
|
-
console.log("");
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
const backupPath = backupExistingConfig();
|
|
177
|
-
if (backupPath) {
|
|
178
|
-
console.log(a.dim(isZh ? `\u{1F4E6} \u5DF2\u5907\u4EFD\u914D\u7F6E\u5230: ${backupPath}` : `\u{1F4E6} Configuration backed up to: ${backupPath}`));
|
|
179
|
-
}
|
|
180
|
-
const minimalConfig = {
|
|
181
|
-
completedOnboarding: true
|
|
182
|
-
};
|
|
183
|
-
writeClaudeConfig(minimalConfig);
|
|
184
|
-
console.log("");
|
|
185
|
-
console.log(a.green(isZh ? "\u2705 \u914D\u7F6E\u5DF2\u91CD\u7F6E" : "\u2705 Configuration reset"));
|
|
186
|
-
console.log(a.dim(isZh ? '\u8FD0\u884C "ccjk init" \u91CD\u65B0\u914D\u7F6E' : 'Run "ccjk init" to reconfigure'));
|
|
187
|
-
console.log("");
|
|
188
|
-
} catch (error) {
|
|
189
|
-
console.error(a.red(isZh ? "\u274C \u91CD\u7F6E\u914D\u7F6E\u5931\u8D25" : "\u274C Failed to reset configuration"));
|
|
190
|
-
if (error instanceof Error) {
|
|
191
|
-
console.error(a.dim(error.message));
|
|
192
|
-
}
|
|
193
|
-
console.log("");
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
async function setProvider(providerId, options = {}) {
|
|
197
|
-
const isZh = i18n.language === "zh-CN";
|
|
198
|
-
const codeType = options.codeType || "claude-code";
|
|
199
|
-
try {
|
|
200
|
-
const providers = await getApiProviderPresets(codeType);
|
|
201
|
-
const provider = providers.find((p) => p.id === providerId);
|
|
202
|
-
if (!provider) {
|
|
203
|
-
console.log(a.yellow(isZh ? `\u26A0\uFE0F \u4F9B\u5E94\u5546 "${providerId}" \u4E0D\u5B58\u5728` : `\u26A0\uFE0F Provider "${providerId}" not found`));
|
|
204
|
-
console.log("");
|
|
205
|
-
console.log(a.dim(isZh ? "\u53EF\u7528\u7684\u4F9B\u5E94\u5546:" : "Available providers:"));
|
|
206
|
-
for (const p of providers) {
|
|
207
|
-
console.log(` - ${p.id} (${p.name})`);
|
|
208
|
-
}
|
|
209
|
-
console.log("");
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
const config = readClaudeConfig();
|
|
213
|
-
if (!config) {
|
|
214
|
-
console.log(a.yellow(isZh ? "\u26A0\uFE0F \u914D\u7F6E\u6587\u4EF6\u4E0D\u5B58\u5728" : "\u26A0\uFE0F Configuration file not found"));
|
|
215
|
-
console.log(a.dim(isZh ? '\u8FD0\u884C "ccjk init" \u521D\u59CB\u5316\u914D\u7F6E' : 'Run "ccjk init" to initialize configuration'));
|
|
216
|
-
console.log("");
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
const backupPath = backupExistingConfig();
|
|
220
|
-
if (backupPath) {
|
|
221
|
-
console.log(a.dim(isZh ? `\u{1F4E6} \u5DF2\u5907\u4EFD\u914D\u7F6E\u5230: ${backupPath}` : `\u{1F4E6} Configuration backed up to: ${backupPath}`));
|
|
222
|
-
}
|
|
223
|
-
if (codeType === "claude-code" && provider.claudeCode) {
|
|
224
|
-
config.baseUrl = provider.claudeCode.baseUrl;
|
|
225
|
-
if (provider.claudeCode.defaultModels && provider.claudeCode.defaultModels.length > 0) {
|
|
226
|
-
config.model = provider.claudeCode.defaultModels[0];
|
|
227
|
-
if (provider.claudeCode.defaultModels.length > 1) {
|
|
228
|
-
config.fastModel = provider.claudeCode.defaultModels[1];
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
writeClaudeConfig(config);
|
|
233
|
-
console.log("");
|
|
234
|
-
console.log(a.green(isZh ? `\u2705 \u5DF2\u5207\u6362\u5230\u4F9B\u5E94\u5546: ${provider.name}` : `\u2705 Switched to provider: ${provider.name}`));
|
|
235
|
-
console.log("");
|
|
236
|
-
console.log(a.bold(isZh ? "\u914D\u7F6E\u8BE6\u60C5:" : "Configuration details:"));
|
|
237
|
-
console.log(` ${a.green(isZh ? "\u4F9B\u5E94\u5546" : "Provider")}: ${provider.name}`);
|
|
238
|
-
console.log(` ${a.green(isZh ? "\u63A5\u53E3\u5730\u5740" : "Base URL")}: ${config.baseUrl}`);
|
|
239
|
-
if (config.model) {
|
|
240
|
-
console.log(` ${a.green(isZh ? "\u4E3B\u6A21\u578B" : "Primary Model")}: ${config.model}`);
|
|
241
|
-
}
|
|
242
|
-
if (config.fastModel) {
|
|
243
|
-
console.log(` ${a.green(isZh ? "\u5FEB\u901F\u6A21\u578B" : "Fast Model")}: ${config.fastModel}`);
|
|
244
|
-
}
|
|
245
|
-
console.log("");
|
|
246
|
-
console.log(a.dim(isZh ? "\u{1F4A1} \u63D0\u793A: \u8BF7\u786E\u4FDD\u5DF2\u8BBE\u7F6E\u6B63\u786E\u7684 API \u5BC6\u94A5\u6216\u8BA4\u8BC1\u4EE4\u724C" : "\u{1F4A1} Tip: Make sure to set the correct API key or auth token"));
|
|
247
|
-
console.log("");
|
|
248
|
-
} catch (error) {
|
|
249
|
-
console.error(a.red(isZh ? "\u274C \u8BBE\u7F6E\u4F9B\u5E94\u5546\u5931\u8D25" : "\u274C Failed to set provider"));
|
|
250
|
-
if (error instanceof Error) {
|
|
251
|
-
console.error(a.dim(error.message));
|
|
252
|
-
}
|
|
253
|
-
console.log("");
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
async function configCommand(action, args, options = {}) {
|
|
257
|
-
switch (action) {
|
|
258
|
-
case "get":
|
|
259
|
-
if (args.length === 0) {
|
|
260
|
-
const isZh = i18n.language === "zh-CN";
|
|
261
|
-
console.log(a.yellow(isZh ? "\u26A0\uFE0F \u8BF7\u6307\u5B9A\u914D\u7F6E\u9879" : "\u26A0\uFE0F Please specify a configuration key"));
|
|
262
|
-
console.log(a.dim(isZh ? "\u7528\u6CD5: ccjk config get <key>" : "Usage: ccjk config get <key>"));
|
|
263
|
-
console.log("");
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
await getConfig(args[0], options);
|
|
267
|
-
break;
|
|
268
|
-
case "set":
|
|
269
|
-
if (args.length < 2) {
|
|
270
|
-
const isZh = i18n.language === "zh-CN";
|
|
271
|
-
console.log(a.yellow(isZh ? "\u26A0\uFE0F \u8BF7\u6307\u5B9A\u914D\u7F6E\u9879\u548C\u503C" : "\u26A0\uFE0F Please specify key and value"));
|
|
272
|
-
console.log(a.dim(isZh ? "\u7528\u6CD5: ccjk config set <key> <value>" : "Usage: ccjk config set <key> <value>"));
|
|
273
|
-
console.log("");
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
await setConfig(args[0], args.slice(1).join(" "), options);
|
|
277
|
-
break;
|
|
278
|
-
case "list":
|
|
279
|
-
case "ls":
|
|
280
|
-
await listConfig(options);
|
|
281
|
-
break;
|
|
282
|
-
case "reset":
|
|
283
|
-
await resetConfig(options);
|
|
284
|
-
break;
|
|
285
|
-
case "provider":
|
|
286
|
-
if (args.length === 0) {
|
|
287
|
-
const isZh = i18n.language === "zh-CN";
|
|
288
|
-
console.log(a.yellow(isZh ? "\u26A0\uFE0F \u8BF7\u6307\u5B9A\u4F9B\u5E94\u5546 ID" : "\u26A0\uFE0F Please specify provider ID"));
|
|
289
|
-
console.log(a.dim(isZh ? "\u7528\u6CD5: ccjk config provider <id>" : "Usage: ccjk config provider <id>"));
|
|
290
|
-
console.log("");
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
await setProvider(args[0], options);
|
|
294
|
-
break;
|
|
295
|
-
default: {
|
|
296
|
-
const isZh = i18n.language === "zh-CN";
|
|
297
|
-
console.log("");
|
|
298
|
-
console.log(a.bold.cyan(isZh ? "\u2699\uFE0F \u914D\u7F6E\u7BA1\u7406\u547D\u4EE4" : "\u2699\uFE0F Configuration Management Commands"));
|
|
299
|
-
console.log("");
|
|
300
|
-
console.log(` ${a.green("ccjk config get <key>")} ${isZh ? "\u83B7\u53D6\u914D\u7F6E\u9879" : "Get configuration value"}`);
|
|
301
|
-
console.log(` ${a.green("ccjk config set <key> <value>")} ${isZh ? "\u8BBE\u7F6E\u914D\u7F6E\u9879" : "Set configuration value"}`);
|
|
302
|
-
console.log(` ${a.green("ccjk config list")} ${isZh ? "\u5217\u51FA\u6240\u6709\u914D\u7F6E" : "List all configuration"}`);
|
|
303
|
-
console.log(` ${a.green("ccjk config reset")} ${isZh ? "\u91CD\u7F6E\u914D\u7F6E" : "Reset configuration"}`);
|
|
304
|
-
console.log(` ${a.green("ccjk config provider <id>")} ${isZh ? "\u5207\u6362\u4F9B\u5E94\u5546" : "Switch provider"}`);
|
|
305
|
-
console.log("");
|
|
306
|
-
console.log(a.bold(isZh ? "\u9009\u9879" : "Options"));
|
|
307
|
-
console.log(` ${a.green("--code-type, -T")} <type> ${isZh ? "\u4EE3\u7801\u5DE5\u5177\u7C7B\u578B (claude-code, codex)" : "Code tool type (claude-code, codex)"}`);
|
|
308
|
-
console.log(` ${a.green("--json, -j")} ${isZh ? "JSON \u683C\u5F0F\u8F93\u51FA" : "JSON format output"}`);
|
|
309
|
-
console.log("");
|
|
310
|
-
console.log(a.bold(isZh ? "\u793A\u4F8B" : "Examples"));
|
|
311
|
-
console.log(` ${a.dim("ccjk config get baseUrl")}`);
|
|
312
|
-
console.log(` ${a.dim('ccjk config set model "claude-3-5-sonnet-20241022"')}`);
|
|
313
|
-
console.log(` ${a.dim("ccjk config provider glm")}`);
|
|
314
|
-
console.log("");
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
function getClaudeConfigPath() {
|
|
319
|
-
return SETTINGS_FILE;
|
|
320
|
-
}
|
|
321
|
-
function readClaudeConfig() {
|
|
322
|
-
if (!existsSync(SETTINGS_FILE)) {
|
|
323
|
-
return null;
|
|
324
|
-
}
|
|
325
|
-
try {
|
|
326
|
-
const content = readFileSync(SETTINGS_FILE, "utf-8");
|
|
327
|
-
return JSON.parse(content);
|
|
328
|
-
} catch {
|
|
329
|
-
return null;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
function writeClaudeConfig(config) {
|
|
333
|
-
writeFileSync(SETTINGS_FILE, JSON.stringify(config, null, 2), "utf-8");
|
|
334
|
-
}
|
|
335
|
-
function getNestedValue(obj, path) {
|
|
336
|
-
const keys = path.split(".");
|
|
337
|
-
let current = obj;
|
|
338
|
-
for (const key of keys) {
|
|
339
|
-
if (current === null || current === void 0) {
|
|
340
|
-
return void 0;
|
|
341
|
-
}
|
|
342
|
-
current = current[key];
|
|
343
|
-
}
|
|
344
|
-
return current;
|
|
345
|
-
}
|
|
346
|
-
function setNestedValue(obj, path, value) {
|
|
347
|
-
const keys = path.split(".");
|
|
348
|
-
let current = obj;
|
|
349
|
-
for (let i = 0; i < keys.length - 1; i++) {
|
|
350
|
-
const key = keys[i];
|
|
351
|
-
if (!(key in current) || typeof current[key] !== "object") {
|
|
352
|
-
current[key] = {};
|
|
353
|
-
}
|
|
354
|
-
current = current[key];
|
|
355
|
-
}
|
|
356
|
-
current[keys[keys.length - 1]] = value;
|
|
357
|
-
}
|
|
358
|
-
function displayValue(value, indent) {
|
|
359
|
-
const prefix = " ".repeat(indent);
|
|
360
|
-
if (value === null) {
|
|
361
|
-
console.log(`${prefix}${a.dim("null")}`);
|
|
362
|
-
} else if (typeof value === "boolean") {
|
|
363
|
-
console.log(`${prefix}${a.green(value.toString())}`);
|
|
364
|
-
} else if (typeof value === "number") {
|
|
365
|
-
console.log(`${prefix}${a.yellow(value.toString())}`);
|
|
366
|
-
} else if (typeof value === "string") {
|
|
367
|
-
console.log(`${prefix}${a.green(value)}`);
|
|
368
|
-
} else if (Array.isArray(value)) {
|
|
369
|
-
console.log(`${prefix}${a.dim("[")}`);
|
|
370
|
-
for (const item of value) {
|
|
371
|
-
displayValue(item, indent + 1);
|
|
372
|
-
}
|
|
373
|
-
console.log(`${prefix}${a.dim("]")}`);
|
|
374
|
-
} else if (typeof value === "object") {
|
|
375
|
-
for (const [key, val] of Object.entries(value)) {
|
|
376
|
-
console.log(`${prefix}${a.bold(key)}:`);
|
|
377
|
-
displayValue(val, indent + 1);
|
|
378
|
-
}
|
|
379
|
-
} else {
|
|
380
|
-
console.log(`${prefix}${value}`);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
function displayConfigSection(title, data, _isZh) {
|
|
384
|
-
console.log(a.bold(title));
|
|
385
|
-
console.log("");
|
|
386
|
-
for (const [key, value] of Object.entries(data)) {
|
|
387
|
-
if (value !== void 0) {
|
|
388
|
-
if (Array.isArray(value)) {
|
|
389
|
-
console.log(` ${a.green(key)}: ${value.join(", ")}`);
|
|
390
|
-
} else {
|
|
391
|
-
console.log(` ${a.green(key)}: ${value}`);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
console.log("");
|
|
396
|
-
}
|
|
397
|
-
async function unsetConfig(key, _options = {}) {
|
|
398
|
-
const isZh = i18n.language === "zh-CN";
|
|
399
|
-
if (!key) {
|
|
400
|
-
console.log(a.yellow(isZh ? "\u26A0\uFE0F \u8BF7\u6307\u5B9A\u914D\u7F6E\u9879" : "\u26A0\uFE0F Please specify a configuration key"));
|
|
401
|
-
return;
|
|
402
|
-
}
|
|
403
|
-
const config = readClaudeConfig();
|
|
404
|
-
const keys = key.split(".");
|
|
405
|
-
let current = config;
|
|
406
|
-
for (let i = 0; i < keys.length - 1; i++) {
|
|
407
|
-
if (current[keys[i]] === void 0) {
|
|
408
|
-
console.log(a.yellow(isZh ? `\u26A0\uFE0F \u914D\u7F6E\u9879 "${key}" \u4E0D\u5B58\u5728` : `\u26A0\uFE0F Configuration key "${key}" does not exist`));
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
411
|
-
current = current[keys[i]];
|
|
412
|
-
}
|
|
413
|
-
const lastKey = keys[keys.length - 1];
|
|
414
|
-
if (current[lastKey] === void 0) {
|
|
415
|
-
console.log(a.yellow(isZh ? `\u26A0\uFE0F \u914D\u7F6E\u9879 "${key}" \u4E0D\u5B58\u5728` : `\u26A0\uFE0F Configuration key "${key}" does not exist`));
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
|
-
delete current[lastKey];
|
|
419
|
-
writeClaudeConfig(config);
|
|
420
|
-
console.log(a.green(isZh ? `\u2705 \u5DF2\u5220\u9664\u914D\u7F6E\u9879: ${key}` : `\u2705 Removed configuration: ${key}`));
|
|
421
|
-
}
|
|
422
|
-
async function editConfig(_options = {}) {
|
|
423
|
-
const isZh = i18n.language === "zh-CN";
|
|
424
|
-
const configPath = getClaudeConfigPath();
|
|
425
|
-
const editor = process__default.env.EDITOR || process__default.env.VISUAL || "vi";
|
|
426
|
-
console.log(a.green(isZh ? `\u{1F4DD} \u6B63\u5728\u6253\u5F00\u914D\u7F6E\u6587\u4EF6: ${configPath}` : `\u{1F4DD} Opening config file: ${configPath}`));
|
|
427
|
-
const { spawn } = await import('node:child_process');
|
|
428
|
-
const child = spawn(editor, [configPath], { stdio: "inherit" });
|
|
429
|
-
child.on("exit", (code) => {
|
|
430
|
-
if (code === 0) {
|
|
431
|
-
console.log(a.green(isZh ? "\u2705 \u914D\u7F6E\u6587\u4EF6\u5DF2\u4FDD\u5B58" : "\u2705 Config file saved"));
|
|
432
|
-
}
|
|
433
|
-
});
|
|
434
|
-
}
|
|
435
|
-
async function validateConfig(_options = {}) {
|
|
436
|
-
const isZh = i18n.language === "zh-CN";
|
|
437
|
-
console.log(a.green(isZh ? "\u{1F50D} \u6B63\u5728\u9A8C\u8BC1\u914D\u7F6E..." : "\u{1F50D} Validating configuration..."));
|
|
438
|
-
console.log("");
|
|
439
|
-
const config = readClaudeConfig();
|
|
440
|
-
const errors = [];
|
|
441
|
-
const warnings = [];
|
|
442
|
-
if (!config.apiKey) {
|
|
443
|
-
errors.push(isZh ? "apiKey \u672A\u8BBE\u7F6E" : "apiKey is not set");
|
|
444
|
-
}
|
|
445
|
-
if (!config.baseUrl) {
|
|
446
|
-
warnings.push(isZh ? "baseUrl \u672A\u8BBE\u7F6E\uFF0C\u5C06\u4F7F\u7528\u9ED8\u8BA4\u503C" : "baseUrl is not set, will use default");
|
|
447
|
-
}
|
|
448
|
-
if (config.model && typeof config.model !== "string") {
|
|
449
|
-
errors.push(isZh ? "model \u683C\u5F0F\u65E0\u6548" : "model format is invalid");
|
|
450
|
-
}
|
|
451
|
-
if (errors.length === 0 && warnings.length === 0) {
|
|
452
|
-
console.log(a.green(isZh ? "\u2705 \u914D\u7F6E\u9A8C\u8BC1\u901A\u8FC7" : "\u2705 Configuration is valid"));
|
|
453
|
-
} else {
|
|
454
|
-
if (errors.length > 0) {
|
|
455
|
-
console.log(a.red(isZh ? "\u274C \u9519\u8BEF:" : "\u274C Errors:"));
|
|
456
|
-
for (const error of errors) {
|
|
457
|
-
console.log(a.red(` \u2022 ${error}`));
|
|
458
|
-
}
|
|
459
|
-
console.log("");
|
|
460
|
-
}
|
|
461
|
-
if (warnings.length > 0) {
|
|
462
|
-
console.log(a.yellow(isZh ? "\u26A0\uFE0F \u8B66\u544A:" : "\u26A0\uFE0F Warnings:"));
|
|
463
|
-
for (const warning of warnings) {
|
|
464
|
-
console.log(a.yellow(` \u2022 ${warning}`));
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
export { configCommand, editConfig, getConfig, listConfig, resetConfig, setConfig, setProvider, unsetConfig, validateConfig };
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { homedir } from 'node:os';
|
|
2
|
-
import { i18n } from './index5.mjs';
|
|
3
|
-
import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
4
|
-
import 'node:fs';
|
|
5
|
-
import 'node:process';
|
|
6
|
-
import 'node:url';
|
|
7
|
-
|
|
8
|
-
const CLAUDE_DIR = join(homedir(), ".claude");
|
|
9
|
-
const SETTINGS_FILE = join(CLAUDE_DIR, "settings.json");
|
|
10
|
-
join(CLAUDE_DIR, "CLAUDE.md");
|
|
11
|
-
const CLAUDE_AGENTS_DIR = join(CLAUDE_DIR, "agents");
|
|
12
|
-
const ClAUDE_CONFIG_FILE = join(homedir(), ".claude.json");
|
|
13
|
-
const CLAUDE_VSC_CONFIG_FILE = join(CLAUDE_DIR, "config.json");
|
|
14
|
-
const CODEX_DIR = join(homedir(), ".codex");
|
|
15
|
-
const CODEX_CONFIG_FILE = join(CODEX_DIR, "config.toml");
|
|
16
|
-
const CODEX_AUTH_FILE = join(CODEX_DIR, "auth.json");
|
|
17
|
-
const CODEX_AGENTS_FILE = join(CODEX_DIR, "AGENTS.md");
|
|
18
|
-
const CODEX_PROMPTS_DIR = join(CODEX_DIR, "prompts");
|
|
19
|
-
const AIDER_DIR = join(homedir(), ".aider");
|
|
20
|
-
join(AIDER_DIR, ".aider.conf.yml");
|
|
21
|
-
join(AIDER_DIR, ".env");
|
|
22
|
-
const CONTINUE_DIR = join(homedir(), ".continue");
|
|
23
|
-
join(CONTINUE_DIR, "config.json");
|
|
24
|
-
const CLINE_DIR = join(homedir(), ".cline");
|
|
25
|
-
join(CLINE_DIR, "config.json");
|
|
26
|
-
const CURSOR_DIR = join(homedir(), ".cursor");
|
|
27
|
-
join(CURSOR_DIR, "config.json");
|
|
28
|
-
const CCJK_CONFIG_DIR = join(homedir(), ".ccjk");
|
|
29
|
-
const CCJK_CONFIG_FILE = join(CCJK_CONFIG_DIR, "config.toml");
|
|
30
|
-
join(CCJK_CONFIG_DIR, "state.json");
|
|
31
|
-
const CCJK_PLUGINS_DIR = join(CCJK_CONFIG_DIR, "plugins");
|
|
32
|
-
const CCJK_SKILLS_DIR = join(CLAUDE_DIR, "skills");
|
|
33
|
-
join(CCJK_CONFIG_DIR, "groups");
|
|
34
|
-
const CCJK_CLOUD_PLUGINS_DIR = join(CCJK_CONFIG_DIR, "cloud-plugins");
|
|
35
|
-
const CCJK_CLOUD_PLUGINS_CACHE_DIR = join(CCJK_CLOUD_PLUGINS_DIR, "cache");
|
|
36
|
-
join(CCJK_CLOUD_PLUGINS_CACHE_DIR, "plugins.json");
|
|
37
|
-
const CCJK_CLOUD_PLUGINS_INSTALLED_DIR = join(CCJK_CLOUD_PLUGINS_DIR, "installed");
|
|
38
|
-
const CLOUD_ENDPOINTS = {
|
|
39
|
-
/**
|
|
40
|
-
* Main API - Core cloud services
|
|
41
|
-
* Used for: project analysis, templates, telemetry
|
|
42
|
-
*/
|
|
43
|
-
MAIN: {
|
|
44
|
-
BASE_URL: "https://api.claudehome.cn",
|
|
45
|
-
API_VERSION: "/api/v1"
|
|
46
|
-
},
|
|
47
|
-
/**
|
|
48
|
-
* Plugins API - Marketplace and cloud plugins
|
|
49
|
-
* Used for: plugin discovery, installation, ratings
|
|
50
|
-
*/
|
|
51
|
-
PLUGINS: {
|
|
52
|
-
BASE_URL: "https://api.api.claudehome.cn",
|
|
53
|
-
API_VERSION: "/v1"
|
|
54
|
-
},
|
|
55
|
-
/**
|
|
56
|
-
* Remote API - Real-time features
|
|
57
|
-
* Used for: notifications, WebSocket connections
|
|
58
|
-
*/
|
|
59
|
-
REMOTE: {
|
|
60
|
-
BASE_URL: "https://remote-api.claudehome.cn",
|
|
61
|
-
API_VERSION: ""
|
|
62
|
-
// No version prefix for remote API
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
function getCloudApiUrl(endpoint) {
|
|
66
|
-
const config = CLOUD_ENDPOINTS[endpoint];
|
|
67
|
-
return `${config.BASE_URL}${config.API_VERSION}`;
|
|
68
|
-
}
|
|
69
|
-
const CCJK_CLOUD_API_URL = getCloudApiUrl("PLUGINS");
|
|
70
|
-
const LEGACY_ZCF_CONFIG_DIR = join(homedir(), ".ufomiao", "zcf");
|
|
71
|
-
const LEGACY_ZCF_CONFIG_FILE = join(LEGACY_ZCF_CONFIG_DIR, "config.toml");
|
|
72
|
-
const LEGACY_ZCF_CONFIG_FILES = [
|
|
73
|
-
join(CLAUDE_DIR, ".zcf-config.json"),
|
|
74
|
-
join(homedir(), ".zcf.json"),
|
|
75
|
-
LEGACY_ZCF_CONFIG_FILE
|
|
76
|
-
];
|
|
77
|
-
const ZCF_CONFIG_DIR = CCJK_CONFIG_DIR;
|
|
78
|
-
const ZCF_CONFIG_FILE = CCJK_CONFIG_FILE;
|
|
79
|
-
const CODE_TOOL_TYPES = ["claude-code", "codex", "aider", "continue", "cline", "cursor"];
|
|
80
|
-
const DEFAULT_CODE_TOOL_TYPE = "claude-code";
|
|
81
|
-
const CODE_TOOL_BANNERS = {
|
|
82
|
-
"claude-code": "for Claude Code",
|
|
83
|
-
"codex": "for Codex",
|
|
84
|
-
"aider": "for Aider",
|
|
85
|
-
"continue": "for Continue",
|
|
86
|
-
"cline": "for Cline",
|
|
87
|
-
"cursor": "for Cursor CLI"
|
|
88
|
-
};
|
|
89
|
-
const CODE_TOOL_ALIASES = {
|
|
90
|
-
cc: "claude-code",
|
|
91
|
-
cx: "codex",
|
|
92
|
-
ad: "aider",
|
|
93
|
-
ct: "continue",
|
|
94
|
-
cl: "cline",
|
|
95
|
-
cu: "cursor"
|
|
96
|
-
};
|
|
97
|
-
function isCodeToolType(value) {
|
|
98
|
-
return CODE_TOOL_TYPES.includes(value);
|
|
99
|
-
}
|
|
100
|
-
const API_DEFAULT_URL = "https://api.anthropic.com";
|
|
101
|
-
function resolveCodeToolType(value) {
|
|
102
|
-
if (isCodeToolType(value)) {
|
|
103
|
-
return value;
|
|
104
|
-
}
|
|
105
|
-
if (typeof value === "string" && value in CODE_TOOL_ALIASES) {
|
|
106
|
-
return CODE_TOOL_ALIASES[value];
|
|
107
|
-
}
|
|
108
|
-
return DEFAULT_CODE_TOOL_TYPE;
|
|
109
|
-
}
|
|
110
|
-
const SUPPORTED_LANGS = ["zh-CN", "en"];
|
|
111
|
-
const LANG_LABELS = {
|
|
112
|
-
"zh-CN": "\u7B80\u4F53\u4E2D\u6587",
|
|
113
|
-
"en": "English"
|
|
114
|
-
};
|
|
115
|
-
const AI_OUTPUT_LANGUAGES = {
|
|
116
|
-
"zh-CN": { directive: "Always respond in Chinese-simplified" },
|
|
117
|
-
"en": { directive: "Always respond in English" },
|
|
118
|
-
"custom": { directive: "" }
|
|
119
|
-
};
|
|
120
|
-
function getAiOutputLanguageLabel(lang) {
|
|
121
|
-
if (lang in LANG_LABELS) {
|
|
122
|
-
return LANG_LABELS[lang];
|
|
123
|
-
}
|
|
124
|
-
if (lang === "custom" && i18n?.isInitialized) {
|
|
125
|
-
try {
|
|
126
|
-
return i18n.t("language:labels.custom");
|
|
127
|
-
} catch {
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return lang;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export { AIDER_DIR, AI_OUTPUT_LANGUAGES, API_DEFAULT_URL, CCJK_CLOUD_API_URL, CCJK_CLOUD_PLUGINS_CACHE_DIR, CCJK_CLOUD_PLUGINS_DIR, CCJK_CLOUD_PLUGINS_INSTALLED_DIR, CCJK_CONFIG_DIR, CCJK_CONFIG_FILE, CCJK_PLUGINS_DIR, CCJK_SKILLS_DIR, CLAUDE_AGENTS_DIR, CLAUDE_DIR, CLAUDE_VSC_CONFIG_FILE, CLINE_DIR, CLOUD_ENDPOINTS, CODEX_AGENTS_FILE, CODEX_AUTH_FILE, CODEX_CONFIG_FILE, CODEX_DIR, CODEX_PROMPTS_DIR, CODE_TOOL_ALIASES, CODE_TOOL_BANNERS, CODE_TOOL_TYPES, CONTINUE_DIR, CURSOR_DIR, ClAUDE_CONFIG_FILE, DEFAULT_CODE_TOOL_TYPE, LANG_LABELS, LEGACY_ZCF_CONFIG_DIR, LEGACY_ZCF_CONFIG_FILE, LEGACY_ZCF_CONFIG_FILES, SETTINGS_FILE, SUPPORTED_LANGS, ZCF_CONFIG_DIR, ZCF_CONFIG_FILE, getAiOutputLanguageLabel, getCloudApiUrl, isCodeToolType, resolveCodeToolType };
|