rulesync 3.30.0 → 3.32.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 +37 -2
- package/dist/index.cjs +1177 -732
- package/dist/index.js +1173 -728
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -252,17 +252,18 @@ var ALL_TOOL_TARGETS = [
|
|
|
252
252
|
"antigravity",
|
|
253
253
|
"augmentcode",
|
|
254
254
|
"augmentcode-legacy",
|
|
255
|
-
"copilot",
|
|
256
|
-
"cursor",
|
|
257
|
-
"cline",
|
|
258
255
|
"claudecode",
|
|
256
|
+
"claudecode-legacy",
|
|
257
|
+
"cline",
|
|
259
258
|
"codexcli",
|
|
259
|
+
"copilot",
|
|
260
|
+
"cursor",
|
|
261
|
+
"geminicli",
|
|
262
|
+
"junie",
|
|
263
|
+
"kiro",
|
|
260
264
|
"opencode",
|
|
261
265
|
"qwencode",
|
|
262
266
|
"roo",
|
|
263
|
-
"geminicli",
|
|
264
|
-
"kiro",
|
|
265
|
-
"junie",
|
|
266
267
|
"warp",
|
|
267
268
|
"windsurf"
|
|
268
269
|
];
|
|
@@ -295,6 +296,11 @@ var ConfigFileSchema = import_mini3.z.object({
|
|
|
295
296
|
...import_mini3.z.partial(ConfigParamsSchema).shape
|
|
296
297
|
});
|
|
297
298
|
var RequiredConfigParamsSchema = import_mini3.z.required(ConfigParamsSchema);
|
|
299
|
+
var CONFLICTING_TARGET_PAIRS = [
|
|
300
|
+
["augmentcode", "augmentcode-legacy"],
|
|
301
|
+
["claudecode", "claudecode-legacy"]
|
|
302
|
+
];
|
|
303
|
+
var LEGACY_TARGETS = ["augmentcode-legacy", "claudecode-legacy"];
|
|
298
304
|
var Config = class {
|
|
299
305
|
baseDirs;
|
|
300
306
|
targets;
|
|
@@ -321,6 +327,7 @@ var Config = class {
|
|
|
321
327
|
experimentalSimulateCommands,
|
|
322
328
|
experimentalSimulateSubagents
|
|
323
329
|
}) {
|
|
330
|
+
this.validateConflictingTargets(targets);
|
|
324
331
|
this.baseDirs = baseDirs;
|
|
325
332
|
this.targets = targets;
|
|
326
333
|
this.features = features;
|
|
@@ -332,12 +339,26 @@ var Config = class {
|
|
|
332
339
|
this.simulateSkills = simulateSkills ?? false;
|
|
333
340
|
this.modularMcp = modularMcp ?? false;
|
|
334
341
|
}
|
|
342
|
+
validateConflictingTargets(targets) {
|
|
343
|
+
for (const [target1, target2] of CONFLICTING_TARGET_PAIRS) {
|
|
344
|
+
const hasTarget1 = targets.includes(target1);
|
|
345
|
+
const hasTarget2 = targets.includes(target2);
|
|
346
|
+
if (hasTarget1 && hasTarget2) {
|
|
347
|
+
throw new Error(
|
|
348
|
+
`Conflicting targets: '${target1}' and '${target2}' cannot be used together. Please choose one.`
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
335
353
|
getBaseDirs() {
|
|
336
354
|
return this.baseDirs;
|
|
337
355
|
}
|
|
338
356
|
getTargets() {
|
|
339
357
|
if (this.targets.includes("*")) {
|
|
340
|
-
return
|
|
358
|
+
return ALL_TOOL_TARGETS.filter(
|
|
359
|
+
// eslint-disable-next-line no-type-assertion/no-type-assertion
|
|
360
|
+
(target) => !LEGACY_TARGETS.includes(target)
|
|
361
|
+
);
|
|
341
362
|
}
|
|
342
363
|
return this.targets.filter((target) => target !== "*");
|
|
343
364
|
}
|
|
@@ -4237,20 +4258,21 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4237
4258
|
};
|
|
4238
4259
|
|
|
4239
4260
|
// src/features/rules/rules-processor.ts
|
|
4240
|
-
var
|
|
4241
|
-
var
|
|
4242
|
-
var
|
|
4261
|
+
var import_node_path84 = require("path");
|
|
4262
|
+
var import_toon = require("@toon-format/toon");
|
|
4263
|
+
var import_mini33 = require("zod/mini");
|
|
4243
4264
|
|
|
4244
4265
|
// src/features/skills/codexcli-skill.ts
|
|
4245
|
-
var
|
|
4246
|
-
|
|
4247
|
-
// src/features/skills/simulated-skill.ts
|
|
4248
|
-
var import_node_path42 = require("path");
|
|
4249
|
-
var import_mini19 = require("zod/mini");
|
|
4266
|
+
var import_node_path44 = require("path");
|
|
4267
|
+
var import_mini20 = require("zod/mini");
|
|
4250
4268
|
|
|
4251
4269
|
// src/constants/general.ts
|
|
4252
4270
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
4253
4271
|
|
|
4272
|
+
// src/features/skills/rulesync-skill.ts
|
|
4273
|
+
var import_node_path42 = require("path");
|
|
4274
|
+
var import_mini19 = require("zod/mini");
|
|
4275
|
+
|
|
4254
4276
|
// src/types/ai-dir.ts
|
|
4255
4277
|
var import_node_path41 = __toESM(require("path"), 1);
|
|
4256
4278
|
var AiDir = class {
|
|
@@ -4363,7 +4385,113 @@ var AiDir = class {
|
|
|
4363
4385
|
}
|
|
4364
4386
|
};
|
|
4365
4387
|
|
|
4388
|
+
// src/features/skills/rulesync-skill.ts
|
|
4389
|
+
var RulesyncSkillFrontmatterSchemaInternal = import_mini19.z.object({
|
|
4390
|
+
name: import_mini19.z.string(),
|
|
4391
|
+
description: import_mini19.z.string(),
|
|
4392
|
+
targets: import_mini19.z._default(RulesyncTargetsSchema, ["*"]),
|
|
4393
|
+
claudecode: import_mini19.z.optional(
|
|
4394
|
+
import_mini19.z.object({
|
|
4395
|
+
"allowed-tools": import_mini19.z.optional(import_mini19.z.array(import_mini19.z.string()))
|
|
4396
|
+
})
|
|
4397
|
+
)
|
|
4398
|
+
});
|
|
4399
|
+
var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
|
|
4400
|
+
var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
4401
|
+
constructor({
|
|
4402
|
+
baseDir = process.cwd(),
|
|
4403
|
+
relativeDirPath = RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
4404
|
+
dirName,
|
|
4405
|
+
frontmatter,
|
|
4406
|
+
body,
|
|
4407
|
+
otherFiles = [],
|
|
4408
|
+
validate = true,
|
|
4409
|
+
global = false
|
|
4410
|
+
}) {
|
|
4411
|
+
super({
|
|
4412
|
+
baseDir,
|
|
4413
|
+
relativeDirPath,
|
|
4414
|
+
dirName,
|
|
4415
|
+
mainFile: {
|
|
4416
|
+
name: SKILL_FILE_NAME,
|
|
4417
|
+
body,
|
|
4418
|
+
frontmatter: { ...frontmatter }
|
|
4419
|
+
},
|
|
4420
|
+
otherFiles,
|
|
4421
|
+
global
|
|
4422
|
+
});
|
|
4423
|
+
if (validate) {
|
|
4424
|
+
const result = this.validate();
|
|
4425
|
+
if (!result.success) {
|
|
4426
|
+
throw result.error;
|
|
4427
|
+
}
|
|
4428
|
+
}
|
|
4429
|
+
}
|
|
4430
|
+
static getSettablePaths() {
|
|
4431
|
+
return {
|
|
4432
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH
|
|
4433
|
+
};
|
|
4434
|
+
}
|
|
4435
|
+
getFrontmatter() {
|
|
4436
|
+
if (!this.mainFile?.frontmatter) {
|
|
4437
|
+
throw new Error("Frontmatter is not defined");
|
|
4438
|
+
}
|
|
4439
|
+
const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
4440
|
+
return result;
|
|
4441
|
+
}
|
|
4442
|
+
getBody() {
|
|
4443
|
+
return this.mainFile?.body ?? "";
|
|
4444
|
+
}
|
|
4445
|
+
validate() {
|
|
4446
|
+
const result = RulesyncSkillFrontmatterSchema.safeParse(this.mainFile?.frontmatter);
|
|
4447
|
+
if (!result.success) {
|
|
4448
|
+
return {
|
|
4449
|
+
success: false,
|
|
4450
|
+
error: new Error(
|
|
4451
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
4452
|
+
)
|
|
4453
|
+
};
|
|
4454
|
+
}
|
|
4455
|
+
return { success: true, error: null };
|
|
4456
|
+
}
|
|
4457
|
+
static async fromDir({
|
|
4458
|
+
baseDir = process.cwd(),
|
|
4459
|
+
relativeDirPath = RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
4460
|
+
dirName,
|
|
4461
|
+
global = false
|
|
4462
|
+
}) {
|
|
4463
|
+
const skillDirPath = (0, import_node_path42.join)(baseDir, relativeDirPath, dirName);
|
|
4464
|
+
const skillFilePath = (0, import_node_path42.join)(skillDirPath, SKILL_FILE_NAME);
|
|
4465
|
+
if (!await fileExists(skillFilePath)) {
|
|
4466
|
+
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
4467
|
+
}
|
|
4468
|
+
const fileContent = await readFileContent(skillFilePath);
|
|
4469
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
4470
|
+
const result = RulesyncSkillFrontmatterSchema.safeParse(frontmatter);
|
|
4471
|
+
if (!result.success) {
|
|
4472
|
+
throw new Error(`Invalid frontmatter in ${skillFilePath}: ${formatError(result.error)}`);
|
|
4473
|
+
}
|
|
4474
|
+
const otherFiles = await this.collectOtherFiles(
|
|
4475
|
+
baseDir,
|
|
4476
|
+
relativeDirPath,
|
|
4477
|
+
dirName,
|
|
4478
|
+
SKILL_FILE_NAME
|
|
4479
|
+
);
|
|
4480
|
+
return new _RulesyncSkill({
|
|
4481
|
+
baseDir,
|
|
4482
|
+
relativeDirPath,
|
|
4483
|
+
dirName,
|
|
4484
|
+
frontmatter: result.data,
|
|
4485
|
+
body: content.trim(),
|
|
4486
|
+
otherFiles,
|
|
4487
|
+
validate: true,
|
|
4488
|
+
global
|
|
4489
|
+
});
|
|
4490
|
+
}
|
|
4491
|
+
};
|
|
4492
|
+
|
|
4366
4493
|
// src/features/skills/tool-skill.ts
|
|
4494
|
+
var import_node_path43 = require("path");
|
|
4367
4495
|
var ToolSkill = class extends AiDir {
|
|
4368
4496
|
/**
|
|
4369
4497
|
* Get the settable paths for this tool's skill directories.
|
|
@@ -4417,24 +4545,66 @@ var ToolSkill = class extends AiDir {
|
|
|
4417
4545
|
static isTargetedByRulesyncSkill(_rulesyncSkill) {
|
|
4418
4546
|
throw new Error("Please implement this method in the subclass.");
|
|
4419
4547
|
}
|
|
4548
|
+
/**
|
|
4549
|
+
* Load and parse skill directory content.
|
|
4550
|
+
* This is a helper method that handles the common logic of reading SKILL.md,
|
|
4551
|
+
* parsing frontmatter, and collecting other files.
|
|
4552
|
+
*
|
|
4553
|
+
* Subclasses should call this method and then validate the frontmatter
|
|
4554
|
+
* against their specific schema.
|
|
4555
|
+
*
|
|
4556
|
+
* @param params - Parameters including settablePaths callback to get tool-specific paths
|
|
4557
|
+
* @returns Parsed skill directory content
|
|
4558
|
+
*/
|
|
4559
|
+
static async loadSkillDirContent({
|
|
4560
|
+
baseDir = process.cwd(),
|
|
4561
|
+
relativeDirPath,
|
|
4562
|
+
dirName,
|
|
4563
|
+
global = false,
|
|
4564
|
+
getSettablePaths
|
|
4565
|
+
}) {
|
|
4566
|
+
const settablePaths = getSettablePaths({ global });
|
|
4567
|
+
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
4568
|
+
const skillDirPath = (0, import_node_path43.join)(baseDir, actualRelativeDirPath, dirName);
|
|
4569
|
+
const skillFilePath = (0, import_node_path43.join)(skillDirPath, SKILL_FILE_NAME);
|
|
4570
|
+
if (!await fileExists(skillFilePath)) {
|
|
4571
|
+
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
4572
|
+
}
|
|
4573
|
+
const fileContent = await readFileContent(skillFilePath);
|
|
4574
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
4575
|
+
const otherFiles = await this.collectOtherFiles(
|
|
4576
|
+
baseDir,
|
|
4577
|
+
actualRelativeDirPath,
|
|
4578
|
+
dirName,
|
|
4579
|
+
SKILL_FILE_NAME
|
|
4580
|
+
);
|
|
4581
|
+
return {
|
|
4582
|
+
baseDir,
|
|
4583
|
+
relativeDirPath: actualRelativeDirPath,
|
|
4584
|
+
dirName,
|
|
4585
|
+
frontmatter,
|
|
4586
|
+
body: content.trim(),
|
|
4587
|
+
otherFiles,
|
|
4588
|
+
global
|
|
4589
|
+
};
|
|
4590
|
+
}
|
|
4420
4591
|
};
|
|
4421
4592
|
|
|
4422
|
-
// src/features/skills/
|
|
4423
|
-
var
|
|
4424
|
-
name:
|
|
4425
|
-
description:
|
|
4593
|
+
// src/features/skills/codexcli-skill.ts
|
|
4594
|
+
var CodexCliSkillFrontmatterSchema = import_mini20.z.object({
|
|
4595
|
+
name: import_mini20.z.string(),
|
|
4596
|
+
description: import_mini20.z.string()
|
|
4426
4597
|
});
|
|
4427
|
-
var
|
|
4428
|
-
frontmatter;
|
|
4429
|
-
body;
|
|
4598
|
+
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
4430
4599
|
constructor({
|
|
4431
4600
|
baseDir = process.cwd(),
|
|
4432
|
-
relativeDirPath,
|
|
4601
|
+
relativeDirPath = (0, import_node_path44.join)(".codex", "skills"),
|
|
4433
4602
|
dirName,
|
|
4434
4603
|
frontmatter,
|
|
4435
4604
|
body,
|
|
4436
4605
|
otherFiles = [],
|
|
4437
|
-
validate = true
|
|
4606
|
+
validate = true,
|
|
4607
|
+
global = false
|
|
4438
4608
|
}) {
|
|
4439
4609
|
super({
|
|
4440
4610
|
baseDir,
|
|
@@ -4446,37 +4616,42 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
4446
4616
|
frontmatter: { ...frontmatter }
|
|
4447
4617
|
},
|
|
4448
4618
|
otherFiles,
|
|
4449
|
-
global
|
|
4450
|
-
// Simulated skills are project mode only
|
|
4619
|
+
global
|
|
4451
4620
|
});
|
|
4452
4621
|
if (validate) {
|
|
4453
|
-
const result =
|
|
4622
|
+
const result = this.validate();
|
|
4454
4623
|
if (!result.success) {
|
|
4455
|
-
throw
|
|
4456
|
-
`Invalid frontmatter in ${(0, import_node_path42.join)(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
4457
|
-
);
|
|
4624
|
+
throw result.error;
|
|
4458
4625
|
}
|
|
4459
4626
|
}
|
|
4460
|
-
this.frontmatter = frontmatter;
|
|
4461
|
-
this.body = body;
|
|
4462
4627
|
}
|
|
4463
|
-
|
|
4464
|
-
|
|
4628
|
+
static getSettablePaths({ global = false } = {}) {
|
|
4629
|
+
if (!global) {
|
|
4630
|
+
throw new Error("CodexCliSkill only supports global mode. Please pass { global: true }.");
|
|
4631
|
+
}
|
|
4632
|
+
return {
|
|
4633
|
+
relativeDirPath: (0, import_node_path44.join)(".codex", "skills")
|
|
4634
|
+
};
|
|
4465
4635
|
}
|
|
4466
4636
|
getFrontmatter() {
|
|
4467
|
-
|
|
4637
|
+
if (!this.mainFile?.frontmatter) {
|
|
4638
|
+
throw new Error("Frontmatter is not defined");
|
|
4639
|
+
}
|
|
4640
|
+
const result = CodexCliSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
4641
|
+
return result;
|
|
4468
4642
|
}
|
|
4469
|
-
|
|
4470
|
-
|
|
4643
|
+
getBody() {
|
|
4644
|
+
return this.mainFile?.body ?? "";
|
|
4471
4645
|
}
|
|
4472
4646
|
validate() {
|
|
4473
|
-
if (!this.
|
|
4474
|
-
return {
|
|
4647
|
+
if (!this.mainFile) {
|
|
4648
|
+
return {
|
|
4649
|
+
success: false,
|
|
4650
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
4651
|
+
};
|
|
4475
4652
|
}
|
|
4476
|
-
const result =
|
|
4477
|
-
if (result.success) {
|
|
4478
|
-
return { success: true, error: null };
|
|
4479
|
-
} else {
|
|
4653
|
+
const result = CodexCliSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
4654
|
+
if (!result.success) {
|
|
4480
4655
|
return {
|
|
4481
4656
|
success: false,
|
|
4482
4657
|
error: new Error(
|
|
@@ -4484,39 +4659,180 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
4484
4659
|
)
|
|
4485
4660
|
};
|
|
4486
4661
|
}
|
|
4662
|
+
return { success: true, error: null };
|
|
4487
4663
|
}
|
|
4488
|
-
|
|
4664
|
+
toRulesyncSkill() {
|
|
4665
|
+
const frontmatter = this.getFrontmatter();
|
|
4666
|
+
const rulesyncFrontmatter = {
|
|
4667
|
+
name: frontmatter.name,
|
|
4668
|
+
description: frontmatter.description,
|
|
4669
|
+
targets: ["*"]
|
|
4670
|
+
};
|
|
4671
|
+
return new RulesyncSkill({
|
|
4672
|
+
baseDir: this.baseDir,
|
|
4673
|
+
relativeDirPath: this.relativeDirPath,
|
|
4674
|
+
dirName: this.getDirName(),
|
|
4675
|
+
frontmatter: rulesyncFrontmatter,
|
|
4676
|
+
body: this.getBody(),
|
|
4677
|
+
otherFiles: this.getOtherFiles(),
|
|
4678
|
+
validate: true,
|
|
4679
|
+
global: this.global
|
|
4680
|
+
});
|
|
4681
|
+
}
|
|
4682
|
+
static fromRulesyncSkill({
|
|
4489
4683
|
rulesyncSkill,
|
|
4490
|
-
validate = true
|
|
4684
|
+
validate = true,
|
|
4685
|
+
global = false
|
|
4491
4686
|
}) {
|
|
4687
|
+
const settablePaths = _CodexCliSkill.getSettablePaths({ global });
|
|
4492
4688
|
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
4493
|
-
const
|
|
4689
|
+
const codexFrontmatter = {
|
|
4494
4690
|
name: rulesyncFrontmatter.name,
|
|
4495
4691
|
description: rulesyncFrontmatter.description
|
|
4496
4692
|
};
|
|
4497
|
-
return {
|
|
4693
|
+
return new _CodexCliSkill({
|
|
4498
4694
|
baseDir: rulesyncSkill.getBaseDir(),
|
|
4499
|
-
relativeDirPath:
|
|
4695
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
4500
4696
|
dirName: rulesyncSkill.getDirName(),
|
|
4501
|
-
frontmatter:
|
|
4697
|
+
frontmatter: codexFrontmatter,
|
|
4502
4698
|
body: rulesyncSkill.getBody(),
|
|
4503
4699
|
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
4504
|
-
validate
|
|
4505
|
-
|
|
4700
|
+
validate,
|
|
4701
|
+
global
|
|
4702
|
+
});
|
|
4506
4703
|
}
|
|
4507
|
-
static
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
const
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4704
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
4705
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
4706
|
+
return targets.includes("*") || targets.includes("codexcli");
|
|
4707
|
+
}
|
|
4708
|
+
static async fromDir(params) {
|
|
4709
|
+
const loaded = await this.loadSkillDirContent({
|
|
4710
|
+
...params,
|
|
4711
|
+
getSettablePaths: _CodexCliSkill.getSettablePaths
|
|
4712
|
+
});
|
|
4713
|
+
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
4714
|
+
if (!result.success) {
|
|
4715
|
+
const skillDirPath = (0, import_node_path44.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
4716
|
+
throw new Error(
|
|
4717
|
+
`Invalid frontmatter in ${(0, import_node_path44.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
4718
|
+
);
|
|
4719
|
+
}
|
|
4720
|
+
return new _CodexCliSkill({
|
|
4721
|
+
baseDir: loaded.baseDir,
|
|
4722
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
4723
|
+
dirName: loaded.dirName,
|
|
4724
|
+
frontmatter: result.data,
|
|
4725
|
+
body: loaded.body,
|
|
4726
|
+
otherFiles: loaded.otherFiles,
|
|
4727
|
+
validate: true,
|
|
4728
|
+
global: loaded.global
|
|
4729
|
+
});
|
|
4730
|
+
}
|
|
4731
|
+
};
|
|
4732
|
+
|
|
4733
|
+
// src/features/skills/copilot-skill.ts
|
|
4734
|
+
var import_node_path46 = require("path");
|
|
4735
|
+
|
|
4736
|
+
// src/features/skills/simulated-skill.ts
|
|
4737
|
+
var import_node_path45 = require("path");
|
|
4738
|
+
var import_mini21 = require("zod/mini");
|
|
4739
|
+
var SimulatedSkillFrontmatterSchema = import_mini21.z.object({
|
|
4740
|
+
name: import_mini21.z.string(),
|
|
4741
|
+
description: import_mini21.z.string()
|
|
4742
|
+
});
|
|
4743
|
+
var SimulatedSkill = class extends ToolSkill {
|
|
4744
|
+
frontmatter;
|
|
4745
|
+
body;
|
|
4746
|
+
constructor({
|
|
4747
|
+
baseDir = process.cwd(),
|
|
4748
|
+
relativeDirPath,
|
|
4749
|
+
dirName,
|
|
4750
|
+
frontmatter,
|
|
4751
|
+
body,
|
|
4752
|
+
otherFiles = [],
|
|
4753
|
+
validate = true
|
|
4754
|
+
}) {
|
|
4755
|
+
super({
|
|
4756
|
+
baseDir,
|
|
4757
|
+
relativeDirPath,
|
|
4758
|
+
dirName,
|
|
4759
|
+
mainFile: {
|
|
4760
|
+
name: SKILL_FILE_NAME,
|
|
4761
|
+
body,
|
|
4762
|
+
frontmatter: { ...frontmatter }
|
|
4763
|
+
},
|
|
4764
|
+
otherFiles,
|
|
4765
|
+
global: false
|
|
4766
|
+
// Simulated skills are project mode only
|
|
4767
|
+
});
|
|
4768
|
+
if (validate) {
|
|
4769
|
+
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
4770
|
+
if (!result.success) {
|
|
4771
|
+
throw new Error(
|
|
4772
|
+
`Invalid frontmatter in ${(0, import_node_path45.join)(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
4773
|
+
);
|
|
4774
|
+
}
|
|
4775
|
+
}
|
|
4776
|
+
this.frontmatter = frontmatter;
|
|
4777
|
+
this.body = body;
|
|
4778
|
+
}
|
|
4779
|
+
getBody() {
|
|
4780
|
+
return this.body;
|
|
4781
|
+
}
|
|
4782
|
+
getFrontmatter() {
|
|
4783
|
+
return this.frontmatter;
|
|
4784
|
+
}
|
|
4785
|
+
toRulesyncSkill() {
|
|
4786
|
+
throw new Error("Not implemented because it is a SIMULATED skill.");
|
|
4787
|
+
}
|
|
4788
|
+
validate() {
|
|
4789
|
+
if (!this.frontmatter) {
|
|
4790
|
+
return { success: true, error: null };
|
|
4791
|
+
}
|
|
4792
|
+
const result = SimulatedSkillFrontmatterSchema.safeParse(this.frontmatter);
|
|
4793
|
+
if (result.success) {
|
|
4794
|
+
return { success: true, error: null };
|
|
4795
|
+
} else {
|
|
4796
|
+
return {
|
|
4797
|
+
success: false,
|
|
4798
|
+
error: new Error(
|
|
4799
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
4800
|
+
)
|
|
4801
|
+
};
|
|
4802
|
+
}
|
|
4803
|
+
}
|
|
4804
|
+
static fromRulesyncSkillDefault({
|
|
4805
|
+
rulesyncSkill,
|
|
4806
|
+
validate = true
|
|
4807
|
+
}) {
|
|
4808
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
4809
|
+
const simulatedFrontmatter = {
|
|
4810
|
+
name: rulesyncFrontmatter.name,
|
|
4811
|
+
description: rulesyncFrontmatter.description
|
|
4812
|
+
};
|
|
4813
|
+
return {
|
|
4814
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
4815
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
4816
|
+
dirName: rulesyncSkill.getDirName(),
|
|
4817
|
+
frontmatter: simulatedFrontmatter,
|
|
4818
|
+
body: rulesyncSkill.getBody(),
|
|
4819
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
4820
|
+
validate
|
|
4821
|
+
};
|
|
4822
|
+
}
|
|
4823
|
+
static async fromDirDefault({
|
|
4824
|
+
baseDir = process.cwd(),
|
|
4825
|
+
relativeDirPath,
|
|
4826
|
+
dirName
|
|
4827
|
+
}) {
|
|
4828
|
+
const settablePaths = this.getSettablePaths();
|
|
4829
|
+
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
4830
|
+
const skillDirPath = (0, import_node_path45.join)(baseDir, actualRelativeDirPath, dirName);
|
|
4831
|
+
const skillFilePath = (0, import_node_path45.join)(skillDirPath, SKILL_FILE_NAME);
|
|
4832
|
+
if (!await fileExists(skillFilePath)) {
|
|
4833
|
+
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
4834
|
+
}
|
|
4835
|
+
const fileContent = await readFileContent(skillFilePath);
|
|
4520
4836
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
4521
4837
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
4522
4838
|
if (!result.success) {
|
|
@@ -4562,44 +4878,14 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
4562
4878
|
}
|
|
4563
4879
|
};
|
|
4564
4880
|
|
|
4565
|
-
// src/features/skills/codexcli-skill.ts
|
|
4566
|
-
var CodexCliSkill = class _CodexCliSkill extends SimulatedSkill {
|
|
4567
|
-
static getSettablePaths(options) {
|
|
4568
|
-
if (options?.global) {
|
|
4569
|
-
throw new Error("CodexCliSkill does not support global mode.");
|
|
4570
|
-
}
|
|
4571
|
-
return {
|
|
4572
|
-
relativeDirPath: (0, import_node_path43.join)(".codex", "skills")
|
|
4573
|
-
};
|
|
4574
|
-
}
|
|
4575
|
-
static async fromDir(params) {
|
|
4576
|
-
const baseParams = await this.fromDirDefault(params);
|
|
4577
|
-
return new _CodexCliSkill(baseParams);
|
|
4578
|
-
}
|
|
4579
|
-
static fromRulesyncSkill(params) {
|
|
4580
|
-
const baseParams = {
|
|
4581
|
-
...this.fromRulesyncSkillDefault(params),
|
|
4582
|
-
relativeDirPath: this.getSettablePaths().relativeDirPath
|
|
4583
|
-
};
|
|
4584
|
-
return new _CodexCliSkill(baseParams);
|
|
4585
|
-
}
|
|
4586
|
-
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
4587
|
-
return this.isTargetedByRulesyncSkillDefault({
|
|
4588
|
-
rulesyncSkill,
|
|
4589
|
-
toolTarget: "codexcli"
|
|
4590
|
-
});
|
|
4591
|
-
}
|
|
4592
|
-
};
|
|
4593
|
-
|
|
4594
4881
|
// src/features/skills/copilot-skill.ts
|
|
4595
|
-
var import_node_path44 = require("path");
|
|
4596
4882
|
var CopilotSkill = class _CopilotSkill extends SimulatedSkill {
|
|
4597
4883
|
static getSettablePaths(options) {
|
|
4598
4884
|
if (options?.global) {
|
|
4599
4885
|
throw new Error("CopilotSkill does not support global mode.");
|
|
4600
4886
|
}
|
|
4601
4887
|
return {
|
|
4602
|
-
relativeDirPath: (0,
|
|
4888
|
+
relativeDirPath: (0, import_node_path46.join)(".github", "skills")
|
|
4603
4889
|
};
|
|
4604
4890
|
}
|
|
4605
4891
|
static async fromDir(params) {
|
|
@@ -4622,14 +4908,14 @@ var CopilotSkill = class _CopilotSkill extends SimulatedSkill {
|
|
|
4622
4908
|
};
|
|
4623
4909
|
|
|
4624
4910
|
// src/features/skills/cursor-skill.ts
|
|
4625
|
-
var
|
|
4911
|
+
var import_node_path47 = require("path");
|
|
4626
4912
|
var CursorSkill = class _CursorSkill extends SimulatedSkill {
|
|
4627
4913
|
static getSettablePaths(options) {
|
|
4628
4914
|
if (options?.global) {
|
|
4629
4915
|
throw new Error("CursorSkill does not support global mode.");
|
|
4630
4916
|
}
|
|
4631
4917
|
return {
|
|
4632
|
-
relativeDirPath: (0,
|
|
4918
|
+
relativeDirPath: (0, import_node_path47.join)(".cursor", "skills")
|
|
4633
4919
|
};
|
|
4634
4920
|
}
|
|
4635
4921
|
static async fromDir(params) {
|
|
@@ -4652,11 +4938,11 @@ var CursorSkill = class _CursorSkill extends SimulatedSkill {
|
|
|
4652
4938
|
};
|
|
4653
4939
|
|
|
4654
4940
|
// src/features/skills/skills-processor.ts
|
|
4655
|
-
var
|
|
4656
|
-
var
|
|
4941
|
+
var import_node_path52 = require("path");
|
|
4942
|
+
var import_mini23 = require("zod/mini");
|
|
4657
4943
|
|
|
4658
4944
|
// src/types/dir-feature-processor.ts
|
|
4659
|
-
var
|
|
4945
|
+
var import_node_path48 = require("path");
|
|
4660
4946
|
var DirFeatureProcessor = class {
|
|
4661
4947
|
baseDir;
|
|
4662
4948
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -4678,14 +4964,14 @@ var DirFeatureProcessor = class {
|
|
|
4678
4964
|
await ensureDir(dirPath);
|
|
4679
4965
|
const mainFile = aiDir.getMainFile();
|
|
4680
4966
|
if (mainFile) {
|
|
4681
|
-
const mainFilePath = (0,
|
|
4967
|
+
const mainFilePath = (0, import_node_path48.join)(dirPath, mainFile.name);
|
|
4682
4968
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
4683
4969
|
const contentWithNewline = addTrailingNewline(content);
|
|
4684
4970
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
4685
4971
|
}
|
|
4686
4972
|
const otherFiles = aiDir.getOtherFiles();
|
|
4687
4973
|
for (const file of otherFiles) {
|
|
4688
|
-
const filePath = (0,
|
|
4974
|
+
const filePath = (0, import_node_path48.join)(dirPath, file.relativeFilePathToDirPath);
|
|
4689
4975
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
4690
4976
|
await writeFileContent(filePath, contentWithNewline);
|
|
4691
4977
|
}
|
|
@@ -4700,14 +4986,14 @@ var DirFeatureProcessor = class {
|
|
|
4700
4986
|
};
|
|
4701
4987
|
|
|
4702
4988
|
// src/features/skills/agentsmd-skill.ts
|
|
4703
|
-
var
|
|
4989
|
+
var import_node_path49 = require("path");
|
|
4704
4990
|
var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
4705
4991
|
static getSettablePaths(options) {
|
|
4706
4992
|
if (options?.global) {
|
|
4707
4993
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
4708
4994
|
}
|
|
4709
4995
|
return {
|
|
4710
|
-
relativeDirPath: (0,
|
|
4996
|
+
relativeDirPath: (0, import_node_path49.join)(".agents", "skills")
|
|
4711
4997
|
};
|
|
4712
4998
|
}
|
|
4713
4999
|
static async fromDir(params) {
|
|
@@ -4730,126 +5016,17 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
4730
5016
|
};
|
|
4731
5017
|
|
|
4732
5018
|
// src/features/skills/claudecode-skill.ts
|
|
4733
|
-
var
|
|
4734
|
-
var
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
var RulesyncSkillFrontmatterSchemaInternal = import_mini20.z.object({
|
|
4740
|
-
name: import_mini20.z.string(),
|
|
4741
|
-
description: import_mini20.z.string(),
|
|
4742
|
-
targets: import_mini20.z._default(RulesyncTargetsSchema, ["*"]),
|
|
4743
|
-
claudecode: import_mini20.z.optional(
|
|
4744
|
-
import_mini20.z.object({
|
|
4745
|
-
"allowed-tools": import_mini20.z.optional(import_mini20.z.array(import_mini20.z.string()))
|
|
4746
|
-
})
|
|
4747
|
-
)
|
|
4748
|
-
});
|
|
4749
|
-
var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
|
|
4750
|
-
var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
4751
|
-
constructor({
|
|
4752
|
-
baseDir = process.cwd(),
|
|
4753
|
-
relativeDirPath = RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
4754
|
-
dirName,
|
|
4755
|
-
frontmatter,
|
|
4756
|
-
body,
|
|
4757
|
-
otherFiles = [],
|
|
4758
|
-
validate = true,
|
|
4759
|
-
global = false
|
|
4760
|
-
}) {
|
|
4761
|
-
super({
|
|
4762
|
-
baseDir,
|
|
4763
|
-
relativeDirPath,
|
|
4764
|
-
dirName,
|
|
4765
|
-
mainFile: {
|
|
4766
|
-
name: SKILL_FILE_NAME,
|
|
4767
|
-
body,
|
|
4768
|
-
frontmatter: { ...frontmatter }
|
|
4769
|
-
},
|
|
4770
|
-
otherFiles,
|
|
4771
|
-
global
|
|
4772
|
-
});
|
|
4773
|
-
if (validate) {
|
|
4774
|
-
const result = this.validate();
|
|
4775
|
-
if (!result.success) {
|
|
4776
|
-
throw result.error;
|
|
4777
|
-
}
|
|
4778
|
-
}
|
|
4779
|
-
}
|
|
4780
|
-
static getSettablePaths() {
|
|
4781
|
-
return {
|
|
4782
|
-
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH
|
|
4783
|
-
};
|
|
4784
|
-
}
|
|
4785
|
-
getFrontmatter() {
|
|
4786
|
-
if (!this.mainFile?.frontmatter) {
|
|
4787
|
-
throw new Error("Frontmatter is not defined");
|
|
4788
|
-
}
|
|
4789
|
-
const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
4790
|
-
return result;
|
|
4791
|
-
}
|
|
4792
|
-
getBody() {
|
|
4793
|
-
return this.mainFile?.body ?? "";
|
|
4794
|
-
}
|
|
4795
|
-
validate() {
|
|
4796
|
-
const result = RulesyncSkillFrontmatterSchema.safeParse(this.mainFile?.frontmatter);
|
|
4797
|
-
if (!result.success) {
|
|
4798
|
-
return {
|
|
4799
|
-
success: false,
|
|
4800
|
-
error: new Error(
|
|
4801
|
-
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
4802
|
-
)
|
|
4803
|
-
};
|
|
4804
|
-
}
|
|
4805
|
-
return { success: true, error: null };
|
|
4806
|
-
}
|
|
4807
|
-
static async fromDir({
|
|
4808
|
-
baseDir = process.cwd(),
|
|
4809
|
-
relativeDirPath = RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
4810
|
-
dirName,
|
|
4811
|
-
global = false
|
|
4812
|
-
}) {
|
|
4813
|
-
const skillDirPath = (0, import_node_path48.join)(baseDir, relativeDirPath, dirName);
|
|
4814
|
-
const skillFilePath = (0, import_node_path48.join)(skillDirPath, SKILL_FILE_NAME);
|
|
4815
|
-
if (!await fileExists(skillFilePath)) {
|
|
4816
|
-
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
4817
|
-
}
|
|
4818
|
-
const fileContent = await readFileContent(skillFilePath);
|
|
4819
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
4820
|
-
const result = RulesyncSkillFrontmatterSchema.safeParse(frontmatter);
|
|
4821
|
-
if (!result.success) {
|
|
4822
|
-
throw new Error(`Invalid frontmatter in ${skillFilePath}: ${formatError(result.error)}`);
|
|
4823
|
-
}
|
|
4824
|
-
const otherFiles = await this.collectOtherFiles(
|
|
4825
|
-
baseDir,
|
|
4826
|
-
relativeDirPath,
|
|
4827
|
-
dirName,
|
|
4828
|
-
SKILL_FILE_NAME
|
|
4829
|
-
);
|
|
4830
|
-
return new _RulesyncSkill({
|
|
4831
|
-
baseDir,
|
|
4832
|
-
relativeDirPath,
|
|
4833
|
-
dirName,
|
|
4834
|
-
frontmatter: result.data,
|
|
4835
|
-
body: content.trim(),
|
|
4836
|
-
otherFiles,
|
|
4837
|
-
validate: true,
|
|
4838
|
-
global
|
|
4839
|
-
});
|
|
4840
|
-
}
|
|
4841
|
-
};
|
|
4842
|
-
|
|
4843
|
-
// src/features/skills/claudecode-skill.ts
|
|
4844
|
-
var ClaudecodeSkillFrontmatterSchema = import_mini21.z.object({
|
|
4845
|
-
name: import_mini21.z.string(),
|
|
4846
|
-
description: import_mini21.z.string(),
|
|
4847
|
-
"allowed-tools": import_mini21.z.optional(import_mini21.z.array(import_mini21.z.string()))
|
|
5019
|
+
var import_node_path50 = require("path");
|
|
5020
|
+
var import_mini22 = require("zod/mini");
|
|
5021
|
+
var ClaudecodeSkillFrontmatterSchema = import_mini22.z.object({
|
|
5022
|
+
name: import_mini22.z.string(),
|
|
5023
|
+
description: import_mini22.z.string(),
|
|
5024
|
+
"allowed-tools": import_mini22.z.optional(import_mini22.z.array(import_mini22.z.string()))
|
|
4848
5025
|
});
|
|
4849
5026
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
4850
5027
|
constructor({
|
|
4851
5028
|
baseDir = process.cwd(),
|
|
4852
|
-
relativeDirPath = (0,
|
|
5029
|
+
relativeDirPath = (0, import_node_path50.join)(".claude", "skills"),
|
|
4853
5030
|
dirName,
|
|
4854
5031
|
frontmatter,
|
|
4855
5032
|
body,
|
|
@@ -4880,7 +5057,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
4880
5057
|
global: _global = false
|
|
4881
5058
|
} = {}) {
|
|
4882
5059
|
return {
|
|
4883
|
-
relativeDirPath: (0,
|
|
5060
|
+
relativeDirPath: (0, import_node_path50.join)(".claude", "skills")
|
|
4884
5061
|
};
|
|
4885
5062
|
}
|
|
4886
5063
|
getFrontmatter() {
|
|
@@ -4960,53 +5137,40 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
4960
5137
|
static isTargetedByRulesyncSkill(_rulesyncSkill) {
|
|
4961
5138
|
return true;
|
|
4962
5139
|
}
|
|
4963
|
-
static async fromDir({
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
const settablePaths = this.getSettablePaths({ global });
|
|
4970
|
-
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
4971
|
-
const skillDirPath = (0, import_node_path49.join)(baseDir, actualRelativeDirPath, dirName);
|
|
4972
|
-
const skillFilePath = (0, import_node_path49.join)(skillDirPath, SKILL_FILE_NAME);
|
|
4973
|
-
if (!await fileExists(skillFilePath)) {
|
|
4974
|
-
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
4975
|
-
}
|
|
4976
|
-
const fileContent = await readFileContent(skillFilePath);
|
|
4977
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
4978
|
-
const result = ClaudecodeSkillFrontmatterSchema.safeParse(frontmatter);
|
|
5140
|
+
static async fromDir(params) {
|
|
5141
|
+
const loaded = await this.loadSkillDirContent({
|
|
5142
|
+
...params,
|
|
5143
|
+
getSettablePaths: _ClaudecodeSkill.getSettablePaths
|
|
5144
|
+
});
|
|
5145
|
+
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
4979
5146
|
if (!result.success) {
|
|
4980
|
-
|
|
5147
|
+
const skillDirPath = (0, import_node_path50.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5148
|
+
throw new Error(
|
|
5149
|
+
`Invalid frontmatter in ${(0, import_node_path50.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5150
|
+
);
|
|
4981
5151
|
}
|
|
4982
|
-
const otherFiles = await this.collectOtherFiles(
|
|
4983
|
-
baseDir,
|
|
4984
|
-
actualRelativeDirPath,
|
|
4985
|
-
dirName,
|
|
4986
|
-
SKILL_FILE_NAME
|
|
4987
|
-
);
|
|
4988
5152
|
return new _ClaudecodeSkill({
|
|
4989
|
-
baseDir,
|
|
4990
|
-
relativeDirPath:
|
|
4991
|
-
dirName,
|
|
5153
|
+
baseDir: loaded.baseDir,
|
|
5154
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
5155
|
+
dirName: loaded.dirName,
|
|
4992
5156
|
frontmatter: result.data,
|
|
4993
|
-
body:
|
|
4994
|
-
otherFiles,
|
|
5157
|
+
body: loaded.body,
|
|
5158
|
+
otherFiles: loaded.otherFiles,
|
|
4995
5159
|
validate: true,
|
|
4996
|
-
global
|
|
5160
|
+
global: loaded.global
|
|
4997
5161
|
});
|
|
4998
5162
|
}
|
|
4999
5163
|
};
|
|
5000
5164
|
|
|
5001
5165
|
// src/features/skills/geminicli-skill.ts
|
|
5002
|
-
var
|
|
5166
|
+
var import_node_path51 = require("path");
|
|
5003
5167
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5004
5168
|
static getSettablePaths(options) {
|
|
5005
5169
|
if (options?.global) {
|
|
5006
5170
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5007
5171
|
}
|
|
5008
5172
|
return {
|
|
5009
|
-
relativeDirPath: (0,
|
|
5173
|
+
relativeDirPath: (0, import_node_path51.join)(".gemini", "skills")
|
|
5010
5174
|
};
|
|
5011
5175
|
}
|
|
5012
5176
|
static async fromDir(params) {
|
|
@@ -5037,19 +5201,49 @@ var skillsProcessorToolTargetTuple = [
|
|
|
5037
5201
|
"cursor",
|
|
5038
5202
|
"geminicli"
|
|
5039
5203
|
];
|
|
5040
|
-
var SkillsProcessorToolTargetSchema =
|
|
5204
|
+
var SkillsProcessorToolTargetSchema = import_mini23.z.enum(skillsProcessorToolTargetTuple);
|
|
5041
5205
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
5042
|
-
[
|
|
5206
|
+
[
|
|
5207
|
+
"agentsmd",
|
|
5208
|
+
{
|
|
5209
|
+
class: AgentsmdSkill,
|
|
5210
|
+
meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
|
|
5211
|
+
}
|
|
5212
|
+
],
|
|
5043
5213
|
[
|
|
5044
5214
|
"claudecode",
|
|
5045
|
-
{
|
|
5215
|
+
{
|
|
5216
|
+
class: ClaudecodeSkill,
|
|
5217
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
5218
|
+
}
|
|
5219
|
+
],
|
|
5220
|
+
[
|
|
5221
|
+
"codexcli",
|
|
5222
|
+
{
|
|
5223
|
+
class: CodexCliSkill,
|
|
5224
|
+
meta: { supportsProject: false, supportsSimulated: false, supportsGlobal: true }
|
|
5225
|
+
}
|
|
5226
|
+
],
|
|
5227
|
+
[
|
|
5228
|
+
"copilot",
|
|
5229
|
+
{
|
|
5230
|
+
class: CopilotSkill,
|
|
5231
|
+
meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
|
|
5232
|
+
}
|
|
5233
|
+
],
|
|
5234
|
+
[
|
|
5235
|
+
"cursor",
|
|
5236
|
+
{
|
|
5237
|
+
class: CursorSkill,
|
|
5238
|
+
meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
|
|
5239
|
+
}
|
|
5046
5240
|
],
|
|
5047
|
-
["codexcli", { class: CodexCliSkill, meta: { supportsSimulated: true, supportsGlobal: false } }],
|
|
5048
|
-
["copilot", { class: CopilotSkill, meta: { supportsSimulated: true, supportsGlobal: false } }],
|
|
5049
|
-
["cursor", { class: CursorSkill, meta: { supportsSimulated: true, supportsGlobal: false } }],
|
|
5050
5241
|
[
|
|
5051
5242
|
"geminicli",
|
|
5052
|
-
{
|
|
5243
|
+
{
|
|
5244
|
+
class: GeminiCliSkill,
|
|
5245
|
+
meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
|
|
5246
|
+
}
|
|
5053
5247
|
]
|
|
5054
5248
|
]);
|
|
5055
5249
|
var defaultGetFactory4 = (target) => {
|
|
@@ -5060,7 +5254,10 @@ var defaultGetFactory4 = (target) => {
|
|
|
5060
5254
|
return factory;
|
|
5061
5255
|
};
|
|
5062
5256
|
var allToolTargetKeys3 = [...toolSkillFactories.keys()];
|
|
5063
|
-
var
|
|
5257
|
+
var skillsProcessorToolTargetsProject = allToolTargetKeys3.filter((target) => {
|
|
5258
|
+
const factory = toolSkillFactories.get(target);
|
|
5259
|
+
return factory?.meta.supportsProject ?? true;
|
|
5260
|
+
});
|
|
5064
5261
|
var skillsProcessorToolTargetsSimulated = allToolTargetKeys3.filter(
|
|
5065
5262
|
(target) => {
|
|
5066
5263
|
const factory = toolSkillFactories.get(target);
|
|
@@ -5126,9 +5323,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5126
5323
|
*/
|
|
5127
5324
|
async loadRulesyncDirs() {
|
|
5128
5325
|
const paths = RulesyncSkill.getSettablePaths();
|
|
5129
|
-
const rulesyncSkillsDirPath = (0,
|
|
5130
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
5131
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
5326
|
+
const rulesyncSkillsDirPath = (0, import_node_path52.join)(this.baseDir, paths.relativeDirPath);
|
|
5327
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path52.join)(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
5328
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path52.basename)(path3));
|
|
5132
5329
|
const rulesyncSkills = await Promise.all(
|
|
5133
5330
|
dirNames.map(
|
|
5134
5331
|
(dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
|
|
@@ -5144,9 +5341,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5144
5341
|
async loadToolDirs() {
|
|
5145
5342
|
const factory = this.getFactory(this.toolTarget);
|
|
5146
5343
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
5147
|
-
const skillsDirPath = (0,
|
|
5148
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
5149
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
5344
|
+
const skillsDirPath = (0, import_node_path52.join)(this.baseDir, paths.relativeDirPath);
|
|
5345
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path52.join)(skillsDirPath, "*"), { type: "dir" });
|
|
5346
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path52.basename)(path3));
|
|
5150
5347
|
const toolSkills = await Promise.all(
|
|
5151
5348
|
dirNames.map(
|
|
5152
5349
|
(dirName) => factory.class.fromDir({
|
|
@@ -5173,12 +5370,13 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5173
5370
|
if (global) {
|
|
5174
5371
|
return skillsProcessorToolTargetsGlobal;
|
|
5175
5372
|
}
|
|
5373
|
+
const projectTargets = skillsProcessorToolTargetsProject;
|
|
5176
5374
|
if (!includeSimulated) {
|
|
5177
|
-
return
|
|
5375
|
+
return projectTargets.filter(
|
|
5178
5376
|
(target) => !skillsProcessorToolTargetsSimulated.includes(target)
|
|
5179
5377
|
);
|
|
5180
5378
|
}
|
|
5181
|
-
return
|
|
5379
|
+
return projectTargets;
|
|
5182
5380
|
}
|
|
5183
5381
|
/**
|
|
5184
5382
|
* Return the simulated tool targets
|
|
@@ -5195,11 +5393,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5195
5393
|
};
|
|
5196
5394
|
|
|
5197
5395
|
// src/features/subagents/agentsmd-subagent.ts
|
|
5198
|
-
var
|
|
5396
|
+
var import_node_path54 = require("path");
|
|
5199
5397
|
|
|
5200
5398
|
// src/features/subagents/simulated-subagent.ts
|
|
5201
|
-
var
|
|
5202
|
-
var
|
|
5399
|
+
var import_node_path53 = require("path");
|
|
5400
|
+
var import_mini24 = require("zod/mini");
|
|
5203
5401
|
|
|
5204
5402
|
// src/features/subagents/tool-subagent.ts
|
|
5205
5403
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -5234,9 +5432,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
5234
5432
|
};
|
|
5235
5433
|
|
|
5236
5434
|
// src/features/subagents/simulated-subagent.ts
|
|
5237
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
5238
|
-
name:
|
|
5239
|
-
description:
|
|
5435
|
+
var SimulatedSubagentFrontmatterSchema = import_mini24.z.object({
|
|
5436
|
+
name: import_mini24.z.string(),
|
|
5437
|
+
description: import_mini24.z.string()
|
|
5240
5438
|
});
|
|
5241
5439
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
5242
5440
|
frontmatter;
|
|
@@ -5246,7 +5444,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5246
5444
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5247
5445
|
if (!result.success) {
|
|
5248
5446
|
throw new Error(
|
|
5249
|
-
`Invalid frontmatter in ${(0,
|
|
5447
|
+
`Invalid frontmatter in ${(0, import_node_path53.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5250
5448
|
);
|
|
5251
5449
|
}
|
|
5252
5450
|
}
|
|
@@ -5297,7 +5495,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5297
5495
|
return {
|
|
5298
5496
|
success: false,
|
|
5299
5497
|
error: new Error(
|
|
5300
|
-
`Invalid frontmatter in ${(0,
|
|
5498
|
+
`Invalid frontmatter in ${(0, import_node_path53.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5301
5499
|
)
|
|
5302
5500
|
};
|
|
5303
5501
|
}
|
|
@@ -5307,7 +5505,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5307
5505
|
relativeFilePath,
|
|
5308
5506
|
validate = true
|
|
5309
5507
|
}) {
|
|
5310
|
-
const filePath = (0,
|
|
5508
|
+
const filePath = (0, import_node_path53.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
5311
5509
|
const fileContent = await readFileContent(filePath);
|
|
5312
5510
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5313
5511
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -5317,7 +5515,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5317
5515
|
return {
|
|
5318
5516
|
baseDir,
|
|
5319
5517
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
5320
|
-
relativeFilePath: (0,
|
|
5518
|
+
relativeFilePath: (0, import_node_path53.basename)(relativeFilePath),
|
|
5321
5519
|
frontmatter: result.data,
|
|
5322
5520
|
body: content.trim(),
|
|
5323
5521
|
validate
|
|
@@ -5329,7 +5527,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5329
5527
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
5330
5528
|
static getSettablePaths() {
|
|
5331
5529
|
return {
|
|
5332
|
-
relativeDirPath: (0,
|
|
5530
|
+
relativeDirPath: (0, import_node_path54.join)(".agents", "subagents")
|
|
5333
5531
|
};
|
|
5334
5532
|
}
|
|
5335
5533
|
static async fromFile(params) {
|
|
@@ -5349,11 +5547,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
5349
5547
|
};
|
|
5350
5548
|
|
|
5351
5549
|
// src/features/subagents/codexcli-subagent.ts
|
|
5352
|
-
var
|
|
5550
|
+
var import_node_path55 = require("path");
|
|
5353
5551
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
5354
5552
|
static getSettablePaths() {
|
|
5355
5553
|
return {
|
|
5356
|
-
relativeDirPath: (0,
|
|
5554
|
+
relativeDirPath: (0, import_node_path55.join)(".codex", "subagents")
|
|
5357
5555
|
};
|
|
5358
5556
|
}
|
|
5359
5557
|
static async fromFile(params) {
|
|
@@ -5373,11 +5571,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
5373
5571
|
};
|
|
5374
5572
|
|
|
5375
5573
|
// src/features/subagents/copilot-subagent.ts
|
|
5376
|
-
var
|
|
5574
|
+
var import_node_path56 = require("path");
|
|
5377
5575
|
var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
5378
5576
|
static getSettablePaths() {
|
|
5379
5577
|
return {
|
|
5380
|
-
relativeDirPath: (0,
|
|
5578
|
+
relativeDirPath: (0, import_node_path56.join)(".github", "subagents")
|
|
5381
5579
|
};
|
|
5382
5580
|
}
|
|
5383
5581
|
static async fromFile(params) {
|
|
@@ -5397,11 +5595,11 @@ var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
|
5397
5595
|
};
|
|
5398
5596
|
|
|
5399
5597
|
// src/features/subagents/cursor-subagent.ts
|
|
5400
|
-
var
|
|
5598
|
+
var import_node_path57 = require("path");
|
|
5401
5599
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
5402
5600
|
static getSettablePaths() {
|
|
5403
5601
|
return {
|
|
5404
|
-
relativeDirPath: (0,
|
|
5602
|
+
relativeDirPath: (0, import_node_path57.join)(".cursor", "subagents")
|
|
5405
5603
|
};
|
|
5406
5604
|
}
|
|
5407
5605
|
static async fromFile(params) {
|
|
@@ -5421,11 +5619,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
5421
5619
|
};
|
|
5422
5620
|
|
|
5423
5621
|
// src/features/subagents/geminicli-subagent.ts
|
|
5424
|
-
var
|
|
5622
|
+
var import_node_path58 = require("path");
|
|
5425
5623
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
5426
5624
|
static getSettablePaths() {
|
|
5427
5625
|
return {
|
|
5428
|
-
relativeDirPath: (0,
|
|
5626
|
+
relativeDirPath: (0, import_node_path58.join)(".gemini", "subagents")
|
|
5429
5627
|
};
|
|
5430
5628
|
}
|
|
5431
5629
|
static async fromFile(params) {
|
|
@@ -5445,11 +5643,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
5445
5643
|
};
|
|
5446
5644
|
|
|
5447
5645
|
// src/features/subagents/roo-subagent.ts
|
|
5448
|
-
var
|
|
5646
|
+
var import_node_path59 = require("path");
|
|
5449
5647
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
5450
5648
|
static getSettablePaths() {
|
|
5451
5649
|
return {
|
|
5452
|
-
relativeDirPath: (0,
|
|
5650
|
+
relativeDirPath: (0, import_node_path59.join)(".roo", "subagents")
|
|
5453
5651
|
};
|
|
5454
5652
|
}
|
|
5455
5653
|
static async fromFile(params) {
|
|
@@ -5469,20 +5667,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
5469
5667
|
};
|
|
5470
5668
|
|
|
5471
5669
|
// src/features/subagents/subagents-processor.ts
|
|
5670
|
+
var import_node_path62 = require("path");
|
|
5671
|
+
var import_mini27 = require("zod/mini");
|
|
5672
|
+
|
|
5673
|
+
// src/features/subagents/claudecode-subagent.ts
|
|
5472
5674
|
var import_node_path61 = require("path");
|
|
5473
5675
|
var import_mini26 = require("zod/mini");
|
|
5474
5676
|
|
|
5475
|
-
// src/features/subagents/
|
|
5677
|
+
// src/features/subagents/rulesync-subagent.ts
|
|
5476
5678
|
var import_node_path60 = require("path");
|
|
5477
5679
|
var import_mini25 = require("zod/mini");
|
|
5478
|
-
|
|
5479
|
-
// src/features/subagents/rulesync-subagent.ts
|
|
5480
|
-
var import_node_path59 = require("path");
|
|
5481
|
-
var import_mini24 = require("zod/mini");
|
|
5482
|
-
var RulesyncSubagentFrontmatterSchema = import_mini24.z.looseObject({
|
|
5680
|
+
var RulesyncSubagentFrontmatterSchema = import_mini25.z.looseObject({
|
|
5483
5681
|
targets: RulesyncTargetsSchema,
|
|
5484
|
-
name:
|
|
5485
|
-
description:
|
|
5682
|
+
name: import_mini25.z.string(),
|
|
5683
|
+
description: import_mini25.z.string()
|
|
5486
5684
|
});
|
|
5487
5685
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
5488
5686
|
frontmatter;
|
|
@@ -5492,7 +5690,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5492
5690
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5493
5691
|
if (!result.success) {
|
|
5494
5692
|
throw new Error(
|
|
5495
|
-
`Invalid frontmatter in ${(0,
|
|
5693
|
+
`Invalid frontmatter in ${(0, import_node_path60.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5496
5694
|
);
|
|
5497
5695
|
}
|
|
5498
5696
|
}
|
|
@@ -5525,7 +5723,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5525
5723
|
return {
|
|
5526
5724
|
success: false,
|
|
5527
5725
|
error: new Error(
|
|
5528
|
-
`Invalid frontmatter in ${(0,
|
|
5726
|
+
`Invalid frontmatter in ${(0, import_node_path60.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5529
5727
|
)
|
|
5530
5728
|
};
|
|
5531
5729
|
}
|
|
@@ -5534,14 +5732,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5534
5732
|
relativeFilePath
|
|
5535
5733
|
}) {
|
|
5536
5734
|
const fileContent = await readFileContent(
|
|
5537
|
-
(0,
|
|
5735
|
+
(0, import_node_path60.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
5538
5736
|
);
|
|
5539
5737
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5540
5738
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5541
5739
|
if (!result.success) {
|
|
5542
5740
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
5543
5741
|
}
|
|
5544
|
-
const filename = (0,
|
|
5742
|
+
const filename = (0, import_node_path60.basename)(relativeFilePath);
|
|
5545
5743
|
return new _RulesyncSubagent({
|
|
5546
5744
|
baseDir: process.cwd(),
|
|
5547
5745
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -5553,13 +5751,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5553
5751
|
};
|
|
5554
5752
|
|
|
5555
5753
|
// src/features/subagents/claudecode-subagent.ts
|
|
5556
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
5557
|
-
name:
|
|
5558
|
-
description:
|
|
5559
|
-
model:
|
|
5560
|
-
tools:
|
|
5561
|
-
permissionMode:
|
|
5562
|
-
skills:
|
|
5754
|
+
var ClaudecodeSubagentFrontmatterSchema = import_mini26.z.looseObject({
|
|
5755
|
+
name: import_mini26.z.string(),
|
|
5756
|
+
description: import_mini26.z.string(),
|
|
5757
|
+
model: import_mini26.z.optional(import_mini26.z.string()),
|
|
5758
|
+
tools: import_mini26.z.optional(import_mini26.z.union([import_mini26.z.string(), import_mini26.z.array(import_mini26.z.string())])),
|
|
5759
|
+
permissionMode: import_mini26.z.optional(import_mini26.z.string()),
|
|
5760
|
+
skills: import_mini26.z.optional(import_mini26.z.union([import_mini26.z.string(), import_mini26.z.array(import_mini26.z.string())]))
|
|
5563
5761
|
});
|
|
5564
5762
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
5565
5763
|
frontmatter;
|
|
@@ -5569,7 +5767,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5569
5767
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5570
5768
|
if (!result.success) {
|
|
5571
5769
|
throw new Error(
|
|
5572
|
-
`Invalid frontmatter in ${(0,
|
|
5770
|
+
`Invalid frontmatter in ${(0, import_node_path61.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5573
5771
|
);
|
|
5574
5772
|
}
|
|
5575
5773
|
}
|
|
@@ -5581,7 +5779,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5581
5779
|
}
|
|
5582
5780
|
static getSettablePaths(_options = {}) {
|
|
5583
5781
|
return {
|
|
5584
|
-
relativeDirPath: (0,
|
|
5782
|
+
relativeDirPath: (0, import_node_path61.join)(".claude", "agents")
|
|
5585
5783
|
};
|
|
5586
5784
|
}
|
|
5587
5785
|
getFrontmatter() {
|
|
@@ -5655,7 +5853,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5655
5853
|
return {
|
|
5656
5854
|
success: false,
|
|
5657
5855
|
error: new Error(
|
|
5658
|
-
`Invalid frontmatter in ${(0,
|
|
5856
|
+
`Invalid frontmatter in ${(0, import_node_path61.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5659
5857
|
)
|
|
5660
5858
|
};
|
|
5661
5859
|
}
|
|
@@ -5673,7 +5871,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5673
5871
|
global = false
|
|
5674
5872
|
}) {
|
|
5675
5873
|
const paths = this.getSettablePaths({ global });
|
|
5676
|
-
const filePath = (0,
|
|
5874
|
+
const filePath = (0, import_node_path61.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
5677
5875
|
const fileContent = await readFileContent(filePath);
|
|
5678
5876
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5679
5877
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -5702,7 +5900,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
5702
5900
|
"geminicli",
|
|
5703
5901
|
"roo"
|
|
5704
5902
|
];
|
|
5705
|
-
var SubagentsProcessorToolTargetSchema =
|
|
5903
|
+
var SubagentsProcessorToolTargetSchema = import_mini27.z.enum(subagentsProcessorToolTargetTuple);
|
|
5706
5904
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
5707
5905
|
[
|
|
5708
5906
|
"agentsmd",
|
|
@@ -5805,7 +6003,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
5805
6003
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
5806
6004
|
*/
|
|
5807
6005
|
async loadRulesyncFiles() {
|
|
5808
|
-
const subagentsDir = (0,
|
|
6006
|
+
const subagentsDir = (0, import_node_path62.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
5809
6007
|
const dirExists = await directoryExists(subagentsDir);
|
|
5810
6008
|
if (!dirExists) {
|
|
5811
6009
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -5820,7 +6018,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
5820
6018
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
5821
6019
|
const rulesyncSubagents = [];
|
|
5822
6020
|
for (const mdFile of mdFiles) {
|
|
5823
|
-
const filepath = (0,
|
|
6021
|
+
const filepath = (0, import_node_path62.join)(subagentsDir, mdFile);
|
|
5824
6022
|
try {
|
|
5825
6023
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
5826
6024
|
relativeFilePath: mdFile,
|
|
@@ -5850,13 +6048,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
5850
6048
|
const factory = this.getFactory(this.toolTarget);
|
|
5851
6049
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
5852
6050
|
const subagentFilePaths = await findFilesByGlobs(
|
|
5853
|
-
(0,
|
|
6051
|
+
(0, import_node_path62.join)(this.baseDir, paths.relativeDirPath, "*.md")
|
|
5854
6052
|
);
|
|
5855
6053
|
const toolSubagents = await Promise.all(
|
|
5856
6054
|
subagentFilePaths.map(
|
|
5857
6055
|
(path3) => factory.class.fromFile({
|
|
5858
6056
|
baseDir: this.baseDir,
|
|
5859
|
-
relativeFilePath: (0,
|
|
6057
|
+
relativeFilePath: (0, import_node_path62.basename)(path3),
|
|
5860
6058
|
global: this.global
|
|
5861
6059
|
})
|
|
5862
6060
|
)
|
|
@@ -5889,35 +6087,42 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
5889
6087
|
};
|
|
5890
6088
|
|
|
5891
6089
|
// src/features/rules/agentsmd-rule.ts
|
|
5892
|
-
var
|
|
6090
|
+
var import_node_path65 = require("path");
|
|
5893
6091
|
|
|
5894
6092
|
// src/features/rules/tool-rule.ts
|
|
5895
|
-
var
|
|
6093
|
+
var import_node_path64 = require("path");
|
|
5896
6094
|
|
|
5897
6095
|
// src/features/rules/rulesync-rule.ts
|
|
5898
|
-
var
|
|
5899
|
-
var
|
|
5900
|
-
var RulesyncRuleFrontmatterSchema =
|
|
5901
|
-
root:
|
|
5902
|
-
targets:
|
|
5903
|
-
description:
|
|
5904
|
-
globs:
|
|
5905
|
-
agentsmd:
|
|
5906
|
-
|
|
6096
|
+
var import_node_path63 = require("path");
|
|
6097
|
+
var import_mini28 = require("zod/mini");
|
|
6098
|
+
var RulesyncRuleFrontmatterSchema = import_mini28.z.object({
|
|
6099
|
+
root: import_mini28.z.optional(import_mini28.z.optional(import_mini28.z.boolean())),
|
|
6100
|
+
targets: import_mini28.z.optional(RulesyncTargetsSchema),
|
|
6101
|
+
description: import_mini28.z.optional(import_mini28.z.string()),
|
|
6102
|
+
globs: import_mini28.z.optional(import_mini28.z.array(import_mini28.z.string())),
|
|
6103
|
+
agentsmd: import_mini28.z.optional(
|
|
6104
|
+
import_mini28.z.object({
|
|
5907
6105
|
// @example "path/to/subproject"
|
|
5908
|
-
subprojectPath:
|
|
6106
|
+
subprojectPath: import_mini28.z.optional(import_mini28.z.string())
|
|
5909
6107
|
})
|
|
5910
6108
|
),
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
6109
|
+
claudecode: import_mini28.z.optional(
|
|
6110
|
+
import_mini28.z.object({
|
|
6111
|
+
// Glob patterns for conditional rules (takes precedence over globs)
|
|
6112
|
+
// @example "src/**/*.ts, tests/**/*.test.ts"
|
|
6113
|
+
paths: import_mini28.z.optional(import_mini28.z.string())
|
|
5916
6114
|
})
|
|
5917
6115
|
),
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
6116
|
+
cursor: import_mini28.z.optional(
|
|
6117
|
+
import_mini28.z.object({
|
|
6118
|
+
alwaysApply: import_mini28.z.optional(import_mini28.z.boolean()),
|
|
6119
|
+
description: import_mini28.z.optional(import_mini28.z.string()),
|
|
6120
|
+
globs: import_mini28.z.optional(import_mini28.z.array(import_mini28.z.string()))
|
|
6121
|
+
})
|
|
6122
|
+
),
|
|
6123
|
+
copilot: import_mini28.z.optional(
|
|
6124
|
+
import_mini28.z.object({
|
|
6125
|
+
excludeAgent: import_mini28.z.optional(import_mini28.z.union([import_mini28.z.literal("code-review"), import_mini28.z.literal("coding-agent")]))
|
|
5921
6126
|
})
|
|
5922
6127
|
)
|
|
5923
6128
|
});
|
|
@@ -5929,7 +6134,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
5929
6134
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
5930
6135
|
if (!result.success) {
|
|
5931
6136
|
throw new Error(
|
|
5932
|
-
`Invalid frontmatter in ${(0,
|
|
6137
|
+
`Invalid frontmatter in ${(0, import_node_path63.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5933
6138
|
);
|
|
5934
6139
|
}
|
|
5935
6140
|
}
|
|
@@ -5964,7 +6169,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
5964
6169
|
return {
|
|
5965
6170
|
success: false,
|
|
5966
6171
|
error: new Error(
|
|
5967
|
-
`Invalid frontmatter in ${(0,
|
|
6172
|
+
`Invalid frontmatter in ${(0, import_node_path63.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5968
6173
|
)
|
|
5969
6174
|
};
|
|
5970
6175
|
}
|
|
@@ -5973,12 +6178,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
5973
6178
|
relativeFilePath,
|
|
5974
6179
|
validate = true
|
|
5975
6180
|
}) {
|
|
5976
|
-
const legacyPath = (0,
|
|
6181
|
+
const legacyPath = (0, import_node_path63.join)(
|
|
5977
6182
|
process.cwd(),
|
|
5978
6183
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
5979
6184
|
relativeFilePath
|
|
5980
6185
|
);
|
|
5981
|
-
const recommendedPath = (0,
|
|
6186
|
+
const recommendedPath = (0, import_node_path63.join)(
|
|
5982
6187
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
5983
6188
|
relativeFilePath
|
|
5984
6189
|
);
|
|
@@ -5997,7 +6202,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
5997
6202
|
agentsmd: result.data.agentsmd,
|
|
5998
6203
|
cursor: result.data.cursor
|
|
5999
6204
|
};
|
|
6000
|
-
const filename = (0,
|
|
6205
|
+
const filename = (0, import_node_path63.basename)(legacyPath);
|
|
6001
6206
|
return new _RulesyncRule({
|
|
6002
6207
|
baseDir: process.cwd(),
|
|
6003
6208
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -6011,7 +6216,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6011
6216
|
relativeFilePath,
|
|
6012
6217
|
validate = true
|
|
6013
6218
|
}) {
|
|
6014
|
-
const filePath = (0,
|
|
6219
|
+
const filePath = (0, import_node_path63.join)(
|
|
6015
6220
|
process.cwd(),
|
|
6016
6221
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
6017
6222
|
relativeFilePath
|
|
@@ -6030,7 +6235,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6030
6235
|
agentsmd: result.data.agentsmd,
|
|
6031
6236
|
cursor: result.data.cursor
|
|
6032
6237
|
};
|
|
6033
|
-
const filename = (0,
|
|
6238
|
+
const filename = (0, import_node_path63.basename)(filePath);
|
|
6034
6239
|
return new _RulesyncRule({
|
|
6035
6240
|
baseDir: process.cwd(),
|
|
6036
6241
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -6105,7 +6310,7 @@ var ToolRule = class extends ToolFile {
|
|
|
6105
6310
|
rulesyncRule,
|
|
6106
6311
|
validate = true,
|
|
6107
6312
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
6108
|
-
nonRootPath = { relativeDirPath: (0,
|
|
6313
|
+
nonRootPath = { relativeDirPath: (0, import_node_path64.join)(".agents", "memories") }
|
|
6109
6314
|
}) {
|
|
6110
6315
|
const params = this.buildToolRuleParamsDefault({
|
|
6111
6316
|
baseDir,
|
|
@@ -6116,7 +6321,7 @@ var ToolRule = class extends ToolFile {
|
|
|
6116
6321
|
});
|
|
6117
6322
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
6118
6323
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
6119
|
-
params.relativeDirPath = (0,
|
|
6324
|
+
params.relativeDirPath = (0, import_node_path64.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
6120
6325
|
params.relativeFilePath = "AGENTS.md";
|
|
6121
6326
|
}
|
|
6122
6327
|
return params;
|
|
@@ -6181,7 +6386,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6181
6386
|
relativeFilePath: "AGENTS.md"
|
|
6182
6387
|
},
|
|
6183
6388
|
nonRoot: {
|
|
6184
|
-
relativeDirPath: (0,
|
|
6389
|
+
relativeDirPath: (0, import_node_path65.join)(".agents", "memories")
|
|
6185
6390
|
}
|
|
6186
6391
|
};
|
|
6187
6392
|
}
|
|
@@ -6191,8 +6396,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6191
6396
|
validate = true
|
|
6192
6397
|
}) {
|
|
6193
6398
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
6194
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
6195
|
-
const fileContent = await readFileContent((0,
|
|
6399
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path65.join)(".agents", "memories", relativeFilePath);
|
|
6400
|
+
const fileContent = await readFileContent((0, import_node_path65.join)(baseDir, relativePath));
|
|
6196
6401
|
return new _AgentsMdRule({
|
|
6197
6402
|
baseDir,
|
|
6198
6403
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -6232,12 +6437,12 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6232
6437
|
};
|
|
6233
6438
|
|
|
6234
6439
|
// src/features/rules/amazonqcli-rule.ts
|
|
6235
|
-
var
|
|
6440
|
+
var import_node_path66 = require("path");
|
|
6236
6441
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
6237
6442
|
static getSettablePaths() {
|
|
6238
6443
|
return {
|
|
6239
6444
|
nonRoot: {
|
|
6240
|
-
relativeDirPath: (0,
|
|
6445
|
+
relativeDirPath: (0, import_node_path66.join)(".amazonq", "rules")
|
|
6241
6446
|
}
|
|
6242
6447
|
};
|
|
6243
6448
|
}
|
|
@@ -6247,7 +6452,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
6247
6452
|
validate = true
|
|
6248
6453
|
}) {
|
|
6249
6454
|
const fileContent = await readFileContent(
|
|
6250
|
-
(0,
|
|
6455
|
+
(0, import_node_path66.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6251
6456
|
);
|
|
6252
6457
|
return new _AmazonQCliRule({
|
|
6253
6458
|
baseDir,
|
|
@@ -6287,12 +6492,12 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
6287
6492
|
};
|
|
6288
6493
|
|
|
6289
6494
|
// src/features/rules/antigravity-rule.ts
|
|
6290
|
-
var
|
|
6495
|
+
var import_node_path67 = require("path");
|
|
6291
6496
|
var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
6292
6497
|
static getSettablePaths() {
|
|
6293
6498
|
return {
|
|
6294
6499
|
nonRoot: {
|
|
6295
|
-
relativeDirPath: (0,
|
|
6500
|
+
relativeDirPath: (0, import_node_path67.join)(".agent", "rules")
|
|
6296
6501
|
}
|
|
6297
6502
|
};
|
|
6298
6503
|
}
|
|
@@ -6302,7 +6507,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
6302
6507
|
validate = true
|
|
6303
6508
|
}) {
|
|
6304
6509
|
const fileContent = await readFileContent(
|
|
6305
|
-
(0,
|
|
6510
|
+
(0, import_node_path67.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6306
6511
|
);
|
|
6307
6512
|
return new _AntigravityRule({
|
|
6308
6513
|
baseDir,
|
|
@@ -6342,7 +6547,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
6342
6547
|
};
|
|
6343
6548
|
|
|
6344
6549
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
6345
|
-
var
|
|
6550
|
+
var import_node_path68 = require("path");
|
|
6346
6551
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
6347
6552
|
toRulesyncRule() {
|
|
6348
6553
|
const rulesyncFrontmatter = {
|
|
@@ -6368,7 +6573,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6368
6573
|
relativeFilePath: ".augment-guidelines"
|
|
6369
6574
|
},
|
|
6370
6575
|
nonRoot: {
|
|
6371
|
-
relativeDirPath: (0,
|
|
6576
|
+
relativeDirPath: (0, import_node_path68.join)(".augment", "rules")
|
|
6372
6577
|
}
|
|
6373
6578
|
};
|
|
6374
6579
|
}
|
|
@@ -6403,8 +6608,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6403
6608
|
}) {
|
|
6404
6609
|
const settablePaths = this.getSettablePaths();
|
|
6405
6610
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
6406
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
6407
|
-
const fileContent = await readFileContent((0,
|
|
6611
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path68.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
6612
|
+
const fileContent = await readFileContent((0, import_node_path68.join)(baseDir, relativePath));
|
|
6408
6613
|
return new _AugmentcodeLegacyRule({
|
|
6409
6614
|
baseDir,
|
|
6410
6615
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -6417,7 +6622,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6417
6622
|
};
|
|
6418
6623
|
|
|
6419
6624
|
// src/features/rules/augmentcode-rule.ts
|
|
6420
|
-
var
|
|
6625
|
+
var import_node_path69 = require("path");
|
|
6421
6626
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
6422
6627
|
toRulesyncRule() {
|
|
6423
6628
|
return this.toRulesyncRuleDefault();
|
|
@@ -6425,40 +6630,131 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6425
6630
|
static getSettablePaths() {
|
|
6426
6631
|
return {
|
|
6427
6632
|
nonRoot: {
|
|
6428
|
-
relativeDirPath: (0,
|
|
6633
|
+
relativeDirPath: (0, import_node_path69.join)(".augment", "rules")
|
|
6634
|
+
}
|
|
6635
|
+
};
|
|
6636
|
+
}
|
|
6637
|
+
static fromRulesyncRule({
|
|
6638
|
+
baseDir = process.cwd(),
|
|
6639
|
+
rulesyncRule,
|
|
6640
|
+
validate = true
|
|
6641
|
+
}) {
|
|
6642
|
+
return new _AugmentcodeRule(
|
|
6643
|
+
this.buildToolRuleParamsDefault({
|
|
6644
|
+
baseDir,
|
|
6645
|
+
rulesyncRule,
|
|
6646
|
+
validate,
|
|
6647
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
6648
|
+
})
|
|
6649
|
+
);
|
|
6650
|
+
}
|
|
6651
|
+
static async fromFile({
|
|
6652
|
+
baseDir = process.cwd(),
|
|
6653
|
+
relativeFilePath,
|
|
6654
|
+
validate = true
|
|
6655
|
+
}) {
|
|
6656
|
+
const fileContent = await readFileContent(
|
|
6657
|
+
(0, import_node_path69.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6658
|
+
);
|
|
6659
|
+
const { body: content } = parseFrontmatter(fileContent);
|
|
6660
|
+
return new _AugmentcodeRule({
|
|
6661
|
+
baseDir,
|
|
6662
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
6663
|
+
relativeFilePath,
|
|
6664
|
+
fileContent: content.trim(),
|
|
6665
|
+
validate
|
|
6666
|
+
});
|
|
6667
|
+
}
|
|
6668
|
+
validate() {
|
|
6669
|
+
return { success: true, error: null };
|
|
6670
|
+
}
|
|
6671
|
+
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
6672
|
+
return this.isTargetedByRulesyncRuleDefault({
|
|
6673
|
+
rulesyncRule,
|
|
6674
|
+
toolTarget: "augmentcode"
|
|
6675
|
+
});
|
|
6676
|
+
}
|
|
6677
|
+
};
|
|
6678
|
+
|
|
6679
|
+
// src/features/rules/claudecode-legacy-rule.ts
|
|
6680
|
+
var import_node_path70 = require("path");
|
|
6681
|
+
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
6682
|
+
static getSettablePaths({
|
|
6683
|
+
global
|
|
6684
|
+
} = {}) {
|
|
6685
|
+
if (global) {
|
|
6686
|
+
return {
|
|
6687
|
+
root: {
|
|
6688
|
+
relativeDirPath: ".claude",
|
|
6689
|
+
relativeFilePath: "CLAUDE.md"
|
|
6690
|
+
}
|
|
6691
|
+
};
|
|
6692
|
+
}
|
|
6693
|
+
return {
|
|
6694
|
+
root: {
|
|
6695
|
+
relativeDirPath: ".",
|
|
6696
|
+
relativeFilePath: "CLAUDE.md"
|
|
6697
|
+
},
|
|
6698
|
+
nonRoot: {
|
|
6699
|
+
relativeDirPath: (0, import_node_path70.join)(".claude", "memories")
|
|
6429
6700
|
}
|
|
6430
6701
|
};
|
|
6431
6702
|
}
|
|
6703
|
+
static async fromFile({
|
|
6704
|
+
baseDir = process.cwd(),
|
|
6705
|
+
relativeFilePath,
|
|
6706
|
+
validate = true,
|
|
6707
|
+
global = false
|
|
6708
|
+
}) {
|
|
6709
|
+
const paths = this.getSettablePaths({ global });
|
|
6710
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
6711
|
+
if (isRoot) {
|
|
6712
|
+
const relativePath2 = paths.root.relativeFilePath;
|
|
6713
|
+
const fileContent2 = await readFileContent(
|
|
6714
|
+
(0, import_node_path70.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
6715
|
+
);
|
|
6716
|
+
return new _ClaudecodeLegacyRule({
|
|
6717
|
+
baseDir,
|
|
6718
|
+
relativeDirPath: paths.root.relativeDirPath,
|
|
6719
|
+
relativeFilePath: paths.root.relativeFilePath,
|
|
6720
|
+
fileContent: fileContent2,
|
|
6721
|
+
validate,
|
|
6722
|
+
root: true
|
|
6723
|
+
});
|
|
6724
|
+
}
|
|
6725
|
+
if (!paths.nonRoot) {
|
|
6726
|
+
throw new Error("nonRoot path is not set");
|
|
6727
|
+
}
|
|
6728
|
+
const relativePath = (0, import_node_path70.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
6729
|
+
const fileContent = await readFileContent((0, import_node_path70.join)(baseDir, relativePath));
|
|
6730
|
+
return new _ClaudecodeLegacyRule({
|
|
6731
|
+
baseDir,
|
|
6732
|
+
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
6733
|
+
relativeFilePath,
|
|
6734
|
+
fileContent,
|
|
6735
|
+
validate,
|
|
6736
|
+
root: false
|
|
6737
|
+
});
|
|
6738
|
+
}
|
|
6432
6739
|
static fromRulesyncRule({
|
|
6433
6740
|
baseDir = process.cwd(),
|
|
6434
6741
|
rulesyncRule,
|
|
6435
|
-
validate = true
|
|
6742
|
+
validate = true,
|
|
6743
|
+
global = false
|
|
6436
6744
|
}) {
|
|
6437
|
-
|
|
6745
|
+
const paths = this.getSettablePaths({ global });
|
|
6746
|
+
return new _ClaudecodeLegacyRule(
|
|
6438
6747
|
this.buildToolRuleParamsDefault({
|
|
6439
6748
|
baseDir,
|
|
6440
6749
|
rulesyncRule,
|
|
6441
6750
|
validate,
|
|
6442
|
-
|
|
6751
|
+
rootPath: paths.root,
|
|
6752
|
+
nonRootPath: paths.nonRoot
|
|
6443
6753
|
})
|
|
6444
6754
|
);
|
|
6445
6755
|
}
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
relativeFilePath,
|
|
6449
|
-
validate = true
|
|
6450
|
-
}) {
|
|
6451
|
-
const fileContent = await readFileContent(
|
|
6452
|
-
(0, import_node_path68.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6453
|
-
);
|
|
6454
|
-
const { body: content } = parseFrontmatter(fileContent);
|
|
6455
|
-
return new _AugmentcodeRule({
|
|
6456
|
-
baseDir,
|
|
6457
|
-
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
6458
|
-
relativeFilePath,
|
|
6459
|
-
fileContent: content.trim(),
|
|
6460
|
-
validate
|
|
6461
|
-
});
|
|
6756
|
+
toRulesyncRule() {
|
|
6757
|
+
return this.toRulesyncRuleDefault();
|
|
6462
6758
|
}
|
|
6463
6759
|
validate() {
|
|
6464
6760
|
return { success: true, error: null };
|
|
@@ -6466,14 +6762,20 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6466
6762
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
6467
6763
|
return this.isTargetedByRulesyncRuleDefault({
|
|
6468
6764
|
rulesyncRule,
|
|
6469
|
-
toolTarget: "
|
|
6765
|
+
toolTarget: "claudecode-legacy"
|
|
6470
6766
|
});
|
|
6471
6767
|
}
|
|
6472
6768
|
};
|
|
6473
6769
|
|
|
6474
6770
|
// src/features/rules/claudecode-rule.ts
|
|
6475
|
-
var
|
|
6771
|
+
var import_node_path71 = require("path");
|
|
6772
|
+
var import_mini29 = require("zod/mini");
|
|
6773
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini29.z.object({
|
|
6774
|
+
paths: import_mini29.z.optional(import_mini29.z.string())
|
|
6775
|
+
});
|
|
6476
6776
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
6777
|
+
frontmatter;
|
|
6778
|
+
body;
|
|
6477
6779
|
static getSettablePaths({
|
|
6478
6780
|
global
|
|
6479
6781
|
} = {}) {
|
|
@@ -6487,14 +6789,37 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6487
6789
|
}
|
|
6488
6790
|
return {
|
|
6489
6791
|
root: {
|
|
6490
|
-
relativeDirPath: ".",
|
|
6792
|
+
relativeDirPath: ".claude",
|
|
6491
6793
|
relativeFilePath: "CLAUDE.md"
|
|
6492
6794
|
},
|
|
6493
6795
|
nonRoot: {
|
|
6494
|
-
relativeDirPath: (0,
|
|
6796
|
+
relativeDirPath: (0, import_node_path71.join)(".claude", "rules")
|
|
6495
6797
|
}
|
|
6496
6798
|
};
|
|
6497
6799
|
}
|
|
6800
|
+
constructor({ frontmatter, body, ...rest }) {
|
|
6801
|
+
if (rest.validate) {
|
|
6802
|
+
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
6803
|
+
if (!result.success) {
|
|
6804
|
+
throw new Error(
|
|
6805
|
+
`Invalid frontmatter in ${(0, import_node_path71.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6806
|
+
);
|
|
6807
|
+
}
|
|
6808
|
+
}
|
|
6809
|
+
super({
|
|
6810
|
+
...rest,
|
|
6811
|
+
// Root file: no frontmatter; Non-root file: with optional paths frontmatter
|
|
6812
|
+
fileContent: rest.root ? body : _ClaudecodeRule.generateFileContent(body, frontmatter)
|
|
6813
|
+
});
|
|
6814
|
+
this.frontmatter = frontmatter;
|
|
6815
|
+
this.body = body;
|
|
6816
|
+
}
|
|
6817
|
+
static generateFileContent(body, frontmatter) {
|
|
6818
|
+
if (frontmatter.paths) {
|
|
6819
|
+
return stringifyFrontmatter(body, { paths: frontmatter.paths });
|
|
6820
|
+
}
|
|
6821
|
+
return body;
|
|
6822
|
+
}
|
|
6498
6823
|
static async fromFile({
|
|
6499
6824
|
baseDir = process.cwd(),
|
|
6500
6825
|
relativeFilePath,
|
|
@@ -6504,15 +6829,15 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6504
6829
|
const paths = this.getSettablePaths({ global });
|
|
6505
6830
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
6506
6831
|
if (isRoot) {
|
|
6507
|
-
const relativePath2 = paths.root.relativeFilePath;
|
|
6508
6832
|
const fileContent2 = await readFileContent(
|
|
6509
|
-
(0,
|
|
6833
|
+
(0, import_node_path71.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
6510
6834
|
);
|
|
6511
6835
|
return new _ClaudecodeRule({
|
|
6512
6836
|
baseDir,
|
|
6513
6837
|
relativeDirPath: paths.root.relativeDirPath,
|
|
6514
6838
|
relativeFilePath: paths.root.relativeFilePath,
|
|
6515
|
-
|
|
6839
|
+
frontmatter: {},
|
|
6840
|
+
body: fileContent2.trim(),
|
|
6516
6841
|
validate,
|
|
6517
6842
|
root: true
|
|
6518
6843
|
});
|
|
@@ -6520,13 +6845,21 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6520
6845
|
if (!paths.nonRoot) {
|
|
6521
6846
|
throw new Error("nonRoot path is not set");
|
|
6522
6847
|
}
|
|
6523
|
-
const relativePath = (0,
|
|
6524
|
-
const fileContent = await readFileContent((0,
|
|
6848
|
+
const relativePath = (0, import_node_path71.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
6849
|
+
const fileContent = await readFileContent((0, import_node_path71.join)(baseDir, relativePath));
|
|
6850
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
6851
|
+
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
6852
|
+
if (!result.success) {
|
|
6853
|
+
throw new Error(
|
|
6854
|
+
`Invalid frontmatter in ${(0, import_node_path71.join)(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
6855
|
+
);
|
|
6856
|
+
}
|
|
6525
6857
|
return new _ClaudecodeRule({
|
|
6526
6858
|
baseDir,
|
|
6527
6859
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
6528
6860
|
relativeFilePath,
|
|
6529
|
-
|
|
6861
|
+
frontmatter: result.data,
|
|
6862
|
+
body: content.trim(),
|
|
6530
6863
|
validate,
|
|
6531
6864
|
root: false
|
|
6532
6865
|
});
|
|
@@ -6537,22 +6870,86 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6537
6870
|
validate = true,
|
|
6538
6871
|
global = false
|
|
6539
6872
|
}) {
|
|
6873
|
+
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
6874
|
+
const root = rulesyncFrontmatter.root ?? false;
|
|
6540
6875
|
const paths = this.getSettablePaths({ global });
|
|
6541
|
-
|
|
6542
|
-
|
|
6876
|
+
const claudecodePaths = rulesyncFrontmatter.claudecode?.paths;
|
|
6877
|
+
const globs = rulesyncFrontmatter.globs;
|
|
6878
|
+
const pathsValue = claudecodePaths ?? (globs?.length ? globs.join(", ") : void 0);
|
|
6879
|
+
const claudecodeFrontmatter = {
|
|
6880
|
+
paths: root ? void 0 : pathsValue
|
|
6881
|
+
};
|
|
6882
|
+
const body = rulesyncRule.getBody();
|
|
6883
|
+
if (root) {
|
|
6884
|
+
return new _ClaudecodeRule({
|
|
6543
6885
|
baseDir,
|
|
6544
|
-
|
|
6886
|
+
frontmatter: claudecodeFrontmatter,
|
|
6887
|
+
body,
|
|
6888
|
+
relativeDirPath: paths.root.relativeDirPath,
|
|
6889
|
+
relativeFilePath: paths.root.relativeFilePath,
|
|
6545
6890
|
validate,
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
)
|
|
6891
|
+
root
|
|
6892
|
+
});
|
|
6893
|
+
}
|
|
6894
|
+
if (!paths.nonRoot) {
|
|
6895
|
+
throw new Error("nonRoot path is not set");
|
|
6896
|
+
}
|
|
6897
|
+
return new _ClaudecodeRule({
|
|
6898
|
+
baseDir,
|
|
6899
|
+
frontmatter: claudecodeFrontmatter,
|
|
6900
|
+
body,
|
|
6901
|
+
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
6902
|
+
relativeFilePath: rulesyncRule.getRelativeFilePath(),
|
|
6903
|
+
validate,
|
|
6904
|
+
root
|
|
6905
|
+
});
|
|
6550
6906
|
}
|
|
6551
6907
|
toRulesyncRule() {
|
|
6552
|
-
|
|
6908
|
+
let globs;
|
|
6909
|
+
if (this.isRoot()) {
|
|
6910
|
+
globs = ["**/*"];
|
|
6911
|
+
} else if (this.frontmatter.paths) {
|
|
6912
|
+
globs = this.frontmatter.paths.split(",").map((g) => g.trim());
|
|
6913
|
+
}
|
|
6914
|
+
const rulesyncFrontmatter = {
|
|
6915
|
+
targets: ["*"],
|
|
6916
|
+
root: this.isRoot(),
|
|
6917
|
+
description: this.description,
|
|
6918
|
+
globs,
|
|
6919
|
+
...this.frontmatter.paths && {
|
|
6920
|
+
claudecode: { paths: this.frontmatter.paths }
|
|
6921
|
+
}
|
|
6922
|
+
};
|
|
6923
|
+
return new RulesyncRule({
|
|
6924
|
+
baseDir: this.getBaseDir(),
|
|
6925
|
+
frontmatter: rulesyncFrontmatter,
|
|
6926
|
+
body: this.body,
|
|
6927
|
+
relativeDirPath: RULESYNC_RULES_RELATIVE_DIR_PATH,
|
|
6928
|
+
relativeFilePath: this.getRelativeFilePath(),
|
|
6929
|
+
validate: true
|
|
6930
|
+
});
|
|
6553
6931
|
}
|
|
6554
6932
|
validate() {
|
|
6555
|
-
|
|
6933
|
+
if (!this.frontmatter) {
|
|
6934
|
+
return { success: true, error: null };
|
|
6935
|
+
}
|
|
6936
|
+
const result = ClaudecodeRuleFrontmatterSchema.safeParse(this.frontmatter);
|
|
6937
|
+
if (result.success) {
|
|
6938
|
+
return { success: true, error: null };
|
|
6939
|
+
} else {
|
|
6940
|
+
return {
|
|
6941
|
+
success: false,
|
|
6942
|
+
error: new Error(
|
|
6943
|
+
`Invalid frontmatter in ${(0, import_node_path71.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
6944
|
+
)
|
|
6945
|
+
};
|
|
6946
|
+
}
|
|
6947
|
+
}
|
|
6948
|
+
getFrontmatter() {
|
|
6949
|
+
return this.frontmatter;
|
|
6950
|
+
}
|
|
6951
|
+
getBody() {
|
|
6952
|
+
return this.body;
|
|
6556
6953
|
}
|
|
6557
6954
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
6558
6955
|
return this.isTargetedByRulesyncRuleDefault({
|
|
@@ -6563,10 +6960,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6563
6960
|
};
|
|
6564
6961
|
|
|
6565
6962
|
// src/features/rules/cline-rule.ts
|
|
6566
|
-
var
|
|
6567
|
-
var
|
|
6568
|
-
var ClineRuleFrontmatterSchema =
|
|
6569
|
-
description:
|
|
6963
|
+
var import_node_path72 = require("path");
|
|
6964
|
+
var import_mini30 = require("zod/mini");
|
|
6965
|
+
var ClineRuleFrontmatterSchema = import_mini30.z.object({
|
|
6966
|
+
description: import_mini30.z.string()
|
|
6570
6967
|
});
|
|
6571
6968
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
6572
6969
|
static getSettablePaths() {
|
|
@@ -6608,7 +7005,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
6608
7005
|
validate = true
|
|
6609
7006
|
}) {
|
|
6610
7007
|
const fileContent = await readFileContent(
|
|
6611
|
-
(0,
|
|
7008
|
+
(0, import_node_path72.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6612
7009
|
);
|
|
6613
7010
|
return new _ClineRule({
|
|
6614
7011
|
baseDir,
|
|
@@ -6621,7 +7018,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
6621
7018
|
};
|
|
6622
7019
|
|
|
6623
7020
|
// src/features/rules/codexcli-rule.ts
|
|
6624
|
-
var
|
|
7021
|
+
var import_node_path73 = require("path");
|
|
6625
7022
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
6626
7023
|
static getSettablePaths({
|
|
6627
7024
|
global
|
|
@@ -6640,7 +7037,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
6640
7037
|
relativeFilePath: "AGENTS.md"
|
|
6641
7038
|
},
|
|
6642
7039
|
nonRoot: {
|
|
6643
|
-
relativeDirPath: (0,
|
|
7040
|
+
relativeDirPath: (0, import_node_path73.join)(".codex", "memories")
|
|
6644
7041
|
}
|
|
6645
7042
|
};
|
|
6646
7043
|
}
|
|
@@ -6655,7 +7052,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
6655
7052
|
if (isRoot) {
|
|
6656
7053
|
const relativePath2 = paths.root.relativeFilePath;
|
|
6657
7054
|
const fileContent2 = await readFileContent(
|
|
6658
|
-
(0,
|
|
7055
|
+
(0, import_node_path73.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
6659
7056
|
);
|
|
6660
7057
|
return new _CodexcliRule({
|
|
6661
7058
|
baseDir,
|
|
@@ -6669,8 +7066,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
6669
7066
|
if (!paths.nonRoot) {
|
|
6670
7067
|
throw new Error("nonRoot path is not set");
|
|
6671
7068
|
}
|
|
6672
|
-
const relativePath = (0,
|
|
6673
|
-
const fileContent = await readFileContent((0,
|
|
7069
|
+
const relativePath = (0, import_node_path73.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
7070
|
+
const fileContent = await readFileContent((0, import_node_path73.join)(baseDir, relativePath));
|
|
6674
7071
|
return new _CodexcliRule({
|
|
6675
7072
|
baseDir,
|
|
6676
7073
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -6712,12 +7109,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
6712
7109
|
};
|
|
6713
7110
|
|
|
6714
7111
|
// src/features/rules/copilot-rule.ts
|
|
6715
|
-
var
|
|
6716
|
-
var
|
|
6717
|
-
var CopilotRuleFrontmatterSchema =
|
|
6718
|
-
description:
|
|
6719
|
-
applyTo:
|
|
6720
|
-
excludeAgent:
|
|
7112
|
+
var import_node_path74 = require("path");
|
|
7113
|
+
var import_mini31 = require("zod/mini");
|
|
7114
|
+
var CopilotRuleFrontmatterSchema = import_mini31.z.object({
|
|
7115
|
+
description: import_mini31.z.optional(import_mini31.z.string()),
|
|
7116
|
+
applyTo: import_mini31.z.optional(import_mini31.z.string()),
|
|
7117
|
+
excludeAgent: import_mini31.z.optional(import_mini31.z.union([import_mini31.z.literal("code-review"), import_mini31.z.literal("coding-agent")]))
|
|
6721
7118
|
});
|
|
6722
7119
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
6723
7120
|
frontmatter;
|
|
@@ -6729,7 +7126,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6729
7126
|
relativeFilePath: "copilot-instructions.md"
|
|
6730
7127
|
},
|
|
6731
7128
|
nonRoot: {
|
|
6732
|
-
relativeDirPath: (0,
|
|
7129
|
+
relativeDirPath: (0, import_node_path74.join)(".github", "instructions")
|
|
6733
7130
|
}
|
|
6734
7131
|
};
|
|
6735
7132
|
}
|
|
@@ -6738,7 +7135,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6738
7135
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
6739
7136
|
if (!result.success) {
|
|
6740
7137
|
throw new Error(
|
|
6741
|
-
`Invalid frontmatter in ${(0,
|
|
7138
|
+
`Invalid frontmatter in ${(0, import_node_path74.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6742
7139
|
);
|
|
6743
7140
|
}
|
|
6744
7141
|
}
|
|
@@ -6820,11 +7217,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6820
7217
|
validate = true
|
|
6821
7218
|
}) {
|
|
6822
7219
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
6823
|
-
const relativePath = isRoot ? (0,
|
|
7220
|
+
const relativePath = isRoot ? (0, import_node_path74.join)(
|
|
6824
7221
|
this.getSettablePaths().root.relativeDirPath,
|
|
6825
7222
|
this.getSettablePaths().root.relativeFilePath
|
|
6826
|
-
) : (0,
|
|
6827
|
-
const fileContent = await readFileContent((0,
|
|
7223
|
+
) : (0, import_node_path74.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
7224
|
+
const fileContent = await readFileContent((0, import_node_path74.join)(baseDir, relativePath));
|
|
6828
7225
|
if (isRoot) {
|
|
6829
7226
|
return new _CopilotRule({
|
|
6830
7227
|
baseDir,
|
|
@@ -6840,7 +7237,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6840
7237
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
6841
7238
|
if (!result.success) {
|
|
6842
7239
|
throw new Error(
|
|
6843
|
-
`Invalid frontmatter in ${(0,
|
|
7240
|
+
`Invalid frontmatter in ${(0, import_node_path74.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
6844
7241
|
);
|
|
6845
7242
|
}
|
|
6846
7243
|
return new _CopilotRule({
|
|
@@ -6864,7 +7261,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6864
7261
|
return {
|
|
6865
7262
|
success: false,
|
|
6866
7263
|
error: new Error(
|
|
6867
|
-
`Invalid frontmatter in ${(0,
|
|
7264
|
+
`Invalid frontmatter in ${(0, import_node_path74.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
6868
7265
|
)
|
|
6869
7266
|
};
|
|
6870
7267
|
}
|
|
@@ -6884,12 +7281,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6884
7281
|
};
|
|
6885
7282
|
|
|
6886
7283
|
// src/features/rules/cursor-rule.ts
|
|
6887
|
-
var
|
|
6888
|
-
var
|
|
6889
|
-
var CursorRuleFrontmatterSchema =
|
|
6890
|
-
description:
|
|
6891
|
-
globs:
|
|
6892
|
-
alwaysApply:
|
|
7284
|
+
var import_node_path75 = require("path");
|
|
7285
|
+
var import_mini32 = require("zod/mini");
|
|
7286
|
+
var CursorRuleFrontmatterSchema = import_mini32.z.object({
|
|
7287
|
+
description: import_mini32.z.optional(import_mini32.z.string()),
|
|
7288
|
+
globs: import_mini32.z.optional(import_mini32.z.string()),
|
|
7289
|
+
alwaysApply: import_mini32.z.optional(import_mini32.z.boolean())
|
|
6893
7290
|
});
|
|
6894
7291
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
6895
7292
|
frontmatter;
|
|
@@ -6897,7 +7294,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
6897
7294
|
static getSettablePaths() {
|
|
6898
7295
|
return {
|
|
6899
7296
|
nonRoot: {
|
|
6900
|
-
relativeDirPath: (0,
|
|
7297
|
+
relativeDirPath: (0, import_node_path75.join)(".cursor", "rules")
|
|
6901
7298
|
}
|
|
6902
7299
|
};
|
|
6903
7300
|
}
|
|
@@ -6906,7 +7303,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
6906
7303
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
6907
7304
|
if (!result.success) {
|
|
6908
7305
|
throw new Error(
|
|
6909
|
-
`Invalid frontmatter in ${(0,
|
|
7306
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6910
7307
|
);
|
|
6911
7308
|
}
|
|
6912
7309
|
}
|
|
@@ -7023,19 +7420,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7023
7420
|
validate = true
|
|
7024
7421
|
}) {
|
|
7025
7422
|
const fileContent = await readFileContent(
|
|
7026
|
-
(0,
|
|
7423
|
+
(0, import_node_path75.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7027
7424
|
);
|
|
7028
7425
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
7029
7426
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7030
7427
|
if (!result.success) {
|
|
7031
7428
|
throw new Error(
|
|
7032
|
-
`Invalid frontmatter in ${(0,
|
|
7429
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
7033
7430
|
);
|
|
7034
7431
|
}
|
|
7035
7432
|
return new _CursorRule({
|
|
7036
7433
|
baseDir,
|
|
7037
7434
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
7038
|
-
relativeFilePath: (0,
|
|
7435
|
+
relativeFilePath: (0, import_node_path75.basename)(relativeFilePath),
|
|
7039
7436
|
frontmatter: result.data,
|
|
7040
7437
|
body: content.trim(),
|
|
7041
7438
|
validate
|
|
@@ -7052,7 +7449,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7052
7449
|
return {
|
|
7053
7450
|
success: false,
|
|
7054
7451
|
error: new Error(
|
|
7055
|
-
`Invalid frontmatter in ${(0,
|
|
7452
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7056
7453
|
)
|
|
7057
7454
|
};
|
|
7058
7455
|
}
|
|
@@ -7072,7 +7469,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7072
7469
|
};
|
|
7073
7470
|
|
|
7074
7471
|
// src/features/rules/geminicli-rule.ts
|
|
7075
|
-
var
|
|
7472
|
+
var import_node_path76 = require("path");
|
|
7076
7473
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
7077
7474
|
static getSettablePaths({
|
|
7078
7475
|
global
|
|
@@ -7091,7 +7488,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7091
7488
|
relativeFilePath: "GEMINI.md"
|
|
7092
7489
|
},
|
|
7093
7490
|
nonRoot: {
|
|
7094
|
-
relativeDirPath: (0,
|
|
7491
|
+
relativeDirPath: (0, import_node_path76.join)(".gemini", "memories")
|
|
7095
7492
|
}
|
|
7096
7493
|
};
|
|
7097
7494
|
}
|
|
@@ -7106,7 +7503,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7106
7503
|
if (isRoot) {
|
|
7107
7504
|
const relativePath2 = paths.root.relativeFilePath;
|
|
7108
7505
|
const fileContent2 = await readFileContent(
|
|
7109
|
-
(0,
|
|
7506
|
+
(0, import_node_path76.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
7110
7507
|
);
|
|
7111
7508
|
return new _GeminiCliRule({
|
|
7112
7509
|
baseDir,
|
|
@@ -7120,8 +7517,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7120
7517
|
if (!paths.nonRoot) {
|
|
7121
7518
|
throw new Error("nonRoot path is not set");
|
|
7122
7519
|
}
|
|
7123
|
-
const relativePath = (0,
|
|
7124
|
-
const fileContent = await readFileContent((0,
|
|
7520
|
+
const relativePath = (0, import_node_path76.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
7521
|
+
const fileContent = await readFileContent((0, import_node_path76.join)(baseDir, relativePath));
|
|
7125
7522
|
return new _GeminiCliRule({
|
|
7126
7523
|
baseDir,
|
|
7127
7524
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -7163,7 +7560,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7163
7560
|
};
|
|
7164
7561
|
|
|
7165
7562
|
// src/features/rules/junie-rule.ts
|
|
7166
|
-
var
|
|
7563
|
+
var import_node_path77 = require("path");
|
|
7167
7564
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
7168
7565
|
static getSettablePaths() {
|
|
7169
7566
|
return {
|
|
@@ -7172,7 +7569,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7172
7569
|
relativeFilePath: "guidelines.md"
|
|
7173
7570
|
},
|
|
7174
7571
|
nonRoot: {
|
|
7175
|
-
relativeDirPath: (0,
|
|
7572
|
+
relativeDirPath: (0, import_node_path77.join)(".junie", "memories")
|
|
7176
7573
|
}
|
|
7177
7574
|
};
|
|
7178
7575
|
}
|
|
@@ -7182,8 +7579,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7182
7579
|
validate = true
|
|
7183
7580
|
}) {
|
|
7184
7581
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
7185
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
7186
|
-
const fileContent = await readFileContent((0,
|
|
7582
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path77.join)(".junie", "memories", relativeFilePath);
|
|
7583
|
+
const fileContent = await readFileContent((0, import_node_path77.join)(baseDir, relativePath));
|
|
7187
7584
|
return new _JunieRule({
|
|
7188
7585
|
baseDir,
|
|
7189
7586
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7223,12 +7620,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7223
7620
|
};
|
|
7224
7621
|
|
|
7225
7622
|
// src/features/rules/kiro-rule.ts
|
|
7226
|
-
var
|
|
7623
|
+
var import_node_path78 = require("path");
|
|
7227
7624
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
7228
7625
|
static getSettablePaths() {
|
|
7229
7626
|
return {
|
|
7230
7627
|
nonRoot: {
|
|
7231
|
-
relativeDirPath: (0,
|
|
7628
|
+
relativeDirPath: (0, import_node_path78.join)(".kiro", "steering")
|
|
7232
7629
|
}
|
|
7233
7630
|
};
|
|
7234
7631
|
}
|
|
@@ -7238,7 +7635,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
7238
7635
|
validate = true
|
|
7239
7636
|
}) {
|
|
7240
7637
|
const fileContent = await readFileContent(
|
|
7241
|
-
(0,
|
|
7638
|
+
(0, import_node_path78.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7242
7639
|
);
|
|
7243
7640
|
return new _KiroRule({
|
|
7244
7641
|
baseDir,
|
|
@@ -7278,7 +7675,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
7278
7675
|
};
|
|
7279
7676
|
|
|
7280
7677
|
// src/features/rules/opencode-rule.ts
|
|
7281
|
-
var
|
|
7678
|
+
var import_node_path79 = require("path");
|
|
7282
7679
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
7283
7680
|
static getSettablePaths() {
|
|
7284
7681
|
return {
|
|
@@ -7287,7 +7684,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7287
7684
|
relativeFilePath: "AGENTS.md"
|
|
7288
7685
|
},
|
|
7289
7686
|
nonRoot: {
|
|
7290
|
-
relativeDirPath: (0,
|
|
7687
|
+
relativeDirPath: (0, import_node_path79.join)(".opencode", "memories")
|
|
7291
7688
|
}
|
|
7292
7689
|
};
|
|
7293
7690
|
}
|
|
@@ -7297,8 +7694,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7297
7694
|
validate = true
|
|
7298
7695
|
}) {
|
|
7299
7696
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
7300
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
7301
|
-
const fileContent = await readFileContent((0,
|
|
7697
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path79.join)(".opencode", "memories", relativeFilePath);
|
|
7698
|
+
const fileContent = await readFileContent((0, import_node_path79.join)(baseDir, relativePath));
|
|
7302
7699
|
return new _OpenCodeRule({
|
|
7303
7700
|
baseDir,
|
|
7304
7701
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7338,7 +7735,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7338
7735
|
};
|
|
7339
7736
|
|
|
7340
7737
|
// src/features/rules/qwencode-rule.ts
|
|
7341
|
-
var
|
|
7738
|
+
var import_node_path80 = require("path");
|
|
7342
7739
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
7343
7740
|
static getSettablePaths() {
|
|
7344
7741
|
return {
|
|
@@ -7347,7 +7744,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7347
7744
|
relativeFilePath: "QWEN.md"
|
|
7348
7745
|
},
|
|
7349
7746
|
nonRoot: {
|
|
7350
|
-
relativeDirPath: (0,
|
|
7747
|
+
relativeDirPath: (0, import_node_path80.join)(".qwen", "memories")
|
|
7351
7748
|
}
|
|
7352
7749
|
};
|
|
7353
7750
|
}
|
|
@@ -7357,8 +7754,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7357
7754
|
validate = true
|
|
7358
7755
|
}) {
|
|
7359
7756
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
7360
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
7361
|
-
const fileContent = await readFileContent((0,
|
|
7757
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path80.join)(".qwen", "memories", relativeFilePath);
|
|
7758
|
+
const fileContent = await readFileContent((0, import_node_path80.join)(baseDir, relativePath));
|
|
7362
7759
|
return new _QwencodeRule({
|
|
7363
7760
|
baseDir,
|
|
7364
7761
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7395,12 +7792,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7395
7792
|
};
|
|
7396
7793
|
|
|
7397
7794
|
// src/features/rules/roo-rule.ts
|
|
7398
|
-
var
|
|
7795
|
+
var import_node_path81 = require("path");
|
|
7399
7796
|
var RooRule = class _RooRule extends ToolRule {
|
|
7400
7797
|
static getSettablePaths() {
|
|
7401
7798
|
return {
|
|
7402
7799
|
nonRoot: {
|
|
7403
|
-
relativeDirPath: (0,
|
|
7800
|
+
relativeDirPath: (0, import_node_path81.join)(".roo", "rules")
|
|
7404
7801
|
}
|
|
7405
7802
|
};
|
|
7406
7803
|
}
|
|
@@ -7410,7 +7807,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
7410
7807
|
validate = true
|
|
7411
7808
|
}) {
|
|
7412
7809
|
const fileContent = await readFileContent(
|
|
7413
|
-
(0,
|
|
7810
|
+
(0, import_node_path81.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7414
7811
|
);
|
|
7415
7812
|
return new _RooRule({
|
|
7416
7813
|
baseDir,
|
|
@@ -7465,7 +7862,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
7465
7862
|
};
|
|
7466
7863
|
|
|
7467
7864
|
// src/features/rules/warp-rule.ts
|
|
7468
|
-
var
|
|
7865
|
+
var import_node_path82 = require("path");
|
|
7469
7866
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
7470
7867
|
constructor({ fileContent, root, ...rest }) {
|
|
7471
7868
|
super({
|
|
@@ -7481,7 +7878,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
7481
7878
|
relativeFilePath: "WARP.md"
|
|
7482
7879
|
},
|
|
7483
7880
|
nonRoot: {
|
|
7484
|
-
relativeDirPath: (0,
|
|
7881
|
+
relativeDirPath: (0, import_node_path82.join)(".warp", "memories")
|
|
7485
7882
|
}
|
|
7486
7883
|
};
|
|
7487
7884
|
}
|
|
@@ -7491,8 +7888,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
7491
7888
|
validate = true
|
|
7492
7889
|
}) {
|
|
7493
7890
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
7494
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
7495
|
-
const fileContent = await readFileContent((0,
|
|
7891
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path82.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
7892
|
+
const fileContent = await readFileContent((0, import_node_path82.join)(baseDir, relativePath));
|
|
7496
7893
|
return new _WarpRule({
|
|
7497
7894
|
baseDir,
|
|
7498
7895
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -7532,12 +7929,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
7532
7929
|
};
|
|
7533
7930
|
|
|
7534
7931
|
// src/features/rules/windsurf-rule.ts
|
|
7535
|
-
var
|
|
7932
|
+
var import_node_path83 = require("path");
|
|
7536
7933
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
7537
7934
|
static getSettablePaths() {
|
|
7538
7935
|
return {
|
|
7539
7936
|
nonRoot: {
|
|
7540
|
-
relativeDirPath: (0,
|
|
7937
|
+
relativeDirPath: (0, import_node_path83.join)(".windsurf", "rules")
|
|
7541
7938
|
}
|
|
7542
7939
|
};
|
|
7543
7940
|
}
|
|
@@ -7547,7 +7944,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
7547
7944
|
validate = true
|
|
7548
7945
|
}) {
|
|
7549
7946
|
const fileContent = await readFileContent(
|
|
7550
|
-
(0,
|
|
7947
|
+
(0, import_node_path83.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7551
7948
|
);
|
|
7552
7949
|
return new _WindsurfRule({
|
|
7553
7950
|
baseDir,
|
|
@@ -7593,6 +7990,7 @@ var rulesProcessorToolTargets = [
|
|
|
7593
7990
|
"augmentcode",
|
|
7594
7991
|
"augmentcode-legacy",
|
|
7595
7992
|
"claudecode",
|
|
7993
|
+
"claudecode-legacy",
|
|
7596
7994
|
"cline",
|
|
7597
7995
|
"codexcli",
|
|
7598
7996
|
"copilot",
|
|
@@ -7606,9 +8004,10 @@ var rulesProcessorToolTargets = [
|
|
|
7606
8004
|
"warp",
|
|
7607
8005
|
"windsurf"
|
|
7608
8006
|
];
|
|
7609
|
-
var RulesProcessorToolTargetSchema =
|
|
8007
|
+
var RulesProcessorToolTargetSchema = import_mini33.z.enum(rulesProcessorToolTargets);
|
|
7610
8008
|
var rulesProcessorToolTargetsGlobal = [
|
|
7611
8009
|
"claudecode",
|
|
8010
|
+
"claudecode-legacy",
|
|
7612
8011
|
"codexcli",
|
|
7613
8012
|
"geminicli"
|
|
7614
8013
|
];
|
|
@@ -7619,6 +8018,7 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
7619
8018
|
["augmentcode", { class: AugmentcodeRule, meta: { extension: "md" } }],
|
|
7620
8019
|
["augmentcode-legacy", { class: AugmentcodeLegacyRule, meta: { extension: "md" } }],
|
|
7621
8020
|
["claudecode", { class: ClaudecodeRule, meta: { extension: "md" } }],
|
|
8021
|
+
["claudecode-legacy", { class: ClaudecodeLegacyRule, meta: { extension: "md" } }],
|
|
7622
8022
|
["cline", { class: ClineRule, meta: { extension: "md" } }],
|
|
7623
8023
|
["codexcli", { class: CodexcliRule, meta: { extension: "md" } }],
|
|
7624
8024
|
["copilot", { class: CopilotRule, meta: { extension: "md" } }],
|
|
@@ -7732,7 +8132,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7732
8132
|
case "agentsmd": {
|
|
7733
8133
|
const rootRule = toolRules[rootRuleIndex];
|
|
7734
8134
|
rootRule?.setFileContent(
|
|
7735
|
-
this.
|
|
8135
|
+
this.generateToonReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
|
|
7736
8136
|
commands: { relativeDirPath: AgentsmdCommand.getSettablePaths().relativeDirPath },
|
|
7737
8137
|
subagents: {
|
|
7738
8138
|
relativeDirPath: AgentsmdSubagent.getSettablePaths().relativeDirPath
|
|
@@ -7744,11 +8144,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7744
8144
|
case "augmentcode-legacy": {
|
|
7745
8145
|
const rootRule = toolRules[rootRuleIndex];
|
|
7746
8146
|
rootRule?.setFileContent(
|
|
7747
|
-
this.
|
|
8147
|
+
this.generateToonReferencesSection(toolRules) + rootRule.getFileContent()
|
|
7748
8148
|
);
|
|
7749
8149
|
return toolRules;
|
|
7750
8150
|
}
|
|
7751
8151
|
case "claudecode": {
|
|
8152
|
+
return toolRules;
|
|
8153
|
+
}
|
|
8154
|
+
case "claudecode-legacy": {
|
|
7752
8155
|
const rootRule = toolRules[rootRuleIndex];
|
|
7753
8156
|
rootRule?.setFileContent(
|
|
7754
8157
|
this.generateReferencesSection(toolRules) + rootRule.getFileContent()
|
|
@@ -7758,12 +8161,15 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7758
8161
|
case "codexcli": {
|
|
7759
8162
|
const rootRule = toolRules[rootRuleIndex];
|
|
7760
8163
|
rootRule?.setFileContent(
|
|
7761
|
-
this.
|
|
8164
|
+
this.generateToonReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
|
|
7762
8165
|
subagents: {
|
|
7763
8166
|
relativeDirPath: CodexCliSubagent.getSettablePaths().relativeDirPath
|
|
7764
8167
|
},
|
|
7765
|
-
skills
|
|
7766
|
-
|
|
8168
|
+
// Codex CLI skills are only supported in global mode
|
|
8169
|
+
...this.global && {
|
|
8170
|
+
skills: {
|
|
8171
|
+
relativeDirPath: CodexCliSkill.getSettablePaths({ global: this.global }).relativeDirPath
|
|
8172
|
+
}
|
|
7767
8173
|
}
|
|
7768
8174
|
}) + rootRule.getFileContent()
|
|
7769
8175
|
);
|
|
@@ -7787,7 +8193,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7787
8193
|
case "geminicli": {
|
|
7788
8194
|
const rootRule = toolRules[rootRuleIndex];
|
|
7789
8195
|
rootRule?.setFileContent(
|
|
7790
|
-
this.
|
|
8196
|
+
this.generateToonReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
|
|
7791
8197
|
commands: { relativeDirPath: GeminiCliCommand.getSettablePaths().relativeDirPath },
|
|
7792
8198
|
subagents: {
|
|
7793
8199
|
relativeDirPath: GeminiCliSubagent.getSettablePaths().relativeDirPath
|
|
@@ -7799,28 +8205,28 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7799
8205
|
case "kiro": {
|
|
7800
8206
|
const rootRule = toolRules[rootRuleIndex];
|
|
7801
8207
|
rootRule?.setFileContent(
|
|
7802
|
-
this.
|
|
8208
|
+
this.generateToonReferencesSection(toolRules) + rootRule.getFileContent()
|
|
7803
8209
|
);
|
|
7804
8210
|
return toolRules;
|
|
7805
8211
|
}
|
|
7806
8212
|
case "opencode": {
|
|
7807
8213
|
const rootRule = toolRules[rootRuleIndex];
|
|
7808
8214
|
rootRule?.setFileContent(
|
|
7809
|
-
this.
|
|
8215
|
+
this.generateToonReferencesSection(toolRules) + rootRule.getFileContent()
|
|
7810
8216
|
);
|
|
7811
8217
|
return toolRules;
|
|
7812
8218
|
}
|
|
7813
8219
|
case "qwencode": {
|
|
7814
8220
|
const rootRule = toolRules[rootRuleIndex];
|
|
7815
8221
|
rootRule?.setFileContent(
|
|
7816
|
-
this.
|
|
8222
|
+
this.generateToonReferencesSection(toolRules) + rootRule.getFileContent()
|
|
7817
8223
|
);
|
|
7818
8224
|
return toolRules;
|
|
7819
8225
|
}
|
|
7820
8226
|
case "warp": {
|
|
7821
8227
|
const rootRule = toolRules[rootRuleIndex];
|
|
7822
8228
|
rootRule?.setFileContent(
|
|
7823
|
-
this.
|
|
8229
|
+
this.generateToonReferencesSection(toolRules) + rootRule.getFileContent()
|
|
7824
8230
|
);
|
|
7825
8231
|
return toolRules;
|
|
7826
8232
|
}
|
|
@@ -7840,10 +8246,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7840
8246
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
7841
8247
|
*/
|
|
7842
8248
|
async loadRulesyncFiles() {
|
|
7843
|
-
const files = await findFilesByGlobs((0,
|
|
8249
|
+
const files = await findFilesByGlobs((0, import_node_path84.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
7844
8250
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
7845
8251
|
const rulesyncRules = await Promise.all(
|
|
7846
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0,
|
|
8252
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path84.basename)(file) }))
|
|
7847
8253
|
);
|
|
7848
8254
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
7849
8255
|
if (rootRules.length > 1) {
|
|
@@ -7861,10 +8267,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7861
8267
|
return rulesyncRules;
|
|
7862
8268
|
}
|
|
7863
8269
|
async loadRulesyncFilesLegacy() {
|
|
7864
|
-
const legacyFiles = await findFilesByGlobs((0,
|
|
8270
|
+
const legacyFiles = await findFilesByGlobs((0, import_node_path84.join)(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
7865
8271
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
7866
8272
|
return Promise.all(
|
|
7867
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0,
|
|
8273
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path84.basename)(file) }))
|
|
7868
8274
|
);
|
|
7869
8275
|
}
|
|
7870
8276
|
/**
|
|
@@ -7882,7 +8288,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7882
8288
|
return [];
|
|
7883
8289
|
}
|
|
7884
8290
|
const rootFilePaths = await findFilesByGlobs(
|
|
7885
|
-
(0,
|
|
8291
|
+
(0, import_node_path84.join)(
|
|
7886
8292
|
this.baseDir,
|
|
7887
8293
|
settablePaths.root.relativeDirPath ?? ".",
|
|
7888
8294
|
settablePaths.root.relativeFilePath
|
|
@@ -7892,7 +8298,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7892
8298
|
rootFilePaths.map(
|
|
7893
8299
|
(filePath) => factory.class.fromFile({
|
|
7894
8300
|
baseDir: this.baseDir,
|
|
7895
|
-
relativeFilePath: (0,
|
|
8301
|
+
relativeFilePath: (0, import_node_path84.basename)(filePath),
|
|
7896
8302
|
global: this.global
|
|
7897
8303
|
})
|
|
7898
8304
|
)
|
|
@@ -7904,13 +8310,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7904
8310
|
return [];
|
|
7905
8311
|
}
|
|
7906
8312
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
7907
|
-
(0,
|
|
8313
|
+
(0, import_node_path84.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
7908
8314
|
);
|
|
7909
8315
|
return await Promise.all(
|
|
7910
8316
|
nonRootFilePaths.map(
|
|
7911
8317
|
(filePath) => factory.class.fromFile({
|
|
7912
8318
|
baseDir: this.baseDir,
|
|
7913
|
-
relativeFilePath: (0,
|
|
8319
|
+
relativeFilePath: (0, import_node_path84.basename)(filePath),
|
|
7914
8320
|
global: this.global
|
|
7915
8321
|
})
|
|
7916
8322
|
)
|
|
@@ -7933,43 +8339,35 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7933
8339
|
}
|
|
7934
8340
|
return rulesProcessorToolTargets;
|
|
7935
8341
|
}
|
|
7936
|
-
|
|
8342
|
+
generateToonReferencesSection(toolRules) {
|
|
7937
8343
|
const toolRulesWithoutRoot = toolRules.filter((rule) => !rule.isRoot());
|
|
7938
8344
|
if (toolRulesWithoutRoot.length === 0) {
|
|
7939
8345
|
return "";
|
|
7940
8346
|
}
|
|
7941
8347
|
const lines = [];
|
|
7942
8348
|
lines.push(
|
|
7943
|
-
"Please also reference the following
|
|
8349
|
+
"Please also reference the following rules as needed. The list below is provided in TOON format, and `@` stands for the project root directory."
|
|
7944
8350
|
);
|
|
7945
8351
|
lines.push("");
|
|
7946
|
-
const
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
};
|
|
7955
|
-
if (frontmatter.description) {
|
|
7956
|
-
document.Description = frontmatter.description;
|
|
7957
|
-
}
|
|
7958
|
-
if (frontmatter.globs && frontmatter.globs.length > 0) {
|
|
7959
|
-
document.FilePatterns = frontmatter.globs.join(", ");
|
|
7960
|
-
}
|
|
7961
|
-
return document;
|
|
7962
|
-
})
|
|
8352
|
+
const rules = toolRulesWithoutRoot.map((toolRule) => {
|
|
8353
|
+
const rulesyncRule = toolRule.toRulesyncRule();
|
|
8354
|
+
const frontmatter = rulesyncRule.getFrontmatter();
|
|
8355
|
+
const rule = {
|
|
8356
|
+
path: `@${toolRule.getRelativePathFromCwd()}`
|
|
8357
|
+
};
|
|
8358
|
+
if (frontmatter.description) {
|
|
8359
|
+
rule.description = frontmatter.description;
|
|
7963
8360
|
}
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
8361
|
+
if (frontmatter.globs && frontmatter.globs.length > 0) {
|
|
8362
|
+
rule.applyTo = frontmatter.globs;
|
|
8363
|
+
}
|
|
8364
|
+
return rule;
|
|
8365
|
+
});
|
|
8366
|
+
const toonContent = (0, import_toon.encode)({
|
|
8367
|
+
rules
|
|
7969
8368
|
});
|
|
7970
|
-
|
|
7971
|
-
lines.
|
|
7972
|
-
return lines.join("\n") + "\n";
|
|
8369
|
+
lines.push(toonContent);
|
|
8370
|
+
return lines.join("\n") + "\n\n";
|
|
7973
8371
|
}
|
|
7974
8372
|
generateReferencesSection(toolRules) {
|
|
7975
8373
|
const toolRulesWithoutRoot = toolRules.filter((rule) => !rule.isRoot());
|
|
@@ -7977,13 +8375,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7977
8375
|
return "";
|
|
7978
8376
|
}
|
|
7979
8377
|
const lines = [];
|
|
7980
|
-
lines.push("Please also reference the following
|
|
8378
|
+
lines.push("Please also reference the following rules as needed:");
|
|
7981
8379
|
lines.push("");
|
|
7982
|
-
for (const
|
|
7983
|
-
const escapedDescription =
|
|
7984
|
-
const globsText =
|
|
8380
|
+
for (const toolRule of toolRulesWithoutRoot) {
|
|
8381
|
+
const escapedDescription = toolRule.getDescription()?.replace(/"/g, '\\"');
|
|
8382
|
+
const globsText = toolRule.getGlobs()?.join(",");
|
|
7985
8383
|
lines.push(
|
|
7986
|
-
`@${
|
|
8384
|
+
`@${toolRule.getRelativePathFromCwd()} description: "${escapedDescription}" applyTo: "${globsText}"`
|
|
7987
8385
|
);
|
|
7988
8386
|
}
|
|
7989
8387
|
return lines.join("\n") + "\n\n";
|
|
@@ -8011,21 +8409,21 @@ s/<command> [arguments]
|
|
|
8011
8409
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
8012
8410
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
8013
8411
|
|
|
8014
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
8412
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path84.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
8015
8413
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
8016
8414
|
|
|
8017
8415
|
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.
|
|
8018
8416
|
|
|
8019
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
8417
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path84.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
8020
8418
|
|
|
8021
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
8419
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path84.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
8022
8420
|
const skillsSection = skills ? `## Simulated Skills
|
|
8023
8421
|
|
|
8024
8422
|
Simulated skills are specialized capabilities that can be invoked to handle specific types of tasks.
|
|
8025
8423
|
|
|
8026
|
-
When users invoke a simulated skill, look for the corresponding SKILL.md file in \`${(0,
|
|
8424
|
+
When users invoke a simulated skill, look for the corresponding SKILL.md file in \`${(0, import_node_path84.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "{skill}/SKILL.md")}\` and execute its contents as the block of operations.
|
|
8027
8425
|
|
|
8028
|
-
For example, if the user instructs \`Use the skill example-skill to achieve something\`, look for \`${(0,
|
|
8426
|
+
For example, if the user instructs \`Use the skill example-skill to achieve something\`, look for \`${(0, import_node_path84.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "example-skill/SKILL.md")}\` and execute its contents.
|
|
8029
8427
|
|
|
8030
8428
|
Additionally, you should proactively consider using available skills when they would help accomplish a task more effectively, even if the user doesn't explicitly request them.` : "";
|
|
8031
8429
|
const result = [
|
|
@@ -8287,102 +8685,149 @@ async function generateSkills(config) {
|
|
|
8287
8685
|
}
|
|
8288
8686
|
|
|
8289
8687
|
// src/cli/commands/gitignore.ts
|
|
8290
|
-
var
|
|
8688
|
+
var import_node_path85 = require("path");
|
|
8689
|
+
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
8690
|
+
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
8691
|
+
var RULESYNC_IGNORE_ENTRIES = [
|
|
8692
|
+
// AGENTS.md
|
|
8693
|
+
"**/AGENTS.md",
|
|
8694
|
+
"**/.agents/",
|
|
8695
|
+
// Amazon Q
|
|
8696
|
+
"**/.amazonq/",
|
|
8697
|
+
// Augment
|
|
8698
|
+
"**/.augmentignore",
|
|
8699
|
+
"**/.augment/rules/",
|
|
8700
|
+
"**/.augment-guidelines",
|
|
8701
|
+
// Claude Code
|
|
8702
|
+
"**/CLAUDE.md",
|
|
8703
|
+
"**/.claude/CLAUDE.md",
|
|
8704
|
+
"**/.claude/memories/",
|
|
8705
|
+
"**/.claude/rules/",
|
|
8706
|
+
"**/.claude/commands/",
|
|
8707
|
+
"**/.claude/agents/",
|
|
8708
|
+
"**/.claude/skills/",
|
|
8709
|
+
"**/.claude/settings.local.json",
|
|
8710
|
+
"**/.mcp.json",
|
|
8711
|
+
// Cline
|
|
8712
|
+
"**/.clinerules/",
|
|
8713
|
+
"**/.clineignore",
|
|
8714
|
+
"**/.cline/mcp.json",
|
|
8715
|
+
// Codex
|
|
8716
|
+
"**/.codexignore",
|
|
8717
|
+
"**/.codex/",
|
|
8718
|
+
"**/.codex/skills/",
|
|
8719
|
+
// Cursor
|
|
8720
|
+
"**/.cursor/",
|
|
8721
|
+
"**/.cursorignore",
|
|
8722
|
+
// Gemini
|
|
8723
|
+
"**/GEMINI.md",
|
|
8724
|
+
"**/.gemini/memories/",
|
|
8725
|
+
"**/.gemini/commands/",
|
|
8726
|
+
"**/.gemini/subagents/",
|
|
8727
|
+
"**/.gemini/skills/",
|
|
8728
|
+
"**/.geminiignore",
|
|
8729
|
+
// GitHub Copilot
|
|
8730
|
+
"**/.github/copilot-instructions.md",
|
|
8731
|
+
"**/.github/instructions/",
|
|
8732
|
+
"**/.github/prompts/",
|
|
8733
|
+
"**/.github/subagents/",
|
|
8734
|
+
"**/.github/skills/",
|
|
8735
|
+
"**/.vscode/mcp.json",
|
|
8736
|
+
// Junie
|
|
8737
|
+
"**/.junie/guidelines.md",
|
|
8738
|
+
"**/.junie/mcp.json",
|
|
8739
|
+
// Kiro
|
|
8740
|
+
"**/.kiro/steering/",
|
|
8741
|
+
"**/.aiignore",
|
|
8742
|
+
// OpenCode
|
|
8743
|
+
"**/.opencode/memories/",
|
|
8744
|
+
"**/.opencode/command/",
|
|
8745
|
+
"**/opencode.json",
|
|
8746
|
+
// Qwen
|
|
8747
|
+
"**/QWEN.md",
|
|
8748
|
+
"**/.qwen/memories/",
|
|
8749
|
+
// Roo
|
|
8750
|
+
"**/.roo/rules/",
|
|
8751
|
+
"**/.rooignore",
|
|
8752
|
+
"**/.roo/mcp.json",
|
|
8753
|
+
"**/.roo/subagents/",
|
|
8754
|
+
// Warp
|
|
8755
|
+
"**/.warp/",
|
|
8756
|
+
"**/WARP.md",
|
|
8757
|
+
// Others
|
|
8758
|
+
"**/modular-mcp.json",
|
|
8759
|
+
"!.rulesync/.aiignore"
|
|
8760
|
+
];
|
|
8761
|
+
var isRulesyncHeader = (line) => {
|
|
8762
|
+
const trimmed = line.trim();
|
|
8763
|
+
return trimmed === RULESYNC_HEADER || trimmed === LEGACY_RULESYNC_HEADER;
|
|
8764
|
+
};
|
|
8765
|
+
var isRulesyncEntry = (line) => {
|
|
8766
|
+
const trimmed = line.trim();
|
|
8767
|
+
if (trimmed === "" || isRulesyncHeader(line)) {
|
|
8768
|
+
return false;
|
|
8769
|
+
}
|
|
8770
|
+
return RULESYNC_IGNORE_ENTRIES.includes(trimmed);
|
|
8771
|
+
};
|
|
8772
|
+
var removeExistingRulesyncEntries = (content) => {
|
|
8773
|
+
const lines = content.split("\n");
|
|
8774
|
+
const filteredLines = [];
|
|
8775
|
+
let inRulesyncBlock = false;
|
|
8776
|
+
let consecutiveEmptyLines = 0;
|
|
8777
|
+
for (const line of lines) {
|
|
8778
|
+
const trimmed = line.trim();
|
|
8779
|
+
if (isRulesyncHeader(line)) {
|
|
8780
|
+
inRulesyncBlock = true;
|
|
8781
|
+
continue;
|
|
8782
|
+
}
|
|
8783
|
+
if (inRulesyncBlock) {
|
|
8784
|
+
if (trimmed === "") {
|
|
8785
|
+
consecutiveEmptyLines++;
|
|
8786
|
+
if (consecutiveEmptyLines >= 2) {
|
|
8787
|
+
inRulesyncBlock = false;
|
|
8788
|
+
consecutiveEmptyLines = 0;
|
|
8789
|
+
}
|
|
8790
|
+
continue;
|
|
8791
|
+
}
|
|
8792
|
+
if (isRulesyncEntry(line)) {
|
|
8793
|
+
consecutiveEmptyLines = 0;
|
|
8794
|
+
continue;
|
|
8795
|
+
}
|
|
8796
|
+
inRulesyncBlock = false;
|
|
8797
|
+
consecutiveEmptyLines = 0;
|
|
8798
|
+
}
|
|
8799
|
+
if (isRulesyncEntry(line)) {
|
|
8800
|
+
continue;
|
|
8801
|
+
}
|
|
8802
|
+
filteredLines.push(line);
|
|
8803
|
+
}
|
|
8804
|
+
let result = filteredLines.join("\n");
|
|
8805
|
+
while (result.endsWith("\n\n")) {
|
|
8806
|
+
result = result.slice(0, -1);
|
|
8807
|
+
}
|
|
8808
|
+
return result;
|
|
8809
|
+
};
|
|
8291
8810
|
var gitignoreCommand = async () => {
|
|
8292
|
-
const gitignorePath = (0,
|
|
8293
|
-
const rulesFilesToIgnore = [
|
|
8294
|
-
"# Generated by rulesync - AI tool configuration files",
|
|
8295
|
-
// AGENTS.md
|
|
8296
|
-
"**/AGENTS.md",
|
|
8297
|
-
"**/.agents/",
|
|
8298
|
-
// Amazon Q
|
|
8299
|
-
"**/.amazonq/",
|
|
8300
|
-
// Augment
|
|
8301
|
-
"**/.augmentignore",
|
|
8302
|
-
"**/.augment/rules/",
|
|
8303
|
-
"**/.augment-guidelines",
|
|
8304
|
-
// Claude Code
|
|
8305
|
-
"**/CLAUDE.md",
|
|
8306
|
-
"**/.claude/memories/",
|
|
8307
|
-
"**/.claude/commands/",
|
|
8308
|
-
"**/.claude/agents/",
|
|
8309
|
-
"**/.claude/skills/",
|
|
8310
|
-
"**/.claude/settings.local.json",
|
|
8311
|
-
"**/.mcp.json",
|
|
8312
|
-
// Cline
|
|
8313
|
-
"**/.clinerules/",
|
|
8314
|
-
"**/.clineignore",
|
|
8315
|
-
"**/.cline/mcp.json",
|
|
8316
|
-
// Codex
|
|
8317
|
-
"**/.codexignore",
|
|
8318
|
-
"**/.codex/",
|
|
8319
|
-
"**/.codex/skills/",
|
|
8320
|
-
// Cursor
|
|
8321
|
-
"**/.cursor/",
|
|
8322
|
-
"**/.cursorignore",
|
|
8323
|
-
// Gemini
|
|
8324
|
-
"**/GEMINI.md",
|
|
8325
|
-
"**/.gemini/memories/",
|
|
8326
|
-
"**/.gemini/commands/",
|
|
8327
|
-
"**/.gemini/subagents/",
|
|
8328
|
-
"**/.gemini/skills/",
|
|
8329
|
-
// GitHub Copilot
|
|
8330
|
-
"**/.github/copilot-instructions.md",
|
|
8331
|
-
"**/.github/instructions/",
|
|
8332
|
-
"**/.github/prompts/",
|
|
8333
|
-
"**/.github/subagents/",
|
|
8334
|
-
"**/.github/skills/",
|
|
8335
|
-
"**/.vscode/mcp.json",
|
|
8336
|
-
// Junie
|
|
8337
|
-
"**/.junie/guidelines.md",
|
|
8338
|
-
"**/.junie/mcp.json",
|
|
8339
|
-
// Kiro
|
|
8340
|
-
"**/.kiro/steering/",
|
|
8341
|
-
"**/.aiignore",
|
|
8342
|
-
// OpenCode
|
|
8343
|
-
"**/.opencode/memories/",
|
|
8344
|
-
"**/.opencode/command/",
|
|
8345
|
-
"**/opencode.json",
|
|
8346
|
-
// Qwen
|
|
8347
|
-
"**/QWEN.md",
|
|
8348
|
-
"**/.qwen/memories/",
|
|
8349
|
-
// Roo
|
|
8350
|
-
"**/.roo/rules/",
|
|
8351
|
-
"**/.rooignore",
|
|
8352
|
-
"**/.roo/mcp.json",
|
|
8353
|
-
"**/.roo/subagents/",
|
|
8354
|
-
// Warp
|
|
8355
|
-
"**/.warp/",
|
|
8356
|
-
"**/WARP.md",
|
|
8357
|
-
// Others
|
|
8358
|
-
"**/modular-mcp.json",
|
|
8359
|
-
"!.rulesync/.aiignore"
|
|
8360
|
-
];
|
|
8811
|
+
const gitignorePath = (0, import_node_path85.join)(process.cwd(), ".gitignore");
|
|
8361
8812
|
let gitignoreContent = "";
|
|
8362
8813
|
if (await fileExists(gitignorePath)) {
|
|
8363
8814
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
8364
8815
|
}
|
|
8365
|
-
const
|
|
8366
|
-
|
|
8367
|
-
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8816
|
+
const cleanedContent = removeExistingRulesyncEntries(gitignoreContent);
|
|
8817
|
+
const rulesyncBlock = [RULESYNC_HEADER, ...RULESYNC_IGNORE_ENTRIES].join("\n");
|
|
8818
|
+
const newContent = cleanedContent.trim() ? `${cleanedContent.trimEnd()}
|
|
8819
|
+
|
|
8820
|
+
${rulesyncBlock}
|
|
8821
|
+
` : `${rulesyncBlock}
|
|
8822
|
+
`;
|
|
8823
|
+
if (gitignoreContent === newContent) {
|
|
8372
8824
|
logger.success(".gitignore is already up to date");
|
|
8373
8825
|
return;
|
|
8374
8826
|
}
|
|
8375
|
-
const newContent = gitignoreContent ? `${gitignoreContent.trimEnd()}
|
|
8376
|
-
|
|
8377
|
-
${linesToAdd.join("\n")}
|
|
8378
|
-
` : `${linesToAdd.join("\n")}
|
|
8379
|
-
`;
|
|
8380
8827
|
await writeFileContent(gitignorePath, newContent);
|
|
8381
|
-
logger.success(
|
|
8382
|
-
for (const
|
|
8383
|
-
|
|
8384
|
-
logger.info(` ${line}`);
|
|
8385
|
-
}
|
|
8828
|
+
logger.success("Updated .gitignore with rulesync entries:");
|
|
8829
|
+
for (const entry of RULESYNC_IGNORE_ENTRIES) {
|
|
8830
|
+
logger.info(` ${entry}`);
|
|
8386
8831
|
}
|
|
8387
8832
|
};
|
|
8388
8833
|
|
|
@@ -8562,7 +9007,7 @@ async function importSkills(config, tool) {
|
|
|
8562
9007
|
}
|
|
8563
9008
|
|
|
8564
9009
|
// src/cli/commands/init.ts
|
|
8565
|
-
var
|
|
9010
|
+
var import_node_path86 = require("path");
|
|
8566
9011
|
async function initCommand() {
|
|
8567
9012
|
logger.info("Initializing rulesync...");
|
|
8568
9013
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -8725,14 +9170,14 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
8725
9170
|
await ensureDir(commandPaths.relativeDirPath);
|
|
8726
9171
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
8727
9172
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
8728
|
-
const ruleFilepath = (0,
|
|
9173
|
+
const ruleFilepath = (0, import_node_path86.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
8729
9174
|
if (!await fileExists(ruleFilepath)) {
|
|
8730
9175
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
8731
9176
|
logger.success(`Created ${ruleFilepath}`);
|
|
8732
9177
|
} else {
|
|
8733
9178
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
8734
9179
|
}
|
|
8735
|
-
const mcpFilepath = (0,
|
|
9180
|
+
const mcpFilepath = (0, import_node_path86.join)(
|
|
8736
9181
|
mcpPaths.recommended.relativeDirPath,
|
|
8737
9182
|
mcpPaths.recommended.relativeFilePath
|
|
8738
9183
|
);
|
|
@@ -8742,21 +9187,21 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
8742
9187
|
} else {
|
|
8743
9188
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
8744
9189
|
}
|
|
8745
|
-
const commandFilepath = (0,
|
|
9190
|
+
const commandFilepath = (0, import_node_path86.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
8746
9191
|
if (!await fileExists(commandFilepath)) {
|
|
8747
9192
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
8748
9193
|
logger.success(`Created ${commandFilepath}`);
|
|
8749
9194
|
} else {
|
|
8750
9195
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
8751
9196
|
}
|
|
8752
|
-
const subagentFilepath = (0,
|
|
9197
|
+
const subagentFilepath = (0, import_node_path86.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
8753
9198
|
if (!await fileExists(subagentFilepath)) {
|
|
8754
9199
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
8755
9200
|
logger.success(`Created ${subagentFilepath}`);
|
|
8756
9201
|
} else {
|
|
8757
9202
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
8758
9203
|
}
|
|
8759
|
-
const ignoreFilepath = (0,
|
|
9204
|
+
const ignoreFilepath = (0, import_node_path86.join)(
|
|
8760
9205
|
ignorePaths.recommended.relativeDirPath,
|
|
8761
9206
|
ignorePaths.recommended.relativeFilePath
|
|
8762
9207
|
);
|
|
@@ -8772,12 +9217,12 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
8772
9217
|
var import_fastmcp = require("fastmcp");
|
|
8773
9218
|
|
|
8774
9219
|
// src/mcp/commands.ts
|
|
8775
|
-
var
|
|
8776
|
-
var
|
|
9220
|
+
var import_node_path87 = require("path");
|
|
9221
|
+
var import_mini34 = require("zod/mini");
|
|
8777
9222
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
8778
9223
|
var maxCommandsCount = 1e3;
|
|
8779
9224
|
async function listCommands() {
|
|
8780
|
-
const commandsDir = (0,
|
|
9225
|
+
const commandsDir = (0, import_node_path87.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
8781
9226
|
try {
|
|
8782
9227
|
const files = await listDirectoryFiles(commandsDir);
|
|
8783
9228
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -8789,7 +9234,7 @@ async function listCommands() {
|
|
|
8789
9234
|
});
|
|
8790
9235
|
const frontmatter = command.getFrontmatter();
|
|
8791
9236
|
return {
|
|
8792
|
-
relativePathFromCwd: (0,
|
|
9237
|
+
relativePathFromCwd: (0, import_node_path87.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
8793
9238
|
frontmatter
|
|
8794
9239
|
};
|
|
8795
9240
|
} catch (error) {
|
|
@@ -8809,13 +9254,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
8809
9254
|
relativePath: relativePathFromCwd,
|
|
8810
9255
|
intendedRootDir: process.cwd()
|
|
8811
9256
|
});
|
|
8812
|
-
const filename = (0,
|
|
9257
|
+
const filename = (0, import_node_path87.basename)(relativePathFromCwd);
|
|
8813
9258
|
try {
|
|
8814
9259
|
const command = await RulesyncCommand.fromFile({
|
|
8815
9260
|
relativeFilePath: filename
|
|
8816
9261
|
});
|
|
8817
9262
|
return {
|
|
8818
|
-
relativePathFromCwd: (0,
|
|
9263
|
+
relativePathFromCwd: (0, import_node_path87.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
8819
9264
|
frontmatter: command.getFrontmatter(),
|
|
8820
9265
|
body: command.getBody()
|
|
8821
9266
|
};
|
|
@@ -8834,7 +9279,7 @@ async function putCommand({
|
|
|
8834
9279
|
relativePath: relativePathFromCwd,
|
|
8835
9280
|
intendedRootDir: process.cwd()
|
|
8836
9281
|
});
|
|
8837
|
-
const filename = (0,
|
|
9282
|
+
const filename = (0, import_node_path87.basename)(relativePathFromCwd);
|
|
8838
9283
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
8839
9284
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
8840
9285
|
throw new Error(
|
|
@@ -8844,7 +9289,7 @@ async function putCommand({
|
|
|
8844
9289
|
try {
|
|
8845
9290
|
const existingCommands = await listCommands();
|
|
8846
9291
|
const isUpdate = existingCommands.some(
|
|
8847
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
9292
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path87.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
8848
9293
|
);
|
|
8849
9294
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
8850
9295
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -8859,11 +9304,11 @@ async function putCommand({
|
|
|
8859
9304
|
fileContent,
|
|
8860
9305
|
validate: true
|
|
8861
9306
|
});
|
|
8862
|
-
const commandsDir = (0,
|
|
9307
|
+
const commandsDir = (0, import_node_path87.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
8863
9308
|
await ensureDir(commandsDir);
|
|
8864
9309
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
8865
9310
|
return {
|
|
8866
|
-
relativePathFromCwd: (0,
|
|
9311
|
+
relativePathFromCwd: (0, import_node_path87.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
8867
9312
|
frontmatter: command.getFrontmatter(),
|
|
8868
9313
|
body: command.getBody()
|
|
8869
9314
|
};
|
|
@@ -8878,12 +9323,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
8878
9323
|
relativePath: relativePathFromCwd,
|
|
8879
9324
|
intendedRootDir: process.cwd()
|
|
8880
9325
|
});
|
|
8881
|
-
const filename = (0,
|
|
8882
|
-
const fullPath = (0,
|
|
9326
|
+
const filename = (0, import_node_path87.basename)(relativePathFromCwd);
|
|
9327
|
+
const fullPath = (0, import_node_path87.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
8883
9328
|
try {
|
|
8884
9329
|
await removeFile(fullPath);
|
|
8885
9330
|
return {
|
|
8886
|
-
relativePathFromCwd: (0,
|
|
9331
|
+
relativePathFromCwd: (0, import_node_path87.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
8887
9332
|
};
|
|
8888
9333
|
} catch (error) {
|
|
8889
9334
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -8892,23 +9337,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
8892
9337
|
}
|
|
8893
9338
|
}
|
|
8894
9339
|
var commandToolSchemas = {
|
|
8895
|
-
listCommands:
|
|
8896
|
-
getCommand:
|
|
8897
|
-
relativePathFromCwd:
|
|
9340
|
+
listCommands: import_mini34.z.object({}),
|
|
9341
|
+
getCommand: import_mini34.z.object({
|
|
9342
|
+
relativePathFromCwd: import_mini34.z.string()
|
|
8898
9343
|
}),
|
|
8899
|
-
putCommand:
|
|
8900
|
-
relativePathFromCwd:
|
|
9344
|
+
putCommand: import_mini34.z.object({
|
|
9345
|
+
relativePathFromCwd: import_mini34.z.string(),
|
|
8901
9346
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
8902
|
-
body:
|
|
9347
|
+
body: import_mini34.z.string()
|
|
8903
9348
|
}),
|
|
8904
|
-
deleteCommand:
|
|
8905
|
-
relativePathFromCwd:
|
|
9349
|
+
deleteCommand: import_mini34.z.object({
|
|
9350
|
+
relativePathFromCwd: import_mini34.z.string()
|
|
8906
9351
|
})
|
|
8907
9352
|
};
|
|
8908
9353
|
var commandTools = {
|
|
8909
9354
|
listCommands: {
|
|
8910
9355
|
name: "listCommands",
|
|
8911
|
-
description: `List all commands from ${(0,
|
|
9356
|
+
description: `List all commands from ${(0, import_node_path87.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
8912
9357
|
parameters: commandToolSchemas.listCommands,
|
|
8913
9358
|
execute: async () => {
|
|
8914
9359
|
const commands = await listCommands();
|
|
@@ -8950,11 +9395,11 @@ var commandTools = {
|
|
|
8950
9395
|
};
|
|
8951
9396
|
|
|
8952
9397
|
// src/mcp/ignore.ts
|
|
8953
|
-
var
|
|
8954
|
-
var
|
|
9398
|
+
var import_node_path88 = require("path");
|
|
9399
|
+
var import_mini35 = require("zod/mini");
|
|
8955
9400
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
8956
9401
|
async function getIgnoreFile() {
|
|
8957
|
-
const ignoreFilePath = (0,
|
|
9402
|
+
const ignoreFilePath = (0, import_node_path88.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
8958
9403
|
try {
|
|
8959
9404
|
const content = await readFileContent(ignoreFilePath);
|
|
8960
9405
|
return {
|
|
@@ -8968,7 +9413,7 @@ async function getIgnoreFile() {
|
|
|
8968
9413
|
}
|
|
8969
9414
|
}
|
|
8970
9415
|
async function putIgnoreFile({ content }) {
|
|
8971
|
-
const ignoreFilePath = (0,
|
|
9416
|
+
const ignoreFilePath = (0, import_node_path88.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
8972
9417
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
8973
9418
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
8974
9419
|
throw new Error(
|
|
@@ -8989,8 +9434,8 @@ async function putIgnoreFile({ content }) {
|
|
|
8989
9434
|
}
|
|
8990
9435
|
}
|
|
8991
9436
|
async function deleteIgnoreFile() {
|
|
8992
|
-
const aiignorePath = (0,
|
|
8993
|
-
const legacyIgnorePath = (0,
|
|
9437
|
+
const aiignorePath = (0, import_node_path88.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
9438
|
+
const legacyIgnorePath = (0, import_node_path88.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
8994
9439
|
try {
|
|
8995
9440
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
8996
9441
|
return {
|
|
@@ -9008,11 +9453,11 @@ async function deleteIgnoreFile() {
|
|
|
9008
9453
|
}
|
|
9009
9454
|
}
|
|
9010
9455
|
var ignoreToolSchemas = {
|
|
9011
|
-
getIgnoreFile:
|
|
9012
|
-
putIgnoreFile:
|
|
9013
|
-
content:
|
|
9456
|
+
getIgnoreFile: import_mini35.z.object({}),
|
|
9457
|
+
putIgnoreFile: import_mini35.z.object({
|
|
9458
|
+
content: import_mini35.z.string()
|
|
9014
9459
|
}),
|
|
9015
|
-
deleteIgnoreFile:
|
|
9460
|
+
deleteIgnoreFile: import_mini35.z.object({})
|
|
9016
9461
|
};
|
|
9017
9462
|
var ignoreTools = {
|
|
9018
9463
|
getIgnoreFile: {
|
|
@@ -9045,8 +9490,8 @@ var ignoreTools = {
|
|
|
9045
9490
|
};
|
|
9046
9491
|
|
|
9047
9492
|
// src/mcp/mcp.ts
|
|
9048
|
-
var
|
|
9049
|
-
var
|
|
9493
|
+
var import_node_path89 = require("path");
|
|
9494
|
+
var import_mini36 = require("zod/mini");
|
|
9050
9495
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
9051
9496
|
async function getMcpFile() {
|
|
9052
9497
|
const config = await ConfigResolver.resolve({});
|
|
@@ -9055,7 +9500,7 @@ async function getMcpFile() {
|
|
|
9055
9500
|
validate: true,
|
|
9056
9501
|
modularMcp: config.getModularMcp()
|
|
9057
9502
|
});
|
|
9058
|
-
const relativePathFromCwd = (0,
|
|
9503
|
+
const relativePathFromCwd = (0, import_node_path89.join)(
|
|
9059
9504
|
rulesyncMcp.getRelativeDirPath(),
|
|
9060
9505
|
rulesyncMcp.getRelativeFilePath()
|
|
9061
9506
|
);
|
|
@@ -9088,7 +9533,7 @@ async function putMcpFile({ content }) {
|
|
|
9088
9533
|
const paths = RulesyncMcp.getSettablePaths();
|
|
9089
9534
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
9090
9535
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
9091
|
-
const fullPath = (0,
|
|
9536
|
+
const fullPath = (0, import_node_path89.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
9092
9537
|
const rulesyncMcp = new RulesyncMcp({
|
|
9093
9538
|
baseDir,
|
|
9094
9539
|
relativeDirPath,
|
|
@@ -9097,9 +9542,9 @@ async function putMcpFile({ content }) {
|
|
|
9097
9542
|
validate: true,
|
|
9098
9543
|
modularMcp: config.getModularMcp()
|
|
9099
9544
|
});
|
|
9100
|
-
await ensureDir((0,
|
|
9545
|
+
await ensureDir((0, import_node_path89.join)(baseDir, relativeDirPath));
|
|
9101
9546
|
await writeFileContent(fullPath, content);
|
|
9102
|
-
const relativePathFromCwd = (0,
|
|
9547
|
+
const relativePathFromCwd = (0, import_node_path89.join)(relativeDirPath, relativeFilePath);
|
|
9103
9548
|
return {
|
|
9104
9549
|
relativePathFromCwd,
|
|
9105
9550
|
content: rulesyncMcp.getFileContent()
|
|
@@ -9114,15 +9559,15 @@ async function deleteMcpFile() {
|
|
|
9114
9559
|
try {
|
|
9115
9560
|
const baseDir = process.cwd();
|
|
9116
9561
|
const paths = RulesyncMcp.getSettablePaths();
|
|
9117
|
-
const recommendedPath = (0,
|
|
9562
|
+
const recommendedPath = (0, import_node_path89.join)(
|
|
9118
9563
|
baseDir,
|
|
9119
9564
|
paths.recommended.relativeDirPath,
|
|
9120
9565
|
paths.recommended.relativeFilePath
|
|
9121
9566
|
);
|
|
9122
|
-
const legacyPath = (0,
|
|
9567
|
+
const legacyPath = (0, import_node_path89.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
9123
9568
|
await removeFile(recommendedPath);
|
|
9124
9569
|
await removeFile(legacyPath);
|
|
9125
|
-
const relativePathFromCwd = (0,
|
|
9570
|
+
const relativePathFromCwd = (0, import_node_path89.join)(
|
|
9126
9571
|
paths.recommended.relativeDirPath,
|
|
9127
9572
|
paths.recommended.relativeFilePath
|
|
9128
9573
|
);
|
|
@@ -9136,11 +9581,11 @@ async function deleteMcpFile() {
|
|
|
9136
9581
|
}
|
|
9137
9582
|
}
|
|
9138
9583
|
var mcpToolSchemas = {
|
|
9139
|
-
getMcpFile:
|
|
9140
|
-
putMcpFile:
|
|
9141
|
-
content:
|
|
9584
|
+
getMcpFile: import_mini36.z.object({}),
|
|
9585
|
+
putMcpFile: import_mini36.z.object({
|
|
9586
|
+
content: import_mini36.z.string()
|
|
9142
9587
|
}),
|
|
9143
|
-
deleteMcpFile:
|
|
9588
|
+
deleteMcpFile: import_mini36.z.object({})
|
|
9144
9589
|
};
|
|
9145
9590
|
var mcpTools = {
|
|
9146
9591
|
getMcpFile: {
|
|
@@ -9173,12 +9618,12 @@ var mcpTools = {
|
|
|
9173
9618
|
};
|
|
9174
9619
|
|
|
9175
9620
|
// src/mcp/rules.ts
|
|
9176
|
-
var
|
|
9177
|
-
var
|
|
9621
|
+
var import_node_path90 = require("path");
|
|
9622
|
+
var import_mini37 = require("zod/mini");
|
|
9178
9623
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
9179
9624
|
var maxRulesCount = 1e3;
|
|
9180
9625
|
async function listRules() {
|
|
9181
|
-
const rulesDir = (0,
|
|
9626
|
+
const rulesDir = (0, import_node_path90.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
9182
9627
|
try {
|
|
9183
9628
|
const files = await listDirectoryFiles(rulesDir);
|
|
9184
9629
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -9191,7 +9636,7 @@ async function listRules() {
|
|
|
9191
9636
|
});
|
|
9192
9637
|
const frontmatter = rule.getFrontmatter();
|
|
9193
9638
|
return {
|
|
9194
|
-
relativePathFromCwd: (0,
|
|
9639
|
+
relativePathFromCwd: (0, import_node_path90.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
9195
9640
|
frontmatter
|
|
9196
9641
|
};
|
|
9197
9642
|
} catch (error) {
|
|
@@ -9211,14 +9656,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
9211
9656
|
relativePath: relativePathFromCwd,
|
|
9212
9657
|
intendedRootDir: process.cwd()
|
|
9213
9658
|
});
|
|
9214
|
-
const filename = (0,
|
|
9659
|
+
const filename = (0, import_node_path90.basename)(relativePathFromCwd);
|
|
9215
9660
|
try {
|
|
9216
9661
|
const rule = await RulesyncRule.fromFile({
|
|
9217
9662
|
relativeFilePath: filename,
|
|
9218
9663
|
validate: true
|
|
9219
9664
|
});
|
|
9220
9665
|
return {
|
|
9221
|
-
relativePathFromCwd: (0,
|
|
9666
|
+
relativePathFromCwd: (0, import_node_path90.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
9222
9667
|
frontmatter: rule.getFrontmatter(),
|
|
9223
9668
|
body: rule.getBody()
|
|
9224
9669
|
};
|
|
@@ -9237,7 +9682,7 @@ async function putRule({
|
|
|
9237
9682
|
relativePath: relativePathFromCwd,
|
|
9238
9683
|
intendedRootDir: process.cwd()
|
|
9239
9684
|
});
|
|
9240
|
-
const filename = (0,
|
|
9685
|
+
const filename = (0, import_node_path90.basename)(relativePathFromCwd);
|
|
9241
9686
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
9242
9687
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
9243
9688
|
throw new Error(
|
|
@@ -9247,7 +9692,7 @@ async function putRule({
|
|
|
9247
9692
|
try {
|
|
9248
9693
|
const existingRules = await listRules();
|
|
9249
9694
|
const isUpdate = existingRules.some(
|
|
9250
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
9695
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path90.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
9251
9696
|
);
|
|
9252
9697
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
9253
9698
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -9260,11 +9705,11 @@ async function putRule({
|
|
|
9260
9705
|
body,
|
|
9261
9706
|
validate: true
|
|
9262
9707
|
});
|
|
9263
|
-
const rulesDir = (0,
|
|
9708
|
+
const rulesDir = (0, import_node_path90.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
9264
9709
|
await ensureDir(rulesDir);
|
|
9265
9710
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
9266
9711
|
return {
|
|
9267
|
-
relativePathFromCwd: (0,
|
|
9712
|
+
relativePathFromCwd: (0, import_node_path90.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
9268
9713
|
frontmatter: rule.getFrontmatter(),
|
|
9269
9714
|
body: rule.getBody()
|
|
9270
9715
|
};
|
|
@@ -9279,12 +9724,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
9279
9724
|
relativePath: relativePathFromCwd,
|
|
9280
9725
|
intendedRootDir: process.cwd()
|
|
9281
9726
|
});
|
|
9282
|
-
const filename = (0,
|
|
9283
|
-
const fullPath = (0,
|
|
9727
|
+
const filename = (0, import_node_path90.basename)(relativePathFromCwd);
|
|
9728
|
+
const fullPath = (0, import_node_path90.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
9284
9729
|
try {
|
|
9285
9730
|
await removeFile(fullPath);
|
|
9286
9731
|
return {
|
|
9287
|
-
relativePathFromCwd: (0,
|
|
9732
|
+
relativePathFromCwd: (0, import_node_path90.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
9288
9733
|
};
|
|
9289
9734
|
} catch (error) {
|
|
9290
9735
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -9293,23 +9738,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
9293
9738
|
}
|
|
9294
9739
|
}
|
|
9295
9740
|
var ruleToolSchemas = {
|
|
9296
|
-
listRules:
|
|
9297
|
-
getRule:
|
|
9298
|
-
relativePathFromCwd:
|
|
9741
|
+
listRules: import_mini37.z.object({}),
|
|
9742
|
+
getRule: import_mini37.z.object({
|
|
9743
|
+
relativePathFromCwd: import_mini37.z.string()
|
|
9299
9744
|
}),
|
|
9300
|
-
putRule:
|
|
9301
|
-
relativePathFromCwd:
|
|
9745
|
+
putRule: import_mini37.z.object({
|
|
9746
|
+
relativePathFromCwd: import_mini37.z.string(),
|
|
9302
9747
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
9303
|
-
body:
|
|
9748
|
+
body: import_mini37.z.string()
|
|
9304
9749
|
}),
|
|
9305
|
-
deleteRule:
|
|
9306
|
-
relativePathFromCwd:
|
|
9750
|
+
deleteRule: import_mini37.z.object({
|
|
9751
|
+
relativePathFromCwd: import_mini37.z.string()
|
|
9307
9752
|
})
|
|
9308
9753
|
};
|
|
9309
9754
|
var ruleTools = {
|
|
9310
9755
|
listRules: {
|
|
9311
9756
|
name: "listRules",
|
|
9312
|
-
description: `List all rules from ${(0,
|
|
9757
|
+
description: `List all rules from ${(0, import_node_path90.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
9313
9758
|
parameters: ruleToolSchemas.listRules,
|
|
9314
9759
|
execute: async () => {
|
|
9315
9760
|
const rules = await listRules();
|
|
@@ -9351,8 +9796,8 @@ var ruleTools = {
|
|
|
9351
9796
|
};
|
|
9352
9797
|
|
|
9353
9798
|
// src/mcp/skills.ts
|
|
9354
|
-
var
|
|
9355
|
-
var
|
|
9799
|
+
var import_node_path91 = require("path");
|
|
9800
|
+
var import_mini38 = require("zod/mini");
|
|
9356
9801
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
9357
9802
|
var maxSkillsCount = 1e3;
|
|
9358
9803
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -9368,19 +9813,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
9368
9813
|
};
|
|
9369
9814
|
}
|
|
9370
9815
|
function extractDirName(relativeDirPathFromCwd) {
|
|
9371
|
-
const dirName = (0,
|
|
9816
|
+
const dirName = (0, import_node_path91.basename)(relativeDirPathFromCwd);
|
|
9372
9817
|
if (!dirName) {
|
|
9373
9818
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
9374
9819
|
}
|
|
9375
9820
|
return dirName;
|
|
9376
9821
|
}
|
|
9377
9822
|
async function listSkills() {
|
|
9378
|
-
const skillsDir = (0,
|
|
9823
|
+
const skillsDir = (0, import_node_path91.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
9379
9824
|
try {
|
|
9380
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
9825
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path91.join)(skillsDir, "*"), { type: "dir" });
|
|
9381
9826
|
const skills = await Promise.all(
|
|
9382
9827
|
skillDirPaths.map(async (dirPath) => {
|
|
9383
|
-
const dirName = (0,
|
|
9828
|
+
const dirName = (0, import_node_path91.basename)(dirPath);
|
|
9384
9829
|
if (!dirName) return null;
|
|
9385
9830
|
try {
|
|
9386
9831
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -9388,7 +9833,7 @@ async function listSkills() {
|
|
|
9388
9833
|
});
|
|
9389
9834
|
const frontmatter = skill.getFrontmatter();
|
|
9390
9835
|
return {
|
|
9391
|
-
relativeDirPathFromCwd: (0,
|
|
9836
|
+
relativeDirPathFromCwd: (0, import_node_path91.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
9392
9837
|
frontmatter
|
|
9393
9838
|
};
|
|
9394
9839
|
} catch (error) {
|
|
@@ -9414,7 +9859,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
9414
9859
|
dirName
|
|
9415
9860
|
});
|
|
9416
9861
|
return {
|
|
9417
|
-
relativeDirPathFromCwd: (0,
|
|
9862
|
+
relativeDirPathFromCwd: (0, import_node_path91.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
9418
9863
|
frontmatter: skill.getFrontmatter(),
|
|
9419
9864
|
body: skill.getBody(),
|
|
9420
9865
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -9448,7 +9893,7 @@ async function putSkill({
|
|
|
9448
9893
|
try {
|
|
9449
9894
|
const existingSkills = await listSkills();
|
|
9450
9895
|
const isUpdate = existingSkills.some(
|
|
9451
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
9896
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path91.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
9452
9897
|
);
|
|
9453
9898
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
9454
9899
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -9463,9 +9908,9 @@ async function putSkill({
|
|
|
9463
9908
|
otherFiles: aiDirFiles,
|
|
9464
9909
|
validate: true
|
|
9465
9910
|
});
|
|
9466
|
-
const skillDirPath = (0,
|
|
9911
|
+
const skillDirPath = (0, import_node_path91.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
9467
9912
|
await ensureDir(skillDirPath);
|
|
9468
|
-
const skillFilePath = (0,
|
|
9913
|
+
const skillFilePath = (0, import_node_path91.join)(skillDirPath, SKILL_FILE_NAME);
|
|
9469
9914
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
9470
9915
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
9471
9916
|
for (const file of otherFiles) {
|
|
@@ -9473,15 +9918,15 @@ async function putSkill({
|
|
|
9473
9918
|
relativePath: file.name,
|
|
9474
9919
|
intendedRootDir: skillDirPath
|
|
9475
9920
|
});
|
|
9476
|
-
const filePath = (0,
|
|
9477
|
-
const fileDir = (0,
|
|
9921
|
+
const filePath = (0, import_node_path91.join)(skillDirPath, file.name);
|
|
9922
|
+
const fileDir = (0, import_node_path91.join)(skillDirPath, (0, import_node_path91.dirname)(file.name));
|
|
9478
9923
|
if (fileDir !== skillDirPath) {
|
|
9479
9924
|
await ensureDir(fileDir);
|
|
9480
9925
|
}
|
|
9481
9926
|
await writeFileContent(filePath, file.body);
|
|
9482
9927
|
}
|
|
9483
9928
|
return {
|
|
9484
|
-
relativeDirPathFromCwd: (0,
|
|
9929
|
+
relativeDirPathFromCwd: (0, import_node_path91.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
9485
9930
|
frontmatter: skill.getFrontmatter(),
|
|
9486
9931
|
body: skill.getBody(),
|
|
9487
9932
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -9503,13 +9948,13 @@ async function deleteSkill({
|
|
|
9503
9948
|
intendedRootDir: process.cwd()
|
|
9504
9949
|
});
|
|
9505
9950
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
9506
|
-
const skillDirPath = (0,
|
|
9951
|
+
const skillDirPath = (0, import_node_path91.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
9507
9952
|
try {
|
|
9508
9953
|
if (await directoryExists(skillDirPath)) {
|
|
9509
9954
|
await removeDirectory(skillDirPath);
|
|
9510
9955
|
}
|
|
9511
9956
|
return {
|
|
9512
|
-
relativeDirPathFromCwd: (0,
|
|
9957
|
+
relativeDirPathFromCwd: (0, import_node_path91.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
9513
9958
|
};
|
|
9514
9959
|
} catch (error) {
|
|
9515
9960
|
throw new Error(
|
|
@@ -9520,29 +9965,29 @@ async function deleteSkill({
|
|
|
9520
9965
|
);
|
|
9521
9966
|
}
|
|
9522
9967
|
}
|
|
9523
|
-
var McpSkillFileSchema =
|
|
9524
|
-
name:
|
|
9525
|
-
body:
|
|
9968
|
+
var McpSkillFileSchema = import_mini38.z.object({
|
|
9969
|
+
name: import_mini38.z.string(),
|
|
9970
|
+
body: import_mini38.z.string()
|
|
9526
9971
|
});
|
|
9527
9972
|
var skillToolSchemas = {
|
|
9528
|
-
listSkills:
|
|
9529
|
-
getSkill:
|
|
9530
|
-
relativeDirPathFromCwd:
|
|
9973
|
+
listSkills: import_mini38.z.object({}),
|
|
9974
|
+
getSkill: import_mini38.z.object({
|
|
9975
|
+
relativeDirPathFromCwd: import_mini38.z.string()
|
|
9531
9976
|
}),
|
|
9532
|
-
putSkill:
|
|
9533
|
-
relativeDirPathFromCwd:
|
|
9977
|
+
putSkill: import_mini38.z.object({
|
|
9978
|
+
relativeDirPathFromCwd: import_mini38.z.string(),
|
|
9534
9979
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
9535
|
-
body:
|
|
9536
|
-
otherFiles:
|
|
9980
|
+
body: import_mini38.z.string(),
|
|
9981
|
+
otherFiles: import_mini38.z.optional(import_mini38.z.array(McpSkillFileSchema))
|
|
9537
9982
|
}),
|
|
9538
|
-
deleteSkill:
|
|
9539
|
-
relativeDirPathFromCwd:
|
|
9983
|
+
deleteSkill: import_mini38.z.object({
|
|
9984
|
+
relativeDirPathFromCwd: import_mini38.z.string()
|
|
9540
9985
|
})
|
|
9541
9986
|
};
|
|
9542
9987
|
var skillTools = {
|
|
9543
9988
|
listSkills: {
|
|
9544
9989
|
name: "listSkills",
|
|
9545
|
-
description: `List all skills from ${(0,
|
|
9990
|
+
description: `List all skills from ${(0, import_node_path91.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
9546
9991
|
parameters: skillToolSchemas.listSkills,
|
|
9547
9992
|
execute: async () => {
|
|
9548
9993
|
const skills = await listSkills();
|
|
@@ -9585,12 +10030,12 @@ var skillTools = {
|
|
|
9585
10030
|
};
|
|
9586
10031
|
|
|
9587
10032
|
// src/mcp/subagents.ts
|
|
9588
|
-
var
|
|
9589
|
-
var
|
|
10033
|
+
var import_node_path92 = require("path");
|
|
10034
|
+
var import_mini39 = require("zod/mini");
|
|
9590
10035
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
9591
10036
|
var maxSubagentsCount = 1e3;
|
|
9592
10037
|
async function listSubagents() {
|
|
9593
|
-
const subagentsDir = (0,
|
|
10038
|
+
const subagentsDir = (0, import_node_path92.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
9594
10039
|
try {
|
|
9595
10040
|
const files = await listDirectoryFiles(subagentsDir);
|
|
9596
10041
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -9603,7 +10048,7 @@ async function listSubagents() {
|
|
|
9603
10048
|
});
|
|
9604
10049
|
const frontmatter = subagent.getFrontmatter();
|
|
9605
10050
|
return {
|
|
9606
|
-
relativePathFromCwd: (0,
|
|
10051
|
+
relativePathFromCwd: (0, import_node_path92.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
9607
10052
|
frontmatter
|
|
9608
10053
|
};
|
|
9609
10054
|
} catch (error) {
|
|
@@ -9625,14 +10070,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
9625
10070
|
relativePath: relativePathFromCwd,
|
|
9626
10071
|
intendedRootDir: process.cwd()
|
|
9627
10072
|
});
|
|
9628
|
-
const filename = (0,
|
|
10073
|
+
const filename = (0, import_node_path92.basename)(relativePathFromCwd);
|
|
9629
10074
|
try {
|
|
9630
10075
|
const subagent = await RulesyncSubagent.fromFile({
|
|
9631
10076
|
relativeFilePath: filename,
|
|
9632
10077
|
validate: true
|
|
9633
10078
|
});
|
|
9634
10079
|
return {
|
|
9635
|
-
relativePathFromCwd: (0,
|
|
10080
|
+
relativePathFromCwd: (0, import_node_path92.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
9636
10081
|
frontmatter: subagent.getFrontmatter(),
|
|
9637
10082
|
body: subagent.getBody()
|
|
9638
10083
|
};
|
|
@@ -9651,7 +10096,7 @@ async function putSubagent({
|
|
|
9651
10096
|
relativePath: relativePathFromCwd,
|
|
9652
10097
|
intendedRootDir: process.cwd()
|
|
9653
10098
|
});
|
|
9654
|
-
const filename = (0,
|
|
10099
|
+
const filename = (0, import_node_path92.basename)(relativePathFromCwd);
|
|
9655
10100
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
9656
10101
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
9657
10102
|
throw new Error(
|
|
@@ -9661,7 +10106,7 @@ async function putSubagent({
|
|
|
9661
10106
|
try {
|
|
9662
10107
|
const existingSubagents = await listSubagents();
|
|
9663
10108
|
const isUpdate = existingSubagents.some(
|
|
9664
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
10109
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path92.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
9665
10110
|
);
|
|
9666
10111
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
9667
10112
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -9674,11 +10119,11 @@ async function putSubagent({
|
|
|
9674
10119
|
body,
|
|
9675
10120
|
validate: true
|
|
9676
10121
|
});
|
|
9677
|
-
const subagentsDir = (0,
|
|
10122
|
+
const subagentsDir = (0, import_node_path92.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
9678
10123
|
await ensureDir(subagentsDir);
|
|
9679
10124
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
9680
10125
|
return {
|
|
9681
|
-
relativePathFromCwd: (0,
|
|
10126
|
+
relativePathFromCwd: (0, import_node_path92.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
9682
10127
|
frontmatter: subagent.getFrontmatter(),
|
|
9683
10128
|
body: subagent.getBody()
|
|
9684
10129
|
};
|
|
@@ -9693,12 +10138,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
9693
10138
|
relativePath: relativePathFromCwd,
|
|
9694
10139
|
intendedRootDir: process.cwd()
|
|
9695
10140
|
});
|
|
9696
|
-
const filename = (0,
|
|
9697
|
-
const fullPath = (0,
|
|
10141
|
+
const filename = (0, import_node_path92.basename)(relativePathFromCwd);
|
|
10142
|
+
const fullPath = (0, import_node_path92.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
9698
10143
|
try {
|
|
9699
10144
|
await removeFile(fullPath);
|
|
9700
10145
|
return {
|
|
9701
|
-
relativePathFromCwd: (0,
|
|
10146
|
+
relativePathFromCwd: (0, import_node_path92.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
9702
10147
|
};
|
|
9703
10148
|
} catch (error) {
|
|
9704
10149
|
throw new Error(
|
|
@@ -9710,23 +10155,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
9710
10155
|
}
|
|
9711
10156
|
}
|
|
9712
10157
|
var subagentToolSchemas = {
|
|
9713
|
-
listSubagents:
|
|
9714
|
-
getSubagent:
|
|
9715
|
-
relativePathFromCwd:
|
|
10158
|
+
listSubagents: import_mini39.z.object({}),
|
|
10159
|
+
getSubagent: import_mini39.z.object({
|
|
10160
|
+
relativePathFromCwd: import_mini39.z.string()
|
|
9716
10161
|
}),
|
|
9717
|
-
putSubagent:
|
|
9718
|
-
relativePathFromCwd:
|
|
10162
|
+
putSubagent: import_mini39.z.object({
|
|
10163
|
+
relativePathFromCwd: import_mini39.z.string(),
|
|
9719
10164
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
9720
|
-
body:
|
|
10165
|
+
body: import_mini39.z.string()
|
|
9721
10166
|
}),
|
|
9722
|
-
deleteSubagent:
|
|
9723
|
-
relativePathFromCwd:
|
|
10167
|
+
deleteSubagent: import_mini39.z.object({
|
|
10168
|
+
relativePathFromCwd: import_mini39.z.string()
|
|
9724
10169
|
})
|
|
9725
10170
|
};
|
|
9726
10171
|
var subagentTools = {
|
|
9727
10172
|
listSubagents: {
|
|
9728
10173
|
name: "listSubagents",
|
|
9729
|
-
description: `List all subagents from ${(0,
|
|
10174
|
+
description: `List all subagents from ${(0, import_node_path92.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
9730
10175
|
parameters: subagentToolSchemas.listSubagents,
|
|
9731
10176
|
execute: async () => {
|
|
9732
10177
|
const subagents = await listSubagents();
|
|
@@ -9804,7 +10249,7 @@ async function mcpCommand({ version }) {
|
|
|
9804
10249
|
}
|
|
9805
10250
|
|
|
9806
10251
|
// src/cli/index.ts
|
|
9807
|
-
var getVersion = () => "3.
|
|
10252
|
+
var getVersion = () => "3.32.0";
|
|
9808
10253
|
var main = async () => {
|
|
9809
10254
|
const program = new import_commander.Command();
|
|
9810
10255
|
const version = getVersion();
|