ccjk 9.3.6 → 9.3.7

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.
@@ -22,28 +22,28 @@ import './json-config.mjs';
22
22
  import 'dayjs';
23
23
  import '../shared/ccjk.SIo9I8q3.mjs';
24
24
  import './features.mjs';
25
- import './config2.mjs';
26
- import 'node:child_process';
27
- import 'node:util';
25
+ import './config.mjs';
28
26
  import './claude-config.mjs';
29
27
  import './platform.mjs';
30
28
  import 'tinyexec';
31
- import './config.mjs';
29
+ import '../shared/ccjk.KfIN1Sqj.mjs';
30
+ import '../shared/ccjk.BFQ7yr5S.mjs';
32
31
  import '../shared/ccjk.DHbrGcgg.mjs';
33
32
  import 'inquirer-toggle';
33
+ import './workflows.mjs';
34
+ import './ccu.mjs';
35
+ import 'node:child_process';
36
+ import 'node:util';
34
37
  import './init.mjs';
35
38
  import './codex.mjs';
36
39
  import 'ora';
37
40
  import 'semver';
38
- import '../shared/ccjk.BFQ7yr5S.mjs';
39
41
  import './prompts.mjs';
40
- import './workflows.mjs';
42
+ import './config2.mjs';
41
43
  import './auto-updater.mjs';
42
44
  import './version-checker.mjs';
43
45
  import 'node:path';
44
- import '../shared/ccjk.KfIN1Sqj.mjs';
45
46
  import './installer.mjs';
46
- import './ccu.mjs';
47
47
  import './commands.mjs';
48
48
  import './claude-code-config-manager.mjs';
49
49
  import './config-switch.mjs';
@@ -3,9 +3,7 @@ import inquirer from 'inquirer';
3
3
  import { SUPPORTED_LANGS, LANG_LABELS } from './constants.mjs';
4
4
  import { ensureI18nInitialized, i18n, changeLanguage } from './index.mjs';
5
5
  import { updateZcfConfig, readZcfConfig } from './ccjk-config.mjs';
6
- import { setupCcrConfiguration } from './config2.mjs';
7
- import { a as isCcrInstalled, b as installCcr } from './init.mjs';
8
- import { g as getExistingApiConfig, p as promptApiConfigurationAction, a as configureApi, s as switchToOfficialLogin } from './config.mjs';
6
+ import { g as getExistingApiConfig, p as promptApiConfigurationAction, a as configureApi } from './config.mjs';
9
7
  import { a as modifyApiConfigPartially, v as validateApiKey, f as formatApiKeyDisplay } from '../shared/ccjk.KfIN1Sqj.mjs';
10
8
  import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
11
9
  import 'node:os';
@@ -21,40 +19,17 @@ import 'node:crypto';
21
19
  import 'node:fs/promises';
22
20
  import './json-config.mjs';
23
21
  import 'dayjs';
24
- import 'node:child_process';
25
- import 'node:util';
26
22
  import './claude-config.mjs';
27
23
  import './platform.mjs';
28
24
  import 'tinyexec';
29
25
  import '../shared/ccjk.DHbrGcgg.mjs';
30
26
  import 'inquirer-toggle';
31
- import './package.mjs';
32
- import './codex.mjs';
33
- import 'ora';
34
- import 'semver';
35
- import './prompts.mjs';
36
27
  import './workflows.mjs';
37
- import '../shared/ccjk.Br91zBIG.mjs';
38
- import './auto-updater.mjs';
39
- import './version-checker.mjs';
40
- import 'node:path';
41
- import '../shared/ccjk.SIo9I8q3.mjs';
42
- import '../shared/ccjk.DvIrK0wz.mjs';
43
- import './installer.mjs';
44
28
 
45
29
  async function handleCancellation() {
46
30
  ensureI18nInitialized();
47
31
  console.log(ansis.yellow(i18n.t("common:cancelled")));
48
32
  }
