rulesync 0.58.0 → 0.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-7E4U4YAB.js → chunk-3YQ42A7G.js} +1 -1
- package/dist/{chunk-WAX2UANS.js → chunk-5SRMJNDW.js} +1 -1
- package/dist/{chunk-7UBF4OLN.js → chunk-DJWXF2WO.js} +1 -1
- package/dist/{chunk-VKNCBVZF.js → chunk-EG7LNNMW.js} +1 -1
- package/dist/{chunk-OA473EXZ.js → chunk-LIV53UU5.js} +1 -1
- package/dist/{chunk-J3TBR5EP.js → chunk-OCK47GE7.js} +1 -1
- package/dist/{chunk-VNT6AHHO.js → chunk-S3GB3VQK.js} +1 -1
- package/dist/{chunk-W2WU253H.js → chunk-VYO76WDU.js} +1 -1
- package/dist/{claudecode-VVI2PTKI.js → claudecode-CRSXMPS5.js} +2 -2
- package/dist/{cline-BJLFSLEB.js → cline-O67TEUFW.js} +2 -2
- package/dist/{codexcli-LKWQB3V3.js → codexcli-S7VDKBI2.js} +2 -2
- package/dist/{cursor-2BVUO64T.js → cursor-EXX2Q5MB.js} +2 -2
- package/dist/{geminicli-5YFMKRFL.js → geminicli-K3FKXDKP.js} +2 -2
- package/dist/index.cjs +430 -134
- package/dist/index.js +81 -167
- package/dist/{junie-5TDJPUXX.js → junie-4SNWC452.js} +2 -2
- package/dist/{windsurf-PXDRIQ76.js → windsurf-NVCRKFHF.js} +2 -2
- package/package.json +1 -1
|
@@ -97,7 +97,7 @@ var configWrappers = {
|
|
|
97
97
|
var MCP_GENERATOR_REGISTRY = {
|
|
98
98
|
claudecode: {
|
|
99
99
|
target: "claudecode",
|
|
100
|
-
configPaths: [".
|
|
100
|
+
configPaths: [".mcp.json"],
|
|
101
101
|
serverTransform: (server) => {
|
|
102
102
|
const claudeServer = {};
|
|
103
103
|
if (server.command) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generateGeminiCliMcp,
|
|
3
3
|
generateGeminiCliMcpConfiguration
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-5SRMJNDW.js";
|
|
5
|
+
import "./chunk-OCK47GE7.js";
|
|
6
6
|
import "./chunk-AUUSMVCT.js";
|
|
7
7
|
export {
|
|
8
8
|
generateGeminiCliMcp,
|
package/dist/index.cjs
CHANGED
|
@@ -9,6 +9,10 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
9
9
|
var __esm = (fn, res) => function __init() {
|
|
10
10
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
11
11
|
};
|
|
12
|
+
var __export = (target, all) => {
|
|
13
|
+
for (var name in all)
|
|
14
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
+
};
|
|
12
16
|
var __copyProps = (to, from, except, desc) => {
|
|
13
17
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
18
|
for (let key of __getOwnPropNames(from))
|
|
@@ -82,6 +86,11 @@ var init_mcp_helpers = __esm({
|
|
|
82
86
|
});
|
|
83
87
|
|
|
84
88
|
// src/generators/mcp/augmentcode.ts
|
|
89
|
+
var augmentcode_exports = {};
|
|
90
|
+
__export(augmentcode_exports, {
|
|
91
|
+
generateAugmentcodeMcp: () => generateAugmentcodeMcp,
|
|
92
|
+
generateAugmentcodeMcpConfiguration: () => generateAugmentcodeMcpConfiguration
|
|
93
|
+
});
|
|
85
94
|
function generateAugmentcodeMcp(config) {
|
|
86
95
|
const augmentSettings = {
|
|
87
96
|
mcpServers: []
|
|
@@ -131,6 +140,58 @@ function generateAugmentcodeMcp(config) {
|
|
|
131
140
|
}
|
|
132
141
|
return JSON.stringify(augmentSettings, null, 2);
|
|
133
142
|
}
|
|
143
|
+
function generateAugmentcodeMcpConfiguration(mcpServers, baseDir = "") {
|
|
144
|
+
const filepath = baseDir ? `${baseDir}/.mcp.json` : ".mcp.json";
|
|
145
|
+
const settings = {
|
|
146
|
+
mcpServers: {}
|
|
147
|
+
};
|
|
148
|
+
for (const [serverName, server] of Object.entries(mcpServers)) {
|
|
149
|
+
if (!shouldIncludeServer(server, "augmentcode")) {
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
const { targets: _, ...serverConfig } = server;
|
|
153
|
+
const augmentServer = {};
|
|
154
|
+
if (serverConfig.command) {
|
|
155
|
+
augmentServer.command = serverConfig.command;
|
|
156
|
+
if (serverConfig.args) {
|
|
157
|
+
augmentServer.args = serverConfig.args;
|
|
158
|
+
}
|
|
159
|
+
if (serverConfig.env) {
|
|
160
|
+
augmentServer.env = serverConfig.env;
|
|
161
|
+
}
|
|
162
|
+
} else if (serverConfig.url || serverConfig.httpUrl) {
|
|
163
|
+
const url = serverConfig.httpUrl || serverConfig.url;
|
|
164
|
+
if (url) {
|
|
165
|
+
augmentServer.url = url;
|
|
166
|
+
}
|
|
167
|
+
if (serverConfig.httpUrl || serverConfig.transport === "http") {
|
|
168
|
+
augmentServer.transport = "http";
|
|
169
|
+
} else if (serverConfig.transport === "sse") {
|
|
170
|
+
augmentServer.transport = "sse";
|
|
171
|
+
}
|
|
172
|
+
if (serverConfig.env) {
|
|
173
|
+
augmentServer.headers = serverConfig.env;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (serverConfig.timeout) {
|
|
177
|
+
augmentServer.timeout = serverConfig.timeout;
|
|
178
|
+
}
|
|
179
|
+
if (serverConfig.disabled !== void 0) {
|
|
180
|
+
augmentServer.enabled = !serverConfig.disabled;
|
|
181
|
+
}
|
|
182
|
+
if (serverConfig.networkTimeout && serverConfig.networkTimeout > 0) {
|
|
183
|
+
augmentServer.retries = Math.max(1, Math.floor(serverConfig.networkTimeout / 3e4));
|
|
184
|
+
}
|
|
185
|
+
settings.mcpServers[serverName] = augmentServer;
|
|
186
|
+
}
|
|
187
|
+
return [
|
|
188
|
+
{
|
|
189
|
+
filepath,
|
|
190
|
+
content: `${JSON.stringify(settings, null, 2)}
|
|
191
|
+
`
|
|
192
|
+
}
|
|
193
|
+
];
|
|
194
|
+
}
|
|
134
195
|
var init_augmentcode = __esm({
|
|
135
196
|
"src/generators/mcp/augmentcode.ts"() {
|
|
136
197
|
"use strict";
|
|
@@ -148,6 +209,20 @@ function generateMcpConfig(config, toolConfig) {
|
|
|
148
209
|
const finalConfig = toolConfig.configWrapper(servers);
|
|
149
210
|
return JSON.stringify(finalConfig, null, 2);
|
|
150
211
|
}
|
|
212
|
+
function generateMcpConfigurationFiles(mcpServers, toolConfig, baseDir = "") {
|
|
213
|
+
const configs = [];
|
|
214
|
+
const rulesyncConfig = { mcpServers };
|
|
215
|
+
for (const configPath of toolConfig.configPaths) {
|
|
216
|
+
const filepath = baseDir ? `${baseDir}/${configPath}` : configPath;
|
|
217
|
+
const content = generateMcpConfig(rulesyncConfig, toolConfig);
|
|
218
|
+
configs.push({
|
|
219
|
+
filepath,
|
|
220
|
+
content: `${content}
|
|
221
|
+
`
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
return configs;
|
|
225
|
+
}
|
|
151
226
|
function generateMcpFromRegistry(tool, config) {
|
|
152
227
|
const generatorConfig = MCP_GENERATOR_REGISTRY[tool];
|
|
153
228
|
if (!generatorConfig) {
|
|
@@ -155,6 +230,58 @@ function generateMcpFromRegistry(tool, config) {
|
|
|
155
230
|
}
|
|
156
231
|
return generateMcpConfig(config, generatorConfig);
|
|
157
232
|
}
|
|
233
|
+
function generateMcpConfigurationFilesFromRegistry(tool, mcpServers, baseDir = "") {
|
|
234
|
+
const generatorConfig = MCP_GENERATOR_REGISTRY[tool];
|
|
235
|
+
if (!generatorConfig) {
|
|
236
|
+
throw new Error(`No MCP generator configuration found for tool: ${tool}`);
|
|
237
|
+
}
|
|
238
|
+
if (tool === "junie") {
|
|
239
|
+
return generateJunieMcpConfigurationFiles(mcpServers, baseDir);
|
|
240
|
+
}
|
|
241
|
+
const customTools = ["copilot", "augmentcode", "roo", "codexcli", "kiro", "geminicli"];
|
|
242
|
+
if (customTools.includes(tool)) {
|
|
243
|
+
throw new Error(
|
|
244
|
+
`Tool ${tool} uses custom configuration logic - use its specific generator function instead`
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
return generateMcpConfigurationFiles(mcpServers, generatorConfig, baseDir);
|
|
248
|
+
}
|
|
249
|
+
function generateJunieMcpConfigurationFiles(mcpServers, baseDir = "") {
|
|
250
|
+
const filepath = baseDir ? `${baseDir}/.junie/mcp-config.json` : ".junie/mcp-config.json";
|
|
251
|
+
const config = {
|
|
252
|
+
mcpServers: {}
|
|
253
|
+
};
|
|
254
|
+
for (const [serverName, server] of Object.entries(mcpServers)) {
|
|
255
|
+
if (!shouldIncludeServer(server, "junie")) {
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
const { targets: _, transport, cwd, ...serverConfig } = server;
|
|
259
|
+
const junieServer = {
|
|
260
|
+
...serverConfig,
|
|
261
|
+
name: serverName
|
|
262
|
+
};
|
|
263
|
+
if (cwd) {
|
|
264
|
+
junieServer.workingDirectory = cwd;
|
|
265
|
+
}
|
|
266
|
+
if (transport) {
|
|
267
|
+
if (String(transport) === "streamable-http") {
|
|
268
|
+
junieServer.transport = "http";
|
|
269
|
+
} else if (transport === "stdio" || transport === "http" || transport === "sse") {
|
|
270
|
+
junieServer.transport = transport;
|
|
271
|
+
}
|
|
272
|
+
} else if (serverConfig.command) {
|
|
273
|
+
junieServer.transport = "stdio";
|
|
274
|
+
}
|
|
275
|
+
config.mcpServers[serverName] = junieServer;
|
|
276
|
+
}
|
|
277
|
+
return [
|
|
278
|
+
{
|
|
279
|
+
filepath,
|
|
280
|
+
content: `${JSON.stringify(config, null, 2)}
|
|
281
|
+
`
|
|
282
|
+
}
|
|
283
|
+
];
|
|
284
|
+
}
|
|
158
285
|
var serverTransforms, configWrappers, MCP_GENERATOR_REGISTRY;
|
|
159
286
|
var init_shared_factory = __esm({
|
|
160
287
|
"src/generators/mcp/shared-factory.ts"() {
|
|
@@ -231,7 +358,7 @@ var init_shared_factory = __esm({
|
|
|
231
358
|
MCP_GENERATOR_REGISTRY = {
|
|
232
359
|
claudecode: {
|
|
233
360
|
target: "claudecode",
|
|
234
|
-
configPaths: [".
|
|
361
|
+
configPaths: [".mcp.json"],
|
|
235
362
|
serverTransform: (server) => {
|
|
236
363
|
const claudeServer = {};
|
|
237
364
|
if (server.command) {
|
|
@@ -361,9 +488,17 @@ var init_shared_factory = __esm({
|
|
|
361
488
|
});
|
|
362
489
|
|
|
363
490
|
// src/generators/mcp/claudecode.ts
|
|
491
|
+
var claudecode_exports = {};
|
|
492
|
+
__export(claudecode_exports, {
|
|
493
|
+
generateClaudeMcp: () => generateClaudeMcp,
|
|
494
|
+
generateClaudeMcpConfiguration: () => generateClaudeMcpConfiguration
|
|
495
|
+
});
|
|
364
496
|
function generateClaudeMcp(config) {
|
|
365
497
|
return generateMcpFromRegistry("claudecode", config);
|
|
366
498
|
}
|
|
499
|
+
function generateClaudeMcpConfiguration(mcpServers, baseDir = "") {
|
|
500
|
+
return generateMcpConfigurationFilesFromRegistry("claudecode", mcpServers, baseDir);
|
|
501
|
+
}
|
|
367
502
|
var init_claudecode = __esm({
|
|
368
503
|
"src/generators/mcp/claudecode.ts"() {
|
|
369
504
|
"use strict";
|
|
@@ -372,9 +507,17 @@ var init_claudecode = __esm({
|
|
|
372
507
|
});
|
|
373
508
|
|
|
374
509
|
// src/generators/mcp/cline.ts
|
|
510
|
+
var cline_exports = {};
|
|
511
|
+
__export(cline_exports, {
|
|
512
|
+
generateClineMcp: () => generateClineMcp,
|
|
513
|
+
generateClineMcpConfiguration: () => generateClineMcpConfiguration
|
|
514
|
+
});
|
|
375
515
|
function generateClineMcp(config) {
|
|
376
516
|
return generateMcpFromRegistry("cline", config);
|
|
377
517
|
}
|
|
518
|
+
function generateClineMcpConfiguration(mcpServers, baseDir = "") {
|
|
519
|
+
return generateMcpConfigurationFilesFromRegistry("cline", mcpServers, baseDir);
|
|
520
|
+
}
|
|
378
521
|
var init_cline = __esm({
|
|
379
522
|
"src/generators/mcp/cline.ts"() {
|
|
380
523
|
"use strict";
|
|
@@ -383,6 +526,11 @@ var init_cline = __esm({
|
|
|
383
526
|
});
|
|
384
527
|
|
|
385
528
|
// src/generators/mcp/codexcli.ts
|
|
529
|
+
var codexcli_exports = {};
|
|
530
|
+
__export(codexcli_exports, {
|
|
531
|
+
generateCodexMcp: () => generateCodexMcp,
|
|
532
|
+
generateCodexMcpConfiguration: () => generateCodexMcpConfiguration
|
|
533
|
+
});
|
|
386
534
|
function generateCodexMcp(config) {
|
|
387
535
|
return generateMcpConfig(config, {
|
|
388
536
|
target: "codexcli",
|
|
@@ -442,6 +590,81 @@ function generateCodexMcp(config) {
|
|
|
442
590
|
})
|
|
443
591
|
});
|
|
444
592
|
}
|
|
593
|
+
function generateCodexMcpConfiguration(mcpServers, baseDir = "") {
|
|
594
|
+
return generateMcpConfigurationFiles(
|
|
595
|
+
mcpServers,
|
|
596
|
+
{
|
|
597
|
+
target: "codexcli",
|
|
598
|
+
configPaths: [".codex/mcp-config.json"],
|
|
599
|
+
serverTransform: (server) => {
|
|
600
|
+
const { targets: _, transport, ...serverConfig } = server;
|
|
601
|
+
const codexServer = {};
|
|
602
|
+
if (serverConfig.command !== void 0) codexServer.command = serverConfig.command;
|
|
603
|
+
if (serverConfig.args !== void 0) codexServer.args = serverConfig.args;
|
|
604
|
+
if (serverConfig.url !== void 0) codexServer.url = serverConfig.url;
|
|
605
|
+
if (serverConfig.httpUrl !== void 0) codexServer.httpUrl = serverConfig.httpUrl;
|
|
606
|
+
if (serverConfig.env !== void 0) codexServer.env = serverConfig.env;
|
|
607
|
+
if (serverConfig.disabled !== void 0) codexServer.disabled = serverConfig.disabled;
|
|
608
|
+
if (serverConfig.networkTimeout !== void 0)
|
|
609
|
+
codexServer.networkTimeout = serverConfig.networkTimeout;
|
|
610
|
+
if (serverConfig.timeout !== void 0) codexServer.timeout = serverConfig.timeout;
|
|
611
|
+
if (serverConfig.trust !== void 0) codexServer.trust = serverConfig.trust;
|
|
612
|
+
if (serverConfig.cwd !== void 0) codexServer.cwd = serverConfig.cwd;
|
|
613
|
+
if (serverConfig.type !== void 0) codexServer.type = serverConfig.type;
|
|
614
|
+
if (serverConfig.alwaysAllow !== void 0)
|
|
615
|
+
codexServer.alwaysAllow = serverConfig.alwaysAllow;
|
|
616
|
+
if (serverConfig.tools !== void 0) codexServer.tools = serverConfig.tools;
|
|
617
|
+
if (serverConfig.kiroAutoApprove !== void 0)
|
|
618
|
+
codexServer.autoApprove = serverConfig.kiroAutoApprove;
|
|
619
|
+
if (serverConfig.kiroAutoBlock !== void 0)
|
|
620
|
+
codexServer.autoBlock = serverConfig.kiroAutoBlock;
|
|
621
|
+
if (serverConfig.headers !== void 0) codexServer.headers = serverConfig.headers;
|
|
622
|
+
if (serverConfig.httpUrl !== void 0) {
|
|
623
|
+
codexServer.url = serverConfig.httpUrl;
|
|
624
|
+
delete codexServer.httpUrl;
|
|
625
|
+
}
|
|
626
|
+
if (transport) {
|
|
627
|
+
codexServer.transport = transport;
|
|
628
|
+
} else if (serverConfig.url && !serverConfig.httpUrl) {
|
|
629
|
+
codexServer.transport = "sse";
|
|
630
|
+
} else {
|
|
631
|
+
codexServer.transport = "stdio";
|
|
632
|
+
}
|
|
633
|
+
if (serverConfig.env) {
|
|
634
|
+
codexServer.env = { ...serverConfig.env };
|
|
635
|
+
if (!codexServer.env.CODEX_DEFAULT_MODEL) {
|
|
636
|
+
codexServer.env.CODEX_DEFAULT_MODEL = "gpt-4o-mini";
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
if (serverConfig.cwd) {
|
|
640
|
+
codexServer.cwd = serverConfig.cwd;
|
|
641
|
+
codexServer.workingDirectory = serverConfig.cwd;
|
|
642
|
+
}
|
|
643
|
+
if (serverConfig.timeout) {
|
|
644
|
+
codexServer.timeout = serverConfig.timeout;
|
|
645
|
+
}
|
|
646
|
+
if (serverConfig.headers) {
|
|
647
|
+
codexServer.headers = serverConfig.headers;
|
|
648
|
+
}
|
|
649
|
+
return codexServer;
|
|
650
|
+
},
|
|
651
|
+
configWrapper: (servers) => ({
|
|
652
|
+
// Configuration format for MCP wrapper servers that integrate with Codex CLI
|
|
653
|
+
servers,
|
|
654
|
+
_comment: "Configuration for MCP wrapper servers like openai-codex-mcp that integrate with Codex CLI",
|
|
655
|
+
_usage: "Use with third-party MCP servers that expose Codex CLI functionality to other MCP clients",
|
|
656
|
+
_examples: {
|
|
657
|
+
python_server: "python -m mcp_server or uvicorn codex_server:app",
|
|
658
|
+
nodejs_server: "node dist/server.js or npm start",
|
|
659
|
+
docker_server: "docker run -i --rm custom/codex-mcp:latest"
|
|
660
|
+
},
|
|
661
|
+
_security_note: "Store API keys in environment variables, not in this configuration file",
|
|
662
|
+
_supported_transports: ["stdio", "sse", "http"]
|
|
663
|
+
})
|
|
664
|
+
},
|
|
665
|
+
baseDir
|
|
666
|
+
);
|
|
667
|
+
}
|
|
445
668
|
var init_codexcli = __esm({
|
|
446
669
|
"src/generators/mcp/codexcli.ts"() {
|
|
447
670
|
"use strict";
|
|
@@ -450,6 +673,11 @@ var init_codexcli = __esm({
|
|
|
450
673
|
});
|
|
451
674
|
|
|
452
675
|
// src/generators/mcp/copilot.ts
|
|
676
|
+
var copilot_exports = {};
|
|
677
|
+
__export(copilot_exports, {
|
|
678
|
+
generateCopilotMcp: () => generateCopilotMcp,
|
|
679
|
+
generateCopilotMcpConfiguration: () => generateCopilotMcpConfiguration
|
|
680
|
+
});
|
|
453
681
|
function generateCopilotMcp(config, target) {
|
|
454
682
|
const servers = {};
|
|
455
683
|
const inputs = [];
|
|
@@ -501,6 +729,23 @@ function generateCopilotMcp(config, target) {
|
|
|
501
729
|
return JSON.stringify(config2, null, 2);
|
|
502
730
|
}
|
|
503
731
|
}
|
|
732
|
+
function generateCopilotMcpConfiguration(mcpServers, baseDir = "") {
|
|
733
|
+
const configs = [];
|
|
734
|
+
const rulesyncConfig = { mcpServers };
|
|
735
|
+
const editorContent = generateCopilotMcp(rulesyncConfig, "editor");
|
|
736
|
+
configs.push({
|
|
737
|
+
filepath: baseDir ? `${baseDir}/.vscode/mcp.json` : ".vscode/mcp.json",
|
|
738
|
+
content: `${editorContent}
|
|
739
|
+
`
|
|
740
|
+
});
|
|
741
|
+
const codingAgentContent = generateCopilotMcp(rulesyncConfig, "codingAgent");
|
|
742
|
+
configs.push({
|
|
743
|
+
filepath: baseDir ? `${baseDir}/.copilot/mcp.json` : ".copilot/mcp.json",
|
|
744
|
+
content: `${codingAgentContent}
|
|
745
|
+
`
|
|
746
|
+
});
|
|
747
|
+
return configs;
|
|
748
|
+
}
|
|
504
749
|
var init_copilot = __esm({
|
|
505
750
|
"src/generators/mcp/copilot.ts"() {
|
|
506
751
|
"use strict";
|
|
@@ -509,9 +754,17 @@ var init_copilot = __esm({
|
|
|
509
754
|
});
|
|
510
755
|
|
|
511
756
|
// src/generators/mcp/cursor.ts
|
|
757
|
+
var cursor_exports = {};
|
|
758
|
+
__export(cursor_exports, {
|
|
759
|
+
generateCursorMcp: () => generateCursorMcp,
|
|
760
|
+
generateCursorMcpConfiguration: () => generateCursorMcpConfiguration
|
|
761
|
+
});
|
|
512
762
|
function generateCursorMcp(config) {
|
|
513
763
|
return generateMcpFromRegistry("cursor", config);
|
|
514
764
|
}
|
|
765
|
+
function generateCursorMcpConfiguration(mcpServers, baseDir = "") {
|
|
766
|
+
return generateMcpConfigurationFilesFromRegistry("cursor", mcpServers, baseDir);
|
|
767
|
+
}
|
|
515
768
|
var init_cursor = __esm({
|
|
516
769
|
"src/generators/mcp/cursor.ts"() {
|
|
517
770
|
"use strict";
|
|
@@ -520,6 +773,11 @@ var init_cursor = __esm({
|
|
|
520
773
|
});
|
|
521
774
|
|
|
522
775
|
// src/generators/mcp/geminicli.ts
|
|
776
|
+
var geminicli_exports = {};
|
|
777
|
+
__export(geminicli_exports, {
|
|
778
|
+
generateGeminiCliMcp: () => generateGeminiCliMcp,
|
|
779
|
+
generateGeminiCliMcpConfiguration: () => generateGeminiCliMcpConfiguration
|
|
780
|
+
});
|
|
523
781
|
function generateGeminiCliMcp(config) {
|
|
524
782
|
return generateMcpConfig(config, {
|
|
525
783
|
target: "geminicli",
|
|
@@ -550,6 +808,25 @@ function generateGeminiCliMcp(config) {
|
|
|
550
808
|
configWrapper: configWrappers.mcpServers
|
|
551
809
|
});
|
|
552
810
|
}
|
|
811
|
+
function generateGeminiCliMcpConfiguration(mcpServers, baseDir = "") {
|
|
812
|
+
return generateMcpConfigurationFiles(
|
|
813
|
+
mcpServers,
|
|
814
|
+
{
|
|
815
|
+
target: "geminicli",
|
|
816
|
+
configPaths: [".gemini/settings.json"],
|
|
817
|
+
serverTransform: (server) => {
|
|
818
|
+
const { targets: _, ...serverConfig } = server;
|
|
819
|
+
const geminiServer = { ...serverConfig };
|
|
820
|
+
if (server.env) {
|
|
821
|
+
geminiServer.env = server.env;
|
|
822
|
+
}
|
|
823
|
+
return geminiServer;
|
|
824
|
+
},
|
|
825
|
+
configWrapper: configWrappers.mcpServers
|
|
826
|
+
},
|
|
827
|
+
baseDir
|
|
828
|
+
);
|
|
829
|
+
}
|
|
553
830
|
var init_geminicli = __esm({
|
|
554
831
|
"src/generators/mcp/geminicli.ts"() {
|
|
555
832
|
"use strict";
|
|
@@ -558,9 +835,17 @@ var init_geminicli = __esm({
|
|
|
558
835
|
});
|
|
559
836
|
|
|
560
837
|
// src/generators/mcp/junie.ts
|
|
838
|
+
var junie_exports = {};
|
|
839
|
+
__export(junie_exports, {
|
|
840
|
+
generateJunieMcp: () => generateJunieMcp,
|
|
841
|
+
generateJunieMcpConfiguration: () => generateJunieMcpConfiguration
|
|
842
|
+
});
|
|
561
843
|
function generateJunieMcp(config) {
|
|
562
844
|
return generateMcpFromRegistry("junie", config);
|
|
563
845
|
}
|
|
846
|
+
function generateJunieMcpConfiguration(mcpServers, baseDir = "") {
|
|
847
|
+
return generateMcpConfigurationFilesFromRegistry("junie", mcpServers, baseDir);
|
|
848
|
+
}
|
|
564
849
|
var init_junie = __esm({
|
|
565
850
|
"src/generators/mcp/junie.ts"() {
|
|
566
851
|
"use strict";
|
|
@@ -569,6 +854,11 @@ var init_junie = __esm({
|
|
|
569
854
|
});
|
|
570
855
|
|
|
571
856
|
// src/generators/mcp/kiro.ts
|
|
857
|
+
var kiro_exports = {};
|
|
858
|
+
__export(kiro_exports, {
|
|
859
|
+
generateKiroMcp: () => generateKiroMcp,
|
|
860
|
+
generateKiroMcpConfiguration: () => generateKiroMcpConfiguration
|
|
861
|
+
});
|
|
572
862
|
function generateKiroMcp(config) {
|
|
573
863
|
const kiroConfig = {
|
|
574
864
|
mcpServers: {}
|
|
@@ -612,6 +902,39 @@ function generateKiroMcp(config) {
|
|
|
612
902
|
}
|
|
613
903
|
return JSON.stringify(kiroConfig, null, 2);
|
|
614
904
|
}
|
|
905
|
+
function generateKiroMcpConfiguration(mcpServers, baseDir = "") {
|
|
906
|
+
const filepath = baseDir ? `${baseDir}/.kiro/mcp.json` : ".kiro/mcp.json";
|
|
907
|
+
const config = {
|
|
908
|
+
mcpServers: {}
|
|
909
|
+
};
|
|
910
|
+
for (const [serverName, server] of Object.entries(mcpServers)) {
|
|
911
|
+
if (!shouldIncludeServer(server, "kiro")) {
|
|
912
|
+
continue;
|
|
913
|
+
}
|
|
914
|
+
const { targets: _targets, ...serverConfig } = server;
|
|
915
|
+
const kiroServer = { ...serverConfig };
|
|
916
|
+
if (serverConfig.httpUrl !== void 0) {
|
|
917
|
+
kiroServer.url = serverConfig.httpUrl;
|
|
918
|
+
delete kiroServer.httpUrl;
|
|
919
|
+
}
|
|
920
|
+
if (serverConfig.kiroAutoApprove !== void 0) {
|
|
921
|
+
kiroServer.autoApprove = serverConfig.kiroAutoApprove;
|
|
922
|
+
delete kiroServer.kiroAutoApprove;
|
|
923
|
+
}
|
|
924
|
+
if (serverConfig.kiroAutoBlock !== void 0) {
|
|
925
|
+
kiroServer.autoBlock = serverConfig.kiroAutoBlock;
|
|
926
|
+
delete kiroServer.kiroAutoBlock;
|
|
927
|
+
}
|
|
928
|
+
config.mcpServers[serverName] = kiroServer;
|
|
929
|
+
}
|
|
930
|
+
return [
|
|
931
|
+
{
|
|
932
|
+
filepath,
|
|
933
|
+
content: `${JSON.stringify(config, null, 2)}
|
|
934
|
+
`
|
|
935
|
+
}
|
|
936
|
+
];
|
|
937
|
+
}
|
|
615
938
|
var init_kiro = __esm({
|
|
616
939
|
"src/generators/mcp/kiro.ts"() {
|
|
617
940
|
"use strict";
|
|
@@ -620,6 +943,11 @@ var init_kiro = __esm({
|
|
|
620
943
|
});
|
|
621
944
|
|
|
622
945
|
// src/generators/mcp/roo.ts
|
|
946
|
+
var roo_exports = {};
|
|
947
|
+
__export(roo_exports, {
|
|
948
|
+
generateRooMcp: () => generateRooMcp,
|
|
949
|
+
generateRooMcpConfiguration: () => generateRooMcpConfiguration
|
|
950
|
+
});
|
|
623
951
|
function generateRooMcp(config) {
|
|
624
952
|
const rooConfig = {
|
|
625
953
|
mcpServers: {}
|
|
@@ -664,6 +992,30 @@ function generateRooMcp(config) {
|
|
|
664
992
|
}
|
|
665
993
|
return JSON.stringify(rooConfig, null, 2);
|
|
666
994
|
}
|
|
995
|
+
function generateRooMcpConfiguration(mcpServers, baseDir = "") {
|
|
996
|
+
const filepath = baseDir ? `${baseDir}/.roo/mcp.json` : ".roo/mcp.json";
|
|
997
|
+
const config = {
|
|
998
|
+
mcpServers: {}
|
|
999
|
+
};
|
|
1000
|
+
for (const [serverName, server] of Object.entries(mcpServers)) {
|
|
1001
|
+
if (!shouldIncludeServer(server, "roo")) {
|
|
1002
|
+
continue;
|
|
1003
|
+
}
|
|
1004
|
+
const { targets: _targets, ...serverConfig } = server;
|
|
1005
|
+
const rooServer = { ...serverConfig };
|
|
1006
|
+
if (serverConfig.httpUrl !== void 0 && serverConfig.url !== void 0) {
|
|
1007
|
+
rooServer.url = serverConfig.httpUrl;
|
|
1008
|
+
}
|
|
1009
|
+
config.mcpServers[serverName] = rooServer;
|
|
1010
|
+
}
|
|
1011
|
+
return [
|
|
1012
|
+
{
|
|
1013
|
+
filepath,
|
|
1014
|
+
content: `${JSON.stringify(config, null, 2)}
|
|
1015
|
+
`
|
|
1016
|
+
}
|
|
1017
|
+
];
|
|
1018
|
+
}
|
|
667
1019
|
var init_roo = __esm({
|
|
668
1020
|
"src/generators/mcp/roo.ts"() {
|
|
669
1021
|
"use strict";
|
|
@@ -672,9 +1024,17 @@ var init_roo = __esm({
|
|
|
672
1024
|
});
|
|
673
1025
|
|
|
674
1026
|
// src/generators/mcp/windsurf.ts
|
|
1027
|
+
var windsurf_exports = {};
|
|
1028
|
+
__export(windsurf_exports, {
|
|
1029
|
+
generateWindsurfMcp: () => generateWindsurfMcp,
|
|
1030
|
+
generateWindsurfMcpConfiguration: () => generateWindsurfMcpConfiguration
|
|
1031
|
+
});
|
|
675
1032
|
function generateWindsurfMcp(config) {
|
|
676
1033
|
return generateMcpFromRegistry("windsurf", config);
|
|
677
1034
|
}
|
|
1035
|
+
function generateWindsurfMcpConfiguration(mcpServers, baseDir = "") {
|
|
1036
|
+
return generateMcpConfigurationFilesFromRegistry("windsurf", mcpServers, baseDir);
|
|
1037
|
+
}
|
|
678
1038
|
var init_windsurf = __esm({
|
|
679
1039
|
"src/generators/mcp/windsurf.ts"() {
|
|
680
1040
|
"use strict";
|
|
@@ -3211,125 +3571,51 @@ function parseMcpConfig(projectRoot) {
|
|
|
3211
3571
|
}
|
|
3212
3572
|
|
|
3213
3573
|
// src/core/mcp-generator.ts
|
|
3214
|
-
async function
|
|
3215
|
-
const
|
|
3216
|
-
const
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
path: path4.join(targetRoot, ".codex", "mcp-config.json"),
|
|
3255
|
-
generate: () => generateCodexMcp(config)
|
|
3256
|
-
},
|
|
3257
|
-
{
|
|
3258
|
-
tool: "gemini-project",
|
|
3259
|
-
path: path4.join(targetRoot, ".gemini", "settings.json"),
|
|
3260
|
-
generate: () => generateGeminiCliMcp(config)
|
|
3261
|
-
},
|
|
3262
|
-
{
|
|
3263
|
-
tool: "junie-project",
|
|
3264
|
-
path: path4.join(targetRoot, ".junie", "mcp-config.json"),
|
|
3265
|
-
generate: () => generateJunieMcp(config)
|
|
3266
|
-
},
|
|
3267
|
-
{
|
|
3268
|
-
tool: "kiro-project",
|
|
3269
|
-
path: path4.join(targetRoot, ".kiro", "mcp.json"),
|
|
3270
|
-
generate: () => generateKiroMcp(config)
|
|
3271
|
-
},
|
|
3272
|
-
{
|
|
3273
|
-
tool: "roo-project",
|
|
3274
|
-
path: path4.join(targetRoot, ".roo", "mcp.json"),
|
|
3275
|
-
generate: () => generateRooMcp(config)
|
|
3276
|
-
},
|
|
3277
|
-
{
|
|
3278
|
-
tool: "windsurf-project",
|
|
3279
|
-
path: path4.join(targetRoot, "mcp_config.json"),
|
|
3280
|
-
generate: () => generateWindsurfMcp(config)
|
|
3281
|
-
}
|
|
3282
|
-
];
|
|
3283
|
-
const filteredGenerators = targetTools ? generators.filter((g) => {
|
|
3284
|
-
const baseTool = g.tool.split("-")[0];
|
|
3285
|
-
if (!isToolTarget(baseTool)) {
|
|
3286
|
-
return false;
|
|
3287
|
-
}
|
|
3288
|
-
if (baseTool === "augmentcode") {
|
|
3289
|
-
return targetTools.includes("augmentcode") || targetTools.includes("augmentcode-legacy");
|
|
3290
|
-
}
|
|
3291
|
-
return targetTools.includes(baseTool);
|
|
3292
|
-
}) : generators;
|
|
3293
|
-
for (const generator of filteredGenerators) {
|
|
3294
|
-
try {
|
|
3295
|
-
const content = generator.generate();
|
|
3296
|
-
const parsed = JSON.parse(content);
|
|
3297
|
-
if (generator.tool.includes("augmentcode") || generator.tool.includes("claude") || generator.tool.includes("cline") || generator.tool.includes("codexcli") || generator.tool.includes("cursor") || generator.tool.includes("gemini") || generator.tool.includes("junie") || generator.tool.includes("kiro") || generator.tool.includes("roo") || generator.tool.includes("windsurf")) {
|
|
3298
|
-
if (!parsed.mcpServers || Object.keys(parsed.mcpServers).length === 0) {
|
|
3299
|
-
results.push({
|
|
3300
|
-
tool: generator.tool,
|
|
3301
|
-
path: generator.path,
|
|
3302
|
-
status: "skipped"
|
|
3303
|
-
});
|
|
3304
|
-
continue;
|
|
3305
|
-
}
|
|
3306
|
-
} else if (generator.tool.includes("copilot")) {
|
|
3307
|
-
const key = generator.tool.includes("codingAgent") ? "mcpServers" : "servers";
|
|
3308
|
-
if (!parsed[key] || Object.keys(parsed[key]).length === 0) {
|
|
3309
|
-
results.push({
|
|
3310
|
-
tool: generator.tool,
|
|
3311
|
-
path: generator.path,
|
|
3312
|
-
status: "skipped"
|
|
3313
|
-
});
|
|
3314
|
-
continue;
|
|
3574
|
+
async function generateMcpConfigurations(mcpConfig, baseDir, targetTools) {
|
|
3575
|
+
const outputs = [];
|
|
3576
|
+
const toolMap = {
|
|
3577
|
+
augmentcode: async (servers, dir) => (await Promise.resolve().then(() => (init_augmentcode(), augmentcode_exports))).generateAugmentcodeMcpConfiguration(
|
|
3578
|
+
servers,
|
|
3579
|
+
dir
|
|
3580
|
+
),
|
|
3581
|
+
"augmentcode-legacy": async (servers, dir) => (await Promise.resolve().then(() => (init_augmentcode(), augmentcode_exports))).generateAugmentcodeMcpConfiguration(
|
|
3582
|
+
servers,
|
|
3583
|
+
dir
|
|
3584
|
+
),
|
|
3585
|
+
claudecode: async (servers, dir) => (await Promise.resolve().then(() => (init_claudecode(), claudecode_exports))).generateClaudeMcpConfiguration(
|
|
3586
|
+
servers,
|
|
3587
|
+
dir
|
|
3588
|
+
),
|
|
3589
|
+
copilot: async (servers, dir) => (await Promise.resolve().then(() => (init_copilot(), copilot_exports))).generateCopilotMcpConfiguration(servers, dir),
|
|
3590
|
+
cursor: async (servers, dir) => (await Promise.resolve().then(() => (init_cursor(), cursor_exports))).generateCursorMcpConfiguration(servers, dir),
|
|
3591
|
+
cline: async (servers, dir) => (await Promise.resolve().then(() => (init_cline(), cline_exports))).generateClineMcpConfiguration(servers, dir),
|
|
3592
|
+
codexcli: async (servers, dir) => (await Promise.resolve().then(() => (init_codexcli(), codexcli_exports))).generateCodexMcpConfiguration(servers, dir),
|
|
3593
|
+
roo: async (servers, dir) => (await Promise.resolve().then(() => (init_roo(), roo_exports))).generateRooMcpConfiguration(servers, dir),
|
|
3594
|
+
geminicli: async (servers, dir) => (await Promise.resolve().then(() => (init_geminicli(), geminicli_exports))).generateGeminiCliMcpConfiguration(
|
|
3595
|
+
servers,
|
|
3596
|
+
dir
|
|
3597
|
+
),
|
|
3598
|
+
kiro: async (servers, dir) => (await Promise.resolve().then(() => (init_kiro(), kiro_exports))).generateKiroMcpConfiguration(servers, dir),
|
|
3599
|
+
junie: async (servers, dir) => (await Promise.resolve().then(() => (init_junie(), junie_exports))).generateJunieMcpConfiguration(servers, dir),
|
|
3600
|
+
windsurf: async (servers, dir) => (await Promise.resolve().then(() => (init_windsurf(), windsurf_exports))).generateWindsurfMcpConfiguration(
|
|
3601
|
+
servers,
|
|
3602
|
+
dir
|
|
3603
|
+
)
|
|
3604
|
+
};
|
|
3605
|
+
const tools = targetTools || Object.keys(toolMap).filter(isToolTarget);
|
|
3606
|
+
const seenPaths = /* @__PURE__ */ new Set();
|
|
3607
|
+
for (const tool of tools) {
|
|
3608
|
+
if (tool in toolMap) {
|
|
3609
|
+
const results = await toolMap[tool](mcpConfig.mcpServers || {}, baseDir);
|
|
3610
|
+
for (const result of results) {
|
|
3611
|
+
if (!seenPaths.has(result.filepath)) {
|
|
3612
|
+
seenPaths.add(result.filepath);
|
|
3613
|
+
outputs.push({ ...result, tool });
|
|
3315
3614
|
}
|
|
3316
3615
|
}
|
|
3317
|
-
await writeFileContent(generator.path, content);
|
|
3318
|
-
results.push({
|
|
3319
|
-
tool: generator.tool,
|
|
3320
|
-
path: generator.path,
|
|
3321
|
-
status: "success"
|
|
3322
|
-
});
|
|
3323
|
-
} catch (error) {
|
|
3324
|
-
results.push({
|
|
3325
|
-
tool: generator.tool,
|
|
3326
|
-
path: generator.path,
|
|
3327
|
-
status: "error",
|
|
3328
|
-
error: error instanceof Error ? error.message : String(error)
|
|
3329
|
-
});
|
|
3330
3616
|
}
|
|
3331
3617
|
}
|
|
3332
|
-
return
|
|
3618
|
+
return outputs;
|
|
3333
3619
|
}
|
|
3334
3620
|
|
|
3335
3621
|
// src/cli/commands/generate.ts
|
|
@@ -3474,25 +3760,35 @@ Generating configurations for base directory: ${baseDir}`);
|
|
|
3474
3760
|
}
|
|
3475
3761
|
let totalMcpOutputs = 0;
|
|
3476
3762
|
for (const baseDir of baseDirs) {
|
|
3477
|
-
|
|
3478
|
-
process.cwd()
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
console.log(`No MCP configuration found for ${baseDir}`);
|
|
3763
|
+
try {
|
|
3764
|
+
const mcpConfig = parseMcpConfig(process.cwd());
|
|
3765
|
+
if (!mcpConfig || !mcpConfig.mcpServers || Object.keys(mcpConfig.mcpServers).length === 0) {
|
|
3766
|
+
if (config.verbose) {
|
|
3767
|
+
console.log(`No MCP configuration found for ${baseDir}`);
|
|
3768
|
+
}
|
|
3769
|
+
continue;
|
|
3485
3770
|
}
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3771
|
+
const mcpResults = await generateMcpConfigurations(
|
|
3772
|
+
mcpConfig,
|
|
3773
|
+
baseDir === process.cwd() ? "." : baseDir,
|
|
3774
|
+
config.defaultTargets
|
|
3775
|
+
);
|
|
3776
|
+
if (mcpResults.length === 0) {
|
|
3777
|
+
if (config.verbose) {
|
|
3778
|
+
console.log(`No MCP configurations generated for ${baseDir}`);
|
|
3779
|
+
}
|
|
3780
|
+
continue;
|
|
3781
|
+
}
|
|
3782
|
+
for (const result of mcpResults) {
|
|
3783
|
+
await writeFileContent(result.filepath, result.content);
|
|
3784
|
+
console.log(`\u2705 Generated ${result.tool} MCP configuration: ${result.filepath}`);
|
|
3491
3785
|
totalMcpOutputs++;
|
|
3492
|
-
}
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
console.
|
|
3786
|
+
}
|
|
3787
|
+
} catch (error) {
|
|
3788
|
+
if (config.verbose) {
|
|
3789
|
+
console.error(
|
|
3790
|
+
`\u274C Failed to generate MCP configurations: ${error instanceof Error ? error.message : String(error)}`
|
|
3791
|
+
);
|
|
3496
3792
|
}
|
|
3497
3793
|
}
|
|
3498
3794
|
}
|
|
@@ -4854,7 +5150,7 @@ async function watchCommand() {
|
|
|
4854
5150
|
|
|
4855
5151
|
// src/cli/index.ts
|
|
4856
5152
|
var program = new import_commander.Command();
|
|
4857
|
-
program.name("rulesync").description("Unified AI rules management CLI tool").version("0.
|
|
5153
|
+
program.name("rulesync").description("Unified AI rules management CLI tool").version("0.59.0");
|
|
4858
5154
|
program.command("init").description("Initialize rulesync in current directory").action(initCommand);
|
|
4859
5155
|
program.command("add <filename>").description("Add a new rule file").action(addCommand);
|
|
4860
5156
|
program.command("gitignore").description("Add generated files to .gitignore").action(gitignoreCommand);
|
package/dist/index.js
CHANGED
|
@@ -1,38 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
generateAugmentcodeMcp
|
|
16
|
-
} from "./chunk-YTU3SCQO.js";
|
|
17
|
-
import {
|
|
18
|
-
generateClaudeMcp
|
|
19
|
-
} from "./chunk-VKNCBVZF.js";
|
|
20
|
-
import {
|
|
21
|
-
generateClineMcp
|
|
22
|
-
} from "./chunk-W2WU253H.js";
|
|
23
|
-
import {
|
|
24
|
-
generateCodexMcp
|
|
25
|
-
} from "./chunk-7UBF4OLN.js";
|
|
26
|
-
import {
|
|
27
|
-
generateCopilotMcp
|
|
28
|
-
} from "./chunk-KUGTKMNW.js";
|
|
29
|
-
import {
|
|
30
|
-
generateCursorMcp
|
|
31
|
-
} from "./chunk-OA473EXZ.js";
|
|
32
|
-
import {
|
|
33
|
-
generateGeminiCliMcp
|
|
34
|
-
} from "./chunk-WAX2UANS.js";
|
|
35
|
-
import "./chunk-J3TBR5EP.js";
|
|
2
|
+
import "./chunk-S3GB3VQK.js";
|
|
3
|
+
import "./chunk-LXTA7DBA.js";
|
|
4
|
+
import "./chunk-PCATT4UZ.js";
|
|
5
|
+
import "./chunk-3YQ42A7G.js";
|
|
6
|
+
import "./chunk-YTU3SCQO.js";
|
|
7
|
+
import "./chunk-EG7LNNMW.js";
|
|
8
|
+
import "./chunk-VYO76WDU.js";
|
|
9
|
+
import "./chunk-DJWXF2WO.js";
|
|
10
|
+
import "./chunk-KUGTKMNW.js";
|
|
11
|
+
import "./chunk-LIV53UU5.js";
|
|
12
|
+
import "./chunk-5SRMJNDW.js";
|
|
13
|
+
import "./chunk-OCK47GE7.js";
|
|
36
14
|
import {
|
|
37
15
|
ALL_TOOL_TARGETS,
|
|
38
16
|
RulesyncTargetsSchema,
|
|
@@ -2549,125 +2527,51 @@ function parseMcpConfig(projectRoot) {
|
|
|
2549
2527
|
}
|
|
2550
2528
|
|
|
2551
2529
|
// src/core/mcp-generator.ts
|
|
2552
|
-
async function
|
|
2553
|
-
const
|
|
2554
|
-
const
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
path: path4.join(targetRoot, ".codex", "mcp-config.json"),
|
|
2593
|
-
generate: () => generateCodexMcp(config)
|
|
2594
|
-
},
|
|
2595
|
-
{
|
|
2596
|
-
tool: "gemini-project",
|
|
2597
|
-
path: path4.join(targetRoot, ".gemini", "settings.json"),
|
|
2598
|
-
generate: () => generateGeminiCliMcp(config)
|
|
2599
|
-
},
|
|
2600
|
-
{
|
|
2601
|
-
tool: "junie-project",
|
|
2602
|
-
path: path4.join(targetRoot, ".junie", "mcp-config.json"),
|
|
2603
|
-
generate: () => generateJunieMcp(config)
|
|
2604
|
-
},
|
|
2605
|
-
{
|
|
2606
|
-
tool: "kiro-project",
|
|
2607
|
-
path: path4.join(targetRoot, ".kiro", "mcp.json"),
|
|
2608
|
-
generate: () => generateKiroMcp(config)
|
|
2609
|
-
},
|
|
2610
|
-
{
|
|
2611
|
-
tool: "roo-project",
|
|
2612
|
-
path: path4.join(targetRoot, ".roo", "mcp.json"),
|
|
2613
|
-
generate: () => generateRooMcp(config)
|
|
2614
|
-
},
|
|
2615
|
-
{
|
|
2616
|
-
tool: "windsurf-project",
|
|
2617
|
-
path: path4.join(targetRoot, "mcp_config.json"),
|
|
2618
|
-
generate: () => generateWindsurfMcp(config)
|
|
2619
|
-
}
|
|
2620
|
-
];
|
|
2621
|
-
const filteredGenerators = targetTools ? generators.filter((g) => {
|
|
2622
|
-
const baseTool = g.tool.split("-")[0];
|
|
2623
|
-
if (!isToolTarget(baseTool)) {
|
|
2624
|
-
return false;
|
|
2625
|
-
}
|
|
2626
|
-
if (baseTool === "augmentcode") {
|
|
2627
|
-
return targetTools.includes("augmentcode") || targetTools.includes("augmentcode-legacy");
|
|
2628
|
-
}
|
|
2629
|
-
return targetTools.includes(baseTool);
|
|
2630
|
-
}) : generators;
|
|
2631
|
-
for (const generator of filteredGenerators) {
|
|
2632
|
-
try {
|
|
2633
|
-
const content = generator.generate();
|
|
2634
|
-
const parsed = JSON.parse(content);
|
|
2635
|
-
if (generator.tool.includes("augmentcode") || generator.tool.includes("claude") || generator.tool.includes("cline") || generator.tool.includes("codexcli") || generator.tool.includes("cursor") || generator.tool.includes("gemini") || generator.tool.includes("junie") || generator.tool.includes("kiro") || generator.tool.includes("roo") || generator.tool.includes("windsurf")) {
|
|
2636
|
-
if (!parsed.mcpServers || Object.keys(parsed.mcpServers).length === 0) {
|
|
2637
|
-
results.push({
|
|
2638
|
-
tool: generator.tool,
|
|
2639
|
-
path: generator.path,
|
|
2640
|
-
status: "skipped"
|
|
2641
|
-
});
|
|
2642
|
-
continue;
|
|
2643
|
-
}
|
|
2644
|
-
} else if (generator.tool.includes("copilot")) {
|
|
2645
|
-
const key = generator.tool.includes("codingAgent") ? "mcpServers" : "servers";
|
|
2646
|
-
if (!parsed[key] || Object.keys(parsed[key]).length === 0) {
|
|
2647
|
-
results.push({
|
|
2648
|
-
tool: generator.tool,
|
|
2649
|
-
path: generator.path,
|
|
2650
|
-
status: "skipped"
|
|
2651
|
-
});
|
|
2652
|
-
continue;
|
|
2530
|
+
async function generateMcpConfigurations(mcpConfig, baseDir, targetTools) {
|
|
2531
|
+
const outputs = [];
|
|
2532
|
+
const toolMap = {
|
|
2533
|
+
augmentcode: async (servers, dir) => (await import("./augmentcode-HIZIQG2W.js")).generateAugmentcodeMcpConfiguration(
|
|
2534
|
+
servers,
|
|
2535
|
+
dir
|
|
2536
|
+
),
|
|
2537
|
+
"augmentcode-legacy": async (servers, dir) => (await import("./augmentcode-HIZIQG2W.js")).generateAugmentcodeMcpConfiguration(
|
|
2538
|
+
servers,
|
|
2539
|
+
dir
|
|
2540
|
+
),
|
|
2541
|
+
claudecode: async (servers, dir) => (await import("./claudecode-CRSXMPS5.js")).generateClaudeMcpConfiguration(
|
|
2542
|
+
servers,
|
|
2543
|
+
dir
|
|
2544
|
+
),
|
|
2545
|
+
copilot: async (servers, dir) => (await import("./copilot-MOR3HHJX.js")).generateCopilotMcpConfiguration(servers, dir),
|
|
2546
|
+
cursor: async (servers, dir) => (await import("./cursor-EXX2Q5MB.js")).generateCursorMcpConfiguration(servers, dir),
|
|
2547
|
+
cline: async (servers, dir) => (await import("./cline-O67TEUFW.js")).generateClineMcpConfiguration(servers, dir),
|
|
2548
|
+
codexcli: async (servers, dir) => (await import("./codexcli-S7VDKBI2.js")).generateCodexMcpConfiguration(servers, dir),
|
|
2549
|
+
roo: async (servers, dir) => (await import("./roo-L3QTTIPO.js")).generateRooMcpConfiguration(servers, dir),
|
|
2550
|
+
geminicli: async (servers, dir) => (await import("./geminicli-K3FKXDKP.js")).generateGeminiCliMcpConfiguration(
|
|
2551
|
+
servers,
|
|
2552
|
+
dir
|
|
2553
|
+
),
|
|
2554
|
+
kiro: async (servers, dir) => (await import("./kiro-YDHXY2MA.js")).generateKiroMcpConfiguration(servers, dir),
|
|
2555
|
+
junie: async (servers, dir) => (await import("./junie-4SNWC452.js")).generateJunieMcpConfiguration(servers, dir),
|
|
2556
|
+
windsurf: async (servers, dir) => (await import("./windsurf-NVCRKFHF.js")).generateWindsurfMcpConfiguration(
|
|
2557
|
+
servers,
|
|
2558
|
+
dir
|
|
2559
|
+
)
|
|
2560
|
+
};
|
|
2561
|
+
const tools = targetTools || Object.keys(toolMap).filter(isToolTarget);
|
|
2562
|
+
const seenPaths = /* @__PURE__ */ new Set();
|
|
2563
|
+
for (const tool of tools) {
|
|
2564
|
+
if (tool in toolMap) {
|
|
2565
|
+
const results = await toolMap[tool](mcpConfig.mcpServers || {}, baseDir);
|
|
2566
|
+
for (const result of results) {
|
|
2567
|
+
if (!seenPaths.has(result.filepath)) {
|
|
2568
|
+
seenPaths.add(result.filepath);
|
|
2569
|
+
outputs.push({ ...result, tool });
|
|
2653
2570
|
}
|
|
2654
2571
|
}
|
|
2655
|
-
await writeFileContent(generator.path, content);
|
|
2656
|
-
results.push({
|
|
2657
|
-
tool: generator.tool,
|
|
2658
|
-
path: generator.path,
|
|
2659
|
-
status: "success"
|
|
2660
|
-
});
|
|
2661
|
-
} catch (error) {
|
|
2662
|
-
results.push({
|
|
2663
|
-
tool: generator.tool,
|
|
2664
|
-
path: generator.path,
|
|
2665
|
-
status: "error",
|
|
2666
|
-
error: error instanceof Error ? error.message : String(error)
|
|
2667
|
-
});
|
|
2668
2572
|
}
|
|
2669
2573
|
}
|
|
2670
|
-
return
|
|
2574
|
+
return outputs;
|
|
2671
2575
|
}
|
|
2672
2576
|
|
|
2673
2577
|
// src/cli/commands/generate.ts
|
|
@@ -2812,25 +2716,35 @@ Generating configurations for base directory: ${baseDir}`);
|
|
|
2812
2716
|
}
|
|
2813
2717
|
let totalMcpOutputs = 0;
|
|
2814
2718
|
for (const baseDir of baseDirs) {
|
|
2815
|
-
|
|
2816
|
-
process.cwd()
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
console.log(`No MCP configuration found for ${baseDir}`);
|
|
2719
|
+
try {
|
|
2720
|
+
const mcpConfig = parseMcpConfig(process.cwd());
|
|
2721
|
+
if (!mcpConfig || !mcpConfig.mcpServers || Object.keys(mcpConfig.mcpServers).length === 0) {
|
|
2722
|
+
if (config.verbose) {
|
|
2723
|
+
console.log(`No MCP configuration found for ${baseDir}`);
|
|
2724
|
+
}
|
|
2725
|
+
continue;
|
|
2823
2726
|
}
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2727
|
+
const mcpResults = await generateMcpConfigurations(
|
|
2728
|
+
mcpConfig,
|
|
2729
|
+
baseDir === process.cwd() ? "." : baseDir,
|
|
2730
|
+
config.defaultTargets
|
|
2731
|
+
);
|
|
2732
|
+
if (mcpResults.length === 0) {
|
|
2733
|
+
if (config.verbose) {
|
|
2734
|
+
console.log(`No MCP configurations generated for ${baseDir}`);
|
|
2735
|
+
}
|
|
2736
|
+
continue;
|
|
2737
|
+
}
|
|
2738
|
+
for (const result of mcpResults) {
|
|
2739
|
+
await writeFileContent(result.filepath, result.content);
|
|
2740
|
+
console.log(`\u2705 Generated ${result.tool} MCP configuration: ${result.filepath}`);
|
|
2829
2741
|
totalMcpOutputs++;
|
|
2830
|
-
}
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
console.
|
|
2742
|
+
}
|
|
2743
|
+
} catch (error) {
|
|
2744
|
+
if (config.verbose) {
|
|
2745
|
+
console.error(
|
|
2746
|
+
`\u274C Failed to generate MCP configurations: ${error instanceof Error ? error.message : String(error)}`
|
|
2747
|
+
);
|
|
2834
2748
|
}
|
|
2835
2749
|
}
|
|
2836
2750
|
}
|
|
@@ -4192,7 +4106,7 @@ async function watchCommand() {
|
|
|
4192
4106
|
|
|
4193
4107
|
// src/cli/index.ts
|
|
4194
4108
|
var program = new Command();
|
|
4195
|
-
program.name("rulesync").description("Unified AI rules management CLI tool").version("0.
|
|
4109
|
+
program.name("rulesync").description("Unified AI rules management CLI tool").version("0.59.0");
|
|
4196
4110
|
program.command("init").description("Initialize rulesync in current directory").action(initCommand);
|
|
4197
4111
|
program.command("add <filename>").description("Add a new rule file").action(addCommand);
|
|
4198
4112
|
program.command("gitignore").description("Add generated files to .gitignore").action(gitignoreCommand);
|