rulesync 7.4.0 → 7.6.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 +24 -23
- package/dist/{chunk-UCC3WPDL.js → chunk-M7XFNAZA.js} +608 -260
- package/dist/cli/index.cjs +838 -485
- package/dist/cli/index.js +8 -3
- package/dist/index.cjs +573 -225
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -321,6 +321,7 @@ var ALL_TOOL_TARGETS = [
|
|
|
321
321
|
"cursor",
|
|
322
322
|
"factorydroid",
|
|
323
323
|
"geminicli",
|
|
324
|
+
"goose",
|
|
324
325
|
"junie",
|
|
325
326
|
"kilo",
|
|
326
327
|
"kiro",
|
|
@@ -630,7 +631,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
630
631
|
|
|
631
632
|
// src/lib/generate.ts
|
|
632
633
|
var import_es_toolkit4 = require("es-toolkit");
|
|
633
|
-
var
|
|
634
|
+
var import_node_path111 = require("path");
|
|
634
635
|
|
|
635
636
|
// src/features/commands/commands-processor.ts
|
|
636
637
|
var import_node_path20 = require("path");
|
|
@@ -1000,7 +1001,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
1000
1001
|
return {
|
|
1001
1002
|
baseDir,
|
|
1002
1003
|
relativeDirPath: _SimulatedCommand.getSettablePaths().relativeDirPath,
|
|
1003
|
-
relativeFilePath
|
|
1004
|
+
relativeFilePath,
|
|
1004
1005
|
frontmatter: result.data,
|
|
1005
1006
|
body: content.trim(),
|
|
1006
1007
|
validate
|
|
@@ -1057,7 +1058,7 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
1057
1058
|
return new _AgentsmdCommand({
|
|
1058
1059
|
baseDir,
|
|
1059
1060
|
relativeDirPath: _AgentsmdCommand.getSettablePaths().relativeDirPath,
|
|
1060
|
-
relativeFilePath
|
|
1061
|
+
relativeFilePath,
|
|
1061
1062
|
frontmatter: result.data,
|
|
1062
1063
|
body: content.trim(),
|
|
1063
1064
|
validate
|
|
@@ -1134,6 +1135,16 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
1134
1135
|
getBody() {
|
|
1135
1136
|
return this.body;
|
|
1136
1137
|
}
|
|
1138
|
+
withRelativeFilePath(newRelativeFilePath) {
|
|
1139
|
+
return new _RulesyncCommand({
|
|
1140
|
+
baseDir: this.getBaseDir(),
|
|
1141
|
+
relativeDirPath: this.getRelativeDirPath(),
|
|
1142
|
+
relativeFilePath: newRelativeFilePath,
|
|
1143
|
+
frontmatter: this.getFrontmatter(),
|
|
1144
|
+
body: this.getBody(),
|
|
1145
|
+
fileContent: this.getFileContent()
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1137
1148
|
validate() {
|
|
1138
1149
|
if (!this.frontmatter) {
|
|
1139
1150
|
return { success: true, error: null };
|
|
@@ -1164,11 +1175,10 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
1164
1175
|
if (!result.success) {
|
|
1165
1176
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
1166
1177
|
}
|
|
1167
|
-
const filename = (0, import_node_path7.basename)(relativeFilePath);
|
|
1168
1178
|
return new _RulesyncCommand({
|
|
1169
1179
|
baseDir: process.cwd(),
|
|
1170
1180
|
relativeDirPath: _RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
1171
|
-
relativeFilePath
|
|
1181
|
+
relativeFilePath,
|
|
1172
1182
|
frontmatter: result.data,
|
|
1173
1183
|
body: content.trim(),
|
|
1174
1184
|
fileContent
|
|
@@ -1327,7 +1337,7 @@ ${body}${turboDirective}`;
|
|
|
1327
1337
|
return new _AntigravityCommand({
|
|
1328
1338
|
baseDir,
|
|
1329
1339
|
relativeDirPath: _AntigravityCommand.getSettablePaths().relativeDirPath,
|
|
1330
|
-
relativeFilePath
|
|
1340
|
+
relativeFilePath,
|
|
1331
1341
|
frontmatter: result.data,
|
|
1332
1342
|
body: content.trim(),
|
|
1333
1343
|
fileContent,
|
|
@@ -1473,7 +1483,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1473
1483
|
return new _ClaudecodeCommand({
|
|
1474
1484
|
baseDir,
|
|
1475
1485
|
relativeDirPath: paths.relativeDirPath,
|
|
1476
|
-
relativeFilePath
|
|
1486
|
+
relativeFilePath,
|
|
1477
1487
|
frontmatter: result.data,
|
|
1478
1488
|
body: content.trim(),
|
|
1479
1489
|
validate
|
|
@@ -1563,7 +1573,7 @@ var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
|
1563
1573
|
return new _ClineCommand({
|
|
1564
1574
|
baseDir,
|
|
1565
1575
|
relativeDirPath: paths.relativeDirPath,
|
|
1566
|
-
relativeFilePath
|
|
1576
|
+
relativeFilePath,
|
|
1567
1577
|
fileContent: content.trim(),
|
|
1568
1578
|
validate
|
|
1569
1579
|
});
|
|
@@ -1650,7 +1660,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1650
1660
|
return new _CodexcliCommand({
|
|
1651
1661
|
baseDir,
|
|
1652
1662
|
relativeDirPath: paths.relativeDirPath,
|
|
1653
|
-
relativeFilePath
|
|
1663
|
+
relativeFilePath,
|
|
1654
1664
|
fileContent: content.trim(),
|
|
1655
1665
|
validate
|
|
1656
1666
|
});
|
|
@@ -1783,7 +1793,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1783
1793
|
return new _CopilotCommand({
|
|
1784
1794
|
baseDir,
|
|
1785
1795
|
relativeDirPath: paths.relativeDirPath,
|
|
1786
|
-
relativeFilePath
|
|
1796
|
+
relativeFilePath,
|
|
1787
1797
|
frontmatter: result.data,
|
|
1788
1798
|
body: content.trim(),
|
|
1789
1799
|
validate
|
|
@@ -1875,7 +1885,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1875
1885
|
return new _CursorCommand({
|
|
1876
1886
|
baseDir,
|
|
1877
1887
|
relativeDirPath: paths.relativeDirPath,
|
|
1878
|
-
relativeFilePath
|
|
1888
|
+
relativeFilePath,
|
|
1879
1889
|
fileContent: content.trim(),
|
|
1880
1890
|
validate
|
|
1881
1891
|
});
|
|
@@ -1930,7 +1940,7 @@ var FactorydroidCommand = class _FactorydroidCommand extends SimulatedCommand {
|
|
|
1930
1940
|
return new _FactorydroidCommand({
|
|
1931
1941
|
baseDir,
|
|
1932
1942
|
relativeDirPath: paths.relativeDirPath,
|
|
1933
|
-
relativeFilePath
|
|
1943
|
+
relativeFilePath,
|
|
1934
1944
|
frontmatter: result.data,
|
|
1935
1945
|
body: content.trim(),
|
|
1936
1946
|
validate
|
|
@@ -2062,7 +2072,7 @@ ${geminiFrontmatter.prompt}
|
|
|
2062
2072
|
return new _GeminiCliCommand({
|
|
2063
2073
|
baseDir,
|
|
2064
2074
|
relativeDirPath: paths.relativeDirPath,
|
|
2065
|
-
relativeFilePath
|
|
2075
|
+
relativeFilePath,
|
|
2066
2076
|
fileContent,
|
|
2067
2077
|
validate
|
|
2068
2078
|
});
|
|
@@ -2159,7 +2169,7 @@ var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
|
2159
2169
|
return new _KiloCommand({
|
|
2160
2170
|
baseDir,
|
|
2161
2171
|
relativeDirPath: paths.relativeDirPath,
|
|
2162
|
-
relativeFilePath
|
|
2172
|
+
relativeFilePath,
|
|
2163
2173
|
fileContent: content.trim(),
|
|
2164
2174
|
validate
|
|
2165
2175
|
});
|
|
@@ -2240,7 +2250,7 @@ var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
|
2240
2250
|
return new _KiroCommand({
|
|
2241
2251
|
baseDir,
|
|
2242
2252
|
relativeDirPath: paths.relativeDirPath,
|
|
2243
|
-
relativeFilePath
|
|
2253
|
+
relativeFilePath,
|
|
2244
2254
|
fileContent: content.trim(),
|
|
2245
2255
|
validate
|
|
2246
2256
|
});
|
|
@@ -2372,7 +2382,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2372
2382
|
return new _OpenCodeCommand({
|
|
2373
2383
|
baseDir,
|
|
2374
2384
|
relativeDirPath: paths.relativeDirPath,
|
|
2375
|
-
relativeFilePath
|
|
2385
|
+
relativeFilePath,
|
|
2376
2386
|
frontmatter: result.data,
|
|
2377
2387
|
body: content.trim(),
|
|
2378
2388
|
validate
|
|
@@ -2517,7 +2527,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2517
2527
|
return new _RooCommand({
|
|
2518
2528
|
baseDir,
|
|
2519
2529
|
relativeDirPath: _RooCommand.getSettablePaths().relativeDirPath,
|
|
2520
|
-
relativeFilePath
|
|
2530
|
+
relativeFilePath,
|
|
2521
2531
|
frontmatter: result.data,
|
|
2522
2532
|
body: content.trim(),
|
|
2523
2533
|
fileContent,
|
|
@@ -2564,42 +2574,78 @@ var toolCommandFactories = /* @__PURE__ */ new Map([
|
|
|
2564
2574
|
"agentsmd",
|
|
2565
2575
|
{
|
|
2566
2576
|
class: AgentsmdCommand,
|
|
2567
|
-
meta: {
|
|
2577
|
+
meta: {
|
|
2578
|
+
extension: "md",
|
|
2579
|
+
supportsProject: true,
|
|
2580
|
+
supportsGlobal: false,
|
|
2581
|
+
isSimulated: true,
|
|
2582
|
+
supportsSubdirectory: false
|
|
2583
|
+
}
|
|
2568
2584
|
}
|
|
2569
2585
|
],
|
|
2570
2586
|
[
|
|
2571
2587
|
"antigravity",
|
|
2572
2588
|
{
|
|
2573
2589
|
class: AntigravityCommand,
|
|
2574
|
-
meta: {
|
|
2590
|
+
meta: {
|
|
2591
|
+
extension: "md",
|
|
2592
|
+
supportsProject: true,
|
|
2593
|
+
supportsGlobal: false,
|
|
2594
|
+
isSimulated: false,
|
|
2595
|
+
supportsSubdirectory: false
|
|
2596
|
+
}
|
|
2575
2597
|
}
|
|
2576
2598
|
],
|
|
2577
2599
|
[
|
|
2578
2600
|
"claudecode",
|
|
2579
2601
|
{
|
|
2580
2602
|
class: ClaudecodeCommand,
|
|
2581
|
-
meta: {
|
|
2603
|
+
meta: {
|
|
2604
|
+
extension: "md",
|
|
2605
|
+
supportsProject: true,
|
|
2606
|
+
supportsGlobal: true,
|
|
2607
|
+
isSimulated: false,
|
|
2608
|
+
supportsSubdirectory: true
|
|
2609
|
+
}
|
|
2582
2610
|
}
|
|
2583
2611
|
],
|
|
2584
2612
|
[
|
|
2585
2613
|
"claudecode-legacy",
|
|
2586
2614
|
{
|
|
2587
2615
|
class: ClaudecodeCommand,
|
|
2588
|
-
meta: {
|
|
2616
|
+
meta: {
|
|
2617
|
+
extension: "md",
|
|
2618
|
+
supportsProject: true,
|
|
2619
|
+
supportsGlobal: true,
|
|
2620
|
+
isSimulated: false,
|
|
2621
|
+
supportsSubdirectory: true
|
|
2622
|
+
}
|
|
2589
2623
|
}
|
|
2590
2624
|
],
|
|
2591
2625
|
[
|
|
2592
2626
|
"cline",
|
|
2593
2627
|
{
|
|
2594
2628
|
class: ClineCommand,
|
|
2595
|
-
meta: {
|
|
2629
|
+
meta: {
|
|
2630
|
+
extension: "md",
|
|
2631
|
+
supportsProject: true,
|
|
2632
|
+
supportsGlobal: true,
|
|
2633
|
+
isSimulated: false,
|
|
2634
|
+
supportsSubdirectory: false
|
|
2635
|
+
}
|
|
2596
2636
|
}
|
|
2597
2637
|
],
|
|
2598
2638
|
[
|
|
2599
2639
|
"codexcli",
|
|
2600
2640
|
{
|
|
2601
2641
|
class: CodexcliCommand,
|
|
2602
|
-
meta: {
|
|
2642
|
+
meta: {
|
|
2643
|
+
extension: "md",
|
|
2644
|
+
supportsProject: false,
|
|
2645
|
+
supportsGlobal: true,
|
|
2646
|
+
isSimulated: false,
|
|
2647
|
+
supportsSubdirectory: false
|
|
2648
|
+
}
|
|
2603
2649
|
}
|
|
2604
2650
|
],
|
|
2605
2651
|
[
|
|
@@ -2610,7 +2656,8 @@ var toolCommandFactories = /* @__PURE__ */ new Map([
|
|
|
2610
2656
|
extension: "prompt.md",
|
|
2611
2657
|
supportsProject: true,
|
|
2612
2658
|
supportsGlobal: false,
|
|
2613
|
-
isSimulated: false
|
|
2659
|
+
isSimulated: false,
|
|
2660
|
+
supportsSubdirectory: false
|
|
2614
2661
|
}
|
|
2615
2662
|
}
|
|
2616
2663
|
],
|
|
@@ -2618,49 +2665,91 @@ var toolCommandFactories = /* @__PURE__ */ new Map([
|
|
|
2618
2665
|
"cursor",
|
|
2619
2666
|
{
|
|
2620
2667
|
class: CursorCommand,
|
|
2621
|
-
meta: {
|
|
2668
|
+
meta: {
|
|
2669
|
+
extension: "md",
|
|
2670
|
+
supportsProject: true,
|
|
2671
|
+
supportsGlobal: true,
|
|
2672
|
+
isSimulated: false,
|
|
2673
|
+
supportsSubdirectory: false
|
|
2674
|
+
}
|
|
2622
2675
|
}
|
|
2623
2676
|
],
|
|
2624
2677
|
[
|
|
2625
2678
|
"factorydroid",
|
|
2626
2679
|
{
|
|
2627
2680
|
class: FactorydroidCommand,
|
|
2628
|
-
meta: {
|
|
2681
|
+
meta: {
|
|
2682
|
+
extension: "md",
|
|
2683
|
+
supportsProject: true,
|
|
2684
|
+
supportsGlobal: true,
|
|
2685
|
+
isSimulated: true,
|
|
2686
|
+
supportsSubdirectory: false
|
|
2687
|
+
}
|
|
2629
2688
|
}
|
|
2630
2689
|
],
|
|
2631
2690
|
[
|
|
2632
2691
|
"geminicli",
|
|
2633
2692
|
{
|
|
2634
2693
|
class: GeminiCliCommand,
|
|
2635
|
-
meta: {
|
|
2694
|
+
meta: {
|
|
2695
|
+
extension: "toml",
|
|
2696
|
+
supportsProject: true,
|
|
2697
|
+
supportsGlobal: true,
|
|
2698
|
+
isSimulated: false,
|
|
2699
|
+
supportsSubdirectory: true
|
|
2700
|
+
}
|
|
2636
2701
|
}
|
|
2637
2702
|
],
|
|
2638
2703
|
[
|
|
2639
2704
|
"kilo",
|
|
2640
2705
|
{
|
|
2641
2706
|
class: KiloCommand,
|
|
2642
|
-
meta: {
|
|
2707
|
+
meta: {
|
|
2708
|
+
extension: "md",
|
|
2709
|
+
supportsProject: true,
|
|
2710
|
+
supportsGlobal: true,
|
|
2711
|
+
isSimulated: false,
|
|
2712
|
+
supportsSubdirectory: false
|
|
2713
|
+
}
|
|
2643
2714
|
}
|
|
2644
2715
|
],
|
|
2645
2716
|
[
|
|
2646
2717
|
"kiro",
|
|
2647
2718
|
{
|
|
2648
2719
|
class: KiroCommand,
|
|
2649
|
-
meta: {
|
|
2720
|
+
meta: {
|
|
2721
|
+
extension: "md",
|
|
2722
|
+
supportsProject: true,
|
|
2723
|
+
supportsGlobal: false,
|
|
2724
|
+
isSimulated: false,
|
|
2725
|
+
supportsSubdirectory: false
|
|
2726
|
+
}
|
|
2650
2727
|
}
|
|
2651
2728
|
],
|
|
2652
2729
|
[
|
|
2653
2730
|
"opencode",
|
|
2654
2731
|
{
|
|
2655
2732
|
class: OpenCodeCommand,
|
|
2656
|
-
meta: {
|
|
2733
|
+
meta: {
|
|
2734
|
+
extension: "md",
|
|
2735
|
+
supportsProject: true,
|
|
2736
|
+
supportsGlobal: true,
|
|
2737
|
+
isSimulated: false,
|
|
2738
|
+
supportsSubdirectory: true
|
|
2739
|
+
}
|
|
2657
2740
|
}
|
|
2658
2741
|
],
|
|
2659
2742
|
[
|
|
2660
2743
|
"roo",
|
|
2661
2744
|
{
|
|
2662
2745
|
class: RooCommand,
|
|
2663
|
-
meta: {
|
|
2746
|
+
meta: {
|
|
2747
|
+
extension: "md",
|
|
2748
|
+
supportsProject: true,
|
|
2749
|
+
supportsGlobal: false,
|
|
2750
|
+
isSimulated: false,
|
|
2751
|
+
supportsSubdirectory: true
|
|
2752
|
+
}
|
|
2664
2753
|
}
|
|
2665
2754
|
]
|
|
2666
2755
|
]);
|
|
@@ -2713,13 +2802,27 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2713
2802
|
(file) => file instanceof RulesyncCommand
|
|
2714
2803
|
);
|
|
2715
2804
|
const factory = this.getFactory(this.toolTarget);
|
|
2805
|
+
const flattenedPathOrigins = /* @__PURE__ */ new Map();
|
|
2716
2806
|
const toolCommands = rulesyncCommands.map((rulesyncCommand) => {
|
|
2717
2807
|
if (!factory.class.isTargetedByRulesyncCommand(rulesyncCommand)) {
|
|
2718
2808
|
return null;
|
|
2719
2809
|
}
|
|
2810
|
+
const originalRelativePath = rulesyncCommand.getRelativeFilePath();
|
|
2811
|
+
const commandToConvert = factory.meta.supportsSubdirectory ? rulesyncCommand : this.flattenRelativeFilePath(rulesyncCommand);
|
|
2812
|
+
if (!factory.meta.supportsSubdirectory) {
|
|
2813
|
+
const flattenedPath = commandToConvert.getRelativeFilePath();
|
|
2814
|
+
const firstOrigin = flattenedPathOrigins.get(flattenedPath);
|
|
2815
|
+
if (firstOrigin && firstOrigin !== originalRelativePath) {
|
|
2816
|
+
logger.warn(
|
|
2817
|
+
`Command path collision detected while flattening for ${this.toolTarget}: "${firstOrigin}" and "${originalRelativePath}" both map to "${flattenedPath}". The later command will overwrite the earlier one.`
|
|
2818
|
+
);
|
|
2819
|
+
} else if (!firstOrigin) {
|
|
2820
|
+
flattenedPathOrigins.set(flattenedPath, originalRelativePath);
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2720
2823
|
return factory.class.fromRulesyncCommand({
|
|
2721
2824
|
baseDir: this.baseDir,
|
|
2722
|
-
rulesyncCommand,
|
|
2825
|
+
rulesyncCommand: commandToConvert,
|
|
2723
2826
|
global: this.global
|
|
2724
2827
|
});
|
|
2725
2828
|
}).filter((command) => command !== null);
|
|
@@ -2734,17 +2837,26 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2734
2837
|
});
|
|
2735
2838
|
return rulesyncCommands;
|
|
2736
2839
|
}
|
|
2840
|
+
flattenRelativeFilePath(rulesyncCommand) {
|
|
2841
|
+
const flatPath = (0, import_node_path20.basename)(rulesyncCommand.getRelativeFilePath());
|
|
2842
|
+
if (flatPath === rulesyncCommand.getRelativeFilePath()) return rulesyncCommand;
|
|
2843
|
+
return rulesyncCommand.withRelativeFilePath(flatPath);
|
|
2844
|
+
}
|
|
2845
|
+
safeRelativePath(basePath, fullPath) {
|
|
2846
|
+
const rel = (0, import_node_path20.relative)(basePath, fullPath);
|
|
2847
|
+
checkPathTraversal({ relativePath: rel, intendedRootDir: basePath });
|
|
2848
|
+
return rel;
|
|
2849
|
+
}
|
|
2737
2850
|
/**
|
|
2738
2851
|
* Implementation of abstract method from FeatureProcessor
|
|
2739
2852
|
* Load and parse rulesync command files from .rulesync/commands/ directory
|
|
2740
2853
|
*/
|
|
2741
2854
|
async loadRulesyncFiles() {
|
|
2742
|
-
const
|
|
2743
|
-
|
|
2744
|
-
);
|
|
2855
|
+
const basePath = RulesyncCommand.getSettablePaths().relativeDirPath;
|
|
2856
|
+
const rulesyncCommandPaths = await findFilesByGlobs((0, import_node_path20.join)(basePath, "**", "*.md"));
|
|
2745
2857
|
const rulesyncCommands = await Promise.all(
|
|
2746
2858
|
rulesyncCommandPaths.map(
|
|
2747
|
-
(path3) => RulesyncCommand.fromFile({ relativeFilePath: (
|
|
2859
|
+
(path3) => RulesyncCommand.fromFile({ relativeFilePath: this.safeRelativePath(basePath, path3) })
|
|
2748
2860
|
)
|
|
2749
2861
|
);
|
|
2750
2862
|
logger.debug(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
@@ -2759,15 +2871,15 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2759
2871
|
} = {}) {
|
|
2760
2872
|
const factory = this.getFactory(this.toolTarget);
|
|
2761
2873
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
2762
|
-
const
|
|
2763
|
-
|
|
2764
|
-
);
|
|
2874
|
+
const baseDirFull = (0, import_node_path20.join)(this.baseDir, paths.relativeDirPath);
|
|
2875
|
+
const globPattern = factory.meta.supportsSubdirectory ? (0, import_node_path20.join)(baseDirFull, "**", `*.${factory.meta.extension}`) : (0, import_node_path20.join)(baseDirFull, `*.${factory.meta.extension}`);
|
|
2876
|
+
const commandFilePaths = await findFilesByGlobs(globPattern);
|
|
2765
2877
|
if (forDeletion) {
|
|
2766
2878
|
const toolCommands2 = commandFilePaths.map(
|
|
2767
2879
|
(path3) => factory.class.forDeletion({
|
|
2768
2880
|
baseDir: this.baseDir,
|
|
2769
2881
|
relativeDirPath: paths.relativeDirPath,
|
|
2770
|
-
relativeFilePath: (
|
|
2882
|
+
relativeFilePath: this.safeRelativePath(baseDirFull, path3),
|
|
2771
2883
|
global: this.global
|
|
2772
2884
|
})
|
|
2773
2885
|
).filter((cmd) => cmd.isDeletable());
|
|
@@ -2778,7 +2890,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2778
2890
|
commandFilePaths.map(
|
|
2779
2891
|
(path3) => factory.class.fromFile({
|
|
2780
2892
|
baseDir: this.baseDir,
|
|
2781
|
-
relativeFilePath: (
|
|
2893
|
+
relativeFilePath: this.safeRelativePath(baseDirFull, path3),
|
|
2782
2894
|
global: this.global
|
|
2783
2895
|
})
|
|
2784
2896
|
)
|
|
@@ -5365,24 +5477,25 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
5365
5477
|
getToml() {
|
|
5366
5478
|
return this.toml;
|
|
5367
5479
|
}
|
|
5368
|
-
static getSettablePaths(
|
|
5369
|
-
if (!global) {
|
|
5370
|
-
throw new Error("CodexcliMcp only supports global mode. Please pass { global: true }.");
|
|
5371
|
-
}
|
|
5480
|
+
static getSettablePaths(_options = {}) {
|
|
5372
5481
|
return {
|
|
5373
5482
|
relativeDirPath: ".codex",
|
|
5374
5483
|
relativeFilePath: "config.toml"
|
|
5375
5484
|
};
|
|
5376
5485
|
}
|
|
5486
|
+
/**
|
|
5487
|
+
* config.toml may contain other Codex settings, so it should not be deleted.
|
|
5488
|
+
*/
|
|
5489
|
+
isDeletable() {
|
|
5490
|
+
return false;
|
|
5491
|
+
}
|
|
5377
5492
|
static async fromFile({
|
|
5378
5493
|
baseDir = process.cwd(),
|
|
5379
5494
|
validate = true,
|
|
5380
5495
|
global = false
|
|
5381
5496
|
}) {
|
|
5382
5497
|
const paths = this.getSettablePaths({ global });
|
|
5383
|
-
const fileContent = await
|
|
5384
|
-
(0, import_node_path42.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
5385
|
-
);
|
|
5498
|
+
const fileContent = await readFileContentOrNull((0, import_node_path42.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? smolToml.stringify({});
|
|
5386
5499
|
return new _CodexcliMcp({
|
|
5387
5500
|
baseDir,
|
|
5388
5501
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -6438,7 +6551,7 @@ var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
|
6438
6551
|
{
|
|
6439
6552
|
class: CodexcliMcp,
|
|
6440
6553
|
meta: {
|
|
6441
|
-
supportsProject:
|
|
6554
|
+
supportsProject: true,
|
|
6442
6555
|
supportsGlobal: true,
|
|
6443
6556
|
supportsEnabledTools: true,
|
|
6444
6557
|
supportsDisabledTools: true
|
|
@@ -6698,8 +6811,8 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
6698
6811
|
|
|
6699
6812
|
// src/features/rules/rules-processor.ts
|
|
6700
6813
|
var import_toon = require("@toon-format/toon");
|
|
6701
|
-
var
|
|
6702
|
-
var
|
|
6814
|
+
var import_node_path110 = require("path");
|
|
6815
|
+
var import_mini50 = require("zod/mini");
|
|
6703
6816
|
|
|
6704
6817
|
// src/constants/general.ts
|
|
6705
6818
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
@@ -9898,39 +10011,12 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
9898
10011
|
}
|
|
9899
10012
|
};
|
|
9900
10013
|
|
|
9901
|
-
// src/features/subagents/codexcli-subagent.ts
|
|
9902
|
-
var import_node_path75 = require("path");
|
|
9903
|
-
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
9904
|
-
static getSettablePaths() {
|
|
9905
|
-
return {
|
|
9906
|
-
relativeDirPath: (0, import_node_path75.join)(".codex", "subagents")
|
|
9907
|
-
};
|
|
9908
|
-
}
|
|
9909
|
-
static async fromFile(params) {
|
|
9910
|
-
const baseParams = await this.fromFileDefault(params);
|
|
9911
|
-
return new _CodexCliSubagent(baseParams);
|
|
9912
|
-
}
|
|
9913
|
-
static fromRulesyncSubagent(params) {
|
|
9914
|
-
const baseParams = this.fromRulesyncSubagentDefault(params);
|
|
9915
|
-
return new _CodexCliSubagent(baseParams);
|
|
9916
|
-
}
|
|
9917
|
-
static isTargetedByRulesyncSubagent(rulesyncSubagent) {
|
|
9918
|
-
return this.isTargetedByRulesyncSubagentDefault({
|
|
9919
|
-
rulesyncSubagent,
|
|
9920
|
-
toolTarget: "codexcli"
|
|
9921
|
-
});
|
|
9922
|
-
}
|
|
9923
|
-
static forDeletion(params) {
|
|
9924
|
-
return new _CodexCliSubagent(this.forDeletionDefault(params));
|
|
9925
|
-
}
|
|
9926
|
-
};
|
|
9927
|
-
|
|
9928
10014
|
// src/features/subagents/factorydroid-subagent.ts
|
|
9929
|
-
var
|
|
10015
|
+
var import_node_path75 = require("path");
|
|
9930
10016
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
9931
10017
|
static getSettablePaths(_options) {
|
|
9932
10018
|
return {
|
|
9933
|
-
relativeDirPath: (0,
|
|
10019
|
+
relativeDirPath: (0, import_node_path75.join)(".factory", "droids")
|
|
9934
10020
|
};
|
|
9935
10021
|
}
|
|
9936
10022
|
static async fromFile(params) {
|
|
@@ -9953,11 +10039,11 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
9953
10039
|
};
|
|
9954
10040
|
|
|
9955
10041
|
// src/features/subagents/geminicli-subagent.ts
|
|
9956
|
-
var
|
|
10042
|
+
var import_node_path76 = require("path");
|
|
9957
10043
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
9958
10044
|
static getSettablePaths() {
|
|
9959
10045
|
return {
|
|
9960
|
-
relativeDirPath: (0,
|
|
10046
|
+
relativeDirPath: (0, import_node_path76.join)(".gemini", "subagents")
|
|
9961
10047
|
};
|
|
9962
10048
|
}
|
|
9963
10049
|
static async fromFile(params) {
|
|
@@ -9980,11 +10066,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
9980
10066
|
};
|
|
9981
10067
|
|
|
9982
10068
|
// src/features/subagents/roo-subagent.ts
|
|
9983
|
-
var
|
|
10069
|
+
var import_node_path77 = require("path");
|
|
9984
10070
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
9985
10071
|
static getSettablePaths() {
|
|
9986
10072
|
return {
|
|
9987
|
-
relativeDirPath: (0,
|
|
10073
|
+
relativeDirPath: (0, import_node_path77.join)(".roo", "subagents")
|
|
9988
10074
|
};
|
|
9989
10075
|
}
|
|
9990
10076
|
static async fromFile(params) {
|
|
@@ -10008,14 +10094,14 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
10008
10094
|
|
|
10009
10095
|
// src/features/subagents/subagents-processor.ts
|
|
10010
10096
|
var import_node_path85 = require("path");
|
|
10011
|
-
var
|
|
10097
|
+
var import_mini43 = require("zod/mini");
|
|
10012
10098
|
|
|
10013
10099
|
// src/features/subagents/claudecode-subagent.ts
|
|
10014
|
-
var
|
|
10100
|
+
var import_node_path79 = require("path");
|
|
10015
10101
|
var import_mini37 = require("zod/mini");
|
|
10016
10102
|
|
|
10017
10103
|
// src/features/subagents/rulesync-subagent.ts
|
|
10018
|
-
var
|
|
10104
|
+
var import_node_path78 = require("path");
|
|
10019
10105
|
var import_mini36 = require("zod/mini");
|
|
10020
10106
|
var RulesyncSubagentFrontmatterSchema = import_mini36.z.looseObject({
|
|
10021
10107
|
targets: import_mini36.z._default(RulesyncTargetsSchema, ["*"]),
|
|
@@ -10029,7 +10115,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10029
10115
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10030
10116
|
if (!parseResult.success && rest.validate !== false) {
|
|
10031
10117
|
throw new Error(
|
|
10032
|
-
`Invalid frontmatter in ${(0,
|
|
10118
|
+
`Invalid frontmatter in ${(0, import_node_path78.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
10033
10119
|
);
|
|
10034
10120
|
}
|
|
10035
10121
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -10062,7 +10148,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10062
10148
|
return {
|
|
10063
10149
|
success: false,
|
|
10064
10150
|
error: new Error(
|
|
10065
|
-
`Invalid frontmatter in ${(0,
|
|
10151
|
+
`Invalid frontmatter in ${(0, import_node_path78.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10066
10152
|
)
|
|
10067
10153
|
};
|
|
10068
10154
|
}
|
|
@@ -10071,14 +10157,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10071
10157
|
relativeFilePath
|
|
10072
10158
|
}) {
|
|
10073
10159
|
const fileContent = await readFileContent(
|
|
10074
|
-
(0,
|
|
10160
|
+
(0, import_node_path78.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
10075
10161
|
);
|
|
10076
10162
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10077
10163
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10078
10164
|
if (!result.success) {
|
|
10079
10165
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
10080
10166
|
}
|
|
10081
|
-
const filename = (0,
|
|
10167
|
+
const filename = (0, import_node_path78.basename)(relativeFilePath);
|
|
10082
10168
|
return new _RulesyncSubagent({
|
|
10083
10169
|
baseDir: process.cwd(),
|
|
10084
10170
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -10106,7 +10192,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10106
10192
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10107
10193
|
if (!result.success) {
|
|
10108
10194
|
throw new Error(
|
|
10109
|
-
`Invalid frontmatter in ${(0,
|
|
10195
|
+
`Invalid frontmatter in ${(0, import_node_path79.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10110
10196
|
);
|
|
10111
10197
|
}
|
|
10112
10198
|
}
|
|
@@ -10118,7 +10204,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10118
10204
|
}
|
|
10119
10205
|
static getSettablePaths(_options = {}) {
|
|
10120
10206
|
return {
|
|
10121
|
-
relativeDirPath: (0,
|
|
10207
|
+
relativeDirPath: (0, import_node_path79.join)(".claude", "agents")
|
|
10122
10208
|
};
|
|
10123
10209
|
}
|
|
10124
10210
|
getFrontmatter() {
|
|
@@ -10194,7 +10280,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10194
10280
|
return {
|
|
10195
10281
|
success: false,
|
|
10196
10282
|
error: new Error(
|
|
10197
|
-
`Invalid frontmatter in ${(0,
|
|
10283
|
+
`Invalid frontmatter in ${(0, import_node_path79.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10198
10284
|
)
|
|
10199
10285
|
};
|
|
10200
10286
|
}
|
|
@@ -10212,7 +10298,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10212
10298
|
global = false
|
|
10213
10299
|
}) {
|
|
10214
10300
|
const paths = this.getSettablePaths({ global });
|
|
10215
|
-
const filePath = (0,
|
|
10301
|
+
const filePath = (0, import_node_path79.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10216
10302
|
const fileContent = await readFileContent(filePath);
|
|
10217
10303
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10218
10304
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -10246,14 +10332,158 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10246
10332
|
}
|
|
10247
10333
|
};
|
|
10248
10334
|
|
|
10335
|
+
// src/features/subagents/codexcli-subagent.ts
|
|
10336
|
+
var import_node_path80 = require("path");
|
|
10337
|
+
var smolToml2 = __toESM(require("smol-toml"), 1);
|
|
10338
|
+
var import_mini38 = require("zod/mini");
|
|
10339
|
+
var CodexCliSubagentTomlSchema = import_mini38.z.looseObject({
|
|
10340
|
+
name: import_mini38.z.string(),
|
|
10341
|
+
description: import_mini38.z.optional(import_mini38.z.string()),
|
|
10342
|
+
developer_instructions: import_mini38.z.optional(import_mini38.z.string()),
|
|
10343
|
+
model: import_mini38.z.optional(import_mini38.z.string()),
|
|
10344
|
+
model_reasoning_effort: import_mini38.z.optional(import_mini38.z.string()),
|
|
10345
|
+
sandbox_mode: import_mini38.z.optional(import_mini38.z.string())
|
|
10346
|
+
});
|
|
10347
|
+
var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
10348
|
+
body;
|
|
10349
|
+
constructor({ body, ...rest }) {
|
|
10350
|
+
super({
|
|
10351
|
+
...rest
|
|
10352
|
+
});
|
|
10353
|
+
this.body = body;
|
|
10354
|
+
}
|
|
10355
|
+
static getSettablePaths(_options = {}) {
|
|
10356
|
+
return {
|
|
10357
|
+
relativeDirPath: (0, import_node_path80.join)(".codex", "agents")
|
|
10358
|
+
};
|
|
10359
|
+
}
|
|
10360
|
+
getBody() {
|
|
10361
|
+
return this.body;
|
|
10362
|
+
}
|
|
10363
|
+
toRulesyncSubagent() {
|
|
10364
|
+
let parsed;
|
|
10365
|
+
try {
|
|
10366
|
+
parsed = CodexCliSubagentTomlSchema.parse(smolToml2.parse(this.body));
|
|
10367
|
+
} catch (error) {
|
|
10368
|
+
throw new Error(
|
|
10369
|
+
`Failed to parse TOML in ${(0, import_node_path80.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
10370
|
+
{ cause: error }
|
|
10371
|
+
);
|
|
10372
|
+
}
|
|
10373
|
+
const { name, description, developer_instructions, ...restFields } = parsed;
|
|
10374
|
+
const codexcliSection = {
|
|
10375
|
+
...restFields
|
|
10376
|
+
};
|
|
10377
|
+
const rulesyncFrontmatter = {
|
|
10378
|
+
targets: ["codexcli"],
|
|
10379
|
+
name,
|
|
10380
|
+
description: description ?? "",
|
|
10381
|
+
// Only include codexcli section if there are fields
|
|
10382
|
+
...Object.keys(codexcliSection).length > 0 && { codexcli: codexcliSection }
|
|
10383
|
+
};
|
|
10384
|
+
return new RulesyncSubagent({
|
|
10385
|
+
baseDir: ".",
|
|
10386
|
+
frontmatter: rulesyncFrontmatter,
|
|
10387
|
+
body: developer_instructions ?? "",
|
|
10388
|
+
relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
|
|
10389
|
+
relativeFilePath: this.getRelativeFilePath().replace(/\.toml$/, ".md"),
|
|
10390
|
+
validate: true
|
|
10391
|
+
});
|
|
10392
|
+
}
|
|
10393
|
+
static fromRulesyncSubagent({
|
|
10394
|
+
baseDir = process.cwd(),
|
|
10395
|
+
rulesyncSubagent,
|
|
10396
|
+
validate = true,
|
|
10397
|
+
global = false
|
|
10398
|
+
}) {
|
|
10399
|
+
const frontmatter = rulesyncSubagent.getFrontmatter();
|
|
10400
|
+
const rawSection = frontmatter.codexcli ?? {};
|
|
10401
|
+
const {
|
|
10402
|
+
name: _n,
|
|
10403
|
+
description: _d,
|
|
10404
|
+
developer_instructions: _di,
|
|
10405
|
+
...codexcliSection
|
|
10406
|
+
} = rawSection;
|
|
10407
|
+
const tomlObj = {
|
|
10408
|
+
name: frontmatter.name,
|
|
10409
|
+
...frontmatter.description ? { description: frontmatter.description } : {},
|
|
10410
|
+
...rulesyncSubagent.getBody() ? { developer_instructions: rulesyncSubagent.getBody() } : {},
|
|
10411
|
+
...codexcliSection
|
|
10412
|
+
};
|
|
10413
|
+
const body = smolToml2.stringify(tomlObj);
|
|
10414
|
+
const paths = this.getSettablePaths({ global });
|
|
10415
|
+
const relativeFilePath = rulesyncSubagent.getRelativeFilePath().replace(/\.md$/, ".toml");
|
|
10416
|
+
return new _CodexCliSubagent({
|
|
10417
|
+
baseDir,
|
|
10418
|
+
body,
|
|
10419
|
+
relativeDirPath: paths.relativeDirPath,
|
|
10420
|
+
relativeFilePath,
|
|
10421
|
+
fileContent: body,
|
|
10422
|
+
validate,
|
|
10423
|
+
global
|
|
10424
|
+
});
|
|
10425
|
+
}
|
|
10426
|
+
validate() {
|
|
10427
|
+
try {
|
|
10428
|
+
const parsed = smolToml2.parse(this.body);
|
|
10429
|
+
CodexCliSubagentTomlSchema.parse(parsed);
|
|
10430
|
+
return { success: true, error: null };
|
|
10431
|
+
} catch (error) {
|
|
10432
|
+
return {
|
|
10433
|
+
success: false,
|
|
10434
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
10435
|
+
};
|
|
10436
|
+
}
|
|
10437
|
+
}
|
|
10438
|
+
static isTargetedByRulesyncSubagent(rulesyncSubagent) {
|
|
10439
|
+
return this.isTargetedByRulesyncSubagentDefault({
|
|
10440
|
+
rulesyncSubagent,
|
|
10441
|
+
toolTarget: "codexcli"
|
|
10442
|
+
});
|
|
10443
|
+
}
|
|
10444
|
+
static async fromFile({
|
|
10445
|
+
baseDir = process.cwd(),
|
|
10446
|
+
relativeFilePath,
|
|
10447
|
+
validate = true,
|
|
10448
|
+
global = false
|
|
10449
|
+
}) {
|
|
10450
|
+
const paths = this.getSettablePaths({ global });
|
|
10451
|
+
const filePath = (0, import_node_path80.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10452
|
+
const fileContent = await readFileContent(filePath);
|
|
10453
|
+
return new _CodexCliSubagent({
|
|
10454
|
+
baseDir,
|
|
10455
|
+
relativeDirPath: paths.relativeDirPath,
|
|
10456
|
+
relativeFilePath,
|
|
10457
|
+
body: fileContent.trim(),
|
|
10458
|
+
fileContent,
|
|
10459
|
+
validate,
|
|
10460
|
+
global
|
|
10461
|
+
});
|
|
10462
|
+
}
|
|
10463
|
+
static forDeletion({
|
|
10464
|
+
baseDir = process.cwd(),
|
|
10465
|
+
relativeDirPath,
|
|
10466
|
+
relativeFilePath
|
|
10467
|
+
}) {
|
|
10468
|
+
return new _CodexCliSubagent({
|
|
10469
|
+
baseDir,
|
|
10470
|
+
relativeDirPath,
|
|
10471
|
+
relativeFilePath,
|
|
10472
|
+
body: "",
|
|
10473
|
+
fileContent: "",
|
|
10474
|
+
validate: false
|
|
10475
|
+
});
|
|
10476
|
+
}
|
|
10477
|
+
};
|
|
10478
|
+
|
|
10249
10479
|
// src/features/subagents/copilot-subagent.ts
|
|
10250
10480
|
var import_node_path81 = require("path");
|
|
10251
|
-
var
|
|
10481
|
+
var import_mini39 = require("zod/mini");
|
|
10252
10482
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
10253
|
-
var CopilotSubagentFrontmatterSchema =
|
|
10254
|
-
name:
|
|
10255
|
-
description:
|
|
10256
|
-
tools:
|
|
10483
|
+
var CopilotSubagentFrontmatterSchema = import_mini39.z.looseObject({
|
|
10484
|
+
name: import_mini39.z.string(),
|
|
10485
|
+
description: import_mini39.z.string(),
|
|
10486
|
+
tools: import_mini39.z.optional(import_mini39.z.union([import_mini39.z.string(), import_mini39.z.array(import_mini39.z.string())]))
|
|
10257
10487
|
});
|
|
10258
10488
|
var normalizeTools = (tools) => {
|
|
10259
10489
|
if (!tools) {
|
|
@@ -10414,10 +10644,10 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
10414
10644
|
|
|
10415
10645
|
// src/features/subagents/cursor-subagent.ts
|
|
10416
10646
|
var import_node_path82 = require("path");
|
|
10417
|
-
var
|
|
10418
|
-
var CursorSubagentFrontmatterSchema =
|
|
10419
|
-
name:
|
|
10420
|
-
description:
|
|
10647
|
+
var import_mini40 = require("zod/mini");
|
|
10648
|
+
var CursorSubagentFrontmatterSchema = import_mini40.z.looseObject({
|
|
10649
|
+
name: import_mini40.z.string(),
|
|
10650
|
+
description: import_mini40.z.string()
|
|
10421
10651
|
});
|
|
10422
10652
|
var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
10423
10653
|
frontmatter;
|
|
@@ -10561,22 +10791,22 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
10561
10791
|
|
|
10562
10792
|
// src/features/subagents/kiro-subagent.ts
|
|
10563
10793
|
var import_node_path83 = require("path");
|
|
10564
|
-
var
|
|
10565
|
-
var KiroCliSubagentJsonSchema =
|
|
10566
|
-
name:
|
|
10567
|
-
description:
|
|
10568
|
-
prompt:
|
|
10569
|
-
tools:
|
|
10570
|
-
toolAliases:
|
|
10571
|
-
toolSettings:
|
|
10572
|
-
toolSchema:
|
|
10573
|
-
hooks:
|
|
10574
|
-
model:
|
|
10575
|
-
mcpServers:
|
|
10576
|
-
useLegacyMcpJson:
|
|
10577
|
-
resources:
|
|
10578
|
-
allowedTools:
|
|
10579
|
-
includeMcpJson:
|
|
10794
|
+
var import_mini41 = require("zod/mini");
|
|
10795
|
+
var KiroCliSubagentJsonSchema = import_mini41.z.looseObject({
|
|
10796
|
+
name: import_mini41.z.string(),
|
|
10797
|
+
description: import_mini41.z.optional(import_mini41.z.nullable(import_mini41.z.string())),
|
|
10798
|
+
prompt: import_mini41.z.optional(import_mini41.z.nullable(import_mini41.z.string())),
|
|
10799
|
+
tools: import_mini41.z.optional(import_mini41.z.nullable(import_mini41.z.array(import_mini41.z.string()))),
|
|
10800
|
+
toolAliases: import_mini41.z.optional(import_mini41.z.nullable(import_mini41.z.record(import_mini41.z.string(), import_mini41.z.string()))),
|
|
10801
|
+
toolSettings: import_mini41.z.optional(import_mini41.z.nullable(import_mini41.z.unknown())),
|
|
10802
|
+
toolSchema: import_mini41.z.optional(import_mini41.z.nullable(import_mini41.z.unknown())),
|
|
10803
|
+
hooks: import_mini41.z.optional(import_mini41.z.nullable(import_mini41.z.record(import_mini41.z.string(), import_mini41.z.array(import_mini41.z.unknown())))),
|
|
10804
|
+
model: import_mini41.z.optional(import_mini41.z.nullable(import_mini41.z.string())),
|
|
10805
|
+
mcpServers: import_mini41.z.optional(import_mini41.z.nullable(import_mini41.z.record(import_mini41.z.string(), import_mini41.z.unknown()))),
|
|
10806
|
+
useLegacyMcpJson: import_mini41.z.optional(import_mini41.z.nullable(import_mini41.z.boolean())),
|
|
10807
|
+
resources: import_mini41.z.optional(import_mini41.z.nullable(import_mini41.z.array(import_mini41.z.string()))),
|
|
10808
|
+
allowedTools: import_mini41.z.optional(import_mini41.z.nullable(import_mini41.z.array(import_mini41.z.string()))),
|
|
10809
|
+
includeMcpJson: import_mini41.z.optional(import_mini41.z.nullable(import_mini41.z.boolean()))
|
|
10580
10810
|
});
|
|
10581
10811
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
10582
10812
|
body;
|
|
@@ -10698,11 +10928,11 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
10698
10928
|
|
|
10699
10929
|
// src/features/subagents/opencode-subagent.ts
|
|
10700
10930
|
var import_node_path84 = require("path");
|
|
10701
|
-
var
|
|
10702
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
10703
|
-
description:
|
|
10704
|
-
mode:
|
|
10705
|
-
name:
|
|
10931
|
+
var import_mini42 = require("zod/mini");
|
|
10932
|
+
var OpenCodeSubagentFrontmatterSchema = import_mini42.z.looseObject({
|
|
10933
|
+
description: import_mini42.z.string(),
|
|
10934
|
+
mode: import_mini42.z._default(import_mini42.z.string(), "subagent"),
|
|
10935
|
+
name: import_mini42.z.optional(import_mini42.z.string())
|
|
10706
10936
|
});
|
|
10707
10937
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
10708
10938
|
frontmatter;
|
|
@@ -10858,7 +11088,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
10858
11088
|
"opencode",
|
|
10859
11089
|
"roo"
|
|
10860
11090
|
];
|
|
10861
|
-
var SubagentsProcessorToolTargetSchema =
|
|
11091
|
+
var SubagentsProcessorToolTargetSchema = import_mini43.z.enum(subagentsProcessorToolTargetTuple);
|
|
10862
11092
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
10863
11093
|
[
|
|
10864
11094
|
"agentsmd",
|
|
@@ -10885,7 +11115,7 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
|
10885
11115
|
"codexcli",
|
|
10886
11116
|
{
|
|
10887
11117
|
class: CodexCliSubagent,
|
|
10888
|
-
meta: { supportsSimulated:
|
|
11118
|
+
meta: { supportsSimulated: false, supportsGlobal: false, filePattern: "*.toml" }
|
|
10889
11119
|
}
|
|
10890
11120
|
],
|
|
10891
11121
|
[
|
|
@@ -11137,42 +11367,42 @@ var import_node_path87 = require("path");
|
|
|
11137
11367
|
|
|
11138
11368
|
// src/features/rules/rulesync-rule.ts
|
|
11139
11369
|
var import_node_path86 = require("path");
|
|
11140
|
-
var
|
|
11141
|
-
var RulesyncRuleFrontmatterSchema =
|
|
11142
|
-
root:
|
|
11143
|
-
localRoot:
|
|
11144
|
-
targets:
|
|
11145
|
-
description:
|
|
11146
|
-
globs:
|
|
11147
|
-
agentsmd:
|
|
11148
|
-
|
|
11370
|
+
var import_mini44 = require("zod/mini");
|
|
11371
|
+
var RulesyncRuleFrontmatterSchema = import_mini44.z.object({
|
|
11372
|
+
root: import_mini44.z.optional(import_mini44.z.boolean()),
|
|
11373
|
+
localRoot: import_mini44.z.optional(import_mini44.z.boolean()),
|
|
11374
|
+
targets: import_mini44.z._default(RulesyncTargetsSchema, ["*"]),
|
|
11375
|
+
description: import_mini44.z.optional(import_mini44.z.string()),
|
|
11376
|
+
globs: import_mini44.z.optional(import_mini44.z.array(import_mini44.z.string())),
|
|
11377
|
+
agentsmd: import_mini44.z.optional(
|
|
11378
|
+
import_mini44.z.object({
|
|
11149
11379
|
// @example "path/to/subproject"
|
|
11150
|
-
subprojectPath:
|
|
11380
|
+
subprojectPath: import_mini44.z.optional(import_mini44.z.string())
|
|
11151
11381
|
})
|
|
11152
11382
|
),
|
|
11153
|
-
claudecode:
|
|
11154
|
-
|
|
11383
|
+
claudecode: import_mini44.z.optional(
|
|
11384
|
+
import_mini44.z.object({
|
|
11155
11385
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
11156
11386
|
// @example ["src/**/*.ts", "tests/**/*.test.ts"]
|
|
11157
|
-
paths:
|
|
11387
|
+
paths: import_mini44.z.optional(import_mini44.z.array(import_mini44.z.string()))
|
|
11158
11388
|
})
|
|
11159
11389
|
),
|
|
11160
|
-
cursor:
|
|
11161
|
-
|
|
11162
|
-
alwaysApply:
|
|
11163
|
-
description:
|
|
11164
|
-
globs:
|
|
11390
|
+
cursor: import_mini44.z.optional(
|
|
11391
|
+
import_mini44.z.object({
|
|
11392
|
+
alwaysApply: import_mini44.z.optional(import_mini44.z.boolean()),
|
|
11393
|
+
description: import_mini44.z.optional(import_mini44.z.string()),
|
|
11394
|
+
globs: import_mini44.z.optional(import_mini44.z.array(import_mini44.z.string()))
|
|
11165
11395
|
})
|
|
11166
11396
|
),
|
|
11167
|
-
copilot:
|
|
11168
|
-
|
|
11169
|
-
excludeAgent:
|
|
11397
|
+
copilot: import_mini44.z.optional(
|
|
11398
|
+
import_mini44.z.object({
|
|
11399
|
+
excludeAgent: import_mini44.z.optional(import_mini44.z.union([import_mini44.z.literal("code-review"), import_mini44.z.literal("coding-agent")]))
|
|
11170
11400
|
})
|
|
11171
11401
|
),
|
|
11172
|
-
antigravity:
|
|
11173
|
-
|
|
11174
|
-
trigger:
|
|
11175
|
-
globs:
|
|
11402
|
+
antigravity: import_mini44.z.optional(
|
|
11403
|
+
import_mini44.z.looseObject({
|
|
11404
|
+
trigger: import_mini44.z.optional(import_mini44.z.string()),
|
|
11405
|
+
globs: import_mini44.z.optional(import_mini44.z.array(import_mini44.z.string()))
|
|
11176
11406
|
})
|
|
11177
11407
|
)
|
|
11178
11408
|
});
|
|
@@ -11475,20 +11705,20 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
11475
11705
|
|
|
11476
11706
|
// src/features/rules/antigravity-rule.ts
|
|
11477
11707
|
var import_node_path89 = require("path");
|
|
11478
|
-
var
|
|
11479
|
-
var AntigravityRuleFrontmatterSchema =
|
|
11480
|
-
trigger:
|
|
11481
|
-
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11486
|
-
|
|
11708
|
+
var import_mini45 = require("zod/mini");
|
|
11709
|
+
var AntigravityRuleFrontmatterSchema = import_mini45.z.looseObject({
|
|
11710
|
+
trigger: import_mini45.z.optional(
|
|
11711
|
+
import_mini45.z.union([
|
|
11712
|
+
import_mini45.z.literal("always_on"),
|
|
11713
|
+
import_mini45.z.literal("glob"),
|
|
11714
|
+
import_mini45.z.literal("manual"),
|
|
11715
|
+
import_mini45.z.literal("model_decision"),
|
|
11716
|
+
import_mini45.z.string()
|
|
11487
11717
|
// accepts any string for forward compatibility
|
|
11488
11718
|
])
|
|
11489
11719
|
),
|
|
11490
|
-
globs:
|
|
11491
|
-
description:
|
|
11720
|
+
globs: import_mini45.z.optional(import_mini45.z.string()),
|
|
11721
|
+
description: import_mini45.z.optional(import_mini45.z.string())
|
|
11492
11722
|
});
|
|
11493
11723
|
function parseGlobsString(globs) {
|
|
11494
11724
|
if (!globs) {
|
|
@@ -12067,9 +12297,9 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
12067
12297
|
|
|
12068
12298
|
// src/features/rules/claudecode-rule.ts
|
|
12069
12299
|
var import_node_path93 = require("path");
|
|
12070
|
-
var
|
|
12071
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
12072
|
-
paths:
|
|
12300
|
+
var import_mini46 = require("zod/mini");
|
|
12301
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini46.z.object({
|
|
12302
|
+
paths: import_mini46.z.optional(import_mini46.z.array(import_mini46.z.string()))
|
|
12073
12303
|
});
|
|
12074
12304
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
12075
12305
|
frontmatter;
|
|
@@ -12278,9 +12508,9 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12278
12508
|
|
|
12279
12509
|
// src/features/rules/cline-rule.ts
|
|
12280
12510
|
var import_node_path94 = require("path");
|
|
12281
|
-
var
|
|
12282
|
-
var ClineRuleFrontmatterSchema =
|
|
12283
|
-
description:
|
|
12511
|
+
var import_mini47 = require("zod/mini");
|
|
12512
|
+
var ClineRuleFrontmatterSchema = import_mini47.z.object({
|
|
12513
|
+
description: import_mini47.z.string()
|
|
12284
12514
|
});
|
|
12285
12515
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
12286
12516
|
static getSettablePaths(_options = {}) {
|
|
@@ -12459,11 +12689,11 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
12459
12689
|
|
|
12460
12690
|
// src/features/rules/copilot-rule.ts
|
|
12461
12691
|
var import_node_path96 = require("path");
|
|
12462
|
-
var
|
|
12463
|
-
var CopilotRuleFrontmatterSchema =
|
|
12464
|
-
description:
|
|
12465
|
-
applyTo:
|
|
12466
|
-
excludeAgent:
|
|
12692
|
+
var import_mini48 = require("zod/mini");
|
|
12693
|
+
var CopilotRuleFrontmatterSchema = import_mini48.z.object({
|
|
12694
|
+
description: import_mini48.z.optional(import_mini48.z.string()),
|
|
12695
|
+
applyTo: import_mini48.z.optional(import_mini48.z.string()),
|
|
12696
|
+
excludeAgent: import_mini48.z.optional(import_mini48.z.union([import_mini48.z.literal("code-review"), import_mini48.z.literal("coding-agent")]))
|
|
12467
12697
|
});
|
|
12468
12698
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
12469
12699
|
frontmatter;
|
|
@@ -12666,11 +12896,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
12666
12896
|
|
|
12667
12897
|
// src/features/rules/cursor-rule.ts
|
|
12668
12898
|
var import_node_path97 = require("path");
|
|
12669
|
-
var
|
|
12670
|
-
var CursorRuleFrontmatterSchema =
|
|
12671
|
-
description:
|
|
12672
|
-
globs:
|
|
12673
|
-
alwaysApply:
|
|
12899
|
+
var import_mini49 = require("zod/mini");
|
|
12900
|
+
var CursorRuleFrontmatterSchema = import_mini49.z.object({
|
|
12901
|
+
description: import_mini49.z.optional(import_mini49.z.string()),
|
|
12902
|
+
globs: import_mini49.z.optional(import_mini49.z.string()),
|
|
12903
|
+
alwaysApply: import_mini49.z.optional(import_mini49.z.boolean())
|
|
12674
12904
|
});
|
|
12675
12905
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
12676
12906
|
frontmatter;
|
|
@@ -13089,8 +13319,117 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
13089
13319
|
}
|
|
13090
13320
|
};
|
|
13091
13321
|
|
|
13092
|
-
// src/features/rules/
|
|
13322
|
+
// src/features/rules/goose-rule.ts
|
|
13093
13323
|
var import_node_path100 = require("path");
|
|
13324
|
+
var GooseRule = class _GooseRule extends ToolRule {
|
|
13325
|
+
static getSettablePaths({
|
|
13326
|
+
global,
|
|
13327
|
+
excludeToolDir
|
|
13328
|
+
} = {}) {
|
|
13329
|
+
if (global) {
|
|
13330
|
+
return {
|
|
13331
|
+
root: {
|
|
13332
|
+
relativeDirPath: ".",
|
|
13333
|
+
relativeFilePath: ".goosehints"
|
|
13334
|
+
}
|
|
13335
|
+
};
|
|
13336
|
+
}
|
|
13337
|
+
return {
|
|
13338
|
+
root: {
|
|
13339
|
+
relativeDirPath: ".",
|
|
13340
|
+
relativeFilePath: ".goosehints"
|
|
13341
|
+
},
|
|
13342
|
+
nonRoot: {
|
|
13343
|
+
relativeDirPath: buildToolPath(".goose", "memories", excludeToolDir)
|
|
13344
|
+
}
|
|
13345
|
+
};
|
|
13346
|
+
}
|
|
13347
|
+
static async fromFile({
|
|
13348
|
+
baseDir = process.cwd(),
|
|
13349
|
+
relativeFilePath,
|
|
13350
|
+
validate = true,
|
|
13351
|
+
global = false
|
|
13352
|
+
}) {
|
|
13353
|
+
const paths = this.getSettablePaths({ global });
|
|
13354
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
13355
|
+
if (isRoot) {
|
|
13356
|
+
const relativePath2 = paths.root.relativeFilePath;
|
|
13357
|
+
const fileContent2 = await readFileContent(
|
|
13358
|
+
(0, import_node_path100.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
13359
|
+
);
|
|
13360
|
+
return new _GooseRule({
|
|
13361
|
+
baseDir,
|
|
13362
|
+
relativeDirPath: paths.root.relativeDirPath,
|
|
13363
|
+
relativeFilePath: paths.root.relativeFilePath,
|
|
13364
|
+
fileContent: fileContent2,
|
|
13365
|
+
validate,
|
|
13366
|
+
root: true
|
|
13367
|
+
});
|
|
13368
|
+
}
|
|
13369
|
+
if (!paths.nonRoot) {
|
|
13370
|
+
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13371
|
+
}
|
|
13372
|
+
const relativePath = (0, import_node_path100.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13373
|
+
const fileContent = await readFileContent((0, import_node_path100.join)(baseDir, relativePath));
|
|
13374
|
+
return new _GooseRule({
|
|
13375
|
+
baseDir,
|
|
13376
|
+
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
13377
|
+
relativeFilePath,
|
|
13378
|
+
fileContent,
|
|
13379
|
+
validate,
|
|
13380
|
+
root: false
|
|
13381
|
+
});
|
|
13382
|
+
}
|
|
13383
|
+
static fromRulesyncRule({
|
|
13384
|
+
baseDir = process.cwd(),
|
|
13385
|
+
rulesyncRule,
|
|
13386
|
+
validate = true,
|
|
13387
|
+
global = false
|
|
13388
|
+
}) {
|
|
13389
|
+
const paths = this.getSettablePaths({ global });
|
|
13390
|
+
return new _GooseRule(
|
|
13391
|
+
this.buildToolRuleParamsDefault({
|
|
13392
|
+
baseDir,
|
|
13393
|
+
rulesyncRule,
|
|
13394
|
+
validate,
|
|
13395
|
+
rootPath: paths.root,
|
|
13396
|
+
nonRootPath: paths.nonRoot
|
|
13397
|
+
})
|
|
13398
|
+
);
|
|
13399
|
+
}
|
|
13400
|
+
toRulesyncRule() {
|
|
13401
|
+
return this.toRulesyncRuleDefault();
|
|
13402
|
+
}
|
|
13403
|
+
validate() {
|
|
13404
|
+
return { success: true, error: null };
|
|
13405
|
+
}
|
|
13406
|
+
static forDeletion({
|
|
13407
|
+
baseDir = process.cwd(),
|
|
13408
|
+
relativeDirPath,
|
|
13409
|
+
relativeFilePath,
|
|
13410
|
+
global = false
|
|
13411
|
+
}) {
|
|
13412
|
+
const paths = this.getSettablePaths({ global });
|
|
13413
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
13414
|
+
return new _GooseRule({
|
|
13415
|
+
baseDir,
|
|
13416
|
+
relativeDirPath,
|
|
13417
|
+
relativeFilePath,
|
|
13418
|
+
fileContent: "",
|
|
13419
|
+
validate: false,
|
|
13420
|
+
root: isRoot
|
|
13421
|
+
});
|
|
13422
|
+
}
|
|
13423
|
+
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
13424
|
+
return this.isTargetedByRulesyncRuleDefault({
|
|
13425
|
+
rulesyncRule,
|
|
13426
|
+
toolTarget: "goose"
|
|
13427
|
+
});
|
|
13428
|
+
}
|
|
13429
|
+
};
|
|
13430
|
+
|
|
13431
|
+
// src/features/rules/junie-rule.ts
|
|
13432
|
+
var import_node_path101 = require("path");
|
|
13094
13433
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
13095
13434
|
static getSettablePaths(_options = {}) {
|
|
13096
13435
|
return {
|
|
@@ -13109,8 +13448,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
13109
13448
|
validate = true
|
|
13110
13449
|
}) {
|
|
13111
13450
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
13112
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
13113
|
-
const fileContent = await readFileContent((0,
|
|
13451
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path101.join)(".junie", "memories", relativeFilePath);
|
|
13452
|
+
const fileContent = await readFileContent((0, import_node_path101.join)(baseDir, relativePath));
|
|
13114
13453
|
return new _JunieRule({
|
|
13115
13454
|
baseDir,
|
|
13116
13455
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -13165,7 +13504,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
13165
13504
|
};
|
|
13166
13505
|
|
|
13167
13506
|
// src/features/rules/kilo-rule.ts
|
|
13168
|
-
var
|
|
13507
|
+
var import_node_path102 = require("path");
|
|
13169
13508
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
13170
13509
|
static getSettablePaths(_options = {}) {
|
|
13171
13510
|
return {
|
|
@@ -13180,7 +13519,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
13180
13519
|
validate = true
|
|
13181
13520
|
}) {
|
|
13182
13521
|
const fileContent = await readFileContent(
|
|
13183
|
-
(0,
|
|
13522
|
+
(0, import_node_path102.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
13184
13523
|
);
|
|
13185
13524
|
return new _KiloRule({
|
|
13186
13525
|
baseDir,
|
|
@@ -13232,7 +13571,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
13232
13571
|
};
|
|
13233
13572
|
|
|
13234
13573
|
// src/features/rules/kiro-rule.ts
|
|
13235
|
-
var
|
|
13574
|
+
var import_node_path103 = require("path");
|
|
13236
13575
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
13237
13576
|
static getSettablePaths(_options = {}) {
|
|
13238
13577
|
return {
|
|
@@ -13247,7 +13586,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
13247
13586
|
validate = true
|
|
13248
13587
|
}) {
|
|
13249
13588
|
const fileContent = await readFileContent(
|
|
13250
|
-
(0,
|
|
13589
|
+
(0, import_node_path103.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
13251
13590
|
);
|
|
13252
13591
|
return new _KiroRule({
|
|
13253
13592
|
baseDir,
|
|
@@ -13301,7 +13640,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
13301
13640
|
};
|
|
13302
13641
|
|
|
13303
13642
|
// src/features/rules/opencode-rule.ts
|
|
13304
|
-
var
|
|
13643
|
+
var import_node_path104 = require("path");
|
|
13305
13644
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
13306
13645
|
static getSettablePaths({
|
|
13307
13646
|
global,
|
|
@@ -13336,7 +13675,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
13336
13675
|
if (isRoot) {
|
|
13337
13676
|
const relativePath2 = paths.root.relativeFilePath;
|
|
13338
13677
|
const fileContent2 = await readFileContent(
|
|
13339
|
-
(0,
|
|
13678
|
+
(0, import_node_path104.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
13340
13679
|
);
|
|
13341
13680
|
return new _OpenCodeRule({
|
|
13342
13681
|
baseDir,
|
|
@@ -13350,8 +13689,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
13350
13689
|
if (!paths.nonRoot) {
|
|
13351
13690
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13352
13691
|
}
|
|
13353
|
-
const relativePath = (0,
|
|
13354
|
-
const fileContent = await readFileContent((0,
|
|
13692
|
+
const relativePath = (0, import_node_path104.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13693
|
+
const fileContent = await readFileContent((0, import_node_path104.join)(baseDir, relativePath));
|
|
13355
13694
|
return new _OpenCodeRule({
|
|
13356
13695
|
baseDir,
|
|
13357
13696
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13410,7 +13749,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
13410
13749
|
};
|
|
13411
13750
|
|
|
13412
13751
|
// src/features/rules/qwencode-rule.ts
|
|
13413
|
-
var
|
|
13752
|
+
var import_node_path105 = require("path");
|
|
13414
13753
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
13415
13754
|
static getSettablePaths(_options = {}) {
|
|
13416
13755
|
return {
|
|
@@ -13429,8 +13768,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
13429
13768
|
validate = true
|
|
13430
13769
|
}) {
|
|
13431
13770
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
13432
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
13433
|
-
const fileContent = await readFileContent((0,
|
|
13771
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path105.join)(".qwen", "memories", relativeFilePath);
|
|
13772
|
+
const fileContent = await readFileContent((0, import_node_path105.join)(baseDir, relativePath));
|
|
13434
13773
|
return new _QwencodeRule({
|
|
13435
13774
|
baseDir,
|
|
13436
13775
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -13482,7 +13821,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
13482
13821
|
};
|
|
13483
13822
|
|
|
13484
13823
|
// src/features/rules/replit-rule.ts
|
|
13485
|
-
var
|
|
13824
|
+
var import_node_path106 = require("path");
|
|
13486
13825
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
13487
13826
|
static getSettablePaths(_options = {}) {
|
|
13488
13827
|
return {
|
|
@@ -13504,7 +13843,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
13504
13843
|
}
|
|
13505
13844
|
const relativePath = paths.root.relativeFilePath;
|
|
13506
13845
|
const fileContent = await readFileContent(
|
|
13507
|
-
(0,
|
|
13846
|
+
(0, import_node_path106.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
13508
13847
|
);
|
|
13509
13848
|
return new _ReplitRule({
|
|
13510
13849
|
baseDir,
|
|
@@ -13570,7 +13909,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
13570
13909
|
};
|
|
13571
13910
|
|
|
13572
13911
|
// src/features/rules/roo-rule.ts
|
|
13573
|
-
var
|
|
13912
|
+
var import_node_path107 = require("path");
|
|
13574
13913
|
var RooRule = class _RooRule extends ToolRule {
|
|
13575
13914
|
static getSettablePaths(_options = {}) {
|
|
13576
13915
|
return {
|
|
@@ -13585,7 +13924,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
13585
13924
|
validate = true
|
|
13586
13925
|
}) {
|
|
13587
13926
|
const fileContent = await readFileContent(
|
|
13588
|
-
(0,
|
|
13927
|
+
(0, import_node_path107.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
13589
13928
|
);
|
|
13590
13929
|
return new _RooRule({
|
|
13591
13930
|
baseDir,
|
|
@@ -13654,7 +13993,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
13654
13993
|
};
|
|
13655
13994
|
|
|
13656
13995
|
// src/features/rules/warp-rule.ts
|
|
13657
|
-
var
|
|
13996
|
+
var import_node_path108 = require("path");
|
|
13658
13997
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
13659
13998
|
constructor({ fileContent, root, ...rest }) {
|
|
13660
13999
|
super({
|
|
@@ -13680,8 +14019,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
13680
14019
|
validate = true
|
|
13681
14020
|
}) {
|
|
13682
14021
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
13683
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
13684
|
-
const fileContent = await readFileContent((0,
|
|
14022
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path108.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
14023
|
+
const fileContent = await readFileContent((0, import_node_path108.join)(baseDir, relativePath));
|
|
13685
14024
|
return new _WarpRule({
|
|
13686
14025
|
baseDir,
|
|
13687
14026
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -13736,7 +14075,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
13736
14075
|
};
|
|
13737
14076
|
|
|
13738
14077
|
// src/features/rules/windsurf-rule.ts
|
|
13739
|
-
var
|
|
14078
|
+
var import_node_path109 = require("path");
|
|
13740
14079
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
13741
14080
|
static getSettablePaths(_options = {}) {
|
|
13742
14081
|
return {
|
|
@@ -13751,7 +14090,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
13751
14090
|
validate = true
|
|
13752
14091
|
}) {
|
|
13753
14092
|
const fileContent = await readFileContent(
|
|
13754
|
-
(0,
|
|
14093
|
+
(0, import_node_path109.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
13755
14094
|
);
|
|
13756
14095
|
return new _WindsurfRule({
|
|
13757
14096
|
baseDir,
|
|
@@ -13816,6 +14155,7 @@ var rulesProcessorToolTargets = [
|
|
|
13816
14155
|
"cursor",
|
|
13817
14156
|
"factorydroid",
|
|
13818
14157
|
"geminicli",
|
|
14158
|
+
"goose",
|
|
13819
14159
|
"junie",
|
|
13820
14160
|
"kilo",
|
|
13821
14161
|
"kiro",
|
|
@@ -13826,8 +14166,8 @@ var rulesProcessorToolTargets = [
|
|
|
13826
14166
|
"warp",
|
|
13827
14167
|
"windsurf"
|
|
13828
14168
|
];
|
|
13829
|
-
var RulesProcessorToolTargetSchema =
|
|
13830
|
-
var formatRulePaths = (rules) => rules.map((r) => (0,
|
|
14169
|
+
var RulesProcessorToolTargetSchema = import_mini50.z.enum(rulesProcessorToolTargets);
|
|
14170
|
+
var formatRulePaths = (rules) => rules.map((r) => (0, import_node_path110.join)(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
13831
14171
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
13832
14172
|
[
|
|
13833
14173
|
"agentsmd",
|
|
@@ -13918,10 +14258,7 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
13918
14258
|
meta: {
|
|
13919
14259
|
extension: "md",
|
|
13920
14260
|
supportsGlobal: true,
|
|
13921
|
-
ruleDiscoveryMode: "toon"
|
|
13922
|
-
additionalConventions: {
|
|
13923
|
-
subagents: { subagentClass: CodexCliSubagent }
|
|
13924
|
-
}
|
|
14261
|
+
ruleDiscoveryMode: "toon"
|
|
13925
14262
|
}
|
|
13926
14263
|
}
|
|
13927
14264
|
],
|
|
@@ -13977,6 +14314,17 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
13977
14314
|
}
|
|
13978
14315
|
}
|
|
13979
14316
|
],
|
|
14317
|
+
[
|
|
14318
|
+
"goose",
|
|
14319
|
+
{
|
|
14320
|
+
class: GooseRule,
|
|
14321
|
+
meta: {
|
|
14322
|
+
extension: "md",
|
|
14323
|
+
supportsGlobal: true,
|
|
14324
|
+
ruleDiscoveryMode: "toon"
|
|
14325
|
+
}
|
|
14326
|
+
}
|
|
14327
|
+
],
|
|
13980
14328
|
[
|
|
13981
14329
|
"junie",
|
|
13982
14330
|
{
|
|
@@ -14194,7 +14542,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14194
14542
|
}).relativeDirPath;
|
|
14195
14543
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
14196
14544
|
const frontmatter = skill.getFrontmatter();
|
|
14197
|
-
const relativePath = (0,
|
|
14545
|
+
const relativePath = (0, import_node_path110.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
14198
14546
|
return {
|
|
14199
14547
|
name: frontmatter.name,
|
|
14200
14548
|
description: frontmatter.description,
|
|
@@ -14307,12 +14655,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14307
14655
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
14308
14656
|
*/
|
|
14309
14657
|
async loadRulesyncFiles() {
|
|
14310
|
-
const rulesyncBaseDir = (0,
|
|
14311
|
-
const files = await findFilesByGlobs((0,
|
|
14658
|
+
const rulesyncBaseDir = (0, import_node_path110.join)(this.baseDir, RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
14659
|
+
const files = await findFilesByGlobs((0, import_node_path110.join)(rulesyncBaseDir, "**", "*.md"));
|
|
14312
14660
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
14313
14661
|
const rulesyncRules = await Promise.all(
|
|
14314
14662
|
files.map((file) => {
|
|
14315
|
-
const relativeFilePath = (0,
|
|
14663
|
+
const relativeFilePath = (0, import_node_path110.relative)(rulesyncBaseDir, file);
|
|
14316
14664
|
checkPathTraversal({
|
|
14317
14665
|
relativePath: relativeFilePath,
|
|
14318
14666
|
intendedRootDir: rulesyncBaseDir
|
|
@@ -14375,7 +14723,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14375
14723
|
return [];
|
|
14376
14724
|
}
|
|
14377
14725
|
const rootFilePaths = await findFilesByGlobs(
|
|
14378
|
-
(0,
|
|
14726
|
+
(0, import_node_path110.join)(
|
|
14379
14727
|
this.baseDir,
|
|
14380
14728
|
settablePaths.root.relativeDirPath ?? ".",
|
|
14381
14729
|
settablePaths.root.relativeFilePath
|
|
@@ -14386,7 +14734,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14386
14734
|
(filePath) => factory.class.forDeletion({
|
|
14387
14735
|
baseDir: this.baseDir,
|
|
14388
14736
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
14389
|
-
relativeFilePath: (0,
|
|
14737
|
+
relativeFilePath: (0, import_node_path110.basename)(filePath),
|
|
14390
14738
|
global: this.global
|
|
14391
14739
|
})
|
|
14392
14740
|
).filter((rule) => rule.isDeletable());
|
|
@@ -14395,7 +14743,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14395
14743
|
rootFilePaths.map(
|
|
14396
14744
|
(filePath) => factory.class.fromFile({
|
|
14397
14745
|
baseDir: this.baseDir,
|
|
14398
|
-
relativeFilePath: (0,
|
|
14746
|
+
relativeFilePath: (0, import_node_path110.basename)(filePath),
|
|
14399
14747
|
global: this.global
|
|
14400
14748
|
})
|
|
14401
14749
|
)
|
|
@@ -14413,13 +14761,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14413
14761
|
return [];
|
|
14414
14762
|
}
|
|
14415
14763
|
const localRootFilePaths = await findFilesByGlobs(
|
|
14416
|
-
(0,
|
|
14764
|
+
(0, import_node_path110.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md")
|
|
14417
14765
|
);
|
|
14418
14766
|
return localRootFilePaths.map(
|
|
14419
14767
|
(filePath) => factory.class.forDeletion({
|
|
14420
14768
|
baseDir: this.baseDir,
|
|
14421
14769
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
14422
|
-
relativeFilePath: (0,
|
|
14770
|
+
relativeFilePath: (0, import_node_path110.basename)(filePath),
|
|
14423
14771
|
global: this.global
|
|
14424
14772
|
})
|
|
14425
14773
|
).filter((rule) => rule.isDeletable());
|
|
@@ -14429,13 +14777,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14429
14777
|
if (!settablePaths.nonRoot) {
|
|
14430
14778
|
return [];
|
|
14431
14779
|
}
|
|
14432
|
-
const nonRootBaseDir = (0,
|
|
14780
|
+
const nonRootBaseDir = (0, import_node_path110.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
14433
14781
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
14434
|
-
(0,
|
|
14782
|
+
(0, import_node_path110.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
14435
14783
|
);
|
|
14436
14784
|
if (forDeletion) {
|
|
14437
14785
|
return nonRootFilePaths.map((filePath) => {
|
|
14438
|
-
const relativeFilePath = (0,
|
|
14786
|
+
const relativeFilePath = (0, import_node_path110.relative)(nonRootBaseDir, filePath);
|
|
14439
14787
|
checkPathTraversal({
|
|
14440
14788
|
relativePath: relativeFilePath,
|
|
14441
14789
|
intendedRootDir: nonRootBaseDir
|
|
@@ -14450,7 +14798,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14450
14798
|
}
|
|
14451
14799
|
return await Promise.all(
|
|
14452
14800
|
nonRootFilePaths.map((filePath) => {
|
|
14453
|
-
const relativeFilePath = (0,
|
|
14801
|
+
const relativeFilePath = (0, import_node_path110.relative)(nonRootBaseDir, filePath);
|
|
14454
14802
|
checkPathTraversal({
|
|
14455
14803
|
relativePath: relativeFilePath,
|
|
14456
14804
|
intendedRootDir: nonRootBaseDir
|
|
@@ -14563,14 +14911,14 @@ s/<command> [arguments]
|
|
|
14563
14911
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
14564
14912
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
14565
14913
|
|
|
14566
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
14914
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path110.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
14567
14915
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
14568
14916
|
|
|
14569
14917
|
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.
|
|
14570
14918
|
|
|
14571
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
14919
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path110.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
14572
14920
|
|
|
14573
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
14921
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path110.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
14574
14922
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
14575
14923
|
const result = [
|
|
14576
14924
|
overview,
|
|
@@ -14642,7 +14990,7 @@ async function processEmptyFeatureGeneration(params) {
|
|
|
14642
14990
|
return { count: totalCount, paths: [], hasDiff };
|
|
14643
14991
|
}
|
|
14644
14992
|
async function checkRulesyncDirExists(params) {
|
|
14645
|
-
return fileExists((0,
|
|
14993
|
+
return fileExists((0, import_node_path111.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
14646
14994
|
}
|
|
14647
14995
|
async function generate(params) {
|
|
14648
14996
|
const { config } = params;
|