rulesync 5.6.0 → 5.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/dist/index.cjs +827 -427
- package/dist/index.js +799 -399
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -63,37 +63,52 @@ var isEnvTest = process.env.NODE_ENV === "test";
|
|
|
63
63
|
// src/utils/logger.ts
|
|
64
64
|
var Logger = class {
|
|
65
65
|
_verbose = false;
|
|
66
|
+
_silent = false;
|
|
66
67
|
console = import_consola.consola.withDefaults({
|
|
67
68
|
tag: "rulesync"
|
|
68
69
|
});
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Configure logger with verbose and silent mode settings.
|
|
72
|
+
* Handles conflicting flags where silent takes precedence.
|
|
73
|
+
* @param verbose - Enable verbose logging
|
|
74
|
+
* @param silent - Enable silent mode (suppresses all output except errors)
|
|
75
|
+
*/
|
|
76
|
+
configure({ verbose, silent }) {
|
|
77
|
+
if (verbose && silent) {
|
|
78
|
+
this._silent = false;
|
|
79
|
+
this.warn("Both --verbose and --silent specified; --silent takes precedence");
|
|
80
|
+
}
|
|
81
|
+
this._silent = silent;
|
|
82
|
+
this._verbose = verbose && !silent;
|
|
71
83
|
}
|
|
72
84
|
get verbose() {
|
|
73
85
|
return this._verbose;
|
|
74
86
|
}
|
|
87
|
+
get silent() {
|
|
88
|
+
return this._silent;
|
|
89
|
+
}
|
|
75
90
|
info(message, ...args) {
|
|
76
|
-
if (isEnvTest) return;
|
|
91
|
+
if (isEnvTest || this._silent) return;
|
|
77
92
|
this.console.info(message, ...args);
|
|
78
93
|
}
|
|
79
|
-
// Success (always shown)
|
|
94
|
+
// Success (always shown unless silent)
|
|
80
95
|
success(message, ...args) {
|
|
81
|
-
if (isEnvTest) return;
|
|
96
|
+
if (isEnvTest || this._silent) return;
|
|
82
97
|
this.console.success(message, ...args);
|
|
83
98
|
}
|
|
84
|
-
// Warning (always shown)
|
|
99
|
+
// Warning (always shown unless silent)
|
|
85
100
|
warn(message, ...args) {
|
|
86
|
-
if (isEnvTest) return;
|
|
101
|
+
if (isEnvTest || this._silent) return;
|
|
87
102
|
this.console.warn(message, ...args);
|
|
88
103
|
}
|
|
89
|
-
// Error (always shown)
|
|
104
|
+
// Error (always shown, even in silent mode)
|
|
90
105
|
error(message, ...args) {
|
|
91
106
|
if (isEnvTest) return;
|
|
92
107
|
this.console.error(message, ...args);
|
|
93
108
|
}
|
|
94
109
|
// Debug level (shown only in verbose mode)
|
|
95
110
|
debug(message, ...args) {
|
|
96
|
-
if (isEnvTest) return;
|
|
111
|
+
if (isEnvTest || this._silent) return;
|
|
97
112
|
if (this._verbose) {
|
|
98
113
|
this.console.info(message, ...args);
|
|
99
114
|
}
|
|
@@ -284,6 +299,7 @@ var ConfigParamsSchema = import_mini3.z.object({
|
|
|
284
299
|
delete: import_mini3.z.boolean(),
|
|
285
300
|
// New non-experimental options
|
|
286
301
|
global: (0, import_mini3.optional)(import_mini3.z.boolean()),
|
|
302
|
+
silent: (0, import_mini3.optional)(import_mini3.z.boolean()),
|
|
287
303
|
simulateCommands: (0, import_mini3.optional)(import_mini3.z.boolean()),
|
|
288
304
|
simulateSubagents: (0, import_mini3.optional)(import_mini3.z.boolean()),
|
|
289
305
|
simulateSkills: (0, import_mini3.optional)(import_mini3.z.boolean()),
|
|
@@ -307,6 +323,7 @@ var Config = class {
|
|
|
307
323
|
verbose;
|
|
308
324
|
delete;
|
|
309
325
|
global;
|
|
326
|
+
silent;
|
|
310
327
|
simulateCommands;
|
|
311
328
|
simulateSubagents;
|
|
312
329
|
simulateSkills;
|
|
@@ -318,6 +335,7 @@ var Config = class {
|
|
|
318
335
|
verbose,
|
|
319
336
|
delete: isDelete,
|
|
320
337
|
global,
|
|
338
|
+
silent,
|
|
321
339
|
simulateCommands,
|
|
322
340
|
simulateSubagents,
|
|
323
341
|
simulateSkills,
|
|
@@ -330,6 +348,7 @@ var Config = class {
|
|
|
330
348
|
this.verbose = verbose;
|
|
331
349
|
this.delete = isDelete;
|
|
332
350
|
this.global = global ?? false;
|
|
351
|
+
this.silent = silent ?? false;
|
|
333
352
|
this.simulateCommands = simulateCommands ?? false;
|
|
334
353
|
this.simulateSubagents = simulateSubagents ?? false;
|
|
335
354
|
this.simulateSkills = simulateSkills ?? false;
|
|
@@ -373,6 +392,9 @@ var Config = class {
|
|
|
373
392
|
getGlobal() {
|
|
374
393
|
return this.global;
|
|
375
394
|
}
|
|
395
|
+
getSilent() {
|
|
396
|
+
return this.silent;
|
|
397
|
+
}
|
|
376
398
|
getSimulateCommands() {
|
|
377
399
|
return this.simulateCommands;
|
|
378
400
|
}
|
|
@@ -396,6 +418,7 @@ var getDefaults = () => ({
|
|
|
396
418
|
baseDirs: [process.cwd()],
|
|
397
419
|
configPath: "rulesync.jsonc",
|
|
398
420
|
global: false,
|
|
421
|
+
silent: false,
|
|
399
422
|
simulateCommands: false,
|
|
400
423
|
simulateSubagents: false,
|
|
401
424
|
simulateSkills: false,
|
|
@@ -410,6 +433,7 @@ var ConfigResolver = class {
|
|
|
410
433
|
baseDirs,
|
|
411
434
|
configPath = getDefaults().configPath,
|
|
412
435
|
global,
|
|
436
|
+
silent,
|
|
413
437
|
simulateCommands,
|
|
414
438
|
simulateSubagents,
|
|
415
439
|
simulateSkills,
|
|
@@ -443,6 +467,7 @@ var ConfigResolver = class {
|
|
|
443
467
|
global: resolvedGlobal
|
|
444
468
|
}),
|
|
445
469
|
global: resolvedGlobal,
|
|
470
|
+
silent: silent ?? configByFile.silent ?? getDefaults().silent,
|
|
446
471
|
simulateCommands: resolvedSimulateCommands,
|
|
447
472
|
simulateSubagents: resolvedSimulateSubagents,
|
|
448
473
|
simulateSkills: resolvedSimulateSkills,
|
|
@@ -5240,8 +5265,8 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
5240
5265
|
|
|
5241
5266
|
// src/features/rules/rules-processor.ts
|
|
5242
5267
|
var import_toon = require("@toon-format/toon");
|
|
5243
|
-
var
|
|
5244
|
-
var
|
|
5268
|
+
var import_node_path97 = require("path");
|
|
5269
|
+
var import_mini44 = require("zod/mini");
|
|
5245
5270
|
|
|
5246
5271
|
// src/constants/general.ts
|
|
5247
5272
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
@@ -5706,8 +5731,8 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
|
5706
5731
|
};
|
|
5707
5732
|
|
|
5708
5733
|
// src/features/skills/skills-processor.ts
|
|
5709
|
-
var
|
|
5710
|
-
var
|
|
5734
|
+
var import_node_path62 = require("path");
|
|
5735
|
+
var import_mini30 = require("zod/mini");
|
|
5711
5736
|
|
|
5712
5737
|
// src/types/dir-feature-processor.ts
|
|
5713
5738
|
var import_node_path51 = require("path");
|
|
@@ -6883,18 +6908,197 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6883
6908
|
}
|
|
6884
6909
|
};
|
|
6885
6910
|
|
|
6886
|
-
// src/features/skills/
|
|
6911
|
+
// src/features/skills/kiro-skill.ts
|
|
6887
6912
|
var import_node_path59 = require("path");
|
|
6888
6913
|
var import_mini27 = require("zod/mini");
|
|
6889
|
-
var
|
|
6914
|
+
var KiroSkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
6890
6915
|
name: import_mini27.z.string(),
|
|
6891
|
-
description: import_mini27.z.string()
|
|
6892
|
-
|
|
6916
|
+
description: import_mini27.z.string()
|
|
6917
|
+
});
|
|
6918
|
+
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
6919
|
+
constructor({
|
|
6920
|
+
baseDir = process.cwd(),
|
|
6921
|
+
relativeDirPath = (0, import_node_path59.join)(".kiro", "skills"),
|
|
6922
|
+
dirName,
|
|
6923
|
+
frontmatter,
|
|
6924
|
+
body,
|
|
6925
|
+
otherFiles = [],
|
|
6926
|
+
validate = true,
|
|
6927
|
+
global = false
|
|
6928
|
+
}) {
|
|
6929
|
+
super({
|
|
6930
|
+
baseDir,
|
|
6931
|
+
relativeDirPath,
|
|
6932
|
+
dirName,
|
|
6933
|
+
mainFile: {
|
|
6934
|
+
name: SKILL_FILE_NAME,
|
|
6935
|
+
body,
|
|
6936
|
+
frontmatter: { ...frontmatter }
|
|
6937
|
+
},
|
|
6938
|
+
otherFiles,
|
|
6939
|
+
global
|
|
6940
|
+
});
|
|
6941
|
+
if (validate) {
|
|
6942
|
+
const result = this.validate();
|
|
6943
|
+
if (!result.success) {
|
|
6944
|
+
throw result.error;
|
|
6945
|
+
}
|
|
6946
|
+
}
|
|
6947
|
+
}
|
|
6948
|
+
static getSettablePaths(options) {
|
|
6949
|
+
if (options?.global) {
|
|
6950
|
+
throw new Error("KiroSkill does not support global mode.");
|
|
6951
|
+
}
|
|
6952
|
+
return {
|
|
6953
|
+
relativeDirPath: (0, import_node_path59.join)(".kiro", "skills")
|
|
6954
|
+
};
|
|
6955
|
+
}
|
|
6956
|
+
getFrontmatter() {
|
|
6957
|
+
if (!this.mainFile?.frontmatter) {
|
|
6958
|
+
throw new Error("Frontmatter is not defined");
|
|
6959
|
+
}
|
|
6960
|
+
const result = KiroSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
6961
|
+
return result;
|
|
6962
|
+
}
|
|
6963
|
+
getBody() {
|
|
6964
|
+
return this.mainFile?.body ?? "";
|
|
6965
|
+
}
|
|
6966
|
+
validate() {
|
|
6967
|
+
if (!this.mainFile) {
|
|
6968
|
+
return {
|
|
6969
|
+
success: false,
|
|
6970
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
6971
|
+
};
|
|
6972
|
+
}
|
|
6973
|
+
const result = KiroSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
6974
|
+
if (!result.success) {
|
|
6975
|
+
return {
|
|
6976
|
+
success: false,
|
|
6977
|
+
error: new Error(
|
|
6978
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
6979
|
+
)
|
|
6980
|
+
};
|
|
6981
|
+
}
|
|
6982
|
+
if (result.data.name !== this.getDirName()) {
|
|
6983
|
+
return {
|
|
6984
|
+
success: false,
|
|
6985
|
+
error: new Error(
|
|
6986
|
+
`${this.getDirPath()}: frontmatter name (${result.data.name}) must match directory name (${this.getDirName()})`
|
|
6987
|
+
)
|
|
6988
|
+
};
|
|
6989
|
+
}
|
|
6990
|
+
return { success: true, error: null };
|
|
6991
|
+
}
|
|
6992
|
+
toRulesyncSkill() {
|
|
6993
|
+
const frontmatter = this.getFrontmatter();
|
|
6994
|
+
const rulesyncFrontmatter = {
|
|
6995
|
+
name: frontmatter.name,
|
|
6996
|
+
description: frontmatter.description,
|
|
6997
|
+
targets: ["*"]
|
|
6998
|
+
};
|
|
6999
|
+
return new RulesyncSkill({
|
|
7000
|
+
baseDir: this.baseDir,
|
|
7001
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
7002
|
+
dirName: this.getDirName(),
|
|
7003
|
+
frontmatter: rulesyncFrontmatter,
|
|
7004
|
+
body: this.getBody(),
|
|
7005
|
+
otherFiles: this.getOtherFiles(),
|
|
7006
|
+
validate: true,
|
|
7007
|
+
global: this.global
|
|
7008
|
+
});
|
|
7009
|
+
}
|
|
7010
|
+
static fromRulesyncSkill({
|
|
7011
|
+
rulesyncSkill,
|
|
7012
|
+
validate = true,
|
|
7013
|
+
global = false
|
|
7014
|
+
}) {
|
|
7015
|
+
const settablePaths = _KiroSkill.getSettablePaths({ global });
|
|
7016
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
7017
|
+
const kiroFrontmatter = {
|
|
7018
|
+
name: rulesyncFrontmatter.name,
|
|
7019
|
+
description: rulesyncFrontmatter.description
|
|
7020
|
+
};
|
|
7021
|
+
return new _KiroSkill({
|
|
7022
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
7023
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
7024
|
+
dirName: rulesyncSkill.getDirName(),
|
|
7025
|
+
frontmatter: kiroFrontmatter,
|
|
7026
|
+
body: rulesyncSkill.getBody(),
|
|
7027
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
7028
|
+
validate,
|
|
7029
|
+
global
|
|
7030
|
+
});
|
|
7031
|
+
}
|
|
7032
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
7033
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
7034
|
+
return targets.includes("*") || targets.includes("kiro");
|
|
7035
|
+
}
|
|
7036
|
+
static async fromDir(params) {
|
|
7037
|
+
const loaded = await this.loadSkillDirContent({
|
|
7038
|
+
...params,
|
|
7039
|
+
getSettablePaths: _KiroSkill.getSettablePaths
|
|
7040
|
+
});
|
|
7041
|
+
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7042
|
+
if (!result.success) {
|
|
7043
|
+
const skillDirPath = (0, import_node_path59.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7044
|
+
throw new Error(
|
|
7045
|
+
`Invalid frontmatter in ${(0, import_node_path59.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7046
|
+
);
|
|
7047
|
+
}
|
|
7048
|
+
if (result.data.name !== loaded.dirName) {
|
|
7049
|
+
const skillFilePath = (0, import_node_path59.join)(
|
|
7050
|
+
loaded.baseDir,
|
|
7051
|
+
loaded.relativeDirPath,
|
|
7052
|
+
loaded.dirName,
|
|
7053
|
+
SKILL_FILE_NAME
|
|
7054
|
+
);
|
|
7055
|
+
throw new Error(
|
|
7056
|
+
`Frontmatter name (${result.data.name}) must match directory name (${loaded.dirName}) in ${skillFilePath}`
|
|
7057
|
+
);
|
|
7058
|
+
}
|
|
7059
|
+
return new _KiroSkill({
|
|
7060
|
+
baseDir: loaded.baseDir,
|
|
7061
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
7062
|
+
dirName: loaded.dirName,
|
|
7063
|
+
frontmatter: result.data,
|
|
7064
|
+
body: loaded.body,
|
|
7065
|
+
otherFiles: loaded.otherFiles,
|
|
7066
|
+
validate: true,
|
|
7067
|
+
global: loaded.global
|
|
7068
|
+
});
|
|
7069
|
+
}
|
|
7070
|
+
static forDeletion({
|
|
7071
|
+
baseDir = process.cwd(),
|
|
7072
|
+
relativeDirPath,
|
|
7073
|
+
dirName,
|
|
7074
|
+
global = false
|
|
7075
|
+
}) {
|
|
7076
|
+
const settablePaths = _KiroSkill.getSettablePaths({ global });
|
|
7077
|
+
return new _KiroSkill({
|
|
7078
|
+
baseDir,
|
|
7079
|
+
relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
|
|
7080
|
+
dirName,
|
|
7081
|
+
frontmatter: { name: "", description: "" },
|
|
7082
|
+
body: "",
|
|
7083
|
+
otherFiles: [],
|
|
7084
|
+
validate: false,
|
|
7085
|
+
global
|
|
7086
|
+
});
|
|
7087
|
+
}
|
|
7088
|
+
};
|
|
7089
|
+
|
|
7090
|
+
// src/features/skills/opencode-skill.ts
|
|
7091
|
+
var import_node_path60 = require("path");
|
|
7092
|
+
var import_mini28 = require("zod/mini");
|
|
7093
|
+
var OpenCodeSkillFrontmatterSchema = import_mini28.z.looseObject({
|
|
7094
|
+
name: import_mini28.z.string(),
|
|
7095
|
+
description: import_mini28.z.string(),
|
|
7096
|
+
"allowed-tools": import_mini28.z.optional(import_mini28.z.array(import_mini28.z.string()))
|
|
6893
7097
|
});
|
|
6894
7098
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
6895
7099
|
constructor({
|
|
6896
7100
|
baseDir = process.cwd(),
|
|
6897
|
-
relativeDirPath = (0,
|
|
7101
|
+
relativeDirPath = (0, import_node_path60.join)(".opencode", "skill"),
|
|
6898
7102
|
dirName,
|
|
6899
7103
|
frontmatter,
|
|
6900
7104
|
body,
|
|
@@ -6923,7 +7127,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6923
7127
|
}
|
|
6924
7128
|
static getSettablePaths({ global = false } = {}) {
|
|
6925
7129
|
return {
|
|
6926
|
-
relativeDirPath: global ? (0,
|
|
7130
|
+
relativeDirPath: global ? (0, import_node_path60.join)(".config", "opencode", "skill") : (0, import_node_path60.join)(".opencode", "skill")
|
|
6927
7131
|
};
|
|
6928
7132
|
}
|
|
6929
7133
|
getFrontmatter() {
|
|
@@ -7011,9 +7215,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
7011
7215
|
});
|
|
7012
7216
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7013
7217
|
if (!result.success) {
|
|
7014
|
-
const skillDirPath = (0,
|
|
7218
|
+
const skillDirPath = (0, import_node_path60.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7015
7219
|
throw new Error(
|
|
7016
|
-
`Invalid frontmatter in ${(0,
|
|
7220
|
+
`Invalid frontmatter in ${(0, import_node_path60.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7017
7221
|
);
|
|
7018
7222
|
}
|
|
7019
7223
|
return new _OpenCodeSkill({
|
|
@@ -7047,16 +7251,16 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
7047
7251
|
};
|
|
7048
7252
|
|
|
7049
7253
|
// src/features/skills/roo-skill.ts
|
|
7050
|
-
var
|
|
7051
|
-
var
|
|
7052
|
-
var RooSkillFrontmatterSchema =
|
|
7053
|
-
name:
|
|
7054
|
-
description:
|
|
7254
|
+
var import_node_path61 = require("path");
|
|
7255
|
+
var import_mini29 = require("zod/mini");
|
|
7256
|
+
var RooSkillFrontmatterSchema = import_mini29.z.looseObject({
|
|
7257
|
+
name: import_mini29.z.string(),
|
|
7258
|
+
description: import_mini29.z.string()
|
|
7055
7259
|
});
|
|
7056
7260
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
7057
7261
|
constructor({
|
|
7058
7262
|
baseDir = process.cwd(),
|
|
7059
|
-
relativeDirPath = (0,
|
|
7263
|
+
relativeDirPath = (0, import_node_path61.join)(".roo", "skills"),
|
|
7060
7264
|
dirName,
|
|
7061
7265
|
frontmatter,
|
|
7062
7266
|
body,
|
|
@@ -7087,7 +7291,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
7087
7291
|
global: _global = false
|
|
7088
7292
|
} = {}) {
|
|
7089
7293
|
return {
|
|
7090
|
-
relativeDirPath: (0,
|
|
7294
|
+
relativeDirPath: (0, import_node_path61.join)(".roo", "skills")
|
|
7091
7295
|
};
|
|
7092
7296
|
}
|
|
7093
7297
|
getFrontmatter() {
|
|
@@ -7177,13 +7381,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
7177
7381
|
});
|
|
7178
7382
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7179
7383
|
if (!result.success) {
|
|
7180
|
-
const skillDirPath = (0,
|
|
7384
|
+
const skillDirPath = (0, import_node_path61.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7181
7385
|
throw new Error(
|
|
7182
|
-
`Invalid frontmatter in ${(0,
|
|
7386
|
+
`Invalid frontmatter in ${(0, import_node_path61.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7183
7387
|
);
|
|
7184
7388
|
}
|
|
7185
7389
|
if (result.data.name !== loaded.dirName) {
|
|
7186
|
-
const skillFilePath = (0,
|
|
7390
|
+
const skillFilePath = (0, import_node_path61.join)(
|
|
7187
7391
|
loaded.baseDir,
|
|
7188
7392
|
loaded.relativeDirPath,
|
|
7189
7393
|
loaded.dirName,
|
|
@@ -7234,10 +7438,11 @@ var skillsProcessorToolTargetTuple = [
|
|
|
7234
7438
|
"cursor",
|
|
7235
7439
|
"geminicli",
|
|
7236
7440
|
"kilo",
|
|
7441
|
+
"kiro",
|
|
7237
7442
|
"opencode",
|
|
7238
7443
|
"roo"
|
|
7239
7444
|
];
|
|
7240
|
-
var SkillsProcessorToolTargetSchema =
|
|
7445
|
+
var SkillsProcessorToolTargetSchema = import_mini30.z.enum(skillsProcessorToolTargetTuple);
|
|
7241
7446
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
7242
7447
|
[
|
|
7243
7448
|
"agentsmd",
|
|
@@ -7302,6 +7507,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
7302
7507
|
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
7303
7508
|
}
|
|
7304
7509
|
],
|
|
7510
|
+
[
|
|
7511
|
+
"kiro",
|
|
7512
|
+
{
|
|
7513
|
+
class: KiroSkill,
|
|
7514
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: false }
|
|
7515
|
+
}
|
|
7516
|
+
],
|
|
7305
7517
|
[
|
|
7306
7518
|
"opencode",
|
|
7307
7519
|
{
|
|
@@ -7394,9 +7606,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7394
7606
|
*/
|
|
7395
7607
|
async loadRulesyncDirs() {
|
|
7396
7608
|
const paths = RulesyncSkill.getSettablePaths();
|
|
7397
|
-
const rulesyncSkillsDirPath = (0,
|
|
7398
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
7399
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
7609
|
+
const rulesyncSkillsDirPath = (0, import_node_path62.join)(this.baseDir, paths.relativeDirPath);
|
|
7610
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path62.join)(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
7611
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path62.basename)(path3));
|
|
7400
7612
|
const rulesyncSkills = await Promise.all(
|
|
7401
7613
|
dirNames.map(
|
|
7402
7614
|
(dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
|
|
@@ -7412,9 +7624,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7412
7624
|
async loadToolDirs() {
|
|
7413
7625
|
const factory = this.getFactory(this.toolTarget);
|
|
7414
7626
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7415
|
-
const skillsDirPath = (0,
|
|
7416
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
7417
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
7627
|
+
const skillsDirPath = (0, import_node_path62.join)(this.baseDir, paths.relativeDirPath);
|
|
7628
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path62.join)(skillsDirPath, "*"), { type: "dir" });
|
|
7629
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path62.basename)(path3));
|
|
7418
7630
|
const toolSkills = await Promise.all(
|
|
7419
7631
|
dirNames.map(
|
|
7420
7632
|
(dirName) => factory.class.fromDir({
|
|
@@ -7430,9 +7642,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7430
7642
|
async loadToolDirsToDelete() {
|
|
7431
7643
|
const factory = this.getFactory(this.toolTarget);
|
|
7432
7644
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7433
|
-
const skillsDirPath = (0,
|
|
7434
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
7435
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
7645
|
+
const skillsDirPath = (0, import_node_path62.join)(this.baseDir, paths.relativeDirPath);
|
|
7646
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path62.join)(skillsDirPath, "*"), { type: "dir" });
|
|
7647
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path62.basename)(path3));
|
|
7436
7648
|
const toolSkills = dirNames.map(
|
|
7437
7649
|
(dirName) => factory.class.forDeletion({
|
|
7438
7650
|
baseDir: this.baseDir,
|
|
@@ -7480,11 +7692,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7480
7692
|
};
|
|
7481
7693
|
|
|
7482
7694
|
// src/features/subagents/agentsmd-subagent.ts
|
|
7483
|
-
var
|
|
7695
|
+
var import_node_path64 = require("path");
|
|
7484
7696
|
|
|
7485
7697
|
// src/features/subagents/simulated-subagent.ts
|
|
7486
|
-
var
|
|
7487
|
-
var
|
|
7698
|
+
var import_node_path63 = require("path");
|
|
7699
|
+
var import_mini31 = require("zod/mini");
|
|
7488
7700
|
|
|
7489
7701
|
// src/features/subagents/tool-subagent.ts
|
|
7490
7702
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -7527,9 +7739,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
7527
7739
|
};
|
|
7528
7740
|
|
|
7529
7741
|
// src/features/subagents/simulated-subagent.ts
|
|
7530
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
7531
|
-
name:
|
|
7532
|
-
description:
|
|
7742
|
+
var SimulatedSubagentFrontmatterSchema = import_mini31.z.object({
|
|
7743
|
+
name: import_mini31.z.string(),
|
|
7744
|
+
description: import_mini31.z.string()
|
|
7533
7745
|
});
|
|
7534
7746
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
7535
7747
|
frontmatter;
|
|
@@ -7539,7 +7751,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7539
7751
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7540
7752
|
if (!result.success) {
|
|
7541
7753
|
throw new Error(
|
|
7542
|
-
`Invalid frontmatter in ${(0,
|
|
7754
|
+
`Invalid frontmatter in ${(0, import_node_path63.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7543
7755
|
);
|
|
7544
7756
|
}
|
|
7545
7757
|
}
|
|
@@ -7590,7 +7802,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7590
7802
|
return {
|
|
7591
7803
|
success: false,
|
|
7592
7804
|
error: new Error(
|
|
7593
|
-
`Invalid frontmatter in ${(0,
|
|
7805
|
+
`Invalid frontmatter in ${(0, import_node_path63.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7594
7806
|
)
|
|
7595
7807
|
};
|
|
7596
7808
|
}
|
|
@@ -7600,7 +7812,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7600
7812
|
relativeFilePath,
|
|
7601
7813
|
validate = true
|
|
7602
7814
|
}) {
|
|
7603
|
-
const filePath = (0,
|
|
7815
|
+
const filePath = (0, import_node_path63.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
7604
7816
|
const fileContent = await readFileContent(filePath);
|
|
7605
7817
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7606
7818
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7610,7 +7822,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7610
7822
|
return {
|
|
7611
7823
|
baseDir,
|
|
7612
7824
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
7613
|
-
relativeFilePath: (0,
|
|
7825
|
+
relativeFilePath: (0, import_node_path63.basename)(relativeFilePath),
|
|
7614
7826
|
frontmatter: result.data,
|
|
7615
7827
|
body: content.trim(),
|
|
7616
7828
|
validate
|
|
@@ -7636,7 +7848,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7636
7848
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
7637
7849
|
static getSettablePaths() {
|
|
7638
7850
|
return {
|
|
7639
|
-
relativeDirPath: (0,
|
|
7851
|
+
relativeDirPath: (0, import_node_path64.join)(".agents", "subagents")
|
|
7640
7852
|
};
|
|
7641
7853
|
}
|
|
7642
7854
|
static async fromFile(params) {
|
|
@@ -7659,11 +7871,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
7659
7871
|
};
|
|
7660
7872
|
|
|
7661
7873
|
// src/features/subagents/codexcli-subagent.ts
|
|
7662
|
-
var
|
|
7874
|
+
var import_node_path65 = require("path");
|
|
7663
7875
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
7664
7876
|
static getSettablePaths() {
|
|
7665
7877
|
return {
|
|
7666
|
-
relativeDirPath: (0,
|
|
7878
|
+
relativeDirPath: (0, import_node_path65.join)(".codex", "subagents")
|
|
7667
7879
|
};
|
|
7668
7880
|
}
|
|
7669
7881
|
static async fromFile(params) {
|
|
@@ -7686,11 +7898,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
7686
7898
|
};
|
|
7687
7899
|
|
|
7688
7900
|
// src/features/subagents/cursor-subagent.ts
|
|
7689
|
-
var
|
|
7901
|
+
var import_node_path66 = require("path");
|
|
7690
7902
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
7691
7903
|
static getSettablePaths() {
|
|
7692
7904
|
return {
|
|
7693
|
-
relativeDirPath: (0,
|
|
7905
|
+
relativeDirPath: (0, import_node_path66.join)(".cursor", "subagents")
|
|
7694
7906
|
};
|
|
7695
7907
|
}
|
|
7696
7908
|
static async fromFile(params) {
|
|
@@ -7713,11 +7925,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
7713
7925
|
};
|
|
7714
7926
|
|
|
7715
7927
|
// src/features/subagents/geminicli-subagent.ts
|
|
7716
|
-
var
|
|
7928
|
+
var import_node_path67 = require("path");
|
|
7717
7929
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
7718
7930
|
static getSettablePaths() {
|
|
7719
7931
|
return {
|
|
7720
|
-
relativeDirPath: (0,
|
|
7932
|
+
relativeDirPath: (0, import_node_path67.join)(".gemini", "subagents")
|
|
7721
7933
|
};
|
|
7722
7934
|
}
|
|
7723
7935
|
static async fromFile(params) {
|
|
@@ -7740,11 +7952,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
7740
7952
|
};
|
|
7741
7953
|
|
|
7742
7954
|
// src/features/subagents/roo-subagent.ts
|
|
7743
|
-
var
|
|
7955
|
+
var import_node_path68 = require("path");
|
|
7744
7956
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
7745
7957
|
static getSettablePaths() {
|
|
7746
7958
|
return {
|
|
7747
|
-
relativeDirPath: (0,
|
|
7959
|
+
relativeDirPath: (0, import_node_path68.join)(".roo", "subagents")
|
|
7748
7960
|
};
|
|
7749
7961
|
}
|
|
7750
7962
|
static async fromFile(params) {
|
|
@@ -7767,20 +7979,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
7767
7979
|
};
|
|
7768
7980
|
|
|
7769
7981
|
// src/features/subagents/subagents-processor.ts
|
|
7770
|
-
var
|
|
7771
|
-
var
|
|
7982
|
+
var import_node_path74 = require("path");
|
|
7983
|
+
var import_mini37 = require("zod/mini");
|
|
7772
7984
|
|
|
7773
7985
|
// src/features/subagents/claudecode-subagent.ts
|
|
7774
|
-
var
|
|
7775
|
-
var
|
|
7986
|
+
var import_node_path70 = require("path");
|
|
7987
|
+
var import_mini33 = require("zod/mini");
|
|
7776
7988
|
|
|
7777
7989
|
// src/features/subagents/rulesync-subagent.ts
|
|
7778
|
-
var
|
|
7779
|
-
var
|
|
7780
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
7990
|
+
var import_node_path69 = require("path");
|
|
7991
|
+
var import_mini32 = require("zod/mini");
|
|
7992
|
+
var RulesyncSubagentFrontmatterSchema = import_mini32.z.looseObject({
|
|
7781
7993
|
targets: RulesyncTargetsSchema,
|
|
7782
|
-
name:
|
|
7783
|
-
description:
|
|
7994
|
+
name: import_mini32.z.string(),
|
|
7995
|
+
description: import_mini32.z.string()
|
|
7784
7996
|
});
|
|
7785
7997
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
7786
7998
|
frontmatter;
|
|
@@ -7790,7 +8002,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7790
8002
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7791
8003
|
if (!result.success) {
|
|
7792
8004
|
throw new Error(
|
|
7793
|
-
`Invalid frontmatter in ${(0,
|
|
8005
|
+
`Invalid frontmatter in ${(0, import_node_path69.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7794
8006
|
);
|
|
7795
8007
|
}
|
|
7796
8008
|
}
|
|
@@ -7823,7 +8035,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7823
8035
|
return {
|
|
7824
8036
|
success: false,
|
|
7825
8037
|
error: new Error(
|
|
7826
|
-
`Invalid frontmatter in ${(0,
|
|
8038
|
+
`Invalid frontmatter in ${(0, import_node_path69.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7827
8039
|
)
|
|
7828
8040
|
};
|
|
7829
8041
|
}
|
|
@@ -7832,14 +8044,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7832
8044
|
relativeFilePath
|
|
7833
8045
|
}) {
|
|
7834
8046
|
const fileContent = await readFileContent(
|
|
7835
|
-
(0,
|
|
8047
|
+
(0, import_node_path69.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
7836
8048
|
);
|
|
7837
8049
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7838
8050
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7839
8051
|
if (!result.success) {
|
|
7840
8052
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
7841
8053
|
}
|
|
7842
|
-
const filename = (0,
|
|
8054
|
+
const filename = (0, import_node_path69.basename)(relativeFilePath);
|
|
7843
8055
|
return new _RulesyncSubagent({
|
|
7844
8056
|
baseDir: process.cwd(),
|
|
7845
8057
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -7851,13 +8063,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7851
8063
|
};
|
|
7852
8064
|
|
|
7853
8065
|
// src/features/subagents/claudecode-subagent.ts
|
|
7854
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
7855
|
-
name:
|
|
7856
|
-
description:
|
|
7857
|
-
model:
|
|
7858
|
-
tools:
|
|
7859
|
-
permissionMode:
|
|
7860
|
-
skills:
|
|
8066
|
+
var ClaudecodeSubagentFrontmatterSchema = import_mini33.z.looseObject({
|
|
8067
|
+
name: import_mini33.z.string(),
|
|
8068
|
+
description: import_mini33.z.string(),
|
|
8069
|
+
model: import_mini33.z.optional(import_mini33.z.string()),
|
|
8070
|
+
tools: import_mini33.z.optional(import_mini33.z.union([import_mini33.z.string(), import_mini33.z.array(import_mini33.z.string())])),
|
|
8071
|
+
permissionMode: import_mini33.z.optional(import_mini33.z.string()),
|
|
8072
|
+
skills: import_mini33.z.optional(import_mini33.z.union([import_mini33.z.string(), import_mini33.z.array(import_mini33.z.string())]))
|
|
7861
8073
|
});
|
|
7862
8074
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
7863
8075
|
frontmatter;
|
|
@@ -7867,7 +8079,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7867
8079
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7868
8080
|
if (!result.success) {
|
|
7869
8081
|
throw new Error(
|
|
7870
|
-
`Invalid frontmatter in ${(0,
|
|
8082
|
+
`Invalid frontmatter in ${(0, import_node_path70.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7871
8083
|
);
|
|
7872
8084
|
}
|
|
7873
8085
|
}
|
|
@@ -7879,7 +8091,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7879
8091
|
}
|
|
7880
8092
|
static getSettablePaths(_options = {}) {
|
|
7881
8093
|
return {
|
|
7882
|
-
relativeDirPath: (0,
|
|
8094
|
+
relativeDirPath: (0, import_node_path70.join)(".claude", "agents")
|
|
7883
8095
|
};
|
|
7884
8096
|
}
|
|
7885
8097
|
getFrontmatter() {
|
|
@@ -7953,7 +8165,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7953
8165
|
return {
|
|
7954
8166
|
success: false,
|
|
7955
8167
|
error: new Error(
|
|
7956
|
-
`Invalid frontmatter in ${(0,
|
|
8168
|
+
`Invalid frontmatter in ${(0, import_node_path70.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7957
8169
|
)
|
|
7958
8170
|
};
|
|
7959
8171
|
}
|
|
@@ -7971,7 +8183,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7971
8183
|
global = false
|
|
7972
8184
|
}) {
|
|
7973
8185
|
const paths = this.getSettablePaths({ global });
|
|
7974
|
-
const filePath = (0,
|
|
8186
|
+
const filePath = (0, import_node_path70.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7975
8187
|
const fileContent = await readFileContent(filePath);
|
|
7976
8188
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7977
8189
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8006,13 +8218,13 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8006
8218
|
};
|
|
8007
8219
|
|
|
8008
8220
|
// src/features/subagents/copilot-subagent.ts
|
|
8009
|
-
var
|
|
8010
|
-
var
|
|
8221
|
+
var import_node_path71 = require("path");
|
|
8222
|
+
var import_mini34 = require("zod/mini");
|
|
8011
8223
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
8012
|
-
var CopilotSubagentFrontmatterSchema =
|
|
8013
|
-
name:
|
|
8014
|
-
description:
|
|
8015
|
-
tools:
|
|
8224
|
+
var CopilotSubagentFrontmatterSchema = import_mini34.z.looseObject({
|
|
8225
|
+
name: import_mini34.z.string(),
|
|
8226
|
+
description: import_mini34.z.string(),
|
|
8227
|
+
tools: import_mini34.z.optional(import_mini34.z.union([import_mini34.z.string(), import_mini34.z.array(import_mini34.z.string())]))
|
|
8016
8228
|
});
|
|
8017
8229
|
var normalizeTools = (tools) => {
|
|
8018
8230
|
if (!tools) {
|
|
@@ -8032,7 +8244,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8032
8244
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8033
8245
|
if (!result.success) {
|
|
8034
8246
|
throw new Error(
|
|
8035
|
-
`Invalid frontmatter in ${(0,
|
|
8247
|
+
`Invalid frontmatter in ${(0, import_node_path71.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8036
8248
|
);
|
|
8037
8249
|
}
|
|
8038
8250
|
}
|
|
@@ -8044,7 +8256,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8044
8256
|
}
|
|
8045
8257
|
static getSettablePaths(_options = {}) {
|
|
8046
8258
|
return {
|
|
8047
|
-
relativeDirPath: (0,
|
|
8259
|
+
relativeDirPath: (0, import_node_path71.join)(".github", "agents")
|
|
8048
8260
|
};
|
|
8049
8261
|
}
|
|
8050
8262
|
getFrontmatter() {
|
|
@@ -8118,7 +8330,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8118
8330
|
return {
|
|
8119
8331
|
success: false,
|
|
8120
8332
|
error: new Error(
|
|
8121
|
-
`Invalid frontmatter in ${(0,
|
|
8333
|
+
`Invalid frontmatter in ${(0, import_node_path71.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8122
8334
|
)
|
|
8123
8335
|
};
|
|
8124
8336
|
}
|
|
@@ -8136,7 +8348,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8136
8348
|
global = false
|
|
8137
8349
|
}) {
|
|
8138
8350
|
const paths = this.getSettablePaths({ global });
|
|
8139
|
-
const filePath = (0,
|
|
8351
|
+
const filePath = (0, import_node_path71.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8140
8352
|
const fileContent = await readFileContent(filePath);
|
|
8141
8353
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8142
8354
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8171,13 +8383,150 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8171
8383
|
}
|
|
8172
8384
|
};
|
|
8173
8385
|
|
|
8386
|
+
// src/features/subagents/kiro-subagent.ts
|
|
8387
|
+
var import_node_path72 = require("path");
|
|
8388
|
+
var import_mini35 = require("zod/mini");
|
|
8389
|
+
var KiroCliSubagentJsonSchema = import_mini35.z.looseObject({
|
|
8390
|
+
name: import_mini35.z.string(),
|
|
8391
|
+
description: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.string())),
|
|
8392
|
+
prompt: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.string())),
|
|
8393
|
+
tools: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.array(import_mini35.z.string()))),
|
|
8394
|
+
toolAliases: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.record(import_mini35.z.string(), import_mini35.z.string()))),
|
|
8395
|
+
toolSettings: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.unknown())),
|
|
8396
|
+
toolSchema: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.unknown())),
|
|
8397
|
+
hooks: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.record(import_mini35.z.string(), import_mini35.z.array(import_mini35.z.unknown())))),
|
|
8398
|
+
model: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.string())),
|
|
8399
|
+
mcpServers: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.record(import_mini35.z.string(), import_mini35.z.unknown()))),
|
|
8400
|
+
useLegacyMcpJson: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.boolean())),
|
|
8401
|
+
resources: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.array(import_mini35.z.string()))),
|
|
8402
|
+
allowedTools: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.array(import_mini35.z.string()))),
|
|
8403
|
+
includeMcpJson: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.boolean()))
|
|
8404
|
+
});
|
|
8405
|
+
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
8406
|
+
body;
|
|
8407
|
+
constructor({ body, ...rest }) {
|
|
8408
|
+
super({
|
|
8409
|
+
...rest
|
|
8410
|
+
});
|
|
8411
|
+
this.body = body;
|
|
8412
|
+
}
|
|
8413
|
+
static getSettablePaths(_options = {}) {
|
|
8414
|
+
return {
|
|
8415
|
+
relativeDirPath: (0, import_node_path72.join)(".kiro", "agents")
|
|
8416
|
+
};
|
|
8417
|
+
}
|
|
8418
|
+
getBody() {
|
|
8419
|
+
return this.body;
|
|
8420
|
+
}
|
|
8421
|
+
toRulesyncSubagent() {
|
|
8422
|
+
const parsed = JSON.parse(this.body);
|
|
8423
|
+
const { name, description, prompt, ...restFields } = parsed;
|
|
8424
|
+
const kiroSection = {
|
|
8425
|
+
...restFields
|
|
8426
|
+
};
|
|
8427
|
+
const rulesyncFrontmatter = {
|
|
8428
|
+
targets: ["kiro"],
|
|
8429
|
+
name,
|
|
8430
|
+
description: description ?? "",
|
|
8431
|
+
// Only include kiro section if there are fields
|
|
8432
|
+
...Object.keys(kiroSection).length > 0 && { kiro: kiroSection }
|
|
8433
|
+
};
|
|
8434
|
+
return new RulesyncSubagent({
|
|
8435
|
+
baseDir: ".",
|
|
8436
|
+
frontmatter: rulesyncFrontmatter,
|
|
8437
|
+
body: prompt ?? "",
|
|
8438
|
+
relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
|
|
8439
|
+
relativeFilePath: this.getRelativeFilePath().replace(/\.json$/, ".md"),
|
|
8440
|
+
validate: true
|
|
8441
|
+
});
|
|
8442
|
+
}
|
|
8443
|
+
static fromRulesyncSubagent({
|
|
8444
|
+
baseDir = process.cwd(),
|
|
8445
|
+
rulesyncSubagent,
|
|
8446
|
+
validate = true,
|
|
8447
|
+
global = false
|
|
8448
|
+
}) {
|
|
8449
|
+
const frontmatter = rulesyncSubagent.getFrontmatter();
|
|
8450
|
+
const kiroSection = frontmatter.kiro ?? {};
|
|
8451
|
+
const json = {
|
|
8452
|
+
name: frontmatter.name,
|
|
8453
|
+
description: frontmatter.description || null,
|
|
8454
|
+
prompt: rulesyncSubagent.getBody() || null,
|
|
8455
|
+
...kiroSection
|
|
8456
|
+
};
|
|
8457
|
+
const body = JSON.stringify(json, null, 2);
|
|
8458
|
+
const paths = this.getSettablePaths({ global });
|
|
8459
|
+
const relativeFilePath = rulesyncSubagent.getRelativeFilePath().replace(/\.md$/, ".json");
|
|
8460
|
+
return new _KiroSubagent({
|
|
8461
|
+
baseDir,
|
|
8462
|
+
body,
|
|
8463
|
+
relativeDirPath: paths.relativeDirPath,
|
|
8464
|
+
relativeFilePath,
|
|
8465
|
+
fileContent: body,
|
|
8466
|
+
validate,
|
|
8467
|
+
global
|
|
8468
|
+
});
|
|
8469
|
+
}
|
|
8470
|
+
validate() {
|
|
8471
|
+
try {
|
|
8472
|
+
const parsed = JSON.parse(this.body);
|
|
8473
|
+
KiroCliSubagentJsonSchema.parse(parsed);
|
|
8474
|
+
return { success: true, error: null };
|
|
8475
|
+
} catch (error) {
|
|
8476
|
+
return {
|
|
8477
|
+
success: false,
|
|
8478
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
8479
|
+
};
|
|
8480
|
+
}
|
|
8481
|
+
}
|
|
8482
|
+
static isTargetedByRulesyncSubagent(rulesyncSubagent) {
|
|
8483
|
+
return this.isTargetedByRulesyncSubagentDefault({
|
|
8484
|
+
rulesyncSubagent,
|
|
8485
|
+
toolTarget: "kiro"
|
|
8486
|
+
});
|
|
8487
|
+
}
|
|
8488
|
+
static async fromFile({
|
|
8489
|
+
baseDir = process.cwd(),
|
|
8490
|
+
relativeFilePath,
|
|
8491
|
+
validate = true,
|
|
8492
|
+
global = false
|
|
8493
|
+
}) {
|
|
8494
|
+
const paths = this.getSettablePaths({ global });
|
|
8495
|
+
const filePath = (0, import_node_path72.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8496
|
+
const fileContent = await readFileContent(filePath);
|
|
8497
|
+
return new _KiroSubagent({
|
|
8498
|
+
baseDir,
|
|
8499
|
+
relativeDirPath: paths.relativeDirPath,
|
|
8500
|
+
relativeFilePath,
|
|
8501
|
+
body: fileContent.trim(),
|
|
8502
|
+
fileContent,
|
|
8503
|
+
validate,
|
|
8504
|
+
global
|
|
8505
|
+
});
|
|
8506
|
+
}
|
|
8507
|
+
static forDeletion({
|
|
8508
|
+
baseDir = process.cwd(),
|
|
8509
|
+
relativeDirPath,
|
|
8510
|
+
relativeFilePath
|
|
8511
|
+
}) {
|
|
8512
|
+
return new _KiroSubagent({
|
|
8513
|
+
baseDir,
|
|
8514
|
+
relativeDirPath,
|
|
8515
|
+
relativeFilePath,
|
|
8516
|
+
body: "",
|
|
8517
|
+
fileContent: "",
|
|
8518
|
+
validate: false
|
|
8519
|
+
});
|
|
8520
|
+
}
|
|
8521
|
+
};
|
|
8522
|
+
|
|
8174
8523
|
// src/features/subagents/opencode-subagent.ts
|
|
8175
|
-
var
|
|
8176
|
-
var
|
|
8177
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
8178
|
-
description:
|
|
8179
|
-
mode:
|
|
8180
|
-
name:
|
|
8524
|
+
var import_node_path73 = require("path");
|
|
8525
|
+
var import_mini36 = require("zod/mini");
|
|
8526
|
+
var OpenCodeSubagentFrontmatterSchema = import_mini36.z.looseObject({
|
|
8527
|
+
description: import_mini36.z.string(),
|
|
8528
|
+
mode: import_mini36.z.literal("subagent"),
|
|
8529
|
+
name: import_mini36.z.optional(import_mini36.z.string())
|
|
8181
8530
|
});
|
|
8182
8531
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
8183
8532
|
frontmatter;
|
|
@@ -8187,7 +8536,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8187
8536
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8188
8537
|
if (!result.success) {
|
|
8189
8538
|
throw new Error(
|
|
8190
|
-
`Invalid frontmatter in ${(0,
|
|
8539
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8191
8540
|
);
|
|
8192
8541
|
}
|
|
8193
8542
|
}
|
|
@@ -8201,7 +8550,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8201
8550
|
global = false
|
|
8202
8551
|
} = {}) {
|
|
8203
8552
|
return {
|
|
8204
|
-
relativeDirPath: global ? (0,
|
|
8553
|
+
relativeDirPath: global ? (0, import_node_path73.join)(".config", "opencode", "agent") : (0, import_node_path73.join)(".opencode", "agent")
|
|
8205
8554
|
};
|
|
8206
8555
|
}
|
|
8207
8556
|
getFrontmatter() {
|
|
@@ -8214,7 +8563,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8214
8563
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
8215
8564
|
const rulesyncFrontmatter = {
|
|
8216
8565
|
targets: ["*"],
|
|
8217
|
-
name: name ?? (0,
|
|
8566
|
+
name: name ?? (0, import_node_path73.basename)(this.getRelativeFilePath(), ".md"),
|
|
8218
8567
|
description,
|
|
8219
8568
|
opencode: { mode, ...opencodeSection }
|
|
8220
8569
|
};
|
|
@@ -8267,7 +8616,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8267
8616
|
return {
|
|
8268
8617
|
success: false,
|
|
8269
8618
|
error: new Error(
|
|
8270
|
-
`Invalid frontmatter in ${(0,
|
|
8619
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8271
8620
|
)
|
|
8272
8621
|
};
|
|
8273
8622
|
}
|
|
@@ -8284,7 +8633,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8284
8633
|
global = false
|
|
8285
8634
|
}) {
|
|
8286
8635
|
const paths = this.getSettablePaths({ global });
|
|
8287
|
-
const filePath = (0,
|
|
8636
|
+
const filePath = (0, import_node_path73.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8288
8637
|
const fileContent = await readFileContent(filePath);
|
|
8289
8638
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8290
8639
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8328,41 +8677,82 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
8328
8677
|
"copilot",
|
|
8329
8678
|
"cursor",
|
|
8330
8679
|
"geminicli",
|
|
8680
|
+
"kiro",
|
|
8331
8681
|
"opencode",
|
|
8332
8682
|
"roo"
|
|
8333
8683
|
];
|
|
8334
|
-
var SubagentsProcessorToolTargetSchema =
|
|
8684
|
+
var SubagentsProcessorToolTargetSchema = import_mini37.z.enum(subagentsProcessorToolTargetTuple);
|
|
8335
8685
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
8336
8686
|
[
|
|
8337
8687
|
"agentsmd",
|
|
8338
|
-
{
|
|
8688
|
+
{
|
|
8689
|
+
class: AgentsmdSubagent,
|
|
8690
|
+
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
8691
|
+
}
|
|
8339
8692
|
],
|
|
8340
8693
|
[
|
|
8341
8694
|
"claudecode",
|
|
8342
|
-
{
|
|
8695
|
+
{
|
|
8696
|
+
class: ClaudecodeSubagent,
|
|
8697
|
+
meta: { supportsSimulated: false, supportsGlobal: true, filePattern: "*.md" }
|
|
8698
|
+
}
|
|
8343
8699
|
],
|
|
8344
8700
|
[
|
|
8345
8701
|
"claudecode-legacy",
|
|
8346
|
-
{
|
|
8702
|
+
{
|
|
8703
|
+
class: ClaudecodeSubagent,
|
|
8704
|
+
meta: { supportsSimulated: false, supportsGlobal: true, filePattern: "*.md" }
|
|
8705
|
+
}
|
|
8347
8706
|
],
|
|
8348
8707
|
[
|
|
8349
8708
|
"codexcli",
|
|
8350
|
-
{
|
|
8709
|
+
{
|
|
8710
|
+
class: CodexCliSubagent,
|
|
8711
|
+
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
8712
|
+
}
|
|
8351
8713
|
],
|
|
8352
8714
|
[
|
|
8353
8715
|
"copilot",
|
|
8354
|
-
{
|
|
8716
|
+
{
|
|
8717
|
+
class: CopilotSubagent,
|
|
8718
|
+
meta: { supportsSimulated: false, supportsGlobal: false, filePattern: "*.md" }
|
|
8719
|
+
}
|
|
8720
|
+
],
|
|
8721
|
+
[
|
|
8722
|
+
"cursor",
|
|
8723
|
+
{
|
|
8724
|
+
class: CursorSubagent,
|
|
8725
|
+
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
8726
|
+
}
|
|
8355
8727
|
],
|
|
8356
|
-
["cursor", { class: CursorSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }],
|
|
8357
8728
|
[
|
|
8358
8729
|
"geminicli",
|
|
8359
|
-
{
|
|
8730
|
+
{
|
|
8731
|
+
class: GeminiCliSubagent,
|
|
8732
|
+
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
8733
|
+
}
|
|
8734
|
+
],
|
|
8735
|
+
[
|
|
8736
|
+
"kiro",
|
|
8737
|
+
{
|
|
8738
|
+
class: KiroSubagent,
|
|
8739
|
+
meta: { supportsSimulated: false, supportsGlobal: false, filePattern: "*.json" }
|
|
8740
|
+
}
|
|
8360
8741
|
],
|
|
8361
8742
|
[
|
|
8362
8743
|
"opencode",
|
|
8363
|
-
{
|
|
8744
|
+
{
|
|
8745
|
+
class: OpenCodeSubagent,
|
|
8746
|
+
meta: { supportsSimulated: false, supportsGlobal: true, filePattern: "*.md" }
|
|
8747
|
+
}
|
|
8364
8748
|
],
|
|
8365
|
-
[
|
|
8749
|
+
[
|
|
8750
|
+
"roo",
|
|
8751
|
+
{
|
|
8752
|
+
class: RooSubagent,
|
|
8753
|
+
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
8754
|
+
}
|
|
8755
|
+
]
|
|
8366
8756
|
]);
|
|
8367
8757
|
var defaultGetFactory5 = (target) => {
|
|
8368
8758
|
const factory = toolSubagentFactories.get(target);
|
|
@@ -8445,7 +8835,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8445
8835
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
8446
8836
|
*/
|
|
8447
8837
|
async loadRulesyncFiles() {
|
|
8448
|
-
const subagentsDir = (0,
|
|
8838
|
+
const subagentsDir = (0, import_node_path74.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
8449
8839
|
const dirExists = await directoryExists(subagentsDir);
|
|
8450
8840
|
if (!dirExists) {
|
|
8451
8841
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -8460,7 +8850,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8460
8850
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
8461
8851
|
const rulesyncSubagents = [];
|
|
8462
8852
|
for (const mdFile of mdFiles) {
|
|
8463
|
-
const filepath = (0,
|
|
8853
|
+
const filepath = (0, import_node_path74.join)(subagentsDir, mdFile);
|
|
8464
8854
|
try {
|
|
8465
8855
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
8466
8856
|
relativeFilePath: mdFile,
|
|
@@ -8490,14 +8880,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8490
8880
|
const factory = this.getFactory(this.toolTarget);
|
|
8491
8881
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
8492
8882
|
const subagentFilePaths = await findFilesByGlobs(
|
|
8493
|
-
(0,
|
|
8883
|
+
(0, import_node_path74.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
8494
8884
|
);
|
|
8495
8885
|
if (forDeletion) {
|
|
8496
8886
|
const toolSubagents2 = subagentFilePaths.map(
|
|
8497
8887
|
(path3) => factory.class.forDeletion({
|
|
8498
8888
|
baseDir: this.baseDir,
|
|
8499
8889
|
relativeDirPath: paths.relativeDirPath,
|
|
8500
|
-
relativeFilePath: (0,
|
|
8890
|
+
relativeFilePath: (0, import_node_path74.basename)(path3),
|
|
8501
8891
|
global: this.global
|
|
8502
8892
|
})
|
|
8503
8893
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -8508,7 +8898,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8508
8898
|
subagentFilePaths.map(
|
|
8509
8899
|
(path3) => factory.class.fromFile({
|
|
8510
8900
|
baseDir: this.baseDir,
|
|
8511
|
-
relativeFilePath: (0,
|
|
8901
|
+
relativeFilePath: (0, import_node_path74.basename)(path3),
|
|
8512
8902
|
global: this.global
|
|
8513
8903
|
})
|
|
8514
8904
|
)
|
|
@@ -8540,48 +8930,48 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8540
8930
|
};
|
|
8541
8931
|
|
|
8542
8932
|
// src/features/rules/agentsmd-rule.ts
|
|
8543
|
-
var
|
|
8933
|
+
var import_node_path77 = require("path");
|
|
8544
8934
|
|
|
8545
8935
|
// src/features/rules/tool-rule.ts
|
|
8546
|
-
var
|
|
8936
|
+
var import_node_path76 = require("path");
|
|
8547
8937
|
|
|
8548
8938
|
// src/features/rules/rulesync-rule.ts
|
|
8549
|
-
var
|
|
8550
|
-
var
|
|
8551
|
-
var RulesyncRuleFrontmatterSchema =
|
|
8552
|
-
root:
|
|
8553
|
-
targets:
|
|
8554
|
-
description:
|
|
8555
|
-
globs:
|
|
8556
|
-
agentsmd:
|
|
8557
|
-
|
|
8939
|
+
var import_node_path75 = require("path");
|
|
8940
|
+
var import_mini38 = require("zod/mini");
|
|
8941
|
+
var RulesyncRuleFrontmatterSchema = import_mini38.z.object({
|
|
8942
|
+
root: import_mini38.z.optional(import_mini38.z.optional(import_mini38.z.boolean())),
|
|
8943
|
+
targets: import_mini38.z.optional(RulesyncTargetsSchema),
|
|
8944
|
+
description: import_mini38.z.optional(import_mini38.z.string()),
|
|
8945
|
+
globs: import_mini38.z.optional(import_mini38.z.array(import_mini38.z.string())),
|
|
8946
|
+
agentsmd: import_mini38.z.optional(
|
|
8947
|
+
import_mini38.z.object({
|
|
8558
8948
|
// @example "path/to/subproject"
|
|
8559
|
-
subprojectPath:
|
|
8949
|
+
subprojectPath: import_mini38.z.optional(import_mini38.z.string())
|
|
8560
8950
|
})
|
|
8561
8951
|
),
|
|
8562
|
-
claudecode:
|
|
8563
|
-
|
|
8952
|
+
claudecode: import_mini38.z.optional(
|
|
8953
|
+
import_mini38.z.object({
|
|
8564
8954
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
8565
8955
|
// @example "src/**/*.ts, tests/**/*.test.ts"
|
|
8566
|
-
paths:
|
|
8956
|
+
paths: import_mini38.z.optional(import_mini38.z.string())
|
|
8567
8957
|
})
|
|
8568
8958
|
),
|
|
8569
|
-
cursor:
|
|
8570
|
-
|
|
8571
|
-
alwaysApply:
|
|
8572
|
-
description:
|
|
8573
|
-
globs:
|
|
8959
|
+
cursor: import_mini38.z.optional(
|
|
8960
|
+
import_mini38.z.object({
|
|
8961
|
+
alwaysApply: import_mini38.z.optional(import_mini38.z.boolean()),
|
|
8962
|
+
description: import_mini38.z.optional(import_mini38.z.string()),
|
|
8963
|
+
globs: import_mini38.z.optional(import_mini38.z.array(import_mini38.z.string()))
|
|
8574
8964
|
})
|
|
8575
8965
|
),
|
|
8576
|
-
copilot:
|
|
8577
|
-
|
|
8578
|
-
excludeAgent:
|
|
8966
|
+
copilot: import_mini38.z.optional(
|
|
8967
|
+
import_mini38.z.object({
|
|
8968
|
+
excludeAgent: import_mini38.z.optional(import_mini38.z.union([import_mini38.z.literal("code-review"), import_mini38.z.literal("coding-agent")]))
|
|
8579
8969
|
})
|
|
8580
8970
|
),
|
|
8581
|
-
antigravity:
|
|
8582
|
-
|
|
8583
|
-
trigger:
|
|
8584
|
-
globs:
|
|
8971
|
+
antigravity: import_mini38.z.optional(
|
|
8972
|
+
import_mini38.z.looseObject({
|
|
8973
|
+
trigger: import_mini38.z.optional(import_mini38.z.string()),
|
|
8974
|
+
globs: import_mini38.z.optional(import_mini38.z.array(import_mini38.z.string()))
|
|
8585
8975
|
})
|
|
8586
8976
|
)
|
|
8587
8977
|
});
|
|
@@ -8593,7 +8983,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8593
8983
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8594
8984
|
if (!result.success) {
|
|
8595
8985
|
throw new Error(
|
|
8596
|
-
`Invalid frontmatter in ${(0,
|
|
8986
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8597
8987
|
);
|
|
8598
8988
|
}
|
|
8599
8989
|
}
|
|
@@ -8628,7 +9018,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8628
9018
|
return {
|
|
8629
9019
|
success: false,
|
|
8630
9020
|
error: new Error(
|
|
8631
|
-
`Invalid frontmatter in ${(0,
|
|
9021
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8632
9022
|
)
|
|
8633
9023
|
};
|
|
8634
9024
|
}
|
|
@@ -8637,12 +9027,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8637
9027
|
relativeFilePath,
|
|
8638
9028
|
validate = true
|
|
8639
9029
|
}) {
|
|
8640
|
-
const legacyPath = (0,
|
|
9030
|
+
const legacyPath = (0, import_node_path75.join)(
|
|
8641
9031
|
process.cwd(),
|
|
8642
9032
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
8643
9033
|
relativeFilePath
|
|
8644
9034
|
);
|
|
8645
|
-
const recommendedPath = (0,
|
|
9035
|
+
const recommendedPath = (0, import_node_path75.join)(
|
|
8646
9036
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8647
9037
|
relativeFilePath
|
|
8648
9038
|
);
|
|
@@ -8663,7 +9053,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8663
9053
|
agentsmd: result.data.agentsmd,
|
|
8664
9054
|
cursor: result.data.cursor
|
|
8665
9055
|
};
|
|
8666
|
-
const filename = (0,
|
|
9056
|
+
const filename = (0, import_node_path75.basename)(legacyPath);
|
|
8667
9057
|
return new _RulesyncRule({
|
|
8668
9058
|
baseDir: process.cwd(),
|
|
8669
9059
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8677,7 +9067,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8677
9067
|
relativeFilePath,
|
|
8678
9068
|
validate = true
|
|
8679
9069
|
}) {
|
|
8680
|
-
const filePath = (0,
|
|
9070
|
+
const filePath = (0, import_node_path75.join)(
|
|
8681
9071
|
process.cwd(),
|
|
8682
9072
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8683
9073
|
relativeFilePath
|
|
@@ -8696,7 +9086,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8696
9086
|
agentsmd: result.data.agentsmd,
|
|
8697
9087
|
cursor: result.data.cursor
|
|
8698
9088
|
};
|
|
8699
|
-
const filename = (0,
|
|
9089
|
+
const filename = (0, import_node_path75.basename)(filePath);
|
|
8700
9090
|
return new _RulesyncRule({
|
|
8701
9091
|
baseDir: process.cwd(),
|
|
8702
9092
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8779,7 +9169,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8779
9169
|
rulesyncRule,
|
|
8780
9170
|
validate = true,
|
|
8781
9171
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
8782
|
-
nonRootPath = { relativeDirPath: (0,
|
|
9172
|
+
nonRootPath = { relativeDirPath: (0, import_node_path76.join)(".agents", "memories") }
|
|
8783
9173
|
}) {
|
|
8784
9174
|
const params = this.buildToolRuleParamsDefault({
|
|
8785
9175
|
baseDir,
|
|
@@ -8790,7 +9180,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8790
9180
|
});
|
|
8791
9181
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
8792
9182
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
8793
|
-
params.relativeDirPath = (0,
|
|
9183
|
+
params.relativeDirPath = (0, import_node_path76.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
8794
9184
|
params.relativeFilePath = "AGENTS.md";
|
|
8795
9185
|
}
|
|
8796
9186
|
return params;
|
|
@@ -8855,7 +9245,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8855
9245
|
relativeFilePath: "AGENTS.md"
|
|
8856
9246
|
},
|
|
8857
9247
|
nonRoot: {
|
|
8858
|
-
relativeDirPath: (0,
|
|
9248
|
+
relativeDirPath: (0, import_node_path77.join)(".agents", "memories")
|
|
8859
9249
|
}
|
|
8860
9250
|
};
|
|
8861
9251
|
}
|
|
@@ -8865,8 +9255,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8865
9255
|
validate = true
|
|
8866
9256
|
}) {
|
|
8867
9257
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
8868
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
8869
|
-
const fileContent = await readFileContent((0,
|
|
9258
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path77.join)(".agents", "memories", relativeFilePath);
|
|
9259
|
+
const fileContent = await readFileContent((0, import_node_path77.join)(baseDir, relativePath));
|
|
8870
9260
|
return new _AgentsMdRule({
|
|
8871
9261
|
baseDir,
|
|
8872
9262
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -8921,21 +9311,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8921
9311
|
};
|
|
8922
9312
|
|
|
8923
9313
|
// src/features/rules/antigravity-rule.ts
|
|
8924
|
-
var
|
|
8925
|
-
var
|
|
8926
|
-
var AntigravityRuleFrontmatterSchema =
|
|
8927
|
-
trigger:
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
9314
|
+
var import_node_path78 = require("path");
|
|
9315
|
+
var import_mini39 = require("zod/mini");
|
|
9316
|
+
var AntigravityRuleFrontmatterSchema = import_mini39.z.looseObject({
|
|
9317
|
+
trigger: import_mini39.z.optional(
|
|
9318
|
+
import_mini39.z.union([
|
|
9319
|
+
import_mini39.z.literal("always_on"),
|
|
9320
|
+
import_mini39.z.literal("glob"),
|
|
9321
|
+
import_mini39.z.literal("manual"),
|
|
9322
|
+
import_mini39.z.literal("model_decision"),
|
|
9323
|
+
import_mini39.z.string()
|
|
8934
9324
|
// accepts any string for forward compatibility
|
|
8935
9325
|
])
|
|
8936
9326
|
),
|
|
8937
|
-
globs:
|
|
8938
|
-
description:
|
|
9327
|
+
globs: import_mini39.z.optional(import_mini39.z.string()),
|
|
9328
|
+
description: import_mini39.z.optional(import_mini39.z.string())
|
|
8939
9329
|
});
|
|
8940
9330
|
function parseGlobsString(globs) {
|
|
8941
9331
|
if (!globs) {
|
|
@@ -9080,7 +9470,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9080
9470
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9081
9471
|
if (!result.success) {
|
|
9082
9472
|
throw new Error(
|
|
9083
|
-
`Invalid frontmatter in ${(0,
|
|
9473
|
+
`Invalid frontmatter in ${(0, import_node_path78.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9084
9474
|
);
|
|
9085
9475
|
}
|
|
9086
9476
|
}
|
|
@@ -9095,7 +9485,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9095
9485
|
static getSettablePaths() {
|
|
9096
9486
|
return {
|
|
9097
9487
|
nonRoot: {
|
|
9098
|
-
relativeDirPath: (0,
|
|
9488
|
+
relativeDirPath: (0, import_node_path78.join)(".agent", "rules")
|
|
9099
9489
|
}
|
|
9100
9490
|
};
|
|
9101
9491
|
}
|
|
@@ -9104,7 +9494,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9104
9494
|
relativeFilePath,
|
|
9105
9495
|
validate = true
|
|
9106
9496
|
}) {
|
|
9107
|
-
const filePath = (0,
|
|
9497
|
+
const filePath = (0, import_node_path78.join)(
|
|
9108
9498
|
baseDir,
|
|
9109
9499
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
9110
9500
|
relativeFilePath
|
|
@@ -9245,7 +9635,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9245
9635
|
};
|
|
9246
9636
|
|
|
9247
9637
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
9248
|
-
var
|
|
9638
|
+
var import_node_path79 = require("path");
|
|
9249
9639
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
9250
9640
|
toRulesyncRule() {
|
|
9251
9641
|
const rulesyncFrontmatter = {
|
|
@@ -9271,7 +9661,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9271
9661
|
relativeFilePath: ".augment-guidelines"
|
|
9272
9662
|
},
|
|
9273
9663
|
nonRoot: {
|
|
9274
|
-
relativeDirPath: (0,
|
|
9664
|
+
relativeDirPath: (0, import_node_path79.join)(".augment", "rules")
|
|
9275
9665
|
}
|
|
9276
9666
|
};
|
|
9277
9667
|
}
|
|
@@ -9306,8 +9696,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9306
9696
|
}) {
|
|
9307
9697
|
const settablePaths = this.getSettablePaths();
|
|
9308
9698
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
9309
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
9310
|
-
const fileContent = await readFileContent((0,
|
|
9699
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path79.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9700
|
+
const fileContent = await readFileContent((0, import_node_path79.join)(baseDir, relativePath));
|
|
9311
9701
|
return new _AugmentcodeLegacyRule({
|
|
9312
9702
|
baseDir,
|
|
9313
9703
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -9336,7 +9726,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9336
9726
|
};
|
|
9337
9727
|
|
|
9338
9728
|
// src/features/rules/augmentcode-rule.ts
|
|
9339
|
-
var
|
|
9729
|
+
var import_node_path80 = require("path");
|
|
9340
9730
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
9341
9731
|
toRulesyncRule() {
|
|
9342
9732
|
return this.toRulesyncRuleDefault();
|
|
@@ -9344,7 +9734,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9344
9734
|
static getSettablePaths() {
|
|
9345
9735
|
return {
|
|
9346
9736
|
nonRoot: {
|
|
9347
|
-
relativeDirPath: (0,
|
|
9737
|
+
relativeDirPath: (0, import_node_path80.join)(".augment", "rules")
|
|
9348
9738
|
}
|
|
9349
9739
|
};
|
|
9350
9740
|
}
|
|
@@ -9368,7 +9758,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9368
9758
|
validate = true
|
|
9369
9759
|
}) {
|
|
9370
9760
|
const fileContent = await readFileContent(
|
|
9371
|
-
(0,
|
|
9761
|
+
(0, import_node_path80.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9372
9762
|
);
|
|
9373
9763
|
const { body: content } = parseFrontmatter(fileContent);
|
|
9374
9764
|
return new _AugmentcodeRule({
|
|
@@ -9404,7 +9794,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9404
9794
|
};
|
|
9405
9795
|
|
|
9406
9796
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
9407
|
-
var
|
|
9797
|
+
var import_node_path81 = require("path");
|
|
9408
9798
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
9409
9799
|
static getSettablePaths({
|
|
9410
9800
|
global
|
|
@@ -9423,7 +9813,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9423
9813
|
relativeFilePath: "CLAUDE.md"
|
|
9424
9814
|
},
|
|
9425
9815
|
nonRoot: {
|
|
9426
|
-
relativeDirPath: (0,
|
|
9816
|
+
relativeDirPath: (0, import_node_path81.join)(".claude", "memories")
|
|
9427
9817
|
}
|
|
9428
9818
|
};
|
|
9429
9819
|
}
|
|
@@ -9438,7 +9828,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9438
9828
|
if (isRoot) {
|
|
9439
9829
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9440
9830
|
const fileContent2 = await readFileContent(
|
|
9441
|
-
(0,
|
|
9831
|
+
(0, import_node_path81.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9442
9832
|
);
|
|
9443
9833
|
return new _ClaudecodeLegacyRule({
|
|
9444
9834
|
baseDir,
|
|
@@ -9452,8 +9842,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9452
9842
|
if (!paths.nonRoot) {
|
|
9453
9843
|
throw new Error("nonRoot path is not set");
|
|
9454
9844
|
}
|
|
9455
|
-
const relativePath = (0,
|
|
9456
|
-
const fileContent = await readFileContent((0,
|
|
9845
|
+
const relativePath = (0, import_node_path81.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9846
|
+
const fileContent = await readFileContent((0, import_node_path81.join)(baseDir, relativePath));
|
|
9457
9847
|
return new _ClaudecodeLegacyRule({
|
|
9458
9848
|
baseDir,
|
|
9459
9849
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9512,10 +9902,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9512
9902
|
};
|
|
9513
9903
|
|
|
9514
9904
|
// src/features/rules/claudecode-rule.ts
|
|
9515
|
-
var
|
|
9516
|
-
var
|
|
9517
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
9518
|
-
paths:
|
|
9905
|
+
var import_node_path82 = require("path");
|
|
9906
|
+
var import_mini40 = require("zod/mini");
|
|
9907
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini40.z.object({
|
|
9908
|
+
paths: import_mini40.z.optional(import_mini40.z.string())
|
|
9519
9909
|
});
|
|
9520
9910
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
9521
9911
|
frontmatter;
|
|
@@ -9537,7 +9927,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9537
9927
|
relativeFilePath: "CLAUDE.md"
|
|
9538
9928
|
},
|
|
9539
9929
|
nonRoot: {
|
|
9540
|
-
relativeDirPath: (0,
|
|
9930
|
+
relativeDirPath: (0, import_node_path82.join)(".claude", "rules")
|
|
9541
9931
|
}
|
|
9542
9932
|
};
|
|
9543
9933
|
}
|
|
@@ -9546,7 +9936,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9546
9936
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9547
9937
|
if (!result.success) {
|
|
9548
9938
|
throw new Error(
|
|
9549
|
-
`Invalid frontmatter in ${(0,
|
|
9939
|
+
`Invalid frontmatter in ${(0, import_node_path82.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9550
9940
|
);
|
|
9551
9941
|
}
|
|
9552
9942
|
}
|
|
@@ -9574,7 +9964,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9574
9964
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
9575
9965
|
if (isRoot) {
|
|
9576
9966
|
const fileContent2 = await readFileContent(
|
|
9577
|
-
(0,
|
|
9967
|
+
(0, import_node_path82.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
9578
9968
|
);
|
|
9579
9969
|
return new _ClaudecodeRule({
|
|
9580
9970
|
baseDir,
|
|
@@ -9589,13 +9979,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9589
9979
|
if (!paths.nonRoot) {
|
|
9590
9980
|
throw new Error("nonRoot path is not set");
|
|
9591
9981
|
}
|
|
9592
|
-
const relativePath = (0,
|
|
9593
|
-
const fileContent = await readFileContent((0,
|
|
9982
|
+
const relativePath = (0, import_node_path82.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9983
|
+
const fileContent = await readFileContent((0, import_node_path82.join)(baseDir, relativePath));
|
|
9594
9984
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9595
9985
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9596
9986
|
if (!result.success) {
|
|
9597
9987
|
throw new Error(
|
|
9598
|
-
`Invalid frontmatter in ${(0,
|
|
9988
|
+
`Invalid frontmatter in ${(0, import_node_path82.join)(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
9599
9989
|
);
|
|
9600
9990
|
}
|
|
9601
9991
|
return new _ClaudecodeRule({
|
|
@@ -9702,7 +10092,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9702
10092
|
return {
|
|
9703
10093
|
success: false,
|
|
9704
10094
|
error: new Error(
|
|
9705
|
-
`Invalid frontmatter in ${(0,
|
|
10095
|
+
`Invalid frontmatter in ${(0, import_node_path82.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9706
10096
|
)
|
|
9707
10097
|
};
|
|
9708
10098
|
}
|
|
@@ -9722,10 +10112,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9722
10112
|
};
|
|
9723
10113
|
|
|
9724
10114
|
// src/features/rules/cline-rule.ts
|
|
9725
|
-
var
|
|
9726
|
-
var
|
|
9727
|
-
var ClineRuleFrontmatterSchema =
|
|
9728
|
-
description:
|
|
10115
|
+
var import_node_path83 = require("path");
|
|
10116
|
+
var import_mini41 = require("zod/mini");
|
|
10117
|
+
var ClineRuleFrontmatterSchema = import_mini41.z.object({
|
|
10118
|
+
description: import_mini41.z.string()
|
|
9729
10119
|
});
|
|
9730
10120
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
9731
10121
|
static getSettablePaths() {
|
|
@@ -9767,7 +10157,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9767
10157
|
validate = true
|
|
9768
10158
|
}) {
|
|
9769
10159
|
const fileContent = await readFileContent(
|
|
9770
|
-
(0,
|
|
10160
|
+
(0, import_node_path83.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9771
10161
|
);
|
|
9772
10162
|
return new _ClineRule({
|
|
9773
10163
|
baseDir,
|
|
@@ -9793,7 +10183,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9793
10183
|
};
|
|
9794
10184
|
|
|
9795
10185
|
// src/features/rules/codexcli-rule.ts
|
|
9796
|
-
var
|
|
10186
|
+
var import_node_path84 = require("path");
|
|
9797
10187
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
9798
10188
|
static getSettablePaths({
|
|
9799
10189
|
global
|
|
@@ -9812,7 +10202,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9812
10202
|
relativeFilePath: "AGENTS.md"
|
|
9813
10203
|
},
|
|
9814
10204
|
nonRoot: {
|
|
9815
|
-
relativeDirPath: (0,
|
|
10205
|
+
relativeDirPath: (0, import_node_path84.join)(".codex", "memories")
|
|
9816
10206
|
}
|
|
9817
10207
|
};
|
|
9818
10208
|
}
|
|
@@ -9827,7 +10217,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9827
10217
|
if (isRoot) {
|
|
9828
10218
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9829
10219
|
const fileContent2 = await readFileContent(
|
|
9830
|
-
(0,
|
|
10220
|
+
(0, import_node_path84.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9831
10221
|
);
|
|
9832
10222
|
return new _CodexcliRule({
|
|
9833
10223
|
baseDir,
|
|
@@ -9841,8 +10231,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9841
10231
|
if (!paths.nonRoot) {
|
|
9842
10232
|
throw new Error("nonRoot path is not set");
|
|
9843
10233
|
}
|
|
9844
|
-
const relativePath = (0,
|
|
9845
|
-
const fileContent = await readFileContent((0,
|
|
10234
|
+
const relativePath = (0, import_node_path84.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10235
|
+
const fileContent = await readFileContent((0, import_node_path84.join)(baseDir, relativePath));
|
|
9846
10236
|
return new _CodexcliRule({
|
|
9847
10237
|
baseDir,
|
|
9848
10238
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9901,12 +10291,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9901
10291
|
};
|
|
9902
10292
|
|
|
9903
10293
|
// src/features/rules/copilot-rule.ts
|
|
9904
|
-
var
|
|
9905
|
-
var
|
|
9906
|
-
var CopilotRuleFrontmatterSchema =
|
|
9907
|
-
description:
|
|
9908
|
-
applyTo:
|
|
9909
|
-
excludeAgent:
|
|
10294
|
+
var import_node_path85 = require("path");
|
|
10295
|
+
var import_mini42 = require("zod/mini");
|
|
10296
|
+
var CopilotRuleFrontmatterSchema = import_mini42.z.object({
|
|
10297
|
+
description: import_mini42.z.optional(import_mini42.z.string()),
|
|
10298
|
+
applyTo: import_mini42.z.optional(import_mini42.z.string()),
|
|
10299
|
+
excludeAgent: import_mini42.z.optional(import_mini42.z.union([import_mini42.z.literal("code-review"), import_mini42.z.literal("coding-agent")]))
|
|
9910
10300
|
});
|
|
9911
10301
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
9912
10302
|
frontmatter;
|
|
@@ -9918,7 +10308,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9918
10308
|
relativeFilePath: "copilot-instructions.md"
|
|
9919
10309
|
},
|
|
9920
10310
|
nonRoot: {
|
|
9921
|
-
relativeDirPath: (0,
|
|
10311
|
+
relativeDirPath: (0, import_node_path85.join)(".github", "instructions")
|
|
9922
10312
|
}
|
|
9923
10313
|
};
|
|
9924
10314
|
}
|
|
@@ -9927,7 +10317,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9927
10317
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9928
10318
|
if (!result.success) {
|
|
9929
10319
|
throw new Error(
|
|
9930
|
-
`Invalid frontmatter in ${(0,
|
|
10320
|
+
`Invalid frontmatter in ${(0, import_node_path85.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9931
10321
|
);
|
|
9932
10322
|
}
|
|
9933
10323
|
}
|
|
@@ -10009,11 +10399,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10009
10399
|
validate = true
|
|
10010
10400
|
}) {
|
|
10011
10401
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
10012
|
-
const relativePath = isRoot ? (0,
|
|
10402
|
+
const relativePath = isRoot ? (0, import_node_path85.join)(
|
|
10013
10403
|
this.getSettablePaths().root.relativeDirPath,
|
|
10014
10404
|
this.getSettablePaths().root.relativeFilePath
|
|
10015
|
-
) : (0,
|
|
10016
|
-
const fileContent = await readFileContent((0,
|
|
10405
|
+
) : (0, import_node_path85.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10406
|
+
const fileContent = await readFileContent((0, import_node_path85.join)(baseDir, relativePath));
|
|
10017
10407
|
if (isRoot) {
|
|
10018
10408
|
return new _CopilotRule({
|
|
10019
10409
|
baseDir,
|
|
@@ -10029,7 +10419,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10029
10419
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10030
10420
|
if (!result.success) {
|
|
10031
10421
|
throw new Error(
|
|
10032
|
-
`Invalid frontmatter in ${(0,
|
|
10422
|
+
`Invalid frontmatter in ${(0, import_node_path85.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10033
10423
|
);
|
|
10034
10424
|
}
|
|
10035
10425
|
return new _CopilotRule({
|
|
@@ -10069,7 +10459,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10069
10459
|
return {
|
|
10070
10460
|
success: false,
|
|
10071
10461
|
error: new Error(
|
|
10072
|
-
`Invalid frontmatter in ${(0,
|
|
10462
|
+
`Invalid frontmatter in ${(0, import_node_path85.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10073
10463
|
)
|
|
10074
10464
|
};
|
|
10075
10465
|
}
|
|
@@ -10089,12 +10479,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10089
10479
|
};
|
|
10090
10480
|
|
|
10091
10481
|
// src/features/rules/cursor-rule.ts
|
|
10092
|
-
var
|
|
10093
|
-
var
|
|
10094
|
-
var CursorRuleFrontmatterSchema =
|
|
10095
|
-
description:
|
|
10096
|
-
globs:
|
|
10097
|
-
alwaysApply:
|
|
10482
|
+
var import_node_path86 = require("path");
|
|
10483
|
+
var import_mini43 = require("zod/mini");
|
|
10484
|
+
var CursorRuleFrontmatterSchema = import_mini43.z.object({
|
|
10485
|
+
description: import_mini43.z.optional(import_mini43.z.string()),
|
|
10486
|
+
globs: import_mini43.z.optional(import_mini43.z.string()),
|
|
10487
|
+
alwaysApply: import_mini43.z.optional(import_mini43.z.boolean())
|
|
10098
10488
|
});
|
|
10099
10489
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
10100
10490
|
frontmatter;
|
|
@@ -10102,7 +10492,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10102
10492
|
static getSettablePaths() {
|
|
10103
10493
|
return {
|
|
10104
10494
|
nonRoot: {
|
|
10105
|
-
relativeDirPath: (0,
|
|
10495
|
+
relativeDirPath: (0, import_node_path86.join)(".cursor", "rules")
|
|
10106
10496
|
}
|
|
10107
10497
|
};
|
|
10108
10498
|
}
|
|
@@ -10111,7 +10501,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10111
10501
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10112
10502
|
if (!result.success) {
|
|
10113
10503
|
throw new Error(
|
|
10114
|
-
`Invalid frontmatter in ${(0,
|
|
10504
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10115
10505
|
);
|
|
10116
10506
|
}
|
|
10117
10507
|
}
|
|
@@ -10228,19 +10618,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10228
10618
|
validate = true
|
|
10229
10619
|
}) {
|
|
10230
10620
|
const fileContent = await readFileContent(
|
|
10231
|
-
(0,
|
|
10621
|
+
(0, import_node_path86.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10232
10622
|
);
|
|
10233
10623
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
10234
10624
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10235
10625
|
if (!result.success) {
|
|
10236
10626
|
throw new Error(
|
|
10237
|
-
`Invalid frontmatter in ${(0,
|
|
10627
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10238
10628
|
);
|
|
10239
10629
|
}
|
|
10240
10630
|
return new _CursorRule({
|
|
10241
10631
|
baseDir,
|
|
10242
10632
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
10243
|
-
relativeFilePath: (0,
|
|
10633
|
+
relativeFilePath: (0, import_node_path86.basename)(relativeFilePath),
|
|
10244
10634
|
frontmatter: result.data,
|
|
10245
10635
|
body: content.trim(),
|
|
10246
10636
|
validate
|
|
@@ -10271,7 +10661,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10271
10661
|
return {
|
|
10272
10662
|
success: false,
|
|
10273
10663
|
error: new Error(
|
|
10274
|
-
`Invalid frontmatter in ${(0,
|
|
10664
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10275
10665
|
)
|
|
10276
10666
|
};
|
|
10277
10667
|
}
|
|
@@ -10291,7 +10681,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10291
10681
|
};
|
|
10292
10682
|
|
|
10293
10683
|
// src/features/rules/geminicli-rule.ts
|
|
10294
|
-
var
|
|
10684
|
+
var import_node_path87 = require("path");
|
|
10295
10685
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
10296
10686
|
static getSettablePaths({
|
|
10297
10687
|
global
|
|
@@ -10310,7 +10700,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10310
10700
|
relativeFilePath: "GEMINI.md"
|
|
10311
10701
|
},
|
|
10312
10702
|
nonRoot: {
|
|
10313
|
-
relativeDirPath: (0,
|
|
10703
|
+
relativeDirPath: (0, import_node_path87.join)(".gemini", "memories")
|
|
10314
10704
|
}
|
|
10315
10705
|
};
|
|
10316
10706
|
}
|
|
@@ -10325,7 +10715,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10325
10715
|
if (isRoot) {
|
|
10326
10716
|
const relativePath2 = paths.root.relativeFilePath;
|
|
10327
10717
|
const fileContent2 = await readFileContent(
|
|
10328
|
-
(0,
|
|
10718
|
+
(0, import_node_path87.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
10329
10719
|
);
|
|
10330
10720
|
return new _GeminiCliRule({
|
|
10331
10721
|
baseDir,
|
|
@@ -10339,8 +10729,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10339
10729
|
if (!paths.nonRoot) {
|
|
10340
10730
|
throw new Error("nonRoot path is not set");
|
|
10341
10731
|
}
|
|
10342
|
-
const relativePath = (0,
|
|
10343
|
-
const fileContent = await readFileContent((0,
|
|
10732
|
+
const relativePath = (0, import_node_path87.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10733
|
+
const fileContent = await readFileContent((0, import_node_path87.join)(baseDir, relativePath));
|
|
10344
10734
|
return new _GeminiCliRule({
|
|
10345
10735
|
baseDir,
|
|
10346
10736
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10399,7 +10789,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10399
10789
|
};
|
|
10400
10790
|
|
|
10401
10791
|
// src/features/rules/junie-rule.ts
|
|
10402
|
-
var
|
|
10792
|
+
var import_node_path88 = require("path");
|
|
10403
10793
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
10404
10794
|
static getSettablePaths() {
|
|
10405
10795
|
return {
|
|
@@ -10408,7 +10798,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10408
10798
|
relativeFilePath: "guidelines.md"
|
|
10409
10799
|
},
|
|
10410
10800
|
nonRoot: {
|
|
10411
|
-
relativeDirPath: (0,
|
|
10801
|
+
relativeDirPath: (0, import_node_path88.join)(".junie", "memories")
|
|
10412
10802
|
}
|
|
10413
10803
|
};
|
|
10414
10804
|
}
|
|
@@ -10418,8 +10808,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10418
10808
|
validate = true
|
|
10419
10809
|
}) {
|
|
10420
10810
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
10421
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
10422
|
-
const fileContent = await readFileContent((0,
|
|
10811
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path88.join)(".junie", "memories", relativeFilePath);
|
|
10812
|
+
const fileContent = await readFileContent((0, import_node_path88.join)(baseDir, relativePath));
|
|
10423
10813
|
return new _JunieRule({
|
|
10424
10814
|
baseDir,
|
|
10425
10815
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10474,12 +10864,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10474
10864
|
};
|
|
10475
10865
|
|
|
10476
10866
|
// src/features/rules/kilo-rule.ts
|
|
10477
|
-
var
|
|
10867
|
+
var import_node_path89 = require("path");
|
|
10478
10868
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
10479
10869
|
static getSettablePaths(_options = {}) {
|
|
10480
10870
|
return {
|
|
10481
10871
|
nonRoot: {
|
|
10482
|
-
relativeDirPath: (0,
|
|
10872
|
+
relativeDirPath: (0, import_node_path89.join)(".kilocode", "rules")
|
|
10483
10873
|
}
|
|
10484
10874
|
};
|
|
10485
10875
|
}
|
|
@@ -10489,7 +10879,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10489
10879
|
validate = true
|
|
10490
10880
|
}) {
|
|
10491
10881
|
const fileContent = await readFileContent(
|
|
10492
|
-
(0,
|
|
10882
|
+
(0, import_node_path89.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10493
10883
|
);
|
|
10494
10884
|
return new _KiloRule({
|
|
10495
10885
|
baseDir,
|
|
@@ -10541,12 +10931,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10541
10931
|
};
|
|
10542
10932
|
|
|
10543
10933
|
// src/features/rules/kiro-rule.ts
|
|
10544
|
-
var
|
|
10934
|
+
var import_node_path90 = require("path");
|
|
10545
10935
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
10546
10936
|
static getSettablePaths() {
|
|
10547
10937
|
return {
|
|
10548
10938
|
nonRoot: {
|
|
10549
|
-
relativeDirPath: (0,
|
|
10939
|
+
relativeDirPath: (0, import_node_path90.join)(".kiro", "steering")
|
|
10550
10940
|
}
|
|
10551
10941
|
};
|
|
10552
10942
|
}
|
|
@@ -10556,7 +10946,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10556
10946
|
validate = true
|
|
10557
10947
|
}) {
|
|
10558
10948
|
const fileContent = await readFileContent(
|
|
10559
|
-
(0,
|
|
10949
|
+
(0, import_node_path90.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10560
10950
|
);
|
|
10561
10951
|
return new _KiroRule({
|
|
10562
10952
|
baseDir,
|
|
@@ -10610,7 +11000,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10610
11000
|
};
|
|
10611
11001
|
|
|
10612
11002
|
// src/features/rules/opencode-rule.ts
|
|
10613
|
-
var
|
|
11003
|
+
var import_node_path91 = require("path");
|
|
10614
11004
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
10615
11005
|
static getSettablePaths() {
|
|
10616
11006
|
return {
|
|
@@ -10619,7 +11009,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10619
11009
|
relativeFilePath: "AGENTS.md"
|
|
10620
11010
|
},
|
|
10621
11011
|
nonRoot: {
|
|
10622
|
-
relativeDirPath: (0,
|
|
11012
|
+
relativeDirPath: (0, import_node_path91.join)(".opencode", "memories")
|
|
10623
11013
|
}
|
|
10624
11014
|
};
|
|
10625
11015
|
}
|
|
@@ -10629,8 +11019,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10629
11019
|
validate = true
|
|
10630
11020
|
}) {
|
|
10631
11021
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
10632
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
10633
|
-
const fileContent = await readFileContent((0,
|
|
11022
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path91.join)(".opencode", "memories", relativeFilePath);
|
|
11023
|
+
const fileContent = await readFileContent((0, import_node_path91.join)(baseDir, relativePath));
|
|
10634
11024
|
return new _OpenCodeRule({
|
|
10635
11025
|
baseDir,
|
|
10636
11026
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10685,7 +11075,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10685
11075
|
};
|
|
10686
11076
|
|
|
10687
11077
|
// src/features/rules/qwencode-rule.ts
|
|
10688
|
-
var
|
|
11078
|
+
var import_node_path92 = require("path");
|
|
10689
11079
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
10690
11080
|
static getSettablePaths() {
|
|
10691
11081
|
return {
|
|
@@ -10694,7 +11084,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10694
11084
|
relativeFilePath: "QWEN.md"
|
|
10695
11085
|
},
|
|
10696
11086
|
nonRoot: {
|
|
10697
|
-
relativeDirPath: (0,
|
|
11087
|
+
relativeDirPath: (0, import_node_path92.join)(".qwen", "memories")
|
|
10698
11088
|
}
|
|
10699
11089
|
};
|
|
10700
11090
|
}
|
|
@@ -10704,8 +11094,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10704
11094
|
validate = true
|
|
10705
11095
|
}) {
|
|
10706
11096
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
10707
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
10708
|
-
const fileContent = await readFileContent((0,
|
|
11097
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path92.join)(".qwen", "memories", relativeFilePath);
|
|
11098
|
+
const fileContent = await readFileContent((0, import_node_path92.join)(baseDir, relativePath));
|
|
10709
11099
|
return new _QwencodeRule({
|
|
10710
11100
|
baseDir,
|
|
10711
11101
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10757,7 +11147,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10757
11147
|
};
|
|
10758
11148
|
|
|
10759
11149
|
// src/features/rules/replit-rule.ts
|
|
10760
|
-
var
|
|
11150
|
+
var import_node_path93 = require("path");
|
|
10761
11151
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
10762
11152
|
static getSettablePaths() {
|
|
10763
11153
|
return {
|
|
@@ -10779,7 +11169,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
10779
11169
|
}
|
|
10780
11170
|
const relativePath = paths.root.relativeFilePath;
|
|
10781
11171
|
const fileContent = await readFileContent(
|
|
10782
|
-
(0,
|
|
11172
|
+
(0, import_node_path93.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
10783
11173
|
);
|
|
10784
11174
|
return new _ReplitRule({
|
|
10785
11175
|
baseDir,
|
|
@@ -10845,12 +11235,12 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
10845
11235
|
};
|
|
10846
11236
|
|
|
10847
11237
|
// src/features/rules/roo-rule.ts
|
|
10848
|
-
var
|
|
11238
|
+
var import_node_path94 = require("path");
|
|
10849
11239
|
var RooRule = class _RooRule extends ToolRule {
|
|
10850
11240
|
static getSettablePaths() {
|
|
10851
11241
|
return {
|
|
10852
11242
|
nonRoot: {
|
|
10853
|
-
relativeDirPath: (0,
|
|
11243
|
+
relativeDirPath: (0, import_node_path94.join)(".roo", "rules")
|
|
10854
11244
|
}
|
|
10855
11245
|
};
|
|
10856
11246
|
}
|
|
@@ -10860,7 +11250,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10860
11250
|
validate = true
|
|
10861
11251
|
}) {
|
|
10862
11252
|
const fileContent = await readFileContent(
|
|
10863
|
-
(0,
|
|
11253
|
+
(0, import_node_path94.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10864
11254
|
);
|
|
10865
11255
|
return new _RooRule({
|
|
10866
11256
|
baseDir,
|
|
@@ -10929,7 +11319,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10929
11319
|
};
|
|
10930
11320
|
|
|
10931
11321
|
// src/features/rules/warp-rule.ts
|
|
10932
|
-
var
|
|
11322
|
+
var import_node_path95 = require("path");
|
|
10933
11323
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
10934
11324
|
constructor({ fileContent, root, ...rest }) {
|
|
10935
11325
|
super({
|
|
@@ -10945,7 +11335,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10945
11335
|
relativeFilePath: "WARP.md"
|
|
10946
11336
|
},
|
|
10947
11337
|
nonRoot: {
|
|
10948
|
-
relativeDirPath: (0,
|
|
11338
|
+
relativeDirPath: (0, import_node_path95.join)(".warp", "memories")
|
|
10949
11339
|
}
|
|
10950
11340
|
};
|
|
10951
11341
|
}
|
|
@@ -10955,8 +11345,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10955
11345
|
validate = true
|
|
10956
11346
|
}) {
|
|
10957
11347
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
10958
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
10959
|
-
const fileContent = await readFileContent((0,
|
|
11348
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path95.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
11349
|
+
const fileContent = await readFileContent((0, import_node_path95.join)(baseDir, relativePath));
|
|
10960
11350
|
return new _WarpRule({
|
|
10961
11351
|
baseDir,
|
|
10962
11352
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -11011,12 +11401,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11011
11401
|
};
|
|
11012
11402
|
|
|
11013
11403
|
// src/features/rules/windsurf-rule.ts
|
|
11014
|
-
var
|
|
11404
|
+
var import_node_path96 = require("path");
|
|
11015
11405
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
11016
11406
|
static getSettablePaths() {
|
|
11017
11407
|
return {
|
|
11018
11408
|
nonRoot: {
|
|
11019
|
-
relativeDirPath: (0,
|
|
11409
|
+
relativeDirPath: (0, import_node_path96.join)(".windsurf", "rules")
|
|
11020
11410
|
}
|
|
11021
11411
|
};
|
|
11022
11412
|
}
|
|
@@ -11026,7 +11416,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
11026
11416
|
validate = true
|
|
11027
11417
|
}) {
|
|
11028
11418
|
const fileContent = await readFileContent(
|
|
11029
|
-
(0,
|
|
11419
|
+
(0, import_node_path96.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11030
11420
|
);
|
|
11031
11421
|
return new _WindsurfRule({
|
|
11032
11422
|
baseDir,
|
|
@@ -11100,7 +11490,7 @@ var rulesProcessorToolTargets = [
|
|
|
11100
11490
|
"warp",
|
|
11101
11491
|
"windsurf"
|
|
11102
11492
|
];
|
|
11103
|
-
var RulesProcessorToolTargetSchema =
|
|
11493
|
+
var RulesProcessorToolTargetSchema = import_mini44.z.enum(rulesProcessorToolTargets);
|
|
11104
11494
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
11105
11495
|
[
|
|
11106
11496
|
"agentsmd",
|
|
@@ -11391,7 +11781,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11391
11781
|
}).relativeDirPath;
|
|
11392
11782
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
11393
11783
|
const frontmatter = skill.getFrontmatter();
|
|
11394
|
-
const relativePath = (0,
|
|
11784
|
+
const relativePath = (0, import_node_path97.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
11395
11785
|
return {
|
|
11396
11786
|
name: frontmatter.name,
|
|
11397
11787
|
description: frontmatter.description,
|
|
@@ -11458,10 +11848,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11458
11848
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
11459
11849
|
*/
|
|
11460
11850
|
async loadRulesyncFiles() {
|
|
11461
|
-
const files = await findFilesByGlobs((0,
|
|
11851
|
+
const files = await findFilesByGlobs((0, import_node_path97.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
11462
11852
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
11463
11853
|
const rulesyncRules = await Promise.all(
|
|
11464
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0,
|
|
11854
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path97.basename)(file) }))
|
|
11465
11855
|
);
|
|
11466
11856
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
11467
11857
|
if (rootRules.length > 1) {
|
|
@@ -11479,10 +11869,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11479
11869
|
return rulesyncRules;
|
|
11480
11870
|
}
|
|
11481
11871
|
async loadRulesyncFilesLegacy() {
|
|
11482
|
-
const legacyFiles = await findFilesByGlobs((0,
|
|
11872
|
+
const legacyFiles = await findFilesByGlobs((0, import_node_path97.join)(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
11483
11873
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
11484
11874
|
return Promise.all(
|
|
11485
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0,
|
|
11875
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path97.basename)(file) }))
|
|
11486
11876
|
);
|
|
11487
11877
|
}
|
|
11488
11878
|
/**
|
|
@@ -11500,7 +11890,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11500
11890
|
return [];
|
|
11501
11891
|
}
|
|
11502
11892
|
const rootFilePaths = await findFilesByGlobs(
|
|
11503
|
-
(0,
|
|
11893
|
+
(0, import_node_path97.join)(
|
|
11504
11894
|
this.baseDir,
|
|
11505
11895
|
settablePaths.root.relativeDirPath ?? ".",
|
|
11506
11896
|
settablePaths.root.relativeFilePath
|
|
@@ -11511,7 +11901,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11511
11901
|
(filePath) => factory.class.forDeletion({
|
|
11512
11902
|
baseDir: this.baseDir,
|
|
11513
11903
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
11514
|
-
relativeFilePath: (0,
|
|
11904
|
+
relativeFilePath: (0, import_node_path97.basename)(filePath),
|
|
11515
11905
|
global: this.global
|
|
11516
11906
|
})
|
|
11517
11907
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11520,7 +11910,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11520
11910
|
rootFilePaths.map(
|
|
11521
11911
|
(filePath) => factory.class.fromFile({
|
|
11522
11912
|
baseDir: this.baseDir,
|
|
11523
|
-
relativeFilePath: (0,
|
|
11913
|
+
relativeFilePath: (0, import_node_path97.basename)(filePath),
|
|
11524
11914
|
global: this.global
|
|
11525
11915
|
})
|
|
11526
11916
|
)
|
|
@@ -11532,14 +11922,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11532
11922
|
return [];
|
|
11533
11923
|
}
|
|
11534
11924
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
11535
|
-
(0,
|
|
11925
|
+
(0, import_node_path97.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
11536
11926
|
);
|
|
11537
11927
|
if (forDeletion) {
|
|
11538
11928
|
return nonRootFilePaths.map(
|
|
11539
11929
|
(filePath) => factory.class.forDeletion({
|
|
11540
11930
|
baseDir: this.baseDir,
|
|
11541
11931
|
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
11542
|
-
relativeFilePath: (0,
|
|
11932
|
+
relativeFilePath: (0, import_node_path97.basename)(filePath),
|
|
11543
11933
|
global: this.global
|
|
11544
11934
|
})
|
|
11545
11935
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11548,7 +11938,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11548
11938
|
nonRootFilePaths.map(
|
|
11549
11939
|
(filePath) => factory.class.fromFile({
|
|
11550
11940
|
baseDir: this.baseDir,
|
|
11551
|
-
relativeFilePath: (0,
|
|
11941
|
+
relativeFilePath: (0, import_node_path97.basename)(filePath),
|
|
11552
11942
|
global: this.global
|
|
11553
11943
|
})
|
|
11554
11944
|
)
|
|
@@ -11641,14 +12031,14 @@ s/<command> [arguments]
|
|
|
11641
12031
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
11642
12032
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
11643
12033
|
|
|
11644
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
12034
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path97.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
11645
12035
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
11646
12036
|
|
|
11647
12037
|
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.
|
|
11648
12038
|
|
|
11649
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
12039
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path97.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
11650
12040
|
|
|
11651
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
12041
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path97.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
11652
12042
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
11653
12043
|
const result = [
|
|
11654
12044
|
overview,
|
|
@@ -11678,7 +12068,10 @@ ${toonContent}`;
|
|
|
11678
12068
|
// src/cli/commands/generate.ts
|
|
11679
12069
|
async function generateCommand(options) {
|
|
11680
12070
|
const config = await ConfigResolver.resolve(options);
|
|
11681
|
-
logger.
|
|
12071
|
+
logger.configure({
|
|
12072
|
+
verbose: config.getVerbose(),
|
|
12073
|
+
silent: config.getSilent()
|
|
12074
|
+
});
|
|
11682
12075
|
logger.info("Generating files...");
|
|
11683
12076
|
if (!await fileExists(RULESYNC_RELATIVE_DIR_PATH)) {
|
|
11684
12077
|
logger.error("\u274C .rulesync directory not found. Run 'rulesync init' first.");
|
|
@@ -11930,7 +12323,7 @@ async function generateSkills(config) {
|
|
|
11930
12323
|
}
|
|
11931
12324
|
|
|
11932
12325
|
// src/cli/commands/gitignore.ts
|
|
11933
|
-
var
|
|
12326
|
+
var import_node_path98 = require("path");
|
|
11934
12327
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
11935
12328
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
11936
12329
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -11994,6 +12387,8 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11994
12387
|
// Kiro
|
|
11995
12388
|
"**/.kiro/steering/",
|
|
11996
12389
|
"**/.kiro/prompts/",
|
|
12390
|
+
"**/.kiro/skills/",
|
|
12391
|
+
"**/.kiro/agents/",
|
|
11997
12392
|
"**/.kiro/settings/mcp.json",
|
|
11998
12393
|
"**/.aiignore",
|
|
11999
12394
|
// OpenCode
|
|
@@ -12069,7 +12464,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
12069
12464
|
return result;
|
|
12070
12465
|
};
|
|
12071
12466
|
var gitignoreCommand = async () => {
|
|
12072
|
-
const gitignorePath = (0,
|
|
12467
|
+
const gitignorePath = (0, import_node_path98.join)(process.cwd(), ".gitignore");
|
|
12073
12468
|
let gitignoreContent = "";
|
|
12074
12469
|
if (await fileExists(gitignorePath)) {
|
|
12075
12470
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -12103,7 +12498,10 @@ async function importCommand(options) {
|
|
|
12103
12498
|
process.exit(1);
|
|
12104
12499
|
}
|
|
12105
12500
|
const config = await ConfigResolver.resolve(options);
|
|
12106
|
-
logger.
|
|
12501
|
+
logger.configure({
|
|
12502
|
+
verbose: config.getVerbose(),
|
|
12503
|
+
silent: config.getSilent()
|
|
12504
|
+
});
|
|
12107
12505
|
const tool = config.getTargets()[0];
|
|
12108
12506
|
await importRules(config, tool);
|
|
12109
12507
|
await importIgnore(config, tool);
|
|
@@ -12268,7 +12666,7 @@ async function importSkills(config, tool) {
|
|
|
12268
12666
|
}
|
|
12269
12667
|
|
|
12270
12668
|
// src/cli/commands/init.ts
|
|
12271
|
-
var
|
|
12669
|
+
var import_node_path99 = require("path");
|
|
12272
12670
|
async function initCommand() {
|
|
12273
12671
|
logger.info("Initializing rulesync...");
|
|
12274
12672
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -12446,14 +12844,14 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12446
12844
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
12447
12845
|
await ensureDir(skillPaths.relativeDirPath);
|
|
12448
12846
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
12449
|
-
const ruleFilepath = (0,
|
|
12847
|
+
const ruleFilepath = (0, import_node_path99.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
12450
12848
|
if (!await fileExists(ruleFilepath)) {
|
|
12451
12849
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
12452
12850
|
logger.success(`Created ${ruleFilepath}`);
|
|
12453
12851
|
} else {
|
|
12454
12852
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
12455
12853
|
}
|
|
12456
|
-
const mcpFilepath = (0,
|
|
12854
|
+
const mcpFilepath = (0, import_node_path99.join)(
|
|
12457
12855
|
mcpPaths.recommended.relativeDirPath,
|
|
12458
12856
|
mcpPaths.recommended.relativeFilePath
|
|
12459
12857
|
);
|
|
@@ -12463,30 +12861,30 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12463
12861
|
} else {
|
|
12464
12862
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
12465
12863
|
}
|
|
12466
|
-
const commandFilepath = (0,
|
|
12864
|
+
const commandFilepath = (0, import_node_path99.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
12467
12865
|
if (!await fileExists(commandFilepath)) {
|
|
12468
12866
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
12469
12867
|
logger.success(`Created ${commandFilepath}`);
|
|
12470
12868
|
} else {
|
|
12471
12869
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
12472
12870
|
}
|
|
12473
|
-
const subagentFilepath = (0,
|
|
12871
|
+
const subagentFilepath = (0, import_node_path99.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
12474
12872
|
if (!await fileExists(subagentFilepath)) {
|
|
12475
12873
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
12476
12874
|
logger.success(`Created ${subagentFilepath}`);
|
|
12477
12875
|
} else {
|
|
12478
12876
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
12479
12877
|
}
|
|
12480
|
-
const skillDirPath = (0,
|
|
12878
|
+
const skillDirPath = (0, import_node_path99.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
12481
12879
|
await ensureDir(skillDirPath);
|
|
12482
|
-
const skillFilepath = (0,
|
|
12880
|
+
const skillFilepath = (0, import_node_path99.join)(skillDirPath, SKILL_FILE_NAME);
|
|
12483
12881
|
if (!await fileExists(skillFilepath)) {
|
|
12484
12882
|
await writeFileContent(skillFilepath, sampleSkillFile.content);
|
|
12485
12883
|
logger.success(`Created ${skillFilepath}`);
|
|
12486
12884
|
} else {
|
|
12487
12885
|
logger.info(`Skipped ${skillFilepath} (already exists)`);
|
|
12488
12886
|
}
|
|
12489
|
-
const ignoreFilepath = (0,
|
|
12887
|
+
const ignoreFilepath = (0, import_node_path99.join)(
|
|
12490
12888
|
ignorePaths.recommended.relativeDirPath,
|
|
12491
12889
|
ignorePaths.recommended.relativeFilePath
|
|
12492
12890
|
);
|
|
@@ -12502,15 +12900,15 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12502
12900
|
var import_fastmcp = require("fastmcp");
|
|
12503
12901
|
|
|
12504
12902
|
// src/mcp/tools.ts
|
|
12505
|
-
var
|
|
12903
|
+
var import_mini51 = require("zod/mini");
|
|
12506
12904
|
|
|
12507
12905
|
// src/mcp/commands.ts
|
|
12508
|
-
var
|
|
12509
|
-
var
|
|
12906
|
+
var import_node_path100 = require("path");
|
|
12907
|
+
var import_mini45 = require("zod/mini");
|
|
12510
12908
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
12511
12909
|
var maxCommandsCount = 1e3;
|
|
12512
12910
|
async function listCommands() {
|
|
12513
|
-
const commandsDir = (0,
|
|
12911
|
+
const commandsDir = (0, import_node_path100.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12514
12912
|
try {
|
|
12515
12913
|
const files = await listDirectoryFiles(commandsDir);
|
|
12516
12914
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12522,7 +12920,7 @@ async function listCommands() {
|
|
|
12522
12920
|
});
|
|
12523
12921
|
const frontmatter = command.getFrontmatter();
|
|
12524
12922
|
return {
|
|
12525
|
-
relativePathFromCwd: (0,
|
|
12923
|
+
relativePathFromCwd: (0, import_node_path100.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
12526
12924
|
frontmatter
|
|
12527
12925
|
};
|
|
12528
12926
|
} catch (error) {
|
|
@@ -12542,13 +12940,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
12542
12940
|
relativePath: relativePathFromCwd,
|
|
12543
12941
|
intendedRootDir: process.cwd()
|
|
12544
12942
|
});
|
|
12545
|
-
const filename = (0,
|
|
12943
|
+
const filename = (0, import_node_path100.basename)(relativePathFromCwd);
|
|
12546
12944
|
try {
|
|
12547
12945
|
const command = await RulesyncCommand.fromFile({
|
|
12548
12946
|
relativeFilePath: filename
|
|
12549
12947
|
});
|
|
12550
12948
|
return {
|
|
12551
|
-
relativePathFromCwd: (0,
|
|
12949
|
+
relativePathFromCwd: (0, import_node_path100.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12552
12950
|
frontmatter: command.getFrontmatter(),
|
|
12553
12951
|
body: command.getBody()
|
|
12554
12952
|
};
|
|
@@ -12567,7 +12965,7 @@ async function putCommand({
|
|
|
12567
12965
|
relativePath: relativePathFromCwd,
|
|
12568
12966
|
intendedRootDir: process.cwd()
|
|
12569
12967
|
});
|
|
12570
|
-
const filename = (0,
|
|
12968
|
+
const filename = (0, import_node_path100.basename)(relativePathFromCwd);
|
|
12571
12969
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12572
12970
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
12573
12971
|
throw new Error(
|
|
@@ -12577,7 +12975,7 @@ async function putCommand({
|
|
|
12577
12975
|
try {
|
|
12578
12976
|
const existingCommands = await listCommands();
|
|
12579
12977
|
const isUpdate = existingCommands.some(
|
|
12580
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
12978
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path100.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12581
12979
|
);
|
|
12582
12980
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
12583
12981
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -12592,11 +12990,11 @@ async function putCommand({
|
|
|
12592
12990
|
fileContent,
|
|
12593
12991
|
validate: true
|
|
12594
12992
|
});
|
|
12595
|
-
const commandsDir = (0,
|
|
12993
|
+
const commandsDir = (0, import_node_path100.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12596
12994
|
await ensureDir(commandsDir);
|
|
12597
12995
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
12598
12996
|
return {
|
|
12599
|
-
relativePathFromCwd: (0,
|
|
12997
|
+
relativePathFromCwd: (0, import_node_path100.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12600
12998
|
frontmatter: command.getFrontmatter(),
|
|
12601
12999
|
body: command.getBody()
|
|
12602
13000
|
};
|
|
@@ -12611,12 +13009,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12611
13009
|
relativePath: relativePathFromCwd,
|
|
12612
13010
|
intendedRootDir: process.cwd()
|
|
12613
13011
|
});
|
|
12614
|
-
const filename = (0,
|
|
12615
|
-
const fullPath = (0,
|
|
13012
|
+
const filename = (0, import_node_path100.basename)(relativePathFromCwd);
|
|
13013
|
+
const fullPath = (0, import_node_path100.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
12616
13014
|
try {
|
|
12617
13015
|
await removeFile(fullPath);
|
|
12618
13016
|
return {
|
|
12619
|
-
relativePathFromCwd: (0,
|
|
13017
|
+
relativePathFromCwd: (0, import_node_path100.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12620
13018
|
};
|
|
12621
13019
|
} catch (error) {
|
|
12622
13020
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12625,23 +13023,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12625
13023
|
}
|
|
12626
13024
|
}
|
|
12627
13025
|
var commandToolSchemas = {
|
|
12628
|
-
listCommands:
|
|
12629
|
-
getCommand:
|
|
12630
|
-
relativePathFromCwd:
|
|
13026
|
+
listCommands: import_mini45.z.object({}),
|
|
13027
|
+
getCommand: import_mini45.z.object({
|
|
13028
|
+
relativePathFromCwd: import_mini45.z.string()
|
|
12631
13029
|
}),
|
|
12632
|
-
putCommand:
|
|
12633
|
-
relativePathFromCwd:
|
|
13030
|
+
putCommand: import_mini45.z.object({
|
|
13031
|
+
relativePathFromCwd: import_mini45.z.string(),
|
|
12634
13032
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
12635
|
-
body:
|
|
13033
|
+
body: import_mini45.z.string()
|
|
12636
13034
|
}),
|
|
12637
|
-
deleteCommand:
|
|
12638
|
-
relativePathFromCwd:
|
|
13035
|
+
deleteCommand: import_mini45.z.object({
|
|
13036
|
+
relativePathFromCwd: import_mini45.z.string()
|
|
12639
13037
|
})
|
|
12640
13038
|
};
|
|
12641
13039
|
var commandTools = {
|
|
12642
13040
|
listCommands: {
|
|
12643
13041
|
name: "listCommands",
|
|
12644
|
-
description: `List all commands from ${(0,
|
|
13042
|
+
description: `List all commands from ${(0, import_node_path100.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12645
13043
|
parameters: commandToolSchemas.listCommands,
|
|
12646
13044
|
execute: async () => {
|
|
12647
13045
|
const commands = await listCommands();
|
|
@@ -12683,11 +13081,11 @@ var commandTools = {
|
|
|
12683
13081
|
};
|
|
12684
13082
|
|
|
12685
13083
|
// src/mcp/ignore.ts
|
|
12686
|
-
var
|
|
12687
|
-
var
|
|
13084
|
+
var import_node_path101 = require("path");
|
|
13085
|
+
var import_mini46 = require("zod/mini");
|
|
12688
13086
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
12689
13087
|
async function getIgnoreFile() {
|
|
12690
|
-
const ignoreFilePath = (0,
|
|
13088
|
+
const ignoreFilePath = (0, import_node_path101.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12691
13089
|
try {
|
|
12692
13090
|
const content = await readFileContent(ignoreFilePath);
|
|
12693
13091
|
return {
|
|
@@ -12701,7 +13099,7 @@ async function getIgnoreFile() {
|
|
|
12701
13099
|
}
|
|
12702
13100
|
}
|
|
12703
13101
|
async function putIgnoreFile({ content }) {
|
|
12704
|
-
const ignoreFilePath = (0,
|
|
13102
|
+
const ignoreFilePath = (0, import_node_path101.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12705
13103
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
12706
13104
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
12707
13105
|
throw new Error(
|
|
@@ -12722,8 +13120,8 @@ async function putIgnoreFile({ content }) {
|
|
|
12722
13120
|
}
|
|
12723
13121
|
}
|
|
12724
13122
|
async function deleteIgnoreFile() {
|
|
12725
|
-
const aiignorePath = (0,
|
|
12726
|
-
const legacyIgnorePath = (0,
|
|
13123
|
+
const aiignorePath = (0, import_node_path101.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
13124
|
+
const legacyIgnorePath = (0, import_node_path101.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
12727
13125
|
try {
|
|
12728
13126
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
12729
13127
|
return {
|
|
@@ -12741,11 +13139,11 @@ async function deleteIgnoreFile() {
|
|
|
12741
13139
|
}
|
|
12742
13140
|
}
|
|
12743
13141
|
var ignoreToolSchemas = {
|
|
12744
|
-
getIgnoreFile:
|
|
12745
|
-
putIgnoreFile:
|
|
12746
|
-
content:
|
|
13142
|
+
getIgnoreFile: import_mini46.z.object({}),
|
|
13143
|
+
putIgnoreFile: import_mini46.z.object({
|
|
13144
|
+
content: import_mini46.z.string()
|
|
12747
13145
|
}),
|
|
12748
|
-
deleteIgnoreFile:
|
|
13146
|
+
deleteIgnoreFile: import_mini46.z.object({})
|
|
12749
13147
|
};
|
|
12750
13148
|
var ignoreTools = {
|
|
12751
13149
|
getIgnoreFile: {
|
|
@@ -12778,8 +13176,8 @@ var ignoreTools = {
|
|
|
12778
13176
|
};
|
|
12779
13177
|
|
|
12780
13178
|
// src/mcp/mcp.ts
|
|
12781
|
-
var
|
|
12782
|
-
var
|
|
13179
|
+
var import_node_path102 = require("path");
|
|
13180
|
+
var import_mini47 = require("zod/mini");
|
|
12783
13181
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
12784
13182
|
async function getMcpFile() {
|
|
12785
13183
|
const config = await ConfigResolver.resolve({});
|
|
@@ -12788,7 +13186,7 @@ async function getMcpFile() {
|
|
|
12788
13186
|
validate: true,
|
|
12789
13187
|
modularMcp: config.getModularMcp()
|
|
12790
13188
|
});
|
|
12791
|
-
const relativePathFromCwd = (0,
|
|
13189
|
+
const relativePathFromCwd = (0, import_node_path102.join)(
|
|
12792
13190
|
rulesyncMcp.getRelativeDirPath(),
|
|
12793
13191
|
rulesyncMcp.getRelativeFilePath()
|
|
12794
13192
|
);
|
|
@@ -12821,7 +13219,7 @@ async function putMcpFile({ content }) {
|
|
|
12821
13219
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12822
13220
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
12823
13221
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
12824
|
-
const fullPath = (0,
|
|
13222
|
+
const fullPath = (0, import_node_path102.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
12825
13223
|
const rulesyncMcp = new RulesyncMcp({
|
|
12826
13224
|
baseDir,
|
|
12827
13225
|
relativeDirPath,
|
|
@@ -12830,9 +13228,9 @@ async function putMcpFile({ content }) {
|
|
|
12830
13228
|
validate: true,
|
|
12831
13229
|
modularMcp: config.getModularMcp()
|
|
12832
13230
|
});
|
|
12833
|
-
await ensureDir((0,
|
|
13231
|
+
await ensureDir((0, import_node_path102.join)(baseDir, relativeDirPath));
|
|
12834
13232
|
await writeFileContent(fullPath, content);
|
|
12835
|
-
const relativePathFromCwd = (0,
|
|
13233
|
+
const relativePathFromCwd = (0, import_node_path102.join)(relativeDirPath, relativeFilePath);
|
|
12836
13234
|
return {
|
|
12837
13235
|
relativePathFromCwd,
|
|
12838
13236
|
content: rulesyncMcp.getFileContent()
|
|
@@ -12847,15 +13245,15 @@ async function deleteMcpFile() {
|
|
|
12847
13245
|
try {
|
|
12848
13246
|
const baseDir = process.cwd();
|
|
12849
13247
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12850
|
-
const recommendedPath = (0,
|
|
13248
|
+
const recommendedPath = (0, import_node_path102.join)(
|
|
12851
13249
|
baseDir,
|
|
12852
13250
|
paths.recommended.relativeDirPath,
|
|
12853
13251
|
paths.recommended.relativeFilePath
|
|
12854
13252
|
);
|
|
12855
|
-
const legacyPath = (0,
|
|
13253
|
+
const legacyPath = (0, import_node_path102.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
12856
13254
|
await removeFile(recommendedPath);
|
|
12857
13255
|
await removeFile(legacyPath);
|
|
12858
|
-
const relativePathFromCwd = (0,
|
|
13256
|
+
const relativePathFromCwd = (0, import_node_path102.join)(
|
|
12859
13257
|
paths.recommended.relativeDirPath,
|
|
12860
13258
|
paths.recommended.relativeFilePath
|
|
12861
13259
|
);
|
|
@@ -12869,11 +13267,11 @@ async function deleteMcpFile() {
|
|
|
12869
13267
|
}
|
|
12870
13268
|
}
|
|
12871
13269
|
var mcpToolSchemas = {
|
|
12872
|
-
getMcpFile:
|
|
12873
|
-
putMcpFile:
|
|
12874
|
-
content:
|
|
13270
|
+
getMcpFile: import_mini47.z.object({}),
|
|
13271
|
+
putMcpFile: import_mini47.z.object({
|
|
13272
|
+
content: import_mini47.z.string()
|
|
12875
13273
|
}),
|
|
12876
|
-
deleteMcpFile:
|
|
13274
|
+
deleteMcpFile: import_mini47.z.object({})
|
|
12877
13275
|
};
|
|
12878
13276
|
var mcpTools = {
|
|
12879
13277
|
getMcpFile: {
|
|
@@ -12906,12 +13304,12 @@ var mcpTools = {
|
|
|
12906
13304
|
};
|
|
12907
13305
|
|
|
12908
13306
|
// src/mcp/rules.ts
|
|
12909
|
-
var
|
|
12910
|
-
var
|
|
13307
|
+
var import_node_path103 = require("path");
|
|
13308
|
+
var import_mini48 = require("zod/mini");
|
|
12911
13309
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
12912
13310
|
var maxRulesCount = 1e3;
|
|
12913
13311
|
async function listRules() {
|
|
12914
|
-
const rulesDir = (0,
|
|
13312
|
+
const rulesDir = (0, import_node_path103.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12915
13313
|
try {
|
|
12916
13314
|
const files = await listDirectoryFiles(rulesDir);
|
|
12917
13315
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12924,7 +13322,7 @@ async function listRules() {
|
|
|
12924
13322
|
});
|
|
12925
13323
|
const frontmatter = rule.getFrontmatter();
|
|
12926
13324
|
return {
|
|
12927
|
-
relativePathFromCwd: (0,
|
|
13325
|
+
relativePathFromCwd: (0, import_node_path103.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
12928
13326
|
frontmatter
|
|
12929
13327
|
};
|
|
12930
13328
|
} catch (error) {
|
|
@@ -12944,14 +13342,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
12944
13342
|
relativePath: relativePathFromCwd,
|
|
12945
13343
|
intendedRootDir: process.cwd()
|
|
12946
13344
|
});
|
|
12947
|
-
const filename = (0,
|
|
13345
|
+
const filename = (0, import_node_path103.basename)(relativePathFromCwd);
|
|
12948
13346
|
try {
|
|
12949
13347
|
const rule = await RulesyncRule.fromFile({
|
|
12950
13348
|
relativeFilePath: filename,
|
|
12951
13349
|
validate: true
|
|
12952
13350
|
});
|
|
12953
13351
|
return {
|
|
12954
|
-
relativePathFromCwd: (0,
|
|
13352
|
+
relativePathFromCwd: (0, import_node_path103.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12955
13353
|
frontmatter: rule.getFrontmatter(),
|
|
12956
13354
|
body: rule.getBody()
|
|
12957
13355
|
};
|
|
@@ -12970,7 +13368,7 @@ async function putRule({
|
|
|
12970
13368
|
relativePath: relativePathFromCwd,
|
|
12971
13369
|
intendedRootDir: process.cwd()
|
|
12972
13370
|
});
|
|
12973
|
-
const filename = (0,
|
|
13371
|
+
const filename = (0, import_node_path103.basename)(relativePathFromCwd);
|
|
12974
13372
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12975
13373
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
12976
13374
|
throw new Error(
|
|
@@ -12980,7 +13378,7 @@ async function putRule({
|
|
|
12980
13378
|
try {
|
|
12981
13379
|
const existingRules = await listRules();
|
|
12982
13380
|
const isUpdate = existingRules.some(
|
|
12983
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
13381
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path103.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12984
13382
|
);
|
|
12985
13383
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
12986
13384
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -12993,11 +13391,11 @@ async function putRule({
|
|
|
12993
13391
|
body,
|
|
12994
13392
|
validate: true
|
|
12995
13393
|
});
|
|
12996
|
-
const rulesDir = (0,
|
|
13394
|
+
const rulesDir = (0, import_node_path103.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12997
13395
|
await ensureDir(rulesDir);
|
|
12998
13396
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
12999
13397
|
return {
|
|
13000
|
-
relativePathFromCwd: (0,
|
|
13398
|
+
relativePathFromCwd: (0, import_node_path103.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
13001
13399
|
frontmatter: rule.getFrontmatter(),
|
|
13002
13400
|
body: rule.getBody()
|
|
13003
13401
|
};
|
|
@@ -13012,12 +13410,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
13012
13410
|
relativePath: relativePathFromCwd,
|
|
13013
13411
|
intendedRootDir: process.cwd()
|
|
13014
13412
|
});
|
|
13015
|
-
const filename = (0,
|
|
13016
|
-
const fullPath = (0,
|
|
13413
|
+
const filename = (0, import_node_path103.basename)(relativePathFromCwd);
|
|
13414
|
+
const fullPath = (0, import_node_path103.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
13017
13415
|
try {
|
|
13018
13416
|
await removeFile(fullPath);
|
|
13019
13417
|
return {
|
|
13020
|
-
relativePathFromCwd: (0,
|
|
13418
|
+
relativePathFromCwd: (0, import_node_path103.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
13021
13419
|
};
|
|
13022
13420
|
} catch (error) {
|
|
13023
13421
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -13026,23 +13424,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
13026
13424
|
}
|
|
13027
13425
|
}
|
|
13028
13426
|
var ruleToolSchemas = {
|
|
13029
|
-
listRules:
|
|
13030
|
-
getRule:
|
|
13031
|
-
relativePathFromCwd:
|
|
13427
|
+
listRules: import_mini48.z.object({}),
|
|
13428
|
+
getRule: import_mini48.z.object({
|
|
13429
|
+
relativePathFromCwd: import_mini48.z.string()
|
|
13032
13430
|
}),
|
|
13033
|
-
putRule:
|
|
13034
|
-
relativePathFromCwd:
|
|
13431
|
+
putRule: import_mini48.z.object({
|
|
13432
|
+
relativePathFromCwd: import_mini48.z.string(),
|
|
13035
13433
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
13036
|
-
body:
|
|
13434
|
+
body: import_mini48.z.string()
|
|
13037
13435
|
}),
|
|
13038
|
-
deleteRule:
|
|
13039
|
-
relativePathFromCwd:
|
|
13436
|
+
deleteRule: import_mini48.z.object({
|
|
13437
|
+
relativePathFromCwd: import_mini48.z.string()
|
|
13040
13438
|
})
|
|
13041
13439
|
};
|
|
13042
13440
|
var ruleTools = {
|
|
13043
13441
|
listRules: {
|
|
13044
13442
|
name: "listRules",
|
|
13045
|
-
description: `List all rules from ${(0,
|
|
13443
|
+
description: `List all rules from ${(0, import_node_path103.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13046
13444
|
parameters: ruleToolSchemas.listRules,
|
|
13047
13445
|
execute: async () => {
|
|
13048
13446
|
const rules = await listRules();
|
|
@@ -13084,8 +13482,8 @@ var ruleTools = {
|
|
|
13084
13482
|
};
|
|
13085
13483
|
|
|
13086
13484
|
// src/mcp/skills.ts
|
|
13087
|
-
var
|
|
13088
|
-
var
|
|
13485
|
+
var import_node_path104 = require("path");
|
|
13486
|
+
var import_mini49 = require("zod/mini");
|
|
13089
13487
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
13090
13488
|
var maxSkillsCount = 1e3;
|
|
13091
13489
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -13101,19 +13499,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
13101
13499
|
};
|
|
13102
13500
|
}
|
|
13103
13501
|
function extractDirName(relativeDirPathFromCwd) {
|
|
13104
|
-
const dirName = (0,
|
|
13502
|
+
const dirName = (0, import_node_path104.basename)(relativeDirPathFromCwd);
|
|
13105
13503
|
if (!dirName) {
|
|
13106
13504
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
13107
13505
|
}
|
|
13108
13506
|
return dirName;
|
|
13109
13507
|
}
|
|
13110
13508
|
async function listSkills() {
|
|
13111
|
-
const skillsDir = (0,
|
|
13509
|
+
const skillsDir = (0, import_node_path104.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
13112
13510
|
try {
|
|
13113
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
13511
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path104.join)(skillsDir, "*"), { type: "dir" });
|
|
13114
13512
|
const skills = await Promise.all(
|
|
13115
13513
|
skillDirPaths.map(async (dirPath) => {
|
|
13116
|
-
const dirName = (0,
|
|
13514
|
+
const dirName = (0, import_node_path104.basename)(dirPath);
|
|
13117
13515
|
if (!dirName) return null;
|
|
13118
13516
|
try {
|
|
13119
13517
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -13121,7 +13519,7 @@ async function listSkills() {
|
|
|
13121
13519
|
});
|
|
13122
13520
|
const frontmatter = skill.getFrontmatter();
|
|
13123
13521
|
return {
|
|
13124
|
-
relativeDirPathFromCwd: (0,
|
|
13522
|
+
relativeDirPathFromCwd: (0, import_node_path104.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13125
13523
|
frontmatter
|
|
13126
13524
|
};
|
|
13127
13525
|
} catch (error) {
|
|
@@ -13147,7 +13545,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
13147
13545
|
dirName
|
|
13148
13546
|
});
|
|
13149
13547
|
return {
|
|
13150
|
-
relativeDirPathFromCwd: (0,
|
|
13548
|
+
relativeDirPathFromCwd: (0, import_node_path104.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13151
13549
|
frontmatter: skill.getFrontmatter(),
|
|
13152
13550
|
body: skill.getBody(),
|
|
13153
13551
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13181,7 +13579,7 @@ async function putSkill({
|
|
|
13181
13579
|
try {
|
|
13182
13580
|
const existingSkills = await listSkills();
|
|
13183
13581
|
const isUpdate = existingSkills.some(
|
|
13184
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
13582
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path104.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13185
13583
|
);
|
|
13186
13584
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
13187
13585
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -13196,9 +13594,9 @@ async function putSkill({
|
|
|
13196
13594
|
otherFiles: aiDirFiles,
|
|
13197
13595
|
validate: true
|
|
13198
13596
|
});
|
|
13199
|
-
const skillDirPath = (0,
|
|
13597
|
+
const skillDirPath = (0, import_node_path104.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13200
13598
|
await ensureDir(skillDirPath);
|
|
13201
|
-
const skillFilePath = (0,
|
|
13599
|
+
const skillFilePath = (0, import_node_path104.join)(skillDirPath, SKILL_FILE_NAME);
|
|
13202
13600
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
13203
13601
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
13204
13602
|
for (const file of otherFiles) {
|
|
@@ -13206,15 +13604,15 @@ async function putSkill({
|
|
|
13206
13604
|
relativePath: file.name,
|
|
13207
13605
|
intendedRootDir: skillDirPath
|
|
13208
13606
|
});
|
|
13209
|
-
const filePath = (0,
|
|
13210
|
-
const fileDir = (0,
|
|
13607
|
+
const filePath = (0, import_node_path104.join)(skillDirPath, file.name);
|
|
13608
|
+
const fileDir = (0, import_node_path104.join)(skillDirPath, (0, import_node_path104.dirname)(file.name));
|
|
13211
13609
|
if (fileDir !== skillDirPath) {
|
|
13212
13610
|
await ensureDir(fileDir);
|
|
13213
13611
|
}
|
|
13214
13612
|
await writeFileContent(filePath, file.body);
|
|
13215
13613
|
}
|
|
13216
13614
|
return {
|
|
13217
|
-
relativeDirPathFromCwd: (0,
|
|
13615
|
+
relativeDirPathFromCwd: (0, import_node_path104.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13218
13616
|
frontmatter: skill.getFrontmatter(),
|
|
13219
13617
|
body: skill.getBody(),
|
|
13220
13618
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13236,13 +13634,13 @@ async function deleteSkill({
|
|
|
13236
13634
|
intendedRootDir: process.cwd()
|
|
13237
13635
|
});
|
|
13238
13636
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
13239
|
-
const skillDirPath = (0,
|
|
13637
|
+
const skillDirPath = (0, import_node_path104.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13240
13638
|
try {
|
|
13241
13639
|
if (await directoryExists(skillDirPath)) {
|
|
13242
13640
|
await removeDirectory(skillDirPath);
|
|
13243
13641
|
}
|
|
13244
13642
|
return {
|
|
13245
|
-
relativeDirPathFromCwd: (0,
|
|
13643
|
+
relativeDirPathFromCwd: (0, import_node_path104.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13246
13644
|
};
|
|
13247
13645
|
} catch (error) {
|
|
13248
13646
|
throw new Error(
|
|
@@ -13253,29 +13651,29 @@ async function deleteSkill({
|
|
|
13253
13651
|
);
|
|
13254
13652
|
}
|
|
13255
13653
|
}
|
|
13256
|
-
var McpSkillFileSchema =
|
|
13257
|
-
name:
|
|
13258
|
-
body:
|
|
13654
|
+
var McpSkillFileSchema = import_mini49.z.object({
|
|
13655
|
+
name: import_mini49.z.string(),
|
|
13656
|
+
body: import_mini49.z.string()
|
|
13259
13657
|
});
|
|
13260
13658
|
var skillToolSchemas = {
|
|
13261
|
-
listSkills:
|
|
13262
|
-
getSkill:
|
|
13263
|
-
relativeDirPathFromCwd:
|
|
13659
|
+
listSkills: import_mini49.z.object({}),
|
|
13660
|
+
getSkill: import_mini49.z.object({
|
|
13661
|
+
relativeDirPathFromCwd: import_mini49.z.string()
|
|
13264
13662
|
}),
|
|
13265
|
-
putSkill:
|
|
13266
|
-
relativeDirPathFromCwd:
|
|
13663
|
+
putSkill: import_mini49.z.object({
|
|
13664
|
+
relativeDirPathFromCwd: import_mini49.z.string(),
|
|
13267
13665
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
13268
|
-
body:
|
|
13269
|
-
otherFiles:
|
|
13666
|
+
body: import_mini49.z.string(),
|
|
13667
|
+
otherFiles: import_mini49.z.optional(import_mini49.z.array(McpSkillFileSchema))
|
|
13270
13668
|
}),
|
|
13271
|
-
deleteSkill:
|
|
13272
|
-
relativeDirPathFromCwd:
|
|
13669
|
+
deleteSkill: import_mini49.z.object({
|
|
13670
|
+
relativeDirPathFromCwd: import_mini49.z.string()
|
|
13273
13671
|
})
|
|
13274
13672
|
};
|
|
13275
13673
|
var skillTools = {
|
|
13276
13674
|
listSkills: {
|
|
13277
13675
|
name: "listSkills",
|
|
13278
|
-
description: `List all skills from ${(0,
|
|
13676
|
+
description: `List all skills from ${(0, import_node_path104.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
13279
13677
|
parameters: skillToolSchemas.listSkills,
|
|
13280
13678
|
execute: async () => {
|
|
13281
13679
|
const skills = await listSkills();
|
|
@@ -13318,12 +13716,12 @@ var skillTools = {
|
|
|
13318
13716
|
};
|
|
13319
13717
|
|
|
13320
13718
|
// src/mcp/subagents.ts
|
|
13321
|
-
var
|
|
13322
|
-
var
|
|
13719
|
+
var import_node_path105 = require("path");
|
|
13720
|
+
var import_mini50 = require("zod/mini");
|
|
13323
13721
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
13324
13722
|
var maxSubagentsCount = 1e3;
|
|
13325
13723
|
async function listSubagents() {
|
|
13326
|
-
const subagentsDir = (0,
|
|
13724
|
+
const subagentsDir = (0, import_node_path105.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13327
13725
|
try {
|
|
13328
13726
|
const files = await listDirectoryFiles(subagentsDir);
|
|
13329
13727
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13336,7 +13734,7 @@ async function listSubagents() {
|
|
|
13336
13734
|
});
|
|
13337
13735
|
const frontmatter = subagent.getFrontmatter();
|
|
13338
13736
|
return {
|
|
13339
|
-
relativePathFromCwd: (0,
|
|
13737
|
+
relativePathFromCwd: (0, import_node_path105.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
13340
13738
|
frontmatter
|
|
13341
13739
|
};
|
|
13342
13740
|
} catch (error) {
|
|
@@ -13358,14 +13756,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
13358
13756
|
relativePath: relativePathFromCwd,
|
|
13359
13757
|
intendedRootDir: process.cwd()
|
|
13360
13758
|
});
|
|
13361
|
-
const filename = (0,
|
|
13759
|
+
const filename = (0, import_node_path105.basename)(relativePathFromCwd);
|
|
13362
13760
|
try {
|
|
13363
13761
|
const subagent = await RulesyncSubagent.fromFile({
|
|
13364
13762
|
relativeFilePath: filename,
|
|
13365
13763
|
validate: true
|
|
13366
13764
|
});
|
|
13367
13765
|
return {
|
|
13368
|
-
relativePathFromCwd: (0,
|
|
13766
|
+
relativePathFromCwd: (0, import_node_path105.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13369
13767
|
frontmatter: subagent.getFrontmatter(),
|
|
13370
13768
|
body: subagent.getBody()
|
|
13371
13769
|
};
|
|
@@ -13384,7 +13782,7 @@ async function putSubagent({
|
|
|
13384
13782
|
relativePath: relativePathFromCwd,
|
|
13385
13783
|
intendedRootDir: process.cwd()
|
|
13386
13784
|
});
|
|
13387
|
-
const filename = (0,
|
|
13785
|
+
const filename = (0, import_node_path105.basename)(relativePathFromCwd);
|
|
13388
13786
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
13389
13787
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
13390
13788
|
throw new Error(
|
|
@@ -13394,7 +13792,7 @@ async function putSubagent({
|
|
|
13394
13792
|
try {
|
|
13395
13793
|
const existingSubagents = await listSubagents();
|
|
13396
13794
|
const isUpdate = existingSubagents.some(
|
|
13397
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
13795
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path105.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13398
13796
|
);
|
|
13399
13797
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
13400
13798
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -13407,11 +13805,11 @@ async function putSubagent({
|
|
|
13407
13805
|
body,
|
|
13408
13806
|
validate: true
|
|
13409
13807
|
});
|
|
13410
|
-
const subagentsDir = (0,
|
|
13808
|
+
const subagentsDir = (0, import_node_path105.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13411
13809
|
await ensureDir(subagentsDir);
|
|
13412
13810
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
13413
13811
|
return {
|
|
13414
|
-
relativePathFromCwd: (0,
|
|
13812
|
+
relativePathFromCwd: (0, import_node_path105.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13415
13813
|
frontmatter: subagent.getFrontmatter(),
|
|
13416
13814
|
body: subagent.getBody()
|
|
13417
13815
|
};
|
|
@@ -13426,12 +13824,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
13426
13824
|
relativePath: relativePathFromCwd,
|
|
13427
13825
|
intendedRootDir: process.cwd()
|
|
13428
13826
|
});
|
|
13429
|
-
const filename = (0,
|
|
13430
|
-
const fullPath = (0,
|
|
13827
|
+
const filename = (0, import_node_path105.basename)(relativePathFromCwd);
|
|
13828
|
+
const fullPath = (0, import_node_path105.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
13431
13829
|
try {
|
|
13432
13830
|
await removeFile(fullPath);
|
|
13433
13831
|
return {
|
|
13434
|
-
relativePathFromCwd: (0,
|
|
13832
|
+
relativePathFromCwd: (0, import_node_path105.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13435
13833
|
};
|
|
13436
13834
|
} catch (error) {
|
|
13437
13835
|
throw new Error(
|
|
@@ -13443,23 +13841,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
13443
13841
|
}
|
|
13444
13842
|
}
|
|
13445
13843
|
var subagentToolSchemas = {
|
|
13446
|
-
listSubagents:
|
|
13447
|
-
getSubagent:
|
|
13448
|
-
relativePathFromCwd:
|
|
13844
|
+
listSubagents: import_mini50.z.object({}),
|
|
13845
|
+
getSubagent: import_mini50.z.object({
|
|
13846
|
+
relativePathFromCwd: import_mini50.z.string()
|
|
13449
13847
|
}),
|
|
13450
|
-
putSubagent:
|
|
13451
|
-
relativePathFromCwd:
|
|
13848
|
+
putSubagent: import_mini50.z.object({
|
|
13849
|
+
relativePathFromCwd: import_mini50.z.string(),
|
|
13452
13850
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
13453
|
-
body:
|
|
13851
|
+
body: import_mini50.z.string()
|
|
13454
13852
|
}),
|
|
13455
|
-
deleteSubagent:
|
|
13456
|
-
relativePathFromCwd:
|
|
13853
|
+
deleteSubagent: import_mini50.z.object({
|
|
13854
|
+
relativePathFromCwd: import_mini50.z.string()
|
|
13457
13855
|
})
|
|
13458
13856
|
};
|
|
13459
13857
|
var subagentTools = {
|
|
13460
13858
|
listSubagents: {
|
|
13461
13859
|
name: "listSubagents",
|
|
13462
|
-
description: `List all subagents from ${(0,
|
|
13860
|
+
description: `List all subagents from ${(0, import_node_path105.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13463
13861
|
parameters: subagentToolSchemas.listSubagents,
|
|
13464
13862
|
execute: async () => {
|
|
13465
13863
|
const subagents = await listSubagents();
|
|
@@ -13501,20 +13899,20 @@ var subagentTools = {
|
|
|
13501
13899
|
};
|
|
13502
13900
|
|
|
13503
13901
|
// src/mcp/tools.ts
|
|
13504
|
-
var rulesyncFeatureSchema =
|
|
13505
|
-
var rulesyncOperationSchema =
|
|
13506
|
-
var skillFileSchema =
|
|
13507
|
-
name:
|
|
13508
|
-
body:
|
|
13902
|
+
var rulesyncFeatureSchema = import_mini51.z.enum(["rule", "command", "subagent", "skill", "ignore", "mcp"]);
|
|
13903
|
+
var rulesyncOperationSchema = import_mini51.z.enum(["list", "get", "put", "delete"]);
|
|
13904
|
+
var skillFileSchema = import_mini51.z.object({
|
|
13905
|
+
name: import_mini51.z.string(),
|
|
13906
|
+
body: import_mini51.z.string()
|
|
13509
13907
|
});
|
|
13510
|
-
var rulesyncToolSchema =
|
|
13908
|
+
var rulesyncToolSchema = import_mini51.z.object({
|
|
13511
13909
|
feature: rulesyncFeatureSchema,
|
|
13512
13910
|
operation: rulesyncOperationSchema,
|
|
13513
|
-
targetPathFromCwd:
|
|
13514
|
-
frontmatter:
|
|
13515
|
-
body:
|
|
13516
|
-
otherFiles:
|
|
13517
|
-
content:
|
|
13911
|
+
targetPathFromCwd: import_mini51.z.optional(import_mini51.z.string()),
|
|
13912
|
+
frontmatter: import_mini51.z.optional(import_mini51.z.unknown()),
|
|
13913
|
+
body: import_mini51.z.optional(import_mini51.z.string()),
|
|
13914
|
+
otherFiles: import_mini51.z.optional(import_mini51.z.array(skillFileSchema)),
|
|
13915
|
+
content: import_mini51.z.optional(import_mini51.z.string())
|
|
13518
13916
|
});
|
|
13519
13917
|
var supportedOperationsByFeature = {
|
|
13520
13918
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -13710,7 +14108,7 @@ async function mcpCommand({ version }) {
|
|
|
13710
14108
|
}
|
|
13711
14109
|
|
|
13712
14110
|
// src/cli/index.ts
|
|
13713
|
-
var getVersion = () => "5.
|
|
14111
|
+
var getVersion = () => "5.8.0";
|
|
13714
14112
|
var main = async () => {
|
|
13715
14113
|
const program = new import_commander.Command();
|
|
13716
14114
|
const version = getVersion();
|
|
@@ -13734,12 +14132,13 @@ var main = async () => {
|
|
|
13734
14132
|
(value) => {
|
|
13735
14133
|
return value.split(",").map((f) => f.trim());
|
|
13736
14134
|
}
|
|
13737
|
-
).option("-V, --verbose", "Verbose output").option("-g, --global", "Import for global(user scope) configuration files").action(async (options) => {
|
|
14135
|
+
).option("-V, --verbose", "Verbose output").option("-s, --silent", "Suppress all output").option("-g, --global", "Import for global(user scope) configuration files").action(async (options) => {
|
|
13738
14136
|
try {
|
|
13739
14137
|
await importCommand({
|
|
13740
14138
|
targets: options.targets,
|
|
13741
14139
|
features: options.features,
|
|
13742
14140
|
verbose: options.verbose,
|
|
14141
|
+
silent: options.silent,
|
|
13743
14142
|
configPath: options.config,
|
|
13744
14143
|
global: options.global
|
|
13745
14144
|
});
|
|
@@ -13771,7 +14170,7 @@ var main = async () => {
|
|
|
13771
14170
|
).option("--delete", "Delete all existing files in output directories before generating").option(
|
|
13772
14171
|
"-b, --base-dir <paths>",
|
|
13773
14172
|
"Base directories to generate files (comma-separated for multiple paths)"
|
|
13774
|
-
).option("-V, --verbose", "Verbose output").option("-c, --config <path>", "Path to configuration file").option("-g, --global", "Generate for global(user scope) configuration files").option(
|
|
14173
|
+
).option("-V, --verbose", "Verbose output").option("-s, --silent", "Suppress all output").option("-c, --config <path>", "Path to configuration file").option("-g, --global", "Generate for global(user scope) configuration files").option(
|
|
13775
14174
|
"--simulate-commands",
|
|
13776
14175
|
"Generate simulated commands. This feature is only available for copilot, cursor and codexcli."
|
|
13777
14176
|
).option(
|
|
@@ -13789,6 +14188,7 @@ var main = async () => {
|
|
|
13789
14188
|
targets: options.targets,
|
|
13790
14189
|
features: options.features,
|
|
13791
14190
|
verbose: options.verbose,
|
|
14191
|
+
silent: options.silent,
|
|
13792
14192
|
delete: options.delete,
|
|
13793
14193
|
baseDirs: options.baseDirs,
|
|
13794
14194
|
configPath: options.config,
|