rulesync 5.3.0 → 5.4.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 +15 -19
- package/dist/index.cjs +771 -490
- package/dist/index.js +734 -453
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4481,8 +4481,84 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4481
4481
|
}
|
|
4482
4482
|
};
|
|
4483
4483
|
|
|
4484
|
-
// src/features/mcp/
|
|
4484
|
+
// src/features/mcp/kiro-mcp.ts
|
|
4485
4485
|
var import_node_path42 = require("path");
|
|
4486
|
+
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
4487
|
+
json;
|
|
4488
|
+
constructor(params) {
|
|
4489
|
+
super(params);
|
|
4490
|
+
this.json = JSON.parse(this.fileContent || "{}");
|
|
4491
|
+
}
|
|
4492
|
+
getJson() {
|
|
4493
|
+
return this.json;
|
|
4494
|
+
}
|
|
4495
|
+
static getSettablePaths() {
|
|
4496
|
+
return {
|
|
4497
|
+
relativeDirPath: (0, import_node_path42.join)(".kiro", "settings"),
|
|
4498
|
+
relativeFilePath: "mcp.json"
|
|
4499
|
+
};
|
|
4500
|
+
}
|
|
4501
|
+
static async fromFile({
|
|
4502
|
+
baseDir = process.cwd(),
|
|
4503
|
+
validate = true
|
|
4504
|
+
}) {
|
|
4505
|
+
const paths = this.getSettablePaths();
|
|
4506
|
+
const fileContent = await readOrInitializeFileContent(
|
|
4507
|
+
(0, import_node_path42.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4508
|
+
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4509
|
+
);
|
|
4510
|
+
return new _KiroMcp({
|
|
4511
|
+
baseDir,
|
|
4512
|
+
relativeDirPath: paths.relativeDirPath,
|
|
4513
|
+
relativeFilePath: paths.relativeFilePath,
|
|
4514
|
+
fileContent,
|
|
4515
|
+
validate
|
|
4516
|
+
});
|
|
4517
|
+
}
|
|
4518
|
+
static fromRulesyncMcp({
|
|
4519
|
+
baseDir = process.cwd(),
|
|
4520
|
+
rulesyncMcp,
|
|
4521
|
+
validate = true
|
|
4522
|
+
}) {
|
|
4523
|
+
const paths = this.getSettablePaths();
|
|
4524
|
+
const fileContent = JSON.stringify(
|
|
4525
|
+
{ mcpServers: rulesyncMcp.getMcpServers({ type: "exposed" }) },
|
|
4526
|
+
null,
|
|
4527
|
+
2
|
|
4528
|
+
);
|
|
4529
|
+
return new _KiroMcp({
|
|
4530
|
+
baseDir,
|
|
4531
|
+
relativeDirPath: paths.relativeDirPath,
|
|
4532
|
+
relativeFilePath: paths.relativeFilePath,
|
|
4533
|
+
fileContent,
|
|
4534
|
+
validate
|
|
4535
|
+
});
|
|
4536
|
+
}
|
|
4537
|
+
toRulesyncMcp() {
|
|
4538
|
+
return this.toRulesyncMcpDefault({
|
|
4539
|
+
fileContent: JSON.stringify({ mcpServers: this.json.mcpServers ?? {} }, null, 2)
|
|
4540
|
+
});
|
|
4541
|
+
}
|
|
4542
|
+
validate() {
|
|
4543
|
+
return { success: true, error: null };
|
|
4544
|
+
}
|
|
4545
|
+
static forDeletion({
|
|
4546
|
+
baseDir = process.cwd(),
|
|
4547
|
+
relativeDirPath,
|
|
4548
|
+
relativeFilePath
|
|
4549
|
+
}) {
|
|
4550
|
+
return new _KiroMcp({
|
|
4551
|
+
baseDir,
|
|
4552
|
+
relativeDirPath,
|
|
4553
|
+
relativeFilePath,
|
|
4554
|
+
fileContent: "{}",
|
|
4555
|
+
validate: false
|
|
4556
|
+
});
|
|
4557
|
+
}
|
|
4558
|
+
};
|
|
4559
|
+
|
|
4560
|
+
// src/features/mcp/opencode-mcp.ts
|
|
4561
|
+
var import_node_path43 = require("path");
|
|
4486
4562
|
var import_mini17 = require("zod/mini");
|
|
4487
4563
|
var OpencodeMcpLocalServerSchema = import_mini17.z.object({
|
|
4488
4564
|
type: import_mini17.z.literal("local"),
|
|
@@ -4606,7 +4682,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4606
4682
|
}) {
|
|
4607
4683
|
const paths = this.getSettablePaths({ global });
|
|
4608
4684
|
const fileContent = await readOrInitializeFileContent(
|
|
4609
|
-
(0,
|
|
4685
|
+
(0, import_node_path43.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4610
4686
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4611
4687
|
);
|
|
4612
4688
|
const json = JSON.parse(fileContent);
|
|
@@ -4627,7 +4703,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4627
4703
|
}) {
|
|
4628
4704
|
const paths = this.getSettablePaths({ global });
|
|
4629
4705
|
const fileContent = await readOrInitializeFileContent(
|
|
4630
|
-
(0,
|
|
4706
|
+
(0, import_node_path43.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4631
4707
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4632
4708
|
);
|
|
4633
4709
|
const json = JSON.parse(fileContent);
|
|
@@ -4671,7 +4747,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4671
4747
|
};
|
|
4672
4748
|
|
|
4673
4749
|
// src/features/mcp/roo-mcp.ts
|
|
4674
|
-
var
|
|
4750
|
+
var import_node_path44 = require("path");
|
|
4675
4751
|
function isRooMcpServers(value) {
|
|
4676
4752
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
4677
4753
|
}
|
|
@@ -4723,7 +4799,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4723
4799
|
validate = true
|
|
4724
4800
|
}) {
|
|
4725
4801
|
const fileContent = await readFileContent(
|
|
4726
|
-
(0,
|
|
4802
|
+
(0, import_node_path44.join)(
|
|
4727
4803
|
baseDir,
|
|
4728
4804
|
this.getSettablePaths().relativeDirPath,
|
|
4729
4805
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4788,6 +4864,7 @@ var mcpProcessorToolTargetTuple = [
|
|
|
4788
4864
|
"cursor",
|
|
4789
4865
|
"geminicli",
|
|
4790
4866
|
"kilo",
|
|
4867
|
+
"kiro",
|
|
4791
4868
|
"junie",
|
|
4792
4869
|
"opencode",
|
|
4793
4870
|
"roo"
|
|
@@ -4850,6 +4927,13 @@ var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
|
4850
4927
|
meta: { supportsProject: true, supportsGlobal: false, supportsModular: false }
|
|
4851
4928
|
}
|
|
4852
4929
|
],
|
|
4930
|
+
[
|
|
4931
|
+
"kiro",
|
|
4932
|
+
{
|
|
4933
|
+
class: KiroMcp,
|
|
4934
|
+
meta: { supportsProject: true, supportsGlobal: false, supportsModular: false }
|
|
4935
|
+
}
|
|
4936
|
+
],
|
|
4853
4937
|
[
|
|
4854
4938
|
"junie",
|
|
4855
4939
|
{
|
|
@@ -5030,24 +5114,24 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
5030
5114
|
|
|
5031
5115
|
// src/features/rules/rules-processor.ts
|
|
5032
5116
|
var import_toon = require("@toon-format/toon");
|
|
5033
|
-
var
|
|
5034
|
-
var
|
|
5117
|
+
var import_node_path93 = require("path");
|
|
5118
|
+
var import_mini42 = require("zod/mini");
|
|
5035
5119
|
|
|
5036
5120
|
// src/constants/general.ts
|
|
5037
5121
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
5038
5122
|
|
|
5039
5123
|
// src/features/skills/agentsmd-skill.ts
|
|
5040
|
-
var
|
|
5124
|
+
var import_node_path48 = require("path");
|
|
5041
5125
|
|
|
5042
5126
|
// src/features/skills/simulated-skill.ts
|
|
5043
|
-
var
|
|
5127
|
+
var import_node_path47 = require("path");
|
|
5044
5128
|
var import_mini19 = require("zod/mini");
|
|
5045
5129
|
|
|
5046
5130
|
// src/features/skills/tool-skill.ts
|
|
5047
|
-
var
|
|
5131
|
+
var import_node_path46 = require("path");
|
|
5048
5132
|
|
|
5049
5133
|
// src/types/ai-dir.ts
|
|
5050
|
-
var
|
|
5134
|
+
var import_node_path45 = __toESM(require("path"), 1);
|
|
5051
5135
|
var AiDir = class {
|
|
5052
5136
|
/**
|
|
5053
5137
|
* @example "."
|
|
@@ -5081,7 +5165,7 @@ var AiDir = class {
|
|
|
5081
5165
|
otherFiles = [],
|
|
5082
5166
|
global = false
|
|
5083
5167
|
}) {
|
|
5084
|
-
if (dirName.includes(
|
|
5168
|
+
if (dirName.includes(import_node_path45.default.sep) || dirName.includes("/") || dirName.includes("\\")) {
|
|
5085
5169
|
throw new Error(`Directory name cannot contain path separators: dirName="${dirName}"`);
|
|
5086
5170
|
}
|
|
5087
5171
|
this.baseDir = baseDir;
|
|
@@ -5104,11 +5188,11 @@ var AiDir = class {
|
|
|
5104
5188
|
return this.dirName;
|
|
5105
5189
|
}
|
|
5106
5190
|
getDirPath() {
|
|
5107
|
-
const fullPath =
|
|
5108
|
-
const resolvedFull = (0,
|
|
5109
|
-
const resolvedBase = (0,
|
|
5110
|
-
const rel = (0,
|
|
5111
|
-
if (rel.startsWith("..") ||
|
|
5191
|
+
const fullPath = import_node_path45.default.join(this.baseDir, this.relativeDirPath, this.dirName);
|
|
5192
|
+
const resolvedFull = (0, import_node_path45.resolve)(fullPath);
|
|
5193
|
+
const resolvedBase = (0, import_node_path45.resolve)(this.baseDir);
|
|
5194
|
+
const rel = (0, import_node_path45.relative)(resolvedBase, resolvedFull);
|
|
5195
|
+
if (rel.startsWith("..") || import_node_path45.default.isAbsolute(rel)) {
|
|
5112
5196
|
throw new Error(
|
|
5113
5197
|
`Path traversal detected: Final path escapes baseDir. baseDir="${this.baseDir}", relativeDirPath="${this.relativeDirPath}", dirName="${this.dirName}"`
|
|
5114
5198
|
);
|
|
@@ -5122,7 +5206,7 @@ var AiDir = class {
|
|
|
5122
5206
|
return this.otherFiles;
|
|
5123
5207
|
}
|
|
5124
5208
|
getRelativePathFromCwd() {
|
|
5125
|
-
return
|
|
5209
|
+
return import_node_path45.default.join(this.relativeDirPath, this.dirName);
|
|
5126
5210
|
}
|
|
5127
5211
|
getGlobal() {
|
|
5128
5212
|
return this.global;
|
|
@@ -5141,15 +5225,15 @@ var AiDir = class {
|
|
|
5141
5225
|
* @returns Array of files with their relative paths and buffers
|
|
5142
5226
|
*/
|
|
5143
5227
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
5144
|
-
const dirPath = (0,
|
|
5145
|
-
const glob = (0,
|
|
5228
|
+
const dirPath = (0, import_node_path45.join)(baseDir, relativeDirPath, dirName);
|
|
5229
|
+
const glob = (0, import_node_path45.join)(dirPath, "**", "*");
|
|
5146
5230
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
5147
|
-
const filteredPaths = filePaths.filter((filePath) => (0,
|
|
5231
|
+
const filteredPaths = filePaths.filter((filePath) => (0, import_node_path45.basename)(filePath) !== excludeFileName);
|
|
5148
5232
|
const files = await Promise.all(
|
|
5149
5233
|
filteredPaths.map(async (filePath) => {
|
|
5150
5234
|
const fileBuffer = await readFileBuffer(filePath);
|
|
5151
5235
|
return {
|
|
5152
|
-
relativeFilePathToDirPath: (0,
|
|
5236
|
+
relativeFilePathToDirPath: (0, import_node_path45.relative)(dirPath, filePath),
|
|
5153
5237
|
fileBuffer
|
|
5154
5238
|
};
|
|
5155
5239
|
})
|
|
@@ -5240,8 +5324,8 @@ var ToolSkill = class extends AiDir {
|
|
|
5240
5324
|
}) {
|
|
5241
5325
|
const settablePaths = getSettablePaths({ global });
|
|
5242
5326
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5243
|
-
const skillDirPath = (0,
|
|
5244
|
-
const skillFilePath = (0,
|
|
5327
|
+
const skillDirPath = (0, import_node_path46.join)(baseDir, actualRelativeDirPath, dirName);
|
|
5328
|
+
const skillFilePath = (0, import_node_path46.join)(skillDirPath, SKILL_FILE_NAME);
|
|
5245
5329
|
if (!await fileExists(skillFilePath)) {
|
|
5246
5330
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5247
5331
|
}
|
|
@@ -5299,7 +5383,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5299
5383
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
5300
5384
|
if (!result.success) {
|
|
5301
5385
|
throw new Error(
|
|
5302
|
-
`Invalid frontmatter in ${(0,
|
|
5386
|
+
`Invalid frontmatter in ${(0, import_node_path47.join)(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
5303
5387
|
);
|
|
5304
5388
|
}
|
|
5305
5389
|
}
|
|
@@ -5357,8 +5441,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5357
5441
|
}) {
|
|
5358
5442
|
const settablePaths = this.getSettablePaths();
|
|
5359
5443
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5360
|
-
const skillDirPath = (0,
|
|
5361
|
-
const skillFilePath = (0,
|
|
5444
|
+
const skillDirPath = (0, import_node_path47.join)(baseDir, actualRelativeDirPath, dirName);
|
|
5445
|
+
const skillFilePath = (0, import_node_path47.join)(skillDirPath, SKILL_FILE_NAME);
|
|
5362
5446
|
if (!await fileExists(skillFilePath)) {
|
|
5363
5447
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5364
5448
|
}
|
|
@@ -5435,7 +5519,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5435
5519
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
5436
5520
|
}
|
|
5437
5521
|
return {
|
|
5438
|
-
relativeDirPath: (0,
|
|
5522
|
+
relativeDirPath: (0, import_node_path48.join)(".agents", "skills")
|
|
5439
5523
|
};
|
|
5440
5524
|
}
|
|
5441
5525
|
static async fromDir(params) {
|
|
@@ -5462,14 +5546,14 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5462
5546
|
};
|
|
5463
5547
|
|
|
5464
5548
|
// src/features/skills/geminicli-skill.ts
|
|
5465
|
-
var
|
|
5549
|
+
var import_node_path49 = require("path");
|
|
5466
5550
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5467
5551
|
static getSettablePaths(options) {
|
|
5468
5552
|
if (options?.global) {
|
|
5469
5553
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5470
5554
|
}
|
|
5471
5555
|
return {
|
|
5472
|
-
relativeDirPath: (0,
|
|
5556
|
+
relativeDirPath: (0, import_node_path49.join)(".gemini", "skills")
|
|
5473
5557
|
};
|
|
5474
5558
|
}
|
|
5475
5559
|
static async fromDir(params) {
|
|
@@ -5496,11 +5580,11 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
|
5496
5580
|
};
|
|
5497
5581
|
|
|
5498
5582
|
// src/features/skills/skills-processor.ts
|
|
5499
|
-
var
|
|
5500
|
-
var
|
|
5583
|
+
var import_node_path60 = require("path");
|
|
5584
|
+
var import_mini29 = require("zod/mini");
|
|
5501
5585
|
|
|
5502
5586
|
// src/types/dir-feature-processor.ts
|
|
5503
|
-
var
|
|
5587
|
+
var import_node_path50 = require("path");
|
|
5504
5588
|
var DirFeatureProcessor = class {
|
|
5505
5589
|
baseDir;
|
|
5506
5590
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -5522,14 +5606,14 @@ var DirFeatureProcessor = class {
|
|
|
5522
5606
|
await ensureDir(dirPath);
|
|
5523
5607
|
const mainFile = aiDir.getMainFile();
|
|
5524
5608
|
if (mainFile) {
|
|
5525
|
-
const mainFilePath = (0,
|
|
5609
|
+
const mainFilePath = (0, import_node_path50.join)(dirPath, mainFile.name);
|
|
5526
5610
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5527
5611
|
const contentWithNewline = addTrailingNewline(content);
|
|
5528
5612
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5529
5613
|
}
|
|
5530
5614
|
const otherFiles = aiDir.getOtherFiles();
|
|
5531
5615
|
for (const file of otherFiles) {
|
|
5532
|
-
const filePath = (0,
|
|
5616
|
+
const filePath = (0, import_node_path50.join)(dirPath, file.relativeFilePathToDirPath);
|
|
5533
5617
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5534
5618
|
await writeFileContent(filePath, contentWithNewline);
|
|
5535
5619
|
}
|
|
@@ -5543,12 +5627,12 @@ var DirFeatureProcessor = class {
|
|
|
5543
5627
|
}
|
|
5544
5628
|
};
|
|
5545
5629
|
|
|
5546
|
-
// src/features/skills/
|
|
5547
|
-
var
|
|
5630
|
+
// src/features/skills/antigravity-skill.ts
|
|
5631
|
+
var import_node_path52 = require("path");
|
|
5548
5632
|
var import_mini21 = require("zod/mini");
|
|
5549
5633
|
|
|
5550
5634
|
// src/features/skills/rulesync-skill.ts
|
|
5551
|
-
var
|
|
5635
|
+
var import_node_path51 = require("path");
|
|
5552
5636
|
var import_mini20 = require("zod/mini");
|
|
5553
5637
|
var RulesyncSkillFrontmatterSchemaInternal = import_mini20.z.looseObject({
|
|
5554
5638
|
name: import_mini20.z.string(),
|
|
@@ -5640,8 +5724,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5640
5724
|
dirName,
|
|
5641
5725
|
global = false
|
|
5642
5726
|
}) {
|
|
5643
|
-
const skillDirPath = (0,
|
|
5644
|
-
const skillFilePath = (0,
|
|
5727
|
+
const skillDirPath = (0, import_node_path51.join)(baseDir, relativeDirPath, dirName);
|
|
5728
|
+
const skillFilePath = (0, import_node_path51.join)(skillDirPath, SKILL_FILE_NAME);
|
|
5645
5729
|
if (!await fileExists(skillFilePath)) {
|
|
5646
5730
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5647
5731
|
}
|
|
@@ -5670,16 +5754,179 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5670
5754
|
}
|
|
5671
5755
|
};
|
|
5672
5756
|
|
|
5673
|
-
// src/features/skills/
|
|
5674
|
-
var
|
|
5757
|
+
// src/features/skills/antigravity-skill.ts
|
|
5758
|
+
var AntigravitySkillFrontmatterSchema = import_mini21.z.looseObject({
|
|
5675
5759
|
name: import_mini21.z.string(),
|
|
5676
|
-
description: import_mini21.z.string()
|
|
5677
|
-
|
|
5760
|
+
description: import_mini21.z.string()
|
|
5761
|
+
});
|
|
5762
|
+
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
5763
|
+
constructor({
|
|
5764
|
+
baseDir = process.cwd(),
|
|
5765
|
+
relativeDirPath = (0, import_node_path52.join)(".agent", "skills"),
|
|
5766
|
+
dirName,
|
|
5767
|
+
frontmatter,
|
|
5768
|
+
body,
|
|
5769
|
+
otherFiles = [],
|
|
5770
|
+
validate = true,
|
|
5771
|
+
global = false
|
|
5772
|
+
}) {
|
|
5773
|
+
super({
|
|
5774
|
+
baseDir,
|
|
5775
|
+
relativeDirPath,
|
|
5776
|
+
dirName,
|
|
5777
|
+
mainFile: {
|
|
5778
|
+
name: SKILL_FILE_NAME,
|
|
5779
|
+
body,
|
|
5780
|
+
frontmatter: { ...frontmatter }
|
|
5781
|
+
},
|
|
5782
|
+
otherFiles,
|
|
5783
|
+
global
|
|
5784
|
+
});
|
|
5785
|
+
if (validate) {
|
|
5786
|
+
const result = this.validate();
|
|
5787
|
+
if (!result.success) {
|
|
5788
|
+
throw result.error;
|
|
5789
|
+
}
|
|
5790
|
+
}
|
|
5791
|
+
}
|
|
5792
|
+
static getSettablePaths({
|
|
5793
|
+
global = false
|
|
5794
|
+
} = {}) {
|
|
5795
|
+
if (global) {
|
|
5796
|
+
return {
|
|
5797
|
+
relativeDirPath: (0, import_node_path52.join)(".gemini", "antigravity", "skills")
|
|
5798
|
+
};
|
|
5799
|
+
}
|
|
5800
|
+
return {
|
|
5801
|
+
relativeDirPath: (0, import_node_path52.join)(".agent", "skills")
|
|
5802
|
+
};
|
|
5803
|
+
}
|
|
5804
|
+
getFrontmatter() {
|
|
5805
|
+
if (!this.mainFile?.frontmatter) {
|
|
5806
|
+
throw new Error("Frontmatter is not defined");
|
|
5807
|
+
}
|
|
5808
|
+
const result = AntigravitySkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
5809
|
+
return result;
|
|
5810
|
+
}
|
|
5811
|
+
getBody() {
|
|
5812
|
+
return this.mainFile?.body ?? "";
|
|
5813
|
+
}
|
|
5814
|
+
validate() {
|
|
5815
|
+
if (this.mainFile === void 0) {
|
|
5816
|
+
return {
|
|
5817
|
+
success: false,
|
|
5818
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
5819
|
+
};
|
|
5820
|
+
}
|
|
5821
|
+
const result = AntigravitySkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
5822
|
+
if (!result.success) {
|
|
5823
|
+
return {
|
|
5824
|
+
success: false,
|
|
5825
|
+
error: new Error(
|
|
5826
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
5827
|
+
)
|
|
5828
|
+
};
|
|
5829
|
+
}
|
|
5830
|
+
return { success: true, error: null };
|
|
5831
|
+
}
|
|
5832
|
+
toRulesyncSkill() {
|
|
5833
|
+
const frontmatter = this.getFrontmatter();
|
|
5834
|
+
const rulesyncFrontmatter = {
|
|
5835
|
+
name: frontmatter.name,
|
|
5836
|
+
description: frontmatter.description,
|
|
5837
|
+
targets: ["*"]
|
|
5838
|
+
};
|
|
5839
|
+
return new RulesyncSkill({
|
|
5840
|
+
baseDir: this.baseDir,
|
|
5841
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
5842
|
+
dirName: this.getDirName(),
|
|
5843
|
+
frontmatter: rulesyncFrontmatter,
|
|
5844
|
+
body: this.getBody(),
|
|
5845
|
+
otherFiles: this.getOtherFiles(),
|
|
5846
|
+
validate: true,
|
|
5847
|
+
global: this.global
|
|
5848
|
+
});
|
|
5849
|
+
}
|
|
5850
|
+
static fromRulesyncSkill({
|
|
5851
|
+
rulesyncSkill,
|
|
5852
|
+
validate = true,
|
|
5853
|
+
global = false
|
|
5854
|
+
}) {
|
|
5855
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
5856
|
+
const antigravityFrontmatter = {
|
|
5857
|
+
name: rulesyncFrontmatter.name,
|
|
5858
|
+
description: rulesyncFrontmatter.description
|
|
5859
|
+
};
|
|
5860
|
+
const settablePaths = _AntigravitySkill.getSettablePaths({ global });
|
|
5861
|
+
return new _AntigravitySkill({
|
|
5862
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
5863
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
5864
|
+
dirName: rulesyncSkill.getDirName(),
|
|
5865
|
+
frontmatter: antigravityFrontmatter,
|
|
5866
|
+
body: rulesyncSkill.getBody(),
|
|
5867
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
5868
|
+
validate,
|
|
5869
|
+
global
|
|
5870
|
+
});
|
|
5871
|
+
}
|
|
5872
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
5873
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
5874
|
+
return targets.includes("*") || targets.includes("antigravity");
|
|
5875
|
+
}
|
|
5876
|
+
static async fromDir(params) {
|
|
5877
|
+
const loaded = await this.loadSkillDirContent({
|
|
5878
|
+
...params,
|
|
5879
|
+
getSettablePaths: _AntigravitySkill.getSettablePaths
|
|
5880
|
+
});
|
|
5881
|
+
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5882
|
+
if (!result.success) {
|
|
5883
|
+
const skillDirPath = (0, import_node_path52.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5884
|
+
throw new Error(
|
|
5885
|
+
`Invalid frontmatter in ${(0, import_node_path52.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5886
|
+
);
|
|
5887
|
+
}
|
|
5888
|
+
return new _AntigravitySkill({
|
|
5889
|
+
baseDir: loaded.baseDir,
|
|
5890
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
5891
|
+
dirName: loaded.dirName,
|
|
5892
|
+
frontmatter: result.data,
|
|
5893
|
+
body: loaded.body,
|
|
5894
|
+
otherFiles: loaded.otherFiles,
|
|
5895
|
+
validate: true,
|
|
5896
|
+
global: loaded.global
|
|
5897
|
+
});
|
|
5898
|
+
}
|
|
5899
|
+
static forDeletion({
|
|
5900
|
+
baseDir = process.cwd(),
|
|
5901
|
+
relativeDirPath,
|
|
5902
|
+
dirName,
|
|
5903
|
+
global = false
|
|
5904
|
+
}) {
|
|
5905
|
+
return new _AntigravitySkill({
|
|
5906
|
+
baseDir,
|
|
5907
|
+
relativeDirPath,
|
|
5908
|
+
dirName,
|
|
5909
|
+
frontmatter: { name: "", description: "" },
|
|
5910
|
+
body: "",
|
|
5911
|
+
otherFiles: [],
|
|
5912
|
+
validate: false,
|
|
5913
|
+
global
|
|
5914
|
+
});
|
|
5915
|
+
}
|
|
5916
|
+
};
|
|
5917
|
+
|
|
5918
|
+
// src/features/skills/claudecode-skill.ts
|
|
5919
|
+
var import_node_path53 = require("path");
|
|
5920
|
+
var import_mini22 = require("zod/mini");
|
|
5921
|
+
var ClaudecodeSkillFrontmatterSchema = import_mini22.z.looseObject({
|
|
5922
|
+
name: import_mini22.z.string(),
|
|
5923
|
+
description: import_mini22.z.string(),
|
|
5924
|
+
"allowed-tools": import_mini22.z.optional(import_mini22.z.array(import_mini22.z.string()))
|
|
5678
5925
|
});
|
|
5679
5926
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
5680
5927
|
constructor({
|
|
5681
5928
|
baseDir = process.cwd(),
|
|
5682
|
-
relativeDirPath = (0,
|
|
5929
|
+
relativeDirPath = (0, import_node_path53.join)(".claude", "skills"),
|
|
5683
5930
|
dirName,
|
|
5684
5931
|
frontmatter,
|
|
5685
5932
|
body,
|
|
@@ -5710,7 +5957,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5710
5957
|
global: _global = false
|
|
5711
5958
|
} = {}) {
|
|
5712
5959
|
return {
|
|
5713
|
-
relativeDirPath: (0,
|
|
5960
|
+
relativeDirPath: (0, import_node_path53.join)(".claude", "skills")
|
|
5714
5961
|
};
|
|
5715
5962
|
}
|
|
5716
5963
|
getFrontmatter() {
|
|
@@ -5798,9 +6045,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5798
6045
|
});
|
|
5799
6046
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5800
6047
|
if (!result.success) {
|
|
5801
|
-
const skillDirPath = (0,
|
|
6048
|
+
const skillDirPath = (0, import_node_path53.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5802
6049
|
throw new Error(
|
|
5803
|
-
`Invalid frontmatter in ${(0,
|
|
6050
|
+
`Invalid frontmatter in ${(0, import_node_path53.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5804
6051
|
);
|
|
5805
6052
|
}
|
|
5806
6053
|
return new _ClaudecodeSkill({
|
|
@@ -5834,21 +6081,21 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5834
6081
|
};
|
|
5835
6082
|
|
|
5836
6083
|
// src/features/skills/codexcli-skill.ts
|
|
5837
|
-
var
|
|
5838
|
-
var
|
|
5839
|
-
var CodexCliSkillFrontmatterSchema =
|
|
5840
|
-
name:
|
|
5841
|
-
description:
|
|
5842
|
-
metadata:
|
|
5843
|
-
|
|
5844
|
-
"short-description":
|
|
6084
|
+
var import_node_path54 = require("path");
|
|
6085
|
+
var import_mini23 = require("zod/mini");
|
|
6086
|
+
var CodexCliSkillFrontmatterSchema = import_mini23.z.looseObject({
|
|
6087
|
+
name: import_mini23.z.string(),
|
|
6088
|
+
description: import_mini23.z.string(),
|
|
6089
|
+
metadata: import_mini23.z.optional(
|
|
6090
|
+
import_mini23.z.looseObject({
|
|
6091
|
+
"short-description": import_mini23.z.optional(import_mini23.z.string())
|
|
5845
6092
|
})
|
|
5846
6093
|
)
|
|
5847
6094
|
});
|
|
5848
6095
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
5849
6096
|
constructor({
|
|
5850
6097
|
baseDir = process.cwd(),
|
|
5851
|
-
relativeDirPath = (0,
|
|
6098
|
+
relativeDirPath = (0, import_node_path54.join)(".codex", "skills"),
|
|
5852
6099
|
dirName,
|
|
5853
6100
|
frontmatter,
|
|
5854
6101
|
body,
|
|
@@ -5879,7 +6126,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5879
6126
|
global: _global = false
|
|
5880
6127
|
} = {}) {
|
|
5881
6128
|
return {
|
|
5882
|
-
relativeDirPath: (0,
|
|
6129
|
+
relativeDirPath: (0, import_node_path54.join)(".codex", "skills")
|
|
5883
6130
|
};
|
|
5884
6131
|
}
|
|
5885
6132
|
getFrontmatter() {
|
|
@@ -5971,9 +6218,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5971
6218
|
});
|
|
5972
6219
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5973
6220
|
if (!result.success) {
|
|
5974
|
-
const skillDirPath = (0,
|
|
6221
|
+
const skillDirPath = (0, import_node_path54.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5975
6222
|
throw new Error(
|
|
5976
|
-
`Invalid frontmatter in ${(0,
|
|
6223
|
+
`Invalid frontmatter in ${(0, import_node_path54.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5977
6224
|
);
|
|
5978
6225
|
}
|
|
5979
6226
|
return new _CodexCliSkill({
|
|
@@ -6007,17 +6254,17 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6007
6254
|
};
|
|
6008
6255
|
|
|
6009
6256
|
// src/features/skills/copilot-skill.ts
|
|
6010
|
-
var
|
|
6011
|
-
var
|
|
6012
|
-
var CopilotSkillFrontmatterSchema =
|
|
6013
|
-
name:
|
|
6014
|
-
description:
|
|
6015
|
-
license:
|
|
6257
|
+
var import_node_path55 = require("path");
|
|
6258
|
+
var import_mini24 = require("zod/mini");
|
|
6259
|
+
var CopilotSkillFrontmatterSchema = import_mini24.z.looseObject({
|
|
6260
|
+
name: import_mini24.z.string(),
|
|
6261
|
+
description: import_mini24.z.string(),
|
|
6262
|
+
license: import_mini24.z.optional(import_mini24.z.string())
|
|
6016
6263
|
});
|
|
6017
6264
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
6018
6265
|
constructor({
|
|
6019
6266
|
baseDir = process.cwd(),
|
|
6020
|
-
relativeDirPath = (0,
|
|
6267
|
+
relativeDirPath = (0, import_node_path55.join)(".github", "skills"),
|
|
6021
6268
|
dirName,
|
|
6022
6269
|
frontmatter,
|
|
6023
6270
|
body,
|
|
@@ -6049,7 +6296,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6049
6296
|
throw new Error("CopilotSkill does not support global mode.");
|
|
6050
6297
|
}
|
|
6051
6298
|
return {
|
|
6052
|
-
relativeDirPath: (0,
|
|
6299
|
+
relativeDirPath: (0, import_node_path55.join)(".github", "skills")
|
|
6053
6300
|
};
|
|
6054
6301
|
}
|
|
6055
6302
|
getFrontmatter() {
|
|
@@ -6137,9 +6384,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6137
6384
|
});
|
|
6138
6385
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6139
6386
|
if (!result.success) {
|
|
6140
|
-
const skillDirPath = (0,
|
|
6387
|
+
const skillDirPath = (0, import_node_path55.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6141
6388
|
throw new Error(
|
|
6142
|
-
`Invalid frontmatter in ${(0,
|
|
6389
|
+
`Invalid frontmatter in ${(0, import_node_path55.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6143
6390
|
);
|
|
6144
6391
|
}
|
|
6145
6392
|
return new _CopilotSkill({
|
|
@@ -6174,16 +6421,16 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6174
6421
|
};
|
|
6175
6422
|
|
|
6176
6423
|
// src/features/skills/cursor-skill.ts
|
|
6177
|
-
var
|
|
6178
|
-
var
|
|
6179
|
-
var CursorSkillFrontmatterSchema =
|
|
6180
|
-
name:
|
|
6181
|
-
description:
|
|
6424
|
+
var import_node_path56 = require("path");
|
|
6425
|
+
var import_mini25 = require("zod/mini");
|
|
6426
|
+
var CursorSkillFrontmatterSchema = import_mini25.z.looseObject({
|
|
6427
|
+
name: import_mini25.z.string(),
|
|
6428
|
+
description: import_mini25.z.string()
|
|
6182
6429
|
});
|
|
6183
6430
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
6184
6431
|
constructor({
|
|
6185
6432
|
baseDir = process.cwd(),
|
|
6186
|
-
relativeDirPath = (0,
|
|
6433
|
+
relativeDirPath = (0, import_node_path56.join)(".cursor", "skills"),
|
|
6187
6434
|
dirName,
|
|
6188
6435
|
frontmatter,
|
|
6189
6436
|
body,
|
|
@@ -6215,7 +6462,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6215
6462
|
throw new Error("CursorSkill does not support global mode.");
|
|
6216
6463
|
}
|
|
6217
6464
|
return {
|
|
6218
|
-
relativeDirPath: (0,
|
|
6465
|
+
relativeDirPath: (0, import_node_path56.join)(".cursor", "skills")
|
|
6219
6466
|
};
|
|
6220
6467
|
}
|
|
6221
6468
|
getFrontmatter() {
|
|
@@ -6297,9 +6544,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6297
6544
|
});
|
|
6298
6545
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6299
6546
|
if (!result.success) {
|
|
6300
|
-
const skillDirPath = (0,
|
|
6547
|
+
const skillDirPath = (0, import_node_path56.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6301
6548
|
throw new Error(
|
|
6302
|
-
`Invalid frontmatter in ${(0,
|
|
6549
|
+
`Invalid frontmatter in ${(0, import_node_path56.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6303
6550
|
);
|
|
6304
6551
|
}
|
|
6305
6552
|
return new _CursorSkill({
|
|
@@ -6334,16 +6581,16 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6334
6581
|
};
|
|
6335
6582
|
|
|
6336
6583
|
// src/features/skills/kilo-skill.ts
|
|
6337
|
-
var
|
|
6338
|
-
var
|
|
6339
|
-
var KiloSkillFrontmatterSchema =
|
|
6340
|
-
name:
|
|
6341
|
-
description:
|
|
6584
|
+
var import_node_path57 = require("path");
|
|
6585
|
+
var import_mini26 = require("zod/mini");
|
|
6586
|
+
var KiloSkillFrontmatterSchema = import_mini26.z.looseObject({
|
|
6587
|
+
name: import_mini26.z.string(),
|
|
6588
|
+
description: import_mini26.z.string()
|
|
6342
6589
|
});
|
|
6343
6590
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
6344
6591
|
constructor({
|
|
6345
6592
|
baseDir = process.cwd(),
|
|
6346
|
-
relativeDirPath = (0,
|
|
6593
|
+
relativeDirPath = (0, import_node_path57.join)(".kilocode", "skills"),
|
|
6347
6594
|
dirName,
|
|
6348
6595
|
frontmatter,
|
|
6349
6596
|
body,
|
|
@@ -6374,7 +6621,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6374
6621
|
global: _global = false
|
|
6375
6622
|
} = {}) {
|
|
6376
6623
|
return {
|
|
6377
|
-
relativeDirPath: (0,
|
|
6624
|
+
relativeDirPath: (0, import_node_path57.join)(".kilocode", "skills")
|
|
6378
6625
|
};
|
|
6379
6626
|
}
|
|
6380
6627
|
getFrontmatter() {
|
|
@@ -6464,13 +6711,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6464
6711
|
});
|
|
6465
6712
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6466
6713
|
if (!result.success) {
|
|
6467
|
-
const skillDirPath = (0,
|
|
6714
|
+
const skillDirPath = (0, import_node_path57.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6468
6715
|
throw new Error(
|
|
6469
|
-
`Invalid frontmatter in ${(0,
|
|
6716
|
+
`Invalid frontmatter in ${(0, import_node_path57.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6470
6717
|
);
|
|
6471
6718
|
}
|
|
6472
6719
|
if (result.data.name !== loaded.dirName) {
|
|
6473
|
-
const skillFilePath = (0,
|
|
6720
|
+
const skillFilePath = (0, import_node_path57.join)(
|
|
6474
6721
|
loaded.baseDir,
|
|
6475
6722
|
loaded.relativeDirPath,
|
|
6476
6723
|
loaded.dirName,
|
|
@@ -6511,17 +6758,17 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6511
6758
|
};
|
|
6512
6759
|
|
|
6513
6760
|
// src/features/skills/opencode-skill.ts
|
|
6514
|
-
var
|
|
6515
|
-
var
|
|
6516
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
6517
|
-
name:
|
|
6518
|
-
description:
|
|
6519
|
-
"allowed-tools":
|
|
6761
|
+
var import_node_path58 = require("path");
|
|
6762
|
+
var import_mini27 = require("zod/mini");
|
|
6763
|
+
var OpenCodeSkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
6764
|
+
name: import_mini27.z.string(),
|
|
6765
|
+
description: import_mini27.z.string(),
|
|
6766
|
+
"allowed-tools": import_mini27.z.optional(import_mini27.z.array(import_mini27.z.string()))
|
|
6520
6767
|
});
|
|
6521
6768
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
6522
6769
|
constructor({
|
|
6523
6770
|
baseDir = process.cwd(),
|
|
6524
|
-
relativeDirPath = (0,
|
|
6771
|
+
relativeDirPath = (0, import_node_path58.join)(".opencode", "skill"),
|
|
6525
6772
|
dirName,
|
|
6526
6773
|
frontmatter,
|
|
6527
6774
|
body,
|
|
@@ -6550,7 +6797,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6550
6797
|
}
|
|
6551
6798
|
static getSettablePaths({ global = false } = {}) {
|
|
6552
6799
|
return {
|
|
6553
|
-
relativeDirPath: global ? (0,
|
|
6800
|
+
relativeDirPath: global ? (0, import_node_path58.join)(".config", "opencode", "skill") : (0, import_node_path58.join)(".opencode", "skill")
|
|
6554
6801
|
};
|
|
6555
6802
|
}
|
|
6556
6803
|
getFrontmatter() {
|
|
@@ -6638,9 +6885,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6638
6885
|
});
|
|
6639
6886
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6640
6887
|
if (!result.success) {
|
|
6641
|
-
const skillDirPath = (0,
|
|
6888
|
+
const skillDirPath = (0, import_node_path58.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6642
6889
|
throw new Error(
|
|
6643
|
-
`Invalid frontmatter in ${(0,
|
|
6890
|
+
`Invalid frontmatter in ${(0, import_node_path58.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6644
6891
|
);
|
|
6645
6892
|
}
|
|
6646
6893
|
return new _OpenCodeSkill({
|
|
@@ -6674,16 +6921,16 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6674
6921
|
};
|
|
6675
6922
|
|
|
6676
6923
|
// src/features/skills/roo-skill.ts
|
|
6677
|
-
var
|
|
6678
|
-
var
|
|
6679
|
-
var RooSkillFrontmatterSchema =
|
|
6680
|
-
name:
|
|
6681
|
-
description:
|
|
6924
|
+
var import_node_path59 = require("path");
|
|
6925
|
+
var import_mini28 = require("zod/mini");
|
|
6926
|
+
var RooSkillFrontmatterSchema = import_mini28.z.looseObject({
|
|
6927
|
+
name: import_mini28.z.string(),
|
|
6928
|
+
description: import_mini28.z.string()
|
|
6682
6929
|
});
|
|
6683
6930
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
6684
6931
|
constructor({
|
|
6685
6932
|
baseDir = process.cwd(),
|
|
6686
|
-
relativeDirPath = (0,
|
|
6933
|
+
relativeDirPath = (0, import_node_path59.join)(".roo", "skills"),
|
|
6687
6934
|
dirName,
|
|
6688
6935
|
frontmatter,
|
|
6689
6936
|
body,
|
|
@@ -6714,7 +6961,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6714
6961
|
global: _global = false
|
|
6715
6962
|
} = {}) {
|
|
6716
6963
|
return {
|
|
6717
|
-
relativeDirPath: (0,
|
|
6964
|
+
relativeDirPath: (0, import_node_path59.join)(".roo", "skills")
|
|
6718
6965
|
};
|
|
6719
6966
|
}
|
|
6720
6967
|
getFrontmatter() {
|
|
@@ -6804,13 +7051,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6804
7051
|
});
|
|
6805
7052
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6806
7053
|
if (!result.success) {
|
|
6807
|
-
const skillDirPath = (0,
|
|
7054
|
+
const skillDirPath = (0, import_node_path59.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6808
7055
|
throw new Error(
|
|
6809
|
-
`Invalid frontmatter in ${(0,
|
|
7056
|
+
`Invalid frontmatter in ${(0, import_node_path59.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6810
7057
|
);
|
|
6811
7058
|
}
|
|
6812
7059
|
if (result.data.name !== loaded.dirName) {
|
|
6813
|
-
const skillFilePath = (0,
|
|
7060
|
+
const skillFilePath = (0, import_node_path59.join)(
|
|
6814
7061
|
loaded.baseDir,
|
|
6815
7062
|
loaded.relativeDirPath,
|
|
6816
7063
|
loaded.dirName,
|
|
@@ -6853,6 +7100,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6853
7100
|
// src/features/skills/skills-processor.ts
|
|
6854
7101
|
var skillsProcessorToolTargetTuple = [
|
|
6855
7102
|
"agentsmd",
|
|
7103
|
+
"antigravity",
|
|
6856
7104
|
"claudecode",
|
|
6857
7105
|
"claudecode-legacy",
|
|
6858
7106
|
"codexcli",
|
|
@@ -6863,7 +7111,7 @@ var skillsProcessorToolTargetTuple = [
|
|
|
6863
7111
|
"opencode",
|
|
6864
7112
|
"roo"
|
|
6865
7113
|
];
|
|
6866
|
-
var SkillsProcessorToolTargetSchema =
|
|
7114
|
+
var SkillsProcessorToolTargetSchema = import_mini29.z.enum(skillsProcessorToolTargetTuple);
|
|
6867
7115
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
6868
7116
|
[
|
|
6869
7117
|
"agentsmd",
|
|
@@ -6872,6 +7120,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
6872
7120
|
meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
|
|
6873
7121
|
}
|
|
6874
7122
|
],
|
|
7123
|
+
[
|
|
7124
|
+
"antigravity",
|
|
7125
|
+
{
|
|
7126
|
+
class: AntigravitySkill,
|
|
7127
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
7128
|
+
}
|
|
7129
|
+
],
|
|
6875
7130
|
[
|
|
6876
7131
|
"claudecode",
|
|
6877
7132
|
{
|
|
@@ -7013,9 +7268,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7013
7268
|
*/
|
|
7014
7269
|
async loadRulesyncDirs() {
|
|
7015
7270
|
const paths = RulesyncSkill.getSettablePaths();
|
|
7016
|
-
const rulesyncSkillsDirPath = (0,
|
|
7017
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
7018
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
7271
|
+
const rulesyncSkillsDirPath = (0, import_node_path60.join)(this.baseDir, paths.relativeDirPath);
|
|
7272
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path60.join)(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
7273
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path60.basename)(path3));
|
|
7019
7274
|
const rulesyncSkills = await Promise.all(
|
|
7020
7275
|
dirNames.map(
|
|
7021
7276
|
(dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
|
|
@@ -7031,9 +7286,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7031
7286
|
async loadToolDirs() {
|
|
7032
7287
|
const factory = this.getFactory(this.toolTarget);
|
|
7033
7288
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7034
|
-
const skillsDirPath = (0,
|
|
7035
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
7036
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
7289
|
+
const skillsDirPath = (0, import_node_path60.join)(this.baseDir, paths.relativeDirPath);
|
|
7290
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path60.join)(skillsDirPath, "*"), { type: "dir" });
|
|
7291
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path60.basename)(path3));
|
|
7037
7292
|
const toolSkills = await Promise.all(
|
|
7038
7293
|
dirNames.map(
|
|
7039
7294
|
(dirName) => factory.class.fromDir({
|
|
@@ -7049,9 +7304,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7049
7304
|
async loadToolDirsToDelete() {
|
|
7050
7305
|
const factory = this.getFactory(this.toolTarget);
|
|
7051
7306
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7052
|
-
const skillsDirPath = (0,
|
|
7053
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
7054
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
7307
|
+
const skillsDirPath = (0, import_node_path60.join)(this.baseDir, paths.relativeDirPath);
|
|
7308
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path60.join)(skillsDirPath, "*"), { type: "dir" });
|
|
7309
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path60.basename)(path3));
|
|
7055
7310
|
const toolSkills = dirNames.map(
|
|
7056
7311
|
(dirName) => factory.class.forDeletion({
|
|
7057
7312
|
baseDir: this.baseDir,
|
|
@@ -7099,11 +7354,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7099
7354
|
};
|
|
7100
7355
|
|
|
7101
7356
|
// src/features/subagents/agentsmd-subagent.ts
|
|
7102
|
-
var
|
|
7357
|
+
var import_node_path62 = require("path");
|
|
7103
7358
|
|
|
7104
7359
|
// src/features/subagents/simulated-subagent.ts
|
|
7105
|
-
var
|
|
7106
|
-
var
|
|
7360
|
+
var import_node_path61 = require("path");
|
|
7361
|
+
var import_mini30 = require("zod/mini");
|
|
7107
7362
|
|
|
7108
7363
|
// src/features/subagents/tool-subagent.ts
|
|
7109
7364
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -7146,9 +7401,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
7146
7401
|
};
|
|
7147
7402
|
|
|
7148
7403
|
// src/features/subagents/simulated-subagent.ts
|
|
7149
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
7150
|
-
name:
|
|
7151
|
-
description:
|
|
7404
|
+
var SimulatedSubagentFrontmatterSchema = import_mini30.z.object({
|
|
7405
|
+
name: import_mini30.z.string(),
|
|
7406
|
+
description: import_mini30.z.string()
|
|
7152
7407
|
});
|
|
7153
7408
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
7154
7409
|
frontmatter;
|
|
@@ -7158,7 +7413,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7158
7413
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7159
7414
|
if (!result.success) {
|
|
7160
7415
|
throw new Error(
|
|
7161
|
-
`Invalid frontmatter in ${(0,
|
|
7416
|
+
`Invalid frontmatter in ${(0, import_node_path61.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7162
7417
|
);
|
|
7163
7418
|
}
|
|
7164
7419
|
}
|
|
@@ -7209,7 +7464,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7209
7464
|
return {
|
|
7210
7465
|
success: false,
|
|
7211
7466
|
error: new Error(
|
|
7212
|
-
`Invalid frontmatter in ${(0,
|
|
7467
|
+
`Invalid frontmatter in ${(0, import_node_path61.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7213
7468
|
)
|
|
7214
7469
|
};
|
|
7215
7470
|
}
|
|
@@ -7219,7 +7474,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7219
7474
|
relativeFilePath,
|
|
7220
7475
|
validate = true
|
|
7221
7476
|
}) {
|
|
7222
|
-
const filePath = (0,
|
|
7477
|
+
const filePath = (0, import_node_path61.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
7223
7478
|
const fileContent = await readFileContent(filePath);
|
|
7224
7479
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7225
7480
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7229,7 +7484,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7229
7484
|
return {
|
|
7230
7485
|
baseDir,
|
|
7231
7486
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
7232
|
-
relativeFilePath: (0,
|
|
7487
|
+
relativeFilePath: (0, import_node_path61.basename)(relativeFilePath),
|
|
7233
7488
|
frontmatter: result.data,
|
|
7234
7489
|
body: content.trim(),
|
|
7235
7490
|
validate
|
|
@@ -7255,7 +7510,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7255
7510
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
7256
7511
|
static getSettablePaths() {
|
|
7257
7512
|
return {
|
|
7258
|
-
relativeDirPath: (0,
|
|
7513
|
+
relativeDirPath: (0, import_node_path62.join)(".agents", "subagents")
|
|
7259
7514
|
};
|
|
7260
7515
|
}
|
|
7261
7516
|
static async fromFile(params) {
|
|
@@ -7278,11 +7533,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
7278
7533
|
};
|
|
7279
7534
|
|
|
7280
7535
|
// src/features/subagents/codexcli-subagent.ts
|
|
7281
|
-
var
|
|
7536
|
+
var import_node_path63 = require("path");
|
|
7282
7537
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
7283
7538
|
static getSettablePaths() {
|
|
7284
7539
|
return {
|
|
7285
|
-
relativeDirPath: (0,
|
|
7540
|
+
relativeDirPath: (0, import_node_path63.join)(".codex", "subagents")
|
|
7286
7541
|
};
|
|
7287
7542
|
}
|
|
7288
7543
|
static async fromFile(params) {
|
|
@@ -7305,11 +7560,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
7305
7560
|
};
|
|
7306
7561
|
|
|
7307
7562
|
// src/features/subagents/cursor-subagent.ts
|
|
7308
|
-
var
|
|
7563
|
+
var import_node_path64 = require("path");
|
|
7309
7564
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
7310
7565
|
static getSettablePaths() {
|
|
7311
7566
|
return {
|
|
7312
|
-
relativeDirPath: (0,
|
|
7567
|
+
relativeDirPath: (0, import_node_path64.join)(".cursor", "subagents")
|
|
7313
7568
|
};
|
|
7314
7569
|
}
|
|
7315
7570
|
static async fromFile(params) {
|
|
@@ -7332,11 +7587,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
7332
7587
|
};
|
|
7333
7588
|
|
|
7334
7589
|
// src/features/subagents/geminicli-subagent.ts
|
|
7335
|
-
var
|
|
7590
|
+
var import_node_path65 = require("path");
|
|
7336
7591
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
7337
7592
|
static getSettablePaths() {
|
|
7338
7593
|
return {
|
|
7339
|
-
relativeDirPath: (0,
|
|
7594
|
+
relativeDirPath: (0, import_node_path65.join)(".gemini", "subagents")
|
|
7340
7595
|
};
|
|
7341
7596
|
}
|
|
7342
7597
|
static async fromFile(params) {
|
|
@@ -7359,11 +7614,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
7359
7614
|
};
|
|
7360
7615
|
|
|
7361
7616
|
// src/features/subagents/roo-subagent.ts
|
|
7362
|
-
var
|
|
7617
|
+
var import_node_path66 = require("path");
|
|
7363
7618
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
7364
7619
|
static getSettablePaths() {
|
|
7365
7620
|
return {
|
|
7366
|
-
relativeDirPath: (0,
|
|
7621
|
+
relativeDirPath: (0, import_node_path66.join)(".roo", "subagents")
|
|
7367
7622
|
};
|
|
7368
7623
|
}
|
|
7369
7624
|
static async fromFile(params) {
|
|
@@ -7386,20 +7641,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
7386
7641
|
};
|
|
7387
7642
|
|
|
7388
7643
|
// src/features/subagents/subagents-processor.ts
|
|
7389
|
-
var
|
|
7390
|
-
var
|
|
7644
|
+
var import_node_path71 = require("path");
|
|
7645
|
+
var import_mini35 = require("zod/mini");
|
|
7391
7646
|
|
|
7392
7647
|
// src/features/subagents/claudecode-subagent.ts
|
|
7393
|
-
var
|
|
7394
|
-
var
|
|
7648
|
+
var import_node_path68 = require("path");
|
|
7649
|
+
var import_mini32 = require("zod/mini");
|
|
7395
7650
|
|
|
7396
7651
|
// src/features/subagents/rulesync-subagent.ts
|
|
7397
|
-
var
|
|
7398
|
-
var
|
|
7399
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
7652
|
+
var import_node_path67 = require("path");
|
|
7653
|
+
var import_mini31 = require("zod/mini");
|
|
7654
|
+
var RulesyncSubagentFrontmatterSchema = import_mini31.z.looseObject({
|
|
7400
7655
|
targets: RulesyncTargetsSchema,
|
|
7401
|
-
name:
|
|
7402
|
-
description:
|
|
7656
|
+
name: import_mini31.z.string(),
|
|
7657
|
+
description: import_mini31.z.string()
|
|
7403
7658
|
});
|
|
7404
7659
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
7405
7660
|
frontmatter;
|
|
@@ -7409,7 +7664,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7409
7664
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7410
7665
|
if (!result.success) {
|
|
7411
7666
|
throw new Error(
|
|
7412
|
-
`Invalid frontmatter in ${(0,
|
|
7667
|
+
`Invalid frontmatter in ${(0, import_node_path67.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7413
7668
|
);
|
|
7414
7669
|
}
|
|
7415
7670
|
}
|
|
@@ -7442,7 +7697,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7442
7697
|
return {
|
|
7443
7698
|
success: false,
|
|
7444
7699
|
error: new Error(
|
|
7445
|
-
`Invalid frontmatter in ${(0,
|
|
7700
|
+
`Invalid frontmatter in ${(0, import_node_path67.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7446
7701
|
)
|
|
7447
7702
|
};
|
|
7448
7703
|
}
|
|
@@ -7451,14 +7706,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7451
7706
|
relativeFilePath
|
|
7452
7707
|
}) {
|
|
7453
7708
|
const fileContent = await readFileContent(
|
|
7454
|
-
(0,
|
|
7709
|
+
(0, import_node_path67.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
7455
7710
|
);
|
|
7456
7711
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7457
7712
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7458
7713
|
if (!result.success) {
|
|
7459
7714
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
7460
7715
|
}
|
|
7461
|
-
const filename = (0,
|
|
7716
|
+
const filename = (0, import_node_path67.basename)(relativeFilePath);
|
|
7462
7717
|
return new _RulesyncSubagent({
|
|
7463
7718
|
baseDir: process.cwd(),
|
|
7464
7719
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -7470,13 +7725,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7470
7725
|
};
|
|
7471
7726
|
|
|
7472
7727
|
// src/features/subagents/claudecode-subagent.ts
|
|
7473
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
7474
|
-
name:
|
|
7475
|
-
description:
|
|
7476
|
-
model:
|
|
7477
|
-
tools:
|
|
7478
|
-
permissionMode:
|
|
7479
|
-
skills:
|
|
7728
|
+
var ClaudecodeSubagentFrontmatterSchema = import_mini32.z.looseObject({
|
|
7729
|
+
name: import_mini32.z.string(),
|
|
7730
|
+
description: import_mini32.z.string(),
|
|
7731
|
+
model: import_mini32.z.optional(import_mini32.z.string()),
|
|
7732
|
+
tools: import_mini32.z.optional(import_mini32.z.union([import_mini32.z.string(), import_mini32.z.array(import_mini32.z.string())])),
|
|
7733
|
+
permissionMode: import_mini32.z.optional(import_mini32.z.string()),
|
|
7734
|
+
skills: import_mini32.z.optional(import_mini32.z.union([import_mini32.z.string(), import_mini32.z.array(import_mini32.z.string())]))
|
|
7480
7735
|
});
|
|
7481
7736
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
7482
7737
|
frontmatter;
|
|
@@ -7486,7 +7741,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7486
7741
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7487
7742
|
if (!result.success) {
|
|
7488
7743
|
throw new Error(
|
|
7489
|
-
`Invalid frontmatter in ${(0,
|
|
7744
|
+
`Invalid frontmatter in ${(0, import_node_path68.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7490
7745
|
);
|
|
7491
7746
|
}
|
|
7492
7747
|
}
|
|
@@ -7498,7 +7753,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7498
7753
|
}
|
|
7499
7754
|
static getSettablePaths(_options = {}) {
|
|
7500
7755
|
return {
|
|
7501
|
-
relativeDirPath: (0,
|
|
7756
|
+
relativeDirPath: (0, import_node_path68.join)(".claude", "agents")
|
|
7502
7757
|
};
|
|
7503
7758
|
}
|
|
7504
7759
|
getFrontmatter() {
|
|
@@ -7572,7 +7827,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7572
7827
|
return {
|
|
7573
7828
|
success: false,
|
|
7574
7829
|
error: new Error(
|
|
7575
|
-
`Invalid frontmatter in ${(0,
|
|
7830
|
+
`Invalid frontmatter in ${(0, import_node_path68.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7576
7831
|
)
|
|
7577
7832
|
};
|
|
7578
7833
|
}
|
|
@@ -7590,7 +7845,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7590
7845
|
global = false
|
|
7591
7846
|
}) {
|
|
7592
7847
|
const paths = this.getSettablePaths({ global });
|
|
7593
|
-
const filePath = (0,
|
|
7848
|
+
const filePath = (0, import_node_path68.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7594
7849
|
const fileContent = await readFileContent(filePath);
|
|
7595
7850
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7596
7851
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7625,13 +7880,13 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7625
7880
|
};
|
|
7626
7881
|
|
|
7627
7882
|
// src/features/subagents/copilot-subagent.ts
|
|
7628
|
-
var
|
|
7629
|
-
var
|
|
7883
|
+
var import_node_path69 = require("path");
|
|
7884
|
+
var import_mini33 = require("zod/mini");
|
|
7630
7885
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
7631
|
-
var CopilotSubagentFrontmatterSchema =
|
|
7632
|
-
name:
|
|
7633
|
-
description:
|
|
7634
|
-
tools:
|
|
7886
|
+
var CopilotSubagentFrontmatterSchema = import_mini33.z.looseObject({
|
|
7887
|
+
name: import_mini33.z.string(),
|
|
7888
|
+
description: import_mini33.z.string(),
|
|
7889
|
+
tools: import_mini33.z.optional(import_mini33.z.union([import_mini33.z.string(), import_mini33.z.array(import_mini33.z.string())]))
|
|
7635
7890
|
});
|
|
7636
7891
|
var normalizeTools = (tools) => {
|
|
7637
7892
|
if (!tools) {
|
|
@@ -7651,7 +7906,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7651
7906
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7652
7907
|
if (!result.success) {
|
|
7653
7908
|
throw new Error(
|
|
7654
|
-
`Invalid frontmatter in ${(0,
|
|
7909
|
+
`Invalid frontmatter in ${(0, import_node_path69.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7655
7910
|
);
|
|
7656
7911
|
}
|
|
7657
7912
|
}
|
|
@@ -7663,7 +7918,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7663
7918
|
}
|
|
7664
7919
|
static getSettablePaths(_options = {}) {
|
|
7665
7920
|
return {
|
|
7666
|
-
relativeDirPath: (0,
|
|
7921
|
+
relativeDirPath: (0, import_node_path69.join)(".github", "agents")
|
|
7667
7922
|
};
|
|
7668
7923
|
}
|
|
7669
7924
|
getFrontmatter() {
|
|
@@ -7737,7 +7992,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7737
7992
|
return {
|
|
7738
7993
|
success: false,
|
|
7739
7994
|
error: new Error(
|
|
7740
|
-
`Invalid frontmatter in ${(0,
|
|
7995
|
+
`Invalid frontmatter in ${(0, import_node_path69.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7741
7996
|
)
|
|
7742
7997
|
};
|
|
7743
7998
|
}
|
|
@@ -7755,7 +8010,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7755
8010
|
global = false
|
|
7756
8011
|
}) {
|
|
7757
8012
|
const paths = this.getSettablePaths({ global });
|
|
7758
|
-
const filePath = (0,
|
|
8013
|
+
const filePath = (0, import_node_path69.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7759
8014
|
const fileContent = await readFileContent(filePath);
|
|
7760
8015
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7761
8016
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7791,12 +8046,12 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7791
8046
|
};
|
|
7792
8047
|
|
|
7793
8048
|
// src/features/subagents/opencode-subagent.ts
|
|
7794
|
-
var
|
|
7795
|
-
var
|
|
7796
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
7797
|
-
description:
|
|
7798
|
-
mode:
|
|
7799
|
-
name:
|
|
8049
|
+
var import_node_path70 = require("path");
|
|
8050
|
+
var import_mini34 = require("zod/mini");
|
|
8051
|
+
var OpenCodeSubagentFrontmatterSchema = import_mini34.z.looseObject({
|
|
8052
|
+
description: import_mini34.z.string(),
|
|
8053
|
+
mode: import_mini34.z.literal("subagent"),
|
|
8054
|
+
name: import_mini34.z.optional(import_mini34.z.string())
|
|
7800
8055
|
});
|
|
7801
8056
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
7802
8057
|
frontmatter;
|
|
@@ -7806,7 +8061,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7806
8061
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7807
8062
|
if (!result.success) {
|
|
7808
8063
|
throw new Error(
|
|
7809
|
-
`Invalid frontmatter in ${(0,
|
|
8064
|
+
`Invalid frontmatter in ${(0, import_node_path70.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7810
8065
|
);
|
|
7811
8066
|
}
|
|
7812
8067
|
}
|
|
@@ -7820,7 +8075,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7820
8075
|
global = false
|
|
7821
8076
|
} = {}) {
|
|
7822
8077
|
return {
|
|
7823
|
-
relativeDirPath: global ? (0,
|
|
8078
|
+
relativeDirPath: global ? (0, import_node_path70.join)(".config", "opencode", "agent") : (0, import_node_path70.join)(".opencode", "agent")
|
|
7824
8079
|
};
|
|
7825
8080
|
}
|
|
7826
8081
|
getFrontmatter() {
|
|
@@ -7833,7 +8088,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7833
8088
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
7834
8089
|
const rulesyncFrontmatter = {
|
|
7835
8090
|
targets: ["opencode"],
|
|
7836
|
-
name: name ?? (0,
|
|
8091
|
+
name: name ?? (0, import_node_path70.basename)(this.getRelativeFilePath(), ".md"),
|
|
7837
8092
|
description,
|
|
7838
8093
|
opencode: { mode, ...opencodeSection }
|
|
7839
8094
|
};
|
|
@@ -7886,7 +8141,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7886
8141
|
return {
|
|
7887
8142
|
success: false,
|
|
7888
8143
|
error: new Error(
|
|
7889
|
-
`Invalid frontmatter in ${(0,
|
|
8144
|
+
`Invalid frontmatter in ${(0, import_node_path70.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7890
8145
|
)
|
|
7891
8146
|
};
|
|
7892
8147
|
}
|
|
@@ -7903,7 +8158,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7903
8158
|
global = false
|
|
7904
8159
|
}) {
|
|
7905
8160
|
const paths = this.getSettablePaths({ global });
|
|
7906
|
-
const filePath = (0,
|
|
8161
|
+
const filePath = (0, import_node_path70.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7907
8162
|
const fileContent = await readFileContent(filePath);
|
|
7908
8163
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7909
8164
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7950,7 +8205,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
7950
8205
|
"opencode",
|
|
7951
8206
|
"roo"
|
|
7952
8207
|
];
|
|
7953
|
-
var SubagentsProcessorToolTargetSchema =
|
|
8208
|
+
var SubagentsProcessorToolTargetSchema = import_mini35.z.enum(subagentsProcessorToolTargetTuple);
|
|
7954
8209
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
7955
8210
|
[
|
|
7956
8211
|
"agentsmd",
|
|
@@ -8064,7 +8319,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8064
8319
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
8065
8320
|
*/
|
|
8066
8321
|
async loadRulesyncFiles() {
|
|
8067
|
-
const subagentsDir = (0,
|
|
8322
|
+
const subagentsDir = (0, import_node_path71.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
8068
8323
|
const dirExists = await directoryExists(subagentsDir);
|
|
8069
8324
|
if (!dirExists) {
|
|
8070
8325
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -8079,7 +8334,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8079
8334
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
8080
8335
|
const rulesyncSubagents = [];
|
|
8081
8336
|
for (const mdFile of mdFiles) {
|
|
8082
|
-
const filepath = (0,
|
|
8337
|
+
const filepath = (0, import_node_path71.join)(subagentsDir, mdFile);
|
|
8083
8338
|
try {
|
|
8084
8339
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
8085
8340
|
relativeFilePath: mdFile,
|
|
@@ -8109,14 +8364,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8109
8364
|
const factory = this.getFactory(this.toolTarget);
|
|
8110
8365
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
8111
8366
|
const subagentFilePaths = await findFilesByGlobs(
|
|
8112
|
-
(0,
|
|
8367
|
+
(0, import_node_path71.join)(this.baseDir, paths.relativeDirPath, "*.md")
|
|
8113
8368
|
);
|
|
8114
8369
|
if (forDeletion) {
|
|
8115
8370
|
const toolSubagents2 = subagentFilePaths.map(
|
|
8116
8371
|
(path3) => factory.class.forDeletion({
|
|
8117
8372
|
baseDir: this.baseDir,
|
|
8118
8373
|
relativeDirPath: paths.relativeDirPath,
|
|
8119
|
-
relativeFilePath: (0,
|
|
8374
|
+
relativeFilePath: (0, import_node_path71.basename)(path3),
|
|
8120
8375
|
global: this.global
|
|
8121
8376
|
})
|
|
8122
8377
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -8127,7 +8382,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8127
8382
|
subagentFilePaths.map(
|
|
8128
8383
|
(path3) => factory.class.fromFile({
|
|
8129
8384
|
baseDir: this.baseDir,
|
|
8130
|
-
relativeFilePath: (0,
|
|
8385
|
+
relativeFilePath: (0, import_node_path71.basename)(path3),
|
|
8131
8386
|
global: this.global
|
|
8132
8387
|
})
|
|
8133
8388
|
)
|
|
@@ -8159,48 +8414,48 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8159
8414
|
};
|
|
8160
8415
|
|
|
8161
8416
|
// src/features/rules/agentsmd-rule.ts
|
|
8162
|
-
var
|
|
8417
|
+
var import_node_path74 = require("path");
|
|
8163
8418
|
|
|
8164
8419
|
// src/features/rules/tool-rule.ts
|
|
8165
|
-
var
|
|
8420
|
+
var import_node_path73 = require("path");
|
|
8166
8421
|
|
|
8167
8422
|
// src/features/rules/rulesync-rule.ts
|
|
8168
|
-
var
|
|
8169
|
-
var
|
|
8170
|
-
var RulesyncRuleFrontmatterSchema =
|
|
8171
|
-
root:
|
|
8172
|
-
targets:
|
|
8173
|
-
description:
|
|
8174
|
-
globs:
|
|
8175
|
-
agentsmd:
|
|
8176
|
-
|
|
8423
|
+
var import_node_path72 = require("path");
|
|
8424
|
+
var import_mini36 = require("zod/mini");
|
|
8425
|
+
var RulesyncRuleFrontmatterSchema = import_mini36.z.object({
|
|
8426
|
+
root: import_mini36.z.optional(import_mini36.z.optional(import_mini36.z.boolean())),
|
|
8427
|
+
targets: import_mini36.z.optional(RulesyncTargetsSchema),
|
|
8428
|
+
description: import_mini36.z.optional(import_mini36.z.string()),
|
|
8429
|
+
globs: import_mini36.z.optional(import_mini36.z.array(import_mini36.z.string())),
|
|
8430
|
+
agentsmd: import_mini36.z.optional(
|
|
8431
|
+
import_mini36.z.object({
|
|
8177
8432
|
// @example "path/to/subproject"
|
|
8178
|
-
subprojectPath:
|
|
8433
|
+
subprojectPath: import_mini36.z.optional(import_mini36.z.string())
|
|
8179
8434
|
})
|
|
8180
8435
|
),
|
|
8181
|
-
claudecode:
|
|
8182
|
-
|
|
8436
|
+
claudecode: import_mini36.z.optional(
|
|
8437
|
+
import_mini36.z.object({
|
|
8183
8438
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
8184
8439
|
// @example "src/**/*.ts, tests/**/*.test.ts"
|
|
8185
|
-
paths:
|
|
8440
|
+
paths: import_mini36.z.optional(import_mini36.z.string())
|
|
8186
8441
|
})
|
|
8187
8442
|
),
|
|
8188
|
-
cursor:
|
|
8189
|
-
|
|
8190
|
-
alwaysApply:
|
|
8191
|
-
description:
|
|
8192
|
-
globs:
|
|
8443
|
+
cursor: import_mini36.z.optional(
|
|
8444
|
+
import_mini36.z.object({
|
|
8445
|
+
alwaysApply: import_mini36.z.optional(import_mini36.z.boolean()),
|
|
8446
|
+
description: import_mini36.z.optional(import_mini36.z.string()),
|
|
8447
|
+
globs: import_mini36.z.optional(import_mini36.z.array(import_mini36.z.string()))
|
|
8193
8448
|
})
|
|
8194
8449
|
),
|
|
8195
|
-
copilot:
|
|
8196
|
-
|
|
8197
|
-
excludeAgent:
|
|
8450
|
+
copilot: import_mini36.z.optional(
|
|
8451
|
+
import_mini36.z.object({
|
|
8452
|
+
excludeAgent: import_mini36.z.optional(import_mini36.z.union([import_mini36.z.literal("code-review"), import_mini36.z.literal("coding-agent")]))
|
|
8198
8453
|
})
|
|
8199
8454
|
),
|
|
8200
|
-
antigravity:
|
|
8201
|
-
|
|
8202
|
-
trigger:
|
|
8203
|
-
globs:
|
|
8455
|
+
antigravity: import_mini36.z.optional(
|
|
8456
|
+
import_mini36.z.looseObject({
|
|
8457
|
+
trigger: import_mini36.z.optional(import_mini36.z.string()),
|
|
8458
|
+
globs: import_mini36.z.optional(import_mini36.z.array(import_mini36.z.string()))
|
|
8204
8459
|
})
|
|
8205
8460
|
)
|
|
8206
8461
|
});
|
|
@@ -8212,7 +8467,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8212
8467
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8213
8468
|
if (!result.success) {
|
|
8214
8469
|
throw new Error(
|
|
8215
|
-
`Invalid frontmatter in ${(0,
|
|
8470
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8216
8471
|
);
|
|
8217
8472
|
}
|
|
8218
8473
|
}
|
|
@@ -8247,7 +8502,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8247
8502
|
return {
|
|
8248
8503
|
success: false,
|
|
8249
8504
|
error: new Error(
|
|
8250
|
-
`Invalid frontmatter in ${(0,
|
|
8505
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8251
8506
|
)
|
|
8252
8507
|
};
|
|
8253
8508
|
}
|
|
@@ -8256,12 +8511,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8256
8511
|
relativeFilePath,
|
|
8257
8512
|
validate = true
|
|
8258
8513
|
}) {
|
|
8259
|
-
const legacyPath = (0,
|
|
8514
|
+
const legacyPath = (0, import_node_path72.join)(
|
|
8260
8515
|
process.cwd(),
|
|
8261
8516
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
8262
8517
|
relativeFilePath
|
|
8263
8518
|
);
|
|
8264
|
-
const recommendedPath = (0,
|
|
8519
|
+
const recommendedPath = (0, import_node_path72.join)(
|
|
8265
8520
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8266
8521
|
relativeFilePath
|
|
8267
8522
|
);
|
|
@@ -8282,7 +8537,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8282
8537
|
agentsmd: result.data.agentsmd,
|
|
8283
8538
|
cursor: result.data.cursor
|
|
8284
8539
|
};
|
|
8285
|
-
const filename = (0,
|
|
8540
|
+
const filename = (0, import_node_path72.basename)(legacyPath);
|
|
8286
8541
|
return new _RulesyncRule({
|
|
8287
8542
|
baseDir: process.cwd(),
|
|
8288
8543
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8296,7 +8551,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8296
8551
|
relativeFilePath,
|
|
8297
8552
|
validate = true
|
|
8298
8553
|
}) {
|
|
8299
|
-
const filePath = (0,
|
|
8554
|
+
const filePath = (0, import_node_path72.join)(
|
|
8300
8555
|
process.cwd(),
|
|
8301
8556
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8302
8557
|
relativeFilePath
|
|
@@ -8315,7 +8570,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8315
8570
|
agentsmd: result.data.agentsmd,
|
|
8316
8571
|
cursor: result.data.cursor
|
|
8317
8572
|
};
|
|
8318
|
-
const filename = (0,
|
|
8573
|
+
const filename = (0, import_node_path72.basename)(filePath);
|
|
8319
8574
|
return new _RulesyncRule({
|
|
8320
8575
|
baseDir: process.cwd(),
|
|
8321
8576
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8398,7 +8653,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8398
8653
|
rulesyncRule,
|
|
8399
8654
|
validate = true,
|
|
8400
8655
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
8401
|
-
nonRootPath = { relativeDirPath: (0,
|
|
8656
|
+
nonRootPath = { relativeDirPath: (0, import_node_path73.join)(".agents", "memories") }
|
|
8402
8657
|
}) {
|
|
8403
8658
|
const params = this.buildToolRuleParamsDefault({
|
|
8404
8659
|
baseDir,
|
|
@@ -8409,7 +8664,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8409
8664
|
});
|
|
8410
8665
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
8411
8666
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
8412
|
-
params.relativeDirPath = (0,
|
|
8667
|
+
params.relativeDirPath = (0, import_node_path73.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
8413
8668
|
params.relativeFilePath = "AGENTS.md";
|
|
8414
8669
|
}
|
|
8415
8670
|
return params;
|
|
@@ -8474,7 +8729,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8474
8729
|
relativeFilePath: "AGENTS.md"
|
|
8475
8730
|
},
|
|
8476
8731
|
nonRoot: {
|
|
8477
|
-
relativeDirPath: (0,
|
|
8732
|
+
relativeDirPath: (0, import_node_path74.join)(".agents", "memories")
|
|
8478
8733
|
}
|
|
8479
8734
|
};
|
|
8480
8735
|
}
|
|
@@ -8484,8 +8739,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8484
8739
|
validate = true
|
|
8485
8740
|
}) {
|
|
8486
8741
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
8487
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
8488
|
-
const fileContent = await readFileContent((0,
|
|
8742
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path74.join)(".agents", "memories", relativeFilePath);
|
|
8743
|
+
const fileContent = await readFileContent((0, import_node_path74.join)(baseDir, relativePath));
|
|
8489
8744
|
return new _AgentsMdRule({
|
|
8490
8745
|
baseDir,
|
|
8491
8746
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -8540,21 +8795,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8540
8795
|
};
|
|
8541
8796
|
|
|
8542
8797
|
// src/features/rules/antigravity-rule.ts
|
|
8543
|
-
var
|
|
8544
|
-
var
|
|
8545
|
-
var AntigravityRuleFrontmatterSchema =
|
|
8546
|
-
trigger:
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8798
|
+
var import_node_path75 = require("path");
|
|
8799
|
+
var import_mini37 = require("zod/mini");
|
|
8800
|
+
var AntigravityRuleFrontmatterSchema = import_mini37.z.looseObject({
|
|
8801
|
+
trigger: import_mini37.z.optional(
|
|
8802
|
+
import_mini37.z.union([
|
|
8803
|
+
import_mini37.z.literal("always_on"),
|
|
8804
|
+
import_mini37.z.literal("glob"),
|
|
8805
|
+
import_mini37.z.literal("manual"),
|
|
8806
|
+
import_mini37.z.literal("model_decision"),
|
|
8807
|
+
import_mini37.z.string()
|
|
8553
8808
|
// accepts any string for forward compatibility
|
|
8554
8809
|
])
|
|
8555
8810
|
),
|
|
8556
|
-
globs:
|
|
8557
|
-
description:
|
|
8811
|
+
globs: import_mini37.z.optional(import_mini37.z.string()),
|
|
8812
|
+
description: import_mini37.z.optional(import_mini37.z.string())
|
|
8558
8813
|
});
|
|
8559
8814
|
function parseGlobsString(globs) {
|
|
8560
8815
|
if (!globs) {
|
|
@@ -8699,7 +8954,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8699
8954
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8700
8955
|
if (!result.success) {
|
|
8701
8956
|
throw new Error(
|
|
8702
|
-
`Invalid frontmatter in ${(0,
|
|
8957
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8703
8958
|
);
|
|
8704
8959
|
}
|
|
8705
8960
|
}
|
|
@@ -8714,7 +8969,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8714
8969
|
static getSettablePaths() {
|
|
8715
8970
|
return {
|
|
8716
8971
|
nonRoot: {
|
|
8717
|
-
relativeDirPath: (0,
|
|
8972
|
+
relativeDirPath: (0, import_node_path75.join)(".agent", "rules")
|
|
8718
8973
|
}
|
|
8719
8974
|
};
|
|
8720
8975
|
}
|
|
@@ -8723,7 +8978,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8723
8978
|
relativeFilePath,
|
|
8724
8979
|
validate = true
|
|
8725
8980
|
}) {
|
|
8726
|
-
const filePath = (0,
|
|
8981
|
+
const filePath = (0, import_node_path75.join)(
|
|
8727
8982
|
baseDir,
|
|
8728
8983
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
8729
8984
|
relativeFilePath
|
|
@@ -8864,7 +9119,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8864
9119
|
};
|
|
8865
9120
|
|
|
8866
9121
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
8867
|
-
var
|
|
9122
|
+
var import_node_path76 = require("path");
|
|
8868
9123
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
8869
9124
|
toRulesyncRule() {
|
|
8870
9125
|
const rulesyncFrontmatter = {
|
|
@@ -8890,7 +9145,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8890
9145
|
relativeFilePath: ".augment-guidelines"
|
|
8891
9146
|
},
|
|
8892
9147
|
nonRoot: {
|
|
8893
|
-
relativeDirPath: (0,
|
|
9148
|
+
relativeDirPath: (0, import_node_path76.join)(".augment", "rules")
|
|
8894
9149
|
}
|
|
8895
9150
|
};
|
|
8896
9151
|
}
|
|
@@ -8925,8 +9180,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8925
9180
|
}) {
|
|
8926
9181
|
const settablePaths = this.getSettablePaths();
|
|
8927
9182
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
8928
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
8929
|
-
const fileContent = await readFileContent((0,
|
|
9183
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path76.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9184
|
+
const fileContent = await readFileContent((0, import_node_path76.join)(baseDir, relativePath));
|
|
8930
9185
|
return new _AugmentcodeLegacyRule({
|
|
8931
9186
|
baseDir,
|
|
8932
9187
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -8955,7 +9210,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8955
9210
|
};
|
|
8956
9211
|
|
|
8957
9212
|
// src/features/rules/augmentcode-rule.ts
|
|
8958
|
-
var
|
|
9213
|
+
var import_node_path77 = require("path");
|
|
8959
9214
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
8960
9215
|
toRulesyncRule() {
|
|
8961
9216
|
return this.toRulesyncRuleDefault();
|
|
@@ -8963,7 +9218,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8963
9218
|
static getSettablePaths() {
|
|
8964
9219
|
return {
|
|
8965
9220
|
nonRoot: {
|
|
8966
|
-
relativeDirPath: (0,
|
|
9221
|
+
relativeDirPath: (0, import_node_path77.join)(".augment", "rules")
|
|
8967
9222
|
}
|
|
8968
9223
|
};
|
|
8969
9224
|
}
|
|
@@ -8987,7 +9242,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8987
9242
|
validate = true
|
|
8988
9243
|
}) {
|
|
8989
9244
|
const fileContent = await readFileContent(
|
|
8990
|
-
(0,
|
|
9245
|
+
(0, import_node_path77.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8991
9246
|
);
|
|
8992
9247
|
const { body: content } = parseFrontmatter(fileContent);
|
|
8993
9248
|
return new _AugmentcodeRule({
|
|
@@ -9023,7 +9278,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9023
9278
|
};
|
|
9024
9279
|
|
|
9025
9280
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
9026
|
-
var
|
|
9281
|
+
var import_node_path78 = require("path");
|
|
9027
9282
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
9028
9283
|
static getSettablePaths({
|
|
9029
9284
|
global
|
|
@@ -9042,7 +9297,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9042
9297
|
relativeFilePath: "CLAUDE.md"
|
|
9043
9298
|
},
|
|
9044
9299
|
nonRoot: {
|
|
9045
|
-
relativeDirPath: (0,
|
|
9300
|
+
relativeDirPath: (0, import_node_path78.join)(".claude", "memories")
|
|
9046
9301
|
}
|
|
9047
9302
|
};
|
|
9048
9303
|
}
|
|
@@ -9057,7 +9312,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9057
9312
|
if (isRoot) {
|
|
9058
9313
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9059
9314
|
const fileContent2 = await readFileContent(
|
|
9060
|
-
(0,
|
|
9315
|
+
(0, import_node_path78.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9061
9316
|
);
|
|
9062
9317
|
return new _ClaudecodeLegacyRule({
|
|
9063
9318
|
baseDir,
|
|
@@ -9071,8 +9326,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9071
9326
|
if (!paths.nonRoot) {
|
|
9072
9327
|
throw new Error("nonRoot path is not set");
|
|
9073
9328
|
}
|
|
9074
|
-
const relativePath = (0,
|
|
9075
|
-
const fileContent = await readFileContent((0,
|
|
9329
|
+
const relativePath = (0, import_node_path78.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9330
|
+
const fileContent = await readFileContent((0, import_node_path78.join)(baseDir, relativePath));
|
|
9076
9331
|
return new _ClaudecodeLegacyRule({
|
|
9077
9332
|
baseDir,
|
|
9078
9333
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9131,10 +9386,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9131
9386
|
};
|
|
9132
9387
|
|
|
9133
9388
|
// src/features/rules/claudecode-rule.ts
|
|
9134
|
-
var
|
|
9135
|
-
var
|
|
9136
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
9137
|
-
paths:
|
|
9389
|
+
var import_node_path79 = require("path");
|
|
9390
|
+
var import_mini38 = require("zod/mini");
|
|
9391
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini38.z.object({
|
|
9392
|
+
paths: import_mini38.z.optional(import_mini38.z.string())
|
|
9138
9393
|
});
|
|
9139
9394
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
9140
9395
|
frontmatter;
|
|
@@ -9156,7 +9411,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9156
9411
|
relativeFilePath: "CLAUDE.md"
|
|
9157
9412
|
},
|
|
9158
9413
|
nonRoot: {
|
|
9159
|
-
relativeDirPath: (0,
|
|
9414
|
+
relativeDirPath: (0, import_node_path79.join)(".claude", "rules")
|
|
9160
9415
|
}
|
|
9161
9416
|
};
|
|
9162
9417
|
}
|
|
@@ -9165,7 +9420,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9165
9420
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9166
9421
|
if (!result.success) {
|
|
9167
9422
|
throw new Error(
|
|
9168
|
-
`Invalid frontmatter in ${(0,
|
|
9423
|
+
`Invalid frontmatter in ${(0, import_node_path79.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9169
9424
|
);
|
|
9170
9425
|
}
|
|
9171
9426
|
}
|
|
@@ -9193,7 +9448,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9193
9448
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
9194
9449
|
if (isRoot) {
|
|
9195
9450
|
const fileContent2 = await readFileContent(
|
|
9196
|
-
(0,
|
|
9451
|
+
(0, import_node_path79.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
9197
9452
|
);
|
|
9198
9453
|
return new _ClaudecodeRule({
|
|
9199
9454
|
baseDir,
|
|
@@ -9208,13 +9463,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9208
9463
|
if (!paths.nonRoot) {
|
|
9209
9464
|
throw new Error("nonRoot path is not set");
|
|
9210
9465
|
}
|
|
9211
|
-
const relativePath = (0,
|
|
9212
|
-
const fileContent = await readFileContent((0,
|
|
9466
|
+
const relativePath = (0, import_node_path79.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9467
|
+
const fileContent = await readFileContent((0, import_node_path79.join)(baseDir, relativePath));
|
|
9213
9468
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9214
9469
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9215
9470
|
if (!result.success) {
|
|
9216
9471
|
throw new Error(
|
|
9217
|
-
`Invalid frontmatter in ${(0,
|
|
9472
|
+
`Invalid frontmatter in ${(0, import_node_path79.join)(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
9218
9473
|
);
|
|
9219
9474
|
}
|
|
9220
9475
|
return new _ClaudecodeRule({
|
|
@@ -9321,7 +9576,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9321
9576
|
return {
|
|
9322
9577
|
success: false,
|
|
9323
9578
|
error: new Error(
|
|
9324
|
-
`Invalid frontmatter in ${(0,
|
|
9579
|
+
`Invalid frontmatter in ${(0, import_node_path79.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9325
9580
|
)
|
|
9326
9581
|
};
|
|
9327
9582
|
}
|
|
@@ -9341,10 +9596,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9341
9596
|
};
|
|
9342
9597
|
|
|
9343
9598
|
// src/features/rules/cline-rule.ts
|
|
9344
|
-
var
|
|
9345
|
-
var
|
|
9346
|
-
var ClineRuleFrontmatterSchema =
|
|
9347
|
-
description:
|
|
9599
|
+
var import_node_path80 = require("path");
|
|
9600
|
+
var import_mini39 = require("zod/mini");
|
|
9601
|
+
var ClineRuleFrontmatterSchema = import_mini39.z.object({
|
|
9602
|
+
description: import_mini39.z.string()
|
|
9348
9603
|
});
|
|
9349
9604
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
9350
9605
|
static getSettablePaths() {
|
|
@@ -9386,7 +9641,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9386
9641
|
validate = true
|
|
9387
9642
|
}) {
|
|
9388
9643
|
const fileContent = await readFileContent(
|
|
9389
|
-
(0,
|
|
9644
|
+
(0, import_node_path80.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9390
9645
|
);
|
|
9391
9646
|
return new _ClineRule({
|
|
9392
9647
|
baseDir,
|
|
@@ -9412,7 +9667,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9412
9667
|
};
|
|
9413
9668
|
|
|
9414
9669
|
// src/features/rules/codexcli-rule.ts
|
|
9415
|
-
var
|
|
9670
|
+
var import_node_path81 = require("path");
|
|
9416
9671
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
9417
9672
|
static getSettablePaths({
|
|
9418
9673
|
global
|
|
@@ -9431,7 +9686,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9431
9686
|
relativeFilePath: "AGENTS.md"
|
|
9432
9687
|
},
|
|
9433
9688
|
nonRoot: {
|
|
9434
|
-
relativeDirPath: (0,
|
|
9689
|
+
relativeDirPath: (0, import_node_path81.join)(".codex", "memories")
|
|
9435
9690
|
}
|
|
9436
9691
|
};
|
|
9437
9692
|
}
|
|
@@ -9446,7 +9701,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9446
9701
|
if (isRoot) {
|
|
9447
9702
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9448
9703
|
const fileContent2 = await readFileContent(
|
|
9449
|
-
(0,
|
|
9704
|
+
(0, import_node_path81.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9450
9705
|
);
|
|
9451
9706
|
return new _CodexcliRule({
|
|
9452
9707
|
baseDir,
|
|
@@ -9460,8 +9715,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9460
9715
|
if (!paths.nonRoot) {
|
|
9461
9716
|
throw new Error("nonRoot path is not set");
|
|
9462
9717
|
}
|
|
9463
|
-
const relativePath = (0,
|
|
9464
|
-
const fileContent = await readFileContent((0,
|
|
9718
|
+
const relativePath = (0, import_node_path81.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9719
|
+
const fileContent = await readFileContent((0, import_node_path81.join)(baseDir, relativePath));
|
|
9465
9720
|
return new _CodexcliRule({
|
|
9466
9721
|
baseDir,
|
|
9467
9722
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9520,12 +9775,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9520
9775
|
};
|
|
9521
9776
|
|
|
9522
9777
|
// src/features/rules/copilot-rule.ts
|
|
9523
|
-
var
|
|
9524
|
-
var
|
|
9525
|
-
var CopilotRuleFrontmatterSchema =
|
|
9526
|
-
description:
|
|
9527
|
-
applyTo:
|
|
9528
|
-
excludeAgent:
|
|
9778
|
+
var import_node_path82 = require("path");
|
|
9779
|
+
var import_mini40 = require("zod/mini");
|
|
9780
|
+
var CopilotRuleFrontmatterSchema = import_mini40.z.object({
|
|
9781
|
+
description: import_mini40.z.optional(import_mini40.z.string()),
|
|
9782
|
+
applyTo: import_mini40.z.optional(import_mini40.z.string()),
|
|
9783
|
+
excludeAgent: import_mini40.z.optional(import_mini40.z.union([import_mini40.z.literal("code-review"), import_mini40.z.literal("coding-agent")]))
|
|
9529
9784
|
});
|
|
9530
9785
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
9531
9786
|
frontmatter;
|
|
@@ -9537,7 +9792,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9537
9792
|
relativeFilePath: "copilot-instructions.md"
|
|
9538
9793
|
},
|
|
9539
9794
|
nonRoot: {
|
|
9540
|
-
relativeDirPath: (0,
|
|
9795
|
+
relativeDirPath: (0, import_node_path82.join)(".github", "instructions")
|
|
9541
9796
|
}
|
|
9542
9797
|
};
|
|
9543
9798
|
}
|
|
@@ -9546,7 +9801,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9546
9801
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9547
9802
|
if (!result.success) {
|
|
9548
9803
|
throw new Error(
|
|
9549
|
-
`Invalid frontmatter in ${(0,
|
|
9804
|
+
`Invalid frontmatter in ${(0, import_node_path82.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9550
9805
|
);
|
|
9551
9806
|
}
|
|
9552
9807
|
}
|
|
@@ -9628,11 +9883,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9628
9883
|
validate = true
|
|
9629
9884
|
}) {
|
|
9630
9885
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
9631
|
-
const relativePath = isRoot ? (0,
|
|
9886
|
+
const relativePath = isRoot ? (0, import_node_path82.join)(
|
|
9632
9887
|
this.getSettablePaths().root.relativeDirPath,
|
|
9633
9888
|
this.getSettablePaths().root.relativeFilePath
|
|
9634
|
-
) : (0,
|
|
9635
|
-
const fileContent = await readFileContent((0,
|
|
9889
|
+
) : (0, import_node_path82.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
9890
|
+
const fileContent = await readFileContent((0, import_node_path82.join)(baseDir, relativePath));
|
|
9636
9891
|
if (isRoot) {
|
|
9637
9892
|
return new _CopilotRule({
|
|
9638
9893
|
baseDir,
|
|
@@ -9648,7 +9903,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9648
9903
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9649
9904
|
if (!result.success) {
|
|
9650
9905
|
throw new Error(
|
|
9651
|
-
`Invalid frontmatter in ${(0,
|
|
9906
|
+
`Invalid frontmatter in ${(0, import_node_path82.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9652
9907
|
);
|
|
9653
9908
|
}
|
|
9654
9909
|
return new _CopilotRule({
|
|
@@ -9688,7 +9943,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9688
9943
|
return {
|
|
9689
9944
|
success: false,
|
|
9690
9945
|
error: new Error(
|
|
9691
|
-
`Invalid frontmatter in ${(0,
|
|
9946
|
+
`Invalid frontmatter in ${(0, import_node_path82.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9692
9947
|
)
|
|
9693
9948
|
};
|
|
9694
9949
|
}
|
|
@@ -9708,12 +9963,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9708
9963
|
};
|
|
9709
9964
|
|
|
9710
9965
|
// src/features/rules/cursor-rule.ts
|
|
9711
|
-
var
|
|
9712
|
-
var
|
|
9713
|
-
var CursorRuleFrontmatterSchema =
|
|
9714
|
-
description:
|
|
9715
|
-
globs:
|
|
9716
|
-
alwaysApply:
|
|
9966
|
+
var import_node_path83 = require("path");
|
|
9967
|
+
var import_mini41 = require("zod/mini");
|
|
9968
|
+
var CursorRuleFrontmatterSchema = import_mini41.z.object({
|
|
9969
|
+
description: import_mini41.z.optional(import_mini41.z.string()),
|
|
9970
|
+
globs: import_mini41.z.optional(import_mini41.z.string()),
|
|
9971
|
+
alwaysApply: import_mini41.z.optional(import_mini41.z.boolean())
|
|
9717
9972
|
});
|
|
9718
9973
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
9719
9974
|
frontmatter;
|
|
@@ -9721,7 +9976,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9721
9976
|
static getSettablePaths() {
|
|
9722
9977
|
return {
|
|
9723
9978
|
nonRoot: {
|
|
9724
|
-
relativeDirPath: (0,
|
|
9979
|
+
relativeDirPath: (0, import_node_path83.join)(".cursor", "rules")
|
|
9725
9980
|
}
|
|
9726
9981
|
};
|
|
9727
9982
|
}
|
|
@@ -9730,7 +9985,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9730
9985
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9731
9986
|
if (!result.success) {
|
|
9732
9987
|
throw new Error(
|
|
9733
|
-
`Invalid frontmatter in ${(0,
|
|
9988
|
+
`Invalid frontmatter in ${(0, import_node_path83.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9734
9989
|
);
|
|
9735
9990
|
}
|
|
9736
9991
|
}
|
|
@@ -9847,19 +10102,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9847
10102
|
validate = true
|
|
9848
10103
|
}) {
|
|
9849
10104
|
const fileContent = await readFileContent(
|
|
9850
|
-
(0,
|
|
10105
|
+
(0, import_node_path83.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9851
10106
|
);
|
|
9852
10107
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
9853
10108
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9854
10109
|
if (!result.success) {
|
|
9855
10110
|
throw new Error(
|
|
9856
|
-
`Invalid frontmatter in ${(0,
|
|
10111
|
+
`Invalid frontmatter in ${(0, import_node_path83.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9857
10112
|
);
|
|
9858
10113
|
}
|
|
9859
10114
|
return new _CursorRule({
|
|
9860
10115
|
baseDir,
|
|
9861
10116
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
9862
|
-
relativeFilePath: (0,
|
|
10117
|
+
relativeFilePath: (0, import_node_path83.basename)(relativeFilePath),
|
|
9863
10118
|
frontmatter: result.data,
|
|
9864
10119
|
body: content.trim(),
|
|
9865
10120
|
validate
|
|
@@ -9890,7 +10145,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9890
10145
|
return {
|
|
9891
10146
|
success: false,
|
|
9892
10147
|
error: new Error(
|
|
9893
|
-
`Invalid frontmatter in ${(0,
|
|
10148
|
+
`Invalid frontmatter in ${(0, import_node_path83.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9894
10149
|
)
|
|
9895
10150
|
};
|
|
9896
10151
|
}
|
|
@@ -9910,7 +10165,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9910
10165
|
};
|
|
9911
10166
|
|
|
9912
10167
|
// src/features/rules/geminicli-rule.ts
|
|
9913
|
-
var
|
|
10168
|
+
var import_node_path84 = require("path");
|
|
9914
10169
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
9915
10170
|
static getSettablePaths({
|
|
9916
10171
|
global
|
|
@@ -9929,7 +10184,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9929
10184
|
relativeFilePath: "GEMINI.md"
|
|
9930
10185
|
},
|
|
9931
10186
|
nonRoot: {
|
|
9932
|
-
relativeDirPath: (0,
|
|
10187
|
+
relativeDirPath: (0, import_node_path84.join)(".gemini", "memories")
|
|
9933
10188
|
}
|
|
9934
10189
|
};
|
|
9935
10190
|
}
|
|
@@ -9944,7 +10199,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9944
10199
|
if (isRoot) {
|
|
9945
10200
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9946
10201
|
const fileContent2 = await readFileContent(
|
|
9947
|
-
(0,
|
|
10202
|
+
(0, import_node_path84.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9948
10203
|
);
|
|
9949
10204
|
return new _GeminiCliRule({
|
|
9950
10205
|
baseDir,
|
|
@@ -9958,8 +10213,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9958
10213
|
if (!paths.nonRoot) {
|
|
9959
10214
|
throw new Error("nonRoot path is not set");
|
|
9960
10215
|
}
|
|
9961
|
-
const relativePath = (0,
|
|
9962
|
-
const fileContent = await readFileContent((0,
|
|
10216
|
+
const relativePath = (0, import_node_path84.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10217
|
+
const fileContent = await readFileContent((0, import_node_path84.join)(baseDir, relativePath));
|
|
9963
10218
|
return new _GeminiCliRule({
|
|
9964
10219
|
baseDir,
|
|
9965
10220
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10018,7 +10273,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10018
10273
|
};
|
|
10019
10274
|
|
|
10020
10275
|
// src/features/rules/junie-rule.ts
|
|
10021
|
-
var
|
|
10276
|
+
var import_node_path85 = require("path");
|
|
10022
10277
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
10023
10278
|
static getSettablePaths() {
|
|
10024
10279
|
return {
|
|
@@ -10027,7 +10282,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10027
10282
|
relativeFilePath: "guidelines.md"
|
|
10028
10283
|
},
|
|
10029
10284
|
nonRoot: {
|
|
10030
|
-
relativeDirPath: (0,
|
|
10285
|
+
relativeDirPath: (0, import_node_path85.join)(".junie", "memories")
|
|
10031
10286
|
}
|
|
10032
10287
|
};
|
|
10033
10288
|
}
|
|
@@ -10037,8 +10292,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10037
10292
|
validate = true
|
|
10038
10293
|
}) {
|
|
10039
10294
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
10040
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
10041
|
-
const fileContent = await readFileContent((0,
|
|
10295
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path85.join)(".junie", "memories", relativeFilePath);
|
|
10296
|
+
const fileContent = await readFileContent((0, import_node_path85.join)(baseDir, relativePath));
|
|
10042
10297
|
return new _JunieRule({
|
|
10043
10298
|
baseDir,
|
|
10044
10299
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10093,12 +10348,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10093
10348
|
};
|
|
10094
10349
|
|
|
10095
10350
|
// src/features/rules/kilo-rule.ts
|
|
10096
|
-
var
|
|
10351
|
+
var import_node_path86 = require("path");
|
|
10097
10352
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
10098
10353
|
static getSettablePaths(_options = {}) {
|
|
10099
10354
|
return {
|
|
10100
10355
|
nonRoot: {
|
|
10101
|
-
relativeDirPath: (0,
|
|
10356
|
+
relativeDirPath: (0, import_node_path86.join)(".kilocode", "rules")
|
|
10102
10357
|
}
|
|
10103
10358
|
};
|
|
10104
10359
|
}
|
|
@@ -10108,7 +10363,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10108
10363
|
validate = true
|
|
10109
10364
|
}) {
|
|
10110
10365
|
const fileContent = await readFileContent(
|
|
10111
|
-
(0,
|
|
10366
|
+
(0, import_node_path86.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10112
10367
|
);
|
|
10113
10368
|
return new _KiloRule({
|
|
10114
10369
|
baseDir,
|
|
@@ -10160,12 +10415,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10160
10415
|
};
|
|
10161
10416
|
|
|
10162
10417
|
// src/features/rules/kiro-rule.ts
|
|
10163
|
-
var
|
|
10418
|
+
var import_node_path87 = require("path");
|
|
10164
10419
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
10165
10420
|
static getSettablePaths() {
|
|
10166
10421
|
return {
|
|
10167
10422
|
nonRoot: {
|
|
10168
|
-
relativeDirPath: (0,
|
|
10423
|
+
relativeDirPath: (0, import_node_path87.join)(".kiro", "steering")
|
|
10169
10424
|
}
|
|
10170
10425
|
};
|
|
10171
10426
|
}
|
|
@@ -10175,7 +10430,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10175
10430
|
validate = true
|
|
10176
10431
|
}) {
|
|
10177
10432
|
const fileContent = await readFileContent(
|
|
10178
|
-
(0,
|
|
10433
|
+
(0, import_node_path87.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10179
10434
|
);
|
|
10180
10435
|
return new _KiroRule({
|
|
10181
10436
|
baseDir,
|
|
@@ -10229,7 +10484,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10229
10484
|
};
|
|
10230
10485
|
|
|
10231
10486
|
// src/features/rules/opencode-rule.ts
|
|
10232
|
-
var
|
|
10487
|
+
var import_node_path88 = require("path");
|
|
10233
10488
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
10234
10489
|
static getSettablePaths() {
|
|
10235
10490
|
return {
|
|
@@ -10238,7 +10493,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10238
10493
|
relativeFilePath: "AGENTS.md"
|
|
10239
10494
|
},
|
|
10240
10495
|
nonRoot: {
|
|
10241
|
-
relativeDirPath: (0,
|
|
10496
|
+
relativeDirPath: (0, import_node_path88.join)(".opencode", "memories")
|
|
10242
10497
|
}
|
|
10243
10498
|
};
|
|
10244
10499
|
}
|
|
@@ -10248,8 +10503,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10248
10503
|
validate = true
|
|
10249
10504
|
}) {
|
|
10250
10505
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
10251
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
10252
|
-
const fileContent = await readFileContent((0,
|
|
10506
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path88.join)(".opencode", "memories", relativeFilePath);
|
|
10507
|
+
const fileContent = await readFileContent((0, import_node_path88.join)(baseDir, relativePath));
|
|
10253
10508
|
return new _OpenCodeRule({
|
|
10254
10509
|
baseDir,
|
|
10255
10510
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10304,7 +10559,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10304
10559
|
};
|
|
10305
10560
|
|
|
10306
10561
|
// src/features/rules/qwencode-rule.ts
|
|
10307
|
-
var
|
|
10562
|
+
var import_node_path89 = require("path");
|
|
10308
10563
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
10309
10564
|
static getSettablePaths() {
|
|
10310
10565
|
return {
|
|
@@ -10313,7 +10568,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10313
10568
|
relativeFilePath: "QWEN.md"
|
|
10314
10569
|
},
|
|
10315
10570
|
nonRoot: {
|
|
10316
|
-
relativeDirPath: (0,
|
|
10571
|
+
relativeDirPath: (0, import_node_path89.join)(".qwen", "memories")
|
|
10317
10572
|
}
|
|
10318
10573
|
};
|
|
10319
10574
|
}
|
|
@@ -10323,8 +10578,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10323
10578
|
validate = true
|
|
10324
10579
|
}) {
|
|
10325
10580
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
10326
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
10327
|
-
const fileContent = await readFileContent((0,
|
|
10581
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path89.join)(".qwen", "memories", relativeFilePath);
|
|
10582
|
+
const fileContent = await readFileContent((0, import_node_path89.join)(baseDir, relativePath));
|
|
10328
10583
|
return new _QwencodeRule({
|
|
10329
10584
|
baseDir,
|
|
10330
10585
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10376,12 +10631,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10376
10631
|
};
|
|
10377
10632
|
|
|
10378
10633
|
// src/features/rules/roo-rule.ts
|
|
10379
|
-
var
|
|
10634
|
+
var import_node_path90 = require("path");
|
|
10380
10635
|
var RooRule = class _RooRule extends ToolRule {
|
|
10381
10636
|
static getSettablePaths() {
|
|
10382
10637
|
return {
|
|
10383
10638
|
nonRoot: {
|
|
10384
|
-
relativeDirPath: (0,
|
|
10639
|
+
relativeDirPath: (0, import_node_path90.join)(".roo", "rules")
|
|
10385
10640
|
}
|
|
10386
10641
|
};
|
|
10387
10642
|
}
|
|
@@ -10391,7 +10646,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10391
10646
|
validate = true
|
|
10392
10647
|
}) {
|
|
10393
10648
|
const fileContent = await readFileContent(
|
|
10394
|
-
(0,
|
|
10649
|
+
(0, import_node_path90.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10395
10650
|
);
|
|
10396
10651
|
return new _RooRule({
|
|
10397
10652
|
baseDir,
|
|
@@ -10460,7 +10715,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10460
10715
|
};
|
|
10461
10716
|
|
|
10462
10717
|
// src/features/rules/warp-rule.ts
|
|
10463
|
-
var
|
|
10718
|
+
var import_node_path91 = require("path");
|
|
10464
10719
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
10465
10720
|
constructor({ fileContent, root, ...rest }) {
|
|
10466
10721
|
super({
|
|
@@ -10476,7 +10731,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10476
10731
|
relativeFilePath: "WARP.md"
|
|
10477
10732
|
},
|
|
10478
10733
|
nonRoot: {
|
|
10479
|
-
relativeDirPath: (0,
|
|
10734
|
+
relativeDirPath: (0, import_node_path91.join)(".warp", "memories")
|
|
10480
10735
|
}
|
|
10481
10736
|
};
|
|
10482
10737
|
}
|
|
@@ -10486,8 +10741,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10486
10741
|
validate = true
|
|
10487
10742
|
}) {
|
|
10488
10743
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
10489
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
10490
|
-
const fileContent = await readFileContent((0,
|
|
10744
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path91.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10745
|
+
const fileContent = await readFileContent((0, import_node_path91.join)(baseDir, relativePath));
|
|
10491
10746
|
return new _WarpRule({
|
|
10492
10747
|
baseDir,
|
|
10493
10748
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -10542,12 +10797,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10542
10797
|
};
|
|
10543
10798
|
|
|
10544
10799
|
// src/features/rules/windsurf-rule.ts
|
|
10545
|
-
var
|
|
10800
|
+
var import_node_path92 = require("path");
|
|
10546
10801
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
10547
10802
|
static getSettablePaths() {
|
|
10548
10803
|
return {
|
|
10549
10804
|
nonRoot: {
|
|
10550
|
-
relativeDirPath: (0,
|
|
10805
|
+
relativeDirPath: (0, import_node_path92.join)(".windsurf", "rules")
|
|
10551
10806
|
}
|
|
10552
10807
|
};
|
|
10553
10808
|
}
|
|
@@ -10557,7 +10812,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
10557
10812
|
validate = true
|
|
10558
10813
|
}) {
|
|
10559
10814
|
const fileContent = await readFileContent(
|
|
10560
|
-
(0,
|
|
10815
|
+
(0, import_node_path92.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10561
10816
|
);
|
|
10562
10817
|
return new _WindsurfRule({
|
|
10563
10818
|
baseDir,
|
|
@@ -10630,7 +10885,7 @@ var rulesProcessorToolTargets = [
|
|
|
10630
10885
|
"warp",
|
|
10631
10886
|
"windsurf"
|
|
10632
10887
|
];
|
|
10633
|
-
var RulesProcessorToolTargetSchema =
|
|
10888
|
+
var RulesProcessorToolTargetSchema = import_mini42.z.enum(rulesProcessorToolTargets);
|
|
10634
10889
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
10635
10890
|
[
|
|
10636
10891
|
"agentsmd",
|
|
@@ -10914,7 +11169,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10914
11169
|
}).relativeDirPath;
|
|
10915
11170
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
10916
11171
|
const frontmatter = skill.getFrontmatter();
|
|
10917
|
-
const relativePath = (0,
|
|
11172
|
+
const relativePath = (0, import_node_path93.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
10918
11173
|
return {
|
|
10919
11174
|
name: frontmatter.name,
|
|
10920
11175
|
description: frontmatter.description,
|
|
@@ -10981,10 +11236,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10981
11236
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
10982
11237
|
*/
|
|
10983
11238
|
async loadRulesyncFiles() {
|
|
10984
|
-
const files = await findFilesByGlobs((0,
|
|
11239
|
+
const files = await findFilesByGlobs((0, import_node_path93.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
10985
11240
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
10986
11241
|
const rulesyncRules = await Promise.all(
|
|
10987
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0,
|
|
11242
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path93.basename)(file) }))
|
|
10988
11243
|
);
|
|
10989
11244
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
10990
11245
|
if (rootRules.length > 1) {
|
|
@@ -11002,10 +11257,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11002
11257
|
return rulesyncRules;
|
|
11003
11258
|
}
|
|
11004
11259
|
async loadRulesyncFilesLegacy() {
|
|
11005
|
-
const legacyFiles = await findFilesByGlobs((0,
|
|
11260
|
+
const legacyFiles = await findFilesByGlobs((0, import_node_path93.join)(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
11006
11261
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
11007
11262
|
return Promise.all(
|
|
11008
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0,
|
|
11263
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path93.basename)(file) }))
|
|
11009
11264
|
);
|
|
11010
11265
|
}
|
|
11011
11266
|
/**
|
|
@@ -11023,7 +11278,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11023
11278
|
return [];
|
|
11024
11279
|
}
|
|
11025
11280
|
const rootFilePaths = await findFilesByGlobs(
|
|
11026
|
-
(0,
|
|
11281
|
+
(0, import_node_path93.join)(
|
|
11027
11282
|
this.baseDir,
|
|
11028
11283
|
settablePaths.root.relativeDirPath ?? ".",
|
|
11029
11284
|
settablePaths.root.relativeFilePath
|
|
@@ -11034,7 +11289,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11034
11289
|
(filePath) => factory.class.forDeletion({
|
|
11035
11290
|
baseDir: this.baseDir,
|
|
11036
11291
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
11037
|
-
relativeFilePath: (0,
|
|
11292
|
+
relativeFilePath: (0, import_node_path93.basename)(filePath),
|
|
11038
11293
|
global: this.global
|
|
11039
11294
|
})
|
|
11040
11295
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11043,7 +11298,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11043
11298
|
rootFilePaths.map(
|
|
11044
11299
|
(filePath) => factory.class.fromFile({
|
|
11045
11300
|
baseDir: this.baseDir,
|
|
11046
|
-
relativeFilePath: (0,
|
|
11301
|
+
relativeFilePath: (0, import_node_path93.basename)(filePath),
|
|
11047
11302
|
global: this.global
|
|
11048
11303
|
})
|
|
11049
11304
|
)
|
|
@@ -11055,14 +11310,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11055
11310
|
return [];
|
|
11056
11311
|
}
|
|
11057
11312
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
11058
|
-
(0,
|
|
11313
|
+
(0, import_node_path93.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
11059
11314
|
);
|
|
11060
11315
|
if (forDeletion) {
|
|
11061
11316
|
return nonRootFilePaths.map(
|
|
11062
11317
|
(filePath) => factory.class.forDeletion({
|
|
11063
11318
|
baseDir: this.baseDir,
|
|
11064
11319
|
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
11065
|
-
relativeFilePath: (0,
|
|
11320
|
+
relativeFilePath: (0, import_node_path93.basename)(filePath),
|
|
11066
11321
|
global: this.global
|
|
11067
11322
|
})
|
|
11068
11323
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11071,7 +11326,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11071
11326
|
nonRootFilePaths.map(
|
|
11072
11327
|
(filePath) => factory.class.fromFile({
|
|
11073
11328
|
baseDir: this.baseDir,
|
|
11074
|
-
relativeFilePath: (0,
|
|
11329
|
+
relativeFilePath: (0, import_node_path93.basename)(filePath),
|
|
11075
11330
|
global: this.global
|
|
11076
11331
|
})
|
|
11077
11332
|
)
|
|
@@ -11164,14 +11419,14 @@ s/<command> [arguments]
|
|
|
11164
11419
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
11165
11420
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
11166
11421
|
|
|
11167
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
11422
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path93.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
11168
11423
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
11169
11424
|
|
|
11170
11425
|
Simulated subagents are specialized AI assistants that can be invoked to handle specific types of tasks. In this case, it can be appear something like custom slash commands simply. Simulated subagents can be called by custom slash commands.
|
|
11171
11426
|
|
|
11172
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
11427
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
11173
11428
|
|
|
11174
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
11429
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
11175
11430
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
11176
11431
|
const result = [
|
|
11177
11432
|
overview,
|
|
@@ -11453,7 +11708,7 @@ async function generateSkills(config) {
|
|
|
11453
11708
|
}
|
|
11454
11709
|
|
|
11455
11710
|
// src/cli/commands/gitignore.ts
|
|
11456
|
-
var
|
|
11711
|
+
var import_node_path94 = require("path");
|
|
11457
11712
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
11458
11713
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
11459
11714
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -11462,6 +11717,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11462
11717
|
"**/.agents/",
|
|
11463
11718
|
// Antigravity
|
|
11464
11719
|
"**/.agent/rules/",
|
|
11720
|
+
"**/.agent/skills/",
|
|
11465
11721
|
"**/.agent/workflows/",
|
|
11466
11722
|
// Augment
|
|
11467
11723
|
"**/.augmentignore",
|
|
@@ -11515,6 +11771,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11515
11771
|
"**/.kilocodeignore",
|
|
11516
11772
|
// Kiro
|
|
11517
11773
|
"**/.kiro/steering/",
|
|
11774
|
+
"**/.kiro/settings/mcp.json",
|
|
11518
11775
|
"**/.aiignore",
|
|
11519
11776
|
// OpenCode
|
|
11520
11777
|
"**/.opencode/memories/",
|
|
@@ -11587,7 +11844,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
11587
11844
|
return result;
|
|
11588
11845
|
};
|
|
11589
11846
|
var gitignoreCommand = async () => {
|
|
11590
|
-
const gitignorePath = (0,
|
|
11847
|
+
const gitignorePath = (0, import_node_path94.join)(process.cwd(), ".gitignore");
|
|
11591
11848
|
let gitignoreContent = "";
|
|
11592
11849
|
if (await fileExists(gitignorePath)) {
|
|
11593
11850
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -11786,7 +12043,7 @@ async function importSkills(config, tool) {
|
|
|
11786
12043
|
}
|
|
11787
12044
|
|
|
11788
12045
|
// src/cli/commands/init.ts
|
|
11789
|
-
var
|
|
12046
|
+
var import_node_path95 = require("path");
|
|
11790
12047
|
async function initCommand() {
|
|
11791
12048
|
logger.info("Initializing rulesync...");
|
|
11792
12049
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -11795,7 +12052,7 @@ async function initCommand() {
|
|
|
11795
12052
|
logger.success("rulesync initialized successfully!");
|
|
11796
12053
|
logger.info("Next steps:");
|
|
11797
12054
|
logger.info(
|
|
11798
|
-
`1. Edit ${RULESYNC_RELATIVE_DIR_PATH}/**/*.md, ${RULESYNC_MCP_RELATIVE_FILE_PATH} and ${RULESYNC_AIIGNORE_RELATIVE_FILE_PATH}`
|
|
12055
|
+
`1. Edit ${RULESYNC_RELATIVE_DIR_PATH}/**/*.md, ${RULESYNC_RELATIVE_DIR_PATH}/skills/*/${SKILL_FILE_NAME}, ${RULESYNC_MCP_RELATIVE_FILE_PATH} and ${RULESYNC_AIIGNORE_RELATIVE_FILE_PATH}`
|
|
11799
12056
|
);
|
|
11800
12057
|
logger.info("2. Run 'rulesync generate' to create configuration files");
|
|
11801
12058
|
}
|
|
@@ -11809,13 +12066,14 @@ async function createConfigFile() {
|
|
|
11809
12066
|
JSON.stringify(
|
|
11810
12067
|
{
|
|
11811
12068
|
targets: ["copilot", "cursor", "claudecode", "codexcli"],
|
|
11812
|
-
features: ["rules", "ignore", "mcp", "commands", "subagents"],
|
|
12069
|
+
features: ["rules", "ignore", "mcp", "commands", "subagents", "skills"],
|
|
11813
12070
|
baseDirs: ["."],
|
|
11814
12071
|
delete: true,
|
|
11815
12072
|
verbose: false,
|
|
11816
12073
|
global: false,
|
|
11817
12074
|
simulateCommands: false,
|
|
11818
12075
|
simulateSubagents: false,
|
|
12076
|
+
simulateSkills: false,
|
|
11819
12077
|
modularMcp: false
|
|
11820
12078
|
},
|
|
11821
12079
|
null,
|
|
@@ -11934,6 +12192,18 @@ Based on the user's instruction, create a plan while analyzing the related files
|
|
|
11934
12192
|
|
|
11935
12193
|
Attention, again, you are just the planner, so though you can read any files and run any commands for analysis, please don't write any code.
|
|
11936
12194
|
`
|
|
12195
|
+
};
|
|
12196
|
+
const sampleSkillFile = {
|
|
12197
|
+
dirName: "project-context",
|
|
12198
|
+
content: `---
|
|
12199
|
+
name: project-context
|
|
12200
|
+
description: "Summarize the project context and key constraints"
|
|
12201
|
+
targets: ["*"]
|
|
12202
|
+
---
|
|
12203
|
+
|
|
12204
|
+
Summarize the project goals, core constraints, and relevant dependencies.
|
|
12205
|
+
Call out any architecture decisions, shared conventions, and validation steps.
|
|
12206
|
+
Keep the summary concise and ready to reuse in future tasks.`
|
|
11937
12207
|
};
|
|
11938
12208
|
const sampleIgnoreFile = {
|
|
11939
12209
|
content: `credentials/
|
|
@@ -11943,20 +12213,22 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11943
12213
|
const mcpPaths = RulesyncMcp.getSettablePaths();
|
|
11944
12214
|
const commandPaths = RulesyncCommand.getSettablePaths();
|
|
11945
12215
|
const subagentPaths = RulesyncSubagent.getSettablePaths();
|
|
12216
|
+
const skillPaths = RulesyncSkill.getSettablePaths();
|
|
11946
12217
|
const ignorePaths = RulesyncIgnore.getSettablePaths();
|
|
11947
12218
|
await ensureDir(rulePaths.recommended.relativeDirPath);
|
|
11948
12219
|
await ensureDir(mcpPaths.recommended.relativeDirPath);
|
|
11949
12220
|
await ensureDir(commandPaths.relativeDirPath);
|
|
11950
12221
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
12222
|
+
await ensureDir(skillPaths.relativeDirPath);
|
|
11951
12223
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
11952
|
-
const ruleFilepath = (0,
|
|
12224
|
+
const ruleFilepath = (0, import_node_path95.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
11953
12225
|
if (!await fileExists(ruleFilepath)) {
|
|
11954
12226
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
11955
12227
|
logger.success(`Created ${ruleFilepath}`);
|
|
11956
12228
|
} else {
|
|
11957
12229
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
11958
12230
|
}
|
|
11959
|
-
const mcpFilepath = (0,
|
|
12231
|
+
const mcpFilepath = (0, import_node_path95.join)(
|
|
11960
12232
|
mcpPaths.recommended.relativeDirPath,
|
|
11961
12233
|
mcpPaths.recommended.relativeFilePath
|
|
11962
12234
|
);
|
|
@@ -11966,21 +12238,30 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11966
12238
|
} else {
|
|
11967
12239
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
11968
12240
|
}
|
|
11969
|
-
const commandFilepath = (0,
|
|
12241
|
+
const commandFilepath = (0, import_node_path95.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
11970
12242
|
if (!await fileExists(commandFilepath)) {
|
|
11971
12243
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
11972
12244
|
logger.success(`Created ${commandFilepath}`);
|
|
11973
12245
|
} else {
|
|
11974
12246
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
11975
12247
|
}
|
|
11976
|
-
const subagentFilepath = (0,
|
|
12248
|
+
const subagentFilepath = (0, import_node_path95.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
11977
12249
|
if (!await fileExists(subagentFilepath)) {
|
|
11978
12250
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
11979
12251
|
logger.success(`Created ${subagentFilepath}`);
|
|
11980
12252
|
} else {
|
|
11981
12253
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
11982
12254
|
}
|
|
11983
|
-
const
|
|
12255
|
+
const skillDirPath = (0, import_node_path95.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
12256
|
+
await ensureDir(skillDirPath);
|
|
12257
|
+
const skillFilepath = (0, import_node_path95.join)(skillDirPath, SKILL_FILE_NAME);
|
|
12258
|
+
if (!await fileExists(skillFilepath)) {
|
|
12259
|
+
await writeFileContent(skillFilepath, sampleSkillFile.content);
|
|
12260
|
+
logger.success(`Created ${skillFilepath}`);
|
|
12261
|
+
} else {
|
|
12262
|
+
logger.info(`Skipped ${skillFilepath} (already exists)`);
|
|
12263
|
+
}
|
|
12264
|
+
const ignoreFilepath = (0, import_node_path95.join)(
|
|
11984
12265
|
ignorePaths.recommended.relativeDirPath,
|
|
11985
12266
|
ignorePaths.recommended.relativeFilePath
|
|
11986
12267
|
);
|
|
@@ -11996,15 +12277,15 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11996
12277
|
var import_fastmcp = require("fastmcp");
|
|
11997
12278
|
|
|
11998
12279
|
// src/mcp/tools.ts
|
|
11999
|
-
var
|
|
12280
|
+
var import_mini49 = require("zod/mini");
|
|
12000
12281
|
|
|
12001
12282
|
// src/mcp/commands.ts
|
|
12002
|
-
var
|
|
12003
|
-
var
|
|
12283
|
+
var import_node_path96 = require("path");
|
|
12284
|
+
var import_mini43 = require("zod/mini");
|
|
12004
12285
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
12005
12286
|
var maxCommandsCount = 1e3;
|
|
12006
12287
|
async function listCommands() {
|
|
12007
|
-
const commandsDir = (0,
|
|
12288
|
+
const commandsDir = (0, import_node_path96.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12008
12289
|
try {
|
|
12009
12290
|
const files = await listDirectoryFiles(commandsDir);
|
|
12010
12291
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12016,7 +12297,7 @@ async function listCommands() {
|
|
|
12016
12297
|
});
|
|
12017
12298
|
const frontmatter = command.getFrontmatter();
|
|
12018
12299
|
return {
|
|
12019
|
-
relativePathFromCwd: (0,
|
|
12300
|
+
relativePathFromCwd: (0, import_node_path96.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
12020
12301
|
frontmatter
|
|
12021
12302
|
};
|
|
12022
12303
|
} catch (error) {
|
|
@@ -12036,13 +12317,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
12036
12317
|
relativePath: relativePathFromCwd,
|
|
12037
12318
|
intendedRootDir: process.cwd()
|
|
12038
12319
|
});
|
|
12039
|
-
const filename = (0,
|
|
12320
|
+
const filename = (0, import_node_path96.basename)(relativePathFromCwd);
|
|
12040
12321
|
try {
|
|
12041
12322
|
const command = await RulesyncCommand.fromFile({
|
|
12042
12323
|
relativeFilePath: filename
|
|
12043
12324
|
});
|
|
12044
12325
|
return {
|
|
12045
|
-
relativePathFromCwd: (0,
|
|
12326
|
+
relativePathFromCwd: (0, import_node_path96.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12046
12327
|
frontmatter: command.getFrontmatter(),
|
|
12047
12328
|
body: command.getBody()
|
|
12048
12329
|
};
|
|
@@ -12061,7 +12342,7 @@ async function putCommand({
|
|
|
12061
12342
|
relativePath: relativePathFromCwd,
|
|
12062
12343
|
intendedRootDir: process.cwd()
|
|
12063
12344
|
});
|
|
12064
|
-
const filename = (0,
|
|
12345
|
+
const filename = (0, import_node_path96.basename)(relativePathFromCwd);
|
|
12065
12346
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12066
12347
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
12067
12348
|
throw new Error(
|
|
@@ -12071,7 +12352,7 @@ async function putCommand({
|
|
|
12071
12352
|
try {
|
|
12072
12353
|
const existingCommands = await listCommands();
|
|
12073
12354
|
const isUpdate = existingCommands.some(
|
|
12074
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
12355
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path96.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12075
12356
|
);
|
|
12076
12357
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
12077
12358
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -12086,11 +12367,11 @@ async function putCommand({
|
|
|
12086
12367
|
fileContent,
|
|
12087
12368
|
validate: true
|
|
12088
12369
|
});
|
|
12089
|
-
const commandsDir = (0,
|
|
12370
|
+
const commandsDir = (0, import_node_path96.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12090
12371
|
await ensureDir(commandsDir);
|
|
12091
12372
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
12092
12373
|
return {
|
|
12093
|
-
relativePathFromCwd: (0,
|
|
12374
|
+
relativePathFromCwd: (0, import_node_path96.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12094
12375
|
frontmatter: command.getFrontmatter(),
|
|
12095
12376
|
body: command.getBody()
|
|
12096
12377
|
};
|
|
@@ -12105,12 +12386,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12105
12386
|
relativePath: relativePathFromCwd,
|
|
12106
12387
|
intendedRootDir: process.cwd()
|
|
12107
12388
|
});
|
|
12108
|
-
const filename = (0,
|
|
12109
|
-
const fullPath = (0,
|
|
12389
|
+
const filename = (0, import_node_path96.basename)(relativePathFromCwd);
|
|
12390
|
+
const fullPath = (0, import_node_path96.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
12110
12391
|
try {
|
|
12111
12392
|
await removeFile(fullPath);
|
|
12112
12393
|
return {
|
|
12113
|
-
relativePathFromCwd: (0,
|
|
12394
|
+
relativePathFromCwd: (0, import_node_path96.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12114
12395
|
};
|
|
12115
12396
|
} catch (error) {
|
|
12116
12397
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12119,23 +12400,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12119
12400
|
}
|
|
12120
12401
|
}
|
|
12121
12402
|
var commandToolSchemas = {
|
|
12122
|
-
listCommands:
|
|
12123
|
-
getCommand:
|
|
12124
|
-
relativePathFromCwd:
|
|
12403
|
+
listCommands: import_mini43.z.object({}),
|
|
12404
|
+
getCommand: import_mini43.z.object({
|
|
12405
|
+
relativePathFromCwd: import_mini43.z.string()
|
|
12125
12406
|
}),
|
|
12126
|
-
putCommand:
|
|
12127
|
-
relativePathFromCwd:
|
|
12407
|
+
putCommand: import_mini43.z.object({
|
|
12408
|
+
relativePathFromCwd: import_mini43.z.string(),
|
|
12128
12409
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
12129
|
-
body:
|
|
12410
|
+
body: import_mini43.z.string()
|
|
12130
12411
|
}),
|
|
12131
|
-
deleteCommand:
|
|
12132
|
-
relativePathFromCwd:
|
|
12412
|
+
deleteCommand: import_mini43.z.object({
|
|
12413
|
+
relativePathFromCwd: import_mini43.z.string()
|
|
12133
12414
|
})
|
|
12134
12415
|
};
|
|
12135
12416
|
var commandTools = {
|
|
12136
12417
|
listCommands: {
|
|
12137
12418
|
name: "listCommands",
|
|
12138
|
-
description: `List all commands from ${(0,
|
|
12419
|
+
description: `List all commands from ${(0, import_node_path96.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12139
12420
|
parameters: commandToolSchemas.listCommands,
|
|
12140
12421
|
execute: async () => {
|
|
12141
12422
|
const commands = await listCommands();
|
|
@@ -12177,11 +12458,11 @@ var commandTools = {
|
|
|
12177
12458
|
};
|
|
12178
12459
|
|
|
12179
12460
|
// src/mcp/ignore.ts
|
|
12180
|
-
var
|
|
12181
|
-
var
|
|
12461
|
+
var import_node_path97 = require("path");
|
|
12462
|
+
var import_mini44 = require("zod/mini");
|
|
12182
12463
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
12183
12464
|
async function getIgnoreFile() {
|
|
12184
|
-
const ignoreFilePath = (0,
|
|
12465
|
+
const ignoreFilePath = (0, import_node_path97.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12185
12466
|
try {
|
|
12186
12467
|
const content = await readFileContent(ignoreFilePath);
|
|
12187
12468
|
return {
|
|
@@ -12195,7 +12476,7 @@ async function getIgnoreFile() {
|
|
|
12195
12476
|
}
|
|
12196
12477
|
}
|
|
12197
12478
|
async function putIgnoreFile({ content }) {
|
|
12198
|
-
const ignoreFilePath = (0,
|
|
12479
|
+
const ignoreFilePath = (0, import_node_path97.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12199
12480
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
12200
12481
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
12201
12482
|
throw new Error(
|
|
@@ -12216,8 +12497,8 @@ async function putIgnoreFile({ content }) {
|
|
|
12216
12497
|
}
|
|
12217
12498
|
}
|
|
12218
12499
|
async function deleteIgnoreFile() {
|
|
12219
|
-
const aiignorePath = (0,
|
|
12220
|
-
const legacyIgnorePath = (0,
|
|
12500
|
+
const aiignorePath = (0, import_node_path97.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12501
|
+
const legacyIgnorePath = (0, import_node_path97.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
12221
12502
|
try {
|
|
12222
12503
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
12223
12504
|
return {
|
|
@@ -12235,11 +12516,11 @@ async function deleteIgnoreFile() {
|
|
|
12235
12516
|
}
|
|
12236
12517
|
}
|
|
12237
12518
|
var ignoreToolSchemas = {
|
|
12238
|
-
getIgnoreFile:
|
|
12239
|
-
putIgnoreFile:
|
|
12240
|
-
content:
|
|
12519
|
+
getIgnoreFile: import_mini44.z.object({}),
|
|
12520
|
+
putIgnoreFile: import_mini44.z.object({
|
|
12521
|
+
content: import_mini44.z.string()
|
|
12241
12522
|
}),
|
|
12242
|
-
deleteIgnoreFile:
|
|
12523
|
+
deleteIgnoreFile: import_mini44.z.object({})
|
|
12243
12524
|
};
|
|
12244
12525
|
var ignoreTools = {
|
|
12245
12526
|
getIgnoreFile: {
|
|
@@ -12272,8 +12553,8 @@ var ignoreTools = {
|
|
|
12272
12553
|
};
|
|
12273
12554
|
|
|
12274
12555
|
// src/mcp/mcp.ts
|
|
12275
|
-
var
|
|
12276
|
-
var
|
|
12556
|
+
var import_node_path98 = require("path");
|
|
12557
|
+
var import_mini45 = require("zod/mini");
|
|
12277
12558
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
12278
12559
|
async function getMcpFile() {
|
|
12279
12560
|
const config = await ConfigResolver.resolve({});
|
|
@@ -12282,7 +12563,7 @@ async function getMcpFile() {
|
|
|
12282
12563
|
validate: true,
|
|
12283
12564
|
modularMcp: config.getModularMcp()
|
|
12284
12565
|
});
|
|
12285
|
-
const relativePathFromCwd = (0,
|
|
12566
|
+
const relativePathFromCwd = (0, import_node_path98.join)(
|
|
12286
12567
|
rulesyncMcp.getRelativeDirPath(),
|
|
12287
12568
|
rulesyncMcp.getRelativeFilePath()
|
|
12288
12569
|
);
|
|
@@ -12315,7 +12596,7 @@ async function putMcpFile({ content }) {
|
|
|
12315
12596
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12316
12597
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
12317
12598
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
12318
|
-
const fullPath = (0,
|
|
12599
|
+
const fullPath = (0, import_node_path98.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
12319
12600
|
const rulesyncMcp = new RulesyncMcp({
|
|
12320
12601
|
baseDir,
|
|
12321
12602
|
relativeDirPath,
|
|
@@ -12324,9 +12605,9 @@ async function putMcpFile({ content }) {
|
|
|
12324
12605
|
validate: true,
|
|
12325
12606
|
modularMcp: config.getModularMcp()
|
|
12326
12607
|
});
|
|
12327
|
-
await ensureDir((0,
|
|
12608
|
+
await ensureDir((0, import_node_path98.join)(baseDir, relativeDirPath));
|
|
12328
12609
|
await writeFileContent(fullPath, content);
|
|
12329
|
-
const relativePathFromCwd = (0,
|
|
12610
|
+
const relativePathFromCwd = (0, import_node_path98.join)(relativeDirPath, relativeFilePath);
|
|
12330
12611
|
return {
|
|
12331
12612
|
relativePathFromCwd,
|
|
12332
12613
|
content: rulesyncMcp.getFileContent()
|
|
@@ -12341,15 +12622,15 @@ async function deleteMcpFile() {
|
|
|
12341
12622
|
try {
|
|
12342
12623
|
const baseDir = process.cwd();
|
|
12343
12624
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12344
|
-
const recommendedPath = (0,
|
|
12625
|
+
const recommendedPath = (0, import_node_path98.join)(
|
|
12345
12626
|
baseDir,
|
|
12346
12627
|
paths.recommended.relativeDirPath,
|
|
12347
12628
|
paths.recommended.relativeFilePath
|
|
12348
12629
|
);
|
|
12349
|
-
const legacyPath = (0,
|
|
12630
|
+
const legacyPath = (0, import_node_path98.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
12350
12631
|
await removeFile(recommendedPath);
|
|
12351
12632
|
await removeFile(legacyPath);
|
|
12352
|
-
const relativePathFromCwd = (0,
|
|
12633
|
+
const relativePathFromCwd = (0, import_node_path98.join)(
|
|
12353
12634
|
paths.recommended.relativeDirPath,
|
|
12354
12635
|
paths.recommended.relativeFilePath
|
|
12355
12636
|
);
|
|
@@ -12363,11 +12644,11 @@ async function deleteMcpFile() {
|
|
|
12363
12644
|
}
|
|
12364
12645
|
}
|
|
12365
12646
|
var mcpToolSchemas = {
|
|
12366
|
-
getMcpFile:
|
|
12367
|
-
putMcpFile:
|
|
12368
|
-
content:
|
|
12647
|
+
getMcpFile: import_mini45.z.object({}),
|
|
12648
|
+
putMcpFile: import_mini45.z.object({
|
|
12649
|
+
content: import_mini45.z.string()
|
|
12369
12650
|
}),
|
|
12370
|
-
deleteMcpFile:
|
|
12651
|
+
deleteMcpFile: import_mini45.z.object({})
|
|
12371
12652
|
};
|
|
12372
12653
|
var mcpTools = {
|
|
12373
12654
|
getMcpFile: {
|
|
@@ -12400,12 +12681,12 @@ var mcpTools = {
|
|
|
12400
12681
|
};
|
|
12401
12682
|
|
|
12402
12683
|
// src/mcp/rules.ts
|
|
12403
|
-
var
|
|
12404
|
-
var
|
|
12684
|
+
var import_node_path99 = require("path");
|
|
12685
|
+
var import_mini46 = require("zod/mini");
|
|
12405
12686
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
12406
12687
|
var maxRulesCount = 1e3;
|
|
12407
12688
|
async function listRules() {
|
|
12408
|
-
const rulesDir = (0,
|
|
12689
|
+
const rulesDir = (0, import_node_path99.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12409
12690
|
try {
|
|
12410
12691
|
const files = await listDirectoryFiles(rulesDir);
|
|
12411
12692
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12418,7 +12699,7 @@ async function listRules() {
|
|
|
12418
12699
|
});
|
|
12419
12700
|
const frontmatter = rule.getFrontmatter();
|
|
12420
12701
|
return {
|
|
12421
|
-
relativePathFromCwd: (0,
|
|
12702
|
+
relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
12422
12703
|
frontmatter
|
|
12423
12704
|
};
|
|
12424
12705
|
} catch (error) {
|
|
@@ -12438,14 +12719,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
12438
12719
|
relativePath: relativePathFromCwd,
|
|
12439
12720
|
intendedRootDir: process.cwd()
|
|
12440
12721
|
});
|
|
12441
|
-
const filename = (0,
|
|
12722
|
+
const filename = (0, import_node_path99.basename)(relativePathFromCwd);
|
|
12442
12723
|
try {
|
|
12443
12724
|
const rule = await RulesyncRule.fromFile({
|
|
12444
12725
|
relativeFilePath: filename,
|
|
12445
12726
|
validate: true
|
|
12446
12727
|
});
|
|
12447
12728
|
return {
|
|
12448
|
-
relativePathFromCwd: (0,
|
|
12729
|
+
relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12449
12730
|
frontmatter: rule.getFrontmatter(),
|
|
12450
12731
|
body: rule.getBody()
|
|
12451
12732
|
};
|
|
@@ -12464,7 +12745,7 @@ async function putRule({
|
|
|
12464
12745
|
relativePath: relativePathFromCwd,
|
|
12465
12746
|
intendedRootDir: process.cwd()
|
|
12466
12747
|
});
|
|
12467
|
-
const filename = (0,
|
|
12748
|
+
const filename = (0, import_node_path99.basename)(relativePathFromCwd);
|
|
12468
12749
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12469
12750
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
12470
12751
|
throw new Error(
|
|
@@ -12474,7 +12755,7 @@ async function putRule({
|
|
|
12474
12755
|
try {
|
|
12475
12756
|
const existingRules = await listRules();
|
|
12476
12757
|
const isUpdate = existingRules.some(
|
|
12477
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
12758
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path99.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12478
12759
|
);
|
|
12479
12760
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
12480
12761
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -12487,11 +12768,11 @@ async function putRule({
|
|
|
12487
12768
|
body,
|
|
12488
12769
|
validate: true
|
|
12489
12770
|
});
|
|
12490
|
-
const rulesDir = (0,
|
|
12771
|
+
const rulesDir = (0, import_node_path99.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12491
12772
|
await ensureDir(rulesDir);
|
|
12492
12773
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
12493
12774
|
return {
|
|
12494
|
-
relativePathFromCwd: (0,
|
|
12775
|
+
relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12495
12776
|
frontmatter: rule.getFrontmatter(),
|
|
12496
12777
|
body: rule.getBody()
|
|
12497
12778
|
};
|
|
@@ -12506,12 +12787,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
12506
12787
|
relativePath: relativePathFromCwd,
|
|
12507
12788
|
intendedRootDir: process.cwd()
|
|
12508
12789
|
});
|
|
12509
|
-
const filename = (0,
|
|
12510
|
-
const fullPath = (0,
|
|
12790
|
+
const filename = (0, import_node_path99.basename)(relativePathFromCwd);
|
|
12791
|
+
const fullPath = (0, import_node_path99.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
12511
12792
|
try {
|
|
12512
12793
|
await removeFile(fullPath);
|
|
12513
12794
|
return {
|
|
12514
|
-
relativePathFromCwd: (0,
|
|
12795
|
+
relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12515
12796
|
};
|
|
12516
12797
|
} catch (error) {
|
|
12517
12798
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12520,23 +12801,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
12520
12801
|
}
|
|
12521
12802
|
}
|
|
12522
12803
|
var ruleToolSchemas = {
|
|
12523
|
-
listRules:
|
|
12524
|
-
getRule:
|
|
12525
|
-
relativePathFromCwd:
|
|
12804
|
+
listRules: import_mini46.z.object({}),
|
|
12805
|
+
getRule: import_mini46.z.object({
|
|
12806
|
+
relativePathFromCwd: import_mini46.z.string()
|
|
12526
12807
|
}),
|
|
12527
|
-
putRule:
|
|
12528
|
-
relativePathFromCwd:
|
|
12808
|
+
putRule: import_mini46.z.object({
|
|
12809
|
+
relativePathFromCwd: import_mini46.z.string(),
|
|
12529
12810
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
12530
|
-
body:
|
|
12811
|
+
body: import_mini46.z.string()
|
|
12531
12812
|
}),
|
|
12532
|
-
deleteRule:
|
|
12533
|
-
relativePathFromCwd:
|
|
12813
|
+
deleteRule: import_mini46.z.object({
|
|
12814
|
+
relativePathFromCwd: import_mini46.z.string()
|
|
12534
12815
|
})
|
|
12535
12816
|
};
|
|
12536
12817
|
var ruleTools = {
|
|
12537
12818
|
listRules: {
|
|
12538
12819
|
name: "listRules",
|
|
12539
|
-
description: `List all rules from ${(0,
|
|
12820
|
+
description: `List all rules from ${(0, import_node_path99.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12540
12821
|
parameters: ruleToolSchemas.listRules,
|
|
12541
12822
|
execute: async () => {
|
|
12542
12823
|
const rules = await listRules();
|
|
@@ -12578,8 +12859,8 @@ var ruleTools = {
|
|
|
12578
12859
|
};
|
|
12579
12860
|
|
|
12580
12861
|
// src/mcp/skills.ts
|
|
12581
|
-
var
|
|
12582
|
-
var
|
|
12862
|
+
var import_node_path100 = require("path");
|
|
12863
|
+
var import_mini47 = require("zod/mini");
|
|
12583
12864
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
12584
12865
|
var maxSkillsCount = 1e3;
|
|
12585
12866
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -12595,19 +12876,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
12595
12876
|
};
|
|
12596
12877
|
}
|
|
12597
12878
|
function extractDirName(relativeDirPathFromCwd) {
|
|
12598
|
-
const dirName = (0,
|
|
12879
|
+
const dirName = (0, import_node_path100.basename)(relativeDirPathFromCwd);
|
|
12599
12880
|
if (!dirName) {
|
|
12600
12881
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
12601
12882
|
}
|
|
12602
12883
|
return dirName;
|
|
12603
12884
|
}
|
|
12604
12885
|
async function listSkills() {
|
|
12605
|
-
const skillsDir = (0,
|
|
12886
|
+
const skillsDir = (0, import_node_path100.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
12606
12887
|
try {
|
|
12607
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
12888
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path100.join)(skillsDir, "*"), { type: "dir" });
|
|
12608
12889
|
const skills = await Promise.all(
|
|
12609
12890
|
skillDirPaths.map(async (dirPath) => {
|
|
12610
|
-
const dirName = (0,
|
|
12891
|
+
const dirName = (0, import_node_path100.basename)(dirPath);
|
|
12611
12892
|
if (!dirName) return null;
|
|
12612
12893
|
try {
|
|
12613
12894
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -12615,7 +12896,7 @@ async function listSkills() {
|
|
|
12615
12896
|
});
|
|
12616
12897
|
const frontmatter = skill.getFrontmatter();
|
|
12617
12898
|
return {
|
|
12618
|
-
relativeDirPathFromCwd: (0,
|
|
12899
|
+
relativeDirPathFromCwd: (0, import_node_path100.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12619
12900
|
frontmatter
|
|
12620
12901
|
};
|
|
12621
12902
|
} catch (error) {
|
|
@@ -12641,7 +12922,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
12641
12922
|
dirName
|
|
12642
12923
|
});
|
|
12643
12924
|
return {
|
|
12644
|
-
relativeDirPathFromCwd: (0,
|
|
12925
|
+
relativeDirPathFromCwd: (0, import_node_path100.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12645
12926
|
frontmatter: skill.getFrontmatter(),
|
|
12646
12927
|
body: skill.getBody(),
|
|
12647
12928
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12675,7 +12956,7 @@ async function putSkill({
|
|
|
12675
12956
|
try {
|
|
12676
12957
|
const existingSkills = await listSkills();
|
|
12677
12958
|
const isUpdate = existingSkills.some(
|
|
12678
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
12959
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path100.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12679
12960
|
);
|
|
12680
12961
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
12681
12962
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -12690,9 +12971,9 @@ async function putSkill({
|
|
|
12690
12971
|
otherFiles: aiDirFiles,
|
|
12691
12972
|
validate: true
|
|
12692
12973
|
});
|
|
12693
|
-
const skillDirPath = (0,
|
|
12974
|
+
const skillDirPath = (0, import_node_path100.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12694
12975
|
await ensureDir(skillDirPath);
|
|
12695
|
-
const skillFilePath = (0,
|
|
12976
|
+
const skillFilePath = (0, import_node_path100.join)(skillDirPath, SKILL_FILE_NAME);
|
|
12696
12977
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
12697
12978
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
12698
12979
|
for (const file of otherFiles) {
|
|
@@ -12700,15 +12981,15 @@ async function putSkill({
|
|
|
12700
12981
|
relativePath: file.name,
|
|
12701
12982
|
intendedRootDir: skillDirPath
|
|
12702
12983
|
});
|
|
12703
|
-
const filePath = (0,
|
|
12704
|
-
const fileDir = (0,
|
|
12984
|
+
const filePath = (0, import_node_path100.join)(skillDirPath, file.name);
|
|
12985
|
+
const fileDir = (0, import_node_path100.join)(skillDirPath, (0, import_node_path100.dirname)(file.name));
|
|
12705
12986
|
if (fileDir !== skillDirPath) {
|
|
12706
12987
|
await ensureDir(fileDir);
|
|
12707
12988
|
}
|
|
12708
12989
|
await writeFileContent(filePath, file.body);
|
|
12709
12990
|
}
|
|
12710
12991
|
return {
|
|
12711
|
-
relativeDirPathFromCwd: (0,
|
|
12992
|
+
relativeDirPathFromCwd: (0, import_node_path100.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12712
12993
|
frontmatter: skill.getFrontmatter(),
|
|
12713
12994
|
body: skill.getBody(),
|
|
12714
12995
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12730,13 +13011,13 @@ async function deleteSkill({
|
|
|
12730
13011
|
intendedRootDir: process.cwd()
|
|
12731
13012
|
});
|
|
12732
13013
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
12733
|
-
const skillDirPath = (0,
|
|
13014
|
+
const skillDirPath = (0, import_node_path100.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12734
13015
|
try {
|
|
12735
13016
|
if (await directoryExists(skillDirPath)) {
|
|
12736
13017
|
await removeDirectory(skillDirPath);
|
|
12737
13018
|
}
|
|
12738
13019
|
return {
|
|
12739
|
-
relativeDirPathFromCwd: (0,
|
|
13020
|
+
relativeDirPathFromCwd: (0, import_node_path100.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12740
13021
|
};
|
|
12741
13022
|
} catch (error) {
|
|
12742
13023
|
throw new Error(
|
|
@@ -12747,29 +13028,29 @@ async function deleteSkill({
|
|
|
12747
13028
|
);
|
|
12748
13029
|
}
|
|
12749
13030
|
}
|
|
12750
|
-
var McpSkillFileSchema =
|
|
12751
|
-
name:
|
|
12752
|
-
body:
|
|
13031
|
+
var McpSkillFileSchema = import_mini47.z.object({
|
|
13032
|
+
name: import_mini47.z.string(),
|
|
13033
|
+
body: import_mini47.z.string()
|
|
12753
13034
|
});
|
|
12754
13035
|
var skillToolSchemas = {
|
|
12755
|
-
listSkills:
|
|
12756
|
-
getSkill:
|
|
12757
|
-
relativeDirPathFromCwd:
|
|
13036
|
+
listSkills: import_mini47.z.object({}),
|
|
13037
|
+
getSkill: import_mini47.z.object({
|
|
13038
|
+
relativeDirPathFromCwd: import_mini47.z.string()
|
|
12758
13039
|
}),
|
|
12759
|
-
putSkill:
|
|
12760
|
-
relativeDirPathFromCwd:
|
|
13040
|
+
putSkill: import_mini47.z.object({
|
|
13041
|
+
relativeDirPathFromCwd: import_mini47.z.string(),
|
|
12761
13042
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
12762
|
-
body:
|
|
12763
|
-
otherFiles:
|
|
13043
|
+
body: import_mini47.z.string(),
|
|
13044
|
+
otherFiles: import_mini47.z.optional(import_mini47.z.array(McpSkillFileSchema))
|
|
12764
13045
|
}),
|
|
12765
|
-
deleteSkill:
|
|
12766
|
-
relativeDirPathFromCwd:
|
|
13046
|
+
deleteSkill: import_mini47.z.object({
|
|
13047
|
+
relativeDirPathFromCwd: import_mini47.z.string()
|
|
12767
13048
|
})
|
|
12768
13049
|
};
|
|
12769
13050
|
var skillTools = {
|
|
12770
13051
|
listSkills: {
|
|
12771
13052
|
name: "listSkills",
|
|
12772
|
-
description: `List all skills from ${(0,
|
|
13053
|
+
description: `List all skills from ${(0, import_node_path100.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
12773
13054
|
parameters: skillToolSchemas.listSkills,
|
|
12774
13055
|
execute: async () => {
|
|
12775
13056
|
const skills = await listSkills();
|
|
@@ -12812,12 +13093,12 @@ var skillTools = {
|
|
|
12812
13093
|
};
|
|
12813
13094
|
|
|
12814
13095
|
// src/mcp/subagents.ts
|
|
12815
|
-
var
|
|
12816
|
-
var
|
|
13096
|
+
var import_node_path101 = require("path");
|
|
13097
|
+
var import_mini48 = require("zod/mini");
|
|
12817
13098
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
12818
13099
|
var maxSubagentsCount = 1e3;
|
|
12819
13100
|
async function listSubagents() {
|
|
12820
|
-
const subagentsDir = (0,
|
|
13101
|
+
const subagentsDir = (0, import_node_path101.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12821
13102
|
try {
|
|
12822
13103
|
const files = await listDirectoryFiles(subagentsDir);
|
|
12823
13104
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12830,7 +13111,7 @@ async function listSubagents() {
|
|
|
12830
13111
|
});
|
|
12831
13112
|
const frontmatter = subagent.getFrontmatter();
|
|
12832
13113
|
return {
|
|
12833
|
-
relativePathFromCwd: (0,
|
|
13114
|
+
relativePathFromCwd: (0, import_node_path101.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
12834
13115
|
frontmatter
|
|
12835
13116
|
};
|
|
12836
13117
|
} catch (error) {
|
|
@@ -12852,14 +13133,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
12852
13133
|
relativePath: relativePathFromCwd,
|
|
12853
13134
|
intendedRootDir: process.cwd()
|
|
12854
13135
|
});
|
|
12855
|
-
const filename = (0,
|
|
13136
|
+
const filename = (0, import_node_path101.basename)(relativePathFromCwd);
|
|
12856
13137
|
try {
|
|
12857
13138
|
const subagent = await RulesyncSubagent.fromFile({
|
|
12858
13139
|
relativeFilePath: filename,
|
|
12859
13140
|
validate: true
|
|
12860
13141
|
});
|
|
12861
13142
|
return {
|
|
12862
|
-
relativePathFromCwd: (0,
|
|
13143
|
+
relativePathFromCwd: (0, import_node_path101.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12863
13144
|
frontmatter: subagent.getFrontmatter(),
|
|
12864
13145
|
body: subagent.getBody()
|
|
12865
13146
|
};
|
|
@@ -12878,7 +13159,7 @@ async function putSubagent({
|
|
|
12878
13159
|
relativePath: relativePathFromCwd,
|
|
12879
13160
|
intendedRootDir: process.cwd()
|
|
12880
13161
|
});
|
|
12881
|
-
const filename = (0,
|
|
13162
|
+
const filename = (0, import_node_path101.basename)(relativePathFromCwd);
|
|
12882
13163
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12883
13164
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
12884
13165
|
throw new Error(
|
|
@@ -12888,7 +13169,7 @@ async function putSubagent({
|
|
|
12888
13169
|
try {
|
|
12889
13170
|
const existingSubagents = await listSubagents();
|
|
12890
13171
|
const isUpdate = existingSubagents.some(
|
|
12891
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
13172
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path101.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12892
13173
|
);
|
|
12893
13174
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
12894
13175
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -12901,11 +13182,11 @@ async function putSubagent({
|
|
|
12901
13182
|
body,
|
|
12902
13183
|
validate: true
|
|
12903
13184
|
});
|
|
12904
|
-
const subagentsDir = (0,
|
|
13185
|
+
const subagentsDir = (0, import_node_path101.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12905
13186
|
await ensureDir(subagentsDir);
|
|
12906
13187
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
12907
13188
|
return {
|
|
12908
|
-
relativePathFromCwd: (0,
|
|
13189
|
+
relativePathFromCwd: (0, import_node_path101.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12909
13190
|
frontmatter: subagent.getFrontmatter(),
|
|
12910
13191
|
body: subagent.getBody()
|
|
12911
13192
|
};
|
|
@@ -12920,12 +13201,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12920
13201
|
relativePath: relativePathFromCwd,
|
|
12921
13202
|
intendedRootDir: process.cwd()
|
|
12922
13203
|
});
|
|
12923
|
-
const filename = (0,
|
|
12924
|
-
const fullPath = (0,
|
|
13204
|
+
const filename = (0, import_node_path101.basename)(relativePathFromCwd);
|
|
13205
|
+
const fullPath = (0, import_node_path101.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
12925
13206
|
try {
|
|
12926
13207
|
await removeFile(fullPath);
|
|
12927
13208
|
return {
|
|
12928
|
-
relativePathFromCwd: (0,
|
|
13209
|
+
relativePathFromCwd: (0, import_node_path101.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12929
13210
|
};
|
|
12930
13211
|
} catch (error) {
|
|
12931
13212
|
throw new Error(
|
|
@@ -12937,23 +13218,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12937
13218
|
}
|
|
12938
13219
|
}
|
|
12939
13220
|
var subagentToolSchemas = {
|
|
12940
|
-
listSubagents:
|
|
12941
|
-
getSubagent:
|
|
12942
|
-
relativePathFromCwd:
|
|
13221
|
+
listSubagents: import_mini48.z.object({}),
|
|
13222
|
+
getSubagent: import_mini48.z.object({
|
|
13223
|
+
relativePathFromCwd: import_mini48.z.string()
|
|
12943
13224
|
}),
|
|
12944
|
-
putSubagent:
|
|
12945
|
-
relativePathFromCwd:
|
|
13225
|
+
putSubagent: import_mini48.z.object({
|
|
13226
|
+
relativePathFromCwd: import_mini48.z.string(),
|
|
12946
13227
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
12947
|
-
body:
|
|
13228
|
+
body: import_mini48.z.string()
|
|
12948
13229
|
}),
|
|
12949
|
-
deleteSubagent:
|
|
12950
|
-
relativePathFromCwd:
|
|
13230
|
+
deleteSubagent: import_mini48.z.object({
|
|
13231
|
+
relativePathFromCwd: import_mini48.z.string()
|
|
12951
13232
|
})
|
|
12952
13233
|
};
|
|
12953
13234
|
var subagentTools = {
|
|
12954
13235
|
listSubagents: {
|
|
12955
13236
|
name: "listSubagents",
|
|
12956
|
-
description: `List all subagents from ${(0,
|
|
13237
|
+
description: `List all subagents from ${(0, import_node_path101.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12957
13238
|
parameters: subagentToolSchemas.listSubagents,
|
|
12958
13239
|
execute: async () => {
|
|
12959
13240
|
const subagents = await listSubagents();
|
|
@@ -12995,20 +13276,20 @@ var subagentTools = {
|
|
|
12995
13276
|
};
|
|
12996
13277
|
|
|
12997
13278
|
// src/mcp/tools.ts
|
|
12998
|
-
var rulesyncFeatureSchema =
|
|
12999
|
-
var rulesyncOperationSchema =
|
|
13000
|
-
var skillFileSchema =
|
|
13001
|
-
name:
|
|
13002
|
-
body:
|
|
13279
|
+
var rulesyncFeatureSchema = import_mini49.z.enum(["rule", "command", "subagent", "skill", "ignore", "mcp"]);
|
|
13280
|
+
var rulesyncOperationSchema = import_mini49.z.enum(["list", "get", "put", "delete"]);
|
|
13281
|
+
var skillFileSchema = import_mini49.z.object({
|
|
13282
|
+
name: import_mini49.z.string(),
|
|
13283
|
+
body: import_mini49.z.string()
|
|
13003
13284
|
});
|
|
13004
|
-
var rulesyncToolSchema =
|
|
13285
|
+
var rulesyncToolSchema = import_mini49.z.object({
|
|
13005
13286
|
feature: rulesyncFeatureSchema,
|
|
13006
13287
|
operation: rulesyncOperationSchema,
|
|
13007
|
-
targetPathFromCwd:
|
|
13008
|
-
frontmatter:
|
|
13009
|
-
body:
|
|
13010
|
-
otherFiles:
|
|
13011
|
-
content:
|
|
13288
|
+
targetPathFromCwd: import_mini49.z.optional(import_mini49.z.string()),
|
|
13289
|
+
frontmatter: import_mini49.z.optional(import_mini49.z.unknown()),
|
|
13290
|
+
body: import_mini49.z.optional(import_mini49.z.string()),
|
|
13291
|
+
otherFiles: import_mini49.z.optional(import_mini49.z.array(skillFileSchema)),
|
|
13292
|
+
content: import_mini49.z.optional(import_mini49.z.string())
|
|
13012
13293
|
});
|
|
13013
13294
|
var supportedOperationsByFeature = {
|
|
13014
13295
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -13204,7 +13485,7 @@ async function mcpCommand({ version }) {
|
|
|
13204
13485
|
}
|
|
13205
13486
|
|
|
13206
13487
|
// src/cli/index.ts
|
|
13207
|
-
var getVersion = () => "5.
|
|
13488
|
+
var getVersion = () => "5.4.0";
|
|
13208
13489
|
var main = async () => {
|
|
13209
13490
|
const program = new import_commander.Command();
|
|
13210
13491
|
const version = getVersion();
|