ccjk 14.1.7 → 14.1.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.
Files changed (68) hide show
  1. package/bin/ccjk.mjs +3 -2
  2. package/bin/ccjk.ts +104 -104
  3. package/dist/chunks/agent.mjs +2 -2
  4. package/dist/chunks/api-cli.mjs +2 -2
  5. package/dist/chunks/api-config-selector.mjs +5 -6
  6. package/dist/chunks/auto-updater.mjs +1 -1
  7. package/dist/chunks/brain-config.mjs +1 -1
  8. package/dist/chunks/brain-status.mjs +13 -7
  9. package/dist/chunks/ccjk-all.mjs +3 -3
  10. package/dist/chunks/ccjk-mcp.mjs +2 -2
  11. package/dist/chunks/ccjk-setup.mjs +1 -1
  12. package/dist/chunks/ccjk-skills.mjs +1 -1
  13. package/dist/chunks/ccr.mjs +11 -12
  14. package/dist/chunks/check-updates.mjs +1 -2
  15. package/dist/chunks/claude-code-incremental-manager.mjs +9 -9
  16. package/dist/chunks/claude-config.mjs +2 -2
  17. package/dist/chunks/code-type-resolver.mjs +2 -4
  18. package/dist/chunks/codex-config-switch.mjs +3 -4
  19. package/dist/chunks/codex-provider-manager.mjs +1 -2
  20. package/dist/chunks/codex.mjs +2 -33
  21. package/dist/chunks/config-switch.mjs +8 -5
  22. package/dist/chunks/config.mjs +382 -19
  23. package/dist/chunks/config2.mjs +3 -3
  24. package/dist/chunks/config3.mjs +1 -1
  25. package/dist/chunks/context.mjs +2 -2
  26. package/dist/chunks/doctor.mjs +4 -5
  27. package/dist/chunks/evolution.mjs +10 -6
  28. package/dist/chunks/features.mjs +13 -14
  29. package/dist/chunks/index10.mjs +4 -4
  30. package/dist/chunks/init.mjs +556 -557
  31. package/dist/chunks/installer.mjs +2 -2
  32. package/dist/chunks/mcp-cli.mjs +6 -7
  33. package/dist/chunks/mcp.mjs +6 -7
  34. package/dist/chunks/memory-check.mjs +2 -2
  35. package/dist/chunks/memory-paths.mjs +1 -1
  36. package/dist/chunks/memory-sync.mjs +2 -2
  37. package/dist/chunks/memory.mjs +7 -7
  38. package/dist/chunks/notification.mjs +1 -1
  39. package/dist/chunks/package.mjs +1 -1
  40. package/dist/chunks/quick-provider.mjs +37 -7
  41. package/dist/chunks/quick-setup.mjs +6 -7
  42. package/dist/chunks/remote.mjs +1 -1
  43. package/dist/chunks/research.mjs +118 -118
  44. package/dist/chunks/simple-config.mjs +4 -4
  45. package/dist/chunks/skill2.mjs +129 -80
  46. package/dist/chunks/skills-sync.mjs +1 -1
  47. package/dist/chunks/slash-commands.mjs +1 -1
  48. package/dist/chunks/uninstall.mjs +1 -1
  49. package/dist/chunks/update.mjs +10 -11
  50. package/dist/chunks/zero-config.mjs +8 -9
  51. package/dist/cli.mjs +1 -1
  52. package/dist/index.d.mts +3 -3
  53. package/dist/index.d.ts +3 -3
  54. package/dist/index.mjs +7 -7
  55. package/dist/shared/{ccjk.QNhw2Y_5.mjs → ccjk.B9OuS4xZ.mjs} +3 -3
  56. package/dist/shared/{ccjk.DqlzNDEQ.mjs → ccjk.BEiR3L4C.mjs} +2 -3
  57. package/dist/shared/{ccjk.4iw1XCF3.mjs → ccjk.BJ3Zpjo5.mjs} +1 -1
  58. package/dist/shared/{ccjk.Nwf9bR70.mjs → ccjk.BzxpiEPF.mjs} +2 -2
  59. package/dist/shared/{ccjk.BI-hdI7P.mjs → ccjk.CbWVbtb9.mjs} +1 -1
  60. package/dist/shared/{ccjk.UhjQ1seV.mjs → ccjk.DMV3x5Sd.mjs} +1 -1
  61. package/dist/shared/{ccjk.DQXk596F.mjs → ccjk.DuzJZlgj.mjs} +107 -103
  62. package/dist/shared/{ccjk.DTdjs-qK.mjs → ccjk.MwtjAULc.mjs} +1 -1
  63. package/dist/shared/{ccjk.DsYaCCx4.mjs → ccjk.i_vn-9C3.mjs} +2 -2
  64. package/dist/shared/{ccjk.kAZkKbGW.mjs → ccjk.tI_s2uSh.mjs} +2 -3
  65. package/package.json +5 -5
  66. package/dist/shared/ccjk.DKXs7Fbm.mjs +0 -361
  67. package/dist/shared/{ccjk.BBizCO6_.mjs → ccjk.DcMvE7lf.mjs} +1 -1
  68. package/dist/shared/{ccjk.Dhu8ia5S.mjs → ccjk.zFGcZT7Y.mjs} +1 -1
