rulesync 5.3.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 +19 -19
- package/dist/index.cjs +1081 -568
- package/dist/index.js +1074 -561
- 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({
|
|
@@ -4458,8 +4591,84 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4458
4591
|
}
|
|
4459
4592
|
};
|
|
4460
4593
|
|
|
4594
|
+
// src/features/mcp/kiro-mcp.ts
|
|
4595
|
+
import { join as join41 } from "path";
|
|
4596
|
+
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
4597
|
+
json;
|
|
4598
|
+
constructor(params) {
|
|
4599
|
+
super(params);
|
|
4600
|
+
this.json = JSON.parse(this.fileContent || "{}");
|
|
4601
|
+
}
|
|
4602
|
+
getJson() {
|
|
4603
|
+
return this.json;
|
|
4604
|
+
}
|
|
4605
|
+
static getSettablePaths() {
|
|
4606
|
+
return {
|
|
4607
|
+
relativeDirPath: join41(".kiro", "settings"),
|
|
4608
|
+
relativeFilePath: "mcp.json"
|
|
4609
|
+
};
|
|
4610
|
+
}
|
|
4611
|
+
static async fromFile({
|
|
4612
|
+
baseDir = process.cwd(),
|
|
4613
|
+
validate = true
|
|
4614
|
+
}) {
|
|
4615
|
+
const paths = this.getSettablePaths();
|
|
4616
|
+
const fileContent = await readOrInitializeFileContent(
|
|
4617
|
+
join41(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4618
|
+
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4619
|
+
);
|
|
4620
|
+
return new _KiroMcp({
|
|
4621
|
+
baseDir,
|
|
4622
|
+
relativeDirPath: paths.relativeDirPath,
|
|
4623
|
+
relativeFilePath: paths.relativeFilePath,
|
|
4624
|
+
fileContent,
|
|
4625
|
+
validate
|
|
4626
|
+
});
|
|
4627
|
+
}
|
|
4628
|
+
static fromRulesyncMcp({
|
|
4629
|
+
baseDir = process.cwd(),
|
|
4630
|
+
rulesyncMcp,
|
|
4631
|
+
validate = true
|
|
4632
|
+
}) {
|
|
4633
|
+
const paths = this.getSettablePaths();
|
|
4634
|
+
const fileContent = JSON.stringify(
|
|
4635
|
+
{ mcpServers: rulesyncMcp.getMcpServers({ type: "exposed" }) },
|
|
4636
|
+
null,
|
|
4637
|
+
2
|
|
4638
|
+
);
|
|
4639
|
+
return new _KiroMcp({
|
|
4640
|
+
baseDir,
|
|
4641
|
+
relativeDirPath: paths.relativeDirPath,
|
|
4642
|
+
relativeFilePath: paths.relativeFilePath,
|
|
4643
|
+
fileContent,
|
|
4644
|
+
validate
|
|
4645
|
+
});
|
|
4646
|
+
}
|
|
4647
|
+
toRulesyncMcp() {
|
|
4648
|
+
return this.toRulesyncMcpDefault({
|
|
4649
|
+
fileContent: JSON.stringify({ mcpServers: this.json.mcpServers ?? {} }, null, 2)
|
|
4650
|
+
});
|
|
4651
|
+
}
|
|
4652
|
+
validate() {
|
|
4653
|
+
return { success: true, error: null };
|
|
4654
|
+
}
|
|
4655
|
+
static forDeletion({
|
|
4656
|
+
baseDir = process.cwd(),
|
|
4657
|
+
relativeDirPath,
|
|
4658
|
+
relativeFilePath
|
|
4659
|
+
}) {
|
|
4660
|
+
return new _KiroMcp({
|
|
4661
|
+
baseDir,
|
|
4662
|
+
relativeDirPath,
|
|
4663
|
+
relativeFilePath,
|
|
4664
|
+
fileContent: "{}",
|
|
4665
|
+
validate: false
|
|
4666
|
+
});
|
|
4667
|
+
}
|
|
4668
|
+
};
|
|
4669
|
+
|
|
4461
4670
|
// src/features/mcp/opencode-mcp.ts
|
|
4462
|
-
import { join as
|
|
4671
|
+
import { join as join42 } from "path";
|
|
4463
4672
|
import { z as z17 } from "zod/mini";
|
|
4464
4673
|
var OpencodeMcpLocalServerSchema = z17.object({
|
|
4465
4674
|
type: z17.literal("local"),
|
|
@@ -4583,7 +4792,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4583
4792
|
}) {
|
|
4584
4793
|
const paths = this.getSettablePaths({ global });
|
|
4585
4794
|
const fileContent = await readOrInitializeFileContent(
|
|
4586
|
-
|
|
4795
|
+
join42(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4587
4796
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4588
4797
|
);
|
|
4589
4798
|
const json = JSON.parse(fileContent);
|
|
@@ -4604,7 +4813,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4604
4813
|
}) {
|
|
4605
4814
|
const paths = this.getSettablePaths({ global });
|
|
4606
4815
|
const fileContent = await readOrInitializeFileContent(
|
|
4607
|
-
|
|
4816
|
+
join42(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4608
4817
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4609
4818
|
);
|
|
4610
4819
|
const json = JSON.parse(fileContent);
|
|
@@ -4648,7 +4857,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4648
4857
|
};
|
|
4649
4858
|
|
|
4650
4859
|
// src/features/mcp/roo-mcp.ts
|
|
4651
|
-
import { join as
|
|
4860
|
+
import { join as join43 } from "path";
|
|
4652
4861
|
function isRooMcpServers(value) {
|
|
4653
4862
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
4654
4863
|
}
|
|
@@ -4700,7 +4909,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4700
4909
|
validate = true
|
|
4701
4910
|
}) {
|
|
4702
4911
|
const fileContent = await readFileContent(
|
|
4703
|
-
|
|
4912
|
+
join43(
|
|
4704
4913
|
baseDir,
|
|
4705
4914
|
this.getSettablePaths().relativeDirPath,
|
|
4706
4915
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4765,6 +4974,7 @@ var mcpProcessorToolTargetTuple = [
|
|
|
4765
4974
|
"cursor",
|
|
4766
4975
|
"geminicli",
|
|
4767
4976
|
"kilo",
|
|
4977
|
+
"kiro",
|
|
4768
4978
|
"junie",
|
|
4769
4979
|
"opencode",
|
|
4770
4980
|
"roo"
|
|
@@ -4827,6 +5037,13 @@ var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
|
4827
5037
|
meta: { supportsProject: true, supportsGlobal: false, supportsModular: false }
|
|
4828
5038
|
}
|
|
4829
5039
|
],
|
|
5040
|
+
[
|
|
5041
|
+
"kiro",
|
|
5042
|
+
{
|
|
5043
|
+
class: KiroMcp,
|
|
5044
|
+
meta: { supportsProject: true, supportsGlobal: false, supportsModular: false }
|
|
5045
|
+
}
|
|
5046
|
+
],
|
|
4830
5047
|
[
|
|
4831
5048
|
"junie",
|
|
4832
5049
|
{
|
|
@@ -5007,24 +5224,24 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
5007
5224
|
|
|
5008
5225
|
// src/features/rules/rules-processor.ts
|
|
5009
5226
|
import { encode } from "@toon-format/toon";
|
|
5010
|
-
import { basename as
|
|
5011
|
-
import { z as
|
|
5227
|
+
import { basename as basename24, join as join93 } from "path";
|
|
5228
|
+
import { z as z42 } from "zod/mini";
|
|
5012
5229
|
|
|
5013
5230
|
// src/constants/general.ts
|
|
5014
5231
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
5015
5232
|
|
|
5016
5233
|
// src/features/skills/agentsmd-skill.ts
|
|
5017
|
-
import { join as
|
|
5234
|
+
import { join as join47 } from "path";
|
|
5018
5235
|
|
|
5019
5236
|
// src/features/skills/simulated-skill.ts
|
|
5020
|
-
import { join as
|
|
5237
|
+
import { join as join46 } from "path";
|
|
5021
5238
|
import { z as z19 } from "zod/mini";
|
|
5022
5239
|
|
|
5023
5240
|
// src/features/skills/tool-skill.ts
|
|
5024
|
-
import { join as
|
|
5241
|
+
import { join as join45 } from "path";
|
|
5025
5242
|
|
|
5026
5243
|
// src/types/ai-dir.ts
|
|
5027
|
-
import path2, { basename as
|
|
5244
|
+
import path2, { basename as basename16, join as join44, relative as relative3, resolve as resolve4 } from "path";
|
|
5028
5245
|
var AiDir = class {
|
|
5029
5246
|
/**
|
|
5030
5247
|
* @example "."
|
|
@@ -5118,10 +5335,10 @@ var AiDir = class {
|
|
|
5118
5335
|
* @returns Array of files with their relative paths and buffers
|
|
5119
5336
|
*/
|
|
5120
5337
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
5121
|
-
const dirPath =
|
|
5122
|
-
const glob =
|
|
5338
|
+
const dirPath = join44(baseDir, relativeDirPath, dirName);
|
|
5339
|
+
const glob = join44(dirPath, "**", "*");
|
|
5123
5340
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
5124
|
-
const filteredPaths = filePaths.filter((filePath) =>
|
|
5341
|
+
const filteredPaths = filePaths.filter((filePath) => basename16(filePath) !== excludeFileName);
|
|
5125
5342
|
const files = await Promise.all(
|
|
5126
5343
|
filteredPaths.map(async (filePath) => {
|
|
5127
5344
|
const fileBuffer = await readFileBuffer(filePath);
|
|
@@ -5217,8 +5434,8 @@ var ToolSkill = class extends AiDir {
|
|
|
5217
5434
|
}) {
|
|
5218
5435
|
const settablePaths = getSettablePaths({ global });
|
|
5219
5436
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5220
|
-
const skillDirPath =
|
|
5221
|
-
const skillFilePath =
|
|
5437
|
+
const skillDirPath = join45(baseDir, actualRelativeDirPath, dirName);
|
|
5438
|
+
const skillFilePath = join45(skillDirPath, SKILL_FILE_NAME);
|
|
5222
5439
|
if (!await fileExists(skillFilePath)) {
|
|
5223
5440
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5224
5441
|
}
|
|
@@ -5276,7 +5493,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5276
5493
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
5277
5494
|
if (!result.success) {
|
|
5278
5495
|
throw new Error(
|
|
5279
|
-
`Invalid frontmatter in ${
|
|
5496
|
+
`Invalid frontmatter in ${join46(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
5280
5497
|
);
|
|
5281
5498
|
}
|
|
5282
5499
|
}
|
|
@@ -5334,8 +5551,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5334
5551
|
}) {
|
|
5335
5552
|
const settablePaths = this.getSettablePaths();
|
|
5336
5553
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5337
|
-
const skillDirPath =
|
|
5338
|
-
const skillFilePath =
|
|
5554
|
+
const skillDirPath = join46(baseDir, actualRelativeDirPath, dirName);
|
|
5555
|
+
const skillFilePath = join46(skillDirPath, SKILL_FILE_NAME);
|
|
5339
5556
|
if (!await fileExists(skillFilePath)) {
|
|
5340
5557
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5341
5558
|
}
|
|
@@ -5412,7 +5629,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5412
5629
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
5413
5630
|
}
|
|
5414
5631
|
return {
|
|
5415
|
-
relativeDirPath:
|
|
5632
|
+
relativeDirPath: join47(".agents", "skills")
|
|
5416
5633
|
};
|
|
5417
5634
|
}
|
|
5418
5635
|
static async fromDir(params) {
|
|
@@ -5439,14 +5656,14 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5439
5656
|
};
|
|
5440
5657
|
|
|
5441
5658
|
// src/features/skills/geminicli-skill.ts
|
|
5442
|
-
import { join as
|
|
5659
|
+
import { join as join48 } from "path";
|
|
5443
5660
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5444
5661
|
static getSettablePaths(options) {
|
|
5445
5662
|
if (options?.global) {
|
|
5446
5663
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5447
5664
|
}
|
|
5448
5665
|
return {
|
|
5449
|
-
relativeDirPath:
|
|
5666
|
+
relativeDirPath: join48(".gemini", "skills")
|
|
5450
5667
|
};
|
|
5451
5668
|
}
|
|
5452
5669
|
static async fromDir(params) {
|
|
@@ -5473,11 +5690,11 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
|
5473
5690
|
};
|
|
5474
5691
|
|
|
5475
5692
|
// src/features/skills/skills-processor.ts
|
|
5476
|
-
import { basename as
|
|
5477
|
-
import { z as
|
|
5693
|
+
import { basename as basename17, join as join59 } from "path";
|
|
5694
|
+
import { z as z29 } from "zod/mini";
|
|
5478
5695
|
|
|
5479
5696
|
// src/types/dir-feature-processor.ts
|
|
5480
|
-
import { join as
|
|
5697
|
+
import { join as join49 } from "path";
|
|
5481
5698
|
var DirFeatureProcessor = class {
|
|
5482
5699
|
baseDir;
|
|
5483
5700
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -5499,14 +5716,14 @@ var DirFeatureProcessor = class {
|
|
|
5499
5716
|
await ensureDir(dirPath);
|
|
5500
5717
|
const mainFile = aiDir.getMainFile();
|
|
5501
5718
|
if (mainFile) {
|
|
5502
|
-
const mainFilePath =
|
|
5719
|
+
const mainFilePath = join49(dirPath, mainFile.name);
|
|
5503
5720
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5504
5721
|
const contentWithNewline = addTrailingNewline(content);
|
|
5505
5722
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5506
5723
|
}
|
|
5507
5724
|
const otherFiles = aiDir.getOtherFiles();
|
|
5508
5725
|
for (const file of otherFiles) {
|
|
5509
|
-
const filePath =
|
|
5726
|
+
const filePath = join49(dirPath, file.relativeFilePathToDirPath);
|
|
5510
5727
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5511
5728
|
await writeFileContent(filePath, contentWithNewline);
|
|
5512
5729
|
}
|
|
@@ -5520,12 +5737,12 @@ var DirFeatureProcessor = class {
|
|
|
5520
5737
|
}
|
|
5521
5738
|
};
|
|
5522
5739
|
|
|
5523
|
-
// src/features/skills/
|
|
5524
|
-
import { join as
|
|
5740
|
+
// src/features/skills/antigravity-skill.ts
|
|
5741
|
+
import { join as join51 } from "path";
|
|
5525
5742
|
import { z as z21 } from "zod/mini";
|
|
5526
5743
|
|
|
5527
5744
|
// src/features/skills/rulesync-skill.ts
|
|
5528
|
-
import { join as
|
|
5745
|
+
import { join as join50 } from "path";
|
|
5529
5746
|
import { z as z20 } from "zod/mini";
|
|
5530
5747
|
var RulesyncSkillFrontmatterSchemaInternal = z20.looseObject({
|
|
5531
5748
|
name: z20.string(),
|
|
@@ -5617,8 +5834,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5617
5834
|
dirName,
|
|
5618
5835
|
global = false
|
|
5619
5836
|
}) {
|
|
5620
|
-
const skillDirPath =
|
|
5621
|
-
const skillFilePath =
|
|
5837
|
+
const skillDirPath = join50(baseDir, relativeDirPath, dirName);
|
|
5838
|
+
const skillFilePath = join50(skillDirPath, SKILL_FILE_NAME);
|
|
5622
5839
|
if (!await fileExists(skillFilePath)) {
|
|
5623
5840
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5624
5841
|
}
|
|
@@ -5647,16 +5864,179 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5647
5864
|
}
|
|
5648
5865
|
};
|
|
5649
5866
|
|
|
5650
|
-
// src/features/skills/
|
|
5651
|
-
var
|
|
5867
|
+
// src/features/skills/antigravity-skill.ts
|
|
5868
|
+
var AntigravitySkillFrontmatterSchema = z21.looseObject({
|
|
5652
5869
|
name: z21.string(),
|
|
5653
|
-
description: z21.string()
|
|
5654
|
-
|
|
5870
|
+
description: z21.string()
|
|
5871
|
+
});
|
|
5872
|
+
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
5873
|
+
constructor({
|
|
5874
|
+
baseDir = process.cwd(),
|
|
5875
|
+
relativeDirPath = join51(".agent", "skills"),
|
|
5876
|
+
dirName,
|
|
5877
|
+
frontmatter,
|
|
5878
|
+
body,
|
|
5879
|
+
otherFiles = [],
|
|
5880
|
+
validate = true,
|
|
5881
|
+
global = false
|
|
5882
|
+
}) {
|
|
5883
|
+
super({
|
|
5884
|
+
baseDir,
|
|
5885
|
+
relativeDirPath,
|
|
5886
|
+
dirName,
|
|
5887
|
+
mainFile: {
|
|
5888
|
+
name: SKILL_FILE_NAME,
|
|
5889
|
+
body,
|
|
5890
|
+
frontmatter: { ...frontmatter }
|
|
5891
|
+
},
|
|
5892
|
+
otherFiles,
|
|
5893
|
+
global
|
|
5894
|
+
});
|
|
5895
|
+
if (validate) {
|
|
5896
|
+
const result = this.validate();
|
|
5897
|
+
if (!result.success) {
|
|
5898
|
+
throw result.error;
|
|
5899
|
+
}
|
|
5900
|
+
}
|
|
5901
|
+
}
|
|
5902
|
+
static getSettablePaths({
|
|
5903
|
+
global = false
|
|
5904
|
+
} = {}) {
|
|
5905
|
+
if (global) {
|
|
5906
|
+
return {
|
|
5907
|
+
relativeDirPath: join51(".gemini", "antigravity", "skills")
|
|
5908
|
+
};
|
|
5909
|
+
}
|
|
5910
|
+
return {
|
|
5911
|
+
relativeDirPath: join51(".agent", "skills")
|
|
5912
|
+
};
|
|
5913
|
+
}
|
|
5914
|
+
getFrontmatter() {
|
|
5915
|
+
if (!this.mainFile?.frontmatter) {
|
|
5916
|
+
throw new Error("Frontmatter is not defined");
|
|
5917
|
+
}
|
|
5918
|
+
const result = AntigravitySkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
5919
|
+
return result;
|
|
5920
|
+
}
|
|
5921
|
+
getBody() {
|
|
5922
|
+
return this.mainFile?.body ?? "";
|
|
5923
|
+
}
|
|
5924
|
+
validate() {
|
|
5925
|
+
if (this.mainFile === void 0) {
|
|
5926
|
+
return {
|
|
5927
|
+
success: false,
|
|
5928
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
5929
|
+
};
|
|
5930
|
+
}
|
|
5931
|
+
const result = AntigravitySkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
5932
|
+
if (!result.success) {
|
|
5933
|
+
return {
|
|
5934
|
+
success: false,
|
|
5935
|
+
error: new Error(
|
|
5936
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
5937
|
+
)
|
|
5938
|
+
};
|
|
5939
|
+
}
|
|
5940
|
+
return { success: true, error: null };
|
|
5941
|
+
}
|
|
5942
|
+
toRulesyncSkill() {
|
|
5943
|
+
const frontmatter = this.getFrontmatter();
|
|
5944
|
+
const rulesyncFrontmatter = {
|
|
5945
|
+
name: frontmatter.name,
|
|
5946
|
+
description: frontmatter.description,
|
|
5947
|
+
targets: ["*"]
|
|
5948
|
+
};
|
|
5949
|
+
return new RulesyncSkill({
|
|
5950
|
+
baseDir: this.baseDir,
|
|
5951
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
5952
|
+
dirName: this.getDirName(),
|
|
5953
|
+
frontmatter: rulesyncFrontmatter,
|
|
5954
|
+
body: this.getBody(),
|
|
5955
|
+
otherFiles: this.getOtherFiles(),
|
|
5956
|
+
validate: true,
|
|
5957
|
+
global: this.global
|
|
5958
|
+
});
|
|
5959
|
+
}
|
|
5960
|
+
static fromRulesyncSkill({
|
|
5961
|
+
rulesyncSkill,
|
|
5962
|
+
validate = true,
|
|
5963
|
+
global = false
|
|
5964
|
+
}) {
|
|
5965
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
5966
|
+
const antigravityFrontmatter = {
|
|
5967
|
+
name: rulesyncFrontmatter.name,
|
|
5968
|
+
description: rulesyncFrontmatter.description
|
|
5969
|
+
};
|
|
5970
|
+
const settablePaths = _AntigravitySkill.getSettablePaths({ global });
|
|
5971
|
+
return new _AntigravitySkill({
|
|
5972
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
5973
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
5974
|
+
dirName: rulesyncSkill.getDirName(),
|
|
5975
|
+
frontmatter: antigravityFrontmatter,
|
|
5976
|
+
body: rulesyncSkill.getBody(),
|
|
5977
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
5978
|
+
validate,
|
|
5979
|
+
global
|
|
5980
|
+
});
|
|
5981
|
+
}
|
|
5982
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
5983
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
5984
|
+
return targets.includes("*") || targets.includes("antigravity");
|
|
5985
|
+
}
|
|
5986
|
+
static async fromDir(params) {
|
|
5987
|
+
const loaded = await this.loadSkillDirContent({
|
|
5988
|
+
...params,
|
|
5989
|
+
getSettablePaths: _AntigravitySkill.getSettablePaths
|
|
5990
|
+
});
|
|
5991
|
+
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5992
|
+
if (!result.success) {
|
|
5993
|
+
const skillDirPath = join51(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5994
|
+
throw new Error(
|
|
5995
|
+
`Invalid frontmatter in ${join51(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5996
|
+
);
|
|
5997
|
+
}
|
|
5998
|
+
return new _AntigravitySkill({
|
|
5999
|
+
baseDir: loaded.baseDir,
|
|
6000
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
6001
|
+
dirName: loaded.dirName,
|
|
6002
|
+
frontmatter: result.data,
|
|
6003
|
+
body: loaded.body,
|
|
6004
|
+
otherFiles: loaded.otherFiles,
|
|
6005
|
+
validate: true,
|
|
6006
|
+
global: loaded.global
|
|
6007
|
+
});
|
|
6008
|
+
}
|
|
6009
|
+
static forDeletion({
|
|
6010
|
+
baseDir = process.cwd(),
|
|
6011
|
+
relativeDirPath,
|
|
6012
|
+
dirName,
|
|
6013
|
+
global = false
|
|
6014
|
+
}) {
|
|
6015
|
+
return new _AntigravitySkill({
|
|
6016
|
+
baseDir,
|
|
6017
|
+
relativeDirPath,
|
|
6018
|
+
dirName,
|
|
6019
|
+
frontmatter: { name: "", description: "" },
|
|
6020
|
+
body: "",
|
|
6021
|
+
otherFiles: [],
|
|
6022
|
+
validate: false,
|
|
6023
|
+
global
|
|
6024
|
+
});
|
|
6025
|
+
}
|
|
6026
|
+
};
|
|
6027
|
+
|
|
6028
|
+
// src/features/skills/claudecode-skill.ts
|
|
6029
|
+
import { join as join52 } from "path";
|
|
6030
|
+
import { z as z22 } from "zod/mini";
|
|
6031
|
+
var ClaudecodeSkillFrontmatterSchema = z22.looseObject({
|
|
6032
|
+
name: z22.string(),
|
|
6033
|
+
description: z22.string(),
|
|
6034
|
+
"allowed-tools": z22.optional(z22.array(z22.string()))
|
|
5655
6035
|
});
|
|
5656
6036
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
5657
6037
|
constructor({
|
|
5658
6038
|
baseDir = process.cwd(),
|
|
5659
|
-
relativeDirPath =
|
|
6039
|
+
relativeDirPath = join52(".claude", "skills"),
|
|
5660
6040
|
dirName,
|
|
5661
6041
|
frontmatter,
|
|
5662
6042
|
body,
|
|
@@ -5687,7 +6067,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5687
6067
|
global: _global = false
|
|
5688
6068
|
} = {}) {
|
|
5689
6069
|
return {
|
|
5690
|
-
relativeDirPath:
|
|
6070
|
+
relativeDirPath: join52(".claude", "skills")
|
|
5691
6071
|
};
|
|
5692
6072
|
}
|
|
5693
6073
|
getFrontmatter() {
|
|
@@ -5775,9 +6155,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5775
6155
|
});
|
|
5776
6156
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5777
6157
|
if (!result.success) {
|
|
5778
|
-
const skillDirPath =
|
|
6158
|
+
const skillDirPath = join52(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5779
6159
|
throw new Error(
|
|
5780
|
-
`Invalid frontmatter in ${
|
|
6160
|
+
`Invalid frontmatter in ${join52(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5781
6161
|
);
|
|
5782
6162
|
}
|
|
5783
6163
|
return new _ClaudecodeSkill({
|
|
@@ -5811,21 +6191,21 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5811
6191
|
};
|
|
5812
6192
|
|
|
5813
6193
|
// src/features/skills/codexcli-skill.ts
|
|
5814
|
-
import { join as
|
|
5815
|
-
import { z as
|
|
5816
|
-
var CodexCliSkillFrontmatterSchema =
|
|
5817
|
-
name:
|
|
5818
|
-
description:
|
|
5819
|
-
metadata:
|
|
5820
|
-
|
|
5821
|
-
"short-description":
|
|
6194
|
+
import { join as join53 } from "path";
|
|
6195
|
+
import { z as z23 } from "zod/mini";
|
|
6196
|
+
var CodexCliSkillFrontmatterSchema = z23.looseObject({
|
|
6197
|
+
name: z23.string(),
|
|
6198
|
+
description: z23.string(),
|
|
6199
|
+
metadata: z23.optional(
|
|
6200
|
+
z23.looseObject({
|
|
6201
|
+
"short-description": z23.optional(z23.string())
|
|
5822
6202
|
})
|
|
5823
6203
|
)
|
|
5824
6204
|
});
|
|
5825
6205
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
5826
6206
|
constructor({
|
|
5827
6207
|
baseDir = process.cwd(),
|
|
5828
|
-
relativeDirPath =
|
|
6208
|
+
relativeDirPath = join53(".codex", "skills"),
|
|
5829
6209
|
dirName,
|
|
5830
6210
|
frontmatter,
|
|
5831
6211
|
body,
|
|
@@ -5856,7 +6236,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5856
6236
|
global: _global = false
|
|
5857
6237
|
} = {}) {
|
|
5858
6238
|
return {
|
|
5859
|
-
relativeDirPath:
|
|
6239
|
+
relativeDirPath: join53(".codex", "skills")
|
|
5860
6240
|
};
|
|
5861
6241
|
}
|
|
5862
6242
|
getFrontmatter() {
|
|
@@ -5948,9 +6328,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5948
6328
|
});
|
|
5949
6329
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5950
6330
|
if (!result.success) {
|
|
5951
|
-
const skillDirPath =
|
|
6331
|
+
const skillDirPath = join53(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5952
6332
|
throw new Error(
|
|
5953
|
-
`Invalid frontmatter in ${
|
|
6333
|
+
`Invalid frontmatter in ${join53(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5954
6334
|
);
|
|
5955
6335
|
}
|
|
5956
6336
|
return new _CodexCliSkill({
|
|
@@ -5984,17 +6364,17 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5984
6364
|
};
|
|
5985
6365
|
|
|
5986
6366
|
// src/features/skills/copilot-skill.ts
|
|
5987
|
-
import { join as
|
|
5988
|
-
import { z as
|
|
5989
|
-
var CopilotSkillFrontmatterSchema =
|
|
5990
|
-
name:
|
|
5991
|
-
description:
|
|
5992
|
-
license:
|
|
6367
|
+
import { join as join54 } from "path";
|
|
6368
|
+
import { z as z24 } from "zod/mini";
|
|
6369
|
+
var CopilotSkillFrontmatterSchema = z24.looseObject({
|
|
6370
|
+
name: z24.string(),
|
|
6371
|
+
description: z24.string(),
|
|
6372
|
+
license: z24.optional(z24.string())
|
|
5993
6373
|
});
|
|
5994
6374
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
5995
6375
|
constructor({
|
|
5996
6376
|
baseDir = process.cwd(),
|
|
5997
|
-
relativeDirPath =
|
|
6377
|
+
relativeDirPath = join54(".github", "skills"),
|
|
5998
6378
|
dirName,
|
|
5999
6379
|
frontmatter,
|
|
6000
6380
|
body,
|
|
@@ -6026,7 +6406,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6026
6406
|
throw new Error("CopilotSkill does not support global mode.");
|
|
6027
6407
|
}
|
|
6028
6408
|
return {
|
|
6029
|
-
relativeDirPath:
|
|
6409
|
+
relativeDirPath: join54(".github", "skills")
|
|
6030
6410
|
};
|
|
6031
6411
|
}
|
|
6032
6412
|
getFrontmatter() {
|
|
@@ -6114,9 +6494,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6114
6494
|
});
|
|
6115
6495
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6116
6496
|
if (!result.success) {
|
|
6117
|
-
const skillDirPath =
|
|
6497
|
+
const skillDirPath = join54(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6118
6498
|
throw new Error(
|
|
6119
|
-
`Invalid frontmatter in ${
|
|
6499
|
+
`Invalid frontmatter in ${join54(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6120
6500
|
);
|
|
6121
6501
|
}
|
|
6122
6502
|
return new _CopilotSkill({
|
|
@@ -6151,16 +6531,16 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6151
6531
|
};
|
|
6152
6532
|
|
|
6153
6533
|
// src/features/skills/cursor-skill.ts
|
|
6154
|
-
import { join as
|
|
6155
|
-
import { z as
|
|
6156
|
-
var CursorSkillFrontmatterSchema =
|
|
6157
|
-
name:
|
|
6158
|
-
description:
|
|
6534
|
+
import { join as join55 } from "path";
|
|
6535
|
+
import { z as z25 } from "zod/mini";
|
|
6536
|
+
var CursorSkillFrontmatterSchema = z25.looseObject({
|
|
6537
|
+
name: z25.string(),
|
|
6538
|
+
description: z25.string()
|
|
6159
6539
|
});
|
|
6160
6540
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
6161
6541
|
constructor({
|
|
6162
6542
|
baseDir = process.cwd(),
|
|
6163
|
-
relativeDirPath =
|
|
6543
|
+
relativeDirPath = join55(".cursor", "skills"),
|
|
6164
6544
|
dirName,
|
|
6165
6545
|
frontmatter,
|
|
6166
6546
|
body,
|
|
@@ -6192,7 +6572,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6192
6572
|
throw new Error("CursorSkill does not support global mode.");
|
|
6193
6573
|
}
|
|
6194
6574
|
return {
|
|
6195
|
-
relativeDirPath:
|
|
6575
|
+
relativeDirPath: join55(".cursor", "skills")
|
|
6196
6576
|
};
|
|
6197
6577
|
}
|
|
6198
6578
|
getFrontmatter() {
|
|
@@ -6274,9 +6654,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6274
6654
|
});
|
|
6275
6655
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6276
6656
|
if (!result.success) {
|
|
6277
|
-
const skillDirPath =
|
|
6657
|
+
const skillDirPath = join55(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6278
6658
|
throw new Error(
|
|
6279
|
-
`Invalid frontmatter in ${
|
|
6659
|
+
`Invalid frontmatter in ${join55(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6280
6660
|
);
|
|
6281
6661
|
}
|
|
6282
6662
|
return new _CursorSkill({
|
|
@@ -6310,17 +6690,17 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6310
6690
|
}
|
|
6311
6691
|
};
|
|
6312
6692
|
|
|
6313
|
-
// src/features/skills/kilo-skill.ts
|
|
6314
|
-
import { join as
|
|
6315
|
-
import { z as
|
|
6316
|
-
var KiloSkillFrontmatterSchema =
|
|
6317
|
-
name:
|
|
6318
|
-
description:
|
|
6693
|
+
// src/features/skills/kilo-skill.ts
|
|
6694
|
+
import { join as join56 } from "path";
|
|
6695
|
+
import { z as z26 } from "zod/mini";
|
|
6696
|
+
var KiloSkillFrontmatterSchema = z26.looseObject({
|
|
6697
|
+
name: z26.string(),
|
|
6698
|
+
description: z26.string()
|
|
6319
6699
|
});
|
|
6320
6700
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
6321
6701
|
constructor({
|
|
6322
6702
|
baseDir = process.cwd(),
|
|
6323
|
-
relativeDirPath =
|
|
6703
|
+
relativeDirPath = join56(".kilocode", "skills"),
|
|
6324
6704
|
dirName,
|
|
6325
6705
|
frontmatter,
|
|
6326
6706
|
body,
|
|
@@ -6351,7 +6731,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6351
6731
|
global: _global = false
|
|
6352
6732
|
} = {}) {
|
|
6353
6733
|
return {
|
|
6354
|
-
relativeDirPath:
|
|
6734
|
+
relativeDirPath: join56(".kilocode", "skills")
|
|
6355
6735
|
};
|
|
6356
6736
|
}
|
|
6357
6737
|
getFrontmatter() {
|
|
@@ -6441,13 +6821,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6441
6821
|
});
|
|
6442
6822
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6443
6823
|
if (!result.success) {
|
|
6444
|
-
const skillDirPath =
|
|
6824
|
+
const skillDirPath = join56(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6445
6825
|
throw new Error(
|
|
6446
|
-
`Invalid frontmatter in ${
|
|
6826
|
+
`Invalid frontmatter in ${join56(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6447
6827
|
);
|
|
6448
6828
|
}
|
|
6449
6829
|
if (result.data.name !== loaded.dirName) {
|
|
6450
|
-
const skillFilePath =
|
|
6830
|
+
const skillFilePath = join56(
|
|
6451
6831
|
loaded.baseDir,
|
|
6452
6832
|
loaded.relativeDirPath,
|
|
6453
6833
|
loaded.dirName,
|
|
@@ -6488,17 +6868,17 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6488
6868
|
};
|
|
6489
6869
|
|
|
6490
6870
|
// src/features/skills/opencode-skill.ts
|
|
6491
|
-
import { join as
|
|
6492
|
-
import { z as
|
|
6493
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
6494
|
-
name:
|
|
6495
|
-
description:
|
|
6496
|
-
"allowed-tools":
|
|
6871
|
+
import { join as join57 } from "path";
|
|
6872
|
+
import { z as z27 } from "zod/mini";
|
|
6873
|
+
var OpenCodeSkillFrontmatterSchema = z27.looseObject({
|
|
6874
|
+
name: z27.string(),
|
|
6875
|
+
description: z27.string(),
|
|
6876
|
+
"allowed-tools": z27.optional(z27.array(z27.string()))
|
|
6497
6877
|
});
|
|
6498
6878
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
6499
6879
|
constructor({
|
|
6500
6880
|
baseDir = process.cwd(),
|
|
6501
|
-
relativeDirPath =
|
|
6881
|
+
relativeDirPath = join57(".opencode", "skill"),
|
|
6502
6882
|
dirName,
|
|
6503
6883
|
frontmatter,
|
|
6504
6884
|
body,
|
|
@@ -6527,7 +6907,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6527
6907
|
}
|
|
6528
6908
|
static getSettablePaths({ global = false } = {}) {
|
|
6529
6909
|
return {
|
|
6530
|
-
relativeDirPath: global ?
|
|
6910
|
+
relativeDirPath: global ? join57(".config", "opencode", "skill") : join57(".opencode", "skill")
|
|
6531
6911
|
};
|
|
6532
6912
|
}
|
|
6533
6913
|
getFrontmatter() {
|
|
@@ -6615,9 +6995,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6615
6995
|
});
|
|
6616
6996
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6617
6997
|
if (!result.success) {
|
|
6618
|
-
const skillDirPath =
|
|
6998
|
+
const skillDirPath = join57(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6619
6999
|
throw new Error(
|
|
6620
|
-
`Invalid frontmatter in ${
|
|
7000
|
+
`Invalid frontmatter in ${join57(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6621
7001
|
);
|
|
6622
7002
|
}
|
|
6623
7003
|
return new _OpenCodeSkill({
|
|
@@ -6651,16 +7031,16 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6651
7031
|
};
|
|
6652
7032
|
|
|
6653
7033
|
// src/features/skills/roo-skill.ts
|
|
6654
|
-
import { join as
|
|
6655
|
-
import { z as
|
|
6656
|
-
var RooSkillFrontmatterSchema =
|
|
6657
|
-
name:
|
|
6658
|
-
description:
|
|
7034
|
+
import { join as join58 } from "path";
|
|
7035
|
+
import { z as z28 } from "zod/mini";
|
|
7036
|
+
var RooSkillFrontmatterSchema = z28.looseObject({
|
|
7037
|
+
name: z28.string(),
|
|
7038
|
+
description: z28.string()
|
|
6659
7039
|
});
|
|
6660
7040
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
6661
7041
|
constructor({
|
|
6662
7042
|
baseDir = process.cwd(),
|
|
6663
|
-
relativeDirPath =
|
|
7043
|
+
relativeDirPath = join58(".roo", "skills"),
|
|
6664
7044
|
dirName,
|
|
6665
7045
|
frontmatter,
|
|
6666
7046
|
body,
|
|
@@ -6691,7 +7071,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6691
7071
|
global: _global = false
|
|
6692
7072
|
} = {}) {
|
|
6693
7073
|
return {
|
|
6694
|
-
relativeDirPath:
|
|
7074
|
+
relativeDirPath: join58(".roo", "skills")
|
|
6695
7075
|
};
|
|
6696
7076
|
}
|
|
6697
7077
|
getFrontmatter() {
|
|
@@ -6781,13 +7161,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6781
7161
|
});
|
|
6782
7162
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6783
7163
|
if (!result.success) {
|
|
6784
|
-
const skillDirPath =
|
|
7164
|
+
const skillDirPath = join58(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6785
7165
|
throw new Error(
|
|
6786
|
-
`Invalid frontmatter in ${
|
|
7166
|
+
`Invalid frontmatter in ${join58(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6787
7167
|
);
|
|
6788
7168
|
}
|
|
6789
7169
|
if (result.data.name !== loaded.dirName) {
|
|
6790
|
-
const skillFilePath =
|
|
7170
|
+
const skillFilePath = join58(
|
|
6791
7171
|
loaded.baseDir,
|
|
6792
7172
|
loaded.relativeDirPath,
|
|
6793
7173
|
loaded.dirName,
|
|
@@ -6830,6 +7210,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6830
7210
|
// src/features/skills/skills-processor.ts
|
|
6831
7211
|
var skillsProcessorToolTargetTuple = [
|
|
6832
7212
|
"agentsmd",
|
|
7213
|
+
"antigravity",
|
|
6833
7214
|
"claudecode",
|
|
6834
7215
|
"claudecode-legacy",
|
|
6835
7216
|
"codexcli",
|
|
@@ -6840,7 +7221,7 @@ var skillsProcessorToolTargetTuple = [
|
|
|
6840
7221
|
"opencode",
|
|
6841
7222
|
"roo"
|
|
6842
7223
|
];
|
|
6843
|
-
var SkillsProcessorToolTargetSchema =
|
|
7224
|
+
var SkillsProcessorToolTargetSchema = z29.enum(skillsProcessorToolTargetTuple);
|
|
6844
7225
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
6845
7226
|
[
|
|
6846
7227
|
"agentsmd",
|
|
@@ -6849,6 +7230,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
6849
7230
|
meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
|
|
6850
7231
|
}
|
|
6851
7232
|
],
|
|
7233
|
+
[
|
|
7234
|
+
"antigravity",
|
|
7235
|
+
{
|
|
7236
|
+
class: AntigravitySkill,
|
|
7237
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
7238
|
+
}
|
|
7239
|
+
],
|
|
6852
7240
|
[
|
|
6853
7241
|
"claudecode",
|
|
6854
7242
|
{
|
|
@@ -6990,9 +7378,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
6990
7378
|
*/
|
|
6991
7379
|
async loadRulesyncDirs() {
|
|
6992
7380
|
const paths = RulesyncSkill.getSettablePaths();
|
|
6993
|
-
const rulesyncSkillsDirPath =
|
|
6994
|
-
const dirPaths = await findFilesByGlobs(
|
|
6995
|
-
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));
|
|
6996
7384
|
const rulesyncSkills = await Promise.all(
|
|
6997
7385
|
dirNames.map(
|
|
6998
7386
|
(dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
|
|
@@ -7008,9 +7396,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7008
7396
|
async loadToolDirs() {
|
|
7009
7397
|
const factory = this.getFactory(this.toolTarget);
|
|
7010
7398
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7011
|
-
const skillsDirPath =
|
|
7012
|
-
const dirPaths = await findFilesByGlobs(
|
|
7013
|
-
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));
|
|
7014
7402
|
const toolSkills = await Promise.all(
|
|
7015
7403
|
dirNames.map(
|
|
7016
7404
|
(dirName) => factory.class.fromDir({
|
|
@@ -7026,9 +7414,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7026
7414
|
async loadToolDirsToDelete() {
|
|
7027
7415
|
const factory = this.getFactory(this.toolTarget);
|
|
7028
7416
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7029
|
-
const skillsDirPath =
|
|
7030
|
-
const dirPaths = await findFilesByGlobs(
|
|
7031
|
-
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));
|
|
7032
7420
|
const toolSkills = dirNames.map(
|
|
7033
7421
|
(dirName) => factory.class.forDeletion({
|
|
7034
7422
|
baseDir: this.baseDir,
|
|
@@ -7076,11 +7464,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7076
7464
|
};
|
|
7077
7465
|
|
|
7078
7466
|
// src/features/subagents/agentsmd-subagent.ts
|
|
7079
|
-
import { join as
|
|
7467
|
+
import { join as join61 } from "path";
|
|
7080
7468
|
|
|
7081
7469
|
// src/features/subagents/simulated-subagent.ts
|
|
7082
|
-
import { basename as
|
|
7083
|
-
import { z as
|
|
7470
|
+
import { basename as basename18, join as join60 } from "path";
|
|
7471
|
+
import { z as z30 } from "zod/mini";
|
|
7084
7472
|
|
|
7085
7473
|
// src/features/subagents/tool-subagent.ts
|
|
7086
7474
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -7123,9 +7511,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
7123
7511
|
};
|
|
7124
7512
|
|
|
7125
7513
|
// src/features/subagents/simulated-subagent.ts
|
|
7126
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
7127
|
-
name:
|
|
7128
|
-
description:
|
|
7514
|
+
var SimulatedSubagentFrontmatterSchema = z30.object({
|
|
7515
|
+
name: z30.string(),
|
|
7516
|
+
description: z30.string()
|
|
7129
7517
|
});
|
|
7130
7518
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
7131
7519
|
frontmatter;
|
|
@@ -7135,7 +7523,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7135
7523
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7136
7524
|
if (!result.success) {
|
|
7137
7525
|
throw new Error(
|
|
7138
|
-
`Invalid frontmatter in ${
|
|
7526
|
+
`Invalid frontmatter in ${join60(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7139
7527
|
);
|
|
7140
7528
|
}
|
|
7141
7529
|
}
|
|
@@ -7186,7 +7574,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7186
7574
|
return {
|
|
7187
7575
|
success: false,
|
|
7188
7576
|
error: new Error(
|
|
7189
|
-
`Invalid frontmatter in ${
|
|
7577
|
+
`Invalid frontmatter in ${join60(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7190
7578
|
)
|
|
7191
7579
|
};
|
|
7192
7580
|
}
|
|
@@ -7196,7 +7584,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7196
7584
|
relativeFilePath,
|
|
7197
7585
|
validate = true
|
|
7198
7586
|
}) {
|
|
7199
|
-
const filePath =
|
|
7587
|
+
const filePath = join60(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
7200
7588
|
const fileContent = await readFileContent(filePath);
|
|
7201
7589
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7202
7590
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7206,7 +7594,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7206
7594
|
return {
|
|
7207
7595
|
baseDir,
|
|
7208
7596
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
7209
|
-
relativeFilePath:
|
|
7597
|
+
relativeFilePath: basename18(relativeFilePath),
|
|
7210
7598
|
frontmatter: result.data,
|
|
7211
7599
|
body: content.trim(),
|
|
7212
7600
|
validate
|
|
@@ -7232,7 +7620,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7232
7620
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
7233
7621
|
static getSettablePaths() {
|
|
7234
7622
|
return {
|
|
7235
|
-
relativeDirPath:
|
|
7623
|
+
relativeDirPath: join61(".agents", "subagents")
|
|
7236
7624
|
};
|
|
7237
7625
|
}
|
|
7238
7626
|
static async fromFile(params) {
|
|
@@ -7255,11 +7643,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
7255
7643
|
};
|
|
7256
7644
|
|
|
7257
7645
|
// src/features/subagents/codexcli-subagent.ts
|
|
7258
|
-
import { join as
|
|
7646
|
+
import { join as join62 } from "path";
|
|
7259
7647
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
7260
7648
|
static getSettablePaths() {
|
|
7261
7649
|
return {
|
|
7262
|
-
relativeDirPath:
|
|
7650
|
+
relativeDirPath: join62(".codex", "subagents")
|
|
7263
7651
|
};
|
|
7264
7652
|
}
|
|
7265
7653
|
static async fromFile(params) {
|
|
@@ -7282,11 +7670,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
7282
7670
|
};
|
|
7283
7671
|
|
|
7284
7672
|
// src/features/subagents/cursor-subagent.ts
|
|
7285
|
-
import { join as
|
|
7673
|
+
import { join as join63 } from "path";
|
|
7286
7674
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
7287
7675
|
static getSettablePaths() {
|
|
7288
7676
|
return {
|
|
7289
|
-
relativeDirPath:
|
|
7677
|
+
relativeDirPath: join63(".cursor", "subagents")
|
|
7290
7678
|
};
|
|
7291
7679
|
}
|
|
7292
7680
|
static async fromFile(params) {
|
|
@@ -7309,11 +7697,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
7309
7697
|
};
|
|
7310
7698
|
|
|
7311
7699
|
// src/features/subagents/geminicli-subagent.ts
|
|
7312
|
-
import { join as
|
|
7700
|
+
import { join as join64 } from "path";
|
|
7313
7701
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
7314
7702
|
static getSettablePaths() {
|
|
7315
7703
|
return {
|
|
7316
|
-
relativeDirPath:
|
|
7704
|
+
relativeDirPath: join64(".gemini", "subagents")
|
|
7317
7705
|
};
|
|
7318
7706
|
}
|
|
7319
7707
|
static async fromFile(params) {
|
|
@@ -7336,11 +7724,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
7336
7724
|
};
|
|
7337
7725
|
|
|
7338
7726
|
// src/features/subagents/roo-subagent.ts
|
|
7339
|
-
import { join as
|
|
7727
|
+
import { join as join65 } from "path";
|
|
7340
7728
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
7341
7729
|
static getSettablePaths() {
|
|
7342
7730
|
return {
|
|
7343
|
-
relativeDirPath:
|
|
7731
|
+
relativeDirPath: join65(".roo", "subagents")
|
|
7344
7732
|
};
|
|
7345
7733
|
}
|
|
7346
7734
|
static async fromFile(params) {
|
|
@@ -7363,20 +7751,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
7363
7751
|
};
|
|
7364
7752
|
|
|
7365
7753
|
// src/features/subagents/subagents-processor.ts
|
|
7366
|
-
import { basename as
|
|
7367
|
-
import { z as
|
|
7754
|
+
import { basename as basename21, join as join70 } from "path";
|
|
7755
|
+
import { z as z35 } from "zod/mini";
|
|
7368
7756
|
|
|
7369
7757
|
// src/features/subagents/claudecode-subagent.ts
|
|
7370
|
-
import { join as
|
|
7371
|
-
import { z as
|
|
7758
|
+
import { join as join67 } from "path";
|
|
7759
|
+
import { z as z32 } from "zod/mini";
|
|
7372
7760
|
|
|
7373
7761
|
// src/features/subagents/rulesync-subagent.ts
|
|
7374
|
-
import { basename as
|
|
7375
|
-
import { z as
|
|
7376
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
7762
|
+
import { basename as basename19, join as join66 } from "path";
|
|
7763
|
+
import { z as z31 } from "zod/mini";
|
|
7764
|
+
var RulesyncSubagentFrontmatterSchema = z31.looseObject({
|
|
7377
7765
|
targets: RulesyncTargetsSchema,
|
|
7378
|
-
name:
|
|
7379
|
-
description:
|
|
7766
|
+
name: z31.string(),
|
|
7767
|
+
description: z31.string()
|
|
7380
7768
|
});
|
|
7381
7769
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
7382
7770
|
frontmatter;
|
|
@@ -7386,7 +7774,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7386
7774
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7387
7775
|
if (!result.success) {
|
|
7388
7776
|
throw new Error(
|
|
7389
|
-
`Invalid frontmatter in ${
|
|
7777
|
+
`Invalid frontmatter in ${join66(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7390
7778
|
);
|
|
7391
7779
|
}
|
|
7392
7780
|
}
|
|
@@ -7419,7 +7807,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7419
7807
|
return {
|
|
7420
7808
|
success: false,
|
|
7421
7809
|
error: new Error(
|
|
7422
|
-
`Invalid frontmatter in ${
|
|
7810
|
+
`Invalid frontmatter in ${join66(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7423
7811
|
)
|
|
7424
7812
|
};
|
|
7425
7813
|
}
|
|
@@ -7428,14 +7816,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7428
7816
|
relativeFilePath
|
|
7429
7817
|
}) {
|
|
7430
7818
|
const fileContent = await readFileContent(
|
|
7431
|
-
|
|
7819
|
+
join66(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
7432
7820
|
);
|
|
7433
7821
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7434
7822
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7435
7823
|
if (!result.success) {
|
|
7436
7824
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
7437
7825
|
}
|
|
7438
|
-
const filename =
|
|
7826
|
+
const filename = basename19(relativeFilePath);
|
|
7439
7827
|
return new _RulesyncSubagent({
|
|
7440
7828
|
baseDir: process.cwd(),
|
|
7441
7829
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -7447,13 +7835,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7447
7835
|
};
|
|
7448
7836
|
|
|
7449
7837
|
// src/features/subagents/claudecode-subagent.ts
|
|
7450
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
7451
|
-
name:
|
|
7452
|
-
description:
|
|
7453
|
-
model:
|
|
7454
|
-
tools:
|
|
7455
|
-
permissionMode:
|
|
7456
|
-
skills:
|
|
7838
|
+
var ClaudecodeSubagentFrontmatterSchema = z32.looseObject({
|
|
7839
|
+
name: z32.string(),
|
|
7840
|
+
description: z32.string(),
|
|
7841
|
+
model: z32.optional(z32.string()),
|
|
7842
|
+
tools: z32.optional(z32.union([z32.string(), z32.array(z32.string())])),
|
|
7843
|
+
permissionMode: z32.optional(z32.string()),
|
|
7844
|
+
skills: z32.optional(z32.union([z32.string(), z32.array(z32.string())]))
|
|
7457
7845
|
});
|
|
7458
7846
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
7459
7847
|
frontmatter;
|
|
@@ -7463,7 +7851,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7463
7851
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7464
7852
|
if (!result.success) {
|
|
7465
7853
|
throw new Error(
|
|
7466
|
-
`Invalid frontmatter in ${
|
|
7854
|
+
`Invalid frontmatter in ${join67(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7467
7855
|
);
|
|
7468
7856
|
}
|
|
7469
7857
|
}
|
|
@@ -7475,7 +7863,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7475
7863
|
}
|
|
7476
7864
|
static getSettablePaths(_options = {}) {
|
|
7477
7865
|
return {
|
|
7478
|
-
relativeDirPath:
|
|
7866
|
+
relativeDirPath: join67(".claude", "agents")
|
|
7479
7867
|
};
|
|
7480
7868
|
}
|
|
7481
7869
|
getFrontmatter() {
|
|
@@ -7549,7 +7937,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7549
7937
|
return {
|
|
7550
7938
|
success: false,
|
|
7551
7939
|
error: new Error(
|
|
7552
|
-
`Invalid frontmatter in ${
|
|
7940
|
+
`Invalid frontmatter in ${join67(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7553
7941
|
)
|
|
7554
7942
|
};
|
|
7555
7943
|
}
|
|
@@ -7567,7 +7955,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7567
7955
|
global = false
|
|
7568
7956
|
}) {
|
|
7569
7957
|
const paths = this.getSettablePaths({ global });
|
|
7570
|
-
const filePath =
|
|
7958
|
+
const filePath = join67(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7571
7959
|
const fileContent = await readFileContent(filePath);
|
|
7572
7960
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7573
7961
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7602,13 +7990,13 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7602
7990
|
};
|
|
7603
7991
|
|
|
7604
7992
|
// src/features/subagents/copilot-subagent.ts
|
|
7605
|
-
import { join as
|
|
7606
|
-
import { z as
|
|
7993
|
+
import { join as join68 } from "path";
|
|
7994
|
+
import { z as z33 } from "zod/mini";
|
|
7607
7995
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
7608
|
-
var CopilotSubagentFrontmatterSchema =
|
|
7609
|
-
name:
|
|
7610
|
-
description:
|
|
7611
|
-
tools:
|
|
7996
|
+
var CopilotSubagentFrontmatterSchema = z33.looseObject({
|
|
7997
|
+
name: z33.string(),
|
|
7998
|
+
description: z33.string(),
|
|
7999
|
+
tools: z33.optional(z33.union([z33.string(), z33.array(z33.string())]))
|
|
7612
8000
|
});
|
|
7613
8001
|
var normalizeTools = (tools) => {
|
|
7614
8002
|
if (!tools) {
|
|
@@ -7628,7 +8016,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7628
8016
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7629
8017
|
if (!result.success) {
|
|
7630
8018
|
throw new Error(
|
|
7631
|
-
`Invalid frontmatter in ${
|
|
8019
|
+
`Invalid frontmatter in ${join68(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7632
8020
|
);
|
|
7633
8021
|
}
|
|
7634
8022
|
}
|
|
@@ -7640,7 +8028,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7640
8028
|
}
|
|
7641
8029
|
static getSettablePaths(_options = {}) {
|
|
7642
8030
|
return {
|
|
7643
|
-
relativeDirPath:
|
|
8031
|
+
relativeDirPath: join68(".github", "agents")
|
|
7644
8032
|
};
|
|
7645
8033
|
}
|
|
7646
8034
|
getFrontmatter() {
|
|
@@ -7714,7 +8102,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7714
8102
|
return {
|
|
7715
8103
|
success: false,
|
|
7716
8104
|
error: new Error(
|
|
7717
|
-
`Invalid frontmatter in ${
|
|
8105
|
+
`Invalid frontmatter in ${join68(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7718
8106
|
)
|
|
7719
8107
|
};
|
|
7720
8108
|
}
|
|
@@ -7732,7 +8120,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7732
8120
|
global = false
|
|
7733
8121
|
}) {
|
|
7734
8122
|
const paths = this.getSettablePaths({ global });
|
|
7735
|
-
const filePath =
|
|
8123
|
+
const filePath = join68(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7736
8124
|
const fileContent = await readFileContent(filePath);
|
|
7737
8125
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7738
8126
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7768,12 +8156,12 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7768
8156
|
};
|
|
7769
8157
|
|
|
7770
8158
|
// src/features/subagents/opencode-subagent.ts
|
|
7771
|
-
import { basename as
|
|
7772
|
-
import { z as
|
|
7773
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
7774
|
-
description:
|
|
7775
|
-
mode:
|
|
7776
|
-
name:
|
|
8159
|
+
import { basename as basename20, join as join69 } from "path";
|
|
8160
|
+
import { z as z34 } from "zod/mini";
|
|
8161
|
+
var OpenCodeSubagentFrontmatterSchema = z34.looseObject({
|
|
8162
|
+
description: z34.string(),
|
|
8163
|
+
mode: z34.literal("subagent"),
|
|
8164
|
+
name: z34.optional(z34.string())
|
|
7777
8165
|
});
|
|
7778
8166
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
7779
8167
|
frontmatter;
|
|
@@ -7783,7 +8171,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7783
8171
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7784
8172
|
if (!result.success) {
|
|
7785
8173
|
throw new Error(
|
|
7786
|
-
`Invalid frontmatter in ${
|
|
8174
|
+
`Invalid frontmatter in ${join69(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7787
8175
|
);
|
|
7788
8176
|
}
|
|
7789
8177
|
}
|
|
@@ -7797,7 +8185,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7797
8185
|
global = false
|
|
7798
8186
|
} = {}) {
|
|
7799
8187
|
return {
|
|
7800
|
-
relativeDirPath: global ?
|
|
8188
|
+
relativeDirPath: global ? join69(".config", "opencode", "agent") : join69(".opencode", "agent")
|
|
7801
8189
|
};
|
|
7802
8190
|
}
|
|
7803
8191
|
getFrontmatter() {
|
|
@@ -7810,7 +8198,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7810
8198
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
7811
8199
|
const rulesyncFrontmatter = {
|
|
7812
8200
|
targets: ["opencode"],
|
|
7813
|
-
name: name ??
|
|
8201
|
+
name: name ?? basename20(this.getRelativeFilePath(), ".md"),
|
|
7814
8202
|
description,
|
|
7815
8203
|
opencode: { mode, ...opencodeSection }
|
|
7816
8204
|
};
|
|
@@ -7863,7 +8251,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7863
8251
|
return {
|
|
7864
8252
|
success: false,
|
|
7865
8253
|
error: new Error(
|
|
7866
|
-
`Invalid frontmatter in ${
|
|
8254
|
+
`Invalid frontmatter in ${join69(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7867
8255
|
)
|
|
7868
8256
|
};
|
|
7869
8257
|
}
|
|
@@ -7880,7 +8268,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7880
8268
|
global = false
|
|
7881
8269
|
}) {
|
|
7882
8270
|
const paths = this.getSettablePaths({ global });
|
|
7883
|
-
const filePath =
|
|
8271
|
+
const filePath = join69(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7884
8272
|
const fileContent = await readFileContent(filePath);
|
|
7885
8273
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7886
8274
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7927,7 +8315,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
7927
8315
|
"opencode",
|
|
7928
8316
|
"roo"
|
|
7929
8317
|
];
|
|
7930
|
-
var SubagentsProcessorToolTargetSchema =
|
|
8318
|
+
var SubagentsProcessorToolTargetSchema = z35.enum(subagentsProcessorToolTargetTuple);
|
|
7931
8319
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
7932
8320
|
[
|
|
7933
8321
|
"agentsmd",
|
|
@@ -8041,7 +8429,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8041
8429
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
8042
8430
|
*/
|
|
8043
8431
|
async loadRulesyncFiles() {
|
|
8044
|
-
const subagentsDir =
|
|
8432
|
+
const subagentsDir = join70(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
8045
8433
|
const dirExists = await directoryExists(subagentsDir);
|
|
8046
8434
|
if (!dirExists) {
|
|
8047
8435
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -8056,7 +8444,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8056
8444
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
8057
8445
|
const rulesyncSubagents = [];
|
|
8058
8446
|
for (const mdFile of mdFiles) {
|
|
8059
|
-
const filepath =
|
|
8447
|
+
const filepath = join70(subagentsDir, mdFile);
|
|
8060
8448
|
try {
|
|
8061
8449
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
8062
8450
|
relativeFilePath: mdFile,
|
|
@@ -8086,14 +8474,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8086
8474
|
const factory = this.getFactory(this.toolTarget);
|
|
8087
8475
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
8088
8476
|
const subagentFilePaths = await findFilesByGlobs(
|
|
8089
|
-
|
|
8477
|
+
join70(this.baseDir, paths.relativeDirPath, "*.md")
|
|
8090
8478
|
);
|
|
8091
8479
|
if (forDeletion) {
|
|
8092
8480
|
const toolSubagents2 = subagentFilePaths.map(
|
|
8093
8481
|
(path3) => factory.class.forDeletion({
|
|
8094
8482
|
baseDir: this.baseDir,
|
|
8095
8483
|
relativeDirPath: paths.relativeDirPath,
|
|
8096
|
-
relativeFilePath:
|
|
8484
|
+
relativeFilePath: basename21(path3),
|
|
8097
8485
|
global: this.global
|
|
8098
8486
|
})
|
|
8099
8487
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -8104,7 +8492,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8104
8492
|
subagentFilePaths.map(
|
|
8105
8493
|
(path3) => factory.class.fromFile({
|
|
8106
8494
|
baseDir: this.baseDir,
|
|
8107
|
-
relativeFilePath:
|
|
8495
|
+
relativeFilePath: basename21(path3),
|
|
8108
8496
|
global: this.global
|
|
8109
8497
|
})
|
|
8110
8498
|
)
|
|
@@ -8136,48 +8524,48 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8136
8524
|
};
|
|
8137
8525
|
|
|
8138
8526
|
// src/features/rules/agentsmd-rule.ts
|
|
8139
|
-
import { join as
|
|
8527
|
+
import { join as join73 } from "path";
|
|
8140
8528
|
|
|
8141
8529
|
// src/features/rules/tool-rule.ts
|
|
8142
|
-
import { join as
|
|
8530
|
+
import { join as join72 } from "path";
|
|
8143
8531
|
|
|
8144
8532
|
// src/features/rules/rulesync-rule.ts
|
|
8145
|
-
import { basename as
|
|
8146
|
-
import { z as
|
|
8147
|
-
var RulesyncRuleFrontmatterSchema =
|
|
8148
|
-
root:
|
|
8149
|
-
targets:
|
|
8150
|
-
description:
|
|
8151
|
-
globs:
|
|
8152
|
-
agentsmd:
|
|
8153
|
-
|
|
8533
|
+
import { basename as basename22, join as join71 } from "path";
|
|
8534
|
+
import { z as z36 } from "zod/mini";
|
|
8535
|
+
var RulesyncRuleFrontmatterSchema = z36.object({
|
|
8536
|
+
root: z36.optional(z36.optional(z36.boolean())),
|
|
8537
|
+
targets: z36.optional(RulesyncTargetsSchema),
|
|
8538
|
+
description: z36.optional(z36.string()),
|
|
8539
|
+
globs: z36.optional(z36.array(z36.string())),
|
|
8540
|
+
agentsmd: z36.optional(
|
|
8541
|
+
z36.object({
|
|
8154
8542
|
// @example "path/to/subproject"
|
|
8155
|
-
subprojectPath:
|
|
8543
|
+
subprojectPath: z36.optional(z36.string())
|
|
8156
8544
|
})
|
|
8157
8545
|
),
|
|
8158
|
-
claudecode:
|
|
8159
|
-
|
|
8546
|
+
claudecode: z36.optional(
|
|
8547
|
+
z36.object({
|
|
8160
8548
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
8161
8549
|
// @example "src/**/*.ts, tests/**/*.test.ts"
|
|
8162
|
-
paths:
|
|
8550
|
+
paths: z36.optional(z36.string())
|
|
8163
8551
|
})
|
|
8164
8552
|
),
|
|
8165
|
-
cursor:
|
|
8166
|
-
|
|
8167
|
-
alwaysApply:
|
|
8168
|
-
description:
|
|
8169
|
-
globs:
|
|
8553
|
+
cursor: z36.optional(
|
|
8554
|
+
z36.object({
|
|
8555
|
+
alwaysApply: z36.optional(z36.boolean()),
|
|
8556
|
+
description: z36.optional(z36.string()),
|
|
8557
|
+
globs: z36.optional(z36.array(z36.string()))
|
|
8170
8558
|
})
|
|
8171
8559
|
),
|
|
8172
|
-
copilot:
|
|
8173
|
-
|
|
8174
|
-
excludeAgent:
|
|
8560
|
+
copilot: z36.optional(
|
|
8561
|
+
z36.object({
|
|
8562
|
+
excludeAgent: z36.optional(z36.union([z36.literal("code-review"), z36.literal("coding-agent")]))
|
|
8175
8563
|
})
|
|
8176
8564
|
),
|
|
8177
|
-
antigravity:
|
|
8178
|
-
|
|
8179
|
-
trigger:
|
|
8180
|
-
globs:
|
|
8565
|
+
antigravity: z36.optional(
|
|
8566
|
+
z36.looseObject({
|
|
8567
|
+
trigger: z36.optional(z36.string()),
|
|
8568
|
+
globs: z36.optional(z36.array(z36.string()))
|
|
8181
8569
|
})
|
|
8182
8570
|
)
|
|
8183
8571
|
});
|
|
@@ -8189,7 +8577,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8189
8577
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8190
8578
|
if (!result.success) {
|
|
8191
8579
|
throw new Error(
|
|
8192
|
-
`Invalid frontmatter in ${
|
|
8580
|
+
`Invalid frontmatter in ${join71(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8193
8581
|
);
|
|
8194
8582
|
}
|
|
8195
8583
|
}
|
|
@@ -8224,7 +8612,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8224
8612
|
return {
|
|
8225
8613
|
success: false,
|
|
8226
8614
|
error: new Error(
|
|
8227
|
-
`Invalid frontmatter in ${
|
|
8615
|
+
`Invalid frontmatter in ${join71(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8228
8616
|
)
|
|
8229
8617
|
};
|
|
8230
8618
|
}
|
|
@@ -8233,12 +8621,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8233
8621
|
relativeFilePath,
|
|
8234
8622
|
validate = true
|
|
8235
8623
|
}) {
|
|
8236
|
-
const legacyPath =
|
|
8624
|
+
const legacyPath = join71(
|
|
8237
8625
|
process.cwd(),
|
|
8238
8626
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
8239
8627
|
relativeFilePath
|
|
8240
8628
|
);
|
|
8241
|
-
const recommendedPath =
|
|
8629
|
+
const recommendedPath = join71(
|
|
8242
8630
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8243
8631
|
relativeFilePath
|
|
8244
8632
|
);
|
|
@@ -8259,7 +8647,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8259
8647
|
agentsmd: result.data.agentsmd,
|
|
8260
8648
|
cursor: result.data.cursor
|
|
8261
8649
|
};
|
|
8262
|
-
const filename =
|
|
8650
|
+
const filename = basename22(legacyPath);
|
|
8263
8651
|
return new _RulesyncRule({
|
|
8264
8652
|
baseDir: process.cwd(),
|
|
8265
8653
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8273,7 +8661,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8273
8661
|
relativeFilePath,
|
|
8274
8662
|
validate = true
|
|
8275
8663
|
}) {
|
|
8276
|
-
const filePath =
|
|
8664
|
+
const filePath = join71(
|
|
8277
8665
|
process.cwd(),
|
|
8278
8666
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8279
8667
|
relativeFilePath
|
|
@@ -8292,7 +8680,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8292
8680
|
agentsmd: result.data.agentsmd,
|
|
8293
8681
|
cursor: result.data.cursor
|
|
8294
8682
|
};
|
|
8295
|
-
const filename =
|
|
8683
|
+
const filename = basename22(filePath);
|
|
8296
8684
|
return new _RulesyncRule({
|
|
8297
8685
|
baseDir: process.cwd(),
|
|
8298
8686
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8375,7 +8763,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8375
8763
|
rulesyncRule,
|
|
8376
8764
|
validate = true,
|
|
8377
8765
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
8378
|
-
nonRootPath = { relativeDirPath:
|
|
8766
|
+
nonRootPath = { relativeDirPath: join72(".agents", "memories") }
|
|
8379
8767
|
}) {
|
|
8380
8768
|
const params = this.buildToolRuleParamsDefault({
|
|
8381
8769
|
baseDir,
|
|
@@ -8386,7 +8774,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8386
8774
|
});
|
|
8387
8775
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
8388
8776
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
8389
|
-
params.relativeDirPath =
|
|
8777
|
+
params.relativeDirPath = join72(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
8390
8778
|
params.relativeFilePath = "AGENTS.md";
|
|
8391
8779
|
}
|
|
8392
8780
|
return params;
|
|
@@ -8451,7 +8839,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8451
8839
|
relativeFilePath: "AGENTS.md"
|
|
8452
8840
|
},
|
|
8453
8841
|
nonRoot: {
|
|
8454
|
-
relativeDirPath:
|
|
8842
|
+
relativeDirPath: join73(".agents", "memories")
|
|
8455
8843
|
}
|
|
8456
8844
|
};
|
|
8457
8845
|
}
|
|
@@ -8461,8 +8849,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8461
8849
|
validate = true
|
|
8462
8850
|
}) {
|
|
8463
8851
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
8464
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
8465
|
-
const fileContent = await readFileContent(
|
|
8852
|
+
const relativePath = isRoot ? "AGENTS.md" : join73(".agents", "memories", relativeFilePath);
|
|
8853
|
+
const fileContent = await readFileContent(join73(baseDir, relativePath));
|
|
8466
8854
|
return new _AgentsMdRule({
|
|
8467
8855
|
baseDir,
|
|
8468
8856
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -8517,21 +8905,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8517
8905
|
};
|
|
8518
8906
|
|
|
8519
8907
|
// src/features/rules/antigravity-rule.ts
|
|
8520
|
-
import { join as
|
|
8521
|
-
import { z as
|
|
8522
|
-
var AntigravityRuleFrontmatterSchema =
|
|
8523
|
-
trigger:
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
|
|
8908
|
+
import { join as join74 } from "path";
|
|
8909
|
+
import { z as z37 } from "zod/mini";
|
|
8910
|
+
var AntigravityRuleFrontmatterSchema = z37.looseObject({
|
|
8911
|
+
trigger: z37.optional(
|
|
8912
|
+
z37.union([
|
|
8913
|
+
z37.literal("always_on"),
|
|
8914
|
+
z37.literal("glob"),
|
|
8915
|
+
z37.literal("manual"),
|
|
8916
|
+
z37.literal("model_decision"),
|
|
8917
|
+
z37.string()
|
|
8530
8918
|
// accepts any string for forward compatibility
|
|
8531
8919
|
])
|
|
8532
8920
|
),
|
|
8533
|
-
globs:
|
|
8534
|
-
description:
|
|
8921
|
+
globs: z37.optional(z37.string()),
|
|
8922
|
+
description: z37.optional(z37.string())
|
|
8535
8923
|
});
|
|
8536
8924
|
function parseGlobsString(globs) {
|
|
8537
8925
|
if (!globs) {
|
|
@@ -8676,7 +9064,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8676
9064
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8677
9065
|
if (!result.success) {
|
|
8678
9066
|
throw new Error(
|
|
8679
|
-
`Invalid frontmatter in ${
|
|
9067
|
+
`Invalid frontmatter in ${join74(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8680
9068
|
);
|
|
8681
9069
|
}
|
|
8682
9070
|
}
|
|
@@ -8691,7 +9079,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8691
9079
|
static getSettablePaths() {
|
|
8692
9080
|
return {
|
|
8693
9081
|
nonRoot: {
|
|
8694
|
-
relativeDirPath:
|
|
9082
|
+
relativeDirPath: join74(".agent", "rules")
|
|
8695
9083
|
}
|
|
8696
9084
|
};
|
|
8697
9085
|
}
|
|
@@ -8700,7 +9088,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8700
9088
|
relativeFilePath,
|
|
8701
9089
|
validate = true
|
|
8702
9090
|
}) {
|
|
8703
|
-
const filePath =
|
|
9091
|
+
const filePath = join74(
|
|
8704
9092
|
baseDir,
|
|
8705
9093
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
8706
9094
|
relativeFilePath
|
|
@@ -8841,7 +9229,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8841
9229
|
};
|
|
8842
9230
|
|
|
8843
9231
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
8844
|
-
import { join as
|
|
9232
|
+
import { join as join75 } from "path";
|
|
8845
9233
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
8846
9234
|
toRulesyncRule() {
|
|
8847
9235
|
const rulesyncFrontmatter = {
|
|
@@ -8867,7 +9255,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8867
9255
|
relativeFilePath: ".augment-guidelines"
|
|
8868
9256
|
},
|
|
8869
9257
|
nonRoot: {
|
|
8870
|
-
relativeDirPath:
|
|
9258
|
+
relativeDirPath: join75(".augment", "rules")
|
|
8871
9259
|
}
|
|
8872
9260
|
};
|
|
8873
9261
|
}
|
|
@@ -8902,8 +9290,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8902
9290
|
}) {
|
|
8903
9291
|
const settablePaths = this.getSettablePaths();
|
|
8904
9292
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
8905
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
8906
|
-
const fileContent = await readFileContent(
|
|
9293
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join75(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9294
|
+
const fileContent = await readFileContent(join75(baseDir, relativePath));
|
|
8907
9295
|
return new _AugmentcodeLegacyRule({
|
|
8908
9296
|
baseDir,
|
|
8909
9297
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -8932,7 +9320,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8932
9320
|
};
|
|
8933
9321
|
|
|
8934
9322
|
// src/features/rules/augmentcode-rule.ts
|
|
8935
|
-
import { join as
|
|
9323
|
+
import { join as join76 } from "path";
|
|
8936
9324
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
8937
9325
|
toRulesyncRule() {
|
|
8938
9326
|
return this.toRulesyncRuleDefault();
|
|
@@ -8940,7 +9328,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8940
9328
|
static getSettablePaths() {
|
|
8941
9329
|
return {
|
|
8942
9330
|
nonRoot: {
|
|
8943
|
-
relativeDirPath:
|
|
9331
|
+
relativeDirPath: join76(".augment", "rules")
|
|
8944
9332
|
}
|
|
8945
9333
|
};
|
|
8946
9334
|
}
|
|
@@ -8964,7 +9352,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8964
9352
|
validate = true
|
|
8965
9353
|
}) {
|
|
8966
9354
|
const fileContent = await readFileContent(
|
|
8967
|
-
|
|
9355
|
+
join76(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8968
9356
|
);
|
|
8969
9357
|
const { body: content } = parseFrontmatter(fileContent);
|
|
8970
9358
|
return new _AugmentcodeRule({
|
|
@@ -9000,7 +9388,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9000
9388
|
};
|
|
9001
9389
|
|
|
9002
9390
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
9003
|
-
import { join as
|
|
9391
|
+
import { join as join77 } from "path";
|
|
9004
9392
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
9005
9393
|
static getSettablePaths({
|
|
9006
9394
|
global
|
|
@@ -9019,7 +9407,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9019
9407
|
relativeFilePath: "CLAUDE.md"
|
|
9020
9408
|
},
|
|
9021
9409
|
nonRoot: {
|
|
9022
|
-
relativeDirPath:
|
|
9410
|
+
relativeDirPath: join77(".claude", "memories")
|
|
9023
9411
|
}
|
|
9024
9412
|
};
|
|
9025
9413
|
}
|
|
@@ -9034,7 +9422,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9034
9422
|
if (isRoot) {
|
|
9035
9423
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9036
9424
|
const fileContent2 = await readFileContent(
|
|
9037
|
-
|
|
9425
|
+
join77(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9038
9426
|
);
|
|
9039
9427
|
return new _ClaudecodeLegacyRule({
|
|
9040
9428
|
baseDir,
|
|
@@ -9048,8 +9436,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9048
9436
|
if (!paths.nonRoot) {
|
|
9049
9437
|
throw new Error("nonRoot path is not set");
|
|
9050
9438
|
}
|
|
9051
|
-
const relativePath =
|
|
9052
|
-
const fileContent = await readFileContent(
|
|
9439
|
+
const relativePath = join77(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9440
|
+
const fileContent = await readFileContent(join77(baseDir, relativePath));
|
|
9053
9441
|
return new _ClaudecodeLegacyRule({
|
|
9054
9442
|
baseDir,
|
|
9055
9443
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9108,10 +9496,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9108
9496
|
};
|
|
9109
9497
|
|
|
9110
9498
|
// src/features/rules/claudecode-rule.ts
|
|
9111
|
-
import { join as
|
|
9112
|
-
import { z as
|
|
9113
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
9114
|
-
paths:
|
|
9499
|
+
import { join as join78 } from "path";
|
|
9500
|
+
import { z as z38 } from "zod/mini";
|
|
9501
|
+
var ClaudecodeRuleFrontmatterSchema = z38.object({
|
|
9502
|
+
paths: z38.optional(z38.string())
|
|
9115
9503
|
});
|
|
9116
9504
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
9117
9505
|
frontmatter;
|
|
@@ -9133,7 +9521,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9133
9521
|
relativeFilePath: "CLAUDE.md"
|
|
9134
9522
|
},
|
|
9135
9523
|
nonRoot: {
|
|
9136
|
-
relativeDirPath:
|
|
9524
|
+
relativeDirPath: join78(".claude", "rules")
|
|
9137
9525
|
}
|
|
9138
9526
|
};
|
|
9139
9527
|
}
|
|
@@ -9142,7 +9530,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9142
9530
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9143
9531
|
if (!result.success) {
|
|
9144
9532
|
throw new Error(
|
|
9145
|
-
`Invalid frontmatter in ${
|
|
9533
|
+
`Invalid frontmatter in ${join78(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9146
9534
|
);
|
|
9147
9535
|
}
|
|
9148
9536
|
}
|
|
@@ -9170,7 +9558,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9170
9558
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
9171
9559
|
if (isRoot) {
|
|
9172
9560
|
const fileContent2 = await readFileContent(
|
|
9173
|
-
|
|
9561
|
+
join78(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
9174
9562
|
);
|
|
9175
9563
|
return new _ClaudecodeRule({
|
|
9176
9564
|
baseDir,
|
|
@@ -9185,13 +9573,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9185
9573
|
if (!paths.nonRoot) {
|
|
9186
9574
|
throw new Error("nonRoot path is not set");
|
|
9187
9575
|
}
|
|
9188
|
-
const relativePath =
|
|
9189
|
-
const fileContent = await readFileContent(
|
|
9576
|
+
const relativePath = join78(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9577
|
+
const fileContent = await readFileContent(join78(baseDir, relativePath));
|
|
9190
9578
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9191
9579
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9192
9580
|
if (!result.success) {
|
|
9193
9581
|
throw new Error(
|
|
9194
|
-
`Invalid frontmatter in ${
|
|
9582
|
+
`Invalid frontmatter in ${join78(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
9195
9583
|
);
|
|
9196
9584
|
}
|
|
9197
9585
|
return new _ClaudecodeRule({
|
|
@@ -9298,7 +9686,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9298
9686
|
return {
|
|
9299
9687
|
success: false,
|
|
9300
9688
|
error: new Error(
|
|
9301
|
-
`Invalid frontmatter in ${
|
|
9689
|
+
`Invalid frontmatter in ${join78(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9302
9690
|
)
|
|
9303
9691
|
};
|
|
9304
9692
|
}
|
|
@@ -9318,10 +9706,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9318
9706
|
};
|
|
9319
9707
|
|
|
9320
9708
|
// src/features/rules/cline-rule.ts
|
|
9321
|
-
import { join as
|
|
9322
|
-
import { z as
|
|
9323
|
-
var ClineRuleFrontmatterSchema =
|
|
9324
|
-
description:
|
|
9709
|
+
import { join as join79 } from "path";
|
|
9710
|
+
import { z as z39 } from "zod/mini";
|
|
9711
|
+
var ClineRuleFrontmatterSchema = z39.object({
|
|
9712
|
+
description: z39.string()
|
|
9325
9713
|
});
|
|
9326
9714
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
9327
9715
|
static getSettablePaths() {
|
|
@@ -9363,7 +9751,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9363
9751
|
validate = true
|
|
9364
9752
|
}) {
|
|
9365
9753
|
const fileContent = await readFileContent(
|
|
9366
|
-
|
|
9754
|
+
join79(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9367
9755
|
);
|
|
9368
9756
|
return new _ClineRule({
|
|
9369
9757
|
baseDir,
|
|
@@ -9389,7 +9777,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9389
9777
|
};
|
|
9390
9778
|
|
|
9391
9779
|
// src/features/rules/codexcli-rule.ts
|
|
9392
|
-
import { join as
|
|
9780
|
+
import { join as join80 } from "path";
|
|
9393
9781
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
9394
9782
|
static getSettablePaths({
|
|
9395
9783
|
global
|
|
@@ -9408,7 +9796,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9408
9796
|
relativeFilePath: "AGENTS.md"
|
|
9409
9797
|
},
|
|
9410
9798
|
nonRoot: {
|
|
9411
|
-
relativeDirPath:
|
|
9799
|
+
relativeDirPath: join80(".codex", "memories")
|
|
9412
9800
|
}
|
|
9413
9801
|
};
|
|
9414
9802
|
}
|
|
@@ -9423,7 +9811,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9423
9811
|
if (isRoot) {
|
|
9424
9812
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9425
9813
|
const fileContent2 = await readFileContent(
|
|
9426
|
-
|
|
9814
|
+
join80(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9427
9815
|
);
|
|
9428
9816
|
return new _CodexcliRule({
|
|
9429
9817
|
baseDir,
|
|
@@ -9437,8 +9825,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9437
9825
|
if (!paths.nonRoot) {
|
|
9438
9826
|
throw new Error("nonRoot path is not set");
|
|
9439
9827
|
}
|
|
9440
|
-
const relativePath =
|
|
9441
|
-
const fileContent = await readFileContent(
|
|
9828
|
+
const relativePath = join80(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9829
|
+
const fileContent = await readFileContent(join80(baseDir, relativePath));
|
|
9442
9830
|
return new _CodexcliRule({
|
|
9443
9831
|
baseDir,
|
|
9444
9832
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9497,12 +9885,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9497
9885
|
};
|
|
9498
9886
|
|
|
9499
9887
|
// src/features/rules/copilot-rule.ts
|
|
9500
|
-
import { join as
|
|
9501
|
-
import { z as
|
|
9502
|
-
var CopilotRuleFrontmatterSchema =
|
|
9503
|
-
description:
|
|
9504
|
-
applyTo:
|
|
9505
|
-
excludeAgent:
|
|
9888
|
+
import { join as join81 } from "path";
|
|
9889
|
+
import { z as z40 } from "zod/mini";
|
|
9890
|
+
var CopilotRuleFrontmatterSchema = z40.object({
|
|
9891
|
+
description: z40.optional(z40.string()),
|
|
9892
|
+
applyTo: z40.optional(z40.string()),
|
|
9893
|
+
excludeAgent: z40.optional(z40.union([z40.literal("code-review"), z40.literal("coding-agent")]))
|
|
9506
9894
|
});
|
|
9507
9895
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
9508
9896
|
frontmatter;
|
|
@@ -9514,7 +9902,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9514
9902
|
relativeFilePath: "copilot-instructions.md"
|
|
9515
9903
|
},
|
|
9516
9904
|
nonRoot: {
|
|
9517
|
-
relativeDirPath:
|
|
9905
|
+
relativeDirPath: join81(".github", "instructions")
|
|
9518
9906
|
}
|
|
9519
9907
|
};
|
|
9520
9908
|
}
|
|
@@ -9523,7 +9911,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9523
9911
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9524
9912
|
if (!result.success) {
|
|
9525
9913
|
throw new Error(
|
|
9526
|
-
`Invalid frontmatter in ${
|
|
9914
|
+
`Invalid frontmatter in ${join81(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9527
9915
|
);
|
|
9528
9916
|
}
|
|
9529
9917
|
}
|
|
@@ -9605,11 +9993,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9605
9993
|
validate = true
|
|
9606
9994
|
}) {
|
|
9607
9995
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
9608
|
-
const relativePath = isRoot ?
|
|
9996
|
+
const relativePath = isRoot ? join81(
|
|
9609
9997
|
this.getSettablePaths().root.relativeDirPath,
|
|
9610
9998
|
this.getSettablePaths().root.relativeFilePath
|
|
9611
|
-
) :
|
|
9612
|
-
const fileContent = await readFileContent(
|
|
9999
|
+
) : join81(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10000
|
+
const fileContent = await readFileContent(join81(baseDir, relativePath));
|
|
9613
10001
|
if (isRoot) {
|
|
9614
10002
|
return new _CopilotRule({
|
|
9615
10003
|
baseDir,
|
|
@@ -9625,7 +10013,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9625
10013
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9626
10014
|
if (!result.success) {
|
|
9627
10015
|
throw new Error(
|
|
9628
|
-
`Invalid frontmatter in ${
|
|
10016
|
+
`Invalid frontmatter in ${join81(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9629
10017
|
);
|
|
9630
10018
|
}
|
|
9631
10019
|
return new _CopilotRule({
|
|
@@ -9665,7 +10053,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9665
10053
|
return {
|
|
9666
10054
|
success: false,
|
|
9667
10055
|
error: new Error(
|
|
9668
|
-
`Invalid frontmatter in ${
|
|
10056
|
+
`Invalid frontmatter in ${join81(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9669
10057
|
)
|
|
9670
10058
|
};
|
|
9671
10059
|
}
|
|
@@ -9685,12 +10073,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9685
10073
|
};
|
|
9686
10074
|
|
|
9687
10075
|
// src/features/rules/cursor-rule.ts
|
|
9688
|
-
import { basename as
|
|
9689
|
-
import { z as
|
|
9690
|
-
var CursorRuleFrontmatterSchema =
|
|
9691
|
-
description:
|
|
9692
|
-
globs:
|
|
9693
|
-
alwaysApply:
|
|
10076
|
+
import { basename as basename23, join as join82 } from "path";
|
|
10077
|
+
import { z as z41 } from "zod/mini";
|
|
10078
|
+
var CursorRuleFrontmatterSchema = z41.object({
|
|
10079
|
+
description: z41.optional(z41.string()),
|
|
10080
|
+
globs: z41.optional(z41.string()),
|
|
10081
|
+
alwaysApply: z41.optional(z41.boolean())
|
|
9694
10082
|
});
|
|
9695
10083
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
9696
10084
|
frontmatter;
|
|
@@ -9698,7 +10086,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9698
10086
|
static getSettablePaths() {
|
|
9699
10087
|
return {
|
|
9700
10088
|
nonRoot: {
|
|
9701
|
-
relativeDirPath:
|
|
10089
|
+
relativeDirPath: join82(".cursor", "rules")
|
|
9702
10090
|
}
|
|
9703
10091
|
};
|
|
9704
10092
|
}
|
|
@@ -9707,7 +10095,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9707
10095
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9708
10096
|
if (!result.success) {
|
|
9709
10097
|
throw new Error(
|
|
9710
|
-
`Invalid frontmatter in ${
|
|
10098
|
+
`Invalid frontmatter in ${join82(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9711
10099
|
);
|
|
9712
10100
|
}
|
|
9713
10101
|
}
|
|
@@ -9824,19 +10212,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9824
10212
|
validate = true
|
|
9825
10213
|
}) {
|
|
9826
10214
|
const fileContent = await readFileContent(
|
|
9827
|
-
|
|
10215
|
+
join82(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9828
10216
|
);
|
|
9829
10217
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
9830
10218
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9831
10219
|
if (!result.success) {
|
|
9832
10220
|
throw new Error(
|
|
9833
|
-
`Invalid frontmatter in ${
|
|
10221
|
+
`Invalid frontmatter in ${join82(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9834
10222
|
);
|
|
9835
10223
|
}
|
|
9836
10224
|
return new _CursorRule({
|
|
9837
10225
|
baseDir,
|
|
9838
10226
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
9839
|
-
relativeFilePath:
|
|
10227
|
+
relativeFilePath: basename23(relativeFilePath),
|
|
9840
10228
|
frontmatter: result.data,
|
|
9841
10229
|
body: content.trim(),
|
|
9842
10230
|
validate
|
|
@@ -9867,7 +10255,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9867
10255
|
return {
|
|
9868
10256
|
success: false,
|
|
9869
10257
|
error: new Error(
|
|
9870
|
-
`Invalid frontmatter in ${
|
|
10258
|
+
`Invalid frontmatter in ${join82(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9871
10259
|
)
|
|
9872
10260
|
};
|
|
9873
10261
|
}
|
|
@@ -9887,7 +10275,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9887
10275
|
};
|
|
9888
10276
|
|
|
9889
10277
|
// src/features/rules/geminicli-rule.ts
|
|
9890
|
-
import { join as
|
|
10278
|
+
import { join as join83 } from "path";
|
|
9891
10279
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
9892
10280
|
static getSettablePaths({
|
|
9893
10281
|
global
|
|
@@ -9906,7 +10294,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9906
10294
|
relativeFilePath: "GEMINI.md"
|
|
9907
10295
|
},
|
|
9908
10296
|
nonRoot: {
|
|
9909
|
-
relativeDirPath:
|
|
10297
|
+
relativeDirPath: join83(".gemini", "memories")
|
|
9910
10298
|
}
|
|
9911
10299
|
};
|
|
9912
10300
|
}
|
|
@@ -9921,7 +10309,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9921
10309
|
if (isRoot) {
|
|
9922
10310
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9923
10311
|
const fileContent2 = await readFileContent(
|
|
9924
|
-
|
|
10312
|
+
join83(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9925
10313
|
);
|
|
9926
10314
|
return new _GeminiCliRule({
|
|
9927
10315
|
baseDir,
|
|
@@ -9935,8 +10323,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9935
10323
|
if (!paths.nonRoot) {
|
|
9936
10324
|
throw new Error("nonRoot path is not set");
|
|
9937
10325
|
}
|
|
9938
|
-
const relativePath =
|
|
9939
|
-
const fileContent = await readFileContent(
|
|
10326
|
+
const relativePath = join83(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10327
|
+
const fileContent = await readFileContent(join83(baseDir, relativePath));
|
|
9940
10328
|
return new _GeminiCliRule({
|
|
9941
10329
|
baseDir,
|
|
9942
10330
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9995,7 +10383,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9995
10383
|
};
|
|
9996
10384
|
|
|
9997
10385
|
// src/features/rules/junie-rule.ts
|
|
9998
|
-
import { join as
|
|
10386
|
+
import { join as join84 } from "path";
|
|
9999
10387
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
10000
10388
|
static getSettablePaths() {
|
|
10001
10389
|
return {
|
|
@@ -10004,7 +10392,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10004
10392
|
relativeFilePath: "guidelines.md"
|
|
10005
10393
|
},
|
|
10006
10394
|
nonRoot: {
|
|
10007
|
-
relativeDirPath:
|
|
10395
|
+
relativeDirPath: join84(".junie", "memories")
|
|
10008
10396
|
}
|
|
10009
10397
|
};
|
|
10010
10398
|
}
|
|
@@ -10014,8 +10402,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10014
10402
|
validate = true
|
|
10015
10403
|
}) {
|
|
10016
10404
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
10017
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
10018
|
-
const fileContent = await readFileContent(
|
|
10405
|
+
const relativePath = isRoot ? "guidelines.md" : join84(".junie", "memories", relativeFilePath);
|
|
10406
|
+
const fileContent = await readFileContent(join84(baseDir, relativePath));
|
|
10019
10407
|
return new _JunieRule({
|
|
10020
10408
|
baseDir,
|
|
10021
10409
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10070,12 +10458,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10070
10458
|
};
|
|
10071
10459
|
|
|
10072
10460
|
// src/features/rules/kilo-rule.ts
|
|
10073
|
-
import { join as
|
|
10461
|
+
import { join as join85 } from "path";
|
|
10074
10462
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
10075
10463
|
static getSettablePaths(_options = {}) {
|
|
10076
10464
|
return {
|
|
10077
10465
|
nonRoot: {
|
|
10078
|
-
relativeDirPath:
|
|
10466
|
+
relativeDirPath: join85(".kilocode", "rules")
|
|
10079
10467
|
}
|
|
10080
10468
|
};
|
|
10081
10469
|
}
|
|
@@ -10085,7 +10473,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10085
10473
|
validate = true
|
|
10086
10474
|
}) {
|
|
10087
10475
|
const fileContent = await readFileContent(
|
|
10088
|
-
|
|
10476
|
+
join85(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10089
10477
|
);
|
|
10090
10478
|
return new _KiloRule({
|
|
10091
10479
|
baseDir,
|
|
@@ -10137,12 +10525,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10137
10525
|
};
|
|
10138
10526
|
|
|
10139
10527
|
// src/features/rules/kiro-rule.ts
|
|
10140
|
-
import { join as
|
|
10528
|
+
import { join as join86 } from "path";
|
|
10141
10529
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
10142
10530
|
static getSettablePaths() {
|
|
10143
10531
|
return {
|
|
10144
10532
|
nonRoot: {
|
|
10145
|
-
relativeDirPath:
|
|
10533
|
+
relativeDirPath: join86(".kiro", "steering")
|
|
10146
10534
|
}
|
|
10147
10535
|
};
|
|
10148
10536
|
}
|
|
@@ -10152,7 +10540,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10152
10540
|
validate = true
|
|
10153
10541
|
}) {
|
|
10154
10542
|
const fileContent = await readFileContent(
|
|
10155
|
-
|
|
10543
|
+
join86(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10156
10544
|
);
|
|
10157
10545
|
return new _KiroRule({
|
|
10158
10546
|
baseDir,
|
|
@@ -10206,7 +10594,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10206
10594
|
};
|
|
10207
10595
|
|
|
10208
10596
|
// src/features/rules/opencode-rule.ts
|
|
10209
|
-
import { join as
|
|
10597
|
+
import { join as join87 } from "path";
|
|
10210
10598
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
10211
10599
|
static getSettablePaths() {
|
|
10212
10600
|
return {
|
|
@@ -10215,7 +10603,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10215
10603
|
relativeFilePath: "AGENTS.md"
|
|
10216
10604
|
},
|
|
10217
10605
|
nonRoot: {
|
|
10218
|
-
relativeDirPath:
|
|
10606
|
+
relativeDirPath: join87(".opencode", "memories")
|
|
10219
10607
|
}
|
|
10220
10608
|
};
|
|
10221
10609
|
}
|
|
@@ -10225,8 +10613,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10225
10613
|
validate = true
|
|
10226
10614
|
}) {
|
|
10227
10615
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
10228
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
10229
|
-
const fileContent = await readFileContent(
|
|
10616
|
+
const relativePath = isRoot ? "AGENTS.md" : join87(".opencode", "memories", relativeFilePath);
|
|
10617
|
+
const fileContent = await readFileContent(join87(baseDir, relativePath));
|
|
10230
10618
|
return new _OpenCodeRule({
|
|
10231
10619
|
baseDir,
|
|
10232
10620
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10281,7 +10669,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10281
10669
|
};
|
|
10282
10670
|
|
|
10283
10671
|
// src/features/rules/qwencode-rule.ts
|
|
10284
|
-
import { join as
|
|
10672
|
+
import { join as join88 } from "path";
|
|
10285
10673
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
10286
10674
|
static getSettablePaths() {
|
|
10287
10675
|
return {
|
|
@@ -10290,7 +10678,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10290
10678
|
relativeFilePath: "QWEN.md"
|
|
10291
10679
|
},
|
|
10292
10680
|
nonRoot: {
|
|
10293
|
-
relativeDirPath:
|
|
10681
|
+
relativeDirPath: join88(".qwen", "memories")
|
|
10294
10682
|
}
|
|
10295
10683
|
};
|
|
10296
10684
|
}
|
|
@@ -10300,8 +10688,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10300
10688
|
validate = true
|
|
10301
10689
|
}) {
|
|
10302
10690
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
10303
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
10304
|
-
const fileContent = await readFileContent(
|
|
10691
|
+
const relativePath = isRoot ? "QWEN.md" : join88(".qwen", "memories", relativeFilePath);
|
|
10692
|
+
const fileContent = await readFileContent(join88(baseDir, relativePath));
|
|
10305
10693
|
return new _QwencodeRule({
|
|
10306
10694
|
baseDir,
|
|
10307
10695
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10352,13 +10740,101 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10352
10740
|
}
|
|
10353
10741
|
};
|
|
10354
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
|
+
|
|
10355
10831
|
// src/features/rules/roo-rule.ts
|
|
10356
|
-
import { join as
|
|
10832
|
+
import { join as join90 } from "path";
|
|
10357
10833
|
var RooRule = class _RooRule extends ToolRule {
|
|
10358
10834
|
static getSettablePaths() {
|
|
10359
10835
|
return {
|
|
10360
10836
|
nonRoot: {
|
|
10361
|
-
relativeDirPath:
|
|
10837
|
+
relativeDirPath: join90(".roo", "rules")
|
|
10362
10838
|
}
|
|
10363
10839
|
};
|
|
10364
10840
|
}
|
|
@@ -10368,7 +10844,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10368
10844
|
validate = true
|
|
10369
10845
|
}) {
|
|
10370
10846
|
const fileContent = await readFileContent(
|
|
10371
|
-
|
|
10847
|
+
join90(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10372
10848
|
);
|
|
10373
10849
|
return new _RooRule({
|
|
10374
10850
|
baseDir,
|
|
@@ -10437,7 +10913,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10437
10913
|
};
|
|
10438
10914
|
|
|
10439
10915
|
// src/features/rules/warp-rule.ts
|
|
10440
|
-
import { join as
|
|
10916
|
+
import { join as join91 } from "path";
|
|
10441
10917
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
10442
10918
|
constructor({ fileContent, root, ...rest }) {
|
|
10443
10919
|
super({
|
|
@@ -10453,7 +10929,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10453
10929
|
relativeFilePath: "WARP.md"
|
|
10454
10930
|
},
|
|
10455
10931
|
nonRoot: {
|
|
10456
|
-
relativeDirPath:
|
|
10932
|
+
relativeDirPath: join91(".warp", "memories")
|
|
10457
10933
|
}
|
|
10458
10934
|
};
|
|
10459
10935
|
}
|
|
@@ -10463,8 +10939,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10463
10939
|
validate = true
|
|
10464
10940
|
}) {
|
|
10465
10941
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
10466
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
10467
|
-
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));
|
|
10468
10944
|
return new _WarpRule({
|
|
10469
10945
|
baseDir,
|
|
10470
10946
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -10519,12 +10995,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10519
10995
|
};
|
|
10520
10996
|
|
|
10521
10997
|
// src/features/rules/windsurf-rule.ts
|
|
10522
|
-
import { join as
|
|
10998
|
+
import { join as join92 } from "path";
|
|
10523
10999
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
10524
11000
|
static getSettablePaths() {
|
|
10525
11001
|
return {
|
|
10526
11002
|
nonRoot: {
|
|
10527
|
-
relativeDirPath:
|
|
11003
|
+
relativeDirPath: join92(".windsurf", "rules")
|
|
10528
11004
|
}
|
|
10529
11005
|
};
|
|
10530
11006
|
}
|
|
@@ -10534,7 +11010,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
10534
11010
|
validate = true
|
|
10535
11011
|
}) {
|
|
10536
11012
|
const fileContent = await readFileContent(
|
|
10537
|
-
|
|
11013
|
+
join92(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10538
11014
|
);
|
|
10539
11015
|
return new _WindsurfRule({
|
|
10540
11016
|
baseDir,
|
|
@@ -10603,11 +11079,12 @@ var rulesProcessorToolTargets = [
|
|
|
10603
11079
|
"kiro",
|
|
10604
11080
|
"opencode",
|
|
10605
11081
|
"qwencode",
|
|
11082
|
+
"replit",
|
|
10606
11083
|
"roo",
|
|
10607
11084
|
"warp",
|
|
10608
11085
|
"windsurf"
|
|
10609
11086
|
];
|
|
10610
|
-
var RulesProcessorToolTargetSchema =
|
|
11087
|
+
var RulesProcessorToolTargetSchema = z42.enum(rulesProcessorToolTargets);
|
|
10611
11088
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
10612
11089
|
[
|
|
10613
11090
|
"agentsmd",
|
|
@@ -10757,6 +11234,13 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
10757
11234
|
meta: { extension: "md", supportsGlobal: false, ruleDiscoveryMode: "toon" }
|
|
10758
11235
|
}
|
|
10759
11236
|
],
|
|
11237
|
+
[
|
|
11238
|
+
"replit",
|
|
11239
|
+
{
|
|
11240
|
+
class: ReplitRule,
|
|
11241
|
+
meta: { extension: "md", supportsGlobal: false, ruleDiscoveryMode: "auto" }
|
|
11242
|
+
}
|
|
11243
|
+
],
|
|
10760
11244
|
[
|
|
10761
11245
|
"roo",
|
|
10762
11246
|
{
|
|
@@ -10891,7 +11375,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10891
11375
|
}).relativeDirPath;
|
|
10892
11376
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
10893
11377
|
const frontmatter = skill.getFrontmatter();
|
|
10894
|
-
const relativePath =
|
|
11378
|
+
const relativePath = join93(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
10895
11379
|
return {
|
|
10896
11380
|
name: frontmatter.name,
|
|
10897
11381
|
description: frontmatter.description,
|
|
@@ -10958,10 +11442,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10958
11442
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
10959
11443
|
*/
|
|
10960
11444
|
async loadRulesyncFiles() {
|
|
10961
|
-
const files = await findFilesByGlobs(
|
|
11445
|
+
const files = await findFilesByGlobs(join93(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
10962
11446
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
10963
11447
|
const rulesyncRules = await Promise.all(
|
|
10964
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath:
|
|
11448
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename24(file) }))
|
|
10965
11449
|
);
|
|
10966
11450
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
10967
11451
|
if (rootRules.length > 1) {
|
|
@@ -10979,10 +11463,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10979
11463
|
return rulesyncRules;
|
|
10980
11464
|
}
|
|
10981
11465
|
async loadRulesyncFilesLegacy() {
|
|
10982
|
-
const legacyFiles = await findFilesByGlobs(
|
|
11466
|
+
const legacyFiles = await findFilesByGlobs(join93(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
10983
11467
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
10984
11468
|
return Promise.all(
|
|
10985
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath:
|
|
11469
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename24(file) }))
|
|
10986
11470
|
);
|
|
10987
11471
|
}
|
|
10988
11472
|
/**
|
|
@@ -11000,7 +11484,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11000
11484
|
return [];
|
|
11001
11485
|
}
|
|
11002
11486
|
const rootFilePaths = await findFilesByGlobs(
|
|
11003
|
-
|
|
11487
|
+
join93(
|
|
11004
11488
|
this.baseDir,
|
|
11005
11489
|
settablePaths.root.relativeDirPath ?? ".",
|
|
11006
11490
|
settablePaths.root.relativeFilePath
|
|
@@ -11011,7 +11495,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11011
11495
|
(filePath) => factory.class.forDeletion({
|
|
11012
11496
|
baseDir: this.baseDir,
|
|
11013
11497
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
11014
|
-
relativeFilePath:
|
|
11498
|
+
relativeFilePath: basename24(filePath),
|
|
11015
11499
|
global: this.global
|
|
11016
11500
|
})
|
|
11017
11501
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11020,7 +11504,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11020
11504
|
rootFilePaths.map(
|
|
11021
11505
|
(filePath) => factory.class.fromFile({
|
|
11022
11506
|
baseDir: this.baseDir,
|
|
11023
|
-
relativeFilePath:
|
|
11507
|
+
relativeFilePath: basename24(filePath),
|
|
11024
11508
|
global: this.global
|
|
11025
11509
|
})
|
|
11026
11510
|
)
|
|
@@ -11032,14 +11516,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11032
11516
|
return [];
|
|
11033
11517
|
}
|
|
11034
11518
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
11035
|
-
|
|
11519
|
+
join93(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
11036
11520
|
);
|
|
11037
11521
|
if (forDeletion) {
|
|
11038
11522
|
return nonRootFilePaths.map(
|
|
11039
11523
|
(filePath) => factory.class.forDeletion({
|
|
11040
11524
|
baseDir: this.baseDir,
|
|
11041
11525
|
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
11042
|
-
relativeFilePath:
|
|
11526
|
+
relativeFilePath: basename24(filePath),
|
|
11043
11527
|
global: this.global
|
|
11044
11528
|
})
|
|
11045
11529
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11048,7 +11532,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11048
11532
|
nonRootFilePaths.map(
|
|
11049
11533
|
(filePath) => factory.class.fromFile({
|
|
11050
11534
|
baseDir: this.baseDir,
|
|
11051
|
-
relativeFilePath:
|
|
11535
|
+
relativeFilePath: basename24(filePath),
|
|
11052
11536
|
global: this.global
|
|
11053
11537
|
})
|
|
11054
11538
|
)
|
|
@@ -11141,14 +11625,14 @@ s/<command> [arguments]
|
|
|
11141
11625
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
11142
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.
|
|
11143
11627
|
|
|
11144
|
-
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.` : "";
|
|
11145
11629
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
11146
11630
|
|
|
11147
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.
|
|
11148
11632
|
|
|
11149
|
-
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.
|
|
11150
11634
|
|
|
11151
|
-
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.` : "";
|
|
11152
11636
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
11153
11637
|
const result = [
|
|
11154
11638
|
overview,
|
|
@@ -11430,7 +11914,7 @@ async function generateSkills(config) {
|
|
|
11430
11914
|
}
|
|
11431
11915
|
|
|
11432
11916
|
// src/cli/commands/gitignore.ts
|
|
11433
|
-
import { join as
|
|
11917
|
+
import { join as join94 } from "path";
|
|
11434
11918
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
11435
11919
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
11436
11920
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -11439,6 +11923,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11439
11923
|
"**/.agents/",
|
|
11440
11924
|
// Antigravity
|
|
11441
11925
|
"**/.agent/rules/",
|
|
11926
|
+
"**/.agent/skills/",
|
|
11442
11927
|
"**/.agent/workflows/",
|
|
11443
11928
|
// Augment
|
|
11444
11929
|
"**/.augmentignore",
|
|
@@ -11492,6 +11977,8 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11492
11977
|
"**/.kilocodeignore",
|
|
11493
11978
|
// Kiro
|
|
11494
11979
|
"**/.kiro/steering/",
|
|
11980
|
+
"**/.kiro/prompts/",
|
|
11981
|
+
"**/.kiro/settings/mcp.json",
|
|
11495
11982
|
"**/.aiignore",
|
|
11496
11983
|
// OpenCode
|
|
11497
11984
|
"**/.opencode/memories/",
|
|
@@ -11501,6 +11988,8 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11501
11988
|
// Qwen
|
|
11502
11989
|
"**/QWEN.md",
|
|
11503
11990
|
"**/.qwen/memories/",
|
|
11991
|
+
// Replit
|
|
11992
|
+
"**/replit.md",
|
|
11504
11993
|
// Roo
|
|
11505
11994
|
"**/.roo/rules/",
|
|
11506
11995
|
"**/.roo/skills/",
|
|
@@ -11564,7 +12053,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
11564
12053
|
return result;
|
|
11565
12054
|
};
|
|
11566
12055
|
var gitignoreCommand = async () => {
|
|
11567
|
-
const gitignorePath =
|
|
12056
|
+
const gitignorePath = join94(process.cwd(), ".gitignore");
|
|
11568
12057
|
let gitignoreContent = "";
|
|
11569
12058
|
if (await fileExists(gitignorePath)) {
|
|
11570
12059
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -11763,7 +12252,7 @@ async function importSkills(config, tool) {
|
|
|
11763
12252
|
}
|
|
11764
12253
|
|
|
11765
12254
|
// src/cli/commands/init.ts
|
|
11766
|
-
import { join as
|
|
12255
|
+
import { join as join95 } from "path";
|
|
11767
12256
|
async function initCommand() {
|
|
11768
12257
|
logger.info("Initializing rulesync...");
|
|
11769
12258
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -11772,7 +12261,7 @@ async function initCommand() {
|
|
|
11772
12261
|
logger.success("rulesync initialized successfully!");
|
|
11773
12262
|
logger.info("Next steps:");
|
|
11774
12263
|
logger.info(
|
|
11775
|
-
`1. Edit ${RULESYNC_RELATIVE_DIR_PATH}/**/*.md, ${RULESYNC_MCP_RELATIVE_FILE_PATH} and ${RULESYNC_AIIGNORE_RELATIVE_FILE_PATH}`
|
|
12264
|
+
`1. Edit ${RULESYNC_RELATIVE_DIR_PATH}/**/*.md, ${RULESYNC_RELATIVE_DIR_PATH}/skills/*/${SKILL_FILE_NAME}, ${RULESYNC_MCP_RELATIVE_FILE_PATH} and ${RULESYNC_AIIGNORE_RELATIVE_FILE_PATH}`
|
|
11776
12265
|
);
|
|
11777
12266
|
logger.info("2. Run 'rulesync generate' to create configuration files");
|
|
11778
12267
|
}
|
|
@@ -11786,13 +12275,14 @@ async function createConfigFile() {
|
|
|
11786
12275
|
JSON.stringify(
|
|
11787
12276
|
{
|
|
11788
12277
|
targets: ["copilot", "cursor", "claudecode", "codexcli"],
|
|
11789
|
-
features: ["rules", "ignore", "mcp", "commands", "subagents"],
|
|
12278
|
+
features: ["rules", "ignore", "mcp", "commands", "subagents", "skills"],
|
|
11790
12279
|
baseDirs: ["."],
|
|
11791
12280
|
delete: true,
|
|
11792
12281
|
verbose: false,
|
|
11793
12282
|
global: false,
|
|
11794
12283
|
simulateCommands: false,
|
|
11795
12284
|
simulateSubagents: false,
|
|
12285
|
+
simulateSkills: false,
|
|
11796
12286
|
modularMcp: false
|
|
11797
12287
|
},
|
|
11798
12288
|
null,
|
|
@@ -11911,6 +12401,18 @@ Based on the user's instruction, create a plan while analyzing the related files
|
|
|
11911
12401
|
|
|
11912
12402
|
Attention, again, you are just the planner, so though you can read any files and run any commands for analysis, please don't write any code.
|
|
11913
12403
|
`
|
|
12404
|
+
};
|
|
12405
|
+
const sampleSkillFile = {
|
|
12406
|
+
dirName: "project-context",
|
|
12407
|
+
content: `---
|
|
12408
|
+
name: project-context
|
|
12409
|
+
description: "Summarize the project context and key constraints"
|
|
12410
|
+
targets: ["*"]
|
|
12411
|
+
---
|
|
12412
|
+
|
|
12413
|
+
Summarize the project goals, core constraints, and relevant dependencies.
|
|
12414
|
+
Call out any architecture decisions, shared conventions, and validation steps.
|
|
12415
|
+
Keep the summary concise and ready to reuse in future tasks.`
|
|
11914
12416
|
};
|
|
11915
12417
|
const sampleIgnoreFile = {
|
|
11916
12418
|
content: `credentials/
|
|
@@ -11920,20 +12422,22 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11920
12422
|
const mcpPaths = RulesyncMcp.getSettablePaths();
|
|
11921
12423
|
const commandPaths = RulesyncCommand.getSettablePaths();
|
|
11922
12424
|
const subagentPaths = RulesyncSubagent.getSettablePaths();
|
|
12425
|
+
const skillPaths = RulesyncSkill.getSettablePaths();
|
|
11923
12426
|
const ignorePaths = RulesyncIgnore.getSettablePaths();
|
|
11924
12427
|
await ensureDir(rulePaths.recommended.relativeDirPath);
|
|
11925
12428
|
await ensureDir(mcpPaths.recommended.relativeDirPath);
|
|
11926
12429
|
await ensureDir(commandPaths.relativeDirPath);
|
|
11927
12430
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
12431
|
+
await ensureDir(skillPaths.relativeDirPath);
|
|
11928
12432
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
11929
|
-
const ruleFilepath =
|
|
12433
|
+
const ruleFilepath = join95(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
11930
12434
|
if (!await fileExists(ruleFilepath)) {
|
|
11931
12435
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
11932
12436
|
logger.success(`Created ${ruleFilepath}`);
|
|
11933
12437
|
} else {
|
|
11934
12438
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
11935
12439
|
}
|
|
11936
|
-
const mcpFilepath =
|
|
12440
|
+
const mcpFilepath = join95(
|
|
11937
12441
|
mcpPaths.recommended.relativeDirPath,
|
|
11938
12442
|
mcpPaths.recommended.relativeFilePath
|
|
11939
12443
|
);
|
|
@@ -11943,21 +12447,30 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11943
12447
|
} else {
|
|
11944
12448
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
11945
12449
|
}
|
|
11946
|
-
const commandFilepath =
|
|
12450
|
+
const commandFilepath = join95(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
11947
12451
|
if (!await fileExists(commandFilepath)) {
|
|
11948
12452
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
11949
12453
|
logger.success(`Created ${commandFilepath}`);
|
|
11950
12454
|
} else {
|
|
11951
12455
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
11952
12456
|
}
|
|
11953
|
-
const subagentFilepath =
|
|
12457
|
+
const subagentFilepath = join95(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
11954
12458
|
if (!await fileExists(subagentFilepath)) {
|
|
11955
12459
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
11956
12460
|
logger.success(`Created ${subagentFilepath}`);
|
|
11957
12461
|
} else {
|
|
11958
12462
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
11959
12463
|
}
|
|
11960
|
-
const
|
|
12464
|
+
const skillDirPath = join95(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
12465
|
+
await ensureDir(skillDirPath);
|
|
12466
|
+
const skillFilepath = join95(skillDirPath, SKILL_FILE_NAME);
|
|
12467
|
+
if (!await fileExists(skillFilepath)) {
|
|
12468
|
+
await writeFileContent(skillFilepath, sampleSkillFile.content);
|
|
12469
|
+
logger.success(`Created ${skillFilepath}`);
|
|
12470
|
+
} else {
|
|
12471
|
+
logger.info(`Skipped ${skillFilepath} (already exists)`);
|
|
12472
|
+
}
|
|
12473
|
+
const ignoreFilepath = join95(
|
|
11961
12474
|
ignorePaths.recommended.relativeDirPath,
|
|
11962
12475
|
ignorePaths.recommended.relativeFilePath
|
|
11963
12476
|
);
|
|
@@ -11973,15 +12486,15 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11973
12486
|
import { FastMCP } from "fastmcp";
|
|
11974
12487
|
|
|
11975
12488
|
// src/mcp/tools.ts
|
|
11976
|
-
import { z as
|
|
12489
|
+
import { z as z49 } from "zod/mini";
|
|
11977
12490
|
|
|
11978
12491
|
// src/mcp/commands.ts
|
|
11979
|
-
import { basename as
|
|
11980
|
-
import { z as
|
|
12492
|
+
import { basename as basename25, join as join96 } from "path";
|
|
12493
|
+
import { z as z43 } from "zod/mini";
|
|
11981
12494
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
11982
12495
|
var maxCommandsCount = 1e3;
|
|
11983
12496
|
async function listCommands() {
|
|
11984
|
-
const commandsDir =
|
|
12497
|
+
const commandsDir = join96(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
11985
12498
|
try {
|
|
11986
12499
|
const files = await listDirectoryFiles(commandsDir);
|
|
11987
12500
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -11993,7 +12506,7 @@ async function listCommands() {
|
|
|
11993
12506
|
});
|
|
11994
12507
|
const frontmatter = command.getFrontmatter();
|
|
11995
12508
|
return {
|
|
11996
|
-
relativePathFromCwd:
|
|
12509
|
+
relativePathFromCwd: join96(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
11997
12510
|
frontmatter
|
|
11998
12511
|
};
|
|
11999
12512
|
} catch (error) {
|
|
@@ -12013,13 +12526,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
12013
12526
|
relativePath: relativePathFromCwd,
|
|
12014
12527
|
intendedRootDir: process.cwd()
|
|
12015
12528
|
});
|
|
12016
|
-
const filename =
|
|
12529
|
+
const filename = basename25(relativePathFromCwd);
|
|
12017
12530
|
try {
|
|
12018
12531
|
const command = await RulesyncCommand.fromFile({
|
|
12019
12532
|
relativeFilePath: filename
|
|
12020
12533
|
});
|
|
12021
12534
|
return {
|
|
12022
|
-
relativePathFromCwd:
|
|
12535
|
+
relativePathFromCwd: join96(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12023
12536
|
frontmatter: command.getFrontmatter(),
|
|
12024
12537
|
body: command.getBody()
|
|
12025
12538
|
};
|
|
@@ -12038,7 +12551,7 @@ async function putCommand({
|
|
|
12038
12551
|
relativePath: relativePathFromCwd,
|
|
12039
12552
|
intendedRootDir: process.cwd()
|
|
12040
12553
|
});
|
|
12041
|
-
const filename =
|
|
12554
|
+
const filename = basename25(relativePathFromCwd);
|
|
12042
12555
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12043
12556
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
12044
12557
|
throw new Error(
|
|
@@ -12048,7 +12561,7 @@ async function putCommand({
|
|
|
12048
12561
|
try {
|
|
12049
12562
|
const existingCommands = await listCommands();
|
|
12050
12563
|
const isUpdate = existingCommands.some(
|
|
12051
|
-
(command2) => command2.relativePathFromCwd ===
|
|
12564
|
+
(command2) => command2.relativePathFromCwd === join96(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12052
12565
|
);
|
|
12053
12566
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
12054
12567
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -12063,11 +12576,11 @@ async function putCommand({
|
|
|
12063
12576
|
fileContent,
|
|
12064
12577
|
validate: true
|
|
12065
12578
|
});
|
|
12066
|
-
const commandsDir =
|
|
12579
|
+
const commandsDir = join96(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12067
12580
|
await ensureDir(commandsDir);
|
|
12068
12581
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
12069
12582
|
return {
|
|
12070
|
-
relativePathFromCwd:
|
|
12583
|
+
relativePathFromCwd: join96(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12071
12584
|
frontmatter: command.getFrontmatter(),
|
|
12072
12585
|
body: command.getBody()
|
|
12073
12586
|
};
|
|
@@ -12082,12 +12595,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12082
12595
|
relativePath: relativePathFromCwd,
|
|
12083
12596
|
intendedRootDir: process.cwd()
|
|
12084
12597
|
});
|
|
12085
|
-
const filename =
|
|
12086
|
-
const fullPath =
|
|
12598
|
+
const filename = basename25(relativePathFromCwd);
|
|
12599
|
+
const fullPath = join96(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
12087
12600
|
try {
|
|
12088
12601
|
await removeFile(fullPath);
|
|
12089
12602
|
return {
|
|
12090
|
-
relativePathFromCwd:
|
|
12603
|
+
relativePathFromCwd: join96(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12091
12604
|
};
|
|
12092
12605
|
} catch (error) {
|
|
12093
12606
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12096,23 +12609,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12096
12609
|
}
|
|
12097
12610
|
}
|
|
12098
12611
|
var commandToolSchemas = {
|
|
12099
|
-
listCommands:
|
|
12100
|
-
getCommand:
|
|
12101
|
-
relativePathFromCwd:
|
|
12612
|
+
listCommands: z43.object({}),
|
|
12613
|
+
getCommand: z43.object({
|
|
12614
|
+
relativePathFromCwd: z43.string()
|
|
12102
12615
|
}),
|
|
12103
|
-
putCommand:
|
|
12104
|
-
relativePathFromCwd:
|
|
12616
|
+
putCommand: z43.object({
|
|
12617
|
+
relativePathFromCwd: z43.string(),
|
|
12105
12618
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
12106
|
-
body:
|
|
12619
|
+
body: z43.string()
|
|
12107
12620
|
}),
|
|
12108
|
-
deleteCommand:
|
|
12109
|
-
relativePathFromCwd:
|
|
12621
|
+
deleteCommand: z43.object({
|
|
12622
|
+
relativePathFromCwd: z43.string()
|
|
12110
12623
|
})
|
|
12111
12624
|
};
|
|
12112
12625
|
var commandTools = {
|
|
12113
12626
|
listCommands: {
|
|
12114
12627
|
name: "listCommands",
|
|
12115
|
-
description: `List all commands from ${
|
|
12628
|
+
description: `List all commands from ${join96(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12116
12629
|
parameters: commandToolSchemas.listCommands,
|
|
12117
12630
|
execute: async () => {
|
|
12118
12631
|
const commands = await listCommands();
|
|
@@ -12154,11 +12667,11 @@ var commandTools = {
|
|
|
12154
12667
|
};
|
|
12155
12668
|
|
|
12156
12669
|
// src/mcp/ignore.ts
|
|
12157
|
-
import { join as
|
|
12158
|
-
import { z as
|
|
12670
|
+
import { join as join97 } from "path";
|
|
12671
|
+
import { z as z44 } from "zod/mini";
|
|
12159
12672
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
12160
12673
|
async function getIgnoreFile() {
|
|
12161
|
-
const ignoreFilePath =
|
|
12674
|
+
const ignoreFilePath = join97(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12162
12675
|
try {
|
|
12163
12676
|
const content = await readFileContent(ignoreFilePath);
|
|
12164
12677
|
return {
|
|
@@ -12172,7 +12685,7 @@ async function getIgnoreFile() {
|
|
|
12172
12685
|
}
|
|
12173
12686
|
}
|
|
12174
12687
|
async function putIgnoreFile({ content }) {
|
|
12175
|
-
const ignoreFilePath =
|
|
12688
|
+
const ignoreFilePath = join97(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12176
12689
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
12177
12690
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
12178
12691
|
throw new Error(
|
|
@@ -12193,8 +12706,8 @@ async function putIgnoreFile({ content }) {
|
|
|
12193
12706
|
}
|
|
12194
12707
|
}
|
|
12195
12708
|
async function deleteIgnoreFile() {
|
|
12196
|
-
const aiignorePath =
|
|
12197
|
-
const legacyIgnorePath =
|
|
12709
|
+
const aiignorePath = join97(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12710
|
+
const legacyIgnorePath = join97(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
12198
12711
|
try {
|
|
12199
12712
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
12200
12713
|
return {
|
|
@@ -12212,11 +12725,11 @@ async function deleteIgnoreFile() {
|
|
|
12212
12725
|
}
|
|
12213
12726
|
}
|
|
12214
12727
|
var ignoreToolSchemas = {
|
|
12215
|
-
getIgnoreFile:
|
|
12216
|
-
putIgnoreFile:
|
|
12217
|
-
content:
|
|
12728
|
+
getIgnoreFile: z44.object({}),
|
|
12729
|
+
putIgnoreFile: z44.object({
|
|
12730
|
+
content: z44.string()
|
|
12218
12731
|
}),
|
|
12219
|
-
deleteIgnoreFile:
|
|
12732
|
+
deleteIgnoreFile: z44.object({})
|
|
12220
12733
|
};
|
|
12221
12734
|
var ignoreTools = {
|
|
12222
12735
|
getIgnoreFile: {
|
|
@@ -12249,8 +12762,8 @@ var ignoreTools = {
|
|
|
12249
12762
|
};
|
|
12250
12763
|
|
|
12251
12764
|
// src/mcp/mcp.ts
|
|
12252
|
-
import { join as
|
|
12253
|
-
import { z as
|
|
12765
|
+
import { join as join98 } from "path";
|
|
12766
|
+
import { z as z45 } from "zod/mini";
|
|
12254
12767
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
12255
12768
|
async function getMcpFile() {
|
|
12256
12769
|
const config = await ConfigResolver.resolve({});
|
|
@@ -12259,7 +12772,7 @@ async function getMcpFile() {
|
|
|
12259
12772
|
validate: true,
|
|
12260
12773
|
modularMcp: config.getModularMcp()
|
|
12261
12774
|
});
|
|
12262
|
-
const relativePathFromCwd =
|
|
12775
|
+
const relativePathFromCwd = join98(
|
|
12263
12776
|
rulesyncMcp.getRelativeDirPath(),
|
|
12264
12777
|
rulesyncMcp.getRelativeFilePath()
|
|
12265
12778
|
);
|
|
@@ -12292,7 +12805,7 @@ async function putMcpFile({ content }) {
|
|
|
12292
12805
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12293
12806
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
12294
12807
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
12295
|
-
const fullPath =
|
|
12808
|
+
const fullPath = join98(baseDir, relativeDirPath, relativeFilePath);
|
|
12296
12809
|
const rulesyncMcp = new RulesyncMcp({
|
|
12297
12810
|
baseDir,
|
|
12298
12811
|
relativeDirPath,
|
|
@@ -12301,9 +12814,9 @@ async function putMcpFile({ content }) {
|
|
|
12301
12814
|
validate: true,
|
|
12302
12815
|
modularMcp: config.getModularMcp()
|
|
12303
12816
|
});
|
|
12304
|
-
await ensureDir(
|
|
12817
|
+
await ensureDir(join98(baseDir, relativeDirPath));
|
|
12305
12818
|
await writeFileContent(fullPath, content);
|
|
12306
|
-
const relativePathFromCwd =
|
|
12819
|
+
const relativePathFromCwd = join98(relativeDirPath, relativeFilePath);
|
|
12307
12820
|
return {
|
|
12308
12821
|
relativePathFromCwd,
|
|
12309
12822
|
content: rulesyncMcp.getFileContent()
|
|
@@ -12318,15 +12831,15 @@ async function deleteMcpFile() {
|
|
|
12318
12831
|
try {
|
|
12319
12832
|
const baseDir = process.cwd();
|
|
12320
12833
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12321
|
-
const recommendedPath =
|
|
12834
|
+
const recommendedPath = join98(
|
|
12322
12835
|
baseDir,
|
|
12323
12836
|
paths.recommended.relativeDirPath,
|
|
12324
12837
|
paths.recommended.relativeFilePath
|
|
12325
12838
|
);
|
|
12326
|
-
const legacyPath =
|
|
12839
|
+
const legacyPath = join98(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
12327
12840
|
await removeFile(recommendedPath);
|
|
12328
12841
|
await removeFile(legacyPath);
|
|
12329
|
-
const relativePathFromCwd =
|
|
12842
|
+
const relativePathFromCwd = join98(
|
|
12330
12843
|
paths.recommended.relativeDirPath,
|
|
12331
12844
|
paths.recommended.relativeFilePath
|
|
12332
12845
|
);
|
|
@@ -12340,11 +12853,11 @@ async function deleteMcpFile() {
|
|
|
12340
12853
|
}
|
|
12341
12854
|
}
|
|
12342
12855
|
var mcpToolSchemas = {
|
|
12343
|
-
getMcpFile:
|
|
12344
|
-
putMcpFile:
|
|
12345
|
-
content:
|
|
12856
|
+
getMcpFile: z45.object({}),
|
|
12857
|
+
putMcpFile: z45.object({
|
|
12858
|
+
content: z45.string()
|
|
12346
12859
|
}),
|
|
12347
|
-
deleteMcpFile:
|
|
12860
|
+
deleteMcpFile: z45.object({})
|
|
12348
12861
|
};
|
|
12349
12862
|
var mcpTools = {
|
|
12350
12863
|
getMcpFile: {
|
|
@@ -12377,12 +12890,12 @@ var mcpTools = {
|
|
|
12377
12890
|
};
|
|
12378
12891
|
|
|
12379
12892
|
// src/mcp/rules.ts
|
|
12380
|
-
import { basename as
|
|
12381
|
-
import { z as
|
|
12893
|
+
import { basename as basename26, join as join99 } from "path";
|
|
12894
|
+
import { z as z46 } from "zod/mini";
|
|
12382
12895
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
12383
12896
|
var maxRulesCount = 1e3;
|
|
12384
12897
|
async function listRules() {
|
|
12385
|
-
const rulesDir =
|
|
12898
|
+
const rulesDir = join99(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12386
12899
|
try {
|
|
12387
12900
|
const files = await listDirectoryFiles(rulesDir);
|
|
12388
12901
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12395,7 +12908,7 @@ async function listRules() {
|
|
|
12395
12908
|
});
|
|
12396
12909
|
const frontmatter = rule.getFrontmatter();
|
|
12397
12910
|
return {
|
|
12398
|
-
relativePathFromCwd:
|
|
12911
|
+
relativePathFromCwd: join99(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
12399
12912
|
frontmatter
|
|
12400
12913
|
};
|
|
12401
12914
|
} catch (error) {
|
|
@@ -12415,14 +12928,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
12415
12928
|
relativePath: relativePathFromCwd,
|
|
12416
12929
|
intendedRootDir: process.cwd()
|
|
12417
12930
|
});
|
|
12418
|
-
const filename =
|
|
12931
|
+
const filename = basename26(relativePathFromCwd);
|
|
12419
12932
|
try {
|
|
12420
12933
|
const rule = await RulesyncRule.fromFile({
|
|
12421
12934
|
relativeFilePath: filename,
|
|
12422
12935
|
validate: true
|
|
12423
12936
|
});
|
|
12424
12937
|
return {
|
|
12425
|
-
relativePathFromCwd:
|
|
12938
|
+
relativePathFromCwd: join99(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12426
12939
|
frontmatter: rule.getFrontmatter(),
|
|
12427
12940
|
body: rule.getBody()
|
|
12428
12941
|
};
|
|
@@ -12441,7 +12954,7 @@ async function putRule({
|
|
|
12441
12954
|
relativePath: relativePathFromCwd,
|
|
12442
12955
|
intendedRootDir: process.cwd()
|
|
12443
12956
|
});
|
|
12444
|
-
const filename =
|
|
12957
|
+
const filename = basename26(relativePathFromCwd);
|
|
12445
12958
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12446
12959
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
12447
12960
|
throw new Error(
|
|
@@ -12451,7 +12964,7 @@ async function putRule({
|
|
|
12451
12964
|
try {
|
|
12452
12965
|
const existingRules = await listRules();
|
|
12453
12966
|
const isUpdate = existingRules.some(
|
|
12454
|
-
(rule2) => rule2.relativePathFromCwd ===
|
|
12967
|
+
(rule2) => rule2.relativePathFromCwd === join99(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12455
12968
|
);
|
|
12456
12969
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
12457
12970
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -12464,11 +12977,11 @@ async function putRule({
|
|
|
12464
12977
|
body,
|
|
12465
12978
|
validate: true
|
|
12466
12979
|
});
|
|
12467
|
-
const rulesDir =
|
|
12980
|
+
const rulesDir = join99(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12468
12981
|
await ensureDir(rulesDir);
|
|
12469
12982
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
12470
12983
|
return {
|
|
12471
|
-
relativePathFromCwd:
|
|
12984
|
+
relativePathFromCwd: join99(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12472
12985
|
frontmatter: rule.getFrontmatter(),
|
|
12473
12986
|
body: rule.getBody()
|
|
12474
12987
|
};
|
|
@@ -12483,12 +12996,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
12483
12996
|
relativePath: relativePathFromCwd,
|
|
12484
12997
|
intendedRootDir: process.cwd()
|
|
12485
12998
|
});
|
|
12486
|
-
const filename =
|
|
12487
|
-
const fullPath =
|
|
12999
|
+
const filename = basename26(relativePathFromCwd);
|
|
13000
|
+
const fullPath = join99(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
12488
13001
|
try {
|
|
12489
13002
|
await removeFile(fullPath);
|
|
12490
13003
|
return {
|
|
12491
|
-
relativePathFromCwd:
|
|
13004
|
+
relativePathFromCwd: join99(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12492
13005
|
};
|
|
12493
13006
|
} catch (error) {
|
|
12494
13007
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12497,23 +13010,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
12497
13010
|
}
|
|
12498
13011
|
}
|
|
12499
13012
|
var ruleToolSchemas = {
|
|
12500
|
-
listRules:
|
|
12501
|
-
getRule:
|
|
12502
|
-
relativePathFromCwd:
|
|
13013
|
+
listRules: z46.object({}),
|
|
13014
|
+
getRule: z46.object({
|
|
13015
|
+
relativePathFromCwd: z46.string()
|
|
12503
13016
|
}),
|
|
12504
|
-
putRule:
|
|
12505
|
-
relativePathFromCwd:
|
|
13017
|
+
putRule: z46.object({
|
|
13018
|
+
relativePathFromCwd: z46.string(),
|
|
12506
13019
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
12507
|
-
body:
|
|
13020
|
+
body: z46.string()
|
|
12508
13021
|
}),
|
|
12509
|
-
deleteRule:
|
|
12510
|
-
relativePathFromCwd:
|
|
13022
|
+
deleteRule: z46.object({
|
|
13023
|
+
relativePathFromCwd: z46.string()
|
|
12511
13024
|
})
|
|
12512
13025
|
};
|
|
12513
13026
|
var ruleTools = {
|
|
12514
13027
|
listRules: {
|
|
12515
13028
|
name: "listRules",
|
|
12516
|
-
description: `List all rules from ${
|
|
13029
|
+
description: `List all rules from ${join99(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12517
13030
|
parameters: ruleToolSchemas.listRules,
|
|
12518
13031
|
execute: async () => {
|
|
12519
13032
|
const rules = await listRules();
|
|
@@ -12555,8 +13068,8 @@ var ruleTools = {
|
|
|
12555
13068
|
};
|
|
12556
13069
|
|
|
12557
13070
|
// src/mcp/skills.ts
|
|
12558
|
-
import { basename as
|
|
12559
|
-
import { z as
|
|
13071
|
+
import { basename as basename27, dirname as dirname2, join as join100 } from "path";
|
|
13072
|
+
import { z as z47 } from "zod/mini";
|
|
12560
13073
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
12561
13074
|
var maxSkillsCount = 1e3;
|
|
12562
13075
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -12572,19 +13085,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
12572
13085
|
};
|
|
12573
13086
|
}
|
|
12574
13087
|
function extractDirName(relativeDirPathFromCwd) {
|
|
12575
|
-
const dirName =
|
|
13088
|
+
const dirName = basename27(relativeDirPathFromCwd);
|
|
12576
13089
|
if (!dirName) {
|
|
12577
13090
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
12578
13091
|
}
|
|
12579
13092
|
return dirName;
|
|
12580
13093
|
}
|
|
12581
13094
|
async function listSkills() {
|
|
12582
|
-
const skillsDir =
|
|
13095
|
+
const skillsDir = join100(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
12583
13096
|
try {
|
|
12584
|
-
const skillDirPaths = await findFilesByGlobs(
|
|
13097
|
+
const skillDirPaths = await findFilesByGlobs(join100(skillsDir, "*"), { type: "dir" });
|
|
12585
13098
|
const skills = await Promise.all(
|
|
12586
13099
|
skillDirPaths.map(async (dirPath) => {
|
|
12587
|
-
const dirName =
|
|
13100
|
+
const dirName = basename27(dirPath);
|
|
12588
13101
|
if (!dirName) return null;
|
|
12589
13102
|
try {
|
|
12590
13103
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -12592,7 +13105,7 @@ async function listSkills() {
|
|
|
12592
13105
|
});
|
|
12593
13106
|
const frontmatter = skill.getFrontmatter();
|
|
12594
13107
|
return {
|
|
12595
|
-
relativeDirPathFromCwd:
|
|
13108
|
+
relativeDirPathFromCwd: join100(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12596
13109
|
frontmatter
|
|
12597
13110
|
};
|
|
12598
13111
|
} catch (error) {
|
|
@@ -12618,7 +13131,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
12618
13131
|
dirName
|
|
12619
13132
|
});
|
|
12620
13133
|
return {
|
|
12621
|
-
relativeDirPathFromCwd:
|
|
13134
|
+
relativeDirPathFromCwd: join100(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12622
13135
|
frontmatter: skill.getFrontmatter(),
|
|
12623
13136
|
body: skill.getBody(),
|
|
12624
13137
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12652,7 +13165,7 @@ async function putSkill({
|
|
|
12652
13165
|
try {
|
|
12653
13166
|
const existingSkills = await listSkills();
|
|
12654
13167
|
const isUpdate = existingSkills.some(
|
|
12655
|
-
(skill2) => skill2.relativeDirPathFromCwd ===
|
|
13168
|
+
(skill2) => skill2.relativeDirPathFromCwd === join100(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12656
13169
|
);
|
|
12657
13170
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
12658
13171
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -12667,9 +13180,9 @@ async function putSkill({
|
|
|
12667
13180
|
otherFiles: aiDirFiles,
|
|
12668
13181
|
validate: true
|
|
12669
13182
|
});
|
|
12670
|
-
const skillDirPath =
|
|
13183
|
+
const skillDirPath = join100(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12671
13184
|
await ensureDir(skillDirPath);
|
|
12672
|
-
const skillFilePath =
|
|
13185
|
+
const skillFilePath = join100(skillDirPath, SKILL_FILE_NAME);
|
|
12673
13186
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
12674
13187
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
12675
13188
|
for (const file of otherFiles) {
|
|
@@ -12677,15 +13190,15 @@ async function putSkill({
|
|
|
12677
13190
|
relativePath: file.name,
|
|
12678
13191
|
intendedRootDir: skillDirPath
|
|
12679
13192
|
});
|
|
12680
|
-
const filePath =
|
|
12681
|
-
const fileDir =
|
|
13193
|
+
const filePath = join100(skillDirPath, file.name);
|
|
13194
|
+
const fileDir = join100(skillDirPath, dirname2(file.name));
|
|
12682
13195
|
if (fileDir !== skillDirPath) {
|
|
12683
13196
|
await ensureDir(fileDir);
|
|
12684
13197
|
}
|
|
12685
13198
|
await writeFileContent(filePath, file.body);
|
|
12686
13199
|
}
|
|
12687
13200
|
return {
|
|
12688
|
-
relativeDirPathFromCwd:
|
|
13201
|
+
relativeDirPathFromCwd: join100(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12689
13202
|
frontmatter: skill.getFrontmatter(),
|
|
12690
13203
|
body: skill.getBody(),
|
|
12691
13204
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12707,13 +13220,13 @@ async function deleteSkill({
|
|
|
12707
13220
|
intendedRootDir: process.cwd()
|
|
12708
13221
|
});
|
|
12709
13222
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
12710
|
-
const skillDirPath =
|
|
13223
|
+
const skillDirPath = join100(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12711
13224
|
try {
|
|
12712
13225
|
if (await directoryExists(skillDirPath)) {
|
|
12713
13226
|
await removeDirectory(skillDirPath);
|
|
12714
13227
|
}
|
|
12715
13228
|
return {
|
|
12716
|
-
relativeDirPathFromCwd:
|
|
13229
|
+
relativeDirPathFromCwd: join100(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12717
13230
|
};
|
|
12718
13231
|
} catch (error) {
|
|
12719
13232
|
throw new Error(
|
|
@@ -12724,29 +13237,29 @@ async function deleteSkill({
|
|
|
12724
13237
|
);
|
|
12725
13238
|
}
|
|
12726
13239
|
}
|
|
12727
|
-
var McpSkillFileSchema =
|
|
12728
|
-
name:
|
|
12729
|
-
body:
|
|
13240
|
+
var McpSkillFileSchema = z47.object({
|
|
13241
|
+
name: z47.string(),
|
|
13242
|
+
body: z47.string()
|
|
12730
13243
|
});
|
|
12731
13244
|
var skillToolSchemas = {
|
|
12732
|
-
listSkills:
|
|
12733
|
-
getSkill:
|
|
12734
|
-
relativeDirPathFromCwd:
|
|
13245
|
+
listSkills: z47.object({}),
|
|
13246
|
+
getSkill: z47.object({
|
|
13247
|
+
relativeDirPathFromCwd: z47.string()
|
|
12735
13248
|
}),
|
|
12736
|
-
putSkill:
|
|
12737
|
-
relativeDirPathFromCwd:
|
|
13249
|
+
putSkill: z47.object({
|
|
13250
|
+
relativeDirPathFromCwd: z47.string(),
|
|
12738
13251
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
12739
|
-
body:
|
|
12740
|
-
otherFiles:
|
|
13252
|
+
body: z47.string(),
|
|
13253
|
+
otherFiles: z47.optional(z47.array(McpSkillFileSchema))
|
|
12741
13254
|
}),
|
|
12742
|
-
deleteSkill:
|
|
12743
|
-
relativeDirPathFromCwd:
|
|
13255
|
+
deleteSkill: z47.object({
|
|
13256
|
+
relativeDirPathFromCwd: z47.string()
|
|
12744
13257
|
})
|
|
12745
13258
|
};
|
|
12746
13259
|
var skillTools = {
|
|
12747
13260
|
listSkills: {
|
|
12748
13261
|
name: "listSkills",
|
|
12749
|
-
description: `List all skills from ${
|
|
13262
|
+
description: `List all skills from ${join100(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
12750
13263
|
parameters: skillToolSchemas.listSkills,
|
|
12751
13264
|
execute: async () => {
|
|
12752
13265
|
const skills = await listSkills();
|
|
@@ -12789,12 +13302,12 @@ var skillTools = {
|
|
|
12789
13302
|
};
|
|
12790
13303
|
|
|
12791
13304
|
// src/mcp/subagents.ts
|
|
12792
|
-
import { basename as
|
|
12793
|
-
import { z as
|
|
13305
|
+
import { basename as basename28, join as join101 } from "path";
|
|
13306
|
+
import { z as z48 } from "zod/mini";
|
|
12794
13307
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
12795
13308
|
var maxSubagentsCount = 1e3;
|
|
12796
13309
|
async function listSubagents() {
|
|
12797
|
-
const subagentsDir =
|
|
13310
|
+
const subagentsDir = join101(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12798
13311
|
try {
|
|
12799
13312
|
const files = await listDirectoryFiles(subagentsDir);
|
|
12800
13313
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12807,7 +13320,7 @@ async function listSubagents() {
|
|
|
12807
13320
|
});
|
|
12808
13321
|
const frontmatter = subagent.getFrontmatter();
|
|
12809
13322
|
return {
|
|
12810
|
-
relativePathFromCwd:
|
|
13323
|
+
relativePathFromCwd: join101(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
12811
13324
|
frontmatter
|
|
12812
13325
|
};
|
|
12813
13326
|
} catch (error) {
|
|
@@ -12829,14 +13342,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
12829
13342
|
relativePath: relativePathFromCwd,
|
|
12830
13343
|
intendedRootDir: process.cwd()
|
|
12831
13344
|
});
|
|
12832
|
-
const filename =
|
|
13345
|
+
const filename = basename28(relativePathFromCwd);
|
|
12833
13346
|
try {
|
|
12834
13347
|
const subagent = await RulesyncSubagent.fromFile({
|
|
12835
13348
|
relativeFilePath: filename,
|
|
12836
13349
|
validate: true
|
|
12837
13350
|
});
|
|
12838
13351
|
return {
|
|
12839
|
-
relativePathFromCwd:
|
|
13352
|
+
relativePathFromCwd: join101(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12840
13353
|
frontmatter: subagent.getFrontmatter(),
|
|
12841
13354
|
body: subagent.getBody()
|
|
12842
13355
|
};
|
|
@@ -12855,7 +13368,7 @@ async function putSubagent({
|
|
|
12855
13368
|
relativePath: relativePathFromCwd,
|
|
12856
13369
|
intendedRootDir: process.cwd()
|
|
12857
13370
|
});
|
|
12858
|
-
const filename =
|
|
13371
|
+
const filename = basename28(relativePathFromCwd);
|
|
12859
13372
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12860
13373
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
12861
13374
|
throw new Error(
|
|
@@ -12865,7 +13378,7 @@ async function putSubagent({
|
|
|
12865
13378
|
try {
|
|
12866
13379
|
const existingSubagents = await listSubagents();
|
|
12867
13380
|
const isUpdate = existingSubagents.some(
|
|
12868
|
-
(subagent2) => subagent2.relativePathFromCwd ===
|
|
13381
|
+
(subagent2) => subagent2.relativePathFromCwd === join101(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12869
13382
|
);
|
|
12870
13383
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
12871
13384
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -12878,11 +13391,11 @@ async function putSubagent({
|
|
|
12878
13391
|
body,
|
|
12879
13392
|
validate: true
|
|
12880
13393
|
});
|
|
12881
|
-
const subagentsDir =
|
|
13394
|
+
const subagentsDir = join101(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12882
13395
|
await ensureDir(subagentsDir);
|
|
12883
13396
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
12884
13397
|
return {
|
|
12885
|
-
relativePathFromCwd:
|
|
13398
|
+
relativePathFromCwd: join101(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12886
13399
|
frontmatter: subagent.getFrontmatter(),
|
|
12887
13400
|
body: subagent.getBody()
|
|
12888
13401
|
};
|
|
@@ -12897,12 +13410,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12897
13410
|
relativePath: relativePathFromCwd,
|
|
12898
13411
|
intendedRootDir: process.cwd()
|
|
12899
13412
|
});
|
|
12900
|
-
const filename =
|
|
12901
|
-
const fullPath =
|
|
13413
|
+
const filename = basename28(relativePathFromCwd);
|
|
13414
|
+
const fullPath = join101(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
12902
13415
|
try {
|
|
12903
13416
|
await removeFile(fullPath);
|
|
12904
13417
|
return {
|
|
12905
|
-
relativePathFromCwd:
|
|
13418
|
+
relativePathFromCwd: join101(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12906
13419
|
};
|
|
12907
13420
|
} catch (error) {
|
|
12908
13421
|
throw new Error(
|
|
@@ -12914,23 +13427,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12914
13427
|
}
|
|
12915
13428
|
}
|
|
12916
13429
|
var subagentToolSchemas = {
|
|
12917
|
-
listSubagents:
|
|
12918
|
-
getSubagent:
|
|
12919
|
-
relativePathFromCwd:
|
|
13430
|
+
listSubagents: z48.object({}),
|
|
13431
|
+
getSubagent: z48.object({
|
|
13432
|
+
relativePathFromCwd: z48.string()
|
|
12920
13433
|
}),
|
|
12921
|
-
putSubagent:
|
|
12922
|
-
relativePathFromCwd:
|
|
13434
|
+
putSubagent: z48.object({
|
|
13435
|
+
relativePathFromCwd: z48.string(),
|
|
12923
13436
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
12924
|
-
body:
|
|
13437
|
+
body: z48.string()
|
|
12925
13438
|
}),
|
|
12926
|
-
deleteSubagent:
|
|
12927
|
-
relativePathFromCwd:
|
|
13439
|
+
deleteSubagent: z48.object({
|
|
13440
|
+
relativePathFromCwd: z48.string()
|
|
12928
13441
|
})
|
|
12929
13442
|
};
|
|
12930
13443
|
var subagentTools = {
|
|
12931
13444
|
listSubagents: {
|
|
12932
13445
|
name: "listSubagents",
|
|
12933
|
-
description: `List all subagents from ${
|
|
13446
|
+
description: `List all subagents from ${join101(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12934
13447
|
parameters: subagentToolSchemas.listSubagents,
|
|
12935
13448
|
execute: async () => {
|
|
12936
13449
|
const subagents = await listSubagents();
|
|
@@ -12972,20 +13485,20 @@ var subagentTools = {
|
|
|
12972
13485
|
};
|
|
12973
13486
|
|
|
12974
13487
|
// src/mcp/tools.ts
|
|
12975
|
-
var rulesyncFeatureSchema =
|
|
12976
|
-
var rulesyncOperationSchema =
|
|
12977
|
-
var skillFileSchema =
|
|
12978
|
-
name:
|
|
12979
|
-
body:
|
|
13488
|
+
var rulesyncFeatureSchema = z49.enum(["rule", "command", "subagent", "skill", "ignore", "mcp"]);
|
|
13489
|
+
var rulesyncOperationSchema = z49.enum(["list", "get", "put", "delete"]);
|
|
13490
|
+
var skillFileSchema = z49.object({
|
|
13491
|
+
name: z49.string(),
|
|
13492
|
+
body: z49.string()
|
|
12980
13493
|
});
|
|
12981
|
-
var rulesyncToolSchema =
|
|
13494
|
+
var rulesyncToolSchema = z49.object({
|
|
12982
13495
|
feature: rulesyncFeatureSchema,
|
|
12983
13496
|
operation: rulesyncOperationSchema,
|
|
12984
|
-
targetPathFromCwd:
|
|
12985
|
-
frontmatter:
|
|
12986
|
-
body:
|
|
12987
|
-
otherFiles:
|
|
12988
|
-
content:
|
|
13497
|
+
targetPathFromCwd: z49.optional(z49.string()),
|
|
13498
|
+
frontmatter: z49.optional(z49.unknown()),
|
|
13499
|
+
body: z49.optional(z49.string()),
|
|
13500
|
+
otherFiles: z49.optional(z49.array(skillFileSchema)),
|
|
13501
|
+
content: z49.optional(z49.string())
|
|
12989
13502
|
});
|
|
12990
13503
|
var supportedOperationsByFeature = {
|
|
12991
13504
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -13181,7 +13694,7 @@ async function mcpCommand({ version }) {
|
|
|
13181
13694
|
}
|
|
13182
13695
|
|
|
13183
13696
|
// src/cli/index.ts
|
|
13184
|
-
var getVersion = () => "5.
|
|
13697
|
+
var getVersion = () => "5.5.0";
|
|
13185
13698
|
var main = async () => {
|
|
13186
13699
|
const program = new Command();
|
|
13187
13700
|
const version = getVersion();
|