rulesync 5.9.1 → 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 +145 -109
- package/dist/index.js +555 -519
- 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
|
|
@@ -915,9 +938,6 @@ var RulesyncFile = class extends AiFile {
|
|
|
915
938
|
static async fromFile(_params) {
|
|
916
939
|
throw new Error("Please implement this method in the subclass.");
|
|
917
940
|
}
|
|
918
|
-
static async fromFileLegacy(_params) {
|
|
919
|
-
throw new Error("Please implement this method in the subclass.");
|
|
920
|
-
}
|
|
921
941
|
};
|
|
922
942
|
|
|
923
943
|
// src/features/commands/rulesync-command.ts
|
|
@@ -933,7 +953,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
933
953
|
const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
|
|
934
954
|
if (!result.success) {
|
|
935
955
|
throw new Error(
|
|
936
|
-
`Invalid frontmatter in ${
|
|
956
|
+
`Invalid frontmatter in ${join6(rest.baseDir ?? process.cwd(), rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
937
957
|
);
|
|
938
958
|
}
|
|
939
959
|
}
|
|
@@ -966,7 +986,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
966
986
|
return {
|
|
967
987
|
success: false,
|
|
968
988
|
error: new Error(
|
|
969
|
-
`Invalid frontmatter in ${
|
|
989
|
+
`Invalid frontmatter in ${join6(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
970
990
|
)
|
|
971
991
|
};
|
|
972
992
|
}
|
|
@@ -974,7 +994,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
974
994
|
static async fromFile({
|
|
975
995
|
relativeFilePath
|
|
976
996
|
}) {
|
|
977
|
-
const filePath =
|
|
997
|
+
const filePath = join6(
|
|
978
998
|
process.cwd(),
|
|
979
999
|
_RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
980
1000
|
relativeFilePath
|
|
@@ -1012,7 +1032,7 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1012
1032
|
body;
|
|
1013
1033
|
static getSettablePaths() {
|
|
1014
1034
|
return {
|
|
1015
|
-
relativeDirPath:
|
|
1035
|
+
relativeDirPath: join7(".agent", "workflows")
|
|
1016
1036
|
};
|
|
1017
1037
|
}
|
|
1018
1038
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -1020,7 +1040,7 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1020
1040
|
const result = AntigravityCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1021
1041
|
if (!result.success) {
|
|
1022
1042
|
throw new Error(
|
|
1023
|
-
`Invalid frontmatter in ${
|
|
1043
|
+
`Invalid frontmatter in ${join7(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1024
1044
|
);
|
|
1025
1045
|
}
|
|
1026
1046
|
}
|
|
@@ -1118,7 +1138,7 @@ ${body}${turboDirective}`;
|
|
|
1118
1138
|
return {
|
|
1119
1139
|
success: false,
|
|
1120
1140
|
error: new Error(
|
|
1121
|
-
`Invalid frontmatter in ${
|
|
1141
|
+
`Invalid frontmatter in ${join7(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1122
1142
|
)
|
|
1123
1143
|
};
|
|
1124
1144
|
}
|
|
@@ -1134,7 +1154,7 @@ ${body}${turboDirective}`;
|
|
|
1134
1154
|
relativeFilePath,
|
|
1135
1155
|
validate = true
|
|
1136
1156
|
}) {
|
|
1137
|
-
const filePath =
|
|
1157
|
+
const filePath = join7(
|
|
1138
1158
|
baseDir,
|
|
1139
1159
|
_AntigravityCommand.getSettablePaths().relativeDirPath,
|
|
1140
1160
|
relativeFilePath
|
|
@@ -1173,7 +1193,7 @@ ${body}${turboDirective}`;
|
|
|
1173
1193
|
};
|
|
1174
1194
|
|
|
1175
1195
|
// src/features/commands/claudecode-command.ts
|
|
1176
|
-
import { basename as basename5, join as
|
|
1196
|
+
import { basename as basename5, join as join8 } from "path";
|
|
1177
1197
|
import { z as z7 } from "zod/mini";
|
|
1178
1198
|
var ClaudecodeCommandFrontmatterSchema = z7.looseObject({
|
|
1179
1199
|
description: z7.string(),
|
|
@@ -1190,7 +1210,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1190
1210
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1191
1211
|
if (!result.success) {
|
|
1192
1212
|
throw new Error(
|
|
1193
|
-
`Invalid frontmatter in ${
|
|
1213
|
+
`Invalid frontmatter in ${join8(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1194
1214
|
);
|
|
1195
1215
|
}
|
|
1196
1216
|
}
|
|
@@ -1203,7 +1223,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1203
1223
|
}
|
|
1204
1224
|
static getSettablePaths(_options = {}) {
|
|
1205
1225
|
return {
|
|
1206
|
-
relativeDirPath:
|
|
1226
|
+
relativeDirPath: join8(".claude", "commands")
|
|
1207
1227
|
};
|
|
1208
1228
|
}
|
|
1209
1229
|
getBody() {
|
|
@@ -1266,7 +1286,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1266
1286
|
return {
|
|
1267
1287
|
success: false,
|
|
1268
1288
|
error: new Error(
|
|
1269
|
-
`Invalid frontmatter in ${
|
|
1289
|
+
`Invalid frontmatter in ${join8(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1270
1290
|
)
|
|
1271
1291
|
};
|
|
1272
1292
|
}
|
|
@@ -1284,7 +1304,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1284
1304
|
global = false
|
|
1285
1305
|
}) {
|
|
1286
1306
|
const paths = this.getSettablePaths({ global });
|
|
1287
|
-
const filePath =
|
|
1307
|
+
const filePath = join8(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1288
1308
|
const fileContent = await readFileContent(filePath);
|
|
1289
1309
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1290
1310
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1317,16 +1337,16 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1317
1337
|
};
|
|
1318
1338
|
|
|
1319
1339
|
// src/features/commands/cline-command.ts
|
|
1320
|
-
import { basename as basename6, join as
|
|
1340
|
+
import { basename as basename6, join as join9 } from "path";
|
|
1321
1341
|
var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
1322
1342
|
static getSettablePaths({ global } = {}) {
|
|
1323
1343
|
if (global) {
|
|
1324
1344
|
return {
|
|
1325
|
-
relativeDirPath:
|
|
1345
|
+
relativeDirPath: join9("Documents", "Cline", "Workflows")
|
|
1326
1346
|
};
|
|
1327
1347
|
}
|
|
1328
1348
|
return {
|
|
1329
|
-
relativeDirPath:
|
|
1349
|
+
relativeDirPath: join9(".clinerules", "workflows")
|
|
1330
1350
|
};
|
|
1331
1351
|
}
|
|
1332
1352
|
toRulesyncCommand() {
|
|
@@ -1378,7 +1398,7 @@ var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
|
1378
1398
|
global = false
|
|
1379
1399
|
}) {
|
|
1380
1400
|
const paths = this.getSettablePaths({ global });
|
|
1381
|
-
const filePath =
|
|
1401
|
+
const filePath = join9(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1382
1402
|
const fileContent = await readFileContent(filePath);
|
|
1383
1403
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1384
1404
|
return new _ClineCommand({
|
|
@@ -1405,14 +1425,14 @@ var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
|
1405
1425
|
};
|
|
1406
1426
|
|
|
1407
1427
|
// src/features/commands/codexcli-command.ts
|
|
1408
|
-
import { basename as basename7, join as
|
|
1428
|
+
import { basename as basename7, join as join10 } from "path";
|
|
1409
1429
|
var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
1410
1430
|
static getSettablePaths({ global } = {}) {
|
|
1411
1431
|
if (!global) {
|
|
1412
1432
|
throw new Error("CodexcliCommand only supports global mode. Please pass { global: true }.");
|
|
1413
1433
|
}
|
|
1414
1434
|
return {
|
|
1415
|
-
relativeDirPath:
|
|
1435
|
+
relativeDirPath: join10(".codex", "prompts")
|
|
1416
1436
|
};
|
|
1417
1437
|
}
|
|
1418
1438
|
toRulesyncCommand() {
|
|
@@ -1465,7 +1485,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1465
1485
|
global = false
|
|
1466
1486
|
}) {
|
|
1467
1487
|
const paths = this.getSettablePaths({ global });
|
|
1468
|
-
const filePath =
|
|
1488
|
+
const filePath = join10(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1469
1489
|
const fileContent = await readFileContent(filePath);
|
|
1470
1490
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1471
1491
|
return new _CodexcliCommand({
|
|
@@ -1492,7 +1512,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1492
1512
|
};
|
|
1493
1513
|
|
|
1494
1514
|
// src/features/commands/copilot-command.ts
|
|
1495
|
-
import { basename as basename8, join as
|
|
1515
|
+
import { basename as basename8, join as join11 } from "path";
|
|
1496
1516
|
import { z as z8 } from "zod/mini";
|
|
1497
1517
|
var CopilotCommandFrontmatterSchema = z8.looseObject({
|
|
1498
1518
|
mode: z8.optional(z8.string()),
|
|
@@ -1506,7 +1526,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1506
1526
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1507
1527
|
if (!result.success) {
|
|
1508
1528
|
throw new Error(
|
|
1509
|
-
`Invalid frontmatter in ${
|
|
1529
|
+
`Invalid frontmatter in ${join11(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1510
1530
|
);
|
|
1511
1531
|
}
|
|
1512
1532
|
}
|
|
@@ -1519,7 +1539,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1519
1539
|
}
|
|
1520
1540
|
static getSettablePaths() {
|
|
1521
1541
|
return {
|
|
1522
|
-
relativeDirPath:
|
|
1542
|
+
relativeDirPath: join11(".github", "prompts")
|
|
1523
1543
|
};
|
|
1524
1544
|
}
|
|
1525
1545
|
getBody() {
|
|
@@ -1559,7 +1579,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1559
1579
|
return {
|
|
1560
1580
|
success: false,
|
|
1561
1581
|
error: new Error(
|
|
1562
|
-
`Invalid frontmatter in ${
|
|
1582
|
+
`Invalid frontmatter in ${join11(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1563
1583
|
)
|
|
1564
1584
|
};
|
|
1565
1585
|
}
|
|
@@ -1594,7 +1614,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1594
1614
|
validate = true
|
|
1595
1615
|
}) {
|
|
1596
1616
|
const paths = this.getSettablePaths();
|
|
1597
|
-
const filePath =
|
|
1617
|
+
const filePath = join11(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1598
1618
|
const fileContent = await readFileContent(filePath);
|
|
1599
1619
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1600
1620
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1633,11 +1653,11 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1633
1653
|
};
|
|
1634
1654
|
|
|
1635
1655
|
// src/features/commands/cursor-command.ts
|
|
1636
|
-
import { basename as basename9, join as
|
|
1656
|
+
import { basename as basename9, join as join12 } from "path";
|
|
1637
1657
|
var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
1638
1658
|
static getSettablePaths(_options = {}) {
|
|
1639
1659
|
return {
|
|
1640
|
-
relativeDirPath:
|
|
1660
|
+
relativeDirPath: join12(".cursor", "commands")
|
|
1641
1661
|
};
|
|
1642
1662
|
}
|
|
1643
1663
|
toRulesyncCommand() {
|
|
@@ -1690,7 +1710,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1690
1710
|
global = false
|
|
1691
1711
|
}) {
|
|
1692
1712
|
const paths = this.getSettablePaths({ global });
|
|
1693
|
-
const filePath =
|
|
1713
|
+
const filePath = join12(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1694
1714
|
const fileContent = await readFileContent(filePath);
|
|
1695
1715
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1696
1716
|
return new _CursorCommand({
|
|
@@ -1717,7 +1737,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1717
1737
|
};
|
|
1718
1738
|
|
|
1719
1739
|
// src/features/commands/geminicli-command.ts
|
|
1720
|
-
import { basename as basename10, join as
|
|
1740
|
+
import { basename as basename10, join as join13 } from "path";
|
|
1721
1741
|
import { parse as parseToml } from "smol-toml";
|
|
1722
1742
|
import { z as z9 } from "zod/mini";
|
|
1723
1743
|
var GeminiCliCommandFrontmatterSchema = z9.looseObject({
|
|
@@ -1735,7 +1755,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
1735
1755
|
}
|
|
1736
1756
|
static getSettablePaths(_options = {}) {
|
|
1737
1757
|
return {
|
|
1738
|
-
relativeDirPath:
|
|
1758
|
+
relativeDirPath: join13(".gemini", "commands")
|
|
1739
1759
|
};
|
|
1740
1760
|
}
|
|
1741
1761
|
parseTomlContent(content) {
|
|
@@ -1817,7 +1837,7 @@ ${geminiFrontmatter.prompt}
|
|
|
1817
1837
|
global = false
|
|
1818
1838
|
}) {
|
|
1819
1839
|
const paths = this.getSettablePaths({ global });
|
|
1820
|
-
const filePath =
|
|
1840
|
+
const filePath = join13(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1821
1841
|
const fileContent = await readFileContent(filePath);
|
|
1822
1842
|
return new _GeminiCliCommand({
|
|
1823
1843
|
baseDir,
|
|
@@ -1859,11 +1879,11 @@ prompt = ""`;
|
|
|
1859
1879
|
};
|
|
1860
1880
|
|
|
1861
1881
|
// src/features/commands/kilo-command.ts
|
|
1862
|
-
import { basename as basename11, join as
|
|
1882
|
+
import { basename as basename11, join as join14 } from "path";
|
|
1863
1883
|
var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
1864
1884
|
static getSettablePaths(_options = {}) {
|
|
1865
1885
|
return {
|
|
1866
|
-
relativeDirPath:
|
|
1886
|
+
relativeDirPath: join14(".kilocode", "workflows")
|
|
1867
1887
|
};
|
|
1868
1888
|
}
|
|
1869
1889
|
toRulesyncCommand() {
|
|
@@ -1913,7 +1933,7 @@ var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
|
1913
1933
|
validate = true
|
|
1914
1934
|
}) {
|
|
1915
1935
|
const paths = this.getSettablePaths();
|
|
1916
|
-
const filePath =
|
|
1936
|
+
const filePath = join14(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1917
1937
|
const fileContent = await readFileContent(filePath);
|
|
1918
1938
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1919
1939
|
return new _KiloCommand({
|
|
@@ -1940,11 +1960,11 @@ var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
|
1940
1960
|
};
|
|
1941
1961
|
|
|
1942
1962
|
// src/features/commands/kiro-command.ts
|
|
1943
|
-
import { basename as basename12, join as
|
|
1963
|
+
import { basename as basename12, join as join15 } from "path";
|
|
1944
1964
|
var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
1945
1965
|
static getSettablePaths(_options = {}) {
|
|
1946
1966
|
return {
|
|
1947
|
-
relativeDirPath:
|
|
1967
|
+
relativeDirPath: join15(".kiro", "prompts")
|
|
1948
1968
|
};
|
|
1949
1969
|
}
|
|
1950
1970
|
toRulesyncCommand() {
|
|
@@ -1994,7 +2014,7 @@ var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
|
1994
2014
|
validate = true
|
|
1995
2015
|
}) {
|
|
1996
2016
|
const paths = this.getSettablePaths();
|
|
1997
|
-
const filePath =
|
|
2017
|
+
const filePath = join15(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1998
2018
|
const fileContent = await readFileContent(filePath);
|
|
1999
2019
|
const { body: content } = parseFrontmatter(fileContent);
|
|
2000
2020
|
return new _KiroCommand({
|
|
@@ -2021,7 +2041,7 @@ var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
|
2021
2041
|
};
|
|
2022
2042
|
|
|
2023
2043
|
// src/features/commands/opencode-command.ts
|
|
2024
|
-
import { basename as basename13, join as
|
|
2044
|
+
import { basename as basename13, join as join16 } from "path";
|
|
2025
2045
|
import { optional as optional2, z as z10 } from "zod/mini";
|
|
2026
2046
|
var OpenCodeCommandFrontmatterSchema = z10.looseObject({
|
|
2027
2047
|
description: z10.string(),
|
|
@@ -2037,7 +2057,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2037
2057
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2038
2058
|
if (!result.success) {
|
|
2039
2059
|
throw new Error(
|
|
2040
|
-
`Invalid frontmatter in ${
|
|
2060
|
+
`Invalid frontmatter in ${join16(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
2041
2061
|
);
|
|
2042
2062
|
}
|
|
2043
2063
|
}
|
|
@@ -2050,7 +2070,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2050
2070
|
}
|
|
2051
2071
|
static getSettablePaths({ global } = {}) {
|
|
2052
2072
|
return {
|
|
2053
|
-
relativeDirPath: global ?
|
|
2073
|
+
relativeDirPath: global ? join16(".config", "opencode", "command") : join16(".opencode", "command")
|
|
2054
2074
|
};
|
|
2055
2075
|
}
|
|
2056
2076
|
getBody() {
|
|
@@ -2111,7 +2131,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2111
2131
|
return {
|
|
2112
2132
|
success: false,
|
|
2113
2133
|
error: new Error(
|
|
2114
|
-
`Invalid frontmatter in ${
|
|
2134
|
+
`Invalid frontmatter in ${join16(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
2115
2135
|
)
|
|
2116
2136
|
};
|
|
2117
2137
|
}
|
|
@@ -2122,7 +2142,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2122
2142
|
global = false
|
|
2123
2143
|
}) {
|
|
2124
2144
|
const paths = this.getSettablePaths({ global });
|
|
2125
|
-
const filePath =
|
|
2145
|
+
const filePath = join16(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2126
2146
|
const fileContent = await readFileContent(filePath);
|
|
2127
2147
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2128
2148
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2161,7 +2181,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2161
2181
|
};
|
|
2162
2182
|
|
|
2163
2183
|
// src/features/commands/roo-command.ts
|
|
2164
|
-
import { basename as basename14, join as
|
|
2184
|
+
import { basename as basename14, join as join17 } from "path";
|
|
2165
2185
|
import { optional as optional3, z as z11 } from "zod/mini";
|
|
2166
2186
|
var RooCommandFrontmatterSchema = z11.looseObject({
|
|
2167
2187
|
description: z11.string(),
|
|
@@ -2172,7 +2192,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2172
2192
|
body;
|
|
2173
2193
|
static getSettablePaths() {
|
|
2174
2194
|
return {
|
|
2175
|
-
relativeDirPath:
|
|
2195
|
+
relativeDirPath: join17(".roo", "commands")
|
|
2176
2196
|
};
|
|
2177
2197
|
}
|
|
2178
2198
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -2180,7 +2200,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2180
2200
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2181
2201
|
if (!result.success) {
|
|
2182
2202
|
throw new Error(
|
|
2183
|
-
`Invalid frontmatter in ${
|
|
2203
|
+
`Invalid frontmatter in ${join17(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
2184
2204
|
);
|
|
2185
2205
|
}
|
|
2186
2206
|
}
|
|
@@ -2251,7 +2271,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2251
2271
|
return {
|
|
2252
2272
|
success: false,
|
|
2253
2273
|
error: new Error(
|
|
2254
|
-
`Invalid frontmatter in ${
|
|
2274
|
+
`Invalid frontmatter in ${join17(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
2255
2275
|
)
|
|
2256
2276
|
};
|
|
2257
2277
|
}
|
|
@@ -2267,7 +2287,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2267
2287
|
relativeFilePath,
|
|
2268
2288
|
validate = true
|
|
2269
2289
|
}) {
|
|
2270
|
-
const filePath =
|
|
2290
|
+
const filePath = join17(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
2271
2291
|
const fileContent = await readFileContent(filePath);
|
|
2272
2292
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2273
2293
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2491,7 +2511,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2491
2511
|
*/
|
|
2492
2512
|
async loadRulesyncFiles() {
|
|
2493
2513
|
const rulesyncCommandPaths = await findFilesByGlobs(
|
|
2494
|
-
|
|
2514
|
+
join18(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
|
|
2495
2515
|
);
|
|
2496
2516
|
const rulesyncCommands = await Promise.all(
|
|
2497
2517
|
rulesyncCommandPaths.map(
|
|
@@ -2511,7 +2531,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2511
2531
|
const factory = this.getFactory(this.toolTarget);
|
|
2512
2532
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
2513
2533
|
const commandFilePaths = await findFilesByGlobs(
|
|
2514
|
-
|
|
2534
|
+
join18(this.baseDir, paths.relativeDirPath, `*.${factory.meta.extension}`)
|
|
2515
2535
|
);
|
|
2516
2536
|
if (forDeletion) {
|
|
2517
2537
|
const toolCommands2 = commandFilePaths.map(
|
|
@@ -2564,14 +2584,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2564
2584
|
import { z as z13 } from "zod/mini";
|
|
2565
2585
|
|
|
2566
2586
|
// src/features/ignore/augmentcode-ignore.ts
|
|
2567
|
-
import { join as
|
|
2587
|
+
import { join as join20 } from "path";
|
|
2568
2588
|
|
|
2569
2589
|
// src/types/tool-file.ts
|
|
2570
2590
|
var ToolFile = class extends AiFile {
|
|
2571
2591
|
};
|
|
2572
2592
|
|
|
2573
2593
|
// src/features/ignore/rulesync-ignore.ts
|
|
2574
|
-
import { join as
|
|
2594
|
+
import { join as join19 } from "path";
|
|
2575
2595
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
2576
2596
|
validate() {
|
|
2577
2597
|
return { success: true, error: null };
|
|
@@ -2591,12 +2611,12 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
2591
2611
|
static async fromFile() {
|
|
2592
2612
|
const baseDir = process.cwd();
|
|
2593
2613
|
const paths = this.getSettablePaths();
|
|
2594
|
-
const recommendedPath =
|
|
2614
|
+
const recommendedPath = join19(
|
|
2595
2615
|
baseDir,
|
|
2596
2616
|
paths.recommended.relativeDirPath,
|
|
2597
2617
|
paths.recommended.relativeFilePath
|
|
2598
2618
|
);
|
|
2599
|
-
const legacyPath =
|
|
2619
|
+
const legacyPath = join19(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
2600
2620
|
if (await fileExists(recommendedPath)) {
|
|
2601
2621
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
2602
2622
|
return new _RulesyncIgnore({
|
|
@@ -2712,7 +2732,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2712
2732
|
validate = true
|
|
2713
2733
|
}) {
|
|
2714
2734
|
const fileContent = await readFileContent(
|
|
2715
|
-
|
|
2735
|
+
join20(
|
|
2716
2736
|
baseDir,
|
|
2717
2737
|
this.getSettablePaths().relativeDirPath,
|
|
2718
2738
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2743,7 +2763,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2743
2763
|
|
|
2744
2764
|
// src/features/ignore/claudecode-ignore.ts
|
|
2745
2765
|
import { uniq } from "es-toolkit";
|
|
2746
|
-
import { join as
|
|
2766
|
+
import { join as join21 } from "path";
|
|
2747
2767
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
2748
2768
|
constructor(params) {
|
|
2749
2769
|
super(params);
|
|
@@ -2785,7 +2805,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2785
2805
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
2786
2806
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
2787
2807
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
2788
|
-
const filePath =
|
|
2808
|
+
const filePath = join21(
|
|
2789
2809
|
baseDir,
|
|
2790
2810
|
this.getSettablePaths().relativeDirPath,
|
|
2791
2811
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2821,7 +2841,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2821
2841
|
validate = true
|
|
2822
2842
|
}) {
|
|
2823
2843
|
const fileContent = await readFileContent(
|
|
2824
|
-
|
|
2844
|
+
join21(
|
|
2825
2845
|
baseDir,
|
|
2826
2846
|
this.getSettablePaths().relativeDirPath,
|
|
2827
2847
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2851,7 +2871,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2851
2871
|
};
|
|
2852
2872
|
|
|
2853
2873
|
// src/features/ignore/cline-ignore.ts
|
|
2854
|
-
import { join as
|
|
2874
|
+
import { join as join22 } from "path";
|
|
2855
2875
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
2856
2876
|
static getSettablePaths() {
|
|
2857
2877
|
return {
|
|
@@ -2888,7 +2908,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2888
2908
|
validate = true
|
|
2889
2909
|
}) {
|
|
2890
2910
|
const fileContent = await readFileContent(
|
|
2891
|
-
|
|
2911
|
+
join22(
|
|
2892
2912
|
baseDir,
|
|
2893
2913
|
this.getSettablePaths().relativeDirPath,
|
|
2894
2914
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2918,7 +2938,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2918
2938
|
};
|
|
2919
2939
|
|
|
2920
2940
|
// src/features/ignore/cursor-ignore.ts
|
|
2921
|
-
import { join as
|
|
2941
|
+
import { join as join23 } from "path";
|
|
2922
2942
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
2923
2943
|
static getSettablePaths() {
|
|
2924
2944
|
return {
|
|
@@ -2951,7 +2971,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2951
2971
|
validate = true
|
|
2952
2972
|
}) {
|
|
2953
2973
|
const fileContent = await readFileContent(
|
|
2954
|
-
|
|
2974
|
+
join23(
|
|
2955
2975
|
baseDir,
|
|
2956
2976
|
this.getSettablePaths().relativeDirPath,
|
|
2957
2977
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2981,7 +3001,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2981
3001
|
};
|
|
2982
3002
|
|
|
2983
3003
|
// src/features/ignore/geminicli-ignore.ts
|
|
2984
|
-
import { join as
|
|
3004
|
+
import { join as join24 } from "path";
|
|
2985
3005
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
2986
3006
|
static getSettablePaths() {
|
|
2987
3007
|
return {
|
|
@@ -3008,7 +3028,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
3008
3028
|
validate = true
|
|
3009
3029
|
}) {
|
|
3010
3030
|
const fileContent = await readFileContent(
|
|
3011
|
-
|
|
3031
|
+
join24(
|
|
3012
3032
|
baseDir,
|
|
3013
3033
|
this.getSettablePaths().relativeDirPath,
|
|
3014
3034
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3038,7 +3058,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
3038
3058
|
};
|
|
3039
3059
|
|
|
3040
3060
|
// src/features/ignore/junie-ignore.ts
|
|
3041
|
-
import { join as
|
|
3061
|
+
import { join as join25 } from "path";
|
|
3042
3062
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
3043
3063
|
static getSettablePaths() {
|
|
3044
3064
|
return {
|
|
@@ -3065,7 +3085,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
3065
3085
|
validate = true
|
|
3066
3086
|
}) {
|
|
3067
3087
|
const fileContent = await readFileContent(
|
|
3068
|
-
|
|
3088
|
+
join25(
|
|
3069
3089
|
baseDir,
|
|
3070
3090
|
this.getSettablePaths().relativeDirPath,
|
|
3071
3091
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3095,7 +3115,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
3095
3115
|
};
|
|
3096
3116
|
|
|
3097
3117
|
// src/features/ignore/kilo-ignore.ts
|
|
3098
|
-
import { join as
|
|
3118
|
+
import { join as join26 } from "path";
|
|
3099
3119
|
var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
3100
3120
|
static getSettablePaths() {
|
|
3101
3121
|
return {
|
|
@@ -3132,7 +3152,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
3132
3152
|
validate = true
|
|
3133
3153
|
}) {
|
|
3134
3154
|
const fileContent = await readFileContent(
|
|
3135
|
-
|
|
3155
|
+
join26(
|
|
3136
3156
|
baseDir,
|
|
3137
3157
|
this.getSettablePaths().relativeDirPath,
|
|
3138
3158
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3162,7 +3182,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
3162
3182
|
};
|
|
3163
3183
|
|
|
3164
3184
|
// src/features/ignore/kiro-ignore.ts
|
|
3165
|
-
import { join as
|
|
3185
|
+
import { join as join27 } from "path";
|
|
3166
3186
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
3167
3187
|
static getSettablePaths() {
|
|
3168
3188
|
return {
|
|
@@ -3189,7 +3209,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
3189
3209
|
validate = true
|
|
3190
3210
|
}) {
|
|
3191
3211
|
const fileContent = await readFileContent(
|
|
3192
|
-
|
|
3212
|
+
join27(
|
|
3193
3213
|
baseDir,
|
|
3194
3214
|
this.getSettablePaths().relativeDirPath,
|
|
3195
3215
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3219,7 +3239,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
3219
3239
|
};
|
|
3220
3240
|
|
|
3221
3241
|
// src/features/ignore/qwencode-ignore.ts
|
|
3222
|
-
import { join as
|
|
3242
|
+
import { join as join28 } from "path";
|
|
3223
3243
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
3224
3244
|
static getSettablePaths() {
|
|
3225
3245
|
return {
|
|
@@ -3246,7 +3266,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
3246
3266
|
validate = true
|
|
3247
3267
|
}) {
|
|
3248
3268
|
const fileContent = await readFileContent(
|
|
3249
|
-
|
|
3269
|
+
join28(
|
|
3250
3270
|
baseDir,
|
|
3251
3271
|
this.getSettablePaths().relativeDirPath,
|
|
3252
3272
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3276,7 +3296,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
3276
3296
|
};
|
|
3277
3297
|
|
|
3278
3298
|
// src/features/ignore/roo-ignore.ts
|
|
3279
|
-
import { join as
|
|
3299
|
+
import { join as join29 } from "path";
|
|
3280
3300
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
3281
3301
|
static getSettablePaths() {
|
|
3282
3302
|
return {
|
|
@@ -3303,7 +3323,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
3303
3323
|
validate = true
|
|
3304
3324
|
}) {
|
|
3305
3325
|
const fileContent = await readFileContent(
|
|
3306
|
-
|
|
3326
|
+
join29(
|
|
3307
3327
|
baseDir,
|
|
3308
3328
|
this.getSettablePaths().relativeDirPath,
|
|
3309
3329
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3333,7 +3353,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
3333
3353
|
};
|
|
3334
3354
|
|
|
3335
3355
|
// src/features/ignore/windsurf-ignore.ts
|
|
3336
|
-
import { join as
|
|
3356
|
+
import { join as join30 } from "path";
|
|
3337
3357
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
3338
3358
|
static getSettablePaths() {
|
|
3339
3359
|
return {
|
|
@@ -3360,7 +3380,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3360
3380
|
validate = true
|
|
3361
3381
|
}) {
|
|
3362
3382
|
const fileContent = await readFileContent(
|
|
3363
|
-
|
|
3383
|
+
join30(
|
|
3364
3384
|
baseDir,
|
|
3365
3385
|
this.getSettablePaths().relativeDirPath,
|
|
3366
3386
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3391,7 +3411,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3391
3411
|
|
|
3392
3412
|
// src/features/ignore/zed-ignore.ts
|
|
3393
3413
|
import { uniq as uniq2 } from "es-toolkit";
|
|
3394
|
-
import { join as
|
|
3414
|
+
import { join as join31 } from "path";
|
|
3395
3415
|
var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
3396
3416
|
constructor(params) {
|
|
3397
3417
|
super(params);
|
|
@@ -3427,7 +3447,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
3427
3447
|
}) {
|
|
3428
3448
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
3429
3449
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
3430
|
-
const filePath =
|
|
3450
|
+
const filePath = join31(
|
|
3431
3451
|
baseDir,
|
|
3432
3452
|
this.getSettablePaths().relativeDirPath,
|
|
3433
3453
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3454,7 +3474,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
3454
3474
|
validate = true
|
|
3455
3475
|
}) {
|
|
3456
3476
|
const fileContent = await readFileContent(
|
|
3457
|
-
|
|
3477
|
+
join31(
|
|
3458
3478
|
baseDir,
|
|
3459
3479
|
this.getSettablePaths().relativeDirPath,
|
|
3460
3480
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3636,10 +3656,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
3636
3656
|
import { z as z18 } from "zod/mini";
|
|
3637
3657
|
|
|
3638
3658
|
// src/features/mcp/claudecode-mcp.ts
|
|
3639
|
-
import { join as
|
|
3659
|
+
import { join as join34 } from "path";
|
|
3640
3660
|
|
|
3641
3661
|
// src/features/mcp/modular-mcp.ts
|
|
3642
|
-
import { join as
|
|
3662
|
+
import { join as join32 } from "path";
|
|
3643
3663
|
import { z as z15 } from "zod/mini";
|
|
3644
3664
|
|
|
3645
3665
|
// src/types/mcp.ts
|
|
@@ -3727,7 +3747,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3727
3747
|
args: [
|
|
3728
3748
|
"-y",
|
|
3729
3749
|
"@kimuson/modular-mcp",
|
|
3730
|
-
|
|
3750
|
+
join32(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3731
3751
|
],
|
|
3732
3752
|
env: {}
|
|
3733
3753
|
}
|
|
@@ -3765,7 +3785,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3765
3785
|
|
|
3766
3786
|
// src/features/mcp/rulesync-mcp.ts
|
|
3767
3787
|
import { omit } from "es-toolkit/object";
|
|
3768
|
-
import { join as
|
|
3788
|
+
import { join as join33 } from "path";
|
|
3769
3789
|
import { z as z16 } from "zod/mini";
|
|
3770
3790
|
var RulesyncMcpServerSchema = z16.union([
|
|
3771
3791
|
z16.extend(McpServerSchema, {
|
|
@@ -3821,12 +3841,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
3821
3841
|
}) {
|
|
3822
3842
|
const baseDir = process.cwd();
|
|
3823
3843
|
const paths = this.getSettablePaths();
|
|
3824
|
-
const recommendedPath =
|
|
3844
|
+
const recommendedPath = join33(
|
|
3825
3845
|
baseDir,
|
|
3826
3846
|
paths.recommended.relativeDirPath,
|
|
3827
3847
|
paths.recommended.relativeFilePath
|
|
3828
3848
|
);
|
|
3829
|
-
const legacyPath =
|
|
3849
|
+
const legacyPath = join33(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
3830
3850
|
if (await fileExists(recommendedPath)) {
|
|
3831
3851
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
3832
3852
|
return new _RulesyncMcp({
|
|
@@ -3970,7 +3990,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3970
3990
|
}) {
|
|
3971
3991
|
const paths = this.getSettablePaths({ global });
|
|
3972
3992
|
const fileContent = await readOrInitializeFileContent(
|
|
3973
|
-
|
|
3993
|
+
join34(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3974
3994
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3975
3995
|
);
|
|
3976
3996
|
const json = JSON.parse(fileContent);
|
|
@@ -3992,7 +4012,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3992
4012
|
}) {
|
|
3993
4013
|
const paths = this.getSettablePaths({ global });
|
|
3994
4014
|
const fileContent = await readOrInitializeFileContent(
|
|
3995
|
-
|
|
4015
|
+
join34(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3996
4016
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3997
4017
|
);
|
|
3998
4018
|
const json = JSON.parse(fileContent);
|
|
@@ -4040,7 +4060,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
4040
4060
|
};
|
|
4041
4061
|
|
|
4042
4062
|
// src/features/mcp/cline-mcp.ts
|
|
4043
|
-
import { join as
|
|
4063
|
+
import { join as join35 } from "path";
|
|
4044
4064
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
4045
4065
|
json;
|
|
4046
4066
|
constructor(params) {
|
|
@@ -4061,7 +4081,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
4061
4081
|
validate = true
|
|
4062
4082
|
}) {
|
|
4063
4083
|
const fileContent = await readFileContent(
|
|
4064
|
-
|
|
4084
|
+
join35(
|
|
4065
4085
|
baseDir,
|
|
4066
4086
|
this.getSettablePaths().relativeDirPath,
|
|
4067
4087
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4110,7 +4130,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
4110
4130
|
};
|
|
4111
4131
|
|
|
4112
4132
|
// src/features/mcp/codexcli-mcp.ts
|
|
4113
|
-
import { join as
|
|
4133
|
+
import { join as join36 } from "path";
|
|
4114
4134
|
import * as smolToml from "smol-toml";
|
|
4115
4135
|
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
4116
4136
|
toml;
|
|
@@ -4146,7 +4166,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4146
4166
|
}) {
|
|
4147
4167
|
const paths = this.getSettablePaths({ global });
|
|
4148
4168
|
const fileContent = await readFileContent(
|
|
4149
|
-
|
|
4169
|
+
join36(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
4150
4170
|
);
|
|
4151
4171
|
return new _CodexcliMcp({
|
|
4152
4172
|
baseDir,
|
|
@@ -4163,7 +4183,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4163
4183
|
global = false
|
|
4164
4184
|
}) {
|
|
4165
4185
|
const paths = this.getSettablePaths({ global });
|
|
4166
|
-
const configTomlFilePath =
|
|
4186
|
+
const configTomlFilePath = join36(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
4167
4187
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
4168
4188
|
configTomlFilePath,
|
|
4169
4189
|
smolToml.stringify({})
|
|
@@ -4217,7 +4237,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4217
4237
|
};
|
|
4218
4238
|
|
|
4219
4239
|
// src/features/mcp/copilot-mcp.ts
|
|
4220
|
-
import { join as
|
|
4240
|
+
import { join as join37 } from "path";
|
|
4221
4241
|
function convertToCopilotFormat(mcpServers) {
|
|
4222
4242
|
return { servers: mcpServers };
|
|
4223
4243
|
}
|
|
@@ -4244,7 +4264,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4244
4264
|
validate = true
|
|
4245
4265
|
}) {
|
|
4246
4266
|
const fileContent = await readFileContent(
|
|
4247
|
-
|
|
4267
|
+
join37(
|
|
4248
4268
|
baseDir,
|
|
4249
4269
|
this.getSettablePaths().relativeDirPath,
|
|
4250
4270
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4297,7 +4317,47 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4297
4317
|
};
|
|
4298
4318
|
|
|
4299
4319
|
// src/features/mcp/cursor-mcp.ts
|
|
4300
|
-
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
|
+
}
|
|
4301
4361
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
4302
4362
|
json;
|
|
4303
4363
|
constructor(params) {
|
|
@@ -4318,7 +4378,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4318
4378
|
validate = true
|
|
4319
4379
|
}) {
|
|
4320
4380
|
const fileContent = await readFileContent(
|
|
4321
|
-
|
|
4381
|
+
join38(
|
|
4322
4382
|
baseDir,
|
|
4323
4383
|
this.getSettablePaths().relativeDirPath,
|
|
4324
4384
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4338,8 +4398,10 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4338
4398
|
validate = true
|
|
4339
4399
|
}) {
|
|
4340
4400
|
const json = rulesyncMcp.getJson();
|
|
4401
|
+
const mcpServers = isMcpServers(json.mcpServers) ? json.mcpServers : {};
|
|
4402
|
+
const transformedServers = convertEnvToCursorFormat(mcpServers);
|
|
4341
4403
|
const cursorConfig = {
|
|
4342
|
-
mcpServers:
|
|
4404
|
+
mcpServers: transformedServers
|
|
4343
4405
|
};
|
|
4344
4406
|
const fileContent = JSON.stringify(cursorConfig, null, 2);
|
|
4345
4407
|
return new _CursorMcp({
|
|
@@ -4351,11 +4413,17 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4351
4413
|
});
|
|
4352
4414
|
}
|
|
4353
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
|
+
};
|
|
4354
4422
|
return new RulesyncMcp({
|
|
4355
4423
|
baseDir: this.baseDir,
|
|
4356
4424
|
relativeDirPath: this.relativeDirPath,
|
|
4357
4425
|
relativeFilePath: "rulesync.mcp.json",
|
|
4358
|
-
fileContent:
|
|
4426
|
+
fileContent: JSON.stringify(transformedJson),
|
|
4359
4427
|
validate: true
|
|
4360
4428
|
});
|
|
4361
4429
|
}
|
|
@@ -4378,7 +4446,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4378
4446
|
};
|
|
4379
4447
|
|
|
4380
4448
|
// src/features/mcp/geminicli-mcp.ts
|
|
4381
|
-
import { join as
|
|
4449
|
+
import { join as join39 } from "path";
|
|
4382
4450
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
4383
4451
|
json;
|
|
4384
4452
|
constructor(params) {
|
|
@@ -4407,7 +4475,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4407
4475
|
}) {
|
|
4408
4476
|
const paths = this.getSettablePaths({ global });
|
|
4409
4477
|
const fileContent = await readOrInitializeFileContent(
|
|
4410
|
-
|
|
4478
|
+
join39(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4411
4479
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4412
4480
|
);
|
|
4413
4481
|
const json = JSON.parse(fileContent);
|
|
@@ -4428,7 +4496,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4428
4496
|
}) {
|
|
4429
4497
|
const paths = this.getSettablePaths({ global });
|
|
4430
4498
|
const fileContent = await readOrInitializeFileContent(
|
|
4431
|
-
|
|
4499
|
+
join39(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4432
4500
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4433
4501
|
);
|
|
4434
4502
|
const json = JSON.parse(fileContent);
|
|
@@ -4465,7 +4533,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4465
4533
|
};
|
|
4466
4534
|
|
|
4467
4535
|
// src/features/mcp/junie-mcp.ts
|
|
4468
|
-
import { join as
|
|
4536
|
+
import { join as join40 } from "path";
|
|
4469
4537
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
4470
4538
|
json;
|
|
4471
4539
|
constructor(params) {
|
|
@@ -4477,7 +4545,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4477
4545
|
}
|
|
4478
4546
|
static getSettablePaths() {
|
|
4479
4547
|
return {
|
|
4480
|
-
relativeDirPath:
|
|
4548
|
+
relativeDirPath: join40(".junie", "mcp"),
|
|
4481
4549
|
relativeFilePath: "mcp.json"
|
|
4482
4550
|
};
|
|
4483
4551
|
}
|
|
@@ -4486,7 +4554,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4486
4554
|
validate = true
|
|
4487
4555
|
}) {
|
|
4488
4556
|
const fileContent = await readFileContent(
|
|
4489
|
-
|
|
4557
|
+
join40(
|
|
4490
4558
|
baseDir,
|
|
4491
4559
|
this.getSettablePaths().relativeDirPath,
|
|
4492
4560
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4535,7 +4603,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4535
4603
|
};
|
|
4536
4604
|
|
|
4537
4605
|
// src/features/mcp/kilo-mcp.ts
|
|
4538
|
-
import { join as
|
|
4606
|
+
import { join as join41 } from "path";
|
|
4539
4607
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
4540
4608
|
json;
|
|
4541
4609
|
constructor(params) {
|
|
@@ -4557,7 +4625,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4557
4625
|
}) {
|
|
4558
4626
|
const paths = this.getSettablePaths();
|
|
4559
4627
|
const fileContent = await readOrInitializeFileContent(
|
|
4560
|
-
|
|
4628
|
+
join41(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4561
4629
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4562
4630
|
);
|
|
4563
4631
|
return new _KiloMcp({
|
|
@@ -4611,7 +4679,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4611
4679
|
};
|
|
4612
4680
|
|
|
4613
4681
|
// src/features/mcp/kiro-mcp.ts
|
|
4614
|
-
import { join as
|
|
4682
|
+
import { join as join42 } from "path";
|
|
4615
4683
|
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
4616
4684
|
json;
|
|
4617
4685
|
constructor(params) {
|
|
@@ -4623,7 +4691,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4623
4691
|
}
|
|
4624
4692
|
static getSettablePaths() {
|
|
4625
4693
|
return {
|
|
4626
|
-
relativeDirPath:
|
|
4694
|
+
relativeDirPath: join42(".kiro", "settings"),
|
|
4627
4695
|
relativeFilePath: "mcp.json"
|
|
4628
4696
|
};
|
|
4629
4697
|
}
|
|
@@ -4633,7 +4701,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4633
4701
|
}) {
|
|
4634
4702
|
const paths = this.getSettablePaths();
|
|
4635
4703
|
const fileContent = await readOrInitializeFileContent(
|
|
4636
|
-
|
|
4704
|
+
join42(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4637
4705
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4638
4706
|
);
|
|
4639
4707
|
return new _KiroMcp({
|
|
@@ -4687,7 +4755,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4687
4755
|
};
|
|
4688
4756
|
|
|
4689
4757
|
// src/features/mcp/opencode-mcp.ts
|
|
4690
|
-
import { join as
|
|
4758
|
+
import { join as join43 } from "path";
|
|
4691
4759
|
import { z as z17 } from "zod/mini";
|
|
4692
4760
|
var OpencodeMcpLocalServerSchema = z17.object({
|
|
4693
4761
|
type: z17.literal("local"),
|
|
@@ -4811,7 +4879,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4811
4879
|
}) {
|
|
4812
4880
|
const paths = this.getSettablePaths({ global });
|
|
4813
4881
|
const fileContent = await readOrInitializeFileContent(
|
|
4814
|
-
|
|
4882
|
+
join43(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4815
4883
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4816
4884
|
);
|
|
4817
4885
|
const json = JSON.parse(fileContent);
|
|
@@ -4832,7 +4900,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4832
4900
|
}) {
|
|
4833
4901
|
const paths = this.getSettablePaths({ global });
|
|
4834
4902
|
const fileContent = await readOrInitializeFileContent(
|
|
4835
|
-
|
|
4903
|
+
join43(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4836
4904
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4837
4905
|
);
|
|
4838
4906
|
const json = JSON.parse(fileContent);
|
|
@@ -4876,7 +4944,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4876
4944
|
};
|
|
4877
4945
|
|
|
4878
4946
|
// src/features/mcp/roo-mcp.ts
|
|
4879
|
-
import { join as
|
|
4947
|
+
import { join as join44 } from "path";
|
|
4880
4948
|
function isRooMcpServers(value) {
|
|
4881
4949
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
4882
4950
|
}
|
|
@@ -4928,7 +4996,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4928
4996
|
validate = true
|
|
4929
4997
|
}) {
|
|
4930
4998
|
const fileContent = await readFileContent(
|
|
4931
|
-
|
|
4999
|
+
join44(
|
|
4932
5000
|
baseDir,
|
|
4933
5001
|
this.getSettablePaths().relativeDirPath,
|
|
4934
5002
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5243,24 +5311,24 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
5243
5311
|
|
|
5244
5312
|
// src/features/rules/rules-processor.ts
|
|
5245
5313
|
import { encode } from "@toon-format/toon";
|
|
5246
|
-
import { basename as
|
|
5314
|
+
import { basename as basename22, join as join96, relative as relative4 } from "path";
|
|
5247
5315
|
import { z as z44 } from "zod/mini";
|
|
5248
5316
|
|
|
5249
5317
|
// src/constants/general.ts
|
|
5250
5318
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
5251
5319
|
|
|
5252
5320
|
// src/features/skills/agentsmd-skill.ts
|
|
5253
|
-
import { join as
|
|
5321
|
+
import { join as join48 } from "path";
|
|
5254
5322
|
|
|
5255
5323
|
// src/features/skills/simulated-skill.ts
|
|
5256
|
-
import { join as
|
|
5324
|
+
import { join as join47 } from "path";
|
|
5257
5325
|
import { z as z19 } from "zod/mini";
|
|
5258
5326
|
|
|
5259
5327
|
// src/features/skills/tool-skill.ts
|
|
5260
|
-
import { join as
|
|
5328
|
+
import { join as join46 } from "path";
|
|
5261
5329
|
|
|
5262
5330
|
// src/types/ai-dir.ts
|
|
5263
|
-
import path2, { basename as basename16, join as
|
|
5331
|
+
import path2, { basename as basename16, join as join45, relative as relative3, resolve as resolve4 } from "path";
|
|
5264
5332
|
var AiDir = class {
|
|
5265
5333
|
/**
|
|
5266
5334
|
* @example "."
|
|
@@ -5354,8 +5422,8 @@ var AiDir = class {
|
|
|
5354
5422
|
* @returns Array of files with their relative paths and buffers
|
|
5355
5423
|
*/
|
|
5356
5424
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
5357
|
-
const dirPath =
|
|
5358
|
-
const glob =
|
|
5425
|
+
const dirPath = join45(baseDir, relativeDirPath, dirName);
|
|
5426
|
+
const glob = join45(dirPath, "**", "*");
|
|
5359
5427
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
5360
5428
|
const filteredPaths = filePaths.filter((filePath) => basename16(filePath) !== excludeFileName);
|
|
5361
5429
|
const files = await Promise.all(
|
|
@@ -5453,8 +5521,8 @@ var ToolSkill = class extends AiDir {
|
|
|
5453
5521
|
}) {
|
|
5454
5522
|
const settablePaths = getSettablePaths({ global });
|
|
5455
5523
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5456
|
-
const skillDirPath =
|
|
5457
|
-
const skillFilePath =
|
|
5524
|
+
const skillDirPath = join46(baseDir, actualRelativeDirPath, dirName);
|
|
5525
|
+
const skillFilePath = join46(skillDirPath, SKILL_FILE_NAME);
|
|
5458
5526
|
if (!await fileExists(skillFilePath)) {
|
|
5459
5527
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5460
5528
|
}
|
|
@@ -5512,7 +5580,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5512
5580
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
5513
5581
|
if (!result.success) {
|
|
5514
5582
|
throw new Error(
|
|
5515
|
-
`Invalid frontmatter in ${
|
|
5583
|
+
`Invalid frontmatter in ${join47(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
5516
5584
|
);
|
|
5517
5585
|
}
|
|
5518
5586
|
}
|
|
@@ -5570,8 +5638,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5570
5638
|
}) {
|
|
5571
5639
|
const settablePaths = this.getSettablePaths();
|
|
5572
5640
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5573
|
-
const skillDirPath =
|
|
5574
|
-
const skillFilePath =
|
|
5641
|
+
const skillDirPath = join47(baseDir, actualRelativeDirPath, dirName);
|
|
5642
|
+
const skillFilePath = join47(skillDirPath, SKILL_FILE_NAME);
|
|
5575
5643
|
if (!await fileExists(skillFilePath)) {
|
|
5576
5644
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5577
5645
|
}
|
|
@@ -5648,7 +5716,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5648
5716
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
5649
5717
|
}
|
|
5650
5718
|
return {
|
|
5651
|
-
relativeDirPath:
|
|
5719
|
+
relativeDirPath: join48(".agents", "skills")
|
|
5652
5720
|
};
|
|
5653
5721
|
}
|
|
5654
5722
|
static async fromDir(params) {
|
|
@@ -5675,14 +5743,14 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5675
5743
|
};
|
|
5676
5744
|
|
|
5677
5745
|
// src/features/skills/geminicli-skill.ts
|
|
5678
|
-
import { join as
|
|
5746
|
+
import { join as join49 } from "path";
|
|
5679
5747
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5680
5748
|
static getSettablePaths(options) {
|
|
5681
5749
|
if (options?.global) {
|
|
5682
5750
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5683
5751
|
}
|
|
5684
5752
|
return {
|
|
5685
|
-
relativeDirPath:
|
|
5753
|
+
relativeDirPath: join49(".gemini", "skills")
|
|
5686
5754
|
};
|
|
5687
5755
|
}
|
|
5688
5756
|
static async fromDir(params) {
|
|
@@ -5709,11 +5777,11 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
|
5709
5777
|
};
|
|
5710
5778
|
|
|
5711
5779
|
// src/features/skills/skills-processor.ts
|
|
5712
|
-
import { basename as basename17, join as
|
|
5780
|
+
import { basename as basename17, join as join61 } from "path";
|
|
5713
5781
|
import { z as z30 } from "zod/mini";
|
|
5714
5782
|
|
|
5715
5783
|
// src/types/dir-feature-processor.ts
|
|
5716
|
-
import { join as
|
|
5784
|
+
import { join as join50 } from "path";
|
|
5717
5785
|
var DirFeatureProcessor = class {
|
|
5718
5786
|
baseDir;
|
|
5719
5787
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -5735,14 +5803,14 @@ var DirFeatureProcessor = class {
|
|
|
5735
5803
|
await ensureDir(dirPath);
|
|
5736
5804
|
const mainFile = aiDir.getMainFile();
|
|
5737
5805
|
if (mainFile) {
|
|
5738
|
-
const mainFilePath =
|
|
5806
|
+
const mainFilePath = join50(dirPath, mainFile.name);
|
|
5739
5807
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5740
5808
|
const contentWithNewline = addTrailingNewline(content);
|
|
5741
5809
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5742
5810
|
}
|
|
5743
5811
|
const otherFiles = aiDir.getOtherFiles();
|
|
5744
5812
|
for (const file of otherFiles) {
|
|
5745
|
-
const filePath =
|
|
5813
|
+
const filePath = join50(dirPath, file.relativeFilePathToDirPath);
|
|
5746
5814
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5747
5815
|
await writeFileContent(filePath, contentWithNewline);
|
|
5748
5816
|
}
|
|
@@ -5757,11 +5825,11 @@ var DirFeatureProcessor = class {
|
|
|
5757
5825
|
};
|
|
5758
5826
|
|
|
5759
5827
|
// src/features/skills/antigravity-skill.ts
|
|
5760
|
-
import { join as
|
|
5828
|
+
import { join as join52 } from "path";
|
|
5761
5829
|
import { z as z21 } from "zod/mini";
|
|
5762
5830
|
|
|
5763
5831
|
// src/features/skills/rulesync-skill.ts
|
|
5764
|
-
import { join as
|
|
5832
|
+
import { join as join51 } from "path";
|
|
5765
5833
|
import { z as z20 } from "zod/mini";
|
|
5766
5834
|
var RulesyncSkillFrontmatterSchemaInternal = z20.looseObject({
|
|
5767
5835
|
name: z20.string(),
|
|
@@ -5853,8 +5921,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5853
5921
|
dirName,
|
|
5854
5922
|
global = false
|
|
5855
5923
|
}) {
|
|
5856
|
-
const skillDirPath =
|
|
5857
|
-
const skillFilePath =
|
|
5924
|
+
const skillDirPath = join51(baseDir, relativeDirPath, dirName);
|
|
5925
|
+
const skillFilePath = join51(skillDirPath, SKILL_FILE_NAME);
|
|
5858
5926
|
if (!await fileExists(skillFilePath)) {
|
|
5859
5927
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5860
5928
|
}
|
|
@@ -5891,7 +5959,7 @@ var AntigravitySkillFrontmatterSchema = z21.looseObject({
|
|
|
5891
5959
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
5892
5960
|
constructor({
|
|
5893
5961
|
baseDir = process.cwd(),
|
|
5894
|
-
relativeDirPath =
|
|
5962
|
+
relativeDirPath = join52(".agent", "skills"),
|
|
5895
5963
|
dirName,
|
|
5896
5964
|
frontmatter,
|
|
5897
5965
|
body,
|
|
@@ -5923,11 +5991,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
5923
5991
|
} = {}) {
|
|
5924
5992
|
if (global) {
|
|
5925
5993
|
return {
|
|
5926
|
-
relativeDirPath:
|
|
5994
|
+
relativeDirPath: join52(".gemini", "antigravity", "skills")
|
|
5927
5995
|
};
|
|
5928
5996
|
}
|
|
5929
5997
|
return {
|
|
5930
|
-
relativeDirPath:
|
|
5998
|
+
relativeDirPath: join52(".agent", "skills")
|
|
5931
5999
|
};
|
|
5932
6000
|
}
|
|
5933
6001
|
getFrontmatter() {
|
|
@@ -6009,9 +6077,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
6009
6077
|
});
|
|
6010
6078
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6011
6079
|
if (!result.success) {
|
|
6012
|
-
const skillDirPath =
|
|
6080
|
+
const skillDirPath = join52(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6013
6081
|
throw new Error(
|
|
6014
|
-
`Invalid frontmatter in ${
|
|
6082
|
+
`Invalid frontmatter in ${join52(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6015
6083
|
);
|
|
6016
6084
|
}
|
|
6017
6085
|
return new _AntigravitySkill({
|
|
@@ -6045,7 +6113,7 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
6045
6113
|
};
|
|
6046
6114
|
|
|
6047
6115
|
// src/features/skills/claudecode-skill.ts
|
|
6048
|
-
import { join as
|
|
6116
|
+
import { join as join53 } from "path";
|
|
6049
6117
|
import { z as z22 } from "zod/mini";
|
|
6050
6118
|
var ClaudecodeSkillFrontmatterSchema = z22.looseObject({
|
|
6051
6119
|
name: z22.string(),
|
|
@@ -6055,7 +6123,7 @@ var ClaudecodeSkillFrontmatterSchema = z22.looseObject({
|
|
|
6055
6123
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
6056
6124
|
constructor({
|
|
6057
6125
|
baseDir = process.cwd(),
|
|
6058
|
-
relativeDirPath =
|
|
6126
|
+
relativeDirPath = join53(".claude", "skills"),
|
|
6059
6127
|
dirName,
|
|
6060
6128
|
frontmatter,
|
|
6061
6129
|
body,
|
|
@@ -6086,7 +6154,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6086
6154
|
global: _global = false
|
|
6087
6155
|
} = {}) {
|
|
6088
6156
|
return {
|
|
6089
|
-
relativeDirPath:
|
|
6157
|
+
relativeDirPath: join53(".claude", "skills")
|
|
6090
6158
|
};
|
|
6091
6159
|
}
|
|
6092
6160
|
getFrontmatter() {
|
|
@@ -6174,9 +6242,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6174
6242
|
});
|
|
6175
6243
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6176
6244
|
if (!result.success) {
|
|
6177
|
-
const skillDirPath =
|
|
6245
|
+
const skillDirPath = join53(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6178
6246
|
throw new Error(
|
|
6179
|
-
`Invalid frontmatter in ${
|
|
6247
|
+
`Invalid frontmatter in ${join53(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6180
6248
|
);
|
|
6181
6249
|
}
|
|
6182
6250
|
return new _ClaudecodeSkill({
|
|
@@ -6210,7 +6278,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6210
6278
|
};
|
|
6211
6279
|
|
|
6212
6280
|
// src/features/skills/codexcli-skill.ts
|
|
6213
|
-
import { join as
|
|
6281
|
+
import { join as join54 } from "path";
|
|
6214
6282
|
import { z as z23 } from "zod/mini";
|
|
6215
6283
|
var CodexCliSkillFrontmatterSchema = z23.looseObject({
|
|
6216
6284
|
name: z23.string(),
|
|
@@ -6224,7 +6292,7 @@ var CodexCliSkillFrontmatterSchema = z23.looseObject({
|
|
|
6224
6292
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
6225
6293
|
constructor({
|
|
6226
6294
|
baseDir = process.cwd(),
|
|
6227
|
-
relativeDirPath =
|
|
6295
|
+
relativeDirPath = join54(".codex", "skills"),
|
|
6228
6296
|
dirName,
|
|
6229
6297
|
frontmatter,
|
|
6230
6298
|
body,
|
|
@@ -6255,7 +6323,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6255
6323
|
global: _global = false
|
|
6256
6324
|
} = {}) {
|
|
6257
6325
|
return {
|
|
6258
|
-
relativeDirPath:
|
|
6326
|
+
relativeDirPath: join54(".codex", "skills")
|
|
6259
6327
|
};
|
|
6260
6328
|
}
|
|
6261
6329
|
getFrontmatter() {
|
|
@@ -6347,9 +6415,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6347
6415
|
});
|
|
6348
6416
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6349
6417
|
if (!result.success) {
|
|
6350
|
-
const skillDirPath =
|
|
6418
|
+
const skillDirPath = join54(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6351
6419
|
throw new Error(
|
|
6352
|
-
`Invalid frontmatter in ${
|
|
6420
|
+
`Invalid frontmatter in ${join54(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6353
6421
|
);
|
|
6354
6422
|
}
|
|
6355
6423
|
return new _CodexCliSkill({
|
|
@@ -6383,7 +6451,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6383
6451
|
};
|
|
6384
6452
|
|
|
6385
6453
|
// src/features/skills/copilot-skill.ts
|
|
6386
|
-
import { join as
|
|
6454
|
+
import { join as join55 } from "path";
|
|
6387
6455
|
import { z as z24 } from "zod/mini";
|
|
6388
6456
|
var CopilotSkillFrontmatterSchema = z24.looseObject({
|
|
6389
6457
|
name: z24.string(),
|
|
@@ -6393,7 +6461,7 @@ var CopilotSkillFrontmatterSchema = z24.looseObject({
|
|
|
6393
6461
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
6394
6462
|
constructor({
|
|
6395
6463
|
baseDir = process.cwd(),
|
|
6396
|
-
relativeDirPath =
|
|
6464
|
+
relativeDirPath = join55(".github", "skills"),
|
|
6397
6465
|
dirName,
|
|
6398
6466
|
frontmatter,
|
|
6399
6467
|
body,
|
|
@@ -6425,7 +6493,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6425
6493
|
throw new Error("CopilotSkill does not support global mode.");
|
|
6426
6494
|
}
|
|
6427
6495
|
return {
|
|
6428
|
-
relativeDirPath:
|
|
6496
|
+
relativeDirPath: join55(".github", "skills")
|
|
6429
6497
|
};
|
|
6430
6498
|
}
|
|
6431
6499
|
getFrontmatter() {
|
|
@@ -6513,9 +6581,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6513
6581
|
});
|
|
6514
6582
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6515
6583
|
if (!result.success) {
|
|
6516
|
-
const skillDirPath =
|
|
6584
|
+
const skillDirPath = join55(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6517
6585
|
throw new Error(
|
|
6518
|
-
`Invalid frontmatter in ${
|
|
6586
|
+
`Invalid frontmatter in ${join55(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6519
6587
|
);
|
|
6520
6588
|
}
|
|
6521
6589
|
return new _CopilotSkill({
|
|
@@ -6550,7 +6618,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6550
6618
|
};
|
|
6551
6619
|
|
|
6552
6620
|
// src/features/skills/cursor-skill.ts
|
|
6553
|
-
import { join as
|
|
6621
|
+
import { join as join56 } from "path";
|
|
6554
6622
|
import { z as z25 } from "zod/mini";
|
|
6555
6623
|
var CursorSkillFrontmatterSchema = z25.looseObject({
|
|
6556
6624
|
name: z25.string(),
|
|
@@ -6559,7 +6627,7 @@ var CursorSkillFrontmatterSchema = z25.looseObject({
|
|
|
6559
6627
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
6560
6628
|
constructor({
|
|
6561
6629
|
baseDir = process.cwd(),
|
|
6562
|
-
relativeDirPath =
|
|
6630
|
+
relativeDirPath = join56(".cursor", "skills"),
|
|
6563
6631
|
dirName,
|
|
6564
6632
|
frontmatter,
|
|
6565
6633
|
body,
|
|
@@ -6591,7 +6659,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6591
6659
|
throw new Error("CursorSkill does not support global mode.");
|
|
6592
6660
|
}
|
|
6593
6661
|
return {
|
|
6594
|
-
relativeDirPath:
|
|
6662
|
+
relativeDirPath: join56(".cursor", "skills")
|
|
6595
6663
|
};
|
|
6596
6664
|
}
|
|
6597
6665
|
getFrontmatter() {
|
|
@@ -6673,9 +6741,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6673
6741
|
});
|
|
6674
6742
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6675
6743
|
if (!result.success) {
|
|
6676
|
-
const skillDirPath =
|
|
6744
|
+
const skillDirPath = join56(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6677
6745
|
throw new Error(
|
|
6678
|
-
`Invalid frontmatter in ${
|
|
6746
|
+
`Invalid frontmatter in ${join56(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6679
6747
|
);
|
|
6680
6748
|
}
|
|
6681
6749
|
return new _CursorSkill({
|
|
@@ -6710,7 +6778,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6710
6778
|
};
|
|
6711
6779
|
|
|
6712
6780
|
// src/features/skills/kilo-skill.ts
|
|
6713
|
-
import { join as
|
|
6781
|
+
import { join as join57 } from "path";
|
|
6714
6782
|
import { z as z26 } from "zod/mini";
|
|
6715
6783
|
var KiloSkillFrontmatterSchema = z26.looseObject({
|
|
6716
6784
|
name: z26.string(),
|
|
@@ -6719,7 +6787,7 @@ var KiloSkillFrontmatterSchema = z26.looseObject({
|
|
|
6719
6787
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
6720
6788
|
constructor({
|
|
6721
6789
|
baseDir = process.cwd(),
|
|
6722
|
-
relativeDirPath =
|
|
6790
|
+
relativeDirPath = join57(".kilocode", "skills"),
|
|
6723
6791
|
dirName,
|
|
6724
6792
|
frontmatter,
|
|
6725
6793
|
body,
|
|
@@ -6750,7 +6818,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6750
6818
|
global: _global = false
|
|
6751
6819
|
} = {}) {
|
|
6752
6820
|
return {
|
|
6753
|
-
relativeDirPath:
|
|
6821
|
+
relativeDirPath: join57(".kilocode", "skills")
|
|
6754
6822
|
};
|
|
6755
6823
|
}
|
|
6756
6824
|
getFrontmatter() {
|
|
@@ -6840,13 +6908,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6840
6908
|
});
|
|
6841
6909
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6842
6910
|
if (!result.success) {
|
|
6843
|
-
const skillDirPath =
|
|
6911
|
+
const skillDirPath = join57(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6844
6912
|
throw new Error(
|
|
6845
|
-
`Invalid frontmatter in ${
|
|
6913
|
+
`Invalid frontmatter in ${join57(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6846
6914
|
);
|
|
6847
6915
|
}
|
|
6848
6916
|
if (result.data.name !== loaded.dirName) {
|
|
6849
|
-
const skillFilePath =
|
|
6917
|
+
const skillFilePath = join57(
|
|
6850
6918
|
loaded.baseDir,
|
|
6851
6919
|
loaded.relativeDirPath,
|
|
6852
6920
|
loaded.dirName,
|
|
@@ -6887,7 +6955,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6887
6955
|
};
|
|
6888
6956
|
|
|
6889
6957
|
// src/features/skills/kiro-skill.ts
|
|
6890
|
-
import { join as
|
|
6958
|
+
import { join as join58 } from "path";
|
|
6891
6959
|
import { z as z27 } from "zod/mini";
|
|
6892
6960
|
var KiroSkillFrontmatterSchema = z27.looseObject({
|
|
6893
6961
|
name: z27.string(),
|
|
@@ -6896,7 +6964,7 @@ var KiroSkillFrontmatterSchema = z27.looseObject({
|
|
|
6896
6964
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
6897
6965
|
constructor({
|
|
6898
6966
|
baseDir = process.cwd(),
|
|
6899
|
-
relativeDirPath =
|
|
6967
|
+
relativeDirPath = join58(".kiro", "skills"),
|
|
6900
6968
|
dirName,
|
|
6901
6969
|
frontmatter,
|
|
6902
6970
|
body,
|
|
@@ -6928,7 +6996,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
6928
6996
|
throw new Error("KiroSkill does not support global mode.");
|
|
6929
6997
|
}
|
|
6930
6998
|
return {
|
|
6931
|
-
relativeDirPath:
|
|
6999
|
+
relativeDirPath: join58(".kiro", "skills")
|
|
6932
7000
|
};
|
|
6933
7001
|
}
|
|
6934
7002
|
getFrontmatter() {
|
|
@@ -7018,13 +7086,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
7018
7086
|
});
|
|
7019
7087
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7020
7088
|
if (!result.success) {
|
|
7021
|
-
const skillDirPath =
|
|
7089
|
+
const skillDirPath = join58(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7022
7090
|
throw new Error(
|
|
7023
|
-
`Invalid frontmatter in ${
|
|
7091
|
+
`Invalid frontmatter in ${join58(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7024
7092
|
);
|
|
7025
7093
|
}
|
|
7026
7094
|
if (result.data.name !== loaded.dirName) {
|
|
7027
|
-
const skillFilePath =
|
|
7095
|
+
const skillFilePath = join58(
|
|
7028
7096
|
loaded.baseDir,
|
|
7029
7097
|
loaded.relativeDirPath,
|
|
7030
7098
|
loaded.dirName,
|
|
@@ -7066,7 +7134,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
7066
7134
|
};
|
|
7067
7135
|
|
|
7068
7136
|
// src/features/skills/opencode-skill.ts
|
|
7069
|
-
import { join as
|
|
7137
|
+
import { join as join59 } from "path";
|
|
7070
7138
|
import { z as z28 } from "zod/mini";
|
|
7071
7139
|
var OpenCodeSkillFrontmatterSchema = z28.looseObject({
|
|
7072
7140
|
name: z28.string(),
|
|
@@ -7076,7 +7144,7 @@ var OpenCodeSkillFrontmatterSchema = z28.looseObject({
|
|
|
7076
7144
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
7077
7145
|
constructor({
|
|
7078
7146
|
baseDir = process.cwd(),
|
|
7079
|
-
relativeDirPath =
|
|
7147
|
+
relativeDirPath = join59(".opencode", "skill"),
|
|
7080
7148
|
dirName,
|
|
7081
7149
|
frontmatter,
|
|
7082
7150
|
body,
|
|
@@ -7105,7 +7173,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
7105
7173
|
}
|
|
7106
7174
|
static getSettablePaths({ global = false } = {}) {
|
|
7107
7175
|
return {
|
|
7108
|
-
relativeDirPath: global ?
|
|
7176
|
+
relativeDirPath: global ? join59(".config", "opencode", "skill") : join59(".opencode", "skill")
|
|
7109
7177
|
};
|
|
7110
7178
|
}
|
|
7111
7179
|
getFrontmatter() {
|
|
@@ -7193,9 +7261,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
7193
7261
|
});
|
|
7194
7262
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7195
7263
|
if (!result.success) {
|
|
7196
|
-
const skillDirPath =
|
|
7264
|
+
const skillDirPath = join59(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7197
7265
|
throw new Error(
|
|
7198
|
-
`Invalid frontmatter in ${
|
|
7266
|
+
`Invalid frontmatter in ${join59(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7199
7267
|
);
|
|
7200
7268
|
}
|
|
7201
7269
|
return new _OpenCodeSkill({
|
|
@@ -7229,7 +7297,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
7229
7297
|
};
|
|
7230
7298
|
|
|
7231
7299
|
// src/features/skills/roo-skill.ts
|
|
7232
|
-
import { join as
|
|
7300
|
+
import { join as join60 } from "path";
|
|
7233
7301
|
import { z as z29 } from "zod/mini";
|
|
7234
7302
|
var RooSkillFrontmatterSchema = z29.looseObject({
|
|
7235
7303
|
name: z29.string(),
|
|
@@ -7238,7 +7306,7 @@ var RooSkillFrontmatterSchema = z29.looseObject({
|
|
|
7238
7306
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
7239
7307
|
constructor({
|
|
7240
7308
|
baseDir = process.cwd(),
|
|
7241
|
-
relativeDirPath =
|
|
7309
|
+
relativeDirPath = join60(".roo", "skills"),
|
|
7242
7310
|
dirName,
|
|
7243
7311
|
frontmatter,
|
|
7244
7312
|
body,
|
|
@@ -7269,7 +7337,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
7269
7337
|
global: _global = false
|
|
7270
7338
|
} = {}) {
|
|
7271
7339
|
return {
|
|
7272
|
-
relativeDirPath:
|
|
7340
|
+
relativeDirPath: join60(".roo", "skills")
|
|
7273
7341
|
};
|
|
7274
7342
|
}
|
|
7275
7343
|
getFrontmatter() {
|
|
@@ -7359,13 +7427,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
7359
7427
|
});
|
|
7360
7428
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7361
7429
|
if (!result.success) {
|
|
7362
|
-
const skillDirPath =
|
|
7430
|
+
const skillDirPath = join60(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7363
7431
|
throw new Error(
|
|
7364
|
-
`Invalid frontmatter in ${
|
|
7432
|
+
`Invalid frontmatter in ${join60(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7365
7433
|
);
|
|
7366
7434
|
}
|
|
7367
7435
|
if (result.data.name !== loaded.dirName) {
|
|
7368
|
-
const skillFilePath =
|
|
7436
|
+
const skillFilePath = join60(
|
|
7369
7437
|
loaded.baseDir,
|
|
7370
7438
|
loaded.relativeDirPath,
|
|
7371
7439
|
loaded.dirName,
|
|
@@ -7584,8 +7652,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7584
7652
|
*/
|
|
7585
7653
|
async loadRulesyncDirs() {
|
|
7586
7654
|
const paths = RulesyncSkill.getSettablePaths();
|
|
7587
|
-
const rulesyncSkillsDirPath =
|
|
7588
|
-
const dirPaths = await findFilesByGlobs(
|
|
7655
|
+
const rulesyncSkillsDirPath = join61(this.baseDir, paths.relativeDirPath);
|
|
7656
|
+
const dirPaths = await findFilesByGlobs(join61(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
7589
7657
|
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7590
7658
|
const rulesyncSkills = await Promise.all(
|
|
7591
7659
|
dirNames.map(
|
|
@@ -7602,8 +7670,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7602
7670
|
async loadToolDirs() {
|
|
7603
7671
|
const factory = this.getFactory(this.toolTarget);
|
|
7604
7672
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7605
|
-
const skillsDirPath =
|
|
7606
|
-
const dirPaths = await findFilesByGlobs(
|
|
7673
|
+
const skillsDirPath = join61(this.baseDir, paths.relativeDirPath);
|
|
7674
|
+
const dirPaths = await findFilesByGlobs(join61(skillsDirPath, "*"), { type: "dir" });
|
|
7607
7675
|
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7608
7676
|
const toolSkills = await Promise.all(
|
|
7609
7677
|
dirNames.map(
|
|
@@ -7620,8 +7688,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7620
7688
|
async loadToolDirsToDelete() {
|
|
7621
7689
|
const factory = this.getFactory(this.toolTarget);
|
|
7622
7690
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7623
|
-
const skillsDirPath =
|
|
7624
|
-
const dirPaths = await findFilesByGlobs(
|
|
7691
|
+
const skillsDirPath = join61(this.baseDir, paths.relativeDirPath);
|
|
7692
|
+
const dirPaths = await findFilesByGlobs(join61(skillsDirPath, "*"), { type: "dir" });
|
|
7625
7693
|
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7626
7694
|
const toolSkills = dirNames.map(
|
|
7627
7695
|
(dirName) => factory.class.forDeletion({
|
|
@@ -7670,10 +7738,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7670
7738
|
};
|
|
7671
7739
|
|
|
7672
7740
|
// src/features/subagents/agentsmd-subagent.ts
|
|
7673
|
-
import { join as
|
|
7741
|
+
import { join as join63 } from "path";
|
|
7674
7742
|
|
|
7675
7743
|
// src/features/subagents/simulated-subagent.ts
|
|
7676
|
-
import { basename as basename18, join as
|
|
7744
|
+
import { basename as basename18, join as join62 } from "path";
|
|
7677
7745
|
import { z as z31 } from "zod/mini";
|
|
7678
7746
|
|
|
7679
7747
|
// src/features/subagents/tool-subagent.ts
|
|
@@ -7729,7 +7797,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7729
7797
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7730
7798
|
if (!result.success) {
|
|
7731
7799
|
throw new Error(
|
|
7732
|
-
`Invalid frontmatter in ${
|
|
7800
|
+
`Invalid frontmatter in ${join62(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7733
7801
|
);
|
|
7734
7802
|
}
|
|
7735
7803
|
}
|
|
@@ -7780,7 +7848,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7780
7848
|
return {
|
|
7781
7849
|
success: false,
|
|
7782
7850
|
error: new Error(
|
|
7783
|
-
`Invalid frontmatter in ${
|
|
7851
|
+
`Invalid frontmatter in ${join62(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7784
7852
|
)
|
|
7785
7853
|
};
|
|
7786
7854
|
}
|
|
@@ -7790,7 +7858,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7790
7858
|
relativeFilePath,
|
|
7791
7859
|
validate = true
|
|
7792
7860
|
}) {
|
|
7793
|
-
const filePath =
|
|
7861
|
+
const filePath = join62(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
7794
7862
|
const fileContent = await readFileContent(filePath);
|
|
7795
7863
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7796
7864
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7826,7 +7894,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7826
7894
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
7827
7895
|
static getSettablePaths() {
|
|
7828
7896
|
return {
|
|
7829
|
-
relativeDirPath:
|
|
7897
|
+
relativeDirPath: join63(".agents", "subagents")
|
|
7830
7898
|
};
|
|
7831
7899
|
}
|
|
7832
7900
|
static async fromFile(params) {
|
|
@@ -7849,11 +7917,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
7849
7917
|
};
|
|
7850
7918
|
|
|
7851
7919
|
// src/features/subagents/codexcli-subagent.ts
|
|
7852
|
-
import { join as
|
|
7920
|
+
import { join as join64 } from "path";
|
|
7853
7921
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
7854
7922
|
static getSettablePaths() {
|
|
7855
7923
|
return {
|
|
7856
|
-
relativeDirPath:
|
|
7924
|
+
relativeDirPath: join64(".codex", "subagents")
|
|
7857
7925
|
};
|
|
7858
7926
|
}
|
|
7859
7927
|
static async fromFile(params) {
|
|
@@ -7876,11 +7944,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
7876
7944
|
};
|
|
7877
7945
|
|
|
7878
7946
|
// src/features/subagents/cursor-subagent.ts
|
|
7879
|
-
import { join as
|
|
7947
|
+
import { join as join65 } from "path";
|
|
7880
7948
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
7881
7949
|
static getSettablePaths() {
|
|
7882
7950
|
return {
|
|
7883
|
-
relativeDirPath:
|
|
7951
|
+
relativeDirPath: join65(".cursor", "subagents")
|
|
7884
7952
|
};
|
|
7885
7953
|
}
|
|
7886
7954
|
static async fromFile(params) {
|
|
@@ -7903,11 +7971,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
7903
7971
|
};
|
|
7904
7972
|
|
|
7905
7973
|
// src/features/subagents/geminicli-subagent.ts
|
|
7906
|
-
import { join as
|
|
7974
|
+
import { join as join66 } from "path";
|
|
7907
7975
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
7908
7976
|
static getSettablePaths() {
|
|
7909
7977
|
return {
|
|
7910
|
-
relativeDirPath:
|
|
7978
|
+
relativeDirPath: join66(".gemini", "subagents")
|
|
7911
7979
|
};
|
|
7912
7980
|
}
|
|
7913
7981
|
static async fromFile(params) {
|
|
@@ -7930,11 +7998,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
7930
7998
|
};
|
|
7931
7999
|
|
|
7932
8000
|
// src/features/subagents/roo-subagent.ts
|
|
7933
|
-
import { join as
|
|
8001
|
+
import { join as join67 } from "path";
|
|
7934
8002
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
7935
8003
|
static getSettablePaths() {
|
|
7936
8004
|
return {
|
|
7937
|
-
relativeDirPath:
|
|
8005
|
+
relativeDirPath: join67(".roo", "subagents")
|
|
7938
8006
|
};
|
|
7939
8007
|
}
|
|
7940
8008
|
static async fromFile(params) {
|
|
@@ -7957,15 +8025,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
7957
8025
|
};
|
|
7958
8026
|
|
|
7959
8027
|
// src/features/subagents/subagents-processor.ts
|
|
7960
|
-
import { basename as basename21, join as
|
|
8028
|
+
import { basename as basename21, join as join73 } from "path";
|
|
7961
8029
|
import { z as z37 } from "zod/mini";
|
|
7962
8030
|
|
|
7963
8031
|
// src/features/subagents/claudecode-subagent.ts
|
|
7964
|
-
import { join as
|
|
8032
|
+
import { join as join69 } from "path";
|
|
7965
8033
|
import { z as z33 } from "zod/mini";
|
|
7966
8034
|
|
|
7967
8035
|
// src/features/subagents/rulesync-subagent.ts
|
|
7968
|
-
import { basename as basename19, join as
|
|
8036
|
+
import { basename as basename19, join as join68 } from "path";
|
|
7969
8037
|
import { z as z32 } from "zod/mini";
|
|
7970
8038
|
var RulesyncSubagentFrontmatterSchema = z32.looseObject({
|
|
7971
8039
|
targets: RulesyncTargetsSchema,
|
|
@@ -7980,7 +8048,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7980
8048
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7981
8049
|
if (!result.success) {
|
|
7982
8050
|
throw new Error(
|
|
7983
|
-
`Invalid frontmatter in ${
|
|
8051
|
+
`Invalid frontmatter in ${join68(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7984
8052
|
);
|
|
7985
8053
|
}
|
|
7986
8054
|
}
|
|
@@ -8013,7 +8081,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
8013
8081
|
return {
|
|
8014
8082
|
success: false,
|
|
8015
8083
|
error: new Error(
|
|
8016
|
-
`Invalid frontmatter in ${
|
|
8084
|
+
`Invalid frontmatter in ${join68(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8017
8085
|
)
|
|
8018
8086
|
};
|
|
8019
8087
|
}
|
|
@@ -8022,7 +8090,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
8022
8090
|
relativeFilePath
|
|
8023
8091
|
}) {
|
|
8024
8092
|
const fileContent = await readFileContent(
|
|
8025
|
-
|
|
8093
|
+
join68(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
8026
8094
|
);
|
|
8027
8095
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8028
8096
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8057,7 +8125,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8057
8125
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8058
8126
|
if (!result.success) {
|
|
8059
8127
|
throw new Error(
|
|
8060
|
-
`Invalid frontmatter in ${
|
|
8128
|
+
`Invalid frontmatter in ${join69(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8061
8129
|
);
|
|
8062
8130
|
}
|
|
8063
8131
|
}
|
|
@@ -8069,7 +8137,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8069
8137
|
}
|
|
8070
8138
|
static getSettablePaths(_options = {}) {
|
|
8071
8139
|
return {
|
|
8072
|
-
relativeDirPath:
|
|
8140
|
+
relativeDirPath: join69(".claude", "agents")
|
|
8073
8141
|
};
|
|
8074
8142
|
}
|
|
8075
8143
|
getFrontmatter() {
|
|
@@ -8143,7 +8211,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8143
8211
|
return {
|
|
8144
8212
|
success: false,
|
|
8145
8213
|
error: new Error(
|
|
8146
|
-
`Invalid frontmatter in ${
|
|
8214
|
+
`Invalid frontmatter in ${join69(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8147
8215
|
)
|
|
8148
8216
|
};
|
|
8149
8217
|
}
|
|
@@ -8161,7 +8229,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8161
8229
|
global = false
|
|
8162
8230
|
}) {
|
|
8163
8231
|
const paths = this.getSettablePaths({ global });
|
|
8164
|
-
const filePath =
|
|
8232
|
+
const filePath = join69(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8165
8233
|
const fileContent = await readFileContent(filePath);
|
|
8166
8234
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8167
8235
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8196,7 +8264,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8196
8264
|
};
|
|
8197
8265
|
|
|
8198
8266
|
// src/features/subagents/copilot-subagent.ts
|
|
8199
|
-
import { join as
|
|
8267
|
+
import { join as join70 } from "path";
|
|
8200
8268
|
import { z as z34 } from "zod/mini";
|
|
8201
8269
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
8202
8270
|
var CopilotSubagentFrontmatterSchema = z34.looseObject({
|
|
@@ -8222,7 +8290,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8222
8290
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8223
8291
|
if (!result.success) {
|
|
8224
8292
|
throw new Error(
|
|
8225
|
-
`Invalid frontmatter in ${
|
|
8293
|
+
`Invalid frontmatter in ${join70(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8226
8294
|
);
|
|
8227
8295
|
}
|
|
8228
8296
|
}
|
|
@@ -8234,7 +8302,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8234
8302
|
}
|
|
8235
8303
|
static getSettablePaths(_options = {}) {
|
|
8236
8304
|
return {
|
|
8237
|
-
relativeDirPath:
|
|
8305
|
+
relativeDirPath: join70(".github", "agents")
|
|
8238
8306
|
};
|
|
8239
8307
|
}
|
|
8240
8308
|
getFrontmatter() {
|
|
@@ -8308,7 +8376,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8308
8376
|
return {
|
|
8309
8377
|
success: false,
|
|
8310
8378
|
error: new Error(
|
|
8311
|
-
`Invalid frontmatter in ${
|
|
8379
|
+
`Invalid frontmatter in ${join70(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8312
8380
|
)
|
|
8313
8381
|
};
|
|
8314
8382
|
}
|
|
@@ -8326,7 +8394,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8326
8394
|
global = false
|
|
8327
8395
|
}) {
|
|
8328
8396
|
const paths = this.getSettablePaths({ global });
|
|
8329
|
-
const filePath =
|
|
8397
|
+
const filePath = join70(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8330
8398
|
const fileContent = await readFileContent(filePath);
|
|
8331
8399
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8332
8400
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8362,7 +8430,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8362
8430
|
};
|
|
8363
8431
|
|
|
8364
8432
|
// src/features/subagents/kiro-subagent.ts
|
|
8365
|
-
import { join as
|
|
8433
|
+
import { join as join71 } from "path";
|
|
8366
8434
|
import { z as z35 } from "zod/mini";
|
|
8367
8435
|
var KiroCliSubagentJsonSchema = z35.looseObject({
|
|
8368
8436
|
name: z35.string(),
|
|
@@ -8390,7 +8458,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8390
8458
|
}
|
|
8391
8459
|
static getSettablePaths(_options = {}) {
|
|
8392
8460
|
return {
|
|
8393
|
-
relativeDirPath:
|
|
8461
|
+
relativeDirPath: join71(".kiro", "agents")
|
|
8394
8462
|
};
|
|
8395
8463
|
}
|
|
8396
8464
|
getBody() {
|
|
@@ -8470,7 +8538,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8470
8538
|
global = false
|
|
8471
8539
|
}) {
|
|
8472
8540
|
const paths = this.getSettablePaths({ global });
|
|
8473
|
-
const filePath =
|
|
8541
|
+
const filePath = join71(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8474
8542
|
const fileContent = await readFileContent(filePath);
|
|
8475
8543
|
return new _KiroSubagent({
|
|
8476
8544
|
baseDir,
|
|
@@ -8499,7 +8567,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8499
8567
|
};
|
|
8500
8568
|
|
|
8501
8569
|
// src/features/subagents/opencode-subagent.ts
|
|
8502
|
-
import { basename as basename20, join as
|
|
8570
|
+
import { basename as basename20, join as join72 } from "path";
|
|
8503
8571
|
import { z as z36 } from "zod/mini";
|
|
8504
8572
|
var OpenCodeSubagentFrontmatterSchema = z36.looseObject({
|
|
8505
8573
|
description: z36.string(),
|
|
@@ -8514,7 +8582,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8514
8582
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8515
8583
|
if (!result.success) {
|
|
8516
8584
|
throw new Error(
|
|
8517
|
-
`Invalid frontmatter in ${
|
|
8585
|
+
`Invalid frontmatter in ${join72(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8518
8586
|
);
|
|
8519
8587
|
}
|
|
8520
8588
|
}
|
|
@@ -8528,7 +8596,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8528
8596
|
global = false
|
|
8529
8597
|
} = {}) {
|
|
8530
8598
|
return {
|
|
8531
|
-
relativeDirPath: global ?
|
|
8599
|
+
relativeDirPath: global ? join72(".config", "opencode", "agent") : join72(".opencode", "agent")
|
|
8532
8600
|
};
|
|
8533
8601
|
}
|
|
8534
8602
|
getFrontmatter() {
|
|
@@ -8594,7 +8662,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8594
8662
|
return {
|
|
8595
8663
|
success: false,
|
|
8596
8664
|
error: new Error(
|
|
8597
|
-
`Invalid frontmatter in ${
|
|
8665
|
+
`Invalid frontmatter in ${join72(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8598
8666
|
)
|
|
8599
8667
|
};
|
|
8600
8668
|
}
|
|
@@ -8611,7 +8679,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8611
8679
|
global = false
|
|
8612
8680
|
}) {
|
|
8613
8681
|
const paths = this.getSettablePaths({ global });
|
|
8614
|
-
const filePath =
|
|
8682
|
+
const filePath = join72(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8615
8683
|
const fileContent = await readFileContent(filePath);
|
|
8616
8684
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8617
8685
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8813,7 +8881,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8813
8881
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
8814
8882
|
*/
|
|
8815
8883
|
async loadRulesyncFiles() {
|
|
8816
|
-
const subagentsDir =
|
|
8884
|
+
const subagentsDir = join73(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
8817
8885
|
const dirExists = await directoryExists(subagentsDir);
|
|
8818
8886
|
if (!dirExists) {
|
|
8819
8887
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -8828,7 +8896,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8828
8896
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
8829
8897
|
const rulesyncSubagents = [];
|
|
8830
8898
|
for (const mdFile of mdFiles) {
|
|
8831
|
-
const filepath =
|
|
8899
|
+
const filepath = join73(subagentsDir, mdFile);
|
|
8832
8900
|
try {
|
|
8833
8901
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
8834
8902
|
relativeFilePath: mdFile,
|
|
@@ -8858,7 +8926,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8858
8926
|
const factory = this.getFactory(this.toolTarget);
|
|
8859
8927
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
8860
8928
|
const subagentFilePaths = await findFilesByGlobs(
|
|
8861
|
-
|
|
8929
|
+
join73(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
8862
8930
|
);
|
|
8863
8931
|
if (forDeletion) {
|
|
8864
8932
|
const toolSubagents2 = subagentFilePaths.map(
|
|
@@ -8908,13 +8976,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8908
8976
|
};
|
|
8909
8977
|
|
|
8910
8978
|
// src/features/rules/agentsmd-rule.ts
|
|
8911
|
-
import { join as
|
|
8979
|
+
import { join as join76 } from "path";
|
|
8912
8980
|
|
|
8913
8981
|
// src/features/rules/tool-rule.ts
|
|
8914
|
-
import { join as
|
|
8982
|
+
import { join as join75 } from "path";
|
|
8915
8983
|
|
|
8916
8984
|
// src/features/rules/rulesync-rule.ts
|
|
8917
|
-
import {
|
|
8985
|
+
import { join as join74 } from "path";
|
|
8918
8986
|
import { z as z38 } from "zod/mini";
|
|
8919
8987
|
var RulesyncRuleFrontmatterSchema = z38.object({
|
|
8920
8988
|
root: z38.optional(z38.boolean()),
|
|
@@ -8962,7 +9030,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8962
9030
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8963
9031
|
if (!result.success) {
|
|
8964
9032
|
throw new Error(
|
|
8965
|
-
`Invalid frontmatter in ${
|
|
9033
|
+
`Invalid frontmatter in ${join74(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8966
9034
|
);
|
|
8967
9035
|
}
|
|
8968
9036
|
}
|
|
@@ -8997,57 +9065,16 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8997
9065
|
return {
|
|
8998
9066
|
success: false,
|
|
8999
9067
|
error: new Error(
|
|
9000
|
-
`Invalid frontmatter in ${
|
|
9068
|
+
`Invalid frontmatter in ${join74(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9001
9069
|
)
|
|
9002
9070
|
};
|
|
9003
9071
|
}
|
|
9004
9072
|
}
|
|
9005
|
-
static async fromFileLegacy({
|
|
9006
|
-
relativeFilePath,
|
|
9007
|
-
validate = true
|
|
9008
|
-
}) {
|
|
9009
|
-
const legacyPath = join73(
|
|
9010
|
-
process.cwd(),
|
|
9011
|
-
this.getSettablePaths().legacy.relativeDirPath,
|
|
9012
|
-
relativeFilePath
|
|
9013
|
-
);
|
|
9014
|
-
const recommendedPath = join73(
|
|
9015
|
-
this.getSettablePaths().recommended.relativeDirPath,
|
|
9016
|
-
relativeFilePath
|
|
9017
|
-
);
|
|
9018
|
-
logger.warn(
|
|
9019
|
-
`\u26A0\uFE0F Using deprecated path "${legacyPath}". Please migrate to "${recommendedPath}"`
|
|
9020
|
-
);
|
|
9021
|
-
const fileContent = await readFileContent(legacyPath);
|
|
9022
|
-
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9023
|
-
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9024
|
-
if (!result.success) {
|
|
9025
|
-
throw new Error(`Invalid frontmatter in ${legacyPath}: ${formatError(result.error)}`);
|
|
9026
|
-
}
|
|
9027
|
-
const validatedFrontmatter = {
|
|
9028
|
-
root: result.data.root ?? false,
|
|
9029
|
-
localRoot: result.data.localRoot ?? false,
|
|
9030
|
-
targets: result.data.targets ?? ["*"],
|
|
9031
|
-
description: result.data.description ?? "",
|
|
9032
|
-
globs: result.data.globs ?? [],
|
|
9033
|
-
agentsmd: result.data.agentsmd,
|
|
9034
|
-
cursor: result.data.cursor
|
|
9035
|
-
};
|
|
9036
|
-
const filename = basename22(legacyPath);
|
|
9037
|
-
return new _RulesyncRule({
|
|
9038
|
-
baseDir: process.cwd(),
|
|
9039
|
-
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
9040
|
-
relativeFilePath: filename,
|
|
9041
|
-
frontmatter: validatedFrontmatter,
|
|
9042
|
-
body: content.trim(),
|
|
9043
|
-
validate
|
|
9044
|
-
});
|
|
9045
|
-
}
|
|
9046
9073
|
static async fromFile({
|
|
9047
9074
|
relativeFilePath,
|
|
9048
9075
|
validate = true
|
|
9049
9076
|
}) {
|
|
9050
|
-
const filePath =
|
|
9077
|
+
const filePath = join74(
|
|
9051
9078
|
process.cwd(),
|
|
9052
9079
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
9053
9080
|
relativeFilePath
|
|
@@ -9067,11 +9094,10 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
9067
9094
|
agentsmd: result.data.agentsmd,
|
|
9068
9095
|
cursor: result.data.cursor
|
|
9069
9096
|
};
|
|
9070
|
-
const filename = basename22(filePath);
|
|
9071
9097
|
return new _RulesyncRule({
|
|
9072
9098
|
baseDir: process.cwd(),
|
|
9073
9099
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
9074
|
-
relativeFilePath
|
|
9100
|
+
relativeFilePath,
|
|
9075
9101
|
frontmatter: validatedFrontmatter,
|
|
9076
9102
|
body: content.trim(),
|
|
9077
9103
|
validate
|
|
@@ -9150,7 +9176,7 @@ var ToolRule = class extends ToolFile {
|
|
|
9150
9176
|
rulesyncRule,
|
|
9151
9177
|
validate = true,
|
|
9152
9178
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
9153
|
-
nonRootPath = { relativeDirPath:
|
|
9179
|
+
nonRootPath = { relativeDirPath: join75(".agents", "memories") }
|
|
9154
9180
|
}) {
|
|
9155
9181
|
const params = this.buildToolRuleParamsDefault({
|
|
9156
9182
|
baseDir,
|
|
@@ -9161,7 +9187,7 @@ var ToolRule = class extends ToolFile {
|
|
|
9161
9187
|
});
|
|
9162
9188
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
9163
9189
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
9164
|
-
params.relativeDirPath =
|
|
9190
|
+
params.relativeDirPath = join75(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
9165
9191
|
params.relativeFilePath = "AGENTS.md";
|
|
9166
9192
|
}
|
|
9167
9193
|
return params;
|
|
@@ -9226,7 +9252,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9226
9252
|
relativeFilePath: "AGENTS.md"
|
|
9227
9253
|
},
|
|
9228
9254
|
nonRoot: {
|
|
9229
|
-
relativeDirPath:
|
|
9255
|
+
relativeDirPath: join76(".agents", "memories")
|
|
9230
9256
|
}
|
|
9231
9257
|
};
|
|
9232
9258
|
}
|
|
@@ -9236,8 +9262,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9236
9262
|
validate = true
|
|
9237
9263
|
}) {
|
|
9238
9264
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
9239
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
9240
|
-
const fileContent = await readFileContent(
|
|
9265
|
+
const relativePath = isRoot ? "AGENTS.md" : join76(".agents", "memories", relativeFilePath);
|
|
9266
|
+
const fileContent = await readFileContent(join76(baseDir, relativePath));
|
|
9241
9267
|
return new _AgentsMdRule({
|
|
9242
9268
|
baseDir,
|
|
9243
9269
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9292,7 +9318,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9292
9318
|
};
|
|
9293
9319
|
|
|
9294
9320
|
// src/features/rules/antigravity-rule.ts
|
|
9295
|
-
import { join as
|
|
9321
|
+
import { join as join77 } from "path";
|
|
9296
9322
|
import { z as z39 } from "zod/mini";
|
|
9297
9323
|
var AntigravityRuleFrontmatterSchema = z39.looseObject({
|
|
9298
9324
|
trigger: z39.optional(
|
|
@@ -9451,7 +9477,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9451
9477
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9452
9478
|
if (!result.success) {
|
|
9453
9479
|
throw new Error(
|
|
9454
|
-
`Invalid frontmatter in ${
|
|
9480
|
+
`Invalid frontmatter in ${join77(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9455
9481
|
);
|
|
9456
9482
|
}
|
|
9457
9483
|
}
|
|
@@ -9466,7 +9492,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9466
9492
|
static getSettablePaths() {
|
|
9467
9493
|
return {
|
|
9468
9494
|
nonRoot: {
|
|
9469
|
-
relativeDirPath:
|
|
9495
|
+
relativeDirPath: join77(".agent", "rules")
|
|
9470
9496
|
}
|
|
9471
9497
|
};
|
|
9472
9498
|
}
|
|
@@ -9475,7 +9501,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9475
9501
|
relativeFilePath,
|
|
9476
9502
|
validate = true
|
|
9477
9503
|
}) {
|
|
9478
|
-
const filePath =
|
|
9504
|
+
const filePath = join77(
|
|
9479
9505
|
baseDir,
|
|
9480
9506
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
9481
9507
|
relativeFilePath
|
|
@@ -9616,7 +9642,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9616
9642
|
};
|
|
9617
9643
|
|
|
9618
9644
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
9619
|
-
import { join as
|
|
9645
|
+
import { join as join78 } from "path";
|
|
9620
9646
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
9621
9647
|
toRulesyncRule() {
|
|
9622
9648
|
const rulesyncFrontmatter = {
|
|
@@ -9642,7 +9668,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9642
9668
|
relativeFilePath: ".augment-guidelines"
|
|
9643
9669
|
},
|
|
9644
9670
|
nonRoot: {
|
|
9645
|
-
relativeDirPath:
|
|
9671
|
+
relativeDirPath: join78(".augment", "rules")
|
|
9646
9672
|
}
|
|
9647
9673
|
};
|
|
9648
9674
|
}
|
|
@@ -9677,8 +9703,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9677
9703
|
}) {
|
|
9678
9704
|
const settablePaths = this.getSettablePaths();
|
|
9679
9705
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
9680
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
9681
|
-
const fileContent = await readFileContent(
|
|
9706
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join78(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9707
|
+
const fileContent = await readFileContent(join78(baseDir, relativePath));
|
|
9682
9708
|
return new _AugmentcodeLegacyRule({
|
|
9683
9709
|
baseDir,
|
|
9684
9710
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -9707,7 +9733,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9707
9733
|
};
|
|
9708
9734
|
|
|
9709
9735
|
// src/features/rules/augmentcode-rule.ts
|
|
9710
|
-
import { join as
|
|
9736
|
+
import { join as join79 } from "path";
|
|
9711
9737
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
9712
9738
|
toRulesyncRule() {
|
|
9713
9739
|
return this.toRulesyncRuleDefault();
|
|
@@ -9715,7 +9741,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9715
9741
|
static getSettablePaths() {
|
|
9716
9742
|
return {
|
|
9717
9743
|
nonRoot: {
|
|
9718
|
-
relativeDirPath:
|
|
9744
|
+
relativeDirPath: join79(".augment", "rules")
|
|
9719
9745
|
}
|
|
9720
9746
|
};
|
|
9721
9747
|
}
|
|
@@ -9739,7 +9765,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9739
9765
|
validate = true
|
|
9740
9766
|
}) {
|
|
9741
9767
|
const fileContent = await readFileContent(
|
|
9742
|
-
|
|
9768
|
+
join79(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9743
9769
|
);
|
|
9744
9770
|
const { body: content } = parseFrontmatter(fileContent);
|
|
9745
9771
|
return new _AugmentcodeRule({
|
|
@@ -9775,7 +9801,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9775
9801
|
};
|
|
9776
9802
|
|
|
9777
9803
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
9778
|
-
import { join as
|
|
9804
|
+
import { join as join80 } from "path";
|
|
9779
9805
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
9780
9806
|
static getSettablePaths({
|
|
9781
9807
|
global
|
|
@@ -9794,7 +9820,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9794
9820
|
relativeFilePath: "CLAUDE.md"
|
|
9795
9821
|
},
|
|
9796
9822
|
nonRoot: {
|
|
9797
|
-
relativeDirPath:
|
|
9823
|
+
relativeDirPath: join80(".claude", "memories")
|
|
9798
9824
|
}
|
|
9799
9825
|
};
|
|
9800
9826
|
}
|
|
@@ -9809,7 +9835,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9809
9835
|
if (isRoot) {
|
|
9810
9836
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9811
9837
|
const fileContent2 = await readFileContent(
|
|
9812
|
-
|
|
9838
|
+
join80(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9813
9839
|
);
|
|
9814
9840
|
return new _ClaudecodeLegacyRule({
|
|
9815
9841
|
baseDir,
|
|
@@ -9823,8 +9849,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9823
9849
|
if (!paths.nonRoot) {
|
|
9824
9850
|
throw new Error("nonRoot path is not set");
|
|
9825
9851
|
}
|
|
9826
|
-
const relativePath =
|
|
9827
|
-
const fileContent = await readFileContent(
|
|
9852
|
+
const relativePath = join80(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9853
|
+
const fileContent = await readFileContent(join80(baseDir, relativePath));
|
|
9828
9854
|
return new _ClaudecodeLegacyRule({
|
|
9829
9855
|
baseDir,
|
|
9830
9856
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9883,7 +9909,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9883
9909
|
};
|
|
9884
9910
|
|
|
9885
9911
|
// src/features/rules/claudecode-rule.ts
|
|
9886
|
-
import { join as
|
|
9912
|
+
import { join as join81 } from "path";
|
|
9887
9913
|
import { z as z40 } from "zod/mini";
|
|
9888
9914
|
var ClaudecodeRuleFrontmatterSchema = z40.object({
|
|
9889
9915
|
paths: z40.optional(z40.string())
|
|
@@ -9904,11 +9930,11 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9904
9930
|
}
|
|
9905
9931
|
return {
|
|
9906
9932
|
root: {
|
|
9907
|
-
relativeDirPath: ".
|
|
9933
|
+
relativeDirPath: ".",
|
|
9908
9934
|
relativeFilePath: "CLAUDE.md"
|
|
9909
9935
|
},
|
|
9910
9936
|
nonRoot: {
|
|
9911
|
-
relativeDirPath:
|
|
9937
|
+
relativeDirPath: join81(".claude", "rules")
|
|
9912
9938
|
}
|
|
9913
9939
|
};
|
|
9914
9940
|
}
|
|
@@ -9917,7 +9943,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9917
9943
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9918
9944
|
if (!result.success) {
|
|
9919
9945
|
throw new Error(
|
|
9920
|
-
`Invalid frontmatter in ${
|
|
9946
|
+
`Invalid frontmatter in ${join81(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9921
9947
|
);
|
|
9922
9948
|
}
|
|
9923
9949
|
}
|
|
@@ -9945,7 +9971,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9945
9971
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
9946
9972
|
if (isRoot) {
|
|
9947
9973
|
const fileContent2 = await readFileContent(
|
|
9948
|
-
|
|
9974
|
+
join81(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
9949
9975
|
);
|
|
9950
9976
|
return new _ClaudecodeRule({
|
|
9951
9977
|
baseDir,
|
|
@@ -9960,13 +9986,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9960
9986
|
if (!paths.nonRoot) {
|
|
9961
9987
|
throw new Error("nonRoot path is not set");
|
|
9962
9988
|
}
|
|
9963
|
-
const relativePath =
|
|
9964
|
-
const fileContent = await readFileContent(
|
|
9989
|
+
const relativePath = join81(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9990
|
+
const fileContent = await readFileContent(join81(baseDir, relativePath));
|
|
9965
9991
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9966
9992
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9967
9993
|
if (!result.success) {
|
|
9968
9994
|
throw new Error(
|
|
9969
|
-
`Invalid frontmatter in ${
|
|
9995
|
+
`Invalid frontmatter in ${join81(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
9970
9996
|
);
|
|
9971
9997
|
}
|
|
9972
9998
|
return new _ClaudecodeRule({
|
|
@@ -10073,7 +10099,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
10073
10099
|
return {
|
|
10074
10100
|
success: false,
|
|
10075
10101
|
error: new Error(
|
|
10076
|
-
`Invalid frontmatter in ${
|
|
10102
|
+
`Invalid frontmatter in ${join81(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10077
10103
|
)
|
|
10078
10104
|
};
|
|
10079
10105
|
}
|
|
@@ -10093,7 +10119,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
10093
10119
|
};
|
|
10094
10120
|
|
|
10095
10121
|
// src/features/rules/cline-rule.ts
|
|
10096
|
-
import { join as
|
|
10122
|
+
import { join as join82 } from "path";
|
|
10097
10123
|
import { z as z41 } from "zod/mini";
|
|
10098
10124
|
var ClineRuleFrontmatterSchema = z41.object({
|
|
10099
10125
|
description: z41.string()
|
|
@@ -10138,7 +10164,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
10138
10164
|
validate = true
|
|
10139
10165
|
}) {
|
|
10140
10166
|
const fileContent = await readFileContent(
|
|
10141
|
-
|
|
10167
|
+
join82(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10142
10168
|
);
|
|
10143
10169
|
return new _ClineRule({
|
|
10144
10170
|
baseDir,
|
|
@@ -10164,7 +10190,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
10164
10190
|
};
|
|
10165
10191
|
|
|
10166
10192
|
// src/features/rules/codexcli-rule.ts
|
|
10167
|
-
import { join as
|
|
10193
|
+
import { join as join83 } from "path";
|
|
10168
10194
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
10169
10195
|
static getSettablePaths({
|
|
10170
10196
|
global
|
|
@@ -10183,7 +10209,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10183
10209
|
relativeFilePath: "AGENTS.md"
|
|
10184
10210
|
},
|
|
10185
10211
|
nonRoot: {
|
|
10186
|
-
relativeDirPath:
|
|
10212
|
+
relativeDirPath: join83(".codex", "memories")
|
|
10187
10213
|
}
|
|
10188
10214
|
};
|
|
10189
10215
|
}
|
|
@@ -10198,7 +10224,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10198
10224
|
if (isRoot) {
|
|
10199
10225
|
const relativePath2 = paths.root.relativeFilePath;
|
|
10200
10226
|
const fileContent2 = await readFileContent(
|
|
10201
|
-
|
|
10227
|
+
join83(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
10202
10228
|
);
|
|
10203
10229
|
return new _CodexcliRule({
|
|
10204
10230
|
baseDir,
|
|
@@ -10212,8 +10238,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10212
10238
|
if (!paths.nonRoot) {
|
|
10213
10239
|
throw new Error("nonRoot path is not set");
|
|
10214
10240
|
}
|
|
10215
|
-
const relativePath =
|
|
10216
|
-
const fileContent = await readFileContent(
|
|
10241
|
+
const relativePath = join83(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10242
|
+
const fileContent = await readFileContent(join83(baseDir, relativePath));
|
|
10217
10243
|
return new _CodexcliRule({
|
|
10218
10244
|
baseDir,
|
|
10219
10245
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10272,7 +10298,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10272
10298
|
};
|
|
10273
10299
|
|
|
10274
10300
|
// src/features/rules/copilot-rule.ts
|
|
10275
|
-
import { join as
|
|
10301
|
+
import { join as join84 } from "path";
|
|
10276
10302
|
import { z as z42 } from "zod/mini";
|
|
10277
10303
|
var CopilotRuleFrontmatterSchema = z42.object({
|
|
10278
10304
|
description: z42.optional(z42.string()),
|
|
@@ -10289,7 +10315,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10289
10315
|
relativeFilePath: "copilot-instructions.md"
|
|
10290
10316
|
},
|
|
10291
10317
|
nonRoot: {
|
|
10292
|
-
relativeDirPath:
|
|
10318
|
+
relativeDirPath: join84(".github", "instructions")
|
|
10293
10319
|
}
|
|
10294
10320
|
};
|
|
10295
10321
|
}
|
|
@@ -10298,7 +10324,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10298
10324
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10299
10325
|
if (!result.success) {
|
|
10300
10326
|
throw new Error(
|
|
10301
|
-
`Invalid frontmatter in ${
|
|
10327
|
+
`Invalid frontmatter in ${join84(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10302
10328
|
);
|
|
10303
10329
|
}
|
|
10304
10330
|
}
|
|
@@ -10380,11 +10406,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10380
10406
|
validate = true
|
|
10381
10407
|
}) {
|
|
10382
10408
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
10383
|
-
const relativePath = isRoot ?
|
|
10409
|
+
const relativePath = isRoot ? join84(
|
|
10384
10410
|
this.getSettablePaths().root.relativeDirPath,
|
|
10385
10411
|
this.getSettablePaths().root.relativeFilePath
|
|
10386
|
-
) :
|
|
10387
|
-
const fileContent = await readFileContent(
|
|
10412
|
+
) : join84(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10413
|
+
const fileContent = await readFileContent(join84(baseDir, relativePath));
|
|
10388
10414
|
if (isRoot) {
|
|
10389
10415
|
return new _CopilotRule({
|
|
10390
10416
|
baseDir,
|
|
@@ -10400,7 +10426,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10400
10426
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10401
10427
|
if (!result.success) {
|
|
10402
10428
|
throw new Error(
|
|
10403
|
-
`Invalid frontmatter in ${
|
|
10429
|
+
`Invalid frontmatter in ${join84(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10404
10430
|
);
|
|
10405
10431
|
}
|
|
10406
10432
|
return new _CopilotRule({
|
|
@@ -10440,7 +10466,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10440
10466
|
return {
|
|
10441
10467
|
success: false,
|
|
10442
10468
|
error: new Error(
|
|
10443
|
-
`Invalid frontmatter in ${
|
|
10469
|
+
`Invalid frontmatter in ${join84(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10444
10470
|
)
|
|
10445
10471
|
};
|
|
10446
10472
|
}
|
|
@@ -10460,7 +10486,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10460
10486
|
};
|
|
10461
10487
|
|
|
10462
10488
|
// src/features/rules/cursor-rule.ts
|
|
10463
|
-
import {
|
|
10489
|
+
import { join as join85 } from "path";
|
|
10464
10490
|
import { z as z43 } from "zod/mini";
|
|
10465
10491
|
var CursorRuleFrontmatterSchema = z43.object({
|
|
10466
10492
|
description: z43.optional(z43.string()),
|
|
@@ -10473,7 +10499,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10473
10499
|
static getSettablePaths() {
|
|
10474
10500
|
return {
|
|
10475
10501
|
nonRoot: {
|
|
10476
|
-
relativeDirPath:
|
|
10502
|
+
relativeDirPath: join85(".cursor", "rules")
|
|
10477
10503
|
}
|
|
10478
10504
|
};
|
|
10479
10505
|
}
|
|
@@ -10482,7 +10508,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10482
10508
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10483
10509
|
if (!result.success) {
|
|
10484
10510
|
throw new Error(
|
|
10485
|
-
`Invalid frontmatter in ${
|
|
10511
|
+
`Invalid frontmatter in ${join85(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10486
10512
|
);
|
|
10487
10513
|
}
|
|
10488
10514
|
}
|
|
@@ -10599,19 +10625,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10599
10625
|
validate = true
|
|
10600
10626
|
}) {
|
|
10601
10627
|
const fileContent = await readFileContent(
|
|
10602
|
-
|
|
10628
|
+
join85(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10603
10629
|
);
|
|
10604
10630
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
10605
10631
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10606
10632
|
if (!result.success) {
|
|
10607
10633
|
throw new Error(
|
|
10608
|
-
`Invalid frontmatter in ${
|
|
10634
|
+
`Invalid frontmatter in ${join85(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10609
10635
|
);
|
|
10610
10636
|
}
|
|
10611
10637
|
return new _CursorRule({
|
|
10612
10638
|
baseDir,
|
|
10613
10639
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
10614
|
-
relativeFilePath
|
|
10640
|
+
relativeFilePath,
|
|
10615
10641
|
frontmatter: result.data,
|
|
10616
10642
|
body: content.trim(),
|
|
10617
10643
|
validate
|
|
@@ -10642,7 +10668,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10642
10668
|
return {
|
|
10643
10669
|
success: false,
|
|
10644
10670
|
error: new Error(
|
|
10645
|
-
`Invalid frontmatter in ${
|
|
10671
|
+
`Invalid frontmatter in ${join85(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10646
10672
|
)
|
|
10647
10673
|
};
|
|
10648
10674
|
}
|
|
@@ -10662,7 +10688,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10662
10688
|
};
|
|
10663
10689
|
|
|
10664
10690
|
// src/features/rules/geminicli-rule.ts
|
|
10665
|
-
import { join as
|
|
10691
|
+
import { join as join86 } from "path";
|
|
10666
10692
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
10667
10693
|
static getSettablePaths({
|
|
10668
10694
|
global
|
|
@@ -10681,7 +10707,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10681
10707
|
relativeFilePath: "GEMINI.md"
|
|
10682
10708
|
},
|
|
10683
10709
|
nonRoot: {
|
|
10684
|
-
relativeDirPath:
|
|
10710
|
+
relativeDirPath: join86(".gemini", "memories")
|
|
10685
10711
|
}
|
|
10686
10712
|
};
|
|
10687
10713
|
}
|
|
@@ -10696,7 +10722,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10696
10722
|
if (isRoot) {
|
|
10697
10723
|
const relativePath2 = paths.root.relativeFilePath;
|
|
10698
10724
|
const fileContent2 = await readFileContent(
|
|
10699
|
-
|
|
10725
|
+
join86(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
10700
10726
|
);
|
|
10701
10727
|
return new _GeminiCliRule({
|
|
10702
10728
|
baseDir,
|
|
@@ -10710,8 +10736,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10710
10736
|
if (!paths.nonRoot) {
|
|
10711
10737
|
throw new Error("nonRoot path is not set");
|
|
10712
10738
|
}
|
|
10713
|
-
const relativePath =
|
|
10714
|
-
const fileContent = await readFileContent(
|
|
10739
|
+
const relativePath = join86(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10740
|
+
const fileContent = await readFileContent(join86(baseDir, relativePath));
|
|
10715
10741
|
return new _GeminiCliRule({
|
|
10716
10742
|
baseDir,
|
|
10717
10743
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10770,7 +10796,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10770
10796
|
};
|
|
10771
10797
|
|
|
10772
10798
|
// src/features/rules/junie-rule.ts
|
|
10773
|
-
import { join as
|
|
10799
|
+
import { join as join87 } from "path";
|
|
10774
10800
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
10775
10801
|
static getSettablePaths() {
|
|
10776
10802
|
return {
|
|
@@ -10779,7 +10805,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10779
10805
|
relativeFilePath: "guidelines.md"
|
|
10780
10806
|
},
|
|
10781
10807
|
nonRoot: {
|
|
10782
|
-
relativeDirPath:
|
|
10808
|
+
relativeDirPath: join87(".junie", "memories")
|
|
10783
10809
|
}
|
|
10784
10810
|
};
|
|
10785
10811
|
}
|
|
@@ -10789,8 +10815,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10789
10815
|
validate = true
|
|
10790
10816
|
}) {
|
|
10791
10817
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
10792
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
10793
|
-
const fileContent = await readFileContent(
|
|
10818
|
+
const relativePath = isRoot ? "guidelines.md" : join87(".junie", "memories", relativeFilePath);
|
|
10819
|
+
const fileContent = await readFileContent(join87(baseDir, relativePath));
|
|
10794
10820
|
return new _JunieRule({
|
|
10795
10821
|
baseDir,
|
|
10796
10822
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10845,12 +10871,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10845
10871
|
};
|
|
10846
10872
|
|
|
10847
10873
|
// src/features/rules/kilo-rule.ts
|
|
10848
|
-
import { join as
|
|
10874
|
+
import { join as join88 } from "path";
|
|
10849
10875
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
10850
10876
|
static getSettablePaths(_options = {}) {
|
|
10851
10877
|
return {
|
|
10852
10878
|
nonRoot: {
|
|
10853
|
-
relativeDirPath:
|
|
10879
|
+
relativeDirPath: join88(".kilocode", "rules")
|
|
10854
10880
|
}
|
|
10855
10881
|
};
|
|
10856
10882
|
}
|
|
@@ -10860,7 +10886,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10860
10886
|
validate = true
|
|
10861
10887
|
}) {
|
|
10862
10888
|
const fileContent = await readFileContent(
|
|
10863
|
-
|
|
10889
|
+
join88(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10864
10890
|
);
|
|
10865
10891
|
return new _KiloRule({
|
|
10866
10892
|
baseDir,
|
|
@@ -10912,12 +10938,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10912
10938
|
};
|
|
10913
10939
|
|
|
10914
10940
|
// src/features/rules/kiro-rule.ts
|
|
10915
|
-
import { join as
|
|
10941
|
+
import { join as join89 } from "path";
|
|
10916
10942
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
10917
10943
|
static getSettablePaths() {
|
|
10918
10944
|
return {
|
|
10919
10945
|
nonRoot: {
|
|
10920
|
-
relativeDirPath:
|
|
10946
|
+
relativeDirPath: join89(".kiro", "steering")
|
|
10921
10947
|
}
|
|
10922
10948
|
};
|
|
10923
10949
|
}
|
|
@@ -10927,7 +10953,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10927
10953
|
validate = true
|
|
10928
10954
|
}) {
|
|
10929
10955
|
const fileContent = await readFileContent(
|
|
10930
|
-
|
|
10956
|
+
join89(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10931
10957
|
);
|
|
10932
10958
|
return new _KiroRule({
|
|
10933
10959
|
baseDir,
|
|
@@ -10981,7 +11007,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10981
11007
|
};
|
|
10982
11008
|
|
|
10983
11009
|
// src/features/rules/opencode-rule.ts
|
|
10984
|
-
import { join as
|
|
11010
|
+
import { join as join90 } from "path";
|
|
10985
11011
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
10986
11012
|
static getSettablePaths() {
|
|
10987
11013
|
return {
|
|
@@ -10990,7 +11016,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10990
11016
|
relativeFilePath: "AGENTS.md"
|
|
10991
11017
|
},
|
|
10992
11018
|
nonRoot: {
|
|
10993
|
-
relativeDirPath:
|
|
11019
|
+
relativeDirPath: join90(".opencode", "memories")
|
|
10994
11020
|
}
|
|
10995
11021
|
};
|
|
10996
11022
|
}
|
|
@@ -11000,8 +11026,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
11000
11026
|
validate = true
|
|
11001
11027
|
}) {
|
|
11002
11028
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
11003
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
11004
|
-
const fileContent = await readFileContent(
|
|
11029
|
+
const relativePath = isRoot ? "AGENTS.md" : join90(".opencode", "memories", relativeFilePath);
|
|
11030
|
+
const fileContent = await readFileContent(join90(baseDir, relativePath));
|
|
11005
11031
|
return new _OpenCodeRule({
|
|
11006
11032
|
baseDir,
|
|
11007
11033
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -11056,7 +11082,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
11056
11082
|
};
|
|
11057
11083
|
|
|
11058
11084
|
// src/features/rules/qwencode-rule.ts
|
|
11059
|
-
import { join as
|
|
11085
|
+
import { join as join91 } from "path";
|
|
11060
11086
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
11061
11087
|
static getSettablePaths() {
|
|
11062
11088
|
return {
|
|
@@ -11065,7 +11091,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
11065
11091
|
relativeFilePath: "QWEN.md"
|
|
11066
11092
|
},
|
|
11067
11093
|
nonRoot: {
|
|
11068
|
-
relativeDirPath:
|
|
11094
|
+
relativeDirPath: join91(".qwen", "memories")
|
|
11069
11095
|
}
|
|
11070
11096
|
};
|
|
11071
11097
|
}
|
|
@@ -11075,8 +11101,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
11075
11101
|
validate = true
|
|
11076
11102
|
}) {
|
|
11077
11103
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
11078
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
11079
|
-
const fileContent = await readFileContent(
|
|
11104
|
+
const relativePath = isRoot ? "QWEN.md" : join91(".qwen", "memories", relativeFilePath);
|
|
11105
|
+
const fileContent = await readFileContent(join91(baseDir, relativePath));
|
|
11080
11106
|
return new _QwencodeRule({
|
|
11081
11107
|
baseDir,
|
|
11082
11108
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -11128,7 +11154,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
11128
11154
|
};
|
|
11129
11155
|
|
|
11130
11156
|
// src/features/rules/replit-rule.ts
|
|
11131
|
-
import { join as
|
|
11157
|
+
import { join as join92 } from "path";
|
|
11132
11158
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
11133
11159
|
static getSettablePaths() {
|
|
11134
11160
|
return {
|
|
@@ -11150,7 +11176,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
11150
11176
|
}
|
|
11151
11177
|
const relativePath = paths.root.relativeFilePath;
|
|
11152
11178
|
const fileContent = await readFileContent(
|
|
11153
|
-
|
|
11179
|
+
join92(baseDir, paths.root.relativeDirPath, relativePath)
|
|
11154
11180
|
);
|
|
11155
11181
|
return new _ReplitRule({
|
|
11156
11182
|
baseDir,
|
|
@@ -11216,12 +11242,12 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
11216
11242
|
};
|
|
11217
11243
|
|
|
11218
11244
|
// src/features/rules/roo-rule.ts
|
|
11219
|
-
import { join as
|
|
11245
|
+
import { join as join93 } from "path";
|
|
11220
11246
|
var RooRule = class _RooRule extends ToolRule {
|
|
11221
11247
|
static getSettablePaths() {
|
|
11222
11248
|
return {
|
|
11223
11249
|
nonRoot: {
|
|
11224
|
-
relativeDirPath:
|
|
11250
|
+
relativeDirPath: join93(".roo", "rules")
|
|
11225
11251
|
}
|
|
11226
11252
|
};
|
|
11227
11253
|
}
|
|
@@ -11231,7 +11257,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
11231
11257
|
validate = true
|
|
11232
11258
|
}) {
|
|
11233
11259
|
const fileContent = await readFileContent(
|
|
11234
|
-
|
|
11260
|
+
join93(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11235
11261
|
);
|
|
11236
11262
|
return new _RooRule({
|
|
11237
11263
|
baseDir,
|
|
@@ -11300,7 +11326,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
11300
11326
|
};
|
|
11301
11327
|
|
|
11302
11328
|
// src/features/rules/warp-rule.ts
|
|
11303
|
-
import { join as
|
|
11329
|
+
import { join as join94 } from "path";
|
|
11304
11330
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
11305
11331
|
constructor({ fileContent, root, ...rest }) {
|
|
11306
11332
|
super({
|
|
@@ -11316,7 +11342,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11316
11342
|
relativeFilePath: "WARP.md"
|
|
11317
11343
|
},
|
|
11318
11344
|
nonRoot: {
|
|
11319
|
-
relativeDirPath:
|
|
11345
|
+
relativeDirPath: join94(".warp", "memories")
|
|
11320
11346
|
}
|
|
11321
11347
|
};
|
|
11322
11348
|
}
|
|
@@ -11326,8 +11352,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11326
11352
|
validate = true
|
|
11327
11353
|
}) {
|
|
11328
11354
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
11329
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
11330
|
-
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));
|
|
11331
11357
|
return new _WarpRule({
|
|
11332
11358
|
baseDir,
|
|
11333
11359
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -11382,12 +11408,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11382
11408
|
};
|
|
11383
11409
|
|
|
11384
11410
|
// src/features/rules/windsurf-rule.ts
|
|
11385
|
-
import { join as
|
|
11411
|
+
import { join as join95 } from "path";
|
|
11386
11412
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
11387
11413
|
static getSettablePaths() {
|
|
11388
11414
|
return {
|
|
11389
11415
|
nonRoot: {
|
|
11390
|
-
relativeDirPath:
|
|
11416
|
+
relativeDirPath: join95(".windsurf", "rules")
|
|
11391
11417
|
}
|
|
11392
11418
|
};
|
|
11393
11419
|
}
|
|
@@ -11397,7 +11423,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
11397
11423
|
validate = true
|
|
11398
11424
|
}) {
|
|
11399
11425
|
const fileContent = await readFileContent(
|
|
11400
|
-
|
|
11426
|
+
join95(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11401
11427
|
);
|
|
11402
11428
|
return new _WindsurfRule({
|
|
11403
11429
|
baseDir,
|
|
@@ -11770,7 +11796,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11770
11796
|
}).relativeDirPath;
|
|
11771
11797
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
11772
11798
|
const frontmatter = skill.getFrontmatter();
|
|
11773
|
-
const relativePath =
|
|
11799
|
+
const relativePath = join96(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
11774
11800
|
return {
|
|
11775
11801
|
name: frontmatter.name,
|
|
11776
11802
|
description: frontmatter.description,
|
|
@@ -11780,7 +11806,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11780
11806
|
}
|
|
11781
11807
|
/**
|
|
11782
11808
|
* Handle localRoot rule generation based on tool target.
|
|
11783
|
-
* - Claude Code: generates
|
|
11809
|
+
* - Claude Code: generates `./CLAUDE.local.md`
|
|
11784
11810
|
* - Claude Code Legacy: generates `./CLAUDE.local.md`
|
|
11785
11811
|
* - Other tools: appends content to the root file with one blank line separator
|
|
11786
11812
|
*/
|
|
@@ -11881,10 +11907,17 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11881
11907
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
11882
11908
|
*/
|
|
11883
11909
|
async loadRulesyncFiles() {
|
|
11884
|
-
const
|
|
11910
|
+
const rulesyncBaseDir = join96(this.baseDir, RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
11911
|
+
const files = await findFilesByGlobs(join96(rulesyncBaseDir, "**", "*.md"));
|
|
11885
11912
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
11886
11913
|
const rulesyncRules = await Promise.all(
|
|
11887
|
-
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
|
+
})
|
|
11888
11921
|
);
|
|
11889
11922
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
11890
11923
|
if (rootRules.length > 1) {
|
|
@@ -11918,13 +11951,6 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11918
11951
|
}
|
|
11919
11952
|
return rulesyncRules;
|
|
11920
11953
|
}
|
|
11921
|
-
async loadRulesyncFilesLegacy() {
|
|
11922
|
-
const legacyFiles = await findFilesByGlobs(join95(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
11923
|
-
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
11924
|
-
return Promise.all(
|
|
11925
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename24(file) }))
|
|
11926
|
-
);
|
|
11927
|
-
}
|
|
11928
11954
|
/**
|
|
11929
11955
|
* Implementation of abstract method from FeatureProcessor
|
|
11930
11956
|
* Load tool-specific rule configurations and parse them into ToolRule instances
|
|
@@ -11940,7 +11966,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11940
11966
|
return [];
|
|
11941
11967
|
}
|
|
11942
11968
|
const rootFilePaths = await findFilesByGlobs(
|
|
11943
|
-
|
|
11969
|
+
join96(
|
|
11944
11970
|
this.baseDir,
|
|
11945
11971
|
settablePaths.root.relativeDirPath ?? ".",
|
|
11946
11972
|
settablePaths.root.relativeFilePath
|
|
@@ -11951,7 +11977,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11951
11977
|
(filePath) => factory.class.forDeletion({
|
|
11952
11978
|
baseDir: this.baseDir,
|
|
11953
11979
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
11954
|
-
relativeFilePath:
|
|
11980
|
+
relativeFilePath: basename22(filePath),
|
|
11955
11981
|
global: this.global
|
|
11956
11982
|
})
|
|
11957
11983
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11960,7 +11986,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11960
11986
|
rootFilePaths.map(
|
|
11961
11987
|
(filePath) => factory.class.fromFile({
|
|
11962
11988
|
baseDir: this.baseDir,
|
|
11963
|
-
relativeFilePath:
|
|
11989
|
+
relativeFilePath: basename22(filePath),
|
|
11964
11990
|
global: this.global
|
|
11965
11991
|
})
|
|
11966
11992
|
)
|
|
@@ -11978,13 +12004,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11978
12004
|
return [];
|
|
11979
12005
|
}
|
|
11980
12006
|
const localRootFilePaths = await findFilesByGlobs(
|
|
11981
|
-
|
|
12007
|
+
join96(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md")
|
|
11982
12008
|
);
|
|
11983
12009
|
return localRootFilePaths.map(
|
|
11984
12010
|
(filePath) => factory.class.forDeletion({
|
|
11985
12011
|
baseDir: this.baseDir,
|
|
11986
12012
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
11987
|
-
relativeFilePath:
|
|
12013
|
+
relativeFilePath: basename22(filePath),
|
|
11988
12014
|
global: this.global
|
|
11989
12015
|
})
|
|
11990
12016
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11994,27 +12020,35 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11994
12020
|
if (!settablePaths.nonRoot) {
|
|
11995
12021
|
return [];
|
|
11996
12022
|
}
|
|
12023
|
+
const nonRootBaseDir = join96(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
11997
12024
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
11998
|
-
|
|
12025
|
+
join96(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
11999
12026
|
);
|
|
12000
12027
|
if (forDeletion) {
|
|
12001
|
-
return nonRootFilePaths.map(
|
|
12002
|
-
(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({
|
|
12003
12035
|
baseDir: this.baseDir,
|
|
12004
12036
|
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
12005
|
-
relativeFilePath
|
|
12037
|
+
relativeFilePath,
|
|
12006
12038
|
global: this.global
|
|
12007
|
-
})
|
|
12008
|
-
).filter((rule) => rule.isDeletable());
|
|
12039
|
+
});
|
|
12040
|
+
}).filter((rule) => rule.isDeletable());
|
|
12009
12041
|
}
|
|
12010
12042
|
return await Promise.all(
|
|
12011
|
-
nonRootFilePaths.map(
|
|
12012
|
-
(filePath)
|
|
12043
|
+
nonRootFilePaths.map((filePath) => {
|
|
12044
|
+
const relativeFilePath = relative4(nonRootBaseDir, filePath);
|
|
12045
|
+
checkPathTraversal({ relativePath: relativeFilePath, intendedRootDir: nonRootBaseDir });
|
|
12046
|
+
return factory.class.fromFile({
|
|
12013
12047
|
baseDir: this.baseDir,
|
|
12014
|
-
relativeFilePath
|
|
12048
|
+
relativeFilePath,
|
|
12015
12049
|
global: this.global
|
|
12016
|
-
})
|
|
12017
|
-
)
|
|
12050
|
+
});
|
|
12051
|
+
})
|
|
12018
12052
|
);
|
|
12019
12053
|
})();
|
|
12020
12054
|
logger.debug(`Found ${nonRootToolRules.length} non-root tool rule files`);
|
|
@@ -12104,14 +12138,14 @@ s/<command> [arguments]
|
|
|
12104
12138
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
12105
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.
|
|
12106
12140
|
|
|
12107
|
-
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.` : "";
|
|
12108
12142
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
12109
12143
|
|
|
12110
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.
|
|
12111
12145
|
|
|
12112
|
-
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.
|
|
12113
12147
|
|
|
12114
|
-
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.` : "";
|
|
12115
12149
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
12116
12150
|
const result = [
|
|
12117
12151
|
overview,
|
|
@@ -12140,7 +12174,7 @@ ${toonContent}`;
|
|
|
12140
12174
|
|
|
12141
12175
|
// src/lib/generate.ts
|
|
12142
12176
|
async function checkRulesyncDirExists(params) {
|
|
12143
|
-
return fileExists(
|
|
12177
|
+
return fileExists(join97(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
12144
12178
|
}
|
|
12145
12179
|
async function generate(params) {
|
|
12146
12180
|
const { config } = params;
|
|
@@ -12433,7 +12467,7 @@ async function generateCommand(options) {
|
|
|
12433
12467
|
}
|
|
12434
12468
|
|
|
12435
12469
|
// src/cli/commands/gitignore.ts
|
|
12436
|
-
import { join as
|
|
12470
|
+
import { join as join98 } from "path";
|
|
12437
12471
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
12438
12472
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
12439
12473
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -12525,6 +12559,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
12525
12559
|
// Others
|
|
12526
12560
|
"**/modular-mcp.json",
|
|
12527
12561
|
".rulesync/rules/*.local.md",
|
|
12562
|
+
"rulesync.local.jsonc",
|
|
12528
12563
|
"!.rulesync/.aiignore"
|
|
12529
12564
|
];
|
|
12530
12565
|
var isRulesyncHeader = (line) => {
|
|
@@ -12577,7 +12612,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
12577
12612
|
return result;
|
|
12578
12613
|
};
|
|
12579
12614
|
var gitignoreCommand = async () => {
|
|
12580
|
-
const gitignorePath =
|
|
12615
|
+
const gitignorePath = join98(process.cwd(), ".gitignore");
|
|
12581
12616
|
let gitignoreContent = "";
|
|
12582
12617
|
if (await fileExists(gitignorePath)) {
|
|
12583
12618
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -12779,7 +12814,7 @@ async function importSkills(config, tool) {
|
|
|
12779
12814
|
}
|
|
12780
12815
|
|
|
12781
12816
|
// src/cli/commands/init.ts
|
|
12782
|
-
import { join as
|
|
12817
|
+
import { join as join99 } from "path";
|
|
12783
12818
|
async function initCommand() {
|
|
12784
12819
|
logger.info("Initializing rulesync...");
|
|
12785
12820
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -12806,6 +12841,7 @@ async function createConfigFile() {
|
|
|
12806
12841
|
baseDirs: ["."],
|
|
12807
12842
|
delete: true,
|
|
12808
12843
|
verbose: false,
|
|
12844
|
+
silent: false,
|
|
12809
12845
|
global: false,
|
|
12810
12846
|
simulateCommands: false,
|
|
12811
12847
|
simulateSubagents: false,
|
|
@@ -12957,14 +12993,14 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12957
12993
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
12958
12994
|
await ensureDir(skillPaths.relativeDirPath);
|
|
12959
12995
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
12960
|
-
const ruleFilepath =
|
|
12996
|
+
const ruleFilepath = join99(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
12961
12997
|
if (!await fileExists(ruleFilepath)) {
|
|
12962
12998
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
12963
12999
|
logger.success(`Created ${ruleFilepath}`);
|
|
12964
13000
|
} else {
|
|
12965
13001
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
12966
13002
|
}
|
|
12967
|
-
const mcpFilepath =
|
|
13003
|
+
const mcpFilepath = join99(
|
|
12968
13004
|
mcpPaths.recommended.relativeDirPath,
|
|
12969
13005
|
mcpPaths.recommended.relativeFilePath
|
|
12970
13006
|
);
|
|
@@ -12974,30 +13010,30 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12974
13010
|
} else {
|
|
12975
13011
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
12976
13012
|
}
|
|
12977
|
-
const commandFilepath =
|
|
13013
|
+
const commandFilepath = join99(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
12978
13014
|
if (!await fileExists(commandFilepath)) {
|
|
12979
13015
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
12980
13016
|
logger.success(`Created ${commandFilepath}`);
|
|
12981
13017
|
} else {
|
|
12982
13018
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
12983
13019
|
}
|
|
12984
|
-
const subagentFilepath =
|
|
13020
|
+
const subagentFilepath = join99(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
12985
13021
|
if (!await fileExists(subagentFilepath)) {
|
|
12986
13022
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
12987
13023
|
logger.success(`Created ${subagentFilepath}`);
|
|
12988
13024
|
} else {
|
|
12989
13025
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
12990
13026
|
}
|
|
12991
|
-
const skillDirPath =
|
|
13027
|
+
const skillDirPath = join99(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
12992
13028
|
await ensureDir(skillDirPath);
|
|
12993
|
-
const skillFilepath =
|
|
13029
|
+
const skillFilepath = join99(skillDirPath, SKILL_FILE_NAME);
|
|
12994
13030
|
if (!await fileExists(skillFilepath)) {
|
|
12995
13031
|
await writeFileContent(skillFilepath, sampleSkillFile.content);
|
|
12996
13032
|
logger.success(`Created ${skillFilepath}`);
|
|
12997
13033
|
} else {
|
|
12998
13034
|
logger.info(`Skipped ${skillFilepath} (already exists)`);
|
|
12999
13035
|
}
|
|
13000
|
-
const ignoreFilepath =
|
|
13036
|
+
const ignoreFilepath = join99(
|
|
13001
13037
|
ignorePaths.recommended.relativeDirPath,
|
|
13002
13038
|
ignorePaths.recommended.relativeFilePath
|
|
13003
13039
|
);
|
|
@@ -13016,12 +13052,12 @@ import { FastMCP } from "fastmcp";
|
|
|
13016
13052
|
import { z as z51 } from "zod/mini";
|
|
13017
13053
|
|
|
13018
13054
|
// src/mcp/commands.ts
|
|
13019
|
-
import { basename as
|
|
13055
|
+
import { basename as basename23, join as join100 } from "path";
|
|
13020
13056
|
import { z as z45 } from "zod/mini";
|
|
13021
13057
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
13022
13058
|
var maxCommandsCount = 1e3;
|
|
13023
13059
|
async function listCommands() {
|
|
13024
|
-
const commandsDir =
|
|
13060
|
+
const commandsDir = join100(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
13025
13061
|
try {
|
|
13026
13062
|
const files = await listDirectoryFiles(commandsDir);
|
|
13027
13063
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13033,7 +13069,7 @@ async function listCommands() {
|
|
|
13033
13069
|
});
|
|
13034
13070
|
const frontmatter = command.getFrontmatter();
|
|
13035
13071
|
return {
|
|
13036
|
-
relativePathFromCwd:
|
|
13072
|
+
relativePathFromCwd: join100(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
13037
13073
|
frontmatter
|
|
13038
13074
|
};
|
|
13039
13075
|
} catch (error) {
|
|
@@ -13053,13 +13089,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
13053
13089
|
relativePath: relativePathFromCwd,
|
|
13054
13090
|
intendedRootDir: process.cwd()
|
|
13055
13091
|
});
|
|
13056
|
-
const filename =
|
|
13092
|
+
const filename = basename23(relativePathFromCwd);
|
|
13057
13093
|
try {
|
|
13058
13094
|
const command = await RulesyncCommand.fromFile({
|
|
13059
13095
|
relativeFilePath: filename
|
|
13060
13096
|
});
|
|
13061
13097
|
return {
|
|
13062
|
-
relativePathFromCwd:
|
|
13098
|
+
relativePathFromCwd: join100(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
13063
13099
|
frontmatter: command.getFrontmatter(),
|
|
13064
13100
|
body: command.getBody()
|
|
13065
13101
|
};
|
|
@@ -13078,7 +13114,7 @@ async function putCommand({
|
|
|
13078
13114
|
relativePath: relativePathFromCwd,
|
|
13079
13115
|
intendedRootDir: process.cwd()
|
|
13080
13116
|
});
|
|
13081
|
-
const filename =
|
|
13117
|
+
const filename = basename23(relativePathFromCwd);
|
|
13082
13118
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
13083
13119
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
13084
13120
|
throw new Error(
|
|
@@ -13088,7 +13124,7 @@ async function putCommand({
|
|
|
13088
13124
|
try {
|
|
13089
13125
|
const existingCommands = await listCommands();
|
|
13090
13126
|
const isUpdate = existingCommands.some(
|
|
13091
|
-
(command2) => command2.relativePathFromCwd ===
|
|
13127
|
+
(command2) => command2.relativePathFromCwd === join100(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
13092
13128
|
);
|
|
13093
13129
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
13094
13130
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -13103,11 +13139,11 @@ async function putCommand({
|
|
|
13103
13139
|
fileContent,
|
|
13104
13140
|
validate: true
|
|
13105
13141
|
});
|
|
13106
|
-
const commandsDir =
|
|
13142
|
+
const commandsDir = join100(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
13107
13143
|
await ensureDir(commandsDir);
|
|
13108
13144
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
13109
13145
|
return {
|
|
13110
|
-
relativePathFromCwd:
|
|
13146
|
+
relativePathFromCwd: join100(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
13111
13147
|
frontmatter: command.getFrontmatter(),
|
|
13112
13148
|
body: command.getBody()
|
|
13113
13149
|
};
|
|
@@ -13122,12 +13158,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
13122
13158
|
relativePath: relativePathFromCwd,
|
|
13123
13159
|
intendedRootDir: process.cwd()
|
|
13124
13160
|
});
|
|
13125
|
-
const filename =
|
|
13126
|
-
const fullPath =
|
|
13161
|
+
const filename = basename23(relativePathFromCwd);
|
|
13162
|
+
const fullPath = join100(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
13127
13163
|
try {
|
|
13128
13164
|
await removeFile(fullPath);
|
|
13129
13165
|
return {
|
|
13130
|
-
relativePathFromCwd:
|
|
13166
|
+
relativePathFromCwd: join100(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
13131
13167
|
};
|
|
13132
13168
|
} catch (error) {
|
|
13133
13169
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -13152,7 +13188,7 @@ var commandToolSchemas = {
|
|
|
13152
13188
|
var commandTools = {
|
|
13153
13189
|
listCommands: {
|
|
13154
13190
|
name: "listCommands",
|
|
13155
|
-
description: `List all commands from ${
|
|
13191
|
+
description: `List all commands from ${join100(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13156
13192
|
parameters: commandToolSchemas.listCommands,
|
|
13157
13193
|
execute: async () => {
|
|
13158
13194
|
const commands = await listCommands();
|
|
@@ -13194,11 +13230,11 @@ var commandTools = {
|
|
|
13194
13230
|
};
|
|
13195
13231
|
|
|
13196
13232
|
// src/mcp/ignore.ts
|
|
13197
|
-
import { join as
|
|
13233
|
+
import { join as join101 } from "path";
|
|
13198
13234
|
import { z as z46 } from "zod/mini";
|
|
13199
13235
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
13200
13236
|
async function getIgnoreFile() {
|
|
13201
|
-
const ignoreFilePath =
|
|
13237
|
+
const ignoreFilePath = join101(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
13202
13238
|
try {
|
|
13203
13239
|
const content = await readFileContent(ignoreFilePath);
|
|
13204
13240
|
return {
|
|
@@ -13212,7 +13248,7 @@ async function getIgnoreFile() {
|
|
|
13212
13248
|
}
|
|
13213
13249
|
}
|
|
13214
13250
|
async function putIgnoreFile({ content }) {
|
|
13215
|
-
const ignoreFilePath =
|
|
13251
|
+
const ignoreFilePath = join101(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
13216
13252
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
13217
13253
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
13218
13254
|
throw new Error(
|
|
@@ -13233,8 +13269,8 @@ async function putIgnoreFile({ content }) {
|
|
|
13233
13269
|
}
|
|
13234
13270
|
}
|
|
13235
13271
|
async function deleteIgnoreFile() {
|
|
13236
|
-
const aiignorePath =
|
|
13237
|
-
const legacyIgnorePath =
|
|
13272
|
+
const aiignorePath = join101(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
13273
|
+
const legacyIgnorePath = join101(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
13238
13274
|
try {
|
|
13239
13275
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
13240
13276
|
return {
|
|
@@ -13289,7 +13325,7 @@ var ignoreTools = {
|
|
|
13289
13325
|
};
|
|
13290
13326
|
|
|
13291
13327
|
// src/mcp/mcp.ts
|
|
13292
|
-
import { join as
|
|
13328
|
+
import { join as join102 } from "path";
|
|
13293
13329
|
import { z as z47 } from "zod/mini";
|
|
13294
13330
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
13295
13331
|
async function getMcpFile() {
|
|
@@ -13299,7 +13335,7 @@ async function getMcpFile() {
|
|
|
13299
13335
|
validate: true,
|
|
13300
13336
|
modularMcp: config.getModularMcp()
|
|
13301
13337
|
});
|
|
13302
|
-
const relativePathFromCwd =
|
|
13338
|
+
const relativePathFromCwd = join102(
|
|
13303
13339
|
rulesyncMcp.getRelativeDirPath(),
|
|
13304
13340
|
rulesyncMcp.getRelativeFilePath()
|
|
13305
13341
|
);
|
|
@@ -13332,7 +13368,7 @@ async function putMcpFile({ content }) {
|
|
|
13332
13368
|
const paths = RulesyncMcp.getSettablePaths();
|
|
13333
13369
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
13334
13370
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
13335
|
-
const fullPath =
|
|
13371
|
+
const fullPath = join102(baseDir, relativeDirPath, relativeFilePath);
|
|
13336
13372
|
const rulesyncMcp = new RulesyncMcp({
|
|
13337
13373
|
baseDir,
|
|
13338
13374
|
relativeDirPath,
|
|
@@ -13341,9 +13377,9 @@ async function putMcpFile({ content }) {
|
|
|
13341
13377
|
validate: true,
|
|
13342
13378
|
modularMcp: config.getModularMcp()
|
|
13343
13379
|
});
|
|
13344
|
-
await ensureDir(
|
|
13380
|
+
await ensureDir(join102(baseDir, relativeDirPath));
|
|
13345
13381
|
await writeFileContent(fullPath, content);
|
|
13346
|
-
const relativePathFromCwd =
|
|
13382
|
+
const relativePathFromCwd = join102(relativeDirPath, relativeFilePath);
|
|
13347
13383
|
return {
|
|
13348
13384
|
relativePathFromCwd,
|
|
13349
13385
|
content: rulesyncMcp.getFileContent()
|
|
@@ -13358,15 +13394,15 @@ async function deleteMcpFile() {
|
|
|
13358
13394
|
try {
|
|
13359
13395
|
const baseDir = process.cwd();
|
|
13360
13396
|
const paths = RulesyncMcp.getSettablePaths();
|
|
13361
|
-
const recommendedPath =
|
|
13397
|
+
const recommendedPath = join102(
|
|
13362
13398
|
baseDir,
|
|
13363
13399
|
paths.recommended.relativeDirPath,
|
|
13364
13400
|
paths.recommended.relativeFilePath
|
|
13365
13401
|
);
|
|
13366
|
-
const legacyPath =
|
|
13402
|
+
const legacyPath = join102(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
13367
13403
|
await removeFile(recommendedPath);
|
|
13368
13404
|
await removeFile(legacyPath);
|
|
13369
|
-
const relativePathFromCwd =
|
|
13405
|
+
const relativePathFromCwd = join102(
|
|
13370
13406
|
paths.recommended.relativeDirPath,
|
|
13371
13407
|
paths.recommended.relativeFilePath
|
|
13372
13408
|
);
|
|
@@ -13417,12 +13453,12 @@ var mcpTools = {
|
|
|
13417
13453
|
};
|
|
13418
13454
|
|
|
13419
13455
|
// src/mcp/rules.ts
|
|
13420
|
-
import { basename as
|
|
13456
|
+
import { basename as basename24, join as join103 } from "path";
|
|
13421
13457
|
import { z as z48 } from "zod/mini";
|
|
13422
13458
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
13423
13459
|
var maxRulesCount = 1e3;
|
|
13424
13460
|
async function listRules() {
|
|
13425
|
-
const rulesDir =
|
|
13461
|
+
const rulesDir = join103(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
13426
13462
|
try {
|
|
13427
13463
|
const files = await listDirectoryFiles(rulesDir);
|
|
13428
13464
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13435,7 +13471,7 @@ async function listRules() {
|
|
|
13435
13471
|
});
|
|
13436
13472
|
const frontmatter = rule.getFrontmatter();
|
|
13437
13473
|
return {
|
|
13438
|
-
relativePathFromCwd:
|
|
13474
|
+
relativePathFromCwd: join103(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
13439
13475
|
frontmatter
|
|
13440
13476
|
};
|
|
13441
13477
|
} catch (error) {
|
|
@@ -13455,14 +13491,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
13455
13491
|
relativePath: relativePathFromCwd,
|
|
13456
13492
|
intendedRootDir: process.cwd()
|
|
13457
13493
|
});
|
|
13458
|
-
const filename =
|
|
13494
|
+
const filename = basename24(relativePathFromCwd);
|
|
13459
13495
|
try {
|
|
13460
13496
|
const rule = await RulesyncRule.fromFile({
|
|
13461
13497
|
relativeFilePath: filename,
|
|
13462
13498
|
validate: true
|
|
13463
13499
|
});
|
|
13464
13500
|
return {
|
|
13465
|
-
relativePathFromCwd:
|
|
13501
|
+
relativePathFromCwd: join103(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
13466
13502
|
frontmatter: rule.getFrontmatter(),
|
|
13467
13503
|
body: rule.getBody()
|
|
13468
13504
|
};
|
|
@@ -13481,7 +13517,7 @@ async function putRule({
|
|
|
13481
13517
|
relativePath: relativePathFromCwd,
|
|
13482
13518
|
intendedRootDir: process.cwd()
|
|
13483
13519
|
});
|
|
13484
|
-
const filename =
|
|
13520
|
+
const filename = basename24(relativePathFromCwd);
|
|
13485
13521
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
13486
13522
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
13487
13523
|
throw new Error(
|
|
@@ -13491,7 +13527,7 @@ async function putRule({
|
|
|
13491
13527
|
try {
|
|
13492
13528
|
const existingRules = await listRules();
|
|
13493
13529
|
const isUpdate = existingRules.some(
|
|
13494
|
-
(rule2) => rule2.relativePathFromCwd ===
|
|
13530
|
+
(rule2) => rule2.relativePathFromCwd === join103(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
13495
13531
|
);
|
|
13496
13532
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
13497
13533
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -13504,11 +13540,11 @@ async function putRule({
|
|
|
13504
13540
|
body,
|
|
13505
13541
|
validate: true
|
|
13506
13542
|
});
|
|
13507
|
-
const rulesDir =
|
|
13543
|
+
const rulesDir = join103(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
13508
13544
|
await ensureDir(rulesDir);
|
|
13509
13545
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
13510
13546
|
return {
|
|
13511
|
-
relativePathFromCwd:
|
|
13547
|
+
relativePathFromCwd: join103(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
13512
13548
|
frontmatter: rule.getFrontmatter(),
|
|
13513
13549
|
body: rule.getBody()
|
|
13514
13550
|
};
|
|
@@ -13523,12 +13559,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
13523
13559
|
relativePath: relativePathFromCwd,
|
|
13524
13560
|
intendedRootDir: process.cwd()
|
|
13525
13561
|
});
|
|
13526
|
-
const filename =
|
|
13527
|
-
const fullPath =
|
|
13562
|
+
const filename = basename24(relativePathFromCwd);
|
|
13563
|
+
const fullPath = join103(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
13528
13564
|
try {
|
|
13529
13565
|
await removeFile(fullPath);
|
|
13530
13566
|
return {
|
|
13531
|
-
relativePathFromCwd:
|
|
13567
|
+
relativePathFromCwd: join103(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
13532
13568
|
};
|
|
13533
13569
|
} catch (error) {
|
|
13534
13570
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -13553,7 +13589,7 @@ var ruleToolSchemas = {
|
|
|
13553
13589
|
var ruleTools = {
|
|
13554
13590
|
listRules: {
|
|
13555
13591
|
name: "listRules",
|
|
13556
|
-
description: `List all rules from ${
|
|
13592
|
+
description: `List all rules from ${join103(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13557
13593
|
parameters: ruleToolSchemas.listRules,
|
|
13558
13594
|
execute: async () => {
|
|
13559
13595
|
const rules = await listRules();
|
|
@@ -13595,7 +13631,7 @@ var ruleTools = {
|
|
|
13595
13631
|
};
|
|
13596
13632
|
|
|
13597
13633
|
// src/mcp/skills.ts
|
|
13598
|
-
import { basename as
|
|
13634
|
+
import { basename as basename25, dirname as dirname3, join as join104 } from "path";
|
|
13599
13635
|
import { z as z49 } from "zod/mini";
|
|
13600
13636
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
13601
13637
|
var maxSkillsCount = 1e3;
|
|
@@ -13612,19 +13648,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
13612
13648
|
};
|
|
13613
13649
|
}
|
|
13614
13650
|
function extractDirName(relativeDirPathFromCwd) {
|
|
13615
|
-
const dirName =
|
|
13651
|
+
const dirName = basename25(relativeDirPathFromCwd);
|
|
13616
13652
|
if (!dirName) {
|
|
13617
13653
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
13618
13654
|
}
|
|
13619
13655
|
return dirName;
|
|
13620
13656
|
}
|
|
13621
13657
|
async function listSkills() {
|
|
13622
|
-
const skillsDir =
|
|
13658
|
+
const skillsDir = join104(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
13623
13659
|
try {
|
|
13624
|
-
const skillDirPaths = await findFilesByGlobs(
|
|
13660
|
+
const skillDirPaths = await findFilesByGlobs(join104(skillsDir, "*"), { type: "dir" });
|
|
13625
13661
|
const skills = await Promise.all(
|
|
13626
13662
|
skillDirPaths.map(async (dirPath) => {
|
|
13627
|
-
const dirName =
|
|
13663
|
+
const dirName = basename25(dirPath);
|
|
13628
13664
|
if (!dirName) return null;
|
|
13629
13665
|
try {
|
|
13630
13666
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -13632,7 +13668,7 @@ async function listSkills() {
|
|
|
13632
13668
|
});
|
|
13633
13669
|
const frontmatter = skill.getFrontmatter();
|
|
13634
13670
|
return {
|
|
13635
|
-
relativeDirPathFromCwd:
|
|
13671
|
+
relativeDirPathFromCwd: join104(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13636
13672
|
frontmatter
|
|
13637
13673
|
};
|
|
13638
13674
|
} catch (error) {
|
|
@@ -13658,7 +13694,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
13658
13694
|
dirName
|
|
13659
13695
|
});
|
|
13660
13696
|
return {
|
|
13661
|
-
relativeDirPathFromCwd:
|
|
13697
|
+
relativeDirPathFromCwd: join104(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13662
13698
|
frontmatter: skill.getFrontmatter(),
|
|
13663
13699
|
body: skill.getBody(),
|
|
13664
13700
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13692,7 +13728,7 @@ async function putSkill({
|
|
|
13692
13728
|
try {
|
|
13693
13729
|
const existingSkills = await listSkills();
|
|
13694
13730
|
const isUpdate = existingSkills.some(
|
|
13695
|
-
(skill2) => skill2.relativeDirPathFromCwd ===
|
|
13731
|
+
(skill2) => skill2.relativeDirPathFromCwd === join104(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13696
13732
|
);
|
|
13697
13733
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
13698
13734
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -13707,9 +13743,9 @@ async function putSkill({
|
|
|
13707
13743
|
otherFiles: aiDirFiles,
|
|
13708
13744
|
validate: true
|
|
13709
13745
|
});
|
|
13710
|
-
const skillDirPath =
|
|
13746
|
+
const skillDirPath = join104(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13711
13747
|
await ensureDir(skillDirPath);
|
|
13712
|
-
const skillFilePath =
|
|
13748
|
+
const skillFilePath = join104(skillDirPath, SKILL_FILE_NAME);
|
|
13713
13749
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
13714
13750
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
13715
13751
|
for (const file of otherFiles) {
|
|
@@ -13717,15 +13753,15 @@ async function putSkill({
|
|
|
13717
13753
|
relativePath: file.name,
|
|
13718
13754
|
intendedRootDir: skillDirPath
|
|
13719
13755
|
});
|
|
13720
|
-
const filePath =
|
|
13721
|
-
const fileDir =
|
|
13756
|
+
const filePath = join104(skillDirPath, file.name);
|
|
13757
|
+
const fileDir = join104(skillDirPath, dirname3(file.name));
|
|
13722
13758
|
if (fileDir !== skillDirPath) {
|
|
13723
13759
|
await ensureDir(fileDir);
|
|
13724
13760
|
}
|
|
13725
13761
|
await writeFileContent(filePath, file.body);
|
|
13726
13762
|
}
|
|
13727
13763
|
return {
|
|
13728
|
-
relativeDirPathFromCwd:
|
|
13764
|
+
relativeDirPathFromCwd: join104(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13729
13765
|
frontmatter: skill.getFrontmatter(),
|
|
13730
13766
|
body: skill.getBody(),
|
|
13731
13767
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13747,13 +13783,13 @@ async function deleteSkill({
|
|
|
13747
13783
|
intendedRootDir: process.cwd()
|
|
13748
13784
|
});
|
|
13749
13785
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
13750
|
-
const skillDirPath =
|
|
13786
|
+
const skillDirPath = join104(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13751
13787
|
try {
|
|
13752
13788
|
if (await directoryExists(skillDirPath)) {
|
|
13753
13789
|
await removeDirectory(skillDirPath);
|
|
13754
13790
|
}
|
|
13755
13791
|
return {
|
|
13756
|
-
relativeDirPathFromCwd:
|
|
13792
|
+
relativeDirPathFromCwd: join104(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13757
13793
|
};
|
|
13758
13794
|
} catch (error) {
|
|
13759
13795
|
throw new Error(
|
|
@@ -13786,7 +13822,7 @@ var skillToolSchemas = {
|
|
|
13786
13822
|
var skillTools = {
|
|
13787
13823
|
listSkills: {
|
|
13788
13824
|
name: "listSkills",
|
|
13789
|
-
description: `List all skills from ${
|
|
13825
|
+
description: `List all skills from ${join104(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
13790
13826
|
parameters: skillToolSchemas.listSkills,
|
|
13791
13827
|
execute: async () => {
|
|
13792
13828
|
const skills = await listSkills();
|
|
@@ -13829,12 +13865,12 @@ var skillTools = {
|
|
|
13829
13865
|
};
|
|
13830
13866
|
|
|
13831
13867
|
// src/mcp/subagents.ts
|
|
13832
|
-
import { basename as
|
|
13868
|
+
import { basename as basename26, join as join105 } from "path";
|
|
13833
13869
|
import { z as z50 } from "zod/mini";
|
|
13834
13870
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
13835
13871
|
var maxSubagentsCount = 1e3;
|
|
13836
13872
|
async function listSubagents() {
|
|
13837
|
-
const subagentsDir =
|
|
13873
|
+
const subagentsDir = join105(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13838
13874
|
try {
|
|
13839
13875
|
const files = await listDirectoryFiles(subagentsDir);
|
|
13840
13876
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13847,7 +13883,7 @@ async function listSubagents() {
|
|
|
13847
13883
|
});
|
|
13848
13884
|
const frontmatter = subagent.getFrontmatter();
|
|
13849
13885
|
return {
|
|
13850
|
-
relativePathFromCwd:
|
|
13886
|
+
relativePathFromCwd: join105(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
13851
13887
|
frontmatter
|
|
13852
13888
|
};
|
|
13853
13889
|
} catch (error) {
|
|
@@ -13869,14 +13905,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
13869
13905
|
relativePath: relativePathFromCwd,
|
|
13870
13906
|
intendedRootDir: process.cwd()
|
|
13871
13907
|
});
|
|
13872
|
-
const filename =
|
|
13908
|
+
const filename = basename26(relativePathFromCwd);
|
|
13873
13909
|
try {
|
|
13874
13910
|
const subagent = await RulesyncSubagent.fromFile({
|
|
13875
13911
|
relativeFilePath: filename,
|
|
13876
13912
|
validate: true
|
|
13877
13913
|
});
|
|
13878
13914
|
return {
|
|
13879
|
-
relativePathFromCwd:
|
|
13915
|
+
relativePathFromCwd: join105(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13880
13916
|
frontmatter: subagent.getFrontmatter(),
|
|
13881
13917
|
body: subagent.getBody()
|
|
13882
13918
|
};
|
|
@@ -13895,7 +13931,7 @@ async function putSubagent({
|
|
|
13895
13931
|
relativePath: relativePathFromCwd,
|
|
13896
13932
|
intendedRootDir: process.cwd()
|
|
13897
13933
|
});
|
|
13898
|
-
const filename =
|
|
13934
|
+
const filename = basename26(relativePathFromCwd);
|
|
13899
13935
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
13900
13936
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
13901
13937
|
throw new Error(
|
|
@@ -13905,7 +13941,7 @@ async function putSubagent({
|
|
|
13905
13941
|
try {
|
|
13906
13942
|
const existingSubagents = await listSubagents();
|
|
13907
13943
|
const isUpdate = existingSubagents.some(
|
|
13908
|
-
(subagent2) => subagent2.relativePathFromCwd ===
|
|
13944
|
+
(subagent2) => subagent2.relativePathFromCwd === join105(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13909
13945
|
);
|
|
13910
13946
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
13911
13947
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -13918,11 +13954,11 @@ async function putSubagent({
|
|
|
13918
13954
|
body,
|
|
13919
13955
|
validate: true
|
|
13920
13956
|
});
|
|
13921
|
-
const subagentsDir =
|
|
13957
|
+
const subagentsDir = join105(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13922
13958
|
await ensureDir(subagentsDir);
|
|
13923
13959
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
13924
13960
|
return {
|
|
13925
|
-
relativePathFromCwd:
|
|
13961
|
+
relativePathFromCwd: join105(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13926
13962
|
frontmatter: subagent.getFrontmatter(),
|
|
13927
13963
|
body: subagent.getBody()
|
|
13928
13964
|
};
|
|
@@ -13937,12 +13973,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
13937
13973
|
relativePath: relativePathFromCwd,
|
|
13938
13974
|
intendedRootDir: process.cwd()
|
|
13939
13975
|
});
|
|
13940
|
-
const filename =
|
|
13941
|
-
const fullPath =
|
|
13976
|
+
const filename = basename26(relativePathFromCwd);
|
|
13977
|
+
const fullPath = join105(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
13942
13978
|
try {
|
|
13943
13979
|
await removeFile(fullPath);
|
|
13944
13980
|
return {
|
|
13945
|
-
relativePathFromCwd:
|
|
13981
|
+
relativePathFromCwd: join105(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13946
13982
|
};
|
|
13947
13983
|
} catch (error) {
|
|
13948
13984
|
throw new Error(
|
|
@@ -13970,7 +14006,7 @@ var subagentToolSchemas = {
|
|
|
13970
14006
|
var subagentTools = {
|
|
13971
14007
|
listSubagents: {
|
|
13972
14008
|
name: "listSubagents",
|
|
13973
|
-
description: `List all subagents from ${
|
|
14009
|
+
description: `List all subagents from ${join105(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13974
14010
|
parameters: subagentToolSchemas.listSubagents,
|
|
13975
14011
|
execute: async () => {
|
|
13976
14012
|
const subagents = await listSubagents();
|
|
@@ -14221,7 +14257,7 @@ async function mcpCommand({ version }) {
|
|
|
14221
14257
|
}
|
|
14222
14258
|
|
|
14223
14259
|
// src/cli/index.ts
|
|
14224
|
-
var getVersion = () => "
|
|
14260
|
+
var getVersion = () => "6.1.0";
|
|
14225
14261
|
var main = async () => {
|
|
14226
14262
|
const program = new Command();
|
|
14227
14263
|
const version = getVersion();
|