rulesync 0.37.0 → 0.38.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-TKNVMYAC.mjs → chunk-BEJD7I74.js} +1 -1
- package/dist/{chunk-PBOKMNYU.mjs → chunk-HOVR7QDA.js} +1 -1
- package/dist/{chunk-2BYTQ4LL.mjs → chunk-LQDXGEGC.js} +1 -1
- package/dist/{chunk-3GVVX3G5.mjs → chunk-SPMMXF7R.js} +1 -1
- package/dist/{chunk-KZATM2CQ.mjs → chunk-VZMUQVX4.js} +1 -1
- package/dist/{chunk-2CDVII2R.mjs → chunk-XERXHVPP.js} +1 -1
- package/dist/{claude-2NLZ2CDE.mjs → claude-ZBX7NASK.js} +2 -2
- package/dist/{cline-HUXPTQP7.mjs → cline-XP43H6CB.js} +2 -2
- package/dist/{copilot-376H5OXX.mjs → copilot-4O7P53MT.js} +2 -2
- package/dist/{cursor-XWLBQYWY.mjs → cursor-HSO7S4D3.js} +2 -2
- package/dist/{geminicli-EREPFSDP.mjs → geminicli-UZWXPT2J.js} +2 -2
- package/dist/{index.mjs → index.cjs} +507 -152
- package/dist/index.js +153 -506
- package/dist/{roo-YS23AEWJ.mjs → roo-JSRLCK7Z.js} +2 -2
- package/package.json +7 -18
- /package/dist/{chunk-QQN5GTOV.mjs → chunk-AWKMUY5R.js} +0 -0
- /package/dist/{index.d.mts → index.d.cts} +0 -0
|
@@ -1,30 +1,376 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __esm = (fn, res) => function __init() {
|
|
10
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
|
|
29
|
+
// src/schemas/mcp.ts
|
|
30
|
+
var import_zod, ToolTargetSchema, WildcardTargetSchema, SpecificTargetsSchema, RulesyncTargetsSchema, McpTransportTypeSchema, McpServerBaseSchema, RulesyncMcpServerSchema;
|
|
31
|
+
var init_mcp = __esm({
|
|
32
|
+
"src/schemas/mcp.ts"() {
|
|
33
|
+
"use strict";
|
|
34
|
+
import_zod = require("zod");
|
|
35
|
+
ToolTargetSchema = import_zod.z.enum([
|
|
36
|
+
"copilot",
|
|
37
|
+
"cursor",
|
|
38
|
+
"cline",
|
|
39
|
+
"claudecode",
|
|
40
|
+
"claude",
|
|
41
|
+
"roo",
|
|
42
|
+
"geminicli"
|
|
43
|
+
]);
|
|
44
|
+
WildcardTargetSchema = import_zod.z.tuple([import_zod.z.literal("*")]);
|
|
45
|
+
SpecificTargetsSchema = import_zod.z.array(ToolTargetSchema);
|
|
46
|
+
RulesyncTargetsSchema = import_zod.z.union([SpecificTargetsSchema, WildcardTargetSchema]);
|
|
47
|
+
McpTransportTypeSchema = import_zod.z.enum(["stdio", "sse", "http"]);
|
|
48
|
+
McpServerBaseSchema = import_zod.z.object({
|
|
49
|
+
command: import_zod.z.string().optional(),
|
|
50
|
+
args: import_zod.z.array(import_zod.z.string()).optional(),
|
|
51
|
+
url: import_zod.z.string().optional(),
|
|
52
|
+
httpUrl: import_zod.z.string().optional(),
|
|
53
|
+
env: import_zod.z.record(import_zod.z.string()).optional(),
|
|
54
|
+
disabled: import_zod.z.boolean().optional(),
|
|
55
|
+
networkTimeout: import_zod.z.number().optional(),
|
|
56
|
+
timeout: import_zod.z.number().optional(),
|
|
57
|
+
trust: import_zod.z.boolean().optional(),
|
|
58
|
+
cwd: import_zod.z.string().optional(),
|
|
59
|
+
transport: McpTransportTypeSchema.optional(),
|
|
60
|
+
type: import_zod.z.enum(["sse", "streamable-http"]).optional(),
|
|
61
|
+
alwaysAllow: import_zod.z.array(import_zod.z.string()).optional(),
|
|
62
|
+
tools: import_zod.z.array(import_zod.z.string()).optional()
|
|
63
|
+
});
|
|
64
|
+
RulesyncMcpServerSchema = McpServerBaseSchema.extend({
|
|
65
|
+
rulesyncTargets: RulesyncTargetsSchema.optional()
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// src/utils/mcp-helpers.ts
|
|
71
|
+
function shouldIncludeServer(server, targetTool) {
|
|
72
|
+
if (!server.rulesyncTargets || server.rulesyncTargets.length === 0) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
const parsedTargets = RulesyncTargetsSchema.parse(server.rulesyncTargets);
|
|
76
|
+
if (parsedTargets.length === 1 && parsedTargets[0] === "*") {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
const validatedTool = ToolTargetSchema.parse(targetTool);
|
|
80
|
+
for (const target of parsedTargets) {
|
|
81
|
+
if (target === validatedTool) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
var init_mcp_helpers = __esm({
|
|
88
|
+
"src/utils/mcp-helpers.ts"() {
|
|
89
|
+
"use strict";
|
|
90
|
+
init_mcp();
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// src/generators/mcp/claude.ts
|
|
95
|
+
function generateClaudeMcp(config, _target) {
|
|
96
|
+
const claudeSettings = {
|
|
97
|
+
mcpServers: {}
|
|
98
|
+
};
|
|
99
|
+
const shouldInclude = (server) => {
|
|
100
|
+
return shouldIncludeServer(server, "claude");
|
|
101
|
+
};
|
|
102
|
+
for (const [serverName, server] of Object.entries(config.mcpServers)) {
|
|
103
|
+
if (!shouldInclude(server)) continue;
|
|
104
|
+
const claudeServer = {};
|
|
105
|
+
if (server.command) {
|
|
106
|
+
claudeServer.command = server.command;
|
|
107
|
+
if (server.args) claudeServer.args = server.args;
|
|
108
|
+
} else if (server.url || server.httpUrl) {
|
|
109
|
+
const url = server.httpUrl || server.url;
|
|
110
|
+
if (url) {
|
|
111
|
+
claudeServer.url = url;
|
|
112
|
+
}
|
|
113
|
+
if (server.httpUrl) {
|
|
114
|
+
claudeServer.transport = "http";
|
|
115
|
+
} else if (server.transport === "sse") {
|
|
116
|
+
claudeServer.transport = "sse";
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (server.env) {
|
|
120
|
+
claudeServer.env = server.env;
|
|
121
|
+
}
|
|
122
|
+
claudeSettings.mcpServers[serverName] = claudeServer;
|
|
123
|
+
}
|
|
124
|
+
return JSON.stringify(claudeSettings, null, 2);
|
|
125
|
+
}
|
|
126
|
+
var init_claude = __esm({
|
|
127
|
+
"src/generators/mcp/claude.ts"() {
|
|
128
|
+
"use strict";
|
|
129
|
+
init_mcp_helpers();
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// src/generators/mcp/cline.ts
|
|
134
|
+
function generateClineMcp(config, _target) {
|
|
135
|
+
const clineConfig = {
|
|
136
|
+
mcpServers: {}
|
|
137
|
+
};
|
|
138
|
+
const shouldInclude = (server) => {
|
|
139
|
+
return shouldIncludeServer(server, "cline");
|
|
140
|
+
};
|
|
141
|
+
for (const [serverName, server] of Object.entries(config.mcpServers)) {
|
|
142
|
+
if (!shouldInclude(server)) continue;
|
|
143
|
+
const clineServer = {};
|
|
144
|
+
if (server.command) {
|
|
145
|
+
clineServer.command = server.command;
|
|
146
|
+
if (server.args) clineServer.args = server.args;
|
|
147
|
+
} else if (server.url) {
|
|
148
|
+
clineServer.url = server.url;
|
|
149
|
+
}
|
|
150
|
+
if (server.env) {
|
|
151
|
+
clineServer.env = server.env;
|
|
152
|
+
}
|
|
153
|
+
if (server.disabled !== void 0) {
|
|
154
|
+
clineServer.disabled = server.disabled;
|
|
155
|
+
}
|
|
156
|
+
if (server.alwaysAllow) {
|
|
157
|
+
clineServer.alwaysAllow = server.alwaysAllow;
|
|
158
|
+
}
|
|
159
|
+
if (server.networkTimeout !== void 0) {
|
|
160
|
+
clineServer.networkTimeout = server.networkTimeout;
|
|
161
|
+
}
|
|
162
|
+
clineConfig.mcpServers[serverName] = clineServer;
|
|
163
|
+
}
|
|
164
|
+
return JSON.stringify(clineConfig, null, 2);
|
|
165
|
+
}
|
|
166
|
+
var init_cline = __esm({
|
|
167
|
+
"src/generators/mcp/cline.ts"() {
|
|
168
|
+
"use strict";
|
|
169
|
+
init_mcp_helpers();
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
// src/generators/mcp/copilot.ts
|
|
174
|
+
function generateCopilotMcp(config, target) {
|
|
175
|
+
const servers = {};
|
|
176
|
+
const inputs = [];
|
|
177
|
+
const inputMap = /* @__PURE__ */ new Map();
|
|
178
|
+
for (const [serverName, server] of Object.entries(config.mcpServers)) {
|
|
179
|
+
if (!shouldIncludeServer(server, "copilot")) continue;
|
|
180
|
+
const copilotServer = {};
|
|
181
|
+
if (server.command) {
|
|
182
|
+
copilotServer.command = server.command;
|
|
183
|
+
if (server.args) copilotServer.args = server.args;
|
|
184
|
+
} else if (server.url || server.httpUrl) {
|
|
185
|
+
const url = server.httpUrl || server.url;
|
|
186
|
+
if (url) {
|
|
187
|
+
copilotServer.url = url;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (server.env) {
|
|
191
|
+
copilotServer.env = {};
|
|
192
|
+
for (const [key, value] of Object.entries(server.env)) {
|
|
193
|
+
if (target === "editor" && value.includes("SECRET")) {
|
|
194
|
+
const inputId = `${serverName}_${key}`;
|
|
195
|
+
inputMap.set(inputId, value);
|
|
196
|
+
copilotServer.env[key] = `\${input:${inputId}}`;
|
|
197
|
+
inputs.push({
|
|
198
|
+
id: inputId,
|
|
199
|
+
type: "password",
|
|
200
|
+
description: `${key} for ${serverName}`
|
|
201
|
+
});
|
|
202
|
+
} else {
|
|
203
|
+
copilotServer.env[key] = value;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (server.tools) {
|
|
208
|
+
copilotServer.tools = server.tools;
|
|
209
|
+
} else if (server.alwaysAllow) {
|
|
210
|
+
copilotServer.tools = server.alwaysAllow;
|
|
211
|
+
}
|
|
212
|
+
servers[serverName] = copilotServer;
|
|
213
|
+
}
|
|
214
|
+
if (target === "codingAgent") {
|
|
215
|
+
const config2 = { mcpServers: servers };
|
|
216
|
+
return JSON.stringify(config2, null, 2);
|
|
217
|
+
} else {
|
|
218
|
+
const config2 = { servers };
|
|
219
|
+
if (inputs.length > 0) {
|
|
220
|
+
config2.inputs = inputs;
|
|
221
|
+
}
|
|
222
|
+
return JSON.stringify(config2, null, 2);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
var init_copilot = __esm({
|
|
226
|
+
"src/generators/mcp/copilot.ts"() {
|
|
227
|
+
"use strict";
|
|
228
|
+
init_mcp_helpers();
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
// src/generators/mcp/cursor.ts
|
|
233
|
+
function generateCursorMcp(config, _target) {
|
|
234
|
+
const cursorConfig = {
|
|
235
|
+
mcpServers: {}
|
|
236
|
+
};
|
|
237
|
+
for (const [serverName, server] of Object.entries(config.mcpServers)) {
|
|
238
|
+
if (!shouldIncludeServer(server, "cursor")) continue;
|
|
239
|
+
const cursorServer = {};
|
|
240
|
+
if (server.command) {
|
|
241
|
+
cursorServer.command = server.command;
|
|
242
|
+
if (server.args) cursorServer.args = server.args;
|
|
243
|
+
} else if (server.url || server.httpUrl) {
|
|
244
|
+
const url = server.httpUrl || server.url;
|
|
245
|
+
if (url) {
|
|
246
|
+
cursorServer.url = url;
|
|
247
|
+
}
|
|
248
|
+
if (server.httpUrl || server.transport === "http") {
|
|
249
|
+
cursorServer.type = "streamable-http";
|
|
250
|
+
} else if (server.transport === "sse" || server.type === "sse") {
|
|
251
|
+
cursorServer.type = "sse";
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (server.env) {
|
|
255
|
+
cursorServer.env = server.env;
|
|
256
|
+
}
|
|
257
|
+
if (server.cwd) {
|
|
258
|
+
cursorServer.cwd = server.cwd;
|
|
259
|
+
}
|
|
260
|
+
cursorConfig.mcpServers[serverName] = cursorServer;
|
|
261
|
+
}
|
|
262
|
+
return JSON.stringify(cursorConfig, null, 2);
|
|
263
|
+
}
|
|
264
|
+
var init_cursor = __esm({
|
|
265
|
+
"src/generators/mcp/cursor.ts"() {
|
|
266
|
+
"use strict";
|
|
267
|
+
init_mcp_helpers();
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
// src/generators/mcp/geminicli.ts
|
|
272
|
+
function generateGeminiCliMcp(config, _target) {
|
|
273
|
+
const geminiSettings = {
|
|
274
|
+
mcpServers: {}
|
|
275
|
+
};
|
|
276
|
+
for (const [serverName, server] of Object.entries(config.mcpServers)) {
|
|
277
|
+
if (!shouldIncludeServer(server, "geminicli")) continue;
|
|
278
|
+
const geminiServer = {};
|
|
279
|
+
if (server.command) {
|
|
280
|
+
geminiServer.command = server.command;
|
|
281
|
+
if (server.args) geminiServer.args = server.args;
|
|
282
|
+
} else if (server.url || server.httpUrl) {
|
|
283
|
+
if (server.httpUrl) {
|
|
284
|
+
geminiServer.httpUrl = server.httpUrl;
|
|
285
|
+
} else if (server.url) {
|
|
286
|
+
geminiServer.url = server.url;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
if (server.env) {
|
|
290
|
+
geminiServer.env = {};
|
|
291
|
+
for (const [key, value] of Object.entries(server.env)) {
|
|
292
|
+
if (value.startsWith("${") && value.endsWith("}")) {
|
|
293
|
+
geminiServer.env[key] = value;
|
|
294
|
+
} else {
|
|
295
|
+
geminiServer.env[key] = `\${${value}}`;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
if (server.timeout !== void 0) {
|
|
300
|
+
geminiServer.timeout = server.timeout;
|
|
301
|
+
}
|
|
302
|
+
if (server.trust !== void 0) {
|
|
303
|
+
geminiServer.trust = server.trust;
|
|
304
|
+
}
|
|
305
|
+
geminiSettings.mcpServers[serverName] = geminiServer;
|
|
306
|
+
}
|
|
307
|
+
return JSON.stringify(geminiSettings, null, 2);
|
|
308
|
+
}
|
|
309
|
+
var init_geminicli = __esm({
|
|
310
|
+
"src/generators/mcp/geminicli.ts"() {
|
|
311
|
+
"use strict";
|
|
312
|
+
init_mcp_helpers();
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
// src/generators/mcp/roo.ts
|
|
317
|
+
function generateRooMcp(config, _target) {
|
|
318
|
+
const rooConfig = {
|
|
319
|
+
mcpServers: {}
|
|
320
|
+
};
|
|
321
|
+
for (const [serverName, server] of Object.entries(config.mcpServers)) {
|
|
322
|
+
if (!shouldIncludeServer(server, "roo")) continue;
|
|
323
|
+
const rooServer = {};
|
|
324
|
+
if (server.command) {
|
|
325
|
+
rooServer.command = server.command;
|
|
326
|
+
if (server.args) rooServer.args = server.args;
|
|
327
|
+
} else if (server.url || server.httpUrl) {
|
|
328
|
+
const url = server.httpUrl || server.url;
|
|
329
|
+
if (url) {
|
|
330
|
+
rooServer.url = url;
|
|
331
|
+
}
|
|
332
|
+
if (server.httpUrl || server.transport === "http") {
|
|
333
|
+
rooServer.type = "streamable-http";
|
|
334
|
+
} else if (server.transport === "sse" || server.type === "sse") {
|
|
335
|
+
rooServer.type = "sse";
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
if (server.env) {
|
|
339
|
+
rooServer.env = {};
|
|
340
|
+
for (const [key, value] of Object.entries(server.env)) {
|
|
341
|
+
if (value.startsWith("${env:") && value.endsWith("}")) {
|
|
342
|
+
rooServer.env[key] = value;
|
|
343
|
+
} else {
|
|
344
|
+
rooServer.env[key] = `\${env:${value}}`;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
if (server.disabled !== void 0) {
|
|
349
|
+
rooServer.disabled = server.disabled;
|
|
350
|
+
}
|
|
351
|
+
if (server.alwaysAllow) {
|
|
352
|
+
rooServer.alwaysAllow = server.alwaysAllow;
|
|
353
|
+
}
|
|
354
|
+
if (server.networkTimeout !== void 0) {
|
|
355
|
+
rooServer.networkTimeout = Math.max(3e4, Math.min(3e5, server.networkTimeout));
|
|
356
|
+
}
|
|
357
|
+
rooConfig.mcpServers[serverName] = rooServer;
|
|
358
|
+
}
|
|
359
|
+
return JSON.stringify(rooConfig, null, 2);
|
|
360
|
+
}
|
|
361
|
+
var init_roo = __esm({
|
|
362
|
+
"src/generators/mcp/roo.ts"() {
|
|
363
|
+
"use strict";
|
|
364
|
+
init_mcp_helpers();
|
|
365
|
+
}
|
|
366
|
+
});
|
|
21
367
|
|
|
22
368
|
// src/cli/index.ts
|
|
23
|
-
|
|
369
|
+
var import_commander = require("commander");
|
|
24
370
|
|
|
25
371
|
// src/cli/commands/add.ts
|
|
26
|
-
|
|
27
|
-
|
|
372
|
+
var import_promises = require("fs/promises");
|
|
373
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
28
374
|
|
|
29
375
|
// src/utils/config.ts
|
|
30
376
|
function getDefaultConfig() {
|
|
@@ -72,10 +418,10 @@ async function addCommand(filename) {
|
|
|
72
418
|
const config = getDefaultConfig();
|
|
73
419
|
const sanitizedFilename = sanitizeFilename(filename);
|
|
74
420
|
const rulesDir = config.aiRulesDir;
|
|
75
|
-
const filePath =
|
|
76
|
-
await mkdir(rulesDir, { recursive: true });
|
|
421
|
+
const filePath = import_node_path.default.join(rulesDir, `${sanitizedFilename}.md`);
|
|
422
|
+
await (0, import_promises.mkdir)(rulesDir, { recursive: true });
|
|
77
423
|
const template = generateRuleTemplate(sanitizedFilename);
|
|
78
|
-
await writeFile(filePath, template, "utf8");
|
|
424
|
+
await (0, import_promises.writeFile)(filePath, template, "utf8");
|
|
79
425
|
console.log(`\u2705 Created rule file: ${filePath}`);
|
|
80
426
|
console.log(`\u{1F4DD} Edit the file to customize your rules.`);
|
|
81
427
|
} catch (error) {
|
|
@@ -87,32 +433,32 @@ async function addCommand(filename) {
|
|
|
87
433
|
}
|
|
88
434
|
|
|
89
435
|
// src/generators/rules/claudecode.ts
|
|
90
|
-
|
|
436
|
+
var import_node_path5 = require("path");
|
|
91
437
|
|
|
92
438
|
// src/utils/file.ts
|
|
93
|
-
|
|
94
|
-
|
|
439
|
+
var import_promises3 = require("fs/promises");
|
|
440
|
+
var import_node_path4 = require("path");
|
|
95
441
|
|
|
96
442
|
// src/utils/file-ops.ts
|
|
97
|
-
|
|
98
|
-
|
|
443
|
+
var import_promises2 = require("fs/promises");
|
|
444
|
+
var import_node_path2 = require("path");
|
|
99
445
|
async function ensureDir(dirPath) {
|
|
100
446
|
try {
|
|
101
|
-
await stat(dirPath);
|
|
447
|
+
await (0, import_promises2.stat)(dirPath);
|
|
102
448
|
} catch {
|
|
103
|
-
await
|
|
449
|
+
await (0, import_promises2.mkdir)(dirPath, { recursive: true });
|
|
104
450
|
}
|
|
105
451
|
}
|
|
106
452
|
async function readFileContent(filepath) {
|
|
107
|
-
return readFile(filepath, "utf-8");
|
|
453
|
+
return (0, import_promises2.readFile)(filepath, "utf-8");
|
|
108
454
|
}
|
|
109
455
|
async function writeFileContent(filepath, content) {
|
|
110
|
-
await ensureDir(dirname(filepath));
|
|
111
|
-
await
|
|
456
|
+
await ensureDir((0, import_node_path2.dirname)(filepath));
|
|
457
|
+
await (0, import_promises2.writeFile)(filepath, content, "utf-8");
|
|
112
458
|
}
|
|
113
459
|
async function fileExists(filepath) {
|
|
114
460
|
try {
|
|
115
|
-
await stat(filepath);
|
|
461
|
+
await (0, import_promises2.stat)(filepath);
|
|
116
462
|
return true;
|
|
117
463
|
} catch {
|
|
118
464
|
return false;
|
|
@@ -120,14 +466,14 @@ async function fileExists(filepath) {
|
|
|
120
466
|
}
|
|
121
467
|
|
|
122
468
|
// src/utils/ignore.ts
|
|
123
|
-
|
|
124
|
-
|
|
469
|
+
var import_node_path3 = require("path");
|
|
470
|
+
var import_micromatch = __toESM(require("micromatch"), 1);
|
|
125
471
|
var cachedIgnorePatterns = null;
|
|
126
472
|
async function loadIgnorePatterns(baseDir = process.cwd()) {
|
|
127
473
|
if (cachedIgnorePatterns) {
|
|
128
474
|
return cachedIgnorePatterns;
|
|
129
475
|
}
|
|
130
|
-
const ignorePath = join(baseDir, ".rulesyncignore");
|
|
476
|
+
const ignorePath = (0, import_node_path3.join)(baseDir, ".rulesyncignore");
|
|
131
477
|
if (!await fileExists(ignorePath)) {
|
|
132
478
|
cachedIgnorePatterns = { patterns: [] };
|
|
133
479
|
return cachedIgnorePatterns;
|
|
@@ -152,12 +498,12 @@ function isFileIgnored(filepath, ignorePatterns) {
|
|
|
152
498
|
}
|
|
153
499
|
const negationPatterns = ignorePatterns.filter((p) => p.startsWith("!"));
|
|
154
500
|
const positivePatterns = ignorePatterns.filter((p) => !p.startsWith("!"));
|
|
155
|
-
const isIgnored = positivePatterns.length > 0 &&
|
|
501
|
+
const isIgnored = positivePatterns.length > 0 && import_micromatch.default.isMatch(filepath, positivePatterns, {
|
|
156
502
|
dot: true
|
|
157
503
|
});
|
|
158
504
|
if (isIgnored && negationPatterns.length > 0) {
|
|
159
505
|
const negationPatternsWithoutPrefix = negationPatterns.map((p) => p.substring(1));
|
|
160
|
-
return !
|
|
506
|
+
return !import_micromatch.default.isMatch(filepath, negationPatternsWithoutPrefix, {
|
|
161
507
|
dot: true
|
|
162
508
|
});
|
|
163
509
|
}
|
|
@@ -173,8 +519,8 @@ function filterIgnoredFiles(files, ignorePatterns) {
|
|
|
173
519
|
// src/utils/file.ts
|
|
174
520
|
async function findFiles(dir, extension = ".md", ignorePatterns) {
|
|
175
521
|
try {
|
|
176
|
-
const files = await readdir(dir);
|
|
177
|
-
const filtered = files.filter((file) => file.endsWith(extension)).map((file) =>
|
|
522
|
+
const files = await (0, import_promises3.readdir)(dir);
|
|
523
|
+
const filtered = files.filter((file) => file.endsWith(extension)).map((file) => (0, import_node_path4.join)(dir, file));
|
|
178
524
|
if (ignorePatterns && ignorePatterns.length > 0) {
|
|
179
525
|
return filterIgnoredFiles(filtered, ignorePatterns);
|
|
180
526
|
}
|
|
@@ -191,7 +537,7 @@ async function removeDirectory(dirPath) {
|
|
|
191
537
|
}
|
|
192
538
|
try {
|
|
193
539
|
if (await fileExists(dirPath)) {
|
|
194
|
-
await rm(dirPath, { recursive: true, force: true });
|
|
540
|
+
await (0, import_promises3.rm)(dirPath, { recursive: true, force: true });
|
|
195
541
|
}
|
|
196
542
|
} catch (error) {
|
|
197
543
|
console.warn(`Failed to remove directory ${dirPath}:`, error);
|
|
@@ -200,7 +546,7 @@ async function removeDirectory(dirPath) {
|
|
|
200
546
|
async function removeFile(filepath) {
|
|
201
547
|
try {
|
|
202
548
|
if (await fileExists(filepath)) {
|
|
203
|
-
await rm(filepath);
|
|
549
|
+
await (0, import_promises3.rm)(filepath);
|
|
204
550
|
}
|
|
205
551
|
} catch (error) {
|
|
206
552
|
console.warn(`Failed to remove file ${filepath}:`, error);
|
|
@@ -223,23 +569,23 @@ async function generateClaudecodeConfig(rules, config, baseDir) {
|
|
|
223
569
|
const rootRules = rules.filter((r) => r.frontmatter.root === true);
|
|
224
570
|
const detailRules = rules.filter((r) => r.frontmatter.root === false);
|
|
225
571
|
const claudeMdContent = generateClaudeMarkdown(rootRules, detailRules);
|
|
226
|
-
const claudeOutputDir = baseDir ?
|
|
572
|
+
const claudeOutputDir = baseDir ? (0, import_node_path5.join)(baseDir, config.outputPaths.claudecode) : config.outputPaths.claudecode;
|
|
227
573
|
outputs.push({
|
|
228
574
|
tool: "claudecode",
|
|
229
|
-
filepath:
|
|
575
|
+
filepath: (0, import_node_path5.join)(claudeOutputDir, "CLAUDE.md"),
|
|
230
576
|
content: claudeMdContent
|
|
231
577
|
});
|
|
232
578
|
for (const rule of detailRules) {
|
|
233
579
|
const memoryContent = generateMemoryFile(rule);
|
|
234
580
|
outputs.push({
|
|
235
581
|
tool: "claudecode",
|
|
236
|
-
filepath:
|
|
582
|
+
filepath: (0, import_node_path5.join)(claudeOutputDir, ".claude", "memories", `${rule.filename}.md`),
|
|
237
583
|
content: memoryContent
|
|
238
584
|
});
|
|
239
585
|
}
|
|
240
586
|
const ignorePatterns = await loadIgnorePatterns(baseDir);
|
|
241
587
|
if (ignorePatterns.patterns.length > 0) {
|
|
242
|
-
const settingsPath = baseDir ?
|
|
588
|
+
const settingsPath = baseDir ? (0, import_node_path5.join)(baseDir, ".claude", "settings.json") : (0, import_node_path5.join)(".claude", "settings.json");
|
|
243
589
|
await updateClaudeSettings(settingsPath, ignorePatterns.patterns);
|
|
244
590
|
}
|
|
245
591
|
return outputs;
|
|
@@ -309,13 +655,13 @@ async function updateClaudeSettings(settingsPath, ignorePatterns) {
|
|
|
309
655
|
}
|
|
310
656
|
|
|
311
657
|
// src/generators/rules/cline.ts
|
|
312
|
-
|
|
658
|
+
var import_node_path6 = require("path");
|
|
313
659
|
async function generateClineConfig(rules, config, baseDir) {
|
|
314
660
|
const outputs = [];
|
|
315
661
|
for (const rule of rules) {
|
|
316
662
|
const content = generateClineMarkdown(rule);
|
|
317
|
-
const outputDir = baseDir ?
|
|
318
|
-
const filepath =
|
|
663
|
+
const outputDir = baseDir ? (0, import_node_path6.join)(baseDir, config.outputPaths.cline) : config.outputPaths.cline;
|
|
664
|
+
const filepath = (0, import_node_path6.join)(outputDir, `${rule.filename}.md`);
|
|
319
665
|
outputs.push({
|
|
320
666
|
tool: "cline",
|
|
321
667
|
filepath,
|
|
@@ -324,7 +670,7 @@ async function generateClineConfig(rules, config, baseDir) {
|
|
|
324
670
|
}
|
|
325
671
|
const ignorePatterns = await loadIgnorePatterns(baseDir);
|
|
326
672
|
if (ignorePatterns.patterns.length > 0) {
|
|
327
|
-
const clineIgnorePath = baseDir ?
|
|
673
|
+
const clineIgnorePath = baseDir ? (0, import_node_path6.join)(baseDir, ".clineignore") : ".clineignore";
|
|
328
674
|
const clineIgnoreContent = generateClineIgnore(ignorePatterns.patterns);
|
|
329
675
|
outputs.push({
|
|
330
676
|
tool: "cline",
|
|
@@ -348,14 +694,14 @@ function generateClineIgnore(patterns) {
|
|
|
348
694
|
}
|
|
349
695
|
|
|
350
696
|
// src/generators/rules/copilot.ts
|
|
351
|
-
|
|
697
|
+
var import_node_path7 = require("path");
|
|
352
698
|
async function generateCopilotConfig(rules, config, baseDir) {
|
|
353
699
|
const outputs = [];
|
|
354
700
|
for (const rule of rules) {
|
|
355
701
|
const content = generateCopilotMarkdown(rule);
|
|
356
702
|
const baseFilename = rule.filename.replace(/\.md$/, "");
|
|
357
|
-
const outputDir = baseDir ?
|
|
358
|
-
const filepath =
|
|
703
|
+
const outputDir = baseDir ? (0, import_node_path7.join)(baseDir, config.outputPaths.copilot) : config.outputPaths.copilot;
|
|
704
|
+
const filepath = (0, import_node_path7.join)(outputDir, `${baseFilename}.instructions.md`);
|
|
359
705
|
outputs.push({
|
|
360
706
|
tool: "copilot",
|
|
361
707
|
filepath,
|
|
@@ -364,7 +710,7 @@ async function generateCopilotConfig(rules, config, baseDir) {
|
|
|
364
710
|
}
|
|
365
711
|
const ignorePatterns = await loadIgnorePatterns(baseDir);
|
|
366
712
|
if (ignorePatterns.patterns.length > 0) {
|
|
367
|
-
const copilotIgnorePath = baseDir ?
|
|
713
|
+
const copilotIgnorePath = baseDir ? (0, import_node_path7.join)(baseDir, ".copilotignore") : ".copilotignore";
|
|
368
714
|
const copilotIgnoreContent = generateCopilotIgnore(ignorePatterns.patterns);
|
|
369
715
|
outputs.push({
|
|
370
716
|
tool: "copilot",
|
|
@@ -400,13 +746,13 @@ function generateCopilotIgnore(patterns) {
|
|
|
400
746
|
}
|
|
401
747
|
|
|
402
748
|
// src/generators/rules/cursor.ts
|
|
403
|
-
|
|
749
|
+
var import_node_path8 = require("path");
|
|
404
750
|
async function generateCursorConfig(rules, config, baseDir) {
|
|
405
751
|
const outputs = [];
|
|
406
752
|
for (const rule of rules) {
|
|
407
753
|
const content = generateCursorMarkdown(rule);
|
|
408
|
-
const outputDir = baseDir ?
|
|
409
|
-
const filepath =
|
|
754
|
+
const outputDir = baseDir ? (0, import_node_path8.join)(baseDir, config.outputPaths.cursor) : config.outputPaths.cursor;
|
|
755
|
+
const filepath = (0, import_node_path8.join)(outputDir, `${rule.filename}.mdc`);
|
|
410
756
|
outputs.push({
|
|
411
757
|
tool: "cursor",
|
|
412
758
|
filepath,
|
|
@@ -415,7 +761,7 @@ async function generateCursorConfig(rules, config, baseDir) {
|
|
|
415
761
|
}
|
|
416
762
|
const ignorePatterns = await loadIgnorePatterns(baseDir);
|
|
417
763
|
if (ignorePatterns.patterns.length > 0) {
|
|
418
|
-
const cursorIgnorePath = baseDir ?
|
|
764
|
+
const cursorIgnorePath = baseDir ? (0, import_node_path8.join)(baseDir, ".cursorignore") : ".cursorignore";
|
|
419
765
|
const cursorIgnoreContent = generateCursorIgnore(ignorePatterns.patterns);
|
|
420
766
|
outputs.push({
|
|
421
767
|
tool: "cursor",
|
|
@@ -456,15 +802,15 @@ function generateCursorIgnore(patterns) {
|
|
|
456
802
|
}
|
|
457
803
|
|
|
458
804
|
// src/generators/rules/geminicli.ts
|
|
459
|
-
|
|
805
|
+
var import_node_path9 = require("path");
|
|
460
806
|
async function generateGeminiConfig(rules, config, baseDir) {
|
|
461
807
|
const outputs = [];
|
|
462
808
|
const rootRule = rules.find((rule) => rule.frontmatter.root === true);
|
|
463
809
|
const memoryRules = rules.filter((rule) => rule.frontmatter.root === false);
|
|
464
810
|
for (const rule of memoryRules) {
|
|
465
811
|
const content = generateGeminiMemoryMarkdown(rule);
|
|
466
|
-
const outputDir = baseDir ?
|
|
467
|
-
const filepath =
|
|
812
|
+
const outputDir = baseDir ? (0, import_node_path9.join)(baseDir, config.outputPaths.geminicli) : config.outputPaths.geminicli;
|
|
813
|
+
const filepath = (0, import_node_path9.join)(outputDir, `${rule.filename}.md`);
|
|
468
814
|
outputs.push({
|
|
469
815
|
tool: "geminicli",
|
|
470
816
|
filepath,
|
|
@@ -472,7 +818,7 @@ async function generateGeminiConfig(rules, config, baseDir) {
|
|
|
472
818
|
});
|
|
473
819
|
}
|
|
474
820
|
const rootContent = generateGeminiRootMarkdown(rootRule, memoryRules, baseDir);
|
|
475
|
-
const rootFilepath = baseDir ?
|
|
821
|
+
const rootFilepath = baseDir ? (0, import_node_path9.join)(baseDir, "GEMINI.md") : "GEMINI.md";
|
|
476
822
|
outputs.push({
|
|
477
823
|
tool: "geminicli",
|
|
478
824
|
filepath: rootFilepath,
|
|
@@ -480,7 +826,7 @@ async function generateGeminiConfig(rules, config, baseDir) {
|
|
|
480
826
|
});
|
|
481
827
|
const ignorePatterns = await loadIgnorePatterns(baseDir);
|
|
482
828
|
if (ignorePatterns.patterns.length > 0) {
|
|
483
|
-
const aiexcludePath = baseDir ?
|
|
829
|
+
const aiexcludePath = baseDir ? (0, import_node_path9.join)(baseDir, ".aiexclude") : ".aiexclude";
|
|
484
830
|
const aiexcludeContent = generateAiexclude(ignorePatterns.patterns);
|
|
485
831
|
outputs.push({
|
|
486
832
|
tool: "geminicli",
|
|
@@ -528,13 +874,13 @@ function generateAiexclude(patterns) {
|
|
|
528
874
|
}
|
|
529
875
|
|
|
530
876
|
// src/generators/rules/roo.ts
|
|
531
|
-
|
|
877
|
+
var import_node_path10 = require("path");
|
|
532
878
|
async function generateRooConfig(rules, config, baseDir) {
|
|
533
879
|
const outputs = [];
|
|
534
880
|
for (const rule of rules) {
|
|
535
881
|
const content = generateRooMarkdown(rule);
|
|
536
|
-
const outputDir = baseDir ?
|
|
537
|
-
const filepath =
|
|
882
|
+
const outputDir = baseDir ? (0, import_node_path10.join)(baseDir, config.outputPaths.roo) : config.outputPaths.roo;
|
|
883
|
+
const filepath = (0, import_node_path10.join)(outputDir, `${rule.filename}.md`);
|
|
538
884
|
outputs.push({
|
|
539
885
|
tool: "roo",
|
|
540
886
|
filepath,
|
|
@@ -543,7 +889,7 @@ async function generateRooConfig(rules, config, baseDir) {
|
|
|
543
889
|
}
|
|
544
890
|
const ignorePatterns = await loadIgnorePatterns(baseDir);
|
|
545
891
|
if (ignorePatterns.patterns.length > 0) {
|
|
546
|
-
const rooIgnorePath = baseDir ?
|
|
892
|
+
const rooIgnorePath = baseDir ? (0, import_node_path10.join)(baseDir, ".rooignore") : ".rooignore";
|
|
547
893
|
const rooIgnoreContent = generateRooIgnore(ignorePatterns.patterns);
|
|
548
894
|
outputs.push({
|
|
549
895
|
tool: "roo",
|
|
@@ -616,8 +962,8 @@ async function generateForTool(tool, rules, config, baseDir) {
|
|
|
616
962
|
}
|
|
617
963
|
|
|
618
964
|
// src/core/parser.ts
|
|
619
|
-
|
|
620
|
-
|
|
965
|
+
var import_node_path11 = require("path");
|
|
966
|
+
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
621
967
|
async function parseRulesFromDirectory(aiRulesDir) {
|
|
622
968
|
const ignorePatterns = await loadIgnorePatterns();
|
|
623
969
|
const ruleFiles = await findFiles(aiRulesDir, ".md", ignorePatterns.patterns);
|
|
@@ -650,10 +996,10 @@ ${errors.join("\n")}`);
|
|
|
650
996
|
}
|
|
651
997
|
async function parseRuleFile(filepath) {
|
|
652
998
|
const content = await readFileContent(filepath);
|
|
653
|
-
const parsed =
|
|
999
|
+
const parsed = (0, import_gray_matter.default)(content);
|
|
654
1000
|
validateFrontmatter(parsed.data, filepath);
|
|
655
1001
|
const frontmatter = parsed.data;
|
|
656
|
-
const filename = basename(filepath, ".md");
|
|
1002
|
+
const filename = (0, import_node_path11.basename)(filepath, ".md");
|
|
657
1003
|
return {
|
|
658
1004
|
frontmatter,
|
|
659
1005
|
content: parsed.content,
|
|
@@ -782,19 +1128,27 @@ async function validateRule(rule) {
|
|
|
782
1128
|
}
|
|
783
1129
|
|
|
784
1130
|
// src/core/mcp-generator.ts
|
|
785
|
-
|
|
786
|
-
|
|
1131
|
+
var import_node_os = __toESM(require("os"), 1);
|
|
1132
|
+
var import_node_path13 = __toESM(require("path"), 1);
|
|
1133
|
+
|
|
1134
|
+
// src/generators/mcp/index.ts
|
|
1135
|
+
init_claude();
|
|
1136
|
+
init_cline();
|
|
1137
|
+
init_copilot();
|
|
1138
|
+
init_cursor();
|
|
1139
|
+
init_geminicli();
|
|
1140
|
+
init_roo();
|
|
787
1141
|
|
|
788
1142
|
// src/core/mcp-parser.ts
|
|
789
|
-
|
|
790
|
-
|
|
1143
|
+
var import_node_fs = __toESM(require("fs"), 1);
|
|
1144
|
+
var import_node_path12 = __toESM(require("path"), 1);
|
|
791
1145
|
function parseMcpConfig(projectRoot) {
|
|
792
|
-
const mcpPath =
|
|
793
|
-
if (!
|
|
1146
|
+
const mcpPath = import_node_path12.default.join(projectRoot, ".rulesync", ".mcp.json");
|
|
1147
|
+
if (!import_node_fs.default.existsSync(mcpPath)) {
|
|
794
1148
|
return null;
|
|
795
1149
|
}
|
|
796
1150
|
try {
|
|
797
|
-
const content =
|
|
1151
|
+
const content = import_node_fs.default.readFileSync(mcpPath, "utf-8");
|
|
798
1152
|
const rawConfig = JSON.parse(content);
|
|
799
1153
|
if (rawConfig.servers && !rawConfig.mcpServers) {
|
|
800
1154
|
rawConfig.mcpServers = rawConfig.servers;
|
|
@@ -825,32 +1179,32 @@ async function generateMcpConfigs(projectRoot, baseDir) {
|
|
|
825
1179
|
const generators = [
|
|
826
1180
|
{
|
|
827
1181
|
tool: "claude-project",
|
|
828
|
-
path:
|
|
1182
|
+
path: import_node_path13.default.join(targetRoot, ".mcp.json"),
|
|
829
1183
|
generate: () => generateClaudeMcp(config, "project")
|
|
830
1184
|
},
|
|
831
1185
|
{
|
|
832
1186
|
tool: "copilot-editor",
|
|
833
|
-
path:
|
|
1187
|
+
path: import_node_path13.default.join(targetRoot, ".vscode", "mcp.json"),
|
|
834
1188
|
generate: () => generateCopilotMcp(config, "editor")
|
|
835
1189
|
},
|
|
836
1190
|
{
|
|
837
1191
|
tool: "cursor-project",
|
|
838
|
-
path:
|
|
1192
|
+
path: import_node_path13.default.join(targetRoot, ".cursor", "mcp.json"),
|
|
839
1193
|
generate: () => generateCursorMcp(config, "project")
|
|
840
1194
|
},
|
|
841
1195
|
{
|
|
842
1196
|
tool: "cline-project",
|
|
843
|
-
path:
|
|
1197
|
+
path: import_node_path13.default.join(targetRoot, ".cline", "mcp.json"),
|
|
844
1198
|
generate: () => generateClineMcp(config, "project")
|
|
845
1199
|
},
|
|
846
1200
|
{
|
|
847
1201
|
tool: "gemini-project",
|
|
848
|
-
path:
|
|
1202
|
+
path: import_node_path13.default.join(targetRoot, ".gemini", "settings.json"),
|
|
849
1203
|
generate: () => generateGeminiCliMcp(config, "project")
|
|
850
1204
|
},
|
|
851
1205
|
{
|
|
852
1206
|
tool: "roo-project",
|
|
853
|
-
path:
|
|
1207
|
+
path: import_node_path13.default.join(targetRoot, ".roo", "mcp.json"),
|
|
854
1208
|
generate: () => generateRooMcp(config, "project")
|
|
855
1209
|
}
|
|
856
1210
|
];
|
|
@@ -858,17 +1212,17 @@ async function generateMcpConfigs(projectRoot, baseDir) {
|
|
|
858
1212
|
generators.push(
|
|
859
1213
|
{
|
|
860
1214
|
tool: "claude-global",
|
|
861
|
-
path:
|
|
1215
|
+
path: import_node_path13.default.join(import_node_os.default.homedir(), ".claude", "settings.json"),
|
|
862
1216
|
generate: () => generateClaudeMcp(config, "global")
|
|
863
1217
|
},
|
|
864
1218
|
{
|
|
865
1219
|
tool: "cursor-global",
|
|
866
|
-
path:
|
|
1220
|
+
path: import_node_path13.default.join(import_node_os.default.homedir(), ".cursor", "mcp.json"),
|
|
867
1221
|
generate: () => generateCursorMcp(config, "global")
|
|
868
1222
|
},
|
|
869
1223
|
{
|
|
870
1224
|
tool: "gemini-global",
|
|
871
|
-
path:
|
|
1225
|
+
path: import_node_path13.default.join(import_node_os.default.homedir(), ".gemini", "settings.json"),
|
|
872
1226
|
generate: () => generateGeminiCliMcp(config, "global")
|
|
873
1227
|
}
|
|
874
1228
|
);
|
|
@@ -1026,10 +1380,10 @@ Generating configurations for base directory: ${baseDir}`);
|
|
|
1026
1380
|
}
|
|
1027
1381
|
|
|
1028
1382
|
// src/cli/commands/gitignore.ts
|
|
1029
|
-
|
|
1030
|
-
|
|
1383
|
+
var import_node_fs2 = require("fs");
|
|
1384
|
+
var import_node_path14 = require("path");
|
|
1031
1385
|
var gitignoreCommand = async () => {
|
|
1032
|
-
const gitignorePath =
|
|
1386
|
+
const gitignorePath = (0, import_node_path14.join)(process.cwd(), ".gitignore");
|
|
1033
1387
|
const rulesFilesToIgnore = [
|
|
1034
1388
|
"# Generated by rulesync - AI tool configuration files",
|
|
1035
1389
|
"**/.github/copilot-instructions.md",
|
|
@@ -1047,6 +1401,7 @@ var gitignoreCommand = async () => {
|
|
|
1047
1401
|
"**/.gemini/memories/",
|
|
1048
1402
|
"**/.aiexclude",
|
|
1049
1403
|
"**/.mcp.json",
|
|
1404
|
+
"!.rulesync/.mcp.json",
|
|
1050
1405
|
"**/.cursor/mcp.json",
|
|
1051
1406
|
"**/.cline/mcp.json",
|
|
1052
1407
|
"**/.vscode/mcp.json",
|
|
@@ -1054,8 +1409,8 @@ var gitignoreCommand = async () => {
|
|
|
1054
1409
|
"**/.roo/mcp.json"
|
|
1055
1410
|
];
|
|
1056
1411
|
let gitignoreContent = "";
|
|
1057
|
-
if (existsSync(gitignorePath)) {
|
|
1058
|
-
gitignoreContent = readFileSync(gitignorePath, "utf-8");
|
|
1412
|
+
if ((0, import_node_fs2.existsSync)(gitignorePath)) {
|
|
1413
|
+
gitignoreContent = (0, import_node_fs2.readFileSync)(gitignorePath, "utf-8");
|
|
1059
1414
|
}
|
|
1060
1415
|
const linesToAdd = [];
|
|
1061
1416
|
for (const rule of rulesFilesToIgnore) {
|
|
@@ -1072,7 +1427,7 @@ var gitignoreCommand = async () => {
|
|
|
1072
1427
|
${linesToAdd.join("\n")}
|
|
1073
1428
|
` : `${linesToAdd.join("\n")}
|
|
1074
1429
|
`;
|
|
1075
|
-
writeFileSync(gitignorePath, newContent);
|
|
1430
|
+
(0, import_node_fs2.writeFileSync)(gitignorePath, newContent);
|
|
1076
1431
|
console.log(`\u2705 .gitignore\u306B${linesToAdd.length}\u500B\u306E\u30EB\u30FC\u30EB\u3092\u8FFD\u52A0\u3057\u307E\u3057\u305F:`);
|
|
1077
1432
|
for (const line of linesToAdd) {
|
|
1078
1433
|
if (!line.startsWith("#")) {
|
|
@@ -1082,17 +1437,17 @@ ${linesToAdd.join("\n")}
|
|
|
1082
1437
|
};
|
|
1083
1438
|
|
|
1084
1439
|
// src/core/importer.ts
|
|
1085
|
-
|
|
1086
|
-
|
|
1440
|
+
var import_node_path21 = require("path");
|
|
1441
|
+
var import_gray_matter4 = __toESM(require("gray-matter"), 1);
|
|
1087
1442
|
|
|
1088
1443
|
// src/parsers/claudecode.ts
|
|
1089
|
-
|
|
1444
|
+
var import_node_path15 = require("path");
|
|
1090
1445
|
async function parseClaudeConfiguration(baseDir = process.cwd()) {
|
|
1091
1446
|
const errors = [];
|
|
1092
1447
|
const rules = [];
|
|
1093
1448
|
let ignorePatterns;
|
|
1094
1449
|
let mcpServers;
|
|
1095
|
-
const claudeFilePath =
|
|
1450
|
+
const claudeFilePath = (0, import_node_path15.join)(baseDir, "CLAUDE.md");
|
|
1096
1451
|
if (!await fileExists(claudeFilePath)) {
|
|
1097
1452
|
errors.push("CLAUDE.md file not found");
|
|
1098
1453
|
return { rules, errors };
|
|
@@ -1103,12 +1458,12 @@ async function parseClaudeConfiguration(baseDir = process.cwd()) {
|
|
|
1103
1458
|
if (mainRule) {
|
|
1104
1459
|
rules.push(mainRule);
|
|
1105
1460
|
}
|
|
1106
|
-
const memoryDir =
|
|
1461
|
+
const memoryDir = (0, import_node_path15.join)(baseDir, ".claude", "memories");
|
|
1107
1462
|
if (await fileExists(memoryDir)) {
|
|
1108
1463
|
const memoryRules = await parseClaudeMemoryFiles(memoryDir);
|
|
1109
1464
|
rules.push(...memoryRules);
|
|
1110
1465
|
}
|
|
1111
|
-
const settingsPath =
|
|
1466
|
+
const settingsPath = (0, import_node_path15.join)(baseDir, ".claude", "settings.json");
|
|
1112
1467
|
if (await fileExists(settingsPath)) {
|
|
1113
1468
|
const settingsResult = await parseClaudeSettings(settingsPath);
|
|
1114
1469
|
if (settingsResult.ignorePatterns) {
|
|
@@ -1165,10 +1520,10 @@ async function parseClaudeMemoryFiles(memoryDir) {
|
|
|
1165
1520
|
const files = await readdir2(memoryDir);
|
|
1166
1521
|
for (const file of files) {
|
|
1167
1522
|
if (file.endsWith(".md")) {
|
|
1168
|
-
const filePath =
|
|
1523
|
+
const filePath = (0, import_node_path15.join)(memoryDir, file);
|
|
1169
1524
|
const content = await readFileContent(filePath);
|
|
1170
1525
|
if (content.trim()) {
|
|
1171
|
-
const filename =
|
|
1526
|
+
const filename = (0, import_node_path15.basename)(file, ".md");
|
|
1172
1527
|
const frontmatter = {
|
|
1173
1528
|
root: false,
|
|
1174
1529
|
targets: ["claudecode"],
|
|
@@ -1227,11 +1582,11 @@ async function parseClaudeSettings(settingsPath) {
|
|
|
1227
1582
|
}
|
|
1228
1583
|
|
|
1229
1584
|
// src/parsers/cline.ts
|
|
1230
|
-
|
|
1585
|
+
var import_node_path16 = require("path");
|
|
1231
1586
|
async function parseClineConfiguration(baseDir = process.cwd()) {
|
|
1232
1587
|
const errors = [];
|
|
1233
1588
|
const rules = [];
|
|
1234
|
-
const clineFilePath =
|
|
1589
|
+
const clineFilePath = (0, import_node_path16.join)(baseDir, ".cline", "instructions.md");
|
|
1235
1590
|
if (await fileExists(clineFilePath)) {
|
|
1236
1591
|
try {
|
|
1237
1592
|
const content = await readFileContent(clineFilePath);
|
|
@@ -1254,14 +1609,14 @@ async function parseClineConfiguration(baseDir = process.cwd()) {
|
|
|
1254
1609
|
errors.push(`Failed to parse .cline/instructions.md: ${errorMessage}`);
|
|
1255
1610
|
}
|
|
1256
1611
|
}
|
|
1257
|
-
const clinerulesDirPath =
|
|
1612
|
+
const clinerulesDirPath = (0, import_node_path16.join)(baseDir, ".clinerules");
|
|
1258
1613
|
if (await fileExists(clinerulesDirPath)) {
|
|
1259
1614
|
try {
|
|
1260
1615
|
const { readdir: readdir2 } = await import("fs/promises");
|
|
1261
1616
|
const files = await readdir2(clinerulesDirPath);
|
|
1262
1617
|
for (const file of files) {
|
|
1263
1618
|
if (file.endsWith(".md")) {
|
|
1264
|
-
const filePath =
|
|
1619
|
+
const filePath = (0, import_node_path16.join)(clinerulesDirPath, file);
|
|
1265
1620
|
try {
|
|
1266
1621
|
const content = await readFileContent(filePath);
|
|
1267
1622
|
if (content.trim()) {
|
|
@@ -1297,16 +1652,16 @@ async function parseClineConfiguration(baseDir = process.cwd()) {
|
|
|
1297
1652
|
}
|
|
1298
1653
|
|
|
1299
1654
|
// src/parsers/copilot.ts
|
|
1300
|
-
|
|
1301
|
-
|
|
1655
|
+
var import_node_path17 = require("path");
|
|
1656
|
+
var import_gray_matter2 = __toESM(require("gray-matter"), 1);
|
|
1302
1657
|
async function parseCopilotConfiguration(baseDir = process.cwd()) {
|
|
1303
1658
|
const errors = [];
|
|
1304
1659
|
const rules = [];
|
|
1305
|
-
const copilotFilePath =
|
|
1660
|
+
const copilotFilePath = (0, import_node_path17.join)(baseDir, ".github", "copilot-instructions.md");
|
|
1306
1661
|
if (await fileExists(copilotFilePath)) {
|
|
1307
1662
|
try {
|
|
1308
1663
|
const rawContent = await readFileContent(copilotFilePath);
|
|
1309
|
-
const parsed =
|
|
1664
|
+
const parsed = (0, import_gray_matter2.default)(rawContent);
|
|
1310
1665
|
const content = parsed.content.trim();
|
|
1311
1666
|
if (content) {
|
|
1312
1667
|
const frontmatter = {
|
|
@@ -1327,19 +1682,19 @@ async function parseCopilotConfiguration(baseDir = process.cwd()) {
|
|
|
1327
1682
|
errors.push(`Failed to parse copilot-instructions.md: ${errorMessage}`);
|
|
1328
1683
|
}
|
|
1329
1684
|
}
|
|
1330
|
-
const instructionsDir =
|
|
1685
|
+
const instructionsDir = (0, import_node_path17.join)(baseDir, ".github", "instructions");
|
|
1331
1686
|
if (await fileExists(instructionsDir)) {
|
|
1332
1687
|
try {
|
|
1333
1688
|
const { readdir: readdir2 } = await import("fs/promises");
|
|
1334
1689
|
const files = await readdir2(instructionsDir);
|
|
1335
1690
|
for (const file of files) {
|
|
1336
1691
|
if (file.endsWith(".instructions.md")) {
|
|
1337
|
-
const filePath =
|
|
1692
|
+
const filePath = (0, import_node_path17.join)(instructionsDir, file);
|
|
1338
1693
|
const rawContent = await readFileContent(filePath);
|
|
1339
|
-
const parsed =
|
|
1694
|
+
const parsed = (0, import_gray_matter2.default)(rawContent);
|
|
1340
1695
|
const content = parsed.content.trim();
|
|
1341
1696
|
if (content) {
|
|
1342
|
-
const filename =
|
|
1697
|
+
const filename = (0, import_node_path17.basename)(file, ".instructions.md");
|
|
1343
1698
|
const frontmatter = {
|
|
1344
1699
|
root: false,
|
|
1345
1700
|
targets: ["copilot"],
|
|
@@ -1369,19 +1724,19 @@ async function parseCopilotConfiguration(baseDir = process.cwd()) {
|
|
|
1369
1724
|
}
|
|
1370
1725
|
|
|
1371
1726
|
// src/parsers/cursor.ts
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1727
|
+
var import_node_path18 = require("path");
|
|
1728
|
+
var import_gray_matter3 = __toESM(require("gray-matter"), 1);
|
|
1729
|
+
var import_js_yaml = require("js-yaml");
|
|
1375
1730
|
var customMatterOptions = {
|
|
1376
1731
|
engines: {
|
|
1377
1732
|
yaml: {
|
|
1378
1733
|
parse: (str) => {
|
|
1379
1734
|
try {
|
|
1380
1735
|
const preprocessed = str.replace(/^(\s*globs:\s*)\*\s*$/gm, '$1"*"');
|
|
1381
|
-
return load(preprocessed, { schema: DEFAULT_SCHEMA });
|
|
1736
|
+
return (0, import_js_yaml.load)(preprocessed, { schema: import_js_yaml.DEFAULT_SCHEMA });
|
|
1382
1737
|
} catch (error) {
|
|
1383
1738
|
try {
|
|
1384
|
-
return load(str, { schema: FAILSAFE_SCHEMA });
|
|
1739
|
+
return (0, import_js_yaml.load)(str, { schema: import_js_yaml.FAILSAFE_SCHEMA });
|
|
1385
1740
|
} catch {
|
|
1386
1741
|
throw error;
|
|
1387
1742
|
}
|
|
@@ -1395,11 +1750,11 @@ async function parseCursorConfiguration(baseDir = process.cwd()) {
|
|
|
1395
1750
|
const rules = [];
|
|
1396
1751
|
let ignorePatterns;
|
|
1397
1752
|
let mcpServers;
|
|
1398
|
-
const cursorFilePath =
|
|
1753
|
+
const cursorFilePath = (0, import_node_path18.join)(baseDir, ".cursorrules");
|
|
1399
1754
|
if (await fileExists(cursorFilePath)) {
|
|
1400
1755
|
try {
|
|
1401
1756
|
const rawContent = await readFileContent(cursorFilePath);
|
|
1402
|
-
const parsed =
|
|
1757
|
+
const parsed = (0, import_gray_matter3.default)(rawContent, customMatterOptions);
|
|
1403
1758
|
const content = parsed.content.trim();
|
|
1404
1759
|
if (content) {
|
|
1405
1760
|
const frontmatter = {
|
|
@@ -1420,20 +1775,20 @@ async function parseCursorConfiguration(baseDir = process.cwd()) {
|
|
|
1420
1775
|
errors.push(`Failed to parse .cursorrules file: ${errorMessage}`);
|
|
1421
1776
|
}
|
|
1422
1777
|
}
|
|
1423
|
-
const cursorRulesDir =
|
|
1778
|
+
const cursorRulesDir = (0, import_node_path18.join)(baseDir, ".cursor", "rules");
|
|
1424
1779
|
if (await fileExists(cursorRulesDir)) {
|
|
1425
1780
|
try {
|
|
1426
1781
|
const { readdir: readdir2 } = await import("fs/promises");
|
|
1427
1782
|
const files = await readdir2(cursorRulesDir);
|
|
1428
1783
|
for (const file of files) {
|
|
1429
1784
|
if (file.endsWith(".mdc")) {
|
|
1430
|
-
const filePath =
|
|
1785
|
+
const filePath = (0, import_node_path18.join)(cursorRulesDir, file);
|
|
1431
1786
|
try {
|
|
1432
1787
|
const rawContent = await readFileContent(filePath);
|
|
1433
|
-
const parsed =
|
|
1788
|
+
const parsed = (0, import_gray_matter3.default)(rawContent, customMatterOptions);
|
|
1434
1789
|
const content = parsed.content.trim();
|
|
1435
1790
|
if (content) {
|
|
1436
|
-
const filename =
|
|
1791
|
+
const filename = (0, import_node_path18.basename)(file, ".mdc");
|
|
1437
1792
|
const frontmatter = {
|
|
1438
1793
|
root: false,
|
|
1439
1794
|
targets: ["cursor"],
|
|
@@ -1461,7 +1816,7 @@ async function parseCursorConfiguration(baseDir = process.cwd()) {
|
|
|
1461
1816
|
if (rules.length === 0) {
|
|
1462
1817
|
errors.push("No Cursor configuration files found (.cursorrules or .cursor/rules/*.mdc)");
|
|
1463
1818
|
}
|
|
1464
|
-
const cursorIgnorePath =
|
|
1819
|
+
const cursorIgnorePath = (0, import_node_path18.join)(baseDir, ".cursorignore");
|
|
1465
1820
|
if (await fileExists(cursorIgnorePath)) {
|
|
1466
1821
|
try {
|
|
1467
1822
|
const content = await readFileContent(cursorIgnorePath);
|
|
@@ -1474,7 +1829,7 @@ async function parseCursorConfiguration(baseDir = process.cwd()) {
|
|
|
1474
1829
|
errors.push(`Failed to parse .cursorignore: ${errorMessage}`);
|
|
1475
1830
|
}
|
|
1476
1831
|
}
|
|
1477
|
-
const cursorMcpPath =
|
|
1832
|
+
const cursorMcpPath = (0, import_node_path18.join)(baseDir, ".cursor", "mcp.json");
|
|
1478
1833
|
if (await fileExists(cursorMcpPath)) {
|
|
1479
1834
|
try {
|
|
1480
1835
|
const content = await readFileContent(cursorMcpPath);
|
|
@@ -1496,13 +1851,13 @@ async function parseCursorConfiguration(baseDir = process.cwd()) {
|
|
|
1496
1851
|
}
|
|
1497
1852
|
|
|
1498
1853
|
// src/parsers/geminicli.ts
|
|
1499
|
-
|
|
1854
|
+
var import_node_path19 = require("path");
|
|
1500
1855
|
async function parseGeminiConfiguration(baseDir = process.cwd()) {
|
|
1501
1856
|
const errors = [];
|
|
1502
1857
|
const rules = [];
|
|
1503
1858
|
let ignorePatterns;
|
|
1504
1859
|
let mcpServers;
|
|
1505
|
-
const geminiFilePath =
|
|
1860
|
+
const geminiFilePath = (0, import_node_path19.join)(baseDir, "GEMINI.md");
|
|
1506
1861
|
if (!await fileExists(geminiFilePath)) {
|
|
1507
1862
|
errors.push("GEMINI.md file not found");
|
|
1508
1863
|
return { rules, errors };
|
|
@@ -1513,12 +1868,12 @@ async function parseGeminiConfiguration(baseDir = process.cwd()) {
|
|
|
1513
1868
|
if (mainRule) {
|
|
1514
1869
|
rules.push(mainRule);
|
|
1515
1870
|
}
|
|
1516
|
-
const memoryDir =
|
|
1871
|
+
const memoryDir = (0, import_node_path19.join)(baseDir, ".gemini", "memories");
|
|
1517
1872
|
if (await fileExists(memoryDir)) {
|
|
1518
1873
|
const memoryRules = await parseGeminiMemoryFiles(memoryDir);
|
|
1519
1874
|
rules.push(...memoryRules);
|
|
1520
1875
|
}
|
|
1521
|
-
const settingsPath =
|
|
1876
|
+
const settingsPath = (0, import_node_path19.join)(baseDir, ".gemini", "settings.json");
|
|
1522
1877
|
if (await fileExists(settingsPath)) {
|
|
1523
1878
|
const settingsResult = await parseGeminiSettings(settingsPath);
|
|
1524
1879
|
if (settingsResult.ignorePatterns) {
|
|
@@ -1529,7 +1884,7 @@ async function parseGeminiConfiguration(baseDir = process.cwd()) {
|
|
|
1529
1884
|
}
|
|
1530
1885
|
errors.push(...settingsResult.errors);
|
|
1531
1886
|
}
|
|
1532
|
-
const aiexcludePath =
|
|
1887
|
+
const aiexcludePath = (0, import_node_path19.join)(baseDir, ".aiexclude");
|
|
1533
1888
|
if (await fileExists(aiexcludePath)) {
|
|
1534
1889
|
const aiexcludePatterns = await parseAiexclude(aiexcludePath);
|
|
1535
1890
|
if (aiexcludePatterns.length > 0) {
|
|
@@ -1582,10 +1937,10 @@ async function parseGeminiMemoryFiles(memoryDir) {
|
|
|
1582
1937
|
const files = await readdir2(memoryDir);
|
|
1583
1938
|
for (const file of files) {
|
|
1584
1939
|
if (file.endsWith(".md")) {
|
|
1585
|
-
const filePath =
|
|
1940
|
+
const filePath = (0, import_node_path19.join)(memoryDir, file);
|
|
1586
1941
|
const content = await readFileContent(filePath);
|
|
1587
1942
|
if (content.trim()) {
|
|
1588
|
-
const filename =
|
|
1943
|
+
const filename = (0, import_node_path19.basename)(file, ".md");
|
|
1589
1944
|
const frontmatter = {
|
|
1590
1945
|
root: false,
|
|
1591
1946
|
targets: ["geminicli"],
|
|
@@ -1634,11 +1989,11 @@ async function parseAiexclude(aiexcludePath) {
|
|
|
1634
1989
|
}
|
|
1635
1990
|
|
|
1636
1991
|
// src/parsers/roo.ts
|
|
1637
|
-
|
|
1992
|
+
var import_node_path20 = require("path");
|
|
1638
1993
|
async function parseRooConfiguration(baseDir = process.cwd()) {
|
|
1639
1994
|
const errors = [];
|
|
1640
1995
|
const rules = [];
|
|
1641
|
-
const rooFilePath =
|
|
1996
|
+
const rooFilePath = (0, import_node_path20.join)(baseDir, ".roo", "instructions.md");
|
|
1642
1997
|
if (await fileExists(rooFilePath)) {
|
|
1643
1998
|
try {
|
|
1644
1999
|
const content = await readFileContent(rooFilePath);
|
|
@@ -1661,14 +2016,14 @@ async function parseRooConfiguration(baseDir = process.cwd()) {
|
|
|
1661
2016
|
errors.push(`Failed to parse .roo/instructions.md: ${errorMessage}`);
|
|
1662
2017
|
}
|
|
1663
2018
|
}
|
|
1664
|
-
const rooRulesDir =
|
|
2019
|
+
const rooRulesDir = (0, import_node_path20.join)(baseDir, ".roo", "rules");
|
|
1665
2020
|
if (await fileExists(rooRulesDir)) {
|
|
1666
2021
|
try {
|
|
1667
2022
|
const { readdir: readdir2 } = await import("fs/promises");
|
|
1668
2023
|
const files = await readdir2(rooRulesDir);
|
|
1669
2024
|
for (const file of files) {
|
|
1670
2025
|
if (file.endsWith(".md")) {
|
|
1671
|
-
const filePath =
|
|
2026
|
+
const filePath = (0, import_node_path20.join)(rooRulesDir, file);
|
|
1672
2027
|
try {
|
|
1673
2028
|
const content = await readFileContent(filePath);
|
|
1674
2029
|
if (content.trim()) {
|
|
@@ -1769,7 +2124,7 @@ async function importConfiguration(options) {
|
|
|
1769
2124
|
if (rules.length === 0 && !ignorePatterns && !mcpServers) {
|
|
1770
2125
|
return { success: false, rulesCreated: 0, errors };
|
|
1771
2126
|
}
|
|
1772
|
-
const rulesDirPath =
|
|
2127
|
+
const rulesDirPath = (0, import_node_path21.join)(baseDir, rulesDir);
|
|
1773
2128
|
try {
|
|
1774
2129
|
const { mkdir: mkdir3 } = await import("fs/promises");
|
|
1775
2130
|
await mkdir3(rulesDirPath, { recursive: true });
|
|
@@ -1783,7 +2138,7 @@ async function importConfiguration(options) {
|
|
|
1783
2138
|
try {
|
|
1784
2139
|
const baseFilename = `${tool}__${rule.filename}`;
|
|
1785
2140
|
const filename = await generateUniqueFilename(rulesDirPath, baseFilename);
|
|
1786
|
-
const filePath =
|
|
2141
|
+
const filePath = (0, import_node_path21.join)(rulesDirPath, `${filename}.md`);
|
|
1787
2142
|
const content = generateRuleFileContent(rule);
|
|
1788
2143
|
await writeFileContent(filePath, content);
|
|
1789
2144
|
rulesCreated++;
|
|
@@ -1798,7 +2153,7 @@ async function importConfiguration(options) {
|
|
|
1798
2153
|
let ignoreFileCreated = false;
|
|
1799
2154
|
if (ignorePatterns && ignorePatterns.length > 0) {
|
|
1800
2155
|
try {
|
|
1801
|
-
const rulesyncignorePath =
|
|
2156
|
+
const rulesyncignorePath = (0, import_node_path21.join)(baseDir, ".rulesyncignore");
|
|
1802
2157
|
const ignoreContent = `${ignorePatterns.join("\n")}
|
|
1803
2158
|
`;
|
|
1804
2159
|
await writeFileContent(rulesyncignorePath, ignoreContent);
|
|
@@ -1814,7 +2169,7 @@ async function importConfiguration(options) {
|
|
|
1814
2169
|
let mcpFileCreated = false;
|
|
1815
2170
|
if (mcpServers && Object.keys(mcpServers).length > 0) {
|
|
1816
2171
|
try {
|
|
1817
|
-
const mcpPath =
|
|
2172
|
+
const mcpPath = (0, import_node_path21.join)(baseDir, rulesDir, ".mcp.json");
|
|
1818
2173
|
const mcpContent = `${JSON.stringify({ mcpServers }, null, 2)}
|
|
1819
2174
|
`;
|
|
1820
2175
|
await writeFileContent(mcpPath, mcpContent);
|
|
@@ -1836,13 +2191,13 @@ async function importConfiguration(options) {
|
|
|
1836
2191
|
};
|
|
1837
2192
|
}
|
|
1838
2193
|
function generateRuleFileContent(rule) {
|
|
1839
|
-
const frontmatter =
|
|
2194
|
+
const frontmatter = import_gray_matter4.default.stringify("", rule.frontmatter);
|
|
1840
2195
|
return frontmatter + rule.content;
|
|
1841
2196
|
}
|
|
1842
2197
|
async function generateUniqueFilename(rulesDir, baseFilename) {
|
|
1843
2198
|
let filename = baseFilename;
|
|
1844
2199
|
let counter = 1;
|
|
1845
|
-
while (await fileExists(
|
|
2200
|
+
while (await fileExists((0, import_node_path21.join)(rulesDir, `${filename}.md`))) {
|
|
1846
2201
|
filename = `${baseFilename}-${counter}`;
|
|
1847
2202
|
counter++;
|
|
1848
2203
|
}
|
|
@@ -1907,7 +2262,7 @@ async function importCommand(options = {}) {
|
|
|
1907
2262
|
}
|
|
1908
2263
|
|
|
1909
2264
|
// src/cli/commands/init.ts
|
|
1910
|
-
|
|
2265
|
+
var import_node_path22 = require("path");
|
|
1911
2266
|
async function initCommand() {
|
|
1912
2267
|
const aiRulesDir = ".rulesync";
|
|
1913
2268
|
console.log("Initializing rulesync...");
|
|
@@ -2037,7 +2392,7 @@ globs: ["src/api/**/*.ts", "src/services/**/*.ts", "src/models/**/*.ts"]
|
|
|
2037
2392
|
}
|
|
2038
2393
|
];
|
|
2039
2394
|
for (const file of sampleFiles) {
|
|
2040
|
-
const filepath =
|
|
2395
|
+
const filepath = (0, import_node_path22.join)(aiRulesDir, file.filename);
|
|
2041
2396
|
if (!await fileExists(filepath)) {
|
|
2042
2397
|
await writeFileContent(filepath, file.content);
|
|
2043
2398
|
console.log(`Created ${filepath}`);
|
|
@@ -2139,13 +2494,13 @@ async function validateCommand() {
|
|
|
2139
2494
|
}
|
|
2140
2495
|
|
|
2141
2496
|
// src/cli/commands/watch.ts
|
|
2142
|
-
|
|
2497
|
+
var import_chokidar = require("chokidar");
|
|
2143
2498
|
async function watchCommand() {
|
|
2144
2499
|
const config = getDefaultConfig();
|
|
2145
2500
|
console.log("\u{1F440} Watching for changes in .rulesync directory...");
|
|
2146
2501
|
console.log("Press Ctrl+C to stop watching");
|
|
2147
2502
|
await generateCommand({ verbose: false });
|
|
2148
|
-
const watcher = watch(`${config.aiRulesDir}/**/*.md`, {
|
|
2503
|
+
const watcher = (0, import_chokidar.watch)(`${config.aiRulesDir}/**/*.md`, {
|
|
2149
2504
|
ignoreInitial: true,
|
|
2150
2505
|
persistent: true
|
|
2151
2506
|
});
|
|
@@ -2179,8 +2534,8 @@ async function watchCommand() {
|
|
|
2179
2534
|
}
|
|
2180
2535
|
|
|
2181
2536
|
// src/cli/index.ts
|
|
2182
|
-
var program = new Command();
|
|
2183
|
-
program.name("rulesync").description("Unified AI rules management CLI tool").version("0.
|
|
2537
|
+
var program = new import_commander.Command();
|
|
2538
|
+
program.name("rulesync").description("Unified AI rules management CLI tool").version("0.38.0");
|
|
2184
2539
|
program.command("init").description("Initialize rulesync in current directory").action(initCommand);
|
|
2185
2540
|
program.command("add <filename>").description("Add a new rule file").action(addCommand);
|
|
2186
2541
|
program.command("gitignore").description("Add generated files to .gitignore").action(gitignoreCommand);
|