rulesync 3.30.0 → 3.31.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
@@ -4237,20 +4237,21 @@ var McpProcessor = class extends FeatureProcessor {
4237
4237
  };
4238
4238
 
4239
4239
  // src/features/rules/rules-processor.ts
4240
- var import_node_path82 = require("path");
4241
- var import_fast_xml_parser = require("fast-xml-parser");
4242
- var import_mini31 = require("zod/mini");
4240
+ var import_node_path83 = require("path");
4241
+ var import_toon = require("@toon-format/toon");
4242
+ var import_mini32 = require("zod/mini");
4243
4243
 
4244
4244
  // src/features/skills/codexcli-skill.ts
4245
- var import_node_path43 = require("path");
4246
-
4247
- // src/features/skills/simulated-skill.ts
4248
- var import_node_path42 = require("path");
4249
- var import_mini19 = require("zod/mini");
4245
+ var import_node_path44 = require("path");
4246
+ var import_mini20 = require("zod/mini");
4250
4247
 
4251
4248
  // src/constants/general.ts
4252
4249
  var SKILL_FILE_NAME = "SKILL.md";
4253
4250
 
4251
+ // src/features/skills/rulesync-skill.ts
4252
+ var import_node_path42 = require("path");
4253
+ var import_mini19 = require("zod/mini");
4254
+
4254
4255
  // src/types/ai-dir.ts
4255
4256
  var import_node_path41 = __toESM(require("path"), 1);
4256
4257
  var AiDir = class {
@@ -4363,7 +4364,113 @@ var AiDir = class {
4363
4364
  }
4364
4365
  };
4365
4366
 
