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.js CHANGED
@@ -4214,20 +4214,21 @@ var McpProcessor = class extends FeatureProcessor {
4214
4214
  };
4215
4215
 
4216
4216
  // src/features/rules/rules-processor.ts
4217
- import { basename as basename21, join as join80 } from "path";
4218
- import { XMLBuilder } from "fast-xml-parser";
4219
- import { z as z31 } from "zod/mini";
4217
+ import { basename as basename21, join as join81 } from "path";
4218
+ import { encode } from "@toon-format/toon";
4219
+ import { z as z32 } from "zod/mini";
4220
4220
 
4221
4221
  // src/features/skills/codexcli-skill.ts
4222
- import { join as join41 } from "path";
4223
-
4224
- // src/features/skills/simulated-skill.ts
4225
- import { join as join40 } from "path";
4226
- import { z as z19 } from "zod/mini";
4222
+ import { join as join42 } from "path";
4223
+ import { z as z20 } from "zod/mini";
4227
4224
 
4228
4225
  // src/constants/general.ts
4229
4226
  var SKILL_FILE_NAME = "SKILL.md";
4230
4227
 
4228
+ // src/features/skills/rulesync-skill.ts
4229
+ import { join as join40 } from "path";
4230
+ import { z as z19 } from "zod/mini";
4231
+
4231
4232
  // src/types/ai-dir.ts
4232
4233
  import path2, { basename as basename14, join as join39, relative as relative3, resolve as resolve4 } from "path";
4233
4234
  var AiDir = class {
@@ -4340,7 +4341,113 @@ var AiDir = class {
4340
4341
  }
4341
4342
  };
4342
4343
 
