rulesync 3.1.1 → 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);
@@ -2524,11 +2532,11 @@ var McpServerBaseSchema = import_mini10.z.object({
2524
2532
  kiroAutoBlock: import_mini10.z.optional(import_mini10.z.array(import_mini10.z.string())),
2525
2533
  headers: import_mini10.z.optional(import_mini10.z.record(import_mini10.z.string(), import_mini10.z.string()))
2526
2534
  });
2527
- var RulesyncMcpServerSchema = import_mini10.z.extend(McpServerBaseSchema, {
2535
+ var RulesyncMcpServersSchema = import_mini10.z.extend(McpServerBaseSchema, {
2528
2536
  targets: import_mini10.z.optional(RulesyncTargetsSchema)
2529
2537
  });
2530
2538
  var RulesyncMcpConfigSchema = import_mini10.z.object({
2531
- mcpServers: import_mini10.z.record(import_mini10.z.string(), RulesyncMcpServerSchema)
2539
+ mcpServers: import_mini10.z.record(import_mini10.z.string(), RulesyncMcpServersSchema)
2532
2540
  });
2533
2541
  var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
2534
2542
  json;
@@ -2570,14 +2578,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
2570
2578
 
2571
2579
  // src/mcp/tool-mcp.ts
2572
2580
  var ToolMcp = class extends ToolFile {
2573
- json;
2574
2581
  constructor({ ...rest }) {
2575
2582
  super({
2576
2583
  ...rest,
2577
2584
  validate: true
2578
2585
  // Skip validation during construction
2579
2586
  });
2580
- this.json = JSON.parse(this.fileContent);
2581
2587
  if (rest.validate) {
2582
2588
  const result = this.validate();
2583
2589
  if (!result.success) {
@@ -2585,9 +2591,6 @@ var ToolMcp = class extends ToolFile {
2585
2591
  }
2586
2592
  }
2587
2593
  }
2588
- getJson() {
2589
- return this.json;
2590
- }
2591
2594
  static getSettablePaths() {
2592
2595
  throw new Error("Please implement this method in the subclass.");
2593
2596
  }
@@ -2609,6 +2612,14 @@ var ToolMcp = class extends ToolFile {
2609
2612
 
2610
2613
  // src/mcp/amazonqcli-mcp.ts
2611
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
+ }
2612
2623
  static getSettablePaths() {
2613
2624
  return {
2614
2625
  relativeDirPath: ".amazonq",
@@ -2658,6 +2669,14 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
2658
2669
  // src/mcp/claudecode-mcp.ts
2659
2670
  var import_node_path27 = require("path");
2660
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
+ }
2661
2680
  static getSettablePaths() {
2662
2681
  return {
2663
2682
  relativeDirPath: ".",
@@ -2707,6 +2726,14 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
2707
2726
  // src/mcp/cline-mcp.ts
2708
2727
  var import_node_path28 = require("path");
2709
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
+ }
2710
2737
  static getSettablePaths() {
2711
2738
  return {
2712
2739
  relativeDirPath: ".cline",
@@ -2753,9 +2780,111 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
2753
2780
  }
2754
2781
  };
2755
2782
 
2756
- // src/mcp/copilot-mcp.ts
2783
+ // src/mcp/codex-mcp.ts
2757
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");
2758
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
+ }
2759
2888
  static getSettablePaths() {
2760
2889
  return {
2761
2890
  relativeDirPath: ".vscode",
@@ -2767,7 +2896,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
2767
2896
  validate = true
2768
2897
  }) {
2769
2898
  const fileContent = await readFileContent(
2770
- (0, import_node_path29.join)(
2899
+ (0, import_node_path30.join)(
2771
2900
  baseDir,
2772
2901
  this.getSettablePaths().relativeDirPath,
2773
2902
  this.getSettablePaths().relativeFilePath
@@ -2803,8 +2932,16 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
2803
2932
  };
2804
2933
 
2805
2934
  // src/mcp/cursor-mcp.ts
2806
- var import_node_path30 = require("path");
2935
+ var import_node_path31 = require("path");
2807
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
+ }
2808
2945
  static getSettablePaths() {
2809
2946
  return {
2810
2947
  relativeDirPath: ".cursor",
@@ -2816,7 +2953,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
2816
2953
  validate = true
2817
2954
  }) {
2818
2955
  const fileContent = await readFileContent(
2819
- (0, import_node_path30.join)(
2956
+ (0, import_node_path31.join)(
2820
2957
  baseDir,
2821
2958
  this.getSettablePaths().relativeDirPath,
2822
2959
  this.getSettablePaths().relativeFilePath
@@ -2863,8 +3000,16 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
2863
3000
  };
2864
3001
 
2865
3002
  // src/mcp/roo-mcp.ts
2866
- var import_node_path31 = require("path");
3003
+ var import_node_path32 = require("path");
2867
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
+ }
2868
3013
  static getSettablePaths() {
2869
3014
  return {
2870
3015
  relativeDirPath: ".roo",
@@ -2876,7 +3021,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
2876
3021
  validate = true
2877
3022
  }) {
2878
3023
  const fileContent = await readFileContent(
2879
- (0, import_node_path31.join)(
3024
+ (0, import_node_path32.join)(
2880
3025
  baseDir,
2881
3026
  this.getSettablePaths().relativeDirPath,
2882
3027
  this.getSettablePaths().relativeFilePath
@@ -2921,15 +3066,22 @@ var mcpProcessorToolTargets = [
2921
3066
  "cursor",
2922
3067
  "roo"
2923
3068
  ];
2924
- 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"];
2925
3074
  var McpProcessor = class extends FeatureProcessor {
2926
3075
  toolTarget;
3076
+ global;
2927
3077
  constructor({
2928
3078
  baseDir = ".",
2929
- toolTarget
3079
+ toolTarget,
3080
+ global = false
2930
3081
  }) {
2931
3082
  super({ baseDir });
2932
3083
  this.toolTarget = McpProcessorToolTargetSchema.parse(toolTarget);
3084
+ this.global = global;
2933
3085
  }
2934
3086
  /**
2935
3087
  * Implementation of abstract method from FeatureProcessor
@@ -2978,6 +3130,15 @@ var McpProcessor = class extends FeatureProcessor {
2978
3130
  })
2979
3131
  ];
2980
3132
  }
3133
+ case "codexcli": {
3134
+ return [
3135
+ await CodexcliMcp.fromFile({
3136
+ baseDir: this.baseDir,
3137
+ validate: true,
3138
+ global: this.global
3139
+ })
3140
+ ];
3141
+ }
2981
3142
  case "copilot": {
2982
3143
  return [
2983
3144
  await CopilotMcp.fromFile({
@@ -3024,42 +3185,50 @@ var McpProcessor = class extends FeatureProcessor {
3024
3185
  if (!rulesyncMcp) {
3025
3186
  throw new Error(`No .rulesync/.mcp.json found.`);
3026
3187
  }
3027
- const toolMcps = [rulesyncMcp].map((rulesyncMcp2) => {
3028
- switch (this.toolTarget) {
3029
- case "amazonqcli":
3030
- return AmazonqcliMcp.fromRulesyncMcp({
3031
- baseDir: this.baseDir,
3032
- rulesyncMcp: rulesyncMcp2
3033
- });
3034
- case "claudecode":
3035
- return ClaudecodeMcp.fromRulesyncMcp({
3036
- baseDir: this.baseDir,
3037
- rulesyncMcp: rulesyncMcp2
3038
- });
3039
- case "cline":
3040
- return ClineMcp.fromRulesyncMcp({
3041
- baseDir: this.baseDir,
3042
- rulesyncMcp: rulesyncMcp2
3043
- });
3044
- case "copilot":
3045
- return CopilotMcp.fromRulesyncMcp({
3046
- baseDir: this.baseDir,
3047
- rulesyncMcp: rulesyncMcp2
3048
- });
3049
- case "cursor":
3050
- return CursorMcp.fromRulesyncMcp({
3051
- baseDir: this.baseDir,
3052
- rulesyncMcp: rulesyncMcp2
3053
- });
3054
- case "roo":
3055
- return RooMcp.fromRulesyncMcp({
3056
- baseDir: this.baseDir,
3057
- rulesyncMcp: rulesyncMcp2
3058
- });
3059
- default:
3060
- throw new Error(`Unsupported tool target: ${this.toolTarget}`);
3061
- }
3062
- });
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
+ );
3063
3232
  return toolMcps;
3064
3233
  }
3065
3234
  /**
@@ -3080,15 +3249,18 @@ var McpProcessor = class extends FeatureProcessor {
3080
3249
  static getToolTargets() {
3081
3250
  return mcpProcessorToolTargets;
3082
3251
  }
3252
+ static getToolTargetsGlobal() {
3253
+ return mcpProcessorToolTargetsGlobal;
3254
+ }
3083
3255
  };
3084
3256
 
3085
3257
  // src/rules/rules-processor.ts
3086
- var import_node_path55 = require("path");
3258
+ var import_node_path56 = require("path");
3087
3259
  var import_fast_xml_parser = require("fast-xml-parser");
3088
3260
  var import_mini20 = require("zod/mini");
3089
3261
 
3090
3262
  // src/subagents/simulated-subagent.ts
3091
- var import_node_path32 = require("path");
3263
+ var import_node_path33 = require("path");
3092
3264
  var import_mini12 = require("zod/mini");
3093
3265
 
3094
3266
  // src/subagents/tool-subagent.ts
@@ -3190,7 +3362,7 @@ var SimulatedSubagent = class extends ToolSubagent {
3190
3362
  relativeFilePath,
3191
3363
  validate = true
3192
3364
  }) {
3193
- 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);
3194
3366
  const fileContent = await readFileContent(filePath);
3195
3367
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
3196
3368
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -3200,7 +3372,7 @@ var SimulatedSubagent = class extends ToolSubagent {
3200
3372
  return {
3201
3373
  baseDir,
3202
3374
  relativeDirPath: this.getSettablePaths().relativeDirPath,
3203
- relativeFilePath: (0, import_node_path32.basename)(relativeFilePath),
3375
+ relativeFilePath: (0, import_node_path33.basename)(relativeFilePath),
3204
3376
  frontmatter: result.data,
3205
3377
  body: content.trim(),
3206
3378
  validate
@@ -3347,15 +3519,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
3347
3519
  };
3348
3520
 
3349
3521
  // src/subagents/subagents-processor.ts
3350
- var import_node_path35 = require("path");
3522
+ var import_node_path36 = require("path");
3351
3523
  var import_mini15 = require("zod/mini");
3352
3524
 
3353
3525
  // src/subagents/claudecode-subagent.ts
3354
- var import_node_path34 = require("path");
3526
+ var import_node_path35 = require("path");
3355
3527
  var import_mini14 = require("zod/mini");
3356
3528
 
3357
3529
  // src/subagents/rulesync-subagent.ts
3358
- var import_node_path33 = require("path");
3530
+ var import_node_path34 = require("path");
3359
3531
  var import_mini13 = require("zod/mini");
3360
3532
  var RulesyncSubagentModelSchema = import_mini13.z.enum(["opus", "sonnet", "haiku", "inherit"]);
3361
3533
  var RulesyncSubagentFrontmatterSchema = import_mini13.z.object({
@@ -3409,13 +3581,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
3409
3581
  static async fromFile({
3410
3582
  relativeFilePath
3411
3583
  }) {
3412
- 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));
3413
3585
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
3414
3586
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
3415
3587
  if (!result.success) {
3416
3588
  throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${result.error.message}`);
3417
3589
  }
3418
- const filename = (0, import_node_path33.basename)(relativeFilePath);
3590
+ const filename = (0, import_node_path34.basename)(relativeFilePath);
3419
3591
  return new _RulesyncSubagent({
3420
3592
  baseDir: ".",
3421
3593
  relativeDirPath: this.getSettablePaths().relativeDirPath,
@@ -3527,7 +3699,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
3527
3699
  relativeFilePath,
3528
3700
  validate = true
3529
3701
  }) {
3530
- 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));
3531
3703
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
3532
3704
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
3533
3705
  if (!result.success) {
@@ -3669,7 +3841,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
3669
3841
  * Load and parse rulesync subagent files from .rulesync/subagents/ directory
3670
3842
  */
3671
3843
  async loadRulesyncFiles() {
3672
- 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);
3673
3845
  const dirExists = await directoryExists(subagentsDir);
3674
3846
  if (!dirExists) {
3675
3847
  logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
@@ -3684,7 +3856,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
3684
3856
  logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
3685
3857
  const rulesyncSubagents = [];
3686
3858
  for (const mdFile of mdFiles) {
3687
- const filepath = (0, import_node_path35.join)(subagentsDir, mdFile);
3859
+ const filepath = (0, import_node_path36.join)(subagentsDir, mdFile);
3688
3860
  try {
3689
3861
  const rulesyncSubagent = await RulesyncSubagent.fromFile({
3690
3862
  relativeFilePath: mdFile,
@@ -3798,8 +3970,8 @@ var SubagentsProcessor = class extends FeatureProcessor {
3798
3970
  relativeDirPath,
3799
3971
  fromFile
3800
3972
  }) {
3801
- const paths = await findFilesByGlobs((0, import_node_path35.join)(this.baseDir, relativeDirPath, "*.md"));
3802
- 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);
3803
3975
  logger.info(`Successfully loaded ${subagents.length} ${relativeDirPath} subagents`);
3804
3976
  return subagents;
3805
3977
  }
@@ -3823,13 +3995,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
3823
3995
  };
3824
3996
 
3825
3997
  // src/rules/agentsmd-rule.ts
3826
- var import_node_path38 = require("path");
3998
+ var import_node_path39 = require("path");
3827
3999
 
3828
4000
  // src/rules/tool-rule.ts
3829
- var import_node_path37 = require("path");
4001
+ var import_node_path38 = require("path");
3830
4002
 
3831
4003
  // src/rules/rulesync-rule.ts
3832
- var import_node_path36 = require("path");
4004
+ var import_node_path37 = require("path");
3833
4005
  var import_mini16 = require("zod/mini");
3834
4006
  var RulesyncRuleFrontmatterSchema = import_mini16.z.object({
3835
4007
  root: import_mini16.z.optional(import_mini16.z.optional(import_mini16.z.boolean())),
@@ -3895,7 +4067,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
3895
4067
  relativeFilePath,
3896
4068
  validate = true
3897
4069
  }) {
3898
- 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);
3899
4071
  const fileContent = await readFileContent(filePath);
3900
4072
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
3901
4073
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
@@ -3910,7 +4082,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
3910
4082
  agentsmd: result.data.agentsmd,
3911
4083
  cursor: result.data.cursor
3912
4084
  };
3913
- const filename = (0, import_node_path36.basename)(filePath);
4085
+ const filename = (0, import_node_path37.basename)(filePath);
3914
4086
  return new _RulesyncRule({
3915
4087
  baseDir: ".",
3916
4088
  relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
@@ -3924,7 +4096,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
3924
4096
  relativeFilePath,
3925
4097
  validate = true
3926
4098
  }) {
3927
- 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);
3928
4100
  const fileContent = await readFileContent(filePath);
3929
4101
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
3930
4102
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
@@ -3939,7 +4111,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
3939
4111
  agentsmd: result.data.agentsmd,
3940
4112
  cursor: result.data.cursor
3941
4113
  };
3942
- const filename = (0, import_node_path36.basename)(filePath);
4114
+ const filename = (0, import_node_path37.basename)(filePath);
3943
4115
  return new _RulesyncRule({
3944
4116
  baseDir: ".",
3945
4117
  relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
@@ -4028,7 +4200,7 @@ var ToolRule = class extends ToolFile {
4028
4200
  });
4029
4201
  const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
4030
4202
  if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
4031
- params.relativeDirPath = (0, import_node_path37.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
4203
+ params.relativeDirPath = (0, import_node_path38.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
4032
4204
  params.relativeFilePath = "AGENTS.md";
4033
4205
  }
4034
4206
  return params;
@@ -4104,8 +4276,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
4104
4276
  validate = true
4105
4277
  }) {
4106
4278
  const isRoot = relativeFilePath === "AGENTS.md";
4107
- const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path38.join)(".agents/memories", relativeFilePath);
4108
- 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));
4109
4281
  return new _AgentsMdRule({
4110
4282
  baseDir,
4111
4283
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -4145,7 +4317,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
4145
4317
  };
4146
4318
 
4147
4319
  // src/rules/amazonqcli-rule.ts
4148
- var import_node_path39 = require("path");
4320
+ var import_node_path40 = require("path");
4149
4321
  var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
4150
4322
  static getSettablePaths() {
4151
4323
  return {
@@ -4160,7 +4332,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
4160
4332
  validate = true
4161
4333
  }) {
4162
4334
  const fileContent = await readFileContent(
4163
- (0, import_node_path39.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4335
+ (0, import_node_path40.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4164
4336
  );
4165
4337
  return new _AmazonQCliRule({
4166
4338
  baseDir,
@@ -4200,7 +4372,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
4200
4372
  };
4201
4373
 
4202
4374
  // src/rules/augmentcode-legacy-rule.ts
4203
- var import_node_path40 = require("path");
4375
+ var import_node_path41 = require("path");
4204
4376
  var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
4205
4377
  toRulesyncRule() {
4206
4378
  const rulesyncFrontmatter = {
@@ -4261,8 +4433,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
4261
4433
  }) {
4262
4434
  const settablePaths = this.getSettablePaths();
4263
4435
  const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
4264
- const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path40.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
4265
- 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));
4266
4438
  return new _AugmentcodeLegacyRule({
4267
4439
  baseDir,
4268
4440
  relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
@@ -4275,7 +4447,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
4275
4447
  };
4276
4448
 
4277
4449
  // src/rules/augmentcode-rule.ts
4278
- var import_node_path41 = require("path");
4450
+ var import_node_path42 = require("path");
4279
4451
  var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
4280
4452
  toRulesyncRule() {
4281
4453
  return this.toRulesyncRuleDefault();
@@ -4307,7 +4479,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
4307
4479
  validate = true
4308
4480
  }) {
4309
4481
  const fileContent = await readFileContent(
4310
- (0, import_node_path41.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4482
+ (0, import_node_path42.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4311
4483
  );
4312
4484
  const { body: content } = parseFrontmatter(fileContent);
4313
4485
  return new _AugmentcodeRule({
@@ -4330,7 +4502,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
4330
4502
  };
4331
4503
 
4332
4504
  // src/rules/claudecode-rule.ts
4333
- var import_node_path42 = require("path");
4505
+ var import_node_path43 = require("path");
4334
4506
  var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
4335
4507
  static getSettablePaths() {
4336
4508
  return {
@@ -4339,7 +4511,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
4339
4511
  relativeFilePath: "CLAUDE.md"
4340
4512
  },
4341
4513
  nonRoot: {
4342
- relativeDirPath: (0, import_node_path42.join)(".claude", "memories")
4514
+ relativeDirPath: (0, import_node_path43.join)(".claude", "memories")
4343
4515
  }
4344
4516
  };
4345
4517
  }
@@ -4362,7 +4534,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
4362
4534
  if (isRoot) {
4363
4535
  const relativePath2 = paths.root.relativeFilePath;
4364
4536
  const fileContent2 = await readFileContent(
4365
- (0, import_node_path42.join)(baseDir, paths.root.relativeDirPath, relativePath2)
4537
+ (0, import_node_path43.join)(baseDir, paths.root.relativeDirPath, relativePath2)
4366
4538
  );
4367
4539
  return new _ClaudecodeRule({
4368
4540
  baseDir,
@@ -4376,8 +4548,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
4376
4548
  if (!paths.nonRoot) {
4377
4549
  throw new Error("nonRoot path is not set");
4378
4550
  }
4379
- const relativePath = (0, import_node_path42.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
4380
- 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));
4381
4553
  return new _ClaudecodeRule({
4382
4554
  baseDir,
4383
4555
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -4419,7 +4591,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
4419
4591
  };
4420
4592
 
4421
4593
  // src/rules/cline-rule.ts
4422
- var import_node_path43 = require("path");
4594
+ var import_node_path44 = require("path");
4423
4595
  var import_mini17 = require("zod/mini");
4424
4596
  var ClineRuleFrontmatterSchema = import_mini17.z.object({
4425
4597
  description: import_mini17.z.string()
@@ -4464,7 +4636,7 @@ var ClineRule = class _ClineRule extends ToolRule {
4464
4636
  validate = true
4465
4637
  }) {
4466
4638
  const fileContent = await readFileContent(
4467
- (0, import_node_path43.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4639
+ (0, import_node_path44.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4468
4640
  );
4469
4641
  return new _ClineRule({
4470
4642
  baseDir,
@@ -4477,7 +4649,7 @@ var ClineRule = class _ClineRule extends ToolRule {
4477
4649
  };
4478
4650
 
4479
4651
  // src/rules/codexcli-rule.ts
4480
- var import_node_path44 = require("path");
4652
+ var import_node_path45 = require("path");
4481
4653
  var CodexcliRule = class _CodexcliRule extends ToolRule {
4482
4654
  static getSettablePaths() {
4483
4655
  return {
@@ -4509,7 +4681,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
4509
4681
  if (isRoot) {
4510
4682
  const relativePath2 = paths.root.relativeFilePath;
4511
4683
  const fileContent2 = await readFileContent(
4512
- (0, import_node_path44.join)(baseDir, paths.root.relativeDirPath, relativePath2)
4684
+ (0, import_node_path45.join)(baseDir, paths.root.relativeDirPath, relativePath2)
4513
4685
  );
4514
4686
  return new _CodexcliRule({
4515
4687
  baseDir,
@@ -4523,8 +4695,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
4523
4695
  if (!paths.nonRoot) {
4524
4696
  throw new Error("nonRoot path is not set");
4525
4697
  }
4526
- const relativePath = (0, import_node_path44.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
4527
- 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));
4528
4700
  return new _CodexcliRule({
4529
4701
  baseDir,
4530
4702
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -4566,7 +4738,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
4566
4738
  };
4567
4739
 
4568
4740
  // src/rules/copilot-rule.ts
4569
- var import_node_path45 = require("path");
4741
+ var import_node_path46 = require("path");
4570
4742
  var import_mini18 = require("zod/mini");
4571
4743
  var CopilotRuleFrontmatterSchema = import_mini18.z.object({
4572
4744
  description: import_mini18.z.optional(import_mini18.z.string()),
@@ -4659,11 +4831,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
4659
4831
  validate = true
4660
4832
  }) {
4661
4833
  const isRoot = relativeFilePath === "copilot-instructions.md";
4662
- const relativePath = isRoot ? (0, import_node_path45.join)(
4834
+ const relativePath = isRoot ? (0, import_node_path46.join)(
4663
4835
  this.getSettablePaths().root.relativeDirPath,
4664
4836
  this.getSettablePaths().root.relativeFilePath
4665
- ) : (0, import_node_path45.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
4666
- 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));
4667
4839
  if (isRoot) {
4668
4840
  return new _CopilotRule({
4669
4841
  baseDir,
@@ -4682,7 +4854,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
4682
4854
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
4683
4855
  if (!result.success) {
4684
4856
  throw new Error(
4685
- `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}`
4686
4858
  );
4687
4859
  }
4688
4860
  return new _CopilotRule({
@@ -4721,7 +4893,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
4721
4893
  };
4722
4894
 
4723
4895
  // src/rules/cursor-rule.ts
4724
- var import_node_path46 = require("path");
4896
+ var import_node_path47 = require("path");
4725
4897
  var import_mini19 = require("zod/mini");
4726
4898
  var CursorRuleFrontmatterSchema = import_mini19.z.object({
4727
4899
  description: import_mini19.z.optional(import_mini19.z.string()),
@@ -4848,19 +5020,19 @@ var CursorRule = class _CursorRule extends ToolRule {
4848
5020
  validate = true
4849
5021
  }) {
4850
5022
  const fileContent = await readFileContent(
4851
- (0, import_node_path46.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5023
+ (0, import_node_path47.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4852
5024
  );
4853
5025
  const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
4854
5026
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
4855
5027
  if (!result.success) {
4856
5028
  throw new Error(
4857
- `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}`
4858
5030
  );
4859
5031
  }
4860
5032
  return new _CursorRule({
4861
5033
  baseDir,
4862
5034
  relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
4863
- relativeFilePath: (0, import_node_path46.basename)(relativeFilePath),
5035
+ relativeFilePath: (0, import_node_path47.basename)(relativeFilePath),
4864
5036
  frontmatter: result.data,
4865
5037
  body: content.trim(),
4866
5038
  validate
@@ -4892,7 +5064,7 @@ var CursorRule = class _CursorRule extends ToolRule {
4892
5064
  };
4893
5065
 
4894
5066
  // src/rules/geminicli-rule.ts
4895
- var import_node_path47 = require("path");
5067
+ var import_node_path48 = require("path");
4896
5068
  var GeminiCliRule = class _GeminiCliRule extends ToolRule {
4897
5069
  static getSettablePaths() {
4898
5070
  return {
@@ -4924,7 +5096,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
4924
5096
  if (isRoot) {
4925
5097
  const relativePath2 = paths.root.relativeFilePath;
4926
5098
  const fileContent2 = await readFileContent(
4927
- (0, import_node_path47.join)(baseDir, paths.root.relativeDirPath, relativePath2)
5099
+ (0, import_node_path48.join)(baseDir, paths.root.relativeDirPath, relativePath2)
4928
5100
  );
4929
5101
  return new _GeminiCliRule({
4930
5102
  baseDir,
@@ -4938,8 +5110,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
4938
5110
  if (!paths.nonRoot) {
4939
5111
  throw new Error("nonRoot path is not set");
4940
5112
  }
4941
- const relativePath = (0, import_node_path47.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
4942
- 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));
4943
5115
  return new _GeminiCliRule({
4944
5116
  baseDir,
4945
5117
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -4981,7 +5153,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
4981
5153
  };
4982
5154
 
4983
5155
  // src/rules/junie-rule.ts
4984
- var import_node_path48 = require("path");
5156
+ var import_node_path49 = require("path");
4985
5157
  var JunieRule = class _JunieRule extends ToolRule {
4986
5158
  static getSettablePaths() {
4987
5159
  return {
@@ -5000,8 +5172,8 @@ var JunieRule = class _JunieRule extends ToolRule {
5000
5172
  validate = true
5001
5173
  }) {
5002
5174
  const isRoot = relativeFilePath === "guidelines.md";
5003
- const relativePath = isRoot ? "guidelines.md" : (0, import_node_path48.join)(".junie/memories", relativeFilePath);
5004
- 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));
5005
5177
  return new _JunieRule({
5006
5178
  baseDir,
5007
5179
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -5041,7 +5213,7 @@ var JunieRule = class _JunieRule extends ToolRule {
5041
5213
  };
5042
5214
 
5043
5215
  // src/rules/kiro-rule.ts
5044
- var import_node_path49 = require("path");
5216
+ var import_node_path50 = require("path");
5045
5217
  var KiroRule = class _KiroRule extends ToolRule {
5046
5218
  static getSettablePaths() {
5047
5219
  return {
@@ -5056,7 +5228,7 @@ var KiroRule = class _KiroRule extends ToolRule {
5056
5228
  validate = true
5057
5229
  }) {
5058
5230
  const fileContent = await readFileContent(
5059
- (0, import_node_path49.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5231
+ (0, import_node_path50.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5060
5232
  );
5061
5233
  return new _KiroRule({
5062
5234
  baseDir,
@@ -5096,7 +5268,7 @@ var KiroRule = class _KiroRule extends ToolRule {
5096
5268
  };
5097
5269
 
5098
5270
  // src/rules/opencode-rule.ts
5099
- var import_node_path50 = require("path");
5271
+ var import_node_path51 = require("path");
5100
5272
  var OpenCodeRule = class _OpenCodeRule extends ToolRule {
5101
5273
  static getSettablePaths() {
5102
5274
  return {
@@ -5115,8 +5287,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
5115
5287
  validate = true
5116
5288
  }) {
5117
5289
  const isRoot = relativeFilePath === "AGENTS.md";
5118
- const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path50.join)(".opencode/memories", relativeFilePath);
5119
- 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));
5120
5292
  return new _OpenCodeRule({
5121
5293
  baseDir,
5122
5294
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -5156,7 +5328,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
5156
5328
  };
5157
5329
 
5158
5330
  // src/rules/qwencode-rule.ts
5159
- var import_node_path51 = require("path");
5331
+ var import_node_path52 = require("path");
5160
5332
  var QwencodeRule = class _QwencodeRule extends ToolRule {
5161
5333
  static getSettablePaths() {
5162
5334
  return {
@@ -5175,8 +5347,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
5175
5347
  validate = true
5176
5348
  }) {
5177
5349
  const isRoot = relativeFilePath === "QWEN.md";
5178
- const relativePath = isRoot ? "QWEN.md" : (0, import_node_path51.join)(".qwen/memories", relativeFilePath);
5179
- 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));
5180
5352
  return new _QwencodeRule({
5181
5353
  baseDir,
5182
5354
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -5213,7 +5385,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
5213
5385
  };
5214
5386
 
5215
5387
  // src/rules/roo-rule.ts
5216
- var import_node_path52 = require("path");
5388
+ var import_node_path53 = require("path");
5217
5389
  var RooRule = class _RooRule extends ToolRule {
5218
5390
  static getSettablePaths() {
5219
5391
  return {
@@ -5228,7 +5400,7 @@ var RooRule = class _RooRule extends ToolRule {
5228
5400
  validate = true
5229
5401
  }) {
5230
5402
  const fileContent = await readFileContent(
5231
- (0, import_node_path52.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5403
+ (0, import_node_path53.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5232
5404
  );
5233
5405
  return new _RooRule({
5234
5406
  baseDir,
@@ -5283,7 +5455,7 @@ var RooRule = class _RooRule extends ToolRule {
5283
5455
  };
5284
5456
 
5285
5457
  // src/rules/warp-rule.ts
5286
- var import_node_path53 = require("path");
5458
+ var import_node_path54 = require("path");
5287
5459
  var WarpRule = class _WarpRule extends ToolRule {
5288
5460
  constructor({ fileContent, root, ...rest }) {
5289
5461
  super({
@@ -5309,8 +5481,8 @@ var WarpRule = class _WarpRule extends ToolRule {
5309
5481
  validate = true
5310
5482
  }) {
5311
5483
  const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
5312
- const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path53.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
5313
- 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));
5314
5486
  return new _WarpRule({
5315
5487
  baseDir,
5316
5488
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
@@ -5350,7 +5522,7 @@ var WarpRule = class _WarpRule extends ToolRule {
5350
5522
  };
5351
5523
 
5352
5524
  // src/rules/windsurf-rule.ts
5353
- var import_node_path54 = require("path");
5525
+ var import_node_path55 = require("path");
5354
5526
  var WindsurfRule = class _WindsurfRule extends ToolRule {
5355
5527
  static getSettablePaths() {
5356
5528
  return {
@@ -5365,7 +5537,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
5365
5537
  validate = true
5366
5538
  }) {
5367
5539
  const fileContent = await readFileContent(
5368
- (0, import_node_path54.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5540
+ (0, import_node_path55.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5369
5541
  );
5370
5542
  return new _WindsurfRule({
5371
5543
  baseDir,
@@ -5759,10 +5931,10 @@ var RulesProcessor = class extends FeatureProcessor {
5759
5931
  * Load and parse rulesync rule files from .rulesync/rules/ directory
5760
5932
  */
5761
5933
  async loadRulesyncFiles() {
5762
- 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"));
5763
5935
  logger.debug(`Found ${files.length} rulesync files`);
5764
5936
  const rulesyncRules = await Promise.all(
5765
- 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) }))
5766
5938
  );
5767
5939
  const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
5768
5940
  if (rootRules.length > 1) {
@@ -5780,10 +5952,10 @@ var RulesProcessor = class extends FeatureProcessor {
5780
5952
  return rulesyncRules;
5781
5953
  }
5782
5954
  async loadRulesyncFilesLegacy() {
5783
- const legacyFiles = await findFilesByGlobs((0, import_node_path55.join)(".rulesync", "*.md"));
5955
+ const legacyFiles = await findFilesByGlobs((0, import_node_path56.join)(".rulesync", "*.md"));
5784
5956
  logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
5785
5957
  return Promise.all(
5786
- 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) }))
5787
5959
  );
5788
5960
  }
5789
5961
  /**
@@ -5847,13 +6019,13 @@ var RulesProcessor = class extends FeatureProcessor {
5847
6019
  return [];
5848
6020
  }
5849
6021
  const rootFilePaths = await findFilesByGlobs(
5850
- (0, import_node_path55.join)(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
6022
+ (0, import_node_path56.join)(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
5851
6023
  );
5852
6024
  return await Promise.all(
5853
6025
  rootFilePaths.map(
5854
6026
  (filePath) => root.fromFile({
5855
6027
  baseDir: this.baseDir,
5856
- relativeFilePath: (0, import_node_path55.basename)(filePath),
6028
+ relativeFilePath: (0, import_node_path56.basename)(filePath),
5857
6029
  global: this.global
5858
6030
  })
5859
6031
  )
@@ -5865,13 +6037,13 @@ var RulesProcessor = class extends FeatureProcessor {
5865
6037
  return [];
5866
6038
  }
5867
6039
  const nonRootFilePaths = await findFilesByGlobs(
5868
- (0, import_node_path55.join)(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
6040
+ (0, import_node_path56.join)(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
5869
6041
  );
5870
6042
  return await Promise.all(
5871
6043
  nonRootFilePaths.map(
5872
6044
  (filePath) => nonRoot.fromFile({
5873
6045
  baseDir: this.baseDir,
5874
- relativeFilePath: (0, import_node_path55.basename)(filePath),
6046
+ relativeFilePath: (0, import_node_path56.basename)(filePath),
5875
6047
  global: this.global
5876
6048
  })
5877
6049
  )
@@ -6241,14 +6413,14 @@ s/<command> [arguments]
6241
6413
  This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
6242
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.
6243
6415
 
6244
- 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.` : "";
6245
6417
  const subagentsSection = subagents ? `## Simulated Subagents
6246
6418
 
6247
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.
6248
6420
 
6249
- 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.
6250
6422
 
6251
- 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.` : "";
6252
6424
  const result = [
6253
6425
  overview,
6254
6426
  ...this.simulateCommands && CommandsProcessor.getToolTargetsSimulated().includes(this.toolTarget) ? [commandsSection] : [],
@@ -6367,28 +6539,15 @@ async function generateMcp(config) {
6367
6539
  logger.debug("Skipping MCP configuration generation (not in --features)");
6368
6540
  return 0;
6369
6541
  }
6370
- if (config.getExperimentalGlobal()) {
6371
- logger.debug("Skipping MCP configuration generation (not supported in global mode)");
6372
- return 0;
6373
- }
6374
6542
  let totalMcpOutputs = 0;
6375
6543
  logger.info("Generating MCP files...");
6376
- const supportedMcpTargets = [
6377
- "amazonqcli",
6378
- "claudecode",
6379
- "cline",
6380
- "copilot",
6381
- "cursor",
6382
- "roo"
6383
- ];
6384
- const mcpSupportedTargets = config.getTargets().filter((target) => {
6385
- return supportedMcpTargets.some((supportedTarget) => supportedTarget === target);
6386
- });
6544
+ const toolTargets = config.getExperimentalGlobal() ? (0, import_es_toolkit2.intersection)(config.getTargets(), McpProcessor.getToolTargetsGlobal()) : (0, import_es_toolkit2.intersection)(config.getTargets(), McpProcessor.getToolTargets());
6387
6545
  for (const baseDir of config.getBaseDirs()) {
6388
- for (const toolTarget of (0, import_es_toolkit2.intersection)(mcpSupportedTargets, McpProcessor.getToolTargets())) {
6546
+ for (const toolTarget of toolTargets) {
6389
6547
  const processor = new McpProcessor({
6390
6548
  baseDir,
6391
- toolTarget
6549
+ toolTarget,
6550
+ global: config.getExperimentalGlobal()
6392
6551
  });
6393
6552
  if (config.getDelete()) {
6394
6553
  const oldToolFiles = await processor.loadToolFilesToDelete();
@@ -6473,9 +6632,9 @@ async function generateSubagents(config) {
6473
6632
  }
6474
6633
 
6475
6634
  // src/cli/commands/gitignore.ts
6476
- var import_node_path56 = require("path");
6635
+ var import_node_path57 = require("path");
6477
6636
  var gitignoreCommand = async () => {
6478
- const gitignorePath = (0, import_node_path56.join)(process.cwd(), ".gitignore");
6637
+ const gitignorePath = (0, import_node_path57.join)(process.cwd(), ".gitignore");
6479
6638
  const rulesFilesToIgnore = [
6480
6639
  "# Generated by rulesync - AI tool configuration files",
6481
6640
  "**/.amazonq/",
@@ -6576,12 +6735,9 @@ async function importRules(config, tool) {
6576
6735
  if (!config.getFeatures().includes("rules")) {
6577
6736
  return 0;
6578
6737
  }
6579
- if (!RulesProcessor.getToolTargets().includes(tool)) {
6580
- return 0;
6581
- }
6582
6738
  const global = config.getExperimentalGlobal();
6583
- if (global && !RulesProcessor.getToolTargetsGlobal().includes(tool)) {
6584
- logger.error(`${tool} is not supported in global mode`);
6739
+ const supportedTargets = global ? RulesProcessor.getToolTargetsGlobal() : RulesProcessor.getToolTargets();
6740
+ if (!supportedTargets.includes(tool)) {
6585
6741
  return 0;
6586
6742
  }
6587
6743
  const rulesProcessor = new RulesProcessor({
@@ -6633,16 +6789,15 @@ async function importMcp(config, tool) {
6633
6789
  if (!config.getFeatures().includes("mcp")) {
6634
6790
  return 0;
6635
6791
  }
6636
- if (config.getExperimentalGlobal()) {
6637
- logger.debug("Skipping MCP file import (not supported in global mode)");
6638
- return 0;
6639
- }
6640
- if (!McpProcessor.getToolTargets().includes(tool)) {
6792
+ const global = config.getExperimentalGlobal();
6793
+ const supportedTargets = global ? McpProcessor.getToolTargetsGlobal() : McpProcessor.getToolTargets();
6794
+ if (!supportedTargets.includes(tool)) {
6641
6795
  return 0;
6642
6796
  }
6643
6797
  const mcpProcessor = new McpProcessor({
6644
6798
  baseDir: config.getBaseDirs()[0] ?? ".",
6645
- toolTarget: tool
6799
+ toolTarget: tool,
6800
+ global
6646
6801
  });
6647
6802
  const toolFiles = await mcpProcessor.loadToolFiles();
6648
6803
  if (toolFiles.length === 0) {
@@ -6662,9 +6817,6 @@ async function importCommands(config, tool) {
6662
6817
  const global = config.getExperimentalGlobal();
6663
6818
  const supportedTargets = global ? CommandsProcessor.getToolTargetsGlobal() : CommandsProcessor.getToolTargets({ includeSimulated: false });
6664
6819
  if (!supportedTargets.includes(tool)) {
6665
- if (global) {
6666
- logger.debug(`${tool} is not supported for commands in global mode`);
6667
- }
6668
6820
  return 0;
6669
6821
  }
6670
6822
  const commandsProcessor = new CommandsProcessor({
@@ -6712,7 +6864,7 @@ async function importSubagents(config, tool) {
6712
6864
  }
6713
6865
 
6714
6866
  // src/cli/commands/init.ts
6715
- var import_node_path57 = require("path");
6867
+ var import_node_path58 = require("path");
6716
6868
  async function initCommand() {
6717
6869
  logger.info("Initializing rulesync...");
6718
6870
  await ensureDir(".rulesync");
@@ -6783,7 +6935,7 @@ globs: ["**/*"]
6783
6935
  - Follow single responsibility principle
6784
6936
  `
6785
6937
  };
6786
- const filepath = (0, import_node_path57.join)(".rulesync/rules", sampleFile.filename);
6938
+ const filepath = (0, import_node_path58.join)(".rulesync/rules", sampleFile.filename);
6787
6939
  await ensureDir(".rulesync/rules");
6788
6940
  await ensureDir(RulesyncCommand.getSettablePaths().relativeDirPath);
6789
6941
  await ensureDir(".rulesync/subagents");
@@ -6796,7 +6948,7 @@ globs: ["**/*"]
6796
6948
  }
6797
6949
 
6798
6950
  // src/cli/index.ts
6799
- var getVersion = () => "3.1.1";
6951
+ var getVersion = () => "3.2.0";
6800
6952
  var main = async () => {
6801
6953
  const program = new import_commander.Command();
6802
6954
  const version = getVersion();