rulesync 3.27.0 → 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 +2 -0
- package/dist/index.cjs +727 -513
- package/dist/index.js +720 -506
- 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,13 +4710,14 @@ var DirFeatureProcessor = class {
|
|
|
4559
4710
|
await ensureDir(dirPath);
|
|
4560
4711
|
const mainFile = aiDir.getMainFile();
|
|
4561
4712
|
if (mainFile) {
|
|
4562
|
-
const mainFilePath =
|
|
4563
|
-
const
|
|
4713
|
+
const mainFilePath = join43(dirPath, mainFile.name);
|
|
4714
|
+
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
4715
|
+
const contentWithNewline = addTrailingNewline(content);
|
|
4564
4716
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
4565
4717
|
}
|
|
4566
4718
|
const otherFiles = aiDir.getOtherFiles();
|
|
4567
4719
|
for (const file of otherFiles) {
|
|
4568
|
-
const filePath =
|
|
4720
|
+
const filePath = join43(dirPath, file.relativeFilePathToDirPath);
|
|
4569
4721
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
4570
4722
|
await writeFileContent(filePath, contentWithNewline);
|
|
4571
4723
|
}
|
|
@@ -4580,14 +4732,14 @@ var DirFeatureProcessor = class {
|
|
|
4580
4732
|
};
|
|
4581
4733
|
|
|
4582
4734
|
// src/features/skills/agentsmd-skill.ts
|
|
4583
|
-
import { join as
|
|
4735
|
+
import { join as join44 } from "path";
|
|
4584
4736
|
var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
4585
4737
|
static getSettablePaths(options) {
|
|
4586
4738
|
if (options?.global) {
|
|
4587
4739
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
4588
4740
|
}
|
|
4589
4741
|
return {
|
|
4590
|
-
relativeDirPath:
|
|
4742
|
+
relativeDirPath: join44(".agents", "skills")
|
|
4591
4743
|
};
|
|
4592
4744
|
}
|
|
4593
4745
|
static async fromDir(params) {
|
|
@@ -4610,19 +4762,19 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
4610
4762
|
};
|
|
4611
4763
|
|
|
4612
4764
|
// src/features/skills/claudecode-skill.ts
|
|
4613
|
-
import { join as
|
|
4614
|
-
import { z as
|
|
4765
|
+
import { join as join46 } from "path";
|
|
4766
|
+
import { z as z20 } from "zod/mini";
|
|
4615
4767
|
|
|
4616
4768
|
// src/features/skills/rulesync-skill.ts
|
|
4617
|
-
import { join as
|
|
4618
|
-
import { z as
|
|
4619
|
-
var RulesyncSkillFrontmatterSchemaInternal =
|
|
4620
|
-
name:
|
|
4621
|
-
description:
|
|
4622
|
-
targets:
|
|
4623
|
-
claudecode:
|
|
4624
|
-
|
|
4625
|
-
"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()))
|
|
4626
4778
|
})
|
|
4627
4779
|
)
|
|
4628
4780
|
});
|
|
@@ -4690,8 +4842,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
4690
4842
|
dirName,
|
|
4691
4843
|
global = false
|
|
4692
4844
|
}) {
|
|
4693
|
-
const skillDirPath =
|
|
4694
|
-
const skillFilePath =
|
|
4845
|
+
const skillDirPath = join45(baseDir, relativeDirPath, dirName);
|
|
4846
|
+
const skillFilePath = join45(skillDirPath, SKILL_FILE_NAME);
|
|
4695
4847
|
if (!await fileExists(skillFilePath)) {
|
|
4696
4848
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
4697
4849
|
}
|
|
@@ -4721,15 +4873,15 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
4721
4873
|
};
|
|
4722
4874
|
|
|
4723
4875
|
// src/features/skills/claudecode-skill.ts
|
|
4724
|
-
var ClaudecodeSkillFrontmatterSchema =
|
|
4725
|
-
name:
|
|
4726
|
-
description:
|
|
4727
|
-
"allowed-tools":
|
|
4876
|
+
var ClaudecodeSkillFrontmatterSchema = z20.object({
|
|
4877
|
+
name: z20.string(),
|
|
4878
|
+
description: z20.string(),
|
|
4879
|
+
"allowed-tools": z20.optional(z20.array(z20.string()))
|
|
4728
4880
|
});
|
|
4729
4881
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
4730
4882
|
constructor({
|
|
4731
4883
|
baseDir = process.cwd(),
|
|
4732
|
-
relativeDirPath =
|
|
4884
|
+
relativeDirPath = join46(".claude", "skills"),
|
|
4733
4885
|
dirName,
|
|
4734
4886
|
frontmatter,
|
|
4735
4887
|
body,
|
|
@@ -4760,7 +4912,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
4760
4912
|
global: _global = false
|
|
4761
4913
|
} = {}) {
|
|
4762
4914
|
return {
|
|
4763
|
-
relativeDirPath:
|
|
4915
|
+
relativeDirPath: join46(".claude", "skills")
|
|
4764
4916
|
};
|
|
4765
4917
|
}
|
|
4766
4918
|
getFrontmatter() {
|
|
@@ -4848,8 +5000,8 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
4848
5000
|
}) {
|
|
4849
5001
|
const settablePaths = this.getSettablePaths({ global });
|
|
4850
5002
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
4851
|
-
const skillDirPath =
|
|
4852
|
-
const skillFilePath =
|
|
5003
|
+
const skillDirPath = join46(baseDir, actualRelativeDirPath, dirName);
|
|
5004
|
+
const skillFilePath = join46(skillDirPath, SKILL_FILE_NAME);
|
|
4853
5005
|
if (!await fileExists(skillFilePath)) {
|
|
4854
5006
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
4855
5007
|
}
|
|
@@ -4879,14 +5031,14 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
4879
5031
|
};
|
|
4880
5032
|
|
|
4881
5033
|
// src/features/skills/geminicli-skill.ts
|
|
4882
|
-
import { join as
|
|
5034
|
+
import { join as join47 } from "path";
|
|
4883
5035
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
4884
5036
|
static getSettablePaths(options) {
|
|
4885
5037
|
if (options?.global) {
|
|
4886
5038
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
4887
5039
|
}
|
|
4888
5040
|
return {
|
|
4889
|
-
relativeDirPath:
|
|
5041
|
+
relativeDirPath: join47(".gemini", "skills")
|
|
4890
5042
|
};
|
|
4891
5043
|
}
|
|
4892
5044
|
static async fromDir(params) {
|
|
@@ -4925,7 +5077,7 @@ var skillsProcessorToolTargetsSimulated = [
|
|
|
4925
5077
|
"agentsmd"
|
|
4926
5078
|
];
|
|
4927
5079
|
var skillsProcessorToolTargetsGlobal = ["claudecode"];
|
|
4928
|
-
var SkillsProcessorToolTargetSchema =
|
|
5080
|
+
var SkillsProcessorToolTargetSchema = z21.enum(skillsProcessorToolTargets);
|
|
4929
5081
|
var SkillsProcessor = class extends DirFeatureProcessor {
|
|
4930
5082
|
toolTarget;
|
|
4931
5083
|
global;
|
|
@@ -5036,9 +5188,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5036
5188
|
*/
|
|
5037
5189
|
async loadRulesyncDirs() {
|
|
5038
5190
|
const paths = RulesyncSkill.getSettablePaths();
|
|
5039
|
-
const rulesyncSkillsDirPath =
|
|
5040
|
-
const dirPaths = await findFilesByGlobs(
|
|
5041
|
-
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));
|
|
5042
5194
|
const rulesyncSkills = await Promise.all(
|
|
5043
5195
|
dirNames.map(
|
|
5044
5196
|
(dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
|
|
@@ -5077,9 +5229,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5077
5229
|
*/
|
|
5078
5230
|
async loadClaudecodeSkills() {
|
|
5079
5231
|
const paths = ClaudecodeSkill.getSettablePaths({ global: this.global });
|
|
5080
|
-
const skillsDirPath =
|
|
5081
|
-
const dirPaths = await findFilesByGlobs(
|
|
5082
|
-
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));
|
|
5083
5235
|
const toolSkills = await Promise.all(
|
|
5084
5236
|
dirNames.map(
|
|
5085
5237
|
(dirName) => ClaudecodeSkill.fromDir({
|
|
@@ -5097,9 +5249,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5097
5249
|
*/
|
|
5098
5250
|
async loadSimulatedSkills(SkillClass) {
|
|
5099
5251
|
const paths = SkillClass.getSettablePaths();
|
|
5100
|
-
const skillsDirPath =
|
|
5101
|
-
const dirPaths = await findFilesByGlobs(
|
|
5102
|
-
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));
|
|
5103
5255
|
const toolSkills = await Promise.all(
|
|
5104
5256
|
dirNames.map(
|
|
5105
5257
|
(dirName) => SkillClass.fromDir({
|
|
@@ -5144,11 +5296,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5144
5296
|
};
|
|
5145
5297
|
|
|
5146
5298
|
// src/features/subagents/agentsmd-subagent.ts
|
|
5147
|
-
import { join as
|
|
5299
|
+
import { join as join50 } from "path";
|
|
5148
5300
|
|
|
5149
5301
|
// src/features/subagents/simulated-subagent.ts
|
|
5150
|
-
import { basename as
|
|
5151
|
-
import { z as
|
|
5302
|
+
import { basename as basename15, join as join49 } from "path";
|
|
5303
|
+
import { z as z22 } from "zod/mini";
|
|
5152
5304
|
|
|
5153
5305
|
// src/features/subagents/tool-subagent.ts
|
|
5154
5306
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -5183,9 +5335,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
5183
5335
|
};
|
|
5184
5336
|
|
|
5185
5337
|
// src/features/subagents/simulated-subagent.ts
|
|
5186
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
5187
|
-
name:
|
|
5188
|
-
description:
|
|
5338
|
+
var SimulatedSubagentFrontmatterSchema = z22.object({
|
|
5339
|
+
name: z22.string(),
|
|
5340
|
+
description: z22.string()
|
|
5189
5341
|
});
|
|
5190
5342
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
5191
5343
|
frontmatter;
|
|
@@ -5195,7 +5347,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5195
5347
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5196
5348
|
if (!result.success) {
|
|
5197
5349
|
throw new Error(
|
|
5198
|
-
`Invalid frontmatter in ${
|
|
5350
|
+
`Invalid frontmatter in ${join49(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5199
5351
|
);
|
|
5200
5352
|
}
|
|
5201
5353
|
}
|
|
@@ -5246,7 +5398,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5246
5398
|
return {
|
|
5247
5399
|
success: false,
|
|
5248
5400
|
error: new Error(
|
|
5249
|
-
`Invalid frontmatter in ${
|
|
5401
|
+
`Invalid frontmatter in ${join49(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5250
5402
|
)
|
|
5251
5403
|
};
|
|
5252
5404
|
}
|
|
@@ -5256,7 +5408,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5256
5408
|
relativeFilePath,
|
|
5257
5409
|
validate = true
|
|
5258
5410
|
}) {
|
|
5259
|
-
const filePath =
|
|
5411
|
+
const filePath = join49(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
5260
5412
|
const fileContent = await readFileContent(filePath);
|
|
5261
5413
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5262
5414
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -5266,7 +5418,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5266
5418
|
return {
|
|
5267
5419
|
baseDir,
|
|
5268
5420
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
5269
|
-
relativeFilePath:
|
|
5421
|
+
relativeFilePath: basename15(relativeFilePath),
|
|
5270
5422
|
frontmatter: result.data,
|
|
5271
5423
|
body: content.trim(),
|
|
5272
5424
|
validate
|
|
@@ -5278,7 +5430,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5278
5430
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
5279
5431
|
static getSettablePaths() {
|
|
5280
5432
|
return {
|
|
5281
|
-
relativeDirPath:
|
|
5433
|
+
relativeDirPath: join50(".agents", "subagents")
|
|
5282
5434
|
};
|
|
5283
5435
|
}
|
|
5284
5436
|
static async fromFile(params) {
|
|
@@ -5298,11 +5450,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
5298
5450
|
};
|
|
5299
5451
|
|
|
5300
5452
|
// src/features/subagents/codexcli-subagent.ts
|
|
5301
|
-
import { join as
|
|
5453
|
+
import { join as join51 } from "path";
|
|
5302
5454
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
5303
5455
|
static getSettablePaths() {
|
|
5304
5456
|
return {
|
|
5305
|
-
relativeDirPath:
|
|
5457
|
+
relativeDirPath: join51(".codex", "subagents")
|
|
5306
5458
|
};
|
|
5307
5459
|
}
|
|
5308
5460
|
static async fromFile(params) {
|
|
@@ -5322,11 +5474,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
5322
5474
|
};
|
|
5323
5475
|
|
|
5324
5476
|
// src/features/subagents/copilot-subagent.ts
|
|
5325
|
-
import { join as
|
|
5477
|
+
import { join as join52 } from "path";
|
|
5326
5478
|
var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
5327
5479
|
static getSettablePaths() {
|
|
5328
5480
|
return {
|
|
5329
|
-
relativeDirPath:
|
|
5481
|
+
relativeDirPath: join52(".github", "subagents")
|
|
5330
5482
|
};
|
|
5331
5483
|
}
|
|
5332
5484
|
static async fromFile(params) {
|
|
@@ -5346,11 +5498,11 @@ var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
|
5346
5498
|
};
|
|
5347
5499
|
|
|
5348
5500
|
// src/features/subagents/cursor-subagent.ts
|
|
5349
|
-
import { join as
|
|
5501
|
+
import { join as join53 } from "path";
|
|
5350
5502
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
5351
5503
|
static getSettablePaths() {
|
|
5352
5504
|
return {
|
|
5353
|
-
relativeDirPath:
|
|
5505
|
+
relativeDirPath: join53(".cursor", "subagents")
|
|
5354
5506
|
};
|
|
5355
5507
|
}
|
|
5356
5508
|
static async fromFile(params) {
|
|
@@ -5370,11 +5522,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
5370
5522
|
};
|
|
5371
5523
|
|
|
5372
5524
|
// src/features/subagents/geminicli-subagent.ts
|
|
5373
|
-
import { join as
|
|
5525
|
+
import { join as join54 } from "path";
|
|
5374
5526
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
5375
5527
|
static getSettablePaths() {
|
|
5376
5528
|
return {
|
|
5377
|
-
relativeDirPath:
|
|
5529
|
+
relativeDirPath: join54(".gemini", "subagents")
|
|
5378
5530
|
};
|
|
5379
5531
|
}
|
|
5380
5532
|
static async fromFile(params) {
|
|
@@ -5394,11 +5546,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
5394
5546
|
};
|
|
5395
5547
|
|
|
5396
5548
|
// src/features/subagents/roo-subagent.ts
|
|
5397
|
-
import { join as
|
|
5549
|
+
import { join as join55 } from "path";
|
|
5398
5550
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
5399
5551
|
static getSettablePaths() {
|
|
5400
5552
|
return {
|
|
5401
|
-
relativeDirPath:
|
|
5553
|
+
relativeDirPath: join55(".roo", "subagents")
|
|
5402
5554
|
};
|
|
5403
5555
|
}
|
|
5404
5556
|
static async fromFile(params) {
|
|
@@ -5418,23 +5570,23 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
5418
5570
|
};
|
|
5419
5571
|
|
|
5420
5572
|
// src/features/subagents/subagents-processor.ts
|
|
5421
|
-
import { basename as
|
|
5422
|
-
import { z as
|
|
5573
|
+
import { basename as basename17, join as join58 } from "path";
|
|
5574
|
+
import { z as z25 } from "zod/mini";
|
|
5423
5575
|
|
|
5424
5576
|
// src/features/subagents/claudecode-subagent.ts
|
|
5425
|
-
import { join as
|
|
5426
|
-
import { z as
|
|
5577
|
+
import { join as join57 } from "path";
|
|
5578
|
+
import { z as z24 } from "zod/mini";
|
|
5427
5579
|
|
|
5428
5580
|
// src/features/subagents/rulesync-subagent.ts
|
|
5429
|
-
import { basename as
|
|
5430
|
-
import { z as
|
|
5431
|
-
var RulesyncSubagentModelSchema =
|
|
5432
|
-
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({
|
|
5433
5585
|
targets: RulesyncTargetsSchema,
|
|
5434
|
-
name:
|
|
5435
|
-
description:
|
|
5436
|
-
claudecode:
|
|
5437
|
-
|
|
5586
|
+
name: z23.string(),
|
|
5587
|
+
description: z23.string(),
|
|
5588
|
+
claudecode: z23.optional(
|
|
5589
|
+
z23.object({
|
|
5438
5590
|
model: RulesyncSubagentModelSchema
|
|
5439
5591
|
})
|
|
5440
5592
|
)
|
|
@@ -5447,7 +5599,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5447
5599
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5448
5600
|
if (!result.success) {
|
|
5449
5601
|
throw new Error(
|
|
5450
|
-
`Invalid frontmatter in ${
|
|
5602
|
+
`Invalid frontmatter in ${join56(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5451
5603
|
);
|
|
5452
5604
|
}
|
|
5453
5605
|
}
|
|
@@ -5480,7 +5632,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5480
5632
|
return {
|
|
5481
5633
|
success: false,
|
|
5482
5634
|
error: new Error(
|
|
5483
|
-
`Invalid frontmatter in ${
|
|
5635
|
+
`Invalid frontmatter in ${join56(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5484
5636
|
)
|
|
5485
5637
|
};
|
|
5486
5638
|
}
|
|
@@ -5489,14 +5641,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5489
5641
|
relativeFilePath
|
|
5490
5642
|
}) {
|
|
5491
5643
|
const fileContent = await readFileContent(
|
|
5492
|
-
|
|
5644
|
+
join56(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
5493
5645
|
);
|
|
5494
5646
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5495
5647
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5496
5648
|
if (!result.success) {
|
|
5497
5649
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
5498
5650
|
}
|
|
5499
|
-
const filename =
|
|
5651
|
+
const filename = basename16(relativeFilePath);
|
|
5500
5652
|
return new _RulesyncSubagent({
|
|
5501
5653
|
baseDir: process.cwd(),
|
|
5502
5654
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -5508,10 +5660,10 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5508
5660
|
};
|
|
5509
5661
|
|
|
5510
5662
|
// src/features/subagents/claudecode-subagent.ts
|
|
5511
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
5512
|
-
name:
|
|
5513
|
-
description:
|
|
5514
|
-
model:
|
|
5663
|
+
var ClaudecodeSubagentFrontmatterSchema = z24.object({
|
|
5664
|
+
name: z24.string(),
|
|
5665
|
+
description: z24.string(),
|
|
5666
|
+
model: z24.optional(z24.enum(["opus", "sonnet", "haiku", "inherit"]))
|
|
5515
5667
|
});
|
|
5516
5668
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
5517
5669
|
frontmatter;
|
|
@@ -5521,7 +5673,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5521
5673
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5522
5674
|
if (!result.success) {
|
|
5523
5675
|
throw new Error(
|
|
5524
|
-
`Invalid frontmatter in ${
|
|
5676
|
+
`Invalid frontmatter in ${join57(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5525
5677
|
);
|
|
5526
5678
|
}
|
|
5527
5679
|
}
|
|
@@ -5533,7 +5685,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5533
5685
|
}
|
|
5534
5686
|
static getSettablePaths(_options = {}) {
|
|
5535
5687
|
return {
|
|
5536
|
-
relativeDirPath:
|
|
5688
|
+
relativeDirPath: join57(".claude", "agents")
|
|
5537
5689
|
};
|
|
5538
5690
|
}
|
|
5539
5691
|
getFrontmatter() {
|
|
@@ -5599,7 +5751,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5599
5751
|
return {
|
|
5600
5752
|
success: false,
|
|
5601
5753
|
error: new Error(
|
|
5602
|
-
`Invalid frontmatter in ${
|
|
5754
|
+
`Invalid frontmatter in ${join57(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5603
5755
|
)
|
|
5604
5756
|
};
|
|
5605
5757
|
}
|
|
@@ -5617,7 +5769,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5617
5769
|
global = false
|
|
5618
5770
|
}) {
|
|
5619
5771
|
const paths = this.getSettablePaths({ global });
|
|
5620
|
-
const filePath =
|
|
5772
|
+
const filePath = join57(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
5621
5773
|
const fileContent = await readFileContent(filePath);
|
|
5622
5774
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5623
5775
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -5655,7 +5807,7 @@ var subagentsProcessorToolTargetsSimulated = [
|
|
|
5655
5807
|
"roo"
|
|
5656
5808
|
];
|
|
5657
5809
|
var subagentsProcessorToolTargetsGlobal = ["claudecode"];
|
|
5658
|
-
var SubagentsProcessorToolTargetSchema =
|
|
5810
|
+
var SubagentsProcessorToolTargetSchema = z25.enum(subagentsProcessorToolTargets);
|
|
5659
5811
|
var SubagentsProcessor = class extends FeatureProcessor {
|
|
5660
5812
|
toolTarget;
|
|
5661
5813
|
global;
|
|
@@ -5771,7 +5923,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
5771
5923
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
5772
5924
|
*/
|
|
5773
5925
|
async loadRulesyncFiles() {
|
|
5774
|
-
const subagentsDir =
|
|
5926
|
+
const subagentsDir = join58(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
5775
5927
|
const dirExists = await directoryExists(subagentsDir);
|
|
5776
5928
|
if (!dirExists) {
|
|
5777
5929
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -5786,7 +5938,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
5786
5938
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
5787
5939
|
const rulesyncSubagents = [];
|
|
5788
5940
|
for (const mdFile of mdFiles) {
|
|
5789
|
-
const filepath =
|
|
5941
|
+
const filepath = join58(subagentsDir, mdFile);
|
|
5790
5942
|
try {
|
|
5791
5943
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
5792
5944
|
relativeFilePath: mdFile,
|
|
@@ -5904,8 +6056,8 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
5904
6056
|
relativeDirPath,
|
|
5905
6057
|
fromFile
|
|
5906
6058
|
}) {
|
|
5907
|
-
const paths = await findFilesByGlobs(
|
|
5908
|
-
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))));
|
|
5909
6061
|
logger.info(`Successfully loaded ${subagents.length} ${relativeDirPath} subagents`);
|
|
5910
6062
|
return subagents;
|
|
5911
6063
|
}
|
|
@@ -5933,30 +6085,30 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
5933
6085
|
};
|
|
5934
6086
|
|
|
5935
6087
|
// src/features/rules/agentsmd-rule.ts
|
|
5936
|
-
import { join as
|
|
6088
|
+
import { join as join61 } from "path";
|
|
5937
6089
|
|
|
5938
6090
|
// src/features/rules/tool-rule.ts
|
|
5939
|
-
import { join as
|
|
6091
|
+
import { join as join60 } from "path";
|
|
5940
6092
|
|
|
5941
6093
|
// src/features/rules/rulesync-rule.ts
|
|
5942
|
-
import { basename as
|
|
5943
|
-
import { z as
|
|
5944
|
-
var RulesyncRuleFrontmatterSchema =
|
|
5945
|
-
root:
|
|
5946
|
-
targets:
|
|
5947
|
-
description:
|
|
5948
|
-
globs:
|
|
5949
|
-
agentsmd:
|
|
5950
|
-
|
|
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({
|
|
5951
6103
|
// @example "path/to/subproject"
|
|
5952
|
-
subprojectPath:
|
|
6104
|
+
subprojectPath: z26.optional(z26.string())
|
|
5953
6105
|
})
|
|
5954
6106
|
),
|
|
5955
|
-
cursor:
|
|
5956
|
-
|
|
5957
|
-
alwaysApply:
|
|
5958
|
-
description:
|
|
5959
|
-
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()))
|
|
5960
6112
|
})
|
|
5961
6113
|
)
|
|
5962
6114
|
});
|
|
@@ -5968,7 +6120,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
5968
6120
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
5969
6121
|
if (!result.success) {
|
|
5970
6122
|
throw new Error(
|
|
5971
|
-
`Invalid frontmatter in ${
|
|
6123
|
+
`Invalid frontmatter in ${join59(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5972
6124
|
);
|
|
5973
6125
|
}
|
|
5974
6126
|
}
|
|
@@ -6003,7 +6155,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6003
6155
|
return {
|
|
6004
6156
|
success: false,
|
|
6005
6157
|
error: new Error(
|
|
6006
|
-
`Invalid frontmatter in ${
|
|
6158
|
+
`Invalid frontmatter in ${join59(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
6007
6159
|
)
|
|
6008
6160
|
};
|
|
6009
6161
|
}
|
|
@@ -6012,12 +6164,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6012
6164
|
relativeFilePath,
|
|
6013
6165
|
validate = true
|
|
6014
6166
|
}) {
|
|
6015
|
-
const legacyPath =
|
|
6167
|
+
const legacyPath = join59(
|
|
6016
6168
|
process.cwd(),
|
|
6017
6169
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
6018
6170
|
relativeFilePath
|
|
6019
6171
|
);
|
|
6020
|
-
const recommendedPath =
|
|
6172
|
+
const recommendedPath = join59(
|
|
6021
6173
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
6022
6174
|
relativeFilePath
|
|
6023
6175
|
);
|
|
@@ -6036,7 +6188,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6036
6188
|
agentsmd: result.data.agentsmd,
|
|
6037
6189
|
cursor: result.data.cursor
|
|
6038
6190
|
};
|
|
6039
|
-
const filename =
|
|
6191
|
+
const filename = basename18(legacyPath);
|
|
6040
6192
|
return new _RulesyncRule({
|
|
6041
6193
|
baseDir: process.cwd(),
|
|
6042
6194
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -6050,7 +6202,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6050
6202
|
relativeFilePath,
|
|
6051
6203
|
validate = true
|
|
6052
6204
|
}) {
|
|
6053
|
-
const filePath =
|
|
6205
|
+
const filePath = join59(
|
|
6054
6206
|
process.cwd(),
|
|
6055
6207
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
6056
6208
|
relativeFilePath
|
|
@@ -6069,7 +6221,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6069
6221
|
agentsmd: result.data.agentsmd,
|
|
6070
6222
|
cursor: result.data.cursor
|
|
6071
6223
|
};
|
|
6072
|
-
const filename =
|
|
6224
|
+
const filename = basename18(filePath);
|
|
6073
6225
|
return new _RulesyncRule({
|
|
6074
6226
|
baseDir: process.cwd(),
|
|
6075
6227
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -6144,7 +6296,7 @@ var ToolRule = class extends ToolFile {
|
|
|
6144
6296
|
rulesyncRule,
|
|
6145
6297
|
validate = true,
|
|
6146
6298
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
6147
|
-
nonRootPath = { relativeDirPath:
|
|
6299
|
+
nonRootPath = { relativeDirPath: join60(".agents", "memories") }
|
|
6148
6300
|
}) {
|
|
6149
6301
|
const params = this.buildToolRuleParamsDefault({
|
|
6150
6302
|
baseDir,
|
|
@@ -6155,7 +6307,7 @@ var ToolRule = class extends ToolFile {
|
|
|
6155
6307
|
});
|
|
6156
6308
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
6157
6309
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
6158
|
-
params.relativeDirPath =
|
|
6310
|
+
params.relativeDirPath = join60(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
6159
6311
|
params.relativeFilePath = "AGENTS.md";
|
|
6160
6312
|
}
|
|
6161
6313
|
return params;
|
|
@@ -6220,7 +6372,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6220
6372
|
relativeFilePath: "AGENTS.md"
|
|
6221
6373
|
},
|
|
6222
6374
|
nonRoot: {
|
|
6223
|
-
relativeDirPath:
|
|
6375
|
+
relativeDirPath: join61(".agents", "memories")
|
|
6224
6376
|
}
|
|
6225
6377
|
};
|
|
6226
6378
|
}
|
|
@@ -6230,8 +6382,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6230
6382
|
validate = true
|
|
6231
6383
|
}) {
|
|
6232
6384
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
6233
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
6234
|
-
const fileContent = await readFileContent(
|
|
6385
|
+
const relativePath = isRoot ? "AGENTS.md" : join61(".agents", "memories", relativeFilePath);
|
|
6386
|
+
const fileContent = await readFileContent(join61(baseDir, relativePath));
|
|
6235
6387
|
return new _AgentsMdRule({
|
|
6236
6388
|
baseDir,
|
|
6237
6389
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -6271,12 +6423,12 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6271
6423
|
};
|
|
6272
6424
|
|
|
6273
6425
|
// src/features/rules/amazonqcli-rule.ts
|
|
6274
|
-
import { join as
|
|
6426
|
+
import { join as join62 } from "path";
|
|
6275
6427
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
6276
6428
|
static getSettablePaths() {
|
|
6277
6429
|
return {
|
|
6278
6430
|
nonRoot: {
|
|
6279
|
-
relativeDirPath:
|
|
6431
|
+
relativeDirPath: join62(".amazonq", "rules")
|
|
6280
6432
|
}
|
|
6281
6433
|
};
|
|
6282
6434
|
}
|
|
@@ -6286,7 +6438,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
6286
6438
|
validate = true
|
|
6287
6439
|
}) {
|
|
6288
6440
|
const fileContent = await readFileContent(
|
|
6289
|
-
|
|
6441
|
+
join62(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6290
6442
|
);
|
|
6291
6443
|
return new _AmazonQCliRule({
|
|
6292
6444
|
baseDir,
|
|
@@ -6325,8 +6477,63 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
6325
6477
|
}
|
|
6326
6478
|
};
|
|
6327
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
|
+
|
|
6328
6535
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
6329
|
-
import { join as
|
|
6536
|
+
import { join as join64 } from "path";
|
|
6330
6537
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
6331
6538
|
toRulesyncRule() {
|
|
6332
6539
|
const rulesyncFrontmatter = {
|
|
@@ -6352,7 +6559,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6352
6559
|
relativeFilePath: ".augment-guidelines"
|
|
6353
6560
|
},
|
|
6354
6561
|
nonRoot: {
|
|
6355
|
-
relativeDirPath:
|
|
6562
|
+
relativeDirPath: join64(".augment", "rules")
|
|
6356
6563
|
}
|
|
6357
6564
|
};
|
|
6358
6565
|
}
|
|
@@ -6387,8 +6594,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6387
6594
|
}) {
|
|
6388
6595
|
const settablePaths = this.getSettablePaths();
|
|
6389
6596
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
6390
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
6391
|
-
const fileContent = await readFileContent(
|
|
6597
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join64(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
6598
|
+
const fileContent = await readFileContent(join64(baseDir, relativePath));
|
|
6392
6599
|
return new _AugmentcodeLegacyRule({
|
|
6393
6600
|
baseDir,
|
|
6394
6601
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -6401,7 +6608,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6401
6608
|
};
|
|
6402
6609
|
|
|
6403
6610
|
// src/features/rules/augmentcode-rule.ts
|
|
6404
|
-
import { join as
|
|
6611
|
+
import { join as join65 } from "path";
|
|
6405
6612
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
6406
6613
|
toRulesyncRule() {
|
|
6407
6614
|
return this.toRulesyncRuleDefault();
|
|
@@ -6409,7 +6616,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6409
6616
|
static getSettablePaths() {
|
|
6410
6617
|
return {
|
|
6411
6618
|
nonRoot: {
|
|
6412
|
-
relativeDirPath:
|
|
6619
|
+
relativeDirPath: join65(".augment", "rules")
|
|
6413
6620
|
}
|
|
6414
6621
|
};
|
|
6415
6622
|
}
|
|
@@ -6433,7 +6640,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6433
6640
|
validate = true
|
|
6434
6641
|
}) {
|
|
6435
6642
|
const fileContent = await readFileContent(
|
|
6436
|
-
|
|
6643
|
+
join65(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6437
6644
|
);
|
|
6438
6645
|
const { body: content } = parseFrontmatter(fileContent);
|
|
6439
6646
|
return new _AugmentcodeRule({
|
|
@@ -6456,7 +6663,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6456
6663
|
};
|
|
6457
6664
|
|
|
6458
6665
|
// src/features/rules/claudecode-rule.ts
|
|
6459
|
-
import { join as
|
|
6666
|
+
import { join as join66 } from "path";
|
|
6460
6667
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
6461
6668
|
static getSettablePaths({
|
|
6462
6669
|
global
|
|
@@ -6475,7 +6682,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6475
6682
|
relativeFilePath: "CLAUDE.md"
|
|
6476
6683
|
},
|
|
6477
6684
|
nonRoot: {
|
|
6478
|
-
relativeDirPath:
|
|
6685
|
+
relativeDirPath: join66(".claude", "memories")
|
|
6479
6686
|
}
|
|
6480
6687
|
};
|
|
6481
6688
|
}
|
|
@@ -6490,7 +6697,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6490
6697
|
if (isRoot) {
|
|
6491
6698
|
const relativePath2 = paths.root.relativeFilePath;
|
|
6492
6699
|
const fileContent2 = await readFileContent(
|
|
6493
|
-
|
|
6700
|
+
join66(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
6494
6701
|
);
|
|
6495
6702
|
return new _ClaudecodeRule({
|
|
6496
6703
|
baseDir,
|
|
@@ -6504,8 +6711,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6504
6711
|
if (!paths.nonRoot) {
|
|
6505
6712
|
throw new Error("nonRoot path is not set");
|
|
6506
6713
|
}
|
|
6507
|
-
const relativePath =
|
|
6508
|
-
const fileContent = await readFileContent(
|
|
6714
|
+
const relativePath = join66(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
6715
|
+
const fileContent = await readFileContent(join66(baseDir, relativePath));
|
|
6509
6716
|
return new _ClaudecodeRule({
|
|
6510
6717
|
baseDir,
|
|
6511
6718
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -6547,10 +6754,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6547
6754
|
};
|
|
6548
6755
|
|
|
6549
6756
|
// src/features/rules/cline-rule.ts
|
|
6550
|
-
import { join as
|
|
6551
|
-
import { z as
|
|
6552
|
-
var ClineRuleFrontmatterSchema =
|
|
6553
|
-
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()
|
|
6554
6761
|
});
|
|
6555
6762
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
6556
6763
|
static getSettablePaths() {
|
|
@@ -6592,7 +6799,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
6592
6799
|
validate = true
|
|
6593
6800
|
}) {
|
|
6594
6801
|
const fileContent = await readFileContent(
|
|
6595
|
-
|
|
6802
|
+
join67(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6596
6803
|
);
|
|
6597
6804
|
return new _ClineRule({
|
|
6598
6805
|
baseDir,
|
|
@@ -6605,7 +6812,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
6605
6812
|
};
|
|
6606
6813
|
|
|
6607
6814
|
// src/features/rules/codexcli-rule.ts
|
|
6608
|
-
import { join as
|
|
6815
|
+
import { join as join68 } from "path";
|
|
6609
6816
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
6610
6817
|
static getSettablePaths({
|
|
6611
6818
|
global
|
|
@@ -6624,7 +6831,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
6624
6831
|
relativeFilePath: "AGENTS.md"
|
|
6625
6832
|
},
|
|
6626
6833
|
nonRoot: {
|
|
6627
|
-
relativeDirPath:
|
|
6834
|
+
relativeDirPath: join68(".codex", "memories")
|
|
6628
6835
|
}
|
|
6629
6836
|
};
|
|
6630
6837
|
}
|
|
@@ -6639,7 +6846,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
6639
6846
|
if (isRoot) {
|
|
6640
6847
|
const relativePath2 = paths.root.relativeFilePath;
|
|
6641
6848
|
const fileContent2 = await readFileContent(
|
|
6642
|
-
|
|
6849
|
+
join68(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
6643
6850
|
);
|
|
6644
6851
|
return new _CodexcliRule({
|
|
6645
6852
|
baseDir,
|
|
@@ -6653,8 +6860,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
6653
6860
|
if (!paths.nonRoot) {
|
|
6654
6861
|
throw new Error("nonRoot path is not set");
|
|
6655
6862
|
}
|
|
6656
|
-
const relativePath =
|
|
6657
|
-
const fileContent = await readFileContent(
|
|
6863
|
+
const relativePath = join68(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
6864
|
+
const fileContent = await readFileContent(join68(baseDir, relativePath));
|
|
6658
6865
|
return new _CodexcliRule({
|
|
6659
6866
|
baseDir,
|
|
6660
6867
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -6696,11 +6903,11 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
6696
6903
|
};
|
|
6697
6904
|
|
|
6698
6905
|
// src/features/rules/copilot-rule.ts
|
|
6699
|
-
import { join as
|
|
6700
|
-
import { z as
|
|
6701
|
-
var CopilotRuleFrontmatterSchema =
|
|
6702
|
-
description:
|
|
6703
|
-
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())
|
|
6704
6911
|
});
|
|
6705
6912
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
6706
6913
|
frontmatter;
|
|
@@ -6712,7 +6919,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6712
6919
|
relativeFilePath: "copilot-instructions.md"
|
|
6713
6920
|
},
|
|
6714
6921
|
nonRoot: {
|
|
6715
|
-
relativeDirPath:
|
|
6922
|
+
relativeDirPath: join69(".github", "instructions")
|
|
6716
6923
|
}
|
|
6717
6924
|
};
|
|
6718
6925
|
}
|
|
@@ -6721,7 +6928,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6721
6928
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
6722
6929
|
if (!result.success) {
|
|
6723
6930
|
throw new Error(
|
|
6724
|
-
`Invalid frontmatter in ${
|
|
6931
|
+
`Invalid frontmatter in ${join69(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6725
6932
|
);
|
|
6726
6933
|
}
|
|
6727
6934
|
}
|
|
@@ -6799,11 +7006,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6799
7006
|
validate = true
|
|
6800
7007
|
}) {
|
|
6801
7008
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
6802
|
-
const relativePath = isRoot ?
|
|
7009
|
+
const relativePath = isRoot ? join69(
|
|
6803
7010
|
this.getSettablePaths().root.relativeDirPath,
|
|
6804
7011
|
this.getSettablePaths().root.relativeFilePath
|
|
6805
|
-
) :
|
|
6806
|
-
const fileContent = await readFileContent(
|
|
7012
|
+
) : join69(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
7013
|
+
const fileContent = await readFileContent(join69(baseDir, relativePath));
|
|
6807
7014
|
if (isRoot) {
|
|
6808
7015
|
return new _CopilotRule({
|
|
6809
7016
|
baseDir,
|
|
@@ -6822,7 +7029,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6822
7029
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
6823
7030
|
if (!result.success) {
|
|
6824
7031
|
throw new Error(
|
|
6825
|
-
`Invalid frontmatter in ${
|
|
7032
|
+
`Invalid frontmatter in ${join69(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
6826
7033
|
);
|
|
6827
7034
|
}
|
|
6828
7035
|
return new _CopilotRule({
|
|
@@ -6846,7 +7053,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6846
7053
|
return {
|
|
6847
7054
|
success: false,
|
|
6848
7055
|
error: new Error(
|
|
6849
|
-
`Invalid frontmatter in ${
|
|
7056
|
+
`Invalid frontmatter in ${join69(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
6850
7057
|
)
|
|
6851
7058
|
};
|
|
6852
7059
|
}
|
|
@@ -6866,12 +7073,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6866
7073
|
};
|
|
6867
7074
|
|
|
6868
7075
|
// src/features/rules/cursor-rule.ts
|
|
6869
|
-
import { basename as
|
|
6870
|
-
import { z as
|
|
6871
|
-
var CursorRuleFrontmatterSchema =
|
|
6872
|
-
description:
|
|
6873
|
-
globs:
|
|
6874
|
-
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())
|
|
6875
7082
|
});
|
|
6876
7083
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
6877
7084
|
frontmatter;
|
|
@@ -6879,7 +7086,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
6879
7086
|
static getSettablePaths() {
|
|
6880
7087
|
return {
|
|
6881
7088
|
nonRoot: {
|
|
6882
|
-
relativeDirPath:
|
|
7089
|
+
relativeDirPath: join70(".cursor", "rules")
|
|
6883
7090
|
}
|
|
6884
7091
|
};
|
|
6885
7092
|
}
|
|
@@ -6888,7 +7095,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
6888
7095
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
6889
7096
|
if (!result.success) {
|
|
6890
7097
|
throw new Error(
|
|
6891
|
-
`Invalid frontmatter in ${
|
|
7098
|
+
`Invalid frontmatter in ${join70(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6892
7099
|
);
|
|
6893
7100
|
}
|
|
6894
7101
|
}
|
|
@@ -7005,19 +7212,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7005
7212
|
validate = true
|
|
7006
7213
|
}) {
|
|
7007
7214
|
const fileContent = await readFileContent(
|
|
7008
|
-
|
|
7215
|
+
join70(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7009
7216
|
);
|
|
7010
7217
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
7011
7218
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7012
7219
|
if (!result.success) {
|
|
7013
7220
|
throw new Error(
|
|
7014
|
-
`Invalid frontmatter in ${
|
|
7221
|
+
`Invalid frontmatter in ${join70(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
7015
7222
|
);
|
|
7016
7223
|
}
|
|
7017
7224
|
return new _CursorRule({
|
|
7018
7225
|
baseDir,
|
|
7019
7226
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
7020
|
-
relativeFilePath:
|
|
7227
|
+
relativeFilePath: basename19(relativeFilePath),
|
|
7021
7228
|
frontmatter: result.data,
|
|
7022
7229
|
body: content.trim(),
|
|
7023
7230
|
validate
|
|
@@ -7034,7 +7241,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7034
7241
|
return {
|
|
7035
7242
|
success: false,
|
|
7036
7243
|
error: new Error(
|
|
7037
|
-
`Invalid frontmatter in ${
|
|
7244
|
+
`Invalid frontmatter in ${join70(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7038
7245
|
)
|
|
7039
7246
|
};
|
|
7040
7247
|
}
|
|
@@ -7054,7 +7261,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7054
7261
|
};
|
|
7055
7262
|
|
|
7056
7263
|
// src/features/rules/geminicli-rule.ts
|
|
7057
|
-
import { join as
|
|
7264
|
+
import { join as join71 } from "path";
|
|
7058
7265
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
7059
7266
|
static getSettablePaths({
|
|
7060
7267
|
global
|
|
@@ -7073,7 +7280,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7073
7280
|
relativeFilePath: "GEMINI.md"
|
|
7074
7281
|
},
|
|
7075
7282
|
nonRoot: {
|
|
7076
|
-
relativeDirPath:
|
|
7283
|
+
relativeDirPath: join71(".gemini", "memories")
|
|
7077
7284
|
}
|
|
7078
7285
|
};
|
|
7079
7286
|
}
|
|
@@ -7088,7 +7295,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7088
7295
|
if (isRoot) {
|
|
7089
7296
|
const relativePath2 = paths.root.relativeFilePath;
|
|
7090
7297
|
const fileContent2 = await readFileContent(
|
|
7091
|
-
|
|
7298
|
+
join71(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
7092
7299
|
);
|
|
7093
7300
|
return new _GeminiCliRule({
|
|
7094
7301
|
baseDir,
|
|
@@ -7102,8 +7309,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7102
7309
|
if (!paths.nonRoot) {
|
|
7103
7310
|
throw new Error("nonRoot path is not set");
|
|
7104
7311
|
}
|
|
7105
|
-
const relativePath =
|
|
7106
|
-
const fileContent = await readFileContent(
|
|
7312
|
+
const relativePath = join71(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
7313
|
+
const fileContent = await readFileContent(join71(baseDir, relativePath));
|
|
7107
7314
|
return new _GeminiCliRule({
|
|
7108
7315
|
baseDir,
|
|
7109
7316
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -7145,7 +7352,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7145
7352
|
};
|
|
7146
7353
|
|
|
7147
7354
|
// src/features/rules/junie-rule.ts
|
|
7148
|
-
import { join as
|
|
7355
|
+
import { join as join72 } from "path";
|
|
7149
7356
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
7150
7357
|
static getSettablePaths() {
|
|
7151
7358
|
return {
|
|
@@ -7154,7 +7361,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7154
7361
|
relativeFilePath: "guidelines.md"
|
|
7155
7362
|
},
|
|
7156
7363
|
nonRoot: {
|
|
7157
|
-
relativeDirPath:
|
|
7364
|
+
relativeDirPath: join72(".junie", "memories")
|
|
7158
7365
|
}
|
|
7159
7366
|
};
|
|
7160
7367
|
}
|
|
@@ -7164,8 +7371,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7164
7371
|
validate = true
|
|
7165
7372
|
}) {
|
|
7166
7373
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
7167
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
7168
|
-
const fileContent = await readFileContent(
|
|
7374
|
+
const relativePath = isRoot ? "guidelines.md" : join72(".junie", "memories", relativeFilePath);
|
|
7375
|
+
const fileContent = await readFileContent(join72(baseDir, relativePath));
|
|
7169
7376
|
return new _JunieRule({
|
|
7170
7377
|
baseDir,
|
|
7171
7378
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7205,12 +7412,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7205
7412
|
};
|
|
7206
7413
|
|
|
7207
7414
|
// src/features/rules/kiro-rule.ts
|
|
7208
|
-
import { join as
|
|
7415
|
+
import { join as join73 } from "path";
|
|
7209
7416
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
7210
7417
|
static getSettablePaths() {
|
|
7211
7418
|
return {
|
|
7212
7419
|
nonRoot: {
|
|
7213
|
-
relativeDirPath:
|
|
7420
|
+
relativeDirPath: join73(".kiro", "steering")
|
|
7214
7421
|
}
|
|
7215
7422
|
};
|
|
7216
7423
|
}
|
|
@@ -7220,7 +7427,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
7220
7427
|
validate = true
|
|
7221
7428
|
}) {
|
|
7222
7429
|
const fileContent = await readFileContent(
|
|
7223
|
-
|
|
7430
|
+
join73(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7224
7431
|
);
|
|
7225
7432
|
return new _KiroRule({
|
|
7226
7433
|
baseDir,
|
|
@@ -7260,7 +7467,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
7260
7467
|
};
|
|
7261
7468
|
|
|
7262
7469
|
// src/features/rules/opencode-rule.ts
|
|
7263
|
-
import { join as
|
|
7470
|
+
import { join as join74 } from "path";
|
|
7264
7471
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
7265
7472
|
static getSettablePaths() {
|
|
7266
7473
|
return {
|
|
@@ -7269,7 +7476,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7269
7476
|
relativeFilePath: "AGENTS.md"
|
|
7270
7477
|
},
|
|
7271
7478
|
nonRoot: {
|
|
7272
|
-
relativeDirPath:
|
|
7479
|
+
relativeDirPath: join74(".opencode", "memories")
|
|
7273
7480
|
}
|
|
7274
7481
|
};
|
|
7275
7482
|
}
|
|
@@ -7279,8 +7486,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7279
7486
|
validate = true
|
|
7280
7487
|
}) {
|
|
7281
7488
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
7282
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
7283
|
-
const fileContent = await readFileContent(
|
|
7489
|
+
const relativePath = isRoot ? "AGENTS.md" : join74(".opencode", "memories", relativeFilePath);
|
|
7490
|
+
const fileContent = await readFileContent(join74(baseDir, relativePath));
|
|
7284
7491
|
return new _OpenCodeRule({
|
|
7285
7492
|
baseDir,
|
|
7286
7493
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7320,7 +7527,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7320
7527
|
};
|
|
7321
7528
|
|
|
7322
7529
|
// src/features/rules/qwencode-rule.ts
|
|
7323
|
-
import { join as
|
|
7530
|
+
import { join as join75 } from "path";
|
|
7324
7531
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
7325
7532
|
static getSettablePaths() {
|
|
7326
7533
|
return {
|
|
@@ -7329,7 +7536,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7329
7536
|
relativeFilePath: "QWEN.md"
|
|
7330
7537
|
},
|
|
7331
7538
|
nonRoot: {
|
|
7332
|
-
relativeDirPath:
|
|
7539
|
+
relativeDirPath: join75(".qwen", "memories")
|
|
7333
7540
|
}
|
|
7334
7541
|
};
|
|
7335
7542
|
}
|
|
@@ -7339,8 +7546,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7339
7546
|
validate = true
|
|
7340
7547
|
}) {
|
|
7341
7548
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
7342
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
7343
|
-
const fileContent = await readFileContent(
|
|
7549
|
+
const relativePath = isRoot ? "QWEN.md" : join75(".qwen", "memories", relativeFilePath);
|
|
7550
|
+
const fileContent = await readFileContent(join75(baseDir, relativePath));
|
|
7344
7551
|
return new _QwencodeRule({
|
|
7345
7552
|
baseDir,
|
|
7346
7553
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7377,12 +7584,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7377
7584
|
};
|
|
7378
7585
|
|
|
7379
7586
|
// src/features/rules/roo-rule.ts
|
|
7380
|
-
import { join as
|
|
7587
|
+
import { join as join76 } from "path";
|
|
7381
7588
|
var RooRule = class _RooRule extends ToolRule {
|
|
7382
7589
|
static getSettablePaths() {
|
|
7383
7590
|
return {
|
|
7384
7591
|
nonRoot: {
|
|
7385
|
-
relativeDirPath:
|
|
7592
|
+
relativeDirPath: join76(".roo", "rules")
|
|
7386
7593
|
}
|
|
7387
7594
|
};
|
|
7388
7595
|
}
|
|
@@ -7392,7 +7599,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
7392
7599
|
validate = true
|
|
7393
7600
|
}) {
|
|
7394
7601
|
const fileContent = await readFileContent(
|
|
7395
|
-
|
|
7602
|
+
join76(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7396
7603
|
);
|
|
7397
7604
|
return new _RooRule({
|
|
7398
7605
|
baseDir,
|
|
@@ -7447,7 +7654,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
7447
7654
|
};
|
|
7448
7655
|
|
|
7449
7656
|
// src/features/rules/warp-rule.ts
|
|
7450
|
-
import { join as
|
|
7657
|
+
import { join as join77 } from "path";
|
|
7451
7658
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
7452
7659
|
constructor({ fileContent, root, ...rest }) {
|
|
7453
7660
|
super({
|
|
@@ -7463,7 +7670,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
7463
7670
|
relativeFilePath: "WARP.md"
|
|
7464
7671
|
},
|
|
7465
7672
|
nonRoot: {
|
|
7466
|
-
relativeDirPath:
|
|
7673
|
+
relativeDirPath: join77(".warp", "memories")
|
|
7467
7674
|
}
|
|
7468
7675
|
};
|
|
7469
7676
|
}
|
|
@@ -7473,8 +7680,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
7473
7680
|
validate = true
|
|
7474
7681
|
}) {
|
|
7475
7682
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
7476
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
7477
|
-
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));
|
|
7478
7685
|
return new _WarpRule({
|
|
7479
7686
|
baseDir,
|
|
7480
7687
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -7514,12 +7721,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
7514
7721
|
};
|
|
7515
7722
|
|
|
7516
7723
|
// src/features/rules/windsurf-rule.ts
|
|
7517
|
-
import { join as
|
|
7724
|
+
import { join as join78 } from "path";
|
|
7518
7725
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
7519
7726
|
static getSettablePaths() {
|
|
7520
7727
|
return {
|
|
7521
7728
|
nonRoot: {
|
|
7522
|
-
relativeDirPath:
|
|
7729
|
+
relativeDirPath: join78(".windsurf", "rules")
|
|
7523
7730
|
}
|
|
7524
7731
|
};
|
|
7525
7732
|
}
|
|
@@ -7529,7 +7736,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
7529
7736
|
validate = true
|
|
7530
7737
|
}) {
|
|
7531
7738
|
const fileContent = await readFileContent(
|
|
7532
|
-
|
|
7739
|
+
join78(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7533
7740
|
);
|
|
7534
7741
|
return new _WindsurfRule({
|
|
7535
7742
|
baseDir,
|
|
@@ -7571,6 +7778,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
7571
7778
|
var rulesProcessorToolTargets = [
|
|
7572
7779
|
"agentsmd",
|
|
7573
7780
|
"amazonqcli",
|
|
7781
|
+
"antigravity",
|
|
7574
7782
|
"augmentcode",
|
|
7575
7783
|
"augmentcode-legacy",
|
|
7576
7784
|
"claudecode",
|
|
@@ -7587,7 +7795,7 @@ var rulesProcessorToolTargets = [
|
|
|
7587
7795
|
"warp",
|
|
7588
7796
|
"windsurf"
|
|
7589
7797
|
];
|
|
7590
|
-
var RulesProcessorToolTargetSchema =
|
|
7798
|
+
var RulesProcessorToolTargetSchema = z30.enum(rulesProcessorToolTargets);
|
|
7591
7799
|
var rulesProcessorToolTargetsGlobal = [
|
|
7592
7800
|
"claudecode",
|
|
7593
7801
|
"codexcli",
|
|
@@ -7644,6 +7852,15 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7644
7852
|
rulesyncRule,
|
|
7645
7853
|
validate: true
|
|
7646
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
|
+
});
|
|
7647
7864
|
case "augmentcode":
|
|
7648
7865
|
if (!AugmentcodeRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
7649
7866
|
return null;
|
|
@@ -7941,10 +8158,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7941
8158
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
7942
8159
|
*/
|
|
7943
8160
|
async loadRulesyncFiles() {
|
|
7944
|
-
const files = await findFilesByGlobs(
|
|
8161
|
+
const files = await findFilesByGlobs(join79(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
7945
8162
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
7946
8163
|
const rulesyncRules = await Promise.all(
|
|
7947
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath:
|
|
8164
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename20(file) }))
|
|
7948
8165
|
);
|
|
7949
8166
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
7950
8167
|
if (rootRules.length > 1) {
|
|
@@ -7962,10 +8179,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7962
8179
|
return rulesyncRules;
|
|
7963
8180
|
}
|
|
7964
8181
|
async loadRulesyncFilesLegacy() {
|
|
7965
|
-
const legacyFiles = await findFilesByGlobs(
|
|
8182
|
+
const legacyFiles = await findFilesByGlobs(join79(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
7966
8183
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
7967
8184
|
return Promise.all(
|
|
7968
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath:
|
|
8185
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename20(file) }))
|
|
7969
8186
|
);
|
|
7970
8187
|
}
|
|
7971
8188
|
/**
|
|
@@ -8028,13 +8245,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
8028
8245
|
return [];
|
|
8029
8246
|
}
|
|
8030
8247
|
const rootFilePaths = await findFilesByGlobs(
|
|
8031
|
-
|
|
8248
|
+
join79(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
|
|
8032
8249
|
);
|
|
8033
8250
|
return await Promise.all(
|
|
8034
8251
|
rootFilePaths.map(
|
|
8035
8252
|
(filePath) => root.fromFile({
|
|
8036
8253
|
baseDir: this.baseDir,
|
|
8037
|
-
relativeFilePath:
|
|
8254
|
+
relativeFilePath: basename20(filePath),
|
|
8038
8255
|
global: this.global
|
|
8039
8256
|
})
|
|
8040
8257
|
)
|
|
@@ -8046,13 +8263,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
8046
8263
|
return [];
|
|
8047
8264
|
}
|
|
8048
8265
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
8049
|
-
|
|
8266
|
+
join79(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
|
|
8050
8267
|
);
|
|
8051
8268
|
return await Promise.all(
|
|
8052
8269
|
nonRootFilePaths.map(
|
|
8053
8270
|
(filePath) => nonRoot.fromFile({
|
|
8054
8271
|
baseDir: this.baseDir,
|
|
8055
|
-
relativeFilePath:
|
|
8272
|
+
relativeFilePath: basename20(filePath),
|
|
8056
8273
|
global: this.global
|
|
8057
8274
|
})
|
|
8058
8275
|
)
|
|
@@ -8423,21 +8640,21 @@ s/<command> [arguments]
|
|
|
8423
8640
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
8424
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.
|
|
8425
8642
|
|
|
8426
|
-
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.` : "";
|
|
8427
8644
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
8428
8645
|
|
|
8429
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.
|
|
8430
8647
|
|
|
8431
|
-
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.
|
|
8432
8649
|
|
|
8433
|
-
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.` : "";
|
|
8434
8651
|
const skillsSection = skills ? `## Simulated Skills
|
|
8435
8652
|
|
|
8436
8653
|
Simulated skills are specialized capabilities that can be invoked to handle specific types of tasks.
|
|
8437
8654
|
|
|
8438
|
-
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.
|
|
8439
8656
|
|
|
8440
|
-
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.
|
|
8441
8658
|
|
|
8442
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.` : "";
|
|
8443
8660
|
const result = [
|
|
@@ -8699,15 +8916,14 @@ async function generateSkills(config) {
|
|
|
8699
8916
|
}
|
|
8700
8917
|
|
|
8701
8918
|
// src/cli/commands/gitignore.ts
|
|
8702
|
-
import { join as
|
|
8919
|
+
import { join as join80 } from "path";
|
|
8703
8920
|
var gitignoreCommand = async () => {
|
|
8704
|
-
const gitignorePath =
|
|
8921
|
+
const gitignorePath = join80(process.cwd(), ".gitignore");
|
|
8705
8922
|
const rulesFilesToIgnore = [
|
|
8706
8923
|
"# Generated by rulesync - AI tool configuration files",
|
|
8707
8924
|
// AGENTS.md
|
|
8708
8925
|
"**/AGENTS.md",
|
|
8709
8926
|
"**/.agents/",
|
|
8710
|
-
"**/.agents/skills/",
|
|
8711
8927
|
// Amazon Q
|
|
8712
8928
|
"**/.amazonq/",
|
|
8713
8929
|
// Augment
|
|
@@ -8733,9 +8949,6 @@ var gitignoreCommand = async () => {
|
|
|
8733
8949
|
// Cursor
|
|
8734
8950
|
"**/.cursor/",
|
|
8735
8951
|
"**/.cursorignore",
|
|
8736
|
-
"**/.cursor/mcp.json",
|
|
8737
|
-
"**/.cursor/subagents/",
|
|
8738
|
-
"**/.cursor/skills/",
|
|
8739
8952
|
// Gemini
|
|
8740
8953
|
"**/GEMINI.md",
|
|
8741
8954
|
"**/.gemini/memories/",
|
|
@@ -8771,7 +8984,8 @@ var gitignoreCommand = async () => {
|
|
|
8771
8984
|
"**/.warp/",
|
|
8772
8985
|
"**/WARP.md",
|
|
8773
8986
|
// Others
|
|
8774
|
-
"**/modular-mcp.json"
|
|
8987
|
+
"**/modular-mcp.json",
|
|
8988
|
+
"!.rulesync/.aiignore"
|
|
8775
8989
|
];
|
|
8776
8990
|
let gitignoreContent = "";
|
|
8777
8991
|
if (await fileExists(gitignorePath)) {
|
|
@@ -8977,7 +9191,7 @@ async function importSkills(config, tool) {
|
|
|
8977
9191
|
}
|
|
8978
9192
|
|
|
8979
9193
|
// src/cli/commands/init.ts
|
|
8980
|
-
import { join as
|
|
9194
|
+
import { join as join81 } from "path";
|
|
8981
9195
|
async function initCommand() {
|
|
8982
9196
|
logger.info("Initializing rulesync...");
|
|
8983
9197
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -9140,14 +9354,14 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
9140
9354
|
await ensureDir(commandPaths.relativeDirPath);
|
|
9141
9355
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
9142
9356
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
9143
|
-
const ruleFilepath =
|
|
9357
|
+
const ruleFilepath = join81(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
9144
9358
|
if (!await fileExists(ruleFilepath)) {
|
|
9145
9359
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
9146
9360
|
logger.success(`Created ${ruleFilepath}`);
|
|
9147
9361
|
} else {
|
|
9148
9362
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
9149
9363
|
}
|
|
9150
|
-
const mcpFilepath =
|
|
9364
|
+
const mcpFilepath = join81(
|
|
9151
9365
|
mcpPaths.recommended.relativeDirPath,
|
|
9152
9366
|
mcpPaths.recommended.relativeFilePath
|
|
9153
9367
|
);
|
|
@@ -9157,21 +9371,21 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
9157
9371
|
} else {
|
|
9158
9372
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
9159
9373
|
}
|
|
9160
|
-
const commandFilepath =
|
|
9374
|
+
const commandFilepath = join81(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
9161
9375
|
if (!await fileExists(commandFilepath)) {
|
|
9162
9376
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
9163
9377
|
logger.success(`Created ${commandFilepath}`);
|
|
9164
9378
|
} else {
|
|
9165
9379
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
9166
9380
|
}
|
|
9167
|
-
const subagentFilepath =
|
|
9381
|
+
const subagentFilepath = join81(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
9168
9382
|
if (!await fileExists(subagentFilepath)) {
|
|
9169
9383
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
9170
9384
|
logger.success(`Created ${subagentFilepath}`);
|
|
9171
9385
|
} else {
|
|
9172
9386
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
9173
9387
|
}
|
|
9174
|
-
const ignoreFilepath =
|
|
9388
|
+
const ignoreFilepath = join81(
|
|
9175
9389
|
ignorePaths.recommended.relativeDirPath,
|
|
9176
9390
|
ignorePaths.recommended.relativeFilePath
|
|
9177
9391
|
);
|
|
@@ -9187,12 +9401,12 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
9187
9401
|
import { FastMCP } from "fastmcp";
|
|
9188
9402
|
|
|
9189
9403
|
// src/mcp/commands.ts
|
|
9190
|
-
import { basename as
|
|
9191
|
-
import { z as
|
|
9404
|
+
import { basename as basename21, join as join82 } from "path";
|
|
9405
|
+
import { z as z31 } from "zod/mini";
|
|
9192
9406
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
9193
9407
|
var maxCommandsCount = 1e3;
|
|
9194
9408
|
async function listCommands() {
|
|
9195
|
-
const commandsDir =
|
|
9409
|
+
const commandsDir = join82(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
9196
9410
|
try {
|
|
9197
9411
|
const files = await listDirectoryFiles(commandsDir);
|
|
9198
9412
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -9204,7 +9418,7 @@ async function listCommands() {
|
|
|
9204
9418
|
});
|
|
9205
9419
|
const frontmatter = command.getFrontmatter();
|
|
9206
9420
|
return {
|
|
9207
|
-
relativePathFromCwd:
|
|
9421
|
+
relativePathFromCwd: join82(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
9208
9422
|
frontmatter
|
|
9209
9423
|
};
|
|
9210
9424
|
} catch (error) {
|
|
@@ -9224,13 +9438,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
9224
9438
|
relativePath: relativePathFromCwd,
|
|
9225
9439
|
intendedRootDir: process.cwd()
|
|
9226
9440
|
});
|
|
9227
|
-
const filename =
|
|
9441
|
+
const filename = basename21(relativePathFromCwd);
|
|
9228
9442
|
try {
|
|
9229
9443
|
const command = await RulesyncCommand.fromFile({
|
|
9230
9444
|
relativeFilePath: filename
|
|
9231
9445
|
});
|
|
9232
9446
|
return {
|
|
9233
|
-
relativePathFromCwd:
|
|
9447
|
+
relativePathFromCwd: join82(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
9234
9448
|
frontmatter: command.getFrontmatter(),
|
|
9235
9449
|
body: command.getBody()
|
|
9236
9450
|
};
|
|
@@ -9249,7 +9463,7 @@ async function putCommand({
|
|
|
9249
9463
|
relativePath: relativePathFromCwd,
|
|
9250
9464
|
intendedRootDir: process.cwd()
|
|
9251
9465
|
});
|
|
9252
|
-
const filename =
|
|
9466
|
+
const filename = basename21(relativePathFromCwd);
|
|
9253
9467
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
9254
9468
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
9255
9469
|
throw new Error(
|
|
@@ -9259,7 +9473,7 @@ async function putCommand({
|
|
|
9259
9473
|
try {
|
|
9260
9474
|
const existingCommands = await listCommands();
|
|
9261
9475
|
const isUpdate = existingCommands.some(
|
|
9262
|
-
(command2) => command2.relativePathFromCwd ===
|
|
9476
|
+
(command2) => command2.relativePathFromCwd === join82(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
9263
9477
|
);
|
|
9264
9478
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
9265
9479
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -9274,11 +9488,11 @@ async function putCommand({
|
|
|
9274
9488
|
fileContent,
|
|
9275
9489
|
validate: true
|
|
9276
9490
|
});
|
|
9277
|
-
const commandsDir =
|
|
9491
|
+
const commandsDir = join82(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
9278
9492
|
await ensureDir(commandsDir);
|
|
9279
9493
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
9280
9494
|
return {
|
|
9281
|
-
relativePathFromCwd:
|
|
9495
|
+
relativePathFromCwd: join82(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
9282
9496
|
frontmatter: command.getFrontmatter(),
|
|
9283
9497
|
body: command.getBody()
|
|
9284
9498
|
};
|
|
@@ -9293,12 +9507,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
9293
9507
|
relativePath: relativePathFromCwd,
|
|
9294
9508
|
intendedRootDir: process.cwd()
|
|
9295
9509
|
});
|
|
9296
|
-
const filename =
|
|
9297
|
-
const fullPath =
|
|
9510
|
+
const filename = basename21(relativePathFromCwd);
|
|
9511
|
+
const fullPath = join82(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
9298
9512
|
try {
|
|
9299
9513
|
await removeFile(fullPath);
|
|
9300
9514
|
return {
|
|
9301
|
-
relativePathFromCwd:
|
|
9515
|
+
relativePathFromCwd: join82(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
9302
9516
|
};
|
|
9303
9517
|
} catch (error) {
|
|
9304
9518
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -9307,23 +9521,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
9307
9521
|
}
|
|
9308
9522
|
}
|
|
9309
9523
|
var commandToolSchemas = {
|
|
9310
|
-
listCommands:
|
|
9311
|
-
getCommand:
|
|
9312
|
-
relativePathFromCwd:
|
|
9524
|
+
listCommands: z31.object({}),
|
|
9525
|
+
getCommand: z31.object({
|
|
9526
|
+
relativePathFromCwd: z31.string()
|
|
9313
9527
|
}),
|
|
9314
|
-
putCommand:
|
|
9315
|
-
relativePathFromCwd:
|
|
9528
|
+
putCommand: z31.object({
|
|
9529
|
+
relativePathFromCwd: z31.string(),
|
|
9316
9530
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
9317
|
-
body:
|
|
9531
|
+
body: z31.string()
|
|
9318
9532
|
}),
|
|
9319
|
-
deleteCommand:
|
|
9320
|
-
relativePathFromCwd:
|
|
9533
|
+
deleteCommand: z31.object({
|
|
9534
|
+
relativePathFromCwd: z31.string()
|
|
9321
9535
|
})
|
|
9322
9536
|
};
|
|
9323
9537
|
var commandTools = {
|
|
9324
9538
|
listCommands: {
|
|
9325
9539
|
name: "listCommands",
|
|
9326
|
-
description: `List all commands from ${
|
|
9540
|
+
description: `List all commands from ${join82(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
9327
9541
|
parameters: commandToolSchemas.listCommands,
|
|
9328
9542
|
execute: async () => {
|
|
9329
9543
|
const commands = await listCommands();
|
|
@@ -9365,11 +9579,11 @@ var commandTools = {
|
|
|
9365
9579
|
};
|
|
9366
9580
|
|
|
9367
9581
|
// src/mcp/ignore.ts
|
|
9368
|
-
import { join as
|
|
9369
|
-
import { z as
|
|
9582
|
+
import { join as join83 } from "path";
|
|
9583
|
+
import { z as z32 } from "zod/mini";
|
|
9370
9584
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
9371
9585
|
async function getIgnoreFile() {
|
|
9372
|
-
const ignoreFilePath =
|
|
9586
|
+
const ignoreFilePath = join83(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
9373
9587
|
try {
|
|
9374
9588
|
const content = await readFileContent(ignoreFilePath);
|
|
9375
9589
|
return {
|
|
@@ -9383,7 +9597,7 @@ async function getIgnoreFile() {
|
|
|
9383
9597
|
}
|
|
9384
9598
|
}
|
|
9385
9599
|
async function putIgnoreFile({ content }) {
|
|
9386
|
-
const ignoreFilePath =
|
|
9600
|
+
const ignoreFilePath = join83(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
9387
9601
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
9388
9602
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
9389
9603
|
throw new Error(
|
|
@@ -9404,8 +9618,8 @@ async function putIgnoreFile({ content }) {
|
|
|
9404
9618
|
}
|
|
9405
9619
|
}
|
|
9406
9620
|
async function deleteIgnoreFile() {
|
|
9407
|
-
const aiignorePath =
|
|
9408
|
-
const legacyIgnorePath =
|
|
9621
|
+
const aiignorePath = join83(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
9622
|
+
const legacyIgnorePath = join83(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
9409
9623
|
try {
|
|
9410
9624
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
9411
9625
|
return {
|
|
@@ -9423,11 +9637,11 @@ async function deleteIgnoreFile() {
|
|
|
9423
9637
|
}
|
|
9424
9638
|
}
|
|
9425
9639
|
var ignoreToolSchemas = {
|
|
9426
|
-
getIgnoreFile:
|
|
9427
|
-
putIgnoreFile:
|
|
9428
|
-
content:
|
|
9640
|
+
getIgnoreFile: z32.object({}),
|
|
9641
|
+
putIgnoreFile: z32.object({
|
|
9642
|
+
content: z32.string()
|
|
9429
9643
|
}),
|
|
9430
|
-
deleteIgnoreFile:
|
|
9644
|
+
deleteIgnoreFile: z32.object({})
|
|
9431
9645
|
};
|
|
9432
9646
|
var ignoreTools = {
|
|
9433
9647
|
getIgnoreFile: {
|
|
@@ -9460,8 +9674,8 @@ var ignoreTools = {
|
|
|
9460
9674
|
};
|
|
9461
9675
|
|
|
9462
9676
|
// src/mcp/mcp.ts
|
|
9463
|
-
import { join as
|
|
9464
|
-
import { z as
|
|
9677
|
+
import { join as join84 } from "path";
|
|
9678
|
+
import { z as z33 } from "zod/mini";
|
|
9465
9679
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
9466
9680
|
async function getMcpFile() {
|
|
9467
9681
|
const config = await ConfigResolver.resolve({});
|
|
@@ -9470,7 +9684,7 @@ async function getMcpFile() {
|
|
|
9470
9684
|
validate: true,
|
|
9471
9685
|
modularMcp: config.getModularMcp()
|
|
9472
9686
|
});
|
|
9473
|
-
const relativePathFromCwd =
|
|
9687
|
+
const relativePathFromCwd = join84(
|
|
9474
9688
|
rulesyncMcp.getRelativeDirPath(),
|
|
9475
9689
|
rulesyncMcp.getRelativeFilePath()
|
|
9476
9690
|
);
|
|
@@ -9503,7 +9717,7 @@ async function putMcpFile({ content }) {
|
|
|
9503
9717
|
const paths = RulesyncMcp.getSettablePaths();
|
|
9504
9718
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
9505
9719
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
9506
|
-
const fullPath =
|
|
9720
|
+
const fullPath = join84(baseDir, relativeDirPath, relativeFilePath);
|
|
9507
9721
|
const rulesyncMcp = new RulesyncMcp({
|
|
9508
9722
|
baseDir,
|
|
9509
9723
|
relativeDirPath,
|
|
@@ -9512,9 +9726,9 @@ async function putMcpFile({ content }) {
|
|
|
9512
9726
|
validate: true,
|
|
9513
9727
|
modularMcp: config.getModularMcp()
|
|
9514
9728
|
});
|
|
9515
|
-
await ensureDir(
|
|
9729
|
+
await ensureDir(join84(baseDir, relativeDirPath));
|
|
9516
9730
|
await writeFileContent(fullPath, content);
|
|
9517
|
-
const relativePathFromCwd =
|
|
9731
|
+
const relativePathFromCwd = join84(relativeDirPath, relativeFilePath);
|
|
9518
9732
|
return {
|
|
9519
9733
|
relativePathFromCwd,
|
|
9520
9734
|
content: rulesyncMcp.getFileContent()
|
|
@@ -9529,15 +9743,15 @@ async function deleteMcpFile() {
|
|
|
9529
9743
|
try {
|
|
9530
9744
|
const baseDir = process.cwd();
|
|
9531
9745
|
const paths = RulesyncMcp.getSettablePaths();
|
|
9532
|
-
const recommendedPath =
|
|
9746
|
+
const recommendedPath = join84(
|
|
9533
9747
|
baseDir,
|
|
9534
9748
|
paths.recommended.relativeDirPath,
|
|
9535
9749
|
paths.recommended.relativeFilePath
|
|
9536
9750
|
);
|
|
9537
|
-
const legacyPath =
|
|
9751
|
+
const legacyPath = join84(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
9538
9752
|
await removeFile(recommendedPath);
|
|
9539
9753
|
await removeFile(legacyPath);
|
|
9540
|
-
const relativePathFromCwd =
|
|
9754
|
+
const relativePathFromCwd = join84(
|
|
9541
9755
|
paths.recommended.relativeDirPath,
|
|
9542
9756
|
paths.recommended.relativeFilePath
|
|
9543
9757
|
);
|
|
@@ -9551,11 +9765,11 @@ async function deleteMcpFile() {
|
|
|
9551
9765
|
}
|
|
9552
9766
|
}
|
|
9553
9767
|
var mcpToolSchemas = {
|
|
9554
|
-
getMcpFile:
|
|
9555
|
-
putMcpFile:
|
|
9556
|
-
content:
|
|
9768
|
+
getMcpFile: z33.object({}),
|
|
9769
|
+
putMcpFile: z33.object({
|
|
9770
|
+
content: z33.string()
|
|
9557
9771
|
}),
|
|
9558
|
-
deleteMcpFile:
|
|
9772
|
+
deleteMcpFile: z33.object({})
|
|
9559
9773
|
};
|
|
9560
9774
|
var mcpTools = {
|
|
9561
9775
|
getMcpFile: {
|
|
@@ -9588,12 +9802,12 @@ var mcpTools = {
|
|
|
9588
9802
|
};
|
|
9589
9803
|
|
|
9590
9804
|
// src/mcp/rules.ts
|
|
9591
|
-
import { basename as
|
|
9592
|
-
import { z as
|
|
9805
|
+
import { basename as basename22, join as join85 } from "path";
|
|
9806
|
+
import { z as z34 } from "zod/mini";
|
|
9593
9807
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
9594
9808
|
var maxRulesCount = 1e3;
|
|
9595
9809
|
async function listRules() {
|
|
9596
|
-
const rulesDir =
|
|
9810
|
+
const rulesDir = join85(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
9597
9811
|
try {
|
|
9598
9812
|
const files = await listDirectoryFiles(rulesDir);
|
|
9599
9813
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -9606,7 +9820,7 @@ async function listRules() {
|
|
|
9606
9820
|
});
|
|
9607
9821
|
const frontmatter = rule.getFrontmatter();
|
|
9608
9822
|
return {
|
|
9609
|
-
relativePathFromCwd:
|
|
9823
|
+
relativePathFromCwd: join85(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
9610
9824
|
frontmatter
|
|
9611
9825
|
};
|
|
9612
9826
|
} catch (error) {
|
|
@@ -9626,14 +9840,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
9626
9840
|
relativePath: relativePathFromCwd,
|
|
9627
9841
|
intendedRootDir: process.cwd()
|
|
9628
9842
|
});
|
|
9629
|
-
const filename =
|
|
9843
|
+
const filename = basename22(relativePathFromCwd);
|
|
9630
9844
|
try {
|
|
9631
9845
|
const rule = await RulesyncRule.fromFile({
|
|
9632
9846
|
relativeFilePath: filename,
|
|
9633
9847
|
validate: true
|
|
9634
9848
|
});
|
|
9635
9849
|
return {
|
|
9636
|
-
relativePathFromCwd:
|
|
9850
|
+
relativePathFromCwd: join85(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
9637
9851
|
frontmatter: rule.getFrontmatter(),
|
|
9638
9852
|
body: rule.getBody()
|
|
9639
9853
|
};
|
|
@@ -9652,7 +9866,7 @@ async function putRule({
|
|
|
9652
9866
|
relativePath: relativePathFromCwd,
|
|
9653
9867
|
intendedRootDir: process.cwd()
|
|
9654
9868
|
});
|
|
9655
|
-
const filename =
|
|
9869
|
+
const filename = basename22(relativePathFromCwd);
|
|
9656
9870
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
9657
9871
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
9658
9872
|
throw new Error(
|
|
@@ -9662,7 +9876,7 @@ async function putRule({
|
|
|
9662
9876
|
try {
|
|
9663
9877
|
const existingRules = await listRules();
|
|
9664
9878
|
const isUpdate = existingRules.some(
|
|
9665
|
-
(rule2) => rule2.relativePathFromCwd ===
|
|
9879
|
+
(rule2) => rule2.relativePathFromCwd === join85(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
9666
9880
|
);
|
|
9667
9881
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
9668
9882
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -9675,11 +9889,11 @@ async function putRule({
|
|
|
9675
9889
|
body,
|
|
9676
9890
|
validate: true
|
|
9677
9891
|
});
|
|
9678
|
-
const rulesDir =
|
|
9892
|
+
const rulesDir = join85(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
9679
9893
|
await ensureDir(rulesDir);
|
|
9680
9894
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
9681
9895
|
return {
|
|
9682
|
-
relativePathFromCwd:
|
|
9896
|
+
relativePathFromCwd: join85(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
9683
9897
|
frontmatter: rule.getFrontmatter(),
|
|
9684
9898
|
body: rule.getBody()
|
|
9685
9899
|
};
|
|
@@ -9694,12 +9908,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
9694
9908
|
relativePath: relativePathFromCwd,
|
|
9695
9909
|
intendedRootDir: process.cwd()
|
|
9696
9910
|
});
|
|
9697
|
-
const filename =
|
|
9698
|
-
const fullPath =
|
|
9911
|
+
const filename = basename22(relativePathFromCwd);
|
|
9912
|
+
const fullPath = join85(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
9699
9913
|
try {
|
|
9700
9914
|
await removeFile(fullPath);
|
|
9701
9915
|
return {
|
|
9702
|
-
relativePathFromCwd:
|
|
9916
|
+
relativePathFromCwd: join85(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
9703
9917
|
};
|
|
9704
9918
|
} catch (error) {
|
|
9705
9919
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -9708,23 +9922,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
9708
9922
|
}
|
|
9709
9923
|
}
|
|
9710
9924
|
var ruleToolSchemas = {
|
|
9711
|
-
listRules:
|
|
9712
|
-
getRule:
|
|
9713
|
-
relativePathFromCwd:
|
|
9925
|
+
listRules: z34.object({}),
|
|
9926
|
+
getRule: z34.object({
|
|
9927
|
+
relativePathFromCwd: z34.string()
|
|
9714
9928
|
}),
|
|
9715
|
-
putRule:
|
|
9716
|
-
relativePathFromCwd:
|
|
9929
|
+
putRule: z34.object({
|
|
9930
|
+
relativePathFromCwd: z34.string(),
|
|
9717
9931
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
9718
|
-
body:
|
|
9932
|
+
body: z34.string()
|
|
9719
9933
|
}),
|
|
9720
|
-
deleteRule:
|
|
9721
|
-
relativePathFromCwd:
|
|
9934
|
+
deleteRule: z34.object({
|
|
9935
|
+
relativePathFromCwd: z34.string()
|
|
9722
9936
|
})
|
|
9723
9937
|
};
|
|
9724
9938
|
var ruleTools = {
|
|
9725
9939
|
listRules: {
|
|
9726
9940
|
name: "listRules",
|
|
9727
|
-
description: `List all rules from ${
|
|
9941
|
+
description: `List all rules from ${join85(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
9728
9942
|
parameters: ruleToolSchemas.listRules,
|
|
9729
9943
|
execute: async () => {
|
|
9730
9944
|
const rules = await listRules();
|
|
@@ -9766,12 +9980,12 @@ var ruleTools = {
|
|
|
9766
9980
|
};
|
|
9767
9981
|
|
|
9768
9982
|
// src/mcp/subagents.ts
|
|
9769
|
-
import { basename as
|
|
9770
|
-
import { z as
|
|
9983
|
+
import { basename as basename23, join as join86 } from "path";
|
|
9984
|
+
import { z as z35 } from "zod/mini";
|
|
9771
9985
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
9772
9986
|
var maxSubagentsCount = 1e3;
|
|
9773
9987
|
async function listSubagents() {
|
|
9774
|
-
const subagentsDir =
|
|
9988
|
+
const subagentsDir = join86(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
9775
9989
|
try {
|
|
9776
9990
|
const files = await listDirectoryFiles(subagentsDir);
|
|
9777
9991
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -9784,7 +9998,7 @@ async function listSubagents() {
|
|
|
9784
9998
|
});
|
|
9785
9999
|
const frontmatter = subagent.getFrontmatter();
|
|
9786
10000
|
return {
|
|
9787
|
-
relativePathFromCwd:
|
|
10001
|
+
relativePathFromCwd: join86(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
9788
10002
|
frontmatter
|
|
9789
10003
|
};
|
|
9790
10004
|
} catch (error) {
|
|
@@ -9806,14 +10020,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
9806
10020
|
relativePath: relativePathFromCwd,
|
|
9807
10021
|
intendedRootDir: process.cwd()
|
|
9808
10022
|
});
|
|
9809
|
-
const filename =
|
|
10023
|
+
const filename = basename23(relativePathFromCwd);
|
|
9810
10024
|
try {
|
|
9811
10025
|
const subagent = await RulesyncSubagent.fromFile({
|
|
9812
10026
|
relativeFilePath: filename,
|
|
9813
10027
|
validate: true
|
|
9814
10028
|
});
|
|
9815
10029
|
return {
|
|
9816
|
-
relativePathFromCwd:
|
|
10030
|
+
relativePathFromCwd: join86(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
9817
10031
|
frontmatter: subagent.getFrontmatter(),
|
|
9818
10032
|
body: subagent.getBody()
|
|
9819
10033
|
};
|
|
@@ -9832,7 +10046,7 @@ async function putSubagent({
|
|
|
9832
10046
|
relativePath: relativePathFromCwd,
|
|
9833
10047
|
intendedRootDir: process.cwd()
|
|
9834
10048
|
});
|
|
9835
|
-
const filename =
|
|
10049
|
+
const filename = basename23(relativePathFromCwd);
|
|
9836
10050
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
9837
10051
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
9838
10052
|
throw new Error(
|
|
@@ -9842,7 +10056,7 @@ async function putSubagent({
|
|
|
9842
10056
|
try {
|
|
9843
10057
|
const existingSubagents = await listSubagents();
|
|
9844
10058
|
const isUpdate = existingSubagents.some(
|
|
9845
|
-
(subagent2) => subagent2.relativePathFromCwd ===
|
|
10059
|
+
(subagent2) => subagent2.relativePathFromCwd === join86(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
9846
10060
|
);
|
|
9847
10061
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
9848
10062
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -9855,11 +10069,11 @@ async function putSubagent({
|
|
|
9855
10069
|
body,
|
|
9856
10070
|
validate: true
|
|
9857
10071
|
});
|
|
9858
|
-
const subagentsDir =
|
|
10072
|
+
const subagentsDir = join86(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
9859
10073
|
await ensureDir(subagentsDir);
|
|
9860
10074
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
9861
10075
|
return {
|
|
9862
|
-
relativePathFromCwd:
|
|
10076
|
+
relativePathFromCwd: join86(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
9863
10077
|
frontmatter: subagent.getFrontmatter(),
|
|
9864
10078
|
body: subagent.getBody()
|
|
9865
10079
|
};
|
|
@@ -9874,12 +10088,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
9874
10088
|
relativePath: relativePathFromCwd,
|
|
9875
10089
|
intendedRootDir: process.cwd()
|
|
9876
10090
|
});
|
|
9877
|
-
const filename =
|
|
9878
|
-
const fullPath =
|
|
10091
|
+
const filename = basename23(relativePathFromCwd);
|
|
10092
|
+
const fullPath = join86(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
9879
10093
|
try {
|
|
9880
10094
|
await removeFile(fullPath);
|
|
9881
10095
|
return {
|
|
9882
|
-
relativePathFromCwd:
|
|
10096
|
+
relativePathFromCwd: join86(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
9883
10097
|
};
|
|
9884
10098
|
} catch (error) {
|
|
9885
10099
|
throw new Error(
|
|
@@ -9891,23 +10105,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
9891
10105
|
}
|
|
9892
10106
|
}
|
|
9893
10107
|
var subagentToolSchemas = {
|
|
9894
|
-
listSubagents:
|
|
9895
|
-
getSubagent:
|
|
9896
|
-
relativePathFromCwd:
|
|
10108
|
+
listSubagents: z35.object({}),
|
|
10109
|
+
getSubagent: z35.object({
|
|
10110
|
+
relativePathFromCwd: z35.string()
|
|
9897
10111
|
}),
|
|
9898
|
-
putSubagent:
|
|
9899
|
-
relativePathFromCwd:
|
|
10112
|
+
putSubagent: z35.object({
|
|
10113
|
+
relativePathFromCwd: z35.string(),
|
|
9900
10114
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
9901
|
-
body:
|
|
10115
|
+
body: z35.string()
|
|
9902
10116
|
}),
|
|
9903
|
-
deleteSubagent:
|
|
9904
|
-
relativePathFromCwd:
|
|
10117
|
+
deleteSubagent: z35.object({
|
|
10118
|
+
relativePathFromCwd: z35.string()
|
|
9905
10119
|
})
|
|
9906
10120
|
};
|
|
9907
10121
|
var subagentTools = {
|
|
9908
10122
|
listSubagents: {
|
|
9909
10123
|
name: "listSubagents",
|
|
9910
|
-
description: `List all subagents from ${
|
|
10124
|
+
description: `List all subagents from ${join86(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
9911
10125
|
parameters: subagentToolSchemas.listSubagents,
|
|
9912
10126
|
execute: async () => {
|
|
9913
10127
|
const subagents = await listSubagents();
|
|
@@ -9981,7 +10195,7 @@ async function mcpCommand({ version }) {
|
|
|
9981
10195
|
}
|
|
9982
10196
|
|
|
9983
10197
|
// src/cli/index.ts
|
|
9984
|
-
var getVersion = () => "3.
|
|
10198
|
+
var getVersion = () => "3.28.0";
|
|
9985
10199
|
var main = async () => {
|
|
9986
10200
|
const program = new Command();
|
|
9987
10201
|
const version = getVersion();
|