rulesync 7.13.0 → 7.14.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/{chunk-JGRHJWG5.js → chunk-UWNVSK5V.js} +751 -337
- package/dist/cli/index.cjs +1332 -619
- package/dist/cli/index.js +380 -77
- package/dist/index.cjs +1002 -608
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -38,7 +38,7 @@ __export(index_exports, {
|
|
|
38
38
|
module.exports = __toCommonJS(index_exports);
|
|
39
39
|
|
|
40
40
|
// src/config/config-resolver.ts
|
|
41
|
-
var
|
|
41
|
+
var import_node_path4 = require("path");
|
|
42
42
|
var import_jsonc_parser = require("jsonc-parser");
|
|
43
43
|
|
|
44
44
|
// src/constants/rulesync-paths.ts
|
|
@@ -288,6 +288,7 @@ function toKebabCaseFilename(filename) {
|
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
// src/config/config.ts
|
|
291
|
+
var import_node_path3 = require("path");
|
|
291
292
|
var import_mini3 = require("zod/mini");
|
|
292
293
|
|
|
293
294
|
// src/types/features.ts
|
|
@@ -343,9 +344,30 @@ var ToolTargetsSchema = import_mini2.z.array(ToolTargetSchema);
|
|
|
343
344
|
var RulesyncTargetsSchema = import_mini2.z.array(import_mini2.z.enum(ALL_TOOL_TARGETS_WITH_WILDCARD));
|
|
344
345
|
|
|
345
346
|
// src/config/config.ts
|
|
347
|
+
function hasControlCharacters(value) {
|
|
348
|
+
for (let i = 0; i < value.length; i++) {
|
|
349
|
+
const code = value.charCodeAt(i);
|
|
350
|
+
if (code >= 0 && code <= 31 || code === 127) return true;
|
|
351
|
+
}
|
|
352
|
+
return false;
|
|
353
|
+
}
|
|
346
354
|
var SourceEntrySchema = import_mini3.z.object({
|
|
347
355
|
source: import_mini3.z.string().check((0, import_mini3.minLength)(1, "source must be a non-empty string")),
|
|
348
|
-
skills: (0, import_mini3.optional)(import_mini3.z.array(import_mini3.z.string()))
|
|
356
|
+
skills: (0, import_mini3.optional)(import_mini3.z.array(import_mini3.z.string())),
|
|
357
|
+
transport: (0, import_mini3.optional)(import_mini3.z.enum(["github", "git"])),
|
|
358
|
+
ref: (0, import_mini3.optional)(
|
|
359
|
+
import_mini3.z.string().check(
|
|
360
|
+
(0, import_mini3.refine)((v) => !v.startsWith("-"), 'ref must not start with "-"'),
|
|
361
|
+
(0, import_mini3.refine)((v) => !hasControlCharacters(v), "ref must not contain control characters")
|
|
362
|
+
)
|
|
363
|
+
),
|
|
364
|
+
path: (0, import_mini3.optional)(
|
|
365
|
+
import_mini3.z.string().check(
|
|
366
|
+
(0, import_mini3.refine)((v) => !v.includes(".."), 'path must not contain ".."'),
|
|
367
|
+
(0, import_mini3.refine)((v) => !(0, import_node_path3.isAbsolute)(v), "path must not be absolute"),
|
|
368
|
+
(0, import_mini3.refine)((v) => !hasControlCharacters(v), "path must not contain control characters")
|
|
369
|
+
)
|
|
370
|
+
)
|
|
349
371
|
});
|
|
350
372
|
var ConfigParamsSchema = import_mini3.z.object({
|
|
351
373
|
baseDirs: import_mini3.z.array(import_mini3.z.string()),
|
|
@@ -590,8 +612,8 @@ var ConfigResolver = class {
|
|
|
590
612
|
}) {
|
|
591
613
|
const validatedConfigPath = resolvePath(configPath, process.cwd());
|
|
592
614
|
const baseConfig = await loadConfigFromFile(validatedConfigPath);
|
|
593
|
-
const configDir = (0,
|
|
594
|
-
const localConfigPath = (0,
|
|
615
|
+
const configDir = (0, import_node_path4.dirname)(validatedConfigPath);
|
|
616
|
+
const localConfigPath = (0, import_node_path4.join)(configDir, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH);
|
|
595
617
|
const localConfig = await loadConfigFromFile(localConfigPath);
|
|
596
618
|
const configByFile = mergeConfigs(baseConfig, localConfig);
|
|
597
619
|
const resolvedGlobal = global ?? configByFile.global ?? getDefaults().global;
|
|
@@ -626,7 +648,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
626
648
|
if (global) {
|
|
627
649
|
return [getHomeDirectory()];
|
|
628
650
|
}
|
|
629
|
-
const resolvedBaseDirs = baseDirs.map((baseDir) => (0,
|
|
651
|
+
const resolvedBaseDirs = baseDirs.map((baseDir) => (0, import_node_path4.resolve)(baseDir));
|
|
630
652
|
resolvedBaseDirs.forEach((baseDir) => {
|
|
631
653
|
validateBaseDir(baseDir);
|
|
632
654
|
});
|
|
@@ -634,11 +656,11 @@ function getBaseDirsInLightOfGlobal({
|
|
|
634
656
|
}
|
|
635
657
|
|
|
636
658
|
// src/lib/generate.ts
|
|
637
|
-
var
|
|
659
|
+
var import_node_path118 = require("path");
|
|
638
660
|
var import_es_toolkit4 = require("es-toolkit");
|
|
639
661
|
|
|
640
662
|
// src/features/commands/commands-processor.ts
|
|
641
|
-
var
|
|
663
|
+
var import_node_path21 = require("path");
|
|
642
664
|
var import_mini13 = require("zod/mini");
|
|
643
665
|
|
|
644
666
|
// src/types/feature-processor.ts
|
|
@@ -704,7 +726,7 @@ var FeatureProcessor = class {
|
|
|
704
726
|
};
|
|
705
727
|
|
|
706
728
|
// src/features/commands/agentsmd-command.ts
|
|
707
|
-
var
|
|
729
|
+
var import_node_path7 = require("path");
|
|
708
730
|
|
|
709
731
|
// src/utils/frontmatter.ts
|
|
710
732
|
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
@@ -770,11 +792,11 @@ function parseFrontmatter(content, filePath) {
|
|
|
770
792
|
}
|
|
771
793
|
|
|
772
794
|
// src/features/commands/simulated-command.ts
|
|
773
|
-
var
|
|
795
|
+
var import_node_path6 = require("path");
|
|
774
796
|
var import_mini4 = require("zod/mini");
|
|
775
797
|
|
|
776
798
|
// src/types/ai-file.ts
|
|
777
|
-
var
|
|
799
|
+
var import_node_path5 = __toESM(require("path"), 1);
|
|
778
800
|
var AiFile = class {
|
|
779
801
|
/**
|
|
780
802
|
* @example "."
|
|
@@ -822,11 +844,11 @@ var AiFile = class {
|
|
|
822
844
|
return this.relativeFilePath;
|
|
823
845
|
}
|
|
824
846
|
getFilePath() {
|
|
825
|
-
const fullPath =
|
|
826
|
-
const resolvedFull = (0,
|
|
827
|
-
const resolvedBase = (0,
|
|
828
|
-
const rel = (0,
|
|
829
|
-
if (rel.startsWith("..") ||
|
|
847
|
+
const fullPath = import_node_path5.default.join(this.baseDir, this.relativeDirPath, this.relativeFilePath);
|
|
848
|
+
const resolvedFull = (0, import_node_path5.resolve)(fullPath);
|
|
849
|
+
const resolvedBase = (0, import_node_path5.resolve)(this.baseDir);
|
|
850
|
+
const rel = (0, import_node_path5.relative)(resolvedBase, resolvedFull);
|
|
851
|
+
if (rel.startsWith("..") || import_node_path5.default.isAbsolute(rel)) {
|
|
830
852
|
throw new Error(
|
|
831
853
|
`Path traversal detected: Final path escapes baseDir. baseDir="${this.baseDir}", relativeDirPath="${this.relativeDirPath}", relativeFilePath="${this.relativeFilePath}"`
|
|
832
854
|
);
|
|
@@ -837,7 +859,7 @@ var AiFile = class {
|
|
|
837
859
|
return this.fileContent;
|
|
838
860
|
}
|
|
839
861
|
getRelativePathFromCwd() {
|
|
840
|
-
return
|
|
862
|
+
return import_node_path5.default.join(this.relativeDirPath, this.relativeFilePath);
|
|
841
863
|
}
|
|
842
864
|
setFileContent(newFileContent) {
|
|
843
865
|
this.fileContent = newFileContent;
|
|
@@ -944,7 +966,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
944
966
|
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
945
967
|
if (!result.success) {
|
|
946
968
|
throw new Error(
|
|
947
|
-
`Invalid frontmatter in ${(0,
|
|
969
|
+
`Invalid frontmatter in ${(0, import_node_path6.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
948
970
|
);
|
|
949
971
|
}
|
|
950
972
|
}
|
|
@@ -994,7 +1016,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
994
1016
|
return {
|
|
995
1017
|
success: false,
|
|
996
1018
|
error: new Error(
|
|
997
|
-
`Invalid frontmatter in ${(0,
|
|
1019
|
+
`Invalid frontmatter in ${(0, import_node_path6.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
998
1020
|
)
|
|
999
1021
|
};
|
|
1000
1022
|
}
|
|
@@ -1004,7 +1026,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
1004
1026
|
relativeFilePath,
|
|
1005
1027
|
validate = true
|
|
1006
1028
|
}) {
|
|
1007
|
-
const filePath = (0,
|
|
1029
|
+
const filePath = (0, import_node_path6.join)(
|
|
1008
1030
|
baseDir,
|
|
1009
1031
|
_SimulatedCommand.getSettablePaths().relativeDirPath,
|
|
1010
1032
|
relativeFilePath
|
|
@@ -1044,7 +1066,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
1044
1066
|
var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
1045
1067
|
static getSettablePaths() {
|
|
1046
1068
|
return {
|
|
1047
|
-
relativeDirPath: (0,
|
|
1069
|
+
relativeDirPath: (0, import_node_path7.join)(".agents", "commands")
|
|
1048
1070
|
};
|
|
1049
1071
|
}
|
|
1050
1072
|
static fromRulesyncCommand({
|
|
@@ -1061,7 +1083,7 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
1061
1083
|
relativeFilePath,
|
|
1062
1084
|
validate = true
|
|
1063
1085
|
}) {
|
|
1064
|
-
const filePath = (0,
|
|
1086
|
+
const filePath = (0, import_node_path7.join)(
|
|
1065
1087
|
baseDir,
|
|
1066
1088
|
_AgentsmdCommand.getSettablePaths().relativeDirPath,
|
|
1067
1089
|
relativeFilePath
|
|
@@ -1099,7 +1121,7 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
1099
1121
|
};
|
|
1100
1122
|
|
|
1101
1123
|
// src/features/commands/antigravity-command.ts
|
|
1102
|
-
var
|
|
1124
|
+
var import_node_path9 = require("path");
|
|
1103
1125
|
var import_mini6 = require("zod/mini");
|
|
1104
1126
|
|
|
1105
1127
|
// src/utils/type-guards.ts
|
|
@@ -1108,7 +1130,7 @@ function isRecord(value) {
|
|
|
1108
1130
|
}
|
|
1109
1131
|
|
|
1110
1132
|
// src/features/commands/rulesync-command.ts
|
|
1111
|
-
var
|
|
1133
|
+
var import_node_path8 = require("path");
|
|
1112
1134
|
var import_mini5 = require("zod/mini");
|
|
1113
1135
|
|
|
1114
1136
|
// src/types/rulesync-file.ts
|
|
@@ -1130,7 +1152,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
1130
1152
|
const parseResult = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1131
1153
|
if (!parseResult.success && rest.validate) {
|
|
1132
1154
|
throw new Error(
|
|
1133
|
-
`Invalid frontmatter in ${(0,
|
|
1155
|
+
`Invalid frontmatter in ${(0, import_node_path8.join)(rest.baseDir ?? process.cwd(), rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
1134
1156
|
);
|
|
1135
1157
|
}
|
|
1136
1158
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -1173,7 +1195,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
1173
1195
|
return {
|
|
1174
1196
|
success: false,
|
|
1175
1197
|
error: new Error(
|
|
1176
|
-
`Invalid frontmatter in ${(0,
|
|
1198
|
+
`Invalid frontmatter in ${(0, import_node_path8.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1177
1199
|
)
|
|
1178
1200
|
};
|
|
1179
1201
|
}
|
|
@@ -1181,7 +1203,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
1181
1203
|
static async fromFile({
|
|
1182
1204
|
relativeFilePath
|
|
1183
1205
|
}) {
|
|
1184
|
-
const filePath = (0,
|
|
1206
|
+
const filePath = (0, import_node_path8.join)(
|
|
1185
1207
|
process.cwd(),
|
|
1186
1208
|
_RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
1187
1209
|
relativeFilePath
|
|
@@ -1218,7 +1240,7 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1218
1240
|
body;
|
|
1219
1241
|
static getSettablePaths() {
|
|
1220
1242
|
return {
|
|
1221
|
-
relativeDirPath: (0,
|
|
1243
|
+
relativeDirPath: (0, import_node_path9.join)(".agent", "workflows")
|
|
1222
1244
|
};
|
|
1223
1245
|
}
|
|
1224
1246
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -1226,7 +1248,7 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1226
1248
|
const result = AntigravityCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1227
1249
|
if (!result.success) {
|
|
1228
1250
|
throw new Error(
|
|
1229
|
-
`Invalid frontmatter in ${(0,
|
|
1251
|
+
`Invalid frontmatter in ${(0, import_node_path9.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1230
1252
|
);
|
|
1231
1253
|
}
|
|
1232
1254
|
}
|
|
@@ -1310,7 +1332,7 @@ ${body}${turboDirective}`;
|
|
|
1310
1332
|
const antigravityTrigger = antigravityConfig && typeof antigravityConfig.trigger === "string" ? antigravityConfig.trigger : void 0;
|
|
1311
1333
|
const rootTrigger = typeof rulesyncFrontmatter.trigger === "string" ? rulesyncFrontmatter.trigger : void 0;
|
|
1312
1334
|
const bodyTriggerMatch = rulesyncCommand.getBody().match(/trigger:\s*(\/[\w-]+)/);
|
|
1313
|
-
const filenameTrigger = `/${(0,
|
|
1335
|
+
const filenameTrigger = `/${(0, import_node_path9.basename)(rulesyncCommand.getRelativeFilePath(), ".md")}`;
|
|
1314
1336
|
return antigravityTrigger || rootTrigger || (bodyTriggerMatch ? bodyTriggerMatch[1] : void 0) || filenameTrigger;
|
|
1315
1337
|
}
|
|
1316
1338
|
validate() {
|
|
@@ -1324,7 +1346,7 @@ ${body}${turboDirective}`;
|
|
|
1324
1346
|
return {
|
|
1325
1347
|
success: false,
|
|
1326
1348
|
error: new Error(
|
|
1327
|
-
`Invalid frontmatter in ${(0,
|
|
1349
|
+
`Invalid frontmatter in ${(0, import_node_path9.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1328
1350
|
)
|
|
1329
1351
|
};
|
|
1330
1352
|
}
|
|
@@ -1340,7 +1362,7 @@ ${body}${turboDirective}`;
|
|
|
1340
1362
|
relativeFilePath,
|
|
1341
1363
|
validate = true
|
|
1342
1364
|
}) {
|
|
1343
|
-
const filePath = (0,
|
|
1365
|
+
const filePath = (0, import_node_path9.join)(
|
|
1344
1366
|
baseDir,
|
|
1345
1367
|
_AntigravityCommand.getSettablePaths().relativeDirPath,
|
|
1346
1368
|
relativeFilePath
|
|
@@ -1379,7 +1401,7 @@ ${body}${turboDirective}`;
|
|
|
1379
1401
|
};
|
|
1380
1402
|
|
|
1381
1403
|
// src/features/commands/claudecode-command.ts
|
|
1382
|
-
var
|
|
1404
|
+
var import_node_path10 = require("path");
|
|
1383
1405
|
var import_mini7 = require("zod/mini");
|
|
1384
1406
|
var ClaudecodeCommandFrontmatterSchema = import_mini7.z.looseObject({
|
|
1385
1407
|
description: import_mini7.z.optional(import_mini7.z.string()),
|
|
@@ -1396,7 +1418,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1396
1418
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1397
1419
|
if (!result.success) {
|
|
1398
1420
|
throw new Error(
|
|
1399
|
-
`Invalid frontmatter in ${(0,
|
|
1421
|
+
`Invalid frontmatter in ${(0, import_node_path10.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1400
1422
|
);
|
|
1401
1423
|
}
|
|
1402
1424
|
}
|
|
@@ -1409,7 +1431,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1409
1431
|
}
|
|
1410
1432
|
static getSettablePaths(_options = {}) {
|
|
1411
1433
|
return {
|
|
1412
|
-
relativeDirPath: (0,
|
|
1434
|
+
relativeDirPath: (0, import_node_path10.join)(".claude", "commands")
|
|
1413
1435
|
};
|
|
1414
1436
|
}
|
|
1415
1437
|
getBody() {
|
|
@@ -1472,7 +1494,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1472
1494
|
return {
|
|
1473
1495
|
success: false,
|
|
1474
1496
|
error: new Error(
|
|
1475
|
-
`Invalid frontmatter in ${(0,
|
|
1497
|
+
`Invalid frontmatter in ${(0, import_node_path10.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1476
1498
|
)
|
|
1477
1499
|
};
|
|
1478
1500
|
}
|
|
@@ -1490,7 +1512,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1490
1512
|
global = false
|
|
1491
1513
|
}) {
|
|
1492
1514
|
const paths = this.getSettablePaths({ global });
|
|
1493
|
-
const filePath = (0,
|
|
1515
|
+
const filePath = (0, import_node_path10.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1494
1516
|
const fileContent = await readFileContent(filePath);
|
|
1495
1517
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1496
1518
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1523,16 +1545,16 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1523
1545
|
};
|
|
1524
1546
|
|
|
1525
1547
|
// src/features/commands/cline-command.ts
|
|
1526
|
-
var
|
|
1548
|
+
var import_node_path11 = require("path");
|
|
1527
1549
|
var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
1528
1550
|
static getSettablePaths({ global } = {}) {
|
|
1529
1551
|
if (global) {
|
|
1530
1552
|
return {
|
|
1531
|
-
relativeDirPath: (0,
|
|
1553
|
+
relativeDirPath: (0, import_node_path11.join)("Documents", "Cline", "Workflows")
|
|
1532
1554
|
};
|
|
1533
1555
|
}
|
|
1534
1556
|
return {
|
|
1535
|
-
relativeDirPath: (0,
|
|
1557
|
+
relativeDirPath: (0, import_node_path11.join)(".clinerules", "workflows")
|
|
1536
1558
|
};
|
|
1537
1559
|
}
|
|
1538
1560
|
toRulesyncCommand() {
|
|
@@ -1583,7 +1605,7 @@ var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
|
1583
1605
|
global = false
|
|
1584
1606
|
}) {
|
|
1585
1607
|
const paths = this.getSettablePaths({ global });
|
|
1586
|
-
const filePath = (0,
|
|
1608
|
+
const filePath = (0, import_node_path11.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1587
1609
|
const fileContent = await readFileContent(filePath);
|
|
1588
1610
|
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
1589
1611
|
return new _ClineCommand({
|
|
@@ -1610,14 +1632,14 @@ var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
|
1610
1632
|
};
|
|
1611
1633
|
|
|
1612
1634
|
// src/features/commands/codexcli-command.ts
|
|
1613
|
-
var
|
|
1635
|
+
var import_node_path12 = require("path");
|
|
1614
1636
|
var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
1615
1637
|
static getSettablePaths({ global } = {}) {
|
|
1616
1638
|
if (!global) {
|
|
1617
1639
|
throw new Error("CodexcliCommand only supports global mode. Please pass { global: true }.");
|
|
1618
1640
|
}
|
|
1619
1641
|
return {
|
|
1620
|
-
relativeDirPath: (0,
|
|
1642
|
+
relativeDirPath: (0, import_node_path12.join)(".codex", "prompts")
|
|
1621
1643
|
};
|
|
1622
1644
|
}
|
|
1623
1645
|
toRulesyncCommand() {
|
|
@@ -1669,7 +1691,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1669
1691
|
global = false
|
|
1670
1692
|
}) {
|
|
1671
1693
|
const paths = this.getSettablePaths({ global });
|
|
1672
|
-
const filePath = (0,
|
|
1694
|
+
const filePath = (0, import_node_path12.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1673
1695
|
const fileContent = await readFileContent(filePath);
|
|
1674
1696
|
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
1675
1697
|
return new _CodexcliCommand({
|
|
@@ -1696,7 +1718,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1696
1718
|
};
|
|
1697
1719
|
|
|
1698
1720
|
// src/features/commands/copilot-command.ts
|
|
1699
|
-
var
|
|
1721
|
+
var import_node_path13 = require("path");
|
|
1700
1722
|
var import_mini8 = require("zod/mini");
|
|
1701
1723
|
var CopilotCommandFrontmatterSchema = import_mini8.z.looseObject({
|
|
1702
1724
|
mode: import_mini8.z.optional(import_mini8.z.string()),
|
|
@@ -1710,7 +1732,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1710
1732
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1711
1733
|
if (!result.success) {
|
|
1712
1734
|
throw new Error(
|
|
1713
|
-
`Invalid frontmatter in ${(0,
|
|
1735
|
+
`Invalid frontmatter in ${(0, import_node_path13.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1714
1736
|
);
|
|
1715
1737
|
}
|
|
1716
1738
|
}
|
|
@@ -1723,7 +1745,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1723
1745
|
}
|
|
1724
1746
|
static getSettablePaths() {
|
|
1725
1747
|
return {
|
|
1726
|
-
relativeDirPath: (0,
|
|
1748
|
+
relativeDirPath: (0, import_node_path13.join)(".github", "prompts")
|
|
1727
1749
|
};
|
|
1728
1750
|
}
|
|
1729
1751
|
getBody() {
|
|
@@ -1763,7 +1785,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1763
1785
|
return {
|
|
1764
1786
|
success: false,
|
|
1765
1787
|
error: new Error(
|
|
1766
|
-
`Invalid frontmatter in ${(0,
|
|
1788
|
+
`Invalid frontmatter in ${(0, import_node_path13.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1767
1789
|
)
|
|
1768
1790
|
};
|
|
1769
1791
|
}
|
|
@@ -1798,7 +1820,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1798
1820
|
validate = true
|
|
1799
1821
|
}) {
|
|
1800
1822
|
const paths = this.getSettablePaths();
|
|
1801
|
-
const filePath = (0,
|
|
1823
|
+
const filePath = (0, import_node_path13.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1802
1824
|
const fileContent = await readFileContent(filePath);
|
|
1803
1825
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1804
1826
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1837,7 +1859,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1837
1859
|
};
|
|
1838
1860
|
|
|
1839
1861
|
// src/features/commands/cursor-command.ts
|
|
1840
|
-
var
|
|
1862
|
+
var import_node_path14 = require("path");
|
|
1841
1863
|
var import_mini9 = require("zod/mini");
|
|
1842
1864
|
var CursorCommandFrontmatterSchema = import_mini9.z.looseObject({
|
|
1843
1865
|
description: import_mini9.z.optional(import_mini9.z.string()),
|
|
@@ -1860,7 +1882,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1860
1882
|
const result = CursorCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1861
1883
|
if (!result.success) {
|
|
1862
1884
|
throw new Error(
|
|
1863
|
-
`Invalid frontmatter in ${(0,
|
|
1885
|
+
`Invalid frontmatter in ${(0, import_node_path14.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1864
1886
|
);
|
|
1865
1887
|
}
|
|
1866
1888
|
}
|
|
@@ -1873,7 +1895,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1873
1895
|
}
|
|
1874
1896
|
static getSettablePaths(_options = {}) {
|
|
1875
1897
|
return {
|
|
1876
|
-
relativeDirPath: (0,
|
|
1898
|
+
relativeDirPath: (0, import_node_path14.join)(".cursor", "commands")
|
|
1877
1899
|
};
|
|
1878
1900
|
}
|
|
1879
1901
|
getBody() {
|
|
@@ -1936,7 +1958,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1936
1958
|
return {
|
|
1937
1959
|
success: false,
|
|
1938
1960
|
error: new Error(
|
|
1939
|
-
`Invalid frontmatter in ${(0,
|
|
1961
|
+
`Invalid frontmatter in ${(0, import_node_path14.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1940
1962
|
)
|
|
1941
1963
|
};
|
|
1942
1964
|
}
|
|
@@ -1954,7 +1976,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1954
1976
|
global = false
|
|
1955
1977
|
}) {
|
|
1956
1978
|
const paths = this.getSettablePaths({ global });
|
|
1957
|
-
const filePath = (0,
|
|
1979
|
+
const filePath = (0, import_node_path14.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1958
1980
|
const fileContent = await readFileContent(filePath);
|
|
1959
1981
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1960
1982
|
const result = CursorCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1987,11 +2009,11 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1987
2009
|
};
|
|
1988
2010
|
|
|
1989
2011
|
// src/features/commands/factorydroid-command.ts
|
|
1990
|
-
var
|
|
2012
|
+
var import_node_path15 = require("path");
|
|
1991
2013
|
var FactorydroidCommand = class _FactorydroidCommand extends SimulatedCommand {
|
|
1992
2014
|
static getSettablePaths(_options) {
|
|
1993
2015
|
return {
|
|
1994
|
-
relativeDirPath: (0,
|
|
2016
|
+
relativeDirPath: (0, import_node_path15.join)(".factory", "commands")
|
|
1995
2017
|
};
|
|
1996
2018
|
}
|
|
1997
2019
|
static fromRulesyncCommand({
|
|
@@ -2011,7 +2033,7 @@ var FactorydroidCommand = class _FactorydroidCommand extends SimulatedCommand {
|
|
|
2011
2033
|
global = false
|
|
2012
2034
|
}) {
|
|
2013
2035
|
const paths = _FactorydroidCommand.getSettablePaths({ global });
|
|
2014
|
-
const filePath = (0,
|
|
2036
|
+
const filePath = (0, import_node_path15.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2015
2037
|
const fileContent = await readFileContent(filePath);
|
|
2016
2038
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
2017
2039
|
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2045,7 +2067,7 @@ var FactorydroidCommand = class _FactorydroidCommand extends SimulatedCommand {
|
|
|
2045
2067
|
};
|
|
2046
2068
|
|
|
2047
2069
|
// src/features/commands/geminicli-command.ts
|
|
2048
|
-
var
|
|
2070
|
+
var import_node_path16 = require("path");
|
|
2049
2071
|
var import_smol_toml = require("smol-toml");
|
|
2050
2072
|
var import_mini10 = require("zod/mini");
|
|
2051
2073
|
var GeminiCliCommandFrontmatterSchema = import_mini10.z.looseObject({
|
|
@@ -2063,7 +2085,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
2063
2085
|
}
|
|
2064
2086
|
static getSettablePaths(_options = {}) {
|
|
2065
2087
|
return {
|
|
2066
|
-
relativeDirPath: (0,
|
|
2088
|
+
relativeDirPath: (0, import_node_path16.join)(".gemini", "commands")
|
|
2067
2089
|
};
|
|
2068
2090
|
}
|
|
2069
2091
|
parseTomlContent(content) {
|
|
@@ -2072,7 +2094,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
2072
2094
|
const result = GeminiCliCommandFrontmatterSchema.safeParse(parsed);
|
|
2073
2095
|
if (!result.success) {
|
|
2074
2096
|
throw new Error(
|
|
2075
|
-
`Invalid frontmatter in ${(0,
|
|
2097
|
+
`Invalid frontmatter in ${(0, import_node_path16.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
2076
2098
|
);
|
|
2077
2099
|
}
|
|
2078
2100
|
return {
|
|
@@ -2081,7 +2103,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
2081
2103
|
};
|
|
2082
2104
|
} catch (error) {
|
|
2083
2105
|
throw new Error(
|
|
2084
|
-
`Failed to parse TOML command file (${(0,
|
|
2106
|
+
`Failed to parse TOML command file (${(0, import_node_path16.join)(this.relativeDirPath, this.relativeFilePath)}): ${formatError(error)}`,
|
|
2085
2107
|
{ cause: error }
|
|
2086
2108
|
);
|
|
2087
2109
|
}
|
|
@@ -2149,7 +2171,7 @@ ${geminiFrontmatter.prompt}
|
|
|
2149
2171
|
global = false
|
|
2150
2172
|
}) {
|
|
2151
2173
|
const paths = this.getSettablePaths({ global });
|
|
2152
|
-
const filePath = (0,
|
|
2174
|
+
const filePath = (0, import_node_path16.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2153
2175
|
const fileContent = await readFileContent(filePath);
|
|
2154
2176
|
return new _GeminiCliCommand({
|
|
2155
2177
|
baseDir,
|
|
@@ -2191,11 +2213,11 @@ prompt = ""`;
|
|
|
2191
2213
|
};
|
|
2192
2214
|
|
|
2193
2215
|
// src/features/commands/kilo-command.ts
|
|
2194
|
-
var
|
|
2216
|
+
var import_node_path17 = require("path");
|
|
2195
2217
|
var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
2196
2218
|
static getSettablePaths(_options = {}) {
|
|
2197
2219
|
return {
|
|
2198
|
-
relativeDirPath: (0,
|
|
2220
|
+
relativeDirPath: (0, import_node_path17.join)(".kilocode", "workflows")
|
|
2199
2221
|
};
|
|
2200
2222
|
}
|
|
2201
2223
|
toRulesyncCommand() {
|
|
@@ -2244,7 +2266,7 @@ var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
|
2244
2266
|
validate = true
|
|
2245
2267
|
}) {
|
|
2246
2268
|
const paths = this.getSettablePaths();
|
|
2247
|
-
const filePath = (0,
|
|
2269
|
+
const filePath = (0, import_node_path17.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2248
2270
|
const fileContent = await readFileContent(filePath);
|
|
2249
2271
|
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
2250
2272
|
return new _KiloCommand({
|
|
@@ -2271,11 +2293,11 @@ var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
|
2271
2293
|
};
|
|
2272
2294
|
|
|
2273
2295
|
// src/features/commands/kiro-command.ts
|
|
2274
|
-
var
|
|
2296
|
+
var import_node_path18 = require("path");
|
|
2275
2297
|
var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
2276
2298
|
static getSettablePaths(_options = {}) {
|
|
2277
2299
|
return {
|
|
2278
|
-
relativeDirPath: (0,
|
|
2300
|
+
relativeDirPath: (0, import_node_path18.join)(".kiro", "prompts")
|
|
2279
2301
|
};
|
|
2280
2302
|
}
|
|
2281
2303
|
toRulesyncCommand() {
|
|
@@ -2324,7 +2346,7 @@ var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
|
2324
2346
|
validate = true
|
|
2325
2347
|
}) {
|
|
2326
2348
|
const paths = this.getSettablePaths();
|
|
2327
|
-
const filePath = (0,
|
|
2349
|
+
const filePath = (0, import_node_path18.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2328
2350
|
const fileContent = await readFileContent(filePath);
|
|
2329
2351
|
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
2330
2352
|
return new _KiroCommand({
|
|
@@ -2351,7 +2373,7 @@ var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
|
2351
2373
|
};
|
|
2352
2374
|
|
|
2353
2375
|
// src/features/commands/opencode-command.ts
|
|
2354
|
-
var
|
|
2376
|
+
var import_node_path19 = require("path");
|
|
2355
2377
|
var import_mini11 = require("zod/mini");
|
|
2356
2378
|
var OpenCodeCommandFrontmatterSchema = import_mini11.z.looseObject({
|
|
2357
2379
|
description: import_mini11.z.optional(import_mini11.z.string()),
|
|
@@ -2367,7 +2389,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2367
2389
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2368
2390
|
if (!result.success) {
|
|
2369
2391
|
throw new Error(
|
|
2370
|
-
`Invalid frontmatter in ${(0,
|
|
2392
|
+
`Invalid frontmatter in ${(0, import_node_path19.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
2371
2393
|
);
|
|
2372
2394
|
}
|
|
2373
2395
|
}
|
|
@@ -2380,7 +2402,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2380
2402
|
}
|
|
2381
2403
|
static getSettablePaths({ global } = {}) {
|
|
2382
2404
|
return {
|
|
2383
|
-
relativeDirPath: global ? (0,
|
|
2405
|
+
relativeDirPath: global ? (0, import_node_path19.join)(".config", "opencode", "command") : (0, import_node_path19.join)(".opencode", "command")
|
|
2384
2406
|
};
|
|
2385
2407
|
}
|
|
2386
2408
|
getBody() {
|
|
@@ -2441,7 +2463,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2441
2463
|
return {
|
|
2442
2464
|
success: false,
|
|
2443
2465
|
error: new Error(
|
|
2444
|
-
`Invalid frontmatter in ${(0,
|
|
2466
|
+
`Invalid frontmatter in ${(0, import_node_path19.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
2445
2467
|
)
|
|
2446
2468
|
};
|
|
2447
2469
|
}
|
|
@@ -2452,7 +2474,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2452
2474
|
global = false
|
|
2453
2475
|
}) {
|
|
2454
2476
|
const paths = this.getSettablePaths({ global });
|
|
2455
|
-
const filePath = (0,
|
|
2477
|
+
const filePath = (0, import_node_path19.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2456
2478
|
const fileContent = await readFileContent(filePath);
|
|
2457
2479
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
2458
2480
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2491,7 +2513,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2491
2513
|
};
|
|
2492
2514
|
|
|
2493
2515
|
// src/features/commands/roo-command.ts
|
|
2494
|
-
var
|
|
2516
|
+
var import_node_path20 = require("path");
|
|
2495
2517
|
var import_mini12 = require("zod/mini");
|
|
2496
2518
|
var RooCommandFrontmatterSchema = import_mini12.z.looseObject({
|
|
2497
2519
|
description: import_mini12.z.optional(import_mini12.z.string()),
|
|
@@ -2502,7 +2524,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2502
2524
|
body;
|
|
2503
2525
|
static getSettablePaths() {
|
|
2504
2526
|
return {
|
|
2505
|
-
relativeDirPath: (0,
|
|
2527
|
+
relativeDirPath: (0, import_node_path20.join)(".roo", "commands")
|
|
2506
2528
|
};
|
|
2507
2529
|
}
|
|
2508
2530
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -2510,7 +2532,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2510
2532
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2511
2533
|
if (!result.success) {
|
|
2512
2534
|
throw new Error(
|
|
2513
|
-
`Invalid frontmatter in ${(0,
|
|
2535
|
+
`Invalid frontmatter in ${(0, import_node_path20.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
2514
2536
|
);
|
|
2515
2537
|
}
|
|
2516
2538
|
}
|
|
@@ -2581,7 +2603,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2581
2603
|
return {
|
|
2582
2604
|
success: false,
|
|
2583
2605
|
error: new Error(
|
|
2584
|
-
`Invalid frontmatter in ${(0,
|
|
2606
|
+
`Invalid frontmatter in ${(0, import_node_path20.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
2585
2607
|
)
|
|
2586
2608
|
};
|
|
2587
2609
|
}
|
|
@@ -2597,7 +2619,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2597
2619
|
relativeFilePath,
|
|
2598
2620
|
validate = true
|
|
2599
2621
|
}) {
|
|
2600
|
-
const filePath = (0,
|
|
2622
|
+
const filePath = (0, import_node_path20.join)(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
2601
2623
|
const fileContent = await readFileContent(filePath);
|
|
2602
2624
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
2603
2625
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2918,12 +2940,12 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2918
2940
|
return rulesyncCommands;
|
|
2919
2941
|
}
|
|
2920
2942
|
flattenRelativeFilePath(rulesyncCommand) {
|
|
2921
|
-
const flatPath = (0,
|
|
2943
|
+
const flatPath = (0, import_node_path21.basename)(rulesyncCommand.getRelativeFilePath());
|
|
2922
2944
|
if (flatPath === rulesyncCommand.getRelativeFilePath()) return rulesyncCommand;
|
|
2923
2945
|
return rulesyncCommand.withRelativeFilePath(flatPath);
|
|
2924
2946
|
}
|
|
2925
2947
|
safeRelativePath(basePath, fullPath) {
|
|
2926
|
-
const rel = (0,
|
|
2948
|
+
const rel = (0, import_node_path21.relative)(basePath, fullPath);
|
|
2927
2949
|
checkPathTraversal({ relativePath: rel, intendedRootDir: basePath });
|
|
2928
2950
|
return rel;
|
|
2929
2951
|
}
|
|
@@ -2933,7 +2955,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2933
2955
|
*/
|
|
2934
2956
|
async loadRulesyncFiles() {
|
|
2935
2957
|
const basePath = RulesyncCommand.getSettablePaths().relativeDirPath;
|
|
2936
|
-
const rulesyncCommandPaths = await findFilesByGlobs((0,
|
|
2958
|
+
const rulesyncCommandPaths = await findFilesByGlobs((0, import_node_path21.join)(basePath, "**", "*.md"));
|
|
2937
2959
|
const rulesyncCommands = await Promise.all(
|
|
2938
2960
|
rulesyncCommandPaths.map(
|
|
2939
2961
|
(path3) => RulesyncCommand.fromFile({ relativeFilePath: this.safeRelativePath(basePath, path3) })
|
|
@@ -2951,8 +2973,8 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2951
2973
|
} = {}) {
|
|
2952
2974
|
const factory = this.getFactory(this.toolTarget);
|
|
2953
2975
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
2954
|
-
const baseDirFull = (0,
|
|
2955
|
-
const globPattern = factory.meta.supportsSubdirectory ? (0,
|
|
2976
|
+
const baseDirFull = (0, import_node_path21.join)(this.baseDir, paths.relativeDirPath);
|
|
2977
|
+
const globPattern = factory.meta.supportsSubdirectory ? (0, import_node_path21.join)(baseDirFull, "**", `*.${factory.meta.extension}`) : (0, import_node_path21.join)(baseDirFull, `*.${factory.meta.extension}`);
|
|
2956
2978
|
const commandFilePaths = await findFilesByGlobs(globPattern);
|
|
2957
2979
|
if (forDeletion) {
|
|
2958
2980
|
const toolCommands2 = commandFilePaths.map(
|
|
@@ -3222,7 +3244,7 @@ var GEMINICLI_TO_CANONICAL_EVENT_NAMES = Object.fromEntries(
|
|
|
3222
3244
|
);
|
|
3223
3245
|
|
|
3224
3246
|
// src/features/hooks/claudecode-hooks.ts
|
|
3225
|
-
var
|
|
3247
|
+
var import_node_path23 = require("path");
|
|
3226
3248
|
|
|
3227
3249
|
// src/features/hooks/tool-hooks-converter.ts
|
|
3228
3250
|
function isToolMatcherEntry(x) {
|
|
@@ -3330,7 +3352,7 @@ var ToolFile = class extends AiFile {
|
|
|
3330
3352
|
};
|
|
3331
3353
|
|
|
3332
3354
|
// src/features/hooks/rulesync-hooks.ts
|
|
3333
|
-
var
|
|
3355
|
+
var import_node_path22 = require("path");
|
|
3334
3356
|
var RulesyncHooks = class _RulesyncHooks extends RulesyncFile {
|
|
3335
3357
|
json;
|
|
3336
3358
|
constructor(params) {
|
|
@@ -3361,7 +3383,7 @@ var RulesyncHooks = class _RulesyncHooks extends RulesyncFile {
|
|
|
3361
3383
|
validate = true
|
|
3362
3384
|
}) {
|
|
3363
3385
|
const paths = _RulesyncHooks.getSettablePaths();
|
|
3364
|
-
const filePath = (0,
|
|
3386
|
+
const filePath = (0, import_node_path22.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3365
3387
|
if (!await fileExists(filePath)) {
|
|
3366
3388
|
throw new Error(`No ${RULESYNC_HOOKS_RELATIVE_FILE_PATH} found.`);
|
|
3367
3389
|
}
|
|
@@ -3441,7 +3463,7 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3441
3463
|
global = false
|
|
3442
3464
|
}) {
|
|
3443
3465
|
const paths = _ClaudecodeHooks.getSettablePaths({ global });
|
|
3444
|
-
const filePath = (0,
|
|
3466
|
+
const filePath = (0, import_node_path23.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3445
3467
|
const fileContent = await readFileContentOrNull(filePath) ?? '{"hooks":{}}';
|
|
3446
3468
|
return new _ClaudecodeHooks({
|
|
3447
3469
|
baseDir,
|
|
@@ -3458,7 +3480,7 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3458
3480
|
global = false
|
|
3459
3481
|
}) {
|
|
3460
3482
|
const paths = _ClaudecodeHooks.getSettablePaths({ global });
|
|
3461
|
-
const filePath = (0,
|
|
3483
|
+
const filePath = (0, import_node_path23.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3462
3484
|
const existingContent = await readOrInitializeFileContent(
|
|
3463
3485
|
filePath,
|
|
3464
3486
|
JSON.stringify({}, null, 2)
|
|
@@ -3494,7 +3516,7 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3494
3516
|
settings = JSON.parse(this.getFileContent());
|
|
3495
3517
|
} catch (error) {
|
|
3496
3518
|
throw new Error(
|
|
3497
|
-
`Failed to parse Claude hooks content in ${(0,
|
|
3519
|
+
`Failed to parse Claude hooks content in ${(0, import_node_path23.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
3498
3520
|
{
|
|
3499
3521
|
cause: error
|
|
3500
3522
|
}
|
|
@@ -3527,7 +3549,7 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3527
3549
|
};
|
|
3528
3550
|
|
|
3529
3551
|
// src/features/hooks/copilot-hooks.ts
|
|
3530
|
-
var
|
|
3552
|
+
var import_node_path24 = require("path");
|
|
3531
3553
|
var import_mini15 = require("zod/mini");
|
|
3532
3554
|
var CopilotHookEntrySchema = import_mini15.z.looseObject({
|
|
3533
3555
|
type: import_mini15.z.string(),
|
|
@@ -3630,7 +3652,7 @@ var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
|
3630
3652
|
}
|
|
3631
3653
|
static getSettablePaths(_options = {}) {
|
|
3632
3654
|
return {
|
|
3633
|
-
relativeDirPath: (0,
|
|
3655
|
+
relativeDirPath: (0, import_node_path24.join)(".github", "hooks"),
|
|
3634
3656
|
relativeFilePath: "copilot-hooks.json"
|
|
3635
3657
|
};
|
|
3636
3658
|
}
|
|
@@ -3640,7 +3662,7 @@ var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
|
3640
3662
|
global = false
|
|
3641
3663
|
}) {
|
|
3642
3664
|
const paths = _CopilotHooks.getSettablePaths({ global });
|
|
3643
|
-
const filePath = (0,
|
|
3665
|
+
const filePath = (0, import_node_path24.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3644
3666
|
const fileContent = await readFileContentOrNull(filePath) ?? '{"hooks":{}}';
|
|
3645
3667
|
return new _CopilotHooks({
|
|
3646
3668
|
baseDir,
|
|
@@ -3673,7 +3695,7 @@ var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
|
3673
3695
|
parsed = JSON.parse(this.getFileContent());
|
|
3674
3696
|
} catch (error) {
|
|
3675
3697
|
throw new Error(
|
|
3676
|
-
`Failed to parse Copilot hooks content in ${(0,
|
|
3698
|
+
`Failed to parse Copilot hooks content in ${(0, import_node_path24.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
3677
3699
|
{
|
|
3678
3700
|
cause: error
|
|
3679
3701
|
}
|
|
@@ -3703,7 +3725,7 @@ var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
|
3703
3725
|
};
|
|
3704
3726
|
|
|
3705
3727
|
// src/features/hooks/cursor-hooks.ts
|
|
3706
|
-
var
|
|
3728
|
+
var import_node_path25 = require("path");
|
|
3707
3729
|
var CursorHooks = class _CursorHooks extends ToolHooks {
|
|
3708
3730
|
constructor(params) {
|
|
3709
3731
|
const { rulesyncHooks: _r, ...rest } = params;
|
|
@@ -3724,7 +3746,7 @@ var CursorHooks = class _CursorHooks extends ToolHooks {
|
|
|
3724
3746
|
}) {
|
|
3725
3747
|
const paths = _CursorHooks.getSettablePaths();
|
|
3726
3748
|
const fileContent = await readFileContent(
|
|
3727
|
-
(0,
|
|
3749
|
+
(0, import_node_path25.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3728
3750
|
);
|
|
3729
3751
|
return new _CursorHooks({
|
|
3730
3752
|
baseDir,
|
|
@@ -3811,7 +3833,7 @@ var CursorHooks = class _CursorHooks extends ToolHooks {
|
|
|
3811
3833
|
};
|
|
3812
3834
|
|
|
3813
3835
|
// src/features/hooks/factorydroid-hooks.ts
|
|
3814
|
-
var
|
|
3836
|
+
var import_node_path26 = require("path");
|
|
3815
3837
|
var FACTORYDROID_CONVERTER_CONFIG = {
|
|
3816
3838
|
supportedEvents: FACTORYDROID_HOOK_EVENTS,
|
|
3817
3839
|
canonicalToToolEventNames: CANONICAL_TO_FACTORYDROID_EVENT_NAMES,
|
|
@@ -3837,7 +3859,7 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
3837
3859
|
global = false
|
|
3838
3860
|
}) {
|
|
3839
3861
|
const paths = _FactorydroidHooks.getSettablePaths({ global });
|
|
3840
|
-
const filePath = (0,
|
|
3862
|
+
const filePath = (0, import_node_path26.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3841
3863
|
const fileContent = await readFileContentOrNull(filePath) ?? '{"hooks":{}}';
|
|
3842
3864
|
return new _FactorydroidHooks({
|
|
3843
3865
|
baseDir,
|
|
@@ -3854,7 +3876,7 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
3854
3876
|
global = false
|
|
3855
3877
|
}) {
|
|
3856
3878
|
const paths = _FactorydroidHooks.getSettablePaths({ global });
|
|
3857
|
-
const filePath = (0,
|
|
3879
|
+
const filePath = (0, import_node_path26.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3858
3880
|
const existingContent = await readOrInitializeFileContent(
|
|
3859
3881
|
filePath,
|
|
3860
3882
|
JSON.stringify({}, null, 2)
|
|
@@ -3890,7 +3912,7 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
3890
3912
|
settings = JSON.parse(this.getFileContent());
|
|
3891
3913
|
} catch (error) {
|
|
3892
3914
|
throw new Error(
|
|
3893
|
-
`Failed to parse Factory Droid hooks content in ${(0,
|
|
3915
|
+
`Failed to parse Factory Droid hooks content in ${(0, import_node_path26.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
3894
3916
|
{
|
|
3895
3917
|
cause: error
|
|
3896
3918
|
}
|
|
@@ -3923,7 +3945,7 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
3923
3945
|
};
|
|
3924
3946
|
|
|
3925
3947
|
// src/features/hooks/geminicli-hooks.ts
|
|
3926
|
-
var
|
|
3948
|
+
var import_node_path27 = require("path");
|
|
3927
3949
|
var import_mini16 = require("zod/mini");
|
|
3928
3950
|
function canonicalToGeminicliHooks(config) {
|
|
3929
3951
|
const geminiSupported = new Set(GEMINICLI_HOOK_EVENTS);
|
|
@@ -4032,7 +4054,7 @@ var GeminicliHooks = class _GeminicliHooks extends ToolHooks {
|
|
|
4032
4054
|
global = false
|
|
4033
4055
|
}) {
|
|
4034
4056
|
const paths = _GeminicliHooks.getSettablePaths({ global });
|
|
4035
|
-
const filePath = (0,
|
|
4057
|
+
const filePath = (0, import_node_path27.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
4036
4058
|
const fileContent = await readFileContentOrNull(filePath) ?? '{"hooks":{}}';
|
|
4037
4059
|
return new _GeminicliHooks({
|
|
4038
4060
|
baseDir,
|
|
@@ -4049,7 +4071,7 @@ var GeminicliHooks = class _GeminicliHooks extends ToolHooks {
|
|
|
4049
4071
|
global = false
|
|
4050
4072
|
}) {
|
|
4051
4073
|
const paths = _GeminicliHooks.getSettablePaths({ global });
|
|
4052
|
-
const filePath = (0,
|
|
4074
|
+
const filePath = (0, import_node_path27.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
4053
4075
|
const existingContent = await readOrInitializeFileContent(
|
|
4054
4076
|
filePath,
|
|
4055
4077
|
JSON.stringify({}, null, 2)
|
|
@@ -4081,7 +4103,7 @@ var GeminicliHooks = class _GeminicliHooks extends ToolHooks {
|
|
|
4081
4103
|
settings = JSON.parse(this.getFileContent());
|
|
4082
4104
|
} catch (error) {
|
|
4083
4105
|
throw new Error(
|
|
4084
|
-
`Failed to parse Gemini CLI hooks content in ${(0,
|
|
4106
|
+
`Failed to parse Gemini CLI hooks content in ${(0, import_node_path27.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
4085
4107
|
{
|
|
4086
4108
|
cause: error
|
|
4087
4109
|
}
|
|
@@ -4111,7 +4133,7 @@ var GeminicliHooks = class _GeminicliHooks extends ToolHooks {
|
|
|
4111
4133
|
};
|
|
4112
4134
|
|
|
4113
4135
|
// src/features/hooks/opencode-hooks.ts
|
|
4114
|
-
var
|
|
4136
|
+
var import_node_path28 = require("path");
|
|
4115
4137
|
var NAMED_HOOKS = /* @__PURE__ */ new Set(["tool.execute.before", "tool.execute.after"]);
|
|
4116
4138
|
function escapeForTemplateLiteral(command) {
|
|
4117
4139
|
return command.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${");
|
|
@@ -4209,7 +4231,7 @@ var OpencodeHooks = class _OpencodeHooks extends ToolHooks {
|
|
|
4209
4231
|
}
|
|
4210
4232
|
static getSettablePaths(options) {
|
|
4211
4233
|
return {
|
|
4212
|
-
relativeDirPath: options?.global ? (0,
|
|
4234
|
+
relativeDirPath: options?.global ? (0, import_node_path28.join)(".config", "opencode", "plugins") : (0, import_node_path28.join)(".opencode", "plugins"),
|
|
4213
4235
|
relativeFilePath: "rulesync-hooks.js"
|
|
4214
4236
|
};
|
|
4215
4237
|
}
|
|
@@ -4220,7 +4242,7 @@ var OpencodeHooks = class _OpencodeHooks extends ToolHooks {
|
|
|
4220
4242
|
}) {
|
|
4221
4243
|
const paths = _OpencodeHooks.getSettablePaths({ global });
|
|
4222
4244
|
const fileContent = await readFileContent(
|
|
4223
|
-
(0,
|
|
4245
|
+
(0, import_node_path28.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
4224
4246
|
);
|
|
4225
4247
|
return new _OpencodeHooks({
|
|
4226
4248
|
baseDir,
|
|
@@ -4515,10 +4537,10 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4515
4537
|
var import_mini18 = require("zod/mini");
|
|
4516
4538
|
|
|
4517
4539
|
// src/features/ignore/augmentcode-ignore.ts
|
|
4518
|
-
var
|
|
4540
|
+
var import_node_path30 = require("path");
|
|
4519
4541
|
|
|
4520
4542
|
// src/features/ignore/rulesync-ignore.ts
|
|
4521
|
-
var
|
|
4543
|
+
var import_node_path29 = require("path");
|
|
4522
4544
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
4523
4545
|
validate() {
|
|
4524
4546
|
return { success: true, error: null };
|
|
@@ -4538,12 +4560,12 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
4538
4560
|
static async fromFile() {
|
|
4539
4561
|
const baseDir = process.cwd();
|
|
4540
4562
|
const paths = this.getSettablePaths();
|
|
4541
|
-
const recommendedPath = (0,
|
|
4563
|
+
const recommendedPath = (0, import_node_path29.join)(
|
|
4542
4564
|
baseDir,
|
|
4543
4565
|
paths.recommended.relativeDirPath,
|
|
4544
4566
|
paths.recommended.relativeFilePath
|
|
4545
4567
|
);
|
|
4546
|
-
const legacyPath = (0,
|
|
4568
|
+
const legacyPath = (0, import_node_path29.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
4547
4569
|
if (await fileExists(recommendedPath)) {
|
|
4548
4570
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
4549
4571
|
return new _RulesyncIgnore({
|
|
@@ -4659,7 +4681,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
4659
4681
|
validate = true
|
|
4660
4682
|
}) {
|
|
4661
4683
|
const fileContent = await readFileContent(
|
|
4662
|
-
(0,
|
|
4684
|
+
(0, import_node_path30.join)(
|
|
4663
4685
|
baseDir,
|
|
4664
4686
|
this.getSettablePaths().relativeDirPath,
|
|
4665
4687
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4689,7 +4711,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
4689
4711
|
};
|
|
4690
4712
|
|
|
4691
4713
|
// src/features/ignore/claudecode-ignore.ts
|
|
4692
|
-
var
|
|
4714
|
+
var import_node_path31 = require("path");
|
|
4693
4715
|
var import_es_toolkit2 = require("es-toolkit");
|
|
4694
4716
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
4695
4717
|
constructor(params) {
|
|
@@ -4732,7 +4754,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
4732
4754
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
4733
4755
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
4734
4756
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
4735
|
-
const filePath = (0,
|
|
4757
|
+
const filePath = (0, import_node_path31.join)(
|
|
4736
4758
|
baseDir,
|
|
4737
4759
|
this.getSettablePaths().relativeDirPath,
|
|
4738
4760
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4768,7 +4790,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
4768
4790
|
validate = true
|
|
4769
4791
|
}) {
|
|
4770
4792
|
const fileContent = await readFileContent(
|
|
4771
|
-
(0,
|
|
4793
|
+
(0, import_node_path31.join)(
|
|
4772
4794
|
baseDir,
|
|
4773
4795
|
this.getSettablePaths().relativeDirPath,
|
|
4774
4796
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4798,7 +4820,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
4798
4820
|
};
|
|
4799
4821
|
|
|
4800
4822
|
// src/features/ignore/cline-ignore.ts
|
|
4801
|
-
var
|
|
4823
|
+
var import_node_path32 = require("path");
|
|
4802
4824
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
4803
4825
|
static getSettablePaths() {
|
|
4804
4826
|
return {
|
|
@@ -4835,7 +4857,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
4835
4857
|
validate = true
|
|
4836
4858
|
}) {
|
|
4837
4859
|
const fileContent = await readFileContent(
|
|
4838
|
-
(0,
|
|
4860
|
+
(0, import_node_path32.join)(
|
|
4839
4861
|
baseDir,
|
|
4840
4862
|
this.getSettablePaths().relativeDirPath,
|
|
4841
4863
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4865,7 +4887,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
4865
4887
|
};
|
|
4866
4888
|
|
|
4867
4889
|
// src/features/ignore/cursor-ignore.ts
|
|
4868
|
-
var
|
|
4890
|
+
var import_node_path33 = require("path");
|
|
4869
4891
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
4870
4892
|
static getSettablePaths() {
|
|
4871
4893
|
return {
|
|
@@ -4898,7 +4920,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
4898
4920
|
validate = true
|
|
4899
4921
|
}) {
|
|
4900
4922
|
const fileContent = await readFileContent(
|
|
4901
|
-
(0,
|
|
4923
|
+
(0, import_node_path33.join)(
|
|
4902
4924
|
baseDir,
|
|
4903
4925
|
this.getSettablePaths().relativeDirPath,
|
|
4904
4926
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4928,7 +4950,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
4928
4950
|
};
|
|
4929
4951
|
|
|
4930
4952
|
// src/features/ignore/geminicli-ignore.ts
|
|
4931
|
-
var
|
|
4953
|
+
var import_node_path34 = require("path");
|
|
4932
4954
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
4933
4955
|
static getSettablePaths() {
|
|
4934
4956
|
return {
|
|
@@ -4955,7 +4977,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
4955
4977
|
validate = true
|
|
4956
4978
|
}) {
|
|
4957
4979
|
const fileContent = await readFileContent(
|
|
4958
|
-
(0,
|
|
4980
|
+
(0, import_node_path34.join)(
|
|
4959
4981
|
baseDir,
|
|
4960
4982
|
this.getSettablePaths().relativeDirPath,
|
|
4961
4983
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4985,7 +5007,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
4985
5007
|
};
|
|
4986
5008
|
|
|
4987
5009
|
// src/features/ignore/goose-ignore.ts
|
|
4988
|
-
var
|
|
5010
|
+
var import_node_path35 = require("path");
|
|
4989
5011
|
var GooseIgnore = class _GooseIgnore extends ToolIgnore {
|
|
4990
5012
|
static getSettablePaths() {
|
|
4991
5013
|
return {
|
|
@@ -5022,7 +5044,7 @@ var GooseIgnore = class _GooseIgnore extends ToolIgnore {
|
|
|
5022
5044
|
validate = true
|
|
5023
5045
|
}) {
|
|
5024
5046
|
const fileContent = await readFileContent(
|
|
5025
|
-
(0,
|
|
5047
|
+
(0, import_node_path35.join)(
|
|
5026
5048
|
baseDir,
|
|
5027
5049
|
this.getSettablePaths().relativeDirPath,
|
|
5028
5050
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5052,7 +5074,7 @@ var GooseIgnore = class _GooseIgnore extends ToolIgnore {
|
|
|
5052
5074
|
};
|
|
5053
5075
|
|
|
5054
5076
|
// src/features/ignore/junie-ignore.ts
|
|
5055
|
-
var
|
|
5077
|
+
var import_node_path36 = require("path");
|
|
5056
5078
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
5057
5079
|
static getSettablePaths() {
|
|
5058
5080
|
return {
|
|
@@ -5079,7 +5101,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
5079
5101
|
validate = true
|
|
5080
5102
|
}) {
|
|
5081
5103
|
const fileContent = await readFileContent(
|
|
5082
|
-
(0,
|
|
5104
|
+
(0, import_node_path36.join)(
|
|
5083
5105
|
baseDir,
|
|
5084
5106
|
this.getSettablePaths().relativeDirPath,
|
|
5085
5107
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5109,7 +5131,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
5109
5131
|
};
|
|
5110
5132
|
|
|
5111
5133
|
// src/features/ignore/kilo-ignore.ts
|
|
5112
|
-
var
|
|
5134
|
+
var import_node_path37 = require("path");
|
|
5113
5135
|
var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
5114
5136
|
static getSettablePaths() {
|
|
5115
5137
|
return {
|
|
@@ -5146,7 +5168,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
5146
5168
|
validate = true
|
|
5147
5169
|
}) {
|
|
5148
5170
|
const fileContent = await readFileContent(
|
|
5149
|
-
(0,
|
|
5171
|
+
(0, import_node_path37.join)(
|
|
5150
5172
|
baseDir,
|
|
5151
5173
|
this.getSettablePaths().relativeDirPath,
|
|
5152
5174
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5176,7 +5198,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
5176
5198
|
};
|
|
5177
5199
|
|
|
5178
5200
|
// src/features/ignore/kiro-ignore.ts
|
|
5179
|
-
var
|
|
5201
|
+
var import_node_path38 = require("path");
|
|
5180
5202
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
5181
5203
|
static getSettablePaths() {
|
|
5182
5204
|
return {
|
|
@@ -5203,7 +5225,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
5203
5225
|
validate = true
|
|
5204
5226
|
}) {
|
|
5205
5227
|
const fileContent = await readFileContent(
|
|
5206
|
-
(0,
|
|
5228
|
+
(0, import_node_path38.join)(
|
|
5207
5229
|
baseDir,
|
|
5208
5230
|
this.getSettablePaths().relativeDirPath,
|
|
5209
5231
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5233,7 +5255,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
5233
5255
|
};
|
|
5234
5256
|
|
|
5235
5257
|
// src/features/ignore/qwencode-ignore.ts
|
|
5236
|
-
var
|
|
5258
|
+
var import_node_path39 = require("path");
|
|
5237
5259
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
5238
5260
|
static getSettablePaths() {
|
|
5239
5261
|
return {
|
|
@@ -5260,7 +5282,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
5260
5282
|
validate = true
|
|
5261
5283
|
}) {
|
|
5262
5284
|
const fileContent = await readFileContent(
|
|
5263
|
-
(0,
|
|
5285
|
+
(0, import_node_path39.join)(
|
|
5264
5286
|
baseDir,
|
|
5265
5287
|
this.getSettablePaths().relativeDirPath,
|
|
5266
5288
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5290,7 +5312,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
5290
5312
|
};
|
|
5291
5313
|
|
|
5292
5314
|
// src/features/ignore/roo-ignore.ts
|
|
5293
|
-
var
|
|
5315
|
+
var import_node_path40 = require("path");
|
|
5294
5316
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
5295
5317
|
static getSettablePaths() {
|
|
5296
5318
|
return {
|
|
@@ -5317,7 +5339,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
5317
5339
|
validate = true
|
|
5318
5340
|
}) {
|
|
5319
5341
|
const fileContent = await readFileContent(
|
|
5320
|
-
(0,
|
|
5342
|
+
(0, import_node_path40.join)(
|
|
5321
5343
|
baseDir,
|
|
5322
5344
|
this.getSettablePaths().relativeDirPath,
|
|
5323
5345
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5347,7 +5369,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
5347
5369
|
};
|
|
5348
5370
|
|
|
5349
5371
|
// src/features/ignore/windsurf-ignore.ts
|
|
5350
|
-
var
|
|
5372
|
+
var import_node_path41 = require("path");
|
|
5351
5373
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
5352
5374
|
static getSettablePaths() {
|
|
5353
5375
|
return {
|
|
@@ -5374,7 +5396,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
5374
5396
|
validate = true
|
|
5375
5397
|
}) {
|
|
5376
5398
|
const fileContent = await readFileContent(
|
|
5377
|
-
(0,
|
|
5399
|
+
(0, import_node_path41.join)(
|
|
5378
5400
|
baseDir,
|
|
5379
5401
|
this.getSettablePaths().relativeDirPath,
|
|
5380
5402
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5404,7 +5426,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
5404
5426
|
};
|
|
5405
5427
|
|
|
5406
5428
|
// src/features/ignore/zed-ignore.ts
|
|
5407
|
-
var
|
|
5429
|
+
var import_node_path42 = require("path");
|
|
5408
5430
|
var import_es_toolkit3 = require("es-toolkit");
|
|
5409
5431
|
var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
5410
5432
|
constructor(params) {
|
|
@@ -5441,7 +5463,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
5441
5463
|
}) {
|
|
5442
5464
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
5443
5465
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
5444
|
-
const filePath = (0,
|
|
5466
|
+
const filePath = (0, import_node_path42.join)(
|
|
5445
5467
|
baseDir,
|
|
5446
5468
|
this.getSettablePaths().relativeDirPath,
|
|
5447
5469
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5468,7 +5490,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
5468
5490
|
validate = true
|
|
5469
5491
|
}) {
|
|
5470
5492
|
const fileContent = await readFileContent(
|
|
5471
|
-
(0,
|
|
5493
|
+
(0, import_node_path42.join)(
|
|
5472
5494
|
baseDir,
|
|
5473
5495
|
this.getSettablePaths().relativeDirPath,
|
|
5474
5496
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5655,10 +5677,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5655
5677
|
var import_mini22 = require("zod/mini");
|
|
5656
5678
|
|
|
5657
5679
|
// src/features/mcp/claudecode-mcp.ts
|
|
5658
|
-
var
|
|
5680
|
+
var import_node_path44 = require("path");
|
|
5659
5681
|
|
|
5660
5682
|
// src/features/mcp/rulesync-mcp.ts
|
|
5661
|
-
var
|
|
5683
|
+
var import_node_path43 = require("path");
|
|
5662
5684
|
var import_object = require("es-toolkit/object");
|
|
5663
5685
|
var import_mini20 = require("zod/mini");
|
|
5664
5686
|
|
|
@@ -5730,12 +5752,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
5730
5752
|
static async fromFile({ validate = true }) {
|
|
5731
5753
|
const baseDir = process.cwd();
|
|
5732
5754
|
const paths = this.getSettablePaths();
|
|
5733
|
-
const recommendedPath = (0,
|
|
5755
|
+
const recommendedPath = (0, import_node_path43.join)(
|
|
5734
5756
|
baseDir,
|
|
5735
5757
|
paths.recommended.relativeDirPath,
|
|
5736
5758
|
paths.recommended.relativeFilePath
|
|
5737
5759
|
);
|
|
5738
|
-
const legacyPath = (0,
|
|
5760
|
+
const legacyPath = (0, import_node_path43.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
5739
5761
|
if (await fileExists(recommendedPath)) {
|
|
5740
5762
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
5741
5763
|
return new _RulesyncMcp({
|
|
@@ -5880,7 +5902,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
5880
5902
|
global = false
|
|
5881
5903
|
}) {
|
|
5882
5904
|
const paths = this.getSettablePaths({ global });
|
|
5883
|
-
const fileContent = await readFileContentOrNull((0,
|
|
5905
|
+
const fileContent = await readFileContentOrNull((0, import_node_path44.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
5884
5906
|
const json = JSON.parse(fileContent);
|
|
5885
5907
|
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
5886
5908
|
return new _ClaudecodeMcp({
|
|
@@ -5899,7 +5921,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
5899
5921
|
}) {
|
|
5900
5922
|
const paths = this.getSettablePaths({ global });
|
|
5901
5923
|
const fileContent = await readOrInitializeFileContent(
|
|
5902
|
-
(0,
|
|
5924
|
+
(0, import_node_path44.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
5903
5925
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
5904
5926
|
);
|
|
5905
5927
|
const json = JSON.parse(fileContent);
|
|
@@ -5938,7 +5960,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
5938
5960
|
};
|
|
5939
5961
|
|
|
5940
5962
|
// src/features/mcp/cline-mcp.ts
|
|
5941
|
-
var
|
|
5963
|
+
var import_node_path45 = require("path");
|
|
5942
5964
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
5943
5965
|
json;
|
|
5944
5966
|
constructor(params) {
|
|
@@ -5959,7 +5981,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
5959
5981
|
validate = true
|
|
5960
5982
|
}) {
|
|
5961
5983
|
const fileContent = await readFileContent(
|
|
5962
|
-
(0,
|
|
5984
|
+
(0, import_node_path45.join)(
|
|
5963
5985
|
baseDir,
|
|
5964
5986
|
this.getSettablePaths().relativeDirPath,
|
|
5965
5987
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6008,7 +6030,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
6008
6030
|
};
|
|
6009
6031
|
|
|
6010
6032
|
// src/features/mcp/codexcli-mcp.ts
|
|
6011
|
-
var
|
|
6033
|
+
var import_node_path46 = require("path");
|
|
6012
6034
|
var smolToml = __toESM(require("smol-toml"), 1);
|
|
6013
6035
|
function convertFromCodexFormat(codexMcp) {
|
|
6014
6036
|
const result = {};
|
|
@@ -6091,7 +6113,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
6091
6113
|
global = false
|
|
6092
6114
|
}) {
|
|
6093
6115
|
const paths = this.getSettablePaths({ global });
|
|
6094
|
-
const fileContent = await readFileContentOrNull((0,
|
|
6116
|
+
const fileContent = await readFileContentOrNull((0, import_node_path46.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? smolToml.stringify({});
|
|
6095
6117
|
return new _CodexcliMcp({
|
|
6096
6118
|
baseDir,
|
|
6097
6119
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -6107,7 +6129,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
6107
6129
|
global = false
|
|
6108
6130
|
}) {
|
|
6109
6131
|
const paths = this.getSettablePaths({ global });
|
|
6110
|
-
const configTomlFilePath = (0,
|
|
6132
|
+
const configTomlFilePath = (0, import_node_path46.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
6111
6133
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
6112
6134
|
configTomlFilePath,
|
|
6113
6135
|
smolToml.stringify({})
|
|
@@ -6164,7 +6186,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
6164
6186
|
};
|
|
6165
6187
|
|
|
6166
6188
|
// src/features/mcp/copilot-mcp.ts
|
|
6167
|
-
var
|
|
6189
|
+
var import_node_path47 = require("path");
|
|
6168
6190
|
function convertToCopilotFormat(mcpServers) {
|
|
6169
6191
|
return { servers: mcpServers };
|
|
6170
6192
|
}
|
|
@@ -6191,7 +6213,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
6191
6213
|
validate = true
|
|
6192
6214
|
}) {
|
|
6193
6215
|
const fileContent = await readFileContent(
|
|
6194
|
-
(0,
|
|
6216
|
+
(0, import_node_path47.join)(
|
|
6195
6217
|
baseDir,
|
|
6196
6218
|
this.getSettablePaths().relativeDirPath,
|
|
6197
6219
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6244,7 +6266,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
6244
6266
|
};
|
|
6245
6267
|
|
|
6246
6268
|
// src/features/mcp/cursor-mcp.ts
|
|
6247
|
-
var
|
|
6269
|
+
var import_node_path48 = require("path");
|
|
6248
6270
|
var CURSOR_ENV_VAR_PATTERN = /\$\{env:([^}]+)\}/g;
|
|
6249
6271
|
function isMcpServers(value) {
|
|
6250
6272
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
@@ -6305,7 +6327,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6305
6327
|
validate = true
|
|
6306
6328
|
}) {
|
|
6307
6329
|
const fileContent = await readFileContent(
|
|
6308
|
-
(0,
|
|
6330
|
+
(0, import_node_path48.join)(
|
|
6309
6331
|
baseDir,
|
|
6310
6332
|
this.getSettablePaths().relativeDirPath,
|
|
6311
6333
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6373,7 +6395,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6373
6395
|
};
|
|
6374
6396
|
|
|
6375
6397
|
// src/features/mcp/factorydroid-mcp.ts
|
|
6376
|
-
var
|
|
6398
|
+
var import_node_path49 = require("path");
|
|
6377
6399
|
var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
6378
6400
|
json;
|
|
6379
6401
|
constructor(params) {
|
|
@@ -6394,7 +6416,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
6394
6416
|
validate = true
|
|
6395
6417
|
}) {
|
|
6396
6418
|
const fileContent = await readFileContent(
|
|
6397
|
-
(0,
|
|
6419
|
+
(0, import_node_path49.join)(
|
|
6398
6420
|
baseDir,
|
|
6399
6421
|
this.getSettablePaths().relativeDirPath,
|
|
6400
6422
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6454,7 +6476,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
6454
6476
|
};
|
|
6455
6477
|
|
|
6456
6478
|
// src/features/mcp/geminicli-mcp.ts
|
|
6457
|
-
var
|
|
6479
|
+
var import_node_path50 = require("path");
|
|
6458
6480
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
6459
6481
|
json;
|
|
6460
6482
|
constructor(params) {
|
|
@@ -6482,7 +6504,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6482
6504
|
global = false
|
|
6483
6505
|
}) {
|
|
6484
6506
|
const paths = this.getSettablePaths({ global });
|
|
6485
|
-
const fileContent = await readFileContentOrNull((0,
|
|
6507
|
+
const fileContent = await readFileContentOrNull((0, import_node_path50.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6486
6508
|
const json = JSON.parse(fileContent);
|
|
6487
6509
|
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
6488
6510
|
return new _GeminiCliMcp({
|
|
@@ -6501,7 +6523,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6501
6523
|
}) {
|
|
6502
6524
|
const paths = this.getSettablePaths({ global });
|
|
6503
6525
|
const fileContent = await readOrInitializeFileContent(
|
|
6504
|
-
(0,
|
|
6526
|
+
(0, import_node_path50.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6505
6527
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
6506
6528
|
);
|
|
6507
6529
|
const json = JSON.parse(fileContent);
|
|
@@ -6546,7 +6568,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6546
6568
|
};
|
|
6547
6569
|
|
|
6548
6570
|
// src/features/mcp/junie-mcp.ts
|
|
6549
|
-
var
|
|
6571
|
+
var import_node_path51 = require("path");
|
|
6550
6572
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
6551
6573
|
json;
|
|
6552
6574
|
constructor(params) {
|
|
@@ -6558,7 +6580,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6558
6580
|
}
|
|
6559
6581
|
static getSettablePaths() {
|
|
6560
6582
|
return {
|
|
6561
|
-
relativeDirPath: (0,
|
|
6583
|
+
relativeDirPath: (0, import_node_path51.join)(".junie", "mcp"),
|
|
6562
6584
|
relativeFilePath: "mcp.json"
|
|
6563
6585
|
};
|
|
6564
6586
|
}
|
|
@@ -6567,7 +6589,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6567
6589
|
validate = true
|
|
6568
6590
|
}) {
|
|
6569
6591
|
const fileContent = await readFileContent(
|
|
6570
|
-
(0,
|
|
6592
|
+
(0, import_node_path51.join)(
|
|
6571
6593
|
baseDir,
|
|
6572
6594
|
this.getSettablePaths().relativeDirPath,
|
|
6573
6595
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6616,7 +6638,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6616
6638
|
};
|
|
6617
6639
|
|
|
6618
6640
|
// src/features/mcp/kilo-mcp.ts
|
|
6619
|
-
var
|
|
6641
|
+
var import_node_path52 = require("path");
|
|
6620
6642
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
6621
6643
|
json;
|
|
6622
6644
|
constructor(params) {
|
|
@@ -6637,7 +6659,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
6637
6659
|
validate = true
|
|
6638
6660
|
}) {
|
|
6639
6661
|
const paths = this.getSettablePaths();
|
|
6640
|
-
const fileContent = await readFileContentOrNull((0,
|
|
6662
|
+
const fileContent = await readFileContentOrNull((0, import_node_path52.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6641
6663
|
return new _KiloMcp({
|
|
6642
6664
|
baseDir,
|
|
6643
6665
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -6685,7 +6707,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
6685
6707
|
};
|
|
6686
6708
|
|
|
6687
6709
|
// src/features/mcp/kiro-mcp.ts
|
|
6688
|
-
var
|
|
6710
|
+
var import_node_path53 = require("path");
|
|
6689
6711
|
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
6690
6712
|
json;
|
|
6691
6713
|
constructor(params) {
|
|
@@ -6697,7 +6719,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
6697
6719
|
}
|
|
6698
6720
|
static getSettablePaths() {
|
|
6699
6721
|
return {
|
|
6700
|
-
relativeDirPath: (0,
|
|
6722
|
+
relativeDirPath: (0, import_node_path53.join)(".kiro", "settings"),
|
|
6701
6723
|
relativeFilePath: "mcp.json"
|
|
6702
6724
|
};
|
|
6703
6725
|
}
|
|
@@ -6706,7 +6728,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
6706
6728
|
validate = true
|
|
6707
6729
|
}) {
|
|
6708
6730
|
const paths = this.getSettablePaths();
|
|
6709
|
-
const fileContent = await readFileContentOrNull((0,
|
|
6731
|
+
const fileContent = await readFileContentOrNull((0, import_node_path53.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6710
6732
|
return new _KiroMcp({
|
|
6711
6733
|
baseDir,
|
|
6712
6734
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -6754,7 +6776,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
6754
6776
|
};
|
|
6755
6777
|
|
|
6756
6778
|
// src/features/mcp/opencode-mcp.ts
|
|
6757
|
-
var
|
|
6779
|
+
var import_node_path54 = require("path");
|
|
6758
6780
|
var import_jsonc_parser2 = require("jsonc-parser");
|
|
6759
6781
|
var import_mini21 = require("zod/mini");
|
|
6760
6782
|
var OpencodeMcpLocalServerSchema = import_mini21.z.object({
|
|
@@ -6895,7 +6917,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6895
6917
|
static getSettablePaths({ global } = {}) {
|
|
6896
6918
|
if (global) {
|
|
6897
6919
|
return {
|
|
6898
|
-
relativeDirPath: (0,
|
|
6920
|
+
relativeDirPath: (0, import_node_path54.join)(".config", "opencode"),
|
|
6899
6921
|
relativeFilePath: "opencode.json"
|
|
6900
6922
|
};
|
|
6901
6923
|
}
|
|
@@ -6910,11 +6932,11 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6910
6932
|
global = false
|
|
6911
6933
|
}) {
|
|
6912
6934
|
const basePaths = this.getSettablePaths({ global });
|
|
6913
|
-
const jsonDir = (0,
|
|
6935
|
+
const jsonDir = (0, import_node_path54.join)(baseDir, basePaths.relativeDirPath);
|
|
6914
6936
|
let fileContent = null;
|
|
6915
6937
|
let relativeFilePath = "opencode.jsonc";
|
|
6916
|
-
const jsoncPath = (0,
|
|
6917
|
-
const jsonPath = (0,
|
|
6938
|
+
const jsoncPath = (0, import_node_path54.join)(jsonDir, "opencode.jsonc");
|
|
6939
|
+
const jsonPath = (0, import_node_path54.join)(jsonDir, "opencode.json");
|
|
6918
6940
|
fileContent = await readFileContentOrNull(jsoncPath);
|
|
6919
6941
|
if (!fileContent) {
|
|
6920
6942
|
fileContent = await readFileContentOrNull(jsonPath);
|
|
@@ -6940,11 +6962,11 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6940
6962
|
global = false
|
|
6941
6963
|
}) {
|
|
6942
6964
|
const basePaths = this.getSettablePaths({ global });
|
|
6943
|
-
const jsonDir = (0,
|
|
6965
|
+
const jsonDir = (0, import_node_path54.join)(baseDir, basePaths.relativeDirPath);
|
|
6944
6966
|
let fileContent = null;
|
|
6945
6967
|
let relativeFilePath = "opencode.jsonc";
|
|
6946
|
-
const jsoncPath = (0,
|
|
6947
|
-
const jsonPath = (0,
|
|
6968
|
+
const jsoncPath = (0, import_node_path54.join)(jsonDir, "opencode.jsonc");
|
|
6969
|
+
const jsonPath = (0, import_node_path54.join)(jsonDir, "opencode.json");
|
|
6948
6970
|
fileContent = await readFileContentOrNull(jsoncPath);
|
|
6949
6971
|
if (!fileContent) {
|
|
6950
6972
|
fileContent = await readFileContentOrNull(jsonPath);
|
|
@@ -7005,7 +7027,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7005
7027
|
};
|
|
7006
7028
|
|
|
7007
7029
|
// src/features/mcp/roo-mcp.ts
|
|
7008
|
-
var
|
|
7030
|
+
var import_node_path55 = require("path");
|
|
7009
7031
|
function isRooMcpServers(value) {
|
|
7010
7032
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
7011
7033
|
}
|
|
@@ -7057,7 +7079,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
7057
7079
|
validate = true
|
|
7058
7080
|
}) {
|
|
7059
7081
|
const fileContent = await readFileContent(
|
|
7060
|
-
(0,
|
|
7082
|
+
(0, import_node_path55.join)(
|
|
7061
7083
|
baseDir,
|
|
7062
7084
|
this.getSettablePaths().relativeDirPath,
|
|
7063
7085
|
this.getSettablePaths().relativeFilePath
|
|
@@ -7430,25 +7452,25 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7430
7452
|
};
|
|
7431
7453
|
|
|
7432
7454
|
// src/features/rules/rules-processor.ts
|
|
7433
|
-
var
|
|
7455
|
+
var import_node_path117 = require("path");
|
|
7434
7456
|
var import_toon = require("@toon-format/toon");
|
|
7435
|
-
var
|
|
7457
|
+
var import_mini56 = require("zod/mini");
|
|
7436
7458
|
|
|
7437
7459
|
// src/constants/general.ts
|
|
7438
7460
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
7439
7461
|
|
|
7440
7462
|
// src/features/skills/agentsmd-skill.ts
|
|
7441
|
-
var
|
|
7463
|
+
var import_node_path59 = require("path");
|
|
7442
7464
|
|
|
7443
7465
|
// src/features/skills/simulated-skill.ts
|
|
7444
|
-
var
|
|
7466
|
+
var import_node_path58 = require("path");
|
|
7445
7467
|
var import_mini23 = require("zod/mini");
|
|
7446
7468
|
|
|
7447
7469
|
// src/features/skills/tool-skill.ts
|
|
7448
|
-
var
|
|
7470
|
+
var import_node_path57 = require("path");
|
|
7449
7471
|
|
|
7450
7472
|
// src/types/ai-dir.ts
|
|
7451
|
-
var
|
|
7473
|
+
var import_node_path56 = __toESM(require("path"), 1);
|
|
7452
7474
|
var AiDir = class {
|
|
7453
7475
|
/**
|
|
7454
7476
|
* @example "."
|
|
@@ -7482,7 +7504,7 @@ var AiDir = class {
|
|
|
7482
7504
|
otherFiles = [],
|
|
7483
7505
|
global = false
|
|
7484
7506
|
}) {
|
|
7485
|
-
if (dirName.includes(
|
|
7507
|
+
if (dirName.includes(import_node_path56.default.sep) || dirName.includes("/") || dirName.includes("\\")) {
|
|
7486
7508
|
throw new Error(`Directory name cannot contain path separators: dirName="${dirName}"`);
|
|
7487
7509
|
}
|
|
7488
7510
|
this.baseDir = baseDir;
|
|
@@ -7505,11 +7527,11 @@ var AiDir = class {
|
|
|
7505
7527
|
return this.dirName;
|
|
7506
7528
|
}
|
|
7507
7529
|
getDirPath() {
|
|
7508
|
-
const fullPath =
|
|
7509
|
-
const resolvedFull = (0,
|
|
7510
|
-
const resolvedBase = (0,
|
|
7511
|
-
const rel = (0,
|
|
7512
|
-
if (rel.startsWith("..") ||
|
|
7530
|
+
const fullPath = import_node_path56.default.join(this.baseDir, this.relativeDirPath, this.dirName);
|
|
7531
|
+
const resolvedFull = (0, import_node_path56.resolve)(fullPath);
|
|
7532
|
+
const resolvedBase = (0, import_node_path56.resolve)(this.baseDir);
|
|
7533
|
+
const rel = (0, import_node_path56.relative)(resolvedBase, resolvedFull);
|
|
7534
|
+
if (rel.startsWith("..") || import_node_path56.default.isAbsolute(rel)) {
|
|
7513
7535
|
throw new Error(
|
|
7514
7536
|
`Path traversal detected: Final path escapes baseDir. baseDir="${this.baseDir}", relativeDirPath="${this.relativeDirPath}", dirName="${this.dirName}"`
|
|
7515
7537
|
);
|
|
@@ -7523,7 +7545,7 @@ var AiDir = class {
|
|
|
7523
7545
|
return this.otherFiles;
|
|
7524
7546
|
}
|
|
7525
7547
|
getRelativePathFromCwd() {
|
|
7526
|
-
return
|
|
7548
|
+
return import_node_path56.default.join(this.relativeDirPath, this.dirName);
|
|
7527
7549
|
}
|
|
7528
7550
|
getGlobal() {
|
|
7529
7551
|
return this.global;
|
|
@@ -7542,15 +7564,15 @@ var AiDir = class {
|
|
|
7542
7564
|
* @returns Array of files with their relative paths and buffers
|
|
7543
7565
|
*/
|
|
7544
7566
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
7545
|
-
const dirPath = (0,
|
|
7546
|
-
const glob = (0,
|
|
7567
|
+
const dirPath = (0, import_node_path56.join)(baseDir, relativeDirPath, dirName);
|
|
7568
|
+
const glob = (0, import_node_path56.join)(dirPath, "**", "*");
|
|
7547
7569
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
7548
|
-
const filteredPaths = filePaths.filter((filePath) => (0,
|
|
7570
|
+
const filteredPaths = filePaths.filter((filePath) => (0, import_node_path56.basename)(filePath) !== excludeFileName);
|
|
7549
7571
|
const files = await Promise.all(
|
|
7550
7572
|
filteredPaths.map(async (filePath) => {
|
|
7551
7573
|
const fileBuffer = await readFileBuffer(filePath);
|
|
7552
7574
|
return {
|
|
7553
|
-
relativeFilePathToDirPath: (0,
|
|
7575
|
+
relativeFilePathToDirPath: (0, import_node_path56.relative)(dirPath, filePath),
|
|
7554
7576
|
fileBuffer
|
|
7555
7577
|
};
|
|
7556
7578
|
})
|
|
@@ -7641,8 +7663,8 @@ var ToolSkill = class extends AiDir {
|
|
|
7641
7663
|
}) {
|
|
7642
7664
|
const settablePaths = getSettablePaths({ global });
|
|
7643
7665
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
7644
|
-
const skillDirPath = (0,
|
|
7645
|
-
const skillFilePath = (0,
|
|
7666
|
+
const skillDirPath = (0, import_node_path57.join)(baseDir, actualRelativeDirPath, dirName);
|
|
7667
|
+
const skillFilePath = (0, import_node_path57.join)(skillDirPath, SKILL_FILE_NAME);
|
|
7646
7668
|
if (!await fileExists(skillFilePath)) {
|
|
7647
7669
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
7648
7670
|
}
|
|
@@ -7666,7 +7688,7 @@ var ToolSkill = class extends AiDir {
|
|
|
7666
7688
|
}
|
|
7667
7689
|
requireMainFileFrontmatter() {
|
|
7668
7690
|
if (!this.mainFile?.frontmatter) {
|
|
7669
|
-
throw new Error(`Frontmatter is not defined in ${(0,
|
|
7691
|
+
throw new Error(`Frontmatter is not defined in ${(0, import_node_path57.join)(this.relativeDirPath, this.dirName)}`);
|
|
7670
7692
|
}
|
|
7671
7693
|
return this.mainFile.frontmatter;
|
|
7672
7694
|
}
|
|
@@ -7706,7 +7728,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
7706
7728
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
7707
7729
|
if (!result.success) {
|
|
7708
7730
|
throw new Error(
|
|
7709
|
-
`Invalid frontmatter in ${(0,
|
|
7731
|
+
`Invalid frontmatter in ${(0, import_node_path58.join)(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
7710
7732
|
);
|
|
7711
7733
|
}
|
|
7712
7734
|
}
|
|
@@ -7764,8 +7786,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
7764
7786
|
}) {
|
|
7765
7787
|
const settablePaths = this.getSettablePaths();
|
|
7766
7788
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
7767
|
-
const skillDirPath = (0,
|
|
7768
|
-
const skillFilePath = (0,
|
|
7789
|
+
const skillDirPath = (0, import_node_path58.join)(baseDir, actualRelativeDirPath, dirName);
|
|
7790
|
+
const skillFilePath = (0, import_node_path58.join)(skillDirPath, SKILL_FILE_NAME);
|
|
7769
7791
|
if (!await fileExists(skillFilePath)) {
|
|
7770
7792
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
7771
7793
|
}
|
|
@@ -7842,7 +7864,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
7842
7864
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
7843
7865
|
}
|
|
7844
7866
|
return {
|
|
7845
|
-
relativeDirPath: (0,
|
|
7867
|
+
relativeDirPath: (0, import_node_path59.join)(".agents", "skills")
|
|
7846
7868
|
};
|
|
7847
7869
|
}
|
|
7848
7870
|
static async fromDir(params) {
|
|
@@ -7869,11 +7891,11 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
7869
7891
|
};
|
|
7870
7892
|
|
|
7871
7893
|
// src/features/skills/factorydroid-skill.ts
|
|
7872
|
-
var
|
|
7894
|
+
var import_node_path60 = require("path");
|
|
7873
7895
|
var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
7874
7896
|
static getSettablePaths(_options) {
|
|
7875
7897
|
return {
|
|
7876
|
-
relativeDirPath: (0,
|
|
7898
|
+
relativeDirPath: (0, import_node_path60.join)(".factory", "skills")
|
|
7877
7899
|
};
|
|
7878
7900
|
}
|
|
7879
7901
|
static async fromDir(params) {
|
|
@@ -7900,11 +7922,11 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
|
7900
7922
|
};
|
|
7901
7923
|
|
|
7902
7924
|
// src/features/skills/skills-processor.ts
|
|
7903
|
-
var
|
|
7904
|
-
var
|
|
7925
|
+
var import_node_path78 = require("path");
|
|
7926
|
+
var import_mini39 = require("zod/mini");
|
|
7905
7927
|
|
|
7906
7928
|
// src/types/dir-feature-processor.ts
|
|
7907
|
-
var
|
|
7929
|
+
var import_node_path61 = require("path");
|
|
7908
7930
|
var DirFeatureProcessor = class {
|
|
7909
7931
|
baseDir;
|
|
7910
7932
|
dryRun;
|
|
@@ -7935,7 +7957,7 @@ var DirFeatureProcessor = class {
|
|
|
7935
7957
|
const mainFile = aiDir.getMainFile();
|
|
7936
7958
|
let mainFileContent;
|
|
7937
7959
|
if (mainFile) {
|
|
7938
|
-
const mainFilePath = (0,
|
|
7960
|
+
const mainFilePath = (0, import_node_path61.join)(dirPath, mainFile.name);
|
|
7939
7961
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
7940
7962
|
mainFileContent = addTrailingNewline(content);
|
|
7941
7963
|
const existingContent = await readFileContentOrNull(mainFilePath);
|
|
@@ -7949,7 +7971,7 @@ var DirFeatureProcessor = class {
|
|
|
7949
7971
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
7950
7972
|
otherFileContents.push(contentWithNewline);
|
|
7951
7973
|
if (!dirHasChanges) {
|
|
7952
|
-
const filePath = (0,
|
|
7974
|
+
const filePath = (0, import_node_path61.join)(dirPath, file.relativeFilePathToDirPath);
|
|
7953
7975
|
const existingContent = await readFileContentOrNull(filePath);
|
|
7954
7976
|
if (existingContent !== contentWithNewline) {
|
|
7955
7977
|
dirHasChanges = true;
|
|
@@ -7963,22 +7985,22 @@ var DirFeatureProcessor = class {
|
|
|
7963
7985
|
if (this.dryRun) {
|
|
7964
7986
|
logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
7965
7987
|
if (mainFile) {
|
|
7966
|
-
logger.info(`[DRY RUN] Would write: ${(0,
|
|
7967
|
-
changedPaths.push((0,
|
|
7988
|
+
logger.info(`[DRY RUN] Would write: ${(0, import_node_path61.join)(dirPath, mainFile.name)}`);
|
|
7989
|
+
changedPaths.push((0, import_node_path61.join)(relativeDir, mainFile.name));
|
|
7968
7990
|
}
|
|
7969
7991
|
for (const file of otherFiles) {
|
|
7970
|
-
logger.info(`[DRY RUN] Would write: ${(0,
|
|
7971
|
-
changedPaths.push((0,
|
|
7992
|
+
logger.info(`[DRY RUN] Would write: ${(0, import_node_path61.join)(dirPath, file.relativeFilePathToDirPath)}`);
|
|
7993
|
+
changedPaths.push((0, import_node_path61.join)(relativeDir, file.relativeFilePathToDirPath));
|
|
7972
7994
|
}
|
|
7973
7995
|
} else {
|
|
7974
7996
|
await ensureDir(dirPath);
|
|
7975
7997
|
if (mainFile && mainFileContent) {
|
|
7976
|
-
const mainFilePath = (0,
|
|
7998
|
+
const mainFilePath = (0, import_node_path61.join)(dirPath, mainFile.name);
|
|
7977
7999
|
await writeFileContent(mainFilePath, mainFileContent);
|
|
7978
|
-
changedPaths.push((0,
|
|
8000
|
+
changedPaths.push((0, import_node_path61.join)(relativeDir, mainFile.name));
|
|
7979
8001
|
}
|
|
7980
8002
|
for (const [i, file] of otherFiles.entries()) {
|
|
7981
|
-
const filePath = (0,
|
|
8003
|
+
const filePath = (0, import_node_path61.join)(dirPath, file.relativeFilePathToDirPath);
|
|
7982
8004
|
const content = otherFileContents[i];
|
|
7983
8005
|
if (content === void 0) {
|
|
7984
8006
|
throw new Error(
|
|
@@ -7986,7 +8008,7 @@ var DirFeatureProcessor = class {
|
|
|
7986
8008
|
);
|
|
7987
8009
|
}
|
|
7988
8010
|
await writeFileContent(filePath, content);
|
|
7989
|
-
changedPaths.push((0,
|
|
8011
|
+
changedPaths.push((0, import_node_path61.join)(relativeDir, file.relativeFilePathToDirPath));
|
|
7990
8012
|
}
|
|
7991
8013
|
}
|
|
7992
8014
|
changedCount++;
|
|
@@ -8018,11 +8040,11 @@ var DirFeatureProcessor = class {
|
|
|
8018
8040
|
};
|
|
8019
8041
|
|
|
8020
8042
|
// src/features/skills/agentsskills-skill.ts
|
|
8021
|
-
var
|
|
8043
|
+
var import_node_path63 = require("path");
|
|
8022
8044
|
var import_mini25 = require("zod/mini");
|
|
8023
8045
|
|
|
8024
8046
|
// src/features/skills/rulesync-skill.ts
|
|
8025
|
-
var
|
|
8047
|
+
var import_node_path62 = require("path");
|
|
8026
8048
|
var import_mini24 = require("zod/mini");
|
|
8027
8049
|
var RulesyncSkillFrontmatterSchemaInternal = import_mini24.z.looseObject({
|
|
8028
8050
|
name: import_mini24.z.string(),
|
|
@@ -8091,7 +8113,7 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
8091
8113
|
}
|
|
8092
8114
|
getFrontmatter() {
|
|
8093
8115
|
if (!this.mainFile?.frontmatter) {
|
|
8094
|
-
throw new Error(`Frontmatter is not defined in ${(0,
|
|
8116
|
+
throw new Error(`Frontmatter is not defined in ${(0, import_node_path62.join)(this.relativeDirPath, this.dirName)}`);
|
|
8095
8117
|
}
|
|
8096
8118
|
const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
8097
8119
|
return result;
|
|
@@ -8117,8 +8139,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
8117
8139
|
dirName,
|
|
8118
8140
|
global = false
|
|
8119
8141
|
}) {
|
|
8120
|
-
const skillDirPath = (0,
|
|
8121
|
-
const skillFilePath = (0,
|
|
8142
|
+
const skillDirPath = (0, import_node_path62.join)(baseDir, relativeDirPath, dirName);
|
|
8143
|
+
const skillFilePath = (0, import_node_path62.join)(skillDirPath, SKILL_FILE_NAME);
|
|
8122
8144
|
if (!await fileExists(skillFilePath)) {
|
|
8123
8145
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8124
8146
|
}
|
|
@@ -8155,7 +8177,7 @@ var AgentsSkillsSkillFrontmatterSchema = import_mini25.z.looseObject({
|
|
|
8155
8177
|
var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
8156
8178
|
constructor({
|
|
8157
8179
|
baseDir = process.cwd(),
|
|
8158
|
-
relativeDirPath = (0,
|
|
8180
|
+
relativeDirPath = (0, import_node_path63.join)(".agents", "skills"),
|
|
8159
8181
|
dirName,
|
|
8160
8182
|
frontmatter,
|
|
8161
8183
|
body,
|
|
@@ -8187,7 +8209,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8187
8209
|
throw new Error("AgentsSkillsSkill does not support global mode.");
|
|
8188
8210
|
}
|
|
8189
8211
|
return {
|
|
8190
|
-
relativeDirPath: (0,
|
|
8212
|
+
relativeDirPath: (0, import_node_path63.join)(".agents", "skills")
|
|
8191
8213
|
};
|
|
8192
8214
|
}
|
|
8193
8215
|
getFrontmatter() {
|
|
@@ -8266,9 +8288,9 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8266
8288
|
});
|
|
8267
8289
|
const result = AgentsSkillsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8268
8290
|
if (!result.success) {
|
|
8269
|
-
const skillDirPath = (0,
|
|
8291
|
+
const skillDirPath = (0, import_node_path63.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8270
8292
|
throw new Error(
|
|
8271
|
-
`Invalid frontmatter in ${(0,
|
|
8293
|
+
`Invalid frontmatter in ${(0, import_node_path63.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8272
8294
|
);
|
|
8273
8295
|
}
|
|
8274
8296
|
return new _AgentsSkillsSkill({
|
|
@@ -8303,7 +8325,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8303
8325
|
};
|
|
8304
8326
|
|
|
8305
8327
|
// src/features/skills/antigravity-skill.ts
|
|
8306
|
-
var
|
|
8328
|
+
var import_node_path64 = require("path");
|
|
8307
8329
|
var import_mini26 = require("zod/mini");
|
|
8308
8330
|
var AntigravitySkillFrontmatterSchema = import_mini26.z.looseObject({
|
|
8309
8331
|
name: import_mini26.z.string(),
|
|
@@ -8312,7 +8334,7 @@ var AntigravitySkillFrontmatterSchema = import_mini26.z.looseObject({
|
|
|
8312
8334
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
8313
8335
|
constructor({
|
|
8314
8336
|
baseDir = process.cwd(),
|
|
8315
|
-
relativeDirPath = (0,
|
|
8337
|
+
relativeDirPath = (0, import_node_path64.join)(".agent", "skills"),
|
|
8316
8338
|
dirName,
|
|
8317
8339
|
frontmatter,
|
|
8318
8340
|
body,
|
|
@@ -8344,11 +8366,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8344
8366
|
} = {}) {
|
|
8345
8367
|
if (global) {
|
|
8346
8368
|
return {
|
|
8347
|
-
relativeDirPath: (0,
|
|
8369
|
+
relativeDirPath: (0, import_node_path64.join)(".gemini", "antigravity", "skills")
|
|
8348
8370
|
};
|
|
8349
8371
|
}
|
|
8350
8372
|
return {
|
|
8351
|
-
relativeDirPath: (0,
|
|
8373
|
+
relativeDirPath: (0, import_node_path64.join)(".agent", "skills")
|
|
8352
8374
|
};
|
|
8353
8375
|
}
|
|
8354
8376
|
getFrontmatter() {
|
|
@@ -8427,9 +8449,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8427
8449
|
});
|
|
8428
8450
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8429
8451
|
if (!result.success) {
|
|
8430
|
-
const skillDirPath = (0,
|
|
8452
|
+
const skillDirPath = (0, import_node_path64.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8431
8453
|
throw new Error(
|
|
8432
|
-
`Invalid frontmatter in ${(0,
|
|
8454
|
+
`Invalid frontmatter in ${(0, import_node_path64.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8433
8455
|
);
|
|
8434
8456
|
}
|
|
8435
8457
|
return new _AntigravitySkill({
|
|
@@ -8463,7 +8485,7 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8463
8485
|
};
|
|
8464
8486
|
|
|
8465
8487
|
// src/features/skills/claudecode-skill.ts
|
|
8466
|
-
var
|
|
8488
|
+
var import_node_path65 = require("path");
|
|
8467
8489
|
var import_mini27 = require("zod/mini");
|
|
8468
8490
|
var ClaudecodeSkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
8469
8491
|
name: import_mini27.z.string(),
|
|
@@ -8475,7 +8497,7 @@ var ClaudecodeSkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
|
8475
8497
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
8476
8498
|
constructor({
|
|
8477
8499
|
baseDir = process.cwd(),
|
|
8478
|
-
relativeDirPath = (0,
|
|
8500
|
+
relativeDirPath = (0, import_node_path65.join)(".claude", "skills"),
|
|
8479
8501
|
dirName,
|
|
8480
8502
|
frontmatter,
|
|
8481
8503
|
body,
|
|
@@ -8506,7 +8528,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8506
8528
|
global: _global = false
|
|
8507
8529
|
} = {}) {
|
|
8508
8530
|
return {
|
|
8509
|
-
relativeDirPath: (0,
|
|
8531
|
+
relativeDirPath: (0, import_node_path65.join)(".claude", "skills")
|
|
8510
8532
|
};
|
|
8511
8533
|
}
|
|
8512
8534
|
getFrontmatter() {
|
|
@@ -8602,9 +8624,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8602
8624
|
});
|
|
8603
8625
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8604
8626
|
if (!result.success) {
|
|
8605
|
-
const skillDirPath = (0,
|
|
8627
|
+
const skillDirPath = (0, import_node_path65.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8606
8628
|
throw new Error(
|
|
8607
|
-
`Invalid frontmatter in ${(0,
|
|
8629
|
+
`Invalid frontmatter in ${(0, import_node_path65.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8608
8630
|
);
|
|
8609
8631
|
}
|
|
8610
8632
|
return new _ClaudecodeSkill({
|
|
@@ -8638,7 +8660,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8638
8660
|
};
|
|
8639
8661
|
|
|
8640
8662
|
// src/features/skills/cline-skill.ts
|
|
8641
|
-
var
|
|
8663
|
+
var import_node_path66 = require("path");
|
|
8642
8664
|
var import_mini28 = require("zod/mini");
|
|
8643
8665
|
var ClineSkillFrontmatterSchema = import_mini28.z.looseObject({
|
|
8644
8666
|
name: import_mini28.z.string(),
|
|
@@ -8647,7 +8669,7 @@ var ClineSkillFrontmatterSchema = import_mini28.z.looseObject({
|
|
|
8647
8669
|
var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
8648
8670
|
constructor({
|
|
8649
8671
|
baseDir = process.cwd(),
|
|
8650
|
-
relativeDirPath = (0,
|
|
8672
|
+
relativeDirPath = (0, import_node_path66.join)(".cline", "skills"),
|
|
8651
8673
|
dirName,
|
|
8652
8674
|
frontmatter,
|
|
8653
8675
|
body,
|
|
@@ -8676,7 +8698,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
8676
8698
|
}
|
|
8677
8699
|
static getSettablePaths(_options = {}) {
|
|
8678
8700
|
return {
|
|
8679
|
-
relativeDirPath: (0,
|
|
8701
|
+
relativeDirPath: (0, import_node_path66.join)(".cline", "skills")
|
|
8680
8702
|
};
|
|
8681
8703
|
}
|
|
8682
8704
|
getFrontmatter() {
|
|
@@ -8763,13 +8785,13 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
8763
8785
|
});
|
|
8764
8786
|
const result = ClineSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8765
8787
|
if (!result.success) {
|
|
8766
|
-
const skillDirPath = (0,
|
|
8788
|
+
const skillDirPath = (0, import_node_path66.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8767
8789
|
throw new Error(
|
|
8768
|
-
`Invalid frontmatter in ${(0,
|
|
8790
|
+
`Invalid frontmatter in ${(0, import_node_path66.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8769
8791
|
);
|
|
8770
8792
|
}
|
|
8771
8793
|
if (result.data.name !== loaded.dirName) {
|
|
8772
|
-
const skillFilePath = (0,
|
|
8794
|
+
const skillFilePath = (0, import_node_path66.join)(
|
|
8773
8795
|
loaded.baseDir,
|
|
8774
8796
|
loaded.relativeDirPath,
|
|
8775
8797
|
loaded.dirName,
|
|
@@ -8810,7 +8832,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
8810
8832
|
};
|
|
8811
8833
|
|
|
8812
8834
|
// src/features/skills/codexcli-skill.ts
|
|
8813
|
-
var
|
|
8835
|
+
var import_node_path67 = require("path");
|
|
8814
8836
|
var import_mini29 = require("zod/mini");
|
|
8815
8837
|
var CodexCliSkillFrontmatterSchema = import_mini29.z.looseObject({
|
|
8816
8838
|
name: import_mini29.z.string(),
|
|
@@ -8824,7 +8846,7 @@ var CodexCliSkillFrontmatterSchema = import_mini29.z.looseObject({
|
|
|
8824
8846
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
8825
8847
|
constructor({
|
|
8826
8848
|
baseDir = process.cwd(),
|
|
8827
|
-
relativeDirPath = (0,
|
|
8849
|
+
relativeDirPath = (0, import_node_path67.join)(".codex", "skills"),
|
|
8828
8850
|
dirName,
|
|
8829
8851
|
frontmatter,
|
|
8830
8852
|
body,
|
|
@@ -8855,7 +8877,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
8855
8877
|
global: _global = false
|
|
8856
8878
|
} = {}) {
|
|
8857
8879
|
return {
|
|
8858
|
-
relativeDirPath: (0,
|
|
8880
|
+
relativeDirPath: (0, import_node_path67.join)(".codex", "skills")
|
|
8859
8881
|
};
|
|
8860
8882
|
}
|
|
8861
8883
|
getFrontmatter() {
|
|
@@ -8944,9 +8966,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
8944
8966
|
});
|
|
8945
8967
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8946
8968
|
if (!result.success) {
|
|
8947
|
-
const skillDirPath = (0,
|
|
8969
|
+
const skillDirPath = (0, import_node_path67.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8948
8970
|
throw new Error(
|
|
8949
|
-
`Invalid frontmatter in ${(0,
|
|
8971
|
+
`Invalid frontmatter in ${(0, import_node_path67.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8950
8972
|
);
|
|
8951
8973
|
}
|
|
8952
8974
|
return new _CodexCliSkill({
|
|
@@ -8980,7 +9002,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
8980
9002
|
};
|
|
8981
9003
|
|
|
8982
9004
|
// src/features/skills/copilot-skill.ts
|
|
8983
|
-
var
|
|
9005
|
+
var import_node_path68 = require("path");
|
|
8984
9006
|
var import_mini30 = require("zod/mini");
|
|
8985
9007
|
var CopilotSkillFrontmatterSchema = import_mini30.z.looseObject({
|
|
8986
9008
|
name: import_mini30.z.string(),
|
|
@@ -8990,7 +9012,7 @@ var CopilotSkillFrontmatterSchema = import_mini30.z.looseObject({
|
|
|
8990
9012
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
8991
9013
|
constructor({
|
|
8992
9014
|
baseDir = process.cwd(),
|
|
8993
|
-
relativeDirPath = (0,
|
|
9015
|
+
relativeDirPath = (0, import_node_path68.join)(".github", "skills"),
|
|
8994
9016
|
dirName,
|
|
8995
9017
|
frontmatter,
|
|
8996
9018
|
body,
|
|
@@ -9022,7 +9044,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9022
9044
|
throw new Error("CopilotSkill does not support global mode.");
|
|
9023
9045
|
}
|
|
9024
9046
|
return {
|
|
9025
|
-
relativeDirPath: (0,
|
|
9047
|
+
relativeDirPath: (0, import_node_path68.join)(".github", "skills")
|
|
9026
9048
|
};
|
|
9027
9049
|
}
|
|
9028
9050
|
getFrontmatter() {
|
|
@@ -9107,9 +9129,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9107
9129
|
});
|
|
9108
9130
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9109
9131
|
if (!result.success) {
|
|
9110
|
-
const skillDirPath = (0,
|
|
9132
|
+
const skillDirPath = (0, import_node_path68.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9111
9133
|
throw new Error(
|
|
9112
|
-
`Invalid frontmatter in ${(0,
|
|
9134
|
+
`Invalid frontmatter in ${(0, import_node_path68.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9113
9135
|
);
|
|
9114
9136
|
}
|
|
9115
9137
|
return new _CopilotSkill({
|
|
@@ -9144,7 +9166,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9144
9166
|
};
|
|
9145
9167
|
|
|
9146
9168
|
// src/features/skills/cursor-skill.ts
|
|
9147
|
-
var
|
|
9169
|
+
var import_node_path69 = require("path");
|
|
9148
9170
|
var import_mini31 = require("zod/mini");
|
|
9149
9171
|
var CursorSkillFrontmatterSchema = import_mini31.z.looseObject({
|
|
9150
9172
|
name: import_mini31.z.string(),
|
|
@@ -9153,7 +9175,7 @@ var CursorSkillFrontmatterSchema = import_mini31.z.looseObject({
|
|
|
9153
9175
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
9154
9176
|
constructor({
|
|
9155
9177
|
baseDir = process.cwd(),
|
|
9156
|
-
relativeDirPath = (0,
|
|
9178
|
+
relativeDirPath = (0, import_node_path69.join)(".cursor", "skills"),
|
|
9157
9179
|
dirName,
|
|
9158
9180
|
frontmatter,
|
|
9159
9181
|
body,
|
|
@@ -9182,7 +9204,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9182
9204
|
}
|
|
9183
9205
|
static getSettablePaths(_options) {
|
|
9184
9206
|
return {
|
|
9185
|
-
relativeDirPath: (0,
|
|
9207
|
+
relativeDirPath: (0, import_node_path69.join)(".cursor", "skills")
|
|
9186
9208
|
};
|
|
9187
9209
|
}
|
|
9188
9210
|
getFrontmatter() {
|
|
@@ -9261,9 +9283,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9261
9283
|
});
|
|
9262
9284
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9263
9285
|
if (!result.success) {
|
|
9264
|
-
const skillDirPath = (0,
|
|
9286
|
+
const skillDirPath = (0, import_node_path69.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9265
9287
|
throw new Error(
|
|
9266
|
-
`Invalid frontmatter in ${(0,
|
|
9288
|
+
`Invalid frontmatter in ${(0, import_node_path69.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9267
9289
|
);
|
|
9268
9290
|
}
|
|
9269
9291
|
return new _CursorSkill({
|
|
@@ -9298,7 +9320,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9298
9320
|
};
|
|
9299
9321
|
|
|
9300
9322
|
// src/features/skills/geminicli-skill.ts
|
|
9301
|
-
var
|
|
9323
|
+
var import_node_path70 = require("path");
|
|
9302
9324
|
var import_mini32 = require("zod/mini");
|
|
9303
9325
|
var GeminiCliSkillFrontmatterSchema = import_mini32.z.looseObject({
|
|
9304
9326
|
name: import_mini32.z.string(),
|
|
@@ -9338,7 +9360,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9338
9360
|
global: _global = false
|
|
9339
9361
|
} = {}) {
|
|
9340
9362
|
return {
|
|
9341
|
-
relativeDirPath: (0,
|
|
9363
|
+
relativeDirPath: (0, import_node_path70.join)(".gemini", "skills")
|
|
9342
9364
|
};
|
|
9343
9365
|
}
|
|
9344
9366
|
getFrontmatter() {
|
|
@@ -9417,9 +9439,9 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9417
9439
|
});
|
|
9418
9440
|
const result = GeminiCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9419
9441
|
if (!result.success) {
|
|
9420
|
-
const skillDirPath = (0,
|
|
9442
|
+
const skillDirPath = (0, import_node_path70.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9421
9443
|
throw new Error(
|
|
9422
|
-
`Invalid frontmatter in ${(0,
|
|
9444
|
+
`Invalid frontmatter in ${(0, import_node_path70.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9423
9445
|
);
|
|
9424
9446
|
}
|
|
9425
9447
|
return new _GeminiCliSkill({
|
|
@@ -9453,17 +9475,17 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9453
9475
|
}
|
|
9454
9476
|
};
|
|
9455
9477
|
|
|
9456
|
-
// src/features/skills/
|
|
9457
|
-
var
|
|
9478
|
+
// src/features/skills/junie-skill.ts
|
|
9479
|
+
var import_node_path71 = require("path");
|
|
9458
9480
|
var import_mini33 = require("zod/mini");
|
|
9459
|
-
var
|
|
9481
|
+
var JunieSkillFrontmatterSchema = import_mini33.z.looseObject({
|
|
9460
9482
|
name: import_mini33.z.string(),
|
|
9461
9483
|
description: import_mini33.z.string()
|
|
9462
9484
|
});
|
|
9463
|
-
var
|
|
9485
|
+
var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
9464
9486
|
constructor({
|
|
9465
9487
|
baseDir = process.cwd(),
|
|
9466
|
-
relativeDirPath = (0,
|
|
9488
|
+
relativeDirPath = (0, import_node_path71.join)(".junie", "skills"),
|
|
9467
9489
|
dirName,
|
|
9468
9490
|
frontmatter,
|
|
9469
9491
|
body,
|
|
@@ -9490,11 +9512,187 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9490
9512
|
}
|
|
9491
9513
|
}
|
|
9492
9514
|
}
|
|
9493
|
-
static getSettablePaths({
|
|
9494
|
-
global
|
|
9515
|
+
static getSettablePaths(options) {
|
|
9516
|
+
if (options?.global) {
|
|
9517
|
+
throw new Error("JunieSkill does not support global mode.");
|
|
9518
|
+
}
|
|
9519
|
+
return {
|
|
9520
|
+
relativeDirPath: (0, import_node_path71.join)(".junie", "skills")
|
|
9521
|
+
};
|
|
9522
|
+
}
|
|
9523
|
+
getFrontmatter() {
|
|
9524
|
+
const result = JunieSkillFrontmatterSchema.parse(this.requireMainFileFrontmatter());
|
|
9525
|
+
return result;
|
|
9526
|
+
}
|
|
9527
|
+
getBody() {
|
|
9528
|
+
return this.mainFile?.body ?? "";
|
|
9529
|
+
}
|
|
9530
|
+
validate() {
|
|
9531
|
+
if (!this.mainFile) {
|
|
9532
|
+
return {
|
|
9533
|
+
success: false,
|
|
9534
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
9535
|
+
};
|
|
9536
|
+
}
|
|
9537
|
+
const result = JunieSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
9538
|
+
if (!result.success) {
|
|
9539
|
+
return {
|
|
9540
|
+
success: false,
|
|
9541
|
+
error: new Error(
|
|
9542
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
9543
|
+
)
|
|
9544
|
+
};
|
|
9545
|
+
}
|
|
9546
|
+
if (result.data.name !== this.getDirName()) {
|
|
9547
|
+
return {
|
|
9548
|
+
success: false,
|
|
9549
|
+
error: new Error(
|
|
9550
|
+
`${this.getDirPath()}: frontmatter name (${result.data.name}) must match directory name (${this.getDirName()})`
|
|
9551
|
+
)
|
|
9552
|
+
};
|
|
9553
|
+
}
|
|
9554
|
+
return { success: true, error: null };
|
|
9555
|
+
}
|
|
9556
|
+
toRulesyncSkill() {
|
|
9557
|
+
const frontmatter = this.getFrontmatter();
|
|
9558
|
+
const rulesyncFrontmatter = {
|
|
9559
|
+
name: frontmatter.name,
|
|
9560
|
+
description: frontmatter.description,
|
|
9561
|
+
targets: ["*"]
|
|
9562
|
+
};
|
|
9563
|
+
return new RulesyncSkill({
|
|
9564
|
+
baseDir: this.baseDir,
|
|
9565
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
9566
|
+
dirName: this.getDirName(),
|
|
9567
|
+
frontmatter: rulesyncFrontmatter,
|
|
9568
|
+
body: this.getBody(),
|
|
9569
|
+
otherFiles: this.getOtherFiles(),
|
|
9570
|
+
validate: true,
|
|
9571
|
+
global: this.global
|
|
9572
|
+
});
|
|
9573
|
+
}
|
|
9574
|
+
static fromRulesyncSkill({
|
|
9575
|
+
rulesyncSkill,
|
|
9576
|
+
validate = true,
|
|
9577
|
+
global = false
|
|
9578
|
+
}) {
|
|
9579
|
+
const settablePaths = _JunieSkill.getSettablePaths({ global });
|
|
9580
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
9581
|
+
const junieFrontmatter = {
|
|
9582
|
+
name: rulesyncFrontmatter.name,
|
|
9583
|
+
description: rulesyncFrontmatter.description
|
|
9584
|
+
};
|
|
9585
|
+
return new _JunieSkill({
|
|
9586
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
9587
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
9588
|
+
dirName: junieFrontmatter.name,
|
|
9589
|
+
frontmatter: junieFrontmatter,
|
|
9590
|
+
body: rulesyncSkill.getBody(),
|
|
9591
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
9592
|
+
validate,
|
|
9593
|
+
global
|
|
9594
|
+
});
|
|
9595
|
+
}
|
|
9596
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
9597
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
9598
|
+
return targets.includes("*") || targets.includes("junie");
|
|
9599
|
+
}
|
|
9600
|
+
static async fromDir(params) {
|
|
9601
|
+
const loaded = await this.loadSkillDirContent({
|
|
9602
|
+
...params,
|
|
9603
|
+
getSettablePaths: _JunieSkill.getSettablePaths
|
|
9604
|
+
});
|
|
9605
|
+
const result = JunieSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9606
|
+
if (!result.success) {
|
|
9607
|
+
const skillDirPath = (0, import_node_path71.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9608
|
+
throw new Error(
|
|
9609
|
+
`Invalid frontmatter in ${(0, import_node_path71.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9610
|
+
);
|
|
9611
|
+
}
|
|
9612
|
+
if (result.data.name !== loaded.dirName) {
|
|
9613
|
+
const skillFilePath = (0, import_node_path71.join)(
|
|
9614
|
+
loaded.baseDir,
|
|
9615
|
+
loaded.relativeDirPath,
|
|
9616
|
+
loaded.dirName,
|
|
9617
|
+
SKILL_FILE_NAME
|
|
9618
|
+
);
|
|
9619
|
+
throw new Error(
|
|
9620
|
+
`Frontmatter name (${result.data.name}) must match directory name (${loaded.dirName}) in ${skillFilePath}`
|
|
9621
|
+
);
|
|
9622
|
+
}
|
|
9623
|
+
return new _JunieSkill({
|
|
9624
|
+
baseDir: loaded.baseDir,
|
|
9625
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
9626
|
+
dirName: loaded.dirName,
|
|
9627
|
+
frontmatter: result.data,
|
|
9628
|
+
body: loaded.body,
|
|
9629
|
+
otherFiles: loaded.otherFiles,
|
|
9630
|
+
validate: true,
|
|
9631
|
+
global: loaded.global
|
|
9632
|
+
});
|
|
9633
|
+
}
|
|
9634
|
+
static forDeletion({
|
|
9635
|
+
baseDir = process.cwd(),
|
|
9636
|
+
relativeDirPath,
|
|
9637
|
+
dirName,
|
|
9638
|
+
global = false
|
|
9639
|
+
}) {
|
|
9640
|
+
const settablePaths = _JunieSkill.getSettablePaths({ global });
|
|
9641
|
+
return new _JunieSkill({
|
|
9642
|
+
baseDir,
|
|
9643
|
+
relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
|
|
9644
|
+
dirName,
|
|
9645
|
+
frontmatter: { name: "", description: "" },
|
|
9646
|
+
body: "",
|
|
9647
|
+
otherFiles: [],
|
|
9648
|
+
validate: false,
|
|
9649
|
+
global
|
|
9650
|
+
});
|
|
9651
|
+
}
|
|
9652
|
+
};
|
|
9653
|
+
|
|
9654
|
+
// src/features/skills/kilo-skill.ts
|
|
9655
|
+
var import_node_path72 = require("path");
|
|
9656
|
+
var import_mini34 = require("zod/mini");
|
|
9657
|
+
var KiloSkillFrontmatterSchema = import_mini34.z.looseObject({
|
|
9658
|
+
name: import_mini34.z.string(),
|
|
9659
|
+
description: import_mini34.z.string()
|
|
9660
|
+
});
|
|
9661
|
+
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
9662
|
+
constructor({
|
|
9663
|
+
baseDir = process.cwd(),
|
|
9664
|
+
relativeDirPath = (0, import_node_path72.join)(".kilocode", "skills"),
|
|
9665
|
+
dirName,
|
|
9666
|
+
frontmatter,
|
|
9667
|
+
body,
|
|
9668
|
+
otherFiles = [],
|
|
9669
|
+
validate = true,
|
|
9670
|
+
global = false
|
|
9671
|
+
}) {
|
|
9672
|
+
super({
|
|
9673
|
+
baseDir,
|
|
9674
|
+
relativeDirPath,
|
|
9675
|
+
dirName,
|
|
9676
|
+
mainFile: {
|
|
9677
|
+
name: SKILL_FILE_NAME,
|
|
9678
|
+
body,
|
|
9679
|
+
frontmatter: { ...frontmatter }
|
|
9680
|
+
},
|
|
9681
|
+
otherFiles,
|
|
9682
|
+
global
|
|
9683
|
+
});
|
|
9684
|
+
if (validate) {
|
|
9685
|
+
const result = this.validate();
|
|
9686
|
+
if (!result.success) {
|
|
9687
|
+
throw result.error;
|
|
9688
|
+
}
|
|
9689
|
+
}
|
|
9690
|
+
}
|
|
9691
|
+
static getSettablePaths({
|
|
9692
|
+
global: _global = false
|
|
9495
9693
|
} = {}) {
|
|
9496
9694
|
return {
|
|
9497
|
-
relativeDirPath: (0,
|
|
9695
|
+
relativeDirPath: (0, import_node_path72.join)(".kilocode", "skills")
|
|
9498
9696
|
};
|
|
9499
9697
|
}
|
|
9500
9698
|
getFrontmatter() {
|
|
@@ -9581,13 +9779,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9581
9779
|
});
|
|
9582
9780
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9583
9781
|
if (!result.success) {
|
|
9584
|
-
const skillDirPath = (0,
|
|
9782
|
+
const skillDirPath = (0, import_node_path72.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9585
9783
|
throw new Error(
|
|
9586
|
-
`Invalid frontmatter in ${(0,
|
|
9784
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9587
9785
|
);
|
|
9588
9786
|
}
|
|
9589
9787
|
if (result.data.name !== loaded.dirName) {
|
|
9590
|
-
const skillFilePath = (0,
|
|
9788
|
+
const skillFilePath = (0, import_node_path72.join)(
|
|
9591
9789
|
loaded.baseDir,
|
|
9592
9790
|
loaded.relativeDirPath,
|
|
9593
9791
|
loaded.dirName,
|
|
@@ -9628,16 +9826,16 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9628
9826
|
};
|
|
9629
9827
|
|
|
9630
9828
|
// src/features/skills/kiro-skill.ts
|
|
9631
|
-
var
|
|
9632
|
-
var
|
|
9633
|
-
var KiroSkillFrontmatterSchema =
|
|
9634
|
-
name:
|
|
9635
|
-
description:
|
|
9829
|
+
var import_node_path73 = require("path");
|
|
9830
|
+
var import_mini35 = require("zod/mini");
|
|
9831
|
+
var KiroSkillFrontmatterSchema = import_mini35.z.looseObject({
|
|
9832
|
+
name: import_mini35.z.string(),
|
|
9833
|
+
description: import_mini35.z.string()
|
|
9636
9834
|
});
|
|
9637
9835
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
9638
9836
|
constructor({
|
|
9639
9837
|
baseDir = process.cwd(),
|
|
9640
|
-
relativeDirPath = (0,
|
|
9838
|
+
relativeDirPath = (0, import_node_path73.join)(".kiro", "skills"),
|
|
9641
9839
|
dirName,
|
|
9642
9840
|
frontmatter,
|
|
9643
9841
|
body,
|
|
@@ -9669,7 +9867,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9669
9867
|
throw new Error("KiroSkill does not support global mode.");
|
|
9670
9868
|
}
|
|
9671
9869
|
return {
|
|
9672
|
-
relativeDirPath: (0,
|
|
9870
|
+
relativeDirPath: (0, import_node_path73.join)(".kiro", "skills")
|
|
9673
9871
|
};
|
|
9674
9872
|
}
|
|
9675
9873
|
getFrontmatter() {
|
|
@@ -9756,13 +9954,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9756
9954
|
});
|
|
9757
9955
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9758
9956
|
if (!result.success) {
|
|
9759
|
-
const skillDirPath = (0,
|
|
9957
|
+
const skillDirPath = (0, import_node_path73.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9760
9958
|
throw new Error(
|
|
9761
|
-
`Invalid frontmatter in ${(0,
|
|
9959
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9762
9960
|
);
|
|
9763
9961
|
}
|
|
9764
9962
|
if (result.data.name !== loaded.dirName) {
|
|
9765
|
-
const skillFilePath = (0,
|
|
9963
|
+
const skillFilePath = (0, import_node_path73.join)(
|
|
9766
9964
|
loaded.baseDir,
|
|
9767
9965
|
loaded.relativeDirPath,
|
|
9768
9966
|
loaded.dirName,
|
|
@@ -9804,17 +10002,17 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9804
10002
|
};
|
|
9805
10003
|
|
|
9806
10004
|
// src/features/skills/opencode-skill.ts
|
|
9807
|
-
var
|
|
9808
|
-
var
|
|
9809
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
9810
|
-
name:
|
|
9811
|
-
description:
|
|
9812
|
-
"allowed-tools":
|
|
10005
|
+
var import_node_path74 = require("path");
|
|
10006
|
+
var import_mini36 = require("zod/mini");
|
|
10007
|
+
var OpenCodeSkillFrontmatterSchema = import_mini36.z.looseObject({
|
|
10008
|
+
name: import_mini36.z.string(),
|
|
10009
|
+
description: import_mini36.z.string(),
|
|
10010
|
+
"allowed-tools": import_mini36.z.optional(import_mini36.z.array(import_mini36.z.string()))
|
|
9813
10011
|
});
|
|
9814
10012
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
9815
10013
|
constructor({
|
|
9816
10014
|
baseDir = process.cwd(),
|
|
9817
|
-
relativeDirPath = (0,
|
|
10015
|
+
relativeDirPath = (0, import_node_path74.join)(".opencode", "skill"),
|
|
9818
10016
|
dirName,
|
|
9819
10017
|
frontmatter,
|
|
9820
10018
|
body,
|
|
@@ -9843,7 +10041,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9843
10041
|
}
|
|
9844
10042
|
static getSettablePaths({ global = false } = {}) {
|
|
9845
10043
|
return {
|
|
9846
|
-
relativeDirPath: global ? (0,
|
|
10044
|
+
relativeDirPath: global ? (0, import_node_path74.join)(".config", "opencode", "skill") : (0, import_node_path74.join)(".opencode", "skill")
|
|
9847
10045
|
};
|
|
9848
10046
|
}
|
|
9849
10047
|
getFrontmatter() {
|
|
@@ -9928,9 +10126,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9928
10126
|
});
|
|
9929
10127
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9930
10128
|
if (!result.success) {
|
|
9931
|
-
const skillDirPath = (0,
|
|
10129
|
+
const skillDirPath = (0, import_node_path74.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9932
10130
|
throw new Error(
|
|
9933
|
-
`Invalid frontmatter in ${(0,
|
|
10131
|
+
`Invalid frontmatter in ${(0, import_node_path74.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9934
10132
|
);
|
|
9935
10133
|
}
|
|
9936
10134
|
return new _OpenCodeSkill({
|
|
@@ -9964,16 +10162,16 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9964
10162
|
};
|
|
9965
10163
|
|
|
9966
10164
|
// src/features/skills/replit-skill.ts
|
|
9967
|
-
var
|
|
9968
|
-
var
|
|
9969
|
-
var ReplitSkillFrontmatterSchema =
|
|
9970
|
-
name:
|
|
9971
|
-
description:
|
|
10165
|
+
var import_node_path75 = require("path");
|
|
10166
|
+
var import_mini37 = require("zod/mini");
|
|
10167
|
+
var ReplitSkillFrontmatterSchema = import_mini37.z.looseObject({
|
|
10168
|
+
name: import_mini37.z.string(),
|
|
10169
|
+
description: import_mini37.z.string()
|
|
9972
10170
|
});
|
|
9973
10171
|
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
9974
10172
|
constructor({
|
|
9975
10173
|
baseDir = process.cwd(),
|
|
9976
|
-
relativeDirPath = (0,
|
|
10174
|
+
relativeDirPath = (0, import_node_path75.join)(".agents", "skills"),
|
|
9977
10175
|
dirName,
|
|
9978
10176
|
frontmatter,
|
|
9979
10177
|
body,
|
|
@@ -10005,7 +10203,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10005
10203
|
throw new Error("ReplitSkill does not support global mode.");
|
|
10006
10204
|
}
|
|
10007
10205
|
return {
|
|
10008
|
-
relativeDirPath: (0,
|
|
10206
|
+
relativeDirPath: (0, import_node_path75.join)(".agents", "skills")
|
|
10009
10207
|
};
|
|
10010
10208
|
}
|
|
10011
10209
|
getFrontmatter() {
|
|
@@ -10084,9 +10282,9 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10084
10282
|
});
|
|
10085
10283
|
const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10086
10284
|
if (!result.success) {
|
|
10087
|
-
const skillDirPath = (0,
|
|
10285
|
+
const skillDirPath = (0, import_node_path75.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10088
10286
|
throw new Error(
|
|
10089
|
-
`Invalid frontmatter in ${(0,
|
|
10287
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10090
10288
|
);
|
|
10091
10289
|
}
|
|
10092
10290
|
return new _ReplitSkill({
|
|
@@ -10121,16 +10319,16 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10121
10319
|
};
|
|
10122
10320
|
|
|
10123
10321
|
// src/features/skills/roo-skill.ts
|
|
10124
|
-
var
|
|
10125
|
-
var
|
|
10126
|
-
var RooSkillFrontmatterSchema =
|
|
10127
|
-
name:
|
|
10128
|
-
description:
|
|
10322
|
+
var import_node_path76 = require("path");
|
|
10323
|
+
var import_mini38 = require("zod/mini");
|
|
10324
|
+
var RooSkillFrontmatterSchema = import_mini38.z.looseObject({
|
|
10325
|
+
name: import_mini38.z.string(),
|
|
10326
|
+
description: import_mini38.z.string()
|
|
10129
10327
|
});
|
|
10130
10328
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
10131
10329
|
constructor({
|
|
10132
10330
|
baseDir = process.cwd(),
|
|
10133
|
-
relativeDirPath = (0,
|
|
10331
|
+
relativeDirPath = (0, import_node_path76.join)(".roo", "skills"),
|
|
10134
10332
|
dirName,
|
|
10135
10333
|
frontmatter,
|
|
10136
10334
|
body,
|
|
@@ -10161,7 +10359,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10161
10359
|
global: _global = false
|
|
10162
10360
|
} = {}) {
|
|
10163
10361
|
return {
|
|
10164
|
-
relativeDirPath: (0,
|
|
10362
|
+
relativeDirPath: (0, import_node_path76.join)(".roo", "skills")
|
|
10165
10363
|
};
|
|
10166
10364
|
}
|
|
10167
10365
|
getFrontmatter() {
|
|
@@ -10248,13 +10446,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10248
10446
|
});
|
|
10249
10447
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10250
10448
|
if (!result.success) {
|
|
10251
|
-
const skillDirPath = (0,
|
|
10449
|
+
const skillDirPath = (0, import_node_path76.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10252
10450
|
throw new Error(
|
|
10253
|
-
`Invalid frontmatter in ${(0,
|
|
10451
|
+
`Invalid frontmatter in ${(0, import_node_path76.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10254
10452
|
);
|
|
10255
10453
|
}
|
|
10256
10454
|
if (result.data.name !== loaded.dirName) {
|
|
10257
|
-
const skillFilePath = (0,
|
|
10455
|
+
const skillFilePath = (0, import_node_path76.join)(
|
|
10258
10456
|
loaded.baseDir,
|
|
10259
10457
|
loaded.relativeDirPath,
|
|
10260
10458
|
loaded.dirName,
|
|
@@ -10295,17 +10493,17 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10295
10493
|
};
|
|
10296
10494
|
|
|
10297
10495
|
// src/features/skills/skills-utils.ts
|
|
10298
|
-
var
|
|
10496
|
+
var import_node_path77 = require("path");
|
|
10299
10497
|
async function getLocalSkillDirNames(baseDir) {
|
|
10300
|
-
const skillsDir = (0,
|
|
10498
|
+
const skillsDir = (0, import_node_path77.join)(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
10301
10499
|
const names = /* @__PURE__ */ new Set();
|
|
10302
10500
|
if (!await directoryExists(skillsDir)) {
|
|
10303
10501
|
return names;
|
|
10304
10502
|
}
|
|
10305
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
10503
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path77.join)(skillsDir, "*"), { type: "dir" });
|
|
10306
10504
|
for (const dirPath of dirPaths) {
|
|
10307
|
-
const name = (0,
|
|
10308
|
-
if (name === (0,
|
|
10505
|
+
const name = (0, import_node_path77.basename)(dirPath);
|
|
10506
|
+
if (name === (0, import_node_path77.basename)(RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH)) continue;
|
|
10309
10507
|
names.add(name);
|
|
10310
10508
|
}
|
|
10311
10509
|
return names;
|
|
@@ -10324,13 +10522,14 @@ var skillsProcessorToolTargetTuple = [
|
|
|
10324
10522
|
"cursor",
|
|
10325
10523
|
"factorydroid",
|
|
10326
10524
|
"geminicli",
|
|
10525
|
+
"junie",
|
|
10327
10526
|
"kilo",
|
|
10328
10527
|
"kiro",
|
|
10329
10528
|
"opencode",
|
|
10330
10529
|
"replit",
|
|
10331
10530
|
"roo"
|
|
10332
10531
|
];
|
|
10333
|
-
var SkillsProcessorToolTargetSchema =
|
|
10532
|
+
var SkillsProcessorToolTargetSchema = import_mini39.z.enum(skillsProcessorToolTargetTuple);
|
|
10334
10533
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
10335
10534
|
[
|
|
10336
10535
|
"agentsmd",
|
|
@@ -10409,6 +10608,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
10409
10608
|
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
10410
10609
|
}
|
|
10411
10610
|
],
|
|
10611
|
+
[
|
|
10612
|
+
"junie",
|
|
10613
|
+
{
|
|
10614
|
+
class: JunieSkill,
|
|
10615
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: false }
|
|
10616
|
+
}
|
|
10617
|
+
],
|
|
10412
10618
|
[
|
|
10413
10619
|
"kilo",
|
|
10414
10620
|
{
|
|
@@ -10531,11 +10737,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10531
10737
|
)
|
|
10532
10738
|
);
|
|
10533
10739
|
const localSkillNames = new Set(localDirNames);
|
|
10534
|
-
const curatedDirPath = (0,
|
|
10740
|
+
const curatedDirPath = (0, import_node_path78.join)(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
10535
10741
|
let curatedSkills = [];
|
|
10536
10742
|
if (await directoryExists(curatedDirPath)) {
|
|
10537
|
-
const curatedDirPaths = await findFilesByGlobs((0,
|
|
10538
|
-
const curatedDirNames = curatedDirPaths.map((path3) => (0,
|
|
10743
|
+
const curatedDirPaths = await findFilesByGlobs((0, import_node_path78.join)(curatedDirPath, "*"), { type: "dir" });
|
|
10744
|
+
const curatedDirNames = curatedDirPaths.map((path3) => (0, import_node_path78.basename)(path3));
|
|
10539
10745
|
const nonConflicting = curatedDirNames.filter((name) => {
|
|
10540
10746
|
if (localSkillNames.has(name)) {
|
|
10541
10747
|
logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
@@ -10568,9 +10774,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10568
10774
|
async loadToolDirs() {
|
|
10569
10775
|
const factory = this.getFactory(this.toolTarget);
|
|
10570
10776
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
10571
|
-
const skillsDirPath = (0,
|
|
10572
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
10573
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
10777
|
+
const skillsDirPath = (0, import_node_path78.join)(this.baseDir, paths.relativeDirPath);
|
|
10778
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path78.join)(skillsDirPath, "*"), { type: "dir" });
|
|
10779
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path78.basename)(path3));
|
|
10574
10780
|
const toolSkills = await Promise.all(
|
|
10575
10781
|
dirNames.map(
|
|
10576
10782
|
(dirName) => factory.class.fromDir({
|
|
@@ -10586,9 +10792,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10586
10792
|
async loadToolDirsToDelete() {
|
|
10587
10793
|
const factory = this.getFactory(this.toolTarget);
|
|
10588
10794
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
10589
|
-
const skillsDirPath = (0,
|
|
10590
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
10591
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
10795
|
+
const skillsDirPath = (0, import_node_path78.join)(this.baseDir, paths.relativeDirPath);
|
|
10796
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path78.join)(skillsDirPath, "*"), { type: "dir" });
|
|
10797
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path78.basename)(path3));
|
|
10592
10798
|
const toolSkills = dirNames.map(
|
|
10593
10799
|
(dirName) => factory.class.forDeletion({
|
|
10594
10800
|
baseDir: this.baseDir,
|
|
@@ -10649,11 +10855,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10649
10855
|
};
|
|
10650
10856
|
|
|
10651
10857
|
// src/features/subagents/agentsmd-subagent.ts
|
|
10652
|
-
var
|
|
10858
|
+
var import_node_path80 = require("path");
|
|
10653
10859
|
|
|
10654
10860
|
// src/features/subagents/simulated-subagent.ts
|
|
10655
|
-
var
|
|
10656
|
-
var
|
|
10861
|
+
var import_node_path79 = require("path");
|
|
10862
|
+
var import_mini40 = require("zod/mini");
|
|
10657
10863
|
|
|
10658
10864
|
// src/features/subagents/tool-subagent.ts
|
|
10659
10865
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -10705,9 +10911,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
10705
10911
|
};
|
|
10706
10912
|
|
|
10707
10913
|
// src/features/subagents/simulated-subagent.ts
|
|
10708
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
10709
|
-
name:
|
|
10710
|
-
description:
|
|
10914
|
+
var SimulatedSubagentFrontmatterSchema = import_mini40.z.object({
|
|
10915
|
+
name: import_mini40.z.string(),
|
|
10916
|
+
description: import_mini40.z.optional(import_mini40.z.string())
|
|
10711
10917
|
});
|
|
10712
10918
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
10713
10919
|
frontmatter;
|
|
@@ -10717,7 +10923,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10717
10923
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10718
10924
|
if (!result.success) {
|
|
10719
10925
|
throw new Error(
|
|
10720
|
-
`Invalid frontmatter in ${(0,
|
|
10926
|
+
`Invalid frontmatter in ${(0, import_node_path79.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10721
10927
|
);
|
|
10722
10928
|
}
|
|
10723
10929
|
}
|
|
@@ -10768,7 +10974,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10768
10974
|
return {
|
|
10769
10975
|
success: false,
|
|
10770
10976
|
error: new Error(
|
|
10771
|
-
`Invalid frontmatter in ${(0,
|
|
10977
|
+
`Invalid frontmatter in ${(0, import_node_path79.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10772
10978
|
)
|
|
10773
10979
|
};
|
|
10774
10980
|
}
|
|
@@ -10778,7 +10984,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10778
10984
|
relativeFilePath,
|
|
10779
10985
|
validate = true
|
|
10780
10986
|
}) {
|
|
10781
|
-
const filePath = (0,
|
|
10987
|
+
const filePath = (0, import_node_path79.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
10782
10988
|
const fileContent = await readFileContent(filePath);
|
|
10783
10989
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10784
10990
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -10788,7 +10994,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10788
10994
|
return {
|
|
10789
10995
|
baseDir,
|
|
10790
10996
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
10791
|
-
relativeFilePath: (0,
|
|
10997
|
+
relativeFilePath: (0, import_node_path79.basename)(relativeFilePath),
|
|
10792
10998
|
frontmatter: result.data,
|
|
10793
10999
|
body: content.trim(),
|
|
10794
11000
|
validate
|
|
@@ -10814,7 +11020,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10814
11020
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
10815
11021
|
static getSettablePaths() {
|
|
10816
11022
|
return {
|
|
10817
|
-
relativeDirPath: (0,
|
|
11023
|
+
relativeDirPath: (0, import_node_path80.join)(".agents", "subagents")
|
|
10818
11024
|
};
|
|
10819
11025
|
}
|
|
10820
11026
|
static async fromFile(params) {
|
|
@@ -10837,11 +11043,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
10837
11043
|
};
|
|
10838
11044
|
|
|
10839
11045
|
// src/features/subagents/factorydroid-subagent.ts
|
|
10840
|
-
var
|
|
11046
|
+
var import_node_path81 = require("path");
|
|
10841
11047
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
10842
11048
|
static getSettablePaths(_options) {
|
|
10843
11049
|
return {
|
|
10844
|
-
relativeDirPath: (0,
|
|
11050
|
+
relativeDirPath: (0, import_node_path81.join)(".factory", "droids")
|
|
10845
11051
|
};
|
|
10846
11052
|
}
|
|
10847
11053
|
static async fromFile(params) {
|
|
@@ -10864,11 +11070,11 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
10864
11070
|
};
|
|
10865
11071
|
|
|
10866
11072
|
// src/features/subagents/geminicli-subagent.ts
|
|
10867
|
-
var
|
|
11073
|
+
var import_node_path82 = require("path");
|
|
10868
11074
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
10869
11075
|
static getSettablePaths() {
|
|
10870
11076
|
return {
|
|
10871
|
-
relativeDirPath: (0,
|
|
11077
|
+
relativeDirPath: (0, import_node_path82.join)(".gemini", "subagents")
|
|
10872
11078
|
};
|
|
10873
11079
|
}
|
|
10874
11080
|
static async fromFile(params) {
|
|
@@ -10891,11 +11097,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
10891
11097
|
};
|
|
10892
11098
|
|
|
10893
11099
|
// src/features/subagents/roo-subagent.ts
|
|
10894
|
-
var
|
|
11100
|
+
var import_node_path83 = require("path");
|
|
10895
11101
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
10896
11102
|
static getSettablePaths() {
|
|
10897
11103
|
return {
|
|
10898
|
-
relativeDirPath: (0,
|
|
11104
|
+
relativeDirPath: (0, import_node_path83.join)(".roo", "subagents")
|
|
10899
11105
|
};
|
|
10900
11106
|
}
|
|
10901
11107
|
static async fromFile(params) {
|
|
@@ -10918,20 +11124,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
10918
11124
|
};
|
|
10919
11125
|
|
|
10920
11126
|
// src/features/subagents/subagents-processor.ts
|
|
10921
|
-
var
|
|
10922
|
-
var
|
|
11127
|
+
var import_node_path92 = require("path");
|
|
11128
|
+
var import_mini49 = require("zod/mini");
|
|
10923
11129
|
|
|
10924
11130
|
// src/features/subagents/claudecode-subagent.ts
|
|
10925
|
-
var
|
|
10926
|
-
var
|
|
11131
|
+
var import_node_path85 = require("path");
|
|
11132
|
+
var import_mini42 = require("zod/mini");
|
|
10927
11133
|
|
|
10928
11134
|
// src/features/subagents/rulesync-subagent.ts
|
|
10929
|
-
var
|
|
10930
|
-
var
|
|
10931
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
10932
|
-
targets:
|
|
10933
|
-
name:
|
|
10934
|
-
description:
|
|
11135
|
+
var import_node_path84 = require("path");
|
|
11136
|
+
var import_mini41 = require("zod/mini");
|
|
11137
|
+
var RulesyncSubagentFrontmatterSchema = import_mini41.z.looseObject({
|
|
11138
|
+
targets: import_mini41.z._default(RulesyncTargetsSchema, ["*"]),
|
|
11139
|
+
name: import_mini41.z.string(),
|
|
11140
|
+
description: import_mini41.z.optional(import_mini41.z.string())
|
|
10935
11141
|
});
|
|
10936
11142
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
10937
11143
|
frontmatter;
|
|
@@ -10940,7 +11146,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10940
11146
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10941
11147
|
if (!parseResult.success && rest.validate !== false) {
|
|
10942
11148
|
throw new Error(
|
|
10943
|
-
`Invalid frontmatter in ${(0,
|
|
11149
|
+
`Invalid frontmatter in ${(0, import_node_path84.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
10944
11150
|
);
|
|
10945
11151
|
}
|
|
10946
11152
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -10973,7 +11179,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10973
11179
|
return {
|
|
10974
11180
|
success: false,
|
|
10975
11181
|
error: new Error(
|
|
10976
|
-
`Invalid frontmatter in ${(0,
|
|
11182
|
+
`Invalid frontmatter in ${(0, import_node_path84.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10977
11183
|
)
|
|
10978
11184
|
};
|
|
10979
11185
|
}
|
|
@@ -10981,14 +11187,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10981
11187
|
static async fromFile({
|
|
10982
11188
|
relativeFilePath
|
|
10983
11189
|
}) {
|
|
10984
|
-
const filePath = (0,
|
|
11190
|
+
const filePath = (0, import_node_path84.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
10985
11191
|
const fileContent = await readFileContent(filePath);
|
|
10986
11192
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10987
11193
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10988
11194
|
if (!result.success) {
|
|
10989
11195
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
10990
11196
|
}
|
|
10991
|
-
const filename = (0,
|
|
11197
|
+
const filename = (0, import_node_path84.basename)(relativeFilePath);
|
|
10992
11198
|
return new _RulesyncSubagent({
|
|
10993
11199
|
baseDir: process.cwd(),
|
|
10994
11200
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -11000,13 +11206,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11000
11206
|
};
|
|
11001
11207
|
|
|
11002
11208
|
// src/features/subagents/claudecode-subagent.ts
|
|
11003
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
11004
|
-
name:
|
|
11005
|
-
description:
|
|
11006
|
-
model:
|
|
11007
|
-
tools:
|
|
11008
|
-
permissionMode:
|
|
11009
|
-
skills:
|
|
11209
|
+
var ClaudecodeSubagentFrontmatterSchema = import_mini42.z.looseObject({
|
|
11210
|
+
name: import_mini42.z.string(),
|
|
11211
|
+
description: import_mini42.z.optional(import_mini42.z.string()),
|
|
11212
|
+
model: import_mini42.z.optional(import_mini42.z.string()),
|
|
11213
|
+
tools: import_mini42.z.optional(import_mini42.z.union([import_mini42.z.string(), import_mini42.z.array(import_mini42.z.string())])),
|
|
11214
|
+
permissionMode: import_mini42.z.optional(import_mini42.z.string()),
|
|
11215
|
+
skills: import_mini42.z.optional(import_mini42.z.union([import_mini42.z.string(), import_mini42.z.array(import_mini42.z.string())]))
|
|
11010
11216
|
});
|
|
11011
11217
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
11012
11218
|
frontmatter;
|
|
@@ -11016,7 +11222,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11016
11222
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11017
11223
|
if (!result.success) {
|
|
11018
11224
|
throw new Error(
|
|
11019
|
-
`Invalid frontmatter in ${(0,
|
|
11225
|
+
`Invalid frontmatter in ${(0, import_node_path85.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11020
11226
|
);
|
|
11021
11227
|
}
|
|
11022
11228
|
}
|
|
@@ -11028,7 +11234,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11028
11234
|
}
|
|
11029
11235
|
static getSettablePaths(_options = {}) {
|
|
11030
11236
|
return {
|
|
11031
|
-
relativeDirPath: (0,
|
|
11237
|
+
relativeDirPath: (0, import_node_path85.join)(".claude", "agents")
|
|
11032
11238
|
};
|
|
11033
11239
|
}
|
|
11034
11240
|
getFrontmatter() {
|
|
@@ -11067,7 +11273,10 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11067
11273
|
global = false
|
|
11068
11274
|
}) {
|
|
11069
11275
|
const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
|
|
11070
|
-
const claudecodeSection = rulesyncFrontmatter.claudecode ?? {}
|
|
11276
|
+
const claudecodeSection = this.filterToolSpecificSection(rulesyncFrontmatter.claudecode ?? {}, [
|
|
11277
|
+
"name",
|
|
11278
|
+
"description"
|
|
11279
|
+
]);
|
|
11071
11280
|
const rawClaudecodeFrontmatter = {
|
|
11072
11281
|
name: rulesyncFrontmatter.name,
|
|
11073
11282
|
description: rulesyncFrontmatter.description,
|
|
@@ -11104,7 +11313,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11104
11313
|
return {
|
|
11105
11314
|
success: false,
|
|
11106
11315
|
error: new Error(
|
|
11107
|
-
`Invalid frontmatter in ${(0,
|
|
11316
|
+
`Invalid frontmatter in ${(0, import_node_path85.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11108
11317
|
)
|
|
11109
11318
|
};
|
|
11110
11319
|
}
|
|
@@ -11122,7 +11331,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11122
11331
|
global = false
|
|
11123
11332
|
}) {
|
|
11124
11333
|
const paths = this.getSettablePaths({ global });
|
|
11125
|
-
const filePath = (0,
|
|
11334
|
+
const filePath = (0, import_node_path85.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11126
11335
|
const fileContent = await readFileContent(filePath);
|
|
11127
11336
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11128
11337
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11157,16 +11366,16 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11157
11366
|
};
|
|
11158
11367
|
|
|
11159
11368
|
// src/features/subagents/codexcli-subagent.ts
|
|
11160
|
-
var
|
|
11369
|
+
var import_node_path86 = require("path");
|
|
11161
11370
|
var smolToml2 = __toESM(require("smol-toml"), 1);
|
|
11162
|
-
var
|
|
11163
|
-
var CodexCliSubagentTomlSchema =
|
|
11164
|
-
name:
|
|
11165
|
-
description:
|
|
11166
|
-
developer_instructions:
|
|
11167
|
-
model:
|
|
11168
|
-
model_reasoning_effort:
|
|
11169
|
-
sandbox_mode:
|
|
11371
|
+
var import_mini43 = require("zod/mini");
|
|
11372
|
+
var CodexCliSubagentTomlSchema = import_mini43.z.looseObject({
|
|
11373
|
+
name: import_mini43.z.string(),
|
|
11374
|
+
description: import_mini43.z.optional(import_mini43.z.string()),
|
|
11375
|
+
developer_instructions: import_mini43.z.optional(import_mini43.z.string()),
|
|
11376
|
+
model: import_mini43.z.optional(import_mini43.z.string()),
|
|
11377
|
+
model_reasoning_effort: import_mini43.z.optional(import_mini43.z.string()),
|
|
11378
|
+
sandbox_mode: import_mini43.z.optional(import_mini43.z.string())
|
|
11170
11379
|
});
|
|
11171
11380
|
var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
11172
11381
|
body;
|
|
@@ -11177,7 +11386,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11177
11386
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
11178
11387
|
} catch (error) {
|
|
11179
11388
|
throw new Error(
|
|
11180
|
-
`Invalid TOML in ${(0,
|
|
11389
|
+
`Invalid TOML in ${(0, import_node_path86.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11181
11390
|
{ cause: error }
|
|
11182
11391
|
);
|
|
11183
11392
|
}
|
|
@@ -11189,7 +11398,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11189
11398
|
}
|
|
11190
11399
|
static getSettablePaths(_options = {}) {
|
|
11191
11400
|
return {
|
|
11192
|
-
relativeDirPath: (0,
|
|
11401
|
+
relativeDirPath: (0, import_node_path86.join)(".codex", "agents")
|
|
11193
11402
|
};
|
|
11194
11403
|
}
|
|
11195
11404
|
getBody() {
|
|
@@ -11201,7 +11410,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11201
11410
|
parsed = CodexCliSubagentTomlSchema.parse(smolToml2.parse(this.body));
|
|
11202
11411
|
} catch (error) {
|
|
11203
11412
|
throw new Error(
|
|
11204
|
-
`Failed to parse TOML in ${(0,
|
|
11413
|
+
`Failed to parse TOML in ${(0, import_node_path86.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11205
11414
|
{ cause: error }
|
|
11206
11415
|
);
|
|
11207
11416
|
}
|
|
@@ -11282,7 +11491,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11282
11491
|
global = false
|
|
11283
11492
|
}) {
|
|
11284
11493
|
const paths = this.getSettablePaths({ global });
|
|
11285
|
-
const filePath = (0,
|
|
11494
|
+
const filePath = (0, import_node_path86.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11286
11495
|
const fileContent = await readFileContent(filePath);
|
|
11287
11496
|
const subagent = new _CodexCliSubagent({
|
|
11288
11497
|
baseDir,
|
|
@@ -11320,13 +11529,13 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11320
11529
|
};
|
|
11321
11530
|
|
|
11322
11531
|
// src/features/subagents/copilot-subagent.ts
|
|
11323
|
-
var
|
|
11324
|
-
var
|
|
11532
|
+
var import_node_path87 = require("path");
|
|
11533
|
+
var import_mini44 = require("zod/mini");
|
|
11325
11534
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
11326
|
-
var CopilotSubagentFrontmatterSchema =
|
|
11327
|
-
name:
|
|
11328
|
-
description:
|
|
11329
|
-
tools:
|
|
11535
|
+
var CopilotSubagentFrontmatterSchema = import_mini44.z.looseObject({
|
|
11536
|
+
name: import_mini44.z.string(),
|
|
11537
|
+
description: import_mini44.z.optional(import_mini44.z.string()),
|
|
11538
|
+
tools: import_mini44.z.optional(import_mini44.z.union([import_mini44.z.string(), import_mini44.z.array(import_mini44.z.string())]))
|
|
11330
11539
|
});
|
|
11331
11540
|
var normalizeTools = (tools) => {
|
|
11332
11541
|
if (!tools) {
|
|
@@ -11346,7 +11555,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11346
11555
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11347
11556
|
if (!result.success) {
|
|
11348
11557
|
throw new Error(
|
|
11349
|
-
`Invalid frontmatter in ${(0,
|
|
11558
|
+
`Invalid frontmatter in ${(0, import_node_path87.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11350
11559
|
);
|
|
11351
11560
|
}
|
|
11352
11561
|
}
|
|
@@ -11358,7 +11567,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11358
11567
|
}
|
|
11359
11568
|
static getSettablePaths(_options = {}) {
|
|
11360
11569
|
return {
|
|
11361
|
-
relativeDirPath: (0,
|
|
11570
|
+
relativeDirPath: (0, import_node_path87.join)(".github", "agents")
|
|
11362
11571
|
};
|
|
11363
11572
|
}
|
|
11364
11573
|
getFrontmatter() {
|
|
@@ -11432,7 +11641,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11432
11641
|
return {
|
|
11433
11642
|
success: false,
|
|
11434
11643
|
error: new Error(
|
|
11435
|
-
`Invalid frontmatter in ${(0,
|
|
11644
|
+
`Invalid frontmatter in ${(0, import_node_path87.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11436
11645
|
)
|
|
11437
11646
|
};
|
|
11438
11647
|
}
|
|
@@ -11450,7 +11659,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11450
11659
|
global = false
|
|
11451
11660
|
}) {
|
|
11452
11661
|
const paths = this.getSettablePaths({ global });
|
|
11453
|
-
const filePath = (0,
|
|
11662
|
+
const filePath = (0, import_node_path87.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11454
11663
|
const fileContent = await readFileContent(filePath);
|
|
11455
11664
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11456
11665
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11486,11 +11695,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11486
11695
|
};
|
|
11487
11696
|
|
|
11488
11697
|
// src/features/subagents/cursor-subagent.ts
|
|
11489
|
-
var
|
|
11490
|
-
var
|
|
11491
|
-
var CursorSubagentFrontmatterSchema =
|
|
11492
|
-
name:
|
|
11493
|
-
description:
|
|
11698
|
+
var import_node_path88 = require("path");
|
|
11699
|
+
var import_mini45 = require("zod/mini");
|
|
11700
|
+
var CursorSubagentFrontmatterSchema = import_mini45.z.looseObject({
|
|
11701
|
+
name: import_mini45.z.string(),
|
|
11702
|
+
description: import_mini45.z.optional(import_mini45.z.string())
|
|
11494
11703
|
});
|
|
11495
11704
|
var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
11496
11705
|
frontmatter;
|
|
@@ -11500,7 +11709,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11500
11709
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11501
11710
|
if (!result.success) {
|
|
11502
11711
|
throw new Error(
|
|
11503
|
-
`Invalid frontmatter in ${(0,
|
|
11712
|
+
`Invalid frontmatter in ${(0, import_node_path88.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11504
11713
|
);
|
|
11505
11714
|
}
|
|
11506
11715
|
}
|
|
@@ -11512,7 +11721,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11512
11721
|
}
|
|
11513
11722
|
static getSettablePaths(_options = {}) {
|
|
11514
11723
|
return {
|
|
11515
|
-
relativeDirPath: (0,
|
|
11724
|
+
relativeDirPath: (0, import_node_path88.join)(".cursor", "agents")
|
|
11516
11725
|
};
|
|
11517
11726
|
}
|
|
11518
11727
|
getFrontmatter() {
|
|
@@ -11579,7 +11788,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11579
11788
|
return {
|
|
11580
11789
|
success: false,
|
|
11581
11790
|
error: new Error(
|
|
11582
|
-
`Invalid frontmatter in ${(0,
|
|
11791
|
+
`Invalid frontmatter in ${(0, import_node_path88.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11583
11792
|
)
|
|
11584
11793
|
};
|
|
11585
11794
|
}
|
|
@@ -11597,7 +11806,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11597
11806
|
global = false
|
|
11598
11807
|
}) {
|
|
11599
11808
|
const paths = this.getSettablePaths({ global });
|
|
11600
|
-
const filePath = (0,
|
|
11809
|
+
const filePath = (0, import_node_path88.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11601
11810
|
const fileContent = await readFileContent(filePath);
|
|
11602
11811
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11603
11812
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11632,24 +11841,182 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11632
11841
|
}
|
|
11633
11842
|
};
|
|
11634
11843
|
|
|
11844
|
+
// src/features/subagents/junie-subagent.ts
|
|
11845
|
+
var import_node_path89 = require("path");
|
|
11846
|
+
var import_mini46 = require("zod/mini");
|
|
11847
|
+
var JunieSubagentFrontmatterSchema = import_mini46.z.looseObject({
|
|
11848
|
+
name: import_mini46.z.optional(import_mini46.z.string()),
|
|
11849
|
+
description: import_mini46.z.string()
|
|
11850
|
+
});
|
|
11851
|
+
var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
11852
|
+
frontmatter;
|
|
11853
|
+
body;
|
|
11854
|
+
constructor({ frontmatter, body, ...rest }) {
|
|
11855
|
+
if (rest.validate !== false) {
|
|
11856
|
+
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11857
|
+
if (!result.success) {
|
|
11858
|
+
throw new Error(
|
|
11859
|
+
`Invalid frontmatter in ${(0, import_node_path89.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11860
|
+
);
|
|
11861
|
+
}
|
|
11862
|
+
}
|
|
11863
|
+
super({
|
|
11864
|
+
...rest
|
|
11865
|
+
});
|
|
11866
|
+
this.frontmatter = frontmatter;
|
|
11867
|
+
this.body = body;
|
|
11868
|
+
}
|
|
11869
|
+
static getSettablePaths(options = {}) {
|
|
11870
|
+
if (options?.global) {
|
|
11871
|
+
throw new Error("JunieSubagent does not support global mode.");
|
|
11872
|
+
}
|
|
11873
|
+
return {
|
|
11874
|
+
relativeDirPath: (0, import_node_path89.join)(".junie", "agents")
|
|
11875
|
+
};
|
|
11876
|
+
}
|
|
11877
|
+
getFrontmatter() {
|
|
11878
|
+
return this.frontmatter;
|
|
11879
|
+
}
|
|
11880
|
+
getBody() {
|
|
11881
|
+
return this.body;
|
|
11882
|
+
}
|
|
11883
|
+
toRulesyncSubagent() {
|
|
11884
|
+
const { name, description, ...restFields } = this.frontmatter;
|
|
11885
|
+
const junieSection = {
|
|
11886
|
+
...restFields
|
|
11887
|
+
};
|
|
11888
|
+
const rulesyncFrontmatter = {
|
|
11889
|
+
targets: ["*"],
|
|
11890
|
+
name: name ?? this.getRelativeFilePath().replace(/\.md$/, ""),
|
|
11891
|
+
description,
|
|
11892
|
+
...Object.keys(junieSection).length > 0 && { junie: junieSection }
|
|
11893
|
+
};
|
|
11894
|
+
return new RulesyncSubagent({
|
|
11895
|
+
baseDir: ".",
|
|
11896
|
+
frontmatter: rulesyncFrontmatter,
|
|
11897
|
+
body: this.body,
|
|
11898
|
+
relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
|
|
11899
|
+
relativeFilePath: this.getRelativeFilePath(),
|
|
11900
|
+
validate: true
|
|
11901
|
+
});
|
|
11902
|
+
}
|
|
11903
|
+
static fromRulesyncSubagent({
|
|
11904
|
+
baseDir = process.cwd(),
|
|
11905
|
+
rulesyncSubagent,
|
|
11906
|
+
validate = true,
|
|
11907
|
+
global = false
|
|
11908
|
+
}) {
|
|
11909
|
+
const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
|
|
11910
|
+
const junieSection = this.filterToolSpecificSection(rulesyncFrontmatter.junie ?? {}, [
|
|
11911
|
+
"name",
|
|
11912
|
+
"description"
|
|
11913
|
+
]);
|
|
11914
|
+
const rawJunieFrontmatter = {
|
|
11915
|
+
name: rulesyncFrontmatter.name,
|
|
11916
|
+
description: rulesyncFrontmatter.description,
|
|
11917
|
+
...junieSection
|
|
11918
|
+
};
|
|
11919
|
+
const result = JunieSubagentFrontmatterSchema.safeParse(rawJunieFrontmatter);
|
|
11920
|
+
if (!result.success) {
|
|
11921
|
+
throw new Error(
|
|
11922
|
+
`Invalid junie subagent frontmatter in ${rulesyncSubagent.getRelativeFilePath()}: ${formatError(result.error)}`
|
|
11923
|
+
);
|
|
11924
|
+
}
|
|
11925
|
+
const junieFrontmatter = result.data;
|
|
11926
|
+
const body = rulesyncSubagent.getBody();
|
|
11927
|
+
const fileContent = stringifyFrontmatter(body, junieFrontmatter);
|
|
11928
|
+
const paths = this.getSettablePaths({ global });
|
|
11929
|
+
return new _JunieSubagent({
|
|
11930
|
+
baseDir,
|
|
11931
|
+
frontmatter: junieFrontmatter,
|
|
11932
|
+
body,
|
|
11933
|
+
relativeDirPath: paths.relativeDirPath,
|
|
11934
|
+
relativeFilePath: rulesyncSubagent.getRelativeFilePath(),
|
|
11935
|
+
fileContent,
|
|
11936
|
+
validate
|
|
11937
|
+
});
|
|
11938
|
+
}
|
|
11939
|
+
validate() {
|
|
11940
|
+
if (!this.frontmatter) {
|
|
11941
|
+
return { success: true, error: null };
|
|
11942
|
+
}
|
|
11943
|
+
const result = JunieSubagentFrontmatterSchema.safeParse(this.frontmatter);
|
|
11944
|
+
if (result.success) {
|
|
11945
|
+
return { success: true, error: null };
|
|
11946
|
+
} else {
|
|
11947
|
+
return {
|
|
11948
|
+
success: false,
|
|
11949
|
+
error: new Error(
|
|
11950
|
+
`Invalid frontmatter in ${(0, import_node_path89.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11951
|
+
)
|
|
11952
|
+
};
|
|
11953
|
+
}
|
|
11954
|
+
}
|
|
11955
|
+
static isTargetedByRulesyncSubagent(rulesyncSubagent) {
|
|
11956
|
+
return this.isTargetedByRulesyncSubagentDefault({
|
|
11957
|
+
rulesyncSubagent,
|
|
11958
|
+
toolTarget: "junie"
|
|
11959
|
+
});
|
|
11960
|
+
}
|
|
11961
|
+
static async fromFile({
|
|
11962
|
+
baseDir = process.cwd(),
|
|
11963
|
+
relativeFilePath,
|
|
11964
|
+
validate = true,
|
|
11965
|
+
global = false
|
|
11966
|
+
}) {
|
|
11967
|
+
const paths = this.getSettablePaths({ global });
|
|
11968
|
+
const filePath = (0, import_node_path89.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11969
|
+
const fileContent = await readFileContent(filePath);
|
|
11970
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11971
|
+
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11972
|
+
if (!result.success) {
|
|
11973
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
11974
|
+
}
|
|
11975
|
+
return new _JunieSubagent({
|
|
11976
|
+
baseDir,
|
|
11977
|
+
relativeDirPath: paths.relativeDirPath,
|
|
11978
|
+
relativeFilePath,
|
|
11979
|
+
frontmatter: result.data,
|
|
11980
|
+
body: content.trim(),
|
|
11981
|
+
fileContent,
|
|
11982
|
+
validate
|
|
11983
|
+
});
|
|
11984
|
+
}
|
|
11985
|
+
static forDeletion({
|
|
11986
|
+
baseDir = process.cwd(),
|
|
11987
|
+
relativeDirPath,
|
|
11988
|
+
relativeFilePath
|
|
11989
|
+
}) {
|
|
11990
|
+
return new _JunieSubagent({
|
|
11991
|
+
baseDir,
|
|
11992
|
+
relativeDirPath,
|
|
11993
|
+
relativeFilePath,
|
|
11994
|
+
frontmatter: { name: "", description: "" },
|
|
11995
|
+
body: "",
|
|
11996
|
+
fileContent: "",
|
|
11997
|
+
validate: false
|
|
11998
|
+
});
|
|
11999
|
+
}
|
|
12000
|
+
};
|
|
12001
|
+
|
|
11635
12002
|
// src/features/subagents/kiro-subagent.ts
|
|
11636
|
-
var
|
|
11637
|
-
var
|
|
11638
|
-
var KiroCliSubagentJsonSchema =
|
|
11639
|
-
name:
|
|
11640
|
-
description:
|
|
11641
|
-
prompt:
|
|
11642
|
-
tools:
|
|
11643
|
-
toolAliases:
|
|
11644
|
-
toolSettings:
|
|
11645
|
-
toolSchema:
|
|
11646
|
-
hooks:
|
|
11647
|
-
model:
|
|
11648
|
-
mcpServers:
|
|
11649
|
-
useLegacyMcpJson:
|
|
11650
|
-
resources:
|
|
11651
|
-
allowedTools:
|
|
11652
|
-
includeMcpJson:
|
|
12003
|
+
var import_node_path90 = require("path");
|
|
12004
|
+
var import_mini47 = require("zod/mini");
|
|
12005
|
+
var KiroCliSubagentJsonSchema = import_mini47.z.looseObject({
|
|
12006
|
+
name: import_mini47.z.string(),
|
|
12007
|
+
description: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.string())),
|
|
12008
|
+
prompt: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.string())),
|
|
12009
|
+
tools: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.array(import_mini47.z.string()))),
|
|
12010
|
+
toolAliases: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.record(import_mini47.z.string(), import_mini47.z.string()))),
|
|
12011
|
+
toolSettings: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.unknown())),
|
|
12012
|
+
toolSchema: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.unknown())),
|
|
12013
|
+
hooks: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.record(import_mini47.z.string(), import_mini47.z.array(import_mini47.z.unknown())))),
|
|
12014
|
+
model: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.string())),
|
|
12015
|
+
mcpServers: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.record(import_mini47.z.string(), import_mini47.z.unknown()))),
|
|
12016
|
+
useLegacyMcpJson: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.boolean())),
|
|
12017
|
+
resources: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.array(import_mini47.z.string()))),
|
|
12018
|
+
allowedTools: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.array(import_mini47.z.string()))),
|
|
12019
|
+
includeMcpJson: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.boolean()))
|
|
11653
12020
|
});
|
|
11654
12021
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
11655
12022
|
body;
|
|
@@ -11660,7 +12027,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11660
12027
|
KiroCliSubagentJsonSchema.parse(parsed);
|
|
11661
12028
|
} catch (error) {
|
|
11662
12029
|
throw new Error(
|
|
11663
|
-
`Invalid JSON in ${(0,
|
|
12030
|
+
`Invalid JSON in ${(0, import_node_path90.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11664
12031
|
{ cause: error }
|
|
11665
12032
|
);
|
|
11666
12033
|
}
|
|
@@ -11672,7 +12039,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11672
12039
|
}
|
|
11673
12040
|
static getSettablePaths(_options = {}) {
|
|
11674
12041
|
return {
|
|
11675
|
-
relativeDirPath: (0,
|
|
12042
|
+
relativeDirPath: (0, import_node_path90.join)(".kiro", "agents")
|
|
11676
12043
|
};
|
|
11677
12044
|
}
|
|
11678
12045
|
getBody() {
|
|
@@ -11684,7 +12051,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11684
12051
|
parsed = JSON.parse(this.body);
|
|
11685
12052
|
} catch (error) {
|
|
11686
12053
|
throw new Error(
|
|
11687
|
-
`Failed to parse JSON in ${(0,
|
|
12054
|
+
`Failed to parse JSON in ${(0, import_node_path90.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11688
12055
|
{ cause: error }
|
|
11689
12056
|
);
|
|
11690
12057
|
}
|
|
@@ -11765,7 +12132,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11765
12132
|
global = false
|
|
11766
12133
|
}) {
|
|
11767
12134
|
const paths = this.getSettablePaths({ global });
|
|
11768
|
-
const filePath = (0,
|
|
12135
|
+
const filePath = (0, import_node_path90.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11769
12136
|
const fileContent = await readFileContent(filePath);
|
|
11770
12137
|
const subagent = new _KiroSubagent({
|
|
11771
12138
|
baseDir,
|
|
@@ -11803,12 +12170,12 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11803
12170
|
};
|
|
11804
12171
|
|
|
11805
12172
|
// src/features/subagents/opencode-subagent.ts
|
|
11806
|
-
var
|
|
11807
|
-
var
|
|
11808
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
11809
|
-
description:
|
|
11810
|
-
mode:
|
|
11811
|
-
name:
|
|
12173
|
+
var import_node_path91 = require("path");
|
|
12174
|
+
var import_mini48 = require("zod/mini");
|
|
12175
|
+
var OpenCodeSubagentFrontmatterSchema = import_mini48.z.looseObject({
|
|
12176
|
+
description: import_mini48.z.optional(import_mini48.z.string()),
|
|
12177
|
+
mode: import_mini48.z._default(import_mini48.z.string(), "subagent"),
|
|
12178
|
+
name: import_mini48.z.optional(import_mini48.z.string())
|
|
11812
12179
|
});
|
|
11813
12180
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
11814
12181
|
frontmatter;
|
|
@@ -11818,7 +12185,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11818
12185
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11819
12186
|
if (!result.success) {
|
|
11820
12187
|
throw new Error(
|
|
11821
|
-
`Invalid frontmatter in ${(0,
|
|
12188
|
+
`Invalid frontmatter in ${(0, import_node_path91.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11822
12189
|
);
|
|
11823
12190
|
}
|
|
11824
12191
|
}
|
|
@@ -11832,7 +12199,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11832
12199
|
global = false
|
|
11833
12200
|
} = {}) {
|
|
11834
12201
|
return {
|
|
11835
|
-
relativeDirPath: global ? (0,
|
|
12202
|
+
relativeDirPath: global ? (0, import_node_path91.join)(".config", "opencode", "agent") : (0, import_node_path91.join)(".opencode", "agent")
|
|
11836
12203
|
};
|
|
11837
12204
|
}
|
|
11838
12205
|
getFrontmatter() {
|
|
@@ -11845,7 +12212,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11845
12212
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
11846
12213
|
const rulesyncFrontmatter = {
|
|
11847
12214
|
targets: ["*"],
|
|
11848
|
-
name: name ?? (0,
|
|
12215
|
+
name: name ?? (0, import_node_path91.basename)(this.getRelativeFilePath(), ".md"),
|
|
11849
12216
|
description,
|
|
11850
12217
|
opencode: { mode, ...opencodeSection }
|
|
11851
12218
|
};
|
|
@@ -11898,7 +12265,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11898
12265
|
return {
|
|
11899
12266
|
success: false,
|
|
11900
12267
|
error: new Error(
|
|
11901
|
-
`Invalid frontmatter in ${(0,
|
|
12268
|
+
`Invalid frontmatter in ${(0, import_node_path91.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11902
12269
|
)
|
|
11903
12270
|
};
|
|
11904
12271
|
}
|
|
@@ -11915,7 +12282,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11915
12282
|
global = false
|
|
11916
12283
|
}) {
|
|
11917
12284
|
const paths = this.getSettablePaths({ global });
|
|
11918
|
-
const filePath = (0,
|
|
12285
|
+
const filePath = (0, import_node_path91.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11919
12286
|
const fileContent = await readFileContent(filePath);
|
|
11920
12287
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11921
12288
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11960,11 +12327,12 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
11960
12327
|
"cursor",
|
|
11961
12328
|
"factorydroid",
|
|
11962
12329
|
"geminicli",
|
|
12330
|
+
"junie",
|
|
11963
12331
|
"kiro",
|
|
11964
12332
|
"opencode",
|
|
11965
12333
|
"roo"
|
|
11966
12334
|
];
|
|
11967
|
-
var SubagentsProcessorToolTargetSchema =
|
|
12335
|
+
var SubagentsProcessorToolTargetSchema = import_mini49.z.enum(subagentsProcessorToolTargetTuple);
|
|
11968
12336
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
11969
12337
|
[
|
|
11970
12338
|
"agentsmd",
|
|
@@ -12022,6 +12390,13 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
|
12022
12390
|
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
12023
12391
|
}
|
|
12024
12392
|
],
|
|
12393
|
+
[
|
|
12394
|
+
"junie",
|
|
12395
|
+
{
|
|
12396
|
+
class: JunieSubagent,
|
|
12397
|
+
meta: { supportsSimulated: false, supportsGlobal: false, filePattern: "*.md" }
|
|
12398
|
+
}
|
|
12399
|
+
],
|
|
12025
12400
|
[
|
|
12026
12401
|
"kiro",
|
|
12027
12402
|
{
|
|
@@ -12126,7 +12501,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12126
12501
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
12127
12502
|
*/
|
|
12128
12503
|
async loadRulesyncFiles() {
|
|
12129
|
-
const subagentsDir = (0,
|
|
12504
|
+
const subagentsDir = (0, import_node_path92.join)(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
12130
12505
|
const dirExists = await directoryExists(subagentsDir);
|
|
12131
12506
|
if (!dirExists) {
|
|
12132
12507
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -12141,7 +12516,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12141
12516
|
logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
12142
12517
|
const rulesyncSubagents = [];
|
|
12143
12518
|
for (const mdFile of mdFiles) {
|
|
12144
|
-
const filepath = (0,
|
|
12519
|
+
const filepath = (0, import_node_path92.join)(subagentsDir, mdFile);
|
|
12145
12520
|
try {
|
|
12146
12521
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
12147
12522
|
relativeFilePath: mdFile,
|
|
@@ -12171,14 +12546,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12171
12546
|
const factory = this.getFactory(this.toolTarget);
|
|
12172
12547
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
12173
12548
|
const subagentFilePaths = await findFilesByGlobs(
|
|
12174
|
-
(0,
|
|
12549
|
+
(0, import_node_path92.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
12175
12550
|
);
|
|
12176
12551
|
if (forDeletion) {
|
|
12177
12552
|
const toolSubagents2 = subagentFilePaths.map(
|
|
12178
12553
|
(path3) => factory.class.forDeletion({
|
|
12179
12554
|
baseDir: this.baseDir,
|
|
12180
12555
|
relativeDirPath: paths.relativeDirPath,
|
|
12181
|
-
relativeFilePath: (0,
|
|
12556
|
+
relativeFilePath: (0, import_node_path92.basename)(path3),
|
|
12182
12557
|
global: this.global
|
|
12183
12558
|
})
|
|
12184
12559
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -12191,7 +12566,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12191
12566
|
subagentFilePaths.map(
|
|
12192
12567
|
(path3) => factory.class.fromFile({
|
|
12193
12568
|
baseDir: this.baseDir,
|
|
12194
|
-
relativeFilePath: (0,
|
|
12569
|
+
relativeFilePath: (0, import_node_path92.basename)(path3),
|
|
12195
12570
|
global: this.global
|
|
12196
12571
|
})
|
|
12197
12572
|
)
|
|
@@ -12236,49 +12611,49 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12236
12611
|
};
|
|
12237
12612
|
|
|
12238
12613
|
// src/features/rules/agentsmd-rule.ts
|
|
12239
|
-
var
|
|
12614
|
+
var import_node_path95 = require("path");
|
|
12240
12615
|
|
|
12241
12616
|
// src/features/rules/tool-rule.ts
|
|
12242
|
-
var
|
|
12617
|
+
var import_node_path94 = require("path");
|
|
12243
12618
|
|
|
12244
12619
|
// src/features/rules/rulesync-rule.ts
|
|
12245
|
-
var
|
|
12246
|
-
var
|
|
12247
|
-
var RulesyncRuleFrontmatterSchema =
|
|
12248
|
-
root:
|
|
12249
|
-
localRoot:
|
|
12250
|
-
targets:
|
|
12251
|
-
description:
|
|
12252
|
-
globs:
|
|
12253
|
-
agentsmd:
|
|
12254
|
-
|
|
12620
|
+
var import_node_path93 = require("path");
|
|
12621
|
+
var import_mini50 = require("zod/mini");
|
|
12622
|
+
var RulesyncRuleFrontmatterSchema = import_mini50.z.object({
|
|
12623
|
+
root: import_mini50.z.optional(import_mini50.z.boolean()),
|
|
12624
|
+
localRoot: import_mini50.z.optional(import_mini50.z.boolean()),
|
|
12625
|
+
targets: import_mini50.z._default(RulesyncTargetsSchema, ["*"]),
|
|
12626
|
+
description: import_mini50.z.optional(import_mini50.z.string()),
|
|
12627
|
+
globs: import_mini50.z.optional(import_mini50.z.array(import_mini50.z.string())),
|
|
12628
|
+
agentsmd: import_mini50.z.optional(
|
|
12629
|
+
import_mini50.z.object({
|
|
12255
12630
|
// @example "path/to/subproject"
|
|
12256
|
-
subprojectPath:
|
|
12631
|
+
subprojectPath: import_mini50.z.optional(import_mini50.z.string())
|
|
12257
12632
|
})
|
|
12258
12633
|
),
|
|
12259
|
-
claudecode:
|
|
12260
|
-
|
|
12634
|
+
claudecode: import_mini50.z.optional(
|
|
12635
|
+
import_mini50.z.object({
|
|
12261
12636
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
12262
12637
|
// @example ["src/**/*.ts", "tests/**/*.test.ts"]
|
|
12263
|
-
paths:
|
|
12638
|
+
paths: import_mini50.z.optional(import_mini50.z.array(import_mini50.z.string()))
|
|
12264
12639
|
})
|
|
12265
12640
|
),
|
|
12266
|
-
cursor:
|
|
12267
|
-
|
|
12268
|
-
alwaysApply:
|
|
12269
|
-
description:
|
|
12270
|
-
globs:
|
|
12641
|
+
cursor: import_mini50.z.optional(
|
|
12642
|
+
import_mini50.z.object({
|
|
12643
|
+
alwaysApply: import_mini50.z.optional(import_mini50.z.boolean()),
|
|
12644
|
+
description: import_mini50.z.optional(import_mini50.z.string()),
|
|
12645
|
+
globs: import_mini50.z.optional(import_mini50.z.array(import_mini50.z.string()))
|
|
12271
12646
|
})
|
|
12272
12647
|
),
|
|
12273
|
-
copilot:
|
|
12274
|
-
|
|
12275
|
-
excludeAgent:
|
|
12648
|
+
copilot: import_mini50.z.optional(
|
|
12649
|
+
import_mini50.z.object({
|
|
12650
|
+
excludeAgent: import_mini50.z.optional(import_mini50.z.union([import_mini50.z.literal("code-review"), import_mini50.z.literal("coding-agent")]))
|
|
12276
12651
|
})
|
|
12277
12652
|
),
|
|
12278
|
-
antigravity:
|
|
12279
|
-
|
|
12280
|
-
trigger:
|
|
12281
|
-
globs:
|
|
12653
|
+
antigravity: import_mini50.z.optional(
|
|
12654
|
+
import_mini50.z.looseObject({
|
|
12655
|
+
trigger: import_mini50.z.optional(import_mini50.z.string()),
|
|
12656
|
+
globs: import_mini50.z.optional(import_mini50.z.array(import_mini50.z.string()))
|
|
12282
12657
|
})
|
|
12283
12658
|
)
|
|
12284
12659
|
});
|
|
@@ -12289,7 +12664,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
12289
12664
|
const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12290
12665
|
if (!parseResult.success && rest.validate !== false) {
|
|
12291
12666
|
throw new Error(
|
|
12292
|
-
`Invalid frontmatter in ${(0,
|
|
12667
|
+
`Invalid frontmatter in ${(0, import_node_path93.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
12293
12668
|
);
|
|
12294
12669
|
}
|
|
12295
12670
|
const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -12324,7 +12699,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
12324
12699
|
return {
|
|
12325
12700
|
success: false,
|
|
12326
12701
|
error: new Error(
|
|
12327
|
-
`Invalid frontmatter in ${(0,
|
|
12702
|
+
`Invalid frontmatter in ${(0, import_node_path93.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12328
12703
|
)
|
|
12329
12704
|
};
|
|
12330
12705
|
}
|
|
@@ -12333,7 +12708,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
12333
12708
|
relativeFilePath,
|
|
12334
12709
|
validate = true
|
|
12335
12710
|
}) {
|
|
12336
|
-
const filePath = (0,
|
|
12711
|
+
const filePath = (0, import_node_path93.join)(
|
|
12337
12712
|
process.cwd(),
|
|
12338
12713
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
12339
12714
|
relativeFilePath
|
|
@@ -12435,7 +12810,7 @@ var ToolRule = class extends ToolFile {
|
|
|
12435
12810
|
rulesyncRule,
|
|
12436
12811
|
validate = true,
|
|
12437
12812
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
12438
|
-
nonRootPath = { relativeDirPath: (0,
|
|
12813
|
+
nonRootPath = { relativeDirPath: (0, import_node_path94.join)(".agents", "memories") }
|
|
12439
12814
|
}) {
|
|
12440
12815
|
const params = this.buildToolRuleParamsDefault({
|
|
12441
12816
|
baseDir,
|
|
@@ -12446,7 +12821,7 @@ var ToolRule = class extends ToolFile {
|
|
|
12446
12821
|
});
|
|
12447
12822
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
12448
12823
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
12449
|
-
params.relativeDirPath = (0,
|
|
12824
|
+
params.relativeDirPath = (0, import_node_path94.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
12450
12825
|
params.relativeFilePath = "AGENTS.md";
|
|
12451
12826
|
}
|
|
12452
12827
|
return params;
|
|
@@ -12495,7 +12870,7 @@ var ToolRule = class extends ToolFile {
|
|
|
12495
12870
|
}
|
|
12496
12871
|
};
|
|
12497
12872
|
function buildToolPath(toolDir, subDir, excludeToolDir) {
|
|
12498
|
-
return excludeToolDir ? subDir : (0,
|
|
12873
|
+
return excludeToolDir ? subDir : (0, import_node_path94.join)(toolDir, subDir);
|
|
12499
12874
|
}
|
|
12500
12875
|
|
|
12501
12876
|
// src/features/rules/agentsmd-rule.ts
|
|
@@ -12524,8 +12899,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
12524
12899
|
validate = true
|
|
12525
12900
|
}) {
|
|
12526
12901
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
12527
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
12528
|
-
const fileContent = await readFileContent((0,
|
|
12902
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path95.join)(".agents", "memories", relativeFilePath);
|
|
12903
|
+
const fileContent = await readFileContent((0, import_node_path95.join)(baseDir, relativePath));
|
|
12529
12904
|
return new _AgentsMdRule({
|
|
12530
12905
|
baseDir,
|
|
12531
12906
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -12580,21 +12955,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
12580
12955
|
};
|
|
12581
12956
|
|
|
12582
12957
|
// src/features/rules/antigravity-rule.ts
|
|
12583
|
-
var
|
|
12584
|
-
var
|
|
12585
|
-
var AntigravityRuleFrontmatterSchema =
|
|
12586
|
-
trigger:
|
|
12587
|
-
|
|
12588
|
-
|
|
12589
|
-
|
|
12590
|
-
|
|
12591
|
-
|
|
12592
|
-
|
|
12958
|
+
var import_node_path96 = require("path");
|
|
12959
|
+
var import_mini51 = require("zod/mini");
|
|
12960
|
+
var AntigravityRuleFrontmatterSchema = import_mini51.z.looseObject({
|
|
12961
|
+
trigger: import_mini51.z.optional(
|
|
12962
|
+
import_mini51.z.union([
|
|
12963
|
+
import_mini51.z.literal("always_on"),
|
|
12964
|
+
import_mini51.z.literal("glob"),
|
|
12965
|
+
import_mini51.z.literal("manual"),
|
|
12966
|
+
import_mini51.z.literal("model_decision"),
|
|
12967
|
+
import_mini51.z.string()
|
|
12593
12968
|
// accepts any string for forward compatibility
|
|
12594
12969
|
])
|
|
12595
12970
|
),
|
|
12596
|
-
globs:
|
|
12597
|
-
description:
|
|
12971
|
+
globs: import_mini51.z.optional(import_mini51.z.string()),
|
|
12972
|
+
description: import_mini51.z.optional(import_mini51.z.string())
|
|
12598
12973
|
});
|
|
12599
12974
|
function parseGlobsString(globs) {
|
|
12600
12975
|
if (!globs) {
|
|
@@ -12739,7 +13114,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
12739
13114
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12740
13115
|
if (!result.success) {
|
|
12741
13116
|
throw new Error(
|
|
12742
|
-
`Invalid frontmatter in ${(0,
|
|
13117
|
+
`Invalid frontmatter in ${(0, import_node_path96.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12743
13118
|
);
|
|
12744
13119
|
}
|
|
12745
13120
|
}
|
|
@@ -12763,7 +13138,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
12763
13138
|
relativeFilePath,
|
|
12764
13139
|
validate = true
|
|
12765
13140
|
}) {
|
|
12766
|
-
const filePath = (0,
|
|
13141
|
+
const filePath = (0, import_node_path96.join)(
|
|
12767
13142
|
baseDir,
|
|
12768
13143
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
12769
13144
|
relativeFilePath
|
|
@@ -12903,7 +13278,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
12903
13278
|
};
|
|
12904
13279
|
|
|
12905
13280
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
12906
|
-
var
|
|
13281
|
+
var import_node_path97 = require("path");
|
|
12907
13282
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
12908
13283
|
toRulesyncRule() {
|
|
12909
13284
|
const rulesyncFrontmatter = {
|
|
@@ -12963,8 +13338,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
12963
13338
|
}) {
|
|
12964
13339
|
const settablePaths = this.getSettablePaths();
|
|
12965
13340
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
12966
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
12967
|
-
const fileContent = await readFileContent((0,
|
|
13341
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path97.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13342
|
+
const fileContent = await readFileContent((0, import_node_path97.join)(baseDir, relativePath));
|
|
12968
13343
|
return new _AugmentcodeLegacyRule({
|
|
12969
13344
|
baseDir,
|
|
12970
13345
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -12993,7 +13368,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
12993
13368
|
};
|
|
12994
13369
|
|
|
12995
13370
|
// src/features/rules/augmentcode-rule.ts
|
|
12996
|
-
var
|
|
13371
|
+
var import_node_path98 = require("path");
|
|
12997
13372
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
12998
13373
|
toRulesyncRule() {
|
|
12999
13374
|
return this.toRulesyncRuleDefault();
|
|
@@ -13024,7 +13399,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
13024
13399
|
relativeFilePath,
|
|
13025
13400
|
validate = true
|
|
13026
13401
|
}) {
|
|
13027
|
-
const filePath = (0,
|
|
13402
|
+
const filePath = (0, import_node_path98.join)(
|
|
13028
13403
|
baseDir,
|
|
13029
13404
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13030
13405
|
relativeFilePath
|
|
@@ -13064,7 +13439,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
13064
13439
|
};
|
|
13065
13440
|
|
|
13066
13441
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
13067
|
-
var
|
|
13442
|
+
var import_node_path99 = require("path");
|
|
13068
13443
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
13069
13444
|
static getSettablePaths({
|
|
13070
13445
|
global,
|
|
@@ -13106,7 +13481,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13106
13481
|
if (isRoot) {
|
|
13107
13482
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
13108
13483
|
const fileContent2 = await readFileContent(
|
|
13109
|
-
(0,
|
|
13484
|
+
(0, import_node_path99.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
13110
13485
|
);
|
|
13111
13486
|
return new _ClaudecodeLegacyRule({
|
|
13112
13487
|
baseDir,
|
|
@@ -13120,8 +13495,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13120
13495
|
if (!paths.nonRoot) {
|
|
13121
13496
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13122
13497
|
}
|
|
13123
|
-
const relativePath = (0,
|
|
13124
|
-
const fileContent = await readFileContent((0,
|
|
13498
|
+
const relativePath = (0, import_node_path99.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13499
|
+
const fileContent = await readFileContent((0, import_node_path99.join)(baseDir, relativePath));
|
|
13125
13500
|
return new _ClaudecodeLegacyRule({
|
|
13126
13501
|
baseDir,
|
|
13127
13502
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13180,10 +13555,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13180
13555
|
};
|
|
13181
13556
|
|
|
13182
13557
|
// src/features/rules/claudecode-rule.ts
|
|
13183
|
-
var
|
|
13184
|
-
var
|
|
13185
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
13186
|
-
paths:
|
|
13558
|
+
var import_node_path100 = require("path");
|
|
13559
|
+
var import_mini52 = require("zod/mini");
|
|
13560
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini52.z.object({
|
|
13561
|
+
paths: import_mini52.z.optional(import_mini52.z.array(import_mini52.z.string()))
|
|
13187
13562
|
});
|
|
13188
13563
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
13189
13564
|
frontmatter;
|
|
@@ -13221,7 +13596,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13221
13596
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13222
13597
|
if (!result.success) {
|
|
13223
13598
|
throw new Error(
|
|
13224
|
-
`Invalid frontmatter in ${(0,
|
|
13599
|
+
`Invalid frontmatter in ${(0, import_node_path100.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13225
13600
|
);
|
|
13226
13601
|
}
|
|
13227
13602
|
}
|
|
@@ -13251,7 +13626,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13251
13626
|
if (isRoot) {
|
|
13252
13627
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
13253
13628
|
const fileContent2 = await readFileContent(
|
|
13254
|
-
(0,
|
|
13629
|
+
(0, import_node_path100.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
13255
13630
|
);
|
|
13256
13631
|
return new _ClaudecodeRule({
|
|
13257
13632
|
baseDir,
|
|
@@ -13266,8 +13641,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13266
13641
|
if (!paths.nonRoot) {
|
|
13267
13642
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13268
13643
|
}
|
|
13269
|
-
const relativePath = (0,
|
|
13270
|
-
const filePath = (0,
|
|
13644
|
+
const relativePath = (0, import_node_path100.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13645
|
+
const filePath = (0, import_node_path100.join)(baseDir, relativePath);
|
|
13271
13646
|
const fileContent = await readFileContent(filePath);
|
|
13272
13647
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13273
13648
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13378,7 +13753,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13378
13753
|
return {
|
|
13379
13754
|
success: false,
|
|
13380
13755
|
error: new Error(
|
|
13381
|
-
`Invalid frontmatter in ${(0,
|
|
13756
|
+
`Invalid frontmatter in ${(0, import_node_path100.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13382
13757
|
)
|
|
13383
13758
|
};
|
|
13384
13759
|
}
|
|
@@ -13398,10 +13773,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13398
13773
|
};
|
|
13399
13774
|
|
|
13400
13775
|
// src/features/rules/cline-rule.ts
|
|
13401
|
-
var
|
|
13402
|
-
var
|
|
13403
|
-
var ClineRuleFrontmatterSchema =
|
|
13404
|
-
description:
|
|
13776
|
+
var import_node_path101 = require("path");
|
|
13777
|
+
var import_mini53 = require("zod/mini");
|
|
13778
|
+
var ClineRuleFrontmatterSchema = import_mini53.z.object({
|
|
13779
|
+
description: import_mini53.z.string()
|
|
13405
13780
|
});
|
|
13406
13781
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
13407
13782
|
static getSettablePaths(_options = {}) {
|
|
@@ -13444,7 +13819,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
13444
13819
|
validate = true
|
|
13445
13820
|
}) {
|
|
13446
13821
|
const fileContent = await readFileContent(
|
|
13447
|
-
(0,
|
|
13822
|
+
(0, import_node_path101.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
13448
13823
|
);
|
|
13449
13824
|
return new _ClineRule({
|
|
13450
13825
|
baseDir,
|
|
@@ -13470,7 +13845,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
13470
13845
|
};
|
|
13471
13846
|
|
|
13472
13847
|
// src/features/rules/codexcli-rule.ts
|
|
13473
|
-
var
|
|
13848
|
+
var import_node_path102 = require("path");
|
|
13474
13849
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
13475
13850
|
static getSettablePaths({
|
|
13476
13851
|
global,
|
|
@@ -13505,7 +13880,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
13505
13880
|
if (isRoot) {
|
|
13506
13881
|
const relativePath2 = paths.root.relativeFilePath;
|
|
13507
13882
|
const fileContent2 = await readFileContent(
|
|
13508
|
-
(0,
|
|
13883
|
+
(0, import_node_path102.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
13509
13884
|
);
|
|
13510
13885
|
return new _CodexcliRule({
|
|
13511
13886
|
baseDir,
|
|
@@ -13519,8 +13894,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
13519
13894
|
if (!paths.nonRoot) {
|
|
13520
13895
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13521
13896
|
}
|
|
13522
|
-
const relativePath = (0,
|
|
13523
|
-
const fileContent = await readFileContent((0,
|
|
13897
|
+
const relativePath = (0, import_node_path102.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13898
|
+
const fileContent = await readFileContent((0, import_node_path102.join)(baseDir, relativePath));
|
|
13524
13899
|
return new _CodexcliRule({
|
|
13525
13900
|
baseDir,
|
|
13526
13901
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13579,12 +13954,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
13579
13954
|
};
|
|
13580
13955
|
|
|
13581
13956
|
// src/features/rules/copilot-rule.ts
|
|
13582
|
-
var
|
|
13583
|
-
var
|
|
13584
|
-
var CopilotRuleFrontmatterSchema =
|
|
13585
|
-
description:
|
|
13586
|
-
applyTo:
|
|
13587
|
-
excludeAgent:
|
|
13957
|
+
var import_node_path103 = require("path");
|
|
13958
|
+
var import_mini54 = require("zod/mini");
|
|
13959
|
+
var CopilotRuleFrontmatterSchema = import_mini54.z.object({
|
|
13960
|
+
description: import_mini54.z.optional(import_mini54.z.string()),
|
|
13961
|
+
applyTo: import_mini54.z.optional(import_mini54.z.string()),
|
|
13962
|
+
excludeAgent: import_mini54.z.optional(import_mini54.z.union([import_mini54.z.literal("code-review"), import_mini54.z.literal("coding-agent")]))
|
|
13588
13963
|
});
|
|
13589
13964
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
13590
13965
|
frontmatter;
|
|
@@ -13595,6 +13970,9 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13595
13970
|
root: {
|
|
13596
13971
|
relativeDirPath: buildToolPath(".copilot", ".", options.excludeToolDir),
|
|
13597
13972
|
relativeFilePath: "copilot-instructions.md"
|
|
13973
|
+
},
|
|
13974
|
+
nonRoot: {
|
|
13975
|
+
relativeDirPath: buildToolPath(".copilot", "instructions", options.excludeToolDir)
|
|
13598
13976
|
}
|
|
13599
13977
|
};
|
|
13600
13978
|
}
|
|
@@ -13613,7 +13991,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13613
13991
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13614
13992
|
if (!result.success) {
|
|
13615
13993
|
throw new Error(
|
|
13616
|
-
`Invalid frontmatter in ${(0,
|
|
13994
|
+
`Invalid frontmatter in ${(0, import_node_path103.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13617
13995
|
);
|
|
13618
13996
|
}
|
|
13619
13997
|
}
|
|
@@ -13703,8 +14081,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13703
14081
|
const paths = this.getSettablePaths({ global });
|
|
13704
14082
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
13705
14083
|
if (isRoot) {
|
|
13706
|
-
const relativePath2 = (0,
|
|
13707
|
-
const filePath2 = (0,
|
|
14084
|
+
const relativePath2 = (0, import_node_path103.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
14085
|
+
const filePath2 = (0, import_node_path103.join)(baseDir, relativePath2);
|
|
13708
14086
|
const fileContent2 = await readFileContent(filePath2);
|
|
13709
14087
|
return new _CopilotRule({
|
|
13710
14088
|
baseDir,
|
|
@@ -13719,8 +14097,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13719
14097
|
if (!paths.nonRoot) {
|
|
13720
14098
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13721
14099
|
}
|
|
13722
|
-
const relativePath = (0,
|
|
13723
|
-
const filePath = (0,
|
|
14100
|
+
const relativePath = (0, import_node_path103.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14101
|
+
const filePath = (0, import_node_path103.join)(baseDir, relativePath);
|
|
13724
14102
|
const fileContent = await readFileContent(filePath);
|
|
13725
14103
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13726
14104
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13766,7 +14144,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13766
14144
|
return {
|
|
13767
14145
|
success: false,
|
|
13768
14146
|
error: new Error(
|
|
13769
|
-
`Invalid frontmatter in ${(0,
|
|
14147
|
+
`Invalid frontmatter in ${(0, import_node_path103.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13770
14148
|
)
|
|
13771
14149
|
};
|
|
13772
14150
|
}
|
|
@@ -13786,12 +14164,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13786
14164
|
};
|
|
13787
14165
|
|
|
13788
14166
|
// src/features/rules/cursor-rule.ts
|
|
13789
|
-
var
|
|
13790
|
-
var
|
|
13791
|
-
var CursorRuleFrontmatterSchema =
|
|
13792
|
-
description:
|
|
13793
|
-
globs:
|
|
13794
|
-
alwaysApply:
|
|
14167
|
+
var import_node_path104 = require("path");
|
|
14168
|
+
var import_mini55 = require("zod/mini");
|
|
14169
|
+
var CursorRuleFrontmatterSchema = import_mini55.z.object({
|
|
14170
|
+
description: import_mini55.z.optional(import_mini55.z.string()),
|
|
14171
|
+
globs: import_mini55.z.optional(import_mini55.z.string()),
|
|
14172
|
+
alwaysApply: import_mini55.z.optional(import_mini55.z.boolean())
|
|
13795
14173
|
});
|
|
13796
14174
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
13797
14175
|
frontmatter;
|
|
@@ -13808,7 +14186,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13808
14186
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13809
14187
|
if (!result.success) {
|
|
13810
14188
|
throw new Error(
|
|
13811
|
-
`Invalid frontmatter in ${(0,
|
|
14189
|
+
`Invalid frontmatter in ${(0, import_node_path104.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13812
14190
|
);
|
|
13813
14191
|
}
|
|
13814
14192
|
}
|
|
@@ -13924,7 +14302,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13924
14302
|
relativeFilePath,
|
|
13925
14303
|
validate = true
|
|
13926
14304
|
}) {
|
|
13927
|
-
const filePath = (0,
|
|
14305
|
+
const filePath = (0, import_node_path104.join)(
|
|
13928
14306
|
baseDir,
|
|
13929
14307
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13930
14308
|
relativeFilePath
|
|
@@ -13934,7 +14312,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13934
14312
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13935
14313
|
if (!result.success) {
|
|
13936
14314
|
throw new Error(
|
|
13937
|
-
`Invalid frontmatter in ${(0,
|
|
14315
|
+
`Invalid frontmatter in ${(0, import_node_path104.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
13938
14316
|
);
|
|
13939
14317
|
}
|
|
13940
14318
|
return new _CursorRule({
|
|
@@ -13971,7 +14349,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13971
14349
|
return {
|
|
13972
14350
|
success: false,
|
|
13973
14351
|
error: new Error(
|
|
13974
|
-
`Invalid frontmatter in ${(0,
|
|
14352
|
+
`Invalid frontmatter in ${(0, import_node_path104.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13975
14353
|
)
|
|
13976
14354
|
};
|
|
13977
14355
|
}
|
|
@@ -13991,7 +14369,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13991
14369
|
};
|
|
13992
14370
|
|
|
13993
14371
|
// src/features/rules/factorydroid-rule.ts
|
|
13994
|
-
var
|
|
14372
|
+
var import_node_path105 = require("path");
|
|
13995
14373
|
var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
13996
14374
|
constructor({ fileContent, root, ...rest }) {
|
|
13997
14375
|
super({
|
|
@@ -14031,8 +14409,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14031
14409
|
const paths = this.getSettablePaths({ global });
|
|
14032
14410
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
14033
14411
|
if (isRoot) {
|
|
14034
|
-
const relativePath2 = (0,
|
|
14035
|
-
const fileContent2 = await readFileContent((0,
|
|
14412
|
+
const relativePath2 = (0, import_node_path105.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
14413
|
+
const fileContent2 = await readFileContent((0, import_node_path105.join)(baseDir, relativePath2));
|
|
14036
14414
|
return new _FactorydroidRule({
|
|
14037
14415
|
baseDir,
|
|
14038
14416
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -14045,8 +14423,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14045
14423
|
if (!paths.nonRoot) {
|
|
14046
14424
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14047
14425
|
}
|
|
14048
|
-
const relativePath = (0,
|
|
14049
|
-
const fileContent = await readFileContent((0,
|
|
14426
|
+
const relativePath = (0, import_node_path105.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14427
|
+
const fileContent = await readFileContent((0, import_node_path105.join)(baseDir, relativePath));
|
|
14050
14428
|
return new _FactorydroidRule({
|
|
14051
14429
|
baseDir,
|
|
14052
14430
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14105,7 +14483,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14105
14483
|
};
|
|
14106
14484
|
|
|
14107
14485
|
// src/features/rules/geminicli-rule.ts
|
|
14108
|
-
var
|
|
14486
|
+
var import_node_path106 = require("path");
|
|
14109
14487
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
14110
14488
|
static getSettablePaths({
|
|
14111
14489
|
global,
|
|
@@ -14140,7 +14518,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14140
14518
|
if (isRoot) {
|
|
14141
14519
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14142
14520
|
const fileContent2 = await readFileContent(
|
|
14143
|
-
(0,
|
|
14521
|
+
(0, import_node_path106.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14144
14522
|
);
|
|
14145
14523
|
return new _GeminiCliRule({
|
|
14146
14524
|
baseDir,
|
|
@@ -14154,8 +14532,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14154
14532
|
if (!paths.nonRoot) {
|
|
14155
14533
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14156
14534
|
}
|
|
14157
|
-
const relativePath = (0,
|
|
14158
|
-
const fileContent = await readFileContent((0,
|
|
14535
|
+
const relativePath = (0, import_node_path106.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14536
|
+
const fileContent = await readFileContent((0, import_node_path106.join)(baseDir, relativePath));
|
|
14159
14537
|
return new _GeminiCliRule({
|
|
14160
14538
|
baseDir,
|
|
14161
14539
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14214,7 +14592,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14214
14592
|
};
|
|
14215
14593
|
|
|
14216
14594
|
// src/features/rules/goose-rule.ts
|
|
14217
|
-
var
|
|
14595
|
+
var import_node_path107 = require("path");
|
|
14218
14596
|
var GooseRule = class _GooseRule extends ToolRule {
|
|
14219
14597
|
static getSettablePaths({
|
|
14220
14598
|
global,
|
|
@@ -14249,7 +14627,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
14249
14627
|
if (isRoot) {
|
|
14250
14628
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14251
14629
|
const fileContent2 = await readFileContent(
|
|
14252
|
-
(0,
|
|
14630
|
+
(0, import_node_path107.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14253
14631
|
);
|
|
14254
14632
|
return new _GooseRule({
|
|
14255
14633
|
baseDir,
|
|
@@ -14263,8 +14641,8 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
14263
14641
|
if (!paths.nonRoot) {
|
|
14264
14642
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14265
14643
|
}
|
|
14266
|
-
const relativePath = (0,
|
|
14267
|
-
const fileContent = await readFileContent((0,
|
|
14644
|
+
const relativePath = (0, import_node_path107.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14645
|
+
const fileContent = await readFileContent((0, import_node_path107.join)(baseDir, relativePath));
|
|
14268
14646
|
return new _GooseRule({
|
|
14269
14647
|
baseDir,
|
|
14270
14648
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14323,7 +14701,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
14323
14701
|
};
|
|
14324
14702
|
|
|
14325
14703
|
// src/features/rules/junie-rule.ts
|
|
14326
|
-
var
|
|
14704
|
+
var import_node_path108 = require("path");
|
|
14327
14705
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
14328
14706
|
static getSettablePaths(_options = {}) {
|
|
14329
14707
|
return {
|
|
@@ -14342,8 +14720,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
14342
14720
|
validate = true
|
|
14343
14721
|
}) {
|
|
14344
14722
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
14345
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
14346
|
-
const fileContent = await readFileContent((0,
|
|
14723
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path108.join)(".junie", "memories", relativeFilePath);
|
|
14724
|
+
const fileContent = await readFileContent((0, import_node_path108.join)(baseDir, relativePath));
|
|
14347
14725
|
return new _JunieRule({
|
|
14348
14726
|
baseDir,
|
|
14349
14727
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -14398,7 +14776,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
14398
14776
|
};
|
|
14399
14777
|
|
|
14400
14778
|
// src/features/rules/kilo-rule.ts
|
|
14401
|
-
var
|
|
14779
|
+
var import_node_path109 = require("path");
|
|
14402
14780
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
14403
14781
|
static getSettablePaths(_options = {}) {
|
|
14404
14782
|
return {
|
|
@@ -14413,7 +14791,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
14413
14791
|
validate = true
|
|
14414
14792
|
}) {
|
|
14415
14793
|
const fileContent = await readFileContent(
|
|
14416
|
-
(0,
|
|
14794
|
+
(0, import_node_path109.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14417
14795
|
);
|
|
14418
14796
|
return new _KiloRule({
|
|
14419
14797
|
baseDir,
|
|
@@ -14465,7 +14843,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
14465
14843
|
};
|
|
14466
14844
|
|
|
14467
14845
|
// src/features/rules/kiro-rule.ts
|
|
14468
|
-
var
|
|
14846
|
+
var import_node_path110 = require("path");
|
|
14469
14847
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
14470
14848
|
static getSettablePaths(_options = {}) {
|
|
14471
14849
|
return {
|
|
@@ -14480,7 +14858,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
14480
14858
|
validate = true
|
|
14481
14859
|
}) {
|
|
14482
14860
|
const fileContent = await readFileContent(
|
|
14483
|
-
(0,
|
|
14861
|
+
(0, import_node_path110.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14484
14862
|
);
|
|
14485
14863
|
return new _KiroRule({
|
|
14486
14864
|
baseDir,
|
|
@@ -14534,7 +14912,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
14534
14912
|
};
|
|
14535
14913
|
|
|
14536
14914
|
// src/features/rules/opencode-rule.ts
|
|
14537
|
-
var
|
|
14915
|
+
var import_node_path111 = require("path");
|
|
14538
14916
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
14539
14917
|
static getSettablePaths({
|
|
14540
14918
|
global,
|
|
@@ -14569,7 +14947,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
14569
14947
|
if (isRoot) {
|
|
14570
14948
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14571
14949
|
const fileContent2 = await readFileContent(
|
|
14572
|
-
(0,
|
|
14950
|
+
(0, import_node_path111.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14573
14951
|
);
|
|
14574
14952
|
return new _OpenCodeRule({
|
|
14575
14953
|
baseDir,
|
|
@@ -14583,8 +14961,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
14583
14961
|
if (!paths.nonRoot) {
|
|
14584
14962
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14585
14963
|
}
|
|
14586
|
-
const relativePath = (0,
|
|
14587
|
-
const fileContent = await readFileContent((0,
|
|
14964
|
+
const relativePath = (0, import_node_path111.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14965
|
+
const fileContent = await readFileContent((0, import_node_path111.join)(baseDir, relativePath));
|
|
14588
14966
|
return new _OpenCodeRule({
|
|
14589
14967
|
baseDir,
|
|
14590
14968
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14643,7 +15021,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
14643
15021
|
};
|
|
14644
15022
|
|
|
14645
15023
|
// src/features/rules/qwencode-rule.ts
|
|
14646
|
-
var
|
|
15024
|
+
var import_node_path112 = require("path");
|
|
14647
15025
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
14648
15026
|
static getSettablePaths(_options = {}) {
|
|
14649
15027
|
return {
|
|
@@ -14662,8 +15040,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
14662
15040
|
validate = true
|
|
14663
15041
|
}) {
|
|
14664
15042
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
14665
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
14666
|
-
const fileContent = await readFileContent((0,
|
|
15043
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path112.join)(".qwen", "memories", relativeFilePath);
|
|
15044
|
+
const fileContent = await readFileContent((0, import_node_path112.join)(baseDir, relativePath));
|
|
14667
15045
|
return new _QwencodeRule({
|
|
14668
15046
|
baseDir,
|
|
14669
15047
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -14715,7 +15093,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
14715
15093
|
};
|
|
14716
15094
|
|
|
14717
15095
|
// src/features/rules/replit-rule.ts
|
|
14718
|
-
var
|
|
15096
|
+
var import_node_path113 = require("path");
|
|
14719
15097
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
14720
15098
|
static getSettablePaths(_options = {}) {
|
|
14721
15099
|
return {
|
|
@@ -14737,7 +15115,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
14737
15115
|
}
|
|
14738
15116
|
const relativePath = paths.root.relativeFilePath;
|
|
14739
15117
|
const fileContent = await readFileContent(
|
|
14740
|
-
(0,
|
|
15118
|
+
(0, import_node_path113.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
14741
15119
|
);
|
|
14742
15120
|
return new _ReplitRule({
|
|
14743
15121
|
baseDir,
|
|
@@ -14803,7 +15181,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
14803
15181
|
};
|
|
14804
15182
|
|
|
14805
15183
|
// src/features/rules/roo-rule.ts
|
|
14806
|
-
var
|
|
15184
|
+
var import_node_path114 = require("path");
|
|
14807
15185
|
var RooRule = class _RooRule extends ToolRule {
|
|
14808
15186
|
static getSettablePaths(_options = {}) {
|
|
14809
15187
|
return {
|
|
@@ -14818,7 +15196,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
14818
15196
|
validate = true
|
|
14819
15197
|
}) {
|
|
14820
15198
|
const fileContent = await readFileContent(
|
|
14821
|
-
(0,
|
|
15199
|
+
(0, import_node_path114.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14822
15200
|
);
|
|
14823
15201
|
return new _RooRule({
|
|
14824
15202
|
baseDir,
|
|
@@ -14887,7 +15265,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
14887
15265
|
};
|
|
14888
15266
|
|
|
14889
15267
|
// src/features/rules/warp-rule.ts
|
|
14890
|
-
var
|
|
15268
|
+
var import_node_path115 = require("path");
|
|
14891
15269
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
14892
15270
|
constructor({ fileContent, root, ...rest }) {
|
|
14893
15271
|
super({
|
|
@@ -14913,8 +15291,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
14913
15291
|
validate = true
|
|
14914
15292
|
}) {
|
|
14915
15293
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
14916
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
14917
|
-
const fileContent = await readFileContent((0,
|
|
15294
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path115.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
15295
|
+
const fileContent = await readFileContent((0, import_node_path115.join)(baseDir, relativePath));
|
|
14918
15296
|
return new _WarpRule({
|
|
14919
15297
|
baseDir,
|
|
14920
15298
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -14969,7 +15347,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
14969
15347
|
};
|
|
14970
15348
|
|
|
14971
15349
|
// src/features/rules/windsurf-rule.ts
|
|
14972
|
-
var
|
|
15350
|
+
var import_node_path116 = require("path");
|
|
14973
15351
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
14974
15352
|
static getSettablePaths(_options = {}) {
|
|
14975
15353
|
return {
|
|
@@ -14984,7 +15362,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
14984
15362
|
validate = true
|
|
14985
15363
|
}) {
|
|
14986
15364
|
const fileContent = await readFileContent(
|
|
14987
|
-
(0,
|
|
15365
|
+
(0, import_node_path116.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14988
15366
|
);
|
|
14989
15367
|
return new _WindsurfRule({
|
|
14990
15368
|
baseDir,
|
|
@@ -15060,8 +15438,8 @@ var rulesProcessorToolTargets = [
|
|
|
15060
15438
|
"warp",
|
|
15061
15439
|
"windsurf"
|
|
15062
15440
|
];
|
|
15063
|
-
var RulesProcessorToolTargetSchema =
|
|
15064
|
-
var formatRulePaths = (rules) => rules.map((r) => (0,
|
|
15441
|
+
var RulesProcessorToolTargetSchema = import_mini56.z.enum(rulesProcessorToolTargets);
|
|
15442
|
+
var formatRulePaths = (rules) => rules.map((r) => (0, import_node_path117.join)(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
15065
15443
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
15066
15444
|
[
|
|
15067
15445
|
"agentsmd",
|
|
@@ -15436,7 +15814,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15436
15814
|
}).relativeDirPath;
|
|
15437
15815
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
15438
15816
|
const frontmatter = skill.getFrontmatter();
|
|
15439
|
-
const relativePath = (0,
|
|
15817
|
+
const relativePath = (0, import_node_path117.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
15440
15818
|
return {
|
|
15441
15819
|
name: frontmatter.name,
|
|
15442
15820
|
description: frontmatter.description,
|
|
@@ -15549,12 +15927,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15549
15927
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
15550
15928
|
*/
|
|
15551
15929
|
async loadRulesyncFiles() {
|
|
15552
|
-
const rulesyncBaseDir = (0,
|
|
15553
|
-
const files = await findFilesByGlobs((0,
|
|
15930
|
+
const rulesyncBaseDir = (0, import_node_path117.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
15931
|
+
const files = await findFilesByGlobs((0, import_node_path117.join)(rulesyncBaseDir, "**", "*.md"));
|
|
15554
15932
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
15555
15933
|
const rulesyncRules = await Promise.all(
|
|
15556
15934
|
files.map((file) => {
|
|
15557
|
-
const relativeFilePath = (0,
|
|
15935
|
+
const relativeFilePath = (0, import_node_path117.relative)(rulesyncBaseDir, file);
|
|
15558
15936
|
checkPathTraversal({
|
|
15559
15937
|
relativePath: relativeFilePath,
|
|
15560
15938
|
intendedRootDir: rulesyncBaseDir
|
|
@@ -15564,41 +15942,57 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15564
15942
|
});
|
|
15565
15943
|
})
|
|
15566
15944
|
);
|
|
15945
|
+
const factory = this.getFactory(this.toolTarget);
|
|
15567
15946
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
15568
|
-
|
|
15569
|
-
|
|
15947
|
+
const targetedRootRules = rootRules.filter(
|
|
15948
|
+
(rule) => factory.class.isTargetedByRulesyncRule(rule)
|
|
15949
|
+
);
|
|
15950
|
+
if (targetedRootRules.length > 1) {
|
|
15951
|
+
throw new Error(
|
|
15952
|
+
`Multiple root rulesync rules found for target '${this.toolTarget}': ${formatRulePaths(targetedRootRules)}`
|
|
15953
|
+
);
|
|
15570
15954
|
}
|
|
15571
|
-
if (
|
|
15955
|
+
if (targetedRootRules.length === 0 && rulesyncRules.length > 0) {
|
|
15572
15956
|
logger.warn(
|
|
15573
|
-
`No root rulesync rule file found. Consider adding 'root: true' to one of your rule files in ${RULESYNC_RULES_RELATIVE_DIR_PATH}.`
|
|
15957
|
+
`No root rulesync rule file found for target '${this.toolTarget}'. Consider adding 'root: true' to one of your rule files in ${RULESYNC_RULES_RELATIVE_DIR_PATH}.`
|
|
15574
15958
|
);
|
|
15575
15959
|
}
|
|
15576
15960
|
const localRootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().localRoot);
|
|
15577
|
-
|
|
15961
|
+
const targetedLocalRootRules = localRootRules.filter(
|
|
15962
|
+
(rule) => factory.class.isTargetedByRulesyncRule(rule)
|
|
15963
|
+
);
|
|
15964
|
+
if (targetedLocalRootRules.length > 1) {
|
|
15578
15965
|
throw new Error(
|
|
15579
|
-
`Multiple localRoot rules found: ${formatRulePaths(
|
|
15966
|
+
`Multiple localRoot rules found for target '${this.toolTarget}': ${formatRulePaths(targetedLocalRootRules)}. Only one rule can have localRoot: true`
|
|
15580
15967
|
);
|
|
15581
15968
|
}
|
|
15582
|
-
if (
|
|
15969
|
+
if (targetedLocalRootRules.length > 0 && targetedRootRules.length === 0) {
|
|
15583
15970
|
throw new Error(
|
|
15584
|
-
`localRoot: true requires a root: true rule to exist (found in ${formatRulePaths(
|
|
15971
|
+
`localRoot: true requires a root: true rule to exist for target '${this.toolTarget}' (found in ${formatRulePaths(targetedLocalRootRules)})`
|
|
15585
15972
|
);
|
|
15586
15973
|
}
|
|
15587
15974
|
if (this.global) {
|
|
15588
|
-
const
|
|
15589
|
-
|
|
15975
|
+
const globalPaths = factory.class.getSettablePaths({ global: true });
|
|
15976
|
+
const supportsGlobalNonRoot = "nonRoot" in globalPaths && globalPaths.nonRoot !== null;
|
|
15977
|
+
const nonRootRules2 = rulesyncRules.filter(
|
|
15978
|
+
(rule) => !rule.getFrontmatter().root && !rule.getFrontmatter().localRoot && factory.class.isTargetedByRulesyncRule(rule)
|
|
15979
|
+
);
|
|
15980
|
+
if (nonRootRules2.length > 0 && !supportsGlobalNonRoot) {
|
|
15590
15981
|
logger.warn(
|
|
15591
|
-
`${
|
|
15982
|
+
`${nonRootRules2.length} non-root rulesync rules found, but it's in global mode, so ignoring them: ${formatRulePaths(nonRootRules2)}`
|
|
15592
15983
|
);
|
|
15593
15984
|
}
|
|
15594
|
-
if (
|
|
15985
|
+
if (targetedLocalRootRules.length > 0) {
|
|
15595
15986
|
logger.warn(
|
|
15596
|
-
`${
|
|
15987
|
+
`${targetedLocalRootRules.length} localRoot rules found, but localRoot is not supported in global mode, ignoring them: ${formatRulePaths(targetedLocalRootRules)}`
|
|
15597
15988
|
);
|
|
15598
15989
|
}
|
|
15599
|
-
return
|
|
15990
|
+
return supportsGlobalNonRoot ? [...targetedRootRules, ...nonRootRules2] : targetedRootRules;
|
|
15600
15991
|
}
|
|
15601
|
-
|
|
15992
|
+
const nonRootRules = rulesyncRules.filter(
|
|
15993
|
+
(rule) => !rule.getFrontmatter().root && factory.class.isTargetedByRulesyncRule(rule)
|
|
15994
|
+
);
|
|
15995
|
+
return [...targetedRootRules, ...nonRootRules];
|
|
15602
15996
|
}
|
|
15603
15997
|
/**
|
|
15604
15998
|
* Implementation of abstract method from FeatureProcessor
|
|
@@ -15613,7 +16007,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15613
16007
|
global: this.global
|
|
15614
16008
|
});
|
|
15615
16009
|
const resolveRelativeDirPath = (filePath) => {
|
|
15616
|
-
const dirName = (0,
|
|
16010
|
+
const dirName = (0, import_node_path117.dirname)((0, import_node_path117.relative)(this.baseDir, filePath));
|
|
15617
16011
|
return dirName === "" ? "." : dirName;
|
|
15618
16012
|
};
|
|
15619
16013
|
const findFilesWithFallback = async (primaryGlob, alternativeRoots, buildAltGlob) => {
|
|
@@ -15631,13 +16025,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15631
16025
|
return [];
|
|
15632
16026
|
}
|
|
15633
16027
|
const uniqueRootFilePaths = await findFilesWithFallback(
|
|
15634
|
-
(0,
|
|
16028
|
+
(0, import_node_path117.join)(
|
|
15635
16029
|
this.baseDir,
|
|
15636
16030
|
settablePaths.root.relativeDirPath ?? ".",
|
|
15637
16031
|
settablePaths.root.relativeFilePath
|
|
15638
16032
|
),
|
|
15639
16033
|
settablePaths.alternativeRoots,
|
|
15640
|
-
(alt) => (0,
|
|
16034
|
+
(alt) => (0, import_node_path117.join)(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
|
|
15641
16035
|
);
|
|
15642
16036
|
if (forDeletion) {
|
|
15643
16037
|
return uniqueRootFilePaths.map((filePath) => {
|
|
@@ -15649,7 +16043,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15649
16043
|
return factory.class.forDeletion({
|
|
15650
16044
|
baseDir: this.baseDir,
|
|
15651
16045
|
relativeDirPath,
|
|
15652
|
-
relativeFilePath: (0,
|
|
16046
|
+
relativeFilePath: (0, import_node_path117.basename)(filePath),
|
|
15653
16047
|
global: this.global
|
|
15654
16048
|
});
|
|
15655
16049
|
}).filter((rule) => rule.isDeletable());
|
|
@@ -15663,7 +16057,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15663
16057
|
});
|
|
15664
16058
|
return factory.class.fromFile({
|
|
15665
16059
|
baseDir: this.baseDir,
|
|
15666
|
-
relativeFilePath: (0,
|
|
16060
|
+
relativeFilePath: (0, import_node_path117.basename)(filePath),
|
|
15667
16061
|
relativeDirPath,
|
|
15668
16062
|
global: this.global
|
|
15669
16063
|
});
|
|
@@ -15682,9 +16076,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15682
16076
|
return [];
|
|
15683
16077
|
}
|
|
15684
16078
|
const uniqueLocalRootFilePaths = await findFilesWithFallback(
|
|
15685
|
-
(0,
|
|
16079
|
+
(0, import_node_path117.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
|
|
15686
16080
|
settablePaths.alternativeRoots,
|
|
15687
|
-
(alt) => (0,
|
|
16081
|
+
(alt) => (0, import_node_path117.join)(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
|
|
15688
16082
|
);
|
|
15689
16083
|
return uniqueLocalRootFilePaths.map((filePath) => {
|
|
15690
16084
|
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
@@ -15695,7 +16089,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15695
16089
|
return factory.class.forDeletion({
|
|
15696
16090
|
baseDir: this.baseDir,
|
|
15697
16091
|
relativeDirPath,
|
|
15698
|
-
relativeFilePath: (0,
|
|
16092
|
+
relativeFilePath: (0, import_node_path117.basename)(filePath),
|
|
15699
16093
|
global: this.global
|
|
15700
16094
|
});
|
|
15701
16095
|
}).filter((rule) => rule.isDeletable());
|
|
@@ -15705,13 +16099,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15705
16099
|
if (!settablePaths.nonRoot) {
|
|
15706
16100
|
return [];
|
|
15707
16101
|
}
|
|
15708
|
-
const nonRootBaseDir = (0,
|
|
16102
|
+
const nonRootBaseDir = (0, import_node_path117.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
15709
16103
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
15710
|
-
(0,
|
|
16104
|
+
(0, import_node_path117.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
15711
16105
|
);
|
|
15712
16106
|
if (forDeletion) {
|
|
15713
16107
|
return nonRootFilePaths.map((filePath) => {
|
|
15714
|
-
const relativeFilePath = (0,
|
|
16108
|
+
const relativeFilePath = (0, import_node_path117.relative)(nonRootBaseDir, filePath);
|
|
15715
16109
|
checkPathTraversal({
|
|
15716
16110
|
relativePath: relativeFilePath,
|
|
15717
16111
|
intendedRootDir: nonRootBaseDir
|
|
@@ -15726,7 +16120,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15726
16120
|
}
|
|
15727
16121
|
return await Promise.all(
|
|
15728
16122
|
nonRootFilePaths.map((filePath) => {
|
|
15729
|
-
const relativeFilePath = (0,
|
|
16123
|
+
const relativeFilePath = (0, import_node_path117.relative)(nonRootBaseDir, filePath);
|
|
15730
16124
|
checkPathTraversal({
|
|
15731
16125
|
relativePath: relativeFilePath,
|
|
15732
16126
|
intendedRootDir: nonRootBaseDir
|
|
@@ -15839,14 +16233,14 @@ s/<command> [arguments]
|
|
|
15839
16233
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
15840
16234
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
15841
16235
|
|
|
15842
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
16236
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path117.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
15843
16237
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
15844
16238
|
|
|
15845
16239
|
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.
|
|
15846
16240
|
|
|
15847
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
16241
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path117.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
15848
16242
|
|
|
15849
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
16243
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path117.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
15850
16244
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
15851
16245
|
const result = [
|
|
15852
16246
|
overview,
|
|
@@ -15926,7 +16320,7 @@ function warnUnsupportedTargets(params) {
|
|
|
15926
16320
|
}
|
|
15927
16321
|
}
|
|
15928
16322
|
async function checkRulesyncDirExists(params) {
|
|
15929
|
-
return fileExists((0,
|
|
16323
|
+
return fileExists((0, import_node_path118.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
15930
16324
|
}
|
|
15931
16325
|
async function generate(params) {
|
|
15932
16326
|
const { config } = params;
|