rulesync 4.2.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +21 -18
  2. package/dist/index.cjs +595 -293
  3. package/dist/index.js +595 -293
  4. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4706,7 +4706,7 @@ var McpProcessor = class extends FeatureProcessor {
4706
4706
  // src/features/rules/rules-processor.ts
4707
4707
  import { basename as basename21, join as join84 } from "path";
4708
4708
  import { encode } from "@toon-format/toon";
4709
- import { z as z38 } from "zod/mini";
4709
+ import { z as z39 } from "zod/mini";
4710
4710
 
4711
4711
  // src/constants/general.ts
4712
4712
  var SKILL_FILE_NAME = "SKILL.md";
@@ -5137,127 +5137,11 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
5137
5137
  };
5138
5138
 
5139
5139
  // src/features/skills/cursor-skill.ts
5140
- import { join as join43 } from "path";
5141
- var CursorSkill = class _CursorSkill extends SimulatedSkill {
5142
- static getSettablePaths(options) {
5143
- if (options?.global) {
5144
- throw new Error("CursorSkill does not support global mode.");
5145
- }
5146
- return {
5147
- relativeDirPath: join43(".cursor", "skills")
5148
- };
5149
- }
5150
- static async fromDir(params) {
5151
- const baseParams = await this.fromDirDefault(params);
5152
- return new _CursorSkill(baseParams);
5153
- }
5154
- static fromRulesyncSkill(params) {
5155
- const baseParams = {
5156
- ...this.fromRulesyncSkillDefault(params),
5157
- relativeDirPath: this.getSettablePaths().relativeDirPath
5158
- };
5159
- return new _CursorSkill(baseParams);
5160
- }
5161
- static isTargetedByRulesyncSkill(rulesyncSkill) {
5162
- return this.isTargetedByRulesyncSkillDefault({
5163
- rulesyncSkill,
5164
- toolTarget: "cursor"
5165
- });
5166
- }
5167
- static forDeletion(params) {
5168
- const baseParams = this.forDeletionDefault(params);
5169
- return new _CursorSkill(baseParams);
5170
- }
5171
- };
5172
-
5173
- // src/features/skills/geminicli-skill.ts
5174
5140
  import { join as join44 } from "path";
5175
- var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
5176
- static getSettablePaths(options) {
5177
- if (options?.global) {
5178
- throw new Error("GeminiCliSkill does not support global mode.");
5179
- }
5180
- return {
5181
- relativeDirPath: join44(".gemini", "skills")
5182
- };
5183
- }
5184
- static async fromDir(params) {
5185
- const baseParams = await this.fromDirDefault(params);
5186
- return new _GeminiCliSkill(baseParams);
5187
- }
5188
- static fromRulesyncSkill(params) {
5189
- const baseParams = {
5190
- ...this.fromRulesyncSkillDefault(params),
5191
- relativeDirPath: this.getSettablePaths().relativeDirPath
5192
- };
5193
- return new _GeminiCliSkill(baseParams);
5194
- }
5195
- static isTargetedByRulesyncSkill(rulesyncSkill) {
5196
- return this.isTargetedByRulesyncSkillDefault({
5197
- rulesyncSkill,
5198
- toolTarget: "geminicli"
5199
- });
5200
- }
5201
- static forDeletion(params) {
5202
- const baseParams = this.forDeletionDefault(params);
5203
- return new _GeminiCliSkill(baseParams);
5204
- }
5205
- };
5206
-
5207
- // src/features/skills/skills-processor.ts
5208
- import { basename as basename14, join as join51 } from "path";
5209
- import { z as z25 } from "zod/mini";
5210
-
5211
- // src/types/dir-feature-processor.ts
5212
- import { join as join45 } from "path";
5213
- var DirFeatureProcessor = class {
5214
- baseDir;
5215
- constructor({ baseDir = process.cwd() }) {
5216
- this.baseDir = baseDir;
5217
- }
5218
- /**
5219
- * Return tool targets that this feature supports.
5220
- */
5221
- static getToolTargets(_params = {}) {
5222
- throw new Error("Not implemented");
5223
- }
5224
- /**
5225
- * Once converted to rulesync/tool dirs, write them to the filesystem.
5226
- * Returns the number of directories written.
5227
- */
5228
- async writeAiDirs(aiDirs) {
5229
- for (const aiDir of aiDirs) {
5230
- const dirPath = aiDir.getDirPath();
5231
- await ensureDir(dirPath);
5232
- const mainFile = aiDir.getMainFile();
5233
- if (mainFile) {
5234
- const mainFilePath = join45(dirPath, mainFile.name);
5235
- const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
5236
- const contentWithNewline = addTrailingNewline(content);
5237
- await writeFileContent(mainFilePath, contentWithNewline);
5238
- }
5239
- const otherFiles = aiDir.getOtherFiles();
5240
- for (const file of otherFiles) {
5241
- const filePath = join45(dirPath, file.relativeFilePathToDirPath);
5242
- const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
5243
- await writeFileContent(filePath, contentWithNewline);
5244
- }
5245
- }
5246
- return aiDirs.length;
5247
- }
5248
- async removeAiDirs(aiDirs) {
5249
- for (const aiDir of aiDirs) {
5250
- await removeDirectory(aiDir.getDirPath());
5251
- }
5252
- }
5253
- };
5254
-
5255
- // src/features/skills/claudecode-skill.ts
5256
- import { join as join47 } from "path";
5257
5141
  import { z as z21 } from "zod/mini";
5258
5142
 
5259
5143
  // src/features/skills/rulesync-skill.ts
5260
- import { join as join46 } from "path";
5144
+ import { join as join43 } from "path";
5261
5145
  import { z as z20 } from "zod/mini";
5262
5146
  var RulesyncSkillFrontmatterSchemaInternal = z20.looseObject({
5263
5147
  name: z20.string(),
@@ -5343,8 +5227,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
5343
5227
  dirName,
5344
5228
  global = false
5345
5229
  }) {
5346
- const skillDirPath = join46(baseDir, relativeDirPath, dirName);
5347
- const skillFilePath = join46(skillDirPath, SKILL_FILE_NAME);
5230
+ const skillDirPath = join43(baseDir, relativeDirPath, dirName);
5231
+ const skillFilePath = join43(skillDirPath, SKILL_FILE_NAME);
5348
5232
  if (!await fileExists(skillFilePath)) {
5349
5233
  throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
5350
5234
  }
@@ -5373,11 +5257,253 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
5373
5257
  }
5374
5258
  };
5375
5259
 
