rulesync 2.1.0 → 3.0.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 +5 -5
- package/dist/index.cjs +312 -281
- package/dist/index.js +302 -271
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -613,10 +613,84 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
613
613
|
};
|
|
614
614
|
|
|
615
615
|
// src/commands/codexcli-command.ts
|
|
616
|
-
import { basename as
|
|
616
|
+
import { basename as basename4, join as join4 } from "path";
|
|
617
|
+
var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
618
|
+
static getSettablePaths() {
|
|
619
|
+
throw new Error("getSettablePaths is not supported for CodexcliCommand");
|
|
620
|
+
}
|
|
621
|
+
static getSettablePathsGlobal() {
|
|
622
|
+
return {
|
|
623
|
+
relativeDirPath: join4(".codex", "prompts")
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
toRulesyncCommand() {
|
|
627
|
+
const rulesyncFrontmatter = {
|
|
628
|
+
targets: ["*"],
|
|
629
|
+
description: ""
|
|
630
|
+
};
|
|
631
|
+
return new RulesyncCommand({
|
|
632
|
+
baseDir: ".",
|
|
633
|
+
// RulesyncCommand baseDir is always the project root directory
|
|
634
|
+
frontmatter: rulesyncFrontmatter,
|
|
635
|
+
body: this.getFileContent(),
|
|
636
|
+
relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
637
|
+
relativeFilePath: this.relativeFilePath,
|
|
638
|
+
fileContent: this.getFileContent(),
|
|
639
|
+
validate: true
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
static fromRulesyncCommand({
|
|
643
|
+
baseDir = ".",
|
|
644
|
+
rulesyncCommand,
|
|
645
|
+
validate = true,
|
|
646
|
+
global = false
|
|
647
|
+
}) {
|
|
648
|
+
const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
|
|
649
|
+
return new _CodexcliCommand({
|
|
650
|
+
baseDir,
|
|
651
|
+
fileContent: rulesyncCommand.getBody(),
|
|
652
|
+
relativeDirPath: paths.relativeDirPath,
|
|
653
|
+
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
654
|
+
validate
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
validate() {
|
|
658
|
+
return { success: true, error: null };
|
|
659
|
+
}
|
|
660
|
+
getBody() {
|
|
661
|
+
return this.getFileContent();
|
|
662
|
+
}
|
|
663
|
+
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
664
|
+
return this.isTargetedByRulesyncCommandDefault({
|
|
665
|
+
rulesyncCommand,
|
|
666
|
+
toolTarget: "codexcli"
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
static async fromFile({
|
|
670
|
+
baseDir = ".",
|
|
671
|
+
relativeFilePath,
|
|
672
|
+
validate = true,
|
|
673
|
+
global = false
|
|
674
|
+
}) {
|
|
675
|
+
const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
|
|
676
|
+
const filePath = join4(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
677
|
+
const fileContent = await readFileContent(filePath);
|
|
678
|
+
const { body: content } = parseFrontmatter(fileContent);
|
|
679
|
+
return new _CodexcliCommand({
|
|
680
|
+
baseDir,
|
|
681
|
+
relativeDirPath: paths.relativeDirPath,
|
|
682
|
+
relativeFilePath: basename4(relativeFilePath),
|
|
683
|
+
fileContent: content.trim(),
|
|
684
|
+
validate
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
// src/commands/copilot-command.ts
|
|
690
|
+
import { basename as basename6, join as join6 } from "path";
|
|
617
691
|
|
|
618
692
|
// src/commands/simulated-command.ts
|
|
619
|
-
import { basename as
|
|
693
|
+
import { basename as basename5, join as join5 } from "path";
|
|
620
694
|
import { z as z5 } from "zod/mini";
|
|
621
695
|
var SimulatedCommandFrontmatterSchema = z5.object({
|
|
622
696
|
description: z5.string()
|
|
@@ -682,7 +756,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
682
756
|
relativeFilePath,
|
|
683
757
|
validate = true
|
|
684
758
|
}) {
|
|
685
|
-
const filePath =
|
|
759
|
+
const filePath = join5(
|
|
686
760
|
baseDir,
|
|
687
761
|
_SimulatedCommand.getSettablePaths().relativeDirPath,
|
|
688
762
|
relativeFilePath
|
|
@@ -696,65 +770,15 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
696
770
|
return {
|
|
697
771
|
baseDir,
|
|
698
772
|
relativeDirPath: _SimulatedCommand.getSettablePaths().relativeDirPath,
|
|
699
|
-
relativeFilePath: basename4(relativeFilePath),
|
|
700
|
-
frontmatter: result.data,
|
|
701
|
-
body: content.trim(),
|
|
702
|
-
validate
|
|
703
|
-
};
|
|
704
|
-
}
|
|
705
|
-
};
|
|
706
|
-
|
|
707
|
-
// src/commands/codexcli-command.ts
|
|
708
|
-
var CodexCliCommand = class _CodexCliCommand extends SimulatedCommand {
|
|
709
|
-
static getSettablePaths() {
|
|
710
|
-
return {
|
|
711
|
-
relativeDirPath: ".codex/commands"
|
|
712
|
-
};
|
|
713
|
-
}
|
|
714
|
-
static fromRulesyncCommand({
|
|
715
|
-
baseDir = ".",
|
|
716
|
-
rulesyncCommand,
|
|
717
|
-
validate = true
|
|
718
|
-
}) {
|
|
719
|
-
return new _CodexCliCommand(
|
|
720
|
-
this.fromRulesyncCommandDefault({ baseDir, rulesyncCommand, validate })
|
|
721
|
-
);
|
|
722
|
-
}
|
|
723
|
-
static async fromFile({
|
|
724
|
-
baseDir = ".",
|
|
725
|
-
relativeFilePath,
|
|
726
|
-
validate = true
|
|
727
|
-
}) {
|
|
728
|
-
const filePath = join5(
|
|
729
|
-
baseDir,
|
|
730
|
-
_CodexCliCommand.getSettablePaths().relativeDirPath,
|
|
731
|
-
relativeFilePath
|
|
732
|
-
);
|
|
733
|
-
const fileContent = await readFileContent(filePath);
|
|
734
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
735
|
-
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
736
|
-
if (!result.success) {
|
|
737
|
-
throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
|
|
738
|
-
}
|
|
739
|
-
return new _CodexCliCommand({
|
|
740
|
-
baseDir,
|
|
741
|
-
relativeDirPath: _CodexCliCommand.getSettablePaths().relativeDirPath,
|
|
742
773
|
relativeFilePath: basename5(relativeFilePath),
|
|
743
774
|
frontmatter: result.data,
|
|
744
775
|
body: content.trim(),
|
|
745
776
|
validate
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
749
|
-
return this.isTargetedByRulesyncCommandDefault({
|
|
750
|
-
rulesyncCommand,
|
|
751
|
-
toolTarget: "codexcli"
|
|
752
|
-
});
|
|
777
|
+
};
|
|
753
778
|
}
|
|
754
779
|
};
|
|
755
780
|
|
|
756
781
|
// src/commands/copilot-command.ts
|
|
757
|
-
import { basename as basename6, join as join6 } from "path";
|
|
758
782
|
var CopilotCommand = class _CopilotCommand extends SimulatedCommand {
|
|
759
783
|
static getSettablePaths() {
|
|
760
784
|
return {
|
|
@@ -808,7 +832,12 @@ import { basename as basename7, join as join7 } from "path";
|
|
|
808
832
|
var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
809
833
|
static getSettablePaths() {
|
|
810
834
|
return {
|
|
811
|
-
relativeDirPath: ".cursor
|
|
835
|
+
relativeDirPath: join7(".cursor", "commands")
|
|
836
|
+
};
|
|
837
|
+
}
|
|
838
|
+
static getSettablePathsGlobal() {
|
|
839
|
+
return {
|
|
840
|
+
relativeDirPath: join7(".cursor", "commands")
|
|
812
841
|
};
|
|
813
842
|
}
|
|
814
843
|
toRulesyncCommand() {
|
|
@@ -830,12 +859,14 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
830
859
|
static fromRulesyncCommand({
|
|
831
860
|
baseDir = ".",
|
|
832
861
|
rulesyncCommand,
|
|
833
|
-
validate = true
|
|
862
|
+
validate = true,
|
|
863
|
+
global = false
|
|
834
864
|
}) {
|
|
865
|
+
const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
|
|
835
866
|
return new _CursorCommand({
|
|
836
867
|
baseDir,
|
|
837
868
|
fileContent: rulesyncCommand.getBody(),
|
|
838
|
-
relativeDirPath:
|
|
869
|
+
relativeDirPath: paths.relativeDirPath,
|
|
839
870
|
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
840
871
|
validate
|
|
841
872
|
});
|
|
@@ -855,18 +886,16 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
855
886
|
static async fromFile({
|
|
856
887
|
baseDir = ".",
|
|
857
888
|
relativeFilePath,
|
|
858
|
-
validate = true
|
|
889
|
+
validate = true,
|
|
890
|
+
global = false
|
|
859
891
|
}) {
|
|
860
|
-
const
|
|
861
|
-
|
|
862
|
-
_CursorCommand.getSettablePaths().relativeDirPath,
|
|
863
|
-
relativeFilePath
|
|
864
|
-
);
|
|
892
|
+
const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
|
|
893
|
+
const filePath = join7(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
865
894
|
const fileContent = await readFileContent(filePath);
|
|
866
895
|
const { body: content } = parseFrontmatter(fileContent);
|
|
867
896
|
return new _CursorCommand({
|
|
868
897
|
baseDir,
|
|
869
|
-
relativeDirPath:
|
|
898
|
+
relativeDirPath: paths.relativeDirPath,
|
|
870
899
|
relativeFilePath: basename7(relativeFilePath),
|
|
871
900
|
fileContent: content.trim(),
|
|
872
901
|
validate
|
|
@@ -896,6 +925,11 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
896
925
|
relativeDirPath: ".gemini/commands"
|
|
897
926
|
};
|
|
898
927
|
}
|
|
928
|
+
static getSettablePathsGlobal() {
|
|
929
|
+
return {
|
|
930
|
+
relativeDirPath: join8(".gemini", "commands")
|
|
931
|
+
};
|
|
932
|
+
}
|
|
899
933
|
parseTomlContent(content) {
|
|
900
934
|
try {
|
|
901
935
|
const parsed = parseToml(content);
|
|
@@ -937,7 +971,8 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
937
971
|
static fromRulesyncCommand({
|
|
938
972
|
baseDir = ".",
|
|
939
973
|
rulesyncCommand,
|
|
940
|
-
validate = true
|
|
974
|
+
validate = true,
|
|
975
|
+
global = false
|
|
941
976
|
}) {
|
|
942
977
|
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
943
978
|
const geminiFrontmatter = {
|
|
@@ -948,9 +983,10 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
948
983
|
prompt = """
|
|
949
984
|
${geminiFrontmatter.prompt}
|
|
950
985
|
"""`;
|
|
986
|
+
const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
|
|
951
987
|
return new _GeminiCliCommand({
|
|
952
988
|
baseDir,
|
|
953
|
-
relativeDirPath:
|
|
989
|
+
relativeDirPath: paths.relativeDirPath,
|
|
954
990
|
relativeFilePath: rulesyncCommand.getRelativeFilePath().replace(".md", ".toml"),
|
|
955
991
|
fileContent: tomlContent,
|
|
956
992
|
validate
|
|
@@ -959,17 +995,15 @@ ${geminiFrontmatter.prompt}
|
|
|
959
995
|
static async fromFile({
|
|
960
996
|
baseDir = ".",
|
|
961
997
|
relativeFilePath,
|
|
962
|
-
validate = true
|
|
998
|
+
validate = true,
|
|
999
|
+
global = false
|
|
963
1000
|
}) {
|
|
964
|
-
const
|
|
965
|
-
|
|
966
|
-
_GeminiCliCommand.getSettablePaths().relativeDirPath,
|
|
967
|
-
relativeFilePath
|
|
968
|
-
);
|
|
1001
|
+
const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
|
|
1002
|
+
const filePath = join8(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
969
1003
|
const fileContent = await readFileContent(filePath);
|
|
970
1004
|
return new _GeminiCliCommand({
|
|
971
1005
|
baseDir,
|
|
972
|
-
relativeDirPath:
|
|
1006
|
+
relativeDirPath: paths.relativeDirPath,
|
|
973
1007
|
relativeFilePath: basename8(relativeFilePath),
|
|
974
1008
|
fileContent,
|
|
975
1009
|
validate
|
|
@@ -1111,11 +1145,19 @@ var commandsProcessorToolTargets = [
|
|
|
1111
1145
|
"geminicli",
|
|
1112
1146
|
"roo",
|
|
1113
1147
|
"copilot",
|
|
1148
|
+
"cursor"
|
|
1149
|
+
];
|
|
1150
|
+
var CommandsProcessorToolTargetSchema = z8.enum(
|
|
1151
|
+
// codexcli is not in the list of tool targets but we add it here because it is a valid tool target for global mode generation
|
|
1152
|
+
commandsProcessorToolTargets.concat("codexcli")
|
|
1153
|
+
);
|
|
1154
|
+
var commandsProcessorToolTargetsSimulated = ["copilot"];
|
|
1155
|
+
var commandsProcessorToolTargetsGlobal = [
|
|
1156
|
+
"claudecode",
|
|
1114
1157
|
"cursor",
|
|
1158
|
+
"geminicli",
|
|
1115
1159
|
"codexcli"
|
|
1116
1160
|
];
|
|
1117
|
-
var CommandsProcessorToolTargetSchema = z8.enum(commandsProcessorToolTargets);
|
|
1118
|
-
var commandsProcessorToolTargetsSimulated = ["copilot", "codexcli"];
|
|
1119
1161
|
var CommandsProcessor = class extends FeatureProcessor {
|
|
1120
1162
|
toolTarget;
|
|
1121
1163
|
global;
|
|
@@ -1149,7 +1191,8 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1149
1191
|
}
|
|
1150
1192
|
return GeminiCliCommand.fromRulesyncCommand({
|
|
1151
1193
|
baseDir: this.baseDir,
|
|
1152
|
-
rulesyncCommand
|
|
1194
|
+
rulesyncCommand,
|
|
1195
|
+
global: this.global
|
|
1153
1196
|
});
|
|
1154
1197
|
case "roo":
|
|
1155
1198
|
if (!RooCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
|
|
@@ -1173,15 +1216,17 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1173
1216
|
}
|
|
1174
1217
|
return CursorCommand.fromRulesyncCommand({
|
|
1175
1218
|
baseDir: this.baseDir,
|
|
1176
|
-
rulesyncCommand
|
|
1219
|
+
rulesyncCommand,
|
|
1220
|
+
global: this.global
|
|
1177
1221
|
});
|
|
1178
1222
|
case "codexcli":
|
|
1179
|
-
if (!
|
|
1223
|
+
if (!CodexcliCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
|
|
1180
1224
|
return null;
|
|
1181
1225
|
}
|
|
1182
|
-
return
|
|
1226
|
+
return CodexcliCommand.fromRulesyncCommand({
|
|
1183
1227
|
baseDir: this.baseDir,
|
|
1184
|
-
rulesyncCommand
|
|
1228
|
+
rulesyncCommand,
|
|
1229
|
+
global: this.global
|
|
1185
1230
|
});
|
|
1186
1231
|
default:
|
|
1187
1232
|
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
@@ -1261,7 +1306,8 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1261
1306
|
case "geminicli":
|
|
1262
1307
|
return GeminiCliCommand.fromFile({
|
|
1263
1308
|
baseDir: this.baseDir,
|
|
1264
|
-
relativeFilePath: basename10(path2)
|
|
1309
|
+
relativeFilePath: basename10(path2),
|
|
1310
|
+
global: this.global
|
|
1265
1311
|
});
|
|
1266
1312
|
case "roo":
|
|
1267
1313
|
return RooCommand.fromFile({
|
|
@@ -1276,12 +1322,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1276
1322
|
case "cursor":
|
|
1277
1323
|
return CursorCommand.fromFile({
|
|
1278
1324
|
baseDir: this.baseDir,
|
|
1279
|
-
relativeFilePath: basename10(path2)
|
|
1325
|
+
relativeFilePath: basename10(path2),
|
|
1326
|
+
global: this.global
|
|
1280
1327
|
});
|
|
1281
1328
|
case "codexcli":
|
|
1282
|
-
return
|
|
1329
|
+
return CodexcliCommand.fromFile({
|
|
1283
1330
|
baseDir: this.baseDir,
|
|
1284
|
-
relativeFilePath: basename10(path2)
|
|
1331
|
+
relativeFilePath: basename10(path2),
|
|
1332
|
+
global: this.global
|
|
1285
1333
|
});
|
|
1286
1334
|
default:
|
|
1287
1335
|
throw new Error(`Unsupported tool target: ${toolTarget}`);
|
|
@@ -1313,12 +1361,13 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1313
1361
|
});
|
|
1314
1362
|
}
|
|
1315
1363
|
/**
|
|
1316
|
-
* Load
|
|
1364
|
+
* Load Cursor command configurations from .cursor/commands/ directory
|
|
1317
1365
|
*/
|
|
1318
1366
|
async loadCursorCommands() {
|
|
1367
|
+
const paths = this.global ? CursorCommand.getSettablePathsGlobal() : CursorCommand.getSettablePaths();
|
|
1319
1368
|
return await this.loadToolCommandDefault({
|
|
1320
1369
|
toolTarget: "cursor",
|
|
1321
|
-
relativeDirPath:
|
|
1370
|
+
relativeDirPath: paths.relativeDirPath,
|
|
1322
1371
|
extension: "md"
|
|
1323
1372
|
});
|
|
1324
1373
|
}
|
|
@@ -1326,19 +1375,21 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1326
1375
|
* Load Gemini CLI command configurations from .gemini/commands/ directory
|
|
1327
1376
|
*/
|
|
1328
1377
|
async loadGeminicliCommands() {
|
|
1378
|
+
const paths = this.global ? GeminiCliCommand.getSettablePathsGlobal() : GeminiCliCommand.getSettablePaths();
|
|
1329
1379
|
return await this.loadToolCommandDefault({
|
|
1330
1380
|
toolTarget: "geminicli",
|
|
1331
|
-
relativeDirPath:
|
|
1332
|
-
extension: "
|
|
1381
|
+
relativeDirPath: paths.relativeDirPath,
|
|
1382
|
+
extension: "toml"
|
|
1333
1383
|
});
|
|
1334
1384
|
}
|
|
1335
1385
|
/**
|
|
1336
|
-
* Load
|
|
1386
|
+
* Load Codex CLI command configurations from .codex/prompts/ directory
|
|
1337
1387
|
*/
|
|
1338
1388
|
async loadCodexcliCommands() {
|
|
1389
|
+
const paths = this.global ? CodexcliCommand.getSettablePathsGlobal() : CodexcliCommand.getSettablePaths();
|
|
1339
1390
|
return await this.loadToolCommandDefault({
|
|
1340
1391
|
toolTarget: "codexcli",
|
|
1341
|
-
relativeDirPath:
|
|
1392
|
+
relativeDirPath: paths.relativeDirPath,
|
|
1342
1393
|
extension: "md"
|
|
1343
1394
|
});
|
|
1344
1395
|
}
|
|
@@ -1370,7 +1421,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1370
1421
|
return commandsProcessorToolTargetsSimulated;
|
|
1371
1422
|
}
|
|
1372
1423
|
static getToolTargetsGlobal() {
|
|
1373
|
-
return
|
|
1424
|
+
return commandsProcessorToolTargetsGlobal;
|
|
1374
1425
|
}
|
|
1375
1426
|
};
|
|
1376
1427
|
|
|
@@ -1840,55 +1891,8 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
1840
1891
|
}
|
|
1841
1892
|
};
|
|
1842
1893
|
|
|
1843
|
-
// src/ignore/codexcli-ignore.ts
|
|
1844
|
-
import { join as join16 } from "path";
|
|
1845
|
-
var CodexcliIgnore = class _CodexcliIgnore extends ToolIgnore {
|
|
1846
|
-
static getSettablePaths() {
|
|
1847
|
-
return {
|
|
1848
|
-
relativeDirPath: ".",
|
|
1849
|
-
relativeFilePath: ".codexignore"
|
|
1850
|
-
};
|
|
1851
|
-
}
|
|
1852
|
-
toRulesyncIgnore() {
|
|
1853
|
-
return this.toRulesyncIgnoreDefault();
|
|
1854
|
-
}
|
|
1855
|
-
static fromRulesyncIgnore({
|
|
1856
|
-
baseDir = ".",
|
|
1857
|
-
rulesyncIgnore
|
|
1858
|
-
}) {
|
|
1859
|
-
const fileContent = rulesyncIgnore.getFileContent();
|
|
1860
|
-
return new _CodexcliIgnore({
|
|
1861
|
-
baseDir,
|
|
1862
|
-
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1863
|
-
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1864
|
-
fileContent,
|
|
1865
|
-
validate: true
|
|
1866
|
-
// Skip validation to allow empty patterns
|
|
1867
|
-
});
|
|
1868
|
-
}
|
|
1869
|
-
static async fromFile({
|
|
1870
|
-
baseDir = ".",
|
|
1871
|
-
validate = true
|
|
1872
|
-
}) {
|
|
1873
|
-
const fileContent = await readFileContent(
|
|
1874
|
-
join16(
|
|
1875
|
-
baseDir,
|
|
1876
|
-
this.getSettablePaths().relativeDirPath,
|
|
1877
|
-
this.getSettablePaths().relativeFilePath
|
|
1878
|
-
)
|
|
1879
|
-
);
|
|
1880
|
-
return new _CodexcliIgnore({
|
|
1881
|
-
baseDir,
|
|
1882
|
-
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1883
|
-
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1884
|
-
fileContent,
|
|
1885
|
-
validate
|
|
1886
|
-
});
|
|
1887
|
-
}
|
|
1888
|
-
};
|
|
1889
|
-
|
|
1890
1894
|
// src/ignore/cursor-ignore.ts
|
|
1891
|
-
import { join as
|
|
1895
|
+
import { join as join16 } from "path";
|
|
1892
1896
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
1893
1897
|
static getSettablePaths() {
|
|
1894
1898
|
return {
|
|
@@ -1921,7 +1925,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
1921
1925
|
validate = true
|
|
1922
1926
|
}) {
|
|
1923
1927
|
const fileContent = await readFileContent(
|
|
1924
|
-
|
|
1928
|
+
join16(
|
|
1925
1929
|
baseDir,
|
|
1926
1930
|
this.getSettablePaths().relativeDirPath,
|
|
1927
1931
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1938,7 +1942,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
1938
1942
|
};
|
|
1939
1943
|
|
|
1940
1944
|
// src/ignore/geminicli-ignore.ts
|
|
1941
|
-
import { join as
|
|
1945
|
+
import { join as join17 } from "path";
|
|
1942
1946
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
1943
1947
|
static getSettablePaths() {
|
|
1944
1948
|
return {
|
|
@@ -1965,7 +1969,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
1965
1969
|
validate = true
|
|
1966
1970
|
}) {
|
|
1967
1971
|
const fileContent = await readFileContent(
|
|
1968
|
-
|
|
1972
|
+
join17(
|
|
1969
1973
|
baseDir,
|
|
1970
1974
|
this.getSettablePaths().relativeDirPath,
|
|
1971
1975
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1982,7 +1986,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
1982
1986
|
};
|
|
1983
1987
|
|
|
1984
1988
|
// src/ignore/junie-ignore.ts
|
|
1985
|
-
import { join as
|
|
1989
|
+
import { join as join18 } from "path";
|
|
1986
1990
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
1987
1991
|
static getSettablePaths() {
|
|
1988
1992
|
return {
|
|
@@ -2009,7 +2013,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2009
2013
|
validate = true
|
|
2010
2014
|
}) {
|
|
2011
2015
|
const fileContent = await readFileContent(
|
|
2012
|
-
|
|
2016
|
+
join18(
|
|
2013
2017
|
baseDir,
|
|
2014
2018
|
this.getSettablePaths().relativeDirPath,
|
|
2015
2019
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2026,7 +2030,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2026
2030
|
};
|
|
2027
2031
|
|
|
2028
2032
|
// src/ignore/kiro-ignore.ts
|
|
2029
|
-
import { join as
|
|
2033
|
+
import { join as join19 } from "path";
|
|
2030
2034
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
2031
2035
|
static getSettablePaths() {
|
|
2032
2036
|
return {
|
|
@@ -2053,7 +2057,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
2053
2057
|
validate = true
|
|
2054
2058
|
}) {
|
|
2055
2059
|
const fileContent = await readFileContent(
|
|
2056
|
-
|
|
2060
|
+
join19(
|
|
2057
2061
|
baseDir,
|
|
2058
2062
|
this.getSettablePaths().relativeDirPath,
|
|
2059
2063
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2070,7 +2074,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
2070
2074
|
};
|
|
2071
2075
|
|
|
2072
2076
|
// src/ignore/qwencode-ignore.ts
|
|
2073
|
-
import { join as
|
|
2077
|
+
import { join as join20 } from "path";
|
|
2074
2078
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
2075
2079
|
static getSettablePaths() {
|
|
2076
2080
|
return {
|
|
@@ -2097,7 +2101,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
2097
2101
|
validate = true
|
|
2098
2102
|
}) {
|
|
2099
2103
|
const fileContent = await readFileContent(
|
|
2100
|
-
|
|
2104
|
+
join20(
|
|
2101
2105
|
baseDir,
|
|
2102
2106
|
this.getSettablePaths().relativeDirPath,
|
|
2103
2107
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2114,7 +2118,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
2114
2118
|
};
|
|
2115
2119
|
|
|
2116
2120
|
// src/ignore/roo-ignore.ts
|
|
2117
|
-
import { join as
|
|
2121
|
+
import { join as join21 } from "path";
|
|
2118
2122
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
2119
2123
|
static getSettablePaths() {
|
|
2120
2124
|
return {
|
|
@@ -2141,7 +2145,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
2141
2145
|
validate = true
|
|
2142
2146
|
}) {
|
|
2143
2147
|
const fileContent = await readFileContent(
|
|
2144
|
-
|
|
2148
|
+
join21(
|
|
2145
2149
|
baseDir,
|
|
2146
2150
|
this.getSettablePaths().relativeDirPath,
|
|
2147
2151
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2158,7 +2162,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
2158
2162
|
};
|
|
2159
2163
|
|
|
2160
2164
|
// src/ignore/windsurf-ignore.ts
|
|
2161
|
-
import { join as
|
|
2165
|
+
import { join as join22 } from "path";
|
|
2162
2166
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
2163
2167
|
static getSettablePaths() {
|
|
2164
2168
|
return {
|
|
@@ -2185,7 +2189,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
2185
2189
|
validate = true
|
|
2186
2190
|
}) {
|
|
2187
2191
|
const fileContent = await readFileContent(
|
|
2188
|
-
|
|
2192
|
+
join22(
|
|
2189
2193
|
baseDir,
|
|
2190
2194
|
this.getSettablePaths().relativeDirPath,
|
|
2191
2195
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2207,7 +2211,6 @@ var ignoreProcessorToolTargets = [
|
|
|
2207
2211
|
"augmentcode",
|
|
2208
2212
|
"claudecode",
|
|
2209
2213
|
"cline",
|
|
2210
|
-
"codexcli",
|
|
2211
2214
|
"cursor",
|
|
2212
2215
|
"geminicli",
|
|
2213
2216
|
"junie",
|
|
@@ -2265,8 +2268,6 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
2265
2268
|
return [await ClaudecodeIgnore.fromFile({ baseDir: this.baseDir })];
|
|
2266
2269
|
case "cline":
|
|
2267
2270
|
return [await ClineIgnore.fromFile({ baseDir: this.baseDir })];
|
|
2268
|
-
case "codexcli":
|
|
2269
|
-
return [await CodexcliIgnore.fromFile({ baseDir: this.baseDir })];
|
|
2270
2271
|
case "cursor":
|
|
2271
2272
|
return [await CursorIgnore.fromFile({ baseDir: this.baseDir })];
|
|
2272
2273
|
case "geminicli":
|
|
@@ -2324,11 +2325,6 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
2324
2325
|
baseDir: this.baseDir,
|
|
2325
2326
|
rulesyncIgnore: rulesyncIgnore2
|
|
2326
2327
|
});
|
|
2327
|
-
case "codexcli":
|
|
2328
|
-
return CodexcliIgnore.fromRulesyncIgnore({
|
|
2329
|
-
baseDir: this.baseDir,
|
|
2330
|
-
rulesyncIgnore: rulesyncIgnore2
|
|
2331
|
-
});
|
|
2332
2328
|
case "cursor":
|
|
2333
2329
|
return CursorIgnore.fromRulesyncIgnore({
|
|
2334
2330
|
baseDir: this.baseDir,
|
|
@@ -2395,10 +2391,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
2395
2391
|
import { z as z11 } from "zod/mini";
|
|
2396
2392
|
|
|
2397
2393
|
// src/mcp/amazonqcli-mcp.ts
|
|
2398
|
-
import { join as
|
|
2394
|
+
import { join as join24 } from "path";
|
|
2399
2395
|
|
|
2400
2396
|
// src/mcp/rulesync-mcp.ts
|
|
2401
|
-
import { join as
|
|
2397
|
+
import { join as join23 } from "path";
|
|
2402
2398
|
import { z as z10 } from "zod/mini";
|
|
2403
2399
|
var McpTransportTypeSchema = z10.enum(["stdio", "sse", "http"]);
|
|
2404
2400
|
var McpServerBaseSchema = z10.object({
|
|
@@ -2449,7 +2445,7 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
2449
2445
|
}
|
|
2450
2446
|
static async fromFile({ validate = true }) {
|
|
2451
2447
|
const fileContent = await readFileContent(
|
|
2452
|
-
|
|
2448
|
+
join23(this.getSettablePaths().relativeDirPath, this.getSettablePaths().relativeFilePath)
|
|
2453
2449
|
);
|
|
2454
2450
|
return new _RulesyncMcp({
|
|
2455
2451
|
baseDir: ".",
|
|
@@ -2516,7 +2512,7 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
2516
2512
|
validate = true
|
|
2517
2513
|
}) {
|
|
2518
2514
|
const fileContent = await readFileContent(
|
|
2519
|
-
|
|
2515
|
+
join24(
|
|
2520
2516
|
baseDir,
|
|
2521
2517
|
this.getSettablePaths().relativeDirPath,
|
|
2522
2518
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2552,7 +2548,7 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
2552
2548
|
};
|
|
2553
2549
|
|
|
2554
2550
|
// src/mcp/claudecode-mcp.ts
|
|
2555
|
-
import { join as
|
|
2551
|
+
import { join as join25 } from "path";
|
|
2556
2552
|
var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
2557
2553
|
static getSettablePaths() {
|
|
2558
2554
|
return {
|
|
@@ -2565,7 +2561,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
2565
2561
|
validate = true
|
|
2566
2562
|
}) {
|
|
2567
2563
|
const fileContent = await readFileContent(
|
|
2568
|
-
|
|
2564
|
+
join25(
|
|
2569
2565
|
baseDir,
|
|
2570
2566
|
this.getSettablePaths().relativeDirPath,
|
|
2571
2567
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2601,7 +2597,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
2601
2597
|
};
|
|
2602
2598
|
|
|
2603
2599
|
// src/mcp/cline-mcp.ts
|
|
2604
|
-
import { join as
|
|
2600
|
+
import { join as join26 } from "path";
|
|
2605
2601
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
2606
2602
|
static getSettablePaths() {
|
|
2607
2603
|
return {
|
|
@@ -2614,7 +2610,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
2614
2610
|
validate = true
|
|
2615
2611
|
}) {
|
|
2616
2612
|
const fileContent = await readFileContent(
|
|
2617
|
-
|
|
2613
|
+
join26(
|
|
2618
2614
|
baseDir,
|
|
2619
2615
|
this.getSettablePaths().relativeDirPath,
|
|
2620
2616
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2650,7 +2646,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
2650
2646
|
};
|
|
2651
2647
|
|
|
2652
2648
|
// src/mcp/copilot-mcp.ts
|
|
2653
|
-
import { join as
|
|
2649
|
+
import { join as join27 } from "path";
|
|
2654
2650
|
var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
2655
2651
|
static getSettablePaths() {
|
|
2656
2652
|
return {
|
|
@@ -2663,7 +2659,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
2663
2659
|
validate = true
|
|
2664
2660
|
}) {
|
|
2665
2661
|
const fileContent = await readFileContent(
|
|
2666
|
-
|
|
2662
|
+
join27(
|
|
2667
2663
|
baseDir,
|
|
2668
2664
|
this.getSettablePaths().relativeDirPath,
|
|
2669
2665
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2699,7 +2695,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
2699
2695
|
};
|
|
2700
2696
|
|
|
2701
2697
|
// src/mcp/cursor-mcp.ts
|
|
2702
|
-
import { join as
|
|
2698
|
+
import { join as join28 } from "path";
|
|
2703
2699
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
2704
2700
|
static getSettablePaths() {
|
|
2705
2701
|
return {
|
|
@@ -2712,7 +2708,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
2712
2708
|
validate = true
|
|
2713
2709
|
}) {
|
|
2714
2710
|
const fileContent = await readFileContent(
|
|
2715
|
-
|
|
2711
|
+
join28(
|
|
2716
2712
|
baseDir,
|
|
2717
2713
|
this.getSettablePaths().relativeDirPath,
|
|
2718
2714
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2759,7 +2755,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
2759
2755
|
};
|
|
2760
2756
|
|
|
2761
2757
|
// src/mcp/roo-mcp.ts
|
|
2762
|
-
import { join as
|
|
2758
|
+
import { join as join29 } from "path";
|
|
2763
2759
|
var RooMcp = class _RooMcp extends ToolMcp {
|
|
2764
2760
|
static getSettablePaths() {
|
|
2765
2761
|
return {
|
|
@@ -2772,7 +2768,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
2772
2768
|
validate = true
|
|
2773
2769
|
}) {
|
|
2774
2770
|
const fileContent = await readFileContent(
|
|
2775
|
-
|
|
2771
|
+
join29(
|
|
2776
2772
|
baseDir,
|
|
2777
2773
|
this.getSettablePaths().relativeDirPath,
|
|
2778
2774
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2979,12 +2975,12 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
2979
2975
|
};
|
|
2980
2976
|
|
|
2981
2977
|
// src/rules/rules-processor.ts
|
|
2982
|
-
import { basename as basename16, join as
|
|
2978
|
+
import { basename as basename16, join as join53 } from "path";
|
|
2983
2979
|
import { XMLBuilder } from "fast-xml-parser";
|
|
2984
2980
|
import { z as z20 } from "zod/mini";
|
|
2985
2981
|
|
|
2986
2982
|
// src/subagents/simulated-subagent.ts
|
|
2987
|
-
import { basename as basename11, join as
|
|
2983
|
+
import { basename as basename11, join as join30 } from "path";
|
|
2988
2984
|
import { z as z12 } from "zod/mini";
|
|
2989
2985
|
|
|
2990
2986
|
// src/subagents/tool-subagent.ts
|
|
@@ -3086,7 +3082,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
3086
3082
|
relativeFilePath,
|
|
3087
3083
|
validate = true
|
|
3088
3084
|
}) {
|
|
3089
|
-
const filePath =
|
|
3085
|
+
const filePath = join30(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
3090
3086
|
const fileContent = await readFileContent(filePath);
|
|
3091
3087
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3092
3088
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -3220,15 +3216,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
3220
3216
|
};
|
|
3221
3217
|
|
|
3222
3218
|
// src/subagents/subagents-processor.ts
|
|
3223
|
-
import { basename as basename13, join as
|
|
3219
|
+
import { basename as basename13, join as join33 } from "path";
|
|
3224
3220
|
import { z as z15 } from "zod/mini";
|
|
3225
3221
|
|
|
3226
3222
|
// src/subagents/claudecode-subagent.ts
|
|
3227
|
-
import { join as
|
|
3223
|
+
import { join as join32 } from "path";
|
|
3228
3224
|
import { z as z14 } from "zod/mini";
|
|
3229
3225
|
|
|
3230
3226
|
// src/subagents/rulesync-subagent.ts
|
|
3231
|
-
import { basename as basename12, join as
|
|
3227
|
+
import { basename as basename12, join as join31 } from "path";
|
|
3232
3228
|
import { z as z13 } from "zod/mini";
|
|
3233
3229
|
var RulesyncSubagentModelSchema = z13.enum(["opus", "sonnet", "haiku", "inherit"]);
|
|
3234
3230
|
var RulesyncSubagentFrontmatterSchema = z13.object({
|
|
@@ -3282,7 +3278,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
3282
3278
|
static async fromFile({
|
|
3283
3279
|
relativeFilePath
|
|
3284
3280
|
}) {
|
|
3285
|
-
const fileContent = await readFileContent(
|
|
3281
|
+
const fileContent = await readFileContent(join31(".rulesync/subagents", relativeFilePath));
|
|
3286
3282
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3287
3283
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
3288
3284
|
if (!result.success) {
|
|
@@ -3400,7 +3396,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
3400
3396
|
relativeFilePath,
|
|
3401
3397
|
validate = true
|
|
3402
3398
|
}) {
|
|
3403
|
-
const fileContent = await readFileContent(
|
|
3399
|
+
const fileContent = await readFileContent(join32(baseDir, ".claude/agents", relativeFilePath));
|
|
3404
3400
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3405
3401
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
3406
3402
|
if (!result.success) {
|
|
@@ -3531,7 +3527,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3531
3527
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
3532
3528
|
*/
|
|
3533
3529
|
async loadRulesyncFiles() {
|
|
3534
|
-
const subagentsDir =
|
|
3530
|
+
const subagentsDir = join33(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
3535
3531
|
const dirExists = await directoryExists(subagentsDir);
|
|
3536
3532
|
if (!dirExists) {
|
|
3537
3533
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -3546,7 +3542,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3546
3542
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
3547
3543
|
const rulesyncSubagents = [];
|
|
3548
3544
|
for (const mdFile of mdFiles) {
|
|
3549
|
-
const filepath =
|
|
3545
|
+
const filepath = join33(subagentsDir, mdFile);
|
|
3550
3546
|
try {
|
|
3551
3547
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
3552
3548
|
relativeFilePath: mdFile,
|
|
@@ -3649,7 +3645,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3649
3645
|
relativeDirPath,
|
|
3650
3646
|
fromFile
|
|
3651
3647
|
}) {
|
|
3652
|
-
const paths = await findFilesByGlobs(
|
|
3648
|
+
const paths = await findFilesByGlobs(join33(this.baseDir, relativeDirPath, "*.md"));
|
|
3653
3649
|
const subagents = (await Promise.allSettled(paths.map((path2) => fromFile(basename13(path2))))).filter((r) => r.status === "fulfilled").map((r) => r.value);
|
|
3654
3650
|
logger.info(`Successfully loaded ${subagents.length} ${relativeDirPath} subagents`);
|
|
3655
3651
|
return subagents;
|
|
@@ -3674,13 +3670,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3674
3670
|
};
|
|
3675
3671
|
|
|
3676
3672
|
// src/rules/agentsmd-rule.ts
|
|
3677
|
-
import { join as
|
|
3673
|
+
import { join as join36 } from "path";
|
|
3678
3674
|
|
|
3679
3675
|
// src/rules/tool-rule.ts
|
|
3680
|
-
import { join as
|
|
3676
|
+
import { join as join35 } from "path";
|
|
3681
3677
|
|
|
3682
3678
|
// src/rules/rulesync-rule.ts
|
|
3683
|
-
import { basename as basename14, join as
|
|
3679
|
+
import { basename as basename14, join as join34 } from "path";
|
|
3684
3680
|
import { z as z16 } from "zod/mini";
|
|
3685
3681
|
var RulesyncRuleFrontmatterSchema = z16.object({
|
|
3686
3682
|
root: z16.optional(z16.optional(z16.boolean())),
|
|
@@ -3746,7 +3742,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3746
3742
|
relativeFilePath,
|
|
3747
3743
|
validate = true
|
|
3748
3744
|
}) {
|
|
3749
|
-
const filePath =
|
|
3745
|
+
const filePath = join34(this.getSettablePaths().legacy.relativeDirPath, relativeFilePath);
|
|
3750
3746
|
const fileContent = await readFileContent(filePath);
|
|
3751
3747
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3752
3748
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -3775,7 +3771,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3775
3771
|
relativeFilePath,
|
|
3776
3772
|
validate = true
|
|
3777
3773
|
}) {
|
|
3778
|
-
const filePath =
|
|
3774
|
+
const filePath = join34(this.getSettablePaths().recommended.relativeDirPath, relativeFilePath);
|
|
3779
3775
|
const fileContent = await readFileContent(filePath);
|
|
3780
3776
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3781
3777
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -3879,7 +3875,7 @@ var ToolRule = class extends ToolFile {
|
|
|
3879
3875
|
});
|
|
3880
3876
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
3881
3877
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
3882
|
-
params.relativeDirPath =
|
|
3878
|
+
params.relativeDirPath = join35(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
3883
3879
|
params.relativeFilePath = "AGENTS.md";
|
|
3884
3880
|
}
|
|
3885
3881
|
return params;
|
|
@@ -3955,8 +3951,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
3955
3951
|
validate = true
|
|
3956
3952
|
}) {
|
|
3957
3953
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
3958
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
3959
|
-
const fileContent = await readFileContent(
|
|
3954
|
+
const relativePath = isRoot ? "AGENTS.md" : join36(".agents/memories", relativeFilePath);
|
|
3955
|
+
const fileContent = await readFileContent(join36(baseDir, relativePath));
|
|
3960
3956
|
return new _AgentsMdRule({
|
|
3961
3957
|
baseDir,
|
|
3962
3958
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -3996,7 +3992,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
3996
3992
|
};
|
|
3997
3993
|
|
|
3998
3994
|
// src/rules/amazonqcli-rule.ts
|
|
3999
|
-
import { join as
|
|
3995
|
+
import { join as join37 } from "path";
|
|
4000
3996
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
4001
3997
|
static getSettablePaths() {
|
|
4002
3998
|
return {
|
|
@@ -4011,7 +4007,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
4011
4007
|
validate = true
|
|
4012
4008
|
}) {
|
|
4013
4009
|
const fileContent = await readFileContent(
|
|
4014
|
-
|
|
4010
|
+
join37(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4015
4011
|
);
|
|
4016
4012
|
return new _AmazonQCliRule({
|
|
4017
4013
|
baseDir,
|
|
@@ -4051,7 +4047,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
4051
4047
|
};
|
|
4052
4048
|
|
|
4053
4049
|
// src/rules/augmentcode-legacy-rule.ts
|
|
4054
|
-
import { join as
|
|
4050
|
+
import { join as join38 } from "path";
|
|
4055
4051
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
4056
4052
|
toRulesyncRule() {
|
|
4057
4053
|
const rulesyncFrontmatter = {
|
|
@@ -4112,8 +4108,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
4112
4108
|
}) {
|
|
4113
4109
|
const settablePaths = this.getSettablePaths();
|
|
4114
4110
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
4115
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
4116
|
-
const fileContent = await readFileContent(
|
|
4111
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join38(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
4112
|
+
const fileContent = await readFileContent(join38(baseDir, relativePath));
|
|
4117
4113
|
return new _AugmentcodeLegacyRule({
|
|
4118
4114
|
baseDir,
|
|
4119
4115
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -4126,7 +4122,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
4126
4122
|
};
|
|
4127
4123
|
|
|
4128
4124
|
// src/rules/augmentcode-rule.ts
|
|
4129
|
-
import { join as
|
|
4125
|
+
import { join as join39 } from "path";
|
|
4130
4126
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
4131
4127
|
toRulesyncRule() {
|
|
4132
4128
|
return this.toRulesyncRuleDefault();
|
|
@@ -4158,7 +4154,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
4158
4154
|
validate = true
|
|
4159
4155
|
}) {
|
|
4160
4156
|
const fileContent = await readFileContent(
|
|
4161
|
-
|
|
4157
|
+
join39(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4162
4158
|
);
|
|
4163
4159
|
const { body: content } = parseFrontmatter(fileContent);
|
|
4164
4160
|
return new _AugmentcodeRule({
|
|
@@ -4181,7 +4177,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
4181
4177
|
};
|
|
4182
4178
|
|
|
4183
4179
|
// src/rules/claudecode-rule.ts
|
|
4184
|
-
import { join as
|
|
4180
|
+
import { join as join40 } from "path";
|
|
4185
4181
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
4186
4182
|
static getSettablePaths() {
|
|
4187
4183
|
return {
|
|
@@ -4190,7 +4186,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
4190
4186
|
relativeFilePath: "CLAUDE.md"
|
|
4191
4187
|
},
|
|
4192
4188
|
nonRoot: {
|
|
4193
|
-
relativeDirPath:
|
|
4189
|
+
relativeDirPath: join40(".claude", "memories")
|
|
4194
4190
|
}
|
|
4195
4191
|
};
|
|
4196
4192
|
}
|
|
@@ -4213,7 +4209,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
4213
4209
|
if (isRoot) {
|
|
4214
4210
|
const relativePath2 = paths.root.relativeFilePath;
|
|
4215
4211
|
const fileContent2 = await readFileContent(
|
|
4216
|
-
|
|
4212
|
+
join40(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
4217
4213
|
);
|
|
4218
4214
|
return new _ClaudecodeRule({
|
|
4219
4215
|
baseDir,
|
|
@@ -4227,8 +4223,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
4227
4223
|
if (!paths.nonRoot) {
|
|
4228
4224
|
throw new Error("nonRoot path is not set");
|
|
4229
4225
|
}
|
|
4230
|
-
const relativePath =
|
|
4231
|
-
const fileContent = await readFileContent(
|
|
4226
|
+
const relativePath = join40(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
4227
|
+
const fileContent = await readFileContent(join40(baseDir, relativePath));
|
|
4232
4228
|
return new _ClaudecodeRule({
|
|
4233
4229
|
baseDir,
|
|
4234
4230
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -4270,7 +4266,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
4270
4266
|
};
|
|
4271
4267
|
|
|
4272
4268
|
// src/rules/cline-rule.ts
|
|
4273
|
-
import { join as
|
|
4269
|
+
import { join as join41 } from "path";
|
|
4274
4270
|
import { z as z17 } from "zod/mini";
|
|
4275
4271
|
var ClineRuleFrontmatterSchema = z17.object({
|
|
4276
4272
|
description: z17.string()
|
|
@@ -4315,7 +4311,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
4315
4311
|
validate = true
|
|
4316
4312
|
}) {
|
|
4317
4313
|
const fileContent = await readFileContent(
|
|
4318
|
-
|
|
4314
|
+
join41(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4319
4315
|
);
|
|
4320
4316
|
return new _ClineRule({
|
|
4321
4317
|
baseDir,
|
|
@@ -4328,7 +4324,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
4328
4324
|
};
|
|
4329
4325
|
|
|
4330
4326
|
// src/rules/codexcli-rule.ts
|
|
4331
|
-
import { join as
|
|
4327
|
+
import { join as join42 } from "path";
|
|
4332
4328
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
4333
4329
|
static getSettablePaths() {
|
|
4334
4330
|
return {
|
|
@@ -4360,7 +4356,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4360
4356
|
if (isRoot) {
|
|
4361
4357
|
const relativePath2 = paths.root.relativeFilePath;
|
|
4362
4358
|
const fileContent2 = await readFileContent(
|
|
4363
|
-
|
|
4359
|
+
join42(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
4364
4360
|
);
|
|
4365
4361
|
return new _CodexcliRule({
|
|
4366
4362
|
baseDir,
|
|
@@ -4374,8 +4370,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4374
4370
|
if (!paths.nonRoot) {
|
|
4375
4371
|
throw new Error("nonRoot path is not set");
|
|
4376
4372
|
}
|
|
4377
|
-
const relativePath =
|
|
4378
|
-
const fileContent = await readFileContent(
|
|
4373
|
+
const relativePath = join42(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
4374
|
+
const fileContent = await readFileContent(join42(baseDir, relativePath));
|
|
4379
4375
|
return new _CodexcliRule({
|
|
4380
4376
|
baseDir,
|
|
4381
4377
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -4417,7 +4413,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4417
4413
|
};
|
|
4418
4414
|
|
|
4419
4415
|
// src/rules/copilot-rule.ts
|
|
4420
|
-
import { join as
|
|
4416
|
+
import { join as join43 } from "path";
|
|
4421
4417
|
import { z as z18 } from "zod/mini";
|
|
4422
4418
|
var CopilotRuleFrontmatterSchema = z18.object({
|
|
4423
4419
|
description: z18.optional(z18.string()),
|
|
@@ -4510,11 +4506,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4510
4506
|
validate = true
|
|
4511
4507
|
}) {
|
|
4512
4508
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
4513
|
-
const relativePath = isRoot ?
|
|
4509
|
+
const relativePath = isRoot ? join43(
|
|
4514
4510
|
this.getSettablePaths().root.relativeDirPath,
|
|
4515
4511
|
this.getSettablePaths().root.relativeFilePath
|
|
4516
|
-
) :
|
|
4517
|
-
const fileContent = await readFileContent(
|
|
4512
|
+
) : join43(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4513
|
+
const fileContent = await readFileContent(join43(baseDir, relativePath));
|
|
4518
4514
|
if (isRoot) {
|
|
4519
4515
|
return new _CopilotRule({
|
|
4520
4516
|
baseDir,
|
|
@@ -4533,7 +4529,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4533
4529
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
4534
4530
|
if (!result.success) {
|
|
4535
4531
|
throw new Error(
|
|
4536
|
-
`Invalid frontmatter in ${
|
|
4532
|
+
`Invalid frontmatter in ${join43(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
4537
4533
|
);
|
|
4538
4534
|
}
|
|
4539
4535
|
return new _CopilotRule({
|
|
@@ -4572,7 +4568,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4572
4568
|
};
|
|
4573
4569
|
|
|
4574
4570
|
// src/rules/cursor-rule.ts
|
|
4575
|
-
import { basename as basename15, join as
|
|
4571
|
+
import { basename as basename15, join as join44 } from "path";
|
|
4576
4572
|
import { z as z19 } from "zod/mini";
|
|
4577
4573
|
var CursorRuleFrontmatterSchema = z19.object({
|
|
4578
4574
|
description: z19.optional(z19.string()),
|
|
@@ -4699,13 +4695,13 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
4699
4695
|
validate = true
|
|
4700
4696
|
}) {
|
|
4701
4697
|
const fileContent = await readFileContent(
|
|
4702
|
-
|
|
4698
|
+
join44(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4703
4699
|
);
|
|
4704
4700
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
4705
4701
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
4706
4702
|
if (!result.success) {
|
|
4707
4703
|
throw new Error(
|
|
4708
|
-
`Invalid frontmatter in ${
|
|
4704
|
+
`Invalid frontmatter in ${join44(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
4709
4705
|
);
|
|
4710
4706
|
}
|
|
4711
4707
|
return new _CursorRule({
|
|
@@ -4743,7 +4739,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
4743
4739
|
};
|
|
4744
4740
|
|
|
4745
4741
|
// src/rules/geminicli-rule.ts
|
|
4746
|
-
import { join as
|
|
4742
|
+
import { join as join45 } from "path";
|
|
4747
4743
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
4748
4744
|
static getSettablePaths() {
|
|
4749
4745
|
return {
|
|
@@ -4756,35 +4752,64 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
4756
4752
|
}
|
|
4757
4753
|
};
|
|
4758
4754
|
}
|
|
4755
|
+
static getSettablePathsGlobal() {
|
|
4756
|
+
return {
|
|
4757
|
+
root: {
|
|
4758
|
+
relativeDirPath: ".gemini",
|
|
4759
|
+
relativeFilePath: "GEMINI.md"
|
|
4760
|
+
}
|
|
4761
|
+
};
|
|
4762
|
+
}
|
|
4759
4763
|
static async fromFile({
|
|
4760
4764
|
baseDir = ".",
|
|
4761
4765
|
relativeFilePath,
|
|
4762
|
-
validate = true
|
|
4766
|
+
validate = true,
|
|
4767
|
+
global = false
|
|
4763
4768
|
}) {
|
|
4764
|
-
const
|
|
4765
|
-
const
|
|
4766
|
-
|
|
4769
|
+
const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
|
|
4770
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
4771
|
+
if (isRoot) {
|
|
4772
|
+
const relativePath2 = paths.root.relativeFilePath;
|
|
4773
|
+
const fileContent2 = await readFileContent(
|
|
4774
|
+
join45(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
4775
|
+
);
|
|
4776
|
+
return new _GeminiCliRule({
|
|
4777
|
+
baseDir,
|
|
4778
|
+
relativeDirPath: paths.root.relativeDirPath,
|
|
4779
|
+
relativeFilePath: paths.root.relativeFilePath,
|
|
4780
|
+
fileContent: fileContent2,
|
|
4781
|
+
validate,
|
|
4782
|
+
root: true
|
|
4783
|
+
});
|
|
4784
|
+
}
|
|
4785
|
+
if (!paths.nonRoot) {
|
|
4786
|
+
throw new Error("nonRoot path is not set");
|
|
4787
|
+
}
|
|
4788
|
+
const relativePath = join45(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
4789
|
+
const fileContent = await readFileContent(join45(baseDir, relativePath));
|
|
4767
4790
|
return new _GeminiCliRule({
|
|
4768
4791
|
baseDir,
|
|
4769
|
-
relativeDirPath:
|
|
4770
|
-
relativeFilePath
|
|
4792
|
+
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
4793
|
+
relativeFilePath,
|
|
4771
4794
|
fileContent,
|
|
4772
4795
|
validate,
|
|
4773
|
-
root:
|
|
4796
|
+
root: false
|
|
4774
4797
|
});
|
|
4775
4798
|
}
|
|
4776
4799
|
static fromRulesyncRule({
|
|
4777
4800
|
baseDir = ".",
|
|
4778
4801
|
rulesyncRule,
|
|
4779
|
-
validate = true
|
|
4802
|
+
validate = true,
|
|
4803
|
+
global = false
|
|
4780
4804
|
}) {
|
|
4805
|
+
const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
|
|
4781
4806
|
return new _GeminiCliRule(
|
|
4782
4807
|
this.buildToolRuleParamsDefault({
|
|
4783
4808
|
baseDir,
|
|
4784
4809
|
rulesyncRule,
|
|
4785
4810
|
validate,
|
|
4786
|
-
rootPath:
|
|
4787
|
-
nonRootPath:
|
|
4811
|
+
rootPath: paths.root,
|
|
4812
|
+
nonRootPath: paths.nonRoot
|
|
4788
4813
|
})
|
|
4789
4814
|
);
|
|
4790
4815
|
}
|
|
@@ -4803,7 +4828,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
4803
4828
|
};
|
|
4804
4829
|
|
|
4805
4830
|
// src/rules/junie-rule.ts
|
|
4806
|
-
import { join as
|
|
4831
|
+
import { join as join46 } from "path";
|
|
4807
4832
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
4808
4833
|
static getSettablePaths() {
|
|
4809
4834
|
return {
|
|
@@ -4822,8 +4847,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
4822
4847
|
validate = true
|
|
4823
4848
|
}) {
|
|
4824
4849
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
4825
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
4826
|
-
const fileContent = await readFileContent(
|
|
4850
|
+
const relativePath = isRoot ? "guidelines.md" : join46(".junie/memories", relativeFilePath);
|
|
4851
|
+
const fileContent = await readFileContent(join46(baseDir, relativePath));
|
|
4827
4852
|
return new _JunieRule({
|
|
4828
4853
|
baseDir,
|
|
4829
4854
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4863,7 +4888,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
4863
4888
|
};
|
|
4864
4889
|
|
|
4865
4890
|
// src/rules/kiro-rule.ts
|
|
4866
|
-
import { join as
|
|
4891
|
+
import { join as join47 } from "path";
|
|
4867
4892
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
4868
4893
|
static getSettablePaths() {
|
|
4869
4894
|
return {
|
|
@@ -4878,7 +4903,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
4878
4903
|
validate = true
|
|
4879
4904
|
}) {
|
|
4880
4905
|
const fileContent = await readFileContent(
|
|
4881
|
-
|
|
4906
|
+
join47(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4882
4907
|
);
|
|
4883
4908
|
return new _KiroRule({
|
|
4884
4909
|
baseDir,
|
|
@@ -4918,7 +4943,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
4918
4943
|
};
|
|
4919
4944
|
|
|
4920
4945
|
// src/rules/opencode-rule.ts
|
|
4921
|
-
import { join as
|
|
4946
|
+
import { join as join48 } from "path";
|
|
4922
4947
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
4923
4948
|
static getSettablePaths() {
|
|
4924
4949
|
return {
|
|
@@ -4937,8 +4962,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
4937
4962
|
validate = true
|
|
4938
4963
|
}) {
|
|
4939
4964
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
4940
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
4941
|
-
const fileContent = await readFileContent(
|
|
4965
|
+
const relativePath = isRoot ? "AGENTS.md" : join48(".opencode/memories", relativeFilePath);
|
|
4966
|
+
const fileContent = await readFileContent(join48(baseDir, relativePath));
|
|
4942
4967
|
return new _OpenCodeRule({
|
|
4943
4968
|
baseDir,
|
|
4944
4969
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4978,7 +5003,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
4978
5003
|
};
|
|
4979
5004
|
|
|
4980
5005
|
// src/rules/qwencode-rule.ts
|
|
4981
|
-
import { join as
|
|
5006
|
+
import { join as join49 } from "path";
|
|
4982
5007
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
4983
5008
|
static getSettablePaths() {
|
|
4984
5009
|
return {
|
|
@@ -4997,8 +5022,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
4997
5022
|
validate = true
|
|
4998
5023
|
}) {
|
|
4999
5024
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
5000
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
5001
|
-
const fileContent = await readFileContent(
|
|
5025
|
+
const relativePath = isRoot ? "QWEN.md" : join49(".qwen/memories", relativeFilePath);
|
|
5026
|
+
const fileContent = await readFileContent(join49(baseDir, relativePath));
|
|
5002
5027
|
return new _QwencodeRule({
|
|
5003
5028
|
baseDir,
|
|
5004
5029
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -5035,7 +5060,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
5035
5060
|
};
|
|
5036
5061
|
|
|
5037
5062
|
// src/rules/roo-rule.ts
|
|
5038
|
-
import { join as
|
|
5063
|
+
import { join as join50 } from "path";
|
|
5039
5064
|
var RooRule = class _RooRule extends ToolRule {
|
|
5040
5065
|
static getSettablePaths() {
|
|
5041
5066
|
return {
|
|
@@ -5050,7 +5075,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
5050
5075
|
validate = true
|
|
5051
5076
|
}) {
|
|
5052
5077
|
const fileContent = await readFileContent(
|
|
5053
|
-
|
|
5078
|
+
join50(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
5054
5079
|
);
|
|
5055
5080
|
return new _RooRule({
|
|
5056
5081
|
baseDir,
|
|
@@ -5105,7 +5130,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
5105
5130
|
};
|
|
5106
5131
|
|
|
5107
5132
|
// src/rules/warp-rule.ts
|
|
5108
|
-
import { join as
|
|
5133
|
+
import { join as join51 } from "path";
|
|
5109
5134
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
5110
5135
|
constructor({ fileContent, root, ...rest }) {
|
|
5111
5136
|
super({
|
|
@@ -5131,8 +5156,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
5131
5156
|
validate = true
|
|
5132
5157
|
}) {
|
|
5133
5158
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
5134
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
5135
|
-
const fileContent = await readFileContent(
|
|
5159
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join51(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
5160
|
+
const fileContent = await readFileContent(join51(baseDir, relativePath));
|
|
5136
5161
|
return new _WarpRule({
|
|
5137
5162
|
baseDir,
|
|
5138
5163
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -5172,7 +5197,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
5172
5197
|
};
|
|
5173
5198
|
|
|
5174
5199
|
// src/rules/windsurf-rule.ts
|
|
5175
|
-
import { join as
|
|
5200
|
+
import { join as join52 } from "path";
|
|
5176
5201
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
5177
5202
|
static getSettablePaths() {
|
|
5178
5203
|
return {
|
|
@@ -5187,7 +5212,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
5187
5212
|
validate = true
|
|
5188
5213
|
}) {
|
|
5189
5214
|
const fileContent = await readFileContent(
|
|
5190
|
-
|
|
5215
|
+
join52(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
5191
5216
|
);
|
|
5192
5217
|
return new _WindsurfRule({
|
|
5193
5218
|
baseDir,
|
|
@@ -5246,7 +5271,11 @@ var rulesProcessorToolTargets = [
|
|
|
5246
5271
|
"windsurf"
|
|
5247
5272
|
];
|
|
5248
5273
|
var RulesProcessorToolTargetSchema = z20.enum(rulesProcessorToolTargets);
|
|
5249
|
-
var rulesProcessorToolTargetsGlobal = [
|
|
5274
|
+
var rulesProcessorToolTargetsGlobal = [
|
|
5275
|
+
"claudecode",
|
|
5276
|
+
"codexcli",
|
|
5277
|
+
"geminicli"
|
|
5278
|
+
];
|
|
5250
5279
|
var RulesProcessor = class extends FeatureProcessor {
|
|
5251
5280
|
toolTarget;
|
|
5252
5281
|
simulateCommands;
|
|
@@ -5361,7 +5390,8 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5361
5390
|
return GeminiCliRule.fromRulesyncRule({
|
|
5362
5391
|
baseDir: this.baseDir,
|
|
5363
5392
|
rulesyncRule,
|
|
5364
|
-
validate: true
|
|
5393
|
+
validate: true,
|
|
5394
|
+
global: this.global
|
|
5365
5395
|
});
|
|
5366
5396
|
case "junie":
|
|
5367
5397
|
if (!JunieRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
@@ -5496,7 +5526,6 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5496
5526
|
const rootRule = toolRules[rootRuleIndex];
|
|
5497
5527
|
rootRule?.setFileContent(
|
|
5498
5528
|
this.generateXmlReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
|
|
5499
|
-
commands: { relativeDirPath: CodexCliCommand.getSettablePaths().relativeDirPath },
|
|
5500
5529
|
subagents: {
|
|
5501
5530
|
relativeDirPath: CodexCliSubagent.getSettablePaths().relativeDirPath
|
|
5502
5531
|
}
|
|
@@ -5572,7 +5601,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5572
5601
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
5573
5602
|
*/
|
|
5574
5603
|
async loadRulesyncFiles() {
|
|
5575
|
-
const files = await findFilesByGlobs(
|
|
5604
|
+
const files = await findFilesByGlobs(join53(".rulesync/rules", "*.md"));
|
|
5576
5605
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
5577
5606
|
const rulesyncRules = await Promise.all(
|
|
5578
5607
|
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename16(file) }))
|
|
@@ -5593,7 +5622,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5593
5622
|
return rulesyncRules;
|
|
5594
5623
|
}
|
|
5595
5624
|
async loadRulesyncFilesLegacy() {
|
|
5596
|
-
const legacyFiles = await findFilesByGlobs(
|
|
5625
|
+
const legacyFiles = await findFilesByGlobs(join53(".rulesync", "*.md"));
|
|
5597
5626
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
5598
5627
|
return Promise.all(
|
|
5599
5628
|
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename16(file) }))
|
|
@@ -5660,7 +5689,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5660
5689
|
return [];
|
|
5661
5690
|
}
|
|
5662
5691
|
const rootFilePaths = await findFilesByGlobs(
|
|
5663
|
-
|
|
5692
|
+
join53(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
|
|
5664
5693
|
);
|
|
5665
5694
|
return await Promise.all(
|
|
5666
5695
|
rootFilePaths.map(
|
|
@@ -5678,7 +5707,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5678
5707
|
return [];
|
|
5679
5708
|
}
|
|
5680
5709
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
5681
|
-
|
|
5710
|
+
join53(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
|
|
5682
5711
|
);
|
|
5683
5712
|
return await Promise.all(
|
|
5684
5713
|
nonRootFilePaths.map(
|
|
@@ -5858,18 +5887,20 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5858
5887
|
* Load Gemini CLI rule configuration from GEMINI.md file
|
|
5859
5888
|
*/
|
|
5860
5889
|
async loadGeminicliRules() {
|
|
5861
|
-
const settablePaths = GeminiCliRule.getSettablePaths();
|
|
5890
|
+
const settablePaths = this.global ? GeminiCliRule.getSettablePathsGlobal() : GeminiCliRule.getSettablePaths();
|
|
5862
5891
|
return await this.loadToolRulesDefault({
|
|
5863
5892
|
root: {
|
|
5864
5893
|
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
5865
5894
|
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
5866
5895
|
fromFile: (params) => GeminiCliRule.fromFile(params)
|
|
5867
5896
|
},
|
|
5868
|
-
nonRoot
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5897
|
+
...settablePaths.nonRoot ? {
|
|
5898
|
+
nonRoot: {
|
|
5899
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
5900
|
+
fromFile: (params) => GeminiCliRule.fromFile(params),
|
|
5901
|
+
extension: "md"
|
|
5902
|
+
}
|
|
5903
|
+
} : {}
|
|
5873
5904
|
});
|
|
5874
5905
|
}
|
|
5875
5906
|
/**
|
|
@@ -6037,7 +6068,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
6037
6068
|
const overview = `# Additional Conventions Beyond the Built-in Functions
|
|
6038
6069
|
|
|
6039
6070
|
As this project's AI coding tool, you must follow the additional conventions below, in addition to the built-in functions.`;
|
|
6040
|
-
const commandsSection = `## Simulated Custom Slash Commands
|
|
6071
|
+
const commandsSection = commands ? `## Simulated Custom Slash Commands
|
|
6041
6072
|
|
|
6042
6073
|
Custom slash commands allow you to define frequently-used prompts as Markdown files that you can execute.
|
|
6043
6074
|
|
|
@@ -6052,14 +6083,14 @@ s/<command> [arguments]
|
|
|
6052
6083
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
6053
6084
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
6054
6085
|
|
|
6055
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
6056
|
-
const subagentsSection = `## Simulated Subagents
|
|
6086
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join53(commands.relativeDirPath, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
6087
|
+
const subagentsSection = subagents ? `## Simulated Subagents
|
|
6057
6088
|
|
|
6058
6089
|
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.
|
|
6059
6090
|
|
|
6060
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
6091
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join53(subagents.relativeDirPath, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
6061
6092
|
|
|
6062
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
6093
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join53(subagents.relativeDirPath, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
6063
6094
|
const result = [
|
|
6064
6095
|
overview,
|
|
6065
6096
|
...this.simulateCommands && CommandsProcessor.getToolTargetsSimulated().includes(this.toolTarget) ? [commandsSection] : [],
|
|
@@ -6284,9 +6315,9 @@ async function generateSubagents(config) {
|
|
|
6284
6315
|
}
|
|
6285
6316
|
|
|
6286
6317
|
// src/cli/commands/gitignore.ts
|
|
6287
|
-
import { join as
|
|
6318
|
+
import { join as join54 } from "path";
|
|
6288
6319
|
var gitignoreCommand = async () => {
|
|
6289
|
-
const gitignorePath =
|
|
6320
|
+
const gitignorePath = join54(process.cwd(), ".gitignore");
|
|
6290
6321
|
const rulesFilesToIgnore = [
|
|
6291
6322
|
"# Generated by rulesync - AI tool configuration files",
|
|
6292
6323
|
"**/.amazonq/",
|
|
@@ -6523,7 +6554,7 @@ async function importSubagents(config, tool) {
|
|
|
6523
6554
|
}
|
|
6524
6555
|
|
|
6525
6556
|
// src/cli/commands/init.ts
|
|
6526
|
-
import { join as
|
|
6557
|
+
import { join as join55 } from "path";
|
|
6527
6558
|
async function initCommand() {
|
|
6528
6559
|
logger.info("Initializing rulesync...");
|
|
6529
6560
|
await ensureDir(".rulesync");
|
|
@@ -6594,7 +6625,7 @@ globs: ["**/*"]
|
|
|
6594
6625
|
- Follow single responsibility principle
|
|
6595
6626
|
`
|
|
6596
6627
|
};
|
|
6597
|
-
const filepath =
|
|
6628
|
+
const filepath = join55(".rulesync/rules", sampleFile.filename);
|
|
6598
6629
|
await ensureDir(".rulesync/rules");
|
|
6599
6630
|
await ensureDir(RulesyncCommand.getSettablePaths().relativeDirPath);
|
|
6600
6631
|
await ensureDir(".rulesync/subagents");
|
|
@@ -6607,7 +6638,7 @@ globs: ["**/*"]
|
|
|
6607
6638
|
}
|
|
6608
6639
|
|
|
6609
6640
|
// src/cli/index.ts
|
|
6610
|
-
var getVersion = () => "
|
|
6641
|
+
var getVersion = () => "3.0.0";
|
|
6611
6642
|
var main = async () => {
|
|
6612
6643
|
const program = new Command();
|
|
6613
6644
|
const version = getVersion();
|