49
- async function handleOfficialLoginMode() {
50
- ensureI18nInitialized();
51
- const success = switchToOfficialLogin();
52
- if (success) {
53
- console.log(ansis.green(`\u2714 ${i18n.t("api:officialLoginConfigured")}`));
54
- } else {
55
- console.log(ansis.red(i18n.t("api:officialLoginFailed")));
56
- }
57
- }
58
33
  async function handleCustomApiMode() {
59
34
  ensureI18nInitialized();
60
35
  const zcfConfig = readZcfConfig();
@@ -145,60 +120,6 @@ async function handleCustomApiMode() {
145
120
  console.log(ansis.gray(` Key: ${formatApiKeyDisplay(configuredApi.key)}`));
146
121
  }
147
122
  }
148
- async function handleCcrProxyMode() {
149
- ensureI18nInitialized();
150
- const ccrStatus = await isCcrInstalled();
151
- if (!ccrStatus.hasCorrectPackage) {
152
- await installCcr();
153
- } else {
154
- console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
155
- }
156
- const ccrConfigured = await setupCcrConfiguration();
157
- if (ccrConfigured) {
158
- console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrSetupComplete")}`));
159
- }
160
- }
161
- async function handleSwitchConfigMode() {
162
- ensureI18nInitialized();
163
- const { configSwitchCommand } = await import('./config-switch.mjs');
164
- await configSwitchCommand({ codeType: "claude-code" });
165
- }
166
- async function configureApiFeature() {
167
- ensureI18nInitialized();
168
- const { mode } = await inquirer.prompt({
169
- type: "list",
170
- name: "mode",
171
- message: i18n.t("api:apiModePrompt"),
172
- choices: addNumbersToChoices([
173
- { name: i18n.t("api:apiModeOfficial"), value: "official" },
174
- { name: i18n.t("api:apiModeCustom"), value: "custom" },
175
- { name: i18n.t("api:apiModeCcr"), value: "ccr" },
176
- { name: i18n.t("api:apiModeSwitch"), value: "switch" },
177
- { name: i18n.t("api:apiModeSkip"), value: "skip" }
178
- ])
179
- });
180
- if (!mode || mode === "skip") {
181
- await handleCancellation();
182
- return;
183
- }
184
- switch (mode) {
185
- case "official":
186
- await handleOfficialLoginMode();
187
- break;
188
- case "custom":
189
- await handleCustomApiMode();
190
- break;
191
- case "ccr":
192
- await handleCcrProxyMode();
193
- break;
194
- case "switch":
195
- await handleSwitchConfigMode();
196
- break;
197
- default:
198
- await handleCancellation();
199
- break;
200
- }
201
- }
202
123
  async function promptCustomModels(defaultPrimaryModel, defaultHaikuModel, defaultSonnetModel, defaultOpusModel) {
203
124
  const { primaryModel } = await inquirer.prompt({
204
125
  type: "input",
@@ -249,4 +170,4 @@ async function changeScriptLanguageFeature(currentLang) {
249
170
  return lang;
250
171
  }
251
172
 
252
- export { changeScriptLanguageFeature, configureApiFeature, promptCustomModels };
173
+ export { changeScriptLanguageFeature, handleCustomApiMode, promptCustomModels };
@@ -1408,4 +1408,4 @@ const init$1 = {
1408
1408
  validateSkipPromptOptions: validateSkipPromptOptions
1409
1409
  };
1410
1410
 
1411
- export { COMETIX_COMMAND_NAME as C, isCcrInstalled as a, installCcr as b, COMETIX_COMMANDS as c, installCometixLine as d, init$1 as e, init as i, simplifiedInit as s };
1411
+ export { COMETIX_COMMAND_NAME as C, COMETIX_COMMANDS as a, installCometixLine as b, isCcrInstalled as c, installCcr as d, init$1 as e, init as i, simplifiedInit as s };
@@ -3,27 +3,27 @@ import { i18n, ensureI18nInitialized } from './index.mjs';
3
3
  import 'node:child_process';
4
4
  import 'node:process';
5
5
  import { M as MCP_SERVICE_TIERS, i as isCoreService, g as getServicesByTier, c as checkMcpPerformance, f as formatPerformanceWarning, a as calculateResourceUsage, b as getOptimizationSuggestions, d as getMcpTierConfig } from './mcp-performance.mjs';
6
- import { r as readMcpConfig, b as backupMcpConfig, w as writeMcpConfig, c as buildMcpServerConfig } from './claude-config.mjs';
6
+ import { r as readMcpConfig, b as backupMcpConfig, w as writeMcpConfig, d as deepMerge, c as buildMcpServerConfig } from './claude-config.mjs';
7
7
  import inquirer from 'inquirer';
8
8
  import { j as getMcpService, a as readCodexConfig, k as applyCodexPlatformCommand, w as writeCodexConfig, M as MCP_SERVICE_CONFIGS } from './codex.mjs';
9
- import { ClAUDE_CONFIG_FILE, CODEX_CONFIG_FILE } from './constants.mjs';
10
- import { writeFileAtomic, exists } from './fs-operations.mjs';
9
+ import { join } from 'pathe';
10
+ import { SETTINGS_FILE, CLAUDE_DIR, ClAUDE_CONFIG_FILE, CODEX_CONFIG_FILE } from './constants.mjs';
11
+ import { writeFileAtomic, exists, ensureDir } from './fs-operations.mjs';
12
+ import { readJsonConfig, writeJsonConfig } from './json-config.mjs';
11
13
  import { k as isWindows, m as getSystemRoot } from './platform.mjs';
12
14
  import { existsSync, unlinkSync, statSync, mkdirSync, readFileSync } from 'node:fs';
13
15
  import { homedir } from 'node:os';
14
- import { join } from 'pathe';
15
16
  import 'node:url';
16
17
  import 'i18next';
17
18
  import 'i18next-fs-backend';
18
- import './json-config.mjs';
19
19
  import 'dayjs';
20
- import 'node:crypto';
21
- import 'node:fs/promises';
22
20
  import 'ora';
23
21
  import 'semver';
24
22
  import 'smol-toml';
25
23
  import 'tinyexec';
26
24
  import './ccjk-config.mjs';
25
+ import 'node:crypto';
26
+ import 'node:fs/promises';
27
27
  import './config.mjs';
28
28
  import '../shared/ccjk.BFQ7yr5S.mjs';
29
29
  import './prompts.mjs';
@@ -795,6 +795,47 @@ function getDefaultMarketplaceClient() {
795
795
  return defaultClientInstance;
796
796
  }
797
797
 
798
+ function readClaudeConfig(configPath = SETTINGS_FILE) {
799
+ try {
800
+ if (!exists(configPath)) {
801
+ return null;
802
+ }
803
+ return readJsonConfig(configPath) || null;
804
+ } catch (error) {
805
+ console.error(`Failed to read Claude config from ${configPath}:`, error);
806
+ return null;
807
+ }
808
+ }
809
+ function writeClaudeConfig(config, options = {}, configPath = SETTINGS_FILE) {
810
+ try {
811
+ ensureDir(CLAUDE_DIR);
812
+ writeJsonConfig(configPath, config, {
813
+ atomic: options.atomic !== false,
814
+ pretty: true,
815
+ backup: options.backup
816
+ });
817
+ } catch (error) {
818
+ console.error(`Failed to write Claude config to ${configPath}:`, error);
819
+ throw new Error(`Failed to write Claude config: ${error instanceof Error ? error.message : String(error)}`);
820
+ }
821
+ }
822
+ function updateClaudeConfig(updates, options = {}, configPath = SETTINGS_FILE) {
823
+ const existingConfig = readClaudeConfig(configPath) || {};
824
+ const mergedConfig = deepMerge(existingConfig, updates, {
825
+ mergeArrays: options.merge === "preserve",
826
+ arrayMergeStrategy: "unique"
827
+ });
828
+ writeClaudeConfig(mergedConfig, options, configPath);
829
+ return mergedConfig;
830
+ }
831
+
832
+ const claudeConfig = {
833
+ __proto__: null,
834
+ readClaudeConfig: readClaudeConfig,
835
+ updateClaudeConfig: updateClaudeConfig,
836
+ writeClaudeConfig: writeClaudeConfig
837
+ };
838
+
798
839
  function detectActiveTool() {
799
840
  const hasClaudeConfig = exists(ClAUDE_CONFIG_FILE);
800
841
  const hasCodexConfig = exists(CODEX_CONFIG_FILE);
@@ -872,6 +913,7 @@ async function installMcpServiceForClaudeCode(serviceId, baseConfig, apiKey, api
872
913
  }
873
914
  config.mcpServers[serviceId] = serverConfig;
874
915
  writeMcpConfig(config);
916
+ await autoAuthorizeMcpService(serviceId);
875
917
  }
876
918
  async function installMcpServiceForCodex(serviceId, baseConfig, apiKey, apiKeyEnvVar) {
877
919
  const existingConfig = readCodexConfig();
@@ -957,6 +999,7 @@ async function uninstallMcpServiceFromClaudeCode(serviceId) {
957
999
  }
958
1000
  delete config.mcpServers[existingKey];
959
1001
  writeMcpConfig(config);
1002
+ await removeAuthorizeMcpService(serviceId);
960
1003
  }
961
1004
  async function uninstallMcpServiceFromCodex(serviceId) {
962
1005
  const existingConfig = readCodexConfig();
@@ -1050,6 +1093,37 @@ ${i18n.t("mcp:installer.installedServices", { tool: targetTool })}
1050
1093
  console.log("");
1051
1094
  });
1052
1095
  }
1096
+ async function autoAuthorizeMcpService(serviceId) {
1097
+ const mcpPermission = `mcp__${serviceId.toLowerCase().replace(/-/g, "_")}`;
1098
+ const { readClaudeConfig } = await Promise.resolve().then(function () { return claudeConfig; });
1099
+ const currentSettings = readClaudeConfig() || {};
1100
+ if (!currentSettings.permissions) {
1101
+ currentSettings.permissions = {};
1102
+ }
1103
+ if (!currentSettings.permissions.allow) {
1104
+ currentSettings.permissions.allow = [];
1105
+ }
1106
+ if (!currentSettings.permissions.allow.includes(mcpPermission)) {
1107
+ currentSettings.permissions.allow.push(mcpPermission);
1108
+ updateClaudeConfig({
1109
+ permissions: currentSettings.permissions
1110
+ });
1111
+ }
1112
+ }
1113
+ async function removeAuthorizeMcpService(serviceId) {
1114
+ const mcpPermission = `mcp__${serviceId.toLowerCase().replace(/-/g, "_")}`;
1115
+ const { readClaudeConfig } = await Promise.resolve().then(function () { return claudeConfig; });
1116
+ const currentSettings = readClaudeConfig() || {};
1117
+ if (currentSettings.permissions?.allow) {
1118
+ const index = currentSettings.permissions.allow.indexOf(mcpPermission);
1119
+ if (index !== -1) {
1120
+ currentSettings.permissions.allow.splice(index, 1);
1121
+ updateClaudeConfig({
1122
+ permissions: currentSettings.permissions
1123
+ });
1124
+ }
1125
+ }
1126
+ }
1053
1127
 
1054
1128
  function getLocalFallbackServices() {
1055
1129
  return [
@@ -8,12 +8,12 @@ import { d as displayBannerWithInfo } from '../shared/ccjk.Br91zBIG.mjs';
8
8
  import { readZcfConfig, updateZcfConfig } from './ccjk-config.mjs';
9
9
  import { r as resolveCodeType } from '../shared/ccjk.SIo9I8q3.mjs';
10
10
  import { h as handleExitPromptError, a as handleGeneralError } from '../shared/ccjk.DvIrK0wz.mjs';
11
- import { configureApiFeature, changeScriptLanguageFeature } from './features.mjs';
11
+ import { handleCustomApiMode, changeScriptLanguageFeature } from './features.mjs';
12
12
  import { p as promptBoolean } from '../shared/ccjk.DHbrGcgg.mjs';
13
13
  import { executeCcusage } from './ccu.mjs';
14
14
  import { spawn, exec } from 'node:child_process';
15
15
  import { promisify } from 'node:util';
16
- import { C as COMETIX_COMMAND_NAME, c as COMETIX_COMMANDS, d as installCometixLine, a as isCcrInstalled, b as installCcr, s as simplifiedInit } from './init.mjs';
16
+ import { C as COMETIX_COMMAND_NAME, a as COMETIX_COMMANDS, b as installCometixLine, c as isCcrInstalled, d as installCcr, s as simplifiedInit } from './init.mjs';
17
17
  import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
18
18
  import { homedir } from 'node:os';
19
19
  import { runCcrStop, runCcrStart, runCcrRestart, runCcrStatus, runCcrUi } from './commands.mjs';
@@ -498,7 +498,7 @@ async function handleOfficialLogin(codeTool, isZh) {
498
498
  }
499
499
  async function handleCustomConfig(isZh) {
500
500
  try {
501
- await configureApiFeature();
501
+ await handleCustomApiMode();
502
502
  return { mode: "custom", success: true, cancelled: false };
503
503
  } catch {
504
504
  return { mode: "custom", success: false, cancelled: false };
@@ -1,4 +1,4 @@
1
- const version = "9.3.5";
1
+ const version = "9.3.7";
2
2
  const homepage = "https://github.com/miounet11/ccjk";
3
3
 
4
4
  export { homepage, version };
@@ -67,7 +67,11 @@
67
67
  "uninstallFailed": "Failed to uninstall {{name}}",
68
68
  "restartRequired": "Restart Claude Code for changes to take effect",
69
69
  "noServicesInstalled": "No MCP services installed",
70
- "installedServices": "Installed MCP services ({{tool}})"
70
+ "installedServices": "Installed MCP services ({{tool}})",
71
+ "autoGrantPrompt": "Auto-grant permissions for MCP tools? (You won't be asked again)",
72
+ "autoGrantEnabled": "Auto-grant enabled. MCP tools will be authorized automatically.",
73
+ "autoGrantDisabled": "Auto-grant disabled. You'll approve each MCP tool manually.",
74
+ "permissionGranted": "Permission granted for {{serviceId}}"
71
75
  },
72
76
  "server": {
73
77
  "starting": "Starting CCJK MCP server...",
@@ -67,7 +67,11 @@
67
67
  "uninstallFailed": "卸载 {{name}} 失败",
68
68
  "restartRequired": "重启 Claude Code 以使更改生效",
69
69
  "noServicesInstalled": "未安装任何 MCP 服务",
70
- "installedServices": "已安装的 MCP 服务 ({{tool}})"
70
+ "installedServices": "已安装的 MCP 服务 ({{tool}})",
71
+ "autoGrantPrompt": "是否自动授权 MCP 工具权限?(之后不再询问)",
72
+ "autoGrantEnabled": "已启用自动授权,MCP 工具将自动获得权限。",
73
+ "autoGrantDisabled": "已禁用自动授权,您需要手动批准每个 MCP 工具。",
74
+ "permissionGranted": "已授权 {{serviceId}} 的权限"
71
75
  },
72
76
  "server": {
73
77
  "starting": "正在启动 CCJK MCP 服务器...",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ccjk",
3
3
  "type": "module",
4
- "version": "9.3.6",
4
+ "version": "9.3.7",
5
5
  "packageManager": "pnpm@10.17.1",
6
6
  "description": "CCJK v9.0.0 - Revolutionary AI Development Platform with Enterprise Security, Streaming Cloud Sync, CRDT Conflict Resolution, and Unified V3 Architecture",
7
7
  "author": {