5376
- // src/features/skills/claudecode-skill.ts
5377
- var ClaudecodeSkillFrontmatterSchema = z21.looseObject({
5260
+ // src/features/skills/cursor-skill.ts
5261
+ var CursorSkillFrontmatterSchema = z21.looseObject({
5378
5262
  name: z21.string(),
5379
- description: z21.string(),
5380
- "allowed-tools": z21.optional(z21.array(z21.string()))
5263
+ description: z21.string()
5264
+ });
5265
+ var CursorSkill = class _CursorSkill extends ToolSkill {
5266
+ constructor({
5267
+ baseDir = process.cwd(),
5268
+ relativeDirPath = join44(".cursor", "skills"),
5269
+ dirName,
5270
+ frontmatter,
5271
+ body,
5272
+ otherFiles = [],
5273
+ validate = true,
5274
+ global = false
5275
+ }) {
5276
+ super({
5277
+ baseDir,
5278
+ relativeDirPath,
5279
+ dirName,
5280
+ mainFile: {
5281
+ name: SKILL_FILE_NAME,
5282
+ body,
5283
+ frontmatter: { ...frontmatter }
5284
+ },
5285
+ otherFiles,
5286
+ global
5287
+ });
5288
+ if (validate) {
5289
+ const result = this.validate();
5290
+ if (!result.success) {
5291
+ throw result.error;
5292
+ }
5293
+ }
5294
+ }
5295
+ static getSettablePaths(options) {
5296
+ if (options?.global) {
5297
+ throw new Error("CursorSkill does not support global mode.");
5298
+ }
5299
+ return {
5300
+ relativeDirPath: join44(".cursor", "skills")
5301
+ };
5302
+ }
5303
+ getFrontmatter() {
5304
+ if (!this.mainFile?.frontmatter) {
5305
+ throw new Error("Frontmatter is not defined");
5306
+ }
5307
+ const result = CursorSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
5308
+ return result;
5309
+ }
5310
+ getBody() {
5311
+ return this.mainFile?.body ?? "";
5312
+ }
5313
+ validate() {
5314
+ if (!this.mainFile) {
5315
+ return {
5316
+ success: false,
5317
+ error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
5318
+ };
5319
+ }
5320
+ const result = CursorSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
5321
+ if (!result.success) {
5322
+ return {
5323
+ success: false,
5324
+ error: new Error(
5325
+ `Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
5326
+ )
5327
+ };
5328
+ }
5329
+ return { success: true, error: null };
5330
+ }
5331
+ toRulesyncSkill() {
5332
+ const frontmatter = this.getFrontmatter();
5333
+ const rulesyncFrontmatter = {
5334
+ name: frontmatter.name,
5335
+ description: frontmatter.description,
5336
+ targets: ["*"]
5337
+ };
5338
+ return new RulesyncSkill({
5339
+ baseDir: this.baseDir,
5340
+ relativeDirPath: this.relativeDirPath,
5341
+ dirName: this.getDirName(),
5342
+ frontmatter: rulesyncFrontmatter,
5343
+ body: this.getBody(),
5344
+ otherFiles: this.getOtherFiles(),
5345
+ validate: true,
5346
+ global: this.global
5347
+ });
5348
+ }
5349
+ static fromRulesyncSkill({
5350
+ rulesyncSkill,
5351
+ validate = true,
5352
+ global = false
5353
+ }) {
5354
+ const settablePaths = _CursorSkill.getSettablePaths({ global });
5355
+ const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
5356
+ const cursorFrontmatter = {
5357
+ name: rulesyncFrontmatter.name,
5358
+ description: rulesyncFrontmatter.description
5359
+ };
5360
+ return new _CursorSkill({
5361
+ baseDir: rulesyncSkill.getBaseDir(),
5362
+ relativeDirPath: settablePaths.relativeDirPath,
5363
+ dirName: rulesyncSkill.getDirName(),
5364
+ frontmatter: cursorFrontmatter,
5365
+ body: rulesyncSkill.getBody(),
5366
+ otherFiles: rulesyncSkill.getOtherFiles(),
5367
+ validate,
5368
+ global
5369
+ });
5370
+ }
5371
+ static isTargetedByRulesyncSkill(rulesyncSkill) {
5372
+ const targets = rulesyncSkill.getFrontmatter().targets;
5373
+ return targets.includes("*") || targets.includes("cursor");
5374
+ }
5375
+ static async fromDir(params) {
5376
+ const loaded = await this.loadSkillDirContent({
5377
+ ...params,
5378
+ getSettablePaths: _CursorSkill.getSettablePaths
5379
+ });
5380
+ const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
5381
+ if (!result.success) {
5382
+ const skillDirPath = join44(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
5383
+ throw new Error(
5384
+ `Invalid frontmatter in ${join44(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
5385
+ );
5386
+ }
5387
+ return new _CursorSkill({
5388
+ baseDir: loaded.baseDir,
5389
+ relativeDirPath: loaded.relativeDirPath,
5390
+ dirName: loaded.dirName,
5391
+ frontmatter: result.data,
5392
+ body: loaded.body,
5393
+ otherFiles: loaded.otherFiles,
5394
+ validate: true,
5395
+ global: loaded.global
5396
+ });
5397
+ }
5398
+ static forDeletion({
5399
+ baseDir = process.cwd(),
5400
+ relativeDirPath,
5401
+ dirName,
5402
+ global = false
5403
+ }) {
5404
+ const settablePaths = _CursorSkill.getSettablePaths({ global });
5405
+ return new _CursorSkill({
5406
+ baseDir,
5407
+ relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
5408
+ dirName,
5409
+ frontmatter: { name: "", description: "" },
5410
+ body: "",
5411
+ otherFiles: [],
5412
+ validate: false,
5413
+ global
5414
+ });
5415
+ }
5416
+ };
5417
+
5418
+ // src/features/skills/geminicli-skill.ts
5419
+ import { join as join45 } from "path";
5420
+ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
5421
+ static getSettablePaths(options) {
5422
+ if (options?.global) {
5423
+ throw new Error("GeminiCliSkill does not support global mode.");
5424
+ }
5425
+ return {
5426
+ relativeDirPath: join45(".gemini", "skills")
5427
+ };
5428
+ }
5429
+ static async fromDir(params) {
5430
+ const baseParams = await this.fromDirDefault(params);
5431
+ return new _GeminiCliSkill(baseParams);
5432
+ }
5433
+ static fromRulesyncSkill(params) {
5434
+ const baseParams = {
5435
+ ...this.fromRulesyncSkillDefault(params),
5436
+ relativeDirPath: this.getSettablePaths().relativeDirPath
5437
+ };
5438
+ return new _GeminiCliSkill(baseParams);
5439
+ }
5440
+ static isTargetedByRulesyncSkill(rulesyncSkill) {
5441
+ return this.isTargetedByRulesyncSkillDefault({
5442
+ rulesyncSkill,
5443
+ toolTarget: "geminicli"
5444
+ });
5445
+ }
5446
+ static forDeletion(params) {
5447
+ const baseParams = this.forDeletionDefault(params);
5448
+ return new _GeminiCliSkill(baseParams);
5449
+ }
5450
+ };
5451
+
5452
+ // src/features/skills/skills-processor.ts
5453
+ import { basename as basename14, join as join51 } from "path";
5454
+ import { z as z26 } from "zod/mini";
5455
+
5456
+ // src/types/dir-feature-processor.ts
5457
+ import { join as join46 } from "path";
5458
+ var DirFeatureProcessor = class {
5459
+ baseDir;
5460
+ constructor({ baseDir = process.cwd() }) {
5461
+ this.baseDir = baseDir;
5462
+ }
5463
+ /**
5464
+ * Return tool targets that this feature supports.
5465
+ */
5466
+ static getToolTargets(_params = {}) {
5467
+ throw new Error("Not implemented");
5468
+ }
5469
+ /**
5470
+ * Once converted to rulesync/tool dirs, write them to the filesystem.
5471
+ * Returns the number of directories written.
5472
+ */
5473
+ async writeAiDirs(aiDirs) {
5474
+ for (const aiDir of aiDirs) {
5475
+ const dirPath = aiDir.getDirPath();
5476
+ await ensureDir(dirPath);
5477
+ const mainFile = aiDir.getMainFile();
5478
+ if (mainFile) {
5479
+ const mainFilePath = join46(dirPath, mainFile.name);
5480
+ const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
5481
+ const contentWithNewline = addTrailingNewline(content);
5482
+ await writeFileContent(mainFilePath, contentWithNewline);
5483
+ }
5484
+ const otherFiles = aiDir.getOtherFiles();
5485
+ for (const file of otherFiles) {
5486
+ const filePath = join46(dirPath, file.relativeFilePathToDirPath);
5487
+ const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
5488
+ await writeFileContent(filePath, contentWithNewline);
5489
+ }
5490
+ }
5491
+ return aiDirs.length;
5492
+ }
5493
+ async removeAiDirs(aiDirs) {
5494
+ for (const aiDir of aiDirs) {
5495
+ await removeDirectory(aiDir.getDirPath());
5496
+ }
5497
+ }
5498
+ };
5499
+
5500
+ // src/features/skills/claudecode-skill.ts
5501
+ import { join as join47 } from "path";
5502
+ import { z as z22 } from "zod/mini";
5503
+ var ClaudecodeSkillFrontmatterSchema = z22.looseObject({
5504
+ name: z22.string(),
5505
+ description: z22.string(),
5506
+ "allowed-tools": z22.optional(z22.array(z22.string()))
5381
5507
  });
5382
5508
  var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
5383
5509
  constructor({
@@ -5538,10 +5664,10 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
5538
5664
 
5539
5665
  // src/features/skills/codexcli-skill.ts
5540
5666
  import { join as join48 } from "path";
5541
- import { z as z22 } from "zod/mini";
5542
- var CodexCliSkillFrontmatterSchema = z22.looseObject({
5543
- name: z22.string(),
5544
- description: z22.string()
5667
+ import { z as z23 } from "zod/mini";
5668
+ var CodexCliSkillFrontmatterSchema = z23.looseObject({
5669
+ name: z23.string(),
5670
+ description: z23.string()
5545
5671
  });
5546
5672
  var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
5547
5673
  constructor({
@@ -5697,11 +5823,11 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
5697
5823
 
5698
5824
  // src/features/skills/copilot-skill.ts
5699
5825
  import { join as join49 } from "path";
5700
- import { z as z23 } from "zod/mini";
5701
- var CopilotSkillFrontmatterSchema = z23.looseObject({
5702
- name: z23.string(),
5703
- description: z23.string(),
5704
- license: z23.optional(z23.string())
5826
+ import { z as z24 } from "zod/mini";
5827
+ var CopilotSkillFrontmatterSchema = z24.looseObject({
5828
+ name: z24.string(),
5829
+ description: z24.string(),
5830
+ license: z24.optional(z24.string())
5705
5831
  });
5706
5832
  var CopilotSkill = class _CopilotSkill extends ToolSkill {
5707
5833
  constructor({
@@ -5864,11 +5990,11 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
5864
5990
 
5865
5991
  // src/features/skills/opencode-skill.ts
5866
5992
  import { join as join50 } from "path";
5867
- import { z as z24 } from "zod/mini";
5868
- var OpenCodeSkillFrontmatterSchema = z24.looseObject({
5869
- name: z24.string(),
5870
- description: z24.string(),
5871
- "allowed-tools": z24.optional(z24.array(z24.string()))
5993
+ import { z as z25 } from "zod/mini";
5994
+ var OpenCodeSkillFrontmatterSchema = z25.looseObject({
5995
+ name: z25.string(),
5996
+ description: z25.string(),
5997
+ "allowed-tools": z25.optional(z25.array(z25.string()))
5872
5998
  });
5873
5999
  var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
5874
6000
  constructor({
@@ -6035,7 +6161,7 @@ var skillsProcessorToolTargetTuple = [
6035
6161
  "geminicli",
6036
6162
  "opencode"
6037
6163
  ];
6038
- var SkillsProcessorToolTargetSchema = z25.enum(skillsProcessorToolTargetTuple);
6164
+ var SkillsProcessorToolTargetSchema = z26.enum(skillsProcessorToolTargetTuple);
6039
6165
  var toolSkillFactories = /* @__PURE__ */ new Map([
6040
6166
  [
6041
6167
  "agentsmd",
@@ -6069,7 +6195,7 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
6069
6195
  "cursor",
6070
6196
  {
6071
6197
  class: CursorSkill,
6072
- meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
6198
+ meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: false }
6073
6199
  }
6074
6200
  ],
6075
6201
  [
@@ -6254,7 +6380,7 @@ import { join as join53 } from "path";
6254
6380
 
6255
6381
  // src/features/subagents/simulated-subagent.ts
6256
6382
  import { basename as basename15, join as join52 } from "path";
6257
- import { z as z26 } from "zod/mini";
6383
+ import { z as z27 } from "zod/mini";
6258
6384
 
6259
6385
  // src/features/subagents/tool-subagent.ts
6260
6386
  var ToolSubagent = class extends ToolFile {
@@ -6297,9 +6423,9 @@ var ToolSubagent = class extends ToolFile {
6297
6423
  };
6298
6424
 
6299
6425
  // src/features/subagents/simulated-subagent.ts
6300
- var SimulatedSubagentFrontmatterSchema = z26.object({
6301
- name: z26.string(),
6302
- description: z26.string()
6426
+ var SimulatedSubagentFrontmatterSchema = z27.object({
6427
+ name: z27.string(),
6428
+ description: z27.string()
6303
6429
  });
6304
6430
  var SimulatedSubagent = class extends ToolSubagent {
6305
6431
  frontmatter;
@@ -6538,19 +6664,19 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
6538
6664
 
6539
6665
  // src/features/subagents/subagents-processor.ts
6540
6666
  import { basename as basename18, join as join62 } from "path";
6541
- import { z as z31 } from "zod/mini";
6667
+ import { z as z32 } from "zod/mini";
6542
6668
 
6543
6669
  // src/features/subagents/claudecode-subagent.ts
6544
6670
  import { join as join59 } from "path";
6545
- import { z as z28 } from "zod/mini";
6671
+ import { z as z29 } from "zod/mini";
6546
6672
 
6547
6673
  // src/features/subagents/rulesync-subagent.ts
6548
6674
  import { basename as basename16, join as join58 } from "path";
6549
- import { z as z27 } from "zod/mini";
6550
- var RulesyncSubagentFrontmatterSchema = z27.looseObject({
6675
+ import { z as z28 } from "zod/mini";
6676
+ var RulesyncSubagentFrontmatterSchema = z28.looseObject({
6551
6677
  targets: RulesyncTargetsSchema,
6552
- name: z27.string(),
6553
- description: z27.string()
6678
+ name: z28.string(),
6679
+ description: z28.string()
6554
6680
  });
6555
6681
  var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
6556
6682
  frontmatter;
@@ -6621,13 +6747,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
6621
6747
  };
6622
6748
 
6623
6749
  // src/features/subagents/claudecode-subagent.ts
6624
- var ClaudecodeSubagentFrontmatterSchema = z28.looseObject({
6625
- name: z28.string(),
6626
- description: z28.string(),
6627
- model: z28.optional(z28.string()),
6628
- tools: z28.optional(z28.union([z28.string(), z28.array(z28.string())])),
6629
- permissionMode: z28.optional(z28.string()),
6630
- skills: z28.optional(z28.union([z28.string(), z28.array(z28.string())]))
6750
+ var ClaudecodeSubagentFrontmatterSchema = z29.looseObject({
6751
+ name: z29.string(),
6752
+ description: z29.string(),
6753
+ model: z29.optional(z29.string()),
6754
+ tools: z29.optional(z29.union([z29.string(), z29.array(z29.string())])),
6755
+ permissionMode: z29.optional(z29.string()),
6756
+ skills: z29.optional(z29.union([z29.string(), z29.array(z29.string())]))
6631
6757
  });
6632
6758
  var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
6633
6759
  frontmatter;
@@ -6777,12 +6903,12 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
6777
6903
 
6778
6904
  // src/features/subagents/copilot-subagent.ts
6779
6905
  import { join as join60 } from "path";
6780
- import { z as z29 } from "zod/mini";
6906
+ import { z as z30 } from "zod/mini";
6781
6907
  var REQUIRED_TOOL = "agent/runSubagent";
6782
- var CopilotSubagentFrontmatterSchema = z29.looseObject({
6783
- name: z29.string(),
6784
- description: z29.string(),
6785
- tools: z29.optional(z29.union([z29.string(), z29.array(z29.string())]))
6908
+ var CopilotSubagentFrontmatterSchema = z30.looseObject({
6909
+ name: z30.string(),
6910
+ description: z30.string(),
6911
+ tools: z30.optional(z30.union([z30.string(), z30.array(z30.string())]))
6786
6912
  });
6787
6913
  var normalizeTools = (tools) => {
6788
6914
  if (!tools) {
@@ -6943,11 +7069,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
6943
7069
 
6944
7070
  // src/features/subagents/opencode-subagent.ts
6945
7071
  import { basename as basename17, join as join61 } from "path";
6946
- import { z as z30 } from "zod/mini";
6947
- var OpenCodeSubagentFrontmatterSchema = z30.looseObject({
6948
- description: z30.string(),
6949
- mode: z30.literal("subagent"),
6950
- name: z30.optional(z30.string())
7072
+ import { z as z31 } from "zod/mini";
7073
+ var OpenCodeSubagentFrontmatterSchema = z31.looseObject({
7074
+ description: z31.string(),
7075
+ mode: z31.literal("subagent"),
7076
+ name: z31.optional(z31.string())
6951
7077
  });
6952
7078
  var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
6953
7079
  frontmatter;
@@ -7100,7 +7226,7 @@ var subagentsProcessorToolTargetTuple = [
7100
7226
  "opencode",
7101
7227
  "roo"
7102
7228
  ];
7103
- var SubagentsProcessorToolTargetSchema = z31.enum(subagentsProcessorToolTargetTuple);
7229
+ var SubagentsProcessorToolTargetSchema = z32.enum(subagentsProcessorToolTargetTuple);
7104
7230
  var toolSubagentFactories = /* @__PURE__ */ new Map([
7105
7231
  [
7106
7232
  "agentsmd",
@@ -7312,41 +7438,41 @@ import { join as join64 } from "path";
7312
7438
 
7313
7439
  // src/features/rules/rulesync-rule.ts
7314
7440
  import { basename as basename19, join as join63 } from "path";
7315
- import { z as z32 } from "zod/mini";
7316
- var RulesyncRuleFrontmatterSchema = z32.object({
7317
- root: z32.optional(z32.optional(z32.boolean())),
7318
- targets: z32.optional(RulesyncTargetsSchema),
7319
- description: z32.optional(z32.string()),
7320
- globs: z32.optional(z32.array(z32.string())),
7321
- agentsmd: z32.optional(
7322
- z32.object({
7441
+ import { z as z33 } from "zod/mini";
7442
+ var RulesyncRuleFrontmatterSchema = z33.object({
7443
+ root: z33.optional(z33.optional(z33.boolean())),
7444
+ targets: z33.optional(RulesyncTargetsSchema),
7445
+ description: z33.optional(z33.string()),
7446
+ globs: z33.optional(z33.array(z33.string())),
7447
+ agentsmd: z33.optional(
7448
+ z33.object({
7323
7449
  // @example "path/to/subproject"
7324
- subprojectPath: z32.optional(z32.string())
7450
+ subprojectPath: z33.optional(z33.string())
7325
7451
  })
7326
7452
  ),
7327
- claudecode: z32.optional(
7328
- z32.object({
7453
+ claudecode: z33.optional(
7454
+ z33.object({
7329
7455
  // Glob patterns for conditional rules (takes precedence over globs)
7330
7456
  // @example "src/**/*.ts, tests/**/*.test.ts"
7331
- paths: z32.optional(z32.string())
7457
+ paths: z33.optional(z33.string())
7332
7458
  })
7333
7459
  ),
7334
- cursor: z32.optional(
7335
- z32.object({
7336
- alwaysApply: z32.optional(z32.boolean()),
7337
- description: z32.optional(z32.string()),
7338
- globs: z32.optional(z32.array(z32.string()))
7460
+ cursor: z33.optional(
7461
+ z33.object({
7462
+ alwaysApply: z33.optional(z33.boolean()),
7463
+ description: z33.optional(z33.string()),
7464
+ globs: z33.optional(z33.array(z33.string()))
7339
7465
  })
7340
7466
  ),
7341
- copilot: z32.optional(
7342
- z32.object({
7343
- excludeAgent: z32.optional(z32.union([z32.literal("code-review"), z32.literal("coding-agent")]))
7467
+ copilot: z33.optional(
7468
+ z33.object({
7469
+ excludeAgent: z33.optional(z33.union([z33.literal("code-review"), z33.literal("coding-agent")]))
7344
7470
  })
7345
7471
  ),
7346
- antigravity: z32.optional(
7347
- z32.looseObject({
7348
- trigger: z32.optional(z32.string()),
7349
- globs: z32.optional(z32.array(z32.string()))
7472
+ antigravity: z33.optional(
7473
+ z33.looseObject({
7474
+ trigger: z33.optional(z33.string()),
7475
+ globs: z33.optional(z33.array(z33.string()))
7350
7476
  })
7351
7477
  )
7352
7478
  });
@@ -7754,20 +7880,20 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
7754
7880
 
7755
7881
  // src/features/rules/antigravity-rule.ts
7756
7882
  import { join as join67 } from "path";
7757
- import { z as z33 } from "zod/mini";
7758
- var AntigravityRuleFrontmatterSchema = z33.looseObject({
7759
- trigger: z33.optional(
7760
- z33.union([
7761
- z33.literal("always_on"),
7762
- z33.literal("glob"),
7763
- z33.literal("manual"),
7764
- z33.literal("model_decision"),
7765
- z33.string()
7883
+ import { z as z34 } from "zod/mini";
7884
+ var AntigravityRuleFrontmatterSchema = z34.looseObject({
7885
+ trigger: z34.optional(
7886
+ z34.union([
7887
+ z34.literal("always_on"),
7888
+ z34.literal("glob"),
7889
+ z34.literal("manual"),
7890
+ z34.literal("model_decision"),
7891
+ z34.string()
7766
7892
  // accepts any string for forward compatibility
7767
7893
  ])
7768
7894
  ),
7769
- globs: z33.optional(z33.string()),
7770
- description: z33.optional(z33.string())
7895
+ globs: z34.optional(z34.string()),
7896
+ description: z34.optional(z34.string())
7771
7897
  });
7772
7898
  function parseGlobsString(globs) {
7773
7899
  if (!globs) {
@@ -8345,9 +8471,9 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
8345
8471
 
8346
8472
  // src/features/rules/claudecode-rule.ts
8347
8473
  import { join as join71 } from "path";
8348
- import { z as z34 } from "zod/mini";
8349
- var ClaudecodeRuleFrontmatterSchema = z34.object({
8350
- paths: z34.optional(z34.string())
8474
+ import { z as z35 } from "zod/mini";
8475
+ var ClaudecodeRuleFrontmatterSchema = z35.object({
8476
+ paths: z35.optional(z35.string())
8351
8477
  });
8352
8478
  var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
8353
8479
  frontmatter;
@@ -8555,9 +8681,9 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
8555
8681
 
8556
8682
  // src/features/rules/cline-rule.ts
8557
8683
  import { join as join72 } from "path";
8558
- import { z as z35 } from "zod/mini";
8559
- var ClineRuleFrontmatterSchema = z35.object({
8560
- description: z35.string()
8684
+ import { z as z36 } from "zod/mini";
8685
+ var ClineRuleFrontmatterSchema = z36.object({
8686
+ description: z36.string()
8561
8687
  });
8562
8688
  var ClineRule = class _ClineRule extends ToolRule {
8563
8689
  static getSettablePaths() {
@@ -8734,11 +8860,11 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
8734
8860
 
8735
8861
  // src/features/rules/copilot-rule.ts
8736
8862
  import { join as join74 } from "path";
8737
- import { z as z36 } from "zod/mini";
8738
- var CopilotRuleFrontmatterSchema = z36.object({
8739
- description: z36.optional(z36.string()),
8740
- applyTo: z36.optional(z36.string()),
8741
- excludeAgent: z36.optional(z36.union([z36.literal("code-review"), z36.literal("coding-agent")]))
8863
+ import { z as z37 } from "zod/mini";
8864
+ var CopilotRuleFrontmatterSchema = z37.object({
8865
+ description: z37.optional(z37.string()),
8866
+ applyTo: z37.optional(z37.string()),
8867
+ excludeAgent: z37.optional(z37.union([z37.literal("code-review"), z37.literal("coding-agent")]))
8742
8868
  });
8743
8869
  var CopilotRule = class _CopilotRule extends ToolRule {
8744
8870
  frontmatter;
@@ -8922,11 +9048,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
8922
9048
 
8923
9049
  // src/features/rules/cursor-rule.ts
8924
9050
  import { basename as basename20, join as join75 } from "path";
8925
- import { z as z37 } from "zod/mini";
8926
- var CursorRuleFrontmatterSchema = z37.object({
8927
- description: z37.optional(z37.string()),
8928
- globs: z37.optional(z37.string()),
8929
- alwaysApply: z37.optional(z37.boolean())
9051
+ import { z as z38 } from "zod/mini";
9052
+ var CursorRuleFrontmatterSchema = z38.object({
9053
+ description: z38.optional(z38.string()),
9054
+ globs: z38.optional(z38.string()),
9055
+ alwaysApply: z38.optional(z38.boolean())
8930
9056
  });
8931
9057
  var CursorRule = class _CursorRule extends ToolRule {
8932
9058
  frontmatter;
@@ -9776,7 +9902,7 @@ var rulesProcessorToolTargets = [
9776
9902
  "warp",
9777
9903
  "windsurf"
9778
9904
  ];
9779
- var RulesProcessorToolTargetSchema = z38.enum(rulesProcessorToolTargets);
9905
+ var RulesProcessorToolTargetSchema = z39.enum(rulesProcessorToolTargets);
9780
9906
  var toolRuleFactories = /* @__PURE__ */ new Map([
9781
9907
  [
9782
9908
  "agentsmd",
@@ -11133,9 +11259,12 @@ Attention, again, you are just the planner, so though you can read any files and
11133
11259
  // src/cli/commands/mcp.ts
11134
11260
  import { FastMCP } from "fastmcp";
11135
11261
 
11262
+ // src/mcp/tools.ts
11263
+ import { z as z46 } from "zod/mini";
11264
+
11136
11265
  // src/mcp/commands.ts
11137
11266
  import { basename as basename22, join as join87 } from "path";
11138
- import { z as z39 } from "zod/mini";
11267
+ import { z as z40 } from "zod/mini";
11139
11268
  var maxCommandSizeBytes = 1024 * 1024;
11140
11269
  var maxCommandsCount = 1e3;
11141
11270
  async function listCommands() {
@@ -11254,17 +11383,17 @@ async function deleteCommand({ relativePathFromCwd }) {
11254
11383
  }
11255
11384
  }
11256
11385
  var commandToolSchemas = {
11257
- listCommands: z39.object({}),
11258
- getCommand: z39.object({
11259
- relativePathFromCwd: z39.string()
11386
+ listCommands: z40.object({}),
11387
+ getCommand: z40.object({
11388
+ relativePathFromCwd: z40.string()
11260
11389
  }),
11261
- putCommand: z39.object({
11262
- relativePathFromCwd: z39.string(),
11390
+ putCommand: z40.object({
11391
+ relativePathFromCwd: z40.string(),
11263
11392
  frontmatter: RulesyncCommandFrontmatterSchema,
11264
- body: z39.string()
11393
+ body: z40.string()
11265
11394
  }),
11266
- deleteCommand: z39.object({
11267
- relativePathFromCwd: z39.string()
11395
+ deleteCommand: z40.object({
11396
+ relativePathFromCwd: z40.string()
11268
11397
  })
11269
11398
  };
11270
11399
  var commandTools = {
@@ -11313,7 +11442,7 @@ var commandTools = {
11313
11442
 
11314
11443
  // src/mcp/ignore.ts
11315
11444
  import { join as join88 } from "path";
11316
- import { z as z40 } from "zod/mini";
11445
+ import { z as z41 } from "zod/mini";
11317
11446
  var maxIgnoreFileSizeBytes = 100 * 1024;
11318
11447
  async function getIgnoreFile() {
11319
11448
  const ignoreFilePath = join88(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
@@ -11370,11 +11499,11 @@ async function deleteIgnoreFile() {
11370
11499
  }
11371
11500
  }
11372
11501
  var ignoreToolSchemas = {
11373
- getIgnoreFile: z40.object({}),
11374
- putIgnoreFile: z40.object({
11375
- content: z40.string()
11502
+ getIgnoreFile: z41.object({}),
11503
+ putIgnoreFile: z41.object({
11504
+ content: z41.string()
11376
11505
  }),
11377
- deleteIgnoreFile: z40.object({})
11506
+ deleteIgnoreFile: z41.object({})
11378
11507
  };
11379
11508
  var ignoreTools = {
11380
11509
  getIgnoreFile: {
@@ -11408,7 +11537,7 @@ var ignoreTools = {
11408
11537
 
11409
11538
  // src/mcp/mcp.ts
11410
11539
  import { join as join89 } from "path";
11411
- import { z as z41 } from "zod/mini";
11540
+ import { z as z42 } from "zod/mini";
11412
11541
  var maxMcpSizeBytes = 1024 * 1024;
11413
11542
  async function getMcpFile() {
11414
11543
  const config = await ConfigResolver.resolve({});
@@ -11498,11 +11627,11 @@ async function deleteMcpFile() {
11498
11627
  }
11499
11628
  }
11500
11629
  var mcpToolSchemas = {
11501
- getMcpFile: z41.object({}),
11502
- putMcpFile: z41.object({
11503
- content: z41.string()
11630
+ getMcpFile: z42.object({}),
11631
+ putMcpFile: z42.object({
11632
+ content: z42.string()
11504
11633
  }),
11505
- deleteMcpFile: z41.object({})
11634
+ deleteMcpFile: z42.object({})
11506
11635
  };
11507
11636
  var mcpTools = {
11508
11637
  getMcpFile: {
@@ -11536,7 +11665,7 @@ var mcpTools = {
11536
11665
 
11537
11666
  // src/mcp/rules.ts
11538
11667
  import { basename as basename23, join as join90 } from "path";
11539
- import { z as z42 } from "zod/mini";
11668
+ import { z as z43 } from "zod/mini";
11540
11669
  var maxRuleSizeBytes = 1024 * 1024;
11541
11670
  var maxRulesCount = 1e3;
11542
11671
  async function listRules() {
@@ -11655,17 +11784,17 @@ async function deleteRule({ relativePathFromCwd }) {
11655
11784
  }
11656
11785
  }
11657
11786
  var ruleToolSchemas = {
11658
- listRules: z42.object({}),
11659
- getRule: z42.object({
11660
- relativePathFromCwd: z42.string()
11787
+ listRules: z43.object({}),
11788
+ getRule: z43.object({
11789
+ relativePathFromCwd: z43.string()
11661
11790
  }),
11662
- putRule: z42.object({
11663
- relativePathFromCwd: z42.string(),
11791
+ putRule: z43.object({
11792
+ relativePathFromCwd: z43.string(),
11664
11793
  frontmatter: RulesyncRuleFrontmatterSchema,
11665
- body: z42.string()
11794
+ body: z43.string()
11666
11795
  }),
11667
- deleteRule: z42.object({
11668
- relativePathFromCwd: z42.string()
11796
+ deleteRule: z43.object({
11797
+ relativePathFromCwd: z43.string()
11669
11798
  })
11670
11799
  };
11671
11800
  var ruleTools = {
@@ -11714,7 +11843,7 @@ var ruleTools = {
11714
11843
 
11715
11844
  // src/mcp/skills.ts
11716
11845
  import { basename as basename24, dirname as dirname2, join as join91 } from "path";
11717
- import { z as z43 } from "zod/mini";
11846
+ import { z as z44 } from "zod/mini";
11718
11847
  var maxSkillSizeBytes = 1024 * 1024;
11719
11848
  var maxSkillsCount = 1e3;
11720
11849
  function aiDirFileToMcpSkillFile(file) {
@@ -11882,23 +12011,23 @@ async function deleteSkill({
11882
12011
  );
11883
12012
  }
11884
12013
  }
11885
- var McpSkillFileSchema = z43.object({
11886
- name: z43.string(),
11887
- body: z43.string()
12014
+ var McpSkillFileSchema = z44.object({
12015
+ name: z44.string(),
12016
+ body: z44.string()
11888
12017
  });
11889
12018
  var skillToolSchemas = {
11890
- listSkills: z43.object({}),
11891
- getSkill: z43.object({
11892
- relativeDirPathFromCwd: z43.string()
12019
+ listSkills: z44.object({}),
12020
+ getSkill: z44.object({
12021
+ relativeDirPathFromCwd: z44.string()
11893
12022
  }),
11894
- putSkill: z43.object({
11895
- relativeDirPathFromCwd: z43.string(),
12023
+ putSkill: z44.object({
12024
+ relativeDirPathFromCwd: z44.string(),
11896
12025
  frontmatter: RulesyncSkillFrontmatterSchema,
11897
- body: z43.string(),
11898
- otherFiles: z43.optional(z43.array(McpSkillFileSchema))
12026
+ body: z44.string(),
12027
+ otherFiles: z44.optional(z44.array(McpSkillFileSchema))
11899
12028
  }),
11900
- deleteSkill: z43.object({
11901
- relativeDirPathFromCwd: z43.string()
12029
+ deleteSkill: z44.object({
12030
+ relativeDirPathFromCwd: z44.string()
11902
12031
  })
11903
12032
  };
11904
12033
  var skillTools = {
@@ -11948,7 +12077,7 @@ var skillTools = {
11948
12077
 
11949
12078
  // src/mcp/subagents.ts
11950
12079
  import { basename as basename25, join as join92 } from "path";
11951
- import { z as z44 } from "zod/mini";
12080
+ import { z as z45 } from "zod/mini";
11952
12081
  var maxSubagentSizeBytes = 1024 * 1024;
11953
12082
  var maxSubagentsCount = 1e3;
11954
12083
  async function listSubagents() {
@@ -12072,17 +12201,17 @@ async function deleteSubagent({ relativePathFromCwd }) {
12072
12201
  }
12073
12202
  }
12074
12203
  var subagentToolSchemas = {
12075
- listSubagents: z44.object({}),
12076
- getSubagent: z44.object({
12077
- relativePathFromCwd: z44.string()
12204
+ listSubagents: z45.object({}),
12205
+ getSubagent: z45.object({
12206
+ relativePathFromCwd: z45.string()
12078
12207
  }),
12079
- putSubagent: z44.object({
12080
- relativePathFromCwd: z44.string(),
12208
+ putSubagent: z45.object({
12209
+ relativePathFromCwd: z45.string(),
12081
12210
  frontmatter: RulesyncSubagentFrontmatterSchema,
12082
- body: z44.string()
12211
+ body: z45.string()
12083
12212
  }),
12084
- deleteSubagent: z44.object({
12085
- relativePathFromCwd: z44.string()
12213
+ deleteSubagent: z45.object({
12214
+ relativePathFromCwd: z45.string()
12086
12215
  })
12087
12216
  };
12088
12217
  var subagentTools = {
@@ -12129,6 +12258,200 @@ var subagentTools = {
12129
12258
  }
12130
12259
  };
12131
12260
 
12261
+ // src/mcp/tools.ts
12262
+ var rulesyncFeatureSchema = z46.enum(["rule", "command", "subagent", "skill", "ignore", "mcp"]);
12263
+ var rulesyncOperationSchema = z46.enum(["list", "get", "put", "delete"]);
12264
+ var skillFileSchema = z46.object({
12265
+ name: z46.string(),
12266
+ body: z46.string()
12267
+ });
12268
+ var rulesyncToolSchema = z46.object({
12269
+ feature: rulesyncFeatureSchema,
12270
+ operation: rulesyncOperationSchema,
12271
+ targetPathFromCwd: z46.optional(z46.string()),
12272
+ frontmatter: z46.optional(z46.unknown()),
12273
+ body: z46.optional(z46.string()),
12274
+ otherFiles: z46.optional(z46.array(skillFileSchema)),
12275
+ content: z46.optional(z46.string())
12276
+ });
12277
+ var supportedOperationsByFeature = {
12278
+ rule: ["list", "get", "put", "delete"],
12279
+ command: ["list", "get", "put", "delete"],
12280
+ subagent: ["list", "get", "put", "delete"],
12281
+ skill: ["list", "get", "put", "delete"],
12282
+ ignore: ["get", "put", "delete"],
12283
+ mcp: ["get", "put", "delete"]
12284
+ };
12285
+ function assertSupported({
12286
+ feature,
12287
+ operation
12288
+ }) {
12289
+ const supportedOperations = supportedOperationsByFeature[feature];
12290
+ if (!supportedOperations.includes(operation)) {
12291
+ throw new Error(
12292
+ `Operation ${operation} is not supported for feature ${feature}. Supported operations: ${supportedOperations.join(
12293
+ ", "
12294
+ )}`
12295
+ );
12296
+ }
12297
+ }
12298
+ function requireTargetPath({ targetPathFromCwd, feature, operation }) {
12299
+ if (!targetPathFromCwd) {
12300
+ throw new Error(`targetPathFromCwd is required for ${feature} ${operation} operation`);
12301
+ }
12302
+ return targetPathFromCwd;
12303
+ }
12304
+ function parseFrontmatter2({
12305
+ feature,
12306
+ frontmatter
12307
+ }) {
12308
+ switch (feature) {
12309
+ case "rule": {
12310
+ return RulesyncRuleFrontmatterSchema.parse(frontmatter);
12311
+ }
12312
+ case "command": {
12313
+ return RulesyncCommandFrontmatterSchema.parse(frontmatter);
12314
+ }
12315
+ case "subagent": {
12316
+ return RulesyncSubagentFrontmatterSchema.parse(frontmatter);
12317
+ }
12318
+ case "skill": {
12319
+ return RulesyncSkillFrontmatterSchema.parse(frontmatter);
12320
+ }
12321
+ }
12322
+ }
12323
+ function ensureBody({ body, feature, operation }) {
12324
+ if (!body) {
12325
+ throw new Error(`body is required for ${feature} ${operation} operation`);
12326
+ }
12327
+ return body;
12328
+ }
12329
+ var rulesyncTool = {
12330
+ name: "rulesyncTool",
12331
+ description: "Manage Rulesync files through a single MCP tool. Features: rule/command/subagent/skill support list/get/put/delete; ignore/mcp support get/put/delete only. Parameters: list requires no targetPathFromCwd (lists all items); get/delete require targetPathFromCwd; put requires targetPathFromCwd, frontmatter, and body (or content for ignore/mcp).",
12332
+ parameters: rulesyncToolSchema,
12333
+ execute: async (args) => {
12334
+ const parsed = rulesyncToolSchema.parse(args);
12335
+ assertSupported({ feature: parsed.feature, operation: parsed.operation });
12336
+ switch (parsed.feature) {
12337
+ case "rule": {
12338
+ if (parsed.operation === "list") {
12339
+ return ruleTools.listRules.execute();
12340
+ }
12341
+ if (parsed.operation === "get") {
12342
+ return ruleTools.getRule.execute({ relativePathFromCwd: requireTargetPath(parsed) });
12343
+ }
12344
+ if (parsed.operation === "put") {
12345
+ return ruleTools.putRule.execute({
12346
+ relativePathFromCwd: requireTargetPath(parsed),
12347
+ frontmatter: parseFrontmatter2({
12348
+ feature: "rule",
12349
+ frontmatter: parsed.frontmatter ?? {}
12350
+ }),
12351
+ body: ensureBody(parsed)
12352
+ });
12353
+ }
12354
+ return ruleTools.deleteRule.execute({ relativePathFromCwd: requireTargetPath(parsed) });
12355
+ }
12356
+ case "command": {
12357
+ if (parsed.operation === "list") {
12358
+ return commandTools.listCommands.execute();
12359
+ }
12360
+ if (parsed.operation === "get") {
12361
+ return commandTools.getCommand.execute({
12362
+ relativePathFromCwd: requireTargetPath(parsed)
12363
+ });
12364
+ }
12365
+ if (parsed.operation === "put") {
12366
+ return commandTools.putCommand.execute({
12367
+ relativePathFromCwd: requireTargetPath(parsed),
12368
+ frontmatter: parseFrontmatter2({
12369
+ feature: "command",
12370
+ frontmatter: parsed.frontmatter ?? {}
12371
+ }),
12372
+ body: ensureBody(parsed)
12373
+ });
12374
+ }
12375
+ return commandTools.deleteCommand.execute({
12376
+ relativePathFromCwd: requireTargetPath(parsed)
12377
+ });
12378
+ }
12379
+ case "subagent": {
12380
+ if (parsed.operation === "list") {
12381
+ return subagentTools.listSubagents.execute();
12382
+ }
12383
+ if (parsed.operation === "get") {
12384
+ return subagentTools.getSubagent.execute({
12385
+ relativePathFromCwd: requireTargetPath(parsed)
12386
+ });
12387
+ }
12388
+ if (parsed.operation === "put") {
12389
+ return subagentTools.putSubagent.execute({
12390
+ relativePathFromCwd: requireTargetPath(parsed),
12391
+ frontmatter: parseFrontmatter2({
12392
+ feature: "subagent",
12393
+ frontmatter: parsed.frontmatter ?? {}
12394
+ }),
12395
+ body: ensureBody(parsed)
12396
+ });
12397
+ }
12398
+ return subagentTools.deleteSubagent.execute({
12399
+ relativePathFromCwd: requireTargetPath(parsed)
12400
+ });
12401
+ }
12402
+ case "skill": {
12403
+ if (parsed.operation === "list") {
12404
+ return skillTools.listSkills.execute();
12405
+ }
12406
+ if (parsed.operation === "get") {
12407
+ return skillTools.getSkill.execute({ relativeDirPathFromCwd: requireTargetPath(parsed) });
12408
+ }
12409
+ if (parsed.operation === "put") {
12410
+ return skillTools.putSkill.execute({
12411
+ relativeDirPathFromCwd: requireTargetPath(parsed),
12412
+ frontmatter: parseFrontmatter2({
12413
+ feature: "skill",
12414
+ frontmatter: parsed.frontmatter ?? {}
12415
+ }),
12416
+ body: ensureBody(parsed),
12417
+ otherFiles: parsed.otherFiles ?? []
12418
+ });
12419
+ }
12420
+ return skillTools.deleteSkill.execute({
12421
+ relativeDirPathFromCwd: requireTargetPath(parsed)
12422
+ });
12423
+ }
12424
+ case "ignore": {
12425
+ if (parsed.operation === "get") {
12426
+ return ignoreTools.getIgnoreFile.execute();
12427
+ }
12428
+ if (parsed.operation === "put") {
12429
+ if (!parsed.content) {
12430
+ throw new Error("content is required for ignore put operation");
12431
+ }
12432
+ return ignoreTools.putIgnoreFile.execute({ content: parsed.content });
12433
+ }
12434
+ return ignoreTools.deleteIgnoreFile.execute();
12435
+ }
12436
+ case "mcp": {
12437
+ if (parsed.operation === "get") {
12438
+ return mcpTools.getMcpFile.execute();
12439
+ }
12440
+ if (parsed.operation === "put") {
12441
+ if (!parsed.content) {
12442
+ throw new Error("content is required for mcp put operation");
12443
+ }
12444
+ return mcpTools.putMcpFile.execute({ content: parsed.content });
12445
+ }
12446
+ return mcpTools.deleteMcpFile.execute();
12447
+ }
12448
+ default: {
12449
+ throw new Error(`Unknown feature: ${parsed.feature}`);
12450
+ }
12451
+ }
12452
+ }
12453
+ };
12454
+
12132
12455
  // src/cli/commands/mcp.ts
12133
12456
  async function mcpCommand({ version }) {
12134
12457
  const server = new FastMCP({
@@ -12137,28 +12460,7 @@ async function mcpCommand({ version }) {
12137
12460
  version,
12138
12461
  instructions: "This server handles Rulesync files including rules, commands, MCP, ignore files, subagents and skills for any AI agents. It should be used when you need those files."
12139
12462
  });
12140
- server.addTool(ruleTools.listRules);
12141
- server.addTool(ruleTools.getRule);
12142
- server.addTool(ruleTools.putRule);
12143
- server.addTool(ruleTools.deleteRule);
12144
- server.addTool(commandTools.listCommands);
12145
- server.addTool(commandTools.getCommand);
12146
- server.addTool(commandTools.putCommand);
12147
- server.addTool(commandTools.deleteCommand);
12148
- server.addTool(subagentTools.listSubagents);
12149
- server.addTool(subagentTools.getSubagent);
12150
- server.addTool(subagentTools.putSubagent);
12151
- server.addTool(subagentTools.deleteSubagent);
12152
- server.addTool(skillTools.listSkills);
12153
- server.addTool(skillTools.getSkill);
12154
- server.addTool(skillTools.putSkill);
12155
- server.addTool(skillTools.deleteSkill);
12156
- server.addTool(ignoreTools.getIgnoreFile);
12157
- server.addTool(ignoreTools.putIgnoreFile);
12158
- server.addTool(ignoreTools.deleteIgnoreFile);
12159
- server.addTool(mcpTools.getMcpFile);
12160
- server.addTool(mcpTools.putMcpFile);
12161
- server.addTool(mcpTools.deleteMcpFile);
12463
+ server.addTool(rulesyncTool);
12162
12464
  logger.info("Rulesync MCP server started via stdio");
12163
12465
  void server.start({
12164
12466
  transportType: "stdio"
@@ -12166,7 +12468,7 @@ async function mcpCommand({ version }) {
12166
12468
  }
12167
12469
 
12168
12470
  // src/cli/index.ts
12169
- var getVersion = () => "4.2.0";
12471
+ var getVersion = () => "4.3.0";
12170
12472
  var main = async () => {
12171
12473
  const program = new Command();
12172
12474
  const version = getVersion();