rulesync 3.27.1 → 3.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/dist/index.cjs +769 -531
- package/dist/index.js +762 -524
- 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
|
|
|
@@ -875,7 +876,7 @@ var RulesyncFile = class extends AiFile {
|
|
|
875
876
|
};
|
|
876
877
|
|
|
877
878
|
// src/features/commands/rulesync-command.ts
|
|
878
|
-
var RulesyncCommandFrontmatterSchema = z5.
|
|
879
|
+
var RulesyncCommandFrontmatterSchema = z5.looseObject({
|
|
879
880
|
targets: RulesyncTargetsSchema,
|
|
880
881
|
description: z5.string()
|
|
881
882
|
});
|
|
@@ -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.looseObject({
|
|
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() {
|
|
@@ -986,9 +1111,12 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
986
1111
|
return this.frontmatter;
|
|
987
1112
|
}
|
|
988
1113
|
toRulesyncCommand() {
|
|
1114
|
+
const { description, ...restFields } = this.frontmatter;
|
|
989
1115
|
const rulesyncFrontmatter = {
|
|
990
1116
|
targets: ["*"],
|
|
991
|
-
description
|
|
1117
|
+
description,
|
|
1118
|
+
// Preserve extra fields in claudecode section
|
|
1119
|
+
...Object.keys(restFields).length > 0 && { claudecode: restFields }
|
|
992
1120
|
};
|
|
993
1121
|
const fileContent = stringifyFrontmatter(this.body, rulesyncFrontmatter);
|
|
994
1122
|
return new RulesyncCommand({
|
|
@@ -1009,8 +1137,10 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1009
1137
|
global = false
|
|
1010
1138
|
}) {
|
|
1011
1139
|
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
1140
|
+
const claudecodeFields = rulesyncFrontmatter.claudecode ?? {};
|
|
1012
1141
|
const claudecodeFrontmatter = {
|
|
1013
|
-
description: rulesyncFrontmatter.description
|
|
1142
|
+
description: rulesyncFrontmatter.description,
|
|
1143
|
+
...claudecodeFields
|
|
1014
1144
|
};
|
|
1015
1145
|
const body = rulesyncCommand.getBody();
|
|
1016
1146
|
const paths = this.getSettablePaths({ global });
|
|
@@ -1034,7 +1164,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1034
1164
|
return {
|
|
1035
1165
|
success: false,
|
|
1036
1166
|
error: new Error(
|
|
1037
|
-
`Invalid frontmatter in ${
|
|
1167
|
+
`Invalid frontmatter in ${join7(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1038
1168
|
)
|
|
1039
1169
|
};
|
|
1040
1170
|
}
|
|
@@ -1052,7 +1182,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1052
1182
|
global = false
|
|
1053
1183
|
}) {
|
|
1054
1184
|
const paths = this.getSettablePaths({ global });
|
|
1055
|
-
const filePath =
|
|
1185
|
+
const filePath = join7(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1056
1186
|
const fileContent = await readFileContent(filePath);
|
|
1057
1187
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1058
1188
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1062,7 +1192,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1062
1192
|
return new _ClaudecodeCommand({
|
|
1063
1193
|
baseDir,
|
|
1064
1194
|
relativeDirPath: paths.relativeDirPath,
|
|
1065
|
-
relativeFilePath:
|
|
1195
|
+
relativeFilePath: basename6(relativeFilePath),
|
|
1066
1196
|
frontmatter: result.data,
|
|
1067
1197
|
body: content.trim(),
|
|
1068
1198
|
validate
|
|
@@ -1071,14 +1201,14 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1071
1201
|
};
|
|
1072
1202
|
|
|
1073
1203
|
// src/features/commands/codexcli-command.ts
|
|
1074
|
-
import { basename as
|
|
1204
|
+
import { basename as basename7, join as join8 } from "path";
|
|
1075
1205
|
var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
1076
1206
|
static getSettablePaths({ global } = {}) {
|
|
1077
1207
|
if (!global) {
|
|
1078
1208
|
throw new Error("CodexcliCommand only supports global mode. Please pass { global: true }.");
|
|
1079
1209
|
}
|
|
1080
1210
|
return {
|
|
1081
|
-
relativeDirPath:
|
|
1211
|
+
relativeDirPath: join8(".codex", "prompts")
|
|
1082
1212
|
};
|
|
1083
1213
|
}
|
|
1084
1214
|
toRulesyncCommand() {
|
|
@@ -1131,13 +1261,13 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1131
1261
|
global = false
|
|
1132
1262
|
}) {
|
|
1133
1263
|
const paths = this.getSettablePaths({ global });
|
|
1134
|
-
const filePath =
|
|
1264
|
+
const filePath = join8(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1135
1265
|
const fileContent = await readFileContent(filePath);
|
|
1136
1266
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1137
1267
|
return new _CodexcliCommand({
|
|
1138
1268
|
baseDir,
|
|
1139
1269
|
relativeDirPath: paths.relativeDirPath,
|
|
1140
|
-
relativeFilePath:
|
|
1270
|
+
relativeFilePath: basename7(relativeFilePath),
|
|
1141
1271
|
fileContent: content.trim(),
|
|
1142
1272
|
validate
|
|
1143
1273
|
});
|
|
@@ -1145,11 +1275,11 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1145
1275
|
};
|
|
1146
1276
|
|
|
1147
1277
|
// src/features/commands/copilot-command.ts
|
|
1148
|
-
import { basename as
|
|
1149
|
-
import { z as
|
|
1150
|
-
var CopilotCommandFrontmatterSchema =
|
|
1151
|
-
mode:
|
|
1152
|
-
description:
|
|
1278
|
+
import { basename as basename8, join as join9 } from "path";
|
|
1279
|
+
import { z as z8 } from "zod/mini";
|
|
1280
|
+
var CopilotCommandFrontmatterSchema = z8.looseObject({
|
|
1281
|
+
mode: z8.literal("agent"),
|
|
1282
|
+
description: z8.string()
|
|
1153
1283
|
});
|
|
1154
1284
|
var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
1155
1285
|
frontmatter;
|
|
@@ -1159,7 +1289,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1159
1289
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1160
1290
|
if (!result.success) {
|
|
1161
1291
|
throw new Error(
|
|
1162
|
-
`Invalid frontmatter in ${
|
|
1292
|
+
`Invalid frontmatter in ${join9(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1163
1293
|
);
|
|
1164
1294
|
}
|
|
1165
1295
|
}
|
|
@@ -1172,7 +1302,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1172
1302
|
}
|
|
1173
1303
|
static getSettablePaths() {
|
|
1174
1304
|
return {
|
|
1175
|
-
relativeDirPath:
|
|
1305
|
+
relativeDirPath: join9(".github", "prompts")
|
|
1176
1306
|
};
|
|
1177
1307
|
}
|
|
1178
1308
|
getBody() {
|
|
@@ -1182,9 +1312,12 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1182
1312
|
return this.frontmatter;
|
|
1183
1313
|
}
|
|
1184
1314
|
toRulesyncCommand() {
|
|
1315
|
+
const { mode: _mode, description, ...restFields } = this.frontmatter;
|
|
1185
1316
|
const rulesyncFrontmatter = {
|
|
1186
1317
|
targets: ["*"],
|
|
1187
|
-
description
|
|
1318
|
+
description,
|
|
1319
|
+
// Preserve extra fields in copilot section (excluding mode which is fixed)
|
|
1320
|
+
...Object.keys(restFields).length > 0 && { copilot: restFields }
|
|
1188
1321
|
};
|
|
1189
1322
|
const originalFilePath = this.relativeFilePath;
|
|
1190
1323
|
const relativeFilePath = originalFilePath.replace(/\.prompt\.md$/, ".md");
|
|
@@ -1209,7 +1342,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1209
1342
|
return {
|
|
1210
1343
|
success: false,
|
|
1211
1344
|
error: new Error(
|
|
1212
|
-
`Invalid frontmatter in ${
|
|
1345
|
+
`Invalid frontmatter in ${join9(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1213
1346
|
)
|
|
1214
1347
|
};
|
|
1215
1348
|
}
|
|
@@ -1221,9 +1354,11 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1221
1354
|
}) {
|
|
1222
1355
|
const paths = this.getSettablePaths();
|
|
1223
1356
|
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
1357
|
+
const copilotFields = rulesyncFrontmatter.copilot ?? {};
|
|
1224
1358
|
const copilotFrontmatter = {
|
|
1225
1359
|
mode: "agent",
|
|
1226
|
-
description: rulesyncFrontmatter.description
|
|
1360
|
+
description: rulesyncFrontmatter.description,
|
|
1361
|
+
...copilotFields
|
|
1227
1362
|
};
|
|
1228
1363
|
const body = rulesyncCommand.getBody();
|
|
1229
1364
|
const originalFilePath = rulesyncCommand.getRelativeFilePath();
|
|
@@ -1243,7 +1378,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1243
1378
|
validate = true
|
|
1244
1379
|
}) {
|
|
1245
1380
|
const paths = this.getSettablePaths();
|
|
1246
|
-
const filePath =
|
|
1381
|
+
const filePath = join9(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1247
1382
|
const fileContent = await readFileContent(filePath);
|
|
1248
1383
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1249
1384
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1253,7 +1388,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1253
1388
|
return new _CopilotCommand({
|
|
1254
1389
|
baseDir,
|
|
1255
1390
|
relativeDirPath: paths.relativeDirPath,
|
|
1256
|
-
relativeFilePath:
|
|
1391
|
+
relativeFilePath: basename8(relativeFilePath),
|
|
1257
1392
|
frontmatter: result.data,
|
|
1258
1393
|
body: content.trim(),
|
|
1259
1394
|
validate
|
|
@@ -1268,11 +1403,11 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1268
1403
|
};
|
|
1269
1404
|
|
|
1270
1405
|
// src/features/commands/cursor-command.ts
|
|
1271
|
-
import { basename as
|
|
1406
|
+
import { basename as basename9, join as join10 } from "path";
|
|
1272
1407
|
var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
1273
1408
|
static getSettablePaths(_options = {}) {
|
|
1274
1409
|
return {
|
|
1275
|
-
relativeDirPath:
|
|
1410
|
+
relativeDirPath: join10(".cursor", "commands")
|
|
1276
1411
|
};
|
|
1277
1412
|
}
|
|
1278
1413
|
toRulesyncCommand() {
|
|
@@ -1325,13 +1460,13 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1325
1460
|
global = false
|
|
1326
1461
|
}) {
|
|
1327
1462
|
const paths = this.getSettablePaths({ global });
|
|
1328
|
-
const filePath =
|
|
1463
|
+
const filePath = join10(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1329
1464
|
const fileContent = await readFileContent(filePath);
|
|
1330
1465
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1331
1466
|
return new _CursorCommand({
|
|
1332
1467
|
baseDir,
|
|
1333
1468
|
relativeDirPath: paths.relativeDirPath,
|
|
1334
|
-
relativeFilePath:
|
|
1469
|
+
relativeFilePath: basename9(relativeFilePath),
|
|
1335
1470
|
fileContent: content.trim(),
|
|
1336
1471
|
validate
|
|
1337
1472
|
});
|
|
@@ -1339,12 +1474,12 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1339
1474
|
};
|
|
1340
1475
|
|
|
1341
1476
|
// src/features/commands/geminicli-command.ts
|
|
1342
|
-
import { basename as
|
|
1477
|
+
import { basename as basename10, join as join11 } from "path";
|
|
1343
1478
|
import { parse as parseToml } from "smol-toml";
|
|
1344
|
-
import { z as
|
|
1345
|
-
var GeminiCliCommandFrontmatterSchema =
|
|
1346
|
-
description:
|
|
1347
|
-
prompt:
|
|
1479
|
+
import { z as z9 } from "zod/mini";
|
|
1480
|
+
var GeminiCliCommandFrontmatterSchema = z9.looseObject({
|
|
1481
|
+
description: z9.optional(z9.string()),
|
|
1482
|
+
prompt: z9.string()
|
|
1348
1483
|
});
|
|
1349
1484
|
var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
1350
1485
|
frontmatter;
|
|
@@ -1357,7 +1492,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
1357
1492
|
}
|
|
1358
1493
|
static getSettablePaths(_options = {}) {
|
|
1359
1494
|
return {
|
|
1360
|
-
relativeDirPath:
|
|
1495
|
+
relativeDirPath: join11(".gemini", "commands")
|
|
1361
1496
|
};
|
|
1362
1497
|
}
|
|
1363
1498
|
parseTomlContent(content) {
|
|
@@ -1370,8 +1505,8 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
1370
1505
|
);
|
|
1371
1506
|
}
|
|
1372
1507
|
return {
|
|
1373
|
-
|
|
1374
|
-
|
|
1508
|
+
...result.data,
|
|
1509
|
+
description: result.data.description || ""
|
|
1375
1510
|
};
|
|
1376
1511
|
} catch (error) {
|
|
1377
1512
|
throw new Error(`Failed to parse TOML command file: ${error}`, { cause: error });
|
|
@@ -1387,9 +1522,12 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
1387
1522
|
};
|
|
1388
1523
|
}
|
|
1389
1524
|
toRulesyncCommand() {
|
|
1525
|
+
const { description, prompt: _prompt, ...restFields } = this.frontmatter;
|
|
1390
1526
|
const rulesyncFrontmatter = {
|
|
1391
1527
|
targets: ["geminicli"],
|
|
1392
|
-
description:
|
|
1528
|
+
description: description ?? "",
|
|
1529
|
+
// Preserve extra fields in geminicli section (excluding prompt which is the body)
|
|
1530
|
+
...Object.keys(restFields).length > 0 && { geminicli: restFields }
|
|
1393
1531
|
};
|
|
1394
1532
|
const fileContent = stringifyFrontmatter(this.body, rulesyncFrontmatter);
|
|
1395
1533
|
return new RulesyncCommand({
|
|
@@ -1410,9 +1548,11 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
1410
1548
|
global = false
|
|
1411
1549
|
}) {
|
|
1412
1550
|
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
1551
|
+
const geminicliFields = rulesyncFrontmatter.geminicli ?? {};
|
|
1413
1552
|
const geminiFrontmatter = {
|
|
1414
1553
|
description: rulesyncFrontmatter.description,
|
|
1415
|
-
prompt: rulesyncCommand.getBody()
|
|
1554
|
+
prompt: rulesyncCommand.getBody(),
|
|
1555
|
+
...geminicliFields
|
|
1416
1556
|
};
|
|
1417
1557
|
const tomlContent = `description = "${geminiFrontmatter.description}"
|
|
1418
1558
|
prompt = """
|
|
@@ -1434,12 +1574,12 @@ ${geminiFrontmatter.prompt}
|
|
|
1434
1574
|
global = false
|
|
1435
1575
|
}) {
|
|
1436
1576
|
const paths = this.getSettablePaths({ global });
|
|
1437
|
-
const filePath =
|
|
1577
|
+
const filePath = join11(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1438
1578
|
const fileContent = await readFileContent(filePath);
|
|
1439
1579
|
return new _GeminiCliCommand({
|
|
1440
1580
|
baseDir,
|
|
1441
1581
|
relativeDirPath: paths.relativeDirPath,
|
|
1442
|
-
relativeFilePath:
|
|
1582
|
+
relativeFilePath: basename10(relativeFilePath),
|
|
1443
1583
|
fileContent,
|
|
1444
1584
|
validate
|
|
1445
1585
|
});
|
|
@@ -1461,18 +1601,18 @@ ${geminiFrontmatter.prompt}
|
|
|
1461
1601
|
};
|
|
1462
1602
|
|
|
1463
1603
|
// 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(
|
|
1604
|
+
import { basename as basename11, join as join12 } from "path";
|
|
1605
|
+
import { optional as optional2, z as z10 } from "zod/mini";
|
|
1606
|
+
var RooCommandFrontmatterSchema = z10.looseObject({
|
|
1607
|
+
description: z10.string(),
|
|
1608
|
+
"argument-hint": optional2(z10.string())
|
|
1469
1609
|
});
|
|
1470
1610
|
var RooCommand = class _RooCommand extends ToolCommand {
|
|
1471
1611
|
frontmatter;
|
|
1472
1612
|
body;
|
|
1473
1613
|
static getSettablePaths() {
|
|
1474
1614
|
return {
|
|
1475
|
-
relativeDirPath:
|
|
1615
|
+
relativeDirPath: join12(".roo", "commands")
|
|
1476
1616
|
};
|
|
1477
1617
|
}
|
|
1478
1618
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -1480,7 +1620,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1480
1620
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1481
1621
|
if (!result.success) {
|
|
1482
1622
|
throw new Error(
|
|
1483
|
-
`Invalid frontmatter in ${
|
|
1623
|
+
`Invalid frontmatter in ${join12(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1484
1624
|
);
|
|
1485
1625
|
}
|
|
1486
1626
|
}
|
|
@@ -1498,9 +1638,12 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1498
1638
|
return this.frontmatter;
|
|
1499
1639
|
}
|
|
1500
1640
|
toRulesyncCommand() {
|
|
1641
|
+
const { description, ...restFields } = this.frontmatter;
|
|
1501
1642
|
const rulesyncFrontmatter = {
|
|
1502
1643
|
targets: ["roo"],
|
|
1503
|
-
description
|
|
1644
|
+
description,
|
|
1645
|
+
// Preserve extra fields in roo section
|
|
1646
|
+
...Object.keys(restFields).length > 0 && { roo: restFields }
|
|
1504
1647
|
};
|
|
1505
1648
|
const fileContent = stringifyFrontmatter(this.body, rulesyncFrontmatter);
|
|
1506
1649
|
return new RulesyncCommand({
|
|
@@ -1520,8 +1663,10 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1520
1663
|
validate = true
|
|
1521
1664
|
}) {
|
|
1522
1665
|
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
1666
|
+
const rooFields = rulesyncFrontmatter.roo ?? {};
|
|
1523
1667
|
const rooFrontmatter = {
|
|
1524
|
-
description: rulesyncFrontmatter.description
|
|
1668
|
+
description: rulesyncFrontmatter.description,
|
|
1669
|
+
...rooFields
|
|
1525
1670
|
};
|
|
1526
1671
|
const body = rulesyncCommand.getBody();
|
|
1527
1672
|
const fileContent = stringifyFrontmatter(body, rooFrontmatter);
|
|
@@ -1546,7 +1691,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1546
1691
|
return {
|
|
1547
1692
|
success: false,
|
|
1548
1693
|
error: new Error(
|
|
1549
|
-
`Invalid frontmatter in ${
|
|
1694
|
+
`Invalid frontmatter in ${join12(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1550
1695
|
)
|
|
1551
1696
|
};
|
|
1552
1697
|
}
|
|
@@ -1562,7 +1707,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1562
1707
|
relativeFilePath,
|
|
1563
1708
|
validate = true
|
|
1564
1709
|
}) {
|
|
1565
|
-
const filePath =
|
|
1710
|
+
const filePath = join12(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
1566
1711
|
const fileContent = await readFileContent(filePath);
|
|
1567
1712
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1568
1713
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1572,7 +1717,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1572
1717
|
return new _RooCommand({
|
|
1573
1718
|
baseDir,
|
|
1574
1719
|
relativeDirPath: _RooCommand.getSettablePaths().relativeDirPath,
|
|
1575
|
-
relativeFilePath:
|
|
1720
|
+
relativeFilePath: basename11(relativeFilePath),
|
|
1576
1721
|
frontmatter: result.data,
|
|
1577
1722
|
body: content.trim(),
|
|
1578
1723
|
fileContent,
|
|
@@ -1584,13 +1729,14 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1584
1729
|
// src/features/commands/commands-processor.ts
|
|
1585
1730
|
var commandsProcessorToolTargets = [
|
|
1586
1731
|
"agentsmd",
|
|
1732
|
+
"antigravity",
|
|
1587
1733
|
"claudecode",
|
|
1588
1734
|
"geminicli",
|
|
1589
1735
|
"roo",
|
|
1590
1736
|
"copilot",
|
|
1591
1737
|
"cursor"
|
|
1592
1738
|
];
|
|
1593
|
-
var CommandsProcessorToolTargetSchema =
|
|
1739
|
+
var CommandsProcessorToolTargetSchema = z11.enum(
|
|
1594
1740
|
// 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
1741
|
commandsProcessorToolTargets.concat("codexcli")
|
|
1596
1742
|
);
|
|
@@ -1633,6 +1779,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1633
1779
|
baseDir: this.baseDir,
|
|
1634
1780
|
rulesyncCommand
|
|
1635
1781
|
});
|
|
1782
|
+
case "antigravity":
|
|
1783
|
+
if (!AntigravityCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
|
|
1784
|
+
return null;
|
|
1785
|
+
}
|
|
1786
|
+
return AntigravityCommand.fromRulesyncCommand({
|
|
1787
|
+
baseDir: this.baseDir,
|
|
1788
|
+
rulesyncCommand
|
|
1789
|
+
});
|
|
1636
1790
|
case "claudecode":
|
|
1637
1791
|
if (!ClaudecodeCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
|
|
1638
1792
|
return null;
|
|
@@ -1708,11 +1862,11 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1708
1862
|
*/
|
|
1709
1863
|
async loadRulesyncFiles() {
|
|
1710
1864
|
const rulesyncCommandPaths = await findFilesByGlobs(
|
|
1711
|
-
|
|
1865
|
+
join13(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
|
|
1712
1866
|
);
|
|
1713
1867
|
const rulesyncCommands = await Promise.all(
|
|
1714
1868
|
rulesyncCommandPaths.map(
|
|
1715
|
-
(path3) => RulesyncCommand.fromFile({ relativeFilePath:
|
|
1869
|
+
(path3) => RulesyncCommand.fromFile({ relativeFilePath: basename12(path3) })
|
|
1716
1870
|
)
|
|
1717
1871
|
);
|
|
1718
1872
|
logger.info(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
@@ -1728,6 +1882,8 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1728
1882
|
switch (this.toolTarget) {
|
|
1729
1883
|
case "agentsmd":
|
|
1730
1884
|
return await this.loadAgentsmdCommands();
|
|
1885
|
+
case "antigravity":
|
|
1886
|
+
return await this.loadAntigravityCommands();
|
|
1731
1887
|
case "claudecode":
|
|
1732
1888
|
return await this.loadClaudecodeCommands();
|
|
1733
1889
|
case "geminicli":
|
|
@@ -1750,7 +1906,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1750
1906
|
extension
|
|
1751
1907
|
}) {
|
|
1752
1908
|
const commandFilePaths = await findFilesByGlobs(
|
|
1753
|
-
|
|
1909
|
+
join13(this.baseDir, relativeDirPath, `*.${extension}`)
|
|
1754
1910
|
);
|
|
1755
1911
|
const toolCommands = await Promise.all(
|
|
1756
1912
|
commandFilePaths.map((path3) => {
|
|
@@ -1758,40 +1914,45 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1758
1914
|
case "agentsmd":
|
|
1759
1915
|
return AgentsmdCommand.fromFile({
|
|
1760
1916
|
baseDir: this.baseDir,
|
|
1761
|
-
relativeFilePath:
|
|
1917
|
+
relativeFilePath: basename12(path3)
|
|
1918
|
+
});
|
|
1919
|
+
case "antigravity":
|
|
1920
|
+
return AntigravityCommand.fromFile({
|
|
1921
|
+
baseDir: this.baseDir,
|
|
1922
|
+
relativeFilePath: basename12(path3)
|
|
1762
1923
|
});
|
|
1763
1924
|
case "claudecode":
|
|
1764
1925
|
return ClaudecodeCommand.fromFile({
|
|
1765
1926
|
baseDir: this.baseDir,
|
|
1766
|
-
relativeFilePath:
|
|
1927
|
+
relativeFilePath: basename12(path3),
|
|
1767
1928
|
global: this.global
|
|
1768
1929
|
});
|
|
1769
1930
|
case "geminicli":
|
|
1770
1931
|
return GeminiCliCommand.fromFile({
|
|
1771
1932
|
baseDir: this.baseDir,
|
|
1772
|
-
relativeFilePath:
|
|
1933
|
+
relativeFilePath: basename12(path3),
|
|
1773
1934
|
global: this.global
|
|
1774
1935
|
});
|
|
1775
1936
|
case "roo":
|
|
1776
1937
|
return RooCommand.fromFile({
|
|
1777
1938
|
baseDir: this.baseDir,
|
|
1778
|
-
relativeFilePath:
|
|
1939
|
+
relativeFilePath: basename12(path3)
|
|
1779
1940
|
});
|
|
1780
1941
|
case "copilot":
|
|
1781
1942
|
return CopilotCommand.fromFile({
|
|
1782
1943
|
baseDir: this.baseDir,
|
|
1783
|
-
relativeFilePath:
|
|
1944
|
+
relativeFilePath: basename12(path3)
|
|
1784
1945
|
});
|
|
1785
1946
|
case "cursor":
|
|
1786
1947
|
return CursorCommand.fromFile({
|
|
1787
1948
|
baseDir: this.baseDir,
|
|
1788
|
-
relativeFilePath:
|
|
1949
|
+
relativeFilePath: basename12(path3),
|
|
1789
1950
|
global: this.global
|
|
1790
1951
|
});
|
|
1791
1952
|
case "codexcli":
|
|
1792
1953
|
return CodexcliCommand.fromFile({
|
|
1793
1954
|
baseDir: this.baseDir,
|
|
1794
|
-
relativeFilePath:
|
|
1955
|
+
relativeFilePath: basename12(path3),
|
|
1795
1956
|
global: this.global
|
|
1796
1957
|
});
|
|
1797
1958
|
default:
|
|
@@ -1812,6 +1973,16 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1812
1973
|
extension: "md"
|
|
1813
1974
|
});
|
|
1814
1975
|
}
|
|
1976
|
+
/**
|
|
1977
|
+
* Load Antigravity workflow configurations from .agent/workflows/ directory
|
|
1978
|
+
*/
|
|
1979
|
+
async loadAntigravityCommands() {
|
|
1980
|
+
return await this.loadToolCommandDefault({
|
|
1981
|
+
toolTarget: "antigravity",
|
|
1982
|
+
relativeDirPath: AntigravityCommand.getSettablePaths().relativeDirPath,
|
|
1983
|
+
extension: "md"
|
|
1984
|
+
});
|
|
1985
|
+
}
|
|
1815
1986
|
/**
|
|
1816
1987
|
* Load Copilot command configurations from .github/prompts/ directory
|
|
1817
1988
|
*/
|
|
@@ -1900,17 +2071,17 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1900
2071
|
};
|
|
1901
2072
|
|
|
1902
2073
|
// src/features/ignore/ignore-processor.ts
|
|
1903
|
-
import { z as
|
|
2074
|
+
import { z as z12 } from "zod/mini";
|
|
1904
2075
|
|
|
1905
2076
|
// src/features/ignore/amazonqcli-ignore.ts
|
|
1906
|
-
import { join as
|
|
2077
|
+
import { join as join15 } from "path";
|
|
1907
2078
|
|
|
1908
2079
|
// src/types/tool-file.ts
|
|
1909
2080
|
var ToolFile = class extends AiFile {
|
|
1910
2081
|
};
|
|
1911
2082
|
|
|
1912
2083
|
// src/features/ignore/rulesync-ignore.ts
|
|
1913
|
-
import { join as
|
|
2084
|
+
import { join as join14 } from "path";
|
|
1914
2085
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
1915
2086
|
validate() {
|
|
1916
2087
|
return { success: true, error: null };
|
|
@@ -1930,12 +2101,12 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
1930
2101
|
static async fromFile() {
|
|
1931
2102
|
const baseDir = process.cwd();
|
|
1932
2103
|
const paths = this.getSettablePaths();
|
|
1933
|
-
const recommendedPath =
|
|
2104
|
+
const recommendedPath = join14(
|
|
1934
2105
|
baseDir,
|
|
1935
2106
|
paths.recommended.relativeDirPath,
|
|
1936
2107
|
paths.recommended.relativeFilePath
|
|
1937
2108
|
);
|
|
1938
|
-
const legacyPath =
|
|
2109
|
+
const legacyPath = join14(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
1939
2110
|
if (await fileExists(recommendedPath)) {
|
|
1940
2111
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
1941
2112
|
return new _RulesyncIgnore({
|
|
@@ -2044,7 +2215,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
2044
2215
|
validate = true
|
|
2045
2216
|
}) {
|
|
2046
2217
|
const fileContent = await readFileContent(
|
|
2047
|
-
|
|
2218
|
+
join15(
|
|
2048
2219
|
baseDir,
|
|
2049
2220
|
this.getSettablePaths().relativeDirPath,
|
|
2050
2221
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2061,7 +2232,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
2061
2232
|
};
|
|
2062
2233
|
|
|
2063
2234
|
// src/features/ignore/augmentcode-ignore.ts
|
|
2064
|
-
import { join as
|
|
2235
|
+
import { join as join16 } from "path";
|
|
2065
2236
|
var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
2066
2237
|
static getSettablePaths() {
|
|
2067
2238
|
return {
|
|
@@ -2099,7 +2270,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2099
2270
|
validate = true
|
|
2100
2271
|
}) {
|
|
2101
2272
|
const fileContent = await readFileContent(
|
|
2102
|
-
|
|
2273
|
+
join16(
|
|
2103
2274
|
baseDir,
|
|
2104
2275
|
this.getSettablePaths().relativeDirPath,
|
|
2105
2276
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2116,7 +2287,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2116
2287
|
};
|
|
2117
2288
|
|
|
2118
2289
|
// src/features/ignore/claudecode-ignore.ts
|
|
2119
|
-
import { join as
|
|
2290
|
+
import { join as join17 } from "path";
|
|
2120
2291
|
import { uniq } from "es-toolkit";
|
|
2121
2292
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
2122
2293
|
constructor(params) {
|
|
@@ -2152,7 +2323,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2152
2323
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
2153
2324
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
2154
2325
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
2155
|
-
const filePath =
|
|
2326
|
+
const filePath = join17(
|
|
2156
2327
|
baseDir,
|
|
2157
2328
|
this.getSettablePaths().relativeDirPath,
|
|
2158
2329
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2180,7 +2351,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2180
2351
|
validate = true
|
|
2181
2352
|
}) {
|
|
2182
2353
|
const fileContent = await readFileContent(
|
|
2183
|
-
|
|
2354
|
+
join17(
|
|
2184
2355
|
baseDir,
|
|
2185
2356
|
this.getSettablePaths().relativeDirPath,
|
|
2186
2357
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2197,7 +2368,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2197
2368
|
};
|
|
2198
2369
|
|
|
2199
2370
|
// src/features/ignore/cline-ignore.ts
|
|
2200
|
-
import { join as
|
|
2371
|
+
import { join as join18 } from "path";
|
|
2201
2372
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
2202
2373
|
static getSettablePaths() {
|
|
2203
2374
|
return {
|
|
@@ -2234,7 +2405,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2234
2405
|
validate = true
|
|
2235
2406
|
}) {
|
|
2236
2407
|
const fileContent = await readFileContent(
|
|
2237
|
-
|
|
2408
|
+
join18(
|
|
2238
2409
|
baseDir,
|
|
2239
2410
|
this.getSettablePaths().relativeDirPath,
|
|
2240
2411
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2251,7 +2422,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2251
2422
|
};
|
|
2252
2423
|
|
|
2253
2424
|
// src/features/ignore/cursor-ignore.ts
|
|
2254
|
-
import { join as
|
|
2425
|
+
import { join as join19 } from "path";
|
|
2255
2426
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
2256
2427
|
static getSettablePaths() {
|
|
2257
2428
|
return {
|
|
@@ -2284,7 +2455,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2284
2455
|
validate = true
|
|
2285
2456
|
}) {
|
|
2286
2457
|
const fileContent = await readFileContent(
|
|
2287
|
-
|
|
2458
|
+
join19(
|
|
2288
2459
|
baseDir,
|
|
2289
2460
|
this.getSettablePaths().relativeDirPath,
|
|
2290
2461
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2301,7 +2472,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2301
2472
|
};
|
|
2302
2473
|
|
|
2303
2474
|
// src/features/ignore/geminicli-ignore.ts
|
|
2304
|
-
import { join as
|
|
2475
|
+
import { join as join20 } from "path";
|
|
2305
2476
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
2306
2477
|
static getSettablePaths() {
|
|
2307
2478
|
return {
|
|
@@ -2328,7 +2499,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2328
2499
|
validate = true
|
|
2329
2500
|
}) {
|
|
2330
2501
|
const fileContent = await readFileContent(
|
|
2331
|
-
|
|
2502
|
+
join20(
|
|
2332
2503
|
baseDir,
|
|
2333
2504
|
this.getSettablePaths().relativeDirPath,
|
|
2334
2505
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2345,7 +2516,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2345
2516
|
};
|
|
2346
2517
|
|
|
2347
2518
|
// src/features/ignore/junie-ignore.ts
|
|
2348
|
-
import { join as
|
|
2519
|
+
import { join as join21 } from "path";
|
|
2349
2520
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
2350
2521
|
static getSettablePaths() {
|
|
2351
2522
|
return {
|
|
@@ -2372,7 +2543,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2372
2543
|
validate = true
|
|
2373
2544
|
}) {
|
|
2374
2545
|
const fileContent = await readFileContent(
|
|
2375
|
-
|
|
2546
|
+
join21(
|
|
2376
2547
|
baseDir,
|
|
2377
2548
|
this.getSettablePaths().relativeDirPath,
|
|
2378
2549
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2389,7 +2560,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2389
2560
|
};
|
|
2390
2561
|
|
|
2391
2562
|
// src/features/ignore/kiro-ignore.ts
|
|
2392
|
-
import { join as
|
|
2563
|
+
import { join as join22 } from "path";
|
|
2393
2564
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
2394
2565
|
static getSettablePaths() {
|
|
2395
2566
|
return {
|
|
@@ -2416,7 +2587,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
2416
2587
|
validate = true
|
|
2417
2588
|
}) {
|
|
2418
2589
|
const fileContent = await readFileContent(
|
|
2419
|
-
|
|
2590
|
+
join22(
|
|
2420
2591
|
baseDir,
|
|
2421
2592
|
this.getSettablePaths().relativeDirPath,
|
|
2422
2593
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2433,7 +2604,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
2433
2604
|
};
|
|
2434
2605
|
|
|
2435
2606
|
// src/features/ignore/qwencode-ignore.ts
|
|
2436
|
-
import { join as
|
|
2607
|
+
import { join as join23 } from "path";
|
|
2437
2608
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
2438
2609
|
static getSettablePaths() {
|
|
2439
2610
|
return {
|
|
@@ -2460,7 +2631,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
2460
2631
|
validate = true
|
|
2461
2632
|
}) {
|
|
2462
2633
|
const fileContent = await readFileContent(
|
|
2463
|
-
|
|
2634
|
+
join23(
|
|
2464
2635
|
baseDir,
|
|
2465
2636
|
this.getSettablePaths().relativeDirPath,
|
|
2466
2637
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2477,7 +2648,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
2477
2648
|
};
|
|
2478
2649
|
|
|
2479
2650
|
// src/features/ignore/roo-ignore.ts
|
|
2480
|
-
import { join as
|
|
2651
|
+
import { join as join24 } from "path";
|
|
2481
2652
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
2482
2653
|
static getSettablePaths() {
|
|
2483
2654
|
return {
|
|
@@ -2504,7 +2675,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
2504
2675
|
validate = true
|
|
2505
2676
|
}) {
|
|
2506
2677
|
const fileContent = await readFileContent(
|
|
2507
|
-
|
|
2678
|
+
join24(
|
|
2508
2679
|
baseDir,
|
|
2509
2680
|
this.getSettablePaths().relativeDirPath,
|
|
2510
2681
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2521,7 +2692,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
2521
2692
|
};
|
|
2522
2693
|
|
|
2523
2694
|
// src/features/ignore/windsurf-ignore.ts
|
|
2524
|
-
import { join as
|
|
2695
|
+
import { join as join25 } from "path";
|
|
2525
2696
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
2526
2697
|
static getSettablePaths() {
|
|
2527
2698
|
return {
|
|
@@ -2548,7 +2719,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
2548
2719
|
validate = true
|
|
2549
2720
|
}) {
|
|
2550
2721
|
const fileContent = await readFileContent(
|
|
2551
|
-
|
|
2722
|
+
join25(
|
|
2552
2723
|
baseDir,
|
|
2553
2724
|
this.getSettablePaths().relativeDirPath,
|
|
2554
2725
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2578,7 +2749,7 @@ var ignoreProcessorToolTargets = [
|
|
|
2578
2749
|
"roo",
|
|
2579
2750
|
"windsurf"
|
|
2580
2751
|
];
|
|
2581
|
-
var IgnoreProcessorToolTargetSchema =
|
|
2752
|
+
var IgnoreProcessorToolTargetSchema = z12.enum(ignoreProcessorToolTargets);
|
|
2582
2753
|
var IgnoreProcessor = class extends FeatureProcessor {
|
|
2583
2754
|
toolTarget;
|
|
2584
2755
|
constructor({
|
|
@@ -2761,54 +2932,54 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
2761
2932
|
};
|
|
2762
2933
|
|
|
2763
2934
|
// src/features/mcp/mcp-processor.ts
|
|
2764
|
-
import { z as
|
|
2935
|
+
import { z as z17 } from "zod/mini";
|
|
2765
2936
|
|
|
2766
2937
|
// src/features/mcp/amazonqcli-mcp.ts
|
|
2767
|
-
import { join as
|
|
2938
|
+
import { join as join27 } from "path";
|
|
2768
2939
|
|
|
2769
2940
|
// src/features/mcp/rulesync-mcp.ts
|
|
2770
|
-
import { join as
|
|
2941
|
+
import { join as join26 } from "path";
|
|
2771
2942
|
import { omit } from "es-toolkit/object";
|
|
2772
|
-
import { z as
|
|
2943
|
+
import { z as z14 } from "zod/mini";
|
|
2773
2944
|
|
|
2774
2945
|
// 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:
|
|
2946
|
+
import { z as z13 } from "zod/mini";
|
|
2947
|
+
var McpServerSchema = z13.object({
|
|
2948
|
+
type: z13.optional(z13.enum(["stdio", "sse", "http"])),
|
|
2949
|
+
command: z13.optional(z13.union([z13.string(), z13.array(z13.string())])),
|
|
2950
|
+
args: z13.optional(z13.array(z13.string())),
|
|
2951
|
+
url: z13.optional(z13.string()),
|
|
2952
|
+
httpUrl: z13.optional(z13.string()),
|
|
2953
|
+
env: z13.optional(z13.record(z13.string(), z13.string())),
|
|
2954
|
+
disabled: z13.optional(z13.boolean()),
|
|
2955
|
+
networkTimeout: z13.optional(z13.number()),
|
|
2956
|
+
timeout: z13.optional(z13.number()),
|
|
2957
|
+
trust: z13.optional(z13.boolean()),
|
|
2958
|
+
cwd: z13.optional(z13.string()),
|
|
2959
|
+
transport: z13.optional(z13.enum(["stdio", "sse", "http"])),
|
|
2960
|
+
alwaysAllow: z13.optional(z13.array(z13.string())),
|
|
2961
|
+
tools: z13.optional(z13.array(z13.string())),
|
|
2962
|
+
kiroAutoApprove: z13.optional(z13.array(z13.string())),
|
|
2963
|
+
kiroAutoBlock: z13.optional(z13.array(z13.string())),
|
|
2964
|
+
headers: z13.optional(z13.record(z13.string(), z13.string()))
|
|
2794
2965
|
});
|
|
2795
|
-
var McpServersSchema =
|
|
2966
|
+
var McpServersSchema = z13.record(z13.string(), McpServerSchema);
|
|
2796
2967
|
|
|
2797
2968
|
// src/features/mcp/rulesync-mcp.ts
|
|
2798
|
-
var RulesyncMcpServerSchema =
|
|
2799
|
-
|
|
2800
|
-
targets:
|
|
2801
|
-
description:
|
|
2802
|
-
exposed:
|
|
2969
|
+
var RulesyncMcpServerSchema = z14.union([
|
|
2970
|
+
z14.extend(McpServerSchema, {
|
|
2971
|
+
targets: z14.optional(RulesyncTargetsSchema),
|
|
2972
|
+
description: z14.optional(z14.string()),
|
|
2973
|
+
exposed: z14.optional(z14.literal(false))
|
|
2803
2974
|
}),
|
|
2804
|
-
|
|
2805
|
-
targets:
|
|
2806
|
-
description:
|
|
2807
|
-
exposed:
|
|
2975
|
+
z14.extend(McpServerSchema, {
|
|
2976
|
+
targets: z14.optional(RulesyncTargetsSchema),
|
|
2977
|
+
description: z14.undefined(),
|
|
2978
|
+
exposed: z14.literal(true)
|
|
2808
2979
|
})
|
|
2809
2980
|
]);
|
|
2810
|
-
var RulesyncMcpConfigSchema =
|
|
2811
|
-
mcpServers:
|
|
2981
|
+
var RulesyncMcpConfigSchema = z14.object({
|
|
2982
|
+
mcpServers: z14.record(z14.string(), RulesyncMcpServerSchema)
|
|
2812
2983
|
});
|
|
2813
2984
|
var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
2814
2985
|
json;
|
|
@@ -2849,12 +3020,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
2849
3020
|
}) {
|
|
2850
3021
|
const baseDir = process.cwd();
|
|
2851
3022
|
const paths = this.getSettablePaths();
|
|
2852
|
-
const recommendedPath =
|
|
3023
|
+
const recommendedPath = join26(
|
|
2853
3024
|
baseDir,
|
|
2854
3025
|
paths.recommended.relativeDirPath,
|
|
2855
3026
|
paths.recommended.relativeFilePath
|
|
2856
3027
|
);
|
|
2857
|
-
const legacyPath =
|
|
3028
|
+
const legacyPath = join26(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
2858
3029
|
if (await fileExists(recommendedPath)) {
|
|
2859
3030
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
2860
3031
|
return new _RulesyncMcp({
|
|
@@ -2974,7 +3145,7 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
2974
3145
|
validate = true
|
|
2975
3146
|
}) {
|
|
2976
3147
|
const fileContent = await readFileContent(
|
|
2977
|
-
|
|
3148
|
+
join27(
|
|
2978
3149
|
baseDir,
|
|
2979
3150
|
this.getSettablePaths().relativeDirPath,
|
|
2980
3151
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3010,17 +3181,17 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
3010
3181
|
};
|
|
3011
3182
|
|
|
3012
3183
|
// src/features/mcp/claudecode-mcp.ts
|
|
3013
|
-
import { join as
|
|
3184
|
+
import { join as join29 } from "path";
|
|
3014
3185
|
|
|
3015
3186
|
// src/features/mcp/modular-mcp.ts
|
|
3016
|
-
import { join as
|
|
3017
|
-
import { z as
|
|
3018
|
-
var ModularMcpServerSchema =
|
|
3019
|
-
description:
|
|
3187
|
+
import { join as join28 } from "path";
|
|
3188
|
+
import { z as z15 } from "zod/mini";
|
|
3189
|
+
var ModularMcpServerSchema = z15.extend(McpServerSchema, {
|
|
3190
|
+
description: z15.string()
|
|
3020
3191
|
// Required for modular-mcp
|
|
3021
3192
|
});
|
|
3022
|
-
var ModularMcpConfigSchema =
|
|
3023
|
-
mcpServers:
|
|
3193
|
+
var ModularMcpConfigSchema = z15.object({
|
|
3194
|
+
mcpServers: z15.record(z15.string(), ModularMcpServerSchema)
|
|
3024
3195
|
});
|
|
3025
3196
|
var ModularMcp = class _ModularMcp extends AiFile {
|
|
3026
3197
|
json;
|
|
@@ -3076,7 +3247,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3076
3247
|
args: [
|
|
3077
3248
|
"-y",
|
|
3078
3249
|
"@kimuson/modular-mcp",
|
|
3079
|
-
|
|
3250
|
+
join28(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3080
3251
|
],
|
|
3081
3252
|
env: {}
|
|
3082
3253
|
}
|
|
@@ -3141,7 +3312,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3141
3312
|
}) {
|
|
3142
3313
|
const paths = this.getSettablePaths({ global });
|
|
3143
3314
|
const fileContent = await readOrInitializeFileContent(
|
|
3144
|
-
|
|
3315
|
+
join29(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3145
3316
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3146
3317
|
);
|
|
3147
3318
|
const json = JSON.parse(fileContent);
|
|
@@ -3163,7 +3334,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3163
3334
|
}) {
|
|
3164
3335
|
const paths = this.getSettablePaths({ global });
|
|
3165
3336
|
const fileContent = await readOrInitializeFileContent(
|
|
3166
|
-
|
|
3337
|
+
join29(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3167
3338
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3168
3339
|
);
|
|
3169
3340
|
const json = JSON.parse(fileContent);
|
|
@@ -3198,7 +3369,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3198
3369
|
};
|
|
3199
3370
|
|
|
3200
3371
|
// src/features/mcp/cline-mcp.ts
|
|
3201
|
-
import { join as
|
|
3372
|
+
import { join as join30 } from "path";
|
|
3202
3373
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
3203
3374
|
json;
|
|
3204
3375
|
constructor(params) {
|
|
@@ -3219,7 +3390,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3219
3390
|
validate = true
|
|
3220
3391
|
}) {
|
|
3221
3392
|
const fileContent = await readFileContent(
|
|
3222
|
-
|
|
3393
|
+
join30(
|
|
3223
3394
|
baseDir,
|
|
3224
3395
|
this.getSettablePaths().relativeDirPath,
|
|
3225
3396
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3255,7 +3426,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3255
3426
|
};
|
|
3256
3427
|
|
|
3257
3428
|
// src/features/mcp/codexcli-mcp.ts
|
|
3258
|
-
import { join as
|
|
3429
|
+
import { join as join31 } from "path";
|
|
3259
3430
|
import * as smolToml from "smol-toml";
|
|
3260
3431
|
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
3261
3432
|
toml;
|
|
@@ -3291,7 +3462,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3291
3462
|
}) {
|
|
3292
3463
|
const paths = this.getSettablePaths({ global });
|
|
3293
3464
|
const fileContent = await readFileContent(
|
|
3294
|
-
|
|
3465
|
+
join31(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3295
3466
|
);
|
|
3296
3467
|
return new _CodexcliMcp({
|
|
3297
3468
|
baseDir,
|
|
@@ -3308,7 +3479,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3308
3479
|
global = false
|
|
3309
3480
|
}) {
|
|
3310
3481
|
const paths = this.getSettablePaths({ global });
|
|
3311
|
-
const configTomlFilePath =
|
|
3482
|
+
const configTomlFilePath = join31(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3312
3483
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
3313
3484
|
configTomlFilePath,
|
|
3314
3485
|
smolToml.stringify({})
|
|
@@ -3349,7 +3520,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3349
3520
|
};
|
|
3350
3521
|
|
|
3351
3522
|
// src/features/mcp/copilot-mcp.ts
|
|
3352
|
-
import { join as
|
|
3523
|
+
import { join as join32 } from "path";
|
|
3353
3524
|
var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
3354
3525
|
json;
|
|
3355
3526
|
constructor(params) {
|
|
@@ -3370,7 +3541,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3370
3541
|
validate = true
|
|
3371
3542
|
}) {
|
|
3372
3543
|
const fileContent = await readFileContent(
|
|
3373
|
-
|
|
3544
|
+
join32(
|
|
3374
3545
|
baseDir,
|
|
3375
3546
|
this.getSettablePaths().relativeDirPath,
|
|
3376
3547
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3406,7 +3577,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3406
3577
|
};
|
|
3407
3578
|
|
|
3408
3579
|
// src/features/mcp/cursor-mcp.ts
|
|
3409
|
-
import { join as
|
|
3580
|
+
import { join as join33 } from "path";
|
|
3410
3581
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
3411
3582
|
json;
|
|
3412
3583
|
constructor(params) {
|
|
@@ -3427,7 +3598,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
3427
3598
|
validate = true
|
|
3428
3599
|
}) {
|
|
3429
3600
|
const fileContent = await readFileContent(
|
|
3430
|
-
|
|
3601
|
+
join33(
|
|
3431
3602
|
baseDir,
|
|
3432
3603
|
this.getSettablePaths().relativeDirPath,
|
|
3433
3604
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3474,7 +3645,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
3474
3645
|
};
|
|
3475
3646
|
|
|
3476
3647
|
// src/features/mcp/geminicli-mcp.ts
|
|
3477
|
-
import { join as
|
|
3648
|
+
import { join as join34 } from "path";
|
|
3478
3649
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
3479
3650
|
json;
|
|
3480
3651
|
constructor(params) {
|
|
@@ -3503,7 +3674,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3503
3674
|
}) {
|
|
3504
3675
|
const paths = this.getSettablePaths({ global });
|
|
3505
3676
|
const fileContent = await readOrInitializeFileContent(
|
|
3506
|
-
|
|
3677
|
+
join34(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3507
3678
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3508
3679
|
);
|
|
3509
3680
|
const json = JSON.parse(fileContent);
|
|
@@ -3524,7 +3695,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3524
3695
|
}) {
|
|
3525
3696
|
const paths = this.getSettablePaths({ global });
|
|
3526
3697
|
const fileContent = await readOrInitializeFileContent(
|
|
3527
|
-
|
|
3698
|
+
join34(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3528
3699
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3529
3700
|
);
|
|
3530
3701
|
const json = JSON.parse(fileContent);
|
|
@@ -3548,7 +3719,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3548
3719
|
};
|
|
3549
3720
|
|
|
3550
3721
|
// src/features/mcp/junie-mcp.ts
|
|
3551
|
-
import { join as
|
|
3722
|
+
import { join as join35 } from "path";
|
|
3552
3723
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
3553
3724
|
json;
|
|
3554
3725
|
constructor(params) {
|
|
@@ -3560,7 +3731,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
3560
3731
|
}
|
|
3561
3732
|
static getSettablePaths() {
|
|
3562
3733
|
return {
|
|
3563
|
-
relativeDirPath:
|
|
3734
|
+
relativeDirPath: join35(".junie", "mcp"),
|
|
3564
3735
|
relativeFilePath: "mcp.json"
|
|
3565
3736
|
};
|
|
3566
3737
|
}
|
|
@@ -3569,7 +3740,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
3569
3740
|
validate = true
|
|
3570
3741
|
}) {
|
|
3571
3742
|
const fileContent = await readFileContent(
|
|
3572
|
-
|
|
3743
|
+
join35(
|
|
3573
3744
|
baseDir,
|
|
3574
3745
|
this.getSettablePaths().relativeDirPath,
|
|
3575
3746
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3605,28 +3776,28 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
3605
3776
|
};
|
|
3606
3777
|
|
|
3607
3778
|
// 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:
|
|
3779
|
+
import { join as join36 } from "path";
|
|
3780
|
+
import { z as z16 } from "zod/mini";
|
|
3781
|
+
var OpencodeMcpLocalServerSchema = z16.object({
|
|
3782
|
+
type: z16.literal("local"),
|
|
3783
|
+
command: z16.array(z16.string()),
|
|
3784
|
+
environment: z16.optional(z16.record(z16.string(), z16.string())),
|
|
3785
|
+
enabled: z16._default(z16.boolean(), true),
|
|
3786
|
+
cwd: z16.optional(z16.string())
|
|
3616
3787
|
});
|
|
3617
|
-
var OpencodeMcpRemoteServerSchema =
|
|
3618
|
-
type:
|
|
3619
|
-
url:
|
|
3620
|
-
headers:
|
|
3621
|
-
enabled:
|
|
3788
|
+
var OpencodeMcpRemoteServerSchema = z16.object({
|
|
3789
|
+
type: z16.literal("remote"),
|
|
3790
|
+
url: z16.string(),
|
|
3791
|
+
headers: z16.optional(z16.record(z16.string(), z16.string())),
|
|
3792
|
+
enabled: z16._default(z16.boolean(), true)
|
|
3622
3793
|
});
|
|
3623
|
-
var OpencodeMcpServerSchema =
|
|
3794
|
+
var OpencodeMcpServerSchema = z16.union([
|
|
3624
3795
|
OpencodeMcpLocalServerSchema,
|
|
3625
3796
|
OpencodeMcpRemoteServerSchema
|
|
3626
3797
|
]);
|
|
3627
|
-
var OpencodeConfigSchema =
|
|
3628
|
-
$schema:
|
|
3629
|
-
mcp:
|
|
3798
|
+
var OpencodeConfigSchema = z16.looseObject({
|
|
3799
|
+
$schema: z16.optional(z16.string()),
|
|
3800
|
+
mcp: z16.optional(z16.record(z16.string(), OpencodeMcpServerSchema))
|
|
3630
3801
|
});
|
|
3631
3802
|
function convertFromOpencodeFormat(opencodeMcp) {
|
|
3632
3803
|
return Object.fromEntries(
|
|
@@ -3723,7 +3894,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
3723
3894
|
}) {
|
|
3724
3895
|
const paths = this.getSettablePaths({ global });
|
|
3725
3896
|
const fileContent = await readOrInitializeFileContent(
|
|
3726
|
-
|
|
3897
|
+
join36(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3727
3898
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
3728
3899
|
);
|
|
3729
3900
|
const json = JSON.parse(fileContent);
|
|
@@ -3744,7 +3915,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
3744
3915
|
}) {
|
|
3745
3916
|
const paths = this.getSettablePaths({ global });
|
|
3746
3917
|
const fileContent = await readOrInitializeFileContent(
|
|
3747
|
-
|
|
3918
|
+
join36(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3748
3919
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
3749
3920
|
);
|
|
3750
3921
|
const json = JSON.parse(fileContent);
|
|
@@ -3775,7 +3946,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
3775
3946
|
};
|
|
3776
3947
|
|
|
3777
3948
|
// src/features/mcp/roo-mcp.ts
|
|
3778
|
-
import { join as
|
|
3949
|
+
import { join as join37 } from "path";
|
|
3779
3950
|
var RooMcp = class _RooMcp extends ToolMcp {
|
|
3780
3951
|
json;
|
|
3781
3952
|
constructor(params) {
|
|
@@ -3796,7 +3967,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
3796
3967
|
validate = true
|
|
3797
3968
|
}) {
|
|
3798
3969
|
const fileContent = await readFileContent(
|
|
3799
|
-
|
|
3970
|
+
join37(
|
|
3800
3971
|
baseDir,
|
|
3801
3972
|
this.getSettablePaths().relativeDirPath,
|
|
3802
3973
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3844,7 +4015,7 @@ var mcpProcessorToolTargets = [
|
|
|
3844
4015
|
"opencode",
|
|
3845
4016
|
"roo"
|
|
3846
4017
|
];
|
|
3847
|
-
var McpProcessorToolTargetSchema =
|
|
4018
|
+
var McpProcessorToolTargetSchema = z17.enum(
|
|
3848
4019
|
// 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
4020
|
mcpProcessorToolTargets.concat("codexcli")
|
|
3850
4021
|
);
|
|
@@ -4116,22 +4287,22 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4116
4287
|
};
|
|
4117
4288
|
|
|
4118
4289
|
// src/features/rules/rules-processor.ts
|
|
4119
|
-
import { basename as
|
|
4290
|
+
import { basename as basename20, join as join79 } from "path";
|
|
4120
4291
|
import { XMLBuilder } from "fast-xml-parser";
|
|
4121
|
-
import { z as
|
|
4292
|
+
import { z as z30 } from "zod/mini";
|
|
4122
4293
|
|
|
4123
4294
|
// src/features/skills/codexcli-skill.ts
|
|
4124
|
-
import { join as
|
|
4295
|
+
import { join as join40 } from "path";
|
|
4125
4296
|
|
|
4126
4297
|
// src/features/skills/simulated-skill.ts
|
|
4127
|
-
import { join as
|
|
4128
|
-
import { z as
|
|
4298
|
+
import { join as join39 } from "path";
|
|
4299
|
+
import { z as z18 } from "zod/mini";
|
|
4129
4300
|
|
|
4130
4301
|
// src/constants/general.ts
|
|
4131
4302
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
4132
4303
|
|
|
4133
4304
|
// src/types/ai-dir.ts
|
|
4134
|
-
import path2, { basename as
|
|
4305
|
+
import path2, { basename as basename13, join as join38, relative as relative3, resolve as resolve4 } from "path";
|
|
4135
4306
|
var AiDir = class {
|
|
4136
4307
|
/**
|
|
4137
4308
|
* @example "."
|
|
@@ -4225,10 +4396,10 @@ var AiDir = class {
|
|
|
4225
4396
|
* @returns Array of files with their relative paths and buffers
|
|
4226
4397
|
*/
|
|
4227
4398
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
4228
|
-
const dirPath =
|
|
4229
|
-
const glob =
|
|
4399
|
+
const dirPath = join38(baseDir, relativeDirPath, dirName);
|
|
4400
|
+
const glob = join38(dirPath, "**", "*");
|
|
4230
4401
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
4231
|
-
const filteredPaths = filePaths.filter((filePath) =>
|
|
4402
|
+
const filteredPaths = filePaths.filter((filePath) => basename13(filePath) !== excludeFileName);
|
|
4232
4403
|
const files = await Promise.all(
|
|
4233
4404
|
filteredPaths.map(async (filePath) => {
|
|
4234
4405
|
const fileBuffer = await readFileBuffer(filePath);
|
|
@@ -4299,9 +4470,9 @@ var ToolSkill = class extends AiDir {
|
|
|
4299
4470
|
};
|
|
4300
4471
|
|
|
4301
4472
|
// src/features/skills/simulated-skill.ts
|
|
4302
|
-
var SimulatedSkillFrontmatterSchema =
|
|
4303
|
-
name:
|
|
4304
|
-
description:
|
|
4473
|
+
var SimulatedSkillFrontmatterSchema = z18.object({
|
|
4474
|
+
name: z18.string(),
|
|
4475
|
+
description: z18.string()
|
|
4305
4476
|
});
|
|
4306
4477
|
var SimulatedSkill = class extends ToolSkill {
|
|
4307
4478
|
frontmatter;
|
|
@@ -4332,7 +4503,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
4332
4503
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
4333
4504
|
if (!result.success) {
|
|
4334
4505
|
throw new Error(
|
|
4335
|
-
`Invalid frontmatter in ${
|
|
4506
|
+
`Invalid frontmatter in ${join39(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
4336
4507
|
);
|
|
4337
4508
|
}
|
|
4338
4509
|
}
|
|
@@ -4397,8 +4568,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
4397
4568
|
}) {
|
|
4398
4569
|
const settablePaths = this.getSettablePaths();
|
|
4399
4570
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
4400
|
-
const skillDirPath =
|
|
4401
|
-
const skillFilePath =
|
|
4571
|
+
const skillDirPath = join39(baseDir, actualRelativeDirPath, dirName);
|
|
4572
|
+
const skillFilePath = join39(skillDirPath, SKILL_FILE_NAME);
|
|
4402
4573
|
if (!await fileExists(skillFilePath)) {
|
|
4403
4574
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
4404
4575
|
}
|
|
@@ -4450,7 +4621,7 @@ var CodexCliSkill = class _CodexCliSkill extends SimulatedSkill {
|
|
|
4450
4621
|
throw new Error("CodexCliSkill does not support global mode.");
|
|
4451
4622
|
}
|
|
4452
4623
|
return {
|
|
4453
|
-
relativeDirPath:
|
|
4624
|
+
relativeDirPath: join40(".codex", "skills")
|
|
4454
4625
|
};
|
|
4455
4626
|
}
|
|
4456
4627
|
static async fromDir(params) {
|
|
@@ -4473,14 +4644,14 @@ var CodexCliSkill = class _CodexCliSkill extends SimulatedSkill {
|
|
|
4473
4644
|
};
|
|
4474
4645
|
|
|
4475
4646
|
// src/features/skills/copilot-skill.ts
|
|
4476
|
-
import { join as
|
|
4647
|
+
import { join as join41 } from "path";
|
|
4477
4648
|
var CopilotSkill = class _CopilotSkill extends SimulatedSkill {
|
|
4478
4649
|
static getSettablePaths(options) {
|
|
4479
4650
|
if (options?.global) {
|
|
4480
4651
|
throw new Error("CopilotSkill does not support global mode.");
|
|
4481
4652
|
}
|
|
4482
4653
|
return {
|
|
4483
|
-
relativeDirPath:
|
|
4654
|
+
relativeDirPath: join41(".github", "skills")
|
|
4484
4655
|
};
|
|
4485
4656
|
}
|
|
4486
4657
|
static async fromDir(params) {
|
|
@@ -4503,14 +4674,14 @@ var CopilotSkill = class _CopilotSkill extends SimulatedSkill {
|
|
|
4503
4674
|
};
|
|
4504
4675
|
|
|
4505
4676
|
// src/features/skills/cursor-skill.ts
|
|
4506
|
-
import { join as
|
|
4677
|
+
import { join as join42 } from "path";
|
|
4507
4678
|
var CursorSkill = class _CursorSkill extends SimulatedSkill {
|
|
4508
4679
|
static getSettablePaths(options) {
|
|
4509
4680
|
if (options?.global) {
|
|
4510
4681
|
throw new Error("CursorSkill does not support global mode.");
|
|
4511
4682
|
}
|
|
4512
4683
|
return {
|
|
4513
|
-
relativeDirPath:
|
|
4684
|
+
relativeDirPath: join42(".cursor", "skills")
|
|
4514
4685
|
};
|
|
4515
4686
|
}
|
|
4516
4687
|
static async fromDir(params) {
|
|
@@ -4533,11 +4704,11 @@ var CursorSkill = class _CursorSkill extends SimulatedSkill {
|
|
|
4533
4704
|
};
|
|
4534
4705
|
|
|
4535
4706
|
// src/features/skills/skills-processor.ts
|
|
4536
|
-
import { basename as
|
|
4537
|
-
import { z as
|
|
4707
|
+
import { basename as basename14, join as join48 } from "path";
|
|
4708
|
+
import { z as z21 } from "zod/mini";
|
|
4538
4709
|
|
|
4539
4710
|
// src/types/dir-feature-processor.ts
|
|
4540
|
-
import { join as
|
|
4711
|
+
import { join as join43 } from "path";
|
|
4541
4712
|
var DirFeatureProcessor = class {
|
|
4542
4713
|
baseDir;
|
|
4543
4714
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -4559,14 +4730,14 @@ var DirFeatureProcessor = class {
|
|
|
4559
4730
|
await ensureDir(dirPath);
|
|
4560
4731
|
const mainFile = aiDir.getMainFile();
|
|
4561
4732
|
if (mainFile) {
|
|
4562
|
-
const mainFilePath =
|
|
4733
|
+
const mainFilePath = join43(dirPath, mainFile.name);
|
|
4563
4734
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
4564
4735
|
const contentWithNewline = addTrailingNewline(content);
|
|
4565
4736
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
4566
4737
|
}
|
|
4567
4738
|
const otherFiles = aiDir.getOtherFiles();
|
|
4568
4739
|
for (const file of otherFiles) {
|
|
4569
|
-
const filePath =
|
|
4740
|
+
const filePath = join43(dirPath, file.relativeFilePathToDirPath);
|
|
4570
4741
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
4571
4742
|
await writeFileContent(filePath, contentWithNewline);
|
|
4572
4743
|
}
|
|
@@ -4581,14 +4752,14 @@ var DirFeatureProcessor = class {
|
|
|
4581
4752
|
};
|
|
4582
4753
|
|
|
4583
4754
|
// src/features/skills/agentsmd-skill.ts
|
|
4584
|
-
import { join as
|
|
4755
|
+
import { join as join44 } from "path";
|
|
4585
4756
|
var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
4586
4757
|
static getSettablePaths(options) {
|
|
4587
4758
|
if (options?.global) {
|
|
4588
4759
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
4589
4760
|
}
|
|
4590
4761
|
return {
|
|
4591
|
-
relativeDirPath:
|
|
4762
|
+
relativeDirPath: join44(".agents", "skills")
|
|
4592
4763
|
};
|
|
4593
4764
|
}
|
|
4594
4765
|
static async fromDir(params) {
|
|
@@ -4611,19 +4782,19 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
4611
4782
|
};
|
|
4612
4783
|
|
|
4613
4784
|
// src/features/skills/claudecode-skill.ts
|
|
4614
|
-
import { join as
|
|
4615
|
-
import { z as
|
|
4785
|
+
import { join as join46 } from "path";
|
|
4786
|
+
import { z as z20 } from "zod/mini";
|
|
4616
4787
|
|
|
4617
4788
|
// src/features/skills/rulesync-skill.ts
|
|
4618
|
-
import { join as
|
|
4619
|
-
import { z as
|
|
4620
|
-
var RulesyncSkillFrontmatterSchemaInternal =
|
|
4621
|
-
name:
|
|
4622
|
-
description:
|
|
4623
|
-
targets:
|
|
4624
|
-
claudecode:
|
|
4625
|
-
|
|
4626
|
-
"allowed-tools":
|
|
4789
|
+
import { join as join45 } from "path";
|
|
4790
|
+
import { z as z19 } from "zod/mini";
|
|
4791
|
+
var RulesyncSkillFrontmatterSchemaInternal = z19.object({
|
|
4792
|
+
name: z19.string(),
|
|
4793
|
+
description: z19.string(),
|
|
4794
|
+
targets: z19._default(RulesyncTargetsSchema, ["*"]),
|
|
4795
|
+
claudecode: z19.optional(
|
|
4796
|
+
z19.object({
|
|
4797
|
+
"allowed-tools": z19.optional(z19.array(z19.string()))
|
|
4627
4798
|
})
|
|
4628
4799
|
)
|
|
4629
4800
|
});
|
|
@@ -4691,8 +4862,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
4691
4862
|
dirName,
|
|
4692
4863
|
global = false
|
|
4693
4864
|
}) {
|
|
4694
|
-
const skillDirPath =
|
|
4695
|
-
const skillFilePath =
|
|
4865
|
+
const skillDirPath = join45(baseDir, relativeDirPath, dirName);
|
|
4866
|
+
const skillFilePath = join45(skillDirPath, SKILL_FILE_NAME);
|
|
4696
4867
|
if (!await fileExists(skillFilePath)) {
|
|
4697
4868
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
4698
4869
|
}
|
|
@@ -4722,15 +4893,15 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
4722
4893
|
};
|
|
4723
4894
|
|
|
4724
4895
|
// src/features/skills/claudecode-skill.ts
|
|
4725
|
-
var ClaudecodeSkillFrontmatterSchema =
|
|
4726
|
-
name:
|
|
4727
|
-
description:
|
|
4728
|
-
"allowed-tools":
|
|
4896
|
+
var ClaudecodeSkillFrontmatterSchema = z20.object({
|
|
4897
|
+
name: z20.string(),
|
|
4898
|
+
description: z20.string(),
|
|
4899
|
+
"allowed-tools": z20.optional(z20.array(z20.string()))
|
|
4729
4900
|
});
|
|
4730
4901
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
4731
4902
|
constructor({
|
|
4732
4903
|
baseDir = process.cwd(),
|
|
4733
|
-
relativeDirPath =
|
|
4904
|
+
relativeDirPath = join46(".claude", "skills"),
|
|
4734
4905
|
dirName,
|
|
4735
4906
|
frontmatter,
|
|
4736
4907
|
body,
|
|
@@ -4761,7 +4932,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
4761
4932
|
global: _global = false
|
|
4762
4933
|
} = {}) {
|
|
4763
4934
|
return {
|
|
4764
|
-
relativeDirPath:
|
|
4935
|
+
relativeDirPath: join46(".claude", "skills")
|
|
4765
4936
|
};
|
|
4766
4937
|
}
|
|
4767
4938
|
getFrontmatter() {
|
|
@@ -4849,8 +5020,8 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
4849
5020
|
}) {
|
|
4850
5021
|
const settablePaths = this.getSettablePaths({ global });
|
|
4851
5022
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
4852
|
-
const skillDirPath =
|
|
4853
|
-
const skillFilePath =
|
|
5023
|
+
const skillDirPath = join46(baseDir, actualRelativeDirPath, dirName);
|
|
5024
|
+
const skillFilePath = join46(skillDirPath, SKILL_FILE_NAME);
|
|
4854
5025
|
if (!await fileExists(skillFilePath)) {
|
|
4855
5026
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
4856
5027
|
}
|
|
@@ -4880,14 +5051,14 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
4880
5051
|
};
|
|
4881
5052
|
|
|
4882
5053
|
// src/features/skills/geminicli-skill.ts
|
|
4883
|
-
import { join as
|
|
5054
|
+
import { join as join47 } from "path";
|
|
4884
5055
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
4885
5056
|
static getSettablePaths(options) {
|
|
4886
5057
|
if (options?.global) {
|
|
4887
5058
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
4888
5059
|
}
|
|
4889
5060
|
return {
|
|
4890
|
-
relativeDirPath:
|
|
5061
|
+
relativeDirPath: join47(".gemini", "skills")
|
|
4891
5062
|
};
|
|
4892
5063
|
}
|
|
4893
5064
|
static async fromDir(params) {
|
|
@@ -4926,7 +5097,7 @@ var skillsProcessorToolTargetsSimulated = [
|
|
|
4926
5097
|
"agentsmd"
|
|
4927
5098
|
];
|
|
4928
5099
|
var skillsProcessorToolTargetsGlobal = ["claudecode"];
|
|
4929
|
-
var SkillsProcessorToolTargetSchema =
|
|
5100
|
+
var SkillsProcessorToolTargetSchema = z21.enum(skillsProcessorToolTargets);
|
|
4930
5101
|
var SkillsProcessor = class extends DirFeatureProcessor {
|
|
4931
5102
|
toolTarget;
|
|
4932
5103
|
global;
|
|
@@ -5037,9 +5208,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5037
5208
|
*/
|
|
5038
5209
|
async loadRulesyncDirs() {
|
|
5039
5210
|
const paths = RulesyncSkill.getSettablePaths();
|
|
5040
|
-
const rulesyncSkillsDirPath =
|
|
5041
|
-
const dirPaths = await findFilesByGlobs(
|
|
5042
|
-
const dirNames = dirPaths.map((path3) =>
|
|
5211
|
+
const rulesyncSkillsDirPath = join48(this.baseDir, paths.relativeDirPath);
|
|
5212
|
+
const dirPaths = await findFilesByGlobs(join48(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
5213
|
+
const dirNames = dirPaths.map((path3) => basename14(path3));
|
|
5043
5214
|
const rulesyncSkills = await Promise.all(
|
|
5044
5215
|
dirNames.map(
|
|
5045
5216
|
(dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
|
|
@@ -5078,9 +5249,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5078
5249
|
*/
|
|
5079
5250
|
async loadClaudecodeSkills() {
|
|
5080
5251
|
const paths = ClaudecodeSkill.getSettablePaths({ global: this.global });
|
|
5081
|
-
const skillsDirPath =
|
|
5082
|
-
const dirPaths = await findFilesByGlobs(
|
|
5083
|
-
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));
|
|
5084
5255
|
const toolSkills = await Promise.all(
|
|
5085
5256
|
dirNames.map(
|
|
5086
5257
|
(dirName) => ClaudecodeSkill.fromDir({
|
|
@@ -5098,9 +5269,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5098
5269
|
*/
|
|
5099
5270
|
async loadSimulatedSkills(SkillClass) {
|
|
5100
5271
|
const paths = SkillClass.getSettablePaths();
|
|
5101
|
-
const skillsDirPath =
|
|
5102
|
-
const dirPaths = await findFilesByGlobs(
|
|
5103
|
-
const dirNames = dirPaths.map((path3) =>
|
|
5272
|
+
const skillsDirPath = join48(this.baseDir, paths.relativeDirPath);
|
|
5273
|
+
const dirPaths = await findFilesByGlobs(join48(skillsDirPath, "*"), { type: "dir" });
|
|
5274
|
+
const dirNames = dirPaths.map((path3) => basename14(path3));
|
|
5104
5275
|
const toolSkills = await Promise.all(
|
|
5105
5276
|
dirNames.map(
|
|
5106
5277
|
(dirName) => SkillClass.fromDir({
|
|
@@ -5145,11 +5316,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5145
5316
|
};
|
|
5146
5317
|
|
|
5147
5318
|
// src/features/subagents/agentsmd-subagent.ts
|
|
5148
|
-
import { join as
|
|
5319
|
+
import { join as join50 } from "path";
|
|
5149
5320
|
|
|
5150
5321
|
// src/features/subagents/simulated-subagent.ts
|
|
5151
|
-
import { basename as
|
|
5152
|
-
import { z as
|
|
5322
|
+
import { basename as basename15, join as join49 } from "path";
|
|
5323
|
+
import { z as z22 } from "zod/mini";
|
|
5153
5324
|
|
|
5154
5325
|
// src/features/subagents/tool-subagent.ts
|
|
5155
5326
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -5184,9 +5355,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
5184
5355
|
};
|
|
5185
5356
|
|
|
5186
5357
|
// src/features/subagents/simulated-subagent.ts
|
|
5187
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
5188
|
-
name:
|
|
5189
|
-
description:
|
|
5358
|
+
var SimulatedSubagentFrontmatterSchema = z22.object({
|
|
5359
|
+
name: z22.string(),
|
|
5360
|
+
description: z22.string()
|
|
5190
5361
|
});
|
|
5191
5362
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
5192
5363
|
frontmatter;
|
|
@@ -5196,7 +5367,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5196
5367
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5197
5368
|
if (!result.success) {
|
|
5198
5369
|
throw new Error(
|
|
5199
|
-
`Invalid frontmatter in ${
|
|
5370
|
+
`Invalid frontmatter in ${join49(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5200
5371
|
);
|
|
5201
5372
|
}
|
|
5202
5373
|
}
|
|
@@ -5247,7 +5418,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5247
5418
|
return {
|
|
5248
5419
|
success: false,
|
|
5249
5420
|
error: new Error(
|
|
5250
|
-
`Invalid frontmatter in ${
|
|
5421
|
+
`Invalid frontmatter in ${join49(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5251
5422
|
)
|
|
5252
5423
|
};
|
|
5253
5424
|
}
|
|
@@ -5257,7 +5428,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5257
5428
|
relativeFilePath,
|
|
5258
5429
|
validate = true
|
|
5259
5430
|
}) {
|
|
5260
|
-
const filePath =
|
|
5431
|
+
const filePath = join49(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
5261
5432
|
const fileContent = await readFileContent(filePath);
|
|
5262
5433
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5263
5434
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -5267,7 +5438,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5267
5438
|
return {
|
|
5268
5439
|
baseDir,
|
|
5269
5440
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
5270
|
-
relativeFilePath:
|
|
5441
|
+
relativeFilePath: basename15(relativeFilePath),
|
|
5271
5442
|
frontmatter: result.data,
|
|
5272
5443
|
body: content.trim(),
|
|
5273
5444
|
validate
|
|
@@ -5279,7 +5450,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5279
5450
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
5280
5451
|
static getSettablePaths() {
|
|
5281
5452
|
return {
|
|
5282
|
-
relativeDirPath:
|
|
5453
|
+
relativeDirPath: join50(".agents", "subagents")
|
|
5283
5454
|
};
|
|
5284
5455
|
}
|
|
5285
5456
|
static async fromFile(params) {
|
|
@@ -5299,11 +5470,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
5299
5470
|
};
|
|
5300
5471
|
|
|
5301
5472
|
// src/features/subagents/codexcli-subagent.ts
|
|
5302
|
-
import { join as
|
|
5473
|
+
import { join as join51 } from "path";
|
|
5303
5474
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
5304
5475
|
static getSettablePaths() {
|
|
5305
5476
|
return {
|
|
5306
|
-
relativeDirPath:
|
|
5477
|
+
relativeDirPath: join51(".codex", "subagents")
|
|
5307
5478
|
};
|
|
5308
5479
|
}
|
|
5309
5480
|
static async fromFile(params) {
|
|
@@ -5323,11 +5494,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
5323
5494
|
};
|
|
5324
5495
|
|
|
5325
5496
|
// src/features/subagents/copilot-subagent.ts
|
|
5326
|
-
import { join as
|
|
5497
|
+
import { join as join52 } from "path";
|
|
5327
5498
|
var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
5328
5499
|
static getSettablePaths() {
|
|
5329
5500
|
return {
|
|
5330
|
-
relativeDirPath:
|
|
5501
|
+
relativeDirPath: join52(".github", "subagents")
|
|
5331
5502
|
};
|
|
5332
5503
|
}
|
|
5333
5504
|
static async fromFile(params) {
|
|
@@ -5347,11 +5518,11 @@ var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
|
5347
5518
|
};
|
|
5348
5519
|
|
|
5349
5520
|
// src/features/subagents/cursor-subagent.ts
|
|
5350
|
-
import { join as
|
|
5521
|
+
import { join as join53 } from "path";
|
|
5351
5522
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
5352
5523
|
static getSettablePaths() {
|
|
5353
5524
|
return {
|
|
5354
|
-
relativeDirPath:
|
|
5525
|
+
relativeDirPath: join53(".cursor", "subagents")
|
|
5355
5526
|
};
|
|
5356
5527
|
}
|
|
5357
5528
|
static async fromFile(params) {
|
|
@@ -5371,11 +5542,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
5371
5542
|
};
|
|
5372
5543
|
|
|
5373
5544
|
// src/features/subagents/geminicli-subagent.ts
|
|
5374
|
-
import { join as
|
|
5545
|
+
import { join as join54 } from "path";
|
|
5375
5546
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
5376
5547
|
static getSettablePaths() {
|
|
5377
5548
|
return {
|
|
5378
|
-
relativeDirPath:
|
|
5549
|
+
relativeDirPath: join54(".gemini", "subagents")
|
|
5379
5550
|
};
|
|
5380
5551
|
}
|
|
5381
5552
|
static async fromFile(params) {
|
|
@@ -5395,11 +5566,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
5395
5566
|
};
|
|
5396
5567
|
|
|
5397
5568
|
// src/features/subagents/roo-subagent.ts
|
|
5398
|
-
import { join as
|
|
5569
|
+
import { join as join55 } from "path";
|
|
5399
5570
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
5400
5571
|
static getSettablePaths() {
|
|
5401
5572
|
return {
|
|
5402
|
-
relativeDirPath:
|
|
5573
|
+
relativeDirPath: join55(".roo", "subagents")
|
|
5403
5574
|
};
|
|
5404
5575
|
}
|
|
5405
5576
|
static async fromFile(params) {
|
|
@@ -5419,26 +5590,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
5419
5590
|
};
|
|
5420
5591
|
|
|
5421
5592
|
// src/features/subagents/subagents-processor.ts
|
|
5422
|
-
import { basename as
|
|
5423
|
-
import { z as
|
|
5593
|
+
import { basename as basename17, join as join58 } from "path";
|
|
5594
|
+
import { z as z25 } from "zod/mini";
|
|
5424
5595
|
|
|
5425
5596
|
// src/features/subagents/claudecode-subagent.ts
|
|
5426
|
-
import { join as
|
|
5427
|
-
import { z as
|
|
5597
|
+
import { join as join57 } from "path";
|
|
5598
|
+
import { z as z24 } from "zod/mini";
|
|
5428
5599
|
|
|
5429
5600
|
// src/features/subagents/rulesync-subagent.ts
|
|
5430
|
-
import { basename as
|
|
5431
|
-
import { z as
|
|
5432
|
-
var
|
|
5433
|
-
var RulesyncSubagentFrontmatterSchema = z22.object({
|
|
5601
|
+
import { basename as basename16, join as join56 } from "path";
|
|
5602
|
+
import { z as z23 } from "zod/mini";
|
|
5603
|
+
var RulesyncSubagentFrontmatterSchema = z23.looseObject({
|
|
5434
5604
|
targets: RulesyncTargetsSchema,
|
|
5435
|
-
name:
|
|
5436
|
-
description:
|
|
5437
|
-
claudecode: z22.optional(
|
|
5438
|
-
z22.object({
|
|
5439
|
-
model: RulesyncSubagentModelSchema
|
|
5440
|
-
})
|
|
5441
|
-
)
|
|
5605
|
+
name: z23.string(),
|
|
5606
|
+
description: z23.string()
|
|
5442
5607
|
});
|
|
5443
5608
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
5444
5609
|
frontmatter;
|
|
@@ -5448,7 +5613,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5448
5613
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5449
5614
|
if (!result.success) {
|
|
5450
5615
|
throw new Error(
|
|
5451
|
-
`Invalid frontmatter in ${
|
|
5616
|
+
`Invalid frontmatter in ${join56(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5452
5617
|
);
|
|
5453
5618
|
}
|
|
5454
5619
|
}
|
|
@@ -5481,7 +5646,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5481
5646
|
return {
|
|
5482
5647
|
success: false,
|
|
5483
5648
|
error: new Error(
|
|
5484
|
-
`Invalid frontmatter in ${
|
|
5649
|
+
`Invalid frontmatter in ${join56(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5485
5650
|
)
|
|
5486
5651
|
};
|
|
5487
5652
|
}
|
|
@@ -5490,14 +5655,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5490
5655
|
relativeFilePath
|
|
5491
5656
|
}) {
|
|
5492
5657
|
const fileContent = await readFileContent(
|
|
5493
|
-
|
|
5658
|
+
join56(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
5494
5659
|
);
|
|
5495
5660
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5496
5661
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5497
5662
|
if (!result.success) {
|
|
5498
5663
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
5499
5664
|
}
|
|
5500
|
-
const filename =
|
|
5665
|
+
const filename = basename16(relativeFilePath);
|
|
5501
5666
|
return new _RulesyncSubagent({
|
|
5502
5667
|
baseDir: process.cwd(),
|
|
5503
5668
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -5509,10 +5674,10 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5509
5674
|
};
|
|
5510
5675
|
|
|
5511
5676
|
// src/features/subagents/claudecode-subagent.ts
|
|
5512
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
5513
|
-
name:
|
|
5514
|
-
description:
|
|
5515
|
-
model:
|
|
5677
|
+
var ClaudecodeSubagentFrontmatterSchema = z24.looseObject({
|
|
5678
|
+
name: z24.string(),
|
|
5679
|
+
description: z24.string(),
|
|
5680
|
+
model: z24.optional(z24.enum(["opus", "sonnet", "haiku", "inherit"]))
|
|
5516
5681
|
});
|
|
5517
5682
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
5518
5683
|
frontmatter;
|
|
@@ -5522,7 +5687,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5522
5687
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5523
5688
|
if (!result.success) {
|
|
5524
5689
|
throw new Error(
|
|
5525
|
-
`Invalid frontmatter in ${
|
|
5690
|
+
`Invalid frontmatter in ${join57(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5526
5691
|
);
|
|
5527
5692
|
}
|
|
5528
5693
|
}
|
|
@@ -5534,7 +5699,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5534
5699
|
}
|
|
5535
5700
|
static getSettablePaths(_options = {}) {
|
|
5536
5701
|
return {
|
|
5537
|
-
relativeDirPath:
|
|
5702
|
+
relativeDirPath: join57(".claude", "agents")
|
|
5538
5703
|
};
|
|
5539
5704
|
}
|
|
5540
5705
|
getFrontmatter() {
|
|
@@ -5544,15 +5709,17 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5544
5709
|
return this.body;
|
|
5545
5710
|
}
|
|
5546
5711
|
toRulesyncSubagent() {
|
|
5712
|
+
const { name, description, model, ...restFields } = this.frontmatter;
|
|
5713
|
+
const claudecodeSection = {
|
|
5714
|
+
...model && { model },
|
|
5715
|
+
...restFields
|
|
5716
|
+
};
|
|
5547
5717
|
const rulesyncFrontmatter = {
|
|
5548
5718
|
targets: ["claudecode"],
|
|
5549
|
-
name
|
|
5550
|
-
description
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
model: this.frontmatter.model
|
|
5554
|
-
}
|
|
5555
|
-
}
|
|
5719
|
+
name,
|
|
5720
|
+
description,
|
|
5721
|
+
// Only include claudecode section if there are fields
|
|
5722
|
+
...Object.keys(claudecodeSection).length > 0 && { claudecode: claudecodeSection }
|
|
5556
5723
|
};
|
|
5557
5724
|
return new RulesyncSubagent({
|
|
5558
5725
|
baseDir: ".",
|
|
@@ -5571,11 +5738,17 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5571
5738
|
global = false
|
|
5572
5739
|
}) {
|
|
5573
5740
|
const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
|
|
5574
|
-
const
|
|
5741
|
+
const claudecodeSection = rulesyncFrontmatter.claudecode ?? {};
|
|
5742
|
+
const rawClaudecodeFrontmatter = {
|
|
5575
5743
|
name: rulesyncFrontmatter.name,
|
|
5576
5744
|
description: rulesyncFrontmatter.description,
|
|
5577
|
-
|
|
5745
|
+
...claudecodeSection
|
|
5578
5746
|
};
|
|
5747
|
+
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(rawClaudecodeFrontmatter);
|
|
5748
|
+
if (!result.success) {
|
|
5749
|
+
throw new Error(`Invalid claudecode subagent frontmatter: ${formatError(result.error)}`);
|
|
5750
|
+
}
|
|
5751
|
+
const claudecodeFrontmatter = result.data;
|
|
5579
5752
|
const body = rulesyncSubagent.getBody();
|
|
5580
5753
|
const fileContent = stringifyFrontmatter(body, claudecodeFrontmatter);
|
|
5581
5754
|
const paths = this.getSettablePaths({ global });
|
|
@@ -5600,7 +5773,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5600
5773
|
return {
|
|
5601
5774
|
success: false,
|
|
5602
5775
|
error: new Error(
|
|
5603
|
-
`Invalid frontmatter in ${
|
|
5776
|
+
`Invalid frontmatter in ${join57(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5604
5777
|
)
|
|
5605
5778
|
};
|
|
5606
5779
|
}
|
|
@@ -5618,7 +5791,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5618
5791
|
global = false
|
|
5619
5792
|
}) {
|
|
5620
5793
|
const paths = this.getSettablePaths({ global });
|
|
5621
|
-
const filePath =
|
|
5794
|
+
const filePath = join57(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
5622
5795
|
const fileContent = await readFileContent(filePath);
|
|
5623
5796
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5624
5797
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -5656,7 +5829,7 @@ var subagentsProcessorToolTargetsSimulated = [
|
|
|
5656
5829
|
"roo"
|
|
5657
5830
|
];
|
|
5658
5831
|
var subagentsProcessorToolTargetsGlobal = ["claudecode"];
|
|
5659
|
-
var SubagentsProcessorToolTargetSchema =
|
|
5832
|
+
var SubagentsProcessorToolTargetSchema = z25.enum(subagentsProcessorToolTargets);
|
|
5660
5833
|
var SubagentsProcessor = class extends FeatureProcessor {
|
|
5661
5834
|
toolTarget;
|
|
5662
5835
|
global;
|
|
@@ -5772,7 +5945,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
5772
5945
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
5773
5946
|
*/
|
|
5774
5947
|
async loadRulesyncFiles() {
|
|
5775
|
-
const subagentsDir =
|
|
5948
|
+
const subagentsDir = join58(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
5776
5949
|
const dirExists = await directoryExists(subagentsDir);
|
|
5777
5950
|
if (!dirExists) {
|
|
5778
5951
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -5787,7 +5960,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
5787
5960
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
5788
5961
|
const rulesyncSubagents = [];
|
|
5789
5962
|
for (const mdFile of mdFiles) {
|
|
5790
|
-
const filepath =
|
|
5963
|
+
const filepath = join58(subagentsDir, mdFile);
|
|
5791
5964
|
try {
|
|
5792
5965
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
5793
5966
|
relativeFilePath: mdFile,
|
|
@@ -5905,8 +6078,8 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
5905
6078
|
relativeDirPath,
|
|
5906
6079
|
fromFile
|
|
5907
6080
|
}) {
|
|
5908
|
-
const paths = await findFilesByGlobs(
|
|
5909
|
-
const subagents = await Promise.all(paths.map((path3) => fromFile(
|
|
6081
|
+
const paths = await findFilesByGlobs(join58(this.baseDir, relativeDirPath, "*.md"));
|
|
6082
|
+
const subagents = await Promise.all(paths.map((path3) => fromFile(basename17(path3))));
|
|
5910
6083
|
logger.info(`Successfully loaded ${subagents.length} ${relativeDirPath} subagents`);
|
|
5911
6084
|
return subagents;
|
|
5912
6085
|
}
|
|
@@ -5934,30 +6107,30 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
5934
6107
|
};
|
|
5935
6108
|
|
|
5936
6109
|
// src/features/rules/agentsmd-rule.ts
|
|
5937
|
-
import { join as
|
|
6110
|
+
import { join as join61 } from "path";
|
|
5938
6111
|
|
|
5939
6112
|
// src/features/rules/tool-rule.ts
|
|
5940
|
-
import { join as
|
|
6113
|
+
import { join as join60 } from "path";
|
|
5941
6114
|
|
|
5942
6115
|
// src/features/rules/rulesync-rule.ts
|
|
5943
|
-
import { basename as
|
|
5944
|
-
import { z as
|
|
5945
|
-
var RulesyncRuleFrontmatterSchema =
|
|
5946
|
-
root:
|
|
5947
|
-
targets:
|
|
5948
|
-
description:
|
|
5949
|
-
globs:
|
|
5950
|
-
agentsmd:
|
|
5951
|
-
|
|
6116
|
+
import { basename as basename18, join as join59 } from "path";
|
|
6117
|
+
import { z as z26 } from "zod/mini";
|
|
6118
|
+
var RulesyncRuleFrontmatterSchema = z26.object({
|
|
6119
|
+
root: z26.optional(z26.optional(z26.boolean())),
|
|
6120
|
+
targets: z26.optional(RulesyncTargetsSchema),
|
|
6121
|
+
description: z26.optional(z26.string()),
|
|
6122
|
+
globs: z26.optional(z26.array(z26.string())),
|
|
6123
|
+
agentsmd: z26.optional(
|
|
6124
|
+
z26.object({
|
|
5952
6125
|
// @example "path/to/subproject"
|
|
5953
|
-
subprojectPath:
|
|
6126
|
+
subprojectPath: z26.optional(z26.string())
|
|
5954
6127
|
})
|
|
5955
6128
|
),
|
|
5956
|
-
cursor:
|
|
5957
|
-
|
|
5958
|
-
alwaysApply:
|
|
5959
|
-
description:
|
|
5960
|
-
globs:
|
|
6129
|
+
cursor: z26.optional(
|
|
6130
|
+
z26.object({
|
|
6131
|
+
alwaysApply: z26.optional(z26.boolean()),
|
|
6132
|
+
description: z26.optional(z26.string()),
|
|
6133
|
+
globs: z26.optional(z26.array(z26.string()))
|
|
5961
6134
|
})
|
|
5962
6135
|
)
|
|
5963
6136
|
});
|
|
@@ -5969,7 +6142,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
5969
6142
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
5970
6143
|
if (!result.success) {
|
|
5971
6144
|
throw new Error(
|
|
5972
|
-
`Invalid frontmatter in ${
|
|
6145
|
+
`Invalid frontmatter in ${join59(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5973
6146
|
);
|
|
5974
6147
|
}
|
|
5975
6148
|
}
|
|
@@ -6004,7 +6177,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6004
6177
|
return {
|
|
6005
6178
|
success: false,
|
|
6006
6179
|
error: new Error(
|
|
6007
|
-
`Invalid frontmatter in ${
|
|
6180
|
+
`Invalid frontmatter in ${join59(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
6008
6181
|
)
|
|
6009
6182
|
};
|
|
6010
6183
|
}
|
|
@@ -6013,12 +6186,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6013
6186
|
relativeFilePath,
|
|
6014
6187
|
validate = true
|
|
6015
6188
|
}) {
|
|
6016
|
-
const legacyPath =
|
|
6189
|
+
const legacyPath = join59(
|
|
6017
6190
|
process.cwd(),
|
|
6018
6191
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
6019
6192
|
relativeFilePath
|
|
6020
6193
|
);
|
|
6021
|
-
const recommendedPath =
|
|
6194
|
+
const recommendedPath = join59(
|
|
6022
6195
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
6023
6196
|
relativeFilePath
|
|
6024
6197
|
);
|
|
@@ -6037,7 +6210,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6037
6210
|
agentsmd: result.data.agentsmd,
|
|
6038
6211
|
cursor: result.data.cursor
|
|
6039
6212
|
};
|
|
6040
|
-
const filename =
|
|
6213
|
+
const filename = basename18(legacyPath);
|
|
6041
6214
|
return new _RulesyncRule({
|
|
6042
6215
|
baseDir: process.cwd(),
|
|
6043
6216
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -6051,7 +6224,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6051
6224
|
relativeFilePath,
|
|
6052
6225
|
validate = true
|
|
6053
6226
|
}) {
|
|
6054
|
-
const filePath =
|
|
6227
|
+
const filePath = join59(
|
|
6055
6228
|
process.cwd(),
|
|
6056
6229
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
6057
6230
|
relativeFilePath
|
|
@@ -6070,7 +6243,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6070
6243
|
agentsmd: result.data.agentsmd,
|
|
6071
6244
|
cursor: result.data.cursor
|
|
6072
6245
|
};
|
|
6073
|
-
const filename =
|
|
6246
|
+
const filename = basename18(filePath);
|
|
6074
6247
|
return new _RulesyncRule({
|
|
6075
6248
|
baseDir: process.cwd(),
|
|
6076
6249
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -6145,7 +6318,7 @@ var ToolRule = class extends ToolFile {
|
|
|
6145
6318
|
rulesyncRule,
|
|
6146
6319
|
validate = true,
|
|
6147
6320
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
6148
|
-
nonRootPath = { relativeDirPath:
|
|
6321
|
+
nonRootPath = { relativeDirPath: join60(".agents", "memories") }
|
|
6149
6322
|
}) {
|
|
6150
6323
|
const params = this.buildToolRuleParamsDefault({
|
|
6151
6324
|
baseDir,
|
|
@@ -6156,7 +6329,7 @@ var ToolRule = class extends ToolFile {
|
|
|
6156
6329
|
});
|
|
6157
6330
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
6158
6331
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
6159
|
-
params.relativeDirPath =
|
|
6332
|
+
params.relativeDirPath = join60(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
6160
6333
|
params.relativeFilePath = "AGENTS.md";
|
|
6161
6334
|
}
|
|
6162
6335
|
return params;
|
|
@@ -6221,7 +6394,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6221
6394
|
relativeFilePath: "AGENTS.md"
|
|
6222
6395
|
},
|
|
6223
6396
|
nonRoot: {
|
|
6224
|
-
relativeDirPath:
|
|
6397
|
+
relativeDirPath: join61(".agents", "memories")
|
|
6225
6398
|
}
|
|
6226
6399
|
};
|
|
6227
6400
|
}
|
|
@@ -6231,8 +6404,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6231
6404
|
validate = true
|
|
6232
6405
|
}) {
|
|
6233
6406
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
6234
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
6235
|
-
const fileContent = await readFileContent(
|
|
6407
|
+
const relativePath = isRoot ? "AGENTS.md" : join61(".agents", "memories", relativeFilePath);
|
|
6408
|
+
const fileContent = await readFileContent(join61(baseDir, relativePath));
|
|
6236
6409
|
return new _AgentsMdRule({
|
|
6237
6410
|
baseDir,
|
|
6238
6411
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -6272,12 +6445,12 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6272
6445
|
};
|
|
6273
6446
|
|
|
6274
6447
|
// src/features/rules/amazonqcli-rule.ts
|
|
6275
|
-
import { join as
|
|
6448
|
+
import { join as join62 } from "path";
|
|
6276
6449
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
6277
6450
|
static getSettablePaths() {
|
|
6278
6451
|
return {
|
|
6279
6452
|
nonRoot: {
|
|
6280
|
-
relativeDirPath:
|
|
6453
|
+
relativeDirPath: join62(".amazonq", "rules")
|
|
6281
6454
|
}
|
|
6282
6455
|
};
|
|
6283
6456
|
}
|
|
@@ -6287,7 +6460,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
6287
6460
|
validate = true
|
|
6288
6461
|
}) {
|
|
6289
6462
|
const fileContent = await readFileContent(
|
|
6290
|
-
|
|
6463
|
+
join62(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6291
6464
|
);
|
|
6292
6465
|
return new _AmazonQCliRule({
|
|
6293
6466
|
baseDir,
|
|
@@ -6326,8 +6499,63 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
6326
6499
|
}
|
|
6327
6500
|
};
|
|
6328
6501
|
|
|
6502
|
+
// src/features/rules/antigravity-rule.ts
|
|
6503
|
+
import { join as join63 } from "path";
|
|
6504
|
+
var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
6505
|
+
static getSettablePaths() {
|
|
6506
|
+
return {
|
|
6507
|
+
nonRoot: {
|
|
6508
|
+
relativeDirPath: join63(".agent", "rules")
|
|
6509
|
+
}
|
|
6510
|
+
};
|
|
6511
|
+
}
|
|
6512
|
+
static async fromFile({
|
|
6513
|
+
baseDir = process.cwd(),
|
|
6514
|
+
relativeFilePath,
|
|
6515
|
+
validate = true
|
|
6516
|
+
}) {
|
|
6517
|
+
const fileContent = await readFileContent(
|
|
6518
|
+
join63(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6519
|
+
);
|
|
6520
|
+
return new _AntigravityRule({
|
|
6521
|
+
baseDir,
|
|
6522
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
6523
|
+
relativeFilePath,
|
|
6524
|
+
fileContent,
|
|
6525
|
+
validate,
|
|
6526
|
+
root: false
|
|
6527
|
+
});
|
|
6528
|
+
}
|
|
6529
|
+
static fromRulesyncRule({
|
|
6530
|
+
baseDir = process.cwd(),
|
|
6531
|
+
rulesyncRule,
|
|
6532
|
+
validate = true
|
|
6533
|
+
}) {
|
|
6534
|
+
return new _AntigravityRule(
|
|
6535
|
+
this.buildToolRuleParamsDefault({
|
|
6536
|
+
baseDir,
|
|
6537
|
+
rulesyncRule,
|
|
6538
|
+
validate,
|
|
6539
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
6540
|
+
})
|
|
6541
|
+
);
|
|
6542
|
+
}
|
|
6543
|
+
toRulesyncRule() {
|
|
6544
|
+
return this.toRulesyncRuleDefault();
|
|
6545
|
+
}
|
|
6546
|
+
validate() {
|
|
6547
|
+
return { success: true, error: null };
|
|
6548
|
+
}
|
|
6549
|
+
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
6550
|
+
return this.isTargetedByRulesyncRuleDefault({
|
|
6551
|
+
rulesyncRule,
|
|
6552
|
+
toolTarget: "antigravity"
|
|
6553
|
+
});
|
|
6554
|
+
}
|
|
6555
|
+
};
|
|
6556
|
+
|
|
6329
6557
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
6330
|
-
import { join as
|
|
6558
|
+
import { join as join64 } from "path";
|
|
6331
6559
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
6332
6560
|
toRulesyncRule() {
|
|
6333
6561
|
const rulesyncFrontmatter = {
|
|
@@ -6353,7 +6581,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6353
6581
|
relativeFilePath: ".augment-guidelines"
|
|
6354
6582
|
},
|
|
6355
6583
|
nonRoot: {
|
|
6356
|
-
relativeDirPath:
|
|
6584
|
+
relativeDirPath: join64(".augment", "rules")
|
|
6357
6585
|
}
|
|
6358
6586
|
};
|
|
6359
6587
|
}
|
|
@@ -6388,8 +6616,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6388
6616
|
}) {
|
|
6389
6617
|
const settablePaths = this.getSettablePaths();
|
|
6390
6618
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
6391
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
6392
|
-
const fileContent = await readFileContent(
|
|
6619
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join64(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
6620
|
+
const fileContent = await readFileContent(join64(baseDir, relativePath));
|
|
6393
6621
|
return new _AugmentcodeLegacyRule({
|
|
6394
6622
|
baseDir,
|
|
6395
6623
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -6402,7 +6630,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6402
6630
|
};
|
|
6403
6631
|
|
|
6404
6632
|
// src/features/rules/augmentcode-rule.ts
|
|
6405
|
-
import { join as
|
|
6633
|
+
import { join as join65 } from "path";
|
|
6406
6634
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
6407
6635
|
toRulesyncRule() {
|
|
6408
6636
|
return this.toRulesyncRuleDefault();
|
|
@@ -6410,7 +6638,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6410
6638
|
static getSettablePaths() {
|
|
6411
6639
|
return {
|
|
6412
6640
|
nonRoot: {
|
|
6413
|
-
relativeDirPath:
|
|
6641
|
+
relativeDirPath: join65(".augment", "rules")
|
|
6414
6642
|
}
|
|
6415
6643
|
};
|
|
6416
6644
|
}
|
|
@@ -6434,7 +6662,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6434
6662
|
validate = true
|
|
6435
6663
|
}) {
|
|
6436
6664
|
const fileContent = await readFileContent(
|
|
6437
|
-
|
|
6665
|
+
join65(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6438
6666
|
);
|
|
6439
6667
|
const { body: content } = parseFrontmatter(fileContent);
|
|
6440
6668
|
return new _AugmentcodeRule({
|
|
@@ -6457,7 +6685,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6457
6685
|
};
|
|
6458
6686
|
|
|
6459
6687
|
// src/features/rules/claudecode-rule.ts
|
|
6460
|
-
import { join as
|
|
6688
|
+
import { join as join66 } from "path";
|
|
6461
6689
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
6462
6690
|
static getSettablePaths({
|
|
6463
6691
|
global
|
|
@@ -6476,7 +6704,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6476
6704
|
relativeFilePath: "CLAUDE.md"
|
|
6477
6705
|
},
|
|
6478
6706
|
nonRoot: {
|
|
6479
|
-
relativeDirPath:
|
|
6707
|
+
relativeDirPath: join66(".claude", "memories")
|
|
6480
6708
|
}
|
|
6481
6709
|
};
|
|
6482
6710
|
}
|
|
@@ -6491,7 +6719,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6491
6719
|
if (isRoot) {
|
|
6492
6720
|
const relativePath2 = paths.root.relativeFilePath;
|
|
6493
6721
|
const fileContent2 = await readFileContent(
|
|
6494
|
-
|
|
6722
|
+
join66(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
6495
6723
|
);
|
|
6496
6724
|
return new _ClaudecodeRule({
|
|
6497
6725
|
baseDir,
|
|
@@ -6505,8 +6733,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6505
6733
|
if (!paths.nonRoot) {
|
|
6506
6734
|
throw new Error("nonRoot path is not set");
|
|
6507
6735
|
}
|
|
6508
|
-
const relativePath =
|
|
6509
|
-
const fileContent = await readFileContent(
|
|
6736
|
+
const relativePath = join66(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
6737
|
+
const fileContent = await readFileContent(join66(baseDir, relativePath));
|
|
6510
6738
|
return new _ClaudecodeRule({
|
|
6511
6739
|
baseDir,
|
|
6512
6740
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -6548,10 +6776,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6548
6776
|
};
|
|
6549
6777
|
|
|
6550
6778
|
// src/features/rules/cline-rule.ts
|
|
6551
|
-
import { join as
|
|
6552
|
-
import { z as
|
|
6553
|
-
var ClineRuleFrontmatterSchema =
|
|
6554
|
-
description:
|
|
6779
|
+
import { join as join67 } from "path";
|
|
6780
|
+
import { z as z27 } from "zod/mini";
|
|
6781
|
+
var ClineRuleFrontmatterSchema = z27.object({
|
|
6782
|
+
description: z27.string()
|
|
6555
6783
|
});
|
|
6556
6784
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
6557
6785
|
static getSettablePaths() {
|
|
@@ -6593,7 +6821,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
6593
6821
|
validate = true
|
|
6594
6822
|
}) {
|
|
6595
6823
|
const fileContent = await readFileContent(
|
|
6596
|
-
|
|
6824
|
+
join67(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6597
6825
|
);
|
|
6598
6826
|
return new _ClineRule({
|
|
6599
6827
|
baseDir,
|
|
@@ -6606,7 +6834,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
6606
6834
|
};
|
|
6607
6835
|
|
|
6608
6836
|
// src/features/rules/codexcli-rule.ts
|
|
6609
|
-
import { join as
|
|
6837
|
+
import { join as join68 } from "path";
|
|
6610
6838
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
6611
6839
|
static getSettablePaths({
|
|
6612
6840
|
global
|
|
@@ -6625,7 +6853,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
6625
6853
|
relativeFilePath: "AGENTS.md"
|
|
6626
6854
|
},
|
|
6627
6855
|
nonRoot: {
|
|
6628
|
-
relativeDirPath:
|
|
6856
|
+
relativeDirPath: join68(".codex", "memories")
|
|
6629
6857
|
}
|
|
6630
6858
|
};
|
|
6631
6859
|
}
|
|
@@ -6640,7 +6868,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
6640
6868
|
if (isRoot) {
|
|
6641
6869
|
const relativePath2 = paths.root.relativeFilePath;
|
|
6642
6870
|
const fileContent2 = await readFileContent(
|
|
6643
|
-
|
|
6871
|
+
join68(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
6644
6872
|
);
|
|
6645
6873
|
return new _CodexcliRule({
|
|
6646
6874
|
baseDir,
|
|
@@ -6654,8 +6882,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
6654
6882
|
if (!paths.nonRoot) {
|
|
6655
6883
|
throw new Error("nonRoot path is not set");
|
|
6656
6884
|
}
|
|
6657
|
-
const relativePath =
|
|
6658
|
-
const fileContent = await readFileContent(
|
|
6885
|
+
const relativePath = join68(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
6886
|
+
const fileContent = await readFileContent(join68(baseDir, relativePath));
|
|
6659
6887
|
return new _CodexcliRule({
|
|
6660
6888
|
baseDir,
|
|
6661
6889
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -6697,11 +6925,11 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
6697
6925
|
};
|
|
6698
6926
|
|
|
6699
6927
|
// src/features/rules/copilot-rule.ts
|
|
6700
|
-
import { join as
|
|
6701
|
-
import { z as
|
|
6702
|
-
var CopilotRuleFrontmatterSchema =
|
|
6703
|
-
description:
|
|
6704
|
-
applyTo:
|
|
6928
|
+
import { join as join69 } from "path";
|
|
6929
|
+
import { z as z28 } from "zod/mini";
|
|
6930
|
+
var CopilotRuleFrontmatterSchema = z28.object({
|
|
6931
|
+
description: z28.optional(z28.string()),
|
|
6932
|
+
applyTo: z28.optional(z28.string())
|
|
6705
6933
|
});
|
|
6706
6934
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
6707
6935
|
frontmatter;
|
|
@@ -6713,7 +6941,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6713
6941
|
relativeFilePath: "copilot-instructions.md"
|
|
6714
6942
|
},
|
|
6715
6943
|
nonRoot: {
|
|
6716
|
-
relativeDirPath:
|
|
6944
|
+
relativeDirPath: join69(".github", "instructions")
|
|
6717
6945
|
}
|
|
6718
6946
|
};
|
|
6719
6947
|
}
|
|
@@ -6722,7 +6950,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6722
6950
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
6723
6951
|
if (!result.success) {
|
|
6724
6952
|
throw new Error(
|
|
6725
|
-
`Invalid frontmatter in ${
|
|
6953
|
+
`Invalid frontmatter in ${join69(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6726
6954
|
);
|
|
6727
6955
|
}
|
|
6728
6956
|
}
|
|
@@ -6800,11 +7028,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6800
7028
|
validate = true
|
|
6801
7029
|
}) {
|
|
6802
7030
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
6803
|
-
const relativePath = isRoot ?
|
|
7031
|
+
const relativePath = isRoot ? join69(
|
|
6804
7032
|
this.getSettablePaths().root.relativeDirPath,
|
|
6805
7033
|
this.getSettablePaths().root.relativeFilePath
|
|
6806
|
-
) :
|
|
6807
|
-
const fileContent = await readFileContent(
|
|
7034
|
+
) : join69(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
7035
|
+
const fileContent = await readFileContent(join69(baseDir, relativePath));
|
|
6808
7036
|
if (isRoot) {
|
|
6809
7037
|
return new _CopilotRule({
|
|
6810
7038
|
baseDir,
|
|
@@ -6823,7 +7051,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6823
7051
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
6824
7052
|
if (!result.success) {
|
|
6825
7053
|
throw new Error(
|
|
6826
|
-
`Invalid frontmatter in ${
|
|
7054
|
+
`Invalid frontmatter in ${join69(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
6827
7055
|
);
|
|
6828
7056
|
}
|
|
6829
7057
|
return new _CopilotRule({
|
|
@@ -6847,7 +7075,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6847
7075
|
return {
|
|
6848
7076
|
success: false,
|
|
6849
7077
|
error: new Error(
|
|
6850
|
-
`Invalid frontmatter in ${
|
|
7078
|
+
`Invalid frontmatter in ${join69(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
6851
7079
|
)
|
|
6852
7080
|
};
|
|
6853
7081
|
}
|
|
@@ -6867,12 +7095,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6867
7095
|
};
|
|
6868
7096
|
|
|
6869
7097
|
// src/features/rules/cursor-rule.ts
|
|
6870
|
-
import { basename as
|
|
6871
|
-
import { z as
|
|
6872
|
-
var CursorRuleFrontmatterSchema =
|
|
6873
|
-
description:
|
|
6874
|
-
globs:
|
|
6875
|
-
alwaysApply:
|
|
7098
|
+
import { basename as basename19, join as join70 } from "path";
|
|
7099
|
+
import { z as z29 } from "zod/mini";
|
|
7100
|
+
var CursorRuleFrontmatterSchema = z29.object({
|
|
7101
|
+
description: z29.optional(z29.string()),
|
|
7102
|
+
globs: z29.optional(z29.string()),
|
|
7103
|
+
alwaysApply: z29.optional(z29.boolean())
|
|
6876
7104
|
});
|
|
6877
7105
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
6878
7106
|
frontmatter;
|
|
@@ -6880,7 +7108,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
6880
7108
|
static getSettablePaths() {
|
|
6881
7109
|
return {
|
|
6882
7110
|
nonRoot: {
|
|
6883
|
-
relativeDirPath:
|
|
7111
|
+
relativeDirPath: join70(".cursor", "rules")
|
|
6884
7112
|
}
|
|
6885
7113
|
};
|
|
6886
7114
|
}
|
|
@@ -6889,7 +7117,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
6889
7117
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
6890
7118
|
if (!result.success) {
|
|
6891
7119
|
throw new Error(
|
|
6892
|
-
`Invalid frontmatter in ${
|
|
7120
|
+
`Invalid frontmatter in ${join70(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6893
7121
|
);
|
|
6894
7122
|
}
|
|
6895
7123
|
}
|
|
@@ -7006,19 +7234,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7006
7234
|
validate = true
|
|
7007
7235
|
}) {
|
|
7008
7236
|
const fileContent = await readFileContent(
|
|
7009
|
-
|
|
7237
|
+
join70(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7010
7238
|
);
|
|
7011
7239
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
7012
7240
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7013
7241
|
if (!result.success) {
|
|
7014
7242
|
throw new Error(
|
|
7015
|
-
`Invalid frontmatter in ${
|
|
7243
|
+
`Invalid frontmatter in ${join70(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
7016
7244
|
);
|
|
7017
7245
|
}
|
|
7018
7246
|
return new _CursorRule({
|
|
7019
7247
|
baseDir,
|
|
7020
7248
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
7021
|
-
relativeFilePath:
|
|
7249
|
+
relativeFilePath: basename19(relativeFilePath),
|
|
7022
7250
|
frontmatter: result.data,
|
|
7023
7251
|
body: content.trim(),
|
|
7024
7252
|
validate
|
|
@@ -7035,7 +7263,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7035
7263
|
return {
|
|
7036
7264
|
success: false,
|
|
7037
7265
|
error: new Error(
|
|
7038
|
-
`Invalid frontmatter in ${
|
|
7266
|
+
`Invalid frontmatter in ${join70(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7039
7267
|
)
|
|
7040
7268
|
};
|
|
7041
7269
|
}
|
|
@@ -7055,7 +7283,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7055
7283
|
};
|
|
7056
7284
|
|
|
7057
7285
|
// src/features/rules/geminicli-rule.ts
|
|
7058
|
-
import { join as
|
|
7286
|
+
import { join as join71 } from "path";
|
|
7059
7287
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
7060
7288
|
static getSettablePaths({
|
|
7061
7289
|
global
|
|
@@ -7074,7 +7302,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7074
7302
|
relativeFilePath: "GEMINI.md"
|
|
7075
7303
|
},
|
|
7076
7304
|
nonRoot: {
|
|
7077
|
-
relativeDirPath:
|
|
7305
|
+
relativeDirPath: join71(".gemini", "memories")
|
|
7078
7306
|
}
|
|
7079
7307
|
};
|
|
7080
7308
|
}
|
|
@@ -7089,7 +7317,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7089
7317
|
if (isRoot) {
|
|
7090
7318
|
const relativePath2 = paths.root.relativeFilePath;
|
|
7091
7319
|
const fileContent2 = await readFileContent(
|
|
7092
|
-
|
|
7320
|
+
join71(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
7093
7321
|
);
|
|
7094
7322
|
return new _GeminiCliRule({
|
|
7095
7323
|
baseDir,
|
|
@@ -7103,8 +7331,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7103
7331
|
if (!paths.nonRoot) {
|
|
7104
7332
|
throw new Error("nonRoot path is not set");
|
|
7105
7333
|
}
|
|
7106
|
-
const relativePath =
|
|
7107
|
-
const fileContent = await readFileContent(
|
|
7334
|
+
const relativePath = join71(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
7335
|
+
const fileContent = await readFileContent(join71(baseDir, relativePath));
|
|
7108
7336
|
return new _GeminiCliRule({
|
|
7109
7337
|
baseDir,
|
|
7110
7338
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -7146,7 +7374,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7146
7374
|
};
|
|
7147
7375
|
|
|
7148
7376
|
// src/features/rules/junie-rule.ts
|
|
7149
|
-
import { join as
|
|
7377
|
+
import { join as join72 } from "path";
|
|
7150
7378
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
7151
7379
|
static getSettablePaths() {
|
|
7152
7380
|
return {
|
|
@@ -7155,7 +7383,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7155
7383
|
relativeFilePath: "guidelines.md"
|
|
7156
7384
|
},
|
|
7157
7385
|
nonRoot: {
|
|
7158
|
-
relativeDirPath:
|
|
7386
|
+
relativeDirPath: join72(".junie", "memories")
|
|
7159
7387
|
}
|
|
7160
7388
|
};
|
|
7161
7389
|
}
|
|
@@ -7165,8 +7393,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7165
7393
|
validate = true
|
|
7166
7394
|
}) {
|
|
7167
7395
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
7168
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
7169
|
-
const fileContent = await readFileContent(
|
|
7396
|
+
const relativePath = isRoot ? "guidelines.md" : join72(".junie", "memories", relativeFilePath);
|
|
7397
|
+
const fileContent = await readFileContent(join72(baseDir, relativePath));
|
|
7170
7398
|
return new _JunieRule({
|
|
7171
7399
|
baseDir,
|
|
7172
7400
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7206,12 +7434,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7206
7434
|
};
|
|
7207
7435
|
|
|
7208
7436
|
// src/features/rules/kiro-rule.ts
|
|
7209
|
-
import { join as
|
|
7437
|
+
import { join as join73 } from "path";
|
|
7210
7438
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
7211
7439
|
static getSettablePaths() {
|
|
7212
7440
|
return {
|
|
7213
7441
|
nonRoot: {
|
|
7214
|
-
relativeDirPath:
|
|
7442
|
+
relativeDirPath: join73(".kiro", "steering")
|
|
7215
7443
|
}
|
|
7216
7444
|
};
|
|
7217
7445
|
}
|
|
@@ -7221,7 +7449,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
7221
7449
|
validate = true
|
|
7222
7450
|
}) {
|
|
7223
7451
|
const fileContent = await readFileContent(
|
|
7224
|
-
|
|
7452
|
+
join73(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7225
7453
|
);
|
|
7226
7454
|
return new _KiroRule({
|
|
7227
7455
|
baseDir,
|
|
@@ -7261,7 +7489,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
7261
7489
|
};
|
|
7262
7490
|
|
|
7263
7491
|
// src/features/rules/opencode-rule.ts
|
|
7264
|
-
import { join as
|
|
7492
|
+
import { join as join74 } from "path";
|
|
7265
7493
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
7266
7494
|
static getSettablePaths() {
|
|
7267
7495
|
return {
|
|
@@ -7270,7 +7498,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7270
7498
|
relativeFilePath: "AGENTS.md"
|
|
7271
7499
|
},
|
|
7272
7500
|
nonRoot: {
|
|
7273
|
-
relativeDirPath:
|
|
7501
|
+
relativeDirPath: join74(".opencode", "memories")
|
|
7274
7502
|
}
|
|
7275
7503
|
};
|
|
7276
7504
|
}
|
|
@@ -7280,8 +7508,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7280
7508
|
validate = true
|
|
7281
7509
|
}) {
|
|
7282
7510
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
7283
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
7284
|
-
const fileContent = await readFileContent(
|
|
7511
|
+
const relativePath = isRoot ? "AGENTS.md" : join74(".opencode", "memories", relativeFilePath);
|
|
7512
|
+
const fileContent = await readFileContent(join74(baseDir, relativePath));
|
|
7285
7513
|
return new _OpenCodeRule({
|
|
7286
7514
|
baseDir,
|
|
7287
7515
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7321,7 +7549,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7321
7549
|
};
|
|
7322
7550
|
|
|
7323
7551
|
// src/features/rules/qwencode-rule.ts
|
|
7324
|
-
import { join as
|
|
7552
|
+
import { join as join75 } from "path";
|
|
7325
7553
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
7326
7554
|
static getSettablePaths() {
|
|
7327
7555
|
return {
|
|
@@ -7330,7 +7558,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7330
7558
|
relativeFilePath: "QWEN.md"
|
|
7331
7559
|
},
|
|
7332
7560
|
nonRoot: {
|
|
7333
|
-
relativeDirPath:
|
|
7561
|
+
relativeDirPath: join75(".qwen", "memories")
|
|
7334
7562
|
}
|
|
7335
7563
|
};
|
|
7336
7564
|
}
|
|
@@ -7340,8 +7568,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7340
7568
|
validate = true
|
|
7341
7569
|
}) {
|
|
7342
7570
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
7343
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
7344
|
-
const fileContent = await readFileContent(
|
|
7571
|
+
const relativePath = isRoot ? "QWEN.md" : join75(".qwen", "memories", relativeFilePath);
|
|
7572
|
+
const fileContent = await readFileContent(join75(baseDir, relativePath));
|
|
7345
7573
|
return new _QwencodeRule({
|
|
7346
7574
|
baseDir,
|
|
7347
7575
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7378,12 +7606,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7378
7606
|
};
|
|
7379
7607
|
|
|
7380
7608
|
// src/features/rules/roo-rule.ts
|
|
7381
|
-
import { join as
|
|
7609
|
+
import { join as join76 } from "path";
|
|
7382
7610
|
var RooRule = class _RooRule extends ToolRule {
|
|
7383
7611
|
static getSettablePaths() {
|
|
7384
7612
|
return {
|
|
7385
7613
|
nonRoot: {
|
|
7386
|
-
relativeDirPath:
|
|
7614
|
+
relativeDirPath: join76(".roo", "rules")
|
|
7387
7615
|
}
|
|
7388
7616
|
};
|
|
7389
7617
|
}
|
|
@@ -7393,7 +7621,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
7393
7621
|
validate = true
|
|
7394
7622
|
}) {
|
|
7395
7623
|
const fileContent = await readFileContent(
|
|
7396
|
-
|
|
7624
|
+
join76(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7397
7625
|
);
|
|
7398
7626
|
return new _RooRule({
|
|
7399
7627
|
baseDir,
|
|
@@ -7448,7 +7676,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
7448
7676
|
};
|
|
7449
7677
|
|
|
7450
7678
|
// src/features/rules/warp-rule.ts
|
|
7451
|
-
import { join as
|
|
7679
|
+
import { join as join77 } from "path";
|
|
7452
7680
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
7453
7681
|
constructor({ fileContent, root, ...rest }) {
|
|
7454
7682
|
super({
|
|
@@ -7464,7 +7692,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
7464
7692
|
relativeFilePath: "WARP.md"
|
|
7465
7693
|
},
|
|
7466
7694
|
nonRoot: {
|
|
7467
|
-
relativeDirPath:
|
|
7695
|
+
relativeDirPath: join77(".warp", "memories")
|
|
7468
7696
|
}
|
|
7469
7697
|
};
|
|
7470
7698
|
}
|
|
@@ -7474,8 +7702,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
7474
7702
|
validate = true
|
|
7475
7703
|
}) {
|
|
7476
7704
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
7477
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
7478
|
-
const fileContent = await readFileContent(
|
|
7705
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join77(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
7706
|
+
const fileContent = await readFileContent(join77(baseDir, relativePath));
|
|
7479
7707
|
return new _WarpRule({
|
|
7480
7708
|
baseDir,
|
|
7481
7709
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -7515,12 +7743,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
7515
7743
|
};
|
|
7516
7744
|
|
|
7517
7745
|
// src/features/rules/windsurf-rule.ts
|
|
7518
|
-
import { join as
|
|
7746
|
+
import { join as join78 } from "path";
|
|
7519
7747
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
7520
7748
|
static getSettablePaths() {
|
|
7521
7749
|
return {
|
|
7522
7750
|
nonRoot: {
|
|
7523
|
-
relativeDirPath:
|
|
7751
|
+
relativeDirPath: join78(".windsurf", "rules")
|
|
7524
7752
|
}
|
|
7525
7753
|
};
|
|
7526
7754
|
}
|
|
@@ -7530,7 +7758,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
7530
7758
|
validate = true
|
|
7531
7759
|
}) {
|
|
7532
7760
|
const fileContent = await readFileContent(
|
|
7533
|
-
|
|
7761
|
+
join78(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7534
7762
|
);
|
|
7535
7763
|
return new _WindsurfRule({
|
|
7536
7764
|
baseDir,
|
|
@@ -7572,6 +7800,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
7572
7800
|
var rulesProcessorToolTargets = [
|
|
7573
7801
|
"agentsmd",
|
|
7574
7802
|
"amazonqcli",
|
|
7803
|
+
"antigravity",
|
|
7575
7804
|
"augmentcode",
|
|
7576
7805
|
"augmentcode-legacy",
|
|
7577
7806
|
"claudecode",
|
|
@@ -7588,7 +7817,7 @@ var rulesProcessorToolTargets = [
|
|
|
7588
7817
|
"warp",
|
|
7589
7818
|
"windsurf"
|
|
7590
7819
|
];
|
|
7591
|
-
var RulesProcessorToolTargetSchema =
|
|
7820
|
+
var RulesProcessorToolTargetSchema = z30.enum(rulesProcessorToolTargets);
|
|
7592
7821
|
var rulesProcessorToolTargetsGlobal = [
|
|
7593
7822
|
"claudecode",
|
|
7594
7823
|
"codexcli",
|
|
@@ -7645,6 +7874,15 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7645
7874
|
rulesyncRule,
|
|
7646
7875
|
validate: true
|
|
7647
7876
|
});
|
|
7877
|
+
case "antigravity":
|
|
7878
|
+
if (!AntigravityRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
7879
|
+
return null;
|
|
7880
|
+
}
|
|
7881
|
+
return AntigravityRule.fromRulesyncRule({
|
|
7882
|
+
baseDir: this.baseDir,
|
|
7883
|
+
rulesyncRule,
|
|
7884
|
+
validate: true
|
|
7885
|
+
});
|
|
7648
7886
|
case "augmentcode":
|
|
7649
7887
|
if (!AugmentcodeRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
7650
7888
|
return null;
|
|
@@ -7942,10 +8180,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7942
8180
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
7943
8181
|
*/
|
|
7944
8182
|
async loadRulesyncFiles() {
|
|
7945
|
-
const files = await findFilesByGlobs(
|
|
8183
|
+
const files = await findFilesByGlobs(join79(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
7946
8184
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
7947
8185
|
const rulesyncRules = await Promise.all(
|
|
7948
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath:
|
|
8186
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename20(file) }))
|
|
7949
8187
|
);
|
|
7950
8188
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
7951
8189
|
if (rootRules.length > 1) {
|
|
@@ -7963,10 +8201,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7963
8201
|
return rulesyncRules;
|
|
7964
8202
|
}
|
|
7965
8203
|
async loadRulesyncFilesLegacy() {
|
|
7966
|
-
const legacyFiles = await findFilesByGlobs(
|
|
8204
|
+
const legacyFiles = await findFilesByGlobs(join79(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
7967
8205
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
7968
8206
|
return Promise.all(
|
|
7969
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath:
|
|
8207
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename20(file) }))
|
|
7970
8208
|
);
|
|
7971
8209
|
}
|
|
7972
8210
|
/**
|
|
@@ -8029,13 +8267,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
8029
8267
|
return [];
|
|
8030
8268
|
}
|
|
8031
8269
|
const rootFilePaths = await findFilesByGlobs(
|
|
8032
|
-
|
|
8270
|
+
join79(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
|
|
8033
8271
|
);
|
|
8034
8272
|
return await Promise.all(
|
|
8035
8273
|
rootFilePaths.map(
|
|
8036
8274
|
(filePath) => root.fromFile({
|
|
8037
8275
|
baseDir: this.baseDir,
|
|
8038
|
-
relativeFilePath:
|
|
8276
|
+
relativeFilePath: basename20(filePath),
|
|
8039
8277
|
global: this.global
|
|
8040
8278
|
})
|
|
8041
8279
|
)
|
|
@@ -8047,13 +8285,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
8047
8285
|
return [];
|
|
8048
8286
|
}
|
|
8049
8287
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
8050
|
-
|
|
8288
|
+
join79(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
|
|
8051
8289
|
);
|
|
8052
8290
|
return await Promise.all(
|
|
8053
8291
|
nonRootFilePaths.map(
|
|
8054
8292
|
(filePath) => nonRoot.fromFile({
|
|
8055
8293
|
baseDir: this.baseDir,
|
|
8056
|
-
relativeFilePath:
|
|
8294
|
+
relativeFilePath: basename20(filePath),
|
|
8057
8295
|
global: this.global
|
|
8058
8296
|
})
|
|
8059
8297
|
)
|
|
@@ -8399,7 +8637,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
8399
8637
|
`@${rule.getRelativePathFromCwd()} description: "${escapedDescription}" globs: "${globsText}"`
|
|
8400
8638
|
);
|
|
8401
8639
|
}
|
|
8402
|
-
return lines.join("\n") + "\n";
|
|
8640
|
+
return lines.join("\n") + "\n\n";
|
|
8403
8641
|
}
|
|
8404
8642
|
generateAdditionalConventionsSection({
|
|
8405
8643
|
commands,
|
|
@@ -8424,21 +8662,21 @@ s/<command> [arguments]
|
|
|
8424
8662
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
8425
8663
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
8426
8664
|
|
|
8427
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
8665
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join79(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
8428
8666
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
8429
8667
|
|
|
8430
8668
|
Simulated subagents are specialized AI assistants that can be invoked to handle specific types of tasks. In this case, it can be appear something like custom slash commands simply. Simulated subagents can be called by custom slash commands.
|
|
8431
8669
|
|
|
8432
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
8670
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join79(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
8433
8671
|
|
|
8434
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
8672
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join79(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
8435
8673
|
const skillsSection = skills ? `## Simulated Skills
|
|
8436
8674
|
|
|
8437
8675
|
Simulated skills are specialized capabilities that can be invoked to handle specific types of tasks.
|
|
8438
8676
|
|
|
8439
|
-
When users invoke a simulated skill, look for the corresponding SKILL.md file in \`${
|
|
8677
|
+
When users invoke a simulated skill, look for the corresponding SKILL.md file in \`${join79(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "{skill}/SKILL.md")}\` and execute its contents as the block of operations.
|
|
8440
8678
|
|
|
8441
|
-
For example, if the user instructs \`Use the skill example-skill to achieve something\`, look for \`${
|
|
8679
|
+
For example, if the user instructs \`Use the skill example-skill to achieve something\`, look for \`${join79(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "example-skill/SKILL.md")}\` and execute its contents.
|
|
8442
8680
|
|
|
8443
8681
|
Additionally, you should proactively consider using available skills when they would help accomplish a task more effectively, even if the user doesn't explicitly request them.` : "";
|
|
8444
8682
|
const result = [
|
|
@@ -8700,9 +8938,9 @@ async function generateSkills(config) {
|
|
|
8700
8938
|
}
|
|
8701
8939
|
|
|
8702
8940
|
// src/cli/commands/gitignore.ts
|
|
8703
|
-
import { join as
|
|
8941
|
+
import { join as join80 } from "path";
|
|
8704
8942
|
var gitignoreCommand = async () => {
|
|
8705
|
-
const gitignorePath =
|
|
8943
|
+
const gitignorePath = join80(process.cwd(), ".gitignore");
|
|
8706
8944
|
const rulesFilesToIgnore = [
|
|
8707
8945
|
"# Generated by rulesync - AI tool configuration files",
|
|
8708
8946
|
// AGENTS.md
|
|
@@ -8975,7 +9213,7 @@ async function importSkills(config, tool) {
|
|
|
8975
9213
|
}
|
|
8976
9214
|
|
|
8977
9215
|
// src/cli/commands/init.ts
|
|
8978
|
-
import { join as
|
|
9216
|
+
import { join as join81 } from "path";
|
|
8979
9217
|
async function initCommand() {
|
|
8980
9218
|
logger.info("Initializing rulesync...");
|
|
8981
9219
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -9138,14 +9376,14 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
9138
9376
|
await ensureDir(commandPaths.relativeDirPath);
|
|
9139
9377
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
9140
9378
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
9141
|
-
const ruleFilepath =
|
|
9379
|
+
const ruleFilepath = join81(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
9142
9380
|
if (!await fileExists(ruleFilepath)) {
|
|
9143
9381
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
9144
9382
|
logger.success(`Created ${ruleFilepath}`);
|
|
9145
9383
|
} else {
|
|
9146
9384
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
9147
9385
|
}
|
|
9148
|
-
const mcpFilepath =
|
|
9386
|
+
const mcpFilepath = join81(
|
|
9149
9387
|
mcpPaths.recommended.relativeDirPath,
|
|
9150
9388
|
mcpPaths.recommended.relativeFilePath
|
|
9151
9389
|
);
|
|
@@ -9155,21 +9393,21 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
9155
9393
|
} else {
|
|
9156
9394
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
9157
9395
|
}
|
|
9158
|
-
const commandFilepath =
|
|
9396
|
+
const commandFilepath = join81(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
9159
9397
|
if (!await fileExists(commandFilepath)) {
|
|
9160
9398
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
9161
9399
|
logger.success(`Created ${commandFilepath}`);
|
|
9162
9400
|
} else {
|
|
9163
9401
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
9164
9402
|
}
|
|
9165
|
-
const subagentFilepath =
|
|
9403
|
+
const subagentFilepath = join81(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
9166
9404
|
if (!await fileExists(subagentFilepath)) {
|
|
9167
9405
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
9168
9406
|
logger.success(`Created ${subagentFilepath}`);
|
|
9169
9407
|
} else {
|
|
9170
9408
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
9171
9409
|
}
|
|
9172
|
-
const ignoreFilepath =
|
|
9410
|
+
const ignoreFilepath = join81(
|
|
9173
9411
|
ignorePaths.recommended.relativeDirPath,
|
|
9174
9412
|
ignorePaths.recommended.relativeFilePath
|
|
9175
9413
|
);
|
|
@@ -9185,12 +9423,12 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
9185
9423
|
import { FastMCP } from "fastmcp";
|
|
9186
9424
|
|
|
9187
9425
|
// src/mcp/commands.ts
|
|
9188
|
-
import { basename as
|
|
9189
|
-
import { z as
|
|
9426
|
+
import { basename as basename21, join as join82 } from "path";
|
|
9427
|
+
import { z as z31 } from "zod/mini";
|
|
9190
9428
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
9191
9429
|
var maxCommandsCount = 1e3;
|
|
9192
9430
|
async function listCommands() {
|
|
9193
|
-
const commandsDir =
|
|
9431
|
+
const commandsDir = join82(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
9194
9432
|
try {
|
|
9195
9433
|
const files = await listDirectoryFiles(commandsDir);
|
|
9196
9434
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -9202,7 +9440,7 @@ async function listCommands() {
|
|
|
9202
9440
|
});
|
|
9203
9441
|
const frontmatter = command.getFrontmatter();
|
|
9204
9442
|
return {
|
|
9205
|
-
relativePathFromCwd:
|
|
9443
|
+
relativePathFromCwd: join82(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
9206
9444
|
frontmatter
|
|
9207
9445
|
};
|
|
9208
9446
|
} catch (error) {
|
|
@@ -9222,13 +9460,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
9222
9460
|
relativePath: relativePathFromCwd,
|
|
9223
9461
|
intendedRootDir: process.cwd()
|
|
9224
9462
|
});
|
|
9225
|
-
const filename =
|
|
9463
|
+
const filename = basename21(relativePathFromCwd);
|
|
9226
9464
|
try {
|
|
9227
9465
|
const command = await RulesyncCommand.fromFile({
|
|
9228
9466
|
relativeFilePath: filename
|
|
9229
9467
|
});
|
|
9230
9468
|
return {
|
|
9231
|
-
relativePathFromCwd:
|
|
9469
|
+
relativePathFromCwd: join82(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
9232
9470
|
frontmatter: command.getFrontmatter(),
|
|
9233
9471
|
body: command.getBody()
|
|
9234
9472
|
};
|
|
@@ -9247,7 +9485,7 @@ async function putCommand({
|
|
|
9247
9485
|
relativePath: relativePathFromCwd,
|
|
9248
9486
|
intendedRootDir: process.cwd()
|
|
9249
9487
|
});
|
|
9250
|
-
const filename =
|
|
9488
|
+
const filename = basename21(relativePathFromCwd);
|
|
9251
9489
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
9252
9490
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
9253
9491
|
throw new Error(
|
|
@@ -9257,7 +9495,7 @@ async function putCommand({
|
|
|
9257
9495
|
try {
|
|
9258
9496
|
const existingCommands = await listCommands();
|
|
9259
9497
|
const isUpdate = existingCommands.some(
|
|
9260
|
-
(command2) => command2.relativePathFromCwd ===
|
|
9498
|
+
(command2) => command2.relativePathFromCwd === join82(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
9261
9499
|
);
|
|
9262
9500
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
9263
9501
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -9272,11 +9510,11 @@ async function putCommand({
|
|
|
9272
9510
|
fileContent,
|
|
9273
9511
|
validate: true
|
|
9274
9512
|
});
|
|
9275
|
-
const commandsDir =
|
|
9513
|
+
const commandsDir = join82(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
9276
9514
|
await ensureDir(commandsDir);
|
|
9277
9515
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
9278
9516
|
return {
|
|
9279
|
-
relativePathFromCwd:
|
|
9517
|
+
relativePathFromCwd: join82(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
9280
9518
|
frontmatter: command.getFrontmatter(),
|
|
9281
9519
|
body: command.getBody()
|
|
9282
9520
|
};
|
|
@@ -9291,12 +9529,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
9291
9529
|
relativePath: relativePathFromCwd,
|
|
9292
9530
|
intendedRootDir: process.cwd()
|
|
9293
9531
|
});
|
|
9294
|
-
const filename =
|
|
9295
|
-
const fullPath =
|
|
9532
|
+
const filename = basename21(relativePathFromCwd);
|
|
9533
|
+
const fullPath = join82(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
9296
9534
|
try {
|
|
9297
9535
|
await removeFile(fullPath);
|
|
9298
9536
|
return {
|
|
9299
|
-
relativePathFromCwd:
|
|
9537
|
+
relativePathFromCwd: join82(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
9300
9538
|
};
|
|
9301
9539
|
} catch (error) {
|
|
9302
9540
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -9305,23 +9543,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
9305
9543
|
}
|
|
9306
9544
|
}
|
|
9307
9545
|
var commandToolSchemas = {
|
|
9308
|
-
listCommands:
|
|
9309
|
-
getCommand:
|
|
9310
|
-
relativePathFromCwd:
|
|
9546
|
+
listCommands: z31.object({}),
|
|
9547
|
+
getCommand: z31.object({
|
|
9548
|
+
relativePathFromCwd: z31.string()
|
|
9311
9549
|
}),
|
|
9312
|
-
putCommand:
|
|
9313
|
-
relativePathFromCwd:
|
|
9550
|
+
putCommand: z31.object({
|
|
9551
|
+
relativePathFromCwd: z31.string(),
|
|
9314
9552
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
9315
|
-
body:
|
|
9553
|
+
body: z31.string()
|
|
9316
9554
|
}),
|
|
9317
|
-
deleteCommand:
|
|
9318
|
-
relativePathFromCwd:
|
|
9555
|
+
deleteCommand: z31.object({
|
|
9556
|
+
relativePathFromCwd: z31.string()
|
|
9319
9557
|
})
|
|
9320
9558
|
};
|
|
9321
9559
|
var commandTools = {
|
|
9322
9560
|
listCommands: {
|
|
9323
9561
|
name: "listCommands",
|
|
9324
|
-
description: `List all commands from ${
|
|
9562
|
+
description: `List all commands from ${join82(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
9325
9563
|
parameters: commandToolSchemas.listCommands,
|
|
9326
9564
|
execute: async () => {
|
|
9327
9565
|
const commands = await listCommands();
|
|
@@ -9363,11 +9601,11 @@ var commandTools = {
|
|
|
9363
9601
|
};
|
|
9364
9602
|
|
|
9365
9603
|
// src/mcp/ignore.ts
|
|
9366
|
-
import { join as
|
|
9367
|
-
import { z as
|
|
9604
|
+
import { join as join83 } from "path";
|
|
9605
|
+
import { z as z32 } from "zod/mini";
|
|
9368
9606
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
9369
9607
|
async function getIgnoreFile() {
|
|
9370
|
-
const ignoreFilePath =
|
|
9608
|
+
const ignoreFilePath = join83(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
9371
9609
|
try {
|
|
9372
9610
|
const content = await readFileContent(ignoreFilePath);
|
|
9373
9611
|
return {
|
|
@@ -9381,7 +9619,7 @@ async function getIgnoreFile() {
|
|
|
9381
9619
|
}
|
|
9382
9620
|
}
|
|
9383
9621
|
async function putIgnoreFile({ content }) {
|
|
9384
|
-
const ignoreFilePath =
|
|
9622
|
+
const ignoreFilePath = join83(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
9385
9623
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
9386
9624
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
9387
9625
|
throw new Error(
|
|
@@ -9402,8 +9640,8 @@ async function putIgnoreFile({ content }) {
|
|
|
9402
9640
|
}
|
|
9403
9641
|
}
|
|
9404
9642
|
async function deleteIgnoreFile() {
|
|
9405
|
-
const aiignorePath =
|
|
9406
|
-
const legacyIgnorePath =
|
|
9643
|
+
const aiignorePath = join83(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
9644
|
+
const legacyIgnorePath = join83(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
9407
9645
|
try {
|
|
9408
9646
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
9409
9647
|
return {
|
|
@@ -9421,11 +9659,11 @@ async function deleteIgnoreFile() {
|
|
|
9421
9659
|
}
|
|
9422
9660
|
}
|
|
9423
9661
|
var ignoreToolSchemas = {
|
|
9424
|
-
getIgnoreFile:
|
|
9425
|
-
putIgnoreFile:
|
|
9426
|
-
content:
|
|
9662
|
+
getIgnoreFile: z32.object({}),
|
|
9663
|
+
putIgnoreFile: z32.object({
|
|
9664
|
+
content: z32.string()
|
|
9427
9665
|
}),
|
|
9428
|
-
deleteIgnoreFile:
|
|
9666
|
+
deleteIgnoreFile: z32.object({})
|
|
9429
9667
|
};
|
|
9430
9668
|
var ignoreTools = {
|
|
9431
9669
|
getIgnoreFile: {
|
|
@@ -9458,8 +9696,8 @@ var ignoreTools = {
|
|
|
9458
9696
|
};
|
|
9459
9697
|
|
|
9460
9698
|
// src/mcp/mcp.ts
|
|
9461
|
-
import { join as
|
|
9462
|
-
import { z as
|
|
9699
|
+
import { join as join84 } from "path";
|
|
9700
|
+
import { z as z33 } from "zod/mini";
|
|
9463
9701
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
9464
9702
|
async function getMcpFile() {
|
|
9465
9703
|
const config = await ConfigResolver.resolve({});
|
|
@@ -9468,7 +9706,7 @@ async function getMcpFile() {
|
|
|
9468
9706
|
validate: true,
|
|
9469
9707
|
modularMcp: config.getModularMcp()
|
|
9470
9708
|
});
|
|
9471
|
-
const relativePathFromCwd =
|
|
9709
|
+
const relativePathFromCwd = join84(
|
|
9472
9710
|
rulesyncMcp.getRelativeDirPath(),
|
|
9473
9711
|
rulesyncMcp.getRelativeFilePath()
|
|
9474
9712
|
);
|
|
@@ -9501,7 +9739,7 @@ async function putMcpFile({ content }) {
|
|
|
9501
9739
|
const paths = RulesyncMcp.getSettablePaths();
|
|
9502
9740
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
9503
9741
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
9504
|
-
const fullPath =
|
|
9742
|
+
const fullPath = join84(baseDir, relativeDirPath, relativeFilePath);
|
|
9505
9743
|
const rulesyncMcp = new RulesyncMcp({
|
|
9506
9744
|
baseDir,
|
|
9507
9745
|
relativeDirPath,
|
|
@@ -9510,9 +9748,9 @@ async function putMcpFile({ content }) {
|
|
|
9510
9748
|
validate: true,
|
|
9511
9749
|
modularMcp: config.getModularMcp()
|
|
9512
9750
|
});
|
|
9513
|
-
await ensureDir(
|
|
9751
|
+
await ensureDir(join84(baseDir, relativeDirPath));
|
|
9514
9752
|
await writeFileContent(fullPath, content);
|
|
9515
|
-
const relativePathFromCwd =
|
|
9753
|
+
const relativePathFromCwd = join84(relativeDirPath, relativeFilePath);
|
|
9516
9754
|
return {
|
|
9517
9755
|
relativePathFromCwd,
|
|
9518
9756
|
content: rulesyncMcp.getFileContent()
|
|
@@ -9527,15 +9765,15 @@ async function deleteMcpFile() {
|
|
|
9527
9765
|
try {
|
|
9528
9766
|
const baseDir = process.cwd();
|
|
9529
9767
|
const paths = RulesyncMcp.getSettablePaths();
|
|
9530
|
-
const recommendedPath =
|
|
9768
|
+
const recommendedPath = join84(
|
|
9531
9769
|
baseDir,
|
|
9532
9770
|
paths.recommended.relativeDirPath,
|
|
9533
9771
|
paths.recommended.relativeFilePath
|
|
9534
9772
|
);
|
|
9535
|
-
const legacyPath =
|
|
9773
|
+
const legacyPath = join84(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
9536
9774
|
await removeFile(recommendedPath);
|
|
9537
9775
|
await removeFile(legacyPath);
|
|
9538
|
-
const relativePathFromCwd =
|
|
9776
|
+
const relativePathFromCwd = join84(
|
|
9539
9777
|
paths.recommended.relativeDirPath,
|
|
9540
9778
|
paths.recommended.relativeFilePath
|
|
9541
9779
|
);
|
|
@@ -9549,11 +9787,11 @@ async function deleteMcpFile() {
|
|
|
9549
9787
|
}
|
|
9550
9788
|
}
|
|
9551
9789
|
var mcpToolSchemas = {
|
|
9552
|
-
getMcpFile:
|
|
9553
|
-
putMcpFile:
|
|
9554
|
-
content:
|
|
9790
|
+
getMcpFile: z33.object({}),
|
|
9791
|
+
putMcpFile: z33.object({
|
|
9792
|
+
content: z33.string()
|
|
9555
9793
|
}),
|
|
9556
|
-
deleteMcpFile:
|
|
9794
|
+
deleteMcpFile: z33.object({})
|
|
9557
9795
|
};
|
|
9558
9796
|
var mcpTools = {
|
|
9559
9797
|
getMcpFile: {
|
|
@@ -9586,12 +9824,12 @@ var mcpTools = {
|
|
|
9586
9824
|
};
|
|
9587
9825
|
|
|
9588
9826
|
// src/mcp/rules.ts
|
|
9589
|
-
import { basename as
|
|
9590
|
-
import { z as
|
|
9827
|
+
import { basename as basename22, join as join85 } from "path";
|
|
9828
|
+
import { z as z34 } from "zod/mini";
|
|
9591
9829
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
9592
9830
|
var maxRulesCount = 1e3;
|
|
9593
9831
|
async function listRules() {
|
|
9594
|
-
const rulesDir =
|
|
9832
|
+
const rulesDir = join85(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
9595
9833
|
try {
|
|
9596
9834
|
const files = await listDirectoryFiles(rulesDir);
|
|
9597
9835
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -9604,7 +9842,7 @@ async function listRules() {
|
|
|
9604
9842
|
});
|
|
9605
9843
|
const frontmatter = rule.getFrontmatter();
|
|
9606
9844
|
return {
|
|
9607
|
-
relativePathFromCwd:
|
|
9845
|
+
relativePathFromCwd: join85(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
9608
9846
|
frontmatter
|
|
9609
9847
|
};
|
|
9610
9848
|
} catch (error) {
|
|
@@ -9624,14 +9862,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
9624
9862
|
relativePath: relativePathFromCwd,
|
|
9625
9863
|
intendedRootDir: process.cwd()
|
|
9626
9864
|
});
|
|
9627
|
-
const filename =
|
|
9865
|
+
const filename = basename22(relativePathFromCwd);
|
|
9628
9866
|
try {
|
|
9629
9867
|
const rule = await RulesyncRule.fromFile({
|
|
9630
9868
|
relativeFilePath: filename,
|
|
9631
9869
|
validate: true
|
|
9632
9870
|
});
|
|
9633
9871
|
return {
|
|
9634
|
-
relativePathFromCwd:
|
|
9872
|
+
relativePathFromCwd: join85(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
9635
9873
|
frontmatter: rule.getFrontmatter(),
|
|
9636
9874
|
body: rule.getBody()
|
|
9637
9875
|
};
|
|
@@ -9650,7 +9888,7 @@ async function putRule({
|
|
|
9650
9888
|
relativePath: relativePathFromCwd,
|
|
9651
9889
|
intendedRootDir: process.cwd()
|
|
9652
9890
|
});
|
|
9653
|
-
const filename =
|
|
9891
|
+
const filename = basename22(relativePathFromCwd);
|
|
9654
9892
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
9655
9893
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
9656
9894
|
throw new Error(
|
|
@@ -9660,7 +9898,7 @@ async function putRule({
|
|
|
9660
9898
|
try {
|
|
9661
9899
|
const existingRules = await listRules();
|
|
9662
9900
|
const isUpdate = existingRules.some(
|
|
9663
|
-
(rule2) => rule2.relativePathFromCwd ===
|
|
9901
|
+
(rule2) => rule2.relativePathFromCwd === join85(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
9664
9902
|
);
|
|
9665
9903
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
9666
9904
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -9673,11 +9911,11 @@ async function putRule({
|
|
|
9673
9911
|
body,
|
|
9674
9912
|
validate: true
|
|
9675
9913
|
});
|
|
9676
|
-
const rulesDir =
|
|
9914
|
+
const rulesDir = join85(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
9677
9915
|
await ensureDir(rulesDir);
|
|
9678
9916
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
9679
9917
|
return {
|
|
9680
|
-
relativePathFromCwd:
|
|
9918
|
+
relativePathFromCwd: join85(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
9681
9919
|
frontmatter: rule.getFrontmatter(),
|
|
9682
9920
|
body: rule.getBody()
|
|
9683
9921
|
};
|
|
@@ -9692,12 +9930,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
9692
9930
|
relativePath: relativePathFromCwd,
|
|
9693
9931
|
intendedRootDir: process.cwd()
|
|
9694
9932
|
});
|
|
9695
|
-
const filename =
|
|
9696
|
-
const fullPath =
|
|
9933
|
+
const filename = basename22(relativePathFromCwd);
|
|
9934
|
+
const fullPath = join85(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
9697
9935
|
try {
|
|
9698
9936
|
await removeFile(fullPath);
|
|
9699
9937
|
return {
|
|
9700
|
-
relativePathFromCwd:
|
|
9938
|
+
relativePathFromCwd: join85(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
9701
9939
|
};
|
|
9702
9940
|
} catch (error) {
|
|
9703
9941
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -9706,23 +9944,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
9706
9944
|
}
|
|
9707
9945
|
}
|
|
9708
9946
|
var ruleToolSchemas = {
|
|
9709
|
-
listRules:
|
|
9710
|
-
getRule:
|
|
9711
|
-
relativePathFromCwd:
|
|
9947
|
+
listRules: z34.object({}),
|
|
9948
|
+
getRule: z34.object({
|
|
9949
|
+
relativePathFromCwd: z34.string()
|
|
9712
9950
|
}),
|
|
9713
|
-
putRule:
|
|
9714
|
-
relativePathFromCwd:
|
|
9951
|
+
putRule: z34.object({
|
|
9952
|
+
relativePathFromCwd: z34.string(),
|
|
9715
9953
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
9716
|
-
body:
|
|
9954
|
+
body: z34.string()
|
|
9717
9955
|
}),
|
|
9718
|
-
deleteRule:
|
|
9719
|
-
relativePathFromCwd:
|
|
9956
|
+
deleteRule: z34.object({
|
|
9957
|
+
relativePathFromCwd: z34.string()
|
|
9720
9958
|
})
|
|
9721
9959
|
};
|
|
9722
9960
|
var ruleTools = {
|
|
9723
9961
|
listRules: {
|
|
9724
9962
|
name: "listRules",
|
|
9725
|
-
description: `List all rules from ${
|
|
9963
|
+
description: `List all rules from ${join85(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
9726
9964
|
parameters: ruleToolSchemas.listRules,
|
|
9727
9965
|
execute: async () => {
|
|
9728
9966
|
const rules = await listRules();
|
|
@@ -9764,12 +10002,12 @@ var ruleTools = {
|
|
|
9764
10002
|
};
|
|
9765
10003
|
|
|
9766
10004
|
// src/mcp/subagents.ts
|
|
9767
|
-
import { basename as
|
|
9768
|
-
import { z as
|
|
10005
|
+
import { basename as basename23, join as join86 } from "path";
|
|
10006
|
+
import { z as z35 } from "zod/mini";
|
|
9769
10007
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
9770
10008
|
var maxSubagentsCount = 1e3;
|
|
9771
10009
|
async function listSubagents() {
|
|
9772
|
-
const subagentsDir =
|
|
10010
|
+
const subagentsDir = join86(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
9773
10011
|
try {
|
|
9774
10012
|
const files = await listDirectoryFiles(subagentsDir);
|
|
9775
10013
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -9782,7 +10020,7 @@ async function listSubagents() {
|
|
|
9782
10020
|
});
|
|
9783
10021
|
const frontmatter = subagent.getFrontmatter();
|
|
9784
10022
|
return {
|
|
9785
|
-
relativePathFromCwd:
|
|
10023
|
+
relativePathFromCwd: join86(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
9786
10024
|
frontmatter
|
|
9787
10025
|
};
|
|
9788
10026
|
} catch (error) {
|
|
@@ -9804,14 +10042,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
9804
10042
|
relativePath: relativePathFromCwd,
|
|
9805
10043
|
intendedRootDir: process.cwd()
|
|
9806
10044
|
});
|
|
9807
|
-
const filename =
|
|
10045
|
+
const filename = basename23(relativePathFromCwd);
|
|
9808
10046
|
try {
|
|
9809
10047
|
const subagent = await RulesyncSubagent.fromFile({
|
|
9810
10048
|
relativeFilePath: filename,
|
|
9811
10049
|
validate: true
|
|
9812
10050
|
});
|
|
9813
10051
|
return {
|
|
9814
|
-
relativePathFromCwd:
|
|
10052
|
+
relativePathFromCwd: join86(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
9815
10053
|
frontmatter: subagent.getFrontmatter(),
|
|
9816
10054
|
body: subagent.getBody()
|
|
9817
10055
|
};
|
|
@@ -9830,7 +10068,7 @@ async function putSubagent({
|
|
|
9830
10068
|
relativePath: relativePathFromCwd,
|
|
9831
10069
|
intendedRootDir: process.cwd()
|
|
9832
10070
|
});
|
|
9833
|
-
const filename =
|
|
10071
|
+
const filename = basename23(relativePathFromCwd);
|
|
9834
10072
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
9835
10073
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
9836
10074
|
throw new Error(
|
|
@@ -9840,7 +10078,7 @@ async function putSubagent({
|
|
|
9840
10078
|
try {
|
|
9841
10079
|
const existingSubagents = await listSubagents();
|
|
9842
10080
|
const isUpdate = existingSubagents.some(
|
|
9843
|
-
(subagent2) => subagent2.relativePathFromCwd ===
|
|
10081
|
+
(subagent2) => subagent2.relativePathFromCwd === join86(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
9844
10082
|
);
|
|
9845
10083
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
9846
10084
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -9853,11 +10091,11 @@ async function putSubagent({
|
|
|
9853
10091
|
body,
|
|
9854
10092
|
validate: true
|
|
9855
10093
|
});
|
|
9856
|
-
const subagentsDir =
|
|
10094
|
+
const subagentsDir = join86(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
9857
10095
|
await ensureDir(subagentsDir);
|
|
9858
10096
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
9859
10097
|
return {
|
|
9860
|
-
relativePathFromCwd:
|
|
10098
|
+
relativePathFromCwd: join86(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
9861
10099
|
frontmatter: subagent.getFrontmatter(),
|
|
9862
10100
|
body: subagent.getBody()
|
|
9863
10101
|
};
|
|
@@ -9872,12 +10110,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
9872
10110
|
relativePath: relativePathFromCwd,
|
|
9873
10111
|
intendedRootDir: process.cwd()
|
|
9874
10112
|
});
|
|
9875
|
-
const filename =
|
|
9876
|
-
const fullPath =
|
|
10113
|
+
const filename = basename23(relativePathFromCwd);
|
|
10114
|
+
const fullPath = join86(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
9877
10115
|
try {
|
|
9878
10116
|
await removeFile(fullPath);
|
|
9879
10117
|
return {
|
|
9880
|
-
relativePathFromCwd:
|
|
10118
|
+
relativePathFromCwd: join86(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
9881
10119
|
};
|
|
9882
10120
|
} catch (error) {
|
|
9883
10121
|
throw new Error(
|
|
@@ -9889,23 +10127,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
9889
10127
|
}
|
|
9890
10128
|
}
|
|
9891
10129
|
var subagentToolSchemas = {
|
|
9892
|
-
listSubagents:
|
|
9893
|
-
getSubagent:
|
|
9894
|
-
relativePathFromCwd:
|
|
10130
|
+
listSubagents: z35.object({}),
|
|
10131
|
+
getSubagent: z35.object({
|
|
10132
|
+
relativePathFromCwd: z35.string()
|
|
9895
10133
|
}),
|
|
9896
|
-
putSubagent:
|
|
9897
|
-
relativePathFromCwd:
|
|
10134
|
+
putSubagent: z35.object({
|
|
10135
|
+
relativePathFromCwd: z35.string(),
|
|
9898
10136
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
9899
|
-
body:
|
|
10137
|
+
body: z35.string()
|
|
9900
10138
|
}),
|
|
9901
|
-
deleteSubagent:
|
|
9902
|
-
relativePathFromCwd:
|
|
10139
|
+
deleteSubagent: z35.object({
|
|
10140
|
+
relativePathFromCwd: z35.string()
|
|
9903
10141
|
})
|
|
9904
10142
|
};
|
|
9905
10143
|
var subagentTools = {
|
|
9906
10144
|
listSubagents: {
|
|
9907
10145
|
name: "listSubagents",
|
|
9908
|
-
description: `List all subagents from ${
|
|
10146
|
+
description: `List all subagents from ${join86(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
9909
10147
|
parameters: subagentToolSchemas.listSubagents,
|
|
9910
10148
|
execute: async () => {
|
|
9911
10149
|
const subagents = await listSubagents();
|
|
@@ -9979,7 +10217,7 @@ async function mcpCommand({ version }) {
|
|
|
9979
10217
|
}
|
|
9980
10218
|
|
|
9981
10219
|
// src/cli/index.ts
|
|
9982
|
-
var getVersion = () => "3.
|
|
10220
|
+
var getVersion = () => "3.28.1";
|
|
9983
10221
|
var main = async () => {
|
|
9984
10222
|
const program = new Command();
|
|
9985
10223
|
const version = getVersion();
|