rulesync 6.0.0 → 6.1.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 +24 -0
- package/dist/index.cjs +143 -56
- package/dist/index.js +553 -466
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -95,14 +95,29 @@ var logger = new Logger();
|
|
|
95
95
|
|
|
96
96
|
// src/config/config-resolver.ts
|
|
97
97
|
import { parse as parseJsonc } from "jsonc-parser";
|
|
98
|
-
import { resolve as resolve2 } from "path";
|
|
98
|
+
import { dirname as dirname2, join as join3, resolve as resolve2 } from "path";
|
|
99
|
+
|
|
100
|
+
// src/constants/rulesync-paths.ts
|
|
101
|
+
import { join } from "path";
|
|
102
|
+
var RULESYNC_CONFIG_RELATIVE_FILE_PATH = "rulesync.jsonc";
|
|
103
|
+
var RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH = "rulesync.local.jsonc";
|
|
104
|
+
var RULESYNC_RELATIVE_DIR_PATH = ".rulesync";
|
|
105
|
+
var RULESYNC_RULES_RELATIVE_DIR_PATH = join(RULESYNC_RELATIVE_DIR_PATH, "rules");
|
|
106
|
+
var RULESYNC_COMMANDS_RELATIVE_DIR_PATH = join(RULESYNC_RELATIVE_DIR_PATH, "commands");
|
|
107
|
+
var RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH = join(RULESYNC_RELATIVE_DIR_PATH, "subagents");
|
|
108
|
+
var RULESYNC_MCP_RELATIVE_FILE_PATH = join(RULESYNC_RELATIVE_DIR_PATH, "mcp.json");
|
|
109
|
+
var RULESYNC_AIIGNORE_FILE_NAME = ".aiignore";
|
|
110
|
+
var RULESYNC_AIIGNORE_RELATIVE_FILE_PATH = join(RULESYNC_RELATIVE_DIR_PATH, ".aiignore");
|
|
111
|
+
var RULESYNC_IGNORE_RELATIVE_FILE_PATH = ".rulesyncignore";
|
|
112
|
+
var RULESYNC_OVERVIEW_FILE_NAME = "overview.md";
|
|
113
|
+
var RULESYNC_SKILLS_RELATIVE_DIR_PATH = join(RULESYNC_RELATIVE_DIR_PATH, "skills");
|
|
99
114
|
|
|
100
115
|
// src/utils/file.ts
|
|
101
116
|
import { kebabCase } from "es-toolkit";
|
|
102
117
|
import { globbySync } from "globby";
|
|
103
118
|
import { mkdir, readdir, readFile, rm, stat, writeFile } from "fs/promises";
|
|
104
119
|
import os from "os";
|
|
105
|
-
import { dirname, join, relative, resolve } from "path";
|
|
120
|
+
import { dirname, join as join2, relative, resolve } from "path";
|
|
106
121
|
async function ensureDir(dirPath) {
|
|
107
122
|
try {
|
|
108
123
|
await stat(dirPath);
|
|
@@ -390,7 +405,7 @@ var getDefaults = () => ({
|
|
|
390
405
|
verbose: false,
|
|
391
406
|
delete: false,
|
|
392
407
|
baseDirs: [process.cwd()],
|
|
393
|
-
configPath:
|
|
408
|
+
configPath: RULESYNC_CONFIG_RELATIVE_FILE_PATH,
|
|
394
409
|
global: false,
|
|
395
410
|
silent: false,
|
|
396
411
|
simulateCommands: false,
|
|
@@ -398,6 +413,36 @@ var getDefaults = () => ({
|
|
|
398
413
|
simulateSkills: false,
|
|
399
414
|
modularMcp: false
|
|
400
415
|
});
|
|
416
|
+
var loadConfigFromFile = async (filePath) => {
|
|
417
|
+
if (!await fileExists(filePath)) {
|
|
418
|
+
return {};
|
|
419
|
+
}
|
|
420
|
+
try {
|
|
421
|
+
const fileContent = await readFileContent(filePath);
|
|
422
|
+
const jsonData = parseJsonc(fileContent);
|
|
423
|
+
const parsed = ConfigFileSchema.parse(jsonData);
|
|
424
|
+
const { $schema: _schema, ...configParams } = parsed;
|
|
425
|
+
return configParams;
|
|
426
|
+
} catch (error) {
|
|
427
|
+
logger.error(`Failed to load config file "${filePath}": ${formatError(error)}`);
|
|
428
|
+
throw error;
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
var mergeConfigs = (baseConfig, localConfig) => {
|
|
432
|
+
return {
|
|
433
|
+
targets: localConfig.targets ?? baseConfig.targets,
|
|
434
|
+
features: localConfig.features ?? baseConfig.features,
|
|
435
|
+
verbose: localConfig.verbose ?? baseConfig.verbose,
|
|
436
|
+
delete: localConfig.delete ?? baseConfig.delete,
|
|
437
|
+
baseDirs: localConfig.baseDirs ?? baseConfig.baseDirs,
|
|
438
|
+
global: localConfig.global ?? baseConfig.global,
|
|
439
|
+
silent: localConfig.silent ?? baseConfig.silent,
|
|
440
|
+
simulateCommands: localConfig.simulateCommands ?? baseConfig.simulateCommands,
|
|
441
|
+
simulateSubagents: localConfig.simulateSubagents ?? baseConfig.simulateSubagents,
|
|
442
|
+
simulateSkills: localConfig.simulateSkills ?? baseConfig.simulateSkills,
|
|
443
|
+
modularMcp: localConfig.modularMcp ?? baseConfig.modularMcp
|
|
444
|
+
};
|
|
445
|
+
};
|
|
401
446
|
var ConfigResolver = class {
|
|
402
447
|
static async resolve({
|
|
403
448
|
targets,
|
|
@@ -414,19 +459,11 @@ var ConfigResolver = class {
|
|
|
414
459
|
modularMcp
|
|
415
460
|
}) {
|
|
416
461
|
const validatedConfigPath = resolvePath(configPath, process.cwd());
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
const parsed = ConfigFileSchema.parse(jsonData);
|
|
423
|
-
const { $schema: _schema, ...configParams2 } = parsed;
|
|
424
|
-
configByFile = configParams2;
|
|
425
|
-
} catch (error) {
|
|
426
|
-
logger.error(`Failed to load config file: ${formatError(error)}`);
|
|
427
|
-
throw error;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
462
|
+
const baseConfig = await loadConfigFromFile(validatedConfigPath);
|
|
463
|
+
const configDir = dirname2(validatedConfigPath);
|
|
464
|
+
const localConfigPath = join3(configDir, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH);
|
|
465
|
+
const localConfig = await loadConfigFromFile(localConfigPath);
|
|
466
|
+
const configByFile = mergeConfigs(baseConfig, localConfig);
|
|
430
467
|
const resolvedGlobal = global ?? configByFile.global ?? getDefaults().global;
|
|
431
468
|
const resolvedSimulateCommands = simulateCommands ?? configByFile.simulateCommands ?? getDefaults().simulateCommands;
|
|
432
469
|
const resolvedSimulateSubagents = simulateSubagents ?? configByFile.simulateSubagents ?? getDefaults().simulateSubagents;
|
|
@@ -466,24 +503,10 @@ function getBaseDirsInLightOfGlobal({
|
|
|
466
503
|
|
|
467
504
|
// src/lib/generate.ts
|
|
468
505
|
import { intersection } from "es-toolkit";
|
|
469
|
-
import { join as
|
|
470
|
-
|
|
471
|
-
// src/constants/rulesync-paths.ts
|
|
472
|
-
import { join as join2 } from "path";
|
|
473
|
-
var RULESYNC_CONFIG_RELATIVE_FILE_PATH = "rulesync.jsonc";
|
|
474
|
-
var RULESYNC_RELATIVE_DIR_PATH = ".rulesync";
|
|
475
|
-
var RULESYNC_RULES_RELATIVE_DIR_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "rules");
|
|
476
|
-
var RULESYNC_COMMANDS_RELATIVE_DIR_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "commands");
|
|
477
|
-
var RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "subagents");
|
|
478
|
-
var RULESYNC_MCP_RELATIVE_FILE_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "mcp.json");
|
|
479
|
-
var RULESYNC_AIIGNORE_FILE_NAME = ".aiignore";
|
|
480
|
-
var RULESYNC_AIIGNORE_RELATIVE_FILE_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, ".aiignore");
|
|
481
|
-
var RULESYNC_IGNORE_RELATIVE_FILE_PATH = ".rulesyncignore";
|
|
482
|
-
var RULESYNC_OVERVIEW_FILE_NAME = "overview.md";
|
|
483
|
-
var RULESYNC_SKILLS_RELATIVE_DIR_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "skills");
|
|
506
|
+
import { join as join97 } from "path";
|
|
484
507
|
|
|
485
508
|
// src/features/commands/commands-processor.ts
|
|
486
|
-
import { basename as basename15, join as
|
|
509
|
+
import { basename as basename15, join as join18 } from "path";
|
|
487
510
|
import { z as z12 } from "zod/mini";
|
|
488
511
|
|
|
489
512
|
// src/types/feature-processor.ts
|
|
@@ -517,7 +540,7 @@ var FeatureProcessor = class {
|
|
|
517
540
|
};
|
|
518
541
|
|
|
519
542
|
// src/features/commands/agentsmd-command.ts
|
|
520
|
-
import { basename as basename2, join as
|
|
543
|
+
import { basename as basename2, join as join5 } from "path";
|
|
521
544
|
|
|
522
545
|
// src/utils/frontmatter.ts
|
|
523
546
|
import matter from "gray-matter";
|
|
@@ -569,7 +592,7 @@ function parseFrontmatter(content) {
|
|
|
569
592
|
}
|
|
570
593
|
|
|
571
594
|
// src/features/commands/simulated-command.ts
|
|
572
|
-
import { basename, join as
|
|
595
|
+
import { basename, join as join4 } from "path";
|
|
573
596
|
import { z as z4 } from "zod/mini";
|
|
574
597
|
|
|
575
598
|
// src/types/ai-file.ts
|
|
@@ -743,7 +766,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
743
766
|
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
744
767
|
if (!result.success) {
|
|
745
768
|
throw new Error(
|
|
746
|
-
`Invalid frontmatter in ${
|
|
769
|
+
`Invalid frontmatter in ${join4(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
747
770
|
);
|
|
748
771
|
}
|
|
749
772
|
}
|
|
@@ -793,7 +816,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
793
816
|
return {
|
|
794
817
|
success: false,
|
|
795
818
|
error: new Error(
|
|
796
|
-
`Invalid frontmatter in ${
|
|
819
|
+
`Invalid frontmatter in ${join4(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
797
820
|
)
|
|
798
821
|
};
|
|
799
822
|
}
|
|
@@ -803,7 +826,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
803
826
|
relativeFilePath,
|
|
804
827
|
validate = true
|
|
805
828
|
}) {
|
|
806
|
-
const filePath =
|
|
829
|
+
const filePath = join4(
|
|
807
830
|
baseDir,
|
|
808
831
|
_SimulatedCommand.getSettablePaths().relativeDirPath,
|
|
809
832
|
relativeFilePath
|
|
@@ -843,7 +866,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
843
866
|
var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
844
867
|
static getSettablePaths() {
|
|
845
868
|
return {
|
|
846
|
-
relativeDirPath:
|
|
869
|
+
relativeDirPath: join5(".agents", "commands")
|
|
847
870
|
};
|
|
848
871
|
}
|
|
849
872
|
static fromRulesyncCommand({
|
|
@@ -860,7 +883,7 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
860
883
|
relativeFilePath,
|
|
861
884
|
validate = true
|
|
862
885
|
}) {
|
|
863
|
-
const filePath =
|
|
886
|
+
const filePath = join5(
|
|
864
887
|
baseDir,
|
|
865
888
|
_AgentsmdCommand.getSettablePaths().relativeDirPath,
|
|
866
889
|
relativeFilePath
|
|
@@ -898,7 +921,7 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
898
921
|
};
|
|
899
922
|
|
|
900
923
|
// src/features/commands/antigravity-command.ts
|
|
901
|
-
import { basename as basename4, join as
|
|
924
|
+
import { basename as basename4, join as join7 } from "path";
|
|
902
925
|
import { z as z6 } from "zod/mini";
|
|
903
926
|
|
|
904
927
|
// src/utils/type-guards.ts
|
|
@@ -907,7 +930,7 @@ function isRecord(value) {
|
|
|
907
930
|
}
|
|
908
931
|
|
|
909
932
|
// src/features/commands/rulesync-command.ts
|
|
910
|
-
import { basename as basename3, join as
|
|
933
|
+
import { basename as basename3, join as join6 } from "path";
|
|
911
934
|
import { z as z5 } from "zod/mini";
|
|
912
935
|
|
|
913
936
|
// src/types/rulesync-file.ts
|
|
@@ -930,7 +953,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
930
953
|
const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
|
|
931
954
|
if (!result.success) {
|
|
932
955
|
throw new Error(
|
|
933
|
-
`Invalid frontmatter in ${
|
|
956
|
+
`Invalid frontmatter in ${join6(rest.baseDir ?? process.cwd(), rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
934
957
|
);
|
|
935
958
|
}
|
|
936
959
|
}
|
|
@@ -963,7 +986,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
963
986
|
return {
|
|
964
987
|
success: false,
|
|
965
988
|
error: new Error(
|
|
966
|
-
`Invalid frontmatter in ${
|
|
989
|
+
`Invalid frontmatter in ${join6(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
967
990
|
)
|
|
968
991
|
};
|
|
969
992
|
}
|
|
@@ -971,7 +994,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
971
994
|
static async fromFile({
|
|
972
995
|
relativeFilePath
|
|
973
996
|
}) {
|
|
974
|
-
const filePath =
|
|
997
|
+
const filePath = join6(
|
|
975
998
|
process.cwd(),
|
|
976
999
|
_RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
977
1000
|
relativeFilePath
|
|
@@ -1009,7 +1032,7 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1009
1032
|
body;
|
|
1010
1033
|
static getSettablePaths() {
|
|
1011
1034
|
return {
|
|
1012
|
-
relativeDirPath:
|
|
1035
|
+
relativeDirPath: join7(".agent", "workflows")
|
|
1013
1036
|
};
|
|
1014
1037
|
}
|
|
1015
1038
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -1017,7 +1040,7 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1017
1040
|
const result = AntigravityCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1018
1041
|
if (!result.success) {
|
|
1019
1042
|
throw new Error(
|
|
1020
|
-
`Invalid frontmatter in ${
|
|
1043
|
+
`Invalid frontmatter in ${join7(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1021
1044
|
);
|
|
1022
1045
|
}
|
|
1023
1046
|
}
|
|
@@ -1115,7 +1138,7 @@ ${body}${turboDirective}`;
|
|
|
1115
1138
|
return {
|
|
1116
1139
|
success: false,
|
|
1117
1140
|
error: new Error(
|
|
1118
|
-
`Invalid frontmatter in ${
|
|
1141
|
+
`Invalid frontmatter in ${join7(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1119
1142
|
)
|
|
1120
1143
|
};
|
|
1121
1144
|
}
|
|
@@ -1131,7 +1154,7 @@ ${body}${turboDirective}`;
|
|
|
1131
1154
|
relativeFilePath,
|
|
1132
1155
|
validate = true
|
|
1133
1156
|
}) {
|
|
1134
|
-
const filePath =
|
|
1157
|
+
const filePath = join7(
|
|
1135
1158
|
baseDir,
|
|
1136
1159
|
_AntigravityCommand.getSettablePaths().relativeDirPath,
|
|
1137
1160
|
relativeFilePath
|
|
@@ -1170,7 +1193,7 @@ ${body}${turboDirective}`;
|
|
|
1170
1193
|
};
|
|
1171
1194
|
|
|
1172
1195
|
// src/features/commands/claudecode-command.ts
|
|
1173
|
-
import { basename as basename5, join as
|
|
1196
|
+
import { basename as basename5, join as join8 } from "path";
|
|
1174
1197
|
import { z as z7 } from "zod/mini";
|
|
1175
1198
|
var ClaudecodeCommandFrontmatterSchema = z7.looseObject({
|
|
1176
1199
|
description: z7.string(),
|
|
@@ -1187,7 +1210,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1187
1210
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1188
1211
|
if (!result.success) {
|
|
1189
1212
|
throw new Error(
|
|
1190
|
-
`Invalid frontmatter in ${
|
|
1213
|
+
`Invalid frontmatter in ${join8(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1191
1214
|
);
|
|
1192
1215
|
}
|
|
1193
1216
|
}
|
|
@@ -1200,7 +1223,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1200
1223
|
}
|
|
1201
1224
|
static getSettablePaths(_options = {}) {
|
|
1202
1225
|
return {
|
|
1203
|
-
relativeDirPath:
|
|
1226
|
+
relativeDirPath: join8(".claude", "commands")
|
|
1204
1227
|
};
|
|
1205
1228
|
}
|
|
1206
1229
|
getBody() {
|
|
@@ -1263,7 +1286,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1263
1286
|
return {
|
|
1264
1287
|
success: false,
|
|
1265
1288
|
error: new Error(
|
|
1266
|
-
`Invalid frontmatter in ${
|
|
1289
|
+
`Invalid frontmatter in ${join8(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1267
1290
|
)
|
|
1268
1291
|
};
|
|
1269
1292
|
}
|
|
@@ -1281,7 +1304,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1281
1304
|
global = false
|
|
1282
1305
|
}) {
|
|
1283
1306
|
const paths = this.getSettablePaths({ global });
|
|
1284
|
-
const filePath =
|
|
1307
|
+
const filePath = join8(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1285
1308
|
const fileContent = await readFileContent(filePath);
|
|
1286
1309
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1287
1310
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1314,16 +1337,16 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1314
1337
|
};
|
|
1315
1338
|
|
|
1316
1339
|
// src/features/commands/cline-command.ts
|
|
1317
|
-
import { basename as basename6, join as
|
|
1340
|
+
import { basename as basename6, join as join9 } from "path";
|
|
1318
1341
|
var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
1319
1342
|
static getSettablePaths({ global } = {}) {
|
|
1320
1343
|
if (global) {
|
|
1321
1344
|
return {
|
|
1322
|
-
relativeDirPath:
|
|
1345
|
+
relativeDirPath: join9("Documents", "Cline", "Workflows")
|
|
1323
1346
|
};
|
|
1324
1347
|
}
|
|
1325
1348
|
return {
|
|
1326
|
-
relativeDirPath:
|
|
1349
|
+
relativeDirPath: join9(".clinerules", "workflows")
|
|
1327
1350
|
};
|
|
1328
1351
|
}
|
|
1329
1352
|
toRulesyncCommand() {
|
|
@@ -1375,7 +1398,7 @@ var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
|
1375
1398
|
global = false
|
|
1376
1399
|
}) {
|
|
1377
1400
|
const paths = this.getSettablePaths({ global });
|
|
1378
|
-
const filePath =
|
|
1401
|
+
const filePath = join9(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1379
1402
|
const fileContent = await readFileContent(filePath);
|
|
1380
1403
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1381
1404
|
return new _ClineCommand({
|
|
@@ -1402,14 +1425,14 @@ var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
|
1402
1425
|
};
|
|
1403
1426
|
|
|
1404
1427
|
// src/features/commands/codexcli-command.ts
|
|
1405
|
-
import { basename as basename7, join as
|
|
1428
|
+
import { basename as basename7, join as join10 } from "path";
|
|
1406
1429
|
var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
1407
1430
|
static getSettablePaths({ global } = {}) {
|
|
1408
1431
|
if (!global) {
|
|
1409
1432
|
throw new Error("CodexcliCommand only supports global mode. Please pass { global: true }.");
|
|
1410
1433
|
}
|
|
1411
1434
|
return {
|
|
1412
|
-
relativeDirPath:
|
|
1435
|
+
relativeDirPath: join10(".codex", "prompts")
|
|
1413
1436
|
};
|
|
1414
1437
|
}
|
|
1415
1438
|
toRulesyncCommand() {
|
|
@@ -1462,7 +1485,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1462
1485
|
global = false
|
|
1463
1486
|
}) {
|
|
1464
1487
|
const paths = this.getSettablePaths({ global });
|
|
1465
|
-
const filePath =
|
|
1488
|
+
const filePath = join10(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1466
1489
|
const fileContent = await readFileContent(filePath);
|
|
1467
1490
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1468
1491
|
return new _CodexcliCommand({
|
|
@@ -1489,7 +1512,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1489
1512
|
};
|
|
1490
1513
|
|
|
1491
1514
|
// src/features/commands/copilot-command.ts
|
|
1492
|
-
import { basename as basename8, join as
|
|
1515
|
+
import { basename as basename8, join as join11 } from "path";
|
|
1493
1516
|
import { z as z8 } from "zod/mini";
|
|
1494
1517
|
var CopilotCommandFrontmatterSchema = z8.looseObject({
|
|
1495
1518
|
mode: z8.optional(z8.string()),
|
|
@@ -1503,7 +1526,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1503
1526
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1504
1527
|
if (!result.success) {
|
|
1505
1528
|
throw new Error(
|
|
1506
|
-
`Invalid frontmatter in ${
|
|
1529
|
+
`Invalid frontmatter in ${join11(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1507
1530
|
);
|
|
1508
1531
|
}
|
|
1509
1532
|
}
|
|
@@ -1516,7 +1539,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1516
1539
|
}
|
|
1517
1540
|
static getSettablePaths() {
|
|
1518
1541
|
return {
|
|
1519
|
-
relativeDirPath:
|
|
1542
|
+
relativeDirPath: join11(".github", "prompts")
|
|
1520
1543
|
};
|
|
1521
1544
|
}
|
|
1522
1545
|
getBody() {
|
|
@@ -1556,7 +1579,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1556
1579
|
return {
|
|
1557
1580
|
success: false,
|
|
1558
1581
|
error: new Error(
|
|
1559
|
-
`Invalid frontmatter in ${
|
|
1582
|
+
`Invalid frontmatter in ${join11(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1560
1583
|
)
|
|
1561
1584
|
};
|
|
1562
1585
|
}
|
|
@@ -1591,7 +1614,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1591
1614
|
validate = true
|
|
1592
1615
|
}) {
|
|
1593
1616
|
const paths = this.getSettablePaths();
|
|
1594
|
-
const filePath =
|
|
1617
|
+
const filePath = join11(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1595
1618
|
const fileContent = await readFileContent(filePath);
|
|
1596
1619
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1597
1620
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1630,11 +1653,11 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1630
1653
|
};
|
|
1631
1654
|
|
|
1632
1655
|
// src/features/commands/cursor-command.ts
|
|
1633
|
-
import { basename as basename9, join as
|
|
1656
|
+
import { basename as basename9, join as join12 } from "path";
|
|
1634
1657
|
var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
1635
1658
|
static getSettablePaths(_options = {}) {
|
|
1636
1659
|
return {
|
|
1637
|
-
relativeDirPath:
|
|
1660
|
+
relativeDirPath: join12(".cursor", "commands")
|
|
1638
1661
|
};
|
|
1639
1662
|
}
|
|
1640
1663
|
toRulesyncCommand() {
|
|
@@ -1687,7 +1710,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1687
1710
|
global = false
|
|
1688
1711
|
}) {
|
|
1689
1712
|
const paths = this.getSettablePaths({ global });
|
|
1690
|
-
const filePath =
|
|
1713
|
+
const filePath = join12(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1691
1714
|
const fileContent = await readFileContent(filePath);
|
|
1692
1715
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1693
1716
|
return new _CursorCommand({
|
|
@@ -1714,7 +1737,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1714
1737
|
};
|
|
1715
1738
|
|
|
1716
1739
|
// src/features/commands/geminicli-command.ts
|
|
1717
|
-
import { basename as basename10, join as
|
|
1740
|
+
import { basename as basename10, join as join13 } from "path";
|
|
1718
1741
|
import { parse as parseToml } from "smol-toml";
|
|
1719
1742
|
import { z as z9 } from "zod/mini";
|
|
1720
1743
|
var GeminiCliCommandFrontmatterSchema = z9.looseObject({
|
|
@@ -1732,7 +1755,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
1732
1755
|
}
|
|
1733
1756
|
static getSettablePaths(_options = {}) {
|
|
1734
1757
|
return {
|
|
1735
|
-
relativeDirPath:
|
|
1758
|
+
relativeDirPath: join13(".gemini", "commands")
|
|
1736
1759
|
};
|
|
1737
1760
|
}
|
|
1738
1761
|
parseTomlContent(content) {
|
|
@@ -1814,7 +1837,7 @@ ${geminiFrontmatter.prompt}
|
|
|
1814
1837
|
global = false
|
|
1815
1838
|
}) {
|
|
1816
1839
|
const paths = this.getSettablePaths({ global });
|
|
1817
|
-
const filePath =
|
|
1840
|
+
const filePath = join13(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1818
1841
|
const fileContent = await readFileContent(filePath);
|
|
1819
1842
|
return new _GeminiCliCommand({
|
|
1820
1843
|
baseDir,
|
|
@@ -1856,11 +1879,11 @@ prompt = ""`;
|
|
|
1856
1879
|
};
|
|
1857
1880
|
|
|
1858
1881
|
// src/features/commands/kilo-command.ts
|
|
1859
|
-
import { basename as basename11, join as
|
|
1882
|
+
import { basename as basename11, join as join14 } from "path";
|
|
1860
1883
|
var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
1861
1884
|
static getSettablePaths(_options = {}) {
|
|
1862
1885
|
return {
|
|
1863
|
-
relativeDirPath:
|
|
1886
|
+
relativeDirPath: join14(".kilocode", "workflows")
|
|
1864
1887
|
};
|
|
1865
1888
|
}
|
|
1866
1889
|
toRulesyncCommand() {
|
|
@@ -1910,7 +1933,7 @@ var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
|
1910
1933
|
validate = true
|
|
1911
1934
|
}) {
|
|
1912
1935
|
const paths = this.getSettablePaths();
|
|
1913
|
-
const filePath =
|
|
1936
|
+
const filePath = join14(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1914
1937
|
const fileContent = await readFileContent(filePath);
|
|
1915
1938
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1916
1939
|
return new _KiloCommand({
|
|
@@ -1937,11 +1960,11 @@ var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
|
1937
1960
|
};
|
|
1938
1961
|
|
|
1939
1962
|
// src/features/commands/kiro-command.ts
|
|
1940
|
-
import { basename as basename12, join as
|
|
1963
|
+
import { basename as basename12, join as join15 } from "path";
|
|
1941
1964
|
var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
1942
1965
|
static getSettablePaths(_options = {}) {
|
|
1943
1966
|
return {
|
|
1944
|
-
relativeDirPath:
|
|
1967
|
+
relativeDirPath: join15(".kiro", "prompts")
|
|
1945
1968
|
};
|
|
1946
1969
|
}
|
|
1947
1970
|
toRulesyncCommand() {
|
|
@@ -1991,7 +2014,7 @@ var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
|
1991
2014
|
validate = true
|
|
1992
2015
|
}) {
|
|
1993
2016
|
const paths = this.getSettablePaths();
|
|
1994
|
-
const filePath =
|
|
2017
|
+
const filePath = join15(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1995
2018
|
const fileContent = await readFileContent(filePath);
|
|
1996
2019
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1997
2020
|
return new _KiroCommand({
|
|
@@ -2018,7 +2041,7 @@ var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
|
2018
2041
|
};
|
|
2019
2042
|
|
|
2020
2043
|
// src/features/commands/opencode-command.ts
|
|
2021
|
-
import { basename as basename13, join as
|
|
2044
|
+
import { basename as basename13, join as join16 } from "path";
|
|
2022
2045
|
import { optional as optional2, z as z10 } from "zod/mini";
|
|
2023
2046
|
var OpenCodeCommandFrontmatterSchema = z10.looseObject({
|
|
2024
2047
|
description: z10.string(),
|
|
@@ -2034,7 +2057,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2034
2057
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2035
2058
|
if (!result.success) {
|
|
2036
2059
|
throw new Error(
|
|
2037
|
-
`Invalid frontmatter in ${
|
|
2060
|
+
`Invalid frontmatter in ${join16(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
2038
2061
|
);
|
|
2039
2062
|
}
|
|
2040
2063
|
}
|
|
@@ -2047,7 +2070,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2047
2070
|
}
|
|
2048
2071
|
static getSettablePaths({ global } = {}) {
|
|
2049
2072
|
return {
|
|
2050
|
-
relativeDirPath: global ?
|
|
2073
|
+
relativeDirPath: global ? join16(".config", "opencode", "command") : join16(".opencode", "command")
|
|
2051
2074
|
};
|
|
2052
2075
|
}
|
|
2053
2076
|
getBody() {
|
|
@@ -2108,7 +2131,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2108
2131
|
return {
|
|
2109
2132
|
success: false,
|
|
2110
2133
|
error: new Error(
|
|
2111
|
-
`Invalid frontmatter in ${
|
|
2134
|
+
`Invalid frontmatter in ${join16(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
2112
2135
|
)
|
|
2113
2136
|
};
|
|
2114
2137
|
}
|
|
@@ -2119,7 +2142,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2119
2142
|
global = false
|
|
2120
2143
|
}) {
|
|
2121
2144
|
const paths = this.getSettablePaths({ global });
|
|
2122
|
-
const filePath =
|
|
2145
|
+
const filePath = join16(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2123
2146
|
const fileContent = await readFileContent(filePath);
|
|
2124
2147
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2125
2148
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2158,7 +2181,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2158
2181
|
};
|
|
2159
2182
|
|
|
2160
2183
|
// src/features/commands/roo-command.ts
|
|
2161
|
-
import { basename as basename14, join as
|
|
2184
|
+
import { basename as basename14, join as join17 } from "path";
|
|
2162
2185
|
import { optional as optional3, z as z11 } from "zod/mini";
|
|
2163
2186
|
var RooCommandFrontmatterSchema = z11.looseObject({
|
|
2164
2187
|
description: z11.string(),
|
|
@@ -2169,7 +2192,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2169
2192
|
body;
|
|
2170
2193
|
static getSettablePaths() {
|
|
2171
2194
|
return {
|
|
2172
|
-
relativeDirPath:
|
|
2195
|
+
relativeDirPath: join17(".roo", "commands")
|
|
2173
2196
|
};
|
|
2174
2197
|
}
|
|
2175
2198
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -2177,7 +2200,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2177
2200
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2178
2201
|
if (!result.success) {
|
|
2179
2202
|
throw new Error(
|
|
2180
|
-
`Invalid frontmatter in ${
|
|
2203
|
+
`Invalid frontmatter in ${join17(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
2181
2204
|
);
|
|
2182
2205
|
}
|
|
2183
2206
|
}
|
|
@@ -2248,7 +2271,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2248
2271
|
return {
|
|
2249
2272
|
success: false,
|
|
2250
2273
|
error: new Error(
|
|
2251
|
-
`Invalid frontmatter in ${
|
|
2274
|
+
`Invalid frontmatter in ${join17(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
2252
2275
|
)
|
|
2253
2276
|
};
|
|
2254
2277
|
}
|
|
@@ -2264,7 +2287,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2264
2287
|
relativeFilePath,
|
|
2265
2288
|
validate = true
|
|
2266
2289
|
}) {
|
|
2267
|
-
const filePath =
|
|
2290
|
+
const filePath = join17(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
2268
2291
|
const fileContent = await readFileContent(filePath);
|
|
2269
2292
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2270
2293
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2488,7 +2511,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2488
2511
|
*/
|
|
2489
2512
|
async loadRulesyncFiles() {
|
|
2490
2513
|
const rulesyncCommandPaths = await findFilesByGlobs(
|
|
2491
|
-
|
|
2514
|
+
join18(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
|
|
2492
2515
|
);
|
|
2493
2516
|
const rulesyncCommands = await Promise.all(
|
|
2494
2517
|
rulesyncCommandPaths.map(
|
|
@@ -2508,7 +2531,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2508
2531
|
const factory = this.getFactory(this.toolTarget);
|
|
2509
2532
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
2510
2533
|
const commandFilePaths = await findFilesByGlobs(
|
|
2511
|
-
|
|
2534
|
+
join18(this.baseDir, paths.relativeDirPath, `*.${factory.meta.extension}`)
|
|
2512
2535
|
);
|
|
2513
2536
|
if (forDeletion) {
|
|
2514
2537
|
const toolCommands2 = commandFilePaths.map(
|
|
@@ -2561,14 +2584,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2561
2584
|
import { z as z13 } from "zod/mini";
|
|
2562
2585
|
|
|
2563
2586
|
// src/features/ignore/augmentcode-ignore.ts
|
|
2564
|
-
import { join as
|
|
2587
|
+
import { join as join20 } from "path";
|
|
2565
2588
|
|
|
2566
2589
|
// src/types/tool-file.ts
|
|
2567
2590
|
var ToolFile = class extends AiFile {
|
|
2568
2591
|
};
|
|
2569
2592
|
|
|
2570
2593
|
// src/features/ignore/rulesync-ignore.ts
|
|
2571
|
-
import { join as
|
|
2594
|
+
import { join as join19 } from "path";
|
|
2572
2595
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
2573
2596
|
validate() {
|
|
2574
2597
|
return { success: true, error: null };
|
|
@@ -2588,12 +2611,12 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
2588
2611
|
static async fromFile() {
|
|
2589
2612
|
const baseDir = process.cwd();
|
|
2590
2613
|
const paths = this.getSettablePaths();
|
|
2591
|
-
const recommendedPath =
|
|
2614
|
+
const recommendedPath = join19(
|
|
2592
2615
|
baseDir,
|
|
2593
2616
|
paths.recommended.relativeDirPath,
|
|
2594
2617
|
paths.recommended.relativeFilePath
|
|
2595
2618
|
);
|
|
2596
|
-
const legacyPath =
|
|
2619
|
+
const legacyPath = join19(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
2597
2620
|
if (await fileExists(recommendedPath)) {
|
|
2598
2621
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
2599
2622
|
return new _RulesyncIgnore({
|
|
@@ -2709,7 +2732,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2709
2732
|
validate = true
|
|
2710
2733
|
}) {
|
|
2711
2734
|
const fileContent = await readFileContent(
|
|
2712
|
-
|
|
2735
|
+
join20(
|
|
2713
2736
|
baseDir,
|
|
2714
2737
|
this.getSettablePaths().relativeDirPath,
|
|
2715
2738
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2740,7 +2763,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2740
2763
|
|
|
2741
2764
|
// src/features/ignore/claudecode-ignore.ts
|
|
2742
2765
|
import { uniq } from "es-toolkit";
|
|
2743
|
-
import { join as
|
|
2766
|
+
import { join as join21 } from "path";
|
|
2744
2767
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
2745
2768
|
constructor(params) {
|
|
2746
2769
|
super(params);
|
|
@@ -2782,7 +2805,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2782
2805
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
2783
2806
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
2784
2807
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
2785
|
-
const filePath =
|
|
2808
|
+
const filePath = join21(
|
|
2786
2809
|
baseDir,
|
|
2787
2810
|
this.getSettablePaths().relativeDirPath,
|
|
2788
2811
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2818,7 +2841,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2818
2841
|
validate = true
|
|
2819
2842
|
}) {
|
|
2820
2843
|
const fileContent = await readFileContent(
|
|
2821
|
-
|
|
2844
|
+
join21(
|
|
2822
2845
|
baseDir,
|
|
2823
2846
|
this.getSettablePaths().relativeDirPath,
|
|
2824
2847
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2848,7 +2871,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2848
2871
|
};
|
|
2849
2872
|
|
|
2850
2873
|
// src/features/ignore/cline-ignore.ts
|
|
2851
|
-
import { join as
|
|
2874
|
+
import { join as join22 } from "path";
|
|
2852
2875
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
2853
2876
|
static getSettablePaths() {
|
|
2854
2877
|
return {
|
|
@@ -2885,7 +2908,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2885
2908
|
validate = true
|
|
2886
2909
|
}) {
|
|
2887
2910
|
const fileContent = await readFileContent(
|
|
2888
|
-
|
|
2911
|
+
join22(
|
|
2889
2912
|
baseDir,
|
|
2890
2913
|
this.getSettablePaths().relativeDirPath,
|
|
2891
2914
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2915,7 +2938,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2915
2938
|
};
|
|
2916
2939
|
|
|
2917
2940
|
// src/features/ignore/cursor-ignore.ts
|
|
2918
|
-
import { join as
|
|
2941
|
+
import { join as join23 } from "path";
|
|
2919
2942
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
2920
2943
|
static getSettablePaths() {
|
|
2921
2944
|
return {
|
|
@@ -2948,7 +2971,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2948
2971
|
validate = true
|
|
2949
2972
|
}) {
|
|
2950
2973
|
const fileContent = await readFileContent(
|
|
2951
|
-
|
|
2974
|
+
join23(
|
|
2952
2975
|
baseDir,
|
|
2953
2976
|
this.getSettablePaths().relativeDirPath,
|
|
2954
2977
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2978,7 +3001,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2978
3001
|
};
|
|
2979
3002
|
|
|
2980
3003
|
// src/features/ignore/geminicli-ignore.ts
|
|
2981
|
-
import { join as
|
|
3004
|
+
import { join as join24 } from "path";
|
|
2982
3005
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
2983
3006
|
static getSettablePaths() {
|
|
2984
3007
|
return {
|
|
@@ -3005,7 +3028,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
3005
3028
|
validate = true
|
|
3006
3029
|
}) {
|
|
3007
3030
|
const fileContent = await readFileContent(
|
|
3008
|
-
|
|
3031
|
+
join24(
|
|
3009
3032
|
baseDir,
|
|
3010
3033
|
this.getSettablePaths().relativeDirPath,
|
|
3011
3034
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3035,7 +3058,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
3035
3058
|
};
|
|
3036
3059
|
|
|
3037
3060
|
// src/features/ignore/junie-ignore.ts
|
|
3038
|
-
import { join as
|
|
3061
|
+
import { join as join25 } from "path";
|
|
3039
3062
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
3040
3063
|
static getSettablePaths() {
|
|
3041
3064
|
return {
|
|
@@ -3062,7 +3085,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
3062
3085
|
validate = true
|
|
3063
3086
|
}) {
|
|
3064
3087
|
const fileContent = await readFileContent(
|
|
3065
|
-
|
|
3088
|
+
join25(
|
|
3066
3089
|
baseDir,
|
|
3067
3090
|
this.getSettablePaths().relativeDirPath,
|
|
3068
3091
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3092,7 +3115,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
3092
3115
|
};
|
|
3093
3116
|
|
|
3094
3117
|
// src/features/ignore/kilo-ignore.ts
|
|
3095
|
-
import { join as
|
|
3118
|
+
import { join as join26 } from "path";
|
|
3096
3119
|
var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
3097
3120
|
static getSettablePaths() {
|
|
3098
3121
|
return {
|
|
@@ -3129,7 +3152,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
3129
3152
|
validate = true
|
|
3130
3153
|
}) {
|
|
3131
3154
|
const fileContent = await readFileContent(
|
|
3132
|
-
|
|
3155
|
+
join26(
|
|
3133
3156
|
baseDir,
|
|
3134
3157
|
this.getSettablePaths().relativeDirPath,
|
|
3135
3158
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3159,7 +3182,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
3159
3182
|
};
|
|
3160
3183
|
|
|
3161
3184
|
// src/features/ignore/kiro-ignore.ts
|
|
3162
|
-
import { join as
|
|
3185
|
+
import { join as join27 } from "path";
|
|
3163
3186
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
3164
3187
|
static getSettablePaths() {
|
|
3165
3188
|
return {
|
|
@@ -3186,7 +3209,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
3186
3209
|
validate = true
|
|
3187
3210
|
}) {
|
|
3188
3211
|
const fileContent = await readFileContent(
|
|
3189
|
-
|
|
3212
|
+
join27(
|
|
3190
3213
|
baseDir,
|
|
3191
3214
|
this.getSettablePaths().relativeDirPath,
|
|
3192
3215
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3216,7 +3239,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
3216
3239
|
};
|
|
3217
3240
|
|
|
3218
3241
|
// src/features/ignore/qwencode-ignore.ts
|
|
3219
|
-
import { join as
|
|
3242
|
+
import { join as join28 } from "path";
|
|
3220
3243
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
3221
3244
|
static getSettablePaths() {
|
|
3222
3245
|
return {
|
|
@@ -3243,7 +3266,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
3243
3266
|
validate = true
|
|
3244
3267
|
}) {
|
|
3245
3268
|
const fileContent = await readFileContent(
|
|
3246
|
-
|
|
3269
|
+
join28(
|
|
3247
3270
|
baseDir,
|
|
3248
3271
|
this.getSettablePaths().relativeDirPath,
|
|
3249
3272
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3273,7 +3296,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
3273
3296
|
};
|
|
3274
3297
|
|
|
3275
3298
|
// src/features/ignore/roo-ignore.ts
|
|
3276
|
-
import { join as
|
|
3299
|
+
import { join as join29 } from "path";
|
|
3277
3300
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
3278
3301
|
static getSettablePaths() {
|
|
3279
3302
|
return {
|
|
@@ -3300,7 +3323,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
3300
3323
|
validate = true
|
|
3301
3324
|
}) {
|
|
3302
3325
|
const fileContent = await readFileContent(
|
|
3303
|
-
|
|
3326
|
+
join29(
|
|
3304
3327
|
baseDir,
|
|
3305
3328
|
this.getSettablePaths().relativeDirPath,
|
|
3306
3329
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3330,7 +3353,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
3330
3353
|
};
|
|
3331
3354
|
|
|
3332
3355
|
// src/features/ignore/windsurf-ignore.ts
|
|
3333
|
-
import { join as
|
|
3356
|
+
import { join as join30 } from "path";
|
|
3334
3357
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
3335
3358
|
static getSettablePaths() {
|
|
3336
3359
|
return {
|
|
@@ -3357,7 +3380,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3357
3380
|
validate = true
|
|
3358
3381
|
}) {
|
|
3359
3382
|
const fileContent = await readFileContent(
|
|
3360
|
-
|
|
3383
|
+
join30(
|
|
3361
3384
|
baseDir,
|
|
3362
3385
|
this.getSettablePaths().relativeDirPath,
|
|
3363
3386
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3388,7 +3411,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3388
3411
|
|
|
3389
3412
|
// src/features/ignore/zed-ignore.ts
|
|
3390
3413
|
import { uniq as uniq2 } from "es-toolkit";
|
|
3391
|
-
import { join as
|
|
3414
|
+
import { join as join31 } from "path";
|
|
3392
3415
|
var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
3393
3416
|
constructor(params) {
|
|
3394
3417
|
super(params);
|
|
@@ -3424,7 +3447,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
3424
3447
|
}) {
|
|
3425
3448
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
3426
3449
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
3427
|
-
const filePath =
|
|
3450
|
+
const filePath = join31(
|
|
3428
3451
|
baseDir,
|
|
3429
3452
|
this.getSettablePaths().relativeDirPath,
|
|
3430
3453
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3451,7 +3474,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
3451
3474
|
validate = true
|
|
3452
3475
|
}) {
|
|
3453
3476
|
const fileContent = await readFileContent(
|
|
3454
|
-
|
|
3477
|
+
join31(
|
|
3455
3478
|
baseDir,
|
|
3456
3479
|
this.getSettablePaths().relativeDirPath,
|
|
3457
3480
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3633,10 +3656,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
3633
3656
|
import { z as z18 } from "zod/mini";
|
|
3634
3657
|
|
|
3635
3658
|
// src/features/mcp/claudecode-mcp.ts
|
|
3636
|
-
import { join as
|
|
3659
|
+
import { join as join34 } from "path";
|
|
3637
3660
|
|
|
3638
3661
|
// src/features/mcp/modular-mcp.ts
|
|
3639
|
-
import { join as
|
|
3662
|
+
import { join as join32 } from "path";
|
|
3640
3663
|
import { z as z15 } from "zod/mini";
|
|
3641
3664
|
|
|
3642
3665
|
// src/types/mcp.ts
|
|
@@ -3724,7 +3747,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3724
3747
|
args: [
|
|
3725
3748
|
"-y",
|
|
3726
3749
|
"@kimuson/modular-mcp",
|
|
3727
|
-
|
|
3750
|
+
join32(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3728
3751
|
],
|
|
3729
3752
|
env: {}
|
|
3730
3753
|
}
|
|
@@ -3762,7 +3785,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3762
3785
|
|
|
3763
3786
|
// src/features/mcp/rulesync-mcp.ts
|
|
3764
3787
|
import { omit } from "es-toolkit/object";
|
|
3765
|
-
import { join as
|
|
3788
|
+
import { join as join33 } from "path";
|
|
3766
3789
|
import { z as z16 } from "zod/mini";
|
|
3767
3790
|
var RulesyncMcpServerSchema = z16.union([
|
|
3768
3791
|
z16.extend(McpServerSchema, {
|
|
@@ -3818,12 +3841,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
3818
3841
|
}) {
|
|
3819
3842
|
const baseDir = process.cwd();
|
|
3820
3843
|
const paths = this.getSettablePaths();
|
|
3821
|
-
const recommendedPath =
|
|
3844
|
+
const recommendedPath = join33(
|
|
3822
3845
|
baseDir,
|
|
3823
3846
|
paths.recommended.relativeDirPath,
|
|
3824
3847
|
paths.recommended.relativeFilePath
|
|
3825
3848
|
);
|
|
3826
|
-
const legacyPath =
|
|
3849
|
+
const legacyPath = join33(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
3827
3850
|
if (await fileExists(recommendedPath)) {
|
|
3828
3851
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
3829
3852
|
return new _RulesyncMcp({
|
|
@@ -3967,7 +3990,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3967
3990
|
}) {
|
|
3968
3991
|
const paths = this.getSettablePaths({ global });
|
|
3969
3992
|
const fileContent = await readOrInitializeFileContent(
|
|
3970
|
-
|
|
3993
|
+
join34(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3971
3994
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3972
3995
|
);
|
|
3973
3996
|
const json = JSON.parse(fileContent);
|
|
@@ -3989,7 +4012,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3989
4012
|
}) {
|
|
3990
4013
|
const paths = this.getSettablePaths({ global });
|
|
3991
4014
|
const fileContent = await readOrInitializeFileContent(
|
|
3992
|
-
|
|
4015
|
+
join34(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3993
4016
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3994
4017
|
);
|
|
3995
4018
|
const json = JSON.parse(fileContent);
|
|
@@ -4037,7 +4060,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
4037
4060
|
};
|
|
4038
4061
|
|
|
4039
4062
|
// src/features/mcp/cline-mcp.ts
|
|
4040
|
-
import { join as
|
|
4063
|
+
import { join as join35 } from "path";
|
|
4041
4064
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
4042
4065
|
json;
|
|
4043
4066
|
constructor(params) {
|
|
@@ -4058,7 +4081,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
4058
4081
|
validate = true
|
|
4059
4082
|
}) {
|
|
4060
4083
|
const fileContent = await readFileContent(
|
|
4061
|
-
|
|
4084
|
+
join35(
|
|
4062
4085
|
baseDir,
|
|
4063
4086
|
this.getSettablePaths().relativeDirPath,
|
|
4064
4087
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4107,7 +4130,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
4107
4130
|
};
|
|
4108
4131
|
|
|
4109
4132
|
// src/features/mcp/codexcli-mcp.ts
|
|
4110
|
-
import { join as
|
|
4133
|
+
import { join as join36 } from "path";
|
|
4111
4134
|
import * as smolToml from "smol-toml";
|
|
4112
4135
|
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
4113
4136
|
toml;
|
|
@@ -4143,7 +4166,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4143
4166
|
}) {
|
|
4144
4167
|
const paths = this.getSettablePaths({ global });
|
|
4145
4168
|
const fileContent = await readFileContent(
|
|
4146
|
-
|
|
4169
|
+
join36(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
4147
4170
|
);
|
|
4148
4171
|
return new _CodexcliMcp({
|
|
4149
4172
|
baseDir,
|
|
@@ -4160,7 +4183,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4160
4183
|
global = false
|
|
4161
4184
|
}) {
|
|
4162
4185
|
const paths = this.getSettablePaths({ global });
|
|
4163
|
-
const configTomlFilePath =
|
|
4186
|
+
const configTomlFilePath = join36(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
4164
4187
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
4165
4188
|
configTomlFilePath,
|
|
4166
4189
|
smolToml.stringify({})
|
|
@@ -4214,7 +4237,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4214
4237
|
};
|
|
4215
4238
|
|
|
4216
4239
|
// src/features/mcp/copilot-mcp.ts
|
|
4217
|
-
import { join as
|
|
4240
|
+
import { join as join37 } from "path";
|
|
4218
4241
|
function convertToCopilotFormat(mcpServers) {
|
|
4219
4242
|
return { servers: mcpServers };
|
|
4220
4243
|
}
|
|
@@ -4241,7 +4264,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4241
4264
|
validate = true
|
|
4242
4265
|
}) {
|
|
4243
4266
|
const fileContent = await readFileContent(
|
|
4244
|
-
|
|
4267
|
+
join37(
|
|
4245
4268
|
baseDir,
|
|
4246
4269
|
this.getSettablePaths().relativeDirPath,
|
|
4247
4270
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4294,7 +4317,47 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4294
4317
|
};
|
|
4295
4318
|
|
|
4296
4319
|
// src/features/mcp/cursor-mcp.ts
|
|
4297
|
-
import { join as
|
|
4320
|
+
import { join as join38 } from "path";
|
|
4321
|
+
var CURSOR_ENV_VAR_PATTERN = /\$\{env:([^}]+)\}/g;
|
|
4322
|
+
function isMcpServers(value) {
|
|
4323
|
+
return value !== void 0 && value !== null && typeof value === "object";
|
|
4324
|
+
}
|
|
4325
|
+
function convertEnvFromCursorFormat(mcpServers) {
|
|
4326
|
+
return Object.fromEntries(
|
|
4327
|
+
Object.entries(mcpServers).map(([name, config]) => [
|
|
4328
|
+
name,
|
|
4329
|
+
{
|
|
4330
|
+
...config,
|
|
4331
|
+
...config.env && {
|
|
4332
|
+
env: Object.fromEntries(
|
|
4333
|
+
Object.entries(config.env).map(([k, v]) => [
|
|
4334
|
+
k,
|
|
4335
|
+
v.replace(CURSOR_ENV_VAR_PATTERN, "${$1}")
|
|
4336
|
+
])
|
|
4337
|
+
)
|
|
4338
|
+
}
|
|
4339
|
+
}
|
|
4340
|
+
])
|
|
4341
|
+
);
|
|
4342
|
+
}
|
|
4343
|
+
function convertEnvToCursorFormat(mcpServers) {
|
|
4344
|
+
return Object.fromEntries(
|
|
4345
|
+
Object.entries(mcpServers).map(([name, config]) => [
|
|
4346
|
+
name,
|
|
4347
|
+
{
|
|
4348
|
+
...config,
|
|
4349
|
+
...config.env && {
|
|
4350
|
+
env: Object.fromEntries(
|
|
4351
|
+
Object.entries(config.env).map(([k, v]) => [
|
|
4352
|
+
k,
|
|
4353
|
+
v.replace(/\$\{(?!env:)([^}:]+)\}/g, "${env:$1}")
|
|
4354
|
+
])
|
|
4355
|
+
)
|
|
4356
|
+
}
|
|
4357
|
+
}
|
|
4358
|
+
])
|
|
4359
|
+
);
|
|
4360
|
+
}
|
|
4298
4361
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
4299
4362
|
json;
|
|
4300
4363
|
constructor(params) {
|
|
@@ -4315,7 +4378,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4315
4378
|
validate = true
|
|
4316
4379
|
}) {
|
|
4317
4380
|
const fileContent = await readFileContent(
|
|
4318
|
-
|
|
4381
|
+
join38(
|
|
4319
4382
|
baseDir,
|
|
4320
4383
|
this.getSettablePaths().relativeDirPath,
|
|
4321
4384
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4335,8 +4398,10 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4335
4398
|
validate = true
|
|
4336
4399
|
}) {
|
|
4337
4400
|
const json = rulesyncMcp.getJson();
|
|
4401
|
+
const mcpServers = isMcpServers(json.mcpServers) ? json.mcpServers : {};
|
|
4402
|
+
const transformedServers = convertEnvToCursorFormat(mcpServers);
|
|
4338
4403
|
const cursorConfig = {
|
|
4339
|
-
mcpServers:
|
|
4404
|
+
mcpServers: transformedServers
|
|
4340
4405
|
};
|
|
4341
4406
|
const fileContent = JSON.stringify(cursorConfig, null, 2);
|
|
4342
4407
|
return new _CursorMcp({
|
|
@@ -4348,11 +4413,17 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4348
4413
|
});
|
|
4349
4414
|
}
|
|
4350
4415
|
toRulesyncMcp() {
|
|
4416
|
+
const mcpServers = isMcpServers(this.json.mcpServers) ? this.json.mcpServers : {};
|
|
4417
|
+
const transformedServers = convertEnvFromCursorFormat(mcpServers);
|
|
4418
|
+
const transformedJson = {
|
|
4419
|
+
...this.json,
|
|
4420
|
+
mcpServers: transformedServers
|
|
4421
|
+
};
|
|
4351
4422
|
return new RulesyncMcp({
|
|
4352
4423
|
baseDir: this.baseDir,
|
|
4353
4424
|
relativeDirPath: this.relativeDirPath,
|
|
4354
4425
|
relativeFilePath: "rulesync.mcp.json",
|
|
4355
|
-
fileContent:
|
|
4426
|
+
fileContent: JSON.stringify(transformedJson),
|
|
4356
4427
|
validate: true
|
|
4357
4428
|
});
|
|
4358
4429
|
}
|
|
@@ -4375,7 +4446,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4375
4446
|
};
|
|
4376
4447
|
|
|
4377
4448
|
// src/features/mcp/geminicli-mcp.ts
|
|
4378
|
-
import { join as
|
|
4449
|
+
import { join as join39 } from "path";
|
|
4379
4450
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
4380
4451
|
json;
|
|
4381
4452
|
constructor(params) {
|
|
@@ -4404,7 +4475,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4404
4475
|
}) {
|
|
4405
4476
|
const paths = this.getSettablePaths({ global });
|
|
4406
4477
|
const fileContent = await readOrInitializeFileContent(
|
|
4407
|
-
|
|
4478
|
+
join39(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4408
4479
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4409
4480
|
);
|
|
4410
4481
|
const json = JSON.parse(fileContent);
|
|
@@ -4425,7 +4496,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4425
4496
|
}) {
|
|
4426
4497
|
const paths = this.getSettablePaths({ global });
|
|
4427
4498
|
const fileContent = await readOrInitializeFileContent(
|
|
4428
|
-
|
|
4499
|
+
join39(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4429
4500
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4430
4501
|
);
|
|
4431
4502
|
const json = JSON.parse(fileContent);
|
|
@@ -4462,7 +4533,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4462
4533
|
};
|
|
4463
4534
|
|
|
4464
4535
|
// src/features/mcp/junie-mcp.ts
|
|
4465
|
-
import { join as
|
|
4536
|
+
import { join as join40 } from "path";
|
|
4466
4537
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
4467
4538
|
json;
|
|
4468
4539
|
constructor(params) {
|
|
@@ -4474,7 +4545,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4474
4545
|
}
|
|
4475
4546
|
static getSettablePaths() {
|
|
4476
4547
|
return {
|
|
4477
|
-
relativeDirPath:
|
|
4548
|
+
relativeDirPath: join40(".junie", "mcp"),
|
|
4478
4549
|
relativeFilePath: "mcp.json"
|
|
4479
4550
|
};
|
|
4480
4551
|
}
|
|
@@ -4483,7 +4554,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4483
4554
|
validate = true
|
|
4484
4555
|
}) {
|
|
4485
4556
|
const fileContent = await readFileContent(
|
|
4486
|
-
|
|
4557
|
+
join40(
|
|
4487
4558
|
baseDir,
|
|
4488
4559
|
this.getSettablePaths().relativeDirPath,
|
|
4489
4560
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4532,7 +4603,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4532
4603
|
};
|
|
4533
4604
|
|
|
4534
4605
|
// src/features/mcp/kilo-mcp.ts
|
|
4535
|
-
import { join as
|
|
4606
|
+
import { join as join41 } from "path";
|
|
4536
4607
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
4537
4608
|
json;
|
|
4538
4609
|
constructor(params) {
|
|
@@ -4554,7 +4625,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4554
4625
|
}) {
|
|
4555
4626
|
const paths = this.getSettablePaths();
|
|
4556
4627
|
const fileContent = await readOrInitializeFileContent(
|
|
4557
|
-
|
|
4628
|
+
join41(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4558
4629
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4559
4630
|
);
|
|
4560
4631
|
return new _KiloMcp({
|
|
@@ -4608,7 +4679,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4608
4679
|
};
|
|
4609
4680
|
|
|
4610
4681
|
// src/features/mcp/kiro-mcp.ts
|
|
4611
|
-
import { join as
|
|
4682
|
+
import { join as join42 } from "path";
|
|
4612
4683
|
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
4613
4684
|
json;
|
|
4614
4685
|
constructor(params) {
|
|
@@ -4620,7 +4691,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4620
4691
|
}
|
|
4621
4692
|
static getSettablePaths() {
|
|
4622
4693
|
return {
|
|
4623
|
-
relativeDirPath:
|
|
4694
|
+
relativeDirPath: join42(".kiro", "settings"),
|
|
4624
4695
|
relativeFilePath: "mcp.json"
|
|
4625
4696
|
};
|
|
4626
4697
|
}
|
|
@@ -4630,7 +4701,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4630
4701
|
}) {
|
|
4631
4702
|
const paths = this.getSettablePaths();
|
|
4632
4703
|
const fileContent = await readOrInitializeFileContent(
|
|
4633
|
-
|
|
4704
|
+
join42(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4634
4705
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4635
4706
|
);
|
|
4636
4707
|
return new _KiroMcp({
|
|
@@ -4684,7 +4755,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4684
4755
|
};
|
|
4685
4756
|
|
|
4686
4757
|
// src/features/mcp/opencode-mcp.ts
|
|
4687
|
-
import { join as
|
|
4758
|
+
import { join as join43 } from "path";
|
|
4688
4759
|
import { z as z17 } from "zod/mini";
|
|
4689
4760
|
var OpencodeMcpLocalServerSchema = z17.object({
|
|
4690
4761
|
type: z17.literal("local"),
|
|
@@ -4808,7 +4879,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4808
4879
|
}) {
|
|
4809
4880
|
const paths = this.getSettablePaths({ global });
|
|
4810
4881
|
const fileContent = await readOrInitializeFileContent(
|
|
4811
|
-
|
|
4882
|
+
join43(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4812
4883
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4813
4884
|
);
|
|
4814
4885
|
const json = JSON.parse(fileContent);
|
|
@@ -4829,7 +4900,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4829
4900
|
}) {
|
|
4830
4901
|
const paths = this.getSettablePaths({ global });
|
|
4831
4902
|
const fileContent = await readOrInitializeFileContent(
|
|
4832
|
-
|
|
4903
|
+
join43(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4833
4904
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4834
4905
|
);
|
|
4835
4906
|
const json = JSON.parse(fileContent);
|
|
@@ -4873,7 +4944,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4873
4944
|
};
|
|
4874
4945
|
|
|
4875
4946
|
// src/features/mcp/roo-mcp.ts
|
|
4876
|
-
import { join as
|
|
4947
|
+
import { join as join44 } from "path";
|
|
4877
4948
|
function isRooMcpServers(value) {
|
|
4878
4949
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
4879
4950
|
}
|
|
@@ -4925,7 +4996,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4925
4996
|
validate = true
|
|
4926
4997
|
}) {
|
|
4927
4998
|
const fileContent = await readFileContent(
|
|
4928
|
-
|
|
4999
|
+
join44(
|
|
4929
5000
|
baseDir,
|
|
4930
5001
|
this.getSettablePaths().relativeDirPath,
|
|
4931
5002
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5240,24 +5311,24 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
5240
5311
|
|
|
5241
5312
|
// src/features/rules/rules-processor.ts
|
|
5242
5313
|
import { encode } from "@toon-format/toon";
|
|
5243
|
-
import { basename as
|
|
5314
|
+
import { basename as basename22, join as join96, relative as relative4 } from "path";
|
|
5244
5315
|
import { z as z44 } from "zod/mini";
|
|
5245
5316
|
|
|
5246
5317
|
// src/constants/general.ts
|
|
5247
5318
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
5248
5319
|
|
|
5249
5320
|
// src/features/skills/agentsmd-skill.ts
|
|
5250
|
-
import { join as
|
|
5321
|
+
import { join as join48 } from "path";
|
|
5251
5322
|
|
|
5252
5323
|
// src/features/skills/simulated-skill.ts
|
|
5253
|
-
import { join as
|
|
5324
|
+
import { join as join47 } from "path";
|
|
5254
5325
|
import { z as z19 } from "zod/mini";
|
|
5255
5326
|
|
|
5256
5327
|
// src/features/skills/tool-skill.ts
|
|
5257
|
-
import { join as
|
|
5328
|
+
import { join as join46 } from "path";
|
|
5258
5329
|
|
|
5259
5330
|
// src/types/ai-dir.ts
|
|
5260
|
-
import path2, { basename as basename16, join as
|
|
5331
|
+
import path2, { basename as basename16, join as join45, relative as relative3, resolve as resolve4 } from "path";
|
|
5261
5332
|
var AiDir = class {
|
|
5262
5333
|
/**
|
|
5263
5334
|
* @example "."
|
|
@@ -5351,8 +5422,8 @@ var AiDir = class {
|
|
|
5351
5422
|
* @returns Array of files with their relative paths and buffers
|
|
5352
5423
|
*/
|
|
5353
5424
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
5354
|
-
const dirPath =
|
|
5355
|
-
const glob =
|
|
5425
|
+
const dirPath = join45(baseDir, relativeDirPath, dirName);
|
|
5426
|
+
const glob = join45(dirPath, "**", "*");
|
|
5356
5427
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
5357
5428
|
const filteredPaths = filePaths.filter((filePath) => basename16(filePath) !== excludeFileName);
|
|
5358
5429
|
const files = await Promise.all(
|
|
@@ -5450,8 +5521,8 @@ var ToolSkill = class extends AiDir {
|
|
|
5450
5521
|
}) {
|
|
5451
5522
|
const settablePaths = getSettablePaths({ global });
|
|
5452
5523
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5453
|
-
const skillDirPath =
|
|
5454
|
-
const skillFilePath =
|
|
5524
|
+
const skillDirPath = join46(baseDir, actualRelativeDirPath, dirName);
|
|
5525
|
+
const skillFilePath = join46(skillDirPath, SKILL_FILE_NAME);
|
|
5455
5526
|
if (!await fileExists(skillFilePath)) {
|
|
5456
5527
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5457
5528
|
}
|
|
@@ -5509,7 +5580,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5509
5580
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
5510
5581
|
if (!result.success) {
|
|
5511
5582
|
throw new Error(
|
|
5512
|
-
`Invalid frontmatter in ${
|
|
5583
|
+
`Invalid frontmatter in ${join47(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
5513
5584
|
);
|
|
5514
5585
|
}
|
|
5515
5586
|
}
|
|
@@ -5567,8 +5638,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5567
5638
|
}) {
|
|
5568
5639
|
const settablePaths = this.getSettablePaths();
|
|
5569
5640
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5570
|
-
const skillDirPath =
|
|
5571
|
-
const skillFilePath =
|
|
5641
|
+
const skillDirPath = join47(baseDir, actualRelativeDirPath, dirName);
|
|
5642
|
+
const skillFilePath = join47(skillDirPath, SKILL_FILE_NAME);
|
|
5572
5643
|
if (!await fileExists(skillFilePath)) {
|
|
5573
5644
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5574
5645
|
}
|
|
@@ -5645,7 +5716,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5645
5716
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
5646
5717
|
}
|
|
5647
5718
|
return {
|
|
5648
|
-
relativeDirPath:
|
|
5719
|
+
relativeDirPath: join48(".agents", "skills")
|
|
5649
5720
|
};
|
|
5650
5721
|
}
|
|
5651
5722
|
static async fromDir(params) {
|
|
@@ -5672,14 +5743,14 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5672
5743
|
};
|
|
5673
5744
|
|
|
5674
5745
|
// src/features/skills/geminicli-skill.ts
|
|
5675
|
-
import { join as
|
|
5746
|
+
import { join as join49 } from "path";
|
|
5676
5747
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5677
5748
|
static getSettablePaths(options) {
|
|
5678
5749
|
if (options?.global) {
|
|
5679
5750
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5680
5751
|
}
|
|
5681
5752
|
return {
|
|
5682
|
-
relativeDirPath:
|
|
5753
|
+
relativeDirPath: join49(".gemini", "skills")
|
|
5683
5754
|
};
|
|
5684
5755
|
}
|
|
5685
5756
|
static async fromDir(params) {
|
|
@@ -5706,11 +5777,11 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
|
5706
5777
|
};
|
|
5707
5778
|
|
|
5708
5779
|
// src/features/skills/skills-processor.ts
|
|
5709
|
-
import { basename as basename17, join as
|
|
5780
|
+
import { basename as basename17, join as join61 } from "path";
|
|
5710
5781
|
import { z as z30 } from "zod/mini";
|
|
5711
5782
|
|
|
5712
5783
|
// src/types/dir-feature-processor.ts
|
|
5713
|
-
import { join as
|
|
5784
|
+
import { join as join50 } from "path";
|
|
5714
5785
|
var DirFeatureProcessor = class {
|
|
5715
5786
|
baseDir;
|
|
5716
5787
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -5732,14 +5803,14 @@ var DirFeatureProcessor = class {
|
|
|
5732
5803
|
await ensureDir(dirPath);
|
|
5733
5804
|
const mainFile = aiDir.getMainFile();
|
|
5734
5805
|
if (mainFile) {
|
|
5735
|
-
const mainFilePath =
|
|
5806
|
+
const mainFilePath = join50(dirPath, mainFile.name);
|
|
5736
5807
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5737
5808
|
const contentWithNewline = addTrailingNewline(content);
|
|
5738
5809
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5739
5810
|
}
|
|
5740
5811
|
const otherFiles = aiDir.getOtherFiles();
|
|
5741
5812
|
for (const file of otherFiles) {
|
|
5742
|
-
const filePath =
|
|
5813
|
+
const filePath = join50(dirPath, file.relativeFilePathToDirPath);
|
|
5743
5814
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5744
5815
|
await writeFileContent(filePath, contentWithNewline);
|
|
5745
5816
|
}
|
|
@@ -5754,11 +5825,11 @@ var DirFeatureProcessor = class {
|
|
|
5754
5825
|
};
|
|
5755
5826
|
|
|
5756
5827
|
// src/features/skills/antigravity-skill.ts
|
|
5757
|
-
import { join as
|
|
5828
|
+
import { join as join52 } from "path";
|
|
5758
5829
|
import { z as z21 } from "zod/mini";
|
|
5759
5830
|
|
|
5760
5831
|
// src/features/skills/rulesync-skill.ts
|
|
5761
|
-
import { join as
|
|
5832
|
+
import { join as join51 } from "path";
|
|
5762
5833
|
import { z as z20 } from "zod/mini";
|
|
5763
5834
|
var RulesyncSkillFrontmatterSchemaInternal = z20.looseObject({
|
|
5764
5835
|
name: z20.string(),
|
|
@@ -5850,8 +5921,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5850
5921
|
dirName,
|
|
5851
5922
|
global = false
|
|
5852
5923
|
}) {
|
|
5853
|
-
const skillDirPath =
|
|
5854
|
-
const skillFilePath =
|
|
5924
|
+
const skillDirPath = join51(baseDir, relativeDirPath, dirName);
|
|
5925
|
+
const skillFilePath = join51(skillDirPath, SKILL_FILE_NAME);
|
|
5855
5926
|
if (!await fileExists(skillFilePath)) {
|
|
5856
5927
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5857
5928
|
}
|
|
@@ -5888,7 +5959,7 @@ var AntigravitySkillFrontmatterSchema = z21.looseObject({
|
|
|
5888
5959
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
5889
5960
|
constructor({
|
|
5890
5961
|
baseDir = process.cwd(),
|
|
5891
|
-
relativeDirPath =
|
|
5962
|
+
relativeDirPath = join52(".agent", "skills"),
|
|
5892
5963
|
dirName,
|
|
5893
5964
|
frontmatter,
|
|
5894
5965
|
body,
|
|
@@ -5920,11 +5991,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
5920
5991
|
} = {}) {
|
|
5921
5992
|
if (global) {
|
|
5922
5993
|
return {
|
|
5923
|
-
relativeDirPath:
|
|
5994
|
+
relativeDirPath: join52(".gemini", "antigravity", "skills")
|
|
5924
5995
|
};
|
|
5925
5996
|
}
|
|
5926
5997
|
return {
|
|
5927
|
-
relativeDirPath:
|
|
5998
|
+
relativeDirPath: join52(".agent", "skills")
|
|
5928
5999
|
};
|
|
5929
6000
|
}
|
|
5930
6001
|
getFrontmatter() {
|
|
@@ -6006,9 +6077,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
6006
6077
|
});
|
|
6007
6078
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6008
6079
|
if (!result.success) {
|
|
6009
|
-
const skillDirPath =
|
|
6080
|
+
const skillDirPath = join52(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6010
6081
|
throw new Error(
|
|
6011
|
-
`Invalid frontmatter in ${
|
|
6082
|
+
`Invalid frontmatter in ${join52(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6012
6083
|
);
|
|
6013
6084
|
}
|
|
6014
6085
|
return new _AntigravitySkill({
|
|
@@ -6042,7 +6113,7 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
6042
6113
|
};
|
|
6043
6114
|
|
|
6044
6115
|
// src/features/skills/claudecode-skill.ts
|
|
6045
|
-
import { join as
|
|
6116
|
+
import { join as join53 } from "path";
|
|
6046
6117
|
import { z as z22 } from "zod/mini";
|
|
6047
6118
|
var ClaudecodeSkillFrontmatterSchema = z22.looseObject({
|
|
6048
6119
|
name: z22.string(),
|
|
@@ -6052,7 +6123,7 @@ var ClaudecodeSkillFrontmatterSchema = z22.looseObject({
|
|
|
6052
6123
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
6053
6124
|
constructor({
|
|
6054
6125
|
baseDir = process.cwd(),
|
|
6055
|
-
relativeDirPath =
|
|
6126
|
+
relativeDirPath = join53(".claude", "skills"),
|
|
6056
6127
|
dirName,
|
|
6057
6128
|
frontmatter,
|
|
6058
6129
|
body,
|
|
@@ -6083,7 +6154,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6083
6154
|
global: _global = false
|
|
6084
6155
|
} = {}) {
|
|
6085
6156
|
return {
|
|
6086
|
-
relativeDirPath:
|
|
6157
|
+
relativeDirPath: join53(".claude", "skills")
|
|
6087
6158
|
};
|
|
6088
6159
|
}
|
|
6089
6160
|
getFrontmatter() {
|
|
@@ -6171,9 +6242,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6171
6242
|
});
|
|
6172
6243
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6173
6244
|
if (!result.success) {
|
|
6174
|
-
const skillDirPath =
|
|
6245
|
+
const skillDirPath = join53(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6175
6246
|
throw new Error(
|
|
6176
|
-
`Invalid frontmatter in ${
|
|
6247
|
+
`Invalid frontmatter in ${join53(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6177
6248
|
);
|
|
6178
6249
|
}
|
|
6179
6250
|
return new _ClaudecodeSkill({
|
|
@@ -6207,7 +6278,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6207
6278
|
};
|
|
6208
6279
|
|
|
6209
6280
|
// src/features/skills/codexcli-skill.ts
|
|
6210
|
-
import { join as
|
|
6281
|
+
import { join as join54 } from "path";
|
|
6211
6282
|
import { z as z23 } from "zod/mini";
|
|
6212
6283
|
var CodexCliSkillFrontmatterSchema = z23.looseObject({
|
|
6213
6284
|
name: z23.string(),
|
|
@@ -6221,7 +6292,7 @@ var CodexCliSkillFrontmatterSchema = z23.looseObject({
|
|
|
6221
6292
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
6222
6293
|
constructor({
|
|
6223
6294
|
baseDir = process.cwd(),
|
|
6224
|
-
relativeDirPath =
|
|
6295
|
+
relativeDirPath = join54(".codex", "skills"),
|
|
6225
6296
|
dirName,
|
|
6226
6297
|
frontmatter,
|
|
6227
6298
|
body,
|
|
@@ -6252,7 +6323,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6252
6323
|
global: _global = false
|
|
6253
6324
|
} = {}) {
|
|
6254
6325
|
return {
|
|
6255
|
-
relativeDirPath:
|
|
6326
|
+
relativeDirPath: join54(".codex", "skills")
|
|
6256
6327
|
};
|
|
6257
6328
|
}
|
|
6258
6329
|
getFrontmatter() {
|
|
@@ -6344,9 +6415,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6344
6415
|
});
|
|
6345
6416
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6346
6417
|
if (!result.success) {
|
|
6347
|
-
const skillDirPath =
|
|
6418
|
+
const skillDirPath = join54(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6348
6419
|
throw new Error(
|
|
6349
|
-
`Invalid frontmatter in ${
|
|
6420
|
+
`Invalid frontmatter in ${join54(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6350
6421
|
);
|
|
6351
6422
|
}
|
|
6352
6423
|
return new _CodexCliSkill({
|
|
@@ -6380,7 +6451,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6380
6451
|
};
|
|
6381
6452
|
|
|
6382
6453
|
// src/features/skills/copilot-skill.ts
|
|
6383
|
-
import { join as
|
|
6454
|
+
import { join as join55 } from "path";
|
|
6384
6455
|
import { z as z24 } from "zod/mini";
|
|
6385
6456
|
var CopilotSkillFrontmatterSchema = z24.looseObject({
|
|
6386
6457
|
name: z24.string(),
|
|
@@ -6390,7 +6461,7 @@ var CopilotSkillFrontmatterSchema = z24.looseObject({
|
|
|
6390
6461
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
6391
6462
|
constructor({
|
|
6392
6463
|
baseDir = process.cwd(),
|
|
6393
|
-
relativeDirPath =
|
|
6464
|
+
relativeDirPath = join55(".github", "skills"),
|
|
6394
6465
|
dirName,
|
|
6395
6466
|
frontmatter,
|
|
6396
6467
|
body,
|
|
@@ -6422,7 +6493,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6422
6493
|
throw new Error("CopilotSkill does not support global mode.");
|
|
6423
6494
|
}
|
|
6424
6495
|
return {
|
|
6425
|
-
relativeDirPath:
|
|
6496
|
+
relativeDirPath: join55(".github", "skills")
|
|
6426
6497
|
};
|
|
6427
6498
|
}
|
|
6428
6499
|
getFrontmatter() {
|
|
@@ -6510,9 +6581,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6510
6581
|
});
|
|
6511
6582
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6512
6583
|
if (!result.success) {
|
|
6513
|
-
const skillDirPath =
|
|
6584
|
+
const skillDirPath = join55(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6514
6585
|
throw new Error(
|
|
6515
|
-
`Invalid frontmatter in ${
|
|
6586
|
+
`Invalid frontmatter in ${join55(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6516
6587
|
);
|
|
6517
6588
|
}
|
|
6518
6589
|
return new _CopilotSkill({
|
|
@@ -6547,7 +6618,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6547
6618
|
};
|
|
6548
6619
|
|
|
6549
6620
|
// src/features/skills/cursor-skill.ts
|
|
6550
|
-
import { join as
|
|
6621
|
+
import { join as join56 } from "path";
|
|
6551
6622
|
import { z as z25 } from "zod/mini";
|
|
6552
6623
|
var CursorSkillFrontmatterSchema = z25.looseObject({
|
|
6553
6624
|
name: z25.string(),
|
|
@@ -6556,7 +6627,7 @@ var CursorSkillFrontmatterSchema = z25.looseObject({
|
|
|
6556
6627
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
6557
6628
|
constructor({
|
|
6558
6629
|
baseDir = process.cwd(),
|
|
6559
|
-
relativeDirPath =
|
|
6630
|
+
relativeDirPath = join56(".cursor", "skills"),
|
|
6560
6631
|
dirName,
|
|
6561
6632
|
frontmatter,
|
|
6562
6633
|
body,
|
|
@@ -6588,7 +6659,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6588
6659
|
throw new Error("CursorSkill does not support global mode.");
|
|
6589
6660
|
}
|
|
6590
6661
|
return {
|
|
6591
|
-
relativeDirPath:
|
|
6662
|
+
relativeDirPath: join56(".cursor", "skills")
|
|
6592
6663
|
};
|
|
6593
6664
|
}
|
|
6594
6665
|
getFrontmatter() {
|
|
@@ -6670,9 +6741,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6670
6741
|
});
|
|
6671
6742
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6672
6743
|
if (!result.success) {
|
|
6673
|
-
const skillDirPath =
|
|
6744
|
+
const skillDirPath = join56(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6674
6745
|
throw new Error(
|
|
6675
|
-
`Invalid frontmatter in ${
|
|
6746
|
+
`Invalid frontmatter in ${join56(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6676
6747
|
);
|
|
6677
6748
|
}
|
|
6678
6749
|
return new _CursorSkill({
|
|
@@ -6707,7 +6778,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6707
6778
|
};
|
|
6708
6779
|
|
|
6709
6780
|
// src/features/skills/kilo-skill.ts
|
|
6710
|
-
import { join as
|
|
6781
|
+
import { join as join57 } from "path";
|
|
6711
6782
|
import { z as z26 } from "zod/mini";
|
|
6712
6783
|
var KiloSkillFrontmatterSchema = z26.looseObject({
|
|
6713
6784
|
name: z26.string(),
|
|
@@ -6716,7 +6787,7 @@ var KiloSkillFrontmatterSchema = z26.looseObject({
|
|
|
6716
6787
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
6717
6788
|
constructor({
|
|
6718
6789
|
baseDir = process.cwd(),
|
|
6719
|
-
relativeDirPath =
|
|
6790
|
+
relativeDirPath = join57(".kilocode", "skills"),
|
|
6720
6791
|
dirName,
|
|
6721
6792
|
frontmatter,
|
|
6722
6793
|
body,
|
|
@@ -6747,7 +6818,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6747
6818
|
global: _global = false
|
|
6748
6819
|
} = {}) {
|
|
6749
6820
|
return {
|
|
6750
|
-
relativeDirPath:
|
|
6821
|
+
relativeDirPath: join57(".kilocode", "skills")
|
|
6751
6822
|
};
|
|
6752
6823
|
}
|
|
6753
6824
|
getFrontmatter() {
|
|
@@ -6837,13 +6908,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6837
6908
|
});
|
|
6838
6909
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6839
6910
|
if (!result.success) {
|
|
6840
|
-
const skillDirPath =
|
|
6911
|
+
const skillDirPath = join57(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6841
6912
|
throw new Error(
|
|
6842
|
-
`Invalid frontmatter in ${
|
|
6913
|
+
`Invalid frontmatter in ${join57(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6843
6914
|
);
|
|
6844
6915
|
}
|
|
6845
6916
|
if (result.data.name !== loaded.dirName) {
|
|
6846
|
-
const skillFilePath =
|
|
6917
|
+
const skillFilePath = join57(
|
|
6847
6918
|
loaded.baseDir,
|
|
6848
6919
|
loaded.relativeDirPath,
|
|
6849
6920
|
loaded.dirName,
|
|
@@ -6884,7 +6955,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6884
6955
|
};
|
|
6885
6956
|
|
|
6886
6957
|
// src/features/skills/kiro-skill.ts
|
|
6887
|
-
import { join as
|
|
6958
|
+
import { join as join58 } from "path";
|
|
6888
6959
|
import { z as z27 } from "zod/mini";
|
|
6889
6960
|
var KiroSkillFrontmatterSchema = z27.looseObject({
|
|
6890
6961
|
name: z27.string(),
|
|
@@ -6893,7 +6964,7 @@ var KiroSkillFrontmatterSchema = z27.looseObject({
|
|
|
6893
6964
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
6894
6965
|
constructor({
|
|
6895
6966
|
baseDir = process.cwd(),
|
|
6896
|
-
relativeDirPath =
|
|
6967
|
+
relativeDirPath = join58(".kiro", "skills"),
|
|
6897
6968
|
dirName,
|
|
6898
6969
|
frontmatter,
|
|
6899
6970
|
body,
|
|
@@ -6925,7 +6996,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
6925
6996
|
throw new Error("KiroSkill does not support global mode.");
|
|
6926
6997
|
}
|
|
6927
6998
|
return {
|
|
6928
|
-
relativeDirPath:
|
|
6999
|
+
relativeDirPath: join58(".kiro", "skills")
|
|
6929
7000
|
};
|
|
6930
7001
|
}
|
|
6931
7002
|
getFrontmatter() {
|
|
@@ -7015,13 +7086,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
7015
7086
|
});
|
|
7016
7087
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7017
7088
|
if (!result.success) {
|
|
7018
|
-
const skillDirPath =
|
|
7089
|
+
const skillDirPath = join58(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7019
7090
|
throw new Error(
|
|
7020
|
-
`Invalid frontmatter in ${
|
|
7091
|
+
`Invalid frontmatter in ${join58(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7021
7092
|
);
|
|
7022
7093
|
}
|
|
7023
7094
|
if (result.data.name !== loaded.dirName) {
|
|
7024
|
-
const skillFilePath =
|
|
7095
|
+
const skillFilePath = join58(
|
|
7025
7096
|
loaded.baseDir,
|
|
7026
7097
|
loaded.relativeDirPath,
|
|
7027
7098
|
loaded.dirName,
|
|
@@ -7063,7 +7134,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
7063
7134
|
};
|
|
7064
7135
|
|
|
7065
7136
|
// src/features/skills/opencode-skill.ts
|
|
7066
|
-
import { join as
|
|
7137
|
+
import { join as join59 } from "path";
|
|
7067
7138
|
import { z as z28 } from "zod/mini";
|
|
7068
7139
|
var OpenCodeSkillFrontmatterSchema = z28.looseObject({
|
|
7069
7140
|
name: z28.string(),
|
|
@@ -7073,7 +7144,7 @@ var OpenCodeSkillFrontmatterSchema = z28.looseObject({
|
|
|
7073
7144
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
7074
7145
|
constructor({
|
|
7075
7146
|
baseDir = process.cwd(),
|
|
7076
|
-
relativeDirPath =
|
|
7147
|
+
relativeDirPath = join59(".opencode", "skill"),
|
|
7077
7148
|
dirName,
|
|
7078
7149
|
frontmatter,
|
|
7079
7150
|
body,
|
|
@@ -7102,7 +7173,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
7102
7173
|
}
|
|
7103
7174
|
static getSettablePaths({ global = false } = {}) {
|
|
7104
7175
|
return {
|
|
7105
|
-
relativeDirPath: global ?
|
|
7176
|
+
relativeDirPath: global ? join59(".config", "opencode", "skill") : join59(".opencode", "skill")
|
|
7106
7177
|
};
|
|
7107
7178
|
}
|
|
7108
7179
|
getFrontmatter() {
|
|
@@ -7190,9 +7261,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
7190
7261
|
});
|
|
7191
7262
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7192
7263
|
if (!result.success) {
|
|
7193
|
-
const skillDirPath =
|
|
7264
|
+
const skillDirPath = join59(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7194
7265
|
throw new Error(
|
|
7195
|
-
`Invalid frontmatter in ${
|
|
7266
|
+
`Invalid frontmatter in ${join59(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7196
7267
|
);
|
|
7197
7268
|
}
|
|
7198
7269
|
return new _OpenCodeSkill({
|
|
@@ -7226,7 +7297,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
7226
7297
|
};
|
|
7227
7298
|
|
|
7228
7299
|
// src/features/skills/roo-skill.ts
|
|
7229
|
-
import { join as
|
|
7300
|
+
import { join as join60 } from "path";
|
|
7230
7301
|
import { z as z29 } from "zod/mini";
|
|
7231
7302
|
var RooSkillFrontmatterSchema = z29.looseObject({
|
|
7232
7303
|
name: z29.string(),
|
|
@@ -7235,7 +7306,7 @@ var RooSkillFrontmatterSchema = z29.looseObject({
|
|
|
7235
7306
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
7236
7307
|
constructor({
|
|
7237
7308
|
baseDir = process.cwd(),
|
|
7238
|
-
relativeDirPath =
|
|
7309
|
+
relativeDirPath = join60(".roo", "skills"),
|
|
7239
7310
|
dirName,
|
|
7240
7311
|
frontmatter,
|
|
7241
7312
|
body,
|
|
@@ -7266,7 +7337,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
7266
7337
|
global: _global = false
|
|
7267
7338
|
} = {}) {
|
|
7268
7339
|
return {
|
|
7269
|
-
relativeDirPath:
|
|
7340
|
+
relativeDirPath: join60(".roo", "skills")
|
|
7270
7341
|
};
|
|
7271
7342
|
}
|
|
7272
7343
|
getFrontmatter() {
|
|
@@ -7356,13 +7427,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
7356
7427
|
});
|
|
7357
7428
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7358
7429
|
if (!result.success) {
|
|
7359
|
-
const skillDirPath =
|
|
7430
|
+
const skillDirPath = join60(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7360
7431
|
throw new Error(
|
|
7361
|
-
`Invalid frontmatter in ${
|
|
7432
|
+
`Invalid frontmatter in ${join60(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7362
7433
|
);
|
|
7363
7434
|
}
|
|
7364
7435
|
if (result.data.name !== loaded.dirName) {
|
|
7365
|
-
const skillFilePath =
|
|
7436
|
+
const skillFilePath = join60(
|
|
7366
7437
|
loaded.baseDir,
|
|
7367
7438
|
loaded.relativeDirPath,
|
|
7368
7439
|
loaded.dirName,
|
|
@@ -7581,8 +7652,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7581
7652
|
*/
|
|
7582
7653
|
async loadRulesyncDirs() {
|
|
7583
7654
|
const paths = RulesyncSkill.getSettablePaths();
|
|
7584
|
-
const rulesyncSkillsDirPath =
|
|
7585
|
-
const dirPaths = await findFilesByGlobs(
|
|
7655
|
+
const rulesyncSkillsDirPath = join61(this.baseDir, paths.relativeDirPath);
|
|
7656
|
+
const dirPaths = await findFilesByGlobs(join61(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
7586
7657
|
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7587
7658
|
const rulesyncSkills = await Promise.all(
|
|
7588
7659
|
dirNames.map(
|
|
@@ -7599,8 +7670,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7599
7670
|
async loadToolDirs() {
|
|
7600
7671
|
const factory = this.getFactory(this.toolTarget);
|
|
7601
7672
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7602
|
-
const skillsDirPath =
|
|
7603
|
-
const dirPaths = await findFilesByGlobs(
|
|
7673
|
+
const skillsDirPath = join61(this.baseDir, paths.relativeDirPath);
|
|
7674
|
+
const dirPaths = await findFilesByGlobs(join61(skillsDirPath, "*"), { type: "dir" });
|
|
7604
7675
|
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7605
7676
|
const toolSkills = await Promise.all(
|
|
7606
7677
|
dirNames.map(
|
|
@@ -7617,8 +7688,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7617
7688
|
async loadToolDirsToDelete() {
|
|
7618
7689
|
const factory = this.getFactory(this.toolTarget);
|
|
7619
7690
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7620
|
-
const skillsDirPath =
|
|
7621
|
-
const dirPaths = await findFilesByGlobs(
|
|
7691
|
+
const skillsDirPath = join61(this.baseDir, paths.relativeDirPath);
|
|
7692
|
+
const dirPaths = await findFilesByGlobs(join61(skillsDirPath, "*"), { type: "dir" });
|
|
7622
7693
|
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7623
7694
|
const toolSkills = dirNames.map(
|
|
7624
7695
|
(dirName) => factory.class.forDeletion({
|
|
@@ -7667,10 +7738,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7667
7738
|
};
|
|
7668
7739
|
|
|
7669
7740
|
// src/features/subagents/agentsmd-subagent.ts
|
|
7670
|
-
import { join as
|
|
7741
|
+
import { join as join63 } from "path";
|
|
7671
7742
|
|
|
7672
7743
|
// src/features/subagents/simulated-subagent.ts
|
|
7673
|
-
import { basename as basename18, join as
|
|
7744
|
+
import { basename as basename18, join as join62 } from "path";
|
|
7674
7745
|
import { z as z31 } from "zod/mini";
|
|
7675
7746
|
|
|
7676
7747
|
// src/features/subagents/tool-subagent.ts
|
|
@@ -7726,7 +7797,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7726
7797
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7727
7798
|
if (!result.success) {
|
|
7728
7799
|
throw new Error(
|
|
7729
|
-
`Invalid frontmatter in ${
|
|
7800
|
+
`Invalid frontmatter in ${join62(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7730
7801
|
);
|
|
7731
7802
|
}
|
|
7732
7803
|
}
|
|
@@ -7777,7 +7848,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7777
7848
|
return {
|
|
7778
7849
|
success: false,
|
|
7779
7850
|
error: new Error(
|
|
7780
|
-
`Invalid frontmatter in ${
|
|
7851
|
+
`Invalid frontmatter in ${join62(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7781
7852
|
)
|
|
7782
7853
|
};
|
|
7783
7854
|
}
|
|
@@ -7787,7 +7858,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7787
7858
|
relativeFilePath,
|
|
7788
7859
|
validate = true
|
|
7789
7860
|
}) {
|
|
7790
|
-
const filePath =
|
|
7861
|
+
const filePath = join62(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
7791
7862
|
const fileContent = await readFileContent(filePath);
|
|
7792
7863
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7793
7864
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7823,7 +7894,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7823
7894
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
7824
7895
|
static getSettablePaths() {
|
|
7825
7896
|
return {
|
|
7826
|
-
relativeDirPath:
|
|
7897
|
+
relativeDirPath: join63(".agents", "subagents")
|
|
7827
7898
|
};
|
|
7828
7899
|
}
|
|
7829
7900
|
static async fromFile(params) {
|
|
@@ -7846,11 +7917,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
7846
7917
|
};
|
|
7847
7918
|
|
|
7848
7919
|
// src/features/subagents/codexcli-subagent.ts
|
|
7849
|
-
import { join as
|
|
7920
|
+
import { join as join64 } from "path";
|
|
7850
7921
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
7851
7922
|
static getSettablePaths() {
|
|
7852
7923
|
return {
|
|
7853
|
-
relativeDirPath:
|
|
7924
|
+
relativeDirPath: join64(".codex", "subagents")
|
|
7854
7925
|
};
|
|
7855
7926
|
}
|
|
7856
7927
|
static async fromFile(params) {
|
|
@@ -7873,11 +7944,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
7873
7944
|
};
|
|
7874
7945
|
|
|
7875
7946
|
// src/features/subagents/cursor-subagent.ts
|
|
7876
|
-
import { join as
|
|
7947
|
+
import { join as join65 } from "path";
|
|
7877
7948
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
7878
7949
|
static getSettablePaths() {
|
|
7879
7950
|
return {
|
|
7880
|
-
relativeDirPath:
|
|
7951
|
+
relativeDirPath: join65(".cursor", "subagents")
|
|
7881
7952
|
};
|
|
7882
7953
|
}
|
|
7883
7954
|
static async fromFile(params) {
|
|
@@ -7900,11 +7971,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
7900
7971
|
};
|
|
7901
7972
|
|
|
7902
7973
|
// src/features/subagents/geminicli-subagent.ts
|
|
7903
|
-
import { join as
|
|
7974
|
+
import { join as join66 } from "path";
|
|
7904
7975
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
7905
7976
|
static getSettablePaths() {
|
|
7906
7977
|
return {
|
|
7907
|
-
relativeDirPath:
|
|
7978
|
+
relativeDirPath: join66(".gemini", "subagents")
|
|
7908
7979
|
};
|
|
7909
7980
|
}
|
|
7910
7981
|
static async fromFile(params) {
|
|
@@ -7927,11 +7998,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
7927
7998
|
};
|
|
7928
7999
|
|
|
7929
8000
|
// src/features/subagents/roo-subagent.ts
|
|
7930
|
-
import { join as
|
|
8001
|
+
import { join as join67 } from "path";
|
|
7931
8002
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
7932
8003
|
static getSettablePaths() {
|
|
7933
8004
|
return {
|
|
7934
|
-
relativeDirPath:
|
|
8005
|
+
relativeDirPath: join67(".roo", "subagents")
|
|
7935
8006
|
};
|
|
7936
8007
|
}
|
|
7937
8008
|
static async fromFile(params) {
|
|
@@ -7954,15 +8025,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
7954
8025
|
};
|
|
7955
8026
|
|
|
7956
8027
|
// src/features/subagents/subagents-processor.ts
|
|
7957
|
-
import { basename as basename21, join as
|
|
8028
|
+
import { basename as basename21, join as join73 } from "path";
|
|
7958
8029
|
import { z as z37 } from "zod/mini";
|
|
7959
8030
|
|
|
7960
8031
|
// src/features/subagents/claudecode-subagent.ts
|
|
7961
|
-
import { join as
|
|
8032
|
+
import { join as join69 } from "path";
|
|
7962
8033
|
import { z as z33 } from "zod/mini";
|
|
7963
8034
|
|
|
7964
8035
|
// src/features/subagents/rulesync-subagent.ts
|
|
7965
|
-
import { basename as basename19, join as
|
|
8036
|
+
import { basename as basename19, join as join68 } from "path";
|
|
7966
8037
|
import { z as z32 } from "zod/mini";
|
|
7967
8038
|
var RulesyncSubagentFrontmatterSchema = z32.looseObject({
|
|
7968
8039
|
targets: RulesyncTargetsSchema,
|
|
@@ -7977,7 +8048,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7977
8048
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7978
8049
|
if (!result.success) {
|
|
7979
8050
|
throw new Error(
|
|
7980
|
-
`Invalid frontmatter in ${
|
|
8051
|
+
`Invalid frontmatter in ${join68(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7981
8052
|
);
|
|
7982
8053
|
}
|
|
7983
8054
|
}
|
|
@@ -8010,7 +8081,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
8010
8081
|
return {
|
|
8011
8082
|
success: false,
|
|
8012
8083
|
error: new Error(
|
|
8013
|
-
`Invalid frontmatter in ${
|
|
8084
|
+
`Invalid frontmatter in ${join68(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8014
8085
|
)
|
|
8015
8086
|
};
|
|
8016
8087
|
}
|
|
@@ -8019,7 +8090,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
8019
8090
|
relativeFilePath
|
|
8020
8091
|
}) {
|
|
8021
8092
|
const fileContent = await readFileContent(
|
|
8022
|
-
|
|
8093
|
+
join68(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
8023
8094
|
);
|
|
8024
8095
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8025
8096
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8054,7 +8125,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8054
8125
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8055
8126
|
if (!result.success) {
|
|
8056
8127
|
throw new Error(
|
|
8057
|
-
`Invalid frontmatter in ${
|
|
8128
|
+
`Invalid frontmatter in ${join69(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8058
8129
|
);
|
|
8059
8130
|
}
|
|
8060
8131
|
}
|
|
@@ -8066,7 +8137,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8066
8137
|
}
|
|
8067
8138
|
static getSettablePaths(_options = {}) {
|
|
8068
8139
|
return {
|
|
8069
|
-
relativeDirPath:
|
|
8140
|
+
relativeDirPath: join69(".claude", "agents")
|
|
8070
8141
|
};
|
|
8071
8142
|
}
|
|
8072
8143
|
getFrontmatter() {
|
|
@@ -8140,7 +8211,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8140
8211
|
return {
|
|
8141
8212
|
success: false,
|
|
8142
8213
|
error: new Error(
|
|
8143
|
-
`Invalid frontmatter in ${
|
|
8214
|
+
`Invalid frontmatter in ${join69(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8144
8215
|
)
|
|
8145
8216
|
};
|
|
8146
8217
|
}
|
|
@@ -8158,7 +8229,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8158
8229
|
global = false
|
|
8159
8230
|
}) {
|
|
8160
8231
|
const paths = this.getSettablePaths({ global });
|
|
8161
|
-
const filePath =
|
|
8232
|
+
const filePath = join69(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8162
8233
|
const fileContent = await readFileContent(filePath);
|
|
8163
8234
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8164
8235
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8193,7 +8264,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8193
8264
|
};
|
|
8194
8265
|
|
|
8195
8266
|
// src/features/subagents/copilot-subagent.ts
|
|
8196
|
-
import { join as
|
|
8267
|
+
import { join as join70 } from "path";
|
|
8197
8268
|
import { z as z34 } from "zod/mini";
|
|
8198
8269
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
8199
8270
|
var CopilotSubagentFrontmatterSchema = z34.looseObject({
|
|
@@ -8219,7 +8290,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8219
8290
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8220
8291
|
if (!result.success) {
|
|
8221
8292
|
throw new Error(
|
|
8222
|
-
`Invalid frontmatter in ${
|
|
8293
|
+
`Invalid frontmatter in ${join70(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8223
8294
|
);
|
|
8224
8295
|
}
|
|
8225
8296
|
}
|
|
@@ -8231,7 +8302,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8231
8302
|
}
|
|
8232
8303
|
static getSettablePaths(_options = {}) {
|
|
8233
8304
|
return {
|
|
8234
|
-
relativeDirPath:
|
|
8305
|
+
relativeDirPath: join70(".github", "agents")
|
|
8235
8306
|
};
|
|
8236
8307
|
}
|
|
8237
8308
|
getFrontmatter() {
|
|
@@ -8305,7 +8376,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8305
8376
|
return {
|
|
8306
8377
|
success: false,
|
|
8307
8378
|
error: new Error(
|
|
8308
|
-
`Invalid frontmatter in ${
|
|
8379
|
+
`Invalid frontmatter in ${join70(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8309
8380
|
)
|
|
8310
8381
|
};
|
|
8311
8382
|
}
|
|
@@ -8323,7 +8394,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8323
8394
|
global = false
|
|
8324
8395
|
}) {
|
|
8325
8396
|
const paths = this.getSettablePaths({ global });
|
|
8326
|
-
const filePath =
|
|
8397
|
+
const filePath = join70(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8327
8398
|
const fileContent = await readFileContent(filePath);
|
|
8328
8399
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8329
8400
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8359,7 +8430,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8359
8430
|
};
|
|
8360
8431
|
|
|
8361
8432
|
// src/features/subagents/kiro-subagent.ts
|
|
8362
|
-
import { join as
|
|
8433
|
+
import { join as join71 } from "path";
|
|
8363
8434
|
import { z as z35 } from "zod/mini";
|
|
8364
8435
|
var KiroCliSubagentJsonSchema = z35.looseObject({
|
|
8365
8436
|
name: z35.string(),
|
|
@@ -8387,7 +8458,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8387
8458
|
}
|
|
8388
8459
|
static getSettablePaths(_options = {}) {
|
|
8389
8460
|
return {
|
|
8390
|
-
relativeDirPath:
|
|
8461
|
+
relativeDirPath: join71(".kiro", "agents")
|
|
8391
8462
|
};
|
|
8392
8463
|
}
|
|
8393
8464
|
getBody() {
|
|
@@ -8467,7 +8538,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8467
8538
|
global = false
|
|
8468
8539
|
}) {
|
|
8469
8540
|
const paths = this.getSettablePaths({ global });
|
|
8470
|
-
const filePath =
|
|
8541
|
+
const filePath = join71(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8471
8542
|
const fileContent = await readFileContent(filePath);
|
|
8472
8543
|
return new _KiroSubagent({
|
|
8473
8544
|
baseDir,
|
|
@@ -8496,7 +8567,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8496
8567
|
};
|
|
8497
8568
|
|
|
8498
8569
|
// src/features/subagents/opencode-subagent.ts
|
|
8499
|
-
import { basename as basename20, join as
|
|
8570
|
+
import { basename as basename20, join as join72 } from "path";
|
|
8500
8571
|
import { z as z36 } from "zod/mini";
|
|
8501
8572
|
var OpenCodeSubagentFrontmatterSchema = z36.looseObject({
|
|
8502
8573
|
description: z36.string(),
|
|
@@ -8511,7 +8582,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8511
8582
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8512
8583
|
if (!result.success) {
|
|
8513
8584
|
throw new Error(
|
|
8514
|
-
`Invalid frontmatter in ${
|
|
8585
|
+
`Invalid frontmatter in ${join72(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8515
8586
|
);
|
|
8516
8587
|
}
|
|
8517
8588
|
}
|
|
@@ -8525,7 +8596,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8525
8596
|
global = false
|
|
8526
8597
|
} = {}) {
|
|
8527
8598
|
return {
|
|
8528
|
-
relativeDirPath: global ?
|
|
8599
|
+
relativeDirPath: global ? join72(".config", "opencode", "agent") : join72(".opencode", "agent")
|
|
8529
8600
|
};
|
|
8530
8601
|
}
|
|
8531
8602
|
getFrontmatter() {
|
|
@@ -8591,7 +8662,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8591
8662
|
return {
|
|
8592
8663
|
success: false,
|
|
8593
8664
|
error: new Error(
|
|
8594
|
-
`Invalid frontmatter in ${
|
|
8665
|
+
`Invalid frontmatter in ${join72(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8595
8666
|
)
|
|
8596
8667
|
};
|
|
8597
8668
|
}
|
|
@@ -8608,7 +8679,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8608
8679
|
global = false
|
|
8609
8680
|
}) {
|
|
8610
8681
|
const paths = this.getSettablePaths({ global });
|
|
8611
|
-
const filePath =
|
|
8682
|
+
const filePath = join72(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8612
8683
|
const fileContent = await readFileContent(filePath);
|
|
8613
8684
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8614
8685
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8810,7 +8881,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8810
8881
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
8811
8882
|
*/
|
|
8812
8883
|
async loadRulesyncFiles() {
|
|
8813
|
-
const subagentsDir =
|
|
8884
|
+
const subagentsDir = join73(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
8814
8885
|
const dirExists = await directoryExists(subagentsDir);
|
|
8815
8886
|
if (!dirExists) {
|
|
8816
8887
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -8825,7 +8896,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8825
8896
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
8826
8897
|
const rulesyncSubagents = [];
|
|
8827
8898
|
for (const mdFile of mdFiles) {
|
|
8828
|
-
const filepath =
|
|
8899
|
+
const filepath = join73(subagentsDir, mdFile);
|
|
8829
8900
|
try {
|
|
8830
8901
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
8831
8902
|
relativeFilePath: mdFile,
|
|
@@ -8855,7 +8926,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8855
8926
|
const factory = this.getFactory(this.toolTarget);
|
|
8856
8927
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
8857
8928
|
const subagentFilePaths = await findFilesByGlobs(
|
|
8858
|
-
|
|
8929
|
+
join73(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
8859
8930
|
);
|
|
8860
8931
|
if (forDeletion) {
|
|
8861
8932
|
const toolSubagents2 = subagentFilePaths.map(
|
|
@@ -8905,13 +8976,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8905
8976
|
};
|
|
8906
8977
|
|
|
8907
8978
|
// src/features/rules/agentsmd-rule.ts
|
|
8908
|
-
import { join as
|
|
8979
|
+
import { join as join76 } from "path";
|
|
8909
8980
|
|
|
8910
8981
|
// src/features/rules/tool-rule.ts
|
|
8911
|
-
import { join as
|
|
8982
|
+
import { join as join75 } from "path";
|
|
8912
8983
|
|
|
8913
8984
|
// src/features/rules/rulesync-rule.ts
|
|
8914
|
-
import {
|
|
8985
|
+
import { join as join74 } from "path";
|
|
8915
8986
|
import { z as z38 } from "zod/mini";
|
|
8916
8987
|
var RulesyncRuleFrontmatterSchema = z38.object({
|
|
8917
8988
|
root: z38.optional(z38.boolean()),
|
|
@@ -8959,7 +9030,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8959
9030
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8960
9031
|
if (!result.success) {
|
|
8961
9032
|
throw new Error(
|
|
8962
|
-
`Invalid frontmatter in ${
|
|
9033
|
+
`Invalid frontmatter in ${join74(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8963
9034
|
);
|
|
8964
9035
|
}
|
|
8965
9036
|
}
|
|
@@ -8994,7 +9065,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8994
9065
|
return {
|
|
8995
9066
|
success: false,
|
|
8996
9067
|
error: new Error(
|
|
8997
|
-
`Invalid frontmatter in ${
|
|
9068
|
+
`Invalid frontmatter in ${join74(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8998
9069
|
)
|
|
8999
9070
|
};
|
|
9000
9071
|
}
|
|
@@ -9003,7 +9074,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
9003
9074
|
relativeFilePath,
|
|
9004
9075
|
validate = true
|
|
9005
9076
|
}) {
|
|
9006
|
-
const filePath =
|
|
9077
|
+
const filePath = join74(
|
|
9007
9078
|
process.cwd(),
|
|
9008
9079
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
9009
9080
|
relativeFilePath
|
|
@@ -9023,11 +9094,10 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
9023
9094
|
agentsmd: result.data.agentsmd,
|
|
9024
9095
|
cursor: result.data.cursor
|
|
9025
9096
|
};
|
|
9026
|
-
const filename = basename22(filePath);
|
|
9027
9097
|
return new _RulesyncRule({
|
|
9028
9098
|
baseDir: process.cwd(),
|
|
9029
9099
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
9030
|
-
relativeFilePath
|
|
9100
|
+
relativeFilePath,
|
|
9031
9101
|
frontmatter: validatedFrontmatter,
|
|
9032
9102
|
body: content.trim(),
|
|
9033
9103
|
validate
|
|
@@ -9106,7 +9176,7 @@ var ToolRule = class extends ToolFile {
|
|
|
9106
9176
|
rulesyncRule,
|
|
9107
9177
|
validate = true,
|
|
9108
9178
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
9109
|
-
nonRootPath = { relativeDirPath:
|
|
9179
|
+
nonRootPath = { relativeDirPath: join75(".agents", "memories") }
|
|
9110
9180
|
}) {
|
|
9111
9181
|
const params = this.buildToolRuleParamsDefault({
|
|
9112
9182
|
baseDir,
|
|
@@ -9117,7 +9187,7 @@ var ToolRule = class extends ToolFile {
|
|
|
9117
9187
|
});
|
|
9118
9188
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
9119
9189
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
9120
|
-
params.relativeDirPath =
|
|
9190
|
+
params.relativeDirPath = join75(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
9121
9191
|
params.relativeFilePath = "AGENTS.md";
|
|
9122
9192
|
}
|
|
9123
9193
|
return params;
|
|
@@ -9182,7 +9252,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9182
9252
|
relativeFilePath: "AGENTS.md"
|
|
9183
9253
|
},
|
|
9184
9254
|
nonRoot: {
|
|
9185
|
-
relativeDirPath:
|
|
9255
|
+
relativeDirPath: join76(".agents", "memories")
|
|
9186
9256
|
}
|
|
9187
9257
|
};
|
|
9188
9258
|
}
|
|
@@ -9192,8 +9262,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9192
9262
|
validate = true
|
|
9193
9263
|
}) {
|
|
9194
9264
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
9195
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
9196
|
-
const fileContent = await readFileContent(
|
|
9265
|
+
const relativePath = isRoot ? "AGENTS.md" : join76(".agents", "memories", relativeFilePath);
|
|
9266
|
+
const fileContent = await readFileContent(join76(baseDir, relativePath));
|
|
9197
9267
|
return new _AgentsMdRule({
|
|
9198
9268
|
baseDir,
|
|
9199
9269
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9248,7 +9318,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9248
9318
|
};
|
|
9249
9319
|
|
|
9250
9320
|
// src/features/rules/antigravity-rule.ts
|
|
9251
|
-
import { join as
|
|
9321
|
+
import { join as join77 } from "path";
|
|
9252
9322
|
import { z as z39 } from "zod/mini";
|
|
9253
9323
|
var AntigravityRuleFrontmatterSchema = z39.looseObject({
|
|
9254
9324
|
trigger: z39.optional(
|
|
@@ -9407,7 +9477,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9407
9477
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9408
9478
|
if (!result.success) {
|
|
9409
9479
|
throw new Error(
|
|
9410
|
-
`Invalid frontmatter in ${
|
|
9480
|
+
`Invalid frontmatter in ${join77(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9411
9481
|
);
|
|
9412
9482
|
}
|
|
9413
9483
|
}
|
|
@@ -9422,7 +9492,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9422
9492
|
static getSettablePaths() {
|
|
9423
9493
|
return {
|
|
9424
9494
|
nonRoot: {
|
|
9425
|
-
relativeDirPath:
|
|
9495
|
+
relativeDirPath: join77(".agent", "rules")
|
|
9426
9496
|
}
|
|
9427
9497
|
};
|
|
9428
9498
|
}
|
|
@@ -9431,7 +9501,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9431
9501
|
relativeFilePath,
|
|
9432
9502
|
validate = true
|
|
9433
9503
|
}) {
|
|
9434
|
-
const filePath =
|
|
9504
|
+
const filePath = join77(
|
|
9435
9505
|
baseDir,
|
|
9436
9506
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
9437
9507
|
relativeFilePath
|
|
@@ -9572,7 +9642,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9572
9642
|
};
|
|
9573
9643
|
|
|
9574
9644
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
9575
|
-
import { join as
|
|
9645
|
+
import { join as join78 } from "path";
|
|
9576
9646
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
9577
9647
|
toRulesyncRule() {
|
|
9578
9648
|
const rulesyncFrontmatter = {
|
|
@@ -9598,7 +9668,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9598
9668
|
relativeFilePath: ".augment-guidelines"
|
|
9599
9669
|
},
|
|
9600
9670
|
nonRoot: {
|
|
9601
|
-
relativeDirPath:
|
|
9671
|
+
relativeDirPath: join78(".augment", "rules")
|
|
9602
9672
|
}
|
|
9603
9673
|
};
|
|
9604
9674
|
}
|
|
@@ -9633,8 +9703,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9633
9703
|
}) {
|
|
9634
9704
|
const settablePaths = this.getSettablePaths();
|
|
9635
9705
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
9636
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
9637
|
-
const fileContent = await readFileContent(
|
|
9706
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join78(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9707
|
+
const fileContent = await readFileContent(join78(baseDir, relativePath));
|
|
9638
9708
|
return new _AugmentcodeLegacyRule({
|
|
9639
9709
|
baseDir,
|
|
9640
9710
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -9663,7 +9733,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9663
9733
|
};
|
|
9664
9734
|
|
|
9665
9735
|
// src/features/rules/augmentcode-rule.ts
|
|
9666
|
-
import { join as
|
|
9736
|
+
import { join as join79 } from "path";
|
|
9667
9737
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
9668
9738
|
toRulesyncRule() {
|
|
9669
9739
|
return this.toRulesyncRuleDefault();
|
|
@@ -9671,7 +9741,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9671
9741
|
static getSettablePaths() {
|
|
9672
9742
|
return {
|
|
9673
9743
|
nonRoot: {
|
|
9674
|
-
relativeDirPath:
|
|
9744
|
+
relativeDirPath: join79(".augment", "rules")
|
|
9675
9745
|
}
|
|
9676
9746
|
};
|
|
9677
9747
|
}
|
|
@@ -9695,7 +9765,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9695
9765
|
validate = true
|
|
9696
9766
|
}) {
|
|
9697
9767
|
const fileContent = await readFileContent(
|
|
9698
|
-
|
|
9768
|
+
join79(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9699
9769
|
);
|
|
9700
9770
|
const { body: content } = parseFrontmatter(fileContent);
|
|
9701
9771
|
return new _AugmentcodeRule({
|
|
@@ -9731,7 +9801,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9731
9801
|
};
|
|
9732
9802
|
|
|
9733
9803
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
9734
|
-
import { join as
|
|
9804
|
+
import { join as join80 } from "path";
|
|
9735
9805
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
9736
9806
|
static getSettablePaths({
|
|
9737
9807
|
global
|
|
@@ -9750,7 +9820,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9750
9820
|
relativeFilePath: "CLAUDE.md"
|
|
9751
9821
|
},
|
|
9752
9822
|
nonRoot: {
|
|
9753
|
-
relativeDirPath:
|
|
9823
|
+
relativeDirPath: join80(".claude", "memories")
|
|
9754
9824
|
}
|
|
9755
9825
|
};
|
|
9756
9826
|
}
|
|
@@ -9765,7 +9835,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9765
9835
|
if (isRoot) {
|
|
9766
9836
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9767
9837
|
const fileContent2 = await readFileContent(
|
|
9768
|
-
|
|
9838
|
+
join80(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9769
9839
|
);
|
|
9770
9840
|
return new _ClaudecodeLegacyRule({
|
|
9771
9841
|
baseDir,
|
|
@@ -9779,8 +9849,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9779
9849
|
if (!paths.nonRoot) {
|
|
9780
9850
|
throw new Error("nonRoot path is not set");
|
|
9781
9851
|
}
|
|
9782
|
-
const relativePath =
|
|
9783
|
-
const fileContent = await readFileContent(
|
|
9852
|
+
const relativePath = join80(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9853
|
+
const fileContent = await readFileContent(join80(baseDir, relativePath));
|
|
9784
9854
|
return new _ClaudecodeLegacyRule({
|
|
9785
9855
|
baseDir,
|
|
9786
9856
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9839,7 +9909,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9839
9909
|
};
|
|
9840
9910
|
|
|
9841
9911
|
// src/features/rules/claudecode-rule.ts
|
|
9842
|
-
import { join as
|
|
9912
|
+
import { join as join81 } from "path";
|
|
9843
9913
|
import { z as z40 } from "zod/mini";
|
|
9844
9914
|
var ClaudecodeRuleFrontmatterSchema = z40.object({
|
|
9845
9915
|
paths: z40.optional(z40.string())
|
|
@@ -9864,7 +9934,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9864
9934
|
relativeFilePath: "CLAUDE.md"
|
|
9865
9935
|
},
|
|
9866
9936
|
nonRoot: {
|
|
9867
|
-
relativeDirPath:
|
|
9937
|
+
relativeDirPath: join81(".claude", "rules")
|
|
9868
9938
|
}
|
|
9869
9939
|
};
|
|
9870
9940
|
}
|
|
@@ -9873,7 +9943,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9873
9943
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9874
9944
|
if (!result.success) {
|
|
9875
9945
|
throw new Error(
|
|
9876
|
-
`Invalid frontmatter in ${
|
|
9946
|
+
`Invalid frontmatter in ${join81(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9877
9947
|
);
|
|
9878
9948
|
}
|
|
9879
9949
|
}
|
|
@@ -9901,7 +9971,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9901
9971
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
9902
9972
|
if (isRoot) {
|
|
9903
9973
|
const fileContent2 = await readFileContent(
|
|
9904
|
-
|
|
9974
|
+
join81(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
9905
9975
|
);
|
|
9906
9976
|
return new _ClaudecodeRule({
|
|
9907
9977
|
baseDir,
|
|
@@ -9916,13 +9986,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9916
9986
|
if (!paths.nonRoot) {
|
|
9917
9987
|
throw new Error("nonRoot path is not set");
|
|
9918
9988
|
}
|
|
9919
|
-
const relativePath =
|
|
9920
|
-
const fileContent = await readFileContent(
|
|
9989
|
+
const relativePath = join81(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9990
|
+
const fileContent = await readFileContent(join81(baseDir, relativePath));
|
|
9921
9991
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9922
9992
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9923
9993
|
if (!result.success) {
|
|
9924
9994
|
throw new Error(
|
|
9925
|
-
`Invalid frontmatter in ${
|
|
9995
|
+
`Invalid frontmatter in ${join81(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
9926
9996
|
);
|
|
9927
9997
|
}
|
|
9928
9998
|
return new _ClaudecodeRule({
|
|
@@ -10029,7 +10099,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
10029
10099
|
return {
|
|
10030
10100
|
success: false,
|
|
10031
10101
|
error: new Error(
|
|
10032
|
-
`Invalid frontmatter in ${
|
|
10102
|
+
`Invalid frontmatter in ${join81(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10033
10103
|
)
|
|
10034
10104
|
};
|
|
10035
10105
|
}
|
|
@@ -10049,7 +10119,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
10049
10119
|
};
|
|
10050
10120
|
|
|
10051
10121
|
// src/features/rules/cline-rule.ts
|
|
10052
|
-
import { join as
|
|
10122
|
+
import { join as join82 } from "path";
|
|
10053
10123
|
import { z as z41 } from "zod/mini";
|
|
10054
10124
|
var ClineRuleFrontmatterSchema = z41.object({
|
|
10055
10125
|
description: z41.string()
|
|
@@ -10094,7 +10164,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
10094
10164
|
validate = true
|
|
10095
10165
|
}) {
|
|
10096
10166
|
const fileContent = await readFileContent(
|
|
10097
|
-
|
|
10167
|
+
join82(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10098
10168
|
);
|
|
10099
10169
|
return new _ClineRule({
|
|
10100
10170
|
baseDir,
|
|
@@ -10120,7 +10190,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
10120
10190
|
};
|
|
10121
10191
|
|
|
10122
10192
|
// src/features/rules/codexcli-rule.ts
|
|
10123
|
-
import { join as
|
|
10193
|
+
import { join as join83 } from "path";
|
|
10124
10194
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
10125
10195
|
static getSettablePaths({
|
|
10126
10196
|
global
|
|
@@ -10139,7 +10209,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10139
10209
|
relativeFilePath: "AGENTS.md"
|
|
10140
10210
|
},
|
|
10141
10211
|
nonRoot: {
|
|
10142
|
-
relativeDirPath:
|
|
10212
|
+
relativeDirPath: join83(".codex", "memories")
|
|
10143
10213
|
}
|
|
10144
10214
|
};
|
|
10145
10215
|
}
|
|
@@ -10154,7 +10224,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10154
10224
|
if (isRoot) {
|
|
10155
10225
|
const relativePath2 = paths.root.relativeFilePath;
|
|
10156
10226
|
const fileContent2 = await readFileContent(
|
|
10157
|
-
|
|
10227
|
+
join83(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
10158
10228
|
);
|
|
10159
10229
|
return new _CodexcliRule({
|
|
10160
10230
|
baseDir,
|
|
@@ -10168,8 +10238,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10168
10238
|
if (!paths.nonRoot) {
|
|
10169
10239
|
throw new Error("nonRoot path is not set");
|
|
10170
10240
|
}
|
|
10171
|
-
const relativePath =
|
|
10172
|
-
const fileContent = await readFileContent(
|
|
10241
|
+
const relativePath = join83(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10242
|
+
const fileContent = await readFileContent(join83(baseDir, relativePath));
|
|
10173
10243
|
return new _CodexcliRule({
|
|
10174
10244
|
baseDir,
|
|
10175
10245
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10228,7 +10298,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10228
10298
|
};
|
|
10229
10299
|
|
|
10230
10300
|
// src/features/rules/copilot-rule.ts
|
|
10231
|
-
import { join as
|
|
10301
|
+
import { join as join84 } from "path";
|
|
10232
10302
|
import { z as z42 } from "zod/mini";
|
|
10233
10303
|
var CopilotRuleFrontmatterSchema = z42.object({
|
|
10234
10304
|
description: z42.optional(z42.string()),
|
|
@@ -10245,7 +10315,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10245
10315
|
relativeFilePath: "copilot-instructions.md"
|
|
10246
10316
|
},
|
|
10247
10317
|
nonRoot: {
|
|
10248
|
-
relativeDirPath:
|
|
10318
|
+
relativeDirPath: join84(".github", "instructions")
|
|
10249
10319
|
}
|
|
10250
10320
|
};
|
|
10251
10321
|
}
|
|
@@ -10254,7 +10324,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10254
10324
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10255
10325
|
if (!result.success) {
|
|
10256
10326
|
throw new Error(
|
|
10257
|
-
`Invalid frontmatter in ${
|
|
10327
|
+
`Invalid frontmatter in ${join84(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10258
10328
|
);
|
|
10259
10329
|
}
|
|
10260
10330
|
}
|
|
@@ -10336,11 +10406,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10336
10406
|
validate = true
|
|
10337
10407
|
}) {
|
|
10338
10408
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
10339
|
-
const relativePath = isRoot ?
|
|
10409
|
+
const relativePath = isRoot ? join84(
|
|
10340
10410
|
this.getSettablePaths().root.relativeDirPath,
|
|
10341
10411
|
this.getSettablePaths().root.relativeFilePath
|
|
10342
|
-
) :
|
|
10343
|
-
const fileContent = await readFileContent(
|
|
10412
|
+
) : join84(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10413
|
+
const fileContent = await readFileContent(join84(baseDir, relativePath));
|
|
10344
10414
|
if (isRoot) {
|
|
10345
10415
|
return new _CopilotRule({
|
|
10346
10416
|
baseDir,
|
|
@@ -10356,7 +10426,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10356
10426
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10357
10427
|
if (!result.success) {
|
|
10358
10428
|
throw new Error(
|
|
10359
|
-
`Invalid frontmatter in ${
|
|
10429
|
+
`Invalid frontmatter in ${join84(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10360
10430
|
);
|
|
10361
10431
|
}
|
|
10362
10432
|
return new _CopilotRule({
|
|
@@ -10396,7 +10466,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10396
10466
|
return {
|
|
10397
10467
|
success: false,
|
|
10398
10468
|
error: new Error(
|
|
10399
|
-
`Invalid frontmatter in ${
|
|
10469
|
+
`Invalid frontmatter in ${join84(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10400
10470
|
)
|
|
10401
10471
|
};
|
|
10402
10472
|
}
|
|
@@ -10416,7 +10486,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10416
10486
|
};
|
|
10417
10487
|
|
|
10418
10488
|
// src/features/rules/cursor-rule.ts
|
|
10419
|
-
import {
|
|
10489
|
+
import { join as join85 } from "path";
|
|
10420
10490
|
import { z as z43 } from "zod/mini";
|
|
10421
10491
|
var CursorRuleFrontmatterSchema = z43.object({
|
|
10422
10492
|
description: z43.optional(z43.string()),
|
|
@@ -10429,7 +10499,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10429
10499
|
static getSettablePaths() {
|
|
10430
10500
|
return {
|
|
10431
10501
|
nonRoot: {
|
|
10432
|
-
relativeDirPath:
|
|
10502
|
+
relativeDirPath: join85(".cursor", "rules")
|
|
10433
10503
|
}
|
|
10434
10504
|
};
|
|
10435
10505
|
}
|
|
@@ -10438,7 +10508,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10438
10508
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10439
10509
|
if (!result.success) {
|
|
10440
10510
|
throw new Error(
|
|
10441
|
-
`Invalid frontmatter in ${
|
|
10511
|
+
`Invalid frontmatter in ${join85(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10442
10512
|
);
|
|
10443
10513
|
}
|
|
10444
10514
|
}
|
|
@@ -10555,19 +10625,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10555
10625
|
validate = true
|
|
10556
10626
|
}) {
|
|
10557
10627
|
const fileContent = await readFileContent(
|
|
10558
|
-
|
|
10628
|
+
join85(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10559
10629
|
);
|
|
10560
10630
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
10561
10631
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10562
10632
|
if (!result.success) {
|
|
10563
10633
|
throw new Error(
|
|
10564
|
-
`Invalid frontmatter in ${
|
|
10634
|
+
`Invalid frontmatter in ${join85(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10565
10635
|
);
|
|
10566
10636
|
}
|
|
10567
10637
|
return new _CursorRule({
|
|
10568
10638
|
baseDir,
|
|
10569
10639
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
10570
|
-
relativeFilePath
|
|
10640
|
+
relativeFilePath,
|
|
10571
10641
|
frontmatter: result.data,
|
|
10572
10642
|
body: content.trim(),
|
|
10573
10643
|
validate
|
|
@@ -10598,7 +10668,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10598
10668
|
return {
|
|
10599
10669
|
success: false,
|
|
10600
10670
|
error: new Error(
|
|
10601
|
-
`Invalid frontmatter in ${
|
|
10671
|
+
`Invalid frontmatter in ${join85(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10602
10672
|
)
|
|
10603
10673
|
};
|
|
10604
10674
|
}
|
|
@@ -10618,7 +10688,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10618
10688
|
};
|
|
10619
10689
|
|
|
10620
10690
|
// src/features/rules/geminicli-rule.ts
|
|
10621
|
-
import { join as
|
|
10691
|
+
import { join as join86 } from "path";
|
|
10622
10692
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
10623
10693
|
static getSettablePaths({
|
|
10624
10694
|
global
|
|
@@ -10637,7 +10707,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10637
10707
|
relativeFilePath: "GEMINI.md"
|
|
10638
10708
|
},
|
|
10639
10709
|
nonRoot: {
|
|
10640
|
-
relativeDirPath:
|
|
10710
|
+
relativeDirPath: join86(".gemini", "memories")
|
|
10641
10711
|
}
|
|
10642
10712
|
};
|
|
10643
10713
|
}
|
|
@@ -10652,7 +10722,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10652
10722
|
if (isRoot) {
|
|
10653
10723
|
const relativePath2 = paths.root.relativeFilePath;
|
|
10654
10724
|
const fileContent2 = await readFileContent(
|
|
10655
|
-
|
|
10725
|
+
join86(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
10656
10726
|
);
|
|
10657
10727
|
return new _GeminiCliRule({
|
|
10658
10728
|
baseDir,
|
|
@@ -10666,8 +10736,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10666
10736
|
if (!paths.nonRoot) {
|
|
10667
10737
|
throw new Error("nonRoot path is not set");
|
|
10668
10738
|
}
|
|
10669
|
-
const relativePath =
|
|
10670
|
-
const fileContent = await readFileContent(
|
|
10739
|
+
const relativePath = join86(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10740
|
+
const fileContent = await readFileContent(join86(baseDir, relativePath));
|
|
10671
10741
|
return new _GeminiCliRule({
|
|
10672
10742
|
baseDir,
|
|
10673
10743
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10726,7 +10796,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10726
10796
|
};
|
|
10727
10797
|
|
|
10728
10798
|
// src/features/rules/junie-rule.ts
|
|
10729
|
-
import { join as
|
|
10799
|
+
import { join as join87 } from "path";
|
|
10730
10800
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
10731
10801
|
static getSettablePaths() {
|
|
10732
10802
|
return {
|
|
@@ -10735,7 +10805,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10735
10805
|
relativeFilePath: "guidelines.md"
|
|
10736
10806
|
},
|
|
10737
10807
|
nonRoot: {
|
|
10738
|
-
relativeDirPath:
|
|
10808
|
+
relativeDirPath: join87(".junie", "memories")
|
|
10739
10809
|
}
|
|
10740
10810
|
};
|
|
10741
10811
|
}
|
|
@@ -10745,8 +10815,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10745
10815
|
validate = true
|
|
10746
10816
|
}) {
|
|
10747
10817
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
10748
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
10749
|
-
const fileContent = await readFileContent(
|
|
10818
|
+
const relativePath = isRoot ? "guidelines.md" : join87(".junie", "memories", relativeFilePath);
|
|
10819
|
+
const fileContent = await readFileContent(join87(baseDir, relativePath));
|
|
10750
10820
|
return new _JunieRule({
|
|
10751
10821
|
baseDir,
|
|
10752
10822
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10801,12 +10871,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10801
10871
|
};
|
|
10802
10872
|
|
|
10803
10873
|
// src/features/rules/kilo-rule.ts
|
|
10804
|
-
import { join as
|
|
10874
|
+
import { join as join88 } from "path";
|
|
10805
10875
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
10806
10876
|
static getSettablePaths(_options = {}) {
|
|
10807
10877
|
return {
|
|
10808
10878
|
nonRoot: {
|
|
10809
|
-
relativeDirPath:
|
|
10879
|
+
relativeDirPath: join88(".kilocode", "rules")
|
|
10810
10880
|
}
|
|
10811
10881
|
};
|
|
10812
10882
|
}
|
|
@@ -10816,7 +10886,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10816
10886
|
validate = true
|
|
10817
10887
|
}) {
|
|
10818
10888
|
const fileContent = await readFileContent(
|
|
10819
|
-
|
|
10889
|
+
join88(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10820
10890
|
);
|
|
10821
10891
|
return new _KiloRule({
|
|
10822
10892
|
baseDir,
|
|
@@ -10868,12 +10938,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10868
10938
|
};
|
|
10869
10939
|
|
|
10870
10940
|
// src/features/rules/kiro-rule.ts
|
|
10871
|
-
import { join as
|
|
10941
|
+
import { join as join89 } from "path";
|
|
10872
10942
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
10873
10943
|
static getSettablePaths() {
|
|
10874
10944
|
return {
|
|
10875
10945
|
nonRoot: {
|
|
10876
|
-
relativeDirPath:
|
|
10946
|
+
relativeDirPath: join89(".kiro", "steering")
|
|
10877
10947
|
}
|
|
10878
10948
|
};
|
|
10879
10949
|
}
|
|
@@ -10883,7 +10953,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10883
10953
|
validate = true
|
|
10884
10954
|
}) {
|
|
10885
10955
|
const fileContent = await readFileContent(
|
|
10886
|
-
|
|
10956
|
+
join89(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10887
10957
|
);
|
|
10888
10958
|
return new _KiroRule({
|
|
10889
10959
|
baseDir,
|
|
@@ -10937,7 +11007,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10937
11007
|
};
|
|
10938
11008
|
|
|
10939
11009
|
// src/features/rules/opencode-rule.ts
|
|
10940
|
-
import { join as
|
|
11010
|
+
import { join as join90 } from "path";
|
|
10941
11011
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
10942
11012
|
static getSettablePaths() {
|
|
10943
11013
|
return {
|
|
@@ -10946,7 +11016,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10946
11016
|
relativeFilePath: "AGENTS.md"
|
|
10947
11017
|
},
|
|
10948
11018
|
nonRoot: {
|
|
10949
|
-
relativeDirPath:
|
|
11019
|
+
relativeDirPath: join90(".opencode", "memories")
|
|
10950
11020
|
}
|
|
10951
11021
|
};
|
|
10952
11022
|
}
|
|
@@ -10956,8 +11026,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10956
11026
|
validate = true
|
|
10957
11027
|
}) {
|
|
10958
11028
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
10959
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
10960
|
-
const fileContent = await readFileContent(
|
|
11029
|
+
const relativePath = isRoot ? "AGENTS.md" : join90(".opencode", "memories", relativeFilePath);
|
|
11030
|
+
const fileContent = await readFileContent(join90(baseDir, relativePath));
|
|
10961
11031
|
return new _OpenCodeRule({
|
|
10962
11032
|
baseDir,
|
|
10963
11033
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -11012,7 +11082,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
11012
11082
|
};
|
|
11013
11083
|
|
|
11014
11084
|
// src/features/rules/qwencode-rule.ts
|
|
11015
|
-
import { join as
|
|
11085
|
+
import { join as join91 } from "path";
|
|
11016
11086
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
11017
11087
|
static getSettablePaths() {
|
|
11018
11088
|
return {
|
|
@@ -11021,7 +11091,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
11021
11091
|
relativeFilePath: "QWEN.md"
|
|
11022
11092
|
},
|
|
11023
11093
|
nonRoot: {
|
|
11024
|
-
relativeDirPath:
|
|
11094
|
+
relativeDirPath: join91(".qwen", "memories")
|
|
11025
11095
|
}
|
|
11026
11096
|
};
|
|
11027
11097
|
}
|
|
@@ -11031,8 +11101,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
11031
11101
|
validate = true
|
|
11032
11102
|
}) {
|
|
11033
11103
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
11034
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
11035
|
-
const fileContent = await readFileContent(
|
|
11104
|
+
const relativePath = isRoot ? "QWEN.md" : join91(".qwen", "memories", relativeFilePath);
|
|
11105
|
+
const fileContent = await readFileContent(join91(baseDir, relativePath));
|
|
11036
11106
|
return new _QwencodeRule({
|
|
11037
11107
|
baseDir,
|
|
11038
11108
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -11084,7 +11154,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
11084
11154
|
};
|
|
11085
11155
|
|
|
11086
11156
|
// src/features/rules/replit-rule.ts
|
|
11087
|
-
import { join as
|
|
11157
|
+
import { join as join92 } from "path";
|
|
11088
11158
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
11089
11159
|
static getSettablePaths() {
|
|
11090
11160
|
return {
|
|
@@ -11106,7 +11176,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
11106
11176
|
}
|
|
11107
11177
|
const relativePath = paths.root.relativeFilePath;
|
|
11108
11178
|
const fileContent = await readFileContent(
|
|
11109
|
-
|
|
11179
|
+
join92(baseDir, paths.root.relativeDirPath, relativePath)
|
|
11110
11180
|
);
|
|
11111
11181
|
return new _ReplitRule({
|
|
11112
11182
|
baseDir,
|
|
@@ -11172,12 +11242,12 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
11172
11242
|
};
|
|
11173
11243
|
|
|
11174
11244
|
// src/features/rules/roo-rule.ts
|
|
11175
|
-
import { join as
|
|
11245
|
+
import { join as join93 } from "path";
|
|
11176
11246
|
var RooRule = class _RooRule extends ToolRule {
|
|
11177
11247
|
static getSettablePaths() {
|
|
11178
11248
|
return {
|
|
11179
11249
|
nonRoot: {
|
|
11180
|
-
relativeDirPath:
|
|
11250
|
+
relativeDirPath: join93(".roo", "rules")
|
|
11181
11251
|
}
|
|
11182
11252
|
};
|
|
11183
11253
|
}
|
|
@@ -11187,7 +11257,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
11187
11257
|
validate = true
|
|
11188
11258
|
}) {
|
|
11189
11259
|
const fileContent = await readFileContent(
|
|
11190
|
-
|
|
11260
|
+
join93(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11191
11261
|
);
|
|
11192
11262
|
return new _RooRule({
|
|
11193
11263
|
baseDir,
|
|
@@ -11256,7 +11326,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
11256
11326
|
};
|
|
11257
11327
|
|
|
11258
11328
|
// src/features/rules/warp-rule.ts
|
|
11259
|
-
import { join as
|
|
11329
|
+
import { join as join94 } from "path";
|
|
11260
11330
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
11261
11331
|
constructor({ fileContent, root, ...rest }) {
|
|
11262
11332
|
super({
|
|
@@ -11272,7 +11342,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11272
11342
|
relativeFilePath: "WARP.md"
|
|
11273
11343
|
},
|
|
11274
11344
|
nonRoot: {
|
|
11275
|
-
relativeDirPath:
|
|
11345
|
+
relativeDirPath: join94(".warp", "memories")
|
|
11276
11346
|
}
|
|
11277
11347
|
};
|
|
11278
11348
|
}
|
|
@@ -11282,8 +11352,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11282
11352
|
validate = true
|
|
11283
11353
|
}) {
|
|
11284
11354
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
11285
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
11286
|
-
const fileContent = await readFileContent(
|
|
11355
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join94(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
11356
|
+
const fileContent = await readFileContent(join94(baseDir, relativePath));
|
|
11287
11357
|
return new _WarpRule({
|
|
11288
11358
|
baseDir,
|
|
11289
11359
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -11338,12 +11408,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11338
11408
|
};
|
|
11339
11409
|
|
|
11340
11410
|
// src/features/rules/windsurf-rule.ts
|
|
11341
|
-
import { join as
|
|
11411
|
+
import { join as join95 } from "path";
|
|
11342
11412
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
11343
11413
|
static getSettablePaths() {
|
|
11344
11414
|
return {
|
|
11345
11415
|
nonRoot: {
|
|
11346
|
-
relativeDirPath:
|
|
11416
|
+
relativeDirPath: join95(".windsurf", "rules")
|
|
11347
11417
|
}
|
|
11348
11418
|
};
|
|
11349
11419
|
}
|
|
@@ -11353,7 +11423,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
11353
11423
|
validate = true
|
|
11354
11424
|
}) {
|
|
11355
11425
|
const fileContent = await readFileContent(
|
|
11356
|
-
|
|
11426
|
+
join95(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11357
11427
|
);
|
|
11358
11428
|
return new _WindsurfRule({
|
|
11359
11429
|
baseDir,
|
|
@@ -11726,7 +11796,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11726
11796
|
}).relativeDirPath;
|
|
11727
11797
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
11728
11798
|
const frontmatter = skill.getFrontmatter();
|
|
11729
|
-
const relativePath =
|
|
11799
|
+
const relativePath = join96(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
11730
11800
|
return {
|
|
11731
11801
|
name: frontmatter.name,
|
|
11732
11802
|
description: frontmatter.description,
|
|
@@ -11837,10 +11907,17 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11837
11907
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
11838
11908
|
*/
|
|
11839
11909
|
async loadRulesyncFiles() {
|
|
11840
|
-
const
|
|
11910
|
+
const rulesyncBaseDir = join96(this.baseDir, RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
11911
|
+
const files = await findFilesByGlobs(join96(rulesyncBaseDir, "**", "*.md"));
|
|
11841
11912
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
11842
11913
|
const rulesyncRules = await Promise.all(
|
|
11843
|
-
files.map((file) =>
|
|
11914
|
+
files.map((file) => {
|
|
11915
|
+
const relativeFilePath = relative4(rulesyncBaseDir, file);
|
|
11916
|
+
checkPathTraversal({ relativePath: relativeFilePath, intendedRootDir: rulesyncBaseDir });
|
|
11917
|
+
return RulesyncRule.fromFile({
|
|
11918
|
+
relativeFilePath
|
|
11919
|
+
});
|
|
11920
|
+
})
|
|
11844
11921
|
);
|
|
11845
11922
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
11846
11923
|
if (rootRules.length > 1) {
|
|
@@ -11889,7 +11966,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11889
11966
|
return [];
|
|
11890
11967
|
}
|
|
11891
11968
|
const rootFilePaths = await findFilesByGlobs(
|
|
11892
|
-
|
|
11969
|
+
join96(
|
|
11893
11970
|
this.baseDir,
|
|
11894
11971
|
settablePaths.root.relativeDirPath ?? ".",
|
|
11895
11972
|
settablePaths.root.relativeFilePath
|
|
@@ -11900,7 +11977,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11900
11977
|
(filePath) => factory.class.forDeletion({
|
|
11901
11978
|
baseDir: this.baseDir,
|
|
11902
11979
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
11903
|
-
relativeFilePath:
|
|
11980
|
+
relativeFilePath: basename22(filePath),
|
|
11904
11981
|
global: this.global
|
|
11905
11982
|
})
|
|
11906
11983
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11909,7 +11986,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11909
11986
|
rootFilePaths.map(
|
|
11910
11987
|
(filePath) => factory.class.fromFile({
|
|
11911
11988
|
baseDir: this.baseDir,
|
|
11912
|
-
relativeFilePath:
|
|
11989
|
+
relativeFilePath: basename22(filePath),
|
|
11913
11990
|
global: this.global
|
|
11914
11991
|
})
|
|
11915
11992
|
)
|
|
@@ -11927,13 +12004,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11927
12004
|
return [];
|
|
11928
12005
|
}
|
|
11929
12006
|
const localRootFilePaths = await findFilesByGlobs(
|
|
11930
|
-
|
|
12007
|
+
join96(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md")
|
|
11931
12008
|
);
|
|
11932
12009
|
return localRootFilePaths.map(
|
|
11933
12010
|
(filePath) => factory.class.forDeletion({
|
|
11934
12011
|
baseDir: this.baseDir,
|
|
11935
12012
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
11936
|
-
relativeFilePath:
|
|
12013
|
+
relativeFilePath: basename22(filePath),
|
|
11937
12014
|
global: this.global
|
|
11938
12015
|
})
|
|
11939
12016
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11943,27 +12020,35 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11943
12020
|
if (!settablePaths.nonRoot) {
|
|
11944
12021
|
return [];
|
|
11945
12022
|
}
|
|
12023
|
+
const nonRootBaseDir = join96(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
11946
12024
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
11947
|
-
|
|
12025
|
+
join96(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
11948
12026
|
);
|
|
11949
12027
|
if (forDeletion) {
|
|
11950
|
-
return nonRootFilePaths.map(
|
|
11951
|
-
(filePath)
|
|
12028
|
+
return nonRootFilePaths.map((filePath) => {
|
|
12029
|
+
const relativeFilePath = relative4(nonRootBaseDir, filePath);
|
|
12030
|
+
checkPathTraversal({
|
|
12031
|
+
relativePath: relativeFilePath,
|
|
12032
|
+
intendedRootDir: nonRootBaseDir
|
|
12033
|
+
});
|
|
12034
|
+
return factory.class.forDeletion({
|
|
11952
12035
|
baseDir: this.baseDir,
|
|
11953
12036
|
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
11954
|
-
relativeFilePath
|
|
12037
|
+
relativeFilePath,
|
|
11955
12038
|
global: this.global
|
|
11956
|
-
})
|
|
11957
|
-
).filter((rule) => rule.isDeletable());
|
|
12039
|
+
});
|
|
12040
|
+
}).filter((rule) => rule.isDeletable());
|
|
11958
12041
|
}
|
|
11959
12042
|
return await Promise.all(
|
|
11960
|
-
nonRootFilePaths.map(
|
|
11961
|
-
(filePath)
|
|
12043
|
+
nonRootFilePaths.map((filePath) => {
|
|
12044
|
+
const relativeFilePath = relative4(nonRootBaseDir, filePath);
|
|
12045
|
+
checkPathTraversal({ relativePath: relativeFilePath, intendedRootDir: nonRootBaseDir });
|
|
12046
|
+
return factory.class.fromFile({
|
|
11962
12047
|
baseDir: this.baseDir,
|
|
11963
|
-
relativeFilePath
|
|
12048
|
+
relativeFilePath,
|
|
11964
12049
|
global: this.global
|
|
11965
|
-
})
|
|
11966
|
-
)
|
|
12050
|
+
});
|
|
12051
|
+
})
|
|
11967
12052
|
);
|
|
11968
12053
|
})();
|
|
11969
12054
|
logger.debug(`Found ${nonRootToolRules.length} non-root tool rule files`);
|
|
@@ -12053,14 +12138,14 @@ s/<command> [arguments]
|
|
|
12053
12138
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
12054
12139
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
12055
12140
|
|
|
12056
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
12141
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join96(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
12057
12142
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
12058
12143
|
|
|
12059
12144
|
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.
|
|
12060
12145
|
|
|
12061
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
12146
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join96(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
12062
12147
|
|
|
12063
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
12148
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join96(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
12064
12149
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
12065
12150
|
const result = [
|
|
12066
12151
|
overview,
|
|
@@ -12089,7 +12174,7 @@ ${toonContent}`;
|
|
|
12089
12174
|
|
|
12090
12175
|
// src/lib/generate.ts
|
|
12091
12176
|
async function checkRulesyncDirExists(params) {
|
|
12092
|
-
return fileExists(
|
|
12177
|
+
return fileExists(join97(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
12093
12178
|
}
|
|
12094
12179
|
async function generate(params) {
|
|
12095
12180
|
const { config } = params;
|
|
@@ -12382,7 +12467,7 @@ async function generateCommand(options) {
|
|
|
12382
12467
|
}
|
|
12383
12468
|
|
|
12384
12469
|
// src/cli/commands/gitignore.ts
|
|
12385
|
-
import { join as
|
|
12470
|
+
import { join as join98 } from "path";
|
|
12386
12471
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
12387
12472
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
12388
12473
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -12474,6 +12559,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
12474
12559
|
// Others
|
|
12475
12560
|
"**/modular-mcp.json",
|
|
12476
12561
|
".rulesync/rules/*.local.md",
|
|
12562
|
+
"rulesync.local.jsonc",
|
|
12477
12563
|
"!.rulesync/.aiignore"
|
|
12478
12564
|
];
|
|
12479
12565
|
var isRulesyncHeader = (line) => {
|
|
@@ -12526,7 +12612,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
12526
12612
|
return result;
|
|
12527
12613
|
};
|
|
12528
12614
|
var gitignoreCommand = async () => {
|
|
12529
|
-
const gitignorePath =
|
|
12615
|
+
const gitignorePath = join98(process.cwd(), ".gitignore");
|
|
12530
12616
|
let gitignoreContent = "";
|
|
12531
12617
|
if (await fileExists(gitignorePath)) {
|
|
12532
12618
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -12728,7 +12814,7 @@ async function importSkills(config, tool) {
|
|
|
12728
12814
|
}
|
|
12729
12815
|
|
|
12730
12816
|
// src/cli/commands/init.ts
|
|
12731
|
-
import { join as
|
|
12817
|
+
import { join as join99 } from "path";
|
|
12732
12818
|
async function initCommand() {
|
|
12733
12819
|
logger.info("Initializing rulesync...");
|
|
12734
12820
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -12755,6 +12841,7 @@ async function createConfigFile() {
|
|
|
12755
12841
|
baseDirs: ["."],
|
|
12756
12842
|
delete: true,
|
|
12757
12843
|
verbose: false,
|
|
12844
|
+
silent: false,
|
|
12758
12845
|
global: false,
|
|
12759
12846
|
simulateCommands: false,
|
|
12760
12847
|
simulateSubagents: false,
|
|
@@ -12906,14 +12993,14 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12906
12993
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
12907
12994
|
await ensureDir(skillPaths.relativeDirPath);
|
|
12908
12995
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
12909
|
-
const ruleFilepath =
|
|
12996
|
+
const ruleFilepath = join99(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
12910
12997
|
if (!await fileExists(ruleFilepath)) {
|
|
12911
12998
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
12912
12999
|
logger.success(`Created ${ruleFilepath}`);
|
|
12913
13000
|
} else {
|
|
12914
13001
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
12915
13002
|
}
|
|
12916
|
-
const mcpFilepath =
|
|
13003
|
+
const mcpFilepath = join99(
|
|
12917
13004
|
mcpPaths.recommended.relativeDirPath,
|
|
12918
13005
|
mcpPaths.recommended.relativeFilePath
|
|
12919
13006
|
);
|
|
@@ -12923,30 +13010,30 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12923
13010
|
} else {
|
|
12924
13011
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
12925
13012
|
}
|
|
12926
|
-
const commandFilepath =
|
|
13013
|
+
const commandFilepath = join99(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
12927
13014
|
if (!await fileExists(commandFilepath)) {
|
|
12928
13015
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
12929
13016
|
logger.success(`Created ${commandFilepath}`);
|
|
12930
13017
|
} else {
|
|
12931
13018
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
12932
13019
|
}
|
|
12933
|
-
const subagentFilepath =
|
|
13020
|
+
const subagentFilepath = join99(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
12934
13021
|
if (!await fileExists(subagentFilepath)) {
|
|
12935
13022
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
12936
13023
|
logger.success(`Created ${subagentFilepath}`);
|
|
12937
13024
|
} else {
|
|
12938
13025
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
12939
13026
|
}
|
|
12940
|
-
const skillDirPath =
|
|
13027
|
+
const skillDirPath = join99(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
12941
13028
|
await ensureDir(skillDirPath);
|
|
12942
|
-
const skillFilepath =
|
|
13029
|
+
const skillFilepath = join99(skillDirPath, SKILL_FILE_NAME);
|
|
12943
13030
|
if (!await fileExists(skillFilepath)) {
|
|
12944
13031
|
await writeFileContent(skillFilepath, sampleSkillFile.content);
|
|
12945
13032
|
logger.success(`Created ${skillFilepath}`);
|
|
12946
13033
|
} else {
|
|
12947
13034
|
logger.info(`Skipped ${skillFilepath} (already exists)`);
|
|
12948
13035
|
}
|
|
12949
|
-
const ignoreFilepath =
|
|
13036
|
+
const ignoreFilepath = join99(
|
|
12950
13037
|
ignorePaths.recommended.relativeDirPath,
|
|
12951
13038
|
ignorePaths.recommended.relativeFilePath
|
|
12952
13039
|
);
|
|
@@ -12965,12 +13052,12 @@ import { FastMCP } from "fastmcp";
|
|
|
12965
13052
|
import { z as z51 } from "zod/mini";
|
|
12966
13053
|
|
|
12967
13054
|
// src/mcp/commands.ts
|
|
12968
|
-
import { basename as
|
|
13055
|
+
import { basename as basename23, join as join100 } from "path";
|
|
12969
13056
|
import { z as z45 } from "zod/mini";
|
|
12970
13057
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
12971
13058
|
var maxCommandsCount = 1e3;
|
|
12972
13059
|
async function listCommands() {
|
|
12973
|
-
const commandsDir =
|
|
13060
|
+
const commandsDir = join100(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12974
13061
|
try {
|
|
12975
13062
|
const files = await listDirectoryFiles(commandsDir);
|
|
12976
13063
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12982,7 +13069,7 @@ async function listCommands() {
|
|
|
12982
13069
|
});
|
|
12983
13070
|
const frontmatter = command.getFrontmatter();
|
|
12984
13071
|
return {
|
|
12985
|
-
relativePathFromCwd:
|
|
13072
|
+
relativePathFromCwd: join100(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
12986
13073
|
frontmatter
|
|
12987
13074
|
};
|
|
12988
13075
|
} catch (error) {
|
|
@@ -13002,13 +13089,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
13002
13089
|
relativePath: relativePathFromCwd,
|
|
13003
13090
|
intendedRootDir: process.cwd()
|
|
13004
13091
|
});
|
|
13005
|
-
const filename =
|
|
13092
|
+
const filename = basename23(relativePathFromCwd);
|
|
13006
13093
|
try {
|
|
13007
13094
|
const command = await RulesyncCommand.fromFile({
|
|
13008
13095
|
relativeFilePath: filename
|
|
13009
13096
|
});
|
|
13010
13097
|
return {
|
|
13011
|
-
relativePathFromCwd:
|
|
13098
|
+
relativePathFromCwd: join100(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
13012
13099
|
frontmatter: command.getFrontmatter(),
|
|
13013
13100
|
body: command.getBody()
|
|
13014
13101
|
};
|
|
@@ -13027,7 +13114,7 @@ async function putCommand({
|
|
|
13027
13114
|
relativePath: relativePathFromCwd,
|
|
13028
13115
|
intendedRootDir: process.cwd()
|
|
13029
13116
|
});
|
|
13030
|
-
const filename =
|
|
13117
|
+
const filename = basename23(relativePathFromCwd);
|
|
13031
13118
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
13032
13119
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
13033
13120
|
throw new Error(
|
|
@@ -13037,7 +13124,7 @@ async function putCommand({
|
|
|
13037
13124
|
try {
|
|
13038
13125
|
const existingCommands = await listCommands();
|
|
13039
13126
|
const isUpdate = existingCommands.some(
|
|
13040
|
-
(command2) => command2.relativePathFromCwd ===
|
|
13127
|
+
(command2) => command2.relativePathFromCwd === join100(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
13041
13128
|
);
|
|
13042
13129
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
13043
13130
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -13052,11 +13139,11 @@ async function putCommand({
|
|
|
13052
13139
|
fileContent,
|
|
13053
13140
|
validate: true
|
|
13054
13141
|
});
|
|
13055
|
-
const commandsDir =
|
|
13142
|
+
const commandsDir = join100(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
13056
13143
|
await ensureDir(commandsDir);
|
|
13057
13144
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
13058
13145
|
return {
|
|
13059
|
-
relativePathFromCwd:
|
|
13146
|
+
relativePathFromCwd: join100(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
13060
13147
|
frontmatter: command.getFrontmatter(),
|
|
13061
13148
|
body: command.getBody()
|
|
13062
13149
|
};
|
|
@@ -13071,12 +13158,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
13071
13158
|
relativePath: relativePathFromCwd,
|
|
13072
13159
|
intendedRootDir: process.cwd()
|
|
13073
13160
|
});
|
|
13074
|
-
const filename =
|
|
13075
|
-
const fullPath =
|
|
13161
|
+
const filename = basename23(relativePathFromCwd);
|
|
13162
|
+
const fullPath = join100(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
13076
13163
|
try {
|
|
13077
13164
|
await removeFile(fullPath);
|
|
13078
13165
|
return {
|
|
13079
|
-
relativePathFromCwd:
|
|
13166
|
+
relativePathFromCwd: join100(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
13080
13167
|
};
|
|
13081
13168
|
} catch (error) {
|
|
13082
13169
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -13101,7 +13188,7 @@ var commandToolSchemas = {
|
|
|
13101
13188
|
var commandTools = {
|
|
13102
13189
|
listCommands: {
|
|
13103
13190
|
name: "listCommands",
|
|
13104
|
-
description: `List all commands from ${
|
|
13191
|
+
description: `List all commands from ${join100(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13105
13192
|
parameters: commandToolSchemas.listCommands,
|
|
13106
13193
|
execute: async () => {
|
|
13107
13194
|
const commands = await listCommands();
|
|
@@ -13143,11 +13230,11 @@ var commandTools = {
|
|
|
13143
13230
|
};
|
|
13144
13231
|
|
|
13145
13232
|
// src/mcp/ignore.ts
|
|
13146
|
-
import { join as
|
|
13233
|
+
import { join as join101 } from "path";
|
|
13147
13234
|
import { z as z46 } from "zod/mini";
|
|
13148
13235
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
13149
13236
|
async function getIgnoreFile() {
|
|
13150
|
-
const ignoreFilePath =
|
|
13237
|
+
const ignoreFilePath = join101(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
13151
13238
|
try {
|
|
13152
13239
|
const content = await readFileContent(ignoreFilePath);
|
|
13153
13240
|
return {
|
|
@@ -13161,7 +13248,7 @@ async function getIgnoreFile() {
|
|
|
13161
13248
|
}
|
|
13162
13249
|
}
|
|
13163
13250
|
async function putIgnoreFile({ content }) {
|
|
13164
|
-
const ignoreFilePath =
|
|
13251
|
+
const ignoreFilePath = join101(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
13165
13252
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
13166
13253
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
13167
13254
|
throw new Error(
|
|
@@ -13182,8 +13269,8 @@ async function putIgnoreFile({ content }) {
|
|
|
13182
13269
|
}
|
|
13183
13270
|
}
|
|
13184
13271
|
async function deleteIgnoreFile() {
|
|
13185
|
-
const aiignorePath =
|
|
13186
|
-
const legacyIgnorePath =
|
|
13272
|
+
const aiignorePath = join101(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
13273
|
+
const legacyIgnorePath = join101(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
13187
13274
|
try {
|
|
13188
13275
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
13189
13276
|
return {
|
|
@@ -13238,7 +13325,7 @@ var ignoreTools = {
|
|
|
13238
13325
|
};
|
|
13239
13326
|
|
|
13240
13327
|
// src/mcp/mcp.ts
|
|
13241
|
-
import { join as
|
|
13328
|
+
import { join as join102 } from "path";
|
|
13242
13329
|
import { z as z47 } from "zod/mini";
|
|
13243
13330
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
13244
13331
|
async function getMcpFile() {
|
|
@@ -13248,7 +13335,7 @@ async function getMcpFile() {
|
|
|
13248
13335
|
validate: true,
|
|
13249
13336
|
modularMcp: config.getModularMcp()
|
|
13250
13337
|
});
|
|
13251
|
-
const relativePathFromCwd =
|
|
13338
|
+
const relativePathFromCwd = join102(
|
|
13252
13339
|
rulesyncMcp.getRelativeDirPath(),
|
|
13253
13340
|
rulesyncMcp.getRelativeFilePath()
|
|
13254
13341
|
);
|
|
@@ -13281,7 +13368,7 @@ async function putMcpFile({ content }) {
|
|
|
13281
13368
|
const paths = RulesyncMcp.getSettablePaths();
|
|
13282
13369
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
13283
13370
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
13284
|
-
const fullPath =
|
|
13371
|
+
const fullPath = join102(baseDir, relativeDirPath, relativeFilePath);
|
|
13285
13372
|
const rulesyncMcp = new RulesyncMcp({
|
|
13286
13373
|
baseDir,
|
|
13287
13374
|
relativeDirPath,
|
|
@@ -13290,9 +13377,9 @@ async function putMcpFile({ content }) {
|
|
|
13290
13377
|
validate: true,
|
|
13291
13378
|
modularMcp: config.getModularMcp()
|
|
13292
13379
|
});
|
|
13293
|
-
await ensureDir(
|
|
13380
|
+
await ensureDir(join102(baseDir, relativeDirPath));
|
|
13294
13381
|
await writeFileContent(fullPath, content);
|
|
13295
|
-
const relativePathFromCwd =
|
|
13382
|
+
const relativePathFromCwd = join102(relativeDirPath, relativeFilePath);
|
|
13296
13383
|
return {
|
|
13297
13384
|
relativePathFromCwd,
|
|
13298
13385
|
content: rulesyncMcp.getFileContent()
|
|
@@ -13307,15 +13394,15 @@ async function deleteMcpFile() {
|
|
|
13307
13394
|
try {
|
|
13308
13395
|
const baseDir = process.cwd();
|
|
13309
13396
|
const paths = RulesyncMcp.getSettablePaths();
|
|
13310
|
-
const recommendedPath =
|
|
13397
|
+
const recommendedPath = join102(
|
|
13311
13398
|
baseDir,
|
|
13312
13399
|
paths.recommended.relativeDirPath,
|
|
13313
13400
|
paths.recommended.relativeFilePath
|
|
13314
13401
|
);
|
|
13315
|
-
const legacyPath =
|
|
13402
|
+
const legacyPath = join102(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
13316
13403
|
await removeFile(recommendedPath);
|
|
13317
13404
|
await removeFile(legacyPath);
|
|
13318
|
-
const relativePathFromCwd =
|
|
13405
|
+
const relativePathFromCwd = join102(
|
|
13319
13406
|
paths.recommended.relativeDirPath,
|
|
13320
13407
|
paths.recommended.relativeFilePath
|
|
13321
13408
|
);
|
|
@@ -13366,12 +13453,12 @@ var mcpTools = {
|
|
|
13366
13453
|
};
|
|
13367
13454
|
|
|
13368
13455
|
// src/mcp/rules.ts
|
|
13369
|
-
import { basename as
|
|
13456
|
+
import { basename as basename24, join as join103 } from "path";
|
|
13370
13457
|
import { z as z48 } from "zod/mini";
|
|
13371
13458
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
13372
13459
|
var maxRulesCount = 1e3;
|
|
13373
13460
|
async function listRules() {
|
|
13374
|
-
const rulesDir =
|
|
13461
|
+
const rulesDir = join103(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
13375
13462
|
try {
|
|
13376
13463
|
const files = await listDirectoryFiles(rulesDir);
|
|
13377
13464
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13384,7 +13471,7 @@ async function listRules() {
|
|
|
13384
13471
|
});
|
|
13385
13472
|
const frontmatter = rule.getFrontmatter();
|
|
13386
13473
|
return {
|
|
13387
|
-
relativePathFromCwd:
|
|
13474
|
+
relativePathFromCwd: join103(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
13388
13475
|
frontmatter
|
|
13389
13476
|
};
|
|
13390
13477
|
} catch (error) {
|
|
@@ -13404,14 +13491,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
13404
13491
|
relativePath: relativePathFromCwd,
|
|
13405
13492
|
intendedRootDir: process.cwd()
|
|
13406
13493
|
});
|
|
13407
|
-
const filename =
|
|
13494
|
+
const filename = basename24(relativePathFromCwd);
|
|
13408
13495
|
try {
|
|
13409
13496
|
const rule = await RulesyncRule.fromFile({
|
|
13410
13497
|
relativeFilePath: filename,
|
|
13411
13498
|
validate: true
|
|
13412
13499
|
});
|
|
13413
13500
|
return {
|
|
13414
|
-
relativePathFromCwd:
|
|
13501
|
+
relativePathFromCwd: join103(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
13415
13502
|
frontmatter: rule.getFrontmatter(),
|
|
13416
13503
|
body: rule.getBody()
|
|
13417
13504
|
};
|
|
@@ -13430,7 +13517,7 @@ async function putRule({
|
|
|
13430
13517
|
relativePath: relativePathFromCwd,
|
|
13431
13518
|
intendedRootDir: process.cwd()
|
|
13432
13519
|
});
|
|
13433
|
-
const filename =
|
|
13520
|
+
const filename = basename24(relativePathFromCwd);
|
|
13434
13521
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
13435
13522
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
13436
13523
|
throw new Error(
|
|
@@ -13440,7 +13527,7 @@ async function putRule({
|
|
|
13440
13527
|
try {
|
|
13441
13528
|
const existingRules = await listRules();
|
|
13442
13529
|
const isUpdate = existingRules.some(
|
|
13443
|
-
(rule2) => rule2.relativePathFromCwd ===
|
|
13530
|
+
(rule2) => rule2.relativePathFromCwd === join103(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
13444
13531
|
);
|
|
13445
13532
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
13446
13533
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -13453,11 +13540,11 @@ async function putRule({
|
|
|
13453
13540
|
body,
|
|
13454
13541
|
validate: true
|
|
13455
13542
|
});
|
|
13456
|
-
const rulesDir =
|
|
13543
|
+
const rulesDir = join103(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
13457
13544
|
await ensureDir(rulesDir);
|
|
13458
13545
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
13459
13546
|
return {
|
|
13460
|
-
relativePathFromCwd:
|
|
13547
|
+
relativePathFromCwd: join103(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
13461
13548
|
frontmatter: rule.getFrontmatter(),
|
|
13462
13549
|
body: rule.getBody()
|
|
13463
13550
|
};
|
|
@@ -13472,12 +13559,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
13472
13559
|
relativePath: relativePathFromCwd,
|
|
13473
13560
|
intendedRootDir: process.cwd()
|
|
13474
13561
|
});
|
|
13475
|
-
const filename =
|
|
13476
|
-
const fullPath =
|
|
13562
|
+
const filename = basename24(relativePathFromCwd);
|
|
13563
|
+
const fullPath = join103(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
13477
13564
|
try {
|
|
13478
13565
|
await removeFile(fullPath);
|
|
13479
13566
|
return {
|
|
13480
|
-
relativePathFromCwd:
|
|
13567
|
+
relativePathFromCwd: join103(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
13481
13568
|
};
|
|
13482
13569
|
} catch (error) {
|
|
13483
13570
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -13502,7 +13589,7 @@ var ruleToolSchemas = {
|
|
|
13502
13589
|
var ruleTools = {
|
|
13503
13590
|
listRules: {
|
|
13504
13591
|
name: "listRules",
|
|
13505
|
-
description: `List all rules from ${
|
|
13592
|
+
description: `List all rules from ${join103(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13506
13593
|
parameters: ruleToolSchemas.listRules,
|
|
13507
13594
|
execute: async () => {
|
|
13508
13595
|
const rules = await listRules();
|
|
@@ -13544,7 +13631,7 @@ var ruleTools = {
|
|
|
13544
13631
|
};
|
|
13545
13632
|
|
|
13546
13633
|
// src/mcp/skills.ts
|
|
13547
|
-
import { basename as
|
|
13634
|
+
import { basename as basename25, dirname as dirname3, join as join104 } from "path";
|
|
13548
13635
|
import { z as z49 } from "zod/mini";
|
|
13549
13636
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
13550
13637
|
var maxSkillsCount = 1e3;
|
|
@@ -13561,19 +13648,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
13561
13648
|
};
|
|
13562
13649
|
}
|
|
13563
13650
|
function extractDirName(relativeDirPathFromCwd) {
|
|
13564
|
-
const dirName =
|
|
13651
|
+
const dirName = basename25(relativeDirPathFromCwd);
|
|
13565
13652
|
if (!dirName) {
|
|
13566
13653
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
13567
13654
|
}
|
|
13568
13655
|
return dirName;
|
|
13569
13656
|
}
|
|
13570
13657
|
async function listSkills() {
|
|
13571
|
-
const skillsDir =
|
|
13658
|
+
const skillsDir = join104(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
13572
13659
|
try {
|
|
13573
|
-
const skillDirPaths = await findFilesByGlobs(
|
|
13660
|
+
const skillDirPaths = await findFilesByGlobs(join104(skillsDir, "*"), { type: "dir" });
|
|
13574
13661
|
const skills = await Promise.all(
|
|
13575
13662
|
skillDirPaths.map(async (dirPath) => {
|
|
13576
|
-
const dirName =
|
|
13663
|
+
const dirName = basename25(dirPath);
|
|
13577
13664
|
if (!dirName) return null;
|
|
13578
13665
|
try {
|
|
13579
13666
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -13581,7 +13668,7 @@ async function listSkills() {
|
|
|
13581
13668
|
});
|
|
13582
13669
|
const frontmatter = skill.getFrontmatter();
|
|
13583
13670
|
return {
|
|
13584
|
-
relativeDirPathFromCwd:
|
|
13671
|
+
relativeDirPathFromCwd: join104(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13585
13672
|
frontmatter
|
|
13586
13673
|
};
|
|
13587
13674
|
} catch (error) {
|
|
@@ -13607,7 +13694,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
13607
13694
|
dirName
|
|
13608
13695
|
});
|
|
13609
13696
|
return {
|
|
13610
|
-
relativeDirPathFromCwd:
|
|
13697
|
+
relativeDirPathFromCwd: join104(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13611
13698
|
frontmatter: skill.getFrontmatter(),
|
|
13612
13699
|
body: skill.getBody(),
|
|
13613
13700
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13641,7 +13728,7 @@ async function putSkill({
|
|
|
13641
13728
|
try {
|
|
13642
13729
|
const existingSkills = await listSkills();
|
|
13643
13730
|
const isUpdate = existingSkills.some(
|
|
13644
|
-
(skill2) => skill2.relativeDirPathFromCwd ===
|
|
13731
|
+
(skill2) => skill2.relativeDirPathFromCwd === join104(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13645
13732
|
);
|
|
13646
13733
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
13647
13734
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -13656,9 +13743,9 @@ async function putSkill({
|
|
|
13656
13743
|
otherFiles: aiDirFiles,
|
|
13657
13744
|
validate: true
|
|
13658
13745
|
});
|
|
13659
|
-
const skillDirPath =
|
|
13746
|
+
const skillDirPath = join104(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13660
13747
|
await ensureDir(skillDirPath);
|
|
13661
|
-
const skillFilePath =
|
|
13748
|
+
const skillFilePath = join104(skillDirPath, SKILL_FILE_NAME);
|
|
13662
13749
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
13663
13750
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
13664
13751
|
for (const file of otherFiles) {
|
|
@@ -13666,15 +13753,15 @@ async function putSkill({
|
|
|
13666
13753
|
relativePath: file.name,
|
|
13667
13754
|
intendedRootDir: skillDirPath
|
|
13668
13755
|
});
|
|
13669
|
-
const filePath =
|
|
13670
|
-
const fileDir =
|
|
13756
|
+
const filePath = join104(skillDirPath, file.name);
|
|
13757
|
+
const fileDir = join104(skillDirPath, dirname3(file.name));
|
|
13671
13758
|
if (fileDir !== skillDirPath) {
|
|
13672
13759
|
await ensureDir(fileDir);
|
|
13673
13760
|
}
|
|
13674
13761
|
await writeFileContent(filePath, file.body);
|
|
13675
13762
|
}
|
|
13676
13763
|
return {
|
|
13677
|
-
relativeDirPathFromCwd:
|
|
13764
|
+
relativeDirPathFromCwd: join104(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13678
13765
|
frontmatter: skill.getFrontmatter(),
|
|
13679
13766
|
body: skill.getBody(),
|
|
13680
13767
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13696,13 +13783,13 @@ async function deleteSkill({
|
|
|
13696
13783
|
intendedRootDir: process.cwd()
|
|
13697
13784
|
});
|
|
13698
13785
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
13699
|
-
const skillDirPath =
|
|
13786
|
+
const skillDirPath = join104(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13700
13787
|
try {
|
|
13701
13788
|
if (await directoryExists(skillDirPath)) {
|
|
13702
13789
|
await removeDirectory(skillDirPath);
|
|
13703
13790
|
}
|
|
13704
13791
|
return {
|
|
13705
|
-
relativeDirPathFromCwd:
|
|
13792
|
+
relativeDirPathFromCwd: join104(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13706
13793
|
};
|
|
13707
13794
|
} catch (error) {
|
|
13708
13795
|
throw new Error(
|
|
@@ -13735,7 +13822,7 @@ var skillToolSchemas = {
|
|
|
13735
13822
|
var skillTools = {
|
|
13736
13823
|
listSkills: {
|
|
13737
13824
|
name: "listSkills",
|
|
13738
|
-
description: `List all skills from ${
|
|
13825
|
+
description: `List all skills from ${join104(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
13739
13826
|
parameters: skillToolSchemas.listSkills,
|
|
13740
13827
|
execute: async () => {
|
|
13741
13828
|
const skills = await listSkills();
|
|
@@ -13778,12 +13865,12 @@ var skillTools = {
|
|
|
13778
13865
|
};
|
|
13779
13866
|
|
|
13780
13867
|
// src/mcp/subagents.ts
|
|
13781
|
-
import { basename as
|
|
13868
|
+
import { basename as basename26, join as join105 } from "path";
|
|
13782
13869
|
import { z as z50 } from "zod/mini";
|
|
13783
13870
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
13784
13871
|
var maxSubagentsCount = 1e3;
|
|
13785
13872
|
async function listSubagents() {
|
|
13786
|
-
const subagentsDir =
|
|
13873
|
+
const subagentsDir = join105(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13787
13874
|
try {
|
|
13788
13875
|
const files = await listDirectoryFiles(subagentsDir);
|
|
13789
13876
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13796,7 +13883,7 @@ async function listSubagents() {
|
|
|
13796
13883
|
});
|
|
13797
13884
|
const frontmatter = subagent.getFrontmatter();
|
|
13798
13885
|
return {
|
|
13799
|
-
relativePathFromCwd:
|
|
13886
|
+
relativePathFromCwd: join105(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
13800
13887
|
frontmatter
|
|
13801
13888
|
};
|
|
13802
13889
|
} catch (error) {
|
|
@@ -13818,14 +13905,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
13818
13905
|
relativePath: relativePathFromCwd,
|
|
13819
13906
|
intendedRootDir: process.cwd()
|
|
13820
13907
|
});
|
|
13821
|
-
const filename =
|
|
13908
|
+
const filename = basename26(relativePathFromCwd);
|
|
13822
13909
|
try {
|
|
13823
13910
|
const subagent = await RulesyncSubagent.fromFile({
|
|
13824
13911
|
relativeFilePath: filename,
|
|
13825
13912
|
validate: true
|
|
13826
13913
|
});
|
|
13827
13914
|
return {
|
|
13828
|
-
relativePathFromCwd:
|
|
13915
|
+
relativePathFromCwd: join105(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13829
13916
|
frontmatter: subagent.getFrontmatter(),
|
|
13830
13917
|
body: subagent.getBody()
|
|
13831
13918
|
};
|
|
@@ -13844,7 +13931,7 @@ async function putSubagent({
|
|
|
13844
13931
|
relativePath: relativePathFromCwd,
|
|
13845
13932
|
intendedRootDir: process.cwd()
|
|
13846
13933
|
});
|
|
13847
|
-
const filename =
|
|
13934
|
+
const filename = basename26(relativePathFromCwd);
|
|
13848
13935
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
13849
13936
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
13850
13937
|
throw new Error(
|
|
@@ -13854,7 +13941,7 @@ async function putSubagent({
|
|
|
13854
13941
|
try {
|
|
13855
13942
|
const existingSubagents = await listSubagents();
|
|
13856
13943
|
const isUpdate = existingSubagents.some(
|
|
13857
|
-
(subagent2) => subagent2.relativePathFromCwd ===
|
|
13944
|
+
(subagent2) => subagent2.relativePathFromCwd === join105(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13858
13945
|
);
|
|
13859
13946
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
13860
13947
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -13867,11 +13954,11 @@ async function putSubagent({
|
|
|
13867
13954
|
body,
|
|
13868
13955
|
validate: true
|
|
13869
13956
|
});
|
|
13870
|
-
const subagentsDir =
|
|
13957
|
+
const subagentsDir = join105(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13871
13958
|
await ensureDir(subagentsDir);
|
|
13872
13959
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
13873
13960
|
return {
|
|
13874
|
-
relativePathFromCwd:
|
|
13961
|
+
relativePathFromCwd: join105(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13875
13962
|
frontmatter: subagent.getFrontmatter(),
|
|
13876
13963
|
body: subagent.getBody()
|
|
13877
13964
|
};
|
|
@@ -13886,12 +13973,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
13886
13973
|
relativePath: relativePathFromCwd,
|
|
13887
13974
|
intendedRootDir: process.cwd()
|
|
13888
13975
|
});
|
|
13889
|
-
const filename =
|
|
13890
|
-
const fullPath =
|
|
13976
|
+
const filename = basename26(relativePathFromCwd);
|
|
13977
|
+
const fullPath = join105(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
13891
13978
|
try {
|
|
13892
13979
|
await removeFile(fullPath);
|
|
13893
13980
|
return {
|
|
13894
|
-
relativePathFromCwd:
|
|
13981
|
+
relativePathFromCwd: join105(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13895
13982
|
};
|
|
13896
13983
|
} catch (error) {
|
|
13897
13984
|
throw new Error(
|
|
@@ -13919,7 +14006,7 @@ var subagentToolSchemas = {
|
|
|
13919
14006
|
var subagentTools = {
|
|
13920
14007
|
listSubagents: {
|
|
13921
14008
|
name: "listSubagents",
|
|
13922
|
-
description: `List all subagents from ${
|
|
14009
|
+
description: `List all subagents from ${join105(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13923
14010
|
parameters: subagentToolSchemas.listSubagents,
|
|
13924
14011
|
execute: async () => {
|
|
13925
14012
|
const subagents = await listSubagents();
|
|
@@ -14170,7 +14257,7 @@ async function mcpCommand({ version }) {
|
|
|
14170
14257
|
}
|
|
14171
14258
|
|
|
14172
14259
|
// src/cli/index.ts
|
|
14173
|
-
var getVersion = () => "6.
|
|
14260
|
+
var getVersion = () => "6.1.0";
|
|
14174
14261
|
var main = async () => {
|
|
14175
14262
|
const program = new Command();
|
|
14176
14263
|
const version = getVersion();
|