rulesync 3.27.1 → 3.28.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 +1 -0
- package/dist/index.cjs +723 -507
- package/dist/index.js +716 -500
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -226,6 +226,7 @@ import { z as z2 } from "zod/mini";
|
|
|
226
226
|
var ALL_TOOL_TARGETS = [
|
|
227
227
|
"agentsmd",
|
|
228
228
|
"amazonqcli",
|
|
229
|
+
"antigravity",
|
|
229
230
|
"augmentcode",
|
|
230
231
|
"augmentcode-legacy",
|
|
231
232
|
"copilot",
|
|
@@ -483,8 +484,8 @@ var RULESYNC_OVERVIEW_FILE_NAME = "overview.md";
|
|
|
483
484
|
var RULESYNC_SKILLS_RELATIVE_DIR_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "skills");
|
|
484
485
|
|
|
485
486
|
// src/features/commands/commands-processor.ts
|
|
486
|
-
import { basename as
|
|
487
|
-
import { z as
|
|
487
|
+
import { basename as basename12, join as join13 } from "path";
|
|
488
|
+
import { z as z11 } from "zod/mini";
|
|
488
489
|
|
|
489
490
|
// src/types/feature-processor.ts
|
|
490
491
|
var FeatureProcessor = class {
|
|
@@ -856,7 +857,7 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
856
857
|
}
|
|
857
858
|
};
|
|
858
859
|
|
|
859
|
-
// src/features/commands/
|
|
860
|
+
// src/features/commands/antigravity-command.ts
|
|
860
861
|
import { basename as basename5, join as join6 } from "path";
|
|
861
862
|
import { z as z6 } from "zod/mini";
|
|
862
863
|
|
|
@@ -951,10 +952,134 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
951
952
|
}
|
|
952
953
|
};
|
|
953
954
|
|
|
954
|
-
// src/features/commands/
|
|
955
|
-
var
|
|
955
|
+
// src/features/commands/antigravity-command.ts
|
|
956
|
+
var AntigravityCommandFrontmatterSchema = z6.object({
|
|
956
957
|
description: z6.string()
|
|
957
958
|
});
|
|
959
|
+
var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
960
|
+
frontmatter;
|
|
961
|
+
body;
|
|
962
|
+
static getSettablePaths() {
|
|
963
|
+
return {
|
|
964
|
+
relativeDirPath: join6(".agent", "workflows")
|
|
965
|
+
};
|
|
966
|
+
}
|
|
967
|
+
constructor({ frontmatter, body, ...rest }) {
|
|
968
|
+
if (rest.validate) {
|
|
969
|
+
const result = AntigravityCommandFrontmatterSchema.safeParse(frontmatter);
|
|
970
|
+
if (!result.success) {
|
|
971
|
+
throw new Error(
|
|
972
|
+
`Invalid frontmatter in ${join6(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
973
|
+
);
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
super({
|
|
977
|
+
...rest,
|
|
978
|
+
fileContent: stringifyFrontmatter(body, frontmatter)
|
|
979
|
+
});
|
|
980
|
+
this.frontmatter = frontmatter;
|
|
981
|
+
this.body = body;
|
|
982
|
+
}
|
|
983
|
+
getBody() {
|
|
984
|
+
return this.body;
|
|
985
|
+
}
|
|
986
|
+
getFrontmatter() {
|
|
987
|
+
return this.frontmatter;
|
|
988
|
+
}
|
|
989
|
+
toRulesyncCommand() {
|
|
990
|
+
const rulesyncFrontmatter = {
|
|
991
|
+
targets: ["antigravity"],
|
|
992
|
+
description: this.frontmatter.description
|
|
993
|
+
};
|
|
994
|
+
const fileContent = stringifyFrontmatter(this.body, rulesyncFrontmatter);
|
|
995
|
+
return new RulesyncCommand({
|
|
996
|
+
baseDir: ".",
|
|
997
|
+
// RulesyncCommand baseDir is always the project root directory
|
|
998
|
+
frontmatter: rulesyncFrontmatter,
|
|
999
|
+
body: this.body,
|
|
1000
|
+
relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
1001
|
+
relativeFilePath: this.relativeFilePath,
|
|
1002
|
+
fileContent,
|
|
1003
|
+
validate: true
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
static fromRulesyncCommand({
|
|
1007
|
+
baseDir = process.cwd(),
|
|
1008
|
+
rulesyncCommand,
|
|
1009
|
+
validate = true
|
|
1010
|
+
}) {
|
|
1011
|
+
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
1012
|
+
const antigravityFrontmatter = {
|
|
1013
|
+
description: rulesyncFrontmatter.description
|
|
1014
|
+
};
|
|
1015
|
+
const body = rulesyncCommand.getBody();
|
|
1016
|
+
const fileContent = stringifyFrontmatter(body, antigravityFrontmatter);
|
|
1017
|
+
return new _AntigravityCommand({
|
|
1018
|
+
baseDir,
|
|
1019
|
+
frontmatter: antigravityFrontmatter,
|
|
1020
|
+
body,
|
|
1021
|
+
relativeDirPath: _AntigravityCommand.getSettablePaths().relativeDirPath,
|
|
1022
|
+
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
1023
|
+
fileContent,
|
|
1024
|
+
validate
|
|
1025
|
+
});
|
|
1026
|
+
}
|
|
1027
|
+
validate() {
|
|
1028
|
+
if (!this.frontmatter) {
|
|
1029
|
+
return { success: true, error: null };
|
|
1030
|
+
}
|
|
1031
|
+
const result = AntigravityCommandFrontmatterSchema.safeParse(this.frontmatter);
|
|
1032
|
+
if (result.success) {
|
|
1033
|
+
return { success: true, error: null };
|
|
1034
|
+
} else {
|
|
1035
|
+
return {
|
|
1036
|
+
success: false,
|
|
1037
|
+
error: new Error(
|
|
1038
|
+
`Invalid frontmatter in ${join6(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1039
|
+
)
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
1044
|
+
return this.isTargetedByRulesyncCommandDefault({
|
|
1045
|
+
rulesyncCommand,
|
|
1046
|
+
toolTarget: "antigravity"
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
static async fromFile({
|
|
1050
|
+
baseDir = process.cwd(),
|
|
1051
|
+
relativeFilePath,
|
|
1052
|
+
validate = true
|
|
1053
|
+
}) {
|
|
1054
|
+
const filePath = join6(
|
|
1055
|
+
baseDir,
|
|
1056
|
+
_AntigravityCommand.getSettablePaths().relativeDirPath,
|
|
1057
|
+
relativeFilePath
|
|
1058
|
+
);
|
|
1059
|
+
const fileContent = await readFileContent(filePath);
|
|
1060
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1061
|
+
const result = AntigravityCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1062
|
+
if (!result.success) {
|
|
1063
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
1064
|
+
}
|
|
1065
|
+
return new _AntigravityCommand({
|
|
1066
|
+
baseDir,
|
|
1067
|
+
relativeDirPath: _AntigravityCommand.getSettablePaths().relativeDirPath,
|
|
1068
|
+
relativeFilePath: basename5(relativeFilePath),
|
|
1069
|
+
frontmatter: result.data,
|
|
1070
|
+
body: content.trim(),
|
|
1071
|
+
fileContent,
|
|
1072
|
+
validate
|
|
1073
|
+
});
|
|
1074
|
+
}
|
|
1075
|
+
};
|
|
1076
|
+
|
|
1077
|
+
// src/features/commands/claudecode-command.ts
|
|
1078
|
+
import { basename as basename6, join as join7 } from "path";
|
|
1079
|
+
import { z as z7 } from "zod/mini";
|
|
1080
|
+
var ClaudecodeCommandFrontmatterSchema = z7.object({
|
|
1081
|
+
description: z7.string()
|
|
1082
|
+
});
|
|
958
1083
|
var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
959
1084
|
frontmatter;
|
|
960
1085
|
body;
|
|
@@ -963,7 +1088,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
963
1088
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
964
1089
|
if (!result.success) {
|
|
965
1090
|
throw new Error(
|
|
966
|
-
`Invalid frontmatter in ${
|
|
1091
|
+
`Invalid frontmatter in ${join7(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
967
1092
|
);
|
|
968
1093
|
}
|
|
969
1094
|
}
|
|
@@ -976,7 +1101,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
976
1101
|
}
|
|
977
1102
|
static getSettablePaths(_options = {}) {
|
|
978
1103
|
return {
|
|
979
|
-
relativeDirPath:
|
|
1104
|
+
relativeDirPath: join7(".claude", "commands")
|
|
980
1105
|
};
|
|
981
1106
|
}
|
|
982
1107
|
getBody() {
|
|
@@ -1034,7 +1159,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1034
1159
|
return {
|
|
1035
1160
|
success: false,
|
|
1036
1161
|
error: new Error(
|
|
1037
|
-
`Invalid frontmatter in ${
|
|
1162
|
+
`Invalid frontmatter in ${join7(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1038
1163
|
)
|
|
1039
1164
|
};
|
|
1040
1165
|
}
|
|
@@ -1052,7 +1177,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1052
1177
|
global = false
|
|
1053
1178
|
}) {
|
|
1054
1179
|
const paths = this.getSettablePaths({ global });
|
|
1055
|
-
const filePath =
|
|
1180
|
+
const filePath = join7(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1056
1181
|
const fileContent = await readFileContent(filePath);
|
|
1057
1182
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1058
1183
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1062,7 +1187,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1062
1187
|
return new _ClaudecodeCommand({
|
|
1063
1188
|
baseDir,
|
|
1064
1189
|
relativeDirPath: paths.relativeDirPath,
|
|
1065
|
-
relativeFilePath:
|
|
1190
|
+
relativeFilePath: basename6(relativeFilePath),
|
|
1066
1191
|
frontmatter: result.data,
|
|
1067
1192
|
body: content.trim(),
|
|
1068
1193
|
validate
|
|
@@ -1071,14 +1196,14 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1071
1196
|
};
|
|
1072
1197
|
|
|
1073
1198
|
// src/features/commands/codexcli-command.ts
|
|
1074
|
-
import { basename as
|
|
1199
|
+
import { basename as basename7, join as join8 } from "path";
|
|
1075
1200
|
var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
1076
1201
|
static getSettablePaths({ global } = {}) {
|
|
1077
1202
|
if (!global) {
|
|
1078
1203
|
throw new Error("CodexcliCommand only supports global mode. Please pass { global: true }.");
|
|
1079
1204
|
}
|
|
1080
1205
|
return {
|
|
1081
|
-
relativeDirPath:
|
|
1206
|
+
relativeDirPath: join8(".codex", "prompts")
|
|
1082
1207
|
};
|
|
1083
1208
|
}
|
|
1084
1209
|
toRulesyncCommand() {
|
|
@@ -1131,13 +1256,13 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1131
1256
|
global = false
|
|
1132
1257
|
}) {
|
|
1133
1258
|
const paths = this.getSettablePaths({ global });
|
|
1134
|
-
const filePath =
|
|
1259
|
+
const filePath = join8(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1135
1260
|
const fileContent = await readFileContent(filePath);
|
|
1136
1261
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1137
1262
|
return new _CodexcliCommand({
|
|
1138
1263
|
baseDir,
|
|
1139
1264
|
relativeDirPath: paths.relativeDirPath,
|
|
1140
|
-
relativeFilePath:
|
|
1265
|
+
relativeFilePath: basename7(relativeFilePath),
|
|
1141
1266
|
fileContent: content.trim(),
|
|
1142
1267
|
validate
|
|
1143
1268
|
});
|
|
@@ -1145,11 +1270,11 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1145
1270
|
};
|
|
1146
1271
|
|
|
1147
1272
|
// src/features/commands/copilot-command.ts
|
|
1148
|
-
import { basename as
|
|
1149
|
-
import { z as
|
|
1150
|
-
var CopilotCommandFrontmatterSchema =
|
|
1151
|
-
mode:
|
|
1152
|
-
description:
|
|
1273
|
+
import { basename as basename8, join as join9 } from "path";
|
|
1274
|
+
import { z as z8 } from "zod/mini";
|
|
1275
|
+
var CopilotCommandFrontmatterSchema = z8.object({
|
|
1276
|
+
mode: z8.literal("agent"),
|
|
1277
|
+
description: z8.string()
|
|
1153
1278
|
});
|
|
1154
1279
|
var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
1155
1280
|
frontmatter;
|
|
@@ -1159,7 +1284,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1159
1284
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1160
1285
|
if (!result.success) {
|
|
1161
1286
|
throw new Error(
|
|
1162
|
-
`Invalid frontmatter in ${
|
|
1287
|
+
`Invalid frontmatter in ${join9(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1163
1288
|
);
|
|
1164
1289
|
}
|
|
1165
1290
|
}
|
|
@@ -1172,7 +1297,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1172
1297
|
}
|
|
1173
1298
|
static getSettablePaths() {
|
|
1174
1299
|
return {
|
|
1175
|
-
relativeDirPath:
|
|
1300
|
+
relativeDirPath: join9(".github", "prompts")
|
|
1176
1301
|
};
|
|
1177
1302
|
}
|
|
1178
1303
|
getBody() {
|
|
@@ -1209,7 +1334,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1209
1334
|
return {
|
|
1210
1335
|
success: false,
|
|
1211
1336
|
error: new Error(
|
|
1212
|
-
`Invalid frontmatter in ${
|
|
1337
|
+
`Invalid frontmatter in ${join9(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1213
1338
|
)
|
|
1214
1339
|
};
|
|
1215
1340
|
}
|
|
@@ -1243,7 +1368,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1243
1368
|
validate = true
|
|
1244
1369
|
}) {
|
|
1245
1370
|
const paths = this.getSettablePaths();
|
|
1246
|
-
const filePath =
|
|
1371
|
+
const filePath = join9(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1247
1372
|
const fileContent = await readFileContent(filePath);
|
|
1248
1373
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1249
1374
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1253,7 +1378,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1253
1378
|
return new _CopilotCommand({
|
|
1254
1379
|
baseDir,
|
|
1255
1380
|
relativeDirPath: paths.relativeDirPath,
|
|
1256
|
-
relativeFilePath:
|
|
1381
|
+
relativeFilePath: basename8(relativeFilePath),
|
|
1257
1382
|
frontmatter: result.data,
|
|
1258
1383
|
body: content.trim(),
|
|
1259
1384
|
validate
|
|
@@ -1268,11 +1393,11 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1268
1393
|
};
|
|
1269
1394
|
|
|
1270
1395
|
// src/features/commands/cursor-command.ts
|
|
1271
|
-
import { basename as
|
|
1396
|
+
import { basename as basename9, join as join10 } from "path";
|
|
1272
1397
|
var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
1273
1398
|
static getSettablePaths(_options = {}) {
|
|
1274
1399
|
return {
|
|
1275
|
-
relativeDirPath:
|
|
1400
|
+
relativeDirPath: join10(".cursor", "commands")
|
|
1276
1401
|
};
|
|
1277
1402
|
}
|
|
1278
1403
|
toRulesyncCommand() {
|
|
@@ -1325,13 +1450,13 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1325
1450
|
global = false
|
|
1326
1451
|
}) {
|
|
1327
1452
|
const paths = this.getSettablePaths({ global });
|
|
1328
|
-
const filePath =
|
|
1453
|
+
const filePath = join10(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1329
1454
|
const fileContent = await readFileContent(filePath);
|
|
1330
1455
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1331
1456
|
return new _CursorCommand({
|
|
1332
1457
|
baseDir,
|
|
1333
1458
|
relativeDirPath: paths.relativeDirPath,
|
|
1334
|
-
relativeFilePath:
|
|
1459
|
+
relativeFilePath: basename9(relativeFilePath),
|
|
1335
1460
|
fileContent: content.trim(),
|
|
1336
1461
|
validate
|
|
1337
1462
|
});
|
|
@@ -1339,12 +1464,12 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1339
1464
|
};
|
|
1340
1465
|
|
|
1341
1466
|
// src/features/commands/geminicli-command.ts
|
|
1342
|
-
import { basename as
|
|
1467
|
+
import { basename as basename10, join as join11 } from "path";
|
|
1343
1468
|
import { parse as parseToml } from "smol-toml";
|
|
1344
|
-
import { z as
|
|
1345
|
-
var GeminiCliCommandFrontmatterSchema =
|
|
1346
|
-
description:
|
|
1347
|
-
prompt:
|
|
1469
|
+
import { z as z9 } from "zod/mini";
|
|
1470
|
+
var GeminiCliCommandFrontmatterSchema = z9.object({
|
|
1471
|
+
description: z9.optional(z9.string()),
|
|
1472
|
+
prompt: z9.string()
|
|
1348
1473
|
});
|
|
1349
1474
|
var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
1350
1475
|
frontmatter;
|
|
@@ -1357,7 +1482,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
1357
1482
|
}
|
|
1358
1483
|
static getSettablePaths(_options = {}) {
|
|
1359
1484
|
return {
|
|
1360
|
-
relativeDirPath:
|
|
1485
|
+
relativeDirPath: join11(".gemini", "commands")
|
|
1361
1486
|
};
|
|
1362
1487
|
}
|
|
1363
1488
|
parseTomlContent(content) {
|
|
@@ -1434,12 +1559,12 @@ ${geminiFrontmatter.prompt}
|
|
|
1434
1559
|
global = false
|
|
1435
1560
|
}) {
|
|
1436
1561
|
const paths = this.getSettablePaths({ global });
|
|
1437
|
-
const filePath =
|
|
1562
|
+
const filePath = join11(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1438
1563
|
const fileContent = await readFileContent(filePath);
|
|
1439
1564
|
return new _GeminiCliCommand({
|
|
1440
1565
|
baseDir,
|
|
1441
1566
|
relativeDirPath: paths.relativeDirPath,
|
|
1442
|
-
relativeFilePath:
|
|
1567
|
+
relativeFilePath: basename10(relativeFilePath),
|
|
1443
1568
|
fileContent,
|
|
1444
1569
|
validate
|
|
1445
1570
|
});
|
|
@@ -1461,18 +1586,18 @@ ${geminiFrontmatter.prompt}
|
|
|
1461
1586
|
};
|
|
1462
1587
|
|
|
1463
1588
|
// src/features/commands/roo-command.ts
|
|
1464
|
-
import { basename as
|
|
1465
|
-
import { optional as optional2, z as
|
|
1466
|
-
var RooCommandFrontmatterSchema =
|
|
1467
|
-
description:
|
|
1468
|
-
"argument-hint": optional2(
|
|
1589
|
+
import { basename as basename11, join as join12 } from "path";
|
|
1590
|
+
import { optional as optional2, z as z10 } from "zod/mini";
|
|
1591
|
+
var RooCommandFrontmatterSchema = z10.object({
|
|
1592
|
+
description: z10.string(),
|
|
1593
|
+
"argument-hint": optional2(z10.string())
|
|
1469
1594
|
});
|
|
1470
1595
|
var RooCommand = class _RooCommand extends ToolCommand {
|
|
1471
1596
|
frontmatter;
|
|
1472
1597
|
body;
|
|
1473
1598
|
static getSettablePaths() {
|
|
1474
1599
|
return {
|
|
1475
|
-
relativeDirPath:
|
|
1600
|
+
relativeDirPath: join12(".roo", "commands")
|
|
1476
1601
|
};
|
|
1477
1602
|
}
|
|
1478
1603
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -1480,7 +1605,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1480
1605
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1481
1606
|
if (!result.success) {
|
|
1482
1607
|
throw new Error(
|
|
1483
|
-
`Invalid frontmatter in ${
|
|
1608
|
+
`Invalid frontmatter in ${join12(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1484
1609
|
);
|
|
1485
1610
|
}
|
|
1486
1611
|
}
|
|
@@ -1546,7 +1671,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1546
1671
|
return {
|
|
1547
1672
|
success: false,
|
|
1548
1673
|
error: new Error(
|
|
1549
|
-
`Invalid frontmatter in ${
|
|
1674
|
+
`Invalid frontmatter in ${join12(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1550
1675
|
)
|
|
1551
1676
|
};
|
|
1552
1677
|
}
|
|
@@ -1562,7 +1687,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1562
1687
|
relativeFilePath,
|
|
1563
1688
|
validate = true
|
|
1564
1689
|
}) {
|
|
1565
|
-
const filePath =
|
|
1690
|
+
const filePath = join12(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
1566
1691
|
const fileContent = await readFileContent(filePath);
|
|
1567
1692
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1568
1693
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1572,7 +1697,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1572
1697
|
return new _RooCommand({
|
|
1573
1698
|
baseDir,
|
|
1574
1699
|
relativeDirPath: _RooCommand.getSettablePaths().relativeDirPath,
|
|
1575
|
-
relativeFilePath:
|
|
1700
|
+
relativeFilePath: basename11(relativeFilePath),
|
|
1576
1701
|
frontmatter: result.data,
|
|
1577
1702
|
body: content.trim(),
|
|
1578
1703
|
fileContent,
|
|
@@ -1584,13 +1709,14 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1584
1709
|
// src/features/commands/commands-processor.ts
|
|
1585
1710
|
var commandsProcessorToolTargets = [
|
|
1586
1711
|
"agentsmd",
|
|
1712
|
+
"antigravity",
|
|
1587
1713
|
"claudecode",
|
|
1588
1714
|
"geminicli",
|
|
1589
1715
|
"roo",
|
|
1590
1716
|
"copilot",
|
|
1591
1717
|
"cursor"
|
|
1592
1718
|
];
|
|
1593
|
-
var CommandsProcessorToolTargetSchema =
|
|
1719
|
+
var CommandsProcessorToolTargetSchema = z11.enum(
|
|
1594
1720
|
// codexcli is not in the list of tool targets but we add it here because it is a valid tool target for global mode generation
|
|
1595
1721
|
commandsProcessorToolTargets.concat("codexcli")
|
|
1596
1722
|
);
|
|
@@ -1633,6 +1759,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1633
1759
|
baseDir: this.baseDir,
|
|
1634
1760
|
rulesyncCommand
|
|
1635
1761
|
});
|
|
1762
|
+
case "antigravity":
|
|
1763
|
+
if (!AntigravityCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
|
|
1764
|
+
return null;
|
|
1765
|
+
}
|
|
1766
|
+
return AntigravityCommand.fromRulesyncCommand({
|
|
1767
|
+
baseDir: this.baseDir,
|
|
1768
|
+
rulesyncCommand
|
|
1769
|
+
});
|
|
1636
1770
|
case "claudecode":
|
|
1637
1771
|
if (!ClaudecodeCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
|
|
1638
1772
|
return null;
|
|
@@ -1708,11 +1842,11 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1708
1842
|
*/
|
|
1709
1843
|
async loadRulesyncFiles() {
|
|
1710
1844
|
const rulesyncCommandPaths = await findFilesByGlobs(
|
|
1711
|
-
|
|
1845
|
+
join13(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
|
|
1712
1846
|
);
|
|
1713
1847
|
const rulesyncCommands = await Promise.all(
|
|
1714
1848
|
rulesyncCommandPaths.map(
|
|
1715
|
-
(path3) => RulesyncCommand.fromFile({ relativeFilePath:
|
|
1849
|
+
(path3) => RulesyncCommand.fromFile({ relativeFilePath: basename12(path3) })
|
|
1716
1850
|
)
|
|
1717
1851
|
);
|
|
1718
1852
|
logger.info(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
@@ -1728,6 +1862,8 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1728
1862
|
switch (this.toolTarget) {
|
|
1729
1863
|
case "agentsmd":
|
|
1730
1864
|
return await this.loadAgentsmdCommands();
|
|
1865
|
+
case "antigravity":
|
|
1866
|
+
return await this.loadAntigravityCommands();
|
|
1731
1867
|
case "claudecode":
|
|
1732
1868
|
return await this.loadClaudecodeCommands();
|
|
1733
1869
|
case "geminicli":
|
|
@@ -1750,7 +1886,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1750
1886
|
extension
|
|
1751
1887
|
}) {
|
|
1752
1888
|
const commandFilePaths = await findFilesByGlobs(
|
|
1753
|
-
|
|
1889
|
+
join13(this.baseDir, relativeDirPath, `*.${extension}`)
|
|
1754
1890
|
);
|
|
1755
1891
|
const toolCommands = await Promise.all(
|
|
1756
1892
|
commandFilePaths.map((path3) => {
|
|
@@ -1758,40 +1894,45 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1758
1894
|
case "agentsmd":
|
|
1759
1895
|
return AgentsmdCommand.fromFile({
|
|
1760
1896
|
baseDir: this.baseDir,
|
|
1761
|
-
relativeFilePath:
|
|
1897
|
+
relativeFilePath: basename12(path3)
|
|
1898
|
+
});
|
|
1899
|
+
case "antigravity":
|
|
1900
|
+
return AntigravityCommand.fromFile({
|
|
1901
|
+
baseDir: this.baseDir,
|
|
1902
|
+
relativeFilePath: basename12(path3)
|
|
1762
1903
|
});
|
|
1763
1904
|
case "claudecode":
|
|
1764
1905
|
return ClaudecodeCommand.fromFile({
|
|
1765
1906
|
baseDir: this.baseDir,
|
|
1766
|
-
relativeFilePath:
|
|
1907
|
+
relativeFilePath: basename12(path3),
|
|
1767
1908
|
global: this.global
|
|
1768
1909
|
});
|
|
1769
1910
|
case "geminicli":
|
|
1770
1911
|
return GeminiCliCommand.fromFile({
|
|
1771
1912
|
baseDir: this.baseDir,
|
|
1772
|
-
relativeFilePath:
|
|
1913
|
+
relativeFilePath: basename12(path3),
|
|
1773
1914
|
global: this.global
|
|
1774
1915
|
});
|
|
1775
1916
|
case "roo":
|
|
1776
1917
|
return RooCommand.fromFile({
|
|
1777
1918
|
baseDir: this.baseDir,
|
|
1778
|
-
relativeFilePath:
|
|
1919
|
+
relativeFilePath: basename12(path3)
|
|
1779
1920
|
});
|
|
1780
1921
|
case "copilot":
|
|
1781
1922
|
return CopilotCommand.fromFile({
|
|
1782
1923
|
baseDir: this.baseDir,
|
|
1783
|
-
relativeFilePath:
|
|
1924
|
+
relativeFilePath: basename12(path3)
|
|
1784
1925
|
});
|
|
1785
1926
|
case "cursor":
|
|
1786
1927
|
return CursorCommand.fromFile({
|
|
1787
1928
|
baseDir: this.baseDir,
|
|
1788
|
-
relativeFilePath:
|
|
1929
|
+
relativeFilePath: basename12(path3),
|
|
1789
1930
|
global: this.global
|
|
1790
1931
|
});
|
|
1791
1932
|
case "codexcli":
|
|
1792
1933
|
return CodexcliCommand.fromFile({
|
|
1793
1934
|
baseDir: this.baseDir,
|
|
1794
|
-
relativeFilePath:
|
|
1935
|
+
relativeFilePath: basename12(path3),
|
|
1795
1936
|
global: this.global
|
|
1796
1937
|
});
|
|
1797
1938
|
default:
|
|
@@ -1812,6 +1953,16 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1812
1953
|
extension: "md"
|
|
1813
1954
|
});
|
|
1814
1955
|
}
|
|
1956
|
+
/**
|
|
1957
|
+
* Load Antigravity workflow configurations from .agent/workflows/ directory
|
|
1958
|
+
*/
|
|
1959
|
+
async loadAntigravityCommands() {
|
|
1960
|
+
return await this.loadToolCommandDefault({
|
|
1961
|
+
toolTarget: "antigravity",
|
|
1962
|
+
relativeDirPath: AntigravityCommand.getSettablePaths().relativeDirPath,
|
|
1963
|
+
extension: "md"
|
|
1964
|
+
});
|
|
1965
|
+
}
|
|
1815
1966
|
/**
|
|
1816
1967
|
* Load Copilot command configurations from .github/prompts/ directory
|
|
1817
1968
|
*/
|
|
@@ -1900,17 +2051,17 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1900
2051
|
};
|
|
1901
2052
|
|
|
1902
2053
|
// src/features/ignore/ignore-processor.ts
|
|
1903
|
-
import { z as
|
|
2054
|
+
import { z as z12 } from "zod/mini";
|
|
1904
2055
|
|
|
1905
2056
|
// src/features/ignore/amazonqcli-ignore.ts
|
|
1906
|
-
import { join as
|
|
2057
|
+
import { join as join15 } from "path";
|
|
1907
2058
|
|
|
1908
2059
|
// src/types/tool-file.ts
|
|
1909
2060
|
var ToolFile = class extends AiFile {
|
|
1910
2061
|
};
|
|
1911
2062
|
|
|
1912
2063
|
// src/features/ignore/rulesync-ignore.ts
|
|
1913
|
-
import { join as
|
|
2064
|
+
import { join as join14 } from "path";
|
|
1914
2065
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
1915
2066
|
validate() {
|
|
1916
2067
|
return { success: true, error: null };
|
|
@@ -1930,12 +2081,12 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
1930
2081
|
static async fromFile() {
|
|
1931
2082
|
const baseDir = process.cwd();
|
|
1932
2083
|
const paths = this.getSettablePaths();
|
|
1933
|
-
const recommendedPath =
|
|
2084
|
+
const recommendedPath = join14(
|
|
1934
2085
|
baseDir,
|
|
1935
2086
|
paths.recommended.relativeDirPath,
|
|
1936
2087
|
paths.recommended.relativeFilePath
|
|
1937
2088
|
);
|
|
1938
|
-
const legacyPath =
|
|
2089
|
+
const legacyPath = join14(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
1939
2090
|
if (await fileExists(recommendedPath)) {
|
|
1940
2091
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
1941
2092
|
return new _RulesyncIgnore({
|
|
@@ -2044,7 +2195,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
2044
2195
|
validate = true
|
|
2045
2196
|
}) {
|
|
2046
2197
|
const fileContent = await readFileContent(
|
|
2047
|
-
|
|
2198
|
+
join15(
|
|
2048
2199
|
baseDir,
|
|
2049
2200
|
this.getSettablePaths().relativeDirPath,
|
|
2050
2201
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2061,7 +2212,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
2061
2212
|
};
|
|
2062
2213
|
|
|
2063
2214
|
// src/features/ignore/augmentcode-ignore.ts
|
|
2064
|
-
import { join as
|
|
2215
|
+
import { join as join16 } from "path";
|
|
2065
2216
|
var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
2066
2217
|
static getSettablePaths() {
|
|
2067
2218
|
return {
|
|
@@ -2099,7 +2250,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2099
2250
|
validate = true
|
|
2100
2251
|
}) {
|
|
2101
2252
|
const fileContent = await readFileContent(
|
|
2102
|
-
|
|
2253
|
+
join16(
|
|
2103
2254
|
baseDir,
|
|
2104
2255
|
this.getSettablePaths().relativeDirPath,
|
|
2105
2256
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2116,7 +2267,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2116
2267
|
};
|
|
2117
2268
|
|
|
2118
2269
|
// src/features/ignore/claudecode-ignore.ts
|
|
2119
|
-
import { join as
|
|
2270
|
+
import { join as join17 } from "path";
|
|
2120
2271
|
import { uniq } from "es-toolkit";
|
|
2121
2272
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
2122
2273
|
constructor(params) {
|
|
@@ -2152,7 +2303,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2152
2303
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
2153
2304
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
2154
2305
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
2155
|
-
const filePath =
|
|
2306
|
+
const filePath = join17(
|
|
2156
2307
|
baseDir,
|
|
2157
2308
|
this.getSettablePaths().relativeDirPath,
|
|
2158
2309
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2180,7 +2331,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2180
2331
|
validate = true
|
|
2181
2332
|
}) {
|
|
2182
2333
|
const fileContent = await readFileContent(
|
|
2183
|
-
|
|
2334
|
+
join17(
|
|
2184
2335
|
baseDir,
|
|
2185
2336
|
this.getSettablePaths().relativeDirPath,
|
|
2186
2337
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2197,7 +2348,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2197
2348
|
};
|
|
2198
2349
|
|
|
2199
2350
|
// src/features/ignore/cline-ignore.ts
|
|
2200
|
-
import { join as
|
|
2351
|
+
import { join as join18 } from "path";
|
|
2201
2352
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
2202
2353
|
static getSettablePaths() {
|
|
2203
2354
|
return {
|
|
@@ -2234,7 +2385,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2234
2385
|
validate = true
|
|
2235
2386
|
}) {
|
|
2236
2387
|
const fileContent = await readFileContent(
|
|
2237
|
-
|
|
2388
|
+
join18(
|
|
2238
2389
|
baseDir,
|
|
2239
2390
|
this.getSettablePaths().relativeDirPath,
|
|
2240
2391
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2251,7 +2402,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2251
2402
|
};
|
|
2252
2403
|
|
|
2253
2404
|
// src/features/ignore/cursor-ignore.ts
|
|
2254
|
-
import { join as
|
|
2405
|
+
import { join as join19 } from "path";
|
|
2255
2406
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
2256
2407
|
static getSettablePaths() {
|
|
2257
2408
|
return {
|
|
@@ -2284,7 +2435,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2284
2435
|
validate = true
|
|
2285
2436
|
}) {
|
|
2286
2437
|
const fileContent = await readFileContent(
|
|
2287
|
-
|
|
2438
|
+
join19(
|
|
2288
2439
|
baseDir,
|
|
2289
2440
|
this.getSettablePaths().relativeDirPath,
|
|
2290
2441
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2301,7 +2452,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2301
2452
|
};
|
|
2302
2453
|
|
|
2303
2454
|
// src/features/ignore/geminicli-ignore.ts
|
|
2304
|
-
import { join as
|
|
2455
|
+
import { join as join20 } from "path";
|
|
2305
2456
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
2306
2457
|
static getSettablePaths() {
|
|
2307
2458
|
return {
|
|
@@ -2328,7 +2479,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2328
2479
|
validate = true
|
|
2329
2480
|
}) {
|
|
2330
2481
|
const fileContent = await readFileContent(
|
|
2331
|
-
|
|
2482
|
+
join20(
|
|
2332
2483
|
baseDir,
|
|
2333
2484
|
this.getSettablePaths().relativeDirPath,
|
|
2334
2485
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2345,7 +2496,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2345
2496
|
};
|
|
2346
2497
|
|
|
2347
2498
|
// src/features/ignore/junie-ignore.ts
|
|
2348
|
-
import { join as
|
|
2499
|
+
import { join as join21 } from "path";
|
|
2349
2500
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
2350
2501
|
static getSettablePaths() {
|
|
2351
2502
|
return {
|
|
@@ -2372,7 +2523,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2372
2523
|
validate = true
|
|
2373
2524
|
}) {
|
|
2374
2525
|
const fileContent = await readFileContent(
|
|
2375
|
-
|
|
2526
|
+
join21(
|
|
2376
2527
|
baseDir,
|
|
2377
2528
|
this.getSettablePaths().relativeDirPath,
|
|
2378
2529
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2389,7 +2540,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2389
2540
|
};
|
|
2390
2541
|
|
|
2391
2542
|
// src/features/ignore/kiro-ignore.ts
|
|
2392
|
-
import { join as
|
|
2543
|
+
import { join as join22 } from "path";
|
|
2393
2544
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
2394
2545
|
static getSettablePaths() {
|
|
2395
2546
|
return {
|
|
@@ -2416,7 +2567,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
2416
2567
|
validate = true
|
|
2417
2568
|
}) {
|
|
2418
2569
|
const fileContent = await readFileContent(
|
|
2419
|
-
|
|
2570
|
+
join22(
|
|
2420
2571
|
baseDir,
|
|
2421
2572
|
this.getSettablePaths().relativeDirPath,
|
|
2422
2573
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2433,7 +2584,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
2433
2584
|
};
|
|
2434
2585
|
|
|
2435
2586
|
// src/features/ignore/qwencode-ignore.ts
|
|
2436
|
-
import { join as
|
|
2587
|
+
import { join as join23 } from "path";
|
|
2437
2588
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
2438
2589
|
static getSettablePaths() {
|
|
2439
2590
|
return {
|
|
@@ -2460,7 +2611,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
2460
2611
|
validate = true
|
|
2461
2612
|
}) {
|
|
2462
2613
|
const fileContent = await readFileContent(
|
|
2463
|
-
|
|
2614
|
+
join23(
|
|
2464
2615
|
baseDir,
|
|
2465
2616
|
this.getSettablePaths().relativeDirPath,
|
|
2466
2617
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2477,7 +2628,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
2477
2628
|
};
|
|
2478
2629
|
|
|
2479
2630
|
// src/features/ignore/roo-ignore.ts
|
|
2480
|
-
import { join as
|
|
2631
|
+
import { join as join24 } from "path";
|
|
2481
2632
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
2482
2633
|
static getSettablePaths() {
|
|
2483
2634
|
return {
|
|
@@ -2504,7 +2655,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
2504
2655
|
validate = true
|
|
2505
2656
|
}) {
|
|
2506
2657
|
const fileContent = await readFileContent(
|
|
2507
|
-
|
|
2658
|
+
join24(
|
|
2508
2659
|
baseDir,
|
|
2509
2660
|
this.getSettablePaths().relativeDirPath,
|
|
2510
2661
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2521,7 +2672,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
2521
2672
|
};
|
|
2522
2673
|
|
|
2523
2674
|
// src/features/ignore/windsurf-ignore.ts
|
|
2524
|
-
import { join as
|
|
2675
|
+
import { join as join25 } from "path";
|
|
2525
2676
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
2526
2677
|
static getSettablePaths() {
|
|
2527
2678
|
return {
|
|
@@ -2548,7 +2699,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
2548
2699
|
validate = true
|
|
2549
2700
|
}) {
|
|
2550
2701
|
const fileContent = await readFileContent(
|
|
2551
|
-
|
|
2702
|
+
join25(
|
|
2552
2703
|
baseDir,
|
|
2553
2704
|
this.getSettablePaths().relativeDirPath,
|
|
2554
2705
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2578,7 +2729,7 @@ var ignoreProcessorToolTargets = [
|
|
|
2578
2729
|
"roo",
|
|
2579
2730
|
"windsurf"
|
|
2580
2731
|
];
|
|
2581
|
-
var IgnoreProcessorToolTargetSchema =
|
|
2732
|
+
var IgnoreProcessorToolTargetSchema = z12.enum(ignoreProcessorToolTargets);
|
|
2582
2733
|
var IgnoreProcessor = class extends FeatureProcessor {
|
|
2583
2734
|
toolTarget;
|
|
2584
2735
|
constructor({
|
|
@@ -2761,54 +2912,54 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
2761
2912
|
};
|
|
2762
2913
|
|
|
2763
2914
|
// src/features/mcp/mcp-processor.ts
|
|
2764
|
-
import { z as
|
|
2915
|
+
import { z as z17 } from "zod/mini";
|
|
2765
2916
|
|
|
2766
2917
|
// src/features/mcp/amazonqcli-mcp.ts
|
|
2767
|
-
import { join as
|
|
2918
|
+
import { join as join27 } from "path";
|
|
2768
2919
|
|
|
2769
2920
|
// src/features/mcp/rulesync-mcp.ts
|
|
2770
|
-
import { join as
|
|
2921
|
+
import { join as join26 } from "path";
|
|
2771
2922
|
import { omit } from "es-toolkit/object";
|
|
2772
|
-
import { z as
|
|
2923
|
+
import { z as z14 } from "zod/mini";
|
|
2773
2924
|
|
|
2774
2925
|
// src/types/mcp.ts
|
|
2775
|
-
import { z as
|
|
2776
|
-
var McpServerSchema =
|
|
2777
|
-
type:
|
|
2778
|
-
command:
|
|
2779
|
-
args:
|
|
2780
|
-
url:
|
|
2781
|
-
httpUrl:
|
|
2782
|
-
env:
|
|
2783
|
-
disabled:
|
|
2784
|
-
networkTimeout:
|
|
2785
|
-
timeout:
|
|
2786
|
-
trust:
|
|
2787
|
-
cwd:
|
|
2788
|
-
transport:
|
|
2789
|
-
alwaysAllow:
|
|
2790
|
-
tools:
|
|
2791
|
-
kiroAutoApprove:
|
|
2792
|
-
kiroAutoBlock:
|
|
2793
|
-
headers:
|
|
2926
|
+
import { z as z13 } from "zod/mini";
|
|
2927
|
+
var McpServerSchema = z13.object({
|
|
2928
|
+
type: z13.optional(z13.enum(["stdio", "sse", "http"])),
|
|
2929
|
+
command: z13.optional(z13.union([z13.string(), z13.array(z13.string())])),
|
|
2930
|
+
args: z13.optional(z13.array(z13.string())),
|
|
2931
|
+
url: z13.optional(z13.string()),
|
|
2932
|
+
httpUrl: z13.optional(z13.string()),
|
|
2933
|
+
env: z13.optional(z13.record(z13.string(), z13.string())),
|
|
2934
|
+
disabled: z13.optional(z13.boolean()),
|
|
2935
|
+
networkTimeout: z13.optional(z13.number()),
|
|
2936
|
+
timeout: z13.optional(z13.number()),
|
|
2937
|
+
trust: z13.optional(z13.boolean()),
|
|
2938
|
+
cwd: z13.optional(z13.string()),
|
|
2939
|
+
transport: z13.optional(z13.enum(["stdio", "sse", "http"])),
|
|
2940
|
+
alwaysAllow: z13.optional(z13.array(z13.string())),
|
|
2941
|
+
tools: z13.optional(z13.array(z13.string())),
|
|
2942
|
+
kiroAutoApprove: z13.optional(z13.array(z13.string())),
|
|
2943
|
+
kiroAutoBlock: z13.optional(z13.array(z13.string())),
|
|
2944
|
+
headers: z13.optional(z13.record(z13.string(), z13.string()))
|
|
2794
2945
|
});
|
|
2795
|
-
var McpServersSchema =
|
|
2946
|
+
var McpServersSchema = z13.record(z13.string(), McpServerSchema);
|
|
2796
2947
|
|
|
2797
2948
|
// src/features/mcp/rulesync-mcp.ts
|
|
2798
|
-
var RulesyncMcpServerSchema =
|
|
2799
|
-
|
|
2800
|
-
targets:
|
|
2801
|
-
description:
|
|
2802
|
-
exposed:
|
|
2949
|
+
var RulesyncMcpServerSchema = z14.union([
|
|
2950
|
+
z14.extend(McpServerSchema, {
|
|
2951
|
+
targets: z14.optional(RulesyncTargetsSchema),
|
|
2952
|
+
description: z14.optional(z14.string()),
|
|
2953
|
+
exposed: z14.optional(z14.literal(false))
|
|
2803
2954
|
}),
|
|
2804
|
-
|
|
2805
|
-
targets:
|
|
2806
|
-
description:
|
|
2807
|
-
exposed:
|
|
2955
|
+
z14.extend(McpServerSchema, {
|
|
2956
|
+
targets: z14.optional(RulesyncTargetsSchema),
|
|
2957
|
+
description: z14.undefined(),
|
|
2958
|
+
exposed: z14.literal(true)
|
|
2808
2959
|
})
|
|
2809
2960
|
]);
|
|
2810
|
-
var RulesyncMcpConfigSchema =
|
|
2811
|
-
mcpServers:
|
|
2961
|
+
var RulesyncMcpConfigSchema = z14.object({
|
|
2962
|
+
mcpServers: z14.record(z14.string(), RulesyncMcpServerSchema)
|
|
2812
2963
|
});
|
|
2813
2964
|
var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
2814
2965
|
json;
|
|
@@ -2849,12 +3000,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
2849
3000
|
}) {
|
|
2850
3001
|
const baseDir = process.cwd();
|
|
2851
3002
|
const paths = this.getSettablePaths();
|
|
2852
|
-
const recommendedPath =
|
|
3003
|
+
const recommendedPath = join26(
|
|
2853
3004
|
baseDir,
|
|
2854
3005
|
paths.recommended.relativeDirPath,
|
|
2855
3006
|
paths.recommended.relativeFilePath
|
|
2856
3007
|
);
|
|
2857
|
-
const legacyPath =
|
|
3008
|
+
const legacyPath = join26(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
2858
3009
|
if (await fileExists(recommendedPath)) {
|
|
2859
3010
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
2860
3011
|
return new _RulesyncMcp({
|
|
@@ -2974,7 +3125,7 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
2974
3125
|
validate = true
|
|
2975
3126
|
}) {
|
|
2976
3127
|
const fileContent = await readFileContent(
|
|
2977
|
-
|
|
3128
|
+
join27(
|
|
2978
3129
|
baseDir,
|
|
2979
3130
|
this.getSettablePaths().relativeDirPath,
|
|
2980
3131
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3010,17 +3161,17 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
3010
3161
|
};
|
|
3011
3162
|
|
|
3012
3163
|
// src/features/mcp/claudecode-mcp.ts
|
|
3013
|
-
import { join as
|
|
3164
|
+
import { join as join29 } from "path";
|
|
3014
3165
|
|
|
3015
3166
|
// src/features/mcp/modular-mcp.ts
|
|
3016
|
-
import { join as
|
|
3017
|
-
import { z as
|
|
3018
|
-
var ModularMcpServerSchema =
|
|
3019
|
-
description:
|
|
3167
|
+
import { join as join28 } from "path";
|
|
3168
|
+
import { z as z15 } from "zod/mini";
|
|
3169
|
+
var ModularMcpServerSchema = z15.extend(McpServerSchema, {
|
|
3170
|
+
description: z15.string()
|
|
3020
3171
|
// Required for modular-mcp
|
|
3021
3172
|
});
|
|
3022
|
-
var ModularMcpConfigSchema =
|
|
3023
|
-
mcpServers:
|
|
3173
|
+
var ModularMcpConfigSchema = z15.object({
|
|
3174
|
+
mcpServers: z15.record(z15.string(), ModularMcpServerSchema)
|
|
3024
3175
|
});
|
|
3025
3176
|
var ModularMcp = class _ModularMcp extends AiFile {
|
|
3026
3177
|
json;
|
|
@@ -3076,7 +3227,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3076
3227
|
args: [
|
|
3077
3228
|
"-y",
|
|
3078
3229
|
"@kimuson/modular-mcp",
|
|
3079
|
-
|
|
3230
|
+
join28(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3080
3231
|
],
|
|
3081
3232
|
env: {}
|
|
3082
3233
|
}
|
|
@@ -3141,7 +3292,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3141
3292
|
}) {
|
|
3142
3293
|
const paths = this.getSettablePaths({ global });
|
|
3143
3294
|
const fileContent = await readOrInitializeFileContent(
|
|
3144
|
-
|
|
3295
|
+
join29(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3145
3296
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3146
3297
|
);
|
|
3147
3298
|
const json = JSON.parse(fileContent);
|
|
@@ -3163,7 +3314,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3163
3314
|
}) {
|
|
3164
3315
|
const paths = this.getSettablePaths({ global });
|
|
3165
3316
|
const fileContent = await readOrInitializeFileContent(
|
|
3166
|
-
|
|
3317
|
+
join29(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3167
3318
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3168
3319
|
);
|
|
3169
3320
|
const json = JSON.parse(fileContent);
|
|
@@ -3198,7 +3349,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3198
3349
|
};
|
|
3199
3350
|
|
|
3200
3351
|
// src/features/mcp/cline-mcp.ts
|
|
3201
|
-
import { join as
|
|
3352
|
+
import { join as join30 } from "path";
|
|
3202
3353
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
3203
3354
|
json;
|
|
3204
3355
|
constructor(params) {
|
|
@@ -3219,7 +3370,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3219
3370
|
validate = true
|
|
3220
3371
|
}) {
|
|
3221
3372
|
const fileContent = await readFileContent(
|
|
3222
|
-
|
|
3373
|
+
join30(
|
|
3223
3374
|
baseDir,
|
|
3224
3375
|
this.getSettablePaths().relativeDirPath,
|
|
3225
3376
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3255,7 +3406,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3255
3406
|
};
|
|
3256
3407
|
|
|
3257
3408
|
// src/features/mcp/codexcli-mcp.ts
|
|
3258
|
-
import { join as
|
|
3409
|
+
import { join as join31 } from "path";
|
|
3259
3410
|
import * as smolToml from "smol-toml";
|
|
3260
3411
|
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
3261
3412
|
toml;
|
|
@@ -3291,7 +3442,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3291
3442
|
}) {
|
|
3292
3443
|
const paths = this.getSettablePaths({ global });
|
|
3293
3444
|
const fileContent = await readFileContent(
|
|
3294
|
-
|
|
3445
|
+
join31(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3295
3446
|
);
|
|
3296
3447
|
return new _CodexcliMcp({
|
|
3297
3448
|
baseDir,
|
|
@@ -3308,7 +3459,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3308
3459
|
global = false
|
|
3309
3460
|
}) {
|
|
3310
3461
|
const paths = this.getSettablePaths({ global });
|
|
3311
|
-
const configTomlFilePath =
|
|
3462
|
+
const configTomlFilePath = join31(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3312
3463
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
3313
3464
|
configTomlFilePath,
|
|
3314
3465
|
smolToml.stringify({})
|
|
@@ -3349,7 +3500,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3349
3500
|
};
|
|
3350
3501
|
|
|
3351
3502
|
// src/features/mcp/copilot-mcp.ts
|
|
3352
|
-
import { join as
|
|
3503
|
+
import { join as join32 } from "path";
|
|
3353
3504
|
var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
3354
3505
|
json;
|
|
3355
3506
|
constructor(params) {
|
|
@@ -3370,7 +3521,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3370
3521
|
validate = true
|
|
3371
3522
|
}) {
|
|
3372
3523
|
const fileContent = await readFileContent(
|
|
3373
|
-
|
|
3524
|
+
join32(
|
|
3374
3525
|
baseDir,
|
|
3375
3526
|
this.getSettablePaths().relativeDirPath,
|
|
3376
3527
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3406,7 +3557,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3406
3557
|
};
|
|
3407
3558
|
|
|
3408
3559
|
// src/features/mcp/cursor-mcp.ts
|
|
3409
|
-
import { join as
|
|
3560
|
+
import { join as join33 } from "path";
|
|
3410
3561
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
3411
3562
|
json;
|
|
3412
3563
|
constructor(params) {
|
|
@@ -3427,7 +3578,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
3427
3578
|
validate = true
|
|
3428
3579
|
}) {
|
|
3429
3580
|
const fileContent = await readFileContent(
|
|
3430
|
-
|
|
3581
|
+
join33(
|
|
3431
3582
|
baseDir,
|
|
3432
3583
|
this.getSettablePaths().relativeDirPath,
|
|
3433
3584
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3474,7 +3625,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
3474
3625
|
};
|
|
3475
3626
|
|
|
3476
3627
|
// src/features/mcp/geminicli-mcp.ts
|
|
3477
|
-
import { join as
|
|
3628
|
+
import { join as join34 } from "path";
|
|
3478
3629
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
3479
3630
|
json;
|
|
3480
3631
|
constructor(params) {
|
|
@@ -3503,7 +3654,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3503
3654
|
}) {
|
|
3504
3655
|
const paths = this.getSettablePaths({ global });
|
|
3505
3656
|
const fileContent = await readOrInitializeFileContent(
|
|
3506
|
-
|
|
3657
|
+
join34(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3507
3658
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3508
3659
|
);
|
|
3509
3660
|
const json = JSON.parse(fileContent);
|
|
@@ -3524,7 +3675,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3524
3675
|
}) {
|
|
3525
3676
|
const paths = this.getSettablePaths({ global });
|
|
3526
3677
|
const fileContent = await readOrInitializeFileContent(
|
|
3527
|
-
|
|
3678
|
+
join34(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3528
3679
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3529
3680
|
);
|
|
3530
3681
|
const json = JSON.parse(fileContent);
|
|
@@ -3548,7 +3699,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3548
3699
|
};
|
|
3549
3700
|
|
|
3550
3701
|
// src/features/mcp/junie-mcp.ts
|
|
3551
|
-
import { join as
|
|
3702
|
+
import { join as join35 } from "path";
|
|
3552
3703
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
3553
3704
|
json;
|
|
3554
3705
|
constructor(params) {
|
|
@@ -3560,7 +3711,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
3560
3711
|
}
|
|
3561
3712
|
static getSettablePaths() {
|
|
3562
3713
|
return {
|
|
3563
|
-
relativeDirPath:
|
|
3714
|
+
relativeDirPath: join35(".junie", "mcp"),
|
|
3564
3715
|
relativeFilePath: "mcp.json"
|
|
3565
3716
|
};
|
|
3566
3717
|
}
|
|
@@ -3569,7 +3720,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
3569
3720
|
validate = true
|
|
3570
3721
|
}) {
|
|
3571
3722
|
const fileContent = await readFileContent(
|
|
3572
|
-
|
|
3723
|
+
join35(
|
|
3573
3724
|
baseDir,
|
|
3574
3725
|
this.getSettablePaths().relativeDirPath,
|
|
3575
3726
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3605,28 +3756,28 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
3605
3756
|
};
|
|
3606
3757
|
|
|
3607
3758
|
// src/features/mcp/opencode-mcp.ts
|
|
3608
|
-
import { join as
|
|
3609
|
-
import { z as
|
|
3610
|
-
var OpencodeMcpLocalServerSchema =
|
|
3611
|
-
type:
|
|
3612
|
-
command:
|
|
3613
|
-
environment:
|
|
3614
|
-
enabled:
|
|
3615
|
-
cwd:
|
|
3759
|
+
import { join as join36 } from "path";
|
|
3760
|
+
import { z as z16 } from "zod/mini";
|
|
3761
|
+
var OpencodeMcpLocalServerSchema = z16.object({
|
|
3762
|
+
type: z16.literal("local"),
|
|
3763
|
+
command: z16.array(z16.string()),
|
|
3764
|
+
environment: z16.optional(z16.record(z16.string(), z16.string())),
|
|
3765
|
+
enabled: z16._default(z16.boolean(), true),
|
|
3766
|
+
cwd: z16.optional(z16.string())
|
|
3616
3767
|
});
|
|
3617
|
-
var OpencodeMcpRemoteServerSchema =
|
|
3618
|
-
type:
|
|
3619
|
-
url:
|
|
3620
|
-
headers:
|
|
3621
|
-
enabled:
|
|
3768
|
+
var OpencodeMcpRemoteServerSchema = z16.object({
|
|
3769
|
+
type: z16.literal("remote"),
|
|
3770
|
+
url: z16.string(),
|
|
3771
|
+
headers: z16.optional(z16.record(z16.string(), z16.string())),
|
|
3772
|
+
enabled: z16._default(z16.boolean(), true)
|
|
3622
3773
|
});
|
|
3623
|
-
var OpencodeMcpServerSchema =
|
|
3774
|
+
var OpencodeMcpServerSchema = z16.union([
|
|
3624
3775
|
OpencodeMcpLocalServerSchema,
|
|
3625
3776
|
OpencodeMcpRemoteServerSchema
|
|
3626
3777
|
]);
|
|
3627
|
-
var OpencodeConfigSchema =
|
|
3628
|
-
$schema:
|
|
3629
|
-
mcp:
|
|
3778
|
+
var OpencodeConfigSchema = z16.looseObject({
|
|
3779
|
+
$schema: z16.optional(z16.string()),
|
|
3780
|
+
mcp: z16.optional(z16.record(z16.string(), OpencodeMcpServerSchema))
|
|
3630
3781
|
});
|
|
3631
3782
|
function convertFromOpencodeFormat(opencodeMcp) {
|
|
3632
3783
|
return Object.fromEntries(
|
|
@@ -3723,7 +3874,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
3723
3874
|
}) {
|
|
3724
3875
|
const paths = this.getSettablePaths({ global });
|
|
3725
3876
|
const fileContent = await readOrInitializeFileContent(
|
|
3726
|
-
|
|
3877
|
+
join36(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3727
3878
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
3728
3879
|
);
|
|
3729
3880
|
const json = JSON.parse(fileContent);
|
|
@@ -3744,7 +3895,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
3744
3895
|
}) {
|
|
3745
3896
|
const paths = this.getSettablePaths({ global });
|
|
3746
3897
|
const fileContent = await readOrInitializeFileContent(
|
|
3747
|
-
|
|
3898
|
+
join36(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3748
3899
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
3749
3900
|
);
|
|
3750
3901
|
const json = JSON.parse(fileContent);
|
|
@@ -3775,7 +3926,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
3775
3926
|
};
|
|
3776
3927
|
|
|
3777
3928
|
// src/features/mcp/roo-mcp.ts
|
|
3778
|
-
import { join as
|
|
3929
|
+
import { join as join37 } from "path";
|
|
3779
3930
|
var RooMcp = class _RooMcp extends ToolMcp {
|
|
3780
3931
|
json;
|
|
3781
3932
|
constructor(params) {
|
|
@@ -3796,7 +3947,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
3796
3947
|
validate = true
|
|
3797
3948
|
}) {
|
|
3798
3949
|
const fileContent = await readFileContent(
|
|
3799
|
-
|
|
3950
|
+
join37(
|
|
3800
3951
|
baseDir,
|
|
3801
3952
|
this.getSettablePaths().relativeDirPath,
|
|
3802
3953
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3844,7 +3995,7 @@ var mcpProcessorToolTargets = [
|
|
|
3844
3995
|
"opencode",
|
|
3845
3996
|
"roo"
|
|
3846
3997
|
];
|
|
3847
|
-
var McpProcessorToolTargetSchema =
|
|
3998
|
+
var McpProcessorToolTargetSchema = z17.enum(
|
|
3848
3999
|
// codexcli is not in the list of tool targets but we add it here because it is a valid tool target for global mode generation
|
|
3849
4000
|
mcpProcessorToolTargets.concat("codexcli")
|
|
3850
4001
|
);
|
|
@@ -4116,22 +4267,22 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4116
4267
|
};
|
|
4117
4268
|
|
|
4118
4269
|
// src/features/rules/rules-processor.ts
|
|
4119
|
-
import { basename as
|
|
4270
|
+
import { basename as basename20, join as join79 } from "path";
|
|
4120
4271
|
import { XMLBuilder } from "fast-xml-parser";
|
|
4121
|
-
import { z as
|
|
4272
|
+
import { z as z30 } from "zod/mini";
|
|
4122
4273
|
|
|
4123
4274
|
// src/features/skills/codexcli-skill.ts
|
|
4124
|
-
import { join as
|
|
4275
|
+
import { join as join40 } from "path";
|
|
4125
4276
|
|
|
4126
4277
|
// src/features/skills/simulated-skill.ts
|
|
4127
|
-
import { join as
|
|
4128
|
-
import { z as
|
|
4278
|
+
import { join as join39 } from "path";
|
|
4279
|
+
import { z as z18 } from "zod/mini";
|
|
4129
4280
|
|
|
4130
4281
|
// src/constants/general.ts
|
|
4131
4282
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
4132
4283
|
|
|
4133
4284
|
// src/types/ai-dir.ts
|
|
4134
|
-
import path2, { basename as
|
|
4285
|
+
import path2, { basename as basename13, join as join38, relative as relative3, resolve as resolve4 } from "path";
|
|
4135
4286
|
var AiDir = class {
|
|
4136
4287
|
/**
|
|
4137
4288
|
* @example "."
|
|
@@ -4225,10 +4376,10 @@ var AiDir = class {
|
|
|
4225
4376
|
* @returns Array of files with their relative paths and buffers
|
|
4226
4377
|
*/
|
|
4227
4378
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
4228
|
-
const dirPath =
|
|
4229
|
-
const glob =
|
|
4379
|
+
const dirPath = join38(baseDir, relativeDirPath, dirName);
|
|
4380
|
+
const glob = join38(dirPath, "**", "*");
|
|
4230
4381
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
4231
|
-
const filteredPaths = filePaths.filter((filePath) =>
|
|
4382
|
+
const filteredPaths = filePaths.filter((filePath) => basename13(filePath) !== excludeFileName);
|
|
4232
4383
|
const files = await Promise.all(
|
|
4233
4384
|
filteredPaths.map(async (filePath) => {
|
|
4234
4385
|
const fileBuffer = await readFileBuffer(filePath);
|
|
@@ -4299,9 +4450,9 @@ var ToolSkill = class extends AiDir {
|
|
|
4299
4450
|
};
|
|
4300
4451
|
|
|
4301
4452
|
// src/features/skills/simulated-skill.ts
|
|
4302
|
-
var SimulatedSkillFrontmatterSchema =
|
|
4303
|
-
name:
|
|
4304
|
-
description:
|
|
4453
|
+
var SimulatedSkillFrontmatterSchema = z18.object({
|
|
4454
|
+
name: z18.string(),
|
|
4455
|
+
description: z18.string()
|
|
4305
4456
|
});
|
|
4306
4457
|
var SimulatedSkill = class extends ToolSkill {
|
|
4307
4458
|
frontmatter;
|
|
@@ -4332,7 +4483,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
4332
4483
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
4333
4484
|
if (!result.success) {
|
|
4334
4485
|
throw new Error(
|
|
4335
|
-
`Invalid frontmatter in ${
|
|
4486
|
+
`Invalid frontmatter in ${join39(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
4336
4487
|
);
|
|
4337
4488
|
}
|
|
4338
4489
|
}
|
|
@@ -4397,8 +4548,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
4397
4548
|
}) {
|
|
4398
4549
|
const settablePaths = this.getSettablePaths();
|
|
4399
4550
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
4400
|
-
const skillDirPath =
|
|
4401
|
-
const skillFilePath =
|
|
4551
|
+
const skillDirPath = join39(baseDir, actualRelativeDirPath, dirName);
|
|
4552
|
+
const skillFilePath = join39(skillDirPath, SKILL_FILE_NAME);
|
|
4402
4553
|
if (!await fileExists(skillFilePath)) {
|
|
4403
4554
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
4404
4555
|
}
|
|
@@ -4450,7 +4601,7 @@ var CodexCliSkill = class _CodexCliSkill extends SimulatedSkill {
|
|
|
4450
4601
|
throw new Error("CodexCliSkill does not support global mode.");
|
|
4451
4602
|
}
|
|
4452
4603
|
return {
|
|
4453
|
-
relativeDirPath:
|
|
4604
|
+
relativeDirPath: join40(".codex", "skills")
|
|
4454
4605
|
};
|
|
4455
4606
|
}
|
|
4456
4607
|
static async fromDir(params) {
|
|
@@ -4473,14 +4624,14 @@ var CodexCliSkill = class _CodexCliSkill extends SimulatedSkill {
|
|
|
4473
4624
|
};
|
|
4474
4625
|
|
|
4475
4626
|
// src/features/skills/copilot-skill.ts
|
|
4476
|
-
import { join as
|
|
4627
|
+
import { join as join41 } from "path";
|
|
4477
4628
|
var CopilotSkill = class _CopilotSkill extends SimulatedSkill {
|
|
4478
4629
|
static getSettablePaths(options) {
|
|
4479
4630
|
if (options?.global) {
|
|
4480
4631
|
throw new Error("CopilotSkill does not support global mode.");
|
|
4481
4632
|
}
|
|
4482
4633
|
return {
|
|
4483
|
-
relativeDirPath:
|
|
4634
|
+
relativeDirPath: join41(".github", "skills")
|
|
4484
4635
|
};
|
|
4485
4636
|
}
|
|
4486
4637
|
static async fromDir(params) {
|
|
@@ -4503,14 +4654,14 @@ var CopilotSkill = class _CopilotSkill extends SimulatedSkill {
|
|
|
4503
4654
|
};
|
|
4504
4655
|
|
|
4505
4656
|
// src/features/skills/cursor-skill.ts
|
|
4506
|
-
import { join as
|
|
4657
|
+
import { join as join42 } from "path";
|
|
4507
4658
|
var CursorSkill = class _CursorSkill extends SimulatedSkill {
|
|
4508
4659
|
static getSettablePaths(options) {
|
|
4509
4660
|
if (options?.global) {
|
|
4510
4661
|
throw new Error("CursorSkill does not support global mode.");
|
|
4511
4662
|
}
|
|
4512
4663
|
return {
|
|
4513
|
-
relativeDirPath:
|
|
4664
|
+
relativeDirPath: join42(".cursor", "skills")
|
|
4514
4665
|
};
|
|
4515
4666
|
}
|
|
4516
4667
|
static async fromDir(params) {
|
|
@@ -4533,11 +4684,11 @@ var CursorSkill = class _CursorSkill extends SimulatedSkill {
|
|
|
4533
4684
|
};
|
|
4534
4685
|
|
|
4535
4686
|
// src/features/skills/skills-processor.ts
|
|
4536
|
-
import { basename as
|
|
4537
|
-
import { z as
|
|
4687
|
+
import { basename as basename14, join as join48 } from "path";
|
|
4688
|
+
import { z as z21 } from "zod/mini";
|
|
4538
4689
|
|
|
4539
4690
|
// src/types/dir-feature-processor.ts
|
|
4540
|
-
import { join as
|
|
4691
|
+
import { join as join43 } from "path";
|
|
4541
4692
|
var DirFeatureProcessor = class {
|
|
4542
4693
|
baseDir;
|
|
4543
4694
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -4559,14 +4710,14 @@ var DirFeatureProcessor = class {
|
|
|
4559
4710
|
await ensureDir(dirPath);
|
|
4560
4711
|
const mainFile = aiDir.getMainFile();
|
|
4561
4712
|
if (mainFile) {
|
|
4562
|
-
const mainFilePath =
|
|
4713
|
+
const mainFilePath = join43(dirPath, mainFile.name);
|
|
4563
4714
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
4564
4715
|
const contentWithNewline = addTrailingNewline(content);
|
|
4565
4716
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
4566
4717
|
}
|
|
4567
4718
|
const otherFiles = aiDir.getOtherFiles();
|
|
4568
4719
|
for (const file of otherFiles) {
|
|
4569
|
-
const filePath =
|
|
4720
|
+
const filePath = join43(dirPath, file.relativeFilePathToDirPath);
|
|
4570
4721
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
4571
4722
|
await writeFileContent(filePath, contentWithNewline);
|
|
4572
4723
|
}
|
|
@@ -4581,14 +4732,14 @@ var DirFeatureProcessor = class {
|
|
|
4581
4732
|
};
|
|
4582
4733
|
|
|
4583
4734
|
// src/features/skills/agentsmd-skill.ts
|
|
4584
|
-
import { join as
|
|
4735
|
+
import { join as join44 } from "path";
|
|
4585
4736
|
var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
4586
4737
|
static getSettablePaths(options) {
|
|
4587
4738
|
if (options?.global) {
|
|
4588
4739
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
4589
4740
|
}
|
|
4590
4741
|
return {
|
|
4591
|
-
relativeDirPath:
|
|
4742
|
+
relativeDirPath: join44(".agents", "skills")
|
|
4592
4743
|
};
|
|
4593
4744
|
}
|
|
4594
4745
|
static async fromDir(params) {
|
|
@@ -4611,19 +4762,19 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
4611
4762
|
};
|
|
4612
4763
|
|
|
4613
4764
|
// src/features/skills/claudecode-skill.ts
|
|
4614
|
-
import { join as
|
|
4615
|
-
import { z as
|
|
4765
|
+
import { join as join46 } from "path";
|
|
4766
|
+
import { z as z20 } from "zod/mini";
|
|
4616
4767
|
|
|
4617
4768
|
// src/features/skills/rulesync-skill.ts
|
|
4618
|
-
import { join as
|
|
4619
|
-
import { z as
|
|
4620
|
-
var RulesyncSkillFrontmatterSchemaInternal =
|
|
4621
|
-
name:
|
|
4622
|
-
description:
|
|
4623
|
-
targets:
|
|
4624
|
-
claudecode:
|
|
4625
|
-
|
|
4626
|
-
"allowed-tools":
|
|
4769
|
+
import { join as join45 } from "path";
|
|
4770
|
+
import { z as z19 } from "zod/mini";
|
|
4771
|
+
var RulesyncSkillFrontmatterSchemaInternal = z19.object({
|
|
4772
|
+
name: z19.string(),
|
|
4773
|
+
description: z19.string(),
|
|
4774
|
+
targets: z19._default(RulesyncTargetsSchema, ["*"]),
|
|
4775
|
+
claudecode: z19.optional(
|
|
4776
|
+
z19.object({
|
|
4777
|
+
"allowed-tools": z19.optional(z19.array(z19.string()))
|
|
4627
4778
|
})
|
|
4628
4779
|
)
|
|
4629
4780
|
});
|
|
@@ -4691,8 +4842,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
4691
4842
|
dirName,
|
|
4692
4843
|
global = false
|
|
4693
4844
|
}) {
|
|
4694
|
-
const skillDirPath =
|
|
4695
|
-
const skillFilePath =
|
|
4845
|
+
const skillDirPath = join45(baseDir, relativeDirPath, dirName);
|
|
4846
|
+
const skillFilePath = join45(skillDirPath, SKILL_FILE_NAME);
|
|
4696
4847
|
if (!await fileExists(skillFilePath)) {
|
|
4697
4848
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
4698
4849
|
}
|
|
@@ -4722,15 +4873,15 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
4722
4873
|
};
|
|
4723
4874
|
|
|
4724
4875
|
// src/features/skills/claudecode-skill.ts
|
|
4725
|
-
var ClaudecodeSkillFrontmatterSchema =
|
|
4726
|
-
name:
|
|
4727
|
-
description:
|
|
4728
|
-
"allowed-tools":
|
|
4876
|
+
var ClaudecodeSkillFrontmatterSchema = z20.object({
|
|
4877
|
+
name: z20.string(),
|
|
4878
|
+
description: z20.string(),
|
|
4879
|
+
"allowed-tools": z20.optional(z20.array(z20.string()))
|
|
4729
4880
|
});
|
|
4730
4881
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
4731
4882
|
constructor({
|
|
4732
4883
|
baseDir = process.cwd(),
|
|
4733
|
-
relativeDirPath =
|
|
4884
|
+
relativeDirPath = join46(".claude", "skills"),
|
|
4734
4885
|
dirName,
|
|
4735
4886
|
frontmatter,
|
|
4736
4887
|
body,
|
|
@@ -4761,7 +4912,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
4761
4912
|
global: _global = false
|
|
4762
4913
|
} = {}) {
|
|
4763
4914
|
return {
|
|
4764
|
-
relativeDirPath:
|
|
4915
|
+
relativeDirPath: join46(".claude", "skills")
|
|
4765
4916
|
};
|
|
4766
4917
|
}
|
|
4767
4918
|
getFrontmatter() {
|
|
@@ -4849,8 +5000,8 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
4849
5000
|
}) {
|
|
4850
5001
|
const settablePaths = this.getSettablePaths({ global });
|
|
4851
5002
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
4852
|
-
const skillDirPath =
|
|
4853
|
-
const skillFilePath =
|
|
5003
|
+
const skillDirPath = join46(baseDir, actualRelativeDirPath, dirName);
|
|
5004
|
+
const skillFilePath = join46(skillDirPath, SKILL_FILE_NAME);
|
|
4854
5005
|
if (!await fileExists(skillFilePath)) {
|
|
4855
5006
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
4856
5007
|
}
|
|
@@ -4880,14 +5031,14 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
4880
5031
|
};
|
|
4881
5032
|
|
|
4882
5033
|
// src/features/skills/geminicli-skill.ts
|
|
4883
|
-
import { join as
|
|
5034
|
+
import { join as join47 } from "path";
|
|
4884
5035
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
4885
5036
|
static getSettablePaths(options) {
|
|
4886
5037
|
if (options?.global) {
|
|
4887
5038
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
4888
5039
|
}
|
|
4889
5040
|
return {
|
|
4890
|
-
relativeDirPath:
|
|
5041
|
+
relativeDirPath: join47(".gemini", "skills")
|
|
4891
5042
|
};
|
|
4892
5043
|
}
|
|
4893
5044
|
static async fromDir(params) {
|
|
@@ -4926,7 +5077,7 @@ var skillsProcessorToolTargetsSimulated = [
|
|
|
4926
5077
|
"agentsmd"
|
|
4927
5078
|
];
|
|
4928
5079
|
var skillsProcessorToolTargetsGlobal = ["claudecode"];
|
|
4929
|
-
var SkillsProcessorToolTargetSchema =
|
|
5080
|
+
var SkillsProcessorToolTargetSchema = z21.enum(skillsProcessorToolTargets);
|
|
4930
5081
|
var SkillsProcessor = class extends DirFeatureProcessor {
|
|
4931
5082
|
toolTarget;
|
|
4932
5083
|
global;
|
|
@@ -5037,9 +5188,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5037
5188
|
*/
|
|
5038
5189
|
async loadRulesyncDirs() {
|
|
5039
5190
|
const paths = RulesyncSkill.getSettablePaths();
|
|
5040
|
-
const rulesyncSkillsDirPath =
|
|
5041
|
-
const dirPaths = await findFilesByGlobs(
|
|
5042
|
-
const dirNames = dirPaths.map((path3) =>
|
|
5191
|
+
const rulesyncSkillsDirPath = join48(this.baseDir, paths.relativeDirPath);
|
|
5192
|
+
const dirPaths = await findFilesByGlobs(join48(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
5193
|
+
const dirNames = dirPaths.map((path3) => basename14(path3));
|
|
5043
5194
|
const rulesyncSkills = await Promise.all(
|
|
5044
5195
|
dirNames.map(
|
|
5045
5196
|
(dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
|
|
@@ -5078,9 +5229,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5078
5229
|
*/
|
|
5079
5230
|
async loadClaudecodeSkills() {
|
|
5080
5231
|
const paths = ClaudecodeSkill.getSettablePaths({ global: this.global });
|
|
5081
|
-
const skillsDirPath =
|
|
5082
|
-
const dirPaths = await findFilesByGlobs(
|
|
5083
|
-
const dirNames = dirPaths.map((path3) =>
|
|
5232
|
+
const skillsDirPath = join48(this.baseDir, paths.relativeDirPath);
|
|
5233
|
+
const dirPaths = await findFilesByGlobs(join48(skillsDirPath, "*"), { type: "dir" });
|
|
5234
|
+
const dirNames = dirPaths.map((path3) => basename14(path3));
|
|
5084
5235
|
const toolSkills = await Promise.all(
|
|
5085
5236
|
dirNames.map(
|
|
5086
5237
|
(dirName) => ClaudecodeSkill.fromDir({
|
|
@@ -5098,9 +5249,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5098
5249
|
*/
|
|
5099
5250
|
async loadSimulatedSkills(SkillClass) {
|
|
5100
5251
|
const paths = SkillClass.getSettablePaths();
|
|
5101
|
-
const skillsDirPath =
|
|
5102
|
-
const dirPaths = await findFilesByGlobs(
|
|
5103
|
-
const dirNames = dirPaths.map((path3) =>
|
|
5252
|
+
const skillsDirPath = join48(this.baseDir, paths.relativeDirPath);
|
|
5253
|
+
const dirPaths = await findFilesByGlobs(join48(skillsDirPath, "*"), { type: "dir" });
|
|
5254
|
+
const dirNames = dirPaths.map((path3) => basename14(path3));
|
|
5104
5255
|
const toolSkills = await Promise.all(
|
|
5105
5256
|
dirNames.map(
|
|
5106
5257
|
(dirName) => SkillClass.fromDir({
|
|
@@ -5145,11 +5296,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5145
5296
|
};
|
|
5146
5297
|
|
|
5147
5298
|
// src/features/subagents/agentsmd-subagent.ts
|
|
5148
|
-
import { join as
|
|
5299
|
+
import { join as join50 } from "path";
|
|
5149
5300
|
|
|
5150
5301
|
// src/features/subagents/simulated-subagent.ts
|
|
5151
|
-
import { basename as
|
|
5152
|
-
import { z as
|
|
5302
|
+
import { basename as basename15, join as join49 } from "path";
|
|
5303
|
+
import { z as z22 } from "zod/mini";
|
|
5153
5304
|
|
|
5154
5305
|
// src/features/subagents/tool-subagent.ts
|
|
5155
5306
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -5184,9 +5335,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
5184
5335
|
};
|
|
5185
5336
|
|
|
5186
5337
|
// src/features/subagents/simulated-subagent.ts
|
|
5187
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
5188
|
-
name:
|
|
5189
|
-
description:
|
|
5338
|
+
var SimulatedSubagentFrontmatterSchema = z22.object({
|
|
5339
|
+
name: z22.string(),
|
|
5340
|
+
description: z22.string()
|
|
5190
5341
|
});
|
|
5191
5342
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
5192
5343
|
frontmatter;
|
|
@@ -5196,7 +5347,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5196
5347
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5197
5348
|
if (!result.success) {
|
|
5198
5349
|
throw new Error(
|
|
5199
|
-
`Invalid frontmatter in ${
|
|
5350
|
+
`Invalid frontmatter in ${join49(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5200
5351
|
);
|
|
5201
5352
|
}
|
|
5202
5353
|
}
|
|
@@ -5247,7 +5398,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5247
5398
|
return {
|
|
5248
5399
|
success: false,
|
|
5249
5400
|
error: new Error(
|
|
5250
|
-
`Invalid frontmatter in ${
|
|
5401
|
+
`Invalid frontmatter in ${join49(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5251
5402
|
)
|
|
5252
5403
|
};
|
|
5253
5404
|
}
|
|
@@ -5257,7 +5408,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5257
5408
|
relativeFilePath,
|
|
5258
5409
|
validate = true
|
|
5259
5410
|
}) {
|
|
5260
|
-
const filePath =
|
|
5411
|
+
const filePath = join49(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
5261
5412
|
const fileContent = await readFileContent(filePath);
|
|
5262
5413
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5263
5414
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -5267,7 +5418,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5267
5418
|
return {
|
|
5268
5419
|
baseDir,
|
|
5269
5420
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
5270
|
-
relativeFilePath:
|
|
5421
|
+
relativeFilePath: basename15(relativeFilePath),
|
|
5271
5422
|
frontmatter: result.data,
|
|
5272
5423
|
body: content.trim(),
|
|
5273
5424
|
validate
|
|
@@ -5279,7 +5430,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5279
5430
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
5280
5431
|
static getSettablePaths() {
|
|
5281
5432
|
return {
|
|
5282
|
-
relativeDirPath:
|
|
5433
|
+
relativeDirPath: join50(".agents", "subagents")
|
|
5283
5434
|
};
|
|
5284
5435
|
}
|
|
5285
5436
|
static async fromFile(params) {
|
|
@@ -5299,11 +5450,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
5299
5450
|
};
|
|
5300
5451
|
|
|
5301
5452
|
// src/features/subagents/codexcli-subagent.ts
|
|
5302
|
-
import { join as
|
|
5453
|
+
import { join as join51 } from "path";
|
|
5303
5454
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
5304
5455
|
static getSettablePaths() {
|
|
5305
5456
|
return {
|
|
5306
|
-
relativeDirPath:
|
|
5457
|
+
relativeDirPath: join51(".codex", "subagents")
|
|
5307
5458
|
};
|
|
5308
5459
|
}
|
|
5309
5460
|
static async fromFile(params) {
|
|
@@ -5323,11 +5474,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
5323
5474
|
};
|
|
5324
5475
|
|
|
5325
5476
|
// src/features/subagents/copilot-subagent.ts
|
|
5326
|
-
import { join as
|
|
5477
|
+
import { join as join52 } from "path";
|
|
5327
5478
|
var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
5328
5479
|
static getSettablePaths() {
|
|
5329
5480
|
return {
|
|
5330
|
-
relativeDirPath:
|
|
5481
|
+
relativeDirPath: join52(".github", "subagents")
|
|
5331
5482
|
};
|
|
5332
5483
|
}
|
|
5333
5484
|
static async fromFile(params) {
|
|
@@ -5347,11 +5498,11 @@ var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
|
5347
5498
|
};
|
|
5348
5499
|
|
|
5349
5500
|
// src/features/subagents/cursor-subagent.ts
|
|
5350
|
-
import { join as
|
|
5501
|
+
import { join as join53 } from "path";
|
|
5351
5502
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
5352
5503
|
static getSettablePaths() {
|
|
5353
5504
|
return {
|
|
5354
|
-
relativeDirPath:
|
|
5505
|
+
relativeDirPath: join53(".cursor", "subagents")
|
|
5355
5506
|
};
|
|
5356
5507
|
}
|
|
5357
5508
|
static async fromFile(params) {
|
|
@@ -5371,11 +5522,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
5371
5522
|
};
|
|
5372
5523
|
|
|
5373
5524
|
// src/features/subagents/geminicli-subagent.ts
|
|
5374
|
-
import { join as
|
|
5525
|
+
import { join as join54 } from "path";
|
|
5375
5526
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
5376
5527
|
static getSettablePaths() {
|
|
5377
5528
|
return {
|
|
5378
|
-
relativeDirPath:
|
|
5529
|
+
relativeDirPath: join54(".gemini", "subagents")
|
|
5379
5530
|
};
|
|
5380
5531
|
}
|
|
5381
5532
|
static async fromFile(params) {
|
|
@@ -5395,11 +5546,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
5395
5546
|
};
|
|
5396
5547
|
|
|
5397
5548
|
// src/features/subagents/roo-subagent.ts
|
|
5398
|
-
import { join as
|
|
5549
|
+
import { join as join55 } from "path";
|
|
5399
5550
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
5400
5551
|
static getSettablePaths() {
|
|
5401
5552
|
return {
|
|
5402
|
-
relativeDirPath:
|
|
5553
|
+
relativeDirPath: join55(".roo", "subagents")
|
|
5403
5554
|
};
|
|
5404
5555
|
}
|
|
5405
5556
|
static async fromFile(params) {
|
|
@@ -5419,23 +5570,23 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
5419
5570
|
};
|
|
5420
5571
|
|
|
5421
5572
|
// src/features/subagents/subagents-processor.ts
|
|
5422
|
-
import { basename as
|
|
5423
|
-
import { z as
|
|
5573
|
+
import { basename as basename17, join as join58 } from "path";
|
|
5574
|
+
import { z as z25 } from "zod/mini";
|
|
5424
5575
|
|
|
5425
5576
|
// src/features/subagents/claudecode-subagent.ts
|
|
5426
|
-
import { join as
|
|
5427
|
-
import { z as
|
|
5577
|
+
import { join as join57 } from "path";
|
|
5578
|
+
import { z as z24 } from "zod/mini";
|
|
5428
5579
|
|
|
5429
5580
|
// src/features/subagents/rulesync-subagent.ts
|
|
5430
|
-
import { basename as
|
|
5431
|
-
import { z as
|
|
5432
|
-
var RulesyncSubagentModelSchema =
|
|
5433
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
5581
|
+
import { basename as basename16, join as join56 } from "path";
|
|
5582
|
+
import { z as z23 } from "zod/mini";
|
|
5583
|
+
var RulesyncSubagentModelSchema = z23.enum(["opus", "sonnet", "haiku", "inherit"]);
|
|
5584
|
+
var RulesyncSubagentFrontmatterSchema = z23.object({
|
|
5434
5585
|
targets: RulesyncTargetsSchema,
|
|
5435
|
-
name:
|
|
5436
|
-
description:
|
|
5437
|
-
claudecode:
|
|
5438
|
-
|
|
5586
|
+
name: z23.string(),
|
|
5587
|
+
description: z23.string(),
|
|
5588
|
+
claudecode: z23.optional(
|
|
5589
|
+
z23.object({
|
|
5439
5590
|
model: RulesyncSubagentModelSchema
|
|
5440
5591
|
})
|
|
5441
5592
|
)
|
|
@@ -5448,7 +5599,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5448
5599
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5449
5600
|
if (!result.success) {
|
|
5450
5601
|
throw new Error(
|
|
5451
|
-
`Invalid frontmatter in ${
|
|
5602
|
+
`Invalid frontmatter in ${join56(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5452
5603
|
);
|
|
5453
5604
|
}
|
|
5454
5605
|
}
|
|
@@ -5481,7 +5632,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5481
5632
|
return {
|
|
5482
5633
|
success: false,
|
|
5483
5634
|
error: new Error(
|
|
5484
|
-
`Invalid frontmatter in ${
|
|
5635
|
+
`Invalid frontmatter in ${join56(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5485
5636
|
)
|
|
5486
5637
|
};
|
|
5487
5638
|
}
|
|
@@ -5490,14 +5641,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5490
5641
|
relativeFilePath
|
|
5491
5642
|
}) {
|
|
5492
5643
|
const fileContent = await readFileContent(
|
|
5493
|
-
|
|
5644
|
+
join56(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
5494
5645
|
);
|
|
5495
5646
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5496
5647
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5497
5648
|
if (!result.success) {
|
|
5498
5649
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
5499
5650
|
}
|
|
5500
|
-
const filename =
|
|
5651
|
+
const filename = basename16(relativeFilePath);
|
|
5501
5652
|
return new _RulesyncSubagent({
|
|
5502
5653
|
baseDir: process.cwd(),
|
|
5503
5654
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -5509,10 +5660,10 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5509
5660
|
};
|
|
5510
5661
|
|
|
5511
5662
|
// src/features/subagents/claudecode-subagent.ts
|
|
5512
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
5513
|
-
name:
|
|
5514
|
-
description:
|
|
5515
|
-
model:
|
|
5663
|
+
var ClaudecodeSubagentFrontmatterSchema = z24.object({
|
|
5664
|
+
name: z24.string(),
|
|
5665
|
+
description: z24.string(),
|
|
5666
|
+
model: z24.optional(z24.enum(["opus", "sonnet", "haiku", "inherit"]))
|
|
5516
5667
|
});
|
|
5517
5668
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
5518
5669
|
frontmatter;
|
|
@@ -5522,7 +5673,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5522
5673
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5523
5674
|
if (!result.success) {
|
|
5524
5675
|
throw new Error(
|
|
5525
|
-
`Invalid frontmatter in ${
|
|
5676
|
+
`Invalid frontmatter in ${join57(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5526
5677
|
);
|
|
5527
5678
|
}
|
|
5528
5679
|
}
|
|
@@ -5534,7 +5685,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5534
5685
|
}
|
|
5535
5686
|
static getSettablePaths(_options = {}) {
|
|
5536
5687
|
return {
|
|
5537
|
-
relativeDirPath:
|
|
5688
|
+
relativeDirPath: join57(".claude", "agents")
|
|
5538
5689
|
};
|
|
5539
5690
|
}
|
|
5540
5691
|
getFrontmatter() {
|
|
@@ -5600,7 +5751,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5600
5751
|
return {
|
|
5601
5752
|
success: false,
|
|
5602
5753
|
error: new Error(
|
|
5603
|
-
`Invalid frontmatter in ${
|
|
5754
|
+
`Invalid frontmatter in ${join57(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5604
5755
|
)
|
|
5605
5756
|
};
|
|
5606
5757
|
}
|
|
@@ -5618,7 +5769,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5618
5769
|
global = false
|
|
5619
5770
|
}) {
|
|
5620
5771
|
const paths = this.getSettablePaths({ global });
|
|
5621
|
-
const filePath =
|
|
5772
|
+
const filePath = join57(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
5622
5773
|
const fileContent = await readFileContent(filePath);
|
|
5623
5774
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5624
5775
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -5656,7 +5807,7 @@ var subagentsProcessorToolTargetsSimulated = [
|
|
|
5656
5807
|
"roo"
|
|
5657
5808
|
];
|
|
5658
5809
|
var subagentsProcessorToolTargetsGlobal = ["claudecode"];
|
|
5659
|
-
var SubagentsProcessorToolTargetSchema =
|
|
5810
|
+
var SubagentsProcessorToolTargetSchema = z25.enum(subagentsProcessorToolTargets);
|
|
5660
5811
|
var SubagentsProcessor = class extends FeatureProcessor {
|
|
5661
5812
|
toolTarget;
|
|
5662
5813
|
global;
|
|
@@ -5772,7 +5923,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
5772
5923
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
5773
5924
|
*/
|
|
5774
5925
|
async loadRulesyncFiles() {
|
|
5775
|
-
const subagentsDir =
|
|
5926
|
+
const subagentsDir = join58(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
5776
5927
|
const dirExists = await directoryExists(subagentsDir);
|
|
5777
5928
|
if (!dirExists) {
|
|
5778
5929
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -5787,7 +5938,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
5787
5938
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
5788
5939
|
const rulesyncSubagents = [];
|
|
5789
5940
|
for (const mdFile of mdFiles) {
|
|
5790
|
-
const filepath =
|
|
5941
|
+
const filepath = join58(subagentsDir, mdFile);
|
|
5791
5942
|
try {
|
|
5792
5943
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
5793
5944
|
relativeFilePath: mdFile,
|
|
@@ -5905,8 +6056,8 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
5905
6056
|
relativeDirPath,
|
|
5906
6057
|
fromFile
|
|
5907
6058
|
}) {
|
|
5908
|
-
const paths = await findFilesByGlobs(
|
|
5909
|
-
const subagents = await Promise.all(paths.map((path3) => fromFile(
|
|
6059
|
+
const paths = await findFilesByGlobs(join58(this.baseDir, relativeDirPath, "*.md"));
|
|
6060
|
+
const subagents = await Promise.all(paths.map((path3) => fromFile(basename17(path3))));
|
|
5910
6061
|
logger.info(`Successfully loaded ${subagents.length} ${relativeDirPath} subagents`);
|
|
5911
6062
|
return subagents;
|
|
5912
6063
|
}
|
|
@@ -5934,30 +6085,30 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
5934
6085
|
};
|
|
5935
6086
|
|
|
5936
6087
|
// src/features/rules/agentsmd-rule.ts
|
|
5937
|
-
import { join as
|
|
6088
|
+
import { join as join61 } from "path";
|
|
5938
6089
|
|
|
5939
6090
|
// src/features/rules/tool-rule.ts
|
|
5940
|
-
import { join as
|
|
6091
|
+
import { join as join60 } from "path";
|
|
5941
6092
|
|
|
5942
6093
|
// src/features/rules/rulesync-rule.ts
|
|
5943
|
-
import { basename as
|
|
5944
|
-
import { z as
|
|
5945
|
-
var RulesyncRuleFrontmatterSchema =
|
|
5946
|
-
root:
|
|
5947
|
-
targets:
|
|
5948
|
-
description:
|
|
5949
|
-
globs:
|
|
5950
|
-
agentsmd:
|
|
5951
|
-
|
|
6094
|
+
import { basename as basename18, join as join59 } from "path";
|
|
6095
|
+
import { z as z26 } from "zod/mini";
|
|
6096
|
+
var RulesyncRuleFrontmatterSchema = z26.object({
|
|
6097
|
+
root: z26.optional(z26.optional(z26.boolean())),
|
|
6098
|
+
targets: z26.optional(RulesyncTargetsSchema),
|
|
6099
|
+
description: z26.optional(z26.string()),
|
|
6100
|
+
globs: z26.optional(z26.array(z26.string())),
|
|
6101
|
+
agentsmd: z26.optional(
|
|
6102
|
+
z26.object({
|
|
5952
6103
|
// @example "path/to/subproject"
|
|
5953
|
-
subprojectPath:
|
|
6104
|
+
subprojectPath: z26.optional(z26.string())
|
|
5954
6105
|
})
|
|
5955
6106
|
),
|
|
5956
|
-
cursor:
|
|
5957
|
-
|
|
5958
|
-
alwaysApply:
|
|
5959
|
-
description:
|
|
5960
|
-
globs:
|
|
6107
|
+
cursor: z26.optional(
|
|
6108
|
+
z26.object({
|
|
6109
|
+
alwaysApply: z26.optional(z26.boolean()),
|
|
6110
|
+
description: z26.optional(z26.string()),
|
|
6111
|
+
globs: z26.optional(z26.array(z26.string()))
|
|
5961
6112
|
})
|
|
5962
6113
|
)
|
|
5963
6114
|
});
|
|
@@ -5969,7 +6120,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
5969
6120
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
5970
6121
|
if (!result.success) {
|
|
5971
6122
|
throw new Error(
|
|
5972
|
-
`Invalid frontmatter in ${
|
|
6123
|
+
`Invalid frontmatter in ${join59(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5973
6124
|
);
|
|
5974
6125
|
}
|
|
5975
6126
|
}
|
|
@@ -6004,7 +6155,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6004
6155
|
return {
|
|
6005
6156
|
success: false,
|
|
6006
6157
|
error: new Error(
|
|
6007
|
-
`Invalid frontmatter in ${
|
|
6158
|
+
`Invalid frontmatter in ${join59(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
6008
6159
|
)
|
|
6009
6160
|
};
|
|
6010
6161
|
}
|
|
@@ -6013,12 +6164,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6013
6164
|
relativeFilePath,
|
|
6014
6165
|
validate = true
|
|
6015
6166
|
}) {
|
|
6016
|
-
const legacyPath =
|
|
6167
|
+
const legacyPath = join59(
|
|
6017
6168
|
process.cwd(),
|
|
6018
6169
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
6019
6170
|
relativeFilePath
|
|
6020
6171
|
);
|
|
6021
|
-
const recommendedPath =
|
|
6172
|
+
const recommendedPath = join59(
|
|
6022
6173
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
6023
6174
|
relativeFilePath
|
|
6024
6175
|
);
|
|
@@ -6037,7 +6188,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6037
6188
|
agentsmd: result.data.agentsmd,
|
|
6038
6189
|
cursor: result.data.cursor
|
|
6039
6190
|
};
|
|
6040
|
-
const filename =
|
|
6191
|
+
const filename = basename18(legacyPath);
|
|
6041
6192
|
return new _RulesyncRule({
|
|
6042
6193
|
baseDir: process.cwd(),
|
|
6043
6194
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -6051,7 +6202,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6051
6202
|
relativeFilePath,
|
|
6052
6203
|
validate = true
|
|
6053
6204
|
}) {
|
|
6054
|
-
const filePath =
|
|
6205
|
+
const filePath = join59(
|
|
6055
6206
|
process.cwd(),
|
|
6056
6207
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
6057
6208
|
relativeFilePath
|
|
@@ -6070,7 +6221,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6070
6221
|
agentsmd: result.data.agentsmd,
|
|
6071
6222
|
cursor: result.data.cursor
|
|
6072
6223
|
};
|
|
6073
|
-
const filename =
|
|
6224
|
+
const filename = basename18(filePath);
|
|
6074
6225
|
return new _RulesyncRule({
|
|
6075
6226
|
baseDir: process.cwd(),
|
|
6076
6227
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -6145,7 +6296,7 @@ var ToolRule = class extends ToolFile {
|
|
|
6145
6296
|
rulesyncRule,
|
|
6146
6297
|
validate = true,
|
|
6147
6298
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
6148
|
-
nonRootPath = { relativeDirPath:
|
|
6299
|
+
nonRootPath = { relativeDirPath: join60(".agents", "memories") }
|
|
6149
6300
|
}) {
|
|
6150
6301
|
const params = this.buildToolRuleParamsDefault({
|
|
6151
6302
|
baseDir,
|
|
@@ -6156,7 +6307,7 @@ var ToolRule = class extends ToolFile {
|
|
|
6156
6307
|
});
|
|
6157
6308
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
6158
6309
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
6159
|
-
params.relativeDirPath =
|
|
6310
|
+
params.relativeDirPath = join60(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
6160
6311
|
params.relativeFilePath = "AGENTS.md";
|
|
6161
6312
|
}
|
|
6162
6313
|
return params;
|
|
@@ -6221,7 +6372,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6221
6372
|
relativeFilePath: "AGENTS.md"
|
|
6222
6373
|
},
|
|
6223
6374
|
nonRoot: {
|
|
6224
|
-
relativeDirPath:
|
|
6375
|
+
relativeDirPath: join61(".agents", "memories")
|
|
6225
6376
|
}
|
|
6226
6377
|
};
|
|
6227
6378
|
}
|
|
@@ -6231,8 +6382,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6231
6382
|
validate = true
|
|
6232
6383
|
}) {
|
|
6233
6384
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
6234
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
6235
|
-
const fileContent = await readFileContent(
|
|
6385
|
+
const relativePath = isRoot ? "AGENTS.md" : join61(".agents", "memories", relativeFilePath);
|
|
6386
|
+
const fileContent = await readFileContent(join61(baseDir, relativePath));
|
|
6236
6387
|
return new _AgentsMdRule({
|
|
6237
6388
|
baseDir,
|
|
6238
6389
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -6272,12 +6423,12 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6272
6423
|
};
|
|
6273
6424
|
|
|
6274
6425
|
// src/features/rules/amazonqcli-rule.ts
|
|
6275
|
-
import { join as
|
|
6426
|
+
import { join as join62 } from "path";
|
|
6276
6427
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
6277
6428
|
static getSettablePaths() {
|
|
6278
6429
|
return {
|
|
6279
6430
|
nonRoot: {
|
|
6280
|
-
relativeDirPath:
|
|
6431
|
+
relativeDirPath: join62(".amazonq", "rules")
|
|
6281
6432
|
}
|
|
6282
6433
|
};
|
|
6283
6434
|
}
|
|
@@ -6287,7 +6438,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
6287
6438
|
validate = true
|
|
6288
6439
|
}) {
|
|
6289
6440
|
const fileContent = await readFileContent(
|
|
6290
|
-
|
|
6441
|
+
join62(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6291
6442
|
);
|
|
6292
6443
|
return new _AmazonQCliRule({
|
|
6293
6444
|
baseDir,
|
|
@@ -6326,8 +6477,63 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
6326
6477
|
}
|
|
6327
6478
|
};
|
|
6328
6479
|
|
|
6480
|
+
// src/features/rules/antigravity-rule.ts
|
|
6481
|
+
import { join as join63 } from "path";
|
|
6482
|
+
var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
6483
|
+
static getSettablePaths() {
|
|
6484
|
+
return {
|
|
6485
|
+
nonRoot: {
|
|
6486
|
+
relativeDirPath: join63(".agent", "rules")
|
|
6487
|
+
}
|
|
6488
|
+
};
|
|
6489
|
+
}
|
|
6490
|
+
static async fromFile({
|
|
6491
|
+
baseDir = process.cwd(),
|
|
6492
|
+
relativeFilePath,
|
|
6493
|
+
validate = true
|
|
6494
|
+
}) {
|
|
6495
|
+
const fileContent = await readFileContent(
|
|
6496
|
+
join63(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6497
|
+
);
|
|
6498
|
+
return new _AntigravityRule({
|
|
6499
|
+
baseDir,
|
|
6500
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
6501
|
+
relativeFilePath,
|
|
6502
|
+
fileContent,
|
|
6503
|
+
validate,
|
|
6504
|
+
root: false
|
|
6505
|
+
});
|
|
6506
|
+
}
|
|
6507
|
+
static fromRulesyncRule({
|
|
6508
|
+
baseDir = process.cwd(),
|
|
6509
|
+
rulesyncRule,
|
|
6510
|
+
validate = true
|
|
6511
|
+
}) {
|
|
6512
|
+
return new _AntigravityRule(
|
|
6513
|
+
this.buildToolRuleParamsDefault({
|
|
6514
|
+
baseDir,
|
|
6515
|
+
rulesyncRule,
|
|
6516
|
+
validate,
|
|
6517
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
6518
|
+
})
|
|
6519
|
+
);
|
|
6520
|
+
}
|
|
6521
|
+
toRulesyncRule() {
|
|
6522
|
+
return this.toRulesyncRuleDefault();
|
|
6523
|
+
}
|
|
6524
|
+
validate() {
|
|
6525
|
+
return { success: true, error: null };
|
|
6526
|
+
}
|
|
6527
|
+
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
6528
|
+
return this.isTargetedByRulesyncRuleDefault({
|
|
6529
|
+
rulesyncRule,
|
|
6530
|
+
toolTarget: "antigravity"
|
|
6531
|
+
});
|
|
6532
|
+
}
|
|
6533
|
+
};
|
|
6534
|
+
|
|
6329
6535
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
6330
|
-
import { join as
|
|
6536
|
+
import { join as join64 } from "path";
|
|
6331
6537
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
6332
6538
|
toRulesyncRule() {
|
|
6333
6539
|
const rulesyncFrontmatter = {
|
|
@@ -6353,7 +6559,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6353
6559
|
relativeFilePath: ".augment-guidelines"
|
|
6354
6560
|
},
|
|
6355
6561
|
nonRoot: {
|
|
6356
|
-
relativeDirPath:
|
|
6562
|
+
relativeDirPath: join64(".augment", "rules")
|
|
6357
6563
|
}
|
|
6358
6564
|
};
|
|
6359
6565
|
}
|
|
@@ -6388,8 +6594,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6388
6594
|
}) {
|
|
6389
6595
|
const settablePaths = this.getSettablePaths();
|
|
6390
6596
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
6391
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
6392
|
-
const fileContent = await readFileContent(
|
|
6597
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join64(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
6598
|
+
const fileContent = await readFileContent(join64(baseDir, relativePath));
|
|
6393
6599
|
return new _AugmentcodeLegacyRule({
|
|
6394
6600
|
baseDir,
|
|
6395
6601
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -6402,7 +6608,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6402
6608
|
};
|
|
6403
6609
|
|
|
6404
6610
|
// src/features/rules/augmentcode-rule.ts
|
|
6405
|
-
import { join as
|
|
6611
|
+
import { join as join65 } from "path";
|
|
6406
6612
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
6407
6613
|
toRulesyncRule() {
|
|
6408
6614
|
return this.toRulesyncRuleDefault();
|
|
@@ -6410,7 +6616,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6410
6616
|
static getSettablePaths() {
|
|
6411
6617
|
return {
|
|
6412
6618
|
nonRoot: {
|
|
6413
|
-
relativeDirPath:
|
|
6619
|
+
relativeDirPath: join65(".augment", "rules")
|
|
6414
6620
|
}
|
|
6415
6621
|
};
|
|
6416
6622
|
}
|
|
@@ -6434,7 +6640,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6434
6640
|
validate = true
|
|
6435
6641
|
}) {
|
|
6436
6642
|
const fileContent = await readFileContent(
|
|
6437
|
-
|
|
6643
|
+
join65(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6438
6644
|
);
|
|
6439
6645
|
const { body: content } = parseFrontmatter(fileContent);
|
|
6440
6646
|
return new _AugmentcodeRule({
|
|
@@ -6457,7 +6663,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6457
6663
|
};
|
|
6458
6664
|
|
|
6459
6665
|
// src/features/rules/claudecode-rule.ts
|
|
6460
|
-
import { join as
|
|
6666
|
+
import { join as join66 } from "path";
|
|
6461
6667
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
6462
6668
|
static getSettablePaths({
|
|
6463
6669
|
global
|
|
@@ -6476,7 +6682,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6476
6682
|
relativeFilePath: "CLAUDE.md"
|
|
6477
6683
|
},
|
|
6478
6684
|
nonRoot: {
|
|
6479
|
-
relativeDirPath:
|
|
6685
|
+
relativeDirPath: join66(".claude", "memories")
|
|
6480
6686
|
}
|
|
6481
6687
|
};
|
|
6482
6688
|
}
|
|
@@ -6491,7 +6697,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6491
6697
|
if (isRoot) {
|
|
6492
6698
|
const relativePath2 = paths.root.relativeFilePath;
|
|
6493
6699
|
const fileContent2 = await readFileContent(
|
|
6494
|
-
|
|
6700
|
+
join66(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
6495
6701
|
);
|
|
6496
6702
|
return new _ClaudecodeRule({
|
|
6497
6703
|
baseDir,
|
|
@@ -6505,8 +6711,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6505
6711
|
if (!paths.nonRoot) {
|
|
6506
6712
|
throw new Error("nonRoot path is not set");
|
|
6507
6713
|
}
|
|
6508
|
-
const relativePath =
|
|
6509
|
-
const fileContent = await readFileContent(
|
|
6714
|
+
const relativePath = join66(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
6715
|
+
const fileContent = await readFileContent(join66(baseDir, relativePath));
|
|
6510
6716
|
return new _ClaudecodeRule({
|
|
6511
6717
|
baseDir,
|
|
6512
6718
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -6548,10 +6754,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6548
6754
|
};
|
|
6549
6755
|
|
|
6550
6756
|
// src/features/rules/cline-rule.ts
|
|
6551
|
-
import { join as
|
|
6552
|
-
import { z as
|
|
6553
|
-
var ClineRuleFrontmatterSchema =
|
|
6554
|
-
description:
|
|
6757
|
+
import { join as join67 } from "path";
|
|
6758
|
+
import { z as z27 } from "zod/mini";
|
|
6759
|
+
var ClineRuleFrontmatterSchema = z27.object({
|
|
6760
|
+
description: z27.string()
|
|
6555
6761
|
});
|
|
6556
6762
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
6557
6763
|
static getSettablePaths() {
|
|
@@ -6593,7 +6799,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
6593
6799
|
validate = true
|
|
6594
6800
|
}) {
|
|
6595
6801
|
const fileContent = await readFileContent(
|
|
6596
|
-
|
|
6802
|
+
join67(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6597
6803
|
);
|
|
6598
6804
|
return new _ClineRule({
|
|
6599
6805
|
baseDir,
|
|
@@ -6606,7 +6812,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
6606
6812
|
};
|
|
6607
6813
|
|
|
6608
6814
|
// src/features/rules/codexcli-rule.ts
|
|
6609
|
-
import { join as
|
|
6815
|
+
import { join as join68 } from "path";
|
|
6610
6816
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
6611
6817
|
static getSettablePaths({
|
|
6612
6818
|
global
|
|
@@ -6625,7 +6831,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
6625
6831
|
relativeFilePath: "AGENTS.md"
|
|
6626
6832
|
},
|
|
6627
6833
|
nonRoot: {
|
|
6628
|
-
relativeDirPath:
|
|
6834
|
+
relativeDirPath: join68(".codex", "memories")
|
|
6629
6835
|
}
|
|
6630
6836
|
};
|
|
6631
6837
|
}
|
|
@@ -6640,7 +6846,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
6640
6846
|
if (isRoot) {
|
|
6641
6847
|
const relativePath2 = paths.root.relativeFilePath;
|
|
6642
6848
|
const fileContent2 = await readFileContent(
|
|
6643
|
-
|
|
6849
|
+
join68(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
6644
6850
|
);
|
|
6645
6851
|
return new _CodexcliRule({
|
|
6646
6852
|
baseDir,
|
|
@@ -6654,8 +6860,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
6654
6860
|
if (!paths.nonRoot) {
|
|
6655
6861
|
throw new Error("nonRoot path is not set");
|
|
6656
6862
|
}
|
|
6657
|
-
const relativePath =
|
|
6658
|
-
const fileContent = await readFileContent(
|
|
6863
|
+
const relativePath = join68(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
6864
|
+
const fileContent = await readFileContent(join68(baseDir, relativePath));
|
|
6659
6865
|
return new _CodexcliRule({
|
|
6660
6866
|
baseDir,
|
|
6661
6867
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -6697,11 +6903,11 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
6697
6903
|
};
|
|
6698
6904
|
|
|
6699
6905
|
// src/features/rules/copilot-rule.ts
|
|
6700
|
-
import { join as
|
|
6701
|
-
import { z as
|
|
6702
|
-
var CopilotRuleFrontmatterSchema =
|
|
6703
|
-
description:
|
|
6704
|
-
applyTo:
|
|
6906
|
+
import { join as join69 } from "path";
|
|
6907
|
+
import { z as z28 } from "zod/mini";
|
|
6908
|
+
var CopilotRuleFrontmatterSchema = z28.object({
|
|
6909
|
+
description: z28.optional(z28.string()),
|
|
6910
|
+
applyTo: z28.optional(z28.string())
|
|
6705
6911
|
});
|
|
6706
6912
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
6707
6913
|
frontmatter;
|
|
@@ -6713,7 +6919,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6713
6919
|
relativeFilePath: "copilot-instructions.md"
|
|
6714
6920
|
},
|
|
6715
6921
|
nonRoot: {
|
|
6716
|
-
relativeDirPath:
|
|
6922
|
+
relativeDirPath: join69(".github", "instructions")
|
|
6717
6923
|
}
|
|
6718
6924
|
};
|
|
6719
6925
|
}
|
|
@@ -6722,7 +6928,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6722
6928
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
6723
6929
|
if (!result.success) {
|
|
6724
6930
|
throw new Error(
|
|
6725
|
-
`Invalid frontmatter in ${
|
|
6931
|
+
`Invalid frontmatter in ${join69(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6726
6932
|
);
|
|
6727
6933
|
}
|
|
6728
6934
|
}
|
|
@@ -6800,11 +7006,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6800
7006
|
validate = true
|
|
6801
7007
|
}) {
|
|
6802
7008
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
6803
|
-
const relativePath = isRoot ?
|
|
7009
|
+
const relativePath = isRoot ? join69(
|
|
6804
7010
|
this.getSettablePaths().root.relativeDirPath,
|
|
6805
7011
|
this.getSettablePaths().root.relativeFilePath
|
|
6806
|
-
) :
|
|
6807
|
-
const fileContent = await readFileContent(
|
|
7012
|
+
) : join69(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
7013
|
+
const fileContent = await readFileContent(join69(baseDir, relativePath));
|
|
6808
7014
|
if (isRoot) {
|
|
6809
7015
|
return new _CopilotRule({
|
|
6810
7016
|
baseDir,
|
|
@@ -6823,7 +7029,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6823
7029
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
6824
7030
|
if (!result.success) {
|
|
6825
7031
|
throw new Error(
|
|
6826
|
-
`Invalid frontmatter in ${
|
|
7032
|
+
`Invalid frontmatter in ${join69(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
6827
7033
|
);
|
|
6828
7034
|
}
|
|
6829
7035
|
return new _CopilotRule({
|
|
@@ -6847,7 +7053,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6847
7053
|
return {
|
|
6848
7054
|
success: false,
|
|
6849
7055
|
error: new Error(
|
|
6850
|
-
`Invalid frontmatter in ${
|
|
7056
|
+
`Invalid frontmatter in ${join69(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
6851
7057
|
)
|
|
6852
7058
|
};
|
|
6853
7059
|
}
|
|
@@ -6867,12 +7073,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6867
7073
|
};
|
|
6868
7074
|
|
|
6869
7075
|
// src/features/rules/cursor-rule.ts
|
|
6870
|
-
import { basename as
|
|
6871
|
-
import { z as
|
|
6872
|
-
var CursorRuleFrontmatterSchema =
|
|
6873
|
-
description:
|
|
6874
|
-
globs:
|
|
6875
|
-
alwaysApply:
|
|
7076
|
+
import { basename as basename19, join as join70 } from "path";
|
|
7077
|
+
import { z as z29 } from "zod/mini";
|
|
7078
|
+
var CursorRuleFrontmatterSchema = z29.object({
|
|
7079
|
+
description: z29.optional(z29.string()),
|
|
7080
|
+
globs: z29.optional(z29.string()),
|
|
7081
|
+
alwaysApply: z29.optional(z29.boolean())
|
|
6876
7082
|
});
|
|
6877
7083
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
6878
7084
|
frontmatter;
|
|
@@ -6880,7 +7086,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
6880
7086
|
static getSettablePaths() {
|
|
6881
7087
|
return {
|
|
6882
7088
|
nonRoot: {
|
|
6883
|
-
relativeDirPath:
|
|
7089
|
+
relativeDirPath: join70(".cursor", "rules")
|
|
6884
7090
|
}
|
|
6885
7091
|
};
|
|
6886
7092
|
}
|
|
@@ -6889,7 +7095,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
6889
7095
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
6890
7096
|
if (!result.success) {
|
|
6891
7097
|
throw new Error(
|
|
6892
|
-
`Invalid frontmatter in ${
|
|
7098
|
+
`Invalid frontmatter in ${join70(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6893
7099
|
);
|
|
6894
7100
|
}
|
|
6895
7101
|
}
|
|
@@ -7006,19 +7212,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7006
7212
|
validate = true
|
|
7007
7213
|
}) {
|
|
7008
7214
|
const fileContent = await readFileContent(
|
|
7009
|
-
|
|
7215
|
+
join70(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7010
7216
|
);
|
|
7011
7217
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
7012
7218
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7013
7219
|
if (!result.success) {
|
|
7014
7220
|
throw new Error(
|
|
7015
|
-
`Invalid frontmatter in ${
|
|
7221
|
+
`Invalid frontmatter in ${join70(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
7016
7222
|
);
|
|
7017
7223
|
}
|
|
7018
7224
|
return new _CursorRule({
|
|
7019
7225
|
baseDir,
|
|
7020
7226
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
7021
|
-
relativeFilePath:
|
|
7227
|
+
relativeFilePath: basename19(relativeFilePath),
|
|
7022
7228
|
frontmatter: result.data,
|
|
7023
7229
|
body: content.trim(),
|
|
7024
7230
|
validate
|
|
@@ -7035,7 +7241,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7035
7241
|
return {
|
|
7036
7242
|
success: false,
|
|
7037
7243
|
error: new Error(
|
|
7038
|
-
`Invalid frontmatter in ${
|
|
7244
|
+
`Invalid frontmatter in ${join70(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7039
7245
|
)
|
|
7040
7246
|
};
|
|
7041
7247
|
}
|
|
@@ -7055,7 +7261,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7055
7261
|
};
|
|
7056
7262
|
|
|
7057
7263
|
// src/features/rules/geminicli-rule.ts
|
|
7058
|
-
import { join as
|
|
7264
|
+
import { join as join71 } from "path";
|
|
7059
7265
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
7060
7266
|
static getSettablePaths({
|
|
7061
7267
|
global
|
|
@@ -7074,7 +7280,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7074
7280
|
relativeFilePath: "GEMINI.md"
|
|
7075
7281
|
},
|
|
7076
7282
|
nonRoot: {
|
|
7077
|
-
relativeDirPath:
|
|
7283
|
+
relativeDirPath: join71(".gemini", "memories")
|
|
7078
7284
|
}
|
|
7079
7285
|
};
|
|
7080
7286
|
}
|
|
@@ -7089,7 +7295,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7089
7295
|
if (isRoot) {
|
|
7090
7296
|
const relativePath2 = paths.root.relativeFilePath;
|
|
7091
7297
|
const fileContent2 = await readFileContent(
|
|
7092
|
-
|
|
7298
|
+
join71(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
7093
7299
|
);
|
|
7094
7300
|
return new _GeminiCliRule({
|
|
7095
7301
|
baseDir,
|
|
@@ -7103,8 +7309,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7103
7309
|
if (!paths.nonRoot) {
|
|
7104
7310
|
throw new Error("nonRoot path is not set");
|
|
7105
7311
|
}
|
|
7106
|
-
const relativePath =
|
|
7107
|
-
const fileContent = await readFileContent(
|
|
7312
|
+
const relativePath = join71(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
7313
|
+
const fileContent = await readFileContent(join71(baseDir, relativePath));
|
|
7108
7314
|
return new _GeminiCliRule({
|
|
7109
7315
|
baseDir,
|
|
7110
7316
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -7146,7 +7352,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7146
7352
|
};
|
|
7147
7353
|
|
|
7148
7354
|
// src/features/rules/junie-rule.ts
|
|
7149
|
-
import { join as
|
|
7355
|
+
import { join as join72 } from "path";
|
|
7150
7356
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
7151
7357
|
static getSettablePaths() {
|
|
7152
7358
|
return {
|
|
@@ -7155,7 +7361,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7155
7361
|
relativeFilePath: "guidelines.md"
|
|
7156
7362
|
},
|
|
7157
7363
|
nonRoot: {
|
|
7158
|
-
relativeDirPath:
|
|
7364
|
+
relativeDirPath: join72(".junie", "memories")
|
|
7159
7365
|
}
|
|
7160
7366
|
};
|
|
7161
7367
|
}
|
|
@@ -7165,8 +7371,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7165
7371
|
validate = true
|
|
7166
7372
|
}) {
|
|
7167
7373
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
7168
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
7169
|
-
const fileContent = await readFileContent(
|
|
7374
|
+
const relativePath = isRoot ? "guidelines.md" : join72(".junie", "memories", relativeFilePath);
|
|
7375
|
+
const fileContent = await readFileContent(join72(baseDir, relativePath));
|
|
7170
7376
|
return new _JunieRule({
|
|
7171
7377
|
baseDir,
|
|
7172
7378
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7206,12 +7412,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7206
7412
|
};
|
|
7207
7413
|
|
|
7208
7414
|
// src/features/rules/kiro-rule.ts
|
|
7209
|
-
import { join as
|
|
7415
|
+
import { join as join73 } from "path";
|
|
7210
7416
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
7211
7417
|
static getSettablePaths() {
|
|
7212
7418
|
return {
|
|
7213
7419
|
nonRoot: {
|
|
7214
|
-
relativeDirPath:
|
|
7420
|
+
relativeDirPath: join73(".kiro", "steering")
|
|
7215
7421
|
}
|
|
7216
7422
|
};
|
|
7217
7423
|
}
|
|
@@ -7221,7 +7427,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
7221
7427
|
validate = true
|
|
7222
7428
|
}) {
|
|
7223
7429
|
const fileContent = await readFileContent(
|
|
7224
|
-
|
|
7430
|
+
join73(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7225
7431
|
);
|
|
7226
7432
|
return new _KiroRule({
|
|
7227
7433
|
baseDir,
|
|
@@ -7261,7 +7467,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
7261
7467
|
};
|
|
7262
7468
|
|
|
7263
7469
|
// src/features/rules/opencode-rule.ts
|
|
7264
|
-
import { join as
|
|
7470
|
+
import { join as join74 } from "path";
|
|
7265
7471
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
7266
7472
|
static getSettablePaths() {
|
|
7267
7473
|
return {
|
|
@@ -7270,7 +7476,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7270
7476
|
relativeFilePath: "AGENTS.md"
|
|
7271
7477
|
},
|
|
7272
7478
|
nonRoot: {
|
|
7273
|
-
relativeDirPath:
|
|
7479
|
+
relativeDirPath: join74(".opencode", "memories")
|
|
7274
7480
|
}
|
|
7275
7481
|
};
|
|
7276
7482
|
}
|
|
@@ -7280,8 +7486,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7280
7486
|
validate = true
|
|
7281
7487
|
}) {
|
|
7282
7488
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
7283
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
7284
|
-
const fileContent = await readFileContent(
|
|
7489
|
+
const relativePath = isRoot ? "AGENTS.md" : join74(".opencode", "memories", relativeFilePath);
|
|
7490
|
+
const fileContent = await readFileContent(join74(baseDir, relativePath));
|
|
7285
7491
|
return new _OpenCodeRule({
|
|
7286
7492
|
baseDir,
|
|
7287
7493
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7321,7 +7527,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7321
7527
|
};
|
|
7322
7528
|
|
|
7323
7529
|
// src/features/rules/qwencode-rule.ts
|
|
7324
|
-
import { join as
|
|
7530
|
+
import { join as join75 } from "path";
|
|
7325
7531
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
7326
7532
|
static getSettablePaths() {
|
|
7327
7533
|
return {
|
|
@@ -7330,7 +7536,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7330
7536
|
relativeFilePath: "QWEN.md"
|
|
7331
7537
|
},
|
|
7332
7538
|
nonRoot: {
|
|
7333
|
-
relativeDirPath:
|
|
7539
|
+
relativeDirPath: join75(".qwen", "memories")
|
|
7334
7540
|
}
|
|
7335
7541
|
};
|
|
7336
7542
|
}
|
|
@@ -7340,8 +7546,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7340
7546
|
validate = true
|
|
7341
7547
|
}) {
|
|
7342
7548
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
7343
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
7344
|
-
const fileContent = await readFileContent(
|
|
7549
|
+
const relativePath = isRoot ? "QWEN.md" : join75(".qwen", "memories", relativeFilePath);
|
|
7550
|
+
const fileContent = await readFileContent(join75(baseDir, relativePath));
|
|
7345
7551
|
return new _QwencodeRule({
|
|
7346
7552
|
baseDir,
|
|
7347
7553
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7378,12 +7584,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7378
7584
|
};
|
|
7379
7585
|
|
|
7380
7586
|
// src/features/rules/roo-rule.ts
|
|
7381
|
-
import { join as
|
|
7587
|
+
import { join as join76 } from "path";
|
|
7382
7588
|
var RooRule = class _RooRule extends ToolRule {
|
|
7383
7589
|
static getSettablePaths() {
|
|
7384
7590
|
return {
|
|
7385
7591
|
nonRoot: {
|
|
7386
|
-
relativeDirPath:
|
|
7592
|
+
relativeDirPath: join76(".roo", "rules")
|
|
7387
7593
|
}
|
|
7388
7594
|
};
|
|
7389
7595
|
}
|
|
@@ -7393,7 +7599,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
7393
7599
|
validate = true
|
|
7394
7600
|
}) {
|
|
7395
7601
|
const fileContent = await readFileContent(
|
|
7396
|
-
|
|
7602
|
+
join76(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7397
7603
|
);
|
|
7398
7604
|
return new _RooRule({
|
|
7399
7605
|
baseDir,
|
|
@@ -7448,7 +7654,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
7448
7654
|
};
|
|
7449
7655
|
|
|
7450
7656
|
// src/features/rules/warp-rule.ts
|
|
7451
|
-
import { join as
|
|
7657
|
+
import { join as join77 } from "path";
|
|
7452
7658
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
7453
7659
|
constructor({ fileContent, root, ...rest }) {
|
|
7454
7660
|
super({
|
|
@@ -7464,7 +7670,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
7464
7670
|
relativeFilePath: "WARP.md"
|
|
7465
7671
|
},
|
|
7466
7672
|
nonRoot: {
|
|
7467
|
-
relativeDirPath:
|
|
7673
|
+
relativeDirPath: join77(".warp", "memories")
|
|
7468
7674
|
}
|
|
7469
7675
|
};
|
|
7470
7676
|
}
|
|
@@ -7474,8 +7680,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
7474
7680
|
validate = true
|
|
7475
7681
|
}) {
|
|
7476
7682
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
7477
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
7478
|
-
const fileContent = await readFileContent(
|
|
7683
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join77(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
7684
|
+
const fileContent = await readFileContent(join77(baseDir, relativePath));
|
|
7479
7685
|
return new _WarpRule({
|
|
7480
7686
|
baseDir,
|
|
7481
7687
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -7515,12 +7721,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
7515
7721
|
};
|
|
7516
7722
|
|
|
7517
7723
|
// src/features/rules/windsurf-rule.ts
|
|
7518
|
-
import { join as
|
|
7724
|
+
import { join as join78 } from "path";
|
|
7519
7725
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
7520
7726
|
static getSettablePaths() {
|
|
7521
7727
|
return {
|
|
7522
7728
|
nonRoot: {
|
|
7523
|
-
relativeDirPath:
|
|
7729
|
+
relativeDirPath: join78(".windsurf", "rules")
|
|
7524
7730
|
}
|
|
7525
7731
|
};
|
|
7526
7732
|
}
|
|
@@ -7530,7 +7736,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
7530
7736
|
validate = true
|
|
7531
7737
|
}) {
|
|
7532
7738
|
const fileContent = await readFileContent(
|
|
7533
|
-
|
|
7739
|
+
join78(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7534
7740
|
);
|
|
7535
7741
|
return new _WindsurfRule({
|
|
7536
7742
|
baseDir,
|
|
@@ -7572,6 +7778,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
7572
7778
|
var rulesProcessorToolTargets = [
|
|
7573
7779
|
"agentsmd",
|
|
7574
7780
|
"amazonqcli",
|
|
7781
|
+
"antigravity",
|
|
7575
7782
|
"augmentcode",
|
|
7576
7783
|
"augmentcode-legacy",
|
|
7577
7784
|
"claudecode",
|
|
@@ -7588,7 +7795,7 @@ var rulesProcessorToolTargets = [
|
|
|
7588
7795
|
"warp",
|
|
7589
7796
|
"windsurf"
|
|
7590
7797
|
];
|
|
7591
|
-
var RulesProcessorToolTargetSchema =
|
|
7798
|
+
var RulesProcessorToolTargetSchema = z30.enum(rulesProcessorToolTargets);
|
|
7592
7799
|
var rulesProcessorToolTargetsGlobal = [
|
|
7593
7800
|
"claudecode",
|
|
7594
7801
|
"codexcli",
|
|
@@ -7645,6 +7852,15 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7645
7852
|
rulesyncRule,
|
|
7646
7853
|
validate: true
|
|
7647
7854
|
});
|
|
7855
|
+
case "antigravity":
|
|
7856
|
+
if (!AntigravityRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
7857
|
+
return null;
|
|
7858
|
+
}
|
|
7859
|
+
return AntigravityRule.fromRulesyncRule({
|
|
7860
|
+
baseDir: this.baseDir,
|
|
7861
|
+
rulesyncRule,
|
|
7862
|
+
validate: true
|
|
7863
|
+
});
|
|
7648
7864
|
case "augmentcode":
|
|
7649
7865
|
if (!AugmentcodeRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
7650
7866
|
return null;
|
|
@@ -7942,10 +8158,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7942
8158
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
7943
8159
|
*/
|
|
7944
8160
|
async loadRulesyncFiles() {
|
|
7945
|
-
const files = await findFilesByGlobs(
|
|
8161
|
+
const files = await findFilesByGlobs(join79(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
7946
8162
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
7947
8163
|
const rulesyncRules = await Promise.all(
|
|
7948
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath:
|
|
8164
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename20(file) }))
|
|
7949
8165
|
);
|
|
7950
8166
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
7951
8167
|
if (rootRules.length > 1) {
|
|
@@ -7963,10 +8179,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7963
8179
|
return rulesyncRules;
|
|
7964
8180
|
}
|
|
7965
8181
|
async loadRulesyncFilesLegacy() {
|
|
7966
|
-
const legacyFiles = await findFilesByGlobs(
|
|
8182
|
+
const legacyFiles = await findFilesByGlobs(join79(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
7967
8183
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
7968
8184
|
return Promise.all(
|
|
7969
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath:
|
|
8185
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename20(file) }))
|
|
7970
8186
|
);
|
|
7971
8187
|
}
|
|
7972
8188
|
/**
|
|
@@ -8029,13 +8245,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
8029
8245
|
return [];
|
|
8030
8246
|
}
|
|
8031
8247
|
const rootFilePaths = await findFilesByGlobs(
|
|
8032
|
-
|
|
8248
|
+
join79(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
|
|
8033
8249
|
);
|
|
8034
8250
|
return await Promise.all(
|
|
8035
8251
|
rootFilePaths.map(
|
|
8036
8252
|
(filePath) => root.fromFile({
|
|
8037
8253
|
baseDir: this.baseDir,
|
|
8038
|
-
relativeFilePath:
|
|
8254
|
+
relativeFilePath: basename20(filePath),
|
|
8039
8255
|
global: this.global
|
|
8040
8256
|
})
|
|
8041
8257
|
)
|
|
@@ -8047,13 +8263,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
8047
8263
|
return [];
|
|
8048
8264
|
}
|
|
8049
8265
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
8050
|
-
|
|
8266
|
+
join79(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
|
|
8051
8267
|
);
|
|
8052
8268
|
return await Promise.all(
|
|
8053
8269
|
nonRootFilePaths.map(
|
|
8054
8270
|
(filePath) => nonRoot.fromFile({
|
|
8055
8271
|
baseDir: this.baseDir,
|
|
8056
|
-
relativeFilePath:
|
|
8272
|
+
relativeFilePath: basename20(filePath),
|
|
8057
8273
|
global: this.global
|
|
8058
8274
|
})
|
|
8059
8275
|
)
|
|
@@ -8424,21 +8640,21 @@ s/<command> [arguments]
|
|
|
8424
8640
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
8425
8641
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
8426
8642
|
|
|
8427
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
8643
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join79(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
8428
8644
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
8429
8645
|
|
|
8430
8646
|
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.
|
|
8431
8647
|
|
|
8432
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
8648
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join79(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
8433
8649
|
|
|
8434
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
8650
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join79(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
8435
8651
|
const skillsSection = skills ? `## Simulated Skills
|
|
8436
8652
|
|
|
8437
8653
|
Simulated skills are specialized capabilities that can be invoked to handle specific types of tasks.
|
|
8438
8654
|
|
|
8439
|
-
When users invoke a simulated skill, look for the corresponding SKILL.md file in \`${
|
|
8655
|
+
When users invoke a simulated skill, look for the corresponding SKILL.md file in \`${join79(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "{skill}/SKILL.md")}\` and execute its contents as the block of operations.
|
|
8440
8656
|
|
|
8441
|
-
For example, if the user instructs \`Use the skill example-skill to achieve something\`, look for \`${
|
|
8657
|
+
For example, if the user instructs \`Use the skill example-skill to achieve something\`, look for \`${join79(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "example-skill/SKILL.md")}\` and execute its contents.
|
|
8442
8658
|
|
|
8443
8659
|
Additionally, you should proactively consider using available skills when they would help accomplish a task more effectively, even if the user doesn't explicitly request them.` : "";
|
|
8444
8660
|
const result = [
|
|
@@ -8700,9 +8916,9 @@ async function generateSkills(config) {
|
|
|
8700
8916
|
}
|
|
8701
8917
|
|
|
8702
8918
|
// src/cli/commands/gitignore.ts
|
|
8703
|
-
import { join as
|
|
8919
|
+
import { join as join80 } from "path";
|
|
8704
8920
|
var gitignoreCommand = async () => {
|
|
8705
|
-
const gitignorePath =
|
|
8921
|
+
const gitignorePath = join80(process.cwd(), ".gitignore");
|
|
8706
8922
|
const rulesFilesToIgnore = [
|
|
8707
8923
|
"# Generated by rulesync - AI tool configuration files",
|
|
8708
8924
|
// AGENTS.md
|
|
@@ -8975,7 +9191,7 @@ async function importSkills(config, tool) {
|
|
|
8975
9191
|
}
|
|
8976
9192
|
|
|
8977
9193
|
// src/cli/commands/init.ts
|
|
8978
|
-
import { join as
|
|
9194
|
+
import { join as join81 } from "path";
|
|
8979
9195
|
async function initCommand() {
|
|
8980
9196
|
logger.info("Initializing rulesync...");
|
|
8981
9197
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -9138,14 +9354,14 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
9138
9354
|
await ensureDir(commandPaths.relativeDirPath);
|
|
9139
9355
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
9140
9356
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
9141
|
-
const ruleFilepath =
|
|
9357
|
+
const ruleFilepath = join81(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
9142
9358
|
if (!await fileExists(ruleFilepath)) {
|
|
9143
9359
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
9144
9360
|
logger.success(`Created ${ruleFilepath}`);
|
|
9145
9361
|
} else {
|
|
9146
9362
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
9147
9363
|
}
|
|
9148
|
-
const mcpFilepath =
|
|
9364
|
+
const mcpFilepath = join81(
|
|
9149
9365
|
mcpPaths.recommended.relativeDirPath,
|
|
9150
9366
|
mcpPaths.recommended.relativeFilePath
|
|
9151
9367
|
);
|
|
@@ -9155,21 +9371,21 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
9155
9371
|
} else {
|
|
9156
9372
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
9157
9373
|
}
|
|
9158
|
-
const commandFilepath =
|
|
9374
|
+
const commandFilepath = join81(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
9159
9375
|
if (!await fileExists(commandFilepath)) {
|
|
9160
9376
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
9161
9377
|
logger.success(`Created ${commandFilepath}`);
|
|
9162
9378
|
} else {
|
|
9163
9379
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
9164
9380
|
}
|
|
9165
|
-
const subagentFilepath =
|
|
9381
|
+
const subagentFilepath = join81(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
9166
9382
|
if (!await fileExists(subagentFilepath)) {
|
|
9167
9383
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
9168
9384
|
logger.success(`Created ${subagentFilepath}`);
|
|
9169
9385
|
} else {
|
|
9170
9386
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
9171
9387
|
}
|
|
9172
|
-
const ignoreFilepath =
|
|
9388
|
+
const ignoreFilepath = join81(
|
|
9173
9389
|
ignorePaths.recommended.relativeDirPath,
|
|
9174
9390
|
ignorePaths.recommended.relativeFilePath
|
|
9175
9391
|
);
|
|
@@ -9185,12 +9401,12 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
9185
9401
|
import { FastMCP } from "fastmcp";
|
|
9186
9402
|
|
|
9187
9403
|
// src/mcp/commands.ts
|
|
9188
|
-
import { basename as
|
|
9189
|
-
import { z as
|
|
9404
|
+
import { basename as basename21, join as join82 } from "path";
|
|
9405
|
+
import { z as z31 } from "zod/mini";
|
|
9190
9406
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
9191
9407
|
var maxCommandsCount = 1e3;
|
|
9192
9408
|
async function listCommands() {
|
|
9193
|
-
const commandsDir =
|
|
9409
|
+
const commandsDir = join82(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
9194
9410
|
try {
|
|
9195
9411
|
const files = await listDirectoryFiles(commandsDir);
|
|
9196
9412
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -9202,7 +9418,7 @@ async function listCommands() {
|
|
|
9202
9418
|
});
|
|
9203
9419
|
const frontmatter = command.getFrontmatter();
|
|
9204
9420
|
return {
|
|
9205
|
-
relativePathFromCwd:
|
|
9421
|
+
relativePathFromCwd: join82(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
9206
9422
|
frontmatter
|
|
9207
9423
|
};
|
|
9208
9424
|
} catch (error) {
|
|
@@ -9222,13 +9438,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
9222
9438
|
relativePath: relativePathFromCwd,
|
|
9223
9439
|
intendedRootDir: process.cwd()
|
|
9224
9440
|
});
|
|
9225
|
-
const filename =
|
|
9441
|
+
const filename = basename21(relativePathFromCwd);
|
|
9226
9442
|
try {
|
|
9227
9443
|
const command = await RulesyncCommand.fromFile({
|
|
9228
9444
|
relativeFilePath: filename
|
|
9229
9445
|
});
|
|
9230
9446
|
return {
|
|
9231
|
-
relativePathFromCwd:
|
|
9447
|
+
relativePathFromCwd: join82(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
9232
9448
|
frontmatter: command.getFrontmatter(),
|
|
9233
9449
|
body: command.getBody()
|
|
9234
9450
|
};
|
|
@@ -9247,7 +9463,7 @@ async function putCommand({
|
|
|
9247
9463
|
relativePath: relativePathFromCwd,
|
|
9248
9464
|
intendedRootDir: process.cwd()
|
|
9249
9465
|
});
|
|
9250
|
-
const filename =
|
|
9466
|
+
const filename = basename21(relativePathFromCwd);
|
|
9251
9467
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
9252
9468
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
9253
9469
|
throw new Error(
|
|
@@ -9257,7 +9473,7 @@ async function putCommand({
|
|
|
9257
9473
|
try {
|
|
9258
9474
|
const existingCommands = await listCommands();
|
|
9259
9475
|
const isUpdate = existingCommands.some(
|
|
9260
|
-
(command2) => command2.relativePathFromCwd ===
|
|
9476
|
+
(command2) => command2.relativePathFromCwd === join82(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
9261
9477
|
);
|
|
9262
9478
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
9263
9479
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -9272,11 +9488,11 @@ async function putCommand({
|
|
|
9272
9488
|
fileContent,
|
|
9273
9489
|
validate: true
|
|
9274
9490
|
});
|
|
9275
|
-
const commandsDir =
|
|
9491
|
+
const commandsDir = join82(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
9276
9492
|
await ensureDir(commandsDir);
|
|
9277
9493
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
9278
9494
|
return {
|
|
9279
|
-
relativePathFromCwd:
|
|
9495
|
+
relativePathFromCwd: join82(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
9280
9496
|
frontmatter: command.getFrontmatter(),
|
|
9281
9497
|
body: command.getBody()
|
|
9282
9498
|
};
|
|
@@ -9291,12 +9507,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
9291
9507
|
relativePath: relativePathFromCwd,
|
|
9292
9508
|
intendedRootDir: process.cwd()
|
|
9293
9509
|
});
|
|
9294
|
-
const filename =
|
|
9295
|
-
const fullPath =
|
|
9510
|
+
const filename = basename21(relativePathFromCwd);
|
|
9511
|
+
const fullPath = join82(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
9296
9512
|
try {
|
|
9297
9513
|
await removeFile(fullPath);
|
|
9298
9514
|
return {
|
|
9299
|
-
relativePathFromCwd:
|
|
9515
|
+
relativePathFromCwd: join82(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
9300
9516
|
};
|
|
9301
9517
|
} catch (error) {
|
|
9302
9518
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -9305,23 +9521,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
9305
9521
|
}
|
|
9306
9522
|
}
|
|
9307
9523
|
var commandToolSchemas = {
|
|
9308
|
-
listCommands:
|
|
9309
|
-
getCommand:
|
|
9310
|
-
relativePathFromCwd:
|
|
9524
|
+
listCommands: z31.object({}),
|
|
9525
|
+
getCommand: z31.object({
|
|
9526
|
+
relativePathFromCwd: z31.string()
|
|
9311
9527
|
}),
|
|
9312
|
-
putCommand:
|
|
9313
|
-
relativePathFromCwd:
|
|
9528
|
+
putCommand: z31.object({
|
|
9529
|
+
relativePathFromCwd: z31.string(),
|
|
9314
9530
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
9315
|
-
body:
|
|
9531
|
+
body: z31.string()
|
|
9316
9532
|
}),
|
|
9317
|
-
deleteCommand:
|
|
9318
|
-
relativePathFromCwd:
|
|
9533
|
+
deleteCommand: z31.object({
|
|
9534
|
+
relativePathFromCwd: z31.string()
|
|
9319
9535
|
})
|
|
9320
9536
|
};
|
|
9321
9537
|
var commandTools = {
|
|
9322
9538
|
listCommands: {
|
|
9323
9539
|
name: "listCommands",
|
|
9324
|
-
description: `List all commands from ${
|
|
9540
|
+
description: `List all commands from ${join82(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
9325
9541
|
parameters: commandToolSchemas.listCommands,
|
|
9326
9542
|
execute: async () => {
|
|
9327
9543
|
const commands = await listCommands();
|
|
@@ -9363,11 +9579,11 @@ var commandTools = {
|
|
|
9363
9579
|
};
|
|
9364
9580
|
|
|
9365
9581
|
// src/mcp/ignore.ts
|
|
9366
|
-
import { join as
|
|
9367
|
-
import { z as
|
|
9582
|
+
import { join as join83 } from "path";
|
|
9583
|
+
import { z as z32 } from "zod/mini";
|
|
9368
9584
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
9369
9585
|
async function getIgnoreFile() {
|
|
9370
|
-
const ignoreFilePath =
|
|
9586
|
+
const ignoreFilePath = join83(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
9371
9587
|
try {
|
|
9372
9588
|
const content = await readFileContent(ignoreFilePath);
|
|
9373
9589
|
return {
|
|
@@ -9381,7 +9597,7 @@ async function getIgnoreFile() {
|
|
|
9381
9597
|
}
|
|
9382
9598
|
}
|
|
9383
9599
|
async function putIgnoreFile({ content }) {
|
|
9384
|
-
const ignoreFilePath =
|
|
9600
|
+
const ignoreFilePath = join83(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
9385
9601
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
9386
9602
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
9387
9603
|
throw new Error(
|
|
@@ -9402,8 +9618,8 @@ async function putIgnoreFile({ content }) {
|
|
|
9402
9618
|
}
|
|
9403
9619
|
}
|
|
9404
9620
|
async function deleteIgnoreFile() {
|
|
9405
|
-
const aiignorePath =
|
|
9406
|
-
const legacyIgnorePath =
|
|
9621
|
+
const aiignorePath = join83(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
9622
|
+
const legacyIgnorePath = join83(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
9407
9623
|
try {
|
|
9408
9624
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
9409
9625
|
return {
|
|
@@ -9421,11 +9637,11 @@ async function deleteIgnoreFile() {
|
|
|
9421
9637
|
}
|
|
9422
9638
|
}
|
|
9423
9639
|
var ignoreToolSchemas = {
|
|
9424
|
-
getIgnoreFile:
|
|
9425
|
-
putIgnoreFile:
|
|
9426
|
-
content:
|
|
9640
|
+
getIgnoreFile: z32.object({}),
|
|
9641
|
+
putIgnoreFile: z32.object({
|
|
9642
|
+
content: z32.string()
|
|
9427
9643
|
}),
|
|
9428
|
-
deleteIgnoreFile:
|
|
9644
|
+
deleteIgnoreFile: z32.object({})
|
|
9429
9645
|
};
|
|
9430
9646
|
var ignoreTools = {
|
|
9431
9647
|
getIgnoreFile: {
|
|
@@ -9458,8 +9674,8 @@ var ignoreTools = {
|
|
|
9458
9674
|
};
|
|
9459
9675
|
|
|
9460
9676
|
// src/mcp/mcp.ts
|
|
9461
|
-
import { join as
|
|
9462
|
-
import { z as
|
|
9677
|
+
import { join as join84 } from "path";
|
|
9678
|
+
import { z as z33 } from "zod/mini";
|
|
9463
9679
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
9464
9680
|
async function getMcpFile() {
|
|
9465
9681
|
const config = await ConfigResolver.resolve({});
|
|
@@ -9468,7 +9684,7 @@ async function getMcpFile() {
|
|
|
9468
9684
|
validate: true,
|
|
9469
9685
|
modularMcp: config.getModularMcp()
|
|
9470
9686
|
});
|
|
9471
|
-
const relativePathFromCwd =
|
|
9687
|
+
const relativePathFromCwd = join84(
|
|
9472
9688
|
rulesyncMcp.getRelativeDirPath(),
|
|
9473
9689
|
rulesyncMcp.getRelativeFilePath()
|
|
9474
9690
|
);
|
|
@@ -9501,7 +9717,7 @@ async function putMcpFile({ content }) {
|
|
|
9501
9717
|
const paths = RulesyncMcp.getSettablePaths();
|
|
9502
9718
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
9503
9719
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
9504
|
-
const fullPath =
|
|
9720
|
+
const fullPath = join84(baseDir, relativeDirPath, relativeFilePath);
|
|
9505
9721
|
const rulesyncMcp = new RulesyncMcp({
|
|
9506
9722
|
baseDir,
|
|
9507
9723
|
relativeDirPath,
|
|
@@ -9510,9 +9726,9 @@ async function putMcpFile({ content }) {
|
|
|
9510
9726
|
validate: true,
|
|
9511
9727
|
modularMcp: config.getModularMcp()
|
|
9512
9728
|
});
|
|
9513
|
-
await ensureDir(
|
|
9729
|
+
await ensureDir(join84(baseDir, relativeDirPath));
|
|
9514
9730
|
await writeFileContent(fullPath, content);
|
|
9515
|
-
const relativePathFromCwd =
|
|
9731
|
+
const relativePathFromCwd = join84(relativeDirPath, relativeFilePath);
|
|
9516
9732
|
return {
|
|
9517
9733
|
relativePathFromCwd,
|
|
9518
9734
|
content: rulesyncMcp.getFileContent()
|
|
@@ -9527,15 +9743,15 @@ async function deleteMcpFile() {
|
|
|
9527
9743
|
try {
|
|
9528
9744
|
const baseDir = process.cwd();
|
|
9529
9745
|
const paths = RulesyncMcp.getSettablePaths();
|
|
9530
|
-
const recommendedPath =
|
|
9746
|
+
const recommendedPath = join84(
|
|
9531
9747
|
baseDir,
|
|
9532
9748
|
paths.recommended.relativeDirPath,
|
|
9533
9749
|
paths.recommended.relativeFilePath
|
|
9534
9750
|
);
|
|
9535
|
-
const legacyPath =
|
|
9751
|
+
const legacyPath = join84(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
9536
9752
|
await removeFile(recommendedPath);
|
|
9537
9753
|
await removeFile(legacyPath);
|
|
9538
|
-
const relativePathFromCwd =
|
|
9754
|
+
const relativePathFromCwd = join84(
|
|
9539
9755
|
paths.recommended.relativeDirPath,
|
|
9540
9756
|
paths.recommended.relativeFilePath
|
|
9541
9757
|
);
|
|
@@ -9549,11 +9765,11 @@ async function deleteMcpFile() {
|
|
|
9549
9765
|
}
|
|
9550
9766
|
}
|
|
9551
9767
|
var mcpToolSchemas = {
|
|
9552
|
-
getMcpFile:
|
|
9553
|
-
putMcpFile:
|
|
9554
|
-
content:
|
|
9768
|
+
getMcpFile: z33.object({}),
|
|
9769
|
+
putMcpFile: z33.object({
|
|
9770
|
+
content: z33.string()
|
|
9555
9771
|
}),
|
|
9556
|
-
deleteMcpFile:
|
|
9772
|
+
deleteMcpFile: z33.object({})
|
|
9557
9773
|
};
|
|
9558
9774
|
var mcpTools = {
|
|
9559
9775
|
getMcpFile: {
|
|
@@ -9586,12 +9802,12 @@ var mcpTools = {
|
|
|
9586
9802
|
};
|
|
9587
9803
|
|
|
9588
9804
|
// src/mcp/rules.ts
|
|
9589
|
-
import { basename as
|
|
9590
|
-
import { z as
|
|
9805
|
+
import { basename as basename22, join as join85 } from "path";
|
|
9806
|
+
import { z as z34 } from "zod/mini";
|
|
9591
9807
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
9592
9808
|
var maxRulesCount = 1e3;
|
|
9593
9809
|
async function listRules() {
|
|
9594
|
-
const rulesDir =
|
|
9810
|
+
const rulesDir = join85(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
9595
9811
|
try {
|
|
9596
9812
|
const files = await listDirectoryFiles(rulesDir);
|
|
9597
9813
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -9604,7 +9820,7 @@ async function listRules() {
|
|
|
9604
9820
|
});
|
|
9605
9821
|
const frontmatter = rule.getFrontmatter();
|
|
9606
9822
|
return {
|
|
9607
|
-
relativePathFromCwd:
|
|
9823
|
+
relativePathFromCwd: join85(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
9608
9824
|
frontmatter
|
|
9609
9825
|
};
|
|
9610
9826
|
} catch (error) {
|
|
@@ -9624,14 +9840,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
9624
9840
|
relativePath: relativePathFromCwd,
|
|
9625
9841
|
intendedRootDir: process.cwd()
|
|
9626
9842
|
});
|
|
9627
|
-
const filename =
|
|
9843
|
+
const filename = basename22(relativePathFromCwd);
|
|
9628
9844
|
try {
|
|
9629
9845
|
const rule = await RulesyncRule.fromFile({
|
|
9630
9846
|
relativeFilePath: filename,
|
|
9631
9847
|
validate: true
|
|
9632
9848
|
});
|
|
9633
9849
|
return {
|
|
9634
|
-
relativePathFromCwd:
|
|
9850
|
+
relativePathFromCwd: join85(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
9635
9851
|
frontmatter: rule.getFrontmatter(),
|
|
9636
9852
|
body: rule.getBody()
|
|
9637
9853
|
};
|
|
@@ -9650,7 +9866,7 @@ async function putRule({
|
|
|
9650
9866
|
relativePath: relativePathFromCwd,
|
|
9651
9867
|
intendedRootDir: process.cwd()
|
|
9652
9868
|
});
|
|
9653
|
-
const filename =
|
|
9869
|
+
const filename = basename22(relativePathFromCwd);
|
|
9654
9870
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
9655
9871
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
9656
9872
|
throw new Error(
|
|
@@ -9660,7 +9876,7 @@ async function putRule({
|
|
|
9660
9876
|
try {
|
|
9661
9877
|
const existingRules = await listRules();
|
|
9662
9878
|
const isUpdate = existingRules.some(
|
|
9663
|
-
(rule2) => rule2.relativePathFromCwd ===
|
|
9879
|
+
(rule2) => rule2.relativePathFromCwd === join85(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
9664
9880
|
);
|
|
9665
9881
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
9666
9882
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -9673,11 +9889,11 @@ async function putRule({
|
|
|
9673
9889
|
body,
|
|
9674
9890
|
validate: true
|
|
9675
9891
|
});
|
|
9676
|
-
const rulesDir =
|
|
9892
|
+
const rulesDir = join85(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
9677
9893
|
await ensureDir(rulesDir);
|
|
9678
9894
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
9679
9895
|
return {
|
|
9680
|
-
relativePathFromCwd:
|
|
9896
|
+
relativePathFromCwd: join85(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
9681
9897
|
frontmatter: rule.getFrontmatter(),
|
|
9682
9898
|
body: rule.getBody()
|
|
9683
9899
|
};
|
|
@@ -9692,12 +9908,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
9692
9908
|
relativePath: relativePathFromCwd,
|
|
9693
9909
|
intendedRootDir: process.cwd()
|
|
9694
9910
|
});
|
|
9695
|
-
const filename =
|
|
9696
|
-
const fullPath =
|
|
9911
|
+
const filename = basename22(relativePathFromCwd);
|
|
9912
|
+
const fullPath = join85(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
9697
9913
|
try {
|
|
9698
9914
|
await removeFile(fullPath);
|
|
9699
9915
|
return {
|
|
9700
|
-
relativePathFromCwd:
|
|
9916
|
+
relativePathFromCwd: join85(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
9701
9917
|
};
|
|
9702
9918
|
} catch (error) {
|
|
9703
9919
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -9706,23 +9922,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
9706
9922
|
}
|
|
9707
9923
|
}
|
|
9708
9924
|
var ruleToolSchemas = {
|
|
9709
|
-
listRules:
|
|
9710
|
-
getRule:
|
|
9711
|
-
relativePathFromCwd:
|
|
9925
|
+
listRules: z34.object({}),
|
|
9926
|
+
getRule: z34.object({
|
|
9927
|
+
relativePathFromCwd: z34.string()
|
|
9712
9928
|
}),
|
|
9713
|
-
putRule:
|
|
9714
|
-
relativePathFromCwd:
|
|
9929
|
+
putRule: z34.object({
|
|
9930
|
+
relativePathFromCwd: z34.string(),
|
|
9715
9931
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
9716
|
-
body:
|
|
9932
|
+
body: z34.string()
|
|
9717
9933
|
}),
|
|
9718
|
-
deleteRule:
|
|
9719
|
-
relativePathFromCwd:
|
|
9934
|
+
deleteRule: z34.object({
|
|
9935
|
+
relativePathFromCwd: z34.string()
|
|
9720
9936
|
})
|
|
9721
9937
|
};
|
|
9722
9938
|
var ruleTools = {
|
|
9723
9939
|
listRules: {
|
|
9724
9940
|
name: "listRules",
|
|
9725
|
-
description: `List all rules from ${
|
|
9941
|
+
description: `List all rules from ${join85(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
9726
9942
|
parameters: ruleToolSchemas.listRules,
|
|
9727
9943
|
execute: async () => {
|
|
9728
9944
|
const rules = await listRules();
|
|
@@ -9764,12 +9980,12 @@ var ruleTools = {
|
|
|
9764
9980
|
};
|
|
9765
9981
|
|
|
9766
9982
|
// src/mcp/subagents.ts
|
|
9767
|
-
import { basename as
|
|
9768
|
-
import { z as
|
|
9983
|
+
import { basename as basename23, join as join86 } from "path";
|
|
9984
|
+
import { z as z35 } from "zod/mini";
|
|
9769
9985
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
9770
9986
|
var maxSubagentsCount = 1e3;
|
|
9771
9987
|
async function listSubagents() {
|
|
9772
|
-
const subagentsDir =
|
|
9988
|
+
const subagentsDir = join86(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
9773
9989
|
try {
|
|
9774
9990
|
const files = await listDirectoryFiles(subagentsDir);
|
|
9775
9991
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -9782,7 +9998,7 @@ async function listSubagents() {
|
|
|
9782
9998
|
});
|
|
9783
9999
|
const frontmatter = subagent.getFrontmatter();
|
|
9784
10000
|
return {
|
|
9785
|
-
relativePathFromCwd:
|
|
10001
|
+
relativePathFromCwd: join86(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
9786
10002
|
frontmatter
|
|
9787
10003
|
};
|
|
9788
10004
|
} catch (error) {
|
|
@@ -9804,14 +10020,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
9804
10020
|
relativePath: relativePathFromCwd,
|
|
9805
10021
|
intendedRootDir: process.cwd()
|
|
9806
10022
|
});
|
|
9807
|
-
const filename =
|
|
10023
|
+
const filename = basename23(relativePathFromCwd);
|
|
9808
10024
|
try {
|
|
9809
10025
|
const subagent = await RulesyncSubagent.fromFile({
|
|
9810
10026
|
relativeFilePath: filename,
|
|
9811
10027
|
validate: true
|
|
9812
10028
|
});
|
|
9813
10029
|
return {
|
|
9814
|
-
relativePathFromCwd:
|
|
10030
|
+
relativePathFromCwd: join86(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
9815
10031
|
frontmatter: subagent.getFrontmatter(),
|
|
9816
10032
|
body: subagent.getBody()
|
|
9817
10033
|
};
|
|
@@ -9830,7 +10046,7 @@ async function putSubagent({
|
|
|
9830
10046
|
relativePath: relativePathFromCwd,
|
|
9831
10047
|
intendedRootDir: process.cwd()
|
|
9832
10048
|
});
|
|
9833
|
-
const filename =
|
|
10049
|
+
const filename = basename23(relativePathFromCwd);
|
|
9834
10050
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
9835
10051
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
9836
10052
|
throw new Error(
|
|
@@ -9840,7 +10056,7 @@ async function putSubagent({
|
|
|
9840
10056
|
try {
|
|
9841
10057
|
const existingSubagents = await listSubagents();
|
|
9842
10058
|
const isUpdate = existingSubagents.some(
|
|
9843
|
-
(subagent2) => subagent2.relativePathFromCwd ===
|
|
10059
|
+
(subagent2) => subagent2.relativePathFromCwd === join86(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
9844
10060
|
);
|
|
9845
10061
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
9846
10062
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -9853,11 +10069,11 @@ async function putSubagent({
|
|
|
9853
10069
|
body,
|
|
9854
10070
|
validate: true
|
|
9855
10071
|
});
|
|
9856
|
-
const subagentsDir =
|
|
10072
|
+
const subagentsDir = join86(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
9857
10073
|
await ensureDir(subagentsDir);
|
|
9858
10074
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
9859
10075
|
return {
|
|
9860
|
-
relativePathFromCwd:
|
|
10076
|
+
relativePathFromCwd: join86(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
9861
10077
|
frontmatter: subagent.getFrontmatter(),
|
|
9862
10078
|
body: subagent.getBody()
|
|
9863
10079
|
};
|
|
@@ -9872,12 +10088,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
9872
10088
|
relativePath: relativePathFromCwd,
|
|
9873
10089
|
intendedRootDir: process.cwd()
|
|
9874
10090
|
});
|
|
9875
|
-
const filename =
|
|
9876
|
-
const fullPath =
|
|
10091
|
+
const filename = basename23(relativePathFromCwd);
|
|
10092
|
+
const fullPath = join86(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
9877
10093
|
try {
|
|
9878
10094
|
await removeFile(fullPath);
|
|
9879
10095
|
return {
|
|
9880
|
-
relativePathFromCwd:
|
|
10096
|
+
relativePathFromCwd: join86(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
9881
10097
|
};
|
|
9882
10098
|
} catch (error) {
|
|
9883
10099
|
throw new Error(
|
|
@@ -9889,23 +10105,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
9889
10105
|
}
|
|
9890
10106
|
}
|
|
9891
10107
|
var subagentToolSchemas = {
|
|
9892
|
-
listSubagents:
|
|
9893
|
-
getSubagent:
|
|
9894
|
-
relativePathFromCwd:
|
|
10108
|
+
listSubagents: z35.object({}),
|
|
10109
|
+
getSubagent: z35.object({
|
|
10110
|
+
relativePathFromCwd: z35.string()
|
|
9895
10111
|
}),
|
|
9896
|
-
putSubagent:
|
|
9897
|
-
relativePathFromCwd:
|
|
10112
|
+
putSubagent: z35.object({
|
|
10113
|
+
relativePathFromCwd: z35.string(),
|
|
9898
10114
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
9899
|
-
body:
|
|
10115
|
+
body: z35.string()
|
|
9900
10116
|
}),
|
|
9901
|
-
deleteSubagent:
|
|
9902
|
-
relativePathFromCwd:
|
|
10117
|
+
deleteSubagent: z35.object({
|
|
10118
|
+
relativePathFromCwd: z35.string()
|
|
9903
10119
|
})
|
|
9904
10120
|
};
|
|
9905
10121
|
var subagentTools = {
|
|
9906
10122
|
listSubagents: {
|
|
9907
10123
|
name: "listSubagents",
|
|
9908
|
-
description: `List all subagents from ${
|
|
10124
|
+
description: `List all subagents from ${join86(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
9909
10125
|
parameters: subagentToolSchemas.listSubagents,
|
|
9910
10126
|
execute: async () => {
|
|
9911
10127
|
const subagents = await listSubagents();
|
|
@@ -9979,7 +10195,7 @@ async function mcpCommand({ version }) {
|
|
|
9979
10195
|
}
|
|
9980
10196
|
|
|
9981
10197
|
// src/cli/index.ts
|
|
9982
|
-
var getVersion = () => "3.
|
|
10198
|
+
var getVersion = () => "3.28.0";
|
|
9983
10199
|
var main = async () => {
|
|
9984
10200
|
const program = new Command();
|
|
9985
10201
|
const version = getVersion();
|