rulesync 3.5.2 → 3.7.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
@@ -3123,8 +3123,82 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
3123
3123
  }
3124
3124
  };
3125
3125
 
3126
- // src/mcp/roo-mcp.ts
3126
+ // src/mcp/geminicli-mcp.ts
3127
3127
  var import_node_path32 = require("path");
3128
+ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
3129
+ json;
3130
+ constructor(params) {
3131
+ super(params);
3132
+ this.json = JSON.parse(this.fileContent || "{}");
3133
+ }
3134
+ getJson() {
3135
+ return this.json;
3136
+ }
3137
+ static getSettablePaths({ global } = {}) {
3138
+ if (global) {
3139
+ return {
3140
+ relativeDirPath: ".gemini",
3141
+ relativeFilePath: "settings.json"
3142
+ };
3143
+ }
3144
+ return {
3145
+ relativeDirPath: ".gemini",
3146
+ relativeFilePath: "settings.json"
3147
+ };
3148
+ }
3149
+ static async fromFile({
3150
+ baseDir = ".",
3151
+ validate = true,
3152
+ global = false
3153
+ }) {
3154
+ const paths = this.getSettablePaths({ global });
3155
+ const fileContent = await readOrInitializeFileContent(
3156
+ (0, import_node_path32.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
3157
+ JSON.stringify({ mcpServers: {} }, null, 2)
3158
+ );
3159
+ const json = JSON.parse(fileContent);
3160
+ const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
3161
+ return new _GeminiCliMcp({
3162
+ baseDir,
3163
+ relativeDirPath: paths.relativeDirPath,
3164
+ relativeFilePath: paths.relativeFilePath,
3165
+ fileContent: JSON.stringify(newJson, null, 2),
3166
+ validate
3167
+ });
3168
+ }
3169
+ static async fromRulesyncMcp({
3170
+ baseDir = ".",
3171
+ rulesyncMcp,
3172
+ validate = true,
3173
+ global = false
3174
+ }) {
3175
+ const paths = this.getSettablePaths({ global });
3176
+ const fileContent = await readOrInitializeFileContent(
3177
+ (0, import_node_path32.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
3178
+ JSON.stringify({ mcpServers: {} }, null, 2)
3179
+ );
3180
+ const json = JSON.parse(fileContent);
3181
+ const newJson = { ...json, mcpServers: rulesyncMcp.getJson().mcpServers };
3182
+ return new _GeminiCliMcp({
3183
+ baseDir,
3184
+ relativeDirPath: paths.relativeDirPath,
3185
+ relativeFilePath: paths.relativeFilePath,
3186
+ fileContent: JSON.stringify(newJson, null, 2),
3187
+ validate
3188
+ });
3189
+ }
3190
+ toRulesyncMcp() {
3191
+ return this.toRulesyncMcpDefault({
3192
+ fileContent: JSON.stringify({ mcpServers: this.json.mcpServers }, null, 2)
3193
+ });
3194
+ }
3195
+ validate() {
3196
+ return { success: true, error: null };
3197
+ }
3198
+ };
3199
+
3200
+ // src/mcp/roo-mcp.ts
3201
+ var import_node_path33 = require("path");
3128
3202
  var RooMcp = class _RooMcp extends ToolMcp {
3129
3203
  json;
3130
3204
  constructor(params) {
@@ -3145,7 +3219,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
3145
3219
  validate = true
3146
3220
  }) {
3147
3221
  const fileContent = await readFileContent(
3148
- (0, import_node_path32.join)(
3222
+ (0, import_node_path33.join)(
3149
3223
  baseDir,
3150
3224
  this.getSettablePaths().relativeDirPath,
3151
3225
  this.getSettablePaths().relativeFilePath
@@ -3188,13 +3262,14 @@ var mcpProcessorToolTargets = [
3188
3262
  "cline",
3189
3263
  "copilot",
3190
3264
  "cursor",
3265
+ "geminicli",
3191
3266
  "roo"
3192
3267
  ];
3193
3268
  var McpProcessorToolTargetSchema = import_mini12.z.enum(
3194
3269
  // 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
3195
3270
  mcpProcessorToolTargets.concat("codexcli")
3196
3271
  );
3197
- var mcpProcessorToolTargetsGlobal = ["claudecode", "codexcli"];
3272
+ var mcpProcessorToolTargetsGlobal = ["claudecode", "codexcli", "geminicli"];
3198
3273
  var McpProcessor = class extends FeatureProcessor {
3199
3274
  toolTarget;
3200
3275
  global;
@@ -3291,6 +3366,15 @@ var McpProcessor = class extends FeatureProcessor {
3291
3366
  })
3292
3367
  ];
3293
3368
  }
3369
+ case "geminicli": {
3370
+ return [
3371
+ await GeminiCliMcp.fromFile({
3372
+ baseDir: this.baseDir,
3373
+ validate: true,
3374
+ global: this.global
3375
+ })
3376
+ ];
3377
+ }
3294
3378
  case "roo": {
3295
3379
  return [
3296
3380
  await RooMcp.fromFile({
@@ -3356,6 +3440,12 @@ var McpProcessor = class extends FeatureProcessor {
3356
3440
  rulesyncMcp: rulesyncMcp2,
3357
3441
  global: this.global
3358
3442
  });
3443
+ case "geminicli":
3444
+ return GeminiCliMcp.fromRulesyncMcp({
3445
+ baseDir: this.baseDir,
3446
+ rulesyncMcp: rulesyncMcp2,
3447
+ global: this.global
3448
+ });
3359
3449
  case "roo":
3360
3450
  return RooMcp.fromRulesyncMcp({
3361
3451
  baseDir: this.baseDir,
@@ -3392,12 +3482,12 @@ var McpProcessor = class extends FeatureProcessor {
3392
3482
  };
3393
3483
 
3394
3484
  // src/rules/rules-processor.ts
3395
- var import_node_path56 = require("path");
3485
+ var import_node_path57 = require("path");
3396
3486
  var import_fast_xml_parser = require("fast-xml-parser");
3397
3487
  var import_mini21 = require("zod/mini");
3398
3488
 
3399
3489
  // src/subagents/simulated-subagent.ts
3400
- var import_node_path33 = require("path");
3490
+ var import_node_path34 = require("path");
3401
3491
  var import_mini13 = require("zod/mini");
3402
3492
 
3403
3493
  // src/subagents/tool-subagent.ts
@@ -3445,7 +3535,7 @@ var SimulatedSubagent = class extends ToolSubagent {
3445
3535
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
3446
3536
  if (!result.success) {
3447
3537
  throw new Error(
3448
- `Invalid frontmatter in ${(0, import_node_path33.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
3538
+ `Invalid frontmatter in ${(0, import_node_path34.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
3449
3539
  );
3450
3540
  }
3451
3541
  }
@@ -3496,7 +3586,7 @@ var SimulatedSubagent = class extends ToolSubagent {
3496
3586
  return {
3497
3587
  success: false,
3498
3588
  error: new Error(
3499
- `Invalid frontmatter in ${(0, import_node_path33.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
3589
+ `Invalid frontmatter in ${(0, import_node_path34.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
3500
3590
  )
3501
3591
  };
3502
3592
  }
@@ -3506,7 +3596,7 @@ var SimulatedSubagent = class extends ToolSubagent {
3506
3596
  relativeFilePath,
3507
3597
  validate = true
3508
3598
  }) {
3509
- const filePath = (0, import_node_path33.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
3599
+ const filePath = (0, import_node_path34.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
3510
3600
  const fileContent = await readFileContent(filePath);
3511
3601
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
3512
3602
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -3516,7 +3606,7 @@ var SimulatedSubagent = class extends ToolSubagent {
3516
3606
  return {
3517
3607
  baseDir,
3518
3608
  relativeDirPath: this.getSettablePaths().relativeDirPath,
3519
- relativeFilePath: (0, import_node_path33.basename)(relativeFilePath),
3609
+ relativeFilePath: (0, import_node_path34.basename)(relativeFilePath),
3520
3610
  frontmatter: result.data,
3521
3611
  body: content.trim(),
3522
3612
  validate
@@ -3663,15 +3753,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
3663
3753
  };
3664
3754
 
3665
3755
  // src/subagents/subagents-processor.ts
3666
- var import_node_path36 = require("path");
3756
+ var import_node_path37 = require("path");
3667
3757
  var import_mini16 = require("zod/mini");
3668
3758
 
3669
3759
  // src/subagents/claudecode-subagent.ts
3670
- var import_node_path35 = require("path");
3760
+ var import_node_path36 = require("path");
3671
3761
  var import_mini15 = require("zod/mini");
3672
3762
 
3673
3763
  // src/subagents/rulesync-subagent.ts
3674
- var import_node_path34 = require("path");
3764
+ var import_node_path35 = require("path");
3675
3765
  var import_mini14 = require("zod/mini");
3676
3766
  var RulesyncSubagentModelSchema = import_mini14.z.enum(["opus", "sonnet", "haiku", "inherit"]);
3677
3767
  var RulesyncSubagentFrontmatterSchema = import_mini14.z.object({
@@ -3692,7 +3782,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
3692
3782
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
3693
3783
  if (!result.success) {
3694
3784
  throw new Error(
3695
- `Invalid frontmatter in ${(0, import_node_path34.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
3785
+ `Invalid frontmatter in ${(0, import_node_path35.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
3696
3786
  );
3697
3787
  }
3698
3788
  }
@@ -3724,7 +3814,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
3724
3814
  return {
3725
3815
  success: false,
3726
3816
  error: new Error(
3727
- `Invalid frontmatter in ${(0, import_node_path34.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
3817
+ `Invalid frontmatter in ${(0, import_node_path35.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
3728
3818
  )
3729
3819
  };
3730
3820
  }
@@ -3732,13 +3822,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
3732
3822
  static async fromFile({
3733
3823
  relativeFilePath
3734
3824
  }) {
3735
- const fileContent = await readFileContent((0, import_node_path34.join)(".rulesync/subagents", relativeFilePath));
3825
+ const fileContent = await readFileContent((0, import_node_path35.join)(".rulesync/subagents", relativeFilePath));
3736
3826
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
3737
3827
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
3738
3828
  if (!result.success) {
3739
3829
  throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${result.error.message}`);
3740
3830
  }
3741
- const filename = (0, import_node_path34.basename)(relativeFilePath);
3831
+ const filename = (0, import_node_path35.basename)(relativeFilePath);
3742
3832
  return new _RulesyncSubagent({
3743
3833
  baseDir: ".",
3744
3834
  relativeDirPath: this.getSettablePaths().relativeDirPath,
@@ -3764,7 +3854,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
3764
3854
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
3765
3855
  if (!result.success) {
3766
3856
  throw new Error(
3767
- `Invalid frontmatter in ${(0, import_node_path35.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
3857
+ `Invalid frontmatter in ${(0, import_node_path36.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
3768
3858
  );
3769
3859
  }
3770
3860
  }
@@ -3776,7 +3866,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
3776
3866
  }
3777
3867
  static getSettablePaths(_options = {}) {
3778
3868
  return {
3779
- relativeDirPath: (0, import_node_path35.join)(".claude", "agents")
3869
+ relativeDirPath: (0, import_node_path36.join)(".claude", "agents")
3780
3870
  };
3781
3871
  }
3782
3872
  getFrontmatter() {
@@ -3844,7 +3934,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
3844
3934
  return {
3845
3935
  success: false,
3846
3936
  error: new Error(
3847
- `Invalid frontmatter in ${(0, import_node_path35.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
3937
+ `Invalid frontmatter in ${(0, import_node_path36.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
3848
3938
  )
3849
3939
  };
3850
3940
  }
@@ -3862,7 +3952,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
3862
3952
  global = false
3863
3953
  }) {
3864
3954
  const paths = this.getSettablePaths({ global });
3865
- const filePath = (0, import_node_path35.join)(baseDir, paths.relativeDirPath, relativeFilePath);
3955
+ const filePath = (0, import_node_path36.join)(baseDir, paths.relativeDirPath, relativeFilePath);
3866
3956
  const fileContent = await readFileContent(filePath);
3867
3957
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
3868
3958
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -4016,7 +4106,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
4016
4106
  * Load and parse rulesync subagent files from .rulesync/subagents/ directory
4017
4107
  */
4018
4108
  async loadRulesyncFiles() {
4019
- const subagentsDir = (0, import_node_path36.join)(RulesyncSubagent.getSettablePaths().relativeDirPath);
4109
+ const subagentsDir = (0, import_node_path37.join)(RulesyncSubagent.getSettablePaths().relativeDirPath);
4020
4110
  const dirExists = await directoryExists(subagentsDir);
4021
4111
  if (!dirExists) {
4022
4112
  logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
@@ -4031,7 +4121,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
4031
4121
  logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
4032
4122
  const rulesyncSubagents = [];
4033
4123
  for (const mdFile of mdFiles) {
4034
- const filepath = (0, import_node_path36.join)(subagentsDir, mdFile);
4124
+ const filepath = (0, import_node_path37.join)(subagentsDir, mdFile);
4035
4125
  try {
4036
4126
  const rulesyncSubagent = await RulesyncSubagent.fromFile({
4037
4127
  relativeFilePath: mdFile,
@@ -4150,8 +4240,8 @@ var SubagentsProcessor = class extends FeatureProcessor {
4150
4240
  relativeDirPath,
4151
4241
  fromFile
4152
4242
  }) {
4153
- const paths = await findFilesByGlobs((0, import_node_path36.join)(this.baseDir, relativeDirPath, "*.md"));
4154
- const subagents = (await Promise.allSettled(paths.map((path2) => fromFile((0, import_node_path36.basename)(path2))))).filter((r) => r.status === "fulfilled").map((r) => r.value);
4243
+ const paths = await findFilesByGlobs((0, import_node_path37.join)(this.baseDir, relativeDirPath, "*.md"));
4244
+ const subagents = (await Promise.allSettled(paths.map((path2) => fromFile((0, import_node_path37.basename)(path2))))).filter((r) => r.status === "fulfilled").map((r) => r.value);
4155
4245
  logger.info(`Successfully loaded ${subagents.length} ${relativeDirPath} subagents`);
4156
4246
  return subagents;
4157
4247
  }
@@ -4178,13 +4268,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
4178
4268
  };
4179
4269
 
4180
4270
  // src/rules/agentsmd-rule.ts
4181
- var import_node_path39 = require("path");
4271
+ var import_node_path40 = require("path");
4182
4272
 
4183
4273
  // src/rules/tool-rule.ts
4184
- var import_node_path38 = require("path");
4274
+ var import_node_path39 = require("path");
4185
4275
 
4186
4276
  // src/rules/rulesync-rule.ts
4187
- var import_node_path37 = require("path");
4277
+ var import_node_path38 = require("path");
4188
4278
  var import_mini17 = require("zod/mini");
4189
4279
  var RulesyncRuleFrontmatterSchema = import_mini17.z.object({
4190
4280
  root: import_mini17.z.optional(import_mini17.z.optional(import_mini17.z.boolean())),
@@ -4213,7 +4303,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
4213
4303
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
4214
4304
  if (!result.success) {
4215
4305
  throw new Error(
4216
- `Invalid frontmatter in ${(0, import_node_path37.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
4306
+ `Invalid frontmatter in ${(0, import_node_path38.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
4217
4307
  );
4218
4308
  }
4219
4309
  }
@@ -4248,7 +4338,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
4248
4338
  return {
4249
4339
  success: false,
4250
4340
  error: new Error(
4251
- `Invalid frontmatter in ${(0, import_node_path37.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
4341
+ `Invalid frontmatter in ${(0, import_node_path38.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
4252
4342
  )
4253
4343
  };
4254
4344
  }
@@ -4257,7 +4347,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
4257
4347
  relativeFilePath,
4258
4348
  validate = true
4259
4349
  }) {
4260
- const filePath = (0, import_node_path37.join)(this.getSettablePaths().legacy.relativeDirPath, relativeFilePath);
4350
+ const filePath = (0, import_node_path38.join)(this.getSettablePaths().legacy.relativeDirPath, relativeFilePath);
4261
4351
  const fileContent = await readFileContent(filePath);
4262
4352
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
4263
4353
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
@@ -4272,7 +4362,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
4272
4362
  agentsmd: result.data.agentsmd,
4273
4363
  cursor: result.data.cursor
4274
4364
  };
4275
- const filename = (0, import_node_path37.basename)(filePath);
4365
+ const filename = (0, import_node_path38.basename)(filePath);
4276
4366
  return new _RulesyncRule({
4277
4367
  baseDir: ".",
4278
4368
  relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
@@ -4286,7 +4376,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
4286
4376
  relativeFilePath,
4287
4377
  validate = true
4288
4378
  }) {
4289
- const filePath = (0, import_node_path37.join)(this.getSettablePaths().recommended.relativeDirPath, relativeFilePath);
4379
+ const filePath = (0, import_node_path38.join)(this.getSettablePaths().recommended.relativeDirPath, relativeFilePath);
4290
4380
  const fileContent = await readFileContent(filePath);
4291
4381
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
4292
4382
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
@@ -4301,7 +4391,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
4301
4391
  agentsmd: result.data.agentsmd,
4302
4392
  cursor: result.data.cursor
4303
4393
  };
4304
- const filename = (0, import_node_path37.basename)(filePath);
4394
+ const filename = (0, import_node_path38.basename)(filePath);
4305
4395
  return new _RulesyncRule({
4306
4396
  baseDir: ".",
4307
4397
  relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
@@ -4387,7 +4477,7 @@ var ToolRule = class extends ToolFile {
4387
4477
  });
4388
4478
  const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
4389
4479
  if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
4390
- params.relativeDirPath = (0, import_node_path38.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
4480
+ params.relativeDirPath = (0, import_node_path39.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
4391
4481
  params.relativeFilePath = "AGENTS.md";
4392
4482
  }
4393
4483
  return params;
@@ -4463,8 +4553,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
4463
4553
  validate = true
4464
4554
  }) {
4465
4555
  const isRoot = relativeFilePath === "AGENTS.md";
4466
- const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path39.join)(".agents/memories", relativeFilePath);
4467
- const fileContent = await readFileContent((0, import_node_path39.join)(baseDir, relativePath));
4556
+ const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path40.join)(".agents/memories", relativeFilePath);
4557
+ const fileContent = await readFileContent((0, import_node_path40.join)(baseDir, relativePath));
4468
4558
  return new _AgentsMdRule({
4469
4559
  baseDir,
4470
4560
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -4504,7 +4594,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
4504
4594
  };
4505
4595
 
4506
4596
  // src/rules/amazonqcli-rule.ts
4507
- var import_node_path40 = require("path");
4597
+ var import_node_path41 = require("path");
4508
4598
  var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
4509
4599
  static getSettablePaths() {
4510
4600
  return {
@@ -4519,7 +4609,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
4519
4609
  validate = true
4520
4610
  }) {
4521
4611
  const fileContent = await readFileContent(
4522
- (0, import_node_path40.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4612
+ (0, import_node_path41.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4523
4613
  );
4524
4614
  return new _AmazonQCliRule({
4525
4615
  baseDir,
@@ -4559,7 +4649,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
4559
4649
  };
4560
4650
 
4561
4651
  // src/rules/augmentcode-legacy-rule.ts
4562
- var import_node_path41 = require("path");
4652
+ var import_node_path42 = require("path");
4563
4653
  var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
4564
4654
  toRulesyncRule() {
4565
4655
  const rulesyncFrontmatter = {
@@ -4620,8 +4710,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
4620
4710
  }) {
4621
4711
  const settablePaths = this.getSettablePaths();
4622
4712
  const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
4623
- const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path41.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
4624
- const fileContent = await readFileContent((0, import_node_path41.join)(baseDir, relativePath));
4713
+ const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path42.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
4714
+ const fileContent = await readFileContent((0, import_node_path42.join)(baseDir, relativePath));
4625
4715
  return new _AugmentcodeLegacyRule({
4626
4716
  baseDir,
4627
4717
  relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
@@ -4634,7 +4724,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
4634
4724
  };
4635
4725
 
4636
4726
  // src/rules/augmentcode-rule.ts
4637
- var import_node_path42 = require("path");
4727
+ var import_node_path43 = require("path");
4638
4728
  var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
4639
4729
  toRulesyncRule() {
4640
4730
  return this.toRulesyncRuleDefault();
@@ -4666,7 +4756,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
4666
4756
  validate = true
4667
4757
  }) {
4668
4758
  const fileContent = await readFileContent(
4669
- (0, import_node_path42.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4759
+ (0, import_node_path43.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4670
4760
  );
4671
4761
  const { body: content } = parseFrontmatter(fileContent);
4672
4762
  return new _AugmentcodeRule({
@@ -4689,7 +4779,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
4689
4779
  };
4690
4780
 
4691
4781
  // src/rules/claudecode-rule.ts
4692
- var import_node_path43 = require("path");
4782
+ var import_node_path44 = require("path");
4693
4783
  var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
4694
4784
  static getSettablePaths({
4695
4785
  global
@@ -4708,7 +4798,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
4708
4798
  relativeFilePath: "CLAUDE.md"
4709
4799
  },
4710
4800
  nonRoot: {
4711
- relativeDirPath: (0, import_node_path43.join)(".claude", "memories")
4801
+ relativeDirPath: (0, import_node_path44.join)(".claude", "memories")
4712
4802
  }
4713
4803
  };
4714
4804
  }
@@ -4723,7 +4813,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
4723
4813
  if (isRoot) {
4724
4814
  const relativePath2 = paths.root.relativeFilePath;
4725
4815
  const fileContent2 = await readFileContent(
4726
- (0, import_node_path43.join)(baseDir, paths.root.relativeDirPath, relativePath2)
4816
+ (0, import_node_path44.join)(baseDir, paths.root.relativeDirPath, relativePath2)
4727
4817
  );
4728
4818
  return new _ClaudecodeRule({
4729
4819
  baseDir,
@@ -4737,8 +4827,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
4737
4827
  if (!paths.nonRoot) {
4738
4828
  throw new Error("nonRoot path is not set");
4739
4829
  }
4740
- const relativePath = (0, import_node_path43.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
4741
- const fileContent = await readFileContent((0, import_node_path43.join)(baseDir, relativePath));
4830
+ const relativePath = (0, import_node_path44.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
4831
+ const fileContent = await readFileContent((0, import_node_path44.join)(baseDir, relativePath));
4742
4832
  return new _ClaudecodeRule({
4743
4833
  baseDir,
4744
4834
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -4780,7 +4870,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
4780
4870
  };
4781
4871
 
4782
4872
  // src/rules/cline-rule.ts
4783
- var import_node_path44 = require("path");
4873
+ var import_node_path45 = require("path");
4784
4874
  var import_mini18 = require("zod/mini");
4785
4875
  var ClineRuleFrontmatterSchema = import_mini18.z.object({
4786
4876
  description: import_mini18.z.string()
@@ -4825,7 +4915,7 @@ var ClineRule = class _ClineRule extends ToolRule {
4825
4915
  validate = true
4826
4916
  }) {
4827
4917
  const fileContent = await readFileContent(
4828
- (0, import_node_path44.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4918
+ (0, import_node_path45.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
4829
4919
  );
4830
4920
  return new _ClineRule({
4831
4921
  baseDir,
@@ -4838,7 +4928,7 @@ var ClineRule = class _ClineRule extends ToolRule {
4838
4928
  };
4839
4929
 
4840
4930
  // src/rules/codexcli-rule.ts
4841
- var import_node_path45 = require("path");
4931
+ var import_node_path46 = require("path");
4842
4932
  var CodexcliRule = class _CodexcliRule extends ToolRule {
4843
4933
  static getSettablePaths({
4844
4934
  global
@@ -4872,7 +4962,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
4872
4962
  if (isRoot) {
4873
4963
  const relativePath2 = paths.root.relativeFilePath;
4874
4964
  const fileContent2 = await readFileContent(
4875
- (0, import_node_path45.join)(baseDir, paths.root.relativeDirPath, relativePath2)
4965
+ (0, import_node_path46.join)(baseDir, paths.root.relativeDirPath, relativePath2)
4876
4966
  );
4877
4967
  return new _CodexcliRule({
4878
4968
  baseDir,
@@ -4886,8 +4976,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
4886
4976
  if (!paths.nonRoot) {
4887
4977
  throw new Error("nonRoot path is not set");
4888
4978
  }
4889
- const relativePath = (0, import_node_path45.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
4890
- const fileContent = await readFileContent((0, import_node_path45.join)(baseDir, relativePath));
4979
+ const relativePath = (0, import_node_path46.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
4980
+ const fileContent = await readFileContent((0, import_node_path46.join)(baseDir, relativePath));
4891
4981
  return new _CodexcliRule({
4892
4982
  baseDir,
4893
4983
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -4929,7 +5019,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
4929
5019
  };
4930
5020
 
4931
5021
  // src/rules/copilot-rule.ts
4932
- var import_node_path46 = require("path");
5022
+ var import_node_path47 = require("path");
4933
5023
  var import_mini19 = require("zod/mini");
4934
5024
  var CopilotRuleFrontmatterSchema = import_mini19.z.object({
4935
5025
  description: import_mini19.z.optional(import_mini19.z.string()),
@@ -4954,7 +5044,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
4954
5044
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
4955
5045
  if (!result.success) {
4956
5046
  throw new Error(
4957
- `Invalid frontmatter in ${(0, import_node_path46.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
5047
+ `Invalid frontmatter in ${(0, import_node_path47.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
4958
5048
  );
4959
5049
  }
4960
5050
  }
@@ -5026,11 +5116,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
5026
5116
  validate = true
5027
5117
  }) {
5028
5118
  const isRoot = relativeFilePath === "copilot-instructions.md";
5029
- const relativePath = isRoot ? (0, import_node_path46.join)(
5119
+ const relativePath = isRoot ? (0, import_node_path47.join)(
5030
5120
  this.getSettablePaths().root.relativeDirPath,
5031
5121
  this.getSettablePaths().root.relativeFilePath
5032
- ) : (0, import_node_path46.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
5033
- const fileContent = await readFileContent((0, import_node_path46.join)(baseDir, relativePath));
5122
+ ) : (0, import_node_path47.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
5123
+ const fileContent = await readFileContent((0, import_node_path47.join)(baseDir, relativePath));
5034
5124
  if (isRoot) {
5035
5125
  return new _CopilotRule({
5036
5126
  baseDir,
@@ -5049,7 +5139,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
5049
5139
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
5050
5140
  if (!result.success) {
5051
5141
  throw new Error(
5052
- `Invalid frontmatter in ${(0, import_node_path46.join)(baseDir, relativeFilePath)}: ${result.error.message}`
5142
+ `Invalid frontmatter in ${(0, import_node_path47.join)(baseDir, relativeFilePath)}: ${result.error.message}`
5053
5143
  );
5054
5144
  }
5055
5145
  return new _CopilotRule({
@@ -5073,7 +5163,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
5073
5163
  return {
5074
5164
  success: false,
5075
5165
  error: new Error(
5076
- `Invalid frontmatter in ${(0, import_node_path46.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
5166
+ `Invalid frontmatter in ${(0, import_node_path47.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
5077
5167
  )
5078
5168
  };
5079
5169
  }
@@ -5093,7 +5183,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
5093
5183
  };
5094
5184
 
5095
5185
  // src/rules/cursor-rule.ts
5096
- var import_node_path47 = require("path");
5186
+ var import_node_path48 = require("path");
5097
5187
  var import_mini20 = require("zod/mini");
5098
5188
  var CursorRuleFrontmatterSchema = import_mini20.z.object({
5099
5189
  description: import_mini20.z.optional(import_mini20.z.string()),
@@ -5115,7 +5205,7 @@ var CursorRule = class _CursorRule extends ToolRule {
5115
5205
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
5116
5206
  if (!result.success) {
5117
5207
  throw new Error(
5118
- `Invalid frontmatter in ${(0, import_node_path47.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
5208
+ `Invalid frontmatter in ${(0, import_node_path48.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
5119
5209
  );
5120
5210
  }
5121
5211
  }
@@ -5192,6 +5282,16 @@ var CursorRule = class _CursorRule extends ToolRule {
5192
5282
  validate: true
5193
5283
  });
5194
5284
  }
5285
+ /**
5286
+ * Resolve cursor globs with priority: cursor-specific > parent
5287
+ * Returns comma-separated string for Cursor format, or undefined if no globs
5288
+ * @param cursorSpecificGlobs - Cursor-specific globs (takes priority if defined)
5289
+ * @param parentGlobs - Parent globs (used if cursorSpecificGlobs is undefined)
5290
+ */
5291
+ static resolveCursorGlobs(cursorSpecificGlobs, parentGlobs) {
5292
+ const targetGlobs = cursorSpecificGlobs !== void 0 ? cursorSpecificGlobs : parentGlobs;
5293
+ return targetGlobs && targetGlobs.length > 0 ? targetGlobs.join(",") : void 0;
5294
+ }
5195
5295
  static fromRulesyncRule({
5196
5296
  baseDir = ".",
5197
5297
  rulesyncRule,
@@ -5200,7 +5300,7 @@ var CursorRule = class _CursorRule extends ToolRule {
5200
5300
  const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
5201
5301
  const cursorFrontmatter = {
5202
5302
  description: rulesyncFrontmatter.description,
5203
- globs: rulesyncFrontmatter.globs?.length ?? 0 > 0 ? rulesyncFrontmatter.globs?.join(",") : void 0,
5303
+ globs: this.resolveCursorGlobs(rulesyncFrontmatter.cursor?.globs, rulesyncFrontmatter.globs),
5204
5304
  alwaysApply: rulesyncFrontmatter.cursor?.alwaysApply ?? void 0
5205
5305
  };
5206
5306
  const body = rulesyncRule.getBody();
@@ -5222,19 +5322,19 @@ var CursorRule = class _CursorRule extends ToolRule {
5222
5322
  validate = true
5223
5323
  }) {
5224
5324
  const fileContent = await readFileContent(
5225
- (0, import_node_path47.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5325
+ (0, import_node_path48.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5226
5326
  );
5227
5327
  const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
5228
5328
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
5229
5329
  if (!result.success) {
5230
5330
  throw new Error(
5231
- `Invalid frontmatter in ${(0, import_node_path47.join)(baseDir, relativeFilePath)}: ${result.error.message}`
5331
+ `Invalid frontmatter in ${(0, import_node_path48.join)(baseDir, relativeFilePath)}: ${result.error.message}`
5232
5332
  );
5233
5333
  }
5234
5334
  return new _CursorRule({
5235
5335
  baseDir,
5236
5336
  relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
5237
- relativeFilePath: (0, import_node_path47.basename)(relativeFilePath),
5337
+ relativeFilePath: (0, import_node_path48.basename)(relativeFilePath),
5238
5338
  frontmatter: result.data,
5239
5339
  body: content.trim(),
5240
5340
  validate
@@ -5251,7 +5351,7 @@ var CursorRule = class _CursorRule extends ToolRule {
5251
5351
  return {
5252
5352
  success: false,
5253
5353
  error: new Error(
5254
- `Invalid frontmatter in ${(0, import_node_path47.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
5354
+ `Invalid frontmatter in ${(0, import_node_path48.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
5255
5355
  )
5256
5356
  };
5257
5357
  }
@@ -5271,7 +5371,7 @@ var CursorRule = class _CursorRule extends ToolRule {
5271
5371
  };
5272
5372
 
5273
5373
  // src/rules/geminicli-rule.ts
5274
- var import_node_path48 = require("path");
5374
+ var import_node_path49 = require("path");
5275
5375
  var GeminiCliRule = class _GeminiCliRule extends ToolRule {
5276
5376
  static getSettablePaths({
5277
5377
  global
@@ -5305,7 +5405,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
5305
5405
  if (isRoot) {
5306
5406
  const relativePath2 = paths.root.relativeFilePath;
5307
5407
  const fileContent2 = await readFileContent(
5308
- (0, import_node_path48.join)(baseDir, paths.root.relativeDirPath, relativePath2)
5408
+ (0, import_node_path49.join)(baseDir, paths.root.relativeDirPath, relativePath2)
5309
5409
  );
5310
5410
  return new _GeminiCliRule({
5311
5411
  baseDir,
@@ -5319,8 +5419,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
5319
5419
  if (!paths.nonRoot) {
5320
5420
  throw new Error("nonRoot path is not set");
5321
5421
  }
5322
- const relativePath = (0, import_node_path48.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
5323
- const fileContent = await readFileContent((0, import_node_path48.join)(baseDir, relativePath));
5422
+ const relativePath = (0, import_node_path49.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
5423
+ const fileContent = await readFileContent((0, import_node_path49.join)(baseDir, relativePath));
5324
5424
  return new _GeminiCliRule({
5325
5425
  baseDir,
5326
5426
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -5362,7 +5462,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
5362
5462
  };
5363
5463
 
5364
5464
  // src/rules/junie-rule.ts
5365
- var import_node_path49 = require("path");
5465
+ var import_node_path50 = require("path");
5366
5466
  var JunieRule = class _JunieRule extends ToolRule {
5367
5467
  static getSettablePaths() {
5368
5468
  return {
@@ -5381,8 +5481,8 @@ var JunieRule = class _JunieRule extends ToolRule {
5381
5481
  validate = true
5382
5482
  }) {
5383
5483
  const isRoot = relativeFilePath === "guidelines.md";
5384
- const relativePath = isRoot ? "guidelines.md" : (0, import_node_path49.join)(".junie/memories", relativeFilePath);
5385
- const fileContent = await readFileContent((0, import_node_path49.join)(baseDir, relativePath));
5484
+ const relativePath = isRoot ? "guidelines.md" : (0, import_node_path50.join)(".junie/memories", relativeFilePath);
5485
+ const fileContent = await readFileContent((0, import_node_path50.join)(baseDir, relativePath));
5386
5486
  return new _JunieRule({
5387
5487
  baseDir,
5388
5488
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -5422,7 +5522,7 @@ var JunieRule = class _JunieRule extends ToolRule {
5422
5522
  };
5423
5523
 
5424
5524
  // src/rules/kiro-rule.ts
5425
- var import_node_path50 = require("path");
5525
+ var import_node_path51 = require("path");
5426
5526
  var KiroRule = class _KiroRule extends ToolRule {
5427
5527
  static getSettablePaths() {
5428
5528
  return {
@@ -5437,7 +5537,7 @@ var KiroRule = class _KiroRule extends ToolRule {
5437
5537
  validate = true
5438
5538
  }) {
5439
5539
  const fileContent = await readFileContent(
5440
- (0, import_node_path50.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5540
+ (0, import_node_path51.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5441
5541
  );
5442
5542
  return new _KiroRule({
5443
5543
  baseDir,
@@ -5477,7 +5577,7 @@ var KiroRule = class _KiroRule extends ToolRule {
5477
5577
  };
5478
5578
 
5479
5579
  // src/rules/opencode-rule.ts
5480
- var import_node_path51 = require("path");
5580
+ var import_node_path52 = require("path");
5481
5581
  var OpenCodeRule = class _OpenCodeRule extends ToolRule {
5482
5582
  static getSettablePaths() {
5483
5583
  return {
@@ -5496,8 +5596,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
5496
5596
  validate = true
5497
5597
  }) {
5498
5598
  const isRoot = relativeFilePath === "AGENTS.md";
5499
- const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path51.join)(".opencode/memories", relativeFilePath);
5500
- const fileContent = await readFileContent((0, import_node_path51.join)(baseDir, relativePath));
5599
+ const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path52.join)(".opencode/memories", relativeFilePath);
5600
+ const fileContent = await readFileContent((0, import_node_path52.join)(baseDir, relativePath));
5501
5601
  return new _OpenCodeRule({
5502
5602
  baseDir,
5503
5603
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -5537,7 +5637,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
5537
5637
  };
5538
5638
 
5539
5639
  // src/rules/qwencode-rule.ts
5540
- var import_node_path52 = require("path");
5640
+ var import_node_path53 = require("path");
5541
5641
  var QwencodeRule = class _QwencodeRule extends ToolRule {
5542
5642
  static getSettablePaths() {
5543
5643
  return {
@@ -5556,8 +5656,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
5556
5656
  validate = true
5557
5657
  }) {
5558
5658
  const isRoot = relativeFilePath === "QWEN.md";
5559
- const relativePath = isRoot ? "QWEN.md" : (0, import_node_path52.join)(".qwen/memories", relativeFilePath);
5560
- const fileContent = await readFileContent((0, import_node_path52.join)(baseDir, relativePath));
5659
+ const relativePath = isRoot ? "QWEN.md" : (0, import_node_path53.join)(".qwen/memories", relativeFilePath);
5660
+ const fileContent = await readFileContent((0, import_node_path53.join)(baseDir, relativePath));
5561
5661
  return new _QwencodeRule({
5562
5662
  baseDir,
5563
5663
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -5594,7 +5694,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
5594
5694
  };
5595
5695
 
5596
5696
  // src/rules/roo-rule.ts
5597
- var import_node_path53 = require("path");
5697
+ var import_node_path54 = require("path");
5598
5698
  var RooRule = class _RooRule extends ToolRule {
5599
5699
  static getSettablePaths() {
5600
5700
  return {
@@ -5609,7 +5709,7 @@ var RooRule = class _RooRule extends ToolRule {
5609
5709
  validate = true
5610
5710
  }) {
5611
5711
  const fileContent = await readFileContent(
5612
- (0, import_node_path53.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5712
+ (0, import_node_path54.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5613
5713
  );
5614
5714
  return new _RooRule({
5615
5715
  baseDir,
@@ -5664,7 +5764,7 @@ var RooRule = class _RooRule extends ToolRule {
5664
5764
  };
5665
5765
 
5666
5766
  // src/rules/warp-rule.ts
5667
- var import_node_path54 = require("path");
5767
+ var import_node_path55 = require("path");
5668
5768
  var WarpRule = class _WarpRule extends ToolRule {
5669
5769
  constructor({ fileContent, root, ...rest }) {
5670
5770
  super({
@@ -5690,8 +5790,8 @@ var WarpRule = class _WarpRule extends ToolRule {
5690
5790
  validate = true
5691
5791
  }) {
5692
5792
  const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
5693
- const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path54.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
5694
- const fileContent = await readFileContent((0, import_node_path54.join)(baseDir, relativePath));
5793
+ const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path55.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
5794
+ const fileContent = await readFileContent((0, import_node_path55.join)(baseDir, relativePath));
5695
5795
  return new _WarpRule({
5696
5796
  baseDir,
5697
5797
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
@@ -5731,7 +5831,7 @@ var WarpRule = class _WarpRule extends ToolRule {
5731
5831
  };
5732
5832
 
5733
5833
  // src/rules/windsurf-rule.ts
5734
- var import_node_path55 = require("path");
5834
+ var import_node_path56 = require("path");
5735
5835
  var WindsurfRule = class _WindsurfRule extends ToolRule {
5736
5836
  static getSettablePaths() {
5737
5837
  return {
@@ -5746,7 +5846,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
5746
5846
  validate = true
5747
5847
  }) {
5748
5848
  const fileContent = await readFileContent(
5749
- (0, import_node_path55.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5849
+ (0, import_node_path56.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
5750
5850
  );
5751
5851
  return new _WindsurfRule({
5752
5852
  baseDir,
@@ -6146,10 +6246,10 @@ var RulesProcessor = class extends FeatureProcessor {
6146
6246
  * Load and parse rulesync rule files from .rulesync/rules/ directory
6147
6247
  */
6148
6248
  async loadRulesyncFiles() {
6149
- const files = await findFilesByGlobs((0, import_node_path56.join)(".rulesync/rules", "*.md"));
6249
+ const files = await findFilesByGlobs((0, import_node_path57.join)(".rulesync/rules", "*.md"));
6150
6250
  logger.debug(`Found ${files.length} rulesync files`);
6151
6251
  const rulesyncRules = await Promise.all(
6152
- files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path56.basename)(file) }))
6252
+ files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path57.basename)(file) }))
6153
6253
  );
6154
6254
  const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
6155
6255
  if (rootRules.length > 1) {
@@ -6167,10 +6267,10 @@ var RulesProcessor = class extends FeatureProcessor {
6167
6267
  return rulesyncRules;
6168
6268
  }
6169
6269
  async loadRulesyncFilesLegacy() {
6170
- const legacyFiles = await findFilesByGlobs((0, import_node_path56.join)(".rulesync", "*.md"));
6270
+ const legacyFiles = await findFilesByGlobs((0, import_node_path57.join)(".rulesync", "*.md"));
6171
6271
  logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
6172
6272
  return Promise.all(
6173
- legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path56.basename)(file) }))
6273
+ legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path57.basename)(file) }))
6174
6274
  );
6175
6275
  }
6176
6276
  /**
@@ -6234,13 +6334,13 @@ var RulesProcessor = class extends FeatureProcessor {
6234
6334
  return [];
6235
6335
  }
6236
6336
  const rootFilePaths = await findFilesByGlobs(
6237
- (0, import_node_path56.join)(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
6337
+ (0, import_node_path57.join)(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
6238
6338
  );
6239
6339
  return await Promise.all(
6240
6340
  rootFilePaths.map(
6241
6341
  (filePath) => root.fromFile({
6242
6342
  baseDir: this.baseDir,
6243
- relativeFilePath: (0, import_node_path56.basename)(filePath),
6343
+ relativeFilePath: (0, import_node_path57.basename)(filePath),
6244
6344
  global: this.global
6245
6345
  })
6246
6346
  )
@@ -6252,13 +6352,13 @@ var RulesProcessor = class extends FeatureProcessor {
6252
6352
  return [];
6253
6353
  }
6254
6354
  const nonRootFilePaths = await findFilesByGlobs(
6255
- (0, import_node_path56.join)(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
6355
+ (0, import_node_path57.join)(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
6256
6356
  );
6257
6357
  return await Promise.all(
6258
6358
  nonRootFilePaths.map(
6259
6359
  (filePath) => nonRoot.fromFile({
6260
6360
  baseDir: this.baseDir,
6261
- relativeFilePath: (0, import_node_path56.basename)(filePath),
6361
+ relativeFilePath: (0, import_node_path57.basename)(filePath),
6262
6362
  global: this.global
6263
6363
  })
6264
6364
  )
@@ -6628,14 +6728,14 @@ s/<command> [arguments]
6628
6728
  This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
6629
6729
  The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
6630
6730
 
6631
- 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.` : "";
6731
+ When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path57.join)(commands.relativeDirPath, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
6632
6732
  const subagentsSection = subagents ? `## Simulated Subagents
6633
6733
 
6634
6734
  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.
6635
6735
 
6636
- 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.
6736
+ When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path57.join)(subagents.relativeDirPath, "{subagent}.md")}\`, and execute its contents as the block of operations.
6637
6737
 
6638
- 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.` : "";
6738
+ For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path57.join)(subagents.relativeDirPath, "planner.md")}\`, and execute its contents as the block of operations.` : "";
6639
6739
  const result = [
6640
6740
  overview,
6641
6741
  ...this.simulateCommands && CommandsProcessor.getToolTargetsSimulated().includes(this.toolTarget) ? [commandsSection] : [],
@@ -6845,58 +6945,69 @@ async function generateSubagents(config) {
6845
6945
  }
6846
6946
 
6847
6947
  // src/cli/commands/gitignore.ts
6848
- var import_node_path57 = require("path");
6948
+ var import_node_path58 = require("path");
6849
6949
  var gitignoreCommand = async () => {
6850
- const gitignorePath = (0, import_node_path57.join)(process.cwd(), ".gitignore");
6950
+ const gitignorePath = (0, import_node_path58.join)(process.cwd(), ".gitignore");
6851
6951
  const rulesFilesToIgnore = [
6852
6952
  "# Generated by rulesync - AI tool configuration files",
6953
+ // AGENTS.md
6954
+ "**/AGENTS.md",
6955
+ "**/.agents/",
6956
+ // Amazon Q
6853
6957
  "**/.amazonq/",
6854
- "**/.github/copilot-instructions.md",
6855
- "**/.github/instructions/",
6856
- "**/.github/prompts/",
6857
- "**/.cursor/",
6858
- "**/.cursorignore",
6859
- "**/.clinerules/",
6860
- "**/.clineignore",
6958
+ // Augment
6959
+ "**/.augmentignore",
6960
+ "**/.augment/rules/",
6961
+ "**/.augment-guidelines",
6962
+ // Claude Code
6861
6963
  "**/CLAUDE.md",
6862
6964
  "**/.claude/memories/",
6863
6965
  "**/.claude/commands/",
6864
6966
  "**/.claude/agents/",
6865
6967
  "**/.claude/settings.local.json",
6866
- "**/AGENTS.md",
6867
- "**/.agents/",
6868
- "**/.roo/rules/",
6869
- "**/.rooignore",
6870
- "**/.copilotignore",
6968
+ "**/.mcp.json",
6969
+ // Cline
6970
+ "**/.clinerules/",
6971
+ "**/.clineignore",
6972
+ "**/.cline/mcp.json",
6973
+ // Codex
6974
+ "**/.codexignore",
6975
+ "**/.codex/",
6976
+ // Cursor
6977
+ "**/.cursor/",
6978
+ "**/.cursorignore",
6979
+ "**/.cursor/mcp.json",
6980
+ // Gemini
6871
6981
  "**/GEMINI.md",
6872
6982
  "**/.gemini/memories/",
6873
6983
  "**/.gemini/commands/",
6874
6984
  "**/.gemini/subagents/",
6875
- "**/QWEN.md",
6876
- "**/.qwen/memories/",
6877
- "**/.aiexclude",
6878
- "**/.aiignore",
6879
- "**/.augmentignore",
6880
- "**/.kiro/steering/",
6881
- "**/.augment/rules/",
6882
- "**/.augment-guidelines",
6985
+ // GitHub Copilot
6986
+ "**/.github/copilot-instructions.md",
6987
+ "**/.github/instructions/",
6988
+ "**/.github/prompts/",
6989
+ "**/.github/subagents/",
6990
+ "**/.vscode/mcp.json",
6991
+ // Junie
6883
6992
  "**/.junie/guidelines.md",
6884
- "**/.noai",
6993
+ // Kiro
6994
+ "**/.kiro/steering/",
6995
+ "**/.aiignore",
6996
+ // OpenCode
6885
6997
  "**/.opencode/memories/",
6886
6998
  "**/.opencode/commands/",
6887
6999
  "**/opencode.json",
6888
- "**/.mcp.json",
6889
- "**/.cursor/mcp.json",
6890
- "**/.cline/mcp.json",
7000
+ // Qwen
7001
+ "**/QWEN.md",
7002
+ "**/.qwen/memories/",
7003
+ // Roo
7004
+ "**/.roo/rules/",
7005
+ "**/.rooignore",
6891
7006
  "**/.roo/mcp.json",
6892
7007
  "**/.roo/subagents/",
6893
- "**/.vscode/mcp.json",
6894
- "**/.github/commands/",
6895
- "**/.github/subagents/",
7008
+ // Warp
6896
7009
  "**/.warp/",
6897
- "**/WARP.md",
6898
- "**/.codexignore",
6899
- "**/.codex/"
7010
+ "**/WARP.md"
6900
7011
  ];
6901
7012
  let gitignoreContent = "";
6902
7013
  if (await fileExists(gitignorePath)) {
@@ -7075,7 +7186,7 @@ async function importSubagents(config, tool) {
7075
7186
  }
7076
7187
 
7077
7188
  // src/cli/commands/init.ts
7078
- var import_node_path58 = require("path");
7189
+ var import_node_path59 = require("path");
7079
7190
  async function initCommand() {
7080
7191
  logger.info("Initializing rulesync...");
7081
7192
  await ensureDir(".rulesync");
@@ -7083,7 +7194,7 @@ async function initCommand() {
7083
7194
  await createConfigFile();
7084
7195
  logger.success("rulesync initialized successfully!");
7085
7196
  logger.info("Next steps:");
7086
- logger.info(`1. Edit rule files in .rulesync/rules/`);
7197
+ logger.info(`1. Edit .rulesync/**/*.md, .rulesync/.mcp.json and .rulesyncignore`);
7087
7198
  logger.info("2. Run 'rulesync generate' to create configuration files");
7088
7199
  }
7089
7200
  async function createConfigFile() {
@@ -7111,7 +7222,7 @@ async function createConfigFile() {
7111
7222
  logger.success("Created rulesync.jsonc");
7112
7223
  }
7113
7224
  async function createSampleFiles() {
7114
- const sampleFile = {
7225
+ const sampleRuleFile = {
7115
7226
  filename: "overview.md",
7116
7227
  content: `---
7117
7228
  root: true
@@ -7146,20 +7257,134 @@ globs: ["**/*"]
7146
7257
  - Follow single responsibility principle
7147
7258
  `
7148
7259
  };
7149
- const filepath = (0, import_node_path58.join)(".rulesync/rules", sampleFile.filename);
7150
- await ensureDir(".rulesync/rules");
7151
- await ensureDir(RulesyncCommand.getSettablePaths().relativeDirPath);
7152
- await ensureDir(".rulesync/subagents");
7153
- if (!await fileExists(filepath)) {
7154
- await writeFileContent(filepath, sampleFile.content);
7155
- logger.success(`Created ${filepath}`);
7260
+ const sampleMcpFile = {
7261
+ filename: ".mcp.json",
7262
+ content: `{
7263
+ "mcpServers": {
7264
+ "serena": {
7265
+ "type": "stdio",
7266
+ "command": "uvx",
7267
+ "args": [
7268
+ "--from",
7269
+ "git+https://github.com/oraios/serena",
7270
+ "serena",
7271
+ "start-mcp-server",
7272
+ "--context",
7273
+ "ide-assistant",
7274
+ "--enable-web-dashboard",
7275
+ "false",
7276
+ "--project",
7277
+ "."
7278
+ ],
7279
+ "env": {}
7280
+ },
7281
+ "context7": {
7282
+ "type": "stdio",
7283
+ "command": "npx",
7284
+ "args": [
7285
+ "-y",
7286
+ "@upstash/context7-mcp"
7287
+ ],
7288
+ "env": {}
7289
+ }
7290
+ }
7291
+ }
7292
+ `
7293
+ };
7294
+ const sampleCommandFile = {
7295
+ filename: "review-pr.md",
7296
+ content: `---
7297
+ description: 'Review a pull request'
7298
+ targets: ["*"]
7299
+ ---
7300
+
7301
+ target_pr = $ARGUMENTS
7302
+
7303
+ If target_pr is not provided, use the PR of the current branch.
7304
+
7305
+ Execute the following in parallel:
7306
+
7307
+ 1. Check code quality and style consistency
7308
+ 2. Review test coverage
7309
+ 3. Verify documentation updates
7310
+ 4. Check for potential bugs or security issues
7311
+
7312
+ Then provide a summary of findings and suggestions for improvement.
7313
+ `
7314
+ };
7315
+ const sampleSubagentFile = {
7316
+ filename: "planner.md",
7317
+ content: `---
7318
+ name: planner
7319
+ targets: ["*"]
7320
+ description: >-
7321
+ This is the general-purpose planner. The user asks the agent to plan to
7322
+ suggest a specification, implement a new feature, refactor the codebase, or
7323
+ fix a bug. This agent can be called by the user explicitly only.
7324
+ claudecode:
7325
+ model: inherit
7326
+ ---
7327
+
7328
+ You are the planner for any tasks.
7329
+
7330
+ Based on the user's instruction, create a plan while analyzing the related files. Then, report the plan in detail. You can output files to @tmp/ if needed.
7331
+
7332
+ Attention, again, you are just the planner, so though you can read any files and run any commands for analysis, please don't write any code.
7333
+ `
7334
+ };
7335
+ const sampleIgnoreFile = {
7336
+ content: `credentials/
7337
+ `
7338
+ };
7339
+ const rulePaths = RulesyncRule.getSettablePaths();
7340
+ const mcpPaths = RulesyncMcp.getSettablePaths();
7341
+ const commandPaths = RulesyncCommand.getSettablePaths();
7342
+ const subagentPaths = RulesyncSubagent.getSettablePaths();
7343
+ const ignorePaths = RulesyncIgnore.getSettablePaths();
7344
+ await ensureDir(rulePaths.recommended.relativeDirPath);
7345
+ await ensureDir(mcpPaths.relativeDirPath);
7346
+ await ensureDir(commandPaths.relativeDirPath);
7347
+ await ensureDir(subagentPaths.relativeDirPath);
7348
+ await ensureDir(ignorePaths.relativeDirPath);
7349
+ const ruleFilepath = (0, import_node_path59.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
7350
+ if (!await fileExists(ruleFilepath)) {
7351
+ await writeFileContent(ruleFilepath, sampleRuleFile.content);
7352
+ logger.success(`Created ${ruleFilepath}`);
7353
+ } else {
7354
+ logger.info(`Skipped ${ruleFilepath} (already exists)`);
7355
+ }
7356
+ const mcpFilepath = (0, import_node_path59.join)(mcpPaths.relativeDirPath, mcpPaths.relativeFilePath);
7357
+ if (!await fileExists(mcpFilepath)) {
7358
+ await writeFileContent(mcpFilepath, sampleMcpFile.content);
7359
+ logger.success(`Created ${mcpFilepath}`);
7360
+ } else {
7361
+ logger.info(`Skipped ${mcpFilepath} (already exists)`);
7362
+ }
7363
+ const commandFilepath = (0, import_node_path59.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
7364
+ if (!await fileExists(commandFilepath)) {
7365
+ await writeFileContent(commandFilepath, sampleCommandFile.content);
7366
+ logger.success(`Created ${commandFilepath}`);
7367
+ } else {
7368
+ logger.info(`Skipped ${commandFilepath} (already exists)`);
7369
+ }
7370
+ const subagentFilepath = (0, import_node_path59.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
7371
+ if (!await fileExists(subagentFilepath)) {
7372
+ await writeFileContent(subagentFilepath, sampleSubagentFile.content);
7373
+ logger.success(`Created ${subagentFilepath}`);
7374
+ } else {
7375
+ logger.info(`Skipped ${subagentFilepath} (already exists)`);
7376
+ }
7377
+ const ignoreFilepath = (0, import_node_path59.join)(ignorePaths.relativeDirPath, ignorePaths.relativeFilePath);
7378
+ if (!await fileExists(ignoreFilepath)) {
7379
+ await writeFileContent(ignoreFilepath, sampleIgnoreFile.content);
7380
+ logger.success(`Created ${ignoreFilepath}`);
7156
7381
  } else {
7157
- logger.info(`Skipped ${filepath} (already exists)`);
7382
+ logger.info(`Skipped ${ignoreFilepath} (already exists)`);
7158
7383
  }
7159
7384
  }
7160
7385
 
7161
7386
  // src/cli/index.ts
7162
- var getVersion = () => "3.5.2";
7387
+ var getVersion = () => "3.7.0";
7163
7388
  var main = async () => {
7164
7389
  const program = new import_commander.Command();
7165
7390
  const version = getVersion();