rulesync 5.3.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -19
- package/dist/index.cjs +1081 -568
- package/dist/index.js +1074 -561
- package/package.json +18 -18
package/dist/index.cjs
CHANGED
|
@@ -271,6 +271,7 @@ var ALL_TOOL_TARGETS = [
|
|
|
271
271
|
"kiro",
|
|
272
272
|
"opencode",
|
|
273
273
|
"qwencode",
|
|
274
|
+
"replit",
|
|
274
275
|
"roo",
|
|
275
276
|
"warp",
|
|
276
277
|
"windsurf",
|
|
@@ -486,7 +487,7 @@ var RULESYNC_OVERVIEW_FILE_NAME = "overview.md";
|
|
|
486
487
|
var RULESYNC_SKILLS_RELATIVE_DIR_PATH = (0, import_node_path3.join)(RULESYNC_RELATIVE_DIR_PATH, "skills");
|
|
487
488
|
|
|
488
489
|
// src/features/commands/commands-processor.ts
|
|
489
|
-
var
|
|
490
|
+
var import_node_path19 = require("path");
|
|
490
491
|
var import_mini12 = require("zod/mini");
|
|
491
492
|
|
|
492
493
|
// src/types/feature-processor.ts
|
|
@@ -904,6 +905,11 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
904
905
|
var import_node_path8 = require("path");
|
|
905
906
|
var import_mini6 = require("zod/mini");
|
|
906
907
|
|
|
908
|
+
// src/utils/type-guards.ts
|
|
909
|
+
function isRecord(value) {
|
|
910
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
911
|
+
}
|
|
912
|
+
|
|
907
913
|
// src/features/commands/rulesync-command.ts
|
|
908
914
|
var import_node_path7 = require("path");
|
|
909
915
|
var import_mini5 = require("zod/mini");
|
|
@@ -996,8 +1002,14 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
996
1002
|
};
|
|
997
1003
|
|
|
998
1004
|
// src/features/commands/antigravity-command.ts
|
|
999
|
-
var
|
|
1000
|
-
|
|
1005
|
+
var AntigravityWorkflowFrontmatterSchema = import_mini6.z.looseObject({
|
|
1006
|
+
trigger: import_mini6.z.optional(import_mini6.z.string()),
|
|
1007
|
+
turbo: import_mini6.z.optional(import_mini6.z.boolean())
|
|
1008
|
+
});
|
|
1009
|
+
var AntigravityCommandFrontmatterSchema = import_mini6.z.looseObject({
|
|
1010
|
+
description: import_mini6.z.string(),
|
|
1011
|
+
// Support for workflow-specific configuration
|
|
1012
|
+
...AntigravityWorkflowFrontmatterSchema.shape
|
|
1001
1013
|
});
|
|
1002
1014
|
var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
1003
1015
|
frontmatter;
|
|
@@ -1030,9 +1042,12 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1030
1042
|
return this.frontmatter;
|
|
1031
1043
|
}
|
|
1032
1044
|
toRulesyncCommand() {
|
|
1045
|
+
const { description, ...restFields } = this.frontmatter;
|
|
1033
1046
|
const rulesyncFrontmatter = {
|
|
1034
1047
|
targets: ["antigravity"],
|
|
1035
|
-
description
|
|
1048
|
+
description,
|
|
1049
|
+
// Preserve extra fields in antigravity section
|
|
1050
|
+
...Object.keys(restFields).length > 0 && { antigravity: restFields }
|
|
1036
1051
|
};
|
|
1037
1052
|
const fileContent = stringifyFrontmatter(this.body, rulesyncFrontmatter);
|
|
1038
1053
|
return new RulesyncCommand({
|
|
@@ -1046,27 +1061,56 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1046
1061
|
validate: true
|
|
1047
1062
|
});
|
|
1048
1063
|
}
|
|
1064
|
+
static extractAntigravityConfig(rulesyncCommand) {
|
|
1065
|
+
const antigravity = rulesyncCommand.getFrontmatter().antigravity;
|
|
1066
|
+
return isRecord(antigravity) ? antigravity : void 0;
|
|
1067
|
+
}
|
|
1049
1068
|
static fromRulesyncCommand({
|
|
1050
1069
|
baseDir = process.cwd(),
|
|
1051
1070
|
rulesyncCommand,
|
|
1052
1071
|
validate = true
|
|
1053
1072
|
}) {
|
|
1054
1073
|
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
1074
|
+
const antigravityConfig = this.extractAntigravityConfig(rulesyncCommand);
|
|
1075
|
+
const trigger = this.resolveTrigger(rulesyncCommand, antigravityConfig);
|
|
1076
|
+
const turbo = typeof antigravityConfig?.turbo === "boolean" ? antigravityConfig.turbo : true;
|
|
1077
|
+
let relativeFilePath = rulesyncCommand.getRelativeFilePath();
|
|
1078
|
+
let body = rulesyncCommand.getBody().replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, "").trim();
|
|
1079
|
+
const sanitizedTrigger = trigger.replace(/[^a-zA-Z0-9-_]/g, "-").replace(/^-+|-+$/g, "");
|
|
1080
|
+
if (!sanitizedTrigger) {
|
|
1081
|
+
throw new Error(`Invalid trigger: sanitization resulted in empty string from "${trigger}"`);
|
|
1082
|
+
}
|
|
1083
|
+
const validFilename = sanitizedTrigger + ".md";
|
|
1084
|
+
relativeFilePath = validFilename;
|
|
1085
|
+
const turboDirective = turbo ? "\n\n// turbo" : "";
|
|
1086
|
+
body = `# Workflow: ${trigger}
|
|
1087
|
+
|
|
1088
|
+
${body}${turboDirective}`;
|
|
1089
|
+
const description = rulesyncFrontmatter.description;
|
|
1055
1090
|
const antigravityFrontmatter = {
|
|
1056
|
-
description
|
|
1091
|
+
description,
|
|
1092
|
+
trigger,
|
|
1093
|
+
turbo
|
|
1057
1094
|
};
|
|
1058
|
-
const body = rulesyncCommand.getBody();
|
|
1059
1095
|
const fileContent = stringifyFrontmatter(body, antigravityFrontmatter);
|
|
1060
1096
|
return new _AntigravityCommand({
|
|
1061
1097
|
baseDir,
|
|
1062
1098
|
frontmatter: antigravityFrontmatter,
|
|
1063
1099
|
body,
|
|
1064
1100
|
relativeDirPath: _AntigravityCommand.getSettablePaths().relativeDirPath,
|
|
1065
|
-
relativeFilePath
|
|
1101
|
+
relativeFilePath,
|
|
1066
1102
|
fileContent,
|
|
1067
1103
|
validate
|
|
1068
1104
|
});
|
|
1069
1105
|
}
|
|
1106
|
+
static resolveTrigger(rulesyncCommand, antigravityConfig) {
|
|
1107
|
+
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
1108
|
+
const antigravityTrigger = antigravityConfig && typeof antigravityConfig.trigger === "string" ? antigravityConfig.trigger : void 0;
|
|
1109
|
+
const rootTrigger = typeof rulesyncFrontmatter.trigger === "string" ? rulesyncFrontmatter.trigger : void 0;
|
|
1110
|
+
const bodyTriggerMatch = rulesyncCommand.getBody().match(/trigger:\s*(\/[\w-]+)/);
|
|
1111
|
+
const filenameTrigger = `/${(0, import_node_path8.basename)(rulesyncCommand.getRelativeFilePath(), ".md")}`;
|
|
1112
|
+
return antigravityTrigger || rootTrigger || (bodyTriggerMatch ? bodyTriggerMatch[1] : void 0) || filenameTrigger;
|
|
1113
|
+
}
|
|
1070
1114
|
validate() {
|
|
1071
1115
|
if (!this.frontmatter) {
|
|
1072
1116
|
return { success: true, error: null };
|
|
@@ -1899,8 +1943,89 @@ var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
|
1899
1943
|
}
|
|
1900
1944
|
};
|
|
1901
1945
|
|
|
1902
|
-
// src/features/commands/
|
|
1946
|
+
// src/features/commands/kiro-command.ts
|
|
1903
1947
|
var import_node_path16 = require("path");
|
|
1948
|
+
var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
1949
|
+
static getSettablePaths(_options = {}) {
|
|
1950
|
+
return {
|
|
1951
|
+
relativeDirPath: (0, import_node_path16.join)(".kiro", "prompts")
|
|
1952
|
+
};
|
|
1953
|
+
}
|
|
1954
|
+
toRulesyncCommand() {
|
|
1955
|
+
const rulesyncFrontmatter = {
|
|
1956
|
+
targets: ["*"],
|
|
1957
|
+
description: ""
|
|
1958
|
+
};
|
|
1959
|
+
return new RulesyncCommand({
|
|
1960
|
+
baseDir: process.cwd(),
|
|
1961
|
+
frontmatter: rulesyncFrontmatter,
|
|
1962
|
+
body: this.getFileContent(),
|
|
1963
|
+
relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
1964
|
+
relativeFilePath: this.relativeFilePath,
|
|
1965
|
+
fileContent: this.getFileContent(),
|
|
1966
|
+
validate: true
|
|
1967
|
+
});
|
|
1968
|
+
}
|
|
1969
|
+
static fromRulesyncCommand({
|
|
1970
|
+
baseDir = process.cwd(),
|
|
1971
|
+
rulesyncCommand,
|
|
1972
|
+
validate = true
|
|
1973
|
+
}) {
|
|
1974
|
+
const paths = this.getSettablePaths();
|
|
1975
|
+
return new _KiroCommand({
|
|
1976
|
+
baseDir,
|
|
1977
|
+
fileContent: rulesyncCommand.getBody(),
|
|
1978
|
+
relativeDirPath: paths.relativeDirPath,
|
|
1979
|
+
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
1980
|
+
validate
|
|
1981
|
+
});
|
|
1982
|
+
}
|
|
1983
|
+
validate() {
|
|
1984
|
+
return { success: true, error: null };
|
|
1985
|
+
}
|
|
1986
|
+
getBody() {
|
|
1987
|
+
return this.getFileContent();
|
|
1988
|
+
}
|
|
1989
|
+
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
1990
|
+
return this.isTargetedByRulesyncCommandDefault({
|
|
1991
|
+
rulesyncCommand,
|
|
1992
|
+
toolTarget: "kiro"
|
|
1993
|
+
});
|
|
1994
|
+
}
|
|
1995
|
+
static async fromFile({
|
|
1996
|
+
baseDir = process.cwd(),
|
|
1997
|
+
relativeFilePath,
|
|
1998
|
+
validate = true
|
|
1999
|
+
}) {
|
|
2000
|
+
const paths = this.getSettablePaths();
|
|
2001
|
+
const filePath = (0, import_node_path16.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2002
|
+
const fileContent = await readFileContent(filePath);
|
|
2003
|
+
const { body: content } = parseFrontmatter(fileContent);
|
|
2004
|
+
return new _KiroCommand({
|
|
2005
|
+
baseDir,
|
|
2006
|
+
relativeDirPath: paths.relativeDirPath,
|
|
2007
|
+
relativeFilePath: (0, import_node_path16.basename)(relativeFilePath),
|
|
2008
|
+
fileContent: content.trim(),
|
|
2009
|
+
validate
|
|
2010
|
+
});
|
|
2011
|
+
}
|
|
2012
|
+
static forDeletion({
|
|
2013
|
+
baseDir = process.cwd(),
|
|
2014
|
+
relativeDirPath,
|
|
2015
|
+
relativeFilePath
|
|
2016
|
+
}) {
|
|
2017
|
+
return new _KiroCommand({
|
|
2018
|
+
baseDir,
|
|
2019
|
+
relativeDirPath,
|
|
2020
|
+
relativeFilePath,
|
|
2021
|
+
fileContent: "",
|
|
2022
|
+
validate: false
|
|
2023
|
+
});
|
|
2024
|
+
}
|
|
2025
|
+
};
|
|
2026
|
+
|
|
2027
|
+
// src/features/commands/opencode-command.ts
|
|
2028
|
+
var import_node_path17 = require("path");
|
|
1904
2029
|
var import_mini10 = require("zod/mini");
|
|
1905
2030
|
var OpenCodeCommandFrontmatterSchema = import_mini10.z.looseObject({
|
|
1906
2031
|
description: import_mini10.z.string(),
|
|
@@ -1916,7 +2041,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1916
2041
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1917
2042
|
if (!result.success) {
|
|
1918
2043
|
throw new Error(
|
|
1919
|
-
`Invalid frontmatter in ${(0,
|
|
2044
|
+
`Invalid frontmatter in ${(0, import_node_path17.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1920
2045
|
);
|
|
1921
2046
|
}
|
|
1922
2047
|
}
|
|
@@ -1929,7 +2054,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1929
2054
|
}
|
|
1930
2055
|
static getSettablePaths({ global } = {}) {
|
|
1931
2056
|
return {
|
|
1932
|
-
relativeDirPath: global ? (0,
|
|
2057
|
+
relativeDirPath: global ? (0, import_node_path17.join)(".config", "opencode", "command") : (0, import_node_path17.join)(".opencode", "command")
|
|
1933
2058
|
};
|
|
1934
2059
|
}
|
|
1935
2060
|
getBody() {
|
|
@@ -1990,7 +2115,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1990
2115
|
return {
|
|
1991
2116
|
success: false,
|
|
1992
2117
|
error: new Error(
|
|
1993
|
-
`Invalid frontmatter in ${(0,
|
|
2118
|
+
`Invalid frontmatter in ${(0, import_node_path17.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1994
2119
|
)
|
|
1995
2120
|
};
|
|
1996
2121
|
}
|
|
@@ -2001,7 +2126,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2001
2126
|
global = false
|
|
2002
2127
|
}) {
|
|
2003
2128
|
const paths = this.getSettablePaths({ global });
|
|
2004
|
-
const filePath = (0,
|
|
2129
|
+
const filePath = (0, import_node_path17.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
2005
2130
|
const fileContent = await readFileContent(filePath);
|
|
2006
2131
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2007
2132
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2011,7 +2136,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2011
2136
|
return new _OpenCodeCommand({
|
|
2012
2137
|
baseDir,
|
|
2013
2138
|
relativeDirPath: paths.relativeDirPath,
|
|
2014
|
-
relativeFilePath: (0,
|
|
2139
|
+
relativeFilePath: (0, import_node_path17.basename)(relativeFilePath),
|
|
2015
2140
|
frontmatter: result.data,
|
|
2016
2141
|
body: content.trim(),
|
|
2017
2142
|
validate
|
|
@@ -2040,7 +2165,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2040
2165
|
};
|
|
2041
2166
|
|
|
2042
2167
|
// src/features/commands/roo-command.ts
|
|
2043
|
-
var
|
|
2168
|
+
var import_node_path18 = require("path");
|
|
2044
2169
|
var import_mini11 = require("zod/mini");
|
|
2045
2170
|
var RooCommandFrontmatterSchema = import_mini11.z.looseObject({
|
|
2046
2171
|
description: import_mini11.z.string(),
|
|
@@ -2051,7 +2176,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2051
2176
|
body;
|
|
2052
2177
|
static getSettablePaths() {
|
|
2053
2178
|
return {
|
|
2054
|
-
relativeDirPath: (0,
|
|
2179
|
+
relativeDirPath: (0, import_node_path18.join)(".roo", "commands")
|
|
2055
2180
|
};
|
|
2056
2181
|
}
|
|
2057
2182
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -2059,7 +2184,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2059
2184
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
2060
2185
|
if (!result.success) {
|
|
2061
2186
|
throw new Error(
|
|
2062
|
-
`Invalid frontmatter in ${(0,
|
|
2187
|
+
`Invalid frontmatter in ${(0, import_node_path18.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
2063
2188
|
);
|
|
2064
2189
|
}
|
|
2065
2190
|
}
|
|
@@ -2130,7 +2255,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2130
2255
|
return {
|
|
2131
2256
|
success: false,
|
|
2132
2257
|
error: new Error(
|
|
2133
|
-
`Invalid frontmatter in ${(0,
|
|
2258
|
+
`Invalid frontmatter in ${(0, import_node_path18.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
2134
2259
|
)
|
|
2135
2260
|
};
|
|
2136
2261
|
}
|
|
@@ -2146,7 +2271,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2146
2271
|
relativeFilePath,
|
|
2147
2272
|
validate = true
|
|
2148
2273
|
}) {
|
|
2149
|
-
const filePath = (0,
|
|
2274
|
+
const filePath = (0, import_node_path18.join)(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
2150
2275
|
const fileContent = await readFileContent(filePath);
|
|
2151
2276
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2152
2277
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2156,7 +2281,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2156
2281
|
return new _RooCommand({
|
|
2157
2282
|
baseDir,
|
|
2158
2283
|
relativeDirPath: _RooCommand.getSettablePaths().relativeDirPath,
|
|
2159
|
-
relativeFilePath: (0,
|
|
2284
|
+
relativeFilePath: (0, import_node_path18.basename)(relativeFilePath),
|
|
2160
2285
|
frontmatter: result.data,
|
|
2161
2286
|
body: content.trim(),
|
|
2162
2287
|
fileContent,
|
|
@@ -2192,6 +2317,7 @@ var commandsProcessorToolTargetTuple = [
|
|
|
2192
2317
|
"cursor",
|
|
2193
2318
|
"geminicli",
|
|
2194
2319
|
"kilo",
|
|
2320
|
+
"kiro",
|
|
2195
2321
|
"opencode",
|
|
2196
2322
|
"roo"
|
|
2197
2323
|
];
|
|
@@ -2272,6 +2398,13 @@ var toolCommandFactories = /* @__PURE__ */ new Map([
|
|
|
2272
2398
|
meta: { extension: "md", supportsProject: true, supportsGlobal: true, isSimulated: false }
|
|
2273
2399
|
}
|
|
2274
2400
|
],
|
|
2401
|
+
[
|
|
2402
|
+
"kiro",
|
|
2403
|
+
{
|
|
2404
|
+
class: KiroCommand,
|
|
2405
|
+
meta: { extension: "md", supportsProject: true, supportsGlobal: false, isSimulated: false }
|
|
2406
|
+
}
|
|
2407
|
+
],
|
|
2275
2408
|
[
|
|
2276
2409
|
"opencode",
|
|
2277
2410
|
{
|
|
@@ -2362,11 +2495,11 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2362
2495
|
*/
|
|
2363
2496
|
async loadRulesyncFiles() {
|
|
2364
2497
|
const rulesyncCommandPaths = await findFilesByGlobs(
|
|
2365
|
-
(0,
|
|
2498
|
+
(0, import_node_path19.join)(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
|
|
2366
2499
|
);
|
|
2367
2500
|
const rulesyncCommands = await Promise.all(
|
|
2368
2501
|
rulesyncCommandPaths.map(
|
|
2369
|
-
(path3) => RulesyncCommand.fromFile({ relativeFilePath: (0,
|
|
2502
|
+
(path3) => RulesyncCommand.fromFile({ relativeFilePath: (0, import_node_path19.basename)(path3) })
|
|
2370
2503
|
)
|
|
2371
2504
|
);
|
|
2372
2505
|
logger.info(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
@@ -2382,14 +2515,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2382
2515
|
const factory = this.getFactory(this.toolTarget);
|
|
2383
2516
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
2384
2517
|
const commandFilePaths = await findFilesByGlobs(
|
|
2385
|
-
(0,
|
|
2518
|
+
(0, import_node_path19.join)(this.baseDir, paths.relativeDirPath, `*.${factory.meta.extension}`)
|
|
2386
2519
|
);
|
|
2387
2520
|
if (forDeletion) {
|
|
2388
2521
|
const toolCommands2 = commandFilePaths.map(
|
|
2389
2522
|
(path3) => factory.class.forDeletion({
|
|
2390
2523
|
baseDir: this.baseDir,
|
|
2391
2524
|
relativeDirPath: paths.relativeDirPath,
|
|
2392
|
-
relativeFilePath: (0,
|
|
2525
|
+
relativeFilePath: (0, import_node_path19.basename)(path3),
|
|
2393
2526
|
global: this.global
|
|
2394
2527
|
})
|
|
2395
2528
|
).filter((cmd) => cmd.isDeletable());
|
|
@@ -2400,7 +2533,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2400
2533
|
commandFilePaths.map(
|
|
2401
2534
|
(path3) => factory.class.fromFile({
|
|
2402
2535
|
baseDir: this.baseDir,
|
|
2403
|
-
relativeFilePath: (0,
|
|
2536
|
+
relativeFilePath: (0, import_node_path19.basename)(path3),
|
|
2404
2537
|
global: this.global
|
|
2405
2538
|
})
|
|
2406
2539
|
)
|
|
@@ -2435,14 +2568,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2435
2568
|
var import_mini13 = require("zod/mini");
|
|
2436
2569
|
|
|
2437
2570
|
// src/features/ignore/augmentcode-ignore.ts
|
|
2438
|
-
var
|
|
2571
|
+
var import_node_path21 = require("path");
|
|
2439
2572
|
|
|
2440
2573
|
// src/types/tool-file.ts
|
|
2441
2574
|
var ToolFile = class extends AiFile {
|
|
2442
2575
|
};
|
|
2443
2576
|
|
|
2444
2577
|
// src/features/ignore/rulesync-ignore.ts
|
|
2445
|
-
var
|
|
2578
|
+
var import_node_path20 = require("path");
|
|
2446
2579
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
2447
2580
|
validate() {
|
|
2448
2581
|
return { success: true, error: null };
|
|
@@ -2462,12 +2595,12 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
2462
2595
|
static async fromFile() {
|
|
2463
2596
|
const baseDir = process.cwd();
|
|
2464
2597
|
const paths = this.getSettablePaths();
|
|
2465
|
-
const recommendedPath = (0,
|
|
2598
|
+
const recommendedPath = (0, import_node_path20.join)(
|
|
2466
2599
|
baseDir,
|
|
2467
2600
|
paths.recommended.relativeDirPath,
|
|
2468
2601
|
paths.recommended.relativeFilePath
|
|
2469
2602
|
);
|
|
2470
|
-
const legacyPath = (0,
|
|
2603
|
+
const legacyPath = (0, import_node_path20.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
2471
2604
|
if (await fileExists(recommendedPath)) {
|
|
2472
2605
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
2473
2606
|
return new _RulesyncIgnore({
|
|
@@ -2583,7 +2716,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2583
2716
|
validate = true
|
|
2584
2717
|
}) {
|
|
2585
2718
|
const fileContent = await readFileContent(
|
|
2586
|
-
(0,
|
|
2719
|
+
(0, import_node_path21.join)(
|
|
2587
2720
|
baseDir,
|
|
2588
2721
|
this.getSettablePaths().relativeDirPath,
|
|
2589
2722
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2614,7 +2747,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2614
2747
|
|
|
2615
2748
|
// src/features/ignore/claudecode-ignore.ts
|
|
2616
2749
|
var import_es_toolkit2 = require("es-toolkit");
|
|
2617
|
-
var
|
|
2750
|
+
var import_node_path22 = require("path");
|
|
2618
2751
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
2619
2752
|
constructor(params) {
|
|
2620
2753
|
super(params);
|
|
@@ -2656,7 +2789,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2656
2789
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
2657
2790
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
2658
2791
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
2659
|
-
const filePath = (0,
|
|
2792
|
+
const filePath = (0, import_node_path22.join)(
|
|
2660
2793
|
baseDir,
|
|
2661
2794
|
this.getSettablePaths().relativeDirPath,
|
|
2662
2795
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2692,7 +2825,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2692
2825
|
validate = true
|
|
2693
2826
|
}) {
|
|
2694
2827
|
const fileContent = await readFileContent(
|
|
2695
|
-
(0,
|
|
2828
|
+
(0, import_node_path22.join)(
|
|
2696
2829
|
baseDir,
|
|
2697
2830
|
this.getSettablePaths().relativeDirPath,
|
|
2698
2831
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2722,7 +2855,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2722
2855
|
};
|
|
2723
2856
|
|
|
2724
2857
|
// src/features/ignore/cline-ignore.ts
|
|
2725
|
-
var
|
|
2858
|
+
var import_node_path23 = require("path");
|
|
2726
2859
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
2727
2860
|
static getSettablePaths() {
|
|
2728
2861
|
return {
|
|
@@ -2759,7 +2892,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2759
2892
|
validate = true
|
|
2760
2893
|
}) {
|
|
2761
2894
|
const fileContent = await readFileContent(
|
|
2762
|
-
(0,
|
|
2895
|
+
(0, import_node_path23.join)(
|
|
2763
2896
|
baseDir,
|
|
2764
2897
|
this.getSettablePaths().relativeDirPath,
|
|
2765
2898
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2789,7 +2922,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2789
2922
|
};
|
|
2790
2923
|
|
|
2791
2924
|
// src/features/ignore/cursor-ignore.ts
|
|
2792
|
-
var
|
|
2925
|
+
var import_node_path24 = require("path");
|
|
2793
2926
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
2794
2927
|
static getSettablePaths() {
|
|
2795
2928
|
return {
|
|
@@ -2822,7 +2955,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2822
2955
|
validate = true
|
|
2823
2956
|
}) {
|
|
2824
2957
|
const fileContent = await readFileContent(
|
|
2825
|
-
(0,
|
|
2958
|
+
(0, import_node_path24.join)(
|
|
2826
2959
|
baseDir,
|
|
2827
2960
|
this.getSettablePaths().relativeDirPath,
|
|
2828
2961
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2852,7 +2985,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2852
2985
|
};
|
|
2853
2986
|
|
|
2854
2987
|
// src/features/ignore/geminicli-ignore.ts
|
|
2855
|
-
var
|
|
2988
|
+
var import_node_path25 = require("path");
|
|
2856
2989
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
2857
2990
|
static getSettablePaths() {
|
|
2858
2991
|
return {
|
|
@@ -2879,7 +3012,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2879
3012
|
validate = true
|
|
2880
3013
|
}) {
|
|
2881
3014
|
const fileContent = await readFileContent(
|
|
2882
|
-
(0,
|
|
3015
|
+
(0, import_node_path25.join)(
|
|
2883
3016
|
baseDir,
|
|
2884
3017
|
this.getSettablePaths().relativeDirPath,
|
|
2885
3018
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2909,7 +3042,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2909
3042
|
};
|
|
2910
3043
|
|
|
2911
3044
|
// src/features/ignore/junie-ignore.ts
|
|
2912
|
-
var
|
|
3045
|
+
var import_node_path26 = require("path");
|
|
2913
3046
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
2914
3047
|
static getSettablePaths() {
|
|
2915
3048
|
return {
|
|
@@ -2936,7 +3069,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2936
3069
|
validate = true
|
|
2937
3070
|
}) {
|
|
2938
3071
|
const fileContent = await readFileContent(
|
|
2939
|
-
(0,
|
|
3072
|
+
(0, import_node_path26.join)(
|
|
2940
3073
|
baseDir,
|
|
2941
3074
|
this.getSettablePaths().relativeDirPath,
|
|
2942
3075
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2966,7 +3099,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2966
3099
|
};
|
|
2967
3100
|
|
|
2968
3101
|
// src/features/ignore/kilo-ignore.ts
|
|
2969
|
-
var
|
|
3102
|
+
var import_node_path27 = require("path");
|
|
2970
3103
|
var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
2971
3104
|
static getSettablePaths() {
|
|
2972
3105
|
return {
|
|
@@ -3003,7 +3136,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
3003
3136
|
validate = true
|
|
3004
3137
|
}) {
|
|
3005
3138
|
const fileContent = await readFileContent(
|
|
3006
|
-
(0,
|
|
3139
|
+
(0, import_node_path27.join)(
|
|
3007
3140
|
baseDir,
|
|
3008
3141
|
this.getSettablePaths().relativeDirPath,
|
|
3009
3142
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3033,7 +3166,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
3033
3166
|
};
|
|
3034
3167
|
|
|
3035
3168
|
// src/features/ignore/kiro-ignore.ts
|
|
3036
|
-
var
|
|
3169
|
+
var import_node_path28 = require("path");
|
|
3037
3170
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
3038
3171
|
static getSettablePaths() {
|
|
3039
3172
|
return {
|
|
@@ -3060,7 +3193,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
3060
3193
|
validate = true
|
|
3061
3194
|
}) {
|
|
3062
3195
|
const fileContent = await readFileContent(
|
|
3063
|
-
(0,
|
|
3196
|
+
(0, import_node_path28.join)(
|
|
3064
3197
|
baseDir,
|
|
3065
3198
|
this.getSettablePaths().relativeDirPath,
|
|
3066
3199
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3090,7 +3223,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
3090
3223
|
};
|
|
3091
3224
|
|
|
3092
3225
|
// src/features/ignore/qwencode-ignore.ts
|
|
3093
|
-
var
|
|
3226
|
+
var import_node_path29 = require("path");
|
|
3094
3227
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
3095
3228
|
static getSettablePaths() {
|
|
3096
3229
|
return {
|
|
@@ -3117,7 +3250,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
3117
3250
|
validate = true
|
|
3118
3251
|
}) {
|
|
3119
3252
|
const fileContent = await readFileContent(
|
|
3120
|
-
(0,
|
|
3253
|
+
(0, import_node_path29.join)(
|
|
3121
3254
|
baseDir,
|
|
3122
3255
|
this.getSettablePaths().relativeDirPath,
|
|
3123
3256
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3147,7 +3280,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
3147
3280
|
};
|
|
3148
3281
|
|
|
3149
3282
|
// src/features/ignore/roo-ignore.ts
|
|
3150
|
-
var
|
|
3283
|
+
var import_node_path30 = require("path");
|
|
3151
3284
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
3152
3285
|
static getSettablePaths() {
|
|
3153
3286
|
return {
|
|
@@ -3174,7 +3307,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
3174
3307
|
validate = true
|
|
3175
3308
|
}) {
|
|
3176
3309
|
const fileContent = await readFileContent(
|
|
3177
|
-
(0,
|
|
3310
|
+
(0, import_node_path30.join)(
|
|
3178
3311
|
baseDir,
|
|
3179
3312
|
this.getSettablePaths().relativeDirPath,
|
|
3180
3313
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3204,7 +3337,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
3204
3337
|
};
|
|
3205
3338
|
|
|
3206
3339
|
// src/features/ignore/windsurf-ignore.ts
|
|
3207
|
-
var
|
|
3340
|
+
var import_node_path31 = require("path");
|
|
3208
3341
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
3209
3342
|
static getSettablePaths() {
|
|
3210
3343
|
return {
|
|
@@ -3231,7 +3364,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3231
3364
|
validate = true
|
|
3232
3365
|
}) {
|
|
3233
3366
|
const fileContent = await readFileContent(
|
|
3234
|
-
(0,
|
|
3367
|
+
(0, import_node_path31.join)(
|
|
3235
3368
|
baseDir,
|
|
3236
3369
|
this.getSettablePaths().relativeDirPath,
|
|
3237
3370
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3262,7 +3395,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3262
3395
|
|
|
3263
3396
|
// src/features/ignore/zed-ignore.ts
|
|
3264
3397
|
var import_es_toolkit3 = require("es-toolkit");
|
|
3265
|
-
var
|
|
3398
|
+
var import_node_path32 = require("path");
|
|
3266
3399
|
var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
3267
3400
|
constructor(params) {
|
|
3268
3401
|
super(params);
|
|
@@ -3298,7 +3431,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
3298
3431
|
}) {
|
|
3299
3432
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
3300
3433
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
3301
|
-
const filePath = (0,
|
|
3434
|
+
const filePath = (0, import_node_path32.join)(
|
|
3302
3435
|
baseDir,
|
|
3303
3436
|
this.getSettablePaths().relativeDirPath,
|
|
3304
3437
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3325,7 +3458,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
3325
3458
|
validate = true
|
|
3326
3459
|
}) {
|
|
3327
3460
|
const fileContent = await readFileContent(
|
|
3328
|
-
(0,
|
|
3461
|
+
(0, import_node_path32.join)(
|
|
3329
3462
|
baseDir,
|
|
3330
3463
|
this.getSettablePaths().relativeDirPath,
|
|
3331
3464
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3507,10 +3640,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
3507
3640
|
var import_mini18 = require("zod/mini");
|
|
3508
3641
|
|
|
3509
3642
|
// src/features/mcp/claudecode-mcp.ts
|
|
3510
|
-
var
|
|
3643
|
+
var import_node_path35 = require("path");
|
|
3511
3644
|
|
|
3512
3645
|
// src/features/mcp/modular-mcp.ts
|
|
3513
|
-
var
|
|
3646
|
+
var import_node_path33 = require("path");
|
|
3514
3647
|
var import_mini15 = require("zod/mini");
|
|
3515
3648
|
|
|
3516
3649
|
// src/types/mcp.ts
|
|
@@ -3598,7 +3731,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3598
3731
|
args: [
|
|
3599
3732
|
"-y",
|
|
3600
3733
|
"@kimuson/modular-mcp",
|
|
3601
|
-
(0,
|
|
3734
|
+
(0, import_node_path33.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3602
3735
|
],
|
|
3603
3736
|
env: {}
|
|
3604
3737
|
}
|
|
@@ -3636,7 +3769,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3636
3769
|
|
|
3637
3770
|
// src/features/mcp/rulesync-mcp.ts
|
|
3638
3771
|
var import_object = require("es-toolkit/object");
|
|
3639
|
-
var
|
|
3772
|
+
var import_node_path34 = require("path");
|
|
3640
3773
|
var import_mini16 = require("zod/mini");
|
|
3641
3774
|
var RulesyncMcpServerSchema = import_mini16.z.union([
|
|
3642
3775
|
import_mini16.z.extend(McpServerSchema, {
|
|
@@ -3692,12 +3825,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
3692
3825
|
}) {
|
|
3693
3826
|
const baseDir = process.cwd();
|
|
3694
3827
|
const paths = this.getSettablePaths();
|
|
3695
|
-
const recommendedPath = (0,
|
|
3828
|
+
const recommendedPath = (0, import_node_path34.join)(
|
|
3696
3829
|
baseDir,
|
|
3697
3830
|
paths.recommended.relativeDirPath,
|
|
3698
3831
|
paths.recommended.relativeFilePath
|
|
3699
3832
|
);
|
|
3700
|
-
const legacyPath = (0,
|
|
3833
|
+
const legacyPath = (0, import_node_path34.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
3701
3834
|
if (await fileExists(recommendedPath)) {
|
|
3702
3835
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
3703
3836
|
return new _RulesyncMcp({
|
|
@@ -3841,7 +3974,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3841
3974
|
}) {
|
|
3842
3975
|
const paths = this.getSettablePaths({ global });
|
|
3843
3976
|
const fileContent = await readOrInitializeFileContent(
|
|
3844
|
-
(0,
|
|
3977
|
+
(0, import_node_path35.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3845
3978
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3846
3979
|
);
|
|
3847
3980
|
const json = JSON.parse(fileContent);
|
|
@@ -3863,7 +3996,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3863
3996
|
}) {
|
|
3864
3997
|
const paths = this.getSettablePaths({ global });
|
|
3865
3998
|
const fileContent = await readOrInitializeFileContent(
|
|
3866
|
-
(0,
|
|
3999
|
+
(0, import_node_path35.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3867
4000
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3868
4001
|
);
|
|
3869
4002
|
const json = JSON.parse(fileContent);
|
|
@@ -3911,7 +4044,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3911
4044
|
};
|
|
3912
4045
|
|
|
3913
4046
|
// src/features/mcp/cline-mcp.ts
|
|
3914
|
-
var
|
|
4047
|
+
var import_node_path36 = require("path");
|
|
3915
4048
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
3916
4049
|
json;
|
|
3917
4050
|
constructor(params) {
|
|
@@ -3932,7 +4065,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3932
4065
|
validate = true
|
|
3933
4066
|
}) {
|
|
3934
4067
|
const fileContent = await readFileContent(
|
|
3935
|
-
(0,
|
|
4068
|
+
(0, import_node_path36.join)(
|
|
3936
4069
|
baseDir,
|
|
3937
4070
|
this.getSettablePaths().relativeDirPath,
|
|
3938
4071
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3981,7 +4114,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3981
4114
|
};
|
|
3982
4115
|
|
|
3983
4116
|
// src/features/mcp/codexcli-mcp.ts
|
|
3984
|
-
var
|
|
4117
|
+
var import_node_path37 = require("path");
|
|
3985
4118
|
var smolToml = __toESM(require("smol-toml"), 1);
|
|
3986
4119
|
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
3987
4120
|
toml;
|
|
@@ -4017,7 +4150,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4017
4150
|
}) {
|
|
4018
4151
|
const paths = this.getSettablePaths({ global });
|
|
4019
4152
|
const fileContent = await readFileContent(
|
|
4020
|
-
(0,
|
|
4153
|
+
(0, import_node_path37.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
4021
4154
|
);
|
|
4022
4155
|
return new _CodexcliMcp({
|
|
4023
4156
|
baseDir,
|
|
@@ -4034,7 +4167,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4034
4167
|
global = false
|
|
4035
4168
|
}) {
|
|
4036
4169
|
const paths = this.getSettablePaths({ global });
|
|
4037
|
-
const configTomlFilePath = (0,
|
|
4170
|
+
const configTomlFilePath = (0, import_node_path37.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
4038
4171
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
4039
4172
|
configTomlFilePath,
|
|
4040
4173
|
smolToml.stringify({})
|
|
@@ -4088,7 +4221,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4088
4221
|
};
|
|
4089
4222
|
|
|
4090
4223
|
// src/features/mcp/copilot-mcp.ts
|
|
4091
|
-
var
|
|
4224
|
+
var import_node_path38 = require("path");
|
|
4092
4225
|
function convertToCopilotFormat(mcpServers) {
|
|
4093
4226
|
return { servers: mcpServers };
|
|
4094
4227
|
}
|
|
@@ -4115,7 +4248,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4115
4248
|
validate = true
|
|
4116
4249
|
}) {
|
|
4117
4250
|
const fileContent = await readFileContent(
|
|
4118
|
-
(0,
|
|
4251
|
+
(0, import_node_path38.join)(
|
|
4119
4252
|
baseDir,
|
|
4120
4253
|
this.getSettablePaths().relativeDirPath,
|
|
4121
4254
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4168,7 +4301,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4168
4301
|
};
|
|
4169
4302
|
|
|
4170
4303
|
// src/features/mcp/cursor-mcp.ts
|
|
4171
|
-
var
|
|
4304
|
+
var import_node_path39 = require("path");
|
|
4172
4305
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
4173
4306
|
json;
|
|
4174
4307
|
constructor(params) {
|
|
@@ -4189,7 +4322,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4189
4322
|
validate = true
|
|
4190
4323
|
}) {
|
|
4191
4324
|
const fileContent = await readFileContent(
|
|
4192
|
-
(0,
|
|
4325
|
+
(0, import_node_path39.join)(
|
|
4193
4326
|
baseDir,
|
|
4194
4327
|
this.getSettablePaths().relativeDirPath,
|
|
4195
4328
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4249,7 +4382,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4249
4382
|
};
|
|
4250
4383
|
|
|
4251
4384
|
// src/features/mcp/geminicli-mcp.ts
|
|
4252
|
-
var
|
|
4385
|
+
var import_node_path40 = require("path");
|
|
4253
4386
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
4254
4387
|
json;
|
|
4255
4388
|
constructor(params) {
|
|
@@ -4278,7 +4411,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4278
4411
|
}) {
|
|
4279
4412
|
const paths = this.getSettablePaths({ global });
|
|
4280
4413
|
const fileContent = await readOrInitializeFileContent(
|
|
4281
|
-
(0,
|
|
4414
|
+
(0, import_node_path40.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4282
4415
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4283
4416
|
);
|
|
4284
4417
|
const json = JSON.parse(fileContent);
|
|
@@ -4299,7 +4432,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4299
4432
|
}) {
|
|
4300
4433
|
const paths = this.getSettablePaths({ global });
|
|
4301
4434
|
const fileContent = await readOrInitializeFileContent(
|
|
4302
|
-
(0,
|
|
4435
|
+
(0, import_node_path40.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4303
4436
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4304
4437
|
);
|
|
4305
4438
|
const json = JSON.parse(fileContent);
|
|
@@ -4336,7 +4469,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4336
4469
|
};
|
|
4337
4470
|
|
|
4338
4471
|
// src/features/mcp/junie-mcp.ts
|
|
4339
|
-
var
|
|
4472
|
+
var import_node_path41 = require("path");
|
|
4340
4473
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
4341
4474
|
json;
|
|
4342
4475
|
constructor(params) {
|
|
@@ -4348,7 +4481,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4348
4481
|
}
|
|
4349
4482
|
static getSettablePaths() {
|
|
4350
4483
|
return {
|
|
4351
|
-
relativeDirPath: (0,
|
|
4484
|
+
relativeDirPath: (0, import_node_path41.join)(".junie", "mcp"),
|
|
4352
4485
|
relativeFilePath: "mcp.json"
|
|
4353
4486
|
};
|
|
4354
4487
|
}
|
|
@@ -4357,7 +4490,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4357
4490
|
validate = true
|
|
4358
4491
|
}) {
|
|
4359
4492
|
const fileContent = await readFileContent(
|
|
4360
|
-
(0,
|
|
4493
|
+
(0, import_node_path41.join)(
|
|
4361
4494
|
baseDir,
|
|
4362
4495
|
this.getSettablePaths().relativeDirPath,
|
|
4363
4496
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4406,7 +4539,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4406
4539
|
};
|
|
4407
4540
|
|
|
4408
4541
|
// src/features/mcp/kilo-mcp.ts
|
|
4409
|
-
var
|
|
4542
|
+
var import_node_path42 = require("path");
|
|
4410
4543
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
4411
4544
|
json;
|
|
4412
4545
|
constructor(params) {
|
|
@@ -4428,7 +4561,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4428
4561
|
}) {
|
|
4429
4562
|
const paths = this.getSettablePaths();
|
|
4430
4563
|
const fileContent = await readOrInitializeFileContent(
|
|
4431
|
-
(0,
|
|
4564
|
+
(0, import_node_path42.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4432
4565
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4433
4566
|
);
|
|
4434
4567
|
return new _KiloMcp({
|
|
@@ -4481,8 +4614,84 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4481
4614
|
}
|
|
4482
4615
|
};
|
|
4483
4616
|
|
|
4617
|
+
// src/features/mcp/kiro-mcp.ts
|
|
4618
|
+
var import_node_path43 = require("path");
|
|
4619
|
+
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
4620
|
+
json;
|
|
4621
|
+
constructor(params) {
|
|
4622
|
+
super(params);
|
|
4623
|
+
this.json = JSON.parse(this.fileContent || "{}");
|
|
4624
|
+
}
|
|
4625
|
+
getJson() {
|
|
4626
|
+
return this.json;
|
|
4627
|
+
}
|
|
4628
|
+
static getSettablePaths() {
|
|
4629
|
+
return {
|
|
4630
|
+
relativeDirPath: (0, import_node_path43.join)(".kiro", "settings"),
|
|
4631
|
+
relativeFilePath: "mcp.json"
|
|
4632
|
+
};
|
|
4633
|
+
}
|
|
4634
|
+
static async fromFile({
|
|
4635
|
+
baseDir = process.cwd(),
|
|
4636
|
+
validate = true
|
|
4637
|
+
}) {
|
|
4638
|
+
const paths = this.getSettablePaths();
|
|
4639
|
+
const fileContent = await readOrInitializeFileContent(
|
|
4640
|
+
(0, import_node_path43.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4641
|
+
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4642
|
+
);
|
|
4643
|
+
return new _KiroMcp({
|
|
4644
|
+
baseDir,
|
|
4645
|
+
relativeDirPath: paths.relativeDirPath,
|
|
4646
|
+
relativeFilePath: paths.relativeFilePath,
|
|
4647
|
+
fileContent,
|
|
4648
|
+
validate
|
|
4649
|
+
});
|
|
4650
|
+
}
|
|
4651
|
+
static fromRulesyncMcp({
|
|
4652
|
+
baseDir = process.cwd(),
|
|
4653
|
+
rulesyncMcp,
|
|
4654
|
+
validate = true
|
|
4655
|
+
}) {
|
|
4656
|
+
const paths = this.getSettablePaths();
|
|
4657
|
+
const fileContent = JSON.stringify(
|
|
4658
|
+
{ mcpServers: rulesyncMcp.getMcpServers({ type: "exposed" }) },
|
|
4659
|
+
null,
|
|
4660
|
+
2
|
|
4661
|
+
);
|
|
4662
|
+
return new _KiroMcp({
|
|
4663
|
+
baseDir,
|
|
4664
|
+
relativeDirPath: paths.relativeDirPath,
|
|
4665
|
+
relativeFilePath: paths.relativeFilePath,
|
|
4666
|
+
fileContent,
|
|
4667
|
+
validate
|
|
4668
|
+
});
|
|
4669
|
+
}
|
|
4670
|
+
toRulesyncMcp() {
|
|
4671
|
+
return this.toRulesyncMcpDefault({
|
|
4672
|
+
fileContent: JSON.stringify({ mcpServers: this.json.mcpServers ?? {} }, null, 2)
|
|
4673
|
+
});
|
|
4674
|
+
}
|
|
4675
|
+
validate() {
|
|
4676
|
+
return { success: true, error: null };
|
|
4677
|
+
}
|
|
4678
|
+
static forDeletion({
|
|
4679
|
+
baseDir = process.cwd(),
|
|
4680
|
+
relativeDirPath,
|
|
4681
|
+
relativeFilePath
|
|
4682
|
+
}) {
|
|
4683
|
+
return new _KiroMcp({
|
|
4684
|
+
baseDir,
|
|
4685
|
+
relativeDirPath,
|
|
4686
|
+
relativeFilePath,
|
|
4687
|
+
fileContent: "{}",
|
|
4688
|
+
validate: false
|
|
4689
|
+
});
|
|
4690
|
+
}
|
|
4691
|
+
};
|
|
4692
|
+
|
|
4484
4693
|
// src/features/mcp/opencode-mcp.ts
|
|
4485
|
-
var
|
|
4694
|
+
var import_node_path44 = require("path");
|
|
4486
4695
|
var import_mini17 = require("zod/mini");
|
|
4487
4696
|
var OpencodeMcpLocalServerSchema = import_mini17.z.object({
|
|
4488
4697
|
type: import_mini17.z.literal("local"),
|
|
@@ -4606,7 +4815,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4606
4815
|
}) {
|
|
4607
4816
|
const paths = this.getSettablePaths({ global });
|
|
4608
4817
|
const fileContent = await readOrInitializeFileContent(
|
|
4609
|
-
(0,
|
|
4818
|
+
(0, import_node_path44.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4610
4819
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4611
4820
|
);
|
|
4612
4821
|
const json = JSON.parse(fileContent);
|
|
@@ -4627,7 +4836,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4627
4836
|
}) {
|
|
4628
4837
|
const paths = this.getSettablePaths({ global });
|
|
4629
4838
|
const fileContent = await readOrInitializeFileContent(
|
|
4630
|
-
(0,
|
|
4839
|
+
(0, import_node_path44.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4631
4840
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4632
4841
|
);
|
|
4633
4842
|
const json = JSON.parse(fileContent);
|
|
@@ -4671,7 +4880,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4671
4880
|
};
|
|
4672
4881
|
|
|
4673
4882
|
// src/features/mcp/roo-mcp.ts
|
|
4674
|
-
var
|
|
4883
|
+
var import_node_path45 = require("path");
|
|
4675
4884
|
function isRooMcpServers(value) {
|
|
4676
4885
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
4677
4886
|
}
|
|
@@ -4723,7 +4932,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4723
4932
|
validate = true
|
|
4724
4933
|
}) {
|
|
4725
4934
|
const fileContent = await readFileContent(
|
|
4726
|
-
(0,
|
|
4935
|
+
(0, import_node_path45.join)(
|
|
4727
4936
|
baseDir,
|
|
4728
4937
|
this.getSettablePaths().relativeDirPath,
|
|
4729
4938
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4788,6 +4997,7 @@ var mcpProcessorToolTargetTuple = [
|
|
|
4788
4997
|
"cursor",
|
|
4789
4998
|
"geminicli",
|
|
4790
4999
|
"kilo",
|
|
5000
|
+
"kiro",
|
|
4791
5001
|
"junie",
|
|
4792
5002
|
"opencode",
|
|
4793
5003
|
"roo"
|
|
@@ -4850,6 +5060,13 @@ var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
|
4850
5060
|
meta: { supportsProject: true, supportsGlobal: false, supportsModular: false }
|
|
4851
5061
|
}
|
|
4852
5062
|
],
|
|
5063
|
+
[
|
|
5064
|
+
"kiro",
|
|
5065
|
+
{
|
|
5066
|
+
class: KiroMcp,
|
|
5067
|
+
meta: { supportsProject: true, supportsGlobal: false, supportsModular: false }
|
|
5068
|
+
}
|
|
5069
|
+
],
|
|
4853
5070
|
[
|
|
4854
5071
|
"junie",
|
|
4855
5072
|
{
|
|
@@ -5030,24 +5247,24 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
5030
5247
|
|
|
5031
5248
|
// src/features/rules/rules-processor.ts
|
|
5032
5249
|
var import_toon = require("@toon-format/toon");
|
|
5033
|
-
var
|
|
5034
|
-
var
|
|
5250
|
+
var import_node_path95 = require("path");
|
|
5251
|
+
var import_mini42 = require("zod/mini");
|
|
5035
5252
|
|
|
5036
5253
|
// src/constants/general.ts
|
|
5037
5254
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
5038
5255
|
|
|
5039
5256
|
// src/features/skills/agentsmd-skill.ts
|
|
5040
|
-
var
|
|
5257
|
+
var import_node_path49 = require("path");
|
|
5041
5258
|
|
|
5042
5259
|
// src/features/skills/simulated-skill.ts
|
|
5043
|
-
var
|
|
5260
|
+
var import_node_path48 = require("path");
|
|
5044
5261
|
var import_mini19 = require("zod/mini");
|
|
5045
5262
|
|
|
5046
5263
|
// src/features/skills/tool-skill.ts
|
|
5047
|
-
var
|
|
5264
|
+
var import_node_path47 = require("path");
|
|
5048
5265
|
|
|
5049
5266
|
// src/types/ai-dir.ts
|
|
5050
|
-
var
|
|
5267
|
+
var import_node_path46 = __toESM(require("path"), 1);
|
|
5051
5268
|
var AiDir = class {
|
|
5052
5269
|
/**
|
|
5053
5270
|
* @example "."
|
|
@@ -5081,7 +5298,7 @@ var AiDir = class {
|
|
|
5081
5298
|
otherFiles = [],
|
|
5082
5299
|
global = false
|
|
5083
5300
|
}) {
|
|
5084
|
-
if (dirName.includes(
|
|
5301
|
+
if (dirName.includes(import_node_path46.default.sep) || dirName.includes("/") || dirName.includes("\\")) {
|
|
5085
5302
|
throw new Error(`Directory name cannot contain path separators: dirName="${dirName}"`);
|
|
5086
5303
|
}
|
|
5087
5304
|
this.baseDir = baseDir;
|
|
@@ -5104,11 +5321,11 @@ var AiDir = class {
|
|
|
5104
5321
|
return this.dirName;
|
|
5105
5322
|
}
|
|
5106
5323
|
getDirPath() {
|
|
5107
|
-
const fullPath =
|
|
5108
|
-
const resolvedFull = (0,
|
|
5109
|
-
const resolvedBase = (0,
|
|
5110
|
-
const rel = (0,
|
|
5111
|
-
if (rel.startsWith("..") ||
|
|
5324
|
+
const fullPath = import_node_path46.default.join(this.baseDir, this.relativeDirPath, this.dirName);
|
|
5325
|
+
const resolvedFull = (0, import_node_path46.resolve)(fullPath);
|
|
5326
|
+
const resolvedBase = (0, import_node_path46.resolve)(this.baseDir);
|
|
5327
|
+
const rel = (0, import_node_path46.relative)(resolvedBase, resolvedFull);
|
|
5328
|
+
if (rel.startsWith("..") || import_node_path46.default.isAbsolute(rel)) {
|
|
5112
5329
|
throw new Error(
|
|
5113
5330
|
`Path traversal detected: Final path escapes baseDir. baseDir="${this.baseDir}", relativeDirPath="${this.relativeDirPath}", dirName="${this.dirName}"`
|
|
5114
5331
|
);
|
|
@@ -5122,7 +5339,7 @@ var AiDir = class {
|
|
|
5122
5339
|
return this.otherFiles;
|
|
5123
5340
|
}
|
|
5124
5341
|
getRelativePathFromCwd() {
|
|
5125
|
-
return
|
|
5342
|
+
return import_node_path46.default.join(this.relativeDirPath, this.dirName);
|
|
5126
5343
|
}
|
|
5127
5344
|
getGlobal() {
|
|
5128
5345
|
return this.global;
|
|
@@ -5141,15 +5358,15 @@ var AiDir = class {
|
|
|
5141
5358
|
* @returns Array of files with their relative paths and buffers
|
|
5142
5359
|
*/
|
|
5143
5360
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
5144
|
-
const dirPath = (0,
|
|
5145
|
-
const glob = (0,
|
|
5361
|
+
const dirPath = (0, import_node_path46.join)(baseDir, relativeDirPath, dirName);
|
|
5362
|
+
const glob = (0, import_node_path46.join)(dirPath, "**", "*");
|
|
5146
5363
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
5147
|
-
const filteredPaths = filePaths.filter((filePath) => (0,
|
|
5364
|
+
const filteredPaths = filePaths.filter((filePath) => (0, import_node_path46.basename)(filePath) !== excludeFileName);
|
|
5148
5365
|
const files = await Promise.all(
|
|
5149
5366
|
filteredPaths.map(async (filePath) => {
|
|
5150
5367
|
const fileBuffer = await readFileBuffer(filePath);
|
|
5151
5368
|
return {
|
|
5152
|
-
relativeFilePathToDirPath: (0,
|
|
5369
|
+
relativeFilePathToDirPath: (0, import_node_path46.relative)(dirPath, filePath),
|
|
5153
5370
|
fileBuffer
|
|
5154
5371
|
};
|
|
5155
5372
|
})
|
|
@@ -5240,8 +5457,8 @@ var ToolSkill = class extends AiDir {
|
|
|
5240
5457
|
}) {
|
|
5241
5458
|
const settablePaths = getSettablePaths({ global });
|
|
5242
5459
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5243
|
-
const skillDirPath = (0,
|
|
5244
|
-
const skillFilePath = (0,
|
|
5460
|
+
const skillDirPath = (0, import_node_path47.join)(baseDir, actualRelativeDirPath, dirName);
|
|
5461
|
+
const skillFilePath = (0, import_node_path47.join)(skillDirPath, SKILL_FILE_NAME);
|
|
5245
5462
|
if (!await fileExists(skillFilePath)) {
|
|
5246
5463
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5247
5464
|
}
|
|
@@ -5299,7 +5516,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5299
5516
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
5300
5517
|
if (!result.success) {
|
|
5301
5518
|
throw new Error(
|
|
5302
|
-
`Invalid frontmatter in ${(0,
|
|
5519
|
+
`Invalid frontmatter in ${(0, import_node_path48.join)(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
5303
5520
|
);
|
|
5304
5521
|
}
|
|
5305
5522
|
}
|
|
@@ -5357,8 +5574,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5357
5574
|
}) {
|
|
5358
5575
|
const settablePaths = this.getSettablePaths();
|
|
5359
5576
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5360
|
-
const skillDirPath = (0,
|
|
5361
|
-
const skillFilePath = (0,
|
|
5577
|
+
const skillDirPath = (0, import_node_path48.join)(baseDir, actualRelativeDirPath, dirName);
|
|
5578
|
+
const skillFilePath = (0, import_node_path48.join)(skillDirPath, SKILL_FILE_NAME);
|
|
5362
5579
|
if (!await fileExists(skillFilePath)) {
|
|
5363
5580
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5364
5581
|
}
|
|
@@ -5435,7 +5652,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5435
5652
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
5436
5653
|
}
|
|
5437
5654
|
return {
|
|
5438
|
-
relativeDirPath: (0,
|
|
5655
|
+
relativeDirPath: (0, import_node_path49.join)(".agents", "skills")
|
|
5439
5656
|
};
|
|
5440
5657
|
}
|
|
5441
5658
|
static async fromDir(params) {
|
|
@@ -5462,14 +5679,14 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5462
5679
|
};
|
|
5463
5680
|
|
|
5464
5681
|
// src/features/skills/geminicli-skill.ts
|
|
5465
|
-
var
|
|
5682
|
+
var import_node_path50 = require("path");
|
|
5466
5683
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5467
5684
|
static getSettablePaths(options) {
|
|
5468
5685
|
if (options?.global) {
|
|
5469
5686
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5470
5687
|
}
|
|
5471
5688
|
return {
|
|
5472
|
-
relativeDirPath: (0,
|
|
5689
|
+
relativeDirPath: (0, import_node_path50.join)(".gemini", "skills")
|
|
5473
5690
|
};
|
|
5474
5691
|
}
|
|
5475
5692
|
static async fromDir(params) {
|
|
@@ -5496,11 +5713,11 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
|
5496
5713
|
};
|
|
5497
5714
|
|
|
5498
5715
|
// src/features/skills/skills-processor.ts
|
|
5499
|
-
var
|
|
5500
|
-
var
|
|
5716
|
+
var import_node_path61 = require("path");
|
|
5717
|
+
var import_mini29 = require("zod/mini");
|
|
5501
5718
|
|
|
5502
5719
|
// src/types/dir-feature-processor.ts
|
|
5503
|
-
var
|
|
5720
|
+
var import_node_path51 = require("path");
|
|
5504
5721
|
var DirFeatureProcessor = class {
|
|
5505
5722
|
baseDir;
|
|
5506
5723
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -5522,14 +5739,14 @@ var DirFeatureProcessor = class {
|
|
|
5522
5739
|
await ensureDir(dirPath);
|
|
5523
5740
|
const mainFile = aiDir.getMainFile();
|
|
5524
5741
|
if (mainFile) {
|
|
5525
|
-
const mainFilePath = (0,
|
|
5742
|
+
const mainFilePath = (0, import_node_path51.join)(dirPath, mainFile.name);
|
|
5526
5743
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5527
5744
|
const contentWithNewline = addTrailingNewline(content);
|
|
5528
5745
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5529
5746
|
}
|
|
5530
5747
|
const otherFiles = aiDir.getOtherFiles();
|
|
5531
5748
|
for (const file of otherFiles) {
|
|
5532
|
-
const filePath = (0,
|
|
5749
|
+
const filePath = (0, import_node_path51.join)(dirPath, file.relativeFilePathToDirPath);
|
|
5533
5750
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5534
5751
|
await writeFileContent(filePath, contentWithNewline);
|
|
5535
5752
|
}
|
|
@@ -5543,12 +5760,12 @@ var DirFeatureProcessor = class {
|
|
|
5543
5760
|
}
|
|
5544
5761
|
};
|
|
5545
5762
|
|
|
5546
|
-
// src/features/skills/
|
|
5547
|
-
var
|
|
5763
|
+
// src/features/skills/antigravity-skill.ts
|
|
5764
|
+
var import_node_path53 = require("path");
|
|
5548
5765
|
var import_mini21 = require("zod/mini");
|
|
5549
5766
|
|
|
5550
5767
|
// src/features/skills/rulesync-skill.ts
|
|
5551
|
-
var
|
|
5768
|
+
var import_node_path52 = require("path");
|
|
5552
5769
|
var import_mini20 = require("zod/mini");
|
|
5553
5770
|
var RulesyncSkillFrontmatterSchemaInternal = import_mini20.z.looseObject({
|
|
5554
5771
|
name: import_mini20.z.string(),
|
|
@@ -5640,8 +5857,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5640
5857
|
dirName,
|
|
5641
5858
|
global = false
|
|
5642
5859
|
}) {
|
|
5643
|
-
const skillDirPath = (0,
|
|
5644
|
-
const skillFilePath = (0,
|
|
5860
|
+
const skillDirPath = (0, import_node_path52.join)(baseDir, relativeDirPath, dirName);
|
|
5861
|
+
const skillFilePath = (0, import_node_path52.join)(skillDirPath, SKILL_FILE_NAME);
|
|
5645
5862
|
if (!await fileExists(skillFilePath)) {
|
|
5646
5863
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5647
5864
|
}
|
|
@@ -5670,16 +5887,179 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5670
5887
|
}
|
|
5671
5888
|
};
|
|
5672
5889
|
|
|
5673
|
-
// src/features/skills/
|
|
5674
|
-
var
|
|
5890
|
+
// src/features/skills/antigravity-skill.ts
|
|
5891
|
+
var AntigravitySkillFrontmatterSchema = import_mini21.z.looseObject({
|
|
5675
5892
|
name: import_mini21.z.string(),
|
|
5676
|
-
description: import_mini21.z.string()
|
|
5677
|
-
|
|
5893
|
+
description: import_mini21.z.string()
|
|
5894
|
+
});
|
|
5895
|
+
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
5896
|
+
constructor({
|
|
5897
|
+
baseDir = process.cwd(),
|
|
5898
|
+
relativeDirPath = (0, import_node_path53.join)(".agent", "skills"),
|
|
5899
|
+
dirName,
|
|
5900
|
+
frontmatter,
|
|
5901
|
+
body,
|
|
5902
|
+
otherFiles = [],
|
|
5903
|
+
validate = true,
|
|
5904
|
+
global = false
|
|
5905
|
+
}) {
|
|
5906
|
+
super({
|
|
5907
|
+
baseDir,
|
|
5908
|
+
relativeDirPath,
|
|
5909
|
+
dirName,
|
|
5910
|
+
mainFile: {
|
|
5911
|
+
name: SKILL_FILE_NAME,
|
|
5912
|
+
body,
|
|
5913
|
+
frontmatter: { ...frontmatter }
|
|
5914
|
+
},
|
|
5915
|
+
otherFiles,
|
|
5916
|
+
global
|
|
5917
|
+
});
|
|
5918
|
+
if (validate) {
|
|
5919
|
+
const result = this.validate();
|
|
5920
|
+
if (!result.success) {
|
|
5921
|
+
throw result.error;
|
|
5922
|
+
}
|
|
5923
|
+
}
|
|
5924
|
+
}
|
|
5925
|
+
static getSettablePaths({
|
|
5926
|
+
global = false
|
|
5927
|
+
} = {}) {
|
|
5928
|
+
if (global) {
|
|
5929
|
+
return {
|
|
5930
|
+
relativeDirPath: (0, import_node_path53.join)(".gemini", "antigravity", "skills")
|
|
5931
|
+
};
|
|
5932
|
+
}
|
|
5933
|
+
return {
|
|
5934
|
+
relativeDirPath: (0, import_node_path53.join)(".agent", "skills")
|
|
5935
|
+
};
|
|
5936
|
+
}
|
|
5937
|
+
getFrontmatter() {
|
|
5938
|
+
if (!this.mainFile?.frontmatter) {
|
|
5939
|
+
throw new Error("Frontmatter is not defined");
|
|
5940
|
+
}
|
|
5941
|
+
const result = AntigravitySkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
5942
|
+
return result;
|
|
5943
|
+
}
|
|
5944
|
+
getBody() {
|
|
5945
|
+
return this.mainFile?.body ?? "";
|
|
5946
|
+
}
|
|
5947
|
+
validate() {
|
|
5948
|
+
if (this.mainFile === void 0) {
|
|
5949
|
+
return {
|
|
5950
|
+
success: false,
|
|
5951
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
5952
|
+
};
|
|
5953
|
+
}
|
|
5954
|
+
const result = AntigravitySkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
5955
|
+
if (!result.success) {
|
|
5956
|
+
return {
|
|
5957
|
+
success: false,
|
|
5958
|
+
error: new Error(
|
|
5959
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
5960
|
+
)
|
|
5961
|
+
};
|
|
5962
|
+
}
|
|
5963
|
+
return { success: true, error: null };
|
|
5964
|
+
}
|
|
5965
|
+
toRulesyncSkill() {
|
|
5966
|
+
const frontmatter = this.getFrontmatter();
|
|
5967
|
+
const rulesyncFrontmatter = {
|
|
5968
|
+
name: frontmatter.name,
|
|
5969
|
+
description: frontmatter.description,
|
|
5970
|
+
targets: ["*"]
|
|
5971
|
+
};
|
|
5972
|
+
return new RulesyncSkill({
|
|
5973
|
+
baseDir: this.baseDir,
|
|
5974
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
5975
|
+
dirName: this.getDirName(),
|
|
5976
|
+
frontmatter: rulesyncFrontmatter,
|
|
5977
|
+
body: this.getBody(),
|
|
5978
|
+
otherFiles: this.getOtherFiles(),
|
|
5979
|
+
validate: true,
|
|
5980
|
+
global: this.global
|
|
5981
|
+
});
|
|
5982
|
+
}
|
|
5983
|
+
static fromRulesyncSkill({
|
|
5984
|
+
rulesyncSkill,
|
|
5985
|
+
validate = true,
|
|
5986
|
+
global = false
|
|
5987
|
+
}) {
|
|
5988
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
5989
|
+
const antigravityFrontmatter = {
|
|
5990
|
+
name: rulesyncFrontmatter.name,
|
|
5991
|
+
description: rulesyncFrontmatter.description
|
|
5992
|
+
};
|
|
5993
|
+
const settablePaths = _AntigravitySkill.getSettablePaths({ global });
|
|
5994
|
+
return new _AntigravitySkill({
|
|
5995
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
5996
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
5997
|
+
dirName: rulesyncSkill.getDirName(),
|
|
5998
|
+
frontmatter: antigravityFrontmatter,
|
|
5999
|
+
body: rulesyncSkill.getBody(),
|
|
6000
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
6001
|
+
validate,
|
|
6002
|
+
global
|
|
6003
|
+
});
|
|
6004
|
+
}
|
|
6005
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
6006
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
6007
|
+
return targets.includes("*") || targets.includes("antigravity");
|
|
6008
|
+
}
|
|
6009
|
+
static async fromDir(params) {
|
|
6010
|
+
const loaded = await this.loadSkillDirContent({
|
|
6011
|
+
...params,
|
|
6012
|
+
getSettablePaths: _AntigravitySkill.getSettablePaths
|
|
6013
|
+
});
|
|
6014
|
+
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6015
|
+
if (!result.success) {
|
|
6016
|
+
const skillDirPath = (0, import_node_path53.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6017
|
+
throw new Error(
|
|
6018
|
+
`Invalid frontmatter in ${(0, import_node_path53.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6019
|
+
);
|
|
6020
|
+
}
|
|
6021
|
+
return new _AntigravitySkill({
|
|
6022
|
+
baseDir: loaded.baseDir,
|
|
6023
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
6024
|
+
dirName: loaded.dirName,
|
|
6025
|
+
frontmatter: result.data,
|
|
6026
|
+
body: loaded.body,
|
|
6027
|
+
otherFiles: loaded.otherFiles,
|
|
6028
|
+
validate: true,
|
|
6029
|
+
global: loaded.global
|
|
6030
|
+
});
|
|
6031
|
+
}
|
|
6032
|
+
static forDeletion({
|
|
6033
|
+
baseDir = process.cwd(),
|
|
6034
|
+
relativeDirPath,
|
|
6035
|
+
dirName,
|
|
6036
|
+
global = false
|
|
6037
|
+
}) {
|
|
6038
|
+
return new _AntigravitySkill({
|
|
6039
|
+
baseDir,
|
|
6040
|
+
relativeDirPath,
|
|
6041
|
+
dirName,
|
|
6042
|
+
frontmatter: { name: "", description: "" },
|
|
6043
|
+
body: "",
|
|
6044
|
+
otherFiles: [],
|
|
6045
|
+
validate: false,
|
|
6046
|
+
global
|
|
6047
|
+
});
|
|
6048
|
+
}
|
|
6049
|
+
};
|
|
6050
|
+
|
|
6051
|
+
// src/features/skills/claudecode-skill.ts
|
|
6052
|
+
var import_node_path54 = require("path");
|
|
6053
|
+
var import_mini22 = require("zod/mini");
|
|
6054
|
+
var ClaudecodeSkillFrontmatterSchema = import_mini22.z.looseObject({
|
|
6055
|
+
name: import_mini22.z.string(),
|
|
6056
|
+
description: import_mini22.z.string(),
|
|
6057
|
+
"allowed-tools": import_mini22.z.optional(import_mini22.z.array(import_mini22.z.string()))
|
|
5678
6058
|
});
|
|
5679
6059
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
5680
6060
|
constructor({
|
|
5681
6061
|
baseDir = process.cwd(),
|
|
5682
|
-
relativeDirPath = (0,
|
|
6062
|
+
relativeDirPath = (0, import_node_path54.join)(".claude", "skills"),
|
|
5683
6063
|
dirName,
|
|
5684
6064
|
frontmatter,
|
|
5685
6065
|
body,
|
|
@@ -5710,7 +6090,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5710
6090
|
global: _global = false
|
|
5711
6091
|
} = {}) {
|
|
5712
6092
|
return {
|
|
5713
|
-
relativeDirPath: (0,
|
|
6093
|
+
relativeDirPath: (0, import_node_path54.join)(".claude", "skills")
|
|
5714
6094
|
};
|
|
5715
6095
|
}
|
|
5716
6096
|
getFrontmatter() {
|
|
@@ -5798,9 +6178,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5798
6178
|
});
|
|
5799
6179
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5800
6180
|
if (!result.success) {
|
|
5801
|
-
const skillDirPath = (0,
|
|
6181
|
+
const skillDirPath = (0, import_node_path54.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5802
6182
|
throw new Error(
|
|
5803
|
-
`Invalid frontmatter in ${(0,
|
|
6183
|
+
`Invalid frontmatter in ${(0, import_node_path54.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5804
6184
|
);
|
|
5805
6185
|
}
|
|
5806
6186
|
return new _ClaudecodeSkill({
|
|
@@ -5834,21 +6214,21 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5834
6214
|
};
|
|
5835
6215
|
|
|
5836
6216
|
// src/features/skills/codexcli-skill.ts
|
|
5837
|
-
var
|
|
5838
|
-
var
|
|
5839
|
-
var CodexCliSkillFrontmatterSchema =
|
|
5840
|
-
name:
|
|
5841
|
-
description:
|
|
5842
|
-
metadata:
|
|
5843
|
-
|
|
5844
|
-
"short-description":
|
|
6217
|
+
var import_node_path55 = require("path");
|
|
6218
|
+
var import_mini23 = require("zod/mini");
|
|
6219
|
+
var CodexCliSkillFrontmatterSchema = import_mini23.z.looseObject({
|
|
6220
|
+
name: import_mini23.z.string(),
|
|
6221
|
+
description: import_mini23.z.string(),
|
|
6222
|
+
metadata: import_mini23.z.optional(
|
|
6223
|
+
import_mini23.z.looseObject({
|
|
6224
|
+
"short-description": import_mini23.z.optional(import_mini23.z.string())
|
|
5845
6225
|
})
|
|
5846
6226
|
)
|
|
5847
6227
|
});
|
|
5848
6228
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
5849
6229
|
constructor({
|
|
5850
6230
|
baseDir = process.cwd(),
|
|
5851
|
-
relativeDirPath = (0,
|
|
6231
|
+
relativeDirPath = (0, import_node_path55.join)(".codex", "skills"),
|
|
5852
6232
|
dirName,
|
|
5853
6233
|
frontmatter,
|
|
5854
6234
|
body,
|
|
@@ -5879,7 +6259,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5879
6259
|
global: _global = false
|
|
5880
6260
|
} = {}) {
|
|
5881
6261
|
return {
|
|
5882
|
-
relativeDirPath: (0,
|
|
6262
|
+
relativeDirPath: (0, import_node_path55.join)(".codex", "skills")
|
|
5883
6263
|
};
|
|
5884
6264
|
}
|
|
5885
6265
|
getFrontmatter() {
|
|
@@ -5971,9 +6351,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5971
6351
|
});
|
|
5972
6352
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5973
6353
|
if (!result.success) {
|
|
5974
|
-
const skillDirPath = (0,
|
|
6354
|
+
const skillDirPath = (0, import_node_path55.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5975
6355
|
throw new Error(
|
|
5976
|
-
`Invalid frontmatter in ${(0,
|
|
6356
|
+
`Invalid frontmatter in ${(0, import_node_path55.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5977
6357
|
);
|
|
5978
6358
|
}
|
|
5979
6359
|
return new _CodexCliSkill({
|
|
@@ -6007,17 +6387,17 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6007
6387
|
};
|
|
6008
6388
|
|
|
6009
6389
|
// src/features/skills/copilot-skill.ts
|
|
6010
|
-
var
|
|
6011
|
-
var
|
|
6012
|
-
var CopilotSkillFrontmatterSchema =
|
|
6013
|
-
name:
|
|
6014
|
-
description:
|
|
6015
|
-
license:
|
|
6390
|
+
var import_node_path56 = require("path");
|
|
6391
|
+
var import_mini24 = require("zod/mini");
|
|
6392
|
+
var CopilotSkillFrontmatterSchema = import_mini24.z.looseObject({
|
|
6393
|
+
name: import_mini24.z.string(),
|
|
6394
|
+
description: import_mini24.z.string(),
|
|
6395
|
+
license: import_mini24.z.optional(import_mini24.z.string())
|
|
6016
6396
|
});
|
|
6017
6397
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
6018
6398
|
constructor({
|
|
6019
6399
|
baseDir = process.cwd(),
|
|
6020
|
-
relativeDirPath = (0,
|
|
6400
|
+
relativeDirPath = (0, import_node_path56.join)(".github", "skills"),
|
|
6021
6401
|
dirName,
|
|
6022
6402
|
frontmatter,
|
|
6023
6403
|
body,
|
|
@@ -6049,7 +6429,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6049
6429
|
throw new Error("CopilotSkill does not support global mode.");
|
|
6050
6430
|
}
|
|
6051
6431
|
return {
|
|
6052
|
-
relativeDirPath: (0,
|
|
6432
|
+
relativeDirPath: (0, import_node_path56.join)(".github", "skills")
|
|
6053
6433
|
};
|
|
6054
6434
|
}
|
|
6055
6435
|
getFrontmatter() {
|
|
@@ -6137,9 +6517,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6137
6517
|
});
|
|
6138
6518
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6139
6519
|
if (!result.success) {
|
|
6140
|
-
const skillDirPath = (0,
|
|
6520
|
+
const skillDirPath = (0, import_node_path56.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6141
6521
|
throw new Error(
|
|
6142
|
-
`Invalid frontmatter in ${(0,
|
|
6522
|
+
`Invalid frontmatter in ${(0, import_node_path56.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6143
6523
|
);
|
|
6144
6524
|
}
|
|
6145
6525
|
return new _CopilotSkill({
|
|
@@ -6174,16 +6554,16 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6174
6554
|
};
|
|
6175
6555
|
|
|
6176
6556
|
// src/features/skills/cursor-skill.ts
|
|
6177
|
-
var
|
|
6178
|
-
var
|
|
6179
|
-
var CursorSkillFrontmatterSchema =
|
|
6180
|
-
name:
|
|
6181
|
-
description:
|
|
6557
|
+
var import_node_path57 = require("path");
|
|
6558
|
+
var import_mini25 = require("zod/mini");
|
|
6559
|
+
var CursorSkillFrontmatterSchema = import_mini25.z.looseObject({
|
|
6560
|
+
name: import_mini25.z.string(),
|
|
6561
|
+
description: import_mini25.z.string()
|
|
6182
6562
|
});
|
|
6183
6563
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
6184
6564
|
constructor({
|
|
6185
6565
|
baseDir = process.cwd(),
|
|
6186
|
-
relativeDirPath = (0,
|
|
6566
|
+
relativeDirPath = (0, import_node_path57.join)(".cursor", "skills"),
|
|
6187
6567
|
dirName,
|
|
6188
6568
|
frontmatter,
|
|
6189
6569
|
body,
|
|
@@ -6215,7 +6595,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6215
6595
|
throw new Error("CursorSkill does not support global mode.");
|
|
6216
6596
|
}
|
|
6217
6597
|
return {
|
|
6218
|
-
relativeDirPath: (0,
|
|
6598
|
+
relativeDirPath: (0, import_node_path57.join)(".cursor", "skills")
|
|
6219
6599
|
};
|
|
6220
6600
|
}
|
|
6221
6601
|
getFrontmatter() {
|
|
@@ -6297,9 +6677,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6297
6677
|
});
|
|
6298
6678
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6299
6679
|
if (!result.success) {
|
|
6300
|
-
const skillDirPath = (0,
|
|
6680
|
+
const skillDirPath = (0, import_node_path57.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6301
6681
|
throw new Error(
|
|
6302
|
-
`Invalid frontmatter in ${(0,
|
|
6682
|
+
`Invalid frontmatter in ${(0, import_node_path57.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6303
6683
|
);
|
|
6304
6684
|
}
|
|
6305
6685
|
return new _CursorSkill({
|
|
@@ -6334,16 +6714,16 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6334
6714
|
};
|
|
6335
6715
|
|
|
6336
6716
|
// src/features/skills/kilo-skill.ts
|
|
6337
|
-
var
|
|
6338
|
-
var
|
|
6339
|
-
var KiloSkillFrontmatterSchema =
|
|
6340
|
-
name:
|
|
6341
|
-
description:
|
|
6717
|
+
var import_node_path58 = require("path");
|
|
6718
|
+
var import_mini26 = require("zod/mini");
|
|
6719
|
+
var KiloSkillFrontmatterSchema = import_mini26.z.looseObject({
|
|
6720
|
+
name: import_mini26.z.string(),
|
|
6721
|
+
description: import_mini26.z.string()
|
|
6342
6722
|
});
|
|
6343
6723
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
6344
6724
|
constructor({
|
|
6345
6725
|
baseDir = process.cwd(),
|
|
6346
|
-
relativeDirPath = (0,
|
|
6726
|
+
relativeDirPath = (0, import_node_path58.join)(".kilocode", "skills"),
|
|
6347
6727
|
dirName,
|
|
6348
6728
|
frontmatter,
|
|
6349
6729
|
body,
|
|
@@ -6374,7 +6754,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6374
6754
|
global: _global = false
|
|
6375
6755
|
} = {}) {
|
|
6376
6756
|
return {
|
|
6377
|
-
relativeDirPath: (0,
|
|
6757
|
+
relativeDirPath: (0, import_node_path58.join)(".kilocode", "skills")
|
|
6378
6758
|
};
|
|
6379
6759
|
}
|
|
6380
6760
|
getFrontmatter() {
|
|
@@ -6464,13 +6844,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6464
6844
|
});
|
|
6465
6845
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6466
6846
|
if (!result.success) {
|
|
6467
|
-
const skillDirPath = (0,
|
|
6847
|
+
const skillDirPath = (0, import_node_path58.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6468
6848
|
throw new Error(
|
|
6469
|
-
`Invalid frontmatter in ${(0,
|
|
6849
|
+
`Invalid frontmatter in ${(0, import_node_path58.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6470
6850
|
);
|
|
6471
6851
|
}
|
|
6472
6852
|
if (result.data.name !== loaded.dirName) {
|
|
6473
|
-
const skillFilePath = (0,
|
|
6853
|
+
const skillFilePath = (0, import_node_path58.join)(
|
|
6474
6854
|
loaded.baseDir,
|
|
6475
6855
|
loaded.relativeDirPath,
|
|
6476
6856
|
loaded.dirName,
|
|
@@ -6511,17 +6891,17 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6511
6891
|
};
|
|
6512
6892
|
|
|
6513
6893
|
// src/features/skills/opencode-skill.ts
|
|
6514
|
-
var
|
|
6515
|
-
var
|
|
6516
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
6517
|
-
name:
|
|
6518
|
-
description:
|
|
6519
|
-
"allowed-tools":
|
|
6894
|
+
var import_node_path59 = require("path");
|
|
6895
|
+
var import_mini27 = require("zod/mini");
|
|
6896
|
+
var OpenCodeSkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
6897
|
+
name: import_mini27.z.string(),
|
|
6898
|
+
description: import_mini27.z.string(),
|
|
6899
|
+
"allowed-tools": import_mini27.z.optional(import_mini27.z.array(import_mini27.z.string()))
|
|
6520
6900
|
});
|
|
6521
6901
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
6522
6902
|
constructor({
|
|
6523
6903
|
baseDir = process.cwd(),
|
|
6524
|
-
relativeDirPath = (0,
|
|
6904
|
+
relativeDirPath = (0, import_node_path59.join)(".opencode", "skill"),
|
|
6525
6905
|
dirName,
|
|
6526
6906
|
frontmatter,
|
|
6527
6907
|
body,
|
|
@@ -6550,7 +6930,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6550
6930
|
}
|
|
6551
6931
|
static getSettablePaths({ global = false } = {}) {
|
|
6552
6932
|
return {
|
|
6553
|
-
relativeDirPath: global ? (0,
|
|
6933
|
+
relativeDirPath: global ? (0, import_node_path59.join)(".config", "opencode", "skill") : (0, import_node_path59.join)(".opencode", "skill")
|
|
6554
6934
|
};
|
|
6555
6935
|
}
|
|
6556
6936
|
getFrontmatter() {
|
|
@@ -6638,9 +7018,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6638
7018
|
});
|
|
6639
7019
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6640
7020
|
if (!result.success) {
|
|
6641
|
-
const skillDirPath = (0,
|
|
7021
|
+
const skillDirPath = (0, import_node_path59.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6642
7022
|
throw new Error(
|
|
6643
|
-
`Invalid frontmatter in ${(0,
|
|
7023
|
+
`Invalid frontmatter in ${(0, import_node_path59.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6644
7024
|
);
|
|
6645
7025
|
}
|
|
6646
7026
|
return new _OpenCodeSkill({
|
|
@@ -6674,16 +7054,16 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6674
7054
|
};
|
|
6675
7055
|
|
|
6676
7056
|
// src/features/skills/roo-skill.ts
|
|
6677
|
-
var
|
|
6678
|
-
var
|
|
6679
|
-
var RooSkillFrontmatterSchema =
|
|
6680
|
-
name:
|
|
6681
|
-
description:
|
|
7057
|
+
var import_node_path60 = require("path");
|
|
7058
|
+
var import_mini28 = require("zod/mini");
|
|
7059
|
+
var RooSkillFrontmatterSchema = import_mini28.z.looseObject({
|
|
7060
|
+
name: import_mini28.z.string(),
|
|
7061
|
+
description: import_mini28.z.string()
|
|
6682
7062
|
});
|
|
6683
7063
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
6684
7064
|
constructor({
|
|
6685
7065
|
baseDir = process.cwd(),
|
|
6686
|
-
relativeDirPath = (0,
|
|
7066
|
+
relativeDirPath = (0, import_node_path60.join)(".roo", "skills"),
|
|
6687
7067
|
dirName,
|
|
6688
7068
|
frontmatter,
|
|
6689
7069
|
body,
|
|
@@ -6714,7 +7094,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6714
7094
|
global: _global = false
|
|
6715
7095
|
} = {}) {
|
|
6716
7096
|
return {
|
|
6717
|
-
relativeDirPath: (0,
|
|
7097
|
+
relativeDirPath: (0, import_node_path60.join)(".roo", "skills")
|
|
6718
7098
|
};
|
|
6719
7099
|
}
|
|
6720
7100
|
getFrontmatter() {
|
|
@@ -6804,13 +7184,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6804
7184
|
});
|
|
6805
7185
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6806
7186
|
if (!result.success) {
|
|
6807
|
-
const skillDirPath = (0,
|
|
7187
|
+
const skillDirPath = (0, import_node_path60.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6808
7188
|
throw new Error(
|
|
6809
|
-
`Invalid frontmatter in ${(0,
|
|
7189
|
+
`Invalid frontmatter in ${(0, import_node_path60.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6810
7190
|
);
|
|
6811
7191
|
}
|
|
6812
7192
|
if (result.data.name !== loaded.dirName) {
|
|
6813
|
-
const skillFilePath = (0,
|
|
7193
|
+
const skillFilePath = (0, import_node_path60.join)(
|
|
6814
7194
|
loaded.baseDir,
|
|
6815
7195
|
loaded.relativeDirPath,
|
|
6816
7196
|
loaded.dirName,
|
|
@@ -6853,6 +7233,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6853
7233
|
// src/features/skills/skills-processor.ts
|
|
6854
7234
|
var skillsProcessorToolTargetTuple = [
|
|
6855
7235
|
"agentsmd",
|
|
7236
|
+
"antigravity",
|
|
6856
7237
|
"claudecode",
|
|
6857
7238
|
"claudecode-legacy",
|
|
6858
7239
|
"codexcli",
|
|
@@ -6863,7 +7244,7 @@ var skillsProcessorToolTargetTuple = [
|
|
|
6863
7244
|
"opencode",
|
|
6864
7245
|
"roo"
|
|
6865
7246
|
];
|
|
6866
|
-
var SkillsProcessorToolTargetSchema =
|
|
7247
|
+
var SkillsProcessorToolTargetSchema = import_mini29.z.enum(skillsProcessorToolTargetTuple);
|
|
6867
7248
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
6868
7249
|
[
|
|
6869
7250
|
"agentsmd",
|
|
@@ -6872,6 +7253,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
6872
7253
|
meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
|
|
6873
7254
|
}
|
|
6874
7255
|
],
|
|
7256
|
+
[
|
|
7257
|
+
"antigravity",
|
|
7258
|
+
{
|
|
7259
|
+
class: AntigravitySkill,
|
|
7260
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
7261
|
+
}
|
|
7262
|
+
],
|
|
6875
7263
|
[
|
|
6876
7264
|
"claudecode",
|
|
6877
7265
|
{
|
|
@@ -7013,9 +7401,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7013
7401
|
*/
|
|
7014
7402
|
async loadRulesyncDirs() {
|
|
7015
7403
|
const paths = RulesyncSkill.getSettablePaths();
|
|
7016
|
-
const rulesyncSkillsDirPath = (0,
|
|
7017
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
7018
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
7404
|
+
const rulesyncSkillsDirPath = (0, import_node_path61.join)(this.baseDir, paths.relativeDirPath);
|
|
7405
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path61.join)(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
7406
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path61.basename)(path3));
|
|
7019
7407
|
const rulesyncSkills = await Promise.all(
|
|
7020
7408
|
dirNames.map(
|
|
7021
7409
|
(dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
|
|
@@ -7031,9 +7419,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7031
7419
|
async loadToolDirs() {
|
|
7032
7420
|
const factory = this.getFactory(this.toolTarget);
|
|
7033
7421
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7034
|
-
const skillsDirPath = (0,
|
|
7035
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
7036
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
7422
|
+
const skillsDirPath = (0, import_node_path61.join)(this.baseDir, paths.relativeDirPath);
|
|
7423
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path61.join)(skillsDirPath, "*"), { type: "dir" });
|
|
7424
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path61.basename)(path3));
|
|
7037
7425
|
const toolSkills = await Promise.all(
|
|
7038
7426
|
dirNames.map(
|
|
7039
7427
|
(dirName) => factory.class.fromDir({
|
|
@@ -7049,9 +7437,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7049
7437
|
async loadToolDirsToDelete() {
|
|
7050
7438
|
const factory = this.getFactory(this.toolTarget);
|
|
7051
7439
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7052
|
-
const skillsDirPath = (0,
|
|
7053
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
7054
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
7440
|
+
const skillsDirPath = (0, import_node_path61.join)(this.baseDir, paths.relativeDirPath);
|
|
7441
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path61.join)(skillsDirPath, "*"), { type: "dir" });
|
|
7442
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path61.basename)(path3));
|
|
7055
7443
|
const toolSkills = dirNames.map(
|
|
7056
7444
|
(dirName) => factory.class.forDeletion({
|
|
7057
7445
|
baseDir: this.baseDir,
|
|
@@ -7099,11 +7487,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7099
7487
|
};
|
|
7100
7488
|
|
|
7101
7489
|
// src/features/subagents/agentsmd-subagent.ts
|
|
7102
|
-
var
|
|
7490
|
+
var import_node_path63 = require("path");
|
|
7103
7491
|
|
|
7104
7492
|
// src/features/subagents/simulated-subagent.ts
|
|
7105
|
-
var
|
|
7106
|
-
var
|
|
7493
|
+
var import_node_path62 = require("path");
|
|
7494
|
+
var import_mini30 = require("zod/mini");
|
|
7107
7495
|
|
|
7108
7496
|
// src/features/subagents/tool-subagent.ts
|
|
7109
7497
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -7146,9 +7534,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
7146
7534
|
};
|
|
7147
7535
|
|
|
7148
7536
|
// src/features/subagents/simulated-subagent.ts
|
|
7149
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
7150
|
-
name:
|
|
7151
|
-
description:
|
|
7537
|
+
var SimulatedSubagentFrontmatterSchema = import_mini30.z.object({
|
|
7538
|
+
name: import_mini30.z.string(),
|
|
7539
|
+
description: import_mini30.z.string()
|
|
7152
7540
|
});
|
|
7153
7541
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
7154
7542
|
frontmatter;
|
|
@@ -7158,7 +7546,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7158
7546
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7159
7547
|
if (!result.success) {
|
|
7160
7548
|
throw new Error(
|
|
7161
|
-
`Invalid frontmatter in ${(0,
|
|
7549
|
+
`Invalid frontmatter in ${(0, import_node_path62.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7162
7550
|
);
|
|
7163
7551
|
}
|
|
7164
7552
|
}
|
|
@@ -7209,7 +7597,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7209
7597
|
return {
|
|
7210
7598
|
success: false,
|
|
7211
7599
|
error: new Error(
|
|
7212
|
-
`Invalid frontmatter in ${(0,
|
|
7600
|
+
`Invalid frontmatter in ${(0, import_node_path62.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7213
7601
|
)
|
|
7214
7602
|
};
|
|
7215
7603
|
}
|
|
@@ -7219,7 +7607,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7219
7607
|
relativeFilePath,
|
|
7220
7608
|
validate = true
|
|
7221
7609
|
}) {
|
|
7222
|
-
const filePath = (0,
|
|
7610
|
+
const filePath = (0, import_node_path62.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
7223
7611
|
const fileContent = await readFileContent(filePath);
|
|
7224
7612
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7225
7613
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7229,7 +7617,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7229
7617
|
return {
|
|
7230
7618
|
baseDir,
|
|
7231
7619
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
7232
|
-
relativeFilePath: (0,
|
|
7620
|
+
relativeFilePath: (0, import_node_path62.basename)(relativeFilePath),
|
|
7233
7621
|
frontmatter: result.data,
|
|
7234
7622
|
body: content.trim(),
|
|
7235
7623
|
validate
|
|
@@ -7255,7 +7643,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7255
7643
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
7256
7644
|
static getSettablePaths() {
|
|
7257
7645
|
return {
|
|
7258
|
-
relativeDirPath: (0,
|
|
7646
|
+
relativeDirPath: (0, import_node_path63.join)(".agents", "subagents")
|
|
7259
7647
|
};
|
|
7260
7648
|
}
|
|
7261
7649
|
static async fromFile(params) {
|
|
@@ -7278,11 +7666,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
7278
7666
|
};
|
|
7279
7667
|
|
|
7280
7668
|
// src/features/subagents/codexcli-subagent.ts
|
|
7281
|
-
var
|
|
7669
|
+
var import_node_path64 = require("path");
|
|
7282
7670
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
7283
7671
|
static getSettablePaths() {
|
|
7284
7672
|
return {
|
|
7285
|
-
relativeDirPath: (0,
|
|
7673
|
+
relativeDirPath: (0, import_node_path64.join)(".codex", "subagents")
|
|
7286
7674
|
};
|
|
7287
7675
|
}
|
|
7288
7676
|
static async fromFile(params) {
|
|
@@ -7305,11 +7693,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
7305
7693
|
};
|
|
7306
7694
|
|
|
7307
7695
|
// src/features/subagents/cursor-subagent.ts
|
|
7308
|
-
var
|
|
7696
|
+
var import_node_path65 = require("path");
|
|
7309
7697
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
7310
7698
|
static getSettablePaths() {
|
|
7311
7699
|
return {
|
|
7312
|
-
relativeDirPath: (0,
|
|
7700
|
+
relativeDirPath: (0, import_node_path65.join)(".cursor", "subagents")
|
|
7313
7701
|
};
|
|
7314
7702
|
}
|
|
7315
7703
|
static async fromFile(params) {
|
|
@@ -7332,11 +7720,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
7332
7720
|
};
|
|
7333
7721
|
|
|
7334
7722
|
// src/features/subagents/geminicli-subagent.ts
|
|
7335
|
-
var
|
|
7723
|
+
var import_node_path66 = require("path");
|
|
7336
7724
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
7337
7725
|
static getSettablePaths() {
|
|
7338
7726
|
return {
|
|
7339
|
-
relativeDirPath: (0,
|
|
7727
|
+
relativeDirPath: (0, import_node_path66.join)(".gemini", "subagents")
|
|
7340
7728
|
};
|
|
7341
7729
|
}
|
|
7342
7730
|
static async fromFile(params) {
|
|
@@ -7359,11 +7747,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
7359
7747
|
};
|
|
7360
7748
|
|
|
7361
7749
|
// src/features/subagents/roo-subagent.ts
|
|
7362
|
-
var
|
|
7750
|
+
var import_node_path67 = require("path");
|
|
7363
7751
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
7364
7752
|
static getSettablePaths() {
|
|
7365
7753
|
return {
|
|
7366
|
-
relativeDirPath: (0,
|
|
7754
|
+
relativeDirPath: (0, import_node_path67.join)(".roo", "subagents")
|
|
7367
7755
|
};
|
|
7368
7756
|
}
|
|
7369
7757
|
static async fromFile(params) {
|
|
@@ -7386,20 +7774,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
7386
7774
|
};
|
|
7387
7775
|
|
|
7388
7776
|
// src/features/subagents/subagents-processor.ts
|
|
7389
|
-
var
|
|
7390
|
-
var
|
|
7777
|
+
var import_node_path72 = require("path");
|
|
7778
|
+
var import_mini35 = require("zod/mini");
|
|
7391
7779
|
|
|
7392
7780
|
// src/features/subagents/claudecode-subagent.ts
|
|
7393
|
-
var
|
|
7394
|
-
var
|
|
7781
|
+
var import_node_path69 = require("path");
|
|
7782
|
+
var import_mini32 = require("zod/mini");
|
|
7395
7783
|
|
|
7396
7784
|
// src/features/subagents/rulesync-subagent.ts
|
|
7397
|
-
var
|
|
7398
|
-
var
|
|
7399
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
7785
|
+
var import_node_path68 = require("path");
|
|
7786
|
+
var import_mini31 = require("zod/mini");
|
|
7787
|
+
var RulesyncSubagentFrontmatterSchema = import_mini31.z.looseObject({
|
|
7400
7788
|
targets: RulesyncTargetsSchema,
|
|
7401
|
-
name:
|
|
7402
|
-
description:
|
|
7789
|
+
name: import_mini31.z.string(),
|
|
7790
|
+
description: import_mini31.z.string()
|
|
7403
7791
|
});
|
|
7404
7792
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
7405
7793
|
frontmatter;
|
|
@@ -7409,7 +7797,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7409
7797
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7410
7798
|
if (!result.success) {
|
|
7411
7799
|
throw new Error(
|
|
7412
|
-
`Invalid frontmatter in ${(0,
|
|
7800
|
+
`Invalid frontmatter in ${(0, import_node_path68.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7413
7801
|
);
|
|
7414
7802
|
}
|
|
7415
7803
|
}
|
|
@@ -7442,7 +7830,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7442
7830
|
return {
|
|
7443
7831
|
success: false,
|
|
7444
7832
|
error: new Error(
|
|
7445
|
-
`Invalid frontmatter in ${(0,
|
|
7833
|
+
`Invalid frontmatter in ${(0, import_node_path68.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7446
7834
|
)
|
|
7447
7835
|
};
|
|
7448
7836
|
}
|
|
@@ -7451,14 +7839,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7451
7839
|
relativeFilePath
|
|
7452
7840
|
}) {
|
|
7453
7841
|
const fileContent = await readFileContent(
|
|
7454
|
-
(0,
|
|
7842
|
+
(0, import_node_path68.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
7455
7843
|
);
|
|
7456
7844
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7457
7845
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7458
7846
|
if (!result.success) {
|
|
7459
7847
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
7460
7848
|
}
|
|
7461
|
-
const filename = (0,
|
|
7849
|
+
const filename = (0, import_node_path68.basename)(relativeFilePath);
|
|
7462
7850
|
return new _RulesyncSubagent({
|
|
7463
7851
|
baseDir: process.cwd(),
|
|
7464
7852
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -7470,13 +7858,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7470
7858
|
};
|
|
7471
7859
|
|
|
7472
7860
|
// src/features/subagents/claudecode-subagent.ts
|
|
7473
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
7474
|
-
name:
|
|
7475
|
-
description:
|
|
7476
|
-
model:
|
|
7477
|
-
tools:
|
|
7478
|
-
permissionMode:
|
|
7479
|
-
skills:
|
|
7861
|
+
var ClaudecodeSubagentFrontmatterSchema = import_mini32.z.looseObject({
|
|
7862
|
+
name: import_mini32.z.string(),
|
|
7863
|
+
description: import_mini32.z.string(),
|
|
7864
|
+
model: import_mini32.z.optional(import_mini32.z.string()),
|
|
7865
|
+
tools: import_mini32.z.optional(import_mini32.z.union([import_mini32.z.string(), import_mini32.z.array(import_mini32.z.string())])),
|
|
7866
|
+
permissionMode: import_mini32.z.optional(import_mini32.z.string()),
|
|
7867
|
+
skills: import_mini32.z.optional(import_mini32.z.union([import_mini32.z.string(), import_mini32.z.array(import_mini32.z.string())]))
|
|
7480
7868
|
});
|
|
7481
7869
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
7482
7870
|
frontmatter;
|
|
@@ -7486,7 +7874,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7486
7874
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7487
7875
|
if (!result.success) {
|
|
7488
7876
|
throw new Error(
|
|
7489
|
-
`Invalid frontmatter in ${(0,
|
|
7877
|
+
`Invalid frontmatter in ${(0, import_node_path69.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7490
7878
|
);
|
|
7491
7879
|
}
|
|
7492
7880
|
}
|
|
@@ -7498,7 +7886,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7498
7886
|
}
|
|
7499
7887
|
static getSettablePaths(_options = {}) {
|
|
7500
7888
|
return {
|
|
7501
|
-
relativeDirPath: (0,
|
|
7889
|
+
relativeDirPath: (0, import_node_path69.join)(".claude", "agents")
|
|
7502
7890
|
};
|
|
7503
7891
|
}
|
|
7504
7892
|
getFrontmatter() {
|
|
@@ -7572,7 +7960,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7572
7960
|
return {
|
|
7573
7961
|
success: false,
|
|
7574
7962
|
error: new Error(
|
|
7575
|
-
`Invalid frontmatter in ${(0,
|
|
7963
|
+
`Invalid frontmatter in ${(0, import_node_path69.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7576
7964
|
)
|
|
7577
7965
|
};
|
|
7578
7966
|
}
|
|
@@ -7590,7 +7978,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7590
7978
|
global = false
|
|
7591
7979
|
}) {
|
|
7592
7980
|
const paths = this.getSettablePaths({ global });
|
|
7593
|
-
const filePath = (0,
|
|
7981
|
+
const filePath = (0, import_node_path69.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7594
7982
|
const fileContent = await readFileContent(filePath);
|
|
7595
7983
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7596
7984
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7625,13 +8013,13 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7625
8013
|
};
|
|
7626
8014
|
|
|
7627
8015
|
// src/features/subagents/copilot-subagent.ts
|
|
7628
|
-
var
|
|
7629
|
-
var
|
|
8016
|
+
var import_node_path70 = require("path");
|
|
8017
|
+
var import_mini33 = require("zod/mini");
|
|
7630
8018
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
7631
|
-
var CopilotSubagentFrontmatterSchema =
|
|
7632
|
-
name:
|
|
7633
|
-
description:
|
|
7634
|
-
tools:
|
|
8019
|
+
var CopilotSubagentFrontmatterSchema = import_mini33.z.looseObject({
|
|
8020
|
+
name: import_mini33.z.string(),
|
|
8021
|
+
description: import_mini33.z.string(),
|
|
8022
|
+
tools: import_mini33.z.optional(import_mini33.z.union([import_mini33.z.string(), import_mini33.z.array(import_mini33.z.string())]))
|
|
7635
8023
|
});
|
|
7636
8024
|
var normalizeTools = (tools) => {
|
|
7637
8025
|
if (!tools) {
|
|
@@ -7651,7 +8039,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7651
8039
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7652
8040
|
if (!result.success) {
|
|
7653
8041
|
throw new Error(
|
|
7654
|
-
`Invalid frontmatter in ${(0,
|
|
8042
|
+
`Invalid frontmatter in ${(0, import_node_path70.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7655
8043
|
);
|
|
7656
8044
|
}
|
|
7657
8045
|
}
|
|
@@ -7663,7 +8051,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7663
8051
|
}
|
|
7664
8052
|
static getSettablePaths(_options = {}) {
|
|
7665
8053
|
return {
|
|
7666
|
-
relativeDirPath: (0,
|
|
8054
|
+
relativeDirPath: (0, import_node_path70.join)(".github", "agents")
|
|
7667
8055
|
};
|
|
7668
8056
|
}
|
|
7669
8057
|
getFrontmatter() {
|
|
@@ -7737,7 +8125,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7737
8125
|
return {
|
|
7738
8126
|
success: false,
|
|
7739
8127
|
error: new Error(
|
|
7740
|
-
`Invalid frontmatter in ${(0,
|
|
8128
|
+
`Invalid frontmatter in ${(0, import_node_path70.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7741
8129
|
)
|
|
7742
8130
|
};
|
|
7743
8131
|
}
|
|
@@ -7755,7 +8143,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7755
8143
|
global = false
|
|
7756
8144
|
}) {
|
|
7757
8145
|
const paths = this.getSettablePaths({ global });
|
|
7758
|
-
const filePath = (0,
|
|
8146
|
+
const filePath = (0, import_node_path70.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7759
8147
|
const fileContent = await readFileContent(filePath);
|
|
7760
8148
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7761
8149
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7791,12 +8179,12 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7791
8179
|
};
|
|
7792
8180
|
|
|
7793
8181
|
// src/features/subagents/opencode-subagent.ts
|
|
7794
|
-
var
|
|
7795
|
-
var
|
|
7796
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
7797
|
-
description:
|
|
7798
|
-
mode:
|
|
7799
|
-
name:
|
|
8182
|
+
var import_node_path71 = require("path");
|
|
8183
|
+
var import_mini34 = require("zod/mini");
|
|
8184
|
+
var OpenCodeSubagentFrontmatterSchema = import_mini34.z.looseObject({
|
|
8185
|
+
description: import_mini34.z.string(),
|
|
8186
|
+
mode: import_mini34.z.literal("subagent"),
|
|
8187
|
+
name: import_mini34.z.optional(import_mini34.z.string())
|
|
7800
8188
|
});
|
|
7801
8189
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
7802
8190
|
frontmatter;
|
|
@@ -7806,7 +8194,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7806
8194
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7807
8195
|
if (!result.success) {
|
|
7808
8196
|
throw new Error(
|
|
7809
|
-
`Invalid frontmatter in ${(0,
|
|
8197
|
+
`Invalid frontmatter in ${(0, import_node_path71.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7810
8198
|
);
|
|
7811
8199
|
}
|
|
7812
8200
|
}
|
|
@@ -7820,7 +8208,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7820
8208
|
global = false
|
|
7821
8209
|
} = {}) {
|
|
7822
8210
|
return {
|
|
7823
|
-
relativeDirPath: global ? (0,
|
|
8211
|
+
relativeDirPath: global ? (0, import_node_path71.join)(".config", "opencode", "agent") : (0, import_node_path71.join)(".opencode", "agent")
|
|
7824
8212
|
};
|
|
7825
8213
|
}
|
|
7826
8214
|
getFrontmatter() {
|
|
@@ -7833,7 +8221,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7833
8221
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
7834
8222
|
const rulesyncFrontmatter = {
|
|
7835
8223
|
targets: ["opencode"],
|
|
7836
|
-
name: name ?? (0,
|
|
8224
|
+
name: name ?? (0, import_node_path71.basename)(this.getRelativeFilePath(), ".md"),
|
|
7837
8225
|
description,
|
|
7838
8226
|
opencode: { mode, ...opencodeSection }
|
|
7839
8227
|
};
|
|
@@ -7886,7 +8274,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7886
8274
|
return {
|
|
7887
8275
|
success: false,
|
|
7888
8276
|
error: new Error(
|
|
7889
|
-
`Invalid frontmatter in ${(0,
|
|
8277
|
+
`Invalid frontmatter in ${(0, import_node_path71.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7890
8278
|
)
|
|
7891
8279
|
};
|
|
7892
8280
|
}
|
|
@@ -7903,7 +8291,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7903
8291
|
global = false
|
|
7904
8292
|
}) {
|
|
7905
8293
|
const paths = this.getSettablePaths({ global });
|
|
7906
|
-
const filePath = (0,
|
|
8294
|
+
const filePath = (0, import_node_path71.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7907
8295
|
const fileContent = await readFileContent(filePath);
|
|
7908
8296
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7909
8297
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7950,7 +8338,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
7950
8338
|
"opencode",
|
|
7951
8339
|
"roo"
|
|
7952
8340
|
];
|
|
7953
|
-
var SubagentsProcessorToolTargetSchema =
|
|
8341
|
+
var SubagentsProcessorToolTargetSchema = import_mini35.z.enum(subagentsProcessorToolTargetTuple);
|
|
7954
8342
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
7955
8343
|
[
|
|
7956
8344
|
"agentsmd",
|
|
@@ -8064,7 +8452,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8064
8452
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
8065
8453
|
*/
|
|
8066
8454
|
async loadRulesyncFiles() {
|
|
8067
|
-
const subagentsDir = (0,
|
|
8455
|
+
const subagentsDir = (0, import_node_path72.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
8068
8456
|
const dirExists = await directoryExists(subagentsDir);
|
|
8069
8457
|
if (!dirExists) {
|
|
8070
8458
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -8079,7 +8467,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8079
8467
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
8080
8468
|
const rulesyncSubagents = [];
|
|
8081
8469
|
for (const mdFile of mdFiles) {
|
|
8082
|
-
const filepath = (0,
|
|
8470
|
+
const filepath = (0, import_node_path72.join)(subagentsDir, mdFile);
|
|
8083
8471
|
try {
|
|
8084
8472
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
8085
8473
|
relativeFilePath: mdFile,
|
|
@@ -8109,14 +8497,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8109
8497
|
const factory = this.getFactory(this.toolTarget);
|
|
8110
8498
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
8111
8499
|
const subagentFilePaths = await findFilesByGlobs(
|
|
8112
|
-
(0,
|
|
8500
|
+
(0, import_node_path72.join)(this.baseDir, paths.relativeDirPath, "*.md")
|
|
8113
8501
|
);
|
|
8114
8502
|
if (forDeletion) {
|
|
8115
8503
|
const toolSubagents2 = subagentFilePaths.map(
|
|
8116
8504
|
(path3) => factory.class.forDeletion({
|
|
8117
8505
|
baseDir: this.baseDir,
|
|
8118
8506
|
relativeDirPath: paths.relativeDirPath,
|
|
8119
|
-
relativeFilePath: (0,
|
|
8507
|
+
relativeFilePath: (0, import_node_path72.basename)(path3),
|
|
8120
8508
|
global: this.global
|
|
8121
8509
|
})
|
|
8122
8510
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -8127,7 +8515,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8127
8515
|
subagentFilePaths.map(
|
|
8128
8516
|
(path3) => factory.class.fromFile({
|
|
8129
8517
|
baseDir: this.baseDir,
|
|
8130
|
-
relativeFilePath: (0,
|
|
8518
|
+
relativeFilePath: (0, import_node_path72.basename)(path3),
|
|
8131
8519
|
global: this.global
|
|
8132
8520
|
})
|
|
8133
8521
|
)
|
|
@@ -8159,48 +8547,48 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8159
8547
|
};
|
|
8160
8548
|
|
|
8161
8549
|
// src/features/rules/agentsmd-rule.ts
|
|
8162
|
-
var
|
|
8550
|
+
var import_node_path75 = require("path");
|
|
8163
8551
|
|
|
8164
8552
|
// src/features/rules/tool-rule.ts
|
|
8165
|
-
var
|
|
8553
|
+
var import_node_path74 = require("path");
|
|
8166
8554
|
|
|
8167
8555
|
// src/features/rules/rulesync-rule.ts
|
|
8168
|
-
var
|
|
8169
|
-
var
|
|
8170
|
-
var RulesyncRuleFrontmatterSchema =
|
|
8171
|
-
root:
|
|
8172
|
-
targets:
|
|
8173
|
-
description:
|
|
8174
|
-
globs:
|
|
8175
|
-
agentsmd:
|
|
8176
|
-
|
|
8556
|
+
var import_node_path73 = require("path");
|
|
8557
|
+
var import_mini36 = require("zod/mini");
|
|
8558
|
+
var RulesyncRuleFrontmatterSchema = import_mini36.z.object({
|
|
8559
|
+
root: import_mini36.z.optional(import_mini36.z.optional(import_mini36.z.boolean())),
|
|
8560
|
+
targets: import_mini36.z.optional(RulesyncTargetsSchema),
|
|
8561
|
+
description: import_mini36.z.optional(import_mini36.z.string()),
|
|
8562
|
+
globs: import_mini36.z.optional(import_mini36.z.array(import_mini36.z.string())),
|
|
8563
|
+
agentsmd: import_mini36.z.optional(
|
|
8564
|
+
import_mini36.z.object({
|
|
8177
8565
|
// @example "path/to/subproject"
|
|
8178
|
-
subprojectPath:
|
|
8566
|
+
subprojectPath: import_mini36.z.optional(import_mini36.z.string())
|
|
8179
8567
|
})
|
|
8180
8568
|
),
|
|
8181
|
-
claudecode:
|
|
8182
|
-
|
|
8569
|
+
claudecode: import_mini36.z.optional(
|
|
8570
|
+
import_mini36.z.object({
|
|
8183
8571
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
8184
8572
|
// @example "src/**/*.ts, tests/**/*.test.ts"
|
|
8185
|
-
paths:
|
|
8573
|
+
paths: import_mini36.z.optional(import_mini36.z.string())
|
|
8186
8574
|
})
|
|
8187
8575
|
),
|
|
8188
|
-
cursor:
|
|
8189
|
-
|
|
8190
|
-
alwaysApply:
|
|
8191
|
-
description:
|
|
8192
|
-
globs:
|
|
8576
|
+
cursor: import_mini36.z.optional(
|
|
8577
|
+
import_mini36.z.object({
|
|
8578
|
+
alwaysApply: import_mini36.z.optional(import_mini36.z.boolean()),
|
|
8579
|
+
description: import_mini36.z.optional(import_mini36.z.string()),
|
|
8580
|
+
globs: import_mini36.z.optional(import_mini36.z.array(import_mini36.z.string()))
|
|
8193
8581
|
})
|
|
8194
8582
|
),
|
|
8195
|
-
copilot:
|
|
8196
|
-
|
|
8197
|
-
excludeAgent:
|
|
8583
|
+
copilot: import_mini36.z.optional(
|
|
8584
|
+
import_mini36.z.object({
|
|
8585
|
+
excludeAgent: import_mini36.z.optional(import_mini36.z.union([import_mini36.z.literal("code-review"), import_mini36.z.literal("coding-agent")]))
|
|
8198
8586
|
})
|
|
8199
8587
|
),
|
|
8200
|
-
antigravity:
|
|
8201
|
-
|
|
8202
|
-
trigger:
|
|
8203
|
-
globs:
|
|
8588
|
+
antigravity: import_mini36.z.optional(
|
|
8589
|
+
import_mini36.z.looseObject({
|
|
8590
|
+
trigger: import_mini36.z.optional(import_mini36.z.string()),
|
|
8591
|
+
globs: import_mini36.z.optional(import_mini36.z.array(import_mini36.z.string()))
|
|
8204
8592
|
})
|
|
8205
8593
|
)
|
|
8206
8594
|
});
|
|
@@ -8212,7 +8600,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8212
8600
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8213
8601
|
if (!result.success) {
|
|
8214
8602
|
throw new Error(
|
|
8215
|
-
`Invalid frontmatter in ${(0,
|
|
8603
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8216
8604
|
);
|
|
8217
8605
|
}
|
|
8218
8606
|
}
|
|
@@ -8247,7 +8635,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8247
8635
|
return {
|
|
8248
8636
|
success: false,
|
|
8249
8637
|
error: new Error(
|
|
8250
|
-
`Invalid frontmatter in ${(0,
|
|
8638
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8251
8639
|
)
|
|
8252
8640
|
};
|
|
8253
8641
|
}
|
|
@@ -8256,12 +8644,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8256
8644
|
relativeFilePath,
|
|
8257
8645
|
validate = true
|
|
8258
8646
|
}) {
|
|
8259
|
-
const legacyPath = (0,
|
|
8647
|
+
const legacyPath = (0, import_node_path73.join)(
|
|
8260
8648
|
process.cwd(),
|
|
8261
8649
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
8262
8650
|
relativeFilePath
|
|
8263
8651
|
);
|
|
8264
|
-
const recommendedPath = (0,
|
|
8652
|
+
const recommendedPath = (0, import_node_path73.join)(
|
|
8265
8653
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8266
8654
|
relativeFilePath
|
|
8267
8655
|
);
|
|
@@ -8282,7 +8670,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8282
8670
|
agentsmd: result.data.agentsmd,
|
|
8283
8671
|
cursor: result.data.cursor
|
|
8284
8672
|
};
|
|
8285
|
-
const filename = (0,
|
|
8673
|
+
const filename = (0, import_node_path73.basename)(legacyPath);
|
|
8286
8674
|
return new _RulesyncRule({
|
|
8287
8675
|
baseDir: process.cwd(),
|
|
8288
8676
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8296,7 +8684,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8296
8684
|
relativeFilePath,
|
|
8297
8685
|
validate = true
|
|
8298
8686
|
}) {
|
|
8299
|
-
const filePath = (0,
|
|
8687
|
+
const filePath = (0, import_node_path73.join)(
|
|
8300
8688
|
process.cwd(),
|
|
8301
8689
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8302
8690
|
relativeFilePath
|
|
@@ -8315,7 +8703,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8315
8703
|
agentsmd: result.data.agentsmd,
|
|
8316
8704
|
cursor: result.data.cursor
|
|
8317
8705
|
};
|
|
8318
|
-
const filename = (0,
|
|
8706
|
+
const filename = (0, import_node_path73.basename)(filePath);
|
|
8319
8707
|
return new _RulesyncRule({
|
|
8320
8708
|
baseDir: process.cwd(),
|
|
8321
8709
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8398,7 +8786,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8398
8786
|
rulesyncRule,
|
|
8399
8787
|
validate = true,
|
|
8400
8788
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
8401
|
-
nonRootPath = { relativeDirPath: (0,
|
|
8789
|
+
nonRootPath = { relativeDirPath: (0, import_node_path74.join)(".agents", "memories") }
|
|
8402
8790
|
}) {
|
|
8403
8791
|
const params = this.buildToolRuleParamsDefault({
|
|
8404
8792
|
baseDir,
|
|
@@ -8409,7 +8797,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8409
8797
|
});
|
|
8410
8798
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
8411
8799
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
8412
|
-
params.relativeDirPath = (0,
|
|
8800
|
+
params.relativeDirPath = (0, import_node_path74.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
8413
8801
|
params.relativeFilePath = "AGENTS.md";
|
|
8414
8802
|
}
|
|
8415
8803
|
return params;
|
|
@@ -8474,7 +8862,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8474
8862
|
relativeFilePath: "AGENTS.md"
|
|
8475
8863
|
},
|
|
8476
8864
|
nonRoot: {
|
|
8477
|
-
relativeDirPath: (0,
|
|
8865
|
+
relativeDirPath: (0, import_node_path75.join)(".agents", "memories")
|
|
8478
8866
|
}
|
|
8479
8867
|
};
|
|
8480
8868
|
}
|
|
@@ -8484,8 +8872,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8484
8872
|
validate = true
|
|
8485
8873
|
}) {
|
|
8486
8874
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
8487
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
8488
|
-
const fileContent = await readFileContent((0,
|
|
8875
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path75.join)(".agents", "memories", relativeFilePath);
|
|
8876
|
+
const fileContent = await readFileContent((0, import_node_path75.join)(baseDir, relativePath));
|
|
8489
8877
|
return new _AgentsMdRule({
|
|
8490
8878
|
baseDir,
|
|
8491
8879
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -8540,21 +8928,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8540
8928
|
};
|
|
8541
8929
|
|
|
8542
8930
|
// src/features/rules/antigravity-rule.ts
|
|
8543
|
-
var
|
|
8544
|
-
var
|
|
8545
|
-
var AntigravityRuleFrontmatterSchema =
|
|
8546
|
-
trigger:
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8931
|
+
var import_node_path76 = require("path");
|
|
8932
|
+
var import_mini37 = require("zod/mini");
|
|
8933
|
+
var AntigravityRuleFrontmatterSchema = import_mini37.z.looseObject({
|
|
8934
|
+
trigger: import_mini37.z.optional(
|
|
8935
|
+
import_mini37.z.union([
|
|
8936
|
+
import_mini37.z.literal("always_on"),
|
|
8937
|
+
import_mini37.z.literal("glob"),
|
|
8938
|
+
import_mini37.z.literal("manual"),
|
|
8939
|
+
import_mini37.z.literal("model_decision"),
|
|
8940
|
+
import_mini37.z.string()
|
|
8553
8941
|
// accepts any string for forward compatibility
|
|
8554
8942
|
])
|
|
8555
8943
|
),
|
|
8556
|
-
globs:
|
|
8557
|
-
description:
|
|
8944
|
+
globs: import_mini37.z.optional(import_mini37.z.string()),
|
|
8945
|
+
description: import_mini37.z.optional(import_mini37.z.string())
|
|
8558
8946
|
});
|
|
8559
8947
|
function parseGlobsString(globs) {
|
|
8560
8948
|
if (!globs) {
|
|
@@ -8699,7 +9087,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8699
9087
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8700
9088
|
if (!result.success) {
|
|
8701
9089
|
throw new Error(
|
|
8702
|
-
`Invalid frontmatter in ${(0,
|
|
9090
|
+
`Invalid frontmatter in ${(0, import_node_path76.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8703
9091
|
);
|
|
8704
9092
|
}
|
|
8705
9093
|
}
|
|
@@ -8714,7 +9102,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8714
9102
|
static getSettablePaths() {
|
|
8715
9103
|
return {
|
|
8716
9104
|
nonRoot: {
|
|
8717
|
-
relativeDirPath: (0,
|
|
9105
|
+
relativeDirPath: (0, import_node_path76.join)(".agent", "rules")
|
|
8718
9106
|
}
|
|
8719
9107
|
};
|
|
8720
9108
|
}
|
|
@@ -8723,7 +9111,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8723
9111
|
relativeFilePath,
|
|
8724
9112
|
validate = true
|
|
8725
9113
|
}) {
|
|
8726
|
-
const filePath = (0,
|
|
9114
|
+
const filePath = (0, import_node_path76.join)(
|
|
8727
9115
|
baseDir,
|
|
8728
9116
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
8729
9117
|
relativeFilePath
|
|
@@ -8864,7 +9252,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8864
9252
|
};
|
|
8865
9253
|
|
|
8866
9254
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
8867
|
-
var
|
|
9255
|
+
var import_node_path77 = require("path");
|
|
8868
9256
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
8869
9257
|
toRulesyncRule() {
|
|
8870
9258
|
const rulesyncFrontmatter = {
|
|
@@ -8890,7 +9278,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8890
9278
|
relativeFilePath: ".augment-guidelines"
|
|
8891
9279
|
},
|
|
8892
9280
|
nonRoot: {
|
|
8893
|
-
relativeDirPath: (0,
|
|
9281
|
+
relativeDirPath: (0, import_node_path77.join)(".augment", "rules")
|
|
8894
9282
|
}
|
|
8895
9283
|
};
|
|
8896
9284
|
}
|
|
@@ -8925,8 +9313,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8925
9313
|
}) {
|
|
8926
9314
|
const settablePaths = this.getSettablePaths();
|
|
8927
9315
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
8928
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
8929
|
-
const fileContent = await readFileContent((0,
|
|
9316
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path77.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9317
|
+
const fileContent = await readFileContent((0, import_node_path77.join)(baseDir, relativePath));
|
|
8930
9318
|
return new _AugmentcodeLegacyRule({
|
|
8931
9319
|
baseDir,
|
|
8932
9320
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -8955,7 +9343,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8955
9343
|
};
|
|
8956
9344
|
|
|
8957
9345
|
// src/features/rules/augmentcode-rule.ts
|
|
8958
|
-
var
|
|
9346
|
+
var import_node_path78 = require("path");
|
|
8959
9347
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
8960
9348
|
toRulesyncRule() {
|
|
8961
9349
|
return this.toRulesyncRuleDefault();
|
|
@@ -8963,7 +9351,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8963
9351
|
static getSettablePaths() {
|
|
8964
9352
|
return {
|
|
8965
9353
|
nonRoot: {
|
|
8966
|
-
relativeDirPath: (0,
|
|
9354
|
+
relativeDirPath: (0, import_node_path78.join)(".augment", "rules")
|
|
8967
9355
|
}
|
|
8968
9356
|
};
|
|
8969
9357
|
}
|
|
@@ -8987,7 +9375,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8987
9375
|
validate = true
|
|
8988
9376
|
}) {
|
|
8989
9377
|
const fileContent = await readFileContent(
|
|
8990
|
-
(0,
|
|
9378
|
+
(0, import_node_path78.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8991
9379
|
);
|
|
8992
9380
|
const { body: content } = parseFrontmatter(fileContent);
|
|
8993
9381
|
return new _AugmentcodeRule({
|
|
@@ -9023,7 +9411,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9023
9411
|
};
|
|
9024
9412
|
|
|
9025
9413
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
9026
|
-
var
|
|
9414
|
+
var import_node_path79 = require("path");
|
|
9027
9415
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
9028
9416
|
static getSettablePaths({
|
|
9029
9417
|
global
|
|
@@ -9042,7 +9430,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9042
9430
|
relativeFilePath: "CLAUDE.md"
|
|
9043
9431
|
},
|
|
9044
9432
|
nonRoot: {
|
|
9045
|
-
relativeDirPath: (0,
|
|
9433
|
+
relativeDirPath: (0, import_node_path79.join)(".claude", "memories")
|
|
9046
9434
|
}
|
|
9047
9435
|
};
|
|
9048
9436
|
}
|
|
@@ -9057,7 +9445,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9057
9445
|
if (isRoot) {
|
|
9058
9446
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9059
9447
|
const fileContent2 = await readFileContent(
|
|
9060
|
-
(0,
|
|
9448
|
+
(0, import_node_path79.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9061
9449
|
);
|
|
9062
9450
|
return new _ClaudecodeLegacyRule({
|
|
9063
9451
|
baseDir,
|
|
@@ -9071,8 +9459,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9071
9459
|
if (!paths.nonRoot) {
|
|
9072
9460
|
throw new Error("nonRoot path is not set");
|
|
9073
9461
|
}
|
|
9074
|
-
const relativePath = (0,
|
|
9075
|
-
const fileContent = await readFileContent((0,
|
|
9462
|
+
const relativePath = (0, import_node_path79.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9463
|
+
const fileContent = await readFileContent((0, import_node_path79.join)(baseDir, relativePath));
|
|
9076
9464
|
return new _ClaudecodeLegacyRule({
|
|
9077
9465
|
baseDir,
|
|
9078
9466
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9131,10 +9519,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9131
9519
|
};
|
|
9132
9520
|
|
|
9133
9521
|
// src/features/rules/claudecode-rule.ts
|
|
9134
|
-
var
|
|
9135
|
-
var
|
|
9136
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
9137
|
-
paths:
|
|
9522
|
+
var import_node_path80 = require("path");
|
|
9523
|
+
var import_mini38 = require("zod/mini");
|
|
9524
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini38.z.object({
|
|
9525
|
+
paths: import_mini38.z.optional(import_mini38.z.string())
|
|
9138
9526
|
});
|
|
9139
9527
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
9140
9528
|
frontmatter;
|
|
@@ -9156,7 +9544,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9156
9544
|
relativeFilePath: "CLAUDE.md"
|
|
9157
9545
|
},
|
|
9158
9546
|
nonRoot: {
|
|
9159
|
-
relativeDirPath: (0,
|
|
9547
|
+
relativeDirPath: (0, import_node_path80.join)(".claude", "rules")
|
|
9160
9548
|
}
|
|
9161
9549
|
};
|
|
9162
9550
|
}
|
|
@@ -9165,7 +9553,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9165
9553
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9166
9554
|
if (!result.success) {
|
|
9167
9555
|
throw new Error(
|
|
9168
|
-
`Invalid frontmatter in ${(0,
|
|
9556
|
+
`Invalid frontmatter in ${(0, import_node_path80.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9169
9557
|
);
|
|
9170
9558
|
}
|
|
9171
9559
|
}
|
|
@@ -9193,7 +9581,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9193
9581
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
9194
9582
|
if (isRoot) {
|
|
9195
9583
|
const fileContent2 = await readFileContent(
|
|
9196
|
-
(0,
|
|
9584
|
+
(0, import_node_path80.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
9197
9585
|
);
|
|
9198
9586
|
return new _ClaudecodeRule({
|
|
9199
9587
|
baseDir,
|
|
@@ -9208,13 +9596,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9208
9596
|
if (!paths.nonRoot) {
|
|
9209
9597
|
throw new Error("nonRoot path is not set");
|
|
9210
9598
|
}
|
|
9211
|
-
const relativePath = (0,
|
|
9212
|
-
const fileContent = await readFileContent((0,
|
|
9599
|
+
const relativePath = (0, import_node_path80.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9600
|
+
const fileContent = await readFileContent((0, import_node_path80.join)(baseDir, relativePath));
|
|
9213
9601
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9214
9602
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9215
9603
|
if (!result.success) {
|
|
9216
9604
|
throw new Error(
|
|
9217
|
-
`Invalid frontmatter in ${(0,
|
|
9605
|
+
`Invalid frontmatter in ${(0, import_node_path80.join)(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
9218
9606
|
);
|
|
9219
9607
|
}
|
|
9220
9608
|
return new _ClaudecodeRule({
|
|
@@ -9321,7 +9709,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9321
9709
|
return {
|
|
9322
9710
|
success: false,
|
|
9323
9711
|
error: new Error(
|
|
9324
|
-
`Invalid frontmatter in ${(0,
|
|
9712
|
+
`Invalid frontmatter in ${(0, import_node_path80.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9325
9713
|
)
|
|
9326
9714
|
};
|
|
9327
9715
|
}
|
|
@@ -9341,10 +9729,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9341
9729
|
};
|
|
9342
9730
|
|
|
9343
9731
|
// src/features/rules/cline-rule.ts
|
|
9344
|
-
var
|
|
9345
|
-
var
|
|
9346
|
-
var ClineRuleFrontmatterSchema =
|
|
9347
|
-
description:
|
|
9732
|
+
var import_node_path81 = require("path");
|
|
9733
|
+
var import_mini39 = require("zod/mini");
|
|
9734
|
+
var ClineRuleFrontmatterSchema = import_mini39.z.object({
|
|
9735
|
+
description: import_mini39.z.string()
|
|
9348
9736
|
});
|
|
9349
9737
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
9350
9738
|
static getSettablePaths() {
|
|
@@ -9386,7 +9774,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9386
9774
|
validate = true
|
|
9387
9775
|
}) {
|
|
9388
9776
|
const fileContent = await readFileContent(
|
|
9389
|
-
(0,
|
|
9777
|
+
(0, import_node_path81.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9390
9778
|
);
|
|
9391
9779
|
return new _ClineRule({
|
|
9392
9780
|
baseDir,
|
|
@@ -9412,7 +9800,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9412
9800
|
};
|
|
9413
9801
|
|
|
9414
9802
|
// src/features/rules/codexcli-rule.ts
|
|
9415
|
-
var
|
|
9803
|
+
var import_node_path82 = require("path");
|
|
9416
9804
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
9417
9805
|
static getSettablePaths({
|
|
9418
9806
|
global
|
|
@@ -9431,7 +9819,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9431
9819
|
relativeFilePath: "AGENTS.md"
|
|
9432
9820
|
},
|
|
9433
9821
|
nonRoot: {
|
|
9434
|
-
relativeDirPath: (0,
|
|
9822
|
+
relativeDirPath: (0, import_node_path82.join)(".codex", "memories")
|
|
9435
9823
|
}
|
|
9436
9824
|
};
|
|
9437
9825
|
}
|
|
@@ -9446,7 +9834,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9446
9834
|
if (isRoot) {
|
|
9447
9835
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9448
9836
|
const fileContent2 = await readFileContent(
|
|
9449
|
-
(0,
|
|
9837
|
+
(0, import_node_path82.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9450
9838
|
);
|
|
9451
9839
|
return new _CodexcliRule({
|
|
9452
9840
|
baseDir,
|
|
@@ -9460,8 +9848,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9460
9848
|
if (!paths.nonRoot) {
|
|
9461
9849
|
throw new Error("nonRoot path is not set");
|
|
9462
9850
|
}
|
|
9463
|
-
const relativePath = (0,
|
|
9464
|
-
const fileContent = await readFileContent((0,
|
|
9851
|
+
const relativePath = (0, import_node_path82.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9852
|
+
const fileContent = await readFileContent((0, import_node_path82.join)(baseDir, relativePath));
|
|
9465
9853
|
return new _CodexcliRule({
|
|
9466
9854
|
baseDir,
|
|
9467
9855
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9520,12 +9908,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9520
9908
|
};
|
|
9521
9909
|
|
|
9522
9910
|
// src/features/rules/copilot-rule.ts
|
|
9523
|
-
var
|
|
9524
|
-
var
|
|
9525
|
-
var CopilotRuleFrontmatterSchema =
|
|
9526
|
-
description:
|
|
9527
|
-
applyTo:
|
|
9528
|
-
excludeAgent:
|
|
9911
|
+
var import_node_path83 = require("path");
|
|
9912
|
+
var import_mini40 = require("zod/mini");
|
|
9913
|
+
var CopilotRuleFrontmatterSchema = import_mini40.z.object({
|
|
9914
|
+
description: import_mini40.z.optional(import_mini40.z.string()),
|
|
9915
|
+
applyTo: import_mini40.z.optional(import_mini40.z.string()),
|
|
9916
|
+
excludeAgent: import_mini40.z.optional(import_mini40.z.union([import_mini40.z.literal("code-review"), import_mini40.z.literal("coding-agent")]))
|
|
9529
9917
|
});
|
|
9530
9918
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
9531
9919
|
frontmatter;
|
|
@@ -9537,7 +9925,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9537
9925
|
relativeFilePath: "copilot-instructions.md"
|
|
9538
9926
|
},
|
|
9539
9927
|
nonRoot: {
|
|
9540
|
-
relativeDirPath: (0,
|
|
9928
|
+
relativeDirPath: (0, import_node_path83.join)(".github", "instructions")
|
|
9541
9929
|
}
|
|
9542
9930
|
};
|
|
9543
9931
|
}
|
|
@@ -9546,7 +9934,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9546
9934
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9547
9935
|
if (!result.success) {
|
|
9548
9936
|
throw new Error(
|
|
9549
|
-
`Invalid frontmatter in ${(0,
|
|
9937
|
+
`Invalid frontmatter in ${(0, import_node_path83.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9550
9938
|
);
|
|
9551
9939
|
}
|
|
9552
9940
|
}
|
|
@@ -9628,11 +10016,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9628
10016
|
validate = true
|
|
9629
10017
|
}) {
|
|
9630
10018
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
9631
|
-
const relativePath = isRoot ? (0,
|
|
10019
|
+
const relativePath = isRoot ? (0, import_node_path83.join)(
|
|
9632
10020
|
this.getSettablePaths().root.relativeDirPath,
|
|
9633
10021
|
this.getSettablePaths().root.relativeFilePath
|
|
9634
|
-
) : (0,
|
|
9635
|
-
const fileContent = await readFileContent((0,
|
|
10022
|
+
) : (0, import_node_path83.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10023
|
+
const fileContent = await readFileContent((0, import_node_path83.join)(baseDir, relativePath));
|
|
9636
10024
|
if (isRoot) {
|
|
9637
10025
|
return new _CopilotRule({
|
|
9638
10026
|
baseDir,
|
|
@@ -9648,7 +10036,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9648
10036
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9649
10037
|
if (!result.success) {
|
|
9650
10038
|
throw new Error(
|
|
9651
|
-
`Invalid frontmatter in ${(0,
|
|
10039
|
+
`Invalid frontmatter in ${(0, import_node_path83.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9652
10040
|
);
|
|
9653
10041
|
}
|
|
9654
10042
|
return new _CopilotRule({
|
|
@@ -9688,7 +10076,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9688
10076
|
return {
|
|
9689
10077
|
success: false,
|
|
9690
10078
|
error: new Error(
|
|
9691
|
-
`Invalid frontmatter in ${(0,
|
|
10079
|
+
`Invalid frontmatter in ${(0, import_node_path83.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9692
10080
|
)
|
|
9693
10081
|
};
|
|
9694
10082
|
}
|
|
@@ -9708,12 +10096,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9708
10096
|
};
|
|
9709
10097
|
|
|
9710
10098
|
// src/features/rules/cursor-rule.ts
|
|
9711
|
-
var
|
|
9712
|
-
var
|
|
9713
|
-
var CursorRuleFrontmatterSchema =
|
|
9714
|
-
description:
|
|
9715
|
-
globs:
|
|
9716
|
-
alwaysApply:
|
|
10099
|
+
var import_node_path84 = require("path");
|
|
10100
|
+
var import_mini41 = require("zod/mini");
|
|
10101
|
+
var CursorRuleFrontmatterSchema = import_mini41.z.object({
|
|
10102
|
+
description: import_mini41.z.optional(import_mini41.z.string()),
|
|
10103
|
+
globs: import_mini41.z.optional(import_mini41.z.string()),
|
|
10104
|
+
alwaysApply: import_mini41.z.optional(import_mini41.z.boolean())
|
|
9717
10105
|
});
|
|
9718
10106
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
9719
10107
|
frontmatter;
|
|
@@ -9721,7 +10109,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9721
10109
|
static getSettablePaths() {
|
|
9722
10110
|
return {
|
|
9723
10111
|
nonRoot: {
|
|
9724
|
-
relativeDirPath: (0,
|
|
10112
|
+
relativeDirPath: (0, import_node_path84.join)(".cursor", "rules")
|
|
9725
10113
|
}
|
|
9726
10114
|
};
|
|
9727
10115
|
}
|
|
@@ -9730,7 +10118,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9730
10118
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9731
10119
|
if (!result.success) {
|
|
9732
10120
|
throw new Error(
|
|
9733
|
-
`Invalid frontmatter in ${(0,
|
|
10121
|
+
`Invalid frontmatter in ${(0, import_node_path84.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9734
10122
|
);
|
|
9735
10123
|
}
|
|
9736
10124
|
}
|
|
@@ -9847,19 +10235,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9847
10235
|
validate = true
|
|
9848
10236
|
}) {
|
|
9849
10237
|
const fileContent = await readFileContent(
|
|
9850
|
-
(0,
|
|
10238
|
+
(0, import_node_path84.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9851
10239
|
);
|
|
9852
10240
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
9853
10241
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9854
10242
|
if (!result.success) {
|
|
9855
10243
|
throw new Error(
|
|
9856
|
-
`Invalid frontmatter in ${(0,
|
|
10244
|
+
`Invalid frontmatter in ${(0, import_node_path84.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9857
10245
|
);
|
|
9858
10246
|
}
|
|
9859
10247
|
return new _CursorRule({
|
|
9860
10248
|
baseDir,
|
|
9861
10249
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
9862
|
-
relativeFilePath: (0,
|
|
10250
|
+
relativeFilePath: (0, import_node_path84.basename)(relativeFilePath),
|
|
9863
10251
|
frontmatter: result.data,
|
|
9864
10252
|
body: content.trim(),
|
|
9865
10253
|
validate
|
|
@@ -9890,7 +10278,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9890
10278
|
return {
|
|
9891
10279
|
success: false,
|
|
9892
10280
|
error: new Error(
|
|
9893
|
-
`Invalid frontmatter in ${(0,
|
|
10281
|
+
`Invalid frontmatter in ${(0, import_node_path84.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9894
10282
|
)
|
|
9895
10283
|
};
|
|
9896
10284
|
}
|
|
@@ -9910,7 +10298,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9910
10298
|
};
|
|
9911
10299
|
|
|
9912
10300
|
// src/features/rules/geminicli-rule.ts
|
|
9913
|
-
var
|
|
10301
|
+
var import_node_path85 = require("path");
|
|
9914
10302
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
9915
10303
|
static getSettablePaths({
|
|
9916
10304
|
global
|
|
@@ -9929,7 +10317,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9929
10317
|
relativeFilePath: "GEMINI.md"
|
|
9930
10318
|
},
|
|
9931
10319
|
nonRoot: {
|
|
9932
|
-
relativeDirPath: (0,
|
|
10320
|
+
relativeDirPath: (0, import_node_path85.join)(".gemini", "memories")
|
|
9933
10321
|
}
|
|
9934
10322
|
};
|
|
9935
10323
|
}
|
|
@@ -9944,7 +10332,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9944
10332
|
if (isRoot) {
|
|
9945
10333
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9946
10334
|
const fileContent2 = await readFileContent(
|
|
9947
|
-
(0,
|
|
10335
|
+
(0, import_node_path85.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9948
10336
|
);
|
|
9949
10337
|
return new _GeminiCliRule({
|
|
9950
10338
|
baseDir,
|
|
@@ -9958,8 +10346,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9958
10346
|
if (!paths.nonRoot) {
|
|
9959
10347
|
throw new Error("nonRoot path is not set");
|
|
9960
10348
|
}
|
|
9961
|
-
const relativePath = (0,
|
|
9962
|
-
const fileContent = await readFileContent((0,
|
|
10349
|
+
const relativePath = (0, import_node_path85.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10350
|
+
const fileContent = await readFileContent((0, import_node_path85.join)(baseDir, relativePath));
|
|
9963
10351
|
return new _GeminiCliRule({
|
|
9964
10352
|
baseDir,
|
|
9965
10353
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10018,7 +10406,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10018
10406
|
};
|
|
10019
10407
|
|
|
10020
10408
|
// src/features/rules/junie-rule.ts
|
|
10021
|
-
var
|
|
10409
|
+
var import_node_path86 = require("path");
|
|
10022
10410
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
10023
10411
|
static getSettablePaths() {
|
|
10024
10412
|
return {
|
|
@@ -10027,7 +10415,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10027
10415
|
relativeFilePath: "guidelines.md"
|
|
10028
10416
|
},
|
|
10029
10417
|
nonRoot: {
|
|
10030
|
-
relativeDirPath: (0,
|
|
10418
|
+
relativeDirPath: (0, import_node_path86.join)(".junie", "memories")
|
|
10031
10419
|
}
|
|
10032
10420
|
};
|
|
10033
10421
|
}
|
|
@@ -10037,8 +10425,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10037
10425
|
validate = true
|
|
10038
10426
|
}) {
|
|
10039
10427
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
10040
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
10041
|
-
const fileContent = await readFileContent((0,
|
|
10428
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path86.join)(".junie", "memories", relativeFilePath);
|
|
10429
|
+
const fileContent = await readFileContent((0, import_node_path86.join)(baseDir, relativePath));
|
|
10042
10430
|
return new _JunieRule({
|
|
10043
10431
|
baseDir,
|
|
10044
10432
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10093,12 +10481,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10093
10481
|
};
|
|
10094
10482
|
|
|
10095
10483
|
// src/features/rules/kilo-rule.ts
|
|
10096
|
-
var
|
|
10484
|
+
var import_node_path87 = require("path");
|
|
10097
10485
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
10098
10486
|
static getSettablePaths(_options = {}) {
|
|
10099
10487
|
return {
|
|
10100
10488
|
nonRoot: {
|
|
10101
|
-
relativeDirPath: (0,
|
|
10489
|
+
relativeDirPath: (0, import_node_path87.join)(".kilocode", "rules")
|
|
10102
10490
|
}
|
|
10103
10491
|
};
|
|
10104
10492
|
}
|
|
@@ -10108,7 +10496,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10108
10496
|
validate = true
|
|
10109
10497
|
}) {
|
|
10110
10498
|
const fileContent = await readFileContent(
|
|
10111
|
-
(0,
|
|
10499
|
+
(0, import_node_path87.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10112
10500
|
);
|
|
10113
10501
|
return new _KiloRule({
|
|
10114
10502
|
baseDir,
|
|
@@ -10160,12 +10548,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10160
10548
|
};
|
|
10161
10549
|
|
|
10162
10550
|
// src/features/rules/kiro-rule.ts
|
|
10163
|
-
var
|
|
10551
|
+
var import_node_path88 = require("path");
|
|
10164
10552
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
10165
10553
|
static getSettablePaths() {
|
|
10166
10554
|
return {
|
|
10167
10555
|
nonRoot: {
|
|
10168
|
-
relativeDirPath: (0,
|
|
10556
|
+
relativeDirPath: (0, import_node_path88.join)(".kiro", "steering")
|
|
10169
10557
|
}
|
|
10170
10558
|
};
|
|
10171
10559
|
}
|
|
@@ -10175,7 +10563,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10175
10563
|
validate = true
|
|
10176
10564
|
}) {
|
|
10177
10565
|
const fileContent = await readFileContent(
|
|
10178
|
-
(0,
|
|
10566
|
+
(0, import_node_path88.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10179
10567
|
);
|
|
10180
10568
|
return new _KiroRule({
|
|
10181
10569
|
baseDir,
|
|
@@ -10229,7 +10617,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10229
10617
|
};
|
|
10230
10618
|
|
|
10231
10619
|
// src/features/rules/opencode-rule.ts
|
|
10232
|
-
var
|
|
10620
|
+
var import_node_path89 = require("path");
|
|
10233
10621
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
10234
10622
|
static getSettablePaths() {
|
|
10235
10623
|
return {
|
|
@@ -10238,7 +10626,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10238
10626
|
relativeFilePath: "AGENTS.md"
|
|
10239
10627
|
},
|
|
10240
10628
|
nonRoot: {
|
|
10241
|
-
relativeDirPath: (0,
|
|
10629
|
+
relativeDirPath: (0, import_node_path89.join)(".opencode", "memories")
|
|
10242
10630
|
}
|
|
10243
10631
|
};
|
|
10244
10632
|
}
|
|
@@ -10248,8 +10636,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10248
10636
|
validate = true
|
|
10249
10637
|
}) {
|
|
10250
10638
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
10251
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
10252
|
-
const fileContent = await readFileContent((0,
|
|
10639
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path89.join)(".opencode", "memories", relativeFilePath);
|
|
10640
|
+
const fileContent = await readFileContent((0, import_node_path89.join)(baseDir, relativePath));
|
|
10253
10641
|
return new _OpenCodeRule({
|
|
10254
10642
|
baseDir,
|
|
10255
10643
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10304,7 +10692,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10304
10692
|
};
|
|
10305
10693
|
|
|
10306
10694
|
// src/features/rules/qwencode-rule.ts
|
|
10307
|
-
var
|
|
10695
|
+
var import_node_path90 = require("path");
|
|
10308
10696
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
10309
10697
|
static getSettablePaths() {
|
|
10310
10698
|
return {
|
|
@@ -10313,7 +10701,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10313
10701
|
relativeFilePath: "QWEN.md"
|
|
10314
10702
|
},
|
|
10315
10703
|
nonRoot: {
|
|
10316
|
-
relativeDirPath: (0,
|
|
10704
|
+
relativeDirPath: (0, import_node_path90.join)(".qwen", "memories")
|
|
10317
10705
|
}
|
|
10318
10706
|
};
|
|
10319
10707
|
}
|
|
@@ -10323,8 +10711,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10323
10711
|
validate = true
|
|
10324
10712
|
}) {
|
|
10325
10713
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
10326
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
10327
|
-
const fileContent = await readFileContent((0,
|
|
10714
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path90.join)(".qwen", "memories", relativeFilePath);
|
|
10715
|
+
const fileContent = await readFileContent((0, import_node_path90.join)(baseDir, relativePath));
|
|
10328
10716
|
return new _QwencodeRule({
|
|
10329
10717
|
baseDir,
|
|
10330
10718
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10375,13 +10763,101 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10375
10763
|
}
|
|
10376
10764
|
};
|
|
10377
10765
|
|
|
10766
|
+
// src/features/rules/replit-rule.ts
|
|
10767
|
+
var import_node_path91 = require("path");
|
|
10768
|
+
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
10769
|
+
static getSettablePaths() {
|
|
10770
|
+
return {
|
|
10771
|
+
root: {
|
|
10772
|
+
relativeDirPath: ".",
|
|
10773
|
+
relativeFilePath: "replit.md"
|
|
10774
|
+
}
|
|
10775
|
+
};
|
|
10776
|
+
}
|
|
10777
|
+
static async fromFile({
|
|
10778
|
+
baseDir = process.cwd(),
|
|
10779
|
+
relativeFilePath,
|
|
10780
|
+
validate = true
|
|
10781
|
+
}) {
|
|
10782
|
+
const paths = this.getSettablePaths();
|
|
10783
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
10784
|
+
if (!isRoot) {
|
|
10785
|
+
throw new Error("ReplitRule only supports root rules");
|
|
10786
|
+
}
|
|
10787
|
+
const relativePath = paths.root.relativeFilePath;
|
|
10788
|
+
const fileContent = await readFileContent(
|
|
10789
|
+
(0, import_node_path91.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
10790
|
+
);
|
|
10791
|
+
return new _ReplitRule({
|
|
10792
|
+
baseDir,
|
|
10793
|
+
relativeDirPath: paths.root.relativeDirPath,
|
|
10794
|
+
relativeFilePath: paths.root.relativeFilePath,
|
|
10795
|
+
fileContent,
|
|
10796
|
+
validate,
|
|
10797
|
+
root: true
|
|
10798
|
+
});
|
|
10799
|
+
}
|
|
10800
|
+
static fromRulesyncRule({
|
|
10801
|
+
baseDir = process.cwd(),
|
|
10802
|
+
rulesyncRule,
|
|
10803
|
+
validate = true
|
|
10804
|
+
}) {
|
|
10805
|
+
const paths = this.getSettablePaths();
|
|
10806
|
+
const isRoot = rulesyncRule.getFrontmatter().root ?? false;
|
|
10807
|
+
if (!isRoot) {
|
|
10808
|
+
throw new Error("ReplitRule only supports root rules");
|
|
10809
|
+
}
|
|
10810
|
+
return new _ReplitRule(
|
|
10811
|
+
this.buildToolRuleParamsDefault({
|
|
10812
|
+
baseDir,
|
|
10813
|
+
rulesyncRule,
|
|
10814
|
+
validate,
|
|
10815
|
+
rootPath: paths.root,
|
|
10816
|
+
nonRootPath: void 0
|
|
10817
|
+
})
|
|
10818
|
+
);
|
|
10819
|
+
}
|
|
10820
|
+
toRulesyncRule() {
|
|
10821
|
+
return this.toRulesyncRuleDefault();
|
|
10822
|
+
}
|
|
10823
|
+
validate() {
|
|
10824
|
+
return { success: true, error: null };
|
|
10825
|
+
}
|
|
10826
|
+
static forDeletion({
|
|
10827
|
+
baseDir = process.cwd(),
|
|
10828
|
+
relativeDirPath,
|
|
10829
|
+
relativeFilePath
|
|
10830
|
+
}) {
|
|
10831
|
+
const paths = this.getSettablePaths();
|
|
10832
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
10833
|
+
return new _ReplitRule({
|
|
10834
|
+
baseDir,
|
|
10835
|
+
relativeDirPath,
|
|
10836
|
+
relativeFilePath,
|
|
10837
|
+
fileContent: "",
|
|
10838
|
+
validate: false,
|
|
10839
|
+
root: isRoot
|
|
10840
|
+
});
|
|
10841
|
+
}
|
|
10842
|
+
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
10843
|
+
const isRoot = rulesyncRule.getFrontmatter().root ?? false;
|
|
10844
|
+
if (!isRoot) {
|
|
10845
|
+
return false;
|
|
10846
|
+
}
|
|
10847
|
+
return this.isTargetedByRulesyncRuleDefault({
|
|
10848
|
+
rulesyncRule,
|
|
10849
|
+
toolTarget: "replit"
|
|
10850
|
+
});
|
|
10851
|
+
}
|
|
10852
|
+
};
|
|
10853
|
+
|
|
10378
10854
|
// src/features/rules/roo-rule.ts
|
|
10379
|
-
var
|
|
10855
|
+
var import_node_path92 = require("path");
|
|
10380
10856
|
var RooRule = class _RooRule extends ToolRule {
|
|
10381
10857
|
static getSettablePaths() {
|
|
10382
10858
|
return {
|
|
10383
10859
|
nonRoot: {
|
|
10384
|
-
relativeDirPath: (0,
|
|
10860
|
+
relativeDirPath: (0, import_node_path92.join)(".roo", "rules")
|
|
10385
10861
|
}
|
|
10386
10862
|
};
|
|
10387
10863
|
}
|
|
@@ -10391,7 +10867,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10391
10867
|
validate = true
|
|
10392
10868
|
}) {
|
|
10393
10869
|
const fileContent = await readFileContent(
|
|
10394
|
-
(0,
|
|
10870
|
+
(0, import_node_path92.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10395
10871
|
);
|
|
10396
10872
|
return new _RooRule({
|
|
10397
10873
|
baseDir,
|
|
@@ -10460,7 +10936,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10460
10936
|
};
|
|
10461
10937
|
|
|
10462
10938
|
// src/features/rules/warp-rule.ts
|
|
10463
|
-
var
|
|
10939
|
+
var import_node_path93 = require("path");
|
|
10464
10940
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
10465
10941
|
constructor({ fileContent, root, ...rest }) {
|
|
10466
10942
|
super({
|
|
@@ -10476,7 +10952,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10476
10952
|
relativeFilePath: "WARP.md"
|
|
10477
10953
|
},
|
|
10478
10954
|
nonRoot: {
|
|
10479
|
-
relativeDirPath: (0,
|
|
10955
|
+
relativeDirPath: (0, import_node_path93.join)(".warp", "memories")
|
|
10480
10956
|
}
|
|
10481
10957
|
};
|
|
10482
10958
|
}
|
|
@@ -10486,8 +10962,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10486
10962
|
validate = true
|
|
10487
10963
|
}) {
|
|
10488
10964
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
10489
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
10490
|
-
const fileContent = await readFileContent((0,
|
|
10965
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path93.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10966
|
+
const fileContent = await readFileContent((0, import_node_path93.join)(baseDir, relativePath));
|
|
10491
10967
|
return new _WarpRule({
|
|
10492
10968
|
baseDir,
|
|
10493
10969
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -10542,12 +11018,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10542
11018
|
};
|
|
10543
11019
|
|
|
10544
11020
|
// src/features/rules/windsurf-rule.ts
|
|
10545
|
-
var
|
|
11021
|
+
var import_node_path94 = require("path");
|
|
10546
11022
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
10547
11023
|
static getSettablePaths() {
|
|
10548
11024
|
return {
|
|
10549
11025
|
nonRoot: {
|
|
10550
|
-
relativeDirPath: (0,
|
|
11026
|
+
relativeDirPath: (0, import_node_path94.join)(".windsurf", "rules")
|
|
10551
11027
|
}
|
|
10552
11028
|
};
|
|
10553
11029
|
}
|
|
@@ -10557,7 +11033,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
10557
11033
|
validate = true
|
|
10558
11034
|
}) {
|
|
10559
11035
|
const fileContent = await readFileContent(
|
|
10560
|
-
(0,
|
|
11036
|
+
(0, import_node_path94.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10561
11037
|
);
|
|
10562
11038
|
return new _WindsurfRule({
|
|
10563
11039
|
baseDir,
|
|
@@ -10626,11 +11102,12 @@ var rulesProcessorToolTargets = [
|
|
|
10626
11102
|
"kiro",
|
|
10627
11103
|
"opencode",
|
|
10628
11104
|
"qwencode",
|
|
11105
|
+
"replit",
|
|
10629
11106
|
"roo",
|
|
10630
11107
|
"warp",
|
|
10631
11108
|
"windsurf"
|
|
10632
11109
|
];
|
|
10633
|
-
var RulesProcessorToolTargetSchema =
|
|
11110
|
+
var RulesProcessorToolTargetSchema = import_mini42.z.enum(rulesProcessorToolTargets);
|
|
10634
11111
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
10635
11112
|
[
|
|
10636
11113
|
"agentsmd",
|
|
@@ -10780,6 +11257,13 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
10780
11257
|
meta: { extension: "md", supportsGlobal: false, ruleDiscoveryMode: "toon" }
|
|
10781
11258
|
}
|
|
10782
11259
|
],
|
|
11260
|
+
[
|
|
11261
|
+
"replit",
|
|
11262
|
+
{
|
|
11263
|
+
class: ReplitRule,
|
|
11264
|
+
meta: { extension: "md", supportsGlobal: false, ruleDiscoveryMode: "auto" }
|
|
11265
|
+
}
|
|
11266
|
+
],
|
|
10783
11267
|
[
|
|
10784
11268
|
"roo",
|
|
10785
11269
|
{
|
|
@@ -10914,7 +11398,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10914
11398
|
}).relativeDirPath;
|
|
10915
11399
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
10916
11400
|
const frontmatter = skill.getFrontmatter();
|
|
10917
|
-
const relativePath = (0,
|
|
11401
|
+
const relativePath = (0, import_node_path95.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
10918
11402
|
return {
|
|
10919
11403
|
name: frontmatter.name,
|
|
10920
11404
|
description: frontmatter.description,
|
|
@@ -10981,10 +11465,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10981
11465
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
10982
11466
|
*/
|
|
10983
11467
|
async loadRulesyncFiles() {
|
|
10984
|
-
const files = await findFilesByGlobs((0,
|
|
11468
|
+
const files = await findFilesByGlobs((0, import_node_path95.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
10985
11469
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
10986
11470
|
const rulesyncRules = await Promise.all(
|
|
10987
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0,
|
|
11471
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path95.basename)(file) }))
|
|
10988
11472
|
);
|
|
10989
11473
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
10990
11474
|
if (rootRules.length > 1) {
|
|
@@ -11002,10 +11486,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11002
11486
|
return rulesyncRules;
|
|
11003
11487
|
}
|
|
11004
11488
|
async loadRulesyncFilesLegacy() {
|
|
11005
|
-
const legacyFiles = await findFilesByGlobs((0,
|
|
11489
|
+
const legacyFiles = await findFilesByGlobs((0, import_node_path95.join)(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
11006
11490
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
11007
11491
|
return Promise.all(
|
|
11008
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0,
|
|
11492
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path95.basename)(file) }))
|
|
11009
11493
|
);
|
|
11010
11494
|
}
|
|
11011
11495
|
/**
|
|
@@ -11023,7 +11507,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11023
11507
|
return [];
|
|
11024
11508
|
}
|
|
11025
11509
|
const rootFilePaths = await findFilesByGlobs(
|
|
11026
|
-
(0,
|
|
11510
|
+
(0, import_node_path95.join)(
|
|
11027
11511
|
this.baseDir,
|
|
11028
11512
|
settablePaths.root.relativeDirPath ?? ".",
|
|
11029
11513
|
settablePaths.root.relativeFilePath
|
|
@@ -11034,7 +11518,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11034
11518
|
(filePath) => factory.class.forDeletion({
|
|
11035
11519
|
baseDir: this.baseDir,
|
|
11036
11520
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
11037
|
-
relativeFilePath: (0,
|
|
11521
|
+
relativeFilePath: (0, import_node_path95.basename)(filePath),
|
|
11038
11522
|
global: this.global
|
|
11039
11523
|
})
|
|
11040
11524
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11043,7 +11527,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11043
11527
|
rootFilePaths.map(
|
|
11044
11528
|
(filePath) => factory.class.fromFile({
|
|
11045
11529
|
baseDir: this.baseDir,
|
|
11046
|
-
relativeFilePath: (0,
|
|
11530
|
+
relativeFilePath: (0, import_node_path95.basename)(filePath),
|
|
11047
11531
|
global: this.global
|
|
11048
11532
|
})
|
|
11049
11533
|
)
|
|
@@ -11055,14 +11539,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11055
11539
|
return [];
|
|
11056
11540
|
}
|
|
11057
11541
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
11058
|
-
(0,
|
|
11542
|
+
(0, import_node_path95.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
11059
11543
|
);
|
|
11060
11544
|
if (forDeletion) {
|
|
11061
11545
|
return nonRootFilePaths.map(
|
|
11062
11546
|
(filePath) => factory.class.forDeletion({
|
|
11063
11547
|
baseDir: this.baseDir,
|
|
11064
11548
|
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
11065
|
-
relativeFilePath: (0,
|
|
11549
|
+
relativeFilePath: (0, import_node_path95.basename)(filePath),
|
|
11066
11550
|
global: this.global
|
|
11067
11551
|
})
|
|
11068
11552
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11071,7 +11555,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11071
11555
|
nonRootFilePaths.map(
|
|
11072
11556
|
(filePath) => factory.class.fromFile({
|
|
11073
11557
|
baseDir: this.baseDir,
|
|
11074
|
-
relativeFilePath: (0,
|
|
11558
|
+
relativeFilePath: (0, import_node_path95.basename)(filePath),
|
|
11075
11559
|
global: this.global
|
|
11076
11560
|
})
|
|
11077
11561
|
)
|
|
@@ -11164,14 +11648,14 @@ s/<command> [arguments]
|
|
|
11164
11648
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
11165
11649
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
11166
11650
|
|
|
11167
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
11651
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path95.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
11168
11652
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
11169
11653
|
|
|
11170
11654
|
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.
|
|
11171
11655
|
|
|
11172
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
11656
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path95.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
11173
11657
|
|
|
11174
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
11658
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path95.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
11175
11659
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
11176
11660
|
const result = [
|
|
11177
11661
|
overview,
|
|
@@ -11453,7 +11937,7 @@ async function generateSkills(config) {
|
|
|
11453
11937
|
}
|
|
11454
11938
|
|
|
11455
11939
|
// src/cli/commands/gitignore.ts
|
|
11456
|
-
var
|
|
11940
|
+
var import_node_path96 = require("path");
|
|
11457
11941
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
11458
11942
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
11459
11943
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -11462,6 +11946,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11462
11946
|
"**/.agents/",
|
|
11463
11947
|
// Antigravity
|
|
11464
11948
|
"**/.agent/rules/",
|
|
11949
|
+
"**/.agent/skills/",
|
|
11465
11950
|
"**/.agent/workflows/",
|
|
11466
11951
|
// Augment
|
|
11467
11952
|
"**/.augmentignore",
|
|
@@ -11515,6 +12000,8 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11515
12000
|
"**/.kilocodeignore",
|
|
11516
12001
|
// Kiro
|
|
11517
12002
|
"**/.kiro/steering/",
|
|
12003
|
+
"**/.kiro/prompts/",
|
|
12004
|
+
"**/.kiro/settings/mcp.json",
|
|
11518
12005
|
"**/.aiignore",
|
|
11519
12006
|
// OpenCode
|
|
11520
12007
|
"**/.opencode/memories/",
|
|
@@ -11524,6 +12011,8 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11524
12011
|
// Qwen
|
|
11525
12012
|
"**/QWEN.md",
|
|
11526
12013
|
"**/.qwen/memories/",
|
|
12014
|
+
// Replit
|
|
12015
|
+
"**/replit.md",
|
|
11527
12016
|
// Roo
|
|
11528
12017
|
"**/.roo/rules/",
|
|
11529
12018
|
"**/.roo/skills/",
|
|
@@ -11587,7 +12076,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
11587
12076
|
return result;
|
|
11588
12077
|
};
|
|
11589
12078
|
var gitignoreCommand = async () => {
|
|
11590
|
-
const gitignorePath = (0,
|
|
12079
|
+
const gitignorePath = (0, import_node_path96.join)(process.cwd(), ".gitignore");
|
|
11591
12080
|
let gitignoreContent = "";
|
|
11592
12081
|
if (await fileExists(gitignorePath)) {
|
|
11593
12082
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -11786,7 +12275,7 @@ async function importSkills(config, tool) {
|
|
|
11786
12275
|
}
|
|
11787
12276
|
|
|
11788
12277
|
// src/cli/commands/init.ts
|
|
11789
|
-
var
|
|
12278
|
+
var import_node_path97 = require("path");
|
|
11790
12279
|
async function initCommand() {
|
|
11791
12280
|
logger.info("Initializing rulesync...");
|
|
11792
12281
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -11795,7 +12284,7 @@ async function initCommand() {
|
|
|
11795
12284
|
logger.success("rulesync initialized successfully!");
|
|
11796
12285
|
logger.info("Next steps:");
|
|
11797
12286
|
logger.info(
|
|
11798
|
-
`1. Edit ${RULESYNC_RELATIVE_DIR_PATH}/**/*.md, ${RULESYNC_MCP_RELATIVE_FILE_PATH} and ${RULESYNC_AIIGNORE_RELATIVE_FILE_PATH}`
|
|
12287
|
+
`1. Edit ${RULESYNC_RELATIVE_DIR_PATH}/**/*.md, ${RULESYNC_RELATIVE_DIR_PATH}/skills/*/${SKILL_FILE_NAME}, ${RULESYNC_MCP_RELATIVE_FILE_PATH} and ${RULESYNC_AIIGNORE_RELATIVE_FILE_PATH}`
|
|
11799
12288
|
);
|
|
11800
12289
|
logger.info("2. Run 'rulesync generate' to create configuration files");
|
|
11801
12290
|
}
|
|
@@ -11809,13 +12298,14 @@ async function createConfigFile() {
|
|
|
11809
12298
|
JSON.stringify(
|
|
11810
12299
|
{
|
|
11811
12300
|
targets: ["copilot", "cursor", "claudecode", "codexcli"],
|
|
11812
|
-
features: ["rules", "ignore", "mcp", "commands", "subagents"],
|
|
12301
|
+
features: ["rules", "ignore", "mcp", "commands", "subagents", "skills"],
|
|
11813
12302
|
baseDirs: ["."],
|
|
11814
12303
|
delete: true,
|
|
11815
12304
|
verbose: false,
|
|
11816
12305
|
global: false,
|
|
11817
12306
|
simulateCommands: false,
|
|
11818
12307
|
simulateSubagents: false,
|
|
12308
|
+
simulateSkills: false,
|
|
11819
12309
|
modularMcp: false
|
|
11820
12310
|
},
|
|
11821
12311
|
null,
|
|
@@ -11934,6 +12424,18 @@ Based on the user's instruction, create a plan while analyzing the related files
|
|
|
11934
12424
|
|
|
11935
12425
|
Attention, again, you are just the planner, so though you can read any files and run any commands for analysis, please don't write any code.
|
|
11936
12426
|
`
|
|
12427
|
+
};
|
|
12428
|
+
const sampleSkillFile = {
|
|
12429
|
+
dirName: "project-context",
|
|
12430
|
+
content: `---
|
|
12431
|
+
name: project-context
|
|
12432
|
+
description: "Summarize the project context and key constraints"
|
|
12433
|
+
targets: ["*"]
|
|
12434
|
+
---
|
|
12435
|
+
|
|
12436
|
+
Summarize the project goals, core constraints, and relevant dependencies.
|
|
12437
|
+
Call out any architecture decisions, shared conventions, and validation steps.
|
|
12438
|
+
Keep the summary concise and ready to reuse in future tasks.`
|
|
11937
12439
|
};
|
|
11938
12440
|
const sampleIgnoreFile = {
|
|
11939
12441
|
content: `credentials/
|
|
@@ -11943,20 +12445,22 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11943
12445
|
const mcpPaths = RulesyncMcp.getSettablePaths();
|
|
11944
12446
|
const commandPaths = RulesyncCommand.getSettablePaths();
|
|
11945
12447
|
const subagentPaths = RulesyncSubagent.getSettablePaths();
|
|
12448
|
+
const skillPaths = RulesyncSkill.getSettablePaths();
|
|
11946
12449
|
const ignorePaths = RulesyncIgnore.getSettablePaths();
|
|
11947
12450
|
await ensureDir(rulePaths.recommended.relativeDirPath);
|
|
11948
12451
|
await ensureDir(mcpPaths.recommended.relativeDirPath);
|
|
11949
12452
|
await ensureDir(commandPaths.relativeDirPath);
|
|
11950
12453
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
12454
|
+
await ensureDir(skillPaths.relativeDirPath);
|
|
11951
12455
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
11952
|
-
const ruleFilepath = (0,
|
|
12456
|
+
const ruleFilepath = (0, import_node_path97.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
11953
12457
|
if (!await fileExists(ruleFilepath)) {
|
|
11954
12458
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
11955
12459
|
logger.success(`Created ${ruleFilepath}`);
|
|
11956
12460
|
} else {
|
|
11957
12461
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
11958
12462
|
}
|
|
11959
|
-
const mcpFilepath = (0,
|
|
12463
|
+
const mcpFilepath = (0, import_node_path97.join)(
|
|
11960
12464
|
mcpPaths.recommended.relativeDirPath,
|
|
11961
12465
|
mcpPaths.recommended.relativeFilePath
|
|
11962
12466
|
);
|
|
@@ -11966,21 +12470,30 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11966
12470
|
} else {
|
|
11967
12471
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
11968
12472
|
}
|
|
11969
|
-
const commandFilepath = (0,
|
|
12473
|
+
const commandFilepath = (0, import_node_path97.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
11970
12474
|
if (!await fileExists(commandFilepath)) {
|
|
11971
12475
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
11972
12476
|
logger.success(`Created ${commandFilepath}`);
|
|
11973
12477
|
} else {
|
|
11974
12478
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
11975
12479
|
}
|
|
11976
|
-
const subagentFilepath = (0,
|
|
12480
|
+
const subagentFilepath = (0, import_node_path97.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
11977
12481
|
if (!await fileExists(subagentFilepath)) {
|
|
11978
12482
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
11979
12483
|
logger.success(`Created ${subagentFilepath}`);
|
|
11980
12484
|
} else {
|
|
11981
12485
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
11982
12486
|
}
|
|
11983
|
-
const
|
|
12487
|
+
const skillDirPath = (0, import_node_path97.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
12488
|
+
await ensureDir(skillDirPath);
|
|
12489
|
+
const skillFilepath = (0, import_node_path97.join)(skillDirPath, SKILL_FILE_NAME);
|
|
12490
|
+
if (!await fileExists(skillFilepath)) {
|
|
12491
|
+
await writeFileContent(skillFilepath, sampleSkillFile.content);
|
|
12492
|
+
logger.success(`Created ${skillFilepath}`);
|
|
12493
|
+
} else {
|
|
12494
|
+
logger.info(`Skipped ${skillFilepath} (already exists)`);
|
|
12495
|
+
}
|
|
12496
|
+
const ignoreFilepath = (0, import_node_path97.join)(
|
|
11984
12497
|
ignorePaths.recommended.relativeDirPath,
|
|
11985
12498
|
ignorePaths.recommended.relativeFilePath
|
|
11986
12499
|
);
|
|
@@ -11996,15 +12509,15 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11996
12509
|
var import_fastmcp = require("fastmcp");
|
|
11997
12510
|
|
|
11998
12511
|
// src/mcp/tools.ts
|
|
11999
|
-
var
|
|
12512
|
+
var import_mini49 = require("zod/mini");
|
|
12000
12513
|
|
|
12001
12514
|
// src/mcp/commands.ts
|
|
12002
|
-
var
|
|
12003
|
-
var
|
|
12515
|
+
var import_node_path98 = require("path");
|
|
12516
|
+
var import_mini43 = require("zod/mini");
|
|
12004
12517
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
12005
12518
|
var maxCommandsCount = 1e3;
|
|
12006
12519
|
async function listCommands() {
|
|
12007
|
-
const commandsDir = (0,
|
|
12520
|
+
const commandsDir = (0, import_node_path98.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12008
12521
|
try {
|
|
12009
12522
|
const files = await listDirectoryFiles(commandsDir);
|
|
12010
12523
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12016,7 +12529,7 @@ async function listCommands() {
|
|
|
12016
12529
|
});
|
|
12017
12530
|
const frontmatter = command.getFrontmatter();
|
|
12018
12531
|
return {
|
|
12019
|
-
relativePathFromCwd: (0,
|
|
12532
|
+
relativePathFromCwd: (0, import_node_path98.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
12020
12533
|
frontmatter
|
|
12021
12534
|
};
|
|
12022
12535
|
} catch (error) {
|
|
@@ -12036,13 +12549,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
12036
12549
|
relativePath: relativePathFromCwd,
|
|
12037
12550
|
intendedRootDir: process.cwd()
|
|
12038
12551
|
});
|
|
12039
|
-
const filename = (0,
|
|
12552
|
+
const filename = (0, import_node_path98.basename)(relativePathFromCwd);
|
|
12040
12553
|
try {
|
|
12041
12554
|
const command = await RulesyncCommand.fromFile({
|
|
12042
12555
|
relativeFilePath: filename
|
|
12043
12556
|
});
|
|
12044
12557
|
return {
|
|
12045
|
-
relativePathFromCwd: (0,
|
|
12558
|
+
relativePathFromCwd: (0, import_node_path98.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12046
12559
|
frontmatter: command.getFrontmatter(),
|
|
12047
12560
|
body: command.getBody()
|
|
12048
12561
|
};
|
|
@@ -12061,7 +12574,7 @@ async function putCommand({
|
|
|
12061
12574
|
relativePath: relativePathFromCwd,
|
|
12062
12575
|
intendedRootDir: process.cwd()
|
|
12063
12576
|
});
|
|
12064
|
-
const filename = (0,
|
|
12577
|
+
const filename = (0, import_node_path98.basename)(relativePathFromCwd);
|
|
12065
12578
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12066
12579
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
12067
12580
|
throw new Error(
|
|
@@ -12071,7 +12584,7 @@ async function putCommand({
|
|
|
12071
12584
|
try {
|
|
12072
12585
|
const existingCommands = await listCommands();
|
|
12073
12586
|
const isUpdate = existingCommands.some(
|
|
12074
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
12587
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path98.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12075
12588
|
);
|
|
12076
12589
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
12077
12590
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -12086,11 +12599,11 @@ async function putCommand({
|
|
|
12086
12599
|
fileContent,
|
|
12087
12600
|
validate: true
|
|
12088
12601
|
});
|
|
12089
|
-
const commandsDir = (0,
|
|
12602
|
+
const commandsDir = (0, import_node_path98.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12090
12603
|
await ensureDir(commandsDir);
|
|
12091
12604
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
12092
12605
|
return {
|
|
12093
|
-
relativePathFromCwd: (0,
|
|
12606
|
+
relativePathFromCwd: (0, import_node_path98.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12094
12607
|
frontmatter: command.getFrontmatter(),
|
|
12095
12608
|
body: command.getBody()
|
|
12096
12609
|
};
|
|
@@ -12105,12 +12618,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12105
12618
|
relativePath: relativePathFromCwd,
|
|
12106
12619
|
intendedRootDir: process.cwd()
|
|
12107
12620
|
});
|
|
12108
|
-
const filename = (0,
|
|
12109
|
-
const fullPath = (0,
|
|
12621
|
+
const filename = (0, import_node_path98.basename)(relativePathFromCwd);
|
|
12622
|
+
const fullPath = (0, import_node_path98.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
12110
12623
|
try {
|
|
12111
12624
|
await removeFile(fullPath);
|
|
12112
12625
|
return {
|
|
12113
|
-
relativePathFromCwd: (0,
|
|
12626
|
+
relativePathFromCwd: (0, import_node_path98.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12114
12627
|
};
|
|
12115
12628
|
} catch (error) {
|
|
12116
12629
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12119,23 +12632,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12119
12632
|
}
|
|
12120
12633
|
}
|
|
12121
12634
|
var commandToolSchemas = {
|
|
12122
|
-
listCommands:
|
|
12123
|
-
getCommand:
|
|
12124
|
-
relativePathFromCwd:
|
|
12635
|
+
listCommands: import_mini43.z.object({}),
|
|
12636
|
+
getCommand: import_mini43.z.object({
|
|
12637
|
+
relativePathFromCwd: import_mini43.z.string()
|
|
12125
12638
|
}),
|
|
12126
|
-
putCommand:
|
|
12127
|
-
relativePathFromCwd:
|
|
12639
|
+
putCommand: import_mini43.z.object({
|
|
12640
|
+
relativePathFromCwd: import_mini43.z.string(),
|
|
12128
12641
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
12129
|
-
body:
|
|
12642
|
+
body: import_mini43.z.string()
|
|
12130
12643
|
}),
|
|
12131
|
-
deleteCommand:
|
|
12132
|
-
relativePathFromCwd:
|
|
12644
|
+
deleteCommand: import_mini43.z.object({
|
|
12645
|
+
relativePathFromCwd: import_mini43.z.string()
|
|
12133
12646
|
})
|
|
12134
12647
|
};
|
|
12135
12648
|
var commandTools = {
|
|
12136
12649
|
listCommands: {
|
|
12137
12650
|
name: "listCommands",
|
|
12138
|
-
description: `List all commands from ${(0,
|
|
12651
|
+
description: `List all commands from ${(0, import_node_path98.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12139
12652
|
parameters: commandToolSchemas.listCommands,
|
|
12140
12653
|
execute: async () => {
|
|
12141
12654
|
const commands = await listCommands();
|
|
@@ -12177,11 +12690,11 @@ var commandTools = {
|
|
|
12177
12690
|
};
|
|
12178
12691
|
|
|
12179
12692
|
// src/mcp/ignore.ts
|
|
12180
|
-
var
|
|
12181
|
-
var
|
|
12693
|
+
var import_node_path99 = require("path");
|
|
12694
|
+
var import_mini44 = require("zod/mini");
|
|
12182
12695
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
12183
12696
|
async function getIgnoreFile() {
|
|
12184
|
-
const ignoreFilePath = (0,
|
|
12697
|
+
const ignoreFilePath = (0, import_node_path99.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12185
12698
|
try {
|
|
12186
12699
|
const content = await readFileContent(ignoreFilePath);
|
|
12187
12700
|
return {
|
|
@@ -12195,7 +12708,7 @@ async function getIgnoreFile() {
|
|
|
12195
12708
|
}
|
|
12196
12709
|
}
|
|
12197
12710
|
async function putIgnoreFile({ content }) {
|
|
12198
|
-
const ignoreFilePath = (0,
|
|
12711
|
+
const ignoreFilePath = (0, import_node_path99.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12199
12712
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
12200
12713
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
12201
12714
|
throw new Error(
|
|
@@ -12216,8 +12729,8 @@ async function putIgnoreFile({ content }) {
|
|
|
12216
12729
|
}
|
|
12217
12730
|
}
|
|
12218
12731
|
async function deleteIgnoreFile() {
|
|
12219
|
-
const aiignorePath = (0,
|
|
12220
|
-
const legacyIgnorePath = (0,
|
|
12732
|
+
const aiignorePath = (0, import_node_path99.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12733
|
+
const legacyIgnorePath = (0, import_node_path99.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
12221
12734
|
try {
|
|
12222
12735
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
12223
12736
|
return {
|
|
@@ -12235,11 +12748,11 @@ async function deleteIgnoreFile() {
|
|
|
12235
12748
|
}
|
|
12236
12749
|
}
|
|
12237
12750
|
var ignoreToolSchemas = {
|
|
12238
|
-
getIgnoreFile:
|
|
12239
|
-
putIgnoreFile:
|
|
12240
|
-
content:
|
|
12751
|
+
getIgnoreFile: import_mini44.z.object({}),
|
|
12752
|
+
putIgnoreFile: import_mini44.z.object({
|
|
12753
|
+
content: import_mini44.z.string()
|
|
12241
12754
|
}),
|
|
12242
|
-
deleteIgnoreFile:
|
|
12755
|
+
deleteIgnoreFile: import_mini44.z.object({})
|
|
12243
12756
|
};
|
|
12244
12757
|
var ignoreTools = {
|
|
12245
12758
|
getIgnoreFile: {
|
|
@@ -12272,8 +12785,8 @@ var ignoreTools = {
|
|
|
12272
12785
|
};
|
|
12273
12786
|
|
|
12274
12787
|
// src/mcp/mcp.ts
|
|
12275
|
-
var
|
|
12276
|
-
var
|
|
12788
|
+
var import_node_path100 = require("path");
|
|
12789
|
+
var import_mini45 = require("zod/mini");
|
|
12277
12790
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
12278
12791
|
async function getMcpFile() {
|
|
12279
12792
|
const config = await ConfigResolver.resolve({});
|
|
@@ -12282,7 +12795,7 @@ async function getMcpFile() {
|
|
|
12282
12795
|
validate: true,
|
|
12283
12796
|
modularMcp: config.getModularMcp()
|
|
12284
12797
|
});
|
|
12285
|
-
const relativePathFromCwd = (0,
|
|
12798
|
+
const relativePathFromCwd = (0, import_node_path100.join)(
|
|
12286
12799
|
rulesyncMcp.getRelativeDirPath(),
|
|
12287
12800
|
rulesyncMcp.getRelativeFilePath()
|
|
12288
12801
|
);
|
|
@@ -12315,7 +12828,7 @@ async function putMcpFile({ content }) {
|
|
|
12315
12828
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12316
12829
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
12317
12830
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
12318
|
-
const fullPath = (0,
|
|
12831
|
+
const fullPath = (0, import_node_path100.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
12319
12832
|
const rulesyncMcp = new RulesyncMcp({
|
|
12320
12833
|
baseDir,
|
|
12321
12834
|
relativeDirPath,
|
|
@@ -12324,9 +12837,9 @@ async function putMcpFile({ content }) {
|
|
|
12324
12837
|
validate: true,
|
|
12325
12838
|
modularMcp: config.getModularMcp()
|
|
12326
12839
|
});
|
|
12327
|
-
await ensureDir((0,
|
|
12840
|
+
await ensureDir((0, import_node_path100.join)(baseDir, relativeDirPath));
|
|
12328
12841
|
await writeFileContent(fullPath, content);
|
|
12329
|
-
const relativePathFromCwd = (0,
|
|
12842
|
+
const relativePathFromCwd = (0, import_node_path100.join)(relativeDirPath, relativeFilePath);
|
|
12330
12843
|
return {
|
|
12331
12844
|
relativePathFromCwd,
|
|
12332
12845
|
content: rulesyncMcp.getFileContent()
|
|
@@ -12341,15 +12854,15 @@ async function deleteMcpFile() {
|
|
|
12341
12854
|
try {
|
|
12342
12855
|
const baseDir = process.cwd();
|
|
12343
12856
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12344
|
-
const recommendedPath = (0,
|
|
12857
|
+
const recommendedPath = (0, import_node_path100.join)(
|
|
12345
12858
|
baseDir,
|
|
12346
12859
|
paths.recommended.relativeDirPath,
|
|
12347
12860
|
paths.recommended.relativeFilePath
|
|
12348
12861
|
);
|
|
12349
|
-
const legacyPath = (0,
|
|
12862
|
+
const legacyPath = (0, import_node_path100.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
12350
12863
|
await removeFile(recommendedPath);
|
|
12351
12864
|
await removeFile(legacyPath);
|
|
12352
|
-
const relativePathFromCwd = (0,
|
|
12865
|
+
const relativePathFromCwd = (0, import_node_path100.join)(
|
|
12353
12866
|
paths.recommended.relativeDirPath,
|
|
12354
12867
|
paths.recommended.relativeFilePath
|
|
12355
12868
|
);
|
|
@@ -12363,11 +12876,11 @@ async function deleteMcpFile() {
|
|
|
12363
12876
|
}
|
|
12364
12877
|
}
|
|
12365
12878
|
var mcpToolSchemas = {
|
|
12366
|
-
getMcpFile:
|
|
12367
|
-
putMcpFile:
|
|
12368
|
-
content:
|
|
12879
|
+
getMcpFile: import_mini45.z.object({}),
|
|
12880
|
+
putMcpFile: import_mini45.z.object({
|
|
12881
|
+
content: import_mini45.z.string()
|
|
12369
12882
|
}),
|
|
12370
|
-
deleteMcpFile:
|
|
12883
|
+
deleteMcpFile: import_mini45.z.object({})
|
|
12371
12884
|
};
|
|
12372
12885
|
var mcpTools = {
|
|
12373
12886
|
getMcpFile: {
|
|
@@ -12400,12 +12913,12 @@ var mcpTools = {
|
|
|
12400
12913
|
};
|
|
12401
12914
|
|
|
12402
12915
|
// src/mcp/rules.ts
|
|
12403
|
-
var
|
|
12404
|
-
var
|
|
12916
|
+
var import_node_path101 = require("path");
|
|
12917
|
+
var import_mini46 = require("zod/mini");
|
|
12405
12918
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
12406
12919
|
var maxRulesCount = 1e3;
|
|
12407
12920
|
async function listRules() {
|
|
12408
|
-
const rulesDir = (0,
|
|
12921
|
+
const rulesDir = (0, import_node_path101.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12409
12922
|
try {
|
|
12410
12923
|
const files = await listDirectoryFiles(rulesDir);
|
|
12411
12924
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12418,7 +12931,7 @@ async function listRules() {
|
|
|
12418
12931
|
});
|
|
12419
12932
|
const frontmatter = rule.getFrontmatter();
|
|
12420
12933
|
return {
|
|
12421
|
-
relativePathFromCwd: (0,
|
|
12934
|
+
relativePathFromCwd: (0, import_node_path101.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
12422
12935
|
frontmatter
|
|
12423
12936
|
};
|
|
12424
12937
|
} catch (error) {
|
|
@@ -12438,14 +12951,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
12438
12951
|
relativePath: relativePathFromCwd,
|
|
12439
12952
|
intendedRootDir: process.cwd()
|
|
12440
12953
|
});
|
|
12441
|
-
const filename = (0,
|
|
12954
|
+
const filename = (0, import_node_path101.basename)(relativePathFromCwd);
|
|
12442
12955
|
try {
|
|
12443
12956
|
const rule = await RulesyncRule.fromFile({
|
|
12444
12957
|
relativeFilePath: filename,
|
|
12445
12958
|
validate: true
|
|
12446
12959
|
});
|
|
12447
12960
|
return {
|
|
12448
|
-
relativePathFromCwd: (0,
|
|
12961
|
+
relativePathFromCwd: (0, import_node_path101.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12449
12962
|
frontmatter: rule.getFrontmatter(),
|
|
12450
12963
|
body: rule.getBody()
|
|
12451
12964
|
};
|
|
@@ -12464,7 +12977,7 @@ async function putRule({
|
|
|
12464
12977
|
relativePath: relativePathFromCwd,
|
|
12465
12978
|
intendedRootDir: process.cwd()
|
|
12466
12979
|
});
|
|
12467
|
-
const filename = (0,
|
|
12980
|
+
const filename = (0, import_node_path101.basename)(relativePathFromCwd);
|
|
12468
12981
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12469
12982
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
12470
12983
|
throw new Error(
|
|
@@ -12474,7 +12987,7 @@ async function putRule({
|
|
|
12474
12987
|
try {
|
|
12475
12988
|
const existingRules = await listRules();
|
|
12476
12989
|
const isUpdate = existingRules.some(
|
|
12477
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
12990
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path101.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12478
12991
|
);
|
|
12479
12992
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
12480
12993
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -12487,11 +13000,11 @@ async function putRule({
|
|
|
12487
13000
|
body,
|
|
12488
13001
|
validate: true
|
|
12489
13002
|
});
|
|
12490
|
-
const rulesDir = (0,
|
|
13003
|
+
const rulesDir = (0, import_node_path101.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12491
13004
|
await ensureDir(rulesDir);
|
|
12492
13005
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
12493
13006
|
return {
|
|
12494
|
-
relativePathFromCwd: (0,
|
|
13007
|
+
relativePathFromCwd: (0, import_node_path101.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12495
13008
|
frontmatter: rule.getFrontmatter(),
|
|
12496
13009
|
body: rule.getBody()
|
|
12497
13010
|
};
|
|
@@ -12506,12 +13019,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
12506
13019
|
relativePath: relativePathFromCwd,
|
|
12507
13020
|
intendedRootDir: process.cwd()
|
|
12508
13021
|
});
|
|
12509
|
-
const filename = (0,
|
|
12510
|
-
const fullPath = (0,
|
|
13022
|
+
const filename = (0, import_node_path101.basename)(relativePathFromCwd);
|
|
13023
|
+
const fullPath = (0, import_node_path101.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
12511
13024
|
try {
|
|
12512
13025
|
await removeFile(fullPath);
|
|
12513
13026
|
return {
|
|
12514
|
-
relativePathFromCwd: (0,
|
|
13027
|
+
relativePathFromCwd: (0, import_node_path101.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12515
13028
|
};
|
|
12516
13029
|
} catch (error) {
|
|
12517
13030
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12520,23 +13033,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
12520
13033
|
}
|
|
12521
13034
|
}
|
|
12522
13035
|
var ruleToolSchemas = {
|
|
12523
|
-
listRules:
|
|
12524
|
-
getRule:
|
|
12525
|
-
relativePathFromCwd:
|
|
13036
|
+
listRules: import_mini46.z.object({}),
|
|
13037
|
+
getRule: import_mini46.z.object({
|
|
13038
|
+
relativePathFromCwd: import_mini46.z.string()
|
|
12526
13039
|
}),
|
|
12527
|
-
putRule:
|
|
12528
|
-
relativePathFromCwd:
|
|
13040
|
+
putRule: import_mini46.z.object({
|
|
13041
|
+
relativePathFromCwd: import_mini46.z.string(),
|
|
12529
13042
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
12530
|
-
body:
|
|
13043
|
+
body: import_mini46.z.string()
|
|
12531
13044
|
}),
|
|
12532
|
-
deleteRule:
|
|
12533
|
-
relativePathFromCwd:
|
|
13045
|
+
deleteRule: import_mini46.z.object({
|
|
13046
|
+
relativePathFromCwd: import_mini46.z.string()
|
|
12534
13047
|
})
|
|
12535
13048
|
};
|
|
12536
13049
|
var ruleTools = {
|
|
12537
13050
|
listRules: {
|
|
12538
13051
|
name: "listRules",
|
|
12539
|
-
description: `List all rules from ${(0,
|
|
13052
|
+
description: `List all rules from ${(0, import_node_path101.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12540
13053
|
parameters: ruleToolSchemas.listRules,
|
|
12541
13054
|
execute: async () => {
|
|
12542
13055
|
const rules = await listRules();
|
|
@@ -12578,8 +13091,8 @@ var ruleTools = {
|
|
|
12578
13091
|
};
|
|
12579
13092
|
|
|
12580
13093
|
// src/mcp/skills.ts
|
|
12581
|
-
var
|
|
12582
|
-
var
|
|
13094
|
+
var import_node_path102 = require("path");
|
|
13095
|
+
var import_mini47 = require("zod/mini");
|
|
12583
13096
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
12584
13097
|
var maxSkillsCount = 1e3;
|
|
12585
13098
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -12595,19 +13108,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
12595
13108
|
};
|
|
12596
13109
|
}
|
|
12597
13110
|
function extractDirName(relativeDirPathFromCwd) {
|
|
12598
|
-
const dirName = (0,
|
|
13111
|
+
const dirName = (0, import_node_path102.basename)(relativeDirPathFromCwd);
|
|
12599
13112
|
if (!dirName) {
|
|
12600
13113
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
12601
13114
|
}
|
|
12602
13115
|
return dirName;
|
|
12603
13116
|
}
|
|
12604
13117
|
async function listSkills() {
|
|
12605
|
-
const skillsDir = (0,
|
|
13118
|
+
const skillsDir = (0, import_node_path102.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
12606
13119
|
try {
|
|
12607
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
13120
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path102.join)(skillsDir, "*"), { type: "dir" });
|
|
12608
13121
|
const skills = await Promise.all(
|
|
12609
13122
|
skillDirPaths.map(async (dirPath) => {
|
|
12610
|
-
const dirName = (0,
|
|
13123
|
+
const dirName = (0, import_node_path102.basename)(dirPath);
|
|
12611
13124
|
if (!dirName) return null;
|
|
12612
13125
|
try {
|
|
12613
13126
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -12615,7 +13128,7 @@ async function listSkills() {
|
|
|
12615
13128
|
});
|
|
12616
13129
|
const frontmatter = skill.getFrontmatter();
|
|
12617
13130
|
return {
|
|
12618
|
-
relativeDirPathFromCwd: (0,
|
|
13131
|
+
relativeDirPathFromCwd: (0, import_node_path102.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12619
13132
|
frontmatter
|
|
12620
13133
|
};
|
|
12621
13134
|
} catch (error) {
|
|
@@ -12641,7 +13154,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
12641
13154
|
dirName
|
|
12642
13155
|
});
|
|
12643
13156
|
return {
|
|
12644
|
-
relativeDirPathFromCwd: (0,
|
|
13157
|
+
relativeDirPathFromCwd: (0, import_node_path102.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12645
13158
|
frontmatter: skill.getFrontmatter(),
|
|
12646
13159
|
body: skill.getBody(),
|
|
12647
13160
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12675,7 +13188,7 @@ async function putSkill({
|
|
|
12675
13188
|
try {
|
|
12676
13189
|
const existingSkills = await listSkills();
|
|
12677
13190
|
const isUpdate = existingSkills.some(
|
|
12678
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
13191
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path102.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12679
13192
|
);
|
|
12680
13193
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
12681
13194
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -12690,9 +13203,9 @@ async function putSkill({
|
|
|
12690
13203
|
otherFiles: aiDirFiles,
|
|
12691
13204
|
validate: true
|
|
12692
13205
|
});
|
|
12693
|
-
const skillDirPath = (0,
|
|
13206
|
+
const skillDirPath = (0, import_node_path102.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12694
13207
|
await ensureDir(skillDirPath);
|
|
12695
|
-
const skillFilePath = (0,
|
|
13208
|
+
const skillFilePath = (0, import_node_path102.join)(skillDirPath, SKILL_FILE_NAME);
|
|
12696
13209
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
12697
13210
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
12698
13211
|
for (const file of otherFiles) {
|
|
@@ -12700,15 +13213,15 @@ async function putSkill({
|
|
|
12700
13213
|
relativePath: file.name,
|
|
12701
13214
|
intendedRootDir: skillDirPath
|
|
12702
13215
|
});
|
|
12703
|
-
const filePath = (0,
|
|
12704
|
-
const fileDir = (0,
|
|
13216
|
+
const filePath = (0, import_node_path102.join)(skillDirPath, file.name);
|
|
13217
|
+
const fileDir = (0, import_node_path102.join)(skillDirPath, (0, import_node_path102.dirname)(file.name));
|
|
12705
13218
|
if (fileDir !== skillDirPath) {
|
|
12706
13219
|
await ensureDir(fileDir);
|
|
12707
13220
|
}
|
|
12708
13221
|
await writeFileContent(filePath, file.body);
|
|
12709
13222
|
}
|
|
12710
13223
|
return {
|
|
12711
|
-
relativeDirPathFromCwd: (0,
|
|
13224
|
+
relativeDirPathFromCwd: (0, import_node_path102.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12712
13225
|
frontmatter: skill.getFrontmatter(),
|
|
12713
13226
|
body: skill.getBody(),
|
|
12714
13227
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12730,13 +13243,13 @@ async function deleteSkill({
|
|
|
12730
13243
|
intendedRootDir: process.cwd()
|
|
12731
13244
|
});
|
|
12732
13245
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
12733
|
-
const skillDirPath = (0,
|
|
13246
|
+
const skillDirPath = (0, import_node_path102.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12734
13247
|
try {
|
|
12735
13248
|
if (await directoryExists(skillDirPath)) {
|
|
12736
13249
|
await removeDirectory(skillDirPath);
|
|
12737
13250
|
}
|
|
12738
13251
|
return {
|
|
12739
|
-
relativeDirPathFromCwd: (0,
|
|
13252
|
+
relativeDirPathFromCwd: (0, import_node_path102.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12740
13253
|
};
|
|
12741
13254
|
} catch (error) {
|
|
12742
13255
|
throw new Error(
|
|
@@ -12747,29 +13260,29 @@ async function deleteSkill({
|
|
|
12747
13260
|
);
|
|
12748
13261
|
}
|
|
12749
13262
|
}
|
|
12750
|
-
var McpSkillFileSchema =
|
|
12751
|
-
name:
|
|
12752
|
-
body:
|
|
13263
|
+
var McpSkillFileSchema = import_mini47.z.object({
|
|
13264
|
+
name: import_mini47.z.string(),
|
|
13265
|
+
body: import_mini47.z.string()
|
|
12753
13266
|
});
|
|
12754
13267
|
var skillToolSchemas = {
|
|
12755
|
-
listSkills:
|
|
12756
|
-
getSkill:
|
|
12757
|
-
relativeDirPathFromCwd:
|
|
13268
|
+
listSkills: import_mini47.z.object({}),
|
|
13269
|
+
getSkill: import_mini47.z.object({
|
|
13270
|
+
relativeDirPathFromCwd: import_mini47.z.string()
|
|
12758
13271
|
}),
|
|
12759
|
-
putSkill:
|
|
12760
|
-
relativeDirPathFromCwd:
|
|
13272
|
+
putSkill: import_mini47.z.object({
|
|
13273
|
+
relativeDirPathFromCwd: import_mini47.z.string(),
|
|
12761
13274
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
12762
|
-
body:
|
|
12763
|
-
otherFiles:
|
|
13275
|
+
body: import_mini47.z.string(),
|
|
13276
|
+
otherFiles: import_mini47.z.optional(import_mini47.z.array(McpSkillFileSchema))
|
|
12764
13277
|
}),
|
|
12765
|
-
deleteSkill:
|
|
12766
|
-
relativeDirPathFromCwd:
|
|
13278
|
+
deleteSkill: import_mini47.z.object({
|
|
13279
|
+
relativeDirPathFromCwd: import_mini47.z.string()
|
|
12767
13280
|
})
|
|
12768
13281
|
};
|
|
12769
13282
|
var skillTools = {
|
|
12770
13283
|
listSkills: {
|
|
12771
13284
|
name: "listSkills",
|
|
12772
|
-
description: `List all skills from ${(0,
|
|
13285
|
+
description: `List all skills from ${(0, import_node_path102.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
12773
13286
|
parameters: skillToolSchemas.listSkills,
|
|
12774
13287
|
execute: async () => {
|
|
12775
13288
|
const skills = await listSkills();
|
|
@@ -12812,12 +13325,12 @@ var skillTools = {
|
|
|
12812
13325
|
};
|
|
12813
13326
|
|
|
12814
13327
|
// src/mcp/subagents.ts
|
|
12815
|
-
var
|
|
12816
|
-
var
|
|
13328
|
+
var import_node_path103 = require("path");
|
|
13329
|
+
var import_mini48 = require("zod/mini");
|
|
12817
13330
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
12818
13331
|
var maxSubagentsCount = 1e3;
|
|
12819
13332
|
async function listSubagents() {
|
|
12820
|
-
const subagentsDir = (0,
|
|
13333
|
+
const subagentsDir = (0, import_node_path103.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12821
13334
|
try {
|
|
12822
13335
|
const files = await listDirectoryFiles(subagentsDir);
|
|
12823
13336
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12830,7 +13343,7 @@ async function listSubagents() {
|
|
|
12830
13343
|
});
|
|
12831
13344
|
const frontmatter = subagent.getFrontmatter();
|
|
12832
13345
|
return {
|
|
12833
|
-
relativePathFromCwd: (0,
|
|
13346
|
+
relativePathFromCwd: (0, import_node_path103.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
12834
13347
|
frontmatter
|
|
12835
13348
|
};
|
|
12836
13349
|
} catch (error) {
|
|
@@ -12852,14 +13365,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
12852
13365
|
relativePath: relativePathFromCwd,
|
|
12853
13366
|
intendedRootDir: process.cwd()
|
|
12854
13367
|
});
|
|
12855
|
-
const filename = (0,
|
|
13368
|
+
const filename = (0, import_node_path103.basename)(relativePathFromCwd);
|
|
12856
13369
|
try {
|
|
12857
13370
|
const subagent = await RulesyncSubagent.fromFile({
|
|
12858
13371
|
relativeFilePath: filename,
|
|
12859
13372
|
validate: true
|
|
12860
13373
|
});
|
|
12861
13374
|
return {
|
|
12862
|
-
relativePathFromCwd: (0,
|
|
13375
|
+
relativePathFromCwd: (0, import_node_path103.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12863
13376
|
frontmatter: subagent.getFrontmatter(),
|
|
12864
13377
|
body: subagent.getBody()
|
|
12865
13378
|
};
|
|
@@ -12878,7 +13391,7 @@ async function putSubagent({
|
|
|
12878
13391
|
relativePath: relativePathFromCwd,
|
|
12879
13392
|
intendedRootDir: process.cwd()
|
|
12880
13393
|
});
|
|
12881
|
-
const filename = (0,
|
|
13394
|
+
const filename = (0, import_node_path103.basename)(relativePathFromCwd);
|
|
12882
13395
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12883
13396
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
12884
13397
|
throw new Error(
|
|
@@ -12888,7 +13401,7 @@ async function putSubagent({
|
|
|
12888
13401
|
try {
|
|
12889
13402
|
const existingSubagents = await listSubagents();
|
|
12890
13403
|
const isUpdate = existingSubagents.some(
|
|
12891
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
13404
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path103.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12892
13405
|
);
|
|
12893
13406
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
12894
13407
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -12901,11 +13414,11 @@ async function putSubagent({
|
|
|
12901
13414
|
body,
|
|
12902
13415
|
validate: true
|
|
12903
13416
|
});
|
|
12904
|
-
const subagentsDir = (0,
|
|
13417
|
+
const subagentsDir = (0, import_node_path103.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12905
13418
|
await ensureDir(subagentsDir);
|
|
12906
13419
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
12907
13420
|
return {
|
|
12908
|
-
relativePathFromCwd: (0,
|
|
13421
|
+
relativePathFromCwd: (0, import_node_path103.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12909
13422
|
frontmatter: subagent.getFrontmatter(),
|
|
12910
13423
|
body: subagent.getBody()
|
|
12911
13424
|
};
|
|
@@ -12920,12 +13433,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12920
13433
|
relativePath: relativePathFromCwd,
|
|
12921
13434
|
intendedRootDir: process.cwd()
|
|
12922
13435
|
});
|
|
12923
|
-
const filename = (0,
|
|
12924
|
-
const fullPath = (0,
|
|
13436
|
+
const filename = (0, import_node_path103.basename)(relativePathFromCwd);
|
|
13437
|
+
const fullPath = (0, import_node_path103.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
12925
13438
|
try {
|
|
12926
13439
|
await removeFile(fullPath);
|
|
12927
13440
|
return {
|
|
12928
|
-
relativePathFromCwd: (0,
|
|
13441
|
+
relativePathFromCwd: (0, import_node_path103.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12929
13442
|
};
|
|
12930
13443
|
} catch (error) {
|
|
12931
13444
|
throw new Error(
|
|
@@ -12937,23 +13450,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12937
13450
|
}
|
|
12938
13451
|
}
|
|
12939
13452
|
var subagentToolSchemas = {
|
|
12940
|
-
listSubagents:
|
|
12941
|
-
getSubagent:
|
|
12942
|
-
relativePathFromCwd:
|
|
13453
|
+
listSubagents: import_mini48.z.object({}),
|
|
13454
|
+
getSubagent: import_mini48.z.object({
|
|
13455
|
+
relativePathFromCwd: import_mini48.z.string()
|
|
12943
13456
|
}),
|
|
12944
|
-
putSubagent:
|
|
12945
|
-
relativePathFromCwd:
|
|
13457
|
+
putSubagent: import_mini48.z.object({
|
|
13458
|
+
relativePathFromCwd: import_mini48.z.string(),
|
|
12946
13459
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
12947
|
-
body:
|
|
13460
|
+
body: import_mini48.z.string()
|
|
12948
13461
|
}),
|
|
12949
|
-
deleteSubagent:
|
|
12950
|
-
relativePathFromCwd:
|
|
13462
|
+
deleteSubagent: import_mini48.z.object({
|
|
13463
|
+
relativePathFromCwd: import_mini48.z.string()
|
|
12951
13464
|
})
|
|
12952
13465
|
};
|
|
12953
13466
|
var subagentTools = {
|
|
12954
13467
|
listSubagents: {
|
|
12955
13468
|
name: "listSubagents",
|
|
12956
|
-
description: `List all subagents from ${(0,
|
|
13469
|
+
description: `List all subagents from ${(0, import_node_path103.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12957
13470
|
parameters: subagentToolSchemas.listSubagents,
|
|
12958
13471
|
execute: async () => {
|
|
12959
13472
|
const subagents = await listSubagents();
|
|
@@ -12995,20 +13508,20 @@ var subagentTools = {
|
|
|
12995
13508
|
};
|
|
12996
13509
|
|
|
12997
13510
|
// src/mcp/tools.ts
|
|
12998
|
-
var rulesyncFeatureSchema =
|
|
12999
|
-
var rulesyncOperationSchema =
|
|
13000
|
-
var skillFileSchema =
|
|
13001
|
-
name:
|
|
13002
|
-
body:
|
|
13511
|
+
var rulesyncFeatureSchema = import_mini49.z.enum(["rule", "command", "subagent", "skill", "ignore", "mcp"]);
|
|
13512
|
+
var rulesyncOperationSchema = import_mini49.z.enum(["list", "get", "put", "delete"]);
|
|
13513
|
+
var skillFileSchema = import_mini49.z.object({
|
|
13514
|
+
name: import_mini49.z.string(),
|
|
13515
|
+
body: import_mini49.z.string()
|
|
13003
13516
|
});
|
|
13004
|
-
var rulesyncToolSchema =
|
|
13517
|
+
var rulesyncToolSchema = import_mini49.z.object({
|
|
13005
13518
|
feature: rulesyncFeatureSchema,
|
|
13006
13519
|
operation: rulesyncOperationSchema,
|
|
13007
|
-
targetPathFromCwd:
|
|
13008
|
-
frontmatter:
|
|
13009
|
-
body:
|
|
13010
|
-
otherFiles:
|
|
13011
|
-
content:
|
|
13520
|
+
targetPathFromCwd: import_mini49.z.optional(import_mini49.z.string()),
|
|
13521
|
+
frontmatter: import_mini49.z.optional(import_mini49.z.unknown()),
|
|
13522
|
+
body: import_mini49.z.optional(import_mini49.z.string()),
|
|
13523
|
+
otherFiles: import_mini49.z.optional(import_mini49.z.array(skillFileSchema)),
|
|
13524
|
+
content: import_mini49.z.optional(import_mini49.z.string())
|
|
13012
13525
|
});
|
|
13013
13526
|
var supportedOperationsByFeature = {
|
|
13014
13527
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -13204,7 +13717,7 @@ async function mcpCommand({ version }) {
|
|
|
13204
13717
|
}
|
|
13205
13718
|
|
|
13206
13719
|
// src/cli/index.ts
|
|
13207
|
-
var getVersion = () => "5.
|
|
13720
|
+
var getVersion = () => "5.5.0";
|
|
13208
13721
|
var main = async () => {
|
|
13209
13722
|
const program = new import_commander.Command();
|
|
13210
13723
|
const version = getVersion();
|