4344
+ // src/features/skills/rulesync-skill.ts
4345
+ var RulesyncSkillFrontmatterSchemaInternal = z19.object({
4346
+ name: z19.string(),
4347
+ description: z19.string(),
4348
+ targets: z19._default(RulesyncTargetsSchema, ["*"]),
4349
+ claudecode: z19.optional(
4350
+ z19.object({
4351
+ "allowed-tools": z19.optional(z19.array(z19.string()))
4352
+ })
4353
+ )
4354
+ });
4355
+ var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
4356
+ var RulesyncSkill = class _RulesyncSkill extends AiDir {
4357
+ constructor({
4358
+ baseDir = process.cwd(),
4359
+ relativeDirPath = RULESYNC_SKILLS_RELATIVE_DIR_PATH,
4360
+ dirName,
4361
+ frontmatter,
4362
+ body,
4363
+ otherFiles = [],
4364
+ validate = true,
4365
+ global = false
4366
+ }) {
4367
+ super({
4368
+ baseDir,
4369
+ relativeDirPath,
4370
+ dirName,
4371
+ mainFile: {
4372
+ name: SKILL_FILE_NAME,
4373
+ body,
4374
+ frontmatter: { ...frontmatter }
4375
+ },
4376
+ otherFiles,
4377
+ global
4378
+ });
4379
+ if (validate) {
4380
+ const result = this.validate();
4381
+ if (!result.success) {
4382
+ throw result.error;
4383
+ }
4384
+ }
4385
+ }
4386
+ static getSettablePaths() {
4387
+ return {
4388
+ relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH
4389
+ };
4390
+ }
4391
+ getFrontmatter() {
4392
+ if (!this.mainFile?.frontmatter) {
4393
+ throw new Error("Frontmatter is not defined");
4394
+ }
4395
+ const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
4396
+ return result;
4397
+ }
4398
+ getBody() {
4399
+ return this.mainFile?.body ?? "";
4400
+ }
4401
+ validate() {
4402
+ const result = RulesyncSkillFrontmatterSchema.safeParse(this.mainFile?.frontmatter);
4403
+ if (!result.success) {
4404
+ return {
4405
+ success: false,
4406
+ error: new Error(
4407
+ `Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
4408
+ )
4409
+ };
4410
+ }
4411
+ return { success: true, error: null };
4412
+ }
4413
+ static async fromDir({
4414
+ baseDir = process.cwd(),
4415
+ relativeDirPath = RULESYNC_SKILLS_RELATIVE_DIR_PATH,
4416
+ dirName,
4417
+ global = false
4418
+ }) {
4419
+ const skillDirPath = join40(baseDir, relativeDirPath, dirName);
4420
+ const skillFilePath = join40(skillDirPath, SKILL_FILE_NAME);
4421
+ if (!await fileExists(skillFilePath)) {
4422
+ throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
4423
+ }
4424
+ const fileContent = await readFileContent(skillFilePath);
4425
+ const { frontmatter, body: content } = parseFrontmatter(fileContent);
4426
+ const result = RulesyncSkillFrontmatterSchema.safeParse(frontmatter);
4427
+ if (!result.success) {
4428
+ throw new Error(`Invalid frontmatter in ${skillFilePath}: ${formatError(result.error)}`);
4429
+ }
4430
+ const otherFiles = await this.collectOtherFiles(
4431
+ baseDir,
4432
+ relativeDirPath,
4433
+ dirName,
4434
+ SKILL_FILE_NAME
4435
+ );
4436
+ return new _RulesyncSkill({
4437
+ baseDir,
4438
+ relativeDirPath,
4439
+ dirName,
4440
+ frontmatter: result.data,
4441
+ body: content.trim(),
4442
+ otherFiles,
4443
+ validate: true,
4444
+ global
4445
+ });
4446
+ }
4447
+ };
4448
+
4343
4449
  // src/features/skills/tool-skill.ts
4450
+ import { join as join41 } from "path";
4344
4451
  var ToolSkill = class extends AiDir {
4345
4452
  /**
4346
4453
  * Get the settable paths for this tool's skill directories.
@@ -4394,12 +4501,200 @@ var ToolSkill = class extends AiDir {
4394
4501
  static isTargetedByRulesyncSkill(_rulesyncSkill) {
4395
4502
  throw new Error("Please implement this method in the subclass.");
4396
4503
  }
4504
+ /**
4505
+ * Load and parse skill directory content.
4506
+ * This is a helper method that handles the common logic of reading SKILL.md,
4507
+ * parsing frontmatter, and collecting other files.
4508
+ *
4509
+ * Subclasses should call this method and then validate the frontmatter
4510
+ * against their specific schema.
4511
+ *
4512
+ * @param params - Parameters including settablePaths callback to get tool-specific paths
4513
+ * @returns Parsed skill directory content
4514
+ */
4515
+ static async loadSkillDirContent({
4516
+ baseDir = process.cwd(),
4517
+ relativeDirPath,
4518
+ dirName,
4519
+ global = false,
4520
+ getSettablePaths
4521
+ }) {
4522
+ const settablePaths = getSettablePaths({ global });
4523
+ const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
4524
+ const skillDirPath = join41(baseDir, actualRelativeDirPath, dirName);
4525
+ const skillFilePath = join41(skillDirPath, SKILL_FILE_NAME);
4526
+ if (!await fileExists(skillFilePath)) {
4527
+ throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
4528
+ }
4529
+ const fileContent = await readFileContent(skillFilePath);
4530
+ const { frontmatter, body: content } = parseFrontmatter(fileContent);
4531
+ const otherFiles = await this.collectOtherFiles(
4532
+ baseDir,
4533
+ actualRelativeDirPath,
4534
+ dirName,
4535
+ SKILL_FILE_NAME
4536
+ );
4537
+ return {
4538
+ baseDir,
4539
+ relativeDirPath: actualRelativeDirPath,
4540
+ dirName,
4541
+ frontmatter,
4542
+ body: content.trim(),
4543
+ otherFiles,
4544
+ global
4545
+ };
4546
+ }
4397
4547
  };
4398
4548
 
4549
+ // src/features/skills/codexcli-skill.ts
4550
+ var CodexCliSkillFrontmatterSchema = z20.object({
4551
+ name: z20.string(),
4552
+ description: z20.string()
4553
+ });
4554
+ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
4555
+ constructor({
4556
+ baseDir = process.cwd(),
4557
+ relativeDirPath = join42(".codex", "skills"),
4558
+ dirName,
4559
+ frontmatter,
4560
+ body,
4561
+ otherFiles = [],
4562
+ validate = true,
4563
+ global = false
4564
+ }) {
4565
+ super({
4566
+ baseDir,
4567
+ relativeDirPath,
4568
+ dirName,
4569
+ mainFile: {
4570
+ name: SKILL_FILE_NAME,
4571
+ body,
4572
+ frontmatter: { ...frontmatter }
4573
+ },
4574
+ otherFiles,
4575
+ global
4576
+ });
4577
+ if (validate) {
4578
+ const result = this.validate();
4579
+ if (!result.success) {
4580
+ throw result.error;
4581
+ }
4582
+ }
4583
+ }
4584
+ static getSettablePaths({ global = false } = {}) {
4585
+ if (!global) {
4586
+ throw new Error("CodexCliSkill only supports global mode. Please pass { global: true }.");
4587
+ }
4588
+ return {
4589
+ relativeDirPath: join42(".codex", "skills")
4590
+ };
4591
+ }
4592
+ getFrontmatter() {
4593
+ if (!this.mainFile?.frontmatter) {
4594
+ throw new Error("Frontmatter is not defined");
4595
+ }
4596
+ const result = CodexCliSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
4597
+ return result;
4598
+ }
4599
+ getBody() {
4600
+ return this.mainFile?.body ?? "";
4601
+ }
4602
+ validate() {
4603
+ if (!this.mainFile) {
4604
+ return {
4605
+ success: false,
4606
+ error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
4607
+ };
4608
+ }
4609
+ const result = CodexCliSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
4610
+ if (!result.success) {
4611
+ return {
4612
+ success: false,
4613
+ error: new Error(
4614
+ `Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
4615
+ )
4616
+ };
4617
+ }
4618
+ return { success: true, error: null };
4619
+ }
4620
+ toRulesyncSkill() {
4621
+ const frontmatter = this.getFrontmatter();
4622
+ const rulesyncFrontmatter = {
4623
+ name: frontmatter.name,
4624
+ description: frontmatter.description,
4625
+ targets: ["*"]
4626
+ };
4627
+ return new RulesyncSkill({
4628
+ baseDir: this.baseDir,
4629
+ relativeDirPath: this.relativeDirPath,
4630
+ dirName: this.getDirName(),
4631
+ frontmatter: rulesyncFrontmatter,
4632
+ body: this.getBody(),
4633
+ otherFiles: this.getOtherFiles(),
4634
+ validate: true,
4635
+ global: this.global
4636
+ });
4637
+ }
4638
+ static fromRulesyncSkill({
4639
+ rulesyncSkill,
4640
+ validate = true,
4641
+ global = false
4642
+ }) {
4643
+ const settablePaths = _CodexCliSkill.getSettablePaths({ global });
4644
+ const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
4645
+ const codexFrontmatter = {
4646
+ name: rulesyncFrontmatter.name,
4647
+ description: rulesyncFrontmatter.description
4648
+ };
4649
+ return new _CodexCliSkill({
4650
+ baseDir: rulesyncSkill.getBaseDir(),
4651
+ relativeDirPath: settablePaths.relativeDirPath,
4652
+ dirName: rulesyncSkill.getDirName(),
4653
+ frontmatter: codexFrontmatter,
4654
+ body: rulesyncSkill.getBody(),
4655
+ otherFiles: rulesyncSkill.getOtherFiles(),
4656
+ validate,
4657
+ global
4658
+ });
4659
+ }
4660
+ static isTargetedByRulesyncSkill(rulesyncSkill) {
4661
+ const targets = rulesyncSkill.getFrontmatter().targets;
4662
+ return targets.includes("*") || targets.includes("codexcli");
4663
+ }
4664
+ static async fromDir(params) {
4665
+ const loaded = await this.loadSkillDirContent({
4666
+ ...params,
4667
+ getSettablePaths: _CodexCliSkill.getSettablePaths
4668
+ });
4669
+ const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
4670
+ if (!result.success) {
4671
+ const skillDirPath = join42(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
4672
+ throw new Error(
4673
+ `Invalid frontmatter in ${join42(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
4674
+ );
4675
+ }
4676
+ return new _CodexCliSkill({
4677
+ baseDir: loaded.baseDir,
4678
+ relativeDirPath: loaded.relativeDirPath,
4679
+ dirName: loaded.dirName,
4680
+ frontmatter: result.data,
4681
+ body: loaded.body,
4682
+ otherFiles: loaded.otherFiles,
4683
+ validate: true,
4684
+ global: loaded.global
4685
+ });
4686
+ }
4687
+ };
4688
+
4689
+ // src/features/skills/copilot-skill.ts
4690
+ import { join as join44 } from "path";
4691
+
4399
4692
  // src/features/skills/simulated-skill.ts
4400
- var SimulatedSkillFrontmatterSchema = z19.object({
4401
- name: z19.string(),
4402
- description: z19.string()
4693
+ import { join as join43 } from "path";
4694
+ import { z as z21 } from "zod/mini";
4695
+ var SimulatedSkillFrontmatterSchema = z21.object({
4696
+ name: z21.string(),
4697
+ description: z21.string()
4403
4698
  });
4404
4699
  var SimulatedSkill = class extends ToolSkill {
4405
4700
  frontmatter;
@@ -4430,7 +4725,7 @@ var SimulatedSkill = class extends ToolSkill {
4430
4725
  const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
4431
4726
  if (!result.success) {
4432
4727
  throw new Error(
4433
- `Invalid frontmatter in ${join40(relativeDirPath, dirName)}: ${formatError(result.error)}`
4728
+ `Invalid frontmatter in ${join43(relativeDirPath, dirName)}: ${formatError(result.error)}`
4434
4729
  );
4435
4730
  }
4436
4731
  }
@@ -4488,8 +4783,8 @@ var SimulatedSkill = class extends ToolSkill {
4488
4783
  }) {
4489
4784
  const settablePaths = this.getSettablePaths();
4490
4785
  const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
4491
- const skillDirPath = join40(baseDir, actualRelativeDirPath, dirName);
4492
- const skillFilePath = join40(skillDirPath, SKILL_FILE_NAME);
4786
+ const skillDirPath = join43(baseDir, actualRelativeDirPath, dirName);
4787
+ const skillFilePath = join43(skillDirPath, SKILL_FILE_NAME);
4493
4788
  if (!await fileExists(skillFilePath)) {
4494
4789
  throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
4495
4790
  }
@@ -4539,44 +4834,14 @@ var SimulatedSkill = class extends ToolSkill {
4539
4834
  }
4540
4835
  };
4541
4836
 
4542
- // src/features/skills/codexcli-skill.ts
4543
- var CodexCliSkill = class _CodexCliSkill extends SimulatedSkill {
4544
- static getSettablePaths(options) {
4545
- if (options?.global) {
4546
- throw new Error("CodexCliSkill does not support global mode.");
4547
- }
4548
- return {
4549
- relativeDirPath: join41(".codex", "skills")
4550
- };
4551
- }
4552
- static async fromDir(params) {
4553
- const baseParams = await this.fromDirDefault(params);
4554
- return new _CodexCliSkill(baseParams);
4555
- }
4556
- static fromRulesyncSkill(params) {
4557
- const baseParams = {
4558
- ...this.fromRulesyncSkillDefault(params),
4559
- relativeDirPath: this.getSettablePaths().relativeDirPath
4560
- };
4561
- return new _CodexCliSkill(baseParams);
4562
- }
4563
- static isTargetedByRulesyncSkill(rulesyncSkill) {
4564
- return this.isTargetedByRulesyncSkillDefault({
4565
- rulesyncSkill,
4566
- toolTarget: "codexcli"
4567
- });
4568
- }
4569
- };
4570
-
4571
4837
  // src/features/skills/copilot-skill.ts
4572
- import { join as join42 } from "path";
4573
4838
  var CopilotSkill = class _CopilotSkill extends SimulatedSkill {
4574
4839
  static getSettablePaths(options) {
4575
4840
  if (options?.global) {
4576
4841
  throw new Error("CopilotSkill does not support global mode.");
4577
4842
  }
4578
4843
  return {
4579
- relativeDirPath: join42(".github", "skills")
4844
+ relativeDirPath: join44(".github", "skills")
4580
4845
  };
4581
4846
  }
4582
4847
  static async fromDir(params) {
@@ -4599,14 +4864,14 @@ var CopilotSkill = class _CopilotSkill extends SimulatedSkill {
4599
4864
  };
4600
4865
 
4601
4866
  // src/features/skills/cursor-skill.ts
4602
- import { join as join43 } from "path";
4867
+ import { join as join45 } from "path";
4603
4868
  var CursorSkill = class _CursorSkill extends SimulatedSkill {
4604
4869
  static getSettablePaths(options) {
4605
4870
  if (options?.global) {
4606
4871
  throw new Error("CursorSkill does not support global mode.");
4607
4872
  }
4608
4873
  return {
4609
- relativeDirPath: join43(".cursor", "skills")
4874
+ relativeDirPath: join45(".cursor", "skills")
4610
4875
  };
4611
4876
  }
4612
4877
  static async fromDir(params) {
@@ -4629,11 +4894,11 @@ var CursorSkill = class _CursorSkill extends SimulatedSkill {
4629
4894
  };
4630
4895
 
4631
4896
  // src/features/skills/skills-processor.ts
4632
- import { basename as basename15, join as join49 } from "path";
4633
- import { z as z22 } from "zod/mini";
4897
+ import { basename as basename15, join as join50 } from "path";
4898
+ import { z as z23 } from "zod/mini";
4634
4899
 
4635
4900
  // src/types/dir-feature-processor.ts
4636
- import { join as join44 } from "path";
4901
+ import { join as join46 } from "path";
4637
4902
  var DirFeatureProcessor = class {
4638
4903
  baseDir;
4639
4904
  constructor({ baseDir = process.cwd() }) {
@@ -4655,178 +4920,69 @@ var DirFeatureProcessor = class {
4655
4920
  await ensureDir(dirPath);
4656
4921
  const mainFile = aiDir.getMainFile();
4657
4922
  if (mainFile) {
4658
- const mainFilePath = join44(dirPath, mainFile.name);
4923
+ const mainFilePath = join46(dirPath, mainFile.name);
4659
4924
  const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
4660
4925
  const contentWithNewline = addTrailingNewline(content);
4661
4926
  await writeFileContent(mainFilePath, contentWithNewline);
4662
4927
  }
4663
4928
  const otherFiles = aiDir.getOtherFiles();
4664
- for (const file of otherFiles) {
4665
- const filePath = join44(dirPath, file.relativeFilePathToDirPath);
4666
- const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
4667
- await writeFileContent(filePath, contentWithNewline);
4668
- }
4669
- }
4670
- return aiDirs.length;
4671
- }
4672
- async removeAiDirs(aiDirs) {
4673
- for (const aiDir of aiDirs) {
4674
- await removeDirectory(aiDir.getDirPath());
4675
- }
4676
- }
4677
- };
4678
-
4679
- // src/features/skills/agentsmd-skill.ts
4680
- import { join as join45 } from "path";
4681
- var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
4682
- static getSettablePaths(options) {
4683
- if (options?.global) {
4684
- throw new Error("AgentsmdSkill does not support global mode.");
4685
- }
4686
- return {
4687
- relativeDirPath: join45(".agents", "skills")
4688
- };
4689
- }
4690
- static async fromDir(params) {
4691
- const baseParams = await this.fromDirDefault(params);
4692
- return new _AgentsmdSkill(baseParams);
4693
- }
4694
- static fromRulesyncSkill(params) {
4695
- const baseParams = {
4696
- ...this.fromRulesyncSkillDefault(params),
4697
- relativeDirPath: this.getSettablePaths().relativeDirPath
4698
- };
4699
- return new _AgentsmdSkill(baseParams);
4700
- }
4701
- static isTargetedByRulesyncSkill(rulesyncSkill) {
4702
- return this.isTargetedByRulesyncSkillDefault({
4703
- rulesyncSkill,
4704
- toolTarget: "agentsmd"
4705
- });
4706
- }
4707
- };
4708
-
4709
- // src/features/skills/claudecode-skill.ts
4710
- import { join as join47 } from "path";
4711
- import { z as z21 } from "zod/mini";
4712
-
4713
- // src/features/skills/rulesync-skill.ts
4714
- import { join as join46 } from "path";
4715
- import { z as z20 } from "zod/mini";
4716
- var RulesyncSkillFrontmatterSchemaInternal = z20.object({
4717
- name: z20.string(),
4718
- description: z20.string(),
4719
- targets: z20._default(RulesyncTargetsSchema, ["*"]),
4720
- claudecode: z20.optional(
4721
- z20.object({
4722
- "allowed-tools": z20.optional(z20.array(z20.string()))
4723
- })
4724
- )
4725
- });
4726
- var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
4727
- var RulesyncSkill = class _RulesyncSkill extends AiDir {
4728
- constructor({
4729
- baseDir = process.cwd(),
4730
- relativeDirPath = RULESYNC_SKILLS_RELATIVE_DIR_PATH,
4731
- dirName,
4732
- frontmatter,
4733
- body,
4734
- otherFiles = [],
4735
- validate = true,
4736
- global = false
4737
- }) {
4738
- super({
4739
- baseDir,
4740
- relativeDirPath,
4741
- dirName,
4742
- mainFile: {
4743
- name: SKILL_FILE_NAME,
4744
- body,
4745
- frontmatter: { ...frontmatter }
4746
- },
4747
- otherFiles,
4748
- global
4749
- });
4750
- if (validate) {
4751
- const result = this.validate();
4752
- if (!result.success) {
4753
- throw result.error;
4929
+ for (const file of otherFiles) {
4930
+ const filePath = join46(dirPath, file.relativeFilePathToDirPath);
4931
+ const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
4932
+ await writeFileContent(filePath, contentWithNewline);
4754
4933
  }
4755
4934
  }
4935
+ return aiDirs.length;
4756
4936
  }
4757
- static getSettablePaths() {
4758
- return {
4759
- relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH
4760
- };
4937
+ async removeAiDirs(aiDirs) {
4938
+ for (const aiDir of aiDirs) {
4939
+ await removeDirectory(aiDir.getDirPath());
4940
+ }
4761
4941
  }
4762
- getFrontmatter() {
4763
- if (!this.mainFile?.frontmatter) {
4764
- throw new Error("Frontmatter is not defined");
4942
+ };
4943
+
4944
+ // src/features/skills/agentsmd-skill.ts
4945
+ import { join as join47 } from "path";
4946
+ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
4947
+ static getSettablePaths(options) {
4948
+ if (options?.global) {
4949
+ throw new Error("AgentsmdSkill does not support global mode.");
4765
4950
  }
4766
- const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
4767
- return result;
4951
+ return {
4952
+ relativeDirPath: join47(".agents", "skills")
4953
+ };
4768
4954
  }
4769
- getBody() {
4770
- return this.mainFile?.body ?? "";
4955
+ static async fromDir(params) {
4956
+ const baseParams = await this.fromDirDefault(params);
4957
+ return new _AgentsmdSkill(baseParams);
4771
4958
  }
4772
- validate() {
4773
- const result = RulesyncSkillFrontmatterSchema.safeParse(this.mainFile?.frontmatter);
4774
- if (!result.success) {
4775
- return {
4776
- success: false,
4777
- error: new Error(
4778
- `Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
4779
- )
4780
- };
4781
- }
4782
- return { success: true, error: null };
4959
+ static fromRulesyncSkill(params) {
4960
+ const baseParams = {
4961
+ ...this.fromRulesyncSkillDefault(params),
4962
+ relativeDirPath: this.getSettablePaths().relativeDirPath
4963
+ };
4964
+ return new _AgentsmdSkill(baseParams);
4783
4965
  }
4784
- static async fromDir({
4785
- baseDir = process.cwd(),
4786
- relativeDirPath = RULESYNC_SKILLS_RELATIVE_DIR_PATH,
4787
- dirName,
4788
- global = false
4789
- }) {
4790
- const skillDirPath = join46(baseDir, relativeDirPath, dirName);
4791
- const skillFilePath = join46(skillDirPath, SKILL_FILE_NAME);
4792
- if (!await fileExists(skillFilePath)) {
4793
- throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
4794
- }
4795
- const fileContent = await readFileContent(skillFilePath);
4796
- const { frontmatter, body: content } = parseFrontmatter(fileContent);
4797
- const result = RulesyncSkillFrontmatterSchema.safeParse(frontmatter);
4798
- if (!result.success) {
4799
- throw new Error(`Invalid frontmatter in ${skillFilePath}: ${formatError(result.error)}`);
4800
- }
4801
- const otherFiles = await this.collectOtherFiles(
4802
- baseDir,
4803
- relativeDirPath,
4804
- dirName,
4805
- SKILL_FILE_NAME
4806
- );
4807
- return new _RulesyncSkill({
4808
- baseDir,
4809
- relativeDirPath,
4810
- dirName,
4811
- frontmatter: result.data,
4812
- body: content.trim(),
4813
- otherFiles,
4814
- validate: true,
4815
- global
4966
+ static isTargetedByRulesyncSkill(rulesyncSkill) {
4967
+ return this.isTargetedByRulesyncSkillDefault({
4968
+ rulesyncSkill,
4969
+ toolTarget: "agentsmd"
4816
4970
  });
4817
4971
  }
4818
4972
  };
4819
4973
 
4820
4974
  // src/features/skills/claudecode-skill.ts
4821
- var ClaudecodeSkillFrontmatterSchema = z21.object({
4822
- name: z21.string(),
4823
- description: z21.string(),
4824
- "allowed-tools": z21.optional(z21.array(z21.string()))
4975
+ import { join as join48 } from "path";
4976
+ import { z as z22 } from "zod/mini";
4977
+ var ClaudecodeSkillFrontmatterSchema = z22.object({
4978
+ name: z22.string(),
4979
+ description: z22.string(),
4980
+ "allowed-tools": z22.optional(z22.array(z22.string()))
4825
4981
  });
4826
4982
  var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
4827
4983
  constructor({
4828
4984
  baseDir = process.cwd(),
4829
- relativeDirPath = join47(".claude", "skills"),
4985
+ relativeDirPath = join48(".claude", "skills"),
4830
4986
  dirName,
4831
4987
  frontmatter,
4832
4988
  body,
@@ -4857,7 +5013,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
4857
5013
  global: _global = false
4858
5014
  } = {}) {
4859
5015
  return {
4860
- relativeDirPath: join47(".claude", "skills")
5016
+ relativeDirPath: join48(".claude", "skills")
4861
5017
  };
4862
5018
  }
4863
5019
  getFrontmatter() {
@@ -4937,53 +5093,40 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
4937
5093
  static isTargetedByRulesyncSkill(_rulesyncSkill) {
4938
5094
  return true;
4939
5095
  }
4940
- static async fromDir({
4941
- baseDir = process.cwd(),
4942
- relativeDirPath,
4943
- dirName,
4944
- global = false
4945
- }) {
4946
- const settablePaths = this.getSettablePaths({ global });
4947
- const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
4948
- const skillDirPath = join47(baseDir, actualRelativeDirPath, dirName);
4949
- const skillFilePath = join47(skillDirPath, SKILL_FILE_NAME);
4950
- if (!await fileExists(skillFilePath)) {
4951
- throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
4952
- }
4953
- const fileContent = await readFileContent(skillFilePath);
4954
- const { frontmatter, body: content } = parseFrontmatter(fileContent);
4955
- const result = ClaudecodeSkillFrontmatterSchema.safeParse(frontmatter);
5096
+ static async fromDir(params) {
5097
+ const loaded = await this.loadSkillDirContent({
5098
+ ...params,
5099
+ getSettablePaths: _ClaudecodeSkill.getSettablePaths
5100
+ });
5101
+ const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
4956
5102
  if (!result.success) {
4957
- throw new Error(`Invalid frontmatter in ${skillFilePath}: ${formatError(result.error)}`);
5103
+ const skillDirPath = join48(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
5104
+ throw new Error(
5105
+ `Invalid frontmatter in ${join48(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
5106
+ );
4958
5107
  }
4959
- const otherFiles = await this.collectOtherFiles(
4960
- baseDir,
4961
- actualRelativeDirPath,
4962
- dirName,
4963
- SKILL_FILE_NAME
4964
- );
4965
5108
  return new _ClaudecodeSkill({
4966
- baseDir,
4967
- relativeDirPath: actualRelativeDirPath,
4968
- dirName,
5109
+ baseDir: loaded.baseDir,
5110
+ relativeDirPath: loaded.relativeDirPath,
5111
+ dirName: loaded.dirName,
4969
5112
  frontmatter: result.data,
4970
- body: content.trim(),
4971
- otherFiles,
5113
+ body: loaded.body,
5114
+ otherFiles: loaded.otherFiles,
4972
5115
  validate: true,
4973
- global
5116
+ global: loaded.global
4974
5117
  });
4975
5118
  }
4976
5119
  };
4977
5120
 
4978
5121
  // src/features/skills/geminicli-skill.ts
4979
- import { join as join48 } from "path";
5122
+ import { join as join49 } from "path";
4980
5123
  var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
4981
5124
  static getSettablePaths(options) {
4982
5125
  if (options?.global) {
4983
5126
  throw new Error("GeminiCliSkill does not support global mode.");
4984
5127
  }
4985
5128
  return {
4986
- relativeDirPath: join48(".gemini", "skills")
5129
+ relativeDirPath: join49(".gemini", "skills")
4987
5130
  };
4988
5131
  }
4989
5132
  static async fromDir(params) {
@@ -5014,19 +5157,49 @@ var skillsProcessorToolTargetTuple = [
5014
5157
  "cursor",
5015
5158
  "geminicli"
5016
5159
  ];
5017
- var SkillsProcessorToolTargetSchema = z22.enum(skillsProcessorToolTargetTuple);
5160
+ var SkillsProcessorToolTargetSchema = z23.enum(skillsProcessorToolTargetTuple);
5018
5161
  var toolSkillFactories = /* @__PURE__ */ new Map([
5019
- ["agentsmd", { class: AgentsmdSkill, meta: { supportsSimulated: true, supportsGlobal: false } }],
5162
+ [
5163
+ "agentsmd",
5164
+ {
5165
+ class: AgentsmdSkill,
5166
+ meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
5167
+ }
5168
+ ],
5020
5169
  [
5021
5170
  "claudecode",
5022
- { class: ClaudecodeSkill, meta: { supportsSimulated: false, supportsGlobal: true } }
5171
+ {
5172
+ class: ClaudecodeSkill,
5173
+ meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
5174
+ }
5175
+ ],
5176
+ [
5177
+ "codexcli",
5178
+ {
5179
+ class: CodexCliSkill,
5180
+ meta: { supportsProject: false, supportsSimulated: false, supportsGlobal: true }
5181
+ }
5182
+ ],
5183
+ [
5184
+ "copilot",
5185
+ {
5186
+ class: CopilotSkill,
5187
+ meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
5188
+ }
5189
+ ],
5190
+ [
5191
+ "cursor",
5192
+ {
5193
+ class: CursorSkill,
5194
+ meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
5195
+ }
5023
5196
  ],
5024
- ["codexcli", { class: CodexCliSkill, meta: { supportsSimulated: true, supportsGlobal: false } }],
5025
- ["copilot", { class: CopilotSkill, meta: { supportsSimulated: true, supportsGlobal: false } }],
5026
- ["cursor", { class: CursorSkill, meta: { supportsSimulated: true, supportsGlobal: false } }],
5027
5197
  [
5028
5198
  "geminicli",
5029
- { class: GeminiCliSkill, meta: { supportsSimulated: true, supportsGlobal: false } }
5199
+ {
5200
+ class: GeminiCliSkill,
5201
+ meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
5202
+ }
5030
5203
  ]
5031
5204
  ]);
5032
5205
  var defaultGetFactory4 = (target) => {
@@ -5037,7 +5210,10 @@ var defaultGetFactory4 = (target) => {
5037
5210
  return factory;
5038
5211
  };
5039
5212
  var allToolTargetKeys3 = [...toolSkillFactories.keys()];
5040
- var skillsProcessorToolTargets = allToolTargetKeys3;
5213
+ var skillsProcessorToolTargetsProject = allToolTargetKeys3.filter((target) => {
5214
+ const factory = toolSkillFactories.get(target);
5215
+ return factory?.meta.supportsProject ?? true;
5216
+ });
5041
5217
  var skillsProcessorToolTargetsSimulated = allToolTargetKeys3.filter(
5042
5218
  (target) => {
5043
5219
  const factory = toolSkillFactories.get(target);
@@ -5103,8 +5279,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
5103
5279
  */
5104
5280
  async loadRulesyncDirs() {
5105
5281
  const paths = RulesyncSkill.getSettablePaths();
5106
- const rulesyncSkillsDirPath = join49(this.baseDir, paths.relativeDirPath);
5107
- const dirPaths = await findFilesByGlobs(join49(rulesyncSkillsDirPath, "*"), { type: "dir" });
5282
+ const rulesyncSkillsDirPath = join50(this.baseDir, paths.relativeDirPath);
5283
+ const dirPaths = await findFilesByGlobs(join50(rulesyncSkillsDirPath, "*"), { type: "dir" });
5108
5284
  const dirNames = dirPaths.map((path3) => basename15(path3));
5109
5285
  const rulesyncSkills = await Promise.all(
5110
5286
  dirNames.map(
@@ -5121,8 +5297,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
5121
5297
  async loadToolDirs() {
5122
5298
  const factory = this.getFactory(this.toolTarget);
5123
5299
  const paths = factory.class.getSettablePaths({ global: this.global });
5124
- const skillsDirPath = join49(this.baseDir, paths.relativeDirPath);
5125
- const dirPaths = await findFilesByGlobs(join49(skillsDirPath, "*"), { type: "dir" });
5300
+ const skillsDirPath = join50(this.baseDir, paths.relativeDirPath);
5301
+ const dirPaths = await findFilesByGlobs(join50(skillsDirPath, "*"), { type: "dir" });
5126
5302
  const dirNames = dirPaths.map((path3) => basename15(path3));
5127
5303
  const toolSkills = await Promise.all(
5128
5304
  dirNames.map(
@@ -5150,12 +5326,13 @@ var SkillsProcessor = class extends DirFeatureProcessor {
5150
5326
  if (global) {
5151
5327
  return skillsProcessorToolTargetsGlobal;
5152
5328
  }
5329
+ const projectTargets = skillsProcessorToolTargetsProject;
5153
5330
  if (!includeSimulated) {
5154
- return skillsProcessorToolTargets.filter(
5331
+ return projectTargets.filter(
5155
5332
  (target) => !skillsProcessorToolTargetsSimulated.includes(target)
5156
5333
  );
5157
5334
  }
5158
- return skillsProcessorToolTargets;
5335
+ return projectTargets;
5159
5336
  }
5160
5337
  /**
5161
5338
  * Return the simulated tool targets
@@ -5172,11 +5349,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
5172
5349
  };
5173
5350
 
5174
5351
  // src/features/subagents/agentsmd-subagent.ts
5175
- import { join as join51 } from "path";
5352
+ import { join as join52 } from "path";
5176
5353
 
5177
5354
  // src/features/subagents/simulated-subagent.ts
5178
- import { basename as basename16, join as join50 } from "path";
5179
- import { z as z23 } from "zod/mini";
5355
+ import { basename as basename16, join as join51 } from "path";
5356
+ import { z as z24 } from "zod/mini";
5180
5357
 
5181
5358
  // src/features/subagents/tool-subagent.ts
5182
5359
  var ToolSubagent = class extends ToolFile {
@@ -5211,9 +5388,9 @@ var ToolSubagent = class extends ToolFile {
5211
5388
  };
5212
5389
 
5213
5390
  // src/features/subagents/simulated-subagent.ts
5214
- var SimulatedSubagentFrontmatterSchema = z23.object({
5215
- name: z23.string(),
5216
- description: z23.string()
5391
+ var SimulatedSubagentFrontmatterSchema = z24.object({
5392
+ name: z24.string(),
5393
+ description: z24.string()
5217
5394
  });
5218
5395
  var SimulatedSubagent = class extends ToolSubagent {
5219
5396
  frontmatter;
@@ -5223,7 +5400,7 @@ var SimulatedSubagent = class extends ToolSubagent {
5223
5400
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
5224
5401
  if (!result.success) {
5225
5402
  throw new Error(
5226
- `Invalid frontmatter in ${join50(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5403
+ `Invalid frontmatter in ${join51(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5227
5404
  );
5228
5405
  }
5229
5406
  }
@@ -5274,7 +5451,7 @@ var SimulatedSubagent = class extends ToolSubagent {
5274
5451
  return {
5275
5452
  success: false,
5276
5453
  error: new Error(
5277
- `Invalid frontmatter in ${join50(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5454
+ `Invalid frontmatter in ${join51(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5278
5455
  )
5279
5456
  };
5280
5457
  }
@@ -5284,7 +5461,7 @@ var SimulatedSubagent = class extends ToolSubagent {
5284
5461
  relativeFilePath,
5285
5462
  validate = true
5286
5463
  }) {
5287
- const filePath = join50(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
5464
+ const filePath = join51(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
5288
5465
  const fileContent = await readFileContent(filePath);
5289
5466
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
5290
5467
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -5306,7 +5483,7 @@ var SimulatedSubagent = class extends ToolSubagent {
5306
5483
  var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
5307
5484
  static getSettablePaths() {
5308
5485
  return {
5309
- relativeDirPath: join51(".agents", "subagents")
5486
+ relativeDirPath: join52(".agents", "subagents")
5310
5487
  };
5311
5488
  }
5312
5489
  static async fromFile(params) {
@@ -5326,11 +5503,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
5326
5503
  };
5327
5504
 
5328
5505
  // src/features/subagents/codexcli-subagent.ts
5329
- import { join as join52 } from "path";
5506
+ import { join as join53 } from "path";
5330
5507
  var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
5331
5508
  static getSettablePaths() {
5332
5509
  return {
5333
- relativeDirPath: join52(".codex", "subagents")
5510
+ relativeDirPath: join53(".codex", "subagents")
5334
5511
  };
5335
5512
  }
5336
5513
  static async fromFile(params) {
@@ -5350,11 +5527,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
5350
5527
  };
5351
5528
 
5352
5529
  // src/features/subagents/copilot-subagent.ts
5353
- import { join as join53 } from "path";
5530
+ import { join as join54 } from "path";
5354
5531
  var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
5355
5532
  static getSettablePaths() {
5356
5533
  return {
5357
- relativeDirPath: join53(".github", "subagents")
5534
+ relativeDirPath: join54(".github", "subagents")
5358
5535
  };
5359
5536
  }
5360
5537
  static async fromFile(params) {
@@ -5374,11 +5551,11 @@ var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
5374
5551
  };
5375
5552
 
5376
5553
  // src/features/subagents/cursor-subagent.ts
5377
- import { join as join54 } from "path";
5554
+ import { join as join55 } from "path";
5378
5555
  var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
5379
5556
  static getSettablePaths() {
5380
5557
  return {
5381
- relativeDirPath: join54(".cursor", "subagents")
5558
+ relativeDirPath: join55(".cursor", "subagents")
5382
5559
  };
5383
5560
  }
5384
5561
  static async fromFile(params) {
@@ -5398,11 +5575,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
5398
5575
  };
5399
5576
 
5400
5577
  // src/features/subagents/geminicli-subagent.ts
5401
- import { join as join55 } from "path";
5578
+ import { join as join56 } from "path";
5402
5579
  var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
5403
5580
  static getSettablePaths() {
5404
5581
  return {
5405
- relativeDirPath: join55(".gemini", "subagents")
5582
+ relativeDirPath: join56(".gemini", "subagents")
5406
5583
  };
5407
5584
  }
5408
5585
  static async fromFile(params) {
@@ -5422,11 +5599,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
5422
5599
  };
5423
5600
 
5424
5601
  // src/features/subagents/roo-subagent.ts
5425
- import { join as join56 } from "path";
5602
+ import { join as join57 } from "path";
5426
5603
  var RooSubagent = class _RooSubagent extends SimulatedSubagent {
5427
5604
  static getSettablePaths() {
5428
5605
  return {
5429
- relativeDirPath: join56(".roo", "subagents")
5606
+ relativeDirPath: join57(".roo", "subagents")
5430
5607
  };
5431
5608
  }
5432
5609
  static async fromFile(params) {
@@ -5446,20 +5623,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
5446
5623
  };
5447
5624
 
5448
5625
  // src/features/subagents/subagents-processor.ts
5449
- import { basename as basename18, join as join59 } from "path";
5450
- import { z as z26 } from "zod/mini";
5626
+ import { basename as basename18, join as join60 } from "path";
5627
+ import { z as z27 } from "zod/mini";
5451
5628
 
5452
5629
  // src/features/subagents/claudecode-subagent.ts
5453
- import { join as join58 } from "path";
5454
- import { z as z25 } from "zod/mini";
5630
+ import { join as join59 } from "path";
5631
+ import { z as z26 } from "zod/mini";
5455
5632
 
5456
5633
  // src/features/subagents/rulesync-subagent.ts
5457
- import { basename as basename17, join as join57 } from "path";
5458
- import { z as z24 } from "zod/mini";
5459
- var RulesyncSubagentFrontmatterSchema = z24.looseObject({
5634
+ import { basename as basename17, join as join58 } from "path";
5635
+ import { z as z25 } from "zod/mini";
5636
+ var RulesyncSubagentFrontmatterSchema = z25.looseObject({
5460
5637
  targets: RulesyncTargetsSchema,
5461
- name: z24.string(),
5462
- description: z24.string()
5638
+ name: z25.string(),
5639
+ description: z25.string()
5463
5640
  });
5464
5641
  var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
5465
5642
  frontmatter;
@@ -5469,7 +5646,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
5469
5646
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
5470
5647
  if (!result.success) {
5471
5648
  throw new Error(
5472
- `Invalid frontmatter in ${join57(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5649
+ `Invalid frontmatter in ${join58(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5473
5650
  );
5474
5651
  }
5475
5652
  }
@@ -5502,7 +5679,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
5502
5679
  return {
5503
5680
  success: false,
5504
5681
  error: new Error(
5505
- `Invalid frontmatter in ${join57(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5682
+ `Invalid frontmatter in ${join58(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5506
5683
  )
5507
5684
  };
5508
5685
  }
@@ -5511,7 +5688,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
5511
5688
  relativeFilePath
5512
5689
  }) {
5513
5690
  const fileContent = await readFileContent(
5514
- join57(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
5691
+ join58(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
5515
5692
  );
5516
5693
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
5517
5694
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -5530,13 +5707,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
5530
5707
  };
5531
5708
 
5532
5709
  // src/features/subagents/claudecode-subagent.ts
5533
- var ClaudecodeSubagentFrontmatterSchema = z25.looseObject({
5534
- name: z25.string(),
5535
- description: z25.string(),
5536
- model: z25.optional(z25.string()),
5537
- tools: z25.optional(z25.union([z25.string(), z25.array(z25.string())])),
5538
- permissionMode: z25.optional(z25.string()),
5539
- skills: z25.optional(z25.union([z25.string(), z25.array(z25.string())]))
5710
+ var ClaudecodeSubagentFrontmatterSchema = z26.looseObject({
5711
+ name: z26.string(),
5712
+ description: z26.string(),
5713
+ model: z26.optional(z26.string()),
5714
+ tools: z26.optional(z26.union([z26.string(), z26.array(z26.string())])),
5715
+ permissionMode: z26.optional(z26.string()),
5716
+ skills: z26.optional(z26.union([z26.string(), z26.array(z26.string())]))
5540
5717
  });
5541
5718
  var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
5542
5719
  frontmatter;
@@ -5546,7 +5723,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
5546
5723
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
5547
5724
  if (!result.success) {
5548
5725
  throw new Error(
5549
- `Invalid frontmatter in ${join58(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5726
+ `Invalid frontmatter in ${join59(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5550
5727
  );
5551
5728
  }
5552
5729
  }
@@ -5558,7 +5735,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
5558
5735
  }
5559
5736
  static getSettablePaths(_options = {}) {
5560
5737
  return {
5561
- relativeDirPath: join58(".claude", "agents")
5738
+ relativeDirPath: join59(".claude", "agents")
5562
5739
  };
5563
5740
  }
5564
5741
  getFrontmatter() {
@@ -5632,7 +5809,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
5632
5809
  return {
5633
5810
  success: false,
5634
5811
  error: new Error(
5635
- `Invalid frontmatter in ${join58(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5812
+ `Invalid frontmatter in ${join59(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5636
5813
  )
5637
5814
  };
5638
5815
  }
@@ -5650,7 +5827,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
5650
5827
  global = false
5651
5828
  }) {
5652
5829
  const paths = this.getSettablePaths({ global });
5653
- const filePath = join58(baseDir, paths.relativeDirPath, relativeFilePath);
5830
+ const filePath = join59(baseDir, paths.relativeDirPath, relativeFilePath);
5654
5831
  const fileContent = await readFileContent(filePath);
5655
5832
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
5656
5833
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -5679,7 +5856,7 @@ var subagentsProcessorToolTargetTuple = [
5679
5856
  "geminicli",
5680
5857
  "roo"
5681
5858
  ];
5682
- var SubagentsProcessorToolTargetSchema = z26.enum(subagentsProcessorToolTargetTuple);
5859
+ var SubagentsProcessorToolTargetSchema = z27.enum(subagentsProcessorToolTargetTuple);
5683
5860
  var toolSubagentFactories = /* @__PURE__ */ new Map([
5684
5861
  [
5685
5862
  "agentsmd",
@@ -5782,7 +5959,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
5782
5959
  * Load and parse rulesync subagent files from .rulesync/subagents/ directory
5783
5960
  */
5784
5961
  async loadRulesyncFiles() {
5785
- const subagentsDir = join59(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
5962
+ const subagentsDir = join60(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
5786
5963
  const dirExists = await directoryExists(subagentsDir);
5787
5964
  if (!dirExists) {
5788
5965
  logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
@@ -5797,7 +5974,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
5797
5974
  logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
5798
5975
  const rulesyncSubagents = [];
5799
5976
  for (const mdFile of mdFiles) {
5800
- const filepath = join59(subagentsDir, mdFile);
5977
+ const filepath = join60(subagentsDir, mdFile);
5801
5978
  try {
5802
5979
  const rulesyncSubagent = await RulesyncSubagent.fromFile({
5803
5980
  relativeFilePath: mdFile,
@@ -5827,7 +6004,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
5827
6004
  const factory = this.getFactory(this.toolTarget);
5828
6005
  const paths = factory.class.getSettablePaths({ global: this.global });
5829
6006
  const subagentFilePaths = await findFilesByGlobs(
5830
- join59(this.baseDir, paths.relativeDirPath, "*.md")
6007
+ join60(this.baseDir, paths.relativeDirPath, "*.md")
5831
6008
  );
5832
6009
  const toolSubagents = await Promise.all(
5833
6010
  subagentFilePaths.map(
@@ -5866,35 +6043,35 @@ var SubagentsProcessor = class extends FeatureProcessor {
5866
6043
  };
5867
6044
 
5868
6045
  // src/features/rules/agentsmd-rule.ts
5869
- import { join as join62 } from "path";
6046
+ import { join as join63 } from "path";
5870
6047
 
5871
6048
  // src/features/rules/tool-rule.ts
5872
- import { join as join61 } from "path";
6049
+ import { join as join62 } from "path";
5873
6050
 
5874
6051
  // src/features/rules/rulesync-rule.ts
5875
- import { basename as basename19, join as join60 } from "path";
5876
- import { z as z27 } from "zod/mini";
5877
- var RulesyncRuleFrontmatterSchema = z27.object({
5878
- root: z27.optional(z27.optional(z27.boolean())),
5879
- targets: z27.optional(RulesyncTargetsSchema),
5880
- description: z27.optional(z27.string()),
5881
- globs: z27.optional(z27.array(z27.string())),
5882
- agentsmd: z27.optional(
5883
- z27.object({
6052
+ import { basename as basename19, join as join61 } from "path";
6053
+ import { z as z28 } from "zod/mini";
6054
+ var RulesyncRuleFrontmatterSchema = z28.object({
6055
+ root: z28.optional(z28.optional(z28.boolean())),
6056
+ targets: z28.optional(RulesyncTargetsSchema),
6057
+ description: z28.optional(z28.string()),
6058
+ globs: z28.optional(z28.array(z28.string())),
6059
+ agentsmd: z28.optional(
6060
+ z28.object({
5884
6061
  // @example "path/to/subproject"
5885
- subprojectPath: z27.optional(z27.string())
6062
+ subprojectPath: z28.optional(z28.string())
5886
6063
  })
5887
6064
  ),
5888
- cursor: z27.optional(
5889
- z27.object({
5890
- alwaysApply: z27.optional(z27.boolean()),
5891
- description: z27.optional(z27.string()),
5892
- globs: z27.optional(z27.array(z27.string()))
6065
+ cursor: z28.optional(
6066
+ z28.object({
6067
+ alwaysApply: z28.optional(z28.boolean()),
6068
+ description: z28.optional(z28.string()),
6069
+ globs: z28.optional(z28.array(z28.string()))
5893
6070
  })
5894
6071
  ),
5895
- copilot: z27.optional(
5896
- z27.object({
5897
- excludeAgent: z27.optional(z27.union([z27.literal("code-review"), z27.literal("coding-agent")]))
6072
+ copilot: z28.optional(
6073
+ z28.object({
6074
+ excludeAgent: z28.optional(z28.union([z28.literal("code-review"), z28.literal("coding-agent")]))
5898
6075
  })
5899
6076
  )
5900
6077
  });
@@ -5906,7 +6083,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
5906
6083
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
5907
6084
  if (!result.success) {
5908
6085
  throw new Error(
5909
- `Invalid frontmatter in ${join60(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
6086
+ `Invalid frontmatter in ${join61(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5910
6087
  );
5911
6088
  }
5912
6089
  }
@@ -5941,7 +6118,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
5941
6118
  return {
5942
6119
  success: false,
5943
6120
  error: new Error(
5944
- `Invalid frontmatter in ${join60(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
6121
+ `Invalid frontmatter in ${join61(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5945
6122
  )
5946
6123
  };
5947
6124
  }
@@ -5950,12 +6127,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
5950
6127
  relativeFilePath,
5951
6128
  validate = true
5952
6129
  }) {
5953
- const legacyPath = join60(
6130
+ const legacyPath = join61(
5954
6131
  process.cwd(),
5955
6132
  this.getSettablePaths().legacy.relativeDirPath,
5956
6133
  relativeFilePath
5957
6134
  );
5958
- const recommendedPath = join60(
6135
+ const recommendedPath = join61(
5959
6136
  this.getSettablePaths().recommended.relativeDirPath,
5960
6137
  relativeFilePath
5961
6138
  );
@@ -5988,7 +6165,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
5988
6165
  relativeFilePath,
5989
6166
  validate = true
5990
6167
  }) {
5991
- const filePath = join60(
6168
+ const filePath = join61(
5992
6169
  process.cwd(),
5993
6170
  this.getSettablePaths().recommended.relativeDirPath,
5994
6171
  relativeFilePath
@@ -6082,7 +6259,7 @@ var ToolRule = class extends ToolFile {
6082
6259
  rulesyncRule,
6083
6260
  validate = true,
6084
6261
  rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
6085
- nonRootPath = { relativeDirPath: join61(".agents", "memories") }
6262
+ nonRootPath = { relativeDirPath: join62(".agents", "memories") }
6086
6263
  }) {
6087
6264
  const params = this.buildToolRuleParamsDefault({
6088
6265
  baseDir,
@@ -6093,7 +6270,7 @@ var ToolRule = class extends ToolFile {
6093
6270
  });
6094
6271
  const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
6095
6272
  if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
6096
- params.relativeDirPath = join61(rulesyncFrontmatter.agentsmd.subprojectPath);
6273
+ params.relativeDirPath = join62(rulesyncFrontmatter.agentsmd.subprojectPath);
6097
6274
  params.relativeFilePath = "AGENTS.md";
6098
6275
  }
6099
6276
  return params;
@@ -6158,7 +6335,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
6158
6335
  relativeFilePath: "AGENTS.md"
6159
6336
  },
6160
6337
  nonRoot: {
6161
- relativeDirPath: join62(".agents", "memories")
6338
+ relativeDirPath: join63(".agents", "memories")
6162
6339
  }
6163
6340
  };
6164
6341
  }
@@ -6168,8 +6345,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
6168
6345
  validate = true
6169
6346
  }) {
6170
6347
  const isRoot = relativeFilePath === "AGENTS.md";
6171
- const relativePath = isRoot ? "AGENTS.md" : join62(".agents", "memories", relativeFilePath);
6172
- const fileContent = await readFileContent(join62(baseDir, relativePath));
6348
+ const relativePath = isRoot ? "AGENTS.md" : join63(".agents", "memories", relativeFilePath);
6349
+ const fileContent = await readFileContent(join63(baseDir, relativePath));
6173
6350
  return new _AgentsMdRule({
6174
6351
  baseDir,
6175
6352
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -6209,12 +6386,12 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
6209
6386
  };
6210
6387
 
6211
6388
  // src/features/rules/amazonqcli-rule.ts
6212
- import { join as join63 } from "path";
6389
+ import { join as join64 } from "path";
6213
6390
  var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
6214
6391
  static getSettablePaths() {
6215
6392
  return {
6216
6393
  nonRoot: {
6217
- relativeDirPath: join63(".amazonq", "rules")
6394
+ relativeDirPath: join64(".amazonq", "rules")
6218
6395
  }
6219
6396
  };
6220
6397
  }
@@ -6224,7 +6401,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
6224
6401
  validate = true
6225
6402
  }) {
6226
6403
  const fileContent = await readFileContent(
6227
- join63(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6404
+ join64(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6228
6405
  );
6229
6406
  return new _AmazonQCliRule({
6230
6407
  baseDir,
@@ -6264,12 +6441,12 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
6264
6441
  };
6265
6442
 
6266
6443
  // src/features/rules/antigravity-rule.ts
6267
- import { join as join64 } from "path";
6444
+ import { join as join65 } from "path";
6268
6445
  var AntigravityRule = class _AntigravityRule extends ToolRule {
6269
6446
  static getSettablePaths() {
6270
6447
  return {
6271
6448
  nonRoot: {
6272
- relativeDirPath: join64(".agent", "rules")
6449
+ relativeDirPath: join65(".agent", "rules")
6273
6450
  }
6274
6451
  };
6275
6452
  }
@@ -6279,7 +6456,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
6279
6456
  validate = true
6280
6457
  }) {
6281
6458
  const fileContent = await readFileContent(
6282
- join64(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6459
+ join65(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6283
6460
  );
6284
6461
  return new _AntigravityRule({
6285
6462
  baseDir,
@@ -6319,7 +6496,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
6319
6496
  };
6320
6497
 
6321
6498
  // src/features/rules/augmentcode-legacy-rule.ts
6322
- import { join as join65 } from "path";
6499
+ import { join as join66 } from "path";
6323
6500
  var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
6324
6501
  toRulesyncRule() {
6325
6502
  const rulesyncFrontmatter = {
@@ -6345,7 +6522,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
6345
6522
  relativeFilePath: ".augment-guidelines"
6346
6523
  },
6347
6524
  nonRoot: {
6348
- relativeDirPath: join65(".augment", "rules")
6525
+ relativeDirPath: join66(".augment", "rules")
6349
6526
  }
6350
6527
  };
6351
6528
  }
@@ -6380,8 +6557,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
6380
6557
  }) {
6381
6558
  const settablePaths = this.getSettablePaths();
6382
6559
  const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
6383
- const relativePath = isRoot ? settablePaths.root.relativeFilePath : join65(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
6384
- const fileContent = await readFileContent(join65(baseDir, relativePath));
6560
+ const relativePath = isRoot ? settablePaths.root.relativeFilePath : join66(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
6561
+ const fileContent = await readFileContent(join66(baseDir, relativePath));
6385
6562
  return new _AugmentcodeLegacyRule({
6386
6563
  baseDir,
6387
6564
  relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
@@ -6394,7 +6571,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
6394
6571
  };
6395
6572
 
6396
6573
  // src/features/rules/augmentcode-rule.ts
6397
- import { join as join66 } from "path";
6574
+ import { join as join67 } from "path";
6398
6575
  var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
6399
6576
  toRulesyncRule() {
6400
6577
  return this.toRulesyncRuleDefault();
@@ -6402,7 +6579,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
6402
6579
  static getSettablePaths() {
6403
6580
  return {
6404
6581
  nonRoot: {
6405
- relativeDirPath: join66(".augment", "rules")
6582
+ relativeDirPath: join67(".augment", "rules")
6406
6583
  }
6407
6584
  };
6408
6585
  }
@@ -6426,7 +6603,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
6426
6603
  validate = true
6427
6604
  }) {
6428
6605
  const fileContent = await readFileContent(
6429
- join66(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6606
+ join67(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6430
6607
  );
6431
6608
  const { body: content } = parseFrontmatter(fileContent);
6432
6609
  return new _AugmentcodeRule({
@@ -6449,7 +6626,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
6449
6626
  };
6450
6627
 
6451
6628
  // src/features/rules/claudecode-rule.ts
6452
- import { join as join67 } from "path";
6629
+ import { join as join68 } from "path";
6453
6630
  var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
6454
6631
  static getSettablePaths({
6455
6632
  global
@@ -6468,7 +6645,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
6468
6645
  relativeFilePath: "CLAUDE.md"
6469
6646
  },
6470
6647
  nonRoot: {
6471
- relativeDirPath: join67(".claude", "memories")
6648
+ relativeDirPath: join68(".claude", "memories")
6472
6649
  }
6473
6650
  };
6474
6651
  }
@@ -6483,7 +6660,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
6483
6660
  if (isRoot) {
6484
6661
  const relativePath2 = paths.root.relativeFilePath;
6485
6662
  const fileContent2 = await readFileContent(
6486
- join67(baseDir, paths.root.relativeDirPath, relativePath2)
6663
+ join68(baseDir, paths.root.relativeDirPath, relativePath2)
6487
6664
  );
6488
6665
  return new _ClaudecodeRule({
6489
6666
  baseDir,
@@ -6497,8 +6674,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
6497
6674
  if (!paths.nonRoot) {
6498
6675
  throw new Error("nonRoot path is not set");
6499
6676
  }
6500
- const relativePath = join67(paths.nonRoot.relativeDirPath, relativeFilePath);
6501
- const fileContent = await readFileContent(join67(baseDir, relativePath));
6677
+ const relativePath = join68(paths.nonRoot.relativeDirPath, relativeFilePath);
6678
+ const fileContent = await readFileContent(join68(baseDir, relativePath));
6502
6679
  return new _ClaudecodeRule({
6503
6680
  baseDir,
6504
6681
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -6540,10 +6717,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
6540
6717
  };
6541
6718
 
6542
6719
  // src/features/rules/cline-rule.ts
6543
- import { join as join68 } from "path";
6544
- import { z as z28 } from "zod/mini";
6545
- var ClineRuleFrontmatterSchema = z28.object({
6546
- description: z28.string()
6720
+ import { join as join69 } from "path";
6721
+ import { z as z29 } from "zod/mini";
6722
+ var ClineRuleFrontmatterSchema = z29.object({
6723
+ description: z29.string()
6547
6724
  });
6548
6725
  var ClineRule = class _ClineRule extends ToolRule {
6549
6726
  static getSettablePaths() {
@@ -6585,7 +6762,7 @@ var ClineRule = class _ClineRule extends ToolRule {
6585
6762
  validate = true
6586
6763
  }) {
6587
6764
  const fileContent = await readFileContent(
6588
- join68(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6765
+ join69(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6589
6766
  );
6590
6767
  return new _ClineRule({
6591
6768
  baseDir,
@@ -6598,7 +6775,7 @@ var ClineRule = class _ClineRule extends ToolRule {
6598
6775
  };
6599
6776
 
6600
6777
  // src/features/rules/codexcli-rule.ts
6601
- import { join as join69 } from "path";
6778
+ import { join as join70 } from "path";
6602
6779
  var CodexcliRule = class _CodexcliRule extends ToolRule {
6603
6780
  static getSettablePaths({
6604
6781
  global
@@ -6617,7 +6794,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
6617
6794
  relativeFilePath: "AGENTS.md"
6618
6795
  },
6619
6796
  nonRoot: {
6620
- relativeDirPath: join69(".codex", "memories")
6797
+ relativeDirPath: join70(".codex", "memories")
6621
6798
  }
6622
6799
  };
6623
6800
  }
@@ -6632,7 +6809,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
6632
6809
  if (isRoot) {
6633
6810
  const relativePath2 = paths.root.relativeFilePath;
6634
6811
  const fileContent2 = await readFileContent(
6635
- join69(baseDir, paths.root.relativeDirPath, relativePath2)
6812
+ join70(baseDir, paths.root.relativeDirPath, relativePath2)
6636
6813
  );
6637
6814
  return new _CodexcliRule({
6638
6815
  baseDir,
@@ -6646,8 +6823,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
6646
6823
  if (!paths.nonRoot) {
6647
6824
  throw new Error("nonRoot path is not set");
6648
6825
  }
6649
- const relativePath = join69(paths.nonRoot.relativeDirPath, relativeFilePath);
6650
- const fileContent = await readFileContent(join69(baseDir, relativePath));
6826
+ const relativePath = join70(paths.nonRoot.relativeDirPath, relativeFilePath);
6827
+ const fileContent = await readFileContent(join70(baseDir, relativePath));
6651
6828
  return new _CodexcliRule({
6652
6829
  baseDir,
6653
6830
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -6689,12 +6866,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
6689
6866
  };
6690
6867
 
6691
6868
  // src/features/rules/copilot-rule.ts
6692
- import { join as join70 } from "path";
6693
- import { z as z29 } from "zod/mini";
6694
- var CopilotRuleFrontmatterSchema = z29.object({
6695
- description: z29.optional(z29.string()),
6696
- applyTo: z29.optional(z29.string()),
6697
- excludeAgent: z29.optional(z29.union([z29.literal("code-review"), z29.literal("coding-agent")]))
6869
+ import { join as join71 } from "path";
6870
+ import { z as z30 } from "zod/mini";
6871
+ var CopilotRuleFrontmatterSchema = z30.object({
6872
+ description: z30.optional(z30.string()),
6873
+ applyTo: z30.optional(z30.string()),
6874
+ excludeAgent: z30.optional(z30.union([z30.literal("code-review"), z30.literal("coding-agent")]))
6698
6875
  });
6699
6876
  var CopilotRule = class _CopilotRule extends ToolRule {
6700
6877
  frontmatter;
@@ -6706,7 +6883,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
6706
6883
  relativeFilePath: "copilot-instructions.md"
6707
6884
  },
6708
6885
  nonRoot: {
6709
- relativeDirPath: join70(".github", "instructions")
6886
+ relativeDirPath: join71(".github", "instructions")
6710
6887
  }
6711
6888
  };
6712
6889
  }
@@ -6715,7 +6892,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
6715
6892
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
6716
6893
  if (!result.success) {
6717
6894
  throw new Error(
6718
- `Invalid frontmatter in ${join70(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
6895
+ `Invalid frontmatter in ${join71(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
6719
6896
  );
6720
6897
  }
6721
6898
  }
@@ -6797,11 +6974,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
6797
6974
  validate = true
6798
6975
  }) {
6799
6976
  const isRoot = relativeFilePath === "copilot-instructions.md";
6800
- const relativePath = isRoot ? join70(
6977
+ const relativePath = isRoot ? join71(
6801
6978
  this.getSettablePaths().root.relativeDirPath,
6802
6979
  this.getSettablePaths().root.relativeFilePath
6803
- ) : join70(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
6804
- const fileContent = await readFileContent(join70(baseDir, relativePath));
6980
+ ) : join71(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
6981
+ const fileContent = await readFileContent(join71(baseDir, relativePath));
6805
6982
  if (isRoot) {
6806
6983
  return new _CopilotRule({
6807
6984
  baseDir,
@@ -6817,7 +6994,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
6817
6994
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
6818
6995
  if (!result.success) {
6819
6996
  throw new Error(
6820
- `Invalid frontmatter in ${join70(baseDir, relativeFilePath)}: ${formatError(result.error)}`
6997
+ `Invalid frontmatter in ${join71(baseDir, relativeFilePath)}: ${formatError(result.error)}`
6821
6998
  );
6822
6999
  }
6823
7000
  return new _CopilotRule({
@@ -6841,7 +7018,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
6841
7018
  return {
6842
7019
  success: false,
6843
7020
  error: new Error(
6844
- `Invalid frontmatter in ${join70(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7021
+ `Invalid frontmatter in ${join71(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
6845
7022
  )
6846
7023
  };
6847
7024
  }
@@ -6861,12 +7038,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
6861
7038
  };
6862
7039
 
6863
7040
  // src/features/rules/cursor-rule.ts
6864
- import { basename as basename20, join as join71 } from "path";
6865
- import { z as z30 } from "zod/mini";
6866
- var CursorRuleFrontmatterSchema = z30.object({
6867
- description: z30.optional(z30.string()),
6868
- globs: z30.optional(z30.string()),
6869
- alwaysApply: z30.optional(z30.boolean())
7041
+ import { basename as basename20, join as join72 } from "path";
7042
+ import { z as z31 } from "zod/mini";
7043
+ var CursorRuleFrontmatterSchema = z31.object({
7044
+ description: z31.optional(z31.string()),
7045
+ globs: z31.optional(z31.string()),
7046
+ alwaysApply: z31.optional(z31.boolean())
6870
7047
  });
6871
7048
  var CursorRule = class _CursorRule extends ToolRule {
6872
7049
  frontmatter;
@@ -6874,7 +7051,7 @@ var CursorRule = class _CursorRule extends ToolRule {
6874
7051
  static getSettablePaths() {
6875
7052
  return {
6876
7053
  nonRoot: {
6877
- relativeDirPath: join71(".cursor", "rules")
7054
+ relativeDirPath: join72(".cursor", "rules")
6878
7055
  }
6879
7056
  };
6880
7057
  }
@@ -6883,7 +7060,7 @@ var CursorRule = class _CursorRule extends ToolRule {
6883
7060
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
6884
7061
  if (!result.success) {
6885
7062
  throw new Error(
6886
- `Invalid frontmatter in ${join71(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
7063
+ `Invalid frontmatter in ${join72(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
6887
7064
  );
6888
7065
  }
6889
7066
  }
@@ -7000,13 +7177,13 @@ var CursorRule = class _CursorRule extends ToolRule {
7000
7177
  validate = true
7001
7178
  }) {
7002
7179
  const fileContent = await readFileContent(
7003
- join71(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7180
+ join72(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7004
7181
  );
7005
7182
  const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
7006
7183
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
7007
7184
  if (!result.success) {
7008
7185
  throw new Error(
7009
- `Invalid frontmatter in ${join71(baseDir, relativeFilePath)}: ${formatError(result.error)}`
7186
+ `Invalid frontmatter in ${join72(baseDir, relativeFilePath)}: ${formatError(result.error)}`
7010
7187
  );
7011
7188
  }
7012
7189
  return new _CursorRule({
@@ -7029,7 +7206,7 @@ var CursorRule = class _CursorRule extends ToolRule {
7029
7206
  return {
7030
7207
  success: false,
7031
7208
  error: new Error(
7032
- `Invalid frontmatter in ${join71(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7209
+ `Invalid frontmatter in ${join72(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7033
7210
  )
7034
7211
  };
7035
7212
  }
@@ -7049,7 +7226,7 @@ var CursorRule = class _CursorRule extends ToolRule {
7049
7226
  };
7050
7227
 
7051
7228
  // src/features/rules/geminicli-rule.ts
7052
- import { join as join72 } from "path";
7229
+ import { join as join73 } from "path";
7053
7230
  var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7054
7231
  static getSettablePaths({
7055
7232
  global
@@ -7068,7 +7245,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7068
7245
  relativeFilePath: "GEMINI.md"
7069
7246
  },
7070
7247
  nonRoot: {
7071
- relativeDirPath: join72(".gemini", "memories")
7248
+ relativeDirPath: join73(".gemini", "memories")
7072
7249
  }
7073
7250
  };
7074
7251
  }
@@ -7083,7 +7260,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7083
7260
  if (isRoot) {
7084
7261
  const relativePath2 = paths.root.relativeFilePath;
7085
7262
  const fileContent2 = await readFileContent(
7086
- join72(baseDir, paths.root.relativeDirPath, relativePath2)
7263
+ join73(baseDir, paths.root.relativeDirPath, relativePath2)
7087
7264
  );
7088
7265
  return new _GeminiCliRule({
7089
7266
  baseDir,
@@ -7097,8 +7274,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7097
7274
  if (!paths.nonRoot) {
7098
7275
  throw new Error("nonRoot path is not set");
7099
7276
  }
7100
- const relativePath = join72(paths.nonRoot.relativeDirPath, relativeFilePath);
7101
- const fileContent = await readFileContent(join72(baseDir, relativePath));
7277
+ const relativePath = join73(paths.nonRoot.relativeDirPath, relativeFilePath);
7278
+ const fileContent = await readFileContent(join73(baseDir, relativePath));
7102
7279
  return new _GeminiCliRule({
7103
7280
  baseDir,
7104
7281
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -7140,7 +7317,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7140
7317
  };
7141
7318
 
7142
7319
  // src/features/rules/junie-rule.ts
7143
- import { join as join73 } from "path";
7320
+ import { join as join74 } from "path";
7144
7321
  var JunieRule = class _JunieRule extends ToolRule {
7145
7322
  static getSettablePaths() {
7146
7323
  return {
@@ -7149,7 +7326,7 @@ var JunieRule = class _JunieRule extends ToolRule {
7149
7326
  relativeFilePath: "guidelines.md"
7150
7327
  },
7151
7328
  nonRoot: {
7152
- relativeDirPath: join73(".junie", "memories")
7329
+ relativeDirPath: join74(".junie", "memories")
7153
7330
  }
7154
7331
  };
7155
7332
  }
@@ -7159,8 +7336,8 @@ var JunieRule = class _JunieRule extends ToolRule {
7159
7336
  validate = true
7160
7337
  }) {
7161
7338
  const isRoot = relativeFilePath === "guidelines.md";
7162
- const relativePath = isRoot ? "guidelines.md" : join73(".junie", "memories", relativeFilePath);
7163
- const fileContent = await readFileContent(join73(baseDir, relativePath));
7339
+ const relativePath = isRoot ? "guidelines.md" : join74(".junie", "memories", relativeFilePath);
7340
+ const fileContent = await readFileContent(join74(baseDir, relativePath));
7164
7341
  return new _JunieRule({
7165
7342
  baseDir,
7166
7343
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -7200,12 +7377,12 @@ var JunieRule = class _JunieRule extends ToolRule {
7200
7377
  };
7201
7378
 
7202
7379
  // src/features/rules/kiro-rule.ts
7203
- import { join as join74 } from "path";
7380
+ import { join as join75 } from "path";
7204
7381
  var KiroRule = class _KiroRule extends ToolRule {
7205
7382
  static getSettablePaths() {
7206
7383
  return {
7207
7384
  nonRoot: {
7208
- relativeDirPath: join74(".kiro", "steering")
7385
+ relativeDirPath: join75(".kiro", "steering")
7209
7386
  }
7210
7387
  };
7211
7388
  }
@@ -7215,7 +7392,7 @@ var KiroRule = class _KiroRule extends ToolRule {
7215
7392
  validate = true
7216
7393
  }) {
7217
7394
  const fileContent = await readFileContent(
7218
- join74(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7395
+ join75(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7219
7396
  );
7220
7397
  return new _KiroRule({
7221
7398
  baseDir,
@@ -7255,7 +7432,7 @@ var KiroRule = class _KiroRule extends ToolRule {
7255
7432
  };
7256
7433
 
7257
7434
  // src/features/rules/opencode-rule.ts
7258
- import { join as join75 } from "path";
7435
+ import { join as join76 } from "path";
7259
7436
  var OpenCodeRule = class _OpenCodeRule extends ToolRule {
7260
7437
  static getSettablePaths() {
7261
7438
  return {
@@ -7264,7 +7441,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
7264
7441
  relativeFilePath: "AGENTS.md"
7265
7442
  },
7266
7443
  nonRoot: {
7267
- relativeDirPath: join75(".opencode", "memories")
7444
+ relativeDirPath: join76(".opencode", "memories")
7268
7445
  }
7269
7446
  };
7270
7447
  }
@@ -7274,8 +7451,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
7274
7451
  validate = true
7275
7452
  }) {
7276
7453
  const isRoot = relativeFilePath === "AGENTS.md";
7277
- const relativePath = isRoot ? "AGENTS.md" : join75(".opencode", "memories", relativeFilePath);
7278
- const fileContent = await readFileContent(join75(baseDir, relativePath));
7454
+ const relativePath = isRoot ? "AGENTS.md" : join76(".opencode", "memories", relativeFilePath);
7455
+ const fileContent = await readFileContent(join76(baseDir, relativePath));
7279
7456
  return new _OpenCodeRule({
7280
7457
  baseDir,
7281
7458
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -7315,7 +7492,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
7315
7492
  };
7316
7493
 
7317
7494
  // src/features/rules/qwencode-rule.ts
7318
- import { join as join76 } from "path";
7495
+ import { join as join77 } from "path";
7319
7496
  var QwencodeRule = class _QwencodeRule extends ToolRule {
7320
7497
  static getSettablePaths() {
7321
7498
  return {
@@ -7324,7 +7501,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
7324
7501
  relativeFilePath: "QWEN.md"
7325
7502
  },
7326
7503
  nonRoot: {
7327
- relativeDirPath: join76(".qwen", "memories")
7504
+ relativeDirPath: join77(".qwen", "memories")
7328
7505
  }
7329
7506
  };
7330
7507
  }
@@ -7334,8 +7511,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
7334
7511
  validate = true
7335
7512
  }) {
7336
7513
  const isRoot = relativeFilePath === "QWEN.md";
7337
- const relativePath = isRoot ? "QWEN.md" : join76(".qwen", "memories", relativeFilePath);
7338
- const fileContent = await readFileContent(join76(baseDir, relativePath));
7514
+ const relativePath = isRoot ? "QWEN.md" : join77(".qwen", "memories", relativeFilePath);
7515
+ const fileContent = await readFileContent(join77(baseDir, relativePath));
7339
7516
  return new _QwencodeRule({
7340
7517
  baseDir,
7341
7518
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -7372,12 +7549,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
7372
7549
  };
7373
7550
 
7374
7551
  // src/features/rules/roo-rule.ts
7375
- import { join as join77 } from "path";
7552
+ import { join as join78 } from "path";
7376
7553
  var RooRule = class _RooRule extends ToolRule {
7377
7554
  static getSettablePaths() {
7378
7555
  return {
7379
7556
  nonRoot: {
7380
- relativeDirPath: join77(".roo", "rules")
7557
+ relativeDirPath: join78(".roo", "rules")
7381
7558
  }
7382
7559
  };
7383
7560
  }
@@ -7387,7 +7564,7 @@ var RooRule = class _RooRule extends ToolRule {
7387
7564
  validate = true
7388
7565
  }) {
7389
7566
  const fileContent = await readFileContent(
7390
- join77(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7567
+ join78(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7391
7568
  );
7392
7569
  return new _RooRule({
7393
7570
  baseDir,
@@ -7442,7 +7619,7 @@ var RooRule = class _RooRule extends ToolRule {
7442
7619
  };
7443
7620
 
7444
7621
  // src/features/rules/warp-rule.ts
7445
- import { join as join78 } from "path";
7622
+ import { join as join79 } from "path";
7446
7623
  var WarpRule = class _WarpRule extends ToolRule {
7447
7624
  constructor({ fileContent, root, ...rest }) {
7448
7625
  super({
@@ -7458,7 +7635,7 @@ var WarpRule = class _WarpRule extends ToolRule {
7458
7635
  relativeFilePath: "WARP.md"
7459
7636
  },
7460
7637
  nonRoot: {
7461
- relativeDirPath: join78(".warp", "memories")
7638
+ relativeDirPath: join79(".warp", "memories")
7462
7639
  }
7463
7640
  };
7464
7641
  }
@@ -7468,8 +7645,8 @@ var WarpRule = class _WarpRule extends ToolRule {
7468
7645
  validate = true
7469
7646
  }) {
7470
7647
  const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
7471
- const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join78(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
7472
- const fileContent = await readFileContent(join78(baseDir, relativePath));
7648
+ const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join79(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
7649
+ const fileContent = await readFileContent(join79(baseDir, relativePath));
7473
7650
  return new _WarpRule({
7474
7651
  baseDir,
7475
7652
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
@@ -7509,12 +7686,12 @@ var WarpRule = class _WarpRule extends ToolRule {
7509
7686
  };
7510
7687
 
7511
7688
  // src/features/rules/windsurf-rule.ts
7512
- import { join as join79 } from "path";
7689
+ import { join as join80 } from "path";
7513
7690
  var WindsurfRule = class _WindsurfRule extends ToolRule {
7514
7691
  static getSettablePaths() {
7515
7692
  return {
7516
7693
  nonRoot: {
7517
- relativeDirPath: join79(".windsurf", "rules")
7694
+ relativeDirPath: join80(".windsurf", "rules")
7518
7695
  }
7519
7696
  };
7520
7697
  }
@@ -7524,7 +7701,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
7524
7701
  validate = true
7525
7702
  }) {
7526
7703
  const fileContent = await readFileContent(
7527
- join79(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7704
+ join80(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7528
7705
  );
7529
7706
  return new _WindsurfRule({
7530
7707
  baseDir,
@@ -7583,7 +7760,7 @@ var rulesProcessorToolTargets = [
7583
7760
  "warp",
7584
7761
  "windsurf"
7585
7762
  ];
7586
- var RulesProcessorToolTargetSchema = z31.enum(rulesProcessorToolTargets);
7763
+ var RulesProcessorToolTargetSchema = z32.enum(rulesProcessorToolTargets);
7587
7764
  var rulesProcessorToolTargetsGlobal = [
7588
7765
  "claudecode",
7589
7766
  "codexcli",
@@ -7709,7 +7886,7 @@ var RulesProcessor = class extends FeatureProcessor {
7709
7886
  case "agentsmd": {
7710
7887
  const rootRule = toolRules[rootRuleIndex];
7711
7888
  rootRule?.setFileContent(
7712
- this.generateXmlReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
7889
+ this.generateToonReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
7713
7890
  commands: { relativeDirPath: AgentsmdCommand.getSettablePaths().relativeDirPath },
7714
7891
  subagents: {
7715
7892
  relativeDirPath: AgentsmdSubagent.getSettablePaths().relativeDirPath
@@ -7721,7 +7898,7 @@ var RulesProcessor = class extends FeatureProcessor {
7721
7898
  case "augmentcode-legacy": {
7722
7899
  const rootRule = toolRules[rootRuleIndex];
7723
7900
  rootRule?.setFileContent(
7724
- this.generateXmlReferencesSection(toolRules) + rootRule.getFileContent()
7901
+ this.generateToonReferencesSection(toolRules) + rootRule.getFileContent()
7725
7902
  );
7726
7903
  return toolRules;
7727
7904
  }
@@ -7735,12 +7912,15 @@ var RulesProcessor = class extends FeatureProcessor {
7735
7912
  case "codexcli": {
7736
7913
  const rootRule = toolRules[rootRuleIndex];
7737
7914
  rootRule?.setFileContent(
7738
- this.generateXmlReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
7915
+ this.generateToonReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
7739
7916
  subagents: {
7740
7917
  relativeDirPath: CodexCliSubagent.getSettablePaths().relativeDirPath
7741
7918
  },
7742
- skills: {
7743
- relativeDirPath: CodexCliSkill.getSettablePaths().relativeDirPath
7919
+ // Codex CLI skills are only supported in global mode
7920
+ ...this.global && {
7921
+ skills: {
7922
+ relativeDirPath: CodexCliSkill.getSettablePaths({ global: this.global }).relativeDirPath
7923
+ }
7744
7924
  }
7745
7925
  }) + rootRule.getFileContent()
7746
7926
  );
@@ -7764,7 +7944,7 @@ var RulesProcessor = class extends FeatureProcessor {
7764
7944
  case "geminicli": {
7765
7945
  const rootRule = toolRules[rootRuleIndex];
7766
7946
  rootRule?.setFileContent(
7767
- this.generateXmlReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
7947
+ this.generateToonReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
7768
7948
  commands: { relativeDirPath: GeminiCliCommand.getSettablePaths().relativeDirPath },
7769
7949
  subagents: {
7770
7950
  relativeDirPath: GeminiCliSubagent.getSettablePaths().relativeDirPath
@@ -7776,28 +7956,28 @@ var RulesProcessor = class extends FeatureProcessor {
7776
7956
  case "kiro": {
7777
7957
  const rootRule = toolRules[rootRuleIndex];
7778
7958
  rootRule?.setFileContent(
7779
- this.generateXmlReferencesSection(toolRules) + rootRule.getFileContent()
7959
+ this.generateToonReferencesSection(toolRules) + rootRule.getFileContent()
7780
7960
  );
7781
7961
  return toolRules;
7782
7962
  }
7783
7963
  case "opencode": {
7784
7964
  const rootRule = toolRules[rootRuleIndex];
7785
7965
  rootRule?.setFileContent(
7786
- this.generateXmlReferencesSection(toolRules) + rootRule.getFileContent()
7966
+ this.generateToonReferencesSection(toolRules) + rootRule.getFileContent()
7787
7967
  );
7788
7968
  return toolRules;
7789
7969
  }
7790
7970
  case "qwencode": {
7791
7971
  const rootRule = toolRules[rootRuleIndex];
7792
7972
  rootRule?.setFileContent(
7793
- this.generateXmlReferencesSection(toolRules) + rootRule.getFileContent()
7973
+ this.generateToonReferencesSection(toolRules) + rootRule.getFileContent()
7794
7974
  );
7795
7975
  return toolRules;
7796
7976
  }
7797
7977
  case "warp": {
7798
7978
  const rootRule = toolRules[rootRuleIndex];
7799
7979
  rootRule?.setFileContent(
7800
- this.generateXmlReferencesSection(toolRules) + rootRule.getFileContent()
7980
+ this.generateToonReferencesSection(toolRules) + rootRule.getFileContent()
7801
7981
  );
7802
7982
  return toolRules;
7803
7983
  }
@@ -7817,7 +7997,7 @@ var RulesProcessor = class extends FeatureProcessor {
7817
7997
  * Load and parse rulesync rule files from .rulesync/rules/ directory
7818
7998
  */
7819
7999
  async loadRulesyncFiles() {
7820
- const files = await findFilesByGlobs(join80(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
8000
+ const files = await findFilesByGlobs(join81(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
7821
8001
  logger.debug(`Found ${files.length} rulesync files`);
7822
8002
  const rulesyncRules = await Promise.all(
7823
8003
  files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename21(file) }))
@@ -7838,7 +8018,7 @@ var RulesProcessor = class extends FeatureProcessor {
7838
8018
  return rulesyncRules;
7839
8019
  }
7840
8020
  async loadRulesyncFilesLegacy() {
7841
- const legacyFiles = await findFilesByGlobs(join80(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
8021
+ const legacyFiles = await findFilesByGlobs(join81(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
7842
8022
  logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
7843
8023
  return Promise.all(
7844
8024
  legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename21(file) }))
@@ -7859,7 +8039,7 @@ var RulesProcessor = class extends FeatureProcessor {
7859
8039
  return [];
7860
8040
  }
7861
8041
  const rootFilePaths = await findFilesByGlobs(
7862
- join80(
8042
+ join81(
7863
8043
  this.baseDir,
7864
8044
  settablePaths.root.relativeDirPath ?? ".",
7865
8045
  settablePaths.root.relativeFilePath
@@ -7881,7 +8061,7 @@ var RulesProcessor = class extends FeatureProcessor {
7881
8061
  return [];
7882
8062
  }
7883
8063
  const nonRootFilePaths = await findFilesByGlobs(
7884
- join80(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
8064
+ join81(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
7885
8065
  );
7886
8066
  return await Promise.all(
7887
8067
  nonRootFilePaths.map(
@@ -7910,43 +8090,35 @@ var RulesProcessor = class extends FeatureProcessor {
7910
8090
  }
7911
8091
  return rulesProcessorToolTargets;
7912
8092
  }
7913
- generateXmlReferencesSection(toolRules) {
8093
+ generateToonReferencesSection(toolRules) {
7914
8094
  const toolRulesWithoutRoot = toolRules.filter((rule) => !rule.isRoot());
7915
8095
  if (toolRulesWithoutRoot.length === 0) {
7916
8096
  return "";
7917
8097
  }
7918
8098
  const lines = [];
7919
8099
  lines.push(
7920
- "Please also reference the following documents as needed. In this case, `@` stands for the project root directory."
8100
+ "Please also reference the following rules as needed. The list below is provided in TOON format, and `@` stands for the project root directory."
7921
8101
  );
7922
8102
  lines.push("");
7923
- const documentsData = {
7924
- Documents: {
7925
- Document: toolRulesWithoutRoot.map((rule) => {
7926
- const rulesyncRule = rule.toRulesyncRule();
7927
- const frontmatter = rulesyncRule.getFrontmatter();
7928
- const relativePath = `@${rule.getRelativePathFromCwd()}`;
7929
- const document = {
7930
- Path: relativePath
7931
- };
7932
- if (frontmatter.description) {
7933
- document.Description = frontmatter.description;
7934
- }
7935
- if (frontmatter.globs && frontmatter.globs.length > 0) {
7936
- document.FilePatterns = frontmatter.globs.join(", ");
7937
- }
7938
- return document;
7939
- })
8103
+ const rules = toolRulesWithoutRoot.map((toolRule) => {
8104
+ const rulesyncRule = toolRule.toRulesyncRule();
8105
+ const frontmatter = rulesyncRule.getFrontmatter();
8106
+ const rule = {
8107
+ path: `@${toolRule.getRelativePathFromCwd()}`
8108
+ };
8109
+ if (frontmatter.description) {
8110
+ rule.description = frontmatter.description;
7940
8111
  }
7941
- };
7942
- const builder = new XMLBuilder({
7943
- format: true,
7944
- ignoreAttributes: false,
7945
- suppressEmptyNode: false
8112
+ if (frontmatter.globs && frontmatter.globs.length > 0) {
8113
+ rule.applyTo = frontmatter.globs;
8114
+ }
8115
+ return rule;
8116
+ });
8117
+ const toonContent = encode({
8118
+ rules
7946
8119
  });
7947
- const xmlContent = builder.build(documentsData);
7948
- lines.push(xmlContent);
7949
- return lines.join("\n") + "\n";
8120
+ lines.push(toonContent);
8121
+ return lines.join("\n") + "\n\n";
7950
8122
  }
7951
8123
  generateReferencesSection(toolRules) {
7952
8124
  const toolRulesWithoutRoot = toolRules.filter((rule) => !rule.isRoot());
@@ -7954,13 +8126,13 @@ var RulesProcessor = class extends FeatureProcessor {
7954
8126
  return "";
7955
8127
  }
7956
8128
  const lines = [];
7957
- lines.push("Please also reference the following documents as needed:");
8129
+ lines.push("Please also reference the following rules as needed:");
7958
8130
  lines.push("");
7959
- for (const rule of toolRulesWithoutRoot) {
7960
- const escapedDescription = rule.getDescription()?.replace(/"/g, '\\"');
7961
- const globsText = rule.getGlobs()?.join(",");
8131
+ for (const toolRule of toolRulesWithoutRoot) {
8132
+ const escapedDescription = toolRule.getDescription()?.replace(/"/g, '\\"');
8133
+ const globsText = toolRule.getGlobs()?.join(",");
7962
8134
  lines.push(
7963
- `@${rule.getRelativePathFromCwd()} description: "${escapedDescription}" globs: "${globsText}"`
8135
+ `@${toolRule.getRelativePathFromCwd()} description: "${escapedDescription}" applyTo: "${globsText}"`
7964
8136
  );
7965
8137
  }
7966
8138
  return lines.join("\n") + "\n\n";
@@ -7988,21 +8160,21 @@ s/<command> [arguments]
7988
8160
  This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
7989
8161
  The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
7990
8162
 
7991
- When users call a custom slash command, you have to look for the markdown file, \`${join80(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
8163
+ When users call a custom slash command, you have to look for the markdown file, \`${join81(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
7992
8164
  const subagentsSection = subagents ? `## Simulated Subagents
7993
8165
 
7994
8166
  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.
7995
8167
 
7996
- When users call a simulated subagent, it will look for the corresponding markdown file, \`${join80(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
8168
+ When users call a simulated subagent, it will look for the corresponding markdown file, \`${join81(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
7997
8169
 
7998
- For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join80(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
8170
+ For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join81(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
7999
8171
  const skillsSection = skills ? `## Simulated Skills
8000
8172
 
8001
8173
  Simulated skills are specialized capabilities that can be invoked to handle specific types of tasks.
8002
8174
 
8003
- When users invoke a simulated skill, look for the corresponding SKILL.md file in \`${join80(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "{skill}/SKILL.md")}\` and execute its contents as the block of operations.
8175
+ When users invoke a simulated skill, look for the corresponding SKILL.md file in \`${join81(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "{skill}/SKILL.md")}\` and execute its contents as the block of operations.
8004
8176
 
8005
- For example, if the user instructs \`Use the skill example-skill to achieve something\`, look for \`${join80(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "example-skill/SKILL.md")}\` and execute its contents.
8177
+ For example, if the user instructs \`Use the skill example-skill to achieve something\`, look for \`${join81(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "example-skill/SKILL.md")}\` and execute its contents.
8006
8178
 
8007
8179
  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.` : "";
8008
8180
  const result = [
@@ -8264,9 +8436,9 @@ async function generateSkills(config) {
8264
8436
  }
8265
8437
 
8266
8438
  // src/cli/commands/gitignore.ts
8267
- import { join as join81 } from "path";
8439
+ import { join as join82 } from "path";
8268
8440
  var gitignoreCommand = async () => {
8269
- const gitignorePath = join81(process.cwd(), ".gitignore");
8441
+ const gitignorePath = join82(process.cwd(), ".gitignore");
8270
8442
  const rulesFilesToIgnore = [
8271
8443
  "# Generated by rulesync - AI tool configuration files",
8272
8444
  // AGENTS.md
@@ -8539,7 +8711,7 @@ async function importSkills(config, tool) {
8539
8711
  }
8540
8712
 
8541
8713
  // src/cli/commands/init.ts
8542
- import { join as join82 } from "path";
8714
+ import { join as join83 } from "path";
8543
8715
  async function initCommand() {
8544
8716
  logger.info("Initializing rulesync...");
8545
8717
  await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
@@ -8702,14 +8874,14 @@ Attention, again, you are just the planner, so though you can read any files and
8702
8874
  await ensureDir(commandPaths.relativeDirPath);
8703
8875
  await ensureDir(subagentPaths.relativeDirPath);
8704
8876
  await ensureDir(ignorePaths.recommended.relativeDirPath);
8705
- const ruleFilepath = join82(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
8877
+ const ruleFilepath = join83(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
8706
8878
  if (!await fileExists(ruleFilepath)) {
8707
8879
  await writeFileContent(ruleFilepath, sampleRuleFile.content);
8708
8880
  logger.success(`Created ${ruleFilepath}`);
8709
8881
  } else {
8710
8882
  logger.info(`Skipped ${ruleFilepath} (already exists)`);
8711
8883
  }
8712
- const mcpFilepath = join82(
8884
+ const mcpFilepath = join83(
8713
8885
  mcpPaths.recommended.relativeDirPath,
8714
8886
  mcpPaths.recommended.relativeFilePath
8715
8887
  );
@@ -8719,21 +8891,21 @@ Attention, again, you are just the planner, so though you can read any files and
8719
8891
  } else {
8720
8892
  logger.info(`Skipped ${mcpFilepath} (already exists)`);
8721
8893
  }
8722
- const commandFilepath = join82(commandPaths.relativeDirPath, sampleCommandFile.filename);
8894
+ const commandFilepath = join83(commandPaths.relativeDirPath, sampleCommandFile.filename);
8723
8895
  if (!await fileExists(commandFilepath)) {
8724
8896
  await writeFileContent(commandFilepath, sampleCommandFile.content);
8725
8897
  logger.success(`Created ${commandFilepath}`);
8726
8898
  } else {
8727
8899
  logger.info(`Skipped ${commandFilepath} (already exists)`);
8728
8900
  }
8729
- const subagentFilepath = join82(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
8901
+ const subagentFilepath = join83(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
8730
8902
  if (!await fileExists(subagentFilepath)) {
8731
8903
  await writeFileContent(subagentFilepath, sampleSubagentFile.content);
8732
8904
  logger.success(`Created ${subagentFilepath}`);
8733
8905
  } else {
8734
8906
  logger.info(`Skipped ${subagentFilepath} (already exists)`);
8735
8907
  }
8736
- const ignoreFilepath = join82(
8908
+ const ignoreFilepath = join83(
8737
8909
  ignorePaths.recommended.relativeDirPath,
8738
8910
  ignorePaths.recommended.relativeFilePath
8739
8911
  );
@@ -8749,12 +8921,12 @@ Attention, again, you are just the planner, so though you can read any files and
8749
8921
  import { FastMCP } from "fastmcp";
8750
8922
 
8751
8923
  // src/mcp/commands.ts
8752
- import { basename as basename22, join as join83 } from "path";
8753
- import { z as z32 } from "zod/mini";
8924
+ import { basename as basename22, join as join84 } from "path";
8925
+ import { z as z33 } from "zod/mini";
8754
8926
  var maxCommandSizeBytes = 1024 * 1024;
8755
8927
  var maxCommandsCount = 1e3;
8756
8928
  async function listCommands() {
8757
- const commandsDir = join83(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
8929
+ const commandsDir = join84(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
8758
8930
  try {
8759
8931
  const files = await listDirectoryFiles(commandsDir);
8760
8932
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -8766,7 +8938,7 @@ async function listCommands() {
8766
8938
  });
8767
8939
  const frontmatter = command.getFrontmatter();
8768
8940
  return {
8769
- relativePathFromCwd: join83(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
8941
+ relativePathFromCwd: join84(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
8770
8942
  frontmatter
8771
8943
  };
8772
8944
  } catch (error) {
@@ -8792,7 +8964,7 @@ async function getCommand({ relativePathFromCwd }) {
8792
8964
  relativeFilePath: filename
8793
8965
  });
8794
8966
  return {
8795
- relativePathFromCwd: join83(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
8967
+ relativePathFromCwd: join84(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
8796
8968
  frontmatter: command.getFrontmatter(),
8797
8969
  body: command.getBody()
8798
8970
  };
@@ -8821,7 +8993,7 @@ async function putCommand({
8821
8993
  try {
8822
8994
  const existingCommands = await listCommands();
8823
8995
  const isUpdate = existingCommands.some(
8824
- (command2) => command2.relativePathFromCwd === join83(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
8996
+ (command2) => command2.relativePathFromCwd === join84(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
8825
8997
  );
8826
8998
  if (!isUpdate && existingCommands.length >= maxCommandsCount) {
8827
8999
  throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
@@ -8836,11 +9008,11 @@ async function putCommand({
8836
9008
  fileContent,
8837
9009
  validate: true
8838
9010
  });
8839
- const commandsDir = join83(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
9011
+ const commandsDir = join84(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
8840
9012
  await ensureDir(commandsDir);
8841
9013
  await writeFileContent(command.getFilePath(), command.getFileContent());
8842
9014
  return {
8843
- relativePathFromCwd: join83(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
9015
+ relativePathFromCwd: join84(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
8844
9016
  frontmatter: command.getFrontmatter(),
8845
9017
  body: command.getBody()
8846
9018
  };
@@ -8856,11 +9028,11 @@ async function deleteCommand({ relativePathFromCwd }) {
8856
9028
  intendedRootDir: process.cwd()
8857
9029
  });
8858
9030
  const filename = basename22(relativePathFromCwd);
8859
- const fullPath = join83(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
9031
+ const fullPath = join84(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
8860
9032
  try {
8861
9033
  await removeFile(fullPath);
8862
9034
  return {
8863
- relativePathFromCwd: join83(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
9035
+ relativePathFromCwd: join84(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
8864
9036
  };
8865
9037
  } catch (error) {
8866
9038
  throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
@@ -8869,23 +9041,23 @@ async function deleteCommand({ relativePathFromCwd }) {
8869
9041
  }
8870
9042
  }
8871
9043
  var commandToolSchemas = {
8872
- listCommands: z32.object({}),
8873
- getCommand: z32.object({
8874
- relativePathFromCwd: z32.string()
9044
+ listCommands: z33.object({}),
9045
+ getCommand: z33.object({
9046
+ relativePathFromCwd: z33.string()
8875
9047
  }),
8876
- putCommand: z32.object({
8877
- relativePathFromCwd: z32.string(),
9048
+ putCommand: z33.object({
9049
+ relativePathFromCwd: z33.string(),
8878
9050
  frontmatter: RulesyncCommandFrontmatterSchema,
8879
- body: z32.string()
9051
+ body: z33.string()
8880
9052
  }),
8881
- deleteCommand: z32.object({
8882
- relativePathFromCwd: z32.string()
9053
+ deleteCommand: z33.object({
9054
+ relativePathFromCwd: z33.string()
8883
9055
  })
8884
9056
  };
8885
9057
  var commandTools = {
8886
9058
  listCommands: {
8887
9059
  name: "listCommands",
8888
- description: `List all commands from ${join83(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
9060
+ description: `List all commands from ${join84(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
8889
9061
  parameters: commandToolSchemas.listCommands,
8890
9062
  execute: async () => {
8891
9063
  const commands = await listCommands();
@@ -8927,11 +9099,11 @@ var commandTools = {
8927
9099
  };
8928
9100
 
8929
9101
  // src/mcp/ignore.ts
8930
- import { join as join84 } from "path";
8931
- import { z as z33 } from "zod/mini";
9102
+ import { join as join85 } from "path";
9103
+ import { z as z34 } from "zod/mini";
8932
9104
  var maxIgnoreFileSizeBytes = 100 * 1024;
8933
9105
  async function getIgnoreFile() {
8934
- const ignoreFilePath = join84(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
9106
+ const ignoreFilePath = join85(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
8935
9107
  try {
8936
9108
  const content = await readFileContent(ignoreFilePath);
8937
9109
  return {
@@ -8945,7 +9117,7 @@ async function getIgnoreFile() {
8945
9117
  }
8946
9118
  }
8947
9119
  async function putIgnoreFile({ content }) {
8948
- const ignoreFilePath = join84(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
9120
+ const ignoreFilePath = join85(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
8949
9121
  const contentSizeBytes = Buffer.byteLength(content, "utf8");
8950
9122
  if (contentSizeBytes > maxIgnoreFileSizeBytes) {
8951
9123
  throw new Error(
@@ -8966,8 +9138,8 @@ async function putIgnoreFile({ content }) {
8966
9138
  }
8967
9139
  }
8968
9140
  async function deleteIgnoreFile() {
8969
- const aiignorePath = join84(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
8970
- const legacyIgnorePath = join84(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
9141
+ const aiignorePath = join85(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
9142
+ const legacyIgnorePath = join85(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
8971
9143
  try {
8972
9144
  await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
8973
9145
  return {
@@ -8985,11 +9157,11 @@ async function deleteIgnoreFile() {
8985
9157
  }
8986
9158
  }
8987
9159
  var ignoreToolSchemas = {
8988
- getIgnoreFile: z33.object({}),
8989
- putIgnoreFile: z33.object({
8990
- content: z33.string()
9160
+ getIgnoreFile: z34.object({}),
9161
+ putIgnoreFile: z34.object({
9162
+ content: z34.string()
8991
9163
  }),
8992
- deleteIgnoreFile: z33.object({})
9164
+ deleteIgnoreFile: z34.object({})
8993
9165
  };
8994
9166
  var ignoreTools = {
8995
9167
  getIgnoreFile: {
@@ -9022,8 +9194,8 @@ var ignoreTools = {
9022
9194
  };
9023
9195
 
9024
9196
  // src/mcp/mcp.ts
9025
- import { join as join85 } from "path";
9026
- import { z as z34 } from "zod/mini";
9197
+ import { join as join86 } from "path";
9198
+ import { z as z35 } from "zod/mini";
9027
9199
  var maxMcpSizeBytes = 1024 * 1024;
9028
9200
  async function getMcpFile() {
9029
9201
  const config = await ConfigResolver.resolve({});
@@ -9032,7 +9204,7 @@ async function getMcpFile() {
9032
9204
  validate: true,
9033
9205
  modularMcp: config.getModularMcp()
9034
9206
  });
9035
- const relativePathFromCwd = join85(
9207
+ const relativePathFromCwd = join86(
9036
9208
  rulesyncMcp.getRelativeDirPath(),
9037
9209
  rulesyncMcp.getRelativeFilePath()
9038
9210
  );
@@ -9065,7 +9237,7 @@ async function putMcpFile({ content }) {
9065
9237
  const paths = RulesyncMcp.getSettablePaths();
9066
9238
  const relativeDirPath = paths.recommended.relativeDirPath;
9067
9239
  const relativeFilePath = paths.recommended.relativeFilePath;
9068
- const fullPath = join85(baseDir, relativeDirPath, relativeFilePath);
9240
+ const fullPath = join86(baseDir, relativeDirPath, relativeFilePath);
9069
9241
  const rulesyncMcp = new RulesyncMcp({
9070
9242
  baseDir,
9071
9243
  relativeDirPath,
@@ -9074,9 +9246,9 @@ async function putMcpFile({ content }) {
9074
9246
  validate: true,
9075
9247
  modularMcp: config.getModularMcp()
9076
9248
  });
9077
- await ensureDir(join85(baseDir, relativeDirPath));
9249
+ await ensureDir(join86(baseDir, relativeDirPath));
9078
9250
  await writeFileContent(fullPath, content);
9079
- const relativePathFromCwd = join85(relativeDirPath, relativeFilePath);
9251
+ const relativePathFromCwd = join86(relativeDirPath, relativeFilePath);
9080
9252
  return {
9081
9253
  relativePathFromCwd,
9082
9254
  content: rulesyncMcp.getFileContent()
@@ -9091,15 +9263,15 @@ async function deleteMcpFile() {
9091
9263
  try {
9092
9264
  const baseDir = process.cwd();
9093
9265
  const paths = RulesyncMcp.getSettablePaths();
9094
- const recommendedPath = join85(
9266
+ const recommendedPath = join86(
9095
9267
  baseDir,
9096
9268
  paths.recommended.relativeDirPath,
9097
9269
  paths.recommended.relativeFilePath
9098
9270
  );
9099
- const legacyPath = join85(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
9271
+ const legacyPath = join86(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
9100
9272
  await removeFile(recommendedPath);
9101
9273
  await removeFile(legacyPath);
9102
- const relativePathFromCwd = join85(
9274
+ const relativePathFromCwd = join86(
9103
9275
  paths.recommended.relativeDirPath,
9104
9276
  paths.recommended.relativeFilePath
9105
9277
  );
@@ -9113,11 +9285,11 @@ async function deleteMcpFile() {
9113
9285
  }
9114
9286
  }
9115
9287
  var mcpToolSchemas = {
9116
- getMcpFile: z34.object({}),
9117
- putMcpFile: z34.object({
9118
- content: z34.string()
9288
+ getMcpFile: z35.object({}),
9289
+ putMcpFile: z35.object({
9290
+ content: z35.string()
9119
9291
  }),
9120
- deleteMcpFile: z34.object({})
9292
+ deleteMcpFile: z35.object({})
9121
9293
  };
9122
9294
  var mcpTools = {
9123
9295
  getMcpFile: {
@@ -9150,12 +9322,12 @@ var mcpTools = {
9150
9322
  };
9151
9323
 
9152
9324
  // src/mcp/rules.ts
9153
- import { basename as basename23, join as join86 } from "path";
9154
- import { z as z35 } from "zod/mini";
9325
+ import { basename as basename23, join as join87 } from "path";
9326
+ import { z as z36 } from "zod/mini";
9155
9327
  var maxRuleSizeBytes = 1024 * 1024;
9156
9328
  var maxRulesCount = 1e3;
9157
9329
  async function listRules() {
9158
- const rulesDir = join86(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
9330
+ const rulesDir = join87(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
9159
9331
  try {
9160
9332
  const files = await listDirectoryFiles(rulesDir);
9161
9333
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -9168,7 +9340,7 @@ async function listRules() {
9168
9340
  });
9169
9341
  const frontmatter = rule.getFrontmatter();
9170
9342
  return {
9171
- relativePathFromCwd: join86(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
9343
+ relativePathFromCwd: join87(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
9172
9344
  frontmatter
9173
9345
  };
9174
9346
  } catch (error) {
@@ -9195,7 +9367,7 @@ async function getRule({ relativePathFromCwd }) {
9195
9367
  validate: true
9196
9368
  });
9197
9369
  return {
9198
- relativePathFromCwd: join86(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
9370
+ relativePathFromCwd: join87(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
9199
9371
  frontmatter: rule.getFrontmatter(),
9200
9372
  body: rule.getBody()
9201
9373
  };
@@ -9224,7 +9396,7 @@ async function putRule({
9224
9396
  try {
9225
9397
  const existingRules = await listRules();
9226
9398
  const isUpdate = existingRules.some(
9227
- (rule2) => rule2.relativePathFromCwd === join86(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
9399
+ (rule2) => rule2.relativePathFromCwd === join87(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
9228
9400
  );
9229
9401
  if (!isUpdate && existingRules.length >= maxRulesCount) {
9230
9402
  throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
@@ -9237,11 +9409,11 @@ async function putRule({
9237
9409
  body,
9238
9410
  validate: true
9239
9411
  });
9240
- const rulesDir = join86(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
9412
+ const rulesDir = join87(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
9241
9413
  await ensureDir(rulesDir);
9242
9414
  await writeFileContent(rule.getFilePath(), rule.getFileContent());
9243
9415
  return {
9244
- relativePathFromCwd: join86(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
9416
+ relativePathFromCwd: join87(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
9245
9417
  frontmatter: rule.getFrontmatter(),
9246
9418
  body: rule.getBody()
9247
9419
  };
@@ -9257,11 +9429,11 @@ async function deleteRule({ relativePathFromCwd }) {
9257
9429
  intendedRootDir: process.cwd()
9258
9430
  });
9259
9431
  const filename = basename23(relativePathFromCwd);
9260
- const fullPath = join86(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
9432
+ const fullPath = join87(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
9261
9433
  try {
9262
9434
  await removeFile(fullPath);
9263
9435
  return {
9264
- relativePathFromCwd: join86(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
9436
+ relativePathFromCwd: join87(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
9265
9437
  };
9266
9438
  } catch (error) {
9267
9439
  throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
@@ -9270,23 +9442,23 @@ async function deleteRule({ relativePathFromCwd }) {
9270
9442
  }
9271
9443
  }
9272
9444
  var ruleToolSchemas = {
9273
- listRules: z35.object({}),
9274
- getRule: z35.object({
9275
- relativePathFromCwd: z35.string()
9445
+ listRules: z36.object({}),
9446
+ getRule: z36.object({
9447
+ relativePathFromCwd: z36.string()
9276
9448
  }),
9277
- putRule: z35.object({
9278
- relativePathFromCwd: z35.string(),
9449
+ putRule: z36.object({
9450
+ relativePathFromCwd: z36.string(),
9279
9451
  frontmatter: RulesyncRuleFrontmatterSchema,
9280
- body: z35.string()
9452
+ body: z36.string()
9281
9453
  }),
9282
- deleteRule: z35.object({
9283
- relativePathFromCwd: z35.string()
9454
+ deleteRule: z36.object({
9455
+ relativePathFromCwd: z36.string()
9284
9456
  })
9285
9457
  };
9286
9458
  var ruleTools = {
9287
9459
  listRules: {
9288
9460
  name: "listRules",
9289
- description: `List all rules from ${join86(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
9461
+ description: `List all rules from ${join87(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
9290
9462
  parameters: ruleToolSchemas.listRules,
9291
9463
  execute: async () => {
9292
9464
  const rules = await listRules();
@@ -9328,8 +9500,8 @@ var ruleTools = {
9328
9500
  };
9329
9501
 
9330
9502
  // src/mcp/skills.ts
9331
- import { basename as basename24, dirname as dirname2, join as join87 } from "path";
9332
- import { z as z36 } from "zod/mini";
9503
+ import { basename as basename24, dirname as dirname2, join as join88 } from "path";
9504
+ import { z as z37 } from "zod/mini";
9333
9505
  var maxSkillSizeBytes = 1024 * 1024;
9334
9506
  var maxSkillsCount = 1e3;
9335
9507
  function aiDirFileToMcpSkillFile(file) {
@@ -9352,9 +9524,9 @@ function extractDirName(relativeDirPathFromCwd) {
9352
9524
  return dirName;
9353
9525
  }
9354
9526
  async function listSkills() {
9355
- const skillsDir = join87(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
9527
+ const skillsDir = join88(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
9356
9528
  try {
9357
- const skillDirPaths = await findFilesByGlobs(join87(skillsDir, "*"), { type: "dir" });
9529
+ const skillDirPaths = await findFilesByGlobs(join88(skillsDir, "*"), { type: "dir" });
9358
9530
  const skills = await Promise.all(
9359
9531
  skillDirPaths.map(async (dirPath) => {
9360
9532
  const dirName = basename24(dirPath);
@@ -9365,7 +9537,7 @@ async function listSkills() {
9365
9537
  });
9366
9538
  const frontmatter = skill.getFrontmatter();
9367
9539
  return {
9368
- relativeDirPathFromCwd: join87(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
9540
+ relativeDirPathFromCwd: join88(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
9369
9541
  frontmatter
9370
9542
  };
9371
9543
  } catch (error) {
@@ -9391,7 +9563,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
9391
9563
  dirName
9392
9564
  });
9393
9565
  return {
9394
- relativeDirPathFromCwd: join87(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
9566
+ relativeDirPathFromCwd: join88(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
9395
9567
  frontmatter: skill.getFrontmatter(),
9396
9568
  body: skill.getBody(),
9397
9569
  otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
@@ -9425,7 +9597,7 @@ async function putSkill({
9425
9597
  try {
9426
9598
  const existingSkills = await listSkills();
9427
9599
  const isUpdate = existingSkills.some(
9428
- (skill2) => skill2.relativeDirPathFromCwd === join87(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
9600
+ (skill2) => skill2.relativeDirPathFromCwd === join88(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
9429
9601
  );
9430
9602
  if (!isUpdate && existingSkills.length >= maxSkillsCount) {
9431
9603
  throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
@@ -9440,9 +9612,9 @@ async function putSkill({
9440
9612
  otherFiles: aiDirFiles,
9441
9613
  validate: true
9442
9614
  });
9443
- const skillDirPath = join87(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
9615
+ const skillDirPath = join88(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
9444
9616
  await ensureDir(skillDirPath);
9445
- const skillFilePath = join87(skillDirPath, SKILL_FILE_NAME);
9617
+ const skillFilePath = join88(skillDirPath, SKILL_FILE_NAME);
9446
9618
  const skillFileContent = stringifyFrontmatter(body, frontmatter);
9447
9619
  await writeFileContent(skillFilePath, skillFileContent);
9448
9620
  for (const file of otherFiles) {
@@ -9450,15 +9622,15 @@ async function putSkill({
9450
9622
  relativePath: file.name,
9451
9623
  intendedRootDir: skillDirPath
9452
9624
  });
9453
- const filePath = join87(skillDirPath, file.name);
9454
- const fileDir = join87(skillDirPath, dirname2(file.name));
9625
+ const filePath = join88(skillDirPath, file.name);
9626
+ const fileDir = join88(skillDirPath, dirname2(file.name));
9455
9627
  if (fileDir !== skillDirPath) {
9456
9628
  await ensureDir(fileDir);
9457
9629
  }
9458
9630
  await writeFileContent(filePath, file.body);
9459
9631
  }
9460
9632
  return {
9461
- relativeDirPathFromCwd: join87(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
9633
+ relativeDirPathFromCwd: join88(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
9462
9634
  frontmatter: skill.getFrontmatter(),
9463
9635
  body: skill.getBody(),
9464
9636
  otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
@@ -9480,13 +9652,13 @@ async function deleteSkill({
9480
9652
  intendedRootDir: process.cwd()
9481
9653
  });
9482
9654
  const dirName = extractDirName(relativeDirPathFromCwd);
9483
- const skillDirPath = join87(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
9655
+ const skillDirPath = join88(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
9484
9656
  try {
9485
9657
  if (await directoryExists(skillDirPath)) {
9486
9658
  await removeDirectory(skillDirPath);
9487
9659
  }
9488
9660
  return {
9489
- relativeDirPathFromCwd: join87(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
9661
+ relativeDirPathFromCwd: join88(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
9490
9662
  };
9491
9663
  } catch (error) {
9492
9664
  throw new Error(
@@ -9497,29 +9669,29 @@ async function deleteSkill({
9497
9669
  );
9498
9670
  }
9499
9671
  }
9500
- var McpSkillFileSchema = z36.object({
9501
- name: z36.string(),
9502
- body: z36.string()
9672
+ var McpSkillFileSchema = z37.object({
9673
+ name: z37.string(),
9674
+ body: z37.string()
9503
9675
  });
9504
9676
  var skillToolSchemas = {
9505
- listSkills: z36.object({}),
9506
- getSkill: z36.object({
9507
- relativeDirPathFromCwd: z36.string()
9677
+ listSkills: z37.object({}),
9678
+ getSkill: z37.object({
9679
+ relativeDirPathFromCwd: z37.string()
9508
9680
  }),
9509
- putSkill: z36.object({
9510
- relativeDirPathFromCwd: z36.string(),
9681
+ putSkill: z37.object({
9682
+ relativeDirPathFromCwd: z37.string(),
9511
9683
  frontmatter: RulesyncSkillFrontmatterSchema,
9512
- body: z36.string(),
9513
- otherFiles: z36.optional(z36.array(McpSkillFileSchema))
9684
+ body: z37.string(),
9685
+ otherFiles: z37.optional(z37.array(McpSkillFileSchema))
9514
9686
  }),
9515
- deleteSkill: z36.object({
9516
- relativeDirPathFromCwd: z36.string()
9687
+ deleteSkill: z37.object({
9688
+ relativeDirPathFromCwd: z37.string()
9517
9689
  })
9518
9690
  };
9519
9691
  var skillTools = {
9520
9692
  listSkills: {
9521
9693
  name: "listSkills",
9522
- description: `List all skills from ${join87(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
9694
+ description: `List all skills from ${join88(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
9523
9695
  parameters: skillToolSchemas.listSkills,
9524
9696
  execute: async () => {
9525
9697
  const skills = await listSkills();
@@ -9562,12 +9734,12 @@ var skillTools = {
9562
9734
  };
9563
9735
 
9564
9736
  // src/mcp/subagents.ts
9565
- import { basename as basename25, join as join88 } from "path";
9566
- import { z as z37 } from "zod/mini";
9737
+ import { basename as basename25, join as join89 } from "path";
9738
+ import { z as z38 } from "zod/mini";
9567
9739
  var maxSubagentSizeBytes = 1024 * 1024;
9568
9740
  var maxSubagentsCount = 1e3;
9569
9741
  async function listSubagents() {
9570
- const subagentsDir = join88(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
9742
+ const subagentsDir = join89(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
9571
9743
  try {
9572
9744
  const files = await listDirectoryFiles(subagentsDir);
9573
9745
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -9580,7 +9752,7 @@ async function listSubagents() {
9580
9752
  });
9581
9753
  const frontmatter = subagent.getFrontmatter();
9582
9754
  return {
9583
- relativePathFromCwd: join88(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
9755
+ relativePathFromCwd: join89(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
9584
9756
  frontmatter
9585
9757
  };
9586
9758
  } catch (error) {
@@ -9609,7 +9781,7 @@ async function getSubagent({ relativePathFromCwd }) {
9609
9781
  validate: true
9610
9782
  });
9611
9783
  return {
9612
- relativePathFromCwd: join88(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
9784
+ relativePathFromCwd: join89(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
9613
9785
  frontmatter: subagent.getFrontmatter(),
9614
9786
  body: subagent.getBody()
9615
9787
  };
@@ -9638,7 +9810,7 @@ async function putSubagent({
9638
9810
  try {
9639
9811
  const existingSubagents = await listSubagents();
9640
9812
  const isUpdate = existingSubagents.some(
9641
- (subagent2) => subagent2.relativePathFromCwd === join88(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
9813
+ (subagent2) => subagent2.relativePathFromCwd === join89(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
9642
9814
  );
9643
9815
  if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
9644
9816
  throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
@@ -9651,11 +9823,11 @@ async function putSubagent({
9651
9823
  body,
9652
9824
  validate: true
9653
9825
  });
9654
- const subagentsDir = join88(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
9826
+ const subagentsDir = join89(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
9655
9827
  await ensureDir(subagentsDir);
9656
9828
  await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
9657
9829
  return {
9658
- relativePathFromCwd: join88(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
9830
+ relativePathFromCwd: join89(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
9659
9831
  frontmatter: subagent.getFrontmatter(),
9660
9832
  body: subagent.getBody()
9661
9833
  };
@@ -9671,11 +9843,11 @@ async function deleteSubagent({ relativePathFromCwd }) {
9671
9843
  intendedRootDir: process.cwd()
9672
9844
  });
9673
9845
  const filename = basename25(relativePathFromCwd);
9674
- const fullPath = join88(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
9846
+ const fullPath = join89(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
9675
9847
  try {
9676
9848
  await removeFile(fullPath);
9677
9849
  return {
9678
- relativePathFromCwd: join88(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
9850
+ relativePathFromCwd: join89(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
9679
9851
  };
9680
9852
  } catch (error) {
9681
9853
  throw new Error(
@@ -9687,23 +9859,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
9687
9859
  }
9688
9860
  }
9689
9861
  var subagentToolSchemas = {
9690
- listSubagents: z37.object({}),
9691
- getSubagent: z37.object({
9692
- relativePathFromCwd: z37.string()
9862
+ listSubagents: z38.object({}),
9863
+ getSubagent: z38.object({
9864
+ relativePathFromCwd: z38.string()
9693
9865
  }),
9694
- putSubagent: z37.object({
9695
- relativePathFromCwd: z37.string(),
9866
+ putSubagent: z38.object({
9867
+ relativePathFromCwd: z38.string(),
9696
9868
  frontmatter: RulesyncSubagentFrontmatterSchema,
9697
- body: z37.string()
9869
+ body: z38.string()
9698
9870
  }),
9699
- deleteSubagent: z37.object({
9700
- relativePathFromCwd: z37.string()
9871
+ deleteSubagent: z38.object({
9872
+ relativePathFromCwd: z38.string()
9701
9873
  })
9702
9874
  };
9703
9875
  var subagentTools = {
9704
9876
  listSubagents: {
9705
9877
  name: "listSubagents",
9706
- description: `List all subagents from ${join88(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
9878
+ description: `List all subagents from ${join89(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
9707
9879
  parameters: subagentToolSchemas.listSubagents,
9708
9880
  execute: async () => {
9709
9881
  const subagents = await listSubagents();
@@ -9781,7 +9953,7 @@ async function mcpCommand({ version }) {
9781
9953
  }
9782
9954
 
9783
9955
  // src/cli/index.ts
9784
- var getVersion = () => "3.30.0";
9956
+ var getVersion = () => "3.31.0";
9785
9957
  var main = async () => {
9786
9958
  const program = new Command();
9787
9959
  const version = getVersion();