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.js
CHANGED
|
@@ -4458,8 +4458,84 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4458
4458
|
}
|
|
4459
4459
|
};
|
|
4460
4460
|
|
|
4461
|
-
// src/features/mcp/
|
|
4461
|
+
// src/features/mcp/kiro-mcp.ts
|
|
4462
4462
|
import { join as join40 } from "path";
|
|
4463
|
+
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
4464
|
+
json;
|
|
4465
|
+
constructor(params) {
|
|
4466
|
+
super(params);
|
|
4467
|
+
this.json = JSON.parse(this.fileContent || "{}");
|
|
4468
|
+
}
|
|
4469
|
+
getJson() {
|
|
4470
|
+
return this.json;
|
|
4471
|
+
}
|
|
4472
|
+
static getSettablePaths() {
|
|
4473
|
+
return {
|
|
4474
|
+
relativeDirPath: join40(".kiro", "settings"),
|
|
4475
|
+
relativeFilePath: "mcp.json"
|
|
4476
|
+
};
|
|
4477
|
+
}
|
|
4478
|
+
static async fromFile({
|
|
4479
|
+
baseDir = process.cwd(),
|
|
4480
|
+
validate = true
|
|
4481
|
+
}) {
|
|
4482
|
+
const paths = this.getSettablePaths();
|
|
4483
|
+
const fileContent = await readOrInitializeFileContent(
|
|
4484
|
+
join40(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4485
|
+
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4486
|
+
);
|
|
4487
|
+
return new _KiroMcp({
|
|
4488
|
+
baseDir,
|
|
4489
|
+
relativeDirPath: paths.relativeDirPath,
|
|
4490
|
+
relativeFilePath: paths.relativeFilePath,
|
|
4491
|
+
fileContent,
|
|
4492
|
+
validate
|
|
4493
|
+
});
|
|
4494
|
+
}
|
|
4495
|
+
static fromRulesyncMcp({
|
|
4496
|
+
baseDir = process.cwd(),
|
|
4497
|
+
rulesyncMcp,
|
|
4498
|
+
validate = true
|
|
4499
|
+
}) {
|
|
4500
|
+
const paths = this.getSettablePaths();
|
|
4501
|
+
const fileContent = JSON.stringify(
|
|
4502
|
+
{ mcpServers: rulesyncMcp.getMcpServers({ type: "exposed" }) },
|
|
4503
|
+
null,
|
|
4504
|
+
2
|
|
4505
|
+
);
|
|
4506
|
+
return new _KiroMcp({
|
|
4507
|
+
baseDir,
|
|
4508
|
+
relativeDirPath: paths.relativeDirPath,
|
|
4509
|
+
relativeFilePath: paths.relativeFilePath,
|
|
4510
|
+
fileContent,
|
|
4511
|
+
validate
|
|
4512
|
+
});
|
|
4513
|
+
}
|
|
4514
|
+
toRulesyncMcp() {
|
|
4515
|
+
return this.toRulesyncMcpDefault({
|
|
4516
|
+
fileContent: JSON.stringify({ mcpServers: this.json.mcpServers ?? {} }, null, 2)
|
|
4517
|
+
});
|
|
4518
|
+
}
|
|
4519
|
+
validate() {
|
|
4520
|
+
return { success: true, error: null };
|
|
4521
|
+
}
|
|
4522
|
+
static forDeletion({
|
|
4523
|
+
baseDir = process.cwd(),
|
|
4524
|
+
relativeDirPath,
|
|
4525
|
+
relativeFilePath
|
|
4526
|
+
}) {
|
|
4527
|
+
return new _KiroMcp({
|
|
4528
|
+
baseDir,
|
|
4529
|
+
relativeDirPath,
|
|
4530
|
+
relativeFilePath,
|
|
4531
|
+
fileContent: "{}",
|
|
4532
|
+
validate: false
|
|
4533
|
+
});
|
|
4534
|
+
}
|
|
4535
|
+
};
|
|
4536
|
+
|
|
4537
|
+
// src/features/mcp/opencode-mcp.ts
|
|
4538
|
+
import { join as join41 } from "path";
|
|
4463
4539
|
import { z as z17 } from "zod/mini";
|
|
4464
4540
|
var OpencodeMcpLocalServerSchema = z17.object({
|
|
4465
4541
|
type: z17.literal("local"),
|
|
@@ -4583,7 +4659,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4583
4659
|
}) {
|
|
4584
4660
|
const paths = this.getSettablePaths({ global });
|
|
4585
4661
|
const fileContent = await readOrInitializeFileContent(
|
|
4586
|
-
|
|
4662
|
+
join41(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4587
4663
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4588
4664
|
);
|
|
4589
4665
|
const json = JSON.parse(fileContent);
|
|
@@ -4604,7 +4680,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4604
4680
|
}) {
|
|
4605
4681
|
const paths = this.getSettablePaths({ global });
|
|
4606
4682
|
const fileContent = await readOrInitializeFileContent(
|
|
4607
|
-
|
|
4683
|
+
join41(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4608
4684
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4609
4685
|
);
|
|
4610
4686
|
const json = JSON.parse(fileContent);
|
|
@@ -4648,7 +4724,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4648
4724
|
};
|
|
4649
4725
|
|
|
4650
4726
|
// src/features/mcp/roo-mcp.ts
|
|
4651
|
-
import { join as
|
|
4727
|
+
import { join as join42 } from "path";
|
|
4652
4728
|
function isRooMcpServers(value) {
|
|
4653
4729
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
4654
4730
|
}
|
|
@@ -4700,7 +4776,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4700
4776
|
validate = true
|
|
4701
4777
|
}) {
|
|
4702
4778
|
const fileContent = await readFileContent(
|
|
4703
|
-
|
|
4779
|
+
join42(
|
|
4704
4780
|
baseDir,
|
|
4705
4781
|
this.getSettablePaths().relativeDirPath,
|
|
4706
4782
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4765,6 +4841,7 @@ var mcpProcessorToolTargetTuple = [
|
|
|
4765
4841
|
"cursor",
|
|
4766
4842
|
"geminicli",
|
|
4767
4843
|
"kilo",
|
|
4844
|
+
"kiro",
|
|
4768
4845
|
"junie",
|
|
4769
4846
|
"opencode",
|
|
4770
4847
|
"roo"
|
|
@@ -4827,6 +4904,13 @@ var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
|
4827
4904
|
meta: { supportsProject: true, supportsGlobal: false, supportsModular: false }
|
|
4828
4905
|
}
|
|
4829
4906
|
],
|
|
4907
|
+
[
|
|
4908
|
+
"kiro",
|
|
4909
|
+
{
|
|
4910
|
+
class: KiroMcp,
|
|
4911
|
+
meta: { supportsProject: true, supportsGlobal: false, supportsModular: false }
|
|
4912
|
+
}
|
|
4913
|
+
],
|
|
4830
4914
|
[
|
|
4831
4915
|
"junie",
|
|
4832
4916
|
{
|
|
@@ -5007,24 +5091,24 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
5007
5091
|
|
|
5008
5092
|
// src/features/rules/rules-processor.ts
|
|
5009
5093
|
import { encode } from "@toon-format/toon";
|
|
5010
|
-
import { basename as basename23, join as
|
|
5011
|
-
import { z as
|
|
5094
|
+
import { basename as basename23, join as join91 } from "path";
|
|
5095
|
+
import { z as z42 } from "zod/mini";
|
|
5012
5096
|
|
|
5013
5097
|
// src/constants/general.ts
|
|
5014
5098
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
5015
5099
|
|
|
5016
5100
|
// src/features/skills/agentsmd-skill.ts
|
|
5017
|
-
import { join as
|
|
5101
|
+
import { join as join46 } from "path";
|
|
5018
5102
|
|
|
5019
5103
|
// src/features/skills/simulated-skill.ts
|
|
5020
|
-
import { join as
|
|
5104
|
+
import { join as join45 } from "path";
|
|
5021
5105
|
import { z as z19 } from "zod/mini";
|
|
5022
5106
|
|
|
5023
5107
|
// src/features/skills/tool-skill.ts
|
|
5024
|
-
import { join as
|
|
5108
|
+
import { join as join44 } from "path";
|
|
5025
5109
|
|
|
5026
5110
|
// src/types/ai-dir.ts
|
|
5027
|
-
import path2, { basename as basename15, join as
|
|
5111
|
+
import path2, { basename as basename15, join as join43, relative as relative3, resolve as resolve4 } from "path";
|
|
5028
5112
|
var AiDir = class {
|
|
5029
5113
|
/**
|
|
5030
5114
|
* @example "."
|
|
@@ -5118,8 +5202,8 @@ var AiDir = class {
|
|
|
5118
5202
|
* @returns Array of files with their relative paths and buffers
|
|
5119
5203
|
*/
|
|
5120
5204
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
5121
|
-
const dirPath =
|
|
5122
|
-
const glob =
|
|
5205
|
+
const dirPath = join43(baseDir, relativeDirPath, dirName);
|
|
5206
|
+
const glob = join43(dirPath, "**", "*");
|
|
5123
5207
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
5124
5208
|
const filteredPaths = filePaths.filter((filePath) => basename15(filePath) !== excludeFileName);
|
|
5125
5209
|
const files = await Promise.all(
|
|
@@ -5217,8 +5301,8 @@ var ToolSkill = class extends AiDir {
|
|
|
5217
5301
|
}) {
|
|
5218
5302
|
const settablePaths = getSettablePaths({ global });
|
|
5219
5303
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5220
|
-
const skillDirPath =
|
|
5221
|
-
const skillFilePath =
|
|
5304
|
+
const skillDirPath = join44(baseDir, actualRelativeDirPath, dirName);
|
|
5305
|
+
const skillFilePath = join44(skillDirPath, SKILL_FILE_NAME);
|
|
5222
5306
|
if (!await fileExists(skillFilePath)) {
|
|
5223
5307
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5224
5308
|
}
|
|
@@ -5276,7 +5360,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5276
5360
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
5277
5361
|
if (!result.success) {
|
|
5278
5362
|
throw new Error(
|
|
5279
|
-
`Invalid frontmatter in ${
|
|
5363
|
+
`Invalid frontmatter in ${join45(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
5280
5364
|
);
|
|
5281
5365
|
}
|
|
5282
5366
|
}
|
|
@@ -5334,8 +5418,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5334
5418
|
}) {
|
|
5335
5419
|
const settablePaths = this.getSettablePaths();
|
|
5336
5420
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5337
|
-
const skillDirPath =
|
|
5338
|
-
const skillFilePath =
|
|
5421
|
+
const skillDirPath = join45(baseDir, actualRelativeDirPath, dirName);
|
|
5422
|
+
const skillFilePath = join45(skillDirPath, SKILL_FILE_NAME);
|
|
5339
5423
|
if (!await fileExists(skillFilePath)) {
|
|
5340
5424
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5341
5425
|
}
|
|
@@ -5412,7 +5496,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5412
5496
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
5413
5497
|
}
|
|
5414
5498
|
return {
|
|
5415
|
-
relativeDirPath:
|
|
5499
|
+
relativeDirPath: join46(".agents", "skills")
|
|
5416
5500
|
};
|
|
5417
5501
|
}
|
|
5418
5502
|
static async fromDir(params) {
|
|
@@ -5439,14 +5523,14 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5439
5523
|
};
|
|
5440
5524
|
|
|
5441
5525
|
// src/features/skills/geminicli-skill.ts
|
|
5442
|
-
import { join as
|
|
5526
|
+
import { join as join47 } from "path";
|
|
5443
5527
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5444
5528
|
static getSettablePaths(options) {
|
|
5445
5529
|
if (options?.global) {
|
|
5446
5530
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5447
5531
|
}
|
|
5448
5532
|
return {
|
|
5449
|
-
relativeDirPath:
|
|
5533
|
+
relativeDirPath: join47(".gemini", "skills")
|
|
5450
5534
|
};
|
|
5451
5535
|
}
|
|
5452
5536
|
static async fromDir(params) {
|
|
@@ -5473,11 +5557,11 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
|
5473
5557
|
};
|
|
5474
5558
|
|
|
5475
5559
|
// src/features/skills/skills-processor.ts
|
|
5476
|
-
import { basename as basename16, join as
|
|
5477
|
-
import { z as
|
|
5560
|
+
import { basename as basename16, join as join58 } from "path";
|
|
5561
|
+
import { z as z29 } from "zod/mini";
|
|
5478
5562
|
|
|
5479
5563
|
// src/types/dir-feature-processor.ts
|
|
5480
|
-
import { join as
|
|
5564
|
+
import { join as join48 } from "path";
|
|
5481
5565
|
var DirFeatureProcessor = class {
|
|
5482
5566
|
baseDir;
|
|
5483
5567
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -5499,14 +5583,14 @@ var DirFeatureProcessor = class {
|
|
|
5499
5583
|
await ensureDir(dirPath);
|
|
5500
5584
|
const mainFile = aiDir.getMainFile();
|
|
5501
5585
|
if (mainFile) {
|
|
5502
|
-
const mainFilePath =
|
|
5586
|
+
const mainFilePath = join48(dirPath, mainFile.name);
|
|
5503
5587
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5504
5588
|
const contentWithNewline = addTrailingNewline(content);
|
|
5505
5589
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5506
5590
|
}
|
|
5507
5591
|
const otherFiles = aiDir.getOtherFiles();
|
|
5508
5592
|
for (const file of otherFiles) {
|
|
5509
|
-
const filePath =
|
|
5593
|
+
const filePath = join48(dirPath, file.relativeFilePathToDirPath);
|
|
5510
5594
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5511
5595
|
await writeFileContent(filePath, contentWithNewline);
|
|
5512
5596
|
}
|
|
@@ -5520,12 +5604,12 @@ var DirFeatureProcessor = class {
|
|
|
5520
5604
|
}
|
|
5521
5605
|
};
|
|
5522
5606
|
|
|
5523
|
-
// src/features/skills/
|
|
5524
|
-
import { join as
|
|
5607
|
+
// src/features/skills/antigravity-skill.ts
|
|
5608
|
+
import { join as join50 } from "path";
|
|
5525
5609
|
import { z as z21 } from "zod/mini";
|
|
5526
5610
|
|
|
5527
5611
|
// src/features/skills/rulesync-skill.ts
|
|
5528
|
-
import { join as
|
|
5612
|
+
import { join as join49 } from "path";
|
|
5529
5613
|
import { z as z20 } from "zod/mini";
|
|
5530
5614
|
var RulesyncSkillFrontmatterSchemaInternal = z20.looseObject({
|
|
5531
5615
|
name: z20.string(),
|
|
@@ -5536,6 +5620,11 @@ var RulesyncSkillFrontmatterSchemaInternal = z20.looseObject({
|
|
|
5536
5620
|
"allowed-tools": z20.optional(z20.array(z20.string()))
|
|
5537
5621
|
})
|
|
5538
5622
|
),
|
|
5623
|
+
codexcli: z20.optional(
|
|
5624
|
+
z20.looseObject({
|
|
5625
|
+
"short-description": z20.optional(z20.string())
|
|
5626
|
+
})
|
|
5627
|
+
),
|
|
5539
5628
|
opencode: z20.optional(
|
|
5540
5629
|
z20.looseObject({
|
|
5541
5630
|
"allowed-tools": z20.optional(z20.array(z20.string()))
|
|
@@ -5612,8 +5701,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5612
5701
|
dirName,
|
|
5613
5702
|
global = false
|
|
5614
5703
|
}) {
|
|
5615
|
-
const skillDirPath =
|
|
5616
|
-
const skillFilePath =
|
|
5704
|
+
const skillDirPath = join49(baseDir, relativeDirPath, dirName);
|
|
5705
|
+
const skillFilePath = join49(skillDirPath, SKILL_FILE_NAME);
|
|
5617
5706
|
if (!await fileExists(skillFilePath)) {
|
|
5618
5707
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5619
5708
|
}
|
|
@@ -5642,16 +5731,179 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5642
5731
|
}
|
|
5643
5732
|
};
|
|
5644
5733
|
|
|
5645
|
-
// src/features/skills/
|
|
5646
|
-
var
|
|
5734
|
+
// src/features/skills/antigravity-skill.ts
|
|
5735
|
+
var AntigravitySkillFrontmatterSchema = z21.looseObject({
|
|
5647
5736
|
name: z21.string(),
|
|
5648
|
-
description: z21.string()
|
|
5649
|
-
|
|
5737
|
+
description: z21.string()
|
|
5738
|
+
});
|
|
5739
|
+
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
5740
|
+
constructor({
|
|
5741
|
+
baseDir = process.cwd(),
|
|
5742
|
+
relativeDirPath = join50(".agent", "skills"),
|
|
5743
|
+
dirName,
|
|
5744
|
+
frontmatter,
|
|
5745
|
+
body,
|
|
5746
|
+
otherFiles = [],
|
|
5747
|
+
validate = true,
|
|
5748
|
+
global = false
|
|
5749
|
+
}) {
|
|
5750
|
+
super({
|
|
5751
|
+
baseDir,
|
|
5752
|
+
relativeDirPath,
|
|
5753
|
+
dirName,
|
|
5754
|
+
mainFile: {
|
|
5755
|
+
name: SKILL_FILE_NAME,
|
|
5756
|
+
body,
|
|
5757
|
+
frontmatter: { ...frontmatter }
|
|
5758
|
+
},
|
|
5759
|
+
otherFiles,
|
|
5760
|
+
global
|
|
5761
|
+
});
|
|
5762
|
+
if (validate) {
|
|
5763
|
+
const result = this.validate();
|
|
5764
|
+
if (!result.success) {
|
|
5765
|
+
throw result.error;
|
|
5766
|
+
}
|
|
5767
|
+
}
|
|
5768
|
+
}
|
|
5769
|
+
static getSettablePaths({
|
|
5770
|
+
global = false
|
|
5771
|
+
} = {}) {
|
|
5772
|
+
if (global) {
|
|
5773
|
+
return {
|
|
5774
|
+
relativeDirPath: join50(".gemini", "antigravity", "skills")
|
|
5775
|
+
};
|
|
5776
|
+
}
|
|
5777
|
+
return {
|
|
5778
|
+
relativeDirPath: join50(".agent", "skills")
|
|
5779
|
+
};
|
|
5780
|
+
}
|
|
5781
|
+
getFrontmatter() {
|
|
5782
|
+
if (!this.mainFile?.frontmatter) {
|
|
5783
|
+
throw new Error("Frontmatter is not defined");
|
|
5784
|
+
}
|
|
5785
|
+
const result = AntigravitySkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
5786
|
+
return result;
|
|
5787
|
+
}
|
|
5788
|
+
getBody() {
|
|
5789
|
+
return this.mainFile?.body ?? "";
|
|
5790
|
+
}
|
|
5791
|
+
validate() {
|
|
5792
|
+
if (this.mainFile === void 0) {
|
|
5793
|
+
return {
|
|
5794
|
+
success: false,
|
|
5795
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
5796
|
+
};
|
|
5797
|
+
}
|
|
5798
|
+
const result = AntigravitySkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
5799
|
+
if (!result.success) {
|
|
5800
|
+
return {
|
|
5801
|
+
success: false,
|
|
5802
|
+
error: new Error(
|
|
5803
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
5804
|
+
)
|
|
5805
|
+
};
|
|
5806
|
+
}
|
|
5807
|
+
return { success: true, error: null };
|
|
5808
|
+
}
|
|
5809
|
+
toRulesyncSkill() {
|
|
5810
|
+
const frontmatter = this.getFrontmatter();
|
|
5811
|
+
const rulesyncFrontmatter = {
|
|
5812
|
+
name: frontmatter.name,
|
|
5813
|
+
description: frontmatter.description,
|
|
5814
|
+
targets: ["*"]
|
|
5815
|
+
};
|
|
5816
|
+
return new RulesyncSkill({
|
|
5817
|
+
baseDir: this.baseDir,
|
|
5818
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
5819
|
+
dirName: this.getDirName(),
|
|
5820
|
+
frontmatter: rulesyncFrontmatter,
|
|
5821
|
+
body: this.getBody(),
|
|
5822
|
+
otherFiles: this.getOtherFiles(),
|
|
5823
|
+
validate: true,
|
|
5824
|
+
global: this.global
|
|
5825
|
+
});
|
|
5826
|
+
}
|
|
5827
|
+
static fromRulesyncSkill({
|
|
5828
|
+
rulesyncSkill,
|
|
5829
|
+
validate = true,
|
|
5830
|
+
global = false
|
|
5831
|
+
}) {
|
|
5832
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
5833
|
+
const antigravityFrontmatter = {
|
|
5834
|
+
name: rulesyncFrontmatter.name,
|
|
5835
|
+
description: rulesyncFrontmatter.description
|
|
5836
|
+
};
|
|
5837
|
+
const settablePaths = _AntigravitySkill.getSettablePaths({ global });
|
|
5838
|
+
return new _AntigravitySkill({
|
|
5839
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
5840
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
5841
|
+
dirName: rulesyncSkill.getDirName(),
|
|
5842
|
+
frontmatter: antigravityFrontmatter,
|
|
5843
|
+
body: rulesyncSkill.getBody(),
|
|
5844
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
5845
|
+
validate,
|
|
5846
|
+
global
|
|
5847
|
+
});
|
|
5848
|
+
}
|
|
5849
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
5850
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
5851
|
+
return targets.includes("*") || targets.includes("antigravity");
|
|
5852
|
+
}
|
|
5853
|
+
static async fromDir(params) {
|
|
5854
|
+
const loaded = await this.loadSkillDirContent({
|
|
5855
|
+
...params,
|
|
5856
|
+
getSettablePaths: _AntigravitySkill.getSettablePaths
|
|
5857
|
+
});
|
|
5858
|
+
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5859
|
+
if (!result.success) {
|
|
5860
|
+
const skillDirPath = join50(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5861
|
+
throw new Error(
|
|
5862
|
+
`Invalid frontmatter in ${join50(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5863
|
+
);
|
|
5864
|
+
}
|
|
5865
|
+
return new _AntigravitySkill({
|
|
5866
|
+
baseDir: loaded.baseDir,
|
|
5867
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
5868
|
+
dirName: loaded.dirName,
|
|
5869
|
+
frontmatter: result.data,
|
|
5870
|
+
body: loaded.body,
|
|
5871
|
+
otherFiles: loaded.otherFiles,
|
|
5872
|
+
validate: true,
|
|
5873
|
+
global: loaded.global
|
|
5874
|
+
});
|
|
5875
|
+
}
|
|
5876
|
+
static forDeletion({
|
|
5877
|
+
baseDir = process.cwd(),
|
|
5878
|
+
relativeDirPath,
|
|
5879
|
+
dirName,
|
|
5880
|
+
global = false
|
|
5881
|
+
}) {
|
|
5882
|
+
return new _AntigravitySkill({
|
|
5883
|
+
baseDir,
|
|
5884
|
+
relativeDirPath,
|
|
5885
|
+
dirName,
|
|
5886
|
+
frontmatter: { name: "", description: "" },
|
|
5887
|
+
body: "",
|
|
5888
|
+
otherFiles: [],
|
|
5889
|
+
validate: false,
|
|
5890
|
+
global
|
|
5891
|
+
});
|
|
5892
|
+
}
|
|
5893
|
+
};
|
|
5894
|
+
|
|
5895
|
+
// src/features/skills/claudecode-skill.ts
|
|
5896
|
+
import { join as join51 } from "path";
|
|
5897
|
+
import { z as z22 } from "zod/mini";
|
|
5898
|
+
var ClaudecodeSkillFrontmatterSchema = z22.looseObject({
|
|
5899
|
+
name: z22.string(),
|
|
5900
|
+
description: z22.string(),
|
|
5901
|
+
"allowed-tools": z22.optional(z22.array(z22.string()))
|
|
5650
5902
|
});
|
|
5651
5903
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
5652
5904
|
constructor({
|
|
5653
5905
|
baseDir = process.cwd(),
|
|
5654
|
-
relativeDirPath =
|
|
5906
|
+
relativeDirPath = join51(".claude", "skills"),
|
|
5655
5907
|
dirName,
|
|
5656
5908
|
frontmatter,
|
|
5657
5909
|
body,
|
|
@@ -5682,7 +5934,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5682
5934
|
global: _global = false
|
|
5683
5935
|
} = {}) {
|
|
5684
5936
|
return {
|
|
5685
|
-
relativeDirPath:
|
|
5937
|
+
relativeDirPath: join51(".claude", "skills")
|
|
5686
5938
|
};
|
|
5687
5939
|
}
|
|
5688
5940
|
getFrontmatter() {
|
|
@@ -5770,9 +6022,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5770
6022
|
});
|
|
5771
6023
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5772
6024
|
if (!result.success) {
|
|
5773
|
-
const skillDirPath =
|
|
6025
|
+
const skillDirPath = join51(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5774
6026
|
throw new Error(
|
|
5775
|
-
`Invalid frontmatter in ${
|
|
6027
|
+
`Invalid frontmatter in ${join51(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5776
6028
|
);
|
|
5777
6029
|
}
|
|
5778
6030
|
return new _ClaudecodeSkill({
|
|
@@ -5806,16 +6058,21 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5806
6058
|
};
|
|
5807
6059
|
|
|
5808
6060
|
// src/features/skills/codexcli-skill.ts
|
|
5809
|
-
import { join as
|
|
5810
|
-
import { z as
|
|
5811
|
-
var CodexCliSkillFrontmatterSchema =
|
|
5812
|
-
name:
|
|
5813
|
-
description:
|
|
6061
|
+
import { join as join52 } from "path";
|
|
6062
|
+
import { z as z23 } from "zod/mini";
|
|
6063
|
+
var CodexCliSkillFrontmatterSchema = z23.looseObject({
|
|
6064
|
+
name: z23.string(),
|
|
6065
|
+
description: z23.string(),
|
|
6066
|
+
metadata: z23.optional(
|
|
6067
|
+
z23.looseObject({
|
|
6068
|
+
"short-description": z23.optional(z23.string())
|
|
6069
|
+
})
|
|
6070
|
+
)
|
|
5814
6071
|
});
|
|
5815
6072
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
5816
6073
|
constructor({
|
|
5817
6074
|
baseDir = process.cwd(),
|
|
5818
|
-
relativeDirPath =
|
|
6075
|
+
relativeDirPath = join52(".codex", "skills"),
|
|
5819
6076
|
dirName,
|
|
5820
6077
|
frontmatter,
|
|
5821
6078
|
body,
|
|
@@ -5842,12 +6099,11 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5842
6099
|
}
|
|
5843
6100
|
}
|
|
5844
6101
|
}
|
|
5845
|
-
static getSettablePaths({
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
}
|
|
6102
|
+
static getSettablePaths({
|
|
6103
|
+
global: _global = false
|
|
6104
|
+
} = {}) {
|
|
5849
6105
|
return {
|
|
5850
|
-
relativeDirPath:
|
|
6106
|
+
relativeDirPath: join52(".codex", "skills")
|
|
5851
6107
|
};
|
|
5852
6108
|
}
|
|
5853
6109
|
getFrontmatter() {
|
|
@@ -5883,7 +6139,12 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5883
6139
|
const rulesyncFrontmatter = {
|
|
5884
6140
|
name: frontmatter.name,
|
|
5885
6141
|
description: frontmatter.description,
|
|
5886
|
-
targets: ["*"]
|
|
6142
|
+
targets: ["*"],
|
|
6143
|
+
...frontmatter.metadata?.["short-description"] && {
|
|
6144
|
+
codexcli: {
|
|
6145
|
+
"short-description": frontmatter.metadata["short-description"]
|
|
6146
|
+
}
|
|
6147
|
+
}
|
|
5887
6148
|
};
|
|
5888
6149
|
return new RulesyncSkill({
|
|
5889
6150
|
baseDir: this.baseDir,
|
|
@@ -5905,7 +6166,12 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5905
6166
|
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
5906
6167
|
const codexFrontmatter = {
|
|
5907
6168
|
name: rulesyncFrontmatter.name,
|
|
5908
|
-
description: rulesyncFrontmatter.description
|
|
6169
|
+
description: rulesyncFrontmatter.description,
|
|
6170
|
+
...rulesyncFrontmatter.codexcli?.["short-description"] && {
|
|
6171
|
+
metadata: {
|
|
6172
|
+
"short-description": rulesyncFrontmatter.codexcli["short-description"]
|
|
6173
|
+
}
|
|
6174
|
+
}
|
|
5909
6175
|
};
|
|
5910
6176
|
return new _CodexCliSkill({
|
|
5911
6177
|
baseDir: rulesyncSkill.getBaseDir(),
|
|
@@ -5929,9 +6195,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5929
6195
|
});
|
|
5930
6196
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5931
6197
|
if (!result.success) {
|
|
5932
|
-
const skillDirPath =
|
|
6198
|
+
const skillDirPath = join52(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5933
6199
|
throw new Error(
|
|
5934
|
-
`Invalid frontmatter in ${
|
|
6200
|
+
`Invalid frontmatter in ${join52(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5935
6201
|
);
|
|
5936
6202
|
}
|
|
5937
6203
|
return new _CodexCliSkill({
|
|
@@ -5965,17 +6231,17 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5965
6231
|
};
|
|
5966
6232
|
|
|
5967
6233
|
// src/features/skills/copilot-skill.ts
|
|
5968
|
-
import { join as
|
|
5969
|
-
import { z as
|
|
5970
|
-
var CopilotSkillFrontmatterSchema =
|
|
5971
|
-
name:
|
|
5972
|
-
description:
|
|
5973
|
-
license:
|
|
6234
|
+
import { join as join53 } from "path";
|
|
6235
|
+
import { z as z24 } from "zod/mini";
|
|
6236
|
+
var CopilotSkillFrontmatterSchema = z24.looseObject({
|
|
6237
|
+
name: z24.string(),
|
|
6238
|
+
description: z24.string(),
|
|
6239
|
+
license: z24.optional(z24.string())
|
|
5974
6240
|
});
|
|
5975
6241
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
5976
6242
|
constructor({
|
|
5977
6243
|
baseDir = process.cwd(),
|
|
5978
|
-
relativeDirPath =
|
|
6244
|
+
relativeDirPath = join53(".github", "skills"),
|
|
5979
6245
|
dirName,
|
|
5980
6246
|
frontmatter,
|
|
5981
6247
|
body,
|
|
@@ -6007,7 +6273,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6007
6273
|
throw new Error("CopilotSkill does not support global mode.");
|
|
6008
6274
|
}
|
|
6009
6275
|
return {
|
|
6010
|
-
relativeDirPath:
|
|
6276
|
+
relativeDirPath: join53(".github", "skills")
|
|
6011
6277
|
};
|
|
6012
6278
|
}
|
|
6013
6279
|
getFrontmatter() {
|
|
@@ -6095,9 +6361,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6095
6361
|
});
|
|
6096
6362
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6097
6363
|
if (!result.success) {
|
|
6098
|
-
const skillDirPath =
|
|
6364
|
+
const skillDirPath = join53(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6099
6365
|
throw new Error(
|
|
6100
|
-
`Invalid frontmatter in ${
|
|
6366
|
+
`Invalid frontmatter in ${join53(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6101
6367
|
);
|
|
6102
6368
|
}
|
|
6103
6369
|
return new _CopilotSkill({
|
|
@@ -6132,16 +6398,16 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6132
6398
|
};
|
|
6133
6399
|
|
|
6134
6400
|
// src/features/skills/cursor-skill.ts
|
|
6135
|
-
import { join as
|
|
6136
|
-
import { z as
|
|
6137
|
-
var CursorSkillFrontmatterSchema =
|
|
6138
|
-
name:
|
|
6139
|
-
description:
|
|
6401
|
+
import { join as join54 } from "path";
|
|
6402
|
+
import { z as z25 } from "zod/mini";
|
|
6403
|
+
var CursorSkillFrontmatterSchema = z25.looseObject({
|
|
6404
|
+
name: z25.string(),
|
|
6405
|
+
description: z25.string()
|
|
6140
6406
|
});
|
|
6141
6407
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
6142
6408
|
constructor({
|
|
6143
6409
|
baseDir = process.cwd(),
|
|
6144
|
-
relativeDirPath =
|
|
6410
|
+
relativeDirPath = join54(".cursor", "skills"),
|
|
6145
6411
|
dirName,
|
|
6146
6412
|
frontmatter,
|
|
6147
6413
|
body,
|
|
@@ -6173,7 +6439,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6173
6439
|
throw new Error("CursorSkill does not support global mode.");
|
|
6174
6440
|
}
|
|
6175
6441
|
return {
|
|
6176
|
-
relativeDirPath:
|
|
6442
|
+
relativeDirPath: join54(".cursor", "skills")
|
|
6177
6443
|
};
|
|
6178
6444
|
}
|
|
6179
6445
|
getFrontmatter() {
|
|
@@ -6255,9 +6521,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6255
6521
|
});
|
|
6256
6522
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6257
6523
|
if (!result.success) {
|
|
6258
|
-
const skillDirPath =
|
|
6524
|
+
const skillDirPath = join54(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6259
6525
|
throw new Error(
|
|
6260
|
-
`Invalid frontmatter in ${
|
|
6526
|
+
`Invalid frontmatter in ${join54(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6261
6527
|
);
|
|
6262
6528
|
}
|
|
6263
6529
|
return new _CursorSkill({
|
|
@@ -6292,16 +6558,16 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6292
6558
|
};
|
|
6293
6559
|
|
|
6294
6560
|
// src/features/skills/kilo-skill.ts
|
|
6295
|
-
import { join as
|
|
6296
|
-
import { z as
|
|
6297
|
-
var KiloSkillFrontmatterSchema =
|
|
6298
|
-
name:
|
|
6299
|
-
description:
|
|
6561
|
+
import { join as join55 } from "path";
|
|
6562
|
+
import { z as z26 } from "zod/mini";
|
|
6563
|
+
var KiloSkillFrontmatterSchema = z26.looseObject({
|
|
6564
|
+
name: z26.string(),
|
|
6565
|
+
description: z26.string()
|
|
6300
6566
|
});
|
|
6301
6567
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
6302
6568
|
constructor({
|
|
6303
6569
|
baseDir = process.cwd(),
|
|
6304
|
-
relativeDirPath =
|
|
6570
|
+
relativeDirPath = join55(".kilocode", "skills"),
|
|
6305
6571
|
dirName,
|
|
6306
6572
|
frontmatter,
|
|
6307
6573
|
body,
|
|
@@ -6332,7 +6598,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6332
6598
|
global: _global = false
|
|
6333
6599
|
} = {}) {
|
|
6334
6600
|
return {
|
|
6335
|
-
relativeDirPath:
|
|
6601
|
+
relativeDirPath: join55(".kilocode", "skills")
|
|
6336
6602
|
};
|
|
6337
6603
|
}
|
|
6338
6604
|
getFrontmatter() {
|
|
@@ -6422,13 +6688,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6422
6688
|
});
|
|
6423
6689
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6424
6690
|
if (!result.success) {
|
|
6425
|
-
const skillDirPath =
|
|
6691
|
+
const skillDirPath = join55(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6426
6692
|
throw new Error(
|
|
6427
|
-
`Invalid frontmatter in ${
|
|
6693
|
+
`Invalid frontmatter in ${join55(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6428
6694
|
);
|
|
6429
6695
|
}
|
|
6430
6696
|
if (result.data.name !== loaded.dirName) {
|
|
6431
|
-
const skillFilePath =
|
|
6697
|
+
const skillFilePath = join55(
|
|
6432
6698
|
loaded.baseDir,
|
|
6433
6699
|
loaded.relativeDirPath,
|
|
6434
6700
|
loaded.dirName,
|
|
@@ -6469,17 +6735,17 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6469
6735
|
};
|
|
6470
6736
|
|
|
6471
6737
|
// src/features/skills/opencode-skill.ts
|
|
6472
|
-
import { join as
|
|
6473
|
-
import { z as
|
|
6474
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
6475
|
-
name:
|
|
6476
|
-
description:
|
|
6477
|
-
"allowed-tools":
|
|
6738
|
+
import { join as join56 } from "path";
|
|
6739
|
+
import { z as z27 } from "zod/mini";
|
|
6740
|
+
var OpenCodeSkillFrontmatterSchema = z27.looseObject({
|
|
6741
|
+
name: z27.string(),
|
|
6742
|
+
description: z27.string(),
|
|
6743
|
+
"allowed-tools": z27.optional(z27.array(z27.string()))
|
|
6478
6744
|
});
|
|
6479
6745
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
6480
6746
|
constructor({
|
|
6481
6747
|
baseDir = process.cwd(),
|
|
6482
|
-
relativeDirPath =
|
|
6748
|
+
relativeDirPath = join56(".opencode", "skill"),
|
|
6483
6749
|
dirName,
|
|
6484
6750
|
frontmatter,
|
|
6485
6751
|
body,
|
|
@@ -6508,7 +6774,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6508
6774
|
}
|
|
6509
6775
|
static getSettablePaths({ global = false } = {}) {
|
|
6510
6776
|
return {
|
|
6511
|
-
relativeDirPath: global ?
|
|
6777
|
+
relativeDirPath: global ? join56(".config", "opencode", "skill") : join56(".opencode", "skill")
|
|
6512
6778
|
};
|
|
6513
6779
|
}
|
|
6514
6780
|
getFrontmatter() {
|
|
@@ -6596,9 +6862,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6596
6862
|
});
|
|
6597
6863
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6598
6864
|
if (!result.success) {
|
|
6599
|
-
const skillDirPath =
|
|
6865
|
+
const skillDirPath = join56(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6600
6866
|
throw new Error(
|
|
6601
|
-
`Invalid frontmatter in ${
|
|
6867
|
+
`Invalid frontmatter in ${join56(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6602
6868
|
);
|
|
6603
6869
|
}
|
|
6604
6870
|
return new _OpenCodeSkill({
|
|
@@ -6632,16 +6898,16 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6632
6898
|
};
|
|
6633
6899
|
|
|
6634
6900
|
// src/features/skills/roo-skill.ts
|
|
6635
|
-
import { join as
|
|
6636
|
-
import { z as
|
|
6637
|
-
var RooSkillFrontmatterSchema =
|
|
6638
|
-
name:
|
|
6639
|
-
description:
|
|
6901
|
+
import { join as join57 } from "path";
|
|
6902
|
+
import { z as z28 } from "zod/mini";
|
|
6903
|
+
var RooSkillFrontmatterSchema = z28.looseObject({
|
|
6904
|
+
name: z28.string(),
|
|
6905
|
+
description: z28.string()
|
|
6640
6906
|
});
|
|
6641
6907
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
6642
6908
|
constructor({
|
|
6643
6909
|
baseDir = process.cwd(),
|
|
6644
|
-
relativeDirPath =
|
|
6910
|
+
relativeDirPath = join57(".roo", "skills"),
|
|
6645
6911
|
dirName,
|
|
6646
6912
|
frontmatter,
|
|
6647
6913
|
body,
|
|
@@ -6672,7 +6938,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6672
6938
|
global: _global = false
|
|
6673
6939
|
} = {}) {
|
|
6674
6940
|
return {
|
|
6675
|
-
relativeDirPath:
|
|
6941
|
+
relativeDirPath: join57(".roo", "skills")
|
|
6676
6942
|
};
|
|
6677
6943
|
}
|
|
6678
6944
|
getFrontmatter() {
|
|
@@ -6762,13 +7028,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6762
7028
|
});
|
|
6763
7029
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6764
7030
|
if (!result.success) {
|
|
6765
|
-
const skillDirPath =
|
|
7031
|
+
const skillDirPath = join57(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6766
7032
|
throw new Error(
|
|
6767
|
-
`Invalid frontmatter in ${
|
|
7033
|
+
`Invalid frontmatter in ${join57(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6768
7034
|
);
|
|
6769
7035
|
}
|
|
6770
7036
|
if (result.data.name !== loaded.dirName) {
|
|
6771
|
-
const skillFilePath =
|
|
7037
|
+
const skillFilePath = join57(
|
|
6772
7038
|
loaded.baseDir,
|
|
6773
7039
|
loaded.relativeDirPath,
|
|
6774
7040
|
loaded.dirName,
|
|
@@ -6811,6 +7077,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6811
7077
|
// src/features/skills/skills-processor.ts
|
|
6812
7078
|
var skillsProcessorToolTargetTuple = [
|
|
6813
7079
|
"agentsmd",
|
|
7080
|
+
"antigravity",
|
|
6814
7081
|
"claudecode",
|
|
6815
7082
|
"claudecode-legacy",
|
|
6816
7083
|
"codexcli",
|
|
@@ -6821,7 +7088,7 @@ var skillsProcessorToolTargetTuple = [
|
|
|
6821
7088
|
"opencode",
|
|
6822
7089
|
"roo"
|
|
6823
7090
|
];
|
|
6824
|
-
var SkillsProcessorToolTargetSchema =
|
|
7091
|
+
var SkillsProcessorToolTargetSchema = z29.enum(skillsProcessorToolTargetTuple);
|
|
6825
7092
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
6826
7093
|
[
|
|
6827
7094
|
"agentsmd",
|
|
@@ -6830,6 +7097,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
6830
7097
|
meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
|
|
6831
7098
|
}
|
|
6832
7099
|
],
|
|
7100
|
+
[
|
|
7101
|
+
"antigravity",
|
|
7102
|
+
{
|
|
7103
|
+
class: AntigravitySkill,
|
|
7104
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
7105
|
+
}
|
|
7106
|
+
],
|
|
6833
7107
|
[
|
|
6834
7108
|
"claudecode",
|
|
6835
7109
|
{
|
|
@@ -6848,7 +7122,7 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
6848
7122
|
"codexcli",
|
|
6849
7123
|
{
|
|
6850
7124
|
class: CodexCliSkill,
|
|
6851
|
-
meta: { supportsProject:
|
|
7125
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
6852
7126
|
}
|
|
6853
7127
|
],
|
|
6854
7128
|
[
|
|
@@ -6971,8 +7245,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
6971
7245
|
*/
|
|
6972
7246
|
async loadRulesyncDirs() {
|
|
6973
7247
|
const paths = RulesyncSkill.getSettablePaths();
|
|
6974
|
-
const rulesyncSkillsDirPath =
|
|
6975
|
-
const dirPaths = await findFilesByGlobs(
|
|
7248
|
+
const rulesyncSkillsDirPath = join58(this.baseDir, paths.relativeDirPath);
|
|
7249
|
+
const dirPaths = await findFilesByGlobs(join58(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
6976
7250
|
const dirNames = dirPaths.map((path3) => basename16(path3));
|
|
6977
7251
|
const rulesyncSkills = await Promise.all(
|
|
6978
7252
|
dirNames.map(
|
|
@@ -6989,8 +7263,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
6989
7263
|
async loadToolDirs() {
|
|
6990
7264
|
const factory = this.getFactory(this.toolTarget);
|
|
6991
7265
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
6992
|
-
const skillsDirPath =
|
|
6993
|
-
const dirPaths = await findFilesByGlobs(
|
|
7266
|
+
const skillsDirPath = join58(this.baseDir, paths.relativeDirPath);
|
|
7267
|
+
const dirPaths = await findFilesByGlobs(join58(skillsDirPath, "*"), { type: "dir" });
|
|
6994
7268
|
const dirNames = dirPaths.map((path3) => basename16(path3));
|
|
6995
7269
|
const toolSkills = await Promise.all(
|
|
6996
7270
|
dirNames.map(
|
|
@@ -7007,8 +7281,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7007
7281
|
async loadToolDirsToDelete() {
|
|
7008
7282
|
const factory = this.getFactory(this.toolTarget);
|
|
7009
7283
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7010
|
-
const skillsDirPath =
|
|
7011
|
-
const dirPaths = await findFilesByGlobs(
|
|
7284
|
+
const skillsDirPath = join58(this.baseDir, paths.relativeDirPath);
|
|
7285
|
+
const dirPaths = await findFilesByGlobs(join58(skillsDirPath, "*"), { type: "dir" });
|
|
7012
7286
|
const dirNames = dirPaths.map((path3) => basename16(path3));
|
|
7013
7287
|
const toolSkills = dirNames.map(
|
|
7014
7288
|
(dirName) => factory.class.forDeletion({
|
|
@@ -7057,11 +7331,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7057
7331
|
};
|
|
7058
7332
|
|
|
7059
7333
|
// src/features/subagents/agentsmd-subagent.ts
|
|
7060
|
-
import { join as
|
|
7334
|
+
import { join as join60 } from "path";
|
|
7061
7335
|
|
|
7062
7336
|
// src/features/subagents/simulated-subagent.ts
|
|
7063
|
-
import { basename as basename17, join as
|
|
7064
|
-
import { z as
|
|
7337
|
+
import { basename as basename17, join as join59 } from "path";
|
|
7338
|
+
import { z as z30 } from "zod/mini";
|
|
7065
7339
|
|
|
7066
7340
|
// src/features/subagents/tool-subagent.ts
|
|
7067
7341
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -7104,9 +7378,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
7104
7378
|
};
|
|
7105
7379
|
|
|
7106
7380
|
// src/features/subagents/simulated-subagent.ts
|
|
7107
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
7108
|
-
name:
|
|
7109
|
-
description:
|
|
7381
|
+
var SimulatedSubagentFrontmatterSchema = z30.object({
|
|
7382
|
+
name: z30.string(),
|
|
7383
|
+
description: z30.string()
|
|
7110
7384
|
});
|
|
7111
7385
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
7112
7386
|
frontmatter;
|
|
@@ -7116,7 +7390,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7116
7390
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7117
7391
|
if (!result.success) {
|
|
7118
7392
|
throw new Error(
|
|
7119
|
-
`Invalid frontmatter in ${
|
|
7393
|
+
`Invalid frontmatter in ${join59(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7120
7394
|
);
|
|
7121
7395
|
}
|
|
7122
7396
|
}
|
|
@@ -7167,7 +7441,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7167
7441
|
return {
|
|
7168
7442
|
success: false,
|
|
7169
7443
|
error: new Error(
|
|
7170
|
-
`Invalid frontmatter in ${
|
|
7444
|
+
`Invalid frontmatter in ${join59(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7171
7445
|
)
|
|
7172
7446
|
};
|
|
7173
7447
|
}
|
|
@@ -7177,7 +7451,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7177
7451
|
relativeFilePath,
|
|
7178
7452
|
validate = true
|
|
7179
7453
|
}) {
|
|
7180
|
-
const filePath =
|
|
7454
|
+
const filePath = join59(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
7181
7455
|
const fileContent = await readFileContent(filePath);
|
|
7182
7456
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7183
7457
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7213,7 +7487,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7213
7487
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
7214
7488
|
static getSettablePaths() {
|
|
7215
7489
|
return {
|
|
7216
|
-
relativeDirPath:
|
|
7490
|
+
relativeDirPath: join60(".agents", "subagents")
|
|
7217
7491
|
};
|
|
7218
7492
|
}
|
|
7219
7493
|
static async fromFile(params) {
|
|
@@ -7236,11 +7510,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
7236
7510
|
};
|
|
7237
7511
|
|
|
7238
7512
|
// src/features/subagents/codexcli-subagent.ts
|
|
7239
|
-
import { join as
|
|
7513
|
+
import { join as join61 } from "path";
|
|
7240
7514
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
7241
7515
|
static getSettablePaths() {
|
|
7242
7516
|
return {
|
|
7243
|
-
relativeDirPath:
|
|
7517
|
+
relativeDirPath: join61(".codex", "subagents")
|
|
7244
7518
|
};
|
|
7245
7519
|
}
|
|
7246
7520
|
static async fromFile(params) {
|
|
@@ -7263,11 +7537,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
7263
7537
|
};
|
|
7264
7538
|
|
|
7265
7539
|
// src/features/subagents/cursor-subagent.ts
|
|
7266
|
-
import { join as
|
|
7540
|
+
import { join as join62 } from "path";
|
|
7267
7541
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
7268
7542
|
static getSettablePaths() {
|
|
7269
7543
|
return {
|
|
7270
|
-
relativeDirPath:
|
|
7544
|
+
relativeDirPath: join62(".cursor", "subagents")
|
|
7271
7545
|
};
|
|
7272
7546
|
}
|
|
7273
7547
|
static async fromFile(params) {
|
|
@@ -7290,11 +7564,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
7290
7564
|
};
|
|
7291
7565
|
|
|
7292
7566
|
// src/features/subagents/geminicli-subagent.ts
|
|
7293
|
-
import { join as
|
|
7567
|
+
import { join as join63 } from "path";
|
|
7294
7568
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
7295
7569
|
static getSettablePaths() {
|
|
7296
7570
|
return {
|
|
7297
|
-
relativeDirPath:
|
|
7571
|
+
relativeDirPath: join63(".gemini", "subagents")
|
|
7298
7572
|
};
|
|
7299
7573
|
}
|
|
7300
7574
|
static async fromFile(params) {
|
|
@@ -7317,11 +7591,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
7317
7591
|
};
|
|
7318
7592
|
|
|
7319
7593
|
// src/features/subagents/roo-subagent.ts
|
|
7320
|
-
import { join as
|
|
7594
|
+
import { join as join64 } from "path";
|
|
7321
7595
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
7322
7596
|
static getSettablePaths() {
|
|
7323
7597
|
return {
|
|
7324
|
-
relativeDirPath:
|
|
7598
|
+
relativeDirPath: join64(".roo", "subagents")
|
|
7325
7599
|
};
|
|
7326
7600
|
}
|
|
7327
7601
|
static async fromFile(params) {
|
|
@@ -7344,20 +7618,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
7344
7618
|
};
|
|
7345
7619
|
|
|
7346
7620
|
// src/features/subagents/subagents-processor.ts
|
|
7347
|
-
import { basename as basename20, join as
|
|
7348
|
-
import { z as
|
|
7621
|
+
import { basename as basename20, join as join69 } from "path";
|
|
7622
|
+
import { z as z35 } from "zod/mini";
|
|
7349
7623
|
|
|
7350
7624
|
// src/features/subagents/claudecode-subagent.ts
|
|
7351
|
-
import { join as
|
|
7352
|
-
import { z as
|
|
7625
|
+
import { join as join66 } from "path";
|
|
7626
|
+
import { z as z32 } from "zod/mini";
|
|
7353
7627
|
|
|
7354
7628
|
// src/features/subagents/rulesync-subagent.ts
|
|
7355
|
-
import { basename as basename18, join as
|
|
7356
|
-
import { z as
|
|
7357
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
7629
|
+
import { basename as basename18, join as join65 } from "path";
|
|
7630
|
+
import { z as z31 } from "zod/mini";
|
|
7631
|
+
var RulesyncSubagentFrontmatterSchema = z31.looseObject({
|
|
7358
7632
|
targets: RulesyncTargetsSchema,
|
|
7359
|
-
name:
|
|
7360
|
-
description:
|
|
7633
|
+
name: z31.string(),
|
|
7634
|
+
description: z31.string()
|
|
7361
7635
|
});
|
|
7362
7636
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
7363
7637
|
frontmatter;
|
|
@@ -7367,7 +7641,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7367
7641
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7368
7642
|
if (!result.success) {
|
|
7369
7643
|
throw new Error(
|
|
7370
|
-
`Invalid frontmatter in ${
|
|
7644
|
+
`Invalid frontmatter in ${join65(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7371
7645
|
);
|
|
7372
7646
|
}
|
|
7373
7647
|
}
|
|
@@ -7400,7 +7674,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7400
7674
|
return {
|
|
7401
7675
|
success: false,
|
|
7402
7676
|
error: new Error(
|
|
7403
|
-
`Invalid frontmatter in ${
|
|
7677
|
+
`Invalid frontmatter in ${join65(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7404
7678
|
)
|
|
7405
7679
|
};
|
|
7406
7680
|
}
|
|
@@ -7409,7 +7683,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7409
7683
|
relativeFilePath
|
|
7410
7684
|
}) {
|
|
7411
7685
|
const fileContent = await readFileContent(
|
|
7412
|
-
|
|
7686
|
+
join65(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
7413
7687
|
);
|
|
7414
7688
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7415
7689
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7428,13 +7702,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7428
7702
|
};
|
|
7429
7703
|
|
|
7430
7704
|
// src/features/subagents/claudecode-subagent.ts
|
|
7431
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
7432
|
-
name:
|
|
7433
|
-
description:
|
|
7434
|
-
model:
|
|
7435
|
-
tools:
|
|
7436
|
-
permissionMode:
|
|
7437
|
-
skills:
|
|
7705
|
+
var ClaudecodeSubagentFrontmatterSchema = z32.looseObject({
|
|
7706
|
+
name: z32.string(),
|
|
7707
|
+
description: z32.string(),
|
|
7708
|
+
model: z32.optional(z32.string()),
|
|
7709
|
+
tools: z32.optional(z32.union([z32.string(), z32.array(z32.string())])),
|
|
7710
|
+
permissionMode: z32.optional(z32.string()),
|
|
7711
|
+
skills: z32.optional(z32.union([z32.string(), z32.array(z32.string())]))
|
|
7438
7712
|
});
|
|
7439
7713
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
7440
7714
|
frontmatter;
|
|
@@ -7444,7 +7718,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7444
7718
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7445
7719
|
if (!result.success) {
|
|
7446
7720
|
throw new Error(
|
|
7447
|
-
`Invalid frontmatter in ${
|
|
7721
|
+
`Invalid frontmatter in ${join66(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7448
7722
|
);
|
|
7449
7723
|
}
|
|
7450
7724
|
}
|
|
@@ -7456,7 +7730,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7456
7730
|
}
|
|
7457
7731
|
static getSettablePaths(_options = {}) {
|
|
7458
7732
|
return {
|
|
7459
|
-
relativeDirPath:
|
|
7733
|
+
relativeDirPath: join66(".claude", "agents")
|
|
7460
7734
|
};
|
|
7461
7735
|
}
|
|
7462
7736
|
getFrontmatter() {
|
|
@@ -7530,7 +7804,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7530
7804
|
return {
|
|
7531
7805
|
success: false,
|
|
7532
7806
|
error: new Error(
|
|
7533
|
-
`Invalid frontmatter in ${
|
|
7807
|
+
`Invalid frontmatter in ${join66(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7534
7808
|
)
|
|
7535
7809
|
};
|
|
7536
7810
|
}
|
|
@@ -7548,7 +7822,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7548
7822
|
global = false
|
|
7549
7823
|
}) {
|
|
7550
7824
|
const paths = this.getSettablePaths({ global });
|
|
7551
|
-
const filePath =
|
|
7825
|
+
const filePath = join66(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7552
7826
|
const fileContent = await readFileContent(filePath);
|
|
7553
7827
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7554
7828
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7583,13 +7857,13 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7583
7857
|
};
|
|
7584
7858
|
|
|
7585
7859
|
// src/features/subagents/copilot-subagent.ts
|
|
7586
|
-
import { join as
|
|
7587
|
-
import { z as
|
|
7860
|
+
import { join as join67 } from "path";
|
|
7861
|
+
import { z as z33 } from "zod/mini";
|
|
7588
7862
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
7589
|
-
var CopilotSubagentFrontmatterSchema =
|
|
7590
|
-
name:
|
|
7591
|
-
description:
|
|
7592
|
-
tools:
|
|
7863
|
+
var CopilotSubagentFrontmatterSchema = z33.looseObject({
|
|
7864
|
+
name: z33.string(),
|
|
7865
|
+
description: z33.string(),
|
|
7866
|
+
tools: z33.optional(z33.union([z33.string(), z33.array(z33.string())]))
|
|
7593
7867
|
});
|
|
7594
7868
|
var normalizeTools = (tools) => {
|
|
7595
7869
|
if (!tools) {
|
|
@@ -7609,7 +7883,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7609
7883
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7610
7884
|
if (!result.success) {
|
|
7611
7885
|
throw new Error(
|
|
7612
|
-
`Invalid frontmatter in ${
|
|
7886
|
+
`Invalid frontmatter in ${join67(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7613
7887
|
);
|
|
7614
7888
|
}
|
|
7615
7889
|
}
|
|
@@ -7621,7 +7895,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7621
7895
|
}
|
|
7622
7896
|
static getSettablePaths(_options = {}) {
|
|
7623
7897
|
return {
|
|
7624
|
-
relativeDirPath:
|
|
7898
|
+
relativeDirPath: join67(".github", "agents")
|
|
7625
7899
|
};
|
|
7626
7900
|
}
|
|
7627
7901
|
getFrontmatter() {
|
|
@@ -7695,7 +7969,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7695
7969
|
return {
|
|
7696
7970
|
success: false,
|
|
7697
7971
|
error: new Error(
|
|
7698
|
-
`Invalid frontmatter in ${
|
|
7972
|
+
`Invalid frontmatter in ${join67(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7699
7973
|
)
|
|
7700
7974
|
};
|
|
7701
7975
|
}
|
|
@@ -7713,7 +7987,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7713
7987
|
global = false
|
|
7714
7988
|
}) {
|
|
7715
7989
|
const paths = this.getSettablePaths({ global });
|
|
7716
|
-
const filePath =
|
|
7990
|
+
const filePath = join67(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7717
7991
|
const fileContent = await readFileContent(filePath);
|
|
7718
7992
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7719
7993
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7749,12 +8023,12 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7749
8023
|
};
|
|
7750
8024
|
|
|
7751
8025
|
// src/features/subagents/opencode-subagent.ts
|
|
7752
|
-
import { basename as basename19, join as
|
|
7753
|
-
import { z as
|
|
7754
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
7755
|
-
description:
|
|
7756
|
-
mode:
|
|
7757
|
-
name:
|
|
8026
|
+
import { basename as basename19, join as join68 } from "path";
|
|
8027
|
+
import { z as z34 } from "zod/mini";
|
|
8028
|
+
var OpenCodeSubagentFrontmatterSchema = z34.looseObject({
|
|
8029
|
+
description: z34.string(),
|
|
8030
|
+
mode: z34.literal("subagent"),
|
|
8031
|
+
name: z34.optional(z34.string())
|
|
7758
8032
|
});
|
|
7759
8033
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
7760
8034
|
frontmatter;
|
|
@@ -7764,7 +8038,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7764
8038
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7765
8039
|
if (!result.success) {
|
|
7766
8040
|
throw new Error(
|
|
7767
|
-
`Invalid frontmatter in ${
|
|
8041
|
+
`Invalid frontmatter in ${join68(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7768
8042
|
);
|
|
7769
8043
|
}
|
|
7770
8044
|
}
|
|
@@ -7778,7 +8052,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7778
8052
|
global = false
|
|
7779
8053
|
} = {}) {
|
|
7780
8054
|
return {
|
|
7781
|
-
relativeDirPath: global ?
|
|
8055
|
+
relativeDirPath: global ? join68(".config", "opencode", "agent") : join68(".opencode", "agent")
|
|
7782
8056
|
};
|
|
7783
8057
|
}
|
|
7784
8058
|
getFrontmatter() {
|
|
@@ -7844,7 +8118,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7844
8118
|
return {
|
|
7845
8119
|
success: false,
|
|
7846
8120
|
error: new Error(
|
|
7847
|
-
`Invalid frontmatter in ${
|
|
8121
|
+
`Invalid frontmatter in ${join68(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7848
8122
|
)
|
|
7849
8123
|
};
|
|
7850
8124
|
}
|
|
@@ -7861,7 +8135,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7861
8135
|
global = false
|
|
7862
8136
|
}) {
|
|
7863
8137
|
const paths = this.getSettablePaths({ global });
|
|
7864
|
-
const filePath =
|
|
8138
|
+
const filePath = join68(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7865
8139
|
const fileContent = await readFileContent(filePath);
|
|
7866
8140
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7867
8141
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7908,7 +8182,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
7908
8182
|
"opencode",
|
|
7909
8183
|
"roo"
|
|
7910
8184
|
];
|
|
7911
|
-
var SubagentsProcessorToolTargetSchema =
|
|
8185
|
+
var SubagentsProcessorToolTargetSchema = z35.enum(subagentsProcessorToolTargetTuple);
|
|
7912
8186
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
7913
8187
|
[
|
|
7914
8188
|
"agentsmd",
|
|
@@ -8022,7 +8296,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8022
8296
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
8023
8297
|
*/
|
|
8024
8298
|
async loadRulesyncFiles() {
|
|
8025
|
-
const subagentsDir =
|
|
8299
|
+
const subagentsDir = join69(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
8026
8300
|
const dirExists = await directoryExists(subagentsDir);
|
|
8027
8301
|
if (!dirExists) {
|
|
8028
8302
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -8037,7 +8311,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8037
8311
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
8038
8312
|
const rulesyncSubagents = [];
|
|
8039
8313
|
for (const mdFile of mdFiles) {
|
|
8040
|
-
const filepath =
|
|
8314
|
+
const filepath = join69(subagentsDir, mdFile);
|
|
8041
8315
|
try {
|
|
8042
8316
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
8043
8317
|
relativeFilePath: mdFile,
|
|
@@ -8067,7 +8341,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8067
8341
|
const factory = this.getFactory(this.toolTarget);
|
|
8068
8342
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
8069
8343
|
const subagentFilePaths = await findFilesByGlobs(
|
|
8070
|
-
|
|
8344
|
+
join69(this.baseDir, paths.relativeDirPath, "*.md")
|
|
8071
8345
|
);
|
|
8072
8346
|
if (forDeletion) {
|
|
8073
8347
|
const toolSubagents2 = subagentFilePaths.map(
|
|
@@ -8117,48 +8391,48 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8117
8391
|
};
|
|
8118
8392
|
|
|
8119
8393
|
// src/features/rules/agentsmd-rule.ts
|
|
8120
|
-
import { join as
|
|
8394
|
+
import { join as join72 } from "path";
|
|
8121
8395
|
|
|
8122
8396
|
// src/features/rules/tool-rule.ts
|
|
8123
|
-
import { join as
|
|
8397
|
+
import { join as join71 } from "path";
|
|
8124
8398
|
|
|
8125
8399
|
// src/features/rules/rulesync-rule.ts
|
|
8126
|
-
import { basename as basename21, join as
|
|
8127
|
-
import { z as
|
|
8128
|
-
var RulesyncRuleFrontmatterSchema =
|
|
8129
|
-
root:
|
|
8130
|
-
targets:
|
|
8131
|
-
description:
|
|
8132
|
-
globs:
|
|
8133
|
-
agentsmd:
|
|
8134
|
-
|
|
8400
|
+
import { basename as basename21, join as join70 } from "path";
|
|
8401
|
+
import { z as z36 } from "zod/mini";
|
|
8402
|
+
var RulesyncRuleFrontmatterSchema = z36.object({
|
|
8403
|
+
root: z36.optional(z36.optional(z36.boolean())),
|
|
8404
|
+
targets: z36.optional(RulesyncTargetsSchema),
|
|
8405
|
+
description: z36.optional(z36.string()),
|
|
8406
|
+
globs: z36.optional(z36.array(z36.string())),
|
|
8407
|
+
agentsmd: z36.optional(
|
|
8408
|
+
z36.object({
|
|
8135
8409
|
// @example "path/to/subproject"
|
|
8136
|
-
subprojectPath:
|
|
8410
|
+
subprojectPath: z36.optional(z36.string())
|
|
8137
8411
|
})
|
|
8138
8412
|
),
|
|
8139
|
-
claudecode:
|
|
8140
|
-
|
|
8413
|
+
claudecode: z36.optional(
|
|
8414
|
+
z36.object({
|
|
8141
8415
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
8142
8416
|
// @example "src/**/*.ts, tests/**/*.test.ts"
|
|
8143
|
-
paths:
|
|
8417
|
+
paths: z36.optional(z36.string())
|
|
8144
8418
|
})
|
|
8145
8419
|
),
|
|
8146
|
-
cursor:
|
|
8147
|
-
|
|
8148
|
-
alwaysApply:
|
|
8149
|
-
description:
|
|
8150
|
-
globs:
|
|
8420
|
+
cursor: z36.optional(
|
|
8421
|
+
z36.object({
|
|
8422
|
+
alwaysApply: z36.optional(z36.boolean()),
|
|
8423
|
+
description: z36.optional(z36.string()),
|
|
8424
|
+
globs: z36.optional(z36.array(z36.string()))
|
|
8151
8425
|
})
|
|
8152
8426
|
),
|
|
8153
|
-
copilot:
|
|
8154
|
-
|
|
8155
|
-
excludeAgent:
|
|
8427
|
+
copilot: z36.optional(
|
|
8428
|
+
z36.object({
|
|
8429
|
+
excludeAgent: z36.optional(z36.union([z36.literal("code-review"), z36.literal("coding-agent")]))
|
|
8156
8430
|
})
|
|
8157
8431
|
),
|
|
8158
|
-
antigravity:
|
|
8159
|
-
|
|
8160
|
-
trigger:
|
|
8161
|
-
globs:
|
|
8432
|
+
antigravity: z36.optional(
|
|
8433
|
+
z36.looseObject({
|
|
8434
|
+
trigger: z36.optional(z36.string()),
|
|
8435
|
+
globs: z36.optional(z36.array(z36.string()))
|
|
8162
8436
|
})
|
|
8163
8437
|
)
|
|
8164
8438
|
});
|
|
@@ -8170,7 +8444,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8170
8444
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8171
8445
|
if (!result.success) {
|
|
8172
8446
|
throw new Error(
|
|
8173
|
-
`Invalid frontmatter in ${
|
|
8447
|
+
`Invalid frontmatter in ${join70(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8174
8448
|
);
|
|
8175
8449
|
}
|
|
8176
8450
|
}
|
|
@@ -8205,7 +8479,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8205
8479
|
return {
|
|
8206
8480
|
success: false,
|
|
8207
8481
|
error: new Error(
|
|
8208
|
-
`Invalid frontmatter in ${
|
|
8482
|
+
`Invalid frontmatter in ${join70(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8209
8483
|
)
|
|
8210
8484
|
};
|
|
8211
8485
|
}
|
|
@@ -8214,12 +8488,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8214
8488
|
relativeFilePath,
|
|
8215
8489
|
validate = true
|
|
8216
8490
|
}) {
|
|
8217
|
-
const legacyPath =
|
|
8491
|
+
const legacyPath = join70(
|
|
8218
8492
|
process.cwd(),
|
|
8219
8493
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
8220
8494
|
relativeFilePath
|
|
8221
8495
|
);
|
|
8222
|
-
const recommendedPath =
|
|
8496
|
+
const recommendedPath = join70(
|
|
8223
8497
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8224
8498
|
relativeFilePath
|
|
8225
8499
|
);
|
|
@@ -8254,7 +8528,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8254
8528
|
relativeFilePath,
|
|
8255
8529
|
validate = true
|
|
8256
8530
|
}) {
|
|
8257
|
-
const filePath =
|
|
8531
|
+
const filePath = join70(
|
|
8258
8532
|
process.cwd(),
|
|
8259
8533
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8260
8534
|
relativeFilePath
|
|
@@ -8356,7 +8630,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8356
8630
|
rulesyncRule,
|
|
8357
8631
|
validate = true,
|
|
8358
8632
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
8359
|
-
nonRootPath = { relativeDirPath:
|
|
8633
|
+
nonRootPath = { relativeDirPath: join71(".agents", "memories") }
|
|
8360
8634
|
}) {
|
|
8361
8635
|
const params = this.buildToolRuleParamsDefault({
|
|
8362
8636
|
baseDir,
|
|
@@ -8367,7 +8641,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8367
8641
|
});
|
|
8368
8642
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
8369
8643
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
8370
|
-
params.relativeDirPath =
|
|
8644
|
+
params.relativeDirPath = join71(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
8371
8645
|
params.relativeFilePath = "AGENTS.md";
|
|
8372
8646
|
}
|
|
8373
8647
|
return params;
|
|
@@ -8432,7 +8706,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8432
8706
|
relativeFilePath: "AGENTS.md"
|
|
8433
8707
|
},
|
|
8434
8708
|
nonRoot: {
|
|
8435
|
-
relativeDirPath:
|
|
8709
|
+
relativeDirPath: join72(".agents", "memories")
|
|
8436
8710
|
}
|
|
8437
8711
|
};
|
|
8438
8712
|
}
|
|
@@ -8442,8 +8716,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8442
8716
|
validate = true
|
|
8443
8717
|
}) {
|
|
8444
8718
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
8445
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
8446
|
-
const fileContent = await readFileContent(
|
|
8719
|
+
const relativePath = isRoot ? "AGENTS.md" : join72(".agents", "memories", relativeFilePath);
|
|
8720
|
+
const fileContent = await readFileContent(join72(baseDir, relativePath));
|
|
8447
8721
|
return new _AgentsMdRule({
|
|
8448
8722
|
baseDir,
|
|
8449
8723
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -8498,21 +8772,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8498
8772
|
};
|
|
8499
8773
|
|
|
8500
8774
|
// src/features/rules/antigravity-rule.ts
|
|
8501
|
-
import { join as
|
|
8502
|
-
import { z as
|
|
8503
|
-
var AntigravityRuleFrontmatterSchema =
|
|
8504
|
-
trigger:
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8775
|
+
import { join as join73 } from "path";
|
|
8776
|
+
import { z as z37 } from "zod/mini";
|
|
8777
|
+
var AntigravityRuleFrontmatterSchema = z37.looseObject({
|
|
8778
|
+
trigger: z37.optional(
|
|
8779
|
+
z37.union([
|
|
8780
|
+
z37.literal("always_on"),
|
|
8781
|
+
z37.literal("glob"),
|
|
8782
|
+
z37.literal("manual"),
|
|
8783
|
+
z37.literal("model_decision"),
|
|
8784
|
+
z37.string()
|
|
8511
8785
|
// accepts any string for forward compatibility
|
|
8512
8786
|
])
|
|
8513
8787
|
),
|
|
8514
|
-
globs:
|
|
8515
|
-
description:
|
|
8788
|
+
globs: z37.optional(z37.string()),
|
|
8789
|
+
description: z37.optional(z37.string())
|
|
8516
8790
|
});
|
|
8517
8791
|
function parseGlobsString(globs) {
|
|
8518
8792
|
if (!globs) {
|
|
@@ -8657,7 +8931,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8657
8931
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8658
8932
|
if (!result.success) {
|
|
8659
8933
|
throw new Error(
|
|
8660
|
-
`Invalid frontmatter in ${
|
|
8934
|
+
`Invalid frontmatter in ${join73(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8661
8935
|
);
|
|
8662
8936
|
}
|
|
8663
8937
|
}
|
|
@@ -8672,7 +8946,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8672
8946
|
static getSettablePaths() {
|
|
8673
8947
|
return {
|
|
8674
8948
|
nonRoot: {
|
|
8675
|
-
relativeDirPath:
|
|
8949
|
+
relativeDirPath: join73(".agent", "rules")
|
|
8676
8950
|
}
|
|
8677
8951
|
};
|
|
8678
8952
|
}
|
|
@@ -8681,7 +8955,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8681
8955
|
relativeFilePath,
|
|
8682
8956
|
validate = true
|
|
8683
8957
|
}) {
|
|
8684
|
-
const filePath =
|
|
8958
|
+
const filePath = join73(
|
|
8685
8959
|
baseDir,
|
|
8686
8960
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
8687
8961
|
relativeFilePath
|
|
@@ -8822,7 +9096,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8822
9096
|
};
|
|
8823
9097
|
|
|
8824
9098
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
8825
|
-
import { join as
|
|
9099
|
+
import { join as join74 } from "path";
|
|
8826
9100
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
8827
9101
|
toRulesyncRule() {
|
|
8828
9102
|
const rulesyncFrontmatter = {
|
|
@@ -8848,7 +9122,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8848
9122
|
relativeFilePath: ".augment-guidelines"
|
|
8849
9123
|
},
|
|
8850
9124
|
nonRoot: {
|
|
8851
|
-
relativeDirPath:
|
|
9125
|
+
relativeDirPath: join74(".augment", "rules")
|
|
8852
9126
|
}
|
|
8853
9127
|
};
|
|
8854
9128
|
}
|
|
@@ -8883,8 +9157,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8883
9157
|
}) {
|
|
8884
9158
|
const settablePaths = this.getSettablePaths();
|
|
8885
9159
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
8886
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
8887
|
-
const fileContent = await readFileContent(
|
|
9160
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join74(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9161
|
+
const fileContent = await readFileContent(join74(baseDir, relativePath));
|
|
8888
9162
|
return new _AugmentcodeLegacyRule({
|
|
8889
9163
|
baseDir,
|
|
8890
9164
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -8913,7 +9187,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8913
9187
|
};
|
|
8914
9188
|
|
|
8915
9189
|
// src/features/rules/augmentcode-rule.ts
|
|
8916
|
-
import { join as
|
|
9190
|
+
import { join as join75 } from "path";
|
|
8917
9191
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
8918
9192
|
toRulesyncRule() {
|
|
8919
9193
|
return this.toRulesyncRuleDefault();
|
|
@@ -8921,7 +9195,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8921
9195
|
static getSettablePaths() {
|
|
8922
9196
|
return {
|
|
8923
9197
|
nonRoot: {
|
|
8924
|
-
relativeDirPath:
|
|
9198
|
+
relativeDirPath: join75(".augment", "rules")
|
|
8925
9199
|
}
|
|
8926
9200
|
};
|
|
8927
9201
|
}
|
|
@@ -8945,7 +9219,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8945
9219
|
validate = true
|
|
8946
9220
|
}) {
|
|
8947
9221
|
const fileContent = await readFileContent(
|
|
8948
|
-
|
|
9222
|
+
join75(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8949
9223
|
);
|
|
8950
9224
|
const { body: content } = parseFrontmatter(fileContent);
|
|
8951
9225
|
return new _AugmentcodeRule({
|
|
@@ -8981,7 +9255,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8981
9255
|
};
|
|
8982
9256
|
|
|
8983
9257
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
8984
|
-
import { join as
|
|
9258
|
+
import { join as join76 } from "path";
|
|
8985
9259
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
8986
9260
|
static getSettablePaths({
|
|
8987
9261
|
global
|
|
@@ -9000,7 +9274,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9000
9274
|
relativeFilePath: "CLAUDE.md"
|
|
9001
9275
|
},
|
|
9002
9276
|
nonRoot: {
|
|
9003
|
-
relativeDirPath:
|
|
9277
|
+
relativeDirPath: join76(".claude", "memories")
|
|
9004
9278
|
}
|
|
9005
9279
|
};
|
|
9006
9280
|
}
|
|
@@ -9015,7 +9289,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9015
9289
|
if (isRoot) {
|
|
9016
9290
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9017
9291
|
const fileContent2 = await readFileContent(
|
|
9018
|
-
|
|
9292
|
+
join76(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9019
9293
|
);
|
|
9020
9294
|
return new _ClaudecodeLegacyRule({
|
|
9021
9295
|
baseDir,
|
|
@@ -9029,8 +9303,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9029
9303
|
if (!paths.nonRoot) {
|
|
9030
9304
|
throw new Error("nonRoot path is not set");
|
|
9031
9305
|
}
|
|
9032
|
-
const relativePath =
|
|
9033
|
-
const fileContent = await readFileContent(
|
|
9306
|
+
const relativePath = join76(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9307
|
+
const fileContent = await readFileContent(join76(baseDir, relativePath));
|
|
9034
9308
|
return new _ClaudecodeLegacyRule({
|
|
9035
9309
|
baseDir,
|
|
9036
9310
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9089,10 +9363,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9089
9363
|
};
|
|
9090
9364
|
|
|
9091
9365
|
// src/features/rules/claudecode-rule.ts
|
|
9092
|
-
import { join as
|
|
9093
|
-
import { z as
|
|
9094
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
9095
|
-
paths:
|
|
9366
|
+
import { join as join77 } from "path";
|
|
9367
|
+
import { z as z38 } from "zod/mini";
|
|
9368
|
+
var ClaudecodeRuleFrontmatterSchema = z38.object({
|
|
9369
|
+
paths: z38.optional(z38.string())
|
|
9096
9370
|
});
|
|
9097
9371
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
9098
9372
|
frontmatter;
|
|
@@ -9114,7 +9388,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9114
9388
|
relativeFilePath: "CLAUDE.md"
|
|
9115
9389
|
},
|
|
9116
9390
|
nonRoot: {
|
|
9117
|
-
relativeDirPath:
|
|
9391
|
+
relativeDirPath: join77(".claude", "rules")
|
|
9118
9392
|
}
|
|
9119
9393
|
};
|
|
9120
9394
|
}
|
|
@@ -9123,7 +9397,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9123
9397
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9124
9398
|
if (!result.success) {
|
|
9125
9399
|
throw new Error(
|
|
9126
|
-
`Invalid frontmatter in ${
|
|
9400
|
+
`Invalid frontmatter in ${join77(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9127
9401
|
);
|
|
9128
9402
|
}
|
|
9129
9403
|
}
|
|
@@ -9151,7 +9425,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9151
9425
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
9152
9426
|
if (isRoot) {
|
|
9153
9427
|
const fileContent2 = await readFileContent(
|
|
9154
|
-
|
|
9428
|
+
join77(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
9155
9429
|
);
|
|
9156
9430
|
return new _ClaudecodeRule({
|
|
9157
9431
|
baseDir,
|
|
@@ -9166,13 +9440,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9166
9440
|
if (!paths.nonRoot) {
|
|
9167
9441
|
throw new Error("nonRoot path is not set");
|
|
9168
9442
|
}
|
|
9169
|
-
const relativePath =
|
|
9170
|
-
const fileContent = await readFileContent(
|
|
9443
|
+
const relativePath = join77(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9444
|
+
const fileContent = await readFileContent(join77(baseDir, relativePath));
|
|
9171
9445
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9172
9446
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9173
9447
|
if (!result.success) {
|
|
9174
9448
|
throw new Error(
|
|
9175
|
-
`Invalid frontmatter in ${
|
|
9449
|
+
`Invalid frontmatter in ${join77(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
9176
9450
|
);
|
|
9177
9451
|
}
|
|
9178
9452
|
return new _ClaudecodeRule({
|
|
@@ -9279,7 +9553,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9279
9553
|
return {
|
|
9280
9554
|
success: false,
|
|
9281
9555
|
error: new Error(
|
|
9282
|
-
`Invalid frontmatter in ${
|
|
9556
|
+
`Invalid frontmatter in ${join77(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9283
9557
|
)
|
|
9284
9558
|
};
|
|
9285
9559
|
}
|
|
@@ -9299,10 +9573,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9299
9573
|
};
|
|
9300
9574
|
|
|
9301
9575
|
// src/features/rules/cline-rule.ts
|
|
9302
|
-
import { join as
|
|
9303
|
-
import { z as
|
|
9304
|
-
var ClineRuleFrontmatterSchema =
|
|
9305
|
-
description:
|
|
9576
|
+
import { join as join78 } from "path";
|
|
9577
|
+
import { z as z39 } from "zod/mini";
|
|
9578
|
+
var ClineRuleFrontmatterSchema = z39.object({
|
|
9579
|
+
description: z39.string()
|
|
9306
9580
|
});
|
|
9307
9581
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
9308
9582
|
static getSettablePaths() {
|
|
@@ -9344,7 +9618,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9344
9618
|
validate = true
|
|
9345
9619
|
}) {
|
|
9346
9620
|
const fileContent = await readFileContent(
|
|
9347
|
-
|
|
9621
|
+
join78(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9348
9622
|
);
|
|
9349
9623
|
return new _ClineRule({
|
|
9350
9624
|
baseDir,
|
|
@@ -9370,7 +9644,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9370
9644
|
};
|
|
9371
9645
|
|
|
9372
9646
|
// src/features/rules/codexcli-rule.ts
|
|
9373
|
-
import { join as
|
|
9647
|
+
import { join as join79 } from "path";
|
|
9374
9648
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
9375
9649
|
static getSettablePaths({
|
|
9376
9650
|
global
|
|
@@ -9389,7 +9663,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9389
9663
|
relativeFilePath: "AGENTS.md"
|
|
9390
9664
|
},
|
|
9391
9665
|
nonRoot: {
|
|
9392
|
-
relativeDirPath:
|
|
9666
|
+
relativeDirPath: join79(".codex", "memories")
|
|
9393
9667
|
}
|
|
9394
9668
|
};
|
|
9395
9669
|
}
|
|
@@ -9404,7 +9678,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9404
9678
|
if (isRoot) {
|
|
9405
9679
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9406
9680
|
const fileContent2 = await readFileContent(
|
|
9407
|
-
|
|
9681
|
+
join79(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9408
9682
|
);
|
|
9409
9683
|
return new _CodexcliRule({
|
|
9410
9684
|
baseDir,
|
|
@@ -9418,8 +9692,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9418
9692
|
if (!paths.nonRoot) {
|
|
9419
9693
|
throw new Error("nonRoot path is not set");
|
|
9420
9694
|
}
|
|
9421
|
-
const relativePath =
|
|
9422
|
-
const fileContent = await readFileContent(
|
|
9695
|
+
const relativePath = join79(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9696
|
+
const fileContent = await readFileContent(join79(baseDir, relativePath));
|
|
9423
9697
|
return new _CodexcliRule({
|
|
9424
9698
|
baseDir,
|
|
9425
9699
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9478,12 +9752,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9478
9752
|
};
|
|
9479
9753
|
|
|
9480
9754
|
// src/features/rules/copilot-rule.ts
|
|
9481
|
-
import { join as
|
|
9482
|
-
import { z as
|
|
9483
|
-
var CopilotRuleFrontmatterSchema =
|
|
9484
|
-
description:
|
|
9485
|
-
applyTo:
|
|
9486
|
-
excludeAgent:
|
|
9755
|
+
import { join as join80 } from "path";
|
|
9756
|
+
import { z as z40 } from "zod/mini";
|
|
9757
|
+
var CopilotRuleFrontmatterSchema = z40.object({
|
|
9758
|
+
description: z40.optional(z40.string()),
|
|
9759
|
+
applyTo: z40.optional(z40.string()),
|
|
9760
|
+
excludeAgent: z40.optional(z40.union([z40.literal("code-review"), z40.literal("coding-agent")]))
|
|
9487
9761
|
});
|
|
9488
9762
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
9489
9763
|
frontmatter;
|
|
@@ -9495,7 +9769,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9495
9769
|
relativeFilePath: "copilot-instructions.md"
|
|
9496
9770
|
},
|
|
9497
9771
|
nonRoot: {
|
|
9498
|
-
relativeDirPath:
|
|
9772
|
+
relativeDirPath: join80(".github", "instructions")
|
|
9499
9773
|
}
|
|
9500
9774
|
};
|
|
9501
9775
|
}
|
|
@@ -9504,7 +9778,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9504
9778
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9505
9779
|
if (!result.success) {
|
|
9506
9780
|
throw new Error(
|
|
9507
|
-
`Invalid frontmatter in ${
|
|
9781
|
+
`Invalid frontmatter in ${join80(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9508
9782
|
);
|
|
9509
9783
|
}
|
|
9510
9784
|
}
|
|
@@ -9586,11 +9860,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9586
9860
|
validate = true
|
|
9587
9861
|
}) {
|
|
9588
9862
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
9589
|
-
const relativePath = isRoot ?
|
|
9863
|
+
const relativePath = isRoot ? join80(
|
|
9590
9864
|
this.getSettablePaths().root.relativeDirPath,
|
|
9591
9865
|
this.getSettablePaths().root.relativeFilePath
|
|
9592
|
-
) :
|
|
9593
|
-
const fileContent = await readFileContent(
|
|
9866
|
+
) : join80(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
9867
|
+
const fileContent = await readFileContent(join80(baseDir, relativePath));
|
|
9594
9868
|
if (isRoot) {
|
|
9595
9869
|
return new _CopilotRule({
|
|
9596
9870
|
baseDir,
|
|
@@ -9606,7 +9880,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9606
9880
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9607
9881
|
if (!result.success) {
|
|
9608
9882
|
throw new Error(
|
|
9609
|
-
`Invalid frontmatter in ${
|
|
9883
|
+
`Invalid frontmatter in ${join80(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9610
9884
|
);
|
|
9611
9885
|
}
|
|
9612
9886
|
return new _CopilotRule({
|
|
@@ -9646,7 +9920,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9646
9920
|
return {
|
|
9647
9921
|
success: false,
|
|
9648
9922
|
error: new Error(
|
|
9649
|
-
`Invalid frontmatter in ${
|
|
9923
|
+
`Invalid frontmatter in ${join80(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9650
9924
|
)
|
|
9651
9925
|
};
|
|
9652
9926
|
}
|
|
@@ -9666,12 +9940,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9666
9940
|
};
|
|
9667
9941
|
|
|
9668
9942
|
// src/features/rules/cursor-rule.ts
|
|
9669
|
-
import { basename as basename22, join as
|
|
9670
|
-
import { z as
|
|
9671
|
-
var CursorRuleFrontmatterSchema =
|
|
9672
|
-
description:
|
|
9673
|
-
globs:
|
|
9674
|
-
alwaysApply:
|
|
9943
|
+
import { basename as basename22, join as join81 } from "path";
|
|
9944
|
+
import { z as z41 } from "zod/mini";
|
|
9945
|
+
var CursorRuleFrontmatterSchema = z41.object({
|
|
9946
|
+
description: z41.optional(z41.string()),
|
|
9947
|
+
globs: z41.optional(z41.string()),
|
|
9948
|
+
alwaysApply: z41.optional(z41.boolean())
|
|
9675
9949
|
});
|
|
9676
9950
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
9677
9951
|
frontmatter;
|
|
@@ -9679,7 +9953,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9679
9953
|
static getSettablePaths() {
|
|
9680
9954
|
return {
|
|
9681
9955
|
nonRoot: {
|
|
9682
|
-
relativeDirPath:
|
|
9956
|
+
relativeDirPath: join81(".cursor", "rules")
|
|
9683
9957
|
}
|
|
9684
9958
|
};
|
|
9685
9959
|
}
|
|
@@ -9688,7 +9962,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9688
9962
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9689
9963
|
if (!result.success) {
|
|
9690
9964
|
throw new Error(
|
|
9691
|
-
`Invalid frontmatter in ${
|
|
9965
|
+
`Invalid frontmatter in ${join81(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9692
9966
|
);
|
|
9693
9967
|
}
|
|
9694
9968
|
}
|
|
@@ -9805,13 +10079,13 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9805
10079
|
validate = true
|
|
9806
10080
|
}) {
|
|
9807
10081
|
const fileContent = await readFileContent(
|
|
9808
|
-
|
|
10082
|
+
join81(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9809
10083
|
);
|
|
9810
10084
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
9811
10085
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9812
10086
|
if (!result.success) {
|
|
9813
10087
|
throw new Error(
|
|
9814
|
-
`Invalid frontmatter in ${
|
|
10088
|
+
`Invalid frontmatter in ${join81(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9815
10089
|
);
|
|
9816
10090
|
}
|
|
9817
10091
|
return new _CursorRule({
|
|
@@ -9848,7 +10122,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9848
10122
|
return {
|
|
9849
10123
|
success: false,
|
|
9850
10124
|
error: new Error(
|
|
9851
|
-
`Invalid frontmatter in ${
|
|
10125
|
+
`Invalid frontmatter in ${join81(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9852
10126
|
)
|
|
9853
10127
|
};
|
|
9854
10128
|
}
|
|
@@ -9868,7 +10142,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9868
10142
|
};
|
|
9869
10143
|
|
|
9870
10144
|
// src/features/rules/geminicli-rule.ts
|
|
9871
|
-
import { join as
|
|
10145
|
+
import { join as join82 } from "path";
|
|
9872
10146
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
9873
10147
|
static getSettablePaths({
|
|
9874
10148
|
global
|
|
@@ -9887,7 +10161,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9887
10161
|
relativeFilePath: "GEMINI.md"
|
|
9888
10162
|
},
|
|
9889
10163
|
nonRoot: {
|
|
9890
|
-
relativeDirPath:
|
|
10164
|
+
relativeDirPath: join82(".gemini", "memories")
|
|
9891
10165
|
}
|
|
9892
10166
|
};
|
|
9893
10167
|
}
|
|
@@ -9902,7 +10176,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9902
10176
|
if (isRoot) {
|
|
9903
10177
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9904
10178
|
const fileContent2 = await readFileContent(
|
|
9905
|
-
|
|
10179
|
+
join82(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9906
10180
|
);
|
|
9907
10181
|
return new _GeminiCliRule({
|
|
9908
10182
|
baseDir,
|
|
@@ -9916,8 +10190,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9916
10190
|
if (!paths.nonRoot) {
|
|
9917
10191
|
throw new Error("nonRoot path is not set");
|
|
9918
10192
|
}
|
|
9919
|
-
const relativePath =
|
|
9920
|
-
const fileContent = await readFileContent(
|
|
10193
|
+
const relativePath = join82(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10194
|
+
const fileContent = await readFileContent(join82(baseDir, relativePath));
|
|
9921
10195
|
return new _GeminiCliRule({
|
|
9922
10196
|
baseDir,
|
|
9923
10197
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9976,7 +10250,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9976
10250
|
};
|
|
9977
10251
|
|
|
9978
10252
|
// src/features/rules/junie-rule.ts
|
|
9979
|
-
import { join as
|
|
10253
|
+
import { join as join83 } from "path";
|
|
9980
10254
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
9981
10255
|
static getSettablePaths() {
|
|
9982
10256
|
return {
|
|
@@ -9985,7 +10259,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9985
10259
|
relativeFilePath: "guidelines.md"
|
|
9986
10260
|
},
|
|
9987
10261
|
nonRoot: {
|
|
9988
|
-
relativeDirPath:
|
|
10262
|
+
relativeDirPath: join83(".junie", "memories")
|
|
9989
10263
|
}
|
|
9990
10264
|
};
|
|
9991
10265
|
}
|
|
@@ -9995,8 +10269,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9995
10269
|
validate = true
|
|
9996
10270
|
}) {
|
|
9997
10271
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
9998
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
9999
|
-
const fileContent = await readFileContent(
|
|
10272
|
+
const relativePath = isRoot ? "guidelines.md" : join83(".junie", "memories", relativeFilePath);
|
|
10273
|
+
const fileContent = await readFileContent(join83(baseDir, relativePath));
|
|
10000
10274
|
return new _JunieRule({
|
|
10001
10275
|
baseDir,
|
|
10002
10276
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10051,12 +10325,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10051
10325
|
};
|
|
10052
10326
|
|
|
10053
10327
|
// src/features/rules/kilo-rule.ts
|
|
10054
|
-
import { join as
|
|
10328
|
+
import { join as join84 } from "path";
|
|
10055
10329
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
10056
10330
|
static getSettablePaths(_options = {}) {
|
|
10057
10331
|
return {
|
|
10058
10332
|
nonRoot: {
|
|
10059
|
-
relativeDirPath:
|
|
10333
|
+
relativeDirPath: join84(".kilocode", "rules")
|
|
10060
10334
|
}
|
|
10061
10335
|
};
|
|
10062
10336
|
}
|
|
@@ -10066,7 +10340,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10066
10340
|
validate = true
|
|
10067
10341
|
}) {
|
|
10068
10342
|
const fileContent = await readFileContent(
|
|
10069
|
-
|
|
10343
|
+
join84(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10070
10344
|
);
|
|
10071
10345
|
return new _KiloRule({
|
|
10072
10346
|
baseDir,
|
|
@@ -10118,12 +10392,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10118
10392
|
};
|
|
10119
10393
|
|
|
10120
10394
|
// src/features/rules/kiro-rule.ts
|
|
10121
|
-
import { join as
|
|
10395
|
+
import { join as join85 } from "path";
|
|
10122
10396
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
10123
10397
|
static getSettablePaths() {
|
|
10124
10398
|
return {
|
|
10125
10399
|
nonRoot: {
|
|
10126
|
-
relativeDirPath:
|
|
10400
|
+
relativeDirPath: join85(".kiro", "steering")
|
|
10127
10401
|
}
|
|
10128
10402
|
};
|
|
10129
10403
|
}
|
|
@@ -10133,7 +10407,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10133
10407
|
validate = true
|
|
10134
10408
|
}) {
|
|
10135
10409
|
const fileContent = await readFileContent(
|
|
10136
|
-
|
|
10410
|
+
join85(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10137
10411
|
);
|
|
10138
10412
|
return new _KiroRule({
|
|
10139
10413
|
baseDir,
|
|
@@ -10187,7 +10461,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10187
10461
|
};
|
|
10188
10462
|
|
|
10189
10463
|
// src/features/rules/opencode-rule.ts
|
|
10190
|
-
import { join as
|
|
10464
|
+
import { join as join86 } from "path";
|
|
10191
10465
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
10192
10466
|
static getSettablePaths() {
|
|
10193
10467
|
return {
|
|
@@ -10196,7 +10470,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10196
10470
|
relativeFilePath: "AGENTS.md"
|
|
10197
10471
|
},
|
|
10198
10472
|
nonRoot: {
|
|
10199
|
-
relativeDirPath:
|
|
10473
|
+
relativeDirPath: join86(".opencode", "memories")
|
|
10200
10474
|
}
|
|
10201
10475
|
};
|
|
10202
10476
|
}
|
|
@@ -10206,8 +10480,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10206
10480
|
validate = true
|
|
10207
10481
|
}) {
|
|
10208
10482
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
10209
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
10210
|
-
const fileContent = await readFileContent(
|
|
10483
|
+
const relativePath = isRoot ? "AGENTS.md" : join86(".opencode", "memories", relativeFilePath);
|
|
10484
|
+
const fileContent = await readFileContent(join86(baseDir, relativePath));
|
|
10211
10485
|
return new _OpenCodeRule({
|
|
10212
10486
|
baseDir,
|
|
10213
10487
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10262,7 +10536,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10262
10536
|
};
|
|
10263
10537
|
|
|
10264
10538
|
// src/features/rules/qwencode-rule.ts
|
|
10265
|
-
import { join as
|
|
10539
|
+
import { join as join87 } from "path";
|
|
10266
10540
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
10267
10541
|
static getSettablePaths() {
|
|
10268
10542
|
return {
|
|
@@ -10271,7 +10545,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10271
10545
|
relativeFilePath: "QWEN.md"
|
|
10272
10546
|
},
|
|
10273
10547
|
nonRoot: {
|
|
10274
|
-
relativeDirPath:
|
|
10548
|
+
relativeDirPath: join87(".qwen", "memories")
|
|
10275
10549
|
}
|
|
10276
10550
|
};
|
|
10277
10551
|
}
|
|
@@ -10281,8 +10555,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10281
10555
|
validate = true
|
|
10282
10556
|
}) {
|
|
10283
10557
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
10284
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
10285
|
-
const fileContent = await readFileContent(
|
|
10558
|
+
const relativePath = isRoot ? "QWEN.md" : join87(".qwen", "memories", relativeFilePath);
|
|
10559
|
+
const fileContent = await readFileContent(join87(baseDir, relativePath));
|
|
10286
10560
|
return new _QwencodeRule({
|
|
10287
10561
|
baseDir,
|
|
10288
10562
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10334,12 +10608,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10334
10608
|
};
|
|
10335
10609
|
|
|
10336
10610
|
// src/features/rules/roo-rule.ts
|
|
10337
|
-
import { join as
|
|
10611
|
+
import { join as join88 } from "path";
|
|
10338
10612
|
var RooRule = class _RooRule extends ToolRule {
|
|
10339
10613
|
static getSettablePaths() {
|
|
10340
10614
|
return {
|
|
10341
10615
|
nonRoot: {
|
|
10342
|
-
relativeDirPath:
|
|
10616
|
+
relativeDirPath: join88(".roo", "rules")
|
|
10343
10617
|
}
|
|
10344
10618
|
};
|
|
10345
10619
|
}
|
|
@@ -10349,7 +10623,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10349
10623
|
validate = true
|
|
10350
10624
|
}) {
|
|
10351
10625
|
const fileContent = await readFileContent(
|
|
10352
|
-
|
|
10626
|
+
join88(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10353
10627
|
);
|
|
10354
10628
|
return new _RooRule({
|
|
10355
10629
|
baseDir,
|
|
@@ -10418,7 +10692,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10418
10692
|
};
|
|
10419
10693
|
|
|
10420
10694
|
// src/features/rules/warp-rule.ts
|
|
10421
|
-
import { join as
|
|
10695
|
+
import { join as join89 } from "path";
|
|
10422
10696
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
10423
10697
|
constructor({ fileContent, root, ...rest }) {
|
|
10424
10698
|
super({
|
|
@@ -10434,7 +10708,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10434
10708
|
relativeFilePath: "WARP.md"
|
|
10435
10709
|
},
|
|
10436
10710
|
nonRoot: {
|
|
10437
|
-
relativeDirPath:
|
|
10711
|
+
relativeDirPath: join89(".warp", "memories")
|
|
10438
10712
|
}
|
|
10439
10713
|
};
|
|
10440
10714
|
}
|
|
@@ -10444,8 +10718,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10444
10718
|
validate = true
|
|
10445
10719
|
}) {
|
|
10446
10720
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
10447
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
10448
|
-
const fileContent = await readFileContent(
|
|
10721
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join89(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10722
|
+
const fileContent = await readFileContent(join89(baseDir, relativePath));
|
|
10449
10723
|
return new _WarpRule({
|
|
10450
10724
|
baseDir,
|
|
10451
10725
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -10500,12 +10774,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10500
10774
|
};
|
|
10501
10775
|
|
|
10502
10776
|
// src/features/rules/windsurf-rule.ts
|
|
10503
|
-
import { join as
|
|
10777
|
+
import { join as join90 } from "path";
|
|
10504
10778
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
10505
10779
|
static getSettablePaths() {
|
|
10506
10780
|
return {
|
|
10507
10781
|
nonRoot: {
|
|
10508
|
-
relativeDirPath:
|
|
10782
|
+
relativeDirPath: join90(".windsurf", "rules")
|
|
10509
10783
|
}
|
|
10510
10784
|
};
|
|
10511
10785
|
}
|
|
@@ -10515,7 +10789,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
10515
10789
|
validate = true
|
|
10516
10790
|
}) {
|
|
10517
10791
|
const fileContent = await readFileContent(
|
|
10518
|
-
|
|
10792
|
+
join90(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10519
10793
|
);
|
|
10520
10794
|
return new _WindsurfRule({
|
|
10521
10795
|
baseDir,
|
|
@@ -10588,7 +10862,7 @@ var rulesProcessorToolTargets = [
|
|
|
10588
10862
|
"warp",
|
|
10589
10863
|
"windsurf"
|
|
10590
10864
|
];
|
|
10591
|
-
var RulesProcessorToolTargetSchema =
|
|
10865
|
+
var RulesProcessorToolTargetSchema = z42.enum(rulesProcessorToolTargets);
|
|
10592
10866
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
10593
10867
|
[
|
|
10594
10868
|
"agentsmd",
|
|
@@ -10872,7 +11146,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10872
11146
|
}).relativeDirPath;
|
|
10873
11147
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
10874
11148
|
const frontmatter = skill.getFrontmatter();
|
|
10875
|
-
const relativePath =
|
|
11149
|
+
const relativePath = join91(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
10876
11150
|
return {
|
|
10877
11151
|
name: frontmatter.name,
|
|
10878
11152
|
description: frontmatter.description,
|
|
@@ -10939,7 +11213,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10939
11213
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
10940
11214
|
*/
|
|
10941
11215
|
async loadRulesyncFiles() {
|
|
10942
|
-
const files = await findFilesByGlobs(
|
|
11216
|
+
const files = await findFilesByGlobs(join91(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
10943
11217
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
10944
11218
|
const rulesyncRules = await Promise.all(
|
|
10945
11219
|
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename23(file) }))
|
|
@@ -10960,7 +11234,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10960
11234
|
return rulesyncRules;
|
|
10961
11235
|
}
|
|
10962
11236
|
async loadRulesyncFilesLegacy() {
|
|
10963
|
-
const legacyFiles = await findFilesByGlobs(
|
|
11237
|
+
const legacyFiles = await findFilesByGlobs(join91(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
10964
11238
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
10965
11239
|
return Promise.all(
|
|
10966
11240
|
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename23(file) }))
|
|
@@ -10981,7 +11255,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10981
11255
|
return [];
|
|
10982
11256
|
}
|
|
10983
11257
|
const rootFilePaths = await findFilesByGlobs(
|
|
10984
|
-
|
|
11258
|
+
join91(
|
|
10985
11259
|
this.baseDir,
|
|
10986
11260
|
settablePaths.root.relativeDirPath ?? ".",
|
|
10987
11261
|
settablePaths.root.relativeFilePath
|
|
@@ -11013,7 +11287,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11013
11287
|
return [];
|
|
11014
11288
|
}
|
|
11015
11289
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
11016
|
-
|
|
11290
|
+
join91(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
11017
11291
|
);
|
|
11018
11292
|
if (forDeletion) {
|
|
11019
11293
|
return nonRootFilePaths.map(
|
|
@@ -11122,14 +11396,14 @@ s/<command> [arguments]
|
|
|
11122
11396
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
11123
11397
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
11124
11398
|
|
|
11125
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
11399
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join91(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
11126
11400
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
11127
11401
|
|
|
11128
11402
|
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.
|
|
11129
11403
|
|
|
11130
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
11404
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join91(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
11131
11405
|
|
|
11132
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
11406
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join91(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
11133
11407
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
11134
11408
|
const result = [
|
|
11135
11409
|
overview,
|
|
@@ -11411,13 +11685,17 @@ async function generateSkills(config) {
|
|
|
11411
11685
|
}
|
|
11412
11686
|
|
|
11413
11687
|
// src/cli/commands/gitignore.ts
|
|
11414
|
-
import { join as
|
|
11688
|
+
import { join as join92 } from "path";
|
|
11415
11689
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
11416
11690
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
11417
11691
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
11418
11692
|
// AGENTS.md
|
|
11419
11693
|
"**/AGENTS.md",
|
|
11420
11694
|
"**/.agents/",
|
|
11695
|
+
// Antigravity
|
|
11696
|
+
"**/.agent/rules/",
|
|
11697
|
+
"**/.agent/skills/",
|
|
11698
|
+
"**/.agent/workflows/",
|
|
11421
11699
|
// Augment
|
|
11422
11700
|
"**/.augmentignore",
|
|
11423
11701
|
"**/.augment/rules/",
|
|
@@ -11439,8 +11717,9 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11439
11717
|
"**/.cline/mcp.json",
|
|
11440
11718
|
// Codex
|
|
11441
11719
|
"**/.codexignore",
|
|
11442
|
-
"**/.codex/",
|
|
11720
|
+
"**/.codex/memories/",
|
|
11443
11721
|
"**/.codex/skills/",
|
|
11722
|
+
"**/.codex/subagents/",
|
|
11444
11723
|
// Cursor
|
|
11445
11724
|
"**/.cursor/",
|
|
11446
11725
|
"**/.cursorignore",
|
|
@@ -11469,6 +11748,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11469
11748
|
"**/.kilocodeignore",
|
|
11470
11749
|
// Kiro
|
|
11471
11750
|
"**/.kiro/steering/",
|
|
11751
|
+
"**/.kiro/settings/mcp.json",
|
|
11472
11752
|
"**/.aiignore",
|
|
11473
11753
|
// OpenCode
|
|
11474
11754
|
"**/.opencode/memories/",
|
|
@@ -11541,7 +11821,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
11541
11821
|
return result;
|
|
11542
11822
|
};
|
|
11543
11823
|
var gitignoreCommand = async () => {
|
|
11544
|
-
const gitignorePath =
|
|
11824
|
+
const gitignorePath = join92(process.cwd(), ".gitignore");
|
|
11545
11825
|
let gitignoreContent = "";
|
|
11546
11826
|
if (await fileExists(gitignorePath)) {
|
|
11547
11827
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -11740,7 +12020,7 @@ async function importSkills(config, tool) {
|
|
|
11740
12020
|
}
|
|
11741
12021
|
|
|
11742
12022
|
// src/cli/commands/init.ts
|
|
11743
|
-
import { join as
|
|
12023
|
+
import { join as join93 } from "path";
|
|
11744
12024
|
async function initCommand() {
|
|
11745
12025
|
logger.info("Initializing rulesync...");
|
|
11746
12026
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -11749,7 +12029,7 @@ async function initCommand() {
|
|
|
11749
12029
|
logger.success("rulesync initialized successfully!");
|
|
11750
12030
|
logger.info("Next steps:");
|
|
11751
12031
|
logger.info(
|
|
11752
|
-
`1. Edit ${RULESYNC_RELATIVE_DIR_PATH}/**/*.md, ${RULESYNC_MCP_RELATIVE_FILE_PATH} and ${RULESYNC_AIIGNORE_RELATIVE_FILE_PATH}`
|
|
12032
|
+
`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}`
|
|
11753
12033
|
);
|
|
11754
12034
|
logger.info("2. Run 'rulesync generate' to create configuration files");
|
|
11755
12035
|
}
|
|
@@ -11763,13 +12043,14 @@ async function createConfigFile() {
|
|
|
11763
12043
|
JSON.stringify(
|
|
11764
12044
|
{
|
|
11765
12045
|
targets: ["copilot", "cursor", "claudecode", "codexcli"],
|
|
11766
|
-
features: ["rules", "ignore", "mcp", "commands", "subagents"],
|
|
12046
|
+
features: ["rules", "ignore", "mcp", "commands", "subagents", "skills"],
|
|
11767
12047
|
baseDirs: ["."],
|
|
11768
12048
|
delete: true,
|
|
11769
12049
|
verbose: false,
|
|
11770
12050
|
global: false,
|
|
11771
12051
|
simulateCommands: false,
|
|
11772
12052
|
simulateSubagents: false,
|
|
12053
|
+
simulateSkills: false,
|
|
11773
12054
|
modularMcp: false
|
|
11774
12055
|
},
|
|
11775
12056
|
null,
|
|
@@ -11888,6 +12169,18 @@ Based on the user's instruction, create a plan while analyzing the related files
|
|
|
11888
12169
|
|
|
11889
12170
|
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.
|
|
11890
12171
|
`
|
|
12172
|
+
};
|
|
12173
|
+
const sampleSkillFile = {
|
|
12174
|
+
dirName: "project-context",
|
|
12175
|
+
content: `---
|
|
12176
|
+
name: project-context
|
|
12177
|
+
description: "Summarize the project context and key constraints"
|
|
12178
|
+
targets: ["*"]
|
|
12179
|
+
---
|
|
12180
|
+
|
|
12181
|
+
Summarize the project goals, core constraints, and relevant dependencies.
|
|
12182
|
+
Call out any architecture decisions, shared conventions, and validation steps.
|
|
12183
|
+
Keep the summary concise and ready to reuse in future tasks.`
|
|
11891
12184
|
};
|
|
11892
12185
|
const sampleIgnoreFile = {
|
|
11893
12186
|
content: `credentials/
|
|
@@ -11897,20 +12190,22 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11897
12190
|
const mcpPaths = RulesyncMcp.getSettablePaths();
|
|
11898
12191
|
const commandPaths = RulesyncCommand.getSettablePaths();
|
|
11899
12192
|
const subagentPaths = RulesyncSubagent.getSettablePaths();
|
|
12193
|
+
const skillPaths = RulesyncSkill.getSettablePaths();
|
|
11900
12194
|
const ignorePaths = RulesyncIgnore.getSettablePaths();
|
|
11901
12195
|
await ensureDir(rulePaths.recommended.relativeDirPath);
|
|
11902
12196
|
await ensureDir(mcpPaths.recommended.relativeDirPath);
|
|
11903
12197
|
await ensureDir(commandPaths.relativeDirPath);
|
|
11904
12198
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
12199
|
+
await ensureDir(skillPaths.relativeDirPath);
|
|
11905
12200
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
11906
|
-
const ruleFilepath =
|
|
12201
|
+
const ruleFilepath = join93(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
11907
12202
|
if (!await fileExists(ruleFilepath)) {
|
|
11908
12203
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
11909
12204
|
logger.success(`Created ${ruleFilepath}`);
|
|
11910
12205
|
} else {
|
|
11911
12206
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
11912
12207
|
}
|
|
11913
|
-
const mcpFilepath =
|
|
12208
|
+
const mcpFilepath = join93(
|
|
11914
12209
|
mcpPaths.recommended.relativeDirPath,
|
|
11915
12210
|
mcpPaths.recommended.relativeFilePath
|
|
11916
12211
|
);
|
|
@@ -11920,21 +12215,30 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11920
12215
|
} else {
|
|
11921
12216
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
11922
12217
|
}
|
|
11923
|
-
const commandFilepath =
|
|
12218
|
+
const commandFilepath = join93(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
11924
12219
|
if (!await fileExists(commandFilepath)) {
|
|
11925
12220
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
11926
12221
|
logger.success(`Created ${commandFilepath}`);
|
|
11927
12222
|
} else {
|
|
11928
12223
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
11929
12224
|
}
|
|
11930
|
-
const subagentFilepath =
|
|
12225
|
+
const subagentFilepath = join93(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
11931
12226
|
if (!await fileExists(subagentFilepath)) {
|
|
11932
12227
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
11933
12228
|
logger.success(`Created ${subagentFilepath}`);
|
|
11934
12229
|
} else {
|
|
11935
12230
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
11936
12231
|
}
|
|
11937
|
-
const
|
|
12232
|
+
const skillDirPath = join93(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
12233
|
+
await ensureDir(skillDirPath);
|
|
12234
|
+
const skillFilepath = join93(skillDirPath, SKILL_FILE_NAME);
|
|
12235
|
+
if (!await fileExists(skillFilepath)) {
|
|
12236
|
+
await writeFileContent(skillFilepath, sampleSkillFile.content);
|
|
12237
|
+
logger.success(`Created ${skillFilepath}`);
|
|
12238
|
+
} else {
|
|
12239
|
+
logger.info(`Skipped ${skillFilepath} (already exists)`);
|
|
12240
|
+
}
|
|
12241
|
+
const ignoreFilepath = join93(
|
|
11938
12242
|
ignorePaths.recommended.relativeDirPath,
|
|
11939
12243
|
ignorePaths.recommended.relativeFilePath
|
|
11940
12244
|
);
|
|
@@ -11950,15 +12254,15 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11950
12254
|
import { FastMCP } from "fastmcp";
|
|
11951
12255
|
|
|
11952
12256
|
// src/mcp/tools.ts
|
|
11953
|
-
import { z as
|
|
12257
|
+
import { z as z49 } from "zod/mini";
|
|
11954
12258
|
|
|
11955
12259
|
// src/mcp/commands.ts
|
|
11956
|
-
import { basename as basename24, join as
|
|
11957
|
-
import { z as
|
|
12260
|
+
import { basename as basename24, join as join94 } from "path";
|
|
12261
|
+
import { z as z43 } from "zod/mini";
|
|
11958
12262
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
11959
12263
|
var maxCommandsCount = 1e3;
|
|
11960
12264
|
async function listCommands() {
|
|
11961
|
-
const commandsDir =
|
|
12265
|
+
const commandsDir = join94(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
11962
12266
|
try {
|
|
11963
12267
|
const files = await listDirectoryFiles(commandsDir);
|
|
11964
12268
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -11970,7 +12274,7 @@ async function listCommands() {
|
|
|
11970
12274
|
});
|
|
11971
12275
|
const frontmatter = command.getFrontmatter();
|
|
11972
12276
|
return {
|
|
11973
|
-
relativePathFromCwd:
|
|
12277
|
+
relativePathFromCwd: join94(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
11974
12278
|
frontmatter
|
|
11975
12279
|
};
|
|
11976
12280
|
} catch (error) {
|
|
@@ -11996,7 +12300,7 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
11996
12300
|
relativeFilePath: filename
|
|
11997
12301
|
});
|
|
11998
12302
|
return {
|
|
11999
|
-
relativePathFromCwd:
|
|
12303
|
+
relativePathFromCwd: join94(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12000
12304
|
frontmatter: command.getFrontmatter(),
|
|
12001
12305
|
body: command.getBody()
|
|
12002
12306
|
};
|
|
@@ -12025,7 +12329,7 @@ async function putCommand({
|
|
|
12025
12329
|
try {
|
|
12026
12330
|
const existingCommands = await listCommands();
|
|
12027
12331
|
const isUpdate = existingCommands.some(
|
|
12028
|
-
(command2) => command2.relativePathFromCwd ===
|
|
12332
|
+
(command2) => command2.relativePathFromCwd === join94(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12029
12333
|
);
|
|
12030
12334
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
12031
12335
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -12040,11 +12344,11 @@ async function putCommand({
|
|
|
12040
12344
|
fileContent,
|
|
12041
12345
|
validate: true
|
|
12042
12346
|
});
|
|
12043
|
-
const commandsDir =
|
|
12347
|
+
const commandsDir = join94(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12044
12348
|
await ensureDir(commandsDir);
|
|
12045
12349
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
12046
12350
|
return {
|
|
12047
|
-
relativePathFromCwd:
|
|
12351
|
+
relativePathFromCwd: join94(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12048
12352
|
frontmatter: command.getFrontmatter(),
|
|
12049
12353
|
body: command.getBody()
|
|
12050
12354
|
};
|
|
@@ -12060,11 +12364,11 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12060
12364
|
intendedRootDir: process.cwd()
|
|
12061
12365
|
});
|
|
12062
12366
|
const filename = basename24(relativePathFromCwd);
|
|
12063
|
-
const fullPath =
|
|
12367
|
+
const fullPath = join94(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
12064
12368
|
try {
|
|
12065
12369
|
await removeFile(fullPath);
|
|
12066
12370
|
return {
|
|
12067
|
-
relativePathFromCwd:
|
|
12371
|
+
relativePathFromCwd: join94(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12068
12372
|
};
|
|
12069
12373
|
} catch (error) {
|
|
12070
12374
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12073,23 +12377,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12073
12377
|
}
|
|
12074
12378
|
}
|
|
12075
12379
|
var commandToolSchemas = {
|
|
12076
|
-
listCommands:
|
|
12077
|
-
getCommand:
|
|
12078
|
-
relativePathFromCwd:
|
|
12380
|
+
listCommands: z43.object({}),
|
|
12381
|
+
getCommand: z43.object({
|
|
12382
|
+
relativePathFromCwd: z43.string()
|
|
12079
12383
|
}),
|
|
12080
|
-
putCommand:
|
|
12081
|
-
relativePathFromCwd:
|
|
12384
|
+
putCommand: z43.object({
|
|
12385
|
+
relativePathFromCwd: z43.string(),
|
|
12082
12386
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
12083
|
-
body:
|
|
12387
|
+
body: z43.string()
|
|
12084
12388
|
}),
|
|
12085
|
-
deleteCommand:
|
|
12086
|
-
relativePathFromCwd:
|
|
12389
|
+
deleteCommand: z43.object({
|
|
12390
|
+
relativePathFromCwd: z43.string()
|
|
12087
12391
|
})
|
|
12088
12392
|
};
|
|
12089
12393
|
var commandTools = {
|
|
12090
12394
|
listCommands: {
|
|
12091
12395
|
name: "listCommands",
|
|
12092
|
-
description: `List all commands from ${
|
|
12396
|
+
description: `List all commands from ${join94(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12093
12397
|
parameters: commandToolSchemas.listCommands,
|
|
12094
12398
|
execute: async () => {
|
|
12095
12399
|
const commands = await listCommands();
|
|
@@ -12131,11 +12435,11 @@ var commandTools = {
|
|
|
12131
12435
|
};
|
|
12132
12436
|
|
|
12133
12437
|
// src/mcp/ignore.ts
|
|
12134
|
-
import { join as
|
|
12135
|
-
import { z as
|
|
12438
|
+
import { join as join95 } from "path";
|
|
12439
|
+
import { z as z44 } from "zod/mini";
|
|
12136
12440
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
12137
12441
|
async function getIgnoreFile() {
|
|
12138
|
-
const ignoreFilePath =
|
|
12442
|
+
const ignoreFilePath = join95(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12139
12443
|
try {
|
|
12140
12444
|
const content = await readFileContent(ignoreFilePath);
|
|
12141
12445
|
return {
|
|
@@ -12149,7 +12453,7 @@ async function getIgnoreFile() {
|
|
|
12149
12453
|
}
|
|
12150
12454
|
}
|
|
12151
12455
|
async function putIgnoreFile({ content }) {
|
|
12152
|
-
const ignoreFilePath =
|
|
12456
|
+
const ignoreFilePath = join95(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12153
12457
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
12154
12458
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
12155
12459
|
throw new Error(
|
|
@@ -12170,8 +12474,8 @@ async function putIgnoreFile({ content }) {
|
|
|
12170
12474
|
}
|
|
12171
12475
|
}
|
|
12172
12476
|
async function deleteIgnoreFile() {
|
|
12173
|
-
const aiignorePath =
|
|
12174
|
-
const legacyIgnorePath =
|
|
12477
|
+
const aiignorePath = join95(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12478
|
+
const legacyIgnorePath = join95(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
12175
12479
|
try {
|
|
12176
12480
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
12177
12481
|
return {
|
|
@@ -12189,11 +12493,11 @@ async function deleteIgnoreFile() {
|
|
|
12189
12493
|
}
|
|
12190
12494
|
}
|
|
12191
12495
|
var ignoreToolSchemas = {
|
|
12192
|
-
getIgnoreFile:
|
|
12193
|
-
putIgnoreFile:
|
|
12194
|
-
content:
|
|
12496
|
+
getIgnoreFile: z44.object({}),
|
|
12497
|
+
putIgnoreFile: z44.object({
|
|
12498
|
+
content: z44.string()
|
|
12195
12499
|
}),
|
|
12196
|
-
deleteIgnoreFile:
|
|
12500
|
+
deleteIgnoreFile: z44.object({})
|
|
12197
12501
|
};
|
|
12198
12502
|
var ignoreTools = {
|
|
12199
12503
|
getIgnoreFile: {
|
|
@@ -12226,8 +12530,8 @@ var ignoreTools = {
|
|
|
12226
12530
|
};
|
|
12227
12531
|
|
|
12228
12532
|
// src/mcp/mcp.ts
|
|
12229
|
-
import { join as
|
|
12230
|
-
import { z as
|
|
12533
|
+
import { join as join96 } from "path";
|
|
12534
|
+
import { z as z45 } from "zod/mini";
|
|
12231
12535
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
12232
12536
|
async function getMcpFile() {
|
|
12233
12537
|
const config = await ConfigResolver.resolve({});
|
|
@@ -12236,7 +12540,7 @@ async function getMcpFile() {
|
|
|
12236
12540
|
validate: true,
|
|
12237
12541
|
modularMcp: config.getModularMcp()
|
|
12238
12542
|
});
|
|
12239
|
-
const relativePathFromCwd =
|
|
12543
|
+
const relativePathFromCwd = join96(
|
|
12240
12544
|
rulesyncMcp.getRelativeDirPath(),
|
|
12241
12545
|
rulesyncMcp.getRelativeFilePath()
|
|
12242
12546
|
);
|
|
@@ -12269,7 +12573,7 @@ async function putMcpFile({ content }) {
|
|
|
12269
12573
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12270
12574
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
12271
12575
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
12272
|
-
const fullPath =
|
|
12576
|
+
const fullPath = join96(baseDir, relativeDirPath, relativeFilePath);
|
|
12273
12577
|
const rulesyncMcp = new RulesyncMcp({
|
|
12274
12578
|
baseDir,
|
|
12275
12579
|
relativeDirPath,
|
|
@@ -12278,9 +12582,9 @@ async function putMcpFile({ content }) {
|
|
|
12278
12582
|
validate: true,
|
|
12279
12583
|
modularMcp: config.getModularMcp()
|
|
12280
12584
|
});
|
|
12281
|
-
await ensureDir(
|
|
12585
|
+
await ensureDir(join96(baseDir, relativeDirPath));
|
|
12282
12586
|
await writeFileContent(fullPath, content);
|
|
12283
|
-
const relativePathFromCwd =
|
|
12587
|
+
const relativePathFromCwd = join96(relativeDirPath, relativeFilePath);
|
|
12284
12588
|
return {
|
|
12285
12589
|
relativePathFromCwd,
|
|
12286
12590
|
content: rulesyncMcp.getFileContent()
|
|
@@ -12295,15 +12599,15 @@ async function deleteMcpFile() {
|
|
|
12295
12599
|
try {
|
|
12296
12600
|
const baseDir = process.cwd();
|
|
12297
12601
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12298
|
-
const recommendedPath =
|
|
12602
|
+
const recommendedPath = join96(
|
|
12299
12603
|
baseDir,
|
|
12300
12604
|
paths.recommended.relativeDirPath,
|
|
12301
12605
|
paths.recommended.relativeFilePath
|
|
12302
12606
|
);
|
|
12303
|
-
const legacyPath =
|
|
12607
|
+
const legacyPath = join96(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
12304
12608
|
await removeFile(recommendedPath);
|
|
12305
12609
|
await removeFile(legacyPath);
|
|
12306
|
-
const relativePathFromCwd =
|
|
12610
|
+
const relativePathFromCwd = join96(
|
|
12307
12611
|
paths.recommended.relativeDirPath,
|
|
12308
12612
|
paths.recommended.relativeFilePath
|
|
12309
12613
|
);
|
|
@@ -12317,11 +12621,11 @@ async function deleteMcpFile() {
|
|
|
12317
12621
|
}
|
|
12318
12622
|
}
|
|
12319
12623
|
var mcpToolSchemas = {
|
|
12320
|
-
getMcpFile:
|
|
12321
|
-
putMcpFile:
|
|
12322
|
-
content:
|
|
12624
|
+
getMcpFile: z45.object({}),
|
|
12625
|
+
putMcpFile: z45.object({
|
|
12626
|
+
content: z45.string()
|
|
12323
12627
|
}),
|
|
12324
|
-
deleteMcpFile:
|
|
12628
|
+
deleteMcpFile: z45.object({})
|
|
12325
12629
|
};
|
|
12326
12630
|
var mcpTools = {
|
|
12327
12631
|
getMcpFile: {
|
|
@@ -12354,12 +12658,12 @@ var mcpTools = {
|
|
|
12354
12658
|
};
|
|
12355
12659
|
|
|
12356
12660
|
// src/mcp/rules.ts
|
|
12357
|
-
import { basename as basename25, join as
|
|
12358
|
-
import { z as
|
|
12661
|
+
import { basename as basename25, join as join97 } from "path";
|
|
12662
|
+
import { z as z46 } from "zod/mini";
|
|
12359
12663
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
12360
12664
|
var maxRulesCount = 1e3;
|
|
12361
12665
|
async function listRules() {
|
|
12362
|
-
const rulesDir =
|
|
12666
|
+
const rulesDir = join97(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12363
12667
|
try {
|
|
12364
12668
|
const files = await listDirectoryFiles(rulesDir);
|
|
12365
12669
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12372,7 +12676,7 @@ async function listRules() {
|
|
|
12372
12676
|
});
|
|
12373
12677
|
const frontmatter = rule.getFrontmatter();
|
|
12374
12678
|
return {
|
|
12375
|
-
relativePathFromCwd:
|
|
12679
|
+
relativePathFromCwd: join97(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
12376
12680
|
frontmatter
|
|
12377
12681
|
};
|
|
12378
12682
|
} catch (error) {
|
|
@@ -12399,7 +12703,7 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
12399
12703
|
validate: true
|
|
12400
12704
|
});
|
|
12401
12705
|
return {
|
|
12402
|
-
relativePathFromCwd:
|
|
12706
|
+
relativePathFromCwd: join97(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12403
12707
|
frontmatter: rule.getFrontmatter(),
|
|
12404
12708
|
body: rule.getBody()
|
|
12405
12709
|
};
|
|
@@ -12428,7 +12732,7 @@ async function putRule({
|
|
|
12428
12732
|
try {
|
|
12429
12733
|
const existingRules = await listRules();
|
|
12430
12734
|
const isUpdate = existingRules.some(
|
|
12431
|
-
(rule2) => rule2.relativePathFromCwd ===
|
|
12735
|
+
(rule2) => rule2.relativePathFromCwd === join97(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12432
12736
|
);
|
|
12433
12737
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
12434
12738
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -12441,11 +12745,11 @@ async function putRule({
|
|
|
12441
12745
|
body,
|
|
12442
12746
|
validate: true
|
|
12443
12747
|
});
|
|
12444
|
-
const rulesDir =
|
|
12748
|
+
const rulesDir = join97(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12445
12749
|
await ensureDir(rulesDir);
|
|
12446
12750
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
12447
12751
|
return {
|
|
12448
|
-
relativePathFromCwd:
|
|
12752
|
+
relativePathFromCwd: join97(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12449
12753
|
frontmatter: rule.getFrontmatter(),
|
|
12450
12754
|
body: rule.getBody()
|
|
12451
12755
|
};
|
|
@@ -12461,11 +12765,11 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
12461
12765
|
intendedRootDir: process.cwd()
|
|
12462
12766
|
});
|
|
12463
12767
|
const filename = basename25(relativePathFromCwd);
|
|
12464
|
-
const fullPath =
|
|
12768
|
+
const fullPath = join97(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
12465
12769
|
try {
|
|
12466
12770
|
await removeFile(fullPath);
|
|
12467
12771
|
return {
|
|
12468
|
-
relativePathFromCwd:
|
|
12772
|
+
relativePathFromCwd: join97(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12469
12773
|
};
|
|
12470
12774
|
} catch (error) {
|
|
12471
12775
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12474,23 +12778,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
12474
12778
|
}
|
|
12475
12779
|
}
|
|
12476
12780
|
var ruleToolSchemas = {
|
|
12477
|
-
listRules:
|
|
12478
|
-
getRule:
|
|
12479
|
-
relativePathFromCwd:
|
|
12781
|
+
listRules: z46.object({}),
|
|
12782
|
+
getRule: z46.object({
|
|
12783
|
+
relativePathFromCwd: z46.string()
|
|
12480
12784
|
}),
|
|
12481
|
-
putRule:
|
|
12482
|
-
relativePathFromCwd:
|
|
12785
|
+
putRule: z46.object({
|
|
12786
|
+
relativePathFromCwd: z46.string(),
|
|
12483
12787
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
12484
|
-
body:
|
|
12788
|
+
body: z46.string()
|
|
12485
12789
|
}),
|
|
12486
|
-
deleteRule:
|
|
12487
|
-
relativePathFromCwd:
|
|
12790
|
+
deleteRule: z46.object({
|
|
12791
|
+
relativePathFromCwd: z46.string()
|
|
12488
12792
|
})
|
|
12489
12793
|
};
|
|
12490
12794
|
var ruleTools = {
|
|
12491
12795
|
listRules: {
|
|
12492
12796
|
name: "listRules",
|
|
12493
|
-
description: `List all rules from ${
|
|
12797
|
+
description: `List all rules from ${join97(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12494
12798
|
parameters: ruleToolSchemas.listRules,
|
|
12495
12799
|
execute: async () => {
|
|
12496
12800
|
const rules = await listRules();
|
|
@@ -12532,8 +12836,8 @@ var ruleTools = {
|
|
|
12532
12836
|
};
|
|
12533
12837
|
|
|
12534
12838
|
// src/mcp/skills.ts
|
|
12535
|
-
import { basename as basename26, dirname as dirname2, join as
|
|
12536
|
-
import { z as
|
|
12839
|
+
import { basename as basename26, dirname as dirname2, join as join98 } from "path";
|
|
12840
|
+
import { z as z47 } from "zod/mini";
|
|
12537
12841
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
12538
12842
|
var maxSkillsCount = 1e3;
|
|
12539
12843
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -12556,9 +12860,9 @@ function extractDirName(relativeDirPathFromCwd) {
|
|
|
12556
12860
|
return dirName;
|
|
12557
12861
|
}
|
|
12558
12862
|
async function listSkills() {
|
|
12559
|
-
const skillsDir =
|
|
12863
|
+
const skillsDir = join98(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
12560
12864
|
try {
|
|
12561
|
-
const skillDirPaths = await findFilesByGlobs(
|
|
12865
|
+
const skillDirPaths = await findFilesByGlobs(join98(skillsDir, "*"), { type: "dir" });
|
|
12562
12866
|
const skills = await Promise.all(
|
|
12563
12867
|
skillDirPaths.map(async (dirPath) => {
|
|
12564
12868
|
const dirName = basename26(dirPath);
|
|
@@ -12569,7 +12873,7 @@ async function listSkills() {
|
|
|
12569
12873
|
});
|
|
12570
12874
|
const frontmatter = skill.getFrontmatter();
|
|
12571
12875
|
return {
|
|
12572
|
-
relativeDirPathFromCwd:
|
|
12876
|
+
relativeDirPathFromCwd: join98(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12573
12877
|
frontmatter
|
|
12574
12878
|
};
|
|
12575
12879
|
} catch (error) {
|
|
@@ -12595,7 +12899,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
12595
12899
|
dirName
|
|
12596
12900
|
});
|
|
12597
12901
|
return {
|
|
12598
|
-
relativeDirPathFromCwd:
|
|
12902
|
+
relativeDirPathFromCwd: join98(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12599
12903
|
frontmatter: skill.getFrontmatter(),
|
|
12600
12904
|
body: skill.getBody(),
|
|
12601
12905
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12629,7 +12933,7 @@ async function putSkill({
|
|
|
12629
12933
|
try {
|
|
12630
12934
|
const existingSkills = await listSkills();
|
|
12631
12935
|
const isUpdate = existingSkills.some(
|
|
12632
|
-
(skill2) => skill2.relativeDirPathFromCwd ===
|
|
12936
|
+
(skill2) => skill2.relativeDirPathFromCwd === join98(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12633
12937
|
);
|
|
12634
12938
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
12635
12939
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -12644,9 +12948,9 @@ async function putSkill({
|
|
|
12644
12948
|
otherFiles: aiDirFiles,
|
|
12645
12949
|
validate: true
|
|
12646
12950
|
});
|
|
12647
|
-
const skillDirPath =
|
|
12951
|
+
const skillDirPath = join98(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12648
12952
|
await ensureDir(skillDirPath);
|
|
12649
|
-
const skillFilePath =
|
|
12953
|
+
const skillFilePath = join98(skillDirPath, SKILL_FILE_NAME);
|
|
12650
12954
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
12651
12955
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
12652
12956
|
for (const file of otherFiles) {
|
|
@@ -12654,15 +12958,15 @@ async function putSkill({
|
|
|
12654
12958
|
relativePath: file.name,
|
|
12655
12959
|
intendedRootDir: skillDirPath
|
|
12656
12960
|
});
|
|
12657
|
-
const filePath =
|
|
12658
|
-
const fileDir =
|
|
12961
|
+
const filePath = join98(skillDirPath, file.name);
|
|
12962
|
+
const fileDir = join98(skillDirPath, dirname2(file.name));
|
|
12659
12963
|
if (fileDir !== skillDirPath) {
|
|
12660
12964
|
await ensureDir(fileDir);
|
|
12661
12965
|
}
|
|
12662
12966
|
await writeFileContent(filePath, file.body);
|
|
12663
12967
|
}
|
|
12664
12968
|
return {
|
|
12665
|
-
relativeDirPathFromCwd:
|
|
12969
|
+
relativeDirPathFromCwd: join98(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12666
12970
|
frontmatter: skill.getFrontmatter(),
|
|
12667
12971
|
body: skill.getBody(),
|
|
12668
12972
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12684,13 +12988,13 @@ async function deleteSkill({
|
|
|
12684
12988
|
intendedRootDir: process.cwd()
|
|
12685
12989
|
});
|
|
12686
12990
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
12687
|
-
const skillDirPath =
|
|
12991
|
+
const skillDirPath = join98(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12688
12992
|
try {
|
|
12689
12993
|
if (await directoryExists(skillDirPath)) {
|
|
12690
12994
|
await removeDirectory(skillDirPath);
|
|
12691
12995
|
}
|
|
12692
12996
|
return {
|
|
12693
|
-
relativeDirPathFromCwd:
|
|
12997
|
+
relativeDirPathFromCwd: join98(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12694
12998
|
};
|
|
12695
12999
|
} catch (error) {
|
|
12696
13000
|
throw new Error(
|
|
@@ -12701,29 +13005,29 @@ async function deleteSkill({
|
|
|
12701
13005
|
);
|
|
12702
13006
|
}
|
|
12703
13007
|
}
|
|
12704
|
-
var McpSkillFileSchema =
|
|
12705
|
-
name:
|
|
12706
|
-
body:
|
|
13008
|
+
var McpSkillFileSchema = z47.object({
|
|
13009
|
+
name: z47.string(),
|
|
13010
|
+
body: z47.string()
|
|
12707
13011
|
});
|
|
12708
13012
|
var skillToolSchemas = {
|
|
12709
|
-
listSkills:
|
|
12710
|
-
getSkill:
|
|
12711
|
-
relativeDirPathFromCwd:
|
|
13013
|
+
listSkills: z47.object({}),
|
|
13014
|
+
getSkill: z47.object({
|
|
13015
|
+
relativeDirPathFromCwd: z47.string()
|
|
12712
13016
|
}),
|
|
12713
|
-
putSkill:
|
|
12714
|
-
relativeDirPathFromCwd:
|
|
13017
|
+
putSkill: z47.object({
|
|
13018
|
+
relativeDirPathFromCwd: z47.string(),
|
|
12715
13019
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
12716
|
-
body:
|
|
12717
|
-
otherFiles:
|
|
13020
|
+
body: z47.string(),
|
|
13021
|
+
otherFiles: z47.optional(z47.array(McpSkillFileSchema))
|
|
12718
13022
|
}),
|
|
12719
|
-
deleteSkill:
|
|
12720
|
-
relativeDirPathFromCwd:
|
|
13023
|
+
deleteSkill: z47.object({
|
|
13024
|
+
relativeDirPathFromCwd: z47.string()
|
|
12721
13025
|
})
|
|
12722
13026
|
};
|
|
12723
13027
|
var skillTools = {
|
|
12724
13028
|
listSkills: {
|
|
12725
13029
|
name: "listSkills",
|
|
12726
|
-
description: `List all skills from ${
|
|
13030
|
+
description: `List all skills from ${join98(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
12727
13031
|
parameters: skillToolSchemas.listSkills,
|
|
12728
13032
|
execute: async () => {
|
|
12729
13033
|
const skills = await listSkills();
|
|
@@ -12766,12 +13070,12 @@ var skillTools = {
|
|
|
12766
13070
|
};
|
|
12767
13071
|
|
|
12768
13072
|
// src/mcp/subagents.ts
|
|
12769
|
-
import { basename as basename27, join as
|
|
12770
|
-
import { z as
|
|
13073
|
+
import { basename as basename27, join as join99 } from "path";
|
|
13074
|
+
import { z as z48 } from "zod/mini";
|
|
12771
13075
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
12772
13076
|
var maxSubagentsCount = 1e3;
|
|
12773
13077
|
async function listSubagents() {
|
|
12774
|
-
const subagentsDir =
|
|
13078
|
+
const subagentsDir = join99(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12775
13079
|
try {
|
|
12776
13080
|
const files = await listDirectoryFiles(subagentsDir);
|
|
12777
13081
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12784,7 +13088,7 @@ async function listSubagents() {
|
|
|
12784
13088
|
});
|
|
12785
13089
|
const frontmatter = subagent.getFrontmatter();
|
|
12786
13090
|
return {
|
|
12787
|
-
relativePathFromCwd:
|
|
13091
|
+
relativePathFromCwd: join99(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
12788
13092
|
frontmatter
|
|
12789
13093
|
};
|
|
12790
13094
|
} catch (error) {
|
|
@@ -12813,7 +13117,7 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
12813
13117
|
validate: true
|
|
12814
13118
|
});
|
|
12815
13119
|
return {
|
|
12816
|
-
relativePathFromCwd:
|
|
13120
|
+
relativePathFromCwd: join99(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12817
13121
|
frontmatter: subagent.getFrontmatter(),
|
|
12818
13122
|
body: subagent.getBody()
|
|
12819
13123
|
};
|
|
@@ -12842,7 +13146,7 @@ async function putSubagent({
|
|
|
12842
13146
|
try {
|
|
12843
13147
|
const existingSubagents = await listSubagents();
|
|
12844
13148
|
const isUpdate = existingSubagents.some(
|
|
12845
|
-
(subagent2) => subagent2.relativePathFromCwd ===
|
|
13149
|
+
(subagent2) => subagent2.relativePathFromCwd === join99(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12846
13150
|
);
|
|
12847
13151
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
12848
13152
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -12855,11 +13159,11 @@ async function putSubagent({
|
|
|
12855
13159
|
body,
|
|
12856
13160
|
validate: true
|
|
12857
13161
|
});
|
|
12858
|
-
const subagentsDir =
|
|
13162
|
+
const subagentsDir = join99(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12859
13163
|
await ensureDir(subagentsDir);
|
|
12860
13164
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
12861
13165
|
return {
|
|
12862
|
-
relativePathFromCwd:
|
|
13166
|
+
relativePathFromCwd: join99(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12863
13167
|
frontmatter: subagent.getFrontmatter(),
|
|
12864
13168
|
body: subagent.getBody()
|
|
12865
13169
|
};
|
|
@@ -12875,11 +13179,11 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12875
13179
|
intendedRootDir: process.cwd()
|
|
12876
13180
|
});
|
|
12877
13181
|
const filename = basename27(relativePathFromCwd);
|
|
12878
|
-
const fullPath =
|
|
13182
|
+
const fullPath = join99(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
12879
13183
|
try {
|
|
12880
13184
|
await removeFile(fullPath);
|
|
12881
13185
|
return {
|
|
12882
|
-
relativePathFromCwd:
|
|
13186
|
+
relativePathFromCwd: join99(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12883
13187
|
};
|
|
12884
13188
|
} catch (error) {
|
|
12885
13189
|
throw new Error(
|
|
@@ -12891,23 +13195,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12891
13195
|
}
|
|
12892
13196
|
}
|
|
12893
13197
|
var subagentToolSchemas = {
|
|
12894
|
-
listSubagents:
|
|
12895
|
-
getSubagent:
|
|
12896
|
-
relativePathFromCwd:
|
|
13198
|
+
listSubagents: z48.object({}),
|
|
13199
|
+
getSubagent: z48.object({
|
|
13200
|
+
relativePathFromCwd: z48.string()
|
|
12897
13201
|
}),
|
|
12898
|
-
putSubagent:
|
|
12899
|
-
relativePathFromCwd:
|
|
13202
|
+
putSubagent: z48.object({
|
|
13203
|
+
relativePathFromCwd: z48.string(),
|
|
12900
13204
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
12901
|
-
body:
|
|
13205
|
+
body: z48.string()
|
|
12902
13206
|
}),
|
|
12903
|
-
deleteSubagent:
|
|
12904
|
-
relativePathFromCwd:
|
|
13207
|
+
deleteSubagent: z48.object({
|
|
13208
|
+
relativePathFromCwd: z48.string()
|
|
12905
13209
|
})
|
|
12906
13210
|
};
|
|
12907
13211
|
var subagentTools = {
|
|
12908
13212
|
listSubagents: {
|
|
12909
13213
|
name: "listSubagents",
|
|
12910
|
-
description: `List all subagents from ${
|
|
13214
|
+
description: `List all subagents from ${join99(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12911
13215
|
parameters: subagentToolSchemas.listSubagents,
|
|
12912
13216
|
execute: async () => {
|
|
12913
13217
|
const subagents = await listSubagents();
|
|
@@ -12949,20 +13253,20 @@ var subagentTools = {
|
|
|
12949
13253
|
};
|
|
12950
13254
|
|
|
12951
13255
|
// src/mcp/tools.ts
|
|
12952
|
-
var rulesyncFeatureSchema =
|
|
12953
|
-
var rulesyncOperationSchema =
|
|
12954
|
-
var skillFileSchema =
|
|
12955
|
-
name:
|
|
12956
|
-
body:
|
|
13256
|
+
var rulesyncFeatureSchema = z49.enum(["rule", "command", "subagent", "skill", "ignore", "mcp"]);
|
|
13257
|
+
var rulesyncOperationSchema = z49.enum(["list", "get", "put", "delete"]);
|
|
13258
|
+
var skillFileSchema = z49.object({
|
|
13259
|
+
name: z49.string(),
|
|
13260
|
+
body: z49.string()
|
|
12957
13261
|
});
|
|
12958
|
-
var rulesyncToolSchema =
|
|
13262
|
+
var rulesyncToolSchema = z49.object({
|
|
12959
13263
|
feature: rulesyncFeatureSchema,
|
|
12960
13264
|
operation: rulesyncOperationSchema,
|
|
12961
|
-
targetPathFromCwd:
|
|
12962
|
-
frontmatter:
|
|
12963
|
-
body:
|
|
12964
|
-
otherFiles:
|
|
12965
|
-
content:
|
|
13265
|
+
targetPathFromCwd: z49.optional(z49.string()),
|
|
13266
|
+
frontmatter: z49.optional(z49.unknown()),
|
|
13267
|
+
body: z49.optional(z49.string()),
|
|
13268
|
+
otherFiles: z49.optional(z49.array(skillFileSchema)),
|
|
13269
|
+
content: z49.optional(z49.string())
|
|
12966
13270
|
});
|
|
12967
13271
|
var supportedOperationsByFeature = {
|
|
12968
13272
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -13158,7 +13462,7 @@ async function mcpCommand({ version }) {
|
|
|
13158
13462
|
}
|
|
13159
13463
|
|
|
13160
13464
|
// src/cli/index.ts
|
|
13161
|
-
var getVersion = () => "5.
|
|
13465
|
+
var getVersion = () => "5.4.0";
|
|
13162
13466
|
var main = async () => {
|
|
13163
13467
|
const program = new Command();
|
|
13164
13468
|
const version = getVersion();
|