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.js
CHANGED
|
@@ -87,7 +87,7 @@ import { resolve as resolve2 } from "path";
|
|
|
87
87
|
|
|
88
88
|
// src/utils/file.ts
|
|
89
89
|
import { kebabCase } from "es-toolkit";
|
|
90
|
-
import {
|
|
90
|
+
import { globbySync } from "globby";
|
|
91
91
|
import { mkdir, readdir, readFile, rm, stat, writeFile } from "fs/promises";
|
|
92
92
|
import os from "os";
|
|
93
93
|
import { dirname, join, relative, resolve } from "path";
|
|
@@ -170,17 +170,10 @@ async function listDirectoryFiles(dir) {
|
|
|
170
170
|
}
|
|
171
171
|
async function findFilesByGlobs(globs, options = {}) {
|
|
172
172
|
const { type = "all" } = options;
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
case "dir":
|
|
178
|
-
return items.filter((item) => item.isDirectory()).map((item) => join(item.parentPath, item.name));
|
|
179
|
-
case "all":
|
|
180
|
-
return items.map((item) => join(item.parentPath, item.name));
|
|
181
|
-
default:
|
|
182
|
-
throw new Error(`Invalid type: ${type}`);
|
|
183
|
-
}
|
|
173
|
+
const globbyOptions = type === "file" ? { onlyFiles: true, onlyDirectories: false } : type === "dir" ? { onlyFiles: false, onlyDirectories: true } : { onlyFiles: false, onlyDirectories: false };
|
|
174
|
+
const normalizedGlobs = Array.isArray(globs) ? globs.map((g) => g.replaceAll("\\", "/")) : globs.replaceAll("\\", "/");
|
|
175
|
+
const results = globbySync(normalizedGlobs, { absolute: true, ...globbyOptions });
|
|
176
|
+
return results.toSorted();
|
|
184
177
|
}
|
|
185
178
|
async function removeDirectory(dirPath) {
|
|
186
179
|
const dangerousPaths = [".", "/", "~", "src", "node_modules"];
|
|
@@ -248,6 +241,7 @@ var ALL_TOOL_TARGETS = [
|
|
|
248
241
|
"kiro",
|
|
249
242
|
"opencode",
|
|
250
243
|
"qwencode",
|
|
244
|
+
"replit",
|
|
251
245
|
"roo",
|
|
252
246
|
"warp",
|
|
253
247
|
"windsurf",
|
|
@@ -463,7 +457,7 @@ var RULESYNC_OVERVIEW_FILE_NAME = "overview.md";
|
|
|
463
457
|
var RULESYNC_SKILLS_RELATIVE_DIR_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "skills");
|
|
464
458
|
|
|
465
459
|
// src/features/commands/commands-processor.ts
|
|
466
|
-
import { basename as
|
|
460
|
+
import { basename as basename15, join as join17 } from "path";
|
|
467
461
|
import { z as z12 } from "zod/mini";
|
|
468
462
|
|
|
469
463
|
// src/types/feature-processor.ts
|
|
@@ -881,6 +875,11 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
881
875
|
import { basename as basename4, join as join6 } from "path";
|
|
882
876
|
import { z as z6 } from "zod/mini";
|
|
883
877
|
|
|
878
|
+
// src/utils/type-guards.ts
|
|
879
|
+
function isRecord(value) {
|
|
880
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
881
|
+
}
|
|
882
|
+
|
|
884
883
|
// src/features/commands/rulesync-command.ts
|
|
885
884
|
import { basename as basename3, join as join5 } from "path";
|
|
886
885
|
import { z as z5 } from "zod/mini";
|
|
@@ -973,8 +972,14 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
973
972
|
};
|
|
974
973
|
|
|
975
974
|
// src/features/commands/antigravity-command.ts
|
|
976
|
-
var
|
|
977
|
-
|
|
975
|
+
var AntigravityWorkflowFrontmatterSchema = z6.looseObject({
|
|
976
|
+
trigger: z6.optional(z6.string()),
|
|
977
|
+
turbo: z6.optional(z6.boolean())
|
|
978
|
+
});
|
|
979
|
+
var AntigravityCommandFrontmatterSchema = z6.looseObject({
|
|
980
|
+
description: z6.string(),
|
|
981
|
+
// Support for workflow-specific configuration
|
|
982
|
+
...AntigravityWorkflowFrontmatterSchema.shape
|
|
978
983
|
});
|
|
979
984
|
var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
980
985
|
frontmatter;
|
|
@@ -1007,9 +1012,12 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1007
1012
|
return this.frontmatter;
|
|
1008
1013
|
}
|
|
1009
1014
|
toRulesyncCommand() {
|
|
1015
|
+
const { description, ...restFields } = this.frontmatter;
|
|
1010
1016
|
const rulesyncFrontmatter = {
|
|
1011
1017
|
targets: ["antigravity"],
|
|
1012
|
-
description
|
|
1018
|
+
description,
|
|
1019
|
+
// Preserve extra fields in antigravity section
|
|
1020
|
+
...Object.keys(restFields).length > 0 && { antigravity: restFields }
|
|
1013
1021
|
};
|
|
1014
1022
|
const fileContent = stringifyFrontmatter(this.body, rulesyncFrontmatter);
|
|
1015
1023
|
return new RulesyncCommand({
|
|
@@ -1023,27 +1031,56 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1023
1031
|
validate: true
|
|
1024
1032
|
});
|
|
1025
1033
|
}
|
|
1034
|
+
static extractAntigravityConfig(rulesyncCommand) {
|
|
1035
|
+
const antigravity = rulesyncCommand.getFrontmatter().antigravity;
|
|
1036
|
+
return isRecord(antigravity) ? antigravity : void 0;
|
|
1037
|
+
}
|
|
1026
1038
|
static fromRulesyncCommand({
|
|
1027
1039
|
baseDir = process.cwd(),
|
|
1028
1040
|
rulesyncCommand,
|
|
1029
1041
|
validate = true
|
|
1030
1042
|
}) {
|
|
1031
1043
|
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
1044
|
+
const antigravityConfig = this.extractAntigravityConfig(rulesyncCommand);
|
|
1045
|
+
const trigger = this.resolveTrigger(rulesyncCommand, antigravityConfig);
|
|
1046
|
+
const turbo = typeof antigravityConfig?.turbo === "boolean" ? antigravityConfig.turbo : true;
|
|
1047
|
+
let relativeFilePath = rulesyncCommand.getRelativeFilePath();
|
|
1048
|
+
let body = rulesyncCommand.getBody().replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, "").trim();
|
|
1049
|
+
const sanitizedTrigger = trigger.replace(/[^a-zA-Z0-9-_]/g, "-").replace(/^-+|-+$/g, "");
|
|
1050
|
+
if (!sanitizedTrigger) {
|
|
1051
|
+
throw new Error(`Invalid trigger: sanitization resulted in empty string from "${trigger}"`);
|
|
1052
|
+
}
|
|
1053
|
+
const validFilename = sanitizedTrigger + ".md";
|
|
1054
|
+
relativeFilePath = validFilename;
|
|
1055
|
+
const turboDirective = turbo ? "\n\n// turbo" : "";
|
|
1056
|
+
body = `# Workflow: ${trigger}
|
|
1057
|
+
|
|
1058
|
+
${body}${turboDirective}`;
|
|
1059
|
+
const description = rulesyncFrontmatter.description;
|
|
1032
1060
|
const antigravityFrontmatter = {
|
|
1033
|
-
description
|
|
1061
|
+
description,
|
|
1062
|
+
trigger,
|
|
1063
|
+
turbo
|
|
1034
1064
|
};
|
|
1035
|
-
const body = rulesyncCommand.getBody();
|
|
1036
1065
|
const fileContent = stringifyFrontmatter(body, antigravityFrontmatter);
|
|
1037
1066
|
return new _AntigravityCommand({
|
|
1038
1067
|
baseDir,
|
|
1039
1068
|
frontmatter: antigravityFrontmatter,
|
|
1040
1069
|
body,
|
|
1041
1070
|
relativeDirPath: _AntigravityCommand.getSettablePaths().relativeDirPath,
|
|
1042
|
-
relativeFilePath
|
|
1071
|
+
relativeFilePath,
|
|
1043
1072
|
fileContent,
|
|
1044
1073
|
validate
|
|
1045
1074
|
});
|
|
1046
1075
|
}
|
|
1076
|
+
static resolveTrigger(rulesyncCommand, antigravityConfig) {
|
|
1077
|
+
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
1078
|
+
const antigravityTrigger = antigravityConfig && typeof antigravityConfig.trigger === "string" ? antigravityConfig.trigger : void 0;
|
|
1079
|
+
const rootTrigger = typeof rulesyncFrontmatter.trigger === "string" ? rulesyncFrontmatter.trigger : void 0;
|
|
1080
|
+
const bodyTriggerMatch = rulesyncCommand.getBody().match(/trigger:\s*(\/[\w-]+)/);
|
|
1081
|
+
const filenameTrigger = `/${basename4(rulesyncCommand.getRelativeFilePath(), ".md")}`;
|
|
1082
|
+
return antigravityTrigger || rootTrigger || (bodyTriggerMatch ? bodyTriggerMatch[1] : void 0) || filenameTrigger;
|
|
1083
|
+
}
|
|
1047
1084
|
validate() {
|
|
1048
1085
|
if (!this.frontmatter) {
|
|
1049
1086
|
return { success: true, error: null };
|
|
@@ -1876,8 +1913,89 @@ var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
|
1876
1913
|
}
|
|
1877
1914
|
};
|
|
1878
1915
|
|
|
1879
|
-
// src/features/commands/
|
|
1916
|
+
// src/features/commands/kiro-command.ts
|
|
1880
1917
|
import { basename as basename12, join as join14 } from "path";
|
|
1918
|
+
var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
1919
|
+
static getSettablePaths(_options = {}) {
|
|
1920
|
+
return {
|
|
1921
|
+
relativeDirPath: join14(".kiro", "prompts")
|
|
1922
|
+
};
|
|
1923
|
+
}
|
|
1924
|
+
toRulesyncCommand() {
|
|
1925
|
+
const rulesyncFrontmatter = {
|
|
1926
|
+
targets: ["*"],
|
|
1927
|
+
description: ""
|
|
1928
|
+
};
|
|
1929
|
+
return new RulesyncCommand({
|
|
1930
|
+
baseDir: process.cwd(),
|
|
1931
|
+
frontmatter: rulesyncFrontmatter,
|
|
1932
|
+
body: this.getFileContent(),
|
|
1933
|
+
relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
1934
|
+
relativeFilePath: this.relativeFilePath,
|
|
1935
|
+
fileContent: this.getFileContent(),
|
|
1936
|
+
validate: true
|
|
1937
|
+
});
|
|
1938
|
+
}
|
|
1939
|
+
static fromRulesyncCommand({
|
|
1940
|
+
baseDir = process.cwd(),
|
|
1941
|
+
rulesyncCommand,
|
|
1942
|
+
validate = true
|
|
1943
|
+
}) {
|
|
1944
|
+
const paths = this.getSettablePaths();
|
|
1945
|
+
return new _KiroCommand({
|
|
1946
|
+
baseDir,
|
|
1947
|
+
fileContent: rulesyncCommand.getBody(),
|
|
1948
|
+
relativeDirPath: paths.relativeDirPath,
|
|
1949
|
+
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
1950
|
+
validate
|
|
1951
|
+
});
|
|
1952
|
+
}
|
|
1953
|
+
validate() {
|
|
1954
|
+
return { success: true, error: null };
|
|
1955
|
+
}
|
|
1956
|
+
getBody() {
|
|
1957
|
+
return this.getFileContent();
|
|
1958
|
+
}
|
|
1959
|
+
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
1960
|
+
return this.isTargetedByRulesyncCommandDefault({
|
|
1961
|
+
rulesyncCommand,
|
|
1962
|
+
toolTarget: "kiro"
|
|
1963
|
+
});
|
|
1964
|
+
}
|
|
1965
|
+
static async fromFile({
|
|
1966
|
+
baseDir = process.cwd(),
|
|
1967
|
+
relativeFilePath,
|
|
1968
|
+
validate = true
|
|
1969
|
+
}) {
|
|
1970
|
+
const paths = this.getSettablePaths();
|
|
1971
|
+
const filePath = join14(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1972
|
+
const fileContent = await readFileContent(filePath);
|
|
1973
|
+
const { body: content } = parseFrontmatter(fileContent);
|
|
1974
|
+
return new _KiroCommand({
|
|
1975
|
+
baseDir,
|
|
1976
|
+
relativeDirPath: paths.relativeDirPath,
|
|
1977
|
+
relativeFilePath: basename12(relativeFilePath),
|
|
1978
|
+
fileContent: content.trim(),
|
|
1979
|
+
validate
|
|
1980
|
+
});
|
|
1981
|
+
}
|
|
1982
|
+
static forDeletion({
|
|
1983
|
+
baseDir = process.cwd(),
|
|
1984
|
+
relativeDirPath,
|
|
1985
|
+
relativeFilePath
|
|
1986
|
+
}) {
|
|
1987
|
+
return new _KiroCommand({
|
|
1988
|
+
baseDir,
|
|
1989
|
+
relativeDirPath,
|
|
1990
|
+
relativeFilePath,
|
|
1991
|
+
fileContent: "",
|
|
1992
|
+
validate: false
|
|
1993
|
+
});
|
|
1994
|
+
}
|
|
1995
|
+
};
|
|
1996
|
+
|
|
1997
|
+
// src/features/commands/opencode-command.ts
|
|
1998
|
+
import { basename as basename13, join as join15 } from "path";
|
|
1881
1999
|
import { optional as optional2, z as z10 } from "zod/mini";
|
|
1882
2000
|
var OpenCodeCommandFrontmatterSchema = z10.looseObject({
|
|
1883
2001
|
description: z10.string(),
|
|
@@ -1893,7 +2011,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1893
2011
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1894
2012
|
if (!result.success) {
|
|
1895
2013
|
throw new Error(
|
|
1896
|
-
`Invalid frontmatter in ${
|
|
2014
|
+
`Invalid frontmatter in ${join15(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1897
2015
|
);
|
|
1898
2016
|
}
|
|
1899
2017
|
}
|
|
@@ -1906,7 +2024,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1906
2024
|
}
|
|
1907
2025
|
static getSettablePaths({ global } = {}) {
|
|
1908
2026
|
return {
|
|
1909
|
-
relativeDirPath: global ?
|
|
2027
|
+
relativeDirPath: global ? join15(".config", "opencode", "command") : join15(".opencode", "command")
|
|
1910
2028
|
};
|
|
1911
2029
|
}
|
|
1912
2030
|
getBody() {
|
|
@@ -1967,7 +2085,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1967
2085
|
return {
|
|
1968
2086
|
success: false,
|
|
1969
2087
|
error: new Error(
|
|
1970
|
-
`Invalid frontmatter in ${
|
|
2088
|
+
`Invalid frontmatter in ${join15(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1971
2089
|
)
|
|
1972
2090
|
};
|
|
1973
2091
|
}
|
|
@@ -1978,7 +2096,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1978
2096
|
global = false
|
|
1979
2097
|
}) {
|
|
1980
2098
|
const paths = this.getSettablePaths({ global });
|
|
1981
|
-
const filePath =
|
|
2099
|
+
const filePath = join15(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1982
2100
|
const fileContent = await readFileContent(filePath);
|
|
1983
2101
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1984
2102
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1988,7 +2106,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1988
2106
|
return new _OpenCodeCommand({
|
|
1989
2107
|
baseDir,
|
|
1990
2108
|
relativeDirPath: paths.relativeDirPath,
|
|
1991
|
-
relativeFilePath:
|
|
2109
|
+
relativeFilePath: basename13(relativeFilePath),
|
|
1992
2110
|
frontmatter: result.data,
|
|
1993
2111
|
body: content.trim(),
|
|
1994
2112
|
validate
|
|
@@ -2017,7 +2135,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2017
2135
|
};
|
|
2018
2136
|
|
|
2019
2137
|
// src/features/commands/roo-command.ts
|
|
2020
|
-
import { basename as
|
|
2138
|
+
import { basename as basename14, join as join16 } from "path";
|
|
2021
2139
|
import { optional as optional3, z as z11 } from "zod/mini";
|
|
2022
2140
|
var RooCommandFrontmatterSchema = z11.looseObject({
|
|
2023
2141
|
description: z11.string(),
|
|
@@ -2028,7 +2146,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2028
2146
|
body;
|
|
2029
2147
|
static getSettablePaths() {
|
|
2030
2148
|
return {
|
|
2031
|
-
relativeDirPath:
|
|
2149
|
+
relativeDirPath: join16(".roo", "commands")
|
|
2032
2150
|
};
|
|
2033
2151
|
}
|
|
2034
2152
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -2036,7 +2154,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2036
2154
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2037
2155
|
if (!result.success) {
|
|
2038
2156
|
throw new Error(
|
|
2039
|
-
`Invalid frontmatter in ${
|
|
2157
|
+
`Invalid frontmatter in ${join16(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
2040
2158
|
);
|
|
2041
2159
|
}
|
|
2042
2160
|
}
|
|
@@ -2107,7 +2225,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2107
2225
|
return {
|
|
2108
2226
|
success: false,
|
|
2109
2227
|
error: new Error(
|
|
2110
|
-
`Invalid frontmatter in ${
|
|
2228
|
+
`Invalid frontmatter in ${join16(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
2111
2229
|
)
|
|
2112
2230
|
};
|
|
2113
2231
|
}
|
|
@@ -2123,7 +2241,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2123
2241
|
relativeFilePath,
|
|
2124
2242
|
validate = true
|
|
2125
2243
|
}) {
|
|
2126
|
-
const filePath =
|
|
2244
|
+
const filePath = join16(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
2127
2245
|
const fileContent = await readFileContent(filePath);
|
|
2128
2246
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2129
2247
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2133,7 +2251,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2133
2251
|
return new _RooCommand({
|
|
2134
2252
|
baseDir,
|
|
2135
2253
|
relativeDirPath: _RooCommand.getSettablePaths().relativeDirPath,
|
|
2136
|
-
relativeFilePath:
|
|
2254
|
+
relativeFilePath: basename14(relativeFilePath),
|
|
2137
2255
|
frontmatter: result.data,
|
|
2138
2256
|
body: content.trim(),
|
|
2139
2257
|
fileContent,
|
|
@@ -2169,6 +2287,7 @@ var commandsProcessorToolTargetTuple = [
|
|
|
2169
2287
|
"cursor",
|
|
2170
2288
|
"geminicli",
|
|
2171
2289
|
"kilo",
|
|
2290
|
+
"kiro",
|
|
2172
2291
|
"opencode",
|
|
2173
2292
|
"roo"
|
|
2174
2293
|
];
|
|
@@ -2249,6 +2368,13 @@ var toolCommandFactories = /* @__PURE__ */ new Map([
|
|
|
2249
2368
|
meta: { extension: "md", supportsProject: true, supportsGlobal: true, isSimulated: false }
|
|
2250
2369
|
}
|
|
2251
2370
|
],
|
|
2371
|
+
[
|
|
2372
|
+
"kiro",
|
|
2373
|
+
{
|
|
2374
|
+
class: KiroCommand,
|
|
2375
|
+
meta: { extension: "md", supportsProject: true, supportsGlobal: false, isSimulated: false }
|
|
2376
|
+
}
|
|
2377
|
+
],
|
|
2252
2378
|
[
|
|
2253
2379
|
"opencode",
|
|
2254
2380
|
{
|
|
@@ -2339,11 +2465,11 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2339
2465
|
*/
|
|
2340
2466
|
async loadRulesyncFiles() {
|
|
2341
2467
|
const rulesyncCommandPaths = await findFilesByGlobs(
|
|
2342
|
-
|
|
2468
|
+
join17(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
|
|
2343
2469
|
);
|
|
2344
2470
|
const rulesyncCommands = await Promise.all(
|
|
2345
2471
|
rulesyncCommandPaths.map(
|
|
2346
|
-
(path3) => RulesyncCommand.fromFile({ relativeFilePath:
|
|
2472
|
+
(path3) => RulesyncCommand.fromFile({ relativeFilePath: basename15(path3) })
|
|
2347
2473
|
)
|
|
2348
2474
|
);
|
|
2349
2475
|
logger.info(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
@@ -2359,14 +2485,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2359
2485
|
const factory = this.getFactory(this.toolTarget);
|
|
2360
2486
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
2361
2487
|
const commandFilePaths = await findFilesByGlobs(
|
|
2362
|
-
|
|
2488
|
+
join17(this.baseDir, paths.relativeDirPath, `*.${factory.meta.extension}`)
|
|
2363
2489
|
);
|
|
2364
2490
|
if (forDeletion) {
|
|
2365
2491
|
const toolCommands2 = commandFilePaths.map(
|
|
2366
2492
|
(path3) => factory.class.forDeletion({
|
|
2367
2493
|
baseDir: this.baseDir,
|
|
2368
2494
|
relativeDirPath: paths.relativeDirPath,
|
|
2369
|
-
relativeFilePath:
|
|
2495
|
+
relativeFilePath: basename15(path3),
|
|
2370
2496
|
global: this.global
|
|
2371
2497
|
})
|
|
2372
2498
|
).filter((cmd) => cmd.isDeletable());
|
|
@@ -2377,7 +2503,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2377
2503
|
commandFilePaths.map(
|
|
2378
2504
|
(path3) => factory.class.fromFile({
|
|
2379
2505
|
baseDir: this.baseDir,
|
|
2380
|
-
relativeFilePath:
|
|
2506
|
+
relativeFilePath: basename15(path3),
|
|
2381
2507
|
global: this.global
|
|
2382
2508
|
})
|
|
2383
2509
|
)
|
|
@@ -2412,14 +2538,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2412
2538
|
import { z as z13 } from "zod/mini";
|
|
2413
2539
|
|
|
2414
2540
|
// src/features/ignore/augmentcode-ignore.ts
|
|
2415
|
-
import { join as
|
|
2541
|
+
import { join as join19 } from "path";
|
|
2416
2542
|
|
|
2417
2543
|
// src/types/tool-file.ts
|
|
2418
2544
|
var ToolFile = class extends AiFile {
|
|
2419
2545
|
};
|
|
2420
2546
|
|
|
2421
2547
|
// src/features/ignore/rulesync-ignore.ts
|
|
2422
|
-
import { join as
|
|
2548
|
+
import { join as join18 } from "path";
|
|
2423
2549
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
2424
2550
|
validate() {
|
|
2425
2551
|
return { success: true, error: null };
|
|
@@ -2439,12 +2565,12 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
2439
2565
|
static async fromFile() {
|
|
2440
2566
|
const baseDir = process.cwd();
|
|
2441
2567
|
const paths = this.getSettablePaths();
|
|
2442
|
-
const recommendedPath =
|
|
2568
|
+
const recommendedPath = join18(
|
|
2443
2569
|
baseDir,
|
|
2444
2570
|
paths.recommended.relativeDirPath,
|
|
2445
2571
|
paths.recommended.relativeFilePath
|
|
2446
2572
|
);
|
|
2447
|
-
const legacyPath =
|
|
2573
|
+
const legacyPath = join18(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
2448
2574
|
if (await fileExists(recommendedPath)) {
|
|
2449
2575
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
2450
2576
|
return new _RulesyncIgnore({
|
|
@@ -2560,7 +2686,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2560
2686
|
validate = true
|
|
2561
2687
|
}) {
|
|
2562
2688
|
const fileContent = await readFileContent(
|
|
2563
|
-
|
|
2689
|
+
join19(
|
|
2564
2690
|
baseDir,
|
|
2565
2691
|
this.getSettablePaths().relativeDirPath,
|
|
2566
2692
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2591,7 +2717,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2591
2717
|
|
|
2592
2718
|
// src/features/ignore/claudecode-ignore.ts
|
|
2593
2719
|
import { uniq } from "es-toolkit";
|
|
2594
|
-
import { join as
|
|
2720
|
+
import { join as join20 } from "path";
|
|
2595
2721
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
2596
2722
|
constructor(params) {
|
|
2597
2723
|
super(params);
|
|
@@ -2633,7 +2759,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2633
2759
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
2634
2760
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
2635
2761
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
2636
|
-
const filePath =
|
|
2762
|
+
const filePath = join20(
|
|
2637
2763
|
baseDir,
|
|
2638
2764
|
this.getSettablePaths().relativeDirPath,
|
|
2639
2765
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2669,7 +2795,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2669
2795
|
validate = true
|
|
2670
2796
|
}) {
|
|
2671
2797
|
const fileContent = await readFileContent(
|
|
2672
|
-
|
|
2798
|
+
join20(
|
|
2673
2799
|
baseDir,
|
|
2674
2800
|
this.getSettablePaths().relativeDirPath,
|
|
2675
2801
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2699,7 +2825,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2699
2825
|
};
|
|
2700
2826
|
|
|
2701
2827
|
// src/features/ignore/cline-ignore.ts
|
|
2702
|
-
import { join as
|
|
2828
|
+
import { join as join21 } from "path";
|
|
2703
2829
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
2704
2830
|
static getSettablePaths() {
|
|
2705
2831
|
return {
|
|
@@ -2736,7 +2862,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2736
2862
|
validate = true
|
|
2737
2863
|
}) {
|
|
2738
2864
|
const fileContent = await readFileContent(
|
|
2739
|
-
|
|
2865
|
+
join21(
|
|
2740
2866
|
baseDir,
|
|
2741
2867
|
this.getSettablePaths().relativeDirPath,
|
|
2742
2868
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2766,7 +2892,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2766
2892
|
};
|
|
2767
2893
|
|
|
2768
2894
|
// src/features/ignore/cursor-ignore.ts
|
|
2769
|
-
import { join as
|
|
2895
|
+
import { join as join22 } from "path";
|
|
2770
2896
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
2771
2897
|
static getSettablePaths() {
|
|
2772
2898
|
return {
|
|
@@ -2799,7 +2925,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2799
2925
|
validate = true
|
|
2800
2926
|
}) {
|
|
2801
2927
|
const fileContent = await readFileContent(
|
|
2802
|
-
|
|
2928
|
+
join22(
|
|
2803
2929
|
baseDir,
|
|
2804
2930
|
this.getSettablePaths().relativeDirPath,
|
|
2805
2931
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2829,7 +2955,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2829
2955
|
};
|
|
2830
2956
|
|
|
2831
2957
|
// src/features/ignore/geminicli-ignore.ts
|
|
2832
|
-
import { join as
|
|
2958
|
+
import { join as join23 } from "path";
|
|
2833
2959
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
2834
2960
|
static getSettablePaths() {
|
|
2835
2961
|
return {
|
|
@@ -2856,7 +2982,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2856
2982
|
validate = true
|
|
2857
2983
|
}) {
|
|
2858
2984
|
const fileContent = await readFileContent(
|
|
2859
|
-
|
|
2985
|
+
join23(
|
|
2860
2986
|
baseDir,
|
|
2861
2987
|
this.getSettablePaths().relativeDirPath,
|
|
2862
2988
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2886,7 +3012,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2886
3012
|
};
|
|
2887
3013
|
|
|
2888
3014
|
// src/features/ignore/junie-ignore.ts
|
|
2889
|
-
import { join as
|
|
3015
|
+
import { join as join24 } from "path";
|
|
2890
3016
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
2891
3017
|
static getSettablePaths() {
|
|
2892
3018
|
return {
|
|
@@ -2913,7 +3039,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2913
3039
|
validate = true
|
|
2914
3040
|
}) {
|
|
2915
3041
|
const fileContent = await readFileContent(
|
|
2916
|
-
|
|
3042
|
+
join24(
|
|
2917
3043
|
baseDir,
|
|
2918
3044
|
this.getSettablePaths().relativeDirPath,
|
|
2919
3045
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2943,7 +3069,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2943
3069
|
};
|
|
2944
3070
|
|
|
2945
3071
|
// src/features/ignore/kilo-ignore.ts
|
|
2946
|
-
import { join as
|
|
3072
|
+
import { join as join25 } from "path";
|
|
2947
3073
|
var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
2948
3074
|
static getSettablePaths() {
|
|
2949
3075
|
return {
|
|
@@ -2980,7 +3106,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
2980
3106
|
validate = true
|
|
2981
3107
|
}) {
|
|
2982
3108
|
const fileContent = await readFileContent(
|
|
2983
|
-
|
|
3109
|
+
join25(
|
|
2984
3110
|
baseDir,
|
|
2985
3111
|
this.getSettablePaths().relativeDirPath,
|
|
2986
3112
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3010,7 +3136,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
3010
3136
|
};
|
|
3011
3137
|
|
|
3012
3138
|
// src/features/ignore/kiro-ignore.ts
|
|
3013
|
-
import { join as
|
|
3139
|
+
import { join as join26 } from "path";
|
|
3014
3140
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
3015
3141
|
static getSettablePaths() {
|
|
3016
3142
|
return {
|
|
@@ -3037,7 +3163,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
3037
3163
|
validate = true
|
|
3038
3164
|
}) {
|
|
3039
3165
|
const fileContent = await readFileContent(
|
|
3040
|
-
|
|
3166
|
+
join26(
|
|
3041
3167
|
baseDir,
|
|
3042
3168
|
this.getSettablePaths().relativeDirPath,
|
|
3043
3169
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3067,7 +3193,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
3067
3193
|
};
|
|
3068
3194
|
|
|
3069
3195
|
// src/features/ignore/qwencode-ignore.ts
|
|
3070
|
-
import { join as
|
|
3196
|
+
import { join as join27 } from "path";
|
|
3071
3197
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
3072
3198
|
static getSettablePaths() {
|
|
3073
3199
|
return {
|
|
@@ -3094,7 +3220,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
3094
3220
|
validate = true
|
|
3095
3221
|
}) {
|
|
3096
3222
|
const fileContent = await readFileContent(
|
|
3097
|
-
|
|
3223
|
+
join27(
|
|
3098
3224
|
baseDir,
|
|
3099
3225
|
this.getSettablePaths().relativeDirPath,
|
|
3100
3226
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3124,7 +3250,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
3124
3250
|
};
|
|
3125
3251
|
|
|
3126
3252
|
// src/features/ignore/roo-ignore.ts
|
|
3127
|
-
import { join as
|
|
3253
|
+
import { join as join28 } from "path";
|
|
3128
3254
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
3129
3255
|
static getSettablePaths() {
|
|
3130
3256
|
return {
|
|
@@ -3151,7 +3277,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
3151
3277
|
validate = true
|
|
3152
3278
|
}) {
|
|
3153
3279
|
const fileContent = await readFileContent(
|
|
3154
|
-
|
|
3280
|
+
join28(
|
|
3155
3281
|
baseDir,
|
|
3156
3282
|
this.getSettablePaths().relativeDirPath,
|
|
3157
3283
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3181,7 +3307,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
3181
3307
|
};
|
|
3182
3308
|
|
|
3183
3309
|
// src/features/ignore/windsurf-ignore.ts
|
|
3184
|
-
import { join as
|
|
3310
|
+
import { join as join29 } from "path";
|
|
3185
3311
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
3186
3312
|
static getSettablePaths() {
|
|
3187
3313
|
return {
|
|
@@ -3208,7 +3334,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3208
3334
|
validate = true
|
|
3209
3335
|
}) {
|
|
3210
3336
|
const fileContent = await readFileContent(
|
|
3211
|
-
|
|
3337
|
+
join29(
|
|
3212
3338
|
baseDir,
|
|
3213
3339
|
this.getSettablePaths().relativeDirPath,
|
|
3214
3340
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3239,7 +3365,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3239
3365
|
|
|
3240
3366
|
// src/features/ignore/zed-ignore.ts
|
|
3241
3367
|
import { uniq as uniq2 } from "es-toolkit";
|
|
3242
|
-
import { join as
|
|
3368
|
+
import { join as join30 } from "path";
|
|
3243
3369
|
var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
3244
3370
|
constructor(params) {
|
|
3245
3371
|
super(params);
|
|
@@ -3275,7 +3401,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
3275
3401
|
}) {
|
|
3276
3402
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
3277
3403
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
3278
|
-
const filePath =
|
|
3404
|
+
const filePath = join30(
|
|
3279
3405
|
baseDir,
|
|
3280
3406
|
this.getSettablePaths().relativeDirPath,
|
|
3281
3407
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3302,7 +3428,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
3302
3428
|
validate = true
|
|
3303
3429
|
}) {
|
|
3304
3430
|
const fileContent = await readFileContent(
|
|
3305
|
-
|
|
3431
|
+
join30(
|
|
3306
3432
|
baseDir,
|
|
3307
3433
|
this.getSettablePaths().relativeDirPath,
|
|
3308
3434
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3484,10 +3610,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
3484
3610
|
import { z as z18 } from "zod/mini";
|
|
3485
3611
|
|
|
3486
3612
|
// src/features/mcp/claudecode-mcp.ts
|
|
3487
|
-
import { join as
|
|
3613
|
+
import { join as join33 } from "path";
|
|
3488
3614
|
|
|
3489
3615
|
// src/features/mcp/modular-mcp.ts
|
|
3490
|
-
import { join as
|
|
3616
|
+
import { join as join31 } from "path";
|
|
3491
3617
|
import { z as z15 } from "zod/mini";
|
|
3492
3618
|
|
|
3493
3619
|
// src/types/mcp.ts
|
|
@@ -3575,7 +3701,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3575
3701
|
args: [
|
|
3576
3702
|
"-y",
|
|
3577
3703
|
"@kimuson/modular-mcp",
|
|
3578
|
-
|
|
3704
|
+
join31(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3579
3705
|
],
|
|
3580
3706
|
env: {}
|
|
3581
3707
|
}
|
|
@@ -3613,7 +3739,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3613
3739
|
|
|
3614
3740
|
// src/features/mcp/rulesync-mcp.ts
|
|
3615
3741
|
import { omit } from "es-toolkit/object";
|
|
3616
|
-
import { join as
|
|
3742
|
+
import { join as join32 } from "path";
|
|
3617
3743
|
import { z as z16 } from "zod/mini";
|
|
3618
3744
|
var RulesyncMcpServerSchema = z16.union([
|
|
3619
3745
|
z16.extend(McpServerSchema, {
|
|
@@ -3669,12 +3795,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
3669
3795
|
}) {
|
|
3670
3796
|
const baseDir = process.cwd();
|
|
3671
3797
|
const paths = this.getSettablePaths();
|
|
3672
|
-
const recommendedPath =
|
|
3798
|
+
const recommendedPath = join32(
|
|
3673
3799
|
baseDir,
|
|
3674
3800
|
paths.recommended.relativeDirPath,
|
|
3675
3801
|
paths.recommended.relativeFilePath
|
|
3676
3802
|
);
|
|
3677
|
-
const legacyPath =
|
|
3803
|
+
const legacyPath = join32(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
3678
3804
|
if (await fileExists(recommendedPath)) {
|
|
3679
3805
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
3680
3806
|
return new _RulesyncMcp({
|
|
@@ -3818,7 +3944,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3818
3944
|
}) {
|
|
3819
3945
|
const paths = this.getSettablePaths({ global });
|
|
3820
3946
|
const fileContent = await readOrInitializeFileContent(
|
|
3821
|
-
|
|
3947
|
+
join33(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3822
3948
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3823
3949
|
);
|
|
3824
3950
|
const json = JSON.parse(fileContent);
|
|
@@ -3840,7 +3966,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3840
3966
|
}) {
|
|
3841
3967
|
const paths = this.getSettablePaths({ global });
|
|
3842
3968
|
const fileContent = await readOrInitializeFileContent(
|
|
3843
|
-
|
|
3969
|
+
join33(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3844
3970
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3845
3971
|
);
|
|
3846
3972
|
const json = JSON.parse(fileContent);
|
|
@@ -3888,7 +4014,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3888
4014
|
};
|
|
3889
4015
|
|
|
3890
4016
|
// src/features/mcp/cline-mcp.ts
|
|
3891
|
-
import { join as
|
|
4017
|
+
import { join as join34 } from "path";
|
|
3892
4018
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
3893
4019
|
json;
|
|
3894
4020
|
constructor(params) {
|
|
@@ -3909,7 +4035,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3909
4035
|
validate = true
|
|
3910
4036
|
}) {
|
|
3911
4037
|
const fileContent = await readFileContent(
|
|
3912
|
-
|
|
4038
|
+
join34(
|
|
3913
4039
|
baseDir,
|
|
3914
4040
|
this.getSettablePaths().relativeDirPath,
|
|
3915
4041
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3958,7 +4084,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3958
4084
|
};
|
|
3959
4085
|
|
|
3960
4086
|
// src/features/mcp/codexcli-mcp.ts
|
|
3961
|
-
import { join as
|
|
4087
|
+
import { join as join35 } from "path";
|
|
3962
4088
|
import * as smolToml from "smol-toml";
|
|
3963
4089
|
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
3964
4090
|
toml;
|
|
@@ -3994,7 +4120,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3994
4120
|
}) {
|
|
3995
4121
|
const paths = this.getSettablePaths({ global });
|
|
3996
4122
|
const fileContent = await readFileContent(
|
|
3997
|
-
|
|
4123
|
+
join35(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3998
4124
|
);
|
|
3999
4125
|
return new _CodexcliMcp({
|
|
4000
4126
|
baseDir,
|
|
@@ -4011,7 +4137,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4011
4137
|
global = false
|
|
4012
4138
|
}) {
|
|
4013
4139
|
const paths = this.getSettablePaths({ global });
|
|
4014
|
-
const configTomlFilePath =
|
|
4140
|
+
const configTomlFilePath = join35(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
4015
4141
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
4016
4142
|
configTomlFilePath,
|
|
4017
4143
|
smolToml.stringify({})
|
|
@@ -4065,7 +4191,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4065
4191
|
};
|
|
4066
4192
|
|
|
4067
4193
|
// src/features/mcp/copilot-mcp.ts
|
|
4068
|
-
import { join as
|
|
4194
|
+
import { join as join36 } from "path";
|
|
4069
4195
|
function convertToCopilotFormat(mcpServers) {
|
|
4070
4196
|
return { servers: mcpServers };
|
|
4071
4197
|
}
|
|
@@ -4092,7 +4218,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4092
4218
|
validate = true
|
|
4093
4219
|
}) {
|
|
4094
4220
|
const fileContent = await readFileContent(
|
|
4095
|
-
|
|
4221
|
+
join36(
|
|
4096
4222
|
baseDir,
|
|
4097
4223
|
this.getSettablePaths().relativeDirPath,
|
|
4098
4224
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4145,7 +4271,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4145
4271
|
};
|
|
4146
4272
|
|
|
4147
4273
|
// src/features/mcp/cursor-mcp.ts
|
|
4148
|
-
import { join as
|
|
4274
|
+
import { join as join37 } from "path";
|
|
4149
4275
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
4150
4276
|
json;
|
|
4151
4277
|
constructor(params) {
|
|
@@ -4166,7 +4292,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4166
4292
|
validate = true
|
|
4167
4293
|
}) {
|
|
4168
4294
|
const fileContent = await readFileContent(
|
|
4169
|
-
|
|
4295
|
+
join37(
|
|
4170
4296
|
baseDir,
|
|
4171
4297
|
this.getSettablePaths().relativeDirPath,
|
|
4172
4298
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4226,7 +4352,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4226
4352
|
};
|
|
4227
4353
|
|
|
4228
4354
|
// src/features/mcp/geminicli-mcp.ts
|
|
4229
|
-
import { join as
|
|
4355
|
+
import { join as join38 } from "path";
|
|
4230
4356
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
4231
4357
|
json;
|
|
4232
4358
|
constructor(params) {
|
|
@@ -4255,7 +4381,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4255
4381
|
}) {
|
|
4256
4382
|
const paths = this.getSettablePaths({ global });
|
|
4257
4383
|
const fileContent = await readOrInitializeFileContent(
|
|
4258
|
-
|
|
4384
|
+
join38(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4259
4385
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4260
4386
|
);
|
|
4261
4387
|
const json = JSON.parse(fileContent);
|
|
@@ -4276,7 +4402,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4276
4402
|
}) {
|
|
4277
4403
|
const paths = this.getSettablePaths({ global });
|
|
4278
4404
|
const fileContent = await readOrInitializeFileContent(
|
|
4279
|
-
|
|
4405
|
+
join38(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4280
4406
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4281
4407
|
);
|
|
4282
4408
|
const json = JSON.parse(fileContent);
|
|
@@ -4313,7 +4439,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4313
4439
|
};
|
|
4314
4440
|
|
|
4315
4441
|
// src/features/mcp/junie-mcp.ts
|
|
4316
|
-
import { join as
|
|
4442
|
+
import { join as join39 } from "path";
|
|
4317
4443
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
4318
4444
|
json;
|
|
4319
4445
|
constructor(params) {
|
|
@@ -4325,7 +4451,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4325
4451
|
}
|
|
4326
4452
|
static getSettablePaths() {
|
|
4327
4453
|
return {
|
|
4328
|
-
relativeDirPath:
|
|
4454
|
+
relativeDirPath: join39(".junie", "mcp"),
|
|
4329
4455
|
relativeFilePath: "mcp.json"
|
|
4330
4456
|
};
|
|
4331
4457
|
}
|
|
@@ -4334,7 +4460,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4334
4460
|
validate = true
|
|
4335
4461
|
}) {
|
|
4336
4462
|
const fileContent = await readFileContent(
|
|
4337
|
-
|
|
4463
|
+
join39(
|
|
4338
4464
|
baseDir,
|
|
4339
4465
|
this.getSettablePaths().relativeDirPath,
|
|
4340
4466
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4383,7 +4509,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4383
4509
|
};
|
|
4384
4510
|
|
|
4385
4511
|
// src/features/mcp/kilo-mcp.ts
|
|
4386
|
-
import { join as
|
|
4512
|
+
import { join as join40 } from "path";
|
|
4387
4513
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
4388
4514
|
json;
|
|
4389
4515
|
constructor(params) {
|
|
@@ -4405,7 +4531,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4405
4531
|
}) {
|
|
4406
4532
|
const paths = this.getSettablePaths();
|
|
4407
4533
|
const fileContent = await readOrInitializeFileContent(
|
|
4408
|
-
|
|
4534
|
+
join40(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4409
4535
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4410
4536
|
);
|
|
4411
4537
|
return new _KiloMcp({
|
|
@@ -4459,7 +4585,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4459
4585
|
};
|
|
4460
4586
|
|
|
4461
4587
|
// src/features/mcp/kiro-mcp.ts
|
|
4462
|
-
import { join as
|
|
4588
|
+
import { join as join41 } from "path";
|
|
4463
4589
|
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
4464
4590
|
json;
|
|
4465
4591
|
constructor(params) {
|
|
@@ -4471,7 +4597,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4471
4597
|
}
|
|
4472
4598
|
static getSettablePaths() {
|
|
4473
4599
|
return {
|
|
4474
|
-
relativeDirPath:
|
|
4600
|
+
relativeDirPath: join41(".kiro", "settings"),
|
|
4475
4601
|
relativeFilePath: "mcp.json"
|
|
4476
4602
|
};
|
|
4477
4603
|
}
|
|
@@ -4481,7 +4607,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4481
4607
|
}) {
|
|
4482
4608
|
const paths = this.getSettablePaths();
|
|
4483
4609
|
const fileContent = await readOrInitializeFileContent(
|
|
4484
|
-
|
|
4610
|
+
join41(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4485
4611
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4486
4612
|
);
|
|
4487
4613
|
return new _KiroMcp({
|
|
@@ -4535,7 +4661,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4535
4661
|
};
|
|
4536
4662
|
|
|
4537
4663
|
// src/features/mcp/opencode-mcp.ts
|
|
4538
|
-
import { join as
|
|
4664
|
+
import { join as join42 } from "path";
|
|
4539
4665
|
import { z as z17 } from "zod/mini";
|
|
4540
4666
|
var OpencodeMcpLocalServerSchema = z17.object({
|
|
4541
4667
|
type: z17.literal("local"),
|
|
@@ -4659,7 +4785,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4659
4785
|
}) {
|
|
4660
4786
|
const paths = this.getSettablePaths({ global });
|
|
4661
4787
|
const fileContent = await readOrInitializeFileContent(
|
|
4662
|
-
|
|
4788
|
+
join42(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4663
4789
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4664
4790
|
);
|
|
4665
4791
|
const json = JSON.parse(fileContent);
|
|
@@ -4680,7 +4806,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4680
4806
|
}) {
|
|
4681
4807
|
const paths = this.getSettablePaths({ global });
|
|
4682
4808
|
const fileContent = await readOrInitializeFileContent(
|
|
4683
|
-
|
|
4809
|
+
join42(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4684
4810
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4685
4811
|
);
|
|
4686
4812
|
const json = JSON.parse(fileContent);
|
|
@@ -4724,7 +4850,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4724
4850
|
};
|
|
4725
4851
|
|
|
4726
4852
|
// src/features/mcp/roo-mcp.ts
|
|
4727
|
-
import { join as
|
|
4853
|
+
import { join as join43 } from "path";
|
|
4728
4854
|
function isRooMcpServers(value) {
|
|
4729
4855
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
4730
4856
|
}
|
|
@@ -4776,7 +4902,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4776
4902
|
validate = true
|
|
4777
4903
|
}) {
|
|
4778
4904
|
const fileContent = await readFileContent(
|
|
4779
|
-
|
|
4905
|
+
join43(
|
|
4780
4906
|
baseDir,
|
|
4781
4907
|
this.getSettablePaths().relativeDirPath,
|
|
4782
4908
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5091,24 +5217,24 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
5091
5217
|
|
|
5092
5218
|
// src/features/rules/rules-processor.ts
|
|
5093
5219
|
import { encode } from "@toon-format/toon";
|
|
5094
|
-
import { basename as
|
|
5220
|
+
import { basename as basename24, join as join93 } from "path";
|
|
5095
5221
|
import { z as z42 } from "zod/mini";
|
|
5096
5222
|
|
|
5097
5223
|
// src/constants/general.ts
|
|
5098
5224
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
5099
5225
|
|
|
5100
5226
|
// src/features/skills/agentsmd-skill.ts
|
|
5101
|
-
import { join as
|
|
5227
|
+
import { join as join47 } from "path";
|
|
5102
5228
|
|
|
5103
5229
|
// src/features/skills/simulated-skill.ts
|
|
5104
|
-
import { join as
|
|
5230
|
+
import { join as join46 } from "path";
|
|
5105
5231
|
import { z as z19 } from "zod/mini";
|
|
5106
5232
|
|
|
5107
5233
|
// src/features/skills/tool-skill.ts
|
|
5108
|
-
import { join as
|
|
5234
|
+
import { join as join45 } from "path";
|
|
5109
5235
|
|
|
5110
5236
|
// src/types/ai-dir.ts
|
|
5111
|
-
import path2, { basename as
|
|
5237
|
+
import path2, { basename as basename16, join as join44, relative as relative3, resolve as resolve4 } from "path";
|
|
5112
5238
|
var AiDir = class {
|
|
5113
5239
|
/**
|
|
5114
5240
|
* @example "."
|
|
@@ -5202,10 +5328,10 @@ var AiDir = class {
|
|
|
5202
5328
|
* @returns Array of files with their relative paths and buffers
|
|
5203
5329
|
*/
|
|
5204
5330
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
5205
|
-
const dirPath =
|
|
5206
|
-
const glob =
|
|
5331
|
+
const dirPath = join44(baseDir, relativeDirPath, dirName);
|
|
5332
|
+
const glob = join44(dirPath, "**", "*");
|
|
5207
5333
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
5208
|
-
const filteredPaths = filePaths.filter((filePath) =>
|
|
5334
|
+
const filteredPaths = filePaths.filter((filePath) => basename16(filePath) !== excludeFileName);
|
|
5209
5335
|
const files = await Promise.all(
|
|
5210
5336
|
filteredPaths.map(async (filePath) => {
|
|
5211
5337
|
const fileBuffer = await readFileBuffer(filePath);
|
|
@@ -5301,8 +5427,8 @@ var ToolSkill = class extends AiDir {
|
|
|
5301
5427
|
}) {
|
|
5302
5428
|
const settablePaths = getSettablePaths({ global });
|
|
5303
5429
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5304
|
-
const skillDirPath =
|
|
5305
|
-
const skillFilePath =
|
|
5430
|
+
const skillDirPath = join45(baseDir, actualRelativeDirPath, dirName);
|
|
5431
|
+
const skillFilePath = join45(skillDirPath, SKILL_FILE_NAME);
|
|
5306
5432
|
if (!await fileExists(skillFilePath)) {
|
|
5307
5433
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5308
5434
|
}
|
|
@@ -5360,7 +5486,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5360
5486
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
5361
5487
|
if (!result.success) {
|
|
5362
5488
|
throw new Error(
|
|
5363
|
-
`Invalid frontmatter in ${
|
|
5489
|
+
`Invalid frontmatter in ${join46(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
5364
5490
|
);
|
|
5365
5491
|
}
|
|
5366
5492
|
}
|
|
@@ -5418,8 +5544,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5418
5544
|
}) {
|
|
5419
5545
|
const settablePaths = this.getSettablePaths();
|
|
5420
5546
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5421
|
-
const skillDirPath =
|
|
5422
|
-
const skillFilePath =
|
|
5547
|
+
const skillDirPath = join46(baseDir, actualRelativeDirPath, dirName);
|
|
5548
|
+
const skillFilePath = join46(skillDirPath, SKILL_FILE_NAME);
|
|
5423
5549
|
if (!await fileExists(skillFilePath)) {
|
|
5424
5550
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5425
5551
|
}
|
|
@@ -5496,7 +5622,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5496
5622
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
5497
5623
|
}
|
|
5498
5624
|
return {
|
|
5499
|
-
relativeDirPath:
|
|
5625
|
+
relativeDirPath: join47(".agents", "skills")
|
|
5500
5626
|
};
|
|
5501
5627
|
}
|
|
5502
5628
|
static async fromDir(params) {
|
|
@@ -5523,14 +5649,14 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5523
5649
|
};
|
|
5524
5650
|
|
|
5525
5651
|
// src/features/skills/geminicli-skill.ts
|
|
5526
|
-
import { join as
|
|
5652
|
+
import { join as join48 } from "path";
|
|
5527
5653
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5528
5654
|
static getSettablePaths(options) {
|
|
5529
5655
|
if (options?.global) {
|
|
5530
5656
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5531
5657
|
}
|
|
5532
5658
|
return {
|
|
5533
|
-
relativeDirPath:
|
|
5659
|
+
relativeDirPath: join48(".gemini", "skills")
|
|
5534
5660
|
};
|
|
5535
5661
|
}
|
|
5536
5662
|
static async fromDir(params) {
|
|
@@ -5557,11 +5683,11 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
|
5557
5683
|
};
|
|
5558
5684
|
|
|
5559
5685
|
// src/features/skills/skills-processor.ts
|
|
5560
|
-
import { basename as
|
|
5686
|
+
import { basename as basename17, join as join59 } from "path";
|
|
5561
5687
|
import { z as z29 } from "zod/mini";
|
|
5562
5688
|
|
|
5563
5689
|
// src/types/dir-feature-processor.ts
|
|
5564
|
-
import { join as
|
|
5690
|
+
import { join as join49 } from "path";
|
|
5565
5691
|
var DirFeatureProcessor = class {
|
|
5566
5692
|
baseDir;
|
|
5567
5693
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -5583,14 +5709,14 @@ var DirFeatureProcessor = class {
|
|
|
5583
5709
|
await ensureDir(dirPath);
|
|
5584
5710
|
const mainFile = aiDir.getMainFile();
|
|
5585
5711
|
if (mainFile) {
|
|
5586
|
-
const mainFilePath =
|
|
5712
|
+
const mainFilePath = join49(dirPath, mainFile.name);
|
|
5587
5713
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5588
5714
|
const contentWithNewline = addTrailingNewline(content);
|
|
5589
5715
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5590
5716
|
}
|
|
5591
5717
|
const otherFiles = aiDir.getOtherFiles();
|
|
5592
5718
|
for (const file of otherFiles) {
|
|
5593
|
-
const filePath =
|
|
5719
|
+
const filePath = join49(dirPath, file.relativeFilePathToDirPath);
|
|
5594
5720
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5595
5721
|
await writeFileContent(filePath, contentWithNewline);
|
|
5596
5722
|
}
|
|
@@ -5605,11 +5731,11 @@ var DirFeatureProcessor = class {
|
|
|
5605
5731
|
};
|
|
5606
5732
|
|
|
5607
5733
|
// src/features/skills/antigravity-skill.ts
|
|
5608
|
-
import { join as
|
|
5734
|
+
import { join as join51 } from "path";
|
|
5609
5735
|
import { z as z21 } from "zod/mini";
|
|
5610
5736
|
|
|
5611
5737
|
// src/features/skills/rulesync-skill.ts
|
|
5612
|
-
import { join as
|
|
5738
|
+
import { join as join50 } from "path";
|
|
5613
5739
|
import { z as z20 } from "zod/mini";
|
|
5614
5740
|
var RulesyncSkillFrontmatterSchemaInternal = z20.looseObject({
|
|
5615
5741
|
name: z20.string(),
|
|
@@ -5701,8 +5827,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5701
5827
|
dirName,
|
|
5702
5828
|
global = false
|
|
5703
5829
|
}) {
|
|
5704
|
-
const skillDirPath =
|
|
5705
|
-
const skillFilePath =
|
|
5830
|
+
const skillDirPath = join50(baseDir, relativeDirPath, dirName);
|
|
5831
|
+
const skillFilePath = join50(skillDirPath, SKILL_FILE_NAME);
|
|
5706
5832
|
if (!await fileExists(skillFilePath)) {
|
|
5707
5833
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5708
5834
|
}
|
|
@@ -5739,7 +5865,7 @@ var AntigravitySkillFrontmatterSchema = z21.looseObject({
|
|
|
5739
5865
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
5740
5866
|
constructor({
|
|
5741
5867
|
baseDir = process.cwd(),
|
|
5742
|
-
relativeDirPath =
|
|
5868
|
+
relativeDirPath = join51(".agent", "skills"),
|
|
5743
5869
|
dirName,
|
|
5744
5870
|
frontmatter,
|
|
5745
5871
|
body,
|
|
@@ -5771,11 +5897,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
5771
5897
|
} = {}) {
|
|
5772
5898
|
if (global) {
|
|
5773
5899
|
return {
|
|
5774
|
-
relativeDirPath:
|
|
5900
|
+
relativeDirPath: join51(".gemini", "antigravity", "skills")
|
|
5775
5901
|
};
|
|
5776
5902
|
}
|
|
5777
5903
|
return {
|
|
5778
|
-
relativeDirPath:
|
|
5904
|
+
relativeDirPath: join51(".agent", "skills")
|
|
5779
5905
|
};
|
|
5780
5906
|
}
|
|
5781
5907
|
getFrontmatter() {
|
|
@@ -5857,9 +5983,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
5857
5983
|
});
|
|
5858
5984
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5859
5985
|
if (!result.success) {
|
|
5860
|
-
const skillDirPath =
|
|
5986
|
+
const skillDirPath = join51(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5861
5987
|
throw new Error(
|
|
5862
|
-
`Invalid frontmatter in ${
|
|
5988
|
+
`Invalid frontmatter in ${join51(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5863
5989
|
);
|
|
5864
5990
|
}
|
|
5865
5991
|
return new _AntigravitySkill({
|
|
@@ -5893,7 +6019,7 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
5893
6019
|
};
|
|
5894
6020
|
|
|
5895
6021
|
// src/features/skills/claudecode-skill.ts
|
|
5896
|
-
import { join as
|
|
6022
|
+
import { join as join52 } from "path";
|
|
5897
6023
|
import { z as z22 } from "zod/mini";
|
|
5898
6024
|
var ClaudecodeSkillFrontmatterSchema = z22.looseObject({
|
|
5899
6025
|
name: z22.string(),
|
|
@@ -5903,7 +6029,7 @@ var ClaudecodeSkillFrontmatterSchema = z22.looseObject({
|
|
|
5903
6029
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
5904
6030
|
constructor({
|
|
5905
6031
|
baseDir = process.cwd(),
|
|
5906
|
-
relativeDirPath =
|
|
6032
|
+
relativeDirPath = join52(".claude", "skills"),
|
|
5907
6033
|
dirName,
|
|
5908
6034
|
frontmatter,
|
|
5909
6035
|
body,
|
|
@@ -5934,7 +6060,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5934
6060
|
global: _global = false
|
|
5935
6061
|
} = {}) {
|
|
5936
6062
|
return {
|
|
5937
|
-
relativeDirPath:
|
|
6063
|
+
relativeDirPath: join52(".claude", "skills")
|
|
5938
6064
|
};
|
|
5939
6065
|
}
|
|
5940
6066
|
getFrontmatter() {
|
|
@@ -6022,9 +6148,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6022
6148
|
});
|
|
6023
6149
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6024
6150
|
if (!result.success) {
|
|
6025
|
-
const skillDirPath =
|
|
6151
|
+
const skillDirPath = join52(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6026
6152
|
throw new Error(
|
|
6027
|
-
`Invalid frontmatter in ${
|
|
6153
|
+
`Invalid frontmatter in ${join52(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6028
6154
|
);
|
|
6029
6155
|
}
|
|
6030
6156
|
return new _ClaudecodeSkill({
|
|
@@ -6058,7 +6184,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6058
6184
|
};
|
|
6059
6185
|
|
|
6060
6186
|
// src/features/skills/codexcli-skill.ts
|
|
6061
|
-
import { join as
|
|
6187
|
+
import { join as join53 } from "path";
|
|
6062
6188
|
import { z as z23 } from "zod/mini";
|
|
6063
6189
|
var CodexCliSkillFrontmatterSchema = z23.looseObject({
|
|
6064
6190
|
name: z23.string(),
|
|
@@ -6072,7 +6198,7 @@ var CodexCliSkillFrontmatterSchema = z23.looseObject({
|
|
|
6072
6198
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
6073
6199
|
constructor({
|
|
6074
6200
|
baseDir = process.cwd(),
|
|
6075
|
-
relativeDirPath =
|
|
6201
|
+
relativeDirPath = join53(".codex", "skills"),
|
|
6076
6202
|
dirName,
|
|
6077
6203
|
frontmatter,
|
|
6078
6204
|
body,
|
|
@@ -6103,7 +6229,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6103
6229
|
global: _global = false
|
|
6104
6230
|
} = {}) {
|
|
6105
6231
|
return {
|
|
6106
|
-
relativeDirPath:
|
|
6232
|
+
relativeDirPath: join53(".codex", "skills")
|
|
6107
6233
|
};
|
|
6108
6234
|
}
|
|
6109
6235
|
getFrontmatter() {
|
|
@@ -6195,9 +6321,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6195
6321
|
});
|
|
6196
6322
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6197
6323
|
if (!result.success) {
|
|
6198
|
-
const skillDirPath =
|
|
6324
|
+
const skillDirPath = join53(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6199
6325
|
throw new Error(
|
|
6200
|
-
`Invalid frontmatter in ${
|
|
6326
|
+
`Invalid frontmatter in ${join53(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6201
6327
|
);
|
|
6202
6328
|
}
|
|
6203
6329
|
return new _CodexCliSkill({
|
|
@@ -6231,7 +6357,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6231
6357
|
};
|
|
6232
6358
|
|
|
6233
6359
|
// src/features/skills/copilot-skill.ts
|
|
6234
|
-
import { join as
|
|
6360
|
+
import { join as join54 } from "path";
|
|
6235
6361
|
import { z as z24 } from "zod/mini";
|
|
6236
6362
|
var CopilotSkillFrontmatterSchema = z24.looseObject({
|
|
6237
6363
|
name: z24.string(),
|
|
@@ -6241,7 +6367,7 @@ var CopilotSkillFrontmatterSchema = z24.looseObject({
|
|
|
6241
6367
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
6242
6368
|
constructor({
|
|
6243
6369
|
baseDir = process.cwd(),
|
|
6244
|
-
relativeDirPath =
|
|
6370
|
+
relativeDirPath = join54(".github", "skills"),
|
|
6245
6371
|
dirName,
|
|
6246
6372
|
frontmatter,
|
|
6247
6373
|
body,
|
|
@@ -6273,7 +6399,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6273
6399
|
throw new Error("CopilotSkill does not support global mode.");
|
|
6274
6400
|
}
|
|
6275
6401
|
return {
|
|
6276
|
-
relativeDirPath:
|
|
6402
|
+
relativeDirPath: join54(".github", "skills")
|
|
6277
6403
|
};
|
|
6278
6404
|
}
|
|
6279
6405
|
getFrontmatter() {
|
|
@@ -6361,9 +6487,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6361
6487
|
});
|
|
6362
6488
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6363
6489
|
if (!result.success) {
|
|
6364
|
-
const skillDirPath =
|
|
6490
|
+
const skillDirPath = join54(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6365
6491
|
throw new Error(
|
|
6366
|
-
`Invalid frontmatter in ${
|
|
6492
|
+
`Invalid frontmatter in ${join54(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6367
6493
|
);
|
|
6368
6494
|
}
|
|
6369
6495
|
return new _CopilotSkill({
|
|
@@ -6398,7 +6524,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6398
6524
|
};
|
|
6399
6525
|
|
|
6400
6526
|
// src/features/skills/cursor-skill.ts
|
|
6401
|
-
import { join as
|
|
6527
|
+
import { join as join55 } from "path";
|
|
6402
6528
|
import { z as z25 } from "zod/mini";
|
|
6403
6529
|
var CursorSkillFrontmatterSchema = z25.looseObject({
|
|
6404
6530
|
name: z25.string(),
|
|
@@ -6407,7 +6533,7 @@ var CursorSkillFrontmatterSchema = z25.looseObject({
|
|
|
6407
6533
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
6408
6534
|
constructor({
|
|
6409
6535
|
baseDir = process.cwd(),
|
|
6410
|
-
relativeDirPath =
|
|
6536
|
+
relativeDirPath = join55(".cursor", "skills"),
|
|
6411
6537
|
dirName,
|
|
6412
6538
|
frontmatter,
|
|
6413
6539
|
body,
|
|
@@ -6439,7 +6565,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6439
6565
|
throw new Error("CursorSkill does not support global mode.");
|
|
6440
6566
|
}
|
|
6441
6567
|
return {
|
|
6442
|
-
relativeDirPath:
|
|
6568
|
+
relativeDirPath: join55(".cursor", "skills")
|
|
6443
6569
|
};
|
|
6444
6570
|
}
|
|
6445
6571
|
getFrontmatter() {
|
|
@@ -6521,9 +6647,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6521
6647
|
});
|
|
6522
6648
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6523
6649
|
if (!result.success) {
|
|
6524
|
-
const skillDirPath =
|
|
6650
|
+
const skillDirPath = join55(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6525
6651
|
throw new Error(
|
|
6526
|
-
`Invalid frontmatter in ${
|
|
6652
|
+
`Invalid frontmatter in ${join55(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6527
6653
|
);
|
|
6528
6654
|
}
|
|
6529
6655
|
return new _CursorSkill({
|
|
@@ -6558,7 +6684,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6558
6684
|
};
|
|
6559
6685
|
|
|
6560
6686
|
// src/features/skills/kilo-skill.ts
|
|
6561
|
-
import { join as
|
|
6687
|
+
import { join as join56 } from "path";
|
|
6562
6688
|
import { z as z26 } from "zod/mini";
|
|
6563
6689
|
var KiloSkillFrontmatterSchema = z26.looseObject({
|
|
6564
6690
|
name: z26.string(),
|
|
@@ -6567,7 +6693,7 @@ var KiloSkillFrontmatterSchema = z26.looseObject({
|
|
|
6567
6693
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
6568
6694
|
constructor({
|
|
6569
6695
|
baseDir = process.cwd(),
|
|
6570
|
-
relativeDirPath =
|
|
6696
|
+
relativeDirPath = join56(".kilocode", "skills"),
|
|
6571
6697
|
dirName,
|
|
6572
6698
|
frontmatter,
|
|
6573
6699
|
body,
|
|
@@ -6598,7 +6724,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6598
6724
|
global: _global = false
|
|
6599
6725
|
} = {}) {
|
|
6600
6726
|
return {
|
|
6601
|
-
relativeDirPath:
|
|
6727
|
+
relativeDirPath: join56(".kilocode", "skills")
|
|
6602
6728
|
};
|
|
6603
6729
|
}
|
|
6604
6730
|
getFrontmatter() {
|
|
@@ -6688,13 +6814,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6688
6814
|
});
|
|
6689
6815
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6690
6816
|
if (!result.success) {
|
|
6691
|
-
const skillDirPath =
|
|
6817
|
+
const skillDirPath = join56(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6692
6818
|
throw new Error(
|
|
6693
|
-
`Invalid frontmatter in ${
|
|
6819
|
+
`Invalid frontmatter in ${join56(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6694
6820
|
);
|
|
6695
6821
|
}
|
|
6696
6822
|
if (result.data.name !== loaded.dirName) {
|
|
6697
|
-
const skillFilePath =
|
|
6823
|
+
const skillFilePath = join56(
|
|
6698
6824
|
loaded.baseDir,
|
|
6699
6825
|
loaded.relativeDirPath,
|
|
6700
6826
|
loaded.dirName,
|
|
@@ -6735,7 +6861,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6735
6861
|
};
|
|
6736
6862
|
|
|
6737
6863
|
// src/features/skills/opencode-skill.ts
|
|
6738
|
-
import { join as
|
|
6864
|
+
import { join as join57 } from "path";
|
|
6739
6865
|
import { z as z27 } from "zod/mini";
|
|
6740
6866
|
var OpenCodeSkillFrontmatterSchema = z27.looseObject({
|
|
6741
6867
|
name: z27.string(),
|
|
@@ -6745,7 +6871,7 @@ var OpenCodeSkillFrontmatterSchema = z27.looseObject({
|
|
|
6745
6871
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
6746
6872
|
constructor({
|
|
6747
6873
|
baseDir = process.cwd(),
|
|
6748
|
-
relativeDirPath =
|
|
6874
|
+
relativeDirPath = join57(".opencode", "skill"),
|
|
6749
6875
|
dirName,
|
|
6750
6876
|
frontmatter,
|
|
6751
6877
|
body,
|
|
@@ -6774,7 +6900,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6774
6900
|
}
|
|
6775
6901
|
static getSettablePaths({ global = false } = {}) {
|
|
6776
6902
|
return {
|
|
6777
|
-
relativeDirPath: global ?
|
|
6903
|
+
relativeDirPath: global ? join57(".config", "opencode", "skill") : join57(".opencode", "skill")
|
|
6778
6904
|
};
|
|
6779
6905
|
}
|
|
6780
6906
|
getFrontmatter() {
|
|
@@ -6862,9 +6988,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6862
6988
|
});
|
|
6863
6989
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6864
6990
|
if (!result.success) {
|
|
6865
|
-
const skillDirPath =
|
|
6991
|
+
const skillDirPath = join57(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6866
6992
|
throw new Error(
|
|
6867
|
-
`Invalid frontmatter in ${
|
|
6993
|
+
`Invalid frontmatter in ${join57(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6868
6994
|
);
|
|
6869
6995
|
}
|
|
6870
6996
|
return new _OpenCodeSkill({
|
|
@@ -6898,7 +7024,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6898
7024
|
};
|
|
6899
7025
|
|
|
6900
7026
|
// src/features/skills/roo-skill.ts
|
|
6901
|
-
import { join as
|
|
7027
|
+
import { join as join58 } from "path";
|
|
6902
7028
|
import { z as z28 } from "zod/mini";
|
|
6903
7029
|
var RooSkillFrontmatterSchema = z28.looseObject({
|
|
6904
7030
|
name: z28.string(),
|
|
@@ -6907,7 +7033,7 @@ var RooSkillFrontmatterSchema = z28.looseObject({
|
|
|
6907
7033
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
6908
7034
|
constructor({
|
|
6909
7035
|
baseDir = process.cwd(),
|
|
6910
|
-
relativeDirPath =
|
|
7036
|
+
relativeDirPath = join58(".roo", "skills"),
|
|
6911
7037
|
dirName,
|
|
6912
7038
|
frontmatter,
|
|
6913
7039
|
body,
|
|
@@ -6938,7 +7064,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6938
7064
|
global: _global = false
|
|
6939
7065
|
} = {}) {
|
|
6940
7066
|
return {
|
|
6941
|
-
relativeDirPath:
|
|
7067
|
+
relativeDirPath: join58(".roo", "skills")
|
|
6942
7068
|
};
|
|
6943
7069
|
}
|
|
6944
7070
|
getFrontmatter() {
|
|
@@ -7028,13 +7154,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
7028
7154
|
});
|
|
7029
7155
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7030
7156
|
if (!result.success) {
|
|
7031
|
-
const skillDirPath =
|
|
7157
|
+
const skillDirPath = join58(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7032
7158
|
throw new Error(
|
|
7033
|
-
`Invalid frontmatter in ${
|
|
7159
|
+
`Invalid frontmatter in ${join58(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7034
7160
|
);
|
|
7035
7161
|
}
|
|
7036
7162
|
if (result.data.name !== loaded.dirName) {
|
|
7037
|
-
const skillFilePath =
|
|
7163
|
+
const skillFilePath = join58(
|
|
7038
7164
|
loaded.baseDir,
|
|
7039
7165
|
loaded.relativeDirPath,
|
|
7040
7166
|
loaded.dirName,
|
|
@@ -7245,9 +7371,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7245
7371
|
*/
|
|
7246
7372
|
async loadRulesyncDirs() {
|
|
7247
7373
|
const paths = RulesyncSkill.getSettablePaths();
|
|
7248
|
-
const rulesyncSkillsDirPath =
|
|
7249
|
-
const dirPaths = await findFilesByGlobs(
|
|
7250
|
-
const dirNames = dirPaths.map((path3) =>
|
|
7374
|
+
const rulesyncSkillsDirPath = join59(this.baseDir, paths.relativeDirPath);
|
|
7375
|
+
const dirPaths = await findFilesByGlobs(join59(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
7376
|
+
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7251
7377
|
const rulesyncSkills = await Promise.all(
|
|
7252
7378
|
dirNames.map(
|
|
7253
7379
|
(dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
|
|
@@ -7263,9 +7389,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7263
7389
|
async loadToolDirs() {
|
|
7264
7390
|
const factory = this.getFactory(this.toolTarget);
|
|
7265
7391
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7266
|
-
const skillsDirPath =
|
|
7267
|
-
const dirPaths = await findFilesByGlobs(
|
|
7268
|
-
const dirNames = dirPaths.map((path3) =>
|
|
7392
|
+
const skillsDirPath = join59(this.baseDir, paths.relativeDirPath);
|
|
7393
|
+
const dirPaths = await findFilesByGlobs(join59(skillsDirPath, "*"), { type: "dir" });
|
|
7394
|
+
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7269
7395
|
const toolSkills = await Promise.all(
|
|
7270
7396
|
dirNames.map(
|
|
7271
7397
|
(dirName) => factory.class.fromDir({
|
|
@@ -7281,9 +7407,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7281
7407
|
async loadToolDirsToDelete() {
|
|
7282
7408
|
const factory = this.getFactory(this.toolTarget);
|
|
7283
7409
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7284
|
-
const skillsDirPath =
|
|
7285
|
-
const dirPaths = await findFilesByGlobs(
|
|
7286
|
-
const dirNames = dirPaths.map((path3) =>
|
|
7410
|
+
const skillsDirPath = join59(this.baseDir, paths.relativeDirPath);
|
|
7411
|
+
const dirPaths = await findFilesByGlobs(join59(skillsDirPath, "*"), { type: "dir" });
|
|
7412
|
+
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7287
7413
|
const toolSkills = dirNames.map(
|
|
7288
7414
|
(dirName) => factory.class.forDeletion({
|
|
7289
7415
|
baseDir: this.baseDir,
|
|
@@ -7331,10 +7457,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7331
7457
|
};
|
|
7332
7458
|
|
|
7333
7459
|
// src/features/subagents/agentsmd-subagent.ts
|
|
7334
|
-
import { join as
|
|
7460
|
+
import { join as join61 } from "path";
|
|
7335
7461
|
|
|
7336
7462
|
// src/features/subagents/simulated-subagent.ts
|
|
7337
|
-
import { basename as
|
|
7463
|
+
import { basename as basename18, join as join60 } from "path";
|
|
7338
7464
|
import { z as z30 } from "zod/mini";
|
|
7339
7465
|
|
|
7340
7466
|
// src/features/subagents/tool-subagent.ts
|
|
@@ -7390,7 +7516,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7390
7516
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7391
7517
|
if (!result.success) {
|
|
7392
7518
|
throw new Error(
|
|
7393
|
-
`Invalid frontmatter in ${
|
|
7519
|
+
`Invalid frontmatter in ${join60(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7394
7520
|
);
|
|
7395
7521
|
}
|
|
7396
7522
|
}
|
|
@@ -7441,7 +7567,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7441
7567
|
return {
|
|
7442
7568
|
success: false,
|
|
7443
7569
|
error: new Error(
|
|
7444
|
-
`Invalid frontmatter in ${
|
|
7570
|
+
`Invalid frontmatter in ${join60(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7445
7571
|
)
|
|
7446
7572
|
};
|
|
7447
7573
|
}
|
|
@@ -7451,7 +7577,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7451
7577
|
relativeFilePath,
|
|
7452
7578
|
validate = true
|
|
7453
7579
|
}) {
|
|
7454
|
-
const filePath =
|
|
7580
|
+
const filePath = join60(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
7455
7581
|
const fileContent = await readFileContent(filePath);
|
|
7456
7582
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7457
7583
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7461,7 +7587,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7461
7587
|
return {
|
|
7462
7588
|
baseDir,
|
|
7463
7589
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
7464
|
-
relativeFilePath:
|
|
7590
|
+
relativeFilePath: basename18(relativeFilePath),
|
|
7465
7591
|
frontmatter: result.data,
|
|
7466
7592
|
body: content.trim(),
|
|
7467
7593
|
validate
|
|
@@ -7487,7 +7613,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7487
7613
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
7488
7614
|
static getSettablePaths() {
|
|
7489
7615
|
return {
|
|
7490
|
-
relativeDirPath:
|
|
7616
|
+
relativeDirPath: join61(".agents", "subagents")
|
|
7491
7617
|
};
|
|
7492
7618
|
}
|
|
7493
7619
|
static async fromFile(params) {
|
|
@@ -7510,11 +7636,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
7510
7636
|
};
|
|
7511
7637
|
|
|
7512
7638
|
// src/features/subagents/codexcli-subagent.ts
|
|
7513
|
-
import { join as
|
|
7639
|
+
import { join as join62 } from "path";
|
|
7514
7640
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
7515
7641
|
static getSettablePaths() {
|
|
7516
7642
|
return {
|
|
7517
|
-
relativeDirPath:
|
|
7643
|
+
relativeDirPath: join62(".codex", "subagents")
|
|
7518
7644
|
};
|
|
7519
7645
|
}
|
|
7520
7646
|
static async fromFile(params) {
|
|
@@ -7537,11 +7663,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
7537
7663
|
};
|
|
7538
7664
|
|
|
7539
7665
|
// src/features/subagents/cursor-subagent.ts
|
|
7540
|
-
import { join as
|
|
7666
|
+
import { join as join63 } from "path";
|
|
7541
7667
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
7542
7668
|
static getSettablePaths() {
|
|
7543
7669
|
return {
|
|
7544
|
-
relativeDirPath:
|
|
7670
|
+
relativeDirPath: join63(".cursor", "subagents")
|
|
7545
7671
|
};
|
|
7546
7672
|
}
|
|
7547
7673
|
static async fromFile(params) {
|
|
@@ -7564,11 +7690,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
7564
7690
|
};
|
|
7565
7691
|
|
|
7566
7692
|
// src/features/subagents/geminicli-subagent.ts
|
|
7567
|
-
import { join as
|
|
7693
|
+
import { join as join64 } from "path";
|
|
7568
7694
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
7569
7695
|
static getSettablePaths() {
|
|
7570
7696
|
return {
|
|
7571
|
-
relativeDirPath:
|
|
7697
|
+
relativeDirPath: join64(".gemini", "subagents")
|
|
7572
7698
|
};
|
|
7573
7699
|
}
|
|
7574
7700
|
static async fromFile(params) {
|
|
@@ -7591,11 +7717,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
7591
7717
|
};
|
|
7592
7718
|
|
|
7593
7719
|
// src/features/subagents/roo-subagent.ts
|
|
7594
|
-
import { join as
|
|
7720
|
+
import { join as join65 } from "path";
|
|
7595
7721
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
7596
7722
|
static getSettablePaths() {
|
|
7597
7723
|
return {
|
|
7598
|
-
relativeDirPath:
|
|
7724
|
+
relativeDirPath: join65(".roo", "subagents")
|
|
7599
7725
|
};
|
|
7600
7726
|
}
|
|
7601
7727
|
static async fromFile(params) {
|
|
@@ -7618,15 +7744,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
7618
7744
|
};
|
|
7619
7745
|
|
|
7620
7746
|
// src/features/subagents/subagents-processor.ts
|
|
7621
|
-
import { basename as
|
|
7747
|
+
import { basename as basename21, join as join70 } from "path";
|
|
7622
7748
|
import { z as z35 } from "zod/mini";
|
|
7623
7749
|
|
|
7624
7750
|
// src/features/subagents/claudecode-subagent.ts
|
|
7625
|
-
import { join as
|
|
7751
|
+
import { join as join67 } from "path";
|
|
7626
7752
|
import { z as z32 } from "zod/mini";
|
|
7627
7753
|
|
|
7628
7754
|
// src/features/subagents/rulesync-subagent.ts
|
|
7629
|
-
import { basename as
|
|
7755
|
+
import { basename as basename19, join as join66 } from "path";
|
|
7630
7756
|
import { z as z31 } from "zod/mini";
|
|
7631
7757
|
var RulesyncSubagentFrontmatterSchema = z31.looseObject({
|
|
7632
7758
|
targets: RulesyncTargetsSchema,
|
|
@@ -7641,7 +7767,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7641
7767
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7642
7768
|
if (!result.success) {
|
|
7643
7769
|
throw new Error(
|
|
7644
|
-
`Invalid frontmatter in ${
|
|
7770
|
+
`Invalid frontmatter in ${join66(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7645
7771
|
);
|
|
7646
7772
|
}
|
|
7647
7773
|
}
|
|
@@ -7674,7 +7800,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7674
7800
|
return {
|
|
7675
7801
|
success: false,
|
|
7676
7802
|
error: new Error(
|
|
7677
|
-
`Invalid frontmatter in ${
|
|
7803
|
+
`Invalid frontmatter in ${join66(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7678
7804
|
)
|
|
7679
7805
|
};
|
|
7680
7806
|
}
|
|
@@ -7683,14 +7809,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7683
7809
|
relativeFilePath
|
|
7684
7810
|
}) {
|
|
7685
7811
|
const fileContent = await readFileContent(
|
|
7686
|
-
|
|
7812
|
+
join66(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
7687
7813
|
);
|
|
7688
7814
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7689
7815
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7690
7816
|
if (!result.success) {
|
|
7691
7817
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
7692
7818
|
}
|
|
7693
|
-
const filename =
|
|
7819
|
+
const filename = basename19(relativeFilePath);
|
|
7694
7820
|
return new _RulesyncSubagent({
|
|
7695
7821
|
baseDir: process.cwd(),
|
|
7696
7822
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -7718,7 +7844,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7718
7844
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7719
7845
|
if (!result.success) {
|
|
7720
7846
|
throw new Error(
|
|
7721
|
-
`Invalid frontmatter in ${
|
|
7847
|
+
`Invalid frontmatter in ${join67(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7722
7848
|
);
|
|
7723
7849
|
}
|
|
7724
7850
|
}
|
|
@@ -7730,7 +7856,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7730
7856
|
}
|
|
7731
7857
|
static getSettablePaths(_options = {}) {
|
|
7732
7858
|
return {
|
|
7733
|
-
relativeDirPath:
|
|
7859
|
+
relativeDirPath: join67(".claude", "agents")
|
|
7734
7860
|
};
|
|
7735
7861
|
}
|
|
7736
7862
|
getFrontmatter() {
|
|
@@ -7804,7 +7930,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7804
7930
|
return {
|
|
7805
7931
|
success: false,
|
|
7806
7932
|
error: new Error(
|
|
7807
|
-
`Invalid frontmatter in ${
|
|
7933
|
+
`Invalid frontmatter in ${join67(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7808
7934
|
)
|
|
7809
7935
|
};
|
|
7810
7936
|
}
|
|
@@ -7822,7 +7948,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7822
7948
|
global = false
|
|
7823
7949
|
}) {
|
|
7824
7950
|
const paths = this.getSettablePaths({ global });
|
|
7825
|
-
const filePath =
|
|
7951
|
+
const filePath = join67(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7826
7952
|
const fileContent = await readFileContent(filePath);
|
|
7827
7953
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7828
7954
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7857,7 +7983,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7857
7983
|
};
|
|
7858
7984
|
|
|
7859
7985
|
// src/features/subagents/copilot-subagent.ts
|
|
7860
|
-
import { join as
|
|
7986
|
+
import { join as join68 } from "path";
|
|
7861
7987
|
import { z as z33 } from "zod/mini";
|
|
7862
7988
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
7863
7989
|
var CopilotSubagentFrontmatterSchema = z33.looseObject({
|
|
@@ -7883,7 +8009,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7883
8009
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7884
8010
|
if (!result.success) {
|
|
7885
8011
|
throw new Error(
|
|
7886
|
-
`Invalid frontmatter in ${
|
|
8012
|
+
`Invalid frontmatter in ${join68(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7887
8013
|
);
|
|
7888
8014
|
}
|
|
7889
8015
|
}
|
|
@@ -7895,7 +8021,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7895
8021
|
}
|
|
7896
8022
|
static getSettablePaths(_options = {}) {
|
|
7897
8023
|
return {
|
|
7898
|
-
relativeDirPath:
|
|
8024
|
+
relativeDirPath: join68(".github", "agents")
|
|
7899
8025
|
};
|
|
7900
8026
|
}
|
|
7901
8027
|
getFrontmatter() {
|
|
@@ -7969,7 +8095,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7969
8095
|
return {
|
|
7970
8096
|
success: false,
|
|
7971
8097
|
error: new Error(
|
|
7972
|
-
`Invalid frontmatter in ${
|
|
8098
|
+
`Invalid frontmatter in ${join68(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7973
8099
|
)
|
|
7974
8100
|
};
|
|
7975
8101
|
}
|
|
@@ -7987,7 +8113,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7987
8113
|
global = false
|
|
7988
8114
|
}) {
|
|
7989
8115
|
const paths = this.getSettablePaths({ global });
|
|
7990
|
-
const filePath =
|
|
8116
|
+
const filePath = join68(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7991
8117
|
const fileContent = await readFileContent(filePath);
|
|
7992
8118
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7993
8119
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8023,7 +8149,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8023
8149
|
};
|
|
8024
8150
|
|
|
8025
8151
|
// src/features/subagents/opencode-subagent.ts
|
|
8026
|
-
import { basename as
|
|
8152
|
+
import { basename as basename20, join as join69 } from "path";
|
|
8027
8153
|
import { z as z34 } from "zod/mini";
|
|
8028
8154
|
var OpenCodeSubagentFrontmatterSchema = z34.looseObject({
|
|
8029
8155
|
description: z34.string(),
|
|
@@ -8038,7 +8164,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8038
8164
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8039
8165
|
if (!result.success) {
|
|
8040
8166
|
throw new Error(
|
|
8041
|
-
`Invalid frontmatter in ${
|
|
8167
|
+
`Invalid frontmatter in ${join69(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8042
8168
|
);
|
|
8043
8169
|
}
|
|
8044
8170
|
}
|
|
@@ -8052,7 +8178,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8052
8178
|
global = false
|
|
8053
8179
|
} = {}) {
|
|
8054
8180
|
return {
|
|
8055
|
-
relativeDirPath: global ?
|
|
8181
|
+
relativeDirPath: global ? join69(".config", "opencode", "agent") : join69(".opencode", "agent")
|
|
8056
8182
|
};
|
|
8057
8183
|
}
|
|
8058
8184
|
getFrontmatter() {
|
|
@@ -8065,7 +8191,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8065
8191
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
8066
8192
|
const rulesyncFrontmatter = {
|
|
8067
8193
|
targets: ["opencode"],
|
|
8068
|
-
name: name ??
|
|
8194
|
+
name: name ?? basename20(this.getRelativeFilePath(), ".md"),
|
|
8069
8195
|
description,
|
|
8070
8196
|
opencode: { mode, ...opencodeSection }
|
|
8071
8197
|
};
|
|
@@ -8118,7 +8244,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8118
8244
|
return {
|
|
8119
8245
|
success: false,
|
|
8120
8246
|
error: new Error(
|
|
8121
|
-
`Invalid frontmatter in ${
|
|
8247
|
+
`Invalid frontmatter in ${join69(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8122
8248
|
)
|
|
8123
8249
|
};
|
|
8124
8250
|
}
|
|
@@ -8135,7 +8261,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8135
8261
|
global = false
|
|
8136
8262
|
}) {
|
|
8137
8263
|
const paths = this.getSettablePaths({ global });
|
|
8138
|
-
const filePath =
|
|
8264
|
+
const filePath = join69(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8139
8265
|
const fileContent = await readFileContent(filePath);
|
|
8140
8266
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8141
8267
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8296,7 +8422,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8296
8422
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
8297
8423
|
*/
|
|
8298
8424
|
async loadRulesyncFiles() {
|
|
8299
|
-
const subagentsDir =
|
|
8425
|
+
const subagentsDir = join70(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
8300
8426
|
const dirExists = await directoryExists(subagentsDir);
|
|
8301
8427
|
if (!dirExists) {
|
|
8302
8428
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -8311,7 +8437,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8311
8437
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
8312
8438
|
const rulesyncSubagents = [];
|
|
8313
8439
|
for (const mdFile of mdFiles) {
|
|
8314
|
-
const filepath =
|
|
8440
|
+
const filepath = join70(subagentsDir, mdFile);
|
|
8315
8441
|
try {
|
|
8316
8442
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
8317
8443
|
relativeFilePath: mdFile,
|
|
@@ -8341,14 +8467,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8341
8467
|
const factory = this.getFactory(this.toolTarget);
|
|
8342
8468
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
8343
8469
|
const subagentFilePaths = await findFilesByGlobs(
|
|
8344
|
-
|
|
8470
|
+
join70(this.baseDir, paths.relativeDirPath, "*.md")
|
|
8345
8471
|
);
|
|
8346
8472
|
if (forDeletion) {
|
|
8347
8473
|
const toolSubagents2 = subagentFilePaths.map(
|
|
8348
8474
|
(path3) => factory.class.forDeletion({
|
|
8349
8475
|
baseDir: this.baseDir,
|
|
8350
8476
|
relativeDirPath: paths.relativeDirPath,
|
|
8351
|
-
relativeFilePath:
|
|
8477
|
+
relativeFilePath: basename21(path3),
|
|
8352
8478
|
global: this.global
|
|
8353
8479
|
})
|
|
8354
8480
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -8359,7 +8485,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8359
8485
|
subagentFilePaths.map(
|
|
8360
8486
|
(path3) => factory.class.fromFile({
|
|
8361
8487
|
baseDir: this.baseDir,
|
|
8362
|
-
relativeFilePath:
|
|
8488
|
+
relativeFilePath: basename21(path3),
|
|
8363
8489
|
global: this.global
|
|
8364
8490
|
})
|
|
8365
8491
|
)
|
|
@@ -8391,13 +8517,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8391
8517
|
};
|
|
8392
8518
|
|
|
8393
8519
|
// src/features/rules/agentsmd-rule.ts
|
|
8394
|
-
import { join as
|
|
8520
|
+
import { join as join73 } from "path";
|
|
8395
8521
|
|
|
8396
8522
|
// src/features/rules/tool-rule.ts
|
|
8397
|
-
import { join as
|
|
8523
|
+
import { join as join72 } from "path";
|
|
8398
8524
|
|
|
8399
8525
|
// src/features/rules/rulesync-rule.ts
|
|
8400
|
-
import { basename as
|
|
8526
|
+
import { basename as basename22, join as join71 } from "path";
|
|
8401
8527
|
import { z as z36 } from "zod/mini";
|
|
8402
8528
|
var RulesyncRuleFrontmatterSchema = z36.object({
|
|
8403
8529
|
root: z36.optional(z36.optional(z36.boolean())),
|
|
@@ -8444,7 +8570,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8444
8570
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8445
8571
|
if (!result.success) {
|
|
8446
8572
|
throw new Error(
|
|
8447
|
-
`Invalid frontmatter in ${
|
|
8573
|
+
`Invalid frontmatter in ${join71(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8448
8574
|
);
|
|
8449
8575
|
}
|
|
8450
8576
|
}
|
|
@@ -8479,7 +8605,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8479
8605
|
return {
|
|
8480
8606
|
success: false,
|
|
8481
8607
|
error: new Error(
|
|
8482
|
-
`Invalid frontmatter in ${
|
|
8608
|
+
`Invalid frontmatter in ${join71(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8483
8609
|
)
|
|
8484
8610
|
};
|
|
8485
8611
|
}
|
|
@@ -8488,12 +8614,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8488
8614
|
relativeFilePath,
|
|
8489
8615
|
validate = true
|
|
8490
8616
|
}) {
|
|
8491
|
-
const legacyPath =
|
|
8617
|
+
const legacyPath = join71(
|
|
8492
8618
|
process.cwd(),
|
|
8493
8619
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
8494
8620
|
relativeFilePath
|
|
8495
8621
|
);
|
|
8496
|
-
const recommendedPath =
|
|
8622
|
+
const recommendedPath = join71(
|
|
8497
8623
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8498
8624
|
relativeFilePath
|
|
8499
8625
|
);
|
|
@@ -8514,7 +8640,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8514
8640
|
agentsmd: result.data.agentsmd,
|
|
8515
8641
|
cursor: result.data.cursor
|
|
8516
8642
|
};
|
|
8517
|
-
const filename =
|
|
8643
|
+
const filename = basename22(legacyPath);
|
|
8518
8644
|
return new _RulesyncRule({
|
|
8519
8645
|
baseDir: process.cwd(),
|
|
8520
8646
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8528,7 +8654,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8528
8654
|
relativeFilePath,
|
|
8529
8655
|
validate = true
|
|
8530
8656
|
}) {
|
|
8531
|
-
const filePath =
|
|
8657
|
+
const filePath = join71(
|
|
8532
8658
|
process.cwd(),
|
|
8533
8659
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8534
8660
|
relativeFilePath
|
|
@@ -8547,7 +8673,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8547
8673
|
agentsmd: result.data.agentsmd,
|
|
8548
8674
|
cursor: result.data.cursor
|
|
8549
8675
|
};
|
|
8550
|
-
const filename =
|
|
8676
|
+
const filename = basename22(filePath);
|
|
8551
8677
|
return new _RulesyncRule({
|
|
8552
8678
|
baseDir: process.cwd(),
|
|
8553
8679
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8630,7 +8756,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8630
8756
|
rulesyncRule,
|
|
8631
8757
|
validate = true,
|
|
8632
8758
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
8633
|
-
nonRootPath = { relativeDirPath:
|
|
8759
|
+
nonRootPath = { relativeDirPath: join72(".agents", "memories") }
|
|
8634
8760
|
}) {
|
|
8635
8761
|
const params = this.buildToolRuleParamsDefault({
|
|
8636
8762
|
baseDir,
|
|
@@ -8641,7 +8767,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8641
8767
|
});
|
|
8642
8768
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
8643
8769
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
8644
|
-
params.relativeDirPath =
|
|
8770
|
+
params.relativeDirPath = join72(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
8645
8771
|
params.relativeFilePath = "AGENTS.md";
|
|
8646
8772
|
}
|
|
8647
8773
|
return params;
|
|
@@ -8706,7 +8832,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8706
8832
|
relativeFilePath: "AGENTS.md"
|
|
8707
8833
|
},
|
|
8708
8834
|
nonRoot: {
|
|
8709
|
-
relativeDirPath:
|
|
8835
|
+
relativeDirPath: join73(".agents", "memories")
|
|
8710
8836
|
}
|
|
8711
8837
|
};
|
|
8712
8838
|
}
|
|
@@ -8716,8 +8842,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8716
8842
|
validate = true
|
|
8717
8843
|
}) {
|
|
8718
8844
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
8719
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
8720
|
-
const fileContent = await readFileContent(
|
|
8845
|
+
const relativePath = isRoot ? "AGENTS.md" : join73(".agents", "memories", relativeFilePath);
|
|
8846
|
+
const fileContent = await readFileContent(join73(baseDir, relativePath));
|
|
8721
8847
|
return new _AgentsMdRule({
|
|
8722
8848
|
baseDir,
|
|
8723
8849
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -8772,7 +8898,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8772
8898
|
};
|
|
8773
8899
|
|
|
8774
8900
|
// src/features/rules/antigravity-rule.ts
|
|
8775
|
-
import { join as
|
|
8901
|
+
import { join as join74 } from "path";
|
|
8776
8902
|
import { z as z37 } from "zod/mini";
|
|
8777
8903
|
var AntigravityRuleFrontmatterSchema = z37.looseObject({
|
|
8778
8904
|
trigger: z37.optional(
|
|
@@ -8931,7 +9057,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8931
9057
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8932
9058
|
if (!result.success) {
|
|
8933
9059
|
throw new Error(
|
|
8934
|
-
`Invalid frontmatter in ${
|
|
9060
|
+
`Invalid frontmatter in ${join74(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8935
9061
|
);
|
|
8936
9062
|
}
|
|
8937
9063
|
}
|
|
@@ -8946,7 +9072,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8946
9072
|
static getSettablePaths() {
|
|
8947
9073
|
return {
|
|
8948
9074
|
nonRoot: {
|
|
8949
|
-
relativeDirPath:
|
|
9075
|
+
relativeDirPath: join74(".agent", "rules")
|
|
8950
9076
|
}
|
|
8951
9077
|
};
|
|
8952
9078
|
}
|
|
@@ -8955,7 +9081,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8955
9081
|
relativeFilePath,
|
|
8956
9082
|
validate = true
|
|
8957
9083
|
}) {
|
|
8958
|
-
const filePath =
|
|
9084
|
+
const filePath = join74(
|
|
8959
9085
|
baseDir,
|
|
8960
9086
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
8961
9087
|
relativeFilePath
|
|
@@ -9096,7 +9222,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9096
9222
|
};
|
|
9097
9223
|
|
|
9098
9224
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
9099
|
-
import { join as
|
|
9225
|
+
import { join as join75 } from "path";
|
|
9100
9226
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
9101
9227
|
toRulesyncRule() {
|
|
9102
9228
|
const rulesyncFrontmatter = {
|
|
@@ -9122,7 +9248,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9122
9248
|
relativeFilePath: ".augment-guidelines"
|
|
9123
9249
|
},
|
|
9124
9250
|
nonRoot: {
|
|
9125
|
-
relativeDirPath:
|
|
9251
|
+
relativeDirPath: join75(".augment", "rules")
|
|
9126
9252
|
}
|
|
9127
9253
|
};
|
|
9128
9254
|
}
|
|
@@ -9157,8 +9283,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9157
9283
|
}) {
|
|
9158
9284
|
const settablePaths = this.getSettablePaths();
|
|
9159
9285
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
9160
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
9161
|
-
const fileContent = await readFileContent(
|
|
9286
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join75(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9287
|
+
const fileContent = await readFileContent(join75(baseDir, relativePath));
|
|
9162
9288
|
return new _AugmentcodeLegacyRule({
|
|
9163
9289
|
baseDir,
|
|
9164
9290
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -9187,7 +9313,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9187
9313
|
};
|
|
9188
9314
|
|
|
9189
9315
|
// src/features/rules/augmentcode-rule.ts
|
|
9190
|
-
import { join as
|
|
9316
|
+
import { join as join76 } from "path";
|
|
9191
9317
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
9192
9318
|
toRulesyncRule() {
|
|
9193
9319
|
return this.toRulesyncRuleDefault();
|
|
@@ -9195,7 +9321,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9195
9321
|
static getSettablePaths() {
|
|
9196
9322
|
return {
|
|
9197
9323
|
nonRoot: {
|
|
9198
|
-
relativeDirPath:
|
|
9324
|
+
relativeDirPath: join76(".augment", "rules")
|
|
9199
9325
|
}
|
|
9200
9326
|
};
|
|
9201
9327
|
}
|
|
@@ -9219,7 +9345,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9219
9345
|
validate = true
|
|
9220
9346
|
}) {
|
|
9221
9347
|
const fileContent = await readFileContent(
|
|
9222
|
-
|
|
9348
|
+
join76(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9223
9349
|
);
|
|
9224
9350
|
const { body: content } = parseFrontmatter(fileContent);
|
|
9225
9351
|
return new _AugmentcodeRule({
|
|
@@ -9255,7 +9381,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9255
9381
|
};
|
|
9256
9382
|
|
|
9257
9383
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
9258
|
-
import { join as
|
|
9384
|
+
import { join as join77 } from "path";
|
|
9259
9385
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
9260
9386
|
static getSettablePaths({
|
|
9261
9387
|
global
|
|
@@ -9274,7 +9400,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9274
9400
|
relativeFilePath: "CLAUDE.md"
|
|
9275
9401
|
},
|
|
9276
9402
|
nonRoot: {
|
|
9277
|
-
relativeDirPath:
|
|
9403
|
+
relativeDirPath: join77(".claude", "memories")
|
|
9278
9404
|
}
|
|
9279
9405
|
};
|
|
9280
9406
|
}
|
|
@@ -9289,7 +9415,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9289
9415
|
if (isRoot) {
|
|
9290
9416
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9291
9417
|
const fileContent2 = await readFileContent(
|
|
9292
|
-
|
|
9418
|
+
join77(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9293
9419
|
);
|
|
9294
9420
|
return new _ClaudecodeLegacyRule({
|
|
9295
9421
|
baseDir,
|
|
@@ -9303,8 +9429,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9303
9429
|
if (!paths.nonRoot) {
|
|
9304
9430
|
throw new Error("nonRoot path is not set");
|
|
9305
9431
|
}
|
|
9306
|
-
const relativePath =
|
|
9307
|
-
const fileContent = await readFileContent(
|
|
9432
|
+
const relativePath = join77(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9433
|
+
const fileContent = await readFileContent(join77(baseDir, relativePath));
|
|
9308
9434
|
return new _ClaudecodeLegacyRule({
|
|
9309
9435
|
baseDir,
|
|
9310
9436
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9363,7 +9489,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9363
9489
|
};
|
|
9364
9490
|
|
|
9365
9491
|
// src/features/rules/claudecode-rule.ts
|
|
9366
|
-
import { join as
|
|
9492
|
+
import { join as join78 } from "path";
|
|
9367
9493
|
import { z as z38 } from "zod/mini";
|
|
9368
9494
|
var ClaudecodeRuleFrontmatterSchema = z38.object({
|
|
9369
9495
|
paths: z38.optional(z38.string())
|
|
@@ -9388,7 +9514,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9388
9514
|
relativeFilePath: "CLAUDE.md"
|
|
9389
9515
|
},
|
|
9390
9516
|
nonRoot: {
|
|
9391
|
-
relativeDirPath:
|
|
9517
|
+
relativeDirPath: join78(".claude", "rules")
|
|
9392
9518
|
}
|
|
9393
9519
|
};
|
|
9394
9520
|
}
|
|
@@ -9397,7 +9523,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9397
9523
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9398
9524
|
if (!result.success) {
|
|
9399
9525
|
throw new Error(
|
|
9400
|
-
`Invalid frontmatter in ${
|
|
9526
|
+
`Invalid frontmatter in ${join78(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9401
9527
|
);
|
|
9402
9528
|
}
|
|
9403
9529
|
}
|
|
@@ -9425,7 +9551,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9425
9551
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
9426
9552
|
if (isRoot) {
|
|
9427
9553
|
const fileContent2 = await readFileContent(
|
|
9428
|
-
|
|
9554
|
+
join78(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
9429
9555
|
);
|
|
9430
9556
|
return new _ClaudecodeRule({
|
|
9431
9557
|
baseDir,
|
|
@@ -9440,13 +9566,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9440
9566
|
if (!paths.nonRoot) {
|
|
9441
9567
|
throw new Error("nonRoot path is not set");
|
|
9442
9568
|
}
|
|
9443
|
-
const relativePath =
|
|
9444
|
-
const fileContent = await readFileContent(
|
|
9569
|
+
const relativePath = join78(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9570
|
+
const fileContent = await readFileContent(join78(baseDir, relativePath));
|
|
9445
9571
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9446
9572
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9447
9573
|
if (!result.success) {
|
|
9448
9574
|
throw new Error(
|
|
9449
|
-
`Invalid frontmatter in ${
|
|
9575
|
+
`Invalid frontmatter in ${join78(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
9450
9576
|
);
|
|
9451
9577
|
}
|
|
9452
9578
|
return new _ClaudecodeRule({
|
|
@@ -9553,7 +9679,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9553
9679
|
return {
|
|
9554
9680
|
success: false,
|
|
9555
9681
|
error: new Error(
|
|
9556
|
-
`Invalid frontmatter in ${
|
|
9682
|
+
`Invalid frontmatter in ${join78(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9557
9683
|
)
|
|
9558
9684
|
};
|
|
9559
9685
|
}
|
|
@@ -9573,7 +9699,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9573
9699
|
};
|
|
9574
9700
|
|
|
9575
9701
|
// src/features/rules/cline-rule.ts
|
|
9576
|
-
import { join as
|
|
9702
|
+
import { join as join79 } from "path";
|
|
9577
9703
|
import { z as z39 } from "zod/mini";
|
|
9578
9704
|
var ClineRuleFrontmatterSchema = z39.object({
|
|
9579
9705
|
description: z39.string()
|
|
@@ -9618,7 +9744,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9618
9744
|
validate = true
|
|
9619
9745
|
}) {
|
|
9620
9746
|
const fileContent = await readFileContent(
|
|
9621
|
-
|
|
9747
|
+
join79(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9622
9748
|
);
|
|
9623
9749
|
return new _ClineRule({
|
|
9624
9750
|
baseDir,
|
|
@@ -9644,7 +9770,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9644
9770
|
};
|
|
9645
9771
|
|
|
9646
9772
|
// src/features/rules/codexcli-rule.ts
|
|
9647
|
-
import { join as
|
|
9773
|
+
import { join as join80 } from "path";
|
|
9648
9774
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
9649
9775
|
static getSettablePaths({
|
|
9650
9776
|
global
|
|
@@ -9663,7 +9789,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9663
9789
|
relativeFilePath: "AGENTS.md"
|
|
9664
9790
|
},
|
|
9665
9791
|
nonRoot: {
|
|
9666
|
-
relativeDirPath:
|
|
9792
|
+
relativeDirPath: join80(".codex", "memories")
|
|
9667
9793
|
}
|
|
9668
9794
|
};
|
|
9669
9795
|
}
|
|
@@ -9678,7 +9804,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9678
9804
|
if (isRoot) {
|
|
9679
9805
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9680
9806
|
const fileContent2 = await readFileContent(
|
|
9681
|
-
|
|
9807
|
+
join80(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9682
9808
|
);
|
|
9683
9809
|
return new _CodexcliRule({
|
|
9684
9810
|
baseDir,
|
|
@@ -9692,8 +9818,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9692
9818
|
if (!paths.nonRoot) {
|
|
9693
9819
|
throw new Error("nonRoot path is not set");
|
|
9694
9820
|
}
|
|
9695
|
-
const relativePath =
|
|
9696
|
-
const fileContent = await readFileContent(
|
|
9821
|
+
const relativePath = join80(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9822
|
+
const fileContent = await readFileContent(join80(baseDir, relativePath));
|
|
9697
9823
|
return new _CodexcliRule({
|
|
9698
9824
|
baseDir,
|
|
9699
9825
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9752,7 +9878,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9752
9878
|
};
|
|
9753
9879
|
|
|
9754
9880
|
// src/features/rules/copilot-rule.ts
|
|
9755
|
-
import { join as
|
|
9881
|
+
import { join as join81 } from "path";
|
|
9756
9882
|
import { z as z40 } from "zod/mini";
|
|
9757
9883
|
var CopilotRuleFrontmatterSchema = z40.object({
|
|
9758
9884
|
description: z40.optional(z40.string()),
|
|
@@ -9769,7 +9895,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9769
9895
|
relativeFilePath: "copilot-instructions.md"
|
|
9770
9896
|
},
|
|
9771
9897
|
nonRoot: {
|
|
9772
|
-
relativeDirPath:
|
|
9898
|
+
relativeDirPath: join81(".github", "instructions")
|
|
9773
9899
|
}
|
|
9774
9900
|
};
|
|
9775
9901
|
}
|
|
@@ -9778,7 +9904,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9778
9904
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9779
9905
|
if (!result.success) {
|
|
9780
9906
|
throw new Error(
|
|
9781
|
-
`Invalid frontmatter in ${
|
|
9907
|
+
`Invalid frontmatter in ${join81(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9782
9908
|
);
|
|
9783
9909
|
}
|
|
9784
9910
|
}
|
|
@@ -9860,11 +9986,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9860
9986
|
validate = true
|
|
9861
9987
|
}) {
|
|
9862
9988
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
9863
|
-
const relativePath = isRoot ?
|
|
9989
|
+
const relativePath = isRoot ? join81(
|
|
9864
9990
|
this.getSettablePaths().root.relativeDirPath,
|
|
9865
9991
|
this.getSettablePaths().root.relativeFilePath
|
|
9866
|
-
) :
|
|
9867
|
-
const fileContent = await readFileContent(
|
|
9992
|
+
) : join81(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
9993
|
+
const fileContent = await readFileContent(join81(baseDir, relativePath));
|
|
9868
9994
|
if (isRoot) {
|
|
9869
9995
|
return new _CopilotRule({
|
|
9870
9996
|
baseDir,
|
|
@@ -9880,7 +10006,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9880
10006
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9881
10007
|
if (!result.success) {
|
|
9882
10008
|
throw new Error(
|
|
9883
|
-
`Invalid frontmatter in ${
|
|
10009
|
+
`Invalid frontmatter in ${join81(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9884
10010
|
);
|
|
9885
10011
|
}
|
|
9886
10012
|
return new _CopilotRule({
|
|
@@ -9920,7 +10046,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9920
10046
|
return {
|
|
9921
10047
|
success: false,
|
|
9922
10048
|
error: new Error(
|
|
9923
|
-
`Invalid frontmatter in ${
|
|
10049
|
+
`Invalid frontmatter in ${join81(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9924
10050
|
)
|
|
9925
10051
|
};
|
|
9926
10052
|
}
|
|
@@ -9940,7 +10066,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9940
10066
|
};
|
|
9941
10067
|
|
|
9942
10068
|
// src/features/rules/cursor-rule.ts
|
|
9943
|
-
import { basename as
|
|
10069
|
+
import { basename as basename23, join as join82 } from "path";
|
|
9944
10070
|
import { z as z41 } from "zod/mini";
|
|
9945
10071
|
var CursorRuleFrontmatterSchema = z41.object({
|
|
9946
10072
|
description: z41.optional(z41.string()),
|
|
@@ -9953,7 +10079,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9953
10079
|
static getSettablePaths() {
|
|
9954
10080
|
return {
|
|
9955
10081
|
nonRoot: {
|
|
9956
|
-
relativeDirPath:
|
|
10082
|
+
relativeDirPath: join82(".cursor", "rules")
|
|
9957
10083
|
}
|
|
9958
10084
|
};
|
|
9959
10085
|
}
|
|
@@ -9962,7 +10088,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9962
10088
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9963
10089
|
if (!result.success) {
|
|
9964
10090
|
throw new Error(
|
|
9965
|
-
`Invalid frontmatter in ${
|
|
10091
|
+
`Invalid frontmatter in ${join82(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9966
10092
|
);
|
|
9967
10093
|
}
|
|
9968
10094
|
}
|
|
@@ -10079,19 +10205,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10079
10205
|
validate = true
|
|
10080
10206
|
}) {
|
|
10081
10207
|
const fileContent = await readFileContent(
|
|
10082
|
-
|
|
10208
|
+
join82(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10083
10209
|
);
|
|
10084
10210
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
10085
10211
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10086
10212
|
if (!result.success) {
|
|
10087
10213
|
throw new Error(
|
|
10088
|
-
`Invalid frontmatter in ${
|
|
10214
|
+
`Invalid frontmatter in ${join82(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10089
10215
|
);
|
|
10090
10216
|
}
|
|
10091
10217
|
return new _CursorRule({
|
|
10092
10218
|
baseDir,
|
|
10093
10219
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
10094
|
-
relativeFilePath:
|
|
10220
|
+
relativeFilePath: basename23(relativeFilePath),
|
|
10095
10221
|
frontmatter: result.data,
|
|
10096
10222
|
body: content.trim(),
|
|
10097
10223
|
validate
|
|
@@ -10122,7 +10248,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10122
10248
|
return {
|
|
10123
10249
|
success: false,
|
|
10124
10250
|
error: new Error(
|
|
10125
|
-
`Invalid frontmatter in ${
|
|
10251
|
+
`Invalid frontmatter in ${join82(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10126
10252
|
)
|
|
10127
10253
|
};
|
|
10128
10254
|
}
|
|
@@ -10142,7 +10268,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10142
10268
|
};
|
|
10143
10269
|
|
|
10144
10270
|
// src/features/rules/geminicli-rule.ts
|
|
10145
|
-
import { join as
|
|
10271
|
+
import { join as join83 } from "path";
|
|
10146
10272
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
10147
10273
|
static getSettablePaths({
|
|
10148
10274
|
global
|
|
@@ -10161,7 +10287,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10161
10287
|
relativeFilePath: "GEMINI.md"
|
|
10162
10288
|
},
|
|
10163
10289
|
nonRoot: {
|
|
10164
|
-
relativeDirPath:
|
|
10290
|
+
relativeDirPath: join83(".gemini", "memories")
|
|
10165
10291
|
}
|
|
10166
10292
|
};
|
|
10167
10293
|
}
|
|
@@ -10176,7 +10302,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10176
10302
|
if (isRoot) {
|
|
10177
10303
|
const relativePath2 = paths.root.relativeFilePath;
|
|
10178
10304
|
const fileContent2 = await readFileContent(
|
|
10179
|
-
|
|
10305
|
+
join83(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
10180
10306
|
);
|
|
10181
10307
|
return new _GeminiCliRule({
|
|
10182
10308
|
baseDir,
|
|
@@ -10190,8 +10316,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10190
10316
|
if (!paths.nonRoot) {
|
|
10191
10317
|
throw new Error("nonRoot path is not set");
|
|
10192
10318
|
}
|
|
10193
|
-
const relativePath =
|
|
10194
|
-
const fileContent = await readFileContent(
|
|
10319
|
+
const relativePath = join83(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10320
|
+
const fileContent = await readFileContent(join83(baseDir, relativePath));
|
|
10195
10321
|
return new _GeminiCliRule({
|
|
10196
10322
|
baseDir,
|
|
10197
10323
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10250,7 +10376,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10250
10376
|
};
|
|
10251
10377
|
|
|
10252
10378
|
// src/features/rules/junie-rule.ts
|
|
10253
|
-
import { join as
|
|
10379
|
+
import { join as join84 } from "path";
|
|
10254
10380
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
10255
10381
|
static getSettablePaths() {
|
|
10256
10382
|
return {
|
|
@@ -10259,7 +10385,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10259
10385
|
relativeFilePath: "guidelines.md"
|
|
10260
10386
|
},
|
|
10261
10387
|
nonRoot: {
|
|
10262
|
-
relativeDirPath:
|
|
10388
|
+
relativeDirPath: join84(".junie", "memories")
|
|
10263
10389
|
}
|
|
10264
10390
|
};
|
|
10265
10391
|
}
|
|
@@ -10269,8 +10395,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10269
10395
|
validate = true
|
|
10270
10396
|
}) {
|
|
10271
10397
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
10272
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
10273
|
-
const fileContent = await readFileContent(
|
|
10398
|
+
const relativePath = isRoot ? "guidelines.md" : join84(".junie", "memories", relativeFilePath);
|
|
10399
|
+
const fileContent = await readFileContent(join84(baseDir, relativePath));
|
|
10274
10400
|
return new _JunieRule({
|
|
10275
10401
|
baseDir,
|
|
10276
10402
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10325,12 +10451,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10325
10451
|
};
|
|
10326
10452
|
|
|
10327
10453
|
// src/features/rules/kilo-rule.ts
|
|
10328
|
-
import { join as
|
|
10454
|
+
import { join as join85 } from "path";
|
|
10329
10455
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
10330
10456
|
static getSettablePaths(_options = {}) {
|
|
10331
10457
|
return {
|
|
10332
10458
|
nonRoot: {
|
|
10333
|
-
relativeDirPath:
|
|
10459
|
+
relativeDirPath: join85(".kilocode", "rules")
|
|
10334
10460
|
}
|
|
10335
10461
|
};
|
|
10336
10462
|
}
|
|
@@ -10340,7 +10466,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10340
10466
|
validate = true
|
|
10341
10467
|
}) {
|
|
10342
10468
|
const fileContent = await readFileContent(
|
|
10343
|
-
|
|
10469
|
+
join85(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10344
10470
|
);
|
|
10345
10471
|
return new _KiloRule({
|
|
10346
10472
|
baseDir,
|
|
@@ -10392,12 +10518,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10392
10518
|
};
|
|
10393
10519
|
|
|
10394
10520
|
// src/features/rules/kiro-rule.ts
|
|
10395
|
-
import { join as
|
|
10521
|
+
import { join as join86 } from "path";
|
|
10396
10522
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
10397
10523
|
static getSettablePaths() {
|
|
10398
10524
|
return {
|
|
10399
10525
|
nonRoot: {
|
|
10400
|
-
relativeDirPath:
|
|
10526
|
+
relativeDirPath: join86(".kiro", "steering")
|
|
10401
10527
|
}
|
|
10402
10528
|
};
|
|
10403
10529
|
}
|
|
@@ -10407,7 +10533,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10407
10533
|
validate = true
|
|
10408
10534
|
}) {
|
|
10409
10535
|
const fileContent = await readFileContent(
|
|
10410
|
-
|
|
10536
|
+
join86(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10411
10537
|
);
|
|
10412
10538
|
return new _KiroRule({
|
|
10413
10539
|
baseDir,
|
|
@@ -10461,7 +10587,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10461
10587
|
};
|
|
10462
10588
|
|
|
10463
10589
|
// src/features/rules/opencode-rule.ts
|
|
10464
|
-
import { join as
|
|
10590
|
+
import { join as join87 } from "path";
|
|
10465
10591
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
10466
10592
|
static getSettablePaths() {
|
|
10467
10593
|
return {
|
|
@@ -10470,7 +10596,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10470
10596
|
relativeFilePath: "AGENTS.md"
|
|
10471
10597
|
},
|
|
10472
10598
|
nonRoot: {
|
|
10473
|
-
relativeDirPath:
|
|
10599
|
+
relativeDirPath: join87(".opencode", "memories")
|
|
10474
10600
|
}
|
|
10475
10601
|
};
|
|
10476
10602
|
}
|
|
@@ -10480,8 +10606,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10480
10606
|
validate = true
|
|
10481
10607
|
}) {
|
|
10482
10608
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
10483
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
10484
|
-
const fileContent = await readFileContent(
|
|
10609
|
+
const relativePath = isRoot ? "AGENTS.md" : join87(".opencode", "memories", relativeFilePath);
|
|
10610
|
+
const fileContent = await readFileContent(join87(baseDir, relativePath));
|
|
10485
10611
|
return new _OpenCodeRule({
|
|
10486
10612
|
baseDir,
|
|
10487
10613
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10536,7 +10662,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10536
10662
|
};
|
|
10537
10663
|
|
|
10538
10664
|
// src/features/rules/qwencode-rule.ts
|
|
10539
|
-
import { join as
|
|
10665
|
+
import { join as join88 } from "path";
|
|
10540
10666
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
10541
10667
|
static getSettablePaths() {
|
|
10542
10668
|
return {
|
|
@@ -10545,7 +10671,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10545
10671
|
relativeFilePath: "QWEN.md"
|
|
10546
10672
|
},
|
|
10547
10673
|
nonRoot: {
|
|
10548
|
-
relativeDirPath:
|
|
10674
|
+
relativeDirPath: join88(".qwen", "memories")
|
|
10549
10675
|
}
|
|
10550
10676
|
};
|
|
10551
10677
|
}
|
|
@@ -10555,8 +10681,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10555
10681
|
validate = true
|
|
10556
10682
|
}) {
|
|
10557
10683
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
10558
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
10559
|
-
const fileContent = await readFileContent(
|
|
10684
|
+
const relativePath = isRoot ? "QWEN.md" : join88(".qwen", "memories", relativeFilePath);
|
|
10685
|
+
const fileContent = await readFileContent(join88(baseDir, relativePath));
|
|
10560
10686
|
return new _QwencodeRule({
|
|
10561
10687
|
baseDir,
|
|
10562
10688
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10607,13 +10733,101 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10607
10733
|
}
|
|
10608
10734
|
};
|
|
10609
10735
|
|
|
10736
|
+
// src/features/rules/replit-rule.ts
|
|
10737
|
+
import { join as join89 } from "path";
|
|
10738
|
+
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
10739
|
+
static getSettablePaths() {
|
|
10740
|
+
return {
|
|
10741
|
+
root: {
|
|
10742
|
+
relativeDirPath: ".",
|
|
10743
|
+
relativeFilePath: "replit.md"
|
|
10744
|
+
}
|
|
10745
|
+
};
|
|
10746
|
+
}
|
|
10747
|
+
static async fromFile({
|
|
10748
|
+
baseDir = process.cwd(),
|
|
10749
|
+
relativeFilePath,
|
|
10750
|
+
validate = true
|
|
10751
|
+
}) {
|
|
10752
|
+
const paths = this.getSettablePaths();
|
|
10753
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
10754
|
+
if (!isRoot) {
|
|
10755
|
+
throw new Error("ReplitRule only supports root rules");
|
|
10756
|
+
}
|
|
10757
|
+
const relativePath = paths.root.relativeFilePath;
|
|
10758
|
+
const fileContent = await readFileContent(
|
|
10759
|
+
join89(baseDir, paths.root.relativeDirPath, relativePath)
|
|
10760
|
+
);
|
|
10761
|
+
return new _ReplitRule({
|
|
10762
|
+
baseDir,
|
|
10763
|
+
relativeDirPath: paths.root.relativeDirPath,
|
|
10764
|
+
relativeFilePath: paths.root.relativeFilePath,
|
|
10765
|
+
fileContent,
|
|
10766
|
+
validate,
|
|
10767
|
+
root: true
|
|
10768
|
+
});
|
|
10769
|
+
}
|
|
10770
|
+
static fromRulesyncRule({
|
|
10771
|
+
baseDir = process.cwd(),
|
|
10772
|
+
rulesyncRule,
|
|
10773
|
+
validate = true
|
|
10774
|
+
}) {
|
|
10775
|
+
const paths = this.getSettablePaths();
|
|
10776
|
+
const isRoot = rulesyncRule.getFrontmatter().root ?? false;
|
|
10777
|
+
if (!isRoot) {
|
|
10778
|
+
throw new Error("ReplitRule only supports root rules");
|
|
10779
|
+
}
|
|
10780
|
+
return new _ReplitRule(
|
|
10781
|
+
this.buildToolRuleParamsDefault({
|
|
10782
|
+
baseDir,
|
|
10783
|
+
rulesyncRule,
|
|
10784
|
+
validate,
|
|
10785
|
+
rootPath: paths.root,
|
|
10786
|
+
nonRootPath: void 0
|
|
10787
|
+
})
|
|
10788
|
+
);
|
|
10789
|
+
}
|
|
10790
|
+
toRulesyncRule() {
|
|
10791
|
+
return this.toRulesyncRuleDefault();
|
|
10792
|
+
}
|
|
10793
|
+
validate() {
|
|
10794
|
+
return { success: true, error: null };
|
|
10795
|
+
}
|
|
10796
|
+
static forDeletion({
|
|
10797
|
+
baseDir = process.cwd(),
|
|
10798
|
+
relativeDirPath,
|
|
10799
|
+
relativeFilePath
|
|
10800
|
+
}) {
|
|
10801
|
+
const paths = this.getSettablePaths();
|
|
10802
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
10803
|
+
return new _ReplitRule({
|
|
10804
|
+
baseDir,
|
|
10805
|
+
relativeDirPath,
|
|
10806
|
+
relativeFilePath,
|
|
10807
|
+
fileContent: "",
|
|
10808
|
+
validate: false,
|
|
10809
|
+
root: isRoot
|
|
10810
|
+
});
|
|
10811
|
+
}
|
|
10812
|
+
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
10813
|
+
const isRoot = rulesyncRule.getFrontmatter().root ?? false;
|
|
10814
|
+
if (!isRoot) {
|
|
10815
|
+
return false;
|
|
10816
|
+
}
|
|
10817
|
+
return this.isTargetedByRulesyncRuleDefault({
|
|
10818
|
+
rulesyncRule,
|
|
10819
|
+
toolTarget: "replit"
|
|
10820
|
+
});
|
|
10821
|
+
}
|
|
10822
|
+
};
|
|
10823
|
+
|
|
10610
10824
|
// src/features/rules/roo-rule.ts
|
|
10611
|
-
import { join as
|
|
10825
|
+
import { join as join90 } from "path";
|
|
10612
10826
|
var RooRule = class _RooRule extends ToolRule {
|
|
10613
10827
|
static getSettablePaths() {
|
|
10614
10828
|
return {
|
|
10615
10829
|
nonRoot: {
|
|
10616
|
-
relativeDirPath:
|
|
10830
|
+
relativeDirPath: join90(".roo", "rules")
|
|
10617
10831
|
}
|
|
10618
10832
|
};
|
|
10619
10833
|
}
|
|
@@ -10623,7 +10837,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10623
10837
|
validate = true
|
|
10624
10838
|
}) {
|
|
10625
10839
|
const fileContent = await readFileContent(
|
|
10626
|
-
|
|
10840
|
+
join90(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10627
10841
|
);
|
|
10628
10842
|
return new _RooRule({
|
|
10629
10843
|
baseDir,
|
|
@@ -10692,7 +10906,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10692
10906
|
};
|
|
10693
10907
|
|
|
10694
10908
|
// src/features/rules/warp-rule.ts
|
|
10695
|
-
import { join as
|
|
10909
|
+
import { join as join91 } from "path";
|
|
10696
10910
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
10697
10911
|
constructor({ fileContent, root, ...rest }) {
|
|
10698
10912
|
super({
|
|
@@ -10708,7 +10922,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10708
10922
|
relativeFilePath: "WARP.md"
|
|
10709
10923
|
},
|
|
10710
10924
|
nonRoot: {
|
|
10711
|
-
relativeDirPath:
|
|
10925
|
+
relativeDirPath: join91(".warp", "memories")
|
|
10712
10926
|
}
|
|
10713
10927
|
};
|
|
10714
10928
|
}
|
|
@@ -10718,8 +10932,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10718
10932
|
validate = true
|
|
10719
10933
|
}) {
|
|
10720
10934
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
10721
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
10722
|
-
const fileContent = await readFileContent(
|
|
10935
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join91(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10936
|
+
const fileContent = await readFileContent(join91(baseDir, relativePath));
|
|
10723
10937
|
return new _WarpRule({
|
|
10724
10938
|
baseDir,
|
|
10725
10939
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -10774,12 +10988,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10774
10988
|
};
|
|
10775
10989
|
|
|
10776
10990
|
// src/features/rules/windsurf-rule.ts
|
|
10777
|
-
import { join as
|
|
10991
|
+
import { join as join92 } from "path";
|
|
10778
10992
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
10779
10993
|
static getSettablePaths() {
|
|
10780
10994
|
return {
|
|
10781
10995
|
nonRoot: {
|
|
10782
|
-
relativeDirPath:
|
|
10996
|
+
relativeDirPath: join92(".windsurf", "rules")
|
|
10783
10997
|
}
|
|
10784
10998
|
};
|
|
10785
10999
|
}
|
|
@@ -10789,7 +11003,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
10789
11003
|
validate = true
|
|
10790
11004
|
}) {
|
|
10791
11005
|
const fileContent = await readFileContent(
|
|
10792
|
-
|
|
11006
|
+
join92(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10793
11007
|
);
|
|
10794
11008
|
return new _WindsurfRule({
|
|
10795
11009
|
baseDir,
|
|
@@ -10858,6 +11072,7 @@ var rulesProcessorToolTargets = [
|
|
|
10858
11072
|
"kiro",
|
|
10859
11073
|
"opencode",
|
|
10860
11074
|
"qwencode",
|
|
11075
|
+
"replit",
|
|
10861
11076
|
"roo",
|
|
10862
11077
|
"warp",
|
|
10863
11078
|
"windsurf"
|
|
@@ -11012,6 +11227,13 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
11012
11227
|
meta: { extension: "md", supportsGlobal: false, ruleDiscoveryMode: "toon" }
|
|
11013
11228
|
}
|
|
11014
11229
|
],
|
|
11230
|
+
[
|
|
11231
|
+
"replit",
|
|
11232
|
+
{
|
|
11233
|
+
class: ReplitRule,
|
|
11234
|
+
meta: { extension: "md", supportsGlobal: false, ruleDiscoveryMode: "auto" }
|
|
11235
|
+
}
|
|
11236
|
+
],
|
|
11015
11237
|
[
|
|
11016
11238
|
"roo",
|
|
11017
11239
|
{
|
|
@@ -11146,7 +11368,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11146
11368
|
}).relativeDirPath;
|
|
11147
11369
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
11148
11370
|
const frontmatter = skill.getFrontmatter();
|
|
11149
|
-
const relativePath =
|
|
11371
|
+
const relativePath = join93(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
11150
11372
|
return {
|
|
11151
11373
|
name: frontmatter.name,
|
|
11152
11374
|
description: frontmatter.description,
|
|
@@ -11213,10 +11435,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11213
11435
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
11214
11436
|
*/
|
|
11215
11437
|
async loadRulesyncFiles() {
|
|
11216
|
-
const files = await findFilesByGlobs(
|
|
11438
|
+
const files = await findFilesByGlobs(join93(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
11217
11439
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
11218
11440
|
const rulesyncRules = await Promise.all(
|
|
11219
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath:
|
|
11441
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename24(file) }))
|
|
11220
11442
|
);
|
|
11221
11443
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
11222
11444
|
if (rootRules.length > 1) {
|
|
@@ -11234,10 +11456,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11234
11456
|
return rulesyncRules;
|
|
11235
11457
|
}
|
|
11236
11458
|
async loadRulesyncFilesLegacy() {
|
|
11237
|
-
const legacyFiles = await findFilesByGlobs(
|
|
11459
|
+
const legacyFiles = await findFilesByGlobs(join93(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
11238
11460
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
11239
11461
|
return Promise.all(
|
|
11240
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath:
|
|
11462
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename24(file) }))
|
|
11241
11463
|
);
|
|
11242
11464
|
}
|
|
11243
11465
|
/**
|
|
@@ -11255,7 +11477,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11255
11477
|
return [];
|
|
11256
11478
|
}
|
|
11257
11479
|
const rootFilePaths = await findFilesByGlobs(
|
|
11258
|
-
|
|
11480
|
+
join93(
|
|
11259
11481
|
this.baseDir,
|
|
11260
11482
|
settablePaths.root.relativeDirPath ?? ".",
|
|
11261
11483
|
settablePaths.root.relativeFilePath
|
|
@@ -11266,7 +11488,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11266
11488
|
(filePath) => factory.class.forDeletion({
|
|
11267
11489
|
baseDir: this.baseDir,
|
|
11268
11490
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
11269
|
-
relativeFilePath:
|
|
11491
|
+
relativeFilePath: basename24(filePath),
|
|
11270
11492
|
global: this.global
|
|
11271
11493
|
})
|
|
11272
11494
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11275,7 +11497,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11275
11497
|
rootFilePaths.map(
|
|
11276
11498
|
(filePath) => factory.class.fromFile({
|
|
11277
11499
|
baseDir: this.baseDir,
|
|
11278
|
-
relativeFilePath:
|
|
11500
|
+
relativeFilePath: basename24(filePath),
|
|
11279
11501
|
global: this.global
|
|
11280
11502
|
})
|
|
11281
11503
|
)
|
|
@@ -11287,14 +11509,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11287
11509
|
return [];
|
|
11288
11510
|
}
|
|
11289
11511
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
11290
|
-
|
|
11512
|
+
join93(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
11291
11513
|
);
|
|
11292
11514
|
if (forDeletion) {
|
|
11293
11515
|
return nonRootFilePaths.map(
|
|
11294
11516
|
(filePath) => factory.class.forDeletion({
|
|
11295
11517
|
baseDir: this.baseDir,
|
|
11296
11518
|
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
11297
|
-
relativeFilePath:
|
|
11519
|
+
relativeFilePath: basename24(filePath),
|
|
11298
11520
|
global: this.global
|
|
11299
11521
|
})
|
|
11300
11522
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11303,7 +11525,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11303
11525
|
nonRootFilePaths.map(
|
|
11304
11526
|
(filePath) => factory.class.fromFile({
|
|
11305
11527
|
baseDir: this.baseDir,
|
|
11306
|
-
relativeFilePath:
|
|
11528
|
+
relativeFilePath: basename24(filePath),
|
|
11307
11529
|
global: this.global
|
|
11308
11530
|
})
|
|
11309
11531
|
)
|
|
@@ -11396,14 +11618,14 @@ s/<command> [arguments]
|
|
|
11396
11618
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
11397
11619
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
11398
11620
|
|
|
11399
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
11621
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join93(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
11400
11622
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
11401
11623
|
|
|
11402
11624
|
Simulated subagents are specialized AI assistants that can be invoked to handle specific types of tasks. In this case, it can be appear something like custom slash commands simply. Simulated subagents can be called by custom slash commands.
|
|
11403
11625
|
|
|
11404
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
11626
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join93(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
11405
11627
|
|
|
11406
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
11628
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join93(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
11407
11629
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
11408
11630
|
const result = [
|
|
11409
11631
|
overview,
|
|
@@ -11685,7 +11907,7 @@ async function generateSkills(config) {
|
|
|
11685
11907
|
}
|
|
11686
11908
|
|
|
11687
11909
|
// src/cli/commands/gitignore.ts
|
|
11688
|
-
import { join as
|
|
11910
|
+
import { join as join94 } from "path";
|
|
11689
11911
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
11690
11912
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
11691
11913
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -11748,6 +11970,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11748
11970
|
"**/.kilocodeignore",
|
|
11749
11971
|
// Kiro
|
|
11750
11972
|
"**/.kiro/steering/",
|
|
11973
|
+
"**/.kiro/prompts/",
|
|
11751
11974
|
"**/.kiro/settings/mcp.json",
|
|
11752
11975
|
"**/.aiignore",
|
|
11753
11976
|
// OpenCode
|
|
@@ -11758,6 +11981,8 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11758
11981
|
// Qwen
|
|
11759
11982
|
"**/QWEN.md",
|
|
11760
11983
|
"**/.qwen/memories/",
|
|
11984
|
+
// Replit
|
|
11985
|
+
"**/replit.md",
|
|
11761
11986
|
// Roo
|
|
11762
11987
|
"**/.roo/rules/",
|
|
11763
11988
|
"**/.roo/skills/",
|
|
@@ -11821,7 +12046,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
11821
12046
|
return result;
|
|
11822
12047
|
};
|
|
11823
12048
|
var gitignoreCommand = async () => {
|
|
11824
|
-
const gitignorePath =
|
|
12049
|
+
const gitignorePath = join94(process.cwd(), ".gitignore");
|
|
11825
12050
|
let gitignoreContent = "";
|
|
11826
12051
|
if (await fileExists(gitignorePath)) {
|
|
11827
12052
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -12020,7 +12245,7 @@ async function importSkills(config, tool) {
|
|
|
12020
12245
|
}
|
|
12021
12246
|
|
|
12022
12247
|
// src/cli/commands/init.ts
|
|
12023
|
-
import { join as
|
|
12248
|
+
import { join as join95 } from "path";
|
|
12024
12249
|
async function initCommand() {
|
|
12025
12250
|
logger.info("Initializing rulesync...");
|
|
12026
12251
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -12198,14 +12423,14 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12198
12423
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
12199
12424
|
await ensureDir(skillPaths.relativeDirPath);
|
|
12200
12425
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
12201
|
-
const ruleFilepath =
|
|
12426
|
+
const ruleFilepath = join95(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
12202
12427
|
if (!await fileExists(ruleFilepath)) {
|
|
12203
12428
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
12204
12429
|
logger.success(`Created ${ruleFilepath}`);
|
|
12205
12430
|
} else {
|
|
12206
12431
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
12207
12432
|
}
|
|
12208
|
-
const mcpFilepath =
|
|
12433
|
+
const mcpFilepath = join95(
|
|
12209
12434
|
mcpPaths.recommended.relativeDirPath,
|
|
12210
12435
|
mcpPaths.recommended.relativeFilePath
|
|
12211
12436
|
);
|
|
@@ -12215,30 +12440,30 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12215
12440
|
} else {
|
|
12216
12441
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
12217
12442
|
}
|
|
12218
|
-
const commandFilepath =
|
|
12443
|
+
const commandFilepath = join95(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
12219
12444
|
if (!await fileExists(commandFilepath)) {
|
|
12220
12445
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
12221
12446
|
logger.success(`Created ${commandFilepath}`);
|
|
12222
12447
|
} else {
|
|
12223
12448
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
12224
12449
|
}
|
|
12225
|
-
const subagentFilepath =
|
|
12450
|
+
const subagentFilepath = join95(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
12226
12451
|
if (!await fileExists(subagentFilepath)) {
|
|
12227
12452
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
12228
12453
|
logger.success(`Created ${subagentFilepath}`);
|
|
12229
12454
|
} else {
|
|
12230
12455
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
12231
12456
|
}
|
|
12232
|
-
const skillDirPath =
|
|
12457
|
+
const skillDirPath = join95(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
12233
12458
|
await ensureDir(skillDirPath);
|
|
12234
|
-
const skillFilepath =
|
|
12459
|
+
const skillFilepath = join95(skillDirPath, SKILL_FILE_NAME);
|
|
12235
12460
|
if (!await fileExists(skillFilepath)) {
|
|
12236
12461
|
await writeFileContent(skillFilepath, sampleSkillFile.content);
|
|
12237
12462
|
logger.success(`Created ${skillFilepath}`);
|
|
12238
12463
|
} else {
|
|
12239
12464
|
logger.info(`Skipped ${skillFilepath} (already exists)`);
|
|
12240
12465
|
}
|
|
12241
|
-
const ignoreFilepath =
|
|
12466
|
+
const ignoreFilepath = join95(
|
|
12242
12467
|
ignorePaths.recommended.relativeDirPath,
|
|
12243
12468
|
ignorePaths.recommended.relativeFilePath
|
|
12244
12469
|
);
|
|
@@ -12257,12 +12482,12 @@ import { FastMCP } from "fastmcp";
|
|
|
12257
12482
|
import { z as z49 } from "zod/mini";
|
|
12258
12483
|
|
|
12259
12484
|
// src/mcp/commands.ts
|
|
12260
|
-
import { basename as
|
|
12485
|
+
import { basename as basename25, join as join96 } from "path";
|
|
12261
12486
|
import { z as z43 } from "zod/mini";
|
|
12262
12487
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
12263
12488
|
var maxCommandsCount = 1e3;
|
|
12264
12489
|
async function listCommands() {
|
|
12265
|
-
const commandsDir =
|
|
12490
|
+
const commandsDir = join96(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12266
12491
|
try {
|
|
12267
12492
|
const files = await listDirectoryFiles(commandsDir);
|
|
12268
12493
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12274,7 +12499,7 @@ async function listCommands() {
|
|
|
12274
12499
|
});
|
|
12275
12500
|
const frontmatter = command.getFrontmatter();
|
|
12276
12501
|
return {
|
|
12277
|
-
relativePathFromCwd:
|
|
12502
|
+
relativePathFromCwd: join96(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
12278
12503
|
frontmatter
|
|
12279
12504
|
};
|
|
12280
12505
|
} catch (error) {
|
|
@@ -12294,13 +12519,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
12294
12519
|
relativePath: relativePathFromCwd,
|
|
12295
12520
|
intendedRootDir: process.cwd()
|
|
12296
12521
|
});
|
|
12297
|
-
const filename =
|
|
12522
|
+
const filename = basename25(relativePathFromCwd);
|
|
12298
12523
|
try {
|
|
12299
12524
|
const command = await RulesyncCommand.fromFile({
|
|
12300
12525
|
relativeFilePath: filename
|
|
12301
12526
|
});
|
|
12302
12527
|
return {
|
|
12303
|
-
relativePathFromCwd:
|
|
12528
|
+
relativePathFromCwd: join96(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12304
12529
|
frontmatter: command.getFrontmatter(),
|
|
12305
12530
|
body: command.getBody()
|
|
12306
12531
|
};
|
|
@@ -12319,7 +12544,7 @@ async function putCommand({
|
|
|
12319
12544
|
relativePath: relativePathFromCwd,
|
|
12320
12545
|
intendedRootDir: process.cwd()
|
|
12321
12546
|
});
|
|
12322
|
-
const filename =
|
|
12547
|
+
const filename = basename25(relativePathFromCwd);
|
|
12323
12548
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12324
12549
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
12325
12550
|
throw new Error(
|
|
@@ -12329,7 +12554,7 @@ async function putCommand({
|
|
|
12329
12554
|
try {
|
|
12330
12555
|
const existingCommands = await listCommands();
|
|
12331
12556
|
const isUpdate = existingCommands.some(
|
|
12332
|
-
(command2) => command2.relativePathFromCwd ===
|
|
12557
|
+
(command2) => command2.relativePathFromCwd === join96(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12333
12558
|
);
|
|
12334
12559
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
12335
12560
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -12344,11 +12569,11 @@ async function putCommand({
|
|
|
12344
12569
|
fileContent,
|
|
12345
12570
|
validate: true
|
|
12346
12571
|
});
|
|
12347
|
-
const commandsDir =
|
|
12572
|
+
const commandsDir = join96(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12348
12573
|
await ensureDir(commandsDir);
|
|
12349
12574
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
12350
12575
|
return {
|
|
12351
|
-
relativePathFromCwd:
|
|
12576
|
+
relativePathFromCwd: join96(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12352
12577
|
frontmatter: command.getFrontmatter(),
|
|
12353
12578
|
body: command.getBody()
|
|
12354
12579
|
};
|
|
@@ -12363,12 +12588,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12363
12588
|
relativePath: relativePathFromCwd,
|
|
12364
12589
|
intendedRootDir: process.cwd()
|
|
12365
12590
|
});
|
|
12366
|
-
const filename =
|
|
12367
|
-
const fullPath =
|
|
12591
|
+
const filename = basename25(relativePathFromCwd);
|
|
12592
|
+
const fullPath = join96(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
12368
12593
|
try {
|
|
12369
12594
|
await removeFile(fullPath);
|
|
12370
12595
|
return {
|
|
12371
|
-
relativePathFromCwd:
|
|
12596
|
+
relativePathFromCwd: join96(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12372
12597
|
};
|
|
12373
12598
|
} catch (error) {
|
|
12374
12599
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12393,7 +12618,7 @@ var commandToolSchemas = {
|
|
|
12393
12618
|
var commandTools = {
|
|
12394
12619
|
listCommands: {
|
|
12395
12620
|
name: "listCommands",
|
|
12396
|
-
description: `List all commands from ${
|
|
12621
|
+
description: `List all commands from ${join96(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12397
12622
|
parameters: commandToolSchemas.listCommands,
|
|
12398
12623
|
execute: async () => {
|
|
12399
12624
|
const commands = await listCommands();
|
|
@@ -12435,11 +12660,11 @@ var commandTools = {
|
|
|
12435
12660
|
};
|
|
12436
12661
|
|
|
12437
12662
|
// src/mcp/ignore.ts
|
|
12438
|
-
import { join as
|
|
12663
|
+
import { join as join97 } from "path";
|
|
12439
12664
|
import { z as z44 } from "zod/mini";
|
|
12440
12665
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
12441
12666
|
async function getIgnoreFile() {
|
|
12442
|
-
const ignoreFilePath =
|
|
12667
|
+
const ignoreFilePath = join97(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12443
12668
|
try {
|
|
12444
12669
|
const content = await readFileContent(ignoreFilePath);
|
|
12445
12670
|
return {
|
|
@@ -12453,7 +12678,7 @@ async function getIgnoreFile() {
|
|
|
12453
12678
|
}
|
|
12454
12679
|
}
|
|
12455
12680
|
async function putIgnoreFile({ content }) {
|
|
12456
|
-
const ignoreFilePath =
|
|
12681
|
+
const ignoreFilePath = join97(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12457
12682
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
12458
12683
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
12459
12684
|
throw new Error(
|
|
@@ -12474,8 +12699,8 @@ async function putIgnoreFile({ content }) {
|
|
|
12474
12699
|
}
|
|
12475
12700
|
}
|
|
12476
12701
|
async function deleteIgnoreFile() {
|
|
12477
|
-
const aiignorePath =
|
|
12478
|
-
const legacyIgnorePath =
|
|
12702
|
+
const aiignorePath = join97(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12703
|
+
const legacyIgnorePath = join97(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
12479
12704
|
try {
|
|
12480
12705
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
12481
12706
|
return {
|
|
@@ -12530,7 +12755,7 @@ var ignoreTools = {
|
|
|
12530
12755
|
};
|
|
12531
12756
|
|
|
12532
12757
|
// src/mcp/mcp.ts
|
|
12533
|
-
import { join as
|
|
12758
|
+
import { join as join98 } from "path";
|
|
12534
12759
|
import { z as z45 } from "zod/mini";
|
|
12535
12760
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
12536
12761
|
async function getMcpFile() {
|
|
@@ -12540,7 +12765,7 @@ async function getMcpFile() {
|
|
|
12540
12765
|
validate: true,
|
|
12541
12766
|
modularMcp: config.getModularMcp()
|
|
12542
12767
|
});
|
|
12543
|
-
const relativePathFromCwd =
|
|
12768
|
+
const relativePathFromCwd = join98(
|
|
12544
12769
|
rulesyncMcp.getRelativeDirPath(),
|
|
12545
12770
|
rulesyncMcp.getRelativeFilePath()
|
|
12546
12771
|
);
|
|
@@ -12573,7 +12798,7 @@ async function putMcpFile({ content }) {
|
|
|
12573
12798
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12574
12799
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
12575
12800
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
12576
|
-
const fullPath =
|
|
12801
|
+
const fullPath = join98(baseDir, relativeDirPath, relativeFilePath);
|
|
12577
12802
|
const rulesyncMcp = new RulesyncMcp({
|
|
12578
12803
|
baseDir,
|
|
12579
12804
|
relativeDirPath,
|
|
@@ -12582,9 +12807,9 @@ async function putMcpFile({ content }) {
|
|
|
12582
12807
|
validate: true,
|
|
12583
12808
|
modularMcp: config.getModularMcp()
|
|
12584
12809
|
});
|
|
12585
|
-
await ensureDir(
|
|
12810
|
+
await ensureDir(join98(baseDir, relativeDirPath));
|
|
12586
12811
|
await writeFileContent(fullPath, content);
|
|
12587
|
-
const relativePathFromCwd =
|
|
12812
|
+
const relativePathFromCwd = join98(relativeDirPath, relativeFilePath);
|
|
12588
12813
|
return {
|
|
12589
12814
|
relativePathFromCwd,
|
|
12590
12815
|
content: rulesyncMcp.getFileContent()
|
|
@@ -12599,15 +12824,15 @@ async function deleteMcpFile() {
|
|
|
12599
12824
|
try {
|
|
12600
12825
|
const baseDir = process.cwd();
|
|
12601
12826
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12602
|
-
const recommendedPath =
|
|
12827
|
+
const recommendedPath = join98(
|
|
12603
12828
|
baseDir,
|
|
12604
12829
|
paths.recommended.relativeDirPath,
|
|
12605
12830
|
paths.recommended.relativeFilePath
|
|
12606
12831
|
);
|
|
12607
|
-
const legacyPath =
|
|
12832
|
+
const legacyPath = join98(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
12608
12833
|
await removeFile(recommendedPath);
|
|
12609
12834
|
await removeFile(legacyPath);
|
|
12610
|
-
const relativePathFromCwd =
|
|
12835
|
+
const relativePathFromCwd = join98(
|
|
12611
12836
|
paths.recommended.relativeDirPath,
|
|
12612
12837
|
paths.recommended.relativeFilePath
|
|
12613
12838
|
);
|
|
@@ -12658,12 +12883,12 @@ var mcpTools = {
|
|
|
12658
12883
|
};
|
|
12659
12884
|
|
|
12660
12885
|
// src/mcp/rules.ts
|
|
12661
|
-
import { basename as
|
|
12886
|
+
import { basename as basename26, join as join99 } from "path";
|
|
12662
12887
|
import { z as z46 } from "zod/mini";
|
|
12663
12888
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
12664
12889
|
var maxRulesCount = 1e3;
|
|
12665
12890
|
async function listRules() {
|
|
12666
|
-
const rulesDir =
|
|
12891
|
+
const rulesDir = join99(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12667
12892
|
try {
|
|
12668
12893
|
const files = await listDirectoryFiles(rulesDir);
|
|
12669
12894
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12676,7 +12901,7 @@ async function listRules() {
|
|
|
12676
12901
|
});
|
|
12677
12902
|
const frontmatter = rule.getFrontmatter();
|
|
12678
12903
|
return {
|
|
12679
|
-
relativePathFromCwd:
|
|
12904
|
+
relativePathFromCwd: join99(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
12680
12905
|
frontmatter
|
|
12681
12906
|
};
|
|
12682
12907
|
} catch (error) {
|
|
@@ -12696,14 +12921,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
12696
12921
|
relativePath: relativePathFromCwd,
|
|
12697
12922
|
intendedRootDir: process.cwd()
|
|
12698
12923
|
});
|
|
12699
|
-
const filename =
|
|
12924
|
+
const filename = basename26(relativePathFromCwd);
|
|
12700
12925
|
try {
|
|
12701
12926
|
const rule = await RulesyncRule.fromFile({
|
|
12702
12927
|
relativeFilePath: filename,
|
|
12703
12928
|
validate: true
|
|
12704
12929
|
});
|
|
12705
12930
|
return {
|
|
12706
|
-
relativePathFromCwd:
|
|
12931
|
+
relativePathFromCwd: join99(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12707
12932
|
frontmatter: rule.getFrontmatter(),
|
|
12708
12933
|
body: rule.getBody()
|
|
12709
12934
|
};
|
|
@@ -12722,7 +12947,7 @@ async function putRule({
|
|
|
12722
12947
|
relativePath: relativePathFromCwd,
|
|
12723
12948
|
intendedRootDir: process.cwd()
|
|
12724
12949
|
});
|
|
12725
|
-
const filename =
|
|
12950
|
+
const filename = basename26(relativePathFromCwd);
|
|
12726
12951
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12727
12952
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
12728
12953
|
throw new Error(
|
|
@@ -12732,7 +12957,7 @@ async function putRule({
|
|
|
12732
12957
|
try {
|
|
12733
12958
|
const existingRules = await listRules();
|
|
12734
12959
|
const isUpdate = existingRules.some(
|
|
12735
|
-
(rule2) => rule2.relativePathFromCwd ===
|
|
12960
|
+
(rule2) => rule2.relativePathFromCwd === join99(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12736
12961
|
);
|
|
12737
12962
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
12738
12963
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -12745,11 +12970,11 @@ async function putRule({
|
|
|
12745
12970
|
body,
|
|
12746
12971
|
validate: true
|
|
12747
12972
|
});
|
|
12748
|
-
const rulesDir =
|
|
12973
|
+
const rulesDir = join99(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12749
12974
|
await ensureDir(rulesDir);
|
|
12750
12975
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
12751
12976
|
return {
|
|
12752
|
-
relativePathFromCwd:
|
|
12977
|
+
relativePathFromCwd: join99(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12753
12978
|
frontmatter: rule.getFrontmatter(),
|
|
12754
12979
|
body: rule.getBody()
|
|
12755
12980
|
};
|
|
@@ -12764,12 +12989,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
12764
12989
|
relativePath: relativePathFromCwd,
|
|
12765
12990
|
intendedRootDir: process.cwd()
|
|
12766
12991
|
});
|
|
12767
|
-
const filename =
|
|
12768
|
-
const fullPath =
|
|
12992
|
+
const filename = basename26(relativePathFromCwd);
|
|
12993
|
+
const fullPath = join99(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
12769
12994
|
try {
|
|
12770
12995
|
await removeFile(fullPath);
|
|
12771
12996
|
return {
|
|
12772
|
-
relativePathFromCwd:
|
|
12997
|
+
relativePathFromCwd: join99(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12773
12998
|
};
|
|
12774
12999
|
} catch (error) {
|
|
12775
13000
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12794,7 +13019,7 @@ var ruleToolSchemas = {
|
|
|
12794
13019
|
var ruleTools = {
|
|
12795
13020
|
listRules: {
|
|
12796
13021
|
name: "listRules",
|
|
12797
|
-
description: `List all rules from ${
|
|
13022
|
+
description: `List all rules from ${join99(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12798
13023
|
parameters: ruleToolSchemas.listRules,
|
|
12799
13024
|
execute: async () => {
|
|
12800
13025
|
const rules = await listRules();
|
|
@@ -12836,7 +13061,7 @@ var ruleTools = {
|
|
|
12836
13061
|
};
|
|
12837
13062
|
|
|
12838
13063
|
// src/mcp/skills.ts
|
|
12839
|
-
import { basename as
|
|
13064
|
+
import { basename as basename27, dirname as dirname2, join as join100 } from "path";
|
|
12840
13065
|
import { z as z47 } from "zod/mini";
|
|
12841
13066
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
12842
13067
|
var maxSkillsCount = 1e3;
|
|
@@ -12853,19 +13078,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
12853
13078
|
};
|
|
12854
13079
|
}
|
|
12855
13080
|
function extractDirName(relativeDirPathFromCwd) {
|
|
12856
|
-
const dirName =
|
|
13081
|
+
const dirName = basename27(relativeDirPathFromCwd);
|
|
12857
13082
|
if (!dirName) {
|
|
12858
13083
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
12859
13084
|
}
|
|
12860
13085
|
return dirName;
|
|
12861
13086
|
}
|
|
12862
13087
|
async function listSkills() {
|
|
12863
|
-
const skillsDir =
|
|
13088
|
+
const skillsDir = join100(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
12864
13089
|
try {
|
|
12865
|
-
const skillDirPaths = await findFilesByGlobs(
|
|
13090
|
+
const skillDirPaths = await findFilesByGlobs(join100(skillsDir, "*"), { type: "dir" });
|
|
12866
13091
|
const skills = await Promise.all(
|
|
12867
13092
|
skillDirPaths.map(async (dirPath) => {
|
|
12868
|
-
const dirName =
|
|
13093
|
+
const dirName = basename27(dirPath);
|
|
12869
13094
|
if (!dirName) return null;
|
|
12870
13095
|
try {
|
|
12871
13096
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -12873,7 +13098,7 @@ async function listSkills() {
|
|
|
12873
13098
|
});
|
|
12874
13099
|
const frontmatter = skill.getFrontmatter();
|
|
12875
13100
|
return {
|
|
12876
|
-
relativeDirPathFromCwd:
|
|
13101
|
+
relativeDirPathFromCwd: join100(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12877
13102
|
frontmatter
|
|
12878
13103
|
};
|
|
12879
13104
|
} catch (error) {
|
|
@@ -12899,7 +13124,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
12899
13124
|
dirName
|
|
12900
13125
|
});
|
|
12901
13126
|
return {
|
|
12902
|
-
relativeDirPathFromCwd:
|
|
13127
|
+
relativeDirPathFromCwd: join100(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12903
13128
|
frontmatter: skill.getFrontmatter(),
|
|
12904
13129
|
body: skill.getBody(),
|
|
12905
13130
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12933,7 +13158,7 @@ async function putSkill({
|
|
|
12933
13158
|
try {
|
|
12934
13159
|
const existingSkills = await listSkills();
|
|
12935
13160
|
const isUpdate = existingSkills.some(
|
|
12936
|
-
(skill2) => skill2.relativeDirPathFromCwd ===
|
|
13161
|
+
(skill2) => skill2.relativeDirPathFromCwd === join100(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12937
13162
|
);
|
|
12938
13163
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
12939
13164
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -12948,9 +13173,9 @@ async function putSkill({
|
|
|
12948
13173
|
otherFiles: aiDirFiles,
|
|
12949
13174
|
validate: true
|
|
12950
13175
|
});
|
|
12951
|
-
const skillDirPath =
|
|
13176
|
+
const skillDirPath = join100(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12952
13177
|
await ensureDir(skillDirPath);
|
|
12953
|
-
const skillFilePath =
|
|
13178
|
+
const skillFilePath = join100(skillDirPath, SKILL_FILE_NAME);
|
|
12954
13179
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
12955
13180
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
12956
13181
|
for (const file of otherFiles) {
|
|
@@ -12958,15 +13183,15 @@ async function putSkill({
|
|
|
12958
13183
|
relativePath: file.name,
|
|
12959
13184
|
intendedRootDir: skillDirPath
|
|
12960
13185
|
});
|
|
12961
|
-
const filePath =
|
|
12962
|
-
const fileDir =
|
|
13186
|
+
const filePath = join100(skillDirPath, file.name);
|
|
13187
|
+
const fileDir = join100(skillDirPath, dirname2(file.name));
|
|
12963
13188
|
if (fileDir !== skillDirPath) {
|
|
12964
13189
|
await ensureDir(fileDir);
|
|
12965
13190
|
}
|
|
12966
13191
|
await writeFileContent(filePath, file.body);
|
|
12967
13192
|
}
|
|
12968
13193
|
return {
|
|
12969
|
-
relativeDirPathFromCwd:
|
|
13194
|
+
relativeDirPathFromCwd: join100(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12970
13195
|
frontmatter: skill.getFrontmatter(),
|
|
12971
13196
|
body: skill.getBody(),
|
|
12972
13197
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12988,13 +13213,13 @@ async function deleteSkill({
|
|
|
12988
13213
|
intendedRootDir: process.cwd()
|
|
12989
13214
|
});
|
|
12990
13215
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
12991
|
-
const skillDirPath =
|
|
13216
|
+
const skillDirPath = join100(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12992
13217
|
try {
|
|
12993
13218
|
if (await directoryExists(skillDirPath)) {
|
|
12994
13219
|
await removeDirectory(skillDirPath);
|
|
12995
13220
|
}
|
|
12996
13221
|
return {
|
|
12997
|
-
relativeDirPathFromCwd:
|
|
13222
|
+
relativeDirPathFromCwd: join100(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12998
13223
|
};
|
|
12999
13224
|
} catch (error) {
|
|
13000
13225
|
throw new Error(
|
|
@@ -13027,7 +13252,7 @@ var skillToolSchemas = {
|
|
|
13027
13252
|
var skillTools = {
|
|
13028
13253
|
listSkills: {
|
|
13029
13254
|
name: "listSkills",
|
|
13030
|
-
description: `List all skills from ${
|
|
13255
|
+
description: `List all skills from ${join100(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
13031
13256
|
parameters: skillToolSchemas.listSkills,
|
|
13032
13257
|
execute: async () => {
|
|
13033
13258
|
const skills = await listSkills();
|
|
@@ -13070,12 +13295,12 @@ var skillTools = {
|
|
|
13070
13295
|
};
|
|
13071
13296
|
|
|
13072
13297
|
// src/mcp/subagents.ts
|
|
13073
|
-
import { basename as
|
|
13298
|
+
import { basename as basename28, join as join101 } from "path";
|
|
13074
13299
|
import { z as z48 } from "zod/mini";
|
|
13075
13300
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
13076
13301
|
var maxSubagentsCount = 1e3;
|
|
13077
13302
|
async function listSubagents() {
|
|
13078
|
-
const subagentsDir =
|
|
13303
|
+
const subagentsDir = join101(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13079
13304
|
try {
|
|
13080
13305
|
const files = await listDirectoryFiles(subagentsDir);
|
|
13081
13306
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13088,7 +13313,7 @@ async function listSubagents() {
|
|
|
13088
13313
|
});
|
|
13089
13314
|
const frontmatter = subagent.getFrontmatter();
|
|
13090
13315
|
return {
|
|
13091
|
-
relativePathFromCwd:
|
|
13316
|
+
relativePathFromCwd: join101(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
13092
13317
|
frontmatter
|
|
13093
13318
|
};
|
|
13094
13319
|
} catch (error) {
|
|
@@ -13110,14 +13335,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
13110
13335
|
relativePath: relativePathFromCwd,
|
|
13111
13336
|
intendedRootDir: process.cwd()
|
|
13112
13337
|
});
|
|
13113
|
-
const filename =
|
|
13338
|
+
const filename = basename28(relativePathFromCwd);
|
|
13114
13339
|
try {
|
|
13115
13340
|
const subagent = await RulesyncSubagent.fromFile({
|
|
13116
13341
|
relativeFilePath: filename,
|
|
13117
13342
|
validate: true
|
|
13118
13343
|
});
|
|
13119
13344
|
return {
|
|
13120
|
-
relativePathFromCwd:
|
|
13345
|
+
relativePathFromCwd: join101(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13121
13346
|
frontmatter: subagent.getFrontmatter(),
|
|
13122
13347
|
body: subagent.getBody()
|
|
13123
13348
|
};
|
|
@@ -13136,7 +13361,7 @@ async function putSubagent({
|
|
|
13136
13361
|
relativePath: relativePathFromCwd,
|
|
13137
13362
|
intendedRootDir: process.cwd()
|
|
13138
13363
|
});
|
|
13139
|
-
const filename =
|
|
13364
|
+
const filename = basename28(relativePathFromCwd);
|
|
13140
13365
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
13141
13366
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
13142
13367
|
throw new Error(
|
|
@@ -13146,7 +13371,7 @@ async function putSubagent({
|
|
|
13146
13371
|
try {
|
|
13147
13372
|
const existingSubagents = await listSubagents();
|
|
13148
13373
|
const isUpdate = existingSubagents.some(
|
|
13149
|
-
(subagent2) => subagent2.relativePathFromCwd ===
|
|
13374
|
+
(subagent2) => subagent2.relativePathFromCwd === join101(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13150
13375
|
);
|
|
13151
13376
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
13152
13377
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -13159,11 +13384,11 @@ async function putSubagent({
|
|
|
13159
13384
|
body,
|
|
13160
13385
|
validate: true
|
|
13161
13386
|
});
|
|
13162
|
-
const subagentsDir =
|
|
13387
|
+
const subagentsDir = join101(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13163
13388
|
await ensureDir(subagentsDir);
|
|
13164
13389
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
13165
13390
|
return {
|
|
13166
|
-
relativePathFromCwd:
|
|
13391
|
+
relativePathFromCwd: join101(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13167
13392
|
frontmatter: subagent.getFrontmatter(),
|
|
13168
13393
|
body: subagent.getBody()
|
|
13169
13394
|
};
|
|
@@ -13178,12 +13403,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
13178
13403
|
relativePath: relativePathFromCwd,
|
|
13179
13404
|
intendedRootDir: process.cwd()
|
|
13180
13405
|
});
|
|
13181
|
-
const filename =
|
|
13182
|
-
const fullPath =
|
|
13406
|
+
const filename = basename28(relativePathFromCwd);
|
|
13407
|
+
const fullPath = join101(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
13183
13408
|
try {
|
|
13184
13409
|
await removeFile(fullPath);
|
|
13185
13410
|
return {
|
|
13186
|
-
relativePathFromCwd:
|
|
13411
|
+
relativePathFromCwd: join101(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13187
13412
|
};
|
|
13188
13413
|
} catch (error) {
|
|
13189
13414
|
throw new Error(
|
|
@@ -13211,7 +13436,7 @@ var subagentToolSchemas = {
|
|
|
13211
13436
|
var subagentTools = {
|
|
13212
13437
|
listSubagents: {
|
|
13213
13438
|
name: "listSubagents",
|
|
13214
|
-
description: `List all subagents from ${
|
|
13439
|
+
description: `List all subagents from ${join101(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13215
13440
|
parameters: subagentToolSchemas.listSubagents,
|
|
13216
13441
|
execute: async () => {
|
|
13217
13442
|
const subagents = await listSubagents();
|
|
@@ -13462,7 +13687,7 @@ async function mcpCommand({ version }) {
|
|
|
13462
13687
|
}
|
|
13463
13688
|
|
|
13464
13689
|
// src/cli/index.ts
|
|
13465
|
-
var getVersion = () => "5.
|
|
13690
|
+
var getVersion = () => "5.5.1";
|
|
13466
13691
|
var main = async () => {
|
|
13467
13692
|
const program = new Command();
|
|
13468
13693
|
const version = getVersion();
|