rulesync 7.13.0 → 7.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/{chunk-JGRHJWG5.js → chunk-L5AQUWUM.js} +871 -434
- package/dist/cli/index.cjs +1451 -715
- package/dist/cli/index.js +380 -77
- package/dist/index.cjs +1044 -627
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -38,7 +38,7 @@ __export(index_exports, {
|
|
|
38
38
|
module.exports = __toCommonJS(index_exports);
|
|
39
39
|
|
|
40
40
|
// src/config/config-resolver.ts
|
|
41
|
-
var
|
|
41
|
+
var import_node_path4 = require("path");
|
|
42
42
|
var import_jsonc_parser = require("jsonc-parser");
|
|
43
43
|
|
|
44
44
|
// src/constants/rulesync-paths.ts
|
|
@@ -90,7 +90,9 @@ var import_globby = require("globby");
|
|
|
90
90
|
var import_consola = require("consola");
|
|
91
91
|
|
|
92
92
|
// src/utils/vitest.ts
|
|
93
|
-
|
|
93
|
+
function isEnvTest() {
|
|
94
|
+
return process.env.NODE_ENV === "test";
|
|
95
|
+
}
|
|
94
96
|
|
|
95
97
|
// src/utils/logger.ts
|
|
96
98
|
var Logger = class {
|
|
@@ -120,27 +122,27 @@ var Logger = class {
|
|
|
120
122
|
return this._silent;
|
|
121
123
|
}
|
|
122
124
|
info(message, ...args) {
|
|
123
|
-
if (isEnvTest || this._silent) return;
|
|
125
|
+
if (isEnvTest() || this._silent) return;
|
|
124
126
|
this.console.info(message, ...args);
|
|
125
127
|
}
|
|
126
128
|
// Success (always shown unless silent)
|
|
127
129
|
success(message, ...args) {
|
|
128
|
-
if (isEnvTest || this._silent) return;
|
|
130
|
+
if (isEnvTest() || this._silent) return;
|
|
129
131
|
this.console.success(message, ...args);
|
|
130
132
|
}
|
|
131
133
|
// Warning (always shown unless silent)
|
|
132
134
|
warn(message, ...args) {
|
|
133
|
-
if (isEnvTest || this._silent) return;
|
|
135
|
+
if (isEnvTest() || this._silent) return;
|
|
134
136
|
this.console.warn(message, ...args);
|
|
135
137
|
}
|
|
136
138
|
// Error (always shown, even in silent mode)
|
|
137
139
|
error(message, ...args) {
|
|
138
|
-
if (isEnvTest) return;
|
|
140
|
+
if (isEnvTest()) return;
|
|
139
141
|
this.console.error(message, ...args);
|
|
140
142
|
}
|
|
141
143
|
// Debug level (shown only in verbose mode)
|
|
142
144
|
debug(message, ...args) {
|
|
143
|
-
if (isEnvTest || this._silent) return;
|
|
145
|
+
if (isEnvTest() || this._silent) return;
|
|
144
146
|
if (this._verbose) {
|
|
145
147
|
this.console.info(message, ...args);
|
|
146
148
|
}
|
|
@@ -268,8 +270,14 @@ async function removeFile(filepath) {
|
|
|
268
270
|
}
|
|
269
271
|
}
|
|
270
272
|
function getHomeDirectory() {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
+
const homeDirFromEnv = process.env.HOME_DIR;
|
|
274
|
+
if (homeDirFromEnv) {
|
|
275
|
+
return homeDirFromEnv;
|
|
276
|
+
}
|
|
277
|
+
if (isEnvTest()) {
|
|
278
|
+
throw new Error(
|
|
279
|
+
"getHomeDirectory() must be mocked in test environment, or set HOME_DIR environment variable"
|
|
280
|
+
);
|
|
273
281
|
}
|
|
274
282
|
return import_node_os.default.homedir();
|
|
275
283
|
}
|
|
@@ -288,6 +296,7 @@ function toKebabCaseFilename(filename) {
|
|
|
288
296
|
}
|
|
289
297
|
|
|
290
298
|
// src/config/config.ts
|
|
299
|
+
var import_node_path3 = require("path");
|
|
291
300
|
var import_mini3 = require("zod/mini");
|
|
292
301
|
|
|
293
302
|
// src/types/features.ts
|
|
@@ -343,9 +352,30 @@ var ToolTargetsSchema = import_mini2.z.array(ToolTargetSchema);
|
|
|
343
352
|
var RulesyncTargetsSchema = import_mini2.z.array(import_mini2.z.enum(ALL_TOOL_TARGETS_WITH_WILDCARD));
|
|
344
353
|
|
|
345
354
|
// src/config/config.ts
|
|
355
|
+
function hasControlCharacters(value) {
|
|
356
|
+
for (let i = 0; i < value.length; i++) {
|
|
357
|
+
const code = value.charCodeAt(i);
|
|
358
|
+
if (code >= 0 && code <= 31 || code === 127) return true;
|
|
359
|
+
}
|
|
360
|
+
return false;
|
|
361
|
+
}
|
|
346
362
|
var SourceEntrySchema = import_mini3.z.object({
|
|
347
363
|
source: import_mini3.z.string().check((0, import_mini3.minLength)(1, "source must be a non-empty string")),
|
|
348
|
-
skills: (0, import_mini3.optional)(import_mini3.z.array(import_mini3.z.string()))
|
|
364
|
+
skills: (0, import_mini3.optional)(import_mini3.z.array(import_mini3.z.string())),
|
|
365
|
+
transport: (0, import_mini3.optional)(import_mini3.z.enum(["github", "git"])),
|
|
366
|
+
ref: (0, import_mini3.optional)(
|
|
367
|
+
import_mini3.z.string().check(
|
|
368
|
+
(0, import_mini3.refine)((v) => !v.startsWith("-"), 'ref must not start with "-"'),
|
|
369
|
+
(0, import_mini3.refine)((v) => !hasControlCharacters(v), "ref must not contain control characters")
|
|
370
|
+
)
|
|
371
|
+
),
|
|
372
|
+
path: (0, import_mini3.optional)(
|
|
373
|
+
import_mini3.z.string().check(
|
|
374
|
+
(0, import_mini3.refine)((v) => !v.includes(".."), 'path must not contain ".."'),
|
|
375
|
+
(0, import_mini3.refine)((v) => !(0, import_node_path3.isAbsolute)(v), "path must not be absolute"),
|
|
376
|
+
(0, import_mini3.refine)((v) => !hasControlCharacters(v), "path must not contain control characters")
|
|
377
|
+
)
|
|
378
|
+
)
|
|
349
379
|
});
|
|
350
380
|
var ConfigParamsSchema = import_mini3.z.object({
|
|
351
381
|
baseDirs: import_mini3.z.array(import_mini3.z.string()),
|
|
@@ -590,8 +620,8 @@ var ConfigResolver = class {
|
|
|
590
620
|
}) {
|
|
591
621
|
const validatedConfigPath = resolvePath(configPath, process.cwd());
|
|
592
622
|
const baseConfig = await loadConfigFromFile(validatedConfigPath);
|
|
593
|
-
const configDir = (0,
|
|
594
|
-
const localConfigPath = (0,
|
|
623
|
+
const configDir = (0, import_node_path4.dirname)(validatedConfigPath);
|
|
624
|
+
const localConfigPath = (0, import_node_path4.join)(configDir, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH);
|
|
595
625
|
const localConfig = await loadConfigFromFile(localConfigPath);
|
|
596
626
|
const configByFile = mergeConfigs(baseConfig, localConfig);
|
|
597
627
|
const resolvedGlobal = global ?? configByFile.global ?? getDefaults().global;
|
|
@@ -626,7 +656,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
626
656
|
if (global) {
|
|
627
657
|
return [getHomeDirectory()];
|
|
628
658
|
}
|
|
629
|
-
const resolvedBaseDirs = baseDirs.map((baseDir) => (0,
|
|
659
|
+
const resolvedBaseDirs = baseDirs.map((baseDir) => (0, import_node_path4.resolve)(baseDir));
|
|
630
660
|
resolvedBaseDirs.forEach((baseDir) => {
|
|
631
661
|
validateBaseDir(baseDir);
|
|
632
662
|
});
|
|
@@ -634,11 +664,11 @@ function getBaseDirsInLightOfGlobal({
|
|
|
634
664
|
}
|
|
635
665
|
|
|
636
666
|
// src/lib/generate.ts
|
|
637
|
-
var
|
|
667
|
+
var import_node_path118 = require("path");
|
|
638
668
|
var import_es_toolkit4 = require("es-toolkit");
|
|
639
669
|
|
|
640
670
|
// src/features/commands/commands-processor.ts
|
|
641
|
-
var
|
|
671
|
+
var import_node_path21 = require("path");
|
|
642
672
|
var import_mini13 = require("zod/mini");
|
|
643
673
|
|
|
644
674
|
// src/types/feature-processor.ts
|
|
@@ -704,7 +734,7 @@ var FeatureProcessor = class {
|
|
|
704
734
|
};
|
|
705
735
|
|
|
706
736
|
// src/features/commands/agentsmd-command.ts
|
|
707
|
-
var
|
|
737
|
+
var import_node_path7 = require("path");
|
|
708
738
|
|
|
709
739
|
// src/utils/frontmatter.ts
|
|
710
740
|
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
@@ -770,11 +800,11 @@ function parseFrontmatter(content, filePath) {
|
|
|
770
800
|
}
|
|
771
801
|
|
|
772
802
|
// src/features/commands/simulated-command.ts
|
|
773
|
-
var
|
|
803
|
+
var import_node_path6 = require("path");
|
|
774
804
|
var import_mini4 = require("zod/mini");
|
|
775
805
|
|
|
776
806
|
// src/types/ai-file.ts
|
|
777
|
-
var
|
|
807
|
+
var import_node_path5 = __toESM(require("path"), 1);
|
|
778
808
|
var AiFile = class {
|
|
779
809
|
/**
|
|
780
810
|
* @example "."
|
|
@@ -822,11 +852,11 @@ var AiFile = class {
|
|
|
822
852
|
return this.relativeFilePath;
|
|
823
853
|
}
|
|
824
854
|
getFilePath() {
|
|
825
|
-
const fullPath =
|
|
826
|
-
const resolvedFull = (0,
|
|
827
|
-
const resolvedBase = (0,
|
|
828
|
-
const rel = (0,
|
|
829
|
-
if (rel.startsWith("..") ||
|
|
855
|
+
const fullPath = import_node_path5.default.join(this.baseDir, this.relativeDirPath, this.relativeFilePath);
|
|
856
|
+
const resolvedFull = (0, import_node_path5.resolve)(fullPath);
|
|
857
|
+
const resolvedBase = (0, import_node_path5.resolve)(this.baseDir);
|
|
858
|
+
const rel = (0, import_node_path5.relative)(resolvedBase, resolvedFull);
|
|
859
|
+
if (rel.startsWith("..") || import_node_path5.default.isAbsolute(rel)) {
|
|
830
860
|
throw new Error(
|
|
831
861
|
`Path traversal detected: Final path escapes baseDir. baseDir="${this.baseDir}", relativeDirPath="${this.relativeDirPath}", relativeFilePath="${this.relativeFilePath}"`
|
|
832
862
|
);
|
|
@@ -837,7 +867,7 @@ var AiFile = class {
|
|
|
837
867
|
return this.fileContent;
|
|
838
868
|
}
|
|
839
869
|
getRelativePathFromCwd() {
|
|
840
|
-
return
|
|
870
|
+
return import_node_path5.default.join(this.relativeDirPath, this.relativeFilePath);
|
|
841
871
|
}
|
|
842
872
|
setFileContent(newFileContent) {
|
|
843
873
|
this.fileContent = newFileContent;
|
|
@@ -944,7 +974,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
944
974
|
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
945
975
|
if (!result.success) {
|
|
946
976
|
throw new Error(
|
|
947
|
-
`Invalid frontmatter in ${(0,
|
|
977
|
+
`Invalid frontmatter in ${(0, import_node_path6.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
948
978
|
);
|
|
949
979
|
}
|
|
950
980
|
}
|
|
@@ -994,7 +1024,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
994
1024
|
return {
|
|
995
1025
|
success: false,
|
|
996
1026
|
error: new Error(
|
|
997
|
-
`Invalid frontmatter in ${(0,
|
|
1027
|
+
`Invalid frontmatter in ${(0, import_node_path6.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
998
1028
|
)
|
|
999
1029
|
};
|
|
1000
1030
|
}
|
|
@@ -1004,7 +1034,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
1004
1034
|
relativeFilePath,
|
|
1005
1035
|
validate = true
|
|
1006
1036
|
}) {
|
|
1007
|
-
const filePath = (0,
|
|
1037
|
+
const filePath = (0, import_node_path6.join)(
|
|
1008
1038
|
baseDir,
|
|
1009
1039
|
_SimulatedCommand.getSettablePaths().relativeDirPath,
|
|
1010
1040
|
relativeFilePath
|
|
@@ -1044,7 +1074,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
1044
1074
|
var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
1045
1075
|
static getSettablePaths() {
|
|
1046
1076
|
return {
|
|
1047
|
-
relativeDirPath: (0,
|
|
1077
|
+
relativeDirPath: (0, import_node_path7.join)(".agents", "commands")
|
|
1048
1078
|
};
|
|
1049
1079
|
}
|
|
1050
1080
|
static fromRulesyncCommand({
|
|
@@ -1061,7 +1091,7 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
1061
1091
|
relativeFilePath,
|
|
1062
1092
|
validate = true
|
|
1063
1093
|
}) {
|
|
1064
|
-
const filePath = (0,
|
|
1094
|
+
const filePath = (0, import_node_path7.join)(
|
|
1065
1095
|
baseDir,
|
|
1066
1096
|
_AgentsmdCommand.getSettablePaths().relativeDirPath,
|
|
1067
1097
|
relativeFilePath
|
|
@@ -1099,7 +1129,7 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
1099
1129
|
};
|
|
1100
1130
|
|
|
1101
1131
|
// src/features/commands/antigravity-command.ts
|
|
1102
|
-
var
|
|
1132
|
+
var import_node_path9 = require("path");
|
|
1103
1133
|
var import_mini6 = require("zod/mini");
|
|
1104
1134
|
|
|
1105
1135
|
// src/utils/type-guards.ts
|
|
@@ -1108,7 +1138,7 @@ function isRecord(value) {
|
|
|
1108
1138
|
}
|
|
1109
1139
|
|
|
1110
1140
|
// src/features/commands/rulesync-command.ts
|
|
1111
|
-
var
|
|
1141
|
+
var import_node_path8 = require("path");
|
|
1112
1142
|
var import_mini5 = require("zod/mini");
|
|
1113
1143
|
|
|
1114
1144
|
// src/types/rulesync-file.ts
|
|
@@ -1130,7 +1160,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
1130
1160
|
const parseResult = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1131
1161
|
if (!parseResult.success && rest.validate) {
|
|
1132
1162
|
throw new Error(
|
|
1133
|
-
`Invalid frontmatter in ${(0,
|
|
1163
|
+
`Invalid frontmatter in ${(0, import_node_path8.join)(rest.baseDir ?? process.cwd(), rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
1134
1164
|
);
|
|
1135
1165
|
}
|
|
1136
1166
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -1173,7 +1203,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
1173
1203
|
return {
|
|
1174
1204
|
success: false,
|
|
1175
1205
|
error: new Error(
|
|
1176
|
-
`Invalid frontmatter in ${(0,
|
|
1206
|
+
`Invalid frontmatter in ${(0, import_node_path8.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1177
1207
|
)
|
|
1178
1208
|
};
|
|
1179
1209
|
}
|
|
@@ -1181,7 +1211,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
1181
1211
|
static async fromFile({
|
|
1182
1212
|
relativeFilePath
|
|
1183
1213
|
}) {
|
|
1184
|
-
const filePath = (0,
|
|
1214
|
+
const filePath = (0, import_node_path8.join)(
|
|
1185
1215
|
process.cwd(),
|
|
1186
1216
|
_RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
1187
1217
|
relativeFilePath
|
|
@@ -1218,7 +1248,7 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1218
1248
|
body;
|
|
1219
1249
|
static getSettablePaths() {
|
|
1220
1250
|
return {
|
|
1221
|
-
relativeDirPath: (0,
|
|
1251
|
+
relativeDirPath: (0, import_node_path9.join)(".agent", "workflows")
|
|
1222
1252
|
};
|
|
1223
1253
|
}
|
|
1224
1254
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -1226,7 +1256,7 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1226
1256
|
const result = AntigravityCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1227
1257
|
if (!result.success) {
|
|
1228
1258
|
throw new Error(
|
|
1229
|
-
`Invalid frontmatter in ${(0,
|
|
1259
|
+
`Invalid frontmatter in ${(0, import_node_path9.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1230
1260
|
);
|
|
1231
1261
|
}
|
|
1232
1262
|
}
|
|
@@ -1310,7 +1340,7 @@ ${body}${turboDirective}`;
|
|
|
1310
1340
|
const antigravityTrigger = antigravityConfig && typeof antigravityConfig.trigger === "string" ? antigravityConfig.trigger : void 0;
|
|
1311
1341
|
const rootTrigger = typeof rulesyncFrontmatter.trigger === "string" ? rulesyncFrontmatter.trigger : void 0;
|
|
1312
1342
|
const bodyTriggerMatch = rulesyncCommand.getBody().match(/trigger:\s*(\/[\w-]+)/);
|
|
1313
|
-
const filenameTrigger = `/${(0,
|
|
1343
|
+
const filenameTrigger = `/${(0, import_node_path9.basename)(rulesyncCommand.getRelativeFilePath(), ".md")}`;
|
|
1314
1344
|
return antigravityTrigger || rootTrigger || (bodyTriggerMatch ? bodyTriggerMatch[1] : void 0) || filenameTrigger;
|
|
1315
1345
|
}
|
|
1316
1346
|
validate() {
|
|
@@ -1324,7 +1354,7 @@ ${body}${turboDirective}`;
|
|
|
1324
1354
|
return {
|
|
1325
1355
|
success: false,
|
|
1326
1356
|
error: new Error(
|
|
1327
|
-
`Invalid frontmatter in ${(0,
|
|
1357
|
+
`Invalid frontmatter in ${(0, import_node_path9.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1328
1358
|
)
|
|
1329
1359
|
};
|
|
1330
1360
|
}
|
|
@@ -1340,7 +1370,7 @@ ${body}${turboDirective}`;
|
|
|
1340
1370
|
relativeFilePath,
|
|
1341
1371
|
validate = true
|
|
1342
1372
|
}) {
|
|
1343
|
-
const filePath = (0,
|
|
1373
|
+
const filePath = (0, import_node_path9.join)(
|
|
1344
1374
|
baseDir,
|
|
1345
1375
|
_AntigravityCommand.getSettablePaths().relativeDirPath,
|
|
1346
1376
|
relativeFilePath
|
|
@@ -1379,7 +1409,7 @@ ${body}${turboDirective}`;
|
|
|
1379
1409
|
};
|
|
1380
1410
|
|
|
1381
1411
|
// src/features/commands/claudecode-command.ts
|
|
1382
|
-
var
|
|
1412
|
+
var import_node_path10 = require("path");
|
|
1383
1413
|
var import_mini7 = require("zod/mini");
|
|
1384
1414
|
var ClaudecodeCommandFrontmatterSchema = import_mini7.z.looseObject({
|
|
1385
1415
|
description: import_mini7.z.optional(import_mini7.z.string()),
|
|
@@ -1396,7 +1426,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1396
1426
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1397
1427
|
if (!result.success) {
|
|
1398
1428
|
throw new Error(
|
|
1399
|
-
`Invalid frontmatter in ${(0,
|
|
1429
|
+
`Invalid frontmatter in ${(0, import_node_path10.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1400
1430
|
);
|
|
1401
1431
|
}
|
|
1402
1432
|
}
|
|
@@ -1409,7 +1439,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1409
1439
|
}
|
|
1410
1440
|
static getSettablePaths(_options = {}) {
|
|
1411
1441
|
return {
|
|
1412
|
-
relativeDirPath: (0,
|
|
1442
|
+
relativeDirPath: (0, import_node_path10.join)(".claude", "commands")
|
|
1413
1443
|
};
|
|
1414
1444
|
}
|
|
1415
1445
|
getBody() {
|
|
@@ -1472,7 +1502,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1472
1502
|
return {
|
|
1473
1503
|
success: false,
|
|
1474
1504
|
error: new Error(
|
|
1475
|
-
`Invalid frontmatter in ${(0,
|
|
1505
|
+
`Invalid frontmatter in ${(0, import_node_path10.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1476
1506
|
)
|
|
1477
1507
|
};
|
|
1478
1508
|
}
|
|
@@ -1490,7 +1520,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1490
1520
|
global = false
|
|
1491
1521
|
}) {
|
|
1492
1522
|
const paths = this.getSettablePaths({ global });
|
|
1493
|
-
const filePath = (0,
|
|
1523
|
+
const filePath = (0, import_node_path10.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1494
1524
|
const fileContent = await readFileContent(filePath);
|
|
1495
1525
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1496
1526
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1523,16 +1553,16 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1523
1553
|
};
|
|
1524
1554
|
|
|
1525
1555
|
// src/features/commands/cline-command.ts
|
|
1526
|
-
var
|
|
1556
|
+
var import_node_path11 = require("path");
|
|
1527
1557
|
var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
1528
1558
|
static getSettablePaths({ global } = {}) {
|
|
1529
1559
|
if (global) {
|
|
1530
1560
|
return {
|
|
1531
|
-
relativeDirPath: (0,
|
|
1561
|
+
relativeDirPath: (0, import_node_path11.join)("Documents", "Cline", "Workflows")
|
|
1532
1562
|
};
|
|
1533
1563
|
}
|
|
1534
1564
|
return {
|
|
1535
|
-
relativeDirPath: (0,
|
|
1565
|
+
relativeDirPath: (0, import_node_path11.join)(".clinerules", "workflows")
|
|
1536
1566
|
};
|
|
1537
1567
|
}
|
|
1538
1568
|
toRulesyncCommand() {
|
|
@@ -1583,7 +1613,7 @@ var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
|
1583
1613
|
global = false
|
|
1584
1614
|
}) {
|
|
1585
1615
|
const paths = this.getSettablePaths({ global });
|
|
1586
|
-
const filePath = (0,
|
|
1616
|
+
const filePath = (0, import_node_path11.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1587
1617
|
const fileContent = await readFileContent(filePath);
|
|
1588
1618
|
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
1589
1619
|
return new _ClineCommand({
|
|
@@ -1610,14 +1640,14 @@ var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
|
1610
1640
|
};
|
|
1611
1641
|
|
|
1612
1642
|
// src/features/commands/codexcli-command.ts
|
|
1613
|
-
var
|
|
1643
|
+
var import_node_path12 = require("path");
|
|
1614
1644
|
var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
1615
1645
|
static getSettablePaths({ global } = {}) {
|
|
1616
1646
|
if (!global) {
|
|
1617
1647
|
throw new Error("CodexcliCommand only supports global mode. Please pass { global: true }.");
|
|
1618
1648
|
}
|
|
1619
1649
|
return {
|
|
1620
|
-
relativeDirPath: (0,
|
|
1650
|
+
relativeDirPath: (0, import_node_path12.join)(".codex", "prompts")
|
|
1621
1651
|
};
|
|
1622
1652
|
}
|
|
1623
1653
|
toRulesyncCommand() {
|
|
@@ -1669,7 +1699,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1669
1699
|
global = false
|
|
1670
1700
|
}) {
|
|
1671
1701
|
const paths = this.getSettablePaths({ global });
|
|
1672
|
-
const filePath = (0,
|
|
1702
|
+
const filePath = (0, import_node_path12.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1673
1703
|
const fileContent = await readFileContent(filePath);
|
|
1674
1704
|
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
1675
1705
|
return new _CodexcliCommand({
|
|
@@ -1696,7 +1726,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1696
1726
|
};
|
|
1697
1727
|
|
|
1698
1728
|
// src/features/commands/copilot-command.ts
|
|
1699
|
-
var
|
|
1729
|
+
var import_node_path13 = require("path");
|
|
1700
1730
|
var import_mini8 = require("zod/mini");
|
|
1701
1731
|
var CopilotCommandFrontmatterSchema = import_mini8.z.looseObject({
|
|
1702
1732
|
mode: import_mini8.z.optional(import_mini8.z.string()),
|
|
@@ -1710,7 +1740,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1710
1740
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1711
1741
|
if (!result.success) {
|
|
1712
1742
|
throw new Error(
|
|
1713
|
-
`Invalid frontmatter in ${(0,
|
|
1743
|
+
`Invalid frontmatter in ${(0, import_node_path13.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1714
1744
|
);
|
|
1715
1745
|
}
|
|
1716
1746
|
}
|
|
@@ -1723,7 +1753,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1723
1753
|
}
|
|
1724
1754
|
static getSettablePaths() {
|
|
1725
1755
|
return {
|
|
1726
|
-
relativeDirPath: (0,
|
|
1756
|
+
relativeDirPath: (0, import_node_path13.join)(".github", "prompts")
|
|
1727
1757
|
};
|
|
1728
1758
|
}
|
|
1729
1759
|
getBody() {
|
|
@@ -1763,7 +1793,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1763
1793
|
return {
|
|
1764
1794
|
success: false,
|
|
1765
1795
|
error: new Error(
|
|
1766
|
-
`Invalid frontmatter in ${(0,
|
|
1796
|
+
`Invalid frontmatter in ${(0, import_node_path13.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1767
1797
|
)
|
|
1768
1798
|
};
|
|
1769
1799
|
}
|
|
@@ -1798,7 +1828,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1798
1828
|
validate = true
|
|
1799
1829
|
}) {
|
|
1800
1830
|
const paths = this.getSettablePaths();
|
|
1801
|
-
const filePath = (0,
|
|
1831
|
+
const filePath = (0, import_node_path13.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1802
1832
|
const fileContent = await readFileContent(filePath);
|
|
1803
1833
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1804
1834
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1837,7 +1867,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1837
1867
|
};
|
|
1838
1868
|
|
|
1839
1869
|
// src/features/commands/cursor-command.ts
|
|
1840
|
-
var
|
|
1870
|
+
var import_node_path14 = require("path");
|
|
1841
1871
|
var import_mini9 = require("zod/mini");
|
|
1842
1872
|
var CursorCommandFrontmatterSchema = import_mini9.z.looseObject({
|
|
1843
1873
|
description: import_mini9.z.optional(import_mini9.z.string()),
|
|
@@ -1860,7 +1890,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1860
1890
|
const result = CursorCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1861
1891
|
if (!result.success) {
|
|
1862
1892
|
throw new Error(
|
|
1863
|
-
`Invalid frontmatter in ${(0,
|
|
1893
|
+
`Invalid frontmatter in ${(0, import_node_path14.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1864
1894
|
);
|
|
1865
1895
|
}
|
|
1866
1896
|
}
|
|
@@ -1873,7 +1903,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1873
1903
|
}
|
|
1874
1904
|
static getSettablePaths(_options = {}) {
|
|
1875
1905
|
return {
|
|
1876
|
-
relativeDirPath: (0,
|
|
1906
|
+
relativeDirPath: (0, import_node_path14.join)(".cursor", "commands")
|
|
1877
1907
|
};
|
|
1878
1908
|
}
|
|
1879
1909
|
getBody() {
|
|
@@ -1936,7 +1966,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1936
1966
|
return {
|
|
1937
1967
|
success: false,
|
|
1938
1968
|
error: new Error(
|
|
1939
|
-
`Invalid frontmatter in ${(0,
|
|
1969
|
+
`Invalid frontmatter in ${(0, import_node_path14.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1940
1970
|
)
|
|
1941
1971
|
};
|
|
1942
1972
|
}
|
|
@@ -1954,7 +1984,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1954
1984
|
global = false
|
|
1955
1985
|
}) {
|
|
1956
1986
|
const paths = this.getSettablePaths({ global });
|
|
1957
|
-
const filePath = (0,
|
|
1987
|
+
const filePath = (0, import_node_path14.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1958
1988
|
const fileContent = await readFileContent(filePath);
|
|
1959
1989
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
1960
1990
|
const result = CursorCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1987,11 +2017,11 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1987
2017
|
};
|
|
1988
2018
|
|
|
1989
2019
|
// src/features/commands/factorydroid-command.ts
|
|
1990
|
-
var
|
|
2020
|
+
var import_node_path15 = require("path");
|
|
1991
2021
|
var FactorydroidCommand = class _FactorydroidCommand extends SimulatedCommand {
|
|
1992
2022
|
static getSettablePaths(_options) {
|
|
1993
2023
|
return {
|
|
1994
|
-
relativeDirPath: (0,
|
|
2024
|
+
relativeDirPath: (0, import_node_path15.join)(".factory", "commands")
|
|
1995
2025
|
};
|
|
1996
2026
|
}
|
|
1997
2027
|
static fromRulesyncCommand({
|
|
@@ -2011,7 +2041,7 @@ var FactorydroidCommand = class _FactorydroidCommand extends SimulatedCommand {
|
|
|
2011
2041
|
global = false
|
|
2012
2042
|
}) {
|
|
2013
2043
|
const paths = _FactorydroidCommand.getSettablePaths({ global });
|
|
2014
|
-
const filePath = (0,
|
|
2044
|
+
const filePath = (0, import_node_path15.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2015
2045
|
const fileContent = await readFileContent(filePath);
|
|
2016
2046
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
2017
2047
|
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2045,7 +2075,7 @@ var FactorydroidCommand = class _FactorydroidCommand extends SimulatedCommand {
|
|
|
2045
2075
|
};
|
|
2046
2076
|
|
|
2047
2077
|
// src/features/commands/geminicli-command.ts
|
|
2048
|
-
var
|
|
2078
|
+
var import_node_path16 = require("path");
|
|
2049
2079
|
var import_smol_toml = require("smol-toml");
|
|
2050
2080
|
var import_mini10 = require("zod/mini");
|
|
2051
2081
|
var GeminiCliCommandFrontmatterSchema = import_mini10.z.looseObject({
|
|
@@ -2063,7 +2093,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
2063
2093
|
}
|
|
2064
2094
|
static getSettablePaths(_options = {}) {
|
|
2065
2095
|
return {
|
|
2066
|
-
relativeDirPath: (0,
|
|
2096
|
+
relativeDirPath: (0, import_node_path16.join)(".gemini", "commands")
|
|
2067
2097
|
};
|
|
2068
2098
|
}
|
|
2069
2099
|
parseTomlContent(content) {
|
|
@@ -2072,7 +2102,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
2072
2102
|
const result = GeminiCliCommandFrontmatterSchema.safeParse(parsed);
|
|
2073
2103
|
if (!result.success) {
|
|
2074
2104
|
throw new Error(
|
|
2075
|
-
`Invalid frontmatter in ${(0,
|
|
2105
|
+
`Invalid frontmatter in ${(0, import_node_path16.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
2076
2106
|
);
|
|
2077
2107
|
}
|
|
2078
2108
|
return {
|
|
@@ -2081,7 +2111,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
2081
2111
|
};
|
|
2082
2112
|
} catch (error) {
|
|
2083
2113
|
throw new Error(
|
|
2084
|
-
`Failed to parse TOML command file (${(0,
|
|
2114
|
+
`Failed to parse TOML command file (${(0, import_node_path16.join)(this.relativeDirPath, this.relativeFilePath)}): ${formatError(error)}`,
|
|
2085
2115
|
{ cause: error }
|
|
2086
2116
|
);
|
|
2087
2117
|
}
|
|
@@ -2149,7 +2179,7 @@ ${geminiFrontmatter.prompt}
|
|
|
2149
2179
|
global = false
|
|
2150
2180
|
}) {
|
|
2151
2181
|
const paths = this.getSettablePaths({ global });
|
|
2152
|
-
const filePath = (0,
|
|
2182
|
+
const filePath = (0, import_node_path16.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2153
2183
|
const fileContent = await readFileContent(filePath);
|
|
2154
2184
|
return new _GeminiCliCommand({
|
|
2155
2185
|
baseDir,
|
|
@@ -2191,11 +2221,11 @@ prompt = ""`;
|
|
|
2191
2221
|
};
|
|
2192
2222
|
|
|
2193
2223
|
// src/features/commands/kilo-command.ts
|
|
2194
|
-
var
|
|
2224
|
+
var import_node_path17 = require("path");
|
|
2195
2225
|
var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
2196
2226
|
static getSettablePaths(_options = {}) {
|
|
2197
2227
|
return {
|
|
2198
|
-
relativeDirPath: (0,
|
|
2228
|
+
relativeDirPath: (0, import_node_path17.join)(".kilocode", "workflows")
|
|
2199
2229
|
};
|
|
2200
2230
|
}
|
|
2201
2231
|
toRulesyncCommand() {
|
|
@@ -2244,7 +2274,7 @@ var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
|
2244
2274
|
validate = true
|
|
2245
2275
|
}) {
|
|
2246
2276
|
const paths = this.getSettablePaths();
|
|
2247
|
-
const filePath = (0,
|
|
2277
|
+
const filePath = (0, import_node_path17.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2248
2278
|
const fileContent = await readFileContent(filePath);
|
|
2249
2279
|
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
2250
2280
|
return new _KiloCommand({
|
|
@@ -2271,11 +2301,11 @@ var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
|
2271
2301
|
};
|
|
2272
2302
|
|
|
2273
2303
|
// src/features/commands/kiro-command.ts
|
|
2274
|
-
var
|
|
2304
|
+
var import_node_path18 = require("path");
|
|
2275
2305
|
var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
2276
2306
|
static getSettablePaths(_options = {}) {
|
|
2277
2307
|
return {
|
|
2278
|
-
relativeDirPath: (0,
|
|
2308
|
+
relativeDirPath: (0, import_node_path18.join)(".kiro", "prompts")
|
|
2279
2309
|
};
|
|
2280
2310
|
}
|
|
2281
2311
|
toRulesyncCommand() {
|
|
@@ -2324,7 +2354,7 @@ var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
|
2324
2354
|
validate = true
|
|
2325
2355
|
}) {
|
|
2326
2356
|
const paths = this.getSettablePaths();
|
|
2327
|
-
const filePath = (0,
|
|
2357
|
+
const filePath = (0, import_node_path18.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2328
2358
|
const fileContent = await readFileContent(filePath);
|
|
2329
2359
|
const { body: content } = parseFrontmatter(fileContent, filePath);
|
|
2330
2360
|
return new _KiroCommand({
|
|
@@ -2351,7 +2381,7 @@ var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
|
2351
2381
|
};
|
|
2352
2382
|
|
|
2353
2383
|
// src/features/commands/opencode-command.ts
|
|
2354
|
-
var
|
|
2384
|
+
var import_node_path19 = require("path");
|
|
2355
2385
|
var import_mini11 = require("zod/mini");
|
|
2356
2386
|
var OpenCodeCommandFrontmatterSchema = import_mini11.z.looseObject({
|
|
2357
2387
|
description: import_mini11.z.optional(import_mini11.z.string()),
|
|
@@ -2367,7 +2397,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2367
2397
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2368
2398
|
if (!result.success) {
|
|
2369
2399
|
throw new Error(
|
|
2370
|
-
`Invalid frontmatter in ${(0,
|
|
2400
|
+
`Invalid frontmatter in ${(0, import_node_path19.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
2371
2401
|
);
|
|
2372
2402
|
}
|
|
2373
2403
|
}
|
|
@@ -2380,7 +2410,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2380
2410
|
}
|
|
2381
2411
|
static getSettablePaths({ global } = {}) {
|
|
2382
2412
|
return {
|
|
2383
|
-
relativeDirPath: global ? (0,
|
|
2413
|
+
relativeDirPath: global ? (0, import_node_path19.join)(".config", "opencode", "command") : (0, import_node_path19.join)(".opencode", "command")
|
|
2384
2414
|
};
|
|
2385
2415
|
}
|
|
2386
2416
|
getBody() {
|
|
@@ -2441,7 +2471,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2441
2471
|
return {
|
|
2442
2472
|
success: false,
|
|
2443
2473
|
error: new Error(
|
|
2444
|
-
`Invalid frontmatter in ${(0,
|
|
2474
|
+
`Invalid frontmatter in ${(0, import_node_path19.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
2445
2475
|
)
|
|
2446
2476
|
};
|
|
2447
2477
|
}
|
|
@@ -2452,7 +2482,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2452
2482
|
global = false
|
|
2453
2483
|
}) {
|
|
2454
2484
|
const paths = this.getSettablePaths({ global });
|
|
2455
|
-
const filePath = (0,
|
|
2485
|
+
const filePath = (0, import_node_path19.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2456
2486
|
const fileContent = await readFileContent(filePath);
|
|
2457
2487
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
2458
2488
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2491,7 +2521,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2491
2521
|
};
|
|
2492
2522
|
|
|
2493
2523
|
// src/features/commands/roo-command.ts
|
|
2494
|
-
var
|
|
2524
|
+
var import_node_path20 = require("path");
|
|
2495
2525
|
var import_mini12 = require("zod/mini");
|
|
2496
2526
|
var RooCommandFrontmatterSchema = import_mini12.z.looseObject({
|
|
2497
2527
|
description: import_mini12.z.optional(import_mini12.z.string()),
|
|
@@ -2502,7 +2532,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2502
2532
|
body;
|
|
2503
2533
|
static getSettablePaths() {
|
|
2504
2534
|
return {
|
|
2505
|
-
relativeDirPath: (0,
|
|
2535
|
+
relativeDirPath: (0, import_node_path20.join)(".roo", "commands")
|
|
2506
2536
|
};
|
|
2507
2537
|
}
|
|
2508
2538
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -2510,7 +2540,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2510
2540
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2511
2541
|
if (!result.success) {
|
|
2512
2542
|
throw new Error(
|
|
2513
|
-
`Invalid frontmatter in ${(0,
|
|
2543
|
+
`Invalid frontmatter in ${(0, import_node_path20.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
2514
2544
|
);
|
|
2515
2545
|
}
|
|
2516
2546
|
}
|
|
@@ -2581,7 +2611,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2581
2611
|
return {
|
|
2582
2612
|
success: false,
|
|
2583
2613
|
error: new Error(
|
|
2584
|
-
`Invalid frontmatter in ${(0,
|
|
2614
|
+
`Invalid frontmatter in ${(0, import_node_path20.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
2585
2615
|
)
|
|
2586
2616
|
};
|
|
2587
2617
|
}
|
|
@@ -2597,7 +2627,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2597
2627
|
relativeFilePath,
|
|
2598
2628
|
validate = true
|
|
2599
2629
|
}) {
|
|
2600
|
-
const filePath = (0,
|
|
2630
|
+
const filePath = (0, import_node_path20.join)(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
2601
2631
|
const fileContent = await readFileContent(filePath);
|
|
2602
2632
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
2603
2633
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2918,12 +2948,12 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2918
2948
|
return rulesyncCommands;
|
|
2919
2949
|
}
|
|
2920
2950
|
flattenRelativeFilePath(rulesyncCommand) {
|
|
2921
|
-
const flatPath = (0,
|
|
2951
|
+
const flatPath = (0, import_node_path21.basename)(rulesyncCommand.getRelativeFilePath());
|
|
2922
2952
|
if (flatPath === rulesyncCommand.getRelativeFilePath()) return rulesyncCommand;
|
|
2923
2953
|
return rulesyncCommand.withRelativeFilePath(flatPath);
|
|
2924
2954
|
}
|
|
2925
2955
|
safeRelativePath(basePath, fullPath) {
|
|
2926
|
-
const rel = (0,
|
|
2956
|
+
const rel = (0, import_node_path21.relative)(basePath, fullPath);
|
|
2927
2957
|
checkPathTraversal({ relativePath: rel, intendedRootDir: basePath });
|
|
2928
2958
|
return rel;
|
|
2929
2959
|
}
|
|
@@ -2933,7 +2963,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2933
2963
|
*/
|
|
2934
2964
|
async loadRulesyncFiles() {
|
|
2935
2965
|
const basePath = RulesyncCommand.getSettablePaths().relativeDirPath;
|
|
2936
|
-
const rulesyncCommandPaths = await findFilesByGlobs((0,
|
|
2966
|
+
const rulesyncCommandPaths = await findFilesByGlobs((0, import_node_path21.join)(basePath, "**", "*.md"));
|
|
2937
2967
|
const rulesyncCommands = await Promise.all(
|
|
2938
2968
|
rulesyncCommandPaths.map(
|
|
2939
2969
|
(path3) => RulesyncCommand.fromFile({ relativeFilePath: this.safeRelativePath(basePath, path3) })
|
|
@@ -2951,8 +2981,8 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2951
2981
|
} = {}) {
|
|
2952
2982
|
const factory = this.getFactory(this.toolTarget);
|
|
2953
2983
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
2954
|
-
const baseDirFull = (0,
|
|
2955
|
-
const globPattern = factory.meta.supportsSubdirectory ? (0,
|
|
2984
|
+
const baseDirFull = (0, import_node_path21.join)(this.baseDir, paths.relativeDirPath);
|
|
2985
|
+
const globPattern = factory.meta.supportsSubdirectory ? (0, import_node_path21.join)(baseDirFull, "**", `*.${factory.meta.extension}`) : (0, import_node_path21.join)(baseDirFull, `*.${factory.meta.extension}`);
|
|
2956
2986
|
const commandFilePaths = await findFilesByGlobs(globPattern);
|
|
2957
2987
|
if (forDeletion) {
|
|
2958
2988
|
const toolCommands2 = commandFilePaths.map(
|
|
@@ -3222,7 +3252,7 @@ var GEMINICLI_TO_CANONICAL_EVENT_NAMES = Object.fromEntries(
|
|
|
3222
3252
|
);
|
|
3223
3253
|
|
|
3224
3254
|
// src/features/hooks/claudecode-hooks.ts
|
|
3225
|
-
var
|
|
3255
|
+
var import_node_path23 = require("path");
|
|
3226
3256
|
|
|
3227
3257
|
// src/features/hooks/tool-hooks-converter.ts
|
|
3228
3258
|
function isToolMatcherEntry(x) {
|
|
@@ -3330,7 +3360,7 @@ var ToolFile = class extends AiFile {
|
|
|
3330
3360
|
};
|
|
3331
3361
|
|
|
3332
3362
|
// src/features/hooks/rulesync-hooks.ts
|
|
3333
|
-
var
|
|
3363
|
+
var import_node_path22 = require("path");
|
|
3334
3364
|
var RulesyncHooks = class _RulesyncHooks extends RulesyncFile {
|
|
3335
3365
|
json;
|
|
3336
3366
|
constructor(params) {
|
|
@@ -3361,7 +3391,7 @@ var RulesyncHooks = class _RulesyncHooks extends RulesyncFile {
|
|
|
3361
3391
|
validate = true
|
|
3362
3392
|
}) {
|
|
3363
3393
|
const paths = _RulesyncHooks.getSettablePaths();
|
|
3364
|
-
const filePath = (0,
|
|
3394
|
+
const filePath = (0, import_node_path22.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3365
3395
|
if (!await fileExists(filePath)) {
|
|
3366
3396
|
throw new Error(`No ${RULESYNC_HOOKS_RELATIVE_FILE_PATH} found.`);
|
|
3367
3397
|
}
|
|
@@ -3441,7 +3471,7 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3441
3471
|
global = false
|
|
3442
3472
|
}) {
|
|
3443
3473
|
const paths = _ClaudecodeHooks.getSettablePaths({ global });
|
|
3444
|
-
const filePath = (0,
|
|
3474
|
+
const filePath = (0, import_node_path23.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3445
3475
|
const fileContent = await readFileContentOrNull(filePath) ?? '{"hooks":{}}';
|
|
3446
3476
|
return new _ClaudecodeHooks({
|
|
3447
3477
|
baseDir,
|
|
@@ -3458,7 +3488,7 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3458
3488
|
global = false
|
|
3459
3489
|
}) {
|
|
3460
3490
|
const paths = _ClaudecodeHooks.getSettablePaths({ global });
|
|
3461
|
-
const filePath = (0,
|
|
3491
|
+
const filePath = (0, import_node_path23.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3462
3492
|
const existingContent = await readOrInitializeFileContent(
|
|
3463
3493
|
filePath,
|
|
3464
3494
|
JSON.stringify({}, null, 2)
|
|
@@ -3494,7 +3524,7 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3494
3524
|
settings = JSON.parse(this.getFileContent());
|
|
3495
3525
|
} catch (error) {
|
|
3496
3526
|
throw new Error(
|
|
3497
|
-
`Failed to parse Claude hooks content in ${(0,
|
|
3527
|
+
`Failed to parse Claude hooks content in ${(0, import_node_path23.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
3498
3528
|
{
|
|
3499
3529
|
cause: error
|
|
3500
3530
|
}
|
|
@@ -3527,7 +3557,7 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3527
3557
|
};
|
|
3528
3558
|
|
|
3529
3559
|
// src/features/hooks/copilot-hooks.ts
|
|
3530
|
-
var
|
|
3560
|
+
var import_node_path24 = require("path");
|
|
3531
3561
|
var import_mini15 = require("zod/mini");
|
|
3532
3562
|
var CopilotHookEntrySchema = import_mini15.z.looseObject({
|
|
3533
3563
|
type: import_mini15.z.string(),
|
|
@@ -3630,7 +3660,7 @@ var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
|
3630
3660
|
}
|
|
3631
3661
|
static getSettablePaths(_options = {}) {
|
|
3632
3662
|
return {
|
|
3633
|
-
relativeDirPath: (0,
|
|
3663
|
+
relativeDirPath: (0, import_node_path24.join)(".github", "hooks"),
|
|
3634
3664
|
relativeFilePath: "copilot-hooks.json"
|
|
3635
3665
|
};
|
|
3636
3666
|
}
|
|
@@ -3640,7 +3670,7 @@ var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
|
3640
3670
|
global = false
|
|
3641
3671
|
}) {
|
|
3642
3672
|
const paths = _CopilotHooks.getSettablePaths({ global });
|
|
3643
|
-
const filePath = (0,
|
|
3673
|
+
const filePath = (0, import_node_path24.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3644
3674
|
const fileContent = await readFileContentOrNull(filePath) ?? '{"hooks":{}}';
|
|
3645
3675
|
return new _CopilotHooks({
|
|
3646
3676
|
baseDir,
|
|
@@ -3673,7 +3703,7 @@ var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
|
3673
3703
|
parsed = JSON.parse(this.getFileContent());
|
|
3674
3704
|
} catch (error) {
|
|
3675
3705
|
throw new Error(
|
|
3676
|
-
`Failed to parse Copilot hooks content in ${(0,
|
|
3706
|
+
`Failed to parse Copilot hooks content in ${(0, import_node_path24.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
3677
3707
|
{
|
|
3678
3708
|
cause: error
|
|
3679
3709
|
}
|
|
@@ -3703,7 +3733,7 @@ var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
|
3703
3733
|
};
|
|
3704
3734
|
|
|
3705
3735
|
// src/features/hooks/cursor-hooks.ts
|
|
3706
|
-
var
|
|
3736
|
+
var import_node_path25 = require("path");
|
|
3707
3737
|
var CursorHooks = class _CursorHooks extends ToolHooks {
|
|
3708
3738
|
constructor(params) {
|
|
3709
3739
|
const { rulesyncHooks: _r, ...rest } = params;
|
|
@@ -3724,7 +3754,7 @@ var CursorHooks = class _CursorHooks extends ToolHooks {
|
|
|
3724
3754
|
}) {
|
|
3725
3755
|
const paths = _CursorHooks.getSettablePaths();
|
|
3726
3756
|
const fileContent = await readFileContent(
|
|
3727
|
-
(0,
|
|
3757
|
+
(0, import_node_path25.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3728
3758
|
);
|
|
3729
3759
|
return new _CursorHooks({
|
|
3730
3760
|
baseDir,
|
|
@@ -3811,7 +3841,7 @@ var CursorHooks = class _CursorHooks extends ToolHooks {
|
|
|
3811
3841
|
};
|
|
3812
3842
|
|
|
3813
3843
|
// src/features/hooks/factorydroid-hooks.ts
|
|
3814
|
-
var
|
|
3844
|
+
var import_node_path26 = require("path");
|
|
3815
3845
|
var FACTORYDROID_CONVERTER_CONFIG = {
|
|
3816
3846
|
supportedEvents: FACTORYDROID_HOOK_EVENTS,
|
|
3817
3847
|
canonicalToToolEventNames: CANONICAL_TO_FACTORYDROID_EVENT_NAMES,
|
|
@@ -3837,7 +3867,7 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
3837
3867
|
global = false
|
|
3838
3868
|
}) {
|
|
3839
3869
|
const paths = _FactorydroidHooks.getSettablePaths({ global });
|
|
3840
|
-
const filePath = (0,
|
|
3870
|
+
const filePath = (0, import_node_path26.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3841
3871
|
const fileContent = await readFileContentOrNull(filePath) ?? '{"hooks":{}}';
|
|
3842
3872
|
return new _FactorydroidHooks({
|
|
3843
3873
|
baseDir,
|
|
@@ -3854,7 +3884,7 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
3854
3884
|
global = false
|
|
3855
3885
|
}) {
|
|
3856
3886
|
const paths = _FactorydroidHooks.getSettablePaths({ global });
|
|
3857
|
-
const filePath = (0,
|
|
3887
|
+
const filePath = (0, import_node_path26.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3858
3888
|
const existingContent = await readOrInitializeFileContent(
|
|
3859
3889
|
filePath,
|
|
3860
3890
|
JSON.stringify({}, null, 2)
|
|
@@ -3890,7 +3920,7 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
3890
3920
|
settings = JSON.parse(this.getFileContent());
|
|
3891
3921
|
} catch (error) {
|
|
3892
3922
|
throw new Error(
|
|
3893
|
-
`Failed to parse Factory Droid hooks content in ${(0,
|
|
3923
|
+
`Failed to parse Factory Droid hooks content in ${(0, import_node_path26.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
3894
3924
|
{
|
|
3895
3925
|
cause: error
|
|
3896
3926
|
}
|
|
@@ -3923,7 +3953,7 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
3923
3953
|
};
|
|
3924
3954
|
|
|
3925
3955
|
// src/features/hooks/geminicli-hooks.ts
|
|
3926
|
-
var
|
|
3956
|
+
var import_node_path27 = require("path");
|
|
3927
3957
|
var import_mini16 = require("zod/mini");
|
|
3928
3958
|
function canonicalToGeminicliHooks(config) {
|
|
3929
3959
|
const geminiSupported = new Set(GEMINICLI_HOOK_EVENTS);
|
|
@@ -4032,7 +4062,7 @@ var GeminicliHooks = class _GeminicliHooks extends ToolHooks {
|
|
|
4032
4062
|
global = false
|
|
4033
4063
|
}) {
|
|
4034
4064
|
const paths = _GeminicliHooks.getSettablePaths({ global });
|
|
4035
|
-
const filePath = (0,
|
|
4065
|
+
const filePath = (0, import_node_path27.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
4036
4066
|
const fileContent = await readFileContentOrNull(filePath) ?? '{"hooks":{}}';
|
|
4037
4067
|
return new _GeminicliHooks({
|
|
4038
4068
|
baseDir,
|
|
@@ -4049,7 +4079,7 @@ var GeminicliHooks = class _GeminicliHooks extends ToolHooks {
|
|
|
4049
4079
|
global = false
|
|
4050
4080
|
}) {
|
|
4051
4081
|
const paths = _GeminicliHooks.getSettablePaths({ global });
|
|
4052
|
-
const filePath = (0,
|
|
4082
|
+
const filePath = (0, import_node_path27.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
4053
4083
|
const existingContent = await readOrInitializeFileContent(
|
|
4054
4084
|
filePath,
|
|
4055
4085
|
JSON.stringify({}, null, 2)
|
|
@@ -4081,7 +4111,7 @@ var GeminicliHooks = class _GeminicliHooks extends ToolHooks {
|
|
|
4081
4111
|
settings = JSON.parse(this.getFileContent());
|
|
4082
4112
|
} catch (error) {
|
|
4083
4113
|
throw new Error(
|
|
4084
|
-
`Failed to parse Gemini CLI hooks content in ${(0,
|
|
4114
|
+
`Failed to parse Gemini CLI hooks content in ${(0, import_node_path27.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
4085
4115
|
{
|
|
4086
4116
|
cause: error
|
|
4087
4117
|
}
|
|
@@ -4111,7 +4141,7 @@ var GeminicliHooks = class _GeminicliHooks extends ToolHooks {
|
|
|
4111
4141
|
};
|
|
4112
4142
|
|
|
4113
4143
|
// src/features/hooks/opencode-hooks.ts
|
|
4114
|
-
var
|
|
4144
|
+
var import_node_path28 = require("path");
|
|
4115
4145
|
var NAMED_HOOKS = /* @__PURE__ */ new Set(["tool.execute.before", "tool.execute.after"]);
|
|
4116
4146
|
function escapeForTemplateLiteral(command) {
|
|
4117
4147
|
return command.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${");
|
|
@@ -4209,7 +4239,7 @@ var OpencodeHooks = class _OpencodeHooks extends ToolHooks {
|
|
|
4209
4239
|
}
|
|
4210
4240
|
static getSettablePaths(options) {
|
|
4211
4241
|
return {
|
|
4212
|
-
relativeDirPath: options?.global ? (0,
|
|
4242
|
+
relativeDirPath: options?.global ? (0, import_node_path28.join)(".config", "opencode", "plugins") : (0, import_node_path28.join)(".opencode", "plugins"),
|
|
4213
4243
|
relativeFilePath: "rulesync-hooks.js"
|
|
4214
4244
|
};
|
|
4215
4245
|
}
|
|
@@ -4220,7 +4250,7 @@ var OpencodeHooks = class _OpencodeHooks extends ToolHooks {
|
|
|
4220
4250
|
}) {
|
|
4221
4251
|
const paths = _OpencodeHooks.getSettablePaths({ global });
|
|
4222
4252
|
const fileContent = await readFileContent(
|
|
4223
|
-
(0,
|
|
4253
|
+
(0, import_node_path28.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
4224
4254
|
);
|
|
4225
4255
|
return new _OpencodeHooks({
|
|
4226
4256
|
baseDir,
|
|
@@ -4515,10 +4545,10 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4515
4545
|
var import_mini18 = require("zod/mini");
|
|
4516
4546
|
|
|
4517
4547
|
// src/features/ignore/augmentcode-ignore.ts
|
|
4518
|
-
var
|
|
4548
|
+
var import_node_path30 = require("path");
|
|
4519
4549
|
|
|
4520
4550
|
// src/features/ignore/rulesync-ignore.ts
|
|
4521
|
-
var
|
|
4551
|
+
var import_node_path29 = require("path");
|
|
4522
4552
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
4523
4553
|
validate() {
|
|
4524
4554
|
return { success: true, error: null };
|
|
@@ -4538,12 +4568,12 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
4538
4568
|
static async fromFile() {
|
|
4539
4569
|
const baseDir = process.cwd();
|
|
4540
4570
|
const paths = this.getSettablePaths();
|
|
4541
|
-
const recommendedPath = (0,
|
|
4571
|
+
const recommendedPath = (0, import_node_path29.join)(
|
|
4542
4572
|
baseDir,
|
|
4543
4573
|
paths.recommended.relativeDirPath,
|
|
4544
4574
|
paths.recommended.relativeFilePath
|
|
4545
4575
|
);
|
|
4546
|
-
const legacyPath = (0,
|
|
4576
|
+
const legacyPath = (0, import_node_path29.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
4547
4577
|
if (await fileExists(recommendedPath)) {
|
|
4548
4578
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
4549
4579
|
return new _RulesyncIgnore({
|
|
@@ -4659,7 +4689,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
4659
4689
|
validate = true
|
|
4660
4690
|
}) {
|
|
4661
4691
|
const fileContent = await readFileContent(
|
|
4662
|
-
(0,
|
|
4692
|
+
(0, import_node_path30.join)(
|
|
4663
4693
|
baseDir,
|
|
4664
4694
|
this.getSettablePaths().relativeDirPath,
|
|
4665
4695
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4689,7 +4719,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
4689
4719
|
};
|
|
4690
4720
|
|
|
4691
4721
|
// src/features/ignore/claudecode-ignore.ts
|
|
4692
|
-
var
|
|
4722
|
+
var import_node_path31 = require("path");
|
|
4693
4723
|
var import_es_toolkit2 = require("es-toolkit");
|
|
4694
4724
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
4695
4725
|
constructor(params) {
|
|
@@ -4732,7 +4762,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
4732
4762
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
4733
4763
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
4734
4764
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
4735
|
-
const filePath = (0,
|
|
4765
|
+
const filePath = (0, import_node_path31.join)(
|
|
4736
4766
|
baseDir,
|
|
4737
4767
|
this.getSettablePaths().relativeDirPath,
|
|
4738
4768
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4768,7 +4798,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
4768
4798
|
validate = true
|
|
4769
4799
|
}) {
|
|
4770
4800
|
const fileContent = await readFileContent(
|
|
4771
|
-
(0,
|
|
4801
|
+
(0, import_node_path31.join)(
|
|
4772
4802
|
baseDir,
|
|
4773
4803
|
this.getSettablePaths().relativeDirPath,
|
|
4774
4804
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4798,7 +4828,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
4798
4828
|
};
|
|
4799
4829
|
|
|
4800
4830
|
// src/features/ignore/cline-ignore.ts
|
|
4801
|
-
var
|
|
4831
|
+
var import_node_path32 = require("path");
|
|
4802
4832
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
4803
4833
|
static getSettablePaths() {
|
|
4804
4834
|
return {
|
|
@@ -4835,7 +4865,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
4835
4865
|
validate = true
|
|
4836
4866
|
}) {
|
|
4837
4867
|
const fileContent = await readFileContent(
|
|
4838
|
-
(0,
|
|
4868
|
+
(0, import_node_path32.join)(
|
|
4839
4869
|
baseDir,
|
|
4840
4870
|
this.getSettablePaths().relativeDirPath,
|
|
4841
4871
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4865,7 +4895,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
4865
4895
|
};
|
|
4866
4896
|
|
|
4867
4897
|
// src/features/ignore/cursor-ignore.ts
|
|
4868
|
-
var
|
|
4898
|
+
var import_node_path33 = require("path");
|
|
4869
4899
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
4870
4900
|
static getSettablePaths() {
|
|
4871
4901
|
return {
|
|
@@ -4898,7 +4928,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
4898
4928
|
validate = true
|
|
4899
4929
|
}) {
|
|
4900
4930
|
const fileContent = await readFileContent(
|
|
4901
|
-
(0,
|
|
4931
|
+
(0, import_node_path33.join)(
|
|
4902
4932
|
baseDir,
|
|
4903
4933
|
this.getSettablePaths().relativeDirPath,
|
|
4904
4934
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4928,7 +4958,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
4928
4958
|
};
|
|
4929
4959
|
|
|
4930
4960
|
// src/features/ignore/geminicli-ignore.ts
|
|
4931
|
-
var
|
|
4961
|
+
var import_node_path34 = require("path");
|
|
4932
4962
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
4933
4963
|
static getSettablePaths() {
|
|
4934
4964
|
return {
|
|
@@ -4955,7 +4985,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
4955
4985
|
validate = true
|
|
4956
4986
|
}) {
|
|
4957
4987
|
const fileContent = await readFileContent(
|
|
4958
|
-
(0,
|
|
4988
|
+
(0, import_node_path34.join)(
|
|
4959
4989
|
baseDir,
|
|
4960
4990
|
this.getSettablePaths().relativeDirPath,
|
|
4961
4991
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4985,7 +5015,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
4985
5015
|
};
|
|
4986
5016
|
|
|
4987
5017
|
// src/features/ignore/goose-ignore.ts
|
|
4988
|
-
var
|
|
5018
|
+
var import_node_path35 = require("path");
|
|
4989
5019
|
var GooseIgnore = class _GooseIgnore extends ToolIgnore {
|
|
4990
5020
|
static getSettablePaths() {
|
|
4991
5021
|
return {
|
|
@@ -5022,7 +5052,7 @@ var GooseIgnore = class _GooseIgnore extends ToolIgnore {
|
|
|
5022
5052
|
validate = true
|
|
5023
5053
|
}) {
|
|
5024
5054
|
const fileContent = await readFileContent(
|
|
5025
|
-
(0,
|
|
5055
|
+
(0, import_node_path35.join)(
|
|
5026
5056
|
baseDir,
|
|
5027
5057
|
this.getSettablePaths().relativeDirPath,
|
|
5028
5058
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5052,7 +5082,7 @@ var GooseIgnore = class _GooseIgnore extends ToolIgnore {
|
|
|
5052
5082
|
};
|
|
5053
5083
|
|
|
5054
5084
|
// src/features/ignore/junie-ignore.ts
|
|
5055
|
-
var
|
|
5085
|
+
var import_node_path36 = require("path");
|
|
5056
5086
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
5057
5087
|
static getSettablePaths() {
|
|
5058
5088
|
return {
|
|
@@ -5079,7 +5109,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
5079
5109
|
validate = true
|
|
5080
5110
|
}) {
|
|
5081
5111
|
const fileContent = await readFileContent(
|
|
5082
|
-
(0,
|
|
5112
|
+
(0, import_node_path36.join)(
|
|
5083
5113
|
baseDir,
|
|
5084
5114
|
this.getSettablePaths().relativeDirPath,
|
|
5085
5115
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5109,7 +5139,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
5109
5139
|
};
|
|
5110
5140
|
|
|
5111
5141
|
// src/features/ignore/kilo-ignore.ts
|
|
5112
|
-
var
|
|
5142
|
+
var import_node_path37 = require("path");
|
|
5113
5143
|
var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
5114
5144
|
static getSettablePaths() {
|
|
5115
5145
|
return {
|
|
@@ -5146,7 +5176,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
5146
5176
|
validate = true
|
|
5147
5177
|
}) {
|
|
5148
5178
|
const fileContent = await readFileContent(
|
|
5149
|
-
(0,
|
|
5179
|
+
(0, import_node_path37.join)(
|
|
5150
5180
|
baseDir,
|
|
5151
5181
|
this.getSettablePaths().relativeDirPath,
|
|
5152
5182
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5176,7 +5206,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
5176
5206
|
};
|
|
5177
5207
|
|
|
5178
5208
|
// src/features/ignore/kiro-ignore.ts
|
|
5179
|
-
var
|
|
5209
|
+
var import_node_path38 = require("path");
|
|
5180
5210
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
5181
5211
|
static getSettablePaths() {
|
|
5182
5212
|
return {
|
|
@@ -5203,7 +5233,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
5203
5233
|
validate = true
|
|
5204
5234
|
}) {
|
|
5205
5235
|
const fileContent = await readFileContent(
|
|
5206
|
-
(0,
|
|
5236
|
+
(0, import_node_path38.join)(
|
|
5207
5237
|
baseDir,
|
|
5208
5238
|
this.getSettablePaths().relativeDirPath,
|
|
5209
5239
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5233,7 +5263,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
5233
5263
|
};
|
|
5234
5264
|
|
|
5235
5265
|
// src/features/ignore/qwencode-ignore.ts
|
|
5236
|
-
var
|
|
5266
|
+
var import_node_path39 = require("path");
|
|
5237
5267
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
5238
5268
|
static getSettablePaths() {
|
|
5239
5269
|
return {
|
|
@@ -5260,7 +5290,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
5260
5290
|
validate = true
|
|
5261
5291
|
}) {
|
|
5262
5292
|
const fileContent = await readFileContent(
|
|
5263
|
-
(0,
|
|
5293
|
+
(0, import_node_path39.join)(
|
|
5264
5294
|
baseDir,
|
|
5265
5295
|
this.getSettablePaths().relativeDirPath,
|
|
5266
5296
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5290,7 +5320,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
5290
5320
|
};
|
|
5291
5321
|
|
|
5292
5322
|
// src/features/ignore/roo-ignore.ts
|
|
5293
|
-
var
|
|
5323
|
+
var import_node_path40 = require("path");
|
|
5294
5324
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
5295
5325
|
static getSettablePaths() {
|
|
5296
5326
|
return {
|
|
@@ -5317,7 +5347,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
5317
5347
|
validate = true
|
|
5318
5348
|
}) {
|
|
5319
5349
|
const fileContent = await readFileContent(
|
|
5320
|
-
(0,
|
|
5350
|
+
(0, import_node_path40.join)(
|
|
5321
5351
|
baseDir,
|
|
5322
5352
|
this.getSettablePaths().relativeDirPath,
|
|
5323
5353
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5347,7 +5377,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
5347
5377
|
};
|
|
5348
5378
|
|
|
5349
5379
|
// src/features/ignore/windsurf-ignore.ts
|
|
5350
|
-
var
|
|
5380
|
+
var import_node_path41 = require("path");
|
|
5351
5381
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
5352
5382
|
static getSettablePaths() {
|
|
5353
5383
|
return {
|
|
@@ -5374,7 +5404,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
5374
5404
|
validate = true
|
|
5375
5405
|
}) {
|
|
5376
5406
|
const fileContent = await readFileContent(
|
|
5377
|
-
(0,
|
|
5407
|
+
(0, import_node_path41.join)(
|
|
5378
5408
|
baseDir,
|
|
5379
5409
|
this.getSettablePaths().relativeDirPath,
|
|
5380
5410
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5404,7 +5434,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
5404
5434
|
};
|
|
5405
5435
|
|
|
5406
5436
|
// src/features/ignore/zed-ignore.ts
|
|
5407
|
-
var
|
|
5437
|
+
var import_node_path42 = require("path");
|
|
5408
5438
|
var import_es_toolkit3 = require("es-toolkit");
|
|
5409
5439
|
var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
5410
5440
|
constructor(params) {
|
|
@@ -5441,7 +5471,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
5441
5471
|
}) {
|
|
5442
5472
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
5443
5473
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
5444
|
-
const filePath = (0,
|
|
5474
|
+
const filePath = (0, import_node_path42.join)(
|
|
5445
5475
|
baseDir,
|
|
5446
5476
|
this.getSettablePaths().relativeDirPath,
|
|
5447
5477
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5468,7 +5498,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
5468
5498
|
validate = true
|
|
5469
5499
|
}) {
|
|
5470
5500
|
const fileContent = await readFileContent(
|
|
5471
|
-
(0,
|
|
5501
|
+
(0, import_node_path42.join)(
|
|
5472
5502
|
baseDir,
|
|
5473
5503
|
this.getSettablePaths().relativeDirPath,
|
|
5474
5504
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5655,10 +5685,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5655
5685
|
var import_mini22 = require("zod/mini");
|
|
5656
5686
|
|
|
5657
5687
|
// src/features/mcp/claudecode-mcp.ts
|
|
5658
|
-
var
|
|
5688
|
+
var import_node_path44 = require("path");
|
|
5659
5689
|
|
|
5660
5690
|
// src/features/mcp/rulesync-mcp.ts
|
|
5661
|
-
var
|
|
5691
|
+
var import_node_path43 = require("path");
|
|
5662
5692
|
var import_object = require("es-toolkit/object");
|
|
5663
5693
|
var import_mini20 = require("zod/mini");
|
|
5664
5694
|
|
|
@@ -5730,12 +5760,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
5730
5760
|
static async fromFile({ validate = true }) {
|
|
5731
5761
|
const baseDir = process.cwd();
|
|
5732
5762
|
const paths = this.getSettablePaths();
|
|
5733
|
-
const recommendedPath = (0,
|
|
5763
|
+
const recommendedPath = (0, import_node_path43.join)(
|
|
5734
5764
|
baseDir,
|
|
5735
5765
|
paths.recommended.relativeDirPath,
|
|
5736
5766
|
paths.recommended.relativeFilePath
|
|
5737
5767
|
);
|
|
5738
|
-
const legacyPath = (0,
|
|
5768
|
+
const legacyPath = (0, import_node_path43.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
5739
5769
|
if (await fileExists(recommendedPath)) {
|
|
5740
5770
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
5741
5771
|
return new _RulesyncMcp({
|
|
@@ -5880,7 +5910,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
5880
5910
|
global = false
|
|
5881
5911
|
}) {
|
|
5882
5912
|
const paths = this.getSettablePaths({ global });
|
|
5883
|
-
const fileContent = await readFileContentOrNull((0,
|
|
5913
|
+
const fileContent = await readFileContentOrNull((0, import_node_path44.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
5884
5914
|
const json = JSON.parse(fileContent);
|
|
5885
5915
|
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
5886
5916
|
return new _ClaudecodeMcp({
|
|
@@ -5899,7 +5929,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
5899
5929
|
}) {
|
|
5900
5930
|
const paths = this.getSettablePaths({ global });
|
|
5901
5931
|
const fileContent = await readOrInitializeFileContent(
|
|
5902
|
-
(0,
|
|
5932
|
+
(0, import_node_path44.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
5903
5933
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
5904
5934
|
);
|
|
5905
5935
|
const json = JSON.parse(fileContent);
|
|
@@ -5938,7 +5968,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
5938
5968
|
};
|
|
5939
5969
|
|
|
5940
5970
|
// src/features/mcp/cline-mcp.ts
|
|
5941
|
-
var
|
|
5971
|
+
var import_node_path45 = require("path");
|
|
5942
5972
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
5943
5973
|
json;
|
|
5944
5974
|
constructor(params) {
|
|
@@ -5959,7 +5989,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
5959
5989
|
validate = true
|
|
5960
5990
|
}) {
|
|
5961
5991
|
const fileContent = await readFileContent(
|
|
5962
|
-
(0,
|
|
5992
|
+
(0, import_node_path45.join)(
|
|
5963
5993
|
baseDir,
|
|
5964
5994
|
this.getSettablePaths().relativeDirPath,
|
|
5965
5995
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6008,7 +6038,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
6008
6038
|
};
|
|
6009
6039
|
|
|
6010
6040
|
// src/features/mcp/codexcli-mcp.ts
|
|
6011
|
-
var
|
|
6041
|
+
var import_node_path46 = require("path");
|
|
6012
6042
|
var smolToml = __toESM(require("smol-toml"), 1);
|
|
6013
6043
|
function convertFromCodexFormat(codexMcp) {
|
|
6014
6044
|
const result = {};
|
|
@@ -6091,7 +6121,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
6091
6121
|
global = false
|
|
6092
6122
|
}) {
|
|
6093
6123
|
const paths = this.getSettablePaths({ global });
|
|
6094
|
-
const fileContent = await readFileContentOrNull((0,
|
|
6124
|
+
const fileContent = await readFileContentOrNull((0, import_node_path46.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? smolToml.stringify({});
|
|
6095
6125
|
return new _CodexcliMcp({
|
|
6096
6126
|
baseDir,
|
|
6097
6127
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -6107,7 +6137,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
6107
6137
|
global = false
|
|
6108
6138
|
}) {
|
|
6109
6139
|
const paths = this.getSettablePaths({ global });
|
|
6110
|
-
const configTomlFilePath = (0,
|
|
6140
|
+
const configTomlFilePath = (0, import_node_path46.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
6111
6141
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
6112
6142
|
configTomlFilePath,
|
|
6113
6143
|
smolToml.stringify({})
|
|
@@ -6164,7 +6194,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
6164
6194
|
};
|
|
6165
6195
|
|
|
6166
6196
|
// src/features/mcp/copilot-mcp.ts
|
|
6167
|
-
var
|
|
6197
|
+
var import_node_path47 = require("path");
|
|
6168
6198
|
function convertToCopilotFormat(mcpServers) {
|
|
6169
6199
|
return { servers: mcpServers };
|
|
6170
6200
|
}
|
|
@@ -6191,7 +6221,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
6191
6221
|
validate = true
|
|
6192
6222
|
}) {
|
|
6193
6223
|
const fileContent = await readFileContent(
|
|
6194
|
-
(0,
|
|
6224
|
+
(0, import_node_path47.join)(
|
|
6195
6225
|
baseDir,
|
|
6196
6226
|
this.getSettablePaths().relativeDirPath,
|
|
6197
6227
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6244,7 +6274,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
6244
6274
|
};
|
|
6245
6275
|
|
|
6246
6276
|
// src/features/mcp/cursor-mcp.ts
|
|
6247
|
-
var
|
|
6277
|
+
var import_node_path48 = require("path");
|
|
6248
6278
|
var CURSOR_ENV_VAR_PATTERN = /\$\{env:([^}]+)\}/g;
|
|
6249
6279
|
function isMcpServers(value) {
|
|
6250
6280
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
@@ -6305,7 +6335,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6305
6335
|
validate = true
|
|
6306
6336
|
}) {
|
|
6307
6337
|
const fileContent = await readFileContent(
|
|
6308
|
-
(0,
|
|
6338
|
+
(0, import_node_path48.join)(
|
|
6309
6339
|
baseDir,
|
|
6310
6340
|
this.getSettablePaths().relativeDirPath,
|
|
6311
6341
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6373,7 +6403,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6373
6403
|
};
|
|
6374
6404
|
|
|
6375
6405
|
// src/features/mcp/factorydroid-mcp.ts
|
|
6376
|
-
var
|
|
6406
|
+
var import_node_path49 = require("path");
|
|
6377
6407
|
var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
6378
6408
|
json;
|
|
6379
6409
|
constructor(params) {
|
|
@@ -6394,7 +6424,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
6394
6424
|
validate = true
|
|
6395
6425
|
}) {
|
|
6396
6426
|
const fileContent = await readFileContent(
|
|
6397
|
-
(0,
|
|
6427
|
+
(0, import_node_path49.join)(
|
|
6398
6428
|
baseDir,
|
|
6399
6429
|
this.getSettablePaths().relativeDirPath,
|
|
6400
6430
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6454,7 +6484,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
6454
6484
|
};
|
|
6455
6485
|
|
|
6456
6486
|
// src/features/mcp/geminicli-mcp.ts
|
|
6457
|
-
var
|
|
6487
|
+
var import_node_path50 = require("path");
|
|
6458
6488
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
6459
6489
|
json;
|
|
6460
6490
|
constructor(params) {
|
|
@@ -6482,7 +6512,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6482
6512
|
global = false
|
|
6483
6513
|
}) {
|
|
6484
6514
|
const paths = this.getSettablePaths({ global });
|
|
6485
|
-
const fileContent = await readFileContentOrNull((0,
|
|
6515
|
+
const fileContent = await readFileContentOrNull((0, import_node_path50.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6486
6516
|
const json = JSON.parse(fileContent);
|
|
6487
6517
|
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
6488
6518
|
return new _GeminiCliMcp({
|
|
@@ -6501,7 +6531,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6501
6531
|
}) {
|
|
6502
6532
|
const paths = this.getSettablePaths({ global });
|
|
6503
6533
|
const fileContent = await readOrInitializeFileContent(
|
|
6504
|
-
(0,
|
|
6534
|
+
(0, import_node_path50.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6505
6535
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
6506
6536
|
);
|
|
6507
6537
|
const json = JSON.parse(fileContent);
|
|
@@ -6546,7 +6576,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6546
6576
|
};
|
|
6547
6577
|
|
|
6548
6578
|
// src/features/mcp/junie-mcp.ts
|
|
6549
|
-
var
|
|
6579
|
+
var import_node_path51 = require("path");
|
|
6550
6580
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
6551
6581
|
json;
|
|
6552
6582
|
constructor(params) {
|
|
@@ -6558,7 +6588,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6558
6588
|
}
|
|
6559
6589
|
static getSettablePaths() {
|
|
6560
6590
|
return {
|
|
6561
|
-
relativeDirPath: (0,
|
|
6591
|
+
relativeDirPath: (0, import_node_path51.join)(".junie", "mcp"),
|
|
6562
6592
|
relativeFilePath: "mcp.json"
|
|
6563
6593
|
};
|
|
6564
6594
|
}
|
|
@@ -6567,7 +6597,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6567
6597
|
validate = true
|
|
6568
6598
|
}) {
|
|
6569
6599
|
const fileContent = await readFileContent(
|
|
6570
|
-
(0,
|
|
6600
|
+
(0, import_node_path51.join)(
|
|
6571
6601
|
baseDir,
|
|
6572
6602
|
this.getSettablePaths().relativeDirPath,
|
|
6573
6603
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6616,7 +6646,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6616
6646
|
};
|
|
6617
6647
|
|
|
6618
6648
|
// src/features/mcp/kilo-mcp.ts
|
|
6619
|
-
var
|
|
6649
|
+
var import_node_path52 = require("path");
|
|
6620
6650
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
6621
6651
|
json;
|
|
6622
6652
|
constructor(params) {
|
|
@@ -6637,7 +6667,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
6637
6667
|
validate = true
|
|
6638
6668
|
}) {
|
|
6639
6669
|
const paths = this.getSettablePaths();
|
|
6640
|
-
const fileContent = await readFileContentOrNull((0,
|
|
6670
|
+
const fileContent = await readFileContentOrNull((0, import_node_path52.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6641
6671
|
return new _KiloMcp({
|
|
6642
6672
|
baseDir,
|
|
6643
6673
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -6685,7 +6715,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
6685
6715
|
};
|
|
6686
6716
|
|
|
6687
6717
|
// src/features/mcp/kiro-mcp.ts
|
|
6688
|
-
var
|
|
6718
|
+
var import_node_path53 = require("path");
|
|
6689
6719
|
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
6690
6720
|
json;
|
|
6691
6721
|
constructor(params) {
|
|
@@ -6697,7 +6727,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
6697
6727
|
}
|
|
6698
6728
|
static getSettablePaths() {
|
|
6699
6729
|
return {
|
|
6700
|
-
relativeDirPath: (0,
|
|
6730
|
+
relativeDirPath: (0, import_node_path53.join)(".kiro", "settings"),
|
|
6701
6731
|
relativeFilePath: "mcp.json"
|
|
6702
6732
|
};
|
|
6703
6733
|
}
|
|
@@ -6706,7 +6736,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
6706
6736
|
validate = true
|
|
6707
6737
|
}) {
|
|
6708
6738
|
const paths = this.getSettablePaths();
|
|
6709
|
-
const fileContent = await readFileContentOrNull((0,
|
|
6739
|
+
const fileContent = await readFileContentOrNull((0, import_node_path53.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6710
6740
|
return new _KiroMcp({
|
|
6711
6741
|
baseDir,
|
|
6712
6742
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -6754,7 +6784,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
6754
6784
|
};
|
|
6755
6785
|
|
|
6756
6786
|
// src/features/mcp/opencode-mcp.ts
|
|
6757
|
-
var
|
|
6787
|
+
var import_node_path54 = require("path");
|
|
6758
6788
|
var import_jsonc_parser2 = require("jsonc-parser");
|
|
6759
6789
|
var import_mini21 = require("zod/mini");
|
|
6760
6790
|
var OpencodeMcpLocalServerSchema = import_mini21.z.object({
|
|
@@ -6895,7 +6925,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6895
6925
|
static getSettablePaths({ global } = {}) {
|
|
6896
6926
|
if (global) {
|
|
6897
6927
|
return {
|
|
6898
|
-
relativeDirPath: (0,
|
|
6928
|
+
relativeDirPath: (0, import_node_path54.join)(".config", "opencode"),
|
|
6899
6929
|
relativeFilePath: "opencode.json"
|
|
6900
6930
|
};
|
|
6901
6931
|
}
|
|
@@ -6910,11 +6940,11 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6910
6940
|
global = false
|
|
6911
6941
|
}) {
|
|
6912
6942
|
const basePaths = this.getSettablePaths({ global });
|
|
6913
|
-
const jsonDir = (0,
|
|
6943
|
+
const jsonDir = (0, import_node_path54.join)(baseDir, basePaths.relativeDirPath);
|
|
6914
6944
|
let fileContent = null;
|
|
6915
6945
|
let relativeFilePath = "opencode.jsonc";
|
|
6916
|
-
const jsoncPath = (0,
|
|
6917
|
-
const jsonPath = (0,
|
|
6946
|
+
const jsoncPath = (0, import_node_path54.join)(jsonDir, "opencode.jsonc");
|
|
6947
|
+
const jsonPath = (0, import_node_path54.join)(jsonDir, "opencode.json");
|
|
6918
6948
|
fileContent = await readFileContentOrNull(jsoncPath);
|
|
6919
6949
|
if (!fileContent) {
|
|
6920
6950
|
fileContent = await readFileContentOrNull(jsonPath);
|
|
@@ -6940,11 +6970,11 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6940
6970
|
global = false
|
|
6941
6971
|
}) {
|
|
6942
6972
|
const basePaths = this.getSettablePaths({ global });
|
|
6943
|
-
const jsonDir = (0,
|
|
6973
|
+
const jsonDir = (0, import_node_path54.join)(baseDir, basePaths.relativeDirPath);
|
|
6944
6974
|
let fileContent = null;
|
|
6945
6975
|
let relativeFilePath = "opencode.jsonc";
|
|
6946
|
-
const jsoncPath = (0,
|
|
6947
|
-
const jsonPath = (0,
|
|
6976
|
+
const jsoncPath = (0, import_node_path54.join)(jsonDir, "opencode.jsonc");
|
|
6977
|
+
const jsonPath = (0, import_node_path54.join)(jsonDir, "opencode.json");
|
|
6948
6978
|
fileContent = await readFileContentOrNull(jsoncPath);
|
|
6949
6979
|
if (!fileContent) {
|
|
6950
6980
|
fileContent = await readFileContentOrNull(jsonPath);
|
|
@@ -7005,7 +7035,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7005
7035
|
};
|
|
7006
7036
|
|
|
7007
7037
|
// src/features/mcp/roo-mcp.ts
|
|
7008
|
-
var
|
|
7038
|
+
var import_node_path55 = require("path");
|
|
7009
7039
|
function isRooMcpServers(value) {
|
|
7010
7040
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
7011
7041
|
}
|
|
@@ -7057,7 +7087,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
7057
7087
|
validate = true
|
|
7058
7088
|
}) {
|
|
7059
7089
|
const fileContent = await readFileContent(
|
|
7060
|
-
(0,
|
|
7090
|
+
(0, import_node_path55.join)(
|
|
7061
7091
|
baseDir,
|
|
7062
7092
|
this.getSettablePaths().relativeDirPath,
|
|
7063
7093
|
this.getSettablePaths().relativeFilePath
|
|
@@ -7430,25 +7460,25 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7430
7460
|
};
|
|
7431
7461
|
|
|
7432
7462
|
// src/features/rules/rules-processor.ts
|
|
7433
|
-
var
|
|
7463
|
+
var import_node_path117 = require("path");
|
|
7434
7464
|
var import_toon = require("@toon-format/toon");
|
|
7435
|
-
var
|
|
7465
|
+
var import_mini56 = require("zod/mini");
|
|
7436
7466
|
|
|
7437
7467
|
// src/constants/general.ts
|
|
7438
7468
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
7439
7469
|
|
|
7440
7470
|
// src/features/skills/agentsmd-skill.ts
|
|
7441
|
-
var
|
|
7471
|
+
var import_node_path59 = require("path");
|
|
7442
7472
|
|
|
7443
7473
|
// src/features/skills/simulated-skill.ts
|
|
7444
|
-
var
|
|
7474
|
+
var import_node_path58 = require("path");
|
|
7445
7475
|
var import_mini23 = require("zod/mini");
|
|
7446
7476
|
|
|
7447
7477
|
// src/features/skills/tool-skill.ts
|
|
7448
|
-
var
|
|
7478
|
+
var import_node_path57 = require("path");
|
|
7449
7479
|
|
|
7450
7480
|
// src/types/ai-dir.ts
|
|
7451
|
-
var
|
|
7481
|
+
var import_node_path56 = __toESM(require("path"), 1);
|
|
7452
7482
|
var AiDir = class {
|
|
7453
7483
|
/**
|
|
7454
7484
|
* @example "."
|
|
@@ -7482,7 +7512,7 @@ var AiDir = class {
|
|
|
7482
7512
|
otherFiles = [],
|
|
7483
7513
|
global = false
|
|
7484
7514
|
}) {
|
|
7485
|
-
if (dirName.includes(
|
|
7515
|
+
if (dirName.includes(import_node_path56.default.sep) || dirName.includes("/") || dirName.includes("\\")) {
|
|
7486
7516
|
throw new Error(`Directory name cannot contain path separators: dirName="${dirName}"`);
|
|
7487
7517
|
}
|
|
7488
7518
|
this.baseDir = baseDir;
|
|
@@ -7505,11 +7535,11 @@ var AiDir = class {
|
|
|
7505
7535
|
return this.dirName;
|
|
7506
7536
|
}
|
|
7507
7537
|
getDirPath() {
|
|
7508
|
-
const fullPath =
|
|
7509
|
-
const resolvedFull = (0,
|
|
7510
|
-
const resolvedBase = (0,
|
|
7511
|
-
const rel = (0,
|
|
7512
|
-
if (rel.startsWith("..") ||
|
|
7538
|
+
const fullPath = import_node_path56.default.join(this.baseDir, this.relativeDirPath, this.dirName);
|
|
7539
|
+
const resolvedFull = (0, import_node_path56.resolve)(fullPath);
|
|
7540
|
+
const resolvedBase = (0, import_node_path56.resolve)(this.baseDir);
|
|
7541
|
+
const rel = (0, import_node_path56.relative)(resolvedBase, resolvedFull);
|
|
7542
|
+
if (rel.startsWith("..") || import_node_path56.default.isAbsolute(rel)) {
|
|
7513
7543
|
throw new Error(
|
|
7514
7544
|
`Path traversal detected: Final path escapes baseDir. baseDir="${this.baseDir}", relativeDirPath="${this.relativeDirPath}", dirName="${this.dirName}"`
|
|
7515
7545
|
);
|
|
@@ -7523,7 +7553,7 @@ var AiDir = class {
|
|
|
7523
7553
|
return this.otherFiles;
|
|
7524
7554
|
}
|
|
7525
7555
|
getRelativePathFromCwd() {
|
|
7526
|
-
return
|
|
7556
|
+
return import_node_path56.default.join(this.relativeDirPath, this.dirName);
|
|
7527
7557
|
}
|
|
7528
7558
|
getGlobal() {
|
|
7529
7559
|
return this.global;
|
|
@@ -7542,15 +7572,15 @@ var AiDir = class {
|
|
|
7542
7572
|
* @returns Array of files with their relative paths and buffers
|
|
7543
7573
|
*/
|
|
7544
7574
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
7545
|
-
const dirPath = (0,
|
|
7546
|
-
const glob = (0,
|
|
7575
|
+
const dirPath = (0, import_node_path56.join)(baseDir, relativeDirPath, dirName);
|
|
7576
|
+
const glob = (0, import_node_path56.join)(dirPath, "**", "*");
|
|
7547
7577
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
7548
|
-
const filteredPaths = filePaths.filter((filePath) => (0,
|
|
7578
|
+
const filteredPaths = filePaths.filter((filePath) => (0, import_node_path56.basename)(filePath) !== excludeFileName);
|
|
7549
7579
|
const files = await Promise.all(
|
|
7550
7580
|
filteredPaths.map(async (filePath) => {
|
|
7551
7581
|
const fileBuffer = await readFileBuffer(filePath);
|
|
7552
7582
|
return {
|
|
7553
|
-
relativeFilePathToDirPath: (0,
|
|
7583
|
+
relativeFilePathToDirPath: (0, import_node_path56.relative)(dirPath, filePath),
|
|
7554
7584
|
fileBuffer
|
|
7555
7585
|
};
|
|
7556
7586
|
})
|
|
@@ -7641,8 +7671,8 @@ var ToolSkill = class extends AiDir {
|
|
|
7641
7671
|
}) {
|
|
7642
7672
|
const settablePaths = getSettablePaths({ global });
|
|
7643
7673
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
7644
|
-
const skillDirPath = (0,
|
|
7645
|
-
const skillFilePath = (0,
|
|
7674
|
+
const skillDirPath = (0, import_node_path57.join)(baseDir, actualRelativeDirPath, dirName);
|
|
7675
|
+
const skillFilePath = (0, import_node_path57.join)(skillDirPath, SKILL_FILE_NAME);
|
|
7646
7676
|
if (!await fileExists(skillFilePath)) {
|
|
7647
7677
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
7648
7678
|
}
|
|
@@ -7666,7 +7696,7 @@ var ToolSkill = class extends AiDir {
|
|
|
7666
7696
|
}
|
|
7667
7697
|
requireMainFileFrontmatter() {
|
|
7668
7698
|
if (!this.mainFile?.frontmatter) {
|
|
7669
|
-
throw new Error(`Frontmatter is not defined in ${(0,
|
|
7699
|
+
throw new Error(`Frontmatter is not defined in ${(0, import_node_path57.join)(this.relativeDirPath, this.dirName)}`);
|
|
7670
7700
|
}
|
|
7671
7701
|
return this.mainFile.frontmatter;
|
|
7672
7702
|
}
|
|
@@ -7706,7 +7736,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
7706
7736
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
7707
7737
|
if (!result.success) {
|
|
7708
7738
|
throw new Error(
|
|
7709
|
-
`Invalid frontmatter in ${(0,
|
|
7739
|
+
`Invalid frontmatter in ${(0, import_node_path58.join)(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
7710
7740
|
);
|
|
7711
7741
|
}
|
|
7712
7742
|
}
|
|
@@ -7739,6 +7769,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
7739
7769
|
}
|
|
7740
7770
|
}
|
|
7741
7771
|
static fromRulesyncSkillDefault({
|
|
7772
|
+
baseDir = process.cwd(),
|
|
7742
7773
|
rulesyncSkill,
|
|
7743
7774
|
validate = true
|
|
7744
7775
|
}) {
|
|
@@ -7748,7 +7779,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
7748
7779
|
description: rulesyncFrontmatter.description
|
|
7749
7780
|
};
|
|
7750
7781
|
return {
|
|
7751
|
-
baseDir
|
|
7782
|
+
baseDir,
|
|
7752
7783
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
7753
7784
|
dirName: rulesyncSkill.getDirName(),
|
|
7754
7785
|
frontmatter: simulatedFrontmatter,
|
|
@@ -7764,8 +7795,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
7764
7795
|
}) {
|
|
7765
7796
|
const settablePaths = this.getSettablePaths();
|
|
7766
7797
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
7767
|
-
const skillDirPath = (0,
|
|
7768
|
-
const skillFilePath = (0,
|
|
7798
|
+
const skillDirPath = (0, import_node_path58.join)(baseDir, actualRelativeDirPath, dirName);
|
|
7799
|
+
const skillFilePath = (0, import_node_path58.join)(skillDirPath, SKILL_FILE_NAME);
|
|
7769
7800
|
if (!await fileExists(skillFilePath)) {
|
|
7770
7801
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
7771
7802
|
}
|
|
@@ -7842,7 +7873,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
7842
7873
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
7843
7874
|
}
|
|
7844
7875
|
return {
|
|
7845
|
-
relativeDirPath: (0,
|
|
7876
|
+
relativeDirPath: (0, import_node_path59.join)(".agents", "skills")
|
|
7846
7877
|
};
|
|
7847
7878
|
}
|
|
7848
7879
|
static async fromDir(params) {
|
|
@@ -7869,11 +7900,11 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
7869
7900
|
};
|
|
7870
7901
|
|
|
7871
7902
|
// src/features/skills/factorydroid-skill.ts
|
|
7872
|
-
var
|
|
7903
|
+
var import_node_path60 = require("path");
|
|
7873
7904
|
var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
7874
7905
|
static getSettablePaths(_options) {
|
|
7875
7906
|
return {
|
|
7876
|
-
relativeDirPath: (0,
|
|
7907
|
+
relativeDirPath: (0, import_node_path60.join)(".factory", "skills")
|
|
7877
7908
|
};
|
|
7878
7909
|
}
|
|
7879
7910
|
static async fromDir(params) {
|
|
@@ -7900,11 +7931,11 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
|
7900
7931
|
};
|
|
7901
7932
|
|
|
7902
7933
|
// src/features/skills/skills-processor.ts
|
|
7903
|
-
var
|
|
7904
|
-
var
|
|
7934
|
+
var import_node_path78 = require("path");
|
|
7935
|
+
var import_mini39 = require("zod/mini");
|
|
7905
7936
|
|
|
7906
7937
|
// src/types/dir-feature-processor.ts
|
|
7907
|
-
var
|
|
7938
|
+
var import_node_path61 = require("path");
|
|
7908
7939
|
var DirFeatureProcessor = class {
|
|
7909
7940
|
baseDir;
|
|
7910
7941
|
dryRun;
|
|
@@ -7935,7 +7966,7 @@ var DirFeatureProcessor = class {
|
|
|
7935
7966
|
const mainFile = aiDir.getMainFile();
|
|
7936
7967
|
let mainFileContent;
|
|
7937
7968
|
if (mainFile) {
|
|
7938
|
-
const mainFilePath = (0,
|
|
7969
|
+
const mainFilePath = (0, import_node_path61.join)(dirPath, mainFile.name);
|
|
7939
7970
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
7940
7971
|
mainFileContent = addTrailingNewline(content);
|
|
7941
7972
|
const existingContent = await readFileContentOrNull(mainFilePath);
|
|
@@ -7949,7 +7980,7 @@ var DirFeatureProcessor = class {
|
|
|
7949
7980
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
7950
7981
|
otherFileContents.push(contentWithNewline);
|
|
7951
7982
|
if (!dirHasChanges) {
|
|
7952
|
-
const filePath = (0,
|
|
7983
|
+
const filePath = (0, import_node_path61.join)(dirPath, file.relativeFilePathToDirPath);
|
|
7953
7984
|
const existingContent = await readFileContentOrNull(filePath);
|
|
7954
7985
|
if (existingContent !== contentWithNewline) {
|
|
7955
7986
|
dirHasChanges = true;
|
|
@@ -7963,22 +7994,22 @@ var DirFeatureProcessor = class {
|
|
|
7963
7994
|
if (this.dryRun) {
|
|
7964
7995
|
logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
7965
7996
|
if (mainFile) {
|
|
7966
|
-
logger.info(`[DRY RUN] Would write: ${(0,
|
|
7967
|
-
changedPaths.push((0,
|
|
7997
|
+
logger.info(`[DRY RUN] Would write: ${(0, import_node_path61.join)(dirPath, mainFile.name)}`);
|
|
7998
|
+
changedPaths.push((0, import_node_path61.join)(relativeDir, mainFile.name));
|
|
7968
7999
|
}
|
|
7969
8000
|
for (const file of otherFiles) {
|
|
7970
|
-
logger.info(`[DRY RUN] Would write: ${(0,
|
|
7971
|
-
changedPaths.push((0,
|
|
8001
|
+
logger.info(`[DRY RUN] Would write: ${(0, import_node_path61.join)(dirPath, file.relativeFilePathToDirPath)}`);
|
|
8002
|
+
changedPaths.push((0, import_node_path61.join)(relativeDir, file.relativeFilePathToDirPath));
|
|
7972
8003
|
}
|
|
7973
8004
|
} else {
|
|
7974
8005
|
await ensureDir(dirPath);
|
|
7975
8006
|
if (mainFile && mainFileContent) {
|
|
7976
|
-
const mainFilePath = (0,
|
|
8007
|
+
const mainFilePath = (0, import_node_path61.join)(dirPath, mainFile.name);
|
|
7977
8008
|
await writeFileContent(mainFilePath, mainFileContent);
|
|
7978
|
-
changedPaths.push((0,
|
|
8009
|
+
changedPaths.push((0, import_node_path61.join)(relativeDir, mainFile.name));
|
|
7979
8010
|
}
|
|
7980
8011
|
for (const [i, file] of otherFiles.entries()) {
|
|
7981
|
-
const filePath = (0,
|
|
8012
|
+
const filePath = (0, import_node_path61.join)(dirPath, file.relativeFilePathToDirPath);
|
|
7982
8013
|
const content = otherFileContents[i];
|
|
7983
8014
|
if (content === void 0) {
|
|
7984
8015
|
throw new Error(
|
|
@@ -7986,7 +8017,7 @@ var DirFeatureProcessor = class {
|
|
|
7986
8017
|
);
|
|
7987
8018
|
}
|
|
7988
8019
|
await writeFileContent(filePath, content);
|
|
7989
|
-
changedPaths.push((0,
|
|
8020
|
+
changedPaths.push((0, import_node_path61.join)(relativeDir, file.relativeFilePathToDirPath));
|
|
7990
8021
|
}
|
|
7991
8022
|
}
|
|
7992
8023
|
changedCount++;
|
|
@@ -8018,11 +8049,11 @@ var DirFeatureProcessor = class {
|
|
|
8018
8049
|
};
|
|
8019
8050
|
|
|
8020
8051
|
// src/features/skills/agentsskills-skill.ts
|
|
8021
|
-
var
|
|
8052
|
+
var import_node_path63 = require("path");
|
|
8022
8053
|
var import_mini25 = require("zod/mini");
|
|
8023
8054
|
|
|
8024
8055
|
// src/features/skills/rulesync-skill.ts
|
|
8025
|
-
var
|
|
8056
|
+
var import_node_path62 = require("path");
|
|
8026
8057
|
var import_mini24 = require("zod/mini");
|
|
8027
8058
|
var RulesyncSkillFrontmatterSchemaInternal = import_mini24.z.looseObject({
|
|
8028
8059
|
name: import_mini24.z.string(),
|
|
@@ -8091,7 +8122,7 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
8091
8122
|
}
|
|
8092
8123
|
getFrontmatter() {
|
|
8093
8124
|
if (!this.mainFile?.frontmatter) {
|
|
8094
|
-
throw new Error(`Frontmatter is not defined in ${(0,
|
|
8125
|
+
throw new Error(`Frontmatter is not defined in ${(0, import_node_path62.join)(this.relativeDirPath, this.dirName)}`);
|
|
8095
8126
|
}
|
|
8096
8127
|
const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
8097
8128
|
return result;
|
|
@@ -8117,8 +8148,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
8117
8148
|
dirName,
|
|
8118
8149
|
global = false
|
|
8119
8150
|
}) {
|
|
8120
|
-
const skillDirPath = (0,
|
|
8121
|
-
const skillFilePath = (0,
|
|
8151
|
+
const skillDirPath = (0, import_node_path62.join)(baseDir, relativeDirPath, dirName);
|
|
8152
|
+
const skillFilePath = (0, import_node_path62.join)(skillDirPath, SKILL_FILE_NAME);
|
|
8122
8153
|
if (!await fileExists(skillFilePath)) {
|
|
8123
8154
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8124
8155
|
}
|
|
@@ -8155,7 +8186,7 @@ var AgentsSkillsSkillFrontmatterSchema = import_mini25.z.looseObject({
|
|
|
8155
8186
|
var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
8156
8187
|
constructor({
|
|
8157
8188
|
baseDir = process.cwd(),
|
|
8158
|
-
relativeDirPath = (0,
|
|
8189
|
+
relativeDirPath = (0, import_node_path63.join)(".agents", "skills"),
|
|
8159
8190
|
dirName,
|
|
8160
8191
|
frontmatter,
|
|
8161
8192
|
body,
|
|
@@ -8187,7 +8218,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8187
8218
|
throw new Error("AgentsSkillsSkill does not support global mode.");
|
|
8188
8219
|
}
|
|
8189
8220
|
return {
|
|
8190
|
-
relativeDirPath: (0,
|
|
8221
|
+
relativeDirPath: (0, import_node_path63.join)(".agents", "skills")
|
|
8191
8222
|
};
|
|
8192
8223
|
}
|
|
8193
8224
|
getFrontmatter() {
|
|
@@ -8234,6 +8265,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8234
8265
|
});
|
|
8235
8266
|
}
|
|
8236
8267
|
static fromRulesyncSkill({
|
|
8268
|
+
baseDir = process.cwd(),
|
|
8237
8269
|
rulesyncSkill,
|
|
8238
8270
|
validate = true,
|
|
8239
8271
|
global = false
|
|
@@ -8245,7 +8277,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8245
8277
|
description: rulesyncFrontmatter.description
|
|
8246
8278
|
};
|
|
8247
8279
|
return new _AgentsSkillsSkill({
|
|
8248
|
-
baseDir
|
|
8280
|
+
baseDir,
|
|
8249
8281
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
8250
8282
|
dirName: rulesyncSkill.getDirName(),
|
|
8251
8283
|
frontmatter: agentsSkillsFrontmatter,
|
|
@@ -8266,9 +8298,9 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8266
8298
|
});
|
|
8267
8299
|
const result = AgentsSkillsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8268
8300
|
if (!result.success) {
|
|
8269
|
-
const skillDirPath = (0,
|
|
8301
|
+
const skillDirPath = (0, import_node_path63.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8270
8302
|
throw new Error(
|
|
8271
|
-
`Invalid frontmatter in ${(0,
|
|
8303
|
+
`Invalid frontmatter in ${(0, import_node_path63.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8272
8304
|
);
|
|
8273
8305
|
}
|
|
8274
8306
|
return new _AgentsSkillsSkill({
|
|
@@ -8303,7 +8335,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8303
8335
|
};
|
|
8304
8336
|
|
|
8305
8337
|
// src/features/skills/antigravity-skill.ts
|
|
8306
|
-
var
|
|
8338
|
+
var import_node_path64 = require("path");
|
|
8307
8339
|
var import_mini26 = require("zod/mini");
|
|
8308
8340
|
var AntigravitySkillFrontmatterSchema = import_mini26.z.looseObject({
|
|
8309
8341
|
name: import_mini26.z.string(),
|
|
@@ -8312,7 +8344,7 @@ var AntigravitySkillFrontmatterSchema = import_mini26.z.looseObject({
|
|
|
8312
8344
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
8313
8345
|
constructor({
|
|
8314
8346
|
baseDir = process.cwd(),
|
|
8315
|
-
relativeDirPath = (0,
|
|
8347
|
+
relativeDirPath = (0, import_node_path64.join)(".agent", "skills"),
|
|
8316
8348
|
dirName,
|
|
8317
8349
|
frontmatter,
|
|
8318
8350
|
body,
|
|
@@ -8344,11 +8376,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8344
8376
|
} = {}) {
|
|
8345
8377
|
if (global) {
|
|
8346
8378
|
return {
|
|
8347
|
-
relativeDirPath: (0,
|
|
8379
|
+
relativeDirPath: (0, import_node_path64.join)(".gemini", "antigravity", "skills")
|
|
8348
8380
|
};
|
|
8349
8381
|
}
|
|
8350
8382
|
return {
|
|
8351
|
-
relativeDirPath: (0,
|
|
8383
|
+
relativeDirPath: (0, import_node_path64.join)(".agent", "skills")
|
|
8352
8384
|
};
|
|
8353
8385
|
}
|
|
8354
8386
|
getFrontmatter() {
|
|
@@ -8395,6 +8427,7 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8395
8427
|
});
|
|
8396
8428
|
}
|
|
8397
8429
|
static fromRulesyncSkill({
|
|
8430
|
+
baseDir = process.cwd(),
|
|
8398
8431
|
rulesyncSkill,
|
|
8399
8432
|
validate = true,
|
|
8400
8433
|
global = false
|
|
@@ -8406,7 +8439,7 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8406
8439
|
};
|
|
8407
8440
|
const settablePaths = _AntigravitySkill.getSettablePaths({ global });
|
|
8408
8441
|
return new _AntigravitySkill({
|
|
8409
|
-
baseDir
|
|
8442
|
+
baseDir,
|
|
8410
8443
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
8411
8444
|
dirName: rulesyncSkill.getDirName(),
|
|
8412
8445
|
frontmatter: antigravityFrontmatter,
|
|
@@ -8427,9 +8460,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8427
8460
|
});
|
|
8428
8461
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8429
8462
|
if (!result.success) {
|
|
8430
|
-
const skillDirPath = (0,
|
|
8463
|
+
const skillDirPath = (0, import_node_path64.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8431
8464
|
throw new Error(
|
|
8432
|
-
`Invalid frontmatter in ${(0,
|
|
8465
|
+
`Invalid frontmatter in ${(0, import_node_path64.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8433
8466
|
);
|
|
8434
8467
|
}
|
|
8435
8468
|
return new _AntigravitySkill({
|
|
@@ -8463,7 +8496,7 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8463
8496
|
};
|
|
8464
8497
|
|
|
8465
8498
|
// src/features/skills/claudecode-skill.ts
|
|
8466
|
-
var
|
|
8499
|
+
var import_node_path65 = require("path");
|
|
8467
8500
|
var import_mini27 = require("zod/mini");
|
|
8468
8501
|
var ClaudecodeSkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
8469
8502
|
name: import_mini27.z.string(),
|
|
@@ -8475,7 +8508,7 @@ var ClaudecodeSkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
|
8475
8508
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
8476
8509
|
constructor({
|
|
8477
8510
|
baseDir = process.cwd(),
|
|
8478
|
-
relativeDirPath = (0,
|
|
8511
|
+
relativeDirPath = (0, import_node_path65.join)(".claude", "skills"),
|
|
8479
8512
|
dirName,
|
|
8480
8513
|
frontmatter,
|
|
8481
8514
|
body,
|
|
@@ -8506,7 +8539,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8506
8539
|
global: _global = false
|
|
8507
8540
|
} = {}) {
|
|
8508
8541
|
return {
|
|
8509
|
-
relativeDirPath: (0,
|
|
8542
|
+
relativeDirPath: (0, import_node_path65.join)(".claude", "skills")
|
|
8510
8543
|
};
|
|
8511
8544
|
}
|
|
8512
8545
|
getFrontmatter() {
|
|
@@ -8561,6 +8594,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8561
8594
|
});
|
|
8562
8595
|
}
|
|
8563
8596
|
static fromRulesyncSkill({
|
|
8597
|
+
baseDir = process.cwd(),
|
|
8564
8598
|
rulesyncSkill,
|
|
8565
8599
|
validate = true,
|
|
8566
8600
|
global = false
|
|
@@ -8581,7 +8615,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8581
8615
|
};
|
|
8582
8616
|
const settablePaths = _ClaudecodeSkill.getSettablePaths({ global });
|
|
8583
8617
|
return new _ClaudecodeSkill({
|
|
8584
|
-
baseDir
|
|
8618
|
+
baseDir,
|
|
8585
8619
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
8586
8620
|
dirName: rulesyncSkill.getDirName(),
|
|
8587
8621
|
frontmatter: claudecodeFrontmatter,
|
|
@@ -8602,9 +8636,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8602
8636
|
});
|
|
8603
8637
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8604
8638
|
if (!result.success) {
|
|
8605
|
-
const skillDirPath = (0,
|
|
8639
|
+
const skillDirPath = (0, import_node_path65.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8606
8640
|
throw new Error(
|
|
8607
|
-
`Invalid frontmatter in ${(0,
|
|
8641
|
+
`Invalid frontmatter in ${(0, import_node_path65.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8608
8642
|
);
|
|
8609
8643
|
}
|
|
8610
8644
|
return new _ClaudecodeSkill({
|
|
@@ -8638,7 +8672,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8638
8672
|
};
|
|
8639
8673
|
|
|
8640
8674
|
// src/features/skills/cline-skill.ts
|
|
8641
|
-
var
|
|
8675
|
+
var import_node_path66 = require("path");
|
|
8642
8676
|
var import_mini28 = require("zod/mini");
|
|
8643
8677
|
var ClineSkillFrontmatterSchema = import_mini28.z.looseObject({
|
|
8644
8678
|
name: import_mini28.z.string(),
|
|
@@ -8647,7 +8681,7 @@ var ClineSkillFrontmatterSchema = import_mini28.z.looseObject({
|
|
|
8647
8681
|
var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
8648
8682
|
constructor({
|
|
8649
8683
|
baseDir = process.cwd(),
|
|
8650
|
-
relativeDirPath = (0,
|
|
8684
|
+
relativeDirPath = (0, import_node_path66.join)(".cline", "skills"),
|
|
8651
8685
|
dirName,
|
|
8652
8686
|
frontmatter,
|
|
8653
8687
|
body,
|
|
@@ -8676,7 +8710,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
8676
8710
|
}
|
|
8677
8711
|
static getSettablePaths(_options = {}) {
|
|
8678
8712
|
return {
|
|
8679
|
-
relativeDirPath: (0,
|
|
8713
|
+
relativeDirPath: (0, import_node_path66.join)(".cline", "skills")
|
|
8680
8714
|
};
|
|
8681
8715
|
}
|
|
8682
8716
|
getFrontmatter() {
|
|
@@ -8731,6 +8765,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
8731
8765
|
});
|
|
8732
8766
|
}
|
|
8733
8767
|
static fromRulesyncSkill({
|
|
8768
|
+
baseDir = process.cwd(),
|
|
8734
8769
|
rulesyncSkill,
|
|
8735
8770
|
validate = true,
|
|
8736
8771
|
global = false
|
|
@@ -8742,7 +8777,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
8742
8777
|
description: rulesyncFrontmatter.description
|
|
8743
8778
|
};
|
|
8744
8779
|
return new _ClineSkill({
|
|
8745
|
-
baseDir
|
|
8780
|
+
baseDir,
|
|
8746
8781
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
8747
8782
|
dirName: clineFrontmatter.name,
|
|
8748
8783
|
frontmatter: clineFrontmatter,
|
|
@@ -8763,13 +8798,13 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
8763
8798
|
});
|
|
8764
8799
|
const result = ClineSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8765
8800
|
if (!result.success) {
|
|
8766
|
-
const skillDirPath = (0,
|
|
8801
|
+
const skillDirPath = (0, import_node_path66.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8767
8802
|
throw new Error(
|
|
8768
|
-
`Invalid frontmatter in ${(0,
|
|
8803
|
+
`Invalid frontmatter in ${(0, import_node_path66.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8769
8804
|
);
|
|
8770
8805
|
}
|
|
8771
8806
|
if (result.data.name !== loaded.dirName) {
|
|
8772
|
-
const skillFilePath = (0,
|
|
8807
|
+
const skillFilePath = (0, import_node_path66.join)(
|
|
8773
8808
|
loaded.baseDir,
|
|
8774
8809
|
loaded.relativeDirPath,
|
|
8775
8810
|
loaded.dirName,
|
|
@@ -8810,7 +8845,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
8810
8845
|
};
|
|
8811
8846
|
|
|
8812
8847
|
// src/features/skills/codexcli-skill.ts
|
|
8813
|
-
var
|
|
8848
|
+
var import_node_path67 = require("path");
|
|
8814
8849
|
var import_mini29 = require("zod/mini");
|
|
8815
8850
|
var CodexCliSkillFrontmatterSchema = import_mini29.z.looseObject({
|
|
8816
8851
|
name: import_mini29.z.string(),
|
|
@@ -8824,7 +8859,7 @@ var CodexCliSkillFrontmatterSchema = import_mini29.z.looseObject({
|
|
|
8824
8859
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
8825
8860
|
constructor({
|
|
8826
8861
|
baseDir = process.cwd(),
|
|
8827
|
-
relativeDirPath = (0,
|
|
8862
|
+
relativeDirPath = (0, import_node_path67.join)(".codex", "skills"),
|
|
8828
8863
|
dirName,
|
|
8829
8864
|
frontmatter,
|
|
8830
8865
|
body,
|
|
@@ -8855,7 +8890,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
8855
8890
|
global: _global = false
|
|
8856
8891
|
} = {}) {
|
|
8857
8892
|
return {
|
|
8858
|
-
relativeDirPath: (0,
|
|
8893
|
+
relativeDirPath: (0, import_node_path67.join)(".codex", "skills")
|
|
8859
8894
|
};
|
|
8860
8895
|
}
|
|
8861
8896
|
getFrontmatter() {
|
|
@@ -8907,6 +8942,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
8907
8942
|
});
|
|
8908
8943
|
}
|
|
8909
8944
|
static fromRulesyncSkill({
|
|
8945
|
+
baseDir = process.cwd(),
|
|
8910
8946
|
rulesyncSkill,
|
|
8911
8947
|
validate = true,
|
|
8912
8948
|
global = false
|
|
@@ -8923,7 +8959,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
8923
8959
|
}
|
|
8924
8960
|
};
|
|
8925
8961
|
return new _CodexCliSkill({
|
|
8926
|
-
baseDir
|
|
8962
|
+
baseDir,
|
|
8927
8963
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
8928
8964
|
dirName: rulesyncSkill.getDirName(),
|
|
8929
8965
|
frontmatter: codexFrontmatter,
|
|
@@ -8944,9 +8980,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
8944
8980
|
});
|
|
8945
8981
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8946
8982
|
if (!result.success) {
|
|
8947
|
-
const skillDirPath = (0,
|
|
8983
|
+
const skillDirPath = (0, import_node_path67.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8948
8984
|
throw new Error(
|
|
8949
|
-
`Invalid frontmatter in ${(0,
|
|
8985
|
+
`Invalid frontmatter in ${(0, import_node_path67.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8950
8986
|
);
|
|
8951
8987
|
}
|
|
8952
8988
|
return new _CodexCliSkill({
|
|
@@ -8980,7 +9016,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
8980
9016
|
};
|
|
8981
9017
|
|
|
8982
9018
|
// src/features/skills/copilot-skill.ts
|
|
8983
|
-
var
|
|
9019
|
+
var import_node_path68 = require("path");
|
|
8984
9020
|
var import_mini30 = require("zod/mini");
|
|
8985
9021
|
var CopilotSkillFrontmatterSchema = import_mini30.z.looseObject({
|
|
8986
9022
|
name: import_mini30.z.string(),
|
|
@@ -8990,7 +9026,7 @@ var CopilotSkillFrontmatterSchema = import_mini30.z.looseObject({
|
|
|
8990
9026
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
8991
9027
|
constructor({
|
|
8992
9028
|
baseDir = process.cwd(),
|
|
8993
|
-
relativeDirPath = (0,
|
|
9029
|
+
relativeDirPath = (0, import_node_path68.join)(".github", "skills"),
|
|
8994
9030
|
dirName,
|
|
8995
9031
|
frontmatter,
|
|
8996
9032
|
body,
|
|
@@ -9022,7 +9058,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9022
9058
|
throw new Error("CopilotSkill does not support global mode.");
|
|
9023
9059
|
}
|
|
9024
9060
|
return {
|
|
9025
|
-
relativeDirPath: (0,
|
|
9061
|
+
relativeDirPath: (0, import_node_path68.join)(".github", "skills")
|
|
9026
9062
|
};
|
|
9027
9063
|
}
|
|
9028
9064
|
getFrontmatter() {
|
|
@@ -9074,6 +9110,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9074
9110
|
});
|
|
9075
9111
|
}
|
|
9076
9112
|
static fromRulesyncSkill({
|
|
9113
|
+
baseDir = process.cwd(),
|
|
9077
9114
|
rulesyncSkill,
|
|
9078
9115
|
validate = true,
|
|
9079
9116
|
global = false
|
|
@@ -9086,7 +9123,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9086
9123
|
license: rulesyncFrontmatter.copilot?.license
|
|
9087
9124
|
};
|
|
9088
9125
|
return new _CopilotSkill({
|
|
9089
|
-
baseDir
|
|
9126
|
+
baseDir,
|
|
9090
9127
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
9091
9128
|
dirName: rulesyncSkill.getDirName(),
|
|
9092
9129
|
frontmatter: copilotFrontmatter,
|
|
@@ -9107,9 +9144,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9107
9144
|
});
|
|
9108
9145
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9109
9146
|
if (!result.success) {
|
|
9110
|
-
const skillDirPath = (0,
|
|
9147
|
+
const skillDirPath = (0, import_node_path68.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9111
9148
|
throw new Error(
|
|
9112
|
-
`Invalid frontmatter in ${(0,
|
|
9149
|
+
`Invalid frontmatter in ${(0, import_node_path68.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9113
9150
|
);
|
|
9114
9151
|
}
|
|
9115
9152
|
return new _CopilotSkill({
|
|
@@ -9144,7 +9181,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9144
9181
|
};
|
|
9145
9182
|
|
|
9146
9183
|
// src/features/skills/cursor-skill.ts
|
|
9147
|
-
var
|
|
9184
|
+
var import_node_path69 = require("path");
|
|
9148
9185
|
var import_mini31 = require("zod/mini");
|
|
9149
9186
|
var CursorSkillFrontmatterSchema = import_mini31.z.looseObject({
|
|
9150
9187
|
name: import_mini31.z.string(),
|
|
@@ -9153,7 +9190,7 @@ var CursorSkillFrontmatterSchema = import_mini31.z.looseObject({
|
|
|
9153
9190
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
9154
9191
|
constructor({
|
|
9155
9192
|
baseDir = process.cwd(),
|
|
9156
|
-
relativeDirPath = (0,
|
|
9193
|
+
relativeDirPath = (0, import_node_path69.join)(".cursor", "skills"),
|
|
9157
9194
|
dirName,
|
|
9158
9195
|
frontmatter,
|
|
9159
9196
|
body,
|
|
@@ -9182,7 +9219,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9182
9219
|
}
|
|
9183
9220
|
static getSettablePaths(_options) {
|
|
9184
9221
|
return {
|
|
9185
|
-
relativeDirPath: (0,
|
|
9222
|
+
relativeDirPath: (0, import_node_path69.join)(".cursor", "skills")
|
|
9186
9223
|
};
|
|
9187
9224
|
}
|
|
9188
9225
|
getFrontmatter() {
|
|
@@ -9229,6 +9266,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9229
9266
|
});
|
|
9230
9267
|
}
|
|
9231
9268
|
static fromRulesyncSkill({
|
|
9269
|
+
baseDir = process.cwd(),
|
|
9232
9270
|
rulesyncSkill,
|
|
9233
9271
|
validate = true,
|
|
9234
9272
|
global = false
|
|
@@ -9240,7 +9278,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9240
9278
|
description: rulesyncFrontmatter.description
|
|
9241
9279
|
};
|
|
9242
9280
|
return new _CursorSkill({
|
|
9243
|
-
baseDir
|
|
9281
|
+
baseDir,
|
|
9244
9282
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
9245
9283
|
dirName: rulesyncSkill.getDirName(),
|
|
9246
9284
|
frontmatter: cursorFrontmatter,
|
|
@@ -9261,9 +9299,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9261
9299
|
});
|
|
9262
9300
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9263
9301
|
if (!result.success) {
|
|
9264
|
-
const skillDirPath = (0,
|
|
9302
|
+
const skillDirPath = (0, import_node_path69.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9265
9303
|
throw new Error(
|
|
9266
|
-
`Invalid frontmatter in ${(0,
|
|
9304
|
+
`Invalid frontmatter in ${(0, import_node_path69.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9267
9305
|
);
|
|
9268
9306
|
}
|
|
9269
9307
|
return new _CursorSkill({
|
|
@@ -9298,7 +9336,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9298
9336
|
};
|
|
9299
9337
|
|
|
9300
9338
|
// src/features/skills/geminicli-skill.ts
|
|
9301
|
-
var
|
|
9339
|
+
var import_node_path70 = require("path");
|
|
9302
9340
|
var import_mini32 = require("zod/mini");
|
|
9303
9341
|
var GeminiCliSkillFrontmatterSchema = import_mini32.z.looseObject({
|
|
9304
9342
|
name: import_mini32.z.string(),
|
|
@@ -9338,7 +9376,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9338
9376
|
global: _global = false
|
|
9339
9377
|
} = {}) {
|
|
9340
9378
|
return {
|
|
9341
|
-
relativeDirPath: (0,
|
|
9379
|
+
relativeDirPath: (0, import_node_path70.join)(".gemini", "skills")
|
|
9342
9380
|
};
|
|
9343
9381
|
}
|
|
9344
9382
|
getFrontmatter() {
|
|
@@ -9385,6 +9423,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9385
9423
|
});
|
|
9386
9424
|
}
|
|
9387
9425
|
static fromRulesyncSkill({
|
|
9426
|
+
baseDir = process.cwd(),
|
|
9388
9427
|
rulesyncSkill,
|
|
9389
9428
|
validate = true,
|
|
9390
9429
|
global = false
|
|
@@ -9396,7 +9435,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9396
9435
|
description: rulesyncFrontmatter.description
|
|
9397
9436
|
};
|
|
9398
9437
|
return new _GeminiCliSkill({
|
|
9399
|
-
baseDir
|
|
9438
|
+
baseDir,
|
|
9400
9439
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
9401
9440
|
dirName: rulesyncSkill.getDirName(),
|
|
9402
9441
|
frontmatter: geminiCliFrontmatter,
|
|
@@ -9417,9 +9456,9 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9417
9456
|
});
|
|
9418
9457
|
const result = GeminiCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9419
9458
|
if (!result.success) {
|
|
9420
|
-
const skillDirPath = (0,
|
|
9459
|
+
const skillDirPath = (0, import_node_path70.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9421
9460
|
throw new Error(
|
|
9422
|
-
`Invalid frontmatter in ${(0,
|
|
9461
|
+
`Invalid frontmatter in ${(0, import_node_path70.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9423
9462
|
);
|
|
9424
9463
|
}
|
|
9425
9464
|
return new _GeminiCliSkill({
|
|
@@ -9453,17 +9492,193 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9453
9492
|
}
|
|
9454
9493
|
};
|
|
9455
9494
|
|
|
9456
|
-
// src/features/skills/
|
|
9457
|
-
var
|
|
9495
|
+
// src/features/skills/junie-skill.ts
|
|
9496
|
+
var import_node_path71 = require("path");
|
|
9458
9497
|
var import_mini33 = require("zod/mini");
|
|
9459
|
-
var
|
|
9498
|
+
var JunieSkillFrontmatterSchema = import_mini33.z.looseObject({
|
|
9460
9499
|
name: import_mini33.z.string(),
|
|
9461
9500
|
description: import_mini33.z.string()
|
|
9462
9501
|
});
|
|
9502
|
+
var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
9503
|
+
constructor({
|
|
9504
|
+
baseDir = process.cwd(),
|
|
9505
|
+
relativeDirPath = (0, import_node_path71.join)(".junie", "skills"),
|
|
9506
|
+
dirName,
|
|
9507
|
+
frontmatter,
|
|
9508
|
+
body,
|
|
9509
|
+
otherFiles = [],
|
|
9510
|
+
validate = true,
|
|
9511
|
+
global = false
|
|
9512
|
+
}) {
|
|
9513
|
+
super({
|
|
9514
|
+
baseDir,
|
|
9515
|
+
relativeDirPath,
|
|
9516
|
+
dirName,
|
|
9517
|
+
mainFile: {
|
|
9518
|
+
name: SKILL_FILE_NAME,
|
|
9519
|
+
body,
|
|
9520
|
+
frontmatter: { ...frontmatter }
|
|
9521
|
+
},
|
|
9522
|
+
otherFiles,
|
|
9523
|
+
global
|
|
9524
|
+
});
|
|
9525
|
+
if (validate) {
|
|
9526
|
+
const result = this.validate();
|
|
9527
|
+
if (!result.success) {
|
|
9528
|
+
throw result.error;
|
|
9529
|
+
}
|
|
9530
|
+
}
|
|
9531
|
+
}
|
|
9532
|
+
static getSettablePaths(options) {
|
|
9533
|
+
if (options?.global) {
|
|
9534
|
+
throw new Error("JunieSkill does not support global mode.");
|
|
9535
|
+
}
|
|
9536
|
+
return {
|
|
9537
|
+
relativeDirPath: (0, import_node_path71.join)(".junie", "skills")
|
|
9538
|
+
};
|
|
9539
|
+
}
|
|
9540
|
+
getFrontmatter() {
|
|
9541
|
+
const result = JunieSkillFrontmatterSchema.parse(this.requireMainFileFrontmatter());
|
|
9542
|
+
return result;
|
|
9543
|
+
}
|
|
9544
|
+
getBody() {
|
|
9545
|
+
return this.mainFile?.body ?? "";
|
|
9546
|
+
}
|
|
9547
|
+
validate() {
|
|
9548
|
+
if (!this.mainFile) {
|
|
9549
|
+
return {
|
|
9550
|
+
success: false,
|
|
9551
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
9552
|
+
};
|
|
9553
|
+
}
|
|
9554
|
+
const result = JunieSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
9555
|
+
if (!result.success) {
|
|
9556
|
+
return {
|
|
9557
|
+
success: false,
|
|
9558
|
+
error: new Error(
|
|
9559
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
9560
|
+
)
|
|
9561
|
+
};
|
|
9562
|
+
}
|
|
9563
|
+
if (result.data.name !== this.getDirName()) {
|
|
9564
|
+
return {
|
|
9565
|
+
success: false,
|
|
9566
|
+
error: new Error(
|
|
9567
|
+
`${this.getDirPath()}: frontmatter name (${result.data.name}) must match directory name (${this.getDirName()})`
|
|
9568
|
+
)
|
|
9569
|
+
};
|
|
9570
|
+
}
|
|
9571
|
+
return { success: true, error: null };
|
|
9572
|
+
}
|
|
9573
|
+
toRulesyncSkill() {
|
|
9574
|
+
const frontmatter = this.getFrontmatter();
|
|
9575
|
+
const rulesyncFrontmatter = {
|
|
9576
|
+
name: frontmatter.name,
|
|
9577
|
+
description: frontmatter.description,
|
|
9578
|
+
targets: ["*"]
|
|
9579
|
+
};
|
|
9580
|
+
return new RulesyncSkill({
|
|
9581
|
+
baseDir: this.baseDir,
|
|
9582
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
9583
|
+
dirName: this.getDirName(),
|
|
9584
|
+
frontmatter: rulesyncFrontmatter,
|
|
9585
|
+
body: this.getBody(),
|
|
9586
|
+
otherFiles: this.getOtherFiles(),
|
|
9587
|
+
validate: true,
|
|
9588
|
+
global: this.global
|
|
9589
|
+
});
|
|
9590
|
+
}
|
|
9591
|
+
static fromRulesyncSkill({
|
|
9592
|
+
rulesyncSkill,
|
|
9593
|
+
validate = true,
|
|
9594
|
+
global = false
|
|
9595
|
+
}) {
|
|
9596
|
+
const settablePaths = _JunieSkill.getSettablePaths({ global });
|
|
9597
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
9598
|
+
const junieFrontmatter = {
|
|
9599
|
+
name: rulesyncFrontmatter.name,
|
|
9600
|
+
description: rulesyncFrontmatter.description
|
|
9601
|
+
};
|
|
9602
|
+
return new _JunieSkill({
|
|
9603
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
9604
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
9605
|
+
dirName: junieFrontmatter.name,
|
|
9606
|
+
frontmatter: junieFrontmatter,
|
|
9607
|
+
body: rulesyncSkill.getBody(),
|
|
9608
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
9609
|
+
validate,
|
|
9610
|
+
global
|
|
9611
|
+
});
|
|
9612
|
+
}
|
|
9613
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
9614
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
9615
|
+
return targets.includes("*") || targets.includes("junie");
|
|
9616
|
+
}
|
|
9617
|
+
static async fromDir(params) {
|
|
9618
|
+
const loaded = await this.loadSkillDirContent({
|
|
9619
|
+
...params,
|
|
9620
|
+
getSettablePaths: _JunieSkill.getSettablePaths
|
|
9621
|
+
});
|
|
9622
|
+
const result = JunieSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9623
|
+
if (!result.success) {
|
|
9624
|
+
const skillDirPath = (0, import_node_path71.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9625
|
+
throw new Error(
|
|
9626
|
+
`Invalid frontmatter in ${(0, import_node_path71.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9627
|
+
);
|
|
9628
|
+
}
|
|
9629
|
+
if (result.data.name !== loaded.dirName) {
|
|
9630
|
+
const skillFilePath = (0, import_node_path71.join)(
|
|
9631
|
+
loaded.baseDir,
|
|
9632
|
+
loaded.relativeDirPath,
|
|
9633
|
+
loaded.dirName,
|
|
9634
|
+
SKILL_FILE_NAME
|
|
9635
|
+
);
|
|
9636
|
+
throw new Error(
|
|
9637
|
+
`Frontmatter name (${result.data.name}) must match directory name (${loaded.dirName}) in ${skillFilePath}`
|
|
9638
|
+
);
|
|
9639
|
+
}
|
|
9640
|
+
return new _JunieSkill({
|
|
9641
|
+
baseDir: loaded.baseDir,
|
|
9642
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
9643
|
+
dirName: loaded.dirName,
|
|
9644
|
+
frontmatter: result.data,
|
|
9645
|
+
body: loaded.body,
|
|
9646
|
+
otherFiles: loaded.otherFiles,
|
|
9647
|
+
validate: true,
|
|
9648
|
+
global: loaded.global
|
|
9649
|
+
});
|
|
9650
|
+
}
|
|
9651
|
+
static forDeletion({
|
|
9652
|
+
baseDir = process.cwd(),
|
|
9653
|
+
relativeDirPath,
|
|
9654
|
+
dirName,
|
|
9655
|
+
global = false
|
|
9656
|
+
}) {
|
|
9657
|
+
const settablePaths = _JunieSkill.getSettablePaths({ global });
|
|
9658
|
+
return new _JunieSkill({
|
|
9659
|
+
baseDir,
|
|
9660
|
+
relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
|
|
9661
|
+
dirName,
|
|
9662
|
+
frontmatter: { name: "", description: "" },
|
|
9663
|
+
body: "",
|
|
9664
|
+
otherFiles: [],
|
|
9665
|
+
validate: false,
|
|
9666
|
+
global
|
|
9667
|
+
});
|
|
9668
|
+
}
|
|
9669
|
+
};
|
|
9670
|
+
|
|
9671
|
+
// src/features/skills/kilo-skill.ts
|
|
9672
|
+
var import_node_path72 = require("path");
|
|
9673
|
+
var import_mini34 = require("zod/mini");
|
|
9674
|
+
var KiloSkillFrontmatterSchema = import_mini34.z.looseObject({
|
|
9675
|
+
name: import_mini34.z.string(),
|
|
9676
|
+
description: import_mini34.z.string()
|
|
9677
|
+
});
|
|
9463
9678
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
9464
9679
|
constructor({
|
|
9465
9680
|
baseDir = process.cwd(),
|
|
9466
|
-
relativeDirPath = (0,
|
|
9681
|
+
relativeDirPath = (0, import_node_path72.join)(".kilocode", "skills"),
|
|
9467
9682
|
dirName,
|
|
9468
9683
|
frontmatter,
|
|
9469
9684
|
body,
|
|
@@ -9494,7 +9709,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9494
9709
|
global: _global = false
|
|
9495
9710
|
} = {}) {
|
|
9496
9711
|
return {
|
|
9497
|
-
relativeDirPath: (0,
|
|
9712
|
+
relativeDirPath: (0, import_node_path72.join)(".kilocode", "skills")
|
|
9498
9713
|
};
|
|
9499
9714
|
}
|
|
9500
9715
|
getFrontmatter() {
|
|
@@ -9549,6 +9764,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9549
9764
|
});
|
|
9550
9765
|
}
|
|
9551
9766
|
static fromRulesyncSkill({
|
|
9767
|
+
baseDir = process.cwd(),
|
|
9552
9768
|
rulesyncSkill,
|
|
9553
9769
|
validate = true,
|
|
9554
9770
|
global = false
|
|
@@ -9560,7 +9776,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9560
9776
|
description: rulesyncFrontmatter.description
|
|
9561
9777
|
};
|
|
9562
9778
|
return new _KiloSkill({
|
|
9563
|
-
baseDir
|
|
9779
|
+
baseDir,
|
|
9564
9780
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
9565
9781
|
dirName: kiloFrontmatter.name,
|
|
9566
9782
|
frontmatter: kiloFrontmatter,
|
|
@@ -9581,13 +9797,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9581
9797
|
});
|
|
9582
9798
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9583
9799
|
if (!result.success) {
|
|
9584
|
-
const skillDirPath = (0,
|
|
9800
|
+
const skillDirPath = (0, import_node_path72.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9585
9801
|
throw new Error(
|
|
9586
|
-
`Invalid frontmatter in ${(0,
|
|
9802
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9587
9803
|
);
|
|
9588
9804
|
}
|
|
9589
9805
|
if (result.data.name !== loaded.dirName) {
|
|
9590
|
-
const skillFilePath = (0,
|
|
9806
|
+
const skillFilePath = (0, import_node_path72.join)(
|
|
9591
9807
|
loaded.baseDir,
|
|
9592
9808
|
loaded.relativeDirPath,
|
|
9593
9809
|
loaded.dirName,
|
|
@@ -9628,16 +9844,16 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9628
9844
|
};
|
|
9629
9845
|
|
|
9630
9846
|
// src/features/skills/kiro-skill.ts
|
|
9631
|
-
var
|
|
9632
|
-
var
|
|
9633
|
-
var KiroSkillFrontmatterSchema =
|
|
9634
|
-
name:
|
|
9635
|
-
description:
|
|
9847
|
+
var import_node_path73 = require("path");
|
|
9848
|
+
var import_mini35 = require("zod/mini");
|
|
9849
|
+
var KiroSkillFrontmatterSchema = import_mini35.z.looseObject({
|
|
9850
|
+
name: import_mini35.z.string(),
|
|
9851
|
+
description: import_mini35.z.string()
|
|
9636
9852
|
});
|
|
9637
9853
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
9638
9854
|
constructor({
|
|
9639
9855
|
baseDir = process.cwd(),
|
|
9640
|
-
relativeDirPath = (0,
|
|
9856
|
+
relativeDirPath = (0, import_node_path73.join)(".kiro", "skills"),
|
|
9641
9857
|
dirName,
|
|
9642
9858
|
frontmatter,
|
|
9643
9859
|
body,
|
|
@@ -9669,7 +9885,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9669
9885
|
throw new Error("KiroSkill does not support global mode.");
|
|
9670
9886
|
}
|
|
9671
9887
|
return {
|
|
9672
|
-
relativeDirPath: (0,
|
|
9888
|
+
relativeDirPath: (0, import_node_path73.join)(".kiro", "skills")
|
|
9673
9889
|
};
|
|
9674
9890
|
}
|
|
9675
9891
|
getFrontmatter() {
|
|
@@ -9724,6 +9940,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9724
9940
|
});
|
|
9725
9941
|
}
|
|
9726
9942
|
static fromRulesyncSkill({
|
|
9943
|
+
baseDir = process.cwd(),
|
|
9727
9944
|
rulesyncSkill,
|
|
9728
9945
|
validate = true,
|
|
9729
9946
|
global = false
|
|
@@ -9735,7 +9952,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9735
9952
|
description: rulesyncFrontmatter.description
|
|
9736
9953
|
};
|
|
9737
9954
|
return new _KiroSkill({
|
|
9738
|
-
baseDir
|
|
9955
|
+
baseDir,
|
|
9739
9956
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
9740
9957
|
dirName: rulesyncSkill.getDirName(),
|
|
9741
9958
|
frontmatter: kiroFrontmatter,
|
|
@@ -9756,13 +9973,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9756
9973
|
});
|
|
9757
9974
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9758
9975
|
if (!result.success) {
|
|
9759
|
-
const skillDirPath = (0,
|
|
9976
|
+
const skillDirPath = (0, import_node_path73.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9760
9977
|
throw new Error(
|
|
9761
|
-
`Invalid frontmatter in ${(0,
|
|
9978
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9762
9979
|
);
|
|
9763
9980
|
}
|
|
9764
9981
|
if (result.data.name !== loaded.dirName) {
|
|
9765
|
-
const skillFilePath = (0,
|
|
9982
|
+
const skillFilePath = (0, import_node_path73.join)(
|
|
9766
9983
|
loaded.baseDir,
|
|
9767
9984
|
loaded.relativeDirPath,
|
|
9768
9985
|
loaded.dirName,
|
|
@@ -9804,17 +10021,17 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9804
10021
|
};
|
|
9805
10022
|
|
|
9806
10023
|
// src/features/skills/opencode-skill.ts
|
|
9807
|
-
var
|
|
9808
|
-
var
|
|
9809
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
9810
|
-
name:
|
|
9811
|
-
description:
|
|
9812
|
-
"allowed-tools":
|
|
10024
|
+
var import_node_path74 = require("path");
|
|
10025
|
+
var import_mini36 = require("zod/mini");
|
|
10026
|
+
var OpenCodeSkillFrontmatterSchema = import_mini36.z.looseObject({
|
|
10027
|
+
name: import_mini36.z.string(),
|
|
10028
|
+
description: import_mini36.z.string(),
|
|
10029
|
+
"allowed-tools": import_mini36.z.optional(import_mini36.z.array(import_mini36.z.string()))
|
|
9813
10030
|
});
|
|
9814
10031
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
9815
10032
|
constructor({
|
|
9816
10033
|
baseDir = process.cwd(),
|
|
9817
|
-
relativeDirPath = (0,
|
|
10034
|
+
relativeDirPath = (0, import_node_path74.join)(".opencode", "skill"),
|
|
9818
10035
|
dirName,
|
|
9819
10036
|
frontmatter,
|
|
9820
10037
|
body,
|
|
@@ -9843,7 +10060,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9843
10060
|
}
|
|
9844
10061
|
static getSettablePaths({ global = false } = {}) {
|
|
9845
10062
|
return {
|
|
9846
|
-
relativeDirPath: global ? (0,
|
|
10063
|
+
relativeDirPath: global ? (0, import_node_path74.join)(".config", "opencode", "skill") : (0, import_node_path74.join)(".opencode", "skill")
|
|
9847
10064
|
};
|
|
9848
10065
|
}
|
|
9849
10066
|
getFrontmatter() {
|
|
@@ -9895,6 +10112,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9895
10112
|
});
|
|
9896
10113
|
}
|
|
9897
10114
|
static fromRulesyncSkill({
|
|
10115
|
+
baseDir = process.cwd(),
|
|
9898
10116
|
rulesyncSkill,
|
|
9899
10117
|
validate = true,
|
|
9900
10118
|
global = false
|
|
@@ -9907,7 +10125,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9907
10125
|
};
|
|
9908
10126
|
const settablePaths = _OpenCodeSkill.getSettablePaths({ global });
|
|
9909
10127
|
return new _OpenCodeSkill({
|
|
9910
|
-
baseDir
|
|
10128
|
+
baseDir,
|
|
9911
10129
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
9912
10130
|
dirName: rulesyncSkill.getDirName(),
|
|
9913
10131
|
frontmatter: opencodeFrontmatter,
|
|
@@ -9928,9 +10146,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9928
10146
|
});
|
|
9929
10147
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9930
10148
|
if (!result.success) {
|
|
9931
|
-
const skillDirPath = (0,
|
|
10149
|
+
const skillDirPath = (0, import_node_path74.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9932
10150
|
throw new Error(
|
|
9933
|
-
`Invalid frontmatter in ${(0,
|
|
10151
|
+
`Invalid frontmatter in ${(0, import_node_path74.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9934
10152
|
);
|
|
9935
10153
|
}
|
|
9936
10154
|
return new _OpenCodeSkill({
|
|
@@ -9964,16 +10182,16 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9964
10182
|
};
|
|
9965
10183
|
|
|
9966
10184
|
// src/features/skills/replit-skill.ts
|
|
9967
|
-
var
|
|
9968
|
-
var
|
|
9969
|
-
var ReplitSkillFrontmatterSchema =
|
|
9970
|
-
name:
|
|
9971
|
-
description:
|
|
10185
|
+
var import_node_path75 = require("path");
|
|
10186
|
+
var import_mini37 = require("zod/mini");
|
|
10187
|
+
var ReplitSkillFrontmatterSchema = import_mini37.z.looseObject({
|
|
10188
|
+
name: import_mini37.z.string(),
|
|
10189
|
+
description: import_mini37.z.string()
|
|
9972
10190
|
});
|
|
9973
10191
|
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
9974
10192
|
constructor({
|
|
9975
10193
|
baseDir = process.cwd(),
|
|
9976
|
-
relativeDirPath = (0,
|
|
10194
|
+
relativeDirPath = (0, import_node_path75.join)(".agents", "skills"),
|
|
9977
10195
|
dirName,
|
|
9978
10196
|
frontmatter,
|
|
9979
10197
|
body,
|
|
@@ -10005,7 +10223,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10005
10223
|
throw new Error("ReplitSkill does not support global mode.");
|
|
10006
10224
|
}
|
|
10007
10225
|
return {
|
|
10008
|
-
relativeDirPath: (0,
|
|
10226
|
+
relativeDirPath: (0, import_node_path75.join)(".agents", "skills")
|
|
10009
10227
|
};
|
|
10010
10228
|
}
|
|
10011
10229
|
getFrontmatter() {
|
|
@@ -10052,6 +10270,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10052
10270
|
});
|
|
10053
10271
|
}
|
|
10054
10272
|
static fromRulesyncSkill({
|
|
10273
|
+
baseDir = process.cwd(),
|
|
10055
10274
|
rulesyncSkill,
|
|
10056
10275
|
validate = true,
|
|
10057
10276
|
global = false
|
|
@@ -10063,7 +10282,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10063
10282
|
description: rulesyncFrontmatter.description
|
|
10064
10283
|
};
|
|
10065
10284
|
return new _ReplitSkill({
|
|
10066
|
-
baseDir
|
|
10285
|
+
baseDir,
|
|
10067
10286
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
10068
10287
|
dirName: rulesyncSkill.getDirName(),
|
|
10069
10288
|
frontmatter: replitFrontmatter,
|
|
@@ -10084,9 +10303,9 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10084
10303
|
});
|
|
10085
10304
|
const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10086
10305
|
if (!result.success) {
|
|
10087
|
-
const skillDirPath = (0,
|
|
10306
|
+
const skillDirPath = (0, import_node_path75.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10088
10307
|
throw new Error(
|
|
10089
|
-
`Invalid frontmatter in ${(0,
|
|
10308
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10090
10309
|
);
|
|
10091
10310
|
}
|
|
10092
10311
|
return new _ReplitSkill({
|
|
@@ -10121,16 +10340,16 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10121
10340
|
};
|
|
10122
10341
|
|
|
10123
10342
|
// src/features/skills/roo-skill.ts
|
|
10124
|
-
var
|
|
10125
|
-
var
|
|
10126
|
-
var RooSkillFrontmatterSchema =
|
|
10127
|
-
name:
|
|
10128
|
-
description:
|
|
10343
|
+
var import_node_path76 = require("path");
|
|
10344
|
+
var import_mini38 = require("zod/mini");
|
|
10345
|
+
var RooSkillFrontmatterSchema = import_mini38.z.looseObject({
|
|
10346
|
+
name: import_mini38.z.string(),
|
|
10347
|
+
description: import_mini38.z.string()
|
|
10129
10348
|
});
|
|
10130
10349
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
10131
10350
|
constructor({
|
|
10132
10351
|
baseDir = process.cwd(),
|
|
10133
|
-
relativeDirPath = (0,
|
|
10352
|
+
relativeDirPath = (0, import_node_path76.join)(".roo", "skills"),
|
|
10134
10353
|
dirName,
|
|
10135
10354
|
frontmatter,
|
|
10136
10355
|
body,
|
|
@@ -10161,7 +10380,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10161
10380
|
global: _global = false
|
|
10162
10381
|
} = {}) {
|
|
10163
10382
|
return {
|
|
10164
|
-
relativeDirPath: (0,
|
|
10383
|
+
relativeDirPath: (0, import_node_path76.join)(".roo", "skills")
|
|
10165
10384
|
};
|
|
10166
10385
|
}
|
|
10167
10386
|
getFrontmatter() {
|
|
@@ -10216,6 +10435,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10216
10435
|
});
|
|
10217
10436
|
}
|
|
10218
10437
|
static fromRulesyncSkill({
|
|
10438
|
+
baseDir = process.cwd(),
|
|
10219
10439
|
rulesyncSkill,
|
|
10220
10440
|
validate = true,
|
|
10221
10441
|
global = false
|
|
@@ -10227,7 +10447,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10227
10447
|
description: rulesyncFrontmatter.description
|
|
10228
10448
|
};
|
|
10229
10449
|
return new _RooSkill({
|
|
10230
|
-
baseDir
|
|
10450
|
+
baseDir,
|
|
10231
10451
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
10232
10452
|
dirName: rooFrontmatter.name,
|
|
10233
10453
|
frontmatter: rooFrontmatter,
|
|
@@ -10248,13 +10468,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10248
10468
|
});
|
|
10249
10469
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10250
10470
|
if (!result.success) {
|
|
10251
|
-
const skillDirPath = (0,
|
|
10471
|
+
const skillDirPath = (0, import_node_path76.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10252
10472
|
throw new Error(
|
|
10253
|
-
`Invalid frontmatter in ${(0,
|
|
10473
|
+
`Invalid frontmatter in ${(0, import_node_path76.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10254
10474
|
);
|
|
10255
10475
|
}
|
|
10256
10476
|
if (result.data.name !== loaded.dirName) {
|
|
10257
|
-
const skillFilePath = (0,
|
|
10477
|
+
const skillFilePath = (0, import_node_path76.join)(
|
|
10258
10478
|
loaded.baseDir,
|
|
10259
10479
|
loaded.relativeDirPath,
|
|
10260
10480
|
loaded.dirName,
|
|
@@ -10295,17 +10515,17 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10295
10515
|
};
|
|
10296
10516
|
|
|
10297
10517
|
// src/features/skills/skills-utils.ts
|
|
10298
|
-
var
|
|
10518
|
+
var import_node_path77 = require("path");
|
|
10299
10519
|
async function getLocalSkillDirNames(baseDir) {
|
|
10300
|
-
const skillsDir = (0,
|
|
10520
|
+
const skillsDir = (0, import_node_path77.join)(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
10301
10521
|
const names = /* @__PURE__ */ new Set();
|
|
10302
10522
|
if (!await directoryExists(skillsDir)) {
|
|
10303
10523
|
return names;
|
|
10304
10524
|
}
|
|
10305
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
10525
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path77.join)(skillsDir, "*"), { type: "dir" });
|
|
10306
10526
|
for (const dirPath of dirPaths) {
|
|
10307
|
-
const name = (0,
|
|
10308
|
-
if (name === (0,
|
|
10527
|
+
const name = (0, import_node_path77.basename)(dirPath);
|
|
10528
|
+
if (name === (0, import_node_path77.basename)(RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH)) continue;
|
|
10309
10529
|
names.add(name);
|
|
10310
10530
|
}
|
|
10311
10531
|
return names;
|
|
@@ -10324,13 +10544,14 @@ var skillsProcessorToolTargetTuple = [
|
|
|
10324
10544
|
"cursor",
|
|
10325
10545
|
"factorydroid",
|
|
10326
10546
|
"geminicli",
|
|
10547
|
+
"junie",
|
|
10327
10548
|
"kilo",
|
|
10328
10549
|
"kiro",
|
|
10329
10550
|
"opencode",
|
|
10330
10551
|
"replit",
|
|
10331
10552
|
"roo"
|
|
10332
10553
|
];
|
|
10333
|
-
var SkillsProcessorToolTargetSchema =
|
|
10554
|
+
var SkillsProcessorToolTargetSchema = import_mini39.z.enum(skillsProcessorToolTargetTuple);
|
|
10334
10555
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
10335
10556
|
[
|
|
10336
10557
|
"agentsmd",
|
|
@@ -10409,6 +10630,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
10409
10630
|
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
10410
10631
|
}
|
|
10411
10632
|
],
|
|
10633
|
+
[
|
|
10634
|
+
"junie",
|
|
10635
|
+
{
|
|
10636
|
+
class: JunieSkill,
|
|
10637
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: false }
|
|
10638
|
+
}
|
|
10639
|
+
],
|
|
10412
10640
|
[
|
|
10413
10641
|
"kilo",
|
|
10414
10642
|
{
|
|
@@ -10499,6 +10727,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10499
10727
|
return null;
|
|
10500
10728
|
}
|
|
10501
10729
|
return factory.class.fromRulesyncSkill({
|
|
10730
|
+
baseDir: this.baseDir,
|
|
10502
10731
|
rulesyncSkill,
|
|
10503
10732
|
global: this.global
|
|
10504
10733
|
});
|
|
@@ -10531,11 +10760,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10531
10760
|
)
|
|
10532
10761
|
);
|
|
10533
10762
|
const localSkillNames = new Set(localDirNames);
|
|
10534
|
-
const curatedDirPath = (0,
|
|
10763
|
+
const curatedDirPath = (0, import_node_path78.join)(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
10535
10764
|
let curatedSkills = [];
|
|
10536
10765
|
if (await directoryExists(curatedDirPath)) {
|
|
10537
|
-
const curatedDirPaths = await findFilesByGlobs((0,
|
|
10538
|
-
const curatedDirNames = curatedDirPaths.map((path3) => (0,
|
|
10766
|
+
const curatedDirPaths = await findFilesByGlobs((0, import_node_path78.join)(curatedDirPath, "*"), { type: "dir" });
|
|
10767
|
+
const curatedDirNames = curatedDirPaths.map((path3) => (0, import_node_path78.basename)(path3));
|
|
10539
10768
|
const nonConflicting = curatedDirNames.filter((name) => {
|
|
10540
10769
|
if (localSkillNames.has(name)) {
|
|
10541
10770
|
logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
@@ -10568,9 +10797,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10568
10797
|
async loadToolDirs() {
|
|
10569
10798
|
const factory = this.getFactory(this.toolTarget);
|
|
10570
10799
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
10571
|
-
const skillsDirPath = (0,
|
|
10572
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
10573
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
10800
|
+
const skillsDirPath = (0, import_node_path78.join)(this.baseDir, paths.relativeDirPath);
|
|
10801
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path78.join)(skillsDirPath, "*"), { type: "dir" });
|
|
10802
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path78.basename)(path3));
|
|
10574
10803
|
const toolSkills = await Promise.all(
|
|
10575
10804
|
dirNames.map(
|
|
10576
10805
|
(dirName) => factory.class.fromDir({
|
|
@@ -10586,9 +10815,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10586
10815
|
async loadToolDirsToDelete() {
|
|
10587
10816
|
const factory = this.getFactory(this.toolTarget);
|
|
10588
10817
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
10589
|
-
const skillsDirPath = (0,
|
|
10590
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
10591
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
10818
|
+
const skillsDirPath = (0, import_node_path78.join)(this.baseDir, paths.relativeDirPath);
|
|
10819
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path78.join)(skillsDirPath, "*"), { type: "dir" });
|
|
10820
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path78.basename)(path3));
|
|
10592
10821
|
const toolSkills = dirNames.map(
|
|
10593
10822
|
(dirName) => factory.class.forDeletion({
|
|
10594
10823
|
baseDir: this.baseDir,
|
|
@@ -10649,11 +10878,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10649
10878
|
};
|
|
10650
10879
|
|
|
10651
10880
|
// src/features/subagents/agentsmd-subagent.ts
|
|
10652
|
-
var
|
|
10881
|
+
var import_node_path80 = require("path");
|
|
10653
10882
|
|
|
10654
10883
|
// src/features/subagents/simulated-subagent.ts
|
|
10655
|
-
var
|
|
10656
|
-
var
|
|
10884
|
+
var import_node_path79 = require("path");
|
|
10885
|
+
var import_mini40 = require("zod/mini");
|
|
10657
10886
|
|
|
10658
10887
|
// src/features/subagents/tool-subagent.ts
|
|
10659
10888
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -10705,9 +10934,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
10705
10934
|
};
|
|
10706
10935
|
|
|
10707
10936
|
// src/features/subagents/simulated-subagent.ts
|
|
10708
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
10709
|
-
name:
|
|
10710
|
-
description:
|
|
10937
|
+
var SimulatedSubagentFrontmatterSchema = import_mini40.z.object({
|
|
10938
|
+
name: import_mini40.z.string(),
|
|
10939
|
+
description: import_mini40.z.optional(import_mini40.z.string())
|
|
10711
10940
|
});
|
|
10712
10941
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
10713
10942
|
frontmatter;
|
|
@@ -10717,7 +10946,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10717
10946
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10718
10947
|
if (!result.success) {
|
|
10719
10948
|
throw new Error(
|
|
10720
|
-
`Invalid frontmatter in ${(0,
|
|
10949
|
+
`Invalid frontmatter in ${(0, import_node_path79.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10721
10950
|
);
|
|
10722
10951
|
}
|
|
10723
10952
|
}
|
|
@@ -10768,7 +10997,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10768
10997
|
return {
|
|
10769
10998
|
success: false,
|
|
10770
10999
|
error: new Error(
|
|
10771
|
-
`Invalid frontmatter in ${(0,
|
|
11000
|
+
`Invalid frontmatter in ${(0, import_node_path79.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10772
11001
|
)
|
|
10773
11002
|
};
|
|
10774
11003
|
}
|
|
@@ -10778,7 +11007,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10778
11007
|
relativeFilePath,
|
|
10779
11008
|
validate = true
|
|
10780
11009
|
}) {
|
|
10781
|
-
const filePath = (0,
|
|
11010
|
+
const filePath = (0, import_node_path79.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
10782
11011
|
const fileContent = await readFileContent(filePath);
|
|
10783
11012
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10784
11013
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -10788,7 +11017,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10788
11017
|
return {
|
|
10789
11018
|
baseDir,
|
|
10790
11019
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
10791
|
-
relativeFilePath: (0,
|
|
11020
|
+
relativeFilePath: (0, import_node_path79.basename)(relativeFilePath),
|
|
10792
11021
|
frontmatter: result.data,
|
|
10793
11022
|
body: content.trim(),
|
|
10794
11023
|
validate
|
|
@@ -10814,7 +11043,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10814
11043
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
10815
11044
|
static getSettablePaths() {
|
|
10816
11045
|
return {
|
|
10817
|
-
relativeDirPath: (0,
|
|
11046
|
+
relativeDirPath: (0, import_node_path80.join)(".agents", "subagents")
|
|
10818
11047
|
};
|
|
10819
11048
|
}
|
|
10820
11049
|
static async fromFile(params) {
|
|
@@ -10837,11 +11066,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
10837
11066
|
};
|
|
10838
11067
|
|
|
10839
11068
|
// src/features/subagents/factorydroid-subagent.ts
|
|
10840
|
-
var
|
|
11069
|
+
var import_node_path81 = require("path");
|
|
10841
11070
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
10842
11071
|
static getSettablePaths(_options) {
|
|
10843
11072
|
return {
|
|
10844
|
-
relativeDirPath: (0,
|
|
11073
|
+
relativeDirPath: (0, import_node_path81.join)(".factory", "droids")
|
|
10845
11074
|
};
|
|
10846
11075
|
}
|
|
10847
11076
|
static async fromFile(params) {
|
|
@@ -10864,11 +11093,11 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
10864
11093
|
};
|
|
10865
11094
|
|
|
10866
11095
|
// src/features/subagents/geminicli-subagent.ts
|
|
10867
|
-
var
|
|
11096
|
+
var import_node_path82 = require("path");
|
|
10868
11097
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
10869
11098
|
static getSettablePaths() {
|
|
10870
11099
|
return {
|
|
10871
|
-
relativeDirPath: (0,
|
|
11100
|
+
relativeDirPath: (0, import_node_path82.join)(".gemini", "subagents")
|
|
10872
11101
|
};
|
|
10873
11102
|
}
|
|
10874
11103
|
static async fromFile(params) {
|
|
@@ -10891,11 +11120,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
10891
11120
|
};
|
|
10892
11121
|
|
|
10893
11122
|
// src/features/subagents/roo-subagent.ts
|
|
10894
|
-
var
|
|
11123
|
+
var import_node_path83 = require("path");
|
|
10895
11124
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
10896
11125
|
static getSettablePaths() {
|
|
10897
11126
|
return {
|
|
10898
|
-
relativeDirPath: (0,
|
|
11127
|
+
relativeDirPath: (0, import_node_path83.join)(".roo", "subagents")
|
|
10899
11128
|
};
|
|
10900
11129
|
}
|
|
10901
11130
|
static async fromFile(params) {
|
|
@@ -10918,20 +11147,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
10918
11147
|
};
|
|
10919
11148
|
|
|
10920
11149
|
// src/features/subagents/subagents-processor.ts
|
|
10921
|
-
var
|
|
10922
|
-
var
|
|
11150
|
+
var import_node_path92 = require("path");
|
|
11151
|
+
var import_mini49 = require("zod/mini");
|
|
10923
11152
|
|
|
10924
11153
|
// src/features/subagents/claudecode-subagent.ts
|
|
10925
|
-
var
|
|
10926
|
-
var
|
|
11154
|
+
var import_node_path85 = require("path");
|
|
11155
|
+
var import_mini42 = require("zod/mini");
|
|
10927
11156
|
|
|
10928
11157
|
// src/features/subagents/rulesync-subagent.ts
|
|
10929
|
-
var
|
|
10930
|
-
var
|
|
10931
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
10932
|
-
targets:
|
|
10933
|
-
name:
|
|
10934
|
-
description:
|
|
11158
|
+
var import_node_path84 = require("path");
|
|
11159
|
+
var import_mini41 = require("zod/mini");
|
|
11160
|
+
var RulesyncSubagentFrontmatterSchema = import_mini41.z.looseObject({
|
|
11161
|
+
targets: import_mini41.z._default(RulesyncTargetsSchema, ["*"]),
|
|
11162
|
+
name: import_mini41.z.string(),
|
|
11163
|
+
description: import_mini41.z.optional(import_mini41.z.string())
|
|
10935
11164
|
});
|
|
10936
11165
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
10937
11166
|
frontmatter;
|
|
@@ -10940,7 +11169,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10940
11169
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10941
11170
|
if (!parseResult.success && rest.validate !== false) {
|
|
10942
11171
|
throw new Error(
|
|
10943
|
-
`Invalid frontmatter in ${(0,
|
|
11172
|
+
`Invalid frontmatter in ${(0, import_node_path84.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
10944
11173
|
);
|
|
10945
11174
|
}
|
|
10946
11175
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -10973,7 +11202,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10973
11202
|
return {
|
|
10974
11203
|
success: false,
|
|
10975
11204
|
error: new Error(
|
|
10976
|
-
`Invalid frontmatter in ${(0,
|
|
11205
|
+
`Invalid frontmatter in ${(0, import_node_path84.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10977
11206
|
)
|
|
10978
11207
|
};
|
|
10979
11208
|
}
|
|
@@ -10981,14 +11210,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10981
11210
|
static async fromFile({
|
|
10982
11211
|
relativeFilePath
|
|
10983
11212
|
}) {
|
|
10984
|
-
const filePath = (0,
|
|
11213
|
+
const filePath = (0, import_node_path84.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
10985
11214
|
const fileContent = await readFileContent(filePath);
|
|
10986
11215
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10987
11216
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10988
11217
|
if (!result.success) {
|
|
10989
11218
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
10990
11219
|
}
|
|
10991
|
-
const filename = (0,
|
|
11220
|
+
const filename = (0, import_node_path84.basename)(relativeFilePath);
|
|
10992
11221
|
return new _RulesyncSubagent({
|
|
10993
11222
|
baseDir: process.cwd(),
|
|
10994
11223
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -11000,13 +11229,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11000
11229
|
};
|
|
11001
11230
|
|
|
11002
11231
|
// src/features/subagents/claudecode-subagent.ts
|
|
11003
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
11004
|
-
name:
|
|
11005
|
-
description:
|
|
11006
|
-
model:
|
|
11007
|
-
tools:
|
|
11008
|
-
permissionMode:
|
|
11009
|
-
skills:
|
|
11232
|
+
var ClaudecodeSubagentFrontmatterSchema = import_mini42.z.looseObject({
|
|
11233
|
+
name: import_mini42.z.string(),
|
|
11234
|
+
description: import_mini42.z.optional(import_mini42.z.string()),
|
|
11235
|
+
model: import_mini42.z.optional(import_mini42.z.string()),
|
|
11236
|
+
tools: import_mini42.z.optional(import_mini42.z.union([import_mini42.z.string(), import_mini42.z.array(import_mini42.z.string())])),
|
|
11237
|
+
permissionMode: import_mini42.z.optional(import_mini42.z.string()),
|
|
11238
|
+
skills: import_mini42.z.optional(import_mini42.z.union([import_mini42.z.string(), import_mini42.z.array(import_mini42.z.string())]))
|
|
11010
11239
|
});
|
|
11011
11240
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
11012
11241
|
frontmatter;
|
|
@@ -11016,7 +11245,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11016
11245
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11017
11246
|
if (!result.success) {
|
|
11018
11247
|
throw new Error(
|
|
11019
|
-
`Invalid frontmatter in ${(0,
|
|
11248
|
+
`Invalid frontmatter in ${(0, import_node_path85.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11020
11249
|
);
|
|
11021
11250
|
}
|
|
11022
11251
|
}
|
|
@@ -11028,7 +11257,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11028
11257
|
}
|
|
11029
11258
|
static getSettablePaths(_options = {}) {
|
|
11030
11259
|
return {
|
|
11031
|
-
relativeDirPath: (0,
|
|
11260
|
+
relativeDirPath: (0, import_node_path85.join)(".claude", "agents")
|
|
11032
11261
|
};
|
|
11033
11262
|
}
|
|
11034
11263
|
getFrontmatter() {
|
|
@@ -11067,7 +11296,10 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11067
11296
|
global = false
|
|
11068
11297
|
}) {
|
|
11069
11298
|
const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
|
|
11070
|
-
const claudecodeSection = rulesyncFrontmatter.claudecode ?? {}
|
|
11299
|
+
const claudecodeSection = this.filterToolSpecificSection(rulesyncFrontmatter.claudecode ?? {}, [
|
|
11300
|
+
"name",
|
|
11301
|
+
"description"
|
|
11302
|
+
]);
|
|
11071
11303
|
const rawClaudecodeFrontmatter = {
|
|
11072
11304
|
name: rulesyncFrontmatter.name,
|
|
11073
11305
|
description: rulesyncFrontmatter.description,
|
|
@@ -11104,7 +11336,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11104
11336
|
return {
|
|
11105
11337
|
success: false,
|
|
11106
11338
|
error: new Error(
|
|
11107
|
-
`Invalid frontmatter in ${(0,
|
|
11339
|
+
`Invalid frontmatter in ${(0, import_node_path85.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11108
11340
|
)
|
|
11109
11341
|
};
|
|
11110
11342
|
}
|
|
@@ -11122,7 +11354,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11122
11354
|
global = false
|
|
11123
11355
|
}) {
|
|
11124
11356
|
const paths = this.getSettablePaths({ global });
|
|
11125
|
-
const filePath = (0,
|
|
11357
|
+
const filePath = (0, import_node_path85.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11126
11358
|
const fileContent = await readFileContent(filePath);
|
|
11127
11359
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11128
11360
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11157,16 +11389,16 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11157
11389
|
};
|
|
11158
11390
|
|
|
11159
11391
|
// src/features/subagents/codexcli-subagent.ts
|
|
11160
|
-
var
|
|
11392
|
+
var import_node_path86 = require("path");
|
|
11161
11393
|
var smolToml2 = __toESM(require("smol-toml"), 1);
|
|
11162
|
-
var
|
|
11163
|
-
var CodexCliSubagentTomlSchema =
|
|
11164
|
-
name:
|
|
11165
|
-
description:
|
|
11166
|
-
developer_instructions:
|
|
11167
|
-
model:
|
|
11168
|
-
model_reasoning_effort:
|
|
11169
|
-
sandbox_mode:
|
|
11394
|
+
var import_mini43 = require("zod/mini");
|
|
11395
|
+
var CodexCliSubagentTomlSchema = import_mini43.z.looseObject({
|
|
11396
|
+
name: import_mini43.z.string(),
|
|
11397
|
+
description: import_mini43.z.optional(import_mini43.z.string()),
|
|
11398
|
+
developer_instructions: import_mini43.z.optional(import_mini43.z.string()),
|
|
11399
|
+
model: import_mini43.z.optional(import_mini43.z.string()),
|
|
11400
|
+
model_reasoning_effort: import_mini43.z.optional(import_mini43.z.string()),
|
|
11401
|
+
sandbox_mode: import_mini43.z.optional(import_mini43.z.string())
|
|
11170
11402
|
});
|
|
11171
11403
|
var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
11172
11404
|
body;
|
|
@@ -11177,7 +11409,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11177
11409
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
11178
11410
|
} catch (error) {
|
|
11179
11411
|
throw new Error(
|
|
11180
|
-
`Invalid TOML in ${(0,
|
|
11412
|
+
`Invalid TOML in ${(0, import_node_path86.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11181
11413
|
{ cause: error }
|
|
11182
11414
|
);
|
|
11183
11415
|
}
|
|
@@ -11189,7 +11421,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11189
11421
|
}
|
|
11190
11422
|
static getSettablePaths(_options = {}) {
|
|
11191
11423
|
return {
|
|
11192
|
-
relativeDirPath: (0,
|
|
11424
|
+
relativeDirPath: (0, import_node_path86.join)(".codex", "agents")
|
|
11193
11425
|
};
|
|
11194
11426
|
}
|
|
11195
11427
|
getBody() {
|
|
@@ -11201,7 +11433,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11201
11433
|
parsed = CodexCliSubagentTomlSchema.parse(smolToml2.parse(this.body));
|
|
11202
11434
|
} catch (error) {
|
|
11203
11435
|
throw new Error(
|
|
11204
|
-
`Failed to parse TOML in ${(0,
|
|
11436
|
+
`Failed to parse TOML in ${(0, import_node_path86.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11205
11437
|
{ cause: error }
|
|
11206
11438
|
);
|
|
11207
11439
|
}
|
|
@@ -11282,7 +11514,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11282
11514
|
global = false
|
|
11283
11515
|
}) {
|
|
11284
11516
|
const paths = this.getSettablePaths({ global });
|
|
11285
|
-
const filePath = (0,
|
|
11517
|
+
const filePath = (0, import_node_path86.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11286
11518
|
const fileContent = await readFileContent(filePath);
|
|
11287
11519
|
const subagent = new _CodexCliSubagent({
|
|
11288
11520
|
baseDir,
|
|
@@ -11320,13 +11552,13 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11320
11552
|
};
|
|
11321
11553
|
|
|
11322
11554
|
// src/features/subagents/copilot-subagent.ts
|
|
11323
|
-
var
|
|
11324
|
-
var
|
|
11555
|
+
var import_node_path87 = require("path");
|
|
11556
|
+
var import_mini44 = require("zod/mini");
|
|
11325
11557
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
11326
|
-
var CopilotSubagentFrontmatterSchema =
|
|
11327
|
-
name:
|
|
11328
|
-
description:
|
|
11329
|
-
tools:
|
|
11558
|
+
var CopilotSubagentFrontmatterSchema = import_mini44.z.looseObject({
|
|
11559
|
+
name: import_mini44.z.string(),
|
|
11560
|
+
description: import_mini44.z.optional(import_mini44.z.string()),
|
|
11561
|
+
tools: import_mini44.z.optional(import_mini44.z.union([import_mini44.z.string(), import_mini44.z.array(import_mini44.z.string())]))
|
|
11330
11562
|
});
|
|
11331
11563
|
var normalizeTools = (tools) => {
|
|
11332
11564
|
if (!tools) {
|
|
@@ -11346,7 +11578,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11346
11578
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11347
11579
|
if (!result.success) {
|
|
11348
11580
|
throw new Error(
|
|
11349
|
-
`Invalid frontmatter in ${(0,
|
|
11581
|
+
`Invalid frontmatter in ${(0, import_node_path87.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11350
11582
|
);
|
|
11351
11583
|
}
|
|
11352
11584
|
}
|
|
@@ -11358,7 +11590,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11358
11590
|
}
|
|
11359
11591
|
static getSettablePaths(_options = {}) {
|
|
11360
11592
|
return {
|
|
11361
|
-
relativeDirPath: (0,
|
|
11593
|
+
relativeDirPath: (0, import_node_path87.join)(".github", "agents")
|
|
11362
11594
|
};
|
|
11363
11595
|
}
|
|
11364
11596
|
getFrontmatter() {
|
|
@@ -11432,7 +11664,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11432
11664
|
return {
|
|
11433
11665
|
success: false,
|
|
11434
11666
|
error: new Error(
|
|
11435
|
-
`Invalid frontmatter in ${(0,
|
|
11667
|
+
`Invalid frontmatter in ${(0, import_node_path87.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11436
11668
|
)
|
|
11437
11669
|
};
|
|
11438
11670
|
}
|
|
@@ -11450,7 +11682,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11450
11682
|
global = false
|
|
11451
11683
|
}) {
|
|
11452
11684
|
const paths = this.getSettablePaths({ global });
|
|
11453
|
-
const filePath = (0,
|
|
11685
|
+
const filePath = (0, import_node_path87.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11454
11686
|
const fileContent = await readFileContent(filePath);
|
|
11455
11687
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11456
11688
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11486,11 +11718,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11486
11718
|
};
|
|
11487
11719
|
|
|
11488
11720
|
// src/features/subagents/cursor-subagent.ts
|
|
11489
|
-
var
|
|
11490
|
-
var
|
|
11491
|
-
var CursorSubagentFrontmatterSchema =
|
|
11492
|
-
name:
|
|
11493
|
-
description:
|
|
11721
|
+
var import_node_path88 = require("path");
|
|
11722
|
+
var import_mini45 = require("zod/mini");
|
|
11723
|
+
var CursorSubagentFrontmatterSchema = import_mini45.z.looseObject({
|
|
11724
|
+
name: import_mini45.z.string(),
|
|
11725
|
+
description: import_mini45.z.optional(import_mini45.z.string())
|
|
11494
11726
|
});
|
|
11495
11727
|
var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
11496
11728
|
frontmatter;
|
|
@@ -11500,7 +11732,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11500
11732
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11501
11733
|
if (!result.success) {
|
|
11502
11734
|
throw new Error(
|
|
11503
|
-
`Invalid frontmatter in ${(0,
|
|
11735
|
+
`Invalid frontmatter in ${(0, import_node_path88.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11504
11736
|
);
|
|
11505
11737
|
}
|
|
11506
11738
|
}
|
|
@@ -11512,7 +11744,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11512
11744
|
}
|
|
11513
11745
|
static getSettablePaths(_options = {}) {
|
|
11514
11746
|
return {
|
|
11515
|
-
relativeDirPath: (0,
|
|
11747
|
+
relativeDirPath: (0, import_node_path88.join)(".cursor", "agents")
|
|
11516
11748
|
};
|
|
11517
11749
|
}
|
|
11518
11750
|
getFrontmatter() {
|
|
@@ -11579,7 +11811,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11579
11811
|
return {
|
|
11580
11812
|
success: false,
|
|
11581
11813
|
error: new Error(
|
|
11582
|
-
`Invalid frontmatter in ${(0,
|
|
11814
|
+
`Invalid frontmatter in ${(0, import_node_path88.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11583
11815
|
)
|
|
11584
11816
|
};
|
|
11585
11817
|
}
|
|
@@ -11597,7 +11829,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11597
11829
|
global = false
|
|
11598
11830
|
}) {
|
|
11599
11831
|
const paths = this.getSettablePaths({ global });
|
|
11600
|
-
const filePath = (0,
|
|
11832
|
+
const filePath = (0, import_node_path88.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11601
11833
|
const fileContent = await readFileContent(filePath);
|
|
11602
11834
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11603
11835
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11632,24 +11864,182 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11632
11864
|
}
|
|
11633
11865
|
};
|
|
11634
11866
|
|
|
11867
|
+
// src/features/subagents/junie-subagent.ts
|
|
11868
|
+
var import_node_path89 = require("path");
|
|
11869
|
+
var import_mini46 = require("zod/mini");
|
|
11870
|
+
var JunieSubagentFrontmatterSchema = import_mini46.z.looseObject({
|
|
11871
|
+
name: import_mini46.z.optional(import_mini46.z.string()),
|
|
11872
|
+
description: import_mini46.z.string()
|
|
11873
|
+
});
|
|
11874
|
+
var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
11875
|
+
frontmatter;
|
|
11876
|
+
body;
|
|
11877
|
+
constructor({ frontmatter, body, ...rest }) {
|
|
11878
|
+
if (rest.validate !== false) {
|
|
11879
|
+
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11880
|
+
if (!result.success) {
|
|
11881
|
+
throw new Error(
|
|
11882
|
+
`Invalid frontmatter in ${(0, import_node_path89.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11883
|
+
);
|
|
11884
|
+
}
|
|
11885
|
+
}
|
|
11886
|
+
super({
|
|
11887
|
+
...rest
|
|
11888
|
+
});
|
|
11889
|
+
this.frontmatter = frontmatter;
|
|
11890
|
+
this.body = body;
|
|
11891
|
+
}
|
|
11892
|
+
static getSettablePaths(options = {}) {
|
|
11893
|
+
if (options?.global) {
|
|
11894
|
+
throw new Error("JunieSubagent does not support global mode.");
|
|
11895
|
+
}
|
|
11896
|
+
return {
|
|
11897
|
+
relativeDirPath: (0, import_node_path89.join)(".junie", "agents")
|
|
11898
|
+
};
|
|
11899
|
+
}
|
|
11900
|
+
getFrontmatter() {
|
|
11901
|
+
return this.frontmatter;
|
|
11902
|
+
}
|
|
11903
|
+
getBody() {
|
|
11904
|
+
return this.body;
|
|
11905
|
+
}
|
|
11906
|
+
toRulesyncSubagent() {
|
|
11907
|
+
const { name, description, ...restFields } = this.frontmatter;
|
|
11908
|
+
const junieSection = {
|
|
11909
|
+
...restFields
|
|
11910
|
+
};
|
|
11911
|
+
const rulesyncFrontmatter = {
|
|
11912
|
+
targets: ["*"],
|
|
11913
|
+
name: name ?? this.getRelativeFilePath().replace(/\.md$/, ""),
|
|
11914
|
+
description,
|
|
11915
|
+
...Object.keys(junieSection).length > 0 && { junie: junieSection }
|
|
11916
|
+
};
|
|
11917
|
+
return new RulesyncSubagent({
|
|
11918
|
+
baseDir: ".",
|
|
11919
|
+
frontmatter: rulesyncFrontmatter,
|
|
11920
|
+
body: this.body,
|
|
11921
|
+
relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
|
|
11922
|
+
relativeFilePath: this.getRelativeFilePath(),
|
|
11923
|
+
validate: true
|
|
11924
|
+
});
|
|
11925
|
+
}
|
|
11926
|
+
static fromRulesyncSubagent({
|
|
11927
|
+
baseDir = process.cwd(),
|
|
11928
|
+
rulesyncSubagent,
|
|
11929
|
+
validate = true,
|
|
11930
|
+
global = false
|
|
11931
|
+
}) {
|
|
11932
|
+
const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
|
|
11933
|
+
const junieSection = this.filterToolSpecificSection(rulesyncFrontmatter.junie ?? {}, [
|
|
11934
|
+
"name",
|
|
11935
|
+
"description"
|
|
11936
|
+
]);
|
|
11937
|
+
const rawJunieFrontmatter = {
|
|
11938
|
+
name: rulesyncFrontmatter.name,
|
|
11939
|
+
description: rulesyncFrontmatter.description,
|
|
11940
|
+
...junieSection
|
|
11941
|
+
};
|
|
11942
|
+
const result = JunieSubagentFrontmatterSchema.safeParse(rawJunieFrontmatter);
|
|
11943
|
+
if (!result.success) {
|
|
11944
|
+
throw new Error(
|
|
11945
|
+
`Invalid junie subagent frontmatter in ${rulesyncSubagent.getRelativeFilePath()}: ${formatError(result.error)}`
|
|
11946
|
+
);
|
|
11947
|
+
}
|
|
11948
|
+
const junieFrontmatter = result.data;
|
|
11949
|
+
const body = rulesyncSubagent.getBody();
|
|
11950
|
+
const fileContent = stringifyFrontmatter(body, junieFrontmatter);
|
|
11951
|
+
const paths = this.getSettablePaths({ global });
|
|
11952
|
+
return new _JunieSubagent({
|
|
11953
|
+
baseDir,
|
|
11954
|
+
frontmatter: junieFrontmatter,
|
|
11955
|
+
body,
|
|
11956
|
+
relativeDirPath: paths.relativeDirPath,
|
|
11957
|
+
relativeFilePath: rulesyncSubagent.getRelativeFilePath(),
|
|
11958
|
+
fileContent,
|
|
11959
|
+
validate
|
|
11960
|
+
});
|
|
11961
|
+
}
|
|
11962
|
+
validate() {
|
|
11963
|
+
if (!this.frontmatter) {
|
|
11964
|
+
return { success: true, error: null };
|
|
11965
|
+
}
|
|
11966
|
+
const result = JunieSubagentFrontmatterSchema.safeParse(this.frontmatter);
|
|
11967
|
+
if (result.success) {
|
|
11968
|
+
return { success: true, error: null };
|
|
11969
|
+
} else {
|
|
11970
|
+
return {
|
|
11971
|
+
success: false,
|
|
11972
|
+
error: new Error(
|
|
11973
|
+
`Invalid frontmatter in ${(0, import_node_path89.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11974
|
+
)
|
|
11975
|
+
};
|
|
11976
|
+
}
|
|
11977
|
+
}
|
|
11978
|
+
static isTargetedByRulesyncSubagent(rulesyncSubagent) {
|
|
11979
|
+
return this.isTargetedByRulesyncSubagentDefault({
|
|
11980
|
+
rulesyncSubagent,
|
|
11981
|
+
toolTarget: "junie"
|
|
11982
|
+
});
|
|
11983
|
+
}
|
|
11984
|
+
static async fromFile({
|
|
11985
|
+
baseDir = process.cwd(),
|
|
11986
|
+
relativeFilePath,
|
|
11987
|
+
validate = true,
|
|
11988
|
+
global = false
|
|
11989
|
+
}) {
|
|
11990
|
+
const paths = this.getSettablePaths({ global });
|
|
11991
|
+
const filePath = (0, import_node_path89.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11992
|
+
const fileContent = await readFileContent(filePath);
|
|
11993
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11994
|
+
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11995
|
+
if (!result.success) {
|
|
11996
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
11997
|
+
}
|
|
11998
|
+
return new _JunieSubagent({
|
|
11999
|
+
baseDir,
|
|
12000
|
+
relativeDirPath: paths.relativeDirPath,
|
|
12001
|
+
relativeFilePath,
|
|
12002
|
+
frontmatter: result.data,
|
|
12003
|
+
body: content.trim(),
|
|
12004
|
+
fileContent,
|
|
12005
|
+
validate
|
|
12006
|
+
});
|
|
12007
|
+
}
|
|
12008
|
+
static forDeletion({
|
|
12009
|
+
baseDir = process.cwd(),
|
|
12010
|
+
relativeDirPath,
|
|
12011
|
+
relativeFilePath
|
|
12012
|
+
}) {
|
|
12013
|
+
return new _JunieSubagent({
|
|
12014
|
+
baseDir,
|
|
12015
|
+
relativeDirPath,
|
|
12016
|
+
relativeFilePath,
|
|
12017
|
+
frontmatter: { name: "", description: "" },
|
|
12018
|
+
body: "",
|
|
12019
|
+
fileContent: "",
|
|
12020
|
+
validate: false
|
|
12021
|
+
});
|
|
12022
|
+
}
|
|
12023
|
+
};
|
|
12024
|
+
|
|
11635
12025
|
// src/features/subagents/kiro-subagent.ts
|
|
11636
|
-
var
|
|
11637
|
-
var
|
|
11638
|
-
var KiroCliSubagentJsonSchema =
|
|
11639
|
-
name:
|
|
11640
|
-
description:
|
|
11641
|
-
prompt:
|
|
11642
|
-
tools:
|
|
11643
|
-
toolAliases:
|
|
11644
|
-
toolSettings:
|
|
11645
|
-
toolSchema:
|
|
11646
|
-
hooks:
|
|
11647
|
-
model:
|
|
11648
|
-
mcpServers:
|
|
11649
|
-
useLegacyMcpJson:
|
|
11650
|
-
resources:
|
|
11651
|
-
allowedTools:
|
|
11652
|
-
includeMcpJson:
|
|
12026
|
+
var import_node_path90 = require("path");
|
|
12027
|
+
var import_mini47 = require("zod/mini");
|
|
12028
|
+
var KiroCliSubagentJsonSchema = import_mini47.z.looseObject({
|
|
12029
|
+
name: import_mini47.z.string(),
|
|
12030
|
+
description: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.string())),
|
|
12031
|
+
prompt: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.string())),
|
|
12032
|
+
tools: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.array(import_mini47.z.string()))),
|
|
12033
|
+
toolAliases: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.record(import_mini47.z.string(), import_mini47.z.string()))),
|
|
12034
|
+
toolSettings: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.unknown())),
|
|
12035
|
+
toolSchema: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.unknown())),
|
|
12036
|
+
hooks: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.record(import_mini47.z.string(), import_mini47.z.array(import_mini47.z.unknown())))),
|
|
12037
|
+
model: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.string())),
|
|
12038
|
+
mcpServers: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.record(import_mini47.z.string(), import_mini47.z.unknown()))),
|
|
12039
|
+
useLegacyMcpJson: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.boolean())),
|
|
12040
|
+
resources: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.array(import_mini47.z.string()))),
|
|
12041
|
+
allowedTools: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.array(import_mini47.z.string()))),
|
|
12042
|
+
includeMcpJson: import_mini47.z.optional(import_mini47.z.nullable(import_mini47.z.boolean()))
|
|
11653
12043
|
});
|
|
11654
12044
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
11655
12045
|
body;
|
|
@@ -11660,7 +12050,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11660
12050
|
KiroCliSubagentJsonSchema.parse(parsed);
|
|
11661
12051
|
} catch (error) {
|
|
11662
12052
|
throw new Error(
|
|
11663
|
-
`Invalid JSON in ${(0,
|
|
12053
|
+
`Invalid JSON in ${(0, import_node_path90.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11664
12054
|
{ cause: error }
|
|
11665
12055
|
);
|
|
11666
12056
|
}
|
|
@@ -11672,7 +12062,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11672
12062
|
}
|
|
11673
12063
|
static getSettablePaths(_options = {}) {
|
|
11674
12064
|
return {
|
|
11675
|
-
relativeDirPath: (0,
|
|
12065
|
+
relativeDirPath: (0, import_node_path90.join)(".kiro", "agents")
|
|
11676
12066
|
};
|
|
11677
12067
|
}
|
|
11678
12068
|
getBody() {
|
|
@@ -11684,7 +12074,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11684
12074
|
parsed = JSON.parse(this.body);
|
|
11685
12075
|
} catch (error) {
|
|
11686
12076
|
throw new Error(
|
|
11687
|
-
`Failed to parse JSON in ${(0,
|
|
12077
|
+
`Failed to parse JSON in ${(0, import_node_path90.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11688
12078
|
{ cause: error }
|
|
11689
12079
|
);
|
|
11690
12080
|
}
|
|
@@ -11765,7 +12155,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11765
12155
|
global = false
|
|
11766
12156
|
}) {
|
|
11767
12157
|
const paths = this.getSettablePaths({ global });
|
|
11768
|
-
const filePath = (0,
|
|
12158
|
+
const filePath = (0, import_node_path90.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11769
12159
|
const fileContent = await readFileContent(filePath);
|
|
11770
12160
|
const subagent = new _KiroSubagent({
|
|
11771
12161
|
baseDir,
|
|
@@ -11803,12 +12193,12 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11803
12193
|
};
|
|
11804
12194
|
|
|
11805
12195
|
// src/features/subagents/opencode-subagent.ts
|
|
11806
|
-
var
|
|
11807
|
-
var
|
|
11808
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
11809
|
-
description:
|
|
11810
|
-
mode:
|
|
11811
|
-
name:
|
|
12196
|
+
var import_node_path91 = require("path");
|
|
12197
|
+
var import_mini48 = require("zod/mini");
|
|
12198
|
+
var OpenCodeSubagentFrontmatterSchema = import_mini48.z.looseObject({
|
|
12199
|
+
description: import_mini48.z.optional(import_mini48.z.string()),
|
|
12200
|
+
mode: import_mini48.z._default(import_mini48.z.string(), "subagent"),
|
|
12201
|
+
name: import_mini48.z.optional(import_mini48.z.string())
|
|
11812
12202
|
});
|
|
11813
12203
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
11814
12204
|
frontmatter;
|
|
@@ -11818,7 +12208,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11818
12208
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11819
12209
|
if (!result.success) {
|
|
11820
12210
|
throw new Error(
|
|
11821
|
-
`Invalid frontmatter in ${(0,
|
|
12211
|
+
`Invalid frontmatter in ${(0, import_node_path91.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11822
12212
|
);
|
|
11823
12213
|
}
|
|
11824
12214
|
}
|
|
@@ -11832,7 +12222,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11832
12222
|
global = false
|
|
11833
12223
|
} = {}) {
|
|
11834
12224
|
return {
|
|
11835
|
-
relativeDirPath: global ? (0,
|
|
12225
|
+
relativeDirPath: global ? (0, import_node_path91.join)(".config", "opencode", "agent") : (0, import_node_path91.join)(".opencode", "agent")
|
|
11836
12226
|
};
|
|
11837
12227
|
}
|
|
11838
12228
|
getFrontmatter() {
|
|
@@ -11845,7 +12235,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11845
12235
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
11846
12236
|
const rulesyncFrontmatter = {
|
|
11847
12237
|
targets: ["*"],
|
|
11848
|
-
name: name ?? (0,
|
|
12238
|
+
name: name ?? (0, import_node_path91.basename)(this.getRelativeFilePath(), ".md"),
|
|
11849
12239
|
description,
|
|
11850
12240
|
opencode: { mode, ...opencodeSection }
|
|
11851
12241
|
};
|
|
@@ -11898,7 +12288,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11898
12288
|
return {
|
|
11899
12289
|
success: false,
|
|
11900
12290
|
error: new Error(
|
|
11901
|
-
`Invalid frontmatter in ${(0,
|
|
12291
|
+
`Invalid frontmatter in ${(0, import_node_path91.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11902
12292
|
)
|
|
11903
12293
|
};
|
|
11904
12294
|
}
|
|
@@ -11915,7 +12305,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11915
12305
|
global = false
|
|
11916
12306
|
}) {
|
|
11917
12307
|
const paths = this.getSettablePaths({ global });
|
|
11918
|
-
const filePath = (0,
|
|
12308
|
+
const filePath = (0, import_node_path91.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11919
12309
|
const fileContent = await readFileContent(filePath);
|
|
11920
12310
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11921
12311
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11960,11 +12350,12 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
11960
12350
|
"cursor",
|
|
11961
12351
|
"factorydroid",
|
|
11962
12352
|
"geminicli",
|
|
12353
|
+
"junie",
|
|
11963
12354
|
"kiro",
|
|
11964
12355
|
"opencode",
|
|
11965
12356
|
"roo"
|
|
11966
12357
|
];
|
|
11967
|
-
var SubagentsProcessorToolTargetSchema =
|
|
12358
|
+
var SubagentsProcessorToolTargetSchema = import_mini49.z.enum(subagentsProcessorToolTargetTuple);
|
|
11968
12359
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
11969
12360
|
[
|
|
11970
12361
|
"agentsmd",
|
|
@@ -12022,6 +12413,13 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
|
12022
12413
|
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
12023
12414
|
}
|
|
12024
12415
|
],
|
|
12416
|
+
[
|
|
12417
|
+
"junie",
|
|
12418
|
+
{
|
|
12419
|
+
class: JunieSubagent,
|
|
12420
|
+
meta: { supportsSimulated: false, supportsGlobal: false, filePattern: "*.md" }
|
|
12421
|
+
}
|
|
12422
|
+
],
|
|
12025
12423
|
[
|
|
12026
12424
|
"kiro",
|
|
12027
12425
|
{
|
|
@@ -12126,7 +12524,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12126
12524
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
12127
12525
|
*/
|
|
12128
12526
|
async loadRulesyncFiles() {
|
|
12129
|
-
const subagentsDir = (0,
|
|
12527
|
+
const subagentsDir = (0, import_node_path92.join)(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
12130
12528
|
const dirExists = await directoryExists(subagentsDir);
|
|
12131
12529
|
if (!dirExists) {
|
|
12132
12530
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -12141,7 +12539,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12141
12539
|
logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
12142
12540
|
const rulesyncSubagents = [];
|
|
12143
12541
|
for (const mdFile of mdFiles) {
|
|
12144
|
-
const filepath = (0,
|
|
12542
|
+
const filepath = (0, import_node_path92.join)(subagentsDir, mdFile);
|
|
12145
12543
|
try {
|
|
12146
12544
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
12147
12545
|
relativeFilePath: mdFile,
|
|
@@ -12171,14 +12569,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12171
12569
|
const factory = this.getFactory(this.toolTarget);
|
|
12172
12570
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
12173
12571
|
const subagentFilePaths = await findFilesByGlobs(
|
|
12174
|
-
(0,
|
|
12572
|
+
(0, import_node_path92.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
12175
12573
|
);
|
|
12176
12574
|
if (forDeletion) {
|
|
12177
12575
|
const toolSubagents2 = subagentFilePaths.map(
|
|
12178
12576
|
(path3) => factory.class.forDeletion({
|
|
12179
12577
|
baseDir: this.baseDir,
|
|
12180
12578
|
relativeDirPath: paths.relativeDirPath,
|
|
12181
|
-
relativeFilePath: (0,
|
|
12579
|
+
relativeFilePath: (0, import_node_path92.basename)(path3),
|
|
12182
12580
|
global: this.global
|
|
12183
12581
|
})
|
|
12184
12582
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -12191,7 +12589,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12191
12589
|
subagentFilePaths.map(
|
|
12192
12590
|
(path3) => factory.class.fromFile({
|
|
12193
12591
|
baseDir: this.baseDir,
|
|
12194
|
-
relativeFilePath: (0,
|
|
12592
|
+
relativeFilePath: (0, import_node_path92.basename)(path3),
|
|
12195
12593
|
global: this.global
|
|
12196
12594
|
})
|
|
12197
12595
|
)
|
|
@@ -12236,49 +12634,49 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12236
12634
|
};
|
|
12237
12635
|
|
|
12238
12636
|
// src/features/rules/agentsmd-rule.ts
|
|
12239
|
-
var
|
|
12637
|
+
var import_node_path95 = require("path");
|
|
12240
12638
|
|
|
12241
12639
|
// src/features/rules/tool-rule.ts
|
|
12242
|
-
var
|
|
12640
|
+
var import_node_path94 = require("path");
|
|
12243
12641
|
|
|
12244
12642
|
// src/features/rules/rulesync-rule.ts
|
|
12245
|
-
var
|
|
12246
|
-
var
|
|
12247
|
-
var RulesyncRuleFrontmatterSchema =
|
|
12248
|
-
root:
|
|
12249
|
-
localRoot:
|
|
12250
|
-
targets:
|
|
12251
|
-
description:
|
|
12252
|
-
globs:
|
|
12253
|
-
agentsmd:
|
|
12254
|
-
|
|
12643
|
+
var import_node_path93 = require("path");
|
|
12644
|
+
var import_mini50 = require("zod/mini");
|
|
12645
|
+
var RulesyncRuleFrontmatterSchema = import_mini50.z.object({
|
|
12646
|
+
root: import_mini50.z.optional(import_mini50.z.boolean()),
|
|
12647
|
+
localRoot: import_mini50.z.optional(import_mini50.z.boolean()),
|
|
12648
|
+
targets: import_mini50.z._default(RulesyncTargetsSchema, ["*"]),
|
|
12649
|
+
description: import_mini50.z.optional(import_mini50.z.string()),
|
|
12650
|
+
globs: import_mini50.z.optional(import_mini50.z.array(import_mini50.z.string())),
|
|
12651
|
+
agentsmd: import_mini50.z.optional(
|
|
12652
|
+
import_mini50.z.object({
|
|
12255
12653
|
// @example "path/to/subproject"
|
|
12256
|
-
subprojectPath:
|
|
12654
|
+
subprojectPath: import_mini50.z.optional(import_mini50.z.string())
|
|
12257
12655
|
})
|
|
12258
12656
|
),
|
|
12259
|
-
claudecode:
|
|
12260
|
-
|
|
12657
|
+
claudecode: import_mini50.z.optional(
|
|
12658
|
+
import_mini50.z.object({
|
|
12261
12659
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
12262
12660
|
// @example ["src/**/*.ts", "tests/**/*.test.ts"]
|
|
12263
|
-
paths:
|
|
12661
|
+
paths: import_mini50.z.optional(import_mini50.z.array(import_mini50.z.string()))
|
|
12264
12662
|
})
|
|
12265
12663
|
),
|
|
12266
|
-
cursor:
|
|
12267
|
-
|
|
12268
|
-
alwaysApply:
|
|
12269
|
-
description:
|
|
12270
|
-
globs:
|
|
12664
|
+
cursor: import_mini50.z.optional(
|
|
12665
|
+
import_mini50.z.object({
|
|
12666
|
+
alwaysApply: import_mini50.z.optional(import_mini50.z.boolean()),
|
|
12667
|
+
description: import_mini50.z.optional(import_mini50.z.string()),
|
|
12668
|
+
globs: import_mini50.z.optional(import_mini50.z.array(import_mini50.z.string()))
|
|
12271
12669
|
})
|
|
12272
12670
|
),
|
|
12273
|
-
copilot:
|
|
12274
|
-
|
|
12275
|
-
excludeAgent:
|
|
12671
|
+
copilot: import_mini50.z.optional(
|
|
12672
|
+
import_mini50.z.object({
|
|
12673
|
+
excludeAgent: import_mini50.z.optional(import_mini50.z.union([import_mini50.z.literal("code-review"), import_mini50.z.literal("coding-agent")]))
|
|
12276
12674
|
})
|
|
12277
12675
|
),
|
|
12278
|
-
antigravity:
|
|
12279
|
-
|
|
12280
|
-
trigger:
|
|
12281
|
-
globs:
|
|
12676
|
+
antigravity: import_mini50.z.optional(
|
|
12677
|
+
import_mini50.z.looseObject({
|
|
12678
|
+
trigger: import_mini50.z.optional(import_mini50.z.string()),
|
|
12679
|
+
globs: import_mini50.z.optional(import_mini50.z.array(import_mini50.z.string()))
|
|
12282
12680
|
})
|
|
12283
12681
|
)
|
|
12284
12682
|
});
|
|
@@ -12289,7 +12687,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
12289
12687
|
const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12290
12688
|
if (!parseResult.success && rest.validate !== false) {
|
|
12291
12689
|
throw new Error(
|
|
12292
|
-
`Invalid frontmatter in ${(0,
|
|
12690
|
+
`Invalid frontmatter in ${(0, import_node_path93.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
12293
12691
|
);
|
|
12294
12692
|
}
|
|
12295
12693
|
const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -12324,7 +12722,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
12324
12722
|
return {
|
|
12325
12723
|
success: false,
|
|
12326
12724
|
error: new Error(
|
|
12327
|
-
`Invalid frontmatter in ${(0,
|
|
12725
|
+
`Invalid frontmatter in ${(0, import_node_path93.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12328
12726
|
)
|
|
12329
12727
|
};
|
|
12330
12728
|
}
|
|
@@ -12333,7 +12731,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
12333
12731
|
relativeFilePath,
|
|
12334
12732
|
validate = true
|
|
12335
12733
|
}) {
|
|
12336
|
-
const filePath = (0,
|
|
12734
|
+
const filePath = (0, import_node_path93.join)(
|
|
12337
12735
|
process.cwd(),
|
|
12338
12736
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
12339
12737
|
relativeFilePath
|
|
@@ -12435,7 +12833,7 @@ var ToolRule = class extends ToolFile {
|
|
|
12435
12833
|
rulesyncRule,
|
|
12436
12834
|
validate = true,
|
|
12437
12835
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
12438
|
-
nonRootPath = { relativeDirPath: (0,
|
|
12836
|
+
nonRootPath = { relativeDirPath: (0, import_node_path94.join)(".agents", "memories") }
|
|
12439
12837
|
}) {
|
|
12440
12838
|
const params = this.buildToolRuleParamsDefault({
|
|
12441
12839
|
baseDir,
|
|
@@ -12446,7 +12844,7 @@ var ToolRule = class extends ToolFile {
|
|
|
12446
12844
|
});
|
|
12447
12845
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
12448
12846
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
12449
|
-
params.relativeDirPath = (0,
|
|
12847
|
+
params.relativeDirPath = (0, import_node_path94.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
12450
12848
|
params.relativeFilePath = "AGENTS.md";
|
|
12451
12849
|
}
|
|
12452
12850
|
return params;
|
|
@@ -12495,7 +12893,7 @@ var ToolRule = class extends ToolFile {
|
|
|
12495
12893
|
}
|
|
12496
12894
|
};
|
|
12497
12895
|
function buildToolPath(toolDir, subDir, excludeToolDir) {
|
|
12498
|
-
return excludeToolDir ? subDir : (0,
|
|
12896
|
+
return excludeToolDir ? subDir : (0, import_node_path94.join)(toolDir, subDir);
|
|
12499
12897
|
}
|
|
12500
12898
|
|
|
12501
12899
|
// src/features/rules/agentsmd-rule.ts
|
|
@@ -12524,8 +12922,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
12524
12922
|
validate = true
|
|
12525
12923
|
}) {
|
|
12526
12924
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
12527
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
12528
|
-
const fileContent = await readFileContent((0,
|
|
12925
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path95.join)(".agents", "memories", relativeFilePath);
|
|
12926
|
+
const fileContent = await readFileContent((0, import_node_path95.join)(baseDir, relativePath));
|
|
12529
12927
|
return new _AgentsMdRule({
|
|
12530
12928
|
baseDir,
|
|
12531
12929
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -12580,21 +12978,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
12580
12978
|
};
|
|
12581
12979
|
|
|
12582
12980
|
// src/features/rules/antigravity-rule.ts
|
|
12583
|
-
var
|
|
12584
|
-
var
|
|
12585
|
-
var AntigravityRuleFrontmatterSchema =
|
|
12586
|
-
trigger:
|
|
12587
|
-
|
|
12588
|
-
|
|
12589
|
-
|
|
12590
|
-
|
|
12591
|
-
|
|
12592
|
-
|
|
12981
|
+
var import_node_path96 = require("path");
|
|
12982
|
+
var import_mini51 = require("zod/mini");
|
|
12983
|
+
var AntigravityRuleFrontmatterSchema = import_mini51.z.looseObject({
|
|
12984
|
+
trigger: import_mini51.z.optional(
|
|
12985
|
+
import_mini51.z.union([
|
|
12986
|
+
import_mini51.z.literal("always_on"),
|
|
12987
|
+
import_mini51.z.literal("glob"),
|
|
12988
|
+
import_mini51.z.literal("manual"),
|
|
12989
|
+
import_mini51.z.literal("model_decision"),
|
|
12990
|
+
import_mini51.z.string()
|
|
12593
12991
|
// accepts any string for forward compatibility
|
|
12594
12992
|
])
|
|
12595
12993
|
),
|
|
12596
|
-
globs:
|
|
12597
|
-
description:
|
|
12994
|
+
globs: import_mini51.z.optional(import_mini51.z.string()),
|
|
12995
|
+
description: import_mini51.z.optional(import_mini51.z.string())
|
|
12598
12996
|
});
|
|
12599
12997
|
function parseGlobsString(globs) {
|
|
12600
12998
|
if (!globs) {
|
|
@@ -12739,7 +13137,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
12739
13137
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12740
13138
|
if (!result.success) {
|
|
12741
13139
|
throw new Error(
|
|
12742
|
-
`Invalid frontmatter in ${(0,
|
|
13140
|
+
`Invalid frontmatter in ${(0, import_node_path96.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12743
13141
|
);
|
|
12744
13142
|
}
|
|
12745
13143
|
}
|
|
@@ -12763,7 +13161,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
12763
13161
|
relativeFilePath,
|
|
12764
13162
|
validate = true
|
|
12765
13163
|
}) {
|
|
12766
|
-
const filePath = (0,
|
|
13164
|
+
const filePath = (0, import_node_path96.join)(
|
|
12767
13165
|
baseDir,
|
|
12768
13166
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
12769
13167
|
relativeFilePath
|
|
@@ -12903,7 +13301,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
12903
13301
|
};
|
|
12904
13302
|
|
|
12905
13303
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
12906
|
-
var
|
|
13304
|
+
var import_node_path97 = require("path");
|
|
12907
13305
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
12908
13306
|
toRulesyncRule() {
|
|
12909
13307
|
const rulesyncFrontmatter = {
|
|
@@ -12963,8 +13361,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
12963
13361
|
}) {
|
|
12964
13362
|
const settablePaths = this.getSettablePaths();
|
|
12965
13363
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
12966
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
12967
|
-
const fileContent = await readFileContent((0,
|
|
13364
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path97.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13365
|
+
const fileContent = await readFileContent((0, import_node_path97.join)(baseDir, relativePath));
|
|
12968
13366
|
return new _AugmentcodeLegacyRule({
|
|
12969
13367
|
baseDir,
|
|
12970
13368
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -12993,7 +13391,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
12993
13391
|
};
|
|
12994
13392
|
|
|
12995
13393
|
// src/features/rules/augmentcode-rule.ts
|
|
12996
|
-
var
|
|
13394
|
+
var import_node_path98 = require("path");
|
|
12997
13395
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
12998
13396
|
toRulesyncRule() {
|
|
12999
13397
|
return this.toRulesyncRuleDefault();
|
|
@@ -13024,7 +13422,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
13024
13422
|
relativeFilePath,
|
|
13025
13423
|
validate = true
|
|
13026
13424
|
}) {
|
|
13027
|
-
const filePath = (0,
|
|
13425
|
+
const filePath = (0, import_node_path98.join)(
|
|
13028
13426
|
baseDir,
|
|
13029
13427
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13030
13428
|
relativeFilePath
|
|
@@ -13064,7 +13462,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
13064
13462
|
};
|
|
13065
13463
|
|
|
13066
13464
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
13067
|
-
var
|
|
13465
|
+
var import_node_path99 = require("path");
|
|
13068
13466
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
13069
13467
|
static getSettablePaths({
|
|
13070
13468
|
global,
|
|
@@ -13106,7 +13504,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13106
13504
|
if (isRoot) {
|
|
13107
13505
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
13108
13506
|
const fileContent2 = await readFileContent(
|
|
13109
|
-
(0,
|
|
13507
|
+
(0, import_node_path99.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
13110
13508
|
);
|
|
13111
13509
|
return new _ClaudecodeLegacyRule({
|
|
13112
13510
|
baseDir,
|
|
@@ -13120,8 +13518,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13120
13518
|
if (!paths.nonRoot) {
|
|
13121
13519
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13122
13520
|
}
|
|
13123
|
-
const relativePath = (0,
|
|
13124
|
-
const fileContent = await readFileContent((0,
|
|
13521
|
+
const relativePath = (0, import_node_path99.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13522
|
+
const fileContent = await readFileContent((0, import_node_path99.join)(baseDir, relativePath));
|
|
13125
13523
|
return new _ClaudecodeLegacyRule({
|
|
13126
13524
|
baseDir,
|
|
13127
13525
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13180,10 +13578,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13180
13578
|
};
|
|
13181
13579
|
|
|
13182
13580
|
// src/features/rules/claudecode-rule.ts
|
|
13183
|
-
var
|
|
13184
|
-
var
|
|
13185
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
13186
|
-
paths:
|
|
13581
|
+
var import_node_path100 = require("path");
|
|
13582
|
+
var import_mini52 = require("zod/mini");
|
|
13583
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini52.z.object({
|
|
13584
|
+
paths: import_mini52.z.optional(import_mini52.z.array(import_mini52.z.string()))
|
|
13187
13585
|
});
|
|
13188
13586
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
13189
13587
|
frontmatter;
|
|
@@ -13221,7 +13619,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13221
13619
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13222
13620
|
if (!result.success) {
|
|
13223
13621
|
throw new Error(
|
|
13224
|
-
`Invalid frontmatter in ${(0,
|
|
13622
|
+
`Invalid frontmatter in ${(0, import_node_path100.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13225
13623
|
);
|
|
13226
13624
|
}
|
|
13227
13625
|
}
|
|
@@ -13251,7 +13649,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13251
13649
|
if (isRoot) {
|
|
13252
13650
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
13253
13651
|
const fileContent2 = await readFileContent(
|
|
13254
|
-
(0,
|
|
13652
|
+
(0, import_node_path100.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
13255
13653
|
);
|
|
13256
13654
|
return new _ClaudecodeRule({
|
|
13257
13655
|
baseDir,
|
|
@@ -13266,8 +13664,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13266
13664
|
if (!paths.nonRoot) {
|
|
13267
13665
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13268
13666
|
}
|
|
13269
|
-
const relativePath = (0,
|
|
13270
|
-
const filePath = (0,
|
|
13667
|
+
const relativePath = (0, import_node_path100.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13668
|
+
const filePath = (0, import_node_path100.join)(baseDir, relativePath);
|
|
13271
13669
|
const fileContent = await readFileContent(filePath);
|
|
13272
13670
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13273
13671
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13378,7 +13776,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13378
13776
|
return {
|
|
13379
13777
|
success: false,
|
|
13380
13778
|
error: new Error(
|
|
13381
|
-
`Invalid frontmatter in ${(0,
|
|
13779
|
+
`Invalid frontmatter in ${(0, import_node_path100.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13382
13780
|
)
|
|
13383
13781
|
};
|
|
13384
13782
|
}
|
|
@@ -13398,10 +13796,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13398
13796
|
};
|
|
13399
13797
|
|
|
13400
13798
|
// src/features/rules/cline-rule.ts
|
|
13401
|
-
var
|
|
13402
|
-
var
|
|
13403
|
-
var ClineRuleFrontmatterSchema =
|
|
13404
|
-
description:
|
|
13799
|
+
var import_node_path101 = require("path");
|
|
13800
|
+
var import_mini53 = require("zod/mini");
|
|
13801
|
+
var ClineRuleFrontmatterSchema = import_mini53.z.object({
|
|
13802
|
+
description: import_mini53.z.string()
|
|
13405
13803
|
});
|
|
13406
13804
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
13407
13805
|
static getSettablePaths(_options = {}) {
|
|
@@ -13444,7 +13842,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
13444
13842
|
validate = true
|
|
13445
13843
|
}) {
|
|
13446
13844
|
const fileContent = await readFileContent(
|
|
13447
|
-
(0,
|
|
13845
|
+
(0, import_node_path101.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
13448
13846
|
);
|
|
13449
13847
|
return new _ClineRule({
|
|
13450
13848
|
baseDir,
|
|
@@ -13470,7 +13868,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
13470
13868
|
};
|
|
13471
13869
|
|
|
13472
13870
|
// src/features/rules/codexcli-rule.ts
|
|
13473
|
-
var
|
|
13871
|
+
var import_node_path102 = require("path");
|
|
13474
13872
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
13475
13873
|
static getSettablePaths({
|
|
13476
13874
|
global,
|
|
@@ -13505,7 +13903,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
13505
13903
|
if (isRoot) {
|
|
13506
13904
|
const relativePath2 = paths.root.relativeFilePath;
|
|
13507
13905
|
const fileContent2 = await readFileContent(
|
|
13508
|
-
(0,
|
|
13906
|
+
(0, import_node_path102.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
13509
13907
|
);
|
|
13510
13908
|
return new _CodexcliRule({
|
|
13511
13909
|
baseDir,
|
|
@@ -13519,8 +13917,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
13519
13917
|
if (!paths.nonRoot) {
|
|
13520
13918
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13521
13919
|
}
|
|
13522
|
-
const relativePath = (0,
|
|
13523
|
-
const fileContent = await readFileContent((0,
|
|
13920
|
+
const relativePath = (0, import_node_path102.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13921
|
+
const fileContent = await readFileContent((0, import_node_path102.join)(baseDir, relativePath));
|
|
13524
13922
|
return new _CodexcliRule({
|
|
13525
13923
|
baseDir,
|
|
13526
13924
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13579,12 +13977,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
13579
13977
|
};
|
|
13580
13978
|
|
|
13581
13979
|
// src/features/rules/copilot-rule.ts
|
|
13582
|
-
var
|
|
13583
|
-
var
|
|
13584
|
-
var CopilotRuleFrontmatterSchema =
|
|
13585
|
-
description:
|
|
13586
|
-
applyTo:
|
|
13587
|
-
excludeAgent:
|
|
13980
|
+
var import_node_path103 = require("path");
|
|
13981
|
+
var import_mini54 = require("zod/mini");
|
|
13982
|
+
var CopilotRuleFrontmatterSchema = import_mini54.z.object({
|
|
13983
|
+
description: import_mini54.z.optional(import_mini54.z.string()),
|
|
13984
|
+
applyTo: import_mini54.z.optional(import_mini54.z.string()),
|
|
13985
|
+
excludeAgent: import_mini54.z.optional(import_mini54.z.union([import_mini54.z.literal("code-review"), import_mini54.z.literal("coding-agent")]))
|
|
13588
13986
|
});
|
|
13589
13987
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
13590
13988
|
frontmatter;
|
|
@@ -13595,6 +13993,9 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13595
13993
|
root: {
|
|
13596
13994
|
relativeDirPath: buildToolPath(".copilot", ".", options.excludeToolDir),
|
|
13597
13995
|
relativeFilePath: "copilot-instructions.md"
|
|
13996
|
+
},
|
|
13997
|
+
nonRoot: {
|
|
13998
|
+
relativeDirPath: buildToolPath(".copilot", "instructions", options.excludeToolDir)
|
|
13598
13999
|
}
|
|
13599
14000
|
};
|
|
13600
14001
|
}
|
|
@@ -13613,7 +14014,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13613
14014
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13614
14015
|
if (!result.success) {
|
|
13615
14016
|
throw new Error(
|
|
13616
|
-
`Invalid frontmatter in ${(0,
|
|
14017
|
+
`Invalid frontmatter in ${(0, import_node_path103.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13617
14018
|
);
|
|
13618
14019
|
}
|
|
13619
14020
|
}
|
|
@@ -13703,8 +14104,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13703
14104
|
const paths = this.getSettablePaths({ global });
|
|
13704
14105
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
13705
14106
|
if (isRoot) {
|
|
13706
|
-
const relativePath2 = (0,
|
|
13707
|
-
const filePath2 = (0,
|
|
14107
|
+
const relativePath2 = (0, import_node_path103.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
14108
|
+
const filePath2 = (0, import_node_path103.join)(baseDir, relativePath2);
|
|
13708
14109
|
const fileContent2 = await readFileContent(filePath2);
|
|
13709
14110
|
return new _CopilotRule({
|
|
13710
14111
|
baseDir,
|
|
@@ -13719,8 +14120,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13719
14120
|
if (!paths.nonRoot) {
|
|
13720
14121
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13721
14122
|
}
|
|
13722
|
-
const relativePath = (0,
|
|
13723
|
-
const filePath = (0,
|
|
14123
|
+
const relativePath = (0, import_node_path103.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14124
|
+
const filePath = (0, import_node_path103.join)(baseDir, relativePath);
|
|
13724
14125
|
const fileContent = await readFileContent(filePath);
|
|
13725
14126
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13726
14127
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13766,7 +14167,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13766
14167
|
return {
|
|
13767
14168
|
success: false,
|
|
13768
14169
|
error: new Error(
|
|
13769
|
-
`Invalid frontmatter in ${(0,
|
|
14170
|
+
`Invalid frontmatter in ${(0, import_node_path103.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13770
14171
|
)
|
|
13771
14172
|
};
|
|
13772
14173
|
}
|
|
@@ -13786,12 +14187,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13786
14187
|
};
|
|
13787
14188
|
|
|
13788
14189
|
// src/features/rules/cursor-rule.ts
|
|
13789
|
-
var
|
|
13790
|
-
var
|
|
13791
|
-
var CursorRuleFrontmatterSchema =
|
|
13792
|
-
description:
|
|
13793
|
-
globs:
|
|
13794
|
-
alwaysApply:
|
|
14190
|
+
var import_node_path104 = require("path");
|
|
14191
|
+
var import_mini55 = require("zod/mini");
|
|
14192
|
+
var CursorRuleFrontmatterSchema = import_mini55.z.object({
|
|
14193
|
+
description: import_mini55.z.optional(import_mini55.z.string()),
|
|
14194
|
+
globs: import_mini55.z.optional(import_mini55.z.string()),
|
|
14195
|
+
alwaysApply: import_mini55.z.optional(import_mini55.z.boolean())
|
|
13795
14196
|
});
|
|
13796
14197
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
13797
14198
|
frontmatter;
|
|
@@ -13808,7 +14209,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13808
14209
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13809
14210
|
if (!result.success) {
|
|
13810
14211
|
throw new Error(
|
|
13811
|
-
`Invalid frontmatter in ${(0,
|
|
14212
|
+
`Invalid frontmatter in ${(0, import_node_path104.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13812
14213
|
);
|
|
13813
14214
|
}
|
|
13814
14215
|
}
|
|
@@ -13924,7 +14325,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13924
14325
|
relativeFilePath,
|
|
13925
14326
|
validate = true
|
|
13926
14327
|
}) {
|
|
13927
|
-
const filePath = (0,
|
|
14328
|
+
const filePath = (0, import_node_path104.join)(
|
|
13928
14329
|
baseDir,
|
|
13929
14330
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13930
14331
|
relativeFilePath
|
|
@@ -13934,7 +14335,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13934
14335
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13935
14336
|
if (!result.success) {
|
|
13936
14337
|
throw new Error(
|
|
13937
|
-
`Invalid frontmatter in ${(0,
|
|
14338
|
+
`Invalid frontmatter in ${(0, import_node_path104.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
13938
14339
|
);
|
|
13939
14340
|
}
|
|
13940
14341
|
return new _CursorRule({
|
|
@@ -13971,7 +14372,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13971
14372
|
return {
|
|
13972
14373
|
success: false,
|
|
13973
14374
|
error: new Error(
|
|
13974
|
-
`Invalid frontmatter in ${(0,
|
|
14375
|
+
`Invalid frontmatter in ${(0, import_node_path104.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13975
14376
|
)
|
|
13976
14377
|
};
|
|
13977
14378
|
}
|
|
@@ -13991,7 +14392,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13991
14392
|
};
|
|
13992
14393
|
|
|
13993
14394
|
// src/features/rules/factorydroid-rule.ts
|
|
13994
|
-
var
|
|
14395
|
+
var import_node_path105 = require("path");
|
|
13995
14396
|
var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
13996
14397
|
constructor({ fileContent, root, ...rest }) {
|
|
13997
14398
|
super({
|
|
@@ -14031,8 +14432,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14031
14432
|
const paths = this.getSettablePaths({ global });
|
|
14032
14433
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
14033
14434
|
if (isRoot) {
|
|
14034
|
-
const relativePath2 = (0,
|
|
14035
|
-
const fileContent2 = await readFileContent((0,
|
|
14435
|
+
const relativePath2 = (0, import_node_path105.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
14436
|
+
const fileContent2 = await readFileContent((0, import_node_path105.join)(baseDir, relativePath2));
|
|
14036
14437
|
return new _FactorydroidRule({
|
|
14037
14438
|
baseDir,
|
|
14038
14439
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -14045,8 +14446,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14045
14446
|
if (!paths.nonRoot) {
|
|
14046
14447
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14047
14448
|
}
|
|
14048
|
-
const relativePath = (0,
|
|
14049
|
-
const fileContent = await readFileContent((0,
|
|
14449
|
+
const relativePath = (0, import_node_path105.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14450
|
+
const fileContent = await readFileContent((0, import_node_path105.join)(baseDir, relativePath));
|
|
14050
14451
|
return new _FactorydroidRule({
|
|
14051
14452
|
baseDir,
|
|
14052
14453
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14105,7 +14506,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14105
14506
|
};
|
|
14106
14507
|
|
|
14107
14508
|
// src/features/rules/geminicli-rule.ts
|
|
14108
|
-
var
|
|
14509
|
+
var import_node_path106 = require("path");
|
|
14109
14510
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
14110
14511
|
static getSettablePaths({
|
|
14111
14512
|
global,
|
|
@@ -14140,7 +14541,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14140
14541
|
if (isRoot) {
|
|
14141
14542
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14142
14543
|
const fileContent2 = await readFileContent(
|
|
14143
|
-
(0,
|
|
14544
|
+
(0, import_node_path106.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14144
14545
|
);
|
|
14145
14546
|
return new _GeminiCliRule({
|
|
14146
14547
|
baseDir,
|
|
@@ -14154,8 +14555,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14154
14555
|
if (!paths.nonRoot) {
|
|
14155
14556
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14156
14557
|
}
|
|
14157
|
-
const relativePath = (0,
|
|
14158
|
-
const fileContent = await readFileContent((0,
|
|
14558
|
+
const relativePath = (0, import_node_path106.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14559
|
+
const fileContent = await readFileContent((0, import_node_path106.join)(baseDir, relativePath));
|
|
14159
14560
|
return new _GeminiCliRule({
|
|
14160
14561
|
baseDir,
|
|
14161
14562
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14214,7 +14615,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14214
14615
|
};
|
|
14215
14616
|
|
|
14216
14617
|
// src/features/rules/goose-rule.ts
|
|
14217
|
-
var
|
|
14618
|
+
var import_node_path107 = require("path");
|
|
14218
14619
|
var GooseRule = class _GooseRule extends ToolRule {
|
|
14219
14620
|
static getSettablePaths({
|
|
14220
14621
|
global,
|
|
@@ -14249,7 +14650,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
14249
14650
|
if (isRoot) {
|
|
14250
14651
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14251
14652
|
const fileContent2 = await readFileContent(
|
|
14252
|
-
(0,
|
|
14653
|
+
(0, import_node_path107.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14253
14654
|
);
|
|
14254
14655
|
return new _GooseRule({
|
|
14255
14656
|
baseDir,
|
|
@@ -14263,8 +14664,8 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
14263
14664
|
if (!paths.nonRoot) {
|
|
14264
14665
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14265
14666
|
}
|
|
14266
|
-
const relativePath = (0,
|
|
14267
|
-
const fileContent = await readFileContent((0,
|
|
14667
|
+
const relativePath = (0, import_node_path107.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14668
|
+
const fileContent = await readFileContent((0, import_node_path107.join)(baseDir, relativePath));
|
|
14268
14669
|
return new _GooseRule({
|
|
14269
14670
|
baseDir,
|
|
14270
14671
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14323,7 +14724,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
14323
14724
|
};
|
|
14324
14725
|
|
|
14325
14726
|
// src/features/rules/junie-rule.ts
|
|
14326
|
-
var
|
|
14727
|
+
var import_node_path108 = require("path");
|
|
14327
14728
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
14328
14729
|
static getSettablePaths(_options = {}) {
|
|
14329
14730
|
return {
|
|
@@ -14342,8 +14743,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
14342
14743
|
validate = true
|
|
14343
14744
|
}) {
|
|
14344
14745
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
14345
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
14346
|
-
const fileContent = await readFileContent((0,
|
|
14746
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path108.join)(".junie", "memories", relativeFilePath);
|
|
14747
|
+
const fileContent = await readFileContent((0, import_node_path108.join)(baseDir, relativePath));
|
|
14347
14748
|
return new _JunieRule({
|
|
14348
14749
|
baseDir,
|
|
14349
14750
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -14398,7 +14799,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
14398
14799
|
};
|
|
14399
14800
|
|
|
14400
14801
|
// src/features/rules/kilo-rule.ts
|
|
14401
|
-
var
|
|
14802
|
+
var import_node_path109 = require("path");
|
|
14402
14803
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
14403
14804
|
static getSettablePaths(_options = {}) {
|
|
14404
14805
|
return {
|
|
@@ -14413,7 +14814,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
14413
14814
|
validate = true
|
|
14414
14815
|
}) {
|
|
14415
14816
|
const fileContent = await readFileContent(
|
|
14416
|
-
(0,
|
|
14817
|
+
(0, import_node_path109.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14417
14818
|
);
|
|
14418
14819
|
return new _KiloRule({
|
|
14419
14820
|
baseDir,
|
|
@@ -14465,7 +14866,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
14465
14866
|
};
|
|
14466
14867
|
|
|
14467
14868
|
// src/features/rules/kiro-rule.ts
|
|
14468
|
-
var
|
|
14869
|
+
var import_node_path110 = require("path");
|
|
14469
14870
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
14470
14871
|
static getSettablePaths(_options = {}) {
|
|
14471
14872
|
return {
|
|
@@ -14480,7 +14881,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
14480
14881
|
validate = true
|
|
14481
14882
|
}) {
|
|
14482
14883
|
const fileContent = await readFileContent(
|
|
14483
|
-
(0,
|
|
14884
|
+
(0, import_node_path110.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14484
14885
|
);
|
|
14485
14886
|
return new _KiroRule({
|
|
14486
14887
|
baseDir,
|
|
@@ -14534,7 +14935,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
14534
14935
|
};
|
|
14535
14936
|
|
|
14536
14937
|
// src/features/rules/opencode-rule.ts
|
|
14537
|
-
var
|
|
14938
|
+
var import_node_path111 = require("path");
|
|
14538
14939
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
14539
14940
|
static getSettablePaths({
|
|
14540
14941
|
global,
|
|
@@ -14569,7 +14970,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
14569
14970
|
if (isRoot) {
|
|
14570
14971
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14571
14972
|
const fileContent2 = await readFileContent(
|
|
14572
|
-
(0,
|
|
14973
|
+
(0, import_node_path111.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14573
14974
|
);
|
|
14574
14975
|
return new _OpenCodeRule({
|
|
14575
14976
|
baseDir,
|
|
@@ -14583,8 +14984,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
14583
14984
|
if (!paths.nonRoot) {
|
|
14584
14985
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14585
14986
|
}
|
|
14586
|
-
const relativePath = (0,
|
|
14587
|
-
const fileContent = await readFileContent((0,
|
|
14987
|
+
const relativePath = (0, import_node_path111.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14988
|
+
const fileContent = await readFileContent((0, import_node_path111.join)(baseDir, relativePath));
|
|
14588
14989
|
return new _OpenCodeRule({
|
|
14589
14990
|
baseDir,
|
|
14590
14991
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14643,7 +15044,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
14643
15044
|
};
|
|
14644
15045
|
|
|
14645
15046
|
// src/features/rules/qwencode-rule.ts
|
|
14646
|
-
var
|
|
15047
|
+
var import_node_path112 = require("path");
|
|
14647
15048
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
14648
15049
|
static getSettablePaths(_options = {}) {
|
|
14649
15050
|
return {
|
|
@@ -14662,8 +15063,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
14662
15063
|
validate = true
|
|
14663
15064
|
}) {
|
|
14664
15065
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
14665
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
14666
|
-
const fileContent = await readFileContent((0,
|
|
15066
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path112.join)(".qwen", "memories", relativeFilePath);
|
|
15067
|
+
const fileContent = await readFileContent((0, import_node_path112.join)(baseDir, relativePath));
|
|
14667
15068
|
return new _QwencodeRule({
|
|
14668
15069
|
baseDir,
|
|
14669
15070
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -14715,7 +15116,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
14715
15116
|
};
|
|
14716
15117
|
|
|
14717
15118
|
// src/features/rules/replit-rule.ts
|
|
14718
|
-
var
|
|
15119
|
+
var import_node_path113 = require("path");
|
|
14719
15120
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
14720
15121
|
static getSettablePaths(_options = {}) {
|
|
14721
15122
|
return {
|
|
@@ -14737,7 +15138,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
14737
15138
|
}
|
|
14738
15139
|
const relativePath = paths.root.relativeFilePath;
|
|
14739
15140
|
const fileContent = await readFileContent(
|
|
14740
|
-
(0,
|
|
15141
|
+
(0, import_node_path113.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
14741
15142
|
);
|
|
14742
15143
|
return new _ReplitRule({
|
|
14743
15144
|
baseDir,
|
|
@@ -14803,7 +15204,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
14803
15204
|
};
|
|
14804
15205
|
|
|
14805
15206
|
// src/features/rules/roo-rule.ts
|
|
14806
|
-
var
|
|
15207
|
+
var import_node_path114 = require("path");
|
|
14807
15208
|
var RooRule = class _RooRule extends ToolRule {
|
|
14808
15209
|
static getSettablePaths(_options = {}) {
|
|
14809
15210
|
return {
|
|
@@ -14818,7 +15219,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
14818
15219
|
validate = true
|
|
14819
15220
|
}) {
|
|
14820
15221
|
const fileContent = await readFileContent(
|
|
14821
|
-
(0,
|
|
15222
|
+
(0, import_node_path114.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14822
15223
|
);
|
|
14823
15224
|
return new _RooRule({
|
|
14824
15225
|
baseDir,
|
|
@@ -14887,7 +15288,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
14887
15288
|
};
|
|
14888
15289
|
|
|
14889
15290
|
// src/features/rules/warp-rule.ts
|
|
14890
|
-
var
|
|
15291
|
+
var import_node_path115 = require("path");
|
|
14891
15292
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
14892
15293
|
constructor({ fileContent, root, ...rest }) {
|
|
14893
15294
|
super({
|
|
@@ -14913,8 +15314,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
14913
15314
|
validate = true
|
|
14914
15315
|
}) {
|
|
14915
15316
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
14916
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
14917
|
-
const fileContent = await readFileContent((0,
|
|
15317
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path115.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
15318
|
+
const fileContent = await readFileContent((0, import_node_path115.join)(baseDir, relativePath));
|
|
14918
15319
|
return new _WarpRule({
|
|
14919
15320
|
baseDir,
|
|
14920
15321
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -14969,7 +15370,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
14969
15370
|
};
|
|
14970
15371
|
|
|
14971
15372
|
// src/features/rules/windsurf-rule.ts
|
|
14972
|
-
var
|
|
15373
|
+
var import_node_path116 = require("path");
|
|
14973
15374
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
14974
15375
|
static getSettablePaths(_options = {}) {
|
|
14975
15376
|
return {
|
|
@@ -14984,7 +15385,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
14984
15385
|
validate = true
|
|
14985
15386
|
}) {
|
|
14986
15387
|
const fileContent = await readFileContent(
|
|
14987
|
-
(0,
|
|
15388
|
+
(0, import_node_path116.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14988
15389
|
);
|
|
14989
15390
|
return new _WindsurfRule({
|
|
14990
15391
|
baseDir,
|
|
@@ -15060,8 +15461,8 @@ var rulesProcessorToolTargets = [
|
|
|
15060
15461
|
"warp",
|
|
15061
15462
|
"windsurf"
|
|
15062
15463
|
];
|
|
15063
|
-
var RulesProcessorToolTargetSchema =
|
|
15064
|
-
var formatRulePaths = (rules) => rules.map((r) => (0,
|
|
15464
|
+
var RulesProcessorToolTargetSchema = import_mini56.z.enum(rulesProcessorToolTargets);
|
|
15465
|
+
var formatRulePaths = (rules) => rules.map((r) => (0, import_node_path117.join)(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
15065
15466
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
15066
15467
|
[
|
|
15067
15468
|
"agentsmd",
|
|
@@ -15436,7 +15837,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15436
15837
|
}).relativeDirPath;
|
|
15437
15838
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
15438
15839
|
const frontmatter = skill.getFrontmatter();
|
|
15439
|
-
const relativePath = (0,
|
|
15840
|
+
const relativePath = (0, import_node_path117.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
15440
15841
|
return {
|
|
15441
15842
|
name: frontmatter.name,
|
|
15442
15843
|
description: frontmatter.description,
|
|
@@ -15549,12 +15950,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15549
15950
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
15550
15951
|
*/
|
|
15551
15952
|
async loadRulesyncFiles() {
|
|
15552
|
-
const rulesyncBaseDir = (0,
|
|
15553
|
-
const files = await findFilesByGlobs((0,
|
|
15953
|
+
const rulesyncBaseDir = (0, import_node_path117.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
15954
|
+
const files = await findFilesByGlobs((0, import_node_path117.join)(rulesyncBaseDir, "**", "*.md"));
|
|
15554
15955
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
15555
15956
|
const rulesyncRules = await Promise.all(
|
|
15556
15957
|
files.map((file) => {
|
|
15557
|
-
const relativeFilePath = (0,
|
|
15958
|
+
const relativeFilePath = (0, import_node_path117.relative)(rulesyncBaseDir, file);
|
|
15558
15959
|
checkPathTraversal({
|
|
15559
15960
|
relativePath: relativeFilePath,
|
|
15560
15961
|
intendedRootDir: rulesyncBaseDir
|
|
@@ -15564,41 +15965,57 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15564
15965
|
});
|
|
15565
15966
|
})
|
|
15566
15967
|
);
|
|
15968
|
+
const factory = this.getFactory(this.toolTarget);
|
|
15567
15969
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
15568
|
-
|
|
15569
|
-
|
|
15970
|
+
const targetedRootRules = rootRules.filter(
|
|
15971
|
+
(rule) => factory.class.isTargetedByRulesyncRule(rule)
|
|
15972
|
+
);
|
|
15973
|
+
if (targetedRootRules.length > 1) {
|
|
15974
|
+
throw new Error(
|
|
15975
|
+
`Multiple root rulesync rules found for target '${this.toolTarget}': ${formatRulePaths(targetedRootRules)}`
|
|
15976
|
+
);
|
|
15570
15977
|
}
|
|
15571
|
-
if (
|
|
15978
|
+
if (targetedRootRules.length === 0 && rulesyncRules.length > 0) {
|
|
15572
15979
|
logger.warn(
|
|
15573
|
-
`No root rulesync rule file found. Consider adding 'root: true' to one of your rule files in ${RULESYNC_RULES_RELATIVE_DIR_PATH}.`
|
|
15980
|
+
`No root rulesync rule file found for target '${this.toolTarget}'. Consider adding 'root: true' to one of your rule files in ${RULESYNC_RULES_RELATIVE_DIR_PATH}.`
|
|
15574
15981
|
);
|
|
15575
15982
|
}
|
|
15576
15983
|
const localRootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().localRoot);
|
|
15577
|
-
|
|
15984
|
+
const targetedLocalRootRules = localRootRules.filter(
|
|
15985
|
+
(rule) => factory.class.isTargetedByRulesyncRule(rule)
|
|
15986
|
+
);
|
|
15987
|
+
if (targetedLocalRootRules.length > 1) {
|
|
15578
15988
|
throw new Error(
|
|
15579
|
-
`Multiple localRoot rules found: ${formatRulePaths(
|
|
15989
|
+
`Multiple localRoot rules found for target '${this.toolTarget}': ${formatRulePaths(targetedLocalRootRules)}. Only one rule can have localRoot: true`
|
|
15580
15990
|
);
|
|
15581
15991
|
}
|
|
15582
|
-
if (
|
|
15992
|
+
if (targetedLocalRootRules.length > 0 && targetedRootRules.length === 0) {
|
|
15583
15993
|
throw new Error(
|
|
15584
|
-
`localRoot: true requires a root: true rule to exist (found in ${formatRulePaths(
|
|
15994
|
+
`localRoot: true requires a root: true rule to exist for target '${this.toolTarget}' (found in ${formatRulePaths(targetedLocalRootRules)})`
|
|
15585
15995
|
);
|
|
15586
15996
|
}
|
|
15587
15997
|
if (this.global) {
|
|
15588
|
-
const
|
|
15589
|
-
|
|
15998
|
+
const globalPaths = factory.class.getSettablePaths({ global: true });
|
|
15999
|
+
const supportsGlobalNonRoot = "nonRoot" in globalPaths && globalPaths.nonRoot !== null;
|
|
16000
|
+
const nonRootRules2 = rulesyncRules.filter(
|
|
16001
|
+
(rule) => !rule.getFrontmatter().root && !rule.getFrontmatter().localRoot && factory.class.isTargetedByRulesyncRule(rule)
|
|
16002
|
+
);
|
|
16003
|
+
if (nonRootRules2.length > 0 && !supportsGlobalNonRoot) {
|
|
15590
16004
|
logger.warn(
|
|
15591
|
-
`${
|
|
16005
|
+
`${nonRootRules2.length} non-root rulesync rules found, but it's in global mode, so ignoring them: ${formatRulePaths(nonRootRules2)}`
|
|
15592
16006
|
);
|
|
15593
16007
|
}
|
|
15594
|
-
if (
|
|
16008
|
+
if (targetedLocalRootRules.length > 0) {
|
|
15595
16009
|
logger.warn(
|
|
15596
|
-
`${
|
|
16010
|
+
`${targetedLocalRootRules.length} localRoot rules found, but localRoot is not supported in global mode, ignoring them: ${formatRulePaths(targetedLocalRootRules)}`
|
|
15597
16011
|
);
|
|
15598
16012
|
}
|
|
15599
|
-
return
|
|
16013
|
+
return supportsGlobalNonRoot ? [...targetedRootRules, ...nonRootRules2] : targetedRootRules;
|
|
15600
16014
|
}
|
|
15601
|
-
|
|
16015
|
+
const nonRootRules = rulesyncRules.filter(
|
|
16016
|
+
(rule) => !rule.getFrontmatter().root && factory.class.isTargetedByRulesyncRule(rule)
|
|
16017
|
+
);
|
|
16018
|
+
return [...targetedRootRules, ...nonRootRules];
|
|
15602
16019
|
}
|
|
15603
16020
|
/**
|
|
15604
16021
|
* Implementation of abstract method from FeatureProcessor
|
|
@@ -15613,7 +16030,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15613
16030
|
global: this.global
|
|
15614
16031
|
});
|
|
15615
16032
|
const resolveRelativeDirPath = (filePath) => {
|
|
15616
|
-
const dirName = (0,
|
|
16033
|
+
const dirName = (0, import_node_path117.dirname)((0, import_node_path117.relative)(this.baseDir, filePath));
|
|
15617
16034
|
return dirName === "" ? "." : dirName;
|
|
15618
16035
|
};
|
|
15619
16036
|
const findFilesWithFallback = async (primaryGlob, alternativeRoots, buildAltGlob) => {
|
|
@@ -15631,13 +16048,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15631
16048
|
return [];
|
|
15632
16049
|
}
|
|
15633
16050
|
const uniqueRootFilePaths = await findFilesWithFallback(
|
|
15634
|
-
(0,
|
|
16051
|
+
(0, import_node_path117.join)(
|
|
15635
16052
|
this.baseDir,
|
|
15636
16053
|
settablePaths.root.relativeDirPath ?? ".",
|
|
15637
16054
|
settablePaths.root.relativeFilePath
|
|
15638
16055
|
),
|
|
15639
16056
|
settablePaths.alternativeRoots,
|
|
15640
|
-
(alt) => (0,
|
|
16057
|
+
(alt) => (0, import_node_path117.join)(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
|
|
15641
16058
|
);
|
|
15642
16059
|
if (forDeletion) {
|
|
15643
16060
|
return uniqueRootFilePaths.map((filePath) => {
|
|
@@ -15649,7 +16066,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15649
16066
|
return factory.class.forDeletion({
|
|
15650
16067
|
baseDir: this.baseDir,
|
|
15651
16068
|
relativeDirPath,
|
|
15652
|
-
relativeFilePath: (0,
|
|
16069
|
+
relativeFilePath: (0, import_node_path117.basename)(filePath),
|
|
15653
16070
|
global: this.global
|
|
15654
16071
|
});
|
|
15655
16072
|
}).filter((rule) => rule.isDeletable());
|
|
@@ -15663,7 +16080,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15663
16080
|
});
|
|
15664
16081
|
return factory.class.fromFile({
|
|
15665
16082
|
baseDir: this.baseDir,
|
|
15666
|
-
relativeFilePath: (0,
|
|
16083
|
+
relativeFilePath: (0, import_node_path117.basename)(filePath),
|
|
15667
16084
|
relativeDirPath,
|
|
15668
16085
|
global: this.global
|
|
15669
16086
|
});
|
|
@@ -15682,9 +16099,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15682
16099
|
return [];
|
|
15683
16100
|
}
|
|
15684
16101
|
const uniqueLocalRootFilePaths = await findFilesWithFallback(
|
|
15685
|
-
(0,
|
|
16102
|
+
(0, import_node_path117.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
|
|
15686
16103
|
settablePaths.alternativeRoots,
|
|
15687
|
-
(alt) => (0,
|
|
16104
|
+
(alt) => (0, import_node_path117.join)(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
|
|
15688
16105
|
);
|
|
15689
16106
|
return uniqueLocalRootFilePaths.map((filePath) => {
|
|
15690
16107
|
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
@@ -15695,7 +16112,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15695
16112
|
return factory.class.forDeletion({
|
|
15696
16113
|
baseDir: this.baseDir,
|
|
15697
16114
|
relativeDirPath,
|
|
15698
|
-
relativeFilePath: (0,
|
|
16115
|
+
relativeFilePath: (0, import_node_path117.basename)(filePath),
|
|
15699
16116
|
global: this.global
|
|
15700
16117
|
});
|
|
15701
16118
|
}).filter((rule) => rule.isDeletable());
|
|
@@ -15705,13 +16122,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15705
16122
|
if (!settablePaths.nonRoot) {
|
|
15706
16123
|
return [];
|
|
15707
16124
|
}
|
|
15708
|
-
const nonRootBaseDir = (0,
|
|
16125
|
+
const nonRootBaseDir = (0, import_node_path117.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
15709
16126
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
15710
|
-
(0,
|
|
16127
|
+
(0, import_node_path117.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
15711
16128
|
);
|
|
15712
16129
|
if (forDeletion) {
|
|
15713
16130
|
return nonRootFilePaths.map((filePath) => {
|
|
15714
|
-
const relativeFilePath = (0,
|
|
16131
|
+
const relativeFilePath = (0, import_node_path117.relative)(nonRootBaseDir, filePath);
|
|
15715
16132
|
checkPathTraversal({
|
|
15716
16133
|
relativePath: relativeFilePath,
|
|
15717
16134
|
intendedRootDir: nonRootBaseDir
|
|
@@ -15726,7 +16143,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15726
16143
|
}
|
|
15727
16144
|
return await Promise.all(
|
|
15728
16145
|
nonRootFilePaths.map((filePath) => {
|
|
15729
|
-
const relativeFilePath = (0,
|
|
16146
|
+
const relativeFilePath = (0, import_node_path117.relative)(nonRootBaseDir, filePath);
|
|
15730
16147
|
checkPathTraversal({
|
|
15731
16148
|
relativePath: relativeFilePath,
|
|
15732
16149
|
intendedRootDir: nonRootBaseDir
|
|
@@ -15839,14 +16256,14 @@ s/<command> [arguments]
|
|
|
15839
16256
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
15840
16257
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
15841
16258
|
|
|
15842
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
16259
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path117.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
15843
16260
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
15844
16261
|
|
|
15845
16262
|
Simulated subagents are specialized AI assistants that can be invoked to handle specific types of tasks. In this case, it can be appear something like custom slash commands simply. Simulated subagents can be called by custom slash commands.
|
|
15846
16263
|
|
|
15847
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
16264
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path117.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
15848
16265
|
|
|
15849
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
16266
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path117.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
15850
16267
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
15851
16268
|
const result = [
|
|
15852
16269
|
overview,
|
|
@@ -15926,7 +16343,7 @@ function warnUnsupportedTargets(params) {
|
|
|
15926
16343
|
}
|
|
15927
16344
|
}
|
|
15928
16345
|
async function checkRulesyncDirExists(params) {
|
|
15929
|
-
return fileExists((0,
|
|
16346
|
+
return fileExists((0, import_node_path118.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
15930
16347
|
}
|
|
15931
16348
|
async function generate(params) {
|
|
15932
16349
|
const { config } = params;
|