rulesync 5.2.2 → 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 +18 -20
- package/dist/index.cjs +799 -495
- package/dist/index.js +762 -458
- 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(),
|
|
@@ -5559,6 +5643,11 @@ var RulesyncSkillFrontmatterSchemaInternal = import_mini20.z.looseObject({
|
|
|
5559
5643
|
"allowed-tools": import_mini20.z.optional(import_mini20.z.array(import_mini20.z.string()))
|
|
5560
5644
|
})
|
|
5561
5645
|
),
|
|
5646
|
+
codexcli: import_mini20.z.optional(
|
|
5647
|
+
import_mini20.z.looseObject({
|
|
5648
|
+
"short-description": import_mini20.z.optional(import_mini20.z.string())
|
|
5649
|
+
})
|
|
5650
|
+
),
|
|
5562
5651
|
opencode: import_mini20.z.optional(
|
|
5563
5652
|
import_mini20.z.looseObject({
|
|
5564
5653
|
"allowed-tools": import_mini20.z.optional(import_mini20.z.array(import_mini20.z.string()))
|
|
@@ -5635,8 +5724,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5635
5724
|
dirName,
|
|
5636
5725
|
global = false
|
|
5637
5726
|
}) {
|
|
5638
|
-
const skillDirPath = (0,
|
|
5639
|
-
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);
|
|
5640
5729
|
if (!await fileExists(skillFilePath)) {
|
|
5641
5730
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5642
5731
|
}
|
|
@@ -5665,16 +5754,179 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5665
5754
|
}
|
|
5666
5755
|
};
|
|
5667
5756
|
|
|
5668
|
-
// src/features/skills/
|
|
5669
|
-
var
|
|
5757
|
+
// src/features/skills/antigravity-skill.ts
|
|
5758
|
+
var AntigravitySkillFrontmatterSchema = import_mini21.z.looseObject({
|
|
5670
5759
|
name: import_mini21.z.string(),
|
|
5671
|
-
description: import_mini21.z.string()
|
|
5672
|
-
|
|
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()))
|
|
5673
5925
|
});
|
|
5674
5926
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
5675
5927
|
constructor({
|
|
5676
5928
|
baseDir = process.cwd(),
|
|
5677
|
-
relativeDirPath = (0,
|
|
5929
|
+
relativeDirPath = (0, import_node_path53.join)(".claude", "skills"),
|
|
5678
5930
|
dirName,
|
|
5679
5931
|
frontmatter,
|
|
5680
5932
|
body,
|
|
@@ -5705,7 +5957,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5705
5957
|
global: _global = false
|
|
5706
5958
|
} = {}) {
|
|
5707
5959
|
return {
|
|
5708
|
-
relativeDirPath: (0,
|
|
5960
|
+
relativeDirPath: (0, import_node_path53.join)(".claude", "skills")
|
|
5709
5961
|
};
|
|
5710
5962
|
}
|
|
5711
5963
|
getFrontmatter() {
|
|
@@ -5793,9 +6045,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5793
6045
|
});
|
|
5794
6046
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5795
6047
|
if (!result.success) {
|
|
5796
|
-
const skillDirPath = (0,
|
|
6048
|
+
const skillDirPath = (0, import_node_path53.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5797
6049
|
throw new Error(
|
|
5798
|
-
`Invalid frontmatter in ${(0,
|
|
6050
|
+
`Invalid frontmatter in ${(0, import_node_path53.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5799
6051
|
);
|
|
5800
6052
|
}
|
|
5801
6053
|
return new _ClaudecodeSkill({
|
|
@@ -5829,16 +6081,21 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5829
6081
|
};
|
|
5830
6082
|
|
|
5831
6083
|
// src/features/skills/codexcli-skill.ts
|
|
5832
|
-
var
|
|
5833
|
-
var
|
|
5834
|
-
var CodexCliSkillFrontmatterSchema =
|
|
5835
|
-
name:
|
|
5836
|
-
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())
|
|
6092
|
+
})
|
|
6093
|
+
)
|
|
5837
6094
|
});
|
|
5838
6095
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
5839
6096
|
constructor({
|
|
5840
6097
|
baseDir = process.cwd(),
|
|
5841
|
-
relativeDirPath = (0,
|
|
6098
|
+
relativeDirPath = (0, import_node_path54.join)(".codex", "skills"),
|
|
5842
6099
|
dirName,
|
|
5843
6100
|
frontmatter,
|
|
5844
6101
|
body,
|
|
@@ -5865,12 +6122,11 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5865
6122
|
}
|
|
5866
6123
|
}
|
|
5867
6124
|
}
|
|
5868
|
-
static getSettablePaths({
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
}
|
|
6125
|
+
static getSettablePaths({
|
|
6126
|
+
global: _global = false
|
|
6127
|
+
} = {}) {
|
|
5872
6128
|
return {
|
|
5873
|
-
relativeDirPath: (0,
|
|
6129
|
+
relativeDirPath: (0, import_node_path54.join)(".codex", "skills")
|
|
5874
6130
|
};
|
|
5875
6131
|
}
|
|
5876
6132
|
getFrontmatter() {
|
|
@@ -5906,7 +6162,12 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5906
6162
|
const rulesyncFrontmatter = {
|
|
5907
6163
|
name: frontmatter.name,
|
|
5908
6164
|
description: frontmatter.description,
|
|
5909
|
-
targets: ["*"]
|
|
6165
|
+
targets: ["*"],
|
|
6166
|
+
...frontmatter.metadata?.["short-description"] && {
|
|
6167
|
+
codexcli: {
|
|
6168
|
+
"short-description": frontmatter.metadata["short-description"]
|
|
6169
|
+
}
|
|
6170
|
+
}
|
|
5910
6171
|
};
|
|
5911
6172
|
return new RulesyncSkill({
|
|
5912
6173
|
baseDir: this.baseDir,
|
|
@@ -5928,7 +6189,12 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5928
6189
|
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
5929
6190
|
const codexFrontmatter = {
|
|
5930
6191
|
name: rulesyncFrontmatter.name,
|
|
5931
|
-
description: rulesyncFrontmatter.description
|
|
6192
|
+
description: rulesyncFrontmatter.description,
|
|
6193
|
+
...rulesyncFrontmatter.codexcli?.["short-description"] && {
|
|
6194
|
+
metadata: {
|
|
6195
|
+
"short-description": rulesyncFrontmatter.codexcli["short-description"]
|
|
6196
|
+
}
|
|
6197
|
+
}
|
|
5932
6198
|
};
|
|
5933
6199
|
return new _CodexCliSkill({
|
|
5934
6200
|
baseDir: rulesyncSkill.getBaseDir(),
|
|
@@ -5952,9 +6218,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5952
6218
|
});
|
|
5953
6219
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5954
6220
|
if (!result.success) {
|
|
5955
|
-
const skillDirPath = (0,
|
|
6221
|
+
const skillDirPath = (0, import_node_path54.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5956
6222
|
throw new Error(
|
|
5957
|
-
`Invalid frontmatter in ${(0,
|
|
6223
|
+
`Invalid frontmatter in ${(0, import_node_path54.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5958
6224
|
);
|
|
5959
6225
|
}
|
|
5960
6226
|
return new _CodexCliSkill({
|
|
@@ -5988,17 +6254,17 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5988
6254
|
};
|
|
5989
6255
|
|
|
5990
6256
|
// src/features/skills/copilot-skill.ts
|
|
5991
|
-
var
|
|
5992
|
-
var
|
|
5993
|
-
var CopilotSkillFrontmatterSchema =
|
|
5994
|
-
name:
|
|
5995
|
-
description:
|
|
5996
|
-
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())
|
|
5997
6263
|
});
|
|
5998
6264
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
5999
6265
|
constructor({
|
|
6000
6266
|
baseDir = process.cwd(),
|
|
6001
|
-
relativeDirPath = (0,
|
|
6267
|
+
relativeDirPath = (0, import_node_path55.join)(".github", "skills"),
|
|
6002
6268
|
dirName,
|
|
6003
6269
|
frontmatter,
|
|
6004
6270
|
body,
|
|
@@ -6030,7 +6296,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6030
6296
|
throw new Error("CopilotSkill does not support global mode.");
|
|
6031
6297
|
}
|
|
6032
6298
|
return {
|
|
6033
|
-
relativeDirPath: (0,
|
|
6299
|
+
relativeDirPath: (0, import_node_path55.join)(".github", "skills")
|
|
6034
6300
|
};
|
|
6035
6301
|
}
|
|
6036
6302
|
getFrontmatter() {
|
|
@@ -6118,9 +6384,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6118
6384
|
});
|
|
6119
6385
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6120
6386
|
if (!result.success) {
|
|
6121
|
-
const skillDirPath = (0,
|
|
6387
|
+
const skillDirPath = (0, import_node_path55.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6122
6388
|
throw new Error(
|
|
6123
|
-
`Invalid frontmatter in ${(0,
|
|
6389
|
+
`Invalid frontmatter in ${(0, import_node_path55.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6124
6390
|
);
|
|
6125
6391
|
}
|
|
6126
6392
|
return new _CopilotSkill({
|
|
@@ -6155,16 +6421,16 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6155
6421
|
};
|
|
6156
6422
|
|
|
6157
6423
|
// src/features/skills/cursor-skill.ts
|
|
6158
|
-
var
|
|
6159
|
-
var
|
|
6160
|
-
var CursorSkillFrontmatterSchema =
|
|
6161
|
-
name:
|
|
6162
|
-
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()
|
|
6163
6429
|
});
|
|
6164
6430
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
6165
6431
|
constructor({
|
|
6166
6432
|
baseDir = process.cwd(),
|
|
6167
|
-
relativeDirPath = (0,
|
|
6433
|
+
relativeDirPath = (0, import_node_path56.join)(".cursor", "skills"),
|
|
6168
6434
|
dirName,
|
|
6169
6435
|
frontmatter,
|
|
6170
6436
|
body,
|
|
@@ -6196,7 +6462,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6196
6462
|
throw new Error("CursorSkill does not support global mode.");
|
|
6197
6463
|
}
|
|
6198
6464
|
return {
|
|
6199
|
-
relativeDirPath: (0,
|
|
6465
|
+
relativeDirPath: (0, import_node_path56.join)(".cursor", "skills")
|
|
6200
6466
|
};
|
|
6201
6467
|
}
|
|
6202
6468
|
getFrontmatter() {
|
|
@@ -6278,9 +6544,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6278
6544
|
});
|
|
6279
6545
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6280
6546
|
if (!result.success) {
|
|
6281
|
-
const skillDirPath = (0,
|
|
6547
|
+
const skillDirPath = (0, import_node_path56.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6282
6548
|
throw new Error(
|
|
6283
|
-
`Invalid frontmatter in ${(0,
|
|
6549
|
+
`Invalid frontmatter in ${(0, import_node_path56.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6284
6550
|
);
|
|
6285
6551
|
}
|
|
6286
6552
|
return new _CursorSkill({
|
|
@@ -6315,16 +6581,16 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6315
6581
|
};
|
|
6316
6582
|
|
|
6317
6583
|
// src/features/skills/kilo-skill.ts
|
|
6318
|
-
var
|
|
6319
|
-
var
|
|
6320
|
-
var KiloSkillFrontmatterSchema =
|
|
6321
|
-
name:
|
|
6322
|
-
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()
|
|
6323
6589
|
});
|
|
6324
6590
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
6325
6591
|
constructor({
|
|
6326
6592
|
baseDir = process.cwd(),
|
|
6327
|
-
relativeDirPath = (0,
|
|
6593
|
+
relativeDirPath = (0, import_node_path57.join)(".kilocode", "skills"),
|
|
6328
6594
|
dirName,
|
|
6329
6595
|
frontmatter,
|
|
6330
6596
|
body,
|
|
@@ -6355,7 +6621,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6355
6621
|
global: _global = false
|
|
6356
6622
|
} = {}) {
|
|
6357
6623
|
return {
|
|
6358
|
-
relativeDirPath: (0,
|
|
6624
|
+
relativeDirPath: (0, import_node_path57.join)(".kilocode", "skills")
|
|
6359
6625
|
};
|
|
6360
6626
|
}
|
|
6361
6627
|
getFrontmatter() {
|
|
@@ -6445,13 +6711,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6445
6711
|
});
|
|
6446
6712
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6447
6713
|
if (!result.success) {
|
|
6448
|
-
const skillDirPath = (0,
|
|
6714
|
+
const skillDirPath = (0, import_node_path57.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6449
6715
|
throw new Error(
|
|
6450
|
-
`Invalid frontmatter in ${(0,
|
|
6716
|
+
`Invalid frontmatter in ${(0, import_node_path57.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6451
6717
|
);
|
|
6452
6718
|
}
|
|
6453
6719
|
if (result.data.name !== loaded.dirName) {
|
|
6454
|
-
const skillFilePath = (0,
|
|
6720
|
+
const skillFilePath = (0, import_node_path57.join)(
|
|
6455
6721
|
loaded.baseDir,
|
|
6456
6722
|
loaded.relativeDirPath,
|
|
6457
6723
|
loaded.dirName,
|
|
@@ -6492,17 +6758,17 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6492
6758
|
};
|
|
6493
6759
|
|
|
6494
6760
|
// src/features/skills/opencode-skill.ts
|
|
6495
|
-
var
|
|
6496
|
-
var
|
|
6497
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
6498
|
-
name:
|
|
6499
|
-
description:
|
|
6500
|
-
"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()))
|
|
6501
6767
|
});
|
|
6502
6768
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
6503
6769
|
constructor({
|
|
6504
6770
|
baseDir = process.cwd(),
|
|
6505
|
-
relativeDirPath = (0,
|
|
6771
|
+
relativeDirPath = (0, import_node_path58.join)(".opencode", "skill"),
|
|
6506
6772
|
dirName,
|
|
6507
6773
|
frontmatter,
|
|
6508
6774
|
body,
|
|
@@ -6531,7 +6797,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6531
6797
|
}
|
|
6532
6798
|
static getSettablePaths({ global = false } = {}) {
|
|
6533
6799
|
return {
|
|
6534
|
-
relativeDirPath: global ? (0,
|
|
6800
|
+
relativeDirPath: global ? (0, import_node_path58.join)(".config", "opencode", "skill") : (0, import_node_path58.join)(".opencode", "skill")
|
|
6535
6801
|
};
|
|
6536
6802
|
}
|
|
6537
6803
|
getFrontmatter() {
|
|
@@ -6619,9 +6885,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6619
6885
|
});
|
|
6620
6886
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6621
6887
|
if (!result.success) {
|
|
6622
|
-
const skillDirPath = (0,
|
|
6888
|
+
const skillDirPath = (0, import_node_path58.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6623
6889
|
throw new Error(
|
|
6624
|
-
`Invalid frontmatter in ${(0,
|
|
6890
|
+
`Invalid frontmatter in ${(0, import_node_path58.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6625
6891
|
);
|
|
6626
6892
|
}
|
|
6627
6893
|
return new _OpenCodeSkill({
|
|
@@ -6655,16 +6921,16 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6655
6921
|
};
|
|
6656
6922
|
|
|
6657
6923
|
// src/features/skills/roo-skill.ts
|
|
6658
|
-
var
|
|
6659
|
-
var
|
|
6660
|
-
var RooSkillFrontmatterSchema =
|
|
6661
|
-
name:
|
|
6662
|
-
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()
|
|
6663
6929
|
});
|
|
6664
6930
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
6665
6931
|
constructor({
|
|
6666
6932
|
baseDir = process.cwd(),
|
|
6667
|
-
relativeDirPath = (0,
|
|
6933
|
+
relativeDirPath = (0, import_node_path59.join)(".roo", "skills"),
|
|
6668
6934
|
dirName,
|
|
6669
6935
|
frontmatter,
|
|
6670
6936
|
body,
|
|
@@ -6695,7 +6961,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6695
6961
|
global: _global = false
|
|
6696
6962
|
} = {}) {
|
|
6697
6963
|
return {
|
|
6698
|
-
relativeDirPath: (0,
|
|
6964
|
+
relativeDirPath: (0, import_node_path59.join)(".roo", "skills")
|
|
6699
6965
|
};
|
|
6700
6966
|
}
|
|
6701
6967
|
getFrontmatter() {
|
|
@@ -6785,13 +7051,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6785
7051
|
});
|
|
6786
7052
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6787
7053
|
if (!result.success) {
|
|
6788
|
-
const skillDirPath = (0,
|
|
7054
|
+
const skillDirPath = (0, import_node_path59.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6789
7055
|
throw new Error(
|
|
6790
|
-
`Invalid frontmatter in ${(0,
|
|
7056
|
+
`Invalid frontmatter in ${(0, import_node_path59.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6791
7057
|
);
|
|
6792
7058
|
}
|
|
6793
7059
|
if (result.data.name !== loaded.dirName) {
|
|
6794
|
-
const skillFilePath = (0,
|
|
7060
|
+
const skillFilePath = (0, import_node_path59.join)(
|
|
6795
7061
|
loaded.baseDir,
|
|
6796
7062
|
loaded.relativeDirPath,
|
|
6797
7063
|
loaded.dirName,
|
|
@@ -6834,6 +7100,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6834
7100
|
// src/features/skills/skills-processor.ts
|
|
6835
7101
|
var skillsProcessorToolTargetTuple = [
|
|
6836
7102
|
"agentsmd",
|
|
7103
|
+
"antigravity",
|
|
6837
7104
|
"claudecode",
|
|
6838
7105
|
"claudecode-legacy",
|
|
6839
7106
|
"codexcli",
|
|
@@ -6844,7 +7111,7 @@ var skillsProcessorToolTargetTuple = [
|
|
|
6844
7111
|
"opencode",
|
|
6845
7112
|
"roo"
|
|
6846
7113
|
];
|
|
6847
|
-
var SkillsProcessorToolTargetSchema =
|
|
7114
|
+
var SkillsProcessorToolTargetSchema = import_mini29.z.enum(skillsProcessorToolTargetTuple);
|
|
6848
7115
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
6849
7116
|
[
|
|
6850
7117
|
"agentsmd",
|
|
@@ -6853,6 +7120,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
6853
7120
|
meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
|
|
6854
7121
|
}
|
|
6855
7122
|
],
|
|
7123
|
+
[
|
|
7124
|
+
"antigravity",
|
|
7125
|
+
{
|
|
7126
|
+
class: AntigravitySkill,
|
|
7127
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
7128
|
+
}
|
|
7129
|
+
],
|
|
6856
7130
|
[
|
|
6857
7131
|
"claudecode",
|
|
6858
7132
|
{
|
|
@@ -6871,7 +7145,7 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
6871
7145
|
"codexcli",
|
|
6872
7146
|
{
|
|
6873
7147
|
class: CodexCliSkill,
|
|
6874
|
-
meta: { supportsProject:
|
|
7148
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
6875
7149
|
}
|
|
6876
7150
|
],
|
|
6877
7151
|
[
|
|
@@ -6994,9 +7268,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
6994
7268
|
*/
|
|
6995
7269
|
async loadRulesyncDirs() {
|
|
6996
7270
|
const paths = RulesyncSkill.getSettablePaths();
|
|
6997
|
-
const rulesyncSkillsDirPath = (0,
|
|
6998
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
6999
|
-
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));
|
|
7000
7274
|
const rulesyncSkills = await Promise.all(
|
|
7001
7275
|
dirNames.map(
|
|
7002
7276
|
(dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
|
|
@@ -7012,9 +7286,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7012
7286
|
async loadToolDirs() {
|
|
7013
7287
|
const factory = this.getFactory(this.toolTarget);
|
|
7014
7288
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7015
|
-
const skillsDirPath = (0,
|
|
7016
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
7017
|
-
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));
|
|
7018
7292
|
const toolSkills = await Promise.all(
|
|
7019
7293
|
dirNames.map(
|
|
7020
7294
|
(dirName) => factory.class.fromDir({
|
|
@@ -7030,9 +7304,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7030
7304
|
async loadToolDirsToDelete() {
|
|
7031
7305
|
const factory = this.getFactory(this.toolTarget);
|
|
7032
7306
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7033
|
-
const skillsDirPath = (0,
|
|
7034
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
7035
|
-
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));
|
|
7036
7310
|
const toolSkills = dirNames.map(
|
|
7037
7311
|
(dirName) => factory.class.forDeletion({
|
|
7038
7312
|
baseDir: this.baseDir,
|
|
@@ -7080,11 +7354,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7080
7354
|
};
|
|
7081
7355
|
|
|
7082
7356
|
// src/features/subagents/agentsmd-subagent.ts
|
|
7083
|
-
var
|
|
7357
|
+
var import_node_path62 = require("path");
|
|
7084
7358
|
|
|
7085
7359
|
// src/features/subagents/simulated-subagent.ts
|
|
7086
|
-
var
|
|
7087
|
-
var
|
|
7360
|
+
var import_node_path61 = require("path");
|
|
7361
|
+
var import_mini30 = require("zod/mini");
|
|
7088
7362
|
|
|
7089
7363
|
// src/features/subagents/tool-subagent.ts
|
|
7090
7364
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -7127,9 +7401,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
7127
7401
|
};
|
|
7128
7402
|
|
|
7129
7403
|
// src/features/subagents/simulated-subagent.ts
|
|
7130
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
7131
|
-
name:
|
|
7132
|
-
description:
|
|
7404
|
+
var SimulatedSubagentFrontmatterSchema = import_mini30.z.object({
|
|
7405
|
+
name: import_mini30.z.string(),
|
|
7406
|
+
description: import_mini30.z.string()
|
|
7133
7407
|
});
|
|
7134
7408
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
7135
7409
|
frontmatter;
|
|
@@ -7139,7 +7413,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7139
7413
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7140
7414
|
if (!result.success) {
|
|
7141
7415
|
throw new Error(
|
|
7142
|
-
`Invalid frontmatter in ${(0,
|
|
7416
|
+
`Invalid frontmatter in ${(0, import_node_path61.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7143
7417
|
);
|
|
7144
7418
|
}
|
|
7145
7419
|
}
|
|
@@ -7190,7 +7464,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7190
7464
|
return {
|
|
7191
7465
|
success: false,
|
|
7192
7466
|
error: new Error(
|
|
7193
|
-
`Invalid frontmatter in ${(0,
|
|
7467
|
+
`Invalid frontmatter in ${(0, import_node_path61.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7194
7468
|
)
|
|
7195
7469
|
};
|
|
7196
7470
|
}
|
|
@@ -7200,7 +7474,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7200
7474
|
relativeFilePath,
|
|
7201
7475
|
validate = true
|
|
7202
7476
|
}) {
|
|
7203
|
-
const filePath = (0,
|
|
7477
|
+
const filePath = (0, import_node_path61.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
7204
7478
|
const fileContent = await readFileContent(filePath);
|
|
7205
7479
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7206
7480
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7210,7 +7484,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7210
7484
|
return {
|
|
7211
7485
|
baseDir,
|
|
7212
7486
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
7213
|
-
relativeFilePath: (0,
|
|
7487
|
+
relativeFilePath: (0, import_node_path61.basename)(relativeFilePath),
|
|
7214
7488
|
frontmatter: result.data,
|
|
7215
7489
|
body: content.trim(),
|
|
7216
7490
|
validate
|
|
@@ -7236,7 +7510,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7236
7510
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
7237
7511
|
static getSettablePaths() {
|
|
7238
7512
|
return {
|
|
7239
|
-
relativeDirPath: (0,
|
|
7513
|
+
relativeDirPath: (0, import_node_path62.join)(".agents", "subagents")
|
|
7240
7514
|
};
|
|
7241
7515
|
}
|
|
7242
7516
|
static async fromFile(params) {
|
|
@@ -7259,11 +7533,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
7259
7533
|
};
|
|
7260
7534
|
|
|
7261
7535
|
// src/features/subagents/codexcli-subagent.ts
|
|
7262
|
-
var
|
|
7536
|
+
var import_node_path63 = require("path");
|
|
7263
7537
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
7264
7538
|
static getSettablePaths() {
|
|
7265
7539
|
return {
|
|
7266
|
-
relativeDirPath: (0,
|
|
7540
|
+
relativeDirPath: (0, import_node_path63.join)(".codex", "subagents")
|
|
7267
7541
|
};
|
|
7268
7542
|
}
|
|
7269
7543
|
static async fromFile(params) {
|
|
@@ -7286,11 +7560,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
7286
7560
|
};
|
|
7287
7561
|
|
|
7288
7562
|
// src/features/subagents/cursor-subagent.ts
|
|
7289
|
-
var
|
|
7563
|
+
var import_node_path64 = require("path");
|
|
7290
7564
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
7291
7565
|
static getSettablePaths() {
|
|
7292
7566
|
return {
|
|
7293
|
-
relativeDirPath: (0,
|
|
7567
|
+
relativeDirPath: (0, import_node_path64.join)(".cursor", "subagents")
|
|
7294
7568
|
};
|
|
7295
7569
|
}
|
|
7296
7570
|
static async fromFile(params) {
|
|
@@ -7313,11 +7587,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
7313
7587
|
};
|
|
7314
7588
|
|
|
7315
7589
|
// src/features/subagents/geminicli-subagent.ts
|
|
7316
|
-
var
|
|
7590
|
+
var import_node_path65 = require("path");
|
|
7317
7591
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
7318
7592
|
static getSettablePaths() {
|
|
7319
7593
|
return {
|
|
7320
|
-
relativeDirPath: (0,
|
|
7594
|
+
relativeDirPath: (0, import_node_path65.join)(".gemini", "subagents")
|
|
7321
7595
|
};
|
|
7322
7596
|
}
|
|
7323
7597
|
static async fromFile(params) {
|
|
@@ -7340,11 +7614,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
7340
7614
|
};
|
|
7341
7615
|
|
|
7342
7616
|
// src/features/subagents/roo-subagent.ts
|
|
7343
|
-
var
|
|
7617
|
+
var import_node_path66 = require("path");
|
|
7344
7618
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
7345
7619
|
static getSettablePaths() {
|
|
7346
7620
|
return {
|
|
7347
|
-
relativeDirPath: (0,
|
|
7621
|
+
relativeDirPath: (0, import_node_path66.join)(".roo", "subagents")
|
|
7348
7622
|
};
|
|
7349
7623
|
}
|
|
7350
7624
|
static async fromFile(params) {
|
|
@@ -7367,20 +7641,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
7367
7641
|
};
|
|
7368
7642
|
|
|
7369
7643
|
// src/features/subagents/subagents-processor.ts
|
|
7370
|
-
var
|
|
7371
|
-
var
|
|
7644
|
+
var import_node_path71 = require("path");
|
|
7645
|
+
var import_mini35 = require("zod/mini");
|
|
7372
7646
|
|
|
7373
7647
|
// src/features/subagents/claudecode-subagent.ts
|
|
7374
|
-
var
|
|
7375
|
-
var
|
|
7648
|
+
var import_node_path68 = require("path");
|
|
7649
|
+
var import_mini32 = require("zod/mini");
|
|
7376
7650
|
|
|
7377
7651
|
// src/features/subagents/rulesync-subagent.ts
|
|
7378
|
-
var
|
|
7379
|
-
var
|
|
7380
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
7652
|
+
var import_node_path67 = require("path");
|
|
7653
|
+
var import_mini31 = require("zod/mini");
|
|
7654
|
+
var RulesyncSubagentFrontmatterSchema = import_mini31.z.looseObject({
|
|
7381
7655
|
targets: RulesyncTargetsSchema,
|
|
7382
|
-
name:
|
|
7383
|
-
description:
|
|
7656
|
+
name: import_mini31.z.string(),
|
|
7657
|
+
description: import_mini31.z.string()
|
|
7384
7658
|
});
|
|
7385
7659
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
7386
7660
|
frontmatter;
|
|
@@ -7390,7 +7664,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7390
7664
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7391
7665
|
if (!result.success) {
|
|
7392
7666
|
throw new Error(
|
|
7393
|
-
`Invalid frontmatter in ${(0,
|
|
7667
|
+
`Invalid frontmatter in ${(0, import_node_path67.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7394
7668
|
);
|
|
7395
7669
|
}
|
|
7396
7670
|
}
|
|
@@ -7423,7 +7697,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7423
7697
|
return {
|
|
7424
7698
|
success: false,
|
|
7425
7699
|
error: new Error(
|
|
7426
|
-
`Invalid frontmatter in ${(0,
|
|
7700
|
+
`Invalid frontmatter in ${(0, import_node_path67.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7427
7701
|
)
|
|
7428
7702
|
};
|
|
7429
7703
|
}
|
|
@@ -7432,14 +7706,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7432
7706
|
relativeFilePath
|
|
7433
7707
|
}) {
|
|
7434
7708
|
const fileContent = await readFileContent(
|
|
7435
|
-
(0,
|
|
7709
|
+
(0, import_node_path67.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
7436
7710
|
);
|
|
7437
7711
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7438
7712
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7439
7713
|
if (!result.success) {
|
|
7440
7714
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
7441
7715
|
}
|
|
7442
|
-
const filename = (0,
|
|
7716
|
+
const filename = (0, import_node_path67.basename)(relativeFilePath);
|
|
7443
7717
|
return new _RulesyncSubagent({
|
|
7444
7718
|
baseDir: process.cwd(),
|
|
7445
7719
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -7451,13 +7725,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7451
7725
|
};
|
|
7452
7726
|
|
|
7453
7727
|
// src/features/subagents/claudecode-subagent.ts
|
|
7454
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
7455
|
-
name:
|
|
7456
|
-
description:
|
|
7457
|
-
model:
|
|
7458
|
-
tools:
|
|
7459
|
-
permissionMode:
|
|
7460
|
-
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())]))
|
|
7461
7735
|
});
|
|
7462
7736
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
7463
7737
|
frontmatter;
|
|
@@ -7467,7 +7741,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7467
7741
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7468
7742
|
if (!result.success) {
|
|
7469
7743
|
throw new Error(
|
|
7470
|
-
`Invalid frontmatter in ${(0,
|
|
7744
|
+
`Invalid frontmatter in ${(0, import_node_path68.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7471
7745
|
);
|
|
7472
7746
|
}
|
|
7473
7747
|
}
|
|
@@ -7479,7 +7753,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7479
7753
|
}
|
|
7480
7754
|
static getSettablePaths(_options = {}) {
|
|
7481
7755
|
return {
|
|
7482
|
-
relativeDirPath: (0,
|
|
7756
|
+
relativeDirPath: (0, import_node_path68.join)(".claude", "agents")
|
|
7483
7757
|
};
|
|
7484
7758
|
}
|
|
7485
7759
|
getFrontmatter() {
|
|
@@ -7553,7 +7827,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7553
7827
|
return {
|
|
7554
7828
|
success: false,
|
|
7555
7829
|
error: new Error(
|
|
7556
|
-
`Invalid frontmatter in ${(0,
|
|
7830
|
+
`Invalid frontmatter in ${(0, import_node_path68.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7557
7831
|
)
|
|
7558
7832
|
};
|
|
7559
7833
|
}
|
|
@@ -7571,7 +7845,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7571
7845
|
global = false
|
|
7572
7846
|
}) {
|
|
7573
7847
|
const paths = this.getSettablePaths({ global });
|
|
7574
|
-
const filePath = (0,
|
|
7848
|
+
const filePath = (0, import_node_path68.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7575
7849
|
const fileContent = await readFileContent(filePath);
|
|
7576
7850
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7577
7851
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7606,13 +7880,13 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7606
7880
|
};
|
|
7607
7881
|
|
|
7608
7882
|
// src/features/subagents/copilot-subagent.ts
|
|
7609
|
-
var
|
|
7610
|
-
var
|
|
7883
|
+
var import_node_path69 = require("path");
|
|
7884
|
+
var import_mini33 = require("zod/mini");
|
|
7611
7885
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
7612
|
-
var CopilotSubagentFrontmatterSchema =
|
|
7613
|
-
name:
|
|
7614
|
-
description:
|
|
7615
|
-
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())]))
|
|
7616
7890
|
});
|
|
7617
7891
|
var normalizeTools = (tools) => {
|
|
7618
7892
|
if (!tools) {
|
|
@@ -7632,7 +7906,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7632
7906
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7633
7907
|
if (!result.success) {
|
|
7634
7908
|
throw new Error(
|
|
7635
|
-
`Invalid frontmatter in ${(0,
|
|
7909
|
+
`Invalid frontmatter in ${(0, import_node_path69.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7636
7910
|
);
|
|
7637
7911
|
}
|
|
7638
7912
|
}
|
|
@@ -7644,7 +7918,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7644
7918
|
}
|
|
7645
7919
|
static getSettablePaths(_options = {}) {
|
|
7646
7920
|
return {
|
|
7647
|
-
relativeDirPath: (0,
|
|
7921
|
+
relativeDirPath: (0, import_node_path69.join)(".github", "agents")
|
|
7648
7922
|
};
|
|
7649
7923
|
}
|
|
7650
7924
|
getFrontmatter() {
|
|
@@ -7718,7 +7992,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7718
7992
|
return {
|
|
7719
7993
|
success: false,
|
|
7720
7994
|
error: new Error(
|
|
7721
|
-
`Invalid frontmatter in ${(0,
|
|
7995
|
+
`Invalid frontmatter in ${(0, import_node_path69.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7722
7996
|
)
|
|
7723
7997
|
};
|
|
7724
7998
|
}
|
|
@@ -7736,7 +8010,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7736
8010
|
global = false
|
|
7737
8011
|
}) {
|
|
7738
8012
|
const paths = this.getSettablePaths({ global });
|
|
7739
|
-
const filePath = (0,
|
|
8013
|
+
const filePath = (0, import_node_path69.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7740
8014
|
const fileContent = await readFileContent(filePath);
|
|
7741
8015
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7742
8016
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7772,12 +8046,12 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7772
8046
|
};
|
|
7773
8047
|
|
|
7774
8048
|
// src/features/subagents/opencode-subagent.ts
|
|
7775
|
-
var
|
|
7776
|
-
var
|
|
7777
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
7778
|
-
description:
|
|
7779
|
-
mode:
|
|
7780
|
-
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())
|
|
7781
8055
|
});
|
|
7782
8056
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
7783
8057
|
frontmatter;
|
|
@@ -7787,7 +8061,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7787
8061
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7788
8062
|
if (!result.success) {
|
|
7789
8063
|
throw new Error(
|
|
7790
|
-
`Invalid frontmatter in ${(0,
|
|
8064
|
+
`Invalid frontmatter in ${(0, import_node_path70.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7791
8065
|
);
|
|
7792
8066
|
}
|
|
7793
8067
|
}
|
|
@@ -7801,7 +8075,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7801
8075
|
global = false
|
|
7802
8076
|
} = {}) {
|
|
7803
8077
|
return {
|
|
7804
|
-
relativeDirPath: global ? (0,
|
|
8078
|
+
relativeDirPath: global ? (0, import_node_path70.join)(".config", "opencode", "agent") : (0, import_node_path70.join)(".opencode", "agent")
|
|
7805
8079
|
};
|
|
7806
8080
|
}
|
|
7807
8081
|
getFrontmatter() {
|
|
@@ -7814,7 +8088,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7814
8088
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
7815
8089
|
const rulesyncFrontmatter = {
|
|
7816
8090
|
targets: ["opencode"],
|
|
7817
|
-
name: name ?? (0,
|
|
8091
|
+
name: name ?? (0, import_node_path70.basename)(this.getRelativeFilePath(), ".md"),
|
|
7818
8092
|
description,
|
|
7819
8093
|
opencode: { mode, ...opencodeSection }
|
|
7820
8094
|
};
|
|
@@ -7867,7 +8141,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7867
8141
|
return {
|
|
7868
8142
|
success: false,
|
|
7869
8143
|
error: new Error(
|
|
7870
|
-
`Invalid frontmatter in ${(0,
|
|
8144
|
+
`Invalid frontmatter in ${(0, import_node_path70.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7871
8145
|
)
|
|
7872
8146
|
};
|
|
7873
8147
|
}
|
|
@@ -7884,7 +8158,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7884
8158
|
global = false
|
|
7885
8159
|
}) {
|
|
7886
8160
|
const paths = this.getSettablePaths({ global });
|
|
7887
|
-
const filePath = (0,
|
|
8161
|
+
const filePath = (0, import_node_path70.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7888
8162
|
const fileContent = await readFileContent(filePath);
|
|
7889
8163
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7890
8164
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7931,7 +8205,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
7931
8205
|
"opencode",
|
|
7932
8206
|
"roo"
|
|
7933
8207
|
];
|
|
7934
|
-
var SubagentsProcessorToolTargetSchema =
|
|
8208
|
+
var SubagentsProcessorToolTargetSchema = import_mini35.z.enum(subagentsProcessorToolTargetTuple);
|
|
7935
8209
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
7936
8210
|
[
|
|
7937
8211
|
"agentsmd",
|
|
@@ -8045,7 +8319,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8045
8319
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
8046
8320
|
*/
|
|
8047
8321
|
async loadRulesyncFiles() {
|
|
8048
|
-
const subagentsDir = (0,
|
|
8322
|
+
const subagentsDir = (0, import_node_path71.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
8049
8323
|
const dirExists = await directoryExists(subagentsDir);
|
|
8050
8324
|
if (!dirExists) {
|
|
8051
8325
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -8060,7 +8334,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8060
8334
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
8061
8335
|
const rulesyncSubagents = [];
|
|
8062
8336
|
for (const mdFile of mdFiles) {
|
|
8063
|
-
const filepath = (0,
|
|
8337
|
+
const filepath = (0, import_node_path71.join)(subagentsDir, mdFile);
|
|
8064
8338
|
try {
|
|
8065
8339
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
8066
8340
|
relativeFilePath: mdFile,
|
|
@@ -8090,14 +8364,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8090
8364
|
const factory = this.getFactory(this.toolTarget);
|
|
8091
8365
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
8092
8366
|
const subagentFilePaths = await findFilesByGlobs(
|
|
8093
|
-
(0,
|
|
8367
|
+
(0, import_node_path71.join)(this.baseDir, paths.relativeDirPath, "*.md")
|
|
8094
8368
|
);
|
|
8095
8369
|
if (forDeletion) {
|
|
8096
8370
|
const toolSubagents2 = subagentFilePaths.map(
|
|
8097
8371
|
(path3) => factory.class.forDeletion({
|
|
8098
8372
|
baseDir: this.baseDir,
|
|
8099
8373
|
relativeDirPath: paths.relativeDirPath,
|
|
8100
|
-
relativeFilePath: (0,
|
|
8374
|
+
relativeFilePath: (0, import_node_path71.basename)(path3),
|
|
8101
8375
|
global: this.global
|
|
8102
8376
|
})
|
|
8103
8377
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -8108,7 +8382,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8108
8382
|
subagentFilePaths.map(
|
|
8109
8383
|
(path3) => factory.class.fromFile({
|
|
8110
8384
|
baseDir: this.baseDir,
|
|
8111
|
-
relativeFilePath: (0,
|
|
8385
|
+
relativeFilePath: (0, import_node_path71.basename)(path3),
|
|
8112
8386
|
global: this.global
|
|
8113
8387
|
})
|
|
8114
8388
|
)
|
|
@@ -8140,48 +8414,48 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8140
8414
|
};
|
|
8141
8415
|
|
|
8142
8416
|
// src/features/rules/agentsmd-rule.ts
|
|
8143
|
-
var
|
|
8417
|
+
var import_node_path74 = require("path");
|
|
8144
8418
|
|
|
8145
8419
|
// src/features/rules/tool-rule.ts
|
|
8146
|
-
var
|
|
8420
|
+
var import_node_path73 = require("path");
|
|
8147
8421
|
|
|
8148
8422
|
// src/features/rules/rulesync-rule.ts
|
|
8149
|
-
var
|
|
8150
|
-
var
|
|
8151
|
-
var RulesyncRuleFrontmatterSchema =
|
|
8152
|
-
root:
|
|
8153
|
-
targets:
|
|
8154
|
-
description:
|
|
8155
|
-
globs:
|
|
8156
|
-
agentsmd:
|
|
8157
|
-
|
|
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({
|
|
8158
8432
|
// @example "path/to/subproject"
|
|
8159
|
-
subprojectPath:
|
|
8433
|
+
subprojectPath: import_mini36.z.optional(import_mini36.z.string())
|
|
8160
8434
|
})
|
|
8161
8435
|
),
|
|
8162
|
-
claudecode:
|
|
8163
|
-
|
|
8436
|
+
claudecode: import_mini36.z.optional(
|
|
8437
|
+
import_mini36.z.object({
|
|
8164
8438
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
8165
8439
|
// @example "src/**/*.ts, tests/**/*.test.ts"
|
|
8166
|
-
paths:
|
|
8440
|
+
paths: import_mini36.z.optional(import_mini36.z.string())
|
|
8167
8441
|
})
|
|
8168
8442
|
),
|
|
8169
|
-
cursor:
|
|
8170
|
-
|
|
8171
|
-
alwaysApply:
|
|
8172
|
-
description:
|
|
8173
|
-
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()))
|
|
8174
8448
|
})
|
|
8175
8449
|
),
|
|
8176
|
-
copilot:
|
|
8177
|
-
|
|
8178
|
-
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")]))
|
|
8179
8453
|
})
|
|
8180
8454
|
),
|
|
8181
|
-
antigravity:
|
|
8182
|
-
|
|
8183
|
-
trigger:
|
|
8184
|
-
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()))
|
|
8185
8459
|
})
|
|
8186
8460
|
)
|
|
8187
8461
|
});
|
|
@@ -8193,7 +8467,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8193
8467
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8194
8468
|
if (!result.success) {
|
|
8195
8469
|
throw new Error(
|
|
8196
|
-
`Invalid frontmatter in ${(0,
|
|
8470
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8197
8471
|
);
|
|
8198
8472
|
}
|
|
8199
8473
|
}
|
|
@@ -8228,7 +8502,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8228
8502
|
return {
|
|
8229
8503
|
success: false,
|
|
8230
8504
|
error: new Error(
|
|
8231
|
-
`Invalid frontmatter in ${(0,
|
|
8505
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8232
8506
|
)
|
|
8233
8507
|
};
|
|
8234
8508
|
}
|
|
@@ -8237,12 +8511,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8237
8511
|
relativeFilePath,
|
|
8238
8512
|
validate = true
|
|
8239
8513
|
}) {
|
|
8240
|
-
const legacyPath = (0,
|
|
8514
|
+
const legacyPath = (0, import_node_path72.join)(
|
|
8241
8515
|
process.cwd(),
|
|
8242
8516
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
8243
8517
|
relativeFilePath
|
|
8244
8518
|
);
|
|
8245
|
-
const recommendedPath = (0,
|
|
8519
|
+
const recommendedPath = (0, import_node_path72.join)(
|
|
8246
8520
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8247
8521
|
relativeFilePath
|
|
8248
8522
|
);
|
|
@@ -8263,7 +8537,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8263
8537
|
agentsmd: result.data.agentsmd,
|
|
8264
8538
|
cursor: result.data.cursor
|
|
8265
8539
|
};
|
|
8266
|
-
const filename = (0,
|
|
8540
|
+
const filename = (0, import_node_path72.basename)(legacyPath);
|
|
8267
8541
|
return new _RulesyncRule({
|
|
8268
8542
|
baseDir: process.cwd(),
|
|
8269
8543
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8277,7 +8551,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8277
8551
|
relativeFilePath,
|
|
8278
8552
|
validate = true
|
|
8279
8553
|
}) {
|
|
8280
|
-
const filePath = (0,
|
|
8554
|
+
const filePath = (0, import_node_path72.join)(
|
|
8281
8555
|
process.cwd(),
|
|
8282
8556
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8283
8557
|
relativeFilePath
|
|
@@ -8296,7 +8570,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8296
8570
|
agentsmd: result.data.agentsmd,
|
|
8297
8571
|
cursor: result.data.cursor
|
|
8298
8572
|
};
|
|
8299
|
-
const filename = (0,
|
|
8573
|
+
const filename = (0, import_node_path72.basename)(filePath);
|
|
8300
8574
|
return new _RulesyncRule({
|
|
8301
8575
|
baseDir: process.cwd(),
|
|
8302
8576
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8379,7 +8653,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8379
8653
|
rulesyncRule,
|
|
8380
8654
|
validate = true,
|
|
8381
8655
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
8382
|
-
nonRootPath = { relativeDirPath: (0,
|
|
8656
|
+
nonRootPath = { relativeDirPath: (0, import_node_path73.join)(".agents", "memories") }
|
|
8383
8657
|
}) {
|
|
8384
8658
|
const params = this.buildToolRuleParamsDefault({
|
|
8385
8659
|
baseDir,
|
|
@@ -8390,7 +8664,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8390
8664
|
});
|
|
8391
8665
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
8392
8666
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
8393
|
-
params.relativeDirPath = (0,
|
|
8667
|
+
params.relativeDirPath = (0, import_node_path73.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
8394
8668
|
params.relativeFilePath = "AGENTS.md";
|
|
8395
8669
|
}
|
|
8396
8670
|
return params;
|
|
@@ -8455,7 +8729,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8455
8729
|
relativeFilePath: "AGENTS.md"
|
|
8456
8730
|
},
|
|
8457
8731
|
nonRoot: {
|
|
8458
|
-
relativeDirPath: (0,
|
|
8732
|
+
relativeDirPath: (0, import_node_path74.join)(".agents", "memories")
|
|
8459
8733
|
}
|
|
8460
8734
|
};
|
|
8461
8735
|
}
|
|
@@ -8465,8 +8739,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8465
8739
|
validate = true
|
|
8466
8740
|
}) {
|
|
8467
8741
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
8468
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
8469
|
-
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));
|
|
8470
8744
|
return new _AgentsMdRule({
|
|
8471
8745
|
baseDir,
|
|
8472
8746
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -8521,21 +8795,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8521
8795
|
};
|
|
8522
8796
|
|
|
8523
8797
|
// src/features/rules/antigravity-rule.ts
|
|
8524
|
-
var
|
|
8525
|
-
var
|
|
8526
|
-
var AntigravityRuleFrontmatterSchema =
|
|
8527
|
-
trigger:
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
|
|
8533
|
-
|
|
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()
|
|
8534
8808
|
// accepts any string for forward compatibility
|
|
8535
8809
|
])
|
|
8536
8810
|
),
|
|
8537
|
-
globs:
|
|
8538
|
-
description:
|
|
8811
|
+
globs: import_mini37.z.optional(import_mini37.z.string()),
|
|
8812
|
+
description: import_mini37.z.optional(import_mini37.z.string())
|
|
8539
8813
|
});
|
|
8540
8814
|
function parseGlobsString(globs) {
|
|
8541
8815
|
if (!globs) {
|
|
@@ -8680,7 +8954,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8680
8954
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8681
8955
|
if (!result.success) {
|
|
8682
8956
|
throw new Error(
|
|
8683
|
-
`Invalid frontmatter in ${(0,
|
|
8957
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8684
8958
|
);
|
|
8685
8959
|
}
|
|
8686
8960
|
}
|
|
@@ -8695,7 +8969,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8695
8969
|
static getSettablePaths() {
|
|
8696
8970
|
return {
|
|
8697
8971
|
nonRoot: {
|
|
8698
|
-
relativeDirPath: (0,
|
|
8972
|
+
relativeDirPath: (0, import_node_path75.join)(".agent", "rules")
|
|
8699
8973
|
}
|
|
8700
8974
|
};
|
|
8701
8975
|
}
|
|
@@ -8704,7 +8978,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8704
8978
|
relativeFilePath,
|
|
8705
8979
|
validate = true
|
|
8706
8980
|
}) {
|
|
8707
|
-
const filePath = (0,
|
|
8981
|
+
const filePath = (0, import_node_path75.join)(
|
|
8708
8982
|
baseDir,
|
|
8709
8983
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
8710
8984
|
relativeFilePath
|
|
@@ -8845,7 +9119,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8845
9119
|
};
|
|
8846
9120
|
|
|
8847
9121
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
8848
|
-
var
|
|
9122
|
+
var import_node_path76 = require("path");
|
|
8849
9123
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
8850
9124
|
toRulesyncRule() {
|
|
8851
9125
|
const rulesyncFrontmatter = {
|
|
@@ -8871,7 +9145,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8871
9145
|
relativeFilePath: ".augment-guidelines"
|
|
8872
9146
|
},
|
|
8873
9147
|
nonRoot: {
|
|
8874
|
-
relativeDirPath: (0,
|
|
9148
|
+
relativeDirPath: (0, import_node_path76.join)(".augment", "rules")
|
|
8875
9149
|
}
|
|
8876
9150
|
};
|
|
8877
9151
|
}
|
|
@@ -8906,8 +9180,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8906
9180
|
}) {
|
|
8907
9181
|
const settablePaths = this.getSettablePaths();
|
|
8908
9182
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
8909
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
8910
|
-
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));
|
|
8911
9185
|
return new _AugmentcodeLegacyRule({
|
|
8912
9186
|
baseDir,
|
|
8913
9187
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -8936,7 +9210,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8936
9210
|
};
|
|
8937
9211
|
|
|
8938
9212
|
// src/features/rules/augmentcode-rule.ts
|
|
8939
|
-
var
|
|
9213
|
+
var import_node_path77 = require("path");
|
|
8940
9214
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
8941
9215
|
toRulesyncRule() {
|
|
8942
9216
|
return this.toRulesyncRuleDefault();
|
|
@@ -8944,7 +9218,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8944
9218
|
static getSettablePaths() {
|
|
8945
9219
|
return {
|
|
8946
9220
|
nonRoot: {
|
|
8947
|
-
relativeDirPath: (0,
|
|
9221
|
+
relativeDirPath: (0, import_node_path77.join)(".augment", "rules")
|
|
8948
9222
|
}
|
|
8949
9223
|
};
|
|
8950
9224
|
}
|
|
@@ -8968,7 +9242,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8968
9242
|
validate = true
|
|
8969
9243
|
}) {
|
|
8970
9244
|
const fileContent = await readFileContent(
|
|
8971
|
-
(0,
|
|
9245
|
+
(0, import_node_path77.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8972
9246
|
);
|
|
8973
9247
|
const { body: content } = parseFrontmatter(fileContent);
|
|
8974
9248
|
return new _AugmentcodeRule({
|
|
@@ -9004,7 +9278,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9004
9278
|
};
|
|
9005
9279
|
|
|
9006
9280
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
9007
|
-
var
|
|
9281
|
+
var import_node_path78 = require("path");
|
|
9008
9282
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
9009
9283
|
static getSettablePaths({
|
|
9010
9284
|
global
|
|
@@ -9023,7 +9297,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9023
9297
|
relativeFilePath: "CLAUDE.md"
|
|
9024
9298
|
},
|
|
9025
9299
|
nonRoot: {
|
|
9026
|
-
relativeDirPath: (0,
|
|
9300
|
+
relativeDirPath: (0, import_node_path78.join)(".claude", "memories")
|
|
9027
9301
|
}
|
|
9028
9302
|
};
|
|
9029
9303
|
}
|
|
@@ -9038,7 +9312,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9038
9312
|
if (isRoot) {
|
|
9039
9313
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9040
9314
|
const fileContent2 = await readFileContent(
|
|
9041
|
-
(0,
|
|
9315
|
+
(0, import_node_path78.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9042
9316
|
);
|
|
9043
9317
|
return new _ClaudecodeLegacyRule({
|
|
9044
9318
|
baseDir,
|
|
@@ -9052,8 +9326,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9052
9326
|
if (!paths.nonRoot) {
|
|
9053
9327
|
throw new Error("nonRoot path is not set");
|
|
9054
9328
|
}
|
|
9055
|
-
const relativePath = (0,
|
|
9056
|
-
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));
|
|
9057
9331
|
return new _ClaudecodeLegacyRule({
|
|
9058
9332
|
baseDir,
|
|
9059
9333
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9112,10 +9386,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9112
9386
|
};
|
|
9113
9387
|
|
|
9114
9388
|
// src/features/rules/claudecode-rule.ts
|
|
9115
|
-
var
|
|
9116
|
-
var
|
|
9117
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
9118
|
-
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())
|
|
9119
9393
|
});
|
|
9120
9394
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
9121
9395
|
frontmatter;
|
|
@@ -9137,7 +9411,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9137
9411
|
relativeFilePath: "CLAUDE.md"
|
|
9138
9412
|
},
|
|
9139
9413
|
nonRoot: {
|
|
9140
|
-
relativeDirPath: (0,
|
|
9414
|
+
relativeDirPath: (0, import_node_path79.join)(".claude", "rules")
|
|
9141
9415
|
}
|
|
9142
9416
|
};
|
|
9143
9417
|
}
|
|
@@ -9146,7 +9420,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9146
9420
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9147
9421
|
if (!result.success) {
|
|
9148
9422
|
throw new Error(
|
|
9149
|
-
`Invalid frontmatter in ${(0,
|
|
9423
|
+
`Invalid frontmatter in ${(0, import_node_path79.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9150
9424
|
);
|
|
9151
9425
|
}
|
|
9152
9426
|
}
|
|
@@ -9174,7 +9448,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9174
9448
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
9175
9449
|
if (isRoot) {
|
|
9176
9450
|
const fileContent2 = await readFileContent(
|
|
9177
|
-
(0,
|
|
9451
|
+
(0, import_node_path79.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
9178
9452
|
);
|
|
9179
9453
|
return new _ClaudecodeRule({
|
|
9180
9454
|
baseDir,
|
|
@@ -9189,13 +9463,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9189
9463
|
if (!paths.nonRoot) {
|
|
9190
9464
|
throw new Error("nonRoot path is not set");
|
|
9191
9465
|
}
|
|
9192
|
-
const relativePath = (0,
|
|
9193
|
-
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));
|
|
9194
9468
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9195
9469
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9196
9470
|
if (!result.success) {
|
|
9197
9471
|
throw new Error(
|
|
9198
|
-
`Invalid frontmatter in ${(0,
|
|
9472
|
+
`Invalid frontmatter in ${(0, import_node_path79.join)(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
9199
9473
|
);
|
|
9200
9474
|
}
|
|
9201
9475
|
return new _ClaudecodeRule({
|
|
@@ -9302,7 +9576,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9302
9576
|
return {
|
|
9303
9577
|
success: false,
|
|
9304
9578
|
error: new Error(
|
|
9305
|
-
`Invalid frontmatter in ${(0,
|
|
9579
|
+
`Invalid frontmatter in ${(0, import_node_path79.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9306
9580
|
)
|
|
9307
9581
|
};
|
|
9308
9582
|
}
|
|
@@ -9322,10 +9596,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9322
9596
|
};
|
|
9323
9597
|
|
|
9324
9598
|
// src/features/rules/cline-rule.ts
|
|
9325
|
-
var
|
|
9326
|
-
var
|
|
9327
|
-
var ClineRuleFrontmatterSchema =
|
|
9328
|
-
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()
|
|
9329
9603
|
});
|
|
9330
9604
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
9331
9605
|
static getSettablePaths() {
|
|
@@ -9367,7 +9641,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9367
9641
|
validate = true
|
|
9368
9642
|
}) {
|
|
9369
9643
|
const fileContent = await readFileContent(
|
|
9370
|
-
(0,
|
|
9644
|
+
(0, import_node_path80.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9371
9645
|
);
|
|
9372
9646
|
return new _ClineRule({
|
|
9373
9647
|
baseDir,
|
|
@@ -9393,7 +9667,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9393
9667
|
};
|
|
9394
9668
|
|
|
9395
9669
|
// src/features/rules/codexcli-rule.ts
|
|
9396
|
-
var
|
|
9670
|
+
var import_node_path81 = require("path");
|
|
9397
9671
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
9398
9672
|
static getSettablePaths({
|
|
9399
9673
|
global
|
|
@@ -9412,7 +9686,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9412
9686
|
relativeFilePath: "AGENTS.md"
|
|
9413
9687
|
},
|
|
9414
9688
|
nonRoot: {
|
|
9415
|
-
relativeDirPath: (0,
|
|
9689
|
+
relativeDirPath: (0, import_node_path81.join)(".codex", "memories")
|
|
9416
9690
|
}
|
|
9417
9691
|
};
|
|
9418
9692
|
}
|
|
@@ -9427,7 +9701,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9427
9701
|
if (isRoot) {
|
|
9428
9702
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9429
9703
|
const fileContent2 = await readFileContent(
|
|
9430
|
-
(0,
|
|
9704
|
+
(0, import_node_path81.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9431
9705
|
);
|
|
9432
9706
|
return new _CodexcliRule({
|
|
9433
9707
|
baseDir,
|
|
@@ -9441,8 +9715,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9441
9715
|
if (!paths.nonRoot) {
|
|
9442
9716
|
throw new Error("nonRoot path is not set");
|
|
9443
9717
|
}
|
|
9444
|
-
const relativePath = (0,
|
|
9445
|
-
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));
|
|
9446
9720
|
return new _CodexcliRule({
|
|
9447
9721
|
baseDir,
|
|
9448
9722
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9501,12 +9775,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9501
9775
|
};
|
|
9502
9776
|
|
|
9503
9777
|
// src/features/rules/copilot-rule.ts
|
|
9504
|
-
var
|
|
9505
|
-
var
|
|
9506
|
-
var CopilotRuleFrontmatterSchema =
|
|
9507
|
-
description:
|
|
9508
|
-
applyTo:
|
|
9509
|
-
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")]))
|
|
9510
9784
|
});
|
|
9511
9785
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
9512
9786
|
frontmatter;
|
|
@@ -9518,7 +9792,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9518
9792
|
relativeFilePath: "copilot-instructions.md"
|
|
9519
9793
|
},
|
|
9520
9794
|
nonRoot: {
|
|
9521
|
-
relativeDirPath: (0,
|
|
9795
|
+
relativeDirPath: (0, import_node_path82.join)(".github", "instructions")
|
|
9522
9796
|
}
|
|
9523
9797
|
};
|
|
9524
9798
|
}
|
|
@@ -9527,7 +9801,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9527
9801
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9528
9802
|
if (!result.success) {
|
|
9529
9803
|
throw new Error(
|
|
9530
|
-
`Invalid frontmatter in ${(0,
|
|
9804
|
+
`Invalid frontmatter in ${(0, import_node_path82.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9531
9805
|
);
|
|
9532
9806
|
}
|
|
9533
9807
|
}
|
|
@@ -9609,11 +9883,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9609
9883
|
validate = true
|
|
9610
9884
|
}) {
|
|
9611
9885
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
9612
|
-
const relativePath = isRoot ? (0,
|
|
9886
|
+
const relativePath = isRoot ? (0, import_node_path82.join)(
|
|
9613
9887
|
this.getSettablePaths().root.relativeDirPath,
|
|
9614
9888
|
this.getSettablePaths().root.relativeFilePath
|
|
9615
|
-
) : (0,
|
|
9616
|
-
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));
|
|
9617
9891
|
if (isRoot) {
|
|
9618
9892
|
return new _CopilotRule({
|
|
9619
9893
|
baseDir,
|
|
@@ -9629,7 +9903,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9629
9903
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9630
9904
|
if (!result.success) {
|
|
9631
9905
|
throw new Error(
|
|
9632
|
-
`Invalid frontmatter in ${(0,
|
|
9906
|
+
`Invalid frontmatter in ${(0, import_node_path82.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9633
9907
|
);
|
|
9634
9908
|
}
|
|
9635
9909
|
return new _CopilotRule({
|
|
@@ -9669,7 +9943,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9669
9943
|
return {
|
|
9670
9944
|
success: false,
|
|
9671
9945
|
error: new Error(
|
|
9672
|
-
`Invalid frontmatter in ${(0,
|
|
9946
|
+
`Invalid frontmatter in ${(0, import_node_path82.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9673
9947
|
)
|
|
9674
9948
|
};
|
|
9675
9949
|
}
|
|
@@ -9689,12 +9963,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9689
9963
|
};
|
|
9690
9964
|
|
|
9691
9965
|
// src/features/rules/cursor-rule.ts
|
|
9692
|
-
var
|
|
9693
|
-
var
|
|
9694
|
-
var CursorRuleFrontmatterSchema =
|
|
9695
|
-
description:
|
|
9696
|
-
globs:
|
|
9697
|
-
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())
|
|
9698
9972
|
});
|
|
9699
9973
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
9700
9974
|
frontmatter;
|
|
@@ -9702,7 +9976,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9702
9976
|
static getSettablePaths() {
|
|
9703
9977
|
return {
|
|
9704
9978
|
nonRoot: {
|
|
9705
|
-
relativeDirPath: (0,
|
|
9979
|
+
relativeDirPath: (0, import_node_path83.join)(".cursor", "rules")
|
|
9706
9980
|
}
|
|
9707
9981
|
};
|
|
9708
9982
|
}
|
|
@@ -9711,7 +9985,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9711
9985
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9712
9986
|
if (!result.success) {
|
|
9713
9987
|
throw new Error(
|
|
9714
|
-
`Invalid frontmatter in ${(0,
|
|
9988
|
+
`Invalid frontmatter in ${(0, import_node_path83.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9715
9989
|
);
|
|
9716
9990
|
}
|
|
9717
9991
|
}
|
|
@@ -9828,19 +10102,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9828
10102
|
validate = true
|
|
9829
10103
|
}) {
|
|
9830
10104
|
const fileContent = await readFileContent(
|
|
9831
|
-
(0,
|
|
10105
|
+
(0, import_node_path83.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9832
10106
|
);
|
|
9833
10107
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
9834
10108
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9835
10109
|
if (!result.success) {
|
|
9836
10110
|
throw new Error(
|
|
9837
|
-
`Invalid frontmatter in ${(0,
|
|
10111
|
+
`Invalid frontmatter in ${(0, import_node_path83.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9838
10112
|
);
|
|
9839
10113
|
}
|
|
9840
10114
|
return new _CursorRule({
|
|
9841
10115
|
baseDir,
|
|
9842
10116
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
9843
|
-
relativeFilePath: (0,
|
|
10117
|
+
relativeFilePath: (0, import_node_path83.basename)(relativeFilePath),
|
|
9844
10118
|
frontmatter: result.data,
|
|
9845
10119
|
body: content.trim(),
|
|
9846
10120
|
validate
|
|
@@ -9871,7 +10145,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9871
10145
|
return {
|
|
9872
10146
|
success: false,
|
|
9873
10147
|
error: new Error(
|
|
9874
|
-
`Invalid frontmatter in ${(0,
|
|
10148
|
+
`Invalid frontmatter in ${(0, import_node_path83.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9875
10149
|
)
|
|
9876
10150
|
};
|
|
9877
10151
|
}
|
|
@@ -9891,7 +10165,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9891
10165
|
};
|
|
9892
10166
|
|
|
9893
10167
|
// src/features/rules/geminicli-rule.ts
|
|
9894
|
-
var
|
|
10168
|
+
var import_node_path84 = require("path");
|
|
9895
10169
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
9896
10170
|
static getSettablePaths({
|
|
9897
10171
|
global
|
|
@@ -9910,7 +10184,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9910
10184
|
relativeFilePath: "GEMINI.md"
|
|
9911
10185
|
},
|
|
9912
10186
|
nonRoot: {
|
|
9913
|
-
relativeDirPath: (0,
|
|
10187
|
+
relativeDirPath: (0, import_node_path84.join)(".gemini", "memories")
|
|
9914
10188
|
}
|
|
9915
10189
|
};
|
|
9916
10190
|
}
|
|
@@ -9925,7 +10199,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9925
10199
|
if (isRoot) {
|
|
9926
10200
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9927
10201
|
const fileContent2 = await readFileContent(
|
|
9928
|
-
(0,
|
|
10202
|
+
(0, import_node_path84.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9929
10203
|
);
|
|
9930
10204
|
return new _GeminiCliRule({
|
|
9931
10205
|
baseDir,
|
|
@@ -9939,8 +10213,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9939
10213
|
if (!paths.nonRoot) {
|
|
9940
10214
|
throw new Error("nonRoot path is not set");
|
|
9941
10215
|
}
|
|
9942
|
-
const relativePath = (0,
|
|
9943
|
-
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));
|
|
9944
10218
|
return new _GeminiCliRule({
|
|
9945
10219
|
baseDir,
|
|
9946
10220
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9999,7 +10273,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9999
10273
|
};
|
|
10000
10274
|
|
|
10001
10275
|
// src/features/rules/junie-rule.ts
|
|
10002
|
-
var
|
|
10276
|
+
var import_node_path85 = require("path");
|
|
10003
10277
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
10004
10278
|
static getSettablePaths() {
|
|
10005
10279
|
return {
|
|
@@ -10008,7 +10282,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10008
10282
|
relativeFilePath: "guidelines.md"
|
|
10009
10283
|
},
|
|
10010
10284
|
nonRoot: {
|
|
10011
|
-
relativeDirPath: (0,
|
|
10285
|
+
relativeDirPath: (0, import_node_path85.join)(".junie", "memories")
|
|
10012
10286
|
}
|
|
10013
10287
|
};
|
|
10014
10288
|
}
|
|
@@ -10018,8 +10292,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10018
10292
|
validate = true
|
|
10019
10293
|
}) {
|
|
10020
10294
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
10021
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
10022
|
-
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));
|
|
10023
10297
|
return new _JunieRule({
|
|
10024
10298
|
baseDir,
|
|
10025
10299
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10074,12 +10348,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10074
10348
|
};
|
|
10075
10349
|
|
|
10076
10350
|
// src/features/rules/kilo-rule.ts
|
|
10077
|
-
var
|
|
10351
|
+
var import_node_path86 = require("path");
|
|
10078
10352
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
10079
10353
|
static getSettablePaths(_options = {}) {
|
|
10080
10354
|
return {
|
|
10081
10355
|
nonRoot: {
|
|
10082
|
-
relativeDirPath: (0,
|
|
10356
|
+
relativeDirPath: (0, import_node_path86.join)(".kilocode", "rules")
|
|
10083
10357
|
}
|
|
10084
10358
|
};
|
|
10085
10359
|
}
|
|
@@ -10089,7 +10363,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10089
10363
|
validate = true
|
|
10090
10364
|
}) {
|
|
10091
10365
|
const fileContent = await readFileContent(
|
|
10092
|
-
(0,
|
|
10366
|
+
(0, import_node_path86.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10093
10367
|
);
|
|
10094
10368
|
return new _KiloRule({
|
|
10095
10369
|
baseDir,
|
|
@@ -10141,12 +10415,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10141
10415
|
};
|
|
10142
10416
|
|
|
10143
10417
|
// src/features/rules/kiro-rule.ts
|
|
10144
|
-
var
|
|
10418
|
+
var import_node_path87 = require("path");
|
|
10145
10419
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
10146
10420
|
static getSettablePaths() {
|
|
10147
10421
|
return {
|
|
10148
10422
|
nonRoot: {
|
|
10149
|
-
relativeDirPath: (0,
|
|
10423
|
+
relativeDirPath: (0, import_node_path87.join)(".kiro", "steering")
|
|
10150
10424
|
}
|
|
10151
10425
|
};
|
|
10152
10426
|
}
|
|
@@ -10156,7 +10430,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10156
10430
|
validate = true
|
|
10157
10431
|
}) {
|
|
10158
10432
|
const fileContent = await readFileContent(
|
|
10159
|
-
(0,
|
|
10433
|
+
(0, import_node_path87.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10160
10434
|
);
|
|
10161
10435
|
return new _KiroRule({
|
|
10162
10436
|
baseDir,
|
|
@@ -10210,7 +10484,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10210
10484
|
};
|
|
10211
10485
|
|
|
10212
10486
|
// src/features/rules/opencode-rule.ts
|
|
10213
|
-
var
|
|
10487
|
+
var import_node_path88 = require("path");
|
|
10214
10488
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
10215
10489
|
static getSettablePaths() {
|
|
10216
10490
|
return {
|
|
@@ -10219,7 +10493,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10219
10493
|
relativeFilePath: "AGENTS.md"
|
|
10220
10494
|
},
|
|
10221
10495
|
nonRoot: {
|
|
10222
|
-
relativeDirPath: (0,
|
|
10496
|
+
relativeDirPath: (0, import_node_path88.join)(".opencode", "memories")
|
|
10223
10497
|
}
|
|
10224
10498
|
};
|
|
10225
10499
|
}
|
|
@@ -10229,8 +10503,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10229
10503
|
validate = true
|
|
10230
10504
|
}) {
|
|
10231
10505
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
10232
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
10233
|
-
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));
|
|
10234
10508
|
return new _OpenCodeRule({
|
|
10235
10509
|
baseDir,
|
|
10236
10510
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10285,7 +10559,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10285
10559
|
};
|
|
10286
10560
|
|
|
10287
10561
|
// src/features/rules/qwencode-rule.ts
|
|
10288
|
-
var
|
|
10562
|
+
var import_node_path89 = require("path");
|
|
10289
10563
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
10290
10564
|
static getSettablePaths() {
|
|
10291
10565
|
return {
|
|
@@ -10294,7 +10568,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10294
10568
|
relativeFilePath: "QWEN.md"
|
|
10295
10569
|
},
|
|
10296
10570
|
nonRoot: {
|
|
10297
|
-
relativeDirPath: (0,
|
|
10571
|
+
relativeDirPath: (0, import_node_path89.join)(".qwen", "memories")
|
|
10298
10572
|
}
|
|
10299
10573
|
};
|
|
10300
10574
|
}
|
|
@@ -10304,8 +10578,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10304
10578
|
validate = true
|
|
10305
10579
|
}) {
|
|
10306
10580
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
10307
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
10308
|
-
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));
|
|
10309
10583
|
return new _QwencodeRule({
|
|
10310
10584
|
baseDir,
|
|
10311
10585
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10357,12 +10631,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10357
10631
|
};
|
|
10358
10632
|
|
|
10359
10633
|
// src/features/rules/roo-rule.ts
|
|
10360
|
-
var
|
|
10634
|
+
var import_node_path90 = require("path");
|
|
10361
10635
|
var RooRule = class _RooRule extends ToolRule {
|
|
10362
10636
|
static getSettablePaths() {
|
|
10363
10637
|
return {
|
|
10364
10638
|
nonRoot: {
|
|
10365
|
-
relativeDirPath: (0,
|
|
10639
|
+
relativeDirPath: (0, import_node_path90.join)(".roo", "rules")
|
|
10366
10640
|
}
|
|
10367
10641
|
};
|
|
10368
10642
|
}
|
|
@@ -10372,7 +10646,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10372
10646
|
validate = true
|
|
10373
10647
|
}) {
|
|
10374
10648
|
const fileContent = await readFileContent(
|
|
10375
|
-
(0,
|
|
10649
|
+
(0, import_node_path90.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10376
10650
|
);
|
|
10377
10651
|
return new _RooRule({
|
|
10378
10652
|
baseDir,
|
|
@@ -10441,7 +10715,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10441
10715
|
};
|
|
10442
10716
|
|
|
10443
10717
|
// src/features/rules/warp-rule.ts
|
|
10444
|
-
var
|
|
10718
|
+
var import_node_path91 = require("path");
|
|
10445
10719
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
10446
10720
|
constructor({ fileContent, root, ...rest }) {
|
|
10447
10721
|
super({
|
|
@@ -10457,7 +10731,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10457
10731
|
relativeFilePath: "WARP.md"
|
|
10458
10732
|
},
|
|
10459
10733
|
nonRoot: {
|
|
10460
|
-
relativeDirPath: (0,
|
|
10734
|
+
relativeDirPath: (0, import_node_path91.join)(".warp", "memories")
|
|
10461
10735
|
}
|
|
10462
10736
|
};
|
|
10463
10737
|
}
|
|
@@ -10467,8 +10741,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10467
10741
|
validate = true
|
|
10468
10742
|
}) {
|
|
10469
10743
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
10470
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
10471
|
-
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));
|
|
10472
10746
|
return new _WarpRule({
|
|
10473
10747
|
baseDir,
|
|
10474
10748
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -10523,12 +10797,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10523
10797
|
};
|
|
10524
10798
|
|
|
10525
10799
|
// src/features/rules/windsurf-rule.ts
|
|
10526
|
-
var
|
|
10800
|
+
var import_node_path92 = require("path");
|
|
10527
10801
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
10528
10802
|
static getSettablePaths() {
|
|
10529
10803
|
return {
|
|
10530
10804
|
nonRoot: {
|
|
10531
|
-
relativeDirPath: (0,
|
|
10805
|
+
relativeDirPath: (0, import_node_path92.join)(".windsurf", "rules")
|
|
10532
10806
|
}
|
|
10533
10807
|
};
|
|
10534
10808
|
}
|
|
@@ -10538,7 +10812,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
10538
10812
|
validate = true
|
|
10539
10813
|
}) {
|
|
10540
10814
|
const fileContent = await readFileContent(
|
|
10541
|
-
(0,
|
|
10815
|
+
(0, import_node_path92.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10542
10816
|
);
|
|
10543
10817
|
return new _WindsurfRule({
|
|
10544
10818
|
baseDir,
|
|
@@ -10611,7 +10885,7 @@ var rulesProcessorToolTargets = [
|
|
|
10611
10885
|
"warp",
|
|
10612
10886
|
"windsurf"
|
|
10613
10887
|
];
|
|
10614
|
-
var RulesProcessorToolTargetSchema =
|
|
10888
|
+
var RulesProcessorToolTargetSchema = import_mini42.z.enum(rulesProcessorToolTargets);
|
|
10615
10889
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
10616
10890
|
[
|
|
10617
10891
|
"agentsmd",
|
|
@@ -10895,7 +11169,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10895
11169
|
}).relativeDirPath;
|
|
10896
11170
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
10897
11171
|
const frontmatter = skill.getFrontmatter();
|
|
10898
|
-
const relativePath = (0,
|
|
11172
|
+
const relativePath = (0, import_node_path93.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
10899
11173
|
return {
|
|
10900
11174
|
name: frontmatter.name,
|
|
10901
11175
|
description: frontmatter.description,
|
|
@@ -10962,10 +11236,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10962
11236
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
10963
11237
|
*/
|
|
10964
11238
|
async loadRulesyncFiles() {
|
|
10965
|
-
const files = await findFilesByGlobs((0,
|
|
11239
|
+
const files = await findFilesByGlobs((0, import_node_path93.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
10966
11240
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
10967
11241
|
const rulesyncRules = await Promise.all(
|
|
10968
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0,
|
|
11242
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path93.basename)(file) }))
|
|
10969
11243
|
);
|
|
10970
11244
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
10971
11245
|
if (rootRules.length > 1) {
|
|
@@ -10983,10 +11257,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10983
11257
|
return rulesyncRules;
|
|
10984
11258
|
}
|
|
10985
11259
|
async loadRulesyncFilesLegacy() {
|
|
10986
|
-
const legacyFiles = await findFilesByGlobs((0,
|
|
11260
|
+
const legacyFiles = await findFilesByGlobs((0, import_node_path93.join)(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
10987
11261
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
10988
11262
|
return Promise.all(
|
|
10989
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0,
|
|
11263
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path93.basename)(file) }))
|
|
10990
11264
|
);
|
|
10991
11265
|
}
|
|
10992
11266
|
/**
|
|
@@ -11004,7 +11278,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11004
11278
|
return [];
|
|
11005
11279
|
}
|
|
11006
11280
|
const rootFilePaths = await findFilesByGlobs(
|
|
11007
|
-
(0,
|
|
11281
|
+
(0, import_node_path93.join)(
|
|
11008
11282
|
this.baseDir,
|
|
11009
11283
|
settablePaths.root.relativeDirPath ?? ".",
|
|
11010
11284
|
settablePaths.root.relativeFilePath
|
|
@@ -11015,7 +11289,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11015
11289
|
(filePath) => factory.class.forDeletion({
|
|
11016
11290
|
baseDir: this.baseDir,
|
|
11017
11291
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
11018
|
-
relativeFilePath: (0,
|
|
11292
|
+
relativeFilePath: (0, import_node_path93.basename)(filePath),
|
|
11019
11293
|
global: this.global
|
|
11020
11294
|
})
|
|
11021
11295
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11024,7 +11298,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11024
11298
|
rootFilePaths.map(
|
|
11025
11299
|
(filePath) => factory.class.fromFile({
|
|
11026
11300
|
baseDir: this.baseDir,
|
|
11027
|
-
relativeFilePath: (0,
|
|
11301
|
+
relativeFilePath: (0, import_node_path93.basename)(filePath),
|
|
11028
11302
|
global: this.global
|
|
11029
11303
|
})
|
|
11030
11304
|
)
|
|
@@ -11036,14 +11310,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11036
11310
|
return [];
|
|
11037
11311
|
}
|
|
11038
11312
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
11039
|
-
(0,
|
|
11313
|
+
(0, import_node_path93.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
11040
11314
|
);
|
|
11041
11315
|
if (forDeletion) {
|
|
11042
11316
|
return nonRootFilePaths.map(
|
|
11043
11317
|
(filePath) => factory.class.forDeletion({
|
|
11044
11318
|
baseDir: this.baseDir,
|
|
11045
11319
|
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
11046
|
-
relativeFilePath: (0,
|
|
11320
|
+
relativeFilePath: (0, import_node_path93.basename)(filePath),
|
|
11047
11321
|
global: this.global
|
|
11048
11322
|
})
|
|
11049
11323
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11052,7 +11326,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11052
11326
|
nonRootFilePaths.map(
|
|
11053
11327
|
(filePath) => factory.class.fromFile({
|
|
11054
11328
|
baseDir: this.baseDir,
|
|
11055
|
-
relativeFilePath: (0,
|
|
11329
|
+
relativeFilePath: (0, import_node_path93.basename)(filePath),
|
|
11056
11330
|
global: this.global
|
|
11057
11331
|
})
|
|
11058
11332
|
)
|
|
@@ -11145,14 +11419,14 @@ s/<command> [arguments]
|
|
|
11145
11419
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
11146
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.
|
|
11147
11421
|
|
|
11148
|
-
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.` : "";
|
|
11149
11423
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
11150
11424
|
|
|
11151
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.
|
|
11152
11426
|
|
|
11153
|
-
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.
|
|
11154
11428
|
|
|
11155
|
-
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.` : "";
|
|
11156
11430
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
11157
11431
|
const result = [
|
|
11158
11432
|
overview,
|
|
@@ -11434,13 +11708,17 @@ async function generateSkills(config) {
|
|
|
11434
11708
|
}
|
|
11435
11709
|
|
|
11436
11710
|
// src/cli/commands/gitignore.ts
|
|
11437
|
-
var
|
|
11711
|
+
var import_node_path94 = require("path");
|
|
11438
11712
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
11439
11713
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
11440
11714
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
11441
11715
|
// AGENTS.md
|
|
11442
11716
|
"**/AGENTS.md",
|
|
11443
11717
|
"**/.agents/",
|
|
11718
|
+
// Antigravity
|
|
11719
|
+
"**/.agent/rules/",
|
|
11720
|
+
"**/.agent/skills/",
|
|
11721
|
+
"**/.agent/workflows/",
|
|
11444
11722
|
// Augment
|
|
11445
11723
|
"**/.augmentignore",
|
|
11446
11724
|
"**/.augment/rules/",
|
|
@@ -11462,8 +11740,9 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11462
11740
|
"**/.cline/mcp.json",
|
|
11463
11741
|
// Codex
|
|
11464
11742
|
"**/.codexignore",
|
|
11465
|
-
"**/.codex/",
|
|
11743
|
+
"**/.codex/memories/",
|
|
11466
11744
|
"**/.codex/skills/",
|
|
11745
|
+
"**/.codex/subagents/",
|
|
11467
11746
|
// Cursor
|
|
11468
11747
|
"**/.cursor/",
|
|
11469
11748
|
"**/.cursorignore",
|
|
@@ -11492,6 +11771,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11492
11771
|
"**/.kilocodeignore",
|
|
11493
11772
|
// Kiro
|
|
11494
11773
|
"**/.kiro/steering/",
|
|
11774
|
+
"**/.kiro/settings/mcp.json",
|
|
11495
11775
|
"**/.aiignore",
|
|
11496
11776
|
// OpenCode
|
|
11497
11777
|
"**/.opencode/memories/",
|
|
@@ -11564,7 +11844,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
11564
11844
|
return result;
|
|
11565
11845
|
};
|
|
11566
11846
|
var gitignoreCommand = async () => {
|
|
11567
|
-
const gitignorePath = (0,
|
|
11847
|
+
const gitignorePath = (0, import_node_path94.join)(process.cwd(), ".gitignore");
|
|
11568
11848
|
let gitignoreContent = "";
|
|
11569
11849
|
if (await fileExists(gitignorePath)) {
|
|
11570
11850
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -11763,7 +12043,7 @@ async function importSkills(config, tool) {
|
|
|
11763
12043
|
}
|
|
11764
12044
|
|
|
11765
12045
|
// src/cli/commands/init.ts
|
|
11766
|
-
var
|
|
12046
|
+
var import_node_path95 = require("path");
|
|
11767
12047
|
async function initCommand() {
|
|
11768
12048
|
logger.info("Initializing rulesync...");
|
|
11769
12049
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -11772,7 +12052,7 @@ async function initCommand() {
|
|
|
11772
12052
|
logger.success("rulesync initialized successfully!");
|
|
11773
12053
|
logger.info("Next steps:");
|
|
11774
12054
|
logger.info(
|
|
11775
|
-
`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}`
|
|
11776
12056
|
);
|
|
11777
12057
|
logger.info("2. Run 'rulesync generate' to create configuration files");
|
|
11778
12058
|
}
|
|
@@ -11786,13 +12066,14 @@ async function createConfigFile() {
|
|
|
11786
12066
|
JSON.stringify(
|
|
11787
12067
|
{
|
|
11788
12068
|
targets: ["copilot", "cursor", "claudecode", "codexcli"],
|
|
11789
|
-
features: ["rules", "ignore", "mcp", "commands", "subagents"],
|
|
12069
|
+
features: ["rules", "ignore", "mcp", "commands", "subagents", "skills"],
|
|
11790
12070
|
baseDirs: ["."],
|
|
11791
12071
|
delete: true,
|
|
11792
12072
|
verbose: false,
|
|
11793
12073
|
global: false,
|
|
11794
12074
|
simulateCommands: false,
|
|
11795
12075
|
simulateSubagents: false,
|
|
12076
|
+
simulateSkills: false,
|
|
11796
12077
|
modularMcp: false
|
|
11797
12078
|
},
|
|
11798
12079
|
null,
|
|
@@ -11911,6 +12192,18 @@ Based on the user's instruction, create a plan while analyzing the related files
|
|
|
11911
12192
|
|
|
11912
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.
|
|
11913
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.`
|
|
11914
12207
|
};
|
|
11915
12208
|
const sampleIgnoreFile = {
|
|
11916
12209
|
content: `credentials/
|
|
@@ -11920,20 +12213,22 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11920
12213
|
const mcpPaths = RulesyncMcp.getSettablePaths();
|
|
11921
12214
|
const commandPaths = RulesyncCommand.getSettablePaths();
|
|
11922
12215
|
const subagentPaths = RulesyncSubagent.getSettablePaths();
|
|
12216
|
+
const skillPaths = RulesyncSkill.getSettablePaths();
|
|
11923
12217
|
const ignorePaths = RulesyncIgnore.getSettablePaths();
|
|
11924
12218
|
await ensureDir(rulePaths.recommended.relativeDirPath);
|
|
11925
12219
|
await ensureDir(mcpPaths.recommended.relativeDirPath);
|
|
11926
12220
|
await ensureDir(commandPaths.relativeDirPath);
|
|
11927
12221
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
12222
|
+
await ensureDir(skillPaths.relativeDirPath);
|
|
11928
12223
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
11929
|
-
const ruleFilepath = (0,
|
|
12224
|
+
const ruleFilepath = (0, import_node_path95.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
11930
12225
|
if (!await fileExists(ruleFilepath)) {
|
|
11931
12226
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
11932
12227
|
logger.success(`Created ${ruleFilepath}`);
|
|
11933
12228
|
} else {
|
|
11934
12229
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
11935
12230
|
}
|
|
11936
|
-
const mcpFilepath = (0,
|
|
12231
|
+
const mcpFilepath = (0, import_node_path95.join)(
|
|
11937
12232
|
mcpPaths.recommended.relativeDirPath,
|
|
11938
12233
|
mcpPaths.recommended.relativeFilePath
|
|
11939
12234
|
);
|
|
@@ -11943,21 +12238,30 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11943
12238
|
} else {
|
|
11944
12239
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
11945
12240
|
}
|
|
11946
|
-
const commandFilepath = (0,
|
|
12241
|
+
const commandFilepath = (0, import_node_path95.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
11947
12242
|
if (!await fileExists(commandFilepath)) {
|
|
11948
12243
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
11949
12244
|
logger.success(`Created ${commandFilepath}`);
|
|
11950
12245
|
} else {
|
|
11951
12246
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
11952
12247
|
}
|
|
11953
|
-
const subagentFilepath = (0,
|
|
12248
|
+
const subagentFilepath = (0, import_node_path95.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
11954
12249
|
if (!await fileExists(subagentFilepath)) {
|
|
11955
12250
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
11956
12251
|
logger.success(`Created ${subagentFilepath}`);
|
|
11957
12252
|
} else {
|
|
11958
12253
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
11959
12254
|
}
|
|
11960
|
-
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)(
|
|
11961
12265
|
ignorePaths.recommended.relativeDirPath,
|
|
11962
12266
|
ignorePaths.recommended.relativeFilePath
|
|
11963
12267
|
);
|
|
@@ -11973,15 +12277,15 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11973
12277
|
var import_fastmcp = require("fastmcp");
|
|
11974
12278
|
|
|
11975
12279
|
// src/mcp/tools.ts
|
|
11976
|
-
var
|
|
12280
|
+
var import_mini49 = require("zod/mini");
|
|
11977
12281
|
|
|
11978
12282
|
// src/mcp/commands.ts
|
|
11979
|
-
var
|
|
11980
|
-
var
|
|
12283
|
+
var import_node_path96 = require("path");
|
|
12284
|
+
var import_mini43 = require("zod/mini");
|
|
11981
12285
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
11982
12286
|
var maxCommandsCount = 1e3;
|
|
11983
12287
|
async function listCommands() {
|
|
11984
|
-
const commandsDir = (0,
|
|
12288
|
+
const commandsDir = (0, import_node_path96.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
11985
12289
|
try {
|
|
11986
12290
|
const files = await listDirectoryFiles(commandsDir);
|
|
11987
12291
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -11993,7 +12297,7 @@ async function listCommands() {
|
|
|
11993
12297
|
});
|
|
11994
12298
|
const frontmatter = command.getFrontmatter();
|
|
11995
12299
|
return {
|
|
11996
|
-
relativePathFromCwd: (0,
|
|
12300
|
+
relativePathFromCwd: (0, import_node_path96.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
11997
12301
|
frontmatter
|
|
11998
12302
|
};
|
|
11999
12303
|
} catch (error) {
|
|
@@ -12013,13 +12317,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
12013
12317
|
relativePath: relativePathFromCwd,
|
|
12014
12318
|
intendedRootDir: process.cwd()
|
|
12015
12319
|
});
|
|
12016
|
-
const filename = (0,
|
|
12320
|
+
const filename = (0, import_node_path96.basename)(relativePathFromCwd);
|
|
12017
12321
|
try {
|
|
12018
12322
|
const command = await RulesyncCommand.fromFile({
|
|
12019
12323
|
relativeFilePath: filename
|
|
12020
12324
|
});
|
|
12021
12325
|
return {
|
|
12022
|
-
relativePathFromCwd: (0,
|
|
12326
|
+
relativePathFromCwd: (0, import_node_path96.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12023
12327
|
frontmatter: command.getFrontmatter(),
|
|
12024
12328
|
body: command.getBody()
|
|
12025
12329
|
};
|
|
@@ -12038,7 +12342,7 @@ async function putCommand({
|
|
|
12038
12342
|
relativePath: relativePathFromCwd,
|
|
12039
12343
|
intendedRootDir: process.cwd()
|
|
12040
12344
|
});
|
|
12041
|
-
const filename = (0,
|
|
12345
|
+
const filename = (0, import_node_path96.basename)(relativePathFromCwd);
|
|
12042
12346
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12043
12347
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
12044
12348
|
throw new Error(
|
|
@@ -12048,7 +12352,7 @@ async function putCommand({
|
|
|
12048
12352
|
try {
|
|
12049
12353
|
const existingCommands = await listCommands();
|
|
12050
12354
|
const isUpdate = existingCommands.some(
|
|
12051
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
12355
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path96.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12052
12356
|
);
|
|
12053
12357
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
12054
12358
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -12063,11 +12367,11 @@ async function putCommand({
|
|
|
12063
12367
|
fileContent,
|
|
12064
12368
|
validate: true
|
|
12065
12369
|
});
|
|
12066
|
-
const commandsDir = (0,
|
|
12370
|
+
const commandsDir = (0, import_node_path96.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12067
12371
|
await ensureDir(commandsDir);
|
|
12068
12372
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
12069
12373
|
return {
|
|
12070
|
-
relativePathFromCwd: (0,
|
|
12374
|
+
relativePathFromCwd: (0, import_node_path96.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12071
12375
|
frontmatter: command.getFrontmatter(),
|
|
12072
12376
|
body: command.getBody()
|
|
12073
12377
|
};
|
|
@@ -12082,12 +12386,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12082
12386
|
relativePath: relativePathFromCwd,
|
|
12083
12387
|
intendedRootDir: process.cwd()
|
|
12084
12388
|
});
|
|
12085
|
-
const filename = (0,
|
|
12086
|
-
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);
|
|
12087
12391
|
try {
|
|
12088
12392
|
await removeFile(fullPath);
|
|
12089
12393
|
return {
|
|
12090
|
-
relativePathFromCwd: (0,
|
|
12394
|
+
relativePathFromCwd: (0, import_node_path96.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12091
12395
|
};
|
|
12092
12396
|
} catch (error) {
|
|
12093
12397
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12096,23 +12400,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12096
12400
|
}
|
|
12097
12401
|
}
|
|
12098
12402
|
var commandToolSchemas = {
|
|
12099
|
-
listCommands:
|
|
12100
|
-
getCommand:
|
|
12101
|
-
relativePathFromCwd:
|
|
12403
|
+
listCommands: import_mini43.z.object({}),
|
|
12404
|
+
getCommand: import_mini43.z.object({
|
|
12405
|
+
relativePathFromCwd: import_mini43.z.string()
|
|
12102
12406
|
}),
|
|
12103
|
-
putCommand:
|
|
12104
|
-
relativePathFromCwd:
|
|
12407
|
+
putCommand: import_mini43.z.object({
|
|
12408
|
+
relativePathFromCwd: import_mini43.z.string(),
|
|
12105
12409
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
12106
|
-
body:
|
|
12410
|
+
body: import_mini43.z.string()
|
|
12107
12411
|
}),
|
|
12108
|
-
deleteCommand:
|
|
12109
|
-
relativePathFromCwd:
|
|
12412
|
+
deleteCommand: import_mini43.z.object({
|
|
12413
|
+
relativePathFromCwd: import_mini43.z.string()
|
|
12110
12414
|
})
|
|
12111
12415
|
};
|
|
12112
12416
|
var commandTools = {
|
|
12113
12417
|
listCommands: {
|
|
12114
12418
|
name: "listCommands",
|
|
12115
|
-
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.`,
|
|
12116
12420
|
parameters: commandToolSchemas.listCommands,
|
|
12117
12421
|
execute: async () => {
|
|
12118
12422
|
const commands = await listCommands();
|
|
@@ -12154,11 +12458,11 @@ var commandTools = {
|
|
|
12154
12458
|
};
|
|
12155
12459
|
|
|
12156
12460
|
// src/mcp/ignore.ts
|
|
12157
|
-
var
|
|
12158
|
-
var
|
|
12461
|
+
var import_node_path97 = require("path");
|
|
12462
|
+
var import_mini44 = require("zod/mini");
|
|
12159
12463
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
12160
12464
|
async function getIgnoreFile() {
|
|
12161
|
-
const ignoreFilePath = (0,
|
|
12465
|
+
const ignoreFilePath = (0, import_node_path97.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12162
12466
|
try {
|
|
12163
12467
|
const content = await readFileContent(ignoreFilePath);
|
|
12164
12468
|
return {
|
|
@@ -12172,7 +12476,7 @@ async function getIgnoreFile() {
|
|
|
12172
12476
|
}
|
|
12173
12477
|
}
|
|
12174
12478
|
async function putIgnoreFile({ content }) {
|
|
12175
|
-
const ignoreFilePath = (0,
|
|
12479
|
+
const ignoreFilePath = (0, import_node_path97.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12176
12480
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
12177
12481
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
12178
12482
|
throw new Error(
|
|
@@ -12193,8 +12497,8 @@ async function putIgnoreFile({ content }) {
|
|
|
12193
12497
|
}
|
|
12194
12498
|
}
|
|
12195
12499
|
async function deleteIgnoreFile() {
|
|
12196
|
-
const aiignorePath = (0,
|
|
12197
|
-
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);
|
|
12198
12502
|
try {
|
|
12199
12503
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
12200
12504
|
return {
|
|
@@ -12212,11 +12516,11 @@ async function deleteIgnoreFile() {
|
|
|
12212
12516
|
}
|
|
12213
12517
|
}
|
|
12214
12518
|
var ignoreToolSchemas = {
|
|
12215
|
-
getIgnoreFile:
|
|
12216
|
-
putIgnoreFile:
|
|
12217
|
-
content:
|
|
12519
|
+
getIgnoreFile: import_mini44.z.object({}),
|
|
12520
|
+
putIgnoreFile: import_mini44.z.object({
|
|
12521
|
+
content: import_mini44.z.string()
|
|
12218
12522
|
}),
|
|
12219
|
-
deleteIgnoreFile:
|
|
12523
|
+
deleteIgnoreFile: import_mini44.z.object({})
|
|
12220
12524
|
};
|
|
12221
12525
|
var ignoreTools = {
|
|
12222
12526
|
getIgnoreFile: {
|
|
@@ -12249,8 +12553,8 @@ var ignoreTools = {
|
|
|
12249
12553
|
};
|
|
12250
12554
|
|
|
12251
12555
|
// src/mcp/mcp.ts
|
|
12252
|
-
var
|
|
12253
|
-
var
|
|
12556
|
+
var import_node_path98 = require("path");
|
|
12557
|
+
var import_mini45 = require("zod/mini");
|
|
12254
12558
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
12255
12559
|
async function getMcpFile() {
|
|
12256
12560
|
const config = await ConfigResolver.resolve({});
|
|
@@ -12259,7 +12563,7 @@ async function getMcpFile() {
|
|
|
12259
12563
|
validate: true,
|
|
12260
12564
|
modularMcp: config.getModularMcp()
|
|
12261
12565
|
});
|
|
12262
|
-
const relativePathFromCwd = (0,
|
|
12566
|
+
const relativePathFromCwd = (0, import_node_path98.join)(
|
|
12263
12567
|
rulesyncMcp.getRelativeDirPath(),
|
|
12264
12568
|
rulesyncMcp.getRelativeFilePath()
|
|
12265
12569
|
);
|
|
@@ -12292,7 +12596,7 @@ async function putMcpFile({ content }) {
|
|
|
12292
12596
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12293
12597
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
12294
12598
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
12295
|
-
const fullPath = (0,
|
|
12599
|
+
const fullPath = (0, import_node_path98.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
12296
12600
|
const rulesyncMcp = new RulesyncMcp({
|
|
12297
12601
|
baseDir,
|
|
12298
12602
|
relativeDirPath,
|
|
@@ -12301,9 +12605,9 @@ async function putMcpFile({ content }) {
|
|
|
12301
12605
|
validate: true,
|
|
12302
12606
|
modularMcp: config.getModularMcp()
|
|
12303
12607
|
});
|
|
12304
|
-
await ensureDir((0,
|
|
12608
|
+
await ensureDir((0, import_node_path98.join)(baseDir, relativeDirPath));
|
|
12305
12609
|
await writeFileContent(fullPath, content);
|
|
12306
|
-
const relativePathFromCwd = (0,
|
|
12610
|
+
const relativePathFromCwd = (0, import_node_path98.join)(relativeDirPath, relativeFilePath);
|
|
12307
12611
|
return {
|
|
12308
12612
|
relativePathFromCwd,
|
|
12309
12613
|
content: rulesyncMcp.getFileContent()
|
|
@@ -12318,15 +12622,15 @@ async function deleteMcpFile() {
|
|
|
12318
12622
|
try {
|
|
12319
12623
|
const baseDir = process.cwd();
|
|
12320
12624
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12321
|
-
const recommendedPath = (0,
|
|
12625
|
+
const recommendedPath = (0, import_node_path98.join)(
|
|
12322
12626
|
baseDir,
|
|
12323
12627
|
paths.recommended.relativeDirPath,
|
|
12324
12628
|
paths.recommended.relativeFilePath
|
|
12325
12629
|
);
|
|
12326
|
-
const legacyPath = (0,
|
|
12630
|
+
const legacyPath = (0, import_node_path98.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
12327
12631
|
await removeFile(recommendedPath);
|
|
12328
12632
|
await removeFile(legacyPath);
|
|
12329
|
-
const relativePathFromCwd = (0,
|
|
12633
|
+
const relativePathFromCwd = (0, import_node_path98.join)(
|
|
12330
12634
|
paths.recommended.relativeDirPath,
|
|
12331
12635
|
paths.recommended.relativeFilePath
|
|
12332
12636
|
);
|
|
@@ -12340,11 +12644,11 @@ async function deleteMcpFile() {
|
|
|
12340
12644
|
}
|
|
12341
12645
|
}
|
|
12342
12646
|
var mcpToolSchemas = {
|
|
12343
|
-
getMcpFile:
|
|
12344
|
-
putMcpFile:
|
|
12345
|
-
content:
|
|
12647
|
+
getMcpFile: import_mini45.z.object({}),
|
|
12648
|
+
putMcpFile: import_mini45.z.object({
|
|
12649
|
+
content: import_mini45.z.string()
|
|
12346
12650
|
}),
|
|
12347
|
-
deleteMcpFile:
|
|
12651
|
+
deleteMcpFile: import_mini45.z.object({})
|
|
12348
12652
|
};
|
|
12349
12653
|
var mcpTools = {
|
|
12350
12654
|
getMcpFile: {
|
|
@@ -12377,12 +12681,12 @@ var mcpTools = {
|
|
|
12377
12681
|
};
|
|
12378
12682
|
|
|
12379
12683
|
// src/mcp/rules.ts
|
|
12380
|
-
var
|
|
12381
|
-
var
|
|
12684
|
+
var import_node_path99 = require("path");
|
|
12685
|
+
var import_mini46 = require("zod/mini");
|
|
12382
12686
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
12383
12687
|
var maxRulesCount = 1e3;
|
|
12384
12688
|
async function listRules() {
|
|
12385
|
-
const rulesDir = (0,
|
|
12689
|
+
const rulesDir = (0, import_node_path99.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12386
12690
|
try {
|
|
12387
12691
|
const files = await listDirectoryFiles(rulesDir);
|
|
12388
12692
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12395,7 +12699,7 @@ async function listRules() {
|
|
|
12395
12699
|
});
|
|
12396
12700
|
const frontmatter = rule.getFrontmatter();
|
|
12397
12701
|
return {
|
|
12398
|
-
relativePathFromCwd: (0,
|
|
12702
|
+
relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
12399
12703
|
frontmatter
|
|
12400
12704
|
};
|
|
12401
12705
|
} catch (error) {
|
|
@@ -12415,14 +12719,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
12415
12719
|
relativePath: relativePathFromCwd,
|
|
12416
12720
|
intendedRootDir: process.cwd()
|
|
12417
12721
|
});
|
|
12418
|
-
const filename = (0,
|
|
12722
|
+
const filename = (0, import_node_path99.basename)(relativePathFromCwd);
|
|
12419
12723
|
try {
|
|
12420
12724
|
const rule = await RulesyncRule.fromFile({
|
|
12421
12725
|
relativeFilePath: filename,
|
|
12422
12726
|
validate: true
|
|
12423
12727
|
});
|
|
12424
12728
|
return {
|
|
12425
|
-
relativePathFromCwd: (0,
|
|
12729
|
+
relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12426
12730
|
frontmatter: rule.getFrontmatter(),
|
|
12427
12731
|
body: rule.getBody()
|
|
12428
12732
|
};
|
|
@@ -12441,7 +12745,7 @@ async function putRule({
|
|
|
12441
12745
|
relativePath: relativePathFromCwd,
|
|
12442
12746
|
intendedRootDir: process.cwd()
|
|
12443
12747
|
});
|
|
12444
|
-
const filename = (0,
|
|
12748
|
+
const filename = (0, import_node_path99.basename)(relativePathFromCwd);
|
|
12445
12749
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12446
12750
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
12447
12751
|
throw new Error(
|
|
@@ -12451,7 +12755,7 @@ async function putRule({
|
|
|
12451
12755
|
try {
|
|
12452
12756
|
const existingRules = await listRules();
|
|
12453
12757
|
const isUpdate = existingRules.some(
|
|
12454
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
12758
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path99.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12455
12759
|
);
|
|
12456
12760
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
12457
12761
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -12464,11 +12768,11 @@ async function putRule({
|
|
|
12464
12768
|
body,
|
|
12465
12769
|
validate: true
|
|
12466
12770
|
});
|
|
12467
|
-
const rulesDir = (0,
|
|
12771
|
+
const rulesDir = (0, import_node_path99.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12468
12772
|
await ensureDir(rulesDir);
|
|
12469
12773
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
12470
12774
|
return {
|
|
12471
|
-
relativePathFromCwd: (0,
|
|
12775
|
+
relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12472
12776
|
frontmatter: rule.getFrontmatter(),
|
|
12473
12777
|
body: rule.getBody()
|
|
12474
12778
|
};
|
|
@@ -12483,12 +12787,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
12483
12787
|
relativePath: relativePathFromCwd,
|
|
12484
12788
|
intendedRootDir: process.cwd()
|
|
12485
12789
|
});
|
|
12486
|
-
const filename = (0,
|
|
12487
|
-
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);
|
|
12488
12792
|
try {
|
|
12489
12793
|
await removeFile(fullPath);
|
|
12490
12794
|
return {
|
|
12491
|
-
relativePathFromCwd: (0,
|
|
12795
|
+
relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12492
12796
|
};
|
|
12493
12797
|
} catch (error) {
|
|
12494
12798
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12497,23 +12801,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
12497
12801
|
}
|
|
12498
12802
|
}
|
|
12499
12803
|
var ruleToolSchemas = {
|
|
12500
|
-
listRules:
|
|
12501
|
-
getRule:
|
|
12502
|
-
relativePathFromCwd:
|
|
12804
|
+
listRules: import_mini46.z.object({}),
|
|
12805
|
+
getRule: import_mini46.z.object({
|
|
12806
|
+
relativePathFromCwd: import_mini46.z.string()
|
|
12503
12807
|
}),
|
|
12504
|
-
putRule:
|
|
12505
|
-
relativePathFromCwd:
|
|
12808
|
+
putRule: import_mini46.z.object({
|
|
12809
|
+
relativePathFromCwd: import_mini46.z.string(),
|
|
12506
12810
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
12507
|
-
body:
|
|
12811
|
+
body: import_mini46.z.string()
|
|
12508
12812
|
}),
|
|
12509
|
-
deleteRule:
|
|
12510
|
-
relativePathFromCwd:
|
|
12813
|
+
deleteRule: import_mini46.z.object({
|
|
12814
|
+
relativePathFromCwd: import_mini46.z.string()
|
|
12511
12815
|
})
|
|
12512
12816
|
};
|
|
12513
12817
|
var ruleTools = {
|
|
12514
12818
|
listRules: {
|
|
12515
12819
|
name: "listRules",
|
|
12516
|
-
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.`,
|
|
12517
12821
|
parameters: ruleToolSchemas.listRules,
|
|
12518
12822
|
execute: async () => {
|
|
12519
12823
|
const rules = await listRules();
|
|
@@ -12555,8 +12859,8 @@ var ruleTools = {
|
|
|
12555
12859
|
};
|
|
12556
12860
|
|
|
12557
12861
|
// src/mcp/skills.ts
|
|
12558
|
-
var
|
|
12559
|
-
var
|
|
12862
|
+
var import_node_path100 = require("path");
|
|
12863
|
+
var import_mini47 = require("zod/mini");
|
|
12560
12864
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
12561
12865
|
var maxSkillsCount = 1e3;
|
|
12562
12866
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -12572,19 +12876,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
12572
12876
|
};
|
|
12573
12877
|
}
|
|
12574
12878
|
function extractDirName(relativeDirPathFromCwd) {
|
|
12575
|
-
const dirName = (0,
|
|
12879
|
+
const dirName = (0, import_node_path100.basename)(relativeDirPathFromCwd);
|
|
12576
12880
|
if (!dirName) {
|
|
12577
12881
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
12578
12882
|
}
|
|
12579
12883
|
return dirName;
|
|
12580
12884
|
}
|
|
12581
12885
|
async function listSkills() {
|
|
12582
|
-
const skillsDir = (0,
|
|
12886
|
+
const skillsDir = (0, import_node_path100.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
12583
12887
|
try {
|
|
12584
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
12888
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path100.join)(skillsDir, "*"), { type: "dir" });
|
|
12585
12889
|
const skills = await Promise.all(
|
|
12586
12890
|
skillDirPaths.map(async (dirPath) => {
|
|
12587
|
-
const dirName = (0,
|
|
12891
|
+
const dirName = (0, import_node_path100.basename)(dirPath);
|
|
12588
12892
|
if (!dirName) return null;
|
|
12589
12893
|
try {
|
|
12590
12894
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -12592,7 +12896,7 @@ async function listSkills() {
|
|
|
12592
12896
|
});
|
|
12593
12897
|
const frontmatter = skill.getFrontmatter();
|
|
12594
12898
|
return {
|
|
12595
|
-
relativeDirPathFromCwd: (0,
|
|
12899
|
+
relativeDirPathFromCwd: (0, import_node_path100.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12596
12900
|
frontmatter
|
|
12597
12901
|
};
|
|
12598
12902
|
} catch (error) {
|
|
@@ -12618,7 +12922,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
12618
12922
|
dirName
|
|
12619
12923
|
});
|
|
12620
12924
|
return {
|
|
12621
|
-
relativeDirPathFromCwd: (0,
|
|
12925
|
+
relativeDirPathFromCwd: (0, import_node_path100.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12622
12926
|
frontmatter: skill.getFrontmatter(),
|
|
12623
12927
|
body: skill.getBody(),
|
|
12624
12928
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12652,7 +12956,7 @@ async function putSkill({
|
|
|
12652
12956
|
try {
|
|
12653
12957
|
const existingSkills = await listSkills();
|
|
12654
12958
|
const isUpdate = existingSkills.some(
|
|
12655
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
12959
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path100.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12656
12960
|
);
|
|
12657
12961
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
12658
12962
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -12667,9 +12971,9 @@ async function putSkill({
|
|
|
12667
12971
|
otherFiles: aiDirFiles,
|
|
12668
12972
|
validate: true
|
|
12669
12973
|
});
|
|
12670
|
-
const skillDirPath = (0,
|
|
12974
|
+
const skillDirPath = (0, import_node_path100.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12671
12975
|
await ensureDir(skillDirPath);
|
|
12672
|
-
const skillFilePath = (0,
|
|
12976
|
+
const skillFilePath = (0, import_node_path100.join)(skillDirPath, SKILL_FILE_NAME);
|
|
12673
12977
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
12674
12978
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
12675
12979
|
for (const file of otherFiles) {
|
|
@@ -12677,15 +12981,15 @@ async function putSkill({
|
|
|
12677
12981
|
relativePath: file.name,
|
|
12678
12982
|
intendedRootDir: skillDirPath
|
|
12679
12983
|
});
|
|
12680
|
-
const filePath = (0,
|
|
12681
|
-
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));
|
|
12682
12986
|
if (fileDir !== skillDirPath) {
|
|
12683
12987
|
await ensureDir(fileDir);
|
|
12684
12988
|
}
|
|
12685
12989
|
await writeFileContent(filePath, file.body);
|
|
12686
12990
|
}
|
|
12687
12991
|
return {
|
|
12688
|
-
relativeDirPathFromCwd: (0,
|
|
12992
|
+
relativeDirPathFromCwd: (0, import_node_path100.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12689
12993
|
frontmatter: skill.getFrontmatter(),
|
|
12690
12994
|
body: skill.getBody(),
|
|
12691
12995
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12707,13 +13011,13 @@ async function deleteSkill({
|
|
|
12707
13011
|
intendedRootDir: process.cwd()
|
|
12708
13012
|
});
|
|
12709
13013
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
12710
|
-
const skillDirPath = (0,
|
|
13014
|
+
const skillDirPath = (0, import_node_path100.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12711
13015
|
try {
|
|
12712
13016
|
if (await directoryExists(skillDirPath)) {
|
|
12713
13017
|
await removeDirectory(skillDirPath);
|
|
12714
13018
|
}
|
|
12715
13019
|
return {
|
|
12716
|
-
relativeDirPathFromCwd: (0,
|
|
13020
|
+
relativeDirPathFromCwd: (0, import_node_path100.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12717
13021
|
};
|
|
12718
13022
|
} catch (error) {
|
|
12719
13023
|
throw new Error(
|
|
@@ -12724,29 +13028,29 @@ async function deleteSkill({
|
|
|
12724
13028
|
);
|
|
12725
13029
|
}
|
|
12726
13030
|
}
|
|
12727
|
-
var McpSkillFileSchema =
|
|
12728
|
-
name:
|
|
12729
|
-
body:
|
|
13031
|
+
var McpSkillFileSchema = import_mini47.z.object({
|
|
13032
|
+
name: import_mini47.z.string(),
|
|
13033
|
+
body: import_mini47.z.string()
|
|
12730
13034
|
});
|
|
12731
13035
|
var skillToolSchemas = {
|
|
12732
|
-
listSkills:
|
|
12733
|
-
getSkill:
|
|
12734
|
-
relativeDirPathFromCwd:
|
|
13036
|
+
listSkills: import_mini47.z.object({}),
|
|
13037
|
+
getSkill: import_mini47.z.object({
|
|
13038
|
+
relativeDirPathFromCwd: import_mini47.z.string()
|
|
12735
13039
|
}),
|
|
12736
|
-
putSkill:
|
|
12737
|
-
relativeDirPathFromCwd:
|
|
13040
|
+
putSkill: import_mini47.z.object({
|
|
13041
|
+
relativeDirPathFromCwd: import_mini47.z.string(),
|
|
12738
13042
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
12739
|
-
body:
|
|
12740
|
-
otherFiles:
|
|
13043
|
+
body: import_mini47.z.string(),
|
|
13044
|
+
otherFiles: import_mini47.z.optional(import_mini47.z.array(McpSkillFileSchema))
|
|
12741
13045
|
}),
|
|
12742
|
-
deleteSkill:
|
|
12743
|
-
relativeDirPathFromCwd:
|
|
13046
|
+
deleteSkill: import_mini47.z.object({
|
|
13047
|
+
relativeDirPathFromCwd: import_mini47.z.string()
|
|
12744
13048
|
})
|
|
12745
13049
|
};
|
|
12746
13050
|
var skillTools = {
|
|
12747
13051
|
listSkills: {
|
|
12748
13052
|
name: "listSkills",
|
|
12749
|
-
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.`,
|
|
12750
13054
|
parameters: skillToolSchemas.listSkills,
|
|
12751
13055
|
execute: async () => {
|
|
12752
13056
|
const skills = await listSkills();
|
|
@@ -12789,12 +13093,12 @@ var skillTools = {
|
|
|
12789
13093
|
};
|
|
12790
13094
|
|
|
12791
13095
|
// src/mcp/subagents.ts
|
|
12792
|
-
var
|
|
12793
|
-
var
|
|
13096
|
+
var import_node_path101 = require("path");
|
|
13097
|
+
var import_mini48 = require("zod/mini");
|
|
12794
13098
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
12795
13099
|
var maxSubagentsCount = 1e3;
|
|
12796
13100
|
async function listSubagents() {
|
|
12797
|
-
const subagentsDir = (0,
|
|
13101
|
+
const subagentsDir = (0, import_node_path101.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12798
13102
|
try {
|
|
12799
13103
|
const files = await listDirectoryFiles(subagentsDir);
|
|
12800
13104
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12807,7 +13111,7 @@ async function listSubagents() {
|
|
|
12807
13111
|
});
|
|
12808
13112
|
const frontmatter = subagent.getFrontmatter();
|
|
12809
13113
|
return {
|
|
12810
|
-
relativePathFromCwd: (0,
|
|
13114
|
+
relativePathFromCwd: (0, import_node_path101.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
12811
13115
|
frontmatter
|
|
12812
13116
|
};
|
|
12813
13117
|
} catch (error) {
|
|
@@ -12829,14 +13133,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
12829
13133
|
relativePath: relativePathFromCwd,
|
|
12830
13134
|
intendedRootDir: process.cwd()
|
|
12831
13135
|
});
|
|
12832
|
-
const filename = (0,
|
|
13136
|
+
const filename = (0, import_node_path101.basename)(relativePathFromCwd);
|
|
12833
13137
|
try {
|
|
12834
13138
|
const subagent = await RulesyncSubagent.fromFile({
|
|
12835
13139
|
relativeFilePath: filename,
|
|
12836
13140
|
validate: true
|
|
12837
13141
|
});
|
|
12838
13142
|
return {
|
|
12839
|
-
relativePathFromCwd: (0,
|
|
13143
|
+
relativePathFromCwd: (0, import_node_path101.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12840
13144
|
frontmatter: subagent.getFrontmatter(),
|
|
12841
13145
|
body: subagent.getBody()
|
|
12842
13146
|
};
|
|
@@ -12855,7 +13159,7 @@ async function putSubagent({
|
|
|
12855
13159
|
relativePath: relativePathFromCwd,
|
|
12856
13160
|
intendedRootDir: process.cwd()
|
|
12857
13161
|
});
|
|
12858
|
-
const filename = (0,
|
|
13162
|
+
const filename = (0, import_node_path101.basename)(relativePathFromCwd);
|
|
12859
13163
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12860
13164
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
12861
13165
|
throw new Error(
|
|
@@ -12865,7 +13169,7 @@ async function putSubagent({
|
|
|
12865
13169
|
try {
|
|
12866
13170
|
const existingSubagents = await listSubagents();
|
|
12867
13171
|
const isUpdate = existingSubagents.some(
|
|
12868
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
13172
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path101.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12869
13173
|
);
|
|
12870
13174
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
12871
13175
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -12878,11 +13182,11 @@ async function putSubagent({
|
|
|
12878
13182
|
body,
|
|
12879
13183
|
validate: true
|
|
12880
13184
|
});
|
|
12881
|
-
const subagentsDir = (0,
|
|
13185
|
+
const subagentsDir = (0, import_node_path101.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12882
13186
|
await ensureDir(subagentsDir);
|
|
12883
13187
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
12884
13188
|
return {
|
|
12885
|
-
relativePathFromCwd: (0,
|
|
13189
|
+
relativePathFromCwd: (0, import_node_path101.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12886
13190
|
frontmatter: subagent.getFrontmatter(),
|
|
12887
13191
|
body: subagent.getBody()
|
|
12888
13192
|
};
|
|
@@ -12897,12 +13201,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12897
13201
|
relativePath: relativePathFromCwd,
|
|
12898
13202
|
intendedRootDir: process.cwd()
|
|
12899
13203
|
});
|
|
12900
|
-
const filename = (0,
|
|
12901
|
-
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);
|
|
12902
13206
|
try {
|
|
12903
13207
|
await removeFile(fullPath);
|
|
12904
13208
|
return {
|
|
12905
|
-
relativePathFromCwd: (0,
|
|
13209
|
+
relativePathFromCwd: (0, import_node_path101.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12906
13210
|
};
|
|
12907
13211
|
} catch (error) {
|
|
12908
13212
|
throw new Error(
|
|
@@ -12914,23 +13218,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12914
13218
|
}
|
|
12915
13219
|
}
|
|
12916
13220
|
var subagentToolSchemas = {
|
|
12917
|
-
listSubagents:
|
|
12918
|
-
getSubagent:
|
|
12919
|
-
relativePathFromCwd:
|
|
13221
|
+
listSubagents: import_mini48.z.object({}),
|
|
13222
|
+
getSubagent: import_mini48.z.object({
|
|
13223
|
+
relativePathFromCwd: import_mini48.z.string()
|
|
12920
13224
|
}),
|
|
12921
|
-
putSubagent:
|
|
12922
|
-
relativePathFromCwd:
|
|
13225
|
+
putSubagent: import_mini48.z.object({
|
|
13226
|
+
relativePathFromCwd: import_mini48.z.string(),
|
|
12923
13227
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
12924
|
-
body:
|
|
13228
|
+
body: import_mini48.z.string()
|
|
12925
13229
|
}),
|
|
12926
|
-
deleteSubagent:
|
|
12927
|
-
relativePathFromCwd:
|
|
13230
|
+
deleteSubagent: import_mini48.z.object({
|
|
13231
|
+
relativePathFromCwd: import_mini48.z.string()
|
|
12928
13232
|
})
|
|
12929
13233
|
};
|
|
12930
13234
|
var subagentTools = {
|
|
12931
13235
|
listSubagents: {
|
|
12932
13236
|
name: "listSubagents",
|
|
12933
|
-
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.`,
|
|
12934
13238
|
parameters: subagentToolSchemas.listSubagents,
|
|
12935
13239
|
execute: async () => {
|
|
12936
13240
|
const subagents = await listSubagents();
|
|
@@ -12972,20 +13276,20 @@ var subagentTools = {
|
|
|
12972
13276
|
};
|
|
12973
13277
|
|
|
12974
13278
|
// src/mcp/tools.ts
|
|
12975
|
-
var rulesyncFeatureSchema =
|
|
12976
|
-
var rulesyncOperationSchema =
|
|
12977
|
-
var skillFileSchema =
|
|
12978
|
-
name:
|
|
12979
|
-
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()
|
|
12980
13284
|
});
|
|
12981
|
-
var rulesyncToolSchema =
|
|
13285
|
+
var rulesyncToolSchema = import_mini49.z.object({
|
|
12982
13286
|
feature: rulesyncFeatureSchema,
|
|
12983
13287
|
operation: rulesyncOperationSchema,
|
|
12984
|
-
targetPathFromCwd:
|
|
12985
|
-
frontmatter:
|
|
12986
|
-
body:
|
|
12987
|
-
otherFiles:
|
|
12988
|
-
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())
|
|
12989
13293
|
});
|
|
12990
13294
|
var supportedOperationsByFeature = {
|
|
12991
13295
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -13181,7 +13485,7 @@ async function mcpCommand({ version }) {
|
|
|
13181
13485
|
}
|
|
13182
13486
|
|
|
13183
13487
|
// src/cli/index.ts
|
|
13184
|
-
var getVersion = () => "5.
|
|
13488
|
+
var getVersion = () => "5.4.0";
|
|
13185
13489
|
var main = async () => {
|
|
13186
13490
|
const program = new import_commander.Command();
|
|
13187
13491
|
const version = getVersion();
|