rulesync 0.51.0 → 0.53.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-FNL2KPM3.js +63 -0
- package/dist/chunk-HMMTSS5E.js +54 -0
- package/dist/chunk-YPIFCGAP.js +94 -0
- package/dist/{claudecode-SRXYHIJE.js → claudecode-4XWK2WAY.js} +2 -1
- package/dist/{cline-IJW27CUU.js → cline-MNXOHP77.js} +2 -1
- package/dist/index.cjs +361 -346
- package/dist/index.js +274 -282
- package/package.json +1 -1
- package/dist/chunk-4MZXYV5H.js +0 -73
- package/dist/chunk-AREA26HF.js +0 -62
package/dist/index.cjs
CHANGED
|
@@ -136,84 +136,108 @@ var init_augmentcode = __esm({
|
|
|
136
136
|
}
|
|
137
137
|
});
|
|
138
138
|
|
|
139
|
+
// src/generators/mcp/shared-factory.ts
|
|
140
|
+
function generateMcpConfig(config, toolConfig) {
|
|
141
|
+
const servers = {};
|
|
142
|
+
for (const [serverName, server] of Object.entries(config.mcpServers)) {
|
|
143
|
+
if (!shouldIncludeServer(server, toolConfig.target)) continue;
|
|
144
|
+
servers[serverName] = toolConfig.serverTransform(server, serverName);
|
|
145
|
+
}
|
|
146
|
+
const finalConfig = toolConfig.configWrapper(servers);
|
|
147
|
+
return JSON.stringify(finalConfig, null, 2);
|
|
148
|
+
}
|
|
149
|
+
var configWrappers;
|
|
150
|
+
var init_shared_factory = __esm({
|
|
151
|
+
"src/generators/mcp/shared-factory.ts"() {
|
|
152
|
+
"use strict";
|
|
153
|
+
init_mcp_helpers();
|
|
154
|
+
configWrappers = {
|
|
155
|
+
/**
|
|
156
|
+
* Standard mcpServers wrapper
|
|
157
|
+
*/
|
|
158
|
+
mcpServers: (servers) => ({
|
|
159
|
+
mcpServers: servers
|
|
160
|
+
}),
|
|
161
|
+
/**
|
|
162
|
+
* Servers-only wrapper (for tools that use "servers" instead of "mcpServers")
|
|
163
|
+
*/
|
|
164
|
+
servers: (servers) => ({
|
|
165
|
+
servers
|
|
166
|
+
})
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
|
|
139
171
|
// src/generators/mcp/claudecode.ts
|
|
140
172
|
function generateClaudeMcp(config) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
173
|
+
return generateMcpConfig(config, {
|
|
174
|
+
target: "claudecode",
|
|
175
|
+
configPaths: [".claude/settings.json"],
|
|
176
|
+
serverTransform: (server) => {
|
|
177
|
+
const claudeServer = {};
|
|
178
|
+
if (server.command) {
|
|
179
|
+
claudeServer.command = server.command;
|
|
180
|
+
if (server.args) claudeServer.args = server.args;
|
|
181
|
+
} else if (server.url || server.httpUrl) {
|
|
182
|
+
const url = server.httpUrl || server.url;
|
|
183
|
+
if (url) {
|
|
184
|
+
claudeServer.url = url;
|
|
185
|
+
}
|
|
186
|
+
if (server.httpUrl) {
|
|
187
|
+
claudeServer.transport = "http";
|
|
188
|
+
} else if (server.transport === "sse") {
|
|
189
|
+
claudeServer.transport = "sse";
|
|
190
|
+
}
|
|
157
191
|
}
|
|
158
|
-
if (server.
|
|
159
|
-
claudeServer.
|
|
160
|
-
} else if (server.transport === "sse") {
|
|
161
|
-
claudeServer.transport = "sse";
|
|
192
|
+
if (server.env) {
|
|
193
|
+
claudeServer.env = server.env;
|
|
162
194
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
if (claudeSettings.mcpServers) {
|
|
168
|
-
claudeSettings.mcpServers[serverName] = claudeServer;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return JSON.stringify(claudeSettings, null, 2);
|
|
195
|
+
return claudeServer;
|
|
196
|
+
},
|
|
197
|
+
configWrapper: configWrappers.mcpServers
|
|
198
|
+
});
|
|
172
199
|
}
|
|
173
200
|
var init_claudecode = __esm({
|
|
174
201
|
"src/generators/mcp/claudecode.ts"() {
|
|
175
202
|
"use strict";
|
|
176
|
-
|
|
203
|
+
init_shared_factory();
|
|
177
204
|
}
|
|
178
205
|
});
|
|
179
206
|
|
|
180
207
|
// src/generators/mcp/cline.ts
|
|
181
208
|
function generateClineMcp(config) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
if (server.
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
clineConfig.mcpServers[serverName] = clineServer;
|
|
210
|
-
}
|
|
211
|
-
return JSON.stringify(clineConfig, null, 2);
|
|
209
|
+
return generateMcpConfig(config, {
|
|
210
|
+
target: "cline",
|
|
211
|
+
configPaths: [".cline/mcp.json"],
|
|
212
|
+
serverTransform: (server) => {
|
|
213
|
+
const clineServer = {};
|
|
214
|
+
if (server.command) {
|
|
215
|
+
clineServer.command = server.command;
|
|
216
|
+
if (server.args) clineServer.args = server.args;
|
|
217
|
+
} else if (server.url) {
|
|
218
|
+
clineServer.url = server.url;
|
|
219
|
+
}
|
|
220
|
+
if (server.env) {
|
|
221
|
+
clineServer.env = server.env;
|
|
222
|
+
}
|
|
223
|
+
if (server.disabled !== void 0) {
|
|
224
|
+
clineServer.disabled = server.disabled;
|
|
225
|
+
}
|
|
226
|
+
if (server.alwaysAllow) {
|
|
227
|
+
clineServer.alwaysAllow = server.alwaysAllow;
|
|
228
|
+
}
|
|
229
|
+
if (server.networkTimeout !== void 0) {
|
|
230
|
+
clineServer.networkTimeout = server.networkTimeout;
|
|
231
|
+
}
|
|
232
|
+
return clineServer;
|
|
233
|
+
},
|
|
234
|
+
configWrapper: configWrappers.mcpServers
|
|
235
|
+
});
|
|
212
236
|
}
|
|
213
237
|
var init_cline = __esm({
|
|
214
238
|
"src/generators/mcp/cline.ts"() {
|
|
215
239
|
"use strict";
|
|
216
|
-
|
|
240
|
+
init_shared_factory();
|
|
217
241
|
}
|
|
218
242
|
});
|
|
219
243
|
|
|
@@ -1217,9 +1241,9 @@ export default config;
|
|
|
1217
1241
|
}
|
|
1218
1242
|
|
|
1219
1243
|
// src/cli/commands/generate.ts
|
|
1220
|
-
var
|
|
1244
|
+
var import_node_path12 = require("path");
|
|
1221
1245
|
|
|
1222
|
-
// src/generators/ignore/
|
|
1246
|
+
// src/generators/ignore/shared-factory.ts
|
|
1223
1247
|
var import_node_path3 = require("path");
|
|
1224
1248
|
|
|
1225
1249
|
// src/generators/ignore/shared-helpers.ts
|
|
@@ -1333,165 +1357,43 @@ function extractAugmentCodeIgnorePatternsFromContent(content) {
|
|
|
1333
1357
|
return patterns;
|
|
1334
1358
|
}
|
|
1335
1359
|
|
|
1336
|
-
// src/generators/ignore/
|
|
1337
|
-
|
|
1360
|
+
// src/generators/ignore/shared-factory.ts
|
|
1361
|
+
function generateIgnoreFile(rules, config, ignoreConfig, baseDir) {
|
|
1338
1362
|
const outputs = [];
|
|
1339
|
-
const
|
|
1363
|
+
const content = generateIgnoreContent(rules, ignoreConfig);
|
|
1340
1364
|
const outputPath = baseDir || process.cwd();
|
|
1341
|
-
const filepath = (0, import_node_path3.join)(outputPath,
|
|
1365
|
+
const filepath = (0, import_node_path3.join)(outputPath, ignoreConfig.filename);
|
|
1342
1366
|
outputs.push({
|
|
1343
|
-
tool:
|
|
1367
|
+
tool: ignoreConfig.tool,
|
|
1344
1368
|
filepath,
|
|
1345
|
-
content
|
|
1369
|
+
content
|
|
1346
1370
|
});
|
|
1347
1371
|
return outputs;
|
|
1348
1372
|
}
|
|
1349
|
-
function
|
|
1350
|
-
const lines = [
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
];
|
|
1356
|
-
lines.push(
|
|
1357
|
-
"# Security and Secrets (critical exclusions)",
|
|
1358
|
-
"# Environment files",
|
|
1359
|
-
".env*",
|
|
1360
|
-
"",
|
|
1361
|
-
"# Private keys and certificates",
|
|
1362
|
-
"*.pem",
|
|
1363
|
-
"*.key",
|
|
1364
|
-
"*.p12",
|
|
1365
|
-
"*.crt",
|
|
1366
|
-
"*.der",
|
|
1367
|
-
"",
|
|
1368
|
-
"# SSH keys",
|
|
1369
|
-
"id_rsa*",
|
|
1370
|
-
"id_dsa*",
|
|
1371
|
-
"",
|
|
1372
|
-
"# AWS credentials",
|
|
1373
|
-
".aws/",
|
|
1374
|
-
"aws-exports.js",
|
|
1375
|
-
"",
|
|
1376
|
-
"# API keys and tokens",
|
|
1377
|
-
"**/apikeys/",
|
|
1378
|
-
"**/*_token*",
|
|
1379
|
-
"**/*_secret*",
|
|
1380
|
-
""
|
|
1381
|
-
);
|
|
1382
|
-
lines.push(
|
|
1383
|
-
"# Build Artifacts and Dependencies",
|
|
1384
|
-
"# Build outputs",
|
|
1385
|
-
"dist/",
|
|
1386
|
-
"build/",
|
|
1387
|
-
"out/",
|
|
1388
|
-
"target/",
|
|
1389
|
-
"",
|
|
1390
|
-
"# Dependencies",
|
|
1391
|
-
"node_modules/",
|
|
1392
|
-
"venv/",
|
|
1393
|
-
"*.egg-info/",
|
|
1394
|
-
"",
|
|
1395
|
-
"# Logs",
|
|
1396
|
-
"*.log",
|
|
1397
|
-
"logs/",
|
|
1398
|
-
"",
|
|
1399
|
-
"# Temporary files",
|
|
1400
|
-
"*.tmp",
|
|
1401
|
-
"*.swp",
|
|
1402
|
-
"*.swo",
|
|
1403
|
-
"*~",
|
|
1404
|
-
""
|
|
1405
|
-
);
|
|
1406
|
-
lines.push(
|
|
1407
|
-
"# Large Files and Media",
|
|
1408
|
-
"# Binary files",
|
|
1409
|
-
"*.jar",
|
|
1410
|
-
"*.png",
|
|
1411
|
-
"*.jpg",
|
|
1412
|
-
"*.jpeg",
|
|
1413
|
-
"*.gif",
|
|
1414
|
-
"*.mp4",
|
|
1415
|
-
"*.avi",
|
|
1416
|
-
"*.zip",
|
|
1417
|
-
"*.tar.gz",
|
|
1418
|
-
"*.rar",
|
|
1419
|
-
"",
|
|
1420
|
-
"# Database files",
|
|
1421
|
-
"*.sqlite",
|
|
1422
|
-
"*.db",
|
|
1423
|
-
"*.mdb",
|
|
1424
|
-
"",
|
|
1425
|
-
"# Data files",
|
|
1426
|
-
"*.csv",
|
|
1427
|
-
"*.tsv",
|
|
1428
|
-
"*.xlsx",
|
|
1429
|
-
""
|
|
1430
|
-
);
|
|
1431
|
-
lines.push(
|
|
1432
|
-
"# Performance Optimization",
|
|
1433
|
-
"# Exclude files that are too large for effective AI processing",
|
|
1434
|
-
"**/*.{mp4,avi,mov,mkv}",
|
|
1435
|
-
"**/*.{zip,tar,gz,rar}",
|
|
1436
|
-
"**/*.{pdf,doc,docx}",
|
|
1437
|
-
"**/logs/**/*.log",
|
|
1438
|
-
"",
|
|
1439
|
-
"# But include small configuration files",
|
|
1440
|
-
"!**/config.{json,yaml,yml}",
|
|
1441
|
-
""
|
|
1442
|
-
);
|
|
1443
|
-
const rulePatterns = extractIgnorePatternsFromRules(rules);
|
|
1444
|
-
const augmentPatterns = [];
|
|
1445
|
-
for (const rule of rules) {
|
|
1446
|
-
augmentPatterns.push(...extractAugmentCodeIgnorePatternsFromContent(rule.content));
|
|
1373
|
+
function generateIgnoreContent(rules, config) {
|
|
1374
|
+
const lines = [];
|
|
1375
|
+
lines.push(...config.header);
|
|
1376
|
+
lines.push("");
|
|
1377
|
+
if (config.includeCommonPatterns) {
|
|
1378
|
+
lines.push(...getCommonIgnorePatterns());
|
|
1447
1379
|
}
|
|
1448
|
-
|
|
1380
|
+
if (config.corePatterns.length > 0) {
|
|
1381
|
+
lines.push(...config.corePatterns);
|
|
1382
|
+
lines.push("");
|
|
1383
|
+
}
|
|
1384
|
+
const rulePatterns = extractIgnorePatternsFromRules(rules);
|
|
1385
|
+
const customPatterns = config.customPatternProcessor ? config.customPatternProcessor(rules) : [];
|
|
1386
|
+
const allPatterns = [...rulePatterns, ...customPatterns];
|
|
1449
1387
|
if (allPatterns.length > 0) {
|
|
1450
|
-
|
|
1388
|
+
const headerText = config.projectPatternsHeader || "# \u2500\u2500\u2500\u2500\u2500 Project-specific exclusions from rulesync rules \u2500\u2500\u2500\u2500\u2500";
|
|
1389
|
+
lines.push(headerText);
|
|
1451
1390
|
lines.push(...allPatterns);
|
|
1452
1391
|
lines.push("");
|
|
1453
1392
|
}
|
|
1454
|
-
lines.push(
|
|
1455
|
-
"# Team Collaboration",
|
|
1456
|
-
"# Exclude personal IDE settings",
|
|
1457
|
-
".vscode/settings.json",
|
|
1458
|
-
".idea/workspace.xml",
|
|
1459
|
-
"",
|
|
1460
|
-
"# But include shared team settings",
|
|
1461
|
-
"!.vscode/extensions.json",
|
|
1462
|
-
"!.idea/codeStyles/",
|
|
1463
|
-
"",
|
|
1464
|
-
"# Exclude test fixtures with sensitive data",
|
|
1465
|
-
"tests/fixtures/real-data/**",
|
|
1466
|
-
"",
|
|
1467
|
-
"# Re-include important documentation",
|
|
1468
|
-
"!vendor/*/README.md",
|
|
1469
|
-
"!third-party/*/LICENSE",
|
|
1470
|
-
""
|
|
1471
|
-
);
|
|
1472
1393
|
return lines.join("\n");
|
|
1473
1394
|
}
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
var import_node_path4 = require("path");
|
|
1477
|
-
async function generateJunieIgnoreFiles(rules, config, baseDir) {
|
|
1478
|
-
const outputs = [];
|
|
1479
|
-
const aiignoreContent = generateAiignoreContent(rules);
|
|
1480
|
-
const outputPath = baseDir || process.cwd();
|
|
1481
|
-
const filepath = (0, import_node_path4.join)(outputPath, ".aiignore");
|
|
1482
|
-
outputs.push({
|
|
1483
|
-
tool: "junie",
|
|
1484
|
-
filepath,
|
|
1485
|
-
content: aiignoreContent
|
|
1486
|
-
});
|
|
1487
|
-
return outputs;
|
|
1488
|
-
}
|
|
1489
|
-
function generateAiignoreContent(rules) {
|
|
1490
|
-
const lines = [
|
|
1491
|
-
"# Generated by rulesync - JetBrains Junie AI ignore file",
|
|
1492
|
-
"# This file controls which files the AI can access automatically",
|
|
1493
|
-
"# AI must ask before reading or editing matched files/directories",
|
|
1494
|
-
"",
|
|
1395
|
+
function getCommonIgnorePatterns() {
|
|
1396
|
+
return [
|
|
1495
1397
|
"# \u2500\u2500\u2500\u2500\u2500 Source Control Metadata \u2500\u2500\u2500\u2500\u2500",
|
|
1496
1398
|
".git/",
|
|
1497
1399
|
".svn/",
|
|
@@ -1603,93 +1505,206 @@ function generateAiignoreContent(rules) {
|
|
|
1603
1505
|
"target/",
|
|
1604
1506
|
""
|
|
1605
1507
|
];
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1508
|
+
}
|
|
1509
|
+
var ignoreConfigs = {
|
|
1510
|
+
junie: {
|
|
1511
|
+
tool: "junie",
|
|
1512
|
+
filename: ".aiignore",
|
|
1513
|
+
header: [
|
|
1514
|
+
"# Generated by rulesync - JetBrains Junie AI ignore file",
|
|
1515
|
+
"# This file controls which files the AI can access automatically",
|
|
1516
|
+
"# AI must ask before reading or editing matched files/directories"
|
|
1517
|
+
],
|
|
1518
|
+
corePatterns: [
|
|
1519
|
+
"# \u2500\u2500\u2500\u2500\u2500 Allow specific source files (uncomment as needed) \u2500\u2500\u2500\u2500\u2500",
|
|
1520
|
+
"# !src/**/*.ts",
|
|
1521
|
+
"# !src/**/*.js",
|
|
1522
|
+
"# !lib/**/*.py",
|
|
1523
|
+
"# !src/main/**/*.java"
|
|
1524
|
+
],
|
|
1525
|
+
includeCommonPatterns: true
|
|
1526
|
+
},
|
|
1527
|
+
kiro: {
|
|
1528
|
+
tool: "kiro",
|
|
1529
|
+
filename: ".aiignore",
|
|
1530
|
+
header: [
|
|
1531
|
+
"# Generated by rulesync - Kiro AI-specific exclusions",
|
|
1532
|
+
"# This file excludes files that can be in Git but shouldn't be read by the AI"
|
|
1533
|
+
],
|
|
1534
|
+
corePatterns: [
|
|
1535
|
+
"# Data files AI shouldn't process",
|
|
1536
|
+
"*.csv",
|
|
1537
|
+
"*.tsv",
|
|
1538
|
+
"*.sqlite",
|
|
1539
|
+
"*.db",
|
|
1540
|
+
"",
|
|
1541
|
+
"# Large binary files",
|
|
1542
|
+
"*.zip",
|
|
1543
|
+
"*.tar.gz",
|
|
1544
|
+
"*.rar",
|
|
1545
|
+
"",
|
|
1546
|
+
"# Sensitive documentation",
|
|
1547
|
+
"internal-docs/",
|
|
1548
|
+
"confidential/",
|
|
1549
|
+
"",
|
|
1550
|
+
"# Test data that might confuse AI",
|
|
1551
|
+
"test/fixtures/large-*.json",
|
|
1552
|
+
"benchmark-results/",
|
|
1553
|
+
"",
|
|
1554
|
+
"# Reinforce critical exclusions from .gitignore",
|
|
1555
|
+
"*.pem",
|
|
1556
|
+
"*.key",
|
|
1557
|
+
".env*"
|
|
1558
|
+
],
|
|
1559
|
+
includeCommonPatterns: false,
|
|
1560
|
+
projectPatternsHeader: "# Project-specific exclusions from rulesync rules"
|
|
1561
|
+
},
|
|
1562
|
+
augmentcode: {
|
|
1563
|
+
tool: "augmentcode",
|
|
1564
|
+
filename: ".augmentignore",
|
|
1565
|
+
header: [
|
|
1566
|
+
"# Generated by rulesync - AugmentCode ignore patterns",
|
|
1567
|
+
"# AugmentCode uses a two-tier approach: .gitignore first, then .augmentignore",
|
|
1568
|
+
"# This file provides Augment-specific exclusions and re-inclusions"
|
|
1569
|
+
],
|
|
1570
|
+
corePatterns: [
|
|
1571
|
+
"# Security and Secrets (critical exclusions)",
|
|
1572
|
+
"# Environment files",
|
|
1573
|
+
".env*",
|
|
1574
|
+
"",
|
|
1575
|
+
"# Private keys and certificates",
|
|
1576
|
+
"*.pem",
|
|
1577
|
+
"*.key",
|
|
1578
|
+
"*.p12",
|
|
1579
|
+
"*.crt",
|
|
1580
|
+
"*.der",
|
|
1581
|
+
"",
|
|
1582
|
+
"# SSH keys",
|
|
1583
|
+
"id_rsa*",
|
|
1584
|
+
"id_dsa*",
|
|
1585
|
+
"",
|
|
1586
|
+
"# AWS credentials",
|
|
1587
|
+
".aws/",
|
|
1588
|
+
"aws-exports.js",
|
|
1589
|
+
"",
|
|
1590
|
+
"# API keys and tokens",
|
|
1591
|
+
"**/apikeys/",
|
|
1592
|
+
"**/*_token*",
|
|
1593
|
+
"**/*_secret*",
|
|
1594
|
+
"",
|
|
1595
|
+
"# Build Artifacts and Dependencies",
|
|
1596
|
+
"# Build outputs",
|
|
1597
|
+
"dist/",
|
|
1598
|
+
"build/",
|
|
1599
|
+
"out/",
|
|
1600
|
+
"target/",
|
|
1601
|
+
"",
|
|
1602
|
+
"# Dependencies",
|
|
1603
|
+
"node_modules/",
|
|
1604
|
+
"venv/",
|
|
1605
|
+
"*.egg-info/",
|
|
1606
|
+
"",
|
|
1607
|
+
"# Logs",
|
|
1608
|
+
"*.log",
|
|
1609
|
+
"logs/",
|
|
1610
|
+
"",
|
|
1611
|
+
"# Temporary files",
|
|
1612
|
+
"*.tmp",
|
|
1613
|
+
"*.swp",
|
|
1614
|
+
"*.swo",
|
|
1615
|
+
"*~",
|
|
1616
|
+
"",
|
|
1617
|
+
"# Large Files and Media",
|
|
1618
|
+
"# Binary files",
|
|
1619
|
+
"*.jar",
|
|
1620
|
+
"*.png",
|
|
1621
|
+
"*.jpg",
|
|
1622
|
+
"*.jpeg",
|
|
1623
|
+
"*.gif",
|
|
1624
|
+
"*.mp4",
|
|
1625
|
+
"*.avi",
|
|
1626
|
+
"*.zip",
|
|
1627
|
+
"*.tar.gz",
|
|
1628
|
+
"*.rar",
|
|
1629
|
+
"",
|
|
1630
|
+
"# Database files",
|
|
1631
|
+
"*.sqlite",
|
|
1632
|
+
"*.db",
|
|
1633
|
+
"*.mdb",
|
|
1634
|
+
"",
|
|
1635
|
+
"# Data files",
|
|
1636
|
+
"*.csv",
|
|
1637
|
+
"*.tsv",
|
|
1638
|
+
"*.xlsx",
|
|
1639
|
+
"",
|
|
1640
|
+
"# Performance Optimization",
|
|
1641
|
+
"# Exclude files that are too large for effective AI processing",
|
|
1642
|
+
"**/*.{mp4,avi,mov,mkv}",
|
|
1643
|
+
"**/*.{zip,tar,gz,rar}",
|
|
1644
|
+
"**/*.{pdf,doc,docx}",
|
|
1645
|
+
"**/logs/**/*.log",
|
|
1646
|
+
"",
|
|
1647
|
+
"# But include small configuration files",
|
|
1648
|
+
"!**/config.{json,yaml,yml}",
|
|
1649
|
+
"",
|
|
1650
|
+
"# Team Collaboration",
|
|
1651
|
+
"# Exclude personal IDE settings",
|
|
1652
|
+
".vscode/settings.json",
|
|
1653
|
+
".idea/workspace.xml",
|
|
1654
|
+
"",
|
|
1655
|
+
"# But include shared team settings",
|
|
1656
|
+
"!.vscode/extensions.json",
|
|
1657
|
+
"!.idea/codeStyles/",
|
|
1658
|
+
"",
|
|
1659
|
+
"# Exclude test fixtures with sensitive data",
|
|
1660
|
+
"tests/fixtures/real-data/**",
|
|
1661
|
+
"",
|
|
1662
|
+
"# Re-include important documentation",
|
|
1663
|
+
"!vendor/*/README.md",
|
|
1664
|
+
"!third-party/*/LICENSE"
|
|
1665
|
+
],
|
|
1666
|
+
includeCommonPatterns: false,
|
|
1667
|
+
projectPatternsHeader: "# Project-specific patterns from rulesync rules",
|
|
1668
|
+
customPatternProcessor: (rules) => {
|
|
1669
|
+
const augmentPatterns = [];
|
|
1670
|
+
for (const rule of rules) {
|
|
1671
|
+
augmentPatterns.push(...extractAugmentCodeIgnorePatternsFromContent(rule.content));
|
|
1672
|
+
}
|
|
1673
|
+
return augmentPatterns;
|
|
1674
|
+
}
|
|
1611
1675
|
}
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1676
|
+
};
|
|
1677
|
+
|
|
1678
|
+
// src/generators/ignore/augmentcode.ts
|
|
1679
|
+
async function generateAugmentCodeIgnoreFiles(rules, config, baseDir) {
|
|
1680
|
+
return generateIgnoreFile(rules, config, ignoreConfigs.augmentcode, baseDir);
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
// src/generators/ignore/junie.ts
|
|
1684
|
+
async function generateJunieIgnoreFiles(rules, config, baseDir) {
|
|
1685
|
+
return generateIgnoreFile(rules, config, ignoreConfigs.junie, baseDir);
|
|
1621
1686
|
}
|
|
1622
1687
|
|
|
1623
1688
|
// src/generators/ignore/kiro.ts
|
|
1624
|
-
var import_node_path5 = require("path");
|
|
1625
1689
|
async function generateKiroIgnoreFiles(rules, config, baseDir) {
|
|
1626
|
-
|
|
1627
|
-
const aiignoreContent = generateAiignoreContent2(rules);
|
|
1628
|
-
const outputPath = baseDir || process.cwd();
|
|
1629
|
-
const filepath = (0, import_node_path5.join)(outputPath, ".aiignore");
|
|
1630
|
-
outputs.push({
|
|
1631
|
-
tool: "kiro",
|
|
1632
|
-
filepath,
|
|
1633
|
-
content: aiignoreContent
|
|
1634
|
-
});
|
|
1635
|
-
return outputs;
|
|
1636
|
-
}
|
|
1637
|
-
function generateAiignoreContent2(rules) {
|
|
1638
|
-
const lines = [
|
|
1639
|
-
"# Generated by rulesync - Kiro AI-specific exclusions",
|
|
1640
|
-
"# This file excludes files that can be in Git but shouldn't be read by the AI",
|
|
1641
|
-
""
|
|
1642
|
-
];
|
|
1643
|
-
lines.push(
|
|
1644
|
-
"# Data files AI shouldn't process",
|
|
1645
|
-
"*.csv",
|
|
1646
|
-
"*.tsv",
|
|
1647
|
-
"*.sqlite",
|
|
1648
|
-
"*.db",
|
|
1649
|
-
"",
|
|
1650
|
-
"# Large binary files",
|
|
1651
|
-
"*.zip",
|
|
1652
|
-
"*.tar.gz",
|
|
1653
|
-
"*.rar",
|
|
1654
|
-
"",
|
|
1655
|
-
"# Sensitive documentation",
|
|
1656
|
-
"internal-docs/",
|
|
1657
|
-
"confidential/",
|
|
1658
|
-
"",
|
|
1659
|
-
"# Test data that might confuse AI",
|
|
1660
|
-
"test/fixtures/large-*.json",
|
|
1661
|
-
"benchmark-results/",
|
|
1662
|
-
"",
|
|
1663
|
-
"# Reinforce critical exclusions from .gitignore",
|
|
1664
|
-
"*.pem",
|
|
1665
|
-
"*.key",
|
|
1666
|
-
".env*",
|
|
1667
|
-
""
|
|
1668
|
-
);
|
|
1669
|
-
const rulePatterns = extractIgnorePatternsFromRules(rules);
|
|
1670
|
-
if (rulePatterns.length > 0) {
|
|
1671
|
-
lines.push("# Project-specific exclusions from rulesync rules");
|
|
1672
|
-
lines.push(...rulePatterns);
|
|
1673
|
-
lines.push("");
|
|
1674
|
-
}
|
|
1675
|
-
return lines.join("\n");
|
|
1690
|
+
return generateIgnoreFile(rules, config, ignoreConfigs.kiro, baseDir);
|
|
1676
1691
|
}
|
|
1677
1692
|
|
|
1678
1693
|
// src/generators/rules/augmentcode.ts
|
|
1679
|
-
var
|
|
1694
|
+
var import_node_path6 = require("path");
|
|
1680
1695
|
|
|
1681
1696
|
// src/generators/rules/shared-helpers.ts
|
|
1682
|
-
var
|
|
1697
|
+
var import_node_path5 = require("path");
|
|
1683
1698
|
|
|
1684
1699
|
// src/utils/ignore.ts
|
|
1685
|
-
var
|
|
1700
|
+
var import_node_path4 = require("path");
|
|
1686
1701
|
var import_micromatch = __toESM(require("micromatch"), 1);
|
|
1687
1702
|
var cachedIgnorePatterns = null;
|
|
1688
1703
|
async function loadIgnorePatterns(baseDir = process.cwd()) {
|
|
1689
1704
|
if (cachedIgnorePatterns) {
|
|
1690
1705
|
return cachedIgnorePatterns;
|
|
1691
1706
|
}
|
|
1692
|
-
const ignorePath = (0,
|
|
1707
|
+
const ignorePath = (0, import_node_path4.join)(baseDir, ".rulesyncignore");
|
|
1693
1708
|
if (!await fileExists(ignorePath)) {
|
|
1694
1709
|
cachedIgnorePatterns = { patterns: [] };
|
|
1695
1710
|
return cachedIgnorePatterns;
|
|
@@ -1734,7 +1749,7 @@ function filterIgnoredFiles(files, ignorePatterns) {
|
|
|
1734
1749
|
|
|
1735
1750
|
// src/generators/rules/shared-helpers.ts
|
|
1736
1751
|
function resolveOutputDir(config, tool, baseDir) {
|
|
1737
|
-
return baseDir ? (0,
|
|
1752
|
+
return baseDir ? (0, import_node_path5.join)(baseDir, config.outputPaths[tool]) : config.outputPaths[tool];
|
|
1738
1753
|
}
|
|
1739
1754
|
function createOutputsArray() {
|
|
1740
1755
|
return [];
|
|
@@ -1743,7 +1758,7 @@ function addOutput(outputs, tool, config, baseDir, relativePath, content) {
|
|
|
1743
1758
|
const outputDir = resolveOutputDir(config, tool, baseDir);
|
|
1744
1759
|
outputs.push({
|
|
1745
1760
|
tool,
|
|
1746
|
-
filepath: (0,
|
|
1761
|
+
filepath: (0, import_node_path5.join)(outputDir, relativePath),
|
|
1747
1762
|
content
|
|
1748
1763
|
});
|
|
1749
1764
|
}
|
|
@@ -1752,7 +1767,7 @@ async function generateRulesConfig(rules, config, generatorConfig, baseDir) {
|
|
|
1752
1767
|
for (const rule of rules) {
|
|
1753
1768
|
const content = generatorConfig.generateContent(rule);
|
|
1754
1769
|
const outputDir = resolveOutputDir(config, generatorConfig.tool, baseDir);
|
|
1755
|
-
const filepath = generatorConfig.pathResolver ? generatorConfig.pathResolver(rule, outputDir) : (0,
|
|
1770
|
+
const filepath = generatorConfig.pathResolver ? generatorConfig.pathResolver(rule, outputDir) : (0, import_node_path5.join)(outputDir, `${rule.filename}${generatorConfig.fileExtension}`);
|
|
1756
1771
|
outputs.push({
|
|
1757
1772
|
tool: generatorConfig.tool,
|
|
1758
1773
|
filepath,
|
|
@@ -1761,8 +1776,8 @@ async function generateRulesConfig(rules, config, generatorConfig, baseDir) {
|
|
|
1761
1776
|
}
|
|
1762
1777
|
const ignorePatterns = await loadIgnorePatterns(baseDir);
|
|
1763
1778
|
if (ignorePatterns.patterns.length > 0) {
|
|
1764
|
-
const ignorePath = baseDir ? (0,
|
|
1765
|
-
const ignoreContent =
|
|
1779
|
+
const ignorePath = baseDir ? (0, import_node_path5.join)(baseDir, generatorConfig.ignoreFileName) : generatorConfig.ignoreFileName;
|
|
1780
|
+
const ignoreContent = generateIgnoreFile2(ignorePatterns.patterns, generatorConfig.tool);
|
|
1766
1781
|
outputs.push({
|
|
1767
1782
|
tool: generatorConfig.tool,
|
|
1768
1783
|
filepath: ignorePath,
|
|
@@ -1779,7 +1794,7 @@ async function generateComplexRules(rules, config, generatorConfig, baseDir) {
|
|
|
1779
1794
|
if (generatorConfig.generateDetailContent && generatorConfig.detailSubDir) {
|
|
1780
1795
|
for (const rule of detailRules) {
|
|
1781
1796
|
const content = generatorConfig.generateDetailContent(rule);
|
|
1782
|
-
const filepath = baseDir ? (0,
|
|
1797
|
+
const filepath = baseDir ? (0, import_node_path5.join)(baseDir, generatorConfig.detailSubDir, `${rule.filename}.md`) : (0, import_node_path5.join)(generatorConfig.detailSubDir, `${rule.filename}.md`);
|
|
1783
1798
|
outputs.push({
|
|
1784
1799
|
tool: generatorConfig.tool,
|
|
1785
1800
|
filepath,
|
|
@@ -1789,7 +1804,7 @@ async function generateComplexRules(rules, config, generatorConfig, baseDir) {
|
|
|
1789
1804
|
}
|
|
1790
1805
|
if (generatorConfig.generateRootContent && generatorConfig.rootFilePath) {
|
|
1791
1806
|
const rootContent = generatorConfig.generateRootContent(rootRule, detailRules, baseDir);
|
|
1792
|
-
const rootFilepath = baseDir ? (0,
|
|
1807
|
+
const rootFilepath = baseDir ? (0, import_node_path5.join)(baseDir, generatorConfig.rootFilePath) : generatorConfig.rootFilePath;
|
|
1793
1808
|
outputs.push({
|
|
1794
1809
|
tool: generatorConfig.tool,
|
|
1795
1810
|
filepath: rootFilepath,
|
|
@@ -1798,8 +1813,8 @@ async function generateComplexRules(rules, config, generatorConfig, baseDir) {
|
|
|
1798
1813
|
}
|
|
1799
1814
|
const ignorePatterns = await loadIgnorePatterns(baseDir);
|
|
1800
1815
|
if (ignorePatterns.patterns.length > 0) {
|
|
1801
|
-
const ignorePath = baseDir ? (0,
|
|
1802
|
-
const ignoreContent =
|
|
1816
|
+
const ignorePath = baseDir ? (0, import_node_path5.join)(baseDir, generatorConfig.ignoreFileName) : generatorConfig.ignoreFileName;
|
|
1817
|
+
const ignoreContent = generateIgnoreFile2(ignorePatterns.patterns, generatorConfig.tool);
|
|
1803
1818
|
outputs.push({
|
|
1804
1819
|
tool: generatorConfig.tool,
|
|
1805
1820
|
filepath: ignorePath,
|
|
@@ -1815,7 +1830,7 @@ async function generateComplexRules(rules, config, generatorConfig, baseDir) {
|
|
|
1815
1830
|
}
|
|
1816
1831
|
return outputs;
|
|
1817
1832
|
}
|
|
1818
|
-
function
|
|
1833
|
+
function generateIgnoreFile2(patterns, tool) {
|
|
1819
1834
|
const lines = [
|
|
1820
1835
|
"# Generated by rulesync from .rulesyncignore",
|
|
1821
1836
|
"# This file is automatically generated. Do not edit manually."
|
|
@@ -1848,7 +1863,7 @@ async function generateAugmentcodeConfig(rules, config, baseDir) {
|
|
|
1848
1863
|
"augmentcode",
|
|
1849
1864
|
config,
|
|
1850
1865
|
baseDir,
|
|
1851
|
-
(0,
|
|
1866
|
+
(0, import_node_path6.join)(".augment", "rules", `${rule.filename}.md`),
|
|
1852
1867
|
generateRuleFile(rule)
|
|
1853
1868
|
);
|
|
1854
1869
|
});
|
|
@@ -1901,29 +1916,29 @@ function generateLegacyGuidelinesFile(allRules) {
|
|
|
1901
1916
|
}
|
|
1902
1917
|
|
|
1903
1918
|
// src/generators/rules/claudecode.ts
|
|
1904
|
-
var
|
|
1919
|
+
var import_node_path7 = require("path");
|
|
1905
1920
|
async function generateClaudecodeConfig(rules, config, baseDir) {
|
|
1906
1921
|
const outputs = [];
|
|
1907
1922
|
const rootRules = rules.filter((r) => r.frontmatter.root === true);
|
|
1908
1923
|
const detailRules = rules.filter((r) => r.frontmatter.root === false);
|
|
1909
1924
|
const claudeMdContent = generateClaudeMarkdown(rootRules, detailRules);
|
|
1910
|
-
const claudeOutputDir = baseDir ? (0,
|
|
1925
|
+
const claudeOutputDir = baseDir ? (0, import_node_path7.join)(baseDir, config.outputPaths.claudecode) : config.outputPaths.claudecode;
|
|
1911
1926
|
outputs.push({
|
|
1912
1927
|
tool: "claudecode",
|
|
1913
|
-
filepath: (0,
|
|
1928
|
+
filepath: (0, import_node_path7.join)(claudeOutputDir, "CLAUDE.md"),
|
|
1914
1929
|
content: claudeMdContent
|
|
1915
1930
|
});
|
|
1916
1931
|
for (const rule of detailRules) {
|
|
1917
1932
|
const memoryContent = generateMemoryFile(rule);
|
|
1918
1933
|
outputs.push({
|
|
1919
1934
|
tool: "claudecode",
|
|
1920
|
-
filepath: (0,
|
|
1935
|
+
filepath: (0, import_node_path7.join)(claudeOutputDir, ".claude", "memories", `${rule.filename}.md`),
|
|
1921
1936
|
content: memoryContent
|
|
1922
1937
|
});
|
|
1923
1938
|
}
|
|
1924
1939
|
const ignorePatterns = await loadIgnorePatterns(baseDir);
|
|
1925
1940
|
if (ignorePatterns.patterns.length > 0) {
|
|
1926
|
-
const settingsPath = baseDir ? (0,
|
|
1941
|
+
const settingsPath = baseDir ? (0, import_node_path7.join)(baseDir, ".claude", "settings.json") : (0, import_node_path7.join)(".claude", "settings.json");
|
|
1927
1942
|
await updateClaudeSettings(settingsPath, ignorePatterns.patterns);
|
|
1928
1943
|
}
|
|
1929
1944
|
return outputs;
|
|
@@ -2002,7 +2017,7 @@ async function generateClineConfig(rules, config, baseDir) {
|
|
|
2002
2017
|
}
|
|
2003
2018
|
|
|
2004
2019
|
// src/generators/rules/copilot.ts
|
|
2005
|
-
var
|
|
2020
|
+
var import_node_path8 = require("path");
|
|
2006
2021
|
async function generateCopilotConfig(rules, config, baseDir) {
|
|
2007
2022
|
return generateComplexRulesConfig(
|
|
2008
2023
|
rules,
|
|
@@ -2014,7 +2029,7 @@ async function generateCopilotConfig(rules, config, baseDir) {
|
|
|
2014
2029
|
generateContent: generateCopilotMarkdown,
|
|
2015
2030
|
getOutputPath: (rule, outputDir) => {
|
|
2016
2031
|
const baseFilename = rule.filename.replace(/\.md$/, "");
|
|
2017
|
-
return (0,
|
|
2032
|
+
return (0, import_node_path8.join)(outputDir, `${baseFilename}.instructions.md`);
|
|
2018
2033
|
}
|
|
2019
2034
|
},
|
|
2020
2035
|
baseDir
|
|
@@ -2035,7 +2050,7 @@ function generateCopilotMarkdown(rule) {
|
|
|
2035
2050
|
}
|
|
2036
2051
|
|
|
2037
2052
|
// src/generators/rules/cursor.ts
|
|
2038
|
-
var
|
|
2053
|
+
var import_node_path9 = require("path");
|
|
2039
2054
|
async function generateCursorConfig(rules, config, baseDir) {
|
|
2040
2055
|
return generateComplexRulesConfig(
|
|
2041
2056
|
rules,
|
|
@@ -2046,7 +2061,7 @@ async function generateCursorConfig(rules, config, baseDir) {
|
|
|
2046
2061
|
ignoreFileName: ".cursorignore",
|
|
2047
2062
|
generateContent: generateCursorMarkdown,
|
|
2048
2063
|
getOutputPath: (rule, outputDir) => {
|
|
2049
|
-
return (0,
|
|
2064
|
+
return (0, import_node_path9.join)(outputDir, `${rule.filename}.mdc`);
|
|
2050
2065
|
}
|
|
2051
2066
|
},
|
|
2052
2067
|
baseDir
|
|
@@ -2175,13 +2190,13 @@ function generateGuidelinesMarkdown(rootRule, detailRules) {
|
|
|
2175
2190
|
}
|
|
2176
2191
|
|
|
2177
2192
|
// src/generators/rules/kiro.ts
|
|
2178
|
-
var
|
|
2193
|
+
var import_node_path10 = require("path");
|
|
2179
2194
|
async function generateKiroConfig(rules, config, baseDir) {
|
|
2180
2195
|
const outputs = [];
|
|
2181
2196
|
for (const rule of rules) {
|
|
2182
2197
|
const content = generateKiroMarkdown(rule);
|
|
2183
|
-
const outputDir = baseDir ? (0,
|
|
2184
|
-
const filepath = (0,
|
|
2198
|
+
const outputDir = baseDir ? (0, import_node_path10.join)(baseDir, config.outputPaths.kiro) : config.outputPaths.kiro;
|
|
2199
|
+
const filepath = (0, import_node_path10.join)(outputDir, `${rule.filename}.md`);
|
|
2185
2200
|
outputs.push({
|
|
2186
2201
|
tool: "kiro",
|
|
2187
2202
|
filepath,
|
|
@@ -2286,7 +2301,7 @@ async function generateForTool(tool, rules, config, baseDir) {
|
|
|
2286
2301
|
}
|
|
2287
2302
|
|
|
2288
2303
|
// src/core/parser.ts
|
|
2289
|
-
var
|
|
2304
|
+
var import_node_path11 = require("path");
|
|
2290
2305
|
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
2291
2306
|
async function parseRulesFromDirectory(aiRulesDir) {
|
|
2292
2307
|
const ignorePatterns = await loadIgnorePatterns();
|
|
@@ -2324,7 +2339,7 @@ async function parseRuleFile(filepath) {
|
|
|
2324
2339
|
const parsed = (0, import_gray_matter.default)(content);
|
|
2325
2340
|
try {
|
|
2326
2341
|
const frontmatter = RuleFrontmatterSchema.parse(parsed.data);
|
|
2327
|
-
const filename = (0,
|
|
2342
|
+
const filename = (0, import_node_path11.basename)(filepath, ".md");
|
|
2328
2343
|
return {
|
|
2329
2344
|
frontmatter,
|
|
2330
2345
|
content: parsed.content,
|
|
@@ -2615,12 +2630,12 @@ async function generateCommand(options = {}) {
|
|
|
2615
2630
|
for (const tool of targetTools) {
|
|
2616
2631
|
switch (tool) {
|
|
2617
2632
|
case "augmentcode":
|
|
2618
|
-
deleteTasks.push(removeDirectory((0,
|
|
2619
|
-
deleteTasks.push(removeDirectory((0,
|
|
2633
|
+
deleteTasks.push(removeDirectory((0, import_node_path12.join)(".augment", "rules")));
|
|
2634
|
+
deleteTasks.push(removeDirectory((0, import_node_path12.join)(".augment", "ignore")));
|
|
2620
2635
|
break;
|
|
2621
2636
|
case "augmentcode-legacy":
|
|
2622
2637
|
deleteTasks.push(removeClaudeGeneratedFiles());
|
|
2623
|
-
deleteTasks.push(removeDirectory((0,
|
|
2638
|
+
deleteTasks.push(removeDirectory((0, import_node_path12.join)(".augment", "ignore")));
|
|
2624
2639
|
break;
|
|
2625
2640
|
case "copilot":
|
|
2626
2641
|
deleteTasks.push(removeDirectory(config.outputPaths.copilot));
|
|
@@ -2715,9 +2730,9 @@ Generating configurations for base directory: ${baseDir}`);
|
|
|
2715
2730
|
|
|
2716
2731
|
// src/cli/commands/gitignore.ts
|
|
2717
2732
|
var import_node_fs2 = require("fs");
|
|
2718
|
-
var
|
|
2733
|
+
var import_node_path13 = require("path");
|
|
2719
2734
|
var gitignoreCommand = async () => {
|
|
2720
|
-
const gitignorePath = (0,
|
|
2735
|
+
const gitignorePath = (0, import_node_path13.join)(process.cwd(), ".gitignore");
|
|
2721
2736
|
const rulesFilesToIgnore = [
|
|
2722
2737
|
"# Generated by rulesync - AI tool configuration files",
|
|
2723
2738
|
"**/.github/copilot-instructions.md",
|
|
@@ -2778,11 +2793,11 @@ ${linesToAdd.join("\n")}
|
|
|
2778
2793
|
};
|
|
2779
2794
|
|
|
2780
2795
|
// src/core/importer.ts
|
|
2781
|
-
var
|
|
2796
|
+
var import_node_path19 = require("path");
|
|
2782
2797
|
var import_gray_matter5 = __toESM(require("gray-matter"), 1);
|
|
2783
2798
|
|
|
2784
2799
|
// src/parsers/augmentcode.ts
|
|
2785
|
-
var
|
|
2800
|
+
var import_node_path14 = require("path");
|
|
2786
2801
|
var import_gray_matter2 = __toESM(require("gray-matter"), 1);
|
|
2787
2802
|
|
|
2788
2803
|
// src/utils/parser-helpers.ts
|
|
@@ -2823,7 +2838,7 @@ async function safeReadFile(operation, errorContext) {
|
|
|
2823
2838
|
// src/parsers/augmentcode.ts
|
|
2824
2839
|
async function parseAugmentcodeConfiguration(baseDir = process.cwd()) {
|
|
2825
2840
|
const result = createParseResult();
|
|
2826
|
-
const rulesDir = (0,
|
|
2841
|
+
const rulesDir = (0, import_node_path14.join)(baseDir, ".augment", "rules");
|
|
2827
2842
|
if (await fileExists(rulesDir)) {
|
|
2828
2843
|
const rulesResult = await parseAugmentRules(rulesDir);
|
|
2829
2844
|
addRules(result, rulesResult.rules);
|
|
@@ -2841,7 +2856,7 @@ async function parseAugmentRules(rulesDir) {
|
|
|
2841
2856
|
const files = await readdir2(rulesDir);
|
|
2842
2857
|
for (const file of files) {
|
|
2843
2858
|
if (file.endsWith(".md") || file.endsWith(".mdc")) {
|
|
2844
|
-
const filePath = (0,
|
|
2859
|
+
const filePath = (0, import_node_path14.join)(rulesDir, file);
|
|
2845
2860
|
try {
|
|
2846
2861
|
const rawContent = await readFileContent(filePath);
|
|
2847
2862
|
const parsed = (0, import_gray_matter2.default)(rawContent);
|
|
@@ -2850,7 +2865,7 @@ async function parseAugmentRules(rulesDir) {
|
|
|
2850
2865
|
const description = frontmatterData.description || "";
|
|
2851
2866
|
const tags = Array.isArray(frontmatterData.tags) ? frontmatterData.tags : void 0;
|
|
2852
2867
|
const isRoot = ruleType === "always";
|
|
2853
|
-
const filename = (0,
|
|
2868
|
+
const filename = (0, import_node_path14.basename)(file, file.endsWith(".mdc") ? ".mdc" : ".md");
|
|
2854
2869
|
const frontmatter = {
|
|
2855
2870
|
root: isRoot,
|
|
2856
2871
|
targets: ["augmentcode"],
|
|
@@ -2879,10 +2894,10 @@ async function parseAugmentRules(rulesDir) {
|
|
|
2879
2894
|
}
|
|
2880
2895
|
|
|
2881
2896
|
// src/parsers/augmentcode-legacy.ts
|
|
2882
|
-
var
|
|
2897
|
+
var import_node_path15 = require("path");
|
|
2883
2898
|
async function parseAugmentcodeLegacyConfiguration(baseDir = process.cwd()) {
|
|
2884
2899
|
const result = createParseResult();
|
|
2885
|
-
const guidelinesPath = (0,
|
|
2900
|
+
const guidelinesPath = (0, import_node_path15.join)(baseDir, ".augment-guidelines");
|
|
2886
2901
|
if (await fileExists(guidelinesPath)) {
|
|
2887
2902
|
const guidelinesResult = await parseAugmentGuidelines(guidelinesPath);
|
|
2888
2903
|
if (guidelinesResult.rule) {
|
|
@@ -2925,13 +2940,13 @@ async function parseAugmentGuidelines(guidelinesPath) {
|
|
|
2925
2940
|
}
|
|
2926
2941
|
|
|
2927
2942
|
// src/parsers/shared-helpers.ts
|
|
2928
|
-
var
|
|
2943
|
+
var import_node_path16 = require("path");
|
|
2929
2944
|
var import_gray_matter3 = __toESM(require("gray-matter"), 1);
|
|
2930
2945
|
async function parseConfigurationFiles(baseDir = process.cwd(), config) {
|
|
2931
2946
|
const errors = [];
|
|
2932
2947
|
const rules = [];
|
|
2933
2948
|
if (config.mainFile) {
|
|
2934
|
-
const mainFilePath = (0,
|
|
2949
|
+
const mainFilePath = (0, import_node_path16.join)(baseDir, config.mainFile.path);
|
|
2935
2950
|
if (await fileExists(mainFilePath)) {
|
|
2936
2951
|
try {
|
|
2937
2952
|
const rawContent = await readFileContent(mainFilePath);
|
|
@@ -2959,7 +2974,7 @@ async function parseConfigurationFiles(baseDir = process.cwd(), config) {
|
|
|
2959
2974
|
rules.push({
|
|
2960
2975
|
frontmatter,
|
|
2961
2976
|
content,
|
|
2962
|
-
filename:
|
|
2977
|
+
filename: "instructions",
|
|
2963
2978
|
filepath: mainFilePath
|
|
2964
2979
|
});
|
|
2965
2980
|
}
|
|
@@ -2971,14 +2986,14 @@ async function parseConfigurationFiles(baseDir = process.cwd(), config) {
|
|
|
2971
2986
|
}
|
|
2972
2987
|
if (config.directories) {
|
|
2973
2988
|
for (const dirConfig of config.directories) {
|
|
2974
|
-
const dirPath = (0,
|
|
2989
|
+
const dirPath = (0, import_node_path16.join)(baseDir, dirConfig.directory);
|
|
2975
2990
|
if (await fileExists(dirPath)) {
|
|
2976
2991
|
try {
|
|
2977
2992
|
const { readdir: readdir2 } = await import("fs/promises");
|
|
2978
2993
|
const files = await readdir2(dirPath);
|
|
2979
2994
|
for (const file of files) {
|
|
2980
2995
|
if (file.endsWith(dirConfig.filePattern)) {
|
|
2981
|
-
const filePath = (0,
|
|
2996
|
+
const filePath = (0, import_node_path16.join)(dirPath, file);
|
|
2982
2997
|
try {
|
|
2983
2998
|
const rawContent = await readFileContent(filePath);
|
|
2984
2999
|
let content;
|
|
@@ -2999,7 +3014,7 @@ async function parseConfigurationFiles(baseDir = process.cwd(), config) {
|
|
|
2999
3014
|
rules.push({
|
|
3000
3015
|
frontmatter,
|
|
3001
3016
|
content,
|
|
3002
|
-
filename
|
|
3017
|
+
filename,
|
|
3003
3018
|
filepath: filePath
|
|
3004
3019
|
});
|
|
3005
3020
|
}
|
|
@@ -3026,7 +3041,7 @@ async function parseMemoryBasedConfiguration(baseDir = process.cwd(), config) {
|
|
|
3026
3041
|
const rules = [];
|
|
3027
3042
|
let ignorePatterns;
|
|
3028
3043
|
let mcpServers;
|
|
3029
|
-
const mainFilePath = (0,
|
|
3044
|
+
const mainFilePath = (0, import_node_path16.join)(baseDir, config.mainFileName);
|
|
3030
3045
|
if (!await fileExists(mainFilePath)) {
|
|
3031
3046
|
errors.push(`${config.mainFileName} file not found`);
|
|
3032
3047
|
return { rules, errors };
|
|
@@ -3037,12 +3052,12 @@ async function parseMemoryBasedConfiguration(baseDir = process.cwd(), config) {
|
|
|
3037
3052
|
if (mainRule) {
|
|
3038
3053
|
rules.push(mainRule);
|
|
3039
3054
|
}
|
|
3040
|
-
const memoryDir = (0,
|
|
3055
|
+
const memoryDir = (0, import_node_path16.join)(baseDir, config.memoryDirPath);
|
|
3041
3056
|
if (await fileExists(memoryDir)) {
|
|
3042
3057
|
const memoryRules = await parseMemoryFiles(memoryDir, config);
|
|
3043
3058
|
rules.push(...memoryRules);
|
|
3044
3059
|
}
|
|
3045
|
-
const settingsPath = (0,
|
|
3060
|
+
const settingsPath = (0, import_node_path16.join)(baseDir, config.settingsPath);
|
|
3046
3061
|
if (await fileExists(settingsPath)) {
|
|
3047
3062
|
const settingsResult = await parseSettingsFile(settingsPath, config.tool);
|
|
3048
3063
|
if (settingsResult.ignorePatterns) {
|
|
@@ -3054,7 +3069,7 @@ async function parseMemoryBasedConfiguration(baseDir = process.cwd(), config) {
|
|
|
3054
3069
|
errors.push(...settingsResult.errors);
|
|
3055
3070
|
}
|
|
3056
3071
|
if (config.additionalIgnoreFile) {
|
|
3057
|
-
const additionalIgnorePath = (0,
|
|
3072
|
+
const additionalIgnorePath = (0, import_node_path16.join)(baseDir, config.additionalIgnoreFile.path);
|
|
3058
3073
|
if (await fileExists(additionalIgnorePath)) {
|
|
3059
3074
|
const additionalPatterns = await config.additionalIgnoreFile.parser(additionalIgnorePath);
|
|
3060
3075
|
if (additionalPatterns.length > 0) {
|
|
@@ -3097,7 +3112,7 @@ function parseMainFile(content, filepath, config) {
|
|
|
3097
3112
|
return {
|
|
3098
3113
|
frontmatter,
|
|
3099
3114
|
content: mainContent,
|
|
3100
|
-
filename:
|
|
3115
|
+
filename: "main",
|
|
3101
3116
|
filepath
|
|
3102
3117
|
};
|
|
3103
3118
|
}
|
|
@@ -3108,10 +3123,10 @@ async function parseMemoryFiles(memoryDir, config) {
|
|
|
3108
3123
|
const files = await readdir2(memoryDir);
|
|
3109
3124
|
for (const file of files) {
|
|
3110
3125
|
if (file.endsWith(".md")) {
|
|
3111
|
-
const filePath = (0,
|
|
3126
|
+
const filePath = (0, import_node_path16.join)(memoryDir, file);
|
|
3112
3127
|
const content = await readFileContent(filePath);
|
|
3113
3128
|
if (content.trim()) {
|
|
3114
|
-
const filename = (0,
|
|
3129
|
+
const filename = (0, import_node_path16.basename)(file, ".md");
|
|
3115
3130
|
const frontmatter = {
|
|
3116
3131
|
root: false,
|
|
3117
3132
|
targets: [config.tool],
|
|
@@ -3121,7 +3136,7 @@ async function parseMemoryFiles(memoryDir, config) {
|
|
|
3121
3136
|
rules.push({
|
|
3122
3137
|
frontmatter,
|
|
3123
3138
|
content: content.trim(),
|
|
3124
|
-
filename
|
|
3139
|
+
filename,
|
|
3125
3140
|
filepath: filePath
|
|
3126
3141
|
});
|
|
3127
3142
|
}
|
|
@@ -3224,7 +3239,7 @@ async function parseCopilotConfiguration(baseDir = process.cwd()) {
|
|
|
3224
3239
|
}
|
|
3225
3240
|
|
|
3226
3241
|
// src/parsers/cursor.ts
|
|
3227
|
-
var
|
|
3242
|
+
var import_node_path17 = require("path");
|
|
3228
3243
|
var import_gray_matter4 = __toESM(require("gray-matter"), 1);
|
|
3229
3244
|
var import_js_yaml = require("js-yaml");
|
|
3230
3245
|
var import_mini7 = require("zod/mini");
|
|
@@ -3349,7 +3364,7 @@ async function parseCursorConfiguration(baseDir = process.cwd()) {
|
|
|
3349
3364
|
const rules = [];
|
|
3350
3365
|
let ignorePatterns;
|
|
3351
3366
|
let mcpServers;
|
|
3352
|
-
const cursorFilePath = (0,
|
|
3367
|
+
const cursorFilePath = (0, import_node_path17.join)(baseDir, ".cursorrules");
|
|
3353
3368
|
if (await fileExists(cursorFilePath)) {
|
|
3354
3369
|
try {
|
|
3355
3370
|
const rawContent = await readFileContent(cursorFilePath);
|
|
@@ -3370,20 +3385,20 @@ async function parseCursorConfiguration(baseDir = process.cwd()) {
|
|
|
3370
3385
|
errors.push(`Failed to parse .cursorrules file: ${errorMessage}`);
|
|
3371
3386
|
}
|
|
3372
3387
|
}
|
|
3373
|
-
const cursorRulesDir = (0,
|
|
3388
|
+
const cursorRulesDir = (0, import_node_path17.join)(baseDir, ".cursor", "rules");
|
|
3374
3389
|
if (await fileExists(cursorRulesDir)) {
|
|
3375
3390
|
try {
|
|
3376
3391
|
const { readdir: readdir2 } = await import("fs/promises");
|
|
3377
3392
|
const files = await readdir2(cursorRulesDir);
|
|
3378
3393
|
for (const file of files) {
|
|
3379
3394
|
if (file.endsWith(".mdc")) {
|
|
3380
|
-
const filePath = (0,
|
|
3395
|
+
const filePath = (0, import_node_path17.join)(cursorRulesDir, file);
|
|
3381
3396
|
try {
|
|
3382
3397
|
const rawContent = await readFileContent(filePath);
|
|
3383
3398
|
const parsed = (0, import_gray_matter4.default)(rawContent, customMatterOptions);
|
|
3384
3399
|
const content = parsed.content.trim();
|
|
3385
3400
|
if (content) {
|
|
3386
|
-
const filename = (0,
|
|
3401
|
+
const filename = (0, import_node_path17.basename)(file, ".mdc");
|
|
3387
3402
|
const frontmatter = convertCursorMdcFrontmatter(parsed.data, filename);
|
|
3388
3403
|
rules.push({
|
|
3389
3404
|
frontmatter,
|
|
@@ -3406,7 +3421,7 @@ async function parseCursorConfiguration(baseDir = process.cwd()) {
|
|
|
3406
3421
|
if (rules.length === 0) {
|
|
3407
3422
|
errors.push("No Cursor configuration files found (.cursorrules or .cursor/rules/*.mdc)");
|
|
3408
3423
|
}
|
|
3409
|
-
const cursorIgnorePath = (0,
|
|
3424
|
+
const cursorIgnorePath = (0, import_node_path17.join)(baseDir, ".cursorignore");
|
|
3410
3425
|
if (await fileExists(cursorIgnorePath)) {
|
|
3411
3426
|
try {
|
|
3412
3427
|
const content = await readFileContent(cursorIgnorePath);
|
|
@@ -3419,7 +3434,7 @@ async function parseCursorConfiguration(baseDir = process.cwd()) {
|
|
|
3419
3434
|
errors.push(`Failed to parse .cursorignore: ${errorMessage}`);
|
|
3420
3435
|
}
|
|
3421
3436
|
}
|
|
3422
|
-
const cursorMcpPath = (0,
|
|
3437
|
+
const cursorMcpPath = (0, import_node_path17.join)(baseDir, ".cursor", "mcp.json");
|
|
3423
3438
|
if (await fileExists(cursorMcpPath)) {
|
|
3424
3439
|
try {
|
|
3425
3440
|
const content = await readFileContent(cursorMcpPath);
|
|
@@ -3468,11 +3483,11 @@ async function parseGeminiConfiguration(baseDir = process.cwd()) {
|
|
|
3468
3483
|
}
|
|
3469
3484
|
|
|
3470
3485
|
// src/parsers/junie.ts
|
|
3471
|
-
var
|
|
3486
|
+
var import_node_path18 = require("path");
|
|
3472
3487
|
async function parseJunieConfiguration(baseDir = process.cwd()) {
|
|
3473
3488
|
const errors = [];
|
|
3474
3489
|
const rules = [];
|
|
3475
|
-
const guidelinesPath = (0,
|
|
3490
|
+
const guidelinesPath = (0, import_node_path18.join)(baseDir, ".junie", "guidelines.md");
|
|
3476
3491
|
if (!await fileExists(guidelinesPath)) {
|
|
3477
3492
|
errors.push(".junie/guidelines.md file not found");
|
|
3478
3493
|
return { rules, errors };
|
|
@@ -3607,7 +3622,7 @@ async function importConfiguration(options) {
|
|
|
3607
3622
|
if (rules.length === 0 && !ignorePatterns && !mcpServers) {
|
|
3608
3623
|
return { success: false, rulesCreated: 0, errors };
|
|
3609
3624
|
}
|
|
3610
|
-
const rulesDirPath = (0,
|
|
3625
|
+
const rulesDirPath = (0, import_node_path19.join)(baseDir, rulesDir);
|
|
3611
3626
|
try {
|
|
3612
3627
|
const { mkdir: mkdir3 } = await import("fs/promises");
|
|
3613
3628
|
await mkdir3(rulesDirPath, { recursive: true });
|
|
@@ -3619,9 +3634,9 @@ async function importConfiguration(options) {
|
|
|
3619
3634
|
let rulesCreated = 0;
|
|
3620
3635
|
for (const rule of rules) {
|
|
3621
3636
|
try {
|
|
3622
|
-
const baseFilename =
|
|
3637
|
+
const baseFilename = rule.filename;
|
|
3623
3638
|
const filename = await generateUniqueFilename(rulesDirPath, baseFilename);
|
|
3624
|
-
const filePath = (0,
|
|
3639
|
+
const filePath = (0, import_node_path19.join)(rulesDirPath, `${filename}.md`);
|
|
3625
3640
|
const content = generateRuleFileContent(rule);
|
|
3626
3641
|
await writeFileContent(filePath, content);
|
|
3627
3642
|
rulesCreated++;
|
|
@@ -3636,7 +3651,7 @@ async function importConfiguration(options) {
|
|
|
3636
3651
|
let ignoreFileCreated = false;
|
|
3637
3652
|
if (ignorePatterns && ignorePatterns.length > 0) {
|
|
3638
3653
|
try {
|
|
3639
|
-
const rulesyncignorePath = (0,
|
|
3654
|
+
const rulesyncignorePath = (0, import_node_path19.join)(baseDir, ".rulesyncignore");
|
|
3640
3655
|
const ignoreContent = `${ignorePatterns.join("\n")}
|
|
3641
3656
|
`;
|
|
3642
3657
|
await writeFileContent(rulesyncignorePath, ignoreContent);
|
|
@@ -3652,7 +3667,7 @@ async function importConfiguration(options) {
|
|
|
3652
3667
|
let mcpFileCreated = false;
|
|
3653
3668
|
if (mcpServers && Object.keys(mcpServers).length > 0) {
|
|
3654
3669
|
try {
|
|
3655
|
-
const mcpPath = (0,
|
|
3670
|
+
const mcpPath = (0, import_node_path19.join)(baseDir, rulesDir, ".mcp.json");
|
|
3656
3671
|
const mcpContent = `${JSON.stringify({ mcpServers }, null, 2)}
|
|
3657
3672
|
`;
|
|
3658
3673
|
await writeFileContent(mcpPath, mcpContent);
|
|
@@ -3680,7 +3695,7 @@ function generateRuleFileContent(rule) {
|
|
|
3680
3695
|
async function generateUniqueFilename(rulesDir, baseFilename) {
|
|
3681
3696
|
let filename = baseFilename;
|
|
3682
3697
|
let counter = 1;
|
|
3683
|
-
while (await fileExists((0,
|
|
3698
|
+
while (await fileExists((0, import_node_path19.join)(rulesDir, `${filename}.md`))) {
|
|
3684
3699
|
filename = `${baseFilename}-${counter}`;
|
|
3685
3700
|
counter++;
|
|
3686
3701
|
}
|
|
@@ -3747,7 +3762,7 @@ async function importCommand(options = {}) {
|
|
|
3747
3762
|
}
|
|
3748
3763
|
|
|
3749
3764
|
// src/cli/commands/init.ts
|
|
3750
|
-
var
|
|
3765
|
+
var import_node_path20 = require("path");
|
|
3751
3766
|
async function initCommand() {
|
|
3752
3767
|
const aiRulesDir = ".rulesync";
|
|
3753
3768
|
console.log("Initializing rulesync...");
|
|
@@ -3794,7 +3809,7 @@ globs: ["**/*"]
|
|
|
3794
3809
|
- Follow single responsibility principle
|
|
3795
3810
|
`
|
|
3796
3811
|
};
|
|
3797
|
-
const filepath = (0,
|
|
3812
|
+
const filepath = (0, import_node_path20.join)(aiRulesDir, sampleFile.filename);
|
|
3798
3813
|
if (!await fileExists(filepath)) {
|
|
3799
3814
|
await writeFileContent(filepath, sampleFile.content);
|
|
3800
3815
|
console.log(`Created ${filepath}`);
|
|
@@ -3938,7 +3953,7 @@ async function watchCommand() {
|
|
|
3938
3953
|
|
|
3939
3954
|
// src/cli/index.ts
|
|
3940
3955
|
var program = new import_commander.Command();
|
|
3941
|
-
program.name("rulesync").description("Unified AI rules management CLI tool").version("0.
|
|
3956
|
+
program.name("rulesync").description("Unified AI rules management CLI tool").version("0.53.0");
|
|
3942
3957
|
program.command("init").description("Initialize rulesync in current directory").action(initCommand);
|
|
3943
3958
|
program.command("add <filename>").description("Add a new rule file").action(addCommand);
|
|
3944
3959
|
program.command("gitignore").description("Add generated files to .gitignore").action(gitignoreCommand);
|