4367
+ // src/features/skills/rulesync-skill.ts
4368
+ var RulesyncSkillFrontmatterSchemaInternal = import_mini19.z.object({
4369
+ name: import_mini19.z.string(),
4370
+ description: import_mini19.z.string(),
4371
+ targets: import_mini19.z._default(RulesyncTargetsSchema, ["*"]),
4372
+ claudecode: import_mini19.z.optional(
4373
+ import_mini19.z.object({
4374
+ "allowed-tools": import_mini19.z.optional(import_mini19.z.array(import_mini19.z.string()))
4375
+ })
4376
+ )
4377
+ });
4378
+ var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
4379
+ var RulesyncSkill = class _RulesyncSkill extends AiDir {
4380
+ constructor({
4381
+ baseDir = process.cwd(),
4382
+ relativeDirPath = RULESYNC_SKILLS_RELATIVE_DIR_PATH,
4383
+ dirName,
4384
+ frontmatter,
4385
+ body,
4386
+ otherFiles = [],
4387
+ validate = true,
4388
+ global = false
4389
+ }) {
4390
+ super({
4391
+ baseDir,
4392
+ relativeDirPath,
4393
+ dirName,
4394
+ mainFile: {
4395
+ name: SKILL_FILE_NAME,
4396
+ body,
4397
+ frontmatter: { ...frontmatter }
4398
+ },
4399
+ otherFiles,
4400
+ global
4401
+ });
4402
+ if (validate) {
4403
+ const result = this.validate();
4404
+ if (!result.success) {
4405
+ throw result.error;
4406
+ }
4407
+ }
4408
+ }
4409
+ static getSettablePaths() {
4410
+ return {
4411
+ relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH
4412
+ };
4413
+ }
4414
+ getFrontmatter() {
4415
+ if (!this.mainFile?.frontmatter) {
4416
+ throw new Error("Frontmatter is not defined");
4417
+ }
4418
+ const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
4419
+ return result;
4420
+ }
4421
+ getBody() {
4422
+ return this.mainFile?.body ?? "";
4423
+ }
4424
+ validate() {
4425
+ const result = RulesyncSkillFrontmatterSchema.safeParse(this.mainFile?.frontmatter);
4426
+ if (!result.success) {
4427
+ return {
4428
+ success: false,
4429
+ error: new Error(
4430
+ `Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
4431
+ )
4432
+ };
4433
+ }
4434
+ return { success: true, error: null };
4435
+ }
4436
+ static async fromDir({
4437
+ baseDir = process.cwd(),
4438
+ relativeDirPath = RULESYNC_SKILLS_RELATIVE_DIR_PATH,
4439
+ dirName,
4440
+ global = false
4441
+ }) {
4442
+ const skillDirPath = (0, import_node_path42.join)(baseDir, relativeDirPath, dirName);
4443
+ const skillFilePath = (0, import_node_path42.join)(skillDirPath, SKILL_FILE_NAME);
4444
+ if (!await fileExists(skillFilePath)) {
4445
+ throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
4446
+ }
4447
+ const fileContent = await readFileContent(skillFilePath);
4448
+ const { frontmatter, body: content } = parseFrontmatter(fileContent);
4449
+ const result = RulesyncSkillFrontmatterSchema.safeParse(frontmatter);
4450
+ if (!result.success) {
4451
+ throw new Error(`Invalid frontmatter in ${skillFilePath}: ${formatError(result.error)}`);
4452
+ }
4453
+ const otherFiles = await this.collectOtherFiles(
4454
+ baseDir,
4455
+ relativeDirPath,
4456
+ dirName,
4457
+ SKILL_FILE_NAME
4458
+ );
4459
+ return new _RulesyncSkill({
4460
+ baseDir,
4461
+ relativeDirPath,
4462
+ dirName,
4463
+ frontmatter: result.data,
4464
+ body: content.trim(),
4465
+ otherFiles,
4466
+ validate: true,
4467
+ global
4468
+ });
4469
+ }
4470
+ };
4471
+
4366
4472
  // src/features/skills/tool-skill.ts
4473
+ var import_node_path43 = require("path");
4367
4474
  var ToolSkill = class extends AiDir {
4368
4475
  /**
4369
4476
  * Get the settable paths for this tool's skill directories.
@@ -4417,12 +4524,200 @@ var ToolSkill = class extends AiDir {
4417
4524
  static isTargetedByRulesyncSkill(_rulesyncSkill) {
4418
4525
  throw new Error("Please implement this method in the subclass.");
4419
4526
  }
4527
+ /**
4528
+ * Load and parse skill directory content.
4529
+ * This is a helper method that handles the common logic of reading SKILL.md,
4530
+ * parsing frontmatter, and collecting other files.
4531
+ *
4532
+ * Subclasses should call this method and then validate the frontmatter
4533
+ * against their specific schema.
4534
+ *
4535
+ * @param params - Parameters including settablePaths callback to get tool-specific paths
4536
+ * @returns Parsed skill directory content
4537
+ */
4538
+ static async loadSkillDirContent({
4539
+ baseDir = process.cwd(),
4540
+ relativeDirPath,
4541
+ dirName,
4542
+ global = false,
4543
+ getSettablePaths
4544
+ }) {
4545
+ const settablePaths = getSettablePaths({ global });
4546
+ const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
4547
+ const skillDirPath = (0, import_node_path43.join)(baseDir, actualRelativeDirPath, dirName);
4548
+ const skillFilePath = (0, import_node_path43.join)(skillDirPath, SKILL_FILE_NAME);
4549
+ if (!await fileExists(skillFilePath)) {
4550
+ throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
4551
+ }
4552
+ const fileContent = await readFileContent(skillFilePath);
4553
+ const { frontmatter, body: content } = parseFrontmatter(fileContent);
4554
+ const otherFiles = await this.collectOtherFiles(
4555
+ baseDir,
4556
+ actualRelativeDirPath,
4557
+ dirName,
4558
+ SKILL_FILE_NAME
4559
+ );
4560
+ return {
4561
+ baseDir,
4562
+ relativeDirPath: actualRelativeDirPath,
4563
+ dirName,
4564
+ frontmatter,
4565
+ body: content.trim(),
4566
+ otherFiles,
4567
+ global
4568
+ };
4569
+ }
4420
4570
  };
4421
4571
 
4572
+ // src/features/skills/codexcli-skill.ts
4573
+ var CodexCliSkillFrontmatterSchema = import_mini20.z.object({
4574
+ name: import_mini20.z.string(),
4575
+ description: import_mini20.z.string()
4576
+ });
4577
+ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
4578
+ constructor({
4579
+ baseDir = process.cwd(),
4580
+ relativeDirPath = (0, import_node_path44.join)(".codex", "skills"),
4581
+ dirName,
4582
+ frontmatter,
4583
+ body,
4584
+ otherFiles = [],
4585
+ validate = true,
4586
+ global = false
4587
+ }) {
4588
+ super({
4589
+ baseDir,
4590
+ relativeDirPath,
4591
+ dirName,
4592
+ mainFile: {
4593
+ name: SKILL_FILE_NAME,
4594
+ body,
4595
+ frontmatter: { ...frontmatter }
4596
+ },
4597
+ otherFiles,
4598
+ global
4599
+ });
4600
+ if (validate) {
4601
+ const result = this.validate();
4602
+ if (!result.success) {
4603
+ throw result.error;
4604
+ }
4605
+ }
4606
+ }
4607
+ static getSettablePaths({ global = false } = {}) {
4608
+ if (!global) {
4609
+ throw new Error("CodexCliSkill only supports global mode. Please pass { global: true }.");
4610
+ }
4611
+ return {
4612
+ relativeDirPath: (0, import_node_path44.join)(".codex", "skills")
4613
+ };
4614
+ }
4615
+ getFrontmatter() {
4616
+ if (!this.mainFile?.frontmatter) {
4617
+ throw new Error("Frontmatter is not defined");
4618
+ }
4619
+ const result = CodexCliSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
4620
+ return result;
4621
+ }
4622
+ getBody() {
4623
+ return this.mainFile?.body ?? "";
4624
+ }
4625
+ validate() {
4626
+ if (!this.mainFile) {
4627
+ return {
4628
+ success: false,
4629
+ error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
4630
+ };
4631
+ }
4632
+ const result = CodexCliSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
4633
+ if (!result.success) {
4634
+ return {
4635
+ success: false,
4636
+ error: new Error(
4637
+ `Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
4638
+ )
4639
+ };
4640
+ }
4641
+ return { success: true, error: null };
4642
+ }
4643
+ toRulesyncSkill() {
4644
+ const frontmatter = this.getFrontmatter();
4645
+ const rulesyncFrontmatter = {
4646
+ name: frontmatter.name,
4647
+ description: frontmatter.description,
4648
+ targets: ["*"]
4649
+ };
4650
+ return new RulesyncSkill({
4651
+ baseDir: this.baseDir,
4652
+ relativeDirPath: this.relativeDirPath,
4653
+ dirName: this.getDirName(),
4654
+ frontmatter: rulesyncFrontmatter,
4655
+ body: this.getBody(),
4656
+ otherFiles: this.getOtherFiles(),
4657
+ validate: true,
4658
+ global: this.global
4659
+ });
4660
+ }
4661
+ static fromRulesyncSkill({
4662
+ rulesyncSkill,
4663
+ validate = true,
4664
+ global = false
4665
+ }) {
4666
+ const settablePaths = _CodexCliSkill.getSettablePaths({ global });
4667
+ const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
4668
+ const codexFrontmatter = {
4669
+ name: rulesyncFrontmatter.name,
4670
+ description: rulesyncFrontmatter.description
4671
+ };
4672
+ return new _CodexCliSkill({
4673
+ baseDir: rulesyncSkill.getBaseDir(),
4674
+ relativeDirPath: settablePaths.relativeDirPath,
4675
+ dirName: rulesyncSkill.getDirName(),
4676
+ frontmatter: codexFrontmatter,
4677
+ body: rulesyncSkill.getBody(),
4678
+ otherFiles: rulesyncSkill.getOtherFiles(),
4679
+ validate,
4680
+ global
4681
+ });
4682
+ }
4683
+ static isTargetedByRulesyncSkill(rulesyncSkill) {
4684
+ const targets = rulesyncSkill.getFrontmatter().targets;
4685
+ return targets.includes("*") || targets.includes("codexcli");
4686
+ }
4687
+ static async fromDir(params) {
4688
+ const loaded = await this.loadSkillDirContent({
4689
+ ...params,
4690
+ getSettablePaths: _CodexCliSkill.getSettablePaths
4691
+ });
4692
+ const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
4693
+ if (!result.success) {
4694
+ const skillDirPath = (0, import_node_path44.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
4695
+ throw new Error(
4696
+ `Invalid frontmatter in ${(0, import_node_path44.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
4697
+ );
4698
+ }
4699
+ return new _CodexCliSkill({
4700
+ baseDir: loaded.baseDir,
4701
+ relativeDirPath: loaded.relativeDirPath,
4702
+ dirName: loaded.dirName,
4703
+ frontmatter: result.data,
4704
+ body: loaded.body,
4705
+ otherFiles: loaded.otherFiles,
4706
+ validate: true,
4707
+ global: loaded.global
4708
+ });
4709
+ }
4710
+ };
4711
+
4712
+ // src/features/skills/copilot-skill.ts
4713
+ var import_node_path46 = require("path");
4714
+
4422
4715
  // src/features/skills/simulated-skill.ts
4423
- var SimulatedSkillFrontmatterSchema = import_mini19.z.object({
4424
- name: import_mini19.z.string(),
4425
- description: import_mini19.z.string()
4716
+ var import_node_path45 = require("path");
4717
+ var import_mini21 = require("zod/mini");
4718
+ var SimulatedSkillFrontmatterSchema = import_mini21.z.object({
4719
+ name: import_mini21.z.string(),
4720
+ description: import_mini21.z.string()
4426
4721
  });
4427
4722
  var SimulatedSkill = class extends ToolSkill {
4428
4723
  frontmatter;
@@ -4453,7 +4748,7 @@ var SimulatedSkill = class extends ToolSkill {
4453
4748
  const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
4454
4749
  if (!result.success) {
4455
4750
  throw new Error(
4456
- `Invalid frontmatter in ${(0, import_node_path42.join)(relativeDirPath, dirName)}: ${formatError(result.error)}`
4751
+ `Invalid frontmatter in ${(0, import_node_path45.join)(relativeDirPath, dirName)}: ${formatError(result.error)}`
4457
4752
  );
4458
4753
  }
4459
4754
  }
@@ -4511,8 +4806,8 @@ var SimulatedSkill = class extends ToolSkill {
4511
4806
  }) {
4512
4807
  const settablePaths = this.getSettablePaths();
4513
4808
  const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
4514
- const skillDirPath = (0, import_node_path42.join)(baseDir, actualRelativeDirPath, dirName);
4515
- const skillFilePath = (0, import_node_path42.join)(skillDirPath, SKILL_FILE_NAME);
4809
+ const skillDirPath = (0, import_node_path45.join)(baseDir, actualRelativeDirPath, dirName);
4810
+ const skillFilePath = (0, import_node_path45.join)(skillDirPath, SKILL_FILE_NAME);
4516
4811
  if (!await fileExists(skillFilePath)) {
4517
4812
  throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
4518
4813
  }
@@ -4562,44 +4857,14 @@ var SimulatedSkill = class extends ToolSkill {
4562
4857
  }
4563
4858
  };
4564
4859
 
4565
- // src/features/skills/codexcli-skill.ts
4566
- var CodexCliSkill = class _CodexCliSkill extends SimulatedSkill {
4567
- static getSettablePaths(options) {
4568
- if (options?.global) {
4569
- throw new Error("CodexCliSkill does not support global mode.");
4570
- }
4571
- return {
4572
- relativeDirPath: (0, import_node_path43.join)(".codex", "skills")
4573
- };
4574
- }
4575
- static async fromDir(params) {
4576
- const baseParams = await this.fromDirDefault(params);
4577
- return new _CodexCliSkill(baseParams);
4578
- }
4579
- static fromRulesyncSkill(params) {
4580
- const baseParams = {
4581
- ...this.fromRulesyncSkillDefault(params),
4582
- relativeDirPath: this.getSettablePaths().relativeDirPath
4583
- };
4584
- return new _CodexCliSkill(baseParams);
4585
- }
4586
- static isTargetedByRulesyncSkill(rulesyncSkill) {
4587
- return this.isTargetedByRulesyncSkillDefault({
4588
- rulesyncSkill,
4589
- toolTarget: "codexcli"
4590
- });
4591
- }
4592
- };
4593
-
4594
4860
  // src/features/skills/copilot-skill.ts
4595
- var import_node_path44 = require("path");
4596
4861
  var CopilotSkill = class _CopilotSkill extends SimulatedSkill {
4597
4862
  static getSettablePaths(options) {
4598
4863
  if (options?.global) {
4599
4864
  throw new Error("CopilotSkill does not support global mode.");
4600
4865
  }
4601
4866
  return {
4602
- relativeDirPath: (0, import_node_path44.join)(".github", "skills")
4867
+ relativeDirPath: (0, import_node_path46.join)(".github", "skills")
4603
4868
  };
4604
4869
  }
4605
4870
  static async fromDir(params) {
@@ -4622,14 +4887,14 @@ var CopilotSkill = class _CopilotSkill extends SimulatedSkill {
4622
4887
  };
4623
4888
 
4624
4889
  // src/features/skills/cursor-skill.ts
4625
- var import_node_path45 = require("path");
4890
+ var import_node_path47 = require("path");
4626
4891
  var CursorSkill = class _CursorSkill extends SimulatedSkill {
4627
4892
  static getSettablePaths(options) {
4628
4893
  if (options?.global) {
4629
4894
  throw new Error("CursorSkill does not support global mode.");
4630
4895
  }
4631
4896
  return {
4632
- relativeDirPath: (0, import_node_path45.join)(".cursor", "skills")
4897
+ relativeDirPath: (0, import_node_path47.join)(".cursor", "skills")
4633
4898
  };
4634
4899
  }
4635
4900
  static async fromDir(params) {
@@ -4652,11 +4917,11 @@ var CursorSkill = class _CursorSkill extends SimulatedSkill {
4652
4917
  };
4653
4918
 
4654
4919
  // src/features/skills/skills-processor.ts
4655
- var import_node_path51 = require("path");
4656
- var import_mini22 = require("zod/mini");
4920
+ var import_node_path52 = require("path");
4921
+ var import_mini23 = require("zod/mini");
4657
4922
 
4658
4923
  // src/types/dir-feature-processor.ts
4659
- var import_node_path46 = require("path");
4924
+ var import_node_path48 = require("path");
4660
4925
  var DirFeatureProcessor = class {
4661
4926
  baseDir;
4662
4927
  constructor({ baseDir = process.cwd() }) {
@@ -4678,178 +4943,69 @@ var DirFeatureProcessor = class {
4678
4943
  await ensureDir(dirPath);
4679
4944
  const mainFile = aiDir.getMainFile();
4680
4945
  if (mainFile) {
4681
- const mainFilePath = (0, import_node_path46.join)(dirPath, mainFile.name);
4946
+ const mainFilePath = (0, import_node_path48.join)(dirPath, mainFile.name);
4682
4947
  const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
4683
4948
  const contentWithNewline = addTrailingNewline(content);
4684
4949
  await writeFileContent(mainFilePath, contentWithNewline);
4685
4950
  }
4686
4951
  const otherFiles = aiDir.getOtherFiles();
4687
4952
  for (const file of otherFiles) {
4688
- const filePath = (0, import_node_path46.join)(dirPath, file.relativeFilePathToDirPath);
4953
+ const filePath = (0, import_node_path48.join)(dirPath, file.relativeFilePathToDirPath);
4689
4954
  const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
4690
- await writeFileContent(filePath, contentWithNewline);
4691
- }
4692
- }
4693
- return aiDirs.length;
4694
- }
4695
- async removeAiDirs(aiDirs) {
4696
- for (const aiDir of aiDirs) {
4697
- await removeDirectory(aiDir.getDirPath());
4698
- }
4699
- }
4700
- };
4701
-
4702
- // src/features/skills/agentsmd-skill.ts
4703
- var import_node_path47 = require("path");
4704
- var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
4705
- static getSettablePaths(options) {
4706
- if (options?.global) {
4707
- throw new Error("AgentsmdSkill does not support global mode.");
4708
- }
4709
- return {
4710
- relativeDirPath: (0, import_node_path47.join)(".agents", "skills")
4711
- };
4712
- }
4713
- static async fromDir(params) {
4714
- const baseParams = await this.fromDirDefault(params);
4715
- return new _AgentsmdSkill(baseParams);
4716
- }
4717
- static fromRulesyncSkill(params) {
4718
- const baseParams = {
4719
- ...this.fromRulesyncSkillDefault(params),
4720
- relativeDirPath: this.getSettablePaths().relativeDirPath
4721
- };
4722
- return new _AgentsmdSkill(baseParams);
4723
- }
4724
- static isTargetedByRulesyncSkill(rulesyncSkill) {
4725
- return this.isTargetedByRulesyncSkillDefault({
4726
- rulesyncSkill,
4727
- toolTarget: "agentsmd"
4728
- });
4729
- }
4730
- };
4731
-
4732
- // src/features/skills/claudecode-skill.ts
4733
- var import_node_path49 = require("path");
4734
- var import_mini21 = require("zod/mini");
4735
-
4736
- // src/features/skills/rulesync-skill.ts
4737
- var import_node_path48 = require("path");
4738
- var import_mini20 = require("zod/mini");
4739
- var RulesyncSkillFrontmatterSchemaInternal = import_mini20.z.object({
4740
- name: import_mini20.z.string(),
4741
- description: import_mini20.z.string(),
4742
- targets: import_mini20.z._default(RulesyncTargetsSchema, ["*"]),
4743
- claudecode: import_mini20.z.optional(
4744
- import_mini20.z.object({
4745
- "allowed-tools": import_mini20.z.optional(import_mini20.z.array(import_mini20.z.string()))
4746
- })
4747
- )
4748
- });
4749
- var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
4750
- var RulesyncSkill = class _RulesyncSkill extends AiDir {
4751
- constructor({
4752
- baseDir = process.cwd(),
4753
- relativeDirPath = RULESYNC_SKILLS_RELATIVE_DIR_PATH,
4754
- dirName,
4755
- frontmatter,
4756
- body,
4757
- otherFiles = [],
4758
- validate = true,
4759
- global = false
4760
- }) {
4761
- super({
4762
- baseDir,
4763
- relativeDirPath,
4764
- dirName,
4765
- mainFile: {
4766
- name: SKILL_FILE_NAME,
4767
- body,
4768
- frontmatter: { ...frontmatter }
4769
- },
4770
- otherFiles,
4771
- global
4772
- });
4773
- if (validate) {
4774
- const result = this.validate();
4775
- if (!result.success) {
4776
- throw result.error;
4777
- }
4778
- }
4779
- }
4780
- static getSettablePaths() {
4781
- return {
4782
- relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH
4783
- };
4784
- }
4785
- getFrontmatter() {
4786
- if (!this.mainFile?.frontmatter) {
4787
- throw new Error("Frontmatter is not defined");
4788
- }
4789
- const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
4790
- return result;
4791
- }
4792
- getBody() {
4793
- return this.mainFile?.body ?? "";
4794
- }
4795
- validate() {
4796
- const result = RulesyncSkillFrontmatterSchema.safeParse(this.mainFile?.frontmatter);
4797
- if (!result.success) {
4798
- return {
4799
- success: false,
4800
- error: new Error(
4801
- `Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
4802
- )
4803
- };
4804
- }
4805
- return { success: true, error: null };
4806
- }
4807
- static async fromDir({
4808
- baseDir = process.cwd(),
4809
- relativeDirPath = RULESYNC_SKILLS_RELATIVE_DIR_PATH,
4810
- dirName,
4811
- global = false
4812
- }) {
4813
- const skillDirPath = (0, import_node_path48.join)(baseDir, relativeDirPath, dirName);
4814
- const skillFilePath = (0, import_node_path48.join)(skillDirPath, SKILL_FILE_NAME);
4815
- if (!await fileExists(skillFilePath)) {
4816
- throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
4955
+ await writeFileContent(filePath, contentWithNewline);
4956
+ }
4817
4957
  }
4818
- const fileContent = await readFileContent(skillFilePath);
4819
- const { frontmatter, body: content } = parseFrontmatter(fileContent);
4820
- const result = RulesyncSkillFrontmatterSchema.safeParse(frontmatter);
4821
- if (!result.success) {
4822
- throw new Error(`Invalid frontmatter in ${skillFilePath}: ${formatError(result.error)}`);
4958
+ return aiDirs.length;
4959
+ }
4960
+ async removeAiDirs(aiDirs) {
4961
+ for (const aiDir of aiDirs) {
4962
+ await removeDirectory(aiDir.getDirPath());
4823
4963
  }
4824
- const otherFiles = await this.collectOtherFiles(
4825
- baseDir,
4826
- relativeDirPath,
4827
- dirName,
4828
- SKILL_FILE_NAME
4829
- );
4830
- return new _RulesyncSkill({
4831
- baseDir,
4832
- relativeDirPath,
4833
- dirName,
4834
- frontmatter: result.data,
4835
- body: content.trim(),
4836
- otherFiles,
4837
- validate: true,
4838
- global
4964
+ }
4965
+ };
4966
+
4967
+ // src/features/skills/agentsmd-skill.ts
4968
+ var import_node_path49 = require("path");
4969
+ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
4970
+ static getSettablePaths(options) {
4971
+ if (options?.global) {
4972
+ throw new Error("AgentsmdSkill does not support global mode.");
4973
+ }
4974
+ return {
4975
+ relativeDirPath: (0, import_node_path49.join)(".agents", "skills")
4976
+ };
4977
+ }
4978
+ static async fromDir(params) {
4979
+ const baseParams = await this.fromDirDefault(params);
4980
+ return new _AgentsmdSkill(baseParams);
4981
+ }
4982
+ static fromRulesyncSkill(params) {
4983
+ const baseParams = {
4984
+ ...this.fromRulesyncSkillDefault(params),
4985
+ relativeDirPath: this.getSettablePaths().relativeDirPath
4986
+ };
4987
+ return new _AgentsmdSkill(baseParams);
4988
+ }
4989
+ static isTargetedByRulesyncSkill(rulesyncSkill) {
4990
+ return this.isTargetedByRulesyncSkillDefault({
4991
+ rulesyncSkill,
4992
+ toolTarget: "agentsmd"
4839
4993
  });
4840
4994
  }
4841
4995
  };
4842
4996
 
4843
4997
  // src/features/skills/claudecode-skill.ts
4844
- var ClaudecodeSkillFrontmatterSchema = import_mini21.z.object({
4845
- name: import_mini21.z.string(),
4846
- description: import_mini21.z.string(),
4847
- "allowed-tools": import_mini21.z.optional(import_mini21.z.array(import_mini21.z.string()))
4998
+ var import_node_path50 = require("path");
4999
+ var import_mini22 = require("zod/mini");
5000
+ var ClaudecodeSkillFrontmatterSchema = import_mini22.z.object({
5001
+ name: import_mini22.z.string(),
5002
+ description: import_mini22.z.string(),
5003
+ "allowed-tools": import_mini22.z.optional(import_mini22.z.array(import_mini22.z.string()))
4848
5004
  });
4849
5005
  var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
4850
5006
  constructor({
4851
5007
  baseDir = process.cwd(),
4852
- relativeDirPath = (0, import_node_path49.join)(".claude", "skills"),
5008
+ relativeDirPath = (0, import_node_path50.join)(".claude", "skills"),
4853
5009
  dirName,
4854
5010
  frontmatter,
4855
5011
  body,
@@ -4880,7 +5036,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
4880
5036
  global: _global = false
4881
5037
  } = {}) {
4882
5038
  return {
4883
- relativeDirPath: (0, import_node_path49.join)(".claude", "skills")
5039
+ relativeDirPath: (0, import_node_path50.join)(".claude", "skills")
4884
5040
  };
4885
5041
  }
4886
5042
  getFrontmatter() {
@@ -4960,53 +5116,40 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
4960
5116
  static isTargetedByRulesyncSkill(_rulesyncSkill) {
4961
5117
  return true;
4962
5118
  }
4963
- static async fromDir({
4964
- baseDir = process.cwd(),
4965
- relativeDirPath,
4966
- dirName,
4967
- global = false
4968
- }) {
4969
- const settablePaths = this.getSettablePaths({ global });
4970
- const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
4971
- const skillDirPath = (0, import_node_path49.join)(baseDir, actualRelativeDirPath, dirName);
4972
- const skillFilePath = (0, import_node_path49.join)(skillDirPath, SKILL_FILE_NAME);
4973
- if (!await fileExists(skillFilePath)) {
4974
- throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
4975
- }
4976
- const fileContent = await readFileContent(skillFilePath);
4977
- const { frontmatter, body: content } = parseFrontmatter(fileContent);
4978
- const result = ClaudecodeSkillFrontmatterSchema.safeParse(frontmatter);
5119
+ static async fromDir(params) {
5120
+ const loaded = await this.loadSkillDirContent({
5121
+ ...params,
5122
+ getSettablePaths: _ClaudecodeSkill.getSettablePaths
5123
+ });
5124
+ const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
4979
5125
  if (!result.success) {
4980
- throw new Error(`Invalid frontmatter in ${skillFilePath}: ${formatError(result.error)}`);
5126
+ const skillDirPath = (0, import_node_path50.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
5127
+ throw new Error(
5128
+ `Invalid frontmatter in ${(0, import_node_path50.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
5129
+ );
4981
5130
  }
4982
- const otherFiles = await this.collectOtherFiles(
4983
- baseDir,
4984
- actualRelativeDirPath,
4985
- dirName,
4986
- SKILL_FILE_NAME
4987
- );
4988
5131
  return new _ClaudecodeSkill({
4989
- baseDir,
4990
- relativeDirPath: actualRelativeDirPath,
4991
- dirName,
5132
+ baseDir: loaded.baseDir,
5133
+ relativeDirPath: loaded.relativeDirPath,
5134
+ dirName: loaded.dirName,
4992
5135
  frontmatter: result.data,
4993
- body: content.trim(),
4994
- otherFiles,
5136
+ body: loaded.body,
5137
+ otherFiles: loaded.otherFiles,
4995
5138
  validate: true,
4996
- global
5139
+ global: loaded.global
4997
5140
  });
4998
5141
  }
4999
5142
  };
5000
5143
 
5001
5144
  // src/features/skills/geminicli-skill.ts
5002
- var import_node_path50 = require("path");
5145
+ var import_node_path51 = require("path");
5003
5146
  var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
5004
5147
  static getSettablePaths(options) {
5005
5148
  if (options?.global) {
5006
5149
  throw new Error("GeminiCliSkill does not support global mode.");
5007
5150
  }
5008
5151
  return {
5009
- relativeDirPath: (0, import_node_path50.join)(".gemini", "skills")
5152
+ relativeDirPath: (0, import_node_path51.join)(".gemini", "skills")
5010
5153
  };
5011
5154
  }
5012
5155
  static async fromDir(params) {
@@ -5037,19 +5180,49 @@ var skillsProcessorToolTargetTuple = [
5037
5180
  "cursor",
5038
5181
  "geminicli"
5039
5182
  ];
5040
- var SkillsProcessorToolTargetSchema = import_mini22.z.enum(skillsProcessorToolTargetTuple);
5183
+ var SkillsProcessorToolTargetSchema = import_mini23.z.enum(skillsProcessorToolTargetTuple);
5041
5184
  var toolSkillFactories = /* @__PURE__ */ new Map([
5042
- ["agentsmd", { class: AgentsmdSkill, meta: { supportsSimulated: true, supportsGlobal: false } }],
5185
+ [
5186
+ "agentsmd",
5187
+ {
5188
+ class: AgentsmdSkill,
5189
+ meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
5190
+ }
5191
+ ],
5043
5192
  [
5044
5193
  "claudecode",
5045
- { class: ClaudecodeSkill, meta: { supportsSimulated: false, supportsGlobal: true } }
5194
+ {
5195
+ class: ClaudecodeSkill,
5196
+ meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
5197
+ }
5198
+ ],
5199
+ [
5200
+ "codexcli",
5201
+ {
5202
+ class: CodexCliSkill,
5203
+ meta: { supportsProject: false, supportsSimulated: false, supportsGlobal: true }
5204
+ }
5205
+ ],
5206
+ [
5207
+ "copilot",
5208
+ {
5209
+ class: CopilotSkill,
5210
+ meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
5211
+ }
5212
+ ],
5213
+ [
5214
+ "cursor",
5215
+ {
5216
+ class: CursorSkill,
5217
+ meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
5218
+ }
5046
5219
  ],
5047
- ["codexcli", { class: CodexCliSkill, meta: { supportsSimulated: true, supportsGlobal: false } }],
5048
- ["copilot", { class: CopilotSkill, meta: { supportsSimulated: true, supportsGlobal: false } }],
5049
- ["cursor", { class: CursorSkill, meta: { supportsSimulated: true, supportsGlobal: false } }],
5050
5220
  [
5051
5221
  "geminicli",
5052
- { class: GeminiCliSkill, meta: { supportsSimulated: true, supportsGlobal: false } }
5222
+ {
5223
+ class: GeminiCliSkill,
5224
+ meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
5225
+ }
5053
5226
  ]
5054
5227
  ]);
5055
5228
  var defaultGetFactory4 = (target) => {
@@ -5060,7 +5233,10 @@ var defaultGetFactory4 = (target) => {
5060
5233
  return factory;
5061
5234
  };
5062
5235
  var allToolTargetKeys3 = [...toolSkillFactories.keys()];
5063
- var skillsProcessorToolTargets = allToolTargetKeys3;
5236
+ var skillsProcessorToolTargetsProject = allToolTargetKeys3.filter((target) => {
5237
+ const factory = toolSkillFactories.get(target);
5238
+ return factory?.meta.supportsProject ?? true;
5239
+ });
5064
5240
  var skillsProcessorToolTargetsSimulated = allToolTargetKeys3.filter(
5065
5241
  (target) => {
5066
5242
  const factory = toolSkillFactories.get(target);
@@ -5126,9 +5302,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
5126
5302
  */
5127
5303
  async loadRulesyncDirs() {
5128
5304
  const paths = RulesyncSkill.getSettablePaths();
5129
- const rulesyncSkillsDirPath = (0, import_node_path51.join)(this.baseDir, paths.relativeDirPath);
5130
- const dirPaths = await findFilesByGlobs((0, import_node_path51.join)(rulesyncSkillsDirPath, "*"), { type: "dir" });
5131
- const dirNames = dirPaths.map((path3) => (0, import_node_path51.basename)(path3));
5305
+ const rulesyncSkillsDirPath = (0, import_node_path52.join)(this.baseDir, paths.relativeDirPath);
5306
+ const dirPaths = await findFilesByGlobs((0, import_node_path52.join)(rulesyncSkillsDirPath, "*"), { type: "dir" });
5307
+ const dirNames = dirPaths.map((path3) => (0, import_node_path52.basename)(path3));
5132
5308
  const rulesyncSkills = await Promise.all(
5133
5309
  dirNames.map(
5134
5310
  (dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
@@ -5144,9 +5320,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
5144
5320
  async loadToolDirs() {
5145
5321
  const factory = this.getFactory(this.toolTarget);
5146
5322
  const paths = factory.class.getSettablePaths({ global: this.global });
5147
- const skillsDirPath = (0, import_node_path51.join)(this.baseDir, paths.relativeDirPath);
5148
- const dirPaths = await findFilesByGlobs((0, import_node_path51.join)(skillsDirPath, "*"), { type: "dir" });
5149
- const dirNames = dirPaths.map((path3) => (0, import_node_path51.basename)(path3));
5323
+ const skillsDirPath = (0, import_node_path52.join)(this.baseDir, paths.relativeDirPath);
5324
+ const dirPaths = await findFilesByGlobs((0, import_node_path52.join)(skillsDirPath, "*"), { type: "dir" });
5325
+ const dirNames = dirPaths.map((path3) => (0, import_node_path52.basename)(path3));
5150
5326
  const toolSkills = await Promise.all(
5151
5327
  dirNames.map(
5152
5328
  (dirName) => factory.class.fromDir({
@@ -5173,12 +5349,13 @@ var SkillsProcessor = class extends DirFeatureProcessor {
5173
5349
  if (global) {
5174
5350
  return skillsProcessorToolTargetsGlobal;
5175
5351
  }
5352
+ const projectTargets = skillsProcessorToolTargetsProject;
5176
5353
  if (!includeSimulated) {
5177
- return skillsProcessorToolTargets.filter(
5354
+ return projectTargets.filter(
5178
5355
  (target) => !skillsProcessorToolTargetsSimulated.includes(target)
5179
5356
  );
5180
5357
  }
5181
- return skillsProcessorToolTargets;
5358
+ return projectTargets;
5182
5359
  }
5183
5360
  /**
5184
5361
  * Return the simulated tool targets
@@ -5195,11 +5372,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
5195
5372
  };
5196
5373
 
5197
5374
  // src/features/subagents/agentsmd-subagent.ts
5198
- var import_node_path53 = require("path");
5375
+ var import_node_path54 = require("path");
5199
5376
 
5200
5377
  // src/features/subagents/simulated-subagent.ts
5201
- var import_node_path52 = require("path");
5202
- var import_mini23 = require("zod/mini");
5378
+ var import_node_path53 = require("path");
5379
+ var import_mini24 = require("zod/mini");
5203
5380
 
5204
5381
  // src/features/subagents/tool-subagent.ts
5205
5382
  var ToolSubagent = class extends ToolFile {
@@ -5234,9 +5411,9 @@ var ToolSubagent = class extends ToolFile {
5234
5411
  };
5235
5412
 
5236
5413
  // src/features/subagents/simulated-subagent.ts
5237
- var SimulatedSubagentFrontmatterSchema = import_mini23.z.object({
5238
- name: import_mini23.z.string(),
5239
- description: import_mini23.z.string()
5414
+ var SimulatedSubagentFrontmatterSchema = import_mini24.z.object({
5415
+ name: import_mini24.z.string(),
5416
+ description: import_mini24.z.string()
5240
5417
  });
5241
5418
  var SimulatedSubagent = class extends ToolSubagent {
5242
5419
  frontmatter;
@@ -5246,7 +5423,7 @@ var SimulatedSubagent = class extends ToolSubagent {
5246
5423
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
5247
5424
  if (!result.success) {
5248
5425
  throw new Error(
5249
- `Invalid frontmatter in ${(0, import_node_path52.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5426
+ `Invalid frontmatter in ${(0, import_node_path53.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5250
5427
  );
5251
5428
  }
5252
5429
  }
@@ -5297,7 +5474,7 @@ var SimulatedSubagent = class extends ToolSubagent {
5297
5474
  return {
5298
5475
  success: false,
5299
5476
  error: new Error(
5300
- `Invalid frontmatter in ${(0, import_node_path52.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5477
+ `Invalid frontmatter in ${(0, import_node_path53.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5301
5478
  )
5302
5479
  };
5303
5480
  }
@@ -5307,7 +5484,7 @@ var SimulatedSubagent = class extends ToolSubagent {
5307
5484
  relativeFilePath,
5308
5485
  validate = true
5309
5486
  }) {
5310
- const filePath = (0, import_node_path52.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
5487
+ const filePath = (0, import_node_path53.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
5311
5488
  const fileContent = await readFileContent(filePath);
5312
5489
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
5313
5490
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -5317,7 +5494,7 @@ var SimulatedSubagent = class extends ToolSubagent {
5317
5494
  return {
5318
5495
  baseDir,
5319
5496
  relativeDirPath: this.getSettablePaths().relativeDirPath,
5320
- relativeFilePath: (0, import_node_path52.basename)(relativeFilePath),
5497
+ relativeFilePath: (0, import_node_path53.basename)(relativeFilePath),
5321
5498
  frontmatter: result.data,
5322
5499
  body: content.trim(),
5323
5500
  validate
@@ -5329,7 +5506,7 @@ var SimulatedSubagent = class extends ToolSubagent {
5329
5506
  var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
5330
5507
  static getSettablePaths() {
5331
5508
  return {
5332
- relativeDirPath: (0, import_node_path53.join)(".agents", "subagents")
5509
+ relativeDirPath: (0, import_node_path54.join)(".agents", "subagents")
5333
5510
  };
5334
5511
  }
5335
5512
  static async fromFile(params) {
@@ -5349,11 +5526,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
5349
5526
  };
5350
5527
 
5351
5528
  // src/features/subagents/codexcli-subagent.ts
5352
- var import_node_path54 = require("path");
5529
+ var import_node_path55 = require("path");
5353
5530
  var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
5354
5531
  static getSettablePaths() {
5355
5532
  return {
5356
- relativeDirPath: (0, import_node_path54.join)(".codex", "subagents")
5533
+ relativeDirPath: (0, import_node_path55.join)(".codex", "subagents")
5357
5534
  };
5358
5535
  }
5359
5536
  static async fromFile(params) {
@@ -5373,11 +5550,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
5373
5550
  };
5374
5551
 
5375
5552
  // src/features/subagents/copilot-subagent.ts
5376
- var import_node_path55 = require("path");
5553
+ var import_node_path56 = require("path");
5377
5554
  var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
5378
5555
  static getSettablePaths() {
5379
5556
  return {
5380
- relativeDirPath: (0, import_node_path55.join)(".github", "subagents")
5557
+ relativeDirPath: (0, import_node_path56.join)(".github", "subagents")
5381
5558
  };
5382
5559
  }
5383
5560
  static async fromFile(params) {
@@ -5397,11 +5574,11 @@ var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
5397
5574
  };
5398
5575
 
5399
5576
  // src/features/subagents/cursor-subagent.ts
5400
- var import_node_path56 = require("path");
5577
+ var import_node_path57 = require("path");
5401
5578
  var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
5402
5579
  static getSettablePaths() {
5403
5580
  return {
5404
- relativeDirPath: (0, import_node_path56.join)(".cursor", "subagents")
5581
+ relativeDirPath: (0, import_node_path57.join)(".cursor", "subagents")
5405
5582
  };
5406
5583
  }
5407
5584
  static async fromFile(params) {
@@ -5421,11 +5598,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
5421
5598
  };
5422
5599
 
5423
5600
  // src/features/subagents/geminicli-subagent.ts
5424
- var import_node_path57 = require("path");
5601
+ var import_node_path58 = require("path");
5425
5602
  var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
5426
5603
  static getSettablePaths() {
5427
5604
  return {
5428
- relativeDirPath: (0, import_node_path57.join)(".gemini", "subagents")
5605
+ relativeDirPath: (0, import_node_path58.join)(".gemini", "subagents")
5429
5606
  };
5430
5607
  }
5431
5608
  static async fromFile(params) {
@@ -5445,11 +5622,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
5445
5622
  };
5446
5623
 
5447
5624
  // src/features/subagents/roo-subagent.ts
5448
- var import_node_path58 = require("path");
5625
+ var import_node_path59 = require("path");
5449
5626
  var RooSubagent = class _RooSubagent extends SimulatedSubagent {
5450
5627
  static getSettablePaths() {
5451
5628
  return {
5452
- relativeDirPath: (0, import_node_path58.join)(".roo", "subagents")
5629
+ relativeDirPath: (0, import_node_path59.join)(".roo", "subagents")
5453
5630
  };
5454
5631
  }
5455
5632
  static async fromFile(params) {
@@ -5469,20 +5646,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
5469
5646
  };
5470
5647
 
5471
5648
  // src/features/subagents/subagents-processor.ts
5649
+ var import_node_path62 = require("path");
5650
+ var import_mini27 = require("zod/mini");
5651
+
5652
+ // src/features/subagents/claudecode-subagent.ts
5472
5653
  var import_node_path61 = require("path");
5473
5654
  var import_mini26 = require("zod/mini");
5474
5655
 
5475
- // src/features/subagents/claudecode-subagent.ts
5656
+ // src/features/subagents/rulesync-subagent.ts
5476
5657
  var import_node_path60 = require("path");
5477
5658
  var import_mini25 = require("zod/mini");
5478
-
5479
- // src/features/subagents/rulesync-subagent.ts
5480
- var import_node_path59 = require("path");
5481
- var import_mini24 = require("zod/mini");
5482
- var RulesyncSubagentFrontmatterSchema = import_mini24.z.looseObject({
5659
+ var RulesyncSubagentFrontmatterSchema = import_mini25.z.looseObject({
5483
5660
  targets: RulesyncTargetsSchema,
5484
- name: import_mini24.z.string(),
5485
- description: import_mini24.z.string()
5661
+ name: import_mini25.z.string(),
5662
+ description: import_mini25.z.string()
5486
5663
  });
5487
5664
  var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
5488
5665
  frontmatter;
@@ -5492,7 +5669,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
5492
5669
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
5493
5670
  if (!result.success) {
5494
5671
  throw new Error(
5495
- `Invalid frontmatter in ${(0, import_node_path59.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5672
+ `Invalid frontmatter in ${(0, import_node_path60.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5496
5673
  );
5497
5674
  }
5498
5675
  }
@@ -5525,7 +5702,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
5525
5702
  return {
5526
5703
  success: false,
5527
5704
  error: new Error(
5528
- `Invalid frontmatter in ${(0, import_node_path59.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5705
+ `Invalid frontmatter in ${(0, import_node_path60.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5529
5706
  )
5530
5707
  };
5531
5708
  }
@@ -5534,14 +5711,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
5534
5711
  relativeFilePath
5535
5712
  }) {
5536
5713
  const fileContent = await readFileContent(
5537
- (0, import_node_path59.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
5714
+ (0, import_node_path60.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
5538
5715
  );
5539
5716
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
5540
5717
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
5541
5718
  if (!result.success) {
5542
5719
  throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
5543
5720
  }
5544
- const filename = (0, import_node_path59.basename)(relativeFilePath);
5721
+ const filename = (0, import_node_path60.basename)(relativeFilePath);
5545
5722
  return new _RulesyncSubagent({
5546
5723
  baseDir: process.cwd(),
5547
5724
  relativeDirPath: this.getSettablePaths().relativeDirPath,
@@ -5553,13 +5730,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
5553
5730
  };
5554
5731
 
5555
5732
  // src/features/subagents/claudecode-subagent.ts
5556
- var ClaudecodeSubagentFrontmatterSchema = import_mini25.z.looseObject({
5557
- name: import_mini25.z.string(),
5558
- description: import_mini25.z.string(),
5559
- model: import_mini25.z.optional(import_mini25.z.string()),
5560
- tools: import_mini25.z.optional(import_mini25.z.union([import_mini25.z.string(), import_mini25.z.array(import_mini25.z.string())])),
5561
- permissionMode: import_mini25.z.optional(import_mini25.z.string()),
5562
- skills: import_mini25.z.optional(import_mini25.z.union([import_mini25.z.string(), import_mini25.z.array(import_mini25.z.string())]))
5733
+ var ClaudecodeSubagentFrontmatterSchema = import_mini26.z.looseObject({
5734
+ name: import_mini26.z.string(),
5735
+ description: import_mini26.z.string(),
5736
+ model: import_mini26.z.optional(import_mini26.z.string()),
5737
+ tools: import_mini26.z.optional(import_mini26.z.union([import_mini26.z.string(), import_mini26.z.array(import_mini26.z.string())])),
5738
+ permissionMode: import_mini26.z.optional(import_mini26.z.string()),
5739
+ skills: import_mini26.z.optional(import_mini26.z.union([import_mini26.z.string(), import_mini26.z.array(import_mini26.z.string())]))
5563
5740
  });
5564
5741
  var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
5565
5742
  frontmatter;
@@ -5569,7 +5746,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
5569
5746
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
5570
5747
  if (!result.success) {
5571
5748
  throw new Error(
5572
- `Invalid frontmatter in ${(0, import_node_path60.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5749
+ `Invalid frontmatter in ${(0, import_node_path61.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5573
5750
  );
5574
5751
  }
5575
5752
  }
@@ -5581,7 +5758,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
5581
5758
  }
5582
5759
  static getSettablePaths(_options = {}) {
5583
5760
  return {
5584
- relativeDirPath: (0, import_node_path60.join)(".claude", "agents")
5761
+ relativeDirPath: (0, import_node_path61.join)(".claude", "agents")
5585
5762
  };
5586
5763
  }
5587
5764
  getFrontmatter() {
@@ -5655,7 +5832,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
5655
5832
  return {
5656
5833
  success: false,
5657
5834
  error: new Error(
5658
- `Invalid frontmatter in ${(0, import_node_path60.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5835
+ `Invalid frontmatter in ${(0, import_node_path61.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5659
5836
  )
5660
5837
  };
5661
5838
  }
@@ -5673,7 +5850,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
5673
5850
  global = false
5674
5851
  }) {
5675
5852
  const paths = this.getSettablePaths({ global });
5676
- const filePath = (0, import_node_path60.join)(baseDir, paths.relativeDirPath, relativeFilePath);
5853
+ const filePath = (0, import_node_path61.join)(baseDir, paths.relativeDirPath, relativeFilePath);
5677
5854
  const fileContent = await readFileContent(filePath);
5678
5855
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
5679
5856
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -5702,7 +5879,7 @@ var subagentsProcessorToolTargetTuple = [
5702
5879
  "geminicli",
5703
5880
  "roo"
5704
5881
  ];
5705
- var SubagentsProcessorToolTargetSchema = import_mini26.z.enum(subagentsProcessorToolTargetTuple);
5882
+ var SubagentsProcessorToolTargetSchema = import_mini27.z.enum(subagentsProcessorToolTargetTuple);
5706
5883
  var toolSubagentFactories = /* @__PURE__ */ new Map([
5707
5884
  [
5708
5885
  "agentsmd",
@@ -5805,7 +5982,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
5805
5982
  * Load and parse rulesync subagent files from .rulesync/subagents/ directory
5806
5983
  */
5807
5984
  async loadRulesyncFiles() {
5808
- const subagentsDir = (0, import_node_path61.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
5985
+ const subagentsDir = (0, import_node_path62.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
5809
5986
  const dirExists = await directoryExists(subagentsDir);
5810
5987
  if (!dirExists) {
5811
5988
  logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
@@ -5820,7 +5997,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
5820
5997
  logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
5821
5998
  const rulesyncSubagents = [];
5822
5999
  for (const mdFile of mdFiles) {
5823
- const filepath = (0, import_node_path61.join)(subagentsDir, mdFile);
6000
+ const filepath = (0, import_node_path62.join)(subagentsDir, mdFile);
5824
6001
  try {
5825
6002
  const rulesyncSubagent = await RulesyncSubagent.fromFile({
5826
6003
  relativeFilePath: mdFile,
@@ -5850,13 +6027,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
5850
6027
  const factory = this.getFactory(this.toolTarget);
5851
6028
  const paths = factory.class.getSettablePaths({ global: this.global });
5852
6029
  const subagentFilePaths = await findFilesByGlobs(
5853
- (0, import_node_path61.join)(this.baseDir, paths.relativeDirPath, "*.md")
6030
+ (0, import_node_path62.join)(this.baseDir, paths.relativeDirPath, "*.md")
5854
6031
  );
5855
6032
  const toolSubagents = await Promise.all(
5856
6033
  subagentFilePaths.map(
5857
6034
  (path3) => factory.class.fromFile({
5858
6035
  baseDir: this.baseDir,
5859
- relativeFilePath: (0, import_node_path61.basename)(path3),
6036
+ relativeFilePath: (0, import_node_path62.basename)(path3),
5860
6037
  global: this.global
5861
6038
  })
5862
6039
  )
@@ -5889,35 +6066,35 @@ var SubagentsProcessor = class extends FeatureProcessor {
5889
6066
  };
5890
6067
 
5891
6068
  // src/features/rules/agentsmd-rule.ts
5892
- var import_node_path64 = require("path");
6069
+ var import_node_path65 = require("path");
5893
6070
 
5894
6071
  // src/features/rules/tool-rule.ts
5895
- var import_node_path63 = require("path");
6072
+ var import_node_path64 = require("path");
5896
6073
 
5897
6074
  // src/features/rules/rulesync-rule.ts
5898
- var import_node_path62 = require("path");
5899
- var import_mini27 = require("zod/mini");
5900
- var RulesyncRuleFrontmatterSchema = import_mini27.z.object({
5901
- root: import_mini27.z.optional(import_mini27.z.optional(import_mini27.z.boolean())),
5902
- targets: import_mini27.z.optional(RulesyncTargetsSchema),
5903
- description: import_mini27.z.optional(import_mini27.z.string()),
5904
- globs: import_mini27.z.optional(import_mini27.z.array(import_mini27.z.string())),
5905
- agentsmd: import_mini27.z.optional(
5906
- import_mini27.z.object({
6075
+ var import_node_path63 = require("path");
6076
+ var import_mini28 = require("zod/mini");
6077
+ var RulesyncRuleFrontmatterSchema = import_mini28.z.object({
6078
+ root: import_mini28.z.optional(import_mini28.z.optional(import_mini28.z.boolean())),
6079
+ targets: import_mini28.z.optional(RulesyncTargetsSchema),
6080
+ description: import_mini28.z.optional(import_mini28.z.string()),
6081
+ globs: import_mini28.z.optional(import_mini28.z.array(import_mini28.z.string())),
6082
+ agentsmd: import_mini28.z.optional(
6083
+ import_mini28.z.object({
5907
6084
  // @example "path/to/subproject"
5908
- subprojectPath: import_mini27.z.optional(import_mini27.z.string())
6085
+ subprojectPath: import_mini28.z.optional(import_mini28.z.string())
5909
6086
  })
5910
6087
  ),
5911
- cursor: import_mini27.z.optional(
5912
- import_mini27.z.object({
5913
- alwaysApply: import_mini27.z.optional(import_mini27.z.boolean()),
5914
- description: import_mini27.z.optional(import_mini27.z.string()),
5915
- globs: import_mini27.z.optional(import_mini27.z.array(import_mini27.z.string()))
6088
+ cursor: import_mini28.z.optional(
6089
+ import_mini28.z.object({
6090
+ alwaysApply: import_mini28.z.optional(import_mini28.z.boolean()),
6091
+ description: import_mini28.z.optional(import_mini28.z.string()),
6092
+ globs: import_mini28.z.optional(import_mini28.z.array(import_mini28.z.string()))
5916
6093
  })
5917
6094
  ),
5918
- copilot: import_mini27.z.optional(
5919
- import_mini27.z.object({
5920
- excludeAgent: import_mini27.z.optional(import_mini27.z.union([import_mini27.z.literal("code-review"), import_mini27.z.literal("coding-agent")]))
6095
+ copilot: import_mini28.z.optional(
6096
+ import_mini28.z.object({
6097
+ excludeAgent: import_mini28.z.optional(import_mini28.z.union([import_mini28.z.literal("code-review"), import_mini28.z.literal("coding-agent")]))
5921
6098
  })
5922
6099
  )
5923
6100
  });
@@ -5929,7 +6106,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
5929
6106
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
5930
6107
  if (!result.success) {
5931
6108
  throw new Error(
5932
- `Invalid frontmatter in ${(0, import_node_path62.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
6109
+ `Invalid frontmatter in ${(0, import_node_path63.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5933
6110
  );
5934
6111
  }
5935
6112
  }
@@ -5964,7 +6141,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
5964
6141
  return {
5965
6142
  success: false,
5966
6143
  error: new Error(
5967
- `Invalid frontmatter in ${(0, import_node_path62.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
6144
+ `Invalid frontmatter in ${(0, import_node_path63.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5968
6145
  )
5969
6146
  };
5970
6147
  }
@@ -5973,12 +6150,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
5973
6150
  relativeFilePath,
5974
6151
  validate = true
5975
6152
  }) {
5976
- const legacyPath = (0, import_node_path62.join)(
6153
+ const legacyPath = (0, import_node_path63.join)(
5977
6154
  process.cwd(),
5978
6155
  this.getSettablePaths().legacy.relativeDirPath,
5979
6156
  relativeFilePath
5980
6157
  );
5981
- const recommendedPath = (0, import_node_path62.join)(
6158
+ const recommendedPath = (0, import_node_path63.join)(
5982
6159
  this.getSettablePaths().recommended.relativeDirPath,
5983
6160
  relativeFilePath
5984
6161
  );
@@ -5997,7 +6174,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
5997
6174
  agentsmd: result.data.agentsmd,
5998
6175
  cursor: result.data.cursor
5999
6176
  };
6000
- const filename = (0, import_node_path62.basename)(legacyPath);
6177
+ const filename = (0, import_node_path63.basename)(legacyPath);
6001
6178
  return new _RulesyncRule({
6002
6179
  baseDir: process.cwd(),
6003
6180
  relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
@@ -6011,7 +6188,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
6011
6188
  relativeFilePath,
6012
6189
  validate = true
6013
6190
  }) {
6014
- const filePath = (0, import_node_path62.join)(
6191
+ const filePath = (0, import_node_path63.join)(
6015
6192
  process.cwd(),
6016
6193
  this.getSettablePaths().recommended.relativeDirPath,
6017
6194
  relativeFilePath
@@ -6030,7 +6207,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
6030
6207
  agentsmd: result.data.agentsmd,
6031
6208
  cursor: result.data.cursor
6032
6209
  };
6033
- const filename = (0, import_node_path62.basename)(filePath);
6210
+ const filename = (0, import_node_path63.basename)(filePath);
6034
6211
  return new _RulesyncRule({
6035
6212
  baseDir: process.cwd(),
6036
6213
  relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
@@ -6105,7 +6282,7 @@ var ToolRule = class extends ToolFile {
6105
6282
  rulesyncRule,
6106
6283
  validate = true,
6107
6284
  rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
6108
- nonRootPath = { relativeDirPath: (0, import_node_path63.join)(".agents", "memories") }
6285
+ nonRootPath = { relativeDirPath: (0, import_node_path64.join)(".agents", "memories") }
6109
6286
  }) {
6110
6287
  const params = this.buildToolRuleParamsDefault({
6111
6288
  baseDir,
@@ -6116,7 +6293,7 @@ var ToolRule = class extends ToolFile {
6116
6293
  });
6117
6294
  const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
6118
6295
  if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
6119
- params.relativeDirPath = (0, import_node_path63.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
6296
+ params.relativeDirPath = (0, import_node_path64.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
6120
6297
  params.relativeFilePath = "AGENTS.md";
6121
6298
  }
6122
6299
  return params;
@@ -6181,7 +6358,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
6181
6358
  relativeFilePath: "AGENTS.md"
6182
6359
  },
6183
6360
  nonRoot: {
6184
- relativeDirPath: (0, import_node_path64.join)(".agents", "memories")
6361
+ relativeDirPath: (0, import_node_path65.join)(".agents", "memories")
6185
6362
  }
6186
6363
  };
6187
6364
  }
@@ -6191,8 +6368,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
6191
6368
  validate = true
6192
6369
  }) {
6193
6370
  const isRoot = relativeFilePath === "AGENTS.md";
6194
- const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path64.join)(".agents", "memories", relativeFilePath);
6195
- const fileContent = await readFileContent((0, import_node_path64.join)(baseDir, relativePath));
6371
+ const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path65.join)(".agents", "memories", relativeFilePath);
6372
+ const fileContent = await readFileContent((0, import_node_path65.join)(baseDir, relativePath));
6196
6373
  return new _AgentsMdRule({
6197
6374
  baseDir,
6198
6375
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -6232,12 +6409,12 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
6232
6409
  };
6233
6410
 
6234
6411
  // src/features/rules/amazonqcli-rule.ts
6235
- var import_node_path65 = require("path");
6412
+ var import_node_path66 = require("path");
6236
6413
  var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
6237
6414
  static getSettablePaths() {
6238
6415
  return {
6239
6416
  nonRoot: {
6240
- relativeDirPath: (0, import_node_path65.join)(".amazonq", "rules")
6417
+ relativeDirPath: (0, import_node_path66.join)(".amazonq", "rules")
6241
6418
  }
6242
6419
  };
6243
6420
  }
@@ -6247,7 +6424,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
6247
6424
  validate = true
6248
6425
  }) {
6249
6426
  const fileContent = await readFileContent(
6250
- (0, import_node_path65.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6427
+ (0, import_node_path66.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6251
6428
  );
6252
6429
  return new _AmazonQCliRule({
6253
6430
  baseDir,
@@ -6287,12 +6464,12 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
6287
6464
  };
6288
6465
 
6289
6466
  // src/features/rules/antigravity-rule.ts
6290
- var import_node_path66 = require("path");
6467
+ var import_node_path67 = require("path");
6291
6468
  var AntigravityRule = class _AntigravityRule extends ToolRule {
6292
6469
  static getSettablePaths() {
6293
6470
  return {
6294
6471
  nonRoot: {
6295
- relativeDirPath: (0, import_node_path66.join)(".agent", "rules")
6472
+ relativeDirPath: (0, import_node_path67.join)(".agent", "rules")
6296
6473
  }
6297
6474
  };
6298
6475
  }
@@ -6302,7 +6479,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
6302
6479
  validate = true
6303
6480
  }) {
6304
6481
  const fileContent = await readFileContent(
6305
- (0, import_node_path66.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6482
+ (0, import_node_path67.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6306
6483
  );
6307
6484
  return new _AntigravityRule({
6308
6485
  baseDir,
@@ -6342,7 +6519,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
6342
6519
  };
6343
6520
 
6344
6521
  // src/features/rules/augmentcode-legacy-rule.ts
6345
- var import_node_path67 = require("path");
6522
+ var import_node_path68 = require("path");
6346
6523
  var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
6347
6524
  toRulesyncRule() {
6348
6525
  const rulesyncFrontmatter = {
@@ -6368,7 +6545,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
6368
6545
  relativeFilePath: ".augment-guidelines"
6369
6546
  },
6370
6547
  nonRoot: {
6371
- relativeDirPath: (0, import_node_path67.join)(".augment", "rules")
6548
+ relativeDirPath: (0, import_node_path68.join)(".augment", "rules")
6372
6549
  }
6373
6550
  };
6374
6551
  }
@@ -6403,8 +6580,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
6403
6580
  }) {
6404
6581
  const settablePaths = this.getSettablePaths();
6405
6582
  const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
6406
- const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path67.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
6407
- const fileContent = await readFileContent((0, import_node_path67.join)(baseDir, relativePath));
6583
+ const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path68.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
6584
+ const fileContent = await readFileContent((0, import_node_path68.join)(baseDir, relativePath));
6408
6585
  return new _AugmentcodeLegacyRule({
6409
6586
  baseDir,
6410
6587
  relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
@@ -6417,7 +6594,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
6417
6594
  };
6418
6595
 
6419
6596
  // src/features/rules/augmentcode-rule.ts
6420
- var import_node_path68 = require("path");
6597
+ var import_node_path69 = require("path");
6421
6598
  var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
6422
6599
  toRulesyncRule() {
6423
6600
  return this.toRulesyncRuleDefault();
@@ -6425,7 +6602,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
6425
6602
  static getSettablePaths() {
6426
6603
  return {
6427
6604
  nonRoot: {
6428
- relativeDirPath: (0, import_node_path68.join)(".augment", "rules")
6605
+ relativeDirPath: (0, import_node_path69.join)(".augment", "rules")
6429
6606
  }
6430
6607
  };
6431
6608
  }
@@ -6449,7 +6626,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
6449
6626
  validate = true
6450
6627
  }) {
6451
6628
  const fileContent = await readFileContent(
6452
- (0, import_node_path68.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6629
+ (0, import_node_path69.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6453
6630
  );
6454
6631
  const { body: content } = parseFrontmatter(fileContent);
6455
6632
  return new _AugmentcodeRule({
@@ -6472,7 +6649,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
6472
6649
  };
6473
6650
 
6474
6651
  // src/features/rules/claudecode-rule.ts
6475
- var import_node_path69 = require("path");
6652
+ var import_node_path70 = require("path");
6476
6653
  var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
6477
6654
  static getSettablePaths({
6478
6655
  global
@@ -6491,7 +6668,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
6491
6668
  relativeFilePath: "CLAUDE.md"
6492
6669
  },
6493
6670
  nonRoot: {
6494
- relativeDirPath: (0, import_node_path69.join)(".claude", "memories")
6671
+ relativeDirPath: (0, import_node_path70.join)(".claude", "memories")
6495
6672
  }
6496
6673
  };
6497
6674
  }
@@ -6506,7 +6683,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
6506
6683
  if (isRoot) {
6507
6684
  const relativePath2 = paths.root.relativeFilePath;
6508
6685
  const fileContent2 = await readFileContent(
6509
- (0, import_node_path69.join)(baseDir, paths.root.relativeDirPath, relativePath2)
6686
+ (0, import_node_path70.join)(baseDir, paths.root.relativeDirPath, relativePath2)
6510
6687
  );
6511
6688
  return new _ClaudecodeRule({
6512
6689
  baseDir,
@@ -6520,8 +6697,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
6520
6697
  if (!paths.nonRoot) {
6521
6698
  throw new Error("nonRoot path is not set");
6522
6699
  }
6523
- const relativePath = (0, import_node_path69.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
6524
- const fileContent = await readFileContent((0, import_node_path69.join)(baseDir, relativePath));
6700
+ const relativePath = (0, import_node_path70.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
6701
+ const fileContent = await readFileContent((0, import_node_path70.join)(baseDir, relativePath));
6525
6702
  return new _ClaudecodeRule({
6526
6703
  baseDir,
6527
6704
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -6563,10 +6740,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
6563
6740
  };
6564
6741
 
6565
6742
  // src/features/rules/cline-rule.ts
6566
- var import_node_path70 = require("path");
6567
- var import_mini28 = require("zod/mini");
6568
- var ClineRuleFrontmatterSchema = import_mini28.z.object({
6569
- description: import_mini28.z.string()
6743
+ var import_node_path71 = require("path");
6744
+ var import_mini29 = require("zod/mini");
6745
+ var ClineRuleFrontmatterSchema = import_mini29.z.object({
6746
+ description: import_mini29.z.string()
6570
6747
  });
6571
6748
  var ClineRule = class _ClineRule extends ToolRule {
6572
6749
  static getSettablePaths() {
@@ -6608,7 +6785,7 @@ var ClineRule = class _ClineRule extends ToolRule {
6608
6785
  validate = true
6609
6786
  }) {
6610
6787
  const fileContent = await readFileContent(
6611
- (0, import_node_path70.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6788
+ (0, import_node_path71.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6612
6789
  );
6613
6790
  return new _ClineRule({
6614
6791
  baseDir,
@@ -6621,7 +6798,7 @@ var ClineRule = class _ClineRule extends ToolRule {
6621
6798
  };
6622
6799
 
6623
6800
  // src/features/rules/codexcli-rule.ts
6624
- var import_node_path71 = require("path");
6801
+ var import_node_path72 = require("path");
6625
6802
  var CodexcliRule = class _CodexcliRule extends ToolRule {
6626
6803
  static getSettablePaths({
6627
6804
  global
@@ -6640,7 +6817,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
6640
6817
  relativeFilePath: "AGENTS.md"
6641
6818
  },
6642
6819
  nonRoot: {
6643
- relativeDirPath: (0, import_node_path71.join)(".codex", "memories")
6820
+ relativeDirPath: (0, import_node_path72.join)(".codex", "memories")
6644
6821
  }
6645
6822
  };
6646
6823
  }
@@ -6655,7 +6832,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
6655
6832
  if (isRoot) {
6656
6833
  const relativePath2 = paths.root.relativeFilePath;
6657
6834
  const fileContent2 = await readFileContent(
6658
- (0, import_node_path71.join)(baseDir, paths.root.relativeDirPath, relativePath2)
6835
+ (0, import_node_path72.join)(baseDir, paths.root.relativeDirPath, relativePath2)
6659
6836
  );
6660
6837
  return new _CodexcliRule({
6661
6838
  baseDir,
@@ -6669,8 +6846,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
6669
6846
  if (!paths.nonRoot) {
6670
6847
  throw new Error("nonRoot path is not set");
6671
6848
  }
6672
- const relativePath = (0, import_node_path71.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
6673
- const fileContent = await readFileContent((0, import_node_path71.join)(baseDir, relativePath));
6849
+ const relativePath = (0, import_node_path72.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
6850
+ const fileContent = await readFileContent((0, import_node_path72.join)(baseDir, relativePath));
6674
6851
  return new _CodexcliRule({
6675
6852
  baseDir,
6676
6853
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -6712,12 +6889,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
6712
6889
  };
6713
6890
 
6714
6891
  // src/features/rules/copilot-rule.ts
6715
- var import_node_path72 = require("path");
6716
- var import_mini29 = require("zod/mini");
6717
- var CopilotRuleFrontmatterSchema = import_mini29.z.object({
6718
- description: import_mini29.z.optional(import_mini29.z.string()),
6719
- applyTo: import_mini29.z.optional(import_mini29.z.string()),
6720
- excludeAgent: import_mini29.z.optional(import_mini29.z.union([import_mini29.z.literal("code-review"), import_mini29.z.literal("coding-agent")]))
6892
+ var import_node_path73 = require("path");
6893
+ var import_mini30 = require("zod/mini");
6894
+ var CopilotRuleFrontmatterSchema = import_mini30.z.object({
6895
+ description: import_mini30.z.optional(import_mini30.z.string()),
6896
+ applyTo: import_mini30.z.optional(import_mini30.z.string()),
6897
+ excludeAgent: import_mini30.z.optional(import_mini30.z.union([import_mini30.z.literal("code-review"), import_mini30.z.literal("coding-agent")]))
6721
6898
  });
6722
6899
  var CopilotRule = class _CopilotRule extends ToolRule {
6723
6900
  frontmatter;
@@ -6729,7 +6906,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
6729
6906
  relativeFilePath: "copilot-instructions.md"
6730
6907
  },
6731
6908
  nonRoot: {
6732
- relativeDirPath: (0, import_node_path72.join)(".github", "instructions")
6909
+ relativeDirPath: (0, import_node_path73.join)(".github", "instructions")
6733
6910
  }
6734
6911
  };
6735
6912
  }
@@ -6738,7 +6915,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
6738
6915
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
6739
6916
  if (!result.success) {
6740
6917
  throw new Error(
6741
- `Invalid frontmatter in ${(0, import_node_path72.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
6918
+ `Invalid frontmatter in ${(0, import_node_path73.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
6742
6919
  );
6743
6920
  }
6744
6921
  }
@@ -6820,11 +6997,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
6820
6997
  validate = true
6821
6998
  }) {
6822
6999
  const isRoot = relativeFilePath === "copilot-instructions.md";
6823
- const relativePath = isRoot ? (0, import_node_path72.join)(
7000
+ const relativePath = isRoot ? (0, import_node_path73.join)(
6824
7001
  this.getSettablePaths().root.relativeDirPath,
6825
7002
  this.getSettablePaths().root.relativeFilePath
6826
- ) : (0, import_node_path72.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
6827
- const fileContent = await readFileContent((0, import_node_path72.join)(baseDir, relativePath));
7003
+ ) : (0, import_node_path73.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
7004
+ const fileContent = await readFileContent((0, import_node_path73.join)(baseDir, relativePath));
6828
7005
  if (isRoot) {
6829
7006
  return new _CopilotRule({
6830
7007
  baseDir,
@@ -6840,7 +7017,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
6840
7017
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
6841
7018
  if (!result.success) {
6842
7019
  throw new Error(
6843
- `Invalid frontmatter in ${(0, import_node_path72.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
7020
+ `Invalid frontmatter in ${(0, import_node_path73.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
6844
7021
  );
6845
7022
  }
6846
7023
  return new _CopilotRule({
@@ -6864,7 +7041,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
6864
7041
  return {
6865
7042
  success: false,
6866
7043
  error: new Error(
6867
- `Invalid frontmatter in ${(0, import_node_path72.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7044
+ `Invalid frontmatter in ${(0, import_node_path73.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
6868
7045
  )
6869
7046
  };
6870
7047
  }
@@ -6884,12 +7061,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
6884
7061
  };
6885
7062
 
6886
7063
  // src/features/rules/cursor-rule.ts
6887
- var import_node_path73 = require("path");
6888
- var import_mini30 = require("zod/mini");
6889
- var CursorRuleFrontmatterSchema = import_mini30.z.object({
6890
- description: import_mini30.z.optional(import_mini30.z.string()),
6891
- globs: import_mini30.z.optional(import_mini30.z.string()),
6892
- alwaysApply: import_mini30.z.optional(import_mini30.z.boolean())
7064
+ var import_node_path74 = require("path");
7065
+ var import_mini31 = require("zod/mini");
7066
+ var CursorRuleFrontmatterSchema = import_mini31.z.object({
7067
+ description: import_mini31.z.optional(import_mini31.z.string()),
7068
+ globs: import_mini31.z.optional(import_mini31.z.string()),
7069
+ alwaysApply: import_mini31.z.optional(import_mini31.z.boolean())
6893
7070
  });
6894
7071
  var CursorRule = class _CursorRule extends ToolRule {
6895
7072
  frontmatter;
@@ -6897,7 +7074,7 @@ var CursorRule = class _CursorRule extends ToolRule {
6897
7074
  static getSettablePaths() {
6898
7075
  return {
6899
7076
  nonRoot: {
6900
- relativeDirPath: (0, import_node_path73.join)(".cursor", "rules")
7077
+ relativeDirPath: (0, import_node_path74.join)(".cursor", "rules")
6901
7078
  }
6902
7079
  };
6903
7080
  }
@@ -6906,7 +7083,7 @@ var CursorRule = class _CursorRule extends ToolRule {
6906
7083
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
6907
7084
  if (!result.success) {
6908
7085
  throw new Error(
6909
- `Invalid frontmatter in ${(0, import_node_path73.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
7086
+ `Invalid frontmatter in ${(0, import_node_path74.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
6910
7087
  );
6911
7088
  }
6912
7089
  }
@@ -7023,19 +7200,19 @@ var CursorRule = class _CursorRule extends ToolRule {
7023
7200
  validate = true
7024
7201
  }) {
7025
7202
  const fileContent = await readFileContent(
7026
- (0, import_node_path73.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7203
+ (0, import_node_path74.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7027
7204
  );
7028
7205
  const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
7029
7206
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
7030
7207
  if (!result.success) {
7031
7208
  throw new Error(
7032
- `Invalid frontmatter in ${(0, import_node_path73.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
7209
+ `Invalid frontmatter in ${(0, import_node_path74.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
7033
7210
  );
7034
7211
  }
7035
7212
  return new _CursorRule({
7036
7213
  baseDir,
7037
7214
  relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
7038
- relativeFilePath: (0, import_node_path73.basename)(relativeFilePath),
7215
+ relativeFilePath: (0, import_node_path74.basename)(relativeFilePath),
7039
7216
  frontmatter: result.data,
7040
7217
  body: content.trim(),
7041
7218
  validate
@@ -7052,7 +7229,7 @@ var CursorRule = class _CursorRule extends ToolRule {
7052
7229
  return {
7053
7230
  success: false,
7054
7231
  error: new Error(
7055
- `Invalid frontmatter in ${(0, import_node_path73.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7232
+ `Invalid frontmatter in ${(0, import_node_path74.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7056
7233
  )
7057
7234
  };
7058
7235
  }
@@ -7072,7 +7249,7 @@ var CursorRule = class _CursorRule extends ToolRule {
7072
7249
  };
7073
7250
 
7074
7251
  // src/features/rules/geminicli-rule.ts
7075
- var import_node_path74 = require("path");
7252
+ var import_node_path75 = require("path");
7076
7253
  var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7077
7254
  static getSettablePaths({
7078
7255
  global
@@ -7091,7 +7268,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7091
7268
  relativeFilePath: "GEMINI.md"
7092
7269
  },
7093
7270
  nonRoot: {
7094
- relativeDirPath: (0, import_node_path74.join)(".gemini", "memories")
7271
+ relativeDirPath: (0, import_node_path75.join)(".gemini", "memories")
7095
7272
  }
7096
7273
  };
7097
7274
  }
@@ -7106,7 +7283,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7106
7283
  if (isRoot) {
7107
7284
  const relativePath2 = paths.root.relativeFilePath;
7108
7285
  const fileContent2 = await readFileContent(
7109
- (0, import_node_path74.join)(baseDir, paths.root.relativeDirPath, relativePath2)
7286
+ (0, import_node_path75.join)(baseDir, paths.root.relativeDirPath, relativePath2)
7110
7287
  );
7111
7288
  return new _GeminiCliRule({
7112
7289
  baseDir,
@@ -7120,8 +7297,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7120
7297
  if (!paths.nonRoot) {
7121
7298
  throw new Error("nonRoot path is not set");
7122
7299
  }
7123
- const relativePath = (0, import_node_path74.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
7124
- const fileContent = await readFileContent((0, import_node_path74.join)(baseDir, relativePath));
7300
+ const relativePath = (0, import_node_path75.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
7301
+ const fileContent = await readFileContent((0, import_node_path75.join)(baseDir, relativePath));
7125
7302
  return new _GeminiCliRule({
7126
7303
  baseDir,
7127
7304
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -7163,7 +7340,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7163
7340
  };
7164
7341
 
7165
7342
  // src/features/rules/junie-rule.ts
7166
- var import_node_path75 = require("path");
7343
+ var import_node_path76 = require("path");
7167
7344
  var JunieRule = class _JunieRule extends ToolRule {
7168
7345
  static getSettablePaths() {
7169
7346
  return {
@@ -7172,7 +7349,7 @@ var JunieRule = class _JunieRule extends ToolRule {
7172
7349
  relativeFilePath: "guidelines.md"
7173
7350
  },
7174
7351
  nonRoot: {
7175
- relativeDirPath: (0, import_node_path75.join)(".junie", "memories")
7352
+ relativeDirPath: (0, import_node_path76.join)(".junie", "memories")
7176
7353
  }
7177
7354
  };
7178
7355
  }
@@ -7182,8 +7359,8 @@ var JunieRule = class _JunieRule extends ToolRule {
7182
7359
  validate = true
7183
7360
  }) {
7184
7361
  const isRoot = relativeFilePath === "guidelines.md";
7185
- const relativePath = isRoot ? "guidelines.md" : (0, import_node_path75.join)(".junie", "memories", relativeFilePath);
7186
- const fileContent = await readFileContent((0, import_node_path75.join)(baseDir, relativePath));
7362
+ const relativePath = isRoot ? "guidelines.md" : (0, import_node_path76.join)(".junie", "memories", relativeFilePath);
7363
+ const fileContent = await readFileContent((0, import_node_path76.join)(baseDir, relativePath));
7187
7364
  return new _JunieRule({
7188
7365
  baseDir,
7189
7366
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -7223,12 +7400,12 @@ var JunieRule = class _JunieRule extends ToolRule {
7223
7400
  };
7224
7401
 
7225
7402
  // src/features/rules/kiro-rule.ts
7226
- var import_node_path76 = require("path");
7403
+ var import_node_path77 = require("path");
7227
7404
  var KiroRule = class _KiroRule extends ToolRule {
7228
7405
  static getSettablePaths() {
7229
7406
  return {
7230
7407
  nonRoot: {
7231
- relativeDirPath: (0, import_node_path76.join)(".kiro", "steering")
7408
+ relativeDirPath: (0, import_node_path77.join)(".kiro", "steering")
7232
7409
  }
7233
7410
  };
7234
7411
  }
@@ -7238,7 +7415,7 @@ var KiroRule = class _KiroRule extends ToolRule {
7238
7415
  validate = true
7239
7416
  }) {
7240
7417
  const fileContent = await readFileContent(
7241
- (0, import_node_path76.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7418
+ (0, import_node_path77.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7242
7419
  );
7243
7420
  return new _KiroRule({
7244
7421
  baseDir,
@@ -7278,7 +7455,7 @@ var KiroRule = class _KiroRule extends ToolRule {
7278
7455
  };
7279
7456
 
7280
7457
  // src/features/rules/opencode-rule.ts
7281
- var import_node_path77 = require("path");
7458
+ var import_node_path78 = require("path");
7282
7459
  var OpenCodeRule = class _OpenCodeRule extends ToolRule {
7283
7460
  static getSettablePaths() {
7284
7461
  return {
@@ -7287,7 +7464,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
7287
7464
  relativeFilePath: "AGENTS.md"
7288
7465
  },
7289
7466
  nonRoot: {
7290
- relativeDirPath: (0, import_node_path77.join)(".opencode", "memories")
7467
+ relativeDirPath: (0, import_node_path78.join)(".opencode", "memories")
7291
7468
  }
7292
7469
  };
7293
7470
  }
@@ -7297,8 +7474,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
7297
7474
  validate = true
7298
7475
  }) {
7299
7476
  const isRoot = relativeFilePath === "AGENTS.md";
7300
- const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path77.join)(".opencode", "memories", relativeFilePath);
7301
- const fileContent = await readFileContent((0, import_node_path77.join)(baseDir, relativePath));
7477
+ const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path78.join)(".opencode", "memories", relativeFilePath);
7478
+ const fileContent = await readFileContent((0, import_node_path78.join)(baseDir, relativePath));
7302
7479
  return new _OpenCodeRule({
7303
7480
  baseDir,
7304
7481
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -7338,7 +7515,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
7338
7515
  };
7339
7516
 
7340
7517
  // src/features/rules/qwencode-rule.ts
7341
- var import_node_path78 = require("path");
7518
+ var import_node_path79 = require("path");
7342
7519
  var QwencodeRule = class _QwencodeRule extends ToolRule {
7343
7520
  static getSettablePaths() {
7344
7521
  return {
@@ -7347,7 +7524,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
7347
7524
  relativeFilePath: "QWEN.md"
7348
7525
  },
7349
7526
  nonRoot: {
7350
- relativeDirPath: (0, import_node_path78.join)(".qwen", "memories")
7527
+ relativeDirPath: (0, import_node_path79.join)(".qwen", "memories")
7351
7528
  }
7352
7529
  };
7353
7530
  }
@@ -7357,8 +7534,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
7357
7534
  validate = true
7358
7535
  }) {
7359
7536
  const isRoot = relativeFilePath === "QWEN.md";
7360
- const relativePath = isRoot ? "QWEN.md" : (0, import_node_path78.join)(".qwen", "memories", relativeFilePath);
7361
- const fileContent = await readFileContent((0, import_node_path78.join)(baseDir, relativePath));
7537
+ const relativePath = isRoot ? "QWEN.md" : (0, import_node_path79.join)(".qwen", "memories", relativeFilePath);
7538
+ const fileContent = await readFileContent((0, import_node_path79.join)(baseDir, relativePath));
7362
7539
  return new _QwencodeRule({
7363
7540
  baseDir,
7364
7541
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -7395,12 +7572,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
7395
7572
  };
7396
7573
 
7397
7574
  // src/features/rules/roo-rule.ts
7398
- var import_node_path79 = require("path");
7575
+ var import_node_path80 = require("path");
7399
7576
  var RooRule = class _RooRule extends ToolRule {
7400
7577
  static getSettablePaths() {
7401
7578
  return {
7402
7579
  nonRoot: {
7403
- relativeDirPath: (0, import_node_path79.join)(".roo", "rules")
7580
+ relativeDirPath: (0, import_node_path80.join)(".roo", "rules")
7404
7581
  }
7405
7582
  };
7406
7583
  }
@@ -7410,7 +7587,7 @@ var RooRule = class _RooRule extends ToolRule {
7410
7587
  validate = true
7411
7588
  }) {
7412
7589
  const fileContent = await readFileContent(
7413
- (0, import_node_path79.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7590
+ (0, import_node_path80.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7414
7591
  );
7415
7592
  return new _RooRule({
7416
7593
  baseDir,
@@ -7465,7 +7642,7 @@ var RooRule = class _RooRule extends ToolRule {
7465
7642
  };
7466
7643
 
7467
7644
  // src/features/rules/warp-rule.ts
7468
- var import_node_path80 = require("path");
7645
+ var import_node_path81 = require("path");
7469
7646
  var WarpRule = class _WarpRule extends ToolRule {
7470
7647
  constructor({ fileContent, root, ...rest }) {
7471
7648
  super({
@@ -7481,7 +7658,7 @@ var WarpRule = class _WarpRule extends ToolRule {
7481
7658
  relativeFilePath: "WARP.md"
7482
7659
  },
7483
7660
  nonRoot: {
7484
- relativeDirPath: (0, import_node_path80.join)(".warp", "memories")
7661
+ relativeDirPath: (0, import_node_path81.join)(".warp", "memories")
7485
7662
  }
7486
7663
  };
7487
7664
  }
@@ -7491,8 +7668,8 @@ var WarpRule = class _WarpRule extends ToolRule {
7491
7668
  validate = true
7492
7669
  }) {
7493
7670
  const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
7494
- const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path80.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
7495
- const fileContent = await readFileContent((0, import_node_path80.join)(baseDir, relativePath));
7671
+ const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path81.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
7672
+ const fileContent = await readFileContent((0, import_node_path81.join)(baseDir, relativePath));
7496
7673
  return new _WarpRule({
7497
7674
  baseDir,
7498
7675
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
@@ -7532,12 +7709,12 @@ var WarpRule = class _WarpRule extends ToolRule {
7532
7709
  };
7533
7710
 
7534
7711
  // src/features/rules/windsurf-rule.ts
7535
- var import_node_path81 = require("path");
7712
+ var import_node_path82 = require("path");
7536
7713
  var WindsurfRule = class _WindsurfRule extends ToolRule {
7537
7714
  static getSettablePaths() {
7538
7715
  return {
7539
7716
  nonRoot: {
7540
- relativeDirPath: (0, import_node_path81.join)(".windsurf", "rules")
7717
+ relativeDirPath: (0, import_node_path82.join)(".windsurf", "rules")
7541
7718
  }
7542
7719
  };
7543
7720
  }
@@ -7547,7 +7724,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
7547
7724
  validate = true
7548
7725
  }) {
7549
7726
  const fileContent = await readFileContent(
7550
- (0, import_node_path81.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7727
+ (0, import_node_path82.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7551
7728
  );
7552
7729
  return new _WindsurfRule({
7553
7730
  baseDir,
@@ -7606,7 +7783,7 @@ var rulesProcessorToolTargets = [
7606
7783
  "warp",
7607
7784
  "windsurf"
7608
7785
  ];
7609
- var RulesProcessorToolTargetSchema = import_mini31.z.enum(rulesProcessorToolTargets);
7786
+ var RulesProcessorToolTargetSchema = import_mini32.z.enum(rulesProcessorToolTargets);
7610
7787
  var rulesProcessorToolTargetsGlobal = [
7611
7788
  "claudecode",
7612
7789
  "codexcli",
@@ -7732,7 +7909,7 @@ var RulesProcessor = class extends FeatureProcessor {
7732
7909
  case "agentsmd": {
7733
7910
  const rootRule = toolRules[rootRuleIndex];
7734
7911
  rootRule?.setFileContent(
7735
- this.generateXmlReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
7912
+ this.generateToonReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
7736
7913
  commands: { relativeDirPath: AgentsmdCommand.getSettablePaths().relativeDirPath },
7737
7914
  subagents: {
7738
7915
  relativeDirPath: AgentsmdSubagent.getSettablePaths().relativeDirPath
@@ -7744,7 +7921,7 @@ var RulesProcessor = class extends FeatureProcessor {
7744
7921
  case "augmentcode-legacy": {
7745
7922
  const rootRule = toolRules[rootRuleIndex];
7746
7923
  rootRule?.setFileContent(
7747
- this.generateXmlReferencesSection(toolRules) + rootRule.getFileContent()
7924
+ this.generateToonReferencesSection(toolRules) + rootRule.getFileContent()
7748
7925
  );
7749
7926
  return toolRules;
7750
7927
  }
@@ -7758,12 +7935,15 @@ var RulesProcessor = class extends FeatureProcessor {
7758
7935
  case "codexcli": {
7759
7936
  const rootRule = toolRules[rootRuleIndex];
7760
7937
  rootRule?.setFileContent(
7761
- this.generateXmlReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
7938
+ this.generateToonReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
7762
7939
  subagents: {
7763
7940
  relativeDirPath: CodexCliSubagent.getSettablePaths().relativeDirPath
7764
7941
  },
7765
- skills: {
7766
- relativeDirPath: CodexCliSkill.getSettablePaths().relativeDirPath
7942
+ // Codex CLI skills are only supported in global mode
7943
+ ...this.global && {
7944
+ skills: {
7945
+ relativeDirPath: CodexCliSkill.getSettablePaths({ global: this.global }).relativeDirPath
7946
+ }
7767
7947
  }
7768
7948
  }) + rootRule.getFileContent()
7769
7949
  );
@@ -7787,7 +7967,7 @@ var RulesProcessor = class extends FeatureProcessor {
7787
7967
  case "geminicli": {
7788
7968
  const rootRule = toolRules[rootRuleIndex];
7789
7969
  rootRule?.setFileContent(
7790
- this.generateXmlReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
7970
+ this.generateToonReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
7791
7971
  commands: { relativeDirPath: GeminiCliCommand.getSettablePaths().relativeDirPath },
7792
7972
  subagents: {
7793
7973
  relativeDirPath: GeminiCliSubagent.getSettablePaths().relativeDirPath
@@ -7799,28 +7979,28 @@ var RulesProcessor = class extends FeatureProcessor {
7799
7979
  case "kiro": {
7800
7980
  const rootRule = toolRules[rootRuleIndex];
7801
7981
  rootRule?.setFileContent(
7802
- this.generateXmlReferencesSection(toolRules) + rootRule.getFileContent()
7982
+ this.generateToonReferencesSection(toolRules) + rootRule.getFileContent()
7803
7983
  );
7804
7984
  return toolRules;
7805
7985
  }
7806
7986
  case "opencode": {
7807
7987
  const rootRule = toolRules[rootRuleIndex];
7808
7988
  rootRule?.setFileContent(
7809
- this.generateXmlReferencesSection(toolRules) + rootRule.getFileContent()
7989
+ this.generateToonReferencesSection(toolRules) + rootRule.getFileContent()
7810
7990
  );
7811
7991
  return toolRules;
7812
7992
  }
7813
7993
  case "qwencode": {
7814
7994
  const rootRule = toolRules[rootRuleIndex];
7815
7995
  rootRule?.setFileContent(
7816
- this.generateXmlReferencesSection(toolRules) + rootRule.getFileContent()
7996
+ this.generateToonReferencesSection(toolRules) + rootRule.getFileContent()
7817
7997
  );
7818
7998
  return toolRules;
7819
7999
  }
7820
8000
  case "warp": {
7821
8001
  const rootRule = toolRules[rootRuleIndex];
7822
8002
  rootRule?.setFileContent(
7823
- this.generateXmlReferencesSection(toolRules) + rootRule.getFileContent()
8003
+ this.generateToonReferencesSection(toolRules) + rootRule.getFileContent()
7824
8004
  );
7825
8005
  return toolRules;
7826
8006
  }
@@ -7840,10 +8020,10 @@ var RulesProcessor = class extends FeatureProcessor {
7840
8020
  * Load and parse rulesync rule files from .rulesync/rules/ directory
7841
8021
  */
7842
8022
  async loadRulesyncFiles() {
7843
- const files = await findFilesByGlobs((0, import_node_path82.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
8023
+ const files = await findFilesByGlobs((0, import_node_path83.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
7844
8024
  logger.debug(`Found ${files.length} rulesync files`);
7845
8025
  const rulesyncRules = await Promise.all(
7846
- files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path82.basename)(file) }))
8026
+ files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path83.basename)(file) }))
7847
8027
  );
7848
8028
  const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
7849
8029
  if (rootRules.length > 1) {
@@ -7861,10 +8041,10 @@ var RulesProcessor = class extends FeatureProcessor {
7861
8041
  return rulesyncRules;
7862
8042
  }
7863
8043
  async loadRulesyncFilesLegacy() {
7864
- const legacyFiles = await findFilesByGlobs((0, import_node_path82.join)(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
8044
+ const legacyFiles = await findFilesByGlobs((0, import_node_path83.join)(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
7865
8045
  logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
7866
8046
  return Promise.all(
7867
- legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path82.basename)(file) }))
8047
+ legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path83.basename)(file) }))
7868
8048
  );
7869
8049
  }
7870
8050
  /**
@@ -7882,7 +8062,7 @@ var RulesProcessor = class extends FeatureProcessor {
7882
8062
  return [];
7883
8063
  }
7884
8064
  const rootFilePaths = await findFilesByGlobs(
7885
- (0, import_node_path82.join)(
8065
+ (0, import_node_path83.join)(
7886
8066
  this.baseDir,
7887
8067
  settablePaths.root.relativeDirPath ?? ".",
7888
8068
  settablePaths.root.relativeFilePath
@@ -7892,7 +8072,7 @@ var RulesProcessor = class extends FeatureProcessor {
7892
8072
  rootFilePaths.map(
7893
8073
  (filePath) => factory.class.fromFile({
7894
8074
  baseDir: this.baseDir,
7895
- relativeFilePath: (0, import_node_path82.basename)(filePath),
8075
+ relativeFilePath: (0, import_node_path83.basename)(filePath),
7896
8076
  global: this.global
7897
8077
  })
7898
8078
  )
@@ -7904,13 +8084,13 @@ var RulesProcessor = class extends FeatureProcessor {
7904
8084
  return [];
7905
8085
  }
7906
8086
  const nonRootFilePaths = await findFilesByGlobs(
7907
- (0, import_node_path82.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
8087
+ (0, import_node_path83.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
7908
8088
  );
7909
8089
  return await Promise.all(
7910
8090
  nonRootFilePaths.map(
7911
8091
  (filePath) => factory.class.fromFile({
7912
8092
  baseDir: this.baseDir,
7913
- relativeFilePath: (0, import_node_path82.basename)(filePath),
8093
+ relativeFilePath: (0, import_node_path83.basename)(filePath),
7914
8094
  global: this.global
7915
8095
  })
7916
8096
  )
@@ -7933,43 +8113,35 @@ var RulesProcessor = class extends FeatureProcessor {
7933
8113
  }
7934
8114
  return rulesProcessorToolTargets;
7935
8115
  }
7936
- generateXmlReferencesSection(toolRules) {
8116
+ generateToonReferencesSection(toolRules) {
7937
8117
  const toolRulesWithoutRoot = toolRules.filter((rule) => !rule.isRoot());
7938
8118
  if (toolRulesWithoutRoot.length === 0) {
7939
8119
  return "";
7940
8120
  }
7941
8121
  const lines = [];
7942
8122
  lines.push(
7943
- "Please also reference the following documents as needed. In this case, `@` stands for the project root directory."
8123
+ "Please also reference the following rules as needed. The list below is provided in TOON format, and `@` stands for the project root directory."
7944
8124
  );
7945
8125
  lines.push("");
7946
- const documentsData = {
7947
- Documents: {
7948
- Document: toolRulesWithoutRoot.map((rule) => {
7949
- const rulesyncRule = rule.toRulesyncRule();
7950
- const frontmatter = rulesyncRule.getFrontmatter();
7951
- const relativePath = `@${rule.getRelativePathFromCwd()}`;
7952
- const document = {
7953
- Path: relativePath
7954
- };
7955
- if (frontmatter.description) {
7956
- document.Description = frontmatter.description;
7957
- }
7958
- if (frontmatter.globs && frontmatter.globs.length > 0) {
7959
- document.FilePatterns = frontmatter.globs.join(", ");
7960
- }
7961
- return document;
7962
- })
8126
+ const rules = toolRulesWithoutRoot.map((toolRule) => {
8127
+ const rulesyncRule = toolRule.toRulesyncRule();
8128
+ const frontmatter = rulesyncRule.getFrontmatter();
8129
+ const rule = {
8130
+ path: `@${toolRule.getRelativePathFromCwd()}`
8131
+ };
8132
+ if (frontmatter.description) {
8133
+ rule.description = frontmatter.description;
7963
8134
  }
7964
- };
7965
- const builder = new import_fast_xml_parser.XMLBuilder({
7966
- format: true,
7967
- ignoreAttributes: false,
7968
- suppressEmptyNode: false
8135
+ if (frontmatter.globs && frontmatter.globs.length > 0) {
8136
+ rule.applyTo = frontmatter.globs;
8137
+ }
8138
+ return rule;
7969
8139
  });
7970
- const xmlContent = builder.build(documentsData);
7971
- lines.push(xmlContent);
7972
- return lines.join("\n") + "\n";
8140
+ const toonContent = (0, import_toon.encode)({
8141
+ rules
8142
+ });
8143
+ lines.push(toonContent);
8144
+ return lines.join("\n") + "\n\n";
7973
8145
  }
7974
8146
  generateReferencesSection(toolRules) {
7975
8147
  const toolRulesWithoutRoot = toolRules.filter((rule) => !rule.isRoot());
@@ -7977,13 +8149,13 @@ var RulesProcessor = class extends FeatureProcessor {
7977
8149
  return "";
7978
8150
  }
7979
8151
  const lines = [];
7980
- lines.push("Please also reference the following documents as needed:");
8152
+ lines.push("Please also reference the following rules as needed:");
7981
8153
  lines.push("");
7982
- for (const rule of toolRulesWithoutRoot) {
7983
- const escapedDescription = rule.getDescription()?.replace(/"/g, '\\"');
7984
- const globsText = rule.getGlobs()?.join(",");
8154
+ for (const toolRule of toolRulesWithoutRoot) {
8155
+ const escapedDescription = toolRule.getDescription()?.replace(/"/g, '\\"');
8156
+ const globsText = toolRule.getGlobs()?.join(",");
7985
8157
  lines.push(
7986
- `@${rule.getRelativePathFromCwd()} description: "${escapedDescription}" globs: "${globsText}"`
8158
+ `@${toolRule.getRelativePathFromCwd()} description: "${escapedDescription}" applyTo: "${globsText}"`
7987
8159
  );
7988
8160
  }
7989
8161
  return lines.join("\n") + "\n\n";
@@ -8011,21 +8183,21 @@ s/<command> [arguments]
8011
8183
  This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
8012
8184
  The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
8013
8185
 
8014
- When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path82.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
8186
+ When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path83.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
8015
8187
  const subagentsSection = subagents ? `## Simulated Subagents
8016
8188
 
8017
8189
  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.
8018
8190
 
8019
- When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path82.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
8191
+ When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path83.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
8020
8192
 
8021
- For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path82.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
8193
+ For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path83.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
8022
8194
  const skillsSection = skills ? `## Simulated Skills
8023
8195
 
8024
8196
  Simulated skills are specialized capabilities that can be invoked to handle specific types of tasks.
8025
8197
 
8026
- When users invoke a simulated skill, look for the corresponding SKILL.md file in \`${(0, import_node_path82.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "{skill}/SKILL.md")}\` and execute its contents as the block of operations.
8198
+ When users invoke a simulated skill, look for the corresponding SKILL.md file in \`${(0, import_node_path83.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "{skill}/SKILL.md")}\` and execute its contents as the block of operations.
8027
8199
 
8028
- For example, if the user instructs \`Use the skill example-skill to achieve something\`, look for \`${(0, import_node_path82.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "example-skill/SKILL.md")}\` and execute its contents.
8200
+ For example, if the user instructs \`Use the skill example-skill to achieve something\`, look for \`${(0, import_node_path83.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "example-skill/SKILL.md")}\` and execute its contents.
8029
8201
 
8030
8202
  Additionally, you should proactively consider using available skills when they would help accomplish a task more effectively, even if the user doesn't explicitly request them.` : "";
8031
8203
  const result = [
@@ -8287,9 +8459,9 @@ async function generateSkills(config) {
8287
8459
  }
8288
8460
 
8289
8461
  // src/cli/commands/gitignore.ts
8290
- var import_node_path83 = require("path");
8462
+ var import_node_path84 = require("path");
8291
8463
  var gitignoreCommand = async () => {
8292
- const gitignorePath = (0, import_node_path83.join)(process.cwd(), ".gitignore");
8464
+ const gitignorePath = (0, import_node_path84.join)(process.cwd(), ".gitignore");
8293
8465
  const rulesFilesToIgnore = [
8294
8466
  "# Generated by rulesync - AI tool configuration files",
8295
8467
  // AGENTS.md
@@ -8562,7 +8734,7 @@ async function importSkills(config, tool) {
8562
8734
  }
8563
8735
 
8564
8736
  // src/cli/commands/init.ts
8565
- var import_node_path84 = require("path");
8737
+ var import_node_path85 = require("path");
8566
8738
  async function initCommand() {
8567
8739
  logger.info("Initializing rulesync...");
8568
8740
  await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
@@ -8725,14 +8897,14 @@ Attention, again, you are just the planner, so though you can read any files and
8725
8897
  await ensureDir(commandPaths.relativeDirPath);
8726
8898
  await ensureDir(subagentPaths.relativeDirPath);
8727
8899
  await ensureDir(ignorePaths.recommended.relativeDirPath);
8728
- const ruleFilepath = (0, import_node_path84.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
8900
+ const ruleFilepath = (0, import_node_path85.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
8729
8901
  if (!await fileExists(ruleFilepath)) {
8730
8902
  await writeFileContent(ruleFilepath, sampleRuleFile.content);
8731
8903
  logger.success(`Created ${ruleFilepath}`);
8732
8904
  } else {
8733
8905
  logger.info(`Skipped ${ruleFilepath} (already exists)`);
8734
8906
  }
8735
- const mcpFilepath = (0, import_node_path84.join)(
8907
+ const mcpFilepath = (0, import_node_path85.join)(
8736
8908
  mcpPaths.recommended.relativeDirPath,
8737
8909
  mcpPaths.recommended.relativeFilePath
8738
8910
  );
@@ -8742,21 +8914,21 @@ Attention, again, you are just the planner, so though you can read any files and
8742
8914
  } else {
8743
8915
  logger.info(`Skipped ${mcpFilepath} (already exists)`);
8744
8916
  }
8745
- const commandFilepath = (0, import_node_path84.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
8917
+ const commandFilepath = (0, import_node_path85.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
8746
8918
  if (!await fileExists(commandFilepath)) {
8747
8919
  await writeFileContent(commandFilepath, sampleCommandFile.content);
8748
8920
  logger.success(`Created ${commandFilepath}`);
8749
8921
  } else {
8750
8922
  logger.info(`Skipped ${commandFilepath} (already exists)`);
8751
8923
  }
8752
- const subagentFilepath = (0, import_node_path84.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
8924
+ const subagentFilepath = (0, import_node_path85.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
8753
8925
  if (!await fileExists(subagentFilepath)) {
8754
8926
  await writeFileContent(subagentFilepath, sampleSubagentFile.content);
8755
8927
  logger.success(`Created ${subagentFilepath}`);
8756
8928
  } else {
8757
8929
  logger.info(`Skipped ${subagentFilepath} (already exists)`);
8758
8930
  }
8759
- const ignoreFilepath = (0, import_node_path84.join)(
8931
+ const ignoreFilepath = (0, import_node_path85.join)(
8760
8932
  ignorePaths.recommended.relativeDirPath,
8761
8933
  ignorePaths.recommended.relativeFilePath
8762
8934
  );
@@ -8772,12 +8944,12 @@ Attention, again, you are just the planner, so though you can read any files and
8772
8944
  var import_fastmcp = require("fastmcp");
8773
8945
 
8774
8946
  // src/mcp/commands.ts
8775
- var import_node_path85 = require("path");
8776
- var import_mini32 = require("zod/mini");
8947
+ var import_node_path86 = require("path");
8948
+ var import_mini33 = require("zod/mini");
8777
8949
  var maxCommandSizeBytes = 1024 * 1024;
8778
8950
  var maxCommandsCount = 1e3;
8779
8951
  async function listCommands() {
8780
- const commandsDir = (0, import_node_path85.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
8952
+ const commandsDir = (0, import_node_path86.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
8781
8953
  try {
8782
8954
  const files = await listDirectoryFiles(commandsDir);
8783
8955
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -8789,7 +8961,7 @@ async function listCommands() {
8789
8961
  });
8790
8962
  const frontmatter = command.getFrontmatter();
8791
8963
  return {
8792
- relativePathFromCwd: (0, import_node_path85.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
8964
+ relativePathFromCwd: (0, import_node_path86.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
8793
8965
  frontmatter
8794
8966
  };
8795
8967
  } catch (error) {
@@ -8809,13 +8981,13 @@ async function getCommand({ relativePathFromCwd }) {
8809
8981
  relativePath: relativePathFromCwd,
8810
8982
  intendedRootDir: process.cwd()
8811
8983
  });
8812
- const filename = (0, import_node_path85.basename)(relativePathFromCwd);
8984
+ const filename = (0, import_node_path86.basename)(relativePathFromCwd);
8813
8985
  try {
8814
8986
  const command = await RulesyncCommand.fromFile({
8815
8987
  relativeFilePath: filename
8816
8988
  });
8817
8989
  return {
8818
- relativePathFromCwd: (0, import_node_path85.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
8990
+ relativePathFromCwd: (0, import_node_path86.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
8819
8991
  frontmatter: command.getFrontmatter(),
8820
8992
  body: command.getBody()
8821
8993
  };
@@ -8834,7 +9006,7 @@ async function putCommand({
8834
9006
  relativePath: relativePathFromCwd,
8835
9007
  intendedRootDir: process.cwd()
8836
9008
  });
8837
- const filename = (0, import_node_path85.basename)(relativePathFromCwd);
9009
+ const filename = (0, import_node_path86.basename)(relativePathFromCwd);
8838
9010
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
8839
9011
  if (estimatedSize > maxCommandSizeBytes) {
8840
9012
  throw new Error(
@@ -8844,7 +9016,7 @@ async function putCommand({
8844
9016
  try {
8845
9017
  const existingCommands = await listCommands();
8846
9018
  const isUpdate = existingCommands.some(
8847
- (command2) => command2.relativePathFromCwd === (0, import_node_path85.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
9019
+ (command2) => command2.relativePathFromCwd === (0, import_node_path86.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
8848
9020
  );
8849
9021
  if (!isUpdate && existingCommands.length >= maxCommandsCount) {
8850
9022
  throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
@@ -8859,11 +9031,11 @@ async function putCommand({
8859
9031
  fileContent,
8860
9032
  validate: true
8861
9033
  });
8862
- const commandsDir = (0, import_node_path85.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
9034
+ const commandsDir = (0, import_node_path86.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
8863
9035
  await ensureDir(commandsDir);
8864
9036
  await writeFileContent(command.getFilePath(), command.getFileContent());
8865
9037
  return {
8866
- relativePathFromCwd: (0, import_node_path85.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
9038
+ relativePathFromCwd: (0, import_node_path86.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
8867
9039
  frontmatter: command.getFrontmatter(),
8868
9040
  body: command.getBody()
8869
9041
  };
@@ -8878,12 +9050,12 @@ async function deleteCommand({ relativePathFromCwd }) {
8878
9050
  relativePath: relativePathFromCwd,
8879
9051
  intendedRootDir: process.cwd()
8880
9052
  });
8881
- const filename = (0, import_node_path85.basename)(relativePathFromCwd);
8882
- const fullPath = (0, import_node_path85.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
9053
+ const filename = (0, import_node_path86.basename)(relativePathFromCwd);
9054
+ const fullPath = (0, import_node_path86.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
8883
9055
  try {
8884
9056
  await removeFile(fullPath);
8885
9057
  return {
8886
- relativePathFromCwd: (0, import_node_path85.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
9058
+ relativePathFromCwd: (0, import_node_path86.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
8887
9059
  };
8888
9060
  } catch (error) {
8889
9061
  throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
@@ -8892,23 +9064,23 @@ async function deleteCommand({ relativePathFromCwd }) {
8892
9064
  }
8893
9065
  }
8894
9066
  var commandToolSchemas = {
8895
- listCommands: import_mini32.z.object({}),
8896
- getCommand: import_mini32.z.object({
8897
- relativePathFromCwd: import_mini32.z.string()
9067
+ listCommands: import_mini33.z.object({}),
9068
+ getCommand: import_mini33.z.object({
9069
+ relativePathFromCwd: import_mini33.z.string()
8898
9070
  }),
8899
- putCommand: import_mini32.z.object({
8900
- relativePathFromCwd: import_mini32.z.string(),
9071
+ putCommand: import_mini33.z.object({
9072
+ relativePathFromCwd: import_mini33.z.string(),
8901
9073
  frontmatter: RulesyncCommandFrontmatterSchema,
8902
- body: import_mini32.z.string()
9074
+ body: import_mini33.z.string()
8903
9075
  }),
8904
- deleteCommand: import_mini32.z.object({
8905
- relativePathFromCwd: import_mini32.z.string()
9076
+ deleteCommand: import_mini33.z.object({
9077
+ relativePathFromCwd: import_mini33.z.string()
8906
9078
  })
8907
9079
  };
8908
9080
  var commandTools = {
8909
9081
  listCommands: {
8910
9082
  name: "listCommands",
8911
- description: `List all commands from ${(0, import_node_path85.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
9083
+ description: `List all commands from ${(0, import_node_path86.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
8912
9084
  parameters: commandToolSchemas.listCommands,
8913
9085
  execute: async () => {
8914
9086
  const commands = await listCommands();
@@ -8950,11 +9122,11 @@ var commandTools = {
8950
9122
  };
8951
9123
 
8952
9124
  // src/mcp/ignore.ts
8953
- var import_node_path86 = require("path");
8954
- var import_mini33 = require("zod/mini");
9125
+ var import_node_path87 = require("path");
9126
+ var import_mini34 = require("zod/mini");
8955
9127
  var maxIgnoreFileSizeBytes = 100 * 1024;
8956
9128
  async function getIgnoreFile() {
8957
- const ignoreFilePath = (0, import_node_path86.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
9129
+ const ignoreFilePath = (0, import_node_path87.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
8958
9130
  try {
8959
9131
  const content = await readFileContent(ignoreFilePath);
8960
9132
  return {
@@ -8968,7 +9140,7 @@ async function getIgnoreFile() {
8968
9140
  }
8969
9141
  }
8970
9142
  async function putIgnoreFile({ content }) {
8971
- const ignoreFilePath = (0, import_node_path86.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
9143
+ const ignoreFilePath = (0, import_node_path87.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
8972
9144
  const contentSizeBytes = Buffer.byteLength(content, "utf8");
8973
9145
  if (contentSizeBytes > maxIgnoreFileSizeBytes) {
8974
9146
  throw new Error(
@@ -8989,8 +9161,8 @@ async function putIgnoreFile({ content }) {
8989
9161
  }
8990
9162
  }
8991
9163
  async function deleteIgnoreFile() {
8992
- const aiignorePath = (0, import_node_path86.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
8993
- const legacyIgnorePath = (0, import_node_path86.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
9164
+ const aiignorePath = (0, import_node_path87.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
9165
+ const legacyIgnorePath = (0, import_node_path87.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
8994
9166
  try {
8995
9167
  await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
8996
9168
  return {
@@ -9008,11 +9180,11 @@ async function deleteIgnoreFile() {
9008
9180
  }
9009
9181
  }
9010
9182
  var ignoreToolSchemas = {
9011
- getIgnoreFile: import_mini33.z.object({}),
9012
- putIgnoreFile: import_mini33.z.object({
9013
- content: import_mini33.z.string()
9183
+ getIgnoreFile: import_mini34.z.object({}),
9184
+ putIgnoreFile: import_mini34.z.object({
9185
+ content: import_mini34.z.string()
9014
9186
  }),
9015
- deleteIgnoreFile: import_mini33.z.object({})
9187
+ deleteIgnoreFile: import_mini34.z.object({})
9016
9188
  };
9017
9189
  var ignoreTools = {
9018
9190
  getIgnoreFile: {
@@ -9045,8 +9217,8 @@ var ignoreTools = {
9045
9217
  };
9046
9218
 
9047
9219
  // src/mcp/mcp.ts
9048
- var import_node_path87 = require("path");
9049
- var import_mini34 = require("zod/mini");
9220
+ var import_node_path88 = require("path");
9221
+ var import_mini35 = require("zod/mini");
9050
9222
  var maxMcpSizeBytes = 1024 * 1024;
9051
9223
  async function getMcpFile() {
9052
9224
  const config = await ConfigResolver.resolve({});
@@ -9055,7 +9227,7 @@ async function getMcpFile() {
9055
9227
  validate: true,
9056
9228
  modularMcp: config.getModularMcp()
9057
9229
  });
9058
- const relativePathFromCwd = (0, import_node_path87.join)(
9230
+ const relativePathFromCwd = (0, import_node_path88.join)(
9059
9231
  rulesyncMcp.getRelativeDirPath(),
9060
9232
  rulesyncMcp.getRelativeFilePath()
9061
9233
  );
@@ -9088,7 +9260,7 @@ async function putMcpFile({ content }) {
9088
9260
  const paths = RulesyncMcp.getSettablePaths();
9089
9261
  const relativeDirPath = paths.recommended.relativeDirPath;
9090
9262
  const relativeFilePath = paths.recommended.relativeFilePath;
9091
- const fullPath = (0, import_node_path87.join)(baseDir, relativeDirPath, relativeFilePath);
9263
+ const fullPath = (0, import_node_path88.join)(baseDir, relativeDirPath, relativeFilePath);
9092
9264
  const rulesyncMcp = new RulesyncMcp({
9093
9265
  baseDir,
9094
9266
  relativeDirPath,
@@ -9097,9 +9269,9 @@ async function putMcpFile({ content }) {
9097
9269
  validate: true,
9098
9270
  modularMcp: config.getModularMcp()
9099
9271
  });
9100
- await ensureDir((0, import_node_path87.join)(baseDir, relativeDirPath));
9272
+ await ensureDir((0, import_node_path88.join)(baseDir, relativeDirPath));
9101
9273
  await writeFileContent(fullPath, content);
9102
- const relativePathFromCwd = (0, import_node_path87.join)(relativeDirPath, relativeFilePath);
9274
+ const relativePathFromCwd = (0, import_node_path88.join)(relativeDirPath, relativeFilePath);
9103
9275
  return {
9104
9276
  relativePathFromCwd,
9105
9277
  content: rulesyncMcp.getFileContent()
@@ -9114,15 +9286,15 @@ async function deleteMcpFile() {
9114
9286
  try {
9115
9287
  const baseDir = process.cwd();
9116
9288
  const paths = RulesyncMcp.getSettablePaths();
9117
- const recommendedPath = (0, import_node_path87.join)(
9289
+ const recommendedPath = (0, import_node_path88.join)(
9118
9290
  baseDir,
9119
9291
  paths.recommended.relativeDirPath,
9120
9292
  paths.recommended.relativeFilePath
9121
9293
  );
9122
- const legacyPath = (0, import_node_path87.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
9294
+ const legacyPath = (0, import_node_path88.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
9123
9295
  await removeFile(recommendedPath);
9124
9296
  await removeFile(legacyPath);
9125
- const relativePathFromCwd = (0, import_node_path87.join)(
9297
+ const relativePathFromCwd = (0, import_node_path88.join)(
9126
9298
  paths.recommended.relativeDirPath,
9127
9299
  paths.recommended.relativeFilePath
9128
9300
  );
@@ -9136,11 +9308,11 @@ async function deleteMcpFile() {
9136
9308
  }
9137
9309
  }
9138
9310
  var mcpToolSchemas = {
9139
- getMcpFile: import_mini34.z.object({}),
9140
- putMcpFile: import_mini34.z.object({
9141
- content: import_mini34.z.string()
9311
+ getMcpFile: import_mini35.z.object({}),
9312
+ putMcpFile: import_mini35.z.object({
9313
+ content: import_mini35.z.string()
9142
9314
  }),
9143
- deleteMcpFile: import_mini34.z.object({})
9315
+ deleteMcpFile: import_mini35.z.object({})
9144
9316
  };
9145
9317
  var mcpTools = {
9146
9318
  getMcpFile: {
@@ -9173,12 +9345,12 @@ var mcpTools = {
9173
9345
  };
9174
9346
 
9175
9347
  // src/mcp/rules.ts
9176
- var import_node_path88 = require("path");
9177
- var import_mini35 = require("zod/mini");
9348
+ var import_node_path89 = require("path");
9349
+ var import_mini36 = require("zod/mini");
9178
9350
  var maxRuleSizeBytes = 1024 * 1024;
9179
9351
  var maxRulesCount = 1e3;
9180
9352
  async function listRules() {
9181
- const rulesDir = (0, import_node_path88.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
9353
+ const rulesDir = (0, import_node_path89.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
9182
9354
  try {
9183
9355
  const files = await listDirectoryFiles(rulesDir);
9184
9356
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -9191,7 +9363,7 @@ async function listRules() {
9191
9363
  });
9192
9364
  const frontmatter = rule.getFrontmatter();
9193
9365
  return {
9194
- relativePathFromCwd: (0, import_node_path88.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
9366
+ relativePathFromCwd: (0, import_node_path89.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
9195
9367
  frontmatter
9196
9368
  };
9197
9369
  } catch (error) {
@@ -9211,14 +9383,14 @@ async function getRule({ relativePathFromCwd }) {
9211
9383
  relativePath: relativePathFromCwd,
9212
9384
  intendedRootDir: process.cwd()
9213
9385
  });
9214
- const filename = (0, import_node_path88.basename)(relativePathFromCwd);
9386
+ const filename = (0, import_node_path89.basename)(relativePathFromCwd);
9215
9387
  try {
9216
9388
  const rule = await RulesyncRule.fromFile({
9217
9389
  relativeFilePath: filename,
9218
9390
  validate: true
9219
9391
  });
9220
9392
  return {
9221
- relativePathFromCwd: (0, import_node_path88.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
9393
+ relativePathFromCwd: (0, import_node_path89.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
9222
9394
  frontmatter: rule.getFrontmatter(),
9223
9395
  body: rule.getBody()
9224
9396
  };
@@ -9237,7 +9409,7 @@ async function putRule({
9237
9409
  relativePath: relativePathFromCwd,
9238
9410
  intendedRootDir: process.cwd()
9239
9411
  });
9240
- const filename = (0, import_node_path88.basename)(relativePathFromCwd);
9412
+ const filename = (0, import_node_path89.basename)(relativePathFromCwd);
9241
9413
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
9242
9414
  if (estimatedSize > maxRuleSizeBytes) {
9243
9415
  throw new Error(
@@ -9247,7 +9419,7 @@ async function putRule({
9247
9419
  try {
9248
9420
  const existingRules = await listRules();
9249
9421
  const isUpdate = existingRules.some(
9250
- (rule2) => rule2.relativePathFromCwd === (0, import_node_path88.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
9422
+ (rule2) => rule2.relativePathFromCwd === (0, import_node_path89.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
9251
9423
  );
9252
9424
  if (!isUpdate && existingRules.length >= maxRulesCount) {
9253
9425
  throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
@@ -9260,11 +9432,11 @@ async function putRule({
9260
9432
  body,
9261
9433
  validate: true
9262
9434
  });
9263
- const rulesDir = (0, import_node_path88.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
9435
+ const rulesDir = (0, import_node_path89.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
9264
9436
  await ensureDir(rulesDir);
9265
9437
  await writeFileContent(rule.getFilePath(), rule.getFileContent());
9266
9438
  return {
9267
- relativePathFromCwd: (0, import_node_path88.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
9439
+ relativePathFromCwd: (0, import_node_path89.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
9268
9440
  frontmatter: rule.getFrontmatter(),
9269
9441
  body: rule.getBody()
9270
9442
  };
@@ -9279,12 +9451,12 @@ async function deleteRule({ relativePathFromCwd }) {
9279
9451
  relativePath: relativePathFromCwd,
9280
9452
  intendedRootDir: process.cwd()
9281
9453
  });
9282
- const filename = (0, import_node_path88.basename)(relativePathFromCwd);
9283
- const fullPath = (0, import_node_path88.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
9454
+ const filename = (0, import_node_path89.basename)(relativePathFromCwd);
9455
+ const fullPath = (0, import_node_path89.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
9284
9456
  try {
9285
9457
  await removeFile(fullPath);
9286
9458
  return {
9287
- relativePathFromCwd: (0, import_node_path88.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
9459
+ relativePathFromCwd: (0, import_node_path89.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
9288
9460
  };
9289
9461
  } catch (error) {
9290
9462
  throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
@@ -9293,23 +9465,23 @@ async function deleteRule({ relativePathFromCwd }) {
9293
9465
  }
9294
9466
  }
9295
9467
  var ruleToolSchemas = {
9296
- listRules: import_mini35.z.object({}),
9297
- getRule: import_mini35.z.object({
9298
- relativePathFromCwd: import_mini35.z.string()
9468
+ listRules: import_mini36.z.object({}),
9469
+ getRule: import_mini36.z.object({
9470
+ relativePathFromCwd: import_mini36.z.string()
9299
9471
  }),
9300
- putRule: import_mini35.z.object({
9301
- relativePathFromCwd: import_mini35.z.string(),
9472
+ putRule: import_mini36.z.object({
9473
+ relativePathFromCwd: import_mini36.z.string(),
9302
9474
  frontmatter: RulesyncRuleFrontmatterSchema,
9303
- body: import_mini35.z.string()
9475
+ body: import_mini36.z.string()
9304
9476
  }),
9305
- deleteRule: import_mini35.z.object({
9306
- relativePathFromCwd: import_mini35.z.string()
9477
+ deleteRule: import_mini36.z.object({
9478
+ relativePathFromCwd: import_mini36.z.string()
9307
9479
  })
9308
9480
  };
9309
9481
  var ruleTools = {
9310
9482
  listRules: {
9311
9483
  name: "listRules",
9312
- description: `List all rules from ${(0, import_node_path88.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
9484
+ description: `List all rules from ${(0, import_node_path89.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
9313
9485
  parameters: ruleToolSchemas.listRules,
9314
9486
  execute: async () => {
9315
9487
  const rules = await listRules();
@@ -9351,8 +9523,8 @@ var ruleTools = {
9351
9523
  };
9352
9524
 
9353
9525
  // src/mcp/skills.ts
9354
- var import_node_path89 = require("path");
9355
- var import_mini36 = require("zod/mini");
9526
+ var import_node_path90 = require("path");
9527
+ var import_mini37 = require("zod/mini");
9356
9528
  var maxSkillSizeBytes = 1024 * 1024;
9357
9529
  var maxSkillsCount = 1e3;
9358
9530
  function aiDirFileToMcpSkillFile(file) {
@@ -9368,19 +9540,19 @@ function mcpSkillFileToAiDirFile(file) {
9368
9540
  };
9369
9541
  }
9370
9542
  function extractDirName(relativeDirPathFromCwd) {
9371
- const dirName = (0, import_node_path89.basename)(relativeDirPathFromCwd);
9543
+ const dirName = (0, import_node_path90.basename)(relativeDirPathFromCwd);
9372
9544
  if (!dirName) {
9373
9545
  throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
9374
9546
  }
9375
9547
  return dirName;
9376
9548
  }
9377
9549
  async function listSkills() {
9378
- const skillsDir = (0, import_node_path89.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
9550
+ const skillsDir = (0, import_node_path90.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
9379
9551
  try {
9380
- const skillDirPaths = await findFilesByGlobs((0, import_node_path89.join)(skillsDir, "*"), { type: "dir" });
9552
+ const skillDirPaths = await findFilesByGlobs((0, import_node_path90.join)(skillsDir, "*"), { type: "dir" });
9381
9553
  const skills = await Promise.all(
9382
9554
  skillDirPaths.map(async (dirPath) => {
9383
- const dirName = (0, import_node_path89.basename)(dirPath);
9555
+ const dirName = (0, import_node_path90.basename)(dirPath);
9384
9556
  if (!dirName) return null;
9385
9557
  try {
9386
9558
  const skill = await RulesyncSkill.fromDir({
@@ -9388,7 +9560,7 @@ async function listSkills() {
9388
9560
  });
9389
9561
  const frontmatter = skill.getFrontmatter();
9390
9562
  return {
9391
- relativeDirPathFromCwd: (0, import_node_path89.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
9563
+ relativeDirPathFromCwd: (0, import_node_path90.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
9392
9564
  frontmatter
9393
9565
  };
9394
9566
  } catch (error) {
@@ -9414,7 +9586,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
9414
9586
  dirName
9415
9587
  });
9416
9588
  return {
9417
- relativeDirPathFromCwd: (0, import_node_path89.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
9589
+ relativeDirPathFromCwd: (0, import_node_path90.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
9418
9590
  frontmatter: skill.getFrontmatter(),
9419
9591
  body: skill.getBody(),
9420
9592
  otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
@@ -9448,7 +9620,7 @@ async function putSkill({
9448
9620
  try {
9449
9621
  const existingSkills = await listSkills();
9450
9622
  const isUpdate = existingSkills.some(
9451
- (skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path89.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
9623
+ (skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path90.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
9452
9624
  );
9453
9625
  if (!isUpdate && existingSkills.length >= maxSkillsCount) {
9454
9626
  throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
@@ -9463,9 +9635,9 @@ async function putSkill({
9463
9635
  otherFiles: aiDirFiles,
9464
9636
  validate: true
9465
9637
  });
9466
- const skillDirPath = (0, import_node_path89.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
9638
+ const skillDirPath = (0, import_node_path90.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
9467
9639
  await ensureDir(skillDirPath);
9468
- const skillFilePath = (0, import_node_path89.join)(skillDirPath, SKILL_FILE_NAME);
9640
+ const skillFilePath = (0, import_node_path90.join)(skillDirPath, SKILL_FILE_NAME);
9469
9641
  const skillFileContent = stringifyFrontmatter(body, frontmatter);
9470
9642
  await writeFileContent(skillFilePath, skillFileContent);
9471
9643
  for (const file of otherFiles) {
@@ -9473,15 +9645,15 @@ async function putSkill({
9473
9645
  relativePath: file.name,
9474
9646
  intendedRootDir: skillDirPath
9475
9647
  });
9476
- const filePath = (0, import_node_path89.join)(skillDirPath, file.name);
9477
- const fileDir = (0, import_node_path89.join)(skillDirPath, (0, import_node_path89.dirname)(file.name));
9648
+ const filePath = (0, import_node_path90.join)(skillDirPath, file.name);
9649
+ const fileDir = (0, import_node_path90.join)(skillDirPath, (0, import_node_path90.dirname)(file.name));
9478
9650
  if (fileDir !== skillDirPath) {
9479
9651
  await ensureDir(fileDir);
9480
9652
  }
9481
9653
  await writeFileContent(filePath, file.body);
9482
9654
  }
9483
9655
  return {
9484
- relativeDirPathFromCwd: (0, import_node_path89.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
9656
+ relativeDirPathFromCwd: (0, import_node_path90.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
9485
9657
  frontmatter: skill.getFrontmatter(),
9486
9658
  body: skill.getBody(),
9487
9659
  otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
@@ -9503,13 +9675,13 @@ async function deleteSkill({
9503
9675
  intendedRootDir: process.cwd()
9504
9676
  });
9505
9677
  const dirName = extractDirName(relativeDirPathFromCwd);
9506
- const skillDirPath = (0, import_node_path89.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
9678
+ const skillDirPath = (0, import_node_path90.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
9507
9679
  try {
9508
9680
  if (await directoryExists(skillDirPath)) {
9509
9681
  await removeDirectory(skillDirPath);
9510
9682
  }
9511
9683
  return {
9512
- relativeDirPathFromCwd: (0, import_node_path89.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
9684
+ relativeDirPathFromCwd: (0, import_node_path90.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
9513
9685
  };
9514
9686
  } catch (error) {
9515
9687
  throw new Error(
@@ -9520,29 +9692,29 @@ async function deleteSkill({
9520
9692
  );
9521
9693
  }
9522
9694
  }
9523
- var McpSkillFileSchema = import_mini36.z.object({
9524
- name: import_mini36.z.string(),
9525
- body: import_mini36.z.string()
9695
+ var McpSkillFileSchema = import_mini37.z.object({
9696
+ name: import_mini37.z.string(),
9697
+ body: import_mini37.z.string()
9526
9698
  });
9527
9699
  var skillToolSchemas = {
9528
- listSkills: import_mini36.z.object({}),
9529
- getSkill: import_mini36.z.object({
9530
- relativeDirPathFromCwd: import_mini36.z.string()
9700
+ listSkills: import_mini37.z.object({}),
9701
+ getSkill: import_mini37.z.object({
9702
+ relativeDirPathFromCwd: import_mini37.z.string()
9531
9703
  }),
9532
- putSkill: import_mini36.z.object({
9533
- relativeDirPathFromCwd: import_mini36.z.string(),
9704
+ putSkill: import_mini37.z.object({
9705
+ relativeDirPathFromCwd: import_mini37.z.string(),
9534
9706
  frontmatter: RulesyncSkillFrontmatterSchema,
9535
- body: import_mini36.z.string(),
9536
- otherFiles: import_mini36.z.optional(import_mini36.z.array(McpSkillFileSchema))
9707
+ body: import_mini37.z.string(),
9708
+ otherFiles: import_mini37.z.optional(import_mini37.z.array(McpSkillFileSchema))
9537
9709
  }),
9538
- deleteSkill: import_mini36.z.object({
9539
- relativeDirPathFromCwd: import_mini36.z.string()
9710
+ deleteSkill: import_mini37.z.object({
9711
+ relativeDirPathFromCwd: import_mini37.z.string()
9540
9712
  })
9541
9713
  };
9542
9714
  var skillTools = {
9543
9715
  listSkills: {
9544
9716
  name: "listSkills",
9545
- description: `List all skills from ${(0, import_node_path89.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
9717
+ description: `List all skills from ${(0, import_node_path90.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
9546
9718
  parameters: skillToolSchemas.listSkills,
9547
9719
  execute: async () => {
9548
9720
  const skills = await listSkills();
@@ -9585,12 +9757,12 @@ var skillTools = {
9585
9757
  };
9586
9758
 
9587
9759
  // src/mcp/subagents.ts
9588
- var import_node_path90 = require("path");
9589
- var import_mini37 = require("zod/mini");
9760
+ var import_node_path91 = require("path");
9761
+ var import_mini38 = require("zod/mini");
9590
9762
  var maxSubagentSizeBytes = 1024 * 1024;
9591
9763
  var maxSubagentsCount = 1e3;
9592
9764
  async function listSubagents() {
9593
- const subagentsDir = (0, import_node_path90.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
9765
+ const subagentsDir = (0, import_node_path91.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
9594
9766
  try {
9595
9767
  const files = await listDirectoryFiles(subagentsDir);
9596
9768
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -9603,7 +9775,7 @@ async function listSubagents() {
9603
9775
  });
9604
9776
  const frontmatter = subagent.getFrontmatter();
9605
9777
  return {
9606
- relativePathFromCwd: (0, import_node_path90.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
9778
+ relativePathFromCwd: (0, import_node_path91.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
9607
9779
  frontmatter
9608
9780
  };
9609
9781
  } catch (error) {
@@ -9625,14 +9797,14 @@ async function getSubagent({ relativePathFromCwd }) {
9625
9797
  relativePath: relativePathFromCwd,
9626
9798
  intendedRootDir: process.cwd()
9627
9799
  });
9628
- const filename = (0, import_node_path90.basename)(relativePathFromCwd);
9800
+ const filename = (0, import_node_path91.basename)(relativePathFromCwd);
9629
9801
  try {
9630
9802
  const subagent = await RulesyncSubagent.fromFile({
9631
9803
  relativeFilePath: filename,
9632
9804
  validate: true
9633
9805
  });
9634
9806
  return {
9635
- relativePathFromCwd: (0, import_node_path90.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
9807
+ relativePathFromCwd: (0, import_node_path91.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
9636
9808
  frontmatter: subagent.getFrontmatter(),
9637
9809
  body: subagent.getBody()
9638
9810
  };
@@ -9651,7 +9823,7 @@ async function putSubagent({
9651
9823
  relativePath: relativePathFromCwd,
9652
9824
  intendedRootDir: process.cwd()
9653
9825
  });
9654
- const filename = (0, import_node_path90.basename)(relativePathFromCwd);
9826
+ const filename = (0, import_node_path91.basename)(relativePathFromCwd);
9655
9827
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
9656
9828
  if (estimatedSize > maxSubagentSizeBytes) {
9657
9829
  throw new Error(
@@ -9661,7 +9833,7 @@ async function putSubagent({
9661
9833
  try {
9662
9834
  const existingSubagents = await listSubagents();
9663
9835
  const isUpdate = existingSubagents.some(
9664
- (subagent2) => subagent2.relativePathFromCwd === (0, import_node_path90.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
9836
+ (subagent2) => subagent2.relativePathFromCwd === (0, import_node_path91.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
9665
9837
  );
9666
9838
  if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
9667
9839
  throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
@@ -9674,11 +9846,11 @@ async function putSubagent({
9674
9846
  body,
9675
9847
  validate: true
9676
9848
  });
9677
- const subagentsDir = (0, import_node_path90.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
9849
+ const subagentsDir = (0, import_node_path91.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
9678
9850
  await ensureDir(subagentsDir);
9679
9851
  await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
9680
9852
  return {
9681
- relativePathFromCwd: (0, import_node_path90.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
9853
+ relativePathFromCwd: (0, import_node_path91.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
9682
9854
  frontmatter: subagent.getFrontmatter(),
9683
9855
  body: subagent.getBody()
9684
9856
  };
@@ -9693,12 +9865,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
9693
9865
  relativePath: relativePathFromCwd,
9694
9866
  intendedRootDir: process.cwd()
9695
9867
  });
9696
- const filename = (0, import_node_path90.basename)(relativePathFromCwd);
9697
- const fullPath = (0, import_node_path90.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
9868
+ const filename = (0, import_node_path91.basename)(relativePathFromCwd);
9869
+ const fullPath = (0, import_node_path91.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
9698
9870
  try {
9699
9871
  await removeFile(fullPath);
9700
9872
  return {
9701
- relativePathFromCwd: (0, import_node_path90.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
9873
+ relativePathFromCwd: (0, import_node_path91.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
9702
9874
  };
9703
9875
  } catch (error) {
9704
9876
  throw new Error(
@@ -9710,23 +9882,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
9710
9882
  }
9711
9883
  }
9712
9884
  var subagentToolSchemas = {
9713
- listSubagents: import_mini37.z.object({}),
9714
- getSubagent: import_mini37.z.object({
9715
- relativePathFromCwd: import_mini37.z.string()
9885
+ listSubagents: import_mini38.z.object({}),
9886
+ getSubagent: import_mini38.z.object({
9887
+ relativePathFromCwd: import_mini38.z.string()
9716
9888
  }),
9717
- putSubagent: import_mini37.z.object({
9718
- relativePathFromCwd: import_mini37.z.string(),
9889
+ putSubagent: import_mini38.z.object({
9890
+ relativePathFromCwd: import_mini38.z.string(),
9719
9891
  frontmatter: RulesyncSubagentFrontmatterSchema,
9720
- body: import_mini37.z.string()
9892
+ body: import_mini38.z.string()
9721
9893
  }),
9722
- deleteSubagent: import_mini37.z.object({
9723
- relativePathFromCwd: import_mini37.z.string()
9894
+ deleteSubagent: import_mini38.z.object({
9895
+ relativePathFromCwd: import_mini38.z.string()
9724
9896
  })
9725
9897
  };
9726
9898
  var subagentTools = {
9727
9899
  listSubagents: {
9728
9900
  name: "listSubagents",
9729
- description: `List all subagents from ${(0, import_node_path90.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
9901
+ description: `List all subagents from ${(0, import_node_path91.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
9730
9902
  parameters: subagentToolSchemas.listSubagents,
9731
9903
  execute: async () => {
9732
9904
  const subagents = await listSubagents();
@@ -9804,7 +9976,7 @@ async function mcpCommand({ version }) {
9804
9976
  }
9805
9977
 
9806
9978
  // src/cli/index.ts
9807
- var getVersion = () => "3.30.0";
9979
+ var getVersion = () => "3.31.0";
9808
9980
  var main = async () => {
9809
9981
  const program = new import_commander.Command();
9810
9982
  const version = getVersion();