rulesync 6.0.0 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/dist/index.cjs +162 -63
- package/dist/index.js +572 -473
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -95,14 +95,29 @@ var logger = new Logger();
|
|
|
95
95
|
|
|
96
96
|
// src/config/config-resolver.ts
|
|
97
97
|
import { parse as parseJsonc } from "jsonc-parser";
|
|
98
|
-
import { resolve as resolve2 } from "path";
|
|
98
|
+
import { dirname as dirname2, join as join3, resolve as resolve2 } from "path";
|
|
99
|
+
|
|
100
|
+
// src/constants/rulesync-paths.ts
|
|
101
|
+
import { join } from "path";
|
|
102
|
+
var RULESYNC_CONFIG_RELATIVE_FILE_PATH = "rulesync.jsonc";
|
|
103
|
+
var RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH = "rulesync.local.jsonc";
|
|
104
|
+
var RULESYNC_RELATIVE_DIR_PATH = ".rulesync";
|
|
105
|
+
var RULESYNC_RULES_RELATIVE_DIR_PATH = join(RULESYNC_RELATIVE_DIR_PATH, "rules");
|
|
106
|
+
var RULESYNC_COMMANDS_RELATIVE_DIR_PATH = join(RULESYNC_RELATIVE_DIR_PATH, "commands");
|
|
107
|
+
var RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH = join(RULESYNC_RELATIVE_DIR_PATH, "subagents");
|
|
108
|
+
var RULESYNC_MCP_RELATIVE_FILE_PATH = join(RULESYNC_RELATIVE_DIR_PATH, "mcp.json");
|
|
109
|
+
var RULESYNC_AIIGNORE_FILE_NAME = ".aiignore";
|
|
110
|
+
var RULESYNC_AIIGNORE_RELATIVE_FILE_PATH = join(RULESYNC_RELATIVE_DIR_PATH, ".aiignore");
|
|
111
|
+
var RULESYNC_IGNORE_RELATIVE_FILE_PATH = ".rulesyncignore";
|
|
112
|
+
var RULESYNC_OVERVIEW_FILE_NAME = "overview.md";
|
|
113
|
+
var RULESYNC_SKILLS_RELATIVE_DIR_PATH = join(RULESYNC_RELATIVE_DIR_PATH, "skills");
|
|
99
114
|
|
|
100
115
|
// src/utils/file.ts
|
|
101
116
|
import { kebabCase } from "es-toolkit";
|
|
102
117
|
import { globbySync } from "globby";
|
|
103
118
|
import { mkdir, readdir, readFile, rm, stat, writeFile } from "fs/promises";
|
|
104
119
|
import os from "os";
|
|
105
|
-
import { dirname, join, relative, resolve } from "path";
|
|
120
|
+
import { dirname, join as join2, relative, resolve } from "path";
|
|
106
121
|
async function ensureDir(dirPath) {
|
|
107
122
|
try {
|
|
108
123
|
await stat(dirPath);
|
|
@@ -390,7 +405,7 @@ var getDefaults = () => ({
|
|
|
390
405
|
verbose: false,
|
|
391
406
|
delete: false,
|
|
392
407
|
baseDirs: [process.cwd()],
|
|
393
|
-
configPath:
|
|
408
|
+
configPath: RULESYNC_CONFIG_RELATIVE_FILE_PATH,
|
|
394
409
|
global: false,
|
|
395
410
|
silent: false,
|
|
396
411
|
simulateCommands: false,
|
|
@@ -398,6 +413,36 @@ var getDefaults = () => ({
|
|
|
398
413
|
simulateSkills: false,
|
|
399
414
|
modularMcp: false
|
|
400
415
|
});
|
|
416
|
+
var loadConfigFromFile = async (filePath) => {
|
|
417
|
+
if (!await fileExists(filePath)) {
|
|
418
|
+
return {};
|
|
419
|
+
}
|
|
420
|
+
try {
|
|
421
|
+
const fileContent = await readFileContent(filePath);
|
|
422
|
+
const jsonData = parseJsonc(fileContent);
|
|
423
|
+
const parsed = ConfigFileSchema.parse(jsonData);
|
|
424
|
+
const { $schema: _schema, ...configParams } = parsed;
|
|
425
|
+
return configParams;
|
|
426
|
+
} catch (error) {
|
|
427
|
+
logger.error(`Failed to load config file "${filePath}": ${formatError(error)}`);
|
|
428
|
+
throw error;
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
var mergeConfigs = (baseConfig, localConfig) => {
|
|
432
|
+
return {
|
|
433
|
+
targets: localConfig.targets ?? baseConfig.targets,
|
|
434
|
+
features: localConfig.features ?? baseConfig.features,
|
|
435
|
+
verbose: localConfig.verbose ?? baseConfig.verbose,
|
|
436
|
+
delete: localConfig.delete ?? baseConfig.delete,
|
|
437
|
+
baseDirs: localConfig.baseDirs ?? baseConfig.baseDirs,
|
|
438
|
+
global: localConfig.global ?? baseConfig.global,
|
|
439
|
+
silent: localConfig.silent ?? baseConfig.silent,
|
|
440
|
+
simulateCommands: localConfig.simulateCommands ?? baseConfig.simulateCommands,
|
|
441
|
+
simulateSubagents: localConfig.simulateSubagents ?? baseConfig.simulateSubagents,
|
|
442
|
+
simulateSkills: localConfig.simulateSkills ?? baseConfig.simulateSkills,
|
|
443
|
+
modularMcp: localConfig.modularMcp ?? baseConfig.modularMcp
|
|
444
|
+
};
|
|
445
|
+
};
|
|
401
446
|
var ConfigResolver = class {
|
|
402
447
|
static async resolve({
|
|
403
448
|
targets,
|
|
@@ -414,19 +459,11 @@ var ConfigResolver = class {
|
|
|
414
459
|
modularMcp
|
|
415
460
|
}) {
|
|
416
461
|
const validatedConfigPath = resolvePath(configPath, process.cwd());
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
const parsed = ConfigFileSchema.parse(jsonData);
|
|
423
|
-
const { $schema: _schema, ...configParams2 } = parsed;
|
|
424
|
-
configByFile = configParams2;
|
|
425
|
-
} catch (error) {
|
|
426
|
-
logger.error(`Failed to load config file: ${formatError(error)}`);
|
|
427
|
-
throw error;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
462
|
+
const baseConfig = await loadConfigFromFile(validatedConfigPath);
|
|
463
|
+
const configDir = dirname2(validatedConfigPath);
|
|
464
|
+
const localConfigPath = join3(configDir, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH);
|
|
465
|
+
const localConfig = await loadConfigFromFile(localConfigPath);
|
|
466
|
+
const configByFile = mergeConfigs(baseConfig, localConfig);
|
|
430
467
|
const resolvedGlobal = global ?? configByFile.global ?? getDefaults().global;
|
|
431
468
|
const resolvedSimulateCommands = simulateCommands ?? configByFile.simulateCommands ?? getDefaults().simulateCommands;
|
|
432
469
|
const resolvedSimulateSubagents = simulateSubagents ?? configByFile.simulateSubagents ?? getDefaults().simulateSubagents;
|
|
@@ -466,24 +503,10 @@ function getBaseDirsInLightOfGlobal({
|
|
|
466
503
|
|
|
467
504
|
// src/lib/generate.ts
|
|
468
505
|
import { intersection } from "es-toolkit";
|
|
469
|
-
import { join as
|
|
470
|
-
|
|
471
|
-
// src/constants/rulesync-paths.ts
|
|
472
|
-
import { join as join2 } from "path";
|
|
473
|
-
var RULESYNC_CONFIG_RELATIVE_FILE_PATH = "rulesync.jsonc";
|
|
474
|
-
var RULESYNC_RELATIVE_DIR_PATH = ".rulesync";
|
|
475
|
-
var RULESYNC_RULES_RELATIVE_DIR_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "rules");
|
|
476
|
-
var RULESYNC_COMMANDS_RELATIVE_DIR_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "commands");
|
|
477
|
-
var RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "subagents");
|
|
478
|
-
var RULESYNC_MCP_RELATIVE_FILE_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "mcp.json");
|
|
479
|
-
var RULESYNC_AIIGNORE_FILE_NAME = ".aiignore";
|
|
480
|
-
var RULESYNC_AIIGNORE_RELATIVE_FILE_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, ".aiignore");
|
|
481
|
-
var RULESYNC_IGNORE_RELATIVE_FILE_PATH = ".rulesyncignore";
|
|
482
|
-
var RULESYNC_OVERVIEW_FILE_NAME = "overview.md";
|
|
483
|
-
var RULESYNC_SKILLS_RELATIVE_DIR_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "skills");
|
|
506
|
+
import { join as join97 } from "path";
|
|
484
507
|
|
|
485
508
|
// src/features/commands/commands-processor.ts
|
|
486
|
-
import { basename as basename15, join as
|
|
509
|
+
import { basename as basename15, join as join18 } from "path";
|
|
487
510
|
import { z as z12 } from "zod/mini";
|
|
488
511
|
|
|
489
512
|
// src/types/feature-processor.ts
|
|
@@ -517,7 +540,7 @@ var FeatureProcessor = class {
|
|
|
517
540
|
};
|
|
518
541
|
|
|
519
542
|
// src/features/commands/agentsmd-command.ts
|
|
520
|
-
import { basename as basename2, join as
|
|
543
|
+
import { basename as basename2, join as join5 } from "path";
|
|
521
544
|
|
|
522
545
|
// src/utils/frontmatter.ts
|
|
523
546
|
import matter from "gray-matter";
|
|
@@ -569,7 +592,7 @@ function parseFrontmatter(content) {
|
|
|
569
592
|
}
|
|
570
593
|
|
|
571
594
|
// src/features/commands/simulated-command.ts
|
|
572
|
-
import { basename, join as
|
|
595
|
+
import { basename, join as join4 } from "path";
|
|
573
596
|
import { z as z4 } from "zod/mini";
|
|
574
597
|
|
|
575
598
|
// src/types/ai-file.ts
|
|
@@ -743,7 +766,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
743
766
|
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
744
767
|
if (!result.success) {
|
|
745
768
|
throw new Error(
|
|
746
|
-
`Invalid frontmatter in ${
|
|
769
|
+
`Invalid frontmatter in ${join4(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
747
770
|
);
|
|
748
771
|
}
|
|
749
772
|
}
|
|
@@ -793,7 +816,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
793
816
|
return {
|
|
794
817
|
success: false,
|
|
795
818
|
error: new Error(
|
|
796
|
-
`Invalid frontmatter in ${
|
|
819
|
+
`Invalid frontmatter in ${join4(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
797
820
|
)
|
|
798
821
|
};
|
|
799
822
|
}
|
|
@@ -803,7 +826,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
803
826
|
relativeFilePath,
|
|
804
827
|
validate = true
|
|
805
828
|
}) {
|
|
806
|
-
const filePath =
|
|
829
|
+
const filePath = join4(
|
|
807
830
|
baseDir,
|
|
808
831
|
_SimulatedCommand.getSettablePaths().relativeDirPath,
|
|
809
832
|
relativeFilePath
|
|
@@ -843,7 +866,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
843
866
|
var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
844
867
|
static getSettablePaths() {
|
|
845
868
|
return {
|
|
846
|
-
relativeDirPath:
|
|
869
|
+
relativeDirPath: join5(".agents", "commands")
|
|
847
870
|
};
|
|
848
871
|
}
|
|
849
872
|
static fromRulesyncCommand({
|
|
@@ -860,7 +883,7 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
860
883
|
relativeFilePath,
|
|
861
884
|
validate = true
|
|
862
885
|
}) {
|
|
863
|
-
const filePath =
|
|
886
|
+
const filePath = join5(
|
|
864
887
|
baseDir,
|
|
865
888
|
_AgentsmdCommand.getSettablePaths().relativeDirPath,
|
|
866
889
|
relativeFilePath
|
|
@@ -898,7 +921,7 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
898
921
|
};
|
|
899
922
|
|
|
900
923
|
// src/features/commands/antigravity-command.ts
|
|
901
|
-
import { basename as basename4, join as
|
|
924
|
+
import { basename as basename4, join as join7 } from "path";
|
|
902
925
|
import { z as z6 } from "zod/mini";
|
|
903
926
|
|
|
904
927
|
// src/utils/type-guards.ts
|
|
@@ -907,7 +930,7 @@ function isRecord(value) {
|
|
|
907
930
|
}
|
|
908
931
|
|
|
909
932
|
// src/features/commands/rulesync-command.ts
|
|
910
|
-
import { basename as basename3, join as
|
|
933
|
+
import { basename as basename3, join as join6 } from "path";
|
|
911
934
|
import { z as z5 } from "zod/mini";
|
|
912
935
|
|
|
913
936
|
// src/types/rulesync-file.ts
|
|
@@ -930,7 +953,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
930
953
|
const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
|
|
931
954
|
if (!result.success) {
|
|
932
955
|
throw new Error(
|
|
933
|
-
`Invalid frontmatter in ${
|
|
956
|
+
`Invalid frontmatter in ${join6(rest.baseDir ?? process.cwd(), rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
934
957
|
);
|
|
935
958
|
}
|
|
936
959
|
}
|
|
@@ -963,7 +986,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
963
986
|
return {
|
|
964
987
|
success: false,
|
|
965
988
|
error: new Error(
|
|
966
|
-
`Invalid frontmatter in ${
|
|
989
|
+
`Invalid frontmatter in ${join6(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
967
990
|
)
|
|
968
991
|
};
|
|
969
992
|
}
|
|
@@ -971,7 +994,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
971
994
|
static async fromFile({
|
|
972
995
|
relativeFilePath
|
|
973
996
|
}) {
|
|
974
|
-
const filePath =
|
|
997
|
+
const filePath = join6(
|
|
975
998
|
process.cwd(),
|
|
976
999
|
_RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
977
1000
|
relativeFilePath
|
|
@@ -1009,7 +1032,7 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1009
1032
|
body;
|
|
1010
1033
|
static getSettablePaths() {
|
|
1011
1034
|
return {
|
|
1012
|
-
relativeDirPath:
|
|
1035
|
+
relativeDirPath: join7(".agent", "workflows")
|
|
1013
1036
|
};
|
|
1014
1037
|
}
|
|
1015
1038
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -1017,7 +1040,7 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1017
1040
|
const result = AntigravityCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1018
1041
|
if (!result.success) {
|
|
1019
1042
|
throw new Error(
|
|
1020
|
-
`Invalid frontmatter in ${
|
|
1043
|
+
`Invalid frontmatter in ${join7(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1021
1044
|
);
|
|
1022
1045
|
}
|
|
1023
1046
|
}
|
|
@@ -1115,7 +1138,7 @@ ${body}${turboDirective}`;
|
|
|
1115
1138
|
return {
|
|
1116
1139
|
success: false,
|
|
1117
1140
|
error: new Error(
|
|
1118
|
-
`Invalid frontmatter in ${
|
|
1141
|
+
`Invalid frontmatter in ${join7(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1119
1142
|
)
|
|
1120
1143
|
};
|
|
1121
1144
|
}
|
|
@@ -1131,7 +1154,7 @@ ${body}${turboDirective}`;
|
|
|
1131
1154
|
relativeFilePath,
|
|
1132
1155
|
validate = true
|
|
1133
1156
|
}) {
|
|
1134
|
-
const filePath =
|
|
1157
|
+
const filePath = join7(
|
|
1135
1158
|
baseDir,
|
|
1136
1159
|
_AntigravityCommand.getSettablePaths().relativeDirPath,
|
|
1137
1160
|
relativeFilePath
|
|
@@ -1170,7 +1193,7 @@ ${body}${turboDirective}`;
|
|
|
1170
1193
|
};
|
|
1171
1194
|
|
|
1172
1195
|
// src/features/commands/claudecode-command.ts
|
|
1173
|
-
import { basename as basename5, join as
|
|
1196
|
+
import { basename as basename5, join as join8 } from "path";
|
|
1174
1197
|
import { z as z7 } from "zod/mini";
|
|
1175
1198
|
var ClaudecodeCommandFrontmatterSchema = z7.looseObject({
|
|
1176
1199
|
description: z7.string(),
|
|
@@ -1187,7 +1210,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1187
1210
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1188
1211
|
if (!result.success) {
|
|
1189
1212
|
throw new Error(
|
|
1190
|
-
`Invalid frontmatter in ${
|
|
1213
|
+
`Invalid frontmatter in ${join8(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1191
1214
|
);
|
|
1192
1215
|
}
|
|
1193
1216
|
}
|
|
@@ -1200,7 +1223,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1200
1223
|
}
|
|
1201
1224
|
static getSettablePaths(_options = {}) {
|
|
1202
1225
|
return {
|
|
1203
|
-
relativeDirPath:
|
|
1226
|
+
relativeDirPath: join8(".claude", "commands")
|
|
1204
1227
|
};
|
|
1205
1228
|
}
|
|
1206
1229
|
getBody() {
|
|
@@ -1263,7 +1286,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1263
1286
|
return {
|
|
1264
1287
|
success: false,
|
|
1265
1288
|
error: new Error(
|
|
1266
|
-
`Invalid frontmatter in ${
|
|
1289
|
+
`Invalid frontmatter in ${join8(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1267
1290
|
)
|
|
1268
1291
|
};
|
|
1269
1292
|
}
|
|
@@ -1281,7 +1304,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1281
1304
|
global = false
|
|
1282
1305
|
}) {
|
|
1283
1306
|
const paths = this.getSettablePaths({ global });
|
|
1284
|
-
const filePath =
|
|
1307
|
+
const filePath = join8(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1285
1308
|
const fileContent = await readFileContent(filePath);
|
|
1286
1309
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1287
1310
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1314,16 +1337,16 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1314
1337
|
};
|
|
1315
1338
|
|
|
1316
1339
|
// src/features/commands/cline-command.ts
|
|
1317
|
-
import { basename as basename6, join as
|
|
1340
|
+
import { basename as basename6, join as join9 } from "path";
|
|
1318
1341
|
var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
1319
1342
|
static getSettablePaths({ global } = {}) {
|
|
1320
1343
|
if (global) {
|
|
1321
1344
|
return {
|
|
1322
|
-
relativeDirPath:
|
|
1345
|
+
relativeDirPath: join9("Documents", "Cline", "Workflows")
|
|
1323
1346
|
};
|
|
1324
1347
|
}
|
|
1325
1348
|
return {
|
|
1326
|
-
relativeDirPath:
|
|
1349
|
+
relativeDirPath: join9(".clinerules", "workflows")
|
|
1327
1350
|
};
|
|
1328
1351
|
}
|
|
1329
1352
|
toRulesyncCommand() {
|
|
@@ -1375,7 +1398,7 @@ var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
|
1375
1398
|
global = false
|
|
1376
1399
|
}) {
|
|
1377
1400
|
const paths = this.getSettablePaths({ global });
|
|
1378
|
-
const filePath =
|
|
1401
|
+
const filePath = join9(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1379
1402
|
const fileContent = await readFileContent(filePath);
|
|
1380
1403
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1381
1404
|
return new _ClineCommand({
|
|
@@ -1402,14 +1425,14 @@ var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
|
1402
1425
|
};
|
|
1403
1426
|
|
|
1404
1427
|
// src/features/commands/codexcli-command.ts
|
|
1405
|
-
import { basename as basename7, join as
|
|
1428
|
+
import { basename as basename7, join as join10 } from "path";
|
|
1406
1429
|
var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
1407
1430
|
static getSettablePaths({ global } = {}) {
|
|
1408
1431
|
if (!global) {
|
|
1409
1432
|
throw new Error("CodexcliCommand only supports global mode. Please pass { global: true }.");
|
|
1410
1433
|
}
|
|
1411
1434
|
return {
|
|
1412
|
-
relativeDirPath:
|
|
1435
|
+
relativeDirPath: join10(".codex", "prompts")
|
|
1413
1436
|
};
|
|
1414
1437
|
}
|
|
1415
1438
|
toRulesyncCommand() {
|
|
@@ -1462,7 +1485,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1462
1485
|
global = false
|
|
1463
1486
|
}) {
|
|
1464
1487
|
const paths = this.getSettablePaths({ global });
|
|
1465
|
-
const filePath =
|
|
1488
|
+
const filePath = join10(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1466
1489
|
const fileContent = await readFileContent(filePath);
|
|
1467
1490
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1468
1491
|
return new _CodexcliCommand({
|
|
@@ -1489,7 +1512,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1489
1512
|
};
|
|
1490
1513
|
|
|
1491
1514
|
// src/features/commands/copilot-command.ts
|
|
1492
|
-
import { basename as basename8, join as
|
|
1515
|
+
import { basename as basename8, join as join11 } from "path";
|
|
1493
1516
|
import { z as z8 } from "zod/mini";
|
|
1494
1517
|
var CopilotCommandFrontmatterSchema = z8.looseObject({
|
|
1495
1518
|
mode: z8.optional(z8.string()),
|
|
@@ -1503,7 +1526,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1503
1526
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1504
1527
|
if (!result.success) {
|
|
1505
1528
|
throw new Error(
|
|
1506
|
-
`Invalid frontmatter in ${
|
|
1529
|
+
`Invalid frontmatter in ${join11(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1507
1530
|
);
|
|
1508
1531
|
}
|
|
1509
1532
|
}
|
|
@@ -1516,7 +1539,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1516
1539
|
}
|
|
1517
1540
|
static getSettablePaths() {
|
|
1518
1541
|
return {
|
|
1519
|
-
relativeDirPath:
|
|
1542
|
+
relativeDirPath: join11(".github", "prompts")
|
|
1520
1543
|
};
|
|
1521
1544
|
}
|
|
1522
1545
|
getBody() {
|
|
@@ -1556,7 +1579,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1556
1579
|
return {
|
|
1557
1580
|
success: false,
|
|
1558
1581
|
error: new Error(
|
|
1559
|
-
`Invalid frontmatter in ${
|
|
1582
|
+
`Invalid frontmatter in ${join11(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1560
1583
|
)
|
|
1561
1584
|
};
|
|
1562
1585
|
}
|
|
@@ -1591,7 +1614,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1591
1614
|
validate = true
|
|
1592
1615
|
}) {
|
|
1593
1616
|
const paths = this.getSettablePaths();
|
|
1594
|
-
const filePath =
|
|
1617
|
+
const filePath = join11(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1595
1618
|
const fileContent = await readFileContent(filePath);
|
|
1596
1619
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1597
1620
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1630,11 +1653,11 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1630
1653
|
};
|
|
1631
1654
|
|
|
1632
1655
|
// src/features/commands/cursor-command.ts
|
|
1633
|
-
import { basename as basename9, join as
|
|
1656
|
+
import { basename as basename9, join as join12 } from "path";
|
|
1634
1657
|
var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
1635
1658
|
static getSettablePaths(_options = {}) {
|
|
1636
1659
|
return {
|
|
1637
|
-
relativeDirPath:
|
|
1660
|
+
relativeDirPath: join12(".cursor", "commands")
|
|
1638
1661
|
};
|
|
1639
1662
|
}
|
|
1640
1663
|
toRulesyncCommand() {
|
|
@@ -1687,7 +1710,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1687
1710
|
global = false
|
|
1688
1711
|
}) {
|
|
1689
1712
|
const paths = this.getSettablePaths({ global });
|
|
1690
|
-
const filePath =
|
|
1713
|
+
const filePath = join12(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1691
1714
|
const fileContent = await readFileContent(filePath);
|
|
1692
1715
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1693
1716
|
return new _CursorCommand({
|
|
@@ -1714,7 +1737,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1714
1737
|
};
|
|
1715
1738
|
|
|
1716
1739
|
// src/features/commands/geminicli-command.ts
|
|
1717
|
-
import { basename as basename10, join as
|
|
1740
|
+
import { basename as basename10, join as join13 } from "path";
|
|
1718
1741
|
import { parse as parseToml } from "smol-toml";
|
|
1719
1742
|
import { z as z9 } from "zod/mini";
|
|
1720
1743
|
var GeminiCliCommandFrontmatterSchema = z9.looseObject({
|
|
@@ -1732,7 +1755,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
1732
1755
|
}
|
|
1733
1756
|
static getSettablePaths(_options = {}) {
|
|
1734
1757
|
return {
|
|
1735
|
-
relativeDirPath:
|
|
1758
|
+
relativeDirPath: join13(".gemini", "commands")
|
|
1736
1759
|
};
|
|
1737
1760
|
}
|
|
1738
1761
|
parseTomlContent(content) {
|
|
@@ -1814,7 +1837,7 @@ ${geminiFrontmatter.prompt}
|
|
|
1814
1837
|
global = false
|
|
1815
1838
|
}) {
|
|
1816
1839
|
const paths = this.getSettablePaths({ global });
|
|
1817
|
-
const filePath =
|
|
1840
|
+
const filePath = join13(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1818
1841
|
const fileContent = await readFileContent(filePath);
|
|
1819
1842
|
return new _GeminiCliCommand({
|
|
1820
1843
|
baseDir,
|
|
@@ -1856,11 +1879,11 @@ prompt = ""`;
|
|
|
1856
1879
|
};
|
|
1857
1880
|
|
|
1858
1881
|
// src/features/commands/kilo-command.ts
|
|
1859
|
-
import { basename as basename11, join as
|
|
1882
|
+
import { basename as basename11, join as join14 } from "path";
|
|
1860
1883
|
var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
1861
1884
|
static getSettablePaths(_options = {}) {
|
|
1862
1885
|
return {
|
|
1863
|
-
relativeDirPath:
|
|
1886
|
+
relativeDirPath: join14(".kilocode", "workflows")
|
|
1864
1887
|
};
|
|
1865
1888
|
}
|
|
1866
1889
|
toRulesyncCommand() {
|
|
@@ -1910,7 +1933,7 @@ var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
|
1910
1933
|
validate = true
|
|
1911
1934
|
}) {
|
|
1912
1935
|
const paths = this.getSettablePaths();
|
|
1913
|
-
const filePath =
|
|
1936
|
+
const filePath = join14(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1914
1937
|
const fileContent = await readFileContent(filePath);
|
|
1915
1938
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1916
1939
|
return new _KiloCommand({
|
|
@@ -1937,11 +1960,11 @@ var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
|
1937
1960
|
};
|
|
1938
1961
|
|
|
1939
1962
|
// src/features/commands/kiro-command.ts
|
|
1940
|
-
import { basename as basename12, join as
|
|
1963
|
+
import { basename as basename12, join as join15 } from "path";
|
|
1941
1964
|
var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
1942
1965
|
static getSettablePaths(_options = {}) {
|
|
1943
1966
|
return {
|
|
1944
|
-
relativeDirPath:
|
|
1967
|
+
relativeDirPath: join15(".kiro", "prompts")
|
|
1945
1968
|
};
|
|
1946
1969
|
}
|
|
1947
1970
|
toRulesyncCommand() {
|
|
@@ -1991,7 +2014,7 @@ var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
|
1991
2014
|
validate = true
|
|
1992
2015
|
}) {
|
|
1993
2016
|
const paths = this.getSettablePaths();
|
|
1994
|
-
const filePath =
|
|
2017
|
+
const filePath = join15(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1995
2018
|
const fileContent = await readFileContent(filePath);
|
|
1996
2019
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1997
2020
|
return new _KiroCommand({
|
|
@@ -2018,7 +2041,7 @@ var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
|
2018
2041
|
};
|
|
2019
2042
|
|
|
2020
2043
|
// src/features/commands/opencode-command.ts
|
|
2021
|
-
import { basename as basename13, join as
|
|
2044
|
+
import { basename as basename13, join as join16 } from "path";
|
|
2022
2045
|
import { optional as optional2, z as z10 } from "zod/mini";
|
|
2023
2046
|
var OpenCodeCommandFrontmatterSchema = z10.looseObject({
|
|
2024
2047
|
description: z10.string(),
|
|
@@ -2034,7 +2057,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2034
2057
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2035
2058
|
if (!result.success) {
|
|
2036
2059
|
throw new Error(
|
|
2037
|
-
`Invalid frontmatter in ${
|
|
2060
|
+
`Invalid frontmatter in ${join16(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
2038
2061
|
);
|
|
2039
2062
|
}
|
|
2040
2063
|
}
|
|
@@ -2047,7 +2070,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2047
2070
|
}
|
|
2048
2071
|
static getSettablePaths({ global } = {}) {
|
|
2049
2072
|
return {
|
|
2050
|
-
relativeDirPath: global ?
|
|
2073
|
+
relativeDirPath: global ? join16(".config", "opencode", "command") : join16(".opencode", "command")
|
|
2051
2074
|
};
|
|
2052
2075
|
}
|
|
2053
2076
|
getBody() {
|
|
@@ -2108,7 +2131,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2108
2131
|
return {
|
|
2109
2132
|
success: false,
|
|
2110
2133
|
error: new Error(
|
|
2111
|
-
`Invalid frontmatter in ${
|
|
2134
|
+
`Invalid frontmatter in ${join16(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
2112
2135
|
)
|
|
2113
2136
|
};
|
|
2114
2137
|
}
|
|
@@ -2119,7 +2142,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2119
2142
|
global = false
|
|
2120
2143
|
}) {
|
|
2121
2144
|
const paths = this.getSettablePaths({ global });
|
|
2122
|
-
const filePath =
|
|
2145
|
+
const filePath = join16(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2123
2146
|
const fileContent = await readFileContent(filePath);
|
|
2124
2147
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2125
2148
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2158,7 +2181,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2158
2181
|
};
|
|
2159
2182
|
|
|
2160
2183
|
// src/features/commands/roo-command.ts
|
|
2161
|
-
import { basename as basename14, join as
|
|
2184
|
+
import { basename as basename14, join as join17 } from "path";
|
|
2162
2185
|
import { optional as optional3, z as z11 } from "zod/mini";
|
|
2163
2186
|
var RooCommandFrontmatterSchema = z11.looseObject({
|
|
2164
2187
|
description: z11.string(),
|
|
@@ -2169,7 +2192,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2169
2192
|
body;
|
|
2170
2193
|
static getSettablePaths() {
|
|
2171
2194
|
return {
|
|
2172
|
-
relativeDirPath:
|
|
2195
|
+
relativeDirPath: join17(".roo", "commands")
|
|
2173
2196
|
};
|
|
2174
2197
|
}
|
|
2175
2198
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -2177,7 +2200,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2177
2200
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2178
2201
|
if (!result.success) {
|
|
2179
2202
|
throw new Error(
|
|
2180
|
-
`Invalid frontmatter in ${
|
|
2203
|
+
`Invalid frontmatter in ${join17(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
2181
2204
|
);
|
|
2182
2205
|
}
|
|
2183
2206
|
}
|
|
@@ -2248,7 +2271,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2248
2271
|
return {
|
|
2249
2272
|
success: false,
|
|
2250
2273
|
error: new Error(
|
|
2251
|
-
`Invalid frontmatter in ${
|
|
2274
|
+
`Invalid frontmatter in ${join17(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
2252
2275
|
)
|
|
2253
2276
|
};
|
|
2254
2277
|
}
|
|
@@ -2264,7 +2287,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2264
2287
|
relativeFilePath,
|
|
2265
2288
|
validate = true
|
|
2266
2289
|
}) {
|
|
2267
|
-
const filePath =
|
|
2290
|
+
const filePath = join17(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
2268
2291
|
const fileContent = await readFileContent(filePath);
|
|
2269
2292
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2270
2293
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2488,7 +2511,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2488
2511
|
*/
|
|
2489
2512
|
async loadRulesyncFiles() {
|
|
2490
2513
|
const rulesyncCommandPaths = await findFilesByGlobs(
|
|
2491
|
-
|
|
2514
|
+
join18(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
|
|
2492
2515
|
);
|
|
2493
2516
|
const rulesyncCommands = await Promise.all(
|
|
2494
2517
|
rulesyncCommandPaths.map(
|
|
@@ -2508,7 +2531,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2508
2531
|
const factory = this.getFactory(this.toolTarget);
|
|
2509
2532
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
2510
2533
|
const commandFilePaths = await findFilesByGlobs(
|
|
2511
|
-
|
|
2534
|
+
join18(this.baseDir, paths.relativeDirPath, `*.${factory.meta.extension}`)
|
|
2512
2535
|
);
|
|
2513
2536
|
if (forDeletion) {
|
|
2514
2537
|
const toolCommands2 = commandFilePaths.map(
|
|
@@ -2561,14 +2584,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2561
2584
|
import { z as z13 } from "zod/mini";
|
|
2562
2585
|
|
|
2563
2586
|
// src/features/ignore/augmentcode-ignore.ts
|
|
2564
|
-
import { join as
|
|
2587
|
+
import { join as join20 } from "path";
|
|
2565
2588
|
|
|
2566
2589
|
// src/types/tool-file.ts
|
|
2567
2590
|
var ToolFile = class extends AiFile {
|
|
2568
2591
|
};
|
|
2569
2592
|
|
|
2570
2593
|
// src/features/ignore/rulesync-ignore.ts
|
|
2571
|
-
import { join as
|
|
2594
|
+
import { join as join19 } from "path";
|
|
2572
2595
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
2573
2596
|
validate() {
|
|
2574
2597
|
return { success: true, error: null };
|
|
@@ -2588,12 +2611,12 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
2588
2611
|
static async fromFile() {
|
|
2589
2612
|
const baseDir = process.cwd();
|
|
2590
2613
|
const paths = this.getSettablePaths();
|
|
2591
|
-
const recommendedPath =
|
|
2614
|
+
const recommendedPath = join19(
|
|
2592
2615
|
baseDir,
|
|
2593
2616
|
paths.recommended.relativeDirPath,
|
|
2594
2617
|
paths.recommended.relativeFilePath
|
|
2595
2618
|
);
|
|
2596
|
-
const legacyPath =
|
|
2619
|
+
const legacyPath = join19(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
2597
2620
|
if (await fileExists(recommendedPath)) {
|
|
2598
2621
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
2599
2622
|
return new _RulesyncIgnore({
|
|
@@ -2709,7 +2732,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2709
2732
|
validate = true
|
|
2710
2733
|
}) {
|
|
2711
2734
|
const fileContent = await readFileContent(
|
|
2712
|
-
|
|
2735
|
+
join20(
|
|
2713
2736
|
baseDir,
|
|
2714
2737
|
this.getSettablePaths().relativeDirPath,
|
|
2715
2738
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2740,7 +2763,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2740
2763
|
|
|
2741
2764
|
// src/features/ignore/claudecode-ignore.ts
|
|
2742
2765
|
import { uniq } from "es-toolkit";
|
|
2743
|
-
import { join as
|
|
2766
|
+
import { join as join21 } from "path";
|
|
2744
2767
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
2745
2768
|
constructor(params) {
|
|
2746
2769
|
super(params);
|
|
@@ -2782,7 +2805,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2782
2805
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
2783
2806
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
2784
2807
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
2785
|
-
const filePath =
|
|
2808
|
+
const filePath = join21(
|
|
2786
2809
|
baseDir,
|
|
2787
2810
|
this.getSettablePaths().relativeDirPath,
|
|
2788
2811
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2818,7 +2841,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2818
2841
|
validate = true
|
|
2819
2842
|
}) {
|
|
2820
2843
|
const fileContent = await readFileContent(
|
|
2821
|
-
|
|
2844
|
+
join21(
|
|
2822
2845
|
baseDir,
|
|
2823
2846
|
this.getSettablePaths().relativeDirPath,
|
|
2824
2847
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2848,7 +2871,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2848
2871
|
};
|
|
2849
2872
|
|
|
2850
2873
|
// src/features/ignore/cline-ignore.ts
|
|
2851
|
-
import { join as
|
|
2874
|
+
import { join as join22 } from "path";
|
|
2852
2875
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
2853
2876
|
static getSettablePaths() {
|
|
2854
2877
|
return {
|
|
@@ -2885,7 +2908,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2885
2908
|
validate = true
|
|
2886
2909
|
}) {
|
|
2887
2910
|
const fileContent = await readFileContent(
|
|
2888
|
-
|
|
2911
|
+
join22(
|
|
2889
2912
|
baseDir,
|
|
2890
2913
|
this.getSettablePaths().relativeDirPath,
|
|
2891
2914
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2915,7 +2938,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2915
2938
|
};
|
|
2916
2939
|
|
|
2917
2940
|
// src/features/ignore/cursor-ignore.ts
|
|
2918
|
-
import { join as
|
|
2941
|
+
import { join as join23 } from "path";
|
|
2919
2942
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
2920
2943
|
static getSettablePaths() {
|
|
2921
2944
|
return {
|
|
@@ -2948,7 +2971,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2948
2971
|
validate = true
|
|
2949
2972
|
}) {
|
|
2950
2973
|
const fileContent = await readFileContent(
|
|
2951
|
-
|
|
2974
|
+
join23(
|
|
2952
2975
|
baseDir,
|
|
2953
2976
|
this.getSettablePaths().relativeDirPath,
|
|
2954
2977
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2978,7 +3001,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2978
3001
|
};
|
|
2979
3002
|
|
|
2980
3003
|
// src/features/ignore/geminicli-ignore.ts
|
|
2981
|
-
import { join as
|
|
3004
|
+
import { join as join24 } from "path";
|
|
2982
3005
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
2983
3006
|
static getSettablePaths() {
|
|
2984
3007
|
return {
|
|
@@ -3005,7 +3028,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
3005
3028
|
validate = true
|
|
3006
3029
|
}) {
|
|
3007
3030
|
const fileContent = await readFileContent(
|
|
3008
|
-
|
|
3031
|
+
join24(
|
|
3009
3032
|
baseDir,
|
|
3010
3033
|
this.getSettablePaths().relativeDirPath,
|
|
3011
3034
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3035,7 +3058,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
3035
3058
|
};
|
|
3036
3059
|
|
|
3037
3060
|
// src/features/ignore/junie-ignore.ts
|
|
3038
|
-
import { join as
|
|
3061
|
+
import { join as join25 } from "path";
|
|
3039
3062
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
3040
3063
|
static getSettablePaths() {
|
|
3041
3064
|
return {
|
|
@@ -3062,7 +3085,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
3062
3085
|
validate = true
|
|
3063
3086
|
}) {
|
|
3064
3087
|
const fileContent = await readFileContent(
|
|
3065
|
-
|
|
3088
|
+
join25(
|
|
3066
3089
|
baseDir,
|
|
3067
3090
|
this.getSettablePaths().relativeDirPath,
|
|
3068
3091
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3092,7 +3115,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
3092
3115
|
};
|
|
3093
3116
|
|
|
3094
3117
|
// src/features/ignore/kilo-ignore.ts
|
|
3095
|
-
import { join as
|
|
3118
|
+
import { join as join26 } from "path";
|
|
3096
3119
|
var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
3097
3120
|
static getSettablePaths() {
|
|
3098
3121
|
return {
|
|
@@ -3129,7 +3152,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
3129
3152
|
validate = true
|
|
3130
3153
|
}) {
|
|
3131
3154
|
const fileContent = await readFileContent(
|
|
3132
|
-
|
|
3155
|
+
join26(
|
|
3133
3156
|
baseDir,
|
|
3134
3157
|
this.getSettablePaths().relativeDirPath,
|
|
3135
3158
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3159,7 +3182,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
3159
3182
|
};
|
|
3160
3183
|
|
|
3161
3184
|
// src/features/ignore/kiro-ignore.ts
|
|
3162
|
-
import { join as
|
|
3185
|
+
import { join as join27 } from "path";
|
|
3163
3186
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
3164
3187
|
static getSettablePaths() {
|
|
3165
3188
|
return {
|
|
@@ -3186,7 +3209,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
3186
3209
|
validate = true
|
|
3187
3210
|
}) {
|
|
3188
3211
|
const fileContent = await readFileContent(
|
|
3189
|
-
|
|
3212
|
+
join27(
|
|
3190
3213
|
baseDir,
|
|
3191
3214
|
this.getSettablePaths().relativeDirPath,
|
|
3192
3215
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3216,7 +3239,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
3216
3239
|
};
|
|
3217
3240
|
|
|
3218
3241
|
// src/features/ignore/qwencode-ignore.ts
|
|
3219
|
-
import { join as
|
|
3242
|
+
import { join as join28 } from "path";
|
|
3220
3243
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
3221
3244
|
static getSettablePaths() {
|
|
3222
3245
|
return {
|
|
@@ -3243,7 +3266,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
3243
3266
|
validate = true
|
|
3244
3267
|
}) {
|
|
3245
3268
|
const fileContent = await readFileContent(
|
|
3246
|
-
|
|
3269
|
+
join28(
|
|
3247
3270
|
baseDir,
|
|
3248
3271
|
this.getSettablePaths().relativeDirPath,
|
|
3249
3272
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3273,7 +3296,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
3273
3296
|
};
|
|
3274
3297
|
|
|
3275
3298
|
// src/features/ignore/roo-ignore.ts
|
|
3276
|
-
import { join as
|
|
3299
|
+
import { join as join29 } from "path";
|
|
3277
3300
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
3278
3301
|
static getSettablePaths() {
|
|
3279
3302
|
return {
|
|
@@ -3300,7 +3323,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
3300
3323
|
validate = true
|
|
3301
3324
|
}) {
|
|
3302
3325
|
const fileContent = await readFileContent(
|
|
3303
|
-
|
|
3326
|
+
join29(
|
|
3304
3327
|
baseDir,
|
|
3305
3328
|
this.getSettablePaths().relativeDirPath,
|
|
3306
3329
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3330,7 +3353,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
3330
3353
|
};
|
|
3331
3354
|
|
|
3332
3355
|
// src/features/ignore/windsurf-ignore.ts
|
|
3333
|
-
import { join as
|
|
3356
|
+
import { join as join30 } from "path";
|
|
3334
3357
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
3335
3358
|
static getSettablePaths() {
|
|
3336
3359
|
return {
|
|
@@ -3357,7 +3380,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3357
3380
|
validate = true
|
|
3358
3381
|
}) {
|
|
3359
3382
|
const fileContent = await readFileContent(
|
|
3360
|
-
|
|
3383
|
+
join30(
|
|
3361
3384
|
baseDir,
|
|
3362
3385
|
this.getSettablePaths().relativeDirPath,
|
|
3363
3386
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3388,7 +3411,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3388
3411
|
|
|
3389
3412
|
// src/features/ignore/zed-ignore.ts
|
|
3390
3413
|
import { uniq as uniq2 } from "es-toolkit";
|
|
3391
|
-
import { join as
|
|
3414
|
+
import { join as join31 } from "path";
|
|
3392
3415
|
var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
3393
3416
|
constructor(params) {
|
|
3394
3417
|
super(params);
|
|
@@ -3424,7 +3447,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
3424
3447
|
}) {
|
|
3425
3448
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
3426
3449
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
3427
|
-
const filePath =
|
|
3450
|
+
const filePath = join31(
|
|
3428
3451
|
baseDir,
|
|
3429
3452
|
this.getSettablePaths().relativeDirPath,
|
|
3430
3453
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3451,7 +3474,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
3451
3474
|
validate = true
|
|
3452
3475
|
}) {
|
|
3453
3476
|
const fileContent = await readFileContent(
|
|
3454
|
-
|
|
3477
|
+
join31(
|
|
3455
3478
|
baseDir,
|
|
3456
3479
|
this.getSettablePaths().relativeDirPath,
|
|
3457
3480
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3633,10 +3656,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
3633
3656
|
import { z as z18 } from "zod/mini";
|
|
3634
3657
|
|
|
3635
3658
|
// src/features/mcp/claudecode-mcp.ts
|
|
3636
|
-
import { join as
|
|
3659
|
+
import { join as join34 } from "path";
|
|
3637
3660
|
|
|
3638
3661
|
// src/features/mcp/modular-mcp.ts
|
|
3639
|
-
import { join as
|
|
3662
|
+
import { join as join32 } from "path";
|
|
3640
3663
|
import { z as z15 } from "zod/mini";
|
|
3641
3664
|
|
|
3642
3665
|
// src/types/mcp.ts
|
|
@@ -3724,7 +3747,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3724
3747
|
args: [
|
|
3725
3748
|
"-y",
|
|
3726
3749
|
"@kimuson/modular-mcp",
|
|
3727
|
-
|
|
3750
|
+
join32(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3728
3751
|
],
|
|
3729
3752
|
env: {}
|
|
3730
3753
|
}
|
|
@@ -3762,7 +3785,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3762
3785
|
|
|
3763
3786
|
// src/features/mcp/rulesync-mcp.ts
|
|
3764
3787
|
import { omit } from "es-toolkit/object";
|
|
3765
|
-
import { join as
|
|
3788
|
+
import { join as join33 } from "path";
|
|
3766
3789
|
import { z as z16 } from "zod/mini";
|
|
3767
3790
|
var RulesyncMcpServerSchema = z16.union([
|
|
3768
3791
|
z16.extend(McpServerSchema, {
|
|
@@ -3818,12 +3841,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
3818
3841
|
}) {
|
|
3819
3842
|
const baseDir = process.cwd();
|
|
3820
3843
|
const paths = this.getSettablePaths();
|
|
3821
|
-
const recommendedPath =
|
|
3844
|
+
const recommendedPath = join33(
|
|
3822
3845
|
baseDir,
|
|
3823
3846
|
paths.recommended.relativeDirPath,
|
|
3824
3847
|
paths.recommended.relativeFilePath
|
|
3825
3848
|
);
|
|
3826
|
-
const legacyPath =
|
|
3849
|
+
const legacyPath = join33(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
3827
3850
|
if (await fileExists(recommendedPath)) {
|
|
3828
3851
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
3829
3852
|
return new _RulesyncMcp({
|
|
@@ -3967,7 +3990,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3967
3990
|
}) {
|
|
3968
3991
|
const paths = this.getSettablePaths({ global });
|
|
3969
3992
|
const fileContent = await readOrInitializeFileContent(
|
|
3970
|
-
|
|
3993
|
+
join34(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3971
3994
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3972
3995
|
);
|
|
3973
3996
|
const json = JSON.parse(fileContent);
|
|
@@ -3989,7 +4012,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3989
4012
|
}) {
|
|
3990
4013
|
const paths = this.getSettablePaths({ global });
|
|
3991
4014
|
const fileContent = await readOrInitializeFileContent(
|
|
3992
|
-
|
|
4015
|
+
join34(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3993
4016
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3994
4017
|
);
|
|
3995
4018
|
const json = JSON.parse(fileContent);
|
|
@@ -4024,20 +4047,22 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
4024
4047
|
static forDeletion({
|
|
4025
4048
|
baseDir = process.cwd(),
|
|
4026
4049
|
relativeDirPath,
|
|
4027
|
-
relativeFilePath
|
|
4050
|
+
relativeFilePath,
|
|
4051
|
+
global = false
|
|
4028
4052
|
}) {
|
|
4029
4053
|
return new _ClaudecodeMcp({
|
|
4030
4054
|
baseDir,
|
|
4031
4055
|
relativeDirPath,
|
|
4032
4056
|
relativeFilePath,
|
|
4033
4057
|
fileContent: "{}",
|
|
4034
|
-
validate: false
|
|
4058
|
+
validate: false,
|
|
4059
|
+
global
|
|
4035
4060
|
});
|
|
4036
4061
|
}
|
|
4037
4062
|
};
|
|
4038
4063
|
|
|
4039
4064
|
// src/features/mcp/cline-mcp.ts
|
|
4040
|
-
import { join as
|
|
4065
|
+
import { join as join35 } from "path";
|
|
4041
4066
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
4042
4067
|
json;
|
|
4043
4068
|
constructor(params) {
|
|
@@ -4058,7 +4083,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
4058
4083
|
validate = true
|
|
4059
4084
|
}) {
|
|
4060
4085
|
const fileContent = await readFileContent(
|
|
4061
|
-
|
|
4086
|
+
join35(
|
|
4062
4087
|
baseDir,
|
|
4063
4088
|
this.getSettablePaths().relativeDirPath,
|
|
4064
4089
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4107,7 +4132,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
4107
4132
|
};
|
|
4108
4133
|
|
|
4109
4134
|
// src/features/mcp/codexcli-mcp.ts
|
|
4110
|
-
import { join as
|
|
4135
|
+
import { join as join36 } from "path";
|
|
4111
4136
|
import * as smolToml from "smol-toml";
|
|
4112
4137
|
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
4113
4138
|
toml;
|
|
@@ -4143,7 +4168,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4143
4168
|
}) {
|
|
4144
4169
|
const paths = this.getSettablePaths({ global });
|
|
4145
4170
|
const fileContent = await readFileContent(
|
|
4146
|
-
|
|
4171
|
+
join36(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
4147
4172
|
);
|
|
4148
4173
|
return new _CodexcliMcp({
|
|
4149
4174
|
baseDir,
|
|
@@ -4160,7 +4185,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4160
4185
|
global = false
|
|
4161
4186
|
}) {
|
|
4162
4187
|
const paths = this.getSettablePaths({ global });
|
|
4163
|
-
const configTomlFilePath =
|
|
4188
|
+
const configTomlFilePath = join36(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
4164
4189
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
4165
4190
|
configTomlFilePath,
|
|
4166
4191
|
smolToml.stringify({})
|
|
@@ -4214,7 +4239,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4214
4239
|
};
|
|
4215
4240
|
|
|
4216
4241
|
// src/features/mcp/copilot-mcp.ts
|
|
4217
|
-
import { join as
|
|
4242
|
+
import { join as join37 } from "path";
|
|
4218
4243
|
function convertToCopilotFormat(mcpServers) {
|
|
4219
4244
|
return { servers: mcpServers };
|
|
4220
4245
|
}
|
|
@@ -4241,7 +4266,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4241
4266
|
validate = true
|
|
4242
4267
|
}) {
|
|
4243
4268
|
const fileContent = await readFileContent(
|
|
4244
|
-
|
|
4269
|
+
join37(
|
|
4245
4270
|
baseDir,
|
|
4246
4271
|
this.getSettablePaths().relativeDirPath,
|
|
4247
4272
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4294,7 +4319,47 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4294
4319
|
};
|
|
4295
4320
|
|
|
4296
4321
|
// src/features/mcp/cursor-mcp.ts
|
|
4297
|
-
import { join as
|
|
4322
|
+
import { join as join38 } from "path";
|
|
4323
|
+
var CURSOR_ENV_VAR_PATTERN = /\$\{env:([^}]+)\}/g;
|
|
4324
|
+
function isMcpServers(value) {
|
|
4325
|
+
return value !== void 0 && value !== null && typeof value === "object";
|
|
4326
|
+
}
|
|
4327
|
+
function convertEnvFromCursorFormat(mcpServers) {
|
|
4328
|
+
return Object.fromEntries(
|
|
4329
|
+
Object.entries(mcpServers).map(([name, config]) => [
|
|
4330
|
+
name,
|
|
4331
|
+
{
|
|
4332
|
+
...config,
|
|
4333
|
+
...config.env && {
|
|
4334
|
+
env: Object.fromEntries(
|
|
4335
|
+
Object.entries(config.env).map(([k, v]) => [
|
|
4336
|
+
k,
|
|
4337
|
+
v.replace(CURSOR_ENV_VAR_PATTERN, "${$1}")
|
|
4338
|
+
])
|
|
4339
|
+
)
|
|
4340
|
+
}
|
|
4341
|
+
}
|
|
4342
|
+
])
|
|
4343
|
+
);
|
|
4344
|
+
}
|
|
4345
|
+
function convertEnvToCursorFormat(mcpServers) {
|
|
4346
|
+
return Object.fromEntries(
|
|
4347
|
+
Object.entries(mcpServers).map(([name, config]) => [
|
|
4348
|
+
name,
|
|
4349
|
+
{
|
|
4350
|
+
...config,
|
|
4351
|
+
...config.env && {
|
|
4352
|
+
env: Object.fromEntries(
|
|
4353
|
+
Object.entries(config.env).map(([k, v]) => [
|
|
4354
|
+
k,
|
|
4355
|
+
v.replace(/\$\{(?!env:)([^}:]+)\}/g, "${env:$1}")
|
|
4356
|
+
])
|
|
4357
|
+
)
|
|
4358
|
+
}
|
|
4359
|
+
}
|
|
4360
|
+
])
|
|
4361
|
+
);
|
|
4362
|
+
}
|
|
4298
4363
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
4299
4364
|
json;
|
|
4300
4365
|
constructor(params) {
|
|
@@ -4315,7 +4380,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4315
4380
|
validate = true
|
|
4316
4381
|
}) {
|
|
4317
4382
|
const fileContent = await readFileContent(
|
|
4318
|
-
|
|
4383
|
+
join38(
|
|
4319
4384
|
baseDir,
|
|
4320
4385
|
this.getSettablePaths().relativeDirPath,
|
|
4321
4386
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4335,8 +4400,10 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4335
4400
|
validate = true
|
|
4336
4401
|
}) {
|
|
4337
4402
|
const json = rulesyncMcp.getJson();
|
|
4403
|
+
const mcpServers = isMcpServers(json.mcpServers) ? json.mcpServers : {};
|
|
4404
|
+
const transformedServers = convertEnvToCursorFormat(mcpServers);
|
|
4338
4405
|
const cursorConfig = {
|
|
4339
|
-
mcpServers:
|
|
4406
|
+
mcpServers: transformedServers
|
|
4340
4407
|
};
|
|
4341
4408
|
const fileContent = JSON.stringify(cursorConfig, null, 2);
|
|
4342
4409
|
return new _CursorMcp({
|
|
@@ -4348,11 +4415,17 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4348
4415
|
});
|
|
4349
4416
|
}
|
|
4350
4417
|
toRulesyncMcp() {
|
|
4418
|
+
const mcpServers = isMcpServers(this.json.mcpServers) ? this.json.mcpServers : {};
|
|
4419
|
+
const transformedServers = convertEnvFromCursorFormat(mcpServers);
|
|
4420
|
+
const transformedJson = {
|
|
4421
|
+
...this.json,
|
|
4422
|
+
mcpServers: transformedServers
|
|
4423
|
+
};
|
|
4351
4424
|
return new RulesyncMcp({
|
|
4352
4425
|
baseDir: this.baseDir,
|
|
4353
4426
|
relativeDirPath: this.relativeDirPath,
|
|
4354
4427
|
relativeFilePath: "rulesync.mcp.json",
|
|
4355
|
-
fileContent:
|
|
4428
|
+
fileContent: JSON.stringify(transformedJson),
|
|
4356
4429
|
validate: true
|
|
4357
4430
|
});
|
|
4358
4431
|
}
|
|
@@ -4375,7 +4448,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4375
4448
|
};
|
|
4376
4449
|
|
|
4377
4450
|
// src/features/mcp/geminicli-mcp.ts
|
|
4378
|
-
import { join as
|
|
4451
|
+
import { join as join39 } from "path";
|
|
4379
4452
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
4380
4453
|
json;
|
|
4381
4454
|
constructor(params) {
|
|
@@ -4404,7 +4477,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4404
4477
|
}) {
|
|
4405
4478
|
const paths = this.getSettablePaths({ global });
|
|
4406
4479
|
const fileContent = await readOrInitializeFileContent(
|
|
4407
|
-
|
|
4480
|
+
join39(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4408
4481
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4409
4482
|
);
|
|
4410
4483
|
const json = JSON.parse(fileContent);
|
|
@@ -4425,7 +4498,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4425
4498
|
}) {
|
|
4426
4499
|
const paths = this.getSettablePaths({ global });
|
|
4427
4500
|
const fileContent = await readOrInitializeFileContent(
|
|
4428
|
-
|
|
4501
|
+
join39(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4429
4502
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4430
4503
|
);
|
|
4431
4504
|
const json = JSON.parse(fileContent);
|
|
@@ -4446,23 +4519,31 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4446
4519
|
validate() {
|
|
4447
4520
|
return { success: true, error: null };
|
|
4448
4521
|
}
|
|
4522
|
+
/**
|
|
4523
|
+
* settings.json may contain other settings, so it should not be deleted.
|
|
4524
|
+
*/
|
|
4525
|
+
isDeletable() {
|
|
4526
|
+
return false;
|
|
4527
|
+
}
|
|
4449
4528
|
static forDeletion({
|
|
4450
4529
|
baseDir = process.cwd(),
|
|
4451
4530
|
relativeDirPath,
|
|
4452
|
-
relativeFilePath
|
|
4531
|
+
relativeFilePath,
|
|
4532
|
+
global = false
|
|
4453
4533
|
}) {
|
|
4454
4534
|
return new _GeminiCliMcp({
|
|
4455
4535
|
baseDir,
|
|
4456
4536
|
relativeDirPath,
|
|
4457
4537
|
relativeFilePath,
|
|
4458
4538
|
fileContent: "{}",
|
|
4459
|
-
validate: false
|
|
4539
|
+
validate: false,
|
|
4540
|
+
global
|
|
4460
4541
|
});
|
|
4461
4542
|
}
|
|
4462
4543
|
};
|
|
4463
4544
|
|
|
4464
4545
|
// src/features/mcp/junie-mcp.ts
|
|
4465
|
-
import { join as
|
|
4546
|
+
import { join as join40 } from "path";
|
|
4466
4547
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
4467
4548
|
json;
|
|
4468
4549
|
constructor(params) {
|
|
@@ -4474,7 +4555,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4474
4555
|
}
|
|
4475
4556
|
static getSettablePaths() {
|
|
4476
4557
|
return {
|
|
4477
|
-
relativeDirPath:
|
|
4558
|
+
relativeDirPath: join40(".junie", "mcp"),
|
|
4478
4559
|
relativeFilePath: "mcp.json"
|
|
4479
4560
|
};
|
|
4480
4561
|
}
|
|
@@ -4483,7 +4564,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4483
4564
|
validate = true
|
|
4484
4565
|
}) {
|
|
4485
4566
|
const fileContent = await readFileContent(
|
|
4486
|
-
|
|
4567
|
+
join40(
|
|
4487
4568
|
baseDir,
|
|
4488
4569
|
this.getSettablePaths().relativeDirPath,
|
|
4489
4570
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4532,7 +4613,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4532
4613
|
};
|
|
4533
4614
|
|
|
4534
4615
|
// src/features/mcp/kilo-mcp.ts
|
|
4535
|
-
import { join as
|
|
4616
|
+
import { join as join41 } from "path";
|
|
4536
4617
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
4537
4618
|
json;
|
|
4538
4619
|
constructor(params) {
|
|
@@ -4554,7 +4635,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4554
4635
|
}) {
|
|
4555
4636
|
const paths = this.getSettablePaths();
|
|
4556
4637
|
const fileContent = await readOrInitializeFileContent(
|
|
4557
|
-
|
|
4638
|
+
join41(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4558
4639
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4559
4640
|
);
|
|
4560
4641
|
return new _KiloMcp({
|
|
@@ -4608,7 +4689,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4608
4689
|
};
|
|
4609
4690
|
|
|
4610
4691
|
// src/features/mcp/kiro-mcp.ts
|
|
4611
|
-
import { join as
|
|
4692
|
+
import { join as join42 } from "path";
|
|
4612
4693
|
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
4613
4694
|
json;
|
|
4614
4695
|
constructor(params) {
|
|
@@ -4620,7 +4701,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4620
4701
|
}
|
|
4621
4702
|
static getSettablePaths() {
|
|
4622
4703
|
return {
|
|
4623
|
-
relativeDirPath:
|
|
4704
|
+
relativeDirPath: join42(".kiro", "settings"),
|
|
4624
4705
|
relativeFilePath: "mcp.json"
|
|
4625
4706
|
};
|
|
4626
4707
|
}
|
|
@@ -4630,7 +4711,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4630
4711
|
}) {
|
|
4631
4712
|
const paths = this.getSettablePaths();
|
|
4632
4713
|
const fileContent = await readOrInitializeFileContent(
|
|
4633
|
-
|
|
4714
|
+
join42(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4634
4715
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4635
4716
|
);
|
|
4636
4717
|
return new _KiroMcp({
|
|
@@ -4684,7 +4765,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4684
4765
|
};
|
|
4685
4766
|
|
|
4686
4767
|
// src/features/mcp/opencode-mcp.ts
|
|
4687
|
-
import { join as
|
|
4768
|
+
import { join as join43 } from "path";
|
|
4688
4769
|
import { z as z17 } from "zod/mini";
|
|
4689
4770
|
var OpencodeMcpLocalServerSchema = z17.object({
|
|
4690
4771
|
type: z17.literal("local"),
|
|
@@ -4808,7 +4889,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4808
4889
|
}) {
|
|
4809
4890
|
const paths = this.getSettablePaths({ global });
|
|
4810
4891
|
const fileContent = await readOrInitializeFileContent(
|
|
4811
|
-
|
|
4892
|
+
join43(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4812
4893
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4813
4894
|
);
|
|
4814
4895
|
const json = JSON.parse(fileContent);
|
|
@@ -4829,7 +4910,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4829
4910
|
}) {
|
|
4830
4911
|
const paths = this.getSettablePaths({ global });
|
|
4831
4912
|
const fileContent = await readOrInitializeFileContent(
|
|
4832
|
-
|
|
4913
|
+
join43(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4833
4914
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4834
4915
|
);
|
|
4835
4916
|
const json = JSON.parse(fileContent);
|
|
@@ -4860,20 +4941,22 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4860
4941
|
static forDeletion({
|
|
4861
4942
|
baseDir = process.cwd(),
|
|
4862
4943
|
relativeDirPath,
|
|
4863
|
-
relativeFilePath
|
|
4944
|
+
relativeFilePath,
|
|
4945
|
+
global = false
|
|
4864
4946
|
}) {
|
|
4865
4947
|
return new _OpencodeMcp({
|
|
4866
4948
|
baseDir,
|
|
4867
4949
|
relativeDirPath,
|
|
4868
4950
|
relativeFilePath,
|
|
4869
4951
|
fileContent: "{}",
|
|
4870
|
-
validate: false
|
|
4952
|
+
validate: false,
|
|
4953
|
+
global
|
|
4871
4954
|
});
|
|
4872
4955
|
}
|
|
4873
4956
|
};
|
|
4874
4957
|
|
|
4875
4958
|
// src/features/mcp/roo-mcp.ts
|
|
4876
|
-
import { join as
|
|
4959
|
+
import { join as join44 } from "path";
|
|
4877
4960
|
function isRooMcpServers(value) {
|
|
4878
4961
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
4879
4962
|
}
|
|
@@ -4925,7 +5008,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4925
5008
|
validate = true
|
|
4926
5009
|
}) {
|
|
4927
5010
|
const fileContent = await readFileContent(
|
|
4928
|
-
|
|
5011
|
+
join44(
|
|
4929
5012
|
baseDir,
|
|
4930
5013
|
this.getSettablePaths().relativeDirPath,
|
|
4931
5014
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5240,24 +5323,24 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
5240
5323
|
|
|
5241
5324
|
// src/features/rules/rules-processor.ts
|
|
5242
5325
|
import { encode } from "@toon-format/toon";
|
|
5243
|
-
import { basename as
|
|
5326
|
+
import { basename as basename22, join as join96, relative as relative4 } from "path";
|
|
5244
5327
|
import { z as z44 } from "zod/mini";
|
|
5245
5328
|
|
|
5246
5329
|
// src/constants/general.ts
|
|
5247
5330
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
5248
5331
|
|
|
5249
5332
|
// src/features/skills/agentsmd-skill.ts
|
|
5250
|
-
import { join as
|
|
5333
|
+
import { join as join48 } from "path";
|
|
5251
5334
|
|
|
5252
5335
|
// src/features/skills/simulated-skill.ts
|
|
5253
|
-
import { join as
|
|
5336
|
+
import { join as join47 } from "path";
|
|
5254
5337
|
import { z as z19 } from "zod/mini";
|
|
5255
5338
|
|
|
5256
5339
|
// src/features/skills/tool-skill.ts
|
|
5257
|
-
import { join as
|
|
5340
|
+
import { join as join46 } from "path";
|
|
5258
5341
|
|
|
5259
5342
|
// src/types/ai-dir.ts
|
|
5260
|
-
import path2, { basename as basename16, join as
|
|
5343
|
+
import path2, { basename as basename16, join as join45, relative as relative3, resolve as resolve4 } from "path";
|
|
5261
5344
|
var AiDir = class {
|
|
5262
5345
|
/**
|
|
5263
5346
|
* @example "."
|
|
@@ -5351,8 +5434,8 @@ var AiDir = class {
|
|
|
5351
5434
|
* @returns Array of files with their relative paths and buffers
|
|
5352
5435
|
*/
|
|
5353
5436
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
5354
|
-
const dirPath =
|
|
5355
|
-
const glob =
|
|
5437
|
+
const dirPath = join45(baseDir, relativeDirPath, dirName);
|
|
5438
|
+
const glob = join45(dirPath, "**", "*");
|
|
5356
5439
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
5357
5440
|
const filteredPaths = filePaths.filter((filePath) => basename16(filePath) !== excludeFileName);
|
|
5358
5441
|
const files = await Promise.all(
|
|
@@ -5450,8 +5533,8 @@ var ToolSkill = class extends AiDir {
|
|
|
5450
5533
|
}) {
|
|
5451
5534
|
const settablePaths = getSettablePaths({ global });
|
|
5452
5535
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5453
|
-
const skillDirPath =
|
|
5454
|
-
const skillFilePath =
|
|
5536
|
+
const skillDirPath = join46(baseDir, actualRelativeDirPath, dirName);
|
|
5537
|
+
const skillFilePath = join46(skillDirPath, SKILL_FILE_NAME);
|
|
5455
5538
|
if (!await fileExists(skillFilePath)) {
|
|
5456
5539
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5457
5540
|
}
|
|
@@ -5509,7 +5592,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5509
5592
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
5510
5593
|
if (!result.success) {
|
|
5511
5594
|
throw new Error(
|
|
5512
|
-
`Invalid frontmatter in ${
|
|
5595
|
+
`Invalid frontmatter in ${join47(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
5513
5596
|
);
|
|
5514
5597
|
}
|
|
5515
5598
|
}
|
|
@@ -5567,8 +5650,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5567
5650
|
}) {
|
|
5568
5651
|
const settablePaths = this.getSettablePaths();
|
|
5569
5652
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5570
|
-
const skillDirPath =
|
|
5571
|
-
const skillFilePath =
|
|
5653
|
+
const skillDirPath = join47(baseDir, actualRelativeDirPath, dirName);
|
|
5654
|
+
const skillFilePath = join47(skillDirPath, SKILL_FILE_NAME);
|
|
5572
5655
|
if (!await fileExists(skillFilePath)) {
|
|
5573
5656
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5574
5657
|
}
|
|
@@ -5645,7 +5728,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5645
5728
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
5646
5729
|
}
|
|
5647
5730
|
return {
|
|
5648
|
-
relativeDirPath:
|
|
5731
|
+
relativeDirPath: join48(".agents", "skills")
|
|
5649
5732
|
};
|
|
5650
5733
|
}
|
|
5651
5734
|
static async fromDir(params) {
|
|
@@ -5672,14 +5755,14 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5672
5755
|
};
|
|
5673
5756
|
|
|
5674
5757
|
// src/features/skills/geminicli-skill.ts
|
|
5675
|
-
import { join as
|
|
5758
|
+
import { join as join49 } from "path";
|
|
5676
5759
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5677
5760
|
static getSettablePaths(options) {
|
|
5678
5761
|
if (options?.global) {
|
|
5679
5762
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5680
5763
|
}
|
|
5681
5764
|
return {
|
|
5682
|
-
relativeDirPath:
|
|
5765
|
+
relativeDirPath: join49(".gemini", "skills")
|
|
5683
5766
|
};
|
|
5684
5767
|
}
|
|
5685
5768
|
static async fromDir(params) {
|
|
@@ -5706,11 +5789,11 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
|
5706
5789
|
};
|
|
5707
5790
|
|
|
5708
5791
|
// src/features/skills/skills-processor.ts
|
|
5709
|
-
import { basename as basename17, join as
|
|
5792
|
+
import { basename as basename17, join as join61 } from "path";
|
|
5710
5793
|
import { z as z30 } from "zod/mini";
|
|
5711
5794
|
|
|
5712
5795
|
// src/types/dir-feature-processor.ts
|
|
5713
|
-
import { join as
|
|
5796
|
+
import { join as join50 } from "path";
|
|
5714
5797
|
var DirFeatureProcessor = class {
|
|
5715
5798
|
baseDir;
|
|
5716
5799
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -5732,14 +5815,14 @@ var DirFeatureProcessor = class {
|
|
|
5732
5815
|
await ensureDir(dirPath);
|
|
5733
5816
|
const mainFile = aiDir.getMainFile();
|
|
5734
5817
|
if (mainFile) {
|
|
5735
|
-
const mainFilePath =
|
|
5818
|
+
const mainFilePath = join50(dirPath, mainFile.name);
|
|
5736
5819
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5737
5820
|
const contentWithNewline = addTrailingNewline(content);
|
|
5738
5821
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5739
5822
|
}
|
|
5740
5823
|
const otherFiles = aiDir.getOtherFiles();
|
|
5741
5824
|
for (const file of otherFiles) {
|
|
5742
|
-
const filePath =
|
|
5825
|
+
const filePath = join50(dirPath, file.relativeFilePathToDirPath);
|
|
5743
5826
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5744
5827
|
await writeFileContent(filePath, contentWithNewline);
|
|
5745
5828
|
}
|
|
@@ -5754,11 +5837,11 @@ var DirFeatureProcessor = class {
|
|
|
5754
5837
|
};
|
|
5755
5838
|
|
|
5756
5839
|
// src/features/skills/antigravity-skill.ts
|
|
5757
|
-
import { join as
|
|
5840
|
+
import { join as join52 } from "path";
|
|
5758
5841
|
import { z as z21 } from "zod/mini";
|
|
5759
5842
|
|
|
5760
5843
|
// src/features/skills/rulesync-skill.ts
|
|
5761
|
-
import { join as
|
|
5844
|
+
import { join as join51 } from "path";
|
|
5762
5845
|
import { z as z20 } from "zod/mini";
|
|
5763
5846
|
var RulesyncSkillFrontmatterSchemaInternal = z20.looseObject({
|
|
5764
5847
|
name: z20.string(),
|
|
@@ -5850,8 +5933,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5850
5933
|
dirName,
|
|
5851
5934
|
global = false
|
|
5852
5935
|
}) {
|
|
5853
|
-
const skillDirPath =
|
|
5854
|
-
const skillFilePath =
|
|
5936
|
+
const skillDirPath = join51(baseDir, relativeDirPath, dirName);
|
|
5937
|
+
const skillFilePath = join51(skillDirPath, SKILL_FILE_NAME);
|
|
5855
5938
|
if (!await fileExists(skillFilePath)) {
|
|
5856
5939
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5857
5940
|
}
|
|
@@ -5888,7 +5971,7 @@ var AntigravitySkillFrontmatterSchema = z21.looseObject({
|
|
|
5888
5971
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
5889
5972
|
constructor({
|
|
5890
5973
|
baseDir = process.cwd(),
|
|
5891
|
-
relativeDirPath =
|
|
5974
|
+
relativeDirPath = join52(".agent", "skills"),
|
|
5892
5975
|
dirName,
|
|
5893
5976
|
frontmatter,
|
|
5894
5977
|
body,
|
|
@@ -5920,11 +6003,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
5920
6003
|
} = {}) {
|
|
5921
6004
|
if (global) {
|
|
5922
6005
|
return {
|
|
5923
|
-
relativeDirPath:
|
|
6006
|
+
relativeDirPath: join52(".gemini", "antigravity", "skills")
|
|
5924
6007
|
};
|
|
5925
6008
|
}
|
|
5926
6009
|
return {
|
|
5927
|
-
relativeDirPath:
|
|
6010
|
+
relativeDirPath: join52(".agent", "skills")
|
|
5928
6011
|
};
|
|
5929
6012
|
}
|
|
5930
6013
|
getFrontmatter() {
|
|
@@ -6006,9 +6089,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
6006
6089
|
});
|
|
6007
6090
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6008
6091
|
if (!result.success) {
|
|
6009
|
-
const skillDirPath =
|
|
6092
|
+
const skillDirPath = join52(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6010
6093
|
throw new Error(
|
|
6011
|
-
`Invalid frontmatter in ${
|
|
6094
|
+
`Invalid frontmatter in ${join52(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6012
6095
|
);
|
|
6013
6096
|
}
|
|
6014
6097
|
return new _AntigravitySkill({
|
|
@@ -6042,7 +6125,7 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
6042
6125
|
};
|
|
6043
6126
|
|
|
6044
6127
|
// src/features/skills/claudecode-skill.ts
|
|
6045
|
-
import { join as
|
|
6128
|
+
import { join as join53 } from "path";
|
|
6046
6129
|
import { z as z22 } from "zod/mini";
|
|
6047
6130
|
var ClaudecodeSkillFrontmatterSchema = z22.looseObject({
|
|
6048
6131
|
name: z22.string(),
|
|
@@ -6052,7 +6135,7 @@ var ClaudecodeSkillFrontmatterSchema = z22.looseObject({
|
|
|
6052
6135
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
6053
6136
|
constructor({
|
|
6054
6137
|
baseDir = process.cwd(),
|
|
6055
|
-
relativeDirPath =
|
|
6138
|
+
relativeDirPath = join53(".claude", "skills"),
|
|
6056
6139
|
dirName,
|
|
6057
6140
|
frontmatter,
|
|
6058
6141
|
body,
|
|
@@ -6083,7 +6166,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6083
6166
|
global: _global = false
|
|
6084
6167
|
} = {}) {
|
|
6085
6168
|
return {
|
|
6086
|
-
relativeDirPath:
|
|
6169
|
+
relativeDirPath: join53(".claude", "skills")
|
|
6087
6170
|
};
|
|
6088
6171
|
}
|
|
6089
6172
|
getFrontmatter() {
|
|
@@ -6171,9 +6254,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6171
6254
|
});
|
|
6172
6255
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6173
6256
|
if (!result.success) {
|
|
6174
|
-
const skillDirPath =
|
|
6257
|
+
const skillDirPath = join53(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6175
6258
|
throw new Error(
|
|
6176
|
-
`Invalid frontmatter in ${
|
|
6259
|
+
`Invalid frontmatter in ${join53(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6177
6260
|
);
|
|
6178
6261
|
}
|
|
6179
6262
|
return new _ClaudecodeSkill({
|
|
@@ -6207,7 +6290,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6207
6290
|
};
|
|
6208
6291
|
|
|
6209
6292
|
// src/features/skills/codexcli-skill.ts
|
|
6210
|
-
import { join as
|
|
6293
|
+
import { join as join54 } from "path";
|
|
6211
6294
|
import { z as z23 } from "zod/mini";
|
|
6212
6295
|
var CodexCliSkillFrontmatterSchema = z23.looseObject({
|
|
6213
6296
|
name: z23.string(),
|
|
@@ -6221,7 +6304,7 @@ var CodexCliSkillFrontmatterSchema = z23.looseObject({
|
|
|
6221
6304
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
6222
6305
|
constructor({
|
|
6223
6306
|
baseDir = process.cwd(),
|
|
6224
|
-
relativeDirPath =
|
|
6307
|
+
relativeDirPath = join54(".codex", "skills"),
|
|
6225
6308
|
dirName,
|
|
6226
6309
|
frontmatter,
|
|
6227
6310
|
body,
|
|
@@ -6252,7 +6335,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6252
6335
|
global: _global = false
|
|
6253
6336
|
} = {}) {
|
|
6254
6337
|
return {
|
|
6255
|
-
relativeDirPath:
|
|
6338
|
+
relativeDirPath: join54(".codex", "skills")
|
|
6256
6339
|
};
|
|
6257
6340
|
}
|
|
6258
6341
|
getFrontmatter() {
|
|
@@ -6344,9 +6427,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6344
6427
|
});
|
|
6345
6428
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6346
6429
|
if (!result.success) {
|
|
6347
|
-
const skillDirPath =
|
|
6430
|
+
const skillDirPath = join54(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6348
6431
|
throw new Error(
|
|
6349
|
-
`Invalid frontmatter in ${
|
|
6432
|
+
`Invalid frontmatter in ${join54(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6350
6433
|
);
|
|
6351
6434
|
}
|
|
6352
6435
|
return new _CodexCliSkill({
|
|
@@ -6380,7 +6463,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6380
6463
|
};
|
|
6381
6464
|
|
|
6382
6465
|
// src/features/skills/copilot-skill.ts
|
|
6383
|
-
import { join as
|
|
6466
|
+
import { join as join55 } from "path";
|
|
6384
6467
|
import { z as z24 } from "zod/mini";
|
|
6385
6468
|
var CopilotSkillFrontmatterSchema = z24.looseObject({
|
|
6386
6469
|
name: z24.string(),
|
|
@@ -6390,7 +6473,7 @@ var CopilotSkillFrontmatterSchema = z24.looseObject({
|
|
|
6390
6473
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
6391
6474
|
constructor({
|
|
6392
6475
|
baseDir = process.cwd(),
|
|
6393
|
-
relativeDirPath =
|
|
6476
|
+
relativeDirPath = join55(".github", "skills"),
|
|
6394
6477
|
dirName,
|
|
6395
6478
|
frontmatter,
|
|
6396
6479
|
body,
|
|
@@ -6422,7 +6505,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6422
6505
|
throw new Error("CopilotSkill does not support global mode.");
|
|
6423
6506
|
}
|
|
6424
6507
|
return {
|
|
6425
|
-
relativeDirPath:
|
|
6508
|
+
relativeDirPath: join55(".github", "skills")
|
|
6426
6509
|
};
|
|
6427
6510
|
}
|
|
6428
6511
|
getFrontmatter() {
|
|
@@ -6510,9 +6593,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6510
6593
|
});
|
|
6511
6594
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6512
6595
|
if (!result.success) {
|
|
6513
|
-
const skillDirPath =
|
|
6596
|
+
const skillDirPath = join55(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6514
6597
|
throw new Error(
|
|
6515
|
-
`Invalid frontmatter in ${
|
|
6598
|
+
`Invalid frontmatter in ${join55(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6516
6599
|
);
|
|
6517
6600
|
}
|
|
6518
6601
|
return new _CopilotSkill({
|
|
@@ -6547,7 +6630,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6547
6630
|
};
|
|
6548
6631
|
|
|
6549
6632
|
// src/features/skills/cursor-skill.ts
|
|
6550
|
-
import { join as
|
|
6633
|
+
import { join as join56 } from "path";
|
|
6551
6634
|
import { z as z25 } from "zod/mini";
|
|
6552
6635
|
var CursorSkillFrontmatterSchema = z25.looseObject({
|
|
6553
6636
|
name: z25.string(),
|
|
@@ -6556,7 +6639,7 @@ var CursorSkillFrontmatterSchema = z25.looseObject({
|
|
|
6556
6639
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
6557
6640
|
constructor({
|
|
6558
6641
|
baseDir = process.cwd(),
|
|
6559
|
-
relativeDirPath =
|
|
6642
|
+
relativeDirPath = join56(".cursor", "skills"),
|
|
6560
6643
|
dirName,
|
|
6561
6644
|
frontmatter,
|
|
6562
6645
|
body,
|
|
@@ -6588,7 +6671,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6588
6671
|
throw new Error("CursorSkill does not support global mode.");
|
|
6589
6672
|
}
|
|
6590
6673
|
return {
|
|
6591
|
-
relativeDirPath:
|
|
6674
|
+
relativeDirPath: join56(".cursor", "skills")
|
|
6592
6675
|
};
|
|
6593
6676
|
}
|
|
6594
6677
|
getFrontmatter() {
|
|
@@ -6670,9 +6753,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6670
6753
|
});
|
|
6671
6754
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6672
6755
|
if (!result.success) {
|
|
6673
|
-
const skillDirPath =
|
|
6756
|
+
const skillDirPath = join56(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6674
6757
|
throw new Error(
|
|
6675
|
-
`Invalid frontmatter in ${
|
|
6758
|
+
`Invalid frontmatter in ${join56(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6676
6759
|
);
|
|
6677
6760
|
}
|
|
6678
6761
|
return new _CursorSkill({
|
|
@@ -6707,7 +6790,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6707
6790
|
};
|
|
6708
6791
|
|
|
6709
6792
|
// src/features/skills/kilo-skill.ts
|
|
6710
|
-
import { join as
|
|
6793
|
+
import { join as join57 } from "path";
|
|
6711
6794
|
import { z as z26 } from "zod/mini";
|
|
6712
6795
|
var KiloSkillFrontmatterSchema = z26.looseObject({
|
|
6713
6796
|
name: z26.string(),
|
|
@@ -6716,7 +6799,7 @@ var KiloSkillFrontmatterSchema = z26.looseObject({
|
|
|
6716
6799
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
6717
6800
|
constructor({
|
|
6718
6801
|
baseDir = process.cwd(),
|
|
6719
|
-
relativeDirPath =
|
|
6802
|
+
relativeDirPath = join57(".kilocode", "skills"),
|
|
6720
6803
|
dirName,
|
|
6721
6804
|
frontmatter,
|
|
6722
6805
|
body,
|
|
@@ -6747,7 +6830,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6747
6830
|
global: _global = false
|
|
6748
6831
|
} = {}) {
|
|
6749
6832
|
return {
|
|
6750
|
-
relativeDirPath:
|
|
6833
|
+
relativeDirPath: join57(".kilocode", "skills")
|
|
6751
6834
|
};
|
|
6752
6835
|
}
|
|
6753
6836
|
getFrontmatter() {
|
|
@@ -6837,13 +6920,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6837
6920
|
});
|
|
6838
6921
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6839
6922
|
if (!result.success) {
|
|
6840
|
-
const skillDirPath =
|
|
6923
|
+
const skillDirPath = join57(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6841
6924
|
throw new Error(
|
|
6842
|
-
`Invalid frontmatter in ${
|
|
6925
|
+
`Invalid frontmatter in ${join57(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6843
6926
|
);
|
|
6844
6927
|
}
|
|
6845
6928
|
if (result.data.name !== loaded.dirName) {
|
|
6846
|
-
const skillFilePath =
|
|
6929
|
+
const skillFilePath = join57(
|
|
6847
6930
|
loaded.baseDir,
|
|
6848
6931
|
loaded.relativeDirPath,
|
|
6849
6932
|
loaded.dirName,
|
|
@@ -6884,7 +6967,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6884
6967
|
};
|
|
6885
6968
|
|
|
6886
6969
|
// src/features/skills/kiro-skill.ts
|
|
6887
|
-
import { join as
|
|
6970
|
+
import { join as join58 } from "path";
|
|
6888
6971
|
import { z as z27 } from "zod/mini";
|
|
6889
6972
|
var KiroSkillFrontmatterSchema = z27.looseObject({
|
|
6890
6973
|
name: z27.string(),
|
|
@@ -6893,7 +6976,7 @@ var KiroSkillFrontmatterSchema = z27.looseObject({
|
|
|
6893
6976
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
6894
6977
|
constructor({
|
|
6895
6978
|
baseDir = process.cwd(),
|
|
6896
|
-
relativeDirPath =
|
|
6979
|
+
relativeDirPath = join58(".kiro", "skills"),
|
|
6897
6980
|
dirName,
|
|
6898
6981
|
frontmatter,
|
|
6899
6982
|
body,
|
|
@@ -6925,7 +7008,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
6925
7008
|
throw new Error("KiroSkill does not support global mode.");
|
|
6926
7009
|
}
|
|
6927
7010
|
return {
|
|
6928
|
-
relativeDirPath:
|
|
7011
|
+
relativeDirPath: join58(".kiro", "skills")
|
|
6929
7012
|
};
|
|
6930
7013
|
}
|
|
6931
7014
|
getFrontmatter() {
|
|
@@ -7015,13 +7098,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
7015
7098
|
});
|
|
7016
7099
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7017
7100
|
if (!result.success) {
|
|
7018
|
-
const skillDirPath =
|
|
7101
|
+
const skillDirPath = join58(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7019
7102
|
throw new Error(
|
|
7020
|
-
`Invalid frontmatter in ${
|
|
7103
|
+
`Invalid frontmatter in ${join58(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7021
7104
|
);
|
|
7022
7105
|
}
|
|
7023
7106
|
if (result.data.name !== loaded.dirName) {
|
|
7024
|
-
const skillFilePath =
|
|
7107
|
+
const skillFilePath = join58(
|
|
7025
7108
|
loaded.baseDir,
|
|
7026
7109
|
loaded.relativeDirPath,
|
|
7027
7110
|
loaded.dirName,
|
|
@@ -7063,7 +7146,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
7063
7146
|
};
|
|
7064
7147
|
|
|
7065
7148
|
// src/features/skills/opencode-skill.ts
|
|
7066
|
-
import { join as
|
|
7149
|
+
import { join as join59 } from "path";
|
|
7067
7150
|
import { z as z28 } from "zod/mini";
|
|
7068
7151
|
var OpenCodeSkillFrontmatterSchema = z28.looseObject({
|
|
7069
7152
|
name: z28.string(),
|
|
@@ -7073,7 +7156,7 @@ var OpenCodeSkillFrontmatterSchema = z28.looseObject({
|
|
|
7073
7156
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
7074
7157
|
constructor({
|
|
7075
7158
|
baseDir = process.cwd(),
|
|
7076
|
-
relativeDirPath =
|
|
7159
|
+
relativeDirPath = join59(".opencode", "skill"),
|
|
7077
7160
|
dirName,
|
|
7078
7161
|
frontmatter,
|
|
7079
7162
|
body,
|
|
@@ -7102,7 +7185,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
7102
7185
|
}
|
|
7103
7186
|
static getSettablePaths({ global = false } = {}) {
|
|
7104
7187
|
return {
|
|
7105
|
-
relativeDirPath: global ?
|
|
7188
|
+
relativeDirPath: global ? join59(".config", "opencode", "skill") : join59(".opencode", "skill")
|
|
7106
7189
|
};
|
|
7107
7190
|
}
|
|
7108
7191
|
getFrontmatter() {
|
|
@@ -7190,9 +7273,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
7190
7273
|
});
|
|
7191
7274
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7192
7275
|
if (!result.success) {
|
|
7193
|
-
const skillDirPath =
|
|
7276
|
+
const skillDirPath = join59(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7194
7277
|
throw new Error(
|
|
7195
|
-
`Invalid frontmatter in ${
|
|
7278
|
+
`Invalid frontmatter in ${join59(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7196
7279
|
);
|
|
7197
7280
|
}
|
|
7198
7281
|
return new _OpenCodeSkill({
|
|
@@ -7226,7 +7309,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
7226
7309
|
};
|
|
7227
7310
|
|
|
7228
7311
|
// src/features/skills/roo-skill.ts
|
|
7229
|
-
import { join as
|
|
7312
|
+
import { join as join60 } from "path";
|
|
7230
7313
|
import { z as z29 } from "zod/mini";
|
|
7231
7314
|
var RooSkillFrontmatterSchema = z29.looseObject({
|
|
7232
7315
|
name: z29.string(),
|
|
@@ -7235,7 +7318,7 @@ var RooSkillFrontmatterSchema = z29.looseObject({
|
|
|
7235
7318
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
7236
7319
|
constructor({
|
|
7237
7320
|
baseDir = process.cwd(),
|
|
7238
|
-
relativeDirPath =
|
|
7321
|
+
relativeDirPath = join60(".roo", "skills"),
|
|
7239
7322
|
dirName,
|
|
7240
7323
|
frontmatter,
|
|
7241
7324
|
body,
|
|
@@ -7266,7 +7349,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
7266
7349
|
global: _global = false
|
|
7267
7350
|
} = {}) {
|
|
7268
7351
|
return {
|
|
7269
|
-
relativeDirPath:
|
|
7352
|
+
relativeDirPath: join60(".roo", "skills")
|
|
7270
7353
|
};
|
|
7271
7354
|
}
|
|
7272
7355
|
getFrontmatter() {
|
|
@@ -7356,13 +7439,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
7356
7439
|
});
|
|
7357
7440
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7358
7441
|
if (!result.success) {
|
|
7359
|
-
const skillDirPath =
|
|
7442
|
+
const skillDirPath = join60(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7360
7443
|
throw new Error(
|
|
7361
|
-
`Invalid frontmatter in ${
|
|
7444
|
+
`Invalid frontmatter in ${join60(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7362
7445
|
);
|
|
7363
7446
|
}
|
|
7364
7447
|
if (result.data.name !== loaded.dirName) {
|
|
7365
|
-
const skillFilePath =
|
|
7448
|
+
const skillFilePath = join60(
|
|
7366
7449
|
loaded.baseDir,
|
|
7367
7450
|
loaded.relativeDirPath,
|
|
7368
7451
|
loaded.dirName,
|
|
@@ -7581,8 +7664,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7581
7664
|
*/
|
|
7582
7665
|
async loadRulesyncDirs() {
|
|
7583
7666
|
const paths = RulesyncSkill.getSettablePaths();
|
|
7584
|
-
const rulesyncSkillsDirPath =
|
|
7585
|
-
const dirPaths = await findFilesByGlobs(
|
|
7667
|
+
const rulesyncSkillsDirPath = join61(this.baseDir, paths.relativeDirPath);
|
|
7668
|
+
const dirPaths = await findFilesByGlobs(join61(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
7586
7669
|
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7587
7670
|
const rulesyncSkills = await Promise.all(
|
|
7588
7671
|
dirNames.map(
|
|
@@ -7599,8 +7682,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7599
7682
|
async loadToolDirs() {
|
|
7600
7683
|
const factory = this.getFactory(this.toolTarget);
|
|
7601
7684
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7602
|
-
const skillsDirPath =
|
|
7603
|
-
const dirPaths = await findFilesByGlobs(
|
|
7685
|
+
const skillsDirPath = join61(this.baseDir, paths.relativeDirPath);
|
|
7686
|
+
const dirPaths = await findFilesByGlobs(join61(skillsDirPath, "*"), { type: "dir" });
|
|
7604
7687
|
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7605
7688
|
const toolSkills = await Promise.all(
|
|
7606
7689
|
dirNames.map(
|
|
@@ -7617,8 +7700,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7617
7700
|
async loadToolDirsToDelete() {
|
|
7618
7701
|
const factory = this.getFactory(this.toolTarget);
|
|
7619
7702
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7620
|
-
const skillsDirPath =
|
|
7621
|
-
const dirPaths = await findFilesByGlobs(
|
|
7703
|
+
const skillsDirPath = join61(this.baseDir, paths.relativeDirPath);
|
|
7704
|
+
const dirPaths = await findFilesByGlobs(join61(skillsDirPath, "*"), { type: "dir" });
|
|
7622
7705
|
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7623
7706
|
const toolSkills = dirNames.map(
|
|
7624
7707
|
(dirName) => factory.class.forDeletion({
|
|
@@ -7667,10 +7750,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7667
7750
|
};
|
|
7668
7751
|
|
|
7669
7752
|
// src/features/subagents/agentsmd-subagent.ts
|
|
7670
|
-
import { join as
|
|
7753
|
+
import { join as join63 } from "path";
|
|
7671
7754
|
|
|
7672
7755
|
// src/features/subagents/simulated-subagent.ts
|
|
7673
|
-
import { basename as basename18, join as
|
|
7756
|
+
import { basename as basename18, join as join62 } from "path";
|
|
7674
7757
|
import { z as z31 } from "zod/mini";
|
|
7675
7758
|
|
|
7676
7759
|
// src/features/subagents/tool-subagent.ts
|
|
@@ -7726,7 +7809,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7726
7809
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7727
7810
|
if (!result.success) {
|
|
7728
7811
|
throw new Error(
|
|
7729
|
-
`Invalid frontmatter in ${
|
|
7812
|
+
`Invalid frontmatter in ${join62(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7730
7813
|
);
|
|
7731
7814
|
}
|
|
7732
7815
|
}
|
|
@@ -7777,7 +7860,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7777
7860
|
return {
|
|
7778
7861
|
success: false,
|
|
7779
7862
|
error: new Error(
|
|
7780
|
-
`Invalid frontmatter in ${
|
|
7863
|
+
`Invalid frontmatter in ${join62(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7781
7864
|
)
|
|
7782
7865
|
};
|
|
7783
7866
|
}
|
|
@@ -7787,7 +7870,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7787
7870
|
relativeFilePath,
|
|
7788
7871
|
validate = true
|
|
7789
7872
|
}) {
|
|
7790
|
-
const filePath =
|
|
7873
|
+
const filePath = join62(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
7791
7874
|
const fileContent = await readFileContent(filePath);
|
|
7792
7875
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7793
7876
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7823,7 +7906,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7823
7906
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
7824
7907
|
static getSettablePaths() {
|
|
7825
7908
|
return {
|
|
7826
|
-
relativeDirPath:
|
|
7909
|
+
relativeDirPath: join63(".agents", "subagents")
|
|
7827
7910
|
};
|
|
7828
7911
|
}
|
|
7829
7912
|
static async fromFile(params) {
|
|
@@ -7846,11 +7929,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
7846
7929
|
};
|
|
7847
7930
|
|
|
7848
7931
|
// src/features/subagents/codexcli-subagent.ts
|
|
7849
|
-
import { join as
|
|
7932
|
+
import { join as join64 } from "path";
|
|
7850
7933
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
7851
7934
|
static getSettablePaths() {
|
|
7852
7935
|
return {
|
|
7853
|
-
relativeDirPath:
|
|
7936
|
+
relativeDirPath: join64(".codex", "subagents")
|
|
7854
7937
|
};
|
|
7855
7938
|
}
|
|
7856
7939
|
static async fromFile(params) {
|
|
@@ -7873,11 +7956,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
7873
7956
|
};
|
|
7874
7957
|
|
|
7875
7958
|
// src/features/subagents/cursor-subagent.ts
|
|
7876
|
-
import { join as
|
|
7959
|
+
import { join as join65 } from "path";
|
|
7877
7960
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
7878
7961
|
static getSettablePaths() {
|
|
7879
7962
|
return {
|
|
7880
|
-
relativeDirPath:
|
|
7963
|
+
relativeDirPath: join65(".cursor", "subagents")
|
|
7881
7964
|
};
|
|
7882
7965
|
}
|
|
7883
7966
|
static async fromFile(params) {
|
|
@@ -7900,11 +7983,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
7900
7983
|
};
|
|
7901
7984
|
|
|
7902
7985
|
// src/features/subagents/geminicli-subagent.ts
|
|
7903
|
-
import { join as
|
|
7986
|
+
import { join as join66 } from "path";
|
|
7904
7987
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
7905
7988
|
static getSettablePaths() {
|
|
7906
7989
|
return {
|
|
7907
|
-
relativeDirPath:
|
|
7990
|
+
relativeDirPath: join66(".gemini", "subagents")
|
|
7908
7991
|
};
|
|
7909
7992
|
}
|
|
7910
7993
|
static async fromFile(params) {
|
|
@@ -7927,11 +8010,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
7927
8010
|
};
|
|
7928
8011
|
|
|
7929
8012
|
// src/features/subagents/roo-subagent.ts
|
|
7930
|
-
import { join as
|
|
8013
|
+
import { join as join67 } from "path";
|
|
7931
8014
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
7932
8015
|
static getSettablePaths() {
|
|
7933
8016
|
return {
|
|
7934
|
-
relativeDirPath:
|
|
8017
|
+
relativeDirPath: join67(".roo", "subagents")
|
|
7935
8018
|
};
|
|
7936
8019
|
}
|
|
7937
8020
|
static async fromFile(params) {
|
|
@@ -7954,15 +8037,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
7954
8037
|
};
|
|
7955
8038
|
|
|
7956
8039
|
// src/features/subagents/subagents-processor.ts
|
|
7957
|
-
import { basename as basename21, join as
|
|
8040
|
+
import { basename as basename21, join as join73 } from "path";
|
|
7958
8041
|
import { z as z37 } from "zod/mini";
|
|
7959
8042
|
|
|
7960
8043
|
// src/features/subagents/claudecode-subagent.ts
|
|
7961
|
-
import { join as
|
|
8044
|
+
import { join as join69 } from "path";
|
|
7962
8045
|
import { z as z33 } from "zod/mini";
|
|
7963
8046
|
|
|
7964
8047
|
// src/features/subagents/rulesync-subagent.ts
|
|
7965
|
-
import { basename as basename19, join as
|
|
8048
|
+
import { basename as basename19, join as join68 } from "path";
|
|
7966
8049
|
import { z as z32 } from "zod/mini";
|
|
7967
8050
|
var RulesyncSubagentFrontmatterSchema = z32.looseObject({
|
|
7968
8051
|
targets: RulesyncTargetsSchema,
|
|
@@ -7977,7 +8060,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7977
8060
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7978
8061
|
if (!result.success) {
|
|
7979
8062
|
throw new Error(
|
|
7980
|
-
`Invalid frontmatter in ${
|
|
8063
|
+
`Invalid frontmatter in ${join68(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7981
8064
|
);
|
|
7982
8065
|
}
|
|
7983
8066
|
}
|
|
@@ -8010,7 +8093,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
8010
8093
|
return {
|
|
8011
8094
|
success: false,
|
|
8012
8095
|
error: new Error(
|
|
8013
|
-
`Invalid frontmatter in ${
|
|
8096
|
+
`Invalid frontmatter in ${join68(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8014
8097
|
)
|
|
8015
8098
|
};
|
|
8016
8099
|
}
|
|
@@ -8019,7 +8102,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
8019
8102
|
relativeFilePath
|
|
8020
8103
|
}) {
|
|
8021
8104
|
const fileContent = await readFileContent(
|
|
8022
|
-
|
|
8105
|
+
join68(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
8023
8106
|
);
|
|
8024
8107
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8025
8108
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8054,7 +8137,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8054
8137
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8055
8138
|
if (!result.success) {
|
|
8056
8139
|
throw new Error(
|
|
8057
|
-
`Invalid frontmatter in ${
|
|
8140
|
+
`Invalid frontmatter in ${join69(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8058
8141
|
);
|
|
8059
8142
|
}
|
|
8060
8143
|
}
|
|
@@ -8066,7 +8149,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8066
8149
|
}
|
|
8067
8150
|
static getSettablePaths(_options = {}) {
|
|
8068
8151
|
return {
|
|
8069
|
-
relativeDirPath:
|
|
8152
|
+
relativeDirPath: join69(".claude", "agents")
|
|
8070
8153
|
};
|
|
8071
8154
|
}
|
|
8072
8155
|
getFrontmatter() {
|
|
@@ -8140,7 +8223,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8140
8223
|
return {
|
|
8141
8224
|
success: false,
|
|
8142
8225
|
error: new Error(
|
|
8143
|
-
`Invalid frontmatter in ${
|
|
8226
|
+
`Invalid frontmatter in ${join69(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8144
8227
|
)
|
|
8145
8228
|
};
|
|
8146
8229
|
}
|
|
@@ -8158,7 +8241,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8158
8241
|
global = false
|
|
8159
8242
|
}) {
|
|
8160
8243
|
const paths = this.getSettablePaths({ global });
|
|
8161
|
-
const filePath =
|
|
8244
|
+
const filePath = join69(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8162
8245
|
const fileContent = await readFileContent(filePath);
|
|
8163
8246
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8164
8247
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8193,7 +8276,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8193
8276
|
};
|
|
8194
8277
|
|
|
8195
8278
|
// src/features/subagents/copilot-subagent.ts
|
|
8196
|
-
import { join as
|
|
8279
|
+
import { join as join70 } from "path";
|
|
8197
8280
|
import { z as z34 } from "zod/mini";
|
|
8198
8281
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
8199
8282
|
var CopilotSubagentFrontmatterSchema = z34.looseObject({
|
|
@@ -8219,7 +8302,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8219
8302
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8220
8303
|
if (!result.success) {
|
|
8221
8304
|
throw new Error(
|
|
8222
|
-
`Invalid frontmatter in ${
|
|
8305
|
+
`Invalid frontmatter in ${join70(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8223
8306
|
);
|
|
8224
8307
|
}
|
|
8225
8308
|
}
|
|
@@ -8231,7 +8314,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8231
8314
|
}
|
|
8232
8315
|
static getSettablePaths(_options = {}) {
|
|
8233
8316
|
return {
|
|
8234
|
-
relativeDirPath:
|
|
8317
|
+
relativeDirPath: join70(".github", "agents")
|
|
8235
8318
|
};
|
|
8236
8319
|
}
|
|
8237
8320
|
getFrontmatter() {
|
|
@@ -8305,7 +8388,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8305
8388
|
return {
|
|
8306
8389
|
success: false,
|
|
8307
8390
|
error: new Error(
|
|
8308
|
-
`Invalid frontmatter in ${
|
|
8391
|
+
`Invalid frontmatter in ${join70(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8309
8392
|
)
|
|
8310
8393
|
};
|
|
8311
8394
|
}
|
|
@@ -8323,7 +8406,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8323
8406
|
global = false
|
|
8324
8407
|
}) {
|
|
8325
8408
|
const paths = this.getSettablePaths({ global });
|
|
8326
|
-
const filePath =
|
|
8409
|
+
const filePath = join70(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8327
8410
|
const fileContent = await readFileContent(filePath);
|
|
8328
8411
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8329
8412
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8359,7 +8442,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8359
8442
|
};
|
|
8360
8443
|
|
|
8361
8444
|
// src/features/subagents/kiro-subagent.ts
|
|
8362
|
-
import { join as
|
|
8445
|
+
import { join as join71 } from "path";
|
|
8363
8446
|
import { z as z35 } from "zod/mini";
|
|
8364
8447
|
var KiroCliSubagentJsonSchema = z35.looseObject({
|
|
8365
8448
|
name: z35.string(),
|
|
@@ -8387,7 +8470,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8387
8470
|
}
|
|
8388
8471
|
static getSettablePaths(_options = {}) {
|
|
8389
8472
|
return {
|
|
8390
|
-
relativeDirPath:
|
|
8473
|
+
relativeDirPath: join71(".kiro", "agents")
|
|
8391
8474
|
};
|
|
8392
8475
|
}
|
|
8393
8476
|
getBody() {
|
|
@@ -8467,7 +8550,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8467
8550
|
global = false
|
|
8468
8551
|
}) {
|
|
8469
8552
|
const paths = this.getSettablePaths({ global });
|
|
8470
|
-
const filePath =
|
|
8553
|
+
const filePath = join71(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8471
8554
|
const fileContent = await readFileContent(filePath);
|
|
8472
8555
|
return new _KiroSubagent({
|
|
8473
8556
|
baseDir,
|
|
@@ -8496,7 +8579,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8496
8579
|
};
|
|
8497
8580
|
|
|
8498
8581
|
// src/features/subagents/opencode-subagent.ts
|
|
8499
|
-
import { basename as basename20, join as
|
|
8582
|
+
import { basename as basename20, join as join72 } from "path";
|
|
8500
8583
|
import { z as z36 } from "zod/mini";
|
|
8501
8584
|
var OpenCodeSubagentFrontmatterSchema = z36.looseObject({
|
|
8502
8585
|
description: z36.string(),
|
|
@@ -8511,7 +8594,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8511
8594
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8512
8595
|
if (!result.success) {
|
|
8513
8596
|
throw new Error(
|
|
8514
|
-
`Invalid frontmatter in ${
|
|
8597
|
+
`Invalid frontmatter in ${join72(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8515
8598
|
);
|
|
8516
8599
|
}
|
|
8517
8600
|
}
|
|
@@ -8525,7 +8608,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8525
8608
|
global = false
|
|
8526
8609
|
} = {}) {
|
|
8527
8610
|
return {
|
|
8528
|
-
relativeDirPath: global ?
|
|
8611
|
+
relativeDirPath: global ? join72(".config", "opencode", "agent") : join72(".opencode", "agent")
|
|
8529
8612
|
};
|
|
8530
8613
|
}
|
|
8531
8614
|
getFrontmatter() {
|
|
@@ -8591,7 +8674,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8591
8674
|
return {
|
|
8592
8675
|
success: false,
|
|
8593
8676
|
error: new Error(
|
|
8594
|
-
`Invalid frontmatter in ${
|
|
8677
|
+
`Invalid frontmatter in ${join72(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8595
8678
|
)
|
|
8596
8679
|
};
|
|
8597
8680
|
}
|
|
@@ -8608,7 +8691,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8608
8691
|
global = false
|
|
8609
8692
|
}) {
|
|
8610
8693
|
const paths = this.getSettablePaths({ global });
|
|
8611
|
-
const filePath =
|
|
8694
|
+
const filePath = join72(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8612
8695
|
const fileContent = await readFileContent(filePath);
|
|
8613
8696
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8614
8697
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8810,7 +8893,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8810
8893
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
8811
8894
|
*/
|
|
8812
8895
|
async loadRulesyncFiles() {
|
|
8813
|
-
const subagentsDir =
|
|
8896
|
+
const subagentsDir = join73(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
8814
8897
|
const dirExists = await directoryExists(subagentsDir);
|
|
8815
8898
|
if (!dirExists) {
|
|
8816
8899
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -8825,7 +8908,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8825
8908
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
8826
8909
|
const rulesyncSubagents = [];
|
|
8827
8910
|
for (const mdFile of mdFiles) {
|
|
8828
|
-
const filepath =
|
|
8911
|
+
const filepath = join73(subagentsDir, mdFile);
|
|
8829
8912
|
try {
|
|
8830
8913
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
8831
8914
|
relativeFilePath: mdFile,
|
|
@@ -8855,7 +8938,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8855
8938
|
const factory = this.getFactory(this.toolTarget);
|
|
8856
8939
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
8857
8940
|
const subagentFilePaths = await findFilesByGlobs(
|
|
8858
|
-
|
|
8941
|
+
join73(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
8859
8942
|
);
|
|
8860
8943
|
if (forDeletion) {
|
|
8861
8944
|
const toolSubagents2 = subagentFilePaths.map(
|
|
@@ -8905,13 +8988,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8905
8988
|
};
|
|
8906
8989
|
|
|
8907
8990
|
// src/features/rules/agentsmd-rule.ts
|
|
8908
|
-
import { join as
|
|
8991
|
+
import { join as join76 } from "path";
|
|
8909
8992
|
|
|
8910
8993
|
// src/features/rules/tool-rule.ts
|
|
8911
|
-
import { join as
|
|
8994
|
+
import { join as join75 } from "path";
|
|
8912
8995
|
|
|
8913
8996
|
// src/features/rules/rulesync-rule.ts
|
|
8914
|
-
import {
|
|
8997
|
+
import { join as join74 } from "path";
|
|
8915
8998
|
import { z as z38 } from "zod/mini";
|
|
8916
8999
|
var RulesyncRuleFrontmatterSchema = z38.object({
|
|
8917
9000
|
root: z38.optional(z38.boolean()),
|
|
@@ -8959,7 +9042,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8959
9042
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8960
9043
|
if (!result.success) {
|
|
8961
9044
|
throw new Error(
|
|
8962
|
-
`Invalid frontmatter in ${
|
|
9045
|
+
`Invalid frontmatter in ${join74(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8963
9046
|
);
|
|
8964
9047
|
}
|
|
8965
9048
|
}
|
|
@@ -8994,7 +9077,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8994
9077
|
return {
|
|
8995
9078
|
success: false,
|
|
8996
9079
|
error: new Error(
|
|
8997
|
-
`Invalid frontmatter in ${
|
|
9080
|
+
`Invalid frontmatter in ${join74(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8998
9081
|
)
|
|
8999
9082
|
};
|
|
9000
9083
|
}
|
|
@@ -9003,7 +9086,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
9003
9086
|
relativeFilePath,
|
|
9004
9087
|
validate = true
|
|
9005
9088
|
}) {
|
|
9006
|
-
const filePath =
|
|
9089
|
+
const filePath = join74(
|
|
9007
9090
|
process.cwd(),
|
|
9008
9091
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
9009
9092
|
relativeFilePath
|
|
@@ -9023,11 +9106,10 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
9023
9106
|
agentsmd: result.data.agentsmd,
|
|
9024
9107
|
cursor: result.data.cursor
|
|
9025
9108
|
};
|
|
9026
|
-
const filename = basename22(filePath);
|
|
9027
9109
|
return new _RulesyncRule({
|
|
9028
9110
|
baseDir: process.cwd(),
|
|
9029
9111
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
9030
|
-
relativeFilePath
|
|
9112
|
+
relativeFilePath,
|
|
9031
9113
|
frontmatter: validatedFrontmatter,
|
|
9032
9114
|
body: content.trim(),
|
|
9033
9115
|
validate
|
|
@@ -9106,7 +9188,7 @@ var ToolRule = class extends ToolFile {
|
|
|
9106
9188
|
rulesyncRule,
|
|
9107
9189
|
validate = true,
|
|
9108
9190
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
9109
|
-
nonRootPath = { relativeDirPath:
|
|
9191
|
+
nonRootPath = { relativeDirPath: join75(".agents", "memories") }
|
|
9110
9192
|
}) {
|
|
9111
9193
|
const params = this.buildToolRuleParamsDefault({
|
|
9112
9194
|
baseDir,
|
|
@@ -9117,7 +9199,7 @@ var ToolRule = class extends ToolFile {
|
|
|
9117
9199
|
});
|
|
9118
9200
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
9119
9201
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
9120
|
-
params.relativeDirPath =
|
|
9202
|
+
params.relativeDirPath = join75(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
9121
9203
|
params.relativeFilePath = "AGENTS.md";
|
|
9122
9204
|
}
|
|
9123
9205
|
return params;
|
|
@@ -9182,7 +9264,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9182
9264
|
relativeFilePath: "AGENTS.md"
|
|
9183
9265
|
},
|
|
9184
9266
|
nonRoot: {
|
|
9185
|
-
relativeDirPath:
|
|
9267
|
+
relativeDirPath: join76(".agents", "memories")
|
|
9186
9268
|
}
|
|
9187
9269
|
};
|
|
9188
9270
|
}
|
|
@@ -9192,8 +9274,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9192
9274
|
validate = true
|
|
9193
9275
|
}) {
|
|
9194
9276
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
9195
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
9196
|
-
const fileContent = await readFileContent(
|
|
9277
|
+
const relativePath = isRoot ? "AGENTS.md" : join76(".agents", "memories", relativeFilePath);
|
|
9278
|
+
const fileContent = await readFileContent(join76(baseDir, relativePath));
|
|
9197
9279
|
return new _AgentsMdRule({
|
|
9198
9280
|
baseDir,
|
|
9199
9281
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9248,7 +9330,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9248
9330
|
};
|
|
9249
9331
|
|
|
9250
9332
|
// src/features/rules/antigravity-rule.ts
|
|
9251
|
-
import { join as
|
|
9333
|
+
import { join as join77 } from "path";
|
|
9252
9334
|
import { z as z39 } from "zod/mini";
|
|
9253
9335
|
var AntigravityRuleFrontmatterSchema = z39.looseObject({
|
|
9254
9336
|
trigger: z39.optional(
|
|
@@ -9407,7 +9489,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9407
9489
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9408
9490
|
if (!result.success) {
|
|
9409
9491
|
throw new Error(
|
|
9410
|
-
`Invalid frontmatter in ${
|
|
9492
|
+
`Invalid frontmatter in ${join77(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9411
9493
|
);
|
|
9412
9494
|
}
|
|
9413
9495
|
}
|
|
@@ -9422,7 +9504,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9422
9504
|
static getSettablePaths() {
|
|
9423
9505
|
return {
|
|
9424
9506
|
nonRoot: {
|
|
9425
|
-
relativeDirPath:
|
|
9507
|
+
relativeDirPath: join77(".agent", "rules")
|
|
9426
9508
|
}
|
|
9427
9509
|
};
|
|
9428
9510
|
}
|
|
@@ -9431,7 +9513,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9431
9513
|
relativeFilePath,
|
|
9432
9514
|
validate = true
|
|
9433
9515
|
}) {
|
|
9434
|
-
const filePath =
|
|
9516
|
+
const filePath = join77(
|
|
9435
9517
|
baseDir,
|
|
9436
9518
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
9437
9519
|
relativeFilePath
|
|
@@ -9572,7 +9654,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9572
9654
|
};
|
|
9573
9655
|
|
|
9574
9656
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
9575
|
-
import { join as
|
|
9657
|
+
import { join as join78 } from "path";
|
|
9576
9658
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
9577
9659
|
toRulesyncRule() {
|
|
9578
9660
|
const rulesyncFrontmatter = {
|
|
@@ -9598,7 +9680,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9598
9680
|
relativeFilePath: ".augment-guidelines"
|
|
9599
9681
|
},
|
|
9600
9682
|
nonRoot: {
|
|
9601
|
-
relativeDirPath:
|
|
9683
|
+
relativeDirPath: join78(".augment", "rules")
|
|
9602
9684
|
}
|
|
9603
9685
|
};
|
|
9604
9686
|
}
|
|
@@ -9633,8 +9715,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9633
9715
|
}) {
|
|
9634
9716
|
const settablePaths = this.getSettablePaths();
|
|
9635
9717
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
9636
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
9637
|
-
const fileContent = await readFileContent(
|
|
9718
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join78(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9719
|
+
const fileContent = await readFileContent(join78(baseDir, relativePath));
|
|
9638
9720
|
return new _AugmentcodeLegacyRule({
|
|
9639
9721
|
baseDir,
|
|
9640
9722
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -9663,7 +9745,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9663
9745
|
};
|
|
9664
9746
|
|
|
9665
9747
|
// src/features/rules/augmentcode-rule.ts
|
|
9666
|
-
import { join as
|
|
9748
|
+
import { join as join79 } from "path";
|
|
9667
9749
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
9668
9750
|
toRulesyncRule() {
|
|
9669
9751
|
return this.toRulesyncRuleDefault();
|
|
@@ -9671,7 +9753,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9671
9753
|
static getSettablePaths() {
|
|
9672
9754
|
return {
|
|
9673
9755
|
nonRoot: {
|
|
9674
|
-
relativeDirPath:
|
|
9756
|
+
relativeDirPath: join79(".augment", "rules")
|
|
9675
9757
|
}
|
|
9676
9758
|
};
|
|
9677
9759
|
}
|
|
@@ -9695,7 +9777,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9695
9777
|
validate = true
|
|
9696
9778
|
}) {
|
|
9697
9779
|
const fileContent = await readFileContent(
|
|
9698
|
-
|
|
9780
|
+
join79(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9699
9781
|
);
|
|
9700
9782
|
const { body: content } = parseFrontmatter(fileContent);
|
|
9701
9783
|
return new _AugmentcodeRule({
|
|
@@ -9731,7 +9813,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9731
9813
|
};
|
|
9732
9814
|
|
|
9733
9815
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
9734
|
-
import { join as
|
|
9816
|
+
import { join as join80 } from "path";
|
|
9735
9817
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
9736
9818
|
static getSettablePaths({
|
|
9737
9819
|
global
|
|
@@ -9750,7 +9832,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9750
9832
|
relativeFilePath: "CLAUDE.md"
|
|
9751
9833
|
},
|
|
9752
9834
|
nonRoot: {
|
|
9753
|
-
relativeDirPath:
|
|
9835
|
+
relativeDirPath: join80(".claude", "memories")
|
|
9754
9836
|
}
|
|
9755
9837
|
};
|
|
9756
9838
|
}
|
|
@@ -9765,7 +9847,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9765
9847
|
if (isRoot) {
|
|
9766
9848
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9767
9849
|
const fileContent2 = await readFileContent(
|
|
9768
|
-
|
|
9850
|
+
join80(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9769
9851
|
);
|
|
9770
9852
|
return new _ClaudecodeLegacyRule({
|
|
9771
9853
|
baseDir,
|
|
@@ -9779,8 +9861,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9779
9861
|
if (!paths.nonRoot) {
|
|
9780
9862
|
throw new Error("nonRoot path is not set");
|
|
9781
9863
|
}
|
|
9782
|
-
const relativePath =
|
|
9783
|
-
const fileContent = await readFileContent(
|
|
9864
|
+
const relativePath = join80(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9865
|
+
const fileContent = await readFileContent(join80(baseDir, relativePath));
|
|
9784
9866
|
return new _ClaudecodeLegacyRule({
|
|
9785
9867
|
baseDir,
|
|
9786
9868
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9839,7 +9921,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9839
9921
|
};
|
|
9840
9922
|
|
|
9841
9923
|
// src/features/rules/claudecode-rule.ts
|
|
9842
|
-
import { join as
|
|
9924
|
+
import { join as join81 } from "path";
|
|
9843
9925
|
import { z as z40 } from "zod/mini";
|
|
9844
9926
|
var ClaudecodeRuleFrontmatterSchema = z40.object({
|
|
9845
9927
|
paths: z40.optional(z40.string())
|
|
@@ -9864,7 +9946,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9864
9946
|
relativeFilePath: "CLAUDE.md"
|
|
9865
9947
|
},
|
|
9866
9948
|
nonRoot: {
|
|
9867
|
-
relativeDirPath:
|
|
9949
|
+
relativeDirPath: join81(".claude", "rules")
|
|
9868
9950
|
}
|
|
9869
9951
|
};
|
|
9870
9952
|
}
|
|
@@ -9873,7 +9955,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9873
9955
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9874
9956
|
if (!result.success) {
|
|
9875
9957
|
throw new Error(
|
|
9876
|
-
`Invalid frontmatter in ${
|
|
9958
|
+
`Invalid frontmatter in ${join81(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9877
9959
|
);
|
|
9878
9960
|
}
|
|
9879
9961
|
}
|
|
@@ -9901,7 +9983,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9901
9983
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
9902
9984
|
if (isRoot) {
|
|
9903
9985
|
const fileContent2 = await readFileContent(
|
|
9904
|
-
|
|
9986
|
+
join81(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
9905
9987
|
);
|
|
9906
9988
|
return new _ClaudecodeRule({
|
|
9907
9989
|
baseDir,
|
|
@@ -9916,13 +9998,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9916
9998
|
if (!paths.nonRoot) {
|
|
9917
9999
|
throw new Error("nonRoot path is not set");
|
|
9918
10000
|
}
|
|
9919
|
-
const relativePath =
|
|
9920
|
-
const fileContent = await readFileContent(
|
|
10001
|
+
const relativePath = join81(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10002
|
+
const fileContent = await readFileContent(join81(baseDir, relativePath));
|
|
9921
10003
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9922
10004
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9923
10005
|
if (!result.success) {
|
|
9924
10006
|
throw new Error(
|
|
9925
|
-
`Invalid frontmatter in ${
|
|
10007
|
+
`Invalid frontmatter in ${join81(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
9926
10008
|
);
|
|
9927
10009
|
}
|
|
9928
10010
|
return new _ClaudecodeRule({
|
|
@@ -10029,7 +10111,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
10029
10111
|
return {
|
|
10030
10112
|
success: false,
|
|
10031
10113
|
error: new Error(
|
|
10032
|
-
`Invalid frontmatter in ${
|
|
10114
|
+
`Invalid frontmatter in ${join81(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10033
10115
|
)
|
|
10034
10116
|
};
|
|
10035
10117
|
}
|
|
@@ -10049,7 +10131,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
10049
10131
|
};
|
|
10050
10132
|
|
|
10051
10133
|
// src/features/rules/cline-rule.ts
|
|
10052
|
-
import { join as
|
|
10134
|
+
import { join as join82 } from "path";
|
|
10053
10135
|
import { z as z41 } from "zod/mini";
|
|
10054
10136
|
var ClineRuleFrontmatterSchema = z41.object({
|
|
10055
10137
|
description: z41.string()
|
|
@@ -10094,7 +10176,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
10094
10176
|
validate = true
|
|
10095
10177
|
}) {
|
|
10096
10178
|
const fileContent = await readFileContent(
|
|
10097
|
-
|
|
10179
|
+
join82(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10098
10180
|
);
|
|
10099
10181
|
return new _ClineRule({
|
|
10100
10182
|
baseDir,
|
|
@@ -10120,7 +10202,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
10120
10202
|
};
|
|
10121
10203
|
|
|
10122
10204
|
// src/features/rules/codexcli-rule.ts
|
|
10123
|
-
import { join as
|
|
10205
|
+
import { join as join83 } from "path";
|
|
10124
10206
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
10125
10207
|
static getSettablePaths({
|
|
10126
10208
|
global
|
|
@@ -10139,7 +10221,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10139
10221
|
relativeFilePath: "AGENTS.md"
|
|
10140
10222
|
},
|
|
10141
10223
|
nonRoot: {
|
|
10142
|
-
relativeDirPath:
|
|
10224
|
+
relativeDirPath: join83(".codex", "memories")
|
|
10143
10225
|
}
|
|
10144
10226
|
};
|
|
10145
10227
|
}
|
|
@@ -10154,7 +10236,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10154
10236
|
if (isRoot) {
|
|
10155
10237
|
const relativePath2 = paths.root.relativeFilePath;
|
|
10156
10238
|
const fileContent2 = await readFileContent(
|
|
10157
|
-
|
|
10239
|
+
join83(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
10158
10240
|
);
|
|
10159
10241
|
return new _CodexcliRule({
|
|
10160
10242
|
baseDir,
|
|
@@ -10168,8 +10250,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10168
10250
|
if (!paths.nonRoot) {
|
|
10169
10251
|
throw new Error("nonRoot path is not set");
|
|
10170
10252
|
}
|
|
10171
|
-
const relativePath =
|
|
10172
|
-
const fileContent = await readFileContent(
|
|
10253
|
+
const relativePath = join83(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10254
|
+
const fileContent = await readFileContent(join83(baseDir, relativePath));
|
|
10173
10255
|
return new _CodexcliRule({
|
|
10174
10256
|
baseDir,
|
|
10175
10257
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10228,7 +10310,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10228
10310
|
};
|
|
10229
10311
|
|
|
10230
10312
|
// src/features/rules/copilot-rule.ts
|
|
10231
|
-
import { join as
|
|
10313
|
+
import { join as join84 } from "path";
|
|
10232
10314
|
import { z as z42 } from "zod/mini";
|
|
10233
10315
|
var CopilotRuleFrontmatterSchema = z42.object({
|
|
10234
10316
|
description: z42.optional(z42.string()),
|
|
@@ -10245,7 +10327,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10245
10327
|
relativeFilePath: "copilot-instructions.md"
|
|
10246
10328
|
},
|
|
10247
10329
|
nonRoot: {
|
|
10248
|
-
relativeDirPath:
|
|
10330
|
+
relativeDirPath: join84(".github", "instructions")
|
|
10249
10331
|
}
|
|
10250
10332
|
};
|
|
10251
10333
|
}
|
|
@@ -10254,7 +10336,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10254
10336
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10255
10337
|
if (!result.success) {
|
|
10256
10338
|
throw new Error(
|
|
10257
|
-
`Invalid frontmatter in ${
|
|
10339
|
+
`Invalid frontmatter in ${join84(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10258
10340
|
);
|
|
10259
10341
|
}
|
|
10260
10342
|
}
|
|
@@ -10336,11 +10418,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10336
10418
|
validate = true
|
|
10337
10419
|
}) {
|
|
10338
10420
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
10339
|
-
const relativePath = isRoot ?
|
|
10421
|
+
const relativePath = isRoot ? join84(
|
|
10340
10422
|
this.getSettablePaths().root.relativeDirPath,
|
|
10341
10423
|
this.getSettablePaths().root.relativeFilePath
|
|
10342
|
-
) :
|
|
10343
|
-
const fileContent = await readFileContent(
|
|
10424
|
+
) : join84(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10425
|
+
const fileContent = await readFileContent(join84(baseDir, relativePath));
|
|
10344
10426
|
if (isRoot) {
|
|
10345
10427
|
return new _CopilotRule({
|
|
10346
10428
|
baseDir,
|
|
@@ -10356,7 +10438,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10356
10438
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10357
10439
|
if (!result.success) {
|
|
10358
10440
|
throw new Error(
|
|
10359
|
-
`Invalid frontmatter in ${
|
|
10441
|
+
`Invalid frontmatter in ${join84(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10360
10442
|
);
|
|
10361
10443
|
}
|
|
10362
10444
|
return new _CopilotRule({
|
|
@@ -10396,7 +10478,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10396
10478
|
return {
|
|
10397
10479
|
success: false,
|
|
10398
10480
|
error: new Error(
|
|
10399
|
-
`Invalid frontmatter in ${
|
|
10481
|
+
`Invalid frontmatter in ${join84(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10400
10482
|
)
|
|
10401
10483
|
};
|
|
10402
10484
|
}
|
|
@@ -10416,7 +10498,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10416
10498
|
};
|
|
10417
10499
|
|
|
10418
10500
|
// src/features/rules/cursor-rule.ts
|
|
10419
|
-
import {
|
|
10501
|
+
import { join as join85 } from "path";
|
|
10420
10502
|
import { z as z43 } from "zod/mini";
|
|
10421
10503
|
var CursorRuleFrontmatterSchema = z43.object({
|
|
10422
10504
|
description: z43.optional(z43.string()),
|
|
@@ -10429,7 +10511,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10429
10511
|
static getSettablePaths() {
|
|
10430
10512
|
return {
|
|
10431
10513
|
nonRoot: {
|
|
10432
|
-
relativeDirPath:
|
|
10514
|
+
relativeDirPath: join85(".cursor", "rules")
|
|
10433
10515
|
}
|
|
10434
10516
|
};
|
|
10435
10517
|
}
|
|
@@ -10438,7 +10520,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10438
10520
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10439
10521
|
if (!result.success) {
|
|
10440
10522
|
throw new Error(
|
|
10441
|
-
`Invalid frontmatter in ${
|
|
10523
|
+
`Invalid frontmatter in ${join85(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10442
10524
|
);
|
|
10443
10525
|
}
|
|
10444
10526
|
}
|
|
@@ -10555,19 +10637,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10555
10637
|
validate = true
|
|
10556
10638
|
}) {
|
|
10557
10639
|
const fileContent = await readFileContent(
|
|
10558
|
-
|
|
10640
|
+
join85(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10559
10641
|
);
|
|
10560
10642
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
10561
10643
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10562
10644
|
if (!result.success) {
|
|
10563
10645
|
throw new Error(
|
|
10564
|
-
`Invalid frontmatter in ${
|
|
10646
|
+
`Invalid frontmatter in ${join85(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10565
10647
|
);
|
|
10566
10648
|
}
|
|
10567
10649
|
return new _CursorRule({
|
|
10568
10650
|
baseDir,
|
|
10569
10651
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
10570
|
-
relativeFilePath
|
|
10652
|
+
relativeFilePath,
|
|
10571
10653
|
frontmatter: result.data,
|
|
10572
10654
|
body: content.trim(),
|
|
10573
10655
|
validate
|
|
@@ -10598,7 +10680,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10598
10680
|
return {
|
|
10599
10681
|
success: false,
|
|
10600
10682
|
error: new Error(
|
|
10601
|
-
`Invalid frontmatter in ${
|
|
10683
|
+
`Invalid frontmatter in ${join85(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10602
10684
|
)
|
|
10603
10685
|
};
|
|
10604
10686
|
}
|
|
@@ -10618,7 +10700,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10618
10700
|
};
|
|
10619
10701
|
|
|
10620
10702
|
// src/features/rules/geminicli-rule.ts
|
|
10621
|
-
import { join as
|
|
10703
|
+
import { join as join86 } from "path";
|
|
10622
10704
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
10623
10705
|
static getSettablePaths({
|
|
10624
10706
|
global
|
|
@@ -10637,7 +10719,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10637
10719
|
relativeFilePath: "GEMINI.md"
|
|
10638
10720
|
},
|
|
10639
10721
|
nonRoot: {
|
|
10640
|
-
relativeDirPath:
|
|
10722
|
+
relativeDirPath: join86(".gemini", "memories")
|
|
10641
10723
|
}
|
|
10642
10724
|
};
|
|
10643
10725
|
}
|
|
@@ -10652,7 +10734,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10652
10734
|
if (isRoot) {
|
|
10653
10735
|
const relativePath2 = paths.root.relativeFilePath;
|
|
10654
10736
|
const fileContent2 = await readFileContent(
|
|
10655
|
-
|
|
10737
|
+
join86(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
10656
10738
|
);
|
|
10657
10739
|
return new _GeminiCliRule({
|
|
10658
10740
|
baseDir,
|
|
@@ -10666,8 +10748,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10666
10748
|
if (!paths.nonRoot) {
|
|
10667
10749
|
throw new Error("nonRoot path is not set");
|
|
10668
10750
|
}
|
|
10669
|
-
const relativePath =
|
|
10670
|
-
const fileContent = await readFileContent(
|
|
10751
|
+
const relativePath = join86(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10752
|
+
const fileContent = await readFileContent(join86(baseDir, relativePath));
|
|
10671
10753
|
return new _GeminiCliRule({
|
|
10672
10754
|
baseDir,
|
|
10673
10755
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10726,7 +10808,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10726
10808
|
};
|
|
10727
10809
|
|
|
10728
10810
|
// src/features/rules/junie-rule.ts
|
|
10729
|
-
import { join as
|
|
10811
|
+
import { join as join87 } from "path";
|
|
10730
10812
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
10731
10813
|
static getSettablePaths() {
|
|
10732
10814
|
return {
|
|
@@ -10735,7 +10817,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10735
10817
|
relativeFilePath: "guidelines.md"
|
|
10736
10818
|
},
|
|
10737
10819
|
nonRoot: {
|
|
10738
|
-
relativeDirPath:
|
|
10820
|
+
relativeDirPath: join87(".junie", "memories")
|
|
10739
10821
|
}
|
|
10740
10822
|
};
|
|
10741
10823
|
}
|
|
@@ -10745,8 +10827,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10745
10827
|
validate = true
|
|
10746
10828
|
}) {
|
|
10747
10829
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
10748
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
10749
|
-
const fileContent = await readFileContent(
|
|
10830
|
+
const relativePath = isRoot ? "guidelines.md" : join87(".junie", "memories", relativeFilePath);
|
|
10831
|
+
const fileContent = await readFileContent(join87(baseDir, relativePath));
|
|
10750
10832
|
return new _JunieRule({
|
|
10751
10833
|
baseDir,
|
|
10752
10834
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10801,12 +10883,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10801
10883
|
};
|
|
10802
10884
|
|
|
10803
10885
|
// src/features/rules/kilo-rule.ts
|
|
10804
|
-
import { join as
|
|
10886
|
+
import { join as join88 } from "path";
|
|
10805
10887
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
10806
10888
|
static getSettablePaths(_options = {}) {
|
|
10807
10889
|
return {
|
|
10808
10890
|
nonRoot: {
|
|
10809
|
-
relativeDirPath:
|
|
10891
|
+
relativeDirPath: join88(".kilocode", "rules")
|
|
10810
10892
|
}
|
|
10811
10893
|
};
|
|
10812
10894
|
}
|
|
@@ -10816,7 +10898,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10816
10898
|
validate = true
|
|
10817
10899
|
}) {
|
|
10818
10900
|
const fileContent = await readFileContent(
|
|
10819
|
-
|
|
10901
|
+
join88(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10820
10902
|
);
|
|
10821
10903
|
return new _KiloRule({
|
|
10822
10904
|
baseDir,
|
|
@@ -10868,12 +10950,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10868
10950
|
};
|
|
10869
10951
|
|
|
10870
10952
|
// src/features/rules/kiro-rule.ts
|
|
10871
|
-
import { join as
|
|
10953
|
+
import { join as join89 } from "path";
|
|
10872
10954
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
10873
10955
|
static getSettablePaths() {
|
|
10874
10956
|
return {
|
|
10875
10957
|
nonRoot: {
|
|
10876
|
-
relativeDirPath:
|
|
10958
|
+
relativeDirPath: join89(".kiro", "steering")
|
|
10877
10959
|
}
|
|
10878
10960
|
};
|
|
10879
10961
|
}
|
|
@@ -10883,7 +10965,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10883
10965
|
validate = true
|
|
10884
10966
|
}) {
|
|
10885
10967
|
const fileContent = await readFileContent(
|
|
10886
|
-
|
|
10968
|
+
join89(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10887
10969
|
);
|
|
10888
10970
|
return new _KiroRule({
|
|
10889
10971
|
baseDir,
|
|
@@ -10937,7 +11019,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10937
11019
|
};
|
|
10938
11020
|
|
|
10939
11021
|
// src/features/rules/opencode-rule.ts
|
|
10940
|
-
import { join as
|
|
11022
|
+
import { join as join90 } from "path";
|
|
10941
11023
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
10942
11024
|
static getSettablePaths() {
|
|
10943
11025
|
return {
|
|
@@ -10946,7 +11028,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10946
11028
|
relativeFilePath: "AGENTS.md"
|
|
10947
11029
|
},
|
|
10948
11030
|
nonRoot: {
|
|
10949
|
-
relativeDirPath:
|
|
11031
|
+
relativeDirPath: join90(".opencode", "memories")
|
|
10950
11032
|
}
|
|
10951
11033
|
};
|
|
10952
11034
|
}
|
|
@@ -10956,8 +11038,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10956
11038
|
validate = true
|
|
10957
11039
|
}) {
|
|
10958
11040
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
10959
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
10960
|
-
const fileContent = await readFileContent(
|
|
11041
|
+
const relativePath = isRoot ? "AGENTS.md" : join90(".opencode", "memories", relativeFilePath);
|
|
11042
|
+
const fileContent = await readFileContent(join90(baseDir, relativePath));
|
|
10961
11043
|
return new _OpenCodeRule({
|
|
10962
11044
|
baseDir,
|
|
10963
11045
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -11012,7 +11094,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
11012
11094
|
};
|
|
11013
11095
|
|
|
11014
11096
|
// src/features/rules/qwencode-rule.ts
|
|
11015
|
-
import { join as
|
|
11097
|
+
import { join as join91 } from "path";
|
|
11016
11098
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
11017
11099
|
static getSettablePaths() {
|
|
11018
11100
|
return {
|
|
@@ -11021,7 +11103,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
11021
11103
|
relativeFilePath: "QWEN.md"
|
|
11022
11104
|
},
|
|
11023
11105
|
nonRoot: {
|
|
11024
|
-
relativeDirPath:
|
|
11106
|
+
relativeDirPath: join91(".qwen", "memories")
|
|
11025
11107
|
}
|
|
11026
11108
|
};
|
|
11027
11109
|
}
|
|
@@ -11031,8 +11113,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
11031
11113
|
validate = true
|
|
11032
11114
|
}) {
|
|
11033
11115
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
11034
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
11035
|
-
const fileContent = await readFileContent(
|
|
11116
|
+
const relativePath = isRoot ? "QWEN.md" : join91(".qwen", "memories", relativeFilePath);
|
|
11117
|
+
const fileContent = await readFileContent(join91(baseDir, relativePath));
|
|
11036
11118
|
return new _QwencodeRule({
|
|
11037
11119
|
baseDir,
|
|
11038
11120
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -11084,7 +11166,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
11084
11166
|
};
|
|
11085
11167
|
|
|
11086
11168
|
// src/features/rules/replit-rule.ts
|
|
11087
|
-
import { join as
|
|
11169
|
+
import { join as join92 } from "path";
|
|
11088
11170
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
11089
11171
|
static getSettablePaths() {
|
|
11090
11172
|
return {
|
|
@@ -11106,7 +11188,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
11106
11188
|
}
|
|
11107
11189
|
const relativePath = paths.root.relativeFilePath;
|
|
11108
11190
|
const fileContent = await readFileContent(
|
|
11109
|
-
|
|
11191
|
+
join92(baseDir, paths.root.relativeDirPath, relativePath)
|
|
11110
11192
|
);
|
|
11111
11193
|
return new _ReplitRule({
|
|
11112
11194
|
baseDir,
|
|
@@ -11172,12 +11254,12 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
11172
11254
|
};
|
|
11173
11255
|
|
|
11174
11256
|
// src/features/rules/roo-rule.ts
|
|
11175
|
-
import { join as
|
|
11257
|
+
import { join as join93 } from "path";
|
|
11176
11258
|
var RooRule = class _RooRule extends ToolRule {
|
|
11177
11259
|
static getSettablePaths() {
|
|
11178
11260
|
return {
|
|
11179
11261
|
nonRoot: {
|
|
11180
|
-
relativeDirPath:
|
|
11262
|
+
relativeDirPath: join93(".roo", "rules")
|
|
11181
11263
|
}
|
|
11182
11264
|
};
|
|
11183
11265
|
}
|
|
@@ -11187,7 +11269,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
11187
11269
|
validate = true
|
|
11188
11270
|
}) {
|
|
11189
11271
|
const fileContent = await readFileContent(
|
|
11190
|
-
|
|
11272
|
+
join93(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11191
11273
|
);
|
|
11192
11274
|
return new _RooRule({
|
|
11193
11275
|
baseDir,
|
|
@@ -11256,7 +11338,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
11256
11338
|
};
|
|
11257
11339
|
|
|
11258
11340
|
// src/features/rules/warp-rule.ts
|
|
11259
|
-
import { join as
|
|
11341
|
+
import { join as join94 } from "path";
|
|
11260
11342
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
11261
11343
|
constructor({ fileContent, root, ...rest }) {
|
|
11262
11344
|
super({
|
|
@@ -11272,7 +11354,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11272
11354
|
relativeFilePath: "WARP.md"
|
|
11273
11355
|
},
|
|
11274
11356
|
nonRoot: {
|
|
11275
|
-
relativeDirPath:
|
|
11357
|
+
relativeDirPath: join94(".warp", "memories")
|
|
11276
11358
|
}
|
|
11277
11359
|
};
|
|
11278
11360
|
}
|
|
@@ -11282,8 +11364,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11282
11364
|
validate = true
|
|
11283
11365
|
}) {
|
|
11284
11366
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
11285
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
11286
|
-
const fileContent = await readFileContent(
|
|
11367
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join94(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
11368
|
+
const fileContent = await readFileContent(join94(baseDir, relativePath));
|
|
11287
11369
|
return new _WarpRule({
|
|
11288
11370
|
baseDir,
|
|
11289
11371
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -11338,12 +11420,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11338
11420
|
};
|
|
11339
11421
|
|
|
11340
11422
|
// src/features/rules/windsurf-rule.ts
|
|
11341
|
-
import { join as
|
|
11423
|
+
import { join as join95 } from "path";
|
|
11342
11424
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
11343
11425
|
static getSettablePaths() {
|
|
11344
11426
|
return {
|
|
11345
11427
|
nonRoot: {
|
|
11346
|
-
relativeDirPath:
|
|
11428
|
+
relativeDirPath: join95(".windsurf", "rules")
|
|
11347
11429
|
}
|
|
11348
11430
|
};
|
|
11349
11431
|
}
|
|
@@ -11353,7 +11435,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
11353
11435
|
validate = true
|
|
11354
11436
|
}) {
|
|
11355
11437
|
const fileContent = await readFileContent(
|
|
11356
|
-
|
|
11438
|
+
join95(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11357
11439
|
);
|
|
11358
11440
|
return new _WindsurfRule({
|
|
11359
11441
|
baseDir,
|
|
@@ -11726,7 +11808,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11726
11808
|
}).relativeDirPath;
|
|
11727
11809
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
11728
11810
|
const frontmatter = skill.getFrontmatter();
|
|
11729
|
-
const relativePath =
|
|
11811
|
+
const relativePath = join96(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
11730
11812
|
return {
|
|
11731
11813
|
name: frontmatter.name,
|
|
11732
11814
|
description: frontmatter.description,
|
|
@@ -11837,10 +11919,17 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11837
11919
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
11838
11920
|
*/
|
|
11839
11921
|
async loadRulesyncFiles() {
|
|
11840
|
-
const
|
|
11922
|
+
const rulesyncBaseDir = join96(this.baseDir, RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
11923
|
+
const files = await findFilesByGlobs(join96(rulesyncBaseDir, "**", "*.md"));
|
|
11841
11924
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
11842
11925
|
const rulesyncRules = await Promise.all(
|
|
11843
|
-
files.map((file) =>
|
|
11926
|
+
files.map((file) => {
|
|
11927
|
+
const relativeFilePath = relative4(rulesyncBaseDir, file);
|
|
11928
|
+
checkPathTraversal({ relativePath: relativeFilePath, intendedRootDir: rulesyncBaseDir });
|
|
11929
|
+
return RulesyncRule.fromFile({
|
|
11930
|
+
relativeFilePath
|
|
11931
|
+
});
|
|
11932
|
+
})
|
|
11844
11933
|
);
|
|
11845
11934
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
11846
11935
|
if (rootRules.length > 1) {
|
|
@@ -11889,7 +11978,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11889
11978
|
return [];
|
|
11890
11979
|
}
|
|
11891
11980
|
const rootFilePaths = await findFilesByGlobs(
|
|
11892
|
-
|
|
11981
|
+
join96(
|
|
11893
11982
|
this.baseDir,
|
|
11894
11983
|
settablePaths.root.relativeDirPath ?? ".",
|
|
11895
11984
|
settablePaths.root.relativeFilePath
|
|
@@ -11900,7 +11989,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11900
11989
|
(filePath) => factory.class.forDeletion({
|
|
11901
11990
|
baseDir: this.baseDir,
|
|
11902
11991
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
11903
|
-
relativeFilePath:
|
|
11992
|
+
relativeFilePath: basename22(filePath),
|
|
11904
11993
|
global: this.global
|
|
11905
11994
|
})
|
|
11906
11995
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11909,7 +11998,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11909
11998
|
rootFilePaths.map(
|
|
11910
11999
|
(filePath) => factory.class.fromFile({
|
|
11911
12000
|
baseDir: this.baseDir,
|
|
11912
|
-
relativeFilePath:
|
|
12001
|
+
relativeFilePath: basename22(filePath),
|
|
11913
12002
|
global: this.global
|
|
11914
12003
|
})
|
|
11915
12004
|
)
|
|
@@ -11927,13 +12016,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11927
12016
|
return [];
|
|
11928
12017
|
}
|
|
11929
12018
|
const localRootFilePaths = await findFilesByGlobs(
|
|
11930
|
-
|
|
12019
|
+
join96(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md")
|
|
11931
12020
|
);
|
|
11932
12021
|
return localRootFilePaths.map(
|
|
11933
12022
|
(filePath) => factory.class.forDeletion({
|
|
11934
12023
|
baseDir: this.baseDir,
|
|
11935
12024
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
11936
|
-
relativeFilePath:
|
|
12025
|
+
relativeFilePath: basename22(filePath),
|
|
11937
12026
|
global: this.global
|
|
11938
12027
|
})
|
|
11939
12028
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11943,27 +12032,35 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11943
12032
|
if (!settablePaths.nonRoot) {
|
|
11944
12033
|
return [];
|
|
11945
12034
|
}
|
|
12035
|
+
const nonRootBaseDir = join96(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
11946
12036
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
11947
|
-
|
|
12037
|
+
join96(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
11948
12038
|
);
|
|
11949
12039
|
if (forDeletion) {
|
|
11950
|
-
return nonRootFilePaths.map(
|
|
11951
|
-
(filePath)
|
|
12040
|
+
return nonRootFilePaths.map((filePath) => {
|
|
12041
|
+
const relativeFilePath = relative4(nonRootBaseDir, filePath);
|
|
12042
|
+
checkPathTraversal({
|
|
12043
|
+
relativePath: relativeFilePath,
|
|
12044
|
+
intendedRootDir: nonRootBaseDir
|
|
12045
|
+
});
|
|
12046
|
+
return factory.class.forDeletion({
|
|
11952
12047
|
baseDir: this.baseDir,
|
|
11953
12048
|
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
11954
|
-
relativeFilePath
|
|
12049
|
+
relativeFilePath,
|
|
11955
12050
|
global: this.global
|
|
11956
|
-
})
|
|
11957
|
-
).filter((rule) => rule.isDeletable());
|
|
12051
|
+
});
|
|
12052
|
+
}).filter((rule) => rule.isDeletable());
|
|
11958
12053
|
}
|
|
11959
12054
|
return await Promise.all(
|
|
11960
|
-
nonRootFilePaths.map(
|
|
11961
|
-
(filePath)
|
|
12055
|
+
nonRootFilePaths.map((filePath) => {
|
|
12056
|
+
const relativeFilePath = relative4(nonRootBaseDir, filePath);
|
|
12057
|
+
checkPathTraversal({ relativePath: relativeFilePath, intendedRootDir: nonRootBaseDir });
|
|
12058
|
+
return factory.class.fromFile({
|
|
11962
12059
|
baseDir: this.baseDir,
|
|
11963
|
-
relativeFilePath
|
|
12060
|
+
relativeFilePath,
|
|
11964
12061
|
global: this.global
|
|
11965
|
-
})
|
|
11966
|
-
)
|
|
12062
|
+
});
|
|
12063
|
+
})
|
|
11967
12064
|
);
|
|
11968
12065
|
})();
|
|
11969
12066
|
logger.debug(`Found ${nonRootToolRules.length} non-root tool rule files`);
|
|
@@ -12053,14 +12150,14 @@ s/<command> [arguments]
|
|
|
12053
12150
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
12054
12151
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
12055
12152
|
|
|
12056
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
12153
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join96(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
12057
12154
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
12058
12155
|
|
|
12059
12156
|
Simulated subagents are specialized AI assistants that can be invoked to handle specific types of tasks. In this case, it can be appear something like custom slash commands simply. Simulated subagents can be called by custom slash commands.
|
|
12060
12157
|
|
|
12061
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
12158
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join96(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
12062
12159
|
|
|
12063
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
12160
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join96(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
12064
12161
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
12065
12162
|
const result = [
|
|
12066
12163
|
overview,
|
|
@@ -12089,7 +12186,7 @@ ${toonContent}`;
|
|
|
12089
12186
|
|
|
12090
12187
|
// src/lib/generate.ts
|
|
12091
12188
|
async function checkRulesyncDirExists(params) {
|
|
12092
|
-
return fileExists(
|
|
12189
|
+
return fileExists(join97(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
12093
12190
|
}
|
|
12094
12191
|
async function generate(params) {
|
|
12095
12192
|
const { config } = params;
|
|
@@ -12319,7 +12416,7 @@ async function generateCommand(options) {
|
|
|
12319
12416
|
silent: config.getSilent()
|
|
12320
12417
|
});
|
|
12321
12418
|
logger.info("Generating files...");
|
|
12322
|
-
if (!await checkRulesyncDirExists({ baseDir:
|
|
12419
|
+
if (!await checkRulesyncDirExists({ baseDir: process.cwd() })) {
|
|
12323
12420
|
logger.error("\u274C .rulesync directory not found. Run 'rulesync init' first.");
|
|
12324
12421
|
process.exit(1);
|
|
12325
12422
|
}
|
|
@@ -12382,7 +12479,7 @@ async function generateCommand(options) {
|
|
|
12382
12479
|
}
|
|
12383
12480
|
|
|
12384
12481
|
// src/cli/commands/gitignore.ts
|
|
12385
|
-
import { join as
|
|
12482
|
+
import { join as join98 } from "path";
|
|
12386
12483
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
12387
12484
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
12388
12485
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -12474,6 +12571,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
12474
12571
|
// Others
|
|
12475
12572
|
"**/modular-mcp.json",
|
|
12476
12573
|
".rulesync/rules/*.local.md",
|
|
12574
|
+
"rulesync.local.jsonc",
|
|
12477
12575
|
"!.rulesync/.aiignore"
|
|
12478
12576
|
];
|
|
12479
12577
|
var isRulesyncHeader = (line) => {
|
|
@@ -12526,7 +12624,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
12526
12624
|
return result;
|
|
12527
12625
|
};
|
|
12528
12626
|
var gitignoreCommand = async () => {
|
|
12529
|
-
const gitignorePath =
|
|
12627
|
+
const gitignorePath = join98(process.cwd(), ".gitignore");
|
|
12530
12628
|
let gitignoreContent = "";
|
|
12531
12629
|
if (await fileExists(gitignorePath)) {
|
|
12532
12630
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -12728,7 +12826,7 @@ async function importSkills(config, tool) {
|
|
|
12728
12826
|
}
|
|
12729
12827
|
|
|
12730
12828
|
// src/cli/commands/init.ts
|
|
12731
|
-
import { join as
|
|
12829
|
+
import { join as join99 } from "path";
|
|
12732
12830
|
async function initCommand() {
|
|
12733
12831
|
logger.info("Initializing rulesync...");
|
|
12734
12832
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -12755,6 +12853,7 @@ async function createConfigFile() {
|
|
|
12755
12853
|
baseDirs: ["."],
|
|
12756
12854
|
delete: true,
|
|
12757
12855
|
verbose: false,
|
|
12856
|
+
silent: false,
|
|
12758
12857
|
global: false,
|
|
12759
12858
|
simulateCommands: false,
|
|
12760
12859
|
simulateSubagents: false,
|
|
@@ -12906,14 +13005,14 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12906
13005
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
12907
13006
|
await ensureDir(skillPaths.relativeDirPath);
|
|
12908
13007
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
12909
|
-
const ruleFilepath =
|
|
13008
|
+
const ruleFilepath = join99(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
12910
13009
|
if (!await fileExists(ruleFilepath)) {
|
|
12911
13010
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
12912
13011
|
logger.success(`Created ${ruleFilepath}`);
|
|
12913
13012
|
} else {
|
|
12914
13013
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
12915
13014
|
}
|
|
12916
|
-
const mcpFilepath =
|
|
13015
|
+
const mcpFilepath = join99(
|
|
12917
13016
|
mcpPaths.recommended.relativeDirPath,
|
|
12918
13017
|
mcpPaths.recommended.relativeFilePath
|
|
12919
13018
|
);
|
|
@@ -12923,30 +13022,30 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12923
13022
|
} else {
|
|
12924
13023
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
12925
13024
|
}
|
|
12926
|
-
const commandFilepath =
|
|
13025
|
+
const commandFilepath = join99(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
12927
13026
|
if (!await fileExists(commandFilepath)) {
|
|
12928
13027
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
12929
13028
|
logger.success(`Created ${commandFilepath}`);
|
|
12930
13029
|
} else {
|
|
12931
13030
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
12932
13031
|
}
|
|
12933
|
-
const subagentFilepath =
|
|
13032
|
+
const subagentFilepath = join99(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
12934
13033
|
if (!await fileExists(subagentFilepath)) {
|
|
12935
13034
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
12936
13035
|
logger.success(`Created ${subagentFilepath}`);
|
|
12937
13036
|
} else {
|
|
12938
13037
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
12939
13038
|
}
|
|
12940
|
-
const skillDirPath =
|
|
13039
|
+
const skillDirPath = join99(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
12941
13040
|
await ensureDir(skillDirPath);
|
|
12942
|
-
const skillFilepath =
|
|
13041
|
+
const skillFilepath = join99(skillDirPath, SKILL_FILE_NAME);
|
|
12943
13042
|
if (!await fileExists(skillFilepath)) {
|
|
12944
13043
|
await writeFileContent(skillFilepath, sampleSkillFile.content);
|
|
12945
13044
|
logger.success(`Created ${skillFilepath}`);
|
|
12946
13045
|
} else {
|
|
12947
13046
|
logger.info(`Skipped ${skillFilepath} (already exists)`);
|
|
12948
13047
|
}
|
|
12949
|
-
const ignoreFilepath =
|
|
13048
|
+
const ignoreFilepath = join99(
|
|
12950
13049
|
ignorePaths.recommended.relativeDirPath,
|
|
12951
13050
|
ignorePaths.recommended.relativeFilePath
|
|
12952
13051
|
);
|
|
@@ -12965,12 +13064,12 @@ import { FastMCP } from "fastmcp";
|
|
|
12965
13064
|
import { z as z51 } from "zod/mini";
|
|
12966
13065
|
|
|
12967
13066
|
// src/mcp/commands.ts
|
|
12968
|
-
import { basename as
|
|
13067
|
+
import { basename as basename23, join as join100 } from "path";
|
|
12969
13068
|
import { z as z45 } from "zod/mini";
|
|
12970
13069
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
12971
13070
|
var maxCommandsCount = 1e3;
|
|
12972
13071
|
async function listCommands() {
|
|
12973
|
-
const commandsDir =
|
|
13072
|
+
const commandsDir = join100(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12974
13073
|
try {
|
|
12975
13074
|
const files = await listDirectoryFiles(commandsDir);
|
|
12976
13075
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12982,7 +13081,7 @@ async function listCommands() {
|
|
|
12982
13081
|
});
|
|
12983
13082
|
const frontmatter = command.getFrontmatter();
|
|
12984
13083
|
return {
|
|
12985
|
-
relativePathFromCwd:
|
|
13084
|
+
relativePathFromCwd: join100(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
12986
13085
|
frontmatter
|
|
12987
13086
|
};
|
|
12988
13087
|
} catch (error) {
|
|
@@ -13002,13 +13101,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
13002
13101
|
relativePath: relativePathFromCwd,
|
|
13003
13102
|
intendedRootDir: process.cwd()
|
|
13004
13103
|
});
|
|
13005
|
-
const filename =
|
|
13104
|
+
const filename = basename23(relativePathFromCwd);
|
|
13006
13105
|
try {
|
|
13007
13106
|
const command = await RulesyncCommand.fromFile({
|
|
13008
13107
|
relativeFilePath: filename
|
|
13009
13108
|
});
|
|
13010
13109
|
return {
|
|
13011
|
-
relativePathFromCwd:
|
|
13110
|
+
relativePathFromCwd: join100(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
13012
13111
|
frontmatter: command.getFrontmatter(),
|
|
13013
13112
|
body: command.getBody()
|
|
13014
13113
|
};
|
|
@@ -13027,7 +13126,7 @@ async function putCommand({
|
|
|
13027
13126
|
relativePath: relativePathFromCwd,
|
|
13028
13127
|
intendedRootDir: process.cwd()
|
|
13029
13128
|
});
|
|
13030
|
-
const filename =
|
|
13129
|
+
const filename = basename23(relativePathFromCwd);
|
|
13031
13130
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
13032
13131
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
13033
13132
|
throw new Error(
|
|
@@ -13037,7 +13136,7 @@ async function putCommand({
|
|
|
13037
13136
|
try {
|
|
13038
13137
|
const existingCommands = await listCommands();
|
|
13039
13138
|
const isUpdate = existingCommands.some(
|
|
13040
|
-
(command2) => command2.relativePathFromCwd ===
|
|
13139
|
+
(command2) => command2.relativePathFromCwd === join100(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
13041
13140
|
);
|
|
13042
13141
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
13043
13142
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -13052,11 +13151,11 @@ async function putCommand({
|
|
|
13052
13151
|
fileContent,
|
|
13053
13152
|
validate: true
|
|
13054
13153
|
});
|
|
13055
|
-
const commandsDir =
|
|
13154
|
+
const commandsDir = join100(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
13056
13155
|
await ensureDir(commandsDir);
|
|
13057
13156
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
13058
13157
|
return {
|
|
13059
|
-
relativePathFromCwd:
|
|
13158
|
+
relativePathFromCwd: join100(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
13060
13159
|
frontmatter: command.getFrontmatter(),
|
|
13061
13160
|
body: command.getBody()
|
|
13062
13161
|
};
|
|
@@ -13071,12 +13170,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
13071
13170
|
relativePath: relativePathFromCwd,
|
|
13072
13171
|
intendedRootDir: process.cwd()
|
|
13073
13172
|
});
|
|
13074
|
-
const filename =
|
|
13075
|
-
const fullPath =
|
|
13173
|
+
const filename = basename23(relativePathFromCwd);
|
|
13174
|
+
const fullPath = join100(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
13076
13175
|
try {
|
|
13077
13176
|
await removeFile(fullPath);
|
|
13078
13177
|
return {
|
|
13079
|
-
relativePathFromCwd:
|
|
13178
|
+
relativePathFromCwd: join100(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
13080
13179
|
};
|
|
13081
13180
|
} catch (error) {
|
|
13082
13181
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -13101,7 +13200,7 @@ var commandToolSchemas = {
|
|
|
13101
13200
|
var commandTools = {
|
|
13102
13201
|
listCommands: {
|
|
13103
13202
|
name: "listCommands",
|
|
13104
|
-
description: `List all commands from ${
|
|
13203
|
+
description: `List all commands from ${join100(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13105
13204
|
parameters: commandToolSchemas.listCommands,
|
|
13106
13205
|
execute: async () => {
|
|
13107
13206
|
const commands = await listCommands();
|
|
@@ -13143,11 +13242,11 @@ var commandTools = {
|
|
|
13143
13242
|
};
|
|
13144
13243
|
|
|
13145
13244
|
// src/mcp/ignore.ts
|
|
13146
|
-
import { join as
|
|
13245
|
+
import { join as join101 } from "path";
|
|
13147
13246
|
import { z as z46 } from "zod/mini";
|
|
13148
13247
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
13149
13248
|
async function getIgnoreFile() {
|
|
13150
|
-
const ignoreFilePath =
|
|
13249
|
+
const ignoreFilePath = join101(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
13151
13250
|
try {
|
|
13152
13251
|
const content = await readFileContent(ignoreFilePath);
|
|
13153
13252
|
return {
|
|
@@ -13161,7 +13260,7 @@ async function getIgnoreFile() {
|
|
|
13161
13260
|
}
|
|
13162
13261
|
}
|
|
13163
13262
|
async function putIgnoreFile({ content }) {
|
|
13164
|
-
const ignoreFilePath =
|
|
13263
|
+
const ignoreFilePath = join101(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
13165
13264
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
13166
13265
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
13167
13266
|
throw new Error(
|
|
@@ -13182,8 +13281,8 @@ async function putIgnoreFile({ content }) {
|
|
|
13182
13281
|
}
|
|
13183
13282
|
}
|
|
13184
13283
|
async function deleteIgnoreFile() {
|
|
13185
|
-
const aiignorePath =
|
|
13186
|
-
const legacyIgnorePath =
|
|
13284
|
+
const aiignorePath = join101(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
13285
|
+
const legacyIgnorePath = join101(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
13187
13286
|
try {
|
|
13188
13287
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
13189
13288
|
return {
|
|
@@ -13238,7 +13337,7 @@ var ignoreTools = {
|
|
|
13238
13337
|
};
|
|
13239
13338
|
|
|
13240
13339
|
// src/mcp/mcp.ts
|
|
13241
|
-
import { join as
|
|
13340
|
+
import { join as join102 } from "path";
|
|
13242
13341
|
import { z as z47 } from "zod/mini";
|
|
13243
13342
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
13244
13343
|
async function getMcpFile() {
|
|
@@ -13248,7 +13347,7 @@ async function getMcpFile() {
|
|
|
13248
13347
|
validate: true,
|
|
13249
13348
|
modularMcp: config.getModularMcp()
|
|
13250
13349
|
});
|
|
13251
|
-
const relativePathFromCwd =
|
|
13350
|
+
const relativePathFromCwd = join102(
|
|
13252
13351
|
rulesyncMcp.getRelativeDirPath(),
|
|
13253
13352
|
rulesyncMcp.getRelativeFilePath()
|
|
13254
13353
|
);
|
|
@@ -13281,7 +13380,7 @@ async function putMcpFile({ content }) {
|
|
|
13281
13380
|
const paths = RulesyncMcp.getSettablePaths();
|
|
13282
13381
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
13283
13382
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
13284
|
-
const fullPath =
|
|
13383
|
+
const fullPath = join102(baseDir, relativeDirPath, relativeFilePath);
|
|
13285
13384
|
const rulesyncMcp = new RulesyncMcp({
|
|
13286
13385
|
baseDir,
|
|
13287
13386
|
relativeDirPath,
|
|
@@ -13290,9 +13389,9 @@ async function putMcpFile({ content }) {
|
|
|
13290
13389
|
validate: true,
|
|
13291
13390
|
modularMcp: config.getModularMcp()
|
|
13292
13391
|
});
|
|
13293
|
-
await ensureDir(
|
|
13392
|
+
await ensureDir(join102(baseDir, relativeDirPath));
|
|
13294
13393
|
await writeFileContent(fullPath, content);
|
|
13295
|
-
const relativePathFromCwd =
|
|
13394
|
+
const relativePathFromCwd = join102(relativeDirPath, relativeFilePath);
|
|
13296
13395
|
return {
|
|
13297
13396
|
relativePathFromCwd,
|
|
13298
13397
|
content: rulesyncMcp.getFileContent()
|
|
@@ -13307,15 +13406,15 @@ async function deleteMcpFile() {
|
|
|
13307
13406
|
try {
|
|
13308
13407
|
const baseDir = process.cwd();
|
|
13309
13408
|
const paths = RulesyncMcp.getSettablePaths();
|
|
13310
|
-
const recommendedPath =
|
|
13409
|
+
const recommendedPath = join102(
|
|
13311
13410
|
baseDir,
|
|
13312
13411
|
paths.recommended.relativeDirPath,
|
|
13313
13412
|
paths.recommended.relativeFilePath
|
|
13314
13413
|
);
|
|
13315
|
-
const legacyPath =
|
|
13414
|
+
const legacyPath = join102(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
13316
13415
|
await removeFile(recommendedPath);
|
|
13317
13416
|
await removeFile(legacyPath);
|
|
13318
|
-
const relativePathFromCwd =
|
|
13417
|
+
const relativePathFromCwd = join102(
|
|
13319
13418
|
paths.recommended.relativeDirPath,
|
|
13320
13419
|
paths.recommended.relativeFilePath
|
|
13321
13420
|
);
|
|
@@ -13366,12 +13465,12 @@ var mcpTools = {
|
|
|
13366
13465
|
};
|
|
13367
13466
|
|
|
13368
13467
|
// src/mcp/rules.ts
|
|
13369
|
-
import { basename as
|
|
13468
|
+
import { basename as basename24, join as join103 } from "path";
|
|
13370
13469
|
import { z as z48 } from "zod/mini";
|
|
13371
13470
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
13372
13471
|
var maxRulesCount = 1e3;
|
|
13373
13472
|
async function listRules() {
|
|
13374
|
-
const rulesDir =
|
|
13473
|
+
const rulesDir = join103(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
13375
13474
|
try {
|
|
13376
13475
|
const files = await listDirectoryFiles(rulesDir);
|
|
13377
13476
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13384,7 +13483,7 @@ async function listRules() {
|
|
|
13384
13483
|
});
|
|
13385
13484
|
const frontmatter = rule.getFrontmatter();
|
|
13386
13485
|
return {
|
|
13387
|
-
relativePathFromCwd:
|
|
13486
|
+
relativePathFromCwd: join103(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
13388
13487
|
frontmatter
|
|
13389
13488
|
};
|
|
13390
13489
|
} catch (error) {
|
|
@@ -13404,14 +13503,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
13404
13503
|
relativePath: relativePathFromCwd,
|
|
13405
13504
|
intendedRootDir: process.cwd()
|
|
13406
13505
|
});
|
|
13407
|
-
const filename =
|
|
13506
|
+
const filename = basename24(relativePathFromCwd);
|
|
13408
13507
|
try {
|
|
13409
13508
|
const rule = await RulesyncRule.fromFile({
|
|
13410
13509
|
relativeFilePath: filename,
|
|
13411
13510
|
validate: true
|
|
13412
13511
|
});
|
|
13413
13512
|
return {
|
|
13414
|
-
relativePathFromCwd:
|
|
13513
|
+
relativePathFromCwd: join103(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
13415
13514
|
frontmatter: rule.getFrontmatter(),
|
|
13416
13515
|
body: rule.getBody()
|
|
13417
13516
|
};
|
|
@@ -13430,7 +13529,7 @@ async function putRule({
|
|
|
13430
13529
|
relativePath: relativePathFromCwd,
|
|
13431
13530
|
intendedRootDir: process.cwd()
|
|
13432
13531
|
});
|
|
13433
|
-
const filename =
|
|
13532
|
+
const filename = basename24(relativePathFromCwd);
|
|
13434
13533
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
13435
13534
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
13436
13535
|
throw new Error(
|
|
@@ -13440,7 +13539,7 @@ async function putRule({
|
|
|
13440
13539
|
try {
|
|
13441
13540
|
const existingRules = await listRules();
|
|
13442
13541
|
const isUpdate = existingRules.some(
|
|
13443
|
-
(rule2) => rule2.relativePathFromCwd ===
|
|
13542
|
+
(rule2) => rule2.relativePathFromCwd === join103(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
13444
13543
|
);
|
|
13445
13544
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
13446
13545
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -13453,11 +13552,11 @@ async function putRule({
|
|
|
13453
13552
|
body,
|
|
13454
13553
|
validate: true
|
|
13455
13554
|
});
|
|
13456
|
-
const rulesDir =
|
|
13555
|
+
const rulesDir = join103(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
13457
13556
|
await ensureDir(rulesDir);
|
|
13458
13557
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
13459
13558
|
return {
|
|
13460
|
-
relativePathFromCwd:
|
|
13559
|
+
relativePathFromCwd: join103(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
13461
13560
|
frontmatter: rule.getFrontmatter(),
|
|
13462
13561
|
body: rule.getBody()
|
|
13463
13562
|
};
|
|
@@ -13472,12 +13571,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
13472
13571
|
relativePath: relativePathFromCwd,
|
|
13473
13572
|
intendedRootDir: process.cwd()
|
|
13474
13573
|
});
|
|
13475
|
-
const filename =
|
|
13476
|
-
const fullPath =
|
|
13574
|
+
const filename = basename24(relativePathFromCwd);
|
|
13575
|
+
const fullPath = join103(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
13477
13576
|
try {
|
|
13478
13577
|
await removeFile(fullPath);
|
|
13479
13578
|
return {
|
|
13480
|
-
relativePathFromCwd:
|
|
13579
|
+
relativePathFromCwd: join103(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
13481
13580
|
};
|
|
13482
13581
|
} catch (error) {
|
|
13483
13582
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -13502,7 +13601,7 @@ var ruleToolSchemas = {
|
|
|
13502
13601
|
var ruleTools = {
|
|
13503
13602
|
listRules: {
|
|
13504
13603
|
name: "listRules",
|
|
13505
|
-
description: `List all rules from ${
|
|
13604
|
+
description: `List all rules from ${join103(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13506
13605
|
parameters: ruleToolSchemas.listRules,
|
|
13507
13606
|
execute: async () => {
|
|
13508
13607
|
const rules = await listRules();
|
|
@@ -13544,7 +13643,7 @@ var ruleTools = {
|
|
|
13544
13643
|
};
|
|
13545
13644
|
|
|
13546
13645
|
// src/mcp/skills.ts
|
|
13547
|
-
import { basename as
|
|
13646
|
+
import { basename as basename25, dirname as dirname3, join as join104 } from "path";
|
|
13548
13647
|
import { z as z49 } from "zod/mini";
|
|
13549
13648
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
13550
13649
|
var maxSkillsCount = 1e3;
|
|
@@ -13561,19 +13660,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
13561
13660
|
};
|
|
13562
13661
|
}
|
|
13563
13662
|
function extractDirName(relativeDirPathFromCwd) {
|
|
13564
|
-
const dirName =
|
|
13663
|
+
const dirName = basename25(relativeDirPathFromCwd);
|
|
13565
13664
|
if (!dirName) {
|
|
13566
13665
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
13567
13666
|
}
|
|
13568
13667
|
return dirName;
|
|
13569
13668
|
}
|
|
13570
13669
|
async function listSkills() {
|
|
13571
|
-
const skillsDir =
|
|
13670
|
+
const skillsDir = join104(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
13572
13671
|
try {
|
|
13573
|
-
const skillDirPaths = await findFilesByGlobs(
|
|
13672
|
+
const skillDirPaths = await findFilesByGlobs(join104(skillsDir, "*"), { type: "dir" });
|
|
13574
13673
|
const skills = await Promise.all(
|
|
13575
13674
|
skillDirPaths.map(async (dirPath) => {
|
|
13576
|
-
const dirName =
|
|
13675
|
+
const dirName = basename25(dirPath);
|
|
13577
13676
|
if (!dirName) return null;
|
|
13578
13677
|
try {
|
|
13579
13678
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -13581,7 +13680,7 @@ async function listSkills() {
|
|
|
13581
13680
|
});
|
|
13582
13681
|
const frontmatter = skill.getFrontmatter();
|
|
13583
13682
|
return {
|
|
13584
|
-
relativeDirPathFromCwd:
|
|
13683
|
+
relativeDirPathFromCwd: join104(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13585
13684
|
frontmatter
|
|
13586
13685
|
};
|
|
13587
13686
|
} catch (error) {
|
|
@@ -13607,7 +13706,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
13607
13706
|
dirName
|
|
13608
13707
|
});
|
|
13609
13708
|
return {
|
|
13610
|
-
relativeDirPathFromCwd:
|
|
13709
|
+
relativeDirPathFromCwd: join104(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13611
13710
|
frontmatter: skill.getFrontmatter(),
|
|
13612
13711
|
body: skill.getBody(),
|
|
13613
13712
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13641,7 +13740,7 @@ async function putSkill({
|
|
|
13641
13740
|
try {
|
|
13642
13741
|
const existingSkills = await listSkills();
|
|
13643
13742
|
const isUpdate = existingSkills.some(
|
|
13644
|
-
(skill2) => skill2.relativeDirPathFromCwd ===
|
|
13743
|
+
(skill2) => skill2.relativeDirPathFromCwd === join104(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13645
13744
|
);
|
|
13646
13745
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
13647
13746
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -13656,9 +13755,9 @@ async function putSkill({
|
|
|
13656
13755
|
otherFiles: aiDirFiles,
|
|
13657
13756
|
validate: true
|
|
13658
13757
|
});
|
|
13659
|
-
const skillDirPath =
|
|
13758
|
+
const skillDirPath = join104(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13660
13759
|
await ensureDir(skillDirPath);
|
|
13661
|
-
const skillFilePath =
|
|
13760
|
+
const skillFilePath = join104(skillDirPath, SKILL_FILE_NAME);
|
|
13662
13761
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
13663
13762
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
13664
13763
|
for (const file of otherFiles) {
|
|
@@ -13666,15 +13765,15 @@ async function putSkill({
|
|
|
13666
13765
|
relativePath: file.name,
|
|
13667
13766
|
intendedRootDir: skillDirPath
|
|
13668
13767
|
});
|
|
13669
|
-
const filePath =
|
|
13670
|
-
const fileDir =
|
|
13768
|
+
const filePath = join104(skillDirPath, file.name);
|
|
13769
|
+
const fileDir = join104(skillDirPath, dirname3(file.name));
|
|
13671
13770
|
if (fileDir !== skillDirPath) {
|
|
13672
13771
|
await ensureDir(fileDir);
|
|
13673
13772
|
}
|
|
13674
13773
|
await writeFileContent(filePath, file.body);
|
|
13675
13774
|
}
|
|
13676
13775
|
return {
|
|
13677
|
-
relativeDirPathFromCwd:
|
|
13776
|
+
relativeDirPathFromCwd: join104(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13678
13777
|
frontmatter: skill.getFrontmatter(),
|
|
13679
13778
|
body: skill.getBody(),
|
|
13680
13779
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13696,13 +13795,13 @@ async function deleteSkill({
|
|
|
13696
13795
|
intendedRootDir: process.cwd()
|
|
13697
13796
|
});
|
|
13698
13797
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
13699
|
-
const skillDirPath =
|
|
13798
|
+
const skillDirPath = join104(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13700
13799
|
try {
|
|
13701
13800
|
if (await directoryExists(skillDirPath)) {
|
|
13702
13801
|
await removeDirectory(skillDirPath);
|
|
13703
13802
|
}
|
|
13704
13803
|
return {
|
|
13705
|
-
relativeDirPathFromCwd:
|
|
13804
|
+
relativeDirPathFromCwd: join104(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13706
13805
|
};
|
|
13707
13806
|
} catch (error) {
|
|
13708
13807
|
throw new Error(
|
|
@@ -13735,7 +13834,7 @@ var skillToolSchemas = {
|
|
|
13735
13834
|
var skillTools = {
|
|
13736
13835
|
listSkills: {
|
|
13737
13836
|
name: "listSkills",
|
|
13738
|
-
description: `List all skills from ${
|
|
13837
|
+
description: `List all skills from ${join104(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
13739
13838
|
parameters: skillToolSchemas.listSkills,
|
|
13740
13839
|
execute: async () => {
|
|
13741
13840
|
const skills = await listSkills();
|
|
@@ -13778,12 +13877,12 @@ var skillTools = {
|
|
|
13778
13877
|
};
|
|
13779
13878
|
|
|
13780
13879
|
// src/mcp/subagents.ts
|
|
13781
|
-
import { basename as
|
|
13880
|
+
import { basename as basename26, join as join105 } from "path";
|
|
13782
13881
|
import { z as z50 } from "zod/mini";
|
|
13783
13882
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
13784
13883
|
var maxSubagentsCount = 1e3;
|
|
13785
13884
|
async function listSubagents() {
|
|
13786
|
-
const subagentsDir =
|
|
13885
|
+
const subagentsDir = join105(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13787
13886
|
try {
|
|
13788
13887
|
const files = await listDirectoryFiles(subagentsDir);
|
|
13789
13888
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13796,7 +13895,7 @@ async function listSubagents() {
|
|
|
13796
13895
|
});
|
|
13797
13896
|
const frontmatter = subagent.getFrontmatter();
|
|
13798
13897
|
return {
|
|
13799
|
-
relativePathFromCwd:
|
|
13898
|
+
relativePathFromCwd: join105(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
13800
13899
|
frontmatter
|
|
13801
13900
|
};
|
|
13802
13901
|
} catch (error) {
|
|
@@ -13818,14 +13917,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
13818
13917
|
relativePath: relativePathFromCwd,
|
|
13819
13918
|
intendedRootDir: process.cwd()
|
|
13820
13919
|
});
|
|
13821
|
-
const filename =
|
|
13920
|
+
const filename = basename26(relativePathFromCwd);
|
|
13822
13921
|
try {
|
|
13823
13922
|
const subagent = await RulesyncSubagent.fromFile({
|
|
13824
13923
|
relativeFilePath: filename,
|
|
13825
13924
|
validate: true
|
|
13826
13925
|
});
|
|
13827
13926
|
return {
|
|
13828
|
-
relativePathFromCwd:
|
|
13927
|
+
relativePathFromCwd: join105(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13829
13928
|
frontmatter: subagent.getFrontmatter(),
|
|
13830
13929
|
body: subagent.getBody()
|
|
13831
13930
|
};
|
|
@@ -13844,7 +13943,7 @@ async function putSubagent({
|
|
|
13844
13943
|
relativePath: relativePathFromCwd,
|
|
13845
13944
|
intendedRootDir: process.cwd()
|
|
13846
13945
|
});
|
|
13847
|
-
const filename =
|
|
13946
|
+
const filename = basename26(relativePathFromCwd);
|
|
13848
13947
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
13849
13948
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
13850
13949
|
throw new Error(
|
|
@@ -13854,7 +13953,7 @@ async function putSubagent({
|
|
|
13854
13953
|
try {
|
|
13855
13954
|
const existingSubagents = await listSubagents();
|
|
13856
13955
|
const isUpdate = existingSubagents.some(
|
|
13857
|
-
(subagent2) => subagent2.relativePathFromCwd ===
|
|
13956
|
+
(subagent2) => subagent2.relativePathFromCwd === join105(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13858
13957
|
);
|
|
13859
13958
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
13860
13959
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -13867,11 +13966,11 @@ async function putSubagent({
|
|
|
13867
13966
|
body,
|
|
13868
13967
|
validate: true
|
|
13869
13968
|
});
|
|
13870
|
-
const subagentsDir =
|
|
13969
|
+
const subagentsDir = join105(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13871
13970
|
await ensureDir(subagentsDir);
|
|
13872
13971
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
13873
13972
|
return {
|
|
13874
|
-
relativePathFromCwd:
|
|
13973
|
+
relativePathFromCwd: join105(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13875
13974
|
frontmatter: subagent.getFrontmatter(),
|
|
13876
13975
|
body: subagent.getBody()
|
|
13877
13976
|
};
|
|
@@ -13886,12 +13985,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
13886
13985
|
relativePath: relativePathFromCwd,
|
|
13887
13986
|
intendedRootDir: process.cwd()
|
|
13888
13987
|
});
|
|
13889
|
-
const filename =
|
|
13890
|
-
const fullPath =
|
|
13988
|
+
const filename = basename26(relativePathFromCwd);
|
|
13989
|
+
const fullPath = join105(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
13891
13990
|
try {
|
|
13892
13991
|
await removeFile(fullPath);
|
|
13893
13992
|
return {
|
|
13894
|
-
relativePathFromCwd:
|
|
13993
|
+
relativePathFromCwd: join105(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13895
13994
|
};
|
|
13896
13995
|
} catch (error) {
|
|
13897
13996
|
throw new Error(
|
|
@@ -13919,7 +14018,7 @@ var subagentToolSchemas = {
|
|
|
13919
14018
|
var subagentTools = {
|
|
13920
14019
|
listSubagents: {
|
|
13921
14020
|
name: "listSubagents",
|
|
13922
|
-
description: `List all subagents from ${
|
|
14021
|
+
description: `List all subagents from ${join105(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13923
14022
|
parameters: subagentToolSchemas.listSubagents,
|
|
13924
14023
|
execute: async () => {
|
|
13925
14024
|
const subagents = await listSubagents();
|
|
@@ -14170,7 +14269,7 @@ async function mcpCommand({ version }) {
|
|
|
14170
14269
|
}
|
|
14171
14270
|
|
|
14172
14271
|
// src/cli/index.ts
|
|
14173
|
-
var getVersion = () => "6.
|
|
14272
|
+
var getVersion = () => "6.1.1";
|
|
14174
14273
|
var main = async () => {
|
|
14175
14274
|
const program = new Command();
|
|
14176
14275
|
const version = getVersion();
|