rulesync 7.7.0 → 7.8.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/dist/{chunk-KDYNNWMK.js → chunk-PEMFIVEG.js} +65 -40
- package/dist/cli/index.cjs +66 -41
- package/dist/cli/index.js +2 -2
- package/dist/index.cjs +65 -40
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -722,8 +722,22 @@ function stringifyFrontmatter(body, frontmatter) {
|
|
|
722
722
|
const cleanFrontmatter = deepRemoveNullishObject(frontmatter);
|
|
723
723
|
return matter.stringify(body, cleanFrontmatter);
|
|
724
724
|
}
|
|
725
|
-
function parseFrontmatter(content) {
|
|
726
|
-
|
|
725
|
+
function parseFrontmatter(content, filePath) {
|
|
726
|
+
let frontmatter;
|
|
727
|
+
let body;
|
|
728
|
+
try {
|
|
729
|
+
const result = matter(content);
|
|
730
|
+
frontmatter = result.data;
|
|
731
|
+
body = result.content;
|
|
732
|
+
} catch (error) {
|
|
733
|
+
if (filePath) {
|
|
734
|
+
throw new Error(
|
|
735
|
+
`Failed to parse frontmatter in ${filePath}: ${error instanceof Error ? error.message : String(error)}`,
|
|
736
|
+
{ cause: error }
|
|
737
|
+
);
|
|
738
|
+
}
|
|
739
|
+
throw error;
|
|
740
|
+
}
|
|
727
741
|
const cleanFrontmatter = deepRemoveNullishObject(frontmatter);
|
|
728
742
|
return { frontmatter: cleanFrontmatter, body };
|
|
729
743
|
}
|
|
@@ -969,7 +983,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
969
983
|
relativeFilePath
|
|
970
984
|
);
|
|
971
985
|
const fileContent = await readFileContent(filePath);
|
|
972
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
986
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
973
987
|
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
974
988
|
if (!result.success) {
|
|
975
989
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -1026,7 +1040,7 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
1026
1040
|
relativeFilePath
|
|
1027
1041
|
);
|
|
1028
1042
|
const fileContent = await readFileContent(filePath);
|
|
1029
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1043
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1030
1044
|
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1031
1045
|
if (!result.success) {
|
|
1032
1046
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -1146,7 +1160,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
1146
1160
|
relativeFilePath
|
|
1147
1161
|
);
|
|
1148
1162
|
const fileContent = await readFileContent(filePath);
|
|
1149
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1163
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1150
1164
|
const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1151
1165
|
if (!result.success) {
|
|
1152
1166
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
@@ -1305,7 +1319,7 @@ ${body}${turboDirective}`;
|
|
|
1305
1319
|
relativeFilePath
|
|
1306
1320
|
);
|
|
1307
1321
|
const fileContent = await readFileContent(filePath);
|
|
1308
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1322
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1309
1323
|
const result = AntigravityCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1310
1324
|
if (!result.success) {
|
|
1311
1325
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -1451,7 +1465,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1451
1465
|
const paths = this.getSettablePaths({ global });
|
|
1452
1466
|
const filePath = join8(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1453
1467
|
const fileContent = await readFileContent(filePath);
|
|
1454
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1468
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1455
1469
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1456
1470
|
if (!result.success) {
|
|
1457
1471
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -1545,7 +1559,7 @@ var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
|
1545
1559
|
const paths = this.getSettablePaths({ global });
|
|
1546
1560
|
const filePath = join9(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1547
1561
|
const fileContent = await readFileContent(filePath);
|
|
1548
|
-
const { body: content } = parseFrontmatter(fileContent);
|
|
1562
|
+
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
1549
1563
|
return new _ClineCommand({
|
|
1550
1564
|
baseDir,
|
|
1551
1565
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -1632,7 +1646,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1632
1646
|
const paths = this.getSettablePaths({ global });
|
|
1633
1647
|
const filePath = join10(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1634
1648
|
const fileContent = await readFileContent(filePath);
|
|
1635
|
-
const { body: content } = parseFrontmatter(fileContent);
|
|
1649
|
+
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
1636
1650
|
return new _CodexcliCommand({
|
|
1637
1651
|
baseDir,
|
|
1638
1652
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -1761,7 +1775,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1761
1775
|
const paths = this.getSettablePaths();
|
|
1762
1776
|
const filePath = join11(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1763
1777
|
const fileContent = await readFileContent(filePath);
|
|
1764
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1778
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1765
1779
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1766
1780
|
if (!result.success) {
|
|
1767
1781
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -1917,7 +1931,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1917
1931
|
const paths = this.getSettablePaths({ global });
|
|
1918
1932
|
const filePath = join12(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1919
1933
|
const fileContent = await readFileContent(filePath);
|
|
1920
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1934
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1921
1935
|
const result = CursorCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1922
1936
|
if (!result.success) {
|
|
1923
1937
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -1974,7 +1988,7 @@ var FactorydroidCommand = class _FactorydroidCommand extends SimulatedCommand {
|
|
|
1974
1988
|
const paths = _FactorydroidCommand.getSettablePaths({ global });
|
|
1975
1989
|
const filePath = join13(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1976
1990
|
const fileContent = await readFileContent(filePath);
|
|
1977
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1991
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1978
1992
|
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1979
1993
|
if (!result.success) {
|
|
1980
1994
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -2207,7 +2221,7 @@ var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
|
2207
2221
|
const paths = this.getSettablePaths();
|
|
2208
2222
|
const filePath = join15(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2209
2223
|
const fileContent = await readFileContent(filePath);
|
|
2210
|
-
const { body: content } = parseFrontmatter(fileContent);
|
|
2224
|
+
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
2211
2225
|
return new _KiloCommand({
|
|
2212
2226
|
baseDir,
|
|
2213
2227
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -2288,7 +2302,7 @@ var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
|
2288
2302
|
const paths = this.getSettablePaths();
|
|
2289
2303
|
const filePath = join16(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2290
2304
|
const fileContent = await readFileContent(filePath);
|
|
2291
|
-
const { body: content } = parseFrontmatter(fileContent);
|
|
2305
|
+
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
2292
2306
|
return new _KiroCommand({
|
|
2293
2307
|
baseDir,
|
|
2294
2308
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -2416,7 +2430,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2416
2430
|
const paths = this.getSettablePaths({ global });
|
|
2417
2431
|
const filePath = join17(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2418
2432
|
const fileContent = await readFileContent(filePath);
|
|
2419
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2433
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
2420
2434
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2421
2435
|
if (!result.success) {
|
|
2422
2436
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -2561,7 +2575,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2561
2575
|
}) {
|
|
2562
2576
|
const filePath = join18(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
2563
2577
|
const fileContent = await readFileContent(filePath);
|
|
2564
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2578
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
2565
2579
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2566
2580
|
if (!result.success) {
|
|
2567
2581
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -7138,7 +7152,7 @@ var ToolSkill = class extends AiDir {
|
|
|
7138
7152
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
7139
7153
|
}
|
|
7140
7154
|
const fileContent = await readFileContent(skillFilePath);
|
|
7141
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7155
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, skillFilePath);
|
|
7142
7156
|
const otherFiles = await this.collectOtherFiles(
|
|
7143
7157
|
baseDir,
|
|
7144
7158
|
actualRelativeDirPath,
|
|
@@ -7261,7 +7275,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
7261
7275
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
7262
7276
|
}
|
|
7263
7277
|
const fileContent = await readFileContent(skillFilePath);
|
|
7264
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7278
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, skillFilePath);
|
|
7265
7279
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
7266
7280
|
if (!result.success) {
|
|
7267
7281
|
throw new Error(`Invalid frontmatter in ${skillFilePath}: ${formatError(result.error)}`);
|
|
@@ -7612,7 +7626,7 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
7612
7626
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
7613
7627
|
}
|
|
7614
7628
|
const fileContent = await readFileContent(skillFilePath);
|
|
7615
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7629
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, skillFilePath);
|
|
7616
7630
|
const result = RulesyncSkillFrontmatterSchema.safeParse(frontmatter);
|
|
7617
7631
|
if (!result.success) {
|
|
7618
7632
|
throw new Error(`Invalid frontmatter in ${skillFilePath}: ${formatError(result.error)}`);
|
|
@@ -10256,7 +10270,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10256
10270
|
}) {
|
|
10257
10271
|
const filePath = join74(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
10258
10272
|
const fileContent = await readFileContent(filePath);
|
|
10259
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10273
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10260
10274
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10261
10275
|
if (!result.success) {
|
|
10262
10276
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -10457,10 +10471,9 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10457
10471
|
static async fromFile({
|
|
10458
10472
|
relativeFilePath
|
|
10459
10473
|
}) {
|
|
10460
|
-
const
|
|
10461
|
-
|
|
10462
|
-
);
|
|
10463
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10474
|
+
const filePath = join79(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
10475
|
+
const fileContent = await readFileContent(filePath);
|
|
10476
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10464
10477
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10465
10478
|
if (!result.success) {
|
|
10466
10479
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
@@ -10601,7 +10614,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10601
10614
|
const paths = this.getSettablePaths({ global });
|
|
10602
10615
|
const filePath = join80(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10603
10616
|
const fileContent = await readFileContent(filePath);
|
|
10604
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10617
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10605
10618
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10606
10619
|
if (!result.success) {
|
|
10607
10620
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -10929,7 +10942,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
10929
10942
|
const paths = this.getSettablePaths({ global });
|
|
10930
10943
|
const filePath = join82(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10931
10944
|
const fileContent = await readFileContent(filePath);
|
|
10932
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10945
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10933
10946
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10934
10947
|
if (!result.success) {
|
|
10935
10948
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -11076,7 +11089,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11076
11089
|
const paths = this.getSettablePaths({ global });
|
|
11077
11090
|
const filePath = join83(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11078
11091
|
const fileContent = await readFileContent(filePath);
|
|
11079
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
11092
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11080
11093
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11081
11094
|
if (!result.success) {
|
|
11082
11095
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -11394,7 +11407,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11394
11407
|
const paths = this.getSettablePaths({ global });
|
|
11395
11408
|
const filePath = join85(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11396
11409
|
const fileContent = await readFileContent(filePath);
|
|
11397
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
11410
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11398
11411
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11399
11412
|
if (!result.success) {
|
|
11400
11413
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -11816,7 +11829,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
11816
11829
|
relativeFilePath
|
|
11817
11830
|
);
|
|
11818
11831
|
const fileContent = await readFileContent(filePath);
|
|
11819
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
11832
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11820
11833
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
11821
11834
|
if (!result.success) {
|
|
11822
11835
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -12246,7 +12259,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
12246
12259
|
relativeFilePath
|
|
12247
12260
|
);
|
|
12248
12261
|
const fileContent = await readFileContent(filePath);
|
|
12249
|
-
const { frontmatter, body } = parseFrontmatter(fileContent);
|
|
12262
|
+
const { frontmatter, body } = parseFrontmatter(fileContent, filePath);
|
|
12250
12263
|
let parsedFrontmatter;
|
|
12251
12264
|
if (validate) {
|
|
12252
12265
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12503,10 +12516,13 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
12503
12516
|
relativeFilePath,
|
|
12504
12517
|
validate = true
|
|
12505
12518
|
}) {
|
|
12506
|
-
const
|
|
12507
|
-
|
|
12519
|
+
const filePath = join92(
|
|
12520
|
+
baseDir,
|
|
12521
|
+
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
12522
|
+
relativeFilePath
|
|
12508
12523
|
);
|
|
12509
|
-
const
|
|
12524
|
+
const fileContent = await readFileContent(filePath);
|
|
12525
|
+
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
12510
12526
|
return new _AugmentcodeRule({
|
|
12511
12527
|
baseDir,
|
|
12512
12528
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -12729,7 +12745,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12729
12745
|
}
|
|
12730
12746
|
const relativePath = join94(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
12731
12747
|
const fileContent = await readFileContent(join94(baseDir, relativePath));
|
|
12732
|
-
const { frontmatter, body: content } = parseFrontmatter(
|
|
12748
|
+
const { frontmatter, body: content } = parseFrontmatter(
|
|
12749
|
+
fileContent,
|
|
12750
|
+
join94(baseDir, relativePath)
|
|
12751
|
+
);
|
|
12733
12752
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12734
12753
|
if (!result.success) {
|
|
12735
12754
|
throw new Error(
|
|
@@ -13182,7 +13201,10 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13182
13201
|
}
|
|
13183
13202
|
const relativePath = join97(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13184
13203
|
const fileContent = await readFileContent(join97(baseDir, relativePath));
|
|
13185
|
-
const { frontmatter, body: content } = parseFrontmatter(
|
|
13204
|
+
const { frontmatter, body: content } = parseFrontmatter(
|
|
13205
|
+
fileContent,
|
|
13206
|
+
join97(baseDir, relativePath)
|
|
13207
|
+
);
|
|
13186
13208
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13187
13209
|
if (!result.success) {
|
|
13188
13210
|
throw new Error(
|
|
@@ -13307,14 +13329,14 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13307
13329
|
* Custom parse function for Cursor MDC files
|
|
13308
13330
|
* MDC files don't support quotes in YAML, so we need to handle patterns like *.ts specially
|
|
13309
13331
|
*/
|
|
13310
|
-
static parseCursorFrontmatter(fileContent) {
|
|
13332
|
+
static parseCursorFrontmatter(fileContent, filePath) {
|
|
13311
13333
|
const preprocessedContent = fileContent.replace(
|
|
13312
13334
|
/^globs:\s*(\*[^\n]*?)$/m,
|
|
13313
13335
|
(_match, globPattern) => {
|
|
13314
13336
|
return `globs: "${globPattern}"`;
|
|
13315
13337
|
}
|
|
13316
13338
|
);
|
|
13317
|
-
return parseFrontmatter(preprocessedContent);
|
|
13339
|
+
return parseFrontmatter(preprocessedContent, filePath);
|
|
13318
13340
|
}
|
|
13319
13341
|
toRulesyncRule() {
|
|
13320
13342
|
const targets = ["*"];
|
|
@@ -13386,10 +13408,13 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13386
13408
|
relativeFilePath,
|
|
13387
13409
|
validate = true
|
|
13388
13410
|
}) {
|
|
13389
|
-
const
|
|
13390
|
-
|
|
13411
|
+
const filePath = join98(
|
|
13412
|
+
baseDir,
|
|
13413
|
+
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13414
|
+
relativeFilePath
|
|
13391
13415
|
);
|
|
13392
|
-
const
|
|
13416
|
+
const fileContent = await readFileContent(filePath);
|
|
13417
|
+
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent, filePath);
|
|
13393
13418
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13394
13419
|
if (!result.success) {
|
|
13395
13420
|
throw new Error(
|
package/dist/cli/index.cjs
CHANGED
|
@@ -424,8 +424,22 @@ function stringifyFrontmatter(body, frontmatter) {
|
|
|
424
424
|
const cleanFrontmatter = deepRemoveNullishObject(frontmatter);
|
|
425
425
|
return import_gray_matter.default.stringify(body, cleanFrontmatter);
|
|
426
426
|
}
|
|
427
|
-
function parseFrontmatter(content) {
|
|
428
|
-
|
|
427
|
+
function parseFrontmatter(content, filePath) {
|
|
428
|
+
let frontmatter;
|
|
429
|
+
let body;
|
|
430
|
+
try {
|
|
431
|
+
const result = (0, import_gray_matter.default)(content);
|
|
432
|
+
frontmatter = result.data;
|
|
433
|
+
body = result.content;
|
|
434
|
+
} catch (error) {
|
|
435
|
+
if (filePath) {
|
|
436
|
+
throw new Error(
|
|
437
|
+
`Failed to parse frontmatter in ${filePath}: ${error instanceof Error ? error.message : String(error)}`,
|
|
438
|
+
{ cause: error }
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
throw error;
|
|
442
|
+
}
|
|
429
443
|
const cleanFrontmatter = deepRemoveNullishObject(frontmatter);
|
|
430
444
|
return { frontmatter: cleanFrontmatter, body };
|
|
431
445
|
}
|
|
@@ -671,7 +685,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
671
685
|
relativeFilePath
|
|
672
686
|
);
|
|
673
687
|
const fileContent = await readFileContent(filePath);
|
|
674
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
688
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
675
689
|
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
676
690
|
if (!result.success) {
|
|
677
691
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -728,7 +742,7 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
728
742
|
relativeFilePath
|
|
729
743
|
);
|
|
730
744
|
const fileContent = await readFileContent(filePath);
|
|
731
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
745
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
732
746
|
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
733
747
|
if (!result.success) {
|
|
734
748
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -881,7 +895,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
881
895
|
relativeFilePath
|
|
882
896
|
);
|
|
883
897
|
const fileContent = await readFileContent(filePath);
|
|
884
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
898
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
885
899
|
const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
|
|
886
900
|
if (!result.success) {
|
|
887
901
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
@@ -1040,7 +1054,7 @@ ${body}${turboDirective}`;
|
|
|
1040
1054
|
relativeFilePath
|
|
1041
1055
|
);
|
|
1042
1056
|
const fileContent = await readFileContent(filePath);
|
|
1043
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1057
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1044
1058
|
const result = AntigravityCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1045
1059
|
if (!result.success) {
|
|
1046
1060
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -1186,7 +1200,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1186
1200
|
const paths = this.getSettablePaths({ global });
|
|
1187
1201
|
const filePath = (0, import_node_path8.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1188
1202
|
const fileContent = await readFileContent(filePath);
|
|
1189
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1203
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1190
1204
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1191
1205
|
if (!result.success) {
|
|
1192
1206
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -1280,7 +1294,7 @@ var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
|
1280
1294
|
const paths = this.getSettablePaths({ global });
|
|
1281
1295
|
const filePath = (0, import_node_path9.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1282
1296
|
const fileContent = await readFileContent(filePath);
|
|
1283
|
-
const { body: content } = parseFrontmatter(fileContent);
|
|
1297
|
+
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
1284
1298
|
return new _ClineCommand({
|
|
1285
1299
|
baseDir,
|
|
1286
1300
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -1367,7 +1381,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1367
1381
|
const paths = this.getSettablePaths({ global });
|
|
1368
1382
|
const filePath = (0, import_node_path10.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1369
1383
|
const fileContent = await readFileContent(filePath);
|
|
1370
|
-
const { body: content } = parseFrontmatter(fileContent);
|
|
1384
|
+
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
1371
1385
|
return new _CodexcliCommand({
|
|
1372
1386
|
baseDir,
|
|
1373
1387
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -1496,7 +1510,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1496
1510
|
const paths = this.getSettablePaths();
|
|
1497
1511
|
const filePath = (0, import_node_path11.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1498
1512
|
const fileContent = await readFileContent(filePath);
|
|
1499
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1513
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1500
1514
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1501
1515
|
if (!result.success) {
|
|
1502
1516
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -1652,7 +1666,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1652
1666
|
const paths = this.getSettablePaths({ global });
|
|
1653
1667
|
const filePath = (0, import_node_path12.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1654
1668
|
const fileContent = await readFileContent(filePath);
|
|
1655
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1669
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1656
1670
|
const result = CursorCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1657
1671
|
if (!result.success) {
|
|
1658
1672
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -1709,7 +1723,7 @@ var FactorydroidCommand = class _FactorydroidCommand extends SimulatedCommand {
|
|
|
1709
1723
|
const paths = _FactorydroidCommand.getSettablePaths({ global });
|
|
1710
1724
|
const filePath = (0, import_node_path13.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1711
1725
|
const fileContent = await readFileContent(filePath);
|
|
1712
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1726
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1713
1727
|
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1714
1728
|
if (!result.success) {
|
|
1715
1729
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -1942,7 +1956,7 @@ var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
|
1942
1956
|
const paths = this.getSettablePaths();
|
|
1943
1957
|
const filePath = (0, import_node_path15.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1944
1958
|
const fileContent = await readFileContent(filePath);
|
|
1945
|
-
const { body: content } = parseFrontmatter(fileContent);
|
|
1959
|
+
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
1946
1960
|
return new _KiloCommand({
|
|
1947
1961
|
baseDir,
|
|
1948
1962
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -2023,7 +2037,7 @@ var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
|
2023
2037
|
const paths = this.getSettablePaths();
|
|
2024
2038
|
const filePath = (0, import_node_path16.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2025
2039
|
const fileContent = await readFileContent(filePath);
|
|
2026
|
-
const { body: content } = parseFrontmatter(fileContent);
|
|
2040
|
+
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
2027
2041
|
return new _KiroCommand({
|
|
2028
2042
|
baseDir,
|
|
2029
2043
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -2151,7 +2165,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2151
2165
|
const paths = this.getSettablePaths({ global });
|
|
2152
2166
|
const filePath = (0, import_node_path17.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2153
2167
|
const fileContent = await readFileContent(filePath);
|
|
2154
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2168
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
2155
2169
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2156
2170
|
if (!result.success) {
|
|
2157
2171
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -2296,7 +2310,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2296
2310
|
}) {
|
|
2297
2311
|
const filePath = (0, import_node_path18.join)(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
2298
2312
|
const fileContent = await readFileContent(filePath);
|
|
2299
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2313
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
2300
2314
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2301
2315
|
if (!result.success) {
|
|
2302
2316
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -6873,7 +6887,7 @@ var ToolSkill = class extends AiDir {
|
|
|
6873
6887
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
6874
6888
|
}
|
|
6875
6889
|
const fileContent = await readFileContent(skillFilePath);
|
|
6876
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
6890
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, skillFilePath);
|
|
6877
6891
|
const otherFiles = await this.collectOtherFiles(
|
|
6878
6892
|
baseDir,
|
|
6879
6893
|
actualRelativeDirPath,
|
|
@@ -6996,7 +7010,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
6996
7010
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
6997
7011
|
}
|
|
6998
7012
|
const fileContent = await readFileContent(skillFilePath);
|
|
6999
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7013
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, skillFilePath);
|
|
7000
7014
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
7001
7015
|
if (!result.success) {
|
|
7002
7016
|
throw new Error(`Invalid frontmatter in ${skillFilePath}: ${formatError(result.error)}`);
|
|
@@ -7347,7 +7361,7 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
7347
7361
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
7348
7362
|
}
|
|
7349
7363
|
const fileContent = await readFileContent(skillFilePath);
|
|
7350
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7364
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, skillFilePath);
|
|
7351
7365
|
const result = RulesyncSkillFrontmatterSchema.safeParse(frontmatter);
|
|
7352
7366
|
if (!result.success) {
|
|
7353
7367
|
throw new Error(`Invalid frontmatter in ${skillFilePath}: ${formatError(result.error)}`);
|
|
@@ -9991,7 +10005,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
9991
10005
|
}) {
|
|
9992
10006
|
const filePath = (0, import_node_path74.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
9993
10007
|
const fileContent = await readFileContent(filePath);
|
|
9994
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10008
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
9995
10009
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
9996
10010
|
if (!result.success) {
|
|
9997
10011
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -10192,10 +10206,9 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10192
10206
|
static async fromFile({
|
|
10193
10207
|
relativeFilePath
|
|
10194
10208
|
}) {
|
|
10195
|
-
const
|
|
10196
|
-
|
|
10197
|
-
);
|
|
10198
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10209
|
+
const filePath = (0, import_node_path79.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
10210
|
+
const fileContent = await readFileContent(filePath);
|
|
10211
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10199
10212
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10200
10213
|
if (!result.success) {
|
|
10201
10214
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
@@ -10336,7 +10349,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10336
10349
|
const paths = this.getSettablePaths({ global });
|
|
10337
10350
|
const filePath = (0, import_node_path80.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10338
10351
|
const fileContent = await readFileContent(filePath);
|
|
10339
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10352
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10340
10353
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10341
10354
|
if (!result.success) {
|
|
10342
10355
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -10664,7 +10677,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
10664
10677
|
const paths = this.getSettablePaths({ global });
|
|
10665
10678
|
const filePath = (0, import_node_path82.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10666
10679
|
const fileContent = await readFileContent(filePath);
|
|
10667
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10680
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10668
10681
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10669
10682
|
if (!result.success) {
|
|
10670
10683
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -10811,7 +10824,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
10811
10824
|
const paths = this.getSettablePaths({ global });
|
|
10812
10825
|
const filePath = (0, import_node_path83.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10813
10826
|
const fileContent = await readFileContent(filePath);
|
|
10814
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10827
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10815
10828
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10816
10829
|
if (!result.success) {
|
|
10817
10830
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -11129,7 +11142,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11129
11142
|
const paths = this.getSettablePaths({ global });
|
|
11130
11143
|
const filePath = (0, import_node_path85.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11131
11144
|
const fileContent = await readFileContent(filePath);
|
|
11132
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
11145
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11133
11146
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11134
11147
|
if (!result.success) {
|
|
11135
11148
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -11551,7 +11564,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
11551
11564
|
relativeFilePath
|
|
11552
11565
|
);
|
|
11553
11566
|
const fileContent = await readFileContent(filePath);
|
|
11554
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
11567
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11555
11568
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
11556
11569
|
if (!result.success) {
|
|
11557
11570
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -11981,7 +11994,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
11981
11994
|
relativeFilePath
|
|
11982
11995
|
);
|
|
11983
11996
|
const fileContent = await readFileContent(filePath);
|
|
11984
|
-
const { frontmatter, body } = parseFrontmatter(fileContent);
|
|
11997
|
+
const { frontmatter, body } = parseFrontmatter(fileContent, filePath);
|
|
11985
11998
|
let parsedFrontmatter;
|
|
11986
11999
|
if (validate) {
|
|
11987
12000
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12238,10 +12251,13 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
12238
12251
|
relativeFilePath,
|
|
12239
12252
|
validate = true
|
|
12240
12253
|
}) {
|
|
12241
|
-
const
|
|
12242
|
-
|
|
12254
|
+
const filePath = (0, import_node_path92.join)(
|
|
12255
|
+
baseDir,
|
|
12256
|
+
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
12257
|
+
relativeFilePath
|
|
12243
12258
|
);
|
|
12244
|
-
const
|
|
12259
|
+
const fileContent = await readFileContent(filePath);
|
|
12260
|
+
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
12245
12261
|
return new _AugmentcodeRule({
|
|
12246
12262
|
baseDir,
|
|
12247
12263
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -12464,7 +12480,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12464
12480
|
}
|
|
12465
12481
|
const relativePath = (0, import_node_path94.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
12466
12482
|
const fileContent = await readFileContent((0, import_node_path94.join)(baseDir, relativePath));
|
|
12467
|
-
const { frontmatter, body: content } = parseFrontmatter(
|
|
12483
|
+
const { frontmatter, body: content } = parseFrontmatter(
|
|
12484
|
+
fileContent,
|
|
12485
|
+
(0, import_node_path94.join)(baseDir, relativePath)
|
|
12486
|
+
);
|
|
12468
12487
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12469
12488
|
if (!result.success) {
|
|
12470
12489
|
throw new Error(
|
|
@@ -12917,7 +12936,10 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
12917
12936
|
}
|
|
12918
12937
|
const relativePath = (0, import_node_path97.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
12919
12938
|
const fileContent = await readFileContent((0, import_node_path97.join)(baseDir, relativePath));
|
|
12920
|
-
const { frontmatter, body: content } = parseFrontmatter(
|
|
12939
|
+
const { frontmatter, body: content } = parseFrontmatter(
|
|
12940
|
+
fileContent,
|
|
12941
|
+
(0, import_node_path97.join)(baseDir, relativePath)
|
|
12942
|
+
);
|
|
12921
12943
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12922
12944
|
if (!result.success) {
|
|
12923
12945
|
throw new Error(
|
|
@@ -13042,14 +13064,14 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13042
13064
|
* Custom parse function for Cursor MDC files
|
|
13043
13065
|
* MDC files don't support quotes in YAML, so we need to handle patterns like *.ts specially
|
|
13044
13066
|
*/
|
|
13045
|
-
static parseCursorFrontmatter(fileContent) {
|
|
13067
|
+
static parseCursorFrontmatter(fileContent, filePath) {
|
|
13046
13068
|
const preprocessedContent = fileContent.replace(
|
|
13047
13069
|
/^globs:\s*(\*[^\n]*?)$/m,
|
|
13048
13070
|
(_match, globPattern) => {
|
|
13049
13071
|
return `globs: "${globPattern}"`;
|
|
13050
13072
|
}
|
|
13051
13073
|
);
|
|
13052
|
-
return parseFrontmatter(preprocessedContent);
|
|
13074
|
+
return parseFrontmatter(preprocessedContent, filePath);
|
|
13053
13075
|
}
|
|
13054
13076
|
toRulesyncRule() {
|
|
13055
13077
|
const targets = ["*"];
|
|
@@ -13121,10 +13143,13 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13121
13143
|
relativeFilePath,
|
|
13122
13144
|
validate = true
|
|
13123
13145
|
}) {
|
|
13124
|
-
const
|
|
13125
|
-
|
|
13146
|
+
const filePath = (0, import_node_path98.join)(
|
|
13147
|
+
baseDir,
|
|
13148
|
+
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13149
|
+
relativeFilePath
|
|
13126
13150
|
);
|
|
13127
|
-
const
|
|
13151
|
+
const fileContent = await readFileContent(filePath);
|
|
13152
|
+
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent, filePath);
|
|
13128
13153
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13129
13154
|
if (!result.success) {
|
|
13130
13155
|
throw new Error(
|
|
@@ -19625,7 +19650,7 @@ async function updateCommand(currentVersion, options) {
|
|
|
19625
19650
|
}
|
|
19626
19651
|
|
|
19627
19652
|
// src/cli/index.ts
|
|
19628
|
-
var getVersion = () => "7.
|
|
19653
|
+
var getVersion = () => "7.8.0";
|
|
19629
19654
|
var main = async () => {
|
|
19630
19655
|
const program = new import_commander.Command();
|
|
19631
19656
|
const version = getVersion();
|
package/dist/cli/index.js
CHANGED
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
removeTempDirectory,
|
|
61
61
|
stringifyFrontmatter,
|
|
62
62
|
writeFileContent
|
|
63
|
-
} from "../chunk-
|
|
63
|
+
} from "../chunk-PEMFIVEG.js";
|
|
64
64
|
|
|
65
65
|
// src/cli/index.ts
|
|
66
66
|
import { Command } from "commander";
|
|
@@ -3799,7 +3799,7 @@ async function updateCommand(currentVersion, options) {
|
|
|
3799
3799
|
}
|
|
3800
3800
|
|
|
3801
3801
|
// src/cli/index.ts
|
|
3802
|
-
var getVersion = () => "7.
|
|
3802
|
+
var getVersion = () => "7.8.0";
|
|
3803
3803
|
var main = async () => {
|
|
3804
3804
|
const program = new Command();
|
|
3805
3805
|
const version = getVersion();
|
package/dist/index.cjs
CHANGED
|
@@ -750,8 +750,22 @@ function stringifyFrontmatter(body, frontmatter) {
|
|
|
750
750
|
const cleanFrontmatter = deepRemoveNullishObject(frontmatter);
|
|
751
751
|
return import_gray_matter.default.stringify(body, cleanFrontmatter);
|
|
752
752
|
}
|
|
753
|
-
function parseFrontmatter(content) {
|
|
754
|
-
|
|
753
|
+
function parseFrontmatter(content, filePath) {
|
|
754
|
+
let frontmatter;
|
|
755
|
+
let body;
|
|
756
|
+
try {
|
|
757
|
+
const result = (0, import_gray_matter.default)(content);
|
|
758
|
+
frontmatter = result.data;
|
|
759
|
+
body = result.content;
|
|
760
|
+
} catch (error) {
|
|
761
|
+
if (filePath) {
|
|
762
|
+
throw new Error(
|
|
763
|
+
`Failed to parse frontmatter in ${filePath}: ${error instanceof Error ? error.message : String(error)}`,
|
|
764
|
+
{ cause: error }
|
|
765
|
+
);
|
|
766
|
+
}
|
|
767
|
+
throw error;
|
|
768
|
+
}
|
|
755
769
|
const cleanFrontmatter = deepRemoveNullishObject(frontmatter);
|
|
756
770
|
return { frontmatter: cleanFrontmatter, body };
|
|
757
771
|
}
|
|
@@ -997,7 +1011,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
997
1011
|
relativeFilePath
|
|
998
1012
|
);
|
|
999
1013
|
const fileContent = await readFileContent(filePath);
|
|
1000
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1014
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1001
1015
|
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1002
1016
|
if (!result.success) {
|
|
1003
1017
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -1054,7 +1068,7 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
1054
1068
|
relativeFilePath
|
|
1055
1069
|
);
|
|
1056
1070
|
const fileContent = await readFileContent(filePath);
|
|
1057
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1071
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1058
1072
|
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1059
1073
|
if (!result.success) {
|
|
1060
1074
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -1174,7 +1188,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
1174
1188
|
relativeFilePath
|
|
1175
1189
|
);
|
|
1176
1190
|
const fileContent = await readFileContent(filePath);
|
|
1177
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1191
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1178
1192
|
const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1179
1193
|
if (!result.success) {
|
|
1180
1194
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
@@ -1333,7 +1347,7 @@ ${body}${turboDirective}`;
|
|
|
1333
1347
|
relativeFilePath
|
|
1334
1348
|
);
|
|
1335
1349
|
const fileContent = await readFileContent(filePath);
|
|
1336
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1350
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1337
1351
|
const result = AntigravityCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1338
1352
|
if (!result.success) {
|
|
1339
1353
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -1479,7 +1493,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1479
1493
|
const paths = this.getSettablePaths({ global });
|
|
1480
1494
|
const filePath = (0, import_node_path9.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1481
1495
|
const fileContent = await readFileContent(filePath);
|
|
1482
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1496
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1483
1497
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1484
1498
|
if (!result.success) {
|
|
1485
1499
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -1573,7 +1587,7 @@ var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
|
1573
1587
|
const paths = this.getSettablePaths({ global });
|
|
1574
1588
|
const filePath = (0, import_node_path10.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1575
1589
|
const fileContent = await readFileContent(filePath);
|
|
1576
|
-
const { body: content } = parseFrontmatter(fileContent);
|
|
1590
|
+
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
1577
1591
|
return new _ClineCommand({
|
|
1578
1592
|
baseDir,
|
|
1579
1593
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -1660,7 +1674,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1660
1674
|
const paths = this.getSettablePaths({ global });
|
|
1661
1675
|
const filePath = (0, import_node_path11.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1662
1676
|
const fileContent = await readFileContent(filePath);
|
|
1663
|
-
const { body: content } = parseFrontmatter(fileContent);
|
|
1677
|
+
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
1664
1678
|
return new _CodexcliCommand({
|
|
1665
1679
|
baseDir,
|
|
1666
1680
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -1789,7 +1803,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1789
1803
|
const paths = this.getSettablePaths();
|
|
1790
1804
|
const filePath = (0, import_node_path12.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1791
1805
|
const fileContent = await readFileContent(filePath);
|
|
1792
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1806
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1793
1807
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1794
1808
|
if (!result.success) {
|
|
1795
1809
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -1945,7 +1959,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1945
1959
|
const paths = this.getSettablePaths({ global });
|
|
1946
1960
|
const filePath = (0, import_node_path13.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1947
1961
|
const fileContent = await readFileContent(filePath);
|
|
1948
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1962
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1949
1963
|
const result = CursorCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1950
1964
|
if (!result.success) {
|
|
1951
1965
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -2002,7 +2016,7 @@ var FactorydroidCommand = class _FactorydroidCommand extends SimulatedCommand {
|
|
|
2002
2016
|
const paths = _FactorydroidCommand.getSettablePaths({ global });
|
|
2003
2017
|
const filePath = (0, import_node_path14.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2004
2018
|
const fileContent = await readFileContent(filePath);
|
|
2005
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2019
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
2006
2020
|
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2007
2021
|
if (!result.success) {
|
|
2008
2022
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -2235,7 +2249,7 @@ var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
|
2235
2249
|
const paths = this.getSettablePaths();
|
|
2236
2250
|
const filePath = (0, import_node_path16.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2237
2251
|
const fileContent = await readFileContent(filePath);
|
|
2238
|
-
const { body: content } = parseFrontmatter(fileContent);
|
|
2252
|
+
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
2239
2253
|
return new _KiloCommand({
|
|
2240
2254
|
baseDir,
|
|
2241
2255
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -2316,7 +2330,7 @@ var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
|
2316
2330
|
const paths = this.getSettablePaths();
|
|
2317
2331
|
const filePath = (0, import_node_path17.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2318
2332
|
const fileContent = await readFileContent(filePath);
|
|
2319
|
-
const { body: content } = parseFrontmatter(fileContent);
|
|
2333
|
+
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
2320
2334
|
return new _KiroCommand({
|
|
2321
2335
|
baseDir,
|
|
2322
2336
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -2444,7 +2458,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2444
2458
|
const paths = this.getSettablePaths({ global });
|
|
2445
2459
|
const filePath = (0, import_node_path18.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2446
2460
|
const fileContent = await readFileContent(filePath);
|
|
2447
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2461
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
2448
2462
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2449
2463
|
if (!result.success) {
|
|
2450
2464
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -2589,7 +2603,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2589
2603
|
}) {
|
|
2590
2604
|
const filePath = (0, import_node_path19.join)(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
2591
2605
|
const fileContent = await readFileContent(filePath);
|
|
2592
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2606
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
2593
2607
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2594
2608
|
if (!result.success) {
|
|
2595
2609
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -7166,7 +7180,7 @@ var ToolSkill = class extends AiDir {
|
|
|
7166
7180
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
7167
7181
|
}
|
|
7168
7182
|
const fileContent = await readFileContent(skillFilePath);
|
|
7169
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7183
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, skillFilePath);
|
|
7170
7184
|
const otherFiles = await this.collectOtherFiles(
|
|
7171
7185
|
baseDir,
|
|
7172
7186
|
actualRelativeDirPath,
|
|
@@ -7289,7 +7303,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
7289
7303
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
7290
7304
|
}
|
|
7291
7305
|
const fileContent = await readFileContent(skillFilePath);
|
|
7292
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7306
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, skillFilePath);
|
|
7293
7307
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
7294
7308
|
if (!result.success) {
|
|
7295
7309
|
throw new Error(`Invalid frontmatter in ${skillFilePath}: ${formatError(result.error)}`);
|
|
@@ -7640,7 +7654,7 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
7640
7654
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
7641
7655
|
}
|
|
7642
7656
|
const fileContent = await readFileContent(skillFilePath);
|
|
7643
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7657
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, skillFilePath);
|
|
7644
7658
|
const result = RulesyncSkillFrontmatterSchema.safeParse(frontmatter);
|
|
7645
7659
|
if (!result.success) {
|
|
7646
7660
|
throw new Error(`Invalid frontmatter in ${skillFilePath}: ${formatError(result.error)}`);
|
|
@@ -10284,7 +10298,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10284
10298
|
}) {
|
|
10285
10299
|
const filePath = (0, import_node_path75.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
10286
10300
|
const fileContent = await readFileContent(filePath);
|
|
10287
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10301
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10288
10302
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10289
10303
|
if (!result.success) {
|
|
10290
10304
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -10485,10 +10499,9 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10485
10499
|
static async fromFile({
|
|
10486
10500
|
relativeFilePath
|
|
10487
10501
|
}) {
|
|
10488
|
-
const
|
|
10489
|
-
|
|
10490
|
-
);
|
|
10491
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10502
|
+
const filePath = (0, import_node_path80.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
10503
|
+
const fileContent = await readFileContent(filePath);
|
|
10504
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10492
10505
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10493
10506
|
if (!result.success) {
|
|
10494
10507
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
@@ -10629,7 +10642,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10629
10642
|
const paths = this.getSettablePaths({ global });
|
|
10630
10643
|
const filePath = (0, import_node_path81.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10631
10644
|
const fileContent = await readFileContent(filePath);
|
|
10632
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10645
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10633
10646
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10634
10647
|
if (!result.success) {
|
|
10635
10648
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -10957,7 +10970,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
10957
10970
|
const paths = this.getSettablePaths({ global });
|
|
10958
10971
|
const filePath = (0, import_node_path83.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10959
10972
|
const fileContent = await readFileContent(filePath);
|
|
10960
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10973
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10961
10974
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10962
10975
|
if (!result.success) {
|
|
10963
10976
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -11104,7 +11117,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11104
11117
|
const paths = this.getSettablePaths({ global });
|
|
11105
11118
|
const filePath = (0, import_node_path84.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11106
11119
|
const fileContent = await readFileContent(filePath);
|
|
11107
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
11120
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11108
11121
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11109
11122
|
if (!result.success) {
|
|
11110
11123
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -11422,7 +11435,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11422
11435
|
const paths = this.getSettablePaths({ global });
|
|
11423
11436
|
const filePath = (0, import_node_path86.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11424
11437
|
const fileContent = await readFileContent(filePath);
|
|
11425
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
11438
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11426
11439
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11427
11440
|
if (!result.success) {
|
|
11428
11441
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -11844,7 +11857,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
11844
11857
|
relativeFilePath
|
|
11845
11858
|
);
|
|
11846
11859
|
const fileContent = await readFileContent(filePath);
|
|
11847
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
11860
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11848
11861
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
11849
11862
|
if (!result.success) {
|
|
11850
11863
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
@@ -12274,7 +12287,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
12274
12287
|
relativeFilePath
|
|
12275
12288
|
);
|
|
12276
12289
|
const fileContent = await readFileContent(filePath);
|
|
12277
|
-
const { frontmatter, body } = parseFrontmatter(fileContent);
|
|
12290
|
+
const { frontmatter, body } = parseFrontmatter(fileContent, filePath);
|
|
12278
12291
|
let parsedFrontmatter;
|
|
12279
12292
|
if (validate) {
|
|
12280
12293
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12531,10 +12544,13 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
12531
12544
|
relativeFilePath,
|
|
12532
12545
|
validate = true
|
|
12533
12546
|
}) {
|
|
12534
|
-
const
|
|
12535
|
-
|
|
12547
|
+
const filePath = (0, import_node_path93.join)(
|
|
12548
|
+
baseDir,
|
|
12549
|
+
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
12550
|
+
relativeFilePath
|
|
12536
12551
|
);
|
|
12537
|
-
const
|
|
12552
|
+
const fileContent = await readFileContent(filePath);
|
|
12553
|
+
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
12538
12554
|
return new _AugmentcodeRule({
|
|
12539
12555
|
baseDir,
|
|
12540
12556
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -12757,7 +12773,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12757
12773
|
}
|
|
12758
12774
|
const relativePath = (0, import_node_path95.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
12759
12775
|
const fileContent = await readFileContent((0, import_node_path95.join)(baseDir, relativePath));
|
|
12760
|
-
const { frontmatter, body: content } = parseFrontmatter(
|
|
12776
|
+
const { frontmatter, body: content } = parseFrontmatter(
|
|
12777
|
+
fileContent,
|
|
12778
|
+
(0, import_node_path95.join)(baseDir, relativePath)
|
|
12779
|
+
);
|
|
12761
12780
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12762
12781
|
if (!result.success) {
|
|
12763
12782
|
throw new Error(
|
|
@@ -13210,7 +13229,10 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13210
13229
|
}
|
|
13211
13230
|
const relativePath = (0, import_node_path98.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13212
13231
|
const fileContent = await readFileContent((0, import_node_path98.join)(baseDir, relativePath));
|
|
13213
|
-
const { frontmatter, body: content } = parseFrontmatter(
|
|
13232
|
+
const { frontmatter, body: content } = parseFrontmatter(
|
|
13233
|
+
fileContent,
|
|
13234
|
+
(0, import_node_path98.join)(baseDir, relativePath)
|
|
13235
|
+
);
|
|
13214
13236
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13215
13237
|
if (!result.success) {
|
|
13216
13238
|
throw new Error(
|
|
@@ -13335,14 +13357,14 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13335
13357
|
* Custom parse function for Cursor MDC files
|
|
13336
13358
|
* MDC files don't support quotes in YAML, so we need to handle patterns like *.ts specially
|
|
13337
13359
|
*/
|
|
13338
|
-
static parseCursorFrontmatter(fileContent) {
|
|
13360
|
+
static parseCursorFrontmatter(fileContent, filePath) {
|
|
13339
13361
|
const preprocessedContent = fileContent.replace(
|
|
13340
13362
|
/^globs:\s*(\*[^\n]*?)$/m,
|
|
13341
13363
|
(_match, globPattern) => {
|
|
13342
13364
|
return `globs: "${globPattern}"`;
|
|
13343
13365
|
}
|
|
13344
13366
|
);
|
|
13345
|
-
return parseFrontmatter(preprocessedContent);
|
|
13367
|
+
return parseFrontmatter(preprocessedContent, filePath);
|
|
13346
13368
|
}
|
|
13347
13369
|
toRulesyncRule() {
|
|
13348
13370
|
const targets = ["*"];
|
|
@@ -13414,10 +13436,13 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13414
13436
|
relativeFilePath,
|
|
13415
13437
|
validate = true
|
|
13416
13438
|
}) {
|
|
13417
|
-
const
|
|
13418
|
-
|
|
13439
|
+
const filePath = (0, import_node_path99.join)(
|
|
13440
|
+
baseDir,
|
|
13441
|
+
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13442
|
+
relativeFilePath
|
|
13419
13443
|
);
|
|
13420
|
-
const
|
|
13444
|
+
const fileContent = await readFileContent(filePath);
|
|
13445
|
+
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent, filePath);
|
|
13421
13446
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13422
13447
|
if (!result.success) {
|
|
13423
13448
|
throw new Error(
|
package/dist/index.js
CHANGED