rulesync 3.20.0 → 3.21.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 +0 -15
- package/dist/index.cjs +345 -333
- package/dist/index.js +302 -290
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -431,8 +431,19 @@ function getBaseDirsInLightOfGlobal({
|
|
|
431
431
|
return resolvedBaseDirs;
|
|
432
432
|
}
|
|
433
433
|
|
|
434
|
+
// src/constants/rulesync-paths.ts
|
|
435
|
+
import { join as join2 } from "path";
|
|
436
|
+
var RULESYNC_CONFIG_RELATIVE_FILE_PATH = "rulesync.jsonc";
|
|
437
|
+
var RULESYNC_RELATIVE_DIR_PATH = ".rulesync";
|
|
438
|
+
var RULESYNC_RULES_RELATIVE_DIR_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "rules");
|
|
439
|
+
var RULESYNC_COMMANDS_RELATIVE_DIR_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "commands");
|
|
440
|
+
var RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "subagents");
|
|
441
|
+
var RULESYNC_MCP_RELATIVE_FILE_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "mcp.json");
|
|
442
|
+
var RULESYNC_IGNORE_RELATIVE_FILE_PATH = ".rulesyncignore";
|
|
443
|
+
var RULESYNC_OVERVIEW_FILE_NAME = "overview.md";
|
|
444
|
+
|
|
434
445
|
// src/features/commands/commands-processor.ts
|
|
435
|
-
import { basename as basename11, join as
|
|
446
|
+
import { basename as basename11, join as join12 } from "path";
|
|
436
447
|
import { z as z10 } from "zod/mini";
|
|
437
448
|
|
|
438
449
|
// src/types/feature-processor.ts
|
|
@@ -466,7 +477,7 @@ var FeatureProcessor = class {
|
|
|
466
477
|
};
|
|
467
478
|
|
|
468
479
|
// src/features/commands/agentsmd-command.ts
|
|
469
|
-
import { basename as basename3, join as
|
|
480
|
+
import { basename as basename3, join as join4 } from "path";
|
|
470
481
|
|
|
471
482
|
// src/utils/frontmatter.ts
|
|
472
483
|
import matter from "gray-matter";
|
|
@@ -518,7 +529,7 @@ function parseFrontmatter(content) {
|
|
|
518
529
|
}
|
|
519
530
|
|
|
520
531
|
// src/features/commands/simulated-command.ts
|
|
521
|
-
import { basename as basename2, join as
|
|
532
|
+
import { basename as basename2, join as join3 } from "path";
|
|
522
533
|
import { z as z4 } from "zod/mini";
|
|
523
534
|
|
|
524
535
|
// src/types/ai-file.ts
|
|
@@ -681,7 +692,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
681
692
|
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
682
693
|
if (!result.success) {
|
|
683
694
|
throw new Error(
|
|
684
|
-
`Invalid frontmatter in ${
|
|
695
|
+
`Invalid frontmatter in ${join3(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
685
696
|
);
|
|
686
697
|
}
|
|
687
698
|
}
|
|
@@ -731,7 +742,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
731
742
|
return {
|
|
732
743
|
success: false,
|
|
733
744
|
error: new Error(
|
|
734
|
-
`Invalid frontmatter in ${
|
|
745
|
+
`Invalid frontmatter in ${join3(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
735
746
|
)
|
|
736
747
|
};
|
|
737
748
|
}
|
|
@@ -741,7 +752,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
741
752
|
relativeFilePath,
|
|
742
753
|
validate = true
|
|
743
754
|
}) {
|
|
744
|
-
const filePath =
|
|
755
|
+
const filePath = join3(
|
|
745
756
|
baseDir,
|
|
746
757
|
_SimulatedCommand.getSettablePaths().relativeDirPath,
|
|
747
758
|
relativeFilePath
|
|
@@ -767,7 +778,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
767
778
|
var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
768
779
|
static getSettablePaths() {
|
|
769
780
|
return {
|
|
770
|
-
relativeDirPath:
|
|
781
|
+
relativeDirPath: join4(".agents", "commands")
|
|
771
782
|
};
|
|
772
783
|
}
|
|
773
784
|
static fromRulesyncCommand({
|
|
@@ -784,7 +795,7 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
784
795
|
relativeFilePath,
|
|
785
796
|
validate = true
|
|
786
797
|
}) {
|
|
787
|
-
const filePath =
|
|
798
|
+
const filePath = join4(
|
|
788
799
|
baseDir,
|
|
789
800
|
_AgentsmdCommand.getSettablePaths().relativeDirPath,
|
|
790
801
|
relativeFilePath
|
|
@@ -813,11 +824,11 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
813
824
|
};
|
|
814
825
|
|
|
815
826
|
// src/features/commands/claudecode-command.ts
|
|
816
|
-
import { basename as basename5, join as
|
|
827
|
+
import { basename as basename5, join as join6 } from "path";
|
|
817
828
|
import { z as z6 } from "zod/mini";
|
|
818
829
|
|
|
819
830
|
// src/features/commands/rulesync-command.ts
|
|
820
|
-
import { basename as basename4, join as
|
|
831
|
+
import { basename as basename4, join as join5 } from "path";
|
|
821
832
|
import { z as z5 } from "zod/mini";
|
|
822
833
|
|
|
823
834
|
// src/types/rulesync-file.ts
|
|
@@ -843,7 +854,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
843
854
|
const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
|
|
844
855
|
if (!result.success) {
|
|
845
856
|
throw new Error(
|
|
846
|
-
`Invalid frontmatter in ${
|
|
857
|
+
`Invalid frontmatter in ${join5(rest.baseDir ?? process.cwd(), rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
847
858
|
);
|
|
848
859
|
}
|
|
849
860
|
}
|
|
@@ -856,7 +867,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
856
867
|
}
|
|
857
868
|
static getSettablePaths() {
|
|
858
869
|
return {
|
|
859
|
-
relativeDirPath:
|
|
870
|
+
relativeDirPath: RULESYNC_COMMANDS_RELATIVE_DIR_PATH
|
|
860
871
|
};
|
|
861
872
|
}
|
|
862
873
|
getFrontmatter() {
|
|
@@ -876,7 +887,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
876
887
|
return {
|
|
877
888
|
success: false,
|
|
878
889
|
error: new Error(
|
|
879
|
-
`Invalid frontmatter in ${
|
|
890
|
+
`Invalid frontmatter in ${join5(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
880
891
|
)
|
|
881
892
|
};
|
|
882
893
|
}
|
|
@@ -884,7 +895,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
884
895
|
static async fromFile({
|
|
885
896
|
relativeFilePath
|
|
886
897
|
}) {
|
|
887
|
-
const filePath =
|
|
898
|
+
const filePath = join5(
|
|
888
899
|
process.cwd(),
|
|
889
900
|
_RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
890
901
|
relativeFilePath
|
|
@@ -919,7 +930,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
919
930
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
920
931
|
if (!result.success) {
|
|
921
932
|
throw new Error(
|
|
922
|
-
`Invalid frontmatter in ${
|
|
933
|
+
`Invalid frontmatter in ${join6(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
923
934
|
);
|
|
924
935
|
}
|
|
925
936
|
}
|
|
@@ -932,7 +943,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
932
943
|
}
|
|
933
944
|
static getSettablePaths(_options = {}) {
|
|
934
945
|
return {
|
|
935
|
-
relativeDirPath:
|
|
946
|
+
relativeDirPath: join6(".claude", "commands")
|
|
936
947
|
};
|
|
937
948
|
}
|
|
938
949
|
getBody() {
|
|
@@ -990,7 +1001,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
990
1001
|
return {
|
|
991
1002
|
success: false,
|
|
992
1003
|
error: new Error(
|
|
993
|
-
`Invalid frontmatter in ${
|
|
1004
|
+
`Invalid frontmatter in ${join6(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
994
1005
|
)
|
|
995
1006
|
};
|
|
996
1007
|
}
|
|
@@ -1008,7 +1019,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1008
1019
|
global = false
|
|
1009
1020
|
}) {
|
|
1010
1021
|
const paths = this.getSettablePaths({ global });
|
|
1011
|
-
const filePath =
|
|
1022
|
+
const filePath = join6(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1012
1023
|
const fileContent = await readFileContent(filePath);
|
|
1013
1024
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1014
1025
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1027,14 +1038,14 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1027
1038
|
};
|
|
1028
1039
|
|
|
1029
1040
|
// src/features/commands/codexcli-command.ts
|
|
1030
|
-
import { basename as basename6, join as
|
|
1041
|
+
import { basename as basename6, join as join7 } from "path";
|
|
1031
1042
|
var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
1032
1043
|
static getSettablePaths({ global } = {}) {
|
|
1033
1044
|
if (!global) {
|
|
1034
1045
|
throw new Error("CodexcliCommand only supports global mode. Please pass { global: true }.");
|
|
1035
1046
|
}
|
|
1036
1047
|
return {
|
|
1037
|
-
relativeDirPath:
|
|
1048
|
+
relativeDirPath: join7(".codex", "prompts")
|
|
1038
1049
|
};
|
|
1039
1050
|
}
|
|
1040
1051
|
toRulesyncCommand() {
|
|
@@ -1087,7 +1098,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1087
1098
|
global = false
|
|
1088
1099
|
}) {
|
|
1089
1100
|
const paths = this.getSettablePaths({ global });
|
|
1090
|
-
const filePath =
|
|
1101
|
+
const filePath = join7(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1091
1102
|
const fileContent = await readFileContent(filePath);
|
|
1092
1103
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1093
1104
|
return new _CodexcliCommand({
|
|
@@ -1101,7 +1112,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1101
1112
|
};
|
|
1102
1113
|
|
|
1103
1114
|
// src/features/commands/copilot-command.ts
|
|
1104
|
-
import { basename as basename7, join as
|
|
1115
|
+
import { basename as basename7, join as join8 } from "path";
|
|
1105
1116
|
import { z as z7 } from "zod/mini";
|
|
1106
1117
|
var CopilotCommandFrontmatterSchema = z7.object({
|
|
1107
1118
|
mode: z7.literal("agent"),
|
|
@@ -1115,7 +1126,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1115
1126
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1116
1127
|
if (!result.success) {
|
|
1117
1128
|
throw new Error(
|
|
1118
|
-
`Invalid frontmatter in ${
|
|
1129
|
+
`Invalid frontmatter in ${join8(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1119
1130
|
);
|
|
1120
1131
|
}
|
|
1121
1132
|
}
|
|
@@ -1128,7 +1139,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1128
1139
|
}
|
|
1129
1140
|
static getSettablePaths() {
|
|
1130
1141
|
return {
|
|
1131
|
-
relativeDirPath:
|
|
1142
|
+
relativeDirPath: join8(".github", "prompts")
|
|
1132
1143
|
};
|
|
1133
1144
|
}
|
|
1134
1145
|
getBody() {
|
|
@@ -1165,7 +1176,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1165
1176
|
return {
|
|
1166
1177
|
success: false,
|
|
1167
1178
|
error: new Error(
|
|
1168
|
-
`Invalid frontmatter in ${
|
|
1179
|
+
`Invalid frontmatter in ${join8(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1169
1180
|
)
|
|
1170
1181
|
};
|
|
1171
1182
|
}
|
|
@@ -1199,7 +1210,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1199
1210
|
validate = true
|
|
1200
1211
|
}) {
|
|
1201
1212
|
const paths = this.getSettablePaths();
|
|
1202
|
-
const filePath =
|
|
1213
|
+
const filePath = join8(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1203
1214
|
const fileContent = await readFileContent(filePath);
|
|
1204
1215
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1205
1216
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1224,11 +1235,11 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1224
1235
|
};
|
|
1225
1236
|
|
|
1226
1237
|
// src/features/commands/cursor-command.ts
|
|
1227
|
-
import { basename as basename8, join as
|
|
1238
|
+
import { basename as basename8, join as join9 } from "path";
|
|
1228
1239
|
var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
1229
1240
|
static getSettablePaths(_options = {}) {
|
|
1230
1241
|
return {
|
|
1231
|
-
relativeDirPath:
|
|
1242
|
+
relativeDirPath: join9(".cursor", "commands")
|
|
1232
1243
|
};
|
|
1233
1244
|
}
|
|
1234
1245
|
toRulesyncCommand() {
|
|
@@ -1281,7 +1292,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1281
1292
|
global = false
|
|
1282
1293
|
}) {
|
|
1283
1294
|
const paths = this.getSettablePaths({ global });
|
|
1284
|
-
const filePath =
|
|
1295
|
+
const filePath = join9(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1285
1296
|
const fileContent = await readFileContent(filePath);
|
|
1286
1297
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1287
1298
|
return new _CursorCommand({
|
|
@@ -1295,7 +1306,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1295
1306
|
};
|
|
1296
1307
|
|
|
1297
1308
|
// src/features/commands/geminicli-command.ts
|
|
1298
|
-
import { basename as basename9, join as
|
|
1309
|
+
import { basename as basename9, join as join10 } from "path";
|
|
1299
1310
|
import { parse as parseToml } from "smol-toml";
|
|
1300
1311
|
import { z as z8 } from "zod/mini";
|
|
1301
1312
|
var GeminiCliCommandFrontmatterSchema = z8.object({
|
|
@@ -1313,7 +1324,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
1313
1324
|
}
|
|
1314
1325
|
static getSettablePaths(_options = {}) {
|
|
1315
1326
|
return {
|
|
1316
|
-
relativeDirPath:
|
|
1327
|
+
relativeDirPath: join10(".gemini", "commands")
|
|
1317
1328
|
};
|
|
1318
1329
|
}
|
|
1319
1330
|
parseTomlContent(content) {
|
|
@@ -1390,7 +1401,7 @@ ${geminiFrontmatter.prompt}
|
|
|
1390
1401
|
global = false
|
|
1391
1402
|
}) {
|
|
1392
1403
|
const paths = this.getSettablePaths({ global });
|
|
1393
|
-
const filePath =
|
|
1404
|
+
const filePath = join10(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1394
1405
|
const fileContent = await readFileContent(filePath);
|
|
1395
1406
|
return new _GeminiCliCommand({
|
|
1396
1407
|
baseDir,
|
|
@@ -1417,7 +1428,7 @@ ${geminiFrontmatter.prompt}
|
|
|
1417
1428
|
};
|
|
1418
1429
|
|
|
1419
1430
|
// src/features/commands/roo-command.ts
|
|
1420
|
-
import { basename as basename10, join as
|
|
1431
|
+
import { basename as basename10, join as join11 } from "path";
|
|
1421
1432
|
import { optional as optional2, z as z9 } from "zod/mini";
|
|
1422
1433
|
var RooCommandFrontmatterSchema = z9.object({
|
|
1423
1434
|
description: z9.string(),
|
|
@@ -1428,7 +1439,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1428
1439
|
body;
|
|
1429
1440
|
static getSettablePaths() {
|
|
1430
1441
|
return {
|
|
1431
|
-
relativeDirPath:
|
|
1442
|
+
relativeDirPath: join11(".roo", "commands")
|
|
1432
1443
|
};
|
|
1433
1444
|
}
|
|
1434
1445
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -1436,7 +1447,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1436
1447
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1437
1448
|
if (!result.success) {
|
|
1438
1449
|
throw new Error(
|
|
1439
|
-
`Invalid frontmatter in ${
|
|
1450
|
+
`Invalid frontmatter in ${join11(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1440
1451
|
);
|
|
1441
1452
|
}
|
|
1442
1453
|
}
|
|
@@ -1502,7 +1513,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1502
1513
|
return {
|
|
1503
1514
|
success: false,
|
|
1504
1515
|
error: new Error(
|
|
1505
|
-
`Invalid frontmatter in ${
|
|
1516
|
+
`Invalid frontmatter in ${join11(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1506
1517
|
)
|
|
1507
1518
|
};
|
|
1508
1519
|
}
|
|
@@ -1518,7 +1529,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1518
1529
|
relativeFilePath,
|
|
1519
1530
|
validate = true
|
|
1520
1531
|
}) {
|
|
1521
|
-
const filePath =
|
|
1532
|
+
const filePath = join11(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
1522
1533
|
const fileContent = await readFileContent(filePath);
|
|
1523
1534
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1524
1535
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1664,7 +1675,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1664
1675
|
*/
|
|
1665
1676
|
async loadRulesyncFiles() {
|
|
1666
1677
|
const rulesyncCommandPaths = await findFilesByGlobs(
|
|
1667
|
-
|
|
1678
|
+
join12(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
|
|
1668
1679
|
);
|
|
1669
1680
|
const rulesyncCommands = (await Promise.allSettled(
|
|
1670
1681
|
rulesyncCommandPaths.map(
|
|
@@ -1707,7 +1718,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1707
1718
|
extension
|
|
1708
1719
|
}) {
|
|
1709
1720
|
const commandFilePaths = await findFilesByGlobs(
|
|
1710
|
-
|
|
1721
|
+
join12(this.baseDir, relativeDirPath, `*.${extension}`)
|
|
1711
1722
|
);
|
|
1712
1723
|
const toolCommands = (await Promise.allSettled(
|
|
1713
1724
|
commandFilePaths.map((path2) => {
|
|
@@ -1859,14 +1870,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1859
1870
|
import { z as z11 } from "zod/mini";
|
|
1860
1871
|
|
|
1861
1872
|
// src/features/ignore/amazonqcli-ignore.ts
|
|
1862
|
-
import { join as
|
|
1873
|
+
import { join as join14 } from "path";
|
|
1863
1874
|
|
|
1864
1875
|
// src/types/tool-file.ts
|
|
1865
1876
|
var ToolFile = class extends AiFile {
|
|
1866
1877
|
};
|
|
1867
1878
|
|
|
1868
1879
|
// src/features/ignore/rulesync-ignore.ts
|
|
1869
|
-
import { join as
|
|
1880
|
+
import { join as join13 } from "path";
|
|
1870
1881
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
1871
1882
|
validate() {
|
|
1872
1883
|
return { success: true, error: null };
|
|
@@ -1874,12 +1885,12 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
1874
1885
|
static getSettablePaths() {
|
|
1875
1886
|
return {
|
|
1876
1887
|
relativeDirPath: ".",
|
|
1877
|
-
relativeFilePath:
|
|
1888
|
+
relativeFilePath: RULESYNC_IGNORE_RELATIVE_FILE_PATH
|
|
1878
1889
|
};
|
|
1879
1890
|
}
|
|
1880
1891
|
static async fromFile() {
|
|
1881
1892
|
const baseDir = process.cwd();
|
|
1882
|
-
const filePath =
|
|
1893
|
+
const filePath = join13(baseDir, this.getSettablePaths().relativeFilePath);
|
|
1883
1894
|
const fileContent = await readFileContent(filePath);
|
|
1884
1895
|
return new _RulesyncIgnore({
|
|
1885
1896
|
baseDir,
|
|
@@ -1922,7 +1933,7 @@ var ToolIgnore = class extends ToolFile {
|
|
|
1922
1933
|
return new RulesyncIgnore({
|
|
1923
1934
|
baseDir: ".",
|
|
1924
1935
|
relativeDirPath: ".",
|
|
1925
|
-
relativeFilePath:
|
|
1936
|
+
relativeFilePath: RULESYNC_IGNORE_RELATIVE_FILE_PATH,
|
|
1926
1937
|
fileContent: this.fileContent
|
|
1927
1938
|
});
|
|
1928
1939
|
}
|
|
@@ -1970,7 +1981,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
1970
1981
|
validate = true
|
|
1971
1982
|
}) {
|
|
1972
1983
|
const fileContent = await readFileContent(
|
|
1973
|
-
|
|
1984
|
+
join14(
|
|
1974
1985
|
baseDir,
|
|
1975
1986
|
this.getSettablePaths().relativeDirPath,
|
|
1976
1987
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1987,7 +1998,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
1987
1998
|
};
|
|
1988
1999
|
|
|
1989
2000
|
// src/features/ignore/augmentcode-ignore.ts
|
|
1990
|
-
import { join as
|
|
2001
|
+
import { join as join15 } from "path";
|
|
1991
2002
|
var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
1992
2003
|
static getSettablePaths() {
|
|
1993
2004
|
return {
|
|
@@ -2025,7 +2036,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2025
2036
|
validate = true
|
|
2026
2037
|
}) {
|
|
2027
2038
|
const fileContent = await readFileContent(
|
|
2028
|
-
|
|
2039
|
+
join15(
|
|
2029
2040
|
baseDir,
|
|
2030
2041
|
this.getSettablePaths().relativeDirPath,
|
|
2031
2042
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2042,7 +2053,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2042
2053
|
};
|
|
2043
2054
|
|
|
2044
2055
|
// src/features/ignore/claudecode-ignore.ts
|
|
2045
|
-
import { join as
|
|
2056
|
+
import { join as join16 } from "path";
|
|
2046
2057
|
import { uniq } from "es-toolkit";
|
|
2047
2058
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
2048
2059
|
constructor(params) {
|
|
@@ -2078,7 +2089,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2078
2089
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
2079
2090
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
2080
2091
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
2081
|
-
const filePath =
|
|
2092
|
+
const filePath = join16(
|
|
2082
2093
|
baseDir,
|
|
2083
2094
|
this.getSettablePaths().relativeDirPath,
|
|
2084
2095
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2106,7 +2117,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2106
2117
|
validate = true
|
|
2107
2118
|
}) {
|
|
2108
2119
|
const fileContent = await readFileContent(
|
|
2109
|
-
|
|
2120
|
+
join16(
|
|
2110
2121
|
baseDir,
|
|
2111
2122
|
this.getSettablePaths().relativeDirPath,
|
|
2112
2123
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2123,7 +2134,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2123
2134
|
};
|
|
2124
2135
|
|
|
2125
2136
|
// src/features/ignore/cline-ignore.ts
|
|
2126
|
-
import { join as
|
|
2137
|
+
import { join as join17 } from "path";
|
|
2127
2138
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
2128
2139
|
static getSettablePaths() {
|
|
2129
2140
|
return {
|
|
@@ -2160,7 +2171,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2160
2171
|
validate = true
|
|
2161
2172
|
}) {
|
|
2162
2173
|
const fileContent = await readFileContent(
|
|
2163
|
-
|
|
2174
|
+
join17(
|
|
2164
2175
|
baseDir,
|
|
2165
2176
|
this.getSettablePaths().relativeDirPath,
|
|
2166
2177
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2177,7 +2188,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2177
2188
|
};
|
|
2178
2189
|
|
|
2179
2190
|
// src/features/ignore/cursor-ignore.ts
|
|
2180
|
-
import { join as
|
|
2191
|
+
import { join as join18 } from "path";
|
|
2181
2192
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
2182
2193
|
static getSettablePaths() {
|
|
2183
2194
|
return {
|
|
@@ -2189,7 +2200,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2189
2200
|
return new RulesyncIgnore({
|
|
2190
2201
|
baseDir: ".",
|
|
2191
2202
|
relativeDirPath: ".",
|
|
2192
|
-
relativeFilePath:
|
|
2203
|
+
relativeFilePath: RULESYNC_IGNORE_RELATIVE_FILE_PATH,
|
|
2193
2204
|
fileContent: this.fileContent
|
|
2194
2205
|
});
|
|
2195
2206
|
}
|
|
@@ -2210,7 +2221,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2210
2221
|
validate = true
|
|
2211
2222
|
}) {
|
|
2212
2223
|
const fileContent = await readFileContent(
|
|
2213
|
-
|
|
2224
|
+
join18(
|
|
2214
2225
|
baseDir,
|
|
2215
2226
|
this.getSettablePaths().relativeDirPath,
|
|
2216
2227
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2227,7 +2238,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2227
2238
|
};
|
|
2228
2239
|
|
|
2229
2240
|
// src/features/ignore/geminicli-ignore.ts
|
|
2230
|
-
import { join as
|
|
2241
|
+
import { join as join19 } from "path";
|
|
2231
2242
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
2232
2243
|
static getSettablePaths() {
|
|
2233
2244
|
return {
|
|
@@ -2254,7 +2265,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2254
2265
|
validate = true
|
|
2255
2266
|
}) {
|
|
2256
2267
|
const fileContent = await readFileContent(
|
|
2257
|
-
|
|
2268
|
+
join19(
|
|
2258
2269
|
baseDir,
|
|
2259
2270
|
this.getSettablePaths().relativeDirPath,
|
|
2260
2271
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2271,7 +2282,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2271
2282
|
};
|
|
2272
2283
|
|
|
2273
2284
|
// src/features/ignore/junie-ignore.ts
|
|
2274
|
-
import { join as
|
|
2285
|
+
import { join as join20 } from "path";
|
|
2275
2286
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
2276
2287
|
static getSettablePaths() {
|
|
2277
2288
|
return {
|
|
@@ -2298,7 +2309,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2298
2309
|
validate = true
|
|
2299
2310
|
}) {
|
|
2300
2311
|
const fileContent = await readFileContent(
|
|
2301
|
-
|
|
2312
|
+
join20(
|
|
2302
2313
|
baseDir,
|
|
2303
2314
|
this.getSettablePaths().relativeDirPath,
|
|
2304
2315
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2315,7 +2326,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2315
2326
|
};
|
|
2316
2327
|
|
|
2317
2328
|
// src/features/ignore/kiro-ignore.ts
|
|
2318
|
-
import { join as
|
|
2329
|
+
import { join as join21 } from "path";
|
|
2319
2330
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
2320
2331
|
static getSettablePaths() {
|
|
2321
2332
|
return {
|
|
@@ -2342,7 +2353,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
2342
2353
|
validate = true
|
|
2343
2354
|
}) {
|
|
2344
2355
|
const fileContent = await readFileContent(
|
|
2345
|
-
|
|
2356
|
+
join21(
|
|
2346
2357
|
baseDir,
|
|
2347
2358
|
this.getSettablePaths().relativeDirPath,
|
|
2348
2359
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2359,7 +2370,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
2359
2370
|
};
|
|
2360
2371
|
|
|
2361
2372
|
// src/features/ignore/qwencode-ignore.ts
|
|
2362
|
-
import { join as
|
|
2373
|
+
import { join as join22 } from "path";
|
|
2363
2374
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
2364
2375
|
static getSettablePaths() {
|
|
2365
2376
|
return {
|
|
@@ -2386,7 +2397,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
2386
2397
|
validate = true
|
|
2387
2398
|
}) {
|
|
2388
2399
|
const fileContent = await readFileContent(
|
|
2389
|
-
|
|
2400
|
+
join22(
|
|
2390
2401
|
baseDir,
|
|
2391
2402
|
this.getSettablePaths().relativeDirPath,
|
|
2392
2403
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2403,7 +2414,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
2403
2414
|
};
|
|
2404
2415
|
|
|
2405
2416
|
// src/features/ignore/roo-ignore.ts
|
|
2406
|
-
import { join as
|
|
2417
|
+
import { join as join23 } from "path";
|
|
2407
2418
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
2408
2419
|
static getSettablePaths() {
|
|
2409
2420
|
return {
|
|
@@ -2430,7 +2441,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
2430
2441
|
validate = true
|
|
2431
2442
|
}) {
|
|
2432
2443
|
const fileContent = await readFileContent(
|
|
2433
|
-
|
|
2444
|
+
join23(
|
|
2434
2445
|
baseDir,
|
|
2435
2446
|
this.getSettablePaths().relativeDirPath,
|
|
2436
2447
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2447,7 +2458,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
2447
2458
|
};
|
|
2448
2459
|
|
|
2449
2460
|
// src/features/ignore/windsurf-ignore.ts
|
|
2450
|
-
import { join as
|
|
2461
|
+
import { join as join24 } from "path";
|
|
2451
2462
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
2452
2463
|
static getSettablePaths() {
|
|
2453
2464
|
return {
|
|
@@ -2474,7 +2485,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
2474
2485
|
validate = true
|
|
2475
2486
|
}) {
|
|
2476
2487
|
const fileContent = await readFileContent(
|
|
2477
|
-
|
|
2488
|
+
join24(
|
|
2478
2489
|
baseDir,
|
|
2479
2490
|
this.getSettablePaths().relativeDirPath,
|
|
2480
2491
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2591,7 +2602,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
2591
2602
|
(file) => file instanceof RulesyncIgnore
|
|
2592
2603
|
);
|
|
2593
2604
|
if (!rulesyncIgnore) {
|
|
2594
|
-
throw new Error(`No
|
|
2605
|
+
throw new Error(`No ${RULESYNC_IGNORE_RELATIVE_FILE_PATH} found.`);
|
|
2595
2606
|
}
|
|
2596
2607
|
const toolIgnores = await Promise.all(
|
|
2597
2608
|
[rulesyncIgnore].map(async (rulesyncIgnore2) => {
|
|
@@ -2682,10 +2693,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
2682
2693
|
import { z as z13 } from "zod/mini";
|
|
2683
2694
|
|
|
2684
2695
|
// src/features/mcp/amazonqcli-mcp.ts
|
|
2685
|
-
import { join as
|
|
2696
|
+
import { join as join26 } from "path";
|
|
2686
2697
|
|
|
2687
2698
|
// src/features/mcp/rulesync-mcp.ts
|
|
2688
|
-
import { join as
|
|
2699
|
+
import { join as join25 } from "path";
|
|
2689
2700
|
import { omit } from "es-toolkit/object";
|
|
2690
2701
|
import { z as z12 } from "zod/mini";
|
|
2691
2702
|
var McpTransportTypeSchema = z12.enum(["stdio", "sse", "http"]);
|
|
@@ -2736,11 +2747,11 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
2736
2747
|
static getSettablePaths() {
|
|
2737
2748
|
return {
|
|
2738
2749
|
recommended: {
|
|
2739
|
-
relativeDirPath:
|
|
2750
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
2740
2751
|
relativeFilePath: "mcp.json"
|
|
2741
2752
|
},
|
|
2742
2753
|
legacy: {
|
|
2743
|
-
relativeDirPath:
|
|
2754
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
2744
2755
|
relativeFilePath: ".mcp.json"
|
|
2745
2756
|
}
|
|
2746
2757
|
};
|
|
@@ -2765,12 +2776,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
2765
2776
|
}) {
|
|
2766
2777
|
const baseDir = process.cwd();
|
|
2767
2778
|
const paths = this.getSettablePaths();
|
|
2768
|
-
const recommendedPath =
|
|
2779
|
+
const recommendedPath = join25(
|
|
2769
2780
|
baseDir,
|
|
2770
2781
|
paths.recommended.relativeDirPath,
|
|
2771
2782
|
paths.recommended.relativeFilePath
|
|
2772
2783
|
);
|
|
2773
|
-
const legacyPath =
|
|
2784
|
+
const legacyPath = join25(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
2774
2785
|
if (await fileExists(recommendedPath)) {
|
|
2775
2786
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
2776
2787
|
return new _RulesyncMcp({
|
|
@@ -2855,7 +2866,7 @@ var ToolMcp = class extends ToolFile {
|
|
|
2855
2866
|
} = {}) {
|
|
2856
2867
|
return new RulesyncMcp({
|
|
2857
2868
|
baseDir: this.baseDir,
|
|
2858
|
-
relativeDirPath:
|
|
2869
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
2859
2870
|
relativeFilePath: ".mcp.json",
|
|
2860
2871
|
fileContent: fileContent ?? this.fileContent
|
|
2861
2872
|
});
|
|
@@ -2889,7 +2900,7 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
2889
2900
|
validate = true
|
|
2890
2901
|
}) {
|
|
2891
2902
|
const fileContent = await readFileContent(
|
|
2892
|
-
|
|
2903
|
+
join26(
|
|
2893
2904
|
baseDir,
|
|
2894
2905
|
this.getSettablePaths().relativeDirPath,
|
|
2895
2906
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2925,10 +2936,10 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
2925
2936
|
};
|
|
2926
2937
|
|
|
2927
2938
|
// src/features/mcp/claudecode-mcp.ts
|
|
2928
|
-
import { join as
|
|
2939
|
+
import { join as join28 } from "path";
|
|
2929
2940
|
|
|
2930
2941
|
// src/features/mcp/modular-mcp.ts
|
|
2931
|
-
import { join as
|
|
2942
|
+
import { join as join27 } from "path";
|
|
2932
2943
|
var ModularMcp = class _ModularMcp extends AiFile {
|
|
2933
2944
|
json;
|
|
2934
2945
|
constructor(params) {
|
|
@@ -2983,7 +2994,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
2983
2994
|
args: [
|
|
2984
2995
|
"-y",
|
|
2985
2996
|
"@kimuson/modular-mcp",
|
|
2986
|
-
|
|
2997
|
+
join27(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
2987
2998
|
],
|
|
2988
2999
|
env: {}
|
|
2989
3000
|
}
|
|
@@ -3044,7 +3055,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3044
3055
|
}) {
|
|
3045
3056
|
const paths = this.getSettablePaths({ global });
|
|
3046
3057
|
const fileContent = await readOrInitializeFileContent(
|
|
3047
|
-
|
|
3058
|
+
join28(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3048
3059
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3049
3060
|
);
|
|
3050
3061
|
const json = JSON.parse(fileContent);
|
|
@@ -3066,7 +3077,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3066
3077
|
}) {
|
|
3067
3078
|
const paths = this.getSettablePaths({ global });
|
|
3068
3079
|
const fileContent = await readOrInitializeFileContent(
|
|
3069
|
-
|
|
3080
|
+
join28(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3070
3081
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3071
3082
|
);
|
|
3072
3083
|
const json = JSON.parse(fileContent);
|
|
@@ -3097,7 +3108,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3097
3108
|
};
|
|
3098
3109
|
|
|
3099
3110
|
// src/features/mcp/cline-mcp.ts
|
|
3100
|
-
import { join as
|
|
3111
|
+
import { join as join29 } from "path";
|
|
3101
3112
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
3102
3113
|
json;
|
|
3103
3114
|
constructor(params) {
|
|
@@ -3118,7 +3129,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3118
3129
|
validate = true
|
|
3119
3130
|
}) {
|
|
3120
3131
|
const fileContent = await readFileContent(
|
|
3121
|
-
|
|
3132
|
+
join29(
|
|
3122
3133
|
baseDir,
|
|
3123
3134
|
this.getSettablePaths().relativeDirPath,
|
|
3124
3135
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3154,7 +3165,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3154
3165
|
};
|
|
3155
3166
|
|
|
3156
3167
|
// src/features/mcp/codexcli-mcp.ts
|
|
3157
|
-
import { join as
|
|
3168
|
+
import { join as join30 } from "path";
|
|
3158
3169
|
import * as smolToml from "smol-toml";
|
|
3159
3170
|
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
3160
3171
|
toml;
|
|
@@ -3190,7 +3201,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3190
3201
|
}) {
|
|
3191
3202
|
const paths = this.getSettablePaths({ global });
|
|
3192
3203
|
const fileContent = await readFileContent(
|
|
3193
|
-
|
|
3204
|
+
join30(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3194
3205
|
);
|
|
3195
3206
|
return new _CodexcliMcp({
|
|
3196
3207
|
baseDir,
|
|
@@ -3207,7 +3218,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3207
3218
|
global = false
|
|
3208
3219
|
}) {
|
|
3209
3220
|
const paths = this.getSettablePaths({ global });
|
|
3210
|
-
const configTomlFilePath =
|
|
3221
|
+
const configTomlFilePath = join30(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3211
3222
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
3212
3223
|
configTomlFilePath,
|
|
3213
3224
|
smolToml.stringify({})
|
|
@@ -3227,7 +3238,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3227
3238
|
toRulesyncMcp() {
|
|
3228
3239
|
return new RulesyncMcp({
|
|
3229
3240
|
baseDir: this.baseDir,
|
|
3230
|
-
relativeDirPath:
|
|
3241
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
3231
3242
|
relativeFilePath: ".mcp.json",
|
|
3232
3243
|
fileContent: JSON.stringify({ mcpServers: this.toml.mcp_servers ?? {} }, null, 2)
|
|
3233
3244
|
});
|
|
@@ -3248,7 +3259,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3248
3259
|
};
|
|
3249
3260
|
|
|
3250
3261
|
// src/features/mcp/copilot-mcp.ts
|
|
3251
|
-
import { join as
|
|
3262
|
+
import { join as join31 } from "path";
|
|
3252
3263
|
var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
3253
3264
|
json;
|
|
3254
3265
|
constructor(params) {
|
|
@@ -3269,7 +3280,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3269
3280
|
validate = true
|
|
3270
3281
|
}) {
|
|
3271
3282
|
const fileContent = await readFileContent(
|
|
3272
|
-
|
|
3283
|
+
join31(
|
|
3273
3284
|
baseDir,
|
|
3274
3285
|
this.getSettablePaths().relativeDirPath,
|
|
3275
3286
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3305,7 +3316,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3305
3316
|
};
|
|
3306
3317
|
|
|
3307
3318
|
// src/features/mcp/cursor-mcp.ts
|
|
3308
|
-
import { join as
|
|
3319
|
+
import { join as join32 } from "path";
|
|
3309
3320
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
3310
3321
|
json;
|
|
3311
3322
|
constructor(params) {
|
|
@@ -3326,7 +3337,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
3326
3337
|
validate = true
|
|
3327
3338
|
}) {
|
|
3328
3339
|
const fileContent = await readFileContent(
|
|
3329
|
-
|
|
3340
|
+
join32(
|
|
3330
3341
|
baseDir,
|
|
3331
3342
|
this.getSettablePaths().relativeDirPath,
|
|
3332
3343
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3373,7 +3384,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
3373
3384
|
};
|
|
3374
3385
|
|
|
3375
3386
|
// src/features/mcp/geminicli-mcp.ts
|
|
3376
|
-
import { join as
|
|
3387
|
+
import { join as join33 } from "path";
|
|
3377
3388
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
3378
3389
|
json;
|
|
3379
3390
|
constructor(params) {
|
|
@@ -3402,7 +3413,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3402
3413
|
}) {
|
|
3403
3414
|
const paths = this.getSettablePaths({ global });
|
|
3404
3415
|
const fileContent = await readOrInitializeFileContent(
|
|
3405
|
-
|
|
3416
|
+
join33(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3406
3417
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3407
3418
|
);
|
|
3408
3419
|
const json = JSON.parse(fileContent);
|
|
@@ -3423,7 +3434,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3423
3434
|
}) {
|
|
3424
3435
|
const paths = this.getSettablePaths({ global });
|
|
3425
3436
|
const fileContent = await readOrInitializeFileContent(
|
|
3426
|
-
|
|
3437
|
+
join33(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3427
3438
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3428
3439
|
);
|
|
3429
3440
|
const json = JSON.parse(fileContent);
|
|
@@ -3447,7 +3458,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3447
3458
|
};
|
|
3448
3459
|
|
|
3449
3460
|
// src/features/mcp/roo-mcp.ts
|
|
3450
|
-
import { join as
|
|
3461
|
+
import { join as join34 } from "path";
|
|
3451
3462
|
var RooMcp = class _RooMcp extends ToolMcp {
|
|
3452
3463
|
json;
|
|
3453
3464
|
constructor(params) {
|
|
@@ -3468,7 +3479,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
3468
3479
|
validate = true
|
|
3469
3480
|
}) {
|
|
3470
3481
|
const fileContent = await readFileContent(
|
|
3471
|
-
|
|
3482
|
+
join34(
|
|
3472
3483
|
baseDir,
|
|
3473
3484
|
this.getSettablePaths().relativeDirPath,
|
|
3474
3485
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3660,7 +3671,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
3660
3671
|
(file) => file instanceof RulesyncMcp
|
|
3661
3672
|
);
|
|
3662
3673
|
if (!rulesyncMcp) {
|
|
3663
|
-
throw new Error(`No
|
|
3674
|
+
throw new Error(`No ${RULESYNC_MCP_RELATIVE_FILE_PATH} found.`);
|
|
3664
3675
|
}
|
|
3665
3676
|
const toolMcps = await Promise.all(
|
|
3666
3677
|
[rulesyncMcp].map(async (rulesyncMcp2) => {
|
|
@@ -3751,15 +3762,15 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
3751
3762
|
};
|
|
3752
3763
|
|
|
3753
3764
|
// src/features/rules/rules-processor.ts
|
|
3754
|
-
import { basename as basename17, join as
|
|
3765
|
+
import { basename as basename17, join as join64 } from "path";
|
|
3755
3766
|
import { XMLBuilder } from "fast-xml-parser";
|
|
3756
3767
|
import { z as z22 } from "zod/mini";
|
|
3757
3768
|
|
|
3758
3769
|
// src/features/subagents/agentsmd-subagent.ts
|
|
3759
|
-
import { join as
|
|
3770
|
+
import { join as join36 } from "path";
|
|
3760
3771
|
|
|
3761
3772
|
// src/features/subagents/simulated-subagent.ts
|
|
3762
|
-
import { basename as basename12, join as
|
|
3773
|
+
import { basename as basename12, join as join35 } from "path";
|
|
3763
3774
|
import { z as z14 } from "zod/mini";
|
|
3764
3775
|
|
|
3765
3776
|
// src/features/subagents/tool-subagent.ts
|
|
@@ -3807,7 +3818,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
3807
3818
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
3808
3819
|
if (!result.success) {
|
|
3809
3820
|
throw new Error(
|
|
3810
|
-
`Invalid frontmatter in ${
|
|
3821
|
+
`Invalid frontmatter in ${join35(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
3811
3822
|
);
|
|
3812
3823
|
}
|
|
3813
3824
|
}
|
|
@@ -3858,7 +3869,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
3858
3869
|
return {
|
|
3859
3870
|
success: false,
|
|
3860
3871
|
error: new Error(
|
|
3861
|
-
`Invalid frontmatter in ${
|
|
3872
|
+
`Invalid frontmatter in ${join35(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
3862
3873
|
)
|
|
3863
3874
|
};
|
|
3864
3875
|
}
|
|
@@ -3868,7 +3879,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
3868
3879
|
relativeFilePath,
|
|
3869
3880
|
validate = true
|
|
3870
3881
|
}) {
|
|
3871
|
-
const filePath =
|
|
3882
|
+
const filePath = join35(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
3872
3883
|
const fileContent = await readFileContent(filePath);
|
|
3873
3884
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3874
3885
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -3890,7 +3901,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
3890
3901
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
3891
3902
|
static getSettablePaths() {
|
|
3892
3903
|
return {
|
|
3893
|
-
relativeDirPath:
|
|
3904
|
+
relativeDirPath: join36(".agents", "subagents")
|
|
3894
3905
|
};
|
|
3895
3906
|
}
|
|
3896
3907
|
static async fromFile(params) {
|
|
@@ -3910,11 +3921,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
3910
3921
|
};
|
|
3911
3922
|
|
|
3912
3923
|
// src/features/subagents/codexcli-subagent.ts
|
|
3913
|
-
import { join as
|
|
3924
|
+
import { join as join37 } from "path";
|
|
3914
3925
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
3915
3926
|
static getSettablePaths() {
|
|
3916
3927
|
return {
|
|
3917
|
-
relativeDirPath:
|
|
3928
|
+
relativeDirPath: join37(".codex", "subagents")
|
|
3918
3929
|
};
|
|
3919
3930
|
}
|
|
3920
3931
|
static async fromFile(params) {
|
|
@@ -3934,11 +3945,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
3934
3945
|
};
|
|
3935
3946
|
|
|
3936
3947
|
// src/features/subagents/copilot-subagent.ts
|
|
3937
|
-
import { join as
|
|
3948
|
+
import { join as join38 } from "path";
|
|
3938
3949
|
var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
3939
3950
|
static getSettablePaths() {
|
|
3940
3951
|
return {
|
|
3941
|
-
relativeDirPath:
|
|
3952
|
+
relativeDirPath: join38(".github", "subagents")
|
|
3942
3953
|
};
|
|
3943
3954
|
}
|
|
3944
3955
|
static async fromFile(params) {
|
|
@@ -3958,11 +3969,11 @@ var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
|
3958
3969
|
};
|
|
3959
3970
|
|
|
3960
3971
|
// src/features/subagents/cursor-subagent.ts
|
|
3961
|
-
import { join as
|
|
3972
|
+
import { join as join39 } from "path";
|
|
3962
3973
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
3963
3974
|
static getSettablePaths() {
|
|
3964
3975
|
return {
|
|
3965
|
-
relativeDirPath:
|
|
3976
|
+
relativeDirPath: join39(".cursor", "subagents")
|
|
3966
3977
|
};
|
|
3967
3978
|
}
|
|
3968
3979
|
static async fromFile(params) {
|
|
@@ -3982,11 +3993,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
3982
3993
|
};
|
|
3983
3994
|
|
|
3984
3995
|
// src/features/subagents/geminicli-subagent.ts
|
|
3985
|
-
import { join as
|
|
3996
|
+
import { join as join40 } from "path";
|
|
3986
3997
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
3987
3998
|
static getSettablePaths() {
|
|
3988
3999
|
return {
|
|
3989
|
-
relativeDirPath:
|
|
4000
|
+
relativeDirPath: join40(".gemini", "subagents")
|
|
3990
4001
|
};
|
|
3991
4002
|
}
|
|
3992
4003
|
static async fromFile(params) {
|
|
@@ -4006,11 +4017,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
4006
4017
|
};
|
|
4007
4018
|
|
|
4008
4019
|
// src/features/subagents/roo-subagent.ts
|
|
4009
|
-
import { join as
|
|
4020
|
+
import { join as join41 } from "path";
|
|
4010
4021
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
4011
4022
|
static getSettablePaths() {
|
|
4012
4023
|
return {
|
|
4013
|
-
relativeDirPath:
|
|
4024
|
+
relativeDirPath: join41(".roo", "subagents")
|
|
4014
4025
|
};
|
|
4015
4026
|
}
|
|
4016
4027
|
static async fromFile(params) {
|
|
@@ -4030,15 +4041,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
4030
4041
|
};
|
|
4031
4042
|
|
|
4032
4043
|
// src/features/subagents/subagents-processor.ts
|
|
4033
|
-
import { basename as basename14, join as
|
|
4044
|
+
import { basename as basename14, join as join44 } from "path";
|
|
4034
4045
|
import { z as z17 } from "zod/mini";
|
|
4035
4046
|
|
|
4036
4047
|
// src/features/subagents/claudecode-subagent.ts
|
|
4037
|
-
import { join as
|
|
4048
|
+
import { join as join43 } from "path";
|
|
4038
4049
|
import { z as z16 } from "zod/mini";
|
|
4039
4050
|
|
|
4040
4051
|
// src/features/subagents/rulesync-subagent.ts
|
|
4041
|
-
import { basename as basename13, join as
|
|
4052
|
+
import { basename as basename13, join as join42 } from "path";
|
|
4042
4053
|
import { z as z15 } from "zod/mini";
|
|
4043
4054
|
var RulesyncSubagentModelSchema = z15.enum(["opus", "sonnet", "haiku", "inherit"]);
|
|
4044
4055
|
var RulesyncSubagentFrontmatterSchema = z15.object({
|
|
@@ -4059,7 +4070,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
4059
4070
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
4060
4071
|
if (!result.success) {
|
|
4061
4072
|
throw new Error(
|
|
4062
|
-
`Invalid frontmatter in ${
|
|
4073
|
+
`Invalid frontmatter in ${join42(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
4063
4074
|
);
|
|
4064
4075
|
}
|
|
4065
4076
|
}
|
|
@@ -4072,7 +4083,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
4072
4083
|
}
|
|
4073
4084
|
static getSettablePaths() {
|
|
4074
4085
|
return {
|
|
4075
|
-
relativeDirPath:
|
|
4086
|
+
relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH
|
|
4076
4087
|
};
|
|
4077
4088
|
}
|
|
4078
4089
|
getFrontmatter() {
|
|
@@ -4092,7 +4103,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
4092
4103
|
return {
|
|
4093
4104
|
success: false,
|
|
4094
4105
|
error: new Error(
|
|
4095
|
-
`Invalid frontmatter in ${
|
|
4106
|
+
`Invalid frontmatter in ${join42(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
4096
4107
|
)
|
|
4097
4108
|
};
|
|
4098
4109
|
}
|
|
@@ -4101,7 +4112,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
4101
4112
|
relativeFilePath
|
|
4102
4113
|
}) {
|
|
4103
4114
|
const fileContent = await readFileContent(
|
|
4104
|
-
|
|
4115
|
+
join42(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
4105
4116
|
);
|
|
4106
4117
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
4107
4118
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -4133,7 +4144,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
4133
4144
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
4134
4145
|
if (!result.success) {
|
|
4135
4146
|
throw new Error(
|
|
4136
|
-
`Invalid frontmatter in ${
|
|
4147
|
+
`Invalid frontmatter in ${join43(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
4137
4148
|
);
|
|
4138
4149
|
}
|
|
4139
4150
|
}
|
|
@@ -4145,7 +4156,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
4145
4156
|
}
|
|
4146
4157
|
static getSettablePaths(_options = {}) {
|
|
4147
4158
|
return {
|
|
4148
|
-
relativeDirPath:
|
|
4159
|
+
relativeDirPath: join43(".claude", "agents")
|
|
4149
4160
|
};
|
|
4150
4161
|
}
|
|
4151
4162
|
getFrontmatter() {
|
|
@@ -4170,7 +4181,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
4170
4181
|
// RulesyncCommand baseDir is always the project root directory
|
|
4171
4182
|
frontmatter: rulesyncFrontmatter,
|
|
4172
4183
|
body: this.body,
|
|
4173
|
-
relativeDirPath:
|
|
4184
|
+
relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
|
|
4174
4185
|
relativeFilePath: this.getRelativeFilePath(),
|
|
4175
4186
|
validate: true
|
|
4176
4187
|
});
|
|
@@ -4211,7 +4222,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
4211
4222
|
return {
|
|
4212
4223
|
success: false,
|
|
4213
4224
|
error: new Error(
|
|
4214
|
-
`Invalid frontmatter in ${
|
|
4225
|
+
`Invalid frontmatter in ${join43(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
4215
4226
|
)
|
|
4216
4227
|
};
|
|
4217
4228
|
}
|
|
@@ -4229,7 +4240,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
4229
4240
|
global = false
|
|
4230
4241
|
}) {
|
|
4231
4242
|
const paths = this.getSettablePaths({ global });
|
|
4232
|
-
const filePath =
|
|
4243
|
+
const filePath = join43(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
4233
4244
|
const fileContent = await readFileContent(filePath);
|
|
4234
4245
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
4235
4246
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -4383,7 +4394,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4383
4394
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
4384
4395
|
*/
|
|
4385
4396
|
async loadRulesyncFiles() {
|
|
4386
|
-
const subagentsDir =
|
|
4397
|
+
const subagentsDir = join44(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
4387
4398
|
const dirExists = await directoryExists(subagentsDir);
|
|
4388
4399
|
if (!dirExists) {
|
|
4389
4400
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -4398,7 +4409,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4398
4409
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
4399
4410
|
const rulesyncSubagents = [];
|
|
4400
4411
|
for (const mdFile of mdFiles) {
|
|
4401
|
-
const filepath =
|
|
4412
|
+
const filepath = join44(subagentsDir, mdFile);
|
|
4402
4413
|
try {
|
|
4403
4414
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
4404
4415
|
relativeFilePath: mdFile,
|
|
@@ -4517,7 +4528,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4517
4528
|
relativeDirPath,
|
|
4518
4529
|
fromFile
|
|
4519
4530
|
}) {
|
|
4520
|
-
const paths = await findFilesByGlobs(
|
|
4531
|
+
const paths = await findFilesByGlobs(join44(this.baseDir, relativeDirPath, "*.md"));
|
|
4521
4532
|
const subagents = (await Promise.allSettled(paths.map((path2) => fromFile(basename14(path2))))).filter((r) => r.status === "fulfilled").map((r) => r.value);
|
|
4522
4533
|
logger.info(`Successfully loaded ${subagents.length} ${relativeDirPath} subagents`);
|
|
4523
4534
|
return subagents;
|
|
@@ -4545,13 +4556,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4545
4556
|
};
|
|
4546
4557
|
|
|
4547
4558
|
// src/features/rules/agentsmd-rule.ts
|
|
4548
|
-
import { join as
|
|
4559
|
+
import { join as join47 } from "path";
|
|
4549
4560
|
|
|
4550
4561
|
// src/features/rules/tool-rule.ts
|
|
4551
|
-
import { join as
|
|
4562
|
+
import { join as join46 } from "path";
|
|
4552
4563
|
|
|
4553
4564
|
// src/features/rules/rulesync-rule.ts
|
|
4554
|
-
import { basename as basename15, join as
|
|
4565
|
+
import { basename as basename15, join as join45 } from "path";
|
|
4555
4566
|
import { z as z18 } from "zod/mini";
|
|
4556
4567
|
var RulesyncRuleFrontmatterSchema = z18.object({
|
|
4557
4568
|
root: z18.optional(z18.optional(z18.boolean())),
|
|
@@ -4580,7 +4591,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
4580
4591
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
4581
4592
|
if (!result.success) {
|
|
4582
4593
|
throw new Error(
|
|
4583
|
-
`Invalid frontmatter in ${
|
|
4594
|
+
`Invalid frontmatter in ${join45(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
4584
4595
|
);
|
|
4585
4596
|
}
|
|
4586
4597
|
}
|
|
@@ -4594,10 +4605,10 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
4594
4605
|
static getSettablePaths() {
|
|
4595
4606
|
return {
|
|
4596
4607
|
recommended: {
|
|
4597
|
-
relativeDirPath:
|
|
4608
|
+
relativeDirPath: RULESYNC_RULES_RELATIVE_DIR_PATH
|
|
4598
4609
|
},
|
|
4599
4610
|
legacy: {
|
|
4600
|
-
relativeDirPath:
|
|
4611
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH
|
|
4601
4612
|
}
|
|
4602
4613
|
};
|
|
4603
4614
|
}
|
|
@@ -4615,7 +4626,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
4615
4626
|
return {
|
|
4616
4627
|
success: false,
|
|
4617
4628
|
error: new Error(
|
|
4618
|
-
`Invalid frontmatter in ${
|
|
4629
|
+
`Invalid frontmatter in ${join45(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
4619
4630
|
)
|
|
4620
4631
|
};
|
|
4621
4632
|
}
|
|
@@ -4624,12 +4635,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
4624
4635
|
relativeFilePath,
|
|
4625
4636
|
validate = true
|
|
4626
4637
|
}) {
|
|
4627
|
-
const legacyPath =
|
|
4638
|
+
const legacyPath = join45(
|
|
4628
4639
|
process.cwd(),
|
|
4629
4640
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
4630
4641
|
relativeFilePath
|
|
4631
4642
|
);
|
|
4632
|
-
const recommendedPath =
|
|
4643
|
+
const recommendedPath = join45(
|
|
4633
4644
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
4634
4645
|
relativeFilePath
|
|
4635
4646
|
);
|
|
@@ -4662,7 +4673,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
4662
4673
|
relativeFilePath,
|
|
4663
4674
|
validate = true
|
|
4664
4675
|
}) {
|
|
4665
|
-
const filePath =
|
|
4676
|
+
const filePath = join45(
|
|
4666
4677
|
process.cwd(),
|
|
4667
4678
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
4668
4679
|
relativeFilePath
|
|
@@ -4756,7 +4767,7 @@ var ToolRule = class extends ToolFile {
|
|
|
4756
4767
|
rulesyncRule,
|
|
4757
4768
|
validate = true,
|
|
4758
4769
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
4759
|
-
nonRootPath = { relativeDirPath:
|
|
4770
|
+
nonRootPath = { relativeDirPath: join46(".agents", "memories") }
|
|
4760
4771
|
}) {
|
|
4761
4772
|
const params = this.buildToolRuleParamsDefault({
|
|
4762
4773
|
baseDir,
|
|
@@ -4767,17 +4778,16 @@ var ToolRule = class extends ToolFile {
|
|
|
4767
4778
|
});
|
|
4768
4779
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
4769
4780
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
4770
|
-
params.relativeDirPath =
|
|
4781
|
+
params.relativeDirPath = join46(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
4771
4782
|
params.relativeFilePath = "AGENTS.md";
|
|
4772
4783
|
}
|
|
4773
4784
|
return params;
|
|
4774
4785
|
}
|
|
4775
4786
|
toRulesyncRuleDefault() {
|
|
4776
4787
|
return new RulesyncRule({
|
|
4777
|
-
baseDir:
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
relativeFilePath: this.getRelativeFilePath(),
|
|
4788
|
+
baseDir: process.cwd(),
|
|
4789
|
+
relativeDirPath: RULESYNC_RULES_RELATIVE_DIR_PATH,
|
|
4790
|
+
relativeFilePath: this.isRoot() ? RULESYNC_OVERVIEW_FILE_NAME : this.getRelativeFilePath(),
|
|
4781
4791
|
frontmatter: {
|
|
4782
4792
|
root: this.isRoot(),
|
|
4783
4793
|
targets: ["*"],
|
|
@@ -4833,7 +4843,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
4833
4843
|
relativeFilePath: "AGENTS.md"
|
|
4834
4844
|
},
|
|
4835
4845
|
nonRoot: {
|
|
4836
|
-
relativeDirPath:
|
|
4846
|
+
relativeDirPath: join47(".agents", "memories")
|
|
4837
4847
|
}
|
|
4838
4848
|
};
|
|
4839
4849
|
}
|
|
@@ -4843,8 +4853,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
4843
4853
|
validate = true
|
|
4844
4854
|
}) {
|
|
4845
4855
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
4846
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
4847
|
-
const fileContent = await readFileContent(
|
|
4856
|
+
const relativePath = isRoot ? "AGENTS.md" : join47(".agents", "memories", relativeFilePath);
|
|
4857
|
+
const fileContent = await readFileContent(join47(baseDir, relativePath));
|
|
4848
4858
|
return new _AgentsMdRule({
|
|
4849
4859
|
baseDir,
|
|
4850
4860
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4884,12 +4894,12 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
4884
4894
|
};
|
|
4885
4895
|
|
|
4886
4896
|
// src/features/rules/amazonqcli-rule.ts
|
|
4887
|
-
import { join as
|
|
4897
|
+
import { join as join48 } from "path";
|
|
4888
4898
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
4889
4899
|
static getSettablePaths() {
|
|
4890
4900
|
return {
|
|
4891
4901
|
nonRoot: {
|
|
4892
|
-
relativeDirPath:
|
|
4902
|
+
relativeDirPath: join48(".amazonq", "rules")
|
|
4893
4903
|
}
|
|
4894
4904
|
};
|
|
4895
4905
|
}
|
|
@@ -4899,7 +4909,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
4899
4909
|
validate = true
|
|
4900
4910
|
}) {
|
|
4901
4911
|
const fileContent = await readFileContent(
|
|
4902
|
-
|
|
4912
|
+
join48(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4903
4913
|
);
|
|
4904
4914
|
return new _AmazonQCliRule({
|
|
4905
4915
|
baseDir,
|
|
@@ -4939,7 +4949,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
4939
4949
|
};
|
|
4940
4950
|
|
|
4941
4951
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
4942
|
-
import { join as
|
|
4952
|
+
import { join as join49 } from "path";
|
|
4943
4953
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
4944
4954
|
toRulesyncRule() {
|
|
4945
4955
|
const rulesyncFrontmatter = {
|
|
@@ -4953,7 +4963,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
4953
4963
|
// RulesyncRule baseDir is always the project root directory
|
|
4954
4964
|
frontmatter: rulesyncFrontmatter,
|
|
4955
4965
|
body: this.getFileContent(),
|
|
4956
|
-
relativeDirPath:
|
|
4966
|
+
relativeDirPath: RULESYNC_RULES_RELATIVE_DIR_PATH,
|
|
4957
4967
|
relativeFilePath: this.getRelativeFilePath(),
|
|
4958
4968
|
validate: true
|
|
4959
4969
|
});
|
|
@@ -4965,7 +4975,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
4965
4975
|
relativeFilePath: ".augment-guidelines"
|
|
4966
4976
|
},
|
|
4967
4977
|
nonRoot: {
|
|
4968
|
-
relativeDirPath:
|
|
4978
|
+
relativeDirPath: join49(".augment", "rules")
|
|
4969
4979
|
}
|
|
4970
4980
|
};
|
|
4971
4981
|
}
|
|
@@ -5000,8 +5010,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
5000
5010
|
}) {
|
|
5001
5011
|
const settablePaths = this.getSettablePaths();
|
|
5002
5012
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
5003
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
5004
|
-
const fileContent = await readFileContent(
|
|
5013
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join49(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
5014
|
+
const fileContent = await readFileContent(join49(baseDir, relativePath));
|
|
5005
5015
|
return new _AugmentcodeLegacyRule({
|
|
5006
5016
|
baseDir,
|
|
5007
5017
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -5014,7 +5024,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
5014
5024
|
};
|
|
5015
5025
|
|
|
5016
5026
|
// src/features/rules/augmentcode-rule.ts
|
|
5017
|
-
import { join as
|
|
5027
|
+
import { join as join50 } from "path";
|
|
5018
5028
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
5019
5029
|
toRulesyncRule() {
|
|
5020
5030
|
return this.toRulesyncRuleDefault();
|
|
@@ -5022,7 +5032,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
5022
5032
|
static getSettablePaths() {
|
|
5023
5033
|
return {
|
|
5024
5034
|
nonRoot: {
|
|
5025
|
-
relativeDirPath:
|
|
5035
|
+
relativeDirPath: join50(".augment", "rules")
|
|
5026
5036
|
}
|
|
5027
5037
|
};
|
|
5028
5038
|
}
|
|
@@ -5046,7 +5056,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
5046
5056
|
validate = true
|
|
5047
5057
|
}) {
|
|
5048
5058
|
const fileContent = await readFileContent(
|
|
5049
|
-
|
|
5059
|
+
join50(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
5050
5060
|
);
|
|
5051
5061
|
const { body: content } = parseFrontmatter(fileContent);
|
|
5052
5062
|
return new _AugmentcodeRule({
|
|
@@ -5069,7 +5079,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
5069
5079
|
};
|
|
5070
5080
|
|
|
5071
5081
|
// src/features/rules/claudecode-rule.ts
|
|
5072
|
-
import { join as
|
|
5082
|
+
import { join as join51 } from "path";
|
|
5073
5083
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
5074
5084
|
static getSettablePaths({
|
|
5075
5085
|
global
|
|
@@ -5088,7 +5098,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
5088
5098
|
relativeFilePath: "CLAUDE.md"
|
|
5089
5099
|
},
|
|
5090
5100
|
nonRoot: {
|
|
5091
|
-
relativeDirPath:
|
|
5101
|
+
relativeDirPath: join51(".claude", "memories")
|
|
5092
5102
|
}
|
|
5093
5103
|
};
|
|
5094
5104
|
}
|
|
@@ -5103,7 +5113,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
5103
5113
|
if (isRoot) {
|
|
5104
5114
|
const relativePath2 = paths.root.relativeFilePath;
|
|
5105
5115
|
const fileContent2 = await readFileContent(
|
|
5106
|
-
|
|
5116
|
+
join51(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
5107
5117
|
);
|
|
5108
5118
|
return new _ClaudecodeRule({
|
|
5109
5119
|
baseDir,
|
|
@@ -5117,8 +5127,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
5117
5127
|
if (!paths.nonRoot) {
|
|
5118
5128
|
throw new Error("nonRoot path is not set");
|
|
5119
5129
|
}
|
|
5120
|
-
const relativePath =
|
|
5121
|
-
const fileContent = await readFileContent(
|
|
5130
|
+
const relativePath = join51(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
5131
|
+
const fileContent = await readFileContent(join51(baseDir, relativePath));
|
|
5122
5132
|
return new _ClaudecodeRule({
|
|
5123
5133
|
baseDir,
|
|
5124
5134
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -5160,7 +5170,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
5160
5170
|
};
|
|
5161
5171
|
|
|
5162
5172
|
// src/features/rules/cline-rule.ts
|
|
5163
|
-
import { join as
|
|
5173
|
+
import { join as join52 } from "path";
|
|
5164
5174
|
import { z as z19 } from "zod/mini";
|
|
5165
5175
|
var ClineRuleFrontmatterSchema = z19.object({
|
|
5166
5176
|
description: z19.string()
|
|
@@ -5205,7 +5215,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
5205
5215
|
validate = true
|
|
5206
5216
|
}) {
|
|
5207
5217
|
const fileContent = await readFileContent(
|
|
5208
|
-
|
|
5218
|
+
join52(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
5209
5219
|
);
|
|
5210
5220
|
return new _ClineRule({
|
|
5211
5221
|
baseDir,
|
|
@@ -5218,7 +5228,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
5218
5228
|
};
|
|
5219
5229
|
|
|
5220
5230
|
// src/features/rules/codexcli-rule.ts
|
|
5221
|
-
import { join as
|
|
5231
|
+
import { join as join53 } from "path";
|
|
5222
5232
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
5223
5233
|
static getSettablePaths({
|
|
5224
5234
|
global
|
|
@@ -5237,7 +5247,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
5237
5247
|
relativeFilePath: "AGENTS.md"
|
|
5238
5248
|
},
|
|
5239
5249
|
nonRoot: {
|
|
5240
|
-
relativeDirPath:
|
|
5250
|
+
relativeDirPath: join53(".codex", "memories")
|
|
5241
5251
|
}
|
|
5242
5252
|
};
|
|
5243
5253
|
}
|
|
@@ -5252,7 +5262,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
5252
5262
|
if (isRoot) {
|
|
5253
5263
|
const relativePath2 = paths.root.relativeFilePath;
|
|
5254
5264
|
const fileContent2 = await readFileContent(
|
|
5255
|
-
|
|
5265
|
+
join53(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
5256
5266
|
);
|
|
5257
5267
|
return new _CodexcliRule({
|
|
5258
5268
|
baseDir,
|
|
@@ -5266,8 +5276,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
5266
5276
|
if (!paths.nonRoot) {
|
|
5267
5277
|
throw new Error("nonRoot path is not set");
|
|
5268
5278
|
}
|
|
5269
|
-
const relativePath =
|
|
5270
|
-
const fileContent = await readFileContent(
|
|
5279
|
+
const relativePath = join53(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
5280
|
+
const fileContent = await readFileContent(join53(baseDir, relativePath));
|
|
5271
5281
|
return new _CodexcliRule({
|
|
5272
5282
|
baseDir,
|
|
5273
5283
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -5309,7 +5319,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
5309
5319
|
};
|
|
5310
5320
|
|
|
5311
5321
|
// src/features/rules/copilot-rule.ts
|
|
5312
|
-
import { join as
|
|
5322
|
+
import { join as join54 } from "path";
|
|
5313
5323
|
import { z as z20 } from "zod/mini";
|
|
5314
5324
|
var CopilotRuleFrontmatterSchema = z20.object({
|
|
5315
5325
|
description: z20.optional(z20.string()),
|
|
@@ -5325,7 +5335,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
5325
5335
|
relativeFilePath: "copilot-instructions.md"
|
|
5326
5336
|
},
|
|
5327
5337
|
nonRoot: {
|
|
5328
|
-
relativeDirPath:
|
|
5338
|
+
relativeDirPath: join54(".github", "instructions")
|
|
5329
5339
|
}
|
|
5330
5340
|
};
|
|
5331
5341
|
}
|
|
@@ -5334,7 +5344,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
5334
5344
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
5335
5345
|
if (!result.success) {
|
|
5336
5346
|
throw new Error(
|
|
5337
|
-
`Invalid frontmatter in ${
|
|
5347
|
+
`Invalid frontmatter in ${join54(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5338
5348
|
);
|
|
5339
5349
|
}
|
|
5340
5350
|
}
|
|
@@ -5365,7 +5375,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
5365
5375
|
baseDir: this.getBaseDir(),
|
|
5366
5376
|
frontmatter: rulesyncFrontmatter,
|
|
5367
5377
|
body: this.body,
|
|
5368
|
-
relativeDirPath:
|
|
5378
|
+
relativeDirPath: RULESYNC_RULES_RELATIVE_DIR_PATH,
|
|
5369
5379
|
relativeFilePath,
|
|
5370
5380
|
validate: true
|
|
5371
5381
|
});
|
|
@@ -5412,11 +5422,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
5412
5422
|
validate = true
|
|
5413
5423
|
}) {
|
|
5414
5424
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
5415
|
-
const relativePath = isRoot ?
|
|
5425
|
+
const relativePath = isRoot ? join54(
|
|
5416
5426
|
this.getSettablePaths().root.relativeDirPath,
|
|
5417
5427
|
this.getSettablePaths().root.relativeFilePath
|
|
5418
|
-
) :
|
|
5419
|
-
const fileContent = await readFileContent(
|
|
5428
|
+
) : join54(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
5429
|
+
const fileContent = await readFileContent(join54(baseDir, relativePath));
|
|
5420
5430
|
if (isRoot) {
|
|
5421
5431
|
return new _CopilotRule({
|
|
5422
5432
|
baseDir,
|
|
@@ -5435,7 +5445,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
5435
5445
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
5436
5446
|
if (!result.success) {
|
|
5437
5447
|
throw new Error(
|
|
5438
|
-
`Invalid frontmatter in ${
|
|
5448
|
+
`Invalid frontmatter in ${join54(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
5439
5449
|
);
|
|
5440
5450
|
}
|
|
5441
5451
|
return new _CopilotRule({
|
|
@@ -5459,7 +5469,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
5459
5469
|
return {
|
|
5460
5470
|
success: false,
|
|
5461
5471
|
error: new Error(
|
|
5462
|
-
`Invalid frontmatter in ${
|
|
5472
|
+
`Invalid frontmatter in ${join54(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5463
5473
|
)
|
|
5464
5474
|
};
|
|
5465
5475
|
}
|
|
@@ -5479,7 +5489,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
5479
5489
|
};
|
|
5480
5490
|
|
|
5481
5491
|
// src/features/rules/cursor-rule.ts
|
|
5482
|
-
import { basename as basename16, join as
|
|
5492
|
+
import { basename as basename16, join as join55 } from "path";
|
|
5483
5493
|
import { z as z21 } from "zod/mini";
|
|
5484
5494
|
var CursorRuleFrontmatterSchema = z21.object({
|
|
5485
5495
|
description: z21.optional(z21.string()),
|
|
@@ -5492,7 +5502,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
5492
5502
|
static getSettablePaths() {
|
|
5493
5503
|
return {
|
|
5494
5504
|
nonRoot: {
|
|
5495
|
-
relativeDirPath:
|
|
5505
|
+
relativeDirPath: join55(".cursor", "rules")
|
|
5496
5506
|
}
|
|
5497
5507
|
};
|
|
5498
5508
|
}
|
|
@@ -5501,7 +5511,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
5501
5511
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
5502
5512
|
if (!result.success) {
|
|
5503
5513
|
throw new Error(
|
|
5504
|
-
`Invalid frontmatter in ${
|
|
5514
|
+
`Invalid frontmatter in ${join55(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5505
5515
|
);
|
|
5506
5516
|
}
|
|
5507
5517
|
}
|
|
@@ -5573,7 +5583,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
5573
5583
|
return new RulesyncRule({
|
|
5574
5584
|
frontmatter: rulesyncFrontmatter,
|
|
5575
5585
|
body: this.body,
|
|
5576
|
-
relativeDirPath:
|
|
5586
|
+
relativeDirPath: RULESYNC_RULES_RELATIVE_DIR_PATH,
|
|
5577
5587
|
relativeFilePath: this.relativeFilePath.replace(/\.mdc$/, ".md"),
|
|
5578
5588
|
validate: true
|
|
5579
5589
|
});
|
|
@@ -5618,13 +5628,13 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
5618
5628
|
validate = true
|
|
5619
5629
|
}) {
|
|
5620
5630
|
const fileContent = await readFileContent(
|
|
5621
|
-
|
|
5631
|
+
join55(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
5622
5632
|
);
|
|
5623
5633
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
5624
5634
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
5625
5635
|
if (!result.success) {
|
|
5626
5636
|
throw new Error(
|
|
5627
|
-
`Invalid frontmatter in ${
|
|
5637
|
+
`Invalid frontmatter in ${join55(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
5628
5638
|
);
|
|
5629
5639
|
}
|
|
5630
5640
|
return new _CursorRule({
|
|
@@ -5647,7 +5657,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
5647
5657
|
return {
|
|
5648
5658
|
success: false,
|
|
5649
5659
|
error: new Error(
|
|
5650
|
-
`Invalid frontmatter in ${
|
|
5660
|
+
`Invalid frontmatter in ${join55(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5651
5661
|
)
|
|
5652
5662
|
};
|
|
5653
5663
|
}
|
|
@@ -5667,7 +5677,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
5667
5677
|
};
|
|
5668
5678
|
|
|
5669
5679
|
// src/features/rules/geminicli-rule.ts
|
|
5670
|
-
import { join as
|
|
5680
|
+
import { join as join56 } from "path";
|
|
5671
5681
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
5672
5682
|
static getSettablePaths({
|
|
5673
5683
|
global
|
|
@@ -5686,7 +5696,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
5686
5696
|
relativeFilePath: "GEMINI.md"
|
|
5687
5697
|
},
|
|
5688
5698
|
nonRoot: {
|
|
5689
|
-
relativeDirPath:
|
|
5699
|
+
relativeDirPath: join56(".gemini", "memories")
|
|
5690
5700
|
}
|
|
5691
5701
|
};
|
|
5692
5702
|
}
|
|
@@ -5701,7 +5711,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
5701
5711
|
if (isRoot) {
|
|
5702
5712
|
const relativePath2 = paths.root.relativeFilePath;
|
|
5703
5713
|
const fileContent2 = await readFileContent(
|
|
5704
|
-
|
|
5714
|
+
join56(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
5705
5715
|
);
|
|
5706
5716
|
return new _GeminiCliRule({
|
|
5707
5717
|
baseDir,
|
|
@@ -5715,8 +5725,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
5715
5725
|
if (!paths.nonRoot) {
|
|
5716
5726
|
throw new Error("nonRoot path is not set");
|
|
5717
5727
|
}
|
|
5718
|
-
const relativePath =
|
|
5719
|
-
const fileContent = await readFileContent(
|
|
5728
|
+
const relativePath = join56(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
5729
|
+
const fileContent = await readFileContent(join56(baseDir, relativePath));
|
|
5720
5730
|
return new _GeminiCliRule({
|
|
5721
5731
|
baseDir,
|
|
5722
5732
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -5758,7 +5768,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
5758
5768
|
};
|
|
5759
5769
|
|
|
5760
5770
|
// src/features/rules/junie-rule.ts
|
|
5761
|
-
import { join as
|
|
5771
|
+
import { join as join57 } from "path";
|
|
5762
5772
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
5763
5773
|
static getSettablePaths() {
|
|
5764
5774
|
return {
|
|
@@ -5767,7 +5777,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
5767
5777
|
relativeFilePath: "guidelines.md"
|
|
5768
5778
|
},
|
|
5769
5779
|
nonRoot: {
|
|
5770
|
-
relativeDirPath:
|
|
5780
|
+
relativeDirPath: join57(".junie", "memories")
|
|
5771
5781
|
}
|
|
5772
5782
|
};
|
|
5773
5783
|
}
|
|
@@ -5777,8 +5787,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
5777
5787
|
validate = true
|
|
5778
5788
|
}) {
|
|
5779
5789
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
5780
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
5781
|
-
const fileContent = await readFileContent(
|
|
5790
|
+
const relativePath = isRoot ? "guidelines.md" : join57(".junie", "memories", relativeFilePath);
|
|
5791
|
+
const fileContent = await readFileContent(join57(baseDir, relativePath));
|
|
5782
5792
|
return new _JunieRule({
|
|
5783
5793
|
baseDir,
|
|
5784
5794
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -5818,12 +5828,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
5818
5828
|
};
|
|
5819
5829
|
|
|
5820
5830
|
// src/features/rules/kiro-rule.ts
|
|
5821
|
-
import { join as
|
|
5831
|
+
import { join as join58 } from "path";
|
|
5822
5832
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
5823
5833
|
static getSettablePaths() {
|
|
5824
5834
|
return {
|
|
5825
5835
|
nonRoot: {
|
|
5826
|
-
relativeDirPath:
|
|
5836
|
+
relativeDirPath: join58(".kiro", "steering")
|
|
5827
5837
|
}
|
|
5828
5838
|
};
|
|
5829
5839
|
}
|
|
@@ -5833,7 +5843,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
5833
5843
|
validate = true
|
|
5834
5844
|
}) {
|
|
5835
5845
|
const fileContent = await readFileContent(
|
|
5836
|
-
|
|
5846
|
+
join58(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
5837
5847
|
);
|
|
5838
5848
|
return new _KiroRule({
|
|
5839
5849
|
baseDir,
|
|
@@ -5873,7 +5883,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
5873
5883
|
};
|
|
5874
5884
|
|
|
5875
5885
|
// src/features/rules/opencode-rule.ts
|
|
5876
|
-
import { join as
|
|
5886
|
+
import { join as join59 } from "path";
|
|
5877
5887
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
5878
5888
|
static getSettablePaths() {
|
|
5879
5889
|
return {
|
|
@@ -5882,7 +5892,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
5882
5892
|
relativeFilePath: "AGENTS.md"
|
|
5883
5893
|
},
|
|
5884
5894
|
nonRoot: {
|
|
5885
|
-
relativeDirPath:
|
|
5895
|
+
relativeDirPath: join59(".opencode", "memories")
|
|
5886
5896
|
}
|
|
5887
5897
|
};
|
|
5888
5898
|
}
|
|
@@ -5892,8 +5902,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
5892
5902
|
validate = true
|
|
5893
5903
|
}) {
|
|
5894
5904
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
5895
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
5896
|
-
const fileContent = await readFileContent(
|
|
5905
|
+
const relativePath = isRoot ? "AGENTS.md" : join59(".opencode", "memories", relativeFilePath);
|
|
5906
|
+
const fileContent = await readFileContent(join59(baseDir, relativePath));
|
|
5897
5907
|
return new _OpenCodeRule({
|
|
5898
5908
|
baseDir,
|
|
5899
5909
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -5933,7 +5943,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
5933
5943
|
};
|
|
5934
5944
|
|
|
5935
5945
|
// src/features/rules/qwencode-rule.ts
|
|
5936
|
-
import { join as
|
|
5946
|
+
import { join as join60 } from "path";
|
|
5937
5947
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
5938
5948
|
static getSettablePaths() {
|
|
5939
5949
|
return {
|
|
@@ -5942,7 +5952,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
5942
5952
|
relativeFilePath: "QWEN.md"
|
|
5943
5953
|
},
|
|
5944
5954
|
nonRoot: {
|
|
5945
|
-
relativeDirPath:
|
|
5955
|
+
relativeDirPath: join60(".qwen", "memories")
|
|
5946
5956
|
}
|
|
5947
5957
|
};
|
|
5948
5958
|
}
|
|
@@ -5952,8 +5962,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
5952
5962
|
validate = true
|
|
5953
5963
|
}) {
|
|
5954
5964
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
5955
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
5956
|
-
const fileContent = await readFileContent(
|
|
5965
|
+
const relativePath = isRoot ? "QWEN.md" : join60(".qwen", "memories", relativeFilePath);
|
|
5966
|
+
const fileContent = await readFileContent(join60(baseDir, relativePath));
|
|
5957
5967
|
return new _QwencodeRule({
|
|
5958
5968
|
baseDir,
|
|
5959
5969
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -5990,12 +6000,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
5990
6000
|
};
|
|
5991
6001
|
|
|
5992
6002
|
// src/features/rules/roo-rule.ts
|
|
5993
|
-
import { join as
|
|
6003
|
+
import { join as join61 } from "path";
|
|
5994
6004
|
var RooRule = class _RooRule extends ToolRule {
|
|
5995
6005
|
static getSettablePaths() {
|
|
5996
6006
|
return {
|
|
5997
6007
|
nonRoot: {
|
|
5998
|
-
relativeDirPath:
|
|
6008
|
+
relativeDirPath: join61(".roo", "rules")
|
|
5999
6009
|
}
|
|
6000
6010
|
};
|
|
6001
6011
|
}
|
|
@@ -6005,7 +6015,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
6005
6015
|
validate = true
|
|
6006
6016
|
}) {
|
|
6007
6017
|
const fileContent = await readFileContent(
|
|
6008
|
-
|
|
6018
|
+
join61(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6009
6019
|
);
|
|
6010
6020
|
return new _RooRule({
|
|
6011
6021
|
baseDir,
|
|
@@ -6060,7 +6070,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
6060
6070
|
};
|
|
6061
6071
|
|
|
6062
6072
|
// src/features/rules/warp-rule.ts
|
|
6063
|
-
import { join as
|
|
6073
|
+
import { join as join62 } from "path";
|
|
6064
6074
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
6065
6075
|
constructor({ fileContent, root, ...rest }) {
|
|
6066
6076
|
super({
|
|
@@ -6076,7 +6086,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
6076
6086
|
relativeFilePath: "WARP.md"
|
|
6077
6087
|
},
|
|
6078
6088
|
nonRoot: {
|
|
6079
|
-
relativeDirPath:
|
|
6089
|
+
relativeDirPath: join62(".warp", "memories")
|
|
6080
6090
|
}
|
|
6081
6091
|
};
|
|
6082
6092
|
}
|
|
@@ -6086,8 +6096,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
6086
6096
|
validate = true
|
|
6087
6097
|
}) {
|
|
6088
6098
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
6089
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
6090
|
-
const fileContent = await readFileContent(
|
|
6099
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join62(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
6100
|
+
const fileContent = await readFileContent(join62(baseDir, relativePath));
|
|
6091
6101
|
return new _WarpRule({
|
|
6092
6102
|
baseDir,
|
|
6093
6103
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -6127,12 +6137,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
6127
6137
|
};
|
|
6128
6138
|
|
|
6129
6139
|
// src/features/rules/windsurf-rule.ts
|
|
6130
|
-
import { join as
|
|
6140
|
+
import { join as join63 } from "path";
|
|
6131
6141
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
6132
6142
|
static getSettablePaths() {
|
|
6133
6143
|
return {
|
|
6134
6144
|
nonRoot: {
|
|
6135
|
-
relativeDirPath:
|
|
6145
|
+
relativeDirPath: join63(".windsurf", "rules")
|
|
6136
6146
|
}
|
|
6137
6147
|
};
|
|
6138
6148
|
}
|
|
@@ -6142,7 +6152,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
6142
6152
|
validate = true
|
|
6143
6153
|
}) {
|
|
6144
6154
|
const fileContent = await readFileContent(
|
|
6145
|
-
|
|
6155
|
+
join63(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6146
6156
|
);
|
|
6147
6157
|
return new _WindsurfRule({
|
|
6148
6158
|
baseDir,
|
|
@@ -6542,7 +6552,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
6542
6552
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
6543
6553
|
*/
|
|
6544
6554
|
async loadRulesyncFiles() {
|
|
6545
|
-
const files = await findFilesByGlobs(
|
|
6555
|
+
const files = await findFilesByGlobs(join64(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
6546
6556
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
6547
6557
|
const rulesyncRules = await Promise.all(
|
|
6548
6558
|
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename17(file) }))
|
|
@@ -6563,7 +6573,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
6563
6573
|
return rulesyncRules;
|
|
6564
6574
|
}
|
|
6565
6575
|
async loadRulesyncFilesLegacy() {
|
|
6566
|
-
const legacyFiles = await findFilesByGlobs(
|
|
6576
|
+
const legacyFiles = await findFilesByGlobs(join64(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
6567
6577
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
6568
6578
|
return Promise.all(
|
|
6569
6579
|
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename17(file) }))
|
|
@@ -6630,7 +6640,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
6630
6640
|
return [];
|
|
6631
6641
|
}
|
|
6632
6642
|
const rootFilePaths = await findFilesByGlobs(
|
|
6633
|
-
|
|
6643
|
+
join64(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
|
|
6634
6644
|
);
|
|
6635
6645
|
return await Promise.all(
|
|
6636
6646
|
rootFilePaths.map(
|
|
@@ -6648,7 +6658,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
6648
6658
|
return [];
|
|
6649
6659
|
}
|
|
6650
6660
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
6651
|
-
|
|
6661
|
+
join64(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
|
|
6652
6662
|
);
|
|
6653
6663
|
return await Promise.all(
|
|
6654
6664
|
nonRootFilePaths.map(
|
|
@@ -7024,14 +7034,14 @@ s/<command> [arguments]
|
|
|
7024
7034
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
7025
7035
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
7026
7036
|
|
|
7027
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
7037
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join64(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
7028
7038
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
7029
7039
|
|
|
7030
7040
|
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.
|
|
7031
7041
|
|
|
7032
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
7042
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join64(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
7033
7043
|
|
|
7034
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
7044
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join64(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
7035
7045
|
const result = [
|
|
7036
7046
|
overview,
|
|
7037
7047
|
...this.simulateCommands && CommandsProcessor.getToolTargetsSimulated().includes(this.toolTarget) ? [commandsSection] : [],
|
|
@@ -7046,7 +7056,7 @@ async function generateCommand(options) {
|
|
|
7046
7056
|
const config = await ConfigResolver.resolve(options);
|
|
7047
7057
|
logger.setVerbose(config.getVerbose());
|
|
7048
7058
|
logger.info("Generating files...");
|
|
7049
|
-
if (!await fileExists(
|
|
7059
|
+
if (!await fileExists(RULESYNC_RELATIVE_DIR_PATH)) {
|
|
7050
7060
|
logger.error("\u274C .rulesync directory not found. Run 'rulesync init' first.");
|
|
7051
7061
|
process.exit(1);
|
|
7052
7062
|
}
|
|
@@ -7245,9 +7255,9 @@ async function generateSubagents(config) {
|
|
|
7245
7255
|
}
|
|
7246
7256
|
|
|
7247
7257
|
// src/cli/commands/gitignore.ts
|
|
7248
|
-
import { join as
|
|
7258
|
+
import { join as join65 } from "path";
|
|
7249
7259
|
var gitignoreCommand = async () => {
|
|
7250
|
-
const gitignorePath =
|
|
7260
|
+
const gitignorePath = join65(process.cwd(), ".gitignore");
|
|
7251
7261
|
const rulesFilesToIgnore = [
|
|
7252
7262
|
"# Generated by rulesync - AI tool configuration files",
|
|
7253
7263
|
// AGENTS.md
|
|
@@ -7488,24 +7498,26 @@ async function importSubagents(config, tool) {
|
|
|
7488
7498
|
}
|
|
7489
7499
|
|
|
7490
7500
|
// src/cli/commands/init.ts
|
|
7491
|
-
import { join as
|
|
7501
|
+
import { join as join66 } from "path";
|
|
7492
7502
|
async function initCommand() {
|
|
7493
7503
|
logger.info("Initializing rulesync...");
|
|
7494
|
-
await ensureDir(
|
|
7504
|
+
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
7495
7505
|
await createSampleFiles();
|
|
7496
7506
|
await createConfigFile();
|
|
7497
7507
|
logger.success("rulesync initialized successfully!");
|
|
7498
7508
|
logger.info("Next steps:");
|
|
7499
|
-
logger.info(
|
|
7509
|
+
logger.info(
|
|
7510
|
+
`1. Edit ${RULESYNC_RELATIVE_DIR_PATH}/**/*.md, ${RULESYNC_MCP_RELATIVE_FILE_PATH} and ${RULESYNC_IGNORE_RELATIVE_FILE_PATH}`
|
|
7511
|
+
);
|
|
7500
7512
|
logger.info("2. Run 'rulesync generate' to create configuration files");
|
|
7501
7513
|
}
|
|
7502
7514
|
async function createConfigFile() {
|
|
7503
|
-
if (await fileExists(
|
|
7504
|
-
logger.info(
|
|
7515
|
+
if (await fileExists(RULESYNC_CONFIG_RELATIVE_FILE_PATH)) {
|
|
7516
|
+
logger.info(`Skipped ${RULESYNC_CONFIG_RELATIVE_FILE_PATH} (already exists)`);
|
|
7505
7517
|
return;
|
|
7506
7518
|
}
|
|
7507
7519
|
await writeFileContent(
|
|
7508
|
-
|
|
7520
|
+
RULESYNC_CONFIG_RELATIVE_FILE_PATH,
|
|
7509
7521
|
JSON.stringify(
|
|
7510
7522
|
{
|
|
7511
7523
|
targets: ["copilot", "cursor", "claudecode", "codexcli"],
|
|
@@ -7522,11 +7534,11 @@ async function createConfigFile() {
|
|
|
7522
7534
|
2
|
|
7523
7535
|
)
|
|
7524
7536
|
);
|
|
7525
|
-
logger.success(
|
|
7537
|
+
logger.success(`Created ${RULESYNC_CONFIG_RELATIVE_FILE_PATH}`);
|
|
7526
7538
|
}
|
|
7527
7539
|
async function createSampleFiles() {
|
|
7528
7540
|
const sampleRuleFile = {
|
|
7529
|
-
filename:
|
|
7541
|
+
filename: RULESYNC_OVERVIEW_FILE_NAME,
|
|
7530
7542
|
content: `---
|
|
7531
7543
|
root: true
|
|
7532
7544
|
targets: ["*"]
|
|
@@ -7649,14 +7661,14 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
7649
7661
|
await ensureDir(commandPaths.relativeDirPath);
|
|
7650
7662
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
7651
7663
|
await ensureDir(ignorePaths.relativeDirPath);
|
|
7652
|
-
const ruleFilepath =
|
|
7664
|
+
const ruleFilepath = join66(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
7653
7665
|
if (!await fileExists(ruleFilepath)) {
|
|
7654
7666
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
7655
7667
|
logger.success(`Created ${ruleFilepath}`);
|
|
7656
7668
|
} else {
|
|
7657
7669
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
7658
7670
|
}
|
|
7659
|
-
const mcpFilepath =
|
|
7671
|
+
const mcpFilepath = join66(
|
|
7660
7672
|
mcpPaths.recommended.relativeDirPath,
|
|
7661
7673
|
mcpPaths.recommended.relativeFilePath
|
|
7662
7674
|
);
|
|
@@ -7666,21 +7678,21 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
7666
7678
|
} else {
|
|
7667
7679
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
7668
7680
|
}
|
|
7669
|
-
const commandFilepath =
|
|
7681
|
+
const commandFilepath = join66(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
7670
7682
|
if (!await fileExists(commandFilepath)) {
|
|
7671
7683
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
7672
7684
|
logger.success(`Created ${commandFilepath}`);
|
|
7673
7685
|
} else {
|
|
7674
7686
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
7675
7687
|
}
|
|
7676
|
-
const subagentFilepath =
|
|
7688
|
+
const subagentFilepath = join66(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
7677
7689
|
if (!await fileExists(subagentFilepath)) {
|
|
7678
7690
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
7679
7691
|
logger.success(`Created ${subagentFilepath}`);
|
|
7680
7692
|
} else {
|
|
7681
7693
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
7682
7694
|
}
|
|
7683
|
-
const ignoreFilepath =
|
|
7695
|
+
const ignoreFilepath = join66(ignorePaths.relativeDirPath, ignorePaths.relativeFilePath);
|
|
7684
7696
|
if (!await fileExists(ignoreFilepath)) {
|
|
7685
7697
|
await writeFileContent(ignoreFilepath, sampleIgnoreFile.content);
|
|
7686
7698
|
logger.success(`Created ${ignoreFilepath}`);
|
|
@@ -7693,12 +7705,12 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
7693
7705
|
import { FastMCP } from "fastmcp";
|
|
7694
7706
|
|
|
7695
7707
|
// src/mcp/commands.ts
|
|
7696
|
-
import { basename as basename18, join as
|
|
7708
|
+
import { basename as basename18, join as join67 } from "path";
|
|
7697
7709
|
import { z as z23 } from "zod/mini";
|
|
7698
7710
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
7699
7711
|
var maxCommandsCount = 1e3;
|
|
7700
7712
|
async function listCommands() {
|
|
7701
|
-
const commandsDir =
|
|
7713
|
+
const commandsDir = join67(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
7702
7714
|
try {
|
|
7703
7715
|
const files = await listDirectoryFiles(commandsDir);
|
|
7704
7716
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -7710,7 +7722,7 @@ async function listCommands() {
|
|
|
7710
7722
|
});
|
|
7711
7723
|
const frontmatter = command.getFrontmatter();
|
|
7712
7724
|
return {
|
|
7713
|
-
relativePathFromCwd:
|
|
7725
|
+
relativePathFromCwd: join67(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
7714
7726
|
frontmatter
|
|
7715
7727
|
};
|
|
7716
7728
|
} catch (error) {
|
|
@@ -7736,7 +7748,7 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
7736
7748
|
relativeFilePath: filename
|
|
7737
7749
|
});
|
|
7738
7750
|
return {
|
|
7739
|
-
relativePathFromCwd:
|
|
7751
|
+
relativePathFromCwd: join67(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
7740
7752
|
frontmatter: command.getFrontmatter(),
|
|
7741
7753
|
body: command.getBody()
|
|
7742
7754
|
};
|
|
@@ -7765,7 +7777,7 @@ async function putCommand({
|
|
|
7765
7777
|
try {
|
|
7766
7778
|
const existingCommands = await listCommands();
|
|
7767
7779
|
const isUpdate = existingCommands.some(
|
|
7768
|
-
(command2) => command2.relativePathFromCwd ===
|
|
7780
|
+
(command2) => command2.relativePathFromCwd === join67(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
7769
7781
|
);
|
|
7770
7782
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
7771
7783
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -7773,18 +7785,18 @@ async function putCommand({
|
|
|
7773
7785
|
const fileContent = stringifyFrontmatter(body, frontmatter);
|
|
7774
7786
|
const command = new RulesyncCommand({
|
|
7775
7787
|
baseDir: process.cwd(),
|
|
7776
|
-
relativeDirPath:
|
|
7788
|
+
relativeDirPath: RULESYNC_COMMANDS_RELATIVE_DIR_PATH,
|
|
7777
7789
|
relativeFilePath: filename,
|
|
7778
7790
|
frontmatter,
|
|
7779
7791
|
body,
|
|
7780
7792
|
fileContent,
|
|
7781
7793
|
validate: true
|
|
7782
7794
|
});
|
|
7783
|
-
const commandsDir =
|
|
7795
|
+
const commandsDir = join67(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
7784
7796
|
await ensureDir(commandsDir);
|
|
7785
7797
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
7786
7798
|
return {
|
|
7787
|
-
relativePathFromCwd:
|
|
7799
|
+
relativePathFromCwd: join67(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
7788
7800
|
frontmatter: command.getFrontmatter(),
|
|
7789
7801
|
body: command.getBody()
|
|
7790
7802
|
};
|
|
@@ -7800,11 +7812,11 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
7800
7812
|
intendedRootDir: process.cwd()
|
|
7801
7813
|
});
|
|
7802
7814
|
const filename = basename18(relativePathFromCwd);
|
|
7803
|
-
const fullPath =
|
|
7815
|
+
const fullPath = join67(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
7804
7816
|
try {
|
|
7805
7817
|
await removeFile(fullPath);
|
|
7806
7818
|
return {
|
|
7807
|
-
relativePathFromCwd:
|
|
7819
|
+
relativePathFromCwd: join67(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
7808
7820
|
};
|
|
7809
7821
|
} catch (error) {
|
|
7810
7822
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -7829,7 +7841,7 @@ var commandToolSchemas = {
|
|
|
7829
7841
|
var commandTools = {
|
|
7830
7842
|
listCommands: {
|
|
7831
7843
|
name: "listCommands",
|
|
7832
|
-
description: `List all commands from ${
|
|
7844
|
+
description: `List all commands from ${join67(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
7833
7845
|
parameters: commandToolSchemas.listCommands,
|
|
7834
7846
|
execute: async () => {
|
|
7835
7847
|
const commands = await listCommands();
|
|
@@ -7871,15 +7883,15 @@ var commandTools = {
|
|
|
7871
7883
|
};
|
|
7872
7884
|
|
|
7873
7885
|
// src/mcp/ignore.ts
|
|
7874
|
-
import { join as
|
|
7886
|
+
import { join as join68 } from "path";
|
|
7875
7887
|
import { z as z24 } from "zod/mini";
|
|
7876
7888
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
7877
7889
|
async function getIgnoreFile() {
|
|
7878
|
-
const ignoreFilePath =
|
|
7890
|
+
const ignoreFilePath = join68(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
7879
7891
|
try {
|
|
7880
7892
|
const content = await readFileContent(ignoreFilePath);
|
|
7881
7893
|
return {
|
|
7882
|
-
relativePathFromCwd:
|
|
7894
|
+
relativePathFromCwd: RULESYNC_IGNORE_RELATIVE_FILE_PATH,
|
|
7883
7895
|
content
|
|
7884
7896
|
};
|
|
7885
7897
|
} catch (error) {
|
|
@@ -7889,7 +7901,7 @@ async function getIgnoreFile() {
|
|
|
7889
7901
|
}
|
|
7890
7902
|
}
|
|
7891
7903
|
async function putIgnoreFile({ content }) {
|
|
7892
|
-
const ignoreFilePath =
|
|
7904
|
+
const ignoreFilePath = join68(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
7893
7905
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
7894
7906
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
7895
7907
|
throw new Error(
|
|
@@ -7900,7 +7912,7 @@ async function putIgnoreFile({ content }) {
|
|
|
7900
7912
|
await ensureDir(process.cwd());
|
|
7901
7913
|
await writeFileContent(ignoreFilePath, content);
|
|
7902
7914
|
return {
|
|
7903
|
-
relativePathFromCwd:
|
|
7915
|
+
relativePathFromCwd: RULESYNC_IGNORE_RELATIVE_FILE_PATH,
|
|
7904
7916
|
content
|
|
7905
7917
|
};
|
|
7906
7918
|
} catch (error) {
|
|
@@ -7910,11 +7922,11 @@ async function putIgnoreFile({ content }) {
|
|
|
7910
7922
|
}
|
|
7911
7923
|
}
|
|
7912
7924
|
async function deleteIgnoreFile() {
|
|
7913
|
-
const ignoreFilePath =
|
|
7925
|
+
const ignoreFilePath = join68(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
7914
7926
|
try {
|
|
7915
7927
|
await removeFile(ignoreFilePath);
|
|
7916
7928
|
return {
|
|
7917
|
-
relativePathFromCwd:
|
|
7929
|
+
relativePathFromCwd: RULESYNC_IGNORE_RELATIVE_FILE_PATH
|
|
7918
7930
|
};
|
|
7919
7931
|
} catch (error) {
|
|
7920
7932
|
throw new Error(`Failed to delete .rulesyncignore file: ${formatError(error)}`, {
|
|
@@ -7960,7 +7972,7 @@ var ignoreTools = {
|
|
|
7960
7972
|
};
|
|
7961
7973
|
|
|
7962
7974
|
// src/mcp/mcp.ts
|
|
7963
|
-
import { join as
|
|
7975
|
+
import { join as join69 } from "path";
|
|
7964
7976
|
import { z as z25 } from "zod/mini";
|
|
7965
7977
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
7966
7978
|
async function getMcpFile() {
|
|
@@ -7969,7 +7981,7 @@ async function getMcpFile() {
|
|
|
7969
7981
|
validate: true,
|
|
7970
7982
|
modularMcp: false
|
|
7971
7983
|
});
|
|
7972
|
-
const relativePathFromCwd =
|
|
7984
|
+
const relativePathFromCwd = join69(
|
|
7973
7985
|
rulesyncMcp.getRelativeDirPath(),
|
|
7974
7986
|
rulesyncMcp.getRelativeFilePath()
|
|
7975
7987
|
);
|
|
@@ -8001,7 +8013,7 @@ async function putMcpFile({ content }) {
|
|
|
8001
8013
|
const paths = RulesyncMcp.getSettablePaths();
|
|
8002
8014
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
8003
8015
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
8004
|
-
const fullPath =
|
|
8016
|
+
const fullPath = join69(baseDir, relativeDirPath, relativeFilePath);
|
|
8005
8017
|
const rulesyncMcp = new RulesyncMcp({
|
|
8006
8018
|
baseDir,
|
|
8007
8019
|
relativeDirPath,
|
|
@@ -8010,9 +8022,9 @@ async function putMcpFile({ content }) {
|
|
|
8010
8022
|
validate: true,
|
|
8011
8023
|
modularMcp: false
|
|
8012
8024
|
});
|
|
8013
|
-
await ensureDir(
|
|
8025
|
+
await ensureDir(join69(baseDir, relativeDirPath));
|
|
8014
8026
|
await writeFileContent(fullPath, content);
|
|
8015
|
-
const relativePathFromCwd =
|
|
8027
|
+
const relativePathFromCwd = join69(relativeDirPath, relativeFilePath);
|
|
8016
8028
|
return {
|
|
8017
8029
|
relativePathFromCwd,
|
|
8018
8030
|
content: rulesyncMcp.getFileContent()
|
|
@@ -8027,15 +8039,15 @@ async function deleteMcpFile() {
|
|
|
8027
8039
|
try {
|
|
8028
8040
|
const baseDir = process.cwd();
|
|
8029
8041
|
const paths = RulesyncMcp.getSettablePaths();
|
|
8030
|
-
const recommendedPath =
|
|
8042
|
+
const recommendedPath = join69(
|
|
8031
8043
|
baseDir,
|
|
8032
8044
|
paths.recommended.relativeDirPath,
|
|
8033
8045
|
paths.recommended.relativeFilePath
|
|
8034
8046
|
);
|
|
8035
|
-
const legacyPath =
|
|
8047
|
+
const legacyPath = join69(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
8036
8048
|
await removeFile(recommendedPath);
|
|
8037
8049
|
await removeFile(legacyPath);
|
|
8038
|
-
const relativePathFromCwd =
|
|
8050
|
+
const relativePathFromCwd = join69(
|
|
8039
8051
|
paths.recommended.relativeDirPath,
|
|
8040
8052
|
paths.recommended.relativeFilePath
|
|
8041
8053
|
);
|
|
@@ -8058,7 +8070,7 @@ var mcpToolSchemas = {
|
|
|
8058
8070
|
var mcpTools = {
|
|
8059
8071
|
getMcpFile: {
|
|
8060
8072
|
name: "getMcpFile",
|
|
8061
|
-
description: `Get the MCP configuration file (${
|
|
8073
|
+
description: `Get the MCP configuration file (${RULESYNC_MCP_RELATIVE_FILE_PATH}).`,
|
|
8062
8074
|
parameters: mcpToolSchemas.getMcpFile,
|
|
8063
8075
|
execute: async () => {
|
|
8064
8076
|
const result = await getMcpFile();
|
|
@@ -8086,12 +8098,12 @@ var mcpTools = {
|
|
|
8086
8098
|
};
|
|
8087
8099
|
|
|
8088
8100
|
// src/mcp/rules.ts
|
|
8089
|
-
import { basename as basename19, join as
|
|
8101
|
+
import { basename as basename19, join as join70 } from "path";
|
|
8090
8102
|
import { z as z26 } from "zod/mini";
|
|
8091
8103
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
8092
8104
|
var maxRulesCount = 1e3;
|
|
8093
8105
|
async function listRules() {
|
|
8094
|
-
const rulesDir =
|
|
8106
|
+
const rulesDir = join70(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
8095
8107
|
try {
|
|
8096
8108
|
const files = await listDirectoryFiles(rulesDir);
|
|
8097
8109
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -8104,7 +8116,7 @@ async function listRules() {
|
|
|
8104
8116
|
});
|
|
8105
8117
|
const frontmatter = rule.getFrontmatter();
|
|
8106
8118
|
return {
|
|
8107
|
-
relativePathFromCwd:
|
|
8119
|
+
relativePathFromCwd: join70(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
8108
8120
|
frontmatter
|
|
8109
8121
|
};
|
|
8110
8122
|
} catch (error) {
|
|
@@ -8131,7 +8143,7 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
8131
8143
|
validate: true
|
|
8132
8144
|
});
|
|
8133
8145
|
return {
|
|
8134
|
-
relativePathFromCwd:
|
|
8146
|
+
relativePathFromCwd: join70(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
8135
8147
|
frontmatter: rule.getFrontmatter(),
|
|
8136
8148
|
body: rule.getBody()
|
|
8137
8149
|
};
|
|
@@ -8160,24 +8172,24 @@ async function putRule({
|
|
|
8160
8172
|
try {
|
|
8161
8173
|
const existingRules = await listRules();
|
|
8162
8174
|
const isUpdate = existingRules.some(
|
|
8163
|
-
(rule2) => rule2.relativePathFromCwd ===
|
|
8175
|
+
(rule2) => rule2.relativePathFromCwd === join70(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
8164
8176
|
);
|
|
8165
8177
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
8166
8178
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
8167
8179
|
}
|
|
8168
8180
|
const rule = new RulesyncRule({
|
|
8169
8181
|
baseDir: process.cwd(),
|
|
8170
|
-
relativeDirPath:
|
|
8182
|
+
relativeDirPath: RULESYNC_RULES_RELATIVE_DIR_PATH,
|
|
8171
8183
|
relativeFilePath: filename,
|
|
8172
8184
|
frontmatter,
|
|
8173
8185
|
body,
|
|
8174
8186
|
validate: true
|
|
8175
8187
|
});
|
|
8176
|
-
const rulesDir =
|
|
8188
|
+
const rulesDir = join70(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
8177
8189
|
await ensureDir(rulesDir);
|
|
8178
8190
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
8179
8191
|
return {
|
|
8180
|
-
relativePathFromCwd:
|
|
8192
|
+
relativePathFromCwd: join70(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
8181
8193
|
frontmatter: rule.getFrontmatter(),
|
|
8182
8194
|
body: rule.getBody()
|
|
8183
8195
|
};
|
|
@@ -8193,11 +8205,11 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
8193
8205
|
intendedRootDir: process.cwd()
|
|
8194
8206
|
});
|
|
8195
8207
|
const filename = basename19(relativePathFromCwd);
|
|
8196
|
-
const fullPath =
|
|
8208
|
+
const fullPath = join70(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
8197
8209
|
try {
|
|
8198
8210
|
await removeFile(fullPath);
|
|
8199
8211
|
return {
|
|
8200
|
-
relativePathFromCwd:
|
|
8212
|
+
relativePathFromCwd: join70(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
8201
8213
|
};
|
|
8202
8214
|
} catch (error) {
|
|
8203
8215
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -8222,7 +8234,7 @@ var ruleToolSchemas = {
|
|
|
8222
8234
|
var ruleTools = {
|
|
8223
8235
|
listRules: {
|
|
8224
8236
|
name: "listRules",
|
|
8225
|
-
description: `List all rules from ${
|
|
8237
|
+
description: `List all rules from ${join70(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
8226
8238
|
parameters: ruleToolSchemas.listRules,
|
|
8227
8239
|
execute: async () => {
|
|
8228
8240
|
const rules = await listRules();
|
|
@@ -8264,12 +8276,12 @@ var ruleTools = {
|
|
|
8264
8276
|
};
|
|
8265
8277
|
|
|
8266
8278
|
// src/mcp/subagents.ts
|
|
8267
|
-
import { basename as basename20, join as
|
|
8279
|
+
import { basename as basename20, join as join71 } from "path";
|
|
8268
8280
|
import { z as z27 } from "zod/mini";
|
|
8269
8281
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
8270
8282
|
var maxSubagentsCount = 1e3;
|
|
8271
8283
|
async function listSubagents() {
|
|
8272
|
-
const subagentsDir =
|
|
8284
|
+
const subagentsDir = join71(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
8273
8285
|
try {
|
|
8274
8286
|
const files = await listDirectoryFiles(subagentsDir);
|
|
8275
8287
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -8282,7 +8294,7 @@ async function listSubagents() {
|
|
|
8282
8294
|
});
|
|
8283
8295
|
const frontmatter = subagent.getFrontmatter();
|
|
8284
8296
|
return {
|
|
8285
|
-
relativePathFromCwd:
|
|
8297
|
+
relativePathFromCwd: join71(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
8286
8298
|
frontmatter
|
|
8287
8299
|
};
|
|
8288
8300
|
} catch (error) {
|
|
@@ -8311,7 +8323,7 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
8311
8323
|
validate: true
|
|
8312
8324
|
});
|
|
8313
8325
|
return {
|
|
8314
|
-
relativePathFromCwd:
|
|
8326
|
+
relativePathFromCwd: join71(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
8315
8327
|
frontmatter: subagent.getFrontmatter(),
|
|
8316
8328
|
body: subagent.getBody()
|
|
8317
8329
|
};
|
|
@@ -8340,24 +8352,24 @@ async function putSubagent({
|
|
|
8340
8352
|
try {
|
|
8341
8353
|
const existingSubagents = await listSubagents();
|
|
8342
8354
|
const isUpdate = existingSubagents.some(
|
|
8343
|
-
(subagent2) => subagent2.relativePathFromCwd ===
|
|
8355
|
+
(subagent2) => subagent2.relativePathFromCwd === join71(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
8344
8356
|
);
|
|
8345
8357
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
8346
8358
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
8347
8359
|
}
|
|
8348
8360
|
const subagent = new RulesyncSubagent({
|
|
8349
8361
|
baseDir: process.cwd(),
|
|
8350
|
-
relativeDirPath:
|
|
8362
|
+
relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
|
|
8351
8363
|
relativeFilePath: filename,
|
|
8352
8364
|
frontmatter,
|
|
8353
8365
|
body,
|
|
8354
8366
|
validate: true
|
|
8355
8367
|
});
|
|
8356
|
-
const subagentsDir =
|
|
8368
|
+
const subagentsDir = join71(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
8357
8369
|
await ensureDir(subagentsDir);
|
|
8358
8370
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
8359
8371
|
return {
|
|
8360
|
-
relativePathFromCwd:
|
|
8372
|
+
relativePathFromCwd: join71(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
8361
8373
|
frontmatter: subagent.getFrontmatter(),
|
|
8362
8374
|
body: subagent.getBody()
|
|
8363
8375
|
};
|
|
@@ -8373,11 +8385,11 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
8373
8385
|
intendedRootDir: process.cwd()
|
|
8374
8386
|
});
|
|
8375
8387
|
const filename = basename20(relativePathFromCwd);
|
|
8376
|
-
const fullPath =
|
|
8388
|
+
const fullPath = join71(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
8377
8389
|
try {
|
|
8378
8390
|
await removeFile(fullPath);
|
|
8379
8391
|
return {
|
|
8380
|
-
relativePathFromCwd:
|
|
8392
|
+
relativePathFromCwd: join71(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
8381
8393
|
};
|
|
8382
8394
|
} catch (error) {
|
|
8383
8395
|
throw new Error(
|
|
@@ -8405,7 +8417,7 @@ var subagentToolSchemas = {
|
|
|
8405
8417
|
var subagentTools = {
|
|
8406
8418
|
listSubagents: {
|
|
8407
8419
|
name: "listSubagents",
|
|
8408
|
-
description: `List all subagents from ${
|
|
8420
|
+
description: `List all subagents from ${join71(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
8409
8421
|
parameters: subagentToolSchemas.listSubagents,
|
|
8410
8422
|
execute: async () => {
|
|
8411
8423
|
const subagents = await listSubagents();
|
|
@@ -8479,7 +8491,7 @@ async function mcpCommand({ version }) {
|
|
|
8479
8491
|
}
|
|
8480
8492
|
|
|
8481
8493
|
// src/cli/index.ts
|
|
8482
|
-
var getVersion = () => "3.
|
|
8494
|
+
var getVersion = () => "3.21.0";
|
|
8483
8495
|
var main = async () => {
|
|
8484
8496
|
const program = new Command();
|
|
8485
8497
|
const version = getVersion();
|