@@ -2,7 +2,7 @@ import { SETTINGS_FILE } from './constants.mjs';
2
2
  import { n as normalizeClaudeFamilySettings } from '../shared/ccjk.Di1IYU3u.mjs';
3
3
  import { exists, ensureDir } from './fs-operations.mjs';
4
4
  import { readJsonConfig, writeJsonConfig } from './json-config.mjs';
5
- import { q as deepMerge } from './config.mjs';
5
+ import { x as deepMerge } from './config.mjs';
6
6
  import { d as dirname } from '../shared/ccjk.bQ7Dh1g4.mjs';
7
7
  import 'node:os';
8
8
  import './index2.mjs';
@@ -30,10 +30,10 @@ import 'child_process';
30
30
  import 'node:path';
31
31
  import 'buffer';
32
32
  import 'string_decoder';
33
+ import 'node:child_process';
33
34
  import './platform.mjs';
34
35
  import './main.mjs';
35
36
  import 'module';
36
- import 'node:child_process';
37
37
  import 'node:stream';
38
38
 
39
39
  function readClaudeConfig(configPath = SETTINGS_FILE) {
@@ -350,10 +350,8 @@ function detectDatabase(root) {
350
350
  if (content.includes("mongodb"))
351
351
  return "mongodb";
352
352
  }
353
- for (const f of ["*.db", "*.sqlite", "*.sqlite3"]) {
354
- if (existsSync(join(root, "db.sqlite")) || existsSync(join(root, "database.sqlite")) || existsSync(join(root, "dev.db"))) {
355
- return "sqlite";
356
- }
353
+ if (existsSync(join(root, "db.sqlite")) || existsSync(join(root, "database.sqlite")) || existsSync(join(root, "dev.db"))) {
354
+ return "sqlite";
357
355
  }
358
356
  return "none";
359
357
  }
@@ -5,7 +5,7 @@ import { ensureI18nInitialized, i18n } from './index2.mjs';
5
5
  import { readJsonConfig } from './json-config.mjs';
6
6
  import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
7
7
  import { p as promptBoolean } from '../shared/ccjk.DZ2LLOa-.mjs';
8
- import { e as detectConfigManagementMode } from './codex.mjs';
8
+ import { f as detectConfigManagementMode } from './codex.mjs';
9
9
  import { deleteProviders, addProviderToExisting, editExistingProvider } from './codex-provider-manager.mjs';
10
10
  import '../shared/ccjk.BAGoDD49.mjs';
11
11
  import 'node:readline';
@@ -44,7 +44,6 @@ import '../shared/ccjk.Di1IYU3u.mjs';
44
44
  import './platform.mjs';
45
45
  import './prompts.mjs';
46
46
  import '../shared/ccjk.gDEDGD_t.mjs';
47
- import '../shared/ccjk.DKXs7Fbm.mjs';
48
47
 
49
48
  async function configureIncrementalManagement() {
50
49
  ensureI18nInitialized();
@@ -193,7 +192,7 @@ async function handleAddProvider() {
193
192
  defaultValue: true
194
193
  });
195
194
  if (setAsDefault) {
196
- const { switchToProvider } = await import('./codex.mjs').then(function (n) { return n.u; });
195
+ const { switchToProvider } = await import('./codex.mjs').then(function (n) { return n.t; });
197
196
  const switched = await switchToProvider(provider.id);
198
197
  if (switched) {
199
198
  console.log(a.green(i18n.t("multi-config:profileSetAsDefault", { name: provider.name })));
@@ -388,7 +387,7 @@ ${i18n.t("codex:copyingProvider", { name: provider.name })}`));
388
387
  defaultValue: false
389
388
  });
390
389
  if (setAsDefault) {
391
- const { switchToProvider } = await import('./codex.mjs').then(function (n) { return n.u; });
390
+ const { switchToProvider } = await import('./codex.mjs').then(function (n) { return n.t; });
392
391
  const switched = await switchToProvider(copiedProvider.id);
393
392
  if (switched) {
394
393
  console.log(a.green(i18n.t("multi-config:profileSetAsDefault", { name: copiedProvider.name })));
@@ -1,5 +1,5 @@
1
1
  import { ensureI18nInitialized, i18n } from './index2.mjs';
2
- import { r as readCodexConfig, f as backupCodexComplete, w as writeCodexConfig, g as writeAuthFile } from './codex.mjs';
2
+ import { r as readCodexConfig, d as backupCodexComplete, w as writeCodexConfig, e as writeAuthFile } from './codex.mjs';
3
3
  import 'node:fs';
4
4
  import 'node:process';
5
5
  import 'node:url';
@@ -43,7 +43,6 @@ import '../shared/ccjk.BFQ7yr5S.mjs';
43
43
  import './prompts.mjs';
44
44
  import '../shared/ccjk.gDEDGD_t.mjs';
45
45
  import '../shared/ccjk.DZ2LLOa-.mjs';
46
- import '../shared/ccjk.DKXs7Fbm.mjs';
47
46
 
48
47
  async function addProviderToExisting(provider, apiKey, allowOverwrite = false) {
49
48
  ensureI18nInitialized();
@@ -11,14 +11,13 @@ 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 { z as applyAiLanguageDirective } from './config.mjs';
14
+ import { M as MCP_SERVICE_CONFIGS, G as isMcpServiceCompatible, g as getMcpServices, H as getMcpServicesWithCompatibility, D 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
17
  import { i as isWindows, m as getMcpCommand, k 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 { M as MCP_SERVICE_CONFIGS, i as isMcpServiceCompatible, g as getMcpServices, b as getMcpServicesWithCompatibility } from '../shared/ccjk.DKXs7Fbm.mjs';
22
21
  import { j as join, d as dirname } from '../shared/ccjk.bQ7Dh1g4.mjs';
23
22
 
24
23
  function detectConfigManagementMode() {
@@ -1996,35 +1995,6 @@ async function listCodexProviders() {
1996
1995
  const config = readCodexConfig();
1997
1996
  return config?.providers || [];
1998
1997
  }
1999
- async function switchCodexProvider(providerId) {
2000
- ensureI18nInitialized();
2001
- const existingConfig = readCodexConfig();
2002
- if (!existingConfig) {
2003
- console.log(a.red(i18n.t("codex:configNotFound")));
2004
- return false;
2005
- }
2006
- const providerExists = existingConfig.providers.some((provider) => provider.id === providerId);
2007
- if (!providerExists) {
2008
- console.log(a.red(i18n.t("codex:providerNotFound", { provider: providerId })));
2009
- return false;
2010
- }
2011
- const backupPath = backupCodexComplete();
2012
- if (backupPath) {
2013
- console.log(a.gray(getBackupMessage(backupPath)));
2014
- }
2015
- const updatedConfig = {
2016
- ...existingConfig,
2017
- modelProvider: providerId
2018
- };
2019
- try {
2020
- writeCodexConfig(updatedConfig);
2021
- console.log(a.green(i18n.t("codex:providerSwitchSuccess", { provider: providerId })));
2022
- return true;
2023
- } catch (error) {
2024
- console.error(a.red(i18n.t("codex:errorSwitchingProvider", { error: error.message })));
2025
- return false;
2026
- }
2027
- }
2028
1998
  async function switchToOfficialLogin() {
2029
1999
  ensureI18nInitialized();
2030
2000
  const existingConfig = readCodexConfig();
@@ -2161,11 +2131,10 @@ const codex = {
2161
2131
  runCodexWorkflowImportWithLanguageSelection: runCodexWorkflowImportWithLanguageSelection,
2162
2132
  runCodexWorkflowSelection: runCodexWorkflowSelection,
2163
2133
  setCodexGoalsFeatureInContent: setCodexGoalsFeatureInContent,
2164
- switchCodexProvider: switchCodexProvider,
2165
2134
  switchToOfficialLogin: switchToOfficialLogin,
2166
2135
  switchToProvider: switchToProvider,
2167
2136
  writeAuthFile: writeAuthFile,
2168
2137
  writeCodexConfig: writeCodexConfig
2169
2138
  };
2170
2139
 
2171
- export { switchToOfficialLogin as a, switchToProvider as b, runCodexUpdate as c, applyCodexPlatformCommand as d, detectConfigManagementMode as e, backupCodexComplete as f, writeAuthFile as g, readCodexGoalsFeatureEnabled as h, buildCodexGoalsFeatureConfigContent as i, runCodexFullInit as j, runCodexUninstall as k, listCodexProviders as l, configureCodexAiMemoryFeature as m, configureCodexDefaultModelFeature as n, configureCodexMcp as o, configureCodexApi as p, configureCodexPresetFeature as q, readCodexConfig as r, switchCodexProvider as s, runCodexWorkflowImportWithLanguageSelection as t, codex as u, writeCodexConfig as w };
2140
+ export { switchToProvider as a, runCodexUpdate as b, applyCodexPlatformCommand as c, backupCodexComplete as d, writeAuthFile as e, detectConfigManagementMode as f, readCodexGoalsFeatureEnabled as g, buildCodexGoalsFeatureConfigContent as h, runCodexFullInit as i, runCodexUninstall as j, configureCodexAiMemoryFeature as k, listCodexProviders as l, configureCodexDefaultModelFeature as m, configureCodexMcp as n, configureCodexApi as o, configureCodexPresetFeature as p, runCodexWorkflowImportWithLanguageSelection as q, readCodexConfig as r, switchToOfficialLogin as s, codex as t, writeCodexConfig as w };
@@ -4,8 +4,8 @@ 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 { C as ClaudeCodeConfigManager, j as setMyclaudeActiveProviderProfile, k as syncMyclaudeProviderProfilesFromClaudeConfig } from './config.mjs';
8
- import { s as switchCodexProvider, l as listCodexProviders, r as readCodexConfig, a as switchToOfficialLogin, b as switchToProvider } from './codex.mjs';
7
+ import { C as ClaudeCodeConfigManager, k as setMyclaudeActiveProviderProfile, l as syncMyclaudeProviderProfilesFromClaudeConfig } from './config.mjs';
8
+ import { s as switchToOfficialLogin, a as switchToProvider, l as listCodexProviders, r as readCodexConfig } 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';
11
11
  import '../shared/ccjk.BAGoDD49.mjs';
@@ -32,11 +32,11 @@ 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 'node:child_process';
35
36
  import '../shared/ccjk.Di1IYU3u.mjs';
36
37
  import './platform.mjs';
37
38
  import './main.mjs';
38
39
  import 'module';
39
- import 'node:child_process';
40
40
  import 'node:stream';
41
41
  import './index8.mjs';
42
42
  import '../shared/ccjk.DeWpAShp.mjs';
@@ -44,7 +44,6 @@ import '../shared/ccjk.CxpGa6MC.mjs';
44
44
  import './prompts.mjs';
45
45
  import '../shared/ccjk.gDEDGD_t.mjs';
46
46
  import '../shared/ccjk.DZ2LLOa-.mjs';
47
- import '../shared/ccjk.DKXs7Fbm.mjs';
48
47
 
49
48
  async function configSwitchCommand(options) {
50
49
  try {
@@ -144,7 +143,11 @@ async function handleDirectSwitch(codeType, target) {
144
143
  if (resolvedCodeType === "claude-code" || resolvedCodeType === "clavue") {
145
144
  await handleClaudeCodeDirectSwitch(target, resolvedCodeType);
146
145
  } else if (resolvedCodeType === "codex") {
147
- await switchCodexProvider(target);
146
+ if (target === "official") {
147
+ await switchToOfficialLogin();
148
+ } else {
149
+ await switchToProvider(target);
150
+ }
148
151
  }
149
152
  }
150
153
  async function handleClaudeCodeDirectSwitch(target, codeType = "claude-code") {
@@ -4,7 +4,9 @@ import { d as dayjs } from '../shared/ccjk.RyizuzOI.mjs';
4
4
  import { i as inquirer } from './index6.mjs';
5
5
  import { ZCF_CONFIG_FILE, ZCF_CONFIG_DIR, CLAUDE_VSC_CONFIG_FILE, CLAVUE_CONFIG_FILE, CLAVUE_CREDENTIALS_FILE, CLAVUE_SETTINGS_FILE, AI_OUTPUT_LANGUAGES, SETTINGS_FILE } from './constants.mjs';
6
6
  import { ensureI18nInitialized, i18n } from './index2.mjs';
7
- import { existsSync, readFileSync, chmodSync } from 'node:fs';
7
+ import { chmodSync } from 'node:fs';
8
+ import { execSync } from 'node:child_process';
9
+ import process__default from 'node:process';
8
10
  import { readDefaultTomlConfig, createDefaultTomlConfig, writeTomlConfig } from './ccjk-config.mjs';
9
11
  import { r as resolveClaudeFamilySettingsTarget, n as normalizeClaudeFamilySettings } from '../shared/ccjk.Di1IYU3u.mjs';
10
12
  import { ensureDir, exists, copyFile, copyDir, writeFileAtomic } from './fs-operations.mjs';
@@ -12,6 +14,362 @@ import { readJsonConfig, writeJsonConfig, backupJsonConfig } from './json-config
12
14
  import { j as join, d as dirname } from '../shared/ccjk.bQ7Dh1g4.mjs';
13
15
  import { i as isWindows, m as getMcpCommand } from './platform.mjs';
14
16
 
17
+ const MCP_SERVICE_CONFIGS = [
18
+ // Documentation and research services
19
+ {
20
+ id: "context7",
21
+ requiresApiKey: false,
22
+ defaultSelected: true,
23
+ config: {
24
+ type: "stdio",
25
+ command: "npx",
26
+ args: ["-y", "@upstash/context7-mcp@latest"],
27
+ env: {}
28
+ }
29
+ },
30
+ {
31
+ id: "open-websearch",
32
+ requiresApiKey: false,
33
+ config: {
34
+ type: "stdio",
35
+ command: "npx",
36
+ args: ["-y", "open-websearch@latest"],
37
+ env: {
38
+ MODE: "stdio",
39
+ DEFAULT_SEARCH_ENGINE: "duckduckgo",
40
+ ALLOWED_SEARCH_ENGINES: "duckduckgo,bing,brave"
41
+ }
42
+ }
43
+ },
44
+ {
45
+ id: "mcp-deepwiki",
46
+ requiresApiKey: false,
47
+ config: {
48
+ type: "stdio",
49
+ command: "npx",
50
+ args: ["-y", "mcp-deepwiki@latest"],
51
+ env: {}
52
+ }
53
+ },
54
+ {
55
+ id: "spec-workflow",
56
+ requiresApiKey: false,
57
+ config: {
58
+ type: "stdio",
59
+ command: "npx",
60
+ args: ["-y", "@pimzino/spec-workflow-mcp@latest"],
61
+ env: {}
62
+ }
63
+ },
64
+ {
65
+ id: "serena",
66
+ requiresApiKey: false,
67
+ config: {
68
+ type: "stdio",
69
+ command: "uvx",
70
+ args: ["--from", "git+https://github.com/oraios/serena", "serena", "start-mcp-server", "--context", "ide-assistant", "--enable-web-dashboard", "false"],
71
+ env: {}
72
+ },
73
+ platformRequirements: {
74
+ requiredCommands: ["uvx"]
75
+ }
76
+ },
77
+ {
78
+ id: "Playwright",
79
+ requiresApiKey: false,
80
+ config: {
81
+ type: "stdio",
82
+ command: "npx",
83
+ args: ["-y", "@playwright/mcp@latest", "--browser", "chromium"],
84
+ env: {}
85
+ },
86
+ platformRequirements: {
87
+ platforms: ["macos", "windows"],
88
+ requiresGui: true
89
+ }
90
+ },
91
+ {
92
+ id: "intent-engine",
93
+ requiresApiKey: false,
94
+ config: {
95
+ type: "stdio",
96
+ command: "npx",
97
+ args: ["-y", "@origintask/intent-engine@latest", "mcp"],
98
+ env: {}
99
+ }
100
+ },
101
+ {
102
+ id: "sqlite",
103
+ requiresApiKey: false,
104
+ config: {
105
+ type: "stdio",
106
+ command: "npx",
107
+ args: ["-y", "@anthropic-ai/mcp-server-sqlite@latest"],
108
+ env: {}
109
+ }
110
+ }
111
+ ];
112
+ async function getMcpServices() {
113
+ ensureI18nInitialized();
114
+ const mcpServiceList = [
115
+ {
116
+ id: "context7",
117
+ name: i18n.t("mcp:services.context7.name"),
118
+ description: i18n.t("mcp:services.context7.description")
119
+ },
120
+ {
121
+ id: "open-websearch",
122
+ name: i18n.t("mcp:services.open-websearch.name"),
123
+ description: i18n.t("mcp:services.open-websearch.description")
124
+ },
125
+ {
126
+ id: "mcp-deepwiki",
127
+ name: i18n.t("mcp:services.mcp-deepwiki.name"),
128
+ description: i18n.t("mcp:services.mcp-deepwiki.description")
129
+ },
130
+ {
131
+ id: "spec-workflow",
132
+ name: i18n.t("mcp:services.spec-workflow.name"),
133
+ description: i18n.t("mcp:services.spec-workflow.description")
134
+ },
135
+ {
136
+ id: "serena",
137
+ name: i18n.t("mcp:services.serena.name"),
138
+ description: i18n.t("mcp:services.serena.description")
139
+ },
140
+ {
141
+ id: "Playwright",
142
+ name: i18n.t("mcp:services.Playwright.name"),
143
+ description: i18n.t("mcp:services.Playwright.description")
144
+ },
145
+ {
146
+ id: "intent-engine",
147
+ name: i18n.t("mcp:services.intent-engine.name"),
148
+ description: i18n.t("mcp:services.intent-engine.description")
149
+ },
150
+ {
151
+ id: "sqlite",
152
+ name: i18n.t("mcp:services.sqlite.name"),
153
+ description: i18n.t("mcp:services.sqlite.description")
154
+ }
155
+ ];
156
+ return MCP_SERVICE_CONFIGS.map((config) => {
157
+ const serviceInfo = mcpServiceList.find((s) => s.id === config.id);
158
+ const service = {
159
+ id: config.id,
160
+ name: serviceInfo?.name || config.id,
161
+ description: serviceInfo?.description || "",
162
+ requiresApiKey: config.requiresApiKey,
163
+ config: config.config
164
+ };
165
+ if (config.apiKeyEnvVar) {
166
+ service.apiKeyEnvVar = config.apiKeyEnvVar;
167
+ }
168
+ return service;
169
+ });
170
+ }
171
+ async function getMcpService(id) {
172
+ const services = await getMcpServices();
173
+ return services.find((service) => service.id === id);
174
+ }
175
+ function detectPlatform() {
176
+ const platform = process__default.platform;
177
+ const env = process__default.env;
178
+ const isWsl = !!(env.WSL_DISTRO_NAME || env.WSLENV || env.PATH && env.PATH.includes("/mnt/c/"));
179
+ const isTermux = !!(env.TERMUX_VERSION || env.PREFIX?.includes("com.termux"));
180
+ const isHeadless = !!(env.SSH_CLIENT || env.SSH_TTY || env.SSH_CONNECTION || !env.DISPLAY && platform === "linux");
181
+ const hasGui = (() => {
182
+ if (platform === "darwin")
183
+ return true;
184
+ if (platform === "win32")
185
+ return !isHeadless;
186
+ if (isWsl || isTermux)
187
+ return false;
188
+ if (platform === "linux")
189
+ return !!env.DISPLAY || !!env.WAYLAND_DISPLAY;
190
+ return false;
191
+ })();
192
+ let detectedPlatform;
193
+ if (platform === "darwin") {
194
+ detectedPlatform = "macos";
195
+ } else if (platform === "win32") {
196
+ detectedPlatform = "windows";
197
+ } else if (isWsl) {
198
+ detectedPlatform = "wsl";
199
+ } else if (isTermux) {
200
+ detectedPlatform = "termux";
201
+ } else if (platform === "linux") {
202
+ detectedPlatform = "linux";
203
+ } else {
204
+ detectedPlatform = "unknown";
205
+ }
206
+ return {
207
+ platform: detectedPlatform,
208
+ hasGui,
209
+ isHeadless
210
+ };
211
+ }
212
+ function isCommandAvailable(command) {
213
+ try {
214
+ execSync(`which ${command}`, { stdio: "ignore" });
215
+ return true;
216
+ } catch {
217
+ return false;
218
+ }
219
+ }
220
+ function isMcpServiceCompatible(serviceId) {
221
+ const config = MCP_SERVICE_CONFIGS.find((c) => c.id === serviceId);
222
+ if (!config) {
223
+ return { compatible: false, reason: "Service not found" };
224
+ }
225
+ const requirements = config.platformRequirements;
226
+ if (!requirements) {
227
+ return { compatible: true };
228
+ }
229
+ const { platform, hasGui } = detectPlatform();
230
+ if (requirements.platforms && requirements.platforms.length > 0) {
231
+ if (platform !== "unknown" && !requirements.platforms.includes(platform)) {
232
+ return {
233
+ compatible: false,
234
+ reason: `Not supported on ${platform}. Requires: ${requirements.platforms.join(", ")}`
235
+ };
236
+ }
237
+ }
238
+ if (requirements.requiresGui && !hasGui) {
239
+ return {
240
+ compatible: false,
241
+ reason: "Requires GUI environment (X11/Wayland/Desktop)"
242
+ };
243
+ }
244
+ if (requirements.requiredCommands) {
245
+ for (const cmd of requirements.requiredCommands) {
246
+ if (!isCommandAvailable(cmd)) {
247
+ return {
248
+ compatible: false,
249
+ reason: `Required command not found: ${cmd}`
250
+ };
251
+ }
252
+ }
253
+ }
254
+ return { compatible: true };
255
+ }
256
+ async function getMcpServicesWithCompatibility() {
257
+ const allServices = await getMcpServices();
258
+ return allServices.map((service) => {
259
+ const { compatible, reason } = isMcpServiceCompatible(service.id);
260
+ return {
261
+ ...service,
262
+ compatible,
263
+ incompatibleReason: reason
264
+ };
265
+ });
266
+ }
267
+ const DEFAULT_MCP_TOOL_SEARCH_CONFIG = {
268
+ mcpAutoEnableThreshold: 10,
269
+ excludedServices: ["mcp-search", "context7"]
270
+ };
271
+ function getMcpToolSearchConfig() {
272
+ const env = process__default.env;
273
+ return {
274
+ mcpAutoEnableThreshold: env.MCP_AUTO_THRESHOLD || DEFAULT_MCP_TOOL_SEARCH_CONFIG.mcpAutoEnableThreshold,
275
+ dynamicServiceDiscovery: env.MCP_DYNAMIC_DISCOVERY !== "false",
276
+ listChangedNotifications: env.MCP_LIST_CHANGED !== "false",
277
+ excludedServices: env.MCP_EXCLUDED_SERVICES?.split(",").map((s) => s.trim()).filter(Boolean) || DEFAULT_MCP_TOOL_SEARCH_CONFIG.excludedServices
278
+ };
279
+ }
280
+ class DynamicMcpServiceRegistry {
281
+ _services = /* @__PURE__ */ new Map();
282
+ _listeners = /* @__PURE__ */ new Set();
283
+ _enabled = false;
284
+ /**
285
+ * Enable dynamic service discovery
286
+ */
287
+ enable() {
288
+ this._enabled = true;
289
+ }
290
+ /**
291
+ * Disable dynamic service discovery
292
+ */
293
+ disable() {
294
+ this._enabled = false;
295
+ }
296
+ /**
297
+ * Check if dynamic discovery is enabled
298
+ */
299
+ isEnabled() {
300
+ return this._enabled;
301
+ }
302
+ /**
303
+ * Add a service dynamically
304
+ */
305
+ addService(serviceId, config) {
306
+ if (!this._enabled) {
307
+ return false;
308
+ }
309
+ const isUpdate = this._services.has(serviceId);
310
+ this._services.set(serviceId, config);
311
+ this._notify({
312
+ type: isUpdate ? "updated" : "added",
313
+ serviceId,
314
+ timestamp: Date.now(),
315
+ config
316
+ });
317
+ return true;
318
+ }
319
+ /**
320
+ * Remove a service dynamically
321
+ */
322
+ removeService(serviceId) {
323
+ if (!this._enabled || !this._services.has(serviceId)) {
324
+ return false;
325
+ }
326
+ const config = this._services.get(serviceId);
327
+ this._services.delete(serviceId);
328
+ this._notify({
329
+ type: "removed",
330
+ serviceId,
331
+ timestamp: Date.now(),
332
+ config
333
+ });
334
+ return true;
335
+ }
336
+ /**
337
+ * Get a service configuration
338
+ */
339
+ getService(serviceId) {
340
+ return this._services.get(serviceId);
341
+ }
342
+ /**
343
+ * List all dynamically registered services
344
+ */
345
+ listServices() {
346
+ return new Map(this._services);
347
+ }
348
+ /**
349
+ * Subscribe to list change notifications
350
+ */
351
+ subscribe(listener) {
352
+ this._listeners.add(listener);
353
+ return () => this._listeners.delete(listener);
354
+ }
355
+ /**
356
+ * Notify all listeners of a change
357
+ */
358
+ _notify(notification) {
359
+ const toolSearchConfig = getMcpToolSearchConfig();
360
+ if (toolSearchConfig.listChangedNotifications) {
361
+ for (const listener of Array.from(this._listeners)) {
362
+ try {
363
+ listener(notification);
364
+ } catch (error) {
365
+ console.error("Error notifying MCP list change listener:", error);
366
+ }
367
+ }
368
+ }
369
+ }
370
+ }
371
+ const dynamicMcpRegistry = new DynamicMcpServiceRegistry();
372
+
15
373
  class ClaudeCodeConfigManager {
16
374
  static CONFIG_FILE = ZCF_CONFIG_FILE;
17
375
  static LEGACY_CONFIG_FILE = join(ZCF_CONFIG_DIR, "claude-code-configs.json");
@@ -1565,26 +1923,31 @@ function clearMyclaudeProviderProfiles() {
1565
1923
  }
1566
1924
  syncMyclaudeActiveProfileToSettings(preservedActiveProfile);
1567
1925
  }
1926
+ function getKnownMcpServiceIds() {
1927
+ return new Set(MCP_SERVICE_CONFIGS.map((service) => service.id));
1928
+ }
1929
+ function getMcpPermission(serviceId) {
1930
+ return `mcp__${serviceId.toLowerCase().replace(/-/g, "_")}__*`;
1931
+ }
1568
1932
  function syncMcpPermissions(codeTool) {
1569
1933
  const target = resolveClaudeFamilySettingsTarget(codeTool);
1570
- const mcpConfig = readMcpConfig(codeTool);
1571
- const mcpServerIds = Object.keys(mcpConfig?.mcpServers || {});
1934
+ const mcpConfig = readMcpConfig(target.codeTool);
1935
+ const knownServiceIds = getKnownMcpServiceIds();
1936
+ const managedMcpServerIds = Object.keys(mcpConfig?.mcpServers || {}).filter((id) => knownServiceIds.has(id));
1572
1937
  const settingsPath = target.settingsFile;
1573
- if (!existsSync(settingsPath))
1574
- return;
1575
- try {
1576
- const settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
1577
- if (!settings.permissions?.allow)
1578
- return;
1579
- const nonMcpPerms = settings.permissions.allow.filter(
1580
- (p) => !p.startsWith("mcp__")
1581
- );
1582
- const mcpPerms = mcpServerIds.map((id) => `mcp__${id.toLowerCase().replace(/-/g, "_")}__*`);
1583
- settings.permissions.allow = [...nonMcpPerms, ...mcpPerms];
1584
- normalizeClaudeFamilySettings(settings);
1585
- writeJsonConfig(settingsPath, settings);
1586
- } catch {
1587
- }
1938
+ const settings = readJsonConfig(settingsPath) || {};
1939
+ const allow = Array.isArray(settings.permissions?.allow) ? settings.permissions.allow.filter((permission) => typeof permission === "string") : [];
1940
+ const managedMcpPermissions = new Set(
1941
+ [...knownServiceIds].map(getMcpPermission)
1942
+ );
1943
+ const nonManagedPerms = allow.filter((permission) => !managedMcpPermissions.has(permission));
1944
+ const mcpPerms = managedMcpServerIds.map(getMcpPermission);
1945
+ settings.permissions = {
1946
+ ...settings.permissions || {},
1947
+ allow: [...nonManagedPerms, ...mcpPerms]
1948
+ };
1949
+ normalizeClaudeFamilySettings(settings);
1950
+ writeJsonConfig(settingsPath, settings);
1588
1951
  }
1589
1952
 
1590
1953
  const claudeConfig = {
@@ -2142,4 +2505,4 @@ const config = {
2142
2505
  updateDefaultModel: updateDefaultModel
2143
2506
  };
2144
2507
 
2145
- export { setMyclaudeProviderProfiles as A, overwriteModelSettings as B, ClaudeCodeConfigManager as C, ensureClaudeDir as D, clearMyclaudeProviderProfiles as E, replaceMcpServers as F, buildMyclaudeProviderPresentation as G, config as H, claudeCodeConfigManager as I, claudeConfig as J, getExistingCustomModelConfig as a, backupExistingConfig as b, updateDefaultModel as c, backupMcpConfig as d, buildMcpServerConfig as e, fixWindowsMcpConfig as f, getExistingModelConfig as g, getExistingApiConfig as h, configureApi as i, setMyclaudeActiveProviderProfile as j, syncMyclaudeProviderProfilesFromClaudeConfig as k, copyConfigFiles as l, mergeMcpServers as m, mergeAndCleanPermissions as n, syncMcpPermissions as o, promptApiConfigurationAction as p, deepMerge as q, readMcpConfig as r, syncClavueActiveProviderModelSelection as s, clearLegacyTopLevelRuntimeSettings as t, updateCustomModel as u, setPrimaryApiKey as v, writeMcpConfig as w, addCompletedOnboarding as x, switchToOfficialLogin as y, applyAiLanguageDirective as z };
2508
+ export { addCompletedOnboarding as A, switchToOfficialLogin as B, ClaudeCodeConfigManager as C, applyAiLanguageDirective as D, setMyclaudeProviderProfiles as E, overwriteModelSettings as F, isMcpServiceCompatible as G, getMcpServicesWithCompatibility as H, ensureClaudeDir as I, clearMyclaudeProviderProfiles as J, replaceMcpServers as K, buildMyclaudeProviderPresentation as L, MCP_SERVICE_CONFIGS as M, config as N, claudeCodeConfigManager as O, claudeConfig as P, getExistingModelConfig as a, backupExistingConfig as b, getExistingCustomModelConfig as c, updateDefaultModel as d, backupMcpConfig as e, fixWindowsMcpConfig as f, getMcpServices as g, buildMcpServerConfig as h, getExistingApiConfig as i, configureApi as j, setMyclaudeActiveProviderProfile as k, syncMyclaudeProviderProfilesFromClaudeConfig as l, mergeMcpServers as m, copyConfigFiles as n, mergeAndCleanPermissions as o, promptApiConfigurationAction as p, syncMcpPermissions as q, readMcpConfig as r, syncClavueActiveProviderModelSelection as s, getMcpService as t, updateCustomModel as u, dynamicMcpRegistry as v, writeMcpConfig as w, deepMerge as x, clearLegacyTopLevelRuntimeSettings as y, setPrimaryApiKey as z };
@@ -7,7 +7,7 @@ import a from './index5.mjs';
7
7
  import { d as dayjs } from '../shared/ccjk.RyizuzOI.mjs';
8
8
  import { i as inquirer } from './index6.mjs';
9
9
  import { ensureI18nInitialized, i18n } from './index2.mjs';
10
- import { t as clearLegacyTopLevelRuntimeSettings, v as setPrimaryApiKey, x as addCompletedOnboarding, b as backupExistingConfig } from './config.mjs';
10
+ import { y as clearLegacyTopLevelRuntimeSettings, z as setPrimaryApiKey, A as addCompletedOnboarding, b as backupExistingConfig } from './config.mjs';
11
11
  import { r as resolveClaudeFamilySettingsTarget, n as normalizeClaudeFamilySettings } from '../shared/ccjk.Di1IYU3u.mjs';
12
12
  import { readJsonConfig, writeJsonConfig } from './json-config.mjs';
13
13
  import { p as promptBoolean } from '../shared/ccjk.DZ2LLOa-.mjs';
@@ -420,7 +420,7 @@ async function setupCcrConfiguration(codeTool) {
420
420
  console.log(a.yellow(`${i18n.t("ccr:keepingExistingConfig")}`));
421
421
  await configureCcrProxy(existingConfig, codeTool);
422
422
  try {
423
- const { manageApiKeyApproval } = await import('./config.mjs').then(function (n) { return n.J; });
423
+ const { manageApiKeyApproval } = await import('./config.mjs').then(function (n) { return n.P; });
424
424
  const apiKey = existingConfig.APIKEY || "sk-ccjk-x-ccr";
425
425
  manageApiKeyApproval(apiKey, resolveClaudeFamilySettingsTarget(codeTool).codeTool);
426
426
  console.log(a.green(`\u2714 ${i18n.t("ccr:apiKeyApprovalSuccess")}`));
@@ -454,7 +454,7 @@ async function setupCcrConfiguration(codeTool) {
454
454
  console.error(a.red(i18n.t("errors:failedToSetOnboarding")), error);
455
455
  }
456
456
  try {
457
- const { manageApiKeyApproval } = await import('./config.mjs').then(function (n) { return n.J; });
457
+ const { manageApiKeyApproval } = await import('./config.mjs').then(function (n) { return n.P; });
458
458
  const apiKey = config.APIKEY || "sk-ccjk-x-ccr";
459
459
  manageApiKeyApproval(apiKey, resolveClaudeFamilySettingsTarget(codeTool).codeTool);
460
460
  console.log(a.green(`\u2714 ${i18n.t("ccr:apiKeyApprovalSuccess")}`));
@@ -31,10 +31,10 @@ import './fs-operations.mjs';
31
31
  import 'node:fs/promises';
32
32
  import './json-config.mjs';
33
33
  import '../shared/ccjk.RyizuzOI.mjs';
34
+ import 'node:child_process';
34
35
  import './platform.mjs';
35
36
  import './main.mjs';
36
37
  import 'module';
37
- import 'node:child_process';
38
38
  import 'node:stream';
39
39
 
40
40
  async function getConfig(key, options = {}) {