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.js
CHANGED
|
@@ -40,37 +40,52 @@ var isEnvTest = process.env.NODE_ENV === "test";
|
|
|
40
40
|
// src/utils/logger.ts
|
|
41
41
|
var Logger = class {
|
|
42
42
|
_verbose = false;
|
|
43
|
+
_silent = false;
|
|
43
44
|
console = consola.withDefaults({
|
|
44
45
|
tag: "rulesync"
|
|
45
46
|
});
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Configure logger with verbose and silent mode settings.
|
|
49
|
+
* Handles conflicting flags where silent takes precedence.
|
|
50
|
+
* @param verbose - Enable verbose logging
|
|
51
|
+
* @param silent - Enable silent mode (suppresses all output except errors)
|
|
52
|
+
*/
|
|
53
|
+
configure({ verbose, silent }) {
|
|
54
|
+
if (verbose && silent) {
|
|
55
|
+
this._silent = false;
|
|
56
|
+
this.warn("Both --verbose and --silent specified; --silent takes precedence");
|
|
57
|
+
}
|
|
58
|
+
this._silent = silent;
|
|
59
|
+
this._verbose = verbose && !silent;
|
|
48
60
|
}
|
|
49
61
|
get verbose() {
|
|
50
62
|
return this._verbose;
|
|
51
63
|
}
|
|
64
|
+
get silent() {
|
|
65
|
+
return this._silent;
|
|
66
|
+
}
|
|
52
67
|
info(message, ...args) {
|
|
53
|
-
if (isEnvTest) return;
|
|
68
|
+
if (isEnvTest || this._silent) return;
|
|
54
69
|
this.console.info(message, ...args);
|
|
55
70
|
}
|
|
56
|
-
// Success (always shown)
|
|
71
|
+
// Success (always shown unless silent)
|
|
57
72
|
success(message, ...args) {
|
|
58
|
-
if (isEnvTest) return;
|
|
73
|
+
if (isEnvTest || this._silent) return;
|
|
59
74
|
this.console.success(message, ...args);
|
|
60
75
|
}
|
|
61
|
-
// Warning (always shown)
|
|
76
|
+
// Warning (always shown unless silent)
|
|
62
77
|
warn(message, ...args) {
|
|
63
|
-
if (isEnvTest) return;
|
|
78
|
+
if (isEnvTest || this._silent) return;
|
|
64
79
|
this.console.warn(message, ...args);
|
|
65
80
|
}
|
|
66
|
-
// Error (always shown)
|
|
81
|
+
// Error (always shown, even in silent mode)
|
|
67
82
|
error(message, ...args) {
|
|
68
83
|
if (isEnvTest) return;
|
|
69
84
|
this.console.error(message, ...args);
|
|
70
85
|
}
|
|
71
86
|
// Debug level (shown only in verbose mode)
|
|
72
87
|
debug(message, ...args) {
|
|
73
|
-
if (isEnvTest) return;
|
|
88
|
+
if (isEnvTest || this._silent) return;
|
|
74
89
|
if (this._verbose) {
|
|
75
90
|
this.console.info(message, ...args);
|
|
76
91
|
}
|
|
@@ -261,6 +276,7 @@ var ConfigParamsSchema = z3.object({
|
|
|
261
276
|
delete: z3.boolean(),
|
|
262
277
|
// New non-experimental options
|
|
263
278
|
global: optional(z3.boolean()),
|
|
279
|
+
silent: optional(z3.boolean()),
|
|
264
280
|
simulateCommands: optional(z3.boolean()),
|
|
265
281
|
simulateSubagents: optional(z3.boolean()),
|
|
266
282
|
simulateSkills: optional(z3.boolean()),
|
|
@@ -284,6 +300,7 @@ var Config = class {
|
|
|
284
300
|
verbose;
|
|
285
301
|
delete;
|
|
286
302
|
global;
|
|
303
|
+
silent;
|
|
287
304
|
simulateCommands;
|
|
288
305
|
simulateSubagents;
|
|
289
306
|
simulateSkills;
|
|
@@ -295,6 +312,7 @@ var Config = class {
|
|
|
295
312
|
verbose,
|
|
296
313
|
delete: isDelete,
|
|
297
314
|
global,
|
|
315
|
+
silent,
|
|
298
316
|
simulateCommands,
|
|
299
317
|
simulateSubagents,
|
|
300
318
|
simulateSkills,
|
|
@@ -307,6 +325,7 @@ var Config = class {
|
|
|
307
325
|
this.verbose = verbose;
|
|
308
326
|
this.delete = isDelete;
|
|
309
327
|
this.global = global ?? false;
|
|
328
|
+
this.silent = silent ?? false;
|
|
310
329
|
this.simulateCommands = simulateCommands ?? false;
|
|
311
330
|
this.simulateSubagents = simulateSubagents ?? false;
|
|
312
331
|
this.simulateSkills = simulateSkills ?? false;
|
|
@@ -350,6 +369,9 @@ var Config = class {
|
|
|
350
369
|
getGlobal() {
|
|
351
370
|
return this.global;
|
|
352
371
|
}
|
|
372
|
+
getSilent() {
|
|
373
|
+
return this.silent;
|
|
374
|
+
}
|
|
353
375
|
getSimulateCommands() {
|
|
354
376
|
return this.simulateCommands;
|
|
355
377
|
}
|
|
@@ -373,6 +395,7 @@ var getDefaults = () => ({
|
|
|
373
395
|
baseDirs: [process.cwd()],
|
|
374
396
|
configPath: "rulesync.jsonc",
|
|
375
397
|
global: false,
|
|
398
|
+
silent: false,
|
|
376
399
|
simulateCommands: false,
|
|
377
400
|
simulateSubagents: false,
|
|
378
401
|
simulateSkills: false,
|
|
@@ -387,6 +410,7 @@ var ConfigResolver = class {
|
|
|
387
410
|
baseDirs,
|
|
388
411
|
configPath = getDefaults().configPath,
|
|
389
412
|
global,
|
|
413
|
+
silent,
|
|
390
414
|
simulateCommands,
|
|
391
415
|
simulateSubagents,
|
|
392
416
|
simulateSkills,
|
|
@@ -420,6 +444,7 @@ var ConfigResolver = class {
|
|
|
420
444
|
global: resolvedGlobal
|
|
421
445
|
}),
|
|
422
446
|
global: resolvedGlobal,
|
|
447
|
+
silent: silent ?? configByFile.silent ?? getDefaults().silent,
|
|
423
448
|
simulateCommands: resolvedSimulateCommands,
|
|
424
449
|
simulateSubagents: resolvedSimulateSubagents,
|
|
425
450
|
simulateSkills: resolvedSimulateSkills,
|
|
@@ -5217,8 +5242,8 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
5217
5242
|
|
|
5218
5243
|
// src/features/rules/rules-processor.ts
|
|
5219
5244
|
import { encode } from "@toon-format/toon";
|
|
5220
|
-
import { basename as basename24, join as
|
|
5221
|
-
import { z as
|
|
5245
|
+
import { basename as basename24, join as join95 } from "path";
|
|
5246
|
+
import { z as z44 } from "zod/mini";
|
|
5222
5247
|
|
|
5223
5248
|
// src/constants/general.ts
|
|
5224
5249
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
@@ -5683,8 +5708,8 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
|
5683
5708
|
};
|
|
5684
5709
|
|
|
5685
5710
|
// src/features/skills/skills-processor.ts
|
|
5686
|
-
import { basename as basename17, join as
|
|
5687
|
-
import { z as
|
|
5711
|
+
import { basename as basename17, join as join60 } from "path";
|
|
5712
|
+
import { z as z30 } from "zod/mini";
|
|
5688
5713
|
|
|
5689
5714
|
// src/types/dir-feature-processor.ts
|
|
5690
5715
|
import { join as join49 } from "path";
|
|
@@ -6860,18 +6885,197 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6860
6885
|
}
|
|
6861
6886
|
};
|
|
6862
6887
|
|
|
6863
|
-
// src/features/skills/
|
|
6888
|
+
// src/features/skills/kiro-skill.ts
|
|
6864
6889
|
import { join as join57 } from "path";
|
|
6865
6890
|
import { z as z27 } from "zod/mini";
|
|
6866
|
-
var
|
|
6891
|
+
var KiroSkillFrontmatterSchema = z27.looseObject({
|
|
6867
6892
|
name: z27.string(),
|
|
6868
|
-
description: z27.string()
|
|
6869
|
-
|
|
6893
|
+
description: z27.string()
|
|
6894
|
+
});
|
|
6895
|
+
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
6896
|
+
constructor({
|
|
6897
|
+
baseDir = process.cwd(),
|
|
6898
|
+
relativeDirPath = join57(".kiro", "skills"),
|
|
6899
|
+
dirName,
|
|
6900
|
+
frontmatter,
|
|
6901
|
+
body,
|
|
6902
|
+
otherFiles = [],
|
|
6903
|
+
validate = true,
|
|
6904
|
+
global = false
|
|
6905
|
+
}) {
|
|
6906
|
+
super({
|
|
6907
|
+
baseDir,
|
|
6908
|
+
relativeDirPath,
|
|
6909
|
+
dirName,
|
|
6910
|
+
mainFile: {
|
|
6911
|
+
name: SKILL_FILE_NAME,
|
|
6912
|
+
body,
|
|
6913
|
+
frontmatter: { ...frontmatter }
|
|
6914
|
+
},
|
|
6915
|
+
otherFiles,
|
|
6916
|
+
global
|
|
6917
|
+
});
|
|
6918
|
+
if (validate) {
|
|
6919
|
+
const result = this.validate();
|
|
6920
|
+
if (!result.success) {
|
|
6921
|
+
throw result.error;
|
|
6922
|
+
}
|
|
6923
|
+
}
|
|
6924
|
+
}
|
|
6925
|
+
static getSettablePaths(options) {
|
|
6926
|
+
if (options?.global) {
|
|
6927
|
+
throw new Error("KiroSkill does not support global mode.");
|
|
6928
|
+
}
|
|
6929
|
+
return {
|
|
6930
|
+
relativeDirPath: join57(".kiro", "skills")
|
|
6931
|
+
};
|
|
6932
|
+
}
|
|
6933
|
+
getFrontmatter() {
|
|
6934
|
+
if (!this.mainFile?.frontmatter) {
|
|
6935
|
+
throw new Error("Frontmatter is not defined");
|
|
6936
|
+
}
|
|
6937
|
+
const result = KiroSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
6938
|
+
return result;
|
|
6939
|
+
}
|
|
6940
|
+
getBody() {
|
|
6941
|
+
return this.mainFile?.body ?? "";
|
|
6942
|
+
}
|
|
6943
|
+
validate() {
|
|
6944
|
+
if (!this.mainFile) {
|
|
6945
|
+
return {
|
|
6946
|
+
success: false,
|
|
6947
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
6948
|
+
};
|
|
6949
|
+
}
|
|
6950
|
+
const result = KiroSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
6951
|
+
if (!result.success) {
|
|
6952
|
+
return {
|
|
6953
|
+
success: false,
|
|
6954
|
+
error: new Error(
|
|
6955
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
6956
|
+
)
|
|
6957
|
+
};
|
|
6958
|
+
}
|
|
6959
|
+
if (result.data.name !== this.getDirName()) {
|
|
6960
|
+
return {
|
|
6961
|
+
success: false,
|
|
6962
|
+
error: new Error(
|
|
6963
|
+
`${this.getDirPath()}: frontmatter name (${result.data.name}) must match directory name (${this.getDirName()})`
|
|
6964
|
+
)
|
|
6965
|
+
};
|
|
6966
|
+
}
|
|
6967
|
+
return { success: true, error: null };
|
|
6968
|
+
}
|
|
6969
|
+
toRulesyncSkill() {
|
|
6970
|
+
const frontmatter = this.getFrontmatter();
|
|
6971
|
+
const rulesyncFrontmatter = {
|
|
6972
|
+
name: frontmatter.name,
|
|
6973
|
+
description: frontmatter.description,
|
|
6974
|
+
targets: ["*"]
|
|
6975
|
+
};
|
|
6976
|
+
return new RulesyncSkill({
|
|
6977
|
+
baseDir: this.baseDir,
|
|
6978
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
6979
|
+
dirName: this.getDirName(),
|
|
6980
|
+
frontmatter: rulesyncFrontmatter,
|
|
6981
|
+
body: this.getBody(),
|
|
6982
|
+
otherFiles: this.getOtherFiles(),
|
|
6983
|
+
validate: true,
|
|
6984
|
+
global: this.global
|
|
6985
|
+
});
|
|
6986
|
+
}
|
|
6987
|
+
static fromRulesyncSkill({
|
|
6988
|
+
rulesyncSkill,
|
|
6989
|
+
validate = true,
|
|
6990
|
+
global = false
|
|
6991
|
+
}) {
|
|
6992
|
+
const settablePaths = _KiroSkill.getSettablePaths({ global });
|
|
6993
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
6994
|
+
const kiroFrontmatter = {
|
|
6995
|
+
name: rulesyncFrontmatter.name,
|
|
6996
|
+
description: rulesyncFrontmatter.description
|
|
6997
|
+
};
|
|
6998
|
+
return new _KiroSkill({
|
|
6999
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
7000
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
7001
|
+
dirName: rulesyncSkill.getDirName(),
|
|
7002
|
+
frontmatter: kiroFrontmatter,
|
|
7003
|
+
body: rulesyncSkill.getBody(),
|
|
7004
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
7005
|
+
validate,
|
|
7006
|
+
global
|
|
7007
|
+
});
|
|
7008
|
+
}
|
|
7009
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
7010
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
7011
|
+
return targets.includes("*") || targets.includes("kiro");
|
|
7012
|
+
}
|
|
7013
|
+
static async fromDir(params) {
|
|
7014
|
+
const loaded = await this.loadSkillDirContent({
|
|
7015
|
+
...params,
|
|
7016
|
+
getSettablePaths: _KiroSkill.getSettablePaths
|
|
7017
|
+
});
|
|
7018
|
+
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7019
|
+
if (!result.success) {
|
|
7020
|
+
const skillDirPath = join57(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7021
|
+
throw new Error(
|
|
7022
|
+
`Invalid frontmatter in ${join57(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7023
|
+
);
|
|
7024
|
+
}
|
|
7025
|
+
if (result.data.name !== loaded.dirName) {
|
|
7026
|
+
const skillFilePath = join57(
|
|
7027
|
+
loaded.baseDir,
|
|
7028
|
+
loaded.relativeDirPath,
|
|
7029
|
+
loaded.dirName,
|
|
7030
|
+
SKILL_FILE_NAME
|
|
7031
|
+
);
|
|
7032
|
+
throw new Error(
|
|
7033
|
+
`Frontmatter name (${result.data.name}) must match directory name (${loaded.dirName}) in ${skillFilePath}`
|
|
7034
|
+
);
|
|
7035
|
+
}
|
|
7036
|
+
return new _KiroSkill({
|
|
7037
|
+
baseDir: loaded.baseDir,
|
|
7038
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
7039
|
+
dirName: loaded.dirName,
|
|
7040
|
+
frontmatter: result.data,
|
|
7041
|
+
body: loaded.body,
|
|
7042
|
+
otherFiles: loaded.otherFiles,
|
|
7043
|
+
validate: true,
|
|
7044
|
+
global: loaded.global
|
|
7045
|
+
});
|
|
7046
|
+
}
|
|
7047
|
+
static forDeletion({
|
|
7048
|
+
baseDir = process.cwd(),
|
|
7049
|
+
relativeDirPath,
|
|
7050
|
+
dirName,
|
|
7051
|
+
global = false
|
|
7052
|
+
}) {
|
|
7053
|
+
const settablePaths = _KiroSkill.getSettablePaths({ global });
|
|
7054
|
+
return new _KiroSkill({
|
|
7055
|
+
baseDir,
|
|
7056
|
+
relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
|
|
7057
|
+
dirName,
|
|
7058
|
+
frontmatter: { name: "", description: "" },
|
|
7059
|
+
body: "",
|
|
7060
|
+
otherFiles: [],
|
|
7061
|
+
validate: false,
|
|
7062
|
+
global
|
|
7063
|
+
});
|
|
7064
|
+
}
|
|
7065
|
+
};
|
|
7066
|
+
|
|
7067
|
+
// src/features/skills/opencode-skill.ts
|
|
7068
|
+
import { join as join58 } from "path";
|
|
7069
|
+
import { z as z28 } from "zod/mini";
|
|
7070
|
+
var OpenCodeSkillFrontmatterSchema = z28.looseObject({
|
|
7071
|
+
name: z28.string(),
|
|
7072
|
+
description: z28.string(),
|
|
7073
|
+
"allowed-tools": z28.optional(z28.array(z28.string()))
|
|
6870
7074
|
});
|
|
6871
7075
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
6872
7076
|
constructor({
|
|
6873
7077
|
baseDir = process.cwd(),
|
|
6874
|
-
relativeDirPath =
|
|
7078
|
+
relativeDirPath = join58(".opencode", "skill"),
|
|
6875
7079
|
dirName,
|
|
6876
7080
|
frontmatter,
|
|
6877
7081
|
body,
|
|
@@ -6900,7 +7104,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6900
7104
|
}
|
|
6901
7105
|
static getSettablePaths({ global = false } = {}) {
|
|
6902
7106
|
return {
|
|
6903
|
-
relativeDirPath: global ?
|
|
7107
|
+
relativeDirPath: global ? join58(".config", "opencode", "skill") : join58(".opencode", "skill")
|
|
6904
7108
|
};
|
|
6905
7109
|
}
|
|
6906
7110
|
getFrontmatter() {
|
|
@@ -6988,9 +7192,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6988
7192
|
});
|
|
6989
7193
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6990
7194
|
if (!result.success) {
|
|
6991
|
-
const skillDirPath =
|
|
7195
|
+
const skillDirPath = join58(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6992
7196
|
throw new Error(
|
|
6993
|
-
`Invalid frontmatter in ${
|
|
7197
|
+
`Invalid frontmatter in ${join58(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6994
7198
|
);
|
|
6995
7199
|
}
|
|
6996
7200
|
return new _OpenCodeSkill({
|
|
@@ -7024,16 +7228,16 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
7024
7228
|
};
|
|
7025
7229
|
|
|
7026
7230
|
// src/features/skills/roo-skill.ts
|
|
7027
|
-
import { join as
|
|
7028
|
-
import { z as
|
|
7029
|
-
var RooSkillFrontmatterSchema =
|
|
7030
|
-
name:
|
|
7031
|
-
description:
|
|
7231
|
+
import { join as join59 } from "path";
|
|
7232
|
+
import { z as z29 } from "zod/mini";
|
|
7233
|
+
var RooSkillFrontmatterSchema = z29.looseObject({
|
|
7234
|
+
name: z29.string(),
|
|
7235
|
+
description: z29.string()
|
|
7032
7236
|
});
|
|
7033
7237
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
7034
7238
|
constructor({
|
|
7035
7239
|
baseDir = process.cwd(),
|
|
7036
|
-
relativeDirPath =
|
|
7240
|
+
relativeDirPath = join59(".roo", "skills"),
|
|
7037
7241
|
dirName,
|
|
7038
7242
|
frontmatter,
|
|
7039
7243
|
body,
|
|
@@ -7064,7 +7268,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
7064
7268
|
global: _global = false
|
|
7065
7269
|
} = {}) {
|
|
7066
7270
|
return {
|
|
7067
|
-
relativeDirPath:
|
|
7271
|
+
relativeDirPath: join59(".roo", "skills")
|
|
7068
7272
|
};
|
|
7069
7273
|
}
|
|
7070
7274
|
getFrontmatter() {
|
|
@@ -7154,13 +7358,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
7154
7358
|
});
|
|
7155
7359
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7156
7360
|
if (!result.success) {
|
|
7157
|
-
const skillDirPath =
|
|
7361
|
+
const skillDirPath = join59(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7158
7362
|
throw new Error(
|
|
7159
|
-
`Invalid frontmatter in ${
|
|
7363
|
+
`Invalid frontmatter in ${join59(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7160
7364
|
);
|
|
7161
7365
|
}
|
|
7162
7366
|
if (result.data.name !== loaded.dirName) {
|
|
7163
|
-
const skillFilePath =
|
|
7367
|
+
const skillFilePath = join59(
|
|
7164
7368
|
loaded.baseDir,
|
|
7165
7369
|
loaded.relativeDirPath,
|
|
7166
7370
|
loaded.dirName,
|
|
@@ -7211,10 +7415,11 @@ var skillsProcessorToolTargetTuple = [
|
|
|
7211
7415
|
"cursor",
|
|
7212
7416
|
"geminicli",
|
|
7213
7417
|
"kilo",
|
|
7418
|
+
"kiro",
|
|
7214
7419
|
"opencode",
|
|
7215
7420
|
"roo"
|
|
7216
7421
|
];
|
|
7217
|
-
var SkillsProcessorToolTargetSchema =
|
|
7422
|
+
var SkillsProcessorToolTargetSchema = z30.enum(skillsProcessorToolTargetTuple);
|
|
7218
7423
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
7219
7424
|
[
|
|
7220
7425
|
"agentsmd",
|
|
@@ -7279,6 +7484,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
7279
7484
|
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
7280
7485
|
}
|
|
7281
7486
|
],
|
|
7487
|
+
[
|
|
7488
|
+
"kiro",
|
|
7489
|
+
{
|
|
7490
|
+
class: KiroSkill,
|
|
7491
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: false }
|
|
7492
|
+
}
|
|
7493
|
+
],
|
|
7282
7494
|
[
|
|
7283
7495
|
"opencode",
|
|
7284
7496
|
{
|
|
@@ -7371,8 +7583,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7371
7583
|
*/
|
|
7372
7584
|
async loadRulesyncDirs() {
|
|
7373
7585
|
const paths = RulesyncSkill.getSettablePaths();
|
|
7374
|
-
const rulesyncSkillsDirPath =
|
|
7375
|
-
const dirPaths = await findFilesByGlobs(
|
|
7586
|
+
const rulesyncSkillsDirPath = join60(this.baseDir, paths.relativeDirPath);
|
|
7587
|
+
const dirPaths = await findFilesByGlobs(join60(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
7376
7588
|
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7377
7589
|
const rulesyncSkills = await Promise.all(
|
|
7378
7590
|
dirNames.map(
|
|
@@ -7389,8 +7601,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7389
7601
|
async loadToolDirs() {
|
|
7390
7602
|
const factory = this.getFactory(this.toolTarget);
|
|
7391
7603
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7392
|
-
const skillsDirPath =
|
|
7393
|
-
const dirPaths = await findFilesByGlobs(
|
|
7604
|
+
const skillsDirPath = join60(this.baseDir, paths.relativeDirPath);
|
|
7605
|
+
const dirPaths = await findFilesByGlobs(join60(skillsDirPath, "*"), { type: "dir" });
|
|
7394
7606
|
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7395
7607
|
const toolSkills = await Promise.all(
|
|
7396
7608
|
dirNames.map(
|
|
@@ -7407,8 +7619,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7407
7619
|
async loadToolDirsToDelete() {
|
|
7408
7620
|
const factory = this.getFactory(this.toolTarget);
|
|
7409
7621
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7410
|
-
const skillsDirPath =
|
|
7411
|
-
const dirPaths = await findFilesByGlobs(
|
|
7622
|
+
const skillsDirPath = join60(this.baseDir, paths.relativeDirPath);
|
|
7623
|
+
const dirPaths = await findFilesByGlobs(join60(skillsDirPath, "*"), { type: "dir" });
|
|
7412
7624
|
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7413
7625
|
const toolSkills = dirNames.map(
|
|
7414
7626
|
(dirName) => factory.class.forDeletion({
|
|
@@ -7457,11 +7669,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7457
7669
|
};
|
|
7458
7670
|
|
|
7459
7671
|
// src/features/subagents/agentsmd-subagent.ts
|
|
7460
|
-
import { join as
|
|
7672
|
+
import { join as join62 } from "path";
|
|
7461
7673
|
|
|
7462
7674
|
// src/features/subagents/simulated-subagent.ts
|
|
7463
|
-
import { basename as basename18, join as
|
|
7464
|
-
import { z as
|
|
7675
|
+
import { basename as basename18, join as join61 } from "path";
|
|
7676
|
+
import { z as z31 } from "zod/mini";
|
|
7465
7677
|
|
|
7466
7678
|
// src/features/subagents/tool-subagent.ts
|
|
7467
7679
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -7504,9 +7716,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
7504
7716
|
};
|
|
7505
7717
|
|
|
7506
7718
|
// src/features/subagents/simulated-subagent.ts
|
|
7507
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
7508
|
-
name:
|
|
7509
|
-
description:
|
|
7719
|
+
var SimulatedSubagentFrontmatterSchema = z31.object({
|
|
7720
|
+
name: z31.string(),
|
|
7721
|
+
description: z31.string()
|
|
7510
7722
|
});
|
|
7511
7723
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
7512
7724
|
frontmatter;
|
|
@@ -7516,7 +7728,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7516
7728
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7517
7729
|
if (!result.success) {
|
|
7518
7730
|
throw new Error(
|
|
7519
|
-
`Invalid frontmatter in ${
|
|
7731
|
+
`Invalid frontmatter in ${join61(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7520
7732
|
);
|
|
7521
7733
|
}
|
|
7522
7734
|
}
|
|
@@ -7567,7 +7779,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7567
7779
|
return {
|
|
7568
7780
|
success: false,
|
|
7569
7781
|
error: new Error(
|
|
7570
|
-
`Invalid frontmatter in ${
|
|
7782
|
+
`Invalid frontmatter in ${join61(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7571
7783
|
)
|
|
7572
7784
|
};
|
|
7573
7785
|
}
|
|
@@ -7577,7 +7789,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7577
7789
|
relativeFilePath,
|
|
7578
7790
|
validate = true
|
|
7579
7791
|
}) {
|
|
7580
|
-
const filePath =
|
|
7792
|
+
const filePath = join61(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
7581
7793
|
const fileContent = await readFileContent(filePath);
|
|
7582
7794
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7583
7795
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7613,7 +7825,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7613
7825
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
7614
7826
|
static getSettablePaths() {
|
|
7615
7827
|
return {
|
|
7616
|
-
relativeDirPath:
|
|
7828
|
+
relativeDirPath: join62(".agents", "subagents")
|
|
7617
7829
|
};
|
|
7618
7830
|
}
|
|
7619
7831
|
static async fromFile(params) {
|
|
@@ -7636,11 +7848,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
7636
7848
|
};
|
|
7637
7849
|
|
|
7638
7850
|
// src/features/subagents/codexcli-subagent.ts
|
|
7639
|
-
import { join as
|
|
7851
|
+
import { join as join63 } from "path";
|
|
7640
7852
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
7641
7853
|
static getSettablePaths() {
|
|
7642
7854
|
return {
|
|
7643
|
-
relativeDirPath:
|
|
7855
|
+
relativeDirPath: join63(".codex", "subagents")
|
|
7644
7856
|
};
|
|
7645
7857
|
}
|
|
7646
7858
|
static async fromFile(params) {
|
|
@@ -7663,11 +7875,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
7663
7875
|
};
|
|
7664
7876
|
|
|
7665
7877
|
// src/features/subagents/cursor-subagent.ts
|
|
7666
|
-
import { join as
|
|
7878
|
+
import { join as join64 } from "path";
|
|
7667
7879
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
7668
7880
|
static getSettablePaths() {
|
|
7669
7881
|
return {
|
|
7670
|
-
relativeDirPath:
|
|
7882
|
+
relativeDirPath: join64(".cursor", "subagents")
|
|
7671
7883
|
};
|
|
7672
7884
|
}
|
|
7673
7885
|
static async fromFile(params) {
|
|
@@ -7690,11 +7902,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
7690
7902
|
};
|
|
7691
7903
|
|
|
7692
7904
|
// src/features/subagents/geminicli-subagent.ts
|
|
7693
|
-
import { join as
|
|
7905
|
+
import { join as join65 } from "path";
|
|
7694
7906
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
7695
7907
|
static getSettablePaths() {
|
|
7696
7908
|
return {
|
|
7697
|
-
relativeDirPath:
|
|
7909
|
+
relativeDirPath: join65(".gemini", "subagents")
|
|
7698
7910
|
};
|
|
7699
7911
|
}
|
|
7700
7912
|
static async fromFile(params) {
|
|
@@ -7717,11 +7929,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
7717
7929
|
};
|
|
7718
7930
|
|
|
7719
7931
|
// src/features/subagents/roo-subagent.ts
|
|
7720
|
-
import { join as
|
|
7932
|
+
import { join as join66 } from "path";
|
|
7721
7933
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
7722
7934
|
static getSettablePaths() {
|
|
7723
7935
|
return {
|
|
7724
|
-
relativeDirPath:
|
|
7936
|
+
relativeDirPath: join66(".roo", "subagents")
|
|
7725
7937
|
};
|
|
7726
7938
|
}
|
|
7727
7939
|
static async fromFile(params) {
|
|
@@ -7744,20 +7956,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
7744
7956
|
};
|
|
7745
7957
|
|
|
7746
7958
|
// src/features/subagents/subagents-processor.ts
|
|
7747
|
-
import { basename as basename21, join as
|
|
7748
|
-
import { z as
|
|
7959
|
+
import { basename as basename21, join as join72 } from "path";
|
|
7960
|
+
import { z as z37 } from "zod/mini";
|
|
7749
7961
|
|
|
7750
7962
|
// src/features/subagents/claudecode-subagent.ts
|
|
7751
|
-
import { join as
|
|
7752
|
-
import { z as
|
|
7963
|
+
import { join as join68 } from "path";
|
|
7964
|
+
import { z as z33 } from "zod/mini";
|
|
7753
7965
|
|
|
7754
7966
|
// src/features/subagents/rulesync-subagent.ts
|
|
7755
|
-
import { basename as basename19, join as
|
|
7756
|
-
import { z as
|
|
7757
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
7967
|
+
import { basename as basename19, join as join67 } from "path";
|
|
7968
|
+
import { z as z32 } from "zod/mini";
|
|
7969
|
+
var RulesyncSubagentFrontmatterSchema = z32.looseObject({
|
|
7758
7970
|
targets: RulesyncTargetsSchema,
|
|
7759
|
-
name:
|
|
7760
|
-
description:
|
|
7971
|
+
name: z32.string(),
|
|
7972
|
+
description: z32.string()
|
|
7761
7973
|
});
|
|
7762
7974
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
7763
7975
|
frontmatter;
|
|
@@ -7767,7 +7979,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7767
7979
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7768
7980
|
if (!result.success) {
|
|
7769
7981
|
throw new Error(
|
|
7770
|
-
`Invalid frontmatter in ${
|
|
7982
|
+
`Invalid frontmatter in ${join67(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7771
7983
|
);
|
|
7772
7984
|
}
|
|
7773
7985
|
}
|
|
@@ -7800,7 +8012,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7800
8012
|
return {
|
|
7801
8013
|
success: false,
|
|
7802
8014
|
error: new Error(
|
|
7803
|
-
`Invalid frontmatter in ${
|
|
8015
|
+
`Invalid frontmatter in ${join67(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7804
8016
|
)
|
|
7805
8017
|
};
|
|
7806
8018
|
}
|
|
@@ -7809,7 +8021,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7809
8021
|
relativeFilePath
|
|
7810
8022
|
}) {
|
|
7811
8023
|
const fileContent = await readFileContent(
|
|
7812
|
-
|
|
8024
|
+
join67(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
7813
8025
|
);
|
|
7814
8026
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7815
8027
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7828,13 +8040,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7828
8040
|
};
|
|
7829
8041
|
|
|
7830
8042
|
// src/features/subagents/claudecode-subagent.ts
|
|
7831
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
7832
|
-
name:
|
|
7833
|
-
description:
|
|
7834
|
-
model:
|
|
7835
|
-
tools:
|
|
7836
|
-
permissionMode:
|
|
7837
|
-
skills:
|
|
8043
|
+
var ClaudecodeSubagentFrontmatterSchema = z33.looseObject({
|
|
8044
|
+
name: z33.string(),
|
|
8045
|
+
description: z33.string(),
|
|
8046
|
+
model: z33.optional(z33.string()),
|
|
8047
|
+
tools: z33.optional(z33.union([z33.string(), z33.array(z33.string())])),
|
|
8048
|
+
permissionMode: z33.optional(z33.string()),
|
|
8049
|
+
skills: z33.optional(z33.union([z33.string(), z33.array(z33.string())]))
|
|
7838
8050
|
});
|
|
7839
8051
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
7840
8052
|
frontmatter;
|
|
@@ -7844,7 +8056,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7844
8056
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7845
8057
|
if (!result.success) {
|
|
7846
8058
|
throw new Error(
|
|
7847
|
-
`Invalid frontmatter in ${
|
|
8059
|
+
`Invalid frontmatter in ${join68(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7848
8060
|
);
|
|
7849
8061
|
}
|
|
7850
8062
|
}
|
|
@@ -7856,7 +8068,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7856
8068
|
}
|
|
7857
8069
|
static getSettablePaths(_options = {}) {
|
|
7858
8070
|
return {
|
|
7859
|
-
relativeDirPath:
|
|
8071
|
+
relativeDirPath: join68(".claude", "agents")
|
|
7860
8072
|
};
|
|
7861
8073
|
}
|
|
7862
8074
|
getFrontmatter() {
|
|
@@ -7930,7 +8142,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7930
8142
|
return {
|
|
7931
8143
|
success: false,
|
|
7932
8144
|
error: new Error(
|
|
7933
|
-
`Invalid frontmatter in ${
|
|
8145
|
+
`Invalid frontmatter in ${join68(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7934
8146
|
)
|
|
7935
8147
|
};
|
|
7936
8148
|
}
|
|
@@ -7948,7 +8160,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7948
8160
|
global = false
|
|
7949
8161
|
}) {
|
|
7950
8162
|
const paths = this.getSettablePaths({ global });
|
|
7951
|
-
const filePath =
|
|
8163
|
+
const filePath = join68(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7952
8164
|
const fileContent = await readFileContent(filePath);
|
|
7953
8165
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7954
8166
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7983,13 +8195,13 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7983
8195
|
};
|
|
7984
8196
|
|
|
7985
8197
|
// src/features/subagents/copilot-subagent.ts
|
|
7986
|
-
import { join as
|
|
7987
|
-
import { z as
|
|
8198
|
+
import { join as join69 } from "path";
|
|
8199
|
+
import { z as z34 } from "zod/mini";
|
|
7988
8200
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
7989
|
-
var CopilotSubagentFrontmatterSchema =
|
|
7990
|
-
name:
|
|
7991
|
-
description:
|
|
7992
|
-
tools:
|
|
8201
|
+
var CopilotSubagentFrontmatterSchema = z34.looseObject({
|
|
8202
|
+
name: z34.string(),
|
|
8203
|
+
description: z34.string(),
|
|
8204
|
+
tools: z34.optional(z34.union([z34.string(), z34.array(z34.string())]))
|
|
7993
8205
|
});
|
|
7994
8206
|
var normalizeTools = (tools) => {
|
|
7995
8207
|
if (!tools) {
|
|
@@ -8009,7 +8221,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8009
8221
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8010
8222
|
if (!result.success) {
|
|
8011
8223
|
throw new Error(
|
|
8012
|
-
`Invalid frontmatter in ${
|
|
8224
|
+
`Invalid frontmatter in ${join69(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8013
8225
|
);
|
|
8014
8226
|
}
|
|
8015
8227
|
}
|
|
@@ -8021,7 +8233,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8021
8233
|
}
|
|
8022
8234
|
static getSettablePaths(_options = {}) {
|
|
8023
8235
|
return {
|
|
8024
|
-
relativeDirPath:
|
|
8236
|
+
relativeDirPath: join69(".github", "agents")
|
|
8025
8237
|
};
|
|
8026
8238
|
}
|
|
8027
8239
|
getFrontmatter() {
|
|
@@ -8095,7 +8307,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8095
8307
|
return {
|
|
8096
8308
|
success: false,
|
|
8097
8309
|
error: new Error(
|
|
8098
|
-
`Invalid frontmatter in ${
|
|
8310
|
+
`Invalid frontmatter in ${join69(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8099
8311
|
)
|
|
8100
8312
|
};
|
|
8101
8313
|
}
|
|
@@ -8113,7 +8325,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8113
8325
|
global = false
|
|
8114
8326
|
}) {
|
|
8115
8327
|
const paths = this.getSettablePaths({ global });
|
|
8116
|
-
const filePath =
|
|
8328
|
+
const filePath = join69(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8117
8329
|
const fileContent = await readFileContent(filePath);
|
|
8118
8330
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8119
8331
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8149,23 +8361,23 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8149
8361
|
};
|
|
8150
8362
|
|
|
8151
8363
|
// src/features/subagents/kiro-subagent.ts
|
|
8152
|
-
import { join as
|
|
8153
|
-
import { z as
|
|
8154
|
-
var KiroCliSubagentJsonSchema =
|
|
8155
|
-
name:
|
|
8156
|
-
description:
|
|
8157
|
-
prompt:
|
|
8158
|
-
tools:
|
|
8159
|
-
toolAliases:
|
|
8160
|
-
toolSettings:
|
|
8161
|
-
toolSchema:
|
|
8162
|
-
hooks:
|
|
8163
|
-
model:
|
|
8164
|
-
mcpServers:
|
|
8165
|
-
useLegacyMcpJson:
|
|
8166
|
-
resources:
|
|
8167
|
-
allowedTools:
|
|
8168
|
-
includeMcpJson:
|
|
8364
|
+
import { join as join70 } from "path";
|
|
8365
|
+
import { z as z35 } from "zod/mini";
|
|
8366
|
+
var KiroCliSubagentJsonSchema = z35.looseObject({
|
|
8367
|
+
name: z35.string(),
|
|
8368
|
+
description: z35.optional(z35.nullable(z35.string())),
|
|
8369
|
+
prompt: z35.optional(z35.nullable(z35.string())),
|
|
8370
|
+
tools: z35.optional(z35.nullable(z35.array(z35.string()))),
|
|
8371
|
+
toolAliases: z35.optional(z35.nullable(z35.record(z35.string(), z35.string()))),
|
|
8372
|
+
toolSettings: z35.optional(z35.nullable(z35.unknown())),
|
|
8373
|
+
toolSchema: z35.optional(z35.nullable(z35.unknown())),
|
|
8374
|
+
hooks: z35.optional(z35.nullable(z35.record(z35.string(), z35.array(z35.unknown())))),
|
|
8375
|
+
model: z35.optional(z35.nullable(z35.string())),
|
|
8376
|
+
mcpServers: z35.optional(z35.nullable(z35.record(z35.string(), z35.unknown()))),
|
|
8377
|
+
useLegacyMcpJson: z35.optional(z35.nullable(z35.boolean())),
|
|
8378
|
+
resources: z35.optional(z35.nullable(z35.array(z35.string()))),
|
|
8379
|
+
allowedTools: z35.optional(z35.nullable(z35.array(z35.string()))),
|
|
8380
|
+
includeMcpJson: z35.optional(z35.nullable(z35.boolean()))
|
|
8169
8381
|
});
|
|
8170
8382
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
8171
8383
|
body;
|
|
@@ -8177,7 +8389,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8177
8389
|
}
|
|
8178
8390
|
static getSettablePaths(_options = {}) {
|
|
8179
8391
|
return {
|
|
8180
|
-
relativeDirPath:
|
|
8392
|
+
relativeDirPath: join70(".kiro", "agents")
|
|
8181
8393
|
};
|
|
8182
8394
|
}
|
|
8183
8395
|
getBody() {
|
|
@@ -8257,7 +8469,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8257
8469
|
global = false
|
|
8258
8470
|
}) {
|
|
8259
8471
|
const paths = this.getSettablePaths({ global });
|
|
8260
|
-
const filePath =
|
|
8472
|
+
const filePath = join70(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8261
8473
|
const fileContent = await readFileContent(filePath);
|
|
8262
8474
|
return new _KiroSubagent({
|
|
8263
8475
|
baseDir,
|
|
@@ -8286,12 +8498,12 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8286
8498
|
};
|
|
8287
8499
|
|
|
8288
8500
|
// src/features/subagents/opencode-subagent.ts
|
|
8289
|
-
import { basename as basename20, join as
|
|
8290
|
-
import { z as
|
|
8291
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
8292
|
-
description:
|
|
8293
|
-
mode:
|
|
8294
|
-
name:
|
|
8501
|
+
import { basename as basename20, join as join71 } from "path";
|
|
8502
|
+
import { z as z36 } from "zod/mini";
|
|
8503
|
+
var OpenCodeSubagentFrontmatterSchema = z36.looseObject({
|
|
8504
|
+
description: z36.string(),
|
|
8505
|
+
mode: z36.literal("subagent"),
|
|
8506
|
+
name: z36.optional(z36.string())
|
|
8295
8507
|
});
|
|
8296
8508
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
8297
8509
|
frontmatter;
|
|
@@ -8301,7 +8513,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8301
8513
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8302
8514
|
if (!result.success) {
|
|
8303
8515
|
throw new Error(
|
|
8304
|
-
`Invalid frontmatter in ${
|
|
8516
|
+
`Invalid frontmatter in ${join71(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8305
8517
|
);
|
|
8306
8518
|
}
|
|
8307
8519
|
}
|
|
@@ -8315,7 +8527,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8315
8527
|
global = false
|
|
8316
8528
|
} = {}) {
|
|
8317
8529
|
return {
|
|
8318
|
-
relativeDirPath: global ?
|
|
8530
|
+
relativeDirPath: global ? join71(".config", "opencode", "agent") : join71(".opencode", "agent")
|
|
8319
8531
|
};
|
|
8320
8532
|
}
|
|
8321
8533
|
getFrontmatter() {
|
|
@@ -8381,7 +8593,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8381
8593
|
return {
|
|
8382
8594
|
success: false,
|
|
8383
8595
|
error: new Error(
|
|
8384
|
-
`Invalid frontmatter in ${
|
|
8596
|
+
`Invalid frontmatter in ${join71(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8385
8597
|
)
|
|
8386
8598
|
};
|
|
8387
8599
|
}
|
|
@@ -8398,7 +8610,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8398
8610
|
global = false
|
|
8399
8611
|
}) {
|
|
8400
8612
|
const paths = this.getSettablePaths({ global });
|
|
8401
|
-
const filePath =
|
|
8613
|
+
const filePath = join71(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8402
8614
|
const fileContent = await readFileContent(filePath);
|
|
8403
8615
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8404
8616
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8446,7 +8658,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
8446
8658
|
"opencode",
|
|
8447
8659
|
"roo"
|
|
8448
8660
|
];
|
|
8449
|
-
var SubagentsProcessorToolTargetSchema =
|
|
8661
|
+
var SubagentsProcessorToolTargetSchema = z37.enum(subagentsProcessorToolTargetTuple);
|
|
8450
8662
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
8451
8663
|
[
|
|
8452
8664
|
"agentsmd",
|
|
@@ -8600,7 +8812,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8600
8812
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
8601
8813
|
*/
|
|
8602
8814
|
async loadRulesyncFiles() {
|
|
8603
|
-
const subagentsDir =
|
|
8815
|
+
const subagentsDir = join72(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
8604
8816
|
const dirExists = await directoryExists(subagentsDir);
|
|
8605
8817
|
if (!dirExists) {
|
|
8606
8818
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -8615,7 +8827,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8615
8827
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
8616
8828
|
const rulesyncSubagents = [];
|
|
8617
8829
|
for (const mdFile of mdFiles) {
|
|
8618
|
-
const filepath =
|
|
8830
|
+
const filepath = join72(subagentsDir, mdFile);
|
|
8619
8831
|
try {
|
|
8620
8832
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
8621
8833
|
relativeFilePath: mdFile,
|
|
@@ -8645,7 +8857,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8645
8857
|
const factory = this.getFactory(this.toolTarget);
|
|
8646
8858
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
8647
8859
|
const subagentFilePaths = await findFilesByGlobs(
|
|
8648
|
-
|
|
8860
|
+
join72(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
8649
8861
|
);
|
|
8650
8862
|
if (forDeletion) {
|
|
8651
8863
|
const toolSubagents2 = subagentFilePaths.map(
|
|
@@ -8695,48 +8907,48 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8695
8907
|
};
|
|
8696
8908
|
|
|
8697
8909
|
// src/features/rules/agentsmd-rule.ts
|
|
8698
|
-
import { join as
|
|
8910
|
+
import { join as join75 } from "path";
|
|
8699
8911
|
|
|
8700
8912
|
// src/features/rules/tool-rule.ts
|
|
8701
|
-
import { join as
|
|
8913
|
+
import { join as join74 } from "path";
|
|
8702
8914
|
|
|
8703
8915
|
// src/features/rules/rulesync-rule.ts
|
|
8704
|
-
import { basename as basename22, join as
|
|
8705
|
-
import { z as
|
|
8706
|
-
var RulesyncRuleFrontmatterSchema =
|
|
8707
|
-
root:
|
|
8708
|
-
targets:
|
|
8709
|
-
description:
|
|
8710
|
-
globs:
|
|
8711
|
-
agentsmd:
|
|
8712
|
-
|
|
8916
|
+
import { basename as basename22, join as join73 } from "path";
|
|
8917
|
+
import { z as z38 } from "zod/mini";
|
|
8918
|
+
var RulesyncRuleFrontmatterSchema = z38.object({
|
|
8919
|
+
root: z38.optional(z38.optional(z38.boolean())),
|
|
8920
|
+
targets: z38.optional(RulesyncTargetsSchema),
|
|
8921
|
+
description: z38.optional(z38.string()),
|
|
8922
|
+
globs: z38.optional(z38.array(z38.string())),
|
|
8923
|
+
agentsmd: z38.optional(
|
|
8924
|
+
z38.object({
|
|
8713
8925
|
// @example "path/to/subproject"
|
|
8714
|
-
subprojectPath:
|
|
8926
|
+
subprojectPath: z38.optional(z38.string())
|
|
8715
8927
|
})
|
|
8716
8928
|
),
|
|
8717
|
-
claudecode:
|
|
8718
|
-
|
|
8929
|
+
claudecode: z38.optional(
|
|
8930
|
+
z38.object({
|
|
8719
8931
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
8720
8932
|
// @example "src/**/*.ts, tests/**/*.test.ts"
|
|
8721
|
-
paths:
|
|
8933
|
+
paths: z38.optional(z38.string())
|
|
8722
8934
|
})
|
|
8723
8935
|
),
|
|
8724
|
-
cursor:
|
|
8725
|
-
|
|
8726
|
-
alwaysApply:
|
|
8727
|
-
description:
|
|
8728
|
-
globs:
|
|
8936
|
+
cursor: z38.optional(
|
|
8937
|
+
z38.object({
|
|
8938
|
+
alwaysApply: z38.optional(z38.boolean()),
|
|
8939
|
+
description: z38.optional(z38.string()),
|
|
8940
|
+
globs: z38.optional(z38.array(z38.string()))
|
|
8729
8941
|
})
|
|
8730
8942
|
),
|
|
8731
|
-
copilot:
|
|
8732
|
-
|
|
8733
|
-
excludeAgent:
|
|
8943
|
+
copilot: z38.optional(
|
|
8944
|
+
z38.object({
|
|
8945
|
+
excludeAgent: z38.optional(z38.union([z38.literal("code-review"), z38.literal("coding-agent")]))
|
|
8734
8946
|
})
|
|
8735
8947
|
),
|
|
8736
|
-
antigravity:
|
|
8737
|
-
|
|
8738
|
-
trigger:
|
|
8739
|
-
globs:
|
|
8948
|
+
antigravity: z38.optional(
|
|
8949
|
+
z38.looseObject({
|
|
8950
|
+
trigger: z38.optional(z38.string()),
|
|
8951
|
+
globs: z38.optional(z38.array(z38.string()))
|
|
8740
8952
|
})
|
|
8741
8953
|
)
|
|
8742
8954
|
});
|
|
@@ -8748,7 +8960,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8748
8960
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8749
8961
|
if (!result.success) {
|
|
8750
8962
|
throw new Error(
|
|
8751
|
-
`Invalid frontmatter in ${
|
|
8963
|
+
`Invalid frontmatter in ${join73(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8752
8964
|
);
|
|
8753
8965
|
}
|
|
8754
8966
|
}
|
|
@@ -8783,7 +8995,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8783
8995
|
return {
|
|
8784
8996
|
success: false,
|
|
8785
8997
|
error: new Error(
|
|
8786
|
-
`Invalid frontmatter in ${
|
|
8998
|
+
`Invalid frontmatter in ${join73(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8787
8999
|
)
|
|
8788
9000
|
};
|
|
8789
9001
|
}
|
|
@@ -8792,12 +9004,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8792
9004
|
relativeFilePath,
|
|
8793
9005
|
validate = true
|
|
8794
9006
|
}) {
|
|
8795
|
-
const legacyPath =
|
|
9007
|
+
const legacyPath = join73(
|
|
8796
9008
|
process.cwd(),
|
|
8797
9009
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
8798
9010
|
relativeFilePath
|
|
8799
9011
|
);
|
|
8800
|
-
const recommendedPath =
|
|
9012
|
+
const recommendedPath = join73(
|
|
8801
9013
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8802
9014
|
relativeFilePath
|
|
8803
9015
|
);
|
|
@@ -8832,7 +9044,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8832
9044
|
relativeFilePath,
|
|
8833
9045
|
validate = true
|
|
8834
9046
|
}) {
|
|
8835
|
-
const filePath =
|
|
9047
|
+
const filePath = join73(
|
|
8836
9048
|
process.cwd(),
|
|
8837
9049
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8838
9050
|
relativeFilePath
|
|
@@ -8934,7 +9146,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8934
9146
|
rulesyncRule,
|
|
8935
9147
|
validate = true,
|
|
8936
9148
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
8937
|
-
nonRootPath = { relativeDirPath:
|
|
9149
|
+
nonRootPath = { relativeDirPath: join74(".agents", "memories") }
|
|
8938
9150
|
}) {
|
|
8939
9151
|
const params = this.buildToolRuleParamsDefault({
|
|
8940
9152
|
baseDir,
|
|
@@ -8945,7 +9157,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8945
9157
|
});
|
|
8946
9158
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
8947
9159
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
8948
|
-
params.relativeDirPath =
|
|
9160
|
+
params.relativeDirPath = join74(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
8949
9161
|
params.relativeFilePath = "AGENTS.md";
|
|
8950
9162
|
}
|
|
8951
9163
|
return params;
|
|
@@ -9010,7 +9222,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9010
9222
|
relativeFilePath: "AGENTS.md"
|
|
9011
9223
|
},
|
|
9012
9224
|
nonRoot: {
|
|
9013
|
-
relativeDirPath:
|
|
9225
|
+
relativeDirPath: join75(".agents", "memories")
|
|
9014
9226
|
}
|
|
9015
9227
|
};
|
|
9016
9228
|
}
|
|
@@ -9020,8 +9232,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9020
9232
|
validate = true
|
|
9021
9233
|
}) {
|
|
9022
9234
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
9023
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
9024
|
-
const fileContent = await readFileContent(
|
|
9235
|
+
const relativePath = isRoot ? "AGENTS.md" : join75(".agents", "memories", relativeFilePath);
|
|
9236
|
+
const fileContent = await readFileContent(join75(baseDir, relativePath));
|
|
9025
9237
|
return new _AgentsMdRule({
|
|
9026
9238
|
baseDir,
|
|
9027
9239
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9076,21 +9288,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9076
9288
|
};
|
|
9077
9289
|
|
|
9078
9290
|
// src/features/rules/antigravity-rule.ts
|
|
9079
|
-
import { join as
|
|
9080
|
-
import { z as
|
|
9081
|
-
var AntigravityRuleFrontmatterSchema =
|
|
9082
|
-
trigger:
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
|
|
9088
|
-
|
|
9291
|
+
import { join as join76 } from "path";
|
|
9292
|
+
import { z as z39 } from "zod/mini";
|
|
9293
|
+
var AntigravityRuleFrontmatterSchema = z39.looseObject({
|
|
9294
|
+
trigger: z39.optional(
|
|
9295
|
+
z39.union([
|
|
9296
|
+
z39.literal("always_on"),
|
|
9297
|
+
z39.literal("glob"),
|
|
9298
|
+
z39.literal("manual"),
|
|
9299
|
+
z39.literal("model_decision"),
|
|
9300
|
+
z39.string()
|
|
9089
9301
|
// accepts any string for forward compatibility
|
|
9090
9302
|
])
|
|
9091
9303
|
),
|
|
9092
|
-
globs:
|
|
9093
|
-
description:
|
|
9304
|
+
globs: z39.optional(z39.string()),
|
|
9305
|
+
description: z39.optional(z39.string())
|
|
9094
9306
|
});
|
|
9095
9307
|
function parseGlobsString(globs) {
|
|
9096
9308
|
if (!globs) {
|
|
@@ -9235,7 +9447,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9235
9447
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9236
9448
|
if (!result.success) {
|
|
9237
9449
|
throw new Error(
|
|
9238
|
-
`Invalid frontmatter in ${
|
|
9450
|
+
`Invalid frontmatter in ${join76(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9239
9451
|
);
|
|
9240
9452
|
}
|
|
9241
9453
|
}
|
|
@@ -9250,7 +9462,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9250
9462
|
static getSettablePaths() {
|
|
9251
9463
|
return {
|
|
9252
9464
|
nonRoot: {
|
|
9253
|
-
relativeDirPath:
|
|
9465
|
+
relativeDirPath: join76(".agent", "rules")
|
|
9254
9466
|
}
|
|
9255
9467
|
};
|
|
9256
9468
|
}
|
|
@@ -9259,7 +9471,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9259
9471
|
relativeFilePath,
|
|
9260
9472
|
validate = true
|
|
9261
9473
|
}) {
|
|
9262
|
-
const filePath =
|
|
9474
|
+
const filePath = join76(
|
|
9263
9475
|
baseDir,
|
|
9264
9476
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
9265
9477
|
relativeFilePath
|
|
@@ -9400,7 +9612,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9400
9612
|
};
|
|
9401
9613
|
|
|
9402
9614
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
9403
|
-
import { join as
|
|
9615
|
+
import { join as join77 } from "path";
|
|
9404
9616
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
9405
9617
|
toRulesyncRule() {
|
|
9406
9618
|
const rulesyncFrontmatter = {
|
|
@@ -9426,7 +9638,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9426
9638
|
relativeFilePath: ".augment-guidelines"
|
|
9427
9639
|
},
|
|
9428
9640
|
nonRoot: {
|
|
9429
|
-
relativeDirPath:
|
|
9641
|
+
relativeDirPath: join77(".augment", "rules")
|
|
9430
9642
|
}
|
|
9431
9643
|
};
|
|
9432
9644
|
}
|
|
@@ -9461,8 +9673,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9461
9673
|
}) {
|
|
9462
9674
|
const settablePaths = this.getSettablePaths();
|
|
9463
9675
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
9464
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
9465
|
-
const fileContent = await readFileContent(
|
|
9676
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join77(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9677
|
+
const fileContent = await readFileContent(join77(baseDir, relativePath));
|
|
9466
9678
|
return new _AugmentcodeLegacyRule({
|
|
9467
9679
|
baseDir,
|
|
9468
9680
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -9491,7 +9703,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9491
9703
|
};
|
|
9492
9704
|
|
|
9493
9705
|
// src/features/rules/augmentcode-rule.ts
|
|
9494
|
-
import { join as
|
|
9706
|
+
import { join as join78 } from "path";
|
|
9495
9707
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
9496
9708
|
toRulesyncRule() {
|
|
9497
9709
|
return this.toRulesyncRuleDefault();
|
|
@@ -9499,7 +9711,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9499
9711
|
static getSettablePaths() {
|
|
9500
9712
|
return {
|
|
9501
9713
|
nonRoot: {
|
|
9502
|
-
relativeDirPath:
|
|
9714
|
+
relativeDirPath: join78(".augment", "rules")
|
|
9503
9715
|
}
|
|
9504
9716
|
};
|
|
9505
9717
|
}
|
|
@@ -9523,7 +9735,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9523
9735
|
validate = true
|
|
9524
9736
|
}) {
|
|
9525
9737
|
const fileContent = await readFileContent(
|
|
9526
|
-
|
|
9738
|
+
join78(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9527
9739
|
);
|
|
9528
9740
|
const { body: content } = parseFrontmatter(fileContent);
|
|
9529
9741
|
return new _AugmentcodeRule({
|
|
@@ -9559,7 +9771,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9559
9771
|
};
|
|
9560
9772
|
|
|
9561
9773
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
9562
|
-
import { join as
|
|
9774
|
+
import { join as join79 } from "path";
|
|
9563
9775
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
9564
9776
|
static getSettablePaths({
|
|
9565
9777
|
global
|
|
@@ -9578,7 +9790,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9578
9790
|
relativeFilePath: "CLAUDE.md"
|
|
9579
9791
|
},
|
|
9580
9792
|
nonRoot: {
|
|
9581
|
-
relativeDirPath:
|
|
9793
|
+
relativeDirPath: join79(".claude", "memories")
|
|
9582
9794
|
}
|
|
9583
9795
|
};
|
|
9584
9796
|
}
|
|
@@ -9593,7 +9805,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9593
9805
|
if (isRoot) {
|
|
9594
9806
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9595
9807
|
const fileContent2 = await readFileContent(
|
|
9596
|
-
|
|
9808
|
+
join79(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9597
9809
|
);
|
|
9598
9810
|
return new _ClaudecodeLegacyRule({
|
|
9599
9811
|
baseDir,
|
|
@@ -9607,8 +9819,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9607
9819
|
if (!paths.nonRoot) {
|
|
9608
9820
|
throw new Error("nonRoot path is not set");
|
|
9609
9821
|
}
|
|
9610
|
-
const relativePath =
|
|
9611
|
-
const fileContent = await readFileContent(
|
|
9822
|
+
const relativePath = join79(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9823
|
+
const fileContent = await readFileContent(join79(baseDir, relativePath));
|
|
9612
9824
|
return new _ClaudecodeLegacyRule({
|
|
9613
9825
|
baseDir,
|
|
9614
9826
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9667,10 +9879,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9667
9879
|
};
|
|
9668
9880
|
|
|
9669
9881
|
// src/features/rules/claudecode-rule.ts
|
|
9670
|
-
import { join as
|
|
9671
|
-
import { z as
|
|
9672
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
9673
|
-
paths:
|
|
9882
|
+
import { join as join80 } from "path";
|
|
9883
|
+
import { z as z40 } from "zod/mini";
|
|
9884
|
+
var ClaudecodeRuleFrontmatterSchema = z40.object({
|
|
9885
|
+
paths: z40.optional(z40.string())
|
|
9674
9886
|
});
|
|
9675
9887
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
9676
9888
|
frontmatter;
|
|
@@ -9692,7 +9904,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9692
9904
|
relativeFilePath: "CLAUDE.md"
|
|
9693
9905
|
},
|
|
9694
9906
|
nonRoot: {
|
|
9695
|
-
relativeDirPath:
|
|
9907
|
+
relativeDirPath: join80(".claude", "rules")
|
|
9696
9908
|
}
|
|
9697
9909
|
};
|
|
9698
9910
|
}
|
|
@@ -9701,7 +9913,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9701
9913
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9702
9914
|
if (!result.success) {
|
|
9703
9915
|
throw new Error(
|
|
9704
|
-
`Invalid frontmatter in ${
|
|
9916
|
+
`Invalid frontmatter in ${join80(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9705
9917
|
);
|
|
9706
9918
|
}
|
|
9707
9919
|
}
|
|
@@ -9729,7 +9941,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9729
9941
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
9730
9942
|
if (isRoot) {
|
|
9731
9943
|
const fileContent2 = await readFileContent(
|
|
9732
|
-
|
|
9944
|
+
join80(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
9733
9945
|
);
|
|
9734
9946
|
return new _ClaudecodeRule({
|
|
9735
9947
|
baseDir,
|
|
@@ -9744,13 +9956,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9744
9956
|
if (!paths.nonRoot) {
|
|
9745
9957
|
throw new Error("nonRoot path is not set");
|
|
9746
9958
|
}
|
|
9747
|
-
const relativePath =
|
|
9748
|
-
const fileContent = await readFileContent(
|
|
9959
|
+
const relativePath = join80(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9960
|
+
const fileContent = await readFileContent(join80(baseDir, relativePath));
|
|
9749
9961
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9750
9962
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9751
9963
|
if (!result.success) {
|
|
9752
9964
|
throw new Error(
|
|
9753
|
-
`Invalid frontmatter in ${
|
|
9965
|
+
`Invalid frontmatter in ${join80(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
9754
9966
|
);
|
|
9755
9967
|
}
|
|
9756
9968
|
return new _ClaudecodeRule({
|
|
@@ -9857,7 +10069,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9857
10069
|
return {
|
|
9858
10070
|
success: false,
|
|
9859
10071
|
error: new Error(
|
|
9860
|
-
`Invalid frontmatter in ${
|
|
10072
|
+
`Invalid frontmatter in ${join80(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9861
10073
|
)
|
|
9862
10074
|
};
|
|
9863
10075
|
}
|
|
@@ -9877,10 +10089,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9877
10089
|
};
|
|
9878
10090
|
|
|
9879
10091
|
// src/features/rules/cline-rule.ts
|
|
9880
|
-
import { join as
|
|
9881
|
-
import { z as
|
|
9882
|
-
var ClineRuleFrontmatterSchema =
|
|
9883
|
-
description:
|
|
10092
|
+
import { join as join81 } from "path";
|
|
10093
|
+
import { z as z41 } from "zod/mini";
|
|
10094
|
+
var ClineRuleFrontmatterSchema = z41.object({
|
|
10095
|
+
description: z41.string()
|
|
9884
10096
|
});
|
|
9885
10097
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
9886
10098
|
static getSettablePaths() {
|
|
@@ -9922,7 +10134,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9922
10134
|
validate = true
|
|
9923
10135
|
}) {
|
|
9924
10136
|
const fileContent = await readFileContent(
|
|
9925
|
-
|
|
10137
|
+
join81(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9926
10138
|
);
|
|
9927
10139
|
return new _ClineRule({
|
|
9928
10140
|
baseDir,
|
|
@@ -9948,7 +10160,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9948
10160
|
};
|
|
9949
10161
|
|
|
9950
10162
|
// src/features/rules/codexcli-rule.ts
|
|
9951
|
-
import { join as
|
|
10163
|
+
import { join as join82 } from "path";
|
|
9952
10164
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
9953
10165
|
static getSettablePaths({
|
|
9954
10166
|
global
|
|
@@ -9967,7 +10179,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9967
10179
|
relativeFilePath: "AGENTS.md"
|
|
9968
10180
|
},
|
|
9969
10181
|
nonRoot: {
|
|
9970
|
-
relativeDirPath:
|
|
10182
|
+
relativeDirPath: join82(".codex", "memories")
|
|
9971
10183
|
}
|
|
9972
10184
|
};
|
|
9973
10185
|
}
|
|
@@ -9982,7 +10194,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9982
10194
|
if (isRoot) {
|
|
9983
10195
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9984
10196
|
const fileContent2 = await readFileContent(
|
|
9985
|
-
|
|
10197
|
+
join82(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9986
10198
|
);
|
|
9987
10199
|
return new _CodexcliRule({
|
|
9988
10200
|
baseDir,
|
|
@@ -9996,8 +10208,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9996
10208
|
if (!paths.nonRoot) {
|
|
9997
10209
|
throw new Error("nonRoot path is not set");
|
|
9998
10210
|
}
|
|
9999
|
-
const relativePath =
|
|
10000
|
-
const fileContent = await readFileContent(
|
|
10211
|
+
const relativePath = join82(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10212
|
+
const fileContent = await readFileContent(join82(baseDir, relativePath));
|
|
10001
10213
|
return new _CodexcliRule({
|
|
10002
10214
|
baseDir,
|
|
10003
10215
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10056,12 +10268,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10056
10268
|
};
|
|
10057
10269
|
|
|
10058
10270
|
// src/features/rules/copilot-rule.ts
|
|
10059
|
-
import { join as
|
|
10060
|
-
import { z as
|
|
10061
|
-
var CopilotRuleFrontmatterSchema =
|
|
10062
|
-
description:
|
|
10063
|
-
applyTo:
|
|
10064
|
-
excludeAgent:
|
|
10271
|
+
import { join as join83 } from "path";
|
|
10272
|
+
import { z as z42 } from "zod/mini";
|
|
10273
|
+
var CopilotRuleFrontmatterSchema = z42.object({
|
|
10274
|
+
description: z42.optional(z42.string()),
|
|
10275
|
+
applyTo: z42.optional(z42.string()),
|
|
10276
|
+
excludeAgent: z42.optional(z42.union([z42.literal("code-review"), z42.literal("coding-agent")]))
|
|
10065
10277
|
});
|
|
10066
10278
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
10067
10279
|
frontmatter;
|
|
@@ -10073,7 +10285,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10073
10285
|
relativeFilePath: "copilot-instructions.md"
|
|
10074
10286
|
},
|
|
10075
10287
|
nonRoot: {
|
|
10076
|
-
relativeDirPath:
|
|
10288
|
+
relativeDirPath: join83(".github", "instructions")
|
|
10077
10289
|
}
|
|
10078
10290
|
};
|
|
10079
10291
|
}
|
|
@@ -10082,7 +10294,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10082
10294
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10083
10295
|
if (!result.success) {
|
|
10084
10296
|
throw new Error(
|
|
10085
|
-
`Invalid frontmatter in ${
|
|
10297
|
+
`Invalid frontmatter in ${join83(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10086
10298
|
);
|
|
10087
10299
|
}
|
|
10088
10300
|
}
|
|
@@ -10164,11 +10376,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10164
10376
|
validate = true
|
|
10165
10377
|
}) {
|
|
10166
10378
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
10167
|
-
const relativePath = isRoot ?
|
|
10379
|
+
const relativePath = isRoot ? join83(
|
|
10168
10380
|
this.getSettablePaths().root.relativeDirPath,
|
|
10169
10381
|
this.getSettablePaths().root.relativeFilePath
|
|
10170
|
-
) :
|
|
10171
|
-
const fileContent = await readFileContent(
|
|
10382
|
+
) : join83(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10383
|
+
const fileContent = await readFileContent(join83(baseDir, relativePath));
|
|
10172
10384
|
if (isRoot) {
|
|
10173
10385
|
return new _CopilotRule({
|
|
10174
10386
|
baseDir,
|
|
@@ -10184,7 +10396,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10184
10396
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10185
10397
|
if (!result.success) {
|
|
10186
10398
|
throw new Error(
|
|
10187
|
-
`Invalid frontmatter in ${
|
|
10399
|
+
`Invalid frontmatter in ${join83(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10188
10400
|
);
|
|
10189
10401
|
}
|
|
10190
10402
|
return new _CopilotRule({
|
|
@@ -10224,7 +10436,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10224
10436
|
return {
|
|
10225
10437
|
success: false,
|
|
10226
10438
|
error: new Error(
|
|
10227
|
-
`Invalid frontmatter in ${
|
|
10439
|
+
`Invalid frontmatter in ${join83(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10228
10440
|
)
|
|
10229
10441
|
};
|
|
10230
10442
|
}
|
|
@@ -10244,12 +10456,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10244
10456
|
};
|
|
10245
10457
|
|
|
10246
10458
|
// src/features/rules/cursor-rule.ts
|
|
10247
|
-
import { basename as basename23, join as
|
|
10248
|
-
import { z as
|
|
10249
|
-
var CursorRuleFrontmatterSchema =
|
|
10250
|
-
description:
|
|
10251
|
-
globs:
|
|
10252
|
-
alwaysApply:
|
|
10459
|
+
import { basename as basename23, join as join84 } from "path";
|
|
10460
|
+
import { z as z43 } from "zod/mini";
|
|
10461
|
+
var CursorRuleFrontmatterSchema = z43.object({
|
|
10462
|
+
description: z43.optional(z43.string()),
|
|
10463
|
+
globs: z43.optional(z43.string()),
|
|
10464
|
+
alwaysApply: z43.optional(z43.boolean())
|
|
10253
10465
|
});
|
|
10254
10466
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
10255
10467
|
frontmatter;
|
|
@@ -10257,7 +10469,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10257
10469
|
static getSettablePaths() {
|
|
10258
10470
|
return {
|
|
10259
10471
|
nonRoot: {
|
|
10260
|
-
relativeDirPath:
|
|
10472
|
+
relativeDirPath: join84(".cursor", "rules")
|
|
10261
10473
|
}
|
|
10262
10474
|
};
|
|
10263
10475
|
}
|
|
@@ -10266,7 +10478,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10266
10478
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10267
10479
|
if (!result.success) {
|
|
10268
10480
|
throw new Error(
|
|
10269
|
-
`Invalid frontmatter in ${
|
|
10481
|
+
`Invalid frontmatter in ${join84(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10270
10482
|
);
|
|
10271
10483
|
}
|
|
10272
10484
|
}
|
|
@@ -10383,13 +10595,13 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10383
10595
|
validate = true
|
|
10384
10596
|
}) {
|
|
10385
10597
|
const fileContent = await readFileContent(
|
|
10386
|
-
|
|
10598
|
+
join84(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10387
10599
|
);
|
|
10388
10600
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
10389
10601
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10390
10602
|
if (!result.success) {
|
|
10391
10603
|
throw new Error(
|
|
10392
|
-
`Invalid frontmatter in ${
|
|
10604
|
+
`Invalid frontmatter in ${join84(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10393
10605
|
);
|
|
10394
10606
|
}
|
|
10395
10607
|
return new _CursorRule({
|
|
@@ -10426,7 +10638,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10426
10638
|
return {
|
|
10427
10639
|
success: false,
|
|
10428
10640
|
error: new Error(
|
|
10429
|
-
`Invalid frontmatter in ${
|
|
10641
|
+
`Invalid frontmatter in ${join84(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10430
10642
|
)
|
|
10431
10643
|
};
|
|
10432
10644
|
}
|
|
@@ -10446,7 +10658,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10446
10658
|
};
|
|
10447
10659
|
|
|
10448
10660
|
// src/features/rules/geminicli-rule.ts
|
|
10449
|
-
import { join as
|
|
10661
|
+
import { join as join85 } from "path";
|
|
10450
10662
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
10451
10663
|
static getSettablePaths({
|
|
10452
10664
|
global
|
|
@@ -10465,7 +10677,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10465
10677
|
relativeFilePath: "GEMINI.md"
|
|
10466
10678
|
},
|
|
10467
10679
|
nonRoot: {
|
|
10468
|
-
relativeDirPath:
|
|
10680
|
+
relativeDirPath: join85(".gemini", "memories")
|
|
10469
10681
|
}
|
|
10470
10682
|
};
|
|
10471
10683
|
}
|
|
@@ -10480,7 +10692,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10480
10692
|
if (isRoot) {
|
|
10481
10693
|
const relativePath2 = paths.root.relativeFilePath;
|
|
10482
10694
|
const fileContent2 = await readFileContent(
|
|
10483
|
-
|
|
10695
|
+
join85(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
10484
10696
|
);
|
|
10485
10697
|
return new _GeminiCliRule({
|
|
10486
10698
|
baseDir,
|
|
@@ -10494,8 +10706,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10494
10706
|
if (!paths.nonRoot) {
|
|
10495
10707
|
throw new Error("nonRoot path is not set");
|
|
10496
10708
|
}
|
|
10497
|
-
const relativePath =
|
|
10498
|
-
const fileContent = await readFileContent(
|
|
10709
|
+
const relativePath = join85(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10710
|
+
const fileContent = await readFileContent(join85(baseDir, relativePath));
|
|
10499
10711
|
return new _GeminiCliRule({
|
|
10500
10712
|
baseDir,
|
|
10501
10713
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10554,7 +10766,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10554
10766
|
};
|
|
10555
10767
|
|
|
10556
10768
|
// src/features/rules/junie-rule.ts
|
|
10557
|
-
import { join as
|
|
10769
|
+
import { join as join86 } from "path";
|
|
10558
10770
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
10559
10771
|
static getSettablePaths() {
|
|
10560
10772
|
return {
|
|
@@ -10563,7 +10775,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10563
10775
|
relativeFilePath: "guidelines.md"
|
|
10564
10776
|
},
|
|
10565
10777
|
nonRoot: {
|
|
10566
|
-
relativeDirPath:
|
|
10778
|
+
relativeDirPath: join86(".junie", "memories")
|
|
10567
10779
|
}
|
|
10568
10780
|
};
|
|
10569
10781
|
}
|
|
@@ -10573,8 +10785,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10573
10785
|
validate = true
|
|
10574
10786
|
}) {
|
|
10575
10787
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
10576
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
10577
|
-
const fileContent = await readFileContent(
|
|
10788
|
+
const relativePath = isRoot ? "guidelines.md" : join86(".junie", "memories", relativeFilePath);
|
|
10789
|
+
const fileContent = await readFileContent(join86(baseDir, relativePath));
|
|
10578
10790
|
return new _JunieRule({
|
|
10579
10791
|
baseDir,
|
|
10580
10792
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10629,12 +10841,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10629
10841
|
};
|
|
10630
10842
|
|
|
10631
10843
|
// src/features/rules/kilo-rule.ts
|
|
10632
|
-
import { join as
|
|
10844
|
+
import { join as join87 } from "path";
|
|
10633
10845
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
10634
10846
|
static getSettablePaths(_options = {}) {
|
|
10635
10847
|
return {
|
|
10636
10848
|
nonRoot: {
|
|
10637
|
-
relativeDirPath:
|
|
10849
|
+
relativeDirPath: join87(".kilocode", "rules")
|
|
10638
10850
|
}
|
|
10639
10851
|
};
|
|
10640
10852
|
}
|
|
@@ -10644,7 +10856,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10644
10856
|
validate = true
|
|
10645
10857
|
}) {
|
|
10646
10858
|
const fileContent = await readFileContent(
|
|
10647
|
-
|
|
10859
|
+
join87(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10648
10860
|
);
|
|
10649
10861
|
return new _KiloRule({
|
|
10650
10862
|
baseDir,
|
|
@@ -10696,12 +10908,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10696
10908
|
};
|
|
10697
10909
|
|
|
10698
10910
|
// src/features/rules/kiro-rule.ts
|
|
10699
|
-
import { join as
|
|
10911
|
+
import { join as join88 } from "path";
|
|
10700
10912
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
10701
10913
|
static getSettablePaths() {
|
|
10702
10914
|
return {
|
|
10703
10915
|
nonRoot: {
|
|
10704
|
-
relativeDirPath:
|
|
10916
|
+
relativeDirPath: join88(".kiro", "steering")
|
|
10705
10917
|
}
|
|
10706
10918
|
};
|
|
10707
10919
|
}
|
|
@@ -10711,7 +10923,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10711
10923
|
validate = true
|
|
10712
10924
|
}) {
|
|
10713
10925
|
const fileContent = await readFileContent(
|
|
10714
|
-
|
|
10926
|
+
join88(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10715
10927
|
);
|
|
10716
10928
|
return new _KiroRule({
|
|
10717
10929
|
baseDir,
|
|
@@ -10765,7 +10977,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10765
10977
|
};
|
|
10766
10978
|
|
|
10767
10979
|
// src/features/rules/opencode-rule.ts
|
|
10768
|
-
import { join as
|
|
10980
|
+
import { join as join89 } from "path";
|
|
10769
10981
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
10770
10982
|
static getSettablePaths() {
|
|
10771
10983
|
return {
|
|
@@ -10774,7 +10986,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10774
10986
|
relativeFilePath: "AGENTS.md"
|
|
10775
10987
|
},
|
|
10776
10988
|
nonRoot: {
|
|
10777
|
-
relativeDirPath:
|
|
10989
|
+
relativeDirPath: join89(".opencode", "memories")
|
|
10778
10990
|
}
|
|
10779
10991
|
};
|
|
10780
10992
|
}
|
|
@@ -10784,8 +10996,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10784
10996
|
validate = true
|
|
10785
10997
|
}) {
|
|
10786
10998
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
10787
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
10788
|
-
const fileContent = await readFileContent(
|
|
10999
|
+
const relativePath = isRoot ? "AGENTS.md" : join89(".opencode", "memories", relativeFilePath);
|
|
11000
|
+
const fileContent = await readFileContent(join89(baseDir, relativePath));
|
|
10789
11001
|
return new _OpenCodeRule({
|
|
10790
11002
|
baseDir,
|
|
10791
11003
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10840,7 +11052,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10840
11052
|
};
|
|
10841
11053
|
|
|
10842
11054
|
// src/features/rules/qwencode-rule.ts
|
|
10843
|
-
import { join as
|
|
11055
|
+
import { join as join90 } from "path";
|
|
10844
11056
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
10845
11057
|
static getSettablePaths() {
|
|
10846
11058
|
return {
|
|
@@ -10849,7 +11061,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10849
11061
|
relativeFilePath: "QWEN.md"
|
|
10850
11062
|
},
|
|
10851
11063
|
nonRoot: {
|
|
10852
|
-
relativeDirPath:
|
|
11064
|
+
relativeDirPath: join90(".qwen", "memories")
|
|
10853
11065
|
}
|
|
10854
11066
|
};
|
|
10855
11067
|
}
|
|
@@ -10859,8 +11071,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10859
11071
|
validate = true
|
|
10860
11072
|
}) {
|
|
10861
11073
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
10862
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
10863
|
-
const fileContent = await readFileContent(
|
|
11074
|
+
const relativePath = isRoot ? "QWEN.md" : join90(".qwen", "memories", relativeFilePath);
|
|
11075
|
+
const fileContent = await readFileContent(join90(baseDir, relativePath));
|
|
10864
11076
|
return new _QwencodeRule({
|
|
10865
11077
|
baseDir,
|
|
10866
11078
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10912,7 +11124,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10912
11124
|
};
|
|
10913
11125
|
|
|
10914
11126
|
// src/features/rules/replit-rule.ts
|
|
10915
|
-
import { join as
|
|
11127
|
+
import { join as join91 } from "path";
|
|
10916
11128
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
10917
11129
|
static getSettablePaths() {
|
|
10918
11130
|
return {
|
|
@@ -10934,7 +11146,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
10934
11146
|
}
|
|
10935
11147
|
const relativePath = paths.root.relativeFilePath;
|
|
10936
11148
|
const fileContent = await readFileContent(
|
|
10937
|
-
|
|
11149
|
+
join91(baseDir, paths.root.relativeDirPath, relativePath)
|
|
10938
11150
|
);
|
|
10939
11151
|
return new _ReplitRule({
|
|
10940
11152
|
baseDir,
|
|
@@ -11000,12 +11212,12 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
11000
11212
|
};
|
|
11001
11213
|
|
|
11002
11214
|
// src/features/rules/roo-rule.ts
|
|
11003
|
-
import { join as
|
|
11215
|
+
import { join as join92 } from "path";
|
|
11004
11216
|
var RooRule = class _RooRule extends ToolRule {
|
|
11005
11217
|
static getSettablePaths() {
|
|
11006
11218
|
return {
|
|
11007
11219
|
nonRoot: {
|
|
11008
|
-
relativeDirPath:
|
|
11220
|
+
relativeDirPath: join92(".roo", "rules")
|
|
11009
11221
|
}
|
|
11010
11222
|
};
|
|
11011
11223
|
}
|
|
@@ -11015,7 +11227,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
11015
11227
|
validate = true
|
|
11016
11228
|
}) {
|
|
11017
11229
|
const fileContent = await readFileContent(
|
|
11018
|
-
|
|
11230
|
+
join92(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11019
11231
|
);
|
|
11020
11232
|
return new _RooRule({
|
|
11021
11233
|
baseDir,
|
|
@@ -11084,7 +11296,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
11084
11296
|
};
|
|
11085
11297
|
|
|
11086
11298
|
// src/features/rules/warp-rule.ts
|
|
11087
|
-
import { join as
|
|
11299
|
+
import { join as join93 } from "path";
|
|
11088
11300
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
11089
11301
|
constructor({ fileContent, root, ...rest }) {
|
|
11090
11302
|
super({
|
|
@@ -11100,7 +11312,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11100
11312
|
relativeFilePath: "WARP.md"
|
|
11101
11313
|
},
|
|
11102
11314
|
nonRoot: {
|
|
11103
|
-
relativeDirPath:
|
|
11315
|
+
relativeDirPath: join93(".warp", "memories")
|
|
11104
11316
|
}
|
|
11105
11317
|
};
|
|
11106
11318
|
}
|
|
@@ -11110,8 +11322,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11110
11322
|
validate = true
|
|
11111
11323
|
}) {
|
|
11112
11324
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
11113
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
11114
|
-
const fileContent = await readFileContent(
|
|
11325
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join93(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
11326
|
+
const fileContent = await readFileContent(join93(baseDir, relativePath));
|
|
11115
11327
|
return new _WarpRule({
|
|
11116
11328
|
baseDir,
|
|
11117
11329
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -11166,12 +11378,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11166
11378
|
};
|
|
11167
11379
|
|
|
11168
11380
|
// src/features/rules/windsurf-rule.ts
|
|
11169
|
-
import { join as
|
|
11381
|
+
import { join as join94 } from "path";
|
|
11170
11382
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
11171
11383
|
static getSettablePaths() {
|
|
11172
11384
|
return {
|
|
11173
11385
|
nonRoot: {
|
|
11174
|
-
relativeDirPath:
|
|
11386
|
+
relativeDirPath: join94(".windsurf", "rules")
|
|
11175
11387
|
}
|
|
11176
11388
|
};
|
|
11177
11389
|
}
|
|
@@ -11181,7 +11393,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
11181
11393
|
validate = true
|
|
11182
11394
|
}) {
|
|
11183
11395
|
const fileContent = await readFileContent(
|
|
11184
|
-
|
|
11396
|
+
join94(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11185
11397
|
);
|
|
11186
11398
|
return new _WindsurfRule({
|
|
11187
11399
|
baseDir,
|
|
@@ -11255,7 +11467,7 @@ var rulesProcessorToolTargets = [
|
|
|
11255
11467
|
"warp",
|
|
11256
11468
|
"windsurf"
|
|
11257
11469
|
];
|
|
11258
|
-
var RulesProcessorToolTargetSchema =
|
|
11470
|
+
var RulesProcessorToolTargetSchema = z44.enum(rulesProcessorToolTargets);
|
|
11259
11471
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
11260
11472
|
[
|
|
11261
11473
|
"agentsmd",
|
|
@@ -11546,7 +11758,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11546
11758
|
}).relativeDirPath;
|
|
11547
11759
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
11548
11760
|
const frontmatter = skill.getFrontmatter();
|
|
11549
|
-
const relativePath =
|
|
11761
|
+
const relativePath = join95(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
11550
11762
|
return {
|
|
11551
11763
|
name: frontmatter.name,
|
|
11552
11764
|
description: frontmatter.description,
|
|
@@ -11613,7 +11825,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11613
11825
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
11614
11826
|
*/
|
|
11615
11827
|
async loadRulesyncFiles() {
|
|
11616
|
-
const files = await findFilesByGlobs(
|
|
11828
|
+
const files = await findFilesByGlobs(join95(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
11617
11829
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
11618
11830
|
const rulesyncRules = await Promise.all(
|
|
11619
11831
|
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename24(file) }))
|
|
@@ -11634,7 +11846,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11634
11846
|
return rulesyncRules;
|
|
11635
11847
|
}
|
|
11636
11848
|
async loadRulesyncFilesLegacy() {
|
|
11637
|
-
const legacyFiles = await findFilesByGlobs(
|
|
11849
|
+
const legacyFiles = await findFilesByGlobs(join95(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
11638
11850
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
11639
11851
|
return Promise.all(
|
|
11640
11852
|
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename24(file) }))
|
|
@@ -11655,7 +11867,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11655
11867
|
return [];
|
|
11656
11868
|
}
|
|
11657
11869
|
const rootFilePaths = await findFilesByGlobs(
|
|
11658
|
-
|
|
11870
|
+
join95(
|
|
11659
11871
|
this.baseDir,
|
|
11660
11872
|
settablePaths.root.relativeDirPath ?? ".",
|
|
11661
11873
|
settablePaths.root.relativeFilePath
|
|
@@ -11687,7 +11899,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11687
11899
|
return [];
|
|
11688
11900
|
}
|
|
11689
11901
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
11690
|
-
|
|
11902
|
+
join95(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
11691
11903
|
);
|
|
11692
11904
|
if (forDeletion) {
|
|
11693
11905
|
return nonRootFilePaths.map(
|
|
@@ -11796,14 +12008,14 @@ s/<command> [arguments]
|
|
|
11796
12008
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
11797
12009
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
11798
12010
|
|
|
11799
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
12011
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join95(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
11800
12012
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
11801
12013
|
|
|
11802
12014
|
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.
|
|
11803
12015
|
|
|
11804
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
12016
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join95(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
11805
12017
|
|
|
11806
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
12018
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join95(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
11807
12019
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
11808
12020
|
const result = [
|
|
11809
12021
|
overview,
|
|
@@ -11833,7 +12045,10 @@ ${toonContent}`;
|
|
|
11833
12045
|
// src/cli/commands/generate.ts
|
|
11834
12046
|
async function generateCommand(options) {
|
|
11835
12047
|
const config = await ConfigResolver.resolve(options);
|
|
11836
|
-
logger.
|
|
12048
|
+
logger.configure({
|
|
12049
|
+
verbose: config.getVerbose(),
|
|
12050
|
+
silent: config.getSilent()
|
|
12051
|
+
});
|
|
11837
12052
|
logger.info("Generating files...");
|
|
11838
12053
|
if (!await fileExists(RULESYNC_RELATIVE_DIR_PATH)) {
|
|
11839
12054
|
logger.error("\u274C .rulesync directory not found. Run 'rulesync init' first.");
|
|
@@ -12085,7 +12300,7 @@ async function generateSkills(config) {
|
|
|
12085
12300
|
}
|
|
12086
12301
|
|
|
12087
12302
|
// src/cli/commands/gitignore.ts
|
|
12088
|
-
import { join as
|
|
12303
|
+
import { join as join96 } from "path";
|
|
12089
12304
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
12090
12305
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
12091
12306
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -12149,6 +12364,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
12149
12364
|
// Kiro
|
|
12150
12365
|
"**/.kiro/steering/",
|
|
12151
12366
|
"**/.kiro/prompts/",
|
|
12367
|
+
"**/.kiro/skills/",
|
|
12152
12368
|
"**/.kiro/agents/",
|
|
12153
12369
|
"**/.kiro/settings/mcp.json",
|
|
12154
12370
|
"**/.aiignore",
|
|
@@ -12225,7 +12441,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
12225
12441
|
return result;
|
|
12226
12442
|
};
|
|
12227
12443
|
var gitignoreCommand = async () => {
|
|
12228
|
-
const gitignorePath =
|
|
12444
|
+
const gitignorePath = join96(process.cwd(), ".gitignore");
|
|
12229
12445
|
let gitignoreContent = "";
|
|
12230
12446
|
if (await fileExists(gitignorePath)) {
|
|
12231
12447
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -12259,7 +12475,10 @@ async function importCommand(options) {
|
|
|
12259
12475
|
process.exit(1);
|
|
12260
12476
|
}
|
|
12261
12477
|
const config = await ConfigResolver.resolve(options);
|
|
12262
|
-
logger.
|
|
12478
|
+
logger.configure({
|
|
12479
|
+
verbose: config.getVerbose(),
|
|
12480
|
+
silent: config.getSilent()
|
|
12481
|
+
});
|
|
12263
12482
|
const tool = config.getTargets()[0];
|
|
12264
12483
|
await importRules(config, tool);
|
|
12265
12484
|
await importIgnore(config, tool);
|
|
@@ -12424,7 +12643,7 @@ async function importSkills(config, tool) {
|
|
|
12424
12643
|
}
|
|
12425
12644
|
|
|
12426
12645
|
// src/cli/commands/init.ts
|
|
12427
|
-
import { join as
|
|
12646
|
+
import { join as join97 } from "path";
|
|
12428
12647
|
async function initCommand() {
|
|
12429
12648
|
logger.info("Initializing rulesync...");
|
|
12430
12649
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -12602,14 +12821,14 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12602
12821
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
12603
12822
|
await ensureDir(skillPaths.relativeDirPath);
|
|
12604
12823
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
12605
|
-
const ruleFilepath =
|
|
12824
|
+
const ruleFilepath = join97(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
12606
12825
|
if (!await fileExists(ruleFilepath)) {
|
|
12607
12826
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
12608
12827
|
logger.success(`Created ${ruleFilepath}`);
|
|
12609
12828
|
} else {
|
|
12610
12829
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
12611
12830
|
}
|
|
12612
|
-
const mcpFilepath =
|
|
12831
|
+
const mcpFilepath = join97(
|
|
12613
12832
|
mcpPaths.recommended.relativeDirPath,
|
|
12614
12833
|
mcpPaths.recommended.relativeFilePath
|
|
12615
12834
|
);
|
|
@@ -12619,30 +12838,30 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12619
12838
|
} else {
|
|
12620
12839
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
12621
12840
|
}
|
|
12622
|
-
const commandFilepath =
|
|
12841
|
+
const commandFilepath = join97(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
12623
12842
|
if (!await fileExists(commandFilepath)) {
|
|
12624
12843
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
12625
12844
|
logger.success(`Created ${commandFilepath}`);
|
|
12626
12845
|
} else {
|
|
12627
12846
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
12628
12847
|
}
|
|
12629
|
-
const subagentFilepath =
|
|
12848
|
+
const subagentFilepath = join97(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
12630
12849
|
if (!await fileExists(subagentFilepath)) {
|
|
12631
12850
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
12632
12851
|
logger.success(`Created ${subagentFilepath}`);
|
|
12633
12852
|
} else {
|
|
12634
12853
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
12635
12854
|
}
|
|
12636
|
-
const skillDirPath =
|
|
12855
|
+
const skillDirPath = join97(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
12637
12856
|
await ensureDir(skillDirPath);
|
|
12638
|
-
const skillFilepath =
|
|
12857
|
+
const skillFilepath = join97(skillDirPath, SKILL_FILE_NAME);
|
|
12639
12858
|
if (!await fileExists(skillFilepath)) {
|
|
12640
12859
|
await writeFileContent(skillFilepath, sampleSkillFile.content);
|
|
12641
12860
|
logger.success(`Created ${skillFilepath}`);
|
|
12642
12861
|
} else {
|
|
12643
12862
|
logger.info(`Skipped ${skillFilepath} (already exists)`);
|
|
12644
12863
|
}
|
|
12645
|
-
const ignoreFilepath =
|
|
12864
|
+
const ignoreFilepath = join97(
|
|
12646
12865
|
ignorePaths.recommended.relativeDirPath,
|
|
12647
12866
|
ignorePaths.recommended.relativeFilePath
|
|
12648
12867
|
);
|
|
@@ -12658,15 +12877,15 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12658
12877
|
import { FastMCP } from "fastmcp";
|
|
12659
12878
|
|
|
12660
12879
|
// src/mcp/tools.ts
|
|
12661
|
-
import { z as
|
|
12880
|
+
import { z as z51 } from "zod/mini";
|
|
12662
12881
|
|
|
12663
12882
|
// src/mcp/commands.ts
|
|
12664
|
-
import { basename as basename25, join as
|
|
12665
|
-
import { z as
|
|
12883
|
+
import { basename as basename25, join as join98 } from "path";
|
|
12884
|
+
import { z as z45 } from "zod/mini";
|
|
12666
12885
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
12667
12886
|
var maxCommandsCount = 1e3;
|
|
12668
12887
|
async function listCommands() {
|
|
12669
|
-
const commandsDir =
|
|
12888
|
+
const commandsDir = join98(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12670
12889
|
try {
|
|
12671
12890
|
const files = await listDirectoryFiles(commandsDir);
|
|
12672
12891
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12678,7 +12897,7 @@ async function listCommands() {
|
|
|
12678
12897
|
});
|
|
12679
12898
|
const frontmatter = command.getFrontmatter();
|
|
12680
12899
|
return {
|
|
12681
|
-
relativePathFromCwd:
|
|
12900
|
+
relativePathFromCwd: join98(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
12682
12901
|
frontmatter
|
|
12683
12902
|
};
|
|
12684
12903
|
} catch (error) {
|
|
@@ -12704,7 +12923,7 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
12704
12923
|
relativeFilePath: filename
|
|
12705
12924
|
});
|
|
12706
12925
|
return {
|
|
12707
|
-
relativePathFromCwd:
|
|
12926
|
+
relativePathFromCwd: join98(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12708
12927
|
frontmatter: command.getFrontmatter(),
|
|
12709
12928
|
body: command.getBody()
|
|
12710
12929
|
};
|
|
@@ -12733,7 +12952,7 @@ async function putCommand({
|
|
|
12733
12952
|
try {
|
|
12734
12953
|
const existingCommands = await listCommands();
|
|
12735
12954
|
const isUpdate = existingCommands.some(
|
|
12736
|
-
(command2) => command2.relativePathFromCwd ===
|
|
12955
|
+
(command2) => command2.relativePathFromCwd === join98(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12737
12956
|
);
|
|
12738
12957
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
12739
12958
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -12748,11 +12967,11 @@ async function putCommand({
|
|
|
12748
12967
|
fileContent,
|
|
12749
12968
|
validate: true
|
|
12750
12969
|
});
|
|
12751
|
-
const commandsDir =
|
|
12970
|
+
const commandsDir = join98(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12752
12971
|
await ensureDir(commandsDir);
|
|
12753
12972
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
12754
12973
|
return {
|
|
12755
|
-
relativePathFromCwd:
|
|
12974
|
+
relativePathFromCwd: join98(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12756
12975
|
frontmatter: command.getFrontmatter(),
|
|
12757
12976
|
body: command.getBody()
|
|
12758
12977
|
};
|
|
@@ -12768,11 +12987,11 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12768
12987
|
intendedRootDir: process.cwd()
|
|
12769
12988
|
});
|
|
12770
12989
|
const filename = basename25(relativePathFromCwd);
|
|
12771
|
-
const fullPath =
|
|
12990
|
+
const fullPath = join98(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
12772
12991
|
try {
|
|
12773
12992
|
await removeFile(fullPath);
|
|
12774
12993
|
return {
|
|
12775
|
-
relativePathFromCwd:
|
|
12994
|
+
relativePathFromCwd: join98(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12776
12995
|
};
|
|
12777
12996
|
} catch (error) {
|
|
12778
12997
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12781,23 +13000,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12781
13000
|
}
|
|
12782
13001
|
}
|
|
12783
13002
|
var commandToolSchemas = {
|
|
12784
|
-
listCommands:
|
|
12785
|
-
getCommand:
|
|
12786
|
-
relativePathFromCwd:
|
|
13003
|
+
listCommands: z45.object({}),
|
|
13004
|
+
getCommand: z45.object({
|
|
13005
|
+
relativePathFromCwd: z45.string()
|
|
12787
13006
|
}),
|
|
12788
|
-
putCommand:
|
|
12789
|
-
relativePathFromCwd:
|
|
13007
|
+
putCommand: z45.object({
|
|
13008
|
+
relativePathFromCwd: z45.string(),
|
|
12790
13009
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
12791
|
-
body:
|
|
13010
|
+
body: z45.string()
|
|
12792
13011
|
}),
|
|
12793
|
-
deleteCommand:
|
|
12794
|
-
relativePathFromCwd:
|
|
13012
|
+
deleteCommand: z45.object({
|
|
13013
|
+
relativePathFromCwd: z45.string()
|
|
12795
13014
|
})
|
|
12796
13015
|
};
|
|
12797
13016
|
var commandTools = {
|
|
12798
13017
|
listCommands: {
|
|
12799
13018
|
name: "listCommands",
|
|
12800
|
-
description: `List all commands from ${
|
|
13019
|
+
description: `List all commands from ${join98(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12801
13020
|
parameters: commandToolSchemas.listCommands,
|
|
12802
13021
|
execute: async () => {
|
|
12803
13022
|
const commands = await listCommands();
|
|
@@ -12839,11 +13058,11 @@ var commandTools = {
|
|
|
12839
13058
|
};
|
|
12840
13059
|
|
|
12841
13060
|
// src/mcp/ignore.ts
|
|
12842
|
-
import { join as
|
|
12843
|
-
import { z as
|
|
13061
|
+
import { join as join99 } from "path";
|
|
13062
|
+
import { z as z46 } from "zod/mini";
|
|
12844
13063
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
12845
13064
|
async function getIgnoreFile() {
|
|
12846
|
-
const ignoreFilePath =
|
|
13065
|
+
const ignoreFilePath = join99(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12847
13066
|
try {
|
|
12848
13067
|
const content = await readFileContent(ignoreFilePath);
|
|
12849
13068
|
return {
|
|
@@ -12857,7 +13076,7 @@ async function getIgnoreFile() {
|
|
|
12857
13076
|
}
|
|
12858
13077
|
}
|
|
12859
13078
|
async function putIgnoreFile({ content }) {
|
|
12860
|
-
const ignoreFilePath =
|
|
13079
|
+
const ignoreFilePath = join99(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12861
13080
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
12862
13081
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
12863
13082
|
throw new Error(
|
|
@@ -12878,8 +13097,8 @@ async function putIgnoreFile({ content }) {
|
|
|
12878
13097
|
}
|
|
12879
13098
|
}
|
|
12880
13099
|
async function deleteIgnoreFile() {
|
|
12881
|
-
const aiignorePath =
|
|
12882
|
-
const legacyIgnorePath =
|
|
13100
|
+
const aiignorePath = join99(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
13101
|
+
const legacyIgnorePath = join99(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
12883
13102
|
try {
|
|
12884
13103
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
12885
13104
|
return {
|
|
@@ -12897,11 +13116,11 @@ async function deleteIgnoreFile() {
|
|
|
12897
13116
|
}
|
|
12898
13117
|
}
|
|
12899
13118
|
var ignoreToolSchemas = {
|
|
12900
|
-
getIgnoreFile:
|
|
12901
|
-
putIgnoreFile:
|
|
12902
|
-
content:
|
|
13119
|
+
getIgnoreFile: z46.object({}),
|
|
13120
|
+
putIgnoreFile: z46.object({
|
|
13121
|
+
content: z46.string()
|
|
12903
13122
|
}),
|
|
12904
|
-
deleteIgnoreFile:
|
|
13123
|
+
deleteIgnoreFile: z46.object({})
|
|
12905
13124
|
};
|
|
12906
13125
|
var ignoreTools = {
|
|
12907
13126
|
getIgnoreFile: {
|
|
@@ -12934,8 +13153,8 @@ var ignoreTools = {
|
|
|
12934
13153
|
};
|
|
12935
13154
|
|
|
12936
13155
|
// src/mcp/mcp.ts
|
|
12937
|
-
import { join as
|
|
12938
|
-
import { z as
|
|
13156
|
+
import { join as join100 } from "path";
|
|
13157
|
+
import { z as z47 } from "zod/mini";
|
|
12939
13158
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
12940
13159
|
async function getMcpFile() {
|
|
12941
13160
|
const config = await ConfigResolver.resolve({});
|
|
@@ -12944,7 +13163,7 @@ async function getMcpFile() {
|
|
|
12944
13163
|
validate: true,
|
|
12945
13164
|
modularMcp: config.getModularMcp()
|
|
12946
13165
|
});
|
|
12947
|
-
const relativePathFromCwd =
|
|
13166
|
+
const relativePathFromCwd = join100(
|
|
12948
13167
|
rulesyncMcp.getRelativeDirPath(),
|
|
12949
13168
|
rulesyncMcp.getRelativeFilePath()
|
|
12950
13169
|
);
|
|
@@ -12977,7 +13196,7 @@ async function putMcpFile({ content }) {
|
|
|
12977
13196
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12978
13197
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
12979
13198
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
12980
|
-
const fullPath =
|
|
13199
|
+
const fullPath = join100(baseDir, relativeDirPath, relativeFilePath);
|
|
12981
13200
|
const rulesyncMcp = new RulesyncMcp({
|
|
12982
13201
|
baseDir,
|
|
12983
13202
|
relativeDirPath,
|
|
@@ -12986,9 +13205,9 @@ async function putMcpFile({ content }) {
|
|
|
12986
13205
|
validate: true,
|
|
12987
13206
|
modularMcp: config.getModularMcp()
|
|
12988
13207
|
});
|
|
12989
|
-
await ensureDir(
|
|
13208
|
+
await ensureDir(join100(baseDir, relativeDirPath));
|
|
12990
13209
|
await writeFileContent(fullPath, content);
|
|
12991
|
-
const relativePathFromCwd =
|
|
13210
|
+
const relativePathFromCwd = join100(relativeDirPath, relativeFilePath);
|
|
12992
13211
|
return {
|
|
12993
13212
|
relativePathFromCwd,
|
|
12994
13213
|
content: rulesyncMcp.getFileContent()
|
|
@@ -13003,15 +13222,15 @@ async function deleteMcpFile() {
|
|
|
13003
13222
|
try {
|
|
13004
13223
|
const baseDir = process.cwd();
|
|
13005
13224
|
const paths = RulesyncMcp.getSettablePaths();
|
|
13006
|
-
const recommendedPath =
|
|
13225
|
+
const recommendedPath = join100(
|
|
13007
13226
|
baseDir,
|
|
13008
13227
|
paths.recommended.relativeDirPath,
|
|
13009
13228
|
paths.recommended.relativeFilePath
|
|
13010
13229
|
);
|
|
13011
|
-
const legacyPath =
|
|
13230
|
+
const legacyPath = join100(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
13012
13231
|
await removeFile(recommendedPath);
|
|
13013
13232
|
await removeFile(legacyPath);
|
|
13014
|
-
const relativePathFromCwd =
|
|
13233
|
+
const relativePathFromCwd = join100(
|
|
13015
13234
|
paths.recommended.relativeDirPath,
|
|
13016
13235
|
paths.recommended.relativeFilePath
|
|
13017
13236
|
);
|
|
@@ -13025,11 +13244,11 @@ async function deleteMcpFile() {
|
|
|
13025
13244
|
}
|
|
13026
13245
|
}
|
|
13027
13246
|
var mcpToolSchemas = {
|
|
13028
|
-
getMcpFile:
|
|
13029
|
-
putMcpFile:
|
|
13030
|
-
content:
|
|
13247
|
+
getMcpFile: z47.object({}),
|
|
13248
|
+
putMcpFile: z47.object({
|
|
13249
|
+
content: z47.string()
|
|
13031
13250
|
}),
|
|
13032
|
-
deleteMcpFile:
|
|
13251
|
+
deleteMcpFile: z47.object({})
|
|
13033
13252
|
};
|
|
13034
13253
|
var mcpTools = {
|
|
13035
13254
|
getMcpFile: {
|
|
@@ -13062,12 +13281,12 @@ var mcpTools = {
|
|
|
13062
13281
|
};
|
|
13063
13282
|
|
|
13064
13283
|
// src/mcp/rules.ts
|
|
13065
|
-
import { basename as basename26, join as
|
|
13066
|
-
import { z as
|
|
13284
|
+
import { basename as basename26, join as join101 } from "path";
|
|
13285
|
+
import { z as z48 } from "zod/mini";
|
|
13067
13286
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
13068
13287
|
var maxRulesCount = 1e3;
|
|
13069
13288
|
async function listRules() {
|
|
13070
|
-
const rulesDir =
|
|
13289
|
+
const rulesDir = join101(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
13071
13290
|
try {
|
|
13072
13291
|
const files = await listDirectoryFiles(rulesDir);
|
|
13073
13292
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13080,7 +13299,7 @@ async function listRules() {
|
|
|
13080
13299
|
});
|
|
13081
13300
|
const frontmatter = rule.getFrontmatter();
|
|
13082
13301
|
return {
|
|
13083
|
-
relativePathFromCwd:
|
|
13302
|
+
relativePathFromCwd: join101(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
13084
13303
|
frontmatter
|
|
13085
13304
|
};
|
|
13086
13305
|
} catch (error) {
|
|
@@ -13107,7 +13326,7 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
13107
13326
|
validate: true
|
|
13108
13327
|
});
|
|
13109
13328
|
return {
|
|
13110
|
-
relativePathFromCwd:
|
|
13329
|
+
relativePathFromCwd: join101(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
13111
13330
|
frontmatter: rule.getFrontmatter(),
|
|
13112
13331
|
body: rule.getBody()
|
|
13113
13332
|
};
|
|
@@ -13136,7 +13355,7 @@ async function putRule({
|
|
|
13136
13355
|
try {
|
|
13137
13356
|
const existingRules = await listRules();
|
|
13138
13357
|
const isUpdate = existingRules.some(
|
|
13139
|
-
(rule2) => rule2.relativePathFromCwd ===
|
|
13358
|
+
(rule2) => rule2.relativePathFromCwd === join101(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
13140
13359
|
);
|
|
13141
13360
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
13142
13361
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -13149,11 +13368,11 @@ async function putRule({
|
|
|
13149
13368
|
body,
|
|
13150
13369
|
validate: true
|
|
13151
13370
|
});
|
|
13152
|
-
const rulesDir =
|
|
13371
|
+
const rulesDir = join101(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
13153
13372
|
await ensureDir(rulesDir);
|
|
13154
13373
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
13155
13374
|
return {
|
|
13156
|
-
relativePathFromCwd:
|
|
13375
|
+
relativePathFromCwd: join101(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
13157
13376
|
frontmatter: rule.getFrontmatter(),
|
|
13158
13377
|
body: rule.getBody()
|
|
13159
13378
|
};
|
|
@@ -13169,11 +13388,11 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
13169
13388
|
intendedRootDir: process.cwd()
|
|
13170
13389
|
});
|
|
13171
13390
|
const filename = basename26(relativePathFromCwd);
|
|
13172
|
-
const fullPath =
|
|
13391
|
+
const fullPath = join101(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
13173
13392
|
try {
|
|
13174
13393
|
await removeFile(fullPath);
|
|
13175
13394
|
return {
|
|
13176
|
-
relativePathFromCwd:
|
|
13395
|
+
relativePathFromCwd: join101(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
13177
13396
|
};
|
|
13178
13397
|
} catch (error) {
|
|
13179
13398
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -13182,23 +13401,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
13182
13401
|
}
|
|
13183
13402
|
}
|
|
13184
13403
|
var ruleToolSchemas = {
|
|
13185
|
-
listRules:
|
|
13186
|
-
getRule:
|
|
13187
|
-
relativePathFromCwd:
|
|
13404
|
+
listRules: z48.object({}),
|
|
13405
|
+
getRule: z48.object({
|
|
13406
|
+
relativePathFromCwd: z48.string()
|
|
13188
13407
|
}),
|
|
13189
|
-
putRule:
|
|
13190
|
-
relativePathFromCwd:
|
|
13408
|
+
putRule: z48.object({
|
|
13409
|
+
relativePathFromCwd: z48.string(),
|
|
13191
13410
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
13192
|
-
body:
|
|
13411
|
+
body: z48.string()
|
|
13193
13412
|
}),
|
|
13194
|
-
deleteRule:
|
|
13195
|
-
relativePathFromCwd:
|
|
13413
|
+
deleteRule: z48.object({
|
|
13414
|
+
relativePathFromCwd: z48.string()
|
|
13196
13415
|
})
|
|
13197
13416
|
};
|
|
13198
13417
|
var ruleTools = {
|
|
13199
13418
|
listRules: {
|
|
13200
13419
|
name: "listRules",
|
|
13201
|
-
description: `List all rules from ${
|
|
13420
|
+
description: `List all rules from ${join101(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13202
13421
|
parameters: ruleToolSchemas.listRules,
|
|
13203
13422
|
execute: async () => {
|
|
13204
13423
|
const rules = await listRules();
|
|
@@ -13240,8 +13459,8 @@ var ruleTools = {
|
|
|
13240
13459
|
};
|
|
13241
13460
|
|
|
13242
13461
|
// src/mcp/skills.ts
|
|
13243
|
-
import { basename as basename27, dirname as dirname2, join as
|
|
13244
|
-
import { z as
|
|
13462
|
+
import { basename as basename27, dirname as dirname2, join as join102 } from "path";
|
|
13463
|
+
import { z as z49 } from "zod/mini";
|
|
13245
13464
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
13246
13465
|
var maxSkillsCount = 1e3;
|
|
13247
13466
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -13264,9 +13483,9 @@ function extractDirName(relativeDirPathFromCwd) {
|
|
|
13264
13483
|
return dirName;
|
|
13265
13484
|
}
|
|
13266
13485
|
async function listSkills() {
|
|
13267
|
-
const skillsDir =
|
|
13486
|
+
const skillsDir = join102(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
13268
13487
|
try {
|
|
13269
|
-
const skillDirPaths = await findFilesByGlobs(
|
|
13488
|
+
const skillDirPaths = await findFilesByGlobs(join102(skillsDir, "*"), { type: "dir" });
|
|
13270
13489
|
const skills = await Promise.all(
|
|
13271
13490
|
skillDirPaths.map(async (dirPath) => {
|
|
13272
13491
|
const dirName = basename27(dirPath);
|
|
@@ -13277,7 +13496,7 @@ async function listSkills() {
|
|
|
13277
13496
|
});
|
|
13278
13497
|
const frontmatter = skill.getFrontmatter();
|
|
13279
13498
|
return {
|
|
13280
|
-
relativeDirPathFromCwd:
|
|
13499
|
+
relativeDirPathFromCwd: join102(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13281
13500
|
frontmatter
|
|
13282
13501
|
};
|
|
13283
13502
|
} catch (error) {
|
|
@@ -13303,7 +13522,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
13303
13522
|
dirName
|
|
13304
13523
|
});
|
|
13305
13524
|
return {
|
|
13306
|
-
relativeDirPathFromCwd:
|
|
13525
|
+
relativeDirPathFromCwd: join102(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13307
13526
|
frontmatter: skill.getFrontmatter(),
|
|
13308
13527
|
body: skill.getBody(),
|
|
13309
13528
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13337,7 +13556,7 @@ async function putSkill({
|
|
|
13337
13556
|
try {
|
|
13338
13557
|
const existingSkills = await listSkills();
|
|
13339
13558
|
const isUpdate = existingSkills.some(
|
|
13340
|
-
(skill2) => skill2.relativeDirPathFromCwd ===
|
|
13559
|
+
(skill2) => skill2.relativeDirPathFromCwd === join102(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13341
13560
|
);
|
|
13342
13561
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
13343
13562
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -13352,9 +13571,9 @@ async function putSkill({
|
|
|
13352
13571
|
otherFiles: aiDirFiles,
|
|
13353
13572
|
validate: true
|
|
13354
13573
|
});
|
|
13355
|
-
const skillDirPath =
|
|
13574
|
+
const skillDirPath = join102(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13356
13575
|
await ensureDir(skillDirPath);
|
|
13357
|
-
const skillFilePath =
|
|
13576
|
+
const skillFilePath = join102(skillDirPath, SKILL_FILE_NAME);
|
|
13358
13577
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
13359
13578
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
13360
13579
|
for (const file of otherFiles) {
|
|
@@ -13362,15 +13581,15 @@ async function putSkill({
|
|
|
13362
13581
|
relativePath: file.name,
|
|
13363
13582
|
intendedRootDir: skillDirPath
|
|
13364
13583
|
});
|
|
13365
|
-
const filePath =
|
|
13366
|
-
const fileDir =
|
|
13584
|
+
const filePath = join102(skillDirPath, file.name);
|
|
13585
|
+
const fileDir = join102(skillDirPath, dirname2(file.name));
|
|
13367
13586
|
if (fileDir !== skillDirPath) {
|
|
13368
13587
|
await ensureDir(fileDir);
|
|
13369
13588
|
}
|
|
13370
13589
|
await writeFileContent(filePath, file.body);
|
|
13371
13590
|
}
|
|
13372
13591
|
return {
|
|
13373
|
-
relativeDirPathFromCwd:
|
|
13592
|
+
relativeDirPathFromCwd: join102(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13374
13593
|
frontmatter: skill.getFrontmatter(),
|
|
13375
13594
|
body: skill.getBody(),
|
|
13376
13595
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13392,13 +13611,13 @@ async function deleteSkill({
|
|
|
13392
13611
|
intendedRootDir: process.cwd()
|
|
13393
13612
|
});
|
|
13394
13613
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
13395
|
-
const skillDirPath =
|
|
13614
|
+
const skillDirPath = join102(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13396
13615
|
try {
|
|
13397
13616
|
if (await directoryExists(skillDirPath)) {
|
|
13398
13617
|
await removeDirectory(skillDirPath);
|
|
13399
13618
|
}
|
|
13400
13619
|
return {
|
|
13401
|
-
relativeDirPathFromCwd:
|
|
13620
|
+
relativeDirPathFromCwd: join102(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13402
13621
|
};
|
|
13403
13622
|
} catch (error) {
|
|
13404
13623
|
throw new Error(
|
|
@@ -13409,29 +13628,29 @@ async function deleteSkill({
|
|
|
13409
13628
|
);
|
|
13410
13629
|
}
|
|
13411
13630
|
}
|
|
13412
|
-
var McpSkillFileSchema =
|
|
13413
|
-
name:
|
|
13414
|
-
body:
|
|
13631
|
+
var McpSkillFileSchema = z49.object({
|
|
13632
|
+
name: z49.string(),
|
|
13633
|
+
body: z49.string()
|
|
13415
13634
|
});
|
|
13416
13635
|
var skillToolSchemas = {
|
|
13417
|
-
listSkills:
|
|
13418
|
-
getSkill:
|
|
13419
|
-
relativeDirPathFromCwd:
|
|
13636
|
+
listSkills: z49.object({}),
|
|
13637
|
+
getSkill: z49.object({
|
|
13638
|
+
relativeDirPathFromCwd: z49.string()
|
|
13420
13639
|
}),
|
|
13421
|
-
putSkill:
|
|
13422
|
-
relativeDirPathFromCwd:
|
|
13640
|
+
putSkill: z49.object({
|
|
13641
|
+
relativeDirPathFromCwd: z49.string(),
|
|
13423
13642
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
13424
|
-
body:
|
|
13425
|
-
otherFiles:
|
|
13643
|
+
body: z49.string(),
|
|
13644
|
+
otherFiles: z49.optional(z49.array(McpSkillFileSchema))
|
|
13426
13645
|
}),
|
|
13427
|
-
deleteSkill:
|
|
13428
|
-
relativeDirPathFromCwd:
|
|
13646
|
+
deleteSkill: z49.object({
|
|
13647
|
+
relativeDirPathFromCwd: z49.string()
|
|
13429
13648
|
})
|
|
13430
13649
|
};
|
|
13431
13650
|
var skillTools = {
|
|
13432
13651
|
listSkills: {
|
|
13433
13652
|
name: "listSkills",
|
|
13434
|
-
description: `List all skills from ${
|
|
13653
|
+
description: `List all skills from ${join102(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
13435
13654
|
parameters: skillToolSchemas.listSkills,
|
|
13436
13655
|
execute: async () => {
|
|
13437
13656
|
const skills = await listSkills();
|
|
@@ -13474,12 +13693,12 @@ var skillTools = {
|
|
|
13474
13693
|
};
|
|
13475
13694
|
|
|
13476
13695
|
// src/mcp/subagents.ts
|
|
13477
|
-
import { basename as basename28, join as
|
|
13478
|
-
import { z as
|
|
13696
|
+
import { basename as basename28, join as join103 } from "path";
|
|
13697
|
+
import { z as z50 } from "zod/mini";
|
|
13479
13698
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
13480
13699
|
var maxSubagentsCount = 1e3;
|
|
13481
13700
|
async function listSubagents() {
|
|
13482
|
-
const subagentsDir =
|
|
13701
|
+
const subagentsDir = join103(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13483
13702
|
try {
|
|
13484
13703
|
const files = await listDirectoryFiles(subagentsDir);
|
|
13485
13704
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13492,7 +13711,7 @@ async function listSubagents() {
|
|
|
13492
13711
|
});
|
|
13493
13712
|
const frontmatter = subagent.getFrontmatter();
|
|
13494
13713
|
return {
|
|
13495
|
-
relativePathFromCwd:
|
|
13714
|
+
relativePathFromCwd: join103(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
13496
13715
|
frontmatter
|
|
13497
13716
|
};
|
|
13498
13717
|
} catch (error) {
|
|
@@ -13521,7 +13740,7 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
13521
13740
|
validate: true
|
|
13522
13741
|
});
|
|
13523
13742
|
return {
|
|
13524
|
-
relativePathFromCwd:
|
|
13743
|
+
relativePathFromCwd: join103(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13525
13744
|
frontmatter: subagent.getFrontmatter(),
|
|
13526
13745
|
body: subagent.getBody()
|
|
13527
13746
|
};
|
|
@@ -13550,7 +13769,7 @@ async function putSubagent({
|
|
|
13550
13769
|
try {
|
|
13551
13770
|
const existingSubagents = await listSubagents();
|
|
13552
13771
|
const isUpdate = existingSubagents.some(
|
|
13553
|
-
(subagent2) => subagent2.relativePathFromCwd ===
|
|
13772
|
+
(subagent2) => subagent2.relativePathFromCwd === join103(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13554
13773
|
);
|
|
13555
13774
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
13556
13775
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -13563,11 +13782,11 @@ async function putSubagent({
|
|
|
13563
13782
|
body,
|
|
13564
13783
|
validate: true
|
|
13565
13784
|
});
|
|
13566
|
-
const subagentsDir =
|
|
13785
|
+
const subagentsDir = join103(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13567
13786
|
await ensureDir(subagentsDir);
|
|
13568
13787
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
13569
13788
|
return {
|
|
13570
|
-
relativePathFromCwd:
|
|
13789
|
+
relativePathFromCwd: join103(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13571
13790
|
frontmatter: subagent.getFrontmatter(),
|
|
13572
13791
|
body: subagent.getBody()
|
|
13573
13792
|
};
|
|
@@ -13583,11 +13802,11 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
13583
13802
|
intendedRootDir: process.cwd()
|
|
13584
13803
|
});
|
|
13585
13804
|
const filename = basename28(relativePathFromCwd);
|
|
13586
|
-
const fullPath =
|
|
13805
|
+
const fullPath = join103(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
13587
13806
|
try {
|
|
13588
13807
|
await removeFile(fullPath);
|
|
13589
13808
|
return {
|
|
13590
|
-
relativePathFromCwd:
|
|
13809
|
+
relativePathFromCwd: join103(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13591
13810
|
};
|
|
13592
13811
|
} catch (error) {
|
|
13593
13812
|
throw new Error(
|
|
@@ -13599,23 +13818,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
13599
13818
|
}
|
|
13600
13819
|
}
|
|
13601
13820
|
var subagentToolSchemas = {
|
|
13602
|
-
listSubagents:
|
|
13603
|
-
getSubagent:
|
|
13604
|
-
relativePathFromCwd:
|
|
13821
|
+
listSubagents: z50.object({}),
|
|
13822
|
+
getSubagent: z50.object({
|
|
13823
|
+
relativePathFromCwd: z50.string()
|
|
13605
13824
|
}),
|
|
13606
|
-
putSubagent:
|
|
13607
|
-
relativePathFromCwd:
|
|
13825
|
+
putSubagent: z50.object({
|
|
13826
|
+
relativePathFromCwd: z50.string(),
|
|
13608
13827
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
13609
|
-
body:
|
|
13828
|
+
body: z50.string()
|
|
13610
13829
|
}),
|
|
13611
|
-
deleteSubagent:
|
|
13612
|
-
relativePathFromCwd:
|
|
13830
|
+
deleteSubagent: z50.object({
|
|
13831
|
+
relativePathFromCwd: z50.string()
|
|
13613
13832
|
})
|
|
13614
13833
|
};
|
|
13615
13834
|
var subagentTools = {
|
|
13616
13835
|
listSubagents: {
|
|
13617
13836
|
name: "listSubagents",
|
|
13618
|
-
description: `List all subagents from ${
|
|
13837
|
+
description: `List all subagents from ${join103(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13619
13838
|
parameters: subagentToolSchemas.listSubagents,
|
|
13620
13839
|
execute: async () => {
|
|
13621
13840
|
const subagents = await listSubagents();
|
|
@@ -13657,20 +13876,20 @@ var subagentTools = {
|
|
|
13657
13876
|
};
|
|
13658
13877
|
|
|
13659
13878
|
// src/mcp/tools.ts
|
|
13660
|
-
var rulesyncFeatureSchema =
|
|
13661
|
-
var rulesyncOperationSchema =
|
|
13662
|
-
var skillFileSchema =
|
|
13663
|
-
name:
|
|
13664
|
-
body:
|
|
13879
|
+
var rulesyncFeatureSchema = z51.enum(["rule", "command", "subagent", "skill", "ignore", "mcp"]);
|
|
13880
|
+
var rulesyncOperationSchema = z51.enum(["list", "get", "put", "delete"]);
|
|
13881
|
+
var skillFileSchema = z51.object({
|
|
13882
|
+
name: z51.string(),
|
|
13883
|
+
body: z51.string()
|
|
13665
13884
|
});
|
|
13666
|
-
var rulesyncToolSchema =
|
|
13885
|
+
var rulesyncToolSchema = z51.object({
|
|
13667
13886
|
feature: rulesyncFeatureSchema,
|
|
13668
13887
|
operation: rulesyncOperationSchema,
|
|
13669
|
-
targetPathFromCwd:
|
|
13670
|
-
frontmatter:
|
|
13671
|
-
body:
|
|
13672
|
-
otherFiles:
|
|
13673
|
-
content:
|
|
13888
|
+
targetPathFromCwd: z51.optional(z51.string()),
|
|
13889
|
+
frontmatter: z51.optional(z51.unknown()),
|
|
13890
|
+
body: z51.optional(z51.string()),
|
|
13891
|
+
otherFiles: z51.optional(z51.array(skillFileSchema)),
|
|
13892
|
+
content: z51.optional(z51.string())
|
|
13674
13893
|
});
|
|
13675
13894
|
var supportedOperationsByFeature = {
|
|
13676
13895
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -13866,7 +14085,7 @@ async function mcpCommand({ version }) {
|
|
|
13866
14085
|
}
|
|
13867
14086
|
|
|
13868
14087
|
// src/cli/index.ts
|
|
13869
|
-
var getVersion = () => "5.
|
|
14088
|
+
var getVersion = () => "5.8.0";
|
|
13870
14089
|
var main = async () => {
|
|
13871
14090
|
const program = new Command();
|
|
13872
14091
|
const version = getVersion();
|
|
@@ -13890,12 +14109,13 @@ var main = async () => {
|
|
|
13890
14109
|
(value) => {
|
|
13891
14110
|
return value.split(",").map((f) => f.trim());
|
|
13892
14111
|
}
|
|
13893
|
-
).option("-V, --verbose", "Verbose output").option("-g, --global", "Import for global(user scope) configuration files").action(async (options) => {
|
|
14112
|
+
).option("-V, --verbose", "Verbose output").option("-s, --silent", "Suppress all output").option("-g, --global", "Import for global(user scope) configuration files").action(async (options) => {
|
|
13894
14113
|
try {
|
|
13895
14114
|
await importCommand({
|
|
13896
14115
|
targets: options.targets,
|
|
13897
14116
|
features: options.features,
|
|
13898
14117
|
verbose: options.verbose,
|
|
14118
|
+
silent: options.silent,
|
|
13899
14119
|
configPath: options.config,
|
|
13900
14120
|
global: options.global
|
|
13901
14121
|
});
|
|
@@ -13927,7 +14147,7 @@ var main = async () => {
|
|
|
13927
14147
|
).option("--delete", "Delete all existing files in output directories before generating").option(
|
|
13928
14148
|
"-b, --base-dir <paths>",
|
|
13929
14149
|
"Base directories to generate files (comma-separated for multiple paths)"
|
|
13930
|
-
).option("-V, --verbose", "Verbose output").option("-c, --config <path>", "Path to configuration file").option("-g, --global", "Generate for global(user scope) configuration files").option(
|
|
14150
|
+
).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(
|
|
13931
14151
|
"--simulate-commands",
|
|
13932
14152
|
"Generate simulated commands. This feature is only available for copilot, cursor and codexcli."
|
|
13933
14153
|
).option(
|
|
@@ -13945,6 +14165,7 @@ var main = async () => {
|
|
|
13945
14165
|
targets: options.targets,
|
|
13946
14166
|
features: options.features,
|
|
13947
14167
|
verbose: options.verbose,
|
|
14168
|
+
silent: options.silent,
|
|
13948
14169
|
delete: options.delete,
|
|
13949
14170
|
baseDirs: options.baseDirs,
|
|
13950
14171
|
configPath: options.config,
|