ccjk 13.3.18 → 13.3.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/api-cli.mjs +1 -1
- package/dist/chunks/api.mjs +1 -1
- package/dist/chunks/auto-fix.mjs +4 -4
- package/dist/chunks/boost.mjs +1 -1
- package/dist/chunks/ccjk-mcp.mjs +2 -2
- package/dist/chunks/ccr.mjs +24 -20
- package/dist/chunks/check-updates.mjs +2 -1
- package/dist/chunks/claude-code-config-manager.mjs +4 -4
- package/dist/chunks/claude-code-incremental-manager.mjs +5 -5
- package/dist/chunks/claude-config.mjs +2 -2
- package/dist/chunks/claude-wrapper.mjs +1 -1
- package/dist/chunks/codex-config-switch.mjs +4 -3
- package/dist/chunks/codex-provider-manager.mjs +2 -1
- package/dist/chunks/codex.mjs +4 -332
- package/dist/chunks/config-switch.mjs +2 -1
- package/dist/chunks/config.mjs +424 -358
- package/dist/chunks/config2.mjs +358 -424
- package/dist/chunks/config3.mjs +6 -1
- package/dist/chunks/doctor.mjs +2 -2
- package/dist/chunks/features.mjs +812 -0
- package/dist/chunks/index.mjs +1 -1
- package/dist/chunks/init.mjs +43 -89
- package/dist/chunks/installer.mjs +1 -1
- package/dist/chunks/mcp-cli.mjs +18 -17
- package/dist/chunks/mcp.mjs +5 -4
- package/dist/chunks/menu-hierarchical.mjs +27 -23
- package/dist/chunks/menu.mjs +17 -791
- package/dist/chunks/onboarding-wizard.mjs +2 -2
- package/dist/chunks/package.mjs +1 -1
- package/dist/chunks/platform.mjs +1 -1
- package/dist/chunks/quick-setup.mjs +14 -11
- package/dist/chunks/slash-commands.mjs +1 -1
- package/dist/chunks/uninstall.mjs +1 -1
- package/dist/chunks/update.mjs +17 -15
- package/dist/cli.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/ccjk.0aJQmVxS.mjs +336 -0
- package/dist/shared/ccjk.C3o4BXvM.mjs +444 -0
- package/dist/shared/{ccjk.DfZKjHvG.mjs → ccjk.Dgq22o6V.mjs} +2 -438
- package/dist/shared/{ccjk.KpFl2RDA.mjs → ccjk.LTONy3IS.mjs} +4 -3
- package/dist/shared/ccjk.Si-T_ccK.mjs +75 -0
- package/dist/shared/{ccjk.I6IuYdc_.mjs → ccjk.Xla_pE3y.mjs} +1 -1
- package/dist/shared/{ccjk.DZ4ehAHg.mjs → ccjk.byom1b8z.mjs} +1 -1
- package/package.json +1 -1
|
@@ -79,13 +79,13 @@ async function runOnboardingWizard(options = {}) {
|
|
|
79
79
|
console.log(a.bold(`${isZh ? "\u6B65\u9AA4 2/3" : "Step 2/3"}: ${isZh ? "API \u914D\u7F6E" : "API Configuration"}${step2Done ? a.green(" \u2714") : ""}`));
|
|
80
80
|
if (!step2Done) {
|
|
81
81
|
try {
|
|
82
|
-
const { getExistingApiConfig } = await import('./
|
|
82
|
+
const { getExistingApiConfig } = await import('./config2.mjs').then(function (n) { return n.k; });
|
|
83
83
|
const existing = getExistingApiConfig();
|
|
84
84
|
if (existing?.key || existing?.url) {
|
|
85
85
|
console.log(a.green(` \u2714 ${isZh ? "\u5DF2\u914D\u7F6E" : "Already configured"}`));
|
|
86
86
|
completedSteps.add(2);
|
|
87
87
|
} else {
|
|
88
|
-
const { configureApiFeature } = await import('./
|
|
88
|
+
const { configureApiFeature } = await import('./features.mjs');
|
|
89
89
|
await configureApiFeature();
|
|
90
90
|
completedSteps.add(2);
|
|
91
91
|
}
|
package/dist/chunks/package.mjs
CHANGED
package/dist/chunks/platform.mjs
CHANGED
|
@@ -388,4 +388,4 @@ const platform = {
|
|
|
388
388
|
wrapCommandWithSudo: wrapCommandWithSudo
|
|
389
389
|
};
|
|
390
390
|
|
|
391
|
-
export { getHomebrewCommandPaths as a,
|
|
391
|
+
export { getHomebrewCommandPaths as a, isTermux as b, getTermuxPrefix as c, isWSL as d, getWSLInfo as e, findCommandPath as f, getPlatform as g, commandExists as h, isWindows as i, getRecommendedInstallMethods as j, findRealCommandPath as k, getSystemRoot as l, getMcpCommand as m, normalizeTomlPath as n, platform as p, shouldUseSudoForGlobalInstall as s, wrapCommandWithSudo as w };
|
|
@@ -4,7 +4,7 @@ import { d as detectSmartDefaults } from './smart-defaults.mjs';
|
|
|
4
4
|
import { i18n } from './index5.mjs';
|
|
5
5
|
import { updateZcfConfig } from './ccjk-config.mjs';
|
|
6
6
|
import { g as getRuntimeVersion } from '../shared/ccjk.gDEDGD_t.mjs';
|
|
7
|
-
import {
|
|
7
|
+
import { init } from './init.mjs';
|
|
8
8
|
import '../shared/ccjk.BAGoDD49.mjs';
|
|
9
9
|
import 'node:readline';
|
|
10
10
|
import 'stream';
|
|
@@ -37,23 +37,26 @@ import '../shared/ccjk.DJuyfrlL.mjs';
|
|
|
37
37
|
import 'node:url';
|
|
38
38
|
import '../shared/ccjk.BBtCGd_g.mjs';
|
|
39
39
|
import './index6.mjs';
|
|
40
|
-
import '
|
|
41
|
-
import '
|
|
42
|
-
import '
|
|
43
|
-
import '../shared/ccjk.CxpGa6MC.mjs';
|
|
40
|
+
import '../shared/ccjk.0aJQmVxS.mjs';
|
|
41
|
+
import '../shared/ccjk.C3o4BXvM.mjs';
|
|
42
|
+
import './banner.mjs';
|
|
44
43
|
import './config.mjs';
|
|
45
44
|
import './claude-config.mjs';
|
|
45
|
+
import './config2.mjs';
|
|
46
46
|
import '../shared/ccjk.DScm_NnL.mjs';
|
|
47
|
-
import '../shared/ccjk.BFQ7yr5S.mjs';
|
|
48
|
-
import './prompts.mjs';
|
|
49
47
|
import '../shared/ccjk.BWFpnOr3.mjs';
|
|
50
|
-
import '../shared/ccjk.
|
|
51
|
-
import '
|
|
52
|
-
import './config2.mjs';
|
|
48
|
+
import '../shared/ccjk.DeWpAShp.mjs';
|
|
49
|
+
import '../shared/ccjk.Si-T_ccK.mjs';
|
|
53
50
|
import './auto-updater.mjs';
|
|
51
|
+
import './index7.mjs';
|
|
54
52
|
import './version-checker.mjs';
|
|
53
|
+
import '../shared/ccjk.CxpGa6MC.mjs';
|
|
54
|
+
import './codex.mjs';
|
|
55
|
+
import '../shared/ccjk.BFQ7yr5S.mjs';
|
|
56
|
+
import './prompts.mjs';
|
|
55
57
|
import '../shared/ccjk.Cjj8SVrn.mjs';
|
|
56
|
-
import '../shared/ccjk.
|
|
58
|
+
import '../shared/ccjk.byom1b8z.mjs';
|
|
59
|
+
import '../shared/ccjk.Dgq22o6V.mjs';
|
|
57
60
|
import '../shared/ccjk.BIxuVL3_.mjs';
|
|
58
61
|
import './installer.mjs';
|
|
59
62
|
import '../shared/ccjk._dESH4Rk.mjs';
|
|
@@ -122,7 +122,7 @@ function getSlashCommands() {
|
|
|
122
122
|
descriptionZh: "\u521B\u5EFA\u914D\u7F6E\u5907\u4EFD",
|
|
123
123
|
category: "system",
|
|
124
124
|
handler: async () => {
|
|
125
|
-
const { backupExistingConfig } = await import('./
|
|
125
|
+
const { backupExistingConfig } = await import('./config2.mjs').then(function (n) { return n.k; });
|
|
126
126
|
const backupPath = backupExistingConfig();
|
|
127
127
|
if (backupPath) {
|
|
128
128
|
console.log(a.green(`\u2705 Backup created: ${backupPath}`));
|
|
@@ -614,7 +614,7 @@ async function uninstall(options = {}) {
|
|
|
614
614
|
}
|
|
615
615
|
const uninstaller = new ZcfUninstaller(options.lang || "en");
|
|
616
616
|
if (codeType === "codex") {
|
|
617
|
-
const { runCodexUninstall } = await import('./codex.mjs').then(function (n) { return n.
|
|
617
|
+
const { runCodexUninstall } = await import('./codex.mjs').then(function (n) { return n.i; });
|
|
618
618
|
await runCodexUninstall();
|
|
619
619
|
return;
|
|
620
620
|
}
|
package/dist/chunks/update.mjs
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import a from './index2.mjs';
|
|
3
3
|
import { i as inquirer } from './index3.mjs';
|
|
4
|
-
import {
|
|
4
|
+
import { M as MCP_SERVICE_CONFIGS, g as getMcpServices } from '../shared/ccjk.0aJQmVxS.mjs';
|
|
5
5
|
import { SETTINGS_FILE, DEFAULT_CODE_TOOL_TYPE, resolveCodeToolType as resolveCodeToolType$1, isCodeToolType } from './constants.mjs';
|
|
6
6
|
import { i18n } from './index5.mjs';
|
|
7
7
|
import { displayBanner } from './banner.mjs';
|
|
8
8
|
import { readZcfConfig, updateZcfConfig } from './ccjk-config.mjs';
|
|
9
9
|
import { r as readMcpConfig } from './claude-config.mjs';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { r as runCodexUpdate } from './codex.mjs';
|
|
11
|
+
import { c as copyConfigFiles } from './config2.mjs';
|
|
12
|
+
import { n as needsMigration, m as migrateSettingsForTokenRetrieval, d as displayMigrationResult, p as promptMigration } from '../shared/ccjk.byom1b8z.mjs';
|
|
13
|
+
import { u as updatePromptOnly } from '../shared/ccjk.Dgq22o6V.mjs';
|
|
13
14
|
import { h as handleExitPromptError, a as handleGeneralError } from '../shared/ccjk.BIxuVL3_.mjs';
|
|
14
|
-
import { a as installMcpServices } from '../shared/ccjk.
|
|
15
|
+
import { a as installMcpServices } from '../shared/ccjk.LTONy3IS.mjs';
|
|
15
16
|
import { resolveAiOutputLanguage } from './prompts.mjs';
|
|
16
17
|
import { g as getRuntimeVersion } from '../shared/ccjk.gDEDGD_t.mjs';
|
|
17
18
|
import { checkClaudeCodeVersionAndPrompt } from './version-checker.mjs';
|
|
19
|
+
import { s as selectAndInstallWorkflows } from '../shared/ccjk.C3o4BXvM.mjs';
|
|
18
20
|
import '../shared/ccjk.BAGoDD49.mjs';
|
|
19
21
|
import 'node:readline';
|
|
20
22
|
import 'stream';
|
|
@@ -31,24 +33,24 @@ import 'node:os';
|
|
|
31
33
|
import 'node:crypto';
|
|
32
34
|
import 'buffer';
|
|
33
35
|
import 'string_decoder';
|
|
36
|
+
import 'node:child_process';
|
|
37
|
+
import '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
34
38
|
import 'node:url';
|
|
35
|
-
import '../shared/ccjk.RyizuzOI.mjs';
|
|
36
|
-
import './index7.mjs';
|
|
37
|
-
import '../shared/ccjk.DeWpAShp.mjs';
|
|
38
|
-
import '../shared/ccjk.CxpGa6MC.mjs';
|
|
39
39
|
import '../shared/ccjk.BBtCGd_g.mjs';
|
|
40
|
-
import './
|
|
41
|
-
import 'module';
|
|
42
|
-
import 'node:child_process';
|
|
43
|
-
import 'node:stream';
|
|
40
|
+
import './index6.mjs';
|
|
44
41
|
import './fs-operations.mjs';
|
|
45
42
|
import 'node:fs/promises';
|
|
46
|
-
import '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
47
43
|
import './json-config.mjs';
|
|
44
|
+
import '../shared/ccjk.RyizuzOI.mjs';
|
|
48
45
|
import './platform.mjs';
|
|
46
|
+
import './main.mjs';
|
|
47
|
+
import 'module';
|
|
48
|
+
import 'node:stream';
|
|
49
|
+
import './index7.mjs';
|
|
50
|
+
import '../shared/ccjk.DeWpAShp.mjs';
|
|
51
|
+
import '../shared/ccjk.CxpGa6MC.mjs';
|
|
49
52
|
import '../shared/ccjk.BFQ7yr5S.mjs';
|
|
50
53
|
import '../shared/ccjk.BWFpnOr3.mjs';
|
|
51
|
-
import './index6.mjs';
|
|
52
54
|
import '../shared/ccjk.DScm_NnL.mjs';
|
|
53
55
|
|
|
54
56
|
const ccjkVersion = getRuntimeVersion();
|
package/dist/cli.mjs
CHANGED
|
@@ -39,7 +39,7 @@ const COMMANDS = [
|
|
|
39
39
|
{ flags: "--yes, -y", description: "Skip confirmation prompts (auto-confirm)" }
|
|
40
40
|
],
|
|
41
41
|
loader: async () => {
|
|
42
|
-
const { init } = await import('./chunks/init.mjs')
|
|
42
|
+
const { init } = await import('./chunks/init.mjs');
|
|
43
43
|
return async (options) => {
|
|
44
44
|
await init(options);
|
|
45
45
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import { promisify } from 'node:util';
|
|
|
13
13
|
import a from './chunks/index2.mjs';
|
|
14
14
|
import { g as getRuntimeVersion } from './shared/ccjk.gDEDGD_t.mjs';
|
|
15
15
|
import { j as join$1 } from './shared/ccjk.bQ7Dh1g4.mjs';
|
|
16
|
-
export { k as config } from './chunks/
|
|
16
|
+
export { k as config } from './chunks/config2.mjs';
|
|
17
17
|
export { a as loggerUtils } from './shared/ccjk.BJMRY2Ra.mjs';
|
|
18
18
|
export { p as platform } from './chunks/platform.mjs';
|
|
19
19
|
import { Transform } from 'node:stream';
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import a from '../chunks/index2.mjs';
|
|
2
|
+
import { i as inquirer } from '../chunks/index3.mjs';
|
|
3
|
+
import 'node:child_process';
|
|
4
|
+
import { homedir } from 'node:os';
|
|
5
|
+
import process__default from 'node:process';
|
|
6
|
+
import { ensureI18nInitialized, i18n } from '../chunks/index5.mjs';
|
|
7
|
+
import { j as join } from './ccjk.bQ7Dh1g4.mjs';
|
|
8
|
+
|
|
9
|
+
const PLAYWRIGHT_PROFILES_DIR = join(homedir(), ".ccjk", "playwright");
|
|
10
|
+
function createPlaywrightMcpConfig(options = {}) {
|
|
11
|
+
const {
|
|
12
|
+
profile = "default",
|
|
13
|
+
headless = false,
|
|
14
|
+
browser = "chromium",
|
|
15
|
+
userDataDir
|
|
16
|
+
} = options;
|
|
17
|
+
const resolvedUserDataDir = userDataDir || join(PLAYWRIGHT_PROFILES_DIR, profile);
|
|
18
|
+
const args = ["-y", "@playwright/mcp@latest"];
|
|
19
|
+
args.push("--browser", browser);
|
|
20
|
+
args.push("--user-data-dir", resolvedUserDataDir);
|
|
21
|
+
if (headless) {
|
|
22
|
+
args.push("--headless");
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
type: "stdio",
|
|
26
|
+
command: "npx",
|
|
27
|
+
args,
|
|
28
|
+
env: {}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const MCP_SERVICE_CONFIGS = [
|
|
32
|
+
// Documentation and Search Services - Universal (no GUI required)
|
|
33
|
+
{
|
|
34
|
+
id: "context7",
|
|
35
|
+
requiresApiKey: false,
|
|
36
|
+
config: {
|
|
37
|
+
type: "stdio",
|
|
38
|
+
command: "npx",
|
|
39
|
+
args: ["-y", "@upstash/context7-mcp@latest"],
|
|
40
|
+
env: {}
|
|
41
|
+
}
|
|
42
|
+
// Works on all platforms - no special requirements
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "open-websearch",
|
|
46
|
+
requiresApiKey: false,
|
|
47
|
+
config: {
|
|
48
|
+
type: "stdio",
|
|
49
|
+
command: "npx",
|
|
50
|
+
args: ["-y", "open-websearch@latest"],
|
|
51
|
+
env: {
|
|
52
|
+
MODE: "stdio",
|
|
53
|
+
DEFAULT_SEARCH_ENGINE: "duckduckgo",
|
|
54
|
+
ALLOWED_SEARCH_ENGINES: "duckduckgo,bing,brave"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// Works on all platforms - no special requirements
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "mcp-deepwiki",
|
|
61
|
+
requiresApiKey: false,
|
|
62
|
+
config: {
|
|
63
|
+
type: "stdio",
|
|
64
|
+
command: "npx",
|
|
65
|
+
args: ["-y", "mcp-deepwiki@latest"],
|
|
66
|
+
env: {}
|
|
67
|
+
}
|
|
68
|
+
// Works on all platforms - no special requirements
|
|
69
|
+
},
|
|
70
|
+
// Development Workflow Services
|
|
71
|
+
{
|
|
72
|
+
id: "spec-workflow",
|
|
73
|
+
requiresApiKey: false,
|
|
74
|
+
config: {
|
|
75
|
+
type: "stdio",
|
|
76
|
+
command: "npx",
|
|
77
|
+
args: ["-y", "@pimzino/spec-workflow-mcp@latest"],
|
|
78
|
+
env: {}
|
|
79
|
+
}
|
|
80
|
+
// Works on all platforms - no special requirements
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: "serena",
|
|
84
|
+
requiresApiKey: false,
|
|
85
|
+
config: {
|
|
86
|
+
type: "stdio",
|
|
87
|
+
command: "uvx",
|
|
88
|
+
args: ["--from", "git+https://github.com/oraios/serena", "serena", "start-mcp-server", "--context", "ide-assistant", "--enable-web-dashboard", "false"],
|
|
89
|
+
env: {}
|
|
90
|
+
},
|
|
91
|
+
platformRequirements: {
|
|
92
|
+
requiredCommands: ["uvx"]
|
|
93
|
+
// Requires uv/uvx to be installed
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
// Browser and Automation Services - Require GUI environment
|
|
97
|
+
{
|
|
98
|
+
id: "Playwright",
|
|
99
|
+
requiresApiKey: false,
|
|
100
|
+
config: createPlaywrightMcpConfig(),
|
|
101
|
+
// Uses default profile with chromium browser
|
|
102
|
+
platformRequirements: {
|
|
103
|
+
platforms: ["macos", "windows"],
|
|
104
|
+
// GUI required - exclude headless Linux/WSL/Termux
|
|
105
|
+
requiresGui: true
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
// Cross-session Memory Services
|
|
109
|
+
{
|
|
110
|
+
id: "intent-engine",
|
|
111
|
+
requiresApiKey: false,
|
|
112
|
+
defaultSelected: true,
|
|
113
|
+
config: {
|
|
114
|
+
type: "stdio",
|
|
115
|
+
command: "npx",
|
|
116
|
+
args: ["-y", "@origintask/intent-engine@latest", "mcp"],
|
|
117
|
+
env: {}
|
|
118
|
+
}
|
|
119
|
+
// Works on all platforms - no special requirements
|
|
120
|
+
},
|
|
121
|
+
// Anthropic Official MCP Services - Universal
|
|
122
|
+
// Note: Removed low-value services: filesystem (buggy), puppeteer (duplicate of Playwright),
|
|
123
|
+
// memory (Claude has built-in memory), fetch (Claude has WebFetch), sequential-thinking (limited value)
|
|
124
|
+
{
|
|
125
|
+
id: "sqlite",
|
|
126
|
+
requiresApiKey: false,
|
|
127
|
+
config: {
|
|
128
|
+
type: "stdio",
|
|
129
|
+
command: "npx",
|
|
130
|
+
args: ["-y", "@anthropic-ai/mcp-server-sqlite@latest"],
|
|
131
|
+
env: {}
|
|
132
|
+
}
|
|
133
|
+
// Works on all platforms - no special requirements
|
|
134
|
+
}
|
|
135
|
+
];
|
|
136
|
+
async function getMcpServices() {
|
|
137
|
+
ensureI18nInitialized();
|
|
138
|
+
const mcpServiceList = [
|
|
139
|
+
// Documentation and Search Services
|
|
140
|
+
{
|
|
141
|
+
id: "context7",
|
|
142
|
+
name: i18n.t("mcp:services.context7.name"),
|
|
143
|
+
description: i18n.t("mcp:services.context7.description")
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: "open-websearch",
|
|
147
|
+
name: i18n.t("mcp:services.open-websearch.name"),
|
|
148
|
+
description: i18n.t("mcp:services.open-websearch.description")
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
id: "mcp-deepwiki",
|
|
152
|
+
name: i18n.t("mcp:services.mcp-deepwiki.name"),
|
|
153
|
+
description: i18n.t("mcp:services.mcp-deepwiki.description")
|
|
154
|
+
},
|
|
155
|
+
// Development Workflow Services
|
|
156
|
+
{
|
|
157
|
+
id: "spec-workflow",
|
|
158
|
+
name: i18n.t("mcp:services.spec-workflow.name"),
|
|
159
|
+
description: i18n.t("mcp:services.spec-workflow.description")
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
id: "serena",
|
|
163
|
+
name: i18n.t("mcp:services.serena.name"),
|
|
164
|
+
description: i18n.t("mcp:services.serena.description")
|
|
165
|
+
},
|
|
166
|
+
// Browser and Automation Services
|
|
167
|
+
{
|
|
168
|
+
id: "Playwright",
|
|
169
|
+
name: i18n.t("mcp:services.playwright.name"),
|
|
170
|
+
description: i18n.t("mcp:services.playwright.description")
|
|
171
|
+
},
|
|
172
|
+
// Cross-session Memory Services
|
|
173
|
+
{
|
|
174
|
+
id: "intent-engine",
|
|
175
|
+
name: i18n.t("mcp:services.intent-engine.name"),
|
|
176
|
+
description: i18n.t("mcp:services.intent-engine.description")
|
|
177
|
+
},
|
|
178
|
+
// Anthropic Official MCP Services
|
|
179
|
+
// Note: Removed low-value services: filesystem (buggy), puppeteer (duplicate),
|
|
180
|
+
// memory (Claude built-in), fetch (Claude WebFetch), sequential-thinking (limited value)
|
|
181
|
+
{
|
|
182
|
+
id: "sqlite",
|
|
183
|
+
name: i18n.t("mcp:services.sqlite.name"),
|
|
184
|
+
description: i18n.t("mcp:services.sqlite.description")
|
|
185
|
+
}
|
|
186
|
+
];
|
|
187
|
+
return MCP_SERVICE_CONFIGS.map((config) => {
|
|
188
|
+
const serviceInfo = mcpServiceList.find((s) => s.id === config.id);
|
|
189
|
+
const service = {
|
|
190
|
+
id: config.id,
|
|
191
|
+
name: serviceInfo?.name || config.id,
|
|
192
|
+
description: serviceInfo?.description || "",
|
|
193
|
+
requiresApiKey: config.requiresApiKey,
|
|
194
|
+
config: config.config
|
|
195
|
+
};
|
|
196
|
+
if (config.apiKeyEnvVar) {
|
|
197
|
+
service.apiKeyEnvVar = config.apiKeyEnvVar;
|
|
198
|
+
}
|
|
199
|
+
return service;
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
async function getMcpService(id) {
|
|
203
|
+
const services = await getMcpServices();
|
|
204
|
+
return services.find((service) => service.id === id);
|
|
205
|
+
}
|
|
206
|
+
const DEFAULT_MCP_TOOL_SEARCH_CONFIG = {
|
|
207
|
+
mcpAutoEnableThreshold: 10,
|
|
208
|
+
excludedServices: ["mcp-search", "context7", "sqlite"]
|
|
209
|
+
};
|
|
210
|
+
function getMcpToolSearchConfig() {
|
|
211
|
+
const env = process__default.env;
|
|
212
|
+
return {
|
|
213
|
+
mcpAutoEnableThreshold: env.MCP_AUTO_THRESHOLD || DEFAULT_MCP_TOOL_SEARCH_CONFIG.mcpAutoEnableThreshold,
|
|
214
|
+
dynamicServiceDiscovery: env.MCP_DYNAMIC_DISCOVERY !== "false",
|
|
215
|
+
listChangedNotifications: env.MCP_LIST_CHANGED !== "false",
|
|
216
|
+
excludedServices: env.MCP_EXCLUDED_SERVICES?.split(",").map((s) => s.trim()).filter(Boolean) || DEFAULT_MCP_TOOL_SEARCH_CONFIG.excludedServices
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
class DynamicMcpServiceRegistry {
|
|
220
|
+
_services = /* @__PURE__ */ new Map();
|
|
221
|
+
_listeners = /* @__PURE__ */ new Set();
|
|
222
|
+
_enabled = false;
|
|
223
|
+
/**
|
|
224
|
+
* Enable dynamic service discovery
|
|
225
|
+
*/
|
|
226
|
+
enable() {
|
|
227
|
+
this._enabled = true;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Disable dynamic service discovery
|
|
231
|
+
*/
|
|
232
|
+
disable() {
|
|
233
|
+
this._enabled = false;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Check if dynamic discovery is enabled
|
|
237
|
+
*/
|
|
238
|
+
isEnabled() {
|
|
239
|
+
return this._enabled;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Add a service dynamically
|
|
243
|
+
*/
|
|
244
|
+
addService(serviceId, config) {
|
|
245
|
+
if (!this._enabled) {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
const isUpdate = this._services.has(serviceId);
|
|
249
|
+
this._services.set(serviceId, config);
|
|
250
|
+
this._notify({
|
|
251
|
+
type: isUpdate ? "updated" : "added",
|
|
252
|
+
serviceId,
|
|
253
|
+
timestamp: Date.now(),
|
|
254
|
+
config
|
|
255
|
+
});
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Remove a service dynamically
|
|
260
|
+
*/
|
|
261
|
+
removeService(serviceId) {
|
|
262
|
+
if (!this._enabled || !this._services.has(serviceId)) {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
const config = this._services.get(serviceId);
|
|
266
|
+
this._services.delete(serviceId);
|
|
267
|
+
this._notify({
|
|
268
|
+
type: "removed",
|
|
269
|
+
serviceId,
|
|
270
|
+
timestamp: Date.now(),
|
|
271
|
+
config
|
|
272
|
+
});
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Get a service configuration
|
|
277
|
+
*/
|
|
278
|
+
getService(serviceId) {
|
|
279
|
+
return this._services.get(serviceId);
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* List all dynamically registered services
|
|
283
|
+
*/
|
|
284
|
+
listServices() {
|
|
285
|
+
return new Map(this._services);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Subscribe to list change notifications
|
|
289
|
+
*/
|
|
290
|
+
subscribe(listener) {
|
|
291
|
+
this._listeners.add(listener);
|
|
292
|
+
return () => this._listeners.delete(listener);
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Notify all listeners of a change
|
|
296
|
+
*/
|
|
297
|
+
_notify(notification) {
|
|
298
|
+
const toolSearchConfig = getMcpToolSearchConfig();
|
|
299
|
+
if (toolSearchConfig.listChangedNotifications) {
|
|
300
|
+
for (const listener of Array.from(this._listeners)) {
|
|
301
|
+
try {
|
|
302
|
+
listener(notification);
|
|
303
|
+
} catch (error) {
|
|
304
|
+
console.error("Error notifying MCP list change listener:", error);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
const dynamicMcpRegistry = new DynamicMcpServiceRegistry();
|
|
311
|
+
|
|
312
|
+
async function selectMcpServices() {
|
|
313
|
+
ensureI18nInitialized();
|
|
314
|
+
const mcpServices = await getMcpServices();
|
|
315
|
+
const defaultSelectedIds = new Set(
|
|
316
|
+
MCP_SERVICE_CONFIGS.filter((c) => c.defaultSelected).map((c) => c.id)
|
|
317
|
+
);
|
|
318
|
+
const choices = mcpServices.map((service) => ({
|
|
319
|
+
name: `${service.name} - ${a.gray(service.description)}`,
|
|
320
|
+
value: service.id,
|
|
321
|
+
checked: defaultSelectedIds.has(service.id)
|
|
322
|
+
}));
|
|
323
|
+
const { services } = await inquirer.prompt({
|
|
324
|
+
type: "checkbox",
|
|
325
|
+
name: "services",
|
|
326
|
+
message: `${i18n.t("mcp:selectMcpServices")}${i18n.t("common:multiSelectHint")}`,
|
|
327
|
+
choices
|
|
328
|
+
});
|
|
329
|
+
if (services === void 0) {
|
|
330
|
+
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
331
|
+
return void 0;
|
|
332
|
+
}
|
|
333
|
+
return services;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export { MCP_SERVICE_CONFIGS as M, getMcpService as a, dynamicMcpRegistry as d, getMcpServices as g, selectMcpServices as s };
|