rulesync 5.4.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/index.cjs +630 -398
- package/dist/index.js +622 -390
- package/package.json +18 -18
package/dist/index.js
CHANGED
|
@@ -248,6 +248,7 @@ var ALL_TOOL_TARGETS = [
|
|
|
248
248
|
"kiro",
|
|
249
249
|
"opencode",
|
|
250
250
|
"qwencode",
|
|
251
|
+
"replit",
|
|
251
252
|
"roo",
|
|
252
253
|
"warp",
|
|
253
254
|
"windsurf",
|
|
@@ -463,7 +464,7 @@ var RULESYNC_OVERVIEW_FILE_NAME = "overview.md";
|
|
|
463
464
|
var RULESYNC_SKILLS_RELATIVE_DIR_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "skills");
|
|
464
465
|
|
|
465
466
|
// src/features/commands/commands-processor.ts
|
|
466
|
-
import { basename as
|
|
467
|
+
import { basename as basename15, join as join17 } from "path";
|
|
467
468
|
import { z as z12 } from "zod/mini";
|
|
468
469
|
|
|
469
470
|
// src/types/feature-processor.ts
|
|
@@ -881,6 +882,11 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
881
882
|
import { basename as basename4, join as join6 } from "path";
|
|
882
883
|
import { z as z6 } from "zod/mini";
|
|
883
884
|
|
|
885
|
+
// src/utils/type-guards.ts
|
|
886
|
+
function isRecord(value) {
|
|
887
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
888
|
+
}
|
|
889
|
+
|
|
884
890
|
// src/features/commands/rulesync-command.ts
|
|
885
891
|
import { basename as basename3, join as join5 } from "path";
|
|
886
892
|
import { z as z5 } from "zod/mini";
|
|
@@ -973,8 +979,14 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
973
979
|
};
|
|
974
980
|
|
|
975
981
|
// src/features/commands/antigravity-command.ts
|
|
976
|
-
var
|
|
977
|
-
|
|
982
|
+
var AntigravityWorkflowFrontmatterSchema = z6.looseObject({
|
|
983
|
+
trigger: z6.optional(z6.string()),
|
|
984
|
+
turbo: z6.optional(z6.boolean())
|
|
985
|
+
});
|
|
986
|
+
var AntigravityCommandFrontmatterSchema = z6.looseObject({
|
|
987
|
+
description: z6.string(),
|
|
988
|
+
// Support for workflow-specific configuration
|
|
989
|
+
...AntigravityWorkflowFrontmatterSchema.shape
|
|
978
990
|
});
|
|
979
991
|
var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
980
992
|
frontmatter;
|
|
@@ -1007,9 +1019,12 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1007
1019
|
return this.frontmatter;
|
|
1008
1020
|
}
|
|
1009
1021
|
toRulesyncCommand() {
|
|
1022
|
+
const { description, ...restFields } = this.frontmatter;
|
|
1010
1023
|
const rulesyncFrontmatter = {
|
|
1011
1024
|
targets: ["antigravity"],
|
|
1012
|
-
description
|
|
1025
|
+
description,
|
|
1026
|
+
// Preserve extra fields in antigravity section
|
|
1027
|
+
...Object.keys(restFields).length > 0 && { antigravity: restFields }
|
|
1013
1028
|
};
|
|
1014
1029
|
const fileContent = stringifyFrontmatter(this.body, rulesyncFrontmatter);
|
|
1015
1030
|
return new RulesyncCommand({
|
|
@@ -1023,27 +1038,56 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1023
1038
|
validate: true
|
|
1024
1039
|
});
|
|
1025
1040
|
}
|
|
1041
|
+
static extractAntigravityConfig(rulesyncCommand) {
|
|
1042
|
+
const antigravity = rulesyncCommand.getFrontmatter().antigravity;
|
|
1043
|
+
return isRecord(antigravity) ? antigravity : void 0;
|
|
1044
|
+
}
|
|
1026
1045
|
static fromRulesyncCommand({
|
|
1027
1046
|
baseDir = process.cwd(),
|
|
1028
1047
|
rulesyncCommand,
|
|
1029
1048
|
validate = true
|
|
1030
1049
|
}) {
|
|
1031
1050
|
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
1051
|
+
const antigravityConfig = this.extractAntigravityConfig(rulesyncCommand);
|
|
1052
|
+
const trigger = this.resolveTrigger(rulesyncCommand, antigravityConfig);
|
|
1053
|
+
const turbo = typeof antigravityConfig?.turbo === "boolean" ? antigravityConfig.turbo : true;
|
|
1054
|
+
let relativeFilePath = rulesyncCommand.getRelativeFilePath();
|
|
1055
|
+
let body = rulesyncCommand.getBody().replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, "").trim();
|
|
1056
|
+
const sanitizedTrigger = trigger.replace(/[^a-zA-Z0-9-_]/g, "-").replace(/^-+|-+$/g, "");
|
|
1057
|
+
if (!sanitizedTrigger) {
|
|
1058
|
+
throw new Error(`Invalid trigger: sanitization resulted in empty string from "${trigger}"`);
|
|
1059
|
+
}
|
|
1060
|
+
const validFilename = sanitizedTrigger + ".md";
|
|
1061
|
+
relativeFilePath = validFilename;
|
|
1062
|
+
const turboDirective = turbo ? "\n\n// turbo" : "";
|
|
1063
|
+
body = `# Workflow: ${trigger}
|
|
1064
|
+
|
|
1065
|
+
${body}${turboDirective}`;
|
|
1066
|
+
const description = rulesyncFrontmatter.description;
|
|
1032
1067
|
const antigravityFrontmatter = {
|
|
1033
|
-
description
|
|
1068
|
+
description,
|
|
1069
|
+
trigger,
|
|
1070
|
+
turbo
|
|
1034
1071
|
};
|
|
1035
|
-
const body = rulesyncCommand.getBody();
|
|
1036
1072
|
const fileContent = stringifyFrontmatter(body, antigravityFrontmatter);
|
|
1037
1073
|
return new _AntigravityCommand({
|
|
1038
1074
|
baseDir,
|
|
1039
1075
|
frontmatter: antigravityFrontmatter,
|
|
1040
1076
|
body,
|
|
1041
1077
|
relativeDirPath: _AntigravityCommand.getSettablePaths().relativeDirPath,
|
|
1042
|
-
relativeFilePath
|
|
1078
|
+
relativeFilePath,
|
|
1043
1079
|
fileContent,
|
|
1044
1080
|
validate
|
|
1045
1081
|
});
|
|
1046
1082
|
}
|
|
1083
|
+
static resolveTrigger(rulesyncCommand, antigravityConfig) {
|
|
1084
|
+
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
1085
|
+
const antigravityTrigger = antigravityConfig && typeof antigravityConfig.trigger === "string" ? antigravityConfig.trigger : void 0;
|
|
1086
|
+
const rootTrigger = typeof rulesyncFrontmatter.trigger === "string" ? rulesyncFrontmatter.trigger : void 0;
|
|
1087
|
+
const bodyTriggerMatch = rulesyncCommand.getBody().match(/trigger:\s*(\/[\w-]+)/);
|
|
1088
|
+
const filenameTrigger = `/${basename4(rulesyncCommand.getRelativeFilePath(), ".md")}`;
|
|
1089
|
+
return antigravityTrigger || rootTrigger || (bodyTriggerMatch ? bodyTriggerMatch[1] : void 0) || filenameTrigger;
|
|
1090
|
+
}
|
|
1047
1091
|
validate() {
|
|
1048
1092
|
if (!this.frontmatter) {
|
|
1049
1093
|
return { success: true, error: null };
|
|
@@ -1876,8 +1920,89 @@ var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
|
1876
1920
|
}
|
|
1877
1921
|
};
|
|
1878
1922
|
|
|
1879
|
-
// src/features/commands/
|
|
1923
|
+
// src/features/commands/kiro-command.ts
|
|
1880
1924
|
import { basename as basename12, join as join14 } from "path";
|
|
1925
|
+
var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
1926
|
+
static getSettablePaths(_options = {}) {
|
|
1927
|
+
return {
|
|
1928
|
+
relativeDirPath: join14(".kiro", "prompts")
|
|
1929
|
+
};
|
|
1930
|
+
}
|
|
1931
|
+
toRulesyncCommand() {
|
|
1932
|
+
const rulesyncFrontmatter = {
|
|
1933
|
+
targets: ["*"],
|
|
1934
|
+
description: ""
|
|
1935
|
+
};
|
|
1936
|
+
return new RulesyncCommand({
|
|
1937
|
+
baseDir: process.cwd(),
|
|
1938
|
+
frontmatter: rulesyncFrontmatter,
|
|
1939
|
+
body: this.getFileContent(),
|
|
1940
|
+
relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
1941
|
+
relativeFilePath: this.relativeFilePath,
|
|
1942
|
+
fileContent: this.getFileContent(),
|
|
1943
|
+
validate: true
|
|
1944
|
+
});
|
|
1945
|
+
}
|
|
1946
|
+
static fromRulesyncCommand({
|
|
1947
|
+
baseDir = process.cwd(),
|
|
1948
|
+
rulesyncCommand,
|
|
1949
|
+
validate = true
|
|
1950
|
+
}) {
|
|
1951
|
+
const paths = this.getSettablePaths();
|
|
1952
|
+
return new _KiroCommand({
|
|
1953
|
+
baseDir,
|
|
1954
|
+
fileContent: rulesyncCommand.getBody(),
|
|
1955
|
+
relativeDirPath: paths.relativeDirPath,
|
|
1956
|
+
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
1957
|
+
validate
|
|
1958
|
+
});
|
|
1959
|
+
}
|
|
1960
|
+
validate() {
|
|
1961
|
+
return { success: true, error: null };
|
|
1962
|
+
}
|
|
1963
|
+
getBody() {
|
|
1964
|
+
return this.getFileContent();
|
|
1965
|
+
}
|
|
1966
|
+
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
1967
|
+
return this.isTargetedByRulesyncCommandDefault({
|
|
1968
|
+
rulesyncCommand,
|
|
1969
|
+
toolTarget: "kiro"
|
|
1970
|
+
});
|
|
1971
|
+
}
|
|
1972
|
+
static async fromFile({
|
|
1973
|
+
baseDir = process.cwd(),
|
|
1974
|
+
relativeFilePath,
|
|
1975
|
+
validate = true
|
|
1976
|
+
}) {
|
|
1977
|
+
const paths = this.getSettablePaths();
|
|
1978
|
+
const filePath = join14(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1979
|
+
const fileContent = await readFileContent(filePath);
|
|
1980
|
+
const { body: content } = parseFrontmatter(fileContent);
|
|
1981
|
+
return new _KiroCommand({
|
|
1982
|
+
baseDir,
|
|
1983
|
+
relativeDirPath: paths.relativeDirPath,
|
|
1984
|
+
relativeFilePath: basename12(relativeFilePath),
|
|
1985
|
+
fileContent: content.trim(),
|
|
1986
|
+
validate
|
|
1987
|
+
});
|
|
1988
|
+
}
|
|
1989
|
+
static forDeletion({
|
|
1990
|
+
baseDir = process.cwd(),
|
|
1991
|
+
relativeDirPath,
|
|
1992
|
+
relativeFilePath
|
|
1993
|
+
}) {
|
|
1994
|
+
return new _KiroCommand({
|
|
1995
|
+
baseDir,
|
|
1996
|
+
relativeDirPath,
|
|
1997
|
+
relativeFilePath,
|
|
1998
|
+
fileContent: "",
|
|
1999
|
+
validate: false
|
|
2000
|
+
});
|
|
2001
|
+
}
|
|
2002
|
+
};
|
|
2003
|
+
|
|
2004
|
+
// src/features/commands/opencode-command.ts
|
|
2005
|
+
import { basename as basename13, join as join15 } from "path";
|
|
1881
2006
|
import { optional as optional2, z as z10 } from "zod/mini";
|
|
1882
2007
|
var OpenCodeCommandFrontmatterSchema = z10.looseObject({
|
|
1883
2008
|
description: z10.string(),
|
|
@@ -1893,7 +2018,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1893
2018
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1894
2019
|
if (!result.success) {
|
|
1895
2020
|
throw new Error(
|
|
1896
|
-
`Invalid frontmatter in ${
|
|
2021
|
+
`Invalid frontmatter in ${join15(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1897
2022
|
);
|
|
1898
2023
|
}
|
|
1899
2024
|
}
|
|
@@ -1906,7 +2031,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1906
2031
|
}
|
|
1907
2032
|
static getSettablePaths({ global } = {}) {
|
|
1908
2033
|
return {
|
|
1909
|
-
relativeDirPath: global ?
|
|
2034
|
+
relativeDirPath: global ? join15(".config", "opencode", "command") : join15(".opencode", "command")
|
|
1910
2035
|
};
|
|
1911
2036
|
}
|
|
1912
2037
|
getBody() {
|
|
@@ -1967,7 +2092,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1967
2092
|
return {
|
|
1968
2093
|
success: false,
|
|
1969
2094
|
error: new Error(
|
|
1970
|
-
`Invalid frontmatter in ${
|
|
2095
|
+
`Invalid frontmatter in ${join15(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1971
2096
|
)
|
|
1972
2097
|
};
|
|
1973
2098
|
}
|
|
@@ -1978,7 +2103,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1978
2103
|
global = false
|
|
1979
2104
|
}) {
|
|
1980
2105
|
const paths = this.getSettablePaths({ global });
|
|
1981
|
-
const filePath =
|
|
2106
|
+
const filePath = join15(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1982
2107
|
const fileContent = await readFileContent(filePath);
|
|
1983
2108
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1984
2109
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1988,7 +2113,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1988
2113
|
return new _OpenCodeCommand({
|
|
1989
2114
|
baseDir,
|
|
1990
2115
|
relativeDirPath: paths.relativeDirPath,
|
|
1991
|
-
relativeFilePath:
|
|
2116
|
+
relativeFilePath: basename13(relativeFilePath),
|
|
1992
2117
|
frontmatter: result.data,
|
|
1993
2118
|
body: content.trim(),
|
|
1994
2119
|
validate
|
|
@@ -2017,7 +2142,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2017
2142
|
};
|
|
2018
2143
|
|
|
2019
2144
|
// src/features/commands/roo-command.ts
|
|
2020
|
-
import { basename as
|
|
2145
|
+
import { basename as basename14, join as join16 } from "path";
|
|
2021
2146
|
import { optional as optional3, z as z11 } from "zod/mini";
|
|
2022
2147
|
var RooCommandFrontmatterSchema = z11.looseObject({
|
|
2023
2148
|
description: z11.string(),
|
|
@@ -2028,7 +2153,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2028
2153
|
body;
|
|
2029
2154
|
static getSettablePaths() {
|
|
2030
2155
|
return {
|
|
2031
|
-
relativeDirPath:
|
|
2156
|
+
relativeDirPath: join16(".roo", "commands")
|
|
2032
2157
|
};
|
|
2033
2158
|
}
|
|
2034
2159
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -2036,7 +2161,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2036
2161
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2037
2162
|
if (!result.success) {
|
|
2038
2163
|
throw new Error(
|
|
2039
|
-
`Invalid frontmatter in ${
|
|
2164
|
+
`Invalid frontmatter in ${join16(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
2040
2165
|
);
|
|
2041
2166
|
}
|
|
2042
2167
|
}
|
|
@@ -2107,7 +2232,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2107
2232
|
return {
|
|
2108
2233
|
success: false,
|
|
2109
2234
|
error: new Error(
|
|
2110
|
-
`Invalid frontmatter in ${
|
|
2235
|
+
`Invalid frontmatter in ${join16(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
2111
2236
|
)
|
|
2112
2237
|
};
|
|
2113
2238
|
}
|
|
@@ -2123,7 +2248,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2123
2248
|
relativeFilePath,
|
|
2124
2249
|
validate = true
|
|
2125
2250
|
}) {
|
|
2126
|
-
const filePath =
|
|
2251
|
+
const filePath = join16(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
2127
2252
|
const fileContent = await readFileContent(filePath);
|
|
2128
2253
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2129
2254
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2133,7 +2258,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2133
2258
|
return new _RooCommand({
|
|
2134
2259
|
baseDir,
|
|
2135
2260
|
relativeDirPath: _RooCommand.getSettablePaths().relativeDirPath,
|
|
2136
|
-
relativeFilePath:
|
|
2261
|
+
relativeFilePath: basename14(relativeFilePath),
|
|
2137
2262
|
frontmatter: result.data,
|
|
2138
2263
|
body: content.trim(),
|
|
2139
2264
|
fileContent,
|
|
@@ -2169,6 +2294,7 @@ var commandsProcessorToolTargetTuple = [
|
|
|
2169
2294
|
"cursor",
|
|
2170
2295
|
"geminicli",
|
|
2171
2296
|
"kilo",
|
|
2297
|
+
"kiro",
|
|
2172
2298
|
"opencode",
|
|
2173
2299
|
"roo"
|
|
2174
2300
|
];
|
|
@@ -2249,6 +2375,13 @@ var toolCommandFactories = /* @__PURE__ */ new Map([
|
|
|
2249
2375
|
meta: { extension: "md", supportsProject: true, supportsGlobal: true, isSimulated: false }
|
|
2250
2376
|
}
|
|
2251
2377
|
],
|
|
2378
|
+
[
|
|
2379
|
+
"kiro",
|
|
2380
|
+
{
|
|
2381
|
+
class: KiroCommand,
|
|
2382
|
+
meta: { extension: "md", supportsProject: true, supportsGlobal: false, isSimulated: false }
|
|
2383
|
+
}
|
|
2384
|
+
],
|
|
2252
2385
|
[
|
|
2253
2386
|
"opencode",
|
|
2254
2387
|
{
|
|
@@ -2339,11 +2472,11 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2339
2472
|
*/
|
|
2340
2473
|
async loadRulesyncFiles() {
|
|
2341
2474
|
const rulesyncCommandPaths = await findFilesByGlobs(
|
|
2342
|
-
|
|
2475
|
+
join17(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
|
|
2343
2476
|
);
|
|
2344
2477
|
const rulesyncCommands = await Promise.all(
|
|
2345
2478
|
rulesyncCommandPaths.map(
|
|
2346
|
-
(path3) => RulesyncCommand.fromFile({ relativeFilePath:
|
|
2479
|
+
(path3) => RulesyncCommand.fromFile({ relativeFilePath: basename15(path3) })
|
|
2347
2480
|
)
|
|
2348
2481
|
);
|
|
2349
2482
|
logger.info(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
@@ -2359,14 +2492,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2359
2492
|
const factory = this.getFactory(this.toolTarget);
|
|
2360
2493
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
2361
2494
|
const commandFilePaths = await findFilesByGlobs(
|
|
2362
|
-
|
|
2495
|
+
join17(this.baseDir, paths.relativeDirPath, `*.${factory.meta.extension}`)
|
|
2363
2496
|
);
|
|
2364
2497
|
if (forDeletion) {
|
|
2365
2498
|
const toolCommands2 = commandFilePaths.map(
|
|
2366
2499
|
(path3) => factory.class.forDeletion({
|
|
2367
2500
|
baseDir: this.baseDir,
|
|
2368
2501
|
relativeDirPath: paths.relativeDirPath,
|
|
2369
|
-
relativeFilePath:
|
|
2502
|
+
relativeFilePath: basename15(path3),
|
|
2370
2503
|
global: this.global
|
|
2371
2504
|
})
|
|
2372
2505
|
).filter((cmd) => cmd.isDeletable());
|
|
@@ -2377,7 +2510,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2377
2510
|
commandFilePaths.map(
|
|
2378
2511
|
(path3) => factory.class.fromFile({
|
|
2379
2512
|
baseDir: this.baseDir,
|
|
2380
|
-
relativeFilePath:
|
|
2513
|
+
relativeFilePath: basename15(path3),
|
|
2381
2514
|
global: this.global
|
|
2382
2515
|
})
|
|
2383
2516
|
)
|
|
@@ -2412,14 +2545,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2412
2545
|
import { z as z13 } from "zod/mini";
|
|
2413
2546
|
|
|
2414
2547
|
// src/features/ignore/augmentcode-ignore.ts
|
|
2415
|
-
import { join as
|
|
2548
|
+
import { join as join19 } from "path";
|
|
2416
2549
|
|
|
2417
2550
|
// src/types/tool-file.ts
|
|
2418
2551
|
var ToolFile = class extends AiFile {
|
|
2419
2552
|
};
|
|
2420
2553
|
|
|
2421
2554
|
// src/features/ignore/rulesync-ignore.ts
|
|
2422
|
-
import { join as
|
|
2555
|
+
import { join as join18 } from "path";
|
|
2423
2556
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
2424
2557
|
validate() {
|
|
2425
2558
|
return { success: true, error: null };
|
|
@@ -2439,12 +2572,12 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
2439
2572
|
static async fromFile() {
|
|
2440
2573
|
const baseDir = process.cwd();
|
|
2441
2574
|
const paths = this.getSettablePaths();
|
|
2442
|
-
const recommendedPath =
|
|
2575
|
+
const recommendedPath = join18(
|
|
2443
2576
|
baseDir,
|
|
2444
2577
|
paths.recommended.relativeDirPath,
|
|
2445
2578
|
paths.recommended.relativeFilePath
|
|
2446
2579
|
);
|
|
2447
|
-
const legacyPath =
|
|
2580
|
+
const legacyPath = join18(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
2448
2581
|
if (await fileExists(recommendedPath)) {
|
|
2449
2582
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
2450
2583
|
return new _RulesyncIgnore({
|
|
@@ -2560,7 +2693,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2560
2693
|
validate = true
|
|
2561
2694
|
}) {
|
|
2562
2695
|
const fileContent = await readFileContent(
|
|
2563
|
-
|
|
2696
|
+
join19(
|
|
2564
2697
|
baseDir,
|
|
2565
2698
|
this.getSettablePaths().relativeDirPath,
|
|
2566
2699
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2591,7 +2724,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2591
2724
|
|
|
2592
2725
|
// src/features/ignore/claudecode-ignore.ts
|
|
2593
2726
|
import { uniq } from "es-toolkit";
|
|
2594
|
-
import { join as
|
|
2727
|
+
import { join as join20 } from "path";
|
|
2595
2728
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
2596
2729
|
constructor(params) {
|
|
2597
2730
|
super(params);
|
|
@@ -2633,7 +2766,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2633
2766
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
2634
2767
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
2635
2768
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
2636
|
-
const filePath =
|
|
2769
|
+
const filePath = join20(
|
|
2637
2770
|
baseDir,
|
|
2638
2771
|
this.getSettablePaths().relativeDirPath,
|
|
2639
2772
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2669,7 +2802,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2669
2802
|
validate = true
|
|
2670
2803
|
}) {
|
|
2671
2804
|
const fileContent = await readFileContent(
|
|
2672
|
-
|
|
2805
|
+
join20(
|
|
2673
2806
|
baseDir,
|
|
2674
2807
|
this.getSettablePaths().relativeDirPath,
|
|
2675
2808
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2699,7 +2832,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2699
2832
|
};
|
|
2700
2833
|
|
|
2701
2834
|
// src/features/ignore/cline-ignore.ts
|
|
2702
|
-
import { join as
|
|
2835
|
+
import { join as join21 } from "path";
|
|
2703
2836
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
2704
2837
|
static getSettablePaths() {
|
|
2705
2838
|
return {
|
|
@@ -2736,7 +2869,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2736
2869
|
validate = true
|
|
2737
2870
|
}) {
|
|
2738
2871
|
const fileContent = await readFileContent(
|
|
2739
|
-
|
|
2872
|
+
join21(
|
|
2740
2873
|
baseDir,
|
|
2741
2874
|
this.getSettablePaths().relativeDirPath,
|
|
2742
2875
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2766,7 +2899,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2766
2899
|
};
|
|
2767
2900
|
|
|
2768
2901
|
// src/features/ignore/cursor-ignore.ts
|
|
2769
|
-
import { join as
|
|
2902
|
+
import { join as join22 } from "path";
|
|
2770
2903
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
2771
2904
|
static getSettablePaths() {
|
|
2772
2905
|
return {
|
|
@@ -2799,7 +2932,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2799
2932
|
validate = true
|
|
2800
2933
|
}) {
|
|
2801
2934
|
const fileContent = await readFileContent(
|
|
2802
|
-
|
|
2935
|
+
join22(
|
|
2803
2936
|
baseDir,
|
|
2804
2937
|
this.getSettablePaths().relativeDirPath,
|
|
2805
2938
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2829,7 +2962,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2829
2962
|
};
|
|
2830
2963
|
|
|
2831
2964
|
// src/features/ignore/geminicli-ignore.ts
|
|
2832
|
-
import { join as
|
|
2965
|
+
import { join as join23 } from "path";
|
|
2833
2966
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
2834
2967
|
static getSettablePaths() {
|
|
2835
2968
|
return {
|
|
@@ -2856,7 +2989,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2856
2989
|
validate = true
|
|
2857
2990
|
}) {
|
|
2858
2991
|
const fileContent = await readFileContent(
|
|
2859
|
-
|
|
2992
|
+
join23(
|
|
2860
2993
|
baseDir,
|
|
2861
2994
|
this.getSettablePaths().relativeDirPath,
|
|
2862
2995
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2886,7 +3019,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2886
3019
|
};
|
|
2887
3020
|
|
|
2888
3021
|
// src/features/ignore/junie-ignore.ts
|
|
2889
|
-
import { join as
|
|
3022
|
+
import { join as join24 } from "path";
|
|
2890
3023
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
2891
3024
|
static getSettablePaths() {
|
|
2892
3025
|
return {
|
|
@@ -2913,7 +3046,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2913
3046
|
validate = true
|
|
2914
3047
|
}) {
|
|
2915
3048
|
const fileContent = await readFileContent(
|
|
2916
|
-
|
|
3049
|
+
join24(
|
|
2917
3050
|
baseDir,
|
|
2918
3051
|
this.getSettablePaths().relativeDirPath,
|
|
2919
3052
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2943,7 +3076,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2943
3076
|
};
|
|
2944
3077
|
|
|
2945
3078
|
// src/features/ignore/kilo-ignore.ts
|
|
2946
|
-
import { join as
|
|
3079
|
+
import { join as join25 } from "path";
|
|
2947
3080
|
var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
2948
3081
|
static getSettablePaths() {
|
|
2949
3082
|
return {
|
|
@@ -2980,7 +3113,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
2980
3113
|
validate = true
|
|
2981
3114
|
}) {
|
|
2982
3115
|
const fileContent = await readFileContent(
|
|
2983
|
-
|
|
3116
|
+
join25(
|
|
2984
3117
|
baseDir,
|
|
2985
3118
|
this.getSettablePaths().relativeDirPath,
|
|
2986
3119
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3010,7 +3143,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
3010
3143
|
};
|
|
3011
3144
|
|
|
3012
3145
|
// src/features/ignore/kiro-ignore.ts
|
|
3013
|
-
import { join as
|
|
3146
|
+
import { join as join26 } from "path";
|
|
3014
3147
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
3015
3148
|
static getSettablePaths() {
|
|
3016
3149
|
return {
|
|
@@ -3037,7 +3170,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
3037
3170
|
validate = true
|
|
3038
3171
|
}) {
|
|
3039
3172
|
const fileContent = await readFileContent(
|
|
3040
|
-
|
|
3173
|
+
join26(
|
|
3041
3174
|
baseDir,
|
|
3042
3175
|
this.getSettablePaths().relativeDirPath,
|
|
3043
3176
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3067,7 +3200,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
3067
3200
|
};
|
|
3068
3201
|
|
|
3069
3202
|
// src/features/ignore/qwencode-ignore.ts
|
|
3070
|
-
import { join as
|
|
3203
|
+
import { join as join27 } from "path";
|
|
3071
3204
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
3072
3205
|
static getSettablePaths() {
|
|
3073
3206
|
return {
|
|
@@ -3094,7 +3227,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
3094
3227
|
validate = true
|
|
3095
3228
|
}) {
|
|
3096
3229
|
const fileContent = await readFileContent(
|
|
3097
|
-
|
|
3230
|
+
join27(
|
|
3098
3231
|
baseDir,
|
|
3099
3232
|
this.getSettablePaths().relativeDirPath,
|
|
3100
3233
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3124,7 +3257,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
3124
3257
|
};
|
|
3125
3258
|
|
|
3126
3259
|
// src/features/ignore/roo-ignore.ts
|
|
3127
|
-
import { join as
|
|
3260
|
+
import { join as join28 } from "path";
|
|
3128
3261
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
3129
3262
|
static getSettablePaths() {
|
|
3130
3263
|
return {
|
|
@@ -3151,7 +3284,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
3151
3284
|
validate = true
|
|
3152
3285
|
}) {
|
|
3153
3286
|
const fileContent = await readFileContent(
|
|
3154
|
-
|
|
3287
|
+
join28(
|
|
3155
3288
|
baseDir,
|
|
3156
3289
|
this.getSettablePaths().relativeDirPath,
|
|
3157
3290
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3181,7 +3314,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
3181
3314
|
};
|
|
3182
3315
|
|
|
3183
3316
|
// src/features/ignore/windsurf-ignore.ts
|
|
3184
|
-
import { join as
|
|
3317
|
+
import { join as join29 } from "path";
|
|
3185
3318
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
3186
3319
|
static getSettablePaths() {
|
|
3187
3320
|
return {
|
|
@@ -3208,7 +3341,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3208
3341
|
validate = true
|
|
3209
3342
|
}) {
|
|
3210
3343
|
const fileContent = await readFileContent(
|
|
3211
|
-
|
|
3344
|
+
join29(
|
|
3212
3345
|
baseDir,
|
|
3213
3346
|
this.getSettablePaths().relativeDirPath,
|
|
3214
3347
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3239,7 +3372,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3239
3372
|
|
|
3240
3373
|
// src/features/ignore/zed-ignore.ts
|
|
3241
3374
|
import { uniq as uniq2 } from "es-toolkit";
|
|
3242
|
-
import { join as
|
|
3375
|
+
import { join as join30 } from "path";
|
|
3243
3376
|
var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
3244
3377
|
constructor(params) {
|
|
3245
3378
|
super(params);
|
|
@@ -3275,7 +3408,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
3275
3408
|
}) {
|
|
3276
3409
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
3277
3410
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
3278
|
-
const filePath =
|
|
3411
|
+
const filePath = join30(
|
|
3279
3412
|
baseDir,
|
|
3280
3413
|
this.getSettablePaths().relativeDirPath,
|
|
3281
3414
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3302,7 +3435,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
3302
3435
|
validate = true
|
|
3303
3436
|
}) {
|
|
3304
3437
|
const fileContent = await readFileContent(
|
|
3305
|
-
|
|
3438
|
+
join30(
|
|
3306
3439
|
baseDir,
|
|
3307
3440
|
this.getSettablePaths().relativeDirPath,
|
|
3308
3441
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3484,10 +3617,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
3484
3617
|
import { z as z18 } from "zod/mini";
|
|
3485
3618
|
|
|
3486
3619
|
// src/features/mcp/claudecode-mcp.ts
|
|
3487
|
-
import { join as
|
|
3620
|
+
import { join as join33 } from "path";
|
|
3488
3621
|
|
|
3489
3622
|
// src/features/mcp/modular-mcp.ts
|
|
3490
|
-
import { join as
|
|
3623
|
+
import { join as join31 } from "path";
|
|
3491
3624
|
import { z as z15 } from "zod/mini";
|
|
3492
3625
|
|
|
3493
3626
|
// src/types/mcp.ts
|
|
@@ -3575,7 +3708,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3575
3708
|
args: [
|
|
3576
3709
|
"-y",
|
|
3577
3710
|
"@kimuson/modular-mcp",
|
|
3578
|
-
|
|
3711
|
+
join31(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3579
3712
|
],
|
|
3580
3713
|
env: {}
|
|
3581
3714
|
}
|
|
@@ -3613,7 +3746,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3613
3746
|
|
|
3614
3747
|
// src/features/mcp/rulesync-mcp.ts
|
|
3615
3748
|
import { omit } from "es-toolkit/object";
|
|
3616
|
-
import { join as
|
|
3749
|
+
import { join as join32 } from "path";
|
|
3617
3750
|
import { z as z16 } from "zod/mini";
|
|
3618
3751
|
var RulesyncMcpServerSchema = z16.union([
|
|
3619
3752
|
z16.extend(McpServerSchema, {
|
|
@@ -3669,12 +3802,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
3669
3802
|
}) {
|
|
3670
3803
|
const baseDir = process.cwd();
|
|
3671
3804
|
const paths = this.getSettablePaths();
|
|
3672
|
-
const recommendedPath =
|
|
3805
|
+
const recommendedPath = join32(
|
|
3673
3806
|
baseDir,
|
|
3674
3807
|
paths.recommended.relativeDirPath,
|
|
3675
3808
|
paths.recommended.relativeFilePath
|
|
3676
3809
|
);
|
|
3677
|
-
const legacyPath =
|
|
3810
|
+
const legacyPath = join32(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
3678
3811
|
if (await fileExists(recommendedPath)) {
|
|
3679
3812
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
3680
3813
|
return new _RulesyncMcp({
|
|
@@ -3818,7 +3951,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3818
3951
|
}) {
|
|
3819
3952
|
const paths = this.getSettablePaths({ global });
|
|
3820
3953
|
const fileContent = await readOrInitializeFileContent(
|
|
3821
|
-
|
|
3954
|
+
join33(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3822
3955
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3823
3956
|
);
|
|
3824
3957
|
const json = JSON.parse(fileContent);
|
|
@@ -3840,7 +3973,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3840
3973
|
}) {
|
|
3841
3974
|
const paths = this.getSettablePaths({ global });
|
|
3842
3975
|
const fileContent = await readOrInitializeFileContent(
|
|
3843
|
-
|
|
3976
|
+
join33(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3844
3977
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3845
3978
|
);
|
|
3846
3979
|
const json = JSON.parse(fileContent);
|
|
@@ -3888,7 +4021,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3888
4021
|
};
|
|
3889
4022
|
|
|
3890
4023
|
// src/features/mcp/cline-mcp.ts
|
|
3891
|
-
import { join as
|
|
4024
|
+
import { join as join34 } from "path";
|
|
3892
4025
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
3893
4026
|
json;
|
|
3894
4027
|
constructor(params) {
|
|
@@ -3909,7 +4042,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3909
4042
|
validate = true
|
|
3910
4043
|
}) {
|
|
3911
4044
|
const fileContent = await readFileContent(
|
|
3912
|
-
|
|
4045
|
+
join34(
|
|
3913
4046
|
baseDir,
|
|
3914
4047
|
this.getSettablePaths().relativeDirPath,
|
|
3915
4048
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3958,7 +4091,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3958
4091
|
};
|
|
3959
4092
|
|
|
3960
4093
|
// src/features/mcp/codexcli-mcp.ts
|
|
3961
|
-
import { join as
|
|
4094
|
+
import { join as join35 } from "path";
|
|
3962
4095
|
import * as smolToml from "smol-toml";
|
|
3963
4096
|
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
3964
4097
|
toml;
|
|
@@ -3994,7 +4127,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3994
4127
|
}) {
|
|
3995
4128
|
const paths = this.getSettablePaths({ global });
|
|
3996
4129
|
const fileContent = await readFileContent(
|
|
3997
|
-
|
|
4130
|
+
join35(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3998
4131
|
);
|
|
3999
4132
|
return new _CodexcliMcp({
|
|
4000
4133
|
baseDir,
|
|
@@ -4011,7 +4144,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4011
4144
|
global = false
|
|
4012
4145
|
}) {
|
|
4013
4146
|
const paths = this.getSettablePaths({ global });
|
|
4014
|
-
const configTomlFilePath =
|
|
4147
|
+
const configTomlFilePath = join35(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
4015
4148
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
4016
4149
|
configTomlFilePath,
|
|
4017
4150
|
smolToml.stringify({})
|
|
@@ -4065,7 +4198,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4065
4198
|
};
|
|
4066
4199
|
|
|
4067
4200
|
// src/features/mcp/copilot-mcp.ts
|
|
4068
|
-
import { join as
|
|
4201
|
+
import { join as join36 } from "path";
|
|
4069
4202
|
function convertToCopilotFormat(mcpServers) {
|
|
4070
4203
|
return { servers: mcpServers };
|
|
4071
4204
|
}
|
|
@@ -4092,7 +4225,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4092
4225
|
validate = true
|
|
4093
4226
|
}) {
|
|
4094
4227
|
const fileContent = await readFileContent(
|
|
4095
|
-
|
|
4228
|
+
join36(
|
|
4096
4229
|
baseDir,
|
|
4097
4230
|
this.getSettablePaths().relativeDirPath,
|
|
4098
4231
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4145,7 +4278,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4145
4278
|
};
|
|
4146
4279
|
|
|
4147
4280
|
// src/features/mcp/cursor-mcp.ts
|
|
4148
|
-
import { join as
|
|
4281
|
+
import { join as join37 } from "path";
|
|
4149
4282
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
4150
4283
|
json;
|
|
4151
4284
|
constructor(params) {
|
|
@@ -4166,7 +4299,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4166
4299
|
validate = true
|
|
4167
4300
|
}) {
|
|
4168
4301
|
const fileContent = await readFileContent(
|
|
4169
|
-
|
|
4302
|
+
join37(
|
|
4170
4303
|
baseDir,
|
|
4171
4304
|
this.getSettablePaths().relativeDirPath,
|
|
4172
4305
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4226,7 +4359,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4226
4359
|
};
|
|
4227
4360
|
|
|
4228
4361
|
// src/features/mcp/geminicli-mcp.ts
|
|
4229
|
-
import { join as
|
|
4362
|
+
import { join as join38 } from "path";
|
|
4230
4363
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
4231
4364
|
json;
|
|
4232
4365
|
constructor(params) {
|
|
@@ -4255,7 +4388,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4255
4388
|
}) {
|
|
4256
4389
|
const paths = this.getSettablePaths({ global });
|
|
4257
4390
|
const fileContent = await readOrInitializeFileContent(
|
|
4258
|
-
|
|
4391
|
+
join38(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4259
4392
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4260
4393
|
);
|
|
4261
4394
|
const json = JSON.parse(fileContent);
|
|
@@ -4276,7 +4409,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4276
4409
|
}) {
|
|
4277
4410
|
const paths = this.getSettablePaths({ global });
|
|
4278
4411
|
const fileContent = await readOrInitializeFileContent(
|
|
4279
|
-
|
|
4412
|
+
join38(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4280
4413
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4281
4414
|
);
|
|
4282
4415
|
const json = JSON.parse(fileContent);
|
|
@@ -4313,7 +4446,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4313
4446
|
};
|
|
4314
4447
|
|
|
4315
4448
|
// src/features/mcp/junie-mcp.ts
|
|
4316
|
-
import { join as
|
|
4449
|
+
import { join as join39 } from "path";
|
|
4317
4450
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
4318
4451
|
json;
|
|
4319
4452
|
constructor(params) {
|
|
@@ -4325,7 +4458,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4325
4458
|
}
|
|
4326
4459
|
static getSettablePaths() {
|
|
4327
4460
|
return {
|
|
4328
|
-
relativeDirPath:
|
|
4461
|
+
relativeDirPath: join39(".junie", "mcp"),
|
|
4329
4462
|
relativeFilePath: "mcp.json"
|
|
4330
4463
|
};
|
|
4331
4464
|
}
|
|
@@ -4334,7 +4467,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4334
4467
|
validate = true
|
|
4335
4468
|
}) {
|
|
4336
4469
|
const fileContent = await readFileContent(
|
|
4337
|
-
|
|
4470
|
+
join39(
|
|
4338
4471
|
baseDir,
|
|
4339
4472
|
this.getSettablePaths().relativeDirPath,
|
|
4340
4473
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4383,7 +4516,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4383
4516
|
};
|
|
4384
4517
|
|
|
4385
4518
|
// src/features/mcp/kilo-mcp.ts
|
|
4386
|
-
import { join as
|
|
4519
|
+
import { join as join40 } from "path";
|
|
4387
4520
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
4388
4521
|
json;
|
|
4389
4522
|
constructor(params) {
|
|
@@ -4405,7 +4538,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4405
4538
|
}) {
|
|
4406
4539
|
const paths = this.getSettablePaths();
|
|
4407
4540
|
const fileContent = await readOrInitializeFileContent(
|
|
4408
|
-
|
|
4541
|
+
join40(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4409
4542
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4410
4543
|
);
|
|
4411
4544
|
return new _KiloMcp({
|
|
@@ -4459,7 +4592,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4459
4592
|
};
|
|
4460
4593
|
|
|
4461
4594
|
// src/features/mcp/kiro-mcp.ts
|
|
4462
|
-
import { join as
|
|
4595
|
+
import { join as join41 } from "path";
|
|
4463
4596
|
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
4464
4597
|
json;
|
|
4465
4598
|
constructor(params) {
|
|
@@ -4471,7 +4604,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4471
4604
|
}
|
|
4472
4605
|
static getSettablePaths() {
|
|
4473
4606
|
return {
|
|
4474
|
-
relativeDirPath:
|
|
4607
|
+
relativeDirPath: join41(".kiro", "settings"),
|
|
4475
4608
|
relativeFilePath: "mcp.json"
|
|
4476
4609
|
};
|
|
4477
4610
|
}
|
|
@@ -4481,7 +4614,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4481
4614
|
}) {
|
|
4482
4615
|
const paths = this.getSettablePaths();
|
|
4483
4616
|
const fileContent = await readOrInitializeFileContent(
|
|
4484
|
-
|
|
4617
|
+
join41(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4485
4618
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4486
4619
|
);
|
|
4487
4620
|
return new _KiroMcp({
|
|
@@ -4535,7 +4668,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4535
4668
|
};
|
|
4536
4669
|
|
|
4537
4670
|
// src/features/mcp/opencode-mcp.ts
|
|
4538
|
-
import { join as
|
|
4671
|
+
import { join as join42 } from "path";
|
|
4539
4672
|
import { z as z17 } from "zod/mini";
|
|
4540
4673
|
var OpencodeMcpLocalServerSchema = z17.object({
|
|
4541
4674
|
type: z17.literal("local"),
|
|
@@ -4659,7 +4792,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4659
4792
|
}) {
|
|
4660
4793
|
const paths = this.getSettablePaths({ global });
|
|
4661
4794
|
const fileContent = await readOrInitializeFileContent(
|
|
4662
|
-
|
|
4795
|
+
join42(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4663
4796
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4664
4797
|
);
|
|
4665
4798
|
const json = JSON.parse(fileContent);
|
|
@@ -4680,7 +4813,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4680
4813
|
}) {
|
|
4681
4814
|
const paths = this.getSettablePaths({ global });
|
|
4682
4815
|
const fileContent = await readOrInitializeFileContent(
|
|
4683
|
-
|
|
4816
|
+
join42(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4684
4817
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4685
4818
|
);
|
|
4686
4819
|
const json = JSON.parse(fileContent);
|
|
@@ -4724,7 +4857,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4724
4857
|
};
|
|
4725
4858
|
|
|
4726
4859
|
// src/features/mcp/roo-mcp.ts
|
|
4727
|
-
import { join as
|
|
4860
|
+
import { join as join43 } from "path";
|
|
4728
4861
|
function isRooMcpServers(value) {
|
|
4729
4862
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
4730
4863
|
}
|
|
@@ -4776,7 +4909,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4776
4909
|
validate = true
|
|
4777
4910
|
}) {
|
|
4778
4911
|
const fileContent = await readFileContent(
|
|
4779
|
-
|
|
4912
|
+
join43(
|
|
4780
4913
|
baseDir,
|
|
4781
4914
|
this.getSettablePaths().relativeDirPath,
|
|
4782
4915
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5091,24 +5224,24 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
5091
5224
|
|
|
5092
5225
|
// src/features/rules/rules-processor.ts
|
|
5093
5226
|
import { encode } from "@toon-format/toon";
|
|
5094
|
-
import { basename as
|
|
5227
|
+
import { basename as basename24, join as join93 } from "path";
|
|
5095
5228
|
import { z as z42 } from "zod/mini";
|
|
5096
5229
|
|
|
5097
5230
|
// src/constants/general.ts
|
|
5098
5231
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
5099
5232
|
|
|
5100
5233
|
// src/features/skills/agentsmd-skill.ts
|
|
5101
|
-
import { join as
|
|
5234
|
+
import { join as join47 } from "path";
|
|
5102
5235
|
|
|
5103
5236
|
// src/features/skills/simulated-skill.ts
|
|
5104
|
-
import { join as
|
|
5237
|
+
import { join as join46 } from "path";
|
|
5105
5238
|
import { z as z19 } from "zod/mini";
|
|
5106
5239
|
|
|
5107
5240
|
// src/features/skills/tool-skill.ts
|
|
5108
|
-
import { join as
|
|
5241
|
+
import { join as join45 } from "path";
|
|
5109
5242
|
|
|
5110
5243
|
// src/types/ai-dir.ts
|
|
5111
|
-
import path2, { basename as
|
|
5244
|
+
import path2, { basename as basename16, join as join44, relative as relative3, resolve as resolve4 } from "path";
|
|
5112
5245
|
var AiDir = class {
|
|
5113
5246
|
/**
|
|
5114
5247
|
* @example "."
|
|
@@ -5202,10 +5335,10 @@ var AiDir = class {
|
|
|
5202
5335
|
* @returns Array of files with their relative paths and buffers
|
|
5203
5336
|
*/
|
|
5204
5337
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
5205
|
-
const dirPath =
|
|
5206
|
-
const glob =
|
|
5338
|
+
const dirPath = join44(baseDir, relativeDirPath, dirName);
|
|
5339
|
+
const glob = join44(dirPath, "**", "*");
|
|
5207
5340
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
5208
|
-
const filteredPaths = filePaths.filter((filePath) =>
|
|
5341
|
+
const filteredPaths = filePaths.filter((filePath) => basename16(filePath) !== excludeFileName);
|
|
5209
5342
|
const files = await Promise.all(
|
|
5210
5343
|
filteredPaths.map(async (filePath) => {
|
|
5211
5344
|
const fileBuffer = await readFileBuffer(filePath);
|
|
@@ -5301,8 +5434,8 @@ var ToolSkill = class extends AiDir {
|
|
|
5301
5434
|
}) {
|
|
5302
5435
|
const settablePaths = getSettablePaths({ global });
|
|
5303
5436
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5304
|
-
const skillDirPath =
|
|
5305
|
-
const skillFilePath =
|
|
5437
|
+
const skillDirPath = join45(baseDir, actualRelativeDirPath, dirName);
|
|
5438
|
+
const skillFilePath = join45(skillDirPath, SKILL_FILE_NAME);
|
|
5306
5439
|
if (!await fileExists(skillFilePath)) {
|
|
5307
5440
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5308
5441
|
}
|
|
@@ -5360,7 +5493,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5360
5493
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
5361
5494
|
if (!result.success) {
|
|
5362
5495
|
throw new Error(
|
|
5363
|
-
`Invalid frontmatter in ${
|
|
5496
|
+
`Invalid frontmatter in ${join46(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
5364
5497
|
);
|
|
5365
5498
|
}
|
|
5366
5499
|
}
|
|
@@ -5418,8 +5551,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5418
5551
|
}) {
|
|
5419
5552
|
const settablePaths = this.getSettablePaths();
|
|
5420
5553
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5421
|
-
const skillDirPath =
|
|
5422
|
-
const skillFilePath =
|
|
5554
|
+
const skillDirPath = join46(baseDir, actualRelativeDirPath, dirName);
|
|
5555
|
+
const skillFilePath = join46(skillDirPath, SKILL_FILE_NAME);
|
|
5423
5556
|
if (!await fileExists(skillFilePath)) {
|
|
5424
5557
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5425
5558
|
}
|
|
@@ -5496,7 +5629,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5496
5629
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
5497
5630
|
}
|
|
5498
5631
|
return {
|
|
5499
|
-
relativeDirPath:
|
|
5632
|
+
relativeDirPath: join47(".agents", "skills")
|
|
5500
5633
|
};
|
|
5501
5634
|
}
|
|
5502
5635
|
static async fromDir(params) {
|
|
@@ -5523,14 +5656,14 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5523
5656
|
};
|
|
5524
5657
|
|
|
5525
5658
|
// src/features/skills/geminicli-skill.ts
|
|
5526
|
-
import { join as
|
|
5659
|
+
import { join as join48 } from "path";
|
|
5527
5660
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5528
5661
|
static getSettablePaths(options) {
|
|
5529
5662
|
if (options?.global) {
|
|
5530
5663
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5531
5664
|
}
|
|
5532
5665
|
return {
|
|
5533
|
-
relativeDirPath:
|
|
5666
|
+
relativeDirPath: join48(".gemini", "skills")
|
|
5534
5667
|
};
|
|
5535
5668
|
}
|
|
5536
5669
|
static async fromDir(params) {
|
|
@@ -5557,11 +5690,11 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
|
5557
5690
|
};
|
|
5558
5691
|
|
|
5559
5692
|
// src/features/skills/skills-processor.ts
|
|
5560
|
-
import { basename as
|
|
5693
|
+
import { basename as basename17, join as join59 } from "path";
|
|
5561
5694
|
import { z as z29 } from "zod/mini";
|
|
5562
5695
|
|
|
5563
5696
|
// src/types/dir-feature-processor.ts
|
|
5564
|
-
import { join as
|
|
5697
|
+
import { join as join49 } from "path";
|
|
5565
5698
|
var DirFeatureProcessor = class {
|
|
5566
5699
|
baseDir;
|
|
5567
5700
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -5583,14 +5716,14 @@ var DirFeatureProcessor = class {
|
|
|
5583
5716
|
await ensureDir(dirPath);
|
|
5584
5717
|
const mainFile = aiDir.getMainFile();
|
|
5585
5718
|
if (mainFile) {
|
|
5586
|
-
const mainFilePath =
|
|
5719
|
+
const mainFilePath = join49(dirPath, mainFile.name);
|
|
5587
5720
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5588
5721
|
const contentWithNewline = addTrailingNewline(content);
|
|
5589
5722
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5590
5723
|
}
|
|
5591
5724
|
const otherFiles = aiDir.getOtherFiles();
|
|
5592
5725
|
for (const file of otherFiles) {
|
|
5593
|
-
const filePath =
|
|
5726
|
+
const filePath = join49(dirPath, file.relativeFilePathToDirPath);
|
|
5594
5727
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5595
5728
|
await writeFileContent(filePath, contentWithNewline);
|
|
5596
5729
|
}
|
|
@@ -5605,11 +5738,11 @@ var DirFeatureProcessor = class {
|
|
|
5605
5738
|
};
|
|
5606
5739
|
|
|
5607
5740
|
// src/features/skills/antigravity-skill.ts
|
|
5608
|
-
import { join as
|
|
5741
|
+
import { join as join51 } from "path";
|
|
5609
5742
|
import { z as z21 } from "zod/mini";
|
|
5610
5743
|
|
|
5611
5744
|
// src/features/skills/rulesync-skill.ts
|
|
5612
|
-
import { join as
|
|
5745
|
+
import { join as join50 } from "path";
|
|
5613
5746
|
import { z as z20 } from "zod/mini";
|
|
5614
5747
|
var RulesyncSkillFrontmatterSchemaInternal = z20.looseObject({
|
|
5615
5748
|
name: z20.string(),
|
|
@@ -5701,8 +5834,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5701
5834
|
dirName,
|
|
5702
5835
|
global = false
|
|
5703
5836
|
}) {
|
|
5704
|
-
const skillDirPath =
|
|
5705
|
-
const skillFilePath =
|
|
5837
|
+
const skillDirPath = join50(baseDir, relativeDirPath, dirName);
|
|
5838
|
+
const skillFilePath = join50(skillDirPath, SKILL_FILE_NAME);
|
|
5706
5839
|
if (!await fileExists(skillFilePath)) {
|
|
5707
5840
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5708
5841
|
}
|
|
@@ -5739,7 +5872,7 @@ var AntigravitySkillFrontmatterSchema = z21.looseObject({
|
|
|
5739
5872
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
5740
5873
|
constructor({
|
|
5741
5874
|
baseDir = process.cwd(),
|
|
5742
|
-
relativeDirPath =
|
|
5875
|
+
relativeDirPath = join51(".agent", "skills"),
|
|
5743
5876
|
dirName,
|
|
5744
5877
|
frontmatter,
|
|
5745
5878
|
body,
|
|
@@ -5771,11 +5904,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
5771
5904
|
} = {}) {
|
|
5772
5905
|
if (global) {
|
|
5773
5906
|
return {
|
|
5774
|
-
relativeDirPath:
|
|
5907
|
+
relativeDirPath: join51(".gemini", "antigravity", "skills")
|
|
5775
5908
|
};
|
|
5776
5909
|
}
|
|
5777
5910
|
return {
|
|
5778
|
-
relativeDirPath:
|
|
5911
|
+
relativeDirPath: join51(".agent", "skills")
|
|
5779
5912
|
};
|
|
5780
5913
|
}
|
|
5781
5914
|
getFrontmatter() {
|
|
@@ -5857,9 +5990,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
5857
5990
|
});
|
|
5858
5991
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5859
5992
|
if (!result.success) {
|
|
5860
|
-
const skillDirPath =
|
|
5993
|
+
const skillDirPath = join51(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5861
5994
|
throw new Error(
|
|
5862
|
-
`Invalid frontmatter in ${
|
|
5995
|
+
`Invalid frontmatter in ${join51(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5863
5996
|
);
|
|
5864
5997
|
}
|
|
5865
5998
|
return new _AntigravitySkill({
|
|
@@ -5893,7 +6026,7 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
5893
6026
|
};
|
|
5894
6027
|
|
|
5895
6028
|
// src/features/skills/claudecode-skill.ts
|
|
5896
|
-
import { join as
|
|
6029
|
+
import { join as join52 } from "path";
|
|
5897
6030
|
import { z as z22 } from "zod/mini";
|
|
5898
6031
|
var ClaudecodeSkillFrontmatterSchema = z22.looseObject({
|
|
5899
6032
|
name: z22.string(),
|
|
@@ -5903,7 +6036,7 @@ var ClaudecodeSkillFrontmatterSchema = z22.looseObject({
|
|
|
5903
6036
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
5904
6037
|
constructor({
|
|
5905
6038
|
baseDir = process.cwd(),
|
|
5906
|
-
relativeDirPath =
|
|
6039
|
+
relativeDirPath = join52(".claude", "skills"),
|
|
5907
6040
|
dirName,
|
|
5908
6041
|
frontmatter,
|
|
5909
6042
|
body,
|
|
@@ -5934,7 +6067,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5934
6067
|
global: _global = false
|
|
5935
6068
|
} = {}) {
|
|
5936
6069
|
return {
|
|
5937
|
-
relativeDirPath:
|
|
6070
|
+
relativeDirPath: join52(".claude", "skills")
|
|
5938
6071
|
};
|
|
5939
6072
|
}
|
|
5940
6073
|
getFrontmatter() {
|
|
@@ -6022,9 +6155,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6022
6155
|
});
|
|
6023
6156
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6024
6157
|
if (!result.success) {
|
|
6025
|
-
const skillDirPath =
|
|
6158
|
+
const skillDirPath = join52(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6026
6159
|
throw new Error(
|
|
6027
|
-
`Invalid frontmatter in ${
|
|
6160
|
+
`Invalid frontmatter in ${join52(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6028
6161
|
);
|
|
6029
6162
|
}
|
|
6030
6163
|
return new _ClaudecodeSkill({
|
|
@@ -6058,7 +6191,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6058
6191
|
};
|
|
6059
6192
|
|
|
6060
6193
|
// src/features/skills/codexcli-skill.ts
|
|
6061
|
-
import { join as
|
|
6194
|
+
import { join as join53 } from "path";
|
|
6062
6195
|
import { z as z23 } from "zod/mini";
|
|
6063
6196
|
var CodexCliSkillFrontmatterSchema = z23.looseObject({
|
|
6064
6197
|
name: z23.string(),
|
|
@@ -6072,7 +6205,7 @@ var CodexCliSkillFrontmatterSchema = z23.looseObject({
|
|
|
6072
6205
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
6073
6206
|
constructor({
|
|
6074
6207
|
baseDir = process.cwd(),
|
|
6075
|
-
relativeDirPath =
|
|
6208
|
+
relativeDirPath = join53(".codex", "skills"),
|
|
6076
6209
|
dirName,
|
|
6077
6210
|
frontmatter,
|
|
6078
6211
|
body,
|
|
@@ -6103,7 +6236,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6103
6236
|
global: _global = false
|
|
6104
6237
|
} = {}) {
|
|
6105
6238
|
return {
|
|
6106
|
-
relativeDirPath:
|
|
6239
|
+
relativeDirPath: join53(".codex", "skills")
|
|
6107
6240
|
};
|
|
6108
6241
|
}
|
|
6109
6242
|
getFrontmatter() {
|
|
@@ -6195,9 +6328,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6195
6328
|
});
|
|
6196
6329
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6197
6330
|
if (!result.success) {
|
|
6198
|
-
const skillDirPath =
|
|
6331
|
+
const skillDirPath = join53(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6199
6332
|
throw new Error(
|
|
6200
|
-
`Invalid frontmatter in ${
|
|
6333
|
+
`Invalid frontmatter in ${join53(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6201
6334
|
);
|
|
6202
6335
|
}
|
|
6203
6336
|
return new _CodexCliSkill({
|
|
@@ -6231,7 +6364,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6231
6364
|
};
|
|
6232
6365
|
|
|
6233
6366
|
// src/features/skills/copilot-skill.ts
|
|
6234
|
-
import { join as
|
|
6367
|
+
import { join as join54 } from "path";
|
|
6235
6368
|
import { z as z24 } from "zod/mini";
|
|
6236
6369
|
var CopilotSkillFrontmatterSchema = z24.looseObject({
|
|
6237
6370
|
name: z24.string(),
|
|
@@ -6241,7 +6374,7 @@ var CopilotSkillFrontmatterSchema = z24.looseObject({
|
|
|
6241
6374
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
6242
6375
|
constructor({
|
|
6243
6376
|
baseDir = process.cwd(),
|
|
6244
|
-
relativeDirPath =
|
|
6377
|
+
relativeDirPath = join54(".github", "skills"),
|
|
6245
6378
|
dirName,
|
|
6246
6379
|
frontmatter,
|
|
6247
6380
|
body,
|
|
@@ -6273,7 +6406,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6273
6406
|
throw new Error("CopilotSkill does not support global mode.");
|
|
6274
6407
|
}
|
|
6275
6408
|
return {
|
|
6276
|
-
relativeDirPath:
|
|
6409
|
+
relativeDirPath: join54(".github", "skills")
|
|
6277
6410
|
};
|
|
6278
6411
|
}
|
|
6279
6412
|
getFrontmatter() {
|
|
@@ -6361,9 +6494,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6361
6494
|
});
|
|
6362
6495
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6363
6496
|
if (!result.success) {
|
|
6364
|
-
const skillDirPath =
|
|
6497
|
+
const skillDirPath = join54(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6365
6498
|
throw new Error(
|
|
6366
|
-
`Invalid frontmatter in ${
|
|
6499
|
+
`Invalid frontmatter in ${join54(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6367
6500
|
);
|
|
6368
6501
|
}
|
|
6369
6502
|
return new _CopilotSkill({
|
|
@@ -6398,7 +6531,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6398
6531
|
};
|
|
6399
6532
|
|
|
6400
6533
|
// src/features/skills/cursor-skill.ts
|
|
6401
|
-
import { join as
|
|
6534
|
+
import { join as join55 } from "path";
|
|
6402
6535
|
import { z as z25 } from "zod/mini";
|
|
6403
6536
|
var CursorSkillFrontmatterSchema = z25.looseObject({
|
|
6404
6537
|
name: z25.string(),
|
|
@@ -6407,7 +6540,7 @@ var CursorSkillFrontmatterSchema = z25.looseObject({
|
|
|
6407
6540
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
6408
6541
|
constructor({
|
|
6409
6542
|
baseDir = process.cwd(),
|
|
6410
|
-
relativeDirPath =
|
|
6543
|
+
relativeDirPath = join55(".cursor", "skills"),
|
|
6411
6544
|
dirName,
|
|
6412
6545
|
frontmatter,
|
|
6413
6546
|
body,
|
|
@@ -6439,7 +6572,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6439
6572
|
throw new Error("CursorSkill does not support global mode.");
|
|
6440
6573
|
}
|
|
6441
6574
|
return {
|
|
6442
|
-
relativeDirPath:
|
|
6575
|
+
relativeDirPath: join55(".cursor", "skills")
|
|
6443
6576
|
};
|
|
6444
6577
|
}
|
|
6445
6578
|
getFrontmatter() {
|
|
@@ -6521,9 +6654,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6521
6654
|
});
|
|
6522
6655
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6523
6656
|
if (!result.success) {
|
|
6524
|
-
const skillDirPath =
|
|
6657
|
+
const skillDirPath = join55(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6525
6658
|
throw new Error(
|
|
6526
|
-
`Invalid frontmatter in ${
|
|
6659
|
+
`Invalid frontmatter in ${join55(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6527
6660
|
);
|
|
6528
6661
|
}
|
|
6529
6662
|
return new _CursorSkill({
|
|
@@ -6558,7 +6691,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6558
6691
|
};
|
|
6559
6692
|
|
|
6560
6693
|
// src/features/skills/kilo-skill.ts
|
|
6561
|
-
import { join as
|
|
6694
|
+
import { join as join56 } from "path";
|
|
6562
6695
|
import { z as z26 } from "zod/mini";
|
|
6563
6696
|
var KiloSkillFrontmatterSchema = z26.looseObject({
|
|
6564
6697
|
name: z26.string(),
|
|
@@ -6567,7 +6700,7 @@ var KiloSkillFrontmatterSchema = z26.looseObject({
|
|
|
6567
6700
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
6568
6701
|
constructor({
|
|
6569
6702
|
baseDir = process.cwd(),
|
|
6570
|
-
relativeDirPath =
|
|
6703
|
+
relativeDirPath = join56(".kilocode", "skills"),
|
|
6571
6704
|
dirName,
|
|
6572
6705
|
frontmatter,
|
|
6573
6706
|
body,
|
|
@@ -6598,7 +6731,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6598
6731
|
global: _global = false
|
|
6599
6732
|
} = {}) {
|
|
6600
6733
|
return {
|
|
6601
|
-
relativeDirPath:
|
|
6734
|
+
relativeDirPath: join56(".kilocode", "skills")
|
|
6602
6735
|
};
|
|
6603
6736
|
}
|
|
6604
6737
|
getFrontmatter() {
|
|
@@ -6688,13 +6821,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6688
6821
|
});
|
|
6689
6822
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6690
6823
|
if (!result.success) {
|
|
6691
|
-
const skillDirPath =
|
|
6824
|
+
const skillDirPath = join56(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6692
6825
|
throw new Error(
|
|
6693
|
-
`Invalid frontmatter in ${
|
|
6826
|
+
`Invalid frontmatter in ${join56(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6694
6827
|
);
|
|
6695
6828
|
}
|
|
6696
6829
|
if (result.data.name !== loaded.dirName) {
|
|
6697
|
-
const skillFilePath =
|
|
6830
|
+
const skillFilePath = join56(
|
|
6698
6831
|
loaded.baseDir,
|
|
6699
6832
|
loaded.relativeDirPath,
|
|
6700
6833
|
loaded.dirName,
|
|
@@ -6735,7 +6868,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6735
6868
|
};
|
|
6736
6869
|
|
|
6737
6870
|
// src/features/skills/opencode-skill.ts
|
|
6738
|
-
import { join as
|
|
6871
|
+
import { join as join57 } from "path";
|
|
6739
6872
|
import { z as z27 } from "zod/mini";
|
|
6740
6873
|
var OpenCodeSkillFrontmatterSchema = z27.looseObject({
|
|
6741
6874
|
name: z27.string(),
|
|
@@ -6745,7 +6878,7 @@ var OpenCodeSkillFrontmatterSchema = z27.looseObject({
|
|
|
6745
6878
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
6746
6879
|
constructor({
|
|
6747
6880
|
baseDir = process.cwd(),
|
|
6748
|
-
relativeDirPath =
|
|
6881
|
+
relativeDirPath = join57(".opencode", "skill"),
|
|
6749
6882
|
dirName,
|
|
6750
6883
|
frontmatter,
|
|
6751
6884
|
body,
|
|
@@ -6774,7 +6907,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6774
6907
|
}
|
|
6775
6908
|
static getSettablePaths({ global = false } = {}) {
|
|
6776
6909
|
return {
|
|
6777
|
-
relativeDirPath: global ?
|
|
6910
|
+
relativeDirPath: global ? join57(".config", "opencode", "skill") : join57(".opencode", "skill")
|
|
6778
6911
|
};
|
|
6779
6912
|
}
|
|
6780
6913
|
getFrontmatter() {
|
|
@@ -6862,9 +6995,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6862
6995
|
});
|
|
6863
6996
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6864
6997
|
if (!result.success) {
|
|
6865
|
-
const skillDirPath =
|
|
6998
|
+
const skillDirPath = join57(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6866
6999
|
throw new Error(
|
|
6867
|
-
`Invalid frontmatter in ${
|
|
7000
|
+
`Invalid frontmatter in ${join57(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6868
7001
|
);
|
|
6869
7002
|
}
|
|
6870
7003
|
return new _OpenCodeSkill({
|
|
@@ -6898,7 +7031,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6898
7031
|
};
|
|
6899
7032
|
|
|
6900
7033
|
// src/features/skills/roo-skill.ts
|
|
6901
|
-
import { join as
|
|
7034
|
+
import { join as join58 } from "path";
|
|
6902
7035
|
import { z as z28 } from "zod/mini";
|
|
6903
7036
|
var RooSkillFrontmatterSchema = z28.looseObject({
|
|
6904
7037
|
name: z28.string(),
|
|
@@ -6907,7 +7040,7 @@ var RooSkillFrontmatterSchema = z28.looseObject({
|
|
|
6907
7040
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
6908
7041
|
constructor({
|
|
6909
7042
|
baseDir = process.cwd(),
|
|
6910
|
-
relativeDirPath =
|
|
7043
|
+
relativeDirPath = join58(".roo", "skills"),
|
|
6911
7044
|
dirName,
|
|
6912
7045
|
frontmatter,
|
|
6913
7046
|
body,
|
|
@@ -6938,7 +7071,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6938
7071
|
global: _global = false
|
|
6939
7072
|
} = {}) {
|
|
6940
7073
|
return {
|
|
6941
|
-
relativeDirPath:
|
|
7074
|
+
relativeDirPath: join58(".roo", "skills")
|
|
6942
7075
|
};
|
|
6943
7076
|
}
|
|
6944
7077
|
getFrontmatter() {
|
|
@@ -7028,13 +7161,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
7028
7161
|
});
|
|
7029
7162
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7030
7163
|
if (!result.success) {
|
|
7031
|
-
const skillDirPath =
|
|
7164
|
+
const skillDirPath = join58(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7032
7165
|
throw new Error(
|
|
7033
|
-
`Invalid frontmatter in ${
|
|
7166
|
+
`Invalid frontmatter in ${join58(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7034
7167
|
);
|
|
7035
7168
|
}
|
|
7036
7169
|
if (result.data.name !== loaded.dirName) {
|
|
7037
|
-
const skillFilePath =
|
|
7170
|
+
const skillFilePath = join58(
|
|
7038
7171
|
loaded.baseDir,
|
|
7039
7172
|
loaded.relativeDirPath,
|
|
7040
7173
|
loaded.dirName,
|
|
@@ -7245,9 +7378,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7245
7378
|
*/
|
|
7246
7379
|
async loadRulesyncDirs() {
|
|
7247
7380
|
const paths = RulesyncSkill.getSettablePaths();
|
|
7248
|
-
const rulesyncSkillsDirPath =
|
|
7249
|
-
const dirPaths = await findFilesByGlobs(
|
|
7250
|
-
const dirNames = dirPaths.map((path3) =>
|
|
7381
|
+
const rulesyncSkillsDirPath = join59(this.baseDir, paths.relativeDirPath);
|
|
7382
|
+
const dirPaths = await findFilesByGlobs(join59(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
7383
|
+
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7251
7384
|
const rulesyncSkills = await Promise.all(
|
|
7252
7385
|
dirNames.map(
|
|
7253
7386
|
(dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
|
|
@@ -7263,9 +7396,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7263
7396
|
async loadToolDirs() {
|
|
7264
7397
|
const factory = this.getFactory(this.toolTarget);
|
|
7265
7398
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7266
|
-
const skillsDirPath =
|
|
7267
|
-
const dirPaths = await findFilesByGlobs(
|
|
7268
|
-
const dirNames = dirPaths.map((path3) =>
|
|
7399
|
+
const skillsDirPath = join59(this.baseDir, paths.relativeDirPath);
|
|
7400
|
+
const dirPaths = await findFilesByGlobs(join59(skillsDirPath, "*"), { type: "dir" });
|
|
7401
|
+
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7269
7402
|
const toolSkills = await Promise.all(
|
|
7270
7403
|
dirNames.map(
|
|
7271
7404
|
(dirName) => factory.class.fromDir({
|
|
@@ -7281,9 +7414,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7281
7414
|
async loadToolDirsToDelete() {
|
|
7282
7415
|
const factory = this.getFactory(this.toolTarget);
|
|
7283
7416
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7284
|
-
const skillsDirPath =
|
|
7285
|
-
const dirPaths = await findFilesByGlobs(
|
|
7286
|
-
const dirNames = dirPaths.map((path3) =>
|
|
7417
|
+
const skillsDirPath = join59(this.baseDir, paths.relativeDirPath);
|
|
7418
|
+
const dirPaths = await findFilesByGlobs(join59(skillsDirPath, "*"), { type: "dir" });
|
|
7419
|
+
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7287
7420
|
const toolSkills = dirNames.map(
|
|
7288
7421
|
(dirName) => factory.class.forDeletion({
|
|
7289
7422
|
baseDir: this.baseDir,
|
|
@@ -7331,10 +7464,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7331
7464
|
};
|
|
7332
7465
|
|
|
7333
7466
|
// src/features/subagents/agentsmd-subagent.ts
|
|
7334
|
-
import { join as
|
|
7467
|
+
import { join as join61 } from "path";
|
|
7335
7468
|
|
|
7336
7469
|
// src/features/subagents/simulated-subagent.ts
|
|
7337
|
-
import { basename as
|
|
7470
|
+
import { basename as basename18, join as join60 } from "path";
|
|
7338
7471
|
import { z as z30 } from "zod/mini";
|
|
7339
7472
|
|
|
7340
7473
|
// src/features/subagents/tool-subagent.ts
|
|
@@ -7390,7 +7523,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7390
7523
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7391
7524
|
if (!result.success) {
|
|
7392
7525
|
throw new Error(
|
|
7393
|
-
`Invalid frontmatter in ${
|
|
7526
|
+
`Invalid frontmatter in ${join60(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7394
7527
|
);
|
|
7395
7528
|
}
|
|
7396
7529
|
}
|
|
@@ -7441,7 +7574,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7441
7574
|
return {
|
|
7442
7575
|
success: false,
|
|
7443
7576
|
error: new Error(
|
|
7444
|
-
`Invalid frontmatter in ${
|
|
7577
|
+
`Invalid frontmatter in ${join60(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7445
7578
|
)
|
|
7446
7579
|
};
|
|
7447
7580
|
}
|
|
@@ -7451,7 +7584,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7451
7584
|
relativeFilePath,
|
|
7452
7585
|
validate = true
|
|
7453
7586
|
}) {
|
|
7454
|
-
const filePath =
|
|
7587
|
+
const filePath = join60(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
7455
7588
|
const fileContent = await readFileContent(filePath);
|
|
7456
7589
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7457
7590
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7461,7 +7594,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7461
7594
|
return {
|
|
7462
7595
|
baseDir,
|
|
7463
7596
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
7464
|
-
relativeFilePath:
|
|
7597
|
+
relativeFilePath: basename18(relativeFilePath),
|
|
7465
7598
|
frontmatter: result.data,
|
|
7466
7599
|
body: content.trim(),
|
|
7467
7600
|
validate
|
|
@@ -7487,7 +7620,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7487
7620
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
7488
7621
|
static getSettablePaths() {
|
|
7489
7622
|
return {
|
|
7490
|
-
relativeDirPath:
|
|
7623
|
+
relativeDirPath: join61(".agents", "subagents")
|
|
7491
7624
|
};
|
|
7492
7625
|
}
|
|
7493
7626
|
static async fromFile(params) {
|
|
@@ -7510,11 +7643,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
7510
7643
|
};
|
|
7511
7644
|
|
|
7512
7645
|
// src/features/subagents/codexcli-subagent.ts
|
|
7513
|
-
import { join as
|
|
7646
|
+
import { join as join62 } from "path";
|
|
7514
7647
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
7515
7648
|
static getSettablePaths() {
|
|
7516
7649
|
return {
|
|
7517
|
-
relativeDirPath:
|
|
7650
|
+
relativeDirPath: join62(".codex", "subagents")
|
|
7518
7651
|
};
|
|
7519
7652
|
}
|
|
7520
7653
|
static async fromFile(params) {
|
|
@@ -7537,11 +7670,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
7537
7670
|
};
|
|
7538
7671
|
|
|
7539
7672
|
// src/features/subagents/cursor-subagent.ts
|
|
7540
|
-
import { join as
|
|
7673
|
+
import { join as join63 } from "path";
|
|
7541
7674
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
7542
7675
|
static getSettablePaths() {
|
|
7543
7676
|
return {
|
|
7544
|
-
relativeDirPath:
|
|
7677
|
+
relativeDirPath: join63(".cursor", "subagents")
|
|
7545
7678
|
};
|
|
7546
7679
|
}
|
|
7547
7680
|
static async fromFile(params) {
|
|
@@ -7564,11 +7697,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
7564
7697
|
};
|
|
7565
7698
|
|
|
7566
7699
|
// src/features/subagents/geminicli-subagent.ts
|
|
7567
|
-
import { join as
|
|
7700
|
+
import { join as join64 } from "path";
|
|
7568
7701
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
7569
7702
|
static getSettablePaths() {
|
|
7570
7703
|
return {
|
|
7571
|
-
relativeDirPath:
|
|
7704
|
+
relativeDirPath: join64(".gemini", "subagents")
|
|
7572
7705
|
};
|
|
7573
7706
|
}
|
|
7574
7707
|
static async fromFile(params) {
|
|
@@ -7591,11 +7724,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
7591
7724
|
};
|
|
7592
7725
|
|
|
7593
7726
|
// src/features/subagents/roo-subagent.ts
|
|
7594
|
-
import { join as
|
|
7727
|
+
import { join as join65 } from "path";
|
|
7595
7728
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
7596
7729
|
static getSettablePaths() {
|
|
7597
7730
|
return {
|
|
7598
|
-
relativeDirPath:
|
|
7731
|
+
relativeDirPath: join65(".roo", "subagents")
|
|
7599
7732
|
};
|
|
7600
7733
|
}
|
|
7601
7734
|
static async fromFile(params) {
|
|
@@ -7618,15 +7751,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
7618
7751
|
};
|
|
7619
7752
|
|
|
7620
7753
|
// src/features/subagents/subagents-processor.ts
|
|
7621
|
-
import { basename as
|
|
7754
|
+
import { basename as basename21, join as join70 } from "path";
|
|
7622
7755
|
import { z as z35 } from "zod/mini";
|
|
7623
7756
|
|
|
7624
7757
|
// src/features/subagents/claudecode-subagent.ts
|
|
7625
|
-
import { join as
|
|
7758
|
+
import { join as join67 } from "path";
|
|
7626
7759
|
import { z as z32 } from "zod/mini";
|
|
7627
7760
|
|
|
7628
7761
|
// src/features/subagents/rulesync-subagent.ts
|
|
7629
|
-
import { basename as
|
|
7762
|
+
import { basename as basename19, join as join66 } from "path";
|
|
7630
7763
|
import { z as z31 } from "zod/mini";
|
|
7631
7764
|
var RulesyncSubagentFrontmatterSchema = z31.looseObject({
|
|
7632
7765
|
targets: RulesyncTargetsSchema,
|
|
@@ -7641,7 +7774,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7641
7774
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7642
7775
|
if (!result.success) {
|
|
7643
7776
|
throw new Error(
|
|
7644
|
-
`Invalid frontmatter in ${
|
|
7777
|
+
`Invalid frontmatter in ${join66(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7645
7778
|
);
|
|
7646
7779
|
}
|
|
7647
7780
|
}
|
|
@@ -7674,7 +7807,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7674
7807
|
return {
|
|
7675
7808
|
success: false,
|
|
7676
7809
|
error: new Error(
|
|
7677
|
-
`Invalid frontmatter in ${
|
|
7810
|
+
`Invalid frontmatter in ${join66(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7678
7811
|
)
|
|
7679
7812
|
};
|
|
7680
7813
|
}
|
|
@@ -7683,14 +7816,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7683
7816
|
relativeFilePath
|
|
7684
7817
|
}) {
|
|
7685
7818
|
const fileContent = await readFileContent(
|
|
7686
|
-
|
|
7819
|
+
join66(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
7687
7820
|
);
|
|
7688
7821
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7689
7822
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7690
7823
|
if (!result.success) {
|
|
7691
7824
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
7692
7825
|
}
|
|
7693
|
-
const filename =
|
|
7826
|
+
const filename = basename19(relativeFilePath);
|
|
7694
7827
|
return new _RulesyncSubagent({
|
|
7695
7828
|
baseDir: process.cwd(),
|
|
7696
7829
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -7718,7 +7851,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7718
7851
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7719
7852
|
if (!result.success) {
|
|
7720
7853
|
throw new Error(
|
|
7721
|
-
`Invalid frontmatter in ${
|
|
7854
|
+
`Invalid frontmatter in ${join67(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7722
7855
|
);
|
|
7723
7856
|
}
|
|
7724
7857
|
}
|
|
@@ -7730,7 +7863,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7730
7863
|
}
|
|
7731
7864
|
static getSettablePaths(_options = {}) {
|
|
7732
7865
|
return {
|
|
7733
|
-
relativeDirPath:
|
|
7866
|
+
relativeDirPath: join67(".claude", "agents")
|
|
7734
7867
|
};
|
|
7735
7868
|
}
|
|
7736
7869
|
getFrontmatter() {
|
|
@@ -7804,7 +7937,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7804
7937
|
return {
|
|
7805
7938
|
success: false,
|
|
7806
7939
|
error: new Error(
|
|
7807
|
-
`Invalid frontmatter in ${
|
|
7940
|
+
`Invalid frontmatter in ${join67(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7808
7941
|
)
|
|
7809
7942
|
};
|
|
7810
7943
|
}
|
|
@@ -7822,7 +7955,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7822
7955
|
global = false
|
|
7823
7956
|
}) {
|
|
7824
7957
|
const paths = this.getSettablePaths({ global });
|
|
7825
|
-
const filePath =
|
|
7958
|
+
const filePath = join67(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7826
7959
|
const fileContent = await readFileContent(filePath);
|
|
7827
7960
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7828
7961
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7857,7 +7990,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7857
7990
|
};
|
|
7858
7991
|
|
|
7859
7992
|
// src/features/subagents/copilot-subagent.ts
|
|
7860
|
-
import { join as
|
|
7993
|
+
import { join as join68 } from "path";
|
|
7861
7994
|
import { z as z33 } from "zod/mini";
|
|
7862
7995
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
7863
7996
|
var CopilotSubagentFrontmatterSchema = z33.looseObject({
|
|
@@ -7883,7 +8016,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7883
8016
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7884
8017
|
if (!result.success) {
|
|
7885
8018
|
throw new Error(
|
|
7886
|
-
`Invalid frontmatter in ${
|
|
8019
|
+
`Invalid frontmatter in ${join68(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7887
8020
|
);
|
|
7888
8021
|
}
|
|
7889
8022
|
}
|
|
@@ -7895,7 +8028,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7895
8028
|
}
|
|
7896
8029
|
static getSettablePaths(_options = {}) {
|
|
7897
8030
|
return {
|
|
7898
|
-
relativeDirPath:
|
|
8031
|
+
relativeDirPath: join68(".github", "agents")
|
|
7899
8032
|
};
|
|
7900
8033
|
}
|
|
7901
8034
|
getFrontmatter() {
|
|
@@ -7969,7 +8102,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7969
8102
|
return {
|
|
7970
8103
|
success: false,
|
|
7971
8104
|
error: new Error(
|
|
7972
|
-
`Invalid frontmatter in ${
|
|
8105
|
+
`Invalid frontmatter in ${join68(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7973
8106
|
)
|
|
7974
8107
|
};
|
|
7975
8108
|
}
|
|
@@ -7987,7 +8120,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7987
8120
|
global = false
|
|
7988
8121
|
}) {
|
|
7989
8122
|
const paths = this.getSettablePaths({ global });
|
|
7990
|
-
const filePath =
|
|
8123
|
+
const filePath = join68(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7991
8124
|
const fileContent = await readFileContent(filePath);
|
|
7992
8125
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7993
8126
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8023,7 +8156,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8023
8156
|
};
|
|
8024
8157
|
|
|
8025
8158
|
// src/features/subagents/opencode-subagent.ts
|
|
8026
|
-
import { basename as
|
|
8159
|
+
import { basename as basename20, join as join69 } from "path";
|
|
8027
8160
|
import { z as z34 } from "zod/mini";
|
|
8028
8161
|
var OpenCodeSubagentFrontmatterSchema = z34.looseObject({
|
|
8029
8162
|
description: z34.string(),
|
|
@@ -8038,7 +8171,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8038
8171
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8039
8172
|
if (!result.success) {
|
|
8040
8173
|
throw new Error(
|
|
8041
|
-
`Invalid frontmatter in ${
|
|
8174
|
+
`Invalid frontmatter in ${join69(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8042
8175
|
);
|
|
8043
8176
|
}
|
|
8044
8177
|
}
|
|
@@ -8052,7 +8185,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8052
8185
|
global = false
|
|
8053
8186
|
} = {}) {
|
|
8054
8187
|
return {
|
|
8055
|
-
relativeDirPath: global ?
|
|
8188
|
+
relativeDirPath: global ? join69(".config", "opencode", "agent") : join69(".opencode", "agent")
|
|
8056
8189
|
};
|
|
8057
8190
|
}
|
|
8058
8191
|
getFrontmatter() {
|
|
@@ -8065,7 +8198,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8065
8198
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
8066
8199
|
const rulesyncFrontmatter = {
|
|
8067
8200
|
targets: ["opencode"],
|
|
8068
|
-
name: name ??
|
|
8201
|
+
name: name ?? basename20(this.getRelativeFilePath(), ".md"),
|
|
8069
8202
|
description,
|
|
8070
8203
|
opencode: { mode, ...opencodeSection }
|
|
8071
8204
|
};
|
|
@@ -8118,7 +8251,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8118
8251
|
return {
|
|
8119
8252
|
success: false,
|
|
8120
8253
|
error: new Error(
|
|
8121
|
-
`Invalid frontmatter in ${
|
|
8254
|
+
`Invalid frontmatter in ${join69(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8122
8255
|
)
|
|
8123
8256
|
};
|
|
8124
8257
|
}
|
|
@@ -8135,7 +8268,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8135
8268
|
global = false
|
|
8136
8269
|
}) {
|
|
8137
8270
|
const paths = this.getSettablePaths({ global });
|
|
8138
|
-
const filePath =
|
|
8271
|
+
const filePath = join69(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8139
8272
|
const fileContent = await readFileContent(filePath);
|
|
8140
8273
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8141
8274
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8296,7 +8429,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8296
8429
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
8297
8430
|
*/
|
|
8298
8431
|
async loadRulesyncFiles() {
|
|
8299
|
-
const subagentsDir =
|
|
8432
|
+
const subagentsDir = join70(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
8300
8433
|
const dirExists = await directoryExists(subagentsDir);
|
|
8301
8434
|
if (!dirExists) {
|
|
8302
8435
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -8311,7 +8444,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8311
8444
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
8312
8445
|
const rulesyncSubagents = [];
|
|
8313
8446
|
for (const mdFile of mdFiles) {
|
|
8314
|
-
const filepath =
|
|
8447
|
+
const filepath = join70(subagentsDir, mdFile);
|
|
8315
8448
|
try {
|
|
8316
8449
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
8317
8450
|
relativeFilePath: mdFile,
|
|
@@ -8341,14 +8474,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8341
8474
|
const factory = this.getFactory(this.toolTarget);
|
|
8342
8475
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
8343
8476
|
const subagentFilePaths = await findFilesByGlobs(
|
|
8344
|
-
|
|
8477
|
+
join70(this.baseDir, paths.relativeDirPath, "*.md")
|
|
8345
8478
|
);
|
|
8346
8479
|
if (forDeletion) {
|
|
8347
8480
|
const toolSubagents2 = subagentFilePaths.map(
|
|
8348
8481
|
(path3) => factory.class.forDeletion({
|
|
8349
8482
|
baseDir: this.baseDir,
|
|
8350
8483
|
relativeDirPath: paths.relativeDirPath,
|
|
8351
|
-
relativeFilePath:
|
|
8484
|
+
relativeFilePath: basename21(path3),
|
|
8352
8485
|
global: this.global
|
|
8353
8486
|
})
|
|
8354
8487
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -8359,7 +8492,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8359
8492
|
subagentFilePaths.map(
|
|
8360
8493
|
(path3) => factory.class.fromFile({
|
|
8361
8494
|
baseDir: this.baseDir,
|
|
8362
|
-
relativeFilePath:
|
|
8495
|
+
relativeFilePath: basename21(path3),
|
|
8363
8496
|
global: this.global
|
|
8364
8497
|
})
|
|
8365
8498
|
)
|
|
@@ -8391,13 +8524,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8391
8524
|
};
|
|
8392
8525
|
|
|
8393
8526
|
// src/features/rules/agentsmd-rule.ts
|
|
8394
|
-
import { join as
|
|
8527
|
+
import { join as join73 } from "path";
|
|
8395
8528
|
|
|
8396
8529
|
// src/features/rules/tool-rule.ts
|
|
8397
|
-
import { join as
|
|
8530
|
+
import { join as join72 } from "path";
|
|
8398
8531
|
|
|
8399
8532
|
// src/features/rules/rulesync-rule.ts
|
|
8400
|
-
import { basename as
|
|
8533
|
+
import { basename as basename22, join as join71 } from "path";
|
|
8401
8534
|
import { z as z36 } from "zod/mini";
|
|
8402
8535
|
var RulesyncRuleFrontmatterSchema = z36.object({
|
|
8403
8536
|
root: z36.optional(z36.optional(z36.boolean())),
|
|
@@ -8444,7 +8577,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8444
8577
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8445
8578
|
if (!result.success) {
|
|
8446
8579
|
throw new Error(
|
|
8447
|
-
`Invalid frontmatter in ${
|
|
8580
|
+
`Invalid frontmatter in ${join71(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8448
8581
|
);
|
|
8449
8582
|
}
|
|
8450
8583
|
}
|
|
@@ -8479,7 +8612,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8479
8612
|
return {
|
|
8480
8613
|
success: false,
|
|
8481
8614
|
error: new Error(
|
|
8482
|
-
`Invalid frontmatter in ${
|
|
8615
|
+
`Invalid frontmatter in ${join71(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8483
8616
|
)
|
|
8484
8617
|
};
|
|
8485
8618
|
}
|
|
@@ -8488,12 +8621,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8488
8621
|
relativeFilePath,
|
|
8489
8622
|
validate = true
|
|
8490
8623
|
}) {
|
|
8491
|
-
const legacyPath =
|
|
8624
|
+
const legacyPath = join71(
|
|
8492
8625
|
process.cwd(),
|
|
8493
8626
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
8494
8627
|
relativeFilePath
|
|
8495
8628
|
);
|
|
8496
|
-
const recommendedPath =
|
|
8629
|
+
const recommendedPath = join71(
|
|
8497
8630
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8498
8631
|
relativeFilePath
|
|
8499
8632
|
);
|
|
@@ -8514,7 +8647,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8514
8647
|
agentsmd: result.data.agentsmd,
|
|
8515
8648
|
cursor: result.data.cursor
|
|
8516
8649
|
};
|
|
8517
|
-
const filename =
|
|
8650
|
+
const filename = basename22(legacyPath);
|
|
8518
8651
|
return new _RulesyncRule({
|
|
8519
8652
|
baseDir: process.cwd(),
|
|
8520
8653
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8528,7 +8661,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8528
8661
|
relativeFilePath,
|
|
8529
8662
|
validate = true
|
|
8530
8663
|
}) {
|
|
8531
|
-
const filePath =
|
|
8664
|
+
const filePath = join71(
|
|
8532
8665
|
process.cwd(),
|
|
8533
8666
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8534
8667
|
relativeFilePath
|
|
@@ -8547,7 +8680,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8547
8680
|
agentsmd: result.data.agentsmd,
|
|
8548
8681
|
cursor: result.data.cursor
|
|
8549
8682
|
};
|
|
8550
|
-
const filename =
|
|
8683
|
+
const filename = basename22(filePath);
|
|
8551
8684
|
return new _RulesyncRule({
|
|
8552
8685
|
baseDir: process.cwd(),
|
|
8553
8686
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8630,7 +8763,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8630
8763
|
rulesyncRule,
|
|
8631
8764
|
validate = true,
|
|
8632
8765
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
8633
|
-
nonRootPath = { relativeDirPath:
|
|
8766
|
+
nonRootPath = { relativeDirPath: join72(".agents", "memories") }
|
|
8634
8767
|
}) {
|
|
8635
8768
|
const params = this.buildToolRuleParamsDefault({
|
|
8636
8769
|
baseDir,
|
|
@@ -8641,7 +8774,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8641
8774
|
});
|
|
8642
8775
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
8643
8776
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
8644
|
-
params.relativeDirPath =
|
|
8777
|
+
params.relativeDirPath = join72(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
8645
8778
|
params.relativeFilePath = "AGENTS.md";
|
|
8646
8779
|
}
|
|
8647
8780
|
return params;
|
|
@@ -8706,7 +8839,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8706
8839
|
relativeFilePath: "AGENTS.md"
|
|
8707
8840
|
},
|
|
8708
8841
|
nonRoot: {
|
|
8709
|
-
relativeDirPath:
|
|
8842
|
+
relativeDirPath: join73(".agents", "memories")
|
|
8710
8843
|
}
|
|
8711
8844
|
};
|
|
8712
8845
|
}
|
|
@@ -8716,8 +8849,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8716
8849
|
validate = true
|
|
8717
8850
|
}) {
|
|
8718
8851
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
8719
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
8720
|
-
const fileContent = await readFileContent(
|
|
8852
|
+
const relativePath = isRoot ? "AGENTS.md" : join73(".agents", "memories", relativeFilePath);
|
|
8853
|
+
const fileContent = await readFileContent(join73(baseDir, relativePath));
|
|
8721
8854
|
return new _AgentsMdRule({
|
|
8722
8855
|
baseDir,
|
|
8723
8856
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -8772,7 +8905,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8772
8905
|
};
|
|
8773
8906
|
|
|
8774
8907
|
// src/features/rules/antigravity-rule.ts
|
|
8775
|
-
import { join as
|
|
8908
|
+
import { join as join74 } from "path";
|
|
8776
8909
|
import { z as z37 } from "zod/mini";
|
|
8777
8910
|
var AntigravityRuleFrontmatterSchema = z37.looseObject({
|
|
8778
8911
|
trigger: z37.optional(
|
|
@@ -8931,7 +9064,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8931
9064
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8932
9065
|
if (!result.success) {
|
|
8933
9066
|
throw new Error(
|
|
8934
|
-
`Invalid frontmatter in ${
|
|
9067
|
+
`Invalid frontmatter in ${join74(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8935
9068
|
);
|
|
8936
9069
|
}
|
|
8937
9070
|
}
|
|
@@ -8946,7 +9079,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8946
9079
|
static getSettablePaths() {
|
|
8947
9080
|
return {
|
|
8948
9081
|
nonRoot: {
|
|
8949
|
-
relativeDirPath:
|
|
9082
|
+
relativeDirPath: join74(".agent", "rules")
|
|
8950
9083
|
}
|
|
8951
9084
|
};
|
|
8952
9085
|
}
|
|
@@ -8955,7 +9088,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8955
9088
|
relativeFilePath,
|
|
8956
9089
|
validate = true
|
|
8957
9090
|
}) {
|
|
8958
|
-
const filePath =
|
|
9091
|
+
const filePath = join74(
|
|
8959
9092
|
baseDir,
|
|
8960
9093
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
8961
9094
|
relativeFilePath
|
|
@@ -9096,7 +9229,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9096
9229
|
};
|
|
9097
9230
|
|
|
9098
9231
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
9099
|
-
import { join as
|
|
9232
|
+
import { join as join75 } from "path";
|
|
9100
9233
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
9101
9234
|
toRulesyncRule() {
|
|
9102
9235
|
const rulesyncFrontmatter = {
|
|
@@ -9122,7 +9255,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9122
9255
|
relativeFilePath: ".augment-guidelines"
|
|
9123
9256
|
},
|
|
9124
9257
|
nonRoot: {
|
|
9125
|
-
relativeDirPath:
|
|
9258
|
+
relativeDirPath: join75(".augment", "rules")
|
|
9126
9259
|
}
|
|
9127
9260
|
};
|
|
9128
9261
|
}
|
|
@@ -9157,8 +9290,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9157
9290
|
}) {
|
|
9158
9291
|
const settablePaths = this.getSettablePaths();
|
|
9159
9292
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
9160
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
9161
|
-
const fileContent = await readFileContent(
|
|
9293
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join75(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9294
|
+
const fileContent = await readFileContent(join75(baseDir, relativePath));
|
|
9162
9295
|
return new _AugmentcodeLegacyRule({
|
|
9163
9296
|
baseDir,
|
|
9164
9297
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -9187,7 +9320,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9187
9320
|
};
|
|
9188
9321
|
|
|
9189
9322
|
// src/features/rules/augmentcode-rule.ts
|
|
9190
|
-
import { join as
|
|
9323
|
+
import { join as join76 } from "path";
|
|
9191
9324
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
9192
9325
|
toRulesyncRule() {
|
|
9193
9326
|
return this.toRulesyncRuleDefault();
|
|
@@ -9195,7 +9328,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9195
9328
|
static getSettablePaths() {
|
|
9196
9329
|
return {
|
|
9197
9330
|
nonRoot: {
|
|
9198
|
-
relativeDirPath:
|
|
9331
|
+
relativeDirPath: join76(".augment", "rules")
|
|
9199
9332
|
}
|
|
9200
9333
|
};
|
|
9201
9334
|
}
|
|
@@ -9219,7 +9352,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9219
9352
|
validate = true
|
|
9220
9353
|
}) {
|
|
9221
9354
|
const fileContent = await readFileContent(
|
|
9222
|
-
|
|
9355
|
+
join76(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9223
9356
|
);
|
|
9224
9357
|
const { body: content } = parseFrontmatter(fileContent);
|
|
9225
9358
|
return new _AugmentcodeRule({
|
|
@@ -9255,7 +9388,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9255
9388
|
};
|
|
9256
9389
|
|
|
9257
9390
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
9258
|
-
import { join as
|
|
9391
|
+
import { join as join77 } from "path";
|
|
9259
9392
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
9260
9393
|
static getSettablePaths({
|
|
9261
9394
|
global
|
|
@@ -9274,7 +9407,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9274
9407
|
relativeFilePath: "CLAUDE.md"
|
|
9275
9408
|
},
|
|
9276
9409
|
nonRoot: {
|
|
9277
|
-
relativeDirPath:
|
|
9410
|
+
relativeDirPath: join77(".claude", "memories")
|
|
9278
9411
|
}
|
|
9279
9412
|
};
|
|
9280
9413
|
}
|
|
@@ -9289,7 +9422,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9289
9422
|
if (isRoot) {
|
|
9290
9423
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9291
9424
|
const fileContent2 = await readFileContent(
|
|
9292
|
-
|
|
9425
|
+
join77(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9293
9426
|
);
|
|
9294
9427
|
return new _ClaudecodeLegacyRule({
|
|
9295
9428
|
baseDir,
|
|
@@ -9303,8 +9436,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9303
9436
|
if (!paths.nonRoot) {
|
|
9304
9437
|
throw new Error("nonRoot path is not set");
|
|
9305
9438
|
}
|
|
9306
|
-
const relativePath =
|
|
9307
|
-
const fileContent = await readFileContent(
|
|
9439
|
+
const relativePath = join77(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9440
|
+
const fileContent = await readFileContent(join77(baseDir, relativePath));
|
|
9308
9441
|
return new _ClaudecodeLegacyRule({
|
|
9309
9442
|
baseDir,
|
|
9310
9443
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9363,7 +9496,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9363
9496
|
};
|
|
9364
9497
|
|
|
9365
9498
|
// src/features/rules/claudecode-rule.ts
|
|
9366
|
-
import { join as
|
|
9499
|
+
import { join as join78 } from "path";
|
|
9367
9500
|
import { z as z38 } from "zod/mini";
|
|
9368
9501
|
var ClaudecodeRuleFrontmatterSchema = z38.object({
|
|
9369
9502
|
paths: z38.optional(z38.string())
|
|
@@ -9388,7 +9521,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9388
9521
|
relativeFilePath: "CLAUDE.md"
|
|
9389
9522
|
},
|
|
9390
9523
|
nonRoot: {
|
|
9391
|
-
relativeDirPath:
|
|
9524
|
+
relativeDirPath: join78(".claude", "rules")
|
|
9392
9525
|
}
|
|
9393
9526
|
};
|
|
9394
9527
|
}
|
|
@@ -9397,7 +9530,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9397
9530
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9398
9531
|
if (!result.success) {
|
|
9399
9532
|
throw new Error(
|
|
9400
|
-
`Invalid frontmatter in ${
|
|
9533
|
+
`Invalid frontmatter in ${join78(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9401
9534
|
);
|
|
9402
9535
|
}
|
|
9403
9536
|
}
|
|
@@ -9425,7 +9558,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9425
9558
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
9426
9559
|
if (isRoot) {
|
|
9427
9560
|
const fileContent2 = await readFileContent(
|
|
9428
|
-
|
|
9561
|
+
join78(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
9429
9562
|
);
|
|
9430
9563
|
return new _ClaudecodeRule({
|
|
9431
9564
|
baseDir,
|
|
@@ -9440,13 +9573,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9440
9573
|
if (!paths.nonRoot) {
|
|
9441
9574
|
throw new Error("nonRoot path is not set");
|
|
9442
9575
|
}
|
|
9443
|
-
const relativePath =
|
|
9444
|
-
const fileContent = await readFileContent(
|
|
9576
|
+
const relativePath = join78(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9577
|
+
const fileContent = await readFileContent(join78(baseDir, relativePath));
|
|
9445
9578
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9446
9579
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9447
9580
|
if (!result.success) {
|
|
9448
9581
|
throw new Error(
|
|
9449
|
-
`Invalid frontmatter in ${
|
|
9582
|
+
`Invalid frontmatter in ${join78(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
9450
9583
|
);
|
|
9451
9584
|
}
|
|
9452
9585
|
return new _ClaudecodeRule({
|
|
@@ -9553,7 +9686,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9553
9686
|
return {
|
|
9554
9687
|
success: false,
|
|
9555
9688
|
error: new Error(
|
|
9556
|
-
`Invalid frontmatter in ${
|
|
9689
|
+
`Invalid frontmatter in ${join78(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9557
9690
|
)
|
|
9558
9691
|
};
|
|
9559
9692
|
}
|
|
@@ -9573,7 +9706,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9573
9706
|
};
|
|
9574
9707
|
|
|
9575
9708
|
// src/features/rules/cline-rule.ts
|
|
9576
|
-
import { join as
|
|
9709
|
+
import { join as join79 } from "path";
|
|
9577
9710
|
import { z as z39 } from "zod/mini";
|
|
9578
9711
|
var ClineRuleFrontmatterSchema = z39.object({
|
|
9579
9712
|
description: z39.string()
|
|
@@ -9618,7 +9751,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9618
9751
|
validate = true
|
|
9619
9752
|
}) {
|
|
9620
9753
|
const fileContent = await readFileContent(
|
|
9621
|
-
|
|
9754
|
+
join79(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9622
9755
|
);
|
|
9623
9756
|
return new _ClineRule({
|
|
9624
9757
|
baseDir,
|
|
@@ -9644,7 +9777,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9644
9777
|
};
|
|
9645
9778
|
|
|
9646
9779
|
// src/features/rules/codexcli-rule.ts
|
|
9647
|
-
import { join as
|
|
9780
|
+
import { join as join80 } from "path";
|
|
9648
9781
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
9649
9782
|
static getSettablePaths({
|
|
9650
9783
|
global
|
|
@@ -9663,7 +9796,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9663
9796
|
relativeFilePath: "AGENTS.md"
|
|
9664
9797
|
},
|
|
9665
9798
|
nonRoot: {
|
|
9666
|
-
relativeDirPath:
|
|
9799
|
+
relativeDirPath: join80(".codex", "memories")
|
|
9667
9800
|
}
|
|
9668
9801
|
};
|
|
9669
9802
|
}
|
|
@@ -9678,7 +9811,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9678
9811
|
if (isRoot) {
|
|
9679
9812
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9680
9813
|
const fileContent2 = await readFileContent(
|
|
9681
|
-
|
|
9814
|
+
join80(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9682
9815
|
);
|
|
9683
9816
|
return new _CodexcliRule({
|
|
9684
9817
|
baseDir,
|
|
@@ -9692,8 +9825,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9692
9825
|
if (!paths.nonRoot) {
|
|
9693
9826
|
throw new Error("nonRoot path is not set");
|
|
9694
9827
|
}
|
|
9695
|
-
const relativePath =
|
|
9696
|
-
const fileContent = await readFileContent(
|
|
9828
|
+
const relativePath = join80(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9829
|
+
const fileContent = await readFileContent(join80(baseDir, relativePath));
|
|
9697
9830
|
return new _CodexcliRule({
|
|
9698
9831
|
baseDir,
|
|
9699
9832
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9752,7 +9885,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9752
9885
|
};
|
|
9753
9886
|
|
|
9754
9887
|
// src/features/rules/copilot-rule.ts
|
|
9755
|
-
import { join as
|
|
9888
|
+
import { join as join81 } from "path";
|
|
9756
9889
|
import { z as z40 } from "zod/mini";
|
|
9757
9890
|
var CopilotRuleFrontmatterSchema = z40.object({
|
|
9758
9891
|
description: z40.optional(z40.string()),
|
|
@@ -9769,7 +9902,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9769
9902
|
relativeFilePath: "copilot-instructions.md"
|
|
9770
9903
|
},
|
|
9771
9904
|
nonRoot: {
|
|
9772
|
-
relativeDirPath:
|
|
9905
|
+
relativeDirPath: join81(".github", "instructions")
|
|
9773
9906
|
}
|
|
9774
9907
|
};
|
|
9775
9908
|
}
|
|
@@ -9778,7 +9911,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9778
9911
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9779
9912
|
if (!result.success) {
|
|
9780
9913
|
throw new Error(
|
|
9781
|
-
`Invalid frontmatter in ${
|
|
9914
|
+
`Invalid frontmatter in ${join81(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9782
9915
|
);
|
|
9783
9916
|
}
|
|
9784
9917
|
}
|
|
@@ -9860,11 +9993,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9860
9993
|
validate = true
|
|
9861
9994
|
}) {
|
|
9862
9995
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
9863
|
-
const relativePath = isRoot ?
|
|
9996
|
+
const relativePath = isRoot ? join81(
|
|
9864
9997
|
this.getSettablePaths().root.relativeDirPath,
|
|
9865
9998
|
this.getSettablePaths().root.relativeFilePath
|
|
9866
|
-
) :
|
|
9867
|
-
const fileContent = await readFileContent(
|
|
9999
|
+
) : join81(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10000
|
+
const fileContent = await readFileContent(join81(baseDir, relativePath));
|
|
9868
10001
|
if (isRoot) {
|
|
9869
10002
|
return new _CopilotRule({
|
|
9870
10003
|
baseDir,
|
|
@@ -9880,7 +10013,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9880
10013
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9881
10014
|
if (!result.success) {
|
|
9882
10015
|
throw new Error(
|
|
9883
|
-
`Invalid frontmatter in ${
|
|
10016
|
+
`Invalid frontmatter in ${join81(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9884
10017
|
);
|
|
9885
10018
|
}
|
|
9886
10019
|
return new _CopilotRule({
|
|
@@ -9920,7 +10053,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9920
10053
|
return {
|
|
9921
10054
|
success: false,
|
|
9922
10055
|
error: new Error(
|
|
9923
|
-
`Invalid frontmatter in ${
|
|
10056
|
+
`Invalid frontmatter in ${join81(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9924
10057
|
)
|
|
9925
10058
|
};
|
|
9926
10059
|
}
|
|
@@ -9940,7 +10073,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9940
10073
|
};
|
|
9941
10074
|
|
|
9942
10075
|
// src/features/rules/cursor-rule.ts
|
|
9943
|
-
import { basename as
|
|
10076
|
+
import { basename as basename23, join as join82 } from "path";
|
|
9944
10077
|
import { z as z41 } from "zod/mini";
|
|
9945
10078
|
var CursorRuleFrontmatterSchema = z41.object({
|
|
9946
10079
|
description: z41.optional(z41.string()),
|
|
@@ -9953,7 +10086,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9953
10086
|
static getSettablePaths() {
|
|
9954
10087
|
return {
|
|
9955
10088
|
nonRoot: {
|
|
9956
|
-
relativeDirPath:
|
|
10089
|
+
relativeDirPath: join82(".cursor", "rules")
|
|
9957
10090
|
}
|
|
9958
10091
|
};
|
|
9959
10092
|
}
|
|
@@ -9962,7 +10095,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9962
10095
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9963
10096
|
if (!result.success) {
|
|
9964
10097
|
throw new Error(
|
|
9965
|
-
`Invalid frontmatter in ${
|
|
10098
|
+
`Invalid frontmatter in ${join82(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9966
10099
|
);
|
|
9967
10100
|
}
|
|
9968
10101
|
}
|
|
@@ -10079,19 +10212,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10079
10212
|
validate = true
|
|
10080
10213
|
}) {
|
|
10081
10214
|
const fileContent = await readFileContent(
|
|
10082
|
-
|
|
10215
|
+
join82(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10083
10216
|
);
|
|
10084
10217
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
10085
10218
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10086
10219
|
if (!result.success) {
|
|
10087
10220
|
throw new Error(
|
|
10088
|
-
`Invalid frontmatter in ${
|
|
10221
|
+
`Invalid frontmatter in ${join82(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10089
10222
|
);
|
|
10090
10223
|
}
|
|
10091
10224
|
return new _CursorRule({
|
|
10092
10225
|
baseDir,
|
|
10093
10226
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
10094
|
-
relativeFilePath:
|
|
10227
|
+
relativeFilePath: basename23(relativeFilePath),
|
|
10095
10228
|
frontmatter: result.data,
|
|
10096
10229
|
body: content.trim(),
|
|
10097
10230
|
validate
|
|
@@ -10122,7 +10255,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10122
10255
|
return {
|
|
10123
10256
|
success: false,
|
|
10124
10257
|
error: new Error(
|
|
10125
|
-
`Invalid frontmatter in ${
|
|
10258
|
+
`Invalid frontmatter in ${join82(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10126
10259
|
)
|
|
10127
10260
|
};
|
|
10128
10261
|
}
|
|
@@ -10142,7 +10275,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10142
10275
|
};
|
|
10143
10276
|
|
|
10144
10277
|
// src/features/rules/geminicli-rule.ts
|
|
10145
|
-
import { join as
|
|
10278
|
+
import { join as join83 } from "path";
|
|
10146
10279
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
10147
10280
|
static getSettablePaths({
|
|
10148
10281
|
global
|
|
@@ -10161,7 +10294,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10161
10294
|
relativeFilePath: "GEMINI.md"
|
|
10162
10295
|
},
|
|
10163
10296
|
nonRoot: {
|
|
10164
|
-
relativeDirPath:
|
|
10297
|
+
relativeDirPath: join83(".gemini", "memories")
|
|
10165
10298
|
}
|
|
10166
10299
|
};
|
|
10167
10300
|
}
|
|
@@ -10176,7 +10309,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10176
10309
|
if (isRoot) {
|
|
10177
10310
|
const relativePath2 = paths.root.relativeFilePath;
|
|
10178
10311
|
const fileContent2 = await readFileContent(
|
|
10179
|
-
|
|
10312
|
+
join83(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
10180
10313
|
);
|
|
10181
10314
|
return new _GeminiCliRule({
|
|
10182
10315
|
baseDir,
|
|
@@ -10190,8 +10323,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10190
10323
|
if (!paths.nonRoot) {
|
|
10191
10324
|
throw new Error("nonRoot path is not set");
|
|
10192
10325
|
}
|
|
10193
|
-
const relativePath =
|
|
10194
|
-
const fileContent = await readFileContent(
|
|
10326
|
+
const relativePath = join83(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10327
|
+
const fileContent = await readFileContent(join83(baseDir, relativePath));
|
|
10195
10328
|
return new _GeminiCliRule({
|
|
10196
10329
|
baseDir,
|
|
10197
10330
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10250,7 +10383,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10250
10383
|
};
|
|
10251
10384
|
|
|
10252
10385
|
// src/features/rules/junie-rule.ts
|
|
10253
|
-
import { join as
|
|
10386
|
+
import { join as join84 } from "path";
|
|
10254
10387
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
10255
10388
|
static getSettablePaths() {
|
|
10256
10389
|
return {
|
|
@@ -10259,7 +10392,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10259
10392
|
relativeFilePath: "guidelines.md"
|
|
10260
10393
|
},
|
|
10261
10394
|
nonRoot: {
|
|
10262
|
-
relativeDirPath:
|
|
10395
|
+
relativeDirPath: join84(".junie", "memories")
|
|
10263
10396
|
}
|
|
10264
10397
|
};
|
|
10265
10398
|
}
|
|
@@ -10269,8 +10402,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10269
10402
|
validate = true
|
|
10270
10403
|
}) {
|
|
10271
10404
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
10272
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
10273
|
-
const fileContent = await readFileContent(
|
|
10405
|
+
const relativePath = isRoot ? "guidelines.md" : join84(".junie", "memories", relativeFilePath);
|
|
10406
|
+
const fileContent = await readFileContent(join84(baseDir, relativePath));
|
|
10274
10407
|
return new _JunieRule({
|
|
10275
10408
|
baseDir,
|
|
10276
10409
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10325,12 +10458,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10325
10458
|
};
|
|
10326
10459
|
|
|
10327
10460
|
// src/features/rules/kilo-rule.ts
|
|
10328
|
-
import { join as
|
|
10461
|
+
import { join as join85 } from "path";
|
|
10329
10462
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
10330
10463
|
static getSettablePaths(_options = {}) {
|
|
10331
10464
|
return {
|
|
10332
10465
|
nonRoot: {
|
|
10333
|
-
relativeDirPath:
|
|
10466
|
+
relativeDirPath: join85(".kilocode", "rules")
|
|
10334
10467
|
}
|
|
10335
10468
|
};
|
|
10336
10469
|
}
|
|
@@ -10340,7 +10473,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10340
10473
|
validate = true
|
|
10341
10474
|
}) {
|
|
10342
10475
|
const fileContent = await readFileContent(
|
|
10343
|
-
|
|
10476
|
+
join85(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10344
10477
|
);
|
|
10345
10478
|
return new _KiloRule({
|
|
10346
10479
|
baseDir,
|
|
@@ -10392,12 +10525,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10392
10525
|
};
|
|
10393
10526
|
|
|
10394
10527
|
// src/features/rules/kiro-rule.ts
|
|
10395
|
-
import { join as
|
|
10528
|
+
import { join as join86 } from "path";
|
|
10396
10529
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
10397
10530
|
static getSettablePaths() {
|
|
10398
10531
|
return {
|
|
10399
10532
|
nonRoot: {
|
|
10400
|
-
relativeDirPath:
|
|
10533
|
+
relativeDirPath: join86(".kiro", "steering")
|
|
10401
10534
|
}
|
|
10402
10535
|
};
|
|
10403
10536
|
}
|
|
@@ -10407,7 +10540,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10407
10540
|
validate = true
|
|
10408
10541
|
}) {
|
|
10409
10542
|
const fileContent = await readFileContent(
|
|
10410
|
-
|
|
10543
|
+
join86(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10411
10544
|
);
|
|
10412
10545
|
return new _KiroRule({
|
|
10413
10546
|
baseDir,
|
|
@@ -10461,7 +10594,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10461
10594
|
};
|
|
10462
10595
|
|
|
10463
10596
|
// src/features/rules/opencode-rule.ts
|
|
10464
|
-
import { join as
|
|
10597
|
+
import { join as join87 } from "path";
|
|
10465
10598
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
10466
10599
|
static getSettablePaths() {
|
|
10467
10600
|
return {
|
|
@@ -10470,7 +10603,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10470
10603
|
relativeFilePath: "AGENTS.md"
|
|
10471
10604
|
},
|
|
10472
10605
|
nonRoot: {
|
|
10473
|
-
relativeDirPath:
|
|
10606
|
+
relativeDirPath: join87(".opencode", "memories")
|
|
10474
10607
|
}
|
|
10475
10608
|
};
|
|
10476
10609
|
}
|
|
@@ -10480,8 +10613,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10480
10613
|
validate = true
|
|
10481
10614
|
}) {
|
|
10482
10615
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
10483
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
10484
|
-
const fileContent = await readFileContent(
|
|
10616
|
+
const relativePath = isRoot ? "AGENTS.md" : join87(".opencode", "memories", relativeFilePath);
|
|
10617
|
+
const fileContent = await readFileContent(join87(baseDir, relativePath));
|
|
10485
10618
|
return new _OpenCodeRule({
|
|
10486
10619
|
baseDir,
|
|
10487
10620
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10536,7 +10669,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10536
10669
|
};
|
|
10537
10670
|
|
|
10538
10671
|
// src/features/rules/qwencode-rule.ts
|
|
10539
|
-
import { join as
|
|
10672
|
+
import { join as join88 } from "path";
|
|
10540
10673
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
10541
10674
|
static getSettablePaths() {
|
|
10542
10675
|
return {
|
|
@@ -10545,7 +10678,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10545
10678
|
relativeFilePath: "QWEN.md"
|
|
10546
10679
|
},
|
|
10547
10680
|
nonRoot: {
|
|
10548
|
-
relativeDirPath:
|
|
10681
|
+
relativeDirPath: join88(".qwen", "memories")
|
|
10549
10682
|
}
|
|
10550
10683
|
};
|
|
10551
10684
|
}
|
|
@@ -10555,8 +10688,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10555
10688
|
validate = true
|
|
10556
10689
|
}) {
|
|
10557
10690
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
10558
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
10559
|
-
const fileContent = await readFileContent(
|
|
10691
|
+
const relativePath = isRoot ? "QWEN.md" : join88(".qwen", "memories", relativeFilePath);
|
|
10692
|
+
const fileContent = await readFileContent(join88(baseDir, relativePath));
|
|
10560
10693
|
return new _QwencodeRule({
|
|
10561
10694
|
baseDir,
|
|
10562
10695
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10607,13 +10740,101 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10607
10740
|
}
|
|
10608
10741
|
};
|
|
10609
10742
|
|
|
10743
|
+
// src/features/rules/replit-rule.ts
|
|
10744
|
+
import { join as join89 } from "path";
|
|
10745
|
+
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
10746
|
+
static getSettablePaths() {
|
|
10747
|
+
return {
|
|
10748
|
+
root: {
|
|
10749
|
+
relativeDirPath: ".",
|
|
10750
|
+
relativeFilePath: "replit.md"
|
|
10751
|
+
}
|
|
10752
|
+
};
|
|
10753
|
+
}
|
|
10754
|
+
static async fromFile({
|
|
10755
|
+
baseDir = process.cwd(),
|
|
10756
|
+
relativeFilePath,
|
|
10757
|
+
validate = true
|
|
10758
|
+
}) {
|
|
10759
|
+
const paths = this.getSettablePaths();
|
|
10760
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
10761
|
+
if (!isRoot) {
|
|
10762
|
+
throw new Error("ReplitRule only supports root rules");
|
|
10763
|
+
}
|
|
10764
|
+
const relativePath = paths.root.relativeFilePath;
|
|
10765
|
+
const fileContent = await readFileContent(
|
|
10766
|
+
join89(baseDir, paths.root.relativeDirPath, relativePath)
|
|
10767
|
+
);
|
|
10768
|
+
return new _ReplitRule({
|
|
10769
|
+
baseDir,
|
|
10770
|
+
relativeDirPath: paths.root.relativeDirPath,
|
|
10771
|
+
relativeFilePath: paths.root.relativeFilePath,
|
|
10772
|
+
fileContent,
|
|
10773
|
+
validate,
|
|
10774
|
+
root: true
|
|
10775
|
+
});
|
|
10776
|
+
}
|
|
10777
|
+
static fromRulesyncRule({
|
|
10778
|
+
baseDir = process.cwd(),
|
|
10779
|
+
rulesyncRule,
|
|
10780
|
+
validate = true
|
|
10781
|
+
}) {
|
|
10782
|
+
const paths = this.getSettablePaths();
|
|
10783
|
+
const isRoot = rulesyncRule.getFrontmatter().root ?? false;
|
|
10784
|
+
if (!isRoot) {
|
|
10785
|
+
throw new Error("ReplitRule only supports root rules");
|
|
10786
|
+
}
|
|
10787
|
+
return new _ReplitRule(
|
|
10788
|
+
this.buildToolRuleParamsDefault({
|
|
10789
|
+
baseDir,
|
|
10790
|
+
rulesyncRule,
|
|
10791
|
+
validate,
|
|
10792
|
+
rootPath: paths.root,
|
|
10793
|
+
nonRootPath: void 0
|
|
10794
|
+
})
|
|
10795
|
+
);
|
|
10796
|
+
}
|
|
10797
|
+
toRulesyncRule() {
|
|
10798
|
+
return this.toRulesyncRuleDefault();
|
|
10799
|
+
}
|
|
10800
|
+
validate() {
|
|
10801
|
+
return { success: true, error: null };
|
|
10802
|
+
}
|
|
10803
|
+
static forDeletion({
|
|
10804
|
+
baseDir = process.cwd(),
|
|
10805
|
+
relativeDirPath,
|
|
10806
|
+
relativeFilePath
|
|
10807
|
+
}) {
|
|
10808
|
+
const paths = this.getSettablePaths();
|
|
10809
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
10810
|
+
return new _ReplitRule({
|
|
10811
|
+
baseDir,
|
|
10812
|
+
relativeDirPath,
|
|
10813
|
+
relativeFilePath,
|
|
10814
|
+
fileContent: "",
|
|
10815
|
+
validate: false,
|
|
10816
|
+
root: isRoot
|
|
10817
|
+
});
|
|
10818
|
+
}
|
|
10819
|
+
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
10820
|
+
const isRoot = rulesyncRule.getFrontmatter().root ?? false;
|
|
10821
|
+
if (!isRoot) {
|
|
10822
|
+
return false;
|
|
10823
|
+
}
|
|
10824
|
+
return this.isTargetedByRulesyncRuleDefault({
|
|
10825
|
+
rulesyncRule,
|
|
10826
|
+
toolTarget: "replit"
|
|
10827
|
+
});
|
|
10828
|
+
}
|
|
10829
|
+
};
|
|
10830
|
+
|
|
10610
10831
|
// src/features/rules/roo-rule.ts
|
|
10611
|
-
import { join as
|
|
10832
|
+
import { join as join90 } from "path";
|
|
10612
10833
|
var RooRule = class _RooRule extends ToolRule {
|
|
10613
10834
|
static getSettablePaths() {
|
|
10614
10835
|
return {
|
|
10615
10836
|
nonRoot: {
|
|
10616
|
-
relativeDirPath:
|
|
10837
|
+
relativeDirPath: join90(".roo", "rules")
|
|
10617
10838
|
}
|
|
10618
10839
|
};
|
|
10619
10840
|
}
|
|
@@ -10623,7 +10844,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10623
10844
|
validate = true
|
|
10624
10845
|
}) {
|
|
10625
10846
|
const fileContent = await readFileContent(
|
|
10626
|
-
|
|
10847
|
+
join90(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10627
10848
|
);
|
|
10628
10849
|
return new _RooRule({
|
|
10629
10850
|
baseDir,
|
|
@@ -10692,7 +10913,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10692
10913
|
};
|
|
10693
10914
|
|
|
10694
10915
|
// src/features/rules/warp-rule.ts
|
|
10695
|
-
import { join as
|
|
10916
|
+
import { join as join91 } from "path";
|
|
10696
10917
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
10697
10918
|
constructor({ fileContent, root, ...rest }) {
|
|
10698
10919
|
super({
|
|
@@ -10708,7 +10929,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10708
10929
|
relativeFilePath: "WARP.md"
|
|
10709
10930
|
},
|
|
10710
10931
|
nonRoot: {
|
|
10711
|
-
relativeDirPath:
|
|
10932
|
+
relativeDirPath: join91(".warp", "memories")
|
|
10712
10933
|
}
|
|
10713
10934
|
};
|
|
10714
10935
|
}
|
|
@@ -10718,8 +10939,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10718
10939
|
validate = true
|
|
10719
10940
|
}) {
|
|
10720
10941
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
10721
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
10722
|
-
const fileContent = await readFileContent(
|
|
10942
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join91(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10943
|
+
const fileContent = await readFileContent(join91(baseDir, relativePath));
|
|
10723
10944
|
return new _WarpRule({
|
|
10724
10945
|
baseDir,
|
|
10725
10946
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -10774,12 +10995,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10774
10995
|
};
|
|
10775
10996
|
|
|
10776
10997
|
// src/features/rules/windsurf-rule.ts
|
|
10777
|
-
import { join as
|
|
10998
|
+
import { join as join92 } from "path";
|
|
10778
10999
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
10779
11000
|
static getSettablePaths() {
|
|
10780
11001
|
return {
|
|
10781
11002
|
nonRoot: {
|
|
10782
|
-
relativeDirPath:
|
|
11003
|
+
relativeDirPath: join92(".windsurf", "rules")
|
|
10783
11004
|
}
|
|
10784
11005
|
};
|
|
10785
11006
|
}
|
|
@@ -10789,7 +11010,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
10789
11010
|
validate = true
|
|
10790
11011
|
}) {
|
|
10791
11012
|
const fileContent = await readFileContent(
|
|
10792
|
-
|
|
11013
|
+
join92(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10793
11014
|
);
|
|
10794
11015
|
return new _WindsurfRule({
|
|
10795
11016
|
baseDir,
|
|
@@ -10858,6 +11079,7 @@ var rulesProcessorToolTargets = [
|
|
|
10858
11079
|
"kiro",
|
|
10859
11080
|
"opencode",
|
|
10860
11081
|
"qwencode",
|
|
11082
|
+
"replit",
|
|
10861
11083
|
"roo",
|
|
10862
11084
|
"warp",
|
|
10863
11085
|
"windsurf"
|
|
@@ -11012,6 +11234,13 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
11012
11234
|
meta: { extension: "md", supportsGlobal: false, ruleDiscoveryMode: "toon" }
|
|
11013
11235
|
}
|
|
11014
11236
|
],
|
|
11237
|
+
[
|
|
11238
|
+
"replit",
|
|
11239
|
+
{
|
|
11240
|
+
class: ReplitRule,
|
|
11241
|
+
meta: { extension: "md", supportsGlobal: false, ruleDiscoveryMode: "auto" }
|
|
11242
|
+
}
|
|
11243
|
+
],
|
|
11015
11244
|
[
|
|
11016
11245
|
"roo",
|
|
11017
11246
|
{
|
|
@@ -11146,7 +11375,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11146
11375
|
}).relativeDirPath;
|
|
11147
11376
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
11148
11377
|
const frontmatter = skill.getFrontmatter();
|
|
11149
|
-
const relativePath =
|
|
11378
|
+
const relativePath = join93(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
11150
11379
|
return {
|
|
11151
11380
|
name: frontmatter.name,
|
|
11152
11381
|
description: frontmatter.description,
|
|
@@ -11213,10 +11442,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11213
11442
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
11214
11443
|
*/
|
|
11215
11444
|
async loadRulesyncFiles() {
|
|
11216
|
-
const files = await findFilesByGlobs(
|
|
11445
|
+
const files = await findFilesByGlobs(join93(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
11217
11446
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
11218
11447
|
const rulesyncRules = await Promise.all(
|
|
11219
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath:
|
|
11448
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename24(file) }))
|
|
11220
11449
|
);
|
|
11221
11450
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
11222
11451
|
if (rootRules.length > 1) {
|
|
@@ -11234,10 +11463,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11234
11463
|
return rulesyncRules;
|
|
11235
11464
|
}
|
|
11236
11465
|
async loadRulesyncFilesLegacy() {
|
|
11237
|
-
const legacyFiles = await findFilesByGlobs(
|
|
11466
|
+
const legacyFiles = await findFilesByGlobs(join93(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
11238
11467
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
11239
11468
|
return Promise.all(
|
|
11240
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath:
|
|
11469
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename24(file) }))
|
|
11241
11470
|
);
|
|
11242
11471
|
}
|
|
11243
11472
|
/**
|
|
@@ -11255,7 +11484,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11255
11484
|
return [];
|
|
11256
11485
|
}
|
|
11257
11486
|
const rootFilePaths = await findFilesByGlobs(
|
|
11258
|
-
|
|
11487
|
+
join93(
|
|
11259
11488
|
this.baseDir,
|
|
11260
11489
|
settablePaths.root.relativeDirPath ?? ".",
|
|
11261
11490
|
settablePaths.root.relativeFilePath
|
|
@@ -11266,7 +11495,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11266
11495
|
(filePath) => factory.class.forDeletion({
|
|
11267
11496
|
baseDir: this.baseDir,
|
|
11268
11497
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
11269
|
-
relativeFilePath:
|
|
11498
|
+
relativeFilePath: basename24(filePath),
|
|
11270
11499
|
global: this.global
|
|
11271
11500
|
})
|
|
11272
11501
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11275,7 +11504,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11275
11504
|
rootFilePaths.map(
|
|
11276
11505
|
(filePath) => factory.class.fromFile({
|
|
11277
11506
|
baseDir: this.baseDir,
|
|
11278
|
-
relativeFilePath:
|
|
11507
|
+
relativeFilePath: basename24(filePath),
|
|
11279
11508
|
global: this.global
|
|
11280
11509
|
})
|
|
11281
11510
|
)
|
|
@@ -11287,14 +11516,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11287
11516
|
return [];
|
|
11288
11517
|
}
|
|
11289
11518
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
11290
|
-
|
|
11519
|
+
join93(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
11291
11520
|
);
|
|
11292
11521
|
if (forDeletion) {
|
|
11293
11522
|
return nonRootFilePaths.map(
|
|
11294
11523
|
(filePath) => factory.class.forDeletion({
|
|
11295
11524
|
baseDir: this.baseDir,
|
|
11296
11525
|
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
11297
|
-
relativeFilePath:
|
|
11526
|
+
relativeFilePath: basename24(filePath),
|
|
11298
11527
|
global: this.global
|
|
11299
11528
|
})
|
|
11300
11529
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11303,7 +11532,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11303
11532
|
nonRootFilePaths.map(
|
|
11304
11533
|
(filePath) => factory.class.fromFile({
|
|
11305
11534
|
baseDir: this.baseDir,
|
|
11306
|
-
relativeFilePath:
|
|
11535
|
+
relativeFilePath: basename24(filePath),
|
|
11307
11536
|
global: this.global
|
|
11308
11537
|
})
|
|
11309
11538
|
)
|
|
@@ -11396,14 +11625,14 @@ s/<command> [arguments]
|
|
|
11396
11625
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
11397
11626
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
11398
11627
|
|
|
11399
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
11628
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join93(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
11400
11629
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
11401
11630
|
|
|
11402
11631
|
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.
|
|
11403
11632
|
|
|
11404
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
11633
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join93(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
11405
11634
|
|
|
11406
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
11635
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join93(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
11407
11636
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
11408
11637
|
const result = [
|
|
11409
11638
|
overview,
|
|
@@ -11685,7 +11914,7 @@ async function generateSkills(config) {
|
|
|
11685
11914
|
}
|
|
11686
11915
|
|
|
11687
11916
|
// src/cli/commands/gitignore.ts
|
|
11688
|
-
import { join as
|
|
11917
|
+
import { join as join94 } from "path";
|
|
11689
11918
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
11690
11919
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
11691
11920
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -11748,6 +11977,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11748
11977
|
"**/.kilocodeignore",
|
|
11749
11978
|
// Kiro
|
|
11750
11979
|
"**/.kiro/steering/",
|
|
11980
|
+
"**/.kiro/prompts/",
|
|
11751
11981
|
"**/.kiro/settings/mcp.json",
|
|
11752
11982
|
"**/.aiignore",
|
|
11753
11983
|
// OpenCode
|
|
@@ -11758,6 +11988,8 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11758
11988
|
// Qwen
|
|
11759
11989
|
"**/QWEN.md",
|
|
11760
11990
|
"**/.qwen/memories/",
|
|
11991
|
+
// Replit
|
|
11992
|
+
"**/replit.md",
|
|
11761
11993
|
// Roo
|
|
11762
11994
|
"**/.roo/rules/",
|
|
11763
11995
|
"**/.roo/skills/",
|
|
@@ -11821,7 +12053,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
11821
12053
|
return result;
|
|
11822
12054
|
};
|
|
11823
12055
|
var gitignoreCommand = async () => {
|
|
11824
|
-
const gitignorePath =
|
|
12056
|
+
const gitignorePath = join94(process.cwd(), ".gitignore");
|
|
11825
12057
|
let gitignoreContent = "";
|
|
11826
12058
|
if (await fileExists(gitignorePath)) {
|
|
11827
12059
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -12020,7 +12252,7 @@ async function importSkills(config, tool) {
|
|
|
12020
12252
|
}
|
|
12021
12253
|
|
|
12022
12254
|
// src/cli/commands/init.ts
|
|
12023
|
-
import { join as
|
|
12255
|
+
import { join as join95 } from "path";
|
|
12024
12256
|
async function initCommand() {
|
|
12025
12257
|
logger.info("Initializing rulesync...");
|
|
12026
12258
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -12198,14 +12430,14 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12198
12430
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
12199
12431
|
await ensureDir(skillPaths.relativeDirPath);
|
|
12200
12432
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
12201
|
-
const ruleFilepath =
|
|
12433
|
+
const ruleFilepath = join95(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
12202
12434
|
if (!await fileExists(ruleFilepath)) {
|
|
12203
12435
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
12204
12436
|
logger.success(`Created ${ruleFilepath}`);
|
|
12205
12437
|
} else {
|
|
12206
12438
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
12207
12439
|
}
|
|
12208
|
-
const mcpFilepath =
|
|
12440
|
+
const mcpFilepath = join95(
|
|
12209
12441
|
mcpPaths.recommended.relativeDirPath,
|
|
12210
12442
|
mcpPaths.recommended.relativeFilePath
|
|
12211
12443
|
);
|
|
@@ -12215,30 +12447,30 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12215
12447
|
} else {
|
|
12216
12448
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
12217
12449
|
}
|
|
12218
|
-
const commandFilepath =
|
|
12450
|
+
const commandFilepath = join95(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
12219
12451
|
if (!await fileExists(commandFilepath)) {
|
|
12220
12452
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
12221
12453
|
logger.success(`Created ${commandFilepath}`);
|
|
12222
12454
|
} else {
|
|
12223
12455
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
12224
12456
|
}
|
|
12225
|
-
const subagentFilepath =
|
|
12457
|
+
const subagentFilepath = join95(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
12226
12458
|
if (!await fileExists(subagentFilepath)) {
|
|
12227
12459
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
12228
12460
|
logger.success(`Created ${subagentFilepath}`);
|
|
12229
12461
|
} else {
|
|
12230
12462
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
12231
12463
|
}
|
|
12232
|
-
const skillDirPath =
|
|
12464
|
+
const skillDirPath = join95(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
12233
12465
|
await ensureDir(skillDirPath);
|
|
12234
|
-
const skillFilepath =
|
|
12466
|
+
const skillFilepath = join95(skillDirPath, SKILL_FILE_NAME);
|
|
12235
12467
|
if (!await fileExists(skillFilepath)) {
|
|
12236
12468
|
await writeFileContent(skillFilepath, sampleSkillFile.content);
|
|
12237
12469
|
logger.success(`Created ${skillFilepath}`);
|
|
12238
12470
|
} else {
|
|
12239
12471
|
logger.info(`Skipped ${skillFilepath} (already exists)`);
|
|
12240
12472
|
}
|
|
12241
|
-
const ignoreFilepath =
|
|
12473
|
+
const ignoreFilepath = join95(
|
|
12242
12474
|
ignorePaths.recommended.relativeDirPath,
|
|
12243
12475
|
ignorePaths.recommended.relativeFilePath
|
|
12244
12476
|
);
|
|
@@ -12257,12 +12489,12 @@ import { FastMCP } from "fastmcp";
|
|
|
12257
12489
|
import { z as z49 } from "zod/mini";
|
|
12258
12490
|
|
|
12259
12491
|
// src/mcp/commands.ts
|
|
12260
|
-
import { basename as
|
|
12492
|
+
import { basename as basename25, join as join96 } from "path";
|
|
12261
12493
|
import { z as z43 } from "zod/mini";
|
|
12262
12494
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
12263
12495
|
var maxCommandsCount = 1e3;
|
|
12264
12496
|
async function listCommands() {
|
|
12265
|
-
const commandsDir =
|
|
12497
|
+
const commandsDir = join96(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12266
12498
|
try {
|
|
12267
12499
|
const files = await listDirectoryFiles(commandsDir);
|
|
12268
12500
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12274,7 +12506,7 @@ async function listCommands() {
|
|
|
12274
12506
|
});
|
|
12275
12507
|
const frontmatter = command.getFrontmatter();
|
|
12276
12508
|
return {
|
|
12277
|
-
relativePathFromCwd:
|
|
12509
|
+
relativePathFromCwd: join96(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
12278
12510
|
frontmatter
|
|
12279
12511
|
};
|
|
12280
12512
|
} catch (error) {
|
|
@@ -12294,13 +12526,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
12294
12526
|
relativePath: relativePathFromCwd,
|
|
12295
12527
|
intendedRootDir: process.cwd()
|
|
12296
12528
|
});
|
|
12297
|
-
const filename =
|
|
12529
|
+
const filename = basename25(relativePathFromCwd);
|
|
12298
12530
|
try {
|
|
12299
12531
|
const command = await RulesyncCommand.fromFile({
|
|
12300
12532
|
relativeFilePath: filename
|
|
12301
12533
|
});
|
|
12302
12534
|
return {
|
|
12303
|
-
relativePathFromCwd:
|
|
12535
|
+
relativePathFromCwd: join96(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12304
12536
|
frontmatter: command.getFrontmatter(),
|
|
12305
12537
|
body: command.getBody()
|
|
12306
12538
|
};
|
|
@@ -12319,7 +12551,7 @@ async function putCommand({
|
|
|
12319
12551
|
relativePath: relativePathFromCwd,
|
|
12320
12552
|
intendedRootDir: process.cwd()
|
|
12321
12553
|
});
|
|
12322
|
-
const filename =
|
|
12554
|
+
const filename = basename25(relativePathFromCwd);
|
|
12323
12555
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12324
12556
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
12325
12557
|
throw new Error(
|
|
@@ -12329,7 +12561,7 @@ async function putCommand({
|
|
|
12329
12561
|
try {
|
|
12330
12562
|
const existingCommands = await listCommands();
|
|
12331
12563
|
const isUpdate = existingCommands.some(
|
|
12332
|
-
(command2) => command2.relativePathFromCwd ===
|
|
12564
|
+
(command2) => command2.relativePathFromCwd === join96(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12333
12565
|
);
|
|
12334
12566
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
12335
12567
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -12344,11 +12576,11 @@ async function putCommand({
|
|
|
12344
12576
|
fileContent,
|
|
12345
12577
|
validate: true
|
|
12346
12578
|
});
|
|
12347
|
-
const commandsDir =
|
|
12579
|
+
const commandsDir = join96(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12348
12580
|
await ensureDir(commandsDir);
|
|
12349
12581
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
12350
12582
|
return {
|
|
12351
|
-
relativePathFromCwd:
|
|
12583
|
+
relativePathFromCwd: join96(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12352
12584
|
frontmatter: command.getFrontmatter(),
|
|
12353
12585
|
body: command.getBody()
|
|
12354
12586
|
};
|
|
@@ -12363,12 +12595,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12363
12595
|
relativePath: relativePathFromCwd,
|
|
12364
12596
|
intendedRootDir: process.cwd()
|
|
12365
12597
|
});
|
|
12366
|
-
const filename =
|
|
12367
|
-
const fullPath =
|
|
12598
|
+
const filename = basename25(relativePathFromCwd);
|
|
12599
|
+
const fullPath = join96(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
12368
12600
|
try {
|
|
12369
12601
|
await removeFile(fullPath);
|
|
12370
12602
|
return {
|
|
12371
|
-
relativePathFromCwd:
|
|
12603
|
+
relativePathFromCwd: join96(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12372
12604
|
};
|
|
12373
12605
|
} catch (error) {
|
|
12374
12606
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12393,7 +12625,7 @@ var commandToolSchemas = {
|
|
|
12393
12625
|
var commandTools = {
|
|
12394
12626
|
listCommands: {
|
|
12395
12627
|
name: "listCommands",
|
|
12396
|
-
description: `List all commands from ${
|
|
12628
|
+
description: `List all commands from ${join96(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12397
12629
|
parameters: commandToolSchemas.listCommands,
|
|
12398
12630
|
execute: async () => {
|
|
12399
12631
|
const commands = await listCommands();
|
|
@@ -12435,11 +12667,11 @@ var commandTools = {
|
|
|
12435
12667
|
};
|
|
12436
12668
|
|
|
12437
12669
|
// src/mcp/ignore.ts
|
|
12438
|
-
import { join as
|
|
12670
|
+
import { join as join97 } from "path";
|
|
12439
12671
|
import { z as z44 } from "zod/mini";
|
|
12440
12672
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
12441
12673
|
async function getIgnoreFile() {
|
|
12442
|
-
const ignoreFilePath =
|
|
12674
|
+
const ignoreFilePath = join97(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12443
12675
|
try {
|
|
12444
12676
|
const content = await readFileContent(ignoreFilePath);
|
|
12445
12677
|
return {
|
|
@@ -12453,7 +12685,7 @@ async function getIgnoreFile() {
|
|
|
12453
12685
|
}
|
|
12454
12686
|
}
|
|
12455
12687
|
async function putIgnoreFile({ content }) {
|
|
12456
|
-
const ignoreFilePath =
|
|
12688
|
+
const ignoreFilePath = join97(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12457
12689
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
12458
12690
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
12459
12691
|
throw new Error(
|
|
@@ -12474,8 +12706,8 @@ async function putIgnoreFile({ content }) {
|
|
|
12474
12706
|
}
|
|
12475
12707
|
}
|
|
12476
12708
|
async function deleteIgnoreFile() {
|
|
12477
|
-
const aiignorePath =
|
|
12478
|
-
const legacyIgnorePath =
|
|
12709
|
+
const aiignorePath = join97(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12710
|
+
const legacyIgnorePath = join97(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
12479
12711
|
try {
|
|
12480
12712
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
12481
12713
|
return {
|
|
@@ -12530,7 +12762,7 @@ var ignoreTools = {
|
|
|
12530
12762
|
};
|
|
12531
12763
|
|
|
12532
12764
|
// src/mcp/mcp.ts
|
|
12533
|
-
import { join as
|
|
12765
|
+
import { join as join98 } from "path";
|
|
12534
12766
|
import { z as z45 } from "zod/mini";
|
|
12535
12767
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
12536
12768
|
async function getMcpFile() {
|
|
@@ -12540,7 +12772,7 @@ async function getMcpFile() {
|
|
|
12540
12772
|
validate: true,
|
|
12541
12773
|
modularMcp: config.getModularMcp()
|
|
12542
12774
|
});
|
|
12543
|
-
const relativePathFromCwd =
|
|
12775
|
+
const relativePathFromCwd = join98(
|
|
12544
12776
|
rulesyncMcp.getRelativeDirPath(),
|
|
12545
12777
|
rulesyncMcp.getRelativeFilePath()
|
|
12546
12778
|
);
|
|
@@ -12573,7 +12805,7 @@ async function putMcpFile({ content }) {
|
|
|
12573
12805
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12574
12806
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
12575
12807
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
12576
|
-
const fullPath =
|
|
12808
|
+
const fullPath = join98(baseDir, relativeDirPath, relativeFilePath);
|
|
12577
12809
|
const rulesyncMcp = new RulesyncMcp({
|
|
12578
12810
|
baseDir,
|
|
12579
12811
|
relativeDirPath,
|
|
@@ -12582,9 +12814,9 @@ async function putMcpFile({ content }) {
|
|
|
12582
12814
|
validate: true,
|
|
12583
12815
|
modularMcp: config.getModularMcp()
|
|
12584
12816
|
});
|
|
12585
|
-
await ensureDir(
|
|
12817
|
+
await ensureDir(join98(baseDir, relativeDirPath));
|
|
12586
12818
|
await writeFileContent(fullPath, content);
|
|
12587
|
-
const relativePathFromCwd =
|
|
12819
|
+
const relativePathFromCwd = join98(relativeDirPath, relativeFilePath);
|
|
12588
12820
|
return {
|
|
12589
12821
|
relativePathFromCwd,
|
|
12590
12822
|
content: rulesyncMcp.getFileContent()
|
|
@@ -12599,15 +12831,15 @@ async function deleteMcpFile() {
|
|
|
12599
12831
|
try {
|
|
12600
12832
|
const baseDir = process.cwd();
|
|
12601
12833
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12602
|
-
const recommendedPath =
|
|
12834
|
+
const recommendedPath = join98(
|
|
12603
12835
|
baseDir,
|
|
12604
12836
|
paths.recommended.relativeDirPath,
|
|
12605
12837
|
paths.recommended.relativeFilePath
|
|
12606
12838
|
);
|
|
12607
|
-
const legacyPath =
|
|
12839
|
+
const legacyPath = join98(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
12608
12840
|
await removeFile(recommendedPath);
|
|
12609
12841
|
await removeFile(legacyPath);
|
|
12610
|
-
const relativePathFromCwd =
|
|
12842
|
+
const relativePathFromCwd = join98(
|
|
12611
12843
|
paths.recommended.relativeDirPath,
|
|
12612
12844
|
paths.recommended.relativeFilePath
|
|
12613
12845
|
);
|
|
@@ -12658,12 +12890,12 @@ var mcpTools = {
|
|
|
12658
12890
|
};
|
|
12659
12891
|
|
|
12660
12892
|
// src/mcp/rules.ts
|
|
12661
|
-
import { basename as
|
|
12893
|
+
import { basename as basename26, join as join99 } from "path";
|
|
12662
12894
|
import { z as z46 } from "zod/mini";
|
|
12663
12895
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
12664
12896
|
var maxRulesCount = 1e3;
|
|
12665
12897
|
async function listRules() {
|
|
12666
|
-
const rulesDir =
|
|
12898
|
+
const rulesDir = join99(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12667
12899
|
try {
|
|
12668
12900
|
const files = await listDirectoryFiles(rulesDir);
|
|
12669
12901
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12676,7 +12908,7 @@ async function listRules() {
|
|
|
12676
12908
|
});
|
|
12677
12909
|
const frontmatter = rule.getFrontmatter();
|
|
12678
12910
|
return {
|
|
12679
|
-
relativePathFromCwd:
|
|
12911
|
+
relativePathFromCwd: join99(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
12680
12912
|
frontmatter
|
|
12681
12913
|
};
|
|
12682
12914
|
} catch (error) {
|
|
@@ -12696,14 +12928,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
12696
12928
|
relativePath: relativePathFromCwd,
|
|
12697
12929
|
intendedRootDir: process.cwd()
|
|
12698
12930
|
});
|
|
12699
|
-
const filename =
|
|
12931
|
+
const filename = basename26(relativePathFromCwd);
|
|
12700
12932
|
try {
|
|
12701
12933
|
const rule = await RulesyncRule.fromFile({
|
|
12702
12934
|
relativeFilePath: filename,
|
|
12703
12935
|
validate: true
|
|
12704
12936
|
});
|
|
12705
12937
|
return {
|
|
12706
|
-
relativePathFromCwd:
|
|
12938
|
+
relativePathFromCwd: join99(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12707
12939
|
frontmatter: rule.getFrontmatter(),
|
|
12708
12940
|
body: rule.getBody()
|
|
12709
12941
|
};
|
|
@@ -12722,7 +12954,7 @@ async function putRule({
|
|
|
12722
12954
|
relativePath: relativePathFromCwd,
|
|
12723
12955
|
intendedRootDir: process.cwd()
|
|
12724
12956
|
});
|
|
12725
|
-
const filename =
|
|
12957
|
+
const filename = basename26(relativePathFromCwd);
|
|
12726
12958
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12727
12959
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
12728
12960
|
throw new Error(
|
|
@@ -12732,7 +12964,7 @@ async function putRule({
|
|
|
12732
12964
|
try {
|
|
12733
12965
|
const existingRules = await listRules();
|
|
12734
12966
|
const isUpdate = existingRules.some(
|
|
12735
|
-
(rule2) => rule2.relativePathFromCwd ===
|
|
12967
|
+
(rule2) => rule2.relativePathFromCwd === join99(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12736
12968
|
);
|
|
12737
12969
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
12738
12970
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -12745,11 +12977,11 @@ async function putRule({
|
|
|
12745
12977
|
body,
|
|
12746
12978
|
validate: true
|
|
12747
12979
|
});
|
|
12748
|
-
const rulesDir =
|
|
12980
|
+
const rulesDir = join99(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12749
12981
|
await ensureDir(rulesDir);
|
|
12750
12982
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
12751
12983
|
return {
|
|
12752
|
-
relativePathFromCwd:
|
|
12984
|
+
relativePathFromCwd: join99(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12753
12985
|
frontmatter: rule.getFrontmatter(),
|
|
12754
12986
|
body: rule.getBody()
|
|
12755
12987
|
};
|
|
@@ -12764,12 +12996,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
12764
12996
|
relativePath: relativePathFromCwd,
|
|
12765
12997
|
intendedRootDir: process.cwd()
|
|
12766
12998
|
});
|
|
12767
|
-
const filename =
|
|
12768
|
-
const fullPath =
|
|
12999
|
+
const filename = basename26(relativePathFromCwd);
|
|
13000
|
+
const fullPath = join99(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
12769
13001
|
try {
|
|
12770
13002
|
await removeFile(fullPath);
|
|
12771
13003
|
return {
|
|
12772
|
-
relativePathFromCwd:
|
|
13004
|
+
relativePathFromCwd: join99(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12773
13005
|
};
|
|
12774
13006
|
} catch (error) {
|
|
12775
13007
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12794,7 +13026,7 @@ var ruleToolSchemas = {
|
|
|
12794
13026
|
var ruleTools = {
|
|
12795
13027
|
listRules: {
|
|
12796
13028
|
name: "listRules",
|
|
12797
|
-
description: `List all rules from ${
|
|
13029
|
+
description: `List all rules from ${join99(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12798
13030
|
parameters: ruleToolSchemas.listRules,
|
|
12799
13031
|
execute: async () => {
|
|
12800
13032
|
const rules = await listRules();
|
|
@@ -12836,7 +13068,7 @@ var ruleTools = {
|
|
|
12836
13068
|
};
|
|
12837
13069
|
|
|
12838
13070
|
// src/mcp/skills.ts
|
|
12839
|
-
import { basename as
|
|
13071
|
+
import { basename as basename27, dirname as dirname2, join as join100 } from "path";
|
|
12840
13072
|
import { z as z47 } from "zod/mini";
|
|
12841
13073
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
12842
13074
|
var maxSkillsCount = 1e3;
|
|
@@ -12853,19 +13085,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
12853
13085
|
};
|
|
12854
13086
|
}
|
|
12855
13087
|
function extractDirName(relativeDirPathFromCwd) {
|
|
12856
|
-
const dirName =
|
|
13088
|
+
const dirName = basename27(relativeDirPathFromCwd);
|
|
12857
13089
|
if (!dirName) {
|
|
12858
13090
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
12859
13091
|
}
|
|
12860
13092
|
return dirName;
|
|
12861
13093
|
}
|
|
12862
13094
|
async function listSkills() {
|
|
12863
|
-
const skillsDir =
|
|
13095
|
+
const skillsDir = join100(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
12864
13096
|
try {
|
|
12865
|
-
const skillDirPaths = await findFilesByGlobs(
|
|
13097
|
+
const skillDirPaths = await findFilesByGlobs(join100(skillsDir, "*"), { type: "dir" });
|
|
12866
13098
|
const skills = await Promise.all(
|
|
12867
13099
|
skillDirPaths.map(async (dirPath) => {
|
|
12868
|
-
const dirName =
|
|
13100
|
+
const dirName = basename27(dirPath);
|
|
12869
13101
|
if (!dirName) return null;
|
|
12870
13102
|
try {
|
|
12871
13103
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -12873,7 +13105,7 @@ async function listSkills() {
|
|
|
12873
13105
|
});
|
|
12874
13106
|
const frontmatter = skill.getFrontmatter();
|
|
12875
13107
|
return {
|
|
12876
|
-
relativeDirPathFromCwd:
|
|
13108
|
+
relativeDirPathFromCwd: join100(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12877
13109
|
frontmatter
|
|
12878
13110
|
};
|
|
12879
13111
|
} catch (error) {
|
|
@@ -12899,7 +13131,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
12899
13131
|
dirName
|
|
12900
13132
|
});
|
|
12901
13133
|
return {
|
|
12902
|
-
relativeDirPathFromCwd:
|
|
13134
|
+
relativeDirPathFromCwd: join100(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12903
13135
|
frontmatter: skill.getFrontmatter(),
|
|
12904
13136
|
body: skill.getBody(),
|
|
12905
13137
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12933,7 +13165,7 @@ async function putSkill({
|
|
|
12933
13165
|
try {
|
|
12934
13166
|
const existingSkills = await listSkills();
|
|
12935
13167
|
const isUpdate = existingSkills.some(
|
|
12936
|
-
(skill2) => skill2.relativeDirPathFromCwd ===
|
|
13168
|
+
(skill2) => skill2.relativeDirPathFromCwd === join100(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12937
13169
|
);
|
|
12938
13170
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
12939
13171
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -12948,9 +13180,9 @@ async function putSkill({
|
|
|
12948
13180
|
otherFiles: aiDirFiles,
|
|
12949
13181
|
validate: true
|
|
12950
13182
|
});
|
|
12951
|
-
const skillDirPath =
|
|
13183
|
+
const skillDirPath = join100(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12952
13184
|
await ensureDir(skillDirPath);
|
|
12953
|
-
const skillFilePath =
|
|
13185
|
+
const skillFilePath = join100(skillDirPath, SKILL_FILE_NAME);
|
|
12954
13186
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
12955
13187
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
12956
13188
|
for (const file of otherFiles) {
|
|
@@ -12958,15 +13190,15 @@ async function putSkill({
|
|
|
12958
13190
|
relativePath: file.name,
|
|
12959
13191
|
intendedRootDir: skillDirPath
|
|
12960
13192
|
});
|
|
12961
|
-
const filePath =
|
|
12962
|
-
const fileDir =
|
|
13193
|
+
const filePath = join100(skillDirPath, file.name);
|
|
13194
|
+
const fileDir = join100(skillDirPath, dirname2(file.name));
|
|
12963
13195
|
if (fileDir !== skillDirPath) {
|
|
12964
13196
|
await ensureDir(fileDir);
|
|
12965
13197
|
}
|
|
12966
13198
|
await writeFileContent(filePath, file.body);
|
|
12967
13199
|
}
|
|
12968
13200
|
return {
|
|
12969
|
-
relativeDirPathFromCwd:
|
|
13201
|
+
relativeDirPathFromCwd: join100(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12970
13202
|
frontmatter: skill.getFrontmatter(),
|
|
12971
13203
|
body: skill.getBody(),
|
|
12972
13204
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12988,13 +13220,13 @@ async function deleteSkill({
|
|
|
12988
13220
|
intendedRootDir: process.cwd()
|
|
12989
13221
|
});
|
|
12990
13222
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
12991
|
-
const skillDirPath =
|
|
13223
|
+
const skillDirPath = join100(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12992
13224
|
try {
|
|
12993
13225
|
if (await directoryExists(skillDirPath)) {
|
|
12994
13226
|
await removeDirectory(skillDirPath);
|
|
12995
13227
|
}
|
|
12996
13228
|
return {
|
|
12997
|
-
relativeDirPathFromCwd:
|
|
13229
|
+
relativeDirPathFromCwd: join100(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12998
13230
|
};
|
|
12999
13231
|
} catch (error) {
|
|
13000
13232
|
throw new Error(
|
|
@@ -13027,7 +13259,7 @@ var skillToolSchemas = {
|
|
|
13027
13259
|
var skillTools = {
|
|
13028
13260
|
listSkills: {
|
|
13029
13261
|
name: "listSkills",
|
|
13030
|
-
description: `List all skills from ${
|
|
13262
|
+
description: `List all skills from ${join100(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
13031
13263
|
parameters: skillToolSchemas.listSkills,
|
|
13032
13264
|
execute: async () => {
|
|
13033
13265
|
const skills = await listSkills();
|
|
@@ -13070,12 +13302,12 @@ var skillTools = {
|
|
|
13070
13302
|
};
|
|
13071
13303
|
|
|
13072
13304
|
// src/mcp/subagents.ts
|
|
13073
|
-
import { basename as
|
|
13305
|
+
import { basename as basename28, join as join101 } from "path";
|
|
13074
13306
|
import { z as z48 } from "zod/mini";
|
|
13075
13307
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
13076
13308
|
var maxSubagentsCount = 1e3;
|
|
13077
13309
|
async function listSubagents() {
|
|
13078
|
-
const subagentsDir =
|
|
13310
|
+
const subagentsDir = join101(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13079
13311
|
try {
|
|
13080
13312
|
const files = await listDirectoryFiles(subagentsDir);
|
|
13081
13313
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13088,7 +13320,7 @@ async function listSubagents() {
|
|
|
13088
13320
|
});
|
|
13089
13321
|
const frontmatter = subagent.getFrontmatter();
|
|
13090
13322
|
return {
|
|
13091
|
-
relativePathFromCwd:
|
|
13323
|
+
relativePathFromCwd: join101(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
13092
13324
|
frontmatter
|
|
13093
13325
|
};
|
|
13094
13326
|
} catch (error) {
|
|
@@ -13110,14 +13342,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
13110
13342
|
relativePath: relativePathFromCwd,
|
|
13111
13343
|
intendedRootDir: process.cwd()
|
|
13112
13344
|
});
|
|
13113
|
-
const filename =
|
|
13345
|
+
const filename = basename28(relativePathFromCwd);
|
|
13114
13346
|
try {
|
|
13115
13347
|
const subagent = await RulesyncSubagent.fromFile({
|
|
13116
13348
|
relativeFilePath: filename,
|
|
13117
13349
|
validate: true
|
|
13118
13350
|
});
|
|
13119
13351
|
return {
|
|
13120
|
-
relativePathFromCwd:
|
|
13352
|
+
relativePathFromCwd: join101(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13121
13353
|
frontmatter: subagent.getFrontmatter(),
|
|
13122
13354
|
body: subagent.getBody()
|
|
13123
13355
|
};
|
|
@@ -13136,7 +13368,7 @@ async function putSubagent({
|
|
|
13136
13368
|
relativePath: relativePathFromCwd,
|
|
13137
13369
|
intendedRootDir: process.cwd()
|
|
13138
13370
|
});
|
|
13139
|
-
const filename =
|
|
13371
|
+
const filename = basename28(relativePathFromCwd);
|
|
13140
13372
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
13141
13373
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
13142
13374
|
throw new Error(
|
|
@@ -13146,7 +13378,7 @@ async function putSubagent({
|
|
|
13146
13378
|
try {
|
|
13147
13379
|
const existingSubagents = await listSubagents();
|
|
13148
13380
|
const isUpdate = existingSubagents.some(
|
|
13149
|
-
(subagent2) => subagent2.relativePathFromCwd ===
|
|
13381
|
+
(subagent2) => subagent2.relativePathFromCwd === join101(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13150
13382
|
);
|
|
13151
13383
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
13152
13384
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -13159,11 +13391,11 @@ async function putSubagent({
|
|
|
13159
13391
|
body,
|
|
13160
13392
|
validate: true
|
|
13161
13393
|
});
|
|
13162
|
-
const subagentsDir =
|
|
13394
|
+
const subagentsDir = join101(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13163
13395
|
await ensureDir(subagentsDir);
|
|
13164
13396
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
13165
13397
|
return {
|
|
13166
|
-
relativePathFromCwd:
|
|
13398
|
+
relativePathFromCwd: join101(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13167
13399
|
frontmatter: subagent.getFrontmatter(),
|
|
13168
13400
|
body: subagent.getBody()
|
|
13169
13401
|
};
|
|
@@ -13178,12 +13410,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
13178
13410
|
relativePath: relativePathFromCwd,
|
|
13179
13411
|
intendedRootDir: process.cwd()
|
|
13180
13412
|
});
|
|
13181
|
-
const filename =
|
|
13182
|
-
const fullPath =
|
|
13413
|
+
const filename = basename28(relativePathFromCwd);
|
|
13414
|
+
const fullPath = join101(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
13183
13415
|
try {
|
|
13184
13416
|
await removeFile(fullPath);
|
|
13185
13417
|
return {
|
|
13186
|
-
relativePathFromCwd:
|
|
13418
|
+
relativePathFromCwd: join101(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13187
13419
|
};
|
|
13188
13420
|
} catch (error) {
|
|
13189
13421
|
throw new Error(
|
|
@@ -13211,7 +13443,7 @@ var subagentToolSchemas = {
|
|
|
13211
13443
|
var subagentTools = {
|
|
13212
13444
|
listSubagents: {
|
|
13213
13445
|
name: "listSubagents",
|
|
13214
|
-
description: `List all subagents from ${
|
|
13446
|
+
description: `List all subagents from ${join101(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13215
13447
|
parameters: subagentToolSchemas.listSubagents,
|
|
13216
13448
|
execute: async () => {
|
|
13217
13449
|
const subagents = await listSubagents();
|
|
@@ -13462,7 +13694,7 @@ async function mcpCommand({ version }) {
|
|
|
13462
13694
|
}
|
|
13463
13695
|
|
|
13464
13696
|
// src/cli/index.ts
|
|
13465
|
-
var getVersion = () => "5.
|
|
13697
|
+
var getVersion = () => "5.5.0";
|
|
13466
13698
|
var main = async () => {
|
|
13467
13699
|
const program = new Command();
|
|
13468
13700
|
const version = getVersion();
|