rulesync 3.1.1 → 3.3.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 +2 -2
- package/dist/index.cjs +372 -190
- package/dist/index.js +362 -180
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -110,6 +110,15 @@ async function ensureDir(dirPath) {
|
|
|
110
110
|
await (0, import_promises.mkdir)(dirPath, { recursive: true });
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
+
async function readOrInitializeFileContent(filePath, initialContent = "") {
|
|
114
|
+
if (await fileExists(filePath)) {
|
|
115
|
+
return await readFileContent(filePath);
|
|
116
|
+
} else {
|
|
117
|
+
await ensureDir((0, import_node_path.dirname)(filePath));
|
|
118
|
+
await writeFileContent(filePath, initialContent);
|
|
119
|
+
return initialContent;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
113
122
|
async function directoryExists(dirPath) {
|
|
114
123
|
try {
|
|
115
124
|
const stats = await (0, import_promises.stat)(dirPath);
|
|
@@ -2524,11 +2533,11 @@ var McpServerBaseSchema = import_mini10.z.object({
|
|
|
2524
2533
|
kiroAutoBlock: import_mini10.z.optional(import_mini10.z.array(import_mini10.z.string())),
|
|
2525
2534
|
headers: import_mini10.z.optional(import_mini10.z.record(import_mini10.z.string(), import_mini10.z.string()))
|
|
2526
2535
|
});
|
|
2527
|
-
var
|
|
2536
|
+
var RulesyncMcpServersSchema = import_mini10.z.extend(McpServerBaseSchema, {
|
|
2528
2537
|
targets: import_mini10.z.optional(RulesyncTargetsSchema)
|
|
2529
2538
|
});
|
|
2530
2539
|
var RulesyncMcpConfigSchema = import_mini10.z.object({
|
|
2531
|
-
mcpServers: import_mini10.z.record(import_mini10.z.string(),
|
|
2540
|
+
mcpServers: import_mini10.z.record(import_mini10.z.string(), RulesyncMcpServersSchema)
|
|
2532
2541
|
});
|
|
2533
2542
|
var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
2534
2543
|
json;
|
|
@@ -2570,14 +2579,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
2570
2579
|
|
|
2571
2580
|
// src/mcp/tool-mcp.ts
|
|
2572
2581
|
var ToolMcp = class extends ToolFile {
|
|
2573
|
-
json;
|
|
2574
2582
|
constructor({ ...rest }) {
|
|
2575
2583
|
super({
|
|
2576
2584
|
...rest,
|
|
2577
2585
|
validate: true
|
|
2578
2586
|
// Skip validation during construction
|
|
2579
2587
|
});
|
|
2580
|
-
this.json = JSON.parse(this.fileContent);
|
|
2581
2588
|
if (rest.validate) {
|
|
2582
2589
|
const result = this.validate();
|
|
2583
2590
|
if (!result.success) {
|
|
@@ -2585,18 +2592,20 @@ var ToolMcp = class extends ToolFile {
|
|
|
2585
2592
|
}
|
|
2586
2593
|
}
|
|
2587
2594
|
}
|
|
2588
|
-
getJson() {
|
|
2589
|
-
return this.json;
|
|
2590
|
-
}
|
|
2591
2595
|
static getSettablePaths() {
|
|
2592
2596
|
throw new Error("Please implement this method in the subclass.");
|
|
2593
2597
|
}
|
|
2594
|
-
|
|
2598
|
+
static getToolTargetsGlobal() {
|
|
2599
|
+
throw new Error("Please implement this method in the subclass.");
|
|
2600
|
+
}
|
|
2601
|
+
toRulesyncMcpDefault({
|
|
2602
|
+
fileContent = void 0
|
|
2603
|
+
} = {}) {
|
|
2595
2604
|
return new RulesyncMcp({
|
|
2596
2605
|
baseDir: this.baseDir,
|
|
2597
2606
|
relativeDirPath: ".rulesync",
|
|
2598
2607
|
relativeFilePath: ".mcp.json",
|
|
2599
|
-
fileContent: this.fileContent
|
|
2608
|
+
fileContent: fileContent ?? this.fileContent
|
|
2600
2609
|
});
|
|
2601
2610
|
}
|
|
2602
2611
|
static async fromFile(_params) {
|
|
@@ -2609,6 +2618,14 @@ var ToolMcp = class extends ToolFile {
|
|
|
2609
2618
|
|
|
2610
2619
|
// src/mcp/amazonqcli-mcp.ts
|
|
2611
2620
|
var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
2621
|
+
json;
|
|
2622
|
+
constructor(params) {
|
|
2623
|
+
super(params);
|
|
2624
|
+
this.json = this.fileContent !== void 0 ? JSON.parse(this.fileContent) : {};
|
|
2625
|
+
}
|
|
2626
|
+
getJson() {
|
|
2627
|
+
return this.json;
|
|
2628
|
+
}
|
|
2612
2629
|
static getSettablePaths() {
|
|
2613
2630
|
return {
|
|
2614
2631
|
relativeDirPath: ".amazonq",
|
|
@@ -2658,46 +2675,71 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
2658
2675
|
// src/mcp/claudecode-mcp.ts
|
|
2659
2676
|
var import_node_path27 = require("path");
|
|
2660
2677
|
var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
2678
|
+
json;
|
|
2679
|
+
constructor(params) {
|
|
2680
|
+
super(params);
|
|
2681
|
+
this.json = JSON.parse(this.fileContent || "{}");
|
|
2682
|
+
}
|
|
2683
|
+
getJson() {
|
|
2684
|
+
return this.json;
|
|
2685
|
+
}
|
|
2661
2686
|
static getSettablePaths() {
|
|
2662
2687
|
return {
|
|
2663
2688
|
relativeDirPath: ".",
|
|
2664
2689
|
relativeFilePath: ".mcp.json"
|
|
2665
2690
|
};
|
|
2666
2691
|
}
|
|
2692
|
+
static getSettablePathsGlobal() {
|
|
2693
|
+
return {
|
|
2694
|
+
relativeDirPath: ".claude",
|
|
2695
|
+
relativeFilePath: ".claude.json"
|
|
2696
|
+
};
|
|
2697
|
+
}
|
|
2667
2698
|
static async fromFile({
|
|
2668
2699
|
baseDir = ".",
|
|
2669
|
-
validate = true
|
|
2700
|
+
validate = true,
|
|
2701
|
+
global = false
|
|
2670
2702
|
}) {
|
|
2671
|
-
const
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
this.getSettablePaths().relativeFilePath
|
|
2676
|
-
)
|
|
2703
|
+
const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
|
|
2704
|
+
const fileContent = await readOrInitializeFileContent(
|
|
2705
|
+
(0, import_node_path27.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
2706
|
+
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
2677
2707
|
);
|
|
2708
|
+
const json = JSON.parse(fileContent);
|
|
2709
|
+
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
2678
2710
|
return new _ClaudecodeMcp({
|
|
2679
2711
|
baseDir,
|
|
2680
|
-
relativeDirPath:
|
|
2681
|
-
relativeFilePath:
|
|
2682
|
-
fileContent,
|
|
2712
|
+
relativeDirPath: paths.relativeDirPath,
|
|
2713
|
+
relativeFilePath: paths.relativeFilePath,
|
|
2714
|
+
fileContent: JSON.stringify(newJson, null, 2),
|
|
2683
2715
|
validate
|
|
2684
2716
|
});
|
|
2685
2717
|
}
|
|
2686
|
-
static fromRulesyncMcp({
|
|
2718
|
+
static async fromRulesyncMcp({
|
|
2687
2719
|
baseDir = ".",
|
|
2688
2720
|
rulesyncMcp,
|
|
2689
|
-
validate = true
|
|
2721
|
+
validate = true,
|
|
2722
|
+
global = false
|
|
2690
2723
|
}) {
|
|
2724
|
+
const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
|
|
2725
|
+
const fileContent = await readOrInitializeFileContent(
|
|
2726
|
+
(0, import_node_path27.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
2727
|
+
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
2728
|
+
);
|
|
2729
|
+
const json = JSON.parse(fileContent);
|
|
2730
|
+
const newJson = { ...json, mcpServers: rulesyncMcp.getJson().mcpServers };
|
|
2691
2731
|
return new _ClaudecodeMcp({
|
|
2692
2732
|
baseDir,
|
|
2693
|
-
relativeDirPath:
|
|
2694
|
-
relativeFilePath:
|
|
2695
|
-
fileContent:
|
|
2733
|
+
relativeDirPath: paths.relativeDirPath,
|
|
2734
|
+
relativeFilePath: paths.relativeFilePath,
|
|
2735
|
+
fileContent: JSON.stringify(newJson, null, 2),
|
|
2696
2736
|
validate
|
|
2697
2737
|
});
|
|
2698
2738
|
}
|
|
2699
2739
|
toRulesyncMcp() {
|
|
2700
|
-
return this.toRulesyncMcpDefault(
|
|
2740
|
+
return this.toRulesyncMcpDefault({
|
|
2741
|
+
fileContent: JSON.stringify({ mcpServers: this.json.mcpServers }, null, 2)
|
|
2742
|
+
});
|
|
2701
2743
|
}
|
|
2702
2744
|
validate() {
|
|
2703
2745
|
return { success: true, error: null };
|
|
@@ -2707,6 +2749,14 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
2707
2749
|
// src/mcp/cline-mcp.ts
|
|
2708
2750
|
var import_node_path28 = require("path");
|
|
2709
2751
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
2752
|
+
json;
|
|
2753
|
+
constructor(params) {
|
|
2754
|
+
super(params);
|
|
2755
|
+
this.json = this.fileContent !== void 0 ? JSON.parse(this.fileContent) : {};
|
|
2756
|
+
}
|
|
2757
|
+
getJson() {
|
|
2758
|
+
return this.json;
|
|
2759
|
+
}
|
|
2710
2760
|
static getSettablePaths() {
|
|
2711
2761
|
return {
|
|
2712
2762
|
relativeDirPath: ".cline",
|
|
@@ -2753,9 +2803,111 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
2753
2803
|
}
|
|
2754
2804
|
};
|
|
2755
2805
|
|
|
2756
|
-
// src/mcp/
|
|
2806
|
+
// src/mcp/codexcli-mcp.ts
|
|
2757
2807
|
var import_node_path29 = require("path");
|
|
2808
|
+
var smolToml = __toESM(require("smol-toml"), 1);
|
|
2809
|
+
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
2810
|
+
toml;
|
|
2811
|
+
constructor({ ...rest }) {
|
|
2812
|
+
super({
|
|
2813
|
+
...rest,
|
|
2814
|
+
validate: false
|
|
2815
|
+
});
|
|
2816
|
+
this.toml = smolToml.parse(this.fileContent);
|
|
2817
|
+
if (rest.validate) {
|
|
2818
|
+
const result = this.validate();
|
|
2819
|
+
if (!result.success) {
|
|
2820
|
+
throw result.error;
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
getToml() {
|
|
2825
|
+
return this.toml;
|
|
2826
|
+
}
|
|
2827
|
+
static getSettablePaths() {
|
|
2828
|
+
throw new Error("getSettablePaths is not supported for CodexcliMcp");
|
|
2829
|
+
}
|
|
2830
|
+
static getSettablePathsGlobal() {
|
|
2831
|
+
return {
|
|
2832
|
+
relativeDirPath: ".codex",
|
|
2833
|
+
relativeFilePath: "config.toml"
|
|
2834
|
+
};
|
|
2835
|
+
}
|
|
2836
|
+
static async fromFile({
|
|
2837
|
+
baseDir = ".",
|
|
2838
|
+
validate = true,
|
|
2839
|
+
global = false
|
|
2840
|
+
}) {
|
|
2841
|
+
const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
|
|
2842
|
+
const fileContent = await readFileContent(
|
|
2843
|
+
(0, import_node_path29.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
2844
|
+
);
|
|
2845
|
+
return new _CodexcliMcp({
|
|
2846
|
+
baseDir,
|
|
2847
|
+
relativeDirPath: paths.relativeDirPath,
|
|
2848
|
+
relativeFilePath: paths.relativeFilePath,
|
|
2849
|
+
fileContent,
|
|
2850
|
+
validate
|
|
2851
|
+
});
|
|
2852
|
+
}
|
|
2853
|
+
static async fromRulesyncMcp({
|
|
2854
|
+
baseDir = ".",
|
|
2855
|
+
rulesyncMcp,
|
|
2856
|
+
validate = true,
|
|
2857
|
+
global = false
|
|
2858
|
+
}) {
|
|
2859
|
+
const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
|
|
2860
|
+
const configTomlFilePath = (0, import_node_path29.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
2861
|
+
const configTomlFileContent = await readOrInitializeFileContent(
|
|
2862
|
+
configTomlFilePath,
|
|
2863
|
+
smolToml.stringify({})
|
|
2864
|
+
);
|
|
2865
|
+
const configToml = smolToml.parse(configTomlFileContent);
|
|
2866
|
+
const mcpServers = rulesyncMcp.getJson().mcpServers;
|
|
2867
|
+
const filteredMcpServers = this.removeEmptyEntries(mcpServers);
|
|
2868
|
+
configToml["mcp_servers"] = filteredMcpServers;
|
|
2869
|
+
return new _CodexcliMcp({
|
|
2870
|
+
baseDir,
|
|
2871
|
+
relativeDirPath: paths.relativeDirPath,
|
|
2872
|
+
relativeFilePath: paths.relativeFilePath,
|
|
2873
|
+
fileContent: smolToml.stringify(configToml),
|
|
2874
|
+
validate
|
|
2875
|
+
});
|
|
2876
|
+
}
|
|
2877
|
+
toRulesyncMcp() {
|
|
2878
|
+
return new RulesyncMcp({
|
|
2879
|
+
baseDir: this.baseDir,
|
|
2880
|
+
relativeDirPath: ".rulesync",
|
|
2881
|
+
relativeFilePath: ".mcp.json",
|
|
2882
|
+
fileContent: JSON.stringify({ mcpServers: this.toml.mcp_servers ?? {} }, null, 2)
|
|
2883
|
+
});
|
|
2884
|
+
}
|
|
2885
|
+
validate() {
|
|
2886
|
+
return { success: true, error: null };
|
|
2887
|
+
}
|
|
2888
|
+
static removeEmptyEntries(obj) {
|
|
2889
|
+
if (!obj) return {};
|
|
2890
|
+
const filtered = {};
|
|
2891
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
2892
|
+
if (value === null) continue;
|
|
2893
|
+
if (typeof value === "object" && Object.keys(value).length === 0) continue;
|
|
2894
|
+
filtered[key] = value;
|
|
2895
|
+
}
|
|
2896
|
+
return filtered;
|
|
2897
|
+
}
|
|
2898
|
+
};
|
|
2899
|
+
|
|
2900
|
+
// src/mcp/copilot-mcp.ts
|
|
2901
|
+
var import_node_path30 = require("path");
|
|
2758
2902
|
var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
2903
|
+
json;
|
|
2904
|
+
constructor(params) {
|
|
2905
|
+
super(params);
|
|
2906
|
+
this.json = this.fileContent !== void 0 ? JSON.parse(this.fileContent) : {};
|
|
2907
|
+
}
|
|
2908
|
+
getJson() {
|
|
2909
|
+
return this.json;
|
|
2910
|
+
}
|
|
2759
2911
|
static getSettablePaths() {
|
|
2760
2912
|
return {
|
|
2761
2913
|
relativeDirPath: ".vscode",
|
|
@@ -2767,7 +2919,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
2767
2919
|
validate = true
|
|
2768
2920
|
}) {
|
|
2769
2921
|
const fileContent = await readFileContent(
|
|
2770
|
-
(0,
|
|
2922
|
+
(0, import_node_path30.join)(
|
|
2771
2923
|
baseDir,
|
|
2772
2924
|
this.getSettablePaths().relativeDirPath,
|
|
2773
2925
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2803,8 +2955,16 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
2803
2955
|
};
|
|
2804
2956
|
|
|
2805
2957
|
// src/mcp/cursor-mcp.ts
|
|
2806
|
-
var
|
|
2958
|
+
var import_node_path31 = require("path");
|
|
2807
2959
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
2960
|
+
json;
|
|
2961
|
+
constructor(params) {
|
|
2962
|
+
super(params);
|
|
2963
|
+
this.json = this.fileContent !== void 0 ? JSON.parse(this.fileContent) : {};
|
|
2964
|
+
}
|
|
2965
|
+
getJson() {
|
|
2966
|
+
return this.json;
|
|
2967
|
+
}
|
|
2808
2968
|
static getSettablePaths() {
|
|
2809
2969
|
return {
|
|
2810
2970
|
relativeDirPath: ".cursor",
|
|
@@ -2816,7 +2976,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
2816
2976
|
validate = true
|
|
2817
2977
|
}) {
|
|
2818
2978
|
const fileContent = await readFileContent(
|
|
2819
|
-
(0,
|
|
2979
|
+
(0, import_node_path31.join)(
|
|
2820
2980
|
baseDir,
|
|
2821
2981
|
this.getSettablePaths().relativeDirPath,
|
|
2822
2982
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2863,8 +3023,16 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
2863
3023
|
};
|
|
2864
3024
|
|
|
2865
3025
|
// src/mcp/roo-mcp.ts
|
|
2866
|
-
var
|
|
3026
|
+
var import_node_path32 = require("path");
|
|
2867
3027
|
var RooMcp = class _RooMcp extends ToolMcp {
|
|
3028
|
+
json;
|
|
3029
|
+
constructor(params) {
|
|
3030
|
+
super(params);
|
|
3031
|
+
this.json = this.fileContent !== void 0 ? JSON.parse(this.fileContent) : {};
|
|
3032
|
+
}
|
|
3033
|
+
getJson() {
|
|
3034
|
+
return this.json;
|
|
3035
|
+
}
|
|
2868
3036
|
static getSettablePaths() {
|
|
2869
3037
|
return {
|
|
2870
3038
|
relativeDirPath: ".roo",
|
|
@@ -2876,7 +3044,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
2876
3044
|
validate = true
|
|
2877
3045
|
}) {
|
|
2878
3046
|
const fileContent = await readFileContent(
|
|
2879
|
-
(0,
|
|
3047
|
+
(0, import_node_path32.join)(
|
|
2880
3048
|
baseDir,
|
|
2881
3049
|
this.getSettablePaths().relativeDirPath,
|
|
2882
3050
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2921,15 +3089,22 @@ var mcpProcessorToolTargets = [
|
|
|
2921
3089
|
"cursor",
|
|
2922
3090
|
"roo"
|
|
2923
3091
|
];
|
|
2924
|
-
var McpProcessorToolTargetSchema = import_mini11.z.enum(
|
|
3092
|
+
var McpProcessorToolTargetSchema = import_mini11.z.enum(
|
|
3093
|
+
// codexcli is not in the list of tool targets but we add it here because it is a valid tool target for global mode generation
|
|
3094
|
+
mcpProcessorToolTargets.concat("codexcli")
|
|
3095
|
+
);
|
|
3096
|
+
var mcpProcessorToolTargetsGlobal = ["claudecode", "codexcli"];
|
|
2925
3097
|
var McpProcessor = class extends FeatureProcessor {
|
|
2926
3098
|
toolTarget;
|
|
3099
|
+
global;
|
|
2927
3100
|
constructor({
|
|
2928
3101
|
baseDir = ".",
|
|
2929
|
-
toolTarget
|
|
3102
|
+
toolTarget,
|
|
3103
|
+
global = false
|
|
2930
3104
|
}) {
|
|
2931
3105
|
super({ baseDir });
|
|
2932
3106
|
this.toolTarget = McpProcessorToolTargetSchema.parse(toolTarget);
|
|
3107
|
+
this.global = global;
|
|
2933
3108
|
}
|
|
2934
3109
|
/**
|
|
2935
3110
|
* Implementation of abstract method from FeatureProcessor
|
|
@@ -2944,6 +3119,11 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
2944
3119
|
}
|
|
2945
3120
|
}
|
|
2946
3121
|
async loadToolFilesToDelete() {
|
|
3122
|
+
if (this.global) {
|
|
3123
|
+
return (await this.loadToolFiles()).filter(
|
|
3124
|
+
(toolFile) => !(toolFile instanceof ClaudecodeMcp)
|
|
3125
|
+
);
|
|
3126
|
+
}
|
|
2947
3127
|
return this.loadToolFiles();
|
|
2948
3128
|
}
|
|
2949
3129
|
/**
|
|
@@ -2966,7 +3146,8 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
2966
3146
|
return [
|
|
2967
3147
|
await ClaudecodeMcp.fromFile({
|
|
2968
3148
|
baseDir: this.baseDir,
|
|
2969
|
-
validate: true
|
|
3149
|
+
validate: true,
|
|
3150
|
+
global: this.global
|
|
2970
3151
|
})
|
|
2971
3152
|
];
|
|
2972
3153
|
}
|
|
@@ -2978,6 +3159,15 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
2978
3159
|
})
|
|
2979
3160
|
];
|
|
2980
3161
|
}
|
|
3162
|
+
case "codexcli": {
|
|
3163
|
+
return [
|
|
3164
|
+
await CodexcliMcp.fromFile({
|
|
3165
|
+
baseDir: this.baseDir,
|
|
3166
|
+
validate: true,
|
|
3167
|
+
global: this.global
|
|
3168
|
+
})
|
|
3169
|
+
];
|
|
3170
|
+
}
|
|
2981
3171
|
case "copilot": {
|
|
2982
3172
|
return [
|
|
2983
3173
|
await CopilotMcp.fromFile({
|
|
@@ -3024,42 +3214,51 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
3024
3214
|
if (!rulesyncMcp) {
|
|
3025
3215
|
throw new Error(`No .rulesync/.mcp.json found.`);
|
|
3026
3216
|
}
|
|
3027
|
-
const toolMcps =
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3217
|
+
const toolMcps = await Promise.all(
|
|
3218
|
+
[rulesyncMcp].map(async (rulesyncMcp2) => {
|
|
3219
|
+
switch (this.toolTarget) {
|
|
3220
|
+
case "amazonqcli":
|
|
3221
|
+
return AmazonqcliMcp.fromRulesyncMcp({
|
|
3222
|
+
baseDir: this.baseDir,
|
|
3223
|
+
rulesyncMcp: rulesyncMcp2
|
|
3224
|
+
});
|
|
3225
|
+
case "claudecode":
|
|
3226
|
+
return ClaudecodeMcp.fromRulesyncMcp({
|
|
3227
|
+
baseDir: this.baseDir,
|
|
3228
|
+
rulesyncMcp: rulesyncMcp2,
|
|
3229
|
+
global: this.global
|
|
3230
|
+
});
|
|
3231
|
+
case "cline":
|
|
3232
|
+
return ClineMcp.fromRulesyncMcp({
|
|
3233
|
+
baseDir: this.baseDir,
|
|
3234
|
+
rulesyncMcp: rulesyncMcp2
|
|
3235
|
+
});
|
|
3236
|
+
case "copilot":
|
|
3237
|
+
return CopilotMcp.fromRulesyncMcp({
|
|
3238
|
+
baseDir: this.baseDir,
|
|
3239
|
+
rulesyncMcp: rulesyncMcp2
|
|
3240
|
+
});
|
|
3241
|
+
case "cursor":
|
|
3242
|
+
return CursorMcp.fromRulesyncMcp({
|
|
3243
|
+
baseDir: this.baseDir,
|
|
3244
|
+
rulesyncMcp: rulesyncMcp2
|
|
3245
|
+
});
|
|
3246
|
+
case "codexcli":
|
|
3247
|
+
return await CodexcliMcp.fromRulesyncMcp({
|
|
3248
|
+
baseDir: this.baseDir,
|
|
3249
|
+
rulesyncMcp: rulesyncMcp2,
|
|
3250
|
+
global: this.global
|
|
3251
|
+
});
|
|
3252
|
+
case "roo":
|
|
3253
|
+
return RooMcp.fromRulesyncMcp({
|
|
3254
|
+
baseDir: this.baseDir,
|
|
3255
|
+
rulesyncMcp: rulesyncMcp2
|
|
3256
|
+
});
|
|
3257
|
+
default:
|
|
3258
|
+
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
3259
|
+
}
|
|
3260
|
+
})
|
|
3261
|
+
);
|
|
3063
3262
|
return toolMcps;
|
|
3064
3263
|
}
|
|
3065
3264
|
/**
|
|
@@ -3080,15 +3279,18 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
3080
3279
|
static getToolTargets() {
|
|
3081
3280
|
return mcpProcessorToolTargets;
|
|
3082
3281
|
}
|
|
3282
|
+
static getToolTargetsGlobal() {
|
|
3283
|
+
return mcpProcessorToolTargetsGlobal;
|
|
3284
|
+
}
|
|
3083
3285
|
};
|
|
3084
3286
|
|
|
3085
3287
|
// src/rules/rules-processor.ts
|
|
3086
|
-
var
|
|
3288
|
+
var import_node_path56 = require("path");
|
|
3087
3289
|
var import_fast_xml_parser = require("fast-xml-parser");
|
|
3088
3290
|
var import_mini20 = require("zod/mini");
|
|
3089
3291
|
|
|
3090
3292
|
// src/subagents/simulated-subagent.ts
|
|
3091
|
-
var
|
|
3293
|
+
var import_node_path33 = require("path");
|
|
3092
3294
|
var import_mini12 = require("zod/mini");
|
|
3093
3295
|
|
|
3094
3296
|
// src/subagents/tool-subagent.ts
|
|
@@ -3190,7 +3392,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
3190
3392
|
relativeFilePath,
|
|
3191
3393
|
validate = true
|
|
3192
3394
|
}) {
|
|
3193
|
-
const filePath = (0,
|
|
3395
|
+
const filePath = (0, import_node_path33.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
3194
3396
|
const fileContent = await readFileContent(filePath);
|
|
3195
3397
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3196
3398
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -3200,7 +3402,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
3200
3402
|
return {
|
|
3201
3403
|
baseDir,
|
|
3202
3404
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
3203
|
-
relativeFilePath: (0,
|
|
3405
|
+
relativeFilePath: (0, import_node_path33.basename)(relativeFilePath),
|
|
3204
3406
|
frontmatter: result.data,
|
|
3205
3407
|
body: content.trim(),
|
|
3206
3408
|
validate
|
|
@@ -3347,15 +3549,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
3347
3549
|
};
|
|
3348
3550
|
|
|
3349
3551
|
// src/subagents/subagents-processor.ts
|
|
3350
|
-
var
|
|
3552
|
+
var import_node_path36 = require("path");
|
|
3351
3553
|
var import_mini15 = require("zod/mini");
|
|
3352
3554
|
|
|
3353
3555
|
// src/subagents/claudecode-subagent.ts
|
|
3354
|
-
var
|
|
3556
|
+
var import_node_path35 = require("path");
|
|
3355
3557
|
var import_mini14 = require("zod/mini");
|
|
3356
3558
|
|
|
3357
3559
|
// src/subagents/rulesync-subagent.ts
|
|
3358
|
-
var
|
|
3560
|
+
var import_node_path34 = require("path");
|
|
3359
3561
|
var import_mini13 = require("zod/mini");
|
|
3360
3562
|
var RulesyncSubagentModelSchema = import_mini13.z.enum(["opus", "sonnet", "haiku", "inherit"]);
|
|
3361
3563
|
var RulesyncSubagentFrontmatterSchema = import_mini13.z.object({
|
|
@@ -3409,13 +3611,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
3409
3611
|
static async fromFile({
|
|
3410
3612
|
relativeFilePath
|
|
3411
3613
|
}) {
|
|
3412
|
-
const fileContent = await readFileContent((0,
|
|
3614
|
+
const fileContent = await readFileContent((0, import_node_path34.join)(".rulesync/subagents", relativeFilePath));
|
|
3413
3615
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3414
3616
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
3415
3617
|
if (!result.success) {
|
|
3416
3618
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${result.error.message}`);
|
|
3417
3619
|
}
|
|
3418
|
-
const filename = (0,
|
|
3620
|
+
const filename = (0, import_node_path34.basename)(relativeFilePath);
|
|
3419
3621
|
return new _RulesyncSubagent({
|
|
3420
3622
|
baseDir: ".",
|
|
3421
3623
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -3527,7 +3729,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
3527
3729
|
relativeFilePath,
|
|
3528
3730
|
validate = true
|
|
3529
3731
|
}) {
|
|
3530
|
-
const fileContent = await readFileContent((0,
|
|
3732
|
+
const fileContent = await readFileContent((0, import_node_path35.join)(baseDir, ".claude/agents", relativeFilePath));
|
|
3531
3733
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3532
3734
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
3533
3735
|
if (!result.success) {
|
|
@@ -3669,7 +3871,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3669
3871
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
3670
3872
|
*/
|
|
3671
3873
|
async loadRulesyncFiles() {
|
|
3672
|
-
const subagentsDir = (0,
|
|
3874
|
+
const subagentsDir = (0, import_node_path36.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
3673
3875
|
const dirExists = await directoryExists(subagentsDir);
|
|
3674
3876
|
if (!dirExists) {
|
|
3675
3877
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -3684,7 +3886,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3684
3886
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
3685
3887
|
const rulesyncSubagents = [];
|
|
3686
3888
|
for (const mdFile of mdFiles) {
|
|
3687
|
-
const filepath = (0,
|
|
3889
|
+
const filepath = (0, import_node_path36.join)(subagentsDir, mdFile);
|
|
3688
3890
|
try {
|
|
3689
3891
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
3690
3892
|
relativeFilePath: mdFile,
|
|
@@ -3798,8 +4000,8 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3798
4000
|
relativeDirPath,
|
|
3799
4001
|
fromFile
|
|
3800
4002
|
}) {
|
|
3801
|
-
const paths = await findFilesByGlobs((0,
|
|
3802
|
-
const subagents = (await Promise.allSettled(paths.map((path2) => fromFile((0,
|
|
4003
|
+
const paths = await findFilesByGlobs((0, import_node_path36.join)(this.baseDir, relativeDirPath, "*.md"));
|
|
4004
|
+
const subagents = (await Promise.allSettled(paths.map((path2) => fromFile((0, import_node_path36.basename)(path2))))).filter((r) => r.status === "fulfilled").map((r) => r.value);
|
|
3803
4005
|
logger.info(`Successfully loaded ${subagents.length} ${relativeDirPath} subagents`);
|
|
3804
4006
|
return subagents;
|
|
3805
4007
|
}
|
|
@@ -3823,13 +4025,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3823
4025
|
};
|
|
3824
4026
|
|
|
3825
4027
|
// src/rules/agentsmd-rule.ts
|
|
3826
|
-
var
|
|
4028
|
+
var import_node_path39 = require("path");
|
|
3827
4029
|
|
|
3828
4030
|
// src/rules/tool-rule.ts
|
|
3829
|
-
var
|
|
4031
|
+
var import_node_path38 = require("path");
|
|
3830
4032
|
|
|
3831
4033
|
// src/rules/rulesync-rule.ts
|
|
3832
|
-
var
|
|
4034
|
+
var import_node_path37 = require("path");
|
|
3833
4035
|
var import_mini16 = require("zod/mini");
|
|
3834
4036
|
var RulesyncRuleFrontmatterSchema = import_mini16.z.object({
|
|
3835
4037
|
root: import_mini16.z.optional(import_mini16.z.optional(import_mini16.z.boolean())),
|
|
@@ -3895,7 +4097,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3895
4097
|
relativeFilePath,
|
|
3896
4098
|
validate = true
|
|
3897
4099
|
}) {
|
|
3898
|
-
const filePath = (0,
|
|
4100
|
+
const filePath = (0, import_node_path37.join)(this.getSettablePaths().legacy.relativeDirPath, relativeFilePath);
|
|
3899
4101
|
const fileContent = await readFileContent(filePath);
|
|
3900
4102
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3901
4103
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -3910,7 +4112,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3910
4112
|
agentsmd: result.data.agentsmd,
|
|
3911
4113
|
cursor: result.data.cursor
|
|
3912
4114
|
};
|
|
3913
|
-
const filename = (0,
|
|
4115
|
+
const filename = (0, import_node_path37.basename)(filePath);
|
|
3914
4116
|
return new _RulesyncRule({
|
|
3915
4117
|
baseDir: ".",
|
|
3916
4118
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -3924,7 +4126,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3924
4126
|
relativeFilePath,
|
|
3925
4127
|
validate = true
|
|
3926
4128
|
}) {
|
|
3927
|
-
const filePath = (0,
|
|
4129
|
+
const filePath = (0, import_node_path37.join)(this.getSettablePaths().recommended.relativeDirPath, relativeFilePath);
|
|
3928
4130
|
const fileContent = await readFileContent(filePath);
|
|
3929
4131
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3930
4132
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -3939,7 +4141,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3939
4141
|
agentsmd: result.data.agentsmd,
|
|
3940
4142
|
cursor: result.data.cursor
|
|
3941
4143
|
};
|
|
3942
|
-
const filename = (0,
|
|
4144
|
+
const filename = (0, import_node_path37.basename)(filePath);
|
|
3943
4145
|
return new _RulesyncRule({
|
|
3944
4146
|
baseDir: ".",
|
|
3945
4147
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -4028,7 +4230,7 @@ var ToolRule = class extends ToolFile {
|
|
|
4028
4230
|
});
|
|
4029
4231
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
4030
4232
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
4031
|
-
params.relativeDirPath = (0,
|
|
4233
|
+
params.relativeDirPath = (0, import_node_path38.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
4032
4234
|
params.relativeFilePath = "AGENTS.md";
|
|
4033
4235
|
}
|
|
4034
4236
|
return params;
|
|
@@ -4104,8 +4306,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
4104
4306
|
validate = true
|
|
4105
4307
|
}) {
|
|
4106
4308
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
4107
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
4108
|
-
const fileContent = await readFileContent((0,
|
|
4309
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path39.join)(".agents/memories", relativeFilePath);
|
|
4310
|
+
const fileContent = await readFileContent((0, import_node_path39.join)(baseDir, relativePath));
|
|
4109
4311
|
return new _AgentsMdRule({
|
|
4110
4312
|
baseDir,
|
|
4111
4313
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4145,7 +4347,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
4145
4347
|
};
|
|
4146
4348
|
|
|
4147
4349
|
// src/rules/amazonqcli-rule.ts
|
|
4148
|
-
var
|
|
4350
|
+
var import_node_path40 = require("path");
|
|
4149
4351
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
4150
4352
|
static getSettablePaths() {
|
|
4151
4353
|
return {
|
|
@@ -4160,7 +4362,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
4160
4362
|
validate = true
|
|
4161
4363
|
}) {
|
|
4162
4364
|
const fileContent = await readFileContent(
|
|
4163
|
-
(0,
|
|
4365
|
+
(0, import_node_path40.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4164
4366
|
);
|
|
4165
4367
|
return new _AmazonQCliRule({
|
|
4166
4368
|
baseDir,
|
|
@@ -4200,7 +4402,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
4200
4402
|
};
|
|
4201
4403
|
|
|
4202
4404
|
// src/rules/augmentcode-legacy-rule.ts
|
|
4203
|
-
var
|
|
4405
|
+
var import_node_path41 = require("path");
|
|
4204
4406
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
4205
4407
|
toRulesyncRule() {
|
|
4206
4408
|
const rulesyncFrontmatter = {
|
|
@@ -4261,8 +4463,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
4261
4463
|
}) {
|
|
4262
4464
|
const settablePaths = this.getSettablePaths();
|
|
4263
4465
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
4264
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
4265
|
-
const fileContent = await readFileContent((0,
|
|
4466
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path41.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
4467
|
+
const fileContent = await readFileContent((0, import_node_path41.join)(baseDir, relativePath));
|
|
4266
4468
|
return new _AugmentcodeLegacyRule({
|
|
4267
4469
|
baseDir,
|
|
4268
4470
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -4275,7 +4477,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
4275
4477
|
};
|
|
4276
4478
|
|
|
4277
4479
|
// src/rules/augmentcode-rule.ts
|
|
4278
|
-
var
|
|
4480
|
+
var import_node_path42 = require("path");
|
|
4279
4481
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
4280
4482
|
toRulesyncRule() {
|
|
4281
4483
|
return this.toRulesyncRuleDefault();
|
|
@@ -4307,7 +4509,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
4307
4509
|
validate = true
|
|
4308
4510
|
}) {
|
|
4309
4511
|
const fileContent = await readFileContent(
|
|
4310
|
-
(0,
|
|
4512
|
+
(0, import_node_path42.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4311
4513
|
);
|
|
4312
4514
|
const { body: content } = parseFrontmatter(fileContent);
|
|
4313
4515
|
return new _AugmentcodeRule({
|
|
@@ -4330,7 +4532,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
4330
4532
|
};
|
|
4331
4533
|
|
|
4332
4534
|
// src/rules/claudecode-rule.ts
|
|
4333
|
-
var
|
|
4535
|
+
var import_node_path43 = require("path");
|
|
4334
4536
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
4335
4537
|
static getSettablePaths() {
|
|
4336
4538
|
return {
|
|
@@ -4339,7 +4541,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
4339
4541
|
relativeFilePath: "CLAUDE.md"
|
|
4340
4542
|
},
|
|
4341
4543
|
nonRoot: {
|
|
4342
|
-
relativeDirPath: (0,
|
|
4544
|
+
relativeDirPath: (0, import_node_path43.join)(".claude", "memories")
|
|
4343
4545
|
}
|
|
4344
4546
|
};
|
|
4345
4547
|
}
|
|
@@ -4362,7 +4564,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
4362
4564
|
if (isRoot) {
|
|
4363
4565
|
const relativePath2 = paths.root.relativeFilePath;
|
|
4364
4566
|
const fileContent2 = await readFileContent(
|
|
4365
|
-
(0,
|
|
4567
|
+
(0, import_node_path43.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
4366
4568
|
);
|
|
4367
4569
|
return new _ClaudecodeRule({
|
|
4368
4570
|
baseDir,
|
|
@@ -4376,8 +4578,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
4376
4578
|
if (!paths.nonRoot) {
|
|
4377
4579
|
throw new Error("nonRoot path is not set");
|
|
4378
4580
|
}
|
|
4379
|
-
const relativePath = (0,
|
|
4380
|
-
const fileContent = await readFileContent((0,
|
|
4581
|
+
const relativePath = (0, import_node_path43.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
4582
|
+
const fileContent = await readFileContent((0, import_node_path43.join)(baseDir, relativePath));
|
|
4381
4583
|
return new _ClaudecodeRule({
|
|
4382
4584
|
baseDir,
|
|
4383
4585
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -4419,7 +4621,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
4419
4621
|
};
|
|
4420
4622
|
|
|
4421
4623
|
// src/rules/cline-rule.ts
|
|
4422
|
-
var
|
|
4624
|
+
var import_node_path44 = require("path");
|
|
4423
4625
|
var import_mini17 = require("zod/mini");
|
|
4424
4626
|
var ClineRuleFrontmatterSchema = import_mini17.z.object({
|
|
4425
4627
|
description: import_mini17.z.string()
|
|
@@ -4464,7 +4666,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
4464
4666
|
validate = true
|
|
4465
4667
|
}) {
|
|
4466
4668
|
const fileContent = await readFileContent(
|
|
4467
|
-
(0,
|
|
4669
|
+
(0, import_node_path44.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4468
4670
|
);
|
|
4469
4671
|
return new _ClineRule({
|
|
4470
4672
|
baseDir,
|
|
@@ -4477,7 +4679,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
4477
4679
|
};
|
|
4478
4680
|
|
|
4479
4681
|
// src/rules/codexcli-rule.ts
|
|
4480
|
-
var
|
|
4682
|
+
var import_node_path45 = require("path");
|
|
4481
4683
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
4482
4684
|
static getSettablePaths() {
|
|
4483
4685
|
return {
|
|
@@ -4509,7 +4711,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4509
4711
|
if (isRoot) {
|
|
4510
4712
|
const relativePath2 = paths.root.relativeFilePath;
|
|
4511
4713
|
const fileContent2 = await readFileContent(
|
|
4512
|
-
(0,
|
|
4714
|
+
(0, import_node_path45.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
4513
4715
|
);
|
|
4514
4716
|
return new _CodexcliRule({
|
|
4515
4717
|
baseDir,
|
|
@@ -4523,8 +4725,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4523
4725
|
if (!paths.nonRoot) {
|
|
4524
4726
|
throw new Error("nonRoot path is not set");
|
|
4525
4727
|
}
|
|
4526
|
-
const relativePath = (0,
|
|
4527
|
-
const fileContent = await readFileContent((0,
|
|
4728
|
+
const relativePath = (0, import_node_path45.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
4729
|
+
const fileContent = await readFileContent((0, import_node_path45.join)(baseDir, relativePath));
|
|
4528
4730
|
return new _CodexcliRule({
|
|
4529
4731
|
baseDir,
|
|
4530
4732
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -4566,7 +4768,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4566
4768
|
};
|
|
4567
4769
|
|
|
4568
4770
|
// src/rules/copilot-rule.ts
|
|
4569
|
-
var
|
|
4771
|
+
var import_node_path46 = require("path");
|
|
4570
4772
|
var import_mini18 = require("zod/mini");
|
|
4571
4773
|
var CopilotRuleFrontmatterSchema = import_mini18.z.object({
|
|
4572
4774
|
description: import_mini18.z.optional(import_mini18.z.string()),
|
|
@@ -4659,11 +4861,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4659
4861
|
validate = true
|
|
4660
4862
|
}) {
|
|
4661
4863
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
4662
|
-
const relativePath = isRoot ? (0,
|
|
4864
|
+
const relativePath = isRoot ? (0, import_node_path46.join)(
|
|
4663
4865
|
this.getSettablePaths().root.relativeDirPath,
|
|
4664
4866
|
this.getSettablePaths().root.relativeFilePath
|
|
4665
|
-
) : (0,
|
|
4666
|
-
const fileContent = await readFileContent((0,
|
|
4867
|
+
) : (0, import_node_path46.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4868
|
+
const fileContent = await readFileContent((0, import_node_path46.join)(baseDir, relativePath));
|
|
4667
4869
|
if (isRoot) {
|
|
4668
4870
|
return new _CopilotRule({
|
|
4669
4871
|
baseDir,
|
|
@@ -4682,7 +4884,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4682
4884
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
4683
4885
|
if (!result.success) {
|
|
4684
4886
|
throw new Error(
|
|
4685
|
-
`Invalid frontmatter in ${(0,
|
|
4887
|
+
`Invalid frontmatter in ${(0, import_node_path46.join)(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
4686
4888
|
);
|
|
4687
4889
|
}
|
|
4688
4890
|
return new _CopilotRule({
|
|
@@ -4721,7 +4923,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4721
4923
|
};
|
|
4722
4924
|
|
|
4723
4925
|
// src/rules/cursor-rule.ts
|
|
4724
|
-
var
|
|
4926
|
+
var import_node_path47 = require("path");
|
|
4725
4927
|
var import_mini19 = require("zod/mini");
|
|
4726
4928
|
var CursorRuleFrontmatterSchema = import_mini19.z.object({
|
|
4727
4929
|
description: import_mini19.z.optional(import_mini19.z.string()),
|
|
@@ -4848,19 +5050,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
4848
5050
|
validate = true
|
|
4849
5051
|
}) {
|
|
4850
5052
|
const fileContent = await readFileContent(
|
|
4851
|
-
(0,
|
|
5053
|
+
(0, import_node_path47.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4852
5054
|
);
|
|
4853
5055
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
4854
5056
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
4855
5057
|
if (!result.success) {
|
|
4856
5058
|
throw new Error(
|
|
4857
|
-
`Invalid frontmatter in ${(0,
|
|
5059
|
+
`Invalid frontmatter in ${(0, import_node_path47.join)(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
4858
5060
|
);
|
|
4859
5061
|
}
|
|
4860
5062
|
return new _CursorRule({
|
|
4861
5063
|
baseDir,
|
|
4862
5064
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
4863
|
-
relativeFilePath: (0,
|
|
5065
|
+
relativeFilePath: (0, import_node_path47.basename)(relativeFilePath),
|
|
4864
5066
|
frontmatter: result.data,
|
|
4865
5067
|
body: content.trim(),
|
|
4866
5068
|
validate
|
|
@@ -4892,7 +5094,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
4892
5094
|
};
|
|
4893
5095
|
|
|
4894
5096
|
// src/rules/geminicli-rule.ts
|
|
4895
|
-
var
|
|
5097
|
+
var import_node_path48 = require("path");
|
|
4896
5098
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
4897
5099
|
static getSettablePaths() {
|
|
4898
5100
|
return {
|
|
@@ -4924,7 +5126,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
4924
5126
|
if (isRoot) {
|
|
4925
5127
|
const relativePath2 = paths.root.relativeFilePath;
|
|
4926
5128
|
const fileContent2 = await readFileContent(
|
|
4927
|
-
(0,
|
|
5129
|
+
(0, import_node_path48.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
4928
5130
|
);
|
|
4929
5131
|
return new _GeminiCliRule({
|
|
4930
5132
|
baseDir,
|
|
@@ -4938,8 +5140,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
4938
5140
|
if (!paths.nonRoot) {
|
|
4939
5141
|
throw new Error("nonRoot path is not set");
|
|
4940
5142
|
}
|
|
4941
|
-
const relativePath = (0,
|
|
4942
|
-
const fileContent = await readFileContent((0,
|
|
5143
|
+
const relativePath = (0, import_node_path48.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
5144
|
+
const fileContent = await readFileContent((0, import_node_path48.join)(baseDir, relativePath));
|
|
4943
5145
|
return new _GeminiCliRule({
|
|
4944
5146
|
baseDir,
|
|
4945
5147
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -4981,7 +5183,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
4981
5183
|
};
|
|
4982
5184
|
|
|
4983
5185
|
// src/rules/junie-rule.ts
|
|
4984
|
-
var
|
|
5186
|
+
var import_node_path49 = require("path");
|
|
4985
5187
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
4986
5188
|
static getSettablePaths() {
|
|
4987
5189
|
return {
|
|
@@ -5000,8 +5202,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
5000
5202
|
validate = true
|
|
5001
5203
|
}) {
|
|
5002
5204
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
5003
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
5004
|
-
const fileContent = await readFileContent((0,
|
|
5205
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path49.join)(".junie/memories", relativeFilePath);
|
|
5206
|
+
const fileContent = await readFileContent((0, import_node_path49.join)(baseDir, relativePath));
|
|
5005
5207
|
return new _JunieRule({
|
|
5006
5208
|
baseDir,
|
|
5007
5209
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -5041,7 +5243,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
5041
5243
|
};
|
|
5042
5244
|
|
|
5043
5245
|
// src/rules/kiro-rule.ts
|
|
5044
|
-
var
|
|
5246
|
+
var import_node_path50 = require("path");
|
|
5045
5247
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
5046
5248
|
static getSettablePaths() {
|
|
5047
5249
|
return {
|
|
@@ -5056,7 +5258,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
5056
5258
|
validate = true
|
|
5057
5259
|
}) {
|
|
5058
5260
|
const fileContent = await readFileContent(
|
|
5059
|
-
(0,
|
|
5261
|
+
(0, import_node_path50.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
5060
5262
|
);
|
|
5061
5263
|
return new _KiroRule({
|
|
5062
5264
|
baseDir,
|
|
@@ -5096,7 +5298,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
5096
5298
|
};
|
|
5097
5299
|
|
|
5098
5300
|
// src/rules/opencode-rule.ts
|
|
5099
|
-
var
|
|
5301
|
+
var import_node_path51 = require("path");
|
|
5100
5302
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
5101
5303
|
static getSettablePaths() {
|
|
5102
5304
|
return {
|
|
@@ -5115,8 +5317,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
5115
5317
|
validate = true
|
|
5116
5318
|
}) {
|
|
5117
5319
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
5118
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
5119
|
-
const fileContent = await readFileContent((0,
|
|
5320
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path51.join)(".opencode/memories", relativeFilePath);
|
|
5321
|
+
const fileContent = await readFileContent((0, import_node_path51.join)(baseDir, relativePath));
|
|
5120
5322
|
return new _OpenCodeRule({
|
|
5121
5323
|
baseDir,
|
|
5122
5324
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -5156,7 +5358,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
5156
5358
|
};
|
|
5157
5359
|
|
|
5158
5360
|
// src/rules/qwencode-rule.ts
|
|
5159
|
-
var
|
|
5361
|
+
var import_node_path52 = require("path");
|
|
5160
5362
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
5161
5363
|
static getSettablePaths() {
|
|
5162
5364
|
return {
|
|
@@ -5175,8 +5377,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
5175
5377
|
validate = true
|
|
5176
5378
|
}) {
|
|
5177
5379
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
5178
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
5179
|
-
const fileContent = await readFileContent((0,
|
|
5380
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path52.join)(".qwen/memories", relativeFilePath);
|
|
5381
|
+
const fileContent = await readFileContent((0, import_node_path52.join)(baseDir, relativePath));
|
|
5180
5382
|
return new _QwencodeRule({
|
|
5181
5383
|
baseDir,
|
|
5182
5384
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -5213,7 +5415,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
5213
5415
|
};
|
|
5214
5416
|
|
|
5215
5417
|
// src/rules/roo-rule.ts
|
|
5216
|
-
var
|
|
5418
|
+
var import_node_path53 = require("path");
|
|
5217
5419
|
var RooRule = class _RooRule extends ToolRule {
|
|
5218
5420
|
static getSettablePaths() {
|
|
5219
5421
|
return {
|
|
@@ -5228,7 +5430,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
5228
5430
|
validate = true
|
|
5229
5431
|
}) {
|
|
5230
5432
|
const fileContent = await readFileContent(
|
|
5231
|
-
(0,
|
|
5433
|
+
(0, import_node_path53.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
5232
5434
|
);
|
|
5233
5435
|
return new _RooRule({
|
|
5234
5436
|
baseDir,
|
|
@@ -5283,7 +5485,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
5283
5485
|
};
|
|
5284
5486
|
|
|
5285
5487
|
// src/rules/warp-rule.ts
|
|
5286
|
-
var
|
|
5488
|
+
var import_node_path54 = require("path");
|
|
5287
5489
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
5288
5490
|
constructor({ fileContent, root, ...rest }) {
|
|
5289
5491
|
super({
|
|
@@ -5309,8 +5511,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
5309
5511
|
validate = true
|
|
5310
5512
|
}) {
|
|
5311
5513
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
5312
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
5313
|
-
const fileContent = await readFileContent((0,
|
|
5514
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path54.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
5515
|
+
const fileContent = await readFileContent((0, import_node_path54.join)(baseDir, relativePath));
|
|
5314
5516
|
return new _WarpRule({
|
|
5315
5517
|
baseDir,
|
|
5316
5518
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -5350,7 +5552,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
5350
5552
|
};
|
|
5351
5553
|
|
|
5352
5554
|
// src/rules/windsurf-rule.ts
|
|
5353
|
-
var
|
|
5555
|
+
var import_node_path55 = require("path");
|
|
5354
5556
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
5355
5557
|
static getSettablePaths() {
|
|
5356
5558
|
return {
|
|
@@ -5365,7 +5567,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
5365
5567
|
validate = true
|
|
5366
5568
|
}) {
|
|
5367
5569
|
const fileContent = await readFileContent(
|
|
5368
|
-
(0,
|
|
5570
|
+
(0, import_node_path55.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
5369
5571
|
);
|
|
5370
5572
|
return new _WindsurfRule({
|
|
5371
5573
|
baseDir,
|
|
@@ -5759,10 +5961,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5759
5961
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
5760
5962
|
*/
|
|
5761
5963
|
async loadRulesyncFiles() {
|
|
5762
|
-
const files = await findFilesByGlobs((0,
|
|
5964
|
+
const files = await findFilesByGlobs((0, import_node_path56.join)(".rulesync/rules", "*.md"));
|
|
5763
5965
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
5764
5966
|
const rulesyncRules = await Promise.all(
|
|
5765
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0,
|
|
5967
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path56.basename)(file) }))
|
|
5766
5968
|
);
|
|
5767
5969
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
5768
5970
|
if (rootRules.length > 1) {
|
|
@@ -5780,10 +5982,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5780
5982
|
return rulesyncRules;
|
|
5781
5983
|
}
|
|
5782
5984
|
async loadRulesyncFilesLegacy() {
|
|
5783
|
-
const legacyFiles = await findFilesByGlobs((0,
|
|
5985
|
+
const legacyFiles = await findFilesByGlobs((0, import_node_path56.join)(".rulesync", "*.md"));
|
|
5784
5986
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
5785
5987
|
return Promise.all(
|
|
5786
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0,
|
|
5988
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path56.basename)(file) }))
|
|
5787
5989
|
);
|
|
5788
5990
|
}
|
|
5789
5991
|
/**
|
|
@@ -5847,13 +6049,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5847
6049
|
return [];
|
|
5848
6050
|
}
|
|
5849
6051
|
const rootFilePaths = await findFilesByGlobs(
|
|
5850
|
-
(0,
|
|
6052
|
+
(0, import_node_path56.join)(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
|
|
5851
6053
|
);
|
|
5852
6054
|
return await Promise.all(
|
|
5853
6055
|
rootFilePaths.map(
|
|
5854
6056
|
(filePath) => root.fromFile({
|
|
5855
6057
|
baseDir: this.baseDir,
|
|
5856
|
-
relativeFilePath: (0,
|
|
6058
|
+
relativeFilePath: (0, import_node_path56.basename)(filePath),
|
|
5857
6059
|
global: this.global
|
|
5858
6060
|
})
|
|
5859
6061
|
)
|
|
@@ -5865,13 +6067,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5865
6067
|
return [];
|
|
5866
6068
|
}
|
|
5867
6069
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
5868
|
-
(0,
|
|
6070
|
+
(0, import_node_path56.join)(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
|
|
5869
6071
|
);
|
|
5870
6072
|
return await Promise.all(
|
|
5871
6073
|
nonRootFilePaths.map(
|
|
5872
6074
|
(filePath) => nonRoot.fromFile({
|
|
5873
6075
|
baseDir: this.baseDir,
|
|
5874
|
-
relativeFilePath: (0,
|
|
6076
|
+
relativeFilePath: (0, import_node_path56.basename)(filePath),
|
|
5875
6077
|
global: this.global
|
|
5876
6078
|
})
|
|
5877
6079
|
)
|
|
@@ -6241,14 +6443,14 @@ s/<command> [arguments]
|
|
|
6241
6443
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
6242
6444
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
6243
6445
|
|
|
6244
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
6446
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path56.join)(commands.relativeDirPath, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
6245
6447
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
6246
6448
|
|
|
6247
6449
|
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.
|
|
6248
6450
|
|
|
6249
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
6451
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path56.join)(subagents.relativeDirPath, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
6250
6452
|
|
|
6251
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
6453
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path56.join)(subagents.relativeDirPath, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
6252
6454
|
const result = [
|
|
6253
6455
|
overview,
|
|
6254
6456
|
...this.simulateCommands && CommandsProcessor.getToolTargetsSimulated().includes(this.toolTarget) ? [commandsSection] : [],
|
|
@@ -6367,28 +6569,15 @@ async function generateMcp(config) {
|
|
|
6367
6569
|
logger.debug("Skipping MCP configuration generation (not in --features)");
|
|
6368
6570
|
return 0;
|
|
6369
6571
|
}
|
|
6370
|
-
if (config.getExperimentalGlobal()) {
|
|
6371
|
-
logger.debug("Skipping MCP configuration generation (not supported in global mode)");
|
|
6372
|
-
return 0;
|
|
6373
|
-
}
|
|
6374
6572
|
let totalMcpOutputs = 0;
|
|
6375
6573
|
logger.info("Generating MCP files...");
|
|
6376
|
-
const
|
|
6377
|
-
"amazonqcli",
|
|
6378
|
-
"claudecode",
|
|
6379
|
-
"cline",
|
|
6380
|
-
"copilot",
|
|
6381
|
-
"cursor",
|
|
6382
|
-
"roo"
|
|
6383
|
-
];
|
|
6384
|
-
const mcpSupportedTargets = config.getTargets().filter((target) => {
|
|
6385
|
-
return supportedMcpTargets.some((supportedTarget) => supportedTarget === target);
|
|
6386
|
-
});
|
|
6574
|
+
const toolTargets = config.getExperimentalGlobal() ? (0, import_es_toolkit2.intersection)(config.getTargets(), McpProcessor.getToolTargetsGlobal()) : (0, import_es_toolkit2.intersection)(config.getTargets(), McpProcessor.getToolTargets());
|
|
6387
6575
|
for (const baseDir of config.getBaseDirs()) {
|
|
6388
|
-
for (const toolTarget of
|
|
6576
|
+
for (const toolTarget of toolTargets) {
|
|
6389
6577
|
const processor = new McpProcessor({
|
|
6390
6578
|
baseDir,
|
|
6391
|
-
toolTarget
|
|
6579
|
+
toolTarget,
|
|
6580
|
+
global: config.getExperimentalGlobal()
|
|
6392
6581
|
});
|
|
6393
6582
|
if (config.getDelete()) {
|
|
6394
6583
|
const oldToolFiles = await processor.loadToolFilesToDelete();
|
|
@@ -6473,9 +6662,9 @@ async function generateSubagents(config) {
|
|
|
6473
6662
|
}
|
|
6474
6663
|
|
|
6475
6664
|
// src/cli/commands/gitignore.ts
|
|
6476
|
-
var
|
|
6665
|
+
var import_node_path57 = require("path");
|
|
6477
6666
|
var gitignoreCommand = async () => {
|
|
6478
|
-
const gitignorePath = (0,
|
|
6667
|
+
const gitignorePath = (0, import_node_path57.join)(process.cwd(), ".gitignore");
|
|
6479
6668
|
const rulesFilesToIgnore = [
|
|
6480
6669
|
"# Generated by rulesync - AI tool configuration files",
|
|
6481
6670
|
"**/.amazonq/",
|
|
@@ -6576,12 +6765,9 @@ async function importRules(config, tool) {
|
|
|
6576
6765
|
if (!config.getFeatures().includes("rules")) {
|
|
6577
6766
|
return 0;
|
|
6578
6767
|
}
|
|
6579
|
-
if (!RulesProcessor.getToolTargets().includes(tool)) {
|
|
6580
|
-
return 0;
|
|
6581
|
-
}
|
|
6582
6768
|
const global = config.getExperimentalGlobal();
|
|
6583
|
-
|
|
6584
|
-
|
|
6769
|
+
const supportedTargets = global ? RulesProcessor.getToolTargetsGlobal() : RulesProcessor.getToolTargets();
|
|
6770
|
+
if (!supportedTargets.includes(tool)) {
|
|
6585
6771
|
return 0;
|
|
6586
6772
|
}
|
|
6587
6773
|
const rulesProcessor = new RulesProcessor({
|
|
@@ -6633,16 +6819,15 @@ async function importMcp(config, tool) {
|
|
|
6633
6819
|
if (!config.getFeatures().includes("mcp")) {
|
|
6634
6820
|
return 0;
|
|
6635
6821
|
}
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
}
|
|
6640
|
-
if (!McpProcessor.getToolTargets().includes(tool)) {
|
|
6822
|
+
const global = config.getExperimentalGlobal();
|
|
6823
|
+
const supportedTargets = global ? McpProcessor.getToolTargetsGlobal() : McpProcessor.getToolTargets();
|
|
6824
|
+
if (!supportedTargets.includes(tool)) {
|
|
6641
6825
|
return 0;
|
|
6642
6826
|
}
|
|
6643
6827
|
const mcpProcessor = new McpProcessor({
|
|
6644
6828
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
6645
|
-
toolTarget: tool
|
|
6829
|
+
toolTarget: tool,
|
|
6830
|
+
global
|
|
6646
6831
|
});
|
|
6647
6832
|
const toolFiles = await mcpProcessor.loadToolFiles();
|
|
6648
6833
|
if (toolFiles.length === 0) {
|
|
@@ -6662,9 +6847,6 @@ async function importCommands(config, tool) {
|
|
|
6662
6847
|
const global = config.getExperimentalGlobal();
|
|
6663
6848
|
const supportedTargets = global ? CommandsProcessor.getToolTargetsGlobal() : CommandsProcessor.getToolTargets({ includeSimulated: false });
|
|
6664
6849
|
if (!supportedTargets.includes(tool)) {
|
|
6665
|
-
if (global) {
|
|
6666
|
-
logger.debug(`${tool} is not supported for commands in global mode`);
|
|
6667
|
-
}
|
|
6668
6850
|
return 0;
|
|
6669
6851
|
}
|
|
6670
6852
|
const commandsProcessor = new CommandsProcessor({
|
|
@@ -6712,7 +6894,7 @@ async function importSubagents(config, tool) {
|
|
|
6712
6894
|
}
|
|
6713
6895
|
|
|
6714
6896
|
// src/cli/commands/init.ts
|
|
6715
|
-
var
|
|
6897
|
+
var import_node_path58 = require("path");
|
|
6716
6898
|
async function initCommand() {
|
|
6717
6899
|
logger.info("Initializing rulesync...");
|
|
6718
6900
|
await ensureDir(".rulesync");
|
|
@@ -6783,7 +6965,7 @@ globs: ["**/*"]
|
|
|
6783
6965
|
- Follow single responsibility principle
|
|
6784
6966
|
`
|
|
6785
6967
|
};
|
|
6786
|
-
const filepath = (0,
|
|
6968
|
+
const filepath = (0, import_node_path58.join)(".rulesync/rules", sampleFile.filename);
|
|
6787
6969
|
await ensureDir(".rulesync/rules");
|
|
6788
6970
|
await ensureDir(RulesyncCommand.getSettablePaths().relativeDirPath);
|
|
6789
6971
|
await ensureDir(".rulesync/subagents");
|
|
@@ -6796,7 +6978,7 @@ globs: ["**/*"]
|
|
|
6796
6978
|
}
|
|
6797
6979
|
|
|
6798
6980
|
// src/cli/index.ts
|
|
6799
|
-
var getVersion = () => "3.
|
|
6981
|
+
var getVersion = () => "3.3.0";
|
|
6800
6982
|
var main = async () => {
|
|
6801
6983
|
const program = new import_commander.Command();
|
|
6802
6984
|
const version = getVersion();
|