rulesync 5.4.0 → 5.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -19
- package/dist/index.cjs +635 -410
- package/dist/index.js +627 -402
- package/package.json +19 -18
package/dist/index.cjs
CHANGED
|
@@ -110,7 +110,7 @@ var import_node_path2 = require("path");
|
|
|
110
110
|
|
|
111
111
|
// src/utils/file.ts
|
|
112
112
|
var import_es_toolkit = require("es-toolkit");
|
|
113
|
-
var
|
|
113
|
+
var import_globby = require("globby");
|
|
114
114
|
var import_promises = require("fs/promises");
|
|
115
115
|
var import_node_os = __toESM(require("os"), 1);
|
|
116
116
|
var import_node_path = require("path");
|
|
@@ -193,17 +193,10 @@ async function listDirectoryFiles(dir) {
|
|
|
193
193
|
}
|
|
194
194
|
async function findFilesByGlobs(globs, options = {}) {
|
|
195
195
|
const { type = "all" } = options;
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
case "dir":
|
|
201
|
-
return items.filter((item) => item.isDirectory()).map((item) => (0, import_node_path.join)(item.parentPath, item.name));
|
|
202
|
-
case "all":
|
|
203
|
-
return items.map((item) => (0, import_node_path.join)(item.parentPath, item.name));
|
|
204
|
-
default:
|
|
205
|
-
throw new Error(`Invalid type: ${type}`);
|
|
206
|
-
}
|
|
196
|
+
const globbyOptions = type === "file" ? { onlyFiles: true, onlyDirectories: false } : type === "dir" ? { onlyFiles: false, onlyDirectories: true } : { onlyFiles: false, onlyDirectories: false };
|
|
197
|
+
const normalizedGlobs = Array.isArray(globs) ? globs.map((g) => g.replaceAll("\\", "/")) : globs.replaceAll("\\", "/");
|
|
198
|
+
const results = (0, import_globby.globbySync)(normalizedGlobs, { absolute: true, ...globbyOptions });
|
|
199
|
+
return results.toSorted();
|
|
207
200
|
}
|
|
208
201
|
async function removeDirectory(dirPath) {
|
|
209
202
|
const dangerousPaths = [".", "/", "~", "src", "node_modules"];
|
|
@@ -271,6 +264,7 @@ var ALL_TOOL_TARGETS = [
|
|
|
271
264
|
"kiro",
|
|
272
265
|
"opencode",
|
|
273
266
|
"qwencode",
|
|
267
|
+
"replit",
|
|
274
268
|
"roo",
|
|
275
269
|
"warp",
|
|
276
270
|
"windsurf",
|
|
@@ -486,7 +480,7 @@ var RULESYNC_OVERVIEW_FILE_NAME = "overview.md";
|
|
|
486
480
|
var RULESYNC_SKILLS_RELATIVE_DIR_PATH = (0, import_node_path3.join)(RULESYNC_RELATIVE_DIR_PATH, "skills");
|
|
487
481
|
|
|
488
482
|
// src/features/commands/commands-processor.ts
|
|
489
|
-
var
|
|
483
|
+
var import_node_path19 = require("path");
|
|
490
484
|
var import_mini12 = require("zod/mini");
|
|
491
485
|
|
|
492
486
|
// src/types/feature-processor.ts
|
|
@@ -904,6 +898,11 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
904
898
|
var import_node_path8 = require("path");
|
|
905
899
|
var import_mini6 = require("zod/mini");
|
|
906
900
|
|
|
901
|
+
// src/utils/type-guards.ts
|
|
902
|
+
function isRecord(value) {
|
|
903
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
904
|
+
}
|
|
905
|
+
|
|
907
906
|
// src/features/commands/rulesync-command.ts
|
|
908
907
|
var import_node_path7 = require("path");
|
|
909
908
|
var import_mini5 = require("zod/mini");
|
|
@@ -996,8 +995,14 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
996
995
|
};
|
|
997
996
|
|
|
998
997
|
// src/features/commands/antigravity-command.ts
|
|
999
|
-
var
|
|
1000
|
-
|
|
998
|
+
var AntigravityWorkflowFrontmatterSchema = import_mini6.z.looseObject({
|
|
999
|
+
trigger: import_mini6.z.optional(import_mini6.z.string()),
|
|
1000
|
+
turbo: import_mini6.z.optional(import_mini6.z.boolean())
|
|
1001
|
+
});
|
|
1002
|
+
var AntigravityCommandFrontmatterSchema = import_mini6.z.looseObject({
|
|
1003
|
+
description: import_mini6.z.string(),
|
|
1004
|
+
// Support for workflow-specific configuration
|
|
1005
|
+
...AntigravityWorkflowFrontmatterSchema.shape
|
|
1001
1006
|
});
|
|
1002
1007
|
var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
1003
1008
|
frontmatter;
|
|
@@ -1030,9 +1035,12 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1030
1035
|
return this.frontmatter;
|
|
1031
1036
|
}
|
|
1032
1037
|
toRulesyncCommand() {
|
|
1038
|
+
const { description, ...restFields } = this.frontmatter;
|
|
1033
1039
|
const rulesyncFrontmatter = {
|
|
1034
1040
|
targets: ["antigravity"],
|
|
1035
|
-
description
|
|
1041
|
+
description,
|
|
1042
|
+
// Preserve extra fields in antigravity section
|
|
1043
|
+
...Object.keys(restFields).length > 0 && { antigravity: restFields }
|
|
1036
1044
|
};
|
|
1037
1045
|
const fileContent = stringifyFrontmatter(this.body, rulesyncFrontmatter);
|
|
1038
1046
|
return new RulesyncCommand({
|
|
@@ -1046,27 +1054,56 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1046
1054
|
validate: true
|
|
1047
1055
|
});
|
|
1048
1056
|
}
|
|
1057
|
+
static extractAntigravityConfig(rulesyncCommand) {
|
|
1058
|
+
const antigravity = rulesyncCommand.getFrontmatter().antigravity;
|
|
1059
|
+
return isRecord(antigravity) ? antigravity : void 0;
|
|
1060
|
+
}
|
|
1049
1061
|
static fromRulesyncCommand({
|
|
1050
1062
|
baseDir = process.cwd(),
|
|
1051
1063
|
rulesyncCommand,
|
|
1052
1064
|
validate = true
|
|
1053
1065
|
}) {
|
|
1054
1066
|
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
1067
|
+
const antigravityConfig = this.extractAntigravityConfig(rulesyncCommand);
|
|
1068
|
+
const trigger = this.resolveTrigger(rulesyncCommand, antigravityConfig);
|
|
1069
|
+
const turbo = typeof antigravityConfig?.turbo === "boolean" ? antigravityConfig.turbo : true;
|
|
1070
|
+
let relativeFilePath = rulesyncCommand.getRelativeFilePath();
|
|
1071
|
+
let body = rulesyncCommand.getBody().replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, "").trim();
|
|
1072
|
+
const sanitizedTrigger = trigger.replace(/[^a-zA-Z0-9-_]/g, "-").replace(/^-+|-+$/g, "");
|
|
1073
|
+
if (!sanitizedTrigger) {
|
|
1074
|
+
throw new Error(`Invalid trigger: sanitization resulted in empty string from "${trigger}"`);
|
|
1075
|
+
}
|
|
1076
|
+
const validFilename = sanitizedTrigger + ".md";
|
|
1077
|
+
relativeFilePath = validFilename;
|
|
1078
|
+
const turboDirective = turbo ? "\n\n// turbo" : "";
|
|
1079
|
+
body = `# Workflow: ${trigger}
|
|
1080
|
+
|
|
1081
|
+
${body}${turboDirective}`;
|
|
1082
|
+
const description = rulesyncFrontmatter.description;
|
|
1055
1083
|
const antigravityFrontmatter = {
|
|
1056
|
-
description
|
|
1084
|
+
description,
|
|
1085
|
+
trigger,
|
|
1086
|
+
turbo
|
|
1057
1087
|
};
|
|
1058
|
-
const body = rulesyncCommand.getBody();
|
|
1059
1088
|
const fileContent = stringifyFrontmatter(body, antigravityFrontmatter);
|
|
1060
1089
|
return new _AntigravityCommand({
|
|
1061
1090
|
baseDir,
|
|
1062
1091
|
frontmatter: antigravityFrontmatter,
|
|
1063
1092
|
body,
|
|
1064
1093
|
relativeDirPath: _AntigravityCommand.getSettablePaths().relativeDirPath,
|
|
1065
|
-
relativeFilePath
|
|
1094
|
+
relativeFilePath,
|
|
1066
1095
|
fileContent,
|
|
1067
1096
|
validate
|
|
1068
1097
|
});
|
|
1069
1098
|
}
|
|
1099
|
+
static resolveTrigger(rulesyncCommand, antigravityConfig) {
|
|
1100
|
+
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
1101
|
+
const antigravityTrigger = antigravityConfig && typeof antigravityConfig.trigger === "string" ? antigravityConfig.trigger : void 0;
|
|
1102
|
+
const rootTrigger = typeof rulesyncFrontmatter.trigger === "string" ? rulesyncFrontmatter.trigger : void 0;
|
|
1103
|
+
const bodyTriggerMatch = rulesyncCommand.getBody().match(/trigger:\s*(\/[\w-]+)/);
|
|
1104
|
+
const filenameTrigger = `/${(0, import_node_path8.basename)(rulesyncCommand.getRelativeFilePath(), ".md")}`;
|
|
1105
|
+
return antigravityTrigger || rootTrigger || (bodyTriggerMatch ? bodyTriggerMatch[1] : void 0) || filenameTrigger;
|
|
1106
|
+
}
|
|
1070
1107
|
validate() {
|
|
1071
1108
|
if (!this.frontmatter) {
|
|
1072
1109
|
return { success: true, error: null };
|
|
@@ -1899,8 +1936,89 @@ var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
|
1899
1936
|
}
|
|
1900
1937
|
};
|
|
1901
1938
|
|
|
1902
|
-
// src/features/commands/
|
|
1939
|
+
// src/features/commands/kiro-command.ts
|
|
1903
1940
|
var import_node_path16 = require("path");
|
|
1941
|
+
var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
1942
|
+
static getSettablePaths(_options = {}) {
|
|
1943
|
+
return {
|
|
1944
|
+
relativeDirPath: (0, import_node_path16.join)(".kiro", "prompts")
|
|
1945
|
+
};
|
|
1946
|
+
}
|
|
1947
|
+
toRulesyncCommand() {
|
|
1948
|
+
const rulesyncFrontmatter = {
|
|
1949
|
+
targets: ["*"],
|
|
1950
|
+
description: ""
|
|
1951
|
+
};
|
|
1952
|
+
return new RulesyncCommand({
|
|
1953
|
+
baseDir: process.cwd(),
|
|
1954
|
+
frontmatter: rulesyncFrontmatter,
|
|
1955
|
+
body: this.getFileContent(),
|
|
1956
|
+
relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
1957
|
+
relativeFilePath: this.relativeFilePath,
|
|
1958
|
+
fileContent: this.getFileContent(),
|
|
1959
|
+
validate: true
|
|
1960
|
+
});
|
|
1961
|
+
}
|
|
1962
|
+
static fromRulesyncCommand({
|
|
1963
|
+
baseDir = process.cwd(),
|
|
1964
|
+
rulesyncCommand,
|
|
1965
|
+
validate = true
|
|
1966
|
+
}) {
|
|
1967
|
+
const paths = this.getSettablePaths();
|
|
1968
|
+
return new _KiroCommand({
|
|
1969
|
+
baseDir,
|
|
1970
|
+
fileContent: rulesyncCommand.getBody(),
|
|
1971
|
+
relativeDirPath: paths.relativeDirPath,
|
|
1972
|
+
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
1973
|
+
validate
|
|
1974
|
+
});
|
|
1975
|
+
}
|
|
1976
|
+
validate() {
|
|
1977
|
+
return { success: true, error: null };
|
|
1978
|
+
}
|
|
1979
|
+
getBody() {
|
|
1980
|
+
return this.getFileContent();
|
|
1981
|
+
}
|
|
1982
|
+
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
1983
|
+
return this.isTargetedByRulesyncCommandDefault({
|
|
1984
|
+
rulesyncCommand,
|
|
1985
|
+
toolTarget: "kiro"
|
|
1986
|
+
});
|
|
1987
|
+
}
|
|
1988
|
+
static async fromFile({
|
|
1989
|
+
baseDir = process.cwd(),
|
|
1990
|
+
relativeFilePath,
|
|
1991
|
+
validate = true
|
|
1992
|
+
}) {
|
|
1993
|
+
const paths = this.getSettablePaths();
|
|
1994
|
+
const filePath = (0, import_node_path16.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1995
|
+
const fileContent = await readFileContent(filePath);
|
|
1996
|
+
const { body: content } = parseFrontmatter(fileContent);
|
|
1997
|
+
return new _KiroCommand({
|
|
1998
|
+
baseDir,
|
|
1999
|
+
relativeDirPath: paths.relativeDirPath,
|
|
2000
|
+
relativeFilePath: (0, import_node_path16.basename)(relativeFilePath),
|
|
2001
|
+
fileContent: content.trim(),
|
|
2002
|
+
validate
|
|
2003
|
+
});
|
|
2004
|
+
}
|
|
2005
|
+
static forDeletion({
|
|
2006
|
+
baseDir = process.cwd(),
|
|
2007
|
+
relativeDirPath,
|
|
2008
|
+
relativeFilePath
|
|
2009
|
+
}) {
|
|
2010
|
+
return new _KiroCommand({
|
|
2011
|
+
baseDir,
|
|
2012
|
+
relativeDirPath,
|
|
2013
|
+
relativeFilePath,
|
|
2014
|
+
fileContent: "",
|
|
2015
|
+
validate: false
|
|
2016
|
+
});
|
|
2017
|
+
}
|
|
2018
|
+
};
|
|
2019
|
+
|
|
2020
|
+
// src/features/commands/opencode-command.ts
|
|
2021
|
+
var import_node_path17 = require("path");
|
|
1904
2022
|
var import_mini10 = require("zod/mini");
|
|
1905
2023
|
var OpenCodeCommandFrontmatterSchema = import_mini10.z.looseObject({
|
|
1906
2024
|
description: import_mini10.z.string(),
|
|
@@ -1916,7 +2034,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1916
2034
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1917
2035
|
if (!result.success) {
|
|
1918
2036
|
throw new Error(
|
|
1919
|
-
`Invalid frontmatter in ${(0,
|
|
2037
|
+
`Invalid frontmatter in ${(0, import_node_path17.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1920
2038
|
);
|
|
1921
2039
|
}
|
|
1922
2040
|
}
|
|
@@ -1929,7 +2047,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1929
2047
|
}
|
|
1930
2048
|
static getSettablePaths({ global } = {}) {
|
|
1931
2049
|
return {
|
|
1932
|
-
relativeDirPath: global ? (0,
|
|
2050
|
+
relativeDirPath: global ? (0, import_node_path17.join)(".config", "opencode", "command") : (0, import_node_path17.join)(".opencode", "command")
|
|
1933
2051
|
};
|
|
1934
2052
|
}
|
|
1935
2053
|
getBody() {
|
|
@@ -1990,7 +2108,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1990
2108
|
return {
|
|
1991
2109
|
success: false,
|
|
1992
2110
|
error: new Error(
|
|
1993
|
-
`Invalid frontmatter in ${(0,
|
|
2111
|
+
`Invalid frontmatter in ${(0, import_node_path17.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1994
2112
|
)
|
|
1995
2113
|
};
|
|
1996
2114
|
}
|
|
@@ -2001,7 +2119,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2001
2119
|
global = false
|
|
2002
2120
|
}) {
|
|
2003
2121
|
const paths = this.getSettablePaths({ global });
|
|
2004
|
-
const filePath = (0,
|
|
2122
|
+
const filePath = (0, import_node_path17.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2005
2123
|
const fileContent = await readFileContent(filePath);
|
|
2006
2124
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2007
2125
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2011,7 +2129,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2011
2129
|
return new _OpenCodeCommand({
|
|
2012
2130
|
baseDir,
|
|
2013
2131
|
relativeDirPath: paths.relativeDirPath,
|
|
2014
|
-
relativeFilePath: (0,
|
|
2132
|
+
relativeFilePath: (0, import_node_path17.basename)(relativeFilePath),
|
|
2015
2133
|
frontmatter: result.data,
|
|
2016
2134
|
body: content.trim(),
|
|
2017
2135
|
validate
|
|
@@ -2040,7 +2158,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2040
2158
|
};
|
|
2041
2159
|
|
|
2042
2160
|
// src/features/commands/roo-command.ts
|
|
2043
|
-
var
|
|
2161
|
+
var import_node_path18 = require("path");
|
|
2044
2162
|
var import_mini11 = require("zod/mini");
|
|
2045
2163
|
var RooCommandFrontmatterSchema = import_mini11.z.looseObject({
|
|
2046
2164
|
description: import_mini11.z.string(),
|
|
@@ -2051,7 +2169,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2051
2169
|
body;
|
|
2052
2170
|
static getSettablePaths() {
|
|
2053
2171
|
return {
|
|
2054
|
-
relativeDirPath: (0,
|
|
2172
|
+
relativeDirPath: (0, import_node_path18.join)(".roo", "commands")
|
|
2055
2173
|
};
|
|
2056
2174
|
}
|
|
2057
2175
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -2059,7 +2177,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2059
2177
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2060
2178
|
if (!result.success) {
|
|
2061
2179
|
throw new Error(
|
|
2062
|
-
`Invalid frontmatter in ${(0,
|
|
2180
|
+
`Invalid frontmatter in ${(0, import_node_path18.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
2063
2181
|
);
|
|
2064
2182
|
}
|
|
2065
2183
|
}
|
|
@@ -2130,7 +2248,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2130
2248
|
return {
|
|
2131
2249
|
success: false,
|
|
2132
2250
|
error: new Error(
|
|
2133
|
-
`Invalid frontmatter in ${(0,
|
|
2251
|
+
`Invalid frontmatter in ${(0, import_node_path18.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
2134
2252
|
)
|
|
2135
2253
|
};
|
|
2136
2254
|
}
|
|
@@ -2146,7 +2264,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2146
2264
|
relativeFilePath,
|
|
2147
2265
|
validate = true
|
|
2148
2266
|
}) {
|
|
2149
|
-
const filePath = (0,
|
|
2267
|
+
const filePath = (0, import_node_path18.join)(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
2150
2268
|
const fileContent = await readFileContent(filePath);
|
|
2151
2269
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2152
2270
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2156,7 +2274,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2156
2274
|
return new _RooCommand({
|
|
2157
2275
|
baseDir,
|
|
2158
2276
|
relativeDirPath: _RooCommand.getSettablePaths().relativeDirPath,
|
|
2159
|
-
relativeFilePath: (0,
|
|
2277
|
+
relativeFilePath: (0, import_node_path18.basename)(relativeFilePath),
|
|
2160
2278
|
frontmatter: result.data,
|
|
2161
2279
|
body: content.trim(),
|
|
2162
2280
|
fileContent,
|
|
@@ -2192,6 +2310,7 @@ var commandsProcessorToolTargetTuple = [
|
|
|
2192
2310
|
"cursor",
|
|
2193
2311
|
"geminicli",
|
|
2194
2312
|
"kilo",
|
|
2313
|
+
"kiro",
|
|
2195
2314
|
"opencode",
|
|
2196
2315
|
"roo"
|
|
2197
2316
|
];
|
|
@@ -2272,6 +2391,13 @@ var toolCommandFactories = /* @__PURE__ */ new Map([
|
|
|
2272
2391
|
meta: { extension: "md", supportsProject: true, supportsGlobal: true, isSimulated: false }
|
|
2273
2392
|
}
|
|
2274
2393
|
],
|
|
2394
|
+
[
|
|
2395
|
+
"kiro",
|
|
2396
|
+
{
|
|
2397
|
+
class: KiroCommand,
|
|
2398
|
+
meta: { extension: "md", supportsProject: true, supportsGlobal: false, isSimulated: false }
|
|
2399
|
+
}
|
|
2400
|
+
],
|
|
2275
2401
|
[
|
|
2276
2402
|
"opencode",
|
|
2277
2403
|
{
|
|
@@ -2362,11 +2488,11 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2362
2488
|
*/
|
|
2363
2489
|
async loadRulesyncFiles() {
|
|
2364
2490
|
const rulesyncCommandPaths = await findFilesByGlobs(
|
|
2365
|
-
(0,
|
|
2491
|
+
(0, import_node_path19.join)(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
|
|
2366
2492
|
);
|
|
2367
2493
|
const rulesyncCommands = await Promise.all(
|
|
2368
2494
|
rulesyncCommandPaths.map(
|
|
2369
|
-
(path3) => RulesyncCommand.fromFile({ relativeFilePath: (0,
|
|
2495
|
+
(path3) => RulesyncCommand.fromFile({ relativeFilePath: (0, import_node_path19.basename)(path3) })
|
|
2370
2496
|
)
|
|
2371
2497
|
);
|
|
2372
2498
|
logger.info(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
@@ -2382,14 +2508,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2382
2508
|
const factory = this.getFactory(this.toolTarget);
|
|
2383
2509
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
2384
2510
|
const commandFilePaths = await findFilesByGlobs(
|
|
2385
|
-
(0,
|
|
2511
|
+
(0, import_node_path19.join)(this.baseDir, paths.relativeDirPath, `*.${factory.meta.extension}`)
|
|
2386
2512
|
);
|
|
2387
2513
|
if (forDeletion) {
|
|
2388
2514
|
const toolCommands2 = commandFilePaths.map(
|
|
2389
2515
|
(path3) => factory.class.forDeletion({
|
|
2390
2516
|
baseDir: this.baseDir,
|
|
2391
2517
|
relativeDirPath: paths.relativeDirPath,
|
|
2392
|
-
relativeFilePath: (0,
|
|
2518
|
+
relativeFilePath: (0, import_node_path19.basename)(path3),
|
|
2393
2519
|
global: this.global
|
|
2394
2520
|
})
|
|
2395
2521
|
).filter((cmd) => cmd.isDeletable());
|
|
@@ -2400,7 +2526,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2400
2526
|
commandFilePaths.map(
|
|
2401
2527
|
(path3) => factory.class.fromFile({
|
|
2402
2528
|
baseDir: this.baseDir,
|
|
2403
|
-
relativeFilePath: (0,
|
|
2529
|
+
relativeFilePath: (0, import_node_path19.basename)(path3),
|
|
2404
2530
|
global: this.global
|
|
2405
2531
|
})
|
|
2406
2532
|
)
|
|
@@ -2435,14 +2561,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2435
2561
|
var import_mini13 = require("zod/mini");
|
|
2436
2562
|
|
|
2437
2563
|
// src/features/ignore/augmentcode-ignore.ts
|
|
2438
|
-
var
|
|
2564
|
+
var import_node_path21 = require("path");
|
|
2439
2565
|
|
|
2440
2566
|
// src/types/tool-file.ts
|
|
2441
2567
|
var ToolFile = class extends AiFile {
|
|
2442
2568
|
};
|
|
2443
2569
|
|
|
2444
2570
|
// src/features/ignore/rulesync-ignore.ts
|
|
2445
|
-
var
|
|
2571
|
+
var import_node_path20 = require("path");
|
|
2446
2572
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
2447
2573
|
validate() {
|
|
2448
2574
|
return { success: true, error: null };
|
|
@@ -2462,12 +2588,12 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
2462
2588
|
static async fromFile() {
|
|
2463
2589
|
const baseDir = process.cwd();
|
|
2464
2590
|
const paths = this.getSettablePaths();
|
|
2465
|
-
const recommendedPath = (0,
|
|
2591
|
+
const recommendedPath = (0, import_node_path20.join)(
|
|
2466
2592
|
baseDir,
|
|
2467
2593
|
paths.recommended.relativeDirPath,
|
|
2468
2594
|
paths.recommended.relativeFilePath
|
|
2469
2595
|
);
|
|
2470
|
-
const legacyPath = (0,
|
|
2596
|
+
const legacyPath = (0, import_node_path20.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
2471
2597
|
if (await fileExists(recommendedPath)) {
|
|
2472
2598
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
2473
2599
|
return new _RulesyncIgnore({
|
|
@@ -2583,7 +2709,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2583
2709
|
validate = true
|
|
2584
2710
|
}) {
|
|
2585
2711
|
const fileContent = await readFileContent(
|
|
2586
|
-
(0,
|
|
2712
|
+
(0, import_node_path21.join)(
|
|
2587
2713
|
baseDir,
|
|
2588
2714
|
this.getSettablePaths().relativeDirPath,
|
|
2589
2715
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2614,7 +2740,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2614
2740
|
|
|
2615
2741
|
// src/features/ignore/claudecode-ignore.ts
|
|
2616
2742
|
var import_es_toolkit2 = require("es-toolkit");
|
|
2617
|
-
var
|
|
2743
|
+
var import_node_path22 = require("path");
|
|
2618
2744
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
2619
2745
|
constructor(params) {
|
|
2620
2746
|
super(params);
|
|
@@ -2656,7 +2782,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2656
2782
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
2657
2783
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
2658
2784
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
2659
|
-
const filePath = (0,
|
|
2785
|
+
const filePath = (0, import_node_path22.join)(
|
|
2660
2786
|
baseDir,
|
|
2661
2787
|
this.getSettablePaths().relativeDirPath,
|
|
2662
2788
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2692,7 +2818,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2692
2818
|
validate = true
|
|
2693
2819
|
}) {
|
|
2694
2820
|
const fileContent = await readFileContent(
|
|
2695
|
-
(0,
|
|
2821
|
+
(0, import_node_path22.join)(
|
|
2696
2822
|
baseDir,
|
|
2697
2823
|
this.getSettablePaths().relativeDirPath,
|
|
2698
2824
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2722,7 +2848,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2722
2848
|
};
|
|
2723
2849
|
|
|
2724
2850
|
// src/features/ignore/cline-ignore.ts
|
|
2725
|
-
var
|
|
2851
|
+
var import_node_path23 = require("path");
|
|
2726
2852
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
2727
2853
|
static getSettablePaths() {
|
|
2728
2854
|
return {
|
|
@@ -2759,7 +2885,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2759
2885
|
validate = true
|
|
2760
2886
|
}) {
|
|
2761
2887
|
const fileContent = await readFileContent(
|
|
2762
|
-
(0,
|
|
2888
|
+
(0, import_node_path23.join)(
|
|
2763
2889
|
baseDir,
|
|
2764
2890
|
this.getSettablePaths().relativeDirPath,
|
|
2765
2891
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2789,7 +2915,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2789
2915
|
};
|
|
2790
2916
|
|
|
2791
2917
|
// src/features/ignore/cursor-ignore.ts
|
|
2792
|
-
var
|
|
2918
|
+
var import_node_path24 = require("path");
|
|
2793
2919
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
2794
2920
|
static getSettablePaths() {
|
|
2795
2921
|
return {
|
|
@@ -2822,7 +2948,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2822
2948
|
validate = true
|
|
2823
2949
|
}) {
|
|
2824
2950
|
const fileContent = await readFileContent(
|
|
2825
|
-
(0,
|
|
2951
|
+
(0, import_node_path24.join)(
|
|
2826
2952
|
baseDir,
|
|
2827
2953
|
this.getSettablePaths().relativeDirPath,
|
|
2828
2954
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2852,7 +2978,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2852
2978
|
};
|
|
2853
2979
|
|
|
2854
2980
|
// src/features/ignore/geminicli-ignore.ts
|
|
2855
|
-
var
|
|
2981
|
+
var import_node_path25 = require("path");
|
|
2856
2982
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
2857
2983
|
static getSettablePaths() {
|
|
2858
2984
|
return {
|
|
@@ -2879,7 +3005,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2879
3005
|
validate = true
|
|
2880
3006
|
}) {
|
|
2881
3007
|
const fileContent = await readFileContent(
|
|
2882
|
-
(0,
|
|
3008
|
+
(0, import_node_path25.join)(
|
|
2883
3009
|
baseDir,
|
|
2884
3010
|
this.getSettablePaths().relativeDirPath,
|
|
2885
3011
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2909,7 +3035,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2909
3035
|
};
|
|
2910
3036
|
|
|
2911
3037
|
// src/features/ignore/junie-ignore.ts
|
|
2912
|
-
var
|
|
3038
|
+
var import_node_path26 = require("path");
|
|
2913
3039
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
2914
3040
|
static getSettablePaths() {
|
|
2915
3041
|
return {
|
|
@@ -2936,7 +3062,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2936
3062
|
validate = true
|
|
2937
3063
|
}) {
|
|
2938
3064
|
const fileContent = await readFileContent(
|
|
2939
|
-
(0,
|
|
3065
|
+
(0, import_node_path26.join)(
|
|
2940
3066
|
baseDir,
|
|
2941
3067
|
this.getSettablePaths().relativeDirPath,
|
|
2942
3068
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2966,7 +3092,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2966
3092
|
};
|
|
2967
3093
|
|
|
2968
3094
|
// src/features/ignore/kilo-ignore.ts
|
|
2969
|
-
var
|
|
3095
|
+
var import_node_path27 = require("path");
|
|
2970
3096
|
var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
2971
3097
|
static getSettablePaths() {
|
|
2972
3098
|
return {
|
|
@@ -3003,7 +3129,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
3003
3129
|
validate = true
|
|
3004
3130
|
}) {
|
|
3005
3131
|
const fileContent = await readFileContent(
|
|
3006
|
-
(0,
|
|
3132
|
+
(0, import_node_path27.join)(
|
|
3007
3133
|
baseDir,
|
|
3008
3134
|
this.getSettablePaths().relativeDirPath,
|
|
3009
3135
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3033,7 +3159,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
3033
3159
|
};
|
|
3034
3160
|
|
|
3035
3161
|
// src/features/ignore/kiro-ignore.ts
|
|
3036
|
-
var
|
|
3162
|
+
var import_node_path28 = require("path");
|
|
3037
3163
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
3038
3164
|
static getSettablePaths() {
|
|
3039
3165
|
return {
|
|
@@ -3060,7 +3186,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
3060
3186
|
validate = true
|
|
3061
3187
|
}) {
|
|
3062
3188
|
const fileContent = await readFileContent(
|
|
3063
|
-
(0,
|
|
3189
|
+
(0, import_node_path28.join)(
|
|
3064
3190
|
baseDir,
|
|
3065
3191
|
this.getSettablePaths().relativeDirPath,
|
|
3066
3192
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3090,7 +3216,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
3090
3216
|
};
|
|
3091
3217
|
|
|
3092
3218
|
// src/features/ignore/qwencode-ignore.ts
|
|
3093
|
-
var
|
|
3219
|
+
var import_node_path29 = require("path");
|
|
3094
3220
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
3095
3221
|
static getSettablePaths() {
|
|
3096
3222
|
return {
|
|
@@ -3117,7 +3243,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
3117
3243
|
validate = true
|
|
3118
3244
|
}) {
|
|
3119
3245
|
const fileContent = await readFileContent(
|
|
3120
|
-
(0,
|
|
3246
|
+
(0, import_node_path29.join)(
|
|
3121
3247
|
baseDir,
|
|
3122
3248
|
this.getSettablePaths().relativeDirPath,
|
|
3123
3249
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3147,7 +3273,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
3147
3273
|
};
|
|
3148
3274
|
|
|
3149
3275
|
// src/features/ignore/roo-ignore.ts
|
|
3150
|
-
var
|
|
3276
|
+
var import_node_path30 = require("path");
|
|
3151
3277
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
3152
3278
|
static getSettablePaths() {
|
|
3153
3279
|
return {
|
|
@@ -3174,7 +3300,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
3174
3300
|
validate = true
|
|
3175
3301
|
}) {
|
|
3176
3302
|
const fileContent = await readFileContent(
|
|
3177
|
-
(0,
|
|
3303
|
+
(0, import_node_path30.join)(
|
|
3178
3304
|
baseDir,
|
|
3179
3305
|
this.getSettablePaths().relativeDirPath,
|
|
3180
3306
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3204,7 +3330,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
3204
3330
|
};
|
|
3205
3331
|
|
|
3206
3332
|
// src/features/ignore/windsurf-ignore.ts
|
|
3207
|
-
var
|
|
3333
|
+
var import_node_path31 = require("path");
|
|
3208
3334
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
3209
3335
|
static getSettablePaths() {
|
|
3210
3336
|
return {
|
|
@@ -3231,7 +3357,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3231
3357
|
validate = true
|
|
3232
3358
|
}) {
|
|
3233
3359
|
const fileContent = await readFileContent(
|
|
3234
|
-
(0,
|
|
3360
|
+
(0, import_node_path31.join)(
|
|
3235
3361
|
baseDir,
|
|
3236
3362
|
this.getSettablePaths().relativeDirPath,
|
|
3237
3363
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3262,7 +3388,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3262
3388
|
|
|
3263
3389
|
// src/features/ignore/zed-ignore.ts
|
|
3264
3390
|
var import_es_toolkit3 = require("es-toolkit");
|
|
3265
|
-
var
|
|
3391
|
+
var import_node_path32 = require("path");
|
|
3266
3392
|
var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
3267
3393
|
constructor(params) {
|
|
3268
3394
|
super(params);
|
|
@@ -3298,7 +3424,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
3298
3424
|
}) {
|
|
3299
3425
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
3300
3426
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
3301
|
-
const filePath = (0,
|
|
3427
|
+
const filePath = (0, import_node_path32.join)(
|
|
3302
3428
|
baseDir,
|
|
3303
3429
|
this.getSettablePaths().relativeDirPath,
|
|
3304
3430
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3325,7 +3451,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
3325
3451
|
validate = true
|
|
3326
3452
|
}) {
|
|
3327
3453
|
const fileContent = await readFileContent(
|
|
3328
|
-
(0,
|
|
3454
|
+
(0, import_node_path32.join)(
|
|
3329
3455
|
baseDir,
|
|
3330
3456
|
this.getSettablePaths().relativeDirPath,
|
|
3331
3457
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3507,10 +3633,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
3507
3633
|
var import_mini18 = require("zod/mini");
|
|
3508
3634
|
|
|
3509
3635
|
// src/features/mcp/claudecode-mcp.ts
|
|
3510
|
-
var
|
|
3636
|
+
var import_node_path35 = require("path");
|
|
3511
3637
|
|
|
3512
3638
|
// src/features/mcp/modular-mcp.ts
|
|
3513
|
-
var
|
|
3639
|
+
var import_node_path33 = require("path");
|
|
3514
3640
|
var import_mini15 = require("zod/mini");
|
|
3515
3641
|
|
|
3516
3642
|
// src/types/mcp.ts
|
|
@@ -3598,7 +3724,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3598
3724
|
args: [
|
|
3599
3725
|
"-y",
|
|
3600
3726
|
"@kimuson/modular-mcp",
|
|
3601
|
-
(0,
|
|
3727
|
+
(0, import_node_path33.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3602
3728
|
],
|
|
3603
3729
|
env: {}
|
|
3604
3730
|
}
|
|
@@ -3636,7 +3762,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3636
3762
|
|
|
3637
3763
|
// src/features/mcp/rulesync-mcp.ts
|
|
3638
3764
|
var import_object = require("es-toolkit/object");
|
|
3639
|
-
var
|
|
3765
|
+
var import_node_path34 = require("path");
|
|
3640
3766
|
var import_mini16 = require("zod/mini");
|
|
3641
3767
|
var RulesyncMcpServerSchema = import_mini16.z.union([
|
|
3642
3768
|
import_mini16.z.extend(McpServerSchema, {
|
|
@@ -3692,12 +3818,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
3692
3818
|
}) {
|
|
3693
3819
|
const baseDir = process.cwd();
|
|
3694
3820
|
const paths = this.getSettablePaths();
|
|
3695
|
-
const recommendedPath = (0,
|
|
3821
|
+
const recommendedPath = (0, import_node_path34.join)(
|
|
3696
3822
|
baseDir,
|
|
3697
3823
|
paths.recommended.relativeDirPath,
|
|
3698
3824
|
paths.recommended.relativeFilePath
|
|
3699
3825
|
);
|
|
3700
|
-
const legacyPath = (0,
|
|
3826
|
+
const legacyPath = (0, import_node_path34.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
3701
3827
|
if (await fileExists(recommendedPath)) {
|
|
3702
3828
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
3703
3829
|
return new _RulesyncMcp({
|
|
@@ -3841,7 +3967,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3841
3967
|
}) {
|
|
3842
3968
|
const paths = this.getSettablePaths({ global });
|
|
3843
3969
|
const fileContent = await readOrInitializeFileContent(
|
|
3844
|
-
(0,
|
|
3970
|
+
(0, import_node_path35.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3845
3971
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3846
3972
|
);
|
|
3847
3973
|
const json = JSON.parse(fileContent);
|
|
@@ -3863,7 +3989,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3863
3989
|
}) {
|
|
3864
3990
|
const paths = this.getSettablePaths({ global });
|
|
3865
3991
|
const fileContent = await readOrInitializeFileContent(
|
|
3866
|
-
(0,
|
|
3992
|
+
(0, import_node_path35.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3867
3993
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3868
3994
|
);
|
|
3869
3995
|
const json = JSON.parse(fileContent);
|
|
@@ -3911,7 +4037,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3911
4037
|
};
|
|
3912
4038
|
|
|
3913
4039
|
// src/features/mcp/cline-mcp.ts
|
|
3914
|
-
var
|
|
4040
|
+
var import_node_path36 = require("path");
|
|
3915
4041
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
3916
4042
|
json;
|
|
3917
4043
|
constructor(params) {
|
|
@@ -3932,7 +4058,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3932
4058
|
validate = true
|
|
3933
4059
|
}) {
|
|
3934
4060
|
const fileContent = await readFileContent(
|
|
3935
|
-
(0,
|
|
4061
|
+
(0, import_node_path36.join)(
|
|
3936
4062
|
baseDir,
|
|
3937
4063
|
this.getSettablePaths().relativeDirPath,
|
|
3938
4064
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3981,7 +4107,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3981
4107
|
};
|
|
3982
4108
|
|
|
3983
4109
|
// src/features/mcp/codexcli-mcp.ts
|
|
3984
|
-
var
|
|
4110
|
+
var import_node_path37 = require("path");
|
|
3985
4111
|
var smolToml = __toESM(require("smol-toml"), 1);
|
|
3986
4112
|
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
3987
4113
|
toml;
|
|
@@ -4017,7 +4143,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4017
4143
|
}) {
|
|
4018
4144
|
const paths = this.getSettablePaths({ global });
|
|
4019
4145
|
const fileContent = await readFileContent(
|
|
4020
|
-
(0,
|
|
4146
|
+
(0, import_node_path37.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
4021
4147
|
);
|
|
4022
4148
|
return new _CodexcliMcp({
|
|
4023
4149
|
baseDir,
|
|
@@ -4034,7 +4160,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4034
4160
|
global = false
|
|
4035
4161
|
}) {
|
|
4036
4162
|
const paths = this.getSettablePaths({ global });
|
|
4037
|
-
const configTomlFilePath = (0,
|
|
4163
|
+
const configTomlFilePath = (0, import_node_path37.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
4038
4164
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
4039
4165
|
configTomlFilePath,
|
|
4040
4166
|
smolToml.stringify({})
|
|
@@ -4088,7 +4214,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4088
4214
|
};
|
|
4089
4215
|
|
|
4090
4216
|
// src/features/mcp/copilot-mcp.ts
|
|
4091
|
-
var
|
|
4217
|
+
var import_node_path38 = require("path");
|
|
4092
4218
|
function convertToCopilotFormat(mcpServers) {
|
|
4093
4219
|
return { servers: mcpServers };
|
|
4094
4220
|
}
|
|
@@ -4115,7 +4241,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4115
4241
|
validate = true
|
|
4116
4242
|
}) {
|
|
4117
4243
|
const fileContent = await readFileContent(
|
|
4118
|
-
(0,
|
|
4244
|
+
(0, import_node_path38.join)(
|
|
4119
4245
|
baseDir,
|
|
4120
4246
|
this.getSettablePaths().relativeDirPath,
|
|
4121
4247
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4168,7 +4294,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4168
4294
|
};
|
|
4169
4295
|
|
|
4170
4296
|
// src/features/mcp/cursor-mcp.ts
|
|
4171
|
-
var
|
|
4297
|
+
var import_node_path39 = require("path");
|
|
4172
4298
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
4173
4299
|
json;
|
|
4174
4300
|
constructor(params) {
|
|
@@ -4189,7 +4315,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4189
4315
|
validate = true
|
|
4190
4316
|
}) {
|
|
4191
4317
|
const fileContent = await readFileContent(
|
|
4192
|
-
(0,
|
|
4318
|
+
(0, import_node_path39.join)(
|
|
4193
4319
|
baseDir,
|
|
4194
4320
|
this.getSettablePaths().relativeDirPath,
|
|
4195
4321
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4249,7 +4375,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4249
4375
|
};
|
|
4250
4376
|
|
|
4251
4377
|
// src/features/mcp/geminicli-mcp.ts
|
|
4252
|
-
var
|
|
4378
|
+
var import_node_path40 = require("path");
|
|
4253
4379
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
4254
4380
|
json;
|
|
4255
4381
|
constructor(params) {
|
|
@@ -4278,7 +4404,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4278
4404
|
}) {
|
|
4279
4405
|
const paths = this.getSettablePaths({ global });
|
|
4280
4406
|
const fileContent = await readOrInitializeFileContent(
|
|
4281
|
-
(0,
|
|
4407
|
+
(0, import_node_path40.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4282
4408
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4283
4409
|
);
|
|
4284
4410
|
const json = JSON.parse(fileContent);
|
|
@@ -4299,7 +4425,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4299
4425
|
}) {
|
|
4300
4426
|
const paths = this.getSettablePaths({ global });
|
|
4301
4427
|
const fileContent = await readOrInitializeFileContent(
|
|
4302
|
-
(0,
|
|
4428
|
+
(0, import_node_path40.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4303
4429
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4304
4430
|
);
|
|
4305
4431
|
const json = JSON.parse(fileContent);
|
|
@@ -4336,7 +4462,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4336
4462
|
};
|
|
4337
4463
|
|
|
4338
4464
|
// src/features/mcp/junie-mcp.ts
|
|
4339
|
-
var
|
|
4465
|
+
var import_node_path41 = require("path");
|
|
4340
4466
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
4341
4467
|
json;
|
|
4342
4468
|
constructor(params) {
|
|
@@ -4348,7 +4474,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4348
4474
|
}
|
|
4349
4475
|
static getSettablePaths() {
|
|
4350
4476
|
return {
|
|
4351
|
-
relativeDirPath: (0,
|
|
4477
|
+
relativeDirPath: (0, import_node_path41.join)(".junie", "mcp"),
|
|
4352
4478
|
relativeFilePath: "mcp.json"
|
|
4353
4479
|
};
|
|
4354
4480
|
}
|
|
@@ -4357,7 +4483,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4357
4483
|
validate = true
|
|
4358
4484
|
}) {
|
|
4359
4485
|
const fileContent = await readFileContent(
|
|
4360
|
-
(0,
|
|
4486
|
+
(0, import_node_path41.join)(
|
|
4361
4487
|
baseDir,
|
|
4362
4488
|
this.getSettablePaths().relativeDirPath,
|
|
4363
4489
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4406,7 +4532,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4406
4532
|
};
|
|
4407
4533
|
|
|
4408
4534
|
// src/features/mcp/kilo-mcp.ts
|
|
4409
|
-
var
|
|
4535
|
+
var import_node_path42 = require("path");
|
|
4410
4536
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
4411
4537
|
json;
|
|
4412
4538
|
constructor(params) {
|
|
@@ -4428,7 +4554,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4428
4554
|
}) {
|
|
4429
4555
|
const paths = this.getSettablePaths();
|
|
4430
4556
|
const fileContent = await readOrInitializeFileContent(
|
|
4431
|
-
(0,
|
|
4557
|
+
(0, import_node_path42.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4432
4558
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4433
4559
|
);
|
|
4434
4560
|
return new _KiloMcp({
|
|
@@ -4482,7 +4608,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4482
4608
|
};
|
|
4483
4609
|
|
|
4484
4610
|
// src/features/mcp/kiro-mcp.ts
|
|
4485
|
-
var
|
|
4611
|
+
var import_node_path43 = require("path");
|
|
4486
4612
|
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
4487
4613
|
json;
|
|
4488
4614
|
constructor(params) {
|
|
@@ -4494,7 +4620,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4494
4620
|
}
|
|
4495
4621
|
static getSettablePaths() {
|
|
4496
4622
|
return {
|
|
4497
|
-
relativeDirPath: (0,
|
|
4623
|
+
relativeDirPath: (0, import_node_path43.join)(".kiro", "settings"),
|
|
4498
4624
|
relativeFilePath: "mcp.json"
|
|
4499
4625
|
};
|
|
4500
4626
|
}
|
|
@@ -4504,7 +4630,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4504
4630
|
}) {
|
|
4505
4631
|
const paths = this.getSettablePaths();
|
|
4506
4632
|
const fileContent = await readOrInitializeFileContent(
|
|
4507
|
-
(0,
|
|
4633
|
+
(0, import_node_path43.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4508
4634
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4509
4635
|
);
|
|
4510
4636
|
return new _KiroMcp({
|
|
@@ -4558,7 +4684,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4558
4684
|
};
|
|
4559
4685
|
|
|
4560
4686
|
// src/features/mcp/opencode-mcp.ts
|
|
4561
|
-
var
|
|
4687
|
+
var import_node_path44 = require("path");
|
|
4562
4688
|
var import_mini17 = require("zod/mini");
|
|
4563
4689
|
var OpencodeMcpLocalServerSchema = import_mini17.z.object({
|
|
4564
4690
|
type: import_mini17.z.literal("local"),
|
|
@@ -4682,7 +4808,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4682
4808
|
}) {
|
|
4683
4809
|
const paths = this.getSettablePaths({ global });
|
|
4684
4810
|
const fileContent = await readOrInitializeFileContent(
|
|
4685
|
-
(0,
|
|
4811
|
+
(0, import_node_path44.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4686
4812
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4687
4813
|
);
|
|
4688
4814
|
const json = JSON.parse(fileContent);
|
|
@@ -4703,7 +4829,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4703
4829
|
}) {
|
|
4704
4830
|
const paths = this.getSettablePaths({ global });
|
|
4705
4831
|
const fileContent = await readOrInitializeFileContent(
|
|
4706
|
-
(0,
|
|
4832
|
+
(0, import_node_path44.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4707
4833
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4708
4834
|
);
|
|
4709
4835
|
const json = JSON.parse(fileContent);
|
|
@@ -4747,7 +4873,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4747
4873
|
};
|
|
4748
4874
|
|
|
4749
4875
|
// src/features/mcp/roo-mcp.ts
|
|
4750
|
-
var
|
|
4876
|
+
var import_node_path45 = require("path");
|
|
4751
4877
|
function isRooMcpServers(value) {
|
|
4752
4878
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
4753
4879
|
}
|
|
@@ -4799,7 +4925,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4799
4925
|
validate = true
|
|
4800
4926
|
}) {
|
|
4801
4927
|
const fileContent = await readFileContent(
|
|
4802
|
-
(0,
|
|
4928
|
+
(0, import_node_path45.join)(
|
|
4803
4929
|
baseDir,
|
|
4804
4930
|
this.getSettablePaths().relativeDirPath,
|
|
4805
4931
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5114,24 +5240,24 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
5114
5240
|
|
|
5115
5241
|
// src/features/rules/rules-processor.ts
|
|
5116
5242
|
var import_toon = require("@toon-format/toon");
|
|
5117
|
-
var
|
|
5243
|
+
var import_node_path95 = require("path");
|
|
5118
5244
|
var import_mini42 = require("zod/mini");
|
|
5119
5245
|
|
|
5120
5246
|
// src/constants/general.ts
|
|
5121
5247
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
5122
5248
|
|
|
5123
5249
|
// src/features/skills/agentsmd-skill.ts
|
|
5124
|
-
var
|
|
5250
|
+
var import_node_path49 = require("path");
|
|
5125
5251
|
|
|
5126
5252
|
// src/features/skills/simulated-skill.ts
|
|
5127
|
-
var
|
|
5253
|
+
var import_node_path48 = require("path");
|
|
5128
5254
|
var import_mini19 = require("zod/mini");
|
|
5129
5255
|
|
|
5130
5256
|
// src/features/skills/tool-skill.ts
|
|
5131
|
-
var
|
|
5257
|
+
var import_node_path47 = require("path");
|
|
5132
5258
|
|
|
5133
5259
|
// src/types/ai-dir.ts
|
|
5134
|
-
var
|
|
5260
|
+
var import_node_path46 = __toESM(require("path"), 1);
|
|
5135
5261
|
var AiDir = class {
|
|
5136
5262
|
/**
|
|
5137
5263
|
* @example "."
|
|
@@ -5165,7 +5291,7 @@ var AiDir = class {
|
|
|
5165
5291
|
otherFiles = [],
|
|
5166
5292
|
global = false
|
|
5167
5293
|
}) {
|
|
5168
|
-
if (dirName.includes(
|
|
5294
|
+
if (dirName.includes(import_node_path46.default.sep) || dirName.includes("/") || dirName.includes("\\")) {
|
|
5169
5295
|
throw new Error(`Directory name cannot contain path separators: dirName="${dirName}"`);
|
|
5170
5296
|
}
|
|
5171
5297
|
this.baseDir = baseDir;
|
|
@@ -5188,11 +5314,11 @@ var AiDir = class {
|
|
|
5188
5314
|
return this.dirName;
|
|
5189
5315
|
}
|
|
5190
5316
|
getDirPath() {
|
|
5191
|
-
const fullPath =
|
|
5192
|
-
const resolvedFull = (0,
|
|
5193
|
-
const resolvedBase = (0,
|
|
5194
|
-
const rel = (0,
|
|
5195
|
-
if (rel.startsWith("..") ||
|
|
5317
|
+
const fullPath = import_node_path46.default.join(this.baseDir, this.relativeDirPath, this.dirName);
|
|
5318
|
+
const resolvedFull = (0, import_node_path46.resolve)(fullPath);
|
|
5319
|
+
const resolvedBase = (0, import_node_path46.resolve)(this.baseDir);
|
|
5320
|
+
const rel = (0, import_node_path46.relative)(resolvedBase, resolvedFull);
|
|
5321
|
+
if (rel.startsWith("..") || import_node_path46.default.isAbsolute(rel)) {
|
|
5196
5322
|
throw new Error(
|
|
5197
5323
|
`Path traversal detected: Final path escapes baseDir. baseDir="${this.baseDir}", relativeDirPath="${this.relativeDirPath}", dirName="${this.dirName}"`
|
|
5198
5324
|
);
|
|
@@ -5206,7 +5332,7 @@ var AiDir = class {
|
|
|
5206
5332
|
return this.otherFiles;
|
|
5207
5333
|
}
|
|
5208
5334
|
getRelativePathFromCwd() {
|
|
5209
|
-
return
|
|
5335
|
+
return import_node_path46.default.join(this.relativeDirPath, this.dirName);
|
|
5210
5336
|
}
|
|
5211
5337
|
getGlobal() {
|
|
5212
5338
|
return this.global;
|
|
@@ -5225,15 +5351,15 @@ var AiDir = class {
|
|
|
5225
5351
|
* @returns Array of files with their relative paths and buffers
|
|
5226
5352
|
*/
|
|
5227
5353
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
5228
|
-
const dirPath = (0,
|
|
5229
|
-
const glob = (0,
|
|
5354
|
+
const dirPath = (0, import_node_path46.join)(baseDir, relativeDirPath, dirName);
|
|
5355
|
+
const glob = (0, import_node_path46.join)(dirPath, "**", "*");
|
|
5230
5356
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
5231
|
-
const filteredPaths = filePaths.filter((filePath) => (0,
|
|
5357
|
+
const filteredPaths = filePaths.filter((filePath) => (0, import_node_path46.basename)(filePath) !== excludeFileName);
|
|
5232
5358
|
const files = await Promise.all(
|
|
5233
5359
|
filteredPaths.map(async (filePath) => {
|
|
5234
5360
|
const fileBuffer = await readFileBuffer(filePath);
|
|
5235
5361
|
return {
|
|
5236
|
-
relativeFilePathToDirPath: (0,
|
|
5362
|
+
relativeFilePathToDirPath: (0, import_node_path46.relative)(dirPath, filePath),
|
|
5237
5363
|
fileBuffer
|
|
5238
5364
|
};
|
|
5239
5365
|
})
|
|
@@ -5324,8 +5450,8 @@ var ToolSkill = class extends AiDir {
|
|
|
5324
5450
|
}) {
|
|
5325
5451
|
const settablePaths = getSettablePaths({ global });
|
|
5326
5452
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5327
|
-
const skillDirPath = (0,
|
|
5328
|
-
const skillFilePath = (0,
|
|
5453
|
+
const skillDirPath = (0, import_node_path47.join)(baseDir, actualRelativeDirPath, dirName);
|
|
5454
|
+
const skillFilePath = (0, import_node_path47.join)(skillDirPath, SKILL_FILE_NAME);
|
|
5329
5455
|
if (!await fileExists(skillFilePath)) {
|
|
5330
5456
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5331
5457
|
}
|
|
@@ -5383,7 +5509,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5383
5509
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
5384
5510
|
if (!result.success) {
|
|
5385
5511
|
throw new Error(
|
|
5386
|
-
`Invalid frontmatter in ${(0,
|
|
5512
|
+
`Invalid frontmatter in ${(0, import_node_path48.join)(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
5387
5513
|
);
|
|
5388
5514
|
}
|
|
5389
5515
|
}
|
|
@@ -5441,8 +5567,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5441
5567
|
}) {
|
|
5442
5568
|
const settablePaths = this.getSettablePaths();
|
|
5443
5569
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5444
|
-
const skillDirPath = (0,
|
|
5445
|
-
const skillFilePath = (0,
|
|
5570
|
+
const skillDirPath = (0, import_node_path48.join)(baseDir, actualRelativeDirPath, dirName);
|
|
5571
|
+
const skillFilePath = (0, import_node_path48.join)(skillDirPath, SKILL_FILE_NAME);
|
|
5446
5572
|
if (!await fileExists(skillFilePath)) {
|
|
5447
5573
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5448
5574
|
}
|
|
@@ -5519,7 +5645,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5519
5645
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
5520
5646
|
}
|
|
5521
5647
|
return {
|
|
5522
|
-
relativeDirPath: (0,
|
|
5648
|
+
relativeDirPath: (0, import_node_path49.join)(".agents", "skills")
|
|
5523
5649
|
};
|
|
5524
5650
|
}
|
|
5525
5651
|
static async fromDir(params) {
|
|
@@ -5546,14 +5672,14 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5546
5672
|
};
|
|
5547
5673
|
|
|
5548
5674
|
// src/features/skills/geminicli-skill.ts
|
|
5549
|
-
var
|
|
5675
|
+
var import_node_path50 = require("path");
|
|
5550
5676
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5551
5677
|
static getSettablePaths(options) {
|
|
5552
5678
|
if (options?.global) {
|
|
5553
5679
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5554
5680
|
}
|
|
5555
5681
|
return {
|
|
5556
|
-
relativeDirPath: (0,
|
|
5682
|
+
relativeDirPath: (0, import_node_path50.join)(".gemini", "skills")
|
|
5557
5683
|
};
|
|
5558
5684
|
}
|
|
5559
5685
|
static async fromDir(params) {
|
|
@@ -5580,11 +5706,11 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
|
5580
5706
|
};
|
|
5581
5707
|
|
|
5582
5708
|
// src/features/skills/skills-processor.ts
|
|
5583
|
-
var
|
|
5709
|
+
var import_node_path61 = require("path");
|
|
5584
5710
|
var import_mini29 = require("zod/mini");
|
|
5585
5711
|
|
|
5586
5712
|
// src/types/dir-feature-processor.ts
|
|
5587
|
-
var
|
|
5713
|
+
var import_node_path51 = require("path");
|
|
5588
5714
|
var DirFeatureProcessor = class {
|
|
5589
5715
|
baseDir;
|
|
5590
5716
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -5606,14 +5732,14 @@ var DirFeatureProcessor = class {
|
|
|
5606
5732
|
await ensureDir(dirPath);
|
|
5607
5733
|
const mainFile = aiDir.getMainFile();
|
|
5608
5734
|
if (mainFile) {
|
|
5609
|
-
const mainFilePath = (0,
|
|
5735
|
+
const mainFilePath = (0, import_node_path51.join)(dirPath, mainFile.name);
|
|
5610
5736
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5611
5737
|
const contentWithNewline = addTrailingNewline(content);
|
|
5612
5738
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5613
5739
|
}
|
|
5614
5740
|
const otherFiles = aiDir.getOtherFiles();
|
|
5615
5741
|
for (const file of otherFiles) {
|
|
5616
|
-
const filePath = (0,
|
|
5742
|
+
const filePath = (0, import_node_path51.join)(dirPath, file.relativeFilePathToDirPath);
|
|
5617
5743
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5618
5744
|
await writeFileContent(filePath, contentWithNewline);
|
|
5619
5745
|
}
|
|
@@ -5628,11 +5754,11 @@ var DirFeatureProcessor = class {
|
|
|
5628
5754
|
};
|
|
5629
5755
|
|
|
5630
5756
|
// src/features/skills/antigravity-skill.ts
|
|
5631
|
-
var
|
|
5757
|
+
var import_node_path53 = require("path");
|
|
5632
5758
|
var import_mini21 = require("zod/mini");
|
|
5633
5759
|
|
|
5634
5760
|
// src/features/skills/rulesync-skill.ts
|
|
5635
|
-
var
|
|
5761
|
+
var import_node_path52 = require("path");
|
|
5636
5762
|
var import_mini20 = require("zod/mini");
|
|
5637
5763
|
var RulesyncSkillFrontmatterSchemaInternal = import_mini20.z.looseObject({
|
|
5638
5764
|
name: import_mini20.z.string(),
|
|
@@ -5724,8 +5850,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5724
5850
|
dirName,
|
|
5725
5851
|
global = false
|
|
5726
5852
|
}) {
|
|
5727
|
-
const skillDirPath = (0,
|
|
5728
|
-
const skillFilePath = (0,
|
|
5853
|
+
const skillDirPath = (0, import_node_path52.join)(baseDir, relativeDirPath, dirName);
|
|
5854
|
+
const skillFilePath = (0, import_node_path52.join)(skillDirPath, SKILL_FILE_NAME);
|
|
5729
5855
|
if (!await fileExists(skillFilePath)) {
|
|
5730
5856
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5731
5857
|
}
|
|
@@ -5762,7 +5888,7 @@ var AntigravitySkillFrontmatterSchema = import_mini21.z.looseObject({
|
|
|
5762
5888
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
5763
5889
|
constructor({
|
|
5764
5890
|
baseDir = process.cwd(),
|
|
5765
|
-
relativeDirPath = (0,
|
|
5891
|
+
relativeDirPath = (0, import_node_path53.join)(".agent", "skills"),
|
|
5766
5892
|
dirName,
|
|
5767
5893
|
frontmatter,
|
|
5768
5894
|
body,
|
|
@@ -5794,11 +5920,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
5794
5920
|
} = {}) {
|
|
5795
5921
|
if (global) {
|
|
5796
5922
|
return {
|
|
5797
|
-
relativeDirPath: (0,
|
|
5923
|
+
relativeDirPath: (0, import_node_path53.join)(".gemini", "antigravity", "skills")
|
|
5798
5924
|
};
|
|
5799
5925
|
}
|
|
5800
5926
|
return {
|
|
5801
|
-
relativeDirPath: (0,
|
|
5927
|
+
relativeDirPath: (0, import_node_path53.join)(".agent", "skills")
|
|
5802
5928
|
};
|
|
5803
5929
|
}
|
|
5804
5930
|
getFrontmatter() {
|
|
@@ -5880,9 +6006,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
5880
6006
|
});
|
|
5881
6007
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5882
6008
|
if (!result.success) {
|
|
5883
|
-
const skillDirPath = (0,
|
|
6009
|
+
const skillDirPath = (0, import_node_path53.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5884
6010
|
throw new Error(
|
|
5885
|
-
`Invalid frontmatter in ${(0,
|
|
6011
|
+
`Invalid frontmatter in ${(0, import_node_path53.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5886
6012
|
);
|
|
5887
6013
|
}
|
|
5888
6014
|
return new _AntigravitySkill({
|
|
@@ -5916,7 +6042,7 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
5916
6042
|
};
|
|
5917
6043
|
|
|
5918
6044
|
// src/features/skills/claudecode-skill.ts
|
|
5919
|
-
var
|
|
6045
|
+
var import_node_path54 = require("path");
|
|
5920
6046
|
var import_mini22 = require("zod/mini");
|
|
5921
6047
|
var ClaudecodeSkillFrontmatterSchema = import_mini22.z.looseObject({
|
|
5922
6048
|
name: import_mini22.z.string(),
|
|
@@ -5926,7 +6052,7 @@ var ClaudecodeSkillFrontmatterSchema = import_mini22.z.looseObject({
|
|
|
5926
6052
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
5927
6053
|
constructor({
|
|
5928
6054
|
baseDir = process.cwd(),
|
|
5929
|
-
relativeDirPath = (0,
|
|
6055
|
+
relativeDirPath = (0, import_node_path54.join)(".claude", "skills"),
|
|
5930
6056
|
dirName,
|
|
5931
6057
|
frontmatter,
|
|
5932
6058
|
body,
|
|
@@ -5957,7 +6083,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5957
6083
|
global: _global = false
|
|
5958
6084
|
} = {}) {
|
|
5959
6085
|
return {
|
|
5960
|
-
relativeDirPath: (0,
|
|
6086
|
+
relativeDirPath: (0, import_node_path54.join)(".claude", "skills")
|
|
5961
6087
|
};
|
|
5962
6088
|
}
|
|
5963
6089
|
getFrontmatter() {
|
|
@@ -6045,9 +6171,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6045
6171
|
});
|
|
6046
6172
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6047
6173
|
if (!result.success) {
|
|
6048
|
-
const skillDirPath = (0,
|
|
6174
|
+
const skillDirPath = (0, import_node_path54.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6049
6175
|
throw new Error(
|
|
6050
|
-
`Invalid frontmatter in ${(0,
|
|
6176
|
+
`Invalid frontmatter in ${(0, import_node_path54.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6051
6177
|
);
|
|
6052
6178
|
}
|
|
6053
6179
|
return new _ClaudecodeSkill({
|
|
@@ -6081,7 +6207,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6081
6207
|
};
|
|
6082
6208
|
|
|
6083
6209
|
// src/features/skills/codexcli-skill.ts
|
|
6084
|
-
var
|
|
6210
|
+
var import_node_path55 = require("path");
|
|
6085
6211
|
var import_mini23 = require("zod/mini");
|
|
6086
6212
|
var CodexCliSkillFrontmatterSchema = import_mini23.z.looseObject({
|
|
6087
6213
|
name: import_mini23.z.string(),
|
|
@@ -6095,7 +6221,7 @@ var CodexCliSkillFrontmatterSchema = import_mini23.z.looseObject({
|
|
|
6095
6221
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
6096
6222
|
constructor({
|
|
6097
6223
|
baseDir = process.cwd(),
|
|
6098
|
-
relativeDirPath = (0,
|
|
6224
|
+
relativeDirPath = (0, import_node_path55.join)(".codex", "skills"),
|
|
6099
6225
|
dirName,
|
|
6100
6226
|
frontmatter,
|
|
6101
6227
|
body,
|
|
@@ -6126,7 +6252,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6126
6252
|
global: _global = false
|
|
6127
6253
|
} = {}) {
|
|
6128
6254
|
return {
|
|
6129
|
-
relativeDirPath: (0,
|
|
6255
|
+
relativeDirPath: (0, import_node_path55.join)(".codex", "skills")
|
|
6130
6256
|
};
|
|
6131
6257
|
}
|
|
6132
6258
|
getFrontmatter() {
|
|
@@ -6218,9 +6344,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6218
6344
|
});
|
|
6219
6345
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6220
6346
|
if (!result.success) {
|
|
6221
|
-
const skillDirPath = (0,
|
|
6347
|
+
const skillDirPath = (0, import_node_path55.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6222
6348
|
throw new Error(
|
|
6223
|
-
`Invalid frontmatter in ${(0,
|
|
6349
|
+
`Invalid frontmatter in ${(0, import_node_path55.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6224
6350
|
);
|
|
6225
6351
|
}
|
|
6226
6352
|
return new _CodexCliSkill({
|
|
@@ -6254,7 +6380,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6254
6380
|
};
|
|
6255
6381
|
|
|
6256
6382
|
// src/features/skills/copilot-skill.ts
|
|
6257
|
-
var
|
|
6383
|
+
var import_node_path56 = require("path");
|
|
6258
6384
|
var import_mini24 = require("zod/mini");
|
|
6259
6385
|
var CopilotSkillFrontmatterSchema = import_mini24.z.looseObject({
|
|
6260
6386
|
name: import_mini24.z.string(),
|
|
@@ -6264,7 +6390,7 @@ var CopilotSkillFrontmatterSchema = import_mini24.z.looseObject({
|
|
|
6264
6390
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
6265
6391
|
constructor({
|
|
6266
6392
|
baseDir = process.cwd(),
|
|
6267
|
-
relativeDirPath = (0,
|
|
6393
|
+
relativeDirPath = (0, import_node_path56.join)(".github", "skills"),
|
|
6268
6394
|
dirName,
|
|
6269
6395
|
frontmatter,
|
|
6270
6396
|
body,
|
|
@@ -6296,7 +6422,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6296
6422
|
throw new Error("CopilotSkill does not support global mode.");
|
|
6297
6423
|
}
|
|
6298
6424
|
return {
|
|
6299
|
-
relativeDirPath: (0,
|
|
6425
|
+
relativeDirPath: (0, import_node_path56.join)(".github", "skills")
|
|
6300
6426
|
};
|
|
6301
6427
|
}
|
|
6302
6428
|
getFrontmatter() {
|
|
@@ -6384,9 +6510,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6384
6510
|
});
|
|
6385
6511
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6386
6512
|
if (!result.success) {
|
|
6387
|
-
const skillDirPath = (0,
|
|
6513
|
+
const skillDirPath = (0, import_node_path56.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6388
6514
|
throw new Error(
|
|
6389
|
-
`Invalid frontmatter in ${(0,
|
|
6515
|
+
`Invalid frontmatter in ${(0, import_node_path56.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6390
6516
|
);
|
|
6391
6517
|
}
|
|
6392
6518
|
return new _CopilotSkill({
|
|
@@ -6421,7 +6547,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6421
6547
|
};
|
|
6422
6548
|
|
|
6423
6549
|
// src/features/skills/cursor-skill.ts
|
|
6424
|
-
var
|
|
6550
|
+
var import_node_path57 = require("path");
|
|
6425
6551
|
var import_mini25 = require("zod/mini");
|
|
6426
6552
|
var CursorSkillFrontmatterSchema = import_mini25.z.looseObject({
|
|
6427
6553
|
name: import_mini25.z.string(),
|
|
@@ -6430,7 +6556,7 @@ var CursorSkillFrontmatterSchema = import_mini25.z.looseObject({
|
|
|
6430
6556
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
6431
6557
|
constructor({
|
|
6432
6558
|
baseDir = process.cwd(),
|
|
6433
|
-
relativeDirPath = (0,
|
|
6559
|
+
relativeDirPath = (0, import_node_path57.join)(".cursor", "skills"),
|
|
6434
6560
|
dirName,
|
|
6435
6561
|
frontmatter,
|
|
6436
6562
|
body,
|
|
@@ -6462,7 +6588,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6462
6588
|
throw new Error("CursorSkill does not support global mode.");
|
|
6463
6589
|
}
|
|
6464
6590
|
return {
|
|
6465
|
-
relativeDirPath: (0,
|
|
6591
|
+
relativeDirPath: (0, import_node_path57.join)(".cursor", "skills")
|
|
6466
6592
|
};
|
|
6467
6593
|
}
|
|
6468
6594
|
getFrontmatter() {
|
|
@@ -6544,9 +6670,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6544
6670
|
});
|
|
6545
6671
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6546
6672
|
if (!result.success) {
|
|
6547
|
-
const skillDirPath = (0,
|
|
6673
|
+
const skillDirPath = (0, import_node_path57.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6548
6674
|
throw new Error(
|
|
6549
|
-
`Invalid frontmatter in ${(0,
|
|
6675
|
+
`Invalid frontmatter in ${(0, import_node_path57.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6550
6676
|
);
|
|
6551
6677
|
}
|
|
6552
6678
|
return new _CursorSkill({
|
|
@@ -6581,7 +6707,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6581
6707
|
};
|
|
6582
6708
|
|
|
6583
6709
|
// src/features/skills/kilo-skill.ts
|
|
6584
|
-
var
|
|
6710
|
+
var import_node_path58 = require("path");
|
|
6585
6711
|
var import_mini26 = require("zod/mini");
|
|
6586
6712
|
var KiloSkillFrontmatterSchema = import_mini26.z.looseObject({
|
|
6587
6713
|
name: import_mini26.z.string(),
|
|
@@ -6590,7 +6716,7 @@ var KiloSkillFrontmatterSchema = import_mini26.z.looseObject({
|
|
|
6590
6716
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
6591
6717
|
constructor({
|
|
6592
6718
|
baseDir = process.cwd(),
|
|
6593
|
-
relativeDirPath = (0,
|
|
6719
|
+
relativeDirPath = (0, import_node_path58.join)(".kilocode", "skills"),
|
|
6594
6720
|
dirName,
|
|
6595
6721
|
frontmatter,
|
|
6596
6722
|
body,
|
|
@@ -6621,7 +6747,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6621
6747
|
global: _global = false
|
|
6622
6748
|
} = {}) {
|
|
6623
6749
|
return {
|
|
6624
|
-
relativeDirPath: (0,
|
|
6750
|
+
relativeDirPath: (0, import_node_path58.join)(".kilocode", "skills")
|
|
6625
6751
|
};
|
|
6626
6752
|
}
|
|
6627
6753
|
getFrontmatter() {
|
|
@@ -6711,13 +6837,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6711
6837
|
});
|
|
6712
6838
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6713
6839
|
if (!result.success) {
|
|
6714
|
-
const skillDirPath = (0,
|
|
6840
|
+
const skillDirPath = (0, import_node_path58.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6715
6841
|
throw new Error(
|
|
6716
|
-
`Invalid frontmatter in ${(0,
|
|
6842
|
+
`Invalid frontmatter in ${(0, import_node_path58.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6717
6843
|
);
|
|
6718
6844
|
}
|
|
6719
6845
|
if (result.data.name !== loaded.dirName) {
|
|
6720
|
-
const skillFilePath = (0,
|
|
6846
|
+
const skillFilePath = (0, import_node_path58.join)(
|
|
6721
6847
|
loaded.baseDir,
|
|
6722
6848
|
loaded.relativeDirPath,
|
|
6723
6849
|
loaded.dirName,
|
|
@@ -6758,7 +6884,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6758
6884
|
};
|
|
6759
6885
|
|
|
6760
6886
|
// src/features/skills/opencode-skill.ts
|
|
6761
|
-
var
|
|
6887
|
+
var import_node_path59 = require("path");
|
|
6762
6888
|
var import_mini27 = require("zod/mini");
|
|
6763
6889
|
var OpenCodeSkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
6764
6890
|
name: import_mini27.z.string(),
|
|
@@ -6768,7 +6894,7 @@ var OpenCodeSkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
|
6768
6894
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
6769
6895
|
constructor({
|
|
6770
6896
|
baseDir = process.cwd(),
|
|
6771
|
-
relativeDirPath = (0,
|
|
6897
|
+
relativeDirPath = (0, import_node_path59.join)(".opencode", "skill"),
|
|
6772
6898
|
dirName,
|
|
6773
6899
|
frontmatter,
|
|
6774
6900
|
body,
|
|
@@ -6797,7 +6923,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6797
6923
|
}
|
|
6798
6924
|
static getSettablePaths({ global = false } = {}) {
|
|
6799
6925
|
return {
|
|
6800
|
-
relativeDirPath: global ? (0,
|
|
6926
|
+
relativeDirPath: global ? (0, import_node_path59.join)(".config", "opencode", "skill") : (0, import_node_path59.join)(".opencode", "skill")
|
|
6801
6927
|
};
|
|
6802
6928
|
}
|
|
6803
6929
|
getFrontmatter() {
|
|
@@ -6885,9 +7011,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6885
7011
|
});
|
|
6886
7012
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6887
7013
|
if (!result.success) {
|
|
6888
|
-
const skillDirPath = (0,
|
|
7014
|
+
const skillDirPath = (0, import_node_path59.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6889
7015
|
throw new Error(
|
|
6890
|
-
`Invalid frontmatter in ${(0,
|
|
7016
|
+
`Invalid frontmatter in ${(0, import_node_path59.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6891
7017
|
);
|
|
6892
7018
|
}
|
|
6893
7019
|
return new _OpenCodeSkill({
|
|
@@ -6921,7 +7047,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6921
7047
|
};
|
|
6922
7048
|
|
|
6923
7049
|
// src/features/skills/roo-skill.ts
|
|
6924
|
-
var
|
|
7050
|
+
var import_node_path60 = require("path");
|
|
6925
7051
|
var import_mini28 = require("zod/mini");
|
|
6926
7052
|
var RooSkillFrontmatterSchema = import_mini28.z.looseObject({
|
|
6927
7053
|
name: import_mini28.z.string(),
|
|
@@ -6930,7 +7056,7 @@ var RooSkillFrontmatterSchema = import_mini28.z.looseObject({
|
|
|
6930
7056
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
6931
7057
|
constructor({
|
|
6932
7058
|
baseDir = process.cwd(),
|
|
6933
|
-
relativeDirPath = (0,
|
|
7059
|
+
relativeDirPath = (0, import_node_path60.join)(".roo", "skills"),
|
|
6934
7060
|
dirName,
|
|
6935
7061
|
frontmatter,
|
|
6936
7062
|
body,
|
|
@@ -6961,7 +7087,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6961
7087
|
global: _global = false
|
|
6962
7088
|
} = {}) {
|
|
6963
7089
|
return {
|
|
6964
|
-
relativeDirPath: (0,
|
|
7090
|
+
relativeDirPath: (0, import_node_path60.join)(".roo", "skills")
|
|
6965
7091
|
};
|
|
6966
7092
|
}
|
|
6967
7093
|
getFrontmatter() {
|
|
@@ -7051,13 +7177,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
7051
7177
|
});
|
|
7052
7178
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7053
7179
|
if (!result.success) {
|
|
7054
|
-
const skillDirPath = (0,
|
|
7180
|
+
const skillDirPath = (0, import_node_path60.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7055
7181
|
throw new Error(
|
|
7056
|
-
`Invalid frontmatter in ${(0,
|
|
7182
|
+
`Invalid frontmatter in ${(0, import_node_path60.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7057
7183
|
);
|
|
7058
7184
|
}
|
|
7059
7185
|
if (result.data.name !== loaded.dirName) {
|
|
7060
|
-
const skillFilePath = (0,
|
|
7186
|
+
const skillFilePath = (0, import_node_path60.join)(
|
|
7061
7187
|
loaded.baseDir,
|
|
7062
7188
|
loaded.relativeDirPath,
|
|
7063
7189
|
loaded.dirName,
|
|
@@ -7268,9 +7394,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7268
7394
|
*/
|
|
7269
7395
|
async loadRulesyncDirs() {
|
|
7270
7396
|
const paths = RulesyncSkill.getSettablePaths();
|
|
7271
|
-
const rulesyncSkillsDirPath = (0,
|
|
7272
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
7273
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
7397
|
+
const rulesyncSkillsDirPath = (0, import_node_path61.join)(this.baseDir, paths.relativeDirPath);
|
|
7398
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path61.join)(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
7399
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path61.basename)(path3));
|
|
7274
7400
|
const rulesyncSkills = await Promise.all(
|
|
7275
7401
|
dirNames.map(
|
|
7276
7402
|
(dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
|
|
@@ -7286,9 +7412,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7286
7412
|
async loadToolDirs() {
|
|
7287
7413
|
const factory = this.getFactory(this.toolTarget);
|
|
7288
7414
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7289
|
-
const skillsDirPath = (0,
|
|
7290
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
7291
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
7415
|
+
const skillsDirPath = (0, import_node_path61.join)(this.baseDir, paths.relativeDirPath);
|
|
7416
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path61.join)(skillsDirPath, "*"), { type: "dir" });
|
|
7417
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path61.basename)(path3));
|
|
7292
7418
|
const toolSkills = await Promise.all(
|
|
7293
7419
|
dirNames.map(
|
|
7294
7420
|
(dirName) => factory.class.fromDir({
|
|
@@ -7304,9 +7430,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7304
7430
|
async loadToolDirsToDelete() {
|
|
7305
7431
|
const factory = this.getFactory(this.toolTarget);
|
|
7306
7432
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7307
|
-
const skillsDirPath = (0,
|
|
7308
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
7309
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
7433
|
+
const skillsDirPath = (0, import_node_path61.join)(this.baseDir, paths.relativeDirPath);
|
|
7434
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path61.join)(skillsDirPath, "*"), { type: "dir" });
|
|
7435
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path61.basename)(path3));
|
|
7310
7436
|
const toolSkills = dirNames.map(
|
|
7311
7437
|
(dirName) => factory.class.forDeletion({
|
|
7312
7438
|
baseDir: this.baseDir,
|
|
@@ -7354,10 +7480,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7354
7480
|
};
|
|
7355
7481
|
|
|
7356
7482
|
// src/features/subagents/agentsmd-subagent.ts
|
|
7357
|
-
var
|
|
7483
|
+
var import_node_path63 = require("path");
|
|
7358
7484
|
|
|
7359
7485
|
// src/features/subagents/simulated-subagent.ts
|
|
7360
|
-
var
|
|
7486
|
+
var import_node_path62 = require("path");
|
|
7361
7487
|
var import_mini30 = require("zod/mini");
|
|
7362
7488
|
|
|
7363
7489
|
// src/features/subagents/tool-subagent.ts
|
|
@@ -7413,7 +7539,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7413
7539
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7414
7540
|
if (!result.success) {
|
|
7415
7541
|
throw new Error(
|
|
7416
|
-
`Invalid frontmatter in ${(0,
|
|
7542
|
+
`Invalid frontmatter in ${(0, import_node_path62.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7417
7543
|
);
|
|
7418
7544
|
}
|
|
7419
7545
|
}
|
|
@@ -7464,7 +7590,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7464
7590
|
return {
|
|
7465
7591
|
success: false,
|
|
7466
7592
|
error: new Error(
|
|
7467
|
-
`Invalid frontmatter in ${(0,
|
|
7593
|
+
`Invalid frontmatter in ${(0, import_node_path62.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7468
7594
|
)
|
|
7469
7595
|
};
|
|
7470
7596
|
}
|
|
@@ -7474,7 +7600,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7474
7600
|
relativeFilePath,
|
|
7475
7601
|
validate = true
|
|
7476
7602
|
}) {
|
|
7477
|
-
const filePath = (0,
|
|
7603
|
+
const filePath = (0, import_node_path62.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
7478
7604
|
const fileContent = await readFileContent(filePath);
|
|
7479
7605
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7480
7606
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7484,7 +7610,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7484
7610
|
return {
|
|
7485
7611
|
baseDir,
|
|
7486
7612
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
7487
|
-
relativeFilePath: (0,
|
|
7613
|
+
relativeFilePath: (0, import_node_path62.basename)(relativeFilePath),
|
|
7488
7614
|
frontmatter: result.data,
|
|
7489
7615
|
body: content.trim(),
|
|
7490
7616
|
validate
|
|
@@ -7510,7 +7636,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7510
7636
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
7511
7637
|
static getSettablePaths() {
|
|
7512
7638
|
return {
|
|
7513
|
-
relativeDirPath: (0,
|
|
7639
|
+
relativeDirPath: (0, import_node_path63.join)(".agents", "subagents")
|
|
7514
7640
|
};
|
|
7515
7641
|
}
|
|
7516
7642
|
static async fromFile(params) {
|
|
@@ -7533,11 +7659,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
7533
7659
|
};
|
|
7534
7660
|
|
|
7535
7661
|
// src/features/subagents/codexcli-subagent.ts
|
|
7536
|
-
var
|
|
7662
|
+
var import_node_path64 = require("path");
|
|
7537
7663
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
7538
7664
|
static getSettablePaths() {
|
|
7539
7665
|
return {
|
|
7540
|
-
relativeDirPath: (0,
|
|
7666
|
+
relativeDirPath: (0, import_node_path64.join)(".codex", "subagents")
|
|
7541
7667
|
};
|
|
7542
7668
|
}
|
|
7543
7669
|
static async fromFile(params) {
|
|
@@ -7560,11 +7686,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
7560
7686
|
};
|
|
7561
7687
|
|
|
7562
7688
|
// src/features/subagents/cursor-subagent.ts
|
|
7563
|
-
var
|
|
7689
|
+
var import_node_path65 = require("path");
|
|
7564
7690
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
7565
7691
|
static getSettablePaths() {
|
|
7566
7692
|
return {
|
|
7567
|
-
relativeDirPath: (0,
|
|
7693
|
+
relativeDirPath: (0, import_node_path65.join)(".cursor", "subagents")
|
|
7568
7694
|
};
|
|
7569
7695
|
}
|
|
7570
7696
|
static async fromFile(params) {
|
|
@@ -7587,11 +7713,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
7587
7713
|
};
|
|
7588
7714
|
|
|
7589
7715
|
// src/features/subagents/geminicli-subagent.ts
|
|
7590
|
-
var
|
|
7716
|
+
var import_node_path66 = require("path");
|
|
7591
7717
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
7592
7718
|
static getSettablePaths() {
|
|
7593
7719
|
return {
|
|
7594
|
-
relativeDirPath: (0,
|
|
7720
|
+
relativeDirPath: (0, import_node_path66.join)(".gemini", "subagents")
|
|
7595
7721
|
};
|
|
7596
7722
|
}
|
|
7597
7723
|
static async fromFile(params) {
|
|
@@ -7614,11 +7740,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
7614
7740
|
};
|
|
7615
7741
|
|
|
7616
7742
|
// src/features/subagents/roo-subagent.ts
|
|
7617
|
-
var
|
|
7743
|
+
var import_node_path67 = require("path");
|
|
7618
7744
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
7619
7745
|
static getSettablePaths() {
|
|
7620
7746
|
return {
|
|
7621
|
-
relativeDirPath: (0,
|
|
7747
|
+
relativeDirPath: (0, import_node_path67.join)(".roo", "subagents")
|
|
7622
7748
|
};
|
|
7623
7749
|
}
|
|
7624
7750
|
static async fromFile(params) {
|
|
@@ -7641,15 +7767,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
7641
7767
|
};
|
|
7642
7768
|
|
|
7643
7769
|
// src/features/subagents/subagents-processor.ts
|
|
7644
|
-
var
|
|
7770
|
+
var import_node_path72 = require("path");
|
|
7645
7771
|
var import_mini35 = require("zod/mini");
|
|
7646
7772
|
|
|
7647
7773
|
// src/features/subagents/claudecode-subagent.ts
|
|
7648
|
-
var
|
|
7774
|
+
var import_node_path69 = require("path");
|
|
7649
7775
|
var import_mini32 = require("zod/mini");
|
|
7650
7776
|
|
|
7651
7777
|
// src/features/subagents/rulesync-subagent.ts
|
|
7652
|
-
var
|
|
7778
|
+
var import_node_path68 = require("path");
|
|
7653
7779
|
var import_mini31 = require("zod/mini");
|
|
7654
7780
|
var RulesyncSubagentFrontmatterSchema = import_mini31.z.looseObject({
|
|
7655
7781
|
targets: RulesyncTargetsSchema,
|
|
@@ -7664,7 +7790,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7664
7790
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7665
7791
|
if (!result.success) {
|
|
7666
7792
|
throw new Error(
|
|
7667
|
-
`Invalid frontmatter in ${(0,
|
|
7793
|
+
`Invalid frontmatter in ${(0, import_node_path68.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7668
7794
|
);
|
|
7669
7795
|
}
|
|
7670
7796
|
}
|
|
@@ -7697,7 +7823,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7697
7823
|
return {
|
|
7698
7824
|
success: false,
|
|
7699
7825
|
error: new Error(
|
|
7700
|
-
`Invalid frontmatter in ${(0,
|
|
7826
|
+
`Invalid frontmatter in ${(0, import_node_path68.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7701
7827
|
)
|
|
7702
7828
|
};
|
|
7703
7829
|
}
|
|
@@ -7706,14 +7832,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7706
7832
|
relativeFilePath
|
|
7707
7833
|
}) {
|
|
7708
7834
|
const fileContent = await readFileContent(
|
|
7709
|
-
(0,
|
|
7835
|
+
(0, import_node_path68.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
7710
7836
|
);
|
|
7711
7837
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7712
7838
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7713
7839
|
if (!result.success) {
|
|
7714
7840
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
7715
7841
|
}
|
|
7716
|
-
const filename = (0,
|
|
7842
|
+
const filename = (0, import_node_path68.basename)(relativeFilePath);
|
|
7717
7843
|
return new _RulesyncSubagent({
|
|
7718
7844
|
baseDir: process.cwd(),
|
|
7719
7845
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -7741,7 +7867,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7741
7867
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7742
7868
|
if (!result.success) {
|
|
7743
7869
|
throw new Error(
|
|
7744
|
-
`Invalid frontmatter in ${(0,
|
|
7870
|
+
`Invalid frontmatter in ${(0, import_node_path69.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7745
7871
|
);
|
|
7746
7872
|
}
|
|
7747
7873
|
}
|
|
@@ -7753,7 +7879,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7753
7879
|
}
|
|
7754
7880
|
static getSettablePaths(_options = {}) {
|
|
7755
7881
|
return {
|
|
7756
|
-
relativeDirPath: (0,
|
|
7882
|
+
relativeDirPath: (0, import_node_path69.join)(".claude", "agents")
|
|
7757
7883
|
};
|
|
7758
7884
|
}
|
|
7759
7885
|
getFrontmatter() {
|
|
@@ -7827,7 +7953,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7827
7953
|
return {
|
|
7828
7954
|
success: false,
|
|
7829
7955
|
error: new Error(
|
|
7830
|
-
`Invalid frontmatter in ${(0,
|
|
7956
|
+
`Invalid frontmatter in ${(0, import_node_path69.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7831
7957
|
)
|
|
7832
7958
|
};
|
|
7833
7959
|
}
|
|
@@ -7845,7 +7971,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7845
7971
|
global = false
|
|
7846
7972
|
}) {
|
|
7847
7973
|
const paths = this.getSettablePaths({ global });
|
|
7848
|
-
const filePath = (0,
|
|
7974
|
+
const filePath = (0, import_node_path69.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7849
7975
|
const fileContent = await readFileContent(filePath);
|
|
7850
7976
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7851
7977
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7880,7 +8006,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7880
8006
|
};
|
|
7881
8007
|
|
|
7882
8008
|
// src/features/subagents/copilot-subagent.ts
|
|
7883
|
-
var
|
|
8009
|
+
var import_node_path70 = require("path");
|
|
7884
8010
|
var import_mini33 = require("zod/mini");
|
|
7885
8011
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
7886
8012
|
var CopilotSubagentFrontmatterSchema = import_mini33.z.looseObject({
|
|
@@ -7906,7 +8032,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7906
8032
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7907
8033
|
if (!result.success) {
|
|
7908
8034
|
throw new Error(
|
|
7909
|
-
`Invalid frontmatter in ${(0,
|
|
8035
|
+
`Invalid frontmatter in ${(0, import_node_path70.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7910
8036
|
);
|
|
7911
8037
|
}
|
|
7912
8038
|
}
|
|
@@ -7918,7 +8044,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7918
8044
|
}
|
|
7919
8045
|
static getSettablePaths(_options = {}) {
|
|
7920
8046
|
return {
|
|
7921
|
-
relativeDirPath: (0,
|
|
8047
|
+
relativeDirPath: (0, import_node_path70.join)(".github", "agents")
|
|
7922
8048
|
};
|
|
7923
8049
|
}
|
|
7924
8050
|
getFrontmatter() {
|
|
@@ -7992,7 +8118,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7992
8118
|
return {
|
|
7993
8119
|
success: false,
|
|
7994
8120
|
error: new Error(
|
|
7995
|
-
`Invalid frontmatter in ${(0,
|
|
8121
|
+
`Invalid frontmatter in ${(0, import_node_path70.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7996
8122
|
)
|
|
7997
8123
|
};
|
|
7998
8124
|
}
|
|
@@ -8010,7 +8136,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8010
8136
|
global = false
|
|
8011
8137
|
}) {
|
|
8012
8138
|
const paths = this.getSettablePaths({ global });
|
|
8013
|
-
const filePath = (0,
|
|
8139
|
+
const filePath = (0, import_node_path70.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8014
8140
|
const fileContent = await readFileContent(filePath);
|
|
8015
8141
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8016
8142
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8046,7 +8172,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8046
8172
|
};
|
|
8047
8173
|
|
|
8048
8174
|
// src/features/subagents/opencode-subagent.ts
|
|
8049
|
-
var
|
|
8175
|
+
var import_node_path71 = require("path");
|
|
8050
8176
|
var import_mini34 = require("zod/mini");
|
|
8051
8177
|
var OpenCodeSubagentFrontmatterSchema = import_mini34.z.looseObject({
|
|
8052
8178
|
description: import_mini34.z.string(),
|
|
@@ -8061,7 +8187,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8061
8187
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8062
8188
|
if (!result.success) {
|
|
8063
8189
|
throw new Error(
|
|
8064
|
-
`Invalid frontmatter in ${(0,
|
|
8190
|
+
`Invalid frontmatter in ${(0, import_node_path71.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8065
8191
|
);
|
|
8066
8192
|
}
|
|
8067
8193
|
}
|
|
@@ -8075,7 +8201,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8075
8201
|
global = false
|
|
8076
8202
|
} = {}) {
|
|
8077
8203
|
return {
|
|
8078
|
-
relativeDirPath: global ? (0,
|
|
8204
|
+
relativeDirPath: global ? (0, import_node_path71.join)(".config", "opencode", "agent") : (0, import_node_path71.join)(".opencode", "agent")
|
|
8079
8205
|
};
|
|
8080
8206
|
}
|
|
8081
8207
|
getFrontmatter() {
|
|
@@ -8088,7 +8214,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8088
8214
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
8089
8215
|
const rulesyncFrontmatter = {
|
|
8090
8216
|
targets: ["opencode"],
|
|
8091
|
-
name: name ?? (0,
|
|
8217
|
+
name: name ?? (0, import_node_path71.basename)(this.getRelativeFilePath(), ".md"),
|
|
8092
8218
|
description,
|
|
8093
8219
|
opencode: { mode, ...opencodeSection }
|
|
8094
8220
|
};
|
|
@@ -8141,7 +8267,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8141
8267
|
return {
|
|
8142
8268
|
success: false,
|
|
8143
8269
|
error: new Error(
|
|
8144
|
-
`Invalid frontmatter in ${(0,
|
|
8270
|
+
`Invalid frontmatter in ${(0, import_node_path71.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8145
8271
|
)
|
|
8146
8272
|
};
|
|
8147
8273
|
}
|
|
@@ -8158,7 +8284,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8158
8284
|
global = false
|
|
8159
8285
|
}) {
|
|
8160
8286
|
const paths = this.getSettablePaths({ global });
|
|
8161
|
-
const filePath = (0,
|
|
8287
|
+
const filePath = (0, import_node_path71.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8162
8288
|
const fileContent = await readFileContent(filePath);
|
|
8163
8289
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8164
8290
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8319,7 +8445,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8319
8445
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
8320
8446
|
*/
|
|
8321
8447
|
async loadRulesyncFiles() {
|
|
8322
|
-
const subagentsDir = (0,
|
|
8448
|
+
const subagentsDir = (0, import_node_path72.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
8323
8449
|
const dirExists = await directoryExists(subagentsDir);
|
|
8324
8450
|
if (!dirExists) {
|
|
8325
8451
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -8334,7 +8460,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8334
8460
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
8335
8461
|
const rulesyncSubagents = [];
|
|
8336
8462
|
for (const mdFile of mdFiles) {
|
|
8337
|
-
const filepath = (0,
|
|
8463
|
+
const filepath = (0, import_node_path72.join)(subagentsDir, mdFile);
|
|
8338
8464
|
try {
|
|
8339
8465
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
8340
8466
|
relativeFilePath: mdFile,
|
|
@@ -8364,14 +8490,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8364
8490
|
const factory = this.getFactory(this.toolTarget);
|
|
8365
8491
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
8366
8492
|
const subagentFilePaths = await findFilesByGlobs(
|
|
8367
|
-
(0,
|
|
8493
|
+
(0, import_node_path72.join)(this.baseDir, paths.relativeDirPath, "*.md")
|
|
8368
8494
|
);
|
|
8369
8495
|
if (forDeletion) {
|
|
8370
8496
|
const toolSubagents2 = subagentFilePaths.map(
|
|
8371
8497
|
(path3) => factory.class.forDeletion({
|
|
8372
8498
|
baseDir: this.baseDir,
|
|
8373
8499
|
relativeDirPath: paths.relativeDirPath,
|
|
8374
|
-
relativeFilePath: (0,
|
|
8500
|
+
relativeFilePath: (0, import_node_path72.basename)(path3),
|
|
8375
8501
|
global: this.global
|
|
8376
8502
|
})
|
|
8377
8503
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -8382,7 +8508,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8382
8508
|
subagentFilePaths.map(
|
|
8383
8509
|
(path3) => factory.class.fromFile({
|
|
8384
8510
|
baseDir: this.baseDir,
|
|
8385
|
-
relativeFilePath: (0,
|
|
8511
|
+
relativeFilePath: (0, import_node_path72.basename)(path3),
|
|
8386
8512
|
global: this.global
|
|
8387
8513
|
})
|
|
8388
8514
|
)
|
|
@@ -8414,13 +8540,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8414
8540
|
};
|
|
8415
8541
|
|
|
8416
8542
|
// src/features/rules/agentsmd-rule.ts
|
|
8417
|
-
var
|
|
8543
|
+
var import_node_path75 = require("path");
|
|
8418
8544
|
|
|
8419
8545
|
// src/features/rules/tool-rule.ts
|
|
8420
|
-
var
|
|
8546
|
+
var import_node_path74 = require("path");
|
|
8421
8547
|
|
|
8422
8548
|
// src/features/rules/rulesync-rule.ts
|
|
8423
|
-
var
|
|
8549
|
+
var import_node_path73 = require("path");
|
|
8424
8550
|
var import_mini36 = require("zod/mini");
|
|
8425
8551
|
var RulesyncRuleFrontmatterSchema = import_mini36.z.object({
|
|
8426
8552
|
root: import_mini36.z.optional(import_mini36.z.optional(import_mini36.z.boolean())),
|
|
@@ -8467,7 +8593,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8467
8593
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8468
8594
|
if (!result.success) {
|
|
8469
8595
|
throw new Error(
|
|
8470
|
-
`Invalid frontmatter in ${(0,
|
|
8596
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8471
8597
|
);
|
|
8472
8598
|
}
|
|
8473
8599
|
}
|
|
@@ -8502,7 +8628,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8502
8628
|
return {
|
|
8503
8629
|
success: false,
|
|
8504
8630
|
error: new Error(
|
|
8505
|
-
`Invalid frontmatter in ${(0,
|
|
8631
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8506
8632
|
)
|
|
8507
8633
|
};
|
|
8508
8634
|
}
|
|
@@ -8511,12 +8637,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8511
8637
|
relativeFilePath,
|
|
8512
8638
|
validate = true
|
|
8513
8639
|
}) {
|
|
8514
|
-
const legacyPath = (0,
|
|
8640
|
+
const legacyPath = (0, import_node_path73.join)(
|
|
8515
8641
|
process.cwd(),
|
|
8516
8642
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
8517
8643
|
relativeFilePath
|
|
8518
8644
|
);
|
|
8519
|
-
const recommendedPath = (0,
|
|
8645
|
+
const recommendedPath = (0, import_node_path73.join)(
|
|
8520
8646
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8521
8647
|
relativeFilePath
|
|
8522
8648
|
);
|
|
@@ -8537,7 +8663,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8537
8663
|
agentsmd: result.data.agentsmd,
|
|
8538
8664
|
cursor: result.data.cursor
|
|
8539
8665
|
};
|
|
8540
|
-
const filename = (0,
|
|
8666
|
+
const filename = (0, import_node_path73.basename)(legacyPath);
|
|
8541
8667
|
return new _RulesyncRule({
|
|
8542
8668
|
baseDir: process.cwd(),
|
|
8543
8669
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8551,7 +8677,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8551
8677
|
relativeFilePath,
|
|
8552
8678
|
validate = true
|
|
8553
8679
|
}) {
|
|
8554
|
-
const filePath = (0,
|
|
8680
|
+
const filePath = (0, import_node_path73.join)(
|
|
8555
8681
|
process.cwd(),
|
|
8556
8682
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8557
8683
|
relativeFilePath
|
|
@@ -8570,7 +8696,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8570
8696
|
agentsmd: result.data.agentsmd,
|
|
8571
8697
|
cursor: result.data.cursor
|
|
8572
8698
|
};
|
|
8573
|
-
const filename = (0,
|
|
8699
|
+
const filename = (0, import_node_path73.basename)(filePath);
|
|
8574
8700
|
return new _RulesyncRule({
|
|
8575
8701
|
baseDir: process.cwd(),
|
|
8576
8702
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8653,7 +8779,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8653
8779
|
rulesyncRule,
|
|
8654
8780
|
validate = true,
|
|
8655
8781
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
8656
|
-
nonRootPath = { relativeDirPath: (0,
|
|
8782
|
+
nonRootPath = { relativeDirPath: (0, import_node_path74.join)(".agents", "memories") }
|
|
8657
8783
|
}) {
|
|
8658
8784
|
const params = this.buildToolRuleParamsDefault({
|
|
8659
8785
|
baseDir,
|
|
@@ -8664,7 +8790,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8664
8790
|
});
|
|
8665
8791
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
8666
8792
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
8667
|
-
params.relativeDirPath = (0,
|
|
8793
|
+
params.relativeDirPath = (0, import_node_path74.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
8668
8794
|
params.relativeFilePath = "AGENTS.md";
|
|
8669
8795
|
}
|
|
8670
8796
|
return params;
|
|
@@ -8729,7 +8855,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8729
8855
|
relativeFilePath: "AGENTS.md"
|
|
8730
8856
|
},
|
|
8731
8857
|
nonRoot: {
|
|
8732
|
-
relativeDirPath: (0,
|
|
8858
|
+
relativeDirPath: (0, import_node_path75.join)(".agents", "memories")
|
|
8733
8859
|
}
|
|
8734
8860
|
};
|
|
8735
8861
|
}
|
|
@@ -8739,8 +8865,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8739
8865
|
validate = true
|
|
8740
8866
|
}) {
|
|
8741
8867
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
8742
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
8743
|
-
const fileContent = await readFileContent((0,
|
|
8868
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path75.join)(".agents", "memories", relativeFilePath);
|
|
8869
|
+
const fileContent = await readFileContent((0, import_node_path75.join)(baseDir, relativePath));
|
|
8744
8870
|
return new _AgentsMdRule({
|
|
8745
8871
|
baseDir,
|
|
8746
8872
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -8795,7 +8921,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8795
8921
|
};
|
|
8796
8922
|
|
|
8797
8923
|
// src/features/rules/antigravity-rule.ts
|
|
8798
|
-
var
|
|
8924
|
+
var import_node_path76 = require("path");
|
|
8799
8925
|
var import_mini37 = require("zod/mini");
|
|
8800
8926
|
var AntigravityRuleFrontmatterSchema = import_mini37.z.looseObject({
|
|
8801
8927
|
trigger: import_mini37.z.optional(
|
|
@@ -8954,7 +9080,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8954
9080
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8955
9081
|
if (!result.success) {
|
|
8956
9082
|
throw new Error(
|
|
8957
|
-
`Invalid frontmatter in ${(0,
|
|
9083
|
+
`Invalid frontmatter in ${(0, import_node_path76.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8958
9084
|
);
|
|
8959
9085
|
}
|
|
8960
9086
|
}
|
|
@@ -8969,7 +9095,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8969
9095
|
static getSettablePaths() {
|
|
8970
9096
|
return {
|
|
8971
9097
|
nonRoot: {
|
|
8972
|
-
relativeDirPath: (0,
|
|
9098
|
+
relativeDirPath: (0, import_node_path76.join)(".agent", "rules")
|
|
8973
9099
|
}
|
|
8974
9100
|
};
|
|
8975
9101
|
}
|
|
@@ -8978,7 +9104,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8978
9104
|
relativeFilePath,
|
|
8979
9105
|
validate = true
|
|
8980
9106
|
}) {
|
|
8981
|
-
const filePath = (0,
|
|
9107
|
+
const filePath = (0, import_node_path76.join)(
|
|
8982
9108
|
baseDir,
|
|
8983
9109
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
8984
9110
|
relativeFilePath
|
|
@@ -9119,7 +9245,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9119
9245
|
};
|
|
9120
9246
|
|
|
9121
9247
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
9122
|
-
var
|
|
9248
|
+
var import_node_path77 = require("path");
|
|
9123
9249
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
9124
9250
|
toRulesyncRule() {
|
|
9125
9251
|
const rulesyncFrontmatter = {
|
|
@@ -9145,7 +9271,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9145
9271
|
relativeFilePath: ".augment-guidelines"
|
|
9146
9272
|
},
|
|
9147
9273
|
nonRoot: {
|
|
9148
|
-
relativeDirPath: (0,
|
|
9274
|
+
relativeDirPath: (0, import_node_path77.join)(".augment", "rules")
|
|
9149
9275
|
}
|
|
9150
9276
|
};
|
|
9151
9277
|
}
|
|
@@ -9180,8 +9306,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9180
9306
|
}) {
|
|
9181
9307
|
const settablePaths = this.getSettablePaths();
|
|
9182
9308
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
9183
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
9184
|
-
const fileContent = await readFileContent((0,
|
|
9309
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path77.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9310
|
+
const fileContent = await readFileContent((0, import_node_path77.join)(baseDir, relativePath));
|
|
9185
9311
|
return new _AugmentcodeLegacyRule({
|
|
9186
9312
|
baseDir,
|
|
9187
9313
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -9210,7 +9336,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9210
9336
|
};
|
|
9211
9337
|
|
|
9212
9338
|
// src/features/rules/augmentcode-rule.ts
|
|
9213
|
-
var
|
|
9339
|
+
var import_node_path78 = require("path");
|
|
9214
9340
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
9215
9341
|
toRulesyncRule() {
|
|
9216
9342
|
return this.toRulesyncRuleDefault();
|
|
@@ -9218,7 +9344,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9218
9344
|
static getSettablePaths() {
|
|
9219
9345
|
return {
|
|
9220
9346
|
nonRoot: {
|
|
9221
|
-
relativeDirPath: (0,
|
|
9347
|
+
relativeDirPath: (0, import_node_path78.join)(".augment", "rules")
|
|
9222
9348
|
}
|
|
9223
9349
|
};
|
|
9224
9350
|
}
|
|
@@ -9242,7 +9368,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9242
9368
|
validate = true
|
|
9243
9369
|
}) {
|
|
9244
9370
|
const fileContent = await readFileContent(
|
|
9245
|
-
(0,
|
|
9371
|
+
(0, import_node_path78.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9246
9372
|
);
|
|
9247
9373
|
const { body: content } = parseFrontmatter(fileContent);
|
|
9248
9374
|
return new _AugmentcodeRule({
|
|
@@ -9278,7 +9404,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9278
9404
|
};
|
|
9279
9405
|
|
|
9280
9406
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
9281
|
-
var
|
|
9407
|
+
var import_node_path79 = require("path");
|
|
9282
9408
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
9283
9409
|
static getSettablePaths({
|
|
9284
9410
|
global
|
|
@@ -9297,7 +9423,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9297
9423
|
relativeFilePath: "CLAUDE.md"
|
|
9298
9424
|
},
|
|
9299
9425
|
nonRoot: {
|
|
9300
|
-
relativeDirPath: (0,
|
|
9426
|
+
relativeDirPath: (0, import_node_path79.join)(".claude", "memories")
|
|
9301
9427
|
}
|
|
9302
9428
|
};
|
|
9303
9429
|
}
|
|
@@ -9312,7 +9438,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9312
9438
|
if (isRoot) {
|
|
9313
9439
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9314
9440
|
const fileContent2 = await readFileContent(
|
|
9315
|
-
(0,
|
|
9441
|
+
(0, import_node_path79.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9316
9442
|
);
|
|
9317
9443
|
return new _ClaudecodeLegacyRule({
|
|
9318
9444
|
baseDir,
|
|
@@ -9326,8 +9452,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9326
9452
|
if (!paths.nonRoot) {
|
|
9327
9453
|
throw new Error("nonRoot path is not set");
|
|
9328
9454
|
}
|
|
9329
|
-
const relativePath = (0,
|
|
9330
|
-
const fileContent = await readFileContent((0,
|
|
9455
|
+
const relativePath = (0, import_node_path79.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9456
|
+
const fileContent = await readFileContent((0, import_node_path79.join)(baseDir, relativePath));
|
|
9331
9457
|
return new _ClaudecodeLegacyRule({
|
|
9332
9458
|
baseDir,
|
|
9333
9459
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9386,7 +9512,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9386
9512
|
};
|
|
9387
9513
|
|
|
9388
9514
|
// src/features/rules/claudecode-rule.ts
|
|
9389
|
-
var
|
|
9515
|
+
var import_node_path80 = require("path");
|
|
9390
9516
|
var import_mini38 = require("zod/mini");
|
|
9391
9517
|
var ClaudecodeRuleFrontmatterSchema = import_mini38.z.object({
|
|
9392
9518
|
paths: import_mini38.z.optional(import_mini38.z.string())
|
|
@@ -9411,7 +9537,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9411
9537
|
relativeFilePath: "CLAUDE.md"
|
|
9412
9538
|
},
|
|
9413
9539
|
nonRoot: {
|
|
9414
|
-
relativeDirPath: (0,
|
|
9540
|
+
relativeDirPath: (0, import_node_path80.join)(".claude", "rules")
|
|
9415
9541
|
}
|
|
9416
9542
|
};
|
|
9417
9543
|
}
|
|
@@ -9420,7 +9546,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9420
9546
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9421
9547
|
if (!result.success) {
|
|
9422
9548
|
throw new Error(
|
|
9423
|
-
`Invalid frontmatter in ${(0,
|
|
9549
|
+
`Invalid frontmatter in ${(0, import_node_path80.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9424
9550
|
);
|
|
9425
9551
|
}
|
|
9426
9552
|
}
|
|
@@ -9448,7 +9574,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9448
9574
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
9449
9575
|
if (isRoot) {
|
|
9450
9576
|
const fileContent2 = await readFileContent(
|
|
9451
|
-
(0,
|
|
9577
|
+
(0, import_node_path80.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
9452
9578
|
);
|
|
9453
9579
|
return new _ClaudecodeRule({
|
|
9454
9580
|
baseDir,
|
|
@@ -9463,13 +9589,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9463
9589
|
if (!paths.nonRoot) {
|
|
9464
9590
|
throw new Error("nonRoot path is not set");
|
|
9465
9591
|
}
|
|
9466
|
-
const relativePath = (0,
|
|
9467
|
-
const fileContent = await readFileContent((0,
|
|
9592
|
+
const relativePath = (0, import_node_path80.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9593
|
+
const fileContent = await readFileContent((0, import_node_path80.join)(baseDir, relativePath));
|
|
9468
9594
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9469
9595
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9470
9596
|
if (!result.success) {
|
|
9471
9597
|
throw new Error(
|
|
9472
|
-
`Invalid frontmatter in ${(0,
|
|
9598
|
+
`Invalid frontmatter in ${(0, import_node_path80.join)(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
9473
9599
|
);
|
|
9474
9600
|
}
|
|
9475
9601
|
return new _ClaudecodeRule({
|
|
@@ -9576,7 +9702,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9576
9702
|
return {
|
|
9577
9703
|
success: false,
|
|
9578
9704
|
error: new Error(
|
|
9579
|
-
`Invalid frontmatter in ${(0,
|
|
9705
|
+
`Invalid frontmatter in ${(0, import_node_path80.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9580
9706
|
)
|
|
9581
9707
|
};
|
|
9582
9708
|
}
|
|
@@ -9596,7 +9722,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9596
9722
|
};
|
|
9597
9723
|
|
|
9598
9724
|
// src/features/rules/cline-rule.ts
|
|
9599
|
-
var
|
|
9725
|
+
var import_node_path81 = require("path");
|
|
9600
9726
|
var import_mini39 = require("zod/mini");
|
|
9601
9727
|
var ClineRuleFrontmatterSchema = import_mini39.z.object({
|
|
9602
9728
|
description: import_mini39.z.string()
|
|
@@ -9641,7 +9767,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9641
9767
|
validate = true
|
|
9642
9768
|
}) {
|
|
9643
9769
|
const fileContent = await readFileContent(
|
|
9644
|
-
(0,
|
|
9770
|
+
(0, import_node_path81.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9645
9771
|
);
|
|
9646
9772
|
return new _ClineRule({
|
|
9647
9773
|
baseDir,
|
|
@@ -9667,7 +9793,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9667
9793
|
};
|
|
9668
9794
|
|
|
9669
9795
|
// src/features/rules/codexcli-rule.ts
|
|
9670
|
-
var
|
|
9796
|
+
var import_node_path82 = require("path");
|
|
9671
9797
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
9672
9798
|
static getSettablePaths({
|
|
9673
9799
|
global
|
|
@@ -9686,7 +9812,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9686
9812
|
relativeFilePath: "AGENTS.md"
|
|
9687
9813
|
},
|
|
9688
9814
|
nonRoot: {
|
|
9689
|
-
relativeDirPath: (0,
|
|
9815
|
+
relativeDirPath: (0, import_node_path82.join)(".codex", "memories")
|
|
9690
9816
|
}
|
|
9691
9817
|
};
|
|
9692
9818
|
}
|
|
@@ -9701,7 +9827,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9701
9827
|
if (isRoot) {
|
|
9702
9828
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9703
9829
|
const fileContent2 = await readFileContent(
|
|
9704
|
-
(0,
|
|
9830
|
+
(0, import_node_path82.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9705
9831
|
);
|
|
9706
9832
|
return new _CodexcliRule({
|
|
9707
9833
|
baseDir,
|
|
@@ -9715,8 +9841,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9715
9841
|
if (!paths.nonRoot) {
|
|
9716
9842
|
throw new Error("nonRoot path is not set");
|
|
9717
9843
|
}
|
|
9718
|
-
const relativePath = (0,
|
|
9719
|
-
const fileContent = await readFileContent((0,
|
|
9844
|
+
const relativePath = (0, import_node_path82.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9845
|
+
const fileContent = await readFileContent((0, import_node_path82.join)(baseDir, relativePath));
|
|
9720
9846
|
return new _CodexcliRule({
|
|
9721
9847
|
baseDir,
|
|
9722
9848
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9775,7 +9901,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9775
9901
|
};
|
|
9776
9902
|
|
|
9777
9903
|
// src/features/rules/copilot-rule.ts
|
|
9778
|
-
var
|
|
9904
|
+
var import_node_path83 = require("path");
|
|
9779
9905
|
var import_mini40 = require("zod/mini");
|
|
9780
9906
|
var CopilotRuleFrontmatterSchema = import_mini40.z.object({
|
|
9781
9907
|
description: import_mini40.z.optional(import_mini40.z.string()),
|
|
@@ -9792,7 +9918,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9792
9918
|
relativeFilePath: "copilot-instructions.md"
|
|
9793
9919
|
},
|
|
9794
9920
|
nonRoot: {
|
|
9795
|
-
relativeDirPath: (0,
|
|
9921
|
+
relativeDirPath: (0, import_node_path83.join)(".github", "instructions")
|
|
9796
9922
|
}
|
|
9797
9923
|
};
|
|
9798
9924
|
}
|
|
@@ -9801,7 +9927,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9801
9927
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9802
9928
|
if (!result.success) {
|
|
9803
9929
|
throw new Error(
|
|
9804
|
-
`Invalid frontmatter in ${(0,
|
|
9930
|
+
`Invalid frontmatter in ${(0, import_node_path83.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9805
9931
|
);
|
|
9806
9932
|
}
|
|
9807
9933
|
}
|
|
@@ -9883,11 +10009,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9883
10009
|
validate = true
|
|
9884
10010
|
}) {
|
|
9885
10011
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
9886
|
-
const relativePath = isRoot ? (0,
|
|
10012
|
+
const relativePath = isRoot ? (0, import_node_path83.join)(
|
|
9887
10013
|
this.getSettablePaths().root.relativeDirPath,
|
|
9888
10014
|
this.getSettablePaths().root.relativeFilePath
|
|
9889
|
-
) : (0,
|
|
9890
|
-
const fileContent = await readFileContent((0,
|
|
10015
|
+
) : (0, import_node_path83.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10016
|
+
const fileContent = await readFileContent((0, import_node_path83.join)(baseDir, relativePath));
|
|
9891
10017
|
if (isRoot) {
|
|
9892
10018
|
return new _CopilotRule({
|
|
9893
10019
|
baseDir,
|
|
@@ -9903,7 +10029,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9903
10029
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9904
10030
|
if (!result.success) {
|
|
9905
10031
|
throw new Error(
|
|
9906
|
-
`Invalid frontmatter in ${(0,
|
|
10032
|
+
`Invalid frontmatter in ${(0, import_node_path83.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9907
10033
|
);
|
|
9908
10034
|
}
|
|
9909
10035
|
return new _CopilotRule({
|
|
@@ -9943,7 +10069,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9943
10069
|
return {
|
|
9944
10070
|
success: false,
|
|
9945
10071
|
error: new Error(
|
|
9946
|
-
`Invalid frontmatter in ${(0,
|
|
10072
|
+
`Invalid frontmatter in ${(0, import_node_path83.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9947
10073
|
)
|
|
9948
10074
|
};
|
|
9949
10075
|
}
|
|
@@ -9963,7 +10089,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9963
10089
|
};
|
|
9964
10090
|
|
|
9965
10091
|
// src/features/rules/cursor-rule.ts
|
|
9966
|
-
var
|
|
10092
|
+
var import_node_path84 = require("path");
|
|
9967
10093
|
var import_mini41 = require("zod/mini");
|
|
9968
10094
|
var CursorRuleFrontmatterSchema = import_mini41.z.object({
|
|
9969
10095
|
description: import_mini41.z.optional(import_mini41.z.string()),
|
|
@@ -9976,7 +10102,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9976
10102
|
static getSettablePaths() {
|
|
9977
10103
|
return {
|
|
9978
10104
|
nonRoot: {
|
|
9979
|
-
relativeDirPath: (0,
|
|
10105
|
+
relativeDirPath: (0, import_node_path84.join)(".cursor", "rules")
|
|
9980
10106
|
}
|
|
9981
10107
|
};
|
|
9982
10108
|
}
|
|
@@ -9985,7 +10111,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9985
10111
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9986
10112
|
if (!result.success) {
|
|
9987
10113
|
throw new Error(
|
|
9988
|
-
`Invalid frontmatter in ${(0,
|
|
10114
|
+
`Invalid frontmatter in ${(0, import_node_path84.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9989
10115
|
);
|
|
9990
10116
|
}
|
|
9991
10117
|
}
|
|
@@ -10102,19 +10228,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10102
10228
|
validate = true
|
|
10103
10229
|
}) {
|
|
10104
10230
|
const fileContent = await readFileContent(
|
|
10105
|
-
(0,
|
|
10231
|
+
(0, import_node_path84.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10106
10232
|
);
|
|
10107
10233
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
10108
10234
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10109
10235
|
if (!result.success) {
|
|
10110
10236
|
throw new Error(
|
|
10111
|
-
`Invalid frontmatter in ${(0,
|
|
10237
|
+
`Invalid frontmatter in ${(0, import_node_path84.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10112
10238
|
);
|
|
10113
10239
|
}
|
|
10114
10240
|
return new _CursorRule({
|
|
10115
10241
|
baseDir,
|
|
10116
10242
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
10117
|
-
relativeFilePath: (0,
|
|
10243
|
+
relativeFilePath: (0, import_node_path84.basename)(relativeFilePath),
|
|
10118
10244
|
frontmatter: result.data,
|
|
10119
10245
|
body: content.trim(),
|
|
10120
10246
|
validate
|
|
@@ -10145,7 +10271,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10145
10271
|
return {
|
|
10146
10272
|
success: false,
|
|
10147
10273
|
error: new Error(
|
|
10148
|
-
`Invalid frontmatter in ${(0,
|
|
10274
|
+
`Invalid frontmatter in ${(0, import_node_path84.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10149
10275
|
)
|
|
10150
10276
|
};
|
|
10151
10277
|
}
|
|
@@ -10165,7 +10291,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10165
10291
|
};
|
|
10166
10292
|
|
|
10167
10293
|
// src/features/rules/geminicli-rule.ts
|
|
10168
|
-
var
|
|
10294
|
+
var import_node_path85 = require("path");
|
|
10169
10295
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
10170
10296
|
static getSettablePaths({
|
|
10171
10297
|
global
|
|
@@ -10184,7 +10310,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10184
10310
|
relativeFilePath: "GEMINI.md"
|
|
10185
10311
|
},
|
|
10186
10312
|
nonRoot: {
|
|
10187
|
-
relativeDirPath: (0,
|
|
10313
|
+
relativeDirPath: (0, import_node_path85.join)(".gemini", "memories")
|
|
10188
10314
|
}
|
|
10189
10315
|
};
|
|
10190
10316
|
}
|
|
@@ -10199,7 +10325,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10199
10325
|
if (isRoot) {
|
|
10200
10326
|
const relativePath2 = paths.root.relativeFilePath;
|
|
10201
10327
|
const fileContent2 = await readFileContent(
|
|
10202
|
-
(0,
|
|
10328
|
+
(0, import_node_path85.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
10203
10329
|
);
|
|
10204
10330
|
return new _GeminiCliRule({
|
|
10205
10331
|
baseDir,
|
|
@@ -10213,8 +10339,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10213
10339
|
if (!paths.nonRoot) {
|
|
10214
10340
|
throw new Error("nonRoot path is not set");
|
|
10215
10341
|
}
|
|
10216
|
-
const relativePath = (0,
|
|
10217
|
-
const fileContent = await readFileContent((0,
|
|
10342
|
+
const relativePath = (0, import_node_path85.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10343
|
+
const fileContent = await readFileContent((0, import_node_path85.join)(baseDir, relativePath));
|
|
10218
10344
|
return new _GeminiCliRule({
|
|
10219
10345
|
baseDir,
|
|
10220
10346
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10273,7 +10399,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10273
10399
|
};
|
|
10274
10400
|
|
|
10275
10401
|
// src/features/rules/junie-rule.ts
|
|
10276
|
-
var
|
|
10402
|
+
var import_node_path86 = require("path");
|
|
10277
10403
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
10278
10404
|
static getSettablePaths() {
|
|
10279
10405
|
return {
|
|
@@ -10282,7 +10408,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10282
10408
|
relativeFilePath: "guidelines.md"
|
|
10283
10409
|
},
|
|
10284
10410
|
nonRoot: {
|
|
10285
|
-
relativeDirPath: (0,
|
|
10411
|
+
relativeDirPath: (0, import_node_path86.join)(".junie", "memories")
|
|
10286
10412
|
}
|
|
10287
10413
|
};
|
|
10288
10414
|
}
|
|
@@ -10292,8 +10418,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10292
10418
|
validate = true
|
|
10293
10419
|
}) {
|
|
10294
10420
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
10295
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
10296
|
-
const fileContent = await readFileContent((0,
|
|
10421
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path86.join)(".junie", "memories", relativeFilePath);
|
|
10422
|
+
const fileContent = await readFileContent((0, import_node_path86.join)(baseDir, relativePath));
|
|
10297
10423
|
return new _JunieRule({
|
|
10298
10424
|
baseDir,
|
|
10299
10425
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10348,12 +10474,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10348
10474
|
};
|
|
10349
10475
|
|
|
10350
10476
|
// src/features/rules/kilo-rule.ts
|
|
10351
|
-
var
|
|
10477
|
+
var import_node_path87 = require("path");
|
|
10352
10478
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
10353
10479
|
static getSettablePaths(_options = {}) {
|
|
10354
10480
|
return {
|
|
10355
10481
|
nonRoot: {
|
|
10356
|
-
relativeDirPath: (0,
|
|
10482
|
+
relativeDirPath: (0, import_node_path87.join)(".kilocode", "rules")
|
|
10357
10483
|
}
|
|
10358
10484
|
};
|
|
10359
10485
|
}
|
|
@@ -10363,7 +10489,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10363
10489
|
validate = true
|
|
10364
10490
|
}) {
|
|
10365
10491
|
const fileContent = await readFileContent(
|
|
10366
|
-
(0,
|
|
10492
|
+
(0, import_node_path87.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10367
10493
|
);
|
|
10368
10494
|
return new _KiloRule({
|
|
10369
10495
|
baseDir,
|
|
@@ -10415,12 +10541,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10415
10541
|
};
|
|
10416
10542
|
|
|
10417
10543
|
// src/features/rules/kiro-rule.ts
|
|
10418
|
-
var
|
|
10544
|
+
var import_node_path88 = require("path");
|
|
10419
10545
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
10420
10546
|
static getSettablePaths() {
|
|
10421
10547
|
return {
|
|
10422
10548
|
nonRoot: {
|
|
10423
|
-
relativeDirPath: (0,
|
|
10549
|
+
relativeDirPath: (0, import_node_path88.join)(".kiro", "steering")
|
|
10424
10550
|
}
|
|
10425
10551
|
};
|
|
10426
10552
|
}
|
|
@@ -10430,7 +10556,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10430
10556
|
validate = true
|
|
10431
10557
|
}) {
|
|
10432
10558
|
const fileContent = await readFileContent(
|
|
10433
|
-
(0,
|
|
10559
|
+
(0, import_node_path88.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10434
10560
|
);
|
|
10435
10561
|
return new _KiroRule({
|
|
10436
10562
|
baseDir,
|
|
@@ -10484,7 +10610,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10484
10610
|
};
|
|
10485
10611
|
|
|
10486
10612
|
// src/features/rules/opencode-rule.ts
|
|
10487
|
-
var
|
|
10613
|
+
var import_node_path89 = require("path");
|
|
10488
10614
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
10489
10615
|
static getSettablePaths() {
|
|
10490
10616
|
return {
|
|
@@ -10493,7 +10619,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10493
10619
|
relativeFilePath: "AGENTS.md"
|
|
10494
10620
|
},
|
|
10495
10621
|
nonRoot: {
|
|
10496
|
-
relativeDirPath: (0,
|
|
10622
|
+
relativeDirPath: (0, import_node_path89.join)(".opencode", "memories")
|
|
10497
10623
|
}
|
|
10498
10624
|
};
|
|
10499
10625
|
}
|
|
@@ -10503,8 +10629,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10503
10629
|
validate = true
|
|
10504
10630
|
}) {
|
|
10505
10631
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
10506
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
10507
|
-
const fileContent = await readFileContent((0,
|
|
10632
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path89.join)(".opencode", "memories", relativeFilePath);
|
|
10633
|
+
const fileContent = await readFileContent((0, import_node_path89.join)(baseDir, relativePath));
|
|
10508
10634
|
return new _OpenCodeRule({
|
|
10509
10635
|
baseDir,
|
|
10510
10636
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10559,7 +10685,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10559
10685
|
};
|
|
10560
10686
|
|
|
10561
10687
|
// src/features/rules/qwencode-rule.ts
|
|
10562
|
-
var
|
|
10688
|
+
var import_node_path90 = require("path");
|
|
10563
10689
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
10564
10690
|
static getSettablePaths() {
|
|
10565
10691
|
return {
|
|
@@ -10568,7 +10694,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10568
10694
|
relativeFilePath: "QWEN.md"
|
|
10569
10695
|
},
|
|
10570
10696
|
nonRoot: {
|
|
10571
|
-
relativeDirPath: (0,
|
|
10697
|
+
relativeDirPath: (0, import_node_path90.join)(".qwen", "memories")
|
|
10572
10698
|
}
|
|
10573
10699
|
};
|
|
10574
10700
|
}
|
|
@@ -10578,8 +10704,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10578
10704
|
validate = true
|
|
10579
10705
|
}) {
|
|
10580
10706
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
10581
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
10582
|
-
const fileContent = await readFileContent((0,
|
|
10707
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path90.join)(".qwen", "memories", relativeFilePath);
|
|
10708
|
+
const fileContent = await readFileContent((0, import_node_path90.join)(baseDir, relativePath));
|
|
10583
10709
|
return new _QwencodeRule({
|
|
10584
10710
|
baseDir,
|
|
10585
10711
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10630,13 +10756,101 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10630
10756
|
}
|
|
10631
10757
|
};
|
|
10632
10758
|
|
|
10759
|
+
// src/features/rules/replit-rule.ts
|
|
10760
|
+
var import_node_path91 = require("path");
|
|
10761
|
+
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
10762
|
+
static getSettablePaths() {
|
|
10763
|
+
return {
|
|
10764
|
+
root: {
|
|
10765
|
+
relativeDirPath: ".",
|
|
10766
|
+
relativeFilePath: "replit.md"
|
|
10767
|
+
}
|
|
10768
|
+
};
|
|
10769
|
+
}
|
|
10770
|
+
static async fromFile({
|
|
10771
|
+
baseDir = process.cwd(),
|
|
10772
|
+
relativeFilePath,
|
|
10773
|
+
validate = true
|
|
10774
|
+
}) {
|
|
10775
|
+
const paths = this.getSettablePaths();
|
|
10776
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
10777
|
+
if (!isRoot) {
|
|
10778
|
+
throw new Error("ReplitRule only supports root rules");
|
|
10779
|
+
}
|
|
10780
|
+
const relativePath = paths.root.relativeFilePath;
|
|
10781
|
+
const fileContent = await readFileContent(
|
|
10782
|
+
(0, import_node_path91.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
10783
|
+
);
|
|
10784
|
+
return new _ReplitRule({
|
|
10785
|
+
baseDir,
|
|
10786
|
+
relativeDirPath: paths.root.relativeDirPath,
|
|
10787
|
+
relativeFilePath: paths.root.relativeFilePath,
|
|
10788
|
+
fileContent,
|
|
10789
|
+
validate,
|
|
10790
|
+
root: true
|
|
10791
|
+
});
|
|
10792
|
+
}
|
|
10793
|
+
static fromRulesyncRule({
|
|
10794
|
+
baseDir = process.cwd(),
|
|
10795
|
+
rulesyncRule,
|
|
10796
|
+
validate = true
|
|
10797
|
+
}) {
|
|
10798
|
+
const paths = this.getSettablePaths();
|
|
10799
|
+
const isRoot = rulesyncRule.getFrontmatter().root ?? false;
|
|
10800
|
+
if (!isRoot) {
|
|
10801
|
+
throw new Error("ReplitRule only supports root rules");
|
|
10802
|
+
}
|
|
10803
|
+
return new _ReplitRule(
|
|
10804
|
+
this.buildToolRuleParamsDefault({
|
|
10805
|
+
baseDir,
|
|
10806
|
+
rulesyncRule,
|
|
10807
|
+
validate,
|
|
10808
|
+
rootPath: paths.root,
|
|
10809
|
+
nonRootPath: void 0
|
|
10810
|
+
})
|
|
10811
|
+
);
|
|
10812
|
+
}
|
|
10813
|
+
toRulesyncRule() {
|
|
10814
|
+
return this.toRulesyncRuleDefault();
|
|
10815
|
+
}
|
|
10816
|
+
validate() {
|
|
10817
|
+
return { success: true, error: null };
|
|
10818
|
+
}
|
|
10819
|
+
static forDeletion({
|
|
10820
|
+
baseDir = process.cwd(),
|
|
10821
|
+
relativeDirPath,
|
|
10822
|
+
relativeFilePath
|
|
10823
|
+
}) {
|
|
10824
|
+
const paths = this.getSettablePaths();
|
|
10825
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
10826
|
+
return new _ReplitRule({
|
|
10827
|
+
baseDir,
|
|
10828
|
+
relativeDirPath,
|
|
10829
|
+
relativeFilePath,
|
|
10830
|
+
fileContent: "",
|
|
10831
|
+
validate: false,
|
|
10832
|
+
root: isRoot
|
|
10833
|
+
});
|
|
10834
|
+
}
|
|
10835
|
+
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
10836
|
+
const isRoot = rulesyncRule.getFrontmatter().root ?? false;
|
|
10837
|
+
if (!isRoot) {
|
|
10838
|
+
return false;
|
|
10839
|
+
}
|
|
10840
|
+
return this.isTargetedByRulesyncRuleDefault({
|
|
10841
|
+
rulesyncRule,
|
|
10842
|
+
toolTarget: "replit"
|
|
10843
|
+
});
|
|
10844
|
+
}
|
|
10845
|
+
};
|
|
10846
|
+
|
|
10633
10847
|
// src/features/rules/roo-rule.ts
|
|
10634
|
-
var
|
|
10848
|
+
var import_node_path92 = require("path");
|
|
10635
10849
|
var RooRule = class _RooRule extends ToolRule {
|
|
10636
10850
|
static getSettablePaths() {
|
|
10637
10851
|
return {
|
|
10638
10852
|
nonRoot: {
|
|
10639
|
-
relativeDirPath: (0,
|
|
10853
|
+
relativeDirPath: (0, import_node_path92.join)(".roo", "rules")
|
|
10640
10854
|
}
|
|
10641
10855
|
};
|
|
10642
10856
|
}
|
|
@@ -10646,7 +10860,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10646
10860
|
validate = true
|
|
10647
10861
|
}) {
|
|
10648
10862
|
const fileContent = await readFileContent(
|
|
10649
|
-
(0,
|
|
10863
|
+
(0, import_node_path92.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10650
10864
|
);
|
|
10651
10865
|
return new _RooRule({
|
|
10652
10866
|
baseDir,
|
|
@@ -10715,7 +10929,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10715
10929
|
};
|
|
10716
10930
|
|
|
10717
10931
|
// src/features/rules/warp-rule.ts
|
|
10718
|
-
var
|
|
10932
|
+
var import_node_path93 = require("path");
|
|
10719
10933
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
10720
10934
|
constructor({ fileContent, root, ...rest }) {
|
|
10721
10935
|
super({
|
|
@@ -10731,7 +10945,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10731
10945
|
relativeFilePath: "WARP.md"
|
|
10732
10946
|
},
|
|
10733
10947
|
nonRoot: {
|
|
10734
|
-
relativeDirPath: (0,
|
|
10948
|
+
relativeDirPath: (0, import_node_path93.join)(".warp", "memories")
|
|
10735
10949
|
}
|
|
10736
10950
|
};
|
|
10737
10951
|
}
|
|
@@ -10741,8 +10955,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10741
10955
|
validate = true
|
|
10742
10956
|
}) {
|
|
10743
10957
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
10744
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
10745
|
-
const fileContent = await readFileContent((0,
|
|
10958
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path93.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10959
|
+
const fileContent = await readFileContent((0, import_node_path93.join)(baseDir, relativePath));
|
|
10746
10960
|
return new _WarpRule({
|
|
10747
10961
|
baseDir,
|
|
10748
10962
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -10797,12 +11011,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10797
11011
|
};
|
|
10798
11012
|
|
|
10799
11013
|
// src/features/rules/windsurf-rule.ts
|
|
10800
|
-
var
|
|
11014
|
+
var import_node_path94 = require("path");
|
|
10801
11015
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
10802
11016
|
static getSettablePaths() {
|
|
10803
11017
|
return {
|
|
10804
11018
|
nonRoot: {
|
|
10805
|
-
relativeDirPath: (0,
|
|
11019
|
+
relativeDirPath: (0, import_node_path94.join)(".windsurf", "rules")
|
|
10806
11020
|
}
|
|
10807
11021
|
};
|
|
10808
11022
|
}
|
|
@@ -10812,7 +11026,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
10812
11026
|
validate = true
|
|
10813
11027
|
}) {
|
|
10814
11028
|
const fileContent = await readFileContent(
|
|
10815
|
-
(0,
|
|
11029
|
+
(0, import_node_path94.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10816
11030
|
);
|
|
10817
11031
|
return new _WindsurfRule({
|
|
10818
11032
|
baseDir,
|
|
@@ -10881,6 +11095,7 @@ var rulesProcessorToolTargets = [
|
|
|
10881
11095
|
"kiro",
|
|
10882
11096
|
"opencode",
|
|
10883
11097
|
"qwencode",
|
|
11098
|
+
"replit",
|
|
10884
11099
|
"roo",
|
|
10885
11100
|
"warp",
|
|
10886
11101
|
"windsurf"
|
|
@@ -11035,6 +11250,13 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
11035
11250
|
meta: { extension: "md", supportsGlobal: false, ruleDiscoveryMode: "toon" }
|
|
11036
11251
|
}
|
|
11037
11252
|
],
|
|
11253
|
+
[
|
|
11254
|
+
"replit",
|
|
11255
|
+
{
|
|
11256
|
+
class: ReplitRule,
|
|
11257
|
+
meta: { extension: "md", supportsGlobal: false, ruleDiscoveryMode: "auto" }
|
|
11258
|
+
}
|
|
11259
|
+
],
|
|
11038
11260
|
[
|
|
11039
11261
|
"roo",
|
|
11040
11262
|
{
|
|
@@ -11169,7 +11391,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11169
11391
|
}).relativeDirPath;
|
|
11170
11392
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
11171
11393
|
const frontmatter = skill.getFrontmatter();
|
|
11172
|
-
const relativePath = (0,
|
|
11394
|
+
const relativePath = (0, import_node_path95.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
11173
11395
|
return {
|
|
11174
11396
|
name: frontmatter.name,
|
|
11175
11397
|
description: frontmatter.description,
|
|
@@ -11236,10 +11458,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11236
11458
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
11237
11459
|
*/
|
|
11238
11460
|
async loadRulesyncFiles() {
|
|
11239
|
-
const files = await findFilesByGlobs((0,
|
|
11461
|
+
const files = await findFilesByGlobs((0, import_node_path95.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
11240
11462
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
11241
11463
|
const rulesyncRules = await Promise.all(
|
|
11242
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0,
|
|
11464
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path95.basename)(file) }))
|
|
11243
11465
|
);
|
|
11244
11466
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
11245
11467
|
if (rootRules.length > 1) {
|
|
@@ -11257,10 +11479,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11257
11479
|
return rulesyncRules;
|
|
11258
11480
|
}
|
|
11259
11481
|
async loadRulesyncFilesLegacy() {
|
|
11260
|
-
const legacyFiles = await findFilesByGlobs((0,
|
|
11482
|
+
const legacyFiles = await findFilesByGlobs((0, import_node_path95.join)(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
11261
11483
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
11262
11484
|
return Promise.all(
|
|
11263
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0,
|
|
11485
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path95.basename)(file) }))
|
|
11264
11486
|
);
|
|
11265
11487
|
}
|
|
11266
11488
|
/**
|
|
@@ -11278,7 +11500,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11278
11500
|
return [];
|
|
11279
11501
|
}
|
|
11280
11502
|
const rootFilePaths = await findFilesByGlobs(
|
|
11281
|
-
(0,
|
|
11503
|
+
(0, import_node_path95.join)(
|
|
11282
11504
|
this.baseDir,
|
|
11283
11505
|
settablePaths.root.relativeDirPath ?? ".",
|
|
11284
11506
|
settablePaths.root.relativeFilePath
|
|
@@ -11289,7 +11511,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11289
11511
|
(filePath) => factory.class.forDeletion({
|
|
11290
11512
|
baseDir: this.baseDir,
|
|
11291
11513
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
11292
|
-
relativeFilePath: (0,
|
|
11514
|
+
relativeFilePath: (0, import_node_path95.basename)(filePath),
|
|
11293
11515
|
global: this.global
|
|
11294
11516
|
})
|
|
11295
11517
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11298,7 +11520,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11298
11520
|
rootFilePaths.map(
|
|
11299
11521
|
(filePath) => factory.class.fromFile({
|
|
11300
11522
|
baseDir: this.baseDir,
|
|
11301
|
-
relativeFilePath: (0,
|
|
11523
|
+
relativeFilePath: (0, import_node_path95.basename)(filePath),
|
|
11302
11524
|
global: this.global
|
|
11303
11525
|
})
|
|
11304
11526
|
)
|
|
@@ -11310,14 +11532,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11310
11532
|
return [];
|
|
11311
11533
|
}
|
|
11312
11534
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
11313
|
-
(0,
|
|
11535
|
+
(0, import_node_path95.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
11314
11536
|
);
|
|
11315
11537
|
if (forDeletion) {
|
|
11316
11538
|
return nonRootFilePaths.map(
|
|
11317
11539
|
(filePath) => factory.class.forDeletion({
|
|
11318
11540
|
baseDir: this.baseDir,
|
|
11319
11541
|
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
11320
|
-
relativeFilePath: (0,
|
|
11542
|
+
relativeFilePath: (0, import_node_path95.basename)(filePath),
|
|
11321
11543
|
global: this.global
|
|
11322
11544
|
})
|
|
11323
11545
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11326,7 +11548,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11326
11548
|
nonRootFilePaths.map(
|
|
11327
11549
|
(filePath) => factory.class.fromFile({
|
|
11328
11550
|
baseDir: this.baseDir,
|
|
11329
|
-
relativeFilePath: (0,
|
|
11551
|
+
relativeFilePath: (0, import_node_path95.basename)(filePath),
|
|
11330
11552
|
global: this.global
|
|
11331
11553
|
})
|
|
11332
11554
|
)
|
|
@@ -11419,14 +11641,14 @@ s/<command> [arguments]
|
|
|
11419
11641
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
11420
11642
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
11421
11643
|
|
|
11422
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
11644
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path95.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
11423
11645
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
11424
11646
|
|
|
11425
11647
|
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.
|
|
11426
11648
|
|
|
11427
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
11649
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path95.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
11428
11650
|
|
|
11429
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
11651
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path95.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
11430
11652
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
11431
11653
|
const result = [
|
|
11432
11654
|
overview,
|
|
@@ -11708,7 +11930,7 @@ async function generateSkills(config) {
|
|
|
11708
11930
|
}
|
|
11709
11931
|
|
|
11710
11932
|
// src/cli/commands/gitignore.ts
|
|
11711
|
-
var
|
|
11933
|
+
var import_node_path96 = require("path");
|
|
11712
11934
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
11713
11935
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
11714
11936
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -11771,6 +11993,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11771
11993
|
"**/.kilocodeignore",
|
|
11772
11994
|
// Kiro
|
|
11773
11995
|
"**/.kiro/steering/",
|
|
11996
|
+
"**/.kiro/prompts/",
|
|
11774
11997
|
"**/.kiro/settings/mcp.json",
|
|
11775
11998
|
"**/.aiignore",
|
|
11776
11999
|
// OpenCode
|
|
@@ -11781,6 +12004,8 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11781
12004
|
// Qwen
|
|
11782
12005
|
"**/QWEN.md",
|
|
11783
12006
|
"**/.qwen/memories/",
|
|
12007
|
+
// Replit
|
|
12008
|
+
"**/replit.md",
|
|
11784
12009
|
// Roo
|
|
11785
12010
|
"**/.roo/rules/",
|
|
11786
12011
|
"**/.roo/skills/",
|
|
@@ -11844,7 +12069,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
11844
12069
|
return result;
|
|
11845
12070
|
};
|
|
11846
12071
|
var gitignoreCommand = async () => {
|
|
11847
|
-
const gitignorePath = (0,
|
|
12072
|
+
const gitignorePath = (0, import_node_path96.join)(process.cwd(), ".gitignore");
|
|
11848
12073
|
let gitignoreContent = "";
|
|
11849
12074
|
if (await fileExists(gitignorePath)) {
|
|
11850
12075
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -12043,7 +12268,7 @@ async function importSkills(config, tool) {
|
|
|
12043
12268
|
}
|
|
12044
12269
|
|
|
12045
12270
|
// src/cli/commands/init.ts
|
|
12046
|
-
var
|
|
12271
|
+
var import_node_path97 = require("path");
|
|
12047
12272
|
async function initCommand() {
|
|
12048
12273
|
logger.info("Initializing rulesync...");
|
|
12049
12274
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -12221,14 +12446,14 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12221
12446
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
12222
12447
|
await ensureDir(skillPaths.relativeDirPath);
|
|
12223
12448
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
12224
|
-
const ruleFilepath = (0,
|
|
12449
|
+
const ruleFilepath = (0, import_node_path97.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
12225
12450
|
if (!await fileExists(ruleFilepath)) {
|
|
12226
12451
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
12227
12452
|
logger.success(`Created ${ruleFilepath}`);
|
|
12228
12453
|
} else {
|
|
12229
12454
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
12230
12455
|
}
|
|
12231
|
-
const mcpFilepath = (0,
|
|
12456
|
+
const mcpFilepath = (0, import_node_path97.join)(
|
|
12232
12457
|
mcpPaths.recommended.relativeDirPath,
|
|
12233
12458
|
mcpPaths.recommended.relativeFilePath
|
|
12234
12459
|
);
|
|
@@ -12238,30 +12463,30 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12238
12463
|
} else {
|
|
12239
12464
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
12240
12465
|
}
|
|
12241
|
-
const commandFilepath = (0,
|
|
12466
|
+
const commandFilepath = (0, import_node_path97.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
12242
12467
|
if (!await fileExists(commandFilepath)) {
|
|
12243
12468
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
12244
12469
|
logger.success(`Created ${commandFilepath}`);
|
|
12245
12470
|
} else {
|
|
12246
12471
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
12247
12472
|
}
|
|
12248
|
-
const subagentFilepath = (0,
|
|
12473
|
+
const subagentFilepath = (0, import_node_path97.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
12249
12474
|
if (!await fileExists(subagentFilepath)) {
|
|
12250
12475
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
12251
12476
|
logger.success(`Created ${subagentFilepath}`);
|
|
12252
12477
|
} else {
|
|
12253
12478
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
12254
12479
|
}
|
|
12255
|
-
const skillDirPath = (0,
|
|
12480
|
+
const skillDirPath = (0, import_node_path97.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
12256
12481
|
await ensureDir(skillDirPath);
|
|
12257
|
-
const skillFilepath = (0,
|
|
12482
|
+
const skillFilepath = (0, import_node_path97.join)(skillDirPath, SKILL_FILE_NAME);
|
|
12258
12483
|
if (!await fileExists(skillFilepath)) {
|
|
12259
12484
|
await writeFileContent(skillFilepath, sampleSkillFile.content);
|
|
12260
12485
|
logger.success(`Created ${skillFilepath}`);
|
|
12261
12486
|
} else {
|
|
12262
12487
|
logger.info(`Skipped ${skillFilepath} (already exists)`);
|
|
12263
12488
|
}
|
|
12264
|
-
const ignoreFilepath = (0,
|
|
12489
|
+
const ignoreFilepath = (0, import_node_path97.join)(
|
|
12265
12490
|
ignorePaths.recommended.relativeDirPath,
|
|
12266
12491
|
ignorePaths.recommended.relativeFilePath
|
|
12267
12492
|
);
|
|
@@ -12280,12 +12505,12 @@ var import_fastmcp = require("fastmcp");
|
|
|
12280
12505
|
var import_mini49 = require("zod/mini");
|
|
12281
12506
|
|
|
12282
12507
|
// src/mcp/commands.ts
|
|
12283
|
-
var
|
|
12508
|
+
var import_node_path98 = require("path");
|
|
12284
12509
|
var import_mini43 = require("zod/mini");
|
|
12285
12510
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
12286
12511
|
var maxCommandsCount = 1e3;
|
|
12287
12512
|
async function listCommands() {
|
|
12288
|
-
const commandsDir = (0,
|
|
12513
|
+
const commandsDir = (0, import_node_path98.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12289
12514
|
try {
|
|
12290
12515
|
const files = await listDirectoryFiles(commandsDir);
|
|
12291
12516
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12297,7 +12522,7 @@ async function listCommands() {
|
|
|
12297
12522
|
});
|
|
12298
12523
|
const frontmatter = command.getFrontmatter();
|
|
12299
12524
|
return {
|
|
12300
|
-
relativePathFromCwd: (0,
|
|
12525
|
+
relativePathFromCwd: (0, import_node_path98.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
12301
12526
|
frontmatter
|
|
12302
12527
|
};
|
|
12303
12528
|
} catch (error) {
|
|
@@ -12317,13 +12542,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
12317
12542
|
relativePath: relativePathFromCwd,
|
|
12318
12543
|
intendedRootDir: process.cwd()
|
|
12319
12544
|
});
|
|
12320
|
-
const filename = (0,
|
|
12545
|
+
const filename = (0, import_node_path98.basename)(relativePathFromCwd);
|
|
12321
12546
|
try {
|
|
12322
12547
|
const command = await RulesyncCommand.fromFile({
|
|
12323
12548
|
relativeFilePath: filename
|
|
12324
12549
|
});
|
|
12325
12550
|
return {
|
|
12326
|
-
relativePathFromCwd: (0,
|
|
12551
|
+
relativePathFromCwd: (0, import_node_path98.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12327
12552
|
frontmatter: command.getFrontmatter(),
|
|
12328
12553
|
body: command.getBody()
|
|
12329
12554
|
};
|
|
@@ -12342,7 +12567,7 @@ async function putCommand({
|
|
|
12342
12567
|
relativePath: relativePathFromCwd,
|
|
12343
12568
|
intendedRootDir: process.cwd()
|
|
12344
12569
|
});
|
|
12345
|
-
const filename = (0,
|
|
12570
|
+
const filename = (0, import_node_path98.basename)(relativePathFromCwd);
|
|
12346
12571
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12347
12572
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
12348
12573
|
throw new Error(
|
|
@@ -12352,7 +12577,7 @@ async function putCommand({
|
|
|
12352
12577
|
try {
|
|
12353
12578
|
const existingCommands = await listCommands();
|
|
12354
12579
|
const isUpdate = existingCommands.some(
|
|
12355
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
12580
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path98.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12356
12581
|
);
|
|
12357
12582
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
12358
12583
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -12367,11 +12592,11 @@ async function putCommand({
|
|
|
12367
12592
|
fileContent,
|
|
12368
12593
|
validate: true
|
|
12369
12594
|
});
|
|
12370
|
-
const commandsDir = (0,
|
|
12595
|
+
const commandsDir = (0, import_node_path98.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12371
12596
|
await ensureDir(commandsDir);
|
|
12372
12597
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
12373
12598
|
return {
|
|
12374
|
-
relativePathFromCwd: (0,
|
|
12599
|
+
relativePathFromCwd: (0, import_node_path98.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12375
12600
|
frontmatter: command.getFrontmatter(),
|
|
12376
12601
|
body: command.getBody()
|
|
12377
12602
|
};
|
|
@@ -12386,12 +12611,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12386
12611
|
relativePath: relativePathFromCwd,
|
|
12387
12612
|
intendedRootDir: process.cwd()
|
|
12388
12613
|
});
|
|
12389
|
-
const filename = (0,
|
|
12390
|
-
const fullPath = (0,
|
|
12614
|
+
const filename = (0, import_node_path98.basename)(relativePathFromCwd);
|
|
12615
|
+
const fullPath = (0, import_node_path98.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
12391
12616
|
try {
|
|
12392
12617
|
await removeFile(fullPath);
|
|
12393
12618
|
return {
|
|
12394
|
-
relativePathFromCwd: (0,
|
|
12619
|
+
relativePathFromCwd: (0, import_node_path98.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12395
12620
|
};
|
|
12396
12621
|
} catch (error) {
|
|
12397
12622
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12416,7 +12641,7 @@ var commandToolSchemas = {
|
|
|
12416
12641
|
var commandTools = {
|
|
12417
12642
|
listCommands: {
|
|
12418
12643
|
name: "listCommands",
|
|
12419
|
-
description: `List all commands from ${(0,
|
|
12644
|
+
description: `List all commands from ${(0, import_node_path98.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12420
12645
|
parameters: commandToolSchemas.listCommands,
|
|
12421
12646
|
execute: async () => {
|
|
12422
12647
|
const commands = await listCommands();
|
|
@@ -12458,11 +12683,11 @@ var commandTools = {
|
|
|
12458
12683
|
};
|
|
12459
12684
|
|
|
12460
12685
|
// src/mcp/ignore.ts
|
|
12461
|
-
var
|
|
12686
|
+
var import_node_path99 = require("path");
|
|
12462
12687
|
var import_mini44 = require("zod/mini");
|
|
12463
12688
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
12464
12689
|
async function getIgnoreFile() {
|
|
12465
|
-
const ignoreFilePath = (0,
|
|
12690
|
+
const ignoreFilePath = (0, import_node_path99.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12466
12691
|
try {
|
|
12467
12692
|
const content = await readFileContent(ignoreFilePath);
|
|
12468
12693
|
return {
|
|
@@ -12476,7 +12701,7 @@ async function getIgnoreFile() {
|
|
|
12476
12701
|
}
|
|
12477
12702
|
}
|
|
12478
12703
|
async function putIgnoreFile({ content }) {
|
|
12479
|
-
const ignoreFilePath = (0,
|
|
12704
|
+
const ignoreFilePath = (0, import_node_path99.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12480
12705
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
12481
12706
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
12482
12707
|
throw new Error(
|
|
@@ -12497,8 +12722,8 @@ async function putIgnoreFile({ content }) {
|
|
|
12497
12722
|
}
|
|
12498
12723
|
}
|
|
12499
12724
|
async function deleteIgnoreFile() {
|
|
12500
|
-
const aiignorePath = (0,
|
|
12501
|
-
const legacyIgnorePath = (0,
|
|
12725
|
+
const aiignorePath = (0, import_node_path99.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12726
|
+
const legacyIgnorePath = (0, import_node_path99.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
12502
12727
|
try {
|
|
12503
12728
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
12504
12729
|
return {
|
|
@@ -12553,7 +12778,7 @@ var ignoreTools = {
|
|
|
12553
12778
|
};
|
|
12554
12779
|
|
|
12555
12780
|
// src/mcp/mcp.ts
|
|
12556
|
-
var
|
|
12781
|
+
var import_node_path100 = require("path");
|
|
12557
12782
|
var import_mini45 = require("zod/mini");
|
|
12558
12783
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
12559
12784
|
async function getMcpFile() {
|
|
@@ -12563,7 +12788,7 @@ async function getMcpFile() {
|
|
|
12563
12788
|
validate: true,
|
|
12564
12789
|
modularMcp: config.getModularMcp()
|
|
12565
12790
|
});
|
|
12566
|
-
const relativePathFromCwd = (0,
|
|
12791
|
+
const relativePathFromCwd = (0, import_node_path100.join)(
|
|
12567
12792
|
rulesyncMcp.getRelativeDirPath(),
|
|
12568
12793
|
rulesyncMcp.getRelativeFilePath()
|
|
12569
12794
|
);
|
|
@@ -12596,7 +12821,7 @@ async function putMcpFile({ content }) {
|
|
|
12596
12821
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12597
12822
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
12598
12823
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
12599
|
-
const fullPath = (0,
|
|
12824
|
+
const fullPath = (0, import_node_path100.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
12600
12825
|
const rulesyncMcp = new RulesyncMcp({
|
|
12601
12826
|
baseDir,
|
|
12602
12827
|
relativeDirPath,
|
|
@@ -12605,9 +12830,9 @@ async function putMcpFile({ content }) {
|
|
|
12605
12830
|
validate: true,
|
|
12606
12831
|
modularMcp: config.getModularMcp()
|
|
12607
12832
|
});
|
|
12608
|
-
await ensureDir((0,
|
|
12833
|
+
await ensureDir((0, import_node_path100.join)(baseDir, relativeDirPath));
|
|
12609
12834
|
await writeFileContent(fullPath, content);
|
|
12610
|
-
const relativePathFromCwd = (0,
|
|
12835
|
+
const relativePathFromCwd = (0, import_node_path100.join)(relativeDirPath, relativeFilePath);
|
|
12611
12836
|
return {
|
|
12612
12837
|
relativePathFromCwd,
|
|
12613
12838
|
content: rulesyncMcp.getFileContent()
|
|
@@ -12622,15 +12847,15 @@ async function deleteMcpFile() {
|
|
|
12622
12847
|
try {
|
|
12623
12848
|
const baseDir = process.cwd();
|
|
12624
12849
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12625
|
-
const recommendedPath = (0,
|
|
12850
|
+
const recommendedPath = (0, import_node_path100.join)(
|
|
12626
12851
|
baseDir,
|
|
12627
12852
|
paths.recommended.relativeDirPath,
|
|
12628
12853
|
paths.recommended.relativeFilePath
|
|
12629
12854
|
);
|
|
12630
|
-
const legacyPath = (0,
|
|
12855
|
+
const legacyPath = (0, import_node_path100.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
12631
12856
|
await removeFile(recommendedPath);
|
|
12632
12857
|
await removeFile(legacyPath);
|
|
12633
|
-
const relativePathFromCwd = (0,
|
|
12858
|
+
const relativePathFromCwd = (0, import_node_path100.join)(
|
|
12634
12859
|
paths.recommended.relativeDirPath,
|
|
12635
12860
|
paths.recommended.relativeFilePath
|
|
12636
12861
|
);
|
|
@@ -12681,12 +12906,12 @@ var mcpTools = {
|
|
|
12681
12906
|
};
|
|
12682
12907
|
|
|
12683
12908
|
// src/mcp/rules.ts
|
|
12684
|
-
var
|
|
12909
|
+
var import_node_path101 = require("path");
|
|
12685
12910
|
var import_mini46 = require("zod/mini");
|
|
12686
12911
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
12687
12912
|
var maxRulesCount = 1e3;
|
|
12688
12913
|
async function listRules() {
|
|
12689
|
-
const rulesDir = (0,
|
|
12914
|
+
const rulesDir = (0, import_node_path101.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12690
12915
|
try {
|
|
12691
12916
|
const files = await listDirectoryFiles(rulesDir);
|
|
12692
12917
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12699,7 +12924,7 @@ async function listRules() {
|
|
|
12699
12924
|
});
|
|
12700
12925
|
const frontmatter = rule.getFrontmatter();
|
|
12701
12926
|
return {
|
|
12702
|
-
relativePathFromCwd: (0,
|
|
12927
|
+
relativePathFromCwd: (0, import_node_path101.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
12703
12928
|
frontmatter
|
|
12704
12929
|
};
|
|
12705
12930
|
} catch (error) {
|
|
@@ -12719,14 +12944,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
12719
12944
|
relativePath: relativePathFromCwd,
|
|
12720
12945
|
intendedRootDir: process.cwd()
|
|
12721
12946
|
});
|
|
12722
|
-
const filename = (0,
|
|
12947
|
+
const filename = (0, import_node_path101.basename)(relativePathFromCwd);
|
|
12723
12948
|
try {
|
|
12724
12949
|
const rule = await RulesyncRule.fromFile({
|
|
12725
12950
|
relativeFilePath: filename,
|
|
12726
12951
|
validate: true
|
|
12727
12952
|
});
|
|
12728
12953
|
return {
|
|
12729
|
-
relativePathFromCwd: (0,
|
|
12954
|
+
relativePathFromCwd: (0, import_node_path101.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12730
12955
|
frontmatter: rule.getFrontmatter(),
|
|
12731
12956
|
body: rule.getBody()
|
|
12732
12957
|
};
|
|
@@ -12745,7 +12970,7 @@ async function putRule({
|
|
|
12745
12970
|
relativePath: relativePathFromCwd,
|
|
12746
12971
|
intendedRootDir: process.cwd()
|
|
12747
12972
|
});
|
|
12748
|
-
const filename = (0,
|
|
12973
|
+
const filename = (0, import_node_path101.basename)(relativePathFromCwd);
|
|
12749
12974
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12750
12975
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
12751
12976
|
throw new Error(
|
|
@@ -12755,7 +12980,7 @@ async function putRule({
|
|
|
12755
12980
|
try {
|
|
12756
12981
|
const existingRules = await listRules();
|
|
12757
12982
|
const isUpdate = existingRules.some(
|
|
12758
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
12983
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path101.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12759
12984
|
);
|
|
12760
12985
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
12761
12986
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -12768,11 +12993,11 @@ async function putRule({
|
|
|
12768
12993
|
body,
|
|
12769
12994
|
validate: true
|
|
12770
12995
|
});
|
|
12771
|
-
const rulesDir = (0,
|
|
12996
|
+
const rulesDir = (0, import_node_path101.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12772
12997
|
await ensureDir(rulesDir);
|
|
12773
12998
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
12774
12999
|
return {
|
|
12775
|
-
relativePathFromCwd: (0,
|
|
13000
|
+
relativePathFromCwd: (0, import_node_path101.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12776
13001
|
frontmatter: rule.getFrontmatter(),
|
|
12777
13002
|
body: rule.getBody()
|
|
12778
13003
|
};
|
|
@@ -12787,12 +13012,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
12787
13012
|
relativePath: relativePathFromCwd,
|
|
12788
13013
|
intendedRootDir: process.cwd()
|
|
12789
13014
|
});
|
|
12790
|
-
const filename = (0,
|
|
12791
|
-
const fullPath = (0,
|
|
13015
|
+
const filename = (0, import_node_path101.basename)(relativePathFromCwd);
|
|
13016
|
+
const fullPath = (0, import_node_path101.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
12792
13017
|
try {
|
|
12793
13018
|
await removeFile(fullPath);
|
|
12794
13019
|
return {
|
|
12795
|
-
relativePathFromCwd: (0,
|
|
13020
|
+
relativePathFromCwd: (0, import_node_path101.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12796
13021
|
};
|
|
12797
13022
|
} catch (error) {
|
|
12798
13023
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12817,7 +13042,7 @@ var ruleToolSchemas = {
|
|
|
12817
13042
|
var ruleTools = {
|
|
12818
13043
|
listRules: {
|
|
12819
13044
|
name: "listRules",
|
|
12820
|
-
description: `List all rules from ${(0,
|
|
13045
|
+
description: `List all rules from ${(0, import_node_path101.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12821
13046
|
parameters: ruleToolSchemas.listRules,
|
|
12822
13047
|
execute: async () => {
|
|
12823
13048
|
const rules = await listRules();
|
|
@@ -12859,7 +13084,7 @@ var ruleTools = {
|
|
|
12859
13084
|
};
|
|
12860
13085
|
|
|
12861
13086
|
// src/mcp/skills.ts
|
|
12862
|
-
var
|
|
13087
|
+
var import_node_path102 = require("path");
|
|
12863
13088
|
var import_mini47 = require("zod/mini");
|
|
12864
13089
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
12865
13090
|
var maxSkillsCount = 1e3;
|
|
@@ -12876,19 +13101,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
12876
13101
|
};
|
|
12877
13102
|
}
|
|
12878
13103
|
function extractDirName(relativeDirPathFromCwd) {
|
|
12879
|
-
const dirName = (0,
|
|
13104
|
+
const dirName = (0, import_node_path102.basename)(relativeDirPathFromCwd);
|
|
12880
13105
|
if (!dirName) {
|
|
12881
13106
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
12882
13107
|
}
|
|
12883
13108
|
return dirName;
|
|
12884
13109
|
}
|
|
12885
13110
|
async function listSkills() {
|
|
12886
|
-
const skillsDir = (0,
|
|
13111
|
+
const skillsDir = (0, import_node_path102.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
12887
13112
|
try {
|
|
12888
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
13113
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path102.join)(skillsDir, "*"), { type: "dir" });
|
|
12889
13114
|
const skills = await Promise.all(
|
|
12890
13115
|
skillDirPaths.map(async (dirPath) => {
|
|
12891
|
-
const dirName = (0,
|
|
13116
|
+
const dirName = (0, import_node_path102.basename)(dirPath);
|
|
12892
13117
|
if (!dirName) return null;
|
|
12893
13118
|
try {
|
|
12894
13119
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -12896,7 +13121,7 @@ async function listSkills() {
|
|
|
12896
13121
|
});
|
|
12897
13122
|
const frontmatter = skill.getFrontmatter();
|
|
12898
13123
|
return {
|
|
12899
|
-
relativeDirPathFromCwd: (0,
|
|
13124
|
+
relativeDirPathFromCwd: (0, import_node_path102.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12900
13125
|
frontmatter
|
|
12901
13126
|
};
|
|
12902
13127
|
} catch (error) {
|
|
@@ -12922,7 +13147,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
12922
13147
|
dirName
|
|
12923
13148
|
});
|
|
12924
13149
|
return {
|
|
12925
|
-
relativeDirPathFromCwd: (0,
|
|
13150
|
+
relativeDirPathFromCwd: (0, import_node_path102.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12926
13151
|
frontmatter: skill.getFrontmatter(),
|
|
12927
13152
|
body: skill.getBody(),
|
|
12928
13153
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12956,7 +13181,7 @@ async function putSkill({
|
|
|
12956
13181
|
try {
|
|
12957
13182
|
const existingSkills = await listSkills();
|
|
12958
13183
|
const isUpdate = existingSkills.some(
|
|
12959
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
13184
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path102.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12960
13185
|
);
|
|
12961
13186
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
12962
13187
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -12971,9 +13196,9 @@ async function putSkill({
|
|
|
12971
13196
|
otherFiles: aiDirFiles,
|
|
12972
13197
|
validate: true
|
|
12973
13198
|
});
|
|
12974
|
-
const skillDirPath = (0,
|
|
13199
|
+
const skillDirPath = (0, import_node_path102.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12975
13200
|
await ensureDir(skillDirPath);
|
|
12976
|
-
const skillFilePath = (0,
|
|
13201
|
+
const skillFilePath = (0, import_node_path102.join)(skillDirPath, SKILL_FILE_NAME);
|
|
12977
13202
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
12978
13203
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
12979
13204
|
for (const file of otherFiles) {
|
|
@@ -12981,15 +13206,15 @@ async function putSkill({
|
|
|
12981
13206
|
relativePath: file.name,
|
|
12982
13207
|
intendedRootDir: skillDirPath
|
|
12983
13208
|
});
|
|
12984
|
-
const filePath = (0,
|
|
12985
|
-
const fileDir = (0,
|
|
13209
|
+
const filePath = (0, import_node_path102.join)(skillDirPath, file.name);
|
|
13210
|
+
const fileDir = (0, import_node_path102.join)(skillDirPath, (0, import_node_path102.dirname)(file.name));
|
|
12986
13211
|
if (fileDir !== skillDirPath) {
|
|
12987
13212
|
await ensureDir(fileDir);
|
|
12988
13213
|
}
|
|
12989
13214
|
await writeFileContent(filePath, file.body);
|
|
12990
13215
|
}
|
|
12991
13216
|
return {
|
|
12992
|
-
relativeDirPathFromCwd: (0,
|
|
13217
|
+
relativeDirPathFromCwd: (0, import_node_path102.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12993
13218
|
frontmatter: skill.getFrontmatter(),
|
|
12994
13219
|
body: skill.getBody(),
|
|
12995
13220
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13011,13 +13236,13 @@ async function deleteSkill({
|
|
|
13011
13236
|
intendedRootDir: process.cwd()
|
|
13012
13237
|
});
|
|
13013
13238
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
13014
|
-
const skillDirPath = (0,
|
|
13239
|
+
const skillDirPath = (0, import_node_path102.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13015
13240
|
try {
|
|
13016
13241
|
if (await directoryExists(skillDirPath)) {
|
|
13017
13242
|
await removeDirectory(skillDirPath);
|
|
13018
13243
|
}
|
|
13019
13244
|
return {
|
|
13020
|
-
relativeDirPathFromCwd: (0,
|
|
13245
|
+
relativeDirPathFromCwd: (0, import_node_path102.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13021
13246
|
};
|
|
13022
13247
|
} catch (error) {
|
|
13023
13248
|
throw new Error(
|
|
@@ -13050,7 +13275,7 @@ var skillToolSchemas = {
|
|
|
13050
13275
|
var skillTools = {
|
|
13051
13276
|
listSkills: {
|
|
13052
13277
|
name: "listSkills",
|
|
13053
|
-
description: `List all skills from ${(0,
|
|
13278
|
+
description: `List all skills from ${(0, import_node_path102.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
13054
13279
|
parameters: skillToolSchemas.listSkills,
|
|
13055
13280
|
execute: async () => {
|
|
13056
13281
|
const skills = await listSkills();
|
|
@@ -13093,12 +13318,12 @@ var skillTools = {
|
|
|
13093
13318
|
};
|
|
13094
13319
|
|
|
13095
13320
|
// src/mcp/subagents.ts
|
|
13096
|
-
var
|
|
13321
|
+
var import_node_path103 = require("path");
|
|
13097
13322
|
var import_mini48 = require("zod/mini");
|
|
13098
13323
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
13099
13324
|
var maxSubagentsCount = 1e3;
|
|
13100
13325
|
async function listSubagents() {
|
|
13101
|
-
const subagentsDir = (0,
|
|
13326
|
+
const subagentsDir = (0, import_node_path103.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13102
13327
|
try {
|
|
13103
13328
|
const files = await listDirectoryFiles(subagentsDir);
|
|
13104
13329
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13111,7 +13336,7 @@ async function listSubagents() {
|
|
|
13111
13336
|
});
|
|
13112
13337
|
const frontmatter = subagent.getFrontmatter();
|
|
13113
13338
|
return {
|
|
13114
|
-
relativePathFromCwd: (0,
|
|
13339
|
+
relativePathFromCwd: (0, import_node_path103.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
13115
13340
|
frontmatter
|
|
13116
13341
|
};
|
|
13117
13342
|
} catch (error) {
|
|
@@ -13133,14 +13358,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
13133
13358
|
relativePath: relativePathFromCwd,
|
|
13134
13359
|
intendedRootDir: process.cwd()
|
|
13135
13360
|
});
|
|
13136
|
-
const filename = (0,
|
|
13361
|
+
const filename = (0, import_node_path103.basename)(relativePathFromCwd);
|
|
13137
13362
|
try {
|
|
13138
13363
|
const subagent = await RulesyncSubagent.fromFile({
|
|
13139
13364
|
relativeFilePath: filename,
|
|
13140
13365
|
validate: true
|
|
13141
13366
|
});
|
|
13142
13367
|
return {
|
|
13143
|
-
relativePathFromCwd: (0,
|
|
13368
|
+
relativePathFromCwd: (0, import_node_path103.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13144
13369
|
frontmatter: subagent.getFrontmatter(),
|
|
13145
13370
|
body: subagent.getBody()
|
|
13146
13371
|
};
|
|
@@ -13159,7 +13384,7 @@ async function putSubagent({
|
|
|
13159
13384
|
relativePath: relativePathFromCwd,
|
|
13160
13385
|
intendedRootDir: process.cwd()
|
|
13161
13386
|
});
|
|
13162
|
-
const filename = (0,
|
|
13387
|
+
const filename = (0, import_node_path103.basename)(relativePathFromCwd);
|
|
13163
13388
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
13164
13389
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
13165
13390
|
throw new Error(
|
|
@@ -13169,7 +13394,7 @@ async function putSubagent({
|
|
|
13169
13394
|
try {
|
|
13170
13395
|
const existingSubagents = await listSubagents();
|
|
13171
13396
|
const isUpdate = existingSubagents.some(
|
|
13172
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
13397
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path103.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13173
13398
|
);
|
|
13174
13399
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
13175
13400
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -13182,11 +13407,11 @@ async function putSubagent({
|
|
|
13182
13407
|
body,
|
|
13183
13408
|
validate: true
|
|
13184
13409
|
});
|
|
13185
|
-
const subagentsDir = (0,
|
|
13410
|
+
const subagentsDir = (0, import_node_path103.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13186
13411
|
await ensureDir(subagentsDir);
|
|
13187
13412
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
13188
13413
|
return {
|
|
13189
|
-
relativePathFromCwd: (0,
|
|
13414
|
+
relativePathFromCwd: (0, import_node_path103.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13190
13415
|
frontmatter: subagent.getFrontmatter(),
|
|
13191
13416
|
body: subagent.getBody()
|
|
13192
13417
|
};
|
|
@@ -13201,12 +13426,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
13201
13426
|
relativePath: relativePathFromCwd,
|
|
13202
13427
|
intendedRootDir: process.cwd()
|
|
13203
13428
|
});
|
|
13204
|
-
const filename = (0,
|
|
13205
|
-
const fullPath = (0,
|
|
13429
|
+
const filename = (0, import_node_path103.basename)(relativePathFromCwd);
|
|
13430
|
+
const fullPath = (0, import_node_path103.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
13206
13431
|
try {
|
|
13207
13432
|
await removeFile(fullPath);
|
|
13208
13433
|
return {
|
|
13209
|
-
relativePathFromCwd: (0,
|
|
13434
|
+
relativePathFromCwd: (0, import_node_path103.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13210
13435
|
};
|
|
13211
13436
|
} catch (error) {
|
|
13212
13437
|
throw new Error(
|
|
@@ -13234,7 +13459,7 @@ var subagentToolSchemas = {
|
|
|
13234
13459
|
var subagentTools = {
|
|
13235
13460
|
listSubagents: {
|
|
13236
13461
|
name: "listSubagents",
|
|
13237
|
-
description: `List all subagents from ${(0,
|
|
13462
|
+
description: `List all subagents from ${(0, import_node_path103.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13238
13463
|
parameters: subagentToolSchemas.listSubagents,
|
|
13239
13464
|
execute: async () => {
|
|
13240
13465
|
const subagents = await listSubagents();
|
|
@@ -13485,7 +13710,7 @@ async function mcpCommand({ version }) {
|
|
|
13485
13710
|
}
|
|
13486
13711
|
|
|
13487
13712
|
// src/cli/index.ts
|
|
13488
|
-
var getVersion = () => "5.
|
|
13713
|
+
var getVersion = () => "5.5.1";
|
|
13489
13714
|
var main = async () => {
|
|
13490
13715
|
const program = new import_commander.Command();
|
|
13491
13716
|
const version = getVersion();
|