rulesync 3.11.3 → 3.12.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 +38 -3
- package/dist/index.cjs +326 -148
- package/dist/index.js +316 -138
- package/package.json +11 -10
package/dist/index.cjs
CHANGED
|
@@ -1651,6 +1651,7 @@ var Config = class {
|
|
|
1651
1651
|
global;
|
|
1652
1652
|
simulatedCommands;
|
|
1653
1653
|
simulatedSubagents;
|
|
1654
|
+
modularMcp;
|
|
1654
1655
|
constructor({
|
|
1655
1656
|
baseDirs,
|
|
1656
1657
|
targets,
|
|
@@ -1660,6 +1661,7 @@ var Config = class {
|
|
|
1660
1661
|
global,
|
|
1661
1662
|
simulatedCommands,
|
|
1662
1663
|
simulatedSubagents,
|
|
1664
|
+
modularMcp,
|
|
1663
1665
|
experimentalGlobal,
|
|
1664
1666
|
experimentalSimulateCommands,
|
|
1665
1667
|
experimentalSimulateSubagents
|
|
@@ -1672,6 +1674,7 @@ var Config = class {
|
|
|
1672
1674
|
this.global = global ?? experimentalGlobal ?? false;
|
|
1673
1675
|
this.simulatedCommands = simulatedCommands ?? experimentalSimulateCommands ?? false;
|
|
1674
1676
|
this.simulatedSubagents = simulatedSubagents ?? experimentalSimulateSubagents ?? false;
|
|
1677
|
+
this.modularMcp = modularMcp ?? false;
|
|
1675
1678
|
}
|
|
1676
1679
|
getBaseDirs() {
|
|
1677
1680
|
return this.baseDirs;
|
|
@@ -1703,6 +1706,9 @@ var Config = class {
|
|
|
1703
1706
|
getSimulatedSubagents() {
|
|
1704
1707
|
return this.simulatedSubagents;
|
|
1705
1708
|
}
|
|
1709
|
+
getModularMcp() {
|
|
1710
|
+
return this.modularMcp;
|
|
1711
|
+
}
|
|
1706
1712
|
// Deprecated getters for backward compatibility
|
|
1707
1713
|
/** @deprecated Use getGlobal() instead */
|
|
1708
1714
|
getExperimentalGlobal() {
|
|
@@ -1729,6 +1735,7 @@ var defaults = {
|
|
|
1729
1735
|
global: false,
|
|
1730
1736
|
simulatedCommands: false,
|
|
1731
1737
|
simulatedSubagents: false,
|
|
1738
|
+
modularMcp: false,
|
|
1732
1739
|
experimentalGlobal: false,
|
|
1733
1740
|
experimentalSimulateCommands: false,
|
|
1734
1741
|
experimentalSimulateSubagents: false
|
|
@@ -1744,6 +1751,7 @@ var ConfigResolver = class {
|
|
|
1744
1751
|
global,
|
|
1745
1752
|
simulatedCommands,
|
|
1746
1753
|
simulatedSubagents,
|
|
1754
|
+
modularMcp,
|
|
1747
1755
|
experimentalGlobal,
|
|
1748
1756
|
experimentalSimulateCommands,
|
|
1749
1757
|
experimentalSimulateSubagents
|
|
@@ -1772,7 +1780,8 @@ var ConfigResolver = class {
|
|
|
1772
1780
|
}),
|
|
1773
1781
|
global: resolvedGlobal2,
|
|
1774
1782
|
simulatedCommands: resolvedSimulatedCommands2,
|
|
1775
|
-
simulatedSubagents: resolvedSimulatedSubagents2
|
|
1783
|
+
simulatedSubagents: resolvedSimulatedSubagents2,
|
|
1784
|
+
modularMcp: modularMcp ?? defaults.modularMcp
|
|
1776
1785
|
});
|
|
1777
1786
|
}
|
|
1778
1787
|
const loadOptions = {
|
|
@@ -1813,7 +1822,8 @@ var ConfigResolver = class {
|
|
|
1813
1822
|
}),
|
|
1814
1823
|
global: resolvedGlobal,
|
|
1815
1824
|
simulatedCommands: resolvedSimulatedCommands,
|
|
1816
|
-
simulatedSubagents: resolvedSimulatedSubagents
|
|
1825
|
+
simulatedSubagents: resolvedSimulatedSubagents,
|
|
1826
|
+
modularMcp: modularMcp ?? configByFile.modularMcp ?? defaults.modularMcp
|
|
1817
1827
|
};
|
|
1818
1828
|
return new Config(configParams);
|
|
1819
1829
|
}
|
|
@@ -2681,6 +2691,7 @@ var import_node_path26 = require("path");
|
|
|
2681
2691
|
|
|
2682
2692
|
// src/mcp/rulesync-mcp.ts
|
|
2683
2693
|
var import_node_path25 = require("path");
|
|
2694
|
+
var import_object = require("es-toolkit/object");
|
|
2684
2695
|
var import_mini11 = require("zod/mini");
|
|
2685
2696
|
var McpTransportTypeSchema = import_mini11.z.enum(["stdio", "sse", "http"]);
|
|
2686
2697
|
var McpServerBaseSchema = import_mini11.z.object({
|
|
@@ -2702,7 +2713,12 @@ var McpServerBaseSchema = import_mini11.z.object({
|
|
|
2702
2713
|
kiroAutoBlock: import_mini11.z.optional(import_mini11.z.array(import_mini11.z.string())),
|
|
2703
2714
|
headers: import_mini11.z.optional(import_mini11.z.record(import_mini11.z.string(), import_mini11.z.string()))
|
|
2704
2715
|
});
|
|
2716
|
+
var ModularMcpServerSchema = import_mini11.z.extend(McpServerBaseSchema, {
|
|
2717
|
+
description: import_mini11.z.string().check(import_mini11.z.minLength(1))
|
|
2718
|
+
});
|
|
2719
|
+
var ModularMcpServersSchema = import_mini11.z.record(import_mini11.z.string(), ModularMcpServerSchema);
|
|
2705
2720
|
var RulesyncMcpServersSchema = import_mini11.z.extend(McpServerBaseSchema, {
|
|
2721
|
+
description: import_mini11.z.optional(import_mini11.z.string()),
|
|
2706
2722
|
targets: import_mini11.z.optional(RulesyncTargetsSchema)
|
|
2707
2723
|
});
|
|
2708
2724
|
var RulesyncMcpConfigSchema = import_mini11.z.object({
|
|
@@ -2710,9 +2726,11 @@ var RulesyncMcpConfigSchema = import_mini11.z.object({
|
|
|
2710
2726
|
});
|
|
2711
2727
|
var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
2712
2728
|
json;
|
|
2713
|
-
|
|
2729
|
+
modularMcp;
|
|
2730
|
+
constructor({ modularMcp = false, ...rest }) {
|
|
2714
2731
|
super({ ...rest });
|
|
2715
2732
|
this.json = JSON.parse(this.fileContent);
|
|
2733
|
+
this.modularMcp = modularMcp;
|
|
2716
2734
|
if (rest.validate) {
|
|
2717
2735
|
const result = this.validate();
|
|
2718
2736
|
if (!result.success) {
|
|
@@ -2733,9 +2751,23 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
2733
2751
|
};
|
|
2734
2752
|
}
|
|
2735
2753
|
validate() {
|
|
2754
|
+
if (this.modularMcp) {
|
|
2755
|
+
const result = ModularMcpServersSchema.safeParse(this.json.mcpServers);
|
|
2756
|
+
if (!result.success) {
|
|
2757
|
+
return {
|
|
2758
|
+
success: false,
|
|
2759
|
+
error: new Error(
|
|
2760
|
+
`Invalid MCP server configuration for modular-mcp: ${result.error.message}`
|
|
2761
|
+
)
|
|
2762
|
+
};
|
|
2763
|
+
}
|
|
2764
|
+
}
|
|
2736
2765
|
return { success: true, error: null };
|
|
2737
2766
|
}
|
|
2738
|
-
static async fromFile({
|
|
2767
|
+
static async fromFile({
|
|
2768
|
+
validate = true,
|
|
2769
|
+
modularMcp = false
|
|
2770
|
+
}) {
|
|
2739
2771
|
const paths = this.getSettablePaths();
|
|
2740
2772
|
const recommendedPath = (0, import_node_path25.join)(
|
|
2741
2773
|
paths.recommended.relativeDirPath,
|
|
@@ -2749,7 +2781,8 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
2749
2781
|
relativeDirPath: paths.recommended.relativeDirPath,
|
|
2750
2782
|
relativeFilePath: paths.recommended.relativeFilePath,
|
|
2751
2783
|
fileContent: fileContent2,
|
|
2752
|
-
validate
|
|
2784
|
+
validate,
|
|
2785
|
+
modularMcp
|
|
2753
2786
|
});
|
|
2754
2787
|
}
|
|
2755
2788
|
if (await fileExists(legacyPath)) {
|
|
@@ -2762,7 +2795,8 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
2762
2795
|
relativeDirPath: paths.legacy.relativeDirPath,
|
|
2763
2796
|
relativeFilePath: paths.legacy.relativeFilePath,
|
|
2764
2797
|
fileContent: fileContent2,
|
|
2765
|
-
validate
|
|
2798
|
+
validate,
|
|
2799
|
+
modularMcp
|
|
2766
2800
|
});
|
|
2767
2801
|
}
|
|
2768
2802
|
const fileContent = await readFileContent(recommendedPath);
|
|
@@ -2771,11 +2805,30 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
2771
2805
|
relativeDirPath: paths.recommended.relativeDirPath,
|
|
2772
2806
|
relativeFilePath: paths.recommended.relativeFilePath,
|
|
2773
2807
|
fileContent,
|
|
2774
|
-
validate
|
|
2808
|
+
validate,
|
|
2809
|
+
modularMcp
|
|
2775
2810
|
});
|
|
2776
2811
|
}
|
|
2777
|
-
getJson() {
|
|
2778
|
-
|
|
2812
|
+
getJson({ modularMcp = false } = {}) {
|
|
2813
|
+
if (modularMcp) {
|
|
2814
|
+
return this.json;
|
|
2815
|
+
}
|
|
2816
|
+
if (!this.json || typeof this.json !== "object") {
|
|
2817
|
+
return this.json;
|
|
2818
|
+
}
|
|
2819
|
+
if (!this.json.mcpServers || typeof this.json.mcpServers !== "object") {
|
|
2820
|
+
return this.json;
|
|
2821
|
+
}
|
|
2822
|
+
const mcpServersWithoutDescription = Object.fromEntries(
|
|
2823
|
+
Object.entries(this.json.mcpServers).map(([serverName, serverConfig]) => [
|
|
2824
|
+
serverName,
|
|
2825
|
+
(0, import_object.omit)(serverConfig, ["description"])
|
|
2826
|
+
])
|
|
2827
|
+
);
|
|
2828
|
+
return {
|
|
2829
|
+
...this.json,
|
|
2830
|
+
mcpServers: mcpServersWithoutDescription
|
|
2831
|
+
};
|
|
2779
2832
|
}
|
|
2780
2833
|
};
|
|
2781
2834
|
|
|
@@ -2875,7 +2928,97 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
2875
2928
|
};
|
|
2876
2929
|
|
|
2877
2930
|
// src/mcp/claudecode-mcp.ts
|
|
2931
|
+
var import_node_path28 = require("path");
|
|
2932
|
+
|
|
2933
|
+
// src/mcp/modular-mcp.ts
|
|
2878
2934
|
var import_node_path27 = require("path");
|
|
2935
|
+
var ModularMcp = class _ModularMcp extends AiFile {
|
|
2936
|
+
json;
|
|
2937
|
+
constructor(params) {
|
|
2938
|
+
super(params);
|
|
2939
|
+
this.json = JSON.parse(this.fileContent || "{}");
|
|
2940
|
+
}
|
|
2941
|
+
getJson() {
|
|
2942
|
+
return this.json;
|
|
2943
|
+
}
|
|
2944
|
+
static getSettablePaths(params = {
|
|
2945
|
+
global: false,
|
|
2946
|
+
relativeDirPath: void 0
|
|
2947
|
+
}) {
|
|
2948
|
+
const relativeFilePath = "modular-mcp.json";
|
|
2949
|
+
if (!params.global) {
|
|
2950
|
+
return {
|
|
2951
|
+
relativeDirPath: ".",
|
|
2952
|
+
relativeFilePath
|
|
2953
|
+
};
|
|
2954
|
+
}
|
|
2955
|
+
return {
|
|
2956
|
+
relativeDirPath: params.relativeDirPath,
|
|
2957
|
+
relativeFilePath
|
|
2958
|
+
};
|
|
2959
|
+
}
|
|
2960
|
+
static getMcpServers({
|
|
2961
|
+
baseDir,
|
|
2962
|
+
global,
|
|
2963
|
+
relativeDirPath
|
|
2964
|
+
} = {
|
|
2965
|
+
baseDir: ".",
|
|
2966
|
+
global: false,
|
|
2967
|
+
relativeDirPath: void 0
|
|
2968
|
+
}) {
|
|
2969
|
+
const paths = this.getSettablePaths(
|
|
2970
|
+
global ? { global: true, relativeDirPath } : { global: false, relativeDirPath: void 0 }
|
|
2971
|
+
);
|
|
2972
|
+
if (!global) {
|
|
2973
|
+
return {
|
|
2974
|
+
"modular-mcp": {
|
|
2975
|
+
type: "stdio",
|
|
2976
|
+
command: "npx",
|
|
2977
|
+
args: ["-y", "@kimuson/modular-mcp", paths.relativeFilePath],
|
|
2978
|
+
env: {}
|
|
2979
|
+
}
|
|
2980
|
+
};
|
|
2981
|
+
}
|
|
2982
|
+
return {
|
|
2983
|
+
"modular-mcp": {
|
|
2984
|
+
type: "stdio",
|
|
2985
|
+
command: "npx",
|
|
2986
|
+
args: [
|
|
2987
|
+
"-y",
|
|
2988
|
+
"@kimuson/modular-mcp",
|
|
2989
|
+
(0, import_node_path27.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
2990
|
+
],
|
|
2991
|
+
env: {}
|
|
2992
|
+
}
|
|
2993
|
+
};
|
|
2994
|
+
}
|
|
2995
|
+
static fromRulesyncMcp({
|
|
2996
|
+
baseDir = ".",
|
|
2997
|
+
rulesyncMcp,
|
|
2998
|
+
validate = true,
|
|
2999
|
+
global = false,
|
|
3000
|
+
relativeDirPath
|
|
3001
|
+
}) {
|
|
3002
|
+
const paths = this.getSettablePaths(
|
|
3003
|
+
global && relativeDirPath ? { global: true, relativeDirPath } : { global: false, relativeDirPath: void 0 }
|
|
3004
|
+
);
|
|
3005
|
+
const modularMcpJson = {
|
|
3006
|
+
mcpServers: rulesyncMcp.getJson({ modularMcp: true }).mcpServers
|
|
3007
|
+
};
|
|
3008
|
+
return new _ModularMcp({
|
|
3009
|
+
baseDir,
|
|
3010
|
+
relativeDirPath: paths.relativeDirPath,
|
|
3011
|
+
relativeFilePath: paths.relativeFilePath,
|
|
3012
|
+
fileContent: JSON.stringify(modularMcpJson, null, 2),
|
|
3013
|
+
validate
|
|
3014
|
+
});
|
|
3015
|
+
}
|
|
3016
|
+
validate() {
|
|
3017
|
+
return { success: true, error: null };
|
|
3018
|
+
}
|
|
3019
|
+
};
|
|
3020
|
+
|
|
3021
|
+
// src/mcp/claudecode-mcp.ts
|
|
2879
3022
|
var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
2880
3023
|
json;
|
|
2881
3024
|
constructor(params) {
|
|
@@ -2904,7 +3047,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
2904
3047
|
}) {
|
|
2905
3048
|
const paths = this.getSettablePaths({ global });
|
|
2906
3049
|
const fileContent = await readOrInitializeFileContent(
|
|
2907
|
-
(0,
|
|
3050
|
+
(0, import_node_path28.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
2908
3051
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
2909
3052
|
);
|
|
2910
3053
|
const json = JSON.parse(fileContent);
|
|
@@ -2921,20 +3064,28 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
2921
3064
|
baseDir = ".",
|
|
2922
3065
|
rulesyncMcp,
|
|
2923
3066
|
validate = true,
|
|
2924
|
-
global = false
|
|
3067
|
+
global = false,
|
|
3068
|
+
modularMcp = false
|
|
2925
3069
|
}) {
|
|
2926
3070
|
const paths = this.getSettablePaths({ global });
|
|
2927
3071
|
const fileContent = await readOrInitializeFileContent(
|
|
2928
|
-
(0,
|
|
3072
|
+
(0, import_node_path28.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
2929
3073
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
2930
3074
|
);
|
|
2931
3075
|
const json = JSON.parse(fileContent);
|
|
2932
|
-
const
|
|
3076
|
+
const mcpJson = modularMcp ? {
|
|
3077
|
+
...json,
|
|
3078
|
+
mcpServers: global ? ModularMcp.getMcpServers({
|
|
3079
|
+
baseDir,
|
|
3080
|
+
global: true,
|
|
3081
|
+
relativeDirPath: this.getSettablePaths({ global: true }).relativeDirPath
|
|
3082
|
+
}) : ModularMcp.getMcpServers({ baseDir, global: false })
|
|
3083
|
+
} : { ...json, mcpServers: rulesyncMcp.getJson({ modularMcp: false }).mcpServers };
|
|
2933
3084
|
return new _ClaudecodeMcp({
|
|
2934
3085
|
baseDir,
|
|
2935
3086
|
relativeDirPath: paths.relativeDirPath,
|
|
2936
3087
|
relativeFilePath: paths.relativeFilePath,
|
|
2937
|
-
fileContent: JSON.stringify(
|
|
3088
|
+
fileContent: JSON.stringify(mcpJson, null, 2),
|
|
2938
3089
|
validate
|
|
2939
3090
|
});
|
|
2940
3091
|
}
|
|
@@ -2949,7 +3100,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
2949
3100
|
};
|
|
2950
3101
|
|
|
2951
3102
|
// src/mcp/cline-mcp.ts
|
|
2952
|
-
var
|
|
3103
|
+
var import_node_path29 = require("path");
|
|
2953
3104
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
2954
3105
|
json;
|
|
2955
3106
|
constructor(params) {
|
|
@@ -2970,7 +3121,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
2970
3121
|
validate = true
|
|
2971
3122
|
}) {
|
|
2972
3123
|
const fileContent = await readFileContent(
|
|
2973
|
-
(0,
|
|
3124
|
+
(0, import_node_path29.join)(
|
|
2974
3125
|
baseDir,
|
|
2975
3126
|
this.getSettablePaths().relativeDirPath,
|
|
2976
3127
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3006,7 +3157,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3006
3157
|
};
|
|
3007
3158
|
|
|
3008
3159
|
// src/mcp/codexcli-mcp.ts
|
|
3009
|
-
var
|
|
3160
|
+
var import_node_path30 = require("path");
|
|
3010
3161
|
var smolToml = __toESM(require("smol-toml"), 1);
|
|
3011
3162
|
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
3012
3163
|
toml;
|
|
@@ -3042,7 +3193,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3042
3193
|
}) {
|
|
3043
3194
|
const paths = this.getSettablePaths({ global });
|
|
3044
3195
|
const fileContent = await readFileContent(
|
|
3045
|
-
(0,
|
|
3196
|
+
(0, import_node_path30.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3046
3197
|
);
|
|
3047
3198
|
return new _CodexcliMcp({
|
|
3048
3199
|
baseDir,
|
|
@@ -3059,13 +3210,13 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3059
3210
|
global = false
|
|
3060
3211
|
}) {
|
|
3061
3212
|
const paths = this.getSettablePaths({ global });
|
|
3062
|
-
const configTomlFilePath = (0,
|
|
3213
|
+
const configTomlFilePath = (0, import_node_path30.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3063
3214
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
3064
3215
|
configTomlFilePath,
|
|
3065
3216
|
smolToml.stringify({})
|
|
3066
3217
|
);
|
|
3067
3218
|
const configToml = smolToml.parse(configTomlFileContent);
|
|
3068
|
-
const mcpServers = rulesyncMcp.getJson().mcpServers;
|
|
3219
|
+
const mcpServers = rulesyncMcp.getJson({ modularMcp: false }).mcpServers;
|
|
3069
3220
|
const filteredMcpServers = this.removeEmptyEntries(mcpServers);
|
|
3070
3221
|
configToml["mcp_servers"] = filteredMcpServers;
|
|
3071
3222
|
return new _CodexcliMcp({
|
|
@@ -3100,7 +3251,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3100
3251
|
};
|
|
3101
3252
|
|
|
3102
3253
|
// src/mcp/copilot-mcp.ts
|
|
3103
|
-
var
|
|
3254
|
+
var import_node_path31 = require("path");
|
|
3104
3255
|
var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
3105
3256
|
json;
|
|
3106
3257
|
constructor(params) {
|
|
@@ -3121,7 +3272,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3121
3272
|
validate = true
|
|
3122
3273
|
}) {
|
|
3123
3274
|
const fileContent = await readFileContent(
|
|
3124
|
-
(0,
|
|
3275
|
+
(0, import_node_path31.join)(
|
|
3125
3276
|
baseDir,
|
|
3126
3277
|
this.getSettablePaths().relativeDirPath,
|
|
3127
3278
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3157,7 +3308,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3157
3308
|
};
|
|
3158
3309
|
|
|
3159
3310
|
// src/mcp/cursor-mcp.ts
|
|
3160
|
-
var
|
|
3311
|
+
var import_node_path32 = require("path");
|
|
3161
3312
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
3162
3313
|
json;
|
|
3163
3314
|
constructor(params) {
|
|
@@ -3178,7 +3329,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
3178
3329
|
validate = true
|
|
3179
3330
|
}) {
|
|
3180
3331
|
const fileContent = await readFileContent(
|
|
3181
|
-
(0,
|
|
3332
|
+
(0, import_node_path32.join)(
|
|
3182
3333
|
baseDir,
|
|
3183
3334
|
this.getSettablePaths().relativeDirPath,
|
|
3184
3335
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3197,7 +3348,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
3197
3348
|
rulesyncMcp,
|
|
3198
3349
|
validate = true
|
|
3199
3350
|
}) {
|
|
3200
|
-
const json = rulesyncMcp.getJson();
|
|
3351
|
+
const json = rulesyncMcp.getJson({ modularMcp: false });
|
|
3201
3352
|
const cursorConfig = {
|
|
3202
3353
|
mcpServers: json.mcpServers || {}
|
|
3203
3354
|
};
|
|
@@ -3225,7 +3376,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
3225
3376
|
};
|
|
3226
3377
|
|
|
3227
3378
|
// src/mcp/geminicli-mcp.ts
|
|
3228
|
-
var
|
|
3379
|
+
var import_node_path33 = require("path");
|
|
3229
3380
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
3230
3381
|
json;
|
|
3231
3382
|
constructor(params) {
|
|
@@ -3254,7 +3405,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3254
3405
|
}) {
|
|
3255
3406
|
const paths = this.getSettablePaths({ global });
|
|
3256
3407
|
const fileContent = await readOrInitializeFileContent(
|
|
3257
|
-
(0,
|
|
3408
|
+
(0, import_node_path33.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3258
3409
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3259
3410
|
);
|
|
3260
3411
|
const json = JSON.parse(fileContent);
|
|
@@ -3275,11 +3426,11 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3275
3426
|
}) {
|
|
3276
3427
|
const paths = this.getSettablePaths({ global });
|
|
3277
3428
|
const fileContent = await readOrInitializeFileContent(
|
|
3278
|
-
(0,
|
|
3429
|
+
(0, import_node_path33.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3279
3430
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3280
3431
|
);
|
|
3281
3432
|
const json = JSON.parse(fileContent);
|
|
3282
|
-
const newJson = { ...json, mcpServers: rulesyncMcp.getJson().mcpServers };
|
|
3433
|
+
const newJson = { ...json, mcpServers: rulesyncMcp.getJson({ modularMcp: false }).mcpServers };
|
|
3283
3434
|
return new _GeminiCliMcp({
|
|
3284
3435
|
baseDir,
|
|
3285
3436
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -3299,7 +3450,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3299
3450
|
};
|
|
3300
3451
|
|
|
3301
3452
|
// src/mcp/roo-mcp.ts
|
|
3302
|
-
var
|
|
3453
|
+
var import_node_path34 = require("path");
|
|
3303
3454
|
var RooMcp = class _RooMcp extends ToolMcp {
|
|
3304
3455
|
json;
|
|
3305
3456
|
constructor(params) {
|
|
@@ -3320,7 +3471,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
3320
3471
|
validate = true
|
|
3321
3472
|
}) {
|
|
3322
3473
|
const fileContent = await readFileContent(
|
|
3323
|
-
(0,
|
|
3474
|
+
(0, import_node_path34.join)(
|
|
3324
3475
|
baseDir,
|
|
3325
3476
|
this.getSettablePaths().relativeDirPath,
|
|
3326
3477
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3371,13 +3522,16 @@ var McpProcessorToolTargetSchema = import_mini12.z.enum(
|
|
|
3371
3522
|
mcpProcessorToolTargets.concat("codexcli")
|
|
3372
3523
|
);
|
|
3373
3524
|
var mcpProcessorToolTargetsGlobal = ["claudecode", "codexcli", "geminicli"];
|
|
3525
|
+
var mcpProcessorToolTargetsModular = ["claudecode"];
|
|
3374
3526
|
var McpProcessor = class extends FeatureProcessor {
|
|
3375
3527
|
toolTarget;
|
|
3376
3528
|
global;
|
|
3529
|
+
modularMcp;
|
|
3377
3530
|
constructor({
|
|
3378
3531
|
baseDir = ".",
|
|
3379
3532
|
toolTarget,
|
|
3380
|
-
global = false
|
|
3533
|
+
global = false,
|
|
3534
|
+
modularMcp = false
|
|
3381
3535
|
}) {
|
|
3382
3536
|
super({ baseDir });
|
|
3383
3537
|
const result = McpProcessorToolTargetSchema.safeParse(toolTarget);
|
|
@@ -3388,6 +3542,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
3388
3542
|
}
|
|
3389
3543
|
this.toolTarget = result.data;
|
|
3390
3544
|
this.global = global;
|
|
3545
|
+
this.modularMcp = modularMcp;
|
|
3391
3546
|
}
|
|
3392
3547
|
/**
|
|
3393
3548
|
* Implementation of abstract method from FeatureProcessor
|
|
@@ -3395,9 +3550,9 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
3395
3550
|
*/
|
|
3396
3551
|
async loadRulesyncFiles() {
|
|
3397
3552
|
try {
|
|
3398
|
-
return [await RulesyncMcp.fromFile({})];
|
|
3553
|
+
return [await RulesyncMcp.fromFile({ modularMcp: this.modularMcp })];
|
|
3399
3554
|
} catch (error) {
|
|
3400
|
-
logger.debug(`
|
|
3555
|
+
logger.debug(`Failed to load MCP files for tool target: ${this.toolTarget}`, error);
|
|
3401
3556
|
return [];
|
|
3402
3557
|
}
|
|
3403
3558
|
}
|
|
@@ -3491,7 +3646,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
3491
3646
|
logger.info(`Successfully loaded ${toolMcps.length} ${this.toolTarget} MCP files`);
|
|
3492
3647
|
return toolMcps;
|
|
3493
3648
|
} catch (error) {
|
|
3494
|
-
logger.debug(`
|
|
3649
|
+
logger.debug(`Failed to load MCP files for tool target: ${this.toolTarget}`, error);
|
|
3495
3650
|
return [];
|
|
3496
3651
|
}
|
|
3497
3652
|
}
|
|
@@ -3515,10 +3670,11 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
3515
3670
|
rulesyncMcp: rulesyncMcp2
|
|
3516
3671
|
});
|
|
3517
3672
|
case "claudecode":
|
|
3518
|
-
return ClaudecodeMcp.fromRulesyncMcp({
|
|
3673
|
+
return await ClaudecodeMcp.fromRulesyncMcp({
|
|
3519
3674
|
baseDir: this.baseDir,
|
|
3520
3675
|
rulesyncMcp: rulesyncMcp2,
|
|
3521
|
-
global: this.global
|
|
3676
|
+
global: this.global,
|
|
3677
|
+
modularMcp: this.modularMcp
|
|
3522
3678
|
});
|
|
3523
3679
|
case "cline":
|
|
3524
3680
|
return ClineMcp.fromRulesyncMcp({
|
|
@@ -3557,7 +3713,18 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
3557
3713
|
}
|
|
3558
3714
|
})
|
|
3559
3715
|
);
|
|
3560
|
-
|
|
3716
|
+
const toolFiles = toolMcps;
|
|
3717
|
+
if (this.modularMcp && mcpProcessorToolTargetsModular.includes(this.toolTarget)) {
|
|
3718
|
+
const relativeDirPath = this.toolTarget === "claudecode" ? ClaudecodeMcp.getSettablePaths({ global: this.global }).relativeDirPath : void 0;
|
|
3719
|
+
toolFiles.push(
|
|
3720
|
+
ModularMcp.fromRulesyncMcp({
|
|
3721
|
+
baseDir: this.baseDir,
|
|
3722
|
+
rulesyncMcp,
|
|
3723
|
+
...this.global && relativeDirPath ? { global: true, relativeDirPath } : { global: false }
|
|
3724
|
+
})
|
|
3725
|
+
);
|
|
3726
|
+
}
|
|
3727
|
+
return toolFiles;
|
|
3561
3728
|
}
|
|
3562
3729
|
/**
|
|
3563
3730
|
* Implementation of abstract method from FeatureProcessor
|
|
@@ -3583,12 +3750,12 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
3583
3750
|
};
|
|
3584
3751
|
|
|
3585
3752
|
// src/rules/rules-processor.ts
|
|
3586
|
-
var
|
|
3753
|
+
var import_node_path58 = require("path");
|
|
3587
3754
|
var import_fast_xml_parser = require("fast-xml-parser");
|
|
3588
3755
|
var import_mini21 = require("zod/mini");
|
|
3589
3756
|
|
|
3590
3757
|
// src/subagents/simulated-subagent.ts
|
|
3591
|
-
var
|
|
3758
|
+
var import_node_path35 = require("path");
|
|
3592
3759
|
var import_mini13 = require("zod/mini");
|
|
3593
3760
|
|
|
3594
3761
|
// src/subagents/tool-subagent.ts
|
|
@@ -3636,7 +3803,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
3636
3803
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
3637
3804
|
if (!result.success) {
|
|
3638
3805
|
throw new Error(
|
|
3639
|
-
`Invalid frontmatter in ${(0,
|
|
3806
|
+
`Invalid frontmatter in ${(0, import_node_path35.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
|
|
3640
3807
|
);
|
|
3641
3808
|
}
|
|
3642
3809
|
}
|
|
@@ -3687,7 +3854,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
3687
3854
|
return {
|
|
3688
3855
|
success: false,
|
|
3689
3856
|
error: new Error(
|
|
3690
|
-
`Invalid frontmatter in ${(0,
|
|
3857
|
+
`Invalid frontmatter in ${(0, import_node_path35.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
|
|
3691
3858
|
)
|
|
3692
3859
|
};
|
|
3693
3860
|
}
|
|
@@ -3697,7 +3864,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
3697
3864
|
relativeFilePath,
|
|
3698
3865
|
validate = true
|
|
3699
3866
|
}) {
|
|
3700
|
-
const filePath = (0,
|
|
3867
|
+
const filePath = (0, import_node_path35.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
3701
3868
|
const fileContent = await readFileContent(filePath);
|
|
3702
3869
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3703
3870
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -3707,7 +3874,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
3707
3874
|
return {
|
|
3708
3875
|
baseDir,
|
|
3709
3876
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
3710
|
-
relativeFilePath: (0,
|
|
3877
|
+
relativeFilePath: (0, import_node_path35.basename)(relativeFilePath),
|
|
3711
3878
|
frontmatter: result.data,
|
|
3712
3879
|
body: content.trim(),
|
|
3713
3880
|
validate
|
|
@@ -3854,15 +4021,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
3854
4021
|
};
|
|
3855
4022
|
|
|
3856
4023
|
// src/subagents/subagents-processor.ts
|
|
3857
|
-
var
|
|
4024
|
+
var import_node_path38 = require("path");
|
|
3858
4025
|
var import_mini16 = require("zod/mini");
|
|
3859
4026
|
|
|
3860
4027
|
// src/subagents/claudecode-subagent.ts
|
|
3861
|
-
var
|
|
4028
|
+
var import_node_path37 = require("path");
|
|
3862
4029
|
var import_mini15 = require("zod/mini");
|
|
3863
4030
|
|
|
3864
4031
|
// src/subagents/rulesync-subagent.ts
|
|
3865
|
-
var
|
|
4032
|
+
var import_node_path36 = require("path");
|
|
3866
4033
|
var import_mini14 = require("zod/mini");
|
|
3867
4034
|
var RulesyncSubagentModelSchema = import_mini14.z.enum(["opus", "sonnet", "haiku", "inherit"]);
|
|
3868
4035
|
var RulesyncSubagentFrontmatterSchema = import_mini14.z.object({
|
|
@@ -3883,7 +4050,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
3883
4050
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
3884
4051
|
if (!result.success) {
|
|
3885
4052
|
throw new Error(
|
|
3886
|
-
`Invalid frontmatter in ${(0,
|
|
4053
|
+
`Invalid frontmatter in ${(0, import_node_path36.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
|
|
3887
4054
|
);
|
|
3888
4055
|
}
|
|
3889
4056
|
}
|
|
@@ -3915,7 +4082,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
3915
4082
|
return {
|
|
3916
4083
|
success: false,
|
|
3917
4084
|
error: new Error(
|
|
3918
|
-
`Invalid frontmatter in ${(0,
|
|
4085
|
+
`Invalid frontmatter in ${(0, import_node_path36.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
|
|
3919
4086
|
)
|
|
3920
4087
|
};
|
|
3921
4088
|
}
|
|
@@ -3923,13 +4090,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
3923
4090
|
static async fromFile({
|
|
3924
4091
|
relativeFilePath
|
|
3925
4092
|
}) {
|
|
3926
|
-
const fileContent = await readFileContent((0,
|
|
4093
|
+
const fileContent = await readFileContent((0, import_node_path36.join)(".rulesync/subagents", relativeFilePath));
|
|
3927
4094
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3928
4095
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
3929
4096
|
if (!result.success) {
|
|
3930
4097
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${result.error.message}`);
|
|
3931
4098
|
}
|
|
3932
|
-
const filename = (0,
|
|
4099
|
+
const filename = (0, import_node_path36.basename)(relativeFilePath);
|
|
3933
4100
|
return new _RulesyncSubagent({
|
|
3934
4101
|
baseDir: ".",
|
|
3935
4102
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -3955,7 +4122,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
3955
4122
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
3956
4123
|
if (!result.success) {
|
|
3957
4124
|
throw new Error(
|
|
3958
|
-
`Invalid frontmatter in ${(0,
|
|
4125
|
+
`Invalid frontmatter in ${(0, import_node_path37.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
|
|
3959
4126
|
);
|
|
3960
4127
|
}
|
|
3961
4128
|
}
|
|
@@ -3967,7 +4134,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
3967
4134
|
}
|
|
3968
4135
|
static getSettablePaths(_options = {}) {
|
|
3969
4136
|
return {
|
|
3970
|
-
relativeDirPath: (0,
|
|
4137
|
+
relativeDirPath: (0, import_node_path37.join)(".claude", "agents")
|
|
3971
4138
|
};
|
|
3972
4139
|
}
|
|
3973
4140
|
getFrontmatter() {
|
|
@@ -4035,7 +4202,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
4035
4202
|
return {
|
|
4036
4203
|
success: false,
|
|
4037
4204
|
error: new Error(
|
|
4038
|
-
`Invalid frontmatter in ${(0,
|
|
4205
|
+
`Invalid frontmatter in ${(0, import_node_path37.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
|
|
4039
4206
|
)
|
|
4040
4207
|
};
|
|
4041
4208
|
}
|
|
@@ -4053,7 +4220,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
4053
4220
|
global = false
|
|
4054
4221
|
}) {
|
|
4055
4222
|
const paths = this.getSettablePaths({ global });
|
|
4056
|
-
const filePath = (0,
|
|
4223
|
+
const filePath = (0, import_node_path37.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
4057
4224
|
const fileContent = await readFileContent(filePath);
|
|
4058
4225
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
4059
4226
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -4207,7 +4374,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4207
4374
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
4208
4375
|
*/
|
|
4209
4376
|
async loadRulesyncFiles() {
|
|
4210
|
-
const subagentsDir = (0,
|
|
4377
|
+
const subagentsDir = (0, import_node_path38.join)(RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
4211
4378
|
const dirExists = await directoryExists(subagentsDir);
|
|
4212
4379
|
if (!dirExists) {
|
|
4213
4380
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -4222,7 +4389,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4222
4389
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
4223
4390
|
const rulesyncSubagents = [];
|
|
4224
4391
|
for (const mdFile of mdFiles) {
|
|
4225
|
-
const filepath = (0,
|
|
4392
|
+
const filepath = (0, import_node_path38.join)(subagentsDir, mdFile);
|
|
4226
4393
|
try {
|
|
4227
4394
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
4228
4395
|
relativeFilePath: mdFile,
|
|
@@ -4341,8 +4508,8 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4341
4508
|
relativeDirPath,
|
|
4342
4509
|
fromFile
|
|
4343
4510
|
}) {
|
|
4344
|
-
const paths = await findFilesByGlobs((0,
|
|
4345
|
-
const subagents = (await Promise.allSettled(paths.map((path2) => fromFile((0,
|
|
4511
|
+
const paths = await findFilesByGlobs((0, import_node_path38.join)(this.baseDir, relativeDirPath, "*.md"));
|
|
4512
|
+
const subagents = (await Promise.allSettled(paths.map((path2) => fromFile((0, import_node_path38.basename)(path2))))).filter((r) => r.status === "fulfilled").map((r) => r.value);
|
|
4346
4513
|
logger.info(`Successfully loaded ${subagents.length} ${relativeDirPath} subagents`);
|
|
4347
4514
|
return subagents;
|
|
4348
4515
|
}
|
|
@@ -4369,13 +4536,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4369
4536
|
};
|
|
4370
4537
|
|
|
4371
4538
|
// src/rules/agentsmd-rule.ts
|
|
4372
|
-
var
|
|
4539
|
+
var import_node_path41 = require("path");
|
|
4373
4540
|
|
|
4374
4541
|
// src/rules/tool-rule.ts
|
|
4375
|
-
var
|
|
4542
|
+
var import_node_path40 = require("path");
|
|
4376
4543
|
|
|
4377
4544
|
// src/rules/rulesync-rule.ts
|
|
4378
|
-
var
|
|
4545
|
+
var import_node_path39 = require("path");
|
|
4379
4546
|
var import_mini17 = require("zod/mini");
|
|
4380
4547
|
var RulesyncRuleFrontmatterSchema = import_mini17.z.object({
|
|
4381
4548
|
root: import_mini17.z.optional(import_mini17.z.optional(import_mini17.z.boolean())),
|
|
@@ -4404,7 +4571,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
4404
4571
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
4405
4572
|
if (!result.success) {
|
|
4406
4573
|
throw new Error(
|
|
4407
|
-
`Invalid frontmatter in ${(0,
|
|
4574
|
+
`Invalid frontmatter in ${(0, import_node_path39.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
|
|
4408
4575
|
);
|
|
4409
4576
|
}
|
|
4410
4577
|
}
|
|
@@ -4439,7 +4606,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
4439
4606
|
return {
|
|
4440
4607
|
success: false,
|
|
4441
4608
|
error: new Error(
|
|
4442
|
-
`Invalid frontmatter in ${(0,
|
|
4609
|
+
`Invalid frontmatter in ${(0, import_node_path39.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
|
|
4443
4610
|
)
|
|
4444
4611
|
};
|
|
4445
4612
|
}
|
|
@@ -4448,8 +4615,8 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
4448
4615
|
relativeFilePath,
|
|
4449
4616
|
validate = true
|
|
4450
4617
|
}) {
|
|
4451
|
-
const legacyPath = (0,
|
|
4452
|
-
const recommendedPath = (0,
|
|
4618
|
+
const legacyPath = (0, import_node_path39.join)(this.getSettablePaths().legacy.relativeDirPath, relativeFilePath);
|
|
4619
|
+
const recommendedPath = (0, import_node_path39.join)(
|
|
4453
4620
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
4454
4621
|
relativeFilePath
|
|
4455
4622
|
);
|
|
@@ -4468,7 +4635,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
4468
4635
|
agentsmd: result.data.agentsmd,
|
|
4469
4636
|
cursor: result.data.cursor
|
|
4470
4637
|
};
|
|
4471
|
-
const filename = (0,
|
|
4638
|
+
const filename = (0, import_node_path39.basename)(legacyPath);
|
|
4472
4639
|
return new _RulesyncRule({
|
|
4473
4640
|
baseDir: ".",
|
|
4474
4641
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -4482,7 +4649,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
4482
4649
|
relativeFilePath,
|
|
4483
4650
|
validate = true
|
|
4484
4651
|
}) {
|
|
4485
|
-
const filePath = (0,
|
|
4652
|
+
const filePath = (0, import_node_path39.join)(this.getSettablePaths().recommended.relativeDirPath, relativeFilePath);
|
|
4486
4653
|
const fileContent = await readFileContent(filePath);
|
|
4487
4654
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
4488
4655
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -4497,7 +4664,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
4497
4664
|
agentsmd: result.data.agentsmd,
|
|
4498
4665
|
cursor: result.data.cursor
|
|
4499
4666
|
};
|
|
4500
|
-
const filename = (0,
|
|
4667
|
+
const filename = (0, import_node_path39.basename)(filePath);
|
|
4501
4668
|
return new _RulesyncRule({
|
|
4502
4669
|
baseDir: ".",
|
|
4503
4670
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -4583,7 +4750,7 @@ var ToolRule = class extends ToolFile {
|
|
|
4583
4750
|
});
|
|
4584
4751
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
4585
4752
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
4586
|
-
params.relativeDirPath = (0,
|
|
4753
|
+
params.relativeDirPath = (0, import_node_path40.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
4587
4754
|
params.relativeFilePath = "AGENTS.md";
|
|
4588
4755
|
}
|
|
4589
4756
|
return params;
|
|
@@ -4659,8 +4826,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
4659
4826
|
validate = true
|
|
4660
4827
|
}) {
|
|
4661
4828
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
4662
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
4663
|
-
const fileContent = await readFileContent((0,
|
|
4829
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path41.join)(".agents/memories", relativeFilePath);
|
|
4830
|
+
const fileContent = await readFileContent((0, import_node_path41.join)(baseDir, relativePath));
|
|
4664
4831
|
return new _AgentsMdRule({
|
|
4665
4832
|
baseDir,
|
|
4666
4833
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4700,7 +4867,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
4700
4867
|
};
|
|
4701
4868
|
|
|
4702
4869
|
// src/rules/amazonqcli-rule.ts
|
|
4703
|
-
var
|
|
4870
|
+
var import_node_path42 = require("path");
|
|
4704
4871
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
4705
4872
|
static getSettablePaths() {
|
|
4706
4873
|
return {
|
|
@@ -4715,7 +4882,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
4715
4882
|
validate = true
|
|
4716
4883
|
}) {
|
|
4717
4884
|
const fileContent = await readFileContent(
|
|
4718
|
-
(0,
|
|
4885
|
+
(0, import_node_path42.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4719
4886
|
);
|
|
4720
4887
|
return new _AmazonQCliRule({
|
|
4721
4888
|
baseDir,
|
|
@@ -4755,7 +4922,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
4755
4922
|
};
|
|
4756
4923
|
|
|
4757
4924
|
// src/rules/augmentcode-legacy-rule.ts
|
|
4758
|
-
var
|
|
4925
|
+
var import_node_path43 = require("path");
|
|
4759
4926
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
4760
4927
|
toRulesyncRule() {
|
|
4761
4928
|
const rulesyncFrontmatter = {
|
|
@@ -4816,8 +4983,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
4816
4983
|
}) {
|
|
4817
4984
|
const settablePaths = this.getSettablePaths();
|
|
4818
4985
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
4819
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
4820
|
-
const fileContent = await readFileContent((0,
|
|
4986
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path43.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
4987
|
+
const fileContent = await readFileContent((0, import_node_path43.join)(baseDir, relativePath));
|
|
4821
4988
|
return new _AugmentcodeLegacyRule({
|
|
4822
4989
|
baseDir,
|
|
4823
4990
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -4830,7 +4997,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
4830
4997
|
};
|
|
4831
4998
|
|
|
4832
4999
|
// src/rules/augmentcode-rule.ts
|
|
4833
|
-
var
|
|
5000
|
+
var import_node_path44 = require("path");
|
|
4834
5001
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
4835
5002
|
toRulesyncRule() {
|
|
4836
5003
|
return this.toRulesyncRuleDefault();
|
|
@@ -4862,7 +5029,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
4862
5029
|
validate = true
|
|
4863
5030
|
}) {
|
|
4864
5031
|
const fileContent = await readFileContent(
|
|
4865
|
-
(0,
|
|
5032
|
+
(0, import_node_path44.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4866
5033
|
);
|
|
4867
5034
|
const { body: content } = parseFrontmatter(fileContent);
|
|
4868
5035
|
return new _AugmentcodeRule({
|
|
@@ -4885,7 +5052,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
4885
5052
|
};
|
|
4886
5053
|
|
|
4887
5054
|
// src/rules/claudecode-rule.ts
|
|
4888
|
-
var
|
|
5055
|
+
var import_node_path45 = require("path");
|
|
4889
5056
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
4890
5057
|
static getSettablePaths({
|
|
4891
5058
|
global
|
|
@@ -4904,7 +5071,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
4904
5071
|
relativeFilePath: "CLAUDE.md"
|
|
4905
5072
|
},
|
|
4906
5073
|
nonRoot: {
|
|
4907
|
-
relativeDirPath: (0,
|
|
5074
|
+
relativeDirPath: (0, import_node_path45.join)(".claude", "memories")
|
|
4908
5075
|
}
|
|
4909
5076
|
};
|
|
4910
5077
|
}
|
|
@@ -4919,7 +5086,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
4919
5086
|
if (isRoot) {
|
|
4920
5087
|
const relativePath2 = paths.root.relativeFilePath;
|
|
4921
5088
|
const fileContent2 = await readFileContent(
|
|
4922
|
-
(0,
|
|
5089
|
+
(0, import_node_path45.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
4923
5090
|
);
|
|
4924
5091
|
return new _ClaudecodeRule({
|
|
4925
5092
|
baseDir,
|
|
@@ -4933,8 +5100,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
4933
5100
|
if (!paths.nonRoot) {
|
|
4934
5101
|
throw new Error("nonRoot path is not set");
|
|
4935
5102
|
}
|
|
4936
|
-
const relativePath = (0,
|
|
4937
|
-
const fileContent = await readFileContent((0,
|
|
5103
|
+
const relativePath = (0, import_node_path45.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
5104
|
+
const fileContent = await readFileContent((0, import_node_path45.join)(baseDir, relativePath));
|
|
4938
5105
|
return new _ClaudecodeRule({
|
|
4939
5106
|
baseDir,
|
|
4940
5107
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -4976,7 +5143,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
4976
5143
|
};
|
|
4977
5144
|
|
|
4978
5145
|
// src/rules/cline-rule.ts
|
|
4979
|
-
var
|
|
5146
|
+
var import_node_path46 = require("path");
|
|
4980
5147
|
var import_mini18 = require("zod/mini");
|
|
4981
5148
|
var ClineRuleFrontmatterSchema = import_mini18.z.object({
|
|
4982
5149
|
description: import_mini18.z.string()
|
|
@@ -5021,7 +5188,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
5021
5188
|
validate = true
|
|
5022
5189
|
}) {
|
|
5023
5190
|
const fileContent = await readFileContent(
|
|
5024
|
-
(0,
|
|
5191
|
+
(0, import_node_path46.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
5025
5192
|
);
|
|
5026
5193
|
return new _ClineRule({
|
|
5027
5194
|
baseDir,
|
|
@@ -5034,7 +5201,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
5034
5201
|
};
|
|
5035
5202
|
|
|
5036
5203
|
// src/rules/codexcli-rule.ts
|
|
5037
|
-
var
|
|
5204
|
+
var import_node_path47 = require("path");
|
|
5038
5205
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
5039
5206
|
static getSettablePaths({
|
|
5040
5207
|
global
|
|
@@ -5068,7 +5235,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
5068
5235
|
if (isRoot) {
|
|
5069
5236
|
const relativePath2 = paths.root.relativeFilePath;
|
|
5070
5237
|
const fileContent2 = await readFileContent(
|
|
5071
|
-
(0,
|
|
5238
|
+
(0, import_node_path47.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
5072
5239
|
);
|
|
5073
5240
|
return new _CodexcliRule({
|
|
5074
5241
|
baseDir,
|
|
@@ -5082,8 +5249,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
5082
5249
|
if (!paths.nonRoot) {
|
|
5083
5250
|
throw new Error("nonRoot path is not set");
|
|
5084
5251
|
}
|
|
5085
|
-
const relativePath = (0,
|
|
5086
|
-
const fileContent = await readFileContent((0,
|
|
5252
|
+
const relativePath = (0, import_node_path47.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
5253
|
+
const fileContent = await readFileContent((0, import_node_path47.join)(baseDir, relativePath));
|
|
5087
5254
|
return new _CodexcliRule({
|
|
5088
5255
|
baseDir,
|
|
5089
5256
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -5125,7 +5292,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
5125
5292
|
};
|
|
5126
5293
|
|
|
5127
5294
|
// src/rules/copilot-rule.ts
|
|
5128
|
-
var
|
|
5295
|
+
var import_node_path48 = require("path");
|
|
5129
5296
|
var import_mini19 = require("zod/mini");
|
|
5130
5297
|
var CopilotRuleFrontmatterSchema = import_mini19.z.object({
|
|
5131
5298
|
description: import_mini19.z.optional(import_mini19.z.string()),
|
|
@@ -5150,7 +5317,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
5150
5317
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
5151
5318
|
if (!result.success) {
|
|
5152
5319
|
throw new Error(
|
|
5153
|
-
`Invalid frontmatter in ${(0,
|
|
5320
|
+
`Invalid frontmatter in ${(0, import_node_path48.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
|
|
5154
5321
|
);
|
|
5155
5322
|
}
|
|
5156
5323
|
}
|
|
@@ -5222,11 +5389,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
5222
5389
|
validate = true
|
|
5223
5390
|
}) {
|
|
5224
5391
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
5225
|
-
const relativePath = isRoot ? (0,
|
|
5392
|
+
const relativePath = isRoot ? (0, import_node_path48.join)(
|
|
5226
5393
|
this.getSettablePaths().root.relativeDirPath,
|
|
5227
5394
|
this.getSettablePaths().root.relativeFilePath
|
|
5228
|
-
) : (0,
|
|
5229
|
-
const fileContent = await readFileContent((0,
|
|
5395
|
+
) : (0, import_node_path48.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
5396
|
+
const fileContent = await readFileContent((0, import_node_path48.join)(baseDir, relativePath));
|
|
5230
5397
|
if (isRoot) {
|
|
5231
5398
|
return new _CopilotRule({
|
|
5232
5399
|
baseDir,
|
|
@@ -5245,7 +5412,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
5245
5412
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
5246
5413
|
if (!result.success) {
|
|
5247
5414
|
throw new Error(
|
|
5248
|
-
`Invalid frontmatter in ${(0,
|
|
5415
|
+
`Invalid frontmatter in ${(0, import_node_path48.join)(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
5249
5416
|
);
|
|
5250
5417
|
}
|
|
5251
5418
|
return new _CopilotRule({
|
|
@@ -5269,7 +5436,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
5269
5436
|
return {
|
|
5270
5437
|
success: false,
|
|
5271
5438
|
error: new Error(
|
|
5272
|
-
`Invalid frontmatter in ${(0,
|
|
5439
|
+
`Invalid frontmatter in ${(0, import_node_path48.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
|
|
5273
5440
|
)
|
|
5274
5441
|
};
|
|
5275
5442
|
}
|
|
@@ -5289,7 +5456,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
5289
5456
|
};
|
|
5290
5457
|
|
|
5291
5458
|
// src/rules/cursor-rule.ts
|
|
5292
|
-
var
|
|
5459
|
+
var import_node_path49 = require("path");
|
|
5293
5460
|
var import_mini20 = require("zod/mini");
|
|
5294
5461
|
var CursorRuleFrontmatterSchema = import_mini20.z.object({
|
|
5295
5462
|
description: import_mini20.z.optional(import_mini20.z.string()),
|
|
@@ -5311,7 +5478,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
5311
5478
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
5312
5479
|
if (!result.success) {
|
|
5313
5480
|
throw new Error(
|
|
5314
|
-
`Invalid frontmatter in ${(0,
|
|
5481
|
+
`Invalid frontmatter in ${(0, import_node_path49.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
|
|
5315
5482
|
);
|
|
5316
5483
|
}
|
|
5317
5484
|
}
|
|
@@ -5428,19 +5595,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
5428
5595
|
validate = true
|
|
5429
5596
|
}) {
|
|
5430
5597
|
const fileContent = await readFileContent(
|
|
5431
|
-
(0,
|
|
5598
|
+
(0, import_node_path49.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
5432
5599
|
);
|
|
5433
5600
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
5434
5601
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
5435
5602
|
if (!result.success) {
|
|
5436
5603
|
throw new Error(
|
|
5437
|
-
`Invalid frontmatter in ${(0,
|
|
5604
|
+
`Invalid frontmatter in ${(0, import_node_path49.join)(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
5438
5605
|
);
|
|
5439
5606
|
}
|
|
5440
5607
|
return new _CursorRule({
|
|
5441
5608
|
baseDir,
|
|
5442
5609
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
5443
|
-
relativeFilePath: (0,
|
|
5610
|
+
relativeFilePath: (0, import_node_path49.basename)(relativeFilePath),
|
|
5444
5611
|
frontmatter: result.data,
|
|
5445
5612
|
body: content.trim(),
|
|
5446
5613
|
validate
|
|
@@ -5457,7 +5624,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
5457
5624
|
return {
|
|
5458
5625
|
success: false,
|
|
5459
5626
|
error: new Error(
|
|
5460
|
-
`Invalid frontmatter in ${(0,
|
|
5627
|
+
`Invalid frontmatter in ${(0, import_node_path49.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
|
|
5461
5628
|
)
|
|
5462
5629
|
};
|
|
5463
5630
|
}
|
|
@@ -5477,7 +5644,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
5477
5644
|
};
|
|
5478
5645
|
|
|
5479
5646
|
// src/rules/geminicli-rule.ts
|
|
5480
|
-
var
|
|
5647
|
+
var import_node_path50 = require("path");
|
|
5481
5648
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
5482
5649
|
static getSettablePaths({
|
|
5483
5650
|
global
|
|
@@ -5511,7 +5678,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
5511
5678
|
if (isRoot) {
|
|
5512
5679
|
const relativePath2 = paths.root.relativeFilePath;
|
|
5513
5680
|
const fileContent2 = await readFileContent(
|
|
5514
|
-
(0,
|
|
5681
|
+
(0, import_node_path50.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
5515
5682
|
);
|
|
5516
5683
|
return new _GeminiCliRule({
|
|
5517
5684
|
baseDir,
|
|
@@ -5525,8 +5692,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
5525
5692
|
if (!paths.nonRoot) {
|
|
5526
5693
|
throw new Error("nonRoot path is not set");
|
|
5527
5694
|
}
|
|
5528
|
-
const relativePath = (0,
|
|
5529
|
-
const fileContent = await readFileContent((0,
|
|
5695
|
+
const relativePath = (0, import_node_path50.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
5696
|
+
const fileContent = await readFileContent((0, import_node_path50.join)(baseDir, relativePath));
|
|
5530
5697
|
return new _GeminiCliRule({
|
|
5531
5698
|
baseDir,
|
|
5532
5699
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -5568,7 +5735,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
5568
5735
|
};
|
|
5569
5736
|
|
|
5570
5737
|
// src/rules/junie-rule.ts
|
|
5571
|
-
var
|
|
5738
|
+
var import_node_path51 = require("path");
|
|
5572
5739
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
5573
5740
|
static getSettablePaths() {
|
|
5574
5741
|
return {
|
|
@@ -5587,8 +5754,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
5587
5754
|
validate = true
|
|
5588
5755
|
}) {
|
|
5589
5756
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
5590
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
5591
|
-
const fileContent = await readFileContent((0,
|
|
5757
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path51.join)(".junie/memories", relativeFilePath);
|
|
5758
|
+
const fileContent = await readFileContent((0, import_node_path51.join)(baseDir, relativePath));
|
|
5592
5759
|
return new _JunieRule({
|
|
5593
5760
|
baseDir,
|
|
5594
5761
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -5628,7 +5795,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
5628
5795
|
};
|
|
5629
5796
|
|
|
5630
5797
|
// src/rules/kiro-rule.ts
|
|
5631
|
-
var
|
|
5798
|
+
var import_node_path52 = require("path");
|
|
5632
5799
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
5633
5800
|
static getSettablePaths() {
|
|
5634
5801
|
return {
|
|
@@ -5643,7 +5810,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
5643
5810
|
validate = true
|
|
5644
5811
|
}) {
|
|
5645
5812
|
const fileContent = await readFileContent(
|
|
5646
|
-
(0,
|
|
5813
|
+
(0, import_node_path52.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
5647
5814
|
);
|
|
5648
5815
|
return new _KiroRule({
|
|
5649
5816
|
baseDir,
|
|
@@ -5683,7 +5850,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
5683
5850
|
};
|
|
5684
5851
|
|
|
5685
5852
|
// src/rules/opencode-rule.ts
|
|
5686
|
-
var
|
|
5853
|
+
var import_node_path53 = require("path");
|
|
5687
5854
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
5688
5855
|
static getSettablePaths() {
|
|
5689
5856
|
return {
|
|
@@ -5702,8 +5869,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
5702
5869
|
validate = true
|
|
5703
5870
|
}) {
|
|
5704
5871
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
5705
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
5706
|
-
const fileContent = await readFileContent((0,
|
|
5872
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path53.join)(".opencode/memories", relativeFilePath);
|
|
5873
|
+
const fileContent = await readFileContent((0, import_node_path53.join)(baseDir, relativePath));
|
|
5707
5874
|
return new _OpenCodeRule({
|
|
5708
5875
|
baseDir,
|
|
5709
5876
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -5743,7 +5910,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
5743
5910
|
};
|
|
5744
5911
|
|
|
5745
5912
|
// src/rules/qwencode-rule.ts
|
|
5746
|
-
var
|
|
5913
|
+
var import_node_path54 = require("path");
|
|
5747
5914
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
5748
5915
|
static getSettablePaths() {
|
|
5749
5916
|
return {
|
|
@@ -5762,8 +5929,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
5762
5929
|
validate = true
|
|
5763
5930
|
}) {
|
|
5764
5931
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
5765
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
5766
|
-
const fileContent = await readFileContent((0,
|
|
5932
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path54.join)(".qwen/memories", relativeFilePath);
|
|
5933
|
+
const fileContent = await readFileContent((0, import_node_path54.join)(baseDir, relativePath));
|
|
5767
5934
|
return new _QwencodeRule({
|
|
5768
5935
|
baseDir,
|
|
5769
5936
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -5800,7 +5967,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
5800
5967
|
};
|
|
5801
5968
|
|
|
5802
5969
|
// src/rules/roo-rule.ts
|
|
5803
|
-
var
|
|
5970
|
+
var import_node_path55 = require("path");
|
|
5804
5971
|
var RooRule = class _RooRule extends ToolRule {
|
|
5805
5972
|
static getSettablePaths() {
|
|
5806
5973
|
return {
|
|
@@ -5815,7 +5982,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
5815
5982
|
validate = true
|
|
5816
5983
|
}) {
|
|
5817
5984
|
const fileContent = await readFileContent(
|
|
5818
|
-
(0,
|
|
5985
|
+
(0, import_node_path55.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
5819
5986
|
);
|
|
5820
5987
|
return new _RooRule({
|
|
5821
5988
|
baseDir,
|
|
@@ -5870,7 +6037,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
5870
6037
|
};
|
|
5871
6038
|
|
|
5872
6039
|
// src/rules/warp-rule.ts
|
|
5873
|
-
var
|
|
6040
|
+
var import_node_path56 = require("path");
|
|
5874
6041
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
5875
6042
|
constructor({ fileContent, root, ...rest }) {
|
|
5876
6043
|
super({
|
|
@@ -5896,8 +6063,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
5896
6063
|
validate = true
|
|
5897
6064
|
}) {
|
|
5898
6065
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
5899
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
5900
|
-
const fileContent = await readFileContent((0,
|
|
6066
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path56.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
6067
|
+
const fileContent = await readFileContent((0, import_node_path56.join)(baseDir, relativePath));
|
|
5901
6068
|
return new _WarpRule({
|
|
5902
6069
|
baseDir,
|
|
5903
6070
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -5937,7 +6104,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
5937
6104
|
};
|
|
5938
6105
|
|
|
5939
6106
|
// src/rules/windsurf-rule.ts
|
|
5940
|
-
var
|
|
6107
|
+
var import_node_path57 = require("path");
|
|
5941
6108
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
5942
6109
|
static getSettablePaths() {
|
|
5943
6110
|
return {
|
|
@@ -5952,7 +6119,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
5952
6119
|
validate = true
|
|
5953
6120
|
}) {
|
|
5954
6121
|
const fileContent = await readFileContent(
|
|
5955
|
-
(0,
|
|
6122
|
+
(0, import_node_path57.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
5956
6123
|
);
|
|
5957
6124
|
return new _WindsurfRule({
|
|
5958
6125
|
baseDir,
|
|
@@ -6352,10 +6519,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
6352
6519
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
6353
6520
|
*/
|
|
6354
6521
|
async loadRulesyncFiles() {
|
|
6355
|
-
const files = await findFilesByGlobs((0,
|
|
6522
|
+
const files = await findFilesByGlobs((0, import_node_path58.join)(".rulesync/rules", "*.md"));
|
|
6356
6523
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
6357
6524
|
const rulesyncRules = await Promise.all(
|
|
6358
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0,
|
|
6525
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path58.basename)(file) }))
|
|
6359
6526
|
);
|
|
6360
6527
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
6361
6528
|
if (rootRules.length > 1) {
|
|
@@ -6373,10 +6540,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
6373
6540
|
return rulesyncRules;
|
|
6374
6541
|
}
|
|
6375
6542
|
async loadRulesyncFilesLegacy() {
|
|
6376
|
-
const legacyFiles = await findFilesByGlobs((0,
|
|
6543
|
+
const legacyFiles = await findFilesByGlobs((0, import_node_path58.join)(".rulesync", "*.md"));
|
|
6377
6544
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
6378
6545
|
return Promise.all(
|
|
6379
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0,
|
|
6546
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path58.basename)(file) }))
|
|
6380
6547
|
);
|
|
6381
6548
|
}
|
|
6382
6549
|
/**
|
|
@@ -6440,13 +6607,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
6440
6607
|
return [];
|
|
6441
6608
|
}
|
|
6442
6609
|
const rootFilePaths = await findFilesByGlobs(
|
|
6443
|
-
(0,
|
|
6610
|
+
(0, import_node_path58.join)(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
|
|
6444
6611
|
);
|
|
6445
6612
|
return await Promise.all(
|
|
6446
6613
|
rootFilePaths.map(
|
|
6447
6614
|
(filePath) => root.fromFile({
|
|
6448
6615
|
baseDir: this.baseDir,
|
|
6449
|
-
relativeFilePath: (0,
|
|
6616
|
+
relativeFilePath: (0, import_node_path58.basename)(filePath),
|
|
6450
6617
|
global: this.global
|
|
6451
6618
|
})
|
|
6452
6619
|
)
|
|
@@ -6458,13 +6625,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
6458
6625
|
return [];
|
|
6459
6626
|
}
|
|
6460
6627
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
6461
|
-
(0,
|
|
6628
|
+
(0, import_node_path58.join)(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
|
|
6462
6629
|
);
|
|
6463
6630
|
return await Promise.all(
|
|
6464
6631
|
nonRootFilePaths.map(
|
|
6465
6632
|
(filePath) => nonRoot.fromFile({
|
|
6466
6633
|
baseDir: this.baseDir,
|
|
6467
|
-
relativeFilePath: (0,
|
|
6634
|
+
relativeFilePath: (0, import_node_path58.basename)(filePath),
|
|
6468
6635
|
global: this.global
|
|
6469
6636
|
})
|
|
6470
6637
|
)
|
|
@@ -6834,14 +7001,14 @@ s/<command> [arguments]
|
|
|
6834
7001
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
6835
7002
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
6836
7003
|
|
|
6837
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
7004
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path58.join)(commands.relativeDirPath, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
6838
7005
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
6839
7006
|
|
|
6840
7007
|
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.
|
|
6841
7008
|
|
|
6842
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
7009
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path58.join)(subagents.relativeDirPath, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
6843
7010
|
|
|
6844
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
7011
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path58.join)(subagents.relativeDirPath, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
6845
7012
|
const result = [
|
|
6846
7013
|
overview,
|
|
6847
7014
|
...this.simulateCommands && CommandsProcessor.getToolTargetsSimulated().includes(this.toolTarget) ? [commandsSection] : [],
|
|
@@ -6962,13 +7129,17 @@ async function generateMcp(config) {
|
|
|
6962
7129
|
}
|
|
6963
7130
|
let totalMcpOutputs = 0;
|
|
6964
7131
|
logger.info("Generating MCP files...");
|
|
7132
|
+
if (config.getModularMcp()) {
|
|
7133
|
+
logger.info("\u2139\uFE0F Modular MCP support is experimental.");
|
|
7134
|
+
}
|
|
6965
7135
|
const toolTargets = config.getGlobal() ? (0, import_es_toolkit2.intersection)(config.getTargets(), McpProcessor.getToolTargetsGlobal()) : (0, import_es_toolkit2.intersection)(config.getTargets(), McpProcessor.getToolTargets());
|
|
6966
7136
|
for (const baseDir of config.getBaseDirs()) {
|
|
6967
7137
|
for (const toolTarget of toolTargets) {
|
|
6968
7138
|
const processor = new McpProcessor({
|
|
6969
7139
|
baseDir,
|
|
6970
7140
|
toolTarget,
|
|
6971
|
-
global: config.getGlobal()
|
|
7141
|
+
global: config.getGlobal(),
|
|
7142
|
+
modularMcp: config.getModularMcp()
|
|
6972
7143
|
});
|
|
6973
7144
|
if (config.getDelete()) {
|
|
6974
7145
|
const oldToolFiles = await processor.loadToolFilesToDelete();
|
|
@@ -7051,9 +7222,9 @@ async function generateSubagents(config) {
|
|
|
7051
7222
|
}
|
|
7052
7223
|
|
|
7053
7224
|
// src/cli/commands/gitignore.ts
|
|
7054
|
-
var
|
|
7225
|
+
var import_node_path59 = require("path");
|
|
7055
7226
|
var gitignoreCommand = async () => {
|
|
7056
|
-
const gitignorePath = (0,
|
|
7227
|
+
const gitignorePath = (0, import_node_path59.join)(process.cwd(), ".gitignore");
|
|
7057
7228
|
const rulesFilesToIgnore = [
|
|
7058
7229
|
"# Generated by rulesync - AI tool configuration files",
|
|
7059
7230
|
// AGENTS.md
|
|
@@ -7113,7 +7284,9 @@ var gitignoreCommand = async () => {
|
|
|
7113
7284
|
"**/.roo/subagents/",
|
|
7114
7285
|
// Warp
|
|
7115
7286
|
"**/.warp/",
|
|
7116
|
-
"**/WARP.md"
|
|
7287
|
+
"**/WARP.md",
|
|
7288
|
+
// Others
|
|
7289
|
+
"**/modular-mcp.json"
|
|
7117
7290
|
];
|
|
7118
7291
|
let gitignoreContent = "";
|
|
7119
7292
|
if (await fileExists(gitignorePath)) {
|
|
@@ -7292,7 +7465,7 @@ async function importSubagents(config, tool) {
|
|
|
7292
7465
|
}
|
|
7293
7466
|
|
|
7294
7467
|
// src/cli/commands/init.ts
|
|
7295
|
-
var
|
|
7468
|
+
var import_node_path60 = require("path");
|
|
7296
7469
|
async function initCommand() {
|
|
7297
7470
|
logger.info("Initializing rulesync...");
|
|
7298
7471
|
await ensureDir(".rulesync");
|
|
@@ -7319,7 +7492,8 @@ async function createConfigFile() {
|
|
|
7319
7492
|
verbose: false,
|
|
7320
7493
|
global: false,
|
|
7321
7494
|
simulatedCommands: false,
|
|
7322
|
-
simulatedSubagents: false
|
|
7495
|
+
simulatedSubagents: false,
|
|
7496
|
+
modularMcp: false
|
|
7323
7497
|
},
|
|
7324
7498
|
null,
|
|
7325
7499
|
2
|
|
@@ -7452,14 +7626,14 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
7452
7626
|
await ensureDir(commandPaths.relativeDirPath);
|
|
7453
7627
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
7454
7628
|
await ensureDir(ignorePaths.relativeDirPath);
|
|
7455
|
-
const ruleFilepath = (0,
|
|
7629
|
+
const ruleFilepath = (0, import_node_path60.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
7456
7630
|
if (!await fileExists(ruleFilepath)) {
|
|
7457
7631
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
7458
7632
|
logger.success(`Created ${ruleFilepath}`);
|
|
7459
7633
|
} else {
|
|
7460
7634
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
7461
7635
|
}
|
|
7462
|
-
const mcpFilepath = (0,
|
|
7636
|
+
const mcpFilepath = (0, import_node_path60.join)(
|
|
7463
7637
|
mcpPaths.recommended.relativeDirPath,
|
|
7464
7638
|
mcpPaths.recommended.relativeFilePath
|
|
7465
7639
|
);
|
|
@@ -7469,21 +7643,21 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
7469
7643
|
} else {
|
|
7470
7644
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
7471
7645
|
}
|
|
7472
|
-
const commandFilepath = (0,
|
|
7646
|
+
const commandFilepath = (0, import_node_path60.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
7473
7647
|
if (!await fileExists(commandFilepath)) {
|
|
7474
7648
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
7475
7649
|
logger.success(`Created ${commandFilepath}`);
|
|
7476
7650
|
} else {
|
|
7477
7651
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
7478
7652
|
}
|
|
7479
|
-
const subagentFilepath = (0,
|
|
7653
|
+
const subagentFilepath = (0, import_node_path60.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
7480
7654
|
if (!await fileExists(subagentFilepath)) {
|
|
7481
7655
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
7482
7656
|
logger.success(`Created ${subagentFilepath}`);
|
|
7483
7657
|
} else {
|
|
7484
7658
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
7485
7659
|
}
|
|
7486
|
-
const ignoreFilepath = (0,
|
|
7660
|
+
const ignoreFilepath = (0, import_node_path60.join)(ignorePaths.relativeDirPath, ignorePaths.relativeFilePath);
|
|
7487
7661
|
if (!await fileExists(ignoreFilepath)) {
|
|
7488
7662
|
await writeFileContent(ignoreFilepath, sampleIgnoreFile.content);
|
|
7489
7663
|
logger.success(`Created ${ignoreFilepath}`);
|
|
@@ -7493,7 +7667,7 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
7493
7667
|
}
|
|
7494
7668
|
|
|
7495
7669
|
// src/cli/index.ts
|
|
7496
|
-
var getVersion = () => "3.
|
|
7670
|
+
var getVersion = () => "3.12.0";
|
|
7497
7671
|
var main = async () => {
|
|
7498
7672
|
const program = new import_commander.Command();
|
|
7499
7673
|
const version = getVersion();
|
|
@@ -7565,6 +7739,9 @@ var main = async () => {
|
|
|
7565
7739
|
).option(
|
|
7566
7740
|
"--experimental-simulate-subagents",
|
|
7567
7741
|
"Generate simulated subagents (deprecated: use --simulated-subagents instead)"
|
|
7742
|
+
).option(
|
|
7743
|
+
"--modular-mcp",
|
|
7744
|
+
"Generate modular-mcp configuration for context compression (experimental)"
|
|
7568
7745
|
).action(async (options) => {
|
|
7569
7746
|
try {
|
|
7570
7747
|
await generateCommand({
|
|
@@ -7577,6 +7754,7 @@ var main = async () => {
|
|
|
7577
7754
|
global: options.global,
|
|
7578
7755
|
simulatedCommands: options.simulatedCommands,
|
|
7579
7756
|
simulatedSubagents: options.simulatedSubagents,
|
|
7757
|
+
modularMcp: options.modularMcp,
|
|
7580
7758
|
experimentalGlobal: options.experimentalGlobal,
|
|
7581
7759
|
experimentalSimulateCommands: options.experimentalSimulateCommands,
|
|
7582
7760
|
experimentalSimulateSubagents: options.experimentalSimulateSubagents
|