rulesync 5.6.0 → 5.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/dist/index.cjs +827 -427
- package/dist/index.js +799 -399
- package/package.json +1 -1
package/dist/index.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);
|
|
@@ -8148,13 +8360,150 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8148
8360
|
}
|
|
8149
8361
|
};
|
|
8150
8362
|
|
|
8363
|
+
// src/features/subagents/kiro-subagent.ts
|
|
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()))
|
|
8381
|
+
});
|
|
8382
|
+
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
8383
|
+
body;
|
|
8384
|
+
constructor({ body, ...rest }) {
|
|
8385
|
+
super({
|
|
8386
|
+
...rest
|
|
8387
|
+
});
|
|
8388
|
+
this.body = body;
|
|
8389
|
+
}
|
|
8390
|
+
static getSettablePaths(_options = {}) {
|
|
8391
|
+
return {
|
|
8392
|
+
relativeDirPath: join70(".kiro", "agents")
|
|
8393
|
+
};
|
|
8394
|
+
}
|
|
8395
|
+
getBody() {
|
|
8396
|
+
return this.body;
|
|
8397
|
+
}
|
|
8398
|
+
toRulesyncSubagent() {
|
|
8399
|
+
const parsed = JSON.parse(this.body);
|
|
8400
|
+
const { name, description, prompt, ...restFields } = parsed;
|
|
8401
|
+
const kiroSection = {
|
|
8402
|
+
...restFields
|
|
8403
|
+
};
|
|
8404
|
+
const rulesyncFrontmatter = {
|
|
8405
|
+
targets: ["kiro"],
|
|
8406
|
+
name,
|
|
8407
|
+
description: description ?? "",
|
|
8408
|
+
// Only include kiro section if there are fields
|
|
8409
|
+
...Object.keys(kiroSection).length > 0 && { kiro: kiroSection }
|
|
8410
|
+
};
|
|
8411
|
+
return new RulesyncSubagent({
|
|
8412
|
+
baseDir: ".",
|
|
8413
|
+
frontmatter: rulesyncFrontmatter,
|
|
8414
|
+
body: prompt ?? "",
|
|
8415
|
+
relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
|
|
8416
|
+
relativeFilePath: this.getRelativeFilePath().replace(/\.json$/, ".md"),
|
|
8417
|
+
validate: true
|
|
8418
|
+
});
|
|
8419
|
+
}
|
|
8420
|
+
static fromRulesyncSubagent({
|
|
8421
|
+
baseDir = process.cwd(),
|
|
8422
|
+
rulesyncSubagent,
|
|
8423
|
+
validate = true,
|
|
8424
|
+
global = false
|
|
8425
|
+
}) {
|
|
8426
|
+
const frontmatter = rulesyncSubagent.getFrontmatter();
|
|
8427
|
+
const kiroSection = frontmatter.kiro ?? {};
|
|
8428
|
+
const json = {
|
|
8429
|
+
name: frontmatter.name,
|
|
8430
|
+
description: frontmatter.description || null,
|
|
8431
|
+
prompt: rulesyncSubagent.getBody() || null,
|
|
8432
|
+
...kiroSection
|
|
8433
|
+
};
|
|
8434
|
+
const body = JSON.stringify(json, null, 2);
|
|
8435
|
+
const paths = this.getSettablePaths({ global });
|
|
8436
|
+
const relativeFilePath = rulesyncSubagent.getRelativeFilePath().replace(/\.md$/, ".json");
|
|
8437
|
+
return new _KiroSubagent({
|
|
8438
|
+
baseDir,
|
|
8439
|
+
body,
|
|
8440
|
+
relativeDirPath: paths.relativeDirPath,
|
|
8441
|
+
relativeFilePath,
|
|
8442
|
+
fileContent: body,
|
|
8443
|
+
validate,
|
|
8444
|
+
global
|
|
8445
|
+
});
|
|
8446
|
+
}
|
|
8447
|
+
validate() {
|
|
8448
|
+
try {
|
|
8449
|
+
const parsed = JSON.parse(this.body);
|
|
8450
|
+
KiroCliSubagentJsonSchema.parse(parsed);
|
|
8451
|
+
return { success: true, error: null };
|
|
8452
|
+
} catch (error) {
|
|
8453
|
+
return {
|
|
8454
|
+
success: false,
|
|
8455
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
8456
|
+
};
|
|
8457
|
+
}
|
|
8458
|
+
}
|
|
8459
|
+
static isTargetedByRulesyncSubagent(rulesyncSubagent) {
|
|
8460
|
+
return this.isTargetedByRulesyncSubagentDefault({
|
|
8461
|
+
rulesyncSubagent,
|
|
8462
|
+
toolTarget: "kiro"
|
|
8463
|
+
});
|
|
8464
|
+
}
|
|
8465
|
+
static async fromFile({
|
|
8466
|
+
baseDir = process.cwd(),
|
|
8467
|
+
relativeFilePath,
|
|
8468
|
+
validate = true,
|
|
8469
|
+
global = false
|
|
8470
|
+
}) {
|
|
8471
|
+
const paths = this.getSettablePaths({ global });
|
|
8472
|
+
const filePath = join70(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8473
|
+
const fileContent = await readFileContent(filePath);
|
|
8474
|
+
return new _KiroSubagent({
|
|
8475
|
+
baseDir,
|
|
8476
|
+
relativeDirPath: paths.relativeDirPath,
|
|
8477
|
+
relativeFilePath,
|
|
8478
|
+
body: fileContent.trim(),
|
|
8479
|
+
fileContent,
|
|
8480
|
+
validate,
|
|
8481
|
+
global
|
|
8482
|
+
});
|
|
8483
|
+
}
|
|
8484
|
+
static forDeletion({
|
|
8485
|
+
baseDir = process.cwd(),
|
|
8486
|
+
relativeDirPath,
|
|
8487
|
+
relativeFilePath
|
|
8488
|
+
}) {
|
|
8489
|
+
return new _KiroSubagent({
|
|
8490
|
+
baseDir,
|
|
8491
|
+
relativeDirPath,
|
|
8492
|
+
relativeFilePath,
|
|
8493
|
+
body: "",
|
|
8494
|
+
fileContent: "",
|
|
8495
|
+
validate: false
|
|
8496
|
+
});
|
|
8497
|
+
}
|
|
8498
|
+
};
|
|
8499
|
+
|
|
8151
8500
|
// src/features/subagents/opencode-subagent.ts
|
|
8152
|
-
import { basename as basename20, join as
|
|
8153
|
-
import { z as
|
|
8154
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
8155
|
-
description:
|
|
8156
|
-
mode:
|
|
8157
|
-
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())
|
|
8158
8507
|
});
|
|
8159
8508
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
8160
8509
|
frontmatter;
|
|
@@ -8164,7 +8513,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8164
8513
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8165
8514
|
if (!result.success) {
|
|
8166
8515
|
throw new Error(
|
|
8167
|
-
`Invalid frontmatter in ${
|
|
8516
|
+
`Invalid frontmatter in ${join71(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8168
8517
|
);
|
|
8169
8518
|
}
|
|
8170
8519
|
}
|
|
@@ -8178,7 +8527,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8178
8527
|
global = false
|
|
8179
8528
|
} = {}) {
|
|
8180
8529
|
return {
|
|
8181
|
-
relativeDirPath: global ?
|
|
8530
|
+
relativeDirPath: global ? join71(".config", "opencode", "agent") : join71(".opencode", "agent")
|
|
8182
8531
|
};
|
|
8183
8532
|
}
|
|
8184
8533
|
getFrontmatter() {
|
|
@@ -8244,7 +8593,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8244
8593
|
return {
|
|
8245
8594
|
success: false,
|
|
8246
8595
|
error: new Error(
|
|
8247
|
-
`Invalid frontmatter in ${
|
|
8596
|
+
`Invalid frontmatter in ${join71(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8248
8597
|
)
|
|
8249
8598
|
};
|
|
8250
8599
|
}
|
|
@@ -8261,7 +8610,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8261
8610
|
global = false
|
|
8262
8611
|
}) {
|
|
8263
8612
|
const paths = this.getSettablePaths({ global });
|
|
8264
|
-
const filePath =
|
|
8613
|
+
const filePath = join71(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8265
8614
|
const fileContent = await readFileContent(filePath);
|
|
8266
8615
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8267
8616
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8305,41 +8654,82 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
8305
8654
|
"copilot",
|
|
8306
8655
|
"cursor",
|
|
8307
8656
|
"geminicli",
|
|
8657
|
+
"kiro",
|
|
8308
8658
|
"opencode",
|
|
8309
8659
|
"roo"
|
|
8310
8660
|
];
|
|
8311
|
-
var SubagentsProcessorToolTargetSchema =
|
|
8661
|
+
var SubagentsProcessorToolTargetSchema = z37.enum(subagentsProcessorToolTargetTuple);
|
|
8312
8662
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
8313
8663
|
[
|
|
8314
8664
|
"agentsmd",
|
|
8315
|
-
{
|
|
8665
|
+
{
|
|
8666
|
+
class: AgentsmdSubagent,
|
|
8667
|
+
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
8668
|
+
}
|
|
8316
8669
|
],
|
|
8317
8670
|
[
|
|
8318
8671
|
"claudecode",
|
|
8319
|
-
{
|
|
8672
|
+
{
|
|
8673
|
+
class: ClaudecodeSubagent,
|
|
8674
|
+
meta: { supportsSimulated: false, supportsGlobal: true, filePattern: "*.md" }
|
|
8675
|
+
}
|
|
8320
8676
|
],
|
|
8321
8677
|
[
|
|
8322
8678
|
"claudecode-legacy",
|
|
8323
|
-
{
|
|
8679
|
+
{
|
|
8680
|
+
class: ClaudecodeSubagent,
|
|
8681
|
+
meta: { supportsSimulated: false, supportsGlobal: true, filePattern: "*.md" }
|
|
8682
|
+
}
|
|
8324
8683
|
],
|
|
8325
8684
|
[
|
|
8326
8685
|
"codexcli",
|
|
8327
|
-
{
|
|
8686
|
+
{
|
|
8687
|
+
class: CodexCliSubagent,
|
|
8688
|
+
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
8689
|
+
}
|
|
8328
8690
|
],
|
|
8329
8691
|
[
|
|
8330
8692
|
"copilot",
|
|
8331
|
-
{
|
|
8693
|
+
{
|
|
8694
|
+
class: CopilotSubagent,
|
|
8695
|
+
meta: { supportsSimulated: false, supportsGlobal: false, filePattern: "*.md" }
|
|
8696
|
+
}
|
|
8697
|
+
],
|
|
8698
|
+
[
|
|
8699
|
+
"cursor",
|
|
8700
|
+
{
|
|
8701
|
+
class: CursorSubagent,
|
|
8702
|
+
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
8703
|
+
}
|
|
8332
8704
|
],
|
|
8333
|
-
["cursor", { class: CursorSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }],
|
|
8334
8705
|
[
|
|
8335
8706
|
"geminicli",
|
|
8336
|
-
{
|
|
8707
|
+
{
|
|
8708
|
+
class: GeminiCliSubagent,
|
|
8709
|
+
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
8710
|
+
}
|
|
8711
|
+
],
|
|
8712
|
+
[
|
|
8713
|
+
"kiro",
|
|
8714
|
+
{
|
|
8715
|
+
class: KiroSubagent,
|
|
8716
|
+
meta: { supportsSimulated: false, supportsGlobal: false, filePattern: "*.json" }
|
|
8717
|
+
}
|
|
8337
8718
|
],
|
|
8338
8719
|
[
|
|
8339
8720
|
"opencode",
|
|
8340
|
-
{
|
|
8721
|
+
{
|
|
8722
|
+
class: OpenCodeSubagent,
|
|
8723
|
+
meta: { supportsSimulated: false, supportsGlobal: true, filePattern: "*.md" }
|
|
8724
|
+
}
|
|
8341
8725
|
],
|
|
8342
|
-
[
|
|
8726
|
+
[
|
|
8727
|
+
"roo",
|
|
8728
|
+
{
|
|
8729
|
+
class: RooSubagent,
|
|
8730
|
+
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
8731
|
+
}
|
|
8732
|
+
]
|
|
8343
8733
|
]);
|
|
8344
8734
|
var defaultGetFactory5 = (target) => {
|
|
8345
8735
|
const factory = toolSubagentFactories.get(target);
|
|
@@ -8422,7 +8812,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8422
8812
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
8423
8813
|
*/
|
|
8424
8814
|
async loadRulesyncFiles() {
|
|
8425
|
-
const subagentsDir =
|
|
8815
|
+
const subagentsDir = join72(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
8426
8816
|
const dirExists = await directoryExists(subagentsDir);
|
|
8427
8817
|
if (!dirExists) {
|
|
8428
8818
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -8437,7 +8827,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8437
8827
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
8438
8828
|
const rulesyncSubagents = [];
|
|
8439
8829
|
for (const mdFile of mdFiles) {
|
|
8440
|
-
const filepath =
|
|
8830
|
+
const filepath = join72(subagentsDir, mdFile);
|
|
8441
8831
|
try {
|
|
8442
8832
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
8443
8833
|
relativeFilePath: mdFile,
|
|
@@ -8467,7 +8857,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8467
8857
|
const factory = this.getFactory(this.toolTarget);
|
|
8468
8858
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
8469
8859
|
const subagentFilePaths = await findFilesByGlobs(
|
|
8470
|
-
|
|
8860
|
+
join72(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
8471
8861
|
);
|
|
8472
8862
|
if (forDeletion) {
|
|
8473
8863
|
const toolSubagents2 = subagentFilePaths.map(
|
|
@@ -8517,48 +8907,48 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8517
8907
|
};
|
|
8518
8908
|
|
|
8519
8909
|
// src/features/rules/agentsmd-rule.ts
|
|
8520
|
-
import { join as
|
|
8910
|
+
import { join as join75 } from "path";
|
|
8521
8911
|
|
|
8522
8912
|
// src/features/rules/tool-rule.ts
|
|
8523
|
-
import { join as
|
|
8913
|
+
import { join as join74 } from "path";
|
|
8524
8914
|
|
|
8525
8915
|
// src/features/rules/rulesync-rule.ts
|
|
8526
|
-
import { basename as basename22, join as
|
|
8527
|
-
import { z as
|
|
8528
|
-
var RulesyncRuleFrontmatterSchema =
|
|
8529
|
-
root:
|
|
8530
|
-
targets:
|
|
8531
|
-
description:
|
|
8532
|
-
globs:
|
|
8533
|
-
agentsmd:
|
|
8534
|
-
|
|
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({
|
|
8535
8925
|
// @example "path/to/subproject"
|
|
8536
|
-
subprojectPath:
|
|
8926
|
+
subprojectPath: z38.optional(z38.string())
|
|
8537
8927
|
})
|
|
8538
8928
|
),
|
|
8539
|
-
claudecode:
|
|
8540
|
-
|
|
8929
|
+
claudecode: z38.optional(
|
|
8930
|
+
z38.object({
|
|
8541
8931
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
8542
8932
|
// @example "src/**/*.ts, tests/**/*.test.ts"
|
|
8543
|
-
paths:
|
|
8933
|
+
paths: z38.optional(z38.string())
|
|
8544
8934
|
})
|
|
8545
8935
|
),
|
|
8546
|
-
cursor:
|
|
8547
|
-
|
|
8548
|
-
alwaysApply:
|
|
8549
|
-
description:
|
|
8550
|
-
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()))
|
|
8551
8941
|
})
|
|
8552
8942
|
),
|
|
8553
|
-
copilot:
|
|
8554
|
-
|
|
8555
|
-
excludeAgent:
|
|
8943
|
+
copilot: z38.optional(
|
|
8944
|
+
z38.object({
|
|
8945
|
+
excludeAgent: z38.optional(z38.union([z38.literal("code-review"), z38.literal("coding-agent")]))
|
|
8556
8946
|
})
|
|
8557
8947
|
),
|
|
8558
|
-
antigravity:
|
|
8559
|
-
|
|
8560
|
-
trigger:
|
|
8561
|
-
globs:
|
|
8948
|
+
antigravity: z38.optional(
|
|
8949
|
+
z38.looseObject({
|
|
8950
|
+
trigger: z38.optional(z38.string()),
|
|
8951
|
+
globs: z38.optional(z38.array(z38.string()))
|
|
8562
8952
|
})
|
|
8563
8953
|
)
|
|
8564
8954
|
});
|
|
@@ -8570,7 +8960,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8570
8960
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8571
8961
|
if (!result.success) {
|
|
8572
8962
|
throw new Error(
|
|
8573
|
-
`Invalid frontmatter in ${
|
|
8963
|
+
`Invalid frontmatter in ${join73(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8574
8964
|
);
|
|
8575
8965
|
}
|
|
8576
8966
|
}
|
|
@@ -8605,7 +8995,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8605
8995
|
return {
|
|
8606
8996
|
success: false,
|
|
8607
8997
|
error: new Error(
|
|
8608
|
-
`Invalid frontmatter in ${
|
|
8998
|
+
`Invalid frontmatter in ${join73(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8609
8999
|
)
|
|
8610
9000
|
};
|
|
8611
9001
|
}
|
|
@@ -8614,12 +9004,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8614
9004
|
relativeFilePath,
|
|
8615
9005
|
validate = true
|
|
8616
9006
|
}) {
|
|
8617
|
-
const legacyPath =
|
|
9007
|
+
const legacyPath = join73(
|
|
8618
9008
|
process.cwd(),
|
|
8619
9009
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
8620
9010
|
relativeFilePath
|
|
8621
9011
|
);
|
|
8622
|
-
const recommendedPath =
|
|
9012
|
+
const recommendedPath = join73(
|
|
8623
9013
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8624
9014
|
relativeFilePath
|
|
8625
9015
|
);
|
|
@@ -8654,7 +9044,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8654
9044
|
relativeFilePath,
|
|
8655
9045
|
validate = true
|
|
8656
9046
|
}) {
|
|
8657
|
-
const filePath =
|
|
9047
|
+
const filePath = join73(
|
|
8658
9048
|
process.cwd(),
|
|
8659
9049
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8660
9050
|
relativeFilePath
|
|
@@ -8756,7 +9146,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8756
9146
|
rulesyncRule,
|
|
8757
9147
|
validate = true,
|
|
8758
9148
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
8759
|
-
nonRootPath = { relativeDirPath:
|
|
9149
|
+
nonRootPath = { relativeDirPath: join74(".agents", "memories") }
|
|
8760
9150
|
}) {
|
|
8761
9151
|
const params = this.buildToolRuleParamsDefault({
|
|
8762
9152
|
baseDir,
|
|
@@ -8767,7 +9157,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8767
9157
|
});
|
|
8768
9158
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
8769
9159
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
8770
|
-
params.relativeDirPath =
|
|
9160
|
+
params.relativeDirPath = join74(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
8771
9161
|
params.relativeFilePath = "AGENTS.md";
|
|
8772
9162
|
}
|
|
8773
9163
|
return params;
|
|
@@ -8832,7 +9222,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8832
9222
|
relativeFilePath: "AGENTS.md"
|
|
8833
9223
|
},
|
|
8834
9224
|
nonRoot: {
|
|
8835
|
-
relativeDirPath:
|
|
9225
|
+
relativeDirPath: join75(".agents", "memories")
|
|
8836
9226
|
}
|
|
8837
9227
|
};
|
|
8838
9228
|
}
|
|
@@ -8842,8 +9232,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8842
9232
|
validate = true
|
|
8843
9233
|
}) {
|
|
8844
9234
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
8845
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
8846
|
-
const fileContent = await readFileContent(
|
|
9235
|
+
const relativePath = isRoot ? "AGENTS.md" : join75(".agents", "memories", relativeFilePath);
|
|
9236
|
+
const fileContent = await readFileContent(join75(baseDir, relativePath));
|
|
8847
9237
|
return new _AgentsMdRule({
|
|
8848
9238
|
baseDir,
|
|
8849
9239
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -8898,21 +9288,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8898
9288
|
};
|
|
8899
9289
|
|
|
8900
9290
|
// src/features/rules/antigravity-rule.ts
|
|
8901
|
-
import { join as
|
|
8902
|
-
import { z as
|
|
8903
|
-
var AntigravityRuleFrontmatterSchema =
|
|
8904
|
-
trigger:
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
|
|
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()
|
|
8911
9301
|
// accepts any string for forward compatibility
|
|
8912
9302
|
])
|
|
8913
9303
|
),
|
|
8914
|
-
globs:
|
|
8915
|
-
description:
|
|
9304
|
+
globs: z39.optional(z39.string()),
|
|
9305
|
+
description: z39.optional(z39.string())
|
|
8916
9306
|
});
|
|
8917
9307
|
function parseGlobsString(globs) {
|
|
8918
9308
|
if (!globs) {
|
|
@@ -9057,7 +9447,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9057
9447
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9058
9448
|
if (!result.success) {
|
|
9059
9449
|
throw new Error(
|
|
9060
|
-
`Invalid frontmatter in ${
|
|
9450
|
+
`Invalid frontmatter in ${join76(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9061
9451
|
);
|
|
9062
9452
|
}
|
|
9063
9453
|
}
|
|
@@ -9072,7 +9462,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9072
9462
|
static getSettablePaths() {
|
|
9073
9463
|
return {
|
|
9074
9464
|
nonRoot: {
|
|
9075
|
-
relativeDirPath:
|
|
9465
|
+
relativeDirPath: join76(".agent", "rules")
|
|
9076
9466
|
}
|
|
9077
9467
|
};
|
|
9078
9468
|
}
|
|
@@ -9081,7 +9471,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9081
9471
|
relativeFilePath,
|
|
9082
9472
|
validate = true
|
|
9083
9473
|
}) {
|
|
9084
|
-
const filePath =
|
|
9474
|
+
const filePath = join76(
|
|
9085
9475
|
baseDir,
|
|
9086
9476
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
9087
9477
|
relativeFilePath
|
|
@@ -9222,7 +9612,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9222
9612
|
};
|
|
9223
9613
|
|
|
9224
9614
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
9225
|
-
import { join as
|
|
9615
|
+
import { join as join77 } from "path";
|
|
9226
9616
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
9227
9617
|
toRulesyncRule() {
|
|
9228
9618
|
const rulesyncFrontmatter = {
|
|
@@ -9248,7 +9638,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9248
9638
|
relativeFilePath: ".augment-guidelines"
|
|
9249
9639
|
},
|
|
9250
9640
|
nonRoot: {
|
|
9251
|
-
relativeDirPath:
|
|
9641
|
+
relativeDirPath: join77(".augment", "rules")
|
|
9252
9642
|
}
|
|
9253
9643
|
};
|
|
9254
9644
|
}
|
|
@@ -9283,8 +9673,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9283
9673
|
}) {
|
|
9284
9674
|
const settablePaths = this.getSettablePaths();
|
|
9285
9675
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
9286
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
9287
|
-
const fileContent = await readFileContent(
|
|
9676
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join77(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9677
|
+
const fileContent = await readFileContent(join77(baseDir, relativePath));
|
|
9288
9678
|
return new _AugmentcodeLegacyRule({
|
|
9289
9679
|
baseDir,
|
|
9290
9680
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -9313,7 +9703,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9313
9703
|
};
|
|
9314
9704
|
|
|
9315
9705
|
// src/features/rules/augmentcode-rule.ts
|
|
9316
|
-
import { join as
|
|
9706
|
+
import { join as join78 } from "path";
|
|
9317
9707
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
9318
9708
|
toRulesyncRule() {
|
|
9319
9709
|
return this.toRulesyncRuleDefault();
|
|
@@ -9321,7 +9711,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9321
9711
|
static getSettablePaths() {
|
|
9322
9712
|
return {
|
|
9323
9713
|
nonRoot: {
|
|
9324
|
-
relativeDirPath:
|
|
9714
|
+
relativeDirPath: join78(".augment", "rules")
|
|
9325
9715
|
}
|
|
9326
9716
|
};
|
|
9327
9717
|
}
|
|
@@ -9345,7 +9735,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9345
9735
|
validate = true
|
|
9346
9736
|
}) {
|
|
9347
9737
|
const fileContent = await readFileContent(
|
|
9348
|
-
|
|
9738
|
+
join78(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9349
9739
|
);
|
|
9350
9740
|
const { body: content } = parseFrontmatter(fileContent);
|
|
9351
9741
|
return new _AugmentcodeRule({
|
|
@@ -9381,7 +9771,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9381
9771
|
};
|
|
9382
9772
|
|
|
9383
9773
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
9384
|
-
import { join as
|
|
9774
|
+
import { join as join79 } from "path";
|
|
9385
9775
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
9386
9776
|
static getSettablePaths({
|
|
9387
9777
|
global
|
|
@@ -9400,7 +9790,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9400
9790
|
relativeFilePath: "CLAUDE.md"
|
|
9401
9791
|
},
|
|
9402
9792
|
nonRoot: {
|
|
9403
|
-
relativeDirPath:
|
|
9793
|
+
relativeDirPath: join79(".claude", "memories")
|
|
9404
9794
|
}
|
|
9405
9795
|
};
|
|
9406
9796
|
}
|
|
@@ -9415,7 +9805,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9415
9805
|
if (isRoot) {
|
|
9416
9806
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9417
9807
|
const fileContent2 = await readFileContent(
|
|
9418
|
-
|
|
9808
|
+
join79(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9419
9809
|
);
|
|
9420
9810
|
return new _ClaudecodeLegacyRule({
|
|
9421
9811
|
baseDir,
|
|
@@ -9429,8 +9819,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9429
9819
|
if (!paths.nonRoot) {
|
|
9430
9820
|
throw new Error("nonRoot path is not set");
|
|
9431
9821
|
}
|
|
9432
|
-
const relativePath =
|
|
9433
|
-
const fileContent = await readFileContent(
|
|
9822
|
+
const relativePath = join79(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9823
|
+
const fileContent = await readFileContent(join79(baseDir, relativePath));
|
|
9434
9824
|
return new _ClaudecodeLegacyRule({
|
|
9435
9825
|
baseDir,
|
|
9436
9826
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9489,10 +9879,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9489
9879
|
};
|
|
9490
9880
|
|
|
9491
9881
|
// src/features/rules/claudecode-rule.ts
|
|
9492
|
-
import { join as
|
|
9493
|
-
import { z as
|
|
9494
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
9495
|
-
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())
|
|
9496
9886
|
});
|
|
9497
9887
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
9498
9888
|
frontmatter;
|
|
@@ -9514,7 +9904,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9514
9904
|
relativeFilePath: "CLAUDE.md"
|
|
9515
9905
|
},
|
|
9516
9906
|
nonRoot: {
|
|
9517
|
-
relativeDirPath:
|
|
9907
|
+
relativeDirPath: join80(".claude", "rules")
|
|
9518
9908
|
}
|
|
9519
9909
|
};
|
|
9520
9910
|
}
|
|
@@ -9523,7 +9913,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9523
9913
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9524
9914
|
if (!result.success) {
|
|
9525
9915
|
throw new Error(
|
|
9526
|
-
`Invalid frontmatter in ${
|
|
9916
|
+
`Invalid frontmatter in ${join80(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9527
9917
|
);
|
|
9528
9918
|
}
|
|
9529
9919
|
}
|
|
@@ -9551,7 +9941,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9551
9941
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
9552
9942
|
if (isRoot) {
|
|
9553
9943
|
const fileContent2 = await readFileContent(
|
|
9554
|
-
|
|
9944
|
+
join80(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
9555
9945
|
);
|
|
9556
9946
|
return new _ClaudecodeRule({
|
|
9557
9947
|
baseDir,
|
|
@@ -9566,13 +9956,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9566
9956
|
if (!paths.nonRoot) {
|
|
9567
9957
|
throw new Error("nonRoot path is not set");
|
|
9568
9958
|
}
|
|
9569
|
-
const relativePath =
|
|
9570
|
-
const fileContent = await readFileContent(
|
|
9959
|
+
const relativePath = join80(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9960
|
+
const fileContent = await readFileContent(join80(baseDir, relativePath));
|
|
9571
9961
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9572
9962
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9573
9963
|
if (!result.success) {
|
|
9574
9964
|
throw new Error(
|
|
9575
|
-
`Invalid frontmatter in ${
|
|
9965
|
+
`Invalid frontmatter in ${join80(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
9576
9966
|
);
|
|
9577
9967
|
}
|
|
9578
9968
|
return new _ClaudecodeRule({
|
|
@@ -9679,7 +10069,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9679
10069
|
return {
|
|
9680
10070
|
success: false,
|
|
9681
10071
|
error: new Error(
|
|
9682
|
-
`Invalid frontmatter in ${
|
|
10072
|
+
`Invalid frontmatter in ${join80(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9683
10073
|
)
|
|
9684
10074
|
};
|
|
9685
10075
|
}
|
|
@@ -9699,10 +10089,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9699
10089
|
};
|
|
9700
10090
|
|
|
9701
10091
|
// src/features/rules/cline-rule.ts
|
|
9702
|
-
import { join as
|
|
9703
|
-
import { z as
|
|
9704
|
-
var ClineRuleFrontmatterSchema =
|
|
9705
|
-
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()
|
|
9706
10096
|
});
|
|
9707
10097
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
9708
10098
|
static getSettablePaths() {
|
|
@@ -9744,7 +10134,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9744
10134
|
validate = true
|
|
9745
10135
|
}) {
|
|
9746
10136
|
const fileContent = await readFileContent(
|
|
9747
|
-
|
|
10137
|
+
join81(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9748
10138
|
);
|
|
9749
10139
|
return new _ClineRule({
|
|
9750
10140
|
baseDir,
|
|
@@ -9770,7 +10160,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9770
10160
|
};
|
|
9771
10161
|
|
|
9772
10162
|
// src/features/rules/codexcli-rule.ts
|
|
9773
|
-
import { join as
|
|
10163
|
+
import { join as join82 } from "path";
|
|
9774
10164
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
9775
10165
|
static getSettablePaths({
|
|
9776
10166
|
global
|
|
@@ -9789,7 +10179,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9789
10179
|
relativeFilePath: "AGENTS.md"
|
|
9790
10180
|
},
|
|
9791
10181
|
nonRoot: {
|
|
9792
|
-
relativeDirPath:
|
|
10182
|
+
relativeDirPath: join82(".codex", "memories")
|
|
9793
10183
|
}
|
|
9794
10184
|
};
|
|
9795
10185
|
}
|
|
@@ -9804,7 +10194,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9804
10194
|
if (isRoot) {
|
|
9805
10195
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9806
10196
|
const fileContent2 = await readFileContent(
|
|
9807
|
-
|
|
10197
|
+
join82(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9808
10198
|
);
|
|
9809
10199
|
return new _CodexcliRule({
|
|
9810
10200
|
baseDir,
|
|
@@ -9818,8 +10208,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9818
10208
|
if (!paths.nonRoot) {
|
|
9819
10209
|
throw new Error("nonRoot path is not set");
|
|
9820
10210
|
}
|
|
9821
|
-
const relativePath =
|
|
9822
|
-
const fileContent = await readFileContent(
|
|
10211
|
+
const relativePath = join82(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10212
|
+
const fileContent = await readFileContent(join82(baseDir, relativePath));
|
|
9823
10213
|
return new _CodexcliRule({
|
|
9824
10214
|
baseDir,
|
|
9825
10215
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9878,12 +10268,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9878
10268
|
};
|
|
9879
10269
|
|
|
9880
10270
|
// src/features/rules/copilot-rule.ts
|
|
9881
|
-
import { join as
|
|
9882
|
-
import { z as
|
|
9883
|
-
var CopilotRuleFrontmatterSchema =
|
|
9884
|
-
description:
|
|
9885
|
-
applyTo:
|
|
9886
|
-
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")]))
|
|
9887
10277
|
});
|
|
9888
10278
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
9889
10279
|
frontmatter;
|
|
@@ -9895,7 +10285,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9895
10285
|
relativeFilePath: "copilot-instructions.md"
|
|
9896
10286
|
},
|
|
9897
10287
|
nonRoot: {
|
|
9898
|
-
relativeDirPath:
|
|
10288
|
+
relativeDirPath: join83(".github", "instructions")
|
|
9899
10289
|
}
|
|
9900
10290
|
};
|
|
9901
10291
|
}
|
|
@@ -9904,7 +10294,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9904
10294
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9905
10295
|
if (!result.success) {
|
|
9906
10296
|
throw new Error(
|
|
9907
|
-
`Invalid frontmatter in ${
|
|
10297
|
+
`Invalid frontmatter in ${join83(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9908
10298
|
);
|
|
9909
10299
|
}
|
|
9910
10300
|
}
|
|
@@ -9986,11 +10376,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9986
10376
|
validate = true
|
|
9987
10377
|
}) {
|
|
9988
10378
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
9989
|
-
const relativePath = isRoot ?
|
|
10379
|
+
const relativePath = isRoot ? join83(
|
|
9990
10380
|
this.getSettablePaths().root.relativeDirPath,
|
|
9991
10381
|
this.getSettablePaths().root.relativeFilePath
|
|
9992
|
-
) :
|
|
9993
|
-
const fileContent = await readFileContent(
|
|
10382
|
+
) : join83(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10383
|
+
const fileContent = await readFileContent(join83(baseDir, relativePath));
|
|
9994
10384
|
if (isRoot) {
|
|
9995
10385
|
return new _CopilotRule({
|
|
9996
10386
|
baseDir,
|
|
@@ -10006,7 +10396,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10006
10396
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10007
10397
|
if (!result.success) {
|
|
10008
10398
|
throw new Error(
|
|
10009
|
-
`Invalid frontmatter in ${
|
|
10399
|
+
`Invalid frontmatter in ${join83(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10010
10400
|
);
|
|
10011
10401
|
}
|
|
10012
10402
|
return new _CopilotRule({
|
|
@@ -10046,7 +10436,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10046
10436
|
return {
|
|
10047
10437
|
success: false,
|
|
10048
10438
|
error: new Error(
|
|
10049
|
-
`Invalid frontmatter in ${
|
|
10439
|
+
`Invalid frontmatter in ${join83(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10050
10440
|
)
|
|
10051
10441
|
};
|
|
10052
10442
|
}
|
|
@@ -10066,12 +10456,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10066
10456
|
};
|
|
10067
10457
|
|
|
10068
10458
|
// src/features/rules/cursor-rule.ts
|
|
10069
|
-
import { basename as basename23, join as
|
|
10070
|
-
import { z as
|
|
10071
|
-
var CursorRuleFrontmatterSchema =
|
|
10072
|
-
description:
|
|
10073
|
-
globs:
|
|
10074
|
-
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())
|
|
10075
10465
|
});
|
|
10076
10466
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
10077
10467
|
frontmatter;
|
|
@@ -10079,7 +10469,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10079
10469
|
static getSettablePaths() {
|
|
10080
10470
|
return {
|
|
10081
10471
|
nonRoot: {
|
|
10082
|
-
relativeDirPath:
|
|
10472
|
+
relativeDirPath: join84(".cursor", "rules")
|
|
10083
10473
|
}
|
|
10084
10474
|
};
|
|
10085
10475
|
}
|
|
@@ -10088,7 +10478,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10088
10478
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10089
10479
|
if (!result.success) {
|
|
10090
10480
|
throw new Error(
|
|
10091
|
-
`Invalid frontmatter in ${
|
|
10481
|
+
`Invalid frontmatter in ${join84(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10092
10482
|
);
|
|
10093
10483
|
}
|
|
10094
10484
|
}
|
|
@@ -10205,13 +10595,13 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10205
10595
|
validate = true
|
|
10206
10596
|
}) {
|
|
10207
10597
|
const fileContent = await readFileContent(
|
|
10208
|
-
|
|
10598
|
+
join84(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10209
10599
|
);
|
|
10210
10600
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
10211
10601
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10212
10602
|
if (!result.success) {
|
|
10213
10603
|
throw new Error(
|
|
10214
|
-
`Invalid frontmatter in ${
|
|
10604
|
+
`Invalid frontmatter in ${join84(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10215
10605
|
);
|
|
10216
10606
|
}
|
|
10217
10607
|
return new _CursorRule({
|
|
@@ -10248,7 +10638,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10248
10638
|
return {
|
|
10249
10639
|
success: false,
|
|
10250
10640
|
error: new Error(
|
|
10251
|
-
`Invalid frontmatter in ${
|
|
10641
|
+
`Invalid frontmatter in ${join84(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10252
10642
|
)
|
|
10253
10643
|
};
|
|
10254
10644
|
}
|
|
@@ -10268,7 +10658,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10268
10658
|
};
|
|
10269
10659
|
|
|
10270
10660
|
// src/features/rules/geminicli-rule.ts
|
|
10271
|
-
import { join as
|
|
10661
|
+
import { join as join85 } from "path";
|
|
10272
10662
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
10273
10663
|
static getSettablePaths({
|
|
10274
10664
|
global
|
|
@@ -10287,7 +10677,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10287
10677
|
relativeFilePath: "GEMINI.md"
|
|
10288
10678
|
},
|
|
10289
10679
|
nonRoot: {
|
|
10290
|
-
relativeDirPath:
|
|
10680
|
+
relativeDirPath: join85(".gemini", "memories")
|
|
10291
10681
|
}
|
|
10292
10682
|
};
|
|
10293
10683
|
}
|
|
@@ -10302,7 +10692,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10302
10692
|
if (isRoot) {
|
|
10303
10693
|
const relativePath2 = paths.root.relativeFilePath;
|
|
10304
10694
|
const fileContent2 = await readFileContent(
|
|
10305
|
-
|
|
10695
|
+
join85(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
10306
10696
|
);
|
|
10307
10697
|
return new _GeminiCliRule({
|
|
10308
10698
|
baseDir,
|
|
@@ -10316,8 +10706,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10316
10706
|
if (!paths.nonRoot) {
|
|
10317
10707
|
throw new Error("nonRoot path is not set");
|
|
10318
10708
|
}
|
|
10319
|
-
const relativePath =
|
|
10320
|
-
const fileContent = await readFileContent(
|
|
10709
|
+
const relativePath = join85(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10710
|
+
const fileContent = await readFileContent(join85(baseDir, relativePath));
|
|
10321
10711
|
return new _GeminiCliRule({
|
|
10322
10712
|
baseDir,
|
|
10323
10713
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10376,7 +10766,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10376
10766
|
};
|
|
10377
10767
|
|
|
10378
10768
|
// src/features/rules/junie-rule.ts
|
|
10379
|
-
import { join as
|
|
10769
|
+
import { join as join86 } from "path";
|
|
10380
10770
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
10381
10771
|
static getSettablePaths() {
|
|
10382
10772
|
return {
|
|
@@ -10385,7 +10775,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10385
10775
|
relativeFilePath: "guidelines.md"
|
|
10386
10776
|
},
|
|
10387
10777
|
nonRoot: {
|
|
10388
|
-
relativeDirPath:
|
|
10778
|
+
relativeDirPath: join86(".junie", "memories")
|
|
10389
10779
|
}
|
|
10390
10780
|
};
|
|
10391
10781
|
}
|
|
@@ -10395,8 +10785,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10395
10785
|
validate = true
|
|
10396
10786
|
}) {
|
|
10397
10787
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
10398
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
10399
|
-
const fileContent = await readFileContent(
|
|
10788
|
+
const relativePath = isRoot ? "guidelines.md" : join86(".junie", "memories", relativeFilePath);
|
|
10789
|
+
const fileContent = await readFileContent(join86(baseDir, relativePath));
|
|
10400
10790
|
return new _JunieRule({
|
|
10401
10791
|
baseDir,
|
|
10402
10792
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10451,12 +10841,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10451
10841
|
};
|
|
10452
10842
|
|
|
10453
10843
|
// src/features/rules/kilo-rule.ts
|
|
10454
|
-
import { join as
|
|
10844
|
+
import { join as join87 } from "path";
|
|
10455
10845
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
10456
10846
|
static getSettablePaths(_options = {}) {
|
|
10457
10847
|
return {
|
|
10458
10848
|
nonRoot: {
|
|
10459
|
-
relativeDirPath:
|
|
10849
|
+
relativeDirPath: join87(".kilocode", "rules")
|
|
10460
10850
|
}
|
|
10461
10851
|
};
|
|
10462
10852
|
}
|
|
@@ -10466,7 +10856,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10466
10856
|
validate = true
|
|
10467
10857
|
}) {
|
|
10468
10858
|
const fileContent = await readFileContent(
|
|
10469
|
-
|
|
10859
|
+
join87(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10470
10860
|
);
|
|
10471
10861
|
return new _KiloRule({
|
|
10472
10862
|
baseDir,
|
|
@@ -10518,12 +10908,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10518
10908
|
};
|
|
10519
10909
|
|
|
10520
10910
|
// src/features/rules/kiro-rule.ts
|
|
10521
|
-
import { join as
|
|
10911
|
+
import { join as join88 } from "path";
|
|
10522
10912
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
10523
10913
|
static getSettablePaths() {
|
|
10524
10914
|
return {
|
|
10525
10915
|
nonRoot: {
|
|
10526
|
-
relativeDirPath:
|
|
10916
|
+
relativeDirPath: join88(".kiro", "steering")
|
|
10527
10917
|
}
|
|
10528
10918
|
};
|
|
10529
10919
|
}
|
|
@@ -10533,7 +10923,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10533
10923
|
validate = true
|
|
10534
10924
|
}) {
|
|
10535
10925
|
const fileContent = await readFileContent(
|
|
10536
|
-
|
|
10926
|
+
join88(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10537
10927
|
);
|
|
10538
10928
|
return new _KiroRule({
|
|
10539
10929
|
baseDir,
|
|
@@ -10587,7 +10977,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10587
10977
|
};
|
|
10588
10978
|
|
|
10589
10979
|
// src/features/rules/opencode-rule.ts
|
|
10590
|
-
import { join as
|
|
10980
|
+
import { join as join89 } from "path";
|
|
10591
10981
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
10592
10982
|
static getSettablePaths() {
|
|
10593
10983
|
return {
|
|
@@ -10596,7 +10986,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10596
10986
|
relativeFilePath: "AGENTS.md"
|
|
10597
10987
|
},
|
|
10598
10988
|
nonRoot: {
|
|
10599
|
-
relativeDirPath:
|
|
10989
|
+
relativeDirPath: join89(".opencode", "memories")
|
|
10600
10990
|
}
|
|
10601
10991
|
};
|
|
10602
10992
|
}
|
|
@@ -10606,8 +10996,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10606
10996
|
validate = true
|
|
10607
10997
|
}) {
|
|
10608
10998
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
10609
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
10610
|
-
const fileContent = await readFileContent(
|
|
10999
|
+
const relativePath = isRoot ? "AGENTS.md" : join89(".opencode", "memories", relativeFilePath);
|
|
11000
|
+
const fileContent = await readFileContent(join89(baseDir, relativePath));
|
|
10611
11001
|
return new _OpenCodeRule({
|
|
10612
11002
|
baseDir,
|
|
10613
11003
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10662,7 +11052,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10662
11052
|
};
|
|
10663
11053
|
|
|
10664
11054
|
// src/features/rules/qwencode-rule.ts
|
|
10665
|
-
import { join as
|
|
11055
|
+
import { join as join90 } from "path";
|
|
10666
11056
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
10667
11057
|
static getSettablePaths() {
|
|
10668
11058
|
return {
|
|
@@ -10671,7 +11061,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10671
11061
|
relativeFilePath: "QWEN.md"
|
|
10672
11062
|
},
|
|
10673
11063
|
nonRoot: {
|
|
10674
|
-
relativeDirPath:
|
|
11064
|
+
relativeDirPath: join90(".qwen", "memories")
|
|
10675
11065
|
}
|
|
10676
11066
|
};
|
|
10677
11067
|
}
|
|
@@ -10681,8 +11071,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10681
11071
|
validate = true
|
|
10682
11072
|
}) {
|
|
10683
11073
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
10684
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
10685
|
-
const fileContent = await readFileContent(
|
|
11074
|
+
const relativePath = isRoot ? "QWEN.md" : join90(".qwen", "memories", relativeFilePath);
|
|
11075
|
+
const fileContent = await readFileContent(join90(baseDir, relativePath));
|
|
10686
11076
|
return new _QwencodeRule({
|
|
10687
11077
|
baseDir,
|
|
10688
11078
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10734,7 +11124,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10734
11124
|
};
|
|
10735
11125
|
|
|
10736
11126
|
// src/features/rules/replit-rule.ts
|
|
10737
|
-
import { join as
|
|
11127
|
+
import { join as join91 } from "path";
|
|
10738
11128
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
10739
11129
|
static getSettablePaths() {
|
|
10740
11130
|
return {
|
|
@@ -10756,7 +11146,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
10756
11146
|
}
|
|
10757
11147
|
const relativePath = paths.root.relativeFilePath;
|
|
10758
11148
|
const fileContent = await readFileContent(
|
|
10759
|
-
|
|
11149
|
+
join91(baseDir, paths.root.relativeDirPath, relativePath)
|
|
10760
11150
|
);
|
|
10761
11151
|
return new _ReplitRule({
|
|
10762
11152
|
baseDir,
|
|
@@ -10822,12 +11212,12 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
10822
11212
|
};
|
|
10823
11213
|
|
|
10824
11214
|
// src/features/rules/roo-rule.ts
|
|
10825
|
-
import { join as
|
|
11215
|
+
import { join as join92 } from "path";
|
|
10826
11216
|
var RooRule = class _RooRule extends ToolRule {
|
|
10827
11217
|
static getSettablePaths() {
|
|
10828
11218
|
return {
|
|
10829
11219
|
nonRoot: {
|
|
10830
|
-
relativeDirPath:
|
|
11220
|
+
relativeDirPath: join92(".roo", "rules")
|
|
10831
11221
|
}
|
|
10832
11222
|
};
|
|
10833
11223
|
}
|
|
@@ -10837,7 +11227,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10837
11227
|
validate = true
|
|
10838
11228
|
}) {
|
|
10839
11229
|
const fileContent = await readFileContent(
|
|
10840
|
-
|
|
11230
|
+
join92(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10841
11231
|
);
|
|
10842
11232
|
return new _RooRule({
|
|
10843
11233
|
baseDir,
|
|
@@ -10906,7 +11296,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10906
11296
|
};
|
|
10907
11297
|
|
|
10908
11298
|
// src/features/rules/warp-rule.ts
|
|
10909
|
-
import { join as
|
|
11299
|
+
import { join as join93 } from "path";
|
|
10910
11300
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
10911
11301
|
constructor({ fileContent, root, ...rest }) {
|
|
10912
11302
|
super({
|
|
@@ -10922,7 +11312,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10922
11312
|
relativeFilePath: "WARP.md"
|
|
10923
11313
|
},
|
|
10924
11314
|
nonRoot: {
|
|
10925
|
-
relativeDirPath:
|
|
11315
|
+
relativeDirPath: join93(".warp", "memories")
|
|
10926
11316
|
}
|
|
10927
11317
|
};
|
|
10928
11318
|
}
|
|
@@ -10932,8 +11322,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10932
11322
|
validate = true
|
|
10933
11323
|
}) {
|
|
10934
11324
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
10935
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
10936
|
-
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));
|
|
10937
11327
|
return new _WarpRule({
|
|
10938
11328
|
baseDir,
|
|
10939
11329
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -10988,12 +11378,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10988
11378
|
};
|
|
10989
11379
|
|
|
10990
11380
|
// src/features/rules/windsurf-rule.ts
|
|
10991
|
-
import { join as
|
|
11381
|
+
import { join as join94 } from "path";
|
|
10992
11382
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
10993
11383
|
static getSettablePaths() {
|
|
10994
11384
|
return {
|
|
10995
11385
|
nonRoot: {
|
|
10996
|
-
relativeDirPath:
|
|
11386
|
+
relativeDirPath: join94(".windsurf", "rules")
|
|
10997
11387
|
}
|
|
10998
11388
|
};
|
|
10999
11389
|
}
|
|
@@ -11003,7 +11393,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
11003
11393
|
validate = true
|
|
11004
11394
|
}) {
|
|
11005
11395
|
const fileContent = await readFileContent(
|
|
11006
|
-
|
|
11396
|
+
join94(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11007
11397
|
);
|
|
11008
11398
|
return new _WindsurfRule({
|
|
11009
11399
|
baseDir,
|
|
@@ -11077,7 +11467,7 @@ var rulesProcessorToolTargets = [
|
|
|
11077
11467
|
"warp",
|
|
11078
11468
|
"windsurf"
|
|
11079
11469
|
];
|
|
11080
|
-
var RulesProcessorToolTargetSchema =
|
|
11470
|
+
var RulesProcessorToolTargetSchema = z44.enum(rulesProcessorToolTargets);
|
|
11081
11471
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
11082
11472
|
[
|
|
11083
11473
|
"agentsmd",
|
|
@@ -11368,7 +11758,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11368
11758
|
}).relativeDirPath;
|
|
11369
11759
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
11370
11760
|
const frontmatter = skill.getFrontmatter();
|
|
11371
|
-
const relativePath =
|
|
11761
|
+
const relativePath = join95(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
11372
11762
|
return {
|
|
11373
11763
|
name: frontmatter.name,
|
|
11374
11764
|
description: frontmatter.description,
|
|
@@ -11435,7 +11825,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11435
11825
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
11436
11826
|
*/
|
|
11437
11827
|
async loadRulesyncFiles() {
|
|
11438
|
-
const files = await findFilesByGlobs(
|
|
11828
|
+
const files = await findFilesByGlobs(join95(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
11439
11829
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
11440
11830
|
const rulesyncRules = await Promise.all(
|
|
11441
11831
|
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename24(file) }))
|
|
@@ -11456,7 +11846,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11456
11846
|
return rulesyncRules;
|
|
11457
11847
|
}
|
|
11458
11848
|
async loadRulesyncFilesLegacy() {
|
|
11459
|
-
const legacyFiles = await findFilesByGlobs(
|
|
11849
|
+
const legacyFiles = await findFilesByGlobs(join95(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
11460
11850
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
11461
11851
|
return Promise.all(
|
|
11462
11852
|
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename24(file) }))
|
|
@@ -11477,7 +11867,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11477
11867
|
return [];
|
|
11478
11868
|
}
|
|
11479
11869
|
const rootFilePaths = await findFilesByGlobs(
|
|
11480
|
-
|
|
11870
|
+
join95(
|
|
11481
11871
|
this.baseDir,
|
|
11482
11872
|
settablePaths.root.relativeDirPath ?? ".",
|
|
11483
11873
|
settablePaths.root.relativeFilePath
|
|
@@ -11509,7 +11899,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11509
11899
|
return [];
|
|
11510
11900
|
}
|
|
11511
11901
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
11512
|
-
|
|
11902
|
+
join95(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
11513
11903
|
);
|
|
11514
11904
|
if (forDeletion) {
|
|
11515
11905
|
return nonRootFilePaths.map(
|
|
@@ -11618,14 +12008,14 @@ s/<command> [arguments]
|
|
|
11618
12008
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
11619
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.
|
|
11620
12010
|
|
|
11621
|
-
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.` : "";
|
|
11622
12012
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
11623
12013
|
|
|
11624
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.
|
|
11625
12015
|
|
|
11626
|
-
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.
|
|
11627
12017
|
|
|
11628
|
-
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.` : "";
|
|
11629
12019
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
11630
12020
|
const result = [
|
|
11631
12021
|
overview,
|
|
@@ -11655,7 +12045,10 @@ ${toonContent}`;
|
|
|
11655
12045
|
// src/cli/commands/generate.ts
|
|
11656
12046
|
async function generateCommand(options) {
|
|
11657
12047
|
const config = await ConfigResolver.resolve(options);
|
|
11658
|
-
logger.
|
|
12048
|
+
logger.configure({
|
|
12049
|
+
verbose: config.getVerbose(),
|
|
12050
|
+
silent: config.getSilent()
|
|
12051
|
+
});
|
|
11659
12052
|
logger.info("Generating files...");
|
|
11660
12053
|
if (!await fileExists(RULESYNC_RELATIVE_DIR_PATH)) {
|
|
11661
12054
|
logger.error("\u274C .rulesync directory not found. Run 'rulesync init' first.");
|
|
@@ -11907,7 +12300,7 @@ async function generateSkills(config) {
|
|
|
11907
12300
|
}
|
|
11908
12301
|
|
|
11909
12302
|
// src/cli/commands/gitignore.ts
|
|
11910
|
-
import { join as
|
|
12303
|
+
import { join as join96 } from "path";
|
|
11911
12304
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
11912
12305
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
11913
12306
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -11971,6 +12364,8 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11971
12364
|
// Kiro
|
|
11972
12365
|
"**/.kiro/steering/",
|
|
11973
12366
|
"**/.kiro/prompts/",
|
|
12367
|
+
"**/.kiro/skills/",
|
|
12368
|
+
"**/.kiro/agents/",
|
|
11974
12369
|
"**/.kiro/settings/mcp.json",
|
|
11975
12370
|
"**/.aiignore",
|
|
11976
12371
|
// OpenCode
|
|
@@ -12046,7 +12441,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
12046
12441
|
return result;
|
|
12047
12442
|
};
|
|
12048
12443
|
var gitignoreCommand = async () => {
|
|
12049
|
-
const gitignorePath =
|
|
12444
|
+
const gitignorePath = join96(process.cwd(), ".gitignore");
|
|
12050
12445
|
let gitignoreContent = "";
|
|
12051
12446
|
if (await fileExists(gitignorePath)) {
|
|
12052
12447
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -12080,7 +12475,10 @@ async function importCommand(options) {
|
|
|
12080
12475
|
process.exit(1);
|
|
12081
12476
|
}
|
|
12082
12477
|
const config = await ConfigResolver.resolve(options);
|
|
12083
|
-
logger.
|
|
12478
|
+
logger.configure({
|
|
12479
|
+
verbose: config.getVerbose(),
|
|
12480
|
+
silent: config.getSilent()
|
|
12481
|
+
});
|
|
12084
12482
|
const tool = config.getTargets()[0];
|
|
12085
12483
|
await importRules(config, tool);
|
|
12086
12484
|
await importIgnore(config, tool);
|
|
@@ -12245,7 +12643,7 @@ async function importSkills(config, tool) {
|
|
|
12245
12643
|
}
|
|
12246
12644
|
|
|
12247
12645
|
// src/cli/commands/init.ts
|
|
12248
|
-
import { join as
|
|
12646
|
+
import { join as join97 } from "path";
|
|
12249
12647
|
async function initCommand() {
|
|
12250
12648
|
logger.info("Initializing rulesync...");
|
|
12251
12649
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -12423,14 +12821,14 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12423
12821
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
12424
12822
|
await ensureDir(skillPaths.relativeDirPath);
|
|
12425
12823
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
12426
|
-
const ruleFilepath =
|
|
12824
|
+
const ruleFilepath = join97(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
12427
12825
|
if (!await fileExists(ruleFilepath)) {
|
|
12428
12826
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
12429
12827
|
logger.success(`Created ${ruleFilepath}`);
|
|
12430
12828
|
} else {
|
|
12431
12829
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
12432
12830
|
}
|
|
12433
|
-
const mcpFilepath =
|
|
12831
|
+
const mcpFilepath = join97(
|
|
12434
12832
|
mcpPaths.recommended.relativeDirPath,
|
|
12435
12833
|
mcpPaths.recommended.relativeFilePath
|
|
12436
12834
|
);
|
|
@@ -12440,30 +12838,30 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12440
12838
|
} else {
|
|
12441
12839
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
12442
12840
|
}
|
|
12443
|
-
const commandFilepath =
|
|
12841
|
+
const commandFilepath = join97(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
12444
12842
|
if (!await fileExists(commandFilepath)) {
|
|
12445
12843
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
12446
12844
|
logger.success(`Created ${commandFilepath}`);
|
|
12447
12845
|
} else {
|
|
12448
12846
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
12449
12847
|
}
|
|
12450
|
-
const subagentFilepath =
|
|
12848
|
+
const subagentFilepath = join97(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
12451
12849
|
if (!await fileExists(subagentFilepath)) {
|
|
12452
12850
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
12453
12851
|
logger.success(`Created ${subagentFilepath}`);
|
|
12454
12852
|
} else {
|
|
12455
12853
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
12456
12854
|
}
|
|
12457
|
-
const skillDirPath =
|
|
12855
|
+
const skillDirPath = join97(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
12458
12856
|
await ensureDir(skillDirPath);
|
|
12459
|
-
const skillFilepath =
|
|
12857
|
+
const skillFilepath = join97(skillDirPath, SKILL_FILE_NAME);
|
|
12460
12858
|
if (!await fileExists(skillFilepath)) {
|
|
12461
12859
|
await writeFileContent(skillFilepath, sampleSkillFile.content);
|
|
12462
12860
|
logger.success(`Created ${skillFilepath}`);
|
|
12463
12861
|
} else {
|
|
12464
12862
|
logger.info(`Skipped ${skillFilepath} (already exists)`);
|
|
12465
12863
|
}
|
|
12466
|
-
const ignoreFilepath =
|
|
12864
|
+
const ignoreFilepath = join97(
|
|
12467
12865
|
ignorePaths.recommended.relativeDirPath,
|
|
12468
12866
|
ignorePaths.recommended.relativeFilePath
|
|
12469
12867
|
);
|
|
@@ -12479,15 +12877,15 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12479
12877
|
import { FastMCP } from "fastmcp";
|
|
12480
12878
|
|
|
12481
12879
|
// src/mcp/tools.ts
|
|
12482
|
-
import { z as
|
|
12880
|
+
import { z as z51 } from "zod/mini";
|
|
12483
12881
|
|
|
12484
12882
|
// src/mcp/commands.ts
|
|
12485
|
-
import { basename as basename25, join as
|
|
12486
|
-
import { z as
|
|
12883
|
+
import { basename as basename25, join as join98 } from "path";
|
|
12884
|
+
import { z as z45 } from "zod/mini";
|
|
12487
12885
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
12488
12886
|
var maxCommandsCount = 1e3;
|
|
12489
12887
|
async function listCommands() {
|
|
12490
|
-
const commandsDir =
|
|
12888
|
+
const commandsDir = join98(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12491
12889
|
try {
|
|
12492
12890
|
const files = await listDirectoryFiles(commandsDir);
|
|
12493
12891
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12499,7 +12897,7 @@ async function listCommands() {
|
|
|
12499
12897
|
});
|
|
12500
12898
|
const frontmatter = command.getFrontmatter();
|
|
12501
12899
|
return {
|
|
12502
|
-
relativePathFromCwd:
|
|
12900
|
+
relativePathFromCwd: join98(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
12503
12901
|
frontmatter
|
|
12504
12902
|
};
|
|
12505
12903
|
} catch (error) {
|
|
@@ -12525,7 +12923,7 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
12525
12923
|
relativeFilePath: filename
|
|
12526
12924
|
});
|
|
12527
12925
|
return {
|
|
12528
|
-
relativePathFromCwd:
|
|
12926
|
+
relativePathFromCwd: join98(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12529
12927
|
frontmatter: command.getFrontmatter(),
|
|
12530
12928
|
body: command.getBody()
|
|
12531
12929
|
};
|
|
@@ -12554,7 +12952,7 @@ async function putCommand({
|
|
|
12554
12952
|
try {
|
|
12555
12953
|
const existingCommands = await listCommands();
|
|
12556
12954
|
const isUpdate = existingCommands.some(
|
|
12557
|
-
(command2) => command2.relativePathFromCwd ===
|
|
12955
|
+
(command2) => command2.relativePathFromCwd === join98(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12558
12956
|
);
|
|
12559
12957
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
12560
12958
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -12569,11 +12967,11 @@ async function putCommand({
|
|
|
12569
12967
|
fileContent,
|
|
12570
12968
|
validate: true
|
|
12571
12969
|
});
|
|
12572
|
-
const commandsDir =
|
|
12970
|
+
const commandsDir = join98(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12573
12971
|
await ensureDir(commandsDir);
|
|
12574
12972
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
12575
12973
|
return {
|
|
12576
|
-
relativePathFromCwd:
|
|
12974
|
+
relativePathFromCwd: join98(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12577
12975
|
frontmatter: command.getFrontmatter(),
|
|
12578
12976
|
body: command.getBody()
|
|
12579
12977
|
};
|
|
@@ -12589,11 +12987,11 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12589
12987
|
intendedRootDir: process.cwd()
|
|
12590
12988
|
});
|
|
12591
12989
|
const filename = basename25(relativePathFromCwd);
|
|
12592
|
-
const fullPath =
|
|
12990
|
+
const fullPath = join98(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
12593
12991
|
try {
|
|
12594
12992
|
await removeFile(fullPath);
|
|
12595
12993
|
return {
|
|
12596
|
-
relativePathFromCwd:
|
|
12994
|
+
relativePathFromCwd: join98(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12597
12995
|
};
|
|
12598
12996
|
} catch (error) {
|
|
12599
12997
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12602,23 +13000,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12602
13000
|
}
|
|
12603
13001
|
}
|
|
12604
13002
|
var commandToolSchemas = {
|
|
12605
|
-
listCommands:
|
|
12606
|
-
getCommand:
|
|
12607
|
-
relativePathFromCwd:
|
|
13003
|
+
listCommands: z45.object({}),
|
|
13004
|
+
getCommand: z45.object({
|
|
13005
|
+
relativePathFromCwd: z45.string()
|
|
12608
13006
|
}),
|
|
12609
|
-
putCommand:
|
|
12610
|
-
relativePathFromCwd:
|
|
13007
|
+
putCommand: z45.object({
|
|
13008
|
+
relativePathFromCwd: z45.string(),
|
|
12611
13009
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
12612
|
-
body:
|
|
13010
|
+
body: z45.string()
|
|
12613
13011
|
}),
|
|
12614
|
-
deleteCommand:
|
|
12615
|
-
relativePathFromCwd:
|
|
13012
|
+
deleteCommand: z45.object({
|
|
13013
|
+
relativePathFromCwd: z45.string()
|
|
12616
13014
|
})
|
|
12617
13015
|
};
|
|
12618
13016
|
var commandTools = {
|
|
12619
13017
|
listCommands: {
|
|
12620
13018
|
name: "listCommands",
|
|
12621
|
-
description: `List all commands from ${
|
|
13019
|
+
description: `List all commands from ${join98(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12622
13020
|
parameters: commandToolSchemas.listCommands,
|
|
12623
13021
|
execute: async () => {
|
|
12624
13022
|
const commands = await listCommands();
|
|
@@ -12660,11 +13058,11 @@ var commandTools = {
|
|
|
12660
13058
|
};
|
|
12661
13059
|
|
|
12662
13060
|
// src/mcp/ignore.ts
|
|
12663
|
-
import { join as
|
|
12664
|
-
import { z as
|
|
13061
|
+
import { join as join99 } from "path";
|
|
13062
|
+
import { z as z46 } from "zod/mini";
|
|
12665
13063
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
12666
13064
|
async function getIgnoreFile() {
|
|
12667
|
-
const ignoreFilePath =
|
|
13065
|
+
const ignoreFilePath = join99(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12668
13066
|
try {
|
|
12669
13067
|
const content = await readFileContent(ignoreFilePath);
|
|
12670
13068
|
return {
|
|
@@ -12678,7 +13076,7 @@ async function getIgnoreFile() {
|
|
|
12678
13076
|
}
|
|
12679
13077
|
}
|
|
12680
13078
|
async function putIgnoreFile({ content }) {
|
|
12681
|
-
const ignoreFilePath =
|
|
13079
|
+
const ignoreFilePath = join99(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12682
13080
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
12683
13081
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
12684
13082
|
throw new Error(
|
|
@@ -12699,8 +13097,8 @@ async function putIgnoreFile({ content }) {
|
|
|
12699
13097
|
}
|
|
12700
13098
|
}
|
|
12701
13099
|
async function deleteIgnoreFile() {
|
|
12702
|
-
const aiignorePath =
|
|
12703
|
-
const legacyIgnorePath =
|
|
13100
|
+
const aiignorePath = join99(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
13101
|
+
const legacyIgnorePath = join99(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
12704
13102
|
try {
|
|
12705
13103
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
12706
13104
|
return {
|
|
@@ -12718,11 +13116,11 @@ async function deleteIgnoreFile() {
|
|
|
12718
13116
|
}
|
|
12719
13117
|
}
|
|
12720
13118
|
var ignoreToolSchemas = {
|
|
12721
|
-
getIgnoreFile:
|
|
12722
|
-
putIgnoreFile:
|
|
12723
|
-
content:
|
|
13119
|
+
getIgnoreFile: z46.object({}),
|
|
13120
|
+
putIgnoreFile: z46.object({
|
|
13121
|
+
content: z46.string()
|
|
12724
13122
|
}),
|
|
12725
|
-
deleteIgnoreFile:
|
|
13123
|
+
deleteIgnoreFile: z46.object({})
|
|
12726
13124
|
};
|
|
12727
13125
|
var ignoreTools = {
|
|
12728
13126
|
getIgnoreFile: {
|
|
@@ -12755,8 +13153,8 @@ var ignoreTools = {
|
|
|
12755
13153
|
};
|
|
12756
13154
|
|
|
12757
13155
|
// src/mcp/mcp.ts
|
|
12758
|
-
import { join as
|
|
12759
|
-
import { z as
|
|
13156
|
+
import { join as join100 } from "path";
|
|
13157
|
+
import { z as z47 } from "zod/mini";
|
|
12760
13158
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
12761
13159
|
async function getMcpFile() {
|
|
12762
13160
|
const config = await ConfigResolver.resolve({});
|
|
@@ -12765,7 +13163,7 @@ async function getMcpFile() {
|
|
|
12765
13163
|
validate: true,
|
|
12766
13164
|
modularMcp: config.getModularMcp()
|
|
12767
13165
|
});
|
|
12768
|
-
const relativePathFromCwd =
|
|
13166
|
+
const relativePathFromCwd = join100(
|
|
12769
13167
|
rulesyncMcp.getRelativeDirPath(),
|
|
12770
13168
|
rulesyncMcp.getRelativeFilePath()
|
|
12771
13169
|
);
|
|
@@ -12798,7 +13196,7 @@ async function putMcpFile({ content }) {
|
|
|
12798
13196
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12799
13197
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
12800
13198
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
12801
|
-
const fullPath =
|
|
13199
|
+
const fullPath = join100(baseDir, relativeDirPath, relativeFilePath);
|
|
12802
13200
|
const rulesyncMcp = new RulesyncMcp({
|
|
12803
13201
|
baseDir,
|
|
12804
13202
|
relativeDirPath,
|
|
@@ -12807,9 +13205,9 @@ async function putMcpFile({ content }) {
|
|
|
12807
13205
|
validate: true,
|
|
12808
13206
|
modularMcp: config.getModularMcp()
|
|
12809
13207
|
});
|
|
12810
|
-
await ensureDir(
|
|
13208
|
+
await ensureDir(join100(baseDir, relativeDirPath));
|
|
12811
13209
|
await writeFileContent(fullPath, content);
|
|
12812
|
-
const relativePathFromCwd =
|
|
13210
|
+
const relativePathFromCwd = join100(relativeDirPath, relativeFilePath);
|
|
12813
13211
|
return {
|
|
12814
13212
|
relativePathFromCwd,
|
|
12815
13213
|
content: rulesyncMcp.getFileContent()
|
|
@@ -12824,15 +13222,15 @@ async function deleteMcpFile() {
|
|
|
12824
13222
|
try {
|
|
12825
13223
|
const baseDir = process.cwd();
|
|
12826
13224
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12827
|
-
const recommendedPath =
|
|
13225
|
+
const recommendedPath = join100(
|
|
12828
13226
|
baseDir,
|
|
12829
13227
|
paths.recommended.relativeDirPath,
|
|
12830
13228
|
paths.recommended.relativeFilePath
|
|
12831
13229
|
);
|
|
12832
|
-
const legacyPath =
|
|
13230
|
+
const legacyPath = join100(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
12833
13231
|
await removeFile(recommendedPath);
|
|
12834
13232
|
await removeFile(legacyPath);
|
|
12835
|
-
const relativePathFromCwd =
|
|
13233
|
+
const relativePathFromCwd = join100(
|
|
12836
13234
|
paths.recommended.relativeDirPath,
|
|
12837
13235
|
paths.recommended.relativeFilePath
|
|
12838
13236
|
);
|
|
@@ -12846,11 +13244,11 @@ async function deleteMcpFile() {
|
|
|
12846
13244
|
}
|
|
12847
13245
|
}
|
|
12848
13246
|
var mcpToolSchemas = {
|
|
12849
|
-
getMcpFile:
|
|
12850
|
-
putMcpFile:
|
|
12851
|
-
content:
|
|
13247
|
+
getMcpFile: z47.object({}),
|
|
13248
|
+
putMcpFile: z47.object({
|
|
13249
|
+
content: z47.string()
|
|
12852
13250
|
}),
|
|
12853
|
-
deleteMcpFile:
|
|
13251
|
+
deleteMcpFile: z47.object({})
|
|
12854
13252
|
};
|
|
12855
13253
|
var mcpTools = {
|
|
12856
13254
|
getMcpFile: {
|
|
@@ -12883,12 +13281,12 @@ var mcpTools = {
|
|
|
12883
13281
|
};
|
|
12884
13282
|
|
|
12885
13283
|
// src/mcp/rules.ts
|
|
12886
|
-
import { basename as basename26, join as
|
|
12887
|
-
import { z as
|
|
13284
|
+
import { basename as basename26, join as join101 } from "path";
|
|
13285
|
+
import { z as z48 } from "zod/mini";
|
|
12888
13286
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
12889
13287
|
var maxRulesCount = 1e3;
|
|
12890
13288
|
async function listRules() {
|
|
12891
|
-
const rulesDir =
|
|
13289
|
+
const rulesDir = join101(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12892
13290
|
try {
|
|
12893
13291
|
const files = await listDirectoryFiles(rulesDir);
|
|
12894
13292
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12901,7 +13299,7 @@ async function listRules() {
|
|
|
12901
13299
|
});
|
|
12902
13300
|
const frontmatter = rule.getFrontmatter();
|
|
12903
13301
|
return {
|
|
12904
|
-
relativePathFromCwd:
|
|
13302
|
+
relativePathFromCwd: join101(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
12905
13303
|
frontmatter
|
|
12906
13304
|
};
|
|
12907
13305
|
} catch (error) {
|
|
@@ -12928,7 +13326,7 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
12928
13326
|
validate: true
|
|
12929
13327
|
});
|
|
12930
13328
|
return {
|
|
12931
|
-
relativePathFromCwd:
|
|
13329
|
+
relativePathFromCwd: join101(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12932
13330
|
frontmatter: rule.getFrontmatter(),
|
|
12933
13331
|
body: rule.getBody()
|
|
12934
13332
|
};
|
|
@@ -12957,7 +13355,7 @@ async function putRule({
|
|
|
12957
13355
|
try {
|
|
12958
13356
|
const existingRules = await listRules();
|
|
12959
13357
|
const isUpdate = existingRules.some(
|
|
12960
|
-
(rule2) => rule2.relativePathFromCwd ===
|
|
13358
|
+
(rule2) => rule2.relativePathFromCwd === join101(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12961
13359
|
);
|
|
12962
13360
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
12963
13361
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -12970,11 +13368,11 @@ async function putRule({
|
|
|
12970
13368
|
body,
|
|
12971
13369
|
validate: true
|
|
12972
13370
|
});
|
|
12973
|
-
const rulesDir =
|
|
13371
|
+
const rulesDir = join101(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12974
13372
|
await ensureDir(rulesDir);
|
|
12975
13373
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
12976
13374
|
return {
|
|
12977
|
-
relativePathFromCwd:
|
|
13375
|
+
relativePathFromCwd: join101(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12978
13376
|
frontmatter: rule.getFrontmatter(),
|
|
12979
13377
|
body: rule.getBody()
|
|
12980
13378
|
};
|
|
@@ -12990,11 +13388,11 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
12990
13388
|
intendedRootDir: process.cwd()
|
|
12991
13389
|
});
|
|
12992
13390
|
const filename = basename26(relativePathFromCwd);
|
|
12993
|
-
const fullPath =
|
|
13391
|
+
const fullPath = join101(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
12994
13392
|
try {
|
|
12995
13393
|
await removeFile(fullPath);
|
|
12996
13394
|
return {
|
|
12997
|
-
relativePathFromCwd:
|
|
13395
|
+
relativePathFromCwd: join101(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12998
13396
|
};
|
|
12999
13397
|
} catch (error) {
|
|
13000
13398
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -13003,23 +13401,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
13003
13401
|
}
|
|
13004
13402
|
}
|
|
13005
13403
|
var ruleToolSchemas = {
|
|
13006
|
-
listRules:
|
|
13007
|
-
getRule:
|
|
13008
|
-
relativePathFromCwd:
|
|
13404
|
+
listRules: z48.object({}),
|
|
13405
|
+
getRule: z48.object({
|
|
13406
|
+
relativePathFromCwd: z48.string()
|
|
13009
13407
|
}),
|
|
13010
|
-
putRule:
|
|
13011
|
-
relativePathFromCwd:
|
|
13408
|
+
putRule: z48.object({
|
|
13409
|
+
relativePathFromCwd: z48.string(),
|
|
13012
13410
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
13013
|
-
body:
|
|
13411
|
+
body: z48.string()
|
|
13014
13412
|
}),
|
|
13015
|
-
deleteRule:
|
|
13016
|
-
relativePathFromCwd:
|
|
13413
|
+
deleteRule: z48.object({
|
|
13414
|
+
relativePathFromCwd: z48.string()
|
|
13017
13415
|
})
|
|
13018
13416
|
};
|
|
13019
13417
|
var ruleTools = {
|
|
13020
13418
|
listRules: {
|
|
13021
13419
|
name: "listRules",
|
|
13022
|
-
description: `List all rules from ${
|
|
13420
|
+
description: `List all rules from ${join101(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13023
13421
|
parameters: ruleToolSchemas.listRules,
|
|
13024
13422
|
execute: async () => {
|
|
13025
13423
|
const rules = await listRules();
|
|
@@ -13061,8 +13459,8 @@ var ruleTools = {
|
|
|
13061
13459
|
};
|
|
13062
13460
|
|
|
13063
13461
|
// src/mcp/skills.ts
|
|
13064
|
-
import { basename as basename27, dirname as dirname2, join as
|
|
13065
|
-
import { z as
|
|
13462
|
+
import { basename as basename27, dirname as dirname2, join as join102 } from "path";
|
|
13463
|
+
import { z as z49 } from "zod/mini";
|
|
13066
13464
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
13067
13465
|
var maxSkillsCount = 1e3;
|
|
13068
13466
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -13085,9 +13483,9 @@ function extractDirName(relativeDirPathFromCwd) {
|
|
|
13085
13483
|
return dirName;
|
|
13086
13484
|
}
|
|
13087
13485
|
async function listSkills() {
|
|
13088
|
-
const skillsDir =
|
|
13486
|
+
const skillsDir = join102(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
13089
13487
|
try {
|
|
13090
|
-
const skillDirPaths = await findFilesByGlobs(
|
|
13488
|
+
const skillDirPaths = await findFilesByGlobs(join102(skillsDir, "*"), { type: "dir" });
|
|
13091
13489
|
const skills = await Promise.all(
|
|
13092
13490
|
skillDirPaths.map(async (dirPath) => {
|
|
13093
13491
|
const dirName = basename27(dirPath);
|
|
@@ -13098,7 +13496,7 @@ async function listSkills() {
|
|
|
13098
13496
|
});
|
|
13099
13497
|
const frontmatter = skill.getFrontmatter();
|
|
13100
13498
|
return {
|
|
13101
|
-
relativeDirPathFromCwd:
|
|
13499
|
+
relativeDirPathFromCwd: join102(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13102
13500
|
frontmatter
|
|
13103
13501
|
};
|
|
13104
13502
|
} catch (error) {
|
|
@@ -13124,7 +13522,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
13124
13522
|
dirName
|
|
13125
13523
|
});
|
|
13126
13524
|
return {
|
|
13127
|
-
relativeDirPathFromCwd:
|
|
13525
|
+
relativeDirPathFromCwd: join102(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13128
13526
|
frontmatter: skill.getFrontmatter(),
|
|
13129
13527
|
body: skill.getBody(),
|
|
13130
13528
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13158,7 +13556,7 @@ async function putSkill({
|
|
|
13158
13556
|
try {
|
|
13159
13557
|
const existingSkills = await listSkills();
|
|
13160
13558
|
const isUpdate = existingSkills.some(
|
|
13161
|
-
(skill2) => skill2.relativeDirPathFromCwd ===
|
|
13559
|
+
(skill2) => skill2.relativeDirPathFromCwd === join102(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13162
13560
|
);
|
|
13163
13561
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
13164
13562
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -13173,9 +13571,9 @@ async function putSkill({
|
|
|
13173
13571
|
otherFiles: aiDirFiles,
|
|
13174
13572
|
validate: true
|
|
13175
13573
|
});
|
|
13176
|
-
const skillDirPath =
|
|
13574
|
+
const skillDirPath = join102(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13177
13575
|
await ensureDir(skillDirPath);
|
|
13178
|
-
const skillFilePath =
|
|
13576
|
+
const skillFilePath = join102(skillDirPath, SKILL_FILE_NAME);
|
|
13179
13577
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
13180
13578
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
13181
13579
|
for (const file of otherFiles) {
|
|
@@ -13183,15 +13581,15 @@ async function putSkill({
|
|
|
13183
13581
|
relativePath: file.name,
|
|
13184
13582
|
intendedRootDir: skillDirPath
|
|
13185
13583
|
});
|
|
13186
|
-
const filePath =
|
|
13187
|
-
const fileDir =
|
|
13584
|
+
const filePath = join102(skillDirPath, file.name);
|
|
13585
|
+
const fileDir = join102(skillDirPath, dirname2(file.name));
|
|
13188
13586
|
if (fileDir !== skillDirPath) {
|
|
13189
13587
|
await ensureDir(fileDir);
|
|
13190
13588
|
}
|
|
13191
13589
|
await writeFileContent(filePath, file.body);
|
|
13192
13590
|
}
|
|
13193
13591
|
return {
|
|
13194
|
-
relativeDirPathFromCwd:
|
|
13592
|
+
relativeDirPathFromCwd: join102(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13195
13593
|
frontmatter: skill.getFrontmatter(),
|
|
13196
13594
|
body: skill.getBody(),
|
|
13197
13595
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13213,13 +13611,13 @@ async function deleteSkill({
|
|
|
13213
13611
|
intendedRootDir: process.cwd()
|
|
13214
13612
|
});
|
|
13215
13613
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
13216
|
-
const skillDirPath =
|
|
13614
|
+
const skillDirPath = join102(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13217
13615
|
try {
|
|
13218
13616
|
if (await directoryExists(skillDirPath)) {
|
|
13219
13617
|
await removeDirectory(skillDirPath);
|
|
13220
13618
|
}
|
|
13221
13619
|
return {
|
|
13222
|
-
relativeDirPathFromCwd:
|
|
13620
|
+
relativeDirPathFromCwd: join102(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13223
13621
|
};
|
|
13224
13622
|
} catch (error) {
|
|
13225
13623
|
throw new Error(
|
|
@@ -13230,29 +13628,29 @@ async function deleteSkill({
|
|
|
13230
13628
|
);
|
|
13231
13629
|
}
|
|
13232
13630
|
}
|
|
13233
|
-
var McpSkillFileSchema =
|
|
13234
|
-
name:
|
|
13235
|
-
body:
|
|
13631
|
+
var McpSkillFileSchema = z49.object({
|
|
13632
|
+
name: z49.string(),
|
|
13633
|
+
body: z49.string()
|
|
13236
13634
|
});
|
|
13237
13635
|
var skillToolSchemas = {
|
|
13238
|
-
listSkills:
|
|
13239
|
-
getSkill:
|
|
13240
|
-
relativeDirPathFromCwd:
|
|
13636
|
+
listSkills: z49.object({}),
|
|
13637
|
+
getSkill: z49.object({
|
|
13638
|
+
relativeDirPathFromCwd: z49.string()
|
|
13241
13639
|
}),
|
|
13242
|
-
putSkill:
|
|
13243
|
-
relativeDirPathFromCwd:
|
|
13640
|
+
putSkill: z49.object({
|
|
13641
|
+
relativeDirPathFromCwd: z49.string(),
|
|
13244
13642
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
13245
|
-
body:
|
|
13246
|
-
otherFiles:
|
|
13643
|
+
body: z49.string(),
|
|
13644
|
+
otherFiles: z49.optional(z49.array(McpSkillFileSchema))
|
|
13247
13645
|
}),
|
|
13248
|
-
deleteSkill:
|
|
13249
|
-
relativeDirPathFromCwd:
|
|
13646
|
+
deleteSkill: z49.object({
|
|
13647
|
+
relativeDirPathFromCwd: z49.string()
|
|
13250
13648
|
})
|
|
13251
13649
|
};
|
|
13252
13650
|
var skillTools = {
|
|
13253
13651
|
listSkills: {
|
|
13254
13652
|
name: "listSkills",
|
|
13255
|
-
description: `List all skills from ${
|
|
13653
|
+
description: `List all skills from ${join102(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
13256
13654
|
parameters: skillToolSchemas.listSkills,
|
|
13257
13655
|
execute: async () => {
|
|
13258
13656
|
const skills = await listSkills();
|
|
@@ -13295,12 +13693,12 @@ var skillTools = {
|
|
|
13295
13693
|
};
|
|
13296
13694
|
|
|
13297
13695
|
// src/mcp/subagents.ts
|
|
13298
|
-
import { basename as basename28, join as
|
|
13299
|
-
import { z as
|
|
13696
|
+
import { basename as basename28, join as join103 } from "path";
|
|
13697
|
+
import { z as z50 } from "zod/mini";
|
|
13300
13698
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
13301
13699
|
var maxSubagentsCount = 1e3;
|
|
13302
13700
|
async function listSubagents() {
|
|
13303
|
-
const subagentsDir =
|
|
13701
|
+
const subagentsDir = join103(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13304
13702
|
try {
|
|
13305
13703
|
const files = await listDirectoryFiles(subagentsDir);
|
|
13306
13704
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13313,7 +13711,7 @@ async function listSubagents() {
|
|
|
13313
13711
|
});
|
|
13314
13712
|
const frontmatter = subagent.getFrontmatter();
|
|
13315
13713
|
return {
|
|
13316
|
-
relativePathFromCwd:
|
|
13714
|
+
relativePathFromCwd: join103(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
13317
13715
|
frontmatter
|
|
13318
13716
|
};
|
|
13319
13717
|
} catch (error) {
|
|
@@ -13342,7 +13740,7 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
13342
13740
|
validate: true
|
|
13343
13741
|
});
|
|
13344
13742
|
return {
|
|
13345
|
-
relativePathFromCwd:
|
|
13743
|
+
relativePathFromCwd: join103(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13346
13744
|
frontmatter: subagent.getFrontmatter(),
|
|
13347
13745
|
body: subagent.getBody()
|
|
13348
13746
|
};
|
|
@@ -13371,7 +13769,7 @@ async function putSubagent({
|
|
|
13371
13769
|
try {
|
|
13372
13770
|
const existingSubagents = await listSubagents();
|
|
13373
13771
|
const isUpdate = existingSubagents.some(
|
|
13374
|
-
(subagent2) => subagent2.relativePathFromCwd ===
|
|
13772
|
+
(subagent2) => subagent2.relativePathFromCwd === join103(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13375
13773
|
);
|
|
13376
13774
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
13377
13775
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -13384,11 +13782,11 @@ async function putSubagent({
|
|
|
13384
13782
|
body,
|
|
13385
13783
|
validate: true
|
|
13386
13784
|
});
|
|
13387
|
-
const subagentsDir =
|
|
13785
|
+
const subagentsDir = join103(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13388
13786
|
await ensureDir(subagentsDir);
|
|
13389
13787
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
13390
13788
|
return {
|
|
13391
|
-
relativePathFromCwd:
|
|
13789
|
+
relativePathFromCwd: join103(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13392
13790
|
frontmatter: subagent.getFrontmatter(),
|
|
13393
13791
|
body: subagent.getBody()
|
|
13394
13792
|
};
|
|
@@ -13404,11 +13802,11 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
13404
13802
|
intendedRootDir: process.cwd()
|
|
13405
13803
|
});
|
|
13406
13804
|
const filename = basename28(relativePathFromCwd);
|
|
13407
|
-
const fullPath =
|
|
13805
|
+
const fullPath = join103(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
13408
13806
|
try {
|
|
13409
13807
|
await removeFile(fullPath);
|
|
13410
13808
|
return {
|
|
13411
|
-
relativePathFromCwd:
|
|
13809
|
+
relativePathFromCwd: join103(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13412
13810
|
};
|
|
13413
13811
|
} catch (error) {
|
|
13414
13812
|
throw new Error(
|
|
@@ -13420,23 +13818,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
13420
13818
|
}
|
|
13421
13819
|
}
|
|
13422
13820
|
var subagentToolSchemas = {
|
|
13423
|
-
listSubagents:
|
|
13424
|
-
getSubagent:
|
|
13425
|
-
relativePathFromCwd:
|
|
13821
|
+
listSubagents: z50.object({}),
|
|
13822
|
+
getSubagent: z50.object({
|
|
13823
|
+
relativePathFromCwd: z50.string()
|
|
13426
13824
|
}),
|
|
13427
|
-
putSubagent:
|
|
13428
|
-
relativePathFromCwd:
|
|
13825
|
+
putSubagent: z50.object({
|
|
13826
|
+
relativePathFromCwd: z50.string(),
|
|
13429
13827
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
13430
|
-
body:
|
|
13828
|
+
body: z50.string()
|
|
13431
13829
|
}),
|
|
13432
|
-
deleteSubagent:
|
|
13433
|
-
relativePathFromCwd:
|
|
13830
|
+
deleteSubagent: z50.object({
|
|
13831
|
+
relativePathFromCwd: z50.string()
|
|
13434
13832
|
})
|
|
13435
13833
|
};
|
|
13436
13834
|
var subagentTools = {
|
|
13437
13835
|
listSubagents: {
|
|
13438
13836
|
name: "listSubagents",
|
|
13439
|
-
description: `List all subagents from ${
|
|
13837
|
+
description: `List all subagents from ${join103(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13440
13838
|
parameters: subagentToolSchemas.listSubagents,
|
|
13441
13839
|
execute: async () => {
|
|
13442
13840
|
const subagents = await listSubagents();
|
|
@@ -13478,20 +13876,20 @@ var subagentTools = {
|
|
|
13478
13876
|
};
|
|
13479
13877
|
|
|
13480
13878
|
// src/mcp/tools.ts
|
|
13481
|
-
var rulesyncFeatureSchema =
|
|
13482
|
-
var rulesyncOperationSchema =
|
|
13483
|
-
var skillFileSchema =
|
|
13484
|
-
name:
|
|
13485
|
-
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()
|
|
13486
13884
|
});
|
|
13487
|
-
var rulesyncToolSchema =
|
|
13885
|
+
var rulesyncToolSchema = z51.object({
|
|
13488
13886
|
feature: rulesyncFeatureSchema,
|
|
13489
13887
|
operation: rulesyncOperationSchema,
|
|
13490
|
-
targetPathFromCwd:
|
|
13491
|
-
frontmatter:
|
|
13492
|
-
body:
|
|
13493
|
-
otherFiles:
|
|
13494
|
-
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())
|
|
13495
13893
|
});
|
|
13496
13894
|
var supportedOperationsByFeature = {
|
|
13497
13895
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -13687,7 +14085,7 @@ async function mcpCommand({ version }) {
|
|
|
13687
14085
|
}
|
|
13688
14086
|
|
|
13689
14087
|
// src/cli/index.ts
|
|
13690
|
-
var getVersion = () => "5.
|
|
14088
|
+
var getVersion = () => "5.8.0";
|
|
13691
14089
|
var main = async () => {
|
|
13692
14090
|
const program = new Command();
|
|
13693
14091
|
const version = getVersion();
|
|
@@ -13711,12 +14109,13 @@ var main = async () => {
|
|
|
13711
14109
|
(value) => {
|
|
13712
14110
|
return value.split(",").map((f) => f.trim());
|
|
13713
14111
|
}
|
|
13714
|
-
).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) => {
|
|
13715
14113
|
try {
|
|
13716
14114
|
await importCommand({
|
|
13717
14115
|
targets: options.targets,
|
|
13718
14116
|
features: options.features,
|
|
13719
14117
|
verbose: options.verbose,
|
|
14118
|
+
silent: options.silent,
|
|
13720
14119
|
configPath: options.config,
|
|
13721
14120
|
global: options.global
|
|
13722
14121
|
});
|
|
@@ -13748,7 +14147,7 @@ var main = async () => {
|
|
|
13748
14147
|
).option("--delete", "Delete all existing files in output directories before generating").option(
|
|
13749
14148
|
"-b, --base-dir <paths>",
|
|
13750
14149
|
"Base directories to generate files (comma-separated for multiple paths)"
|
|
13751
|
-
).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(
|
|
13752
14151
|
"--simulate-commands",
|
|
13753
14152
|
"Generate simulated commands. This feature is only available for copilot, cursor and codexcli."
|
|
13754
14153
|
).option(
|
|
@@ -13766,6 +14165,7 @@ var main = async () => {
|
|
|
13766
14165
|
targets: options.targets,
|
|
13767
14166
|
features: options.features,
|
|
13768
14167
|
verbose: options.verbose,
|
|
14168
|
+
silent: options.silent,
|
|
13769
14169
|
delete: options.delete,
|
|
13770
14170
|
baseDirs: options.baseDirs,
|
|
13771
14171
|
configPath: options.config,
|