rulesync 3.1.0 → 3.2.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/dist/index.cjs CHANGED
@@ -110,6 +110,14 @@ 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
+ return initialContent;
119
+ }
120
+ }
113
121
  async function directoryExists(dirPath) {
114
122
  try {
115
123
  const stats = await (0, import_promises.stat)(dirPath);
@@ -122,6 +130,12 @@ async function readFileContent(filepath) {
122
130
  logger.debug(`Reading file: ${filepath}`);
123
131
  return (0, import_promises.readFile)(filepath, "utf-8");
124
132
  }
133
+ function addTrailingNewline(content) {
134
+ if (!content) {
135
+ return "\n";
136
+ }
137
+ return content.trimEnd() + "\n";
138
+ }
125
139
  async function writeFileContent(filepath, content) {
126
140
  logger.debug(`Writing file: ${filepath}`);
127
141
  await ensureDir((0, import_node_path.dirname)(filepath));
@@ -199,7 +213,8 @@ var FeatureProcessor = class {
199
213
  */
200
214
  async writeAiFiles(aiFiles) {
201
215
  for (const aiFile of aiFiles) {
202
- await writeFileContent(aiFile.getFilePath(), aiFile.getFileContent());
216
+ const contentWithNewline = addTrailingNewline(aiFile.getFileContent());
217
+ await writeFileContent(aiFile.getFilePath(), contentWithNewline);
203
218
  }
204
219
  return aiFiles.length;
205
220
  }
@@ -2517,11 +2532,11 @@ var McpServerBaseSchema = import_mini10.z.object({
2517
2532
  kiroAutoBlock: import_mini10.z.optional(import_mini10.z.array(import_mini10.z.string())),
2518
2533
  headers: import_mini10.z.optional(import_mini10.z.record(import_mini10.z.string(), import_mini10.z.string()))
2519
2534
  });
2520
- var RulesyncMcpServerSchema = import_mini10.z.extend(McpServerBaseSchema, {
2535
+ var RulesyncMcpServersSchema = import_mini10.z.extend(McpServerBaseSchema, {
2521
2536
  targets: import_mini10.z.optional(RulesyncTargetsSchema)
2522
2537
  });
2523
2538
  var RulesyncMcpConfigSchema = import_mini10.z.object({
2524
- mcpServers: import_mini10.z.record(import_mini10.z.string(), RulesyncMcpServerSchema)
2539
+ mcpServers: import_mini10.z.record(import_mini10.z.string(), RulesyncMcpServersSchema)
2525
2540
  });
2526
2541
  var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
2527
2542
  json;
@@ -2563,14 +2578,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
2563
2578
 
2564
2579
  // src/mcp/tool-mcp.ts
2565
2580
  var ToolMcp = class extends ToolFile {
2566
- json;
2567
2581
  constructor({ ...rest }) {
2568
2582
  super({
2569
2583
  ...rest,
2570
2584
  validate: true
2571
2585
  // Skip validation during construction
2572
2586
  });
2573
- this.json = JSON.parse(this.fileContent);
2574
2587
  if (rest.validate) {
2575
2588
  const result = this.validate();
2576
2589
  if (!result.success) {
@@ -2578,9 +2591,6 @@ var ToolMcp = class extends ToolFile {
2578
2591
  }
2579
2592
  }
2580
2593
  }
2581
- getJson() {
2582
- return this.json;
2583
- }
2584
2594
  static getSettablePaths() {
2585
2595
  throw new Error("Please implement this method in the subclass.");
2586
2596
  }
@@ -2602,6 +2612,14 @@ var ToolMcp = class extends ToolFile {
2602
2612
 
2603
2613
  // src/mcp/amazonqcli-mcp.ts
2604
2614
  var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
2615
+ json;
2616
+ constructor(params) {
2617
+ super(params);
2618
+ this.json = this.fileContent !== void 0 ? JSON.parse(this.fileContent) : {};
2619
+ }
2620
+ getJson() {
2621
+ return this.json;
2622
+ }
2605
2623
  static getSettablePaths() {
2606
2624
  return {
2607
2625
  relativeDirPath: ".amazonq",
@@ -2651,6 +2669,14 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
2651
2669
  // src/mcp/claudecode-mcp.ts
2652
2670
  var import_node_path27 = require("path");
2653
2671
  var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
2672
+ json;
2673
+ constructor(params) {
2674
+ super(params);
2675
+ this.json = this.fileContent !== void 0 ? JSON.parse(this.fileContent) : {};
2676
+ }
2677
+ getJson() {
2678
+ return this.json;
2679
+ }
2654
2680
  static getSettablePaths() {
2655
2681
  return {
2656
2682
  relativeDirPath: ".",
@@ -2700,6 +2726,14 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
2700
2726
  // src/mcp/cline-mcp.ts
2701
2727
  var import_node_path28 = require("path");
2702
2728
  var ClineMcp = class _ClineMcp extends ToolMcp {
2729
+ json;
2730
+ constructor(params) {
2731
+ super(params);
2732
+ this.json = this.fileContent !== void 0 ? JSON.parse(this.fileContent) : {};
2733
+ }
2734
+ getJson() {
2735
+ return this.json;
2736
+ }
2703
2737
  static getSettablePaths() {
2704
2738
  return {
2705
2739
  relativeDirPath: ".cline",
@@ -2746,9 +2780,111 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
2746
2780
  }
2747
2781
  };
2748
2782
 
2749
- // src/mcp/copilot-mcp.ts
2783
+ // src/mcp/codex-mcp.ts
2750
2784
  var import_node_path29 = require("path");
2785
+ var smolToml = __toESM(require("smol-toml"), 1);
2786
+ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
2787
+ toml;
2788
+ constructor({ ...rest }) {
2789
+ super({
2790
+ ...rest,
2791
+ validate: false
2792
+ });
2793
+ this.toml = smolToml.parse(this.fileContent);
2794
+ if (rest.validate) {
2795
+ const result = this.validate();
2796
+ if (!result.success) {
2797
+ throw result.error;
2798
+ }
2799
+ }
2800
+ }
2801
+ getToml() {
2802
+ return this.toml;
2803
+ }
2804
+ static getSettablePaths() {
2805
+ throw new Error("getSettablePaths is not supported for CodexcliMcp");
2806
+ }
2807
+ static getSettablePathsGlobal() {
2808
+ return {
2809
+ relativeDirPath: ".codex",
2810
+ relativeFilePath: "config.toml"
2811
+ };
2812
+ }
2813
+ static async fromFile({
2814
+ baseDir = ".",
2815
+ validate = true,
2816
+ global = false
2817
+ }) {
2818
+ const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
2819
+ const fileContent = await readFileContent(
2820
+ (0, import_node_path29.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
2821
+ );
2822
+ return new _CodexcliMcp({
2823
+ baseDir,
2824
+ relativeDirPath: paths.relativeDirPath,
2825
+ relativeFilePath: paths.relativeFilePath,
2826
+ fileContent,
2827
+ validate
2828
+ });
2829
+ }
2830
+ static async fromRulesyncMcp({
2831
+ baseDir = ".",
2832
+ rulesyncMcp,
2833
+ validate = true,
2834
+ global = false
2835
+ }) {
2836
+ const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
2837
+ const configTomlFilePath = (0, import_node_path29.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
2838
+ const configTomlFileContent = await readOrInitializeFileContent(
2839
+ configTomlFilePath,
2840
+ smolToml.stringify({})
2841
+ );
2842
+ const configToml = smolToml.parse(configTomlFileContent);
2843
+ const mcpServers = rulesyncMcp.getJson().mcpServers;
2844
+ const filteredMcpServers = this.removeEmptyEntries(mcpServers);
2845
+ configToml["mcp_servers"] = filteredMcpServers;
2846
+ return new _CodexcliMcp({
2847
+ baseDir,
2848
+ relativeDirPath: paths.relativeDirPath,
2849
+ relativeFilePath: paths.relativeFilePath,
2850
+ fileContent: smolToml.stringify(configToml),
2851
+ validate
2852
+ });
2853
+ }
2854
+ toRulesyncMcp() {
2855
+ return new RulesyncMcp({
2856
+ baseDir: this.baseDir,
2857
+ relativeDirPath: ".rulesync",
2858
+ relativeFilePath: ".mcp.json",
2859
+ fileContent: JSON.stringify({ mcpServers: this.toml.mcp_servers ?? {} })
2860
+ });
2861
+ }
2862
+ validate() {
2863
+ return { success: true, error: null };
2864
+ }
2865
+ static removeEmptyEntries(obj) {
2866
+ if (!obj) return {};
2867
+ const filtered = {};
2868
+ for (const [key, value] of Object.entries(obj)) {
2869
+ if (value === null) continue;
2870
+ if (typeof value === "object" && Object.keys(value).length === 0) continue;
2871
+ filtered[key] = value;
2872
+ }
2873
+ return filtered;
2874
+ }
2875
+ };
2876
+
2877
+ // src/mcp/copilot-mcp.ts
2878
+ var import_node_path30 = require("path");
2751
2879
  var CopilotMcp = class _CopilotMcp extends ToolMcp {
2880
+ json;
2881
+ constructor(params) {
2882
+ super(params);
2883
+ this.json = this.fileContent !== void 0 ? JSON.parse(this.fileContent) : {};
2884
+ }
2885
+ getJson() {
2886
+ return this.json;
2887
+ }
2752
2888
  static getSettablePaths() {
2753
2889
  return {
2754
2890
  relativeDirPath: ".vscode",
@@ -2760,7 +2896,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
2760
2896
  validate = true
2761
2897
  }) {
2762
2898
  const fileContent = await readFileContent(
2763
- (0, import_node_path29.join)(
2899
+ (0, import_node_path30.join)(
2764
2900
  baseDir,
2765
2901
  this.getSettablePaths().relativeDirPath,
2766
2902
  this.getSettablePaths().relativeFilePath
@@ -2796,8 +2932,16 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
2796
2932
  };
2797
2933
 
2798
2934
  // src/mcp/cursor-mcp.ts
2799
- var import_node_path30 = require("path");
2935
+ var import_node_path31 = require("path");
2800
2936
  var CursorMcp = class _CursorMcp extends ToolMcp {
2937
+ json;
2938
+ constructor(params) {
2939
+ super(params);
2940
+ this.json = this.fileContent !== void 0 ? JSON.parse(this.fileContent) : {};
2941
+ }
2942
+ getJson() {
2943
+ return this.json;
2944
+ }
2801
2945
  static getSettablePaths() {
2802
2946
  return {
2803
2947
  relativeDirPath: ".cursor",
@@ -2809,7 +2953,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
2809
2953
  validate = true
2810
2954
  }) {
2811
2955
  const fileContent = await readFileContent(
2812
- (0, import_node_path30.join)(
2956
+ (0, import_node_path31.join)(
2813
2957
  baseDir,
2814
2958
  this.getSettablePaths().relativeDirPath,
2815
2959
  this.getSettablePaths().relativeFilePath
@@ -2856,8 +3000,16 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
2856
3000
  };
2857
3001
 
2858
3002
  // src/mcp/roo-mcp.ts
2859
- var import_node_path31 = require("path");
3003
+ var import_node_path32 = require("path");
2860
3004
  var RooMcp = class _RooMcp extends ToolMcp {
3005
+ json;
3006
+ constructor(params) {
3007
+ super(params);
3008
+ this.json = this.fileContent !== void 0 ? JSON.parse(this.fileContent) : {};
3009
+ }
3010
+ getJson() {
3011
+ return this.json;
3012
+ }
2861
3013
  static getSettablePaths() {
2862
3014
  return {
2863
3015
  relativeDirPath: ".roo",
@@ -2869,7 +3021,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
2869
3021
  validate = true
2870
3022
  }) {
2871
3023
  const fileContent = await readFileContent(
2872
- (0, import_node_path31.join)(
3024
+ (0, import_node_path32.join)(
2873
3025
  baseDir,
2874
3026
  this.getSettablePaths().relativeDirPath,
2875
3027
  this.getSettablePaths().relativeFilePath
@@ -2914,15 +3066,22 @@ var mcpProcessorToolTargets = [
2914
3066
  "cursor",
2915
3067
  "roo"
2916
3068
  ];
2917
- var McpProcessorToolTargetSchema = import_mini11.z.enum(mcpProcessorToolTargets);
3069
+ var McpProcessorToolTargetSchema = import_mini11.z.enum(
3070
+ // 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
3071
+ mcpProcessorToolTargets.concat("codexcli")
3072
+ );
3073
+ var mcpProcessorToolTargetsGlobal = ["codexcli"];
2918
3074
  var McpProcessor = class extends FeatureProcessor {
2919
3075
  toolTarget;
3076
+ global;
2920
3077
  constructor({
2921
3078
  baseDir = ".",
2922
- toolTarget
3079
+ toolTarget,
3080
+ global = false
2923
3081
  }) {
2924
3082
  super({ baseDir });
2925
3083
  this.toolTarget = McpProcessorToolTargetSchema.parse(toolTarget);
3084
+ this.global = global;
2926
3085
  }
2927
3086
  /**
2928
3087
  * Implementation of abstract method from FeatureProcessor
@@ -2971,6 +3130,15 @@ var McpProcessor = class extends FeatureProcessor {
2971
3130
  })
2972
3131
  ];
2973
3132
  }
3133
+ case "codexcli": {
3134
+ return [
3135
+ await CodexcliMcp.fromFile({
3136
+ baseDir: this.baseDir,
3137
+ validate: true,
3138
+ global: this.global
3139
+ })
3140
+ ];
3141
+ }
2974
3142
  case "copilot": {
2975
3143
  return [
2976
3144
  await CopilotMcp.fromFile({
@@ -3017,42 +3185,50 @@ var McpProcessor = class extends FeatureProcessor {
3017
3185
  if (!rulesyncMcp) {
3018
3186
  throw new Error(`No .rulesync/.mcp.json found.`);
3019
3187
  }
3020
- const toolMcps = [rulesyncMcp].map((rulesyncMcp2) => {
3021
- switch (this.toolTarget) {
3022
- case "amazonqcli":
3023
- return AmazonqcliMcp.fromRulesyncMcp({
3024
- baseDir: this.baseDir,
3025
- rulesyncMcp: rulesyncMcp2
3026
- });
3027
- case "claudecode":
3028
- return ClaudecodeMcp.fromRulesyncMcp({
3029
- baseDir: this.baseDir,
3030
- rulesyncMcp: rulesyncMcp2
3031
- });
3032
- case "cline":
3033
- return ClineMcp.fromRulesyncMcp({
3034
- baseDir: this.baseDir,
3035
- rulesyncMcp: rulesyncMcp2
3036
- });
3037
- case "copilot":
3038
- return CopilotMcp.fromRulesyncMcp({
3039
- baseDir: this.baseDir,
3040
- rulesyncMcp: rulesyncMcp2
3041
- });
3042
- case "cursor":
3043
- return CursorMcp.fromRulesyncMcp({
3044
- baseDir: this.baseDir,
3045
- rulesyncMcp: rulesyncMcp2
3046
- });
3047
- case "roo":
3048
- return RooMcp.fromRulesyncMcp({
3049
- baseDir: this.baseDir,
3050
- rulesyncMcp: rulesyncMcp2
3051
- });
3052
- default:
3053
- throw new Error(`Unsupported tool target: ${this.toolTarget}`);
3054
- }
3055
- });
3188
+ const toolMcps = await Promise.all(
3189
+ [rulesyncMcp].map(async (rulesyncMcp2) => {
3190
+ switch (this.toolTarget) {
3191
+ case "amazonqcli":
3192
+ return AmazonqcliMcp.fromRulesyncMcp({
3193
+ baseDir: this.baseDir,
3194
+ rulesyncMcp: rulesyncMcp2
3195
+ });
3196
+ case "claudecode":
3197
+ return ClaudecodeMcp.fromRulesyncMcp({
3198
+ baseDir: this.baseDir,
3199
+ rulesyncMcp: rulesyncMcp2
3200
+ });
3201
+ case "cline":
3202
+ return ClineMcp.fromRulesyncMcp({
3203
+ baseDir: this.baseDir,
3204
+ rulesyncMcp: rulesyncMcp2
3205
+ });
3206
+ case "copilot":
3207
+ return CopilotMcp.fromRulesyncMcp({
3208
+ baseDir: this.baseDir,
3209
+ rulesyncMcp: rulesyncMcp2
3210
+ });
3211
+ case "cursor":
3212
+ return CursorMcp.fromRulesyncMcp({
3213
+ baseDir: this.baseDir,
3214
+ rulesyncMcp: rulesyncMcp2
3215
+ });
3216
+ case "codexcli":
3217
+ return await CodexcliMcp.fromRulesyncMcp({
3218
+ baseDir: this.baseDir,
3219
+ rulesyncMcp: rulesyncMcp2,
3220
+ global: this.global
3221
+ });
3222
+ case "roo":
3223
+ return RooMcp.fromRulesyncMcp({
3224
+ baseDir: this.baseDir,
3225
+ rulesyncMcp: rulesyncMcp2
3226
+ });
3227
+ default:
3228
+ throw new Error(`Unsupported tool target: ${this.toolTarget}`);
3229
+ }
3230
+ })
3231
+ );
3056
3232
  return toolMcps;
3057
3233
  }
3058
3234
  /**
@@ -3073,15 +3249,18 @@ var McpProcessor = class extends FeatureProcessor {
3073
3249
  static getToolTargets() {
3074
3250
  return mcpProcessorToolTargets;
3075
3251
  }
3252
+ static getToolTargetsGlobal() {
3253
+ return mcpProcessorToolTargetsGlobal;
3254
+ }
3076
3255
  };
3077
3256
 
3078
3257
  // src/rules/rules-processor.ts
3079
- var import_node_path55 = require("path");
3258
+ var import_node_path56 = require("path");
3080
3259
  var import_fast_xml_parser = require("fast-xml-parser");
3081
3260
  var import_mini20 = require("zod/mini");
3082
3261
 
3083
3262
  // src/subagents/simulated-subagent.ts
3084
- var import_node_path32 = require("path");
3263
+ var import_node_path33 = require("path");
3085
3264
  var import_mini12 = require("zod/mini");
3086
3265
 
3087
3266
  // src/subagents/tool-subagent.ts
@@ -3183,7 +3362,7 @@ var SimulatedSubagent = class extends ToolSubagent {
3183
3362
  relativeFilePath,
3184
3363
  validate = true
3185
3364
  }) {
3186
- const filePath = (0, import_node_path32.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
3365
+ const filePath = (0, import_node_path33.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
3187
3366
  const fileContent = await readFileContent(filePath);
3188
3367
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
3189
3368
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -3193,7 +3372,7 @@ var SimulatedSubagent = class extends ToolSubagent {
3193
3372
  return {
3194
3373
  baseDir,
3195
3374
  relativeDirPath: this.getSettablePaths().relativeDirPath,
3196
- relativeFilePath: (0, import_node_path32.basename)(relativeFilePath),
3375
+ relativeFilePath: (0, import_node_path33.basename)(relativeFilePath),
3197
3376
  frontmatter: result.data,
3198
3377
  body: content.trim(),
3199
3378
  validate
@@ -3340,15 +3519,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
3340
3519
  };
3341
3520
 
3342
3521
  // src/subagents/subagents-processor.ts
3343
- var import_node_path35 = require("path");
3522
+ var import_node_path36 = require("path");
3344
3523
  var import_mini15 = require("zod/mini");
3345
3524
 
3346
3525
  // src/subagents/claudecode-subagent.ts
3347
- var import_node_path34 = require("path");
3526
+ var import_node_path35 = require("path");
3348
3527
  var import_mini14 = require("zod/mini");
3349
3528
 
3350
3529
  // src/subagents/rulesync-subagent.ts
3351
- var import_node_path33 = require("path");
3530
+ var import_node_path34 = require("path");
3352
3531
  var import_mini13 = require("zod/mini");
3353
3532
  var RulesyncSubagentModelSchema = import_mini13.z.enum(["opus", "sonnet", "haiku", "inherit"]);
3354
3533
  var RulesyncSubagentFrontmatterSchema = import_mini13.z.object({
@@ -3402,13 +3581,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
3402
3581
  static async fromFile({
3403
3582
  relativeFilePath
3404
3583
  }) {
3405
- const fileContent = await readFileContent((0, import_node_path33.join)(".rulesync/subagents", relativeFilePath));
3584
+ const fileContent = await readFileContent((0, import_node_path34.join)(".rulesync/subagents", relativeFilePath));
3406
3585
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
3407
3586
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
3408
3587
  if (!result.success) {
3409
3588
  throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${result.error.message}`);
3410
3589
  }
3411
- const filename = (0, import_node_path33.basename)(relativeFilePath);
3590
+ const filename = (0, import_node_path34.basename)(relativeFilePath);
3412
3591
  return new _RulesyncSubagent({
3413
3592
  baseDir: ".",
3414
3593
  relativeDirPath: this.getSettablePaths().relativeDirPath,
@@ -3520,7 +3699,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
3520
3699
  relativeFilePath,
3521
3700
  validate = true
3522
3701
  }) {
3523
- const fileContent = await readFileContent((0, import_node_path34.join)(baseDir, ".claude/agents", relativeFilePath));
3702
+ const fileContent = await readFileContent((0, import_node_path35.join)(baseDir, ".claude/agents", relativeFilePath));
3524
3703
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
3525
3704
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
3526
3705
  if (!result.success) {
@@ -3662,7 +3841,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
3662
3841
  * Load and parse rulesync subagent files from .rulesync/subagents/ directory
3663
3842
  */
3664
3843
  async loadRulesyncFiles() {
3665
- const subagentsDir = (0, import_node_path35.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
3844
+ const subagentsDir = (0, import_node_path36.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
3666
3845
  const dirExists = await directoryExists(subagentsDir);
3667
3846
  if (!dirExists) {
3668
3847
  logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
@@ -3677,7 +3856,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
3677
3856
  logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
3678
3857
  const rulesyncSubagents = [];
3679
3858
  for (const mdFile of mdFiles) {
3680
- const filepath = (0, import_node_path35.join)(subagentsDir, mdFile);
3859
+ const filepath = (0, import_node_path36.join)(subagentsDir, mdFile);
3681
3860
  try {
3682
3861
  const rulesyncSubagent = await RulesyncSubagent.fromFile({
3683
3862
  relativeFilePath: mdFile,
@@ -3791,8 +3970,8 @@ var SubagentsProcessor = class extends FeatureProcessor {
3791
3970
  relativeDirPath,
3792
3971
  fromFile
3793
3972
  }) {
3794
- const paths = await findFilesByGlobs((0, import_node_path35.join)(this.baseDir, relativeDirPath, "*.md"));
3795
- const subagents = (await Promise.allSettled(paths.map((path2) => fromFile((0, import_node_path35.basename)(path2))))).filter((r) => r.status === "fulfilled").map((r) => r.value);
3973
+ const paths = await findFilesByGlobs((0, import_node_path36.join)(this.baseDir, relativeDirPath, "*.md"));
3974
+ const subagents = (await Promise.allSettled(paths.map((path2) => fromFile((0, import_node_path36.basename)(path2))))).filter((r) => r.status === "fulfilled").map((r) => r.value);
3796
3975
  logger.info(`Successfully loaded ${subagents.length} ${relativeDirPath} subagents`);
3797
3976
  return subagents;
3798
3977
  }
@@ -3816,13 +3995,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
3816
3995
  };
3817
3996
 
3818
3997
  // src/rules/agentsmd-rule.ts
3819
- var import_node_path38 = require("path");
3998
+ var import_node_path39 = require("path");
3820
3999
 
3821
4000
  // src/rules/tool-rule.ts
3822
- var import_node_path37 = require("path");
4001
+ var import_node_path38 = require("path");
3823
4002
 
3824
4003
  // src/rules/rulesync-rule.ts
3825
- var import_node_path36 = require("path");
4004
+ var import_node_path37 = require("path");
3826
4005
  var import_mini16 = require("zod/mini");
3827
4006
  var RulesyncRuleFrontmatterSchema = import_mini16.z.object({
3828
4007
  root: import_mini16.z.optional(import_mini16.z.optional(import_mini16.z.boolean())),
@@ -3888,7 +4067,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
3888
4067
  relativeFilePath,
3889
4068
  validate = true
3890
4069
  }) {
3891
- const filePath = (0, import_node_path36.join)(this.getSettablePaths().legacy.relativeDirPath, relativeFilePath);
4070
+ const filePath = (0, import_node_path37.join)(this.getSettablePaths().legacy.relativeDirPath, relativeFilePath);
3892
4071
  const fileContent = await readFileContent(filePath);
3893
4072
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
3894
4073
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
@@ -3903,7 +4082,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
3903
4082
  agentsmd: result.data.agentsmd,
3904
4083
  cursor: result.data.cursor
3905
4084
  };
3906
- const filename = (0, import_node_path36.basename)(filePath);
4085
+ const filename = (0, import_node_path37.basename)(filePath);
3907
4086
  return new _RulesyncRule({
3908
4087
  baseDir: ".",
3909
4088
  relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
@@ -3917,7 +4096,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
3917
4096
  relativeFilePath,
3918
4097
  validate = true
3919
4098
  }) {
3920
- const filePath = (0, import_node_path36.join)(this.getSettablePaths().recommended.relativeDirPath, relativeFilePath);
4099
+ const filePath = (0, import_node_path37.join)(this.getSettablePaths().recommended.relativeDirPath, relativeFilePath);
3921
4100
  const fileContent = await readFileContent(filePath);
3922
4101
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
3923
4102
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
@@ -3932,7 +4111,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
3932
4111
  agentsmd: result.data.agentsmd,
3933
4112
  cursor: result.data.cursor
3934
4113
  };
3935
- const filename = (0, import_node_path36.basename)(filePath);
4114
+ const filename = (0, import_node_path37.basename)(filePath);
3936
4115
  return new _RulesyncRule({
3937
4116
  baseDir: ".",
3938
4117
  relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
@@ -4021,7 +4200,7 @@ var ToolRule = class extends ToolFile {
4021
4200
  });
4022
4201
  const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
4023
4202
  if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
4024
- params.relativeDirPath = (0, import_node_path37.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
4203
+ params.relativeDirPath = (0, import_node_path38.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
4025
4204
  params.relativeFilePath = "AGENTS.md";
4026
4205
  }
4027
4206
  return params;
@@ -4097,8 +4276,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
4097
4276
  validate = true
4098
4277
  }) {
4099
4278
  const isRoot = relativeFilePath === "AGENTS.md";
4100
- const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path38.join)(".agents/memories", relativeFilePath);
4101
- const fileContent = await readFileContent((0, import_node_path38.join)(baseDir, relativePath));
4279
+ const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path39.join)(".agents/memories", relativeFilePath);
4280
+ const fileContent = await readFileContent((0, import_node_path39.join)(baseDir, relativePath));
4102
4281
  return new _AgentsMdRule({
4103
4282
  baseDir,
4104
4283
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -4138,7 +4317,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
4138
4317
  };
4139
4318
 
4140
4319
  // src/rules/amazonqcli-rule.ts
4141
- var import_node_path39 = require("path");
4320
+ var import_node_path40 = require("path");
4142
4321
  var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
4143
4322
  static getSettablePaths() {
4144
4323
  return {
@@ -4153,7 +4332,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
4153
4332
  validate = true
4154
4333
  }) {
4155
4334
  const fileContent = await readFileContent(
4156
- (0, import_node_path39.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4335
+ (0, import_node_path40.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4157
4336
  );
4158
4337
  return new _AmazonQCliRule({
4159
4338
  baseDir,
@@ -4193,7 +4372,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
4193
4372
  };
4194
4373
 
4195
4374
  // src/rules/augmentcode-legacy-rule.ts
4196
- var import_node_path40 = require("path");
4375
+ var import_node_path41 = require("path");
4197
4376
  var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
4198
4377
  toRulesyncRule() {
4199
4378
  const rulesyncFrontmatter = {
@@ -4254,8 +4433,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
4254
4433
  }) {
4255
4434
  const settablePaths = this.getSettablePaths();
4256
4435
  const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
4257
- const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path40.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
4258
- const fileContent = await readFileContent((0, import_node_path40.join)(baseDir, relativePath));
4436
+ const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path41.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
4437
+ const fileContent = await readFileContent((0, import_node_path41.join)(baseDir, relativePath));
4259
4438
  return new _AugmentcodeLegacyRule({
4260
4439
  baseDir,
4261
4440
  relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
@@ -4268,7 +4447,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
4268
4447
  };
4269
4448
 
4270
4449
  // src/rules/augmentcode-rule.ts
4271
- var import_node_path41 = require("path");
4450
+ var import_node_path42 = require("path");
4272
4451
  var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
4273
4452
  toRulesyncRule() {
4274
4453
  return this.toRulesyncRuleDefault();
@@ -4300,7 +4479,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
4300
4479
  validate = true
4301
4480
  }) {
4302
4481
  const fileContent = await readFileContent(
4303
- (0, import_node_path41.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4482
+ (0, import_node_path42.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4304
4483
  );
4305
4484
  const { body: content } = parseFrontmatter(fileContent);
4306
4485
  return new _AugmentcodeRule({
@@ -4323,7 +4502,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
4323
4502
  };
4324
4503
 
4325
4504
  // src/rules/claudecode-rule.ts
4326
- var import_node_path42 = require("path");
4505
+ var import_node_path43 = require("path");
4327
4506
  var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
4328
4507
  static getSettablePaths() {
4329
4508
  return {
@@ -4332,7 +4511,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
4332
4511
  relativeFilePath: "CLAUDE.md"
4333
4512
  },
4334
4513
  nonRoot: {
4335
- relativeDirPath: (0, import_node_path42.join)(".claude", "memories")
4514
+ relativeDirPath: (0, import_node_path43.join)(".claude", "memories")
4336
4515
  }
4337
4516
  };
4338
4517
  }
@@ -4355,7 +4534,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
4355
4534
  if (isRoot) {
4356
4535
  const relativePath2 = paths.root.relativeFilePath;
4357
4536
  const fileContent2 = await readFileContent(
4358
- (0, import_node_path42.join)(baseDir, paths.root.relativeDirPath, relativePath2)
4537
+ (0, import_node_path43.join)(baseDir, paths.root.relativeDirPath, relativePath2)
4359
4538
  );
4360
4539
  return new _ClaudecodeRule({
4361
4540
  baseDir,
@@ -4369,8 +4548,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
4369
4548
  if (!paths.nonRoot) {
4370
4549
  throw new Error("nonRoot path is not set");
4371
4550
  }
4372
- const relativePath = (0, import_node_path42.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
4373
- const fileContent = await readFileContent((0, import_node_path42.join)(baseDir, relativePath));
4551
+ const relativePath = (0, import_node_path43.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
4552
+ const fileContent = await readFileContent((0, import_node_path43.join)(baseDir, relativePath));
4374
4553
  return new _ClaudecodeRule({
4375
4554
  baseDir,
4376
4555
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -4412,7 +4591,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
4412
4591
  };
4413
4592
 
4414
4593
  // src/rules/cline-rule.ts
4415
- var import_node_path43 = require("path");
4594
+ var import_node_path44 = require("path");
4416
4595
  var import_mini17 = require("zod/mini");
4417
4596
  var ClineRuleFrontmatterSchema = import_mini17.z.object({
4418
4597
  description: import_mini17.z.string()
@@ -4457,7 +4636,7 @@ var ClineRule = class _ClineRule extends ToolRule {
4457
4636
  validate = true
4458
4637
  }) {
4459
4638
  const fileContent = await readFileContent(
4460
- (0, import_node_path43.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4639
+ (0, import_node_path44.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4461
4640
  );
4462
4641
  return new _ClineRule({
4463
4642
  baseDir,
@@ -4470,7 +4649,7 @@ var ClineRule = class _ClineRule extends ToolRule {
4470
4649
  };
4471
4650
 
4472
4651
  // src/rules/codexcli-rule.ts
4473
- var import_node_path44 = require("path");
4652
+ var import_node_path45 = require("path");
4474
4653
  var CodexcliRule = class _CodexcliRule extends ToolRule {
4475
4654
  static getSettablePaths() {
4476
4655
  return {
@@ -4502,7 +4681,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
4502
4681
  if (isRoot) {
4503
4682
  const relativePath2 = paths.root.relativeFilePath;
4504
4683
  const fileContent2 = await readFileContent(
4505
- (0, import_node_path44.join)(baseDir, paths.root.relativeDirPath, relativePath2)
4684
+ (0, import_node_path45.join)(baseDir, paths.root.relativeDirPath, relativePath2)
4506
4685
  );
4507
4686
  return new _CodexcliRule({
4508
4687
  baseDir,
@@ -4516,8 +4695,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
4516
4695
  if (!paths.nonRoot) {
4517
4696
  throw new Error("nonRoot path is not set");
4518
4697
  }
4519
- const relativePath = (0, import_node_path44.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
4520
- const fileContent = await readFileContent((0, import_node_path44.join)(baseDir, relativePath));
4698
+ const relativePath = (0, import_node_path45.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
4699
+ const fileContent = await readFileContent((0, import_node_path45.join)(baseDir, relativePath));
4521
4700
  return new _CodexcliRule({
4522
4701
  baseDir,
4523
4702
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -4559,7 +4738,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
4559
4738
  };
4560
4739
 
4561
4740
  // src/rules/copilot-rule.ts
4562
- var import_node_path45 = require("path");
4741
+ var import_node_path46 = require("path");
4563
4742
  var import_mini18 = require("zod/mini");
4564
4743
  var CopilotRuleFrontmatterSchema = import_mini18.z.object({
4565
4744
  description: import_mini18.z.optional(import_mini18.z.string()),
@@ -4652,11 +4831,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
4652
4831
  validate = true
4653
4832
  }) {
4654
4833
  const isRoot = relativeFilePath === "copilot-instructions.md";
4655
- const relativePath = isRoot ? (0, import_node_path45.join)(
4834
+ const relativePath = isRoot ? (0, import_node_path46.join)(
4656
4835
  this.getSettablePaths().root.relativeDirPath,
4657
4836
  this.getSettablePaths().root.relativeFilePath
4658
- ) : (0, import_node_path45.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
4659
- const fileContent = await readFileContent((0, import_node_path45.join)(baseDir, relativePath));
4837
+ ) : (0, import_node_path46.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
4838
+ const fileContent = await readFileContent((0, import_node_path46.join)(baseDir, relativePath));
4660
4839
  if (isRoot) {
4661
4840
  return new _CopilotRule({
4662
4841
  baseDir,
@@ -4675,7 +4854,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
4675
4854
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
4676
4855
  if (!result.success) {
4677
4856
  throw new Error(
4678
- `Invalid frontmatter in ${(0, import_node_path45.join)(baseDir, relativeFilePath)}: ${result.error.message}`
4857
+ `Invalid frontmatter in ${(0, import_node_path46.join)(baseDir, relativeFilePath)}: ${result.error.message}`
4679
4858
  );
4680
4859
  }
4681
4860
  return new _CopilotRule({
@@ -4714,7 +4893,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
4714
4893
  };
4715
4894
 
4716
4895
  // src/rules/cursor-rule.ts
4717
- var import_node_path46 = require("path");
4896
+ var import_node_path47 = require("path");
4718
4897
  var import_mini19 = require("zod/mini");
4719
4898
  var CursorRuleFrontmatterSchema = import_mini19.z.object({
4720
4899
  description: import_mini19.z.optional(import_mini19.z.string()),
@@ -4841,19 +5020,19 @@ var CursorRule = class _CursorRule extends ToolRule {
4841
5020
  validate = true
4842
5021
  }) {
4843
5022
  const fileContent = await readFileContent(
4844
- (0, import_node_path46.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5023
+ (0, import_node_path47.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4845
5024
  );
4846
5025
  const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
4847
5026
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
4848
5027
  if (!result.success) {
4849
5028
  throw new Error(
4850
- `Invalid frontmatter in ${(0, import_node_path46.join)(baseDir, relativeFilePath)}: ${result.error.message}`
5029
+ `Invalid frontmatter in ${(0, import_node_path47.join)(baseDir, relativeFilePath)}: ${result.error.message}`
4851
5030
  );
4852
5031
  }
4853
5032
  return new _CursorRule({
4854
5033
  baseDir,
4855
5034
  relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
4856
- relativeFilePath: (0, import_node_path46.basename)(relativeFilePath),
5035
+ relativeFilePath: (0, import_node_path47.basename)(relativeFilePath),
4857
5036
  frontmatter: result.data,
4858
5037
  body: content.trim(),
4859
5038
  validate
@@ -4885,7 +5064,7 @@ var CursorRule = class _CursorRule extends ToolRule {
4885
5064
  };
4886
5065
 
4887
5066
  // src/rules/geminicli-rule.ts
4888
- var import_node_path47 = require("path");
5067
+ var import_node_path48 = require("path");
4889
5068
  var GeminiCliRule = class _GeminiCliRule extends ToolRule {
4890
5069
  static getSettablePaths() {
4891
5070
  return {
@@ -4917,7 +5096,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
4917
5096
  if (isRoot) {
4918
5097
  const relativePath2 = paths.root.relativeFilePath;
4919
5098
  const fileContent2 = await readFileContent(
4920
- (0, import_node_path47.join)(baseDir, paths.root.relativeDirPath, relativePath2)
5099
+ (0, import_node_path48.join)(baseDir, paths.root.relativeDirPath, relativePath2)
4921
5100
  );
4922
5101
  return new _GeminiCliRule({
4923
5102
  baseDir,
@@ -4931,8 +5110,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
4931
5110
  if (!paths.nonRoot) {
4932
5111
  throw new Error("nonRoot path is not set");
4933
5112
  }
4934
- const relativePath = (0, import_node_path47.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
4935
- const fileContent = await readFileContent((0, import_node_path47.join)(baseDir, relativePath));
5113
+ const relativePath = (0, import_node_path48.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
5114
+ const fileContent = await readFileContent((0, import_node_path48.join)(baseDir, relativePath));
4936
5115
  return new _GeminiCliRule({
4937
5116
  baseDir,
4938
5117
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -4974,7 +5153,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
4974
5153
  };
4975
5154
 
4976
5155
  // src/rules/junie-rule.ts
4977
- var import_node_path48 = require("path");
5156
+ var import_node_path49 = require("path");
4978
5157
  var JunieRule = class _JunieRule extends ToolRule {
4979
5158
  static getSettablePaths() {
4980
5159
  return {
@@ -4993,8 +5172,8 @@ var JunieRule = class _JunieRule extends ToolRule {
4993
5172
  validate = true
4994
5173
  }) {
4995
5174
  const isRoot = relativeFilePath === "guidelines.md";
4996
- const relativePath = isRoot ? "guidelines.md" : (0, import_node_path48.join)(".junie/memories", relativeFilePath);
4997
- const fileContent = await readFileContent((0, import_node_path48.join)(baseDir, relativePath));
5175
+ const relativePath = isRoot ? "guidelines.md" : (0, import_node_path49.join)(".junie/memories", relativeFilePath);
5176
+ const fileContent = await readFileContent((0, import_node_path49.join)(baseDir, relativePath));
4998
5177
  return new _JunieRule({
4999
5178
  baseDir,
5000
5179
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -5034,7 +5213,7 @@ var JunieRule = class _JunieRule extends ToolRule {
5034
5213
  };
5035
5214
 
5036
5215
  // src/rules/kiro-rule.ts
5037
- var import_node_path49 = require("path");
5216
+ var import_node_path50 = require("path");
5038
5217
  var KiroRule = class _KiroRule extends ToolRule {
5039
5218
  static getSettablePaths() {
5040
5219
  return {
@@ -5049,7 +5228,7 @@ var KiroRule = class _KiroRule extends ToolRule {
5049
5228
  validate = true
5050
5229
  }) {
5051
5230
  const fileContent = await readFileContent(
5052
- (0, import_node_path49.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5231
+ (0, import_node_path50.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5053
5232
  );
5054
5233
  return new _KiroRule({
5055
5234
  baseDir,
@@ -5089,7 +5268,7 @@ var KiroRule = class _KiroRule extends ToolRule {
5089
5268
  };
5090
5269
 
5091
5270
  // src/rules/opencode-rule.ts
5092
- var import_node_path50 = require("path");
5271
+ var import_node_path51 = require("path");
5093
5272
  var OpenCodeRule = class _OpenCodeRule extends ToolRule {
5094
5273
  static getSettablePaths() {
5095
5274
  return {
@@ -5108,8 +5287,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
5108
5287
  validate = true
5109
5288
  }) {
5110
5289
  const isRoot = relativeFilePath === "AGENTS.md";
5111
- const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path50.join)(".opencode/memories", relativeFilePath);
5112
- const fileContent = await readFileContent((0, import_node_path50.join)(baseDir, relativePath));
5290
+ const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path51.join)(".opencode/memories", relativeFilePath);
5291
+ const fileContent = await readFileContent((0, import_node_path51.join)(baseDir, relativePath));
5113
5292
  return new _OpenCodeRule({
5114
5293
  baseDir,
5115
5294
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -5149,7 +5328,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
5149
5328
  };
5150
5329
 
5151
5330
  // src/rules/qwencode-rule.ts
5152
- var import_node_path51 = require("path");
5331
+ var import_node_path52 = require("path");
5153
5332
  var QwencodeRule = class _QwencodeRule extends ToolRule {
5154
5333
  static getSettablePaths() {
5155
5334
  return {
@@ -5168,8 +5347,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
5168
5347
  validate = true
5169
5348
  }) {
5170
5349
  const isRoot = relativeFilePath === "QWEN.md";
5171
- const relativePath = isRoot ? "QWEN.md" : (0, import_node_path51.join)(".qwen/memories", relativeFilePath);
5172
- const fileContent = await readFileContent((0, import_node_path51.join)(baseDir, relativePath));
5350
+ const relativePath = isRoot ? "QWEN.md" : (0, import_node_path52.join)(".qwen/memories", relativeFilePath);
5351
+ const fileContent = await readFileContent((0, import_node_path52.join)(baseDir, relativePath));
5173
5352
  return new _QwencodeRule({
5174
5353
  baseDir,
5175
5354
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -5206,7 +5385,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
5206
5385
  };
5207
5386
 
5208
5387
  // src/rules/roo-rule.ts
5209
- var import_node_path52 = require("path");
5388
+ var import_node_path53 = require("path");
5210
5389
  var RooRule = class _RooRule extends ToolRule {
5211
5390
  static getSettablePaths() {
5212
5391
  return {
@@ -5221,7 +5400,7 @@ var RooRule = class _RooRule extends ToolRule {
5221
5400
  validate = true
5222
5401
  }) {
5223
5402
  const fileContent = await readFileContent(
5224
- (0, import_node_path52.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5403
+ (0, import_node_path53.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5225
5404
  );
5226
5405
  return new _RooRule({
5227
5406
  baseDir,
@@ -5276,7 +5455,7 @@ var RooRule = class _RooRule extends ToolRule {
5276
5455
  };
5277
5456
 
5278
5457
  // src/rules/warp-rule.ts
5279
- var import_node_path53 = require("path");
5458
+ var import_node_path54 = require("path");
5280
5459
  var WarpRule = class _WarpRule extends ToolRule {
5281
5460
  constructor({ fileContent, root, ...rest }) {
5282
5461
  super({
@@ -5302,8 +5481,8 @@ var WarpRule = class _WarpRule extends ToolRule {
5302
5481
  validate = true
5303
5482
  }) {
5304
5483
  const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
5305
- const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path53.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
5306
- const fileContent = await readFileContent((0, import_node_path53.join)(baseDir, relativePath));
5484
+ const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path54.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
5485
+ const fileContent = await readFileContent((0, import_node_path54.join)(baseDir, relativePath));
5307
5486
  return new _WarpRule({
5308
5487
  baseDir,
5309
5488
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
@@ -5343,7 +5522,7 @@ var WarpRule = class _WarpRule extends ToolRule {
5343
5522
  };
5344
5523
 
5345
5524
  // src/rules/windsurf-rule.ts
5346
- var import_node_path54 = require("path");
5525
+ var import_node_path55 = require("path");
5347
5526
  var WindsurfRule = class _WindsurfRule extends ToolRule {
5348
5527
  static getSettablePaths() {
5349
5528
  return {
@@ -5358,7 +5537,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
5358
5537
  validate = true
5359
5538
  }) {
5360
5539
  const fileContent = await readFileContent(
5361
- (0, import_node_path54.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5540
+ (0, import_node_path55.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5362
5541
  );
5363
5542
  return new _WindsurfRule({
5364
5543
  baseDir,
@@ -5752,10 +5931,10 @@ var RulesProcessor = class extends FeatureProcessor {
5752
5931
  * Load and parse rulesync rule files from .rulesync/rules/ directory
5753
5932
  */
5754
5933
  async loadRulesyncFiles() {
5755
- const files = await findFilesByGlobs((0, import_node_path55.join)(".rulesync/rules", "*.md"));
5934
+ const files = await findFilesByGlobs((0, import_node_path56.join)(".rulesync/rules", "*.md"));
5756
5935
  logger.debug(`Found ${files.length} rulesync files`);
5757
5936
  const rulesyncRules = await Promise.all(
5758
- files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path55.basename)(file) }))
5937
+ files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path56.basename)(file) }))
5759
5938
  );
5760
5939
  const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
5761
5940
  if (rootRules.length > 1) {
@@ -5773,10 +5952,10 @@ var RulesProcessor = class extends FeatureProcessor {
5773
5952
  return rulesyncRules;
5774
5953
  }
5775
5954
  async loadRulesyncFilesLegacy() {
5776
- const legacyFiles = await findFilesByGlobs((0, import_node_path55.join)(".rulesync", "*.md"));
5955
+ const legacyFiles = await findFilesByGlobs((0, import_node_path56.join)(".rulesync", "*.md"));
5777
5956
  logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
5778
5957
  return Promise.all(
5779
- legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path55.basename)(file) }))
5958
+ legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path56.basename)(file) }))
5780
5959
  );
5781
5960
  }
5782
5961
  /**
@@ -5840,13 +6019,13 @@ var RulesProcessor = class extends FeatureProcessor {
5840
6019
  return [];
5841
6020
  }
5842
6021
  const rootFilePaths = await findFilesByGlobs(
5843
- (0, import_node_path55.join)(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
6022
+ (0, import_node_path56.join)(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
5844
6023
  );
5845
6024
  return await Promise.all(
5846
6025
  rootFilePaths.map(
5847
6026
  (filePath) => root.fromFile({
5848
6027
  baseDir: this.baseDir,
5849
- relativeFilePath: (0, import_node_path55.basename)(filePath),
6028
+ relativeFilePath: (0, import_node_path56.basename)(filePath),
5850
6029
  global: this.global
5851
6030
  })
5852
6031
  )
@@ -5858,13 +6037,13 @@ var RulesProcessor = class extends FeatureProcessor {
5858
6037
  return [];
5859
6038
  }
5860
6039
  const nonRootFilePaths = await findFilesByGlobs(
5861
- (0, import_node_path55.join)(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
6040
+ (0, import_node_path56.join)(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
5862
6041
  );
5863
6042
  return await Promise.all(
5864
6043
  nonRootFilePaths.map(
5865
6044
  (filePath) => nonRoot.fromFile({
5866
6045
  baseDir: this.baseDir,
5867
- relativeFilePath: (0, import_node_path55.basename)(filePath),
6046
+ relativeFilePath: (0, import_node_path56.basename)(filePath),
5868
6047
  global: this.global
5869
6048
  })
5870
6049
  )
@@ -6234,14 +6413,14 @@ s/<command> [arguments]
6234
6413
  This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
6235
6414
  The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
6236
6415
 
6237
- When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path55.join)(commands.relativeDirPath, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
6416
+ 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.` : "";
6238
6417
  const subagentsSection = subagents ? `## Simulated Subagents
6239
6418
 
6240
6419
  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.
6241
6420
 
6242
- When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path55.join)(subagents.relativeDirPath, "{subagent}.md")}\`, and execute its contents as the block of operations.
6421
+ 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.
6243
6422
 
6244
- For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path55.join)(subagents.relativeDirPath, "planner.md")}\`, and execute its contents as the block of operations.` : "";
6423
+ 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.` : "";
6245
6424
  const result = [
6246
6425
  overview,
6247
6426
  ...this.simulateCommands && CommandsProcessor.getToolTargetsSimulated().includes(this.toolTarget) ? [commandsSection] : [],
@@ -6360,28 +6539,15 @@ async function generateMcp(config) {
6360
6539
  logger.debug("Skipping MCP configuration generation (not in --features)");
6361
6540
  return 0;
6362
6541
  }
6363
- if (config.getExperimentalGlobal()) {
6364
- logger.debug("Skipping MCP configuration generation (not supported in global mode)");
6365
- return 0;
6366
- }
6367
6542
  let totalMcpOutputs = 0;
6368
6543
  logger.info("Generating MCP files...");
6369
- const supportedMcpTargets = [
6370
- "amazonqcli",
6371
- "claudecode",
6372
- "cline",
6373
- "copilot",
6374
- "cursor",
6375
- "roo"
6376
- ];
6377
- const mcpSupportedTargets = config.getTargets().filter((target) => {
6378
- return supportedMcpTargets.some((supportedTarget) => supportedTarget === target);
6379
- });
6544
+ const toolTargets = config.getExperimentalGlobal() ? (0, import_es_toolkit2.intersection)(config.getTargets(), McpProcessor.getToolTargetsGlobal()) : (0, import_es_toolkit2.intersection)(config.getTargets(), McpProcessor.getToolTargets());
6380
6545
  for (const baseDir of config.getBaseDirs()) {
6381
- for (const toolTarget of (0, import_es_toolkit2.intersection)(mcpSupportedTargets, McpProcessor.getToolTargets())) {
6546
+ for (const toolTarget of toolTargets) {
6382
6547
  const processor = new McpProcessor({
6383
6548
  baseDir,
6384
- toolTarget
6549
+ toolTarget,
6550
+ global: config.getExperimentalGlobal()
6385
6551
  });
6386
6552
  if (config.getDelete()) {
6387
6553
  const oldToolFiles = await processor.loadToolFilesToDelete();
@@ -6466,9 +6632,9 @@ async function generateSubagents(config) {
6466
6632
  }
6467
6633
 
6468
6634
  // src/cli/commands/gitignore.ts
6469
- var import_node_path56 = require("path");
6635
+ var import_node_path57 = require("path");
6470
6636
  var gitignoreCommand = async () => {
6471
- const gitignorePath = (0, import_node_path56.join)(process.cwd(), ".gitignore");
6637
+ const gitignorePath = (0, import_node_path57.join)(process.cwd(), ".gitignore");
6472
6638
  const rulesFilesToIgnore = [
6473
6639
  "# Generated by rulesync - AI tool configuration files",
6474
6640
  "**/.amazonq/",
@@ -6569,12 +6735,9 @@ async function importRules(config, tool) {
6569
6735
  if (!config.getFeatures().includes("rules")) {
6570
6736
  return 0;
6571
6737
  }
6572
- if (!RulesProcessor.getToolTargets().includes(tool)) {
6573
- return 0;
6574
- }
6575
6738
  const global = config.getExperimentalGlobal();
6576
- if (global && !RulesProcessor.getToolTargetsGlobal().includes(tool)) {
6577
- logger.error(`${tool} is not supported in global mode`);
6739
+ const supportedTargets = global ? RulesProcessor.getToolTargetsGlobal() : RulesProcessor.getToolTargets();
6740
+ if (!supportedTargets.includes(tool)) {
6578
6741
  return 0;
6579
6742
  }
6580
6743
  const rulesProcessor = new RulesProcessor({
@@ -6626,16 +6789,15 @@ async function importMcp(config, tool) {
6626
6789
  if (!config.getFeatures().includes("mcp")) {
6627
6790
  return 0;
6628
6791
  }
6629
- if (config.getExperimentalGlobal()) {
6630
- logger.debug("Skipping MCP file import (not supported in global mode)");
6631
- return 0;
6632
- }
6633
- if (!McpProcessor.getToolTargets().includes(tool)) {
6792
+ const global = config.getExperimentalGlobal();
6793
+ const supportedTargets = global ? McpProcessor.getToolTargetsGlobal() : McpProcessor.getToolTargets();
6794
+ if (!supportedTargets.includes(tool)) {
6634
6795
  return 0;
6635
6796
  }
6636
6797
  const mcpProcessor = new McpProcessor({
6637
6798
  baseDir: config.getBaseDirs()[0] ?? ".",
6638
- toolTarget: tool
6799
+ toolTarget: tool,
6800
+ global
6639
6801
  });
6640
6802
  const toolFiles = await mcpProcessor.loadToolFiles();
6641
6803
  if (toolFiles.length === 0) {
@@ -6655,9 +6817,6 @@ async function importCommands(config, tool) {
6655
6817
  const global = config.getExperimentalGlobal();
6656
6818
  const supportedTargets = global ? CommandsProcessor.getToolTargetsGlobal() : CommandsProcessor.getToolTargets({ includeSimulated: false });
6657
6819
  if (!supportedTargets.includes(tool)) {
6658
- if (global) {
6659
- logger.debug(`${tool} is not supported for commands in global mode`);
6660
- }
6661
6820
  return 0;
6662
6821
  }
6663
6822
  const commandsProcessor = new CommandsProcessor({
@@ -6705,7 +6864,7 @@ async function importSubagents(config, tool) {
6705
6864
  }
6706
6865
 
6707
6866
  // src/cli/commands/init.ts
6708
- var import_node_path57 = require("path");
6867
+ var import_node_path58 = require("path");
6709
6868
  async function initCommand() {
6710
6869
  logger.info("Initializing rulesync...");
6711
6870
  await ensureDir(".rulesync");
@@ -6776,7 +6935,7 @@ globs: ["**/*"]
6776
6935
  - Follow single responsibility principle
6777
6936
  `
6778
6937
  };
6779
- const filepath = (0, import_node_path57.join)(".rulesync/rules", sampleFile.filename);
6938
+ const filepath = (0, import_node_path58.join)(".rulesync/rules", sampleFile.filename);
6780
6939
  await ensureDir(".rulesync/rules");
6781
6940
  await ensureDir(RulesyncCommand.getSettablePaths().relativeDirPath);
6782
6941
  await ensureDir(".rulesync/subagents");
@@ -6789,7 +6948,7 @@ globs: ["**/*"]
6789
6948
  }
6790
6949
 
6791
6950
  // src/cli/index.ts
6792
- var getVersion = () => "3.1.0";
6951
+ var getVersion = () => "3.2.0";
6793
6952
  var main = async () => {
6794
6953
  const program = new import_commander.Command();
6795
6954
  const version = getVersion();