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.js
CHANGED
|
@@ -649,6 +649,17 @@ var ToolCommand = class extends AiFile {
|
|
|
649
649
|
static async fromFile(_params) {
|
|
650
650
|
throw new Error("Please implement this method in the subclass.");
|
|
651
651
|
}
|
|
652
|
+
/**
|
|
653
|
+
* Create a minimal instance for deletion purposes.
|
|
654
|
+
* This method does not read or parse file content, making it safe to use
|
|
655
|
+
* even when files have old/incompatible formats.
|
|
656
|
+
*
|
|
657
|
+
* @param params - Parameters including the file path
|
|
658
|
+
* @returns A concrete ToolCommand instance with minimal data for deletion
|
|
659
|
+
*/
|
|
660
|
+
static forDeletion(_params) {
|
|
661
|
+
throw new Error("Please implement this method in the subclass.");
|
|
662
|
+
}
|
|
652
663
|
/**
|
|
653
664
|
* Convert a RulesyncCommand to the tool-specific command format.
|
|
654
665
|
*
|
|
@@ -791,6 +802,20 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
791
802
|
validate
|
|
792
803
|
};
|
|
793
804
|
}
|
|
805
|
+
static forDeletionDefault({
|
|
806
|
+
baseDir = process.cwd(),
|
|
807
|
+
relativeDirPath,
|
|
808
|
+
relativeFilePath
|
|
809
|
+
}) {
|
|
810
|
+
return {
|
|
811
|
+
baseDir,
|
|
812
|
+
relativeDirPath,
|
|
813
|
+
relativeFilePath,
|
|
814
|
+
frontmatter: { description: "" },
|
|
815
|
+
body: "",
|
|
816
|
+
validate: false
|
|
817
|
+
};
|
|
818
|
+
}
|
|
794
819
|
};
|
|
795
820
|
|
|
796
821
|
// src/features/commands/agentsmd-command.ts
|
|
@@ -840,6 +865,15 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
840
865
|
toolTarget: "agentsmd"
|
|
841
866
|
});
|
|
842
867
|
}
|
|
868
|
+
static forDeletion({
|
|
869
|
+
baseDir = process.cwd(),
|
|
870
|
+
relativeDirPath,
|
|
871
|
+
relativeFilePath
|
|
872
|
+
}) {
|
|
873
|
+
return new _AgentsmdCommand(
|
|
874
|
+
this.forDeletionDefault({ baseDir, relativeDirPath, relativeFilePath })
|
|
875
|
+
);
|
|
876
|
+
}
|
|
843
877
|
};
|
|
844
878
|
|
|
845
879
|
// src/features/commands/antigravity-command.ts
|
|
@@ -1057,6 +1091,21 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1057
1091
|
validate
|
|
1058
1092
|
});
|
|
1059
1093
|
}
|
|
1094
|
+
static forDeletion({
|
|
1095
|
+
baseDir = process.cwd(),
|
|
1096
|
+
relativeDirPath,
|
|
1097
|
+
relativeFilePath
|
|
1098
|
+
}) {
|
|
1099
|
+
return new _AntigravityCommand({
|
|
1100
|
+
baseDir,
|
|
1101
|
+
relativeDirPath,
|
|
1102
|
+
relativeFilePath,
|
|
1103
|
+
frontmatter: { description: "" },
|
|
1104
|
+
body: "",
|
|
1105
|
+
fileContent: "",
|
|
1106
|
+
validate: false
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1060
1109
|
};
|
|
1061
1110
|
|
|
1062
1111
|
// src/features/commands/claudecode-command.ts
|
|
@@ -1187,6 +1236,20 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1187
1236
|
validate
|
|
1188
1237
|
});
|
|
1189
1238
|
}
|
|
1239
|
+
static forDeletion({
|
|
1240
|
+
baseDir = process.cwd(),
|
|
1241
|
+
relativeDirPath,
|
|
1242
|
+
relativeFilePath
|
|
1243
|
+
}) {
|
|
1244
|
+
return new _ClaudecodeCommand({
|
|
1245
|
+
baseDir,
|
|
1246
|
+
relativeDirPath,
|
|
1247
|
+
relativeFilePath,
|
|
1248
|
+
frontmatter: { description: "" },
|
|
1249
|
+
body: "",
|
|
1250
|
+
validate: false
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1190
1253
|
};
|
|
1191
1254
|
|
|
1192
1255
|
// src/features/commands/codexcli-command.ts
|
|
@@ -1261,13 +1324,26 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1261
1324
|
validate
|
|
1262
1325
|
});
|
|
1263
1326
|
}
|
|
1327
|
+
static forDeletion({
|
|
1328
|
+
baseDir = process.cwd(),
|
|
1329
|
+
relativeDirPath,
|
|
1330
|
+
relativeFilePath
|
|
1331
|
+
}) {
|
|
1332
|
+
return new _CodexcliCommand({
|
|
1333
|
+
baseDir,
|
|
1334
|
+
relativeDirPath,
|
|
1335
|
+
relativeFilePath,
|
|
1336
|
+
fileContent: "",
|
|
1337
|
+
validate: false
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1264
1340
|
};
|
|
1265
1341
|
|
|
1266
1342
|
// src/features/commands/copilot-command.ts
|
|
1267
1343
|
import { basename as basename7, join as join9 } from "path";
|
|
1268
1344
|
import { z as z8 } from "zod/mini";
|
|
1269
1345
|
var CopilotCommandFrontmatterSchema = z8.looseObject({
|
|
1270
|
-
mode: z8.
|
|
1346
|
+
mode: z8.optional(z8.string()),
|
|
1271
1347
|
description: z8.string()
|
|
1272
1348
|
});
|
|
1273
1349
|
var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
@@ -1345,7 +1421,6 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1345
1421
|
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
1346
1422
|
const copilotFields = rulesyncFrontmatter.copilot ?? {};
|
|
1347
1423
|
const copilotFrontmatter = {
|
|
1348
|
-
mode: "agent",
|
|
1349
1424
|
description: rulesyncFrontmatter.description,
|
|
1350
1425
|
...copilotFields
|
|
1351
1426
|
};
|
|
@@ -1389,6 +1464,20 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1389
1464
|
toolTarget: "copilot"
|
|
1390
1465
|
});
|
|
1391
1466
|
}
|
|
1467
|
+
static forDeletion({
|
|
1468
|
+
baseDir = process.cwd(),
|
|
1469
|
+
relativeDirPath,
|
|
1470
|
+
relativeFilePath
|
|
1471
|
+
}) {
|
|
1472
|
+
return new _CopilotCommand({
|
|
1473
|
+
baseDir,
|
|
1474
|
+
relativeDirPath,
|
|
1475
|
+
relativeFilePath,
|
|
1476
|
+
frontmatter: { description: "" },
|
|
1477
|
+
body: "",
|
|
1478
|
+
validate: false
|
|
1479
|
+
});
|
|
1480
|
+
}
|
|
1392
1481
|
};
|
|
1393
1482
|
|
|
1394
1483
|
// src/features/commands/cursor-command.ts
|
|
@@ -1460,6 +1549,19 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1460
1549
|
validate
|
|
1461
1550
|
});
|
|
1462
1551
|
}
|
|
1552
|
+
static forDeletion({
|
|
1553
|
+
baseDir = process.cwd(),
|
|
1554
|
+
relativeDirPath,
|
|
1555
|
+
relativeFilePath
|
|
1556
|
+
}) {
|
|
1557
|
+
return new _CursorCommand({
|
|
1558
|
+
baseDir,
|
|
1559
|
+
relativeDirPath,
|
|
1560
|
+
relativeFilePath,
|
|
1561
|
+
fileContent: "",
|
|
1562
|
+
validate: false
|
|
1563
|
+
});
|
|
1564
|
+
}
|
|
1463
1565
|
};
|
|
1464
1566
|
|
|
1465
1567
|
// src/features/commands/geminicli-command.ts
|
|
@@ -1587,6 +1689,21 @@ ${geminiFrontmatter.prompt}
|
|
|
1587
1689
|
toolTarget: "geminicli"
|
|
1588
1690
|
});
|
|
1589
1691
|
}
|
|
1692
|
+
static forDeletion({
|
|
1693
|
+
baseDir = process.cwd(),
|
|
1694
|
+
relativeDirPath,
|
|
1695
|
+
relativeFilePath
|
|
1696
|
+
}) {
|
|
1697
|
+
const placeholderToml = `description = ""
|
|
1698
|
+
prompt = ""`;
|
|
1699
|
+
return new _GeminiCliCommand({
|
|
1700
|
+
baseDir,
|
|
1701
|
+
relativeDirPath,
|
|
1702
|
+
relativeFilePath,
|
|
1703
|
+
fileContent: placeholderToml,
|
|
1704
|
+
validate: false
|
|
1705
|
+
});
|
|
1706
|
+
}
|
|
1590
1707
|
};
|
|
1591
1708
|
|
|
1592
1709
|
// src/features/commands/opencode-command.ts
|
|
@@ -1713,6 +1830,20 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1713
1830
|
toolTarget: "opencode"
|
|
1714
1831
|
});
|
|
1715
1832
|
}
|
|
1833
|
+
static forDeletion({
|
|
1834
|
+
baseDir = process.cwd(),
|
|
1835
|
+
relativeDirPath,
|
|
1836
|
+
relativeFilePath
|
|
1837
|
+
}) {
|
|
1838
|
+
return new _OpenCodeCommand({
|
|
1839
|
+
baseDir,
|
|
1840
|
+
relativeDirPath,
|
|
1841
|
+
relativeFilePath,
|
|
1842
|
+
frontmatter: { description: "" },
|
|
1843
|
+
body: "",
|
|
1844
|
+
validate: false
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1716
1847
|
};
|
|
1717
1848
|
|
|
1718
1849
|
// src/features/commands/roo-command.ts
|
|
@@ -1839,6 +1970,21 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1839
1970
|
validate
|
|
1840
1971
|
});
|
|
1841
1972
|
}
|
|
1973
|
+
static forDeletion({
|
|
1974
|
+
baseDir = process.cwd(),
|
|
1975
|
+
relativeDirPath,
|
|
1976
|
+
relativeFilePath
|
|
1977
|
+
}) {
|
|
1978
|
+
return new _RooCommand({
|
|
1979
|
+
baseDir,
|
|
1980
|
+
relativeDirPath,
|
|
1981
|
+
relativeFilePath,
|
|
1982
|
+
frontmatter: { description: "" },
|
|
1983
|
+
body: "",
|
|
1984
|
+
fileContent: "",
|
|
1985
|
+
validate: false
|
|
1986
|
+
});
|
|
1987
|
+
}
|
|
1842
1988
|
};
|
|
1843
1989
|
|
|
1844
1990
|
// src/features/commands/commands-processor.ts
|
|
@@ -2021,6 +2167,18 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2021
2167
|
const commandFilePaths = await findFilesByGlobs(
|
|
2022
2168
|
join14(this.baseDir, paths.relativeDirPath, `*.${factory.meta.extension}`)
|
|
2023
2169
|
);
|
|
2170
|
+
if (forDeletion) {
|
|
2171
|
+
const toolCommands2 = commandFilePaths.map(
|
|
2172
|
+
(path3) => factory.class.forDeletion({
|
|
2173
|
+
baseDir: this.baseDir,
|
|
2174
|
+
relativeDirPath: paths.relativeDirPath,
|
|
2175
|
+
relativeFilePath: basename12(path3),
|
|
2176
|
+
global: this.global
|
|
2177
|
+
})
|
|
2178
|
+
).filter((cmd) => cmd.isDeletable());
|
|
2179
|
+
logger.info(`Successfully loaded ${toolCommands2.length} ${paths.relativeDirPath} commands`);
|
|
2180
|
+
return toolCommands2;
|
|
2181
|
+
}
|
|
2024
2182
|
const toolCommands = await Promise.all(
|
|
2025
2183
|
commandFilePaths.map(
|
|
2026
2184
|
(path3) => factory.class.fromFile({
|
|
@@ -2030,9 +2188,8 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2030
2188
|
})
|
|
2031
2189
|
)
|
|
2032
2190
|
);
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
return result;
|
|
2191
|
+
logger.info(`Successfully loaded ${toolCommands.length} ${paths.relativeDirPath} commands`);
|
|
2192
|
+
return toolCommands;
|
|
2036
2193
|
}
|
|
2037
2194
|
/**
|
|
2038
2195
|
* Implementation of abstract method from FeatureProcessor
|
|
@@ -2161,6 +2318,14 @@ var ToolIgnore = class extends ToolFile {
|
|
|
2161
2318
|
static async fromFile(_params) {
|
|
2162
2319
|
throw new Error("Please implement this method in the subclass.");
|
|
2163
2320
|
}
|
|
2321
|
+
/**
|
|
2322
|
+
* Create a minimal instance for deletion purposes.
|
|
2323
|
+
* This method does not read or parse file content, making it safe to use
|
|
2324
|
+
* even when files have old/incompatible formats.
|
|
2325
|
+
*/
|
|
2326
|
+
static forDeletion(_params) {
|
|
2327
|
+
throw new Error("Please implement this method in the subclass.");
|
|
2328
|
+
}
|
|
2164
2329
|
};
|
|
2165
2330
|
|
|
2166
2331
|
// src/features/ignore/amazonqcli-ignore.ts
|
|
@@ -2216,6 +2381,19 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
2216
2381
|
validate
|
|
2217
2382
|
});
|
|
2218
2383
|
}
|
|
2384
|
+
static forDeletion({
|
|
2385
|
+
baseDir = process.cwd(),
|
|
2386
|
+
relativeDirPath,
|
|
2387
|
+
relativeFilePath
|
|
2388
|
+
}) {
|
|
2389
|
+
return new _AmazonqcliIgnore({
|
|
2390
|
+
baseDir,
|
|
2391
|
+
relativeDirPath,
|
|
2392
|
+
relativeFilePath,
|
|
2393
|
+
fileContent: "",
|
|
2394
|
+
validate: false
|
|
2395
|
+
});
|
|
2396
|
+
}
|
|
2219
2397
|
};
|
|
2220
2398
|
|
|
2221
2399
|
// src/features/ignore/augmentcode-ignore.ts
|
|
@@ -2271,6 +2449,19 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2271
2449
|
validate
|
|
2272
2450
|
});
|
|
2273
2451
|
}
|
|
2452
|
+
static forDeletion({
|
|
2453
|
+
baseDir = process.cwd(),
|
|
2454
|
+
relativeDirPath,
|
|
2455
|
+
relativeFilePath
|
|
2456
|
+
}) {
|
|
2457
|
+
return new _AugmentcodeIgnore({
|
|
2458
|
+
baseDir,
|
|
2459
|
+
relativeDirPath,
|
|
2460
|
+
relativeFilePath,
|
|
2461
|
+
fileContent: "",
|
|
2462
|
+
validate: false
|
|
2463
|
+
});
|
|
2464
|
+
}
|
|
2274
2465
|
};
|
|
2275
2466
|
|
|
2276
2467
|
// src/features/ignore/claudecode-ignore.ts
|
|
@@ -2367,6 +2558,19 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2367
2558
|
validate
|
|
2368
2559
|
});
|
|
2369
2560
|
}
|
|
2561
|
+
static forDeletion({
|
|
2562
|
+
baseDir = process.cwd(),
|
|
2563
|
+
relativeDirPath,
|
|
2564
|
+
relativeFilePath
|
|
2565
|
+
}) {
|
|
2566
|
+
return new _ClaudecodeIgnore({
|
|
2567
|
+
baseDir,
|
|
2568
|
+
relativeDirPath,
|
|
2569
|
+
relativeFilePath,
|
|
2570
|
+
fileContent: "{}",
|
|
2571
|
+
validate: false
|
|
2572
|
+
});
|
|
2573
|
+
}
|
|
2370
2574
|
};
|
|
2371
2575
|
|
|
2372
2576
|
// src/features/ignore/cline-ignore.ts
|
|
@@ -2421,6 +2625,19 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2421
2625
|
validate
|
|
2422
2626
|
});
|
|
2423
2627
|
}
|
|
2628
|
+
static forDeletion({
|
|
2629
|
+
baseDir = process.cwd(),
|
|
2630
|
+
relativeDirPath,
|
|
2631
|
+
relativeFilePath
|
|
2632
|
+
}) {
|
|
2633
|
+
return new _ClineIgnore({
|
|
2634
|
+
baseDir,
|
|
2635
|
+
relativeDirPath,
|
|
2636
|
+
relativeFilePath,
|
|
2637
|
+
fileContent: "",
|
|
2638
|
+
validate: false
|
|
2639
|
+
});
|
|
2640
|
+
}
|
|
2424
2641
|
};
|
|
2425
2642
|
|
|
2426
2643
|
// src/features/ignore/cursor-ignore.ts
|
|
@@ -2471,6 +2688,19 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2471
2688
|
validate
|
|
2472
2689
|
});
|
|
2473
2690
|
}
|
|
2691
|
+
static forDeletion({
|
|
2692
|
+
baseDir = process.cwd(),
|
|
2693
|
+
relativeDirPath,
|
|
2694
|
+
relativeFilePath
|
|
2695
|
+
}) {
|
|
2696
|
+
return new _CursorIgnore({
|
|
2697
|
+
baseDir,
|
|
2698
|
+
relativeDirPath,
|
|
2699
|
+
relativeFilePath,
|
|
2700
|
+
fileContent: "",
|
|
2701
|
+
validate: false
|
|
2702
|
+
});
|
|
2703
|
+
}
|
|
2474
2704
|
};
|
|
2475
2705
|
|
|
2476
2706
|
// src/features/ignore/geminicli-ignore.ts
|
|
@@ -2515,6 +2745,19 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2515
2745
|
validate
|
|
2516
2746
|
});
|
|
2517
2747
|
}
|
|
2748
|
+
static forDeletion({
|
|
2749
|
+
baseDir = process.cwd(),
|
|
2750
|
+
relativeDirPath,
|
|
2751
|
+
relativeFilePath
|
|
2752
|
+
}) {
|
|
2753
|
+
return new _GeminiCliIgnore({
|
|
2754
|
+
baseDir,
|
|
2755
|
+
relativeDirPath,
|
|
2756
|
+
relativeFilePath,
|
|
2757
|
+
fileContent: "",
|
|
2758
|
+
validate: false
|
|
2759
|
+
});
|
|
2760
|
+
}
|
|
2518
2761
|
};
|
|
2519
2762
|
|
|
2520
2763
|
// src/features/ignore/junie-ignore.ts
|
|
@@ -2559,6 +2802,19 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2559
2802
|
validate
|
|
2560
2803
|
});
|
|
2561
2804
|
}
|
|
2805
|
+
static forDeletion({
|
|
2806
|
+
baseDir = process.cwd(),
|
|
2807
|
+
relativeDirPath,
|
|
2808
|
+
relativeFilePath
|
|
2809
|
+
}) {
|
|
2810
|
+
return new _JunieIgnore({
|
|
2811
|
+
baseDir,
|
|
2812
|
+
relativeDirPath,
|
|
2813
|
+
relativeFilePath,
|
|
2814
|
+
fileContent: "",
|
|
2815
|
+
validate: false
|
|
2816
|
+
});
|
|
2817
|
+
}
|
|
2562
2818
|
};
|
|
2563
2819
|
|
|
2564
2820
|
// src/features/ignore/kiro-ignore.ts
|
|
@@ -2603,6 +2859,19 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
2603
2859
|
validate
|
|
2604
2860
|
});
|
|
2605
2861
|
}
|
|
2862
|
+
static forDeletion({
|
|
2863
|
+
baseDir = process.cwd(),
|
|
2864
|
+
relativeDirPath,
|
|
2865
|
+
relativeFilePath
|
|
2866
|
+
}) {
|
|
2867
|
+
return new _KiroIgnore({
|
|
2868
|
+
baseDir,
|
|
2869
|
+
relativeDirPath,
|
|
2870
|
+
relativeFilePath,
|
|
2871
|
+
fileContent: "",
|
|
2872
|
+
validate: false
|
|
2873
|
+
});
|
|
2874
|
+
}
|
|
2606
2875
|
};
|
|
2607
2876
|
|
|
2608
2877
|
// src/features/ignore/qwencode-ignore.ts
|
|
@@ -2647,6 +2916,19 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
2647
2916
|
validate
|
|
2648
2917
|
});
|
|
2649
2918
|
}
|
|
2919
|
+
static forDeletion({
|
|
2920
|
+
baseDir = process.cwd(),
|
|
2921
|
+
relativeDirPath,
|
|
2922
|
+
relativeFilePath
|
|
2923
|
+
}) {
|
|
2924
|
+
return new _QwencodeIgnore({
|
|
2925
|
+
baseDir,
|
|
2926
|
+
relativeDirPath,
|
|
2927
|
+
relativeFilePath,
|
|
2928
|
+
fileContent: "",
|
|
2929
|
+
validate: false
|
|
2930
|
+
});
|
|
2931
|
+
}
|
|
2650
2932
|
};
|
|
2651
2933
|
|
|
2652
2934
|
// src/features/ignore/roo-ignore.ts
|
|
@@ -2691,6 +2973,19 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
2691
2973
|
validate
|
|
2692
2974
|
});
|
|
2693
2975
|
}
|
|
2976
|
+
static forDeletion({
|
|
2977
|
+
baseDir = process.cwd(),
|
|
2978
|
+
relativeDirPath,
|
|
2979
|
+
relativeFilePath
|
|
2980
|
+
}) {
|
|
2981
|
+
return new _RooIgnore({
|
|
2982
|
+
baseDir,
|
|
2983
|
+
relativeDirPath,
|
|
2984
|
+
relativeFilePath,
|
|
2985
|
+
fileContent: "",
|
|
2986
|
+
validate: false
|
|
2987
|
+
});
|
|
2988
|
+
}
|
|
2694
2989
|
};
|
|
2695
2990
|
|
|
2696
2991
|
// src/features/ignore/windsurf-ignore.ts
|
|
@@ -2735,6 +3030,19 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
2735
3030
|
validate
|
|
2736
3031
|
});
|
|
2737
3032
|
}
|
|
3033
|
+
static forDeletion({
|
|
3034
|
+
baseDir = process.cwd(),
|
|
3035
|
+
relativeDirPath,
|
|
3036
|
+
relativeFilePath
|
|
3037
|
+
}) {
|
|
3038
|
+
return new _WindsurfIgnore({
|
|
3039
|
+
baseDir,
|
|
3040
|
+
relativeDirPath,
|
|
3041
|
+
relativeFilePath,
|
|
3042
|
+
fileContent: "",
|
|
3043
|
+
validate: false
|
|
3044
|
+
});
|
|
3045
|
+
}
|
|
2738
3046
|
};
|
|
2739
3047
|
|
|
2740
3048
|
// src/features/ignore/ignore-processor.ts
|
|
@@ -2814,10 +3122,18 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
2814
3122
|
forDeletion = false
|
|
2815
3123
|
} = {}) {
|
|
2816
3124
|
try {
|
|
2817
|
-
const
|
|
3125
|
+
const factory = this.getFactory(this.toolTarget);
|
|
3126
|
+
const paths = factory.class.getSettablePaths();
|
|
2818
3127
|
if (forDeletion) {
|
|
2819
|
-
|
|
3128
|
+
const toolIgnore = factory.class.forDeletion({
|
|
3129
|
+
baseDir: this.baseDir,
|
|
3130
|
+
relativeDirPath: paths.relativeDirPath,
|
|
3131
|
+
relativeFilePath: paths.relativeFilePath
|
|
3132
|
+
});
|
|
3133
|
+
const toolIgnores2 = toolIgnore.isDeletable() ? [toolIgnore] : [];
|
|
3134
|
+
return toolIgnores2;
|
|
2820
3135
|
}
|
|
3136
|
+
const toolIgnores = await this.loadToolIgnores();
|
|
2821
3137
|
return toolIgnores;
|
|
2822
3138
|
} catch (error) {
|
|
2823
3139
|
const errorMessage = `Failed to load tool files: ${formatError(error)}`;
|
|
@@ -3062,6 +3378,14 @@ var ToolMcp = class extends ToolFile {
|
|
|
3062
3378
|
static async fromFile(_params) {
|
|
3063
3379
|
throw new Error("Please implement this method in the subclass.");
|
|
3064
3380
|
}
|
|
3381
|
+
/**
|
|
3382
|
+
* Create a minimal instance for deletion purposes.
|
|
3383
|
+
* This method does not read or parse file content, making it safe to use
|
|
3384
|
+
* even when files have old/incompatible formats.
|
|
3385
|
+
*/
|
|
3386
|
+
static forDeletion(_params) {
|
|
3387
|
+
throw new Error("Please implement this method in the subclass.");
|
|
3388
|
+
}
|
|
3065
3389
|
static fromRulesyncMcp(_params) {
|
|
3066
3390
|
throw new Error("Please implement this method in the subclass.");
|
|
3067
3391
|
}
|
|
@@ -3121,10 +3445,23 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
3121
3445
|
validate() {
|
|
3122
3446
|
return { success: true, error: null };
|
|
3123
3447
|
}
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3448
|
+
static forDeletion({
|
|
3449
|
+
baseDir = process.cwd(),
|
|
3450
|
+
relativeDirPath,
|
|
3451
|
+
relativeFilePath
|
|
3452
|
+
}) {
|
|
3453
|
+
return new _AmazonqcliMcp({
|
|
3454
|
+
baseDir,
|
|
3455
|
+
relativeDirPath,
|
|
3456
|
+
relativeFilePath,
|
|
3457
|
+
fileContent: "{}",
|
|
3458
|
+
validate: false
|
|
3459
|
+
});
|
|
3460
|
+
}
|
|
3461
|
+
};
|
|
3462
|
+
|
|
3463
|
+
// src/features/mcp/claudecode-mcp.ts
|
|
3464
|
+
import { join as join30 } from "path";
|
|
3128
3465
|
|
|
3129
3466
|
// src/features/mcp/modular-mcp.ts
|
|
3130
3467
|
import { join as join29 } from "path";
|
|
@@ -3317,6 +3654,19 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3317
3654
|
validate() {
|
|
3318
3655
|
return { success: true, error: null };
|
|
3319
3656
|
}
|
|
3657
|
+
static forDeletion({
|
|
3658
|
+
baseDir = process.cwd(),
|
|
3659
|
+
relativeDirPath,
|
|
3660
|
+
relativeFilePath
|
|
3661
|
+
}) {
|
|
3662
|
+
return new _ClaudecodeMcp({
|
|
3663
|
+
baseDir,
|
|
3664
|
+
relativeDirPath,
|
|
3665
|
+
relativeFilePath,
|
|
3666
|
+
fileContent: "{}",
|
|
3667
|
+
validate: false
|
|
3668
|
+
});
|
|
3669
|
+
}
|
|
3320
3670
|
};
|
|
3321
3671
|
|
|
3322
3672
|
// src/features/mcp/cline-mcp.ts
|
|
@@ -3374,6 +3724,19 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3374
3724
|
validate() {
|
|
3375
3725
|
return { success: true, error: null };
|
|
3376
3726
|
}
|
|
3727
|
+
static forDeletion({
|
|
3728
|
+
baseDir = process.cwd(),
|
|
3729
|
+
relativeDirPath,
|
|
3730
|
+
relativeFilePath
|
|
3731
|
+
}) {
|
|
3732
|
+
return new _ClineMcp({
|
|
3733
|
+
baseDir,
|
|
3734
|
+
relativeDirPath,
|
|
3735
|
+
relativeFilePath,
|
|
3736
|
+
fileContent: "{}",
|
|
3737
|
+
validate: false
|
|
3738
|
+
});
|
|
3739
|
+
}
|
|
3377
3740
|
};
|
|
3378
3741
|
|
|
3379
3742
|
// src/features/mcp/codexcli-mcp.ts
|
|
@@ -3468,6 +3831,19 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3468
3831
|
}
|
|
3469
3832
|
return filtered;
|
|
3470
3833
|
}
|
|
3834
|
+
static forDeletion({
|
|
3835
|
+
baseDir = process.cwd(),
|
|
3836
|
+
relativeDirPath,
|
|
3837
|
+
relativeFilePath
|
|
3838
|
+
}) {
|
|
3839
|
+
return new _CodexcliMcp({
|
|
3840
|
+
baseDir,
|
|
3841
|
+
relativeDirPath,
|
|
3842
|
+
relativeFilePath,
|
|
3843
|
+
fileContent: "",
|
|
3844
|
+
validate: false
|
|
3845
|
+
});
|
|
3846
|
+
}
|
|
3471
3847
|
};
|
|
3472
3848
|
|
|
3473
3849
|
// src/features/mcp/copilot-mcp.ts
|
|
@@ -3535,6 +3911,19 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3535
3911
|
validate() {
|
|
3536
3912
|
return { success: true, error: null };
|
|
3537
3913
|
}
|
|
3914
|
+
static forDeletion({
|
|
3915
|
+
baseDir = process.cwd(),
|
|
3916
|
+
relativeDirPath,
|
|
3917
|
+
relativeFilePath
|
|
3918
|
+
}) {
|
|
3919
|
+
return new _CopilotMcp({
|
|
3920
|
+
baseDir,
|
|
3921
|
+
relativeDirPath,
|
|
3922
|
+
relativeFilePath,
|
|
3923
|
+
fileContent: "{}",
|
|
3924
|
+
validate: false
|
|
3925
|
+
});
|
|
3926
|
+
}
|
|
3538
3927
|
};
|
|
3539
3928
|
|
|
3540
3929
|
// src/features/mcp/cursor-mcp.ts
|
|
@@ -3603,6 +3992,19 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
3603
3992
|
validate() {
|
|
3604
3993
|
return { success: true, error: null };
|
|
3605
3994
|
}
|
|
3995
|
+
static forDeletion({
|
|
3996
|
+
baseDir = process.cwd(),
|
|
3997
|
+
relativeDirPath,
|
|
3998
|
+
relativeFilePath
|
|
3999
|
+
}) {
|
|
4000
|
+
return new _CursorMcp({
|
|
4001
|
+
baseDir,
|
|
4002
|
+
relativeDirPath,
|
|
4003
|
+
relativeFilePath,
|
|
4004
|
+
fileContent: "{}",
|
|
4005
|
+
validate: false
|
|
4006
|
+
});
|
|
4007
|
+
}
|
|
3606
4008
|
};
|
|
3607
4009
|
|
|
3608
4010
|
// src/features/mcp/geminicli-mcp.ts
|
|
@@ -3677,6 +4079,19 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3677
4079
|
validate() {
|
|
3678
4080
|
return { success: true, error: null };
|
|
3679
4081
|
}
|
|
4082
|
+
static forDeletion({
|
|
4083
|
+
baseDir = process.cwd(),
|
|
4084
|
+
relativeDirPath,
|
|
4085
|
+
relativeFilePath
|
|
4086
|
+
}) {
|
|
4087
|
+
return new _GeminiCliMcp({
|
|
4088
|
+
baseDir,
|
|
4089
|
+
relativeDirPath,
|
|
4090
|
+
relativeFilePath,
|
|
4091
|
+
fileContent: "{}",
|
|
4092
|
+
validate: false
|
|
4093
|
+
});
|
|
4094
|
+
}
|
|
3680
4095
|
};
|
|
3681
4096
|
|
|
3682
4097
|
// src/features/mcp/junie-mcp.ts
|
|
@@ -3734,6 +4149,19 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
3734
4149
|
validate() {
|
|
3735
4150
|
return { success: true, error: null };
|
|
3736
4151
|
}
|
|
4152
|
+
static forDeletion({
|
|
4153
|
+
baseDir = process.cwd(),
|
|
4154
|
+
relativeDirPath,
|
|
4155
|
+
relativeFilePath
|
|
4156
|
+
}) {
|
|
4157
|
+
return new _JunieMcp({
|
|
4158
|
+
baseDir,
|
|
4159
|
+
relativeDirPath,
|
|
4160
|
+
relativeFilePath,
|
|
4161
|
+
fileContent: "{}",
|
|
4162
|
+
validate: false
|
|
4163
|
+
});
|
|
4164
|
+
}
|
|
3737
4165
|
};
|
|
3738
4166
|
|
|
3739
4167
|
// src/features/mcp/opencode-mcp.ts
|
|
@@ -3910,6 +4338,19 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
3910
4338
|
}
|
|
3911
4339
|
return { success: true, error: null };
|
|
3912
4340
|
}
|
|
4341
|
+
static forDeletion({
|
|
4342
|
+
baseDir = process.cwd(),
|
|
4343
|
+
relativeDirPath,
|
|
4344
|
+
relativeFilePath
|
|
4345
|
+
}) {
|
|
4346
|
+
return new _OpencodeMcp({
|
|
4347
|
+
baseDir,
|
|
4348
|
+
relativeDirPath,
|
|
4349
|
+
relativeFilePath,
|
|
4350
|
+
fileContent: "{}",
|
|
4351
|
+
validate: false
|
|
4352
|
+
});
|
|
4353
|
+
}
|
|
3913
4354
|
};
|
|
3914
4355
|
|
|
3915
4356
|
// src/features/mcp/roo-mcp.ts
|
|
@@ -4005,6 +4446,19 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4005
4446
|
validate() {
|
|
4006
4447
|
return { success: true, error: null };
|
|
4007
4448
|
}
|
|
4449
|
+
static forDeletion({
|
|
4450
|
+
baseDir = process.cwd(),
|
|
4451
|
+
relativeDirPath,
|
|
4452
|
+
relativeFilePath
|
|
4453
|
+
}) {
|
|
4454
|
+
return new _RooMcp({
|
|
4455
|
+
baseDir,
|
|
4456
|
+
relativeDirPath,
|
|
4457
|
+
relativeFilePath,
|
|
4458
|
+
fileContent: "{}",
|
|
4459
|
+
validate: false
|
|
4460
|
+
});
|
|
4461
|
+
}
|
|
4008
4462
|
};
|
|
4009
4463
|
|
|
4010
4464
|
// src/features/mcp/mcp-processor.ts
|
|
@@ -4158,6 +4612,18 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4158
4612
|
} = {}) {
|
|
4159
4613
|
try {
|
|
4160
4614
|
const factory = this.getFactory(this.toolTarget);
|
|
4615
|
+
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
4616
|
+
if (forDeletion) {
|
|
4617
|
+
const toolMcp = factory.class.forDeletion({
|
|
4618
|
+
baseDir: this.baseDir,
|
|
4619
|
+
relativeDirPath: paths.relativeDirPath,
|
|
4620
|
+
relativeFilePath: paths.relativeFilePath,
|
|
4621
|
+
global: this.global
|
|
4622
|
+
});
|
|
4623
|
+
const toolMcps2 = toolMcp.isDeletable() ? [toolMcp] : [];
|
|
4624
|
+
logger.info(`Successfully loaded ${toolMcps2.length} ${this.toolTarget} MCP files`);
|
|
4625
|
+
return toolMcps2;
|
|
4626
|
+
}
|
|
4161
4627
|
const toolMcps = [
|
|
4162
4628
|
await factory.class.fromFile({
|
|
4163
4629
|
baseDir: this.baseDir,
|
|
@@ -4166,9 +4632,6 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4166
4632
|
})
|
|
4167
4633
|
];
|
|
4168
4634
|
logger.info(`Successfully loaded ${toolMcps.length} ${this.toolTarget} MCP files`);
|
|
4169
|
-
if (forDeletion) {
|
|
4170
|
-
return toolMcps.filter((toolFile) => toolFile.isDeletable());
|
|
4171
|
-
}
|
|
4172
4635
|
return toolMcps;
|
|
4173
4636
|
} catch (error) {
|
|
4174
4637
|
const errorMessage = `Failed to load MCP files for tool target: ${this.toolTarget}: ${formatError(error)}`;
|
|
@@ -4241,9 +4704,9 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4241
4704
|
};
|
|
4242
4705
|
|
|
4243
4706
|
// src/features/rules/rules-processor.ts
|
|
4244
|
-
import { basename as basename20, join as
|
|
4707
|
+
import { basename as basename20, join as join83 } from "path";
|
|
4245
4708
|
import { encode } from "@toon-format/toon";
|
|
4246
|
-
import { z as
|
|
4709
|
+
import { z as z36 } from "zod/mini";
|
|
4247
4710
|
|
|
4248
4711
|
// src/constants/general.ts
|
|
4249
4712
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
@@ -4397,6 +4860,14 @@ var ToolSkill = class extends AiDir {
|
|
|
4397
4860
|
static async fromDir(_params) {
|
|
4398
4861
|
throw new Error("Please implement this method in the subclass.");
|
|
4399
4862
|
}
|
|
4863
|
+
/**
|
|
4864
|
+
* Create a minimal instance for deletion purposes.
|
|
4865
|
+
* This method does not read or parse directory content, making it safe to use
|
|
4866
|
+
* even when skill files have old/incompatible formats.
|
|
4867
|
+
*/
|
|
4868
|
+
static forDeletion(_params) {
|
|
4869
|
+
throw new Error("Please implement this method in the subclass.");
|
|
4870
|
+
}
|
|
4400
4871
|
/**
|
|
4401
4872
|
* Convert a RulesyncSkill to the tool-specific skill format.
|
|
4402
4873
|
*
|
|
@@ -4470,7 +4941,7 @@ var ToolSkill = class extends AiDir {
|
|
|
4470
4941
|
};
|
|
4471
4942
|
|
|
4472
4943
|
// src/features/skills/simulated-skill.ts
|
|
4473
|
-
var SimulatedSkillFrontmatterSchema = z19.
|
|
4944
|
+
var SimulatedSkillFrontmatterSchema = z19.looseObject({
|
|
4474
4945
|
name: z19.string(),
|
|
4475
4946
|
description: z19.string()
|
|
4476
4947
|
});
|
|
@@ -4588,6 +5059,26 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
4588
5059
|
validate: true
|
|
4589
5060
|
};
|
|
4590
5061
|
}
|
|
5062
|
+
/**
|
|
5063
|
+
* Create minimal params for deletion purposes.
|
|
5064
|
+
* This method does not read or parse directory content, making it safe to use
|
|
5065
|
+
* even when skill files have old/incompatible formats.
|
|
5066
|
+
*/
|
|
5067
|
+
static forDeletionDefault({
|
|
5068
|
+
baseDir = process.cwd(),
|
|
5069
|
+
relativeDirPath,
|
|
5070
|
+
dirName
|
|
5071
|
+
}) {
|
|
5072
|
+
return {
|
|
5073
|
+
baseDir,
|
|
5074
|
+
relativeDirPath,
|
|
5075
|
+
dirName,
|
|
5076
|
+
frontmatter: { name: "", description: "" },
|
|
5077
|
+
body: "",
|
|
5078
|
+
otherFiles: [],
|
|
5079
|
+
validate: false
|
|
5080
|
+
};
|
|
5081
|
+
}
|
|
4591
5082
|
/**
|
|
4592
5083
|
* Check if a RulesyncSkill should be converted to this simulated skill type.
|
|
4593
5084
|
* Uses the targets field in the RulesyncSkill frontmatter to determine targeting.
|
|
@@ -4639,26 +5130,156 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
4639
5130
|
toolTarget: "agentsmd"
|
|
4640
5131
|
});
|
|
4641
5132
|
}
|
|
5133
|
+
static forDeletion(params) {
|
|
5134
|
+
const baseParams = this.forDeletionDefault(params);
|
|
5135
|
+
return new _AgentsmdSkill(baseParams);
|
|
5136
|
+
}
|
|
4642
5137
|
};
|
|
4643
5138
|
|
|
4644
|
-
// src/features/skills/
|
|
5139
|
+
// src/features/skills/cursor-skill.ts
|
|
5140
|
+
import { join as join43 } from "path";
|
|
5141
|
+
var CursorSkill = class _CursorSkill extends SimulatedSkill {
|
|
5142
|
+
static getSettablePaths(options) {
|
|
5143
|
+
if (options?.global) {
|
|
5144
|
+
throw new Error("CursorSkill does not support global mode.");
|
|
5145
|
+
}
|
|
5146
|
+
return {
|
|
5147
|
+
relativeDirPath: join43(".cursor", "skills")
|
|
5148
|
+
};
|
|
5149
|
+
}
|
|
5150
|
+
static async fromDir(params) {
|
|
5151
|
+
const baseParams = await this.fromDirDefault(params);
|
|
5152
|
+
return new _CursorSkill(baseParams);
|
|
5153
|
+
}
|
|
5154
|
+
static fromRulesyncSkill(params) {
|
|
5155
|
+
const baseParams = {
|
|
5156
|
+
...this.fromRulesyncSkillDefault(params),
|
|
5157
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath
|
|
5158
|
+
};
|
|
5159
|
+
return new _CursorSkill(baseParams);
|
|
5160
|
+
}
|
|
5161
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
5162
|
+
return this.isTargetedByRulesyncSkillDefault({
|
|
5163
|
+
rulesyncSkill,
|
|
5164
|
+
toolTarget: "cursor"
|
|
5165
|
+
});
|
|
5166
|
+
}
|
|
5167
|
+
static forDeletion(params) {
|
|
5168
|
+
const baseParams = this.forDeletionDefault(params);
|
|
5169
|
+
return new _CursorSkill(baseParams);
|
|
5170
|
+
}
|
|
5171
|
+
};
|
|
5172
|
+
|
|
5173
|
+
// src/features/skills/geminicli-skill.ts
|
|
4645
5174
|
import { join as join44 } from "path";
|
|
5175
|
+
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5176
|
+
static getSettablePaths(options) {
|
|
5177
|
+
if (options?.global) {
|
|
5178
|
+
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5179
|
+
}
|
|
5180
|
+
return {
|
|
5181
|
+
relativeDirPath: join44(".gemini", "skills")
|
|
5182
|
+
};
|
|
5183
|
+
}
|
|
5184
|
+
static async fromDir(params) {
|
|
5185
|
+
const baseParams = await this.fromDirDefault(params);
|
|
5186
|
+
return new _GeminiCliSkill(baseParams);
|
|
5187
|
+
}
|
|
5188
|
+
static fromRulesyncSkill(params) {
|
|
5189
|
+
const baseParams = {
|
|
5190
|
+
...this.fromRulesyncSkillDefault(params),
|
|
5191
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath
|
|
5192
|
+
};
|
|
5193
|
+
return new _GeminiCliSkill(baseParams);
|
|
5194
|
+
}
|
|
5195
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
5196
|
+
return this.isTargetedByRulesyncSkillDefault({
|
|
5197
|
+
rulesyncSkill,
|
|
5198
|
+
toolTarget: "geminicli"
|
|
5199
|
+
});
|
|
5200
|
+
}
|
|
5201
|
+
static forDeletion(params) {
|
|
5202
|
+
const baseParams = this.forDeletionDefault(params);
|
|
5203
|
+
return new _GeminiCliSkill(baseParams);
|
|
5204
|
+
}
|
|
5205
|
+
};
|
|
5206
|
+
|
|
5207
|
+
// src/features/skills/skills-processor.ts
|
|
5208
|
+
import { basename as basename14, join as join51 } from "path";
|
|
5209
|
+
import { z as z25 } from "zod/mini";
|
|
5210
|
+
|
|
5211
|
+
// src/types/dir-feature-processor.ts
|
|
5212
|
+
import { join as join45 } from "path";
|
|
5213
|
+
var DirFeatureProcessor = class {
|
|
5214
|
+
baseDir;
|
|
5215
|
+
constructor({ baseDir = process.cwd() }) {
|
|
5216
|
+
this.baseDir = baseDir;
|
|
5217
|
+
}
|
|
5218
|
+
/**
|
|
5219
|
+
* Return tool targets that this feature supports.
|
|
5220
|
+
*/
|
|
5221
|
+
static getToolTargets(_params = {}) {
|
|
5222
|
+
throw new Error("Not implemented");
|
|
5223
|
+
}
|
|
5224
|
+
/**
|
|
5225
|
+
* Once converted to rulesync/tool dirs, write them to the filesystem.
|
|
5226
|
+
* Returns the number of directories written.
|
|
5227
|
+
*/
|
|
5228
|
+
async writeAiDirs(aiDirs) {
|
|
5229
|
+
for (const aiDir of aiDirs) {
|
|
5230
|
+
const dirPath = aiDir.getDirPath();
|
|
5231
|
+
await ensureDir(dirPath);
|
|
5232
|
+
const mainFile = aiDir.getMainFile();
|
|
5233
|
+
if (mainFile) {
|
|
5234
|
+
const mainFilePath = join45(dirPath, mainFile.name);
|
|
5235
|
+
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5236
|
+
const contentWithNewline = addTrailingNewline(content);
|
|
5237
|
+
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5238
|
+
}
|
|
5239
|
+
const otherFiles = aiDir.getOtherFiles();
|
|
5240
|
+
for (const file of otherFiles) {
|
|
5241
|
+
const filePath = join45(dirPath, file.relativeFilePathToDirPath);
|
|
5242
|
+
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5243
|
+
await writeFileContent(filePath, contentWithNewline);
|
|
5244
|
+
}
|
|
5245
|
+
}
|
|
5246
|
+
return aiDirs.length;
|
|
5247
|
+
}
|
|
5248
|
+
async removeAiDirs(aiDirs) {
|
|
5249
|
+
for (const aiDir of aiDirs) {
|
|
5250
|
+
await removeDirectory(aiDir.getDirPath());
|
|
5251
|
+
}
|
|
5252
|
+
}
|
|
5253
|
+
};
|
|
5254
|
+
|
|
5255
|
+
// src/features/skills/claudecode-skill.ts
|
|
5256
|
+
import { join as join47 } from "path";
|
|
4646
5257
|
import { z as z21 } from "zod/mini";
|
|
4647
5258
|
|
|
4648
5259
|
// src/features/skills/rulesync-skill.ts
|
|
4649
|
-
import { join as
|
|
5260
|
+
import { join as join46 } from "path";
|
|
4650
5261
|
import { z as z20 } from "zod/mini";
|
|
4651
|
-
var RulesyncSkillFrontmatterSchemaInternal = z20.
|
|
5262
|
+
var RulesyncSkillFrontmatterSchemaInternal = z20.looseObject({
|
|
4652
5263
|
name: z20.string(),
|
|
4653
5264
|
description: z20.string(),
|
|
4654
5265
|
targets: z20._default(RulesyncTargetsSchema, ["*"]),
|
|
4655
5266
|
claudecode: z20.optional(
|
|
4656
|
-
z20.
|
|
5267
|
+
z20.looseObject({
|
|
4657
5268
|
"allowed-tools": z20.optional(z20.array(z20.string()))
|
|
4658
5269
|
})
|
|
4659
|
-
)
|
|
4660
|
-
|
|
4661
|
-
|
|
5270
|
+
),
|
|
5271
|
+
opencode: z20.optional(
|
|
5272
|
+
z20.looseObject({
|
|
5273
|
+
"allowed-tools": z20.optional(z20.array(z20.string()))
|
|
5274
|
+
})
|
|
5275
|
+
),
|
|
5276
|
+
copilot: z20.optional(
|
|
5277
|
+
z20.looseObject({
|
|
5278
|
+
license: z20.optional(z20.string())
|
|
5279
|
+
})
|
|
5280
|
+
)
|
|
5281
|
+
});
|
|
5282
|
+
var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
|
|
4662
5283
|
var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
4663
5284
|
constructor({
|
|
4664
5285
|
baseDir = process.cwd(),
|
|
@@ -4722,8 +5343,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
4722
5343
|
dirName,
|
|
4723
5344
|
global = false
|
|
4724
5345
|
}) {
|
|
4725
|
-
const skillDirPath =
|
|
4726
|
-
const skillFilePath =
|
|
5346
|
+
const skillDirPath = join46(baseDir, relativeDirPath, dirName);
|
|
5347
|
+
const skillFilePath = join46(skillDirPath, SKILL_FILE_NAME);
|
|
4727
5348
|
if (!await fileExists(skillFilePath)) {
|
|
4728
5349
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
4729
5350
|
}
|
|
@@ -4752,15 +5373,180 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
4752
5373
|
}
|
|
4753
5374
|
};
|
|
4754
5375
|
|
|
4755
|
-
// src/features/skills/
|
|
4756
|
-
var
|
|
5376
|
+
// src/features/skills/claudecode-skill.ts
|
|
5377
|
+
var ClaudecodeSkillFrontmatterSchema = z21.looseObject({
|
|
4757
5378
|
name: z21.string(),
|
|
4758
|
-
description: z21.string()
|
|
5379
|
+
description: z21.string(),
|
|
5380
|
+
"allowed-tools": z21.optional(z21.array(z21.string()))
|
|
5381
|
+
});
|
|
5382
|
+
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
5383
|
+
constructor({
|
|
5384
|
+
baseDir = process.cwd(),
|
|
5385
|
+
relativeDirPath = join47(".claude", "skills"),
|
|
5386
|
+
dirName,
|
|
5387
|
+
frontmatter,
|
|
5388
|
+
body,
|
|
5389
|
+
otherFiles = [],
|
|
5390
|
+
validate = true,
|
|
5391
|
+
global = false
|
|
5392
|
+
}) {
|
|
5393
|
+
super({
|
|
5394
|
+
baseDir,
|
|
5395
|
+
relativeDirPath,
|
|
5396
|
+
dirName,
|
|
5397
|
+
mainFile: {
|
|
5398
|
+
name: SKILL_FILE_NAME,
|
|
5399
|
+
body,
|
|
5400
|
+
frontmatter: { ...frontmatter }
|
|
5401
|
+
},
|
|
5402
|
+
otherFiles,
|
|
5403
|
+
global
|
|
5404
|
+
});
|
|
5405
|
+
if (validate) {
|
|
5406
|
+
const result = this.validate();
|
|
5407
|
+
if (!result.success) {
|
|
5408
|
+
throw result.error;
|
|
5409
|
+
}
|
|
5410
|
+
}
|
|
5411
|
+
}
|
|
5412
|
+
static getSettablePaths({
|
|
5413
|
+
global: _global = false
|
|
5414
|
+
} = {}) {
|
|
5415
|
+
return {
|
|
5416
|
+
relativeDirPath: join47(".claude", "skills")
|
|
5417
|
+
};
|
|
5418
|
+
}
|
|
5419
|
+
getFrontmatter() {
|
|
5420
|
+
if (!this.mainFile?.frontmatter) {
|
|
5421
|
+
throw new Error("Frontmatter is not defined");
|
|
5422
|
+
}
|
|
5423
|
+
const result = ClaudecodeSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
5424
|
+
return result;
|
|
5425
|
+
}
|
|
5426
|
+
getBody() {
|
|
5427
|
+
return this.mainFile?.body ?? "";
|
|
5428
|
+
}
|
|
5429
|
+
validate() {
|
|
5430
|
+
if (this.mainFile === void 0) {
|
|
5431
|
+
return {
|
|
5432
|
+
success: false,
|
|
5433
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
5434
|
+
};
|
|
5435
|
+
}
|
|
5436
|
+
const result = ClaudecodeSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
5437
|
+
if (!result.success) {
|
|
5438
|
+
return {
|
|
5439
|
+
success: false,
|
|
5440
|
+
error: new Error(
|
|
5441
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
5442
|
+
)
|
|
5443
|
+
};
|
|
5444
|
+
}
|
|
5445
|
+
return { success: true, error: null };
|
|
5446
|
+
}
|
|
5447
|
+
toRulesyncSkill() {
|
|
5448
|
+
const frontmatter = this.getFrontmatter();
|
|
5449
|
+
const rulesyncFrontmatter = {
|
|
5450
|
+
name: frontmatter.name,
|
|
5451
|
+
description: frontmatter.description,
|
|
5452
|
+
targets: ["*"],
|
|
5453
|
+
...frontmatter["allowed-tools"] && {
|
|
5454
|
+
claudecode: {
|
|
5455
|
+
"allowed-tools": frontmatter["allowed-tools"]
|
|
5456
|
+
}
|
|
5457
|
+
}
|
|
5458
|
+
};
|
|
5459
|
+
return new RulesyncSkill({
|
|
5460
|
+
baseDir: this.baseDir,
|
|
5461
|
+
relativeDirPath: this.relativeDirPath,
|
|
5462
|
+
dirName: this.getDirName(),
|
|
5463
|
+
frontmatter: rulesyncFrontmatter,
|
|
5464
|
+
body: this.getBody(),
|
|
5465
|
+
otherFiles: this.getOtherFiles(),
|
|
5466
|
+
validate: true,
|
|
5467
|
+
global: this.global
|
|
5468
|
+
});
|
|
5469
|
+
}
|
|
5470
|
+
static fromRulesyncSkill({
|
|
5471
|
+
rulesyncSkill,
|
|
5472
|
+
validate = true,
|
|
5473
|
+
global = false
|
|
5474
|
+
}) {
|
|
5475
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
5476
|
+
const claudecodeFrontmatter = {
|
|
5477
|
+
name: rulesyncFrontmatter.name,
|
|
5478
|
+
description: rulesyncFrontmatter.description,
|
|
5479
|
+
"allowed-tools": rulesyncFrontmatter.claudecode?.["allowed-tools"]
|
|
5480
|
+
};
|
|
5481
|
+
const settablePaths = _ClaudecodeSkill.getSettablePaths({ global });
|
|
5482
|
+
return new _ClaudecodeSkill({
|
|
5483
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
5484
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
5485
|
+
dirName: rulesyncSkill.getDirName(),
|
|
5486
|
+
frontmatter: claudecodeFrontmatter,
|
|
5487
|
+
body: rulesyncSkill.getBody(),
|
|
5488
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
5489
|
+
validate,
|
|
5490
|
+
global
|
|
5491
|
+
});
|
|
5492
|
+
}
|
|
5493
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
5494
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
5495
|
+
return targets.includes("*") || targets.includes("claudecode");
|
|
5496
|
+
}
|
|
5497
|
+
static async fromDir(params) {
|
|
5498
|
+
const loaded = await this.loadSkillDirContent({
|
|
5499
|
+
...params,
|
|
5500
|
+
getSettablePaths: _ClaudecodeSkill.getSettablePaths
|
|
5501
|
+
});
|
|
5502
|
+
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5503
|
+
if (!result.success) {
|
|
5504
|
+
const skillDirPath = join47(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5505
|
+
throw new Error(
|
|
5506
|
+
`Invalid frontmatter in ${join47(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5507
|
+
);
|
|
5508
|
+
}
|
|
5509
|
+
return new _ClaudecodeSkill({
|
|
5510
|
+
baseDir: loaded.baseDir,
|
|
5511
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
5512
|
+
dirName: loaded.dirName,
|
|
5513
|
+
frontmatter: result.data,
|
|
5514
|
+
body: loaded.body,
|
|
5515
|
+
otherFiles: loaded.otherFiles,
|
|
5516
|
+
validate: true,
|
|
5517
|
+
global: loaded.global
|
|
5518
|
+
});
|
|
5519
|
+
}
|
|
5520
|
+
static forDeletion({
|
|
5521
|
+
baseDir = process.cwd(),
|
|
5522
|
+
relativeDirPath,
|
|
5523
|
+
dirName,
|
|
5524
|
+
global = false
|
|
5525
|
+
}) {
|
|
5526
|
+
return new _ClaudecodeSkill({
|
|
5527
|
+
baseDir,
|
|
5528
|
+
relativeDirPath,
|
|
5529
|
+
dirName,
|
|
5530
|
+
frontmatter: { name: "", description: "" },
|
|
5531
|
+
body: "",
|
|
5532
|
+
otherFiles: [],
|
|
5533
|
+
validate: false,
|
|
5534
|
+
global
|
|
5535
|
+
});
|
|
5536
|
+
}
|
|
5537
|
+
};
|
|
5538
|
+
|
|
5539
|
+
// src/features/skills/codexcli-skill.ts
|
|
5540
|
+
import { join as join48 } from "path";
|
|
5541
|
+
import { z as z22 } from "zod/mini";
|
|
5542
|
+
var CodexCliSkillFrontmatterSchema = z22.looseObject({
|
|
5543
|
+
name: z22.string(),
|
|
5544
|
+
description: z22.string()
|
|
4759
5545
|
});
|
|
4760
5546
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
4761
5547
|
constructor({
|
|
4762
5548
|
baseDir = process.cwd(),
|
|
4763
|
-
relativeDirPath =
|
|
5549
|
+
relativeDirPath = join48(".codex", "skills"),
|
|
4764
5550
|
dirName,
|
|
4765
5551
|
frontmatter,
|
|
4766
5552
|
body,
|
|
@@ -4792,7 +5578,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
4792
5578
|
throw new Error("CodexCliSkill only supports global mode. Please pass { global: true }.");
|
|
4793
5579
|
}
|
|
4794
5580
|
return {
|
|
4795
|
-
relativeDirPath:
|
|
5581
|
+
relativeDirPath: join48(".codex", "skills")
|
|
4796
5582
|
};
|
|
4797
5583
|
}
|
|
4798
5584
|
getFrontmatter() {
|
|
@@ -4874,9 +5660,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
4874
5660
|
});
|
|
4875
5661
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
4876
5662
|
if (!result.success) {
|
|
4877
|
-
const skillDirPath =
|
|
5663
|
+
const skillDirPath = join48(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
4878
5664
|
throw new Error(
|
|
4879
|
-
`Invalid frontmatter in ${
|
|
5665
|
+
`Invalid frontmatter in ${join48(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
4880
5666
|
);
|
|
4881
5667
|
}
|
|
4882
5668
|
return new _CodexCliSkill({
|
|
@@ -4890,158 +5676,204 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
4890
5676
|
global: loaded.global
|
|
4891
5677
|
});
|
|
4892
5678
|
}
|
|
5679
|
+
static forDeletion({
|
|
5680
|
+
baseDir = process.cwd(),
|
|
5681
|
+
relativeDirPath,
|
|
5682
|
+
dirName,
|
|
5683
|
+
global = false
|
|
5684
|
+
}) {
|
|
5685
|
+
return new _CodexCliSkill({
|
|
5686
|
+
baseDir,
|
|
5687
|
+
relativeDirPath,
|
|
5688
|
+
dirName,
|
|
5689
|
+
frontmatter: { name: "", description: "" },
|
|
5690
|
+
body: "",
|
|
5691
|
+
otherFiles: [],
|
|
5692
|
+
validate: false,
|
|
5693
|
+
global
|
|
5694
|
+
});
|
|
5695
|
+
}
|
|
4893
5696
|
};
|
|
4894
5697
|
|
|
4895
5698
|
// src/features/skills/copilot-skill.ts
|
|
4896
|
-
import { join as
|
|
4897
|
-
|
|
5699
|
+
import { join as join49 } from "path";
|
|
5700
|
+
import { z as z23 } from "zod/mini";
|
|
5701
|
+
var CopilotSkillFrontmatterSchema = z23.looseObject({
|
|
5702
|
+
name: z23.string(),
|
|
5703
|
+
description: z23.string(),
|
|
5704
|
+
license: z23.optional(z23.string())
|
|
5705
|
+
});
|
|
5706
|
+
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
5707
|
+
constructor({
|
|
5708
|
+
baseDir = process.cwd(),
|
|
5709
|
+
relativeDirPath = join49(".github", "skills"),
|
|
5710
|
+
dirName,
|
|
5711
|
+
frontmatter,
|
|
5712
|
+
body,
|
|
5713
|
+
otherFiles = [],
|
|
5714
|
+
validate = true,
|
|
5715
|
+
global = false
|
|
5716
|
+
}) {
|
|
5717
|
+
super({
|
|
5718
|
+
baseDir,
|
|
5719
|
+
relativeDirPath,
|
|
5720
|
+
dirName,
|
|
5721
|
+
mainFile: {
|
|
5722
|
+
name: SKILL_FILE_NAME,
|
|
5723
|
+
body,
|
|
5724
|
+
frontmatter: { ...frontmatter }
|
|
5725
|
+
},
|
|
5726
|
+
otherFiles,
|
|
5727
|
+
global
|
|
5728
|
+
});
|
|
5729
|
+
if (validate) {
|
|
5730
|
+
const result = this.validate();
|
|
5731
|
+
if (!result.success) {
|
|
5732
|
+
throw result.error;
|
|
5733
|
+
}
|
|
5734
|
+
}
|
|
5735
|
+
}
|
|
4898
5736
|
static getSettablePaths(options) {
|
|
4899
5737
|
if (options?.global) {
|
|
4900
5738
|
throw new Error("CopilotSkill does not support global mode.");
|
|
4901
5739
|
}
|
|
4902
5740
|
return {
|
|
4903
|
-
relativeDirPath:
|
|
5741
|
+
relativeDirPath: join49(".github", "skills")
|
|
4904
5742
|
};
|
|
4905
5743
|
}
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
...this.fromRulesyncSkillDefault(params),
|
|
4913
|
-
relativeDirPath: this.getSettablePaths().relativeDirPath
|
|
4914
|
-
};
|
|
4915
|
-
return new _CopilotSkill(baseParams);
|
|
5744
|
+
getFrontmatter() {
|
|
5745
|
+
if (!this.mainFile?.frontmatter) {
|
|
5746
|
+
throw new Error("Frontmatter is not defined");
|
|
5747
|
+
}
|
|
5748
|
+
const result = CopilotSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
5749
|
+
return result;
|
|
4916
5750
|
}
|
|
4917
|
-
|
|
4918
|
-
return this.
|
|
4919
|
-
rulesyncSkill,
|
|
4920
|
-
toolTarget: "copilot"
|
|
4921
|
-
});
|
|
5751
|
+
getBody() {
|
|
5752
|
+
return this.mainFile?.body ?? "";
|
|
4922
5753
|
}
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
if (options?.global) {
|
|
4930
|
-
throw new Error("CursorSkill does not support global mode.");
|
|
5754
|
+
validate() {
|
|
5755
|
+
if (!this.mainFile) {
|
|
5756
|
+
return {
|
|
5757
|
+
success: false,
|
|
5758
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
5759
|
+
};
|
|
4931
5760
|
}
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
5761
|
+
const result = CopilotSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
5762
|
+
if (!result.success) {
|
|
5763
|
+
return {
|
|
5764
|
+
success: false,
|
|
5765
|
+
error: new Error(
|
|
5766
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
5767
|
+
)
|
|
5768
|
+
};
|
|
5769
|
+
}
|
|
5770
|
+
return { success: true, error: null };
|
|
4939
5771
|
}
|
|
4940
|
-
|
|
4941
|
-
const
|
|
4942
|
-
|
|
4943
|
-
|
|
5772
|
+
toRulesyncSkill() {
|
|
5773
|
+
const frontmatter = this.getFrontmatter();
|
|
5774
|
+
const rulesyncFrontmatter = {
|
|
5775
|
+
name: frontmatter.name,
|
|
5776
|
+
description: frontmatter.description,
|
|
5777
|
+
targets: ["*"],
|
|
5778
|
+
...frontmatter.license && {
|
|
5779
|
+
copilot: {
|
|
5780
|
+
license: frontmatter.license
|
|
5781
|
+
}
|
|
5782
|
+
}
|
|
4944
5783
|
};
|
|
4945
|
-
return new
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
5784
|
+
return new RulesyncSkill({
|
|
5785
|
+
baseDir: this.baseDir,
|
|
5786
|
+
relativeDirPath: this.relativeDirPath,
|
|
5787
|
+
dirName: this.getDirName(),
|
|
5788
|
+
frontmatter: rulesyncFrontmatter,
|
|
5789
|
+
body: this.getBody(),
|
|
5790
|
+
otherFiles: this.getOtherFiles(),
|
|
5791
|
+
validate: true,
|
|
5792
|
+
global: this.global
|
|
4951
5793
|
});
|
|
4952
5794
|
}
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
};
|
|
4965
|
-
}
|
|
4966
|
-
static async fromDir(params) {
|
|
4967
|
-
const baseParams = await this.fromDirDefault(params);
|
|
4968
|
-
return new _GeminiCliSkill(baseParams);
|
|
4969
|
-
}
|
|
4970
|
-
static fromRulesyncSkill(params) {
|
|
4971
|
-
const baseParams = {
|
|
4972
|
-
...this.fromRulesyncSkillDefault(params),
|
|
4973
|
-
relativeDirPath: this.getSettablePaths().relativeDirPath
|
|
5795
|
+
static fromRulesyncSkill({
|
|
5796
|
+
rulesyncSkill,
|
|
5797
|
+
validate = true,
|
|
5798
|
+
global = false
|
|
5799
|
+
}) {
|
|
5800
|
+
const settablePaths = _CopilotSkill.getSettablePaths({ global });
|
|
5801
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
5802
|
+
const copilotFrontmatter = {
|
|
5803
|
+
name: rulesyncFrontmatter.name,
|
|
5804
|
+
description: rulesyncFrontmatter.description,
|
|
5805
|
+
license: rulesyncFrontmatter.copilot?.license
|
|
4974
5806
|
};
|
|
4975
|
-
return new
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
5807
|
+
return new _CopilotSkill({
|
|
5808
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
5809
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
5810
|
+
dirName: rulesyncSkill.getDirName(),
|
|
5811
|
+
frontmatter: copilotFrontmatter,
|
|
5812
|
+
body: rulesyncSkill.getBody(),
|
|
5813
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
5814
|
+
validate,
|
|
5815
|
+
global
|
|
4981
5816
|
});
|
|
4982
5817
|
}
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
import { basename as basename14, join as join50 } from "path";
|
|
4987
|
-
import { z as z23 } from "zod/mini";
|
|
4988
|
-
|
|
4989
|
-
// src/types/dir-feature-processor.ts
|
|
4990
|
-
import { join as join48 } from "path";
|
|
4991
|
-
var DirFeatureProcessor = class {
|
|
4992
|
-
baseDir;
|
|
4993
|
-
constructor({ baseDir = process.cwd() }) {
|
|
4994
|
-
this.baseDir = baseDir;
|
|
4995
|
-
}
|
|
4996
|
-
/**
|
|
4997
|
-
* Return tool targets that this feature supports.
|
|
4998
|
-
*/
|
|
4999
|
-
static getToolTargets(_params = {}) {
|
|
5000
|
-
throw new Error("Not implemented");
|
|
5818
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
5819
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
5820
|
+
return targets.includes("*") || targets.includes("copilot");
|
|
5001
5821
|
}
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5014
|
-
const contentWithNewline = addTrailingNewline(content);
|
|
5015
|
-
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5016
|
-
}
|
|
5017
|
-
const otherFiles = aiDir.getOtherFiles();
|
|
5018
|
-
for (const file of otherFiles) {
|
|
5019
|
-
const filePath = join48(dirPath, file.relativeFilePathToDirPath);
|
|
5020
|
-
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5021
|
-
await writeFileContent(filePath, contentWithNewline);
|
|
5022
|
-
}
|
|
5822
|
+
static async fromDir(params) {
|
|
5823
|
+
const loaded = await this.loadSkillDirContent({
|
|
5824
|
+
...params,
|
|
5825
|
+
getSettablePaths: _CopilotSkill.getSettablePaths
|
|
5826
|
+
});
|
|
5827
|
+
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5828
|
+
if (!result.success) {
|
|
5829
|
+
const skillDirPath = join49(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5830
|
+
throw new Error(
|
|
5831
|
+
`Invalid frontmatter in ${join49(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5832
|
+
);
|
|
5023
5833
|
}
|
|
5024
|
-
return
|
|
5834
|
+
return new _CopilotSkill({
|
|
5835
|
+
baseDir: loaded.baseDir,
|
|
5836
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
5837
|
+
dirName: loaded.dirName,
|
|
5838
|
+
frontmatter: result.data,
|
|
5839
|
+
body: loaded.body,
|
|
5840
|
+
otherFiles: loaded.otherFiles,
|
|
5841
|
+
validate: true,
|
|
5842
|
+
global: loaded.global
|
|
5843
|
+
});
|
|
5025
5844
|
}
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5845
|
+
static forDeletion({
|
|
5846
|
+
baseDir = process.cwd(),
|
|
5847
|
+
relativeDirPath,
|
|
5848
|
+
dirName,
|
|
5849
|
+
global = false
|
|
5850
|
+
}) {
|
|
5851
|
+
const settablePaths = _CopilotSkill.getSettablePaths({ global });
|
|
5852
|
+
return new _CopilotSkill({
|
|
5853
|
+
baseDir,
|
|
5854
|
+
relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
|
|
5855
|
+
dirName,
|
|
5856
|
+
frontmatter: { name: "", description: "" },
|
|
5857
|
+
body: "",
|
|
5858
|
+
otherFiles: [],
|
|
5859
|
+
validate: false,
|
|
5860
|
+
global
|
|
5861
|
+
});
|
|
5030
5862
|
}
|
|
5031
5863
|
};
|
|
5032
5864
|
|
|
5033
|
-
// src/features/skills/
|
|
5034
|
-
import { join as
|
|
5035
|
-
import { z as
|
|
5036
|
-
var
|
|
5037
|
-
name:
|
|
5038
|
-
description:
|
|
5039
|
-
"allowed-tools":
|
|
5865
|
+
// src/features/skills/opencode-skill.ts
|
|
5866
|
+
import { join as join50 } from "path";
|
|
5867
|
+
import { z as z24 } from "zod/mini";
|
|
5868
|
+
var OpenCodeSkillFrontmatterSchema = z24.looseObject({
|
|
5869
|
+
name: z24.string(),
|
|
5870
|
+
description: z24.string(),
|
|
5871
|
+
"allowed-tools": z24.optional(z24.array(z24.string()))
|
|
5040
5872
|
});
|
|
5041
|
-
var
|
|
5873
|
+
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
5042
5874
|
constructor({
|
|
5043
5875
|
baseDir = process.cwd(),
|
|
5044
|
-
relativeDirPath =
|
|
5876
|
+
relativeDirPath = join50(".opencode", "skills"),
|
|
5045
5877
|
dirName,
|
|
5046
5878
|
frontmatter,
|
|
5047
5879
|
body,
|
|
@@ -5068,18 +5900,16 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5068
5900
|
}
|
|
5069
5901
|
}
|
|
5070
5902
|
}
|
|
5071
|
-
static getSettablePaths({
|
|
5072
|
-
global: _global = false
|
|
5073
|
-
} = {}) {
|
|
5903
|
+
static getSettablePaths({ global = false } = {}) {
|
|
5074
5904
|
return {
|
|
5075
|
-
relativeDirPath:
|
|
5905
|
+
relativeDirPath: global ? join50(".config", "opencode", "skills") : join50(".opencode", "skills")
|
|
5076
5906
|
};
|
|
5077
5907
|
}
|
|
5078
5908
|
getFrontmatter() {
|
|
5079
5909
|
if (!this.mainFile?.frontmatter) {
|
|
5080
5910
|
throw new Error("Frontmatter is not defined");
|
|
5081
5911
|
}
|
|
5082
|
-
const result =
|
|
5912
|
+
const result = OpenCodeSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
5083
5913
|
return result;
|
|
5084
5914
|
}
|
|
5085
5915
|
getBody() {
|
|
@@ -5092,7 +5922,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5092
5922
|
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
5093
5923
|
};
|
|
5094
5924
|
}
|
|
5095
|
-
const result =
|
|
5925
|
+
const result = OpenCodeSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
5096
5926
|
if (!result.success) {
|
|
5097
5927
|
return {
|
|
5098
5928
|
success: false,
|
|
@@ -5110,7 +5940,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5110
5940
|
description: frontmatter.description,
|
|
5111
5941
|
targets: ["*"],
|
|
5112
5942
|
...frontmatter["allowed-tools"] && {
|
|
5113
|
-
|
|
5943
|
+
opencode: {
|
|
5114
5944
|
"allowed-tools": frontmatter["allowed-tools"]
|
|
5115
5945
|
}
|
|
5116
5946
|
}
|
|
@@ -5132,39 +5962,40 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5132
5962
|
global = false
|
|
5133
5963
|
}) {
|
|
5134
5964
|
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
5135
|
-
const
|
|
5965
|
+
const opencodeFrontmatter = {
|
|
5136
5966
|
name: rulesyncFrontmatter.name,
|
|
5137
5967
|
description: rulesyncFrontmatter.description,
|
|
5138
|
-
"allowed-tools": rulesyncFrontmatter.
|
|
5968
|
+
"allowed-tools": rulesyncFrontmatter.opencode?.["allowed-tools"]
|
|
5139
5969
|
};
|
|
5140
|
-
const settablePaths =
|
|
5141
|
-
return new
|
|
5970
|
+
const settablePaths = _OpenCodeSkill.getSettablePaths({ global });
|
|
5971
|
+
return new _OpenCodeSkill({
|
|
5142
5972
|
baseDir: rulesyncSkill.getBaseDir(),
|
|
5143
5973
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
5144
5974
|
dirName: rulesyncSkill.getDirName(),
|
|
5145
|
-
frontmatter:
|
|
5975
|
+
frontmatter: opencodeFrontmatter,
|
|
5146
5976
|
body: rulesyncSkill.getBody(),
|
|
5147
5977
|
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
5148
5978
|
validate,
|
|
5149
5979
|
global
|
|
5150
5980
|
});
|
|
5151
5981
|
}
|
|
5152
|
-
static isTargetedByRulesyncSkill(
|
|
5153
|
-
|
|
5982
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
5983
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
5984
|
+
return targets.includes("*") || targets.includes("opencode");
|
|
5154
5985
|
}
|
|
5155
5986
|
static async fromDir(params) {
|
|
5156
5987
|
const loaded = await this.loadSkillDirContent({
|
|
5157
5988
|
...params,
|
|
5158
|
-
getSettablePaths:
|
|
5989
|
+
getSettablePaths: _OpenCodeSkill.getSettablePaths
|
|
5159
5990
|
});
|
|
5160
|
-
const result =
|
|
5991
|
+
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5161
5992
|
if (!result.success) {
|
|
5162
|
-
const skillDirPath =
|
|
5993
|
+
const skillDirPath = join50(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5163
5994
|
throw new Error(
|
|
5164
|
-
`Invalid frontmatter in ${
|
|
5995
|
+
`Invalid frontmatter in ${join50(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5165
5996
|
);
|
|
5166
5997
|
}
|
|
5167
|
-
return new
|
|
5998
|
+
return new _OpenCodeSkill({
|
|
5168
5999
|
baseDir: loaded.baseDir,
|
|
5169
6000
|
relativeDirPath: loaded.relativeDirPath,
|
|
5170
6001
|
dirName: loaded.dirName,
|
|
@@ -5175,6 +6006,23 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5175
6006
|
global: loaded.global
|
|
5176
6007
|
});
|
|
5177
6008
|
}
|
|
6009
|
+
static forDeletion({
|
|
6010
|
+
baseDir = process.cwd(),
|
|
6011
|
+
relativeDirPath,
|
|
6012
|
+
dirName,
|
|
6013
|
+
global = false
|
|
6014
|
+
}) {
|
|
6015
|
+
return new _OpenCodeSkill({
|
|
6016
|
+
baseDir,
|
|
6017
|
+
relativeDirPath,
|
|
6018
|
+
dirName,
|
|
6019
|
+
frontmatter: { name: "", description: "" },
|
|
6020
|
+
body: "",
|
|
6021
|
+
otherFiles: [],
|
|
6022
|
+
validate: false,
|
|
6023
|
+
global
|
|
6024
|
+
});
|
|
6025
|
+
}
|
|
5178
6026
|
};
|
|
5179
6027
|
|
|
5180
6028
|
// src/features/skills/skills-processor.ts
|
|
@@ -5184,9 +6032,10 @@ var skillsProcessorToolTargetTuple = [
|
|
|
5184
6032
|
"codexcli",
|
|
5185
6033
|
"copilot",
|
|
5186
6034
|
"cursor",
|
|
5187
|
-
"geminicli"
|
|
6035
|
+
"geminicli",
|
|
6036
|
+
"opencode"
|
|
5188
6037
|
];
|
|
5189
|
-
var SkillsProcessorToolTargetSchema =
|
|
6038
|
+
var SkillsProcessorToolTargetSchema = z25.enum(skillsProcessorToolTargetTuple);
|
|
5190
6039
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
5191
6040
|
[
|
|
5192
6041
|
"agentsmd",
|
|
@@ -5213,7 +6062,7 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
5213
6062
|
"copilot",
|
|
5214
6063
|
{
|
|
5215
6064
|
class: CopilotSkill,
|
|
5216
|
-
meta: { supportsProject: true, supportsSimulated:
|
|
6065
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: false }
|
|
5217
6066
|
}
|
|
5218
6067
|
],
|
|
5219
6068
|
[
|
|
@@ -5229,6 +6078,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
5229
6078
|
class: GeminiCliSkill,
|
|
5230
6079
|
meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
|
|
5231
6080
|
}
|
|
6081
|
+
],
|
|
6082
|
+
[
|
|
6083
|
+
"opencode",
|
|
6084
|
+
{
|
|
6085
|
+
class: OpenCodeSkill,
|
|
6086
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
6087
|
+
}
|
|
5232
6088
|
]
|
|
5233
6089
|
]);
|
|
5234
6090
|
var defaultGetFactory4 = (target) => {
|
|
@@ -5308,8 +6164,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5308
6164
|
*/
|
|
5309
6165
|
async loadRulesyncDirs() {
|
|
5310
6166
|
const paths = RulesyncSkill.getSettablePaths();
|
|
5311
|
-
const rulesyncSkillsDirPath =
|
|
5312
|
-
const dirPaths = await findFilesByGlobs(
|
|
6167
|
+
const rulesyncSkillsDirPath = join51(this.baseDir, paths.relativeDirPath);
|
|
6168
|
+
const dirPaths = await findFilesByGlobs(join51(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
5313
6169
|
const dirNames = dirPaths.map((path3) => basename14(path3));
|
|
5314
6170
|
const rulesyncSkills = await Promise.all(
|
|
5315
6171
|
dirNames.map(
|
|
@@ -5326,8 +6182,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5326
6182
|
async loadToolDirs() {
|
|
5327
6183
|
const factory = this.getFactory(this.toolTarget);
|
|
5328
6184
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
5329
|
-
const skillsDirPath =
|
|
5330
|
-
const dirPaths = await findFilesByGlobs(
|
|
6185
|
+
const skillsDirPath = join51(this.baseDir, paths.relativeDirPath);
|
|
6186
|
+
const dirPaths = await findFilesByGlobs(join51(skillsDirPath, "*"), { type: "dir" });
|
|
5331
6187
|
const dirNames = dirPaths.map((path3) => basename14(path3));
|
|
5332
6188
|
const toolSkills = await Promise.all(
|
|
5333
6189
|
dirNames.map(
|
|
@@ -5342,7 +6198,23 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5342
6198
|
return toolSkills;
|
|
5343
6199
|
}
|
|
5344
6200
|
async loadToolDirsToDelete() {
|
|
5345
|
-
|
|
6201
|
+
const factory = this.getFactory(this.toolTarget);
|
|
6202
|
+
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
6203
|
+
const skillsDirPath = join51(this.baseDir, paths.relativeDirPath);
|
|
6204
|
+
const dirPaths = await findFilesByGlobs(join51(skillsDirPath, "*"), { type: "dir" });
|
|
6205
|
+
const dirNames = dirPaths.map((path3) => basename14(path3));
|
|
6206
|
+
const toolSkills = dirNames.map(
|
|
6207
|
+
(dirName) => factory.class.forDeletion({
|
|
6208
|
+
baseDir: this.baseDir,
|
|
6209
|
+
relativeDirPath: paths.relativeDirPath,
|
|
6210
|
+
dirName,
|
|
6211
|
+
global: this.global
|
|
6212
|
+
})
|
|
6213
|
+
);
|
|
6214
|
+
logger.info(
|
|
6215
|
+
`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills for deletion`
|
|
6216
|
+
);
|
|
6217
|
+
return toolSkills;
|
|
5346
6218
|
}
|
|
5347
6219
|
/**
|
|
5348
6220
|
* Implementation of abstract method from DirFeatureProcessor
|
|
@@ -5378,11 +6250,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5378
6250
|
};
|
|
5379
6251
|
|
|
5380
6252
|
// src/features/subagents/agentsmd-subagent.ts
|
|
5381
|
-
import { join as
|
|
6253
|
+
import { join as join53 } from "path";
|
|
5382
6254
|
|
|
5383
6255
|
// src/features/subagents/simulated-subagent.ts
|
|
5384
|
-
import { basename as basename15, join as
|
|
5385
|
-
import { z as
|
|
6256
|
+
import { basename as basename15, join as join52 } from "path";
|
|
6257
|
+
import { z as z26 } from "zod/mini";
|
|
5386
6258
|
|
|
5387
6259
|
// src/features/subagents/tool-subagent.ts
|
|
5388
6260
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -5392,6 +6264,14 @@ var ToolSubagent = class extends ToolFile {
|
|
|
5392
6264
|
static async fromFile(_params) {
|
|
5393
6265
|
throw new Error("Please implement this method in the subclass.");
|
|
5394
6266
|
}
|
|
6267
|
+
/**
|
|
6268
|
+
* Create a minimal instance for deletion purposes.
|
|
6269
|
+
* This method does not read or parse file content, making it safe to use
|
|
6270
|
+
* even when files have old/incompatible formats.
|
|
6271
|
+
*/
|
|
6272
|
+
static forDeletion(_params) {
|
|
6273
|
+
throw new Error("Please implement this method in the subclass.");
|
|
6274
|
+
}
|
|
5395
6275
|
static fromRulesyncSubagent(_params) {
|
|
5396
6276
|
throw new Error("Please implement this method in the subclass.");
|
|
5397
6277
|
}
|
|
@@ -5417,9 +6297,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
5417
6297
|
};
|
|
5418
6298
|
|
|
5419
6299
|
// src/features/subagents/simulated-subagent.ts
|
|
5420
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
5421
|
-
name:
|
|
5422
|
-
description:
|
|
6300
|
+
var SimulatedSubagentFrontmatterSchema = z26.object({
|
|
6301
|
+
name: z26.string(),
|
|
6302
|
+
description: z26.string()
|
|
5423
6303
|
});
|
|
5424
6304
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
5425
6305
|
frontmatter;
|
|
@@ -5429,7 +6309,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5429
6309
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5430
6310
|
if (!result.success) {
|
|
5431
6311
|
throw new Error(
|
|
5432
|
-
`Invalid frontmatter in ${
|
|
6312
|
+
`Invalid frontmatter in ${join52(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5433
6313
|
);
|
|
5434
6314
|
}
|
|
5435
6315
|
}
|
|
@@ -5480,7 +6360,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5480
6360
|
return {
|
|
5481
6361
|
success: false,
|
|
5482
6362
|
error: new Error(
|
|
5483
|
-
`Invalid frontmatter in ${
|
|
6363
|
+
`Invalid frontmatter in ${join52(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5484
6364
|
)
|
|
5485
6365
|
};
|
|
5486
6366
|
}
|
|
@@ -5490,7 +6370,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5490
6370
|
relativeFilePath,
|
|
5491
6371
|
validate = true
|
|
5492
6372
|
}) {
|
|
5493
|
-
const filePath =
|
|
6373
|
+
const filePath = join52(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
5494
6374
|
const fileContent = await readFileContent(filePath);
|
|
5495
6375
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5496
6376
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -5506,13 +6386,27 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5506
6386
|
validate
|
|
5507
6387
|
};
|
|
5508
6388
|
}
|
|
6389
|
+
static forDeletionDefault({
|
|
6390
|
+
baseDir = process.cwd(),
|
|
6391
|
+
relativeDirPath,
|
|
6392
|
+
relativeFilePath
|
|
6393
|
+
}) {
|
|
6394
|
+
return {
|
|
6395
|
+
baseDir,
|
|
6396
|
+
relativeDirPath,
|
|
6397
|
+
relativeFilePath,
|
|
6398
|
+
frontmatter: { name: "", description: "" },
|
|
6399
|
+
body: "",
|
|
6400
|
+
validate: false
|
|
6401
|
+
};
|
|
6402
|
+
}
|
|
5509
6403
|
};
|
|
5510
6404
|
|
|
5511
6405
|
// src/features/subagents/agentsmd-subagent.ts
|
|
5512
6406
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
5513
6407
|
static getSettablePaths() {
|
|
5514
6408
|
return {
|
|
5515
|
-
relativeDirPath:
|
|
6409
|
+
relativeDirPath: join53(".agents", "subagents")
|
|
5516
6410
|
};
|
|
5517
6411
|
}
|
|
5518
6412
|
static async fromFile(params) {
|
|
@@ -5529,14 +6423,17 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
5529
6423
|
toolTarget: "agentsmd"
|
|
5530
6424
|
});
|
|
5531
6425
|
}
|
|
6426
|
+
static forDeletion(params) {
|
|
6427
|
+
return new _AgentsmdSubagent(this.forDeletionDefault(params));
|
|
6428
|
+
}
|
|
5532
6429
|
};
|
|
5533
6430
|
|
|
5534
6431
|
// src/features/subagents/codexcli-subagent.ts
|
|
5535
|
-
import { join as
|
|
6432
|
+
import { join as join54 } from "path";
|
|
5536
6433
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
5537
6434
|
static getSettablePaths() {
|
|
5538
6435
|
return {
|
|
5539
|
-
relativeDirPath:
|
|
6436
|
+
relativeDirPath: join54(".codex", "subagents")
|
|
5540
6437
|
};
|
|
5541
6438
|
}
|
|
5542
6439
|
static async fromFile(params) {
|
|
@@ -5553,14 +6450,17 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
5553
6450
|
toolTarget: "codexcli"
|
|
5554
6451
|
});
|
|
5555
6452
|
}
|
|
6453
|
+
static forDeletion(params) {
|
|
6454
|
+
return new _CodexCliSubagent(this.forDeletionDefault(params));
|
|
6455
|
+
}
|
|
5556
6456
|
};
|
|
5557
6457
|
|
|
5558
6458
|
// src/features/subagents/copilot-subagent.ts
|
|
5559
|
-
import { join as
|
|
6459
|
+
import { join as join55 } from "path";
|
|
5560
6460
|
var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
5561
6461
|
static getSettablePaths() {
|
|
5562
6462
|
return {
|
|
5563
|
-
relativeDirPath:
|
|
6463
|
+
relativeDirPath: join55(".github", "subagents")
|
|
5564
6464
|
};
|
|
5565
6465
|
}
|
|
5566
6466
|
static async fromFile(params) {
|
|
@@ -5577,14 +6477,17 @@ var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
|
5577
6477
|
toolTarget: "copilot"
|
|
5578
6478
|
});
|
|
5579
6479
|
}
|
|
6480
|
+
static forDeletion(params) {
|
|
6481
|
+
return new _CopilotSubagent(this.forDeletionDefault(params));
|
|
6482
|
+
}
|
|
5580
6483
|
};
|
|
5581
6484
|
|
|
5582
6485
|
// src/features/subagents/cursor-subagent.ts
|
|
5583
|
-
import { join as
|
|
6486
|
+
import { join as join56 } from "path";
|
|
5584
6487
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
5585
6488
|
static getSettablePaths() {
|
|
5586
6489
|
return {
|
|
5587
|
-
relativeDirPath:
|
|
6490
|
+
relativeDirPath: join56(".cursor", "subagents")
|
|
5588
6491
|
};
|
|
5589
6492
|
}
|
|
5590
6493
|
static async fromFile(params) {
|
|
@@ -5601,14 +6504,17 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
5601
6504
|
toolTarget: "cursor"
|
|
5602
6505
|
});
|
|
5603
6506
|
}
|
|
6507
|
+
static forDeletion(params) {
|
|
6508
|
+
return new _CursorSubagent(this.forDeletionDefault(params));
|
|
6509
|
+
}
|
|
5604
6510
|
};
|
|
5605
6511
|
|
|
5606
6512
|
// src/features/subagents/geminicli-subagent.ts
|
|
5607
|
-
import { join as
|
|
6513
|
+
import { join as join57 } from "path";
|
|
5608
6514
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
5609
6515
|
static getSettablePaths() {
|
|
5610
6516
|
return {
|
|
5611
|
-
relativeDirPath:
|
|
6517
|
+
relativeDirPath: join57(".gemini", "subagents")
|
|
5612
6518
|
};
|
|
5613
6519
|
}
|
|
5614
6520
|
static async fromFile(params) {
|
|
@@ -5625,14 +6531,17 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
5625
6531
|
toolTarget: "geminicli"
|
|
5626
6532
|
});
|
|
5627
6533
|
}
|
|
6534
|
+
static forDeletion(params) {
|
|
6535
|
+
return new _GeminiCliSubagent(this.forDeletionDefault(params));
|
|
6536
|
+
}
|
|
5628
6537
|
};
|
|
5629
6538
|
|
|
5630
6539
|
// src/features/subagents/roo-subagent.ts
|
|
5631
|
-
import { join as
|
|
6540
|
+
import { join as join58 } from "path";
|
|
5632
6541
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
5633
6542
|
static getSettablePaths() {
|
|
5634
6543
|
return {
|
|
5635
|
-
relativeDirPath:
|
|
6544
|
+
relativeDirPath: join58(".roo", "subagents")
|
|
5636
6545
|
};
|
|
5637
6546
|
}
|
|
5638
6547
|
static async fromFile(params) {
|
|
@@ -5649,23 +6558,26 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
5649
6558
|
toolTarget: "roo"
|
|
5650
6559
|
});
|
|
5651
6560
|
}
|
|
6561
|
+
static forDeletion(params) {
|
|
6562
|
+
return new _RooSubagent(this.forDeletionDefault(params));
|
|
6563
|
+
}
|
|
5652
6564
|
};
|
|
5653
6565
|
|
|
5654
6566
|
// src/features/subagents/subagents-processor.ts
|
|
5655
|
-
import { basename as basename17, join as
|
|
5656
|
-
import { z as
|
|
6567
|
+
import { basename as basename17, join as join61 } from "path";
|
|
6568
|
+
import { z as z29 } from "zod/mini";
|
|
5657
6569
|
|
|
5658
6570
|
// src/features/subagents/claudecode-subagent.ts
|
|
5659
|
-
import { join as
|
|
5660
|
-
import { z as
|
|
6571
|
+
import { join as join60 } from "path";
|
|
6572
|
+
import { z as z28 } from "zod/mini";
|
|
5661
6573
|
|
|
5662
6574
|
// src/features/subagents/rulesync-subagent.ts
|
|
5663
|
-
import { basename as basename16, join as
|
|
5664
|
-
import { z as
|
|
5665
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
6575
|
+
import { basename as basename16, join as join59 } from "path";
|
|
6576
|
+
import { z as z27 } from "zod/mini";
|
|
6577
|
+
var RulesyncSubagentFrontmatterSchema = z27.looseObject({
|
|
5666
6578
|
targets: RulesyncTargetsSchema,
|
|
5667
|
-
name:
|
|
5668
|
-
description:
|
|
6579
|
+
name: z27.string(),
|
|
6580
|
+
description: z27.string()
|
|
5669
6581
|
});
|
|
5670
6582
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
5671
6583
|
frontmatter;
|
|
@@ -5675,7 +6587,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5675
6587
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5676
6588
|
if (!result.success) {
|
|
5677
6589
|
throw new Error(
|
|
5678
|
-
`Invalid frontmatter in ${
|
|
6590
|
+
`Invalid frontmatter in ${join59(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5679
6591
|
);
|
|
5680
6592
|
}
|
|
5681
6593
|
}
|
|
@@ -5708,7 +6620,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5708
6620
|
return {
|
|
5709
6621
|
success: false,
|
|
5710
6622
|
error: new Error(
|
|
5711
|
-
`Invalid frontmatter in ${
|
|
6623
|
+
`Invalid frontmatter in ${join59(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5712
6624
|
)
|
|
5713
6625
|
};
|
|
5714
6626
|
}
|
|
@@ -5717,7 +6629,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5717
6629
|
relativeFilePath
|
|
5718
6630
|
}) {
|
|
5719
6631
|
const fileContent = await readFileContent(
|
|
5720
|
-
|
|
6632
|
+
join59(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
5721
6633
|
);
|
|
5722
6634
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5723
6635
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -5736,13 +6648,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5736
6648
|
};
|
|
5737
6649
|
|
|
5738
6650
|
// src/features/subagents/claudecode-subagent.ts
|
|
5739
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
5740
|
-
name:
|
|
5741
|
-
description:
|
|
5742
|
-
model:
|
|
5743
|
-
tools:
|
|
5744
|
-
permissionMode:
|
|
5745
|
-
skills:
|
|
6651
|
+
var ClaudecodeSubagentFrontmatterSchema = z28.looseObject({
|
|
6652
|
+
name: z28.string(),
|
|
6653
|
+
description: z28.string(),
|
|
6654
|
+
model: z28.optional(z28.string()),
|
|
6655
|
+
tools: z28.optional(z28.union([z28.string(), z28.array(z28.string())])),
|
|
6656
|
+
permissionMode: z28.optional(z28.string()),
|
|
6657
|
+
skills: z28.optional(z28.union([z28.string(), z28.array(z28.string())]))
|
|
5746
6658
|
});
|
|
5747
6659
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
5748
6660
|
frontmatter;
|
|
@@ -5752,7 +6664,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5752
6664
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5753
6665
|
if (!result.success) {
|
|
5754
6666
|
throw new Error(
|
|
5755
|
-
`Invalid frontmatter in ${
|
|
6667
|
+
`Invalid frontmatter in ${join60(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5756
6668
|
);
|
|
5757
6669
|
}
|
|
5758
6670
|
}
|
|
@@ -5764,7 +6676,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5764
6676
|
}
|
|
5765
6677
|
static getSettablePaths(_options = {}) {
|
|
5766
6678
|
return {
|
|
5767
|
-
relativeDirPath:
|
|
6679
|
+
relativeDirPath: join60(".claude", "agents")
|
|
5768
6680
|
};
|
|
5769
6681
|
}
|
|
5770
6682
|
getFrontmatter() {
|
|
@@ -5838,7 +6750,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5838
6750
|
return {
|
|
5839
6751
|
success: false,
|
|
5840
6752
|
error: new Error(
|
|
5841
|
-
`Invalid frontmatter in ${
|
|
6753
|
+
`Invalid frontmatter in ${join60(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5842
6754
|
)
|
|
5843
6755
|
};
|
|
5844
6756
|
}
|
|
@@ -5856,7 +6768,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5856
6768
|
global = false
|
|
5857
6769
|
}) {
|
|
5858
6770
|
const paths = this.getSettablePaths({ global });
|
|
5859
|
-
const filePath =
|
|
6771
|
+
const filePath = join60(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
5860
6772
|
const fileContent = await readFileContent(filePath);
|
|
5861
6773
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5862
6774
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -5873,6 +6785,21 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5873
6785
|
validate
|
|
5874
6786
|
});
|
|
5875
6787
|
}
|
|
6788
|
+
static forDeletion({
|
|
6789
|
+
baseDir = process.cwd(),
|
|
6790
|
+
relativeDirPath,
|
|
6791
|
+
relativeFilePath
|
|
6792
|
+
}) {
|
|
6793
|
+
return new _ClaudecodeSubagent({
|
|
6794
|
+
baseDir,
|
|
6795
|
+
relativeDirPath,
|
|
6796
|
+
relativeFilePath,
|
|
6797
|
+
frontmatter: { name: "", description: "" },
|
|
6798
|
+
body: "",
|
|
6799
|
+
fileContent: "",
|
|
6800
|
+
validate: false
|
|
6801
|
+
});
|
|
6802
|
+
}
|
|
5876
6803
|
};
|
|
5877
6804
|
|
|
5878
6805
|
// src/features/subagents/subagents-processor.ts
|
|
@@ -5885,7 +6812,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
5885
6812
|
"geminicli",
|
|
5886
6813
|
"roo"
|
|
5887
6814
|
];
|
|
5888
|
-
var SubagentsProcessorToolTargetSchema =
|
|
6815
|
+
var SubagentsProcessorToolTargetSchema = z29.enum(subagentsProcessorToolTargetTuple);
|
|
5889
6816
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
5890
6817
|
[
|
|
5891
6818
|
"agentsmd",
|
|
@@ -5988,7 +6915,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
5988
6915
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
5989
6916
|
*/
|
|
5990
6917
|
async loadRulesyncFiles() {
|
|
5991
|
-
const subagentsDir =
|
|
6918
|
+
const subagentsDir = join61(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
5992
6919
|
const dirExists = await directoryExists(subagentsDir);
|
|
5993
6920
|
if (!dirExists) {
|
|
5994
6921
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -6003,7 +6930,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
6003
6930
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
6004
6931
|
const rulesyncSubagents = [];
|
|
6005
6932
|
for (const mdFile of mdFiles) {
|
|
6006
|
-
const filepath =
|
|
6933
|
+
const filepath = join61(subagentsDir, mdFile);
|
|
6007
6934
|
try {
|
|
6008
6935
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
6009
6936
|
relativeFilePath: mdFile,
|
|
@@ -6033,8 +6960,20 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
6033
6960
|
const factory = this.getFactory(this.toolTarget);
|
|
6034
6961
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
6035
6962
|
const subagentFilePaths = await findFilesByGlobs(
|
|
6036
|
-
|
|
6963
|
+
join61(this.baseDir, paths.relativeDirPath, "*.md")
|
|
6037
6964
|
);
|
|
6965
|
+
if (forDeletion) {
|
|
6966
|
+
const toolSubagents2 = subagentFilePaths.map(
|
|
6967
|
+
(path3) => factory.class.forDeletion({
|
|
6968
|
+
baseDir: this.baseDir,
|
|
6969
|
+
relativeDirPath: paths.relativeDirPath,
|
|
6970
|
+
relativeFilePath: basename17(path3),
|
|
6971
|
+
global: this.global
|
|
6972
|
+
})
|
|
6973
|
+
).filter((subagent) => subagent.isDeletable());
|
|
6974
|
+
logger.info(`Successfully loaded ${toolSubagents2.length} ${paths.relativeDirPath} subagents`);
|
|
6975
|
+
return toolSubagents2;
|
|
6976
|
+
}
|
|
6038
6977
|
const toolSubagents = await Promise.all(
|
|
6039
6978
|
subagentFilePaths.map(
|
|
6040
6979
|
(path3) => factory.class.fromFile({
|
|
@@ -6044,9 +6983,8 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
6044
6983
|
})
|
|
6045
6984
|
)
|
|
6046
6985
|
);
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
return result;
|
|
6986
|
+
logger.info(`Successfully loaded ${toolSubagents.length} ${paths.relativeDirPath} subagents`);
|
|
6987
|
+
return toolSubagents;
|
|
6050
6988
|
}
|
|
6051
6989
|
/**
|
|
6052
6990
|
* Implementation of abstract method from FeatureProcessor
|
|
@@ -6072,48 +7010,48 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
6072
7010
|
};
|
|
6073
7011
|
|
|
6074
7012
|
// src/features/rules/agentsmd-rule.ts
|
|
6075
|
-
import { join as
|
|
7013
|
+
import { join as join64 } from "path";
|
|
6076
7014
|
|
|
6077
7015
|
// src/features/rules/tool-rule.ts
|
|
6078
|
-
import { join as
|
|
7016
|
+
import { join as join63 } from "path";
|
|
6079
7017
|
|
|
6080
7018
|
// src/features/rules/rulesync-rule.ts
|
|
6081
|
-
import { basename as basename18, join as
|
|
6082
|
-
import { z as
|
|
6083
|
-
var RulesyncRuleFrontmatterSchema =
|
|
6084
|
-
root:
|
|
6085
|
-
targets:
|
|
6086
|
-
description:
|
|
6087
|
-
globs:
|
|
6088
|
-
agentsmd:
|
|
6089
|
-
|
|
7019
|
+
import { basename as basename18, join as join62 } from "path";
|
|
7020
|
+
import { z as z30 } from "zod/mini";
|
|
7021
|
+
var RulesyncRuleFrontmatterSchema = z30.object({
|
|
7022
|
+
root: z30.optional(z30.optional(z30.boolean())),
|
|
7023
|
+
targets: z30.optional(RulesyncTargetsSchema),
|
|
7024
|
+
description: z30.optional(z30.string()),
|
|
7025
|
+
globs: z30.optional(z30.array(z30.string())),
|
|
7026
|
+
agentsmd: z30.optional(
|
|
7027
|
+
z30.object({
|
|
6090
7028
|
// @example "path/to/subproject"
|
|
6091
|
-
subprojectPath:
|
|
7029
|
+
subprojectPath: z30.optional(z30.string())
|
|
6092
7030
|
})
|
|
6093
7031
|
),
|
|
6094
|
-
claudecode:
|
|
6095
|
-
|
|
7032
|
+
claudecode: z30.optional(
|
|
7033
|
+
z30.object({
|
|
6096
7034
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
6097
7035
|
// @example "src/**/*.ts, tests/**/*.test.ts"
|
|
6098
|
-
paths:
|
|
7036
|
+
paths: z30.optional(z30.string())
|
|
6099
7037
|
})
|
|
6100
7038
|
),
|
|
6101
|
-
cursor:
|
|
6102
|
-
|
|
6103
|
-
alwaysApply:
|
|
6104
|
-
description:
|
|
6105
|
-
globs:
|
|
7039
|
+
cursor: z30.optional(
|
|
7040
|
+
z30.object({
|
|
7041
|
+
alwaysApply: z30.optional(z30.boolean()),
|
|
7042
|
+
description: z30.optional(z30.string()),
|
|
7043
|
+
globs: z30.optional(z30.array(z30.string()))
|
|
6106
7044
|
})
|
|
6107
7045
|
),
|
|
6108
|
-
copilot:
|
|
6109
|
-
|
|
6110
|
-
excludeAgent:
|
|
7046
|
+
copilot: z30.optional(
|
|
7047
|
+
z30.object({
|
|
7048
|
+
excludeAgent: z30.optional(z30.union([z30.literal("code-review"), z30.literal("coding-agent")]))
|
|
6111
7049
|
})
|
|
6112
7050
|
),
|
|
6113
|
-
antigravity:
|
|
6114
|
-
|
|
6115
|
-
trigger:
|
|
6116
|
-
globs:
|
|
7051
|
+
antigravity: z30.optional(
|
|
7052
|
+
z30.looseObject({
|
|
7053
|
+
trigger: z30.optional(z30.string()),
|
|
7054
|
+
globs: z30.optional(z30.array(z30.string()))
|
|
6117
7055
|
})
|
|
6118
7056
|
)
|
|
6119
7057
|
});
|
|
@@ -6125,7 +7063,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6125
7063
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
6126
7064
|
if (!result.success) {
|
|
6127
7065
|
throw new Error(
|
|
6128
|
-
`Invalid frontmatter in ${
|
|
7066
|
+
`Invalid frontmatter in ${join62(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6129
7067
|
);
|
|
6130
7068
|
}
|
|
6131
7069
|
}
|
|
@@ -6140,6 +7078,9 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6140
7078
|
return {
|
|
6141
7079
|
recommended: {
|
|
6142
7080
|
relativeDirPath: RULESYNC_RULES_RELATIVE_DIR_PATH
|
|
7081
|
+
},
|
|
7082
|
+
legacy: {
|
|
7083
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH
|
|
6143
7084
|
}
|
|
6144
7085
|
};
|
|
6145
7086
|
}
|
|
@@ -6157,16 +7098,54 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6157
7098
|
return {
|
|
6158
7099
|
success: false,
|
|
6159
7100
|
error: new Error(
|
|
6160
|
-
`Invalid frontmatter in ${
|
|
7101
|
+
`Invalid frontmatter in ${join62(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
6161
7102
|
)
|
|
6162
7103
|
};
|
|
6163
7104
|
}
|
|
6164
7105
|
}
|
|
7106
|
+
static async fromFileLegacy({
|
|
7107
|
+
relativeFilePath,
|
|
7108
|
+
validate = true
|
|
7109
|
+
}) {
|
|
7110
|
+
const legacyPath = join62(
|
|
7111
|
+
process.cwd(),
|
|
7112
|
+
this.getSettablePaths().legacy.relativeDirPath,
|
|
7113
|
+
relativeFilePath
|
|
7114
|
+
);
|
|
7115
|
+
const recommendedPath = join62(
|
|
7116
|
+
this.getSettablePaths().recommended.relativeDirPath,
|
|
7117
|
+
relativeFilePath
|
|
7118
|
+
);
|
|
7119
|
+
logger.warn(`\u26A0\uFE0F Using deprecated path "${legacyPath}". Please migrate to "${recommendedPath}"`);
|
|
7120
|
+
const fileContent = await readFileContent(legacyPath);
|
|
7121
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7122
|
+
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7123
|
+
if (!result.success) {
|
|
7124
|
+
throw new Error(`Invalid frontmatter in ${legacyPath}: ${formatError(result.error)}`);
|
|
7125
|
+
}
|
|
7126
|
+
const validatedFrontmatter = {
|
|
7127
|
+
root: result.data.root ?? false,
|
|
7128
|
+
targets: result.data.targets ?? ["*"],
|
|
7129
|
+
description: result.data.description ?? "",
|
|
7130
|
+
globs: result.data.globs ?? [],
|
|
7131
|
+
agentsmd: result.data.agentsmd,
|
|
7132
|
+
cursor: result.data.cursor
|
|
7133
|
+
};
|
|
7134
|
+
const filename = basename18(legacyPath);
|
|
7135
|
+
return new _RulesyncRule({
|
|
7136
|
+
baseDir: process.cwd(),
|
|
7137
|
+
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
7138
|
+
relativeFilePath: filename,
|
|
7139
|
+
frontmatter: validatedFrontmatter,
|
|
7140
|
+
body: content.trim(),
|
|
7141
|
+
validate
|
|
7142
|
+
});
|
|
7143
|
+
}
|
|
6165
7144
|
static async fromFile({
|
|
6166
7145
|
relativeFilePath,
|
|
6167
7146
|
validate = true
|
|
6168
7147
|
}) {
|
|
6169
|
-
const filePath =
|
|
7148
|
+
const filePath = join62(
|
|
6170
7149
|
process.cwd(),
|
|
6171
7150
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
6172
7151
|
relativeFilePath
|
|
@@ -6217,6 +7196,14 @@ var ToolRule = class extends ToolFile {
|
|
|
6217
7196
|
static async fromFile(_params) {
|
|
6218
7197
|
throw new Error("Please implement this method in the subclass.");
|
|
6219
7198
|
}
|
|
7199
|
+
/**
|
|
7200
|
+
* Create a minimal instance for deletion purposes.
|
|
7201
|
+
* This method does not read or parse file content, making it safe to use
|
|
7202
|
+
* even when files have old/incompatible formats.
|
|
7203
|
+
*/
|
|
7204
|
+
static forDeletion(_params) {
|
|
7205
|
+
throw new Error("Please implement this method in the subclass.");
|
|
7206
|
+
}
|
|
6220
7207
|
static fromRulesyncRule(_params) {
|
|
6221
7208
|
throw new Error("Please implement this method in the subclass.");
|
|
6222
7209
|
}
|
|
@@ -6260,7 +7247,7 @@ var ToolRule = class extends ToolFile {
|
|
|
6260
7247
|
rulesyncRule,
|
|
6261
7248
|
validate = true,
|
|
6262
7249
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
6263
|
-
nonRootPath = { relativeDirPath:
|
|
7250
|
+
nonRootPath = { relativeDirPath: join63(".agents", "memories") }
|
|
6264
7251
|
}) {
|
|
6265
7252
|
const params = this.buildToolRuleParamsDefault({
|
|
6266
7253
|
baseDir,
|
|
@@ -6271,7 +7258,7 @@ var ToolRule = class extends ToolFile {
|
|
|
6271
7258
|
});
|
|
6272
7259
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
6273
7260
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
6274
|
-
params.relativeDirPath =
|
|
7261
|
+
params.relativeDirPath = join63(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
6275
7262
|
params.relativeFilePath = "AGENTS.md";
|
|
6276
7263
|
}
|
|
6277
7264
|
return params;
|
|
@@ -6336,7 +7323,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6336
7323
|
relativeFilePath: "AGENTS.md"
|
|
6337
7324
|
},
|
|
6338
7325
|
nonRoot: {
|
|
6339
|
-
relativeDirPath:
|
|
7326
|
+
relativeDirPath: join64(".agents", "memories")
|
|
6340
7327
|
}
|
|
6341
7328
|
};
|
|
6342
7329
|
}
|
|
@@ -6346,8 +7333,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6346
7333
|
validate = true
|
|
6347
7334
|
}) {
|
|
6348
7335
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
6349
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
6350
|
-
const fileContent = await readFileContent(
|
|
7336
|
+
const relativePath = isRoot ? "AGENTS.md" : join64(".agents", "memories", relativeFilePath);
|
|
7337
|
+
const fileContent = await readFileContent(join64(baseDir, relativePath));
|
|
6351
7338
|
return new _AgentsMdRule({
|
|
6352
7339
|
baseDir,
|
|
6353
7340
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -6357,6 +7344,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6357
7344
|
root: isRoot
|
|
6358
7345
|
});
|
|
6359
7346
|
}
|
|
7347
|
+
static forDeletion({
|
|
7348
|
+
baseDir = process.cwd(),
|
|
7349
|
+
relativeDirPath,
|
|
7350
|
+
relativeFilePath
|
|
7351
|
+
}) {
|
|
7352
|
+
const isRoot = relativeFilePath === "AGENTS.md" && relativeDirPath === ".";
|
|
7353
|
+
return new _AgentsMdRule({
|
|
7354
|
+
baseDir,
|
|
7355
|
+
relativeDirPath,
|
|
7356
|
+
relativeFilePath,
|
|
7357
|
+
fileContent: "",
|
|
7358
|
+
validate: false,
|
|
7359
|
+
root: isRoot
|
|
7360
|
+
});
|
|
7361
|
+
}
|
|
6360
7362
|
static fromRulesyncRule({
|
|
6361
7363
|
baseDir = process.cwd(),
|
|
6362
7364
|
rulesyncRule,
|
|
@@ -6387,12 +7389,12 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6387
7389
|
};
|
|
6388
7390
|
|
|
6389
7391
|
// src/features/rules/amazonqcli-rule.ts
|
|
6390
|
-
import { join as
|
|
7392
|
+
import { join as join65 } from "path";
|
|
6391
7393
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
6392
7394
|
static getSettablePaths() {
|
|
6393
7395
|
return {
|
|
6394
7396
|
nonRoot: {
|
|
6395
|
-
relativeDirPath:
|
|
7397
|
+
relativeDirPath: join65(".amazonq", "rules")
|
|
6396
7398
|
}
|
|
6397
7399
|
};
|
|
6398
7400
|
}
|
|
@@ -6402,7 +7404,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
6402
7404
|
validate = true
|
|
6403
7405
|
}) {
|
|
6404
7406
|
const fileContent = await readFileContent(
|
|
6405
|
-
|
|
7407
|
+
join65(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6406
7408
|
);
|
|
6407
7409
|
return new _AmazonQCliRule({
|
|
6408
7410
|
baseDir,
|
|
@@ -6433,6 +7435,20 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
6433
7435
|
validate() {
|
|
6434
7436
|
return { success: true, error: null };
|
|
6435
7437
|
}
|
|
7438
|
+
static forDeletion({
|
|
7439
|
+
baseDir = process.cwd(),
|
|
7440
|
+
relativeDirPath,
|
|
7441
|
+
relativeFilePath
|
|
7442
|
+
}) {
|
|
7443
|
+
return new _AmazonQCliRule({
|
|
7444
|
+
baseDir,
|
|
7445
|
+
relativeDirPath,
|
|
7446
|
+
relativeFilePath,
|
|
7447
|
+
fileContent: "",
|
|
7448
|
+
validate: false,
|
|
7449
|
+
root: false
|
|
7450
|
+
});
|
|
7451
|
+
}
|
|
6436
7452
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
6437
7453
|
return this.isTargetedByRulesyncRuleDefault({
|
|
6438
7454
|
rulesyncRule,
|
|
@@ -6442,21 +7458,21 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
6442
7458
|
};
|
|
6443
7459
|
|
|
6444
7460
|
// src/features/rules/antigravity-rule.ts
|
|
6445
|
-
import { join as
|
|
6446
|
-
import { z as
|
|
6447
|
-
var AntigravityRuleFrontmatterSchema =
|
|
6448
|
-
trigger:
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
7461
|
+
import { join as join66 } from "path";
|
|
7462
|
+
import { z as z31 } from "zod/mini";
|
|
7463
|
+
var AntigravityRuleFrontmatterSchema = z31.looseObject({
|
|
7464
|
+
trigger: z31.optional(
|
|
7465
|
+
z31.union([
|
|
7466
|
+
z31.literal("always_on"),
|
|
7467
|
+
z31.literal("glob"),
|
|
7468
|
+
z31.literal("manual"),
|
|
7469
|
+
z31.literal("model_decision"),
|
|
7470
|
+
z31.string()
|
|
6455
7471
|
// accepts any string for forward compatibility
|
|
6456
7472
|
])
|
|
6457
7473
|
),
|
|
6458
|
-
globs:
|
|
6459
|
-
description:
|
|
7474
|
+
globs: z31.optional(z31.string()),
|
|
7475
|
+
description: z31.optional(z31.string())
|
|
6460
7476
|
});
|
|
6461
7477
|
function parseGlobsString(globs) {
|
|
6462
7478
|
if (!globs) {
|
|
@@ -6601,7 +7617,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
6601
7617
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
6602
7618
|
if (!result.success) {
|
|
6603
7619
|
throw new Error(
|
|
6604
|
-
`Invalid frontmatter in ${
|
|
7620
|
+
`Invalid frontmatter in ${join66(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6605
7621
|
);
|
|
6606
7622
|
}
|
|
6607
7623
|
}
|
|
@@ -6616,7 +7632,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
6616
7632
|
static getSettablePaths() {
|
|
6617
7633
|
return {
|
|
6618
7634
|
nonRoot: {
|
|
6619
|
-
relativeDirPath:
|
|
7635
|
+
relativeDirPath: join66(".agent", "rules")
|
|
6620
7636
|
}
|
|
6621
7637
|
};
|
|
6622
7638
|
}
|
|
@@ -6625,7 +7641,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
6625
7641
|
relativeFilePath,
|
|
6626
7642
|
validate = true
|
|
6627
7643
|
}) {
|
|
6628
|
-
const filePath =
|
|
7644
|
+
const filePath = join66(
|
|
6629
7645
|
baseDir,
|
|
6630
7646
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
6631
7647
|
relativeFilePath
|
|
@@ -6742,6 +7758,21 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
6742
7758
|
}
|
|
6743
7759
|
return { success: true, error: null };
|
|
6744
7760
|
}
|
|
7761
|
+
static forDeletion({
|
|
7762
|
+
baseDir = process.cwd(),
|
|
7763
|
+
relativeDirPath,
|
|
7764
|
+
relativeFilePath
|
|
7765
|
+
}) {
|
|
7766
|
+
return new _AntigravityRule({
|
|
7767
|
+
baseDir,
|
|
7768
|
+
relativeDirPath,
|
|
7769
|
+
relativeFilePath,
|
|
7770
|
+
frontmatter: {},
|
|
7771
|
+
body: "",
|
|
7772
|
+
validate: false,
|
|
7773
|
+
root: false
|
|
7774
|
+
});
|
|
7775
|
+
}
|
|
6745
7776
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
6746
7777
|
return this.isTargetedByRulesyncRuleDefault({
|
|
6747
7778
|
rulesyncRule,
|
|
@@ -6751,7 +7782,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
6751
7782
|
};
|
|
6752
7783
|
|
|
6753
7784
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
6754
|
-
import { join as
|
|
7785
|
+
import { join as join67 } from "path";
|
|
6755
7786
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
6756
7787
|
toRulesyncRule() {
|
|
6757
7788
|
const rulesyncFrontmatter = {
|
|
@@ -6777,7 +7808,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6777
7808
|
relativeFilePath: ".augment-guidelines"
|
|
6778
7809
|
},
|
|
6779
7810
|
nonRoot: {
|
|
6780
|
-
relativeDirPath:
|
|
7811
|
+
relativeDirPath: join67(".augment", "rules")
|
|
6781
7812
|
}
|
|
6782
7813
|
};
|
|
6783
7814
|
}
|
|
@@ -6812,8 +7843,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6812
7843
|
}) {
|
|
6813
7844
|
const settablePaths = this.getSettablePaths();
|
|
6814
7845
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
6815
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
6816
|
-
const fileContent = await readFileContent(
|
|
7846
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join67(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
7847
|
+
const fileContent = await readFileContent(join67(baseDir, relativePath));
|
|
6817
7848
|
return new _AugmentcodeLegacyRule({
|
|
6818
7849
|
baseDir,
|
|
6819
7850
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -6823,10 +7854,26 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6823
7854
|
root: isRoot
|
|
6824
7855
|
});
|
|
6825
7856
|
}
|
|
7857
|
+
static forDeletion({
|
|
7858
|
+
baseDir = process.cwd(),
|
|
7859
|
+
relativeDirPath,
|
|
7860
|
+
relativeFilePath
|
|
7861
|
+
}) {
|
|
7862
|
+
const settablePaths = this.getSettablePaths();
|
|
7863
|
+
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
7864
|
+
return new _AugmentcodeLegacyRule({
|
|
7865
|
+
baseDir,
|
|
7866
|
+
relativeDirPath,
|
|
7867
|
+
relativeFilePath,
|
|
7868
|
+
fileContent: "",
|
|
7869
|
+
validate: false,
|
|
7870
|
+
root: isRoot
|
|
7871
|
+
});
|
|
7872
|
+
}
|
|
6826
7873
|
};
|
|
6827
7874
|
|
|
6828
7875
|
// src/features/rules/augmentcode-rule.ts
|
|
6829
|
-
import { join as
|
|
7876
|
+
import { join as join68 } from "path";
|
|
6830
7877
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
6831
7878
|
toRulesyncRule() {
|
|
6832
7879
|
return this.toRulesyncRuleDefault();
|
|
@@ -6834,7 +7881,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6834
7881
|
static getSettablePaths() {
|
|
6835
7882
|
return {
|
|
6836
7883
|
nonRoot: {
|
|
6837
|
-
relativeDirPath:
|
|
7884
|
+
relativeDirPath: join68(".augment", "rules")
|
|
6838
7885
|
}
|
|
6839
7886
|
};
|
|
6840
7887
|
}
|
|
@@ -6858,7 +7905,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6858
7905
|
validate = true
|
|
6859
7906
|
}) {
|
|
6860
7907
|
const fileContent = await readFileContent(
|
|
6861
|
-
|
|
7908
|
+
join68(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6862
7909
|
);
|
|
6863
7910
|
const { body: content } = parseFrontmatter(fileContent);
|
|
6864
7911
|
return new _AugmentcodeRule({
|
|
@@ -6869,9 +7916,22 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6869
7916
|
validate
|
|
6870
7917
|
});
|
|
6871
7918
|
}
|
|
6872
|
-
validate() {
|
|
6873
|
-
return { success: true, error: null };
|
|
6874
|
-
}
|
|
7919
|
+
validate() {
|
|
7920
|
+
return { success: true, error: null };
|
|
7921
|
+
}
|
|
7922
|
+
static forDeletion({
|
|
7923
|
+
baseDir = process.cwd(),
|
|
7924
|
+
relativeDirPath,
|
|
7925
|
+
relativeFilePath
|
|
7926
|
+
}) {
|
|
7927
|
+
return new _AugmentcodeRule({
|
|
7928
|
+
baseDir,
|
|
7929
|
+
relativeDirPath,
|
|
7930
|
+
relativeFilePath,
|
|
7931
|
+
fileContent: "",
|
|
7932
|
+
validate: false
|
|
7933
|
+
});
|
|
7934
|
+
}
|
|
6875
7935
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
6876
7936
|
return this.isTargetedByRulesyncRuleDefault({
|
|
6877
7937
|
rulesyncRule,
|
|
@@ -6881,7 +7941,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6881
7941
|
};
|
|
6882
7942
|
|
|
6883
7943
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
6884
|
-
import { join as
|
|
7944
|
+
import { join as join69 } from "path";
|
|
6885
7945
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
6886
7946
|
static getSettablePaths({
|
|
6887
7947
|
global
|
|
@@ -6900,7 +7960,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
6900
7960
|
relativeFilePath: "CLAUDE.md"
|
|
6901
7961
|
},
|
|
6902
7962
|
nonRoot: {
|
|
6903
|
-
relativeDirPath:
|
|
7963
|
+
relativeDirPath: join69(".claude", "memories")
|
|
6904
7964
|
}
|
|
6905
7965
|
};
|
|
6906
7966
|
}
|
|
@@ -6915,7 +7975,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
6915
7975
|
if (isRoot) {
|
|
6916
7976
|
const relativePath2 = paths.root.relativeFilePath;
|
|
6917
7977
|
const fileContent2 = await readFileContent(
|
|
6918
|
-
|
|
7978
|
+
join69(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
6919
7979
|
);
|
|
6920
7980
|
return new _ClaudecodeLegacyRule({
|
|
6921
7981
|
baseDir,
|
|
@@ -6929,8 +7989,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
6929
7989
|
if (!paths.nonRoot) {
|
|
6930
7990
|
throw new Error("nonRoot path is not set");
|
|
6931
7991
|
}
|
|
6932
|
-
const relativePath =
|
|
6933
|
-
const fileContent = await readFileContent(
|
|
7992
|
+
const relativePath = join69(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
7993
|
+
const fileContent = await readFileContent(join69(baseDir, relativePath));
|
|
6934
7994
|
return new _ClaudecodeLegacyRule({
|
|
6935
7995
|
baseDir,
|
|
6936
7996
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -6963,6 +8023,23 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
6963
8023
|
validate() {
|
|
6964
8024
|
return { success: true, error: null };
|
|
6965
8025
|
}
|
|
8026
|
+
static forDeletion({
|
|
8027
|
+
baseDir = process.cwd(),
|
|
8028
|
+
relativeDirPath,
|
|
8029
|
+
relativeFilePath,
|
|
8030
|
+
global = false
|
|
8031
|
+
}) {
|
|
8032
|
+
const paths = this.getSettablePaths({ global });
|
|
8033
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
8034
|
+
return new _ClaudecodeLegacyRule({
|
|
8035
|
+
baseDir,
|
|
8036
|
+
relativeDirPath,
|
|
8037
|
+
relativeFilePath,
|
|
8038
|
+
fileContent: "",
|
|
8039
|
+
validate: false,
|
|
8040
|
+
root: isRoot
|
|
8041
|
+
});
|
|
8042
|
+
}
|
|
6966
8043
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
6967
8044
|
return this.isTargetedByRulesyncRuleDefault({
|
|
6968
8045
|
rulesyncRule,
|
|
@@ -6972,10 +8049,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
6972
8049
|
};
|
|
6973
8050
|
|
|
6974
8051
|
// src/features/rules/claudecode-rule.ts
|
|
6975
|
-
import { join as
|
|
6976
|
-
import { z as
|
|
6977
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
6978
|
-
paths:
|
|
8052
|
+
import { join as join70 } from "path";
|
|
8053
|
+
import { z as z32 } from "zod/mini";
|
|
8054
|
+
var ClaudecodeRuleFrontmatterSchema = z32.object({
|
|
8055
|
+
paths: z32.optional(z32.string())
|
|
6979
8056
|
});
|
|
6980
8057
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
6981
8058
|
frontmatter;
|
|
@@ -6997,7 +8074,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6997
8074
|
relativeFilePath: "CLAUDE.md"
|
|
6998
8075
|
},
|
|
6999
8076
|
nonRoot: {
|
|
7000
|
-
relativeDirPath:
|
|
8077
|
+
relativeDirPath: join70(".claude", "rules")
|
|
7001
8078
|
}
|
|
7002
8079
|
};
|
|
7003
8080
|
}
|
|
@@ -7006,7 +8083,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
7006
8083
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7007
8084
|
if (!result.success) {
|
|
7008
8085
|
throw new Error(
|
|
7009
|
-
`Invalid frontmatter in ${
|
|
8086
|
+
`Invalid frontmatter in ${join70(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7010
8087
|
);
|
|
7011
8088
|
}
|
|
7012
8089
|
}
|
|
@@ -7034,7 +8111,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
7034
8111
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
7035
8112
|
if (isRoot) {
|
|
7036
8113
|
const fileContent2 = await readFileContent(
|
|
7037
|
-
|
|
8114
|
+
join70(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
7038
8115
|
);
|
|
7039
8116
|
return new _ClaudecodeRule({
|
|
7040
8117
|
baseDir,
|
|
@@ -7049,13 +8126,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
7049
8126
|
if (!paths.nonRoot) {
|
|
7050
8127
|
throw new Error("nonRoot path is not set");
|
|
7051
8128
|
}
|
|
7052
|
-
const relativePath =
|
|
7053
|
-
const fileContent = await readFileContent(
|
|
8129
|
+
const relativePath = join70(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8130
|
+
const fileContent = await readFileContent(join70(baseDir, relativePath));
|
|
7054
8131
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7055
8132
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7056
8133
|
if (!result.success) {
|
|
7057
8134
|
throw new Error(
|
|
7058
|
-
`Invalid frontmatter in ${
|
|
8135
|
+
`Invalid frontmatter in ${join70(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
7059
8136
|
);
|
|
7060
8137
|
}
|
|
7061
8138
|
return new _ClaudecodeRule({
|
|
@@ -7068,6 +8145,24 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
7068
8145
|
root: false
|
|
7069
8146
|
});
|
|
7070
8147
|
}
|
|
8148
|
+
static forDeletion({
|
|
8149
|
+
baseDir = process.cwd(),
|
|
8150
|
+
relativeDirPath,
|
|
8151
|
+
relativeFilePath,
|
|
8152
|
+
global = false
|
|
8153
|
+
}) {
|
|
8154
|
+
const paths = this.getSettablePaths({ global });
|
|
8155
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
8156
|
+
return new _ClaudecodeRule({
|
|
8157
|
+
baseDir,
|
|
8158
|
+
relativeDirPath,
|
|
8159
|
+
relativeFilePath,
|
|
8160
|
+
frontmatter: {},
|
|
8161
|
+
body: "",
|
|
8162
|
+
validate: false,
|
|
8163
|
+
root: isRoot
|
|
8164
|
+
});
|
|
8165
|
+
}
|
|
7071
8166
|
static fromRulesyncRule({
|
|
7072
8167
|
baseDir = process.cwd(),
|
|
7073
8168
|
rulesyncRule,
|
|
@@ -7144,7 +8239,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
7144
8239
|
return {
|
|
7145
8240
|
success: false,
|
|
7146
8241
|
error: new Error(
|
|
7147
|
-
`Invalid frontmatter in ${
|
|
8242
|
+
`Invalid frontmatter in ${join70(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7148
8243
|
)
|
|
7149
8244
|
};
|
|
7150
8245
|
}
|
|
@@ -7164,10 +8259,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
7164
8259
|
};
|
|
7165
8260
|
|
|
7166
8261
|
// src/features/rules/cline-rule.ts
|
|
7167
|
-
import { join as
|
|
7168
|
-
import { z as
|
|
7169
|
-
var ClineRuleFrontmatterSchema =
|
|
7170
|
-
description:
|
|
8262
|
+
import { join as join71 } from "path";
|
|
8263
|
+
import { z as z33 } from "zod/mini";
|
|
8264
|
+
var ClineRuleFrontmatterSchema = z33.object({
|
|
8265
|
+
description: z33.string()
|
|
7171
8266
|
});
|
|
7172
8267
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
7173
8268
|
static getSettablePaths() {
|
|
@@ -7209,7 +8304,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
7209
8304
|
validate = true
|
|
7210
8305
|
}) {
|
|
7211
8306
|
const fileContent = await readFileContent(
|
|
7212
|
-
|
|
8307
|
+
join71(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7213
8308
|
);
|
|
7214
8309
|
return new _ClineRule({
|
|
7215
8310
|
baseDir,
|
|
@@ -7219,10 +8314,23 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
7219
8314
|
validate
|
|
7220
8315
|
});
|
|
7221
8316
|
}
|
|
8317
|
+
static forDeletion({
|
|
8318
|
+
baseDir = process.cwd(),
|
|
8319
|
+
relativeDirPath,
|
|
8320
|
+
relativeFilePath
|
|
8321
|
+
}) {
|
|
8322
|
+
return new _ClineRule({
|
|
8323
|
+
baseDir,
|
|
8324
|
+
relativeDirPath,
|
|
8325
|
+
relativeFilePath,
|
|
8326
|
+
fileContent: "",
|
|
8327
|
+
validate: false
|
|
8328
|
+
});
|
|
8329
|
+
}
|
|
7222
8330
|
};
|
|
7223
8331
|
|
|
7224
8332
|
// src/features/rules/codexcli-rule.ts
|
|
7225
|
-
import { join as
|
|
8333
|
+
import { join as join72 } from "path";
|
|
7226
8334
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
7227
8335
|
static getSettablePaths({
|
|
7228
8336
|
global
|
|
@@ -7241,7 +8349,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
7241
8349
|
relativeFilePath: "AGENTS.md"
|
|
7242
8350
|
},
|
|
7243
8351
|
nonRoot: {
|
|
7244
|
-
relativeDirPath:
|
|
8352
|
+
relativeDirPath: join72(".codex", "memories")
|
|
7245
8353
|
}
|
|
7246
8354
|
};
|
|
7247
8355
|
}
|
|
@@ -7256,7 +8364,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
7256
8364
|
if (isRoot) {
|
|
7257
8365
|
const relativePath2 = paths.root.relativeFilePath;
|
|
7258
8366
|
const fileContent2 = await readFileContent(
|
|
7259
|
-
|
|
8367
|
+
join72(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
7260
8368
|
);
|
|
7261
8369
|
return new _CodexcliRule({
|
|
7262
8370
|
baseDir,
|
|
@@ -7270,8 +8378,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
7270
8378
|
if (!paths.nonRoot) {
|
|
7271
8379
|
throw new Error("nonRoot path is not set");
|
|
7272
8380
|
}
|
|
7273
|
-
const relativePath =
|
|
7274
|
-
const fileContent = await readFileContent(
|
|
8381
|
+
const relativePath = join72(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8382
|
+
const fileContent = await readFileContent(join72(baseDir, relativePath));
|
|
7275
8383
|
return new _CodexcliRule({
|
|
7276
8384
|
baseDir,
|
|
7277
8385
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -7304,6 +8412,23 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
7304
8412
|
validate() {
|
|
7305
8413
|
return { success: true, error: null };
|
|
7306
8414
|
}
|
|
8415
|
+
static forDeletion({
|
|
8416
|
+
baseDir = process.cwd(),
|
|
8417
|
+
relativeDirPath,
|
|
8418
|
+
relativeFilePath,
|
|
8419
|
+
global = false
|
|
8420
|
+
}) {
|
|
8421
|
+
const paths = this.getSettablePaths({ global });
|
|
8422
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
8423
|
+
return new _CodexcliRule({
|
|
8424
|
+
baseDir,
|
|
8425
|
+
relativeDirPath,
|
|
8426
|
+
relativeFilePath,
|
|
8427
|
+
fileContent: "",
|
|
8428
|
+
validate: false,
|
|
8429
|
+
root: isRoot
|
|
8430
|
+
});
|
|
8431
|
+
}
|
|
7307
8432
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
7308
8433
|
return this.isTargetedByRulesyncRuleDefault({
|
|
7309
8434
|
rulesyncRule,
|
|
@@ -7313,12 +8438,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
7313
8438
|
};
|
|
7314
8439
|
|
|
7315
8440
|
// src/features/rules/copilot-rule.ts
|
|
7316
|
-
import { join as
|
|
7317
|
-
import { z as
|
|
7318
|
-
var CopilotRuleFrontmatterSchema =
|
|
7319
|
-
description:
|
|
7320
|
-
applyTo:
|
|
7321
|
-
excludeAgent:
|
|
8441
|
+
import { join as join73 } from "path";
|
|
8442
|
+
import { z as z34 } from "zod/mini";
|
|
8443
|
+
var CopilotRuleFrontmatterSchema = z34.object({
|
|
8444
|
+
description: z34.optional(z34.string()),
|
|
8445
|
+
applyTo: z34.optional(z34.string()),
|
|
8446
|
+
excludeAgent: z34.optional(z34.union([z34.literal("code-review"), z34.literal("coding-agent")]))
|
|
7322
8447
|
});
|
|
7323
8448
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
7324
8449
|
frontmatter;
|
|
@@ -7330,7 +8455,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
7330
8455
|
relativeFilePath: "copilot-instructions.md"
|
|
7331
8456
|
},
|
|
7332
8457
|
nonRoot: {
|
|
7333
|
-
relativeDirPath:
|
|
8458
|
+
relativeDirPath: join73(".github", "instructions")
|
|
7334
8459
|
}
|
|
7335
8460
|
};
|
|
7336
8461
|
}
|
|
@@ -7339,7 +8464,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
7339
8464
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7340
8465
|
if (!result.success) {
|
|
7341
8466
|
throw new Error(
|
|
7342
|
-
`Invalid frontmatter in ${
|
|
8467
|
+
`Invalid frontmatter in ${join73(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7343
8468
|
);
|
|
7344
8469
|
}
|
|
7345
8470
|
}
|
|
@@ -7421,11 +8546,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
7421
8546
|
validate = true
|
|
7422
8547
|
}) {
|
|
7423
8548
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
7424
|
-
const relativePath = isRoot ?
|
|
8549
|
+
const relativePath = isRoot ? join73(
|
|
7425
8550
|
this.getSettablePaths().root.relativeDirPath,
|
|
7426
8551
|
this.getSettablePaths().root.relativeFilePath
|
|
7427
|
-
) :
|
|
7428
|
-
const fileContent = await readFileContent(
|
|
8552
|
+
) : join73(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
8553
|
+
const fileContent = await readFileContent(join73(baseDir, relativePath));
|
|
7429
8554
|
if (isRoot) {
|
|
7430
8555
|
return new _CopilotRule({
|
|
7431
8556
|
baseDir,
|
|
@@ -7441,7 +8566,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
7441
8566
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7442
8567
|
if (!result.success) {
|
|
7443
8568
|
throw new Error(
|
|
7444
|
-
`Invalid frontmatter in ${
|
|
8569
|
+
`Invalid frontmatter in ${join73(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
7445
8570
|
);
|
|
7446
8571
|
}
|
|
7447
8572
|
return new _CopilotRule({
|
|
@@ -7454,6 +8579,22 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
7454
8579
|
root: isRoot
|
|
7455
8580
|
});
|
|
7456
8581
|
}
|
|
8582
|
+
static forDeletion({
|
|
8583
|
+
baseDir = process.cwd(),
|
|
8584
|
+
relativeDirPath,
|
|
8585
|
+
relativeFilePath
|
|
8586
|
+
}) {
|
|
8587
|
+
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
8588
|
+
return new _CopilotRule({
|
|
8589
|
+
baseDir,
|
|
8590
|
+
relativeDirPath,
|
|
8591
|
+
relativeFilePath,
|
|
8592
|
+
frontmatter: {},
|
|
8593
|
+
body: "",
|
|
8594
|
+
validate: false,
|
|
8595
|
+
root: isRoot
|
|
8596
|
+
});
|
|
8597
|
+
}
|
|
7457
8598
|
validate() {
|
|
7458
8599
|
if (!this.frontmatter) {
|
|
7459
8600
|
return { success: true, error: null };
|
|
@@ -7465,7 +8606,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
7465
8606
|
return {
|
|
7466
8607
|
success: false,
|
|
7467
8608
|
error: new Error(
|
|
7468
|
-
`Invalid frontmatter in ${
|
|
8609
|
+
`Invalid frontmatter in ${join73(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7469
8610
|
)
|
|
7470
8611
|
};
|
|
7471
8612
|
}
|
|
@@ -7485,12 +8626,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
7485
8626
|
};
|
|
7486
8627
|
|
|
7487
8628
|
// src/features/rules/cursor-rule.ts
|
|
7488
|
-
import { basename as basename19, join as
|
|
7489
|
-
import { z as
|
|
7490
|
-
var CursorRuleFrontmatterSchema =
|
|
7491
|
-
description:
|
|
7492
|
-
globs:
|
|
7493
|
-
alwaysApply:
|
|
8629
|
+
import { basename as basename19, join as join74 } from "path";
|
|
8630
|
+
import { z as z35 } from "zod/mini";
|
|
8631
|
+
var CursorRuleFrontmatterSchema = z35.object({
|
|
8632
|
+
description: z35.optional(z35.string()),
|
|
8633
|
+
globs: z35.optional(z35.string()),
|
|
8634
|
+
alwaysApply: z35.optional(z35.boolean())
|
|
7494
8635
|
});
|
|
7495
8636
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
7496
8637
|
frontmatter;
|
|
@@ -7498,7 +8639,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7498
8639
|
static getSettablePaths() {
|
|
7499
8640
|
return {
|
|
7500
8641
|
nonRoot: {
|
|
7501
|
-
relativeDirPath:
|
|
8642
|
+
relativeDirPath: join74(".cursor", "rules")
|
|
7502
8643
|
}
|
|
7503
8644
|
};
|
|
7504
8645
|
}
|
|
@@ -7507,7 +8648,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7507
8648
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7508
8649
|
if (!result.success) {
|
|
7509
8650
|
throw new Error(
|
|
7510
|
-
`Invalid frontmatter in ${
|
|
8651
|
+
`Invalid frontmatter in ${join74(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7511
8652
|
);
|
|
7512
8653
|
}
|
|
7513
8654
|
}
|
|
@@ -7624,13 +8765,13 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7624
8765
|
validate = true
|
|
7625
8766
|
}) {
|
|
7626
8767
|
const fileContent = await readFileContent(
|
|
7627
|
-
|
|
8768
|
+
join74(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7628
8769
|
);
|
|
7629
8770
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
7630
8771
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7631
8772
|
if (!result.success) {
|
|
7632
8773
|
throw new Error(
|
|
7633
|
-
`Invalid frontmatter in ${
|
|
8774
|
+
`Invalid frontmatter in ${join74(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
7634
8775
|
);
|
|
7635
8776
|
}
|
|
7636
8777
|
return new _CursorRule({
|
|
@@ -7642,6 +8783,20 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7642
8783
|
validate
|
|
7643
8784
|
});
|
|
7644
8785
|
}
|
|
8786
|
+
static forDeletion({
|
|
8787
|
+
baseDir = process.cwd(),
|
|
8788
|
+
relativeDirPath,
|
|
8789
|
+
relativeFilePath
|
|
8790
|
+
}) {
|
|
8791
|
+
return new _CursorRule({
|
|
8792
|
+
baseDir,
|
|
8793
|
+
relativeDirPath,
|
|
8794
|
+
relativeFilePath,
|
|
8795
|
+
frontmatter: {},
|
|
8796
|
+
body: "",
|
|
8797
|
+
validate: false
|
|
8798
|
+
});
|
|
8799
|
+
}
|
|
7645
8800
|
validate() {
|
|
7646
8801
|
if (!this.frontmatter) {
|
|
7647
8802
|
return { success: true, error: null };
|
|
@@ -7653,7 +8808,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7653
8808
|
return {
|
|
7654
8809
|
success: false,
|
|
7655
8810
|
error: new Error(
|
|
7656
|
-
`Invalid frontmatter in ${
|
|
8811
|
+
`Invalid frontmatter in ${join74(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7657
8812
|
)
|
|
7658
8813
|
};
|
|
7659
8814
|
}
|
|
@@ -7673,7 +8828,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7673
8828
|
};
|
|
7674
8829
|
|
|
7675
8830
|
// src/features/rules/geminicli-rule.ts
|
|
7676
|
-
import { join as
|
|
8831
|
+
import { join as join75 } from "path";
|
|
7677
8832
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
7678
8833
|
static getSettablePaths({
|
|
7679
8834
|
global
|
|
@@ -7692,7 +8847,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7692
8847
|
relativeFilePath: "GEMINI.md"
|
|
7693
8848
|
},
|
|
7694
8849
|
nonRoot: {
|
|
7695
|
-
relativeDirPath:
|
|
8850
|
+
relativeDirPath: join75(".gemini", "memories")
|
|
7696
8851
|
}
|
|
7697
8852
|
};
|
|
7698
8853
|
}
|
|
@@ -7707,7 +8862,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7707
8862
|
if (isRoot) {
|
|
7708
8863
|
const relativePath2 = paths.root.relativeFilePath;
|
|
7709
8864
|
const fileContent2 = await readFileContent(
|
|
7710
|
-
|
|
8865
|
+
join75(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
7711
8866
|
);
|
|
7712
8867
|
return new _GeminiCliRule({
|
|
7713
8868
|
baseDir,
|
|
@@ -7721,8 +8876,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7721
8876
|
if (!paths.nonRoot) {
|
|
7722
8877
|
throw new Error("nonRoot path is not set");
|
|
7723
8878
|
}
|
|
7724
|
-
const relativePath =
|
|
7725
|
-
const fileContent = await readFileContent(
|
|
8879
|
+
const relativePath = join75(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8880
|
+
const fileContent = await readFileContent(join75(baseDir, relativePath));
|
|
7726
8881
|
return new _GeminiCliRule({
|
|
7727
8882
|
baseDir,
|
|
7728
8883
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -7755,6 +8910,23 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7755
8910
|
validate() {
|
|
7756
8911
|
return { success: true, error: null };
|
|
7757
8912
|
}
|
|
8913
|
+
static forDeletion({
|
|
8914
|
+
baseDir = process.cwd(),
|
|
8915
|
+
relativeDirPath,
|
|
8916
|
+
relativeFilePath,
|
|
8917
|
+
global = false
|
|
8918
|
+
}) {
|
|
8919
|
+
const paths = this.getSettablePaths({ global });
|
|
8920
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
8921
|
+
return new _GeminiCliRule({
|
|
8922
|
+
baseDir,
|
|
8923
|
+
relativeDirPath,
|
|
8924
|
+
relativeFilePath,
|
|
8925
|
+
fileContent: "",
|
|
8926
|
+
validate: false,
|
|
8927
|
+
root: isRoot
|
|
8928
|
+
});
|
|
8929
|
+
}
|
|
7758
8930
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
7759
8931
|
return this.isTargetedByRulesyncRuleDefault({
|
|
7760
8932
|
rulesyncRule,
|
|
@@ -7764,7 +8936,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7764
8936
|
};
|
|
7765
8937
|
|
|
7766
8938
|
// src/features/rules/junie-rule.ts
|
|
7767
|
-
import { join as
|
|
8939
|
+
import { join as join76 } from "path";
|
|
7768
8940
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
7769
8941
|
static getSettablePaths() {
|
|
7770
8942
|
return {
|
|
@@ -7773,7 +8945,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7773
8945
|
relativeFilePath: "guidelines.md"
|
|
7774
8946
|
},
|
|
7775
8947
|
nonRoot: {
|
|
7776
|
-
relativeDirPath:
|
|
8948
|
+
relativeDirPath: join76(".junie", "memories")
|
|
7777
8949
|
}
|
|
7778
8950
|
};
|
|
7779
8951
|
}
|
|
@@ -7783,8 +8955,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7783
8955
|
validate = true
|
|
7784
8956
|
}) {
|
|
7785
8957
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
7786
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
7787
|
-
const fileContent = await readFileContent(
|
|
8958
|
+
const relativePath = isRoot ? "guidelines.md" : join76(".junie", "memories", relativeFilePath);
|
|
8959
|
+
const fileContent = await readFileContent(join76(baseDir, relativePath));
|
|
7788
8960
|
return new _JunieRule({
|
|
7789
8961
|
baseDir,
|
|
7790
8962
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7815,6 +8987,21 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7815
8987
|
validate() {
|
|
7816
8988
|
return { success: true, error: null };
|
|
7817
8989
|
}
|
|
8990
|
+
static forDeletion({
|
|
8991
|
+
baseDir = process.cwd(),
|
|
8992
|
+
relativeDirPath,
|
|
8993
|
+
relativeFilePath
|
|
8994
|
+
}) {
|
|
8995
|
+
const isRoot = relativeFilePath === "guidelines.md";
|
|
8996
|
+
return new _JunieRule({
|
|
8997
|
+
baseDir,
|
|
8998
|
+
relativeDirPath,
|
|
8999
|
+
relativeFilePath,
|
|
9000
|
+
fileContent: "",
|
|
9001
|
+
validate: false,
|
|
9002
|
+
root: isRoot
|
|
9003
|
+
});
|
|
9004
|
+
}
|
|
7818
9005
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
7819
9006
|
return this.isTargetedByRulesyncRuleDefault({
|
|
7820
9007
|
rulesyncRule,
|
|
@@ -7824,12 +9011,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7824
9011
|
};
|
|
7825
9012
|
|
|
7826
9013
|
// src/features/rules/kiro-rule.ts
|
|
7827
|
-
import { join as
|
|
9014
|
+
import { join as join77 } from "path";
|
|
7828
9015
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
7829
9016
|
static getSettablePaths() {
|
|
7830
9017
|
return {
|
|
7831
9018
|
nonRoot: {
|
|
7832
|
-
relativeDirPath:
|
|
9019
|
+
relativeDirPath: join77(".kiro", "steering")
|
|
7833
9020
|
}
|
|
7834
9021
|
};
|
|
7835
9022
|
}
|
|
@@ -7839,7 +9026,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
7839
9026
|
validate = true
|
|
7840
9027
|
}) {
|
|
7841
9028
|
const fileContent = await readFileContent(
|
|
7842
|
-
|
|
9029
|
+
join77(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7843
9030
|
);
|
|
7844
9031
|
return new _KiroRule({
|
|
7845
9032
|
baseDir,
|
|
@@ -7870,6 +9057,20 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
7870
9057
|
validate() {
|
|
7871
9058
|
return { success: true, error: null };
|
|
7872
9059
|
}
|
|
9060
|
+
static forDeletion({
|
|
9061
|
+
baseDir = process.cwd(),
|
|
9062
|
+
relativeDirPath,
|
|
9063
|
+
relativeFilePath
|
|
9064
|
+
}) {
|
|
9065
|
+
return new _KiroRule({
|
|
9066
|
+
baseDir,
|
|
9067
|
+
relativeDirPath,
|
|
9068
|
+
relativeFilePath,
|
|
9069
|
+
fileContent: "",
|
|
9070
|
+
validate: false,
|
|
9071
|
+
root: false
|
|
9072
|
+
});
|
|
9073
|
+
}
|
|
7873
9074
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
7874
9075
|
return this.isTargetedByRulesyncRuleDefault({
|
|
7875
9076
|
rulesyncRule,
|
|
@@ -7879,7 +9080,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
7879
9080
|
};
|
|
7880
9081
|
|
|
7881
9082
|
// src/features/rules/opencode-rule.ts
|
|
7882
|
-
import { join as
|
|
9083
|
+
import { join as join78 } from "path";
|
|
7883
9084
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
7884
9085
|
static getSettablePaths() {
|
|
7885
9086
|
return {
|
|
@@ -7888,7 +9089,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7888
9089
|
relativeFilePath: "AGENTS.md"
|
|
7889
9090
|
},
|
|
7890
9091
|
nonRoot: {
|
|
7891
|
-
relativeDirPath:
|
|
9092
|
+
relativeDirPath: join78(".opencode", "memories")
|
|
7892
9093
|
}
|
|
7893
9094
|
};
|
|
7894
9095
|
}
|
|
@@ -7898,8 +9099,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7898
9099
|
validate = true
|
|
7899
9100
|
}) {
|
|
7900
9101
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
7901
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
7902
|
-
const fileContent = await readFileContent(
|
|
9102
|
+
const relativePath = isRoot ? "AGENTS.md" : join78(".opencode", "memories", relativeFilePath);
|
|
9103
|
+
const fileContent = await readFileContent(join78(baseDir, relativePath));
|
|
7903
9104
|
return new _OpenCodeRule({
|
|
7904
9105
|
baseDir,
|
|
7905
9106
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7930,6 +9131,21 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7930
9131
|
validate() {
|
|
7931
9132
|
return { success: true, error: null };
|
|
7932
9133
|
}
|
|
9134
|
+
static forDeletion({
|
|
9135
|
+
baseDir = process.cwd(),
|
|
9136
|
+
relativeDirPath,
|
|
9137
|
+
relativeFilePath
|
|
9138
|
+
}) {
|
|
9139
|
+
const isRoot = relativeFilePath === "AGENTS.md" && relativeDirPath === ".";
|
|
9140
|
+
return new _OpenCodeRule({
|
|
9141
|
+
baseDir,
|
|
9142
|
+
relativeDirPath,
|
|
9143
|
+
relativeFilePath,
|
|
9144
|
+
fileContent: "",
|
|
9145
|
+
validate: false,
|
|
9146
|
+
root: isRoot
|
|
9147
|
+
});
|
|
9148
|
+
}
|
|
7933
9149
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
7934
9150
|
return this.isTargetedByRulesyncRuleDefault({
|
|
7935
9151
|
rulesyncRule,
|
|
@@ -7939,7 +9155,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7939
9155
|
};
|
|
7940
9156
|
|
|
7941
9157
|
// src/features/rules/qwencode-rule.ts
|
|
7942
|
-
import { join as
|
|
9158
|
+
import { join as join79 } from "path";
|
|
7943
9159
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
7944
9160
|
static getSettablePaths() {
|
|
7945
9161
|
return {
|
|
@@ -7948,7 +9164,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7948
9164
|
relativeFilePath: "QWEN.md"
|
|
7949
9165
|
},
|
|
7950
9166
|
nonRoot: {
|
|
7951
|
-
relativeDirPath:
|
|
9167
|
+
relativeDirPath: join79(".qwen", "memories")
|
|
7952
9168
|
}
|
|
7953
9169
|
};
|
|
7954
9170
|
}
|
|
@@ -7958,8 +9174,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7958
9174
|
validate = true
|
|
7959
9175
|
}) {
|
|
7960
9176
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
7961
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
7962
|
-
const fileContent = await readFileContent(
|
|
9177
|
+
const relativePath = isRoot ? "QWEN.md" : join79(".qwen", "memories", relativeFilePath);
|
|
9178
|
+
const fileContent = await readFileContent(join79(baseDir, relativePath));
|
|
7963
9179
|
return new _QwencodeRule({
|
|
7964
9180
|
baseDir,
|
|
7965
9181
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7987,6 +9203,21 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7987
9203
|
validate() {
|
|
7988
9204
|
return { success: true, error: null };
|
|
7989
9205
|
}
|
|
9206
|
+
static forDeletion({
|
|
9207
|
+
baseDir = process.cwd(),
|
|
9208
|
+
relativeDirPath,
|
|
9209
|
+
relativeFilePath
|
|
9210
|
+
}) {
|
|
9211
|
+
const isRoot = relativeFilePath === "QWEN.md" && relativeDirPath === ".";
|
|
9212
|
+
return new _QwencodeRule({
|
|
9213
|
+
baseDir,
|
|
9214
|
+
relativeDirPath,
|
|
9215
|
+
relativeFilePath,
|
|
9216
|
+
fileContent: "",
|
|
9217
|
+
validate: false,
|
|
9218
|
+
root: isRoot
|
|
9219
|
+
});
|
|
9220
|
+
}
|
|
7990
9221
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
7991
9222
|
return this.isTargetedByRulesyncRuleDefault({
|
|
7992
9223
|
rulesyncRule,
|
|
@@ -7996,12 +9227,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7996
9227
|
};
|
|
7997
9228
|
|
|
7998
9229
|
// src/features/rules/roo-rule.ts
|
|
7999
|
-
import { join as
|
|
9230
|
+
import { join as join80 } from "path";
|
|
8000
9231
|
var RooRule = class _RooRule extends ToolRule {
|
|
8001
9232
|
static getSettablePaths() {
|
|
8002
9233
|
return {
|
|
8003
9234
|
nonRoot: {
|
|
8004
|
-
relativeDirPath:
|
|
9235
|
+
relativeDirPath: join80(".roo", "rules")
|
|
8005
9236
|
}
|
|
8006
9237
|
};
|
|
8007
9238
|
}
|
|
@@ -8011,7 +9242,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
8011
9242
|
validate = true
|
|
8012
9243
|
}) {
|
|
8013
9244
|
const fileContent = await readFileContent(
|
|
8014
|
-
|
|
9245
|
+
join80(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8015
9246
|
);
|
|
8016
9247
|
return new _RooRule({
|
|
8017
9248
|
baseDir,
|
|
@@ -8057,6 +9288,20 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
8057
9288
|
validate() {
|
|
8058
9289
|
return { success: true, error: null };
|
|
8059
9290
|
}
|
|
9291
|
+
static forDeletion({
|
|
9292
|
+
baseDir = process.cwd(),
|
|
9293
|
+
relativeDirPath,
|
|
9294
|
+
relativeFilePath
|
|
9295
|
+
}) {
|
|
9296
|
+
return new _RooRule({
|
|
9297
|
+
baseDir,
|
|
9298
|
+
relativeDirPath,
|
|
9299
|
+
relativeFilePath,
|
|
9300
|
+
fileContent: "",
|
|
9301
|
+
validate: false,
|
|
9302
|
+
root: false
|
|
9303
|
+
});
|
|
9304
|
+
}
|
|
8060
9305
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
8061
9306
|
return this.isTargetedByRulesyncRuleDefault({
|
|
8062
9307
|
rulesyncRule,
|
|
@@ -8066,7 +9311,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
8066
9311
|
};
|
|
8067
9312
|
|
|
8068
9313
|
// src/features/rules/warp-rule.ts
|
|
8069
|
-
import { join as
|
|
9314
|
+
import { join as join81 } from "path";
|
|
8070
9315
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
8071
9316
|
constructor({ fileContent, root, ...rest }) {
|
|
8072
9317
|
super({
|
|
@@ -8082,7 +9327,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
8082
9327
|
relativeFilePath: "WARP.md"
|
|
8083
9328
|
},
|
|
8084
9329
|
nonRoot: {
|
|
8085
|
-
relativeDirPath:
|
|
9330
|
+
relativeDirPath: join81(".warp", "memories")
|
|
8086
9331
|
}
|
|
8087
9332
|
};
|
|
8088
9333
|
}
|
|
@@ -8092,8 +9337,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
8092
9337
|
validate = true
|
|
8093
9338
|
}) {
|
|
8094
9339
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
8095
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
8096
|
-
const fileContent = await readFileContent(
|
|
9340
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join81(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
9341
|
+
const fileContent = await readFileContent(join81(baseDir, relativePath));
|
|
8097
9342
|
return new _WarpRule({
|
|
8098
9343
|
baseDir,
|
|
8099
9344
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -8124,6 +9369,21 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
8124
9369
|
validate() {
|
|
8125
9370
|
return { success: true, error: null };
|
|
8126
9371
|
}
|
|
9372
|
+
static forDeletion({
|
|
9373
|
+
baseDir = process.cwd(),
|
|
9374
|
+
relativeDirPath,
|
|
9375
|
+
relativeFilePath
|
|
9376
|
+
}) {
|
|
9377
|
+
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
9378
|
+
return new _WarpRule({
|
|
9379
|
+
baseDir,
|
|
9380
|
+
relativeDirPath,
|
|
9381
|
+
relativeFilePath,
|
|
9382
|
+
fileContent: "",
|
|
9383
|
+
validate: false,
|
|
9384
|
+
root: isRoot
|
|
9385
|
+
});
|
|
9386
|
+
}
|
|
8127
9387
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
8128
9388
|
return this.isTargetedByRulesyncRuleDefault({
|
|
8129
9389
|
rulesyncRule,
|
|
@@ -8133,12 +9393,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
8133
9393
|
};
|
|
8134
9394
|
|
|
8135
9395
|
// src/features/rules/windsurf-rule.ts
|
|
8136
|
-
import { join as
|
|
9396
|
+
import { join as join82 } from "path";
|
|
8137
9397
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
8138
9398
|
static getSettablePaths() {
|
|
8139
9399
|
return {
|
|
8140
9400
|
nonRoot: {
|
|
8141
|
-
relativeDirPath:
|
|
9401
|
+
relativeDirPath: join82(".windsurf", "rules")
|
|
8142
9402
|
}
|
|
8143
9403
|
};
|
|
8144
9404
|
}
|
|
@@ -8148,7 +9408,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
8148
9408
|
validate = true
|
|
8149
9409
|
}) {
|
|
8150
9410
|
const fileContent = await readFileContent(
|
|
8151
|
-
|
|
9411
|
+
join82(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8152
9412
|
);
|
|
8153
9413
|
return new _WindsurfRule({
|
|
8154
9414
|
baseDir,
|
|
@@ -8178,6 +9438,19 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
8178
9438
|
validate() {
|
|
8179
9439
|
return { success: true, error: null };
|
|
8180
9440
|
}
|
|
9441
|
+
static forDeletion({
|
|
9442
|
+
baseDir = process.cwd(),
|
|
9443
|
+
relativeDirPath,
|
|
9444
|
+
relativeFilePath
|
|
9445
|
+
}) {
|
|
9446
|
+
return new _WindsurfRule({
|
|
9447
|
+
baseDir,
|
|
9448
|
+
relativeDirPath,
|
|
9449
|
+
relativeFilePath,
|
|
9450
|
+
fileContent: "",
|
|
9451
|
+
validate: false
|
|
9452
|
+
});
|
|
9453
|
+
}
|
|
8181
9454
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
8182
9455
|
return this.isTargetedByRulesyncRuleDefault({
|
|
8183
9456
|
rulesyncRule,
|
|
@@ -8208,7 +9481,7 @@ var rulesProcessorToolTargets = [
|
|
|
8208
9481
|
"warp",
|
|
8209
9482
|
"windsurf"
|
|
8210
9483
|
];
|
|
8211
|
-
var RulesProcessorToolTargetSchema =
|
|
9484
|
+
var RulesProcessorToolTargetSchema = z36.enum(rulesProcessorToolTargets);
|
|
8212
9485
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
8213
9486
|
[
|
|
8214
9487
|
"agentsmd",
|
|
@@ -8284,8 +9557,7 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
8284
9557
|
supportsGlobal: true,
|
|
8285
9558
|
ruleDiscoveryMode: "toon",
|
|
8286
9559
|
additionalConventions: {
|
|
8287
|
-
subagents: { subagentClass: CodexCliSubagent }
|
|
8288
|
-
skills: { skillClass: CodexCliSkill, globalOnly: true }
|
|
9560
|
+
subagents: { subagentClass: CodexCliSubagent }
|
|
8289
9561
|
}
|
|
8290
9562
|
}
|
|
8291
9563
|
}
|
|
@@ -8299,9 +9571,7 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
8299
9571
|
supportsGlobal: false,
|
|
8300
9572
|
ruleDiscoveryMode: "auto",
|
|
8301
9573
|
additionalConventions: {
|
|
8302
|
-
|
|
8303
|
-
subagents: { subagentClass: CopilotSubagent },
|
|
8304
|
-
skills: { skillClass: CopilotSkill }
|
|
9574
|
+
subagents: { subagentClass: CopilotSubagent }
|
|
8305
9575
|
}
|
|
8306
9576
|
}
|
|
8307
9577
|
}
|
|
@@ -8315,7 +9585,6 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
8315
9585
|
supportsGlobal: false,
|
|
8316
9586
|
ruleDiscoveryMode: "auto",
|
|
8317
9587
|
additionalConventions: {
|
|
8318
|
-
commands: { commandClass: CursorCommand },
|
|
8319
9588
|
subagents: { subagentClass: CursorSubagent },
|
|
8320
9589
|
skills: { skillClass: CursorSkill }
|
|
8321
9590
|
},
|
|
@@ -8332,7 +9601,6 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
8332
9601
|
supportsGlobal: true,
|
|
8333
9602
|
ruleDiscoveryMode: "toon",
|
|
8334
9603
|
additionalConventions: {
|
|
8335
|
-
commands: { commandClass: GeminiCliCommand },
|
|
8336
9604
|
subagents: { subagentClass: GeminiCliSubagent },
|
|
8337
9605
|
skills: { skillClass: GeminiCliSkill }
|
|
8338
9606
|
}
|
|
@@ -8376,7 +9644,6 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
8376
9644
|
supportsGlobal: false,
|
|
8377
9645
|
ruleDiscoveryMode: "auto",
|
|
8378
9646
|
additionalConventions: {
|
|
8379
|
-
commands: { commandClass: RooCommand },
|
|
8380
9647
|
subagents: { subagentClass: RooSubagent }
|
|
8381
9648
|
},
|
|
8382
9649
|
createsSeparateConventionsRule: true
|
|
@@ -8502,7 +9769,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
8502
9769
|
}).relativeDirPath;
|
|
8503
9770
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
8504
9771
|
const frontmatter = skill.getFrontmatter();
|
|
8505
|
-
const relativePath =
|
|
9772
|
+
const relativePath = join83(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
8506
9773
|
return {
|
|
8507
9774
|
name: frontmatter.name,
|
|
8508
9775
|
description: frontmatter.description,
|
|
@@ -8569,7 +9836,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
8569
9836
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
8570
9837
|
*/
|
|
8571
9838
|
async loadRulesyncFiles() {
|
|
8572
|
-
const files = await findFilesByGlobs(
|
|
9839
|
+
const files = await findFilesByGlobs(join83(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
8573
9840
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
8574
9841
|
const rulesyncRules = await Promise.all(
|
|
8575
9842
|
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename20(file) }))
|
|
@@ -8589,12 +9856,19 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
8589
9856
|
}
|
|
8590
9857
|
return rulesyncRules;
|
|
8591
9858
|
}
|
|
9859
|
+
async loadRulesyncFilesLegacy() {
|
|
9860
|
+
const legacyFiles = await findFilesByGlobs(join83(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
9861
|
+
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
9862
|
+
return Promise.all(
|
|
9863
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename20(file) }))
|
|
9864
|
+
);
|
|
9865
|
+
}
|
|
8592
9866
|
/**
|
|
8593
9867
|
* Implementation of abstract method from FeatureProcessor
|
|
8594
9868
|
* Load tool-specific rule configurations and parse them into ToolRule instances
|
|
8595
9869
|
*/
|
|
8596
9870
|
async loadToolFiles({
|
|
8597
|
-
forDeletion
|
|
9871
|
+
forDeletion = false
|
|
8598
9872
|
} = {}) {
|
|
8599
9873
|
try {
|
|
8600
9874
|
const factory = this.getFactory(this.toolTarget);
|
|
@@ -8604,12 +9878,22 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
8604
9878
|
return [];
|
|
8605
9879
|
}
|
|
8606
9880
|
const rootFilePaths = await findFilesByGlobs(
|
|
8607
|
-
|
|
9881
|
+
join83(
|
|
8608
9882
|
this.baseDir,
|
|
8609
9883
|
settablePaths.root.relativeDirPath ?? ".",
|
|
8610
9884
|
settablePaths.root.relativeFilePath
|
|
8611
9885
|
)
|
|
8612
9886
|
);
|
|
9887
|
+
if (forDeletion) {
|
|
9888
|
+
return rootFilePaths.map(
|
|
9889
|
+
(filePath) => factory.class.forDeletion({
|
|
9890
|
+
baseDir: this.baseDir,
|
|
9891
|
+
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
9892
|
+
relativeFilePath: basename20(filePath),
|
|
9893
|
+
global: this.global
|
|
9894
|
+
})
|
|
9895
|
+
).filter((rule) => rule.isDeletable());
|
|
9896
|
+
}
|
|
8613
9897
|
return await Promise.all(
|
|
8614
9898
|
rootFilePaths.map(
|
|
8615
9899
|
(filePath) => factory.class.fromFile({
|
|
@@ -8626,8 +9910,18 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
8626
9910
|
return [];
|
|
8627
9911
|
}
|
|
8628
9912
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
8629
|
-
|
|
9913
|
+
join83(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
8630
9914
|
);
|
|
9915
|
+
if (forDeletion) {
|
|
9916
|
+
return nonRootFilePaths.map(
|
|
9917
|
+
(filePath) => factory.class.forDeletion({
|
|
9918
|
+
baseDir: this.baseDir,
|
|
9919
|
+
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
9920
|
+
relativeFilePath: basename20(filePath),
|
|
9921
|
+
global: this.global
|
|
9922
|
+
})
|
|
9923
|
+
).filter((rule) => rule.isDeletable());
|
|
9924
|
+
}
|
|
8631
9925
|
return await Promise.all(
|
|
8632
9926
|
nonRootFilePaths.map(
|
|
8633
9927
|
(filePath) => factory.class.fromFile({
|
|
@@ -8725,14 +10019,14 @@ s/<command> [arguments]
|
|
|
8725
10019
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
8726
10020
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
8727
10021
|
|
|
8728
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
10022
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join83(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
8729
10023
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
8730
10024
|
|
|
8731
10025
|
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.
|
|
8732
10026
|
|
|
8733
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
10027
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join83(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
8734
10028
|
|
|
8735
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
10029
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join83(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
8736
10030
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
8737
10031
|
const result = [
|
|
8738
10032
|
overview,
|
|
@@ -9014,7 +10308,7 @@ async function generateSkills(config) {
|
|
|
9014
10308
|
}
|
|
9015
10309
|
|
|
9016
10310
|
// src/cli/commands/gitignore.ts
|
|
9017
|
-
import { join as
|
|
10311
|
+
import { join as join84 } from "path";
|
|
9018
10312
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
9019
10313
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
9020
10314
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -9071,6 +10365,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
9071
10365
|
// OpenCode
|
|
9072
10366
|
"**/.opencode/memories/",
|
|
9073
10367
|
"**/.opencode/command/",
|
|
10368
|
+
"**/.opencode/skills/",
|
|
9074
10369
|
"**/opencode.json",
|
|
9075
10370
|
// Qwen
|
|
9076
10371
|
"**/QWEN.md",
|
|
@@ -9137,7 +10432,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
9137
10432
|
return result;
|
|
9138
10433
|
};
|
|
9139
10434
|
var gitignoreCommand = async () => {
|
|
9140
|
-
const gitignorePath =
|
|
10435
|
+
const gitignorePath = join84(process.cwd(), ".gitignore");
|
|
9141
10436
|
let gitignoreContent = "";
|
|
9142
10437
|
if (await fileExists(gitignorePath)) {
|
|
9143
10438
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -9336,7 +10631,7 @@ async function importSkills(config, tool) {
|
|
|
9336
10631
|
}
|
|
9337
10632
|
|
|
9338
10633
|
// src/cli/commands/init.ts
|
|
9339
|
-
import { join as
|
|
10634
|
+
import { join as join85 } from "path";
|
|
9340
10635
|
async function initCommand() {
|
|
9341
10636
|
logger.info("Initializing rulesync...");
|
|
9342
10637
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -9499,14 +10794,14 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
9499
10794
|
await ensureDir(commandPaths.relativeDirPath);
|
|
9500
10795
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
9501
10796
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
9502
|
-
const ruleFilepath =
|
|
10797
|
+
const ruleFilepath = join85(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
9503
10798
|
if (!await fileExists(ruleFilepath)) {
|
|
9504
10799
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
9505
10800
|
logger.success(`Created ${ruleFilepath}`);
|
|
9506
10801
|
} else {
|
|
9507
10802
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
9508
10803
|
}
|
|
9509
|
-
const mcpFilepath =
|
|
10804
|
+
const mcpFilepath = join85(
|
|
9510
10805
|
mcpPaths.recommended.relativeDirPath,
|
|
9511
10806
|
mcpPaths.recommended.relativeFilePath
|
|
9512
10807
|
);
|
|
@@ -9516,21 +10811,21 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
9516
10811
|
} else {
|
|
9517
10812
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
9518
10813
|
}
|
|
9519
|
-
const commandFilepath =
|
|
10814
|
+
const commandFilepath = join85(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
9520
10815
|
if (!await fileExists(commandFilepath)) {
|
|
9521
10816
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
9522
10817
|
logger.success(`Created ${commandFilepath}`);
|
|
9523
10818
|
} else {
|
|
9524
10819
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
9525
10820
|
}
|
|
9526
|
-
const subagentFilepath =
|
|
10821
|
+
const subagentFilepath = join85(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
9527
10822
|
if (!await fileExists(subagentFilepath)) {
|
|
9528
10823
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
9529
10824
|
logger.success(`Created ${subagentFilepath}`);
|
|
9530
10825
|
} else {
|
|
9531
10826
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
9532
10827
|
}
|
|
9533
|
-
const ignoreFilepath =
|
|
10828
|
+
const ignoreFilepath = join85(
|
|
9534
10829
|
ignorePaths.recommended.relativeDirPath,
|
|
9535
10830
|
ignorePaths.recommended.relativeFilePath
|
|
9536
10831
|
);
|
|
@@ -9546,12 +10841,12 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
9546
10841
|
import { FastMCP } from "fastmcp";
|
|
9547
10842
|
|
|
9548
10843
|
// src/mcp/commands.ts
|
|
9549
|
-
import { basename as basename21, join as
|
|
9550
|
-
import { z as
|
|
10844
|
+
import { basename as basename21, join as join86 } from "path";
|
|
10845
|
+
import { z as z37 } from "zod/mini";
|
|
9551
10846
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
9552
10847
|
var maxCommandsCount = 1e3;
|
|
9553
10848
|
async function listCommands() {
|
|
9554
|
-
const commandsDir =
|
|
10849
|
+
const commandsDir = join86(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
9555
10850
|
try {
|
|
9556
10851
|
const files = await listDirectoryFiles(commandsDir);
|
|
9557
10852
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -9563,7 +10858,7 @@ async function listCommands() {
|
|
|
9563
10858
|
});
|
|
9564
10859
|
const frontmatter = command.getFrontmatter();
|
|
9565
10860
|
return {
|
|
9566
|
-
relativePathFromCwd:
|
|
10861
|
+
relativePathFromCwd: join86(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
9567
10862
|
frontmatter
|
|
9568
10863
|
};
|
|
9569
10864
|
} catch (error) {
|
|
@@ -9589,7 +10884,7 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
9589
10884
|
relativeFilePath: filename
|
|
9590
10885
|
});
|
|
9591
10886
|
return {
|
|
9592
|
-
relativePathFromCwd:
|
|
10887
|
+
relativePathFromCwd: join86(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
9593
10888
|
frontmatter: command.getFrontmatter(),
|
|
9594
10889
|
body: command.getBody()
|
|
9595
10890
|
};
|
|
@@ -9618,7 +10913,7 @@ async function putCommand({
|
|
|
9618
10913
|
try {
|
|
9619
10914
|
const existingCommands = await listCommands();
|
|
9620
10915
|
const isUpdate = existingCommands.some(
|
|
9621
|
-
(command2) => command2.relativePathFromCwd ===
|
|
10916
|
+
(command2) => command2.relativePathFromCwd === join86(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
9622
10917
|
);
|
|
9623
10918
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
9624
10919
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -9633,11 +10928,11 @@ async function putCommand({
|
|
|
9633
10928
|
fileContent,
|
|
9634
10929
|
validate: true
|
|
9635
10930
|
});
|
|
9636
|
-
const commandsDir =
|
|
10931
|
+
const commandsDir = join86(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
9637
10932
|
await ensureDir(commandsDir);
|
|
9638
10933
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
9639
10934
|
return {
|
|
9640
|
-
relativePathFromCwd:
|
|
10935
|
+
relativePathFromCwd: join86(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
9641
10936
|
frontmatter: command.getFrontmatter(),
|
|
9642
10937
|
body: command.getBody()
|
|
9643
10938
|
};
|
|
@@ -9653,11 +10948,11 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
9653
10948
|
intendedRootDir: process.cwd()
|
|
9654
10949
|
});
|
|
9655
10950
|
const filename = basename21(relativePathFromCwd);
|
|
9656
|
-
const fullPath =
|
|
10951
|
+
const fullPath = join86(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
9657
10952
|
try {
|
|
9658
10953
|
await removeFile(fullPath);
|
|
9659
10954
|
return {
|
|
9660
|
-
relativePathFromCwd:
|
|
10955
|
+
relativePathFromCwd: join86(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
9661
10956
|
};
|
|
9662
10957
|
} catch (error) {
|
|
9663
10958
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -9666,23 +10961,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
9666
10961
|
}
|
|
9667
10962
|
}
|
|
9668
10963
|
var commandToolSchemas = {
|
|
9669
|
-
listCommands:
|
|
9670
|
-
getCommand:
|
|
9671
|
-
relativePathFromCwd:
|
|
10964
|
+
listCommands: z37.object({}),
|
|
10965
|
+
getCommand: z37.object({
|
|
10966
|
+
relativePathFromCwd: z37.string()
|
|
9672
10967
|
}),
|
|
9673
|
-
putCommand:
|
|
9674
|
-
relativePathFromCwd:
|
|
10968
|
+
putCommand: z37.object({
|
|
10969
|
+
relativePathFromCwd: z37.string(),
|
|
9675
10970
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
9676
|
-
body:
|
|
10971
|
+
body: z37.string()
|
|
9677
10972
|
}),
|
|
9678
|
-
deleteCommand:
|
|
9679
|
-
relativePathFromCwd:
|
|
10973
|
+
deleteCommand: z37.object({
|
|
10974
|
+
relativePathFromCwd: z37.string()
|
|
9680
10975
|
})
|
|
9681
10976
|
};
|
|
9682
10977
|
var commandTools = {
|
|
9683
10978
|
listCommands: {
|
|
9684
10979
|
name: "listCommands",
|
|
9685
|
-
description: `List all commands from ${
|
|
10980
|
+
description: `List all commands from ${join86(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
9686
10981
|
parameters: commandToolSchemas.listCommands,
|
|
9687
10982
|
execute: async () => {
|
|
9688
10983
|
const commands = await listCommands();
|
|
@@ -9724,11 +11019,11 @@ var commandTools = {
|
|
|
9724
11019
|
};
|
|
9725
11020
|
|
|
9726
11021
|
// src/mcp/ignore.ts
|
|
9727
|
-
import { join as
|
|
9728
|
-
import { z as
|
|
11022
|
+
import { join as join87 } from "path";
|
|
11023
|
+
import { z as z38 } from "zod/mini";
|
|
9729
11024
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
9730
11025
|
async function getIgnoreFile() {
|
|
9731
|
-
const ignoreFilePath =
|
|
11026
|
+
const ignoreFilePath = join87(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
9732
11027
|
try {
|
|
9733
11028
|
const content = await readFileContent(ignoreFilePath);
|
|
9734
11029
|
return {
|
|
@@ -9742,7 +11037,7 @@ async function getIgnoreFile() {
|
|
|
9742
11037
|
}
|
|
9743
11038
|
}
|
|
9744
11039
|
async function putIgnoreFile({ content }) {
|
|
9745
|
-
const ignoreFilePath =
|
|
11040
|
+
const ignoreFilePath = join87(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
9746
11041
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
9747
11042
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
9748
11043
|
throw new Error(
|
|
@@ -9763,8 +11058,8 @@ async function putIgnoreFile({ content }) {
|
|
|
9763
11058
|
}
|
|
9764
11059
|
}
|
|
9765
11060
|
async function deleteIgnoreFile() {
|
|
9766
|
-
const aiignorePath =
|
|
9767
|
-
const legacyIgnorePath =
|
|
11061
|
+
const aiignorePath = join87(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
11062
|
+
const legacyIgnorePath = join87(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
9768
11063
|
try {
|
|
9769
11064
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
9770
11065
|
return {
|
|
@@ -9782,11 +11077,11 @@ async function deleteIgnoreFile() {
|
|
|
9782
11077
|
}
|
|
9783
11078
|
}
|
|
9784
11079
|
var ignoreToolSchemas = {
|
|
9785
|
-
getIgnoreFile:
|
|
9786
|
-
putIgnoreFile:
|
|
9787
|
-
content:
|
|
11080
|
+
getIgnoreFile: z38.object({}),
|
|
11081
|
+
putIgnoreFile: z38.object({
|
|
11082
|
+
content: z38.string()
|
|
9788
11083
|
}),
|
|
9789
|
-
deleteIgnoreFile:
|
|
11084
|
+
deleteIgnoreFile: z38.object({})
|
|
9790
11085
|
};
|
|
9791
11086
|
var ignoreTools = {
|
|
9792
11087
|
getIgnoreFile: {
|
|
@@ -9819,8 +11114,8 @@ var ignoreTools = {
|
|
|
9819
11114
|
};
|
|
9820
11115
|
|
|
9821
11116
|
// src/mcp/mcp.ts
|
|
9822
|
-
import { join as
|
|
9823
|
-
import { z as
|
|
11117
|
+
import { join as join88 } from "path";
|
|
11118
|
+
import { z as z39 } from "zod/mini";
|
|
9824
11119
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
9825
11120
|
async function getMcpFile() {
|
|
9826
11121
|
const config = await ConfigResolver.resolve({});
|
|
@@ -9829,7 +11124,7 @@ async function getMcpFile() {
|
|
|
9829
11124
|
validate: true,
|
|
9830
11125
|
modularMcp: config.getModularMcp()
|
|
9831
11126
|
});
|
|
9832
|
-
const relativePathFromCwd =
|
|
11127
|
+
const relativePathFromCwd = join88(
|
|
9833
11128
|
rulesyncMcp.getRelativeDirPath(),
|
|
9834
11129
|
rulesyncMcp.getRelativeFilePath()
|
|
9835
11130
|
);
|
|
@@ -9862,7 +11157,7 @@ async function putMcpFile({ content }) {
|
|
|
9862
11157
|
const paths = RulesyncMcp.getSettablePaths();
|
|
9863
11158
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
9864
11159
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
9865
|
-
const fullPath =
|
|
11160
|
+
const fullPath = join88(baseDir, relativeDirPath, relativeFilePath);
|
|
9866
11161
|
const rulesyncMcp = new RulesyncMcp({
|
|
9867
11162
|
baseDir,
|
|
9868
11163
|
relativeDirPath,
|
|
@@ -9871,9 +11166,9 @@ async function putMcpFile({ content }) {
|
|
|
9871
11166
|
validate: true,
|
|
9872
11167
|
modularMcp: config.getModularMcp()
|
|
9873
11168
|
});
|
|
9874
|
-
await ensureDir(
|
|
11169
|
+
await ensureDir(join88(baseDir, relativeDirPath));
|
|
9875
11170
|
await writeFileContent(fullPath, content);
|
|
9876
|
-
const relativePathFromCwd =
|
|
11171
|
+
const relativePathFromCwd = join88(relativeDirPath, relativeFilePath);
|
|
9877
11172
|
return {
|
|
9878
11173
|
relativePathFromCwd,
|
|
9879
11174
|
content: rulesyncMcp.getFileContent()
|
|
@@ -9888,15 +11183,15 @@ async function deleteMcpFile() {
|
|
|
9888
11183
|
try {
|
|
9889
11184
|
const baseDir = process.cwd();
|
|
9890
11185
|
const paths = RulesyncMcp.getSettablePaths();
|
|
9891
|
-
const recommendedPath =
|
|
11186
|
+
const recommendedPath = join88(
|
|
9892
11187
|
baseDir,
|
|
9893
11188
|
paths.recommended.relativeDirPath,
|
|
9894
11189
|
paths.recommended.relativeFilePath
|
|
9895
11190
|
);
|
|
9896
|
-
const legacyPath =
|
|
11191
|
+
const legacyPath = join88(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
9897
11192
|
await removeFile(recommendedPath);
|
|
9898
11193
|
await removeFile(legacyPath);
|
|
9899
|
-
const relativePathFromCwd =
|
|
11194
|
+
const relativePathFromCwd = join88(
|
|
9900
11195
|
paths.recommended.relativeDirPath,
|
|
9901
11196
|
paths.recommended.relativeFilePath
|
|
9902
11197
|
);
|
|
@@ -9910,11 +11205,11 @@ async function deleteMcpFile() {
|
|
|
9910
11205
|
}
|
|
9911
11206
|
}
|
|
9912
11207
|
var mcpToolSchemas = {
|
|
9913
|
-
getMcpFile:
|
|
9914
|
-
putMcpFile:
|
|
9915
|
-
content:
|
|
11208
|
+
getMcpFile: z39.object({}),
|
|
11209
|
+
putMcpFile: z39.object({
|
|
11210
|
+
content: z39.string()
|
|
9916
11211
|
}),
|
|
9917
|
-
deleteMcpFile:
|
|
11212
|
+
deleteMcpFile: z39.object({})
|
|
9918
11213
|
};
|
|
9919
11214
|
var mcpTools = {
|
|
9920
11215
|
getMcpFile: {
|
|
@@ -9947,12 +11242,12 @@ var mcpTools = {
|
|
|
9947
11242
|
};
|
|
9948
11243
|
|
|
9949
11244
|
// src/mcp/rules.ts
|
|
9950
|
-
import { basename as basename22, join as
|
|
9951
|
-
import { z as
|
|
11245
|
+
import { basename as basename22, join as join89 } from "path";
|
|
11246
|
+
import { z as z40 } from "zod/mini";
|
|
9952
11247
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
9953
11248
|
var maxRulesCount = 1e3;
|
|
9954
11249
|
async function listRules() {
|
|
9955
|
-
const rulesDir =
|
|
11250
|
+
const rulesDir = join89(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
9956
11251
|
try {
|
|
9957
11252
|
const files = await listDirectoryFiles(rulesDir);
|
|
9958
11253
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -9965,7 +11260,7 @@ async function listRules() {
|
|
|
9965
11260
|
});
|
|
9966
11261
|
const frontmatter = rule.getFrontmatter();
|
|
9967
11262
|
return {
|
|
9968
|
-
relativePathFromCwd:
|
|
11263
|
+
relativePathFromCwd: join89(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
9969
11264
|
frontmatter
|
|
9970
11265
|
};
|
|
9971
11266
|
} catch (error) {
|
|
@@ -9992,7 +11287,7 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
9992
11287
|
validate: true
|
|
9993
11288
|
});
|
|
9994
11289
|
return {
|
|
9995
|
-
relativePathFromCwd:
|
|
11290
|
+
relativePathFromCwd: join89(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
9996
11291
|
frontmatter: rule.getFrontmatter(),
|
|
9997
11292
|
body: rule.getBody()
|
|
9998
11293
|
};
|
|
@@ -10021,7 +11316,7 @@ async function putRule({
|
|
|
10021
11316
|
try {
|
|
10022
11317
|
const existingRules = await listRules();
|
|
10023
11318
|
const isUpdate = existingRules.some(
|
|
10024
|
-
(rule2) => rule2.relativePathFromCwd ===
|
|
11319
|
+
(rule2) => rule2.relativePathFromCwd === join89(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
10025
11320
|
);
|
|
10026
11321
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
10027
11322
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -10034,11 +11329,11 @@ async function putRule({
|
|
|
10034
11329
|
body,
|
|
10035
11330
|
validate: true
|
|
10036
11331
|
});
|
|
10037
|
-
const rulesDir =
|
|
11332
|
+
const rulesDir = join89(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
10038
11333
|
await ensureDir(rulesDir);
|
|
10039
11334
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
10040
11335
|
return {
|
|
10041
|
-
relativePathFromCwd:
|
|
11336
|
+
relativePathFromCwd: join89(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
10042
11337
|
frontmatter: rule.getFrontmatter(),
|
|
10043
11338
|
body: rule.getBody()
|
|
10044
11339
|
};
|
|
@@ -10054,11 +11349,11 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
10054
11349
|
intendedRootDir: process.cwd()
|
|
10055
11350
|
});
|
|
10056
11351
|
const filename = basename22(relativePathFromCwd);
|
|
10057
|
-
const fullPath =
|
|
11352
|
+
const fullPath = join89(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
10058
11353
|
try {
|
|
10059
11354
|
await removeFile(fullPath);
|
|
10060
11355
|
return {
|
|
10061
|
-
relativePathFromCwd:
|
|
11356
|
+
relativePathFromCwd: join89(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
10062
11357
|
};
|
|
10063
11358
|
} catch (error) {
|
|
10064
11359
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -10067,23 +11362,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
10067
11362
|
}
|
|
10068
11363
|
}
|
|
10069
11364
|
var ruleToolSchemas = {
|
|
10070
|
-
listRules:
|
|
10071
|
-
getRule:
|
|
10072
|
-
relativePathFromCwd:
|
|
11365
|
+
listRules: z40.object({}),
|
|
11366
|
+
getRule: z40.object({
|
|
11367
|
+
relativePathFromCwd: z40.string()
|
|
10073
11368
|
}),
|
|
10074
|
-
putRule:
|
|
10075
|
-
relativePathFromCwd:
|
|
11369
|
+
putRule: z40.object({
|
|
11370
|
+
relativePathFromCwd: z40.string(),
|
|
10076
11371
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
10077
|
-
body:
|
|
11372
|
+
body: z40.string()
|
|
10078
11373
|
}),
|
|
10079
|
-
deleteRule:
|
|
10080
|
-
relativePathFromCwd:
|
|
11374
|
+
deleteRule: z40.object({
|
|
11375
|
+
relativePathFromCwd: z40.string()
|
|
10081
11376
|
})
|
|
10082
11377
|
};
|
|
10083
11378
|
var ruleTools = {
|
|
10084
11379
|
listRules: {
|
|
10085
11380
|
name: "listRules",
|
|
10086
|
-
description: `List all rules from ${
|
|
11381
|
+
description: `List all rules from ${join89(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
10087
11382
|
parameters: ruleToolSchemas.listRules,
|
|
10088
11383
|
execute: async () => {
|
|
10089
11384
|
const rules = await listRules();
|
|
@@ -10125,8 +11420,8 @@ var ruleTools = {
|
|
|
10125
11420
|
};
|
|
10126
11421
|
|
|
10127
11422
|
// src/mcp/skills.ts
|
|
10128
|
-
import { basename as basename23, dirname as dirname2, join as
|
|
10129
|
-
import { z as
|
|
11423
|
+
import { basename as basename23, dirname as dirname2, join as join90 } from "path";
|
|
11424
|
+
import { z as z41 } from "zod/mini";
|
|
10130
11425
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
10131
11426
|
var maxSkillsCount = 1e3;
|
|
10132
11427
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -10149,9 +11444,9 @@ function extractDirName(relativeDirPathFromCwd) {
|
|
|
10149
11444
|
return dirName;
|
|
10150
11445
|
}
|
|
10151
11446
|
async function listSkills() {
|
|
10152
|
-
const skillsDir =
|
|
11447
|
+
const skillsDir = join90(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
10153
11448
|
try {
|
|
10154
|
-
const skillDirPaths = await findFilesByGlobs(
|
|
11449
|
+
const skillDirPaths = await findFilesByGlobs(join90(skillsDir, "*"), { type: "dir" });
|
|
10155
11450
|
const skills = await Promise.all(
|
|
10156
11451
|
skillDirPaths.map(async (dirPath) => {
|
|
10157
11452
|
const dirName = basename23(dirPath);
|
|
@@ -10162,7 +11457,7 @@ async function listSkills() {
|
|
|
10162
11457
|
});
|
|
10163
11458
|
const frontmatter = skill.getFrontmatter();
|
|
10164
11459
|
return {
|
|
10165
|
-
relativeDirPathFromCwd:
|
|
11460
|
+
relativeDirPathFromCwd: join90(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
10166
11461
|
frontmatter
|
|
10167
11462
|
};
|
|
10168
11463
|
} catch (error) {
|
|
@@ -10188,7 +11483,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
10188
11483
|
dirName
|
|
10189
11484
|
});
|
|
10190
11485
|
return {
|
|
10191
|
-
relativeDirPathFromCwd:
|
|
11486
|
+
relativeDirPathFromCwd: join90(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
10192
11487
|
frontmatter: skill.getFrontmatter(),
|
|
10193
11488
|
body: skill.getBody(),
|
|
10194
11489
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -10222,7 +11517,7 @@ async function putSkill({
|
|
|
10222
11517
|
try {
|
|
10223
11518
|
const existingSkills = await listSkills();
|
|
10224
11519
|
const isUpdate = existingSkills.some(
|
|
10225
|
-
(skill2) => skill2.relativeDirPathFromCwd ===
|
|
11520
|
+
(skill2) => skill2.relativeDirPathFromCwd === join90(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
10226
11521
|
);
|
|
10227
11522
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
10228
11523
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -10237,9 +11532,9 @@ async function putSkill({
|
|
|
10237
11532
|
otherFiles: aiDirFiles,
|
|
10238
11533
|
validate: true
|
|
10239
11534
|
});
|
|
10240
|
-
const skillDirPath =
|
|
11535
|
+
const skillDirPath = join90(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
10241
11536
|
await ensureDir(skillDirPath);
|
|
10242
|
-
const skillFilePath =
|
|
11537
|
+
const skillFilePath = join90(skillDirPath, SKILL_FILE_NAME);
|
|
10243
11538
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
10244
11539
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
10245
11540
|
for (const file of otherFiles) {
|
|
@@ -10247,15 +11542,15 @@ async function putSkill({
|
|
|
10247
11542
|
relativePath: file.name,
|
|
10248
11543
|
intendedRootDir: skillDirPath
|
|
10249
11544
|
});
|
|
10250
|
-
const filePath =
|
|
10251
|
-
const fileDir =
|
|
11545
|
+
const filePath = join90(skillDirPath, file.name);
|
|
11546
|
+
const fileDir = join90(skillDirPath, dirname2(file.name));
|
|
10252
11547
|
if (fileDir !== skillDirPath) {
|
|
10253
11548
|
await ensureDir(fileDir);
|
|
10254
11549
|
}
|
|
10255
11550
|
await writeFileContent(filePath, file.body);
|
|
10256
11551
|
}
|
|
10257
11552
|
return {
|
|
10258
|
-
relativeDirPathFromCwd:
|
|
11553
|
+
relativeDirPathFromCwd: join90(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
10259
11554
|
frontmatter: skill.getFrontmatter(),
|
|
10260
11555
|
body: skill.getBody(),
|
|
10261
11556
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -10277,13 +11572,13 @@ async function deleteSkill({
|
|
|
10277
11572
|
intendedRootDir: process.cwd()
|
|
10278
11573
|
});
|
|
10279
11574
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
10280
|
-
const skillDirPath =
|
|
11575
|
+
const skillDirPath = join90(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
10281
11576
|
try {
|
|
10282
11577
|
if (await directoryExists(skillDirPath)) {
|
|
10283
11578
|
await removeDirectory(skillDirPath);
|
|
10284
11579
|
}
|
|
10285
11580
|
return {
|
|
10286
|
-
relativeDirPathFromCwd:
|
|
11581
|
+
relativeDirPathFromCwd: join90(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
10287
11582
|
};
|
|
10288
11583
|
} catch (error) {
|
|
10289
11584
|
throw new Error(
|
|
@@ -10294,29 +11589,29 @@ async function deleteSkill({
|
|
|
10294
11589
|
);
|
|
10295
11590
|
}
|
|
10296
11591
|
}
|
|
10297
|
-
var McpSkillFileSchema =
|
|
10298
|
-
name:
|
|
10299
|
-
body:
|
|
11592
|
+
var McpSkillFileSchema = z41.object({
|
|
11593
|
+
name: z41.string(),
|
|
11594
|
+
body: z41.string()
|
|
10300
11595
|
});
|
|
10301
11596
|
var skillToolSchemas = {
|
|
10302
|
-
listSkills:
|
|
10303
|
-
getSkill:
|
|
10304
|
-
relativeDirPathFromCwd:
|
|
11597
|
+
listSkills: z41.object({}),
|
|
11598
|
+
getSkill: z41.object({
|
|
11599
|
+
relativeDirPathFromCwd: z41.string()
|
|
10305
11600
|
}),
|
|
10306
|
-
putSkill:
|
|
10307
|
-
relativeDirPathFromCwd:
|
|
11601
|
+
putSkill: z41.object({
|
|
11602
|
+
relativeDirPathFromCwd: z41.string(),
|
|
10308
11603
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
10309
|
-
body:
|
|
10310
|
-
otherFiles:
|
|
11604
|
+
body: z41.string(),
|
|
11605
|
+
otherFiles: z41.optional(z41.array(McpSkillFileSchema))
|
|
10311
11606
|
}),
|
|
10312
|
-
deleteSkill:
|
|
10313
|
-
relativeDirPathFromCwd:
|
|
11607
|
+
deleteSkill: z41.object({
|
|
11608
|
+
relativeDirPathFromCwd: z41.string()
|
|
10314
11609
|
})
|
|
10315
11610
|
};
|
|
10316
11611
|
var skillTools = {
|
|
10317
11612
|
listSkills: {
|
|
10318
11613
|
name: "listSkills",
|
|
10319
|
-
description: `List all skills from ${
|
|
11614
|
+
description: `List all skills from ${join90(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
10320
11615
|
parameters: skillToolSchemas.listSkills,
|
|
10321
11616
|
execute: async () => {
|
|
10322
11617
|
const skills = await listSkills();
|
|
@@ -10359,12 +11654,12 @@ var skillTools = {
|
|
|
10359
11654
|
};
|
|
10360
11655
|
|
|
10361
11656
|
// src/mcp/subagents.ts
|
|
10362
|
-
import { basename as basename24, join as
|
|
10363
|
-
import { z as
|
|
11657
|
+
import { basename as basename24, join as join91 } from "path";
|
|
11658
|
+
import { z as z42 } from "zod/mini";
|
|
10364
11659
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
10365
11660
|
var maxSubagentsCount = 1e3;
|
|
10366
11661
|
async function listSubagents() {
|
|
10367
|
-
const subagentsDir =
|
|
11662
|
+
const subagentsDir = join91(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
10368
11663
|
try {
|
|
10369
11664
|
const files = await listDirectoryFiles(subagentsDir);
|
|
10370
11665
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -10377,7 +11672,7 @@ async function listSubagents() {
|
|
|
10377
11672
|
});
|
|
10378
11673
|
const frontmatter = subagent.getFrontmatter();
|
|
10379
11674
|
return {
|
|
10380
|
-
relativePathFromCwd:
|
|
11675
|
+
relativePathFromCwd: join91(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
10381
11676
|
frontmatter
|
|
10382
11677
|
};
|
|
10383
11678
|
} catch (error) {
|
|
@@ -10406,7 +11701,7 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
10406
11701
|
validate: true
|
|
10407
11702
|
});
|
|
10408
11703
|
return {
|
|
10409
|
-
relativePathFromCwd:
|
|
11704
|
+
relativePathFromCwd: join91(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
10410
11705
|
frontmatter: subagent.getFrontmatter(),
|
|
10411
11706
|
body: subagent.getBody()
|
|
10412
11707
|
};
|
|
@@ -10435,7 +11730,7 @@ async function putSubagent({
|
|
|
10435
11730
|
try {
|
|
10436
11731
|
const existingSubagents = await listSubagents();
|
|
10437
11732
|
const isUpdate = existingSubagents.some(
|
|
10438
|
-
(subagent2) => subagent2.relativePathFromCwd ===
|
|
11733
|
+
(subagent2) => subagent2.relativePathFromCwd === join91(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
10439
11734
|
);
|
|
10440
11735
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
10441
11736
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -10448,11 +11743,11 @@ async function putSubagent({
|
|
|
10448
11743
|
body,
|
|
10449
11744
|
validate: true
|
|
10450
11745
|
});
|
|
10451
|
-
const subagentsDir =
|
|
11746
|
+
const subagentsDir = join91(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
10452
11747
|
await ensureDir(subagentsDir);
|
|
10453
11748
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
10454
11749
|
return {
|
|
10455
|
-
relativePathFromCwd:
|
|
11750
|
+
relativePathFromCwd: join91(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
10456
11751
|
frontmatter: subagent.getFrontmatter(),
|
|
10457
11752
|
body: subagent.getBody()
|
|
10458
11753
|
};
|
|
@@ -10468,11 +11763,11 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
10468
11763
|
intendedRootDir: process.cwd()
|
|
10469
11764
|
});
|
|
10470
11765
|
const filename = basename24(relativePathFromCwd);
|
|
10471
|
-
const fullPath =
|
|
11766
|
+
const fullPath = join91(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
10472
11767
|
try {
|
|
10473
11768
|
await removeFile(fullPath);
|
|
10474
11769
|
return {
|
|
10475
|
-
relativePathFromCwd:
|
|
11770
|
+
relativePathFromCwd: join91(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
10476
11771
|
};
|
|
10477
11772
|
} catch (error) {
|
|
10478
11773
|
throw new Error(
|
|
@@ -10484,23 +11779,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
10484
11779
|
}
|
|
10485
11780
|
}
|
|
10486
11781
|
var subagentToolSchemas = {
|
|
10487
|
-
listSubagents:
|
|
10488
|
-
getSubagent:
|
|
10489
|
-
relativePathFromCwd:
|
|
11782
|
+
listSubagents: z42.object({}),
|
|
11783
|
+
getSubagent: z42.object({
|
|
11784
|
+
relativePathFromCwd: z42.string()
|
|
10490
11785
|
}),
|
|
10491
|
-
putSubagent:
|
|
10492
|
-
relativePathFromCwd:
|
|
11786
|
+
putSubagent: z42.object({
|
|
11787
|
+
relativePathFromCwd: z42.string(),
|
|
10493
11788
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
10494
|
-
body:
|
|
11789
|
+
body: z42.string()
|
|
10495
11790
|
}),
|
|
10496
|
-
deleteSubagent:
|
|
10497
|
-
relativePathFromCwd:
|
|
11791
|
+
deleteSubagent: z42.object({
|
|
11792
|
+
relativePathFromCwd: z42.string()
|
|
10498
11793
|
})
|
|
10499
11794
|
};
|
|
10500
11795
|
var subagentTools = {
|
|
10501
11796
|
listSubagents: {
|
|
10502
11797
|
name: "listSubagents",
|
|
10503
|
-
description: `List all subagents from ${
|
|
11798
|
+
description: `List all subagents from ${join91(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
10504
11799
|
parameters: subagentToolSchemas.listSubagents,
|
|
10505
11800
|
execute: async () => {
|
|
10506
11801
|
const subagents = await listSubagents();
|
|
@@ -10578,7 +11873,7 @@ async function mcpCommand({ version }) {
|
|
|
10578
11873
|
}
|
|
10579
11874
|
|
|
10580
11875
|
// src/cli/index.ts
|
|
10581
|
-
var getVersion = () => "4.
|
|
11876
|
+
var getVersion = () => "4.1.0";
|
|
10582
11877
|
var main = async () => {
|
|
10583
11878
|
const program = new Command();
|
|
10584
11879
|
const version = getVersion();
|