rulesync 4.0.0 → 4.1.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/README.md +4 -11
- package/dist/index.cjs +1819 -524
- package/dist/index.js +1804 -509
- package/package.json +8 -6
package/dist/index.cjs
CHANGED
|
@@ -672,6 +672,17 @@ var ToolCommand = class extends AiFile {
|
|
|
672
672
|
static async fromFile(_params) {
|
|
673
673
|
throw new Error("Please implement this method in the subclass.");
|
|
674
674
|
}
|
|
675
|
+
/**
|
|
676
|
+
* Create a minimal instance for deletion purposes.
|
|
677
|
+
* This method does not read or parse file content, making it safe to use
|
|
678
|
+
* even when files have old/incompatible formats.
|
|
679
|
+
*
|
|
680
|
+
* @param params - Parameters including the file path
|
|
681
|
+
* @returns A concrete ToolCommand instance with minimal data for deletion
|
|
682
|
+
*/
|
|
683
|
+
static forDeletion(_params) {
|
|
684
|
+
throw new Error("Please implement this method in the subclass.");
|
|
685
|
+
}
|
|
675
686
|
/**
|
|
676
687
|
* Convert a RulesyncCommand to the tool-specific command format.
|
|
677
688
|
*
|
|
@@ -814,6 +825,20 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
814
825
|
validate
|
|
815
826
|
};
|
|
816
827
|
}
|
|
828
|
+
static forDeletionDefault({
|
|
829
|
+
baseDir = process.cwd(),
|
|
830
|
+
relativeDirPath,
|
|
831
|
+
relativeFilePath
|
|
832
|
+
}) {
|
|
833
|
+
return {
|
|
834
|
+
baseDir,
|
|
835
|
+
relativeDirPath,
|
|
836
|
+
relativeFilePath,
|
|
837
|
+
frontmatter: { description: "" },
|
|
838
|
+
body: "",
|
|
839
|
+
validate: false
|
|
840
|
+
};
|
|
841
|
+
}
|
|
817
842
|
};
|
|
818
843
|
|
|
819
844
|
// src/features/commands/agentsmd-command.ts
|
|
@@ -863,6 +888,15 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
863
888
|
toolTarget: "agentsmd"
|
|
864
889
|
});
|
|
865
890
|
}
|
|
891
|
+
static forDeletion({
|
|
892
|
+
baseDir = process.cwd(),
|
|
893
|
+
relativeDirPath,
|
|
894
|
+
relativeFilePath
|
|
895
|
+
}) {
|
|
896
|
+
return new _AgentsmdCommand(
|
|
897
|
+
this.forDeletionDefault({ baseDir, relativeDirPath, relativeFilePath })
|
|
898
|
+
);
|
|
899
|
+
}
|
|
866
900
|
};
|
|
867
901
|
|
|
868
902
|
// src/features/commands/antigravity-command.ts
|
|
@@ -1080,6 +1114,21 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1080
1114
|
validate
|
|
1081
1115
|
});
|
|
1082
1116
|
}
|
|
1117
|
+
static forDeletion({
|
|
1118
|
+
baseDir = process.cwd(),
|
|
1119
|
+
relativeDirPath,
|
|
1120
|
+
relativeFilePath
|
|
1121
|
+
}) {
|
|
1122
|
+
return new _AntigravityCommand({
|
|
1123
|
+
baseDir,
|
|
1124
|
+
relativeDirPath,
|
|
1125
|
+
relativeFilePath,
|
|
1126
|
+
frontmatter: { description: "" },
|
|
1127
|
+
body: "",
|
|
1128
|
+
fileContent: "",
|
|
1129
|
+
validate: false
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1083
1132
|
};
|
|
1084
1133
|
|
|
1085
1134
|
// src/features/commands/claudecode-command.ts
|
|
@@ -1210,6 +1259,20 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1210
1259
|
validate
|
|
1211
1260
|
});
|
|
1212
1261
|
}
|
|
1262
|
+
static forDeletion({
|
|
1263
|
+
baseDir = process.cwd(),
|
|
1264
|
+
relativeDirPath,
|
|
1265
|
+
relativeFilePath
|
|
1266
|
+
}) {
|
|
1267
|
+
return new _ClaudecodeCommand({
|
|
1268
|
+
baseDir,
|
|
1269
|
+
relativeDirPath,
|
|
1270
|
+
relativeFilePath,
|
|
1271
|
+
frontmatter: { description: "" },
|
|
1272
|
+
body: "",
|
|
1273
|
+
validate: false
|
|
1274
|
+
});
|
|
1275
|
+
}
|
|
1213
1276
|
};
|
|
1214
1277
|
|
|
1215
1278
|
// src/features/commands/codexcli-command.ts
|
|
@@ -1284,13 +1347,26 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1284
1347
|
validate
|
|
1285
1348
|
});
|
|
1286
1349
|
}
|
|
1350
|
+
static forDeletion({
|
|
1351
|
+
baseDir = process.cwd(),
|
|
1352
|
+
relativeDirPath,
|
|
1353
|
+
relativeFilePath
|
|
1354
|
+
}) {
|
|
1355
|
+
return new _CodexcliCommand({
|
|
1356
|
+
baseDir,
|
|
1357
|
+
relativeDirPath,
|
|
1358
|
+
relativeFilePath,
|
|
1359
|
+
fileContent: "",
|
|
1360
|
+
validate: false
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1287
1363
|
};
|
|
1288
1364
|
|
|
1289
1365
|
// src/features/commands/copilot-command.ts
|
|
1290
1366
|
var import_node_path11 = require("path");
|
|
1291
1367
|
var import_mini8 = require("zod/mini");
|
|
1292
1368
|
var CopilotCommandFrontmatterSchema = import_mini8.z.looseObject({
|
|
1293
|
-
mode: import_mini8.z.
|
|
1369
|
+
mode: import_mini8.z.optional(import_mini8.z.string()),
|
|
1294
1370
|
description: import_mini8.z.string()
|
|
1295
1371
|
});
|
|
1296
1372
|
var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
@@ -1368,7 +1444,6 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1368
1444
|
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
1369
1445
|
const copilotFields = rulesyncFrontmatter.copilot ?? {};
|
|
1370
1446
|
const copilotFrontmatter = {
|
|
1371
|
-
mode: "agent",
|
|
1372
1447
|
description: rulesyncFrontmatter.description,
|
|
1373
1448
|
...copilotFields
|
|
1374
1449
|
};
|
|
@@ -1412,6 +1487,20 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1412
1487
|
toolTarget: "copilot"
|
|
1413
1488
|
});
|
|
1414
1489
|
}
|
|
1490
|
+
static forDeletion({
|
|
1491
|
+
baseDir = process.cwd(),
|
|
1492
|
+
relativeDirPath,
|
|
1493
|
+
relativeFilePath
|
|
1494
|
+
}) {
|
|
1495
|
+
return new _CopilotCommand({
|
|
1496
|
+
baseDir,
|
|
1497
|
+
relativeDirPath,
|
|
1498
|
+
relativeFilePath,
|
|
1499
|
+
frontmatter: { description: "" },
|
|
1500
|
+
body: "",
|
|
1501
|
+
validate: false
|
|
1502
|
+
});
|
|
1503
|
+
}
|
|
1415
1504
|
};
|
|
1416
1505
|
|
|
1417
1506
|
// src/features/commands/cursor-command.ts
|
|
@@ -1483,6 +1572,19 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1483
1572
|
validate
|
|
1484
1573
|
});
|
|
1485
1574
|
}
|
|
1575
|
+
static forDeletion({
|
|
1576
|
+
baseDir = process.cwd(),
|
|
1577
|
+
relativeDirPath,
|
|
1578
|
+
relativeFilePath
|
|
1579
|
+
}) {
|
|
1580
|
+
return new _CursorCommand({
|
|
1581
|
+
baseDir,
|
|
1582
|
+
relativeDirPath,
|
|
1583
|
+
relativeFilePath,
|
|
1584
|
+
fileContent: "",
|
|
1585
|
+
validate: false
|
|
1586
|
+
});
|
|
1587
|
+
}
|
|
1486
1588
|
};
|
|
1487
1589
|
|
|
1488
1590
|
// src/features/commands/geminicli-command.ts
|
|
@@ -1610,6 +1712,21 @@ ${geminiFrontmatter.prompt}
|
|
|
1610
1712
|
toolTarget: "geminicli"
|
|
1611
1713
|
});
|
|
1612
1714
|
}
|
|
1715
|
+
static forDeletion({
|
|
1716
|
+
baseDir = process.cwd(),
|
|
1717
|
+
relativeDirPath,
|
|
1718
|
+
relativeFilePath
|
|
1719
|
+
}) {
|
|
1720
|
+
const placeholderToml = `description = ""
|
|
1721
|
+
prompt = ""`;
|
|
1722
|
+
return new _GeminiCliCommand({
|
|
1723
|
+
baseDir,
|
|
1724
|
+
relativeDirPath,
|
|
1725
|
+
relativeFilePath,
|
|
1726
|
+
fileContent: placeholderToml,
|
|
1727
|
+
validate: false
|
|
1728
|
+
});
|
|
1729
|
+
}
|
|
1613
1730
|
};
|
|
1614
1731
|
|
|
1615
1732
|
// src/features/commands/opencode-command.ts
|
|
@@ -1736,6 +1853,20 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1736
1853
|
toolTarget: "opencode"
|
|
1737
1854
|
});
|
|
1738
1855
|
}
|
|
1856
|
+
static forDeletion({
|
|
1857
|
+
baseDir = process.cwd(),
|
|
1858
|
+
relativeDirPath,
|
|
1859
|
+
relativeFilePath
|
|
1860
|
+
}) {
|
|
1861
|
+
return new _OpenCodeCommand({
|
|
1862
|
+
baseDir,
|
|
1863
|
+
relativeDirPath,
|
|
1864
|
+
relativeFilePath,
|
|
1865
|
+
frontmatter: { description: "" },
|
|
1866
|
+
body: "",
|
|
1867
|
+
validate: false
|
|
1868
|
+
});
|
|
1869
|
+
}
|
|
1739
1870
|
};
|
|
1740
1871
|
|
|
1741
1872
|
// src/features/commands/roo-command.ts
|
|
@@ -1862,6 +1993,21 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1862
1993
|
validate
|
|
1863
1994
|
});
|
|
1864
1995
|
}
|
|
1996
|
+
static forDeletion({
|
|
1997
|
+
baseDir = process.cwd(),
|
|
1998
|
+
relativeDirPath,
|
|
1999
|
+
relativeFilePath
|
|
2000
|
+
}) {
|
|
2001
|
+
return new _RooCommand({
|
|
2002
|
+
baseDir,
|
|
2003
|
+
relativeDirPath,
|
|
2004
|
+
relativeFilePath,
|
|
2005
|
+
frontmatter: { description: "" },
|
|
2006
|
+
body: "",
|
|
2007
|
+
fileContent: "",
|
|
2008
|
+
validate: false
|
|
2009
|
+
});
|
|
2010
|
+
}
|
|
1865
2011
|
};
|
|
1866
2012
|
|
|
1867
2013
|
// src/features/commands/commands-processor.ts
|
|
@@ -2044,6 +2190,18 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2044
2190
|
const commandFilePaths = await findFilesByGlobs(
|
|
2045
2191
|
(0, import_node_path16.join)(this.baseDir, paths.relativeDirPath, `*.${factory.meta.extension}`)
|
|
2046
2192
|
);
|
|
2193
|
+
if (forDeletion) {
|
|
2194
|
+
const toolCommands2 = commandFilePaths.map(
|
|
2195
|
+
(path3) => factory.class.forDeletion({
|
|
2196
|
+
baseDir: this.baseDir,
|
|
2197
|
+
relativeDirPath: paths.relativeDirPath,
|
|
2198
|
+
relativeFilePath: (0, import_node_path16.basename)(path3),
|
|
2199
|
+
global: this.global
|
|
2200
|
+
})
|
|
2201
|
+
).filter((cmd) => cmd.isDeletable());
|
|
2202
|
+
logger.info(`Successfully loaded ${toolCommands2.length} ${paths.relativeDirPath} commands`);
|
|
2203
|
+
return toolCommands2;
|
|
2204
|
+
}
|
|
2047
2205
|
const toolCommands = await Promise.all(
|
|
2048
2206
|
commandFilePaths.map(
|
|
2049
2207
|
(path3) => factory.class.fromFile({
|
|
@@ -2053,9 +2211,8 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2053
2211
|
})
|
|
2054
2212
|
)
|
|
2055
2213
|
);
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
return result;
|
|
2214
|
+
logger.info(`Successfully loaded ${toolCommands.length} ${paths.relativeDirPath} commands`);
|
|
2215
|
+
return toolCommands;
|
|
2059
2216
|
}
|
|
2060
2217
|
/**
|
|
2061
2218
|
* Implementation of abstract method from FeatureProcessor
|
|
@@ -2184,6 +2341,14 @@ var ToolIgnore = class extends ToolFile {
|
|
|
2184
2341
|
static async fromFile(_params) {
|
|
2185
2342
|
throw new Error("Please implement this method in the subclass.");
|
|
2186
2343
|
}
|
|
2344
|
+
/**
|
|
2345
|
+
* Create a minimal instance for deletion purposes.
|
|
2346
|
+
* This method does not read or parse file content, making it safe to use
|
|
2347
|
+
* even when files have old/incompatible formats.
|
|
2348
|
+
*/
|
|
2349
|
+
static forDeletion(_params) {
|
|
2350
|
+
throw new Error("Please implement this method in the subclass.");
|
|
2351
|
+
}
|
|
2187
2352
|
};
|
|
2188
2353
|
|
|
2189
2354
|
// src/features/ignore/amazonqcli-ignore.ts
|
|
@@ -2239,6 +2404,19 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
2239
2404
|
validate
|
|
2240
2405
|
});
|
|
2241
2406
|
}
|
|
2407
|
+
static forDeletion({
|
|
2408
|
+
baseDir = process.cwd(),
|
|
2409
|
+
relativeDirPath,
|
|
2410
|
+
relativeFilePath
|
|
2411
|
+
}) {
|
|
2412
|
+
return new _AmazonqcliIgnore({
|
|
2413
|
+
baseDir,
|
|
2414
|
+
relativeDirPath,
|
|
2415
|
+
relativeFilePath,
|
|
2416
|
+
fileContent: "",
|
|
2417
|
+
validate: false
|
|
2418
|
+
});
|
|
2419
|
+
}
|
|
2242
2420
|
};
|
|
2243
2421
|
|
|
2244
2422
|
// src/features/ignore/augmentcode-ignore.ts
|
|
@@ -2294,6 +2472,19 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2294
2472
|
validate
|
|
2295
2473
|
});
|
|
2296
2474
|
}
|
|
2475
|
+
static forDeletion({
|
|
2476
|
+
baseDir = process.cwd(),
|
|
2477
|
+
relativeDirPath,
|
|
2478
|
+
relativeFilePath
|
|
2479
|
+
}) {
|
|
2480
|
+
return new _AugmentcodeIgnore({
|
|
2481
|
+
baseDir,
|
|
2482
|
+
relativeDirPath,
|
|
2483
|
+
relativeFilePath,
|
|
2484
|
+
fileContent: "",
|
|
2485
|
+
validate: false
|
|
2486
|
+
});
|
|
2487
|
+
}
|
|
2297
2488
|
};
|
|
2298
2489
|
|
|
2299
2490
|
// src/features/ignore/claudecode-ignore.ts
|
|
@@ -2390,6 +2581,19 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2390
2581
|
validate
|
|
2391
2582
|
});
|
|
2392
2583
|
}
|
|
2584
|
+
static forDeletion({
|
|
2585
|
+
baseDir = process.cwd(),
|
|
2586
|
+
relativeDirPath,
|
|
2587
|
+
relativeFilePath
|
|
2588
|
+
}) {
|
|
2589
|
+
return new _ClaudecodeIgnore({
|
|
2590
|
+
baseDir,
|
|
2591
|
+
relativeDirPath,
|
|
2592
|
+
relativeFilePath,
|
|
2593
|
+
fileContent: "{}",
|
|
2594
|
+
validate: false
|
|
2595
|
+
});
|
|
2596
|
+
}
|
|
2393
2597
|
};
|
|
2394
2598
|
|
|
2395
2599
|
// src/features/ignore/cline-ignore.ts
|
|
@@ -2444,6 +2648,19 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2444
2648
|
validate
|
|
2445
2649
|
});
|
|
2446
2650
|
}
|
|
2651
|
+
static forDeletion({
|
|
2652
|
+
baseDir = process.cwd(),
|
|
2653
|
+
relativeDirPath,
|
|
2654
|
+
relativeFilePath
|
|
2655
|
+
}) {
|
|
2656
|
+
return new _ClineIgnore({
|
|
2657
|
+
baseDir,
|
|
2658
|
+
relativeDirPath,
|
|
2659
|
+
relativeFilePath,
|
|
2660
|
+
fileContent: "",
|
|
2661
|
+
validate: false
|
|
2662
|
+
});
|
|
2663
|
+
}
|
|
2447
2664
|
};
|
|
2448
2665
|
|
|
2449
2666
|
// src/features/ignore/cursor-ignore.ts
|
|
@@ -2494,6 +2711,19 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2494
2711
|
validate
|
|
2495
2712
|
});
|
|
2496
2713
|
}
|
|
2714
|
+
static forDeletion({
|
|
2715
|
+
baseDir = process.cwd(),
|
|
2716
|
+
relativeDirPath,
|
|
2717
|
+
relativeFilePath
|
|
2718
|
+
}) {
|
|
2719
|
+
return new _CursorIgnore({
|
|
2720
|
+
baseDir,
|
|
2721
|
+
relativeDirPath,
|
|
2722
|
+
relativeFilePath,
|
|
2723
|
+
fileContent: "",
|
|
2724
|
+
validate: false
|
|
2725
|
+
});
|
|
2726
|
+
}
|
|
2497
2727
|
};
|
|
2498
2728
|
|
|
2499
2729
|
// src/features/ignore/geminicli-ignore.ts
|
|
@@ -2538,6 +2768,19 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2538
2768
|
validate
|
|
2539
2769
|
});
|
|
2540
2770
|
}
|
|
2771
|
+
static forDeletion({
|
|
2772
|
+
baseDir = process.cwd(),
|
|
2773
|
+
relativeDirPath,
|
|
2774
|
+
relativeFilePath
|
|
2775
|
+
}) {
|
|
2776
|
+
return new _GeminiCliIgnore({
|
|
2777
|
+
baseDir,
|
|
2778
|
+
relativeDirPath,
|
|
2779
|
+
relativeFilePath,
|
|
2780
|
+
fileContent: "",
|
|
2781
|
+
validate: false
|
|
2782
|
+
});
|
|
2783
|
+
}
|
|
2541
2784
|
};
|
|
2542
2785
|
|
|
2543
2786
|
// src/features/ignore/junie-ignore.ts
|
|
@@ -2582,6 +2825,19 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2582
2825
|
validate
|
|
2583
2826
|
});
|
|
2584
2827
|
}
|
|
2828
|
+
static forDeletion({
|
|
2829
|
+
baseDir = process.cwd(),
|
|
2830
|
+
relativeDirPath,
|
|
2831
|
+
relativeFilePath
|
|
2832
|
+
}) {
|
|
2833
|
+
return new _JunieIgnore({
|
|
2834
|
+
baseDir,
|
|
2835
|
+
relativeDirPath,
|
|
2836
|
+
relativeFilePath,
|
|
2837
|
+
fileContent: "",
|
|
2838
|
+
validate: false
|
|
2839
|
+
});
|
|
2840
|
+
}
|
|
2585
2841
|
};
|
|
2586
2842
|
|
|
2587
2843
|
// src/features/ignore/kiro-ignore.ts
|
|
@@ -2626,6 +2882,19 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
2626
2882
|
validate
|
|
2627
2883
|
});
|
|
2628
2884
|
}
|
|
2885
|
+
static forDeletion({
|
|
2886
|
+
baseDir = process.cwd(),
|
|
2887
|
+
relativeDirPath,
|
|
2888
|
+
relativeFilePath
|
|
2889
|
+
}) {
|
|
2890
|
+
return new _KiroIgnore({
|
|
2891
|
+
baseDir,
|
|
2892
|
+
relativeDirPath,
|
|
2893
|
+
relativeFilePath,
|
|
2894
|
+
fileContent: "",
|
|
2895
|
+
validate: false
|
|
2896
|
+
});
|
|
2897
|
+
}
|
|
2629
2898
|
};
|
|
2630
2899
|
|
|
2631
2900
|
// src/features/ignore/qwencode-ignore.ts
|
|
@@ -2670,6 +2939,19 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
2670
2939
|
validate
|
|
2671
2940
|
});
|
|
2672
2941
|
}
|
|
2942
|
+
static forDeletion({
|
|
2943
|
+
baseDir = process.cwd(),
|
|
2944
|
+
relativeDirPath,
|
|
2945
|
+
relativeFilePath
|
|
2946
|
+
}) {
|
|
2947
|
+
return new _QwencodeIgnore({
|
|
2948
|
+
baseDir,
|
|
2949
|
+
relativeDirPath,
|
|
2950
|
+
relativeFilePath,
|
|
2951
|
+
fileContent: "",
|
|
2952
|
+
validate: false
|
|
2953
|
+
});
|
|
2954
|
+
}
|
|
2673
2955
|
};
|
|
2674
2956
|
|
|
2675
2957
|
// src/features/ignore/roo-ignore.ts
|
|
@@ -2714,6 +2996,19 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
2714
2996
|
validate
|
|
2715
2997
|
});
|
|
2716
2998
|
}
|
|
2999
|
+
static forDeletion({
|
|
3000
|
+
baseDir = process.cwd(),
|
|
3001
|
+
relativeDirPath,
|
|
3002
|
+
relativeFilePath
|
|
3003
|
+
}) {
|
|
3004
|
+
return new _RooIgnore({
|
|
3005
|
+
baseDir,
|
|
3006
|
+
relativeDirPath,
|
|
3007
|
+
relativeFilePath,
|
|
3008
|
+
fileContent: "",
|
|
3009
|
+
validate: false
|
|
3010
|
+
});
|
|
3011
|
+
}
|
|
2717
3012
|
};
|
|
2718
3013
|
|
|
2719
3014
|
// src/features/ignore/windsurf-ignore.ts
|
|
@@ -2758,6 +3053,19 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
2758
3053
|
validate
|
|
2759
3054
|
});
|
|
2760
3055
|
}
|
|
3056
|
+
static forDeletion({
|
|
3057
|
+
baseDir = process.cwd(),
|
|
3058
|
+
relativeDirPath,
|
|
3059
|
+
relativeFilePath
|
|
3060
|
+
}) {
|
|
3061
|
+
return new _WindsurfIgnore({
|
|
3062
|
+
baseDir,
|
|
3063
|
+
relativeDirPath,
|
|
3064
|
+
relativeFilePath,
|
|
3065
|
+
fileContent: "",
|
|
3066
|
+
validate: false
|
|
3067
|
+
});
|
|
3068
|
+
}
|
|
2761
3069
|
};
|
|
2762
3070
|
|
|
2763
3071
|
// src/features/ignore/ignore-processor.ts
|
|
@@ -2837,10 +3145,18 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
2837
3145
|
forDeletion = false
|
|
2838
3146
|
} = {}) {
|
|
2839
3147
|
try {
|
|
2840
|
-
const
|
|
3148
|
+
const factory = this.getFactory(this.toolTarget);
|
|
3149
|
+
const paths = factory.class.getSettablePaths();
|
|
2841
3150
|
if (forDeletion) {
|
|
2842
|
-
|
|
3151
|
+
const toolIgnore = factory.class.forDeletion({
|
|
3152
|
+
baseDir: this.baseDir,
|
|
3153
|
+
relativeDirPath: paths.relativeDirPath,
|
|
3154
|
+
relativeFilePath: paths.relativeFilePath
|
|
3155
|
+
});
|
|
3156
|
+
const toolIgnores2 = toolIgnore.isDeletable() ? [toolIgnore] : [];
|
|
3157
|
+
return toolIgnores2;
|
|
2843
3158
|
}
|
|
3159
|
+
const toolIgnores = await this.loadToolIgnores();
|
|
2844
3160
|
return toolIgnores;
|
|
2845
3161
|
} catch (error) {
|
|
2846
3162
|
const errorMessage = `Failed to load tool files: ${formatError(error)}`;
|
|
@@ -3085,6 +3401,14 @@ var ToolMcp = class extends ToolFile {
|
|
|
3085
3401
|
static async fromFile(_params) {
|
|
3086
3402
|
throw new Error("Please implement this method in the subclass.");
|
|
3087
3403
|
}
|
|
3404
|
+
/**
|
|
3405
|
+
* Create a minimal instance for deletion purposes.
|
|
3406
|
+
* This method does not read or parse file content, making it safe to use
|
|
3407
|
+
* even when files have old/incompatible formats.
|
|
3408
|
+
*/
|
|
3409
|
+
static forDeletion(_params) {
|
|
3410
|
+
throw new Error("Please implement this method in the subclass.");
|
|
3411
|
+
}
|
|
3088
3412
|
static fromRulesyncMcp(_params) {
|
|
3089
3413
|
throw new Error("Please implement this method in the subclass.");
|
|
3090
3414
|
}
|
|
@@ -3144,10 +3468,23 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
3144
3468
|
validate() {
|
|
3145
3469
|
return { success: true, error: null };
|
|
3146
3470
|
}
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3471
|
+
static forDeletion({
|
|
3472
|
+
baseDir = process.cwd(),
|
|
3473
|
+
relativeDirPath,
|
|
3474
|
+
relativeFilePath
|
|
3475
|
+
}) {
|
|
3476
|
+
return new _AmazonqcliMcp({
|
|
3477
|
+
baseDir,
|
|
3478
|
+
relativeDirPath,
|
|
3479
|
+
relativeFilePath,
|
|
3480
|
+
fileContent: "{}",
|
|
3481
|
+
validate: false
|
|
3482
|
+
});
|
|
3483
|
+
}
|
|
3484
|
+
};
|
|
3485
|
+
|
|
3486
|
+
// src/features/mcp/claudecode-mcp.ts
|
|
3487
|
+
var import_node_path32 = require("path");
|
|
3151
3488
|
|
|
3152
3489
|
// src/features/mcp/modular-mcp.ts
|
|
3153
3490
|
var import_node_path31 = require("path");
|
|
@@ -3340,6 +3677,19 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3340
3677
|
validate() {
|
|
3341
3678
|
return { success: true, error: null };
|
|
3342
3679
|
}
|
|
3680
|
+
static forDeletion({
|
|
3681
|
+
baseDir = process.cwd(),
|
|
3682
|
+
relativeDirPath,
|
|
3683
|
+
relativeFilePath
|
|
3684
|
+
}) {
|
|
3685
|
+
return new _ClaudecodeMcp({
|
|
3686
|
+
baseDir,
|
|
3687
|
+
relativeDirPath,
|
|
3688
|
+
relativeFilePath,
|
|
3689
|
+
fileContent: "{}",
|
|
3690
|
+
validate: false
|
|
3691
|
+
});
|
|
3692
|
+
}
|
|
3343
3693
|
};
|
|
3344
3694
|
|
|
3345
3695
|
// src/features/mcp/cline-mcp.ts
|
|
@@ -3397,6 +3747,19 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3397
3747
|
validate() {
|
|
3398
3748
|
return { success: true, error: null };
|
|
3399
3749
|
}
|
|
3750
|
+
static forDeletion({
|
|
3751
|
+
baseDir = process.cwd(),
|
|
3752
|
+
relativeDirPath,
|
|
3753
|
+
relativeFilePath
|
|
3754
|
+
}) {
|
|
3755
|
+
return new _ClineMcp({
|
|
3756
|
+
baseDir,
|
|
3757
|
+
relativeDirPath,
|
|
3758
|
+
relativeFilePath,
|
|
3759
|
+
fileContent: "{}",
|
|
3760
|
+
validate: false
|
|
3761
|
+
});
|
|
3762
|
+
}
|
|
3400
3763
|
};
|
|
3401
3764
|
|
|
3402
3765
|
// src/features/mcp/codexcli-mcp.ts
|
|
@@ -3491,6 +3854,19 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3491
3854
|
}
|
|
3492
3855
|
return filtered;
|
|
3493
3856
|
}
|
|
3857
|
+
static forDeletion({
|
|
3858
|
+
baseDir = process.cwd(),
|
|
3859
|
+
relativeDirPath,
|
|
3860
|
+
relativeFilePath
|
|
3861
|
+
}) {
|
|
3862
|
+
return new _CodexcliMcp({
|
|
3863
|
+
baseDir,
|
|
3864
|
+
relativeDirPath,
|
|
3865
|
+
relativeFilePath,
|
|
3866
|
+
fileContent: "",
|
|
3867
|
+
validate: false
|
|
3868
|
+
});
|
|
3869
|
+
}
|
|
3494
3870
|
};
|
|
3495
3871
|
|
|
3496
3872
|
// src/features/mcp/copilot-mcp.ts
|
|
@@ -3558,6 +3934,19 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3558
3934
|
validate() {
|
|
3559
3935
|
return { success: true, error: null };
|
|
3560
3936
|
}
|
|
3937
|
+
static forDeletion({
|
|
3938
|
+
baseDir = process.cwd(),
|
|
3939
|
+
relativeDirPath,
|
|
3940
|
+
relativeFilePath
|
|
3941
|
+
}) {
|
|
3942
|
+
return new _CopilotMcp({
|
|
3943
|
+
baseDir,
|
|
3944
|
+
relativeDirPath,
|
|
3945
|
+
relativeFilePath,
|
|
3946
|
+
fileContent: "{}",
|
|
3947
|
+
validate: false
|
|
3948
|
+
});
|
|
3949
|
+
}
|
|
3561
3950
|
};
|
|
3562
3951
|
|
|
3563
3952
|
// src/features/mcp/cursor-mcp.ts
|
|
@@ -3626,6 +4015,19 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
3626
4015
|
validate() {
|
|
3627
4016
|
return { success: true, error: null };
|
|
3628
4017
|
}
|
|
4018
|
+
static forDeletion({
|
|
4019
|
+
baseDir = process.cwd(),
|
|
4020
|
+
relativeDirPath,
|
|
4021
|
+
relativeFilePath
|
|
4022
|
+
}) {
|
|
4023
|
+
return new _CursorMcp({
|
|
4024
|
+
baseDir,
|
|
4025
|
+
relativeDirPath,
|
|
4026
|
+
relativeFilePath,
|
|
4027
|
+
fileContent: "{}",
|
|
4028
|
+
validate: false
|
|
4029
|
+
});
|
|
4030
|
+
}
|
|
3629
4031
|
};
|
|
3630
4032
|
|
|
3631
4033
|
// src/features/mcp/geminicli-mcp.ts
|
|
@@ -3700,6 +4102,19 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3700
4102
|
validate() {
|
|
3701
4103
|
return { success: true, error: null };
|
|
3702
4104
|
}
|
|
4105
|
+
static forDeletion({
|
|
4106
|
+
baseDir = process.cwd(),
|
|
4107
|
+
relativeDirPath,
|
|
4108
|
+
relativeFilePath
|
|
4109
|
+
}) {
|
|
4110
|
+
return new _GeminiCliMcp({
|
|
4111
|
+
baseDir,
|
|
4112
|
+
relativeDirPath,
|
|
4113
|
+
relativeFilePath,
|
|
4114
|
+
fileContent: "{}",
|
|
4115
|
+
validate: false
|
|
4116
|
+
});
|
|
4117
|
+
}
|
|
3703
4118
|
};
|
|
3704
4119
|
|
|
3705
4120
|
// src/features/mcp/junie-mcp.ts
|
|
@@ -3757,6 +4172,19 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
3757
4172
|
validate() {
|
|
3758
4173
|
return { success: true, error: null };
|
|
3759
4174
|
}
|
|
4175
|
+
static forDeletion({
|
|
4176
|
+
baseDir = process.cwd(),
|
|
4177
|
+
relativeDirPath,
|
|
4178
|
+
relativeFilePath
|
|
4179
|
+
}) {
|
|
4180
|
+
return new _JunieMcp({
|
|
4181
|
+
baseDir,
|
|
4182
|
+
relativeDirPath,
|
|
4183
|
+
relativeFilePath,
|
|
4184
|
+
fileContent: "{}",
|
|
4185
|
+
validate: false
|
|
4186
|
+
});
|
|
4187
|
+
}
|
|
3760
4188
|
};
|
|
3761
4189
|
|
|
3762
4190
|
// src/features/mcp/opencode-mcp.ts
|
|
@@ -3933,6 +4361,19 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
3933
4361
|
}
|
|
3934
4362
|
return { success: true, error: null };
|
|
3935
4363
|
}
|
|
4364
|
+
static forDeletion({
|
|
4365
|
+
baseDir = process.cwd(),
|
|
4366
|
+
relativeDirPath,
|
|
4367
|
+
relativeFilePath
|
|
4368
|
+
}) {
|
|
4369
|
+
return new _OpencodeMcp({
|
|
4370
|
+
baseDir,
|
|
4371
|
+
relativeDirPath,
|
|
4372
|
+
relativeFilePath,
|
|
4373
|
+
fileContent: "{}",
|
|
4374
|
+
validate: false
|
|
4375
|
+
});
|
|
4376
|
+
}
|
|
3936
4377
|
};
|
|
3937
4378
|
|
|
3938
4379
|
// src/features/mcp/roo-mcp.ts
|
|
@@ -4028,6 +4469,19 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4028
4469
|
validate() {
|
|
4029
4470
|
return { success: true, error: null };
|
|
4030
4471
|
}
|
|
4472
|
+
static forDeletion({
|
|
4473
|
+
baseDir = process.cwd(),
|
|
4474
|
+
relativeDirPath,
|
|
4475
|
+
relativeFilePath
|
|
4476
|
+
}) {
|
|
4477
|
+
return new _RooMcp({
|
|
4478
|
+
baseDir,
|
|
4479
|
+
relativeDirPath,
|
|
4480
|
+
relativeFilePath,
|
|
4481
|
+
fileContent: "{}",
|
|
4482
|
+
validate: false
|
|
4483
|
+
});
|
|
4484
|
+
}
|
|
4031
4485
|
};
|
|
4032
4486
|
|
|
4033
4487
|
// src/features/mcp/mcp-processor.ts
|
|
@@ -4181,6 +4635,18 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4181
4635
|
} = {}) {
|
|
4182
4636
|
try {
|
|
4183
4637
|
const factory = this.getFactory(this.toolTarget);
|
|
4638
|
+
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
4639
|
+
if (forDeletion) {
|
|
4640
|
+
const toolMcp = factory.class.forDeletion({
|
|
4641
|
+
baseDir: this.baseDir,
|
|
4642
|
+
relativeDirPath: paths.relativeDirPath,
|
|
4643
|
+
relativeFilePath: paths.relativeFilePath,
|
|
4644
|
+
global: this.global
|
|
4645
|
+
});
|
|
4646
|
+
const toolMcps2 = toolMcp.isDeletable() ? [toolMcp] : [];
|
|
4647
|
+
logger.info(`Successfully loaded ${toolMcps2.length} ${this.toolTarget} MCP files`);
|
|
4648
|
+
return toolMcps2;
|
|
4649
|
+
}
|
|
4184
4650
|
const toolMcps = [
|
|
4185
4651
|
await factory.class.fromFile({
|
|
4186
4652
|
baseDir: this.baseDir,
|
|
@@ -4189,9 +4655,6 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4189
4655
|
})
|
|
4190
4656
|
];
|
|
4191
4657
|
logger.info(`Successfully loaded ${toolMcps.length} ${this.toolTarget} MCP files`);
|
|
4192
|
-
if (forDeletion) {
|
|
4193
|
-
return toolMcps.filter((toolFile) => toolFile.isDeletable());
|
|
4194
|
-
}
|
|
4195
4658
|
return toolMcps;
|
|
4196
4659
|
} catch (error) {
|
|
4197
4660
|
const errorMessage = `Failed to load MCP files for tool target: ${this.toolTarget}: ${formatError(error)}`;
|
|
@@ -4264,9 +4727,9 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4264
4727
|
};
|
|
4265
4728
|
|
|
4266
4729
|
// src/features/rules/rules-processor.ts
|
|
4267
|
-
var
|
|
4730
|
+
var import_node_path85 = require("path");
|
|
4268
4731
|
var import_toon = require("@toon-format/toon");
|
|
4269
|
-
var
|
|
4732
|
+
var import_mini36 = require("zod/mini");
|
|
4270
4733
|
|
|
4271
4734
|
// src/constants/general.ts
|
|
4272
4735
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
@@ -4420,6 +4883,14 @@ var ToolSkill = class extends AiDir {
|
|
|
4420
4883
|
static async fromDir(_params) {
|
|
4421
4884
|
throw new Error("Please implement this method in the subclass.");
|
|
4422
4885
|
}
|
|
4886
|
+
/**
|
|
4887
|
+
* Create a minimal instance for deletion purposes.
|
|
4888
|
+
* This method does not read or parse directory content, making it safe to use
|
|
4889
|
+
* even when skill files have old/incompatible formats.
|
|
4890
|
+
*/
|
|
4891
|
+
static forDeletion(_params) {
|
|
4892
|
+
throw new Error("Please implement this method in the subclass.");
|
|
4893
|
+
}
|
|
4423
4894
|
/**
|
|
4424
4895
|
* Convert a RulesyncSkill to the tool-specific skill format.
|
|
4425
4896
|
*
|
|
@@ -4493,7 +4964,7 @@ var ToolSkill = class extends AiDir {
|
|
|
4493
4964
|
};
|
|
4494
4965
|
|
|
4495
4966
|
// src/features/skills/simulated-skill.ts
|
|
4496
|
-
var SimulatedSkillFrontmatterSchema = import_mini19.z.
|
|
4967
|
+
var SimulatedSkillFrontmatterSchema = import_mini19.z.looseObject({
|
|
4497
4968
|
name: import_mini19.z.string(),
|
|
4498
4969
|
description: import_mini19.z.string()
|
|
4499
4970
|
});
|
|
@@ -4611,6 +5082,26 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
4611
5082
|
validate: true
|
|
4612
5083
|
};
|
|
4613
5084
|
}
|
|
5085
|
+
/**
|
|
5086
|
+
* Create minimal params for deletion purposes.
|
|
5087
|
+
* This method does not read or parse directory content, making it safe to use
|
|
5088
|
+
* even when skill files have old/incompatible formats.
|
|
5089
|
+
*/
|
|
5090
|
+
static forDeletionDefault({
|
|
5091
|
+
baseDir = process.cwd(),
|
|
5092
|
+
relativeDirPath,
|
|
5093
|
+
dirName
|
|
5094
|
+
}) {
|
|
5095
|
+
return {
|
|
5096
|
+
baseDir,
|
|
5097
|
+
relativeDirPath,
|
|
5098
|
+
dirName,
|
|
5099
|
+
frontmatter: { name: "", description: "" },
|
|
5100
|
+
body: "",
|
|
5101
|
+
otherFiles: [],
|
|
5102
|
+
validate: false
|
|
5103
|
+
};
|
|
5104
|
+
}
|
|
4614
5105
|
/**
|
|
4615
5106
|
* Check if a RulesyncSkill should be converted to this simulated skill type.
|
|
4616
5107
|
* Uses the targets field in the RulesyncSkill frontmatter to determine targeting.
|
|
@@ -4662,23 +5153,153 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
4662
5153
|
toolTarget: "agentsmd"
|
|
4663
5154
|
});
|
|
4664
5155
|
}
|
|
5156
|
+
static forDeletion(params) {
|
|
5157
|
+
const baseParams = this.forDeletionDefault(params);
|
|
5158
|
+
return new _AgentsmdSkill(baseParams);
|
|
5159
|
+
}
|
|
4665
5160
|
};
|
|
4666
5161
|
|
|
4667
|
-
// src/features/skills/
|
|
5162
|
+
// src/features/skills/cursor-skill.ts
|
|
5163
|
+
var import_node_path45 = require("path");
|
|
5164
|
+
var CursorSkill = class _CursorSkill extends SimulatedSkill {
|
|
5165
|
+
static getSettablePaths(options) {
|
|
5166
|
+
if (options?.global) {
|
|
5167
|
+
throw new Error("CursorSkill does not support global mode.");
|
|
5168
|
+
}
|
|
5169
|
+
return {
|
|
5170
|
+
relativeDirPath: (0, import_node_path45.join)(".cursor", "skills")
|
|
5171
|
+
};
|
|
5172
|
+
}
|
|
5173
|
+
static async fromDir(params) {
|
|
5174
|
+
const baseParams = await this.fromDirDefault(params);
|
|
5175
|
+
return new _CursorSkill(baseParams);
|
|
5176
|
+
}
|
|
5177
|
+
static fromRulesyncSkill(params) {
|
|
5178
|
+
const baseParams = {
|
|
5179
|
+
...this.fromRulesyncSkillDefault(params),
|
|
5180
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath
|
|
5181
|
+
};
|
|
5182
|
+
return new _CursorSkill(baseParams);
|
|
5183
|
+
}
|
|
5184
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
5185
|
+
return this.isTargetedByRulesyncSkillDefault({
|
|
5186
|
+
rulesyncSkill,
|
|
5187
|
+
toolTarget: "cursor"
|
|
5188
|
+
});
|
|
5189
|
+
}
|
|
5190
|
+
static forDeletion(params) {
|
|
5191
|
+
const baseParams = this.forDeletionDefault(params);
|
|
5192
|
+
return new _CursorSkill(baseParams);
|
|
5193
|
+
}
|
|
5194
|
+
};
|
|
5195
|
+
|
|
5196
|
+
// src/features/skills/geminicli-skill.ts
|
|
4668
5197
|
var import_node_path46 = require("path");
|
|
5198
|
+
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5199
|
+
static getSettablePaths(options) {
|
|
5200
|
+
if (options?.global) {
|
|
5201
|
+
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5202
|
+
}
|
|
5203
|
+
return {
|
|
5204
|
+
relativeDirPath: (0, import_node_path46.join)(".gemini", "skills")
|
|
5205
|
+
};
|
|
5206
|
+
}
|
|
5207
|
+
static async fromDir(params) {
|
|
5208
|
+
const baseParams = await this.fromDirDefault(params);
|
|
5209
|
+
return new _GeminiCliSkill(baseParams);
|
|
5210
|
+
}
|
|
5211
|
+
static fromRulesyncSkill(params) {
|
|
5212
|
+
const baseParams = {
|
|
5213
|
+
...this.fromRulesyncSkillDefault(params),
|
|
5214
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath
|
|
5215
|
+
};
|
|
5216
|
+
return new _GeminiCliSkill(baseParams);
|
|
5217
|
+
}
|
|
5218
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
5219
|
+
return this.isTargetedByRulesyncSkillDefault({
|
|
5220
|
+
rulesyncSkill,
|
|
5221
|
+
toolTarget: "geminicli"
|
|
5222
|
+
});
|
|
5223
|
+
}
|
|
5224
|
+
static forDeletion(params) {
|
|
5225
|
+
const baseParams = this.forDeletionDefault(params);
|
|
5226
|
+
return new _GeminiCliSkill(baseParams);
|
|
5227
|
+
}
|
|
5228
|
+
};
|
|
5229
|
+
|
|
5230
|
+
// src/features/skills/skills-processor.ts
|
|
5231
|
+
var import_node_path53 = require("path");
|
|
5232
|
+
var import_mini25 = require("zod/mini");
|
|
5233
|
+
|
|
5234
|
+
// src/types/dir-feature-processor.ts
|
|
5235
|
+
var import_node_path47 = require("path");
|
|
5236
|
+
var DirFeatureProcessor = class {
|
|
5237
|
+
baseDir;
|
|
5238
|
+
constructor({ baseDir = process.cwd() }) {
|
|
5239
|
+
this.baseDir = baseDir;
|
|
5240
|
+
}
|
|
5241
|
+
/**
|
|
5242
|
+
* Return tool targets that this feature supports.
|
|
5243
|
+
*/
|
|
5244
|
+
static getToolTargets(_params = {}) {
|
|
5245
|
+
throw new Error("Not implemented");
|
|
5246
|
+
}
|
|
5247
|
+
/**
|
|
5248
|
+
* Once converted to rulesync/tool dirs, write them to the filesystem.
|
|
5249
|
+
* Returns the number of directories written.
|
|
5250
|
+
*/
|
|
5251
|
+
async writeAiDirs(aiDirs) {
|
|
5252
|
+
for (const aiDir of aiDirs) {
|
|
5253
|
+
const dirPath = aiDir.getDirPath();
|
|
5254
|
+
await ensureDir(dirPath);
|
|
5255
|
+
const mainFile = aiDir.getMainFile();
|
|
5256
|
+
if (mainFile) {
|
|
5257
|
+
const mainFilePath = (0, import_node_path47.join)(dirPath, mainFile.name);
|
|
5258
|
+
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5259
|
+
const contentWithNewline = addTrailingNewline(content);
|
|
5260
|
+
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5261
|
+
}
|
|
5262
|
+
const otherFiles = aiDir.getOtherFiles();
|
|
5263
|
+
for (const file of otherFiles) {
|
|
5264
|
+
const filePath = (0, import_node_path47.join)(dirPath, file.relativeFilePathToDirPath);
|
|
5265
|
+
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5266
|
+
await writeFileContent(filePath, contentWithNewline);
|
|
5267
|
+
}
|
|
5268
|
+
}
|
|
5269
|
+
return aiDirs.length;
|
|
5270
|
+
}
|
|
5271
|
+
async removeAiDirs(aiDirs) {
|
|
5272
|
+
for (const aiDir of aiDirs) {
|
|
5273
|
+
await removeDirectory(aiDir.getDirPath());
|
|
5274
|
+
}
|
|
5275
|
+
}
|
|
5276
|
+
};
|
|
5277
|
+
|
|
5278
|
+
// src/features/skills/claudecode-skill.ts
|
|
5279
|
+
var import_node_path49 = require("path");
|
|
4669
5280
|
var import_mini21 = require("zod/mini");
|
|
4670
5281
|
|
|
4671
5282
|
// src/features/skills/rulesync-skill.ts
|
|
4672
|
-
var
|
|
5283
|
+
var import_node_path48 = require("path");
|
|
4673
5284
|
var import_mini20 = require("zod/mini");
|
|
4674
|
-
var RulesyncSkillFrontmatterSchemaInternal = import_mini20.z.
|
|
5285
|
+
var RulesyncSkillFrontmatterSchemaInternal = import_mini20.z.looseObject({
|
|
4675
5286
|
name: import_mini20.z.string(),
|
|
4676
5287
|
description: import_mini20.z.string(),
|
|
4677
5288
|
targets: import_mini20.z._default(RulesyncTargetsSchema, ["*"]),
|
|
4678
5289
|
claudecode: import_mini20.z.optional(
|
|
4679
|
-
import_mini20.z.
|
|
5290
|
+
import_mini20.z.looseObject({
|
|
4680
5291
|
"allowed-tools": import_mini20.z.optional(import_mini20.z.array(import_mini20.z.string()))
|
|
4681
5292
|
})
|
|
5293
|
+
),
|
|
5294
|
+
opencode: import_mini20.z.optional(
|
|
5295
|
+
import_mini20.z.looseObject({
|
|
5296
|
+
"allowed-tools": import_mini20.z.optional(import_mini20.z.array(import_mini20.z.string()))
|
|
5297
|
+
})
|
|
5298
|
+
),
|
|
5299
|
+
copilot: import_mini20.z.optional(
|
|
5300
|
+
import_mini20.z.looseObject({
|
|
5301
|
+
license: import_mini20.z.optional(import_mini20.z.string())
|
|
5302
|
+
})
|
|
4682
5303
|
)
|
|
4683
5304
|
});
|
|
4684
5305
|
var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
|
|
@@ -4745,8 +5366,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
4745
5366
|
dirName,
|
|
4746
5367
|
global = false
|
|
4747
5368
|
}) {
|
|
4748
|
-
const skillDirPath = (0,
|
|
4749
|
-
const skillFilePath = (0,
|
|
5369
|
+
const skillDirPath = (0, import_node_path48.join)(baseDir, relativeDirPath, dirName);
|
|
5370
|
+
const skillFilePath = (0, import_node_path48.join)(skillDirPath, SKILL_FILE_NAME);
|
|
4750
5371
|
if (!await fileExists(skillFilePath)) {
|
|
4751
5372
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
4752
5373
|
}
|
|
@@ -4775,15 +5396,180 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
4775
5396
|
}
|
|
4776
5397
|
};
|
|
4777
5398
|
|
|
4778
|
-
// src/features/skills/
|
|
4779
|
-
var
|
|
5399
|
+
// src/features/skills/claudecode-skill.ts
|
|
5400
|
+
var ClaudecodeSkillFrontmatterSchema = import_mini21.z.looseObject({
|
|
4780
5401
|
name: import_mini21.z.string(),
|
|
4781
|
-
description: import_mini21.z.string()
|
|
5402
|
+
description: import_mini21.z.string(),
|
|
5403
|
+
"allowed-tools": import_mini21.z.optional(import_mini21.z.array(import_mini21.z.string()))
|
|
5404
|
+
});
|
|
5405
|
+
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
5406
|
+
constructor({
|
|
5407
|
+
baseDir = process.cwd(),
|
|
5408
|
+
relativeDirPath = (0, import_node_path49.join)(".claude", "skills"),
|
|
5409
|
+
dirName,
|
|
5410
|
+
frontmatter,
|
|
5411
|
+
body,
|
|
5412
|
+
otherFiles = [],
|
|
5413
|
+
validate = true,
|
|
5414
|
+
global = false
|
|
5415
|
+
}) {
|
|
5416
|
+
super({
|
|
5417
|
+
baseDir,
|
|
5418
|
+
relativeDirPath,
|
|
5419
|
+
dirName,
|
|
5420
|
+
mainFile: {
|
|
5421
|
+
name: SKILL_FILE_NAME,
|
|
5422
|
+
body,
|
|
5423
|
+
frontmatter: { ...frontmatter }
|
|
5424
|
+
},
|
|
5425
|
+
otherFiles,
|
|
5426
|
+
global
|
|
5427
|
+
});
|
|
5428
|
+
if (validate) {
|
|
5429
|
+
const result = this.validate();
|
|
5430
|
+
if (!result.success) {
|
|
5431
|
+
throw result.error;
|
|
5432
|
+
}
|
|
5433
|
+
}
|
|
5434
|
+
}
|
|
5435
|
+
static getSettablePaths({
|
|
5436
|
+
global: _global = false
|
|
5437
|
+
} = {}) {
|
|
5438
|
+
return {
|
|
5439
|
+
relativeDirPath: (0, import_node_path49.join)(".claude", "skills")
|
|
5440
|
+
};
|
|
5441
|
+
}
|
|
5442
|
+
getFrontmatter() {
|
|
5443
|
+
if (!this.mainFile?.frontmatter) {
|
|
5444
|
+
throw new Error("Frontmatter is not defined");
|
|
5445
|
+
}
|
|
5446
|
+
const result = ClaudecodeSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
5447
|
+
return result;
|
|
5448
|
+
}
|
|
5449
|
+
getBody() {
|
|
5450
|
+
return this.mainFile?.body ?? "";
|
|
5451
|
+
}
|
|
5452
|
+
validate() {
|
|
5453
|
+
if (this.mainFile === void 0) {
|
|
5454
|
+
return {
|
|
5455
|
+
success: false,
|
|
5456
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
5457
|
+
};
|
|
5458
|
+
}
|
|
5459
|
+
const result = ClaudecodeSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
5460
|
+
if (!result.success) {
|
|
5461
|
+
return {
|
|
5462
|
+
success: false,
|
|
5463
|
+
error: new Error(
|
|
5464
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
5465
|
+
)
|
|
5466
|
+
};
|
|
5467
|
+
}
|
|
5468
|
+
return { success: true, error: null };
|
|
5469
|
+
}
|
|
5470
|
+
toRulesyncSkill() {
|
|
5471
|
+
const frontmatter = this.getFrontmatter();
|
|
5472
|
+
const rulesyncFrontmatter = {
|
|
5473
|
+
name: frontmatter.name,
|
|
5474
|
+
description: frontmatter.description,
|
|
5475
|
+
targets: ["*"],
|
|
5476
|
+
...frontmatter["allowed-tools"] && {
|
|
5477
|
+
claudecode: {
|
|
5478
|
+
"allowed-tools": frontmatter["allowed-tools"]
|
|
5479
|
+
}
|
|
5480
|
+
}
|
|
5481
|
+
};
|
|
5482
|
+
return new RulesyncSkill({
|
|
5483
|
+
baseDir: this.baseDir,
|
|
5484
|
+
relativeDirPath: this.relativeDirPath,
|
|
5485
|
+
dirName: this.getDirName(),
|
|
5486
|
+
frontmatter: rulesyncFrontmatter,
|
|
5487
|
+
body: this.getBody(),
|
|
5488
|
+
otherFiles: this.getOtherFiles(),
|
|
5489
|
+
validate: true,
|
|
5490
|
+
global: this.global
|
|
5491
|
+
});
|
|
5492
|
+
}
|
|
5493
|
+
static fromRulesyncSkill({
|
|
5494
|
+
rulesyncSkill,
|
|
5495
|
+
validate = true,
|
|
5496
|
+
global = false
|
|
5497
|
+
}) {
|
|
5498
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
5499
|
+
const claudecodeFrontmatter = {
|
|
5500
|
+
name: rulesyncFrontmatter.name,
|
|
5501
|
+
description: rulesyncFrontmatter.description,
|
|
5502
|
+
"allowed-tools": rulesyncFrontmatter.claudecode?.["allowed-tools"]
|
|
5503
|
+
};
|
|
5504
|
+
const settablePaths = _ClaudecodeSkill.getSettablePaths({ global });
|
|
5505
|
+
return new _ClaudecodeSkill({
|
|
5506
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
5507
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
5508
|
+
dirName: rulesyncSkill.getDirName(),
|
|
5509
|
+
frontmatter: claudecodeFrontmatter,
|
|
5510
|
+
body: rulesyncSkill.getBody(),
|
|
5511
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
5512
|
+
validate,
|
|
5513
|
+
global
|
|
5514
|
+
});
|
|
5515
|
+
}
|
|
5516
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
5517
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
5518
|
+
return targets.includes("*") || targets.includes("claudecode");
|
|
5519
|
+
}
|
|
5520
|
+
static async fromDir(params) {
|
|
5521
|
+
const loaded = await this.loadSkillDirContent({
|
|
5522
|
+
...params,
|
|
5523
|
+
getSettablePaths: _ClaudecodeSkill.getSettablePaths
|
|
5524
|
+
});
|
|
5525
|
+
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5526
|
+
if (!result.success) {
|
|
5527
|
+
const skillDirPath = (0, import_node_path49.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5528
|
+
throw new Error(
|
|
5529
|
+
`Invalid frontmatter in ${(0, import_node_path49.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5530
|
+
);
|
|
5531
|
+
}
|
|
5532
|
+
return new _ClaudecodeSkill({
|
|
5533
|
+
baseDir: loaded.baseDir,
|
|
5534
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
5535
|
+
dirName: loaded.dirName,
|
|
5536
|
+
frontmatter: result.data,
|
|
5537
|
+
body: loaded.body,
|
|
5538
|
+
otherFiles: loaded.otherFiles,
|
|
5539
|
+
validate: true,
|
|
5540
|
+
global: loaded.global
|
|
5541
|
+
});
|
|
5542
|
+
}
|
|
5543
|
+
static forDeletion({
|
|
5544
|
+
baseDir = process.cwd(),
|
|
5545
|
+
relativeDirPath,
|
|
5546
|
+
dirName,
|
|
5547
|
+
global = false
|
|
5548
|
+
}) {
|
|
5549
|
+
return new _ClaudecodeSkill({
|
|
5550
|
+
baseDir,
|
|
5551
|
+
relativeDirPath,
|
|
5552
|
+
dirName,
|
|
5553
|
+
frontmatter: { name: "", description: "" },
|
|
5554
|
+
body: "",
|
|
5555
|
+
otherFiles: [],
|
|
5556
|
+
validate: false,
|
|
5557
|
+
global
|
|
5558
|
+
});
|
|
5559
|
+
}
|
|
5560
|
+
};
|
|
5561
|
+
|
|
5562
|
+
// src/features/skills/codexcli-skill.ts
|
|
5563
|
+
var import_node_path50 = require("path");
|
|
5564
|
+
var import_mini22 = require("zod/mini");
|
|
5565
|
+
var CodexCliSkillFrontmatterSchema = import_mini22.z.looseObject({
|
|
5566
|
+
name: import_mini22.z.string(),
|
|
5567
|
+
description: import_mini22.z.string()
|
|
4782
5568
|
});
|
|
4783
5569
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
4784
5570
|
constructor({
|
|
4785
5571
|
baseDir = process.cwd(),
|
|
4786
|
-
relativeDirPath = (0,
|
|
5572
|
+
relativeDirPath = (0, import_node_path50.join)(".codex", "skills"),
|
|
4787
5573
|
dirName,
|
|
4788
5574
|
frontmatter,
|
|
4789
5575
|
body,
|
|
@@ -4815,7 +5601,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
4815
5601
|
throw new Error("CodexCliSkill only supports global mode. Please pass { global: true }.");
|
|
4816
5602
|
}
|
|
4817
5603
|
return {
|
|
4818
|
-
relativeDirPath: (0,
|
|
5604
|
+
relativeDirPath: (0, import_node_path50.join)(".codex", "skills")
|
|
4819
5605
|
};
|
|
4820
5606
|
}
|
|
4821
5607
|
getFrontmatter() {
|
|
@@ -4897,9 +5683,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
4897
5683
|
});
|
|
4898
5684
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
4899
5685
|
if (!result.success) {
|
|
4900
|
-
const skillDirPath = (0,
|
|
5686
|
+
const skillDirPath = (0, import_node_path50.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
4901
5687
|
throw new Error(
|
|
4902
|
-
`Invalid frontmatter in ${(0,
|
|
5688
|
+
`Invalid frontmatter in ${(0, import_node_path50.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
4903
5689
|
);
|
|
4904
5690
|
}
|
|
4905
5691
|
return new _CodexCliSkill({
|
|
@@ -4913,158 +5699,204 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
4913
5699
|
global: loaded.global
|
|
4914
5700
|
});
|
|
4915
5701
|
}
|
|
5702
|
+
static forDeletion({
|
|
5703
|
+
baseDir = process.cwd(),
|
|
5704
|
+
relativeDirPath,
|
|
5705
|
+
dirName,
|
|
5706
|
+
global = false
|
|
5707
|
+
}) {
|
|
5708
|
+
return new _CodexCliSkill({
|
|
5709
|
+
baseDir,
|
|
5710
|
+
relativeDirPath,
|
|
5711
|
+
dirName,
|
|
5712
|
+
frontmatter: { name: "", description: "" },
|
|
5713
|
+
body: "",
|
|
5714
|
+
otherFiles: [],
|
|
5715
|
+
validate: false,
|
|
5716
|
+
global
|
|
5717
|
+
});
|
|
5718
|
+
}
|
|
4916
5719
|
};
|
|
4917
5720
|
|
|
4918
5721
|
// src/features/skills/copilot-skill.ts
|
|
4919
|
-
var
|
|
4920
|
-
var
|
|
5722
|
+
var import_node_path51 = require("path");
|
|
5723
|
+
var import_mini23 = require("zod/mini");
|
|
5724
|
+
var CopilotSkillFrontmatterSchema = import_mini23.z.looseObject({
|
|
5725
|
+
name: import_mini23.z.string(),
|
|
5726
|
+
description: import_mini23.z.string(),
|
|
5727
|
+
license: import_mini23.z.optional(import_mini23.z.string())
|
|
5728
|
+
});
|
|
5729
|
+
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
5730
|
+
constructor({
|
|
5731
|
+
baseDir = process.cwd(),
|
|
5732
|
+
relativeDirPath = (0, import_node_path51.join)(".github", "skills"),
|
|
5733
|
+
dirName,
|
|
5734
|
+
frontmatter,
|
|
5735
|
+
body,
|
|
5736
|
+
otherFiles = [],
|
|
5737
|
+
validate = true,
|
|
5738
|
+
global = false
|
|
5739
|
+
}) {
|
|
5740
|
+
super({
|
|
5741
|
+
baseDir,
|
|
5742
|
+
relativeDirPath,
|
|
5743
|
+
dirName,
|
|
5744
|
+
mainFile: {
|
|
5745
|
+
name: SKILL_FILE_NAME,
|
|
5746
|
+
body,
|
|
5747
|
+
frontmatter: { ...frontmatter }
|
|
5748
|
+
},
|
|
5749
|
+
otherFiles,
|
|
5750
|
+
global
|
|
5751
|
+
});
|
|
5752
|
+
if (validate) {
|
|
5753
|
+
const result = this.validate();
|
|
5754
|
+
if (!result.success) {
|
|
5755
|
+
throw result.error;
|
|
5756
|
+
}
|
|
5757
|
+
}
|
|
5758
|
+
}
|
|
4921
5759
|
static getSettablePaths(options) {
|
|
4922
5760
|
if (options?.global) {
|
|
4923
5761
|
throw new Error("CopilotSkill does not support global mode.");
|
|
4924
5762
|
}
|
|
4925
5763
|
return {
|
|
4926
|
-
relativeDirPath: (0,
|
|
5764
|
+
relativeDirPath: (0, import_node_path51.join)(".github", "skills")
|
|
4927
5765
|
};
|
|
4928
5766
|
}
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
...this.fromRulesyncSkillDefault(params),
|
|
4936
|
-
relativeDirPath: this.getSettablePaths().relativeDirPath
|
|
4937
|
-
};
|
|
4938
|
-
return new _CopilotSkill(baseParams);
|
|
5767
|
+
getFrontmatter() {
|
|
5768
|
+
if (!this.mainFile?.frontmatter) {
|
|
5769
|
+
throw new Error("Frontmatter is not defined");
|
|
5770
|
+
}
|
|
5771
|
+
const result = CopilotSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
5772
|
+
return result;
|
|
4939
5773
|
}
|
|
4940
|
-
|
|
4941
|
-
return this.
|
|
4942
|
-
rulesyncSkill,
|
|
4943
|
-
toolTarget: "copilot"
|
|
4944
|
-
});
|
|
5774
|
+
getBody() {
|
|
5775
|
+
return this.mainFile?.body ?? "";
|
|
4945
5776
|
}
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
if (options?.global) {
|
|
4953
|
-
throw new Error("CursorSkill does not support global mode.");
|
|
5777
|
+
validate() {
|
|
5778
|
+
if (!this.mainFile) {
|
|
5779
|
+
return {
|
|
5780
|
+
success: false,
|
|
5781
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
5782
|
+
};
|
|
4954
5783
|
}
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
5784
|
+
const result = CopilotSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
5785
|
+
if (!result.success) {
|
|
5786
|
+
return {
|
|
5787
|
+
success: false,
|
|
5788
|
+
error: new Error(
|
|
5789
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
5790
|
+
)
|
|
5791
|
+
};
|
|
5792
|
+
}
|
|
5793
|
+
return { success: true, error: null };
|
|
4962
5794
|
}
|
|
4963
|
-
|
|
4964
|
-
const
|
|
4965
|
-
|
|
4966
|
-
|
|
5795
|
+
toRulesyncSkill() {
|
|
5796
|
+
const frontmatter = this.getFrontmatter();
|
|
5797
|
+
const rulesyncFrontmatter = {
|
|
5798
|
+
name: frontmatter.name,
|
|
5799
|
+
description: frontmatter.description,
|
|
5800
|
+
targets: ["*"],
|
|
5801
|
+
...frontmatter.license && {
|
|
5802
|
+
copilot: {
|
|
5803
|
+
license: frontmatter.license
|
|
5804
|
+
}
|
|
5805
|
+
}
|
|
4967
5806
|
};
|
|
4968
|
-
return new
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
5807
|
+
return new RulesyncSkill({
|
|
5808
|
+
baseDir: this.baseDir,
|
|
5809
|
+
relativeDirPath: this.relativeDirPath,
|
|
5810
|
+
dirName: this.getDirName(),
|
|
5811
|
+
frontmatter: rulesyncFrontmatter,
|
|
5812
|
+
body: this.getBody(),
|
|
5813
|
+
otherFiles: this.getOtherFiles(),
|
|
5814
|
+
validate: true,
|
|
5815
|
+
global: this.global
|
|
4974
5816
|
});
|
|
4975
5817
|
}
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
};
|
|
4988
|
-
}
|
|
4989
|
-
static async fromDir(params) {
|
|
4990
|
-
const baseParams = await this.fromDirDefault(params);
|
|
4991
|
-
return new _GeminiCliSkill(baseParams);
|
|
4992
|
-
}
|
|
4993
|
-
static fromRulesyncSkill(params) {
|
|
4994
|
-
const baseParams = {
|
|
4995
|
-
...this.fromRulesyncSkillDefault(params),
|
|
4996
|
-
relativeDirPath: this.getSettablePaths().relativeDirPath
|
|
5818
|
+
static fromRulesyncSkill({
|
|
5819
|
+
rulesyncSkill,
|
|
5820
|
+
validate = true,
|
|
5821
|
+
global = false
|
|
5822
|
+
}) {
|
|
5823
|
+
const settablePaths = _CopilotSkill.getSettablePaths({ global });
|
|
5824
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
5825
|
+
const copilotFrontmatter = {
|
|
5826
|
+
name: rulesyncFrontmatter.name,
|
|
5827
|
+
description: rulesyncFrontmatter.description,
|
|
5828
|
+
license: rulesyncFrontmatter.copilot?.license
|
|
4997
5829
|
};
|
|
4998
|
-
return new
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5830
|
+
return new _CopilotSkill({
|
|
5831
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
5832
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
5833
|
+
dirName: rulesyncSkill.getDirName(),
|
|
5834
|
+
frontmatter: copilotFrontmatter,
|
|
5835
|
+
body: rulesyncSkill.getBody(),
|
|
5836
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
5837
|
+
validate,
|
|
5838
|
+
global
|
|
5004
5839
|
});
|
|
5005
5840
|
}
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
var import_node_path52 = require("path");
|
|
5010
|
-
var import_mini23 = require("zod/mini");
|
|
5011
|
-
|
|
5012
|
-
// src/types/dir-feature-processor.ts
|
|
5013
|
-
var import_node_path50 = require("path");
|
|
5014
|
-
var DirFeatureProcessor = class {
|
|
5015
|
-
baseDir;
|
|
5016
|
-
constructor({ baseDir = process.cwd() }) {
|
|
5017
|
-
this.baseDir = baseDir;
|
|
5018
|
-
}
|
|
5019
|
-
/**
|
|
5020
|
-
* Return tool targets that this feature supports.
|
|
5021
|
-
*/
|
|
5022
|
-
static getToolTargets(_params = {}) {
|
|
5023
|
-
throw new Error("Not implemented");
|
|
5841
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
5842
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
5843
|
+
return targets.includes("*") || targets.includes("copilot");
|
|
5024
5844
|
}
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5037
|
-
const contentWithNewline = addTrailingNewline(content);
|
|
5038
|
-
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5039
|
-
}
|
|
5040
|
-
const otherFiles = aiDir.getOtherFiles();
|
|
5041
|
-
for (const file of otherFiles) {
|
|
5042
|
-
const filePath = (0, import_node_path50.join)(dirPath, file.relativeFilePathToDirPath);
|
|
5043
|
-
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5044
|
-
await writeFileContent(filePath, contentWithNewline);
|
|
5045
|
-
}
|
|
5845
|
+
static async fromDir(params) {
|
|
5846
|
+
const loaded = await this.loadSkillDirContent({
|
|
5847
|
+
...params,
|
|
5848
|
+
getSettablePaths: _CopilotSkill.getSettablePaths
|
|
5849
|
+
});
|
|
5850
|
+
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5851
|
+
if (!result.success) {
|
|
5852
|
+
const skillDirPath = (0, import_node_path51.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5853
|
+
throw new Error(
|
|
5854
|
+
`Invalid frontmatter in ${(0, import_node_path51.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5855
|
+
);
|
|
5046
5856
|
}
|
|
5047
|
-
return
|
|
5857
|
+
return new _CopilotSkill({
|
|
5858
|
+
baseDir: loaded.baseDir,
|
|
5859
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
5860
|
+
dirName: loaded.dirName,
|
|
5861
|
+
frontmatter: result.data,
|
|
5862
|
+
body: loaded.body,
|
|
5863
|
+
otherFiles: loaded.otherFiles,
|
|
5864
|
+
validate: true,
|
|
5865
|
+
global: loaded.global
|
|
5866
|
+
});
|
|
5048
5867
|
}
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5868
|
+
static forDeletion({
|
|
5869
|
+
baseDir = process.cwd(),
|
|
5870
|
+
relativeDirPath,
|
|
5871
|
+
dirName,
|
|
5872
|
+
global = false
|
|
5873
|
+
}) {
|
|
5874
|
+
const settablePaths = _CopilotSkill.getSettablePaths({ global });
|
|
5875
|
+
return new _CopilotSkill({
|
|
5876
|
+
baseDir,
|
|
5877
|
+
relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
|
|
5878
|
+
dirName,
|
|
5879
|
+
frontmatter: { name: "", description: "" },
|
|
5880
|
+
body: "",
|
|
5881
|
+
otherFiles: [],
|
|
5882
|
+
validate: false,
|
|
5883
|
+
global
|
|
5884
|
+
});
|
|
5053
5885
|
}
|
|
5054
5886
|
};
|
|
5055
5887
|
|
|
5056
|
-
// src/features/skills/
|
|
5057
|
-
var
|
|
5058
|
-
var
|
|
5059
|
-
var
|
|
5060
|
-
name:
|
|
5061
|
-
description:
|
|
5062
|
-
"allowed-tools":
|
|
5888
|
+
// src/features/skills/opencode-skill.ts
|
|
5889
|
+
var import_node_path52 = require("path");
|
|
5890
|
+
var import_mini24 = require("zod/mini");
|
|
5891
|
+
var OpenCodeSkillFrontmatterSchema = import_mini24.z.looseObject({
|
|
5892
|
+
name: import_mini24.z.string(),
|
|
5893
|
+
description: import_mini24.z.string(),
|
|
5894
|
+
"allowed-tools": import_mini24.z.optional(import_mini24.z.array(import_mini24.z.string()))
|
|
5063
5895
|
});
|
|
5064
|
-
var
|
|
5896
|
+
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
5065
5897
|
constructor({
|
|
5066
5898
|
baseDir = process.cwd(),
|
|
5067
|
-
relativeDirPath = (0,
|
|
5899
|
+
relativeDirPath = (0, import_node_path52.join)(".opencode", "skills"),
|
|
5068
5900
|
dirName,
|
|
5069
5901
|
frontmatter,
|
|
5070
5902
|
body,
|
|
@@ -5091,18 +5923,16 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5091
5923
|
}
|
|
5092
5924
|
}
|
|
5093
5925
|
}
|
|
5094
|
-
static getSettablePaths({
|
|
5095
|
-
global: _global = false
|
|
5096
|
-
} = {}) {
|
|
5926
|
+
static getSettablePaths({ global = false } = {}) {
|
|
5097
5927
|
return {
|
|
5098
|
-
relativeDirPath: (0,
|
|
5928
|
+
relativeDirPath: global ? (0, import_node_path52.join)(".config", "opencode", "skills") : (0, import_node_path52.join)(".opencode", "skills")
|
|
5099
5929
|
};
|
|
5100
5930
|
}
|
|
5101
5931
|
getFrontmatter() {
|
|
5102
5932
|
if (!this.mainFile?.frontmatter) {
|
|
5103
5933
|
throw new Error("Frontmatter is not defined");
|
|
5104
5934
|
}
|
|
5105
|
-
const result =
|
|
5935
|
+
const result = OpenCodeSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
5106
5936
|
return result;
|
|
5107
5937
|
}
|
|
5108
5938
|
getBody() {
|
|
@@ -5115,7 +5945,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5115
5945
|
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
5116
5946
|
};
|
|
5117
5947
|
}
|
|
5118
|
-
const result =
|
|
5948
|
+
const result = OpenCodeSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
5119
5949
|
if (!result.success) {
|
|
5120
5950
|
return {
|
|
5121
5951
|
success: false,
|
|
@@ -5133,7 +5963,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5133
5963
|
description: frontmatter.description,
|
|
5134
5964
|
targets: ["*"],
|
|
5135
5965
|
...frontmatter["allowed-tools"] && {
|
|
5136
|
-
|
|
5966
|
+
opencode: {
|
|
5137
5967
|
"allowed-tools": frontmatter["allowed-tools"]
|
|
5138
5968
|
}
|
|
5139
5969
|
}
|
|
@@ -5155,39 +5985,40 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5155
5985
|
global = false
|
|
5156
5986
|
}) {
|
|
5157
5987
|
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
5158
|
-
const
|
|
5988
|
+
const opencodeFrontmatter = {
|
|
5159
5989
|
name: rulesyncFrontmatter.name,
|
|
5160
5990
|
description: rulesyncFrontmatter.description,
|
|
5161
|
-
"allowed-tools": rulesyncFrontmatter.
|
|
5991
|
+
"allowed-tools": rulesyncFrontmatter.opencode?.["allowed-tools"]
|
|
5162
5992
|
};
|
|
5163
|
-
const settablePaths =
|
|
5164
|
-
return new
|
|
5993
|
+
const settablePaths = _OpenCodeSkill.getSettablePaths({ global });
|
|
5994
|
+
return new _OpenCodeSkill({
|
|
5165
5995
|
baseDir: rulesyncSkill.getBaseDir(),
|
|
5166
5996
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
5167
5997
|
dirName: rulesyncSkill.getDirName(),
|
|
5168
|
-
frontmatter:
|
|
5998
|
+
frontmatter: opencodeFrontmatter,
|
|
5169
5999
|
body: rulesyncSkill.getBody(),
|
|
5170
6000
|
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
5171
6001
|
validate,
|
|
5172
6002
|
global
|
|
5173
6003
|
});
|
|
5174
6004
|
}
|
|
5175
|
-
static isTargetedByRulesyncSkill(
|
|
5176
|
-
|
|
6005
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
6006
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
6007
|
+
return targets.includes("*") || targets.includes("opencode");
|
|
5177
6008
|
}
|
|
5178
6009
|
static async fromDir(params) {
|
|
5179
6010
|
const loaded = await this.loadSkillDirContent({
|
|
5180
6011
|
...params,
|
|
5181
|
-
getSettablePaths:
|
|
6012
|
+
getSettablePaths: _OpenCodeSkill.getSettablePaths
|
|
5182
6013
|
});
|
|
5183
|
-
const result =
|
|
6014
|
+
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5184
6015
|
if (!result.success) {
|
|
5185
|
-
const skillDirPath = (0,
|
|
6016
|
+
const skillDirPath = (0, import_node_path52.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5186
6017
|
throw new Error(
|
|
5187
|
-
`Invalid frontmatter in ${(0,
|
|
6018
|
+
`Invalid frontmatter in ${(0, import_node_path52.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5188
6019
|
);
|
|
5189
6020
|
}
|
|
5190
|
-
return new
|
|
6021
|
+
return new _OpenCodeSkill({
|
|
5191
6022
|
baseDir: loaded.baseDir,
|
|
5192
6023
|
relativeDirPath: loaded.relativeDirPath,
|
|
5193
6024
|
dirName: loaded.dirName,
|
|
@@ -5198,6 +6029,23 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5198
6029
|
global: loaded.global
|
|
5199
6030
|
});
|
|
5200
6031
|
}
|
|
6032
|
+
static forDeletion({
|
|
6033
|
+
baseDir = process.cwd(),
|
|
6034
|
+
relativeDirPath,
|
|
6035
|
+
dirName,
|
|
6036
|
+
global = false
|
|
6037
|
+
}) {
|
|
6038
|
+
return new _OpenCodeSkill({
|
|
6039
|
+
baseDir,
|
|
6040
|
+
relativeDirPath,
|
|
6041
|
+
dirName,
|
|
6042
|
+
frontmatter: { name: "", description: "" },
|
|
6043
|
+
body: "",
|
|
6044
|
+
otherFiles: [],
|
|
6045
|
+
validate: false,
|
|
6046
|
+
global
|
|
6047
|
+
});
|
|
6048
|
+
}
|
|
5201
6049
|
};
|
|
5202
6050
|
|
|
5203
6051
|
// src/features/skills/skills-processor.ts
|
|
@@ -5207,9 +6055,10 @@ var skillsProcessorToolTargetTuple = [
|
|
|
5207
6055
|
"codexcli",
|
|
5208
6056
|
"copilot",
|
|
5209
6057
|
"cursor",
|
|
5210
|
-
"geminicli"
|
|
6058
|
+
"geminicli",
|
|
6059
|
+
"opencode"
|
|
5211
6060
|
];
|
|
5212
|
-
var SkillsProcessorToolTargetSchema =
|
|
6061
|
+
var SkillsProcessorToolTargetSchema = import_mini25.z.enum(skillsProcessorToolTargetTuple);
|
|
5213
6062
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
5214
6063
|
[
|
|
5215
6064
|
"agentsmd",
|
|
@@ -5236,7 +6085,7 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
5236
6085
|
"copilot",
|
|
5237
6086
|
{
|
|
5238
6087
|
class: CopilotSkill,
|
|
5239
|
-
meta: { supportsProject: true, supportsSimulated:
|
|
6088
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: false }
|
|
5240
6089
|
}
|
|
5241
6090
|
],
|
|
5242
6091
|
[
|
|
@@ -5252,6 +6101,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
5252
6101
|
class: GeminiCliSkill,
|
|
5253
6102
|
meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
|
|
5254
6103
|
}
|
|
6104
|
+
],
|
|
6105
|
+
[
|
|
6106
|
+
"opencode",
|
|
6107
|
+
{
|
|
6108
|
+
class: OpenCodeSkill,
|
|
6109
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
6110
|
+
}
|
|
5255
6111
|
]
|
|
5256
6112
|
]);
|
|
5257
6113
|
var defaultGetFactory4 = (target) => {
|
|
@@ -5331,9 +6187,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5331
6187
|
*/
|
|
5332
6188
|
async loadRulesyncDirs() {
|
|
5333
6189
|
const paths = RulesyncSkill.getSettablePaths();
|
|
5334
|
-
const rulesyncSkillsDirPath = (0,
|
|
5335
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
5336
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
6190
|
+
const rulesyncSkillsDirPath = (0, import_node_path53.join)(this.baseDir, paths.relativeDirPath);
|
|
6191
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path53.join)(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
6192
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path53.basename)(path3));
|
|
5337
6193
|
const rulesyncSkills = await Promise.all(
|
|
5338
6194
|
dirNames.map(
|
|
5339
6195
|
(dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
|
|
@@ -5349,9 +6205,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5349
6205
|
async loadToolDirs() {
|
|
5350
6206
|
const factory = this.getFactory(this.toolTarget);
|
|
5351
6207
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
5352
|
-
const skillsDirPath = (0,
|
|
5353
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
5354
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
6208
|
+
const skillsDirPath = (0, import_node_path53.join)(this.baseDir, paths.relativeDirPath);
|
|
6209
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path53.join)(skillsDirPath, "*"), { type: "dir" });
|
|
6210
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path53.basename)(path3));
|
|
5355
6211
|
const toolSkills = await Promise.all(
|
|
5356
6212
|
dirNames.map(
|
|
5357
6213
|
(dirName) => factory.class.fromDir({
|
|
@@ -5365,7 +6221,23 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5365
6221
|
return toolSkills;
|
|
5366
6222
|
}
|
|
5367
6223
|
async loadToolDirsToDelete() {
|
|
5368
|
-
|
|
6224
|
+
const factory = this.getFactory(this.toolTarget);
|
|
6225
|
+
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
6226
|
+
const skillsDirPath = (0, import_node_path53.join)(this.baseDir, paths.relativeDirPath);
|
|
6227
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path53.join)(skillsDirPath, "*"), { type: "dir" });
|
|
6228
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path53.basename)(path3));
|
|
6229
|
+
const toolSkills = dirNames.map(
|
|
6230
|
+
(dirName) => factory.class.forDeletion({
|
|
6231
|
+
baseDir: this.baseDir,
|
|
6232
|
+
relativeDirPath: paths.relativeDirPath,
|
|
6233
|
+
dirName,
|
|
6234
|
+
global: this.global
|
|
6235
|
+
})
|
|
6236
|
+
);
|
|
6237
|
+
logger.info(
|
|
6238
|
+
`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills for deletion`
|
|
6239
|
+
);
|
|
6240
|
+
return toolSkills;
|
|
5369
6241
|
}
|
|
5370
6242
|
/**
|
|
5371
6243
|
* Implementation of abstract method from DirFeatureProcessor
|
|
@@ -5401,11 +6273,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5401
6273
|
};
|
|
5402
6274
|
|
|
5403
6275
|
// src/features/subagents/agentsmd-subagent.ts
|
|
5404
|
-
var
|
|
6276
|
+
var import_node_path55 = require("path");
|
|
5405
6277
|
|
|
5406
6278
|
// src/features/subagents/simulated-subagent.ts
|
|
5407
|
-
var
|
|
5408
|
-
var
|
|
6279
|
+
var import_node_path54 = require("path");
|
|
6280
|
+
var import_mini26 = require("zod/mini");
|
|
5409
6281
|
|
|
5410
6282
|
// src/features/subagents/tool-subagent.ts
|
|
5411
6283
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -5415,6 +6287,14 @@ var ToolSubagent = class extends ToolFile {
|
|
|
5415
6287
|
static async fromFile(_params) {
|
|
5416
6288
|
throw new Error("Please implement this method in the subclass.");
|
|
5417
6289
|
}
|
|
6290
|
+
/**
|
|
6291
|
+
* Create a minimal instance for deletion purposes.
|
|
6292
|
+
* This method does not read or parse file content, making it safe to use
|
|
6293
|
+
* even when files have old/incompatible formats.
|
|
6294
|
+
*/
|
|
6295
|
+
static forDeletion(_params) {
|
|
6296
|
+
throw new Error("Please implement this method in the subclass.");
|
|
6297
|
+
}
|
|
5418
6298
|
static fromRulesyncSubagent(_params) {
|
|
5419
6299
|
throw new Error("Please implement this method in the subclass.");
|
|
5420
6300
|
}
|
|
@@ -5440,9 +6320,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
5440
6320
|
};
|
|
5441
6321
|
|
|
5442
6322
|
// src/features/subagents/simulated-subagent.ts
|
|
5443
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
5444
|
-
name:
|
|
5445
|
-
description:
|
|
6323
|
+
var SimulatedSubagentFrontmatterSchema = import_mini26.z.object({
|
|
6324
|
+
name: import_mini26.z.string(),
|
|
6325
|
+
description: import_mini26.z.string()
|
|
5446
6326
|
});
|
|
5447
6327
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
5448
6328
|
frontmatter;
|
|
@@ -5452,7 +6332,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5452
6332
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5453
6333
|
if (!result.success) {
|
|
5454
6334
|
throw new Error(
|
|
5455
|
-
`Invalid frontmatter in ${(0,
|
|
6335
|
+
`Invalid frontmatter in ${(0, import_node_path54.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5456
6336
|
);
|
|
5457
6337
|
}
|
|
5458
6338
|
}
|
|
@@ -5503,7 +6383,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5503
6383
|
return {
|
|
5504
6384
|
success: false,
|
|
5505
6385
|
error: new Error(
|
|
5506
|
-
`Invalid frontmatter in ${(0,
|
|
6386
|
+
`Invalid frontmatter in ${(0, import_node_path54.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5507
6387
|
)
|
|
5508
6388
|
};
|
|
5509
6389
|
}
|
|
@@ -5513,7 +6393,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5513
6393
|
relativeFilePath,
|
|
5514
6394
|
validate = true
|
|
5515
6395
|
}) {
|
|
5516
|
-
const filePath = (0,
|
|
6396
|
+
const filePath = (0, import_node_path54.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
5517
6397
|
const fileContent = await readFileContent(filePath);
|
|
5518
6398
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5519
6399
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -5523,19 +6403,33 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5523
6403
|
return {
|
|
5524
6404
|
baseDir,
|
|
5525
6405
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
5526
|
-
relativeFilePath: (0,
|
|
6406
|
+
relativeFilePath: (0, import_node_path54.basename)(relativeFilePath),
|
|
5527
6407
|
frontmatter: result.data,
|
|
5528
6408
|
body: content.trim(),
|
|
5529
6409
|
validate
|
|
5530
6410
|
};
|
|
5531
6411
|
}
|
|
6412
|
+
static forDeletionDefault({
|
|
6413
|
+
baseDir = process.cwd(),
|
|
6414
|
+
relativeDirPath,
|
|
6415
|
+
relativeFilePath
|
|
6416
|
+
}) {
|
|
6417
|
+
return {
|
|
6418
|
+
baseDir,
|
|
6419
|
+
relativeDirPath,
|
|
6420
|
+
relativeFilePath,
|
|
6421
|
+
frontmatter: { name: "", description: "" },
|
|
6422
|
+
body: "",
|
|
6423
|
+
validate: false
|
|
6424
|
+
};
|
|
6425
|
+
}
|
|
5532
6426
|
};
|
|
5533
6427
|
|
|
5534
6428
|
// src/features/subagents/agentsmd-subagent.ts
|
|
5535
6429
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
5536
6430
|
static getSettablePaths() {
|
|
5537
6431
|
return {
|
|
5538
|
-
relativeDirPath: (0,
|
|
6432
|
+
relativeDirPath: (0, import_node_path55.join)(".agents", "subagents")
|
|
5539
6433
|
};
|
|
5540
6434
|
}
|
|
5541
6435
|
static async fromFile(params) {
|
|
@@ -5552,14 +6446,17 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
5552
6446
|
toolTarget: "agentsmd"
|
|
5553
6447
|
});
|
|
5554
6448
|
}
|
|
6449
|
+
static forDeletion(params) {
|
|
6450
|
+
return new _AgentsmdSubagent(this.forDeletionDefault(params));
|
|
6451
|
+
}
|
|
5555
6452
|
};
|
|
5556
6453
|
|
|
5557
6454
|
// src/features/subagents/codexcli-subagent.ts
|
|
5558
|
-
var
|
|
6455
|
+
var import_node_path56 = require("path");
|
|
5559
6456
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
5560
6457
|
static getSettablePaths() {
|
|
5561
6458
|
return {
|
|
5562
|
-
relativeDirPath: (0,
|
|
6459
|
+
relativeDirPath: (0, import_node_path56.join)(".codex", "subagents")
|
|
5563
6460
|
};
|
|
5564
6461
|
}
|
|
5565
6462
|
static async fromFile(params) {
|
|
@@ -5576,14 +6473,17 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
5576
6473
|
toolTarget: "codexcli"
|
|
5577
6474
|
});
|
|
5578
6475
|
}
|
|
6476
|
+
static forDeletion(params) {
|
|
6477
|
+
return new _CodexCliSubagent(this.forDeletionDefault(params));
|
|
6478
|
+
}
|
|
5579
6479
|
};
|
|
5580
6480
|
|
|
5581
6481
|
// src/features/subagents/copilot-subagent.ts
|
|
5582
|
-
var
|
|
6482
|
+
var import_node_path57 = require("path");
|
|
5583
6483
|
var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
5584
6484
|
static getSettablePaths() {
|
|
5585
6485
|
return {
|
|
5586
|
-
relativeDirPath: (0,
|
|
6486
|
+
relativeDirPath: (0, import_node_path57.join)(".github", "subagents")
|
|
5587
6487
|
};
|
|
5588
6488
|
}
|
|
5589
6489
|
static async fromFile(params) {
|
|
@@ -5600,14 +6500,17 @@ var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
|
5600
6500
|
toolTarget: "copilot"
|
|
5601
6501
|
});
|
|
5602
6502
|
}
|
|
6503
|
+
static forDeletion(params) {
|
|
6504
|
+
return new _CopilotSubagent(this.forDeletionDefault(params));
|
|
6505
|
+
}
|
|
5603
6506
|
};
|
|
5604
6507
|
|
|
5605
6508
|
// src/features/subagents/cursor-subagent.ts
|
|
5606
|
-
var
|
|
6509
|
+
var import_node_path58 = require("path");
|
|
5607
6510
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
5608
6511
|
static getSettablePaths() {
|
|
5609
6512
|
return {
|
|
5610
|
-
relativeDirPath: (0,
|
|
6513
|
+
relativeDirPath: (0, import_node_path58.join)(".cursor", "subagents")
|
|
5611
6514
|
};
|
|
5612
6515
|
}
|
|
5613
6516
|
static async fromFile(params) {
|
|
@@ -5624,14 +6527,17 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
5624
6527
|
toolTarget: "cursor"
|
|
5625
6528
|
});
|
|
5626
6529
|
}
|
|
6530
|
+
static forDeletion(params) {
|
|
6531
|
+
return new _CursorSubagent(this.forDeletionDefault(params));
|
|
6532
|
+
}
|
|
5627
6533
|
};
|
|
5628
6534
|
|
|
5629
6535
|
// src/features/subagents/geminicli-subagent.ts
|
|
5630
|
-
var
|
|
6536
|
+
var import_node_path59 = require("path");
|
|
5631
6537
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
5632
6538
|
static getSettablePaths() {
|
|
5633
6539
|
return {
|
|
5634
|
-
relativeDirPath: (0,
|
|
6540
|
+
relativeDirPath: (0, import_node_path59.join)(".gemini", "subagents")
|
|
5635
6541
|
};
|
|
5636
6542
|
}
|
|
5637
6543
|
static async fromFile(params) {
|
|
@@ -5648,14 +6554,17 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
5648
6554
|
toolTarget: "geminicli"
|
|
5649
6555
|
});
|
|
5650
6556
|
}
|
|
6557
|
+
static forDeletion(params) {
|
|
6558
|
+
return new _GeminiCliSubagent(this.forDeletionDefault(params));
|
|
6559
|
+
}
|
|
5651
6560
|
};
|
|
5652
6561
|
|
|
5653
6562
|
// src/features/subagents/roo-subagent.ts
|
|
5654
|
-
var
|
|
6563
|
+
var import_node_path60 = require("path");
|
|
5655
6564
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
5656
6565
|
static getSettablePaths() {
|
|
5657
6566
|
return {
|
|
5658
|
-
relativeDirPath: (0,
|
|
6567
|
+
relativeDirPath: (0, import_node_path60.join)(".roo", "subagents")
|
|
5659
6568
|
};
|
|
5660
6569
|
}
|
|
5661
6570
|
static async fromFile(params) {
|
|
@@ -5672,23 +6581,26 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
5672
6581
|
toolTarget: "roo"
|
|
5673
6582
|
});
|
|
5674
6583
|
}
|
|
6584
|
+
static forDeletion(params) {
|
|
6585
|
+
return new _RooSubagent(this.forDeletionDefault(params));
|
|
6586
|
+
}
|
|
5675
6587
|
};
|
|
5676
6588
|
|
|
5677
6589
|
// src/features/subagents/subagents-processor.ts
|
|
5678
|
-
var
|
|
5679
|
-
var
|
|
6590
|
+
var import_node_path63 = require("path");
|
|
6591
|
+
var import_mini29 = require("zod/mini");
|
|
5680
6592
|
|
|
5681
6593
|
// src/features/subagents/claudecode-subagent.ts
|
|
5682
|
-
var
|
|
5683
|
-
var
|
|
6594
|
+
var import_node_path62 = require("path");
|
|
6595
|
+
var import_mini28 = require("zod/mini");
|
|
5684
6596
|
|
|
5685
6597
|
// src/features/subagents/rulesync-subagent.ts
|
|
5686
|
-
var
|
|
5687
|
-
var
|
|
5688
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
6598
|
+
var import_node_path61 = require("path");
|
|
6599
|
+
var import_mini27 = require("zod/mini");
|
|
6600
|
+
var RulesyncSubagentFrontmatterSchema = import_mini27.z.looseObject({
|
|
5689
6601
|
targets: RulesyncTargetsSchema,
|
|
5690
|
-
name:
|
|
5691
|
-
description:
|
|
6602
|
+
name: import_mini27.z.string(),
|
|
6603
|
+
description: import_mini27.z.string()
|
|
5692
6604
|
});
|
|
5693
6605
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
5694
6606
|
frontmatter;
|
|
@@ -5698,7 +6610,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5698
6610
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5699
6611
|
if (!result.success) {
|
|
5700
6612
|
throw new Error(
|
|
5701
|
-
`Invalid frontmatter in ${(0,
|
|
6613
|
+
`Invalid frontmatter in ${(0, import_node_path61.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5702
6614
|
);
|
|
5703
6615
|
}
|
|
5704
6616
|
}
|
|
@@ -5731,7 +6643,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5731
6643
|
return {
|
|
5732
6644
|
success: false,
|
|
5733
6645
|
error: new Error(
|
|
5734
|
-
`Invalid frontmatter in ${(0,
|
|
6646
|
+
`Invalid frontmatter in ${(0, import_node_path61.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5735
6647
|
)
|
|
5736
6648
|
};
|
|
5737
6649
|
}
|
|
@@ -5740,14 +6652,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5740
6652
|
relativeFilePath
|
|
5741
6653
|
}) {
|
|
5742
6654
|
const fileContent = await readFileContent(
|
|
5743
|
-
(0,
|
|
6655
|
+
(0, import_node_path61.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
5744
6656
|
);
|
|
5745
6657
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5746
6658
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5747
6659
|
if (!result.success) {
|
|
5748
6660
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
5749
6661
|
}
|
|
5750
|
-
const filename = (0,
|
|
6662
|
+
const filename = (0, import_node_path61.basename)(relativeFilePath);
|
|
5751
6663
|
return new _RulesyncSubagent({
|
|
5752
6664
|
baseDir: process.cwd(),
|
|
5753
6665
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -5759,13 +6671,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5759
6671
|
};
|
|
5760
6672
|
|
|
5761
6673
|
// src/features/subagents/claudecode-subagent.ts
|
|
5762
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
5763
|
-
name:
|
|
5764
|
-
description:
|
|
5765
|
-
model:
|
|
5766
|
-
tools:
|
|
5767
|
-
permissionMode:
|
|
5768
|
-
skills:
|
|
6674
|
+
var ClaudecodeSubagentFrontmatterSchema = import_mini28.z.looseObject({
|
|
6675
|
+
name: import_mini28.z.string(),
|
|
6676
|
+
description: import_mini28.z.string(),
|
|
6677
|
+
model: import_mini28.z.optional(import_mini28.z.string()),
|
|
6678
|
+
tools: import_mini28.z.optional(import_mini28.z.union([import_mini28.z.string(), import_mini28.z.array(import_mini28.z.string())])),
|
|
6679
|
+
permissionMode: import_mini28.z.optional(import_mini28.z.string()),
|
|
6680
|
+
skills: import_mini28.z.optional(import_mini28.z.union([import_mini28.z.string(), import_mini28.z.array(import_mini28.z.string())]))
|
|
5769
6681
|
});
|
|
5770
6682
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
5771
6683
|
frontmatter;
|
|
@@ -5775,7 +6687,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5775
6687
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5776
6688
|
if (!result.success) {
|
|
5777
6689
|
throw new Error(
|
|
5778
|
-
`Invalid frontmatter in ${(0,
|
|
6690
|
+
`Invalid frontmatter in ${(0, import_node_path62.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5779
6691
|
);
|
|
5780
6692
|
}
|
|
5781
6693
|
}
|
|
@@ -5787,7 +6699,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5787
6699
|
}
|
|
5788
6700
|
static getSettablePaths(_options = {}) {
|
|
5789
6701
|
return {
|
|
5790
|
-
relativeDirPath: (0,
|
|
6702
|
+
relativeDirPath: (0, import_node_path62.join)(".claude", "agents")
|
|
5791
6703
|
};
|
|
5792
6704
|
}
|
|
5793
6705
|
getFrontmatter() {
|
|
@@ -5861,7 +6773,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5861
6773
|
return {
|
|
5862
6774
|
success: false,
|
|
5863
6775
|
error: new Error(
|
|
5864
|
-
`Invalid frontmatter in ${(0,
|
|
6776
|
+
`Invalid frontmatter in ${(0, import_node_path62.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5865
6777
|
)
|
|
5866
6778
|
};
|
|
5867
6779
|
}
|
|
@@ -5879,7 +6791,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5879
6791
|
global = false
|
|
5880
6792
|
}) {
|
|
5881
6793
|
const paths = this.getSettablePaths({ global });
|
|
5882
|
-
const filePath = (0,
|
|
6794
|
+
const filePath = (0, import_node_path62.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
5883
6795
|
const fileContent = await readFileContent(filePath);
|
|
5884
6796
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5885
6797
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -5896,6 +6808,21 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5896
6808
|
validate
|
|
5897
6809
|
});
|
|
5898
6810
|
}
|
|
6811
|
+
static forDeletion({
|
|
6812
|
+
baseDir = process.cwd(),
|
|
6813
|
+
relativeDirPath,
|
|
6814
|
+
relativeFilePath
|
|
6815
|
+
}) {
|
|
6816
|
+
return new _ClaudecodeSubagent({
|
|
6817
|
+
baseDir,
|
|
6818
|
+
relativeDirPath,
|
|
6819
|
+
relativeFilePath,
|
|
6820
|
+
frontmatter: { name: "", description: "" },
|
|
6821
|
+
body: "",
|
|
6822
|
+
fileContent: "",
|
|
6823
|
+
validate: false
|
|
6824
|
+
});
|
|
6825
|
+
}
|
|
5899
6826
|
};
|
|
5900
6827
|
|
|
5901
6828
|
// src/features/subagents/subagents-processor.ts
|
|
@@ -5908,7 +6835,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
5908
6835
|
"geminicli",
|
|
5909
6836
|
"roo"
|
|
5910
6837
|
];
|
|
5911
|
-
var SubagentsProcessorToolTargetSchema =
|
|
6838
|
+
var SubagentsProcessorToolTargetSchema = import_mini29.z.enum(subagentsProcessorToolTargetTuple);
|
|
5912
6839
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
5913
6840
|
[
|
|
5914
6841
|
"agentsmd",
|
|
@@ -6011,7 +6938,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
6011
6938
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
6012
6939
|
*/
|
|
6013
6940
|
async loadRulesyncFiles() {
|
|
6014
|
-
const subagentsDir = (0,
|
|
6941
|
+
const subagentsDir = (0, import_node_path63.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
6015
6942
|
const dirExists = await directoryExists(subagentsDir);
|
|
6016
6943
|
if (!dirExists) {
|
|
6017
6944
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -6026,7 +6953,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
6026
6953
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
6027
6954
|
const rulesyncSubagents = [];
|
|
6028
6955
|
for (const mdFile of mdFiles) {
|
|
6029
|
-
const filepath = (0,
|
|
6956
|
+
const filepath = (0, import_node_path63.join)(subagentsDir, mdFile);
|
|
6030
6957
|
try {
|
|
6031
6958
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
6032
6959
|
relativeFilePath: mdFile,
|
|
@@ -6056,20 +6983,31 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
6056
6983
|
const factory = this.getFactory(this.toolTarget);
|
|
6057
6984
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
6058
6985
|
const subagentFilePaths = await findFilesByGlobs(
|
|
6059
|
-
(0,
|
|
6986
|
+
(0, import_node_path63.join)(this.baseDir, paths.relativeDirPath, "*.md")
|
|
6060
6987
|
);
|
|
6988
|
+
if (forDeletion) {
|
|
6989
|
+
const toolSubagents2 = subagentFilePaths.map(
|
|
6990
|
+
(path3) => factory.class.forDeletion({
|
|
6991
|
+
baseDir: this.baseDir,
|
|
6992
|
+
relativeDirPath: paths.relativeDirPath,
|
|
6993
|
+
relativeFilePath: (0, import_node_path63.basename)(path3),
|
|
6994
|
+
global: this.global
|
|
6995
|
+
})
|
|
6996
|
+
).filter((subagent) => subagent.isDeletable());
|
|
6997
|
+
logger.info(`Successfully loaded ${toolSubagents2.length} ${paths.relativeDirPath} subagents`);
|
|
6998
|
+
return toolSubagents2;
|
|
6999
|
+
}
|
|
6061
7000
|
const toolSubagents = await Promise.all(
|
|
6062
7001
|
subagentFilePaths.map(
|
|
6063
7002
|
(path3) => factory.class.fromFile({
|
|
6064
7003
|
baseDir: this.baseDir,
|
|
6065
|
-
relativeFilePath: (0,
|
|
7004
|
+
relativeFilePath: (0, import_node_path63.basename)(path3),
|
|
6066
7005
|
global: this.global
|
|
6067
7006
|
})
|
|
6068
7007
|
)
|
|
6069
7008
|
);
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
return result;
|
|
7009
|
+
logger.info(`Successfully loaded ${toolSubagents.length} ${paths.relativeDirPath} subagents`);
|
|
7010
|
+
return toolSubagents;
|
|
6073
7011
|
}
|
|
6074
7012
|
/**
|
|
6075
7013
|
* Implementation of abstract method from FeatureProcessor
|
|
@@ -6095,48 +7033,48 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
6095
7033
|
};
|
|
6096
7034
|
|
|
6097
7035
|
// src/features/rules/agentsmd-rule.ts
|
|
6098
|
-
var
|
|
7036
|
+
var import_node_path66 = require("path");
|
|
6099
7037
|
|
|
6100
7038
|
// src/features/rules/tool-rule.ts
|
|
6101
|
-
var
|
|
7039
|
+
var import_node_path65 = require("path");
|
|
6102
7040
|
|
|
6103
7041
|
// src/features/rules/rulesync-rule.ts
|
|
6104
|
-
var
|
|
6105
|
-
var
|
|
6106
|
-
var RulesyncRuleFrontmatterSchema =
|
|
6107
|
-
root:
|
|
6108
|
-
targets:
|
|
6109
|
-
description:
|
|
6110
|
-
globs:
|
|
6111
|
-
agentsmd:
|
|
6112
|
-
|
|
7042
|
+
var import_node_path64 = require("path");
|
|
7043
|
+
var import_mini30 = require("zod/mini");
|
|
7044
|
+
var RulesyncRuleFrontmatterSchema = import_mini30.z.object({
|
|
7045
|
+
root: import_mini30.z.optional(import_mini30.z.optional(import_mini30.z.boolean())),
|
|
7046
|
+
targets: import_mini30.z.optional(RulesyncTargetsSchema),
|
|
7047
|
+
description: import_mini30.z.optional(import_mini30.z.string()),
|
|
7048
|
+
globs: import_mini30.z.optional(import_mini30.z.array(import_mini30.z.string())),
|
|
7049
|
+
agentsmd: import_mini30.z.optional(
|
|
7050
|
+
import_mini30.z.object({
|
|
6113
7051
|
// @example "path/to/subproject"
|
|
6114
|
-
subprojectPath:
|
|
7052
|
+
subprojectPath: import_mini30.z.optional(import_mini30.z.string())
|
|
6115
7053
|
})
|
|
6116
7054
|
),
|
|
6117
|
-
claudecode:
|
|
6118
|
-
|
|
7055
|
+
claudecode: import_mini30.z.optional(
|
|
7056
|
+
import_mini30.z.object({
|
|
6119
7057
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
6120
7058
|
// @example "src/**/*.ts, tests/**/*.test.ts"
|
|
6121
|
-
paths:
|
|
7059
|
+
paths: import_mini30.z.optional(import_mini30.z.string())
|
|
6122
7060
|
})
|
|
6123
7061
|
),
|
|
6124
|
-
cursor:
|
|
6125
|
-
|
|
6126
|
-
alwaysApply:
|
|
6127
|
-
description:
|
|
6128
|
-
globs:
|
|
7062
|
+
cursor: import_mini30.z.optional(
|
|
7063
|
+
import_mini30.z.object({
|
|
7064
|
+
alwaysApply: import_mini30.z.optional(import_mini30.z.boolean()),
|
|
7065
|
+
description: import_mini30.z.optional(import_mini30.z.string()),
|
|
7066
|
+
globs: import_mini30.z.optional(import_mini30.z.array(import_mini30.z.string()))
|
|
6129
7067
|
})
|
|
6130
7068
|
),
|
|
6131
|
-
copilot:
|
|
6132
|
-
|
|
6133
|
-
excludeAgent:
|
|
7069
|
+
copilot: import_mini30.z.optional(
|
|
7070
|
+
import_mini30.z.object({
|
|
7071
|
+
excludeAgent: import_mini30.z.optional(import_mini30.z.union([import_mini30.z.literal("code-review"), import_mini30.z.literal("coding-agent")]))
|
|
6134
7072
|
})
|
|
6135
7073
|
),
|
|
6136
|
-
antigravity:
|
|
6137
|
-
|
|
6138
|
-
trigger:
|
|
6139
|
-
globs:
|
|
7074
|
+
antigravity: import_mini30.z.optional(
|
|
7075
|
+
import_mini30.z.looseObject({
|
|
7076
|
+
trigger: import_mini30.z.optional(import_mini30.z.string()),
|
|
7077
|
+
globs: import_mini30.z.optional(import_mini30.z.array(import_mini30.z.string()))
|
|
6140
7078
|
})
|
|
6141
7079
|
)
|
|
6142
7080
|
});
|
|
@@ -6148,7 +7086,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6148
7086
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
6149
7087
|
if (!result.success) {
|
|
6150
7088
|
throw new Error(
|
|
6151
|
-
`Invalid frontmatter in ${(0,
|
|
7089
|
+
`Invalid frontmatter in ${(0, import_node_path64.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6152
7090
|
);
|
|
6153
7091
|
}
|
|
6154
7092
|
}
|
|
@@ -6163,6 +7101,9 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6163
7101
|
return {
|
|
6164
7102
|
recommended: {
|
|
6165
7103
|
relativeDirPath: RULESYNC_RULES_RELATIVE_DIR_PATH
|
|
7104
|
+
},
|
|
7105
|
+
legacy: {
|
|
7106
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH
|
|
6166
7107
|
}
|
|
6167
7108
|
};
|
|
6168
7109
|
}
|
|
@@ -6180,16 +7121,54 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6180
7121
|
return {
|
|
6181
7122
|
success: false,
|
|
6182
7123
|
error: new Error(
|
|
6183
|
-
`Invalid frontmatter in ${(0,
|
|
7124
|
+
`Invalid frontmatter in ${(0, import_node_path64.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
6184
7125
|
)
|
|
6185
7126
|
};
|
|
6186
7127
|
}
|
|
6187
7128
|
}
|
|
7129
|
+
static async fromFileLegacy({
|
|
7130
|
+
relativeFilePath,
|
|
7131
|
+
validate = true
|
|
7132
|
+
}) {
|
|
7133
|
+
const legacyPath = (0, import_node_path64.join)(
|
|
7134
|
+
process.cwd(),
|
|
7135
|
+
this.getSettablePaths().legacy.relativeDirPath,
|
|
7136
|
+
relativeFilePath
|
|
7137
|
+
);
|
|
7138
|
+
const recommendedPath = (0, import_node_path64.join)(
|
|
7139
|
+
this.getSettablePaths().recommended.relativeDirPath,
|
|
7140
|
+
relativeFilePath
|
|
7141
|
+
);
|
|
7142
|
+
logger.warn(`\u26A0\uFE0F Using deprecated path "${legacyPath}". Please migrate to "${recommendedPath}"`);
|
|
7143
|
+
const fileContent = await readFileContent(legacyPath);
|
|
7144
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7145
|
+
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7146
|
+
if (!result.success) {
|
|
7147
|
+
throw new Error(`Invalid frontmatter in ${legacyPath}: ${formatError(result.error)}`);
|
|
7148
|
+
}
|
|
7149
|
+
const validatedFrontmatter = {
|
|
7150
|
+
root: result.data.root ?? false,
|
|
7151
|
+
targets: result.data.targets ?? ["*"],
|
|
7152
|
+
description: result.data.description ?? "",
|
|
7153
|
+
globs: result.data.globs ?? [],
|
|
7154
|
+
agentsmd: result.data.agentsmd,
|
|
7155
|
+
cursor: result.data.cursor
|
|
7156
|
+
};
|
|
7157
|
+
const filename = (0, import_node_path64.basename)(legacyPath);
|
|
7158
|
+
return new _RulesyncRule({
|
|
7159
|
+
baseDir: process.cwd(),
|
|
7160
|
+
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
7161
|
+
relativeFilePath: filename,
|
|
7162
|
+
frontmatter: validatedFrontmatter,
|
|
7163
|
+
body: content.trim(),
|
|
7164
|
+
validate
|
|
7165
|
+
});
|
|
7166
|
+
}
|
|
6188
7167
|
static async fromFile({
|
|
6189
7168
|
relativeFilePath,
|
|
6190
7169
|
validate = true
|
|
6191
7170
|
}) {
|
|
6192
|
-
const filePath = (0,
|
|
7171
|
+
const filePath = (0, import_node_path64.join)(
|
|
6193
7172
|
process.cwd(),
|
|
6194
7173
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
6195
7174
|
relativeFilePath
|
|
@@ -6208,7 +7187,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6208
7187
|
agentsmd: result.data.agentsmd,
|
|
6209
7188
|
cursor: result.data.cursor
|
|
6210
7189
|
};
|
|
6211
|
-
const filename = (0,
|
|
7190
|
+
const filename = (0, import_node_path64.basename)(filePath);
|
|
6212
7191
|
return new _RulesyncRule({
|
|
6213
7192
|
baseDir: process.cwd(),
|
|
6214
7193
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -6240,6 +7219,14 @@ var ToolRule = class extends ToolFile {
|
|
|
6240
7219
|
static async fromFile(_params) {
|
|
6241
7220
|
throw new Error("Please implement this method in the subclass.");
|
|
6242
7221
|
}
|
|
7222
|
+
/**
|
|
7223
|
+
* Create a minimal instance for deletion purposes.
|
|
7224
|
+
* This method does not read or parse file content, making it safe to use
|
|
7225
|
+
* even when files have old/incompatible formats.
|
|
7226
|
+
*/
|
|
7227
|
+
static forDeletion(_params) {
|
|
7228
|
+
throw new Error("Please implement this method in the subclass.");
|
|
7229
|
+
}
|
|
6243
7230
|
static fromRulesyncRule(_params) {
|
|
6244
7231
|
throw new Error("Please implement this method in the subclass.");
|
|
6245
7232
|
}
|
|
@@ -6283,7 +7270,7 @@ var ToolRule = class extends ToolFile {
|
|
|
6283
7270
|
rulesyncRule,
|
|
6284
7271
|
validate = true,
|
|
6285
7272
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
6286
|
-
nonRootPath = { relativeDirPath: (0,
|
|
7273
|
+
nonRootPath = { relativeDirPath: (0, import_node_path65.join)(".agents", "memories") }
|
|
6287
7274
|
}) {
|
|
6288
7275
|
const params = this.buildToolRuleParamsDefault({
|
|
6289
7276
|
baseDir,
|
|
@@ -6294,7 +7281,7 @@ var ToolRule = class extends ToolFile {
|
|
|
6294
7281
|
});
|
|
6295
7282
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
6296
7283
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
6297
|
-
params.relativeDirPath = (0,
|
|
7284
|
+
params.relativeDirPath = (0, import_node_path65.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
6298
7285
|
params.relativeFilePath = "AGENTS.md";
|
|
6299
7286
|
}
|
|
6300
7287
|
return params;
|
|
@@ -6359,7 +7346,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6359
7346
|
relativeFilePath: "AGENTS.md"
|
|
6360
7347
|
},
|
|
6361
7348
|
nonRoot: {
|
|
6362
|
-
relativeDirPath: (0,
|
|
7349
|
+
relativeDirPath: (0, import_node_path66.join)(".agents", "memories")
|
|
6363
7350
|
}
|
|
6364
7351
|
};
|
|
6365
7352
|
}
|
|
@@ -6369,8 +7356,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6369
7356
|
validate = true
|
|
6370
7357
|
}) {
|
|
6371
7358
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
6372
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
6373
|
-
const fileContent = await readFileContent((0,
|
|
7359
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path66.join)(".agents", "memories", relativeFilePath);
|
|
7360
|
+
const fileContent = await readFileContent((0, import_node_path66.join)(baseDir, relativePath));
|
|
6374
7361
|
return new _AgentsMdRule({
|
|
6375
7362
|
baseDir,
|
|
6376
7363
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -6380,6 +7367,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6380
7367
|
root: isRoot
|
|
6381
7368
|
});
|
|
6382
7369
|
}
|
|
7370
|
+
static forDeletion({
|
|
7371
|
+
baseDir = process.cwd(),
|
|
7372
|
+
relativeDirPath,
|
|
7373
|
+
relativeFilePath
|
|
7374
|
+
}) {
|
|
7375
|
+
const isRoot = relativeFilePath === "AGENTS.md" && relativeDirPath === ".";
|
|
7376
|
+
return new _AgentsMdRule({
|
|
7377
|
+
baseDir,
|
|
7378
|
+
relativeDirPath,
|
|
7379
|
+
relativeFilePath,
|
|
7380
|
+
fileContent: "",
|
|
7381
|
+
validate: false,
|
|
7382
|
+
root: isRoot
|
|
7383
|
+
});
|
|
7384
|
+
}
|
|
6383
7385
|
static fromRulesyncRule({
|
|
6384
7386
|
baseDir = process.cwd(),
|
|
6385
7387
|
rulesyncRule,
|
|
@@ -6410,12 +7412,12 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6410
7412
|
};
|
|
6411
7413
|
|
|
6412
7414
|
// src/features/rules/amazonqcli-rule.ts
|
|
6413
|
-
var
|
|
7415
|
+
var import_node_path67 = require("path");
|
|
6414
7416
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
6415
7417
|
static getSettablePaths() {
|
|
6416
7418
|
return {
|
|
6417
7419
|
nonRoot: {
|
|
6418
|
-
relativeDirPath: (0,
|
|
7420
|
+
relativeDirPath: (0, import_node_path67.join)(".amazonq", "rules")
|
|
6419
7421
|
}
|
|
6420
7422
|
};
|
|
6421
7423
|
}
|
|
@@ -6425,7 +7427,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
6425
7427
|
validate = true
|
|
6426
7428
|
}) {
|
|
6427
7429
|
const fileContent = await readFileContent(
|
|
6428
|
-
(0,
|
|
7430
|
+
(0, import_node_path67.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6429
7431
|
);
|
|
6430
7432
|
return new _AmazonQCliRule({
|
|
6431
7433
|
baseDir,
|
|
@@ -6456,6 +7458,20 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
6456
7458
|
validate() {
|
|
6457
7459
|
return { success: true, error: null };
|
|
6458
7460
|
}
|
|
7461
|
+
static forDeletion({
|
|
7462
|
+
baseDir = process.cwd(),
|
|
7463
|
+
relativeDirPath,
|
|
7464
|
+
relativeFilePath
|
|
7465
|
+
}) {
|
|
7466
|
+
return new _AmazonQCliRule({
|
|
7467
|
+
baseDir,
|
|
7468
|
+
relativeDirPath,
|
|
7469
|
+
relativeFilePath,
|
|
7470
|
+
fileContent: "",
|
|
7471
|
+
validate: false,
|
|
7472
|
+
root: false
|
|
7473
|
+
});
|
|
7474
|
+
}
|
|
6459
7475
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
6460
7476
|
return this.isTargetedByRulesyncRuleDefault({
|
|
6461
7477
|
rulesyncRule,
|
|
@@ -6465,21 +7481,21 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
6465
7481
|
};
|
|
6466
7482
|
|
|
6467
7483
|
// src/features/rules/antigravity-rule.ts
|
|
6468
|
-
var
|
|
6469
|
-
var
|
|
6470
|
-
var AntigravityRuleFrontmatterSchema =
|
|
6471
|
-
trigger:
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
7484
|
+
var import_node_path68 = require("path");
|
|
7485
|
+
var import_mini31 = require("zod/mini");
|
|
7486
|
+
var AntigravityRuleFrontmatterSchema = import_mini31.z.looseObject({
|
|
7487
|
+
trigger: import_mini31.z.optional(
|
|
7488
|
+
import_mini31.z.union([
|
|
7489
|
+
import_mini31.z.literal("always_on"),
|
|
7490
|
+
import_mini31.z.literal("glob"),
|
|
7491
|
+
import_mini31.z.literal("manual"),
|
|
7492
|
+
import_mini31.z.literal("model_decision"),
|
|
7493
|
+
import_mini31.z.string()
|
|
6478
7494
|
// accepts any string for forward compatibility
|
|
6479
7495
|
])
|
|
6480
7496
|
),
|
|
6481
|
-
globs:
|
|
6482
|
-
description:
|
|
7497
|
+
globs: import_mini31.z.optional(import_mini31.z.string()),
|
|
7498
|
+
description: import_mini31.z.optional(import_mini31.z.string())
|
|
6483
7499
|
});
|
|
6484
7500
|
function parseGlobsString(globs) {
|
|
6485
7501
|
if (!globs) {
|
|
@@ -6624,7 +7640,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
6624
7640
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
6625
7641
|
if (!result.success) {
|
|
6626
7642
|
throw new Error(
|
|
6627
|
-
`Invalid frontmatter in ${(0,
|
|
7643
|
+
`Invalid frontmatter in ${(0, import_node_path68.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6628
7644
|
);
|
|
6629
7645
|
}
|
|
6630
7646
|
}
|
|
@@ -6639,7 +7655,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
6639
7655
|
static getSettablePaths() {
|
|
6640
7656
|
return {
|
|
6641
7657
|
nonRoot: {
|
|
6642
|
-
relativeDirPath: (0,
|
|
7658
|
+
relativeDirPath: (0, import_node_path68.join)(".agent", "rules")
|
|
6643
7659
|
}
|
|
6644
7660
|
};
|
|
6645
7661
|
}
|
|
@@ -6648,7 +7664,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
6648
7664
|
relativeFilePath,
|
|
6649
7665
|
validate = true
|
|
6650
7666
|
}) {
|
|
6651
|
-
const filePath = (0,
|
|
7667
|
+
const filePath = (0, import_node_path68.join)(
|
|
6652
7668
|
baseDir,
|
|
6653
7669
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
6654
7670
|
relativeFilePath
|
|
@@ -6765,6 +7781,21 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
6765
7781
|
}
|
|
6766
7782
|
return { success: true, error: null };
|
|
6767
7783
|
}
|
|
7784
|
+
static forDeletion({
|
|
7785
|
+
baseDir = process.cwd(),
|
|
7786
|
+
relativeDirPath,
|
|
7787
|
+
relativeFilePath
|
|
7788
|
+
}) {
|
|
7789
|
+
return new _AntigravityRule({
|
|
7790
|
+
baseDir,
|
|
7791
|
+
relativeDirPath,
|
|
7792
|
+
relativeFilePath,
|
|
7793
|
+
frontmatter: {},
|
|
7794
|
+
body: "",
|
|
7795
|
+
validate: false,
|
|
7796
|
+
root: false
|
|
7797
|
+
});
|
|
7798
|
+
}
|
|
6768
7799
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
6769
7800
|
return this.isTargetedByRulesyncRuleDefault({
|
|
6770
7801
|
rulesyncRule,
|
|
@@ -6774,7 +7805,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
6774
7805
|
};
|
|
6775
7806
|
|
|
6776
7807
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
6777
|
-
var
|
|
7808
|
+
var import_node_path69 = require("path");
|
|
6778
7809
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
6779
7810
|
toRulesyncRule() {
|
|
6780
7811
|
const rulesyncFrontmatter = {
|
|
@@ -6800,7 +7831,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6800
7831
|
relativeFilePath: ".augment-guidelines"
|
|
6801
7832
|
},
|
|
6802
7833
|
nonRoot: {
|
|
6803
|
-
relativeDirPath: (0,
|
|
7834
|
+
relativeDirPath: (0, import_node_path69.join)(".augment", "rules")
|
|
6804
7835
|
}
|
|
6805
7836
|
};
|
|
6806
7837
|
}
|
|
@@ -6835,8 +7866,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6835
7866
|
}) {
|
|
6836
7867
|
const settablePaths = this.getSettablePaths();
|
|
6837
7868
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
6838
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
6839
|
-
const fileContent = await readFileContent((0,
|
|
7869
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path69.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
7870
|
+
const fileContent = await readFileContent((0, import_node_path69.join)(baseDir, relativePath));
|
|
6840
7871
|
return new _AugmentcodeLegacyRule({
|
|
6841
7872
|
baseDir,
|
|
6842
7873
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -6846,10 +7877,26 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6846
7877
|
root: isRoot
|
|
6847
7878
|
});
|
|
6848
7879
|
}
|
|
7880
|
+
static forDeletion({
|
|
7881
|
+
baseDir = process.cwd(),
|
|
7882
|
+
relativeDirPath,
|
|
7883
|
+
relativeFilePath
|
|
7884
|
+
}) {
|
|
7885
|
+
const settablePaths = this.getSettablePaths();
|
|
7886
|
+
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
7887
|
+
return new _AugmentcodeLegacyRule({
|
|
7888
|
+
baseDir,
|
|
7889
|
+
relativeDirPath,
|
|
7890
|
+
relativeFilePath,
|
|
7891
|
+
fileContent: "",
|
|
7892
|
+
validate: false,
|
|
7893
|
+
root: isRoot
|
|
7894
|
+
});
|
|
7895
|
+
}
|
|
6849
7896
|
};
|
|
6850
7897
|
|
|
6851
7898
|
// src/features/rules/augmentcode-rule.ts
|
|
6852
|
-
var
|
|
7899
|
+
var import_node_path70 = require("path");
|
|
6853
7900
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
6854
7901
|
toRulesyncRule() {
|
|
6855
7902
|
return this.toRulesyncRuleDefault();
|
|
@@ -6857,7 +7904,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6857
7904
|
static getSettablePaths() {
|
|
6858
7905
|
return {
|
|
6859
7906
|
nonRoot: {
|
|
6860
|
-
relativeDirPath: (0,
|
|
7907
|
+
relativeDirPath: (0, import_node_path70.join)(".augment", "rules")
|
|
6861
7908
|
}
|
|
6862
7909
|
};
|
|
6863
7910
|
}
|
|
@@ -6881,7 +7928,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6881
7928
|
validate = true
|
|
6882
7929
|
}) {
|
|
6883
7930
|
const fileContent = await readFileContent(
|
|
6884
|
-
(0,
|
|
7931
|
+
(0, import_node_path70.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6885
7932
|
);
|
|
6886
7933
|
const { body: content } = parseFrontmatter(fileContent);
|
|
6887
7934
|
return new _AugmentcodeRule({
|
|
@@ -6895,6 +7942,19 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6895
7942
|
validate() {
|
|
6896
7943
|
return { success: true, error: null };
|
|
6897
7944
|
}
|
|
7945
|
+
static forDeletion({
|
|
7946
|
+
baseDir = process.cwd(),
|
|
7947
|
+
relativeDirPath,
|
|
7948
|
+
relativeFilePath
|
|
7949
|
+
}) {
|
|
7950
|
+
return new _AugmentcodeRule({
|
|
7951
|
+
baseDir,
|
|
7952
|
+
relativeDirPath,
|
|
7953
|
+
relativeFilePath,
|
|
7954
|
+
fileContent: "",
|
|
7955
|
+
validate: false
|
|
7956
|
+
});
|
|
7957
|
+
}
|
|
6898
7958
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
6899
7959
|
return this.isTargetedByRulesyncRuleDefault({
|
|
6900
7960
|
rulesyncRule,
|
|
@@ -6904,7 +7964,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6904
7964
|
};
|
|
6905
7965
|
|
|
6906
7966
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
6907
|
-
var
|
|
7967
|
+
var import_node_path71 = require("path");
|
|
6908
7968
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
6909
7969
|
static getSettablePaths({
|
|
6910
7970
|
global
|
|
@@ -6923,7 +7983,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
6923
7983
|
relativeFilePath: "CLAUDE.md"
|
|
6924
7984
|
},
|
|
6925
7985
|
nonRoot: {
|
|
6926
|
-
relativeDirPath: (0,
|
|
7986
|
+
relativeDirPath: (0, import_node_path71.join)(".claude", "memories")
|
|
6927
7987
|
}
|
|
6928
7988
|
};
|
|
6929
7989
|
}
|
|
@@ -6938,7 +7998,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
6938
7998
|
if (isRoot) {
|
|
6939
7999
|
const relativePath2 = paths.root.relativeFilePath;
|
|
6940
8000
|
const fileContent2 = await readFileContent(
|
|
6941
|
-
(0,
|
|
8001
|
+
(0, import_node_path71.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
6942
8002
|
);
|
|
6943
8003
|
return new _ClaudecodeLegacyRule({
|
|
6944
8004
|
baseDir,
|
|
@@ -6952,8 +8012,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
6952
8012
|
if (!paths.nonRoot) {
|
|
6953
8013
|
throw new Error("nonRoot path is not set");
|
|
6954
8014
|
}
|
|
6955
|
-
const relativePath = (0,
|
|
6956
|
-
const fileContent = await readFileContent((0,
|
|
8015
|
+
const relativePath = (0, import_node_path71.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8016
|
+
const fileContent = await readFileContent((0, import_node_path71.join)(baseDir, relativePath));
|
|
6957
8017
|
return new _ClaudecodeLegacyRule({
|
|
6958
8018
|
baseDir,
|
|
6959
8019
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -6986,6 +8046,23 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
6986
8046
|
validate() {
|
|
6987
8047
|
return { success: true, error: null };
|
|
6988
8048
|
}
|
|
8049
|
+
static forDeletion({
|
|
8050
|
+
baseDir = process.cwd(),
|
|
8051
|
+
relativeDirPath,
|
|
8052
|
+
relativeFilePath,
|
|
8053
|
+
global = false
|
|
8054
|
+
}) {
|
|
8055
|
+
const paths = this.getSettablePaths({ global });
|
|
8056
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
8057
|
+
return new _ClaudecodeLegacyRule({
|
|
8058
|
+
baseDir,
|
|
8059
|
+
relativeDirPath,
|
|
8060
|
+
relativeFilePath,
|
|
8061
|
+
fileContent: "",
|
|
8062
|
+
validate: false,
|
|
8063
|
+
root: isRoot
|
|
8064
|
+
});
|
|
8065
|
+
}
|
|
6989
8066
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
6990
8067
|
return this.isTargetedByRulesyncRuleDefault({
|
|
6991
8068
|
rulesyncRule,
|
|
@@ -6995,10 +8072,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
6995
8072
|
};
|
|
6996
8073
|
|
|
6997
8074
|
// src/features/rules/claudecode-rule.ts
|
|
6998
|
-
var
|
|
6999
|
-
var
|
|
7000
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
7001
|
-
paths:
|
|
8075
|
+
var import_node_path72 = require("path");
|
|
8076
|
+
var import_mini32 = require("zod/mini");
|
|
8077
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini32.z.object({
|
|
8078
|
+
paths: import_mini32.z.optional(import_mini32.z.string())
|
|
7002
8079
|
});
|
|
7003
8080
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
7004
8081
|
frontmatter;
|
|
@@ -7020,7 +8097,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
7020
8097
|
relativeFilePath: "CLAUDE.md"
|
|
7021
8098
|
},
|
|
7022
8099
|
nonRoot: {
|
|
7023
|
-
relativeDirPath: (0,
|
|
8100
|
+
relativeDirPath: (0, import_node_path72.join)(".claude", "rules")
|
|
7024
8101
|
}
|
|
7025
8102
|
};
|
|
7026
8103
|
}
|
|
@@ -7029,7 +8106,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
7029
8106
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7030
8107
|
if (!result.success) {
|
|
7031
8108
|
throw new Error(
|
|
7032
|
-
`Invalid frontmatter in ${(0,
|
|
8109
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7033
8110
|
);
|
|
7034
8111
|
}
|
|
7035
8112
|
}
|
|
@@ -7057,7 +8134,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
7057
8134
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
7058
8135
|
if (isRoot) {
|
|
7059
8136
|
const fileContent2 = await readFileContent(
|
|
7060
|
-
(0,
|
|
8137
|
+
(0, import_node_path72.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
7061
8138
|
);
|
|
7062
8139
|
return new _ClaudecodeRule({
|
|
7063
8140
|
baseDir,
|
|
@@ -7072,13 +8149,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
7072
8149
|
if (!paths.nonRoot) {
|
|
7073
8150
|
throw new Error("nonRoot path is not set");
|
|
7074
8151
|
}
|
|
7075
|
-
const relativePath = (0,
|
|
7076
|
-
const fileContent = await readFileContent((0,
|
|
8152
|
+
const relativePath = (0, import_node_path72.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8153
|
+
const fileContent = await readFileContent((0, import_node_path72.join)(baseDir, relativePath));
|
|
7077
8154
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7078
8155
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7079
8156
|
if (!result.success) {
|
|
7080
8157
|
throw new Error(
|
|
7081
|
-
`Invalid frontmatter in ${(0,
|
|
8158
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
7082
8159
|
);
|
|
7083
8160
|
}
|
|
7084
8161
|
return new _ClaudecodeRule({
|
|
@@ -7091,6 +8168,24 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
7091
8168
|
root: false
|
|
7092
8169
|
});
|
|
7093
8170
|
}
|
|
8171
|
+
static forDeletion({
|
|
8172
|
+
baseDir = process.cwd(),
|
|
8173
|
+
relativeDirPath,
|
|
8174
|
+
relativeFilePath,
|
|
8175
|
+
global = false
|
|
8176
|
+
}) {
|
|
8177
|
+
const paths = this.getSettablePaths({ global });
|
|
8178
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
8179
|
+
return new _ClaudecodeRule({
|
|
8180
|
+
baseDir,
|
|
8181
|
+
relativeDirPath,
|
|
8182
|
+
relativeFilePath,
|
|
8183
|
+
frontmatter: {},
|
|
8184
|
+
body: "",
|
|
8185
|
+
validate: false,
|
|
8186
|
+
root: isRoot
|
|
8187
|
+
});
|
|
8188
|
+
}
|
|
7094
8189
|
static fromRulesyncRule({
|
|
7095
8190
|
baseDir = process.cwd(),
|
|
7096
8191
|
rulesyncRule,
|
|
@@ -7167,7 +8262,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
7167
8262
|
return {
|
|
7168
8263
|
success: false,
|
|
7169
8264
|
error: new Error(
|
|
7170
|
-
`Invalid frontmatter in ${(0,
|
|
8265
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7171
8266
|
)
|
|
7172
8267
|
};
|
|
7173
8268
|
}
|
|
@@ -7187,10 +8282,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
7187
8282
|
};
|
|
7188
8283
|
|
|
7189
8284
|
// src/features/rules/cline-rule.ts
|
|
7190
|
-
var
|
|
7191
|
-
var
|
|
7192
|
-
var ClineRuleFrontmatterSchema =
|
|
7193
|
-
description:
|
|
8285
|
+
var import_node_path73 = require("path");
|
|
8286
|
+
var import_mini33 = require("zod/mini");
|
|
8287
|
+
var ClineRuleFrontmatterSchema = import_mini33.z.object({
|
|
8288
|
+
description: import_mini33.z.string()
|
|
7194
8289
|
});
|
|
7195
8290
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
7196
8291
|
static getSettablePaths() {
|
|
@@ -7232,7 +8327,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
7232
8327
|
validate = true
|
|
7233
8328
|
}) {
|
|
7234
8329
|
const fileContent = await readFileContent(
|
|
7235
|
-
(0,
|
|
8330
|
+
(0, import_node_path73.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7236
8331
|
);
|
|
7237
8332
|
return new _ClineRule({
|
|
7238
8333
|
baseDir,
|
|
@@ -7242,10 +8337,23 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
7242
8337
|
validate
|
|
7243
8338
|
});
|
|
7244
8339
|
}
|
|
8340
|
+
static forDeletion({
|
|
8341
|
+
baseDir = process.cwd(),
|
|
8342
|
+
relativeDirPath,
|
|
8343
|
+
relativeFilePath
|
|
8344
|
+
}) {
|
|
8345
|
+
return new _ClineRule({
|
|
8346
|
+
baseDir,
|
|
8347
|
+
relativeDirPath,
|
|
8348
|
+
relativeFilePath,
|
|
8349
|
+
fileContent: "",
|
|
8350
|
+
validate: false
|
|
8351
|
+
});
|
|
8352
|
+
}
|
|
7245
8353
|
};
|
|
7246
8354
|
|
|
7247
8355
|
// src/features/rules/codexcli-rule.ts
|
|
7248
|
-
var
|
|
8356
|
+
var import_node_path74 = require("path");
|
|
7249
8357
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
7250
8358
|
static getSettablePaths({
|
|
7251
8359
|
global
|
|
@@ -7264,7 +8372,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
7264
8372
|
relativeFilePath: "AGENTS.md"
|
|
7265
8373
|
},
|
|
7266
8374
|
nonRoot: {
|
|
7267
|
-
relativeDirPath: (0,
|
|
8375
|
+
relativeDirPath: (0, import_node_path74.join)(".codex", "memories")
|
|
7268
8376
|
}
|
|
7269
8377
|
};
|
|
7270
8378
|
}
|
|
@@ -7279,7 +8387,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
7279
8387
|
if (isRoot) {
|
|
7280
8388
|
const relativePath2 = paths.root.relativeFilePath;
|
|
7281
8389
|
const fileContent2 = await readFileContent(
|
|
7282
|
-
(0,
|
|
8390
|
+
(0, import_node_path74.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
7283
8391
|
);
|
|
7284
8392
|
return new _CodexcliRule({
|
|
7285
8393
|
baseDir,
|
|
@@ -7293,8 +8401,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
7293
8401
|
if (!paths.nonRoot) {
|
|
7294
8402
|
throw new Error("nonRoot path is not set");
|
|
7295
8403
|
}
|
|
7296
|
-
const relativePath = (0,
|
|
7297
|
-
const fileContent = await readFileContent((0,
|
|
8404
|
+
const relativePath = (0, import_node_path74.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8405
|
+
const fileContent = await readFileContent((0, import_node_path74.join)(baseDir, relativePath));
|
|
7298
8406
|
return new _CodexcliRule({
|
|
7299
8407
|
baseDir,
|
|
7300
8408
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -7327,6 +8435,23 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
7327
8435
|
validate() {
|
|
7328
8436
|
return { success: true, error: null };
|
|
7329
8437
|
}
|
|
8438
|
+
static forDeletion({
|
|
8439
|
+
baseDir = process.cwd(),
|
|
8440
|
+
relativeDirPath,
|
|
8441
|
+
relativeFilePath,
|
|
8442
|
+
global = false
|
|
8443
|
+
}) {
|
|
8444
|
+
const paths = this.getSettablePaths({ global });
|
|
8445
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
8446
|
+
return new _CodexcliRule({
|
|
8447
|
+
baseDir,
|
|
8448
|
+
relativeDirPath,
|
|
8449
|
+
relativeFilePath,
|
|
8450
|
+
fileContent: "",
|
|
8451
|
+
validate: false,
|
|
8452
|
+
root: isRoot
|
|
8453
|
+
});
|
|
8454
|
+
}
|
|
7330
8455
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
7331
8456
|
return this.isTargetedByRulesyncRuleDefault({
|
|
7332
8457
|
rulesyncRule,
|
|
@@ -7336,12 +8461,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
7336
8461
|
};
|
|
7337
8462
|
|
|
7338
8463
|
// src/features/rules/copilot-rule.ts
|
|
7339
|
-
var
|
|
7340
|
-
var
|
|
7341
|
-
var CopilotRuleFrontmatterSchema =
|
|
7342
|
-
description:
|
|
7343
|
-
applyTo:
|
|
7344
|
-
excludeAgent:
|
|
8464
|
+
var import_node_path75 = require("path");
|
|
8465
|
+
var import_mini34 = require("zod/mini");
|
|
8466
|
+
var CopilotRuleFrontmatterSchema = import_mini34.z.object({
|
|
8467
|
+
description: import_mini34.z.optional(import_mini34.z.string()),
|
|
8468
|
+
applyTo: import_mini34.z.optional(import_mini34.z.string()),
|
|
8469
|
+
excludeAgent: import_mini34.z.optional(import_mini34.z.union([import_mini34.z.literal("code-review"), import_mini34.z.literal("coding-agent")]))
|
|
7345
8470
|
});
|
|
7346
8471
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
7347
8472
|
frontmatter;
|
|
@@ -7353,7 +8478,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
7353
8478
|
relativeFilePath: "copilot-instructions.md"
|
|
7354
8479
|
},
|
|
7355
8480
|
nonRoot: {
|
|
7356
|
-
relativeDirPath: (0,
|
|
8481
|
+
relativeDirPath: (0, import_node_path75.join)(".github", "instructions")
|
|
7357
8482
|
}
|
|
7358
8483
|
};
|
|
7359
8484
|
}
|
|
@@ -7362,7 +8487,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
7362
8487
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7363
8488
|
if (!result.success) {
|
|
7364
8489
|
throw new Error(
|
|
7365
|
-
`Invalid frontmatter in ${(0,
|
|
8490
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7366
8491
|
);
|
|
7367
8492
|
}
|
|
7368
8493
|
}
|
|
@@ -7444,11 +8569,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
7444
8569
|
validate = true
|
|
7445
8570
|
}) {
|
|
7446
8571
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
7447
|
-
const relativePath = isRoot ? (0,
|
|
8572
|
+
const relativePath = isRoot ? (0, import_node_path75.join)(
|
|
7448
8573
|
this.getSettablePaths().root.relativeDirPath,
|
|
7449
8574
|
this.getSettablePaths().root.relativeFilePath
|
|
7450
|
-
) : (0,
|
|
7451
|
-
const fileContent = await readFileContent((0,
|
|
8575
|
+
) : (0, import_node_path75.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
8576
|
+
const fileContent = await readFileContent((0, import_node_path75.join)(baseDir, relativePath));
|
|
7452
8577
|
if (isRoot) {
|
|
7453
8578
|
return new _CopilotRule({
|
|
7454
8579
|
baseDir,
|
|
@@ -7464,7 +8589,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
7464
8589
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7465
8590
|
if (!result.success) {
|
|
7466
8591
|
throw new Error(
|
|
7467
|
-
`Invalid frontmatter in ${(0,
|
|
8592
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
7468
8593
|
);
|
|
7469
8594
|
}
|
|
7470
8595
|
return new _CopilotRule({
|
|
@@ -7477,6 +8602,22 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
7477
8602
|
root: isRoot
|
|
7478
8603
|
});
|
|
7479
8604
|
}
|
|
8605
|
+
static forDeletion({
|
|
8606
|
+
baseDir = process.cwd(),
|
|
8607
|
+
relativeDirPath,
|
|
8608
|
+
relativeFilePath
|
|
8609
|
+
}) {
|
|
8610
|
+
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
8611
|
+
return new _CopilotRule({
|
|
8612
|
+
baseDir,
|
|
8613
|
+
relativeDirPath,
|
|
8614
|
+
relativeFilePath,
|
|
8615
|
+
frontmatter: {},
|
|
8616
|
+
body: "",
|
|
8617
|
+
validate: false,
|
|
8618
|
+
root: isRoot
|
|
8619
|
+
});
|
|
8620
|
+
}
|
|
7480
8621
|
validate() {
|
|
7481
8622
|
if (!this.frontmatter) {
|
|
7482
8623
|
return { success: true, error: null };
|
|
@@ -7488,7 +8629,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
7488
8629
|
return {
|
|
7489
8630
|
success: false,
|
|
7490
8631
|
error: new Error(
|
|
7491
|
-
`Invalid frontmatter in ${(0,
|
|
8632
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7492
8633
|
)
|
|
7493
8634
|
};
|
|
7494
8635
|
}
|
|
@@ -7508,12 +8649,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
7508
8649
|
};
|
|
7509
8650
|
|
|
7510
8651
|
// src/features/rules/cursor-rule.ts
|
|
7511
|
-
var
|
|
7512
|
-
var
|
|
7513
|
-
var CursorRuleFrontmatterSchema =
|
|
7514
|
-
description:
|
|
7515
|
-
globs:
|
|
7516
|
-
alwaysApply:
|
|
8652
|
+
var import_node_path76 = require("path");
|
|
8653
|
+
var import_mini35 = require("zod/mini");
|
|
8654
|
+
var CursorRuleFrontmatterSchema = import_mini35.z.object({
|
|
8655
|
+
description: import_mini35.z.optional(import_mini35.z.string()),
|
|
8656
|
+
globs: import_mini35.z.optional(import_mini35.z.string()),
|
|
8657
|
+
alwaysApply: import_mini35.z.optional(import_mini35.z.boolean())
|
|
7517
8658
|
});
|
|
7518
8659
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
7519
8660
|
frontmatter;
|
|
@@ -7521,7 +8662,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7521
8662
|
static getSettablePaths() {
|
|
7522
8663
|
return {
|
|
7523
8664
|
nonRoot: {
|
|
7524
|
-
relativeDirPath: (0,
|
|
8665
|
+
relativeDirPath: (0, import_node_path76.join)(".cursor", "rules")
|
|
7525
8666
|
}
|
|
7526
8667
|
};
|
|
7527
8668
|
}
|
|
@@ -7530,7 +8671,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7530
8671
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7531
8672
|
if (!result.success) {
|
|
7532
8673
|
throw new Error(
|
|
7533
|
-
`Invalid frontmatter in ${(0,
|
|
8674
|
+
`Invalid frontmatter in ${(0, import_node_path76.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7534
8675
|
);
|
|
7535
8676
|
}
|
|
7536
8677
|
}
|
|
@@ -7647,24 +8788,38 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7647
8788
|
validate = true
|
|
7648
8789
|
}) {
|
|
7649
8790
|
const fileContent = await readFileContent(
|
|
7650
|
-
(0,
|
|
8791
|
+
(0, import_node_path76.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7651
8792
|
);
|
|
7652
8793
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
7653
8794
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7654
8795
|
if (!result.success) {
|
|
7655
8796
|
throw new Error(
|
|
7656
|
-
`Invalid frontmatter in ${(0,
|
|
8797
|
+
`Invalid frontmatter in ${(0, import_node_path76.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
7657
8798
|
);
|
|
7658
8799
|
}
|
|
7659
8800
|
return new _CursorRule({
|
|
7660
8801
|
baseDir,
|
|
7661
8802
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
7662
|
-
relativeFilePath: (0,
|
|
8803
|
+
relativeFilePath: (0, import_node_path76.basename)(relativeFilePath),
|
|
7663
8804
|
frontmatter: result.data,
|
|
7664
8805
|
body: content.trim(),
|
|
7665
8806
|
validate
|
|
7666
8807
|
});
|
|
7667
8808
|
}
|
|
8809
|
+
static forDeletion({
|
|
8810
|
+
baseDir = process.cwd(),
|
|
8811
|
+
relativeDirPath,
|
|
8812
|
+
relativeFilePath
|
|
8813
|
+
}) {
|
|
8814
|
+
return new _CursorRule({
|
|
8815
|
+
baseDir,
|
|
8816
|
+
relativeDirPath,
|
|
8817
|
+
relativeFilePath,
|
|
8818
|
+
frontmatter: {},
|
|
8819
|
+
body: "",
|
|
8820
|
+
validate: false
|
|
8821
|
+
});
|
|
8822
|
+
}
|
|
7668
8823
|
validate() {
|
|
7669
8824
|
if (!this.frontmatter) {
|
|
7670
8825
|
return { success: true, error: null };
|
|
@@ -7676,7 +8831,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7676
8831
|
return {
|
|
7677
8832
|
success: false,
|
|
7678
8833
|
error: new Error(
|
|
7679
|
-
`Invalid frontmatter in ${(0,
|
|
8834
|
+
`Invalid frontmatter in ${(0, import_node_path76.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7680
8835
|
)
|
|
7681
8836
|
};
|
|
7682
8837
|
}
|
|
@@ -7696,7 +8851,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7696
8851
|
};
|
|
7697
8852
|
|
|
7698
8853
|
// src/features/rules/geminicli-rule.ts
|
|
7699
|
-
var
|
|
8854
|
+
var import_node_path77 = require("path");
|
|
7700
8855
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
7701
8856
|
static getSettablePaths({
|
|
7702
8857
|
global
|
|
@@ -7715,7 +8870,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7715
8870
|
relativeFilePath: "GEMINI.md"
|
|
7716
8871
|
},
|
|
7717
8872
|
nonRoot: {
|
|
7718
|
-
relativeDirPath: (0,
|
|
8873
|
+
relativeDirPath: (0, import_node_path77.join)(".gemini", "memories")
|
|
7719
8874
|
}
|
|
7720
8875
|
};
|
|
7721
8876
|
}
|
|
@@ -7730,7 +8885,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7730
8885
|
if (isRoot) {
|
|
7731
8886
|
const relativePath2 = paths.root.relativeFilePath;
|
|
7732
8887
|
const fileContent2 = await readFileContent(
|
|
7733
|
-
(0,
|
|
8888
|
+
(0, import_node_path77.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
7734
8889
|
);
|
|
7735
8890
|
return new _GeminiCliRule({
|
|
7736
8891
|
baseDir,
|
|
@@ -7744,8 +8899,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7744
8899
|
if (!paths.nonRoot) {
|
|
7745
8900
|
throw new Error("nonRoot path is not set");
|
|
7746
8901
|
}
|
|
7747
|
-
const relativePath = (0,
|
|
7748
|
-
const fileContent = await readFileContent((0,
|
|
8902
|
+
const relativePath = (0, import_node_path77.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8903
|
+
const fileContent = await readFileContent((0, import_node_path77.join)(baseDir, relativePath));
|
|
7749
8904
|
return new _GeminiCliRule({
|
|
7750
8905
|
baseDir,
|
|
7751
8906
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -7778,6 +8933,23 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7778
8933
|
validate() {
|
|
7779
8934
|
return { success: true, error: null };
|
|
7780
8935
|
}
|
|
8936
|
+
static forDeletion({
|
|
8937
|
+
baseDir = process.cwd(),
|
|
8938
|
+
relativeDirPath,
|
|
8939
|
+
relativeFilePath,
|
|
8940
|
+
global = false
|
|
8941
|
+
}) {
|
|
8942
|
+
const paths = this.getSettablePaths({ global });
|
|
8943
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
8944
|
+
return new _GeminiCliRule({
|
|
8945
|
+
baseDir,
|
|
8946
|
+
relativeDirPath,
|
|
8947
|
+
relativeFilePath,
|
|
8948
|
+
fileContent: "",
|
|
8949
|
+
validate: false,
|
|
8950
|
+
root: isRoot
|
|
8951
|
+
});
|
|
8952
|
+
}
|
|
7781
8953
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
7782
8954
|
return this.isTargetedByRulesyncRuleDefault({
|
|
7783
8955
|
rulesyncRule,
|
|
@@ -7787,7 +8959,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7787
8959
|
};
|
|
7788
8960
|
|
|
7789
8961
|
// src/features/rules/junie-rule.ts
|
|
7790
|
-
var
|
|
8962
|
+
var import_node_path78 = require("path");
|
|
7791
8963
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
7792
8964
|
static getSettablePaths() {
|
|
7793
8965
|
return {
|
|
@@ -7796,7 +8968,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7796
8968
|
relativeFilePath: "guidelines.md"
|
|
7797
8969
|
},
|
|
7798
8970
|
nonRoot: {
|
|
7799
|
-
relativeDirPath: (0,
|
|
8971
|
+
relativeDirPath: (0, import_node_path78.join)(".junie", "memories")
|
|
7800
8972
|
}
|
|
7801
8973
|
};
|
|
7802
8974
|
}
|
|
@@ -7806,8 +8978,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7806
8978
|
validate = true
|
|
7807
8979
|
}) {
|
|
7808
8980
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
7809
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
7810
|
-
const fileContent = await readFileContent((0,
|
|
8981
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path78.join)(".junie", "memories", relativeFilePath);
|
|
8982
|
+
const fileContent = await readFileContent((0, import_node_path78.join)(baseDir, relativePath));
|
|
7811
8983
|
return new _JunieRule({
|
|
7812
8984
|
baseDir,
|
|
7813
8985
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7838,6 +9010,21 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7838
9010
|
validate() {
|
|
7839
9011
|
return { success: true, error: null };
|
|
7840
9012
|
}
|
|
9013
|
+
static forDeletion({
|
|
9014
|
+
baseDir = process.cwd(),
|
|
9015
|
+
relativeDirPath,
|
|
9016
|
+
relativeFilePath
|
|
9017
|
+
}) {
|
|
9018
|
+
const isRoot = relativeFilePath === "guidelines.md";
|
|
9019
|
+
return new _JunieRule({
|
|
9020
|
+
baseDir,
|
|
9021
|
+
relativeDirPath,
|
|
9022
|
+
relativeFilePath,
|
|
9023
|
+
fileContent: "",
|
|
9024
|
+
validate: false,
|
|
9025
|
+
root: isRoot
|
|
9026
|
+
});
|
|
9027
|
+
}
|
|
7841
9028
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
7842
9029
|
return this.isTargetedByRulesyncRuleDefault({
|
|
7843
9030
|
rulesyncRule,
|
|
@@ -7847,12 +9034,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7847
9034
|
};
|
|
7848
9035
|
|
|
7849
9036
|
// src/features/rules/kiro-rule.ts
|
|
7850
|
-
var
|
|
9037
|
+
var import_node_path79 = require("path");
|
|
7851
9038
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
7852
9039
|
static getSettablePaths() {
|
|
7853
9040
|
return {
|
|
7854
9041
|
nonRoot: {
|
|
7855
|
-
relativeDirPath: (0,
|
|
9042
|
+
relativeDirPath: (0, import_node_path79.join)(".kiro", "steering")
|
|
7856
9043
|
}
|
|
7857
9044
|
};
|
|
7858
9045
|
}
|
|
@@ -7862,7 +9049,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
7862
9049
|
validate = true
|
|
7863
9050
|
}) {
|
|
7864
9051
|
const fileContent = await readFileContent(
|
|
7865
|
-
(0,
|
|
9052
|
+
(0, import_node_path79.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7866
9053
|
);
|
|
7867
9054
|
return new _KiroRule({
|
|
7868
9055
|
baseDir,
|
|
@@ -7893,6 +9080,20 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
7893
9080
|
validate() {
|
|
7894
9081
|
return { success: true, error: null };
|
|
7895
9082
|
}
|
|
9083
|
+
static forDeletion({
|
|
9084
|
+
baseDir = process.cwd(),
|
|
9085
|
+
relativeDirPath,
|
|
9086
|
+
relativeFilePath
|
|
9087
|
+
}) {
|
|
9088
|
+
return new _KiroRule({
|
|
9089
|
+
baseDir,
|
|
9090
|
+
relativeDirPath,
|
|
9091
|
+
relativeFilePath,
|
|
9092
|
+
fileContent: "",
|
|
9093
|
+
validate: false,
|
|
9094
|
+
root: false
|
|
9095
|
+
});
|
|
9096
|
+
}
|
|
7896
9097
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
7897
9098
|
return this.isTargetedByRulesyncRuleDefault({
|
|
7898
9099
|
rulesyncRule,
|
|
@@ -7902,7 +9103,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
7902
9103
|
};
|
|
7903
9104
|
|
|
7904
9105
|
// src/features/rules/opencode-rule.ts
|
|
7905
|
-
var
|
|
9106
|
+
var import_node_path80 = require("path");
|
|
7906
9107
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
7907
9108
|
static getSettablePaths() {
|
|
7908
9109
|
return {
|
|
@@ -7911,7 +9112,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7911
9112
|
relativeFilePath: "AGENTS.md"
|
|
7912
9113
|
},
|
|
7913
9114
|
nonRoot: {
|
|
7914
|
-
relativeDirPath: (0,
|
|
9115
|
+
relativeDirPath: (0, import_node_path80.join)(".opencode", "memories")
|
|
7915
9116
|
}
|
|
7916
9117
|
};
|
|
7917
9118
|
}
|
|
@@ -7921,8 +9122,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7921
9122
|
validate = true
|
|
7922
9123
|
}) {
|
|
7923
9124
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
7924
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
7925
|
-
const fileContent = await readFileContent((0,
|
|
9125
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path80.join)(".opencode", "memories", relativeFilePath);
|
|
9126
|
+
const fileContent = await readFileContent((0, import_node_path80.join)(baseDir, relativePath));
|
|
7926
9127
|
return new _OpenCodeRule({
|
|
7927
9128
|
baseDir,
|
|
7928
9129
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7953,6 +9154,21 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7953
9154
|
validate() {
|
|
7954
9155
|
return { success: true, error: null };
|
|
7955
9156
|
}
|
|
9157
|
+
static forDeletion({
|
|
9158
|
+
baseDir = process.cwd(),
|
|
9159
|
+
relativeDirPath,
|
|
9160
|
+
relativeFilePath
|
|
9161
|
+
}) {
|
|
9162
|
+
const isRoot = relativeFilePath === "AGENTS.md" && relativeDirPath === ".";
|
|
9163
|
+
return new _OpenCodeRule({
|
|
9164
|
+
baseDir,
|
|
9165
|
+
relativeDirPath,
|
|
9166
|
+
relativeFilePath,
|
|
9167
|
+
fileContent: "",
|
|
9168
|
+
validate: false,
|
|
9169
|
+
root: isRoot
|
|
9170
|
+
});
|
|
9171
|
+
}
|
|
7956
9172
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
7957
9173
|
return this.isTargetedByRulesyncRuleDefault({
|
|
7958
9174
|
rulesyncRule,
|
|
@@ -7962,7 +9178,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7962
9178
|
};
|
|
7963
9179
|
|
|
7964
9180
|
// src/features/rules/qwencode-rule.ts
|
|
7965
|
-
var
|
|
9181
|
+
var import_node_path81 = require("path");
|
|
7966
9182
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
7967
9183
|
static getSettablePaths() {
|
|
7968
9184
|
return {
|
|
@@ -7971,7 +9187,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7971
9187
|
relativeFilePath: "QWEN.md"
|
|
7972
9188
|
},
|
|
7973
9189
|
nonRoot: {
|
|
7974
|
-
relativeDirPath: (0,
|
|
9190
|
+
relativeDirPath: (0, import_node_path81.join)(".qwen", "memories")
|
|
7975
9191
|
}
|
|
7976
9192
|
};
|
|
7977
9193
|
}
|
|
@@ -7981,8 +9197,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7981
9197
|
validate = true
|
|
7982
9198
|
}) {
|
|
7983
9199
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
7984
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
7985
|
-
const fileContent = await readFileContent((0,
|
|
9200
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path81.join)(".qwen", "memories", relativeFilePath);
|
|
9201
|
+
const fileContent = await readFileContent((0, import_node_path81.join)(baseDir, relativePath));
|
|
7986
9202
|
return new _QwencodeRule({
|
|
7987
9203
|
baseDir,
|
|
7988
9204
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -8010,6 +9226,21 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
8010
9226
|
validate() {
|
|
8011
9227
|
return { success: true, error: null };
|
|
8012
9228
|
}
|
|
9229
|
+
static forDeletion({
|
|
9230
|
+
baseDir = process.cwd(),
|
|
9231
|
+
relativeDirPath,
|
|
9232
|
+
relativeFilePath
|
|
9233
|
+
}) {
|
|
9234
|
+
const isRoot = relativeFilePath === "QWEN.md" && relativeDirPath === ".";
|
|
9235
|
+
return new _QwencodeRule({
|
|
9236
|
+
baseDir,
|
|
9237
|
+
relativeDirPath,
|
|
9238
|
+
relativeFilePath,
|
|
9239
|
+
fileContent: "",
|
|
9240
|
+
validate: false,
|
|
9241
|
+
root: isRoot
|
|
9242
|
+
});
|
|
9243
|
+
}
|
|
8013
9244
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
8014
9245
|
return this.isTargetedByRulesyncRuleDefault({
|
|
8015
9246
|
rulesyncRule,
|
|
@@ -8019,12 +9250,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
8019
9250
|
};
|
|
8020
9251
|
|
|
8021
9252
|
// src/features/rules/roo-rule.ts
|
|
8022
|
-
var
|
|
9253
|
+
var import_node_path82 = require("path");
|
|
8023
9254
|
var RooRule = class _RooRule extends ToolRule {
|
|
8024
9255
|
static getSettablePaths() {
|
|
8025
9256
|
return {
|
|
8026
9257
|
nonRoot: {
|
|
8027
|
-
relativeDirPath: (0,
|
|
9258
|
+
relativeDirPath: (0, import_node_path82.join)(".roo", "rules")
|
|
8028
9259
|
}
|
|
8029
9260
|
};
|
|
8030
9261
|
}
|
|
@@ -8034,7 +9265,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
8034
9265
|
validate = true
|
|
8035
9266
|
}) {
|
|
8036
9267
|
const fileContent = await readFileContent(
|
|
8037
|
-
(0,
|
|
9268
|
+
(0, import_node_path82.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8038
9269
|
);
|
|
8039
9270
|
return new _RooRule({
|
|
8040
9271
|
baseDir,
|
|
@@ -8080,6 +9311,20 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
8080
9311
|
validate() {
|
|
8081
9312
|
return { success: true, error: null };
|
|
8082
9313
|
}
|
|
9314
|
+
static forDeletion({
|
|
9315
|
+
baseDir = process.cwd(),
|
|
9316
|
+
relativeDirPath,
|
|
9317
|
+
relativeFilePath
|
|
9318
|
+
}) {
|
|
9319
|
+
return new _RooRule({
|
|
9320
|
+
baseDir,
|
|
9321
|
+
relativeDirPath,
|
|
9322
|
+
relativeFilePath,
|
|
9323
|
+
fileContent: "",
|
|
9324
|
+
validate: false,
|
|
9325
|
+
root: false
|
|
9326
|
+
});
|
|
9327
|
+
}
|
|
8083
9328
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
8084
9329
|
return this.isTargetedByRulesyncRuleDefault({
|
|
8085
9330
|
rulesyncRule,
|
|
@@ -8089,7 +9334,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
8089
9334
|
};
|
|
8090
9335
|
|
|
8091
9336
|
// src/features/rules/warp-rule.ts
|
|
8092
|
-
var
|
|
9337
|
+
var import_node_path83 = require("path");
|
|
8093
9338
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
8094
9339
|
constructor({ fileContent, root, ...rest }) {
|
|
8095
9340
|
super({
|
|
@@ -8105,7 +9350,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
8105
9350
|
relativeFilePath: "WARP.md"
|
|
8106
9351
|
},
|
|
8107
9352
|
nonRoot: {
|
|
8108
|
-
relativeDirPath: (0,
|
|
9353
|
+
relativeDirPath: (0, import_node_path83.join)(".warp", "memories")
|
|
8109
9354
|
}
|
|
8110
9355
|
};
|
|
8111
9356
|
}
|
|
@@ -8115,8 +9360,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
8115
9360
|
validate = true
|
|
8116
9361
|
}) {
|
|
8117
9362
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
8118
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
8119
|
-
const fileContent = await readFileContent((0,
|
|
9363
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path83.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
9364
|
+
const fileContent = await readFileContent((0, import_node_path83.join)(baseDir, relativePath));
|
|
8120
9365
|
return new _WarpRule({
|
|
8121
9366
|
baseDir,
|
|
8122
9367
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -8147,6 +9392,21 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
8147
9392
|
validate() {
|
|
8148
9393
|
return { success: true, error: null };
|
|
8149
9394
|
}
|
|
9395
|
+
static forDeletion({
|
|
9396
|
+
baseDir = process.cwd(),
|
|
9397
|
+
relativeDirPath,
|
|
9398
|
+
relativeFilePath
|
|
9399
|
+
}) {
|
|
9400
|
+
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
9401
|
+
return new _WarpRule({
|
|
9402
|
+
baseDir,
|
|
9403
|
+
relativeDirPath,
|
|
9404
|
+
relativeFilePath,
|
|
9405
|
+
fileContent: "",
|
|
9406
|
+
validate: false,
|
|
9407
|
+
root: isRoot
|
|
9408
|
+
});
|
|
9409
|
+
}
|
|
8150
9410
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
8151
9411
|
return this.isTargetedByRulesyncRuleDefault({
|
|
8152
9412
|
rulesyncRule,
|
|
@@ -8156,12 +9416,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
8156
9416
|
};
|
|
8157
9417
|
|
|
8158
9418
|
// src/features/rules/windsurf-rule.ts
|
|
8159
|
-
var
|
|
9419
|
+
var import_node_path84 = require("path");
|
|
8160
9420
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
8161
9421
|
static getSettablePaths() {
|
|
8162
9422
|
return {
|
|
8163
9423
|
nonRoot: {
|
|
8164
|
-
relativeDirPath: (0,
|
|
9424
|
+
relativeDirPath: (0, import_node_path84.join)(".windsurf", "rules")
|
|
8165
9425
|
}
|
|
8166
9426
|
};
|
|
8167
9427
|
}
|
|
@@ -8171,7 +9431,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
8171
9431
|
validate = true
|
|
8172
9432
|
}) {
|
|
8173
9433
|
const fileContent = await readFileContent(
|
|
8174
|
-
(0,
|
|
9434
|
+
(0, import_node_path84.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8175
9435
|
);
|
|
8176
9436
|
return new _WindsurfRule({
|
|
8177
9437
|
baseDir,
|
|
@@ -8201,6 +9461,19 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
8201
9461
|
validate() {
|
|
8202
9462
|
return { success: true, error: null };
|
|
8203
9463
|
}
|
|
9464
|
+
static forDeletion({
|
|
9465
|
+
baseDir = process.cwd(),
|
|
9466
|
+
relativeDirPath,
|
|
9467
|
+
relativeFilePath
|
|
9468
|
+
}) {
|
|
9469
|
+
return new _WindsurfRule({
|
|
9470
|
+
baseDir,
|
|
9471
|
+
relativeDirPath,
|
|
9472
|
+
relativeFilePath,
|
|
9473
|
+
fileContent: "",
|
|
9474
|
+
validate: false
|
|
9475
|
+
});
|
|
9476
|
+
}
|
|
8204
9477
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
8205
9478
|
return this.isTargetedByRulesyncRuleDefault({
|
|
8206
9479
|
rulesyncRule,
|
|
@@ -8231,7 +9504,7 @@ var rulesProcessorToolTargets = [
|
|
|
8231
9504
|
"warp",
|
|
8232
9505
|
"windsurf"
|
|
8233
9506
|
];
|
|
8234
|
-
var RulesProcessorToolTargetSchema =
|
|
9507
|
+
var RulesProcessorToolTargetSchema = import_mini36.z.enum(rulesProcessorToolTargets);
|
|
8235
9508
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
8236
9509
|
[
|
|
8237
9510
|
"agentsmd",
|
|
@@ -8307,8 +9580,7 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
8307
9580
|
supportsGlobal: true,
|
|
8308
9581
|
ruleDiscoveryMode: "toon",
|
|
8309
9582
|
additionalConventions: {
|
|
8310
|
-
subagents: { subagentClass: CodexCliSubagent }
|
|
8311
|
-
skills: { skillClass: CodexCliSkill, globalOnly: true }
|
|
9583
|
+
subagents: { subagentClass: CodexCliSubagent }
|
|
8312
9584
|
}
|
|
8313
9585
|
}
|
|
8314
9586
|
}
|
|
@@ -8322,9 +9594,7 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
8322
9594
|
supportsGlobal: false,
|
|
8323
9595
|
ruleDiscoveryMode: "auto",
|
|
8324
9596
|
additionalConventions: {
|
|
8325
|
-
|
|
8326
|
-
subagents: { subagentClass: CopilotSubagent },
|
|
8327
|
-
skills: { skillClass: CopilotSkill }
|
|
9597
|
+
subagents: { subagentClass: CopilotSubagent }
|
|
8328
9598
|
}
|
|
8329
9599
|
}
|
|
8330
9600
|
}
|
|
@@ -8338,7 +9608,6 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
8338
9608
|
supportsGlobal: false,
|
|
8339
9609
|
ruleDiscoveryMode: "auto",
|
|
8340
9610
|
additionalConventions: {
|
|
8341
|
-
commands: { commandClass: CursorCommand },
|
|
8342
9611
|
subagents: { subagentClass: CursorSubagent },
|
|
8343
9612
|
skills: { skillClass: CursorSkill }
|
|
8344
9613
|
},
|
|
@@ -8355,7 +9624,6 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
8355
9624
|
supportsGlobal: true,
|
|
8356
9625
|
ruleDiscoveryMode: "toon",
|
|
8357
9626
|
additionalConventions: {
|
|
8358
|
-
commands: { commandClass: GeminiCliCommand },
|
|
8359
9627
|
subagents: { subagentClass: GeminiCliSubagent },
|
|
8360
9628
|
skills: { skillClass: GeminiCliSkill }
|
|
8361
9629
|
}
|
|
@@ -8399,7 +9667,6 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
8399
9667
|
supportsGlobal: false,
|
|
8400
9668
|
ruleDiscoveryMode: "auto",
|
|
8401
9669
|
additionalConventions: {
|
|
8402
|
-
commands: { commandClass: RooCommand },
|
|
8403
9670
|
subagents: { subagentClass: RooSubagent }
|
|
8404
9671
|
},
|
|
8405
9672
|
createsSeparateConventionsRule: true
|
|
@@ -8525,7 +9792,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
8525
9792
|
}).relativeDirPath;
|
|
8526
9793
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
8527
9794
|
const frontmatter = skill.getFrontmatter();
|
|
8528
|
-
const relativePath = (0,
|
|
9795
|
+
const relativePath = (0, import_node_path85.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
8529
9796
|
return {
|
|
8530
9797
|
name: frontmatter.name,
|
|
8531
9798
|
description: frontmatter.description,
|
|
@@ -8592,10 +9859,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
8592
9859
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
8593
9860
|
*/
|
|
8594
9861
|
async loadRulesyncFiles() {
|
|
8595
|
-
const files = await findFilesByGlobs((0,
|
|
9862
|
+
const files = await findFilesByGlobs((0, import_node_path85.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
8596
9863
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
8597
9864
|
const rulesyncRules = await Promise.all(
|
|
8598
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0,
|
|
9865
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path85.basename)(file) }))
|
|
8599
9866
|
);
|
|
8600
9867
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
8601
9868
|
if (rootRules.length > 1) {
|
|
@@ -8612,12 +9879,19 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
8612
9879
|
}
|
|
8613
9880
|
return rulesyncRules;
|
|
8614
9881
|
}
|
|
9882
|
+
async loadRulesyncFilesLegacy() {
|
|
9883
|
+
const legacyFiles = await findFilesByGlobs((0, import_node_path85.join)(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
9884
|
+
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
9885
|
+
return Promise.all(
|
|
9886
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path85.basename)(file) }))
|
|
9887
|
+
);
|
|
9888
|
+
}
|
|
8615
9889
|
/**
|
|
8616
9890
|
* Implementation of abstract method from FeatureProcessor
|
|
8617
9891
|
* Load tool-specific rule configurations and parse them into ToolRule instances
|
|
8618
9892
|
*/
|
|
8619
9893
|
async loadToolFiles({
|
|
8620
|
-
forDeletion
|
|
9894
|
+
forDeletion = false
|
|
8621
9895
|
} = {}) {
|
|
8622
9896
|
try {
|
|
8623
9897
|
const factory = this.getFactory(this.toolTarget);
|
|
@@ -8627,17 +9901,27 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
8627
9901
|
return [];
|
|
8628
9902
|
}
|
|
8629
9903
|
const rootFilePaths = await findFilesByGlobs(
|
|
8630
|
-
(0,
|
|
9904
|
+
(0, import_node_path85.join)(
|
|
8631
9905
|
this.baseDir,
|
|
8632
9906
|
settablePaths.root.relativeDirPath ?? ".",
|
|
8633
9907
|
settablePaths.root.relativeFilePath
|
|
8634
9908
|
)
|
|
8635
9909
|
);
|
|
9910
|
+
if (forDeletion) {
|
|
9911
|
+
return rootFilePaths.map(
|
|
9912
|
+
(filePath) => factory.class.forDeletion({
|
|
9913
|
+
baseDir: this.baseDir,
|
|
9914
|
+
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
9915
|
+
relativeFilePath: (0, import_node_path85.basename)(filePath),
|
|
9916
|
+
global: this.global
|
|
9917
|
+
})
|
|
9918
|
+
).filter((rule) => rule.isDeletable());
|
|
9919
|
+
}
|
|
8636
9920
|
return await Promise.all(
|
|
8637
9921
|
rootFilePaths.map(
|
|
8638
9922
|
(filePath) => factory.class.fromFile({
|
|
8639
9923
|
baseDir: this.baseDir,
|
|
8640
|
-
relativeFilePath: (0,
|
|
9924
|
+
relativeFilePath: (0, import_node_path85.basename)(filePath),
|
|
8641
9925
|
global: this.global
|
|
8642
9926
|
})
|
|
8643
9927
|
)
|
|
@@ -8649,13 +9933,23 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
8649
9933
|
return [];
|
|
8650
9934
|
}
|
|
8651
9935
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
8652
|
-
(0,
|
|
9936
|
+
(0, import_node_path85.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
8653
9937
|
);
|
|
9938
|
+
if (forDeletion) {
|
|
9939
|
+
return nonRootFilePaths.map(
|
|
9940
|
+
(filePath) => factory.class.forDeletion({
|
|
9941
|
+
baseDir: this.baseDir,
|
|
9942
|
+
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
9943
|
+
relativeFilePath: (0, import_node_path85.basename)(filePath),
|
|
9944
|
+
global: this.global
|
|
9945
|
+
})
|
|
9946
|
+
).filter((rule) => rule.isDeletable());
|
|
9947
|
+
}
|
|
8654
9948
|
return await Promise.all(
|
|
8655
9949
|
nonRootFilePaths.map(
|
|
8656
9950
|
(filePath) => factory.class.fromFile({
|
|
8657
9951
|
baseDir: this.baseDir,
|
|
8658
|
-
relativeFilePath: (0,
|
|
9952
|
+
relativeFilePath: (0, import_node_path85.basename)(filePath),
|
|
8659
9953
|
global: this.global
|
|
8660
9954
|
})
|
|
8661
9955
|
)
|
|
@@ -8748,14 +10042,14 @@ s/<command> [arguments]
|
|
|
8748
10042
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
8749
10043
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
8750
10044
|
|
|
8751
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
10045
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path85.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
8752
10046
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
8753
10047
|
|
|
8754
10048
|
Simulated subagents are specialized AI assistants that can be invoked to handle specific types of tasks. In this case, it can be appear something like custom slash commands simply. Simulated subagents can be called by custom slash commands.
|
|
8755
10049
|
|
|
8756
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
10050
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path85.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
8757
10051
|
|
|
8758
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
10052
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path85.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
8759
10053
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
8760
10054
|
const result = [
|
|
8761
10055
|
overview,
|
|
@@ -9037,7 +10331,7 @@ async function generateSkills(config) {
|
|
|
9037
10331
|
}
|
|
9038
10332
|
|
|
9039
10333
|
// src/cli/commands/gitignore.ts
|
|
9040
|
-
var
|
|
10334
|
+
var import_node_path86 = require("path");
|
|
9041
10335
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
9042
10336
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
9043
10337
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -9094,6 +10388,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
9094
10388
|
// OpenCode
|
|
9095
10389
|
"**/.opencode/memories/",
|
|
9096
10390
|
"**/.opencode/command/",
|
|
10391
|
+
"**/.opencode/skills/",
|
|
9097
10392
|
"**/opencode.json",
|
|
9098
10393
|
// Qwen
|
|
9099
10394
|
"**/QWEN.md",
|
|
@@ -9160,7 +10455,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
9160
10455
|
return result;
|
|
9161
10456
|
};
|
|
9162
10457
|
var gitignoreCommand = async () => {
|
|
9163
|
-
const gitignorePath = (0,
|
|
10458
|
+
const gitignorePath = (0, import_node_path86.join)(process.cwd(), ".gitignore");
|
|
9164
10459
|
let gitignoreContent = "";
|
|
9165
10460
|
if (await fileExists(gitignorePath)) {
|
|
9166
10461
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -9359,7 +10654,7 @@ async function importSkills(config, tool) {
|
|
|
9359
10654
|
}
|
|
9360
10655
|
|
|
9361
10656
|
// src/cli/commands/init.ts
|
|
9362
|
-
var
|
|
10657
|
+
var import_node_path87 = require("path");
|
|
9363
10658
|
async function initCommand() {
|
|
9364
10659
|
logger.info("Initializing rulesync...");
|
|
9365
10660
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -9522,14 +10817,14 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
9522
10817
|
await ensureDir(commandPaths.relativeDirPath);
|
|
9523
10818
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
9524
10819
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
9525
|
-
const ruleFilepath = (0,
|
|
10820
|
+
const ruleFilepath = (0, import_node_path87.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
9526
10821
|
if (!await fileExists(ruleFilepath)) {
|
|
9527
10822
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
9528
10823
|
logger.success(`Created ${ruleFilepath}`);
|
|
9529
10824
|
} else {
|
|
9530
10825
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
9531
10826
|
}
|
|
9532
|
-
const mcpFilepath = (0,
|
|
10827
|
+
const mcpFilepath = (0, import_node_path87.join)(
|
|
9533
10828
|
mcpPaths.recommended.relativeDirPath,
|
|
9534
10829
|
mcpPaths.recommended.relativeFilePath
|
|
9535
10830
|
);
|
|
@@ -9539,21 +10834,21 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
9539
10834
|
} else {
|
|
9540
10835
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
9541
10836
|
}
|
|
9542
|
-
const commandFilepath = (0,
|
|
10837
|
+
const commandFilepath = (0, import_node_path87.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
9543
10838
|
if (!await fileExists(commandFilepath)) {
|
|
9544
10839
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
9545
10840
|
logger.success(`Created ${commandFilepath}`);
|
|
9546
10841
|
} else {
|
|
9547
10842
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
9548
10843
|
}
|
|
9549
|
-
const subagentFilepath = (0,
|
|
10844
|
+
const subagentFilepath = (0, import_node_path87.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
9550
10845
|
if (!await fileExists(subagentFilepath)) {
|
|
9551
10846
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
9552
10847
|
logger.success(`Created ${subagentFilepath}`);
|
|
9553
10848
|
} else {
|
|
9554
10849
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
9555
10850
|
}
|
|
9556
|
-
const ignoreFilepath = (0,
|
|
10851
|
+
const ignoreFilepath = (0, import_node_path87.join)(
|
|
9557
10852
|
ignorePaths.recommended.relativeDirPath,
|
|
9558
10853
|
ignorePaths.recommended.relativeFilePath
|
|
9559
10854
|
);
|
|
@@ -9569,12 +10864,12 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
9569
10864
|
var import_fastmcp = require("fastmcp");
|
|
9570
10865
|
|
|
9571
10866
|
// src/mcp/commands.ts
|
|
9572
|
-
var
|
|
9573
|
-
var
|
|
10867
|
+
var import_node_path88 = require("path");
|
|
10868
|
+
var import_mini37 = require("zod/mini");
|
|
9574
10869
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
9575
10870
|
var maxCommandsCount = 1e3;
|
|
9576
10871
|
async function listCommands() {
|
|
9577
|
-
const commandsDir = (0,
|
|
10872
|
+
const commandsDir = (0, import_node_path88.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
9578
10873
|
try {
|
|
9579
10874
|
const files = await listDirectoryFiles(commandsDir);
|
|
9580
10875
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -9586,7 +10881,7 @@ async function listCommands() {
|
|
|
9586
10881
|
});
|
|
9587
10882
|
const frontmatter = command.getFrontmatter();
|
|
9588
10883
|
return {
|
|
9589
|
-
relativePathFromCwd: (0,
|
|
10884
|
+
relativePathFromCwd: (0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
9590
10885
|
frontmatter
|
|
9591
10886
|
};
|
|
9592
10887
|
} catch (error) {
|
|
@@ -9606,13 +10901,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
9606
10901
|
relativePath: relativePathFromCwd,
|
|
9607
10902
|
intendedRootDir: process.cwd()
|
|
9608
10903
|
});
|
|
9609
|
-
const filename = (0,
|
|
10904
|
+
const filename = (0, import_node_path88.basename)(relativePathFromCwd);
|
|
9610
10905
|
try {
|
|
9611
10906
|
const command = await RulesyncCommand.fromFile({
|
|
9612
10907
|
relativeFilePath: filename
|
|
9613
10908
|
});
|
|
9614
10909
|
return {
|
|
9615
|
-
relativePathFromCwd: (0,
|
|
10910
|
+
relativePathFromCwd: (0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
9616
10911
|
frontmatter: command.getFrontmatter(),
|
|
9617
10912
|
body: command.getBody()
|
|
9618
10913
|
};
|
|
@@ -9631,7 +10926,7 @@ async function putCommand({
|
|
|
9631
10926
|
relativePath: relativePathFromCwd,
|
|
9632
10927
|
intendedRootDir: process.cwd()
|
|
9633
10928
|
});
|
|
9634
|
-
const filename = (0,
|
|
10929
|
+
const filename = (0, import_node_path88.basename)(relativePathFromCwd);
|
|
9635
10930
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
9636
10931
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
9637
10932
|
throw new Error(
|
|
@@ -9641,7 +10936,7 @@ async function putCommand({
|
|
|
9641
10936
|
try {
|
|
9642
10937
|
const existingCommands = await listCommands();
|
|
9643
10938
|
const isUpdate = existingCommands.some(
|
|
9644
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
10939
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
9645
10940
|
);
|
|
9646
10941
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
9647
10942
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -9656,11 +10951,11 @@ async function putCommand({
|
|
|
9656
10951
|
fileContent,
|
|
9657
10952
|
validate: true
|
|
9658
10953
|
});
|
|
9659
|
-
const commandsDir = (0,
|
|
10954
|
+
const commandsDir = (0, import_node_path88.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
9660
10955
|
await ensureDir(commandsDir);
|
|
9661
10956
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
9662
10957
|
return {
|
|
9663
|
-
relativePathFromCwd: (0,
|
|
10958
|
+
relativePathFromCwd: (0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
9664
10959
|
frontmatter: command.getFrontmatter(),
|
|
9665
10960
|
body: command.getBody()
|
|
9666
10961
|
};
|
|
@@ -9675,12 +10970,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
9675
10970
|
relativePath: relativePathFromCwd,
|
|
9676
10971
|
intendedRootDir: process.cwd()
|
|
9677
10972
|
});
|
|
9678
|
-
const filename = (0,
|
|
9679
|
-
const fullPath = (0,
|
|
10973
|
+
const filename = (0, import_node_path88.basename)(relativePathFromCwd);
|
|
10974
|
+
const fullPath = (0, import_node_path88.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
9680
10975
|
try {
|
|
9681
10976
|
await removeFile(fullPath);
|
|
9682
10977
|
return {
|
|
9683
|
-
relativePathFromCwd: (0,
|
|
10978
|
+
relativePathFromCwd: (0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
9684
10979
|
};
|
|
9685
10980
|
} catch (error) {
|
|
9686
10981
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -9689,23 +10984,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
9689
10984
|
}
|
|
9690
10985
|
}
|
|
9691
10986
|
var commandToolSchemas = {
|
|
9692
|
-
listCommands:
|
|
9693
|
-
getCommand:
|
|
9694
|
-
relativePathFromCwd:
|
|
10987
|
+
listCommands: import_mini37.z.object({}),
|
|
10988
|
+
getCommand: import_mini37.z.object({
|
|
10989
|
+
relativePathFromCwd: import_mini37.z.string()
|
|
9695
10990
|
}),
|
|
9696
|
-
putCommand:
|
|
9697
|
-
relativePathFromCwd:
|
|
10991
|
+
putCommand: import_mini37.z.object({
|
|
10992
|
+
relativePathFromCwd: import_mini37.z.string(),
|
|
9698
10993
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
9699
|
-
body:
|
|
10994
|
+
body: import_mini37.z.string()
|
|
9700
10995
|
}),
|
|
9701
|
-
deleteCommand:
|
|
9702
|
-
relativePathFromCwd:
|
|
10996
|
+
deleteCommand: import_mini37.z.object({
|
|
10997
|
+
relativePathFromCwd: import_mini37.z.string()
|
|
9703
10998
|
})
|
|
9704
10999
|
};
|
|
9705
11000
|
var commandTools = {
|
|
9706
11001
|
listCommands: {
|
|
9707
11002
|
name: "listCommands",
|
|
9708
|
-
description: `List all commands from ${(0,
|
|
11003
|
+
description: `List all commands from ${(0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
9709
11004
|
parameters: commandToolSchemas.listCommands,
|
|
9710
11005
|
execute: async () => {
|
|
9711
11006
|
const commands = await listCommands();
|
|
@@ -9747,11 +11042,11 @@ var commandTools = {
|
|
|
9747
11042
|
};
|
|
9748
11043
|
|
|
9749
11044
|
// src/mcp/ignore.ts
|
|
9750
|
-
var
|
|
9751
|
-
var
|
|
11045
|
+
var import_node_path89 = require("path");
|
|
11046
|
+
var import_mini38 = require("zod/mini");
|
|
9752
11047
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
9753
11048
|
async function getIgnoreFile() {
|
|
9754
|
-
const ignoreFilePath = (0,
|
|
11049
|
+
const ignoreFilePath = (0, import_node_path89.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
9755
11050
|
try {
|
|
9756
11051
|
const content = await readFileContent(ignoreFilePath);
|
|
9757
11052
|
return {
|
|
@@ -9765,7 +11060,7 @@ async function getIgnoreFile() {
|
|
|
9765
11060
|
}
|
|
9766
11061
|
}
|
|
9767
11062
|
async function putIgnoreFile({ content }) {
|
|
9768
|
-
const ignoreFilePath = (0,
|
|
11063
|
+
const ignoreFilePath = (0, import_node_path89.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
9769
11064
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
9770
11065
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
9771
11066
|
throw new Error(
|
|
@@ -9786,8 +11081,8 @@ async function putIgnoreFile({ content }) {
|
|
|
9786
11081
|
}
|
|
9787
11082
|
}
|
|
9788
11083
|
async function deleteIgnoreFile() {
|
|
9789
|
-
const aiignorePath = (0,
|
|
9790
|
-
const legacyIgnorePath = (0,
|
|
11084
|
+
const aiignorePath = (0, import_node_path89.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
11085
|
+
const legacyIgnorePath = (0, import_node_path89.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
9791
11086
|
try {
|
|
9792
11087
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
9793
11088
|
return {
|
|
@@ -9805,11 +11100,11 @@ async function deleteIgnoreFile() {
|
|
|
9805
11100
|
}
|
|
9806
11101
|
}
|
|
9807
11102
|
var ignoreToolSchemas = {
|
|
9808
|
-
getIgnoreFile:
|
|
9809
|
-
putIgnoreFile:
|
|
9810
|
-
content:
|
|
11103
|
+
getIgnoreFile: import_mini38.z.object({}),
|
|
11104
|
+
putIgnoreFile: import_mini38.z.object({
|
|
11105
|
+
content: import_mini38.z.string()
|
|
9811
11106
|
}),
|
|
9812
|
-
deleteIgnoreFile:
|
|
11107
|
+
deleteIgnoreFile: import_mini38.z.object({})
|
|
9813
11108
|
};
|
|
9814
11109
|
var ignoreTools = {
|
|
9815
11110
|
getIgnoreFile: {
|
|
@@ -9842,8 +11137,8 @@ var ignoreTools = {
|
|
|
9842
11137
|
};
|
|
9843
11138
|
|
|
9844
11139
|
// src/mcp/mcp.ts
|
|
9845
|
-
var
|
|
9846
|
-
var
|
|
11140
|
+
var import_node_path90 = require("path");
|
|
11141
|
+
var import_mini39 = require("zod/mini");
|
|
9847
11142
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
9848
11143
|
async function getMcpFile() {
|
|
9849
11144
|
const config = await ConfigResolver.resolve({});
|
|
@@ -9852,7 +11147,7 @@ async function getMcpFile() {
|
|
|
9852
11147
|
validate: true,
|
|
9853
11148
|
modularMcp: config.getModularMcp()
|
|
9854
11149
|
});
|
|
9855
|
-
const relativePathFromCwd = (0,
|
|
11150
|
+
const relativePathFromCwd = (0, import_node_path90.join)(
|
|
9856
11151
|
rulesyncMcp.getRelativeDirPath(),
|
|
9857
11152
|
rulesyncMcp.getRelativeFilePath()
|
|
9858
11153
|
);
|
|
@@ -9885,7 +11180,7 @@ async function putMcpFile({ content }) {
|
|
|
9885
11180
|
const paths = RulesyncMcp.getSettablePaths();
|
|
9886
11181
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
9887
11182
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
9888
|
-
const fullPath = (0,
|
|
11183
|
+
const fullPath = (0, import_node_path90.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
9889
11184
|
const rulesyncMcp = new RulesyncMcp({
|
|
9890
11185
|
baseDir,
|
|
9891
11186
|
relativeDirPath,
|
|
@@ -9894,9 +11189,9 @@ async function putMcpFile({ content }) {
|
|
|
9894
11189
|
validate: true,
|
|
9895
11190
|
modularMcp: config.getModularMcp()
|
|
9896
11191
|
});
|
|
9897
|
-
await ensureDir((0,
|
|
11192
|
+
await ensureDir((0, import_node_path90.join)(baseDir, relativeDirPath));
|
|
9898
11193
|
await writeFileContent(fullPath, content);
|
|
9899
|
-
const relativePathFromCwd = (0,
|
|
11194
|
+
const relativePathFromCwd = (0, import_node_path90.join)(relativeDirPath, relativeFilePath);
|
|
9900
11195
|
return {
|
|
9901
11196
|
relativePathFromCwd,
|
|
9902
11197
|
content: rulesyncMcp.getFileContent()
|
|
@@ -9911,15 +11206,15 @@ async function deleteMcpFile() {
|
|
|
9911
11206
|
try {
|
|
9912
11207
|
const baseDir = process.cwd();
|
|
9913
11208
|
const paths = RulesyncMcp.getSettablePaths();
|
|
9914
|
-
const recommendedPath = (0,
|
|
11209
|
+
const recommendedPath = (0, import_node_path90.join)(
|
|
9915
11210
|
baseDir,
|
|
9916
11211
|
paths.recommended.relativeDirPath,
|
|
9917
11212
|
paths.recommended.relativeFilePath
|
|
9918
11213
|
);
|
|
9919
|
-
const legacyPath = (0,
|
|
11214
|
+
const legacyPath = (0, import_node_path90.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
9920
11215
|
await removeFile(recommendedPath);
|
|
9921
11216
|
await removeFile(legacyPath);
|
|
9922
|
-
const relativePathFromCwd = (0,
|
|
11217
|
+
const relativePathFromCwd = (0, import_node_path90.join)(
|
|
9923
11218
|
paths.recommended.relativeDirPath,
|
|
9924
11219
|
paths.recommended.relativeFilePath
|
|
9925
11220
|
);
|
|
@@ -9933,11 +11228,11 @@ async function deleteMcpFile() {
|
|
|
9933
11228
|
}
|
|
9934
11229
|
}
|
|
9935
11230
|
var mcpToolSchemas = {
|
|
9936
|
-
getMcpFile:
|
|
9937
|
-
putMcpFile:
|
|
9938
|
-
content:
|
|
11231
|
+
getMcpFile: import_mini39.z.object({}),
|
|
11232
|
+
putMcpFile: import_mini39.z.object({
|
|
11233
|
+
content: import_mini39.z.string()
|
|
9939
11234
|
}),
|
|
9940
|
-
deleteMcpFile:
|
|
11235
|
+
deleteMcpFile: import_mini39.z.object({})
|
|
9941
11236
|
};
|
|
9942
11237
|
var mcpTools = {
|
|
9943
11238
|
getMcpFile: {
|
|
@@ -9970,12 +11265,12 @@ var mcpTools = {
|
|
|
9970
11265
|
};
|
|
9971
11266
|
|
|
9972
11267
|
// src/mcp/rules.ts
|
|
9973
|
-
var
|
|
9974
|
-
var
|
|
11268
|
+
var import_node_path91 = require("path");
|
|
11269
|
+
var import_mini40 = require("zod/mini");
|
|
9975
11270
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
9976
11271
|
var maxRulesCount = 1e3;
|
|
9977
11272
|
async function listRules() {
|
|
9978
|
-
const rulesDir = (0,
|
|
11273
|
+
const rulesDir = (0, import_node_path91.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
9979
11274
|
try {
|
|
9980
11275
|
const files = await listDirectoryFiles(rulesDir);
|
|
9981
11276
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -9988,7 +11283,7 @@ async function listRules() {
|
|
|
9988
11283
|
});
|
|
9989
11284
|
const frontmatter = rule.getFrontmatter();
|
|
9990
11285
|
return {
|
|
9991
|
-
relativePathFromCwd: (0,
|
|
11286
|
+
relativePathFromCwd: (0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
9992
11287
|
frontmatter
|
|
9993
11288
|
};
|
|
9994
11289
|
} catch (error) {
|
|
@@ -10008,14 +11303,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
10008
11303
|
relativePath: relativePathFromCwd,
|
|
10009
11304
|
intendedRootDir: process.cwd()
|
|
10010
11305
|
});
|
|
10011
|
-
const filename = (0,
|
|
11306
|
+
const filename = (0, import_node_path91.basename)(relativePathFromCwd);
|
|
10012
11307
|
try {
|
|
10013
11308
|
const rule = await RulesyncRule.fromFile({
|
|
10014
11309
|
relativeFilePath: filename,
|
|
10015
11310
|
validate: true
|
|
10016
11311
|
});
|
|
10017
11312
|
return {
|
|
10018
|
-
relativePathFromCwd: (0,
|
|
11313
|
+
relativePathFromCwd: (0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
10019
11314
|
frontmatter: rule.getFrontmatter(),
|
|
10020
11315
|
body: rule.getBody()
|
|
10021
11316
|
};
|
|
@@ -10034,7 +11329,7 @@ async function putRule({
|
|
|
10034
11329
|
relativePath: relativePathFromCwd,
|
|
10035
11330
|
intendedRootDir: process.cwd()
|
|
10036
11331
|
});
|
|
10037
|
-
const filename = (0,
|
|
11332
|
+
const filename = (0, import_node_path91.basename)(relativePathFromCwd);
|
|
10038
11333
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
10039
11334
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
10040
11335
|
throw new Error(
|
|
@@ -10044,7 +11339,7 @@ async function putRule({
|
|
|
10044
11339
|
try {
|
|
10045
11340
|
const existingRules = await listRules();
|
|
10046
11341
|
const isUpdate = existingRules.some(
|
|
10047
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
11342
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
10048
11343
|
);
|
|
10049
11344
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
10050
11345
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -10057,11 +11352,11 @@ async function putRule({
|
|
|
10057
11352
|
body,
|
|
10058
11353
|
validate: true
|
|
10059
11354
|
});
|
|
10060
|
-
const rulesDir = (0,
|
|
11355
|
+
const rulesDir = (0, import_node_path91.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
10061
11356
|
await ensureDir(rulesDir);
|
|
10062
11357
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
10063
11358
|
return {
|
|
10064
|
-
relativePathFromCwd: (0,
|
|
11359
|
+
relativePathFromCwd: (0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
10065
11360
|
frontmatter: rule.getFrontmatter(),
|
|
10066
11361
|
body: rule.getBody()
|
|
10067
11362
|
};
|
|
@@ -10076,12 +11371,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
10076
11371
|
relativePath: relativePathFromCwd,
|
|
10077
11372
|
intendedRootDir: process.cwd()
|
|
10078
11373
|
});
|
|
10079
|
-
const filename = (0,
|
|
10080
|
-
const fullPath = (0,
|
|
11374
|
+
const filename = (0, import_node_path91.basename)(relativePathFromCwd);
|
|
11375
|
+
const fullPath = (0, import_node_path91.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
10081
11376
|
try {
|
|
10082
11377
|
await removeFile(fullPath);
|
|
10083
11378
|
return {
|
|
10084
|
-
relativePathFromCwd: (0,
|
|
11379
|
+
relativePathFromCwd: (0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
10085
11380
|
};
|
|
10086
11381
|
} catch (error) {
|
|
10087
11382
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -10090,23 +11385,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
10090
11385
|
}
|
|
10091
11386
|
}
|
|
10092
11387
|
var ruleToolSchemas = {
|
|
10093
|
-
listRules:
|
|
10094
|
-
getRule:
|
|
10095
|
-
relativePathFromCwd:
|
|
11388
|
+
listRules: import_mini40.z.object({}),
|
|
11389
|
+
getRule: import_mini40.z.object({
|
|
11390
|
+
relativePathFromCwd: import_mini40.z.string()
|
|
10096
11391
|
}),
|
|
10097
|
-
putRule:
|
|
10098
|
-
relativePathFromCwd:
|
|
11392
|
+
putRule: import_mini40.z.object({
|
|
11393
|
+
relativePathFromCwd: import_mini40.z.string(),
|
|
10099
11394
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
10100
|
-
body:
|
|
11395
|
+
body: import_mini40.z.string()
|
|
10101
11396
|
}),
|
|
10102
|
-
deleteRule:
|
|
10103
|
-
relativePathFromCwd:
|
|
11397
|
+
deleteRule: import_mini40.z.object({
|
|
11398
|
+
relativePathFromCwd: import_mini40.z.string()
|
|
10104
11399
|
})
|
|
10105
11400
|
};
|
|
10106
11401
|
var ruleTools = {
|
|
10107
11402
|
listRules: {
|
|
10108
11403
|
name: "listRules",
|
|
10109
|
-
description: `List all rules from ${(0,
|
|
11404
|
+
description: `List all rules from ${(0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
10110
11405
|
parameters: ruleToolSchemas.listRules,
|
|
10111
11406
|
execute: async () => {
|
|
10112
11407
|
const rules = await listRules();
|
|
@@ -10148,8 +11443,8 @@ var ruleTools = {
|
|
|
10148
11443
|
};
|
|
10149
11444
|
|
|
10150
11445
|
// src/mcp/skills.ts
|
|
10151
|
-
var
|
|
10152
|
-
var
|
|
11446
|
+
var import_node_path92 = require("path");
|
|
11447
|
+
var import_mini41 = require("zod/mini");
|
|
10153
11448
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
10154
11449
|
var maxSkillsCount = 1e3;
|
|
10155
11450
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -10165,19 +11460,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
10165
11460
|
};
|
|
10166
11461
|
}
|
|
10167
11462
|
function extractDirName(relativeDirPathFromCwd) {
|
|
10168
|
-
const dirName = (0,
|
|
11463
|
+
const dirName = (0, import_node_path92.basename)(relativeDirPathFromCwd);
|
|
10169
11464
|
if (!dirName) {
|
|
10170
11465
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
10171
11466
|
}
|
|
10172
11467
|
return dirName;
|
|
10173
11468
|
}
|
|
10174
11469
|
async function listSkills() {
|
|
10175
|
-
const skillsDir = (0,
|
|
11470
|
+
const skillsDir = (0, import_node_path92.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
10176
11471
|
try {
|
|
10177
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
11472
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path92.join)(skillsDir, "*"), { type: "dir" });
|
|
10178
11473
|
const skills = await Promise.all(
|
|
10179
11474
|
skillDirPaths.map(async (dirPath) => {
|
|
10180
|
-
const dirName = (0,
|
|
11475
|
+
const dirName = (0, import_node_path92.basename)(dirPath);
|
|
10181
11476
|
if (!dirName) return null;
|
|
10182
11477
|
try {
|
|
10183
11478
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -10185,7 +11480,7 @@ async function listSkills() {
|
|
|
10185
11480
|
});
|
|
10186
11481
|
const frontmatter = skill.getFrontmatter();
|
|
10187
11482
|
return {
|
|
10188
|
-
relativeDirPathFromCwd: (0,
|
|
11483
|
+
relativeDirPathFromCwd: (0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
10189
11484
|
frontmatter
|
|
10190
11485
|
};
|
|
10191
11486
|
} catch (error) {
|
|
@@ -10211,7 +11506,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
10211
11506
|
dirName
|
|
10212
11507
|
});
|
|
10213
11508
|
return {
|
|
10214
|
-
relativeDirPathFromCwd: (0,
|
|
11509
|
+
relativeDirPathFromCwd: (0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
10215
11510
|
frontmatter: skill.getFrontmatter(),
|
|
10216
11511
|
body: skill.getBody(),
|
|
10217
11512
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -10245,7 +11540,7 @@ async function putSkill({
|
|
|
10245
11540
|
try {
|
|
10246
11541
|
const existingSkills = await listSkills();
|
|
10247
11542
|
const isUpdate = existingSkills.some(
|
|
10248
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
11543
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
10249
11544
|
);
|
|
10250
11545
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
10251
11546
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -10260,9 +11555,9 @@ async function putSkill({
|
|
|
10260
11555
|
otherFiles: aiDirFiles,
|
|
10261
11556
|
validate: true
|
|
10262
11557
|
});
|
|
10263
|
-
const skillDirPath = (0,
|
|
11558
|
+
const skillDirPath = (0, import_node_path92.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
10264
11559
|
await ensureDir(skillDirPath);
|
|
10265
|
-
const skillFilePath = (0,
|
|
11560
|
+
const skillFilePath = (0, import_node_path92.join)(skillDirPath, SKILL_FILE_NAME);
|
|
10266
11561
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
10267
11562
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
10268
11563
|
for (const file of otherFiles) {
|
|
@@ -10270,15 +11565,15 @@ async function putSkill({
|
|
|
10270
11565
|
relativePath: file.name,
|
|
10271
11566
|
intendedRootDir: skillDirPath
|
|
10272
11567
|
});
|
|
10273
|
-
const filePath = (0,
|
|
10274
|
-
const fileDir = (0,
|
|
11568
|
+
const filePath = (0, import_node_path92.join)(skillDirPath, file.name);
|
|
11569
|
+
const fileDir = (0, import_node_path92.join)(skillDirPath, (0, import_node_path92.dirname)(file.name));
|
|
10275
11570
|
if (fileDir !== skillDirPath) {
|
|
10276
11571
|
await ensureDir(fileDir);
|
|
10277
11572
|
}
|
|
10278
11573
|
await writeFileContent(filePath, file.body);
|
|
10279
11574
|
}
|
|
10280
11575
|
return {
|
|
10281
|
-
relativeDirPathFromCwd: (0,
|
|
11576
|
+
relativeDirPathFromCwd: (0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
10282
11577
|
frontmatter: skill.getFrontmatter(),
|
|
10283
11578
|
body: skill.getBody(),
|
|
10284
11579
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -10300,13 +11595,13 @@ async function deleteSkill({
|
|
|
10300
11595
|
intendedRootDir: process.cwd()
|
|
10301
11596
|
});
|
|
10302
11597
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
10303
|
-
const skillDirPath = (0,
|
|
11598
|
+
const skillDirPath = (0, import_node_path92.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
10304
11599
|
try {
|
|
10305
11600
|
if (await directoryExists(skillDirPath)) {
|
|
10306
11601
|
await removeDirectory(skillDirPath);
|
|
10307
11602
|
}
|
|
10308
11603
|
return {
|
|
10309
|
-
relativeDirPathFromCwd: (0,
|
|
11604
|
+
relativeDirPathFromCwd: (0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
10310
11605
|
};
|
|
10311
11606
|
} catch (error) {
|
|
10312
11607
|
throw new Error(
|
|
@@ -10317,29 +11612,29 @@ async function deleteSkill({
|
|
|
10317
11612
|
);
|
|
10318
11613
|
}
|
|
10319
11614
|
}
|
|
10320
|
-
var McpSkillFileSchema =
|
|
10321
|
-
name:
|
|
10322
|
-
body:
|
|
11615
|
+
var McpSkillFileSchema = import_mini41.z.object({
|
|
11616
|
+
name: import_mini41.z.string(),
|
|
11617
|
+
body: import_mini41.z.string()
|
|
10323
11618
|
});
|
|
10324
11619
|
var skillToolSchemas = {
|
|
10325
|
-
listSkills:
|
|
10326
|
-
getSkill:
|
|
10327
|
-
relativeDirPathFromCwd:
|
|
11620
|
+
listSkills: import_mini41.z.object({}),
|
|
11621
|
+
getSkill: import_mini41.z.object({
|
|
11622
|
+
relativeDirPathFromCwd: import_mini41.z.string()
|
|
10328
11623
|
}),
|
|
10329
|
-
putSkill:
|
|
10330
|
-
relativeDirPathFromCwd:
|
|
11624
|
+
putSkill: import_mini41.z.object({
|
|
11625
|
+
relativeDirPathFromCwd: import_mini41.z.string(),
|
|
10331
11626
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
10332
|
-
body:
|
|
10333
|
-
otherFiles:
|
|
11627
|
+
body: import_mini41.z.string(),
|
|
11628
|
+
otherFiles: import_mini41.z.optional(import_mini41.z.array(McpSkillFileSchema))
|
|
10334
11629
|
}),
|
|
10335
|
-
deleteSkill:
|
|
10336
|
-
relativeDirPathFromCwd:
|
|
11630
|
+
deleteSkill: import_mini41.z.object({
|
|
11631
|
+
relativeDirPathFromCwd: import_mini41.z.string()
|
|
10337
11632
|
})
|
|
10338
11633
|
};
|
|
10339
11634
|
var skillTools = {
|
|
10340
11635
|
listSkills: {
|
|
10341
11636
|
name: "listSkills",
|
|
10342
|
-
description: `List all skills from ${(0,
|
|
11637
|
+
description: `List all skills from ${(0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
10343
11638
|
parameters: skillToolSchemas.listSkills,
|
|
10344
11639
|
execute: async () => {
|
|
10345
11640
|
const skills = await listSkills();
|
|
@@ -10382,12 +11677,12 @@ var skillTools = {
|
|
|
10382
11677
|
};
|
|
10383
11678
|
|
|
10384
11679
|
// src/mcp/subagents.ts
|
|
10385
|
-
var
|
|
10386
|
-
var
|
|
11680
|
+
var import_node_path93 = require("path");
|
|
11681
|
+
var import_mini42 = require("zod/mini");
|
|
10387
11682
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
10388
11683
|
var maxSubagentsCount = 1e3;
|
|
10389
11684
|
async function listSubagents() {
|
|
10390
|
-
const subagentsDir = (0,
|
|
11685
|
+
const subagentsDir = (0, import_node_path93.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
10391
11686
|
try {
|
|
10392
11687
|
const files = await listDirectoryFiles(subagentsDir);
|
|
10393
11688
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -10400,7 +11695,7 @@ async function listSubagents() {
|
|
|
10400
11695
|
});
|
|
10401
11696
|
const frontmatter = subagent.getFrontmatter();
|
|
10402
11697
|
return {
|
|
10403
|
-
relativePathFromCwd: (0,
|
|
11698
|
+
relativePathFromCwd: (0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
10404
11699
|
frontmatter
|
|
10405
11700
|
};
|
|
10406
11701
|
} catch (error) {
|
|
@@ -10422,14 +11717,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
10422
11717
|
relativePath: relativePathFromCwd,
|
|
10423
11718
|
intendedRootDir: process.cwd()
|
|
10424
11719
|
});
|
|
10425
|
-
const filename = (0,
|
|
11720
|
+
const filename = (0, import_node_path93.basename)(relativePathFromCwd);
|
|
10426
11721
|
try {
|
|
10427
11722
|
const subagent = await RulesyncSubagent.fromFile({
|
|
10428
11723
|
relativeFilePath: filename,
|
|
10429
11724
|
validate: true
|
|
10430
11725
|
});
|
|
10431
11726
|
return {
|
|
10432
|
-
relativePathFromCwd: (0,
|
|
11727
|
+
relativePathFromCwd: (0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
10433
11728
|
frontmatter: subagent.getFrontmatter(),
|
|
10434
11729
|
body: subagent.getBody()
|
|
10435
11730
|
};
|
|
@@ -10448,7 +11743,7 @@ async function putSubagent({
|
|
|
10448
11743
|
relativePath: relativePathFromCwd,
|
|
10449
11744
|
intendedRootDir: process.cwd()
|
|
10450
11745
|
});
|
|
10451
|
-
const filename = (0,
|
|
11746
|
+
const filename = (0, import_node_path93.basename)(relativePathFromCwd);
|
|
10452
11747
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
10453
11748
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
10454
11749
|
throw new Error(
|
|
@@ -10458,7 +11753,7 @@ async function putSubagent({
|
|
|
10458
11753
|
try {
|
|
10459
11754
|
const existingSubagents = await listSubagents();
|
|
10460
11755
|
const isUpdate = existingSubagents.some(
|
|
10461
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
11756
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
10462
11757
|
);
|
|
10463
11758
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
10464
11759
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -10471,11 +11766,11 @@ async function putSubagent({
|
|
|
10471
11766
|
body,
|
|
10472
11767
|
validate: true
|
|
10473
11768
|
});
|
|
10474
|
-
const subagentsDir = (0,
|
|
11769
|
+
const subagentsDir = (0, import_node_path93.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
10475
11770
|
await ensureDir(subagentsDir);
|
|
10476
11771
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
10477
11772
|
return {
|
|
10478
|
-
relativePathFromCwd: (0,
|
|
11773
|
+
relativePathFromCwd: (0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
10479
11774
|
frontmatter: subagent.getFrontmatter(),
|
|
10480
11775
|
body: subagent.getBody()
|
|
10481
11776
|
};
|
|
@@ -10490,12 +11785,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
10490
11785
|
relativePath: relativePathFromCwd,
|
|
10491
11786
|
intendedRootDir: process.cwd()
|
|
10492
11787
|
});
|
|
10493
|
-
const filename = (0,
|
|
10494
|
-
const fullPath = (0,
|
|
11788
|
+
const filename = (0, import_node_path93.basename)(relativePathFromCwd);
|
|
11789
|
+
const fullPath = (0, import_node_path93.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
10495
11790
|
try {
|
|
10496
11791
|
await removeFile(fullPath);
|
|
10497
11792
|
return {
|
|
10498
|
-
relativePathFromCwd: (0,
|
|
11793
|
+
relativePathFromCwd: (0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
10499
11794
|
};
|
|
10500
11795
|
} catch (error) {
|
|
10501
11796
|
throw new Error(
|
|
@@ -10507,23 +11802,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
10507
11802
|
}
|
|
10508
11803
|
}
|
|
10509
11804
|
var subagentToolSchemas = {
|
|
10510
|
-
listSubagents:
|
|
10511
|
-
getSubagent:
|
|
10512
|
-
relativePathFromCwd:
|
|
11805
|
+
listSubagents: import_mini42.z.object({}),
|
|
11806
|
+
getSubagent: import_mini42.z.object({
|
|
11807
|
+
relativePathFromCwd: import_mini42.z.string()
|
|
10513
11808
|
}),
|
|
10514
|
-
putSubagent:
|
|
10515
|
-
relativePathFromCwd:
|
|
11809
|
+
putSubagent: import_mini42.z.object({
|
|
11810
|
+
relativePathFromCwd: import_mini42.z.string(),
|
|
10516
11811
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
10517
|
-
body:
|
|
11812
|
+
body: import_mini42.z.string()
|
|
10518
11813
|
}),
|
|
10519
|
-
deleteSubagent:
|
|
10520
|
-
relativePathFromCwd:
|
|
11814
|
+
deleteSubagent: import_mini42.z.object({
|
|
11815
|
+
relativePathFromCwd: import_mini42.z.string()
|
|
10521
11816
|
})
|
|
10522
11817
|
};
|
|
10523
11818
|
var subagentTools = {
|
|
10524
11819
|
listSubagents: {
|
|
10525
11820
|
name: "listSubagents",
|
|
10526
|
-
description: `List all subagents from ${(0,
|
|
11821
|
+
description: `List all subagents from ${(0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
10527
11822
|
parameters: subagentToolSchemas.listSubagents,
|
|
10528
11823
|
execute: async () => {
|
|
10529
11824
|
const subagents = await listSubagents();
|
|
@@ -10601,7 +11896,7 @@ async function mcpCommand({ version }) {
|
|
|
10601
11896
|
}
|
|
10602
11897
|
|
|
10603
11898
|
// src/cli/index.ts
|
|
10604
|
-
var getVersion = () => "4.
|
|
11899
|
+
var getVersion = () => "4.1.0";
|
|
10605
11900
|
var main = async () => {
|
|
10606
11901
|
const program = new import_commander.Command();
|
|
10607
11902
|
const version = getVersion();
|