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.
- package/README.md +21 -18
- package/dist/index.cjs +595 -293
- package/dist/index.js +595 -293
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4729,7 +4729,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4729
4729
|
// src/features/rules/rules-processor.ts
|
|
4730
4730
|
var import_node_path86 = require("path");
|
|
4731
4731
|
var import_toon = require("@toon-format/toon");
|
|
4732
|
-
var
|
|
4732
|
+
var import_mini39 = require("zod/mini");
|
|
4733
4733
|
|
|
4734
4734
|
// src/constants/general.ts
|
|
4735
4735
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
@@ -5160,127 +5160,11 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5160
5160
|
};
|
|
5161
5161
|
|
|
5162
5162
|
// src/features/skills/cursor-skill.ts
|
|
5163
|
-
var import_node_path45 = require("path");
|
|
5164
|
-
var CursorSkill = class _CursorSkill extends SimulatedSkill {
|
|
5165
|
-
static getSettablePaths(options) {
|
|
5166
|
-
if (options?.global) {
|
|
5167
|
-
throw new Error("CursorSkill does not support global mode.");
|
|
5168
|
-
}
|
|
5169
|
-
return {
|
|
5170
|
-
relativeDirPath: (0, import_node_path45.join)(".cursor", "skills")
|
|
5171
|
-
};
|
|
5172
|
-
}
|
|
5173
|
-
static async fromDir(params) {
|
|
5174
|
-
const baseParams = await this.fromDirDefault(params);
|
|
5175
|
-
return new _CursorSkill(baseParams);
|
|
5176
|
-
}
|
|
5177
|
-
static fromRulesyncSkill(params) {
|
|
5178
|
-
const baseParams = {
|
|
5179
|
-
...this.fromRulesyncSkillDefault(params),
|
|
5180
|
-
relativeDirPath: this.getSettablePaths().relativeDirPath
|
|
5181
|
-
};
|
|
5182
|
-
return new _CursorSkill(baseParams);
|
|
5183
|
-
}
|
|
5184
|
-
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
5185
|
-
return this.isTargetedByRulesyncSkillDefault({
|
|
5186
|
-
rulesyncSkill,
|
|
5187
|
-
toolTarget: "cursor"
|
|
5188
|
-
});
|
|
5189
|
-
}
|
|
5190
|
-
static forDeletion(params) {
|
|
5191
|
-
const baseParams = this.forDeletionDefault(params);
|
|
5192
|
-
return new _CursorSkill(baseParams);
|
|
5193
|
-
}
|
|
5194
|
-
};
|
|
5195
|
-
|
|
5196
|
-
// src/features/skills/geminicli-skill.ts
|
|
5197
5163
|
var import_node_path46 = require("path");
|
|
5198
|
-
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5199
|
-
static getSettablePaths(options) {
|
|
5200
|
-
if (options?.global) {
|
|
5201
|
-
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5202
|
-
}
|
|
5203
|
-
return {
|
|
5204
|
-
relativeDirPath: (0, import_node_path46.join)(".gemini", "skills")
|
|
5205
|
-
};
|
|
5206
|
-
}
|
|
5207
|
-
static async fromDir(params) {
|
|
5208
|
-
const baseParams = await this.fromDirDefault(params);
|
|
5209
|
-
return new _GeminiCliSkill(baseParams);
|
|
5210
|
-
}
|
|
5211
|
-
static fromRulesyncSkill(params) {
|
|
5212
|
-
const baseParams = {
|
|
5213
|
-
...this.fromRulesyncSkillDefault(params),
|
|
5214
|
-
relativeDirPath: this.getSettablePaths().relativeDirPath
|
|
5215
|
-
};
|
|
5216
|
-
return new _GeminiCliSkill(baseParams);
|
|
5217
|
-
}
|
|
5218
|
-
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
5219
|
-
return this.isTargetedByRulesyncSkillDefault({
|
|
5220
|
-
rulesyncSkill,
|
|
5221
|
-
toolTarget: "geminicli"
|
|
5222
|
-
});
|
|
5223
|
-
}
|
|
5224
|
-
static forDeletion(params) {
|
|
5225
|
-
const baseParams = this.forDeletionDefault(params);
|
|
5226
|
-
return new _GeminiCliSkill(baseParams);
|
|
5227
|
-
}
|
|
5228
|
-
};
|
|
5229
|
-
|
|
5230
|
-
// src/features/skills/skills-processor.ts
|
|
5231
|
-
var import_node_path53 = require("path");
|
|
5232
|
-
var import_mini25 = require("zod/mini");
|
|
5233
|
-
|
|
5234
|
-
// src/types/dir-feature-processor.ts
|
|
5235
|
-
var import_node_path47 = require("path");
|
|
5236
|
-
var DirFeatureProcessor = class {
|
|
5237
|
-
baseDir;
|
|
5238
|
-
constructor({ baseDir = process.cwd() }) {
|
|
5239
|
-
this.baseDir = baseDir;
|
|
5240
|
-
}
|
|
5241
|
-
/**
|
|
5242
|
-
* Return tool targets that this feature supports.
|
|
5243
|
-
*/
|
|
5244
|
-
static getToolTargets(_params = {}) {
|
|
5245
|
-
throw new Error("Not implemented");
|
|
5246
|
-
}
|
|
5247
|
-
/**
|
|
5248
|
-
* Once converted to rulesync/tool dirs, write them to the filesystem.
|
|
5249
|
-
* Returns the number of directories written.
|
|
5250
|
-
*/
|
|
5251
|
-
async writeAiDirs(aiDirs) {
|
|
5252
|
-
for (const aiDir of aiDirs) {
|
|
5253
|
-
const dirPath = aiDir.getDirPath();
|
|
5254
|
-
await ensureDir(dirPath);
|
|
5255
|
-
const mainFile = aiDir.getMainFile();
|
|
5256
|
-
if (mainFile) {
|
|
5257
|
-
const mainFilePath = (0, import_node_path47.join)(dirPath, mainFile.name);
|
|
5258
|
-
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5259
|
-
const contentWithNewline = addTrailingNewline(content);
|
|
5260
|
-
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5261
|
-
}
|
|
5262
|
-
const otherFiles = aiDir.getOtherFiles();
|
|
5263
|
-
for (const file of otherFiles) {
|
|
5264
|
-
const filePath = (0, import_node_path47.join)(dirPath, file.relativeFilePathToDirPath);
|
|
5265
|
-
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5266
|
-
await writeFileContent(filePath, contentWithNewline);
|
|
5267
|
-
}
|
|
5268
|
-
}
|
|
5269
|
-
return aiDirs.length;
|
|
5270
|
-
}
|
|
5271
|
-
async removeAiDirs(aiDirs) {
|
|
5272
|
-
for (const aiDir of aiDirs) {
|
|
5273
|
-
await removeDirectory(aiDir.getDirPath());
|
|
5274
|
-
}
|
|
5275
|
-
}
|
|
5276
|
-
};
|
|
5277
|
-
|
|
5278
|
-
// src/features/skills/claudecode-skill.ts
|
|
5279
|
-
var import_node_path49 = require("path");
|
|
5280
5164
|
var import_mini21 = require("zod/mini");
|
|
5281
5165
|
|
|
5282
5166
|
// src/features/skills/rulesync-skill.ts
|
|
5283
|
-
var
|
|
5167
|
+
var import_node_path45 = require("path");
|
|
5284
5168
|
var import_mini20 = require("zod/mini");
|
|
5285
5169
|
var RulesyncSkillFrontmatterSchemaInternal = import_mini20.z.looseObject({
|
|
5286
5170
|
name: import_mini20.z.string(),
|
|
@@ -5366,8 +5250,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5366
5250
|
dirName,
|
|
5367
5251
|
global = false
|
|
5368
5252
|
}) {
|
|
5369
|
-
const skillDirPath = (0,
|
|
5370
|
-
const skillFilePath = (0,
|
|
5253
|
+
const skillDirPath = (0, import_node_path45.join)(baseDir, relativeDirPath, dirName);
|
|
5254
|
+
const skillFilePath = (0, import_node_path45.join)(skillDirPath, SKILL_FILE_NAME);
|
|
5371
5255
|
if (!await fileExists(skillFilePath)) {
|
|
5372
5256
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5373
5257
|
}
|
|
@@ -5396,11 +5280,253 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5396
5280
|
}
|
|
5397
5281
|
};
|
|
5398
5282
|
|
|
5399
|
-
// src/features/skills/
|
|
5400
|
-
var
|
|
5283
|
+
// src/features/skills/cursor-skill.ts
|
|
5284
|
+
var CursorSkillFrontmatterSchema = import_mini21.z.looseObject({
|
|
5401
5285
|
name: import_mini21.z.string(),
|
|
5402
|
-
description: import_mini21.z.string()
|
|
5403
|
-
|
|
5286
|
+
description: import_mini21.z.string()
|
|
5287
|
+
});
|
|
5288
|
+
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
5289
|
+
constructor({
|
|
5290
|
+
baseDir = process.cwd(),
|
|
5291
|
+
relativeDirPath = (0, import_node_path46.join)(".cursor", "skills"),
|
|
5292
|
+
dirName,
|
|
5293
|
+
frontmatter,
|
|
5294
|
+
body,
|
|
5295
|
+
otherFiles = [],
|
|
5296
|
+
validate = true,
|
|
5297
|
+
global = false
|
|
5298
|
+
}) {
|
|
5299
|
+
super({
|
|
5300
|
+
baseDir,
|
|
5301
|
+
relativeDirPath,
|
|
5302
|
+
dirName,
|
|
5303
|
+
mainFile: {
|
|
5304
|
+
name: SKILL_FILE_NAME,
|
|
5305
|
+
body,
|
|
5306
|
+
frontmatter: { ...frontmatter }
|
|
5307
|
+
},
|
|
5308
|
+
otherFiles,
|
|
5309
|
+
global
|
|
5310
|
+
});
|
|
5311
|
+
if (validate) {
|
|
5312
|
+
const result = this.validate();
|
|
5313
|
+
if (!result.success) {
|
|
5314
|
+
throw result.error;
|
|
5315
|
+
}
|
|
5316
|
+
}
|
|
5317
|
+
}
|
|
5318
|
+
static getSettablePaths(options) {
|
|
5319
|
+
if (options?.global) {
|
|
5320
|
+
throw new Error("CursorSkill does not support global mode.");
|
|
5321
|
+
}
|
|
5322
|
+
return {
|
|
5323
|
+
relativeDirPath: (0, import_node_path46.join)(".cursor", "skills")
|
|
5324
|
+
};
|
|
5325
|
+
}
|
|
5326
|
+
getFrontmatter() {
|
|
5327
|
+
if (!this.mainFile?.frontmatter) {
|
|
5328
|
+
throw new Error("Frontmatter is not defined");
|
|
5329
|
+
}
|
|
5330
|
+
const result = CursorSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
5331
|
+
return result;
|
|
5332
|
+
}
|
|
5333
|
+
getBody() {
|
|
5334
|
+
return this.mainFile?.body ?? "";
|
|
5335
|
+
}
|
|
5336
|
+
validate() {
|
|
5337
|
+
if (!this.mainFile) {
|
|
5338
|
+
return {
|
|
5339
|
+
success: false,
|
|
5340
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
5341
|
+
};
|
|
5342
|
+
}
|
|
5343
|
+
const result = CursorSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
5344
|
+
if (!result.success) {
|
|
5345
|
+
return {
|
|
5346
|
+
success: false,
|
|
5347
|
+
error: new Error(
|
|
5348
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
5349
|
+
)
|
|
5350
|
+
};
|
|
5351
|
+
}
|
|
5352
|
+
return { success: true, error: null };
|
|
5353
|
+
}
|
|
5354
|
+
toRulesyncSkill() {
|
|
5355
|
+
const frontmatter = this.getFrontmatter();
|
|
5356
|
+
const rulesyncFrontmatter = {
|
|
5357
|
+
name: frontmatter.name,
|
|
5358
|
+
description: frontmatter.description,
|
|
5359
|
+
targets: ["*"]
|
|
5360
|
+
};
|
|
5361
|
+
return new RulesyncSkill({
|
|
5362
|
+
baseDir: this.baseDir,
|
|
5363
|
+
relativeDirPath: this.relativeDirPath,
|
|
5364
|
+
dirName: this.getDirName(),
|
|
5365
|
+
frontmatter: rulesyncFrontmatter,
|
|
5366
|
+
body: this.getBody(),
|
|
5367
|
+
otherFiles: this.getOtherFiles(),
|
|
5368
|
+
validate: true,
|
|
5369
|
+
global: this.global
|
|
5370
|
+
});
|
|
5371
|
+
}
|
|
5372
|
+
static fromRulesyncSkill({
|
|
5373
|
+
rulesyncSkill,
|
|
5374
|
+
validate = true,
|
|
5375
|
+
global = false
|
|
5376
|
+
}) {
|
|
5377
|
+
const settablePaths = _CursorSkill.getSettablePaths({ global });
|
|
5378
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
5379
|
+
const cursorFrontmatter = {
|
|
5380
|
+
name: rulesyncFrontmatter.name,
|
|
5381
|
+
description: rulesyncFrontmatter.description
|
|
5382
|
+
};
|
|
5383
|
+
return new _CursorSkill({
|
|
5384
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
5385
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
5386
|
+
dirName: rulesyncSkill.getDirName(),
|
|
5387
|
+
frontmatter: cursorFrontmatter,
|
|
5388
|
+
body: rulesyncSkill.getBody(),
|
|
5389
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
5390
|
+
validate,
|
|
5391
|
+
global
|
|
5392
|
+
});
|
|
5393
|
+
}
|
|
5394
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
5395
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
5396
|
+
return targets.includes("*") || targets.includes("cursor");
|
|
5397
|
+
}
|
|
5398
|
+
static async fromDir(params) {
|
|
5399
|
+
const loaded = await this.loadSkillDirContent({
|
|
5400
|
+
...params,
|
|
5401
|
+
getSettablePaths: _CursorSkill.getSettablePaths
|
|
5402
|
+
});
|
|
5403
|
+
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5404
|
+
if (!result.success) {
|
|
5405
|
+
const skillDirPath = (0, import_node_path46.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5406
|
+
throw new Error(
|
|
5407
|
+
`Invalid frontmatter in ${(0, import_node_path46.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5408
|
+
);
|
|
5409
|
+
}
|
|
5410
|
+
return new _CursorSkill({
|
|
5411
|
+
baseDir: loaded.baseDir,
|
|
5412
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
5413
|
+
dirName: loaded.dirName,
|
|
5414
|
+
frontmatter: result.data,
|
|
5415
|
+
body: loaded.body,
|
|
5416
|
+
otherFiles: loaded.otherFiles,
|
|
5417
|
+
validate: true,
|
|
5418
|
+
global: loaded.global
|
|
5419
|
+
});
|
|
5420
|
+
}
|
|
5421
|
+
static forDeletion({
|
|
5422
|
+
baseDir = process.cwd(),
|
|
5423
|
+
relativeDirPath,
|
|
5424
|
+
dirName,
|
|
5425
|
+
global = false
|
|
5426
|
+
}) {
|
|
5427
|
+
const settablePaths = _CursorSkill.getSettablePaths({ global });
|
|
5428
|
+
return new _CursorSkill({
|
|
5429
|
+
baseDir,
|
|
5430
|
+
relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
|
|
5431
|
+
dirName,
|
|
5432
|
+
frontmatter: { name: "", description: "" },
|
|
5433
|
+
body: "",
|
|
5434
|
+
otherFiles: [],
|
|
5435
|
+
validate: false,
|
|
5436
|
+
global
|
|
5437
|
+
});
|
|
5438
|
+
}
|
|
5439
|
+
};
|
|
5440
|
+
|
|
5441
|
+
// src/features/skills/geminicli-skill.ts
|
|
5442
|
+
var import_node_path47 = require("path");
|
|
5443
|
+
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5444
|
+
static getSettablePaths(options) {
|
|
5445
|
+
if (options?.global) {
|
|
5446
|
+
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5447
|
+
}
|
|
5448
|
+
return {
|
|
5449
|
+
relativeDirPath: (0, import_node_path47.join)(".gemini", "skills")
|
|
5450
|
+
};
|
|
5451
|
+
}
|
|
5452
|
+
static async fromDir(params) {
|
|
5453
|
+
const baseParams = await this.fromDirDefault(params);
|
|
5454
|
+
return new _GeminiCliSkill(baseParams);
|
|
5455
|
+
}
|
|
5456
|
+
static fromRulesyncSkill(params) {
|
|
5457
|
+
const baseParams = {
|
|
5458
|
+
...this.fromRulesyncSkillDefault(params),
|
|
5459
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath
|
|
5460
|
+
};
|
|
5461
|
+
return new _GeminiCliSkill(baseParams);
|
|
5462
|
+
}
|
|
5463
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
5464
|
+
return this.isTargetedByRulesyncSkillDefault({
|
|
5465
|
+
rulesyncSkill,
|
|
5466
|
+
toolTarget: "geminicli"
|
|
5467
|
+
});
|
|
5468
|
+
}
|
|
5469
|
+
static forDeletion(params) {
|
|
5470
|
+
const baseParams = this.forDeletionDefault(params);
|
|
5471
|
+
return new _GeminiCliSkill(baseParams);
|
|
5472
|
+
}
|
|
5473
|
+
};
|
|
5474
|
+
|
|
5475
|
+
// src/features/skills/skills-processor.ts
|
|
5476
|
+
var import_node_path53 = require("path");
|
|
5477
|
+
var import_mini26 = require("zod/mini");
|
|
5478
|
+
|
|
5479
|
+
// src/types/dir-feature-processor.ts
|
|
5480
|
+
var import_node_path48 = require("path");
|
|
5481
|
+
var DirFeatureProcessor = class {
|
|
5482
|
+
baseDir;
|
|
5483
|
+
constructor({ baseDir = process.cwd() }) {
|
|
5484
|
+
this.baseDir = baseDir;
|
|
5485
|
+
}
|
|
5486
|
+
/**
|
|
5487
|
+
* Return tool targets that this feature supports.
|
|
5488
|
+
*/
|
|
5489
|
+
static getToolTargets(_params = {}) {
|
|
5490
|
+
throw new Error("Not implemented");
|
|
5491
|
+
}
|
|
5492
|
+
/**
|
|
5493
|
+
* Once converted to rulesync/tool dirs, write them to the filesystem.
|
|
5494
|
+
* Returns the number of directories written.
|
|
5495
|
+
*/
|
|
5496
|
+
async writeAiDirs(aiDirs) {
|
|
5497
|
+
for (const aiDir of aiDirs) {
|
|
5498
|
+
const dirPath = aiDir.getDirPath();
|
|
5499
|
+
await ensureDir(dirPath);
|
|
5500
|
+
const mainFile = aiDir.getMainFile();
|
|
5501
|
+
if (mainFile) {
|
|
5502
|
+
const mainFilePath = (0, import_node_path48.join)(dirPath, mainFile.name);
|
|
5503
|
+
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5504
|
+
const contentWithNewline = addTrailingNewline(content);
|
|
5505
|
+
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5506
|
+
}
|
|
5507
|
+
const otherFiles = aiDir.getOtherFiles();
|
|
5508
|
+
for (const file of otherFiles) {
|
|
5509
|
+
const filePath = (0, import_node_path48.join)(dirPath, file.relativeFilePathToDirPath);
|
|
5510
|
+
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5511
|
+
await writeFileContent(filePath, contentWithNewline);
|
|
5512
|
+
}
|
|
5513
|
+
}
|
|
5514
|
+
return aiDirs.length;
|
|
5515
|
+
}
|
|
5516
|
+
async removeAiDirs(aiDirs) {
|
|
5517
|
+
for (const aiDir of aiDirs) {
|
|
5518
|
+
await removeDirectory(aiDir.getDirPath());
|
|
5519
|
+
}
|
|
5520
|
+
}
|
|
5521
|
+
};
|
|
5522
|
+
|
|
5523
|
+
// src/features/skills/claudecode-skill.ts
|
|
5524
|
+
var import_node_path49 = require("path");
|
|
5525
|
+
var import_mini22 = require("zod/mini");
|
|
5526
|
+
var ClaudecodeSkillFrontmatterSchema = import_mini22.z.looseObject({
|
|
5527
|
+
name: import_mini22.z.string(),
|
|
5528
|
+
description: import_mini22.z.string(),
|
|
5529
|
+
"allowed-tools": import_mini22.z.optional(import_mini22.z.array(import_mini22.z.string()))
|
|
5404
5530
|
});
|
|
5405
5531
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
5406
5532
|
constructor({
|
|
@@ -5561,10 +5687,10 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5561
5687
|
|
|
5562
5688
|
// src/features/skills/codexcli-skill.ts
|
|
5563
5689
|
var import_node_path50 = require("path");
|
|
5564
|
-
var
|
|
5565
|
-
var CodexCliSkillFrontmatterSchema =
|
|
5566
|
-
name:
|
|
5567
|
-
description:
|
|
5690
|
+
var import_mini23 = require("zod/mini");
|
|
5691
|
+
var CodexCliSkillFrontmatterSchema = import_mini23.z.looseObject({
|
|
5692
|
+
name: import_mini23.z.string(),
|
|
5693
|
+
description: import_mini23.z.string()
|
|
5568
5694
|
});
|
|
5569
5695
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
5570
5696
|
constructor({
|
|
@@ -5720,11 +5846,11 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5720
5846
|
|
|
5721
5847
|
// src/features/skills/copilot-skill.ts
|
|
5722
5848
|
var import_node_path51 = require("path");
|
|
5723
|
-
var
|
|
5724
|
-
var CopilotSkillFrontmatterSchema =
|
|
5725
|
-
name:
|
|
5726
|
-
description:
|
|
5727
|
-
license:
|
|
5849
|
+
var import_mini24 = require("zod/mini");
|
|
5850
|
+
var CopilotSkillFrontmatterSchema = import_mini24.z.looseObject({
|
|
5851
|
+
name: import_mini24.z.string(),
|
|
5852
|
+
description: import_mini24.z.string(),
|
|
5853
|
+
license: import_mini24.z.optional(import_mini24.z.string())
|
|
5728
5854
|
});
|
|
5729
5855
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
5730
5856
|
constructor({
|
|
@@ -5887,11 +6013,11 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
5887
6013
|
|
|
5888
6014
|
// src/features/skills/opencode-skill.ts
|
|
5889
6015
|
var import_node_path52 = require("path");
|
|
5890
|
-
var
|
|
5891
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
5892
|
-
name:
|
|
5893
|
-
description:
|
|
5894
|
-
"allowed-tools":
|
|
6016
|
+
var import_mini25 = require("zod/mini");
|
|
6017
|
+
var OpenCodeSkillFrontmatterSchema = import_mini25.z.looseObject({
|
|
6018
|
+
name: import_mini25.z.string(),
|
|
6019
|
+
description: import_mini25.z.string(),
|
|
6020
|
+
"allowed-tools": import_mini25.z.optional(import_mini25.z.array(import_mini25.z.string()))
|
|
5895
6021
|
});
|
|
5896
6022
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
5897
6023
|
constructor({
|
|
@@ -6058,7 +6184,7 @@ var skillsProcessorToolTargetTuple = [
|
|
|
6058
6184
|
"geminicli",
|
|
6059
6185
|
"opencode"
|
|
6060
6186
|
];
|
|
6061
|
-
var SkillsProcessorToolTargetSchema =
|
|
6187
|
+
var SkillsProcessorToolTargetSchema = import_mini26.z.enum(skillsProcessorToolTargetTuple);
|
|
6062
6188
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
6063
6189
|
[
|
|
6064
6190
|
"agentsmd",
|
|
@@ -6092,7 +6218,7 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
6092
6218
|
"cursor",
|
|
6093
6219
|
{
|
|
6094
6220
|
class: CursorSkill,
|
|
6095
|
-
meta: { supportsProject: true, supportsSimulated:
|
|
6221
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: false }
|
|
6096
6222
|
}
|
|
6097
6223
|
],
|
|
6098
6224
|
[
|
|
@@ -6277,7 +6403,7 @@ var import_node_path55 = require("path");
|
|
|
6277
6403
|
|
|
6278
6404
|
// src/features/subagents/simulated-subagent.ts
|
|
6279
6405
|
var import_node_path54 = require("path");
|
|
6280
|
-
var
|
|
6406
|
+
var import_mini27 = require("zod/mini");
|
|
6281
6407
|
|
|
6282
6408
|
// src/features/subagents/tool-subagent.ts
|
|
6283
6409
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -6320,9 +6446,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
6320
6446
|
};
|
|
6321
6447
|
|
|
6322
6448
|
// src/features/subagents/simulated-subagent.ts
|
|
6323
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
6324
|
-
name:
|
|
6325
|
-
description:
|
|
6449
|
+
var SimulatedSubagentFrontmatterSchema = import_mini27.z.object({
|
|
6450
|
+
name: import_mini27.z.string(),
|
|
6451
|
+
description: import_mini27.z.string()
|
|
6326
6452
|
});
|
|
6327
6453
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
6328
6454
|
frontmatter;
|
|
@@ -6561,19 +6687,19 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
6561
6687
|
|
|
6562
6688
|
// src/features/subagents/subagents-processor.ts
|
|
6563
6689
|
var import_node_path64 = require("path");
|
|
6564
|
-
var
|
|
6690
|
+
var import_mini32 = require("zod/mini");
|
|
6565
6691
|
|
|
6566
6692
|
// src/features/subagents/claudecode-subagent.ts
|
|
6567
6693
|
var import_node_path61 = require("path");
|
|
6568
|
-
var
|
|
6694
|
+
var import_mini29 = require("zod/mini");
|
|
6569
6695
|
|
|
6570
6696
|
// src/features/subagents/rulesync-subagent.ts
|
|
6571
6697
|
var import_node_path60 = require("path");
|
|
6572
|
-
var
|
|
6573
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
6698
|
+
var import_mini28 = require("zod/mini");
|
|
6699
|
+
var RulesyncSubagentFrontmatterSchema = import_mini28.z.looseObject({
|
|
6574
6700
|
targets: RulesyncTargetsSchema,
|
|
6575
|
-
name:
|
|
6576
|
-
description:
|
|
6701
|
+
name: import_mini28.z.string(),
|
|
6702
|
+
description: import_mini28.z.string()
|
|
6577
6703
|
});
|
|
6578
6704
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
6579
6705
|
frontmatter;
|
|
@@ -6644,13 +6770,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
6644
6770
|
};
|
|
6645
6771
|
|
|
6646
6772
|
// src/features/subagents/claudecode-subagent.ts
|
|
6647
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
6648
|
-
name:
|
|
6649
|
-
description:
|
|
6650
|
-
model:
|
|
6651
|
-
tools:
|
|
6652
|
-
permissionMode:
|
|
6653
|
-
skills:
|
|
6773
|
+
var ClaudecodeSubagentFrontmatterSchema = import_mini29.z.looseObject({
|
|
6774
|
+
name: import_mini29.z.string(),
|
|
6775
|
+
description: import_mini29.z.string(),
|
|
6776
|
+
model: import_mini29.z.optional(import_mini29.z.string()),
|
|
6777
|
+
tools: import_mini29.z.optional(import_mini29.z.union([import_mini29.z.string(), import_mini29.z.array(import_mini29.z.string())])),
|
|
6778
|
+
permissionMode: import_mini29.z.optional(import_mini29.z.string()),
|
|
6779
|
+
skills: import_mini29.z.optional(import_mini29.z.union([import_mini29.z.string(), import_mini29.z.array(import_mini29.z.string())]))
|
|
6654
6780
|
});
|
|
6655
6781
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
6656
6782
|
frontmatter;
|
|
@@ -6800,12 +6926,12 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
6800
6926
|
|
|
6801
6927
|
// src/features/subagents/copilot-subagent.ts
|
|
6802
6928
|
var import_node_path62 = require("path");
|
|
6803
|
-
var
|
|
6929
|
+
var import_mini30 = require("zod/mini");
|
|
6804
6930
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
6805
|
-
var CopilotSubagentFrontmatterSchema =
|
|
6806
|
-
name:
|
|
6807
|
-
description:
|
|
6808
|
-
tools:
|
|
6931
|
+
var CopilotSubagentFrontmatterSchema = import_mini30.z.looseObject({
|
|
6932
|
+
name: import_mini30.z.string(),
|
|
6933
|
+
description: import_mini30.z.string(),
|
|
6934
|
+
tools: import_mini30.z.optional(import_mini30.z.union([import_mini30.z.string(), import_mini30.z.array(import_mini30.z.string())]))
|
|
6809
6935
|
});
|
|
6810
6936
|
var normalizeTools = (tools) => {
|
|
6811
6937
|
if (!tools) {
|
|
@@ -6966,11 +7092,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
6966
7092
|
|
|
6967
7093
|
// src/features/subagents/opencode-subagent.ts
|
|
6968
7094
|
var import_node_path63 = require("path");
|
|
6969
|
-
var
|
|
6970
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
6971
|
-
description:
|
|
6972
|
-
mode:
|
|
6973
|
-
name:
|
|
7095
|
+
var import_mini31 = require("zod/mini");
|
|
7096
|
+
var OpenCodeSubagentFrontmatterSchema = import_mini31.z.looseObject({
|
|
7097
|
+
description: import_mini31.z.string(),
|
|
7098
|
+
mode: import_mini31.z.literal("subagent"),
|
|
7099
|
+
name: import_mini31.z.optional(import_mini31.z.string())
|
|
6974
7100
|
});
|
|
6975
7101
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
6976
7102
|
frontmatter;
|
|
@@ -7123,7 +7249,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
7123
7249
|
"opencode",
|
|
7124
7250
|
"roo"
|
|
7125
7251
|
];
|
|
7126
|
-
var SubagentsProcessorToolTargetSchema =
|
|
7252
|
+
var SubagentsProcessorToolTargetSchema = import_mini32.z.enum(subagentsProcessorToolTargetTuple);
|
|
7127
7253
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
7128
7254
|
[
|
|
7129
7255
|
"agentsmd",
|
|
@@ -7335,41 +7461,41 @@ var import_node_path66 = require("path");
|
|
|
7335
7461
|
|
|
7336
7462
|
// src/features/rules/rulesync-rule.ts
|
|
7337
7463
|
var import_node_path65 = require("path");
|
|
7338
|
-
var
|
|
7339
|
-
var RulesyncRuleFrontmatterSchema =
|
|
7340
|
-
root:
|
|
7341
|
-
targets:
|
|
7342
|
-
description:
|
|
7343
|
-
globs:
|
|
7344
|
-
agentsmd:
|
|
7345
|
-
|
|
7464
|
+
var import_mini33 = require("zod/mini");
|
|
7465
|
+
var RulesyncRuleFrontmatterSchema = import_mini33.z.object({
|
|
7466
|
+
root: import_mini33.z.optional(import_mini33.z.optional(import_mini33.z.boolean())),
|
|
7467
|
+
targets: import_mini33.z.optional(RulesyncTargetsSchema),
|
|
7468
|
+
description: import_mini33.z.optional(import_mini33.z.string()),
|
|
7469
|
+
globs: import_mini33.z.optional(import_mini33.z.array(import_mini33.z.string())),
|
|
7470
|
+
agentsmd: import_mini33.z.optional(
|
|
7471
|
+
import_mini33.z.object({
|
|
7346
7472
|
// @example "path/to/subproject"
|
|
7347
|
-
subprojectPath:
|
|
7473
|
+
subprojectPath: import_mini33.z.optional(import_mini33.z.string())
|
|
7348
7474
|
})
|
|
7349
7475
|
),
|
|
7350
|
-
claudecode:
|
|
7351
|
-
|
|
7476
|
+
claudecode: import_mini33.z.optional(
|
|
7477
|
+
import_mini33.z.object({
|
|
7352
7478
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
7353
7479
|
// @example "src/**/*.ts, tests/**/*.test.ts"
|
|
7354
|
-
paths:
|
|
7480
|
+
paths: import_mini33.z.optional(import_mini33.z.string())
|
|
7355
7481
|
})
|
|
7356
7482
|
),
|
|
7357
|
-
cursor:
|
|
7358
|
-
|
|
7359
|
-
alwaysApply:
|
|
7360
|
-
description:
|
|
7361
|
-
globs:
|
|
7483
|
+
cursor: import_mini33.z.optional(
|
|
7484
|
+
import_mini33.z.object({
|
|
7485
|
+
alwaysApply: import_mini33.z.optional(import_mini33.z.boolean()),
|
|
7486
|
+
description: import_mini33.z.optional(import_mini33.z.string()),
|
|
7487
|
+
globs: import_mini33.z.optional(import_mini33.z.array(import_mini33.z.string()))
|
|
7362
7488
|
})
|
|
7363
7489
|
),
|
|
7364
|
-
copilot:
|
|
7365
|
-
|
|
7366
|
-
excludeAgent:
|
|
7490
|
+
copilot: import_mini33.z.optional(
|
|
7491
|
+
import_mini33.z.object({
|
|
7492
|
+
excludeAgent: import_mini33.z.optional(import_mini33.z.union([import_mini33.z.literal("code-review"), import_mini33.z.literal("coding-agent")]))
|
|
7367
7493
|
})
|
|
7368
7494
|
),
|
|
7369
|
-
antigravity:
|
|
7370
|
-
|
|
7371
|
-
trigger:
|
|
7372
|
-
globs:
|
|
7495
|
+
antigravity: import_mini33.z.optional(
|
|
7496
|
+
import_mini33.z.looseObject({
|
|
7497
|
+
trigger: import_mini33.z.optional(import_mini33.z.string()),
|
|
7498
|
+
globs: import_mini33.z.optional(import_mini33.z.array(import_mini33.z.string()))
|
|
7373
7499
|
})
|
|
7374
7500
|
)
|
|
7375
7501
|
});
|
|
@@ -7777,20 +7903,20 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
7777
7903
|
|
|
7778
7904
|
// src/features/rules/antigravity-rule.ts
|
|
7779
7905
|
var import_node_path69 = require("path");
|
|
7780
|
-
var
|
|
7781
|
-
var AntigravityRuleFrontmatterSchema =
|
|
7782
|
-
trigger:
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
|
|
7906
|
+
var import_mini34 = require("zod/mini");
|
|
7907
|
+
var AntigravityRuleFrontmatterSchema = import_mini34.z.looseObject({
|
|
7908
|
+
trigger: import_mini34.z.optional(
|
|
7909
|
+
import_mini34.z.union([
|
|
7910
|
+
import_mini34.z.literal("always_on"),
|
|
7911
|
+
import_mini34.z.literal("glob"),
|
|
7912
|
+
import_mini34.z.literal("manual"),
|
|
7913
|
+
import_mini34.z.literal("model_decision"),
|
|
7914
|
+
import_mini34.z.string()
|
|
7789
7915
|
// accepts any string for forward compatibility
|
|
7790
7916
|
])
|
|
7791
7917
|
),
|
|
7792
|
-
globs:
|
|
7793
|
-
description:
|
|
7918
|
+
globs: import_mini34.z.optional(import_mini34.z.string()),
|
|
7919
|
+
description: import_mini34.z.optional(import_mini34.z.string())
|
|
7794
7920
|
});
|
|
7795
7921
|
function parseGlobsString(globs) {
|
|
7796
7922
|
if (!globs) {
|
|
@@ -8368,9 +8494,9 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8368
8494
|
|
|
8369
8495
|
// src/features/rules/claudecode-rule.ts
|
|
8370
8496
|
var import_node_path73 = require("path");
|
|
8371
|
-
var
|
|
8372
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
8373
|
-
paths:
|
|
8497
|
+
var import_mini35 = require("zod/mini");
|
|
8498
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini35.z.object({
|
|
8499
|
+
paths: import_mini35.z.optional(import_mini35.z.string())
|
|
8374
8500
|
});
|
|
8375
8501
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
8376
8502
|
frontmatter;
|
|
@@ -8578,9 +8704,9 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8578
8704
|
|
|
8579
8705
|
// src/features/rules/cline-rule.ts
|
|
8580
8706
|
var import_node_path74 = require("path");
|
|
8581
|
-
var
|
|
8582
|
-
var ClineRuleFrontmatterSchema =
|
|
8583
|
-
description:
|
|
8707
|
+
var import_mini36 = require("zod/mini");
|
|
8708
|
+
var ClineRuleFrontmatterSchema = import_mini36.z.object({
|
|
8709
|
+
description: import_mini36.z.string()
|
|
8584
8710
|
});
|
|
8585
8711
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
8586
8712
|
static getSettablePaths() {
|
|
@@ -8757,11 +8883,11 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
8757
8883
|
|
|
8758
8884
|
// src/features/rules/copilot-rule.ts
|
|
8759
8885
|
var import_node_path76 = require("path");
|
|
8760
|
-
var
|
|
8761
|
-
var CopilotRuleFrontmatterSchema =
|
|
8762
|
-
description:
|
|
8763
|
-
applyTo:
|
|
8764
|
-
excludeAgent:
|
|
8886
|
+
var import_mini37 = require("zod/mini");
|
|
8887
|
+
var CopilotRuleFrontmatterSchema = import_mini37.z.object({
|
|
8888
|
+
description: import_mini37.z.optional(import_mini37.z.string()),
|
|
8889
|
+
applyTo: import_mini37.z.optional(import_mini37.z.string()),
|
|
8890
|
+
excludeAgent: import_mini37.z.optional(import_mini37.z.union([import_mini37.z.literal("code-review"), import_mini37.z.literal("coding-agent")]))
|
|
8765
8891
|
});
|
|
8766
8892
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
8767
8893
|
frontmatter;
|
|
@@ -8945,11 +9071,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
8945
9071
|
|
|
8946
9072
|
// src/features/rules/cursor-rule.ts
|
|
8947
9073
|
var import_node_path77 = require("path");
|
|
8948
|
-
var
|
|
8949
|
-
var CursorRuleFrontmatterSchema =
|
|
8950
|
-
description:
|
|
8951
|
-
globs:
|
|
8952
|
-
alwaysApply:
|
|
9074
|
+
var import_mini38 = require("zod/mini");
|
|
9075
|
+
var CursorRuleFrontmatterSchema = import_mini38.z.object({
|
|
9076
|
+
description: import_mini38.z.optional(import_mini38.z.string()),
|
|
9077
|
+
globs: import_mini38.z.optional(import_mini38.z.string()),
|
|
9078
|
+
alwaysApply: import_mini38.z.optional(import_mini38.z.boolean())
|
|
8953
9079
|
});
|
|
8954
9080
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
8955
9081
|
frontmatter;
|
|
@@ -9799,7 +9925,7 @@ var rulesProcessorToolTargets = [
|
|
|
9799
9925
|
"warp",
|
|
9800
9926
|
"windsurf"
|
|
9801
9927
|
];
|
|
9802
|
-
var RulesProcessorToolTargetSchema =
|
|
9928
|
+
var RulesProcessorToolTargetSchema = import_mini39.z.enum(rulesProcessorToolTargets);
|
|
9803
9929
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
9804
9930
|
[
|
|
9805
9931
|
"agentsmd",
|
|
@@ -11156,9 +11282,12 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11156
11282
|
// src/cli/commands/mcp.ts
|
|
11157
11283
|
var import_fastmcp = require("fastmcp");
|
|
11158
11284
|
|
|
11285
|
+
// src/mcp/tools.ts
|
|
11286
|
+
var import_mini46 = require("zod/mini");
|
|
11287
|
+
|
|
11159
11288
|
// src/mcp/commands.ts
|
|
11160
11289
|
var import_node_path89 = require("path");
|
|
11161
|
-
var
|
|
11290
|
+
var import_mini40 = require("zod/mini");
|
|
11162
11291
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
11163
11292
|
var maxCommandsCount = 1e3;
|
|
11164
11293
|
async function listCommands() {
|
|
@@ -11277,17 +11406,17 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
11277
11406
|
}
|
|
11278
11407
|
}
|
|
11279
11408
|
var commandToolSchemas = {
|
|
11280
|
-
listCommands:
|
|
11281
|
-
getCommand:
|
|
11282
|
-
relativePathFromCwd:
|
|
11409
|
+
listCommands: import_mini40.z.object({}),
|
|
11410
|
+
getCommand: import_mini40.z.object({
|
|
11411
|
+
relativePathFromCwd: import_mini40.z.string()
|
|
11283
11412
|
}),
|
|
11284
|
-
putCommand:
|
|
11285
|
-
relativePathFromCwd:
|
|
11413
|
+
putCommand: import_mini40.z.object({
|
|
11414
|
+
relativePathFromCwd: import_mini40.z.string(),
|
|
11286
11415
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
11287
|
-
body:
|
|
11416
|
+
body: import_mini40.z.string()
|
|
11288
11417
|
}),
|
|
11289
|
-
deleteCommand:
|
|
11290
|
-
relativePathFromCwd:
|
|
11418
|
+
deleteCommand: import_mini40.z.object({
|
|
11419
|
+
relativePathFromCwd: import_mini40.z.string()
|
|
11291
11420
|
})
|
|
11292
11421
|
};
|
|
11293
11422
|
var commandTools = {
|
|
@@ -11336,7 +11465,7 @@ var commandTools = {
|
|
|
11336
11465
|
|
|
11337
11466
|
// src/mcp/ignore.ts
|
|
11338
11467
|
var import_node_path90 = require("path");
|
|
11339
|
-
var
|
|
11468
|
+
var import_mini41 = require("zod/mini");
|
|
11340
11469
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
11341
11470
|
async function getIgnoreFile() {
|
|
11342
11471
|
const ignoreFilePath = (0, import_node_path90.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
@@ -11393,11 +11522,11 @@ async function deleteIgnoreFile() {
|
|
|
11393
11522
|
}
|
|
11394
11523
|
}
|
|
11395
11524
|
var ignoreToolSchemas = {
|
|
11396
|
-
getIgnoreFile:
|
|
11397
|
-
putIgnoreFile:
|
|
11398
|
-
content:
|
|
11525
|
+
getIgnoreFile: import_mini41.z.object({}),
|
|
11526
|
+
putIgnoreFile: import_mini41.z.object({
|
|
11527
|
+
content: import_mini41.z.string()
|
|
11399
11528
|
}),
|
|
11400
|
-
deleteIgnoreFile:
|
|
11529
|
+
deleteIgnoreFile: import_mini41.z.object({})
|
|
11401
11530
|
};
|
|
11402
11531
|
var ignoreTools = {
|
|
11403
11532
|
getIgnoreFile: {
|
|
@@ -11431,7 +11560,7 @@ var ignoreTools = {
|
|
|
11431
11560
|
|
|
11432
11561
|
// src/mcp/mcp.ts
|
|
11433
11562
|
var import_node_path91 = require("path");
|
|
11434
|
-
var
|
|
11563
|
+
var import_mini42 = require("zod/mini");
|
|
11435
11564
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
11436
11565
|
async function getMcpFile() {
|
|
11437
11566
|
const config = await ConfigResolver.resolve({});
|
|
@@ -11521,11 +11650,11 @@ async function deleteMcpFile() {
|
|
|
11521
11650
|
}
|
|
11522
11651
|
}
|
|
11523
11652
|
var mcpToolSchemas = {
|
|
11524
|
-
getMcpFile:
|
|
11525
|
-
putMcpFile:
|
|
11526
|
-
content:
|
|
11653
|
+
getMcpFile: import_mini42.z.object({}),
|
|
11654
|
+
putMcpFile: import_mini42.z.object({
|
|
11655
|
+
content: import_mini42.z.string()
|
|
11527
11656
|
}),
|
|
11528
|
-
deleteMcpFile:
|
|
11657
|
+
deleteMcpFile: import_mini42.z.object({})
|
|
11529
11658
|
};
|
|
11530
11659
|
var mcpTools = {
|
|
11531
11660
|
getMcpFile: {
|
|
@@ -11559,7 +11688,7 @@ var mcpTools = {
|
|
|
11559
11688
|
|
|
11560
11689
|
// src/mcp/rules.ts
|
|
11561
11690
|
var import_node_path92 = require("path");
|
|
11562
|
-
var
|
|
11691
|
+
var import_mini43 = require("zod/mini");
|
|
11563
11692
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
11564
11693
|
var maxRulesCount = 1e3;
|
|
11565
11694
|
async function listRules() {
|
|
@@ -11678,17 +11807,17 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
11678
11807
|
}
|
|
11679
11808
|
}
|
|
11680
11809
|
var ruleToolSchemas = {
|
|
11681
|
-
listRules:
|
|
11682
|
-
getRule:
|
|
11683
|
-
relativePathFromCwd:
|
|
11810
|
+
listRules: import_mini43.z.object({}),
|
|
11811
|
+
getRule: import_mini43.z.object({
|
|
11812
|
+
relativePathFromCwd: import_mini43.z.string()
|
|
11684
11813
|
}),
|
|
11685
|
-
putRule:
|
|
11686
|
-
relativePathFromCwd:
|
|
11814
|
+
putRule: import_mini43.z.object({
|
|
11815
|
+
relativePathFromCwd: import_mini43.z.string(),
|
|
11687
11816
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
11688
|
-
body:
|
|
11817
|
+
body: import_mini43.z.string()
|
|
11689
11818
|
}),
|
|
11690
|
-
deleteRule:
|
|
11691
|
-
relativePathFromCwd:
|
|
11819
|
+
deleteRule: import_mini43.z.object({
|
|
11820
|
+
relativePathFromCwd: import_mini43.z.string()
|
|
11692
11821
|
})
|
|
11693
11822
|
};
|
|
11694
11823
|
var ruleTools = {
|
|
@@ -11737,7 +11866,7 @@ var ruleTools = {
|
|
|
11737
11866
|
|
|
11738
11867
|
// src/mcp/skills.ts
|
|
11739
11868
|
var import_node_path93 = require("path");
|
|
11740
|
-
var
|
|
11869
|
+
var import_mini44 = require("zod/mini");
|
|
11741
11870
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
11742
11871
|
var maxSkillsCount = 1e3;
|
|
11743
11872
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -11905,23 +12034,23 @@ async function deleteSkill({
|
|
|
11905
12034
|
);
|
|
11906
12035
|
}
|
|
11907
12036
|
}
|
|
11908
|
-
var McpSkillFileSchema =
|
|
11909
|
-
name:
|
|
11910
|
-
body:
|
|
12037
|
+
var McpSkillFileSchema = import_mini44.z.object({
|
|
12038
|
+
name: import_mini44.z.string(),
|
|
12039
|
+
body: import_mini44.z.string()
|
|
11911
12040
|
});
|
|
11912
12041
|
var skillToolSchemas = {
|
|
11913
|
-
listSkills:
|
|
11914
|
-
getSkill:
|
|
11915
|
-
relativeDirPathFromCwd:
|
|
12042
|
+
listSkills: import_mini44.z.object({}),
|
|
12043
|
+
getSkill: import_mini44.z.object({
|
|
12044
|
+
relativeDirPathFromCwd: import_mini44.z.string()
|
|
11916
12045
|
}),
|
|
11917
|
-
putSkill:
|
|
11918
|
-
relativeDirPathFromCwd:
|
|
12046
|
+
putSkill: import_mini44.z.object({
|
|
12047
|
+
relativeDirPathFromCwd: import_mini44.z.string(),
|
|
11919
12048
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
11920
|
-
body:
|
|
11921
|
-
otherFiles:
|
|
12049
|
+
body: import_mini44.z.string(),
|
|
12050
|
+
otherFiles: import_mini44.z.optional(import_mini44.z.array(McpSkillFileSchema))
|
|
11922
12051
|
}),
|
|
11923
|
-
deleteSkill:
|
|
11924
|
-
relativeDirPathFromCwd:
|
|
12052
|
+
deleteSkill: import_mini44.z.object({
|
|
12053
|
+
relativeDirPathFromCwd: import_mini44.z.string()
|
|
11925
12054
|
})
|
|
11926
12055
|
};
|
|
11927
12056
|
var skillTools = {
|
|
@@ -11971,7 +12100,7 @@ var skillTools = {
|
|
|
11971
12100
|
|
|
11972
12101
|
// src/mcp/subagents.ts
|
|
11973
12102
|
var import_node_path94 = require("path");
|
|
11974
|
-
var
|
|
12103
|
+
var import_mini45 = require("zod/mini");
|
|
11975
12104
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
11976
12105
|
var maxSubagentsCount = 1e3;
|
|
11977
12106
|
async function listSubagents() {
|
|
@@ -12095,17 +12224,17 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12095
12224
|
}
|
|
12096
12225
|
}
|
|
12097
12226
|
var subagentToolSchemas = {
|
|
12098
|
-
listSubagents:
|
|
12099
|
-
getSubagent:
|
|
12100
|
-
relativePathFromCwd:
|
|
12227
|
+
listSubagents: import_mini45.z.object({}),
|
|
12228
|
+
getSubagent: import_mini45.z.object({
|
|
12229
|
+
relativePathFromCwd: import_mini45.z.string()
|
|
12101
12230
|
}),
|
|
12102
|
-
putSubagent:
|
|
12103
|
-
relativePathFromCwd:
|
|
12231
|
+
putSubagent: import_mini45.z.object({
|
|
12232
|
+
relativePathFromCwd: import_mini45.z.string(),
|
|
12104
12233
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
12105
|
-
body:
|
|
12234
|
+
body: import_mini45.z.string()
|
|
12106
12235
|
}),
|
|
12107
|
-
deleteSubagent:
|
|
12108
|
-
relativePathFromCwd:
|
|
12236
|
+
deleteSubagent: import_mini45.z.object({
|
|
12237
|
+
relativePathFromCwd: import_mini45.z.string()
|
|
12109
12238
|
})
|
|
12110
12239
|
};
|
|
12111
12240
|
var subagentTools = {
|
|
@@ -12152,6 +12281,200 @@ var subagentTools = {
|
|
|
12152
12281
|
}
|
|
12153
12282
|
};
|
|
12154
12283
|
|
|
12284
|
+
// src/mcp/tools.ts
|
|
12285
|
+
var rulesyncFeatureSchema = import_mini46.z.enum(["rule", "command", "subagent", "skill", "ignore", "mcp"]);
|
|
12286
|
+
var rulesyncOperationSchema = import_mini46.z.enum(["list", "get", "put", "delete"]);
|
|
12287
|
+
var skillFileSchema = import_mini46.z.object({
|
|
12288
|
+
name: import_mini46.z.string(),
|
|
12289
|
+
body: import_mini46.z.string()
|
|
12290
|
+
});
|
|
12291
|
+
var rulesyncToolSchema = import_mini46.z.object({
|
|
12292
|
+
feature: rulesyncFeatureSchema,
|
|
12293
|
+
operation: rulesyncOperationSchema,
|
|
12294
|
+
targetPathFromCwd: import_mini46.z.optional(import_mini46.z.string()),
|
|
12295
|
+
frontmatter: import_mini46.z.optional(import_mini46.z.unknown()),
|
|
12296
|
+
body: import_mini46.z.optional(import_mini46.z.string()),
|
|
12297
|
+
otherFiles: import_mini46.z.optional(import_mini46.z.array(skillFileSchema)),
|
|
12298
|
+
content: import_mini46.z.optional(import_mini46.z.string())
|
|
12299
|
+
});
|
|
12300
|
+
var supportedOperationsByFeature = {
|
|
12301
|
+
rule: ["list", "get", "put", "delete"],
|
|
12302
|
+
command: ["list", "get", "put", "delete"],
|
|
12303
|
+
subagent: ["list", "get", "put", "delete"],
|
|
12304
|
+
skill: ["list", "get", "put", "delete"],
|
|
12305
|
+
ignore: ["get", "put", "delete"],
|
|
12306
|
+
mcp: ["get", "put", "delete"]
|
|
12307
|
+
};
|
|
12308
|
+
function assertSupported({
|
|
12309
|
+
feature,
|
|
12310
|
+
operation
|
|
12311
|
+
}) {
|
|
12312
|
+
const supportedOperations = supportedOperationsByFeature[feature];
|
|
12313
|
+
if (!supportedOperations.includes(operation)) {
|
|
12314
|
+
throw new Error(
|
|
12315
|
+
`Operation ${operation} is not supported for feature ${feature}. Supported operations: ${supportedOperations.join(
|
|
12316
|
+
", "
|
|
12317
|
+
)}`
|
|
12318
|
+
);
|
|
12319
|
+
}
|
|
12320
|
+
}
|
|
12321
|
+
function requireTargetPath({ targetPathFromCwd, feature, operation }) {
|
|
12322
|
+
if (!targetPathFromCwd) {
|
|
12323
|
+
throw new Error(`targetPathFromCwd is required for ${feature} ${operation} operation`);
|
|
12324
|
+
}
|
|
12325
|
+
return targetPathFromCwd;
|
|
12326
|
+
}
|
|
12327
|
+
function parseFrontmatter2({
|
|
12328
|
+
feature,
|
|
12329
|
+
frontmatter
|
|
12330
|
+
}) {
|
|
12331
|
+
switch (feature) {
|
|
12332
|
+
case "rule": {
|
|
12333
|
+
return RulesyncRuleFrontmatterSchema.parse(frontmatter);
|
|
12334
|
+
}
|
|
12335
|
+
case "command": {
|
|
12336
|
+
return RulesyncCommandFrontmatterSchema.parse(frontmatter);
|
|
12337
|
+
}
|
|
12338
|
+
case "subagent": {
|
|
12339
|
+
return RulesyncSubagentFrontmatterSchema.parse(frontmatter);
|
|
12340
|
+
}
|
|
12341
|
+
case "skill": {
|
|
12342
|
+
return RulesyncSkillFrontmatterSchema.parse(frontmatter);
|
|
12343
|
+
}
|
|
12344
|
+
}
|
|
12345
|
+
}
|
|
12346
|
+
function ensureBody({ body, feature, operation }) {
|
|
12347
|
+
if (!body) {
|
|
12348
|
+
throw new Error(`body is required for ${feature} ${operation} operation`);
|
|
12349
|
+
}
|
|
12350
|
+
return body;
|
|
12351
|
+
}
|
|
12352
|
+
var rulesyncTool = {
|
|
12353
|
+
name: "rulesyncTool",
|
|
12354
|
+
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).",
|
|
12355
|
+
parameters: rulesyncToolSchema,
|
|
12356
|
+
execute: async (args) => {
|
|
12357
|
+
const parsed = rulesyncToolSchema.parse(args);
|
|
12358
|
+
assertSupported({ feature: parsed.feature, operation: parsed.operation });
|
|
12359
|
+
switch (parsed.feature) {
|
|
12360
|
+
case "rule": {
|
|
12361
|
+
if (parsed.operation === "list") {
|
|
12362
|
+
return ruleTools.listRules.execute();
|
|
12363
|
+
}
|
|
12364
|
+
if (parsed.operation === "get") {
|
|
12365
|
+
return ruleTools.getRule.execute({ relativePathFromCwd: requireTargetPath(parsed) });
|
|
12366
|
+
}
|
|
12367
|
+
if (parsed.operation === "put") {
|
|
12368
|
+
return ruleTools.putRule.execute({
|
|
12369
|
+
relativePathFromCwd: requireTargetPath(parsed),
|
|
12370
|
+
frontmatter: parseFrontmatter2({
|
|
12371
|
+
feature: "rule",
|
|
12372
|
+
frontmatter: parsed.frontmatter ?? {}
|
|
12373
|
+
}),
|
|
12374
|
+
body: ensureBody(parsed)
|
|
12375
|
+
});
|
|
12376
|
+
}
|
|
12377
|
+
return ruleTools.deleteRule.execute({ relativePathFromCwd: requireTargetPath(parsed) });
|
|
12378
|
+
}
|
|
12379
|
+
case "command": {
|
|
12380
|
+
if (parsed.operation === "list") {
|
|
12381
|
+
return commandTools.listCommands.execute();
|
|
12382
|
+
}
|
|
12383
|
+
if (parsed.operation === "get") {
|
|
12384
|
+
return commandTools.getCommand.execute({
|
|
12385
|
+
relativePathFromCwd: requireTargetPath(parsed)
|
|
12386
|
+
});
|
|
12387
|
+
}
|
|
12388
|
+
if (parsed.operation === "put") {
|
|
12389
|
+
return commandTools.putCommand.execute({
|
|
12390
|
+
relativePathFromCwd: requireTargetPath(parsed),
|
|
12391
|
+
frontmatter: parseFrontmatter2({
|
|
12392
|
+
feature: "command",
|
|
12393
|
+
frontmatter: parsed.frontmatter ?? {}
|
|
12394
|
+
}),
|
|
12395
|
+
body: ensureBody(parsed)
|
|
12396
|
+
});
|
|
12397
|
+
}
|
|
12398
|
+
return commandTools.deleteCommand.execute({
|
|
12399
|
+
relativePathFromCwd: requireTargetPath(parsed)
|
|
12400
|
+
});
|
|
12401
|
+
}
|
|
12402
|
+
case "subagent": {
|
|
12403
|
+
if (parsed.operation === "list") {
|
|
12404
|
+
return subagentTools.listSubagents.execute();
|
|
12405
|
+
}
|
|
12406
|
+
if (parsed.operation === "get") {
|
|
12407
|
+
return subagentTools.getSubagent.execute({
|
|
12408
|
+
relativePathFromCwd: requireTargetPath(parsed)
|
|
12409
|
+
});
|
|
12410
|
+
}
|
|
12411
|
+
if (parsed.operation === "put") {
|
|
12412
|
+
return subagentTools.putSubagent.execute({
|
|
12413
|
+
relativePathFromCwd: requireTargetPath(parsed),
|
|
12414
|
+
frontmatter: parseFrontmatter2({
|
|
12415
|
+
feature: "subagent",
|
|
12416
|
+
frontmatter: parsed.frontmatter ?? {}
|
|
12417
|
+
}),
|
|
12418
|
+
body: ensureBody(parsed)
|
|
12419
|
+
});
|
|
12420
|
+
}
|
|
12421
|
+
return subagentTools.deleteSubagent.execute({
|
|
12422
|
+
relativePathFromCwd: requireTargetPath(parsed)
|
|
12423
|
+
});
|
|
12424
|
+
}
|
|
12425
|
+
case "skill": {
|
|
12426
|
+
if (parsed.operation === "list") {
|
|
12427
|
+
return skillTools.listSkills.execute();
|
|
12428
|
+
}
|
|
12429
|
+
if (parsed.operation === "get") {
|
|
12430
|
+
return skillTools.getSkill.execute({ relativeDirPathFromCwd: requireTargetPath(parsed) });
|
|
12431
|
+
}
|
|
12432
|
+
if (parsed.operation === "put") {
|
|
12433
|
+
return skillTools.putSkill.execute({
|
|
12434
|
+
relativeDirPathFromCwd: requireTargetPath(parsed),
|
|
12435
|
+
frontmatter: parseFrontmatter2({
|
|
12436
|
+
feature: "skill",
|
|
12437
|
+
frontmatter: parsed.frontmatter ?? {}
|
|
12438
|
+
}),
|
|
12439
|
+
body: ensureBody(parsed),
|
|
12440
|
+
otherFiles: parsed.otherFiles ?? []
|
|
12441
|
+
});
|
|
12442
|
+
}
|
|
12443
|
+
return skillTools.deleteSkill.execute({
|
|
12444
|
+
relativeDirPathFromCwd: requireTargetPath(parsed)
|
|
12445
|
+
});
|
|
12446
|
+
}
|
|
12447
|
+
case "ignore": {
|
|
12448
|
+
if (parsed.operation === "get") {
|
|
12449
|
+
return ignoreTools.getIgnoreFile.execute();
|
|
12450
|
+
}
|
|
12451
|
+
if (parsed.operation === "put") {
|
|
12452
|
+
if (!parsed.content) {
|
|
12453
|
+
throw new Error("content is required for ignore put operation");
|
|
12454
|
+
}
|
|
12455
|
+
return ignoreTools.putIgnoreFile.execute({ content: parsed.content });
|
|
12456
|
+
}
|
|
12457
|
+
return ignoreTools.deleteIgnoreFile.execute();
|
|
12458
|
+
}
|
|
12459
|
+
case "mcp": {
|
|
12460
|
+
if (parsed.operation === "get") {
|
|
12461
|
+
return mcpTools.getMcpFile.execute();
|
|
12462
|
+
}
|
|
12463
|
+
if (parsed.operation === "put") {
|
|
12464
|
+
if (!parsed.content) {
|
|
12465
|
+
throw new Error("content is required for mcp put operation");
|
|
12466
|
+
}
|
|
12467
|
+
return mcpTools.putMcpFile.execute({ content: parsed.content });
|
|
12468
|
+
}
|
|
12469
|
+
return mcpTools.deleteMcpFile.execute();
|
|
12470
|
+
}
|
|
12471
|
+
default: {
|
|
12472
|
+
throw new Error(`Unknown feature: ${parsed.feature}`);
|
|
12473
|
+
}
|
|
12474
|
+
}
|
|
12475
|
+
}
|
|
12476
|
+
};
|
|
12477
|
+
|
|
12155
12478
|
// src/cli/commands/mcp.ts
|
|
12156
12479
|
async function mcpCommand({ version }) {
|
|
12157
12480
|
const server = new import_fastmcp.FastMCP({
|
|
@@ -12160,28 +12483,7 @@ async function mcpCommand({ version }) {
|
|
|
12160
12483
|
version,
|
|
12161
12484
|
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."
|
|
12162
12485
|
});
|
|
12163
|
-
server.addTool(
|
|
12164
|
-
server.addTool(ruleTools.getRule);
|
|
12165
|
-
server.addTool(ruleTools.putRule);
|
|
12166
|
-
server.addTool(ruleTools.deleteRule);
|
|
12167
|
-
server.addTool(commandTools.listCommands);
|
|
12168
|
-
server.addTool(commandTools.getCommand);
|
|
12169
|
-
server.addTool(commandTools.putCommand);
|
|
12170
|
-
server.addTool(commandTools.deleteCommand);
|
|
12171
|
-
server.addTool(subagentTools.listSubagents);
|
|
12172
|
-
server.addTool(subagentTools.getSubagent);
|
|
12173
|
-
server.addTool(subagentTools.putSubagent);
|
|
12174
|
-
server.addTool(subagentTools.deleteSubagent);
|
|
12175
|
-
server.addTool(skillTools.listSkills);
|
|
12176
|
-
server.addTool(skillTools.getSkill);
|
|
12177
|
-
server.addTool(skillTools.putSkill);
|
|
12178
|
-
server.addTool(skillTools.deleteSkill);
|
|
12179
|
-
server.addTool(ignoreTools.getIgnoreFile);
|
|
12180
|
-
server.addTool(ignoreTools.putIgnoreFile);
|
|
12181
|
-
server.addTool(ignoreTools.deleteIgnoreFile);
|
|
12182
|
-
server.addTool(mcpTools.getMcpFile);
|
|
12183
|
-
server.addTool(mcpTools.putMcpFile);
|
|
12184
|
-
server.addTool(mcpTools.deleteMcpFile);
|
|
12486
|
+
server.addTool(rulesyncTool);
|
|
12185
12487
|
logger.info("Rulesync MCP server started via stdio");
|
|
12186
12488
|
void server.start({
|
|
12187
12489
|
transportType: "stdio"
|
|
@@ -12189,7 +12491,7 @@ async function mcpCommand({ version }) {
|
|
|
12189
12491
|
}
|
|
12190
12492
|
|
|
12191
12493
|
// src/cli/index.ts
|
|
12192
|
-
var getVersion = () => "4.
|
|
12494
|
+
var getVersion = () => "4.3.0";
|
|
12193
12495
|
var main = async () => {
|
|
12194
12496
|
const program = new import_commander.Command();
|
|
12195
12497
|
const version = getVersion();
|