rulesync 5.7.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 +4 -1
- package/dist/index.cjs +658 -437
- package/dist/index.js +630 -409
- 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);
|
|
@@ -8172,23 +8384,23 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8172
8384
|
};
|
|
8173
8385
|
|
|
8174
8386
|
// src/features/subagents/kiro-subagent.ts
|
|
8175
|
-
var
|
|
8176
|
-
var
|
|
8177
|
-
var KiroCliSubagentJsonSchema =
|
|
8178
|
-
name:
|
|
8179
|
-
description:
|
|
8180
|
-
prompt:
|
|
8181
|
-
tools:
|
|
8182
|
-
toolAliases:
|
|
8183
|
-
toolSettings:
|
|
8184
|
-
toolSchema:
|
|
8185
|
-
hooks:
|
|
8186
|
-
model:
|
|
8187
|
-
mcpServers:
|
|
8188
|
-
useLegacyMcpJson:
|
|
8189
|
-
resources:
|
|
8190
|
-
allowedTools:
|
|
8191
|
-
includeMcpJson:
|
|
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()))
|
|
8192
8404
|
});
|
|
8193
8405
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
8194
8406
|
body;
|
|
@@ -8200,7 +8412,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8200
8412
|
}
|
|
8201
8413
|
static getSettablePaths(_options = {}) {
|
|
8202
8414
|
return {
|
|
8203
|
-
relativeDirPath: (0,
|
|
8415
|
+
relativeDirPath: (0, import_node_path72.join)(".kiro", "agents")
|
|
8204
8416
|
};
|
|
8205
8417
|
}
|
|
8206
8418
|
getBody() {
|
|
@@ -8280,7 +8492,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8280
8492
|
global = false
|
|
8281
8493
|
}) {
|
|
8282
8494
|
const paths = this.getSettablePaths({ global });
|
|
8283
|
-
const filePath = (0,
|
|
8495
|
+
const filePath = (0, import_node_path72.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8284
8496
|
const fileContent = await readFileContent(filePath);
|
|
8285
8497
|
return new _KiroSubagent({
|
|
8286
8498
|
baseDir,
|
|
@@ -8309,12 +8521,12 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8309
8521
|
};
|
|
8310
8522
|
|
|
8311
8523
|
// src/features/subagents/opencode-subagent.ts
|
|
8312
|
-
var
|
|
8313
|
-
var
|
|
8314
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
8315
|
-
description:
|
|
8316
|
-
mode:
|
|
8317
|
-
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())
|
|
8318
8530
|
});
|
|
8319
8531
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
8320
8532
|
frontmatter;
|
|
@@ -8324,7 +8536,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8324
8536
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8325
8537
|
if (!result.success) {
|
|
8326
8538
|
throw new Error(
|
|
8327
|
-
`Invalid frontmatter in ${(0,
|
|
8539
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8328
8540
|
);
|
|
8329
8541
|
}
|
|
8330
8542
|
}
|
|
@@ -8338,7 +8550,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8338
8550
|
global = false
|
|
8339
8551
|
} = {}) {
|
|
8340
8552
|
return {
|
|
8341
|
-
relativeDirPath: global ? (0,
|
|
8553
|
+
relativeDirPath: global ? (0, import_node_path73.join)(".config", "opencode", "agent") : (0, import_node_path73.join)(".opencode", "agent")
|
|
8342
8554
|
};
|
|
8343
8555
|
}
|
|
8344
8556
|
getFrontmatter() {
|
|
@@ -8351,7 +8563,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8351
8563
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
8352
8564
|
const rulesyncFrontmatter = {
|
|
8353
8565
|
targets: ["*"],
|
|
8354
|
-
name: name ?? (0,
|
|
8566
|
+
name: name ?? (0, import_node_path73.basename)(this.getRelativeFilePath(), ".md"),
|
|
8355
8567
|
description,
|
|
8356
8568
|
opencode: { mode, ...opencodeSection }
|
|
8357
8569
|
};
|
|
@@ -8404,7 +8616,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8404
8616
|
return {
|
|
8405
8617
|
success: false,
|
|
8406
8618
|
error: new Error(
|
|
8407
|
-
`Invalid frontmatter in ${(0,
|
|
8619
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8408
8620
|
)
|
|
8409
8621
|
};
|
|
8410
8622
|
}
|
|
@@ -8421,7 +8633,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8421
8633
|
global = false
|
|
8422
8634
|
}) {
|
|
8423
8635
|
const paths = this.getSettablePaths({ global });
|
|
8424
|
-
const filePath = (0,
|
|
8636
|
+
const filePath = (0, import_node_path73.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8425
8637
|
const fileContent = await readFileContent(filePath);
|
|
8426
8638
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8427
8639
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8469,7 +8681,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
8469
8681
|
"opencode",
|
|
8470
8682
|
"roo"
|
|
8471
8683
|
];
|
|
8472
|
-
var SubagentsProcessorToolTargetSchema =
|
|
8684
|
+
var SubagentsProcessorToolTargetSchema = import_mini37.z.enum(subagentsProcessorToolTargetTuple);
|
|
8473
8685
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
8474
8686
|
[
|
|
8475
8687
|
"agentsmd",
|
|
@@ -8623,7 +8835,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8623
8835
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
8624
8836
|
*/
|
|
8625
8837
|
async loadRulesyncFiles() {
|
|
8626
|
-
const subagentsDir = (0,
|
|
8838
|
+
const subagentsDir = (0, import_node_path74.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
8627
8839
|
const dirExists = await directoryExists(subagentsDir);
|
|
8628
8840
|
if (!dirExists) {
|
|
8629
8841
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -8638,7 +8850,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8638
8850
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
8639
8851
|
const rulesyncSubagents = [];
|
|
8640
8852
|
for (const mdFile of mdFiles) {
|
|
8641
|
-
const filepath = (0,
|
|
8853
|
+
const filepath = (0, import_node_path74.join)(subagentsDir, mdFile);
|
|
8642
8854
|
try {
|
|
8643
8855
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
8644
8856
|
relativeFilePath: mdFile,
|
|
@@ -8668,14 +8880,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8668
8880
|
const factory = this.getFactory(this.toolTarget);
|
|
8669
8881
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
8670
8882
|
const subagentFilePaths = await findFilesByGlobs(
|
|
8671
|
-
(0,
|
|
8883
|
+
(0, import_node_path74.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
8672
8884
|
);
|
|
8673
8885
|
if (forDeletion) {
|
|
8674
8886
|
const toolSubagents2 = subagentFilePaths.map(
|
|
8675
8887
|
(path3) => factory.class.forDeletion({
|
|
8676
8888
|
baseDir: this.baseDir,
|
|
8677
8889
|
relativeDirPath: paths.relativeDirPath,
|
|
8678
|
-
relativeFilePath: (0,
|
|
8890
|
+
relativeFilePath: (0, import_node_path74.basename)(path3),
|
|
8679
8891
|
global: this.global
|
|
8680
8892
|
})
|
|
8681
8893
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -8686,7 +8898,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8686
8898
|
subagentFilePaths.map(
|
|
8687
8899
|
(path3) => factory.class.fromFile({
|
|
8688
8900
|
baseDir: this.baseDir,
|
|
8689
|
-
relativeFilePath: (0,
|
|
8901
|
+
relativeFilePath: (0, import_node_path74.basename)(path3),
|
|
8690
8902
|
global: this.global
|
|
8691
8903
|
})
|
|
8692
8904
|
)
|
|
@@ -8718,48 +8930,48 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8718
8930
|
};
|
|
8719
8931
|
|
|
8720
8932
|
// src/features/rules/agentsmd-rule.ts
|
|
8721
|
-
var
|
|
8933
|
+
var import_node_path77 = require("path");
|
|
8722
8934
|
|
|
8723
8935
|
// src/features/rules/tool-rule.ts
|
|
8724
|
-
var
|
|
8936
|
+
var import_node_path76 = require("path");
|
|
8725
8937
|
|
|
8726
8938
|
// src/features/rules/rulesync-rule.ts
|
|
8727
|
-
var
|
|
8728
|
-
var
|
|
8729
|
-
var RulesyncRuleFrontmatterSchema =
|
|
8730
|
-
root:
|
|
8731
|
-
targets:
|
|
8732
|
-
description:
|
|
8733
|
-
globs:
|
|
8734
|
-
agentsmd:
|
|
8735
|
-
|
|
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({
|
|
8736
8948
|
// @example "path/to/subproject"
|
|
8737
|
-
subprojectPath:
|
|
8949
|
+
subprojectPath: import_mini38.z.optional(import_mini38.z.string())
|
|
8738
8950
|
})
|
|
8739
8951
|
),
|
|
8740
|
-
claudecode:
|
|
8741
|
-
|
|
8952
|
+
claudecode: import_mini38.z.optional(
|
|
8953
|
+
import_mini38.z.object({
|
|
8742
8954
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
8743
8955
|
// @example "src/**/*.ts, tests/**/*.test.ts"
|
|
8744
|
-
paths:
|
|
8956
|
+
paths: import_mini38.z.optional(import_mini38.z.string())
|
|
8745
8957
|
})
|
|
8746
8958
|
),
|
|
8747
|
-
cursor:
|
|
8748
|
-
|
|
8749
|
-
alwaysApply:
|
|
8750
|
-
description:
|
|
8751
|
-
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()))
|
|
8752
8964
|
})
|
|
8753
8965
|
),
|
|
8754
|
-
copilot:
|
|
8755
|
-
|
|
8756
|
-
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")]))
|
|
8757
8969
|
})
|
|
8758
8970
|
),
|
|
8759
|
-
antigravity:
|
|
8760
|
-
|
|
8761
|
-
trigger:
|
|
8762
|
-
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()))
|
|
8763
8975
|
})
|
|
8764
8976
|
)
|
|
8765
8977
|
});
|
|
@@ -8771,7 +8983,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8771
8983
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8772
8984
|
if (!result.success) {
|
|
8773
8985
|
throw new Error(
|
|
8774
|
-
`Invalid frontmatter in ${(0,
|
|
8986
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8775
8987
|
);
|
|
8776
8988
|
}
|
|
8777
8989
|
}
|
|
@@ -8806,7 +9018,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8806
9018
|
return {
|
|
8807
9019
|
success: false,
|
|
8808
9020
|
error: new Error(
|
|
8809
|
-
`Invalid frontmatter in ${(0,
|
|
9021
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8810
9022
|
)
|
|
8811
9023
|
};
|
|
8812
9024
|
}
|
|
@@ -8815,12 +9027,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8815
9027
|
relativeFilePath,
|
|
8816
9028
|
validate = true
|
|
8817
9029
|
}) {
|
|
8818
|
-
const legacyPath = (0,
|
|
9030
|
+
const legacyPath = (0, import_node_path75.join)(
|
|
8819
9031
|
process.cwd(),
|
|
8820
9032
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
8821
9033
|
relativeFilePath
|
|
8822
9034
|
);
|
|
8823
|
-
const recommendedPath = (0,
|
|
9035
|
+
const recommendedPath = (0, import_node_path75.join)(
|
|
8824
9036
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8825
9037
|
relativeFilePath
|
|
8826
9038
|
);
|
|
@@ -8841,7 +9053,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8841
9053
|
agentsmd: result.data.agentsmd,
|
|
8842
9054
|
cursor: result.data.cursor
|
|
8843
9055
|
};
|
|
8844
|
-
const filename = (0,
|
|
9056
|
+
const filename = (0, import_node_path75.basename)(legacyPath);
|
|
8845
9057
|
return new _RulesyncRule({
|
|
8846
9058
|
baseDir: process.cwd(),
|
|
8847
9059
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8855,7 +9067,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8855
9067
|
relativeFilePath,
|
|
8856
9068
|
validate = true
|
|
8857
9069
|
}) {
|
|
8858
|
-
const filePath = (0,
|
|
9070
|
+
const filePath = (0, import_node_path75.join)(
|
|
8859
9071
|
process.cwd(),
|
|
8860
9072
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8861
9073
|
relativeFilePath
|
|
@@ -8874,7 +9086,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8874
9086
|
agentsmd: result.data.agentsmd,
|
|
8875
9087
|
cursor: result.data.cursor
|
|
8876
9088
|
};
|
|
8877
|
-
const filename = (0,
|
|
9089
|
+
const filename = (0, import_node_path75.basename)(filePath);
|
|
8878
9090
|
return new _RulesyncRule({
|
|
8879
9091
|
baseDir: process.cwd(),
|
|
8880
9092
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8957,7 +9169,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8957
9169
|
rulesyncRule,
|
|
8958
9170
|
validate = true,
|
|
8959
9171
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
8960
|
-
nonRootPath = { relativeDirPath: (0,
|
|
9172
|
+
nonRootPath = { relativeDirPath: (0, import_node_path76.join)(".agents", "memories") }
|
|
8961
9173
|
}) {
|
|
8962
9174
|
const params = this.buildToolRuleParamsDefault({
|
|
8963
9175
|
baseDir,
|
|
@@ -8968,7 +9180,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8968
9180
|
});
|
|
8969
9181
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
8970
9182
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
8971
|
-
params.relativeDirPath = (0,
|
|
9183
|
+
params.relativeDirPath = (0, import_node_path76.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
8972
9184
|
params.relativeFilePath = "AGENTS.md";
|
|
8973
9185
|
}
|
|
8974
9186
|
return params;
|
|
@@ -9033,7 +9245,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9033
9245
|
relativeFilePath: "AGENTS.md"
|
|
9034
9246
|
},
|
|
9035
9247
|
nonRoot: {
|
|
9036
|
-
relativeDirPath: (0,
|
|
9248
|
+
relativeDirPath: (0, import_node_path77.join)(".agents", "memories")
|
|
9037
9249
|
}
|
|
9038
9250
|
};
|
|
9039
9251
|
}
|
|
@@ -9043,8 +9255,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9043
9255
|
validate = true
|
|
9044
9256
|
}) {
|
|
9045
9257
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
9046
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
9047
|
-
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));
|
|
9048
9260
|
return new _AgentsMdRule({
|
|
9049
9261
|
baseDir,
|
|
9050
9262
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9099,21 +9311,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9099
9311
|
};
|
|
9100
9312
|
|
|
9101
9313
|
// src/features/rules/antigravity-rule.ts
|
|
9102
|
-
var
|
|
9103
|
-
var
|
|
9104
|
-
var AntigravityRuleFrontmatterSchema =
|
|
9105
|
-
trigger:
|
|
9106
|
-
|
|
9107
|
-
|
|
9108
|
-
|
|
9109
|
-
|
|
9110
|
-
|
|
9111
|
-
|
|
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()
|
|
9112
9324
|
// accepts any string for forward compatibility
|
|
9113
9325
|
])
|
|
9114
9326
|
),
|
|
9115
|
-
globs:
|
|
9116
|
-
description:
|
|
9327
|
+
globs: import_mini39.z.optional(import_mini39.z.string()),
|
|
9328
|
+
description: import_mini39.z.optional(import_mini39.z.string())
|
|
9117
9329
|
});
|
|
9118
9330
|
function parseGlobsString(globs) {
|
|
9119
9331
|
if (!globs) {
|
|
@@ -9258,7 +9470,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9258
9470
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9259
9471
|
if (!result.success) {
|
|
9260
9472
|
throw new Error(
|
|
9261
|
-
`Invalid frontmatter in ${(0,
|
|
9473
|
+
`Invalid frontmatter in ${(0, import_node_path78.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9262
9474
|
);
|
|
9263
9475
|
}
|
|
9264
9476
|
}
|
|
@@ -9273,7 +9485,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9273
9485
|
static getSettablePaths() {
|
|
9274
9486
|
return {
|
|
9275
9487
|
nonRoot: {
|
|
9276
|
-
relativeDirPath: (0,
|
|
9488
|
+
relativeDirPath: (0, import_node_path78.join)(".agent", "rules")
|
|
9277
9489
|
}
|
|
9278
9490
|
};
|
|
9279
9491
|
}
|
|
@@ -9282,7 +9494,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9282
9494
|
relativeFilePath,
|
|
9283
9495
|
validate = true
|
|
9284
9496
|
}) {
|
|
9285
|
-
const filePath = (0,
|
|
9497
|
+
const filePath = (0, import_node_path78.join)(
|
|
9286
9498
|
baseDir,
|
|
9287
9499
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
9288
9500
|
relativeFilePath
|
|
@@ -9423,7 +9635,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9423
9635
|
};
|
|
9424
9636
|
|
|
9425
9637
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
9426
|
-
var
|
|
9638
|
+
var import_node_path79 = require("path");
|
|
9427
9639
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
9428
9640
|
toRulesyncRule() {
|
|
9429
9641
|
const rulesyncFrontmatter = {
|
|
@@ -9449,7 +9661,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9449
9661
|
relativeFilePath: ".augment-guidelines"
|
|
9450
9662
|
},
|
|
9451
9663
|
nonRoot: {
|
|
9452
|
-
relativeDirPath: (0,
|
|
9664
|
+
relativeDirPath: (0, import_node_path79.join)(".augment", "rules")
|
|
9453
9665
|
}
|
|
9454
9666
|
};
|
|
9455
9667
|
}
|
|
@@ -9484,8 +9696,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9484
9696
|
}) {
|
|
9485
9697
|
const settablePaths = this.getSettablePaths();
|
|
9486
9698
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
9487
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
9488
|
-
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));
|
|
9489
9701
|
return new _AugmentcodeLegacyRule({
|
|
9490
9702
|
baseDir,
|
|
9491
9703
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -9514,7 +9726,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9514
9726
|
};
|
|
9515
9727
|
|
|
9516
9728
|
// src/features/rules/augmentcode-rule.ts
|
|
9517
|
-
var
|
|
9729
|
+
var import_node_path80 = require("path");
|
|
9518
9730
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
9519
9731
|
toRulesyncRule() {
|
|
9520
9732
|
return this.toRulesyncRuleDefault();
|
|
@@ -9522,7 +9734,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9522
9734
|
static getSettablePaths() {
|
|
9523
9735
|
return {
|
|
9524
9736
|
nonRoot: {
|
|
9525
|
-
relativeDirPath: (0,
|
|
9737
|
+
relativeDirPath: (0, import_node_path80.join)(".augment", "rules")
|
|
9526
9738
|
}
|
|
9527
9739
|
};
|
|
9528
9740
|
}
|
|
@@ -9546,7 +9758,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9546
9758
|
validate = true
|
|
9547
9759
|
}) {
|
|
9548
9760
|
const fileContent = await readFileContent(
|
|
9549
|
-
(0,
|
|
9761
|
+
(0, import_node_path80.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9550
9762
|
);
|
|
9551
9763
|
const { body: content } = parseFrontmatter(fileContent);
|
|
9552
9764
|
return new _AugmentcodeRule({
|
|
@@ -9582,7 +9794,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9582
9794
|
};
|
|
9583
9795
|
|
|
9584
9796
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
9585
|
-
var
|
|
9797
|
+
var import_node_path81 = require("path");
|
|
9586
9798
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
9587
9799
|
static getSettablePaths({
|
|
9588
9800
|
global
|
|
@@ -9601,7 +9813,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9601
9813
|
relativeFilePath: "CLAUDE.md"
|
|
9602
9814
|
},
|
|
9603
9815
|
nonRoot: {
|
|
9604
|
-
relativeDirPath: (0,
|
|
9816
|
+
relativeDirPath: (0, import_node_path81.join)(".claude", "memories")
|
|
9605
9817
|
}
|
|
9606
9818
|
};
|
|
9607
9819
|
}
|
|
@@ -9616,7 +9828,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9616
9828
|
if (isRoot) {
|
|
9617
9829
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9618
9830
|
const fileContent2 = await readFileContent(
|
|
9619
|
-
(0,
|
|
9831
|
+
(0, import_node_path81.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9620
9832
|
);
|
|
9621
9833
|
return new _ClaudecodeLegacyRule({
|
|
9622
9834
|
baseDir,
|
|
@@ -9630,8 +9842,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9630
9842
|
if (!paths.nonRoot) {
|
|
9631
9843
|
throw new Error("nonRoot path is not set");
|
|
9632
9844
|
}
|
|
9633
|
-
const relativePath = (0,
|
|
9634
|
-
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));
|
|
9635
9847
|
return new _ClaudecodeLegacyRule({
|
|
9636
9848
|
baseDir,
|
|
9637
9849
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9690,10 +9902,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9690
9902
|
};
|
|
9691
9903
|
|
|
9692
9904
|
// src/features/rules/claudecode-rule.ts
|
|
9693
|
-
var
|
|
9694
|
-
var
|
|
9695
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
9696
|
-
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())
|
|
9697
9909
|
});
|
|
9698
9910
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
9699
9911
|
frontmatter;
|
|
@@ -9715,7 +9927,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9715
9927
|
relativeFilePath: "CLAUDE.md"
|
|
9716
9928
|
},
|
|
9717
9929
|
nonRoot: {
|
|
9718
|
-
relativeDirPath: (0,
|
|
9930
|
+
relativeDirPath: (0, import_node_path82.join)(".claude", "rules")
|
|
9719
9931
|
}
|
|
9720
9932
|
};
|
|
9721
9933
|
}
|
|
@@ -9724,7 +9936,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9724
9936
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9725
9937
|
if (!result.success) {
|
|
9726
9938
|
throw new Error(
|
|
9727
|
-
`Invalid frontmatter in ${(0,
|
|
9939
|
+
`Invalid frontmatter in ${(0, import_node_path82.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9728
9940
|
);
|
|
9729
9941
|
}
|
|
9730
9942
|
}
|
|
@@ -9752,7 +9964,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9752
9964
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
9753
9965
|
if (isRoot) {
|
|
9754
9966
|
const fileContent2 = await readFileContent(
|
|
9755
|
-
(0,
|
|
9967
|
+
(0, import_node_path82.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
9756
9968
|
);
|
|
9757
9969
|
return new _ClaudecodeRule({
|
|
9758
9970
|
baseDir,
|
|
@@ -9767,13 +9979,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9767
9979
|
if (!paths.nonRoot) {
|
|
9768
9980
|
throw new Error("nonRoot path is not set");
|
|
9769
9981
|
}
|
|
9770
|
-
const relativePath = (0,
|
|
9771
|
-
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));
|
|
9772
9984
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9773
9985
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9774
9986
|
if (!result.success) {
|
|
9775
9987
|
throw new Error(
|
|
9776
|
-
`Invalid frontmatter in ${(0,
|
|
9988
|
+
`Invalid frontmatter in ${(0, import_node_path82.join)(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
9777
9989
|
);
|
|
9778
9990
|
}
|
|
9779
9991
|
return new _ClaudecodeRule({
|
|
@@ -9880,7 +10092,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9880
10092
|
return {
|
|
9881
10093
|
success: false,
|
|
9882
10094
|
error: new Error(
|
|
9883
|
-
`Invalid frontmatter in ${(0,
|
|
10095
|
+
`Invalid frontmatter in ${(0, import_node_path82.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9884
10096
|
)
|
|
9885
10097
|
};
|
|
9886
10098
|
}
|
|
@@ -9900,10 +10112,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9900
10112
|
};
|
|
9901
10113
|
|
|
9902
10114
|
// src/features/rules/cline-rule.ts
|
|
9903
|
-
var
|
|
9904
|
-
var
|
|
9905
|
-
var ClineRuleFrontmatterSchema =
|
|
9906
|
-
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()
|
|
9907
10119
|
});
|
|
9908
10120
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
9909
10121
|
static getSettablePaths() {
|
|
@@ -9945,7 +10157,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9945
10157
|
validate = true
|
|
9946
10158
|
}) {
|
|
9947
10159
|
const fileContent = await readFileContent(
|
|
9948
|
-
(0,
|
|
10160
|
+
(0, import_node_path83.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9949
10161
|
);
|
|
9950
10162
|
return new _ClineRule({
|
|
9951
10163
|
baseDir,
|
|
@@ -9971,7 +10183,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9971
10183
|
};
|
|
9972
10184
|
|
|
9973
10185
|
// src/features/rules/codexcli-rule.ts
|
|
9974
|
-
var
|
|
10186
|
+
var import_node_path84 = require("path");
|
|
9975
10187
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
9976
10188
|
static getSettablePaths({
|
|
9977
10189
|
global
|
|
@@ -9990,7 +10202,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9990
10202
|
relativeFilePath: "AGENTS.md"
|
|
9991
10203
|
},
|
|
9992
10204
|
nonRoot: {
|
|
9993
|
-
relativeDirPath: (0,
|
|
10205
|
+
relativeDirPath: (0, import_node_path84.join)(".codex", "memories")
|
|
9994
10206
|
}
|
|
9995
10207
|
};
|
|
9996
10208
|
}
|
|
@@ -10005,7 +10217,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10005
10217
|
if (isRoot) {
|
|
10006
10218
|
const relativePath2 = paths.root.relativeFilePath;
|
|
10007
10219
|
const fileContent2 = await readFileContent(
|
|
10008
|
-
(0,
|
|
10220
|
+
(0, import_node_path84.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
10009
10221
|
);
|
|
10010
10222
|
return new _CodexcliRule({
|
|
10011
10223
|
baseDir,
|
|
@@ -10019,8 +10231,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10019
10231
|
if (!paths.nonRoot) {
|
|
10020
10232
|
throw new Error("nonRoot path is not set");
|
|
10021
10233
|
}
|
|
10022
|
-
const relativePath = (0,
|
|
10023
|
-
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));
|
|
10024
10236
|
return new _CodexcliRule({
|
|
10025
10237
|
baseDir,
|
|
10026
10238
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10079,12 +10291,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10079
10291
|
};
|
|
10080
10292
|
|
|
10081
10293
|
// src/features/rules/copilot-rule.ts
|
|
10082
|
-
var
|
|
10083
|
-
var
|
|
10084
|
-
var CopilotRuleFrontmatterSchema =
|
|
10085
|
-
description:
|
|
10086
|
-
applyTo:
|
|
10087
|
-
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")]))
|
|
10088
10300
|
});
|
|
10089
10301
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
10090
10302
|
frontmatter;
|
|
@@ -10096,7 +10308,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10096
10308
|
relativeFilePath: "copilot-instructions.md"
|
|
10097
10309
|
},
|
|
10098
10310
|
nonRoot: {
|
|
10099
|
-
relativeDirPath: (0,
|
|
10311
|
+
relativeDirPath: (0, import_node_path85.join)(".github", "instructions")
|
|
10100
10312
|
}
|
|
10101
10313
|
};
|
|
10102
10314
|
}
|
|
@@ -10105,7 +10317,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10105
10317
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10106
10318
|
if (!result.success) {
|
|
10107
10319
|
throw new Error(
|
|
10108
|
-
`Invalid frontmatter in ${(0,
|
|
10320
|
+
`Invalid frontmatter in ${(0, import_node_path85.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10109
10321
|
);
|
|
10110
10322
|
}
|
|
10111
10323
|
}
|
|
@@ -10187,11 +10399,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10187
10399
|
validate = true
|
|
10188
10400
|
}) {
|
|
10189
10401
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
10190
|
-
const relativePath = isRoot ? (0,
|
|
10402
|
+
const relativePath = isRoot ? (0, import_node_path85.join)(
|
|
10191
10403
|
this.getSettablePaths().root.relativeDirPath,
|
|
10192
10404
|
this.getSettablePaths().root.relativeFilePath
|
|
10193
|
-
) : (0,
|
|
10194
|
-
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));
|
|
10195
10407
|
if (isRoot) {
|
|
10196
10408
|
return new _CopilotRule({
|
|
10197
10409
|
baseDir,
|
|
@@ -10207,7 +10419,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10207
10419
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10208
10420
|
if (!result.success) {
|
|
10209
10421
|
throw new Error(
|
|
10210
|
-
`Invalid frontmatter in ${(0,
|
|
10422
|
+
`Invalid frontmatter in ${(0, import_node_path85.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10211
10423
|
);
|
|
10212
10424
|
}
|
|
10213
10425
|
return new _CopilotRule({
|
|
@@ -10247,7 +10459,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10247
10459
|
return {
|
|
10248
10460
|
success: false,
|
|
10249
10461
|
error: new Error(
|
|
10250
|
-
`Invalid frontmatter in ${(0,
|
|
10462
|
+
`Invalid frontmatter in ${(0, import_node_path85.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10251
10463
|
)
|
|
10252
10464
|
};
|
|
10253
10465
|
}
|
|
@@ -10267,12 +10479,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10267
10479
|
};
|
|
10268
10480
|
|
|
10269
10481
|
// src/features/rules/cursor-rule.ts
|
|
10270
|
-
var
|
|
10271
|
-
var
|
|
10272
|
-
var CursorRuleFrontmatterSchema =
|
|
10273
|
-
description:
|
|
10274
|
-
globs:
|
|
10275
|
-
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())
|
|
10276
10488
|
});
|
|
10277
10489
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
10278
10490
|
frontmatter;
|
|
@@ -10280,7 +10492,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10280
10492
|
static getSettablePaths() {
|
|
10281
10493
|
return {
|
|
10282
10494
|
nonRoot: {
|
|
10283
|
-
relativeDirPath: (0,
|
|
10495
|
+
relativeDirPath: (0, import_node_path86.join)(".cursor", "rules")
|
|
10284
10496
|
}
|
|
10285
10497
|
};
|
|
10286
10498
|
}
|
|
@@ -10289,7 +10501,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10289
10501
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10290
10502
|
if (!result.success) {
|
|
10291
10503
|
throw new Error(
|
|
10292
|
-
`Invalid frontmatter in ${(0,
|
|
10504
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10293
10505
|
);
|
|
10294
10506
|
}
|
|
10295
10507
|
}
|
|
@@ -10406,19 +10618,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10406
10618
|
validate = true
|
|
10407
10619
|
}) {
|
|
10408
10620
|
const fileContent = await readFileContent(
|
|
10409
|
-
(0,
|
|
10621
|
+
(0, import_node_path86.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10410
10622
|
);
|
|
10411
10623
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
10412
10624
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10413
10625
|
if (!result.success) {
|
|
10414
10626
|
throw new Error(
|
|
10415
|
-
`Invalid frontmatter in ${(0,
|
|
10627
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10416
10628
|
);
|
|
10417
10629
|
}
|
|
10418
10630
|
return new _CursorRule({
|
|
10419
10631
|
baseDir,
|
|
10420
10632
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
10421
|
-
relativeFilePath: (0,
|
|
10633
|
+
relativeFilePath: (0, import_node_path86.basename)(relativeFilePath),
|
|
10422
10634
|
frontmatter: result.data,
|
|
10423
10635
|
body: content.trim(),
|
|
10424
10636
|
validate
|
|
@@ -10449,7 +10661,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10449
10661
|
return {
|
|
10450
10662
|
success: false,
|
|
10451
10663
|
error: new Error(
|
|
10452
|
-
`Invalid frontmatter in ${(0,
|
|
10664
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10453
10665
|
)
|
|
10454
10666
|
};
|
|
10455
10667
|
}
|
|
@@ -10469,7 +10681,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10469
10681
|
};
|
|
10470
10682
|
|
|
10471
10683
|
// src/features/rules/geminicli-rule.ts
|
|
10472
|
-
var
|
|
10684
|
+
var import_node_path87 = require("path");
|
|
10473
10685
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
10474
10686
|
static getSettablePaths({
|
|
10475
10687
|
global
|
|
@@ -10488,7 +10700,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10488
10700
|
relativeFilePath: "GEMINI.md"
|
|
10489
10701
|
},
|
|
10490
10702
|
nonRoot: {
|
|
10491
|
-
relativeDirPath: (0,
|
|
10703
|
+
relativeDirPath: (0, import_node_path87.join)(".gemini", "memories")
|
|
10492
10704
|
}
|
|
10493
10705
|
};
|
|
10494
10706
|
}
|
|
@@ -10503,7 +10715,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10503
10715
|
if (isRoot) {
|
|
10504
10716
|
const relativePath2 = paths.root.relativeFilePath;
|
|
10505
10717
|
const fileContent2 = await readFileContent(
|
|
10506
|
-
(0,
|
|
10718
|
+
(0, import_node_path87.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
10507
10719
|
);
|
|
10508
10720
|
return new _GeminiCliRule({
|
|
10509
10721
|
baseDir,
|
|
@@ -10517,8 +10729,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10517
10729
|
if (!paths.nonRoot) {
|
|
10518
10730
|
throw new Error("nonRoot path is not set");
|
|
10519
10731
|
}
|
|
10520
|
-
const relativePath = (0,
|
|
10521
|
-
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));
|
|
10522
10734
|
return new _GeminiCliRule({
|
|
10523
10735
|
baseDir,
|
|
10524
10736
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10577,7 +10789,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10577
10789
|
};
|
|
10578
10790
|
|
|
10579
10791
|
// src/features/rules/junie-rule.ts
|
|
10580
|
-
var
|
|
10792
|
+
var import_node_path88 = require("path");
|
|
10581
10793
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
10582
10794
|
static getSettablePaths() {
|
|
10583
10795
|
return {
|
|
@@ -10586,7 +10798,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10586
10798
|
relativeFilePath: "guidelines.md"
|
|
10587
10799
|
},
|
|
10588
10800
|
nonRoot: {
|
|
10589
|
-
relativeDirPath: (0,
|
|
10801
|
+
relativeDirPath: (0, import_node_path88.join)(".junie", "memories")
|
|
10590
10802
|
}
|
|
10591
10803
|
};
|
|
10592
10804
|
}
|
|
@@ -10596,8 +10808,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10596
10808
|
validate = true
|
|
10597
10809
|
}) {
|
|
10598
10810
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
10599
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
10600
|
-
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));
|
|
10601
10813
|
return new _JunieRule({
|
|
10602
10814
|
baseDir,
|
|
10603
10815
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10652,12 +10864,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10652
10864
|
};
|
|
10653
10865
|
|
|
10654
10866
|
// src/features/rules/kilo-rule.ts
|
|
10655
|
-
var
|
|
10867
|
+
var import_node_path89 = require("path");
|
|
10656
10868
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
10657
10869
|
static getSettablePaths(_options = {}) {
|
|
10658
10870
|
return {
|
|
10659
10871
|
nonRoot: {
|
|
10660
|
-
relativeDirPath: (0,
|
|
10872
|
+
relativeDirPath: (0, import_node_path89.join)(".kilocode", "rules")
|
|
10661
10873
|
}
|
|
10662
10874
|
};
|
|
10663
10875
|
}
|
|
@@ -10667,7 +10879,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10667
10879
|
validate = true
|
|
10668
10880
|
}) {
|
|
10669
10881
|
const fileContent = await readFileContent(
|
|
10670
|
-
(0,
|
|
10882
|
+
(0, import_node_path89.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10671
10883
|
);
|
|
10672
10884
|
return new _KiloRule({
|
|
10673
10885
|
baseDir,
|
|
@@ -10719,12 +10931,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10719
10931
|
};
|
|
10720
10932
|
|
|
10721
10933
|
// src/features/rules/kiro-rule.ts
|
|
10722
|
-
var
|
|
10934
|
+
var import_node_path90 = require("path");
|
|
10723
10935
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
10724
10936
|
static getSettablePaths() {
|
|
10725
10937
|
return {
|
|
10726
10938
|
nonRoot: {
|
|
10727
|
-
relativeDirPath: (0,
|
|
10939
|
+
relativeDirPath: (0, import_node_path90.join)(".kiro", "steering")
|
|
10728
10940
|
}
|
|
10729
10941
|
};
|
|
10730
10942
|
}
|
|
@@ -10734,7 +10946,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10734
10946
|
validate = true
|
|
10735
10947
|
}) {
|
|
10736
10948
|
const fileContent = await readFileContent(
|
|
10737
|
-
(0,
|
|
10949
|
+
(0, import_node_path90.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10738
10950
|
);
|
|
10739
10951
|
return new _KiroRule({
|
|
10740
10952
|
baseDir,
|
|
@@ -10788,7 +11000,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10788
11000
|
};
|
|
10789
11001
|
|
|
10790
11002
|
// src/features/rules/opencode-rule.ts
|
|
10791
|
-
var
|
|
11003
|
+
var import_node_path91 = require("path");
|
|
10792
11004
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
10793
11005
|
static getSettablePaths() {
|
|
10794
11006
|
return {
|
|
@@ -10797,7 +11009,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10797
11009
|
relativeFilePath: "AGENTS.md"
|
|
10798
11010
|
},
|
|
10799
11011
|
nonRoot: {
|
|
10800
|
-
relativeDirPath: (0,
|
|
11012
|
+
relativeDirPath: (0, import_node_path91.join)(".opencode", "memories")
|
|
10801
11013
|
}
|
|
10802
11014
|
};
|
|
10803
11015
|
}
|
|
@@ -10807,8 +11019,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10807
11019
|
validate = true
|
|
10808
11020
|
}) {
|
|
10809
11021
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
10810
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
10811
|
-
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));
|
|
10812
11024
|
return new _OpenCodeRule({
|
|
10813
11025
|
baseDir,
|
|
10814
11026
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10863,7 +11075,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10863
11075
|
};
|
|
10864
11076
|
|
|
10865
11077
|
// src/features/rules/qwencode-rule.ts
|
|
10866
|
-
var
|
|
11078
|
+
var import_node_path92 = require("path");
|
|
10867
11079
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
10868
11080
|
static getSettablePaths() {
|
|
10869
11081
|
return {
|
|
@@ -10872,7 +11084,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10872
11084
|
relativeFilePath: "QWEN.md"
|
|
10873
11085
|
},
|
|
10874
11086
|
nonRoot: {
|
|
10875
|
-
relativeDirPath: (0,
|
|
11087
|
+
relativeDirPath: (0, import_node_path92.join)(".qwen", "memories")
|
|
10876
11088
|
}
|
|
10877
11089
|
};
|
|
10878
11090
|
}
|
|
@@ -10882,8 +11094,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10882
11094
|
validate = true
|
|
10883
11095
|
}) {
|
|
10884
11096
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
10885
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
10886
|
-
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));
|
|
10887
11099
|
return new _QwencodeRule({
|
|
10888
11100
|
baseDir,
|
|
10889
11101
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10935,7 +11147,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10935
11147
|
};
|
|
10936
11148
|
|
|
10937
11149
|
// src/features/rules/replit-rule.ts
|
|
10938
|
-
var
|
|
11150
|
+
var import_node_path93 = require("path");
|
|
10939
11151
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
10940
11152
|
static getSettablePaths() {
|
|
10941
11153
|
return {
|
|
@@ -10957,7 +11169,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
10957
11169
|
}
|
|
10958
11170
|
const relativePath = paths.root.relativeFilePath;
|
|
10959
11171
|
const fileContent = await readFileContent(
|
|
10960
|
-
(0,
|
|
11172
|
+
(0, import_node_path93.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
10961
11173
|
);
|
|
10962
11174
|
return new _ReplitRule({
|
|
10963
11175
|
baseDir,
|
|
@@ -11023,12 +11235,12 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
11023
11235
|
};
|
|
11024
11236
|
|
|
11025
11237
|
// src/features/rules/roo-rule.ts
|
|
11026
|
-
var
|
|
11238
|
+
var import_node_path94 = require("path");
|
|
11027
11239
|
var RooRule = class _RooRule extends ToolRule {
|
|
11028
11240
|
static getSettablePaths() {
|
|
11029
11241
|
return {
|
|
11030
11242
|
nonRoot: {
|
|
11031
|
-
relativeDirPath: (0,
|
|
11243
|
+
relativeDirPath: (0, import_node_path94.join)(".roo", "rules")
|
|
11032
11244
|
}
|
|
11033
11245
|
};
|
|
11034
11246
|
}
|
|
@@ -11038,7 +11250,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
11038
11250
|
validate = true
|
|
11039
11251
|
}) {
|
|
11040
11252
|
const fileContent = await readFileContent(
|
|
11041
|
-
(0,
|
|
11253
|
+
(0, import_node_path94.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11042
11254
|
);
|
|
11043
11255
|
return new _RooRule({
|
|
11044
11256
|
baseDir,
|
|
@@ -11107,7 +11319,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
11107
11319
|
};
|
|
11108
11320
|
|
|
11109
11321
|
// src/features/rules/warp-rule.ts
|
|
11110
|
-
var
|
|
11322
|
+
var import_node_path95 = require("path");
|
|
11111
11323
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
11112
11324
|
constructor({ fileContent, root, ...rest }) {
|
|
11113
11325
|
super({
|
|
@@ -11123,7 +11335,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11123
11335
|
relativeFilePath: "WARP.md"
|
|
11124
11336
|
},
|
|
11125
11337
|
nonRoot: {
|
|
11126
|
-
relativeDirPath: (0,
|
|
11338
|
+
relativeDirPath: (0, import_node_path95.join)(".warp", "memories")
|
|
11127
11339
|
}
|
|
11128
11340
|
};
|
|
11129
11341
|
}
|
|
@@ -11133,8 +11345,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11133
11345
|
validate = true
|
|
11134
11346
|
}) {
|
|
11135
11347
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
11136
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
11137
|
-
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));
|
|
11138
11350
|
return new _WarpRule({
|
|
11139
11351
|
baseDir,
|
|
11140
11352
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -11189,12 +11401,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11189
11401
|
};
|
|
11190
11402
|
|
|
11191
11403
|
// src/features/rules/windsurf-rule.ts
|
|
11192
|
-
var
|
|
11404
|
+
var import_node_path96 = require("path");
|
|
11193
11405
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
11194
11406
|
static getSettablePaths() {
|
|
11195
11407
|
return {
|
|
11196
11408
|
nonRoot: {
|
|
11197
|
-
relativeDirPath: (0,
|
|
11409
|
+
relativeDirPath: (0, import_node_path96.join)(".windsurf", "rules")
|
|
11198
11410
|
}
|
|
11199
11411
|
};
|
|
11200
11412
|
}
|
|
@@ -11204,7 +11416,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
11204
11416
|
validate = true
|
|
11205
11417
|
}) {
|
|
11206
11418
|
const fileContent = await readFileContent(
|
|
11207
|
-
(0,
|
|
11419
|
+
(0, import_node_path96.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11208
11420
|
);
|
|
11209
11421
|
return new _WindsurfRule({
|
|
11210
11422
|
baseDir,
|
|
@@ -11278,7 +11490,7 @@ var rulesProcessorToolTargets = [
|
|
|
11278
11490
|
"warp",
|
|
11279
11491
|
"windsurf"
|
|
11280
11492
|
];
|
|
11281
|
-
var RulesProcessorToolTargetSchema =
|
|
11493
|
+
var RulesProcessorToolTargetSchema = import_mini44.z.enum(rulesProcessorToolTargets);
|
|
11282
11494
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
11283
11495
|
[
|
|
11284
11496
|
"agentsmd",
|
|
@@ -11569,7 +11781,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11569
11781
|
}).relativeDirPath;
|
|
11570
11782
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
11571
11783
|
const frontmatter = skill.getFrontmatter();
|
|
11572
|
-
const relativePath = (0,
|
|
11784
|
+
const relativePath = (0, import_node_path97.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
11573
11785
|
return {
|
|
11574
11786
|
name: frontmatter.name,
|
|
11575
11787
|
description: frontmatter.description,
|
|
@@ -11636,10 +11848,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11636
11848
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
11637
11849
|
*/
|
|
11638
11850
|
async loadRulesyncFiles() {
|
|
11639
|
-
const files = await findFilesByGlobs((0,
|
|
11851
|
+
const files = await findFilesByGlobs((0, import_node_path97.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
11640
11852
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
11641
11853
|
const rulesyncRules = await Promise.all(
|
|
11642
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0,
|
|
11854
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path97.basename)(file) }))
|
|
11643
11855
|
);
|
|
11644
11856
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
11645
11857
|
if (rootRules.length > 1) {
|
|
@@ -11657,10 +11869,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11657
11869
|
return rulesyncRules;
|
|
11658
11870
|
}
|
|
11659
11871
|
async loadRulesyncFilesLegacy() {
|
|
11660
|
-
const legacyFiles = await findFilesByGlobs((0,
|
|
11872
|
+
const legacyFiles = await findFilesByGlobs((0, import_node_path97.join)(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
11661
11873
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
11662
11874
|
return Promise.all(
|
|
11663
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0,
|
|
11875
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path97.basename)(file) }))
|
|
11664
11876
|
);
|
|
11665
11877
|
}
|
|
11666
11878
|
/**
|
|
@@ -11678,7 +11890,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11678
11890
|
return [];
|
|
11679
11891
|
}
|
|
11680
11892
|
const rootFilePaths = await findFilesByGlobs(
|
|
11681
|
-
(0,
|
|
11893
|
+
(0, import_node_path97.join)(
|
|
11682
11894
|
this.baseDir,
|
|
11683
11895
|
settablePaths.root.relativeDirPath ?? ".",
|
|
11684
11896
|
settablePaths.root.relativeFilePath
|
|
@@ -11689,7 +11901,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11689
11901
|
(filePath) => factory.class.forDeletion({
|
|
11690
11902
|
baseDir: this.baseDir,
|
|
11691
11903
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
11692
|
-
relativeFilePath: (0,
|
|
11904
|
+
relativeFilePath: (0, import_node_path97.basename)(filePath),
|
|
11693
11905
|
global: this.global
|
|
11694
11906
|
})
|
|
11695
11907
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11698,7 +11910,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11698
11910
|
rootFilePaths.map(
|
|
11699
11911
|
(filePath) => factory.class.fromFile({
|
|
11700
11912
|
baseDir: this.baseDir,
|
|
11701
|
-
relativeFilePath: (0,
|
|
11913
|
+
relativeFilePath: (0, import_node_path97.basename)(filePath),
|
|
11702
11914
|
global: this.global
|
|
11703
11915
|
})
|
|
11704
11916
|
)
|
|
@@ -11710,14 +11922,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11710
11922
|
return [];
|
|
11711
11923
|
}
|
|
11712
11924
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
11713
|
-
(0,
|
|
11925
|
+
(0, import_node_path97.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
11714
11926
|
);
|
|
11715
11927
|
if (forDeletion) {
|
|
11716
11928
|
return nonRootFilePaths.map(
|
|
11717
11929
|
(filePath) => factory.class.forDeletion({
|
|
11718
11930
|
baseDir: this.baseDir,
|
|
11719
11931
|
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
11720
|
-
relativeFilePath: (0,
|
|
11932
|
+
relativeFilePath: (0, import_node_path97.basename)(filePath),
|
|
11721
11933
|
global: this.global
|
|
11722
11934
|
})
|
|
11723
11935
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11726,7 +11938,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11726
11938
|
nonRootFilePaths.map(
|
|
11727
11939
|
(filePath) => factory.class.fromFile({
|
|
11728
11940
|
baseDir: this.baseDir,
|
|
11729
|
-
relativeFilePath: (0,
|
|
11941
|
+
relativeFilePath: (0, import_node_path97.basename)(filePath),
|
|
11730
11942
|
global: this.global
|
|
11731
11943
|
})
|
|
11732
11944
|
)
|
|
@@ -11819,14 +12031,14 @@ s/<command> [arguments]
|
|
|
11819
12031
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
11820
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.
|
|
11821
12033
|
|
|
11822
|
-
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.` : "";
|
|
11823
12035
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
11824
12036
|
|
|
11825
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.
|
|
11826
12038
|
|
|
11827
|
-
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.
|
|
11828
12040
|
|
|
11829
|
-
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.` : "";
|
|
11830
12042
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
11831
12043
|
const result = [
|
|
11832
12044
|
overview,
|
|
@@ -11856,7 +12068,10 @@ ${toonContent}`;
|
|
|
11856
12068
|
// src/cli/commands/generate.ts
|
|
11857
12069
|
async function generateCommand(options) {
|
|
11858
12070
|
const config = await ConfigResolver.resolve(options);
|
|
11859
|
-
logger.
|
|
12071
|
+
logger.configure({
|
|
12072
|
+
verbose: config.getVerbose(),
|
|
12073
|
+
silent: config.getSilent()
|
|
12074
|
+
});
|
|
11860
12075
|
logger.info("Generating files...");
|
|
11861
12076
|
if (!await fileExists(RULESYNC_RELATIVE_DIR_PATH)) {
|
|
11862
12077
|
logger.error("\u274C .rulesync directory not found. Run 'rulesync init' first.");
|
|
@@ -12108,7 +12323,7 @@ async function generateSkills(config) {
|
|
|
12108
12323
|
}
|
|
12109
12324
|
|
|
12110
12325
|
// src/cli/commands/gitignore.ts
|
|
12111
|
-
var
|
|
12326
|
+
var import_node_path98 = require("path");
|
|
12112
12327
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
12113
12328
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
12114
12329
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -12172,6 +12387,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
12172
12387
|
// Kiro
|
|
12173
12388
|
"**/.kiro/steering/",
|
|
12174
12389
|
"**/.kiro/prompts/",
|
|
12390
|
+
"**/.kiro/skills/",
|
|
12175
12391
|
"**/.kiro/agents/",
|
|
12176
12392
|
"**/.kiro/settings/mcp.json",
|
|
12177
12393
|
"**/.aiignore",
|
|
@@ -12248,7 +12464,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
12248
12464
|
return result;
|
|
12249
12465
|
};
|
|
12250
12466
|
var gitignoreCommand = async () => {
|
|
12251
|
-
const gitignorePath = (0,
|
|
12467
|
+
const gitignorePath = (0, import_node_path98.join)(process.cwd(), ".gitignore");
|
|
12252
12468
|
let gitignoreContent = "";
|
|
12253
12469
|
if (await fileExists(gitignorePath)) {
|
|
12254
12470
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -12282,7 +12498,10 @@ async function importCommand(options) {
|
|
|
12282
12498
|
process.exit(1);
|
|
12283
12499
|
}
|
|
12284
12500
|
const config = await ConfigResolver.resolve(options);
|
|
12285
|
-
logger.
|
|
12501
|
+
logger.configure({
|
|
12502
|
+
verbose: config.getVerbose(),
|
|
12503
|
+
silent: config.getSilent()
|
|
12504
|
+
});
|
|
12286
12505
|
const tool = config.getTargets()[0];
|
|
12287
12506
|
await importRules(config, tool);
|
|
12288
12507
|
await importIgnore(config, tool);
|
|
@@ -12447,7 +12666,7 @@ async function importSkills(config, tool) {
|
|
|
12447
12666
|
}
|
|
12448
12667
|
|
|
12449
12668
|
// src/cli/commands/init.ts
|
|
12450
|
-
var
|
|
12669
|
+
var import_node_path99 = require("path");
|
|
12451
12670
|
async function initCommand() {
|
|
12452
12671
|
logger.info("Initializing rulesync...");
|
|
12453
12672
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -12625,14 +12844,14 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12625
12844
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
12626
12845
|
await ensureDir(skillPaths.relativeDirPath);
|
|
12627
12846
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
12628
|
-
const ruleFilepath = (0,
|
|
12847
|
+
const ruleFilepath = (0, import_node_path99.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
12629
12848
|
if (!await fileExists(ruleFilepath)) {
|
|
12630
12849
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
12631
12850
|
logger.success(`Created ${ruleFilepath}`);
|
|
12632
12851
|
} else {
|
|
12633
12852
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
12634
12853
|
}
|
|
12635
|
-
const mcpFilepath = (0,
|
|
12854
|
+
const mcpFilepath = (0, import_node_path99.join)(
|
|
12636
12855
|
mcpPaths.recommended.relativeDirPath,
|
|
12637
12856
|
mcpPaths.recommended.relativeFilePath
|
|
12638
12857
|
);
|
|
@@ -12642,30 +12861,30 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12642
12861
|
} else {
|
|
12643
12862
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
12644
12863
|
}
|
|
12645
|
-
const commandFilepath = (0,
|
|
12864
|
+
const commandFilepath = (0, import_node_path99.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
12646
12865
|
if (!await fileExists(commandFilepath)) {
|
|
12647
12866
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
12648
12867
|
logger.success(`Created ${commandFilepath}`);
|
|
12649
12868
|
} else {
|
|
12650
12869
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
12651
12870
|
}
|
|
12652
|
-
const subagentFilepath = (0,
|
|
12871
|
+
const subagentFilepath = (0, import_node_path99.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
12653
12872
|
if (!await fileExists(subagentFilepath)) {
|
|
12654
12873
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
12655
12874
|
logger.success(`Created ${subagentFilepath}`);
|
|
12656
12875
|
} else {
|
|
12657
12876
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
12658
12877
|
}
|
|
12659
|
-
const skillDirPath = (0,
|
|
12878
|
+
const skillDirPath = (0, import_node_path99.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
12660
12879
|
await ensureDir(skillDirPath);
|
|
12661
|
-
const skillFilepath = (0,
|
|
12880
|
+
const skillFilepath = (0, import_node_path99.join)(skillDirPath, SKILL_FILE_NAME);
|
|
12662
12881
|
if (!await fileExists(skillFilepath)) {
|
|
12663
12882
|
await writeFileContent(skillFilepath, sampleSkillFile.content);
|
|
12664
12883
|
logger.success(`Created ${skillFilepath}`);
|
|
12665
12884
|
} else {
|
|
12666
12885
|
logger.info(`Skipped ${skillFilepath} (already exists)`);
|
|
12667
12886
|
}
|
|
12668
|
-
const ignoreFilepath = (0,
|
|
12887
|
+
const ignoreFilepath = (0, import_node_path99.join)(
|
|
12669
12888
|
ignorePaths.recommended.relativeDirPath,
|
|
12670
12889
|
ignorePaths.recommended.relativeFilePath
|
|
12671
12890
|
);
|
|
@@ -12681,15 +12900,15 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12681
12900
|
var import_fastmcp = require("fastmcp");
|
|
12682
12901
|
|
|
12683
12902
|
// src/mcp/tools.ts
|
|
12684
|
-
var
|
|
12903
|
+
var import_mini51 = require("zod/mini");
|
|
12685
12904
|
|
|
12686
12905
|
// src/mcp/commands.ts
|
|
12687
|
-
var
|
|
12688
|
-
var
|
|
12906
|
+
var import_node_path100 = require("path");
|
|
12907
|
+
var import_mini45 = require("zod/mini");
|
|
12689
12908
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
12690
12909
|
var maxCommandsCount = 1e3;
|
|
12691
12910
|
async function listCommands() {
|
|
12692
|
-
const commandsDir = (0,
|
|
12911
|
+
const commandsDir = (0, import_node_path100.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12693
12912
|
try {
|
|
12694
12913
|
const files = await listDirectoryFiles(commandsDir);
|
|
12695
12914
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12701,7 +12920,7 @@ async function listCommands() {
|
|
|
12701
12920
|
});
|
|
12702
12921
|
const frontmatter = command.getFrontmatter();
|
|
12703
12922
|
return {
|
|
12704
|
-
relativePathFromCwd: (0,
|
|
12923
|
+
relativePathFromCwd: (0, import_node_path100.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
12705
12924
|
frontmatter
|
|
12706
12925
|
};
|
|
12707
12926
|
} catch (error) {
|
|
@@ -12721,13 +12940,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
12721
12940
|
relativePath: relativePathFromCwd,
|
|
12722
12941
|
intendedRootDir: process.cwd()
|
|
12723
12942
|
});
|
|
12724
|
-
const filename = (0,
|
|
12943
|
+
const filename = (0, import_node_path100.basename)(relativePathFromCwd);
|
|
12725
12944
|
try {
|
|
12726
12945
|
const command = await RulesyncCommand.fromFile({
|
|
12727
12946
|
relativeFilePath: filename
|
|
12728
12947
|
});
|
|
12729
12948
|
return {
|
|
12730
|
-
relativePathFromCwd: (0,
|
|
12949
|
+
relativePathFromCwd: (0, import_node_path100.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12731
12950
|
frontmatter: command.getFrontmatter(),
|
|
12732
12951
|
body: command.getBody()
|
|
12733
12952
|
};
|
|
@@ -12746,7 +12965,7 @@ async function putCommand({
|
|
|
12746
12965
|
relativePath: relativePathFromCwd,
|
|
12747
12966
|
intendedRootDir: process.cwd()
|
|
12748
12967
|
});
|
|
12749
|
-
const filename = (0,
|
|
12968
|
+
const filename = (0, import_node_path100.basename)(relativePathFromCwd);
|
|
12750
12969
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12751
12970
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
12752
12971
|
throw new Error(
|
|
@@ -12756,7 +12975,7 @@ async function putCommand({
|
|
|
12756
12975
|
try {
|
|
12757
12976
|
const existingCommands = await listCommands();
|
|
12758
12977
|
const isUpdate = existingCommands.some(
|
|
12759
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
12978
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path100.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12760
12979
|
);
|
|
12761
12980
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
12762
12981
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -12771,11 +12990,11 @@ async function putCommand({
|
|
|
12771
12990
|
fileContent,
|
|
12772
12991
|
validate: true
|
|
12773
12992
|
});
|
|
12774
|
-
const commandsDir = (0,
|
|
12993
|
+
const commandsDir = (0, import_node_path100.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12775
12994
|
await ensureDir(commandsDir);
|
|
12776
12995
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
12777
12996
|
return {
|
|
12778
|
-
relativePathFromCwd: (0,
|
|
12997
|
+
relativePathFromCwd: (0, import_node_path100.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12779
12998
|
frontmatter: command.getFrontmatter(),
|
|
12780
12999
|
body: command.getBody()
|
|
12781
13000
|
};
|
|
@@ -12790,12 +13009,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12790
13009
|
relativePath: relativePathFromCwd,
|
|
12791
13010
|
intendedRootDir: process.cwd()
|
|
12792
13011
|
});
|
|
12793
|
-
const filename = (0,
|
|
12794
|
-
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);
|
|
12795
13014
|
try {
|
|
12796
13015
|
await removeFile(fullPath);
|
|
12797
13016
|
return {
|
|
12798
|
-
relativePathFromCwd: (0,
|
|
13017
|
+
relativePathFromCwd: (0, import_node_path100.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12799
13018
|
};
|
|
12800
13019
|
} catch (error) {
|
|
12801
13020
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12804,23 +13023,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12804
13023
|
}
|
|
12805
13024
|
}
|
|
12806
13025
|
var commandToolSchemas = {
|
|
12807
|
-
listCommands:
|
|
12808
|
-
getCommand:
|
|
12809
|
-
relativePathFromCwd:
|
|
13026
|
+
listCommands: import_mini45.z.object({}),
|
|
13027
|
+
getCommand: import_mini45.z.object({
|
|
13028
|
+
relativePathFromCwd: import_mini45.z.string()
|
|
12810
13029
|
}),
|
|
12811
|
-
putCommand:
|
|
12812
|
-
relativePathFromCwd:
|
|
13030
|
+
putCommand: import_mini45.z.object({
|
|
13031
|
+
relativePathFromCwd: import_mini45.z.string(),
|
|
12813
13032
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
12814
|
-
body:
|
|
13033
|
+
body: import_mini45.z.string()
|
|
12815
13034
|
}),
|
|
12816
|
-
deleteCommand:
|
|
12817
|
-
relativePathFromCwd:
|
|
13035
|
+
deleteCommand: import_mini45.z.object({
|
|
13036
|
+
relativePathFromCwd: import_mini45.z.string()
|
|
12818
13037
|
})
|
|
12819
13038
|
};
|
|
12820
13039
|
var commandTools = {
|
|
12821
13040
|
listCommands: {
|
|
12822
13041
|
name: "listCommands",
|
|
12823
|
-
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.`,
|
|
12824
13043
|
parameters: commandToolSchemas.listCommands,
|
|
12825
13044
|
execute: async () => {
|
|
12826
13045
|
const commands = await listCommands();
|
|
@@ -12862,11 +13081,11 @@ var commandTools = {
|
|
|
12862
13081
|
};
|
|
12863
13082
|
|
|
12864
13083
|
// src/mcp/ignore.ts
|
|
12865
|
-
var
|
|
12866
|
-
var
|
|
13084
|
+
var import_node_path101 = require("path");
|
|
13085
|
+
var import_mini46 = require("zod/mini");
|
|
12867
13086
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
12868
13087
|
async function getIgnoreFile() {
|
|
12869
|
-
const ignoreFilePath = (0,
|
|
13088
|
+
const ignoreFilePath = (0, import_node_path101.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12870
13089
|
try {
|
|
12871
13090
|
const content = await readFileContent(ignoreFilePath);
|
|
12872
13091
|
return {
|
|
@@ -12880,7 +13099,7 @@ async function getIgnoreFile() {
|
|
|
12880
13099
|
}
|
|
12881
13100
|
}
|
|
12882
13101
|
async function putIgnoreFile({ content }) {
|
|
12883
|
-
const ignoreFilePath = (0,
|
|
13102
|
+
const ignoreFilePath = (0, import_node_path101.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12884
13103
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
12885
13104
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
12886
13105
|
throw new Error(
|
|
@@ -12901,8 +13120,8 @@ async function putIgnoreFile({ content }) {
|
|
|
12901
13120
|
}
|
|
12902
13121
|
}
|
|
12903
13122
|
async function deleteIgnoreFile() {
|
|
12904
|
-
const aiignorePath = (0,
|
|
12905
|
-
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);
|
|
12906
13125
|
try {
|
|
12907
13126
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
12908
13127
|
return {
|
|
@@ -12920,11 +13139,11 @@ async function deleteIgnoreFile() {
|
|
|
12920
13139
|
}
|
|
12921
13140
|
}
|
|
12922
13141
|
var ignoreToolSchemas = {
|
|
12923
|
-
getIgnoreFile:
|
|
12924
|
-
putIgnoreFile:
|
|
12925
|
-
content:
|
|
13142
|
+
getIgnoreFile: import_mini46.z.object({}),
|
|
13143
|
+
putIgnoreFile: import_mini46.z.object({
|
|
13144
|
+
content: import_mini46.z.string()
|
|
12926
13145
|
}),
|
|
12927
|
-
deleteIgnoreFile:
|
|
13146
|
+
deleteIgnoreFile: import_mini46.z.object({})
|
|
12928
13147
|
};
|
|
12929
13148
|
var ignoreTools = {
|
|
12930
13149
|
getIgnoreFile: {
|
|
@@ -12957,8 +13176,8 @@ var ignoreTools = {
|
|
|
12957
13176
|
};
|
|
12958
13177
|
|
|
12959
13178
|
// src/mcp/mcp.ts
|
|
12960
|
-
var
|
|
12961
|
-
var
|
|
13179
|
+
var import_node_path102 = require("path");
|
|
13180
|
+
var import_mini47 = require("zod/mini");
|
|
12962
13181
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
12963
13182
|
async function getMcpFile() {
|
|
12964
13183
|
const config = await ConfigResolver.resolve({});
|
|
@@ -12967,7 +13186,7 @@ async function getMcpFile() {
|
|
|
12967
13186
|
validate: true,
|
|
12968
13187
|
modularMcp: config.getModularMcp()
|
|
12969
13188
|
});
|
|
12970
|
-
const relativePathFromCwd = (0,
|
|
13189
|
+
const relativePathFromCwd = (0, import_node_path102.join)(
|
|
12971
13190
|
rulesyncMcp.getRelativeDirPath(),
|
|
12972
13191
|
rulesyncMcp.getRelativeFilePath()
|
|
12973
13192
|
);
|
|
@@ -13000,7 +13219,7 @@ async function putMcpFile({ content }) {
|
|
|
13000
13219
|
const paths = RulesyncMcp.getSettablePaths();
|
|
13001
13220
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
13002
13221
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
13003
|
-
const fullPath = (0,
|
|
13222
|
+
const fullPath = (0, import_node_path102.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
13004
13223
|
const rulesyncMcp = new RulesyncMcp({
|
|
13005
13224
|
baseDir,
|
|
13006
13225
|
relativeDirPath,
|
|
@@ -13009,9 +13228,9 @@ async function putMcpFile({ content }) {
|
|
|
13009
13228
|
validate: true,
|
|
13010
13229
|
modularMcp: config.getModularMcp()
|
|
13011
13230
|
});
|
|
13012
|
-
await ensureDir((0,
|
|
13231
|
+
await ensureDir((0, import_node_path102.join)(baseDir, relativeDirPath));
|
|
13013
13232
|
await writeFileContent(fullPath, content);
|
|
13014
|
-
const relativePathFromCwd = (0,
|
|
13233
|
+
const relativePathFromCwd = (0, import_node_path102.join)(relativeDirPath, relativeFilePath);
|
|
13015
13234
|
return {
|
|
13016
13235
|
relativePathFromCwd,
|
|
13017
13236
|
content: rulesyncMcp.getFileContent()
|
|
@@ -13026,15 +13245,15 @@ async function deleteMcpFile() {
|
|
|
13026
13245
|
try {
|
|
13027
13246
|
const baseDir = process.cwd();
|
|
13028
13247
|
const paths = RulesyncMcp.getSettablePaths();
|
|
13029
|
-
const recommendedPath = (0,
|
|
13248
|
+
const recommendedPath = (0, import_node_path102.join)(
|
|
13030
13249
|
baseDir,
|
|
13031
13250
|
paths.recommended.relativeDirPath,
|
|
13032
13251
|
paths.recommended.relativeFilePath
|
|
13033
13252
|
);
|
|
13034
|
-
const legacyPath = (0,
|
|
13253
|
+
const legacyPath = (0, import_node_path102.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
13035
13254
|
await removeFile(recommendedPath);
|
|
13036
13255
|
await removeFile(legacyPath);
|
|
13037
|
-
const relativePathFromCwd = (0,
|
|
13256
|
+
const relativePathFromCwd = (0, import_node_path102.join)(
|
|
13038
13257
|
paths.recommended.relativeDirPath,
|
|
13039
13258
|
paths.recommended.relativeFilePath
|
|
13040
13259
|
);
|
|
@@ -13048,11 +13267,11 @@ async function deleteMcpFile() {
|
|
|
13048
13267
|
}
|
|
13049
13268
|
}
|
|
13050
13269
|
var mcpToolSchemas = {
|
|
13051
|
-
getMcpFile:
|
|
13052
|
-
putMcpFile:
|
|
13053
|
-
content:
|
|
13270
|
+
getMcpFile: import_mini47.z.object({}),
|
|
13271
|
+
putMcpFile: import_mini47.z.object({
|
|
13272
|
+
content: import_mini47.z.string()
|
|
13054
13273
|
}),
|
|
13055
|
-
deleteMcpFile:
|
|
13274
|
+
deleteMcpFile: import_mini47.z.object({})
|
|
13056
13275
|
};
|
|
13057
13276
|
var mcpTools = {
|
|
13058
13277
|
getMcpFile: {
|
|
@@ -13085,12 +13304,12 @@ var mcpTools = {
|
|
|
13085
13304
|
};
|
|
13086
13305
|
|
|
13087
13306
|
// src/mcp/rules.ts
|
|
13088
|
-
var
|
|
13089
|
-
var
|
|
13307
|
+
var import_node_path103 = require("path");
|
|
13308
|
+
var import_mini48 = require("zod/mini");
|
|
13090
13309
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
13091
13310
|
var maxRulesCount = 1e3;
|
|
13092
13311
|
async function listRules() {
|
|
13093
|
-
const rulesDir = (0,
|
|
13312
|
+
const rulesDir = (0, import_node_path103.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
13094
13313
|
try {
|
|
13095
13314
|
const files = await listDirectoryFiles(rulesDir);
|
|
13096
13315
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13103,7 +13322,7 @@ async function listRules() {
|
|
|
13103
13322
|
});
|
|
13104
13323
|
const frontmatter = rule.getFrontmatter();
|
|
13105
13324
|
return {
|
|
13106
|
-
relativePathFromCwd: (0,
|
|
13325
|
+
relativePathFromCwd: (0, import_node_path103.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
13107
13326
|
frontmatter
|
|
13108
13327
|
};
|
|
13109
13328
|
} catch (error) {
|
|
@@ -13123,14 +13342,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
13123
13342
|
relativePath: relativePathFromCwd,
|
|
13124
13343
|
intendedRootDir: process.cwd()
|
|
13125
13344
|
});
|
|
13126
|
-
const filename = (0,
|
|
13345
|
+
const filename = (0, import_node_path103.basename)(relativePathFromCwd);
|
|
13127
13346
|
try {
|
|
13128
13347
|
const rule = await RulesyncRule.fromFile({
|
|
13129
13348
|
relativeFilePath: filename,
|
|
13130
13349
|
validate: true
|
|
13131
13350
|
});
|
|
13132
13351
|
return {
|
|
13133
|
-
relativePathFromCwd: (0,
|
|
13352
|
+
relativePathFromCwd: (0, import_node_path103.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
13134
13353
|
frontmatter: rule.getFrontmatter(),
|
|
13135
13354
|
body: rule.getBody()
|
|
13136
13355
|
};
|
|
@@ -13149,7 +13368,7 @@ async function putRule({
|
|
|
13149
13368
|
relativePath: relativePathFromCwd,
|
|
13150
13369
|
intendedRootDir: process.cwd()
|
|
13151
13370
|
});
|
|
13152
|
-
const filename = (0,
|
|
13371
|
+
const filename = (0, import_node_path103.basename)(relativePathFromCwd);
|
|
13153
13372
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
13154
13373
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
13155
13374
|
throw new Error(
|
|
@@ -13159,7 +13378,7 @@ async function putRule({
|
|
|
13159
13378
|
try {
|
|
13160
13379
|
const existingRules = await listRules();
|
|
13161
13380
|
const isUpdate = existingRules.some(
|
|
13162
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
13381
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path103.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
13163
13382
|
);
|
|
13164
13383
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
13165
13384
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -13172,11 +13391,11 @@ async function putRule({
|
|
|
13172
13391
|
body,
|
|
13173
13392
|
validate: true
|
|
13174
13393
|
});
|
|
13175
|
-
const rulesDir = (0,
|
|
13394
|
+
const rulesDir = (0, import_node_path103.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
13176
13395
|
await ensureDir(rulesDir);
|
|
13177
13396
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
13178
13397
|
return {
|
|
13179
|
-
relativePathFromCwd: (0,
|
|
13398
|
+
relativePathFromCwd: (0, import_node_path103.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
13180
13399
|
frontmatter: rule.getFrontmatter(),
|
|
13181
13400
|
body: rule.getBody()
|
|
13182
13401
|
};
|
|
@@ -13191,12 +13410,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
13191
13410
|
relativePath: relativePathFromCwd,
|
|
13192
13411
|
intendedRootDir: process.cwd()
|
|
13193
13412
|
});
|
|
13194
|
-
const filename = (0,
|
|
13195
|
-
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);
|
|
13196
13415
|
try {
|
|
13197
13416
|
await removeFile(fullPath);
|
|
13198
13417
|
return {
|
|
13199
|
-
relativePathFromCwd: (0,
|
|
13418
|
+
relativePathFromCwd: (0, import_node_path103.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
13200
13419
|
};
|
|
13201
13420
|
} catch (error) {
|
|
13202
13421
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -13205,23 +13424,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
13205
13424
|
}
|
|
13206
13425
|
}
|
|
13207
13426
|
var ruleToolSchemas = {
|
|
13208
|
-
listRules:
|
|
13209
|
-
getRule:
|
|
13210
|
-
relativePathFromCwd:
|
|
13427
|
+
listRules: import_mini48.z.object({}),
|
|
13428
|
+
getRule: import_mini48.z.object({
|
|
13429
|
+
relativePathFromCwd: import_mini48.z.string()
|
|
13211
13430
|
}),
|
|
13212
|
-
putRule:
|
|
13213
|
-
relativePathFromCwd:
|
|
13431
|
+
putRule: import_mini48.z.object({
|
|
13432
|
+
relativePathFromCwd: import_mini48.z.string(),
|
|
13214
13433
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
13215
|
-
body:
|
|
13434
|
+
body: import_mini48.z.string()
|
|
13216
13435
|
}),
|
|
13217
|
-
deleteRule:
|
|
13218
|
-
relativePathFromCwd:
|
|
13436
|
+
deleteRule: import_mini48.z.object({
|
|
13437
|
+
relativePathFromCwd: import_mini48.z.string()
|
|
13219
13438
|
})
|
|
13220
13439
|
};
|
|
13221
13440
|
var ruleTools = {
|
|
13222
13441
|
listRules: {
|
|
13223
13442
|
name: "listRules",
|
|
13224
|
-
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.`,
|
|
13225
13444
|
parameters: ruleToolSchemas.listRules,
|
|
13226
13445
|
execute: async () => {
|
|
13227
13446
|
const rules = await listRules();
|
|
@@ -13263,8 +13482,8 @@ var ruleTools = {
|
|
|
13263
13482
|
};
|
|
13264
13483
|
|
|
13265
13484
|
// src/mcp/skills.ts
|
|
13266
|
-
var
|
|
13267
|
-
var
|
|
13485
|
+
var import_node_path104 = require("path");
|
|
13486
|
+
var import_mini49 = require("zod/mini");
|
|
13268
13487
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
13269
13488
|
var maxSkillsCount = 1e3;
|
|
13270
13489
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -13280,19 +13499,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
13280
13499
|
};
|
|
13281
13500
|
}
|
|
13282
13501
|
function extractDirName(relativeDirPathFromCwd) {
|
|
13283
|
-
const dirName = (0,
|
|
13502
|
+
const dirName = (0, import_node_path104.basename)(relativeDirPathFromCwd);
|
|
13284
13503
|
if (!dirName) {
|
|
13285
13504
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
13286
13505
|
}
|
|
13287
13506
|
return dirName;
|
|
13288
13507
|
}
|
|
13289
13508
|
async function listSkills() {
|
|
13290
|
-
const skillsDir = (0,
|
|
13509
|
+
const skillsDir = (0, import_node_path104.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
13291
13510
|
try {
|
|
13292
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
13511
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path104.join)(skillsDir, "*"), { type: "dir" });
|
|
13293
13512
|
const skills = await Promise.all(
|
|
13294
13513
|
skillDirPaths.map(async (dirPath) => {
|
|
13295
|
-
const dirName = (0,
|
|
13514
|
+
const dirName = (0, import_node_path104.basename)(dirPath);
|
|
13296
13515
|
if (!dirName) return null;
|
|
13297
13516
|
try {
|
|
13298
13517
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -13300,7 +13519,7 @@ async function listSkills() {
|
|
|
13300
13519
|
});
|
|
13301
13520
|
const frontmatter = skill.getFrontmatter();
|
|
13302
13521
|
return {
|
|
13303
|
-
relativeDirPathFromCwd: (0,
|
|
13522
|
+
relativeDirPathFromCwd: (0, import_node_path104.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13304
13523
|
frontmatter
|
|
13305
13524
|
};
|
|
13306
13525
|
} catch (error) {
|
|
@@ -13326,7 +13545,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
13326
13545
|
dirName
|
|
13327
13546
|
});
|
|
13328
13547
|
return {
|
|
13329
|
-
relativeDirPathFromCwd: (0,
|
|
13548
|
+
relativeDirPathFromCwd: (0, import_node_path104.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13330
13549
|
frontmatter: skill.getFrontmatter(),
|
|
13331
13550
|
body: skill.getBody(),
|
|
13332
13551
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13360,7 +13579,7 @@ async function putSkill({
|
|
|
13360
13579
|
try {
|
|
13361
13580
|
const existingSkills = await listSkills();
|
|
13362
13581
|
const isUpdate = existingSkills.some(
|
|
13363
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
13582
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path104.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13364
13583
|
);
|
|
13365
13584
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
13366
13585
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -13375,9 +13594,9 @@ async function putSkill({
|
|
|
13375
13594
|
otherFiles: aiDirFiles,
|
|
13376
13595
|
validate: true
|
|
13377
13596
|
});
|
|
13378
|
-
const skillDirPath = (0,
|
|
13597
|
+
const skillDirPath = (0, import_node_path104.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13379
13598
|
await ensureDir(skillDirPath);
|
|
13380
|
-
const skillFilePath = (0,
|
|
13599
|
+
const skillFilePath = (0, import_node_path104.join)(skillDirPath, SKILL_FILE_NAME);
|
|
13381
13600
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
13382
13601
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
13383
13602
|
for (const file of otherFiles) {
|
|
@@ -13385,15 +13604,15 @@ async function putSkill({
|
|
|
13385
13604
|
relativePath: file.name,
|
|
13386
13605
|
intendedRootDir: skillDirPath
|
|
13387
13606
|
});
|
|
13388
|
-
const filePath = (0,
|
|
13389
|
-
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));
|
|
13390
13609
|
if (fileDir !== skillDirPath) {
|
|
13391
13610
|
await ensureDir(fileDir);
|
|
13392
13611
|
}
|
|
13393
13612
|
await writeFileContent(filePath, file.body);
|
|
13394
13613
|
}
|
|
13395
13614
|
return {
|
|
13396
|
-
relativeDirPathFromCwd: (0,
|
|
13615
|
+
relativeDirPathFromCwd: (0, import_node_path104.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13397
13616
|
frontmatter: skill.getFrontmatter(),
|
|
13398
13617
|
body: skill.getBody(),
|
|
13399
13618
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13415,13 +13634,13 @@ async function deleteSkill({
|
|
|
13415
13634
|
intendedRootDir: process.cwd()
|
|
13416
13635
|
});
|
|
13417
13636
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
13418
|
-
const skillDirPath = (0,
|
|
13637
|
+
const skillDirPath = (0, import_node_path104.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13419
13638
|
try {
|
|
13420
13639
|
if (await directoryExists(skillDirPath)) {
|
|
13421
13640
|
await removeDirectory(skillDirPath);
|
|
13422
13641
|
}
|
|
13423
13642
|
return {
|
|
13424
|
-
relativeDirPathFromCwd: (0,
|
|
13643
|
+
relativeDirPathFromCwd: (0, import_node_path104.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13425
13644
|
};
|
|
13426
13645
|
} catch (error) {
|
|
13427
13646
|
throw new Error(
|
|
@@ -13432,29 +13651,29 @@ async function deleteSkill({
|
|
|
13432
13651
|
);
|
|
13433
13652
|
}
|
|
13434
13653
|
}
|
|
13435
|
-
var McpSkillFileSchema =
|
|
13436
|
-
name:
|
|
13437
|
-
body:
|
|
13654
|
+
var McpSkillFileSchema = import_mini49.z.object({
|
|
13655
|
+
name: import_mini49.z.string(),
|
|
13656
|
+
body: import_mini49.z.string()
|
|
13438
13657
|
});
|
|
13439
13658
|
var skillToolSchemas = {
|
|
13440
|
-
listSkills:
|
|
13441
|
-
getSkill:
|
|
13442
|
-
relativeDirPathFromCwd:
|
|
13659
|
+
listSkills: import_mini49.z.object({}),
|
|
13660
|
+
getSkill: import_mini49.z.object({
|
|
13661
|
+
relativeDirPathFromCwd: import_mini49.z.string()
|
|
13443
13662
|
}),
|
|
13444
|
-
putSkill:
|
|
13445
|
-
relativeDirPathFromCwd:
|
|
13663
|
+
putSkill: import_mini49.z.object({
|
|
13664
|
+
relativeDirPathFromCwd: import_mini49.z.string(),
|
|
13446
13665
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
13447
|
-
body:
|
|
13448
|
-
otherFiles:
|
|
13666
|
+
body: import_mini49.z.string(),
|
|
13667
|
+
otherFiles: import_mini49.z.optional(import_mini49.z.array(McpSkillFileSchema))
|
|
13449
13668
|
}),
|
|
13450
|
-
deleteSkill:
|
|
13451
|
-
relativeDirPathFromCwd:
|
|
13669
|
+
deleteSkill: import_mini49.z.object({
|
|
13670
|
+
relativeDirPathFromCwd: import_mini49.z.string()
|
|
13452
13671
|
})
|
|
13453
13672
|
};
|
|
13454
13673
|
var skillTools = {
|
|
13455
13674
|
listSkills: {
|
|
13456
13675
|
name: "listSkills",
|
|
13457
|
-
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.`,
|
|
13458
13677
|
parameters: skillToolSchemas.listSkills,
|
|
13459
13678
|
execute: async () => {
|
|
13460
13679
|
const skills = await listSkills();
|
|
@@ -13497,12 +13716,12 @@ var skillTools = {
|
|
|
13497
13716
|
};
|
|
13498
13717
|
|
|
13499
13718
|
// src/mcp/subagents.ts
|
|
13500
|
-
var
|
|
13501
|
-
var
|
|
13719
|
+
var import_node_path105 = require("path");
|
|
13720
|
+
var import_mini50 = require("zod/mini");
|
|
13502
13721
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
13503
13722
|
var maxSubagentsCount = 1e3;
|
|
13504
13723
|
async function listSubagents() {
|
|
13505
|
-
const subagentsDir = (0,
|
|
13724
|
+
const subagentsDir = (0, import_node_path105.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13506
13725
|
try {
|
|
13507
13726
|
const files = await listDirectoryFiles(subagentsDir);
|
|
13508
13727
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13515,7 +13734,7 @@ async function listSubagents() {
|
|
|
13515
13734
|
});
|
|
13516
13735
|
const frontmatter = subagent.getFrontmatter();
|
|
13517
13736
|
return {
|
|
13518
|
-
relativePathFromCwd: (0,
|
|
13737
|
+
relativePathFromCwd: (0, import_node_path105.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
13519
13738
|
frontmatter
|
|
13520
13739
|
};
|
|
13521
13740
|
} catch (error) {
|
|
@@ -13537,14 +13756,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
13537
13756
|
relativePath: relativePathFromCwd,
|
|
13538
13757
|
intendedRootDir: process.cwd()
|
|
13539
13758
|
});
|
|
13540
|
-
const filename = (0,
|
|
13759
|
+
const filename = (0, import_node_path105.basename)(relativePathFromCwd);
|
|
13541
13760
|
try {
|
|
13542
13761
|
const subagent = await RulesyncSubagent.fromFile({
|
|
13543
13762
|
relativeFilePath: filename,
|
|
13544
13763
|
validate: true
|
|
13545
13764
|
});
|
|
13546
13765
|
return {
|
|
13547
|
-
relativePathFromCwd: (0,
|
|
13766
|
+
relativePathFromCwd: (0, import_node_path105.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13548
13767
|
frontmatter: subagent.getFrontmatter(),
|
|
13549
13768
|
body: subagent.getBody()
|
|
13550
13769
|
};
|
|
@@ -13563,7 +13782,7 @@ async function putSubagent({
|
|
|
13563
13782
|
relativePath: relativePathFromCwd,
|
|
13564
13783
|
intendedRootDir: process.cwd()
|
|
13565
13784
|
});
|
|
13566
|
-
const filename = (0,
|
|
13785
|
+
const filename = (0, import_node_path105.basename)(relativePathFromCwd);
|
|
13567
13786
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
13568
13787
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
13569
13788
|
throw new Error(
|
|
@@ -13573,7 +13792,7 @@ async function putSubagent({
|
|
|
13573
13792
|
try {
|
|
13574
13793
|
const existingSubagents = await listSubagents();
|
|
13575
13794
|
const isUpdate = existingSubagents.some(
|
|
13576
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
13795
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path105.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13577
13796
|
);
|
|
13578
13797
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
13579
13798
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -13586,11 +13805,11 @@ async function putSubagent({
|
|
|
13586
13805
|
body,
|
|
13587
13806
|
validate: true
|
|
13588
13807
|
});
|
|
13589
|
-
const subagentsDir = (0,
|
|
13808
|
+
const subagentsDir = (0, import_node_path105.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13590
13809
|
await ensureDir(subagentsDir);
|
|
13591
13810
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
13592
13811
|
return {
|
|
13593
|
-
relativePathFromCwd: (0,
|
|
13812
|
+
relativePathFromCwd: (0, import_node_path105.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13594
13813
|
frontmatter: subagent.getFrontmatter(),
|
|
13595
13814
|
body: subagent.getBody()
|
|
13596
13815
|
};
|
|
@@ -13605,12 +13824,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
13605
13824
|
relativePath: relativePathFromCwd,
|
|
13606
13825
|
intendedRootDir: process.cwd()
|
|
13607
13826
|
});
|
|
13608
|
-
const filename = (0,
|
|
13609
|
-
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);
|
|
13610
13829
|
try {
|
|
13611
13830
|
await removeFile(fullPath);
|
|
13612
13831
|
return {
|
|
13613
|
-
relativePathFromCwd: (0,
|
|
13832
|
+
relativePathFromCwd: (0, import_node_path105.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13614
13833
|
};
|
|
13615
13834
|
} catch (error) {
|
|
13616
13835
|
throw new Error(
|
|
@@ -13622,23 +13841,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
13622
13841
|
}
|
|
13623
13842
|
}
|
|
13624
13843
|
var subagentToolSchemas = {
|
|
13625
|
-
listSubagents:
|
|
13626
|
-
getSubagent:
|
|
13627
|
-
relativePathFromCwd:
|
|
13844
|
+
listSubagents: import_mini50.z.object({}),
|
|
13845
|
+
getSubagent: import_mini50.z.object({
|
|
13846
|
+
relativePathFromCwd: import_mini50.z.string()
|
|
13628
13847
|
}),
|
|
13629
|
-
putSubagent:
|
|
13630
|
-
relativePathFromCwd:
|
|
13848
|
+
putSubagent: import_mini50.z.object({
|
|
13849
|
+
relativePathFromCwd: import_mini50.z.string(),
|
|
13631
13850
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
13632
|
-
body:
|
|
13851
|
+
body: import_mini50.z.string()
|
|
13633
13852
|
}),
|
|
13634
|
-
deleteSubagent:
|
|
13635
|
-
relativePathFromCwd:
|
|
13853
|
+
deleteSubagent: import_mini50.z.object({
|
|
13854
|
+
relativePathFromCwd: import_mini50.z.string()
|
|
13636
13855
|
})
|
|
13637
13856
|
};
|
|
13638
13857
|
var subagentTools = {
|
|
13639
13858
|
listSubagents: {
|
|
13640
13859
|
name: "listSubagents",
|
|
13641
|
-
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.`,
|
|
13642
13861
|
parameters: subagentToolSchemas.listSubagents,
|
|
13643
13862
|
execute: async () => {
|
|
13644
13863
|
const subagents = await listSubagents();
|
|
@@ -13680,20 +13899,20 @@ var subagentTools = {
|
|
|
13680
13899
|
};
|
|
13681
13900
|
|
|
13682
13901
|
// src/mcp/tools.ts
|
|
13683
|
-
var rulesyncFeatureSchema =
|
|
13684
|
-
var rulesyncOperationSchema =
|
|
13685
|
-
var skillFileSchema =
|
|
13686
|
-
name:
|
|
13687
|
-
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()
|
|
13688
13907
|
});
|
|
13689
|
-
var rulesyncToolSchema =
|
|
13908
|
+
var rulesyncToolSchema = import_mini51.z.object({
|
|
13690
13909
|
feature: rulesyncFeatureSchema,
|
|
13691
13910
|
operation: rulesyncOperationSchema,
|
|
13692
|
-
targetPathFromCwd:
|
|
13693
|
-
frontmatter:
|
|
13694
|
-
body:
|
|
13695
|
-
otherFiles:
|
|
13696
|
-
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())
|
|
13697
13916
|
});
|
|
13698
13917
|
var supportedOperationsByFeature = {
|
|
13699
13918
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -13889,7 +14108,7 @@ async function mcpCommand({ version }) {
|
|
|
13889
14108
|
}
|
|
13890
14109
|
|
|
13891
14110
|
// src/cli/index.ts
|
|
13892
|
-
var getVersion = () => "5.
|
|
14111
|
+
var getVersion = () => "5.8.0";
|
|
13893
14112
|
var main = async () => {
|
|
13894
14113
|
const program = new import_commander.Command();
|
|
13895
14114
|
const version = getVersion();
|
|
@@ -13913,12 +14132,13 @@ var main = async () => {
|
|
|
13913
14132
|
(value) => {
|
|
13914
14133
|
return value.split(",").map((f) => f.trim());
|
|
13915
14134
|
}
|
|
13916
|
-
).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) => {
|
|
13917
14136
|
try {
|
|
13918
14137
|
await importCommand({
|
|
13919
14138
|
targets: options.targets,
|
|
13920
14139
|
features: options.features,
|
|
13921
14140
|
verbose: options.verbose,
|
|
14141
|
+
silent: options.silent,
|
|
13922
14142
|
configPath: options.config,
|
|
13923
14143
|
global: options.global
|
|
13924
14144
|
});
|
|
@@ -13950,7 +14170,7 @@ var main = async () => {
|
|
|
13950
14170
|
).option("--delete", "Delete all existing files in output directories before generating").option(
|
|
13951
14171
|
"-b, --base-dir <paths>",
|
|
13952
14172
|
"Base directories to generate files (comma-separated for multiple paths)"
|
|
13953
|
-
).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(
|
|
13954
14174
|
"--simulate-commands",
|
|
13955
14175
|
"Generate simulated commands. This feature is only available for copilot, cursor and codexcli."
|
|
13956
14176
|
).option(
|
|
@@ -13968,6 +14188,7 @@ var main = async () => {
|
|
|
13968
14188
|
targets: options.targets,
|
|
13969
14189
|
features: options.features,
|
|
13970
14190
|
verbose: options.verbose,
|
|
14191
|
+
silent: options.silent,
|
|
13971
14192
|
delete: options.delete,
|
|
13972
14193
|
baseDirs: options.baseDirs,
|
|
13973
14194
|
configPath: options.config,
|