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/dist/index.js CHANGED
@@ -87,6 +87,15 @@ async function ensureDir(dirPath) {
87
87
  await mkdir(dirPath, { recursive: true });
88
88
  }
89
89
  }
90
+ async function readOrInitializeFileContent(filePath, initialContent = "") {
91
+ if (await fileExists(filePath)) {
92
+ return await readFileContent(filePath);
93
+ } else {
94
+ await ensureDir(dirname(filePath));
95
+ await writeFileContent(filePath, initialContent);
96
+ return initialContent;
97
+ }
98
+ }
90
99
  async function directoryExists(dirPath) {
91
100
  try {
92
101
  const stats = await stat(dirPath);
@@ -2501,11 +2510,11 @@ var McpServerBaseSchema = z10.object({
2501
2510
  kiroAutoBlock: z10.optional(z10.array(z10.string())),
2502
2511
  headers: z10.optional(z10.record(z10.string(), z10.string()))
2503
2512
  });
2504
- var RulesyncMcpServerSchema = z10.extend(McpServerBaseSchema, {
2513
+ var RulesyncMcpServersSchema = z10.extend(McpServerBaseSchema, {
2505
2514
  targets: z10.optional(RulesyncTargetsSchema)
2506
2515
  });
2507
2516
  var RulesyncMcpConfigSchema = z10.object({
2508
- mcpServers: z10.record(z10.string(), RulesyncMcpServerSchema)
2517
+ mcpServers: z10.record(z10.string(), RulesyncMcpServersSchema)
2509
2518
  });
2510
2519
  var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
2511
2520
  json;
@@ -2547,14 +2556,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
2547
2556
 
2548
2557
  // src/mcp/tool-mcp.ts
2549
2558
  var ToolMcp = class extends ToolFile {
2550
- json;
2551
2559
  constructor({ ...rest }) {
2552
2560
  super({
2553
2561
  ...rest,
2554
2562
  validate: true
2555
2563
  // Skip validation during construction
2556
2564
  });
2557
- this.json = JSON.parse(this.fileContent);
2558
2565
  if (rest.validate) {
2559
2566
  const result = this.validate();
2560
2567
  if (!result.success) {
@@ -2562,18 +2569,20 @@ var ToolMcp = class extends ToolFile {
2562
2569
  }
2563
2570
  }
2564
2571
  }
2565
- getJson() {
2566
- return this.json;
2567
- }
2568
2572
  static getSettablePaths() {
2569
2573
  throw new Error("Please implement this method in the subclass.");
2570
2574
  }
2571
- toRulesyncMcpDefault() {
2575
+ static getToolTargetsGlobal() {
2576
+ throw new Error("Please implement this method in the subclass.");
2577
+ }
2578
+ toRulesyncMcpDefault({
2579
+ fileContent = void 0
2580
+ } = {}) {
2572
2581
  return new RulesyncMcp({
2573
2582
  baseDir: this.baseDir,
2574
2583
  relativeDirPath: ".rulesync",
2575
2584
  relativeFilePath: ".mcp.json",
2576
- fileContent: this.fileContent
2585
+ fileContent: fileContent ?? this.fileContent
2577
2586
  });
2578
2587
  }
2579
2588
  static async fromFile(_params) {
@@ -2586,6 +2595,14 @@ var ToolMcp = class extends ToolFile {
2586
2595
 
2587
2596
  // src/mcp/amazonqcli-mcp.ts
2588
2597
  var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
2598
+ json;
2599
+ constructor(params) {
2600
+ super(params);
2601
+ this.json = this.fileContent !== void 0 ? JSON.parse(this.fileContent) : {};
2602
+ }
2603
+ getJson() {
2604
+ return this.json;
2605
+ }
2589
2606
  static getSettablePaths() {
2590
2607
  return {
2591
2608
  relativeDirPath: ".amazonq",
@@ -2635,46 +2652,71 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
2635
2652
  // src/mcp/claudecode-mcp.ts
2636
2653
  import { join as join26 } from "path";
2637
2654
  var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
2655
+ json;
2656
+ constructor(params) {
2657
+ super(params);
2658
+ this.json = JSON.parse(this.fileContent || "{}");
2659
+ }
2660
+ getJson() {
2661
+ return this.json;
2662
+ }
2638
2663
  static getSettablePaths() {
2639
2664
  return {
2640
2665
  relativeDirPath: ".",
2641
2666
  relativeFilePath: ".mcp.json"
2642
2667
  };
2643
2668
  }
2669
+ static getSettablePathsGlobal() {
2670
+ return {
2671
+ relativeDirPath: ".claude",
2672
+ relativeFilePath: ".claude.json"
2673
+ };
2674
+ }
2644
2675
  static async fromFile({
2645
2676
  baseDir = ".",
2646
- validate = true
2677
+ validate = true,
2678
+ global = false
2647
2679
  }) {
2648
- const fileContent = await readFileContent(
2649
- join26(
2650
- baseDir,
2651
- this.getSettablePaths().relativeDirPath,
2652
- this.getSettablePaths().relativeFilePath
2653
- )
2680
+ const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
2681
+ const fileContent = await readOrInitializeFileContent(
2682
+ join26(baseDir, paths.relativeDirPath, paths.relativeFilePath),
2683
+ JSON.stringify({ mcpServers: {} }, null, 2)
2654
2684
  );
2685
+ const json = JSON.parse(fileContent);
2686
+ const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
2655
2687
  return new _ClaudecodeMcp({
2656
2688
  baseDir,
2657
- relativeDirPath: this.getSettablePaths().relativeDirPath,
2658
- relativeFilePath: this.getSettablePaths().relativeFilePath,
2659
- fileContent,
2689
+ relativeDirPath: paths.relativeDirPath,
2690
+ relativeFilePath: paths.relativeFilePath,
2691
+ fileContent: JSON.stringify(newJson, null, 2),
2660
2692
  validate
2661
2693
  });
2662
2694
  }
2663
- static fromRulesyncMcp({
2695
+ static async fromRulesyncMcp({
2664
2696
  baseDir = ".",
2665
2697
  rulesyncMcp,
2666
- validate = true
2698
+ validate = true,
2699
+ global = false
2667
2700
  }) {
2701
+ const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
2702
+ const fileContent = await readOrInitializeFileContent(
2703
+ join26(baseDir, paths.relativeDirPath, paths.relativeFilePath),
2704
+ JSON.stringify({ mcpServers: {} }, null, 2)
2705
+ );
2706
+ const json = JSON.parse(fileContent);
2707
+ const newJson = { ...json, mcpServers: rulesyncMcp.getJson().mcpServers };
2668
2708
  return new _ClaudecodeMcp({
2669
2709
  baseDir,
2670
- relativeDirPath: this.getSettablePaths().relativeDirPath,
2671
- relativeFilePath: this.getSettablePaths().relativeFilePath,
2672
- fileContent: rulesyncMcp.getFileContent(),
2710
+ relativeDirPath: paths.relativeDirPath,
2711
+ relativeFilePath: paths.relativeFilePath,
2712
+ fileContent: JSON.stringify(newJson, null, 2),
2673
2713
  validate
2674
2714
  });
2675
2715
  }
2676
2716
  toRulesyncMcp() {
2677
- return this.toRulesyncMcpDefault();
2717
+ return this.toRulesyncMcpDefault({
2718
+ fileContent: JSON.stringify({ mcpServers: this.json.mcpServers }, null, 2)
2719
+ });
2678
2720
  }
2679
2721
  validate() {
2680
2722
  return { success: true, error: null };
@@ -2684,6 +2726,14 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
2684
2726
  // src/mcp/cline-mcp.ts
2685
2727
  import { join as join27 } from "path";
2686
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
+ }
2687
2737
  static getSettablePaths() {
2688
2738
  return {
2689
2739
  relativeDirPath: ".cline",
@@ -2730,9 +2780,111 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
2730
2780
  }
2731
2781
  };
2732
2782
 
2733
- // src/mcp/copilot-mcp.ts
2783
+ // src/mcp/codexcli-mcp.ts
2734
2784
  import { join as join28 } from "path";
2785
+ import * as smolToml from "smol-toml";
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
+ join28(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 = join28(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 ?? {} }, null, 2)
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
+ import { join as join29 } from "path";
2735
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
+ }
2736
2888
  static getSettablePaths() {
2737
2889
  return {
2738
2890
  relativeDirPath: ".vscode",
@@ -2744,7 +2896,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
2744
2896
  validate = true
2745
2897
  }) {
2746
2898
  const fileContent = await readFileContent(
2747
- join28(
2899
+ join29(
2748
2900
  baseDir,
2749
2901
  this.getSettablePaths().relativeDirPath,
2750
2902
  this.getSettablePaths().relativeFilePath
@@ -2780,8 +2932,16 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
2780
2932
  };
2781
2933
 
2782
2934
  // src/mcp/cursor-mcp.ts
2783
- import { join as join29 } from "path";
2935
+ import { join as join30 } from "path";
2784
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
+ }
2785
2945
  static getSettablePaths() {
2786
2946
  return {
2787
2947
  relativeDirPath: ".cursor",
@@ -2793,7 +2953,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
2793
2953
  validate = true
2794
2954
  }) {
2795
2955
  const fileContent = await readFileContent(
2796
- join29(
2956
+ join30(
2797
2957
  baseDir,
2798
2958
  this.getSettablePaths().relativeDirPath,
2799
2959
  this.getSettablePaths().relativeFilePath
@@ -2840,8 +3000,16 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
2840
3000
  };
2841
3001
 
2842
3002
  // src/mcp/roo-mcp.ts
2843
- import { join as join30 } from "path";
3003
+ import { join as join31 } from "path";
2844
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
+ }
2845
3013
  static getSettablePaths() {
2846
3014
  return {
2847
3015
  relativeDirPath: ".roo",
@@ -2853,7 +3021,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
2853
3021
  validate = true
2854
3022
  }) {
2855
3023
  const fileContent = await readFileContent(
2856
- join30(
3024
+ join31(
2857
3025
  baseDir,
2858
3026
  this.getSettablePaths().relativeDirPath,
2859
3027
  this.getSettablePaths().relativeFilePath
@@ -2898,15 +3066,22 @@ var mcpProcessorToolTargets = [
2898
3066
  "cursor",
2899
3067
  "roo"
2900
3068
  ];
2901
- var McpProcessorToolTargetSchema = z11.enum(mcpProcessorToolTargets);
3069
+ var McpProcessorToolTargetSchema = z11.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 = ["claudecode", "codexcli"];
2902
3074
  var McpProcessor = class extends FeatureProcessor {
2903
3075
  toolTarget;
3076
+ global;
2904
3077
  constructor({
2905
3078
  baseDir = ".",
2906
- toolTarget
3079
+ toolTarget,
3080
+ global = false
2907
3081
  }) {
2908
3082
  super({ baseDir });
2909
3083
  this.toolTarget = McpProcessorToolTargetSchema.parse(toolTarget);
3084
+ this.global = global;
2910
3085
  }
2911
3086
  /**
2912
3087
  * Implementation of abstract method from FeatureProcessor
@@ -2921,6 +3096,11 @@ var McpProcessor = class extends FeatureProcessor {
2921
3096
  }
2922
3097
  }
2923
3098
  async loadToolFilesToDelete() {
3099
+ if (this.global) {
3100
+ return (await this.loadToolFiles()).filter(
3101
+ (toolFile) => !(toolFile instanceof ClaudecodeMcp)
3102
+ );
3103
+ }
2924
3104
  return this.loadToolFiles();
2925
3105
  }
2926
3106
  /**
@@ -2943,7 +3123,8 @@ var McpProcessor = class extends FeatureProcessor {
2943
3123
  return [
2944
3124
  await ClaudecodeMcp.fromFile({
2945
3125
  baseDir: this.baseDir,
2946
- validate: true
3126
+ validate: true,
3127
+ global: this.global
2947
3128
  })
2948
3129
  ];
2949
3130
  }
@@ -2955,6 +3136,15 @@ var McpProcessor = class extends FeatureProcessor {
2955
3136
  })
2956
3137
  ];
2957
3138
  }
3139
+ case "codexcli": {
3140
+ return [
3141
+ await CodexcliMcp.fromFile({
3142
+ baseDir: this.baseDir,
3143
+ validate: true,
3144
+ global: this.global
3145
+ })
3146
+ ];
3147
+ }
2958
3148
  case "copilot": {
2959
3149
  return [
2960
3150
  await CopilotMcp.fromFile({
@@ -3001,42 +3191,51 @@ var McpProcessor = class extends FeatureProcessor {
3001
3191
  if (!rulesyncMcp) {
3002
3192
  throw new Error(`No .rulesync/.mcp.json found.`);
3003
3193
  }
3004
- const toolMcps = [rulesyncMcp].map((rulesyncMcp2) => {
3005
- switch (this.toolTarget) {
3006
- case "amazonqcli":
3007
- return AmazonqcliMcp.fromRulesyncMcp({
3008
- baseDir: this.baseDir,
3009
- rulesyncMcp: rulesyncMcp2
3010
- });
3011
- case "claudecode":
3012
- return ClaudecodeMcp.fromRulesyncMcp({
3013
- baseDir: this.baseDir,
3014
- rulesyncMcp: rulesyncMcp2
3015
- });
3016
- case "cline":
3017
- return ClineMcp.fromRulesyncMcp({
3018
- baseDir: this.baseDir,
3019
- rulesyncMcp: rulesyncMcp2
3020
- });
3021
- case "copilot":
3022
- return CopilotMcp.fromRulesyncMcp({
3023
- baseDir: this.baseDir,
3024
- rulesyncMcp: rulesyncMcp2
3025
- });
3026
- case "cursor":
3027
- return CursorMcp.fromRulesyncMcp({
3028
- baseDir: this.baseDir,
3029
- rulesyncMcp: rulesyncMcp2
3030
- });
3031
- case "roo":
3032
- return RooMcp.fromRulesyncMcp({
3033
- baseDir: this.baseDir,
3034
- rulesyncMcp: rulesyncMcp2
3035
- });
3036
- default:
3037
- throw new Error(`Unsupported tool target: ${this.toolTarget}`);
3038
- }
3039
- });
3194
+ const toolMcps = await Promise.all(
3195
+ [rulesyncMcp].map(async (rulesyncMcp2) => {
3196
+ switch (this.toolTarget) {
3197
+ case "amazonqcli":
3198
+ return AmazonqcliMcp.fromRulesyncMcp({
3199
+ baseDir: this.baseDir,
3200
+ rulesyncMcp: rulesyncMcp2
3201
+ });
3202
+ case "claudecode":
3203
+ return ClaudecodeMcp.fromRulesyncMcp({
3204
+ baseDir: this.baseDir,
3205
+ rulesyncMcp: rulesyncMcp2,
3206
+ global: this.global
3207
+ });
3208
+ case "cline":
3209
+ return ClineMcp.fromRulesyncMcp({
3210
+ baseDir: this.baseDir,
3211
+ rulesyncMcp: rulesyncMcp2
3212
+ });
3213
+ case "copilot":
3214
+ return CopilotMcp.fromRulesyncMcp({
3215
+ baseDir: this.baseDir,
3216
+ rulesyncMcp: rulesyncMcp2
3217
+ });
3218
+ case "cursor":
3219
+ return CursorMcp.fromRulesyncMcp({
3220
+ baseDir: this.baseDir,
3221
+ rulesyncMcp: rulesyncMcp2
3222
+ });
3223
+ case "codexcli":
3224
+ return await CodexcliMcp.fromRulesyncMcp({
3225
+ baseDir: this.baseDir,
3226
+ rulesyncMcp: rulesyncMcp2,
3227
+ global: this.global
3228
+ });
3229
+ case "roo":
3230
+ return RooMcp.fromRulesyncMcp({
3231
+ baseDir: this.baseDir,
3232
+ rulesyncMcp: rulesyncMcp2
3233
+ });
3234
+ default:
3235
+ throw new Error(`Unsupported tool target: ${this.toolTarget}`);
3236
+ }
3237
+ })
3238
+ );
3040
3239
  return toolMcps;
3041
3240
  }
3042
3241
  /**
@@ -3057,15 +3256,18 @@ var McpProcessor = class extends FeatureProcessor {
3057
3256
  static getToolTargets() {
3058
3257
  return mcpProcessorToolTargets;
3059
3258
  }
3259
+ static getToolTargetsGlobal() {
3260
+ return mcpProcessorToolTargetsGlobal;
3261
+ }
3060
3262
  };
3061
3263
 
3062
3264
  // src/rules/rules-processor.ts
3063
- import { basename as basename17, join as join54 } from "path";
3265
+ import { basename as basename17, join as join55 } from "path";
3064
3266
  import { XMLBuilder } from "fast-xml-parser";
3065
3267
  import { z as z20 } from "zod/mini";
3066
3268
 
3067
3269
  // src/subagents/simulated-subagent.ts
3068
- import { basename as basename12, join as join31 } from "path";
3270
+ import { basename as basename12, join as join32 } from "path";
3069
3271
  import { z as z12 } from "zod/mini";
3070
3272
 
3071
3273
  // src/subagents/tool-subagent.ts
@@ -3167,7 +3369,7 @@ var SimulatedSubagent = class extends ToolSubagent {
3167
3369
  relativeFilePath,
3168
3370
  validate = true
3169
3371
  }) {
3170
- const filePath = join31(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
3372
+ const filePath = join32(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
3171
3373
  const fileContent = await readFileContent(filePath);
3172
3374
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
3173
3375
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -3324,15 +3526,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
3324
3526
  };
3325
3527
 
3326
3528
  // src/subagents/subagents-processor.ts
3327
- import { basename as basename14, join as join34 } from "path";
3529
+ import { basename as basename14, join as join35 } from "path";
3328
3530
  import { z as z15 } from "zod/mini";
3329
3531
 
3330
3532
  // src/subagents/claudecode-subagent.ts
3331
- import { join as join33 } from "path";
3533
+ import { join as join34 } from "path";
3332
3534
  import { z as z14 } from "zod/mini";
3333
3535
 
3334
3536
  // src/subagents/rulesync-subagent.ts
3335
- import { basename as basename13, join as join32 } from "path";
3537
+ import { basename as basename13, join as join33 } from "path";
3336
3538
  import { z as z13 } from "zod/mini";
3337
3539
  var RulesyncSubagentModelSchema = z13.enum(["opus", "sonnet", "haiku", "inherit"]);
3338
3540
  var RulesyncSubagentFrontmatterSchema = z13.object({
@@ -3386,7 +3588,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
3386
3588
  static async fromFile({
3387
3589
  relativeFilePath
3388
3590
  }) {
3389
- const fileContent = await readFileContent(join32(".rulesync/subagents", relativeFilePath));
3591
+ const fileContent = await readFileContent(join33(".rulesync/subagents", relativeFilePath));
3390
3592
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
3391
3593
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
3392
3594
  if (!result.success) {
@@ -3504,7 +3706,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
3504
3706
  relativeFilePath,
3505
3707
  validate = true
3506
3708
  }) {
3507
- const fileContent = await readFileContent(join33(baseDir, ".claude/agents", relativeFilePath));
3709
+ const fileContent = await readFileContent(join34(baseDir, ".claude/agents", relativeFilePath));
3508
3710
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
3509
3711
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
3510
3712
  if (!result.success) {
@@ -3646,7 +3848,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
3646
3848
  * Load and parse rulesync subagent files from .rulesync/subagents/ directory
3647
3849
  */
3648
3850
  async loadRulesyncFiles() {
3649
- const subagentsDir = join34(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
3851
+ const subagentsDir = join35(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
3650
3852
  const dirExists = await directoryExists(subagentsDir);
3651
3853
  if (!dirExists) {
3652
3854
  logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
@@ -3661,7 +3863,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
3661
3863
  logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
3662
3864
  const rulesyncSubagents = [];
3663
3865
  for (const mdFile of mdFiles) {
3664
- const filepath = join34(subagentsDir, mdFile);
3866
+ const filepath = join35(subagentsDir, mdFile);
3665
3867
  try {
3666
3868
  const rulesyncSubagent = await RulesyncSubagent.fromFile({
3667
3869
  relativeFilePath: mdFile,
@@ -3775,7 +3977,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
3775
3977
  relativeDirPath,
3776
3978
  fromFile
3777
3979
  }) {
3778
- const paths = await findFilesByGlobs(join34(this.baseDir, relativeDirPath, "*.md"));
3980
+ const paths = await findFilesByGlobs(join35(this.baseDir, relativeDirPath, "*.md"));
3779
3981
  const subagents = (await Promise.allSettled(paths.map((path2) => fromFile(basename14(path2))))).filter((r) => r.status === "fulfilled").map((r) => r.value);
3780
3982
  logger.info(`Successfully loaded ${subagents.length} ${relativeDirPath} subagents`);
3781
3983
  return subagents;
@@ -3800,13 +4002,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
3800
4002
  };
3801
4003
 
3802
4004
  // src/rules/agentsmd-rule.ts
3803
- import { join as join37 } from "path";
4005
+ import { join as join38 } from "path";
3804
4006
 
3805
4007
  // src/rules/tool-rule.ts
3806
- import { join as join36 } from "path";
4008
+ import { join as join37 } from "path";
3807
4009
 
3808
4010
  // src/rules/rulesync-rule.ts
3809
- import { basename as basename15, join as join35 } from "path";
4011
+ import { basename as basename15, join as join36 } from "path";
3810
4012
  import { z as z16 } from "zod/mini";
3811
4013
  var RulesyncRuleFrontmatterSchema = z16.object({
3812
4014
  root: z16.optional(z16.optional(z16.boolean())),
@@ -3872,7 +4074,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
3872
4074
  relativeFilePath,
3873
4075
  validate = true
3874
4076
  }) {
3875
- const filePath = join35(this.getSettablePaths().legacy.relativeDirPath, relativeFilePath);
4077
+ const filePath = join36(this.getSettablePaths().legacy.relativeDirPath, relativeFilePath);
3876
4078
  const fileContent = await readFileContent(filePath);
3877
4079
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
3878
4080
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
@@ -3901,7 +4103,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
3901
4103
  relativeFilePath,
3902
4104
  validate = true
3903
4105
  }) {
3904
- const filePath = join35(this.getSettablePaths().recommended.relativeDirPath, relativeFilePath);
4106
+ const filePath = join36(this.getSettablePaths().recommended.relativeDirPath, relativeFilePath);
3905
4107
  const fileContent = await readFileContent(filePath);
3906
4108
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
3907
4109
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
@@ -4005,7 +4207,7 @@ var ToolRule = class extends ToolFile {
4005
4207
  });
4006
4208
  const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
4007
4209
  if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
4008
- params.relativeDirPath = join36(rulesyncFrontmatter.agentsmd.subprojectPath);
4210
+ params.relativeDirPath = join37(rulesyncFrontmatter.agentsmd.subprojectPath);
4009
4211
  params.relativeFilePath = "AGENTS.md";
4010
4212
  }
4011
4213
  return params;
@@ -4081,8 +4283,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
4081
4283
  validate = true
4082
4284
  }) {
4083
4285
  const isRoot = relativeFilePath === "AGENTS.md";
4084
- const relativePath = isRoot ? "AGENTS.md" : join37(".agents/memories", relativeFilePath);
4085
- const fileContent = await readFileContent(join37(baseDir, relativePath));
4286
+ const relativePath = isRoot ? "AGENTS.md" : join38(".agents/memories", relativeFilePath);
4287
+ const fileContent = await readFileContent(join38(baseDir, relativePath));
4086
4288
  return new _AgentsMdRule({
4087
4289
  baseDir,
4088
4290
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -4122,7 +4324,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
4122
4324
  };
4123
4325
 
4124
4326
  // src/rules/amazonqcli-rule.ts
4125
- import { join as join38 } from "path";
4327
+ import { join as join39 } from "path";
4126
4328
  var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
4127
4329
  static getSettablePaths() {
4128
4330
  return {
@@ -4137,7 +4339,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
4137
4339
  validate = true
4138
4340
  }) {
4139
4341
  const fileContent = await readFileContent(
4140
- join38(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4342
+ join39(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4141
4343
  );
4142
4344
  return new _AmazonQCliRule({
4143
4345
  baseDir,
@@ -4177,7 +4379,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
4177
4379
  };
4178
4380
 
4179
4381
  // src/rules/augmentcode-legacy-rule.ts
4180
- import { join as join39 } from "path";
4382
+ import { join as join40 } from "path";
4181
4383
  var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
4182
4384
  toRulesyncRule() {
4183
4385
  const rulesyncFrontmatter = {
@@ -4238,8 +4440,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
4238
4440
  }) {
4239
4441
  const settablePaths = this.getSettablePaths();
4240
4442
  const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
4241
- const relativePath = isRoot ? settablePaths.root.relativeFilePath : join39(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
4242
- const fileContent = await readFileContent(join39(baseDir, relativePath));
4443
+ const relativePath = isRoot ? settablePaths.root.relativeFilePath : join40(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
4444
+ const fileContent = await readFileContent(join40(baseDir, relativePath));
4243
4445
  return new _AugmentcodeLegacyRule({
4244
4446
  baseDir,
4245
4447
  relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
@@ -4252,7 +4454,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
4252
4454
  };
4253
4455
 
4254
4456
  // src/rules/augmentcode-rule.ts
4255
- import { join as join40 } from "path";
4457
+ import { join as join41 } from "path";
4256
4458
  var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
4257
4459
  toRulesyncRule() {
4258
4460
  return this.toRulesyncRuleDefault();
@@ -4284,7 +4486,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
4284
4486
  validate = true
4285
4487
  }) {
4286
4488
  const fileContent = await readFileContent(
4287
- join40(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4489
+ join41(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4288
4490
  );
4289
4491
  const { body: content } = parseFrontmatter(fileContent);
4290
4492
  return new _AugmentcodeRule({
@@ -4307,7 +4509,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
4307
4509
  };
4308
4510
 
4309
4511
  // src/rules/claudecode-rule.ts
4310
- import { join as join41 } from "path";
4512
+ import { join as join42 } from "path";
4311
4513
  var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
4312
4514
  static getSettablePaths() {
4313
4515
  return {
@@ -4316,7 +4518,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
4316
4518
  relativeFilePath: "CLAUDE.md"
4317
4519
  },
4318
4520
  nonRoot: {
4319
- relativeDirPath: join41(".claude", "memories")
4521
+ relativeDirPath: join42(".claude", "memories")
4320
4522
  }
4321
4523
  };
4322
4524
  }
@@ -4339,7 +4541,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
4339
4541
  if (isRoot) {
4340
4542
  const relativePath2 = paths.root.relativeFilePath;
4341
4543
  const fileContent2 = await readFileContent(
4342
- join41(baseDir, paths.root.relativeDirPath, relativePath2)
4544
+ join42(baseDir, paths.root.relativeDirPath, relativePath2)
4343
4545
  );
4344
4546
  return new _ClaudecodeRule({
4345
4547
  baseDir,
@@ -4353,8 +4555,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
4353
4555
  if (!paths.nonRoot) {
4354
4556
  throw new Error("nonRoot path is not set");
4355
4557
  }
4356
- const relativePath = join41(paths.nonRoot.relativeDirPath, relativeFilePath);
4357
- const fileContent = await readFileContent(join41(baseDir, relativePath));
4558
+ const relativePath = join42(paths.nonRoot.relativeDirPath, relativeFilePath);
4559
+ const fileContent = await readFileContent(join42(baseDir, relativePath));
4358
4560
  return new _ClaudecodeRule({
4359
4561
  baseDir,
4360
4562
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -4396,7 +4598,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
4396
4598
  };
4397
4599
 
4398
4600
  // src/rules/cline-rule.ts
4399
- import { join as join42 } from "path";
4601
+ import { join as join43 } from "path";
4400
4602
  import { z as z17 } from "zod/mini";
4401
4603
  var ClineRuleFrontmatterSchema = z17.object({
4402
4604
  description: z17.string()
@@ -4441,7 +4643,7 @@ var ClineRule = class _ClineRule extends ToolRule {
4441
4643
  validate = true
4442
4644
  }) {
4443
4645
  const fileContent = await readFileContent(
4444
- join42(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4646
+ join43(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4445
4647
  );
4446
4648
  return new _ClineRule({
4447
4649
  baseDir,
@@ -4454,7 +4656,7 @@ var ClineRule = class _ClineRule extends ToolRule {
4454
4656
  };
4455
4657
 
4456
4658
  // src/rules/codexcli-rule.ts
4457
- import { join as join43 } from "path";
4659
+ import { join as join44 } from "path";
4458
4660
  var CodexcliRule = class _CodexcliRule extends ToolRule {
4459
4661
  static getSettablePaths() {
4460
4662
  return {
@@ -4486,7 +4688,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
4486
4688
  if (isRoot) {
4487
4689
  const relativePath2 = paths.root.relativeFilePath;
4488
4690
  const fileContent2 = await readFileContent(
4489
- join43(baseDir, paths.root.relativeDirPath, relativePath2)
4691
+ join44(baseDir, paths.root.relativeDirPath, relativePath2)
4490
4692
  );
4491
4693
  return new _CodexcliRule({
4492
4694
  baseDir,
@@ -4500,8 +4702,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
4500
4702
  if (!paths.nonRoot) {
4501
4703
  throw new Error("nonRoot path is not set");
4502
4704
  }
4503
- const relativePath = join43(paths.nonRoot.relativeDirPath, relativeFilePath);
4504
- const fileContent = await readFileContent(join43(baseDir, relativePath));
4705
+ const relativePath = join44(paths.nonRoot.relativeDirPath, relativeFilePath);
4706
+ const fileContent = await readFileContent(join44(baseDir, relativePath));
4505
4707
  return new _CodexcliRule({
4506
4708
  baseDir,
4507
4709
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -4543,7 +4745,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
4543
4745
  };
4544
4746
 
4545
4747
  // src/rules/copilot-rule.ts
4546
- import { join as join44 } from "path";
4748
+ import { join as join45 } from "path";
4547
4749
  import { z as z18 } from "zod/mini";
4548
4750
  var CopilotRuleFrontmatterSchema = z18.object({
4549
4751
  description: z18.optional(z18.string()),
@@ -4636,11 +4838,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
4636
4838
  validate = true
4637
4839
  }) {
4638
4840
  const isRoot = relativeFilePath === "copilot-instructions.md";
4639
- const relativePath = isRoot ? join44(
4841
+ const relativePath = isRoot ? join45(
4640
4842
  this.getSettablePaths().root.relativeDirPath,
4641
4843
  this.getSettablePaths().root.relativeFilePath
4642
- ) : join44(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
4643
- const fileContent = await readFileContent(join44(baseDir, relativePath));
4844
+ ) : join45(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
4845
+ const fileContent = await readFileContent(join45(baseDir, relativePath));
4644
4846
  if (isRoot) {
4645
4847
  return new _CopilotRule({
4646
4848
  baseDir,
@@ -4659,7 +4861,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
4659
4861
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
4660
4862
  if (!result.success) {
4661
4863
  throw new Error(
4662
- `Invalid frontmatter in ${join44(baseDir, relativeFilePath)}: ${result.error.message}`
4864
+ `Invalid frontmatter in ${join45(baseDir, relativeFilePath)}: ${result.error.message}`
4663
4865
  );
4664
4866
  }
4665
4867
  return new _CopilotRule({
@@ -4698,7 +4900,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
4698
4900
  };
4699
4901
 
4700
4902
  // src/rules/cursor-rule.ts
4701
- import { basename as basename16, join as join45 } from "path";
4903
+ import { basename as basename16, join as join46 } from "path";
4702
4904
  import { z as z19 } from "zod/mini";
4703
4905
  var CursorRuleFrontmatterSchema = z19.object({
4704
4906
  description: z19.optional(z19.string()),
@@ -4825,13 +5027,13 @@ var CursorRule = class _CursorRule extends ToolRule {
4825
5027
  validate = true
4826
5028
  }) {
4827
5029
  const fileContent = await readFileContent(
4828
- join45(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5030
+ join46(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4829
5031
  );
4830
5032
  const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
4831
5033
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
4832
5034
  if (!result.success) {
4833
5035
  throw new Error(
4834
- `Invalid frontmatter in ${join45(baseDir, relativeFilePath)}: ${result.error.message}`
5036
+ `Invalid frontmatter in ${join46(baseDir, relativeFilePath)}: ${result.error.message}`
4835
5037
  );
4836
5038
  }
4837
5039
  return new _CursorRule({
@@ -4869,7 +5071,7 @@ var CursorRule = class _CursorRule extends ToolRule {
4869
5071
  };
4870
5072
 
4871
5073
  // src/rules/geminicli-rule.ts
4872
- import { join as join46 } from "path";
5074
+ import { join as join47 } from "path";
4873
5075
  var GeminiCliRule = class _GeminiCliRule extends ToolRule {
4874
5076
  static getSettablePaths() {
4875
5077
  return {
@@ -4901,7 +5103,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
4901
5103
  if (isRoot) {
4902
5104
  const relativePath2 = paths.root.relativeFilePath;
4903
5105
  const fileContent2 = await readFileContent(
4904
- join46(baseDir, paths.root.relativeDirPath, relativePath2)
5106
+ join47(baseDir, paths.root.relativeDirPath, relativePath2)
4905
5107
  );
4906
5108
  return new _GeminiCliRule({
4907
5109
  baseDir,
@@ -4915,8 +5117,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
4915
5117
  if (!paths.nonRoot) {
4916
5118
  throw new Error("nonRoot path is not set");
4917
5119
  }
4918
- const relativePath = join46(paths.nonRoot.relativeDirPath, relativeFilePath);
4919
- const fileContent = await readFileContent(join46(baseDir, relativePath));
5120
+ const relativePath = join47(paths.nonRoot.relativeDirPath, relativeFilePath);
5121
+ const fileContent = await readFileContent(join47(baseDir, relativePath));
4920
5122
  return new _GeminiCliRule({
4921
5123
  baseDir,
4922
5124
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -4958,7 +5160,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
4958
5160
  };
4959
5161
 
4960
5162
  // src/rules/junie-rule.ts
4961
- import { join as join47 } from "path";
5163
+ import { join as join48 } from "path";
4962
5164
  var JunieRule = class _JunieRule extends ToolRule {
4963
5165
  static getSettablePaths() {
4964
5166
  return {
@@ -4977,8 +5179,8 @@ var JunieRule = class _JunieRule extends ToolRule {
4977
5179
  validate = true
4978
5180
  }) {
4979
5181
  const isRoot = relativeFilePath === "guidelines.md";
4980
- const relativePath = isRoot ? "guidelines.md" : join47(".junie/memories", relativeFilePath);
4981
- const fileContent = await readFileContent(join47(baseDir, relativePath));
5182
+ const relativePath = isRoot ? "guidelines.md" : join48(".junie/memories", relativeFilePath);
5183
+ const fileContent = await readFileContent(join48(baseDir, relativePath));
4982
5184
  return new _JunieRule({
4983
5185
  baseDir,
4984
5186
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -5018,7 +5220,7 @@ var JunieRule = class _JunieRule extends ToolRule {
5018
5220
  };
5019
5221
 
5020
5222
  // src/rules/kiro-rule.ts
5021
- import { join as join48 } from "path";
5223
+ import { join as join49 } from "path";
5022
5224
  var KiroRule = class _KiroRule extends ToolRule {
5023
5225
  static getSettablePaths() {
5024
5226
  return {
@@ -5033,7 +5235,7 @@ var KiroRule = class _KiroRule extends ToolRule {
5033
5235
  validate = true
5034
5236
  }) {
5035
5237
  const fileContent = await readFileContent(
5036
- join48(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5238
+ join49(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5037
5239
  );
5038
5240
  return new _KiroRule({
5039
5241
  baseDir,
@@ -5073,7 +5275,7 @@ var KiroRule = class _KiroRule extends ToolRule {
5073
5275
  };
5074
5276
 
5075
5277
  // src/rules/opencode-rule.ts
5076
- import { join as join49 } from "path";
5278
+ import { join as join50 } from "path";
5077
5279
  var OpenCodeRule = class _OpenCodeRule extends ToolRule {
5078
5280
  static getSettablePaths() {
5079
5281
  return {
@@ -5092,8 +5294,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
5092
5294
  validate = true
5093
5295
  }) {
5094
5296
  const isRoot = relativeFilePath === "AGENTS.md";
5095
- const relativePath = isRoot ? "AGENTS.md" : join49(".opencode/memories", relativeFilePath);
5096
- const fileContent = await readFileContent(join49(baseDir, relativePath));
5297
+ const relativePath = isRoot ? "AGENTS.md" : join50(".opencode/memories", relativeFilePath);
5298
+ const fileContent = await readFileContent(join50(baseDir, relativePath));
5097
5299
  return new _OpenCodeRule({
5098
5300
  baseDir,
5099
5301
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -5133,7 +5335,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
5133
5335
  };
5134
5336
 
5135
5337
  // src/rules/qwencode-rule.ts
5136
- import { join as join50 } from "path";
5338
+ import { join as join51 } from "path";
5137
5339
  var QwencodeRule = class _QwencodeRule extends ToolRule {
5138
5340
  static getSettablePaths() {
5139
5341
  return {
@@ -5152,8 +5354,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
5152
5354
  validate = true
5153
5355
  }) {
5154
5356
  const isRoot = relativeFilePath === "QWEN.md";
5155
- const relativePath = isRoot ? "QWEN.md" : join50(".qwen/memories", relativeFilePath);
5156
- const fileContent = await readFileContent(join50(baseDir, relativePath));
5357
+ const relativePath = isRoot ? "QWEN.md" : join51(".qwen/memories", relativeFilePath);
5358
+ const fileContent = await readFileContent(join51(baseDir, relativePath));
5157
5359
  return new _QwencodeRule({
5158
5360
  baseDir,
5159
5361
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -5190,7 +5392,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
5190
5392
  };
5191
5393
 
5192
5394
  // src/rules/roo-rule.ts
5193
- import { join as join51 } from "path";
5395
+ import { join as join52 } from "path";
5194
5396
  var RooRule = class _RooRule extends ToolRule {
5195
5397
  static getSettablePaths() {
5196
5398
  return {
@@ -5205,7 +5407,7 @@ var RooRule = class _RooRule extends ToolRule {
5205
5407
  validate = true
5206
5408
  }) {
5207
5409
  const fileContent = await readFileContent(
5208
- join51(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5410
+ join52(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5209
5411
  );
5210
5412
  return new _RooRule({
5211
5413
  baseDir,
@@ -5260,7 +5462,7 @@ var RooRule = class _RooRule extends ToolRule {
5260
5462
  };
5261
5463
 
5262
5464
  // src/rules/warp-rule.ts
5263
- import { join as join52 } from "path";
5465
+ import { join as join53 } from "path";
5264
5466
  var WarpRule = class _WarpRule extends ToolRule {
5265
5467
  constructor({ fileContent, root, ...rest }) {
5266
5468
  super({
@@ -5286,8 +5488,8 @@ var WarpRule = class _WarpRule extends ToolRule {
5286
5488
  validate = true
5287
5489
  }) {
5288
5490
  const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
5289
- const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join52(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
5290
- const fileContent = await readFileContent(join52(baseDir, relativePath));
5491
+ const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join53(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
5492
+ const fileContent = await readFileContent(join53(baseDir, relativePath));
5291
5493
  return new _WarpRule({
5292
5494
  baseDir,
5293
5495
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
@@ -5327,7 +5529,7 @@ var WarpRule = class _WarpRule extends ToolRule {
5327
5529
  };
5328
5530
 
5329
5531
  // src/rules/windsurf-rule.ts
5330
- import { join as join53 } from "path";
5532
+ import { join as join54 } from "path";
5331
5533
  var WindsurfRule = class _WindsurfRule extends ToolRule {
5332
5534
  static getSettablePaths() {
5333
5535
  return {
@@ -5342,7 +5544,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
5342
5544
  validate = true
5343
5545
  }) {
5344
5546
  const fileContent = await readFileContent(
5345
- join53(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5547
+ join54(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5346
5548
  );
5347
5549
  return new _WindsurfRule({
5348
5550
  baseDir,
@@ -5736,7 +5938,7 @@ var RulesProcessor = class extends FeatureProcessor {
5736
5938
  * Load and parse rulesync rule files from .rulesync/rules/ directory
5737
5939
  */
5738
5940
  async loadRulesyncFiles() {
5739
- const files = await findFilesByGlobs(join54(".rulesync/rules", "*.md"));
5941
+ const files = await findFilesByGlobs(join55(".rulesync/rules", "*.md"));
5740
5942
  logger.debug(`Found ${files.length} rulesync files`);
5741
5943
  const rulesyncRules = await Promise.all(
5742
5944
  files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename17(file) }))
@@ -5757,7 +5959,7 @@ var RulesProcessor = class extends FeatureProcessor {
5757
5959
  return rulesyncRules;
5758
5960
  }
5759
5961
  async loadRulesyncFilesLegacy() {
5760
- const legacyFiles = await findFilesByGlobs(join54(".rulesync", "*.md"));
5962
+ const legacyFiles = await findFilesByGlobs(join55(".rulesync", "*.md"));
5761
5963
  logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
5762
5964
  return Promise.all(
5763
5965
  legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename17(file) }))
@@ -5824,7 +6026,7 @@ var RulesProcessor = class extends FeatureProcessor {
5824
6026
  return [];
5825
6027
  }
5826
6028
  const rootFilePaths = await findFilesByGlobs(
5827
- join54(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
6029
+ join55(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
5828
6030
  );
5829
6031
  return await Promise.all(
5830
6032
  rootFilePaths.map(
@@ -5842,7 +6044,7 @@ var RulesProcessor = class extends FeatureProcessor {
5842
6044
  return [];
5843
6045
  }
5844
6046
  const nonRootFilePaths = await findFilesByGlobs(
5845
- join54(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
6047
+ join55(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
5846
6048
  );
5847
6049
  return await Promise.all(
5848
6050
  nonRootFilePaths.map(
@@ -6218,14 +6420,14 @@ s/<command> [arguments]
6218
6420
  This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
6219
6421
  The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
6220
6422
 
6221
- When users call a custom slash command, you have to look for the markdown file, \`${join54(commands.relativeDirPath, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
6423
+ When users call a custom slash command, you have to look for the markdown file, \`${join55(commands.relativeDirPath, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
6222
6424
  const subagentsSection = subagents ? `## Simulated Subagents
6223
6425
 
6224
6426
  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.
6225
6427
 
6226
- When users call a simulated subagent, it will look for the corresponding markdown file, \`${join54(subagents.relativeDirPath, "{subagent}.md")}\`, and execute its contents as the block of operations.
6428
+ When users call a simulated subagent, it will look for the corresponding markdown file, \`${join55(subagents.relativeDirPath, "{subagent}.md")}\`, and execute its contents as the block of operations.
6227
6429
 
6228
- For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join54(subagents.relativeDirPath, "planner.md")}\`, and execute its contents as the block of operations.` : "";
6430
+ For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join55(subagents.relativeDirPath, "planner.md")}\`, and execute its contents as the block of operations.` : "";
6229
6431
  const result = [
6230
6432
  overview,
6231
6433
  ...this.simulateCommands && CommandsProcessor.getToolTargetsSimulated().includes(this.toolTarget) ? [commandsSection] : [],
@@ -6344,28 +6546,15 @@ async function generateMcp(config) {
6344
6546
  logger.debug("Skipping MCP configuration generation (not in --features)");
6345
6547
  return 0;
6346
6548
  }
6347
- if (config.getExperimentalGlobal()) {
6348
- logger.debug("Skipping MCP configuration generation (not supported in global mode)");
6349
- return 0;
6350
- }
6351
6549
  let totalMcpOutputs = 0;
6352
6550
  logger.info("Generating MCP files...");
6353
- const supportedMcpTargets = [
6354
- "amazonqcli",
6355
- "claudecode",
6356
- "cline",
6357
- "copilot",
6358
- "cursor",
6359
- "roo"
6360
- ];
6361
- const mcpSupportedTargets = config.getTargets().filter((target) => {
6362
- return supportedMcpTargets.some((supportedTarget) => supportedTarget === target);
6363
- });
6551
+ const toolTargets = config.getExperimentalGlobal() ? intersection(config.getTargets(), McpProcessor.getToolTargetsGlobal()) : intersection(config.getTargets(), McpProcessor.getToolTargets());
6364
6552
  for (const baseDir of config.getBaseDirs()) {
6365
- for (const toolTarget of intersection(mcpSupportedTargets, McpProcessor.getToolTargets())) {
6553
+ for (const toolTarget of toolTargets) {
6366
6554
  const processor = new McpProcessor({
6367
6555
  baseDir,
6368
- toolTarget
6556
+ toolTarget,
6557
+ global: config.getExperimentalGlobal()
6369
6558
  });
6370
6559
  if (config.getDelete()) {
6371
6560
  const oldToolFiles = await processor.loadToolFilesToDelete();
@@ -6450,9 +6639,9 @@ async function generateSubagents(config) {
6450
6639
  }
6451
6640
 
6452
6641
  // src/cli/commands/gitignore.ts
6453
- import { join as join55 } from "path";
6642
+ import { join as join56 } from "path";
6454
6643
  var gitignoreCommand = async () => {
6455
- const gitignorePath = join55(process.cwd(), ".gitignore");
6644
+ const gitignorePath = join56(process.cwd(), ".gitignore");
6456
6645
  const rulesFilesToIgnore = [
6457
6646
  "# Generated by rulesync - AI tool configuration files",
6458
6647
  "**/.amazonq/",
@@ -6553,12 +6742,9 @@ async function importRules(config, tool) {
6553
6742
  if (!config.getFeatures().includes("rules")) {
6554
6743
  return 0;
6555
6744
  }
6556
- if (!RulesProcessor.getToolTargets().includes(tool)) {
6557
- return 0;
6558
- }
6559
6745
  const global = config.getExperimentalGlobal();
6560
- if (global && !RulesProcessor.getToolTargetsGlobal().includes(tool)) {
6561
- logger.error(`${tool} is not supported in global mode`);
6746
+ const supportedTargets = global ? RulesProcessor.getToolTargetsGlobal() : RulesProcessor.getToolTargets();
6747
+ if (!supportedTargets.includes(tool)) {
6562
6748
  return 0;
6563
6749
  }
6564
6750
  const rulesProcessor = new RulesProcessor({
@@ -6610,16 +6796,15 @@ async function importMcp(config, tool) {
6610
6796
  if (!config.getFeatures().includes("mcp")) {
6611
6797
  return 0;
6612
6798
  }
6613
- if (config.getExperimentalGlobal()) {
6614
- logger.debug("Skipping MCP file import (not supported in global mode)");
6615
- return 0;
6616
- }
6617
- if (!McpProcessor.getToolTargets().includes(tool)) {
6799
+ const global = config.getExperimentalGlobal();
6800
+ const supportedTargets = global ? McpProcessor.getToolTargetsGlobal() : McpProcessor.getToolTargets();
6801
+ if (!supportedTargets.includes(tool)) {
6618
6802
  return 0;
6619
6803
  }
6620
6804
  const mcpProcessor = new McpProcessor({
6621
6805
  baseDir: config.getBaseDirs()[0] ?? ".",
6622
- toolTarget: tool
6806
+ toolTarget: tool,
6807
+ global
6623
6808
  });
6624
6809
  const toolFiles = await mcpProcessor.loadToolFiles();
6625
6810
  if (toolFiles.length === 0) {
@@ -6639,9 +6824,6 @@ async function importCommands(config, tool) {
6639
6824
  const global = config.getExperimentalGlobal();
6640
6825
  const supportedTargets = global ? CommandsProcessor.getToolTargetsGlobal() : CommandsProcessor.getToolTargets({ includeSimulated: false });
6641
6826
  if (!supportedTargets.includes(tool)) {
6642
- if (global) {
6643
- logger.debug(`${tool} is not supported for commands in global mode`);
6644
- }
6645
6827
  return 0;
6646
6828
  }
6647
6829
  const commandsProcessor = new CommandsProcessor({
@@ -6689,7 +6871,7 @@ async function importSubagents(config, tool) {
6689
6871
  }
6690
6872
 
6691
6873
  // src/cli/commands/init.ts
6692
- import { join as join56 } from "path";
6874
+ import { join as join57 } from "path";
6693
6875
  async function initCommand() {
6694
6876
  logger.info("Initializing rulesync...");
6695
6877
  await ensureDir(".rulesync");
@@ -6760,7 +6942,7 @@ globs: ["**/*"]
6760
6942
  - Follow single responsibility principle
6761
6943
  `
6762
6944
  };
6763
- const filepath = join56(".rulesync/rules", sampleFile.filename);
6945
+ const filepath = join57(".rulesync/rules", sampleFile.filename);
6764
6946
  await ensureDir(".rulesync/rules");
6765
6947
  await ensureDir(RulesyncCommand.getSettablePaths().relativeDirPath);
6766
6948
  await ensureDir(".rulesync/subagents");
@@ -6773,7 +6955,7 @@ globs: ["**/*"]
6773
6955
  }
6774
6956
 
6775
6957
  // src/cli/index.ts
6776
- var getVersion = () => "3.1.1";
6958
+ var getVersion = () => "3.3.0";
6777
6959
  var main = async () => {
6778
6960
  const program = new Command();
6779
6961
  const version = getVersion();