rulesync 5.7.0 → 5.9.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.
Files changed (4) hide show
  1. package/README.md +5 -1
  2. package/dist/index.cjs +880 -524
  3. package/dist/index.js +852 -496
  4. package/package.json +11 -11
package/dist/index.cjs CHANGED
@@ -63,37 +63,52 @@ var isEnvTest = process.env.NODE_ENV === "test";
63
63
  // src/utils/logger.ts
64
64
  var Logger = class {
65
65
  _verbose = false;
66
+ _silent = false;
66
67
  console = import_consola.consola.withDefaults({
67
68
  tag: "rulesync"
68
69
  });
69
- setVerbose(verbose) {
70
- this._verbose = verbose;
70
+ /**
71
+ * Configure logger with verbose and silent mode settings.
72
+ * Handles conflicting flags where silent takes precedence.
73
+ * @param verbose - Enable verbose logging
74
+ * @param silent - Enable silent mode (suppresses all output except errors)
75
+ */
76
+ configure({ verbose, silent }) {
77
+ if (verbose && silent) {
78
+ this._silent = false;
79
+ this.warn("Both --verbose and --silent specified; --silent takes precedence");
80
+ }
81
+ this._silent = silent;
82
+ this._verbose = verbose && !silent;
71
83
  }
72
84
  get verbose() {
73
85
  return this._verbose;
74
86
  }
87
+ get silent() {
88
+ return this._silent;
89
+ }
75
90
  info(message, ...args) {
76
- if (isEnvTest) return;
91
+ if (isEnvTest || this._silent) return;
77
92
  this.console.info(message, ...args);
78
93
  }
79
- // Success (always shown)
94
+ // Success (always shown unless silent)
80
95
  success(message, ...args) {
81
- if (isEnvTest) return;
96
+ if (isEnvTest || this._silent) return;
82
97
  this.console.success(message, ...args);
83
98
  }
84
- // Warning (always shown)
99
+ // Warning (always shown unless silent)
85
100
  warn(message, ...args) {
86
- if (isEnvTest) return;
101
+ if (isEnvTest || this._silent) return;
87
102
  this.console.warn(message, ...args);
88
103
  }
89
- // Error (always shown)
104
+ // Error (always shown, even in silent mode)
90
105
  error(message, ...args) {
91
106
  if (isEnvTest) return;
92
107
  this.console.error(message, ...args);
93
108
  }
94
109
  // Debug level (shown only in verbose mode)
95
110
  debug(message, ...args) {
96
- if (isEnvTest) return;
111
+ if (isEnvTest || this._silent) return;
97
112
  if (this._verbose) {
98
113
  this.console.info(message, ...args);
99
114
  }
@@ -101,9 +116,6 @@ var Logger = class {
101
116
  };
102
117
  var logger = new Logger();
103
118
 
104
- // src/cli/commands/generate.ts
105
- var import_es_toolkit4 = require("es-toolkit");
106
-
107
119
  // src/config/config-resolver.ts
108
120
  var import_jsonc_parser = require("jsonc-parser");
109
121
  var import_node_path2 = require("path");
@@ -284,6 +296,7 @@ var ConfigParamsSchema = import_mini3.z.object({
284
296
  delete: import_mini3.z.boolean(),
285
297
  // New non-experimental options
286
298
  global: (0, import_mini3.optional)(import_mini3.z.boolean()),
299
+ silent: (0, import_mini3.optional)(import_mini3.z.boolean()),
287
300
  simulateCommands: (0, import_mini3.optional)(import_mini3.z.boolean()),
288
301
  simulateSubagents: (0, import_mini3.optional)(import_mini3.z.boolean()),
289
302
  simulateSkills: (0, import_mini3.optional)(import_mini3.z.boolean()),
@@ -307,6 +320,7 @@ var Config = class {
307
320
  verbose;
308
321
  delete;
309
322
  global;
323
+ silent;
310
324
  simulateCommands;
311
325
  simulateSubagents;
312
326
  simulateSkills;
@@ -318,6 +332,7 @@ var Config = class {
318
332
  verbose,
319
333
  delete: isDelete,
320
334
  global,
335
+ silent,
321
336
  simulateCommands,
322
337
  simulateSubagents,
323
338
  simulateSkills,
@@ -330,6 +345,7 @@ var Config = class {
330
345
  this.verbose = verbose;
331
346
  this.delete = isDelete;
332
347
  this.global = global ?? false;
348
+ this.silent = silent ?? false;
333
349
  this.simulateCommands = simulateCommands ?? false;
334
350
  this.simulateSubagents = simulateSubagents ?? false;
335
351
  this.simulateSkills = simulateSkills ?? false;
@@ -373,6 +389,9 @@ var Config = class {
373
389
  getGlobal() {
374
390
  return this.global;
375
391
  }
392
+ getSilent() {
393
+ return this.silent;
394
+ }
376
395
  getSimulateCommands() {
377
396
  return this.simulateCommands;
378
397
  }
@@ -396,6 +415,7 @@ var getDefaults = () => ({
396
415
  baseDirs: [process.cwd()],
397
416
  configPath: "rulesync.jsonc",
398
417
  global: false,
418
+ silent: false,
399
419
  simulateCommands: false,
400
420
  simulateSubagents: false,
401
421
  simulateSkills: false,
@@ -410,6 +430,7 @@ var ConfigResolver = class {
410
430
  baseDirs,
411
431
  configPath = getDefaults().configPath,
412
432
  global,
433
+ silent,
413
434
  simulateCommands,
414
435
  simulateSubagents,
415
436
  simulateSkills,
@@ -443,6 +464,7 @@ var ConfigResolver = class {
443
464
  global: resolvedGlobal
444
465
  }),
445
466
  global: resolvedGlobal,
467
+ silent: silent ?? configByFile.silent ?? getDefaults().silent,
446
468
  simulateCommands: resolvedSimulateCommands,
447
469
  simulateSubagents: resolvedSimulateSubagents,
448
470
  simulateSkills: resolvedSimulateSkills,
@@ -465,6 +487,10 @@ function getBaseDirsInLightOfGlobal({
465
487
  return resolvedBaseDirs;
466
488
  }
467
489
 
490
+ // src/lib/generate.ts
491
+ var import_es_toolkit4 = require("es-toolkit");
492
+ var import_node_path98 = require("path");
493
+
468
494
  // src/constants/rulesync-paths.ts
469
495
  var import_node_path3 = require("path");
470
496
  var RULESYNC_CONFIG_RELATIVE_FILE_PATH = "rulesync.jsonc";
@@ -5240,8 +5266,8 @@ var McpProcessor = class extends FeatureProcessor {
5240
5266
 
5241
5267
  // src/features/rules/rules-processor.ts
5242
5268
  var import_toon = require("@toon-format/toon");
5243
- var import_node_path96 = require("path");
5244
- var import_mini43 = require("zod/mini");
5269
+ var import_node_path97 = require("path");
5270
+ var import_mini44 = require("zod/mini");
5245
5271
 
5246
5272
  // src/constants/general.ts
5247
5273
  var SKILL_FILE_NAME = "SKILL.md";
@@ -5706,8 +5732,8 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
5706
5732
  };
5707
5733
 
5708
5734
  // src/features/skills/skills-processor.ts
5709
- var import_node_path61 = require("path");
5710
- var import_mini29 = require("zod/mini");
5735
+ var import_node_path62 = require("path");
5736
+ var import_mini30 = require("zod/mini");
5711
5737
 
5712
5738
  // src/types/dir-feature-processor.ts
5713
5739
  var import_node_path51 = require("path");
@@ -6883,18 +6909,197 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
6883
6909
  }
6884
6910
  };
6885
6911
 
6886
- // src/features/skills/opencode-skill.ts
6912
+ // src/features/skills/kiro-skill.ts
6887
6913
  var import_node_path59 = require("path");
6888
6914
  var import_mini27 = require("zod/mini");
6889
- var OpenCodeSkillFrontmatterSchema = import_mini27.z.looseObject({
6915
+ var KiroSkillFrontmatterSchema = import_mini27.z.looseObject({
6890
6916
  name: import_mini27.z.string(),
6891
- description: import_mini27.z.string(),
6892
- "allowed-tools": import_mini27.z.optional(import_mini27.z.array(import_mini27.z.string()))
6917
+ description: import_mini27.z.string()
6918
+ });
6919
+ var KiroSkill = class _KiroSkill extends ToolSkill {
6920
+ constructor({
6921
+ baseDir = process.cwd(),
6922
+ relativeDirPath = (0, import_node_path59.join)(".kiro", "skills"),
6923
+ dirName,
6924
+ frontmatter,
6925
+ body,
6926
+ otherFiles = [],
6927
+ validate = true,
6928
+ global = false
6929
+ }) {
6930
+ super({
6931
+ baseDir,
6932
+ relativeDirPath,
6933
+ dirName,
6934
+ mainFile: {
6935
+ name: SKILL_FILE_NAME,
6936
+ body,
6937
+ frontmatter: { ...frontmatter }
6938
+ },
6939
+ otherFiles,
6940
+ global
6941
+ });
6942
+ if (validate) {
6943
+ const result = this.validate();
6944
+ if (!result.success) {
6945
+ throw result.error;
6946
+ }
6947
+ }
6948
+ }
6949
+ static getSettablePaths(options) {
6950
+ if (options?.global) {
6951
+ throw new Error("KiroSkill does not support global mode.");
6952
+ }
6953
+ return {
6954
+ relativeDirPath: (0, import_node_path59.join)(".kiro", "skills")
6955
+ };
6956
+ }
6957
+ getFrontmatter() {
6958
+ if (!this.mainFile?.frontmatter) {
6959
+ throw new Error("Frontmatter is not defined");
6960
+ }
6961
+ const result = KiroSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
6962
+ return result;
6963
+ }
6964
+ getBody() {
6965
+ return this.mainFile?.body ?? "";
6966
+ }
6967
+ validate() {
6968
+ if (!this.mainFile) {
6969
+ return {
6970
+ success: false,
6971
+ error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
6972
+ };
6973
+ }
6974
+ const result = KiroSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
6975
+ if (!result.success) {
6976
+ return {
6977
+ success: false,
6978
+ error: new Error(
6979
+ `Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
6980
+ )
6981
+ };
6982
+ }
6983
+ if (result.data.name !== this.getDirName()) {
6984
+ return {
6985
+ success: false,
6986
+ error: new Error(
6987
+ `${this.getDirPath()}: frontmatter name (${result.data.name}) must match directory name (${this.getDirName()})`
6988
+ )
6989
+ };
6990
+ }
6991
+ return { success: true, error: null };
6992
+ }
6993
+ toRulesyncSkill() {
6994
+ const frontmatter = this.getFrontmatter();
6995
+ const rulesyncFrontmatter = {
6996
+ name: frontmatter.name,
6997
+ description: frontmatter.description,
6998
+ targets: ["*"]
6999
+ };
7000
+ return new RulesyncSkill({
7001
+ baseDir: this.baseDir,
7002
+ relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
7003
+ dirName: this.getDirName(),
7004
+ frontmatter: rulesyncFrontmatter,
7005
+ body: this.getBody(),
7006
+ otherFiles: this.getOtherFiles(),
7007
+ validate: true,
7008
+ global: this.global
7009
+ });
7010
+ }
7011
+ static fromRulesyncSkill({
7012
+ rulesyncSkill,
7013
+ validate = true,
7014
+ global = false
7015
+ }) {
7016
+ const settablePaths = _KiroSkill.getSettablePaths({ global });
7017
+ const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
7018
+ const kiroFrontmatter = {
7019
+ name: rulesyncFrontmatter.name,
7020
+ description: rulesyncFrontmatter.description
7021
+ };
7022
+ return new _KiroSkill({
7023
+ baseDir: rulesyncSkill.getBaseDir(),
7024
+ relativeDirPath: settablePaths.relativeDirPath,
7025
+ dirName: rulesyncSkill.getDirName(),
7026
+ frontmatter: kiroFrontmatter,
7027
+ body: rulesyncSkill.getBody(),
7028
+ otherFiles: rulesyncSkill.getOtherFiles(),
7029
+ validate,
7030
+ global
7031
+ });
7032
+ }
7033
+ static isTargetedByRulesyncSkill(rulesyncSkill) {
7034
+ const targets = rulesyncSkill.getFrontmatter().targets;
7035
+ return targets.includes("*") || targets.includes("kiro");
7036
+ }
7037
+ static async fromDir(params) {
7038
+ const loaded = await this.loadSkillDirContent({
7039
+ ...params,
7040
+ getSettablePaths: _KiroSkill.getSettablePaths
7041
+ });
7042
+ const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
7043
+ if (!result.success) {
7044
+ const skillDirPath = (0, import_node_path59.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
7045
+ throw new Error(
7046
+ `Invalid frontmatter in ${(0, import_node_path59.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
7047
+ );
7048
+ }
7049
+ if (result.data.name !== loaded.dirName) {
7050
+ const skillFilePath = (0, import_node_path59.join)(
7051
+ loaded.baseDir,
7052
+ loaded.relativeDirPath,
7053
+ loaded.dirName,
7054
+ SKILL_FILE_NAME
7055
+ );
7056
+ throw new Error(
7057
+ `Frontmatter name (${result.data.name}) must match directory name (${loaded.dirName}) in ${skillFilePath}`
7058
+ );
7059
+ }
7060
+ return new _KiroSkill({
7061
+ baseDir: loaded.baseDir,
7062
+ relativeDirPath: loaded.relativeDirPath,
7063
+ dirName: loaded.dirName,
7064
+ frontmatter: result.data,
7065
+ body: loaded.body,
7066
+ otherFiles: loaded.otherFiles,
7067
+ validate: true,
7068
+ global: loaded.global
7069
+ });
7070
+ }
7071
+ static forDeletion({
7072
+ baseDir = process.cwd(),
7073
+ relativeDirPath,
7074
+ dirName,
7075
+ global = false
7076
+ }) {
7077
+ const settablePaths = _KiroSkill.getSettablePaths({ global });
7078
+ return new _KiroSkill({
7079
+ baseDir,
7080
+ relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
7081
+ dirName,
7082
+ frontmatter: { name: "", description: "" },
7083
+ body: "",
7084
+ otherFiles: [],
7085
+ validate: false,
7086
+ global
7087
+ });
7088
+ }
7089
+ };
7090
+
7091
+ // src/features/skills/opencode-skill.ts
7092
+ var import_node_path60 = require("path");
7093
+ var import_mini28 = require("zod/mini");
7094
+ var OpenCodeSkillFrontmatterSchema = import_mini28.z.looseObject({
7095
+ name: import_mini28.z.string(),
7096
+ description: import_mini28.z.string(),
7097
+ "allowed-tools": import_mini28.z.optional(import_mini28.z.array(import_mini28.z.string()))
6893
7098
  });
6894
7099
  var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
6895
7100
  constructor({
6896
7101
  baseDir = process.cwd(),
6897
- relativeDirPath = (0, import_node_path59.join)(".opencode", "skill"),
7102
+ relativeDirPath = (0, import_node_path60.join)(".opencode", "skill"),
6898
7103
  dirName,
6899
7104
  frontmatter,
6900
7105
  body,
@@ -6923,7 +7128,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
6923
7128
  }
6924
7129
  static getSettablePaths({ global = false } = {}) {
6925
7130
  return {
6926
- relativeDirPath: global ? (0, import_node_path59.join)(".config", "opencode", "skill") : (0, import_node_path59.join)(".opencode", "skill")
7131
+ relativeDirPath: global ? (0, import_node_path60.join)(".config", "opencode", "skill") : (0, import_node_path60.join)(".opencode", "skill")
6927
7132
  };
6928
7133
  }
6929
7134
  getFrontmatter() {
@@ -7011,9 +7216,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
7011
7216
  });
7012
7217
  const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
7013
7218
  if (!result.success) {
7014
- const skillDirPath = (0, import_node_path59.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
7219
+ const skillDirPath = (0, import_node_path60.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
7015
7220
  throw new Error(
7016
- `Invalid frontmatter in ${(0, import_node_path59.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
7221
+ `Invalid frontmatter in ${(0, import_node_path60.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
7017
7222
  );
7018
7223
  }
7019
7224
  return new _OpenCodeSkill({
@@ -7047,16 +7252,16 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
7047
7252
  };
7048
7253
 
7049
7254
  // src/features/skills/roo-skill.ts
7050
- var import_node_path60 = require("path");
7051
- var import_mini28 = require("zod/mini");
7052
- var RooSkillFrontmatterSchema = import_mini28.z.looseObject({
7053
- name: import_mini28.z.string(),
7054
- description: import_mini28.z.string()
7255
+ var import_node_path61 = require("path");
7256
+ var import_mini29 = require("zod/mini");
7257
+ var RooSkillFrontmatterSchema = import_mini29.z.looseObject({
7258
+ name: import_mini29.z.string(),
7259
+ description: import_mini29.z.string()
7055
7260
  });
7056
7261
  var RooSkill = class _RooSkill extends ToolSkill {
7057
7262
  constructor({
7058
7263
  baseDir = process.cwd(),
7059
- relativeDirPath = (0, import_node_path60.join)(".roo", "skills"),
7264
+ relativeDirPath = (0, import_node_path61.join)(".roo", "skills"),
7060
7265
  dirName,
7061
7266
  frontmatter,
7062
7267
  body,
@@ -7087,7 +7292,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
7087
7292
  global: _global = false
7088
7293
  } = {}) {
7089
7294
  return {
7090
- relativeDirPath: (0, import_node_path60.join)(".roo", "skills")
7295
+ relativeDirPath: (0, import_node_path61.join)(".roo", "skills")
7091
7296
  };
7092
7297
  }
7093
7298
  getFrontmatter() {
@@ -7177,13 +7382,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
7177
7382
  });
7178
7383
  const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
7179
7384
  if (!result.success) {
7180
- const skillDirPath = (0, import_node_path60.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
7385
+ const skillDirPath = (0, import_node_path61.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
7181
7386
  throw new Error(
7182
- `Invalid frontmatter in ${(0, import_node_path60.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
7387
+ `Invalid frontmatter in ${(0, import_node_path61.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
7183
7388
  );
7184
7389
  }
7185
7390
  if (result.data.name !== loaded.dirName) {
7186
- const skillFilePath = (0, import_node_path60.join)(
7391
+ const skillFilePath = (0, import_node_path61.join)(
7187
7392
  loaded.baseDir,
7188
7393
  loaded.relativeDirPath,
7189
7394
  loaded.dirName,
@@ -7234,10 +7439,11 @@ var skillsProcessorToolTargetTuple = [
7234
7439
  "cursor",
7235
7440
  "geminicli",
7236
7441
  "kilo",
7442
+ "kiro",
7237
7443
  "opencode",
7238
7444
  "roo"
7239
7445
  ];
7240
- var SkillsProcessorToolTargetSchema = import_mini29.z.enum(skillsProcessorToolTargetTuple);
7446
+ var SkillsProcessorToolTargetSchema = import_mini30.z.enum(skillsProcessorToolTargetTuple);
7241
7447
  var toolSkillFactories = /* @__PURE__ */ new Map([
7242
7448
  [
7243
7449
  "agentsmd",
@@ -7302,6 +7508,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
7302
7508
  meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
7303
7509
  }
7304
7510
  ],
7511
+ [
7512
+ "kiro",
7513
+ {
7514
+ class: KiroSkill,
7515
+ meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: false }
7516
+ }
7517
+ ],
7305
7518
  [
7306
7519
  "opencode",
7307
7520
  {
@@ -7394,9 +7607,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
7394
7607
  */
7395
7608
  async loadRulesyncDirs() {
7396
7609
  const paths = RulesyncSkill.getSettablePaths();
7397
- const rulesyncSkillsDirPath = (0, import_node_path61.join)(this.baseDir, paths.relativeDirPath);
7398
- const dirPaths = await findFilesByGlobs((0, import_node_path61.join)(rulesyncSkillsDirPath, "*"), { type: "dir" });
7399
- const dirNames = dirPaths.map((path3) => (0, import_node_path61.basename)(path3));
7610
+ const rulesyncSkillsDirPath = (0, import_node_path62.join)(this.baseDir, paths.relativeDirPath);
7611
+ const dirPaths = await findFilesByGlobs((0, import_node_path62.join)(rulesyncSkillsDirPath, "*"), { type: "dir" });
7612
+ const dirNames = dirPaths.map((path3) => (0, import_node_path62.basename)(path3));
7400
7613
  const rulesyncSkills = await Promise.all(
7401
7614
  dirNames.map(
7402
7615
  (dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
@@ -7412,9 +7625,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
7412
7625
  async loadToolDirs() {
7413
7626
  const factory = this.getFactory(this.toolTarget);
7414
7627
  const paths = factory.class.getSettablePaths({ global: this.global });
7415
- const skillsDirPath = (0, import_node_path61.join)(this.baseDir, paths.relativeDirPath);
7416
- const dirPaths = await findFilesByGlobs((0, import_node_path61.join)(skillsDirPath, "*"), { type: "dir" });
7417
- const dirNames = dirPaths.map((path3) => (0, import_node_path61.basename)(path3));
7628
+ const skillsDirPath = (0, import_node_path62.join)(this.baseDir, paths.relativeDirPath);
7629
+ const dirPaths = await findFilesByGlobs((0, import_node_path62.join)(skillsDirPath, "*"), { type: "dir" });
7630
+ const dirNames = dirPaths.map((path3) => (0, import_node_path62.basename)(path3));
7418
7631
  const toolSkills = await Promise.all(
7419
7632
  dirNames.map(
7420
7633
  (dirName) => factory.class.fromDir({
@@ -7430,9 +7643,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
7430
7643
  async loadToolDirsToDelete() {
7431
7644
  const factory = this.getFactory(this.toolTarget);
7432
7645
  const paths = factory.class.getSettablePaths({ global: this.global });
7433
- const skillsDirPath = (0, import_node_path61.join)(this.baseDir, paths.relativeDirPath);
7434
- const dirPaths = await findFilesByGlobs((0, import_node_path61.join)(skillsDirPath, "*"), { type: "dir" });
7435
- const dirNames = dirPaths.map((path3) => (0, import_node_path61.basename)(path3));
7646
+ const skillsDirPath = (0, import_node_path62.join)(this.baseDir, paths.relativeDirPath);
7647
+ const dirPaths = await findFilesByGlobs((0, import_node_path62.join)(skillsDirPath, "*"), { type: "dir" });
7648
+ const dirNames = dirPaths.map((path3) => (0, import_node_path62.basename)(path3));
7436
7649
  const toolSkills = dirNames.map(
7437
7650
  (dirName) => factory.class.forDeletion({
7438
7651
  baseDir: this.baseDir,
@@ -7480,11 +7693,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
7480
7693
  };
7481
7694
 
7482
7695
  // src/features/subagents/agentsmd-subagent.ts
7483
- var import_node_path63 = require("path");
7696
+ var import_node_path64 = require("path");
7484
7697
 
7485
7698
  // src/features/subagents/simulated-subagent.ts
7486
- var import_node_path62 = require("path");
7487
- var import_mini30 = require("zod/mini");
7699
+ var import_node_path63 = require("path");
7700
+ var import_mini31 = require("zod/mini");
7488
7701
 
7489
7702
  // src/features/subagents/tool-subagent.ts
7490
7703
  var ToolSubagent = class extends ToolFile {
@@ -7527,9 +7740,9 @@ var ToolSubagent = class extends ToolFile {
7527
7740
  };
7528
7741
 
7529
7742
  // src/features/subagents/simulated-subagent.ts
7530
- var SimulatedSubagentFrontmatterSchema = import_mini30.z.object({
7531
- name: import_mini30.z.string(),
7532
- description: import_mini30.z.string()
7743
+ var SimulatedSubagentFrontmatterSchema = import_mini31.z.object({
7744
+ name: import_mini31.z.string(),
7745
+ description: import_mini31.z.string()
7533
7746
  });
7534
7747
  var SimulatedSubagent = class extends ToolSubagent {
7535
7748
  frontmatter;
@@ -7539,7 +7752,7 @@ var SimulatedSubagent = class extends ToolSubagent {
7539
7752
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
7540
7753
  if (!result.success) {
7541
7754
  throw new Error(
7542
- `Invalid frontmatter in ${(0, import_node_path62.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
7755
+ `Invalid frontmatter in ${(0, import_node_path63.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
7543
7756
  );
7544
7757
  }
7545
7758
  }
@@ -7590,7 +7803,7 @@ var SimulatedSubagent = class extends ToolSubagent {
7590
7803
  return {
7591
7804
  success: false,
7592
7805
  error: new Error(
7593
- `Invalid frontmatter in ${(0, import_node_path62.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7806
+ `Invalid frontmatter in ${(0, import_node_path63.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7594
7807
  )
7595
7808
  };
7596
7809
  }
@@ -7600,7 +7813,7 @@ var SimulatedSubagent = class extends ToolSubagent {
7600
7813
  relativeFilePath,
7601
7814
  validate = true
7602
7815
  }) {
7603
- const filePath = (0, import_node_path62.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
7816
+ const filePath = (0, import_node_path63.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
7604
7817
  const fileContent = await readFileContent(filePath);
7605
7818
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
7606
7819
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -7610,7 +7823,7 @@ var SimulatedSubagent = class extends ToolSubagent {
7610
7823
  return {
7611
7824
  baseDir,
7612
7825
  relativeDirPath: this.getSettablePaths().relativeDirPath,
7613
- relativeFilePath: (0, import_node_path62.basename)(relativeFilePath),
7826
+ relativeFilePath: (0, import_node_path63.basename)(relativeFilePath),
7614
7827
  frontmatter: result.data,
7615
7828
  body: content.trim(),
7616
7829
  validate
@@ -7636,7 +7849,7 @@ var SimulatedSubagent = class extends ToolSubagent {
7636
7849
  var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
7637
7850
  static getSettablePaths() {
7638
7851
  return {
7639
- relativeDirPath: (0, import_node_path63.join)(".agents", "subagents")
7852
+ relativeDirPath: (0, import_node_path64.join)(".agents", "subagents")
7640
7853
  };
7641
7854
  }
7642
7855
  static async fromFile(params) {
@@ -7659,11 +7872,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
7659
7872
  };
7660
7873
 
7661
7874
  // src/features/subagents/codexcli-subagent.ts
7662
- var import_node_path64 = require("path");
7875
+ var import_node_path65 = require("path");
7663
7876
  var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
7664
7877
  static getSettablePaths() {
7665
7878
  return {
7666
- relativeDirPath: (0, import_node_path64.join)(".codex", "subagents")
7879
+ relativeDirPath: (0, import_node_path65.join)(".codex", "subagents")
7667
7880
  };
7668
7881
  }
7669
7882
  static async fromFile(params) {
@@ -7686,11 +7899,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
7686
7899
  };
7687
7900
 
7688
7901
  // src/features/subagents/cursor-subagent.ts
7689
- var import_node_path65 = require("path");
7902
+ var import_node_path66 = require("path");
7690
7903
  var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
7691
7904
  static getSettablePaths() {
7692
7905
  return {
7693
- relativeDirPath: (0, import_node_path65.join)(".cursor", "subagents")
7906
+ relativeDirPath: (0, import_node_path66.join)(".cursor", "subagents")
7694
7907
  };
7695
7908
  }
7696
7909
  static async fromFile(params) {
@@ -7713,11 +7926,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
7713
7926
  };
7714
7927
 
7715
7928
  // src/features/subagents/geminicli-subagent.ts
7716
- var import_node_path66 = require("path");
7929
+ var import_node_path67 = require("path");
7717
7930
  var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
7718
7931
  static getSettablePaths() {
7719
7932
  return {
7720
- relativeDirPath: (0, import_node_path66.join)(".gemini", "subagents")
7933
+ relativeDirPath: (0, import_node_path67.join)(".gemini", "subagents")
7721
7934
  };
7722
7935
  }
7723
7936
  static async fromFile(params) {
@@ -7740,11 +7953,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
7740
7953
  };
7741
7954
 
7742
7955
  // src/features/subagents/roo-subagent.ts
7743
- var import_node_path67 = require("path");
7956
+ var import_node_path68 = require("path");
7744
7957
  var RooSubagent = class _RooSubagent extends SimulatedSubagent {
7745
7958
  static getSettablePaths() {
7746
7959
  return {
7747
- relativeDirPath: (0, import_node_path67.join)(".roo", "subagents")
7960
+ relativeDirPath: (0, import_node_path68.join)(".roo", "subagents")
7748
7961
  };
7749
7962
  }
7750
7963
  static async fromFile(params) {
@@ -7767,20 +7980,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
7767
7980
  };
7768
7981
 
7769
7982
  // src/features/subagents/subagents-processor.ts
7770
- var import_node_path73 = require("path");
7771
- var import_mini36 = require("zod/mini");
7983
+ var import_node_path74 = require("path");
7984
+ var import_mini37 = require("zod/mini");
7772
7985
 
7773
7986
  // src/features/subagents/claudecode-subagent.ts
7774
- var import_node_path69 = require("path");
7775
- var import_mini32 = require("zod/mini");
7987
+ var import_node_path70 = require("path");
7988
+ var import_mini33 = require("zod/mini");
7776
7989
 
7777
7990
  // src/features/subagents/rulesync-subagent.ts
7778
- var import_node_path68 = require("path");
7779
- var import_mini31 = require("zod/mini");
7780
- var RulesyncSubagentFrontmatterSchema = import_mini31.z.looseObject({
7991
+ var import_node_path69 = require("path");
7992
+ var import_mini32 = require("zod/mini");
7993
+ var RulesyncSubagentFrontmatterSchema = import_mini32.z.looseObject({
7781
7994
  targets: RulesyncTargetsSchema,
7782
- name: import_mini31.z.string(),
7783
- description: import_mini31.z.string()
7995
+ name: import_mini32.z.string(),
7996
+ description: import_mini32.z.string()
7784
7997
  });
7785
7998
  var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
7786
7999
  frontmatter;
@@ -7790,7 +8003,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
7790
8003
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
7791
8004
  if (!result.success) {
7792
8005
  throw new Error(
7793
- `Invalid frontmatter in ${(0, import_node_path68.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
8006
+ `Invalid frontmatter in ${(0, import_node_path69.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
7794
8007
  );
7795
8008
  }
7796
8009
  }
@@ -7823,7 +8036,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
7823
8036
  return {
7824
8037
  success: false,
7825
8038
  error: new Error(
7826
- `Invalid frontmatter in ${(0, import_node_path68.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
8039
+ `Invalid frontmatter in ${(0, import_node_path69.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7827
8040
  )
7828
8041
  };
7829
8042
  }
@@ -7832,14 +8045,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
7832
8045
  relativeFilePath
7833
8046
  }) {
7834
8047
  const fileContent = await readFileContent(
7835
- (0, import_node_path68.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
8048
+ (0, import_node_path69.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
7836
8049
  );
7837
8050
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
7838
8051
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
7839
8052
  if (!result.success) {
7840
8053
  throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
7841
8054
  }
7842
- const filename = (0, import_node_path68.basename)(relativeFilePath);
8055
+ const filename = (0, import_node_path69.basename)(relativeFilePath);
7843
8056
  return new _RulesyncSubagent({
7844
8057
  baseDir: process.cwd(),
7845
8058
  relativeDirPath: this.getSettablePaths().relativeDirPath,
@@ -7851,13 +8064,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
7851
8064
  };
7852
8065
 
7853
8066
  // src/features/subagents/claudecode-subagent.ts
7854
- var ClaudecodeSubagentFrontmatterSchema = import_mini32.z.looseObject({
7855
- name: import_mini32.z.string(),
7856
- description: import_mini32.z.string(),
7857
- model: import_mini32.z.optional(import_mini32.z.string()),
7858
- tools: import_mini32.z.optional(import_mini32.z.union([import_mini32.z.string(), import_mini32.z.array(import_mini32.z.string())])),
7859
- permissionMode: import_mini32.z.optional(import_mini32.z.string()),
7860
- skills: import_mini32.z.optional(import_mini32.z.union([import_mini32.z.string(), import_mini32.z.array(import_mini32.z.string())]))
8067
+ var ClaudecodeSubagentFrontmatterSchema = import_mini33.z.looseObject({
8068
+ name: import_mini33.z.string(),
8069
+ description: import_mini33.z.string(),
8070
+ model: import_mini33.z.optional(import_mini33.z.string()),
8071
+ tools: import_mini33.z.optional(import_mini33.z.union([import_mini33.z.string(), import_mini33.z.array(import_mini33.z.string())])),
8072
+ permissionMode: import_mini33.z.optional(import_mini33.z.string()),
8073
+ skills: import_mini33.z.optional(import_mini33.z.union([import_mini33.z.string(), import_mini33.z.array(import_mini33.z.string())]))
7861
8074
  });
7862
8075
  var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
7863
8076
  frontmatter;
@@ -7867,7 +8080,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
7867
8080
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
7868
8081
  if (!result.success) {
7869
8082
  throw new Error(
7870
- `Invalid frontmatter in ${(0, import_node_path69.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
8083
+ `Invalid frontmatter in ${(0, import_node_path70.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
7871
8084
  );
7872
8085
  }
7873
8086
  }
@@ -7879,7 +8092,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
7879
8092
  }
7880
8093
  static getSettablePaths(_options = {}) {
7881
8094
  return {
7882
- relativeDirPath: (0, import_node_path69.join)(".claude", "agents")
8095
+ relativeDirPath: (0, import_node_path70.join)(".claude", "agents")
7883
8096
  };
7884
8097
  }
7885
8098
  getFrontmatter() {
@@ -7953,7 +8166,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
7953
8166
  return {
7954
8167
  success: false,
7955
8168
  error: new Error(
7956
- `Invalid frontmatter in ${(0, import_node_path69.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
8169
+ `Invalid frontmatter in ${(0, import_node_path70.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7957
8170
  )
7958
8171
  };
7959
8172
  }
@@ -7971,7 +8184,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
7971
8184
  global = false
7972
8185
  }) {
7973
8186
  const paths = this.getSettablePaths({ global });
7974
- const filePath = (0, import_node_path69.join)(baseDir, paths.relativeDirPath, relativeFilePath);
8187
+ const filePath = (0, import_node_path70.join)(baseDir, paths.relativeDirPath, relativeFilePath);
7975
8188
  const fileContent = await readFileContent(filePath);
7976
8189
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
7977
8190
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -8006,13 +8219,13 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
8006
8219
  };
8007
8220
 
8008
8221
  // src/features/subagents/copilot-subagent.ts
8009
- var import_node_path70 = require("path");
8010
- var import_mini33 = require("zod/mini");
8222
+ var import_node_path71 = require("path");
8223
+ var import_mini34 = require("zod/mini");
8011
8224
  var REQUIRED_TOOL = "agent/runSubagent";
8012
- var CopilotSubagentFrontmatterSchema = import_mini33.z.looseObject({
8013
- name: import_mini33.z.string(),
8014
- description: import_mini33.z.string(),
8015
- tools: import_mini33.z.optional(import_mini33.z.union([import_mini33.z.string(), import_mini33.z.array(import_mini33.z.string())]))
8225
+ var CopilotSubagentFrontmatterSchema = import_mini34.z.looseObject({
8226
+ name: import_mini34.z.string(),
8227
+ description: import_mini34.z.string(),
8228
+ tools: import_mini34.z.optional(import_mini34.z.union([import_mini34.z.string(), import_mini34.z.array(import_mini34.z.string())]))
8016
8229
  });
8017
8230
  var normalizeTools = (tools) => {
8018
8231
  if (!tools) {
@@ -8032,7 +8245,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
8032
8245
  const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
8033
8246
  if (!result.success) {
8034
8247
  throw new Error(
8035
- `Invalid frontmatter in ${(0, import_node_path70.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
8248
+ `Invalid frontmatter in ${(0, import_node_path71.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
8036
8249
  );
8037
8250
  }
8038
8251
  }
@@ -8044,7 +8257,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
8044
8257
  }
8045
8258
  static getSettablePaths(_options = {}) {
8046
8259
  return {
8047
- relativeDirPath: (0, import_node_path70.join)(".github", "agents")
8260
+ relativeDirPath: (0, import_node_path71.join)(".github", "agents")
8048
8261
  };
8049
8262
  }
8050
8263
  getFrontmatter() {
@@ -8118,7 +8331,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
8118
8331
  return {
8119
8332
  success: false,
8120
8333
  error: new Error(
8121
- `Invalid frontmatter in ${(0, import_node_path70.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
8334
+ `Invalid frontmatter in ${(0, import_node_path71.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
8122
8335
  )
8123
8336
  };
8124
8337
  }
@@ -8136,7 +8349,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
8136
8349
  global = false
8137
8350
  }) {
8138
8351
  const paths = this.getSettablePaths({ global });
8139
- const filePath = (0, import_node_path70.join)(baseDir, paths.relativeDirPath, relativeFilePath);
8352
+ const filePath = (0, import_node_path71.join)(baseDir, paths.relativeDirPath, relativeFilePath);
8140
8353
  const fileContent = await readFileContent(filePath);
8141
8354
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
8142
8355
  const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -8172,23 +8385,23 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
8172
8385
  };
8173
8386
 
8174
8387
  // src/features/subagents/kiro-subagent.ts
8175
- var import_node_path71 = require("path");
8176
- var import_mini34 = require("zod/mini");
8177
- var KiroCliSubagentJsonSchema = import_mini34.z.looseObject({
8178
- name: import_mini34.z.string(),
8179
- description: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.string())),
8180
- prompt: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.string())),
8181
- tools: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.array(import_mini34.z.string()))),
8182
- toolAliases: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.record(import_mini34.z.string(), import_mini34.z.string()))),
8183
- toolSettings: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.unknown())),
8184
- toolSchema: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.unknown())),
8185
- hooks: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.record(import_mini34.z.string(), import_mini34.z.array(import_mini34.z.unknown())))),
8186
- model: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.string())),
8187
- mcpServers: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.record(import_mini34.z.string(), import_mini34.z.unknown()))),
8188
- useLegacyMcpJson: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.boolean())),
8189
- resources: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.array(import_mini34.z.string()))),
8190
- allowedTools: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.array(import_mini34.z.string()))),
8191
- includeMcpJson: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.boolean()))
8388
+ var import_node_path72 = require("path");
8389
+ var import_mini35 = require("zod/mini");
8390
+ var KiroCliSubagentJsonSchema = import_mini35.z.looseObject({
8391
+ name: import_mini35.z.string(),
8392
+ description: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.string())),
8393
+ prompt: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.string())),
8394
+ tools: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.array(import_mini35.z.string()))),
8395
+ toolAliases: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.record(import_mini35.z.string(), import_mini35.z.string()))),
8396
+ toolSettings: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.unknown())),
8397
+ toolSchema: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.unknown())),
8398
+ hooks: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.record(import_mini35.z.string(), import_mini35.z.array(import_mini35.z.unknown())))),
8399
+ model: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.string())),
8400
+ mcpServers: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.record(import_mini35.z.string(), import_mini35.z.unknown()))),
8401
+ useLegacyMcpJson: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.boolean())),
8402
+ resources: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.array(import_mini35.z.string()))),
8403
+ allowedTools: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.array(import_mini35.z.string()))),
8404
+ includeMcpJson: import_mini35.z.optional(import_mini35.z.nullable(import_mini35.z.boolean()))
8192
8405
  });
8193
8406
  var KiroSubagent = class _KiroSubagent extends ToolSubagent {
8194
8407
  body;
@@ -8200,7 +8413,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
8200
8413
  }
8201
8414
  static getSettablePaths(_options = {}) {
8202
8415
  return {
8203
- relativeDirPath: (0, import_node_path71.join)(".kiro", "agents")
8416
+ relativeDirPath: (0, import_node_path72.join)(".kiro", "agents")
8204
8417
  };
8205
8418
  }
8206
8419
  getBody() {
@@ -8280,7 +8493,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
8280
8493
  global = false
8281
8494
  }) {
8282
8495
  const paths = this.getSettablePaths({ global });
8283
- const filePath = (0, import_node_path71.join)(baseDir, paths.relativeDirPath, relativeFilePath);
8496
+ const filePath = (0, import_node_path72.join)(baseDir, paths.relativeDirPath, relativeFilePath);
8284
8497
  const fileContent = await readFileContent(filePath);
8285
8498
  return new _KiroSubagent({
8286
8499
  baseDir,
@@ -8309,12 +8522,12 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
8309
8522
  };
8310
8523
 
8311
8524
  // src/features/subagents/opencode-subagent.ts
8312
- var import_node_path72 = require("path");
8313
- var import_mini35 = require("zod/mini");
8314
- var OpenCodeSubagentFrontmatterSchema = import_mini35.z.looseObject({
8315
- description: import_mini35.z.string(),
8316
- mode: import_mini35.z.literal("subagent"),
8317
- name: import_mini35.z.optional(import_mini35.z.string())
8525
+ var import_node_path73 = require("path");
8526
+ var import_mini36 = require("zod/mini");
8527
+ var OpenCodeSubagentFrontmatterSchema = import_mini36.z.looseObject({
8528
+ description: import_mini36.z.string(),
8529
+ mode: import_mini36.z.literal("subagent"),
8530
+ name: import_mini36.z.optional(import_mini36.z.string())
8318
8531
  });
8319
8532
  var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
8320
8533
  frontmatter;
@@ -8324,7 +8537,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
8324
8537
  const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
8325
8538
  if (!result.success) {
8326
8539
  throw new Error(
8327
- `Invalid frontmatter in ${(0, import_node_path72.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
8540
+ `Invalid frontmatter in ${(0, import_node_path73.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
8328
8541
  );
8329
8542
  }
8330
8543
  }
@@ -8338,7 +8551,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
8338
8551
  global = false
8339
8552
  } = {}) {
8340
8553
  return {
8341
- relativeDirPath: global ? (0, import_node_path72.join)(".config", "opencode", "agent") : (0, import_node_path72.join)(".opencode", "agent")
8554
+ relativeDirPath: global ? (0, import_node_path73.join)(".config", "opencode", "agent") : (0, import_node_path73.join)(".opencode", "agent")
8342
8555
  };
8343
8556
  }
8344
8557
  getFrontmatter() {
@@ -8351,7 +8564,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
8351
8564
  const { description, mode, name, ...opencodeSection } = this.frontmatter;
8352
8565
  const rulesyncFrontmatter = {
8353
8566
  targets: ["*"],
8354
- name: name ?? (0, import_node_path72.basename)(this.getRelativeFilePath(), ".md"),
8567
+ name: name ?? (0, import_node_path73.basename)(this.getRelativeFilePath(), ".md"),
8355
8568
  description,
8356
8569
  opencode: { mode, ...opencodeSection }
8357
8570
  };
@@ -8404,7 +8617,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
8404
8617
  return {
8405
8618
  success: false,
8406
8619
  error: new Error(
8407
- `Invalid frontmatter in ${(0, import_node_path72.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
8620
+ `Invalid frontmatter in ${(0, import_node_path73.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
8408
8621
  )
8409
8622
  };
8410
8623
  }
@@ -8421,7 +8634,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
8421
8634
  global = false
8422
8635
  }) {
8423
8636
  const paths = this.getSettablePaths({ global });
8424
- const filePath = (0, import_node_path72.join)(baseDir, paths.relativeDirPath, relativeFilePath);
8637
+ const filePath = (0, import_node_path73.join)(baseDir, paths.relativeDirPath, relativeFilePath);
8425
8638
  const fileContent = await readFileContent(filePath);
8426
8639
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
8427
8640
  const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -8469,7 +8682,7 @@ var subagentsProcessorToolTargetTuple = [
8469
8682
  "opencode",
8470
8683
  "roo"
8471
8684
  ];
8472
- var SubagentsProcessorToolTargetSchema = import_mini36.z.enum(subagentsProcessorToolTargetTuple);
8685
+ var SubagentsProcessorToolTargetSchema = import_mini37.z.enum(subagentsProcessorToolTargetTuple);
8473
8686
  var toolSubagentFactories = /* @__PURE__ */ new Map([
8474
8687
  [
8475
8688
  "agentsmd",
@@ -8623,7 +8836,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
8623
8836
  * Load and parse rulesync subagent files from .rulesync/subagents/ directory
8624
8837
  */
8625
8838
  async loadRulesyncFiles() {
8626
- const subagentsDir = (0, import_node_path73.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
8839
+ const subagentsDir = (0, import_node_path74.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
8627
8840
  const dirExists = await directoryExists(subagentsDir);
8628
8841
  if (!dirExists) {
8629
8842
  logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
@@ -8638,7 +8851,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
8638
8851
  logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
8639
8852
  const rulesyncSubagents = [];
8640
8853
  for (const mdFile of mdFiles) {
8641
- const filepath = (0, import_node_path73.join)(subagentsDir, mdFile);
8854
+ const filepath = (0, import_node_path74.join)(subagentsDir, mdFile);
8642
8855
  try {
8643
8856
  const rulesyncSubagent = await RulesyncSubagent.fromFile({
8644
8857
  relativeFilePath: mdFile,
@@ -8668,14 +8881,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
8668
8881
  const factory = this.getFactory(this.toolTarget);
8669
8882
  const paths = factory.class.getSettablePaths({ global: this.global });
8670
8883
  const subagentFilePaths = await findFilesByGlobs(
8671
- (0, import_node_path73.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
8884
+ (0, import_node_path74.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
8672
8885
  );
8673
8886
  if (forDeletion) {
8674
8887
  const toolSubagents2 = subagentFilePaths.map(
8675
8888
  (path3) => factory.class.forDeletion({
8676
8889
  baseDir: this.baseDir,
8677
8890
  relativeDirPath: paths.relativeDirPath,
8678
- relativeFilePath: (0, import_node_path73.basename)(path3),
8891
+ relativeFilePath: (0, import_node_path74.basename)(path3),
8679
8892
  global: this.global
8680
8893
  })
8681
8894
  ).filter((subagent) => subagent.isDeletable());
@@ -8686,7 +8899,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
8686
8899
  subagentFilePaths.map(
8687
8900
  (path3) => factory.class.fromFile({
8688
8901
  baseDir: this.baseDir,
8689
- relativeFilePath: (0, import_node_path73.basename)(path3),
8902
+ relativeFilePath: (0, import_node_path74.basename)(path3),
8690
8903
  global: this.global
8691
8904
  })
8692
8905
  )
@@ -8718,48 +8931,49 @@ var SubagentsProcessor = class extends FeatureProcessor {
8718
8931
  };
8719
8932
 
8720
8933
  // src/features/rules/agentsmd-rule.ts
8721
- var import_node_path76 = require("path");
8934
+ var import_node_path77 = require("path");
8722
8935
 
8723
8936
  // src/features/rules/tool-rule.ts
8724
- var import_node_path75 = require("path");
8937
+ var import_node_path76 = require("path");
8725
8938
 
8726
8939
  // src/features/rules/rulesync-rule.ts
8727
- var import_node_path74 = require("path");
8728
- var import_mini37 = require("zod/mini");
8729
- var RulesyncRuleFrontmatterSchema = import_mini37.z.object({
8730
- root: import_mini37.z.optional(import_mini37.z.optional(import_mini37.z.boolean())),
8731
- targets: import_mini37.z.optional(RulesyncTargetsSchema),
8732
- description: import_mini37.z.optional(import_mini37.z.string()),
8733
- globs: import_mini37.z.optional(import_mini37.z.array(import_mini37.z.string())),
8734
- agentsmd: import_mini37.z.optional(
8735
- import_mini37.z.object({
8940
+ var import_node_path75 = require("path");
8941
+ var import_mini38 = require("zod/mini");
8942
+ var RulesyncRuleFrontmatterSchema = import_mini38.z.object({
8943
+ root: import_mini38.z.optional(import_mini38.z.boolean()),
8944
+ localRoot: import_mini38.z.optional(import_mini38.z.boolean()),
8945
+ targets: import_mini38.z.optional(RulesyncTargetsSchema),
8946
+ description: import_mini38.z.optional(import_mini38.z.string()),
8947
+ globs: import_mini38.z.optional(import_mini38.z.array(import_mini38.z.string())),
8948
+ agentsmd: import_mini38.z.optional(
8949
+ import_mini38.z.object({
8736
8950
  // @example "path/to/subproject"
8737
- subprojectPath: import_mini37.z.optional(import_mini37.z.string())
8951
+ subprojectPath: import_mini38.z.optional(import_mini38.z.string())
8738
8952
  })
8739
8953
  ),
8740
- claudecode: import_mini37.z.optional(
8741
- import_mini37.z.object({
8954
+ claudecode: import_mini38.z.optional(
8955
+ import_mini38.z.object({
8742
8956
  // Glob patterns for conditional rules (takes precedence over globs)
8743
8957
  // @example "src/**/*.ts, tests/**/*.test.ts"
8744
- paths: import_mini37.z.optional(import_mini37.z.string())
8958
+ paths: import_mini38.z.optional(import_mini38.z.string())
8745
8959
  })
8746
8960
  ),
8747
- cursor: import_mini37.z.optional(
8748
- import_mini37.z.object({
8749
- alwaysApply: import_mini37.z.optional(import_mini37.z.boolean()),
8750
- description: import_mini37.z.optional(import_mini37.z.string()),
8751
- globs: import_mini37.z.optional(import_mini37.z.array(import_mini37.z.string()))
8961
+ cursor: import_mini38.z.optional(
8962
+ import_mini38.z.object({
8963
+ alwaysApply: import_mini38.z.optional(import_mini38.z.boolean()),
8964
+ description: import_mini38.z.optional(import_mini38.z.string()),
8965
+ globs: import_mini38.z.optional(import_mini38.z.array(import_mini38.z.string()))
8752
8966
  })
8753
8967
  ),
8754
- copilot: import_mini37.z.optional(
8755
- import_mini37.z.object({
8756
- excludeAgent: import_mini37.z.optional(import_mini37.z.union([import_mini37.z.literal("code-review"), import_mini37.z.literal("coding-agent")]))
8968
+ copilot: import_mini38.z.optional(
8969
+ import_mini38.z.object({
8970
+ excludeAgent: import_mini38.z.optional(import_mini38.z.union([import_mini38.z.literal("code-review"), import_mini38.z.literal("coding-agent")]))
8757
8971
  })
8758
8972
  ),
8759
- antigravity: import_mini37.z.optional(
8760
- import_mini37.z.looseObject({
8761
- trigger: import_mini37.z.optional(import_mini37.z.string()),
8762
- globs: import_mini37.z.optional(import_mini37.z.array(import_mini37.z.string()))
8973
+ antigravity: import_mini38.z.optional(
8974
+ import_mini38.z.looseObject({
8975
+ trigger: import_mini38.z.optional(import_mini38.z.string()),
8976
+ globs: import_mini38.z.optional(import_mini38.z.array(import_mini38.z.string()))
8763
8977
  })
8764
8978
  )
8765
8979
  });
@@ -8771,7 +8985,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
8771
8985
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
8772
8986
  if (!result.success) {
8773
8987
  throw new Error(
8774
- `Invalid frontmatter in ${(0, import_node_path74.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
8988
+ `Invalid frontmatter in ${(0, import_node_path75.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
8775
8989
  );
8776
8990
  }
8777
8991
  }
@@ -8806,7 +9020,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
8806
9020
  return {
8807
9021
  success: false,
8808
9022
  error: new Error(
8809
- `Invalid frontmatter in ${(0, import_node_path74.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
9023
+ `Invalid frontmatter in ${(0, import_node_path75.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
8810
9024
  )
8811
9025
  };
8812
9026
  }
@@ -8815,12 +9029,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
8815
9029
  relativeFilePath,
8816
9030
  validate = true
8817
9031
  }) {
8818
- const legacyPath = (0, import_node_path74.join)(
9032
+ const legacyPath = (0, import_node_path75.join)(
8819
9033
  process.cwd(),
8820
9034
  this.getSettablePaths().legacy.relativeDirPath,
8821
9035
  relativeFilePath
8822
9036
  );
8823
- const recommendedPath = (0, import_node_path74.join)(
9037
+ const recommendedPath = (0, import_node_path75.join)(
8824
9038
  this.getSettablePaths().recommended.relativeDirPath,
8825
9039
  relativeFilePath
8826
9040
  );
@@ -8835,13 +9049,14 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
8835
9049
  }
8836
9050
  const validatedFrontmatter = {
8837
9051
  root: result.data.root ?? false,
9052
+ localRoot: result.data.localRoot ?? false,
8838
9053
  targets: result.data.targets ?? ["*"],
8839
9054
  description: result.data.description ?? "",
8840
9055
  globs: result.data.globs ?? [],
8841
9056
  agentsmd: result.data.agentsmd,
8842
9057
  cursor: result.data.cursor
8843
9058
  };
8844
- const filename = (0, import_node_path74.basename)(legacyPath);
9059
+ const filename = (0, import_node_path75.basename)(legacyPath);
8845
9060
  return new _RulesyncRule({
8846
9061
  baseDir: process.cwd(),
8847
9062
  relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
@@ -8855,7 +9070,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
8855
9070
  relativeFilePath,
8856
9071
  validate = true
8857
9072
  }) {
8858
- const filePath = (0, import_node_path74.join)(
9073
+ const filePath = (0, import_node_path75.join)(
8859
9074
  process.cwd(),
8860
9075
  this.getSettablePaths().recommended.relativeDirPath,
8861
9076
  relativeFilePath
@@ -8868,13 +9083,14 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
8868
9083
  }
8869
9084
  const validatedFrontmatter = {
8870
9085
  root: result.data.root ?? false,
9086
+ localRoot: result.data.localRoot ?? false,
8871
9087
  targets: result.data.targets ?? ["*"],
8872
9088
  description: result.data.description ?? "",
8873
9089
  globs: result.data.globs ?? [],
8874
9090
  agentsmd: result.data.agentsmd,
8875
9091
  cursor: result.data.cursor
8876
9092
  };
8877
- const filename = (0, import_node_path74.basename)(filePath);
9093
+ const filename = (0, import_node_path75.basename)(filePath);
8878
9094
  return new _RulesyncRule({
8879
9095
  baseDir: process.cwd(),
8880
9096
  relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
@@ -8957,7 +9173,7 @@ var ToolRule = class extends ToolFile {
8957
9173
  rulesyncRule,
8958
9174
  validate = true,
8959
9175
  rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
8960
- nonRootPath = { relativeDirPath: (0, import_node_path75.join)(".agents", "memories") }
9176
+ nonRootPath = { relativeDirPath: (0, import_node_path76.join)(".agents", "memories") }
8961
9177
  }) {
8962
9178
  const params = this.buildToolRuleParamsDefault({
8963
9179
  baseDir,
@@ -8968,7 +9184,7 @@ var ToolRule = class extends ToolFile {
8968
9184
  });
8969
9185
  const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
8970
9186
  if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
8971
- params.relativeDirPath = (0, import_node_path75.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
9187
+ params.relativeDirPath = (0, import_node_path76.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
8972
9188
  params.relativeFilePath = "AGENTS.md";
8973
9189
  }
8974
9190
  return params;
@@ -9033,7 +9249,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
9033
9249
  relativeFilePath: "AGENTS.md"
9034
9250
  },
9035
9251
  nonRoot: {
9036
- relativeDirPath: (0, import_node_path76.join)(".agents", "memories")
9252
+ relativeDirPath: (0, import_node_path77.join)(".agents", "memories")
9037
9253
  }
9038
9254
  };
9039
9255
  }
@@ -9043,8 +9259,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
9043
9259
  validate = true
9044
9260
  }) {
9045
9261
  const isRoot = relativeFilePath === "AGENTS.md";
9046
- const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path76.join)(".agents", "memories", relativeFilePath);
9047
- const fileContent = await readFileContent((0, import_node_path76.join)(baseDir, relativePath));
9262
+ const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path77.join)(".agents", "memories", relativeFilePath);
9263
+ const fileContent = await readFileContent((0, import_node_path77.join)(baseDir, relativePath));
9048
9264
  return new _AgentsMdRule({
9049
9265
  baseDir,
9050
9266
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -9099,21 +9315,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
9099
9315
  };
9100
9316
 
9101
9317
  // src/features/rules/antigravity-rule.ts
9102
- var import_node_path77 = require("path");
9103
- var import_mini38 = require("zod/mini");
9104
- var AntigravityRuleFrontmatterSchema = import_mini38.z.looseObject({
9105
- trigger: import_mini38.z.optional(
9106
- import_mini38.z.union([
9107
- import_mini38.z.literal("always_on"),
9108
- import_mini38.z.literal("glob"),
9109
- import_mini38.z.literal("manual"),
9110
- import_mini38.z.literal("model_decision"),
9111
- import_mini38.z.string()
9318
+ var import_node_path78 = require("path");
9319
+ var import_mini39 = require("zod/mini");
9320
+ var AntigravityRuleFrontmatterSchema = import_mini39.z.looseObject({
9321
+ trigger: import_mini39.z.optional(
9322
+ import_mini39.z.union([
9323
+ import_mini39.z.literal("always_on"),
9324
+ import_mini39.z.literal("glob"),
9325
+ import_mini39.z.literal("manual"),
9326
+ import_mini39.z.literal("model_decision"),
9327
+ import_mini39.z.string()
9112
9328
  // accepts any string for forward compatibility
9113
9329
  ])
9114
9330
  ),
9115
- globs: import_mini38.z.optional(import_mini38.z.string()),
9116
- description: import_mini38.z.optional(import_mini38.z.string())
9331
+ globs: import_mini39.z.optional(import_mini39.z.string()),
9332
+ description: import_mini39.z.optional(import_mini39.z.string())
9117
9333
  });
9118
9334
  function parseGlobsString(globs) {
9119
9335
  if (!globs) {
@@ -9258,7 +9474,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
9258
9474
  const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
9259
9475
  if (!result.success) {
9260
9476
  throw new Error(
9261
- `Invalid frontmatter in ${(0, import_node_path77.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
9477
+ `Invalid frontmatter in ${(0, import_node_path78.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
9262
9478
  );
9263
9479
  }
9264
9480
  }
@@ -9273,7 +9489,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
9273
9489
  static getSettablePaths() {
9274
9490
  return {
9275
9491
  nonRoot: {
9276
- relativeDirPath: (0, import_node_path77.join)(".agent", "rules")
9492
+ relativeDirPath: (0, import_node_path78.join)(".agent", "rules")
9277
9493
  }
9278
9494
  };
9279
9495
  }
@@ -9282,7 +9498,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
9282
9498
  relativeFilePath,
9283
9499
  validate = true
9284
9500
  }) {
9285
- const filePath = (0, import_node_path77.join)(
9501
+ const filePath = (0, import_node_path78.join)(
9286
9502
  baseDir,
9287
9503
  this.getSettablePaths().nonRoot.relativeDirPath,
9288
9504
  relativeFilePath
@@ -9423,7 +9639,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
9423
9639
  };
9424
9640
 
9425
9641
  // src/features/rules/augmentcode-legacy-rule.ts
9426
- var import_node_path78 = require("path");
9642
+ var import_node_path79 = require("path");
9427
9643
  var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
9428
9644
  toRulesyncRule() {
9429
9645
  const rulesyncFrontmatter = {
@@ -9449,7 +9665,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
9449
9665
  relativeFilePath: ".augment-guidelines"
9450
9666
  },
9451
9667
  nonRoot: {
9452
- relativeDirPath: (0, import_node_path78.join)(".augment", "rules")
9668
+ relativeDirPath: (0, import_node_path79.join)(".augment", "rules")
9453
9669
  }
9454
9670
  };
9455
9671
  }
@@ -9484,8 +9700,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
9484
9700
  }) {
9485
9701
  const settablePaths = this.getSettablePaths();
9486
9702
  const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
9487
- const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path78.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
9488
- const fileContent = await readFileContent((0, import_node_path78.join)(baseDir, relativePath));
9703
+ const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path79.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
9704
+ const fileContent = await readFileContent((0, import_node_path79.join)(baseDir, relativePath));
9489
9705
  return new _AugmentcodeLegacyRule({
9490
9706
  baseDir,
9491
9707
  relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
@@ -9514,7 +9730,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
9514
9730
  };
9515
9731
 
9516
9732
  // src/features/rules/augmentcode-rule.ts
9517
- var import_node_path79 = require("path");
9733
+ var import_node_path80 = require("path");
9518
9734
  var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
9519
9735
  toRulesyncRule() {
9520
9736
  return this.toRulesyncRuleDefault();
@@ -9522,7 +9738,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
9522
9738
  static getSettablePaths() {
9523
9739
  return {
9524
9740
  nonRoot: {
9525
- relativeDirPath: (0, import_node_path79.join)(".augment", "rules")
9741
+ relativeDirPath: (0, import_node_path80.join)(".augment", "rules")
9526
9742
  }
9527
9743
  };
9528
9744
  }
@@ -9546,7 +9762,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
9546
9762
  validate = true
9547
9763
  }) {
9548
9764
  const fileContent = await readFileContent(
9549
- (0, import_node_path79.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
9765
+ (0, import_node_path80.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
9550
9766
  );
9551
9767
  const { body: content } = parseFrontmatter(fileContent);
9552
9768
  return new _AugmentcodeRule({
@@ -9582,7 +9798,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
9582
9798
  };
9583
9799
 
9584
9800
  // src/features/rules/claudecode-legacy-rule.ts
9585
- var import_node_path80 = require("path");
9801
+ var import_node_path81 = require("path");
9586
9802
  var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
9587
9803
  static getSettablePaths({
9588
9804
  global
@@ -9601,7 +9817,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
9601
9817
  relativeFilePath: "CLAUDE.md"
9602
9818
  },
9603
9819
  nonRoot: {
9604
- relativeDirPath: (0, import_node_path80.join)(".claude", "memories")
9820
+ relativeDirPath: (0, import_node_path81.join)(".claude", "memories")
9605
9821
  }
9606
9822
  };
9607
9823
  }
@@ -9616,7 +9832,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
9616
9832
  if (isRoot) {
9617
9833
  const relativePath2 = paths.root.relativeFilePath;
9618
9834
  const fileContent2 = await readFileContent(
9619
- (0, import_node_path80.join)(baseDir, paths.root.relativeDirPath, relativePath2)
9835
+ (0, import_node_path81.join)(baseDir, paths.root.relativeDirPath, relativePath2)
9620
9836
  );
9621
9837
  return new _ClaudecodeLegacyRule({
9622
9838
  baseDir,
@@ -9630,8 +9846,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
9630
9846
  if (!paths.nonRoot) {
9631
9847
  throw new Error("nonRoot path is not set");
9632
9848
  }
9633
- const relativePath = (0, import_node_path80.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
9634
- const fileContent = await readFileContent((0, import_node_path80.join)(baseDir, relativePath));
9849
+ const relativePath = (0, import_node_path81.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
9850
+ const fileContent = await readFileContent((0, import_node_path81.join)(baseDir, relativePath));
9635
9851
  return new _ClaudecodeLegacyRule({
9636
9852
  baseDir,
9637
9853
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -9690,10 +9906,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
9690
9906
  };
9691
9907
 
9692
9908
  // src/features/rules/claudecode-rule.ts
9693
- var import_node_path81 = require("path");
9694
- var import_mini39 = require("zod/mini");
9695
- var ClaudecodeRuleFrontmatterSchema = import_mini39.z.object({
9696
- paths: import_mini39.z.optional(import_mini39.z.string())
9909
+ var import_node_path82 = require("path");
9910
+ var import_mini40 = require("zod/mini");
9911
+ var ClaudecodeRuleFrontmatterSchema = import_mini40.z.object({
9912
+ paths: import_mini40.z.optional(import_mini40.z.string())
9697
9913
  });
9698
9914
  var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
9699
9915
  frontmatter;
@@ -9715,7 +9931,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
9715
9931
  relativeFilePath: "CLAUDE.md"
9716
9932
  },
9717
9933
  nonRoot: {
9718
- relativeDirPath: (0, import_node_path81.join)(".claude", "rules")
9934
+ relativeDirPath: (0, import_node_path82.join)(".claude", "rules")
9719
9935
  }
9720
9936
  };
9721
9937
  }
@@ -9724,7 +9940,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
9724
9940
  const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
9725
9941
  if (!result.success) {
9726
9942
  throw new Error(
9727
- `Invalid frontmatter in ${(0, import_node_path81.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
9943
+ `Invalid frontmatter in ${(0, import_node_path82.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
9728
9944
  );
9729
9945
  }
9730
9946
  }
@@ -9752,7 +9968,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
9752
9968
  const isRoot = relativeFilePath === paths.root.relativeFilePath;
9753
9969
  if (isRoot) {
9754
9970
  const fileContent2 = await readFileContent(
9755
- (0, import_node_path81.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
9971
+ (0, import_node_path82.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
9756
9972
  );
9757
9973
  return new _ClaudecodeRule({
9758
9974
  baseDir,
@@ -9767,13 +9983,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
9767
9983
  if (!paths.nonRoot) {
9768
9984
  throw new Error("nonRoot path is not set");
9769
9985
  }
9770
- const relativePath = (0, import_node_path81.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
9771
- const fileContent = await readFileContent((0, import_node_path81.join)(baseDir, relativePath));
9986
+ const relativePath = (0, import_node_path82.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
9987
+ const fileContent = await readFileContent((0, import_node_path82.join)(baseDir, relativePath));
9772
9988
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
9773
9989
  const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
9774
9990
  if (!result.success) {
9775
9991
  throw new Error(
9776
- `Invalid frontmatter in ${(0, import_node_path81.join)(baseDir, relativePath)}: ${formatError(result.error)}`
9992
+ `Invalid frontmatter in ${(0, import_node_path82.join)(baseDir, relativePath)}: ${formatError(result.error)}`
9777
9993
  );
9778
9994
  }
9779
9995
  return new _ClaudecodeRule({
@@ -9880,7 +10096,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
9880
10096
  return {
9881
10097
  success: false,
9882
10098
  error: new Error(
9883
- `Invalid frontmatter in ${(0, import_node_path81.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
10099
+ `Invalid frontmatter in ${(0, import_node_path82.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
9884
10100
  )
9885
10101
  };
9886
10102
  }
@@ -9900,10 +10116,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
9900
10116
  };
9901
10117
 
9902
10118
  // src/features/rules/cline-rule.ts
9903
- var import_node_path82 = require("path");
9904
- var import_mini40 = require("zod/mini");
9905
- var ClineRuleFrontmatterSchema = import_mini40.z.object({
9906
- description: import_mini40.z.string()
10119
+ var import_node_path83 = require("path");
10120
+ var import_mini41 = require("zod/mini");
10121
+ var ClineRuleFrontmatterSchema = import_mini41.z.object({
10122
+ description: import_mini41.z.string()
9907
10123
  });
9908
10124
  var ClineRule = class _ClineRule extends ToolRule {
9909
10125
  static getSettablePaths() {
@@ -9945,7 +10161,7 @@ var ClineRule = class _ClineRule extends ToolRule {
9945
10161
  validate = true
9946
10162
  }) {
9947
10163
  const fileContent = await readFileContent(
9948
- (0, import_node_path82.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
10164
+ (0, import_node_path83.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
9949
10165
  );
9950
10166
  return new _ClineRule({
9951
10167
  baseDir,
@@ -9971,7 +10187,7 @@ var ClineRule = class _ClineRule extends ToolRule {
9971
10187
  };
9972
10188
 
9973
10189
  // src/features/rules/codexcli-rule.ts
9974
- var import_node_path83 = require("path");
10190
+ var import_node_path84 = require("path");
9975
10191
  var CodexcliRule = class _CodexcliRule extends ToolRule {
9976
10192
  static getSettablePaths({
9977
10193
  global
@@ -9990,7 +10206,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
9990
10206
  relativeFilePath: "AGENTS.md"
9991
10207
  },
9992
10208
  nonRoot: {
9993
- relativeDirPath: (0, import_node_path83.join)(".codex", "memories")
10209
+ relativeDirPath: (0, import_node_path84.join)(".codex", "memories")
9994
10210
  }
9995
10211
  };
9996
10212
  }
@@ -10005,7 +10221,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
10005
10221
  if (isRoot) {
10006
10222
  const relativePath2 = paths.root.relativeFilePath;
10007
10223
  const fileContent2 = await readFileContent(
10008
- (0, import_node_path83.join)(baseDir, paths.root.relativeDirPath, relativePath2)
10224
+ (0, import_node_path84.join)(baseDir, paths.root.relativeDirPath, relativePath2)
10009
10225
  );
10010
10226
  return new _CodexcliRule({
10011
10227
  baseDir,
@@ -10019,8 +10235,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
10019
10235
  if (!paths.nonRoot) {
10020
10236
  throw new Error("nonRoot path is not set");
10021
10237
  }
10022
- const relativePath = (0, import_node_path83.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
10023
- const fileContent = await readFileContent((0, import_node_path83.join)(baseDir, relativePath));
10238
+ const relativePath = (0, import_node_path84.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
10239
+ const fileContent = await readFileContent((0, import_node_path84.join)(baseDir, relativePath));
10024
10240
  return new _CodexcliRule({
10025
10241
  baseDir,
10026
10242
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -10079,12 +10295,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
10079
10295
  };
10080
10296
 
10081
10297
  // src/features/rules/copilot-rule.ts
10082
- var import_node_path84 = require("path");
10083
- var import_mini41 = require("zod/mini");
10084
- var CopilotRuleFrontmatterSchema = import_mini41.z.object({
10085
- description: import_mini41.z.optional(import_mini41.z.string()),
10086
- applyTo: import_mini41.z.optional(import_mini41.z.string()),
10087
- excludeAgent: import_mini41.z.optional(import_mini41.z.union([import_mini41.z.literal("code-review"), import_mini41.z.literal("coding-agent")]))
10298
+ var import_node_path85 = require("path");
10299
+ var import_mini42 = require("zod/mini");
10300
+ var CopilotRuleFrontmatterSchema = import_mini42.z.object({
10301
+ description: import_mini42.z.optional(import_mini42.z.string()),
10302
+ applyTo: import_mini42.z.optional(import_mini42.z.string()),
10303
+ excludeAgent: import_mini42.z.optional(import_mini42.z.union([import_mini42.z.literal("code-review"), import_mini42.z.literal("coding-agent")]))
10088
10304
  });
10089
10305
  var CopilotRule = class _CopilotRule extends ToolRule {
10090
10306
  frontmatter;
@@ -10096,7 +10312,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
10096
10312
  relativeFilePath: "copilot-instructions.md"
10097
10313
  },
10098
10314
  nonRoot: {
10099
- relativeDirPath: (0, import_node_path84.join)(".github", "instructions")
10315
+ relativeDirPath: (0, import_node_path85.join)(".github", "instructions")
10100
10316
  }
10101
10317
  };
10102
10318
  }
@@ -10105,7 +10321,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
10105
10321
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
10106
10322
  if (!result.success) {
10107
10323
  throw new Error(
10108
- `Invalid frontmatter in ${(0, import_node_path84.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
10324
+ `Invalid frontmatter in ${(0, import_node_path85.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
10109
10325
  );
10110
10326
  }
10111
10327
  }
@@ -10187,11 +10403,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
10187
10403
  validate = true
10188
10404
  }) {
10189
10405
  const isRoot = relativeFilePath === "copilot-instructions.md";
10190
- const relativePath = isRoot ? (0, import_node_path84.join)(
10406
+ const relativePath = isRoot ? (0, import_node_path85.join)(
10191
10407
  this.getSettablePaths().root.relativeDirPath,
10192
10408
  this.getSettablePaths().root.relativeFilePath
10193
- ) : (0, import_node_path84.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
10194
- const fileContent = await readFileContent((0, import_node_path84.join)(baseDir, relativePath));
10409
+ ) : (0, import_node_path85.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
10410
+ const fileContent = await readFileContent((0, import_node_path85.join)(baseDir, relativePath));
10195
10411
  if (isRoot) {
10196
10412
  return new _CopilotRule({
10197
10413
  baseDir,
@@ -10207,7 +10423,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
10207
10423
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
10208
10424
  if (!result.success) {
10209
10425
  throw new Error(
10210
- `Invalid frontmatter in ${(0, import_node_path84.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
10426
+ `Invalid frontmatter in ${(0, import_node_path85.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
10211
10427
  );
10212
10428
  }
10213
10429
  return new _CopilotRule({
@@ -10247,7 +10463,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
10247
10463
  return {
10248
10464
  success: false,
10249
10465
  error: new Error(
10250
- `Invalid frontmatter in ${(0, import_node_path84.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
10466
+ `Invalid frontmatter in ${(0, import_node_path85.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
10251
10467
  )
10252
10468
  };
10253
10469
  }
@@ -10267,12 +10483,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
10267
10483
  };
10268
10484
 
10269
10485
  // src/features/rules/cursor-rule.ts
10270
- var import_node_path85 = require("path");
10271
- var import_mini42 = require("zod/mini");
10272
- var CursorRuleFrontmatterSchema = import_mini42.z.object({
10273
- description: import_mini42.z.optional(import_mini42.z.string()),
10274
- globs: import_mini42.z.optional(import_mini42.z.string()),
10275
- alwaysApply: import_mini42.z.optional(import_mini42.z.boolean())
10486
+ var import_node_path86 = require("path");
10487
+ var import_mini43 = require("zod/mini");
10488
+ var CursorRuleFrontmatterSchema = import_mini43.z.object({
10489
+ description: import_mini43.z.optional(import_mini43.z.string()),
10490
+ globs: import_mini43.z.optional(import_mini43.z.string()),
10491
+ alwaysApply: import_mini43.z.optional(import_mini43.z.boolean())
10276
10492
  });
10277
10493
  var CursorRule = class _CursorRule extends ToolRule {
10278
10494
  frontmatter;
@@ -10280,7 +10496,7 @@ var CursorRule = class _CursorRule extends ToolRule {
10280
10496
  static getSettablePaths() {
10281
10497
  return {
10282
10498
  nonRoot: {
10283
- relativeDirPath: (0, import_node_path85.join)(".cursor", "rules")
10499
+ relativeDirPath: (0, import_node_path86.join)(".cursor", "rules")
10284
10500
  }
10285
10501
  };
10286
10502
  }
@@ -10289,7 +10505,7 @@ var CursorRule = class _CursorRule extends ToolRule {
10289
10505
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
10290
10506
  if (!result.success) {
10291
10507
  throw new Error(
10292
- `Invalid frontmatter in ${(0, import_node_path85.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
10508
+ `Invalid frontmatter in ${(0, import_node_path86.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
10293
10509
  );
10294
10510
  }
10295
10511
  }
@@ -10406,19 +10622,19 @@ var CursorRule = class _CursorRule extends ToolRule {
10406
10622
  validate = true
10407
10623
  }) {
10408
10624
  const fileContent = await readFileContent(
10409
- (0, import_node_path85.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
10625
+ (0, import_node_path86.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
10410
10626
  );
10411
10627
  const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
10412
10628
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
10413
10629
  if (!result.success) {
10414
10630
  throw new Error(
10415
- `Invalid frontmatter in ${(0, import_node_path85.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
10631
+ `Invalid frontmatter in ${(0, import_node_path86.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
10416
10632
  );
10417
10633
  }
10418
10634
  return new _CursorRule({
10419
10635
  baseDir,
10420
10636
  relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
10421
- relativeFilePath: (0, import_node_path85.basename)(relativeFilePath),
10637
+ relativeFilePath: (0, import_node_path86.basename)(relativeFilePath),
10422
10638
  frontmatter: result.data,
10423
10639
  body: content.trim(),
10424
10640
  validate
@@ -10449,7 +10665,7 @@ var CursorRule = class _CursorRule extends ToolRule {
10449
10665
  return {
10450
10666
  success: false,
10451
10667
  error: new Error(
10452
- `Invalid frontmatter in ${(0, import_node_path85.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
10668
+ `Invalid frontmatter in ${(0, import_node_path86.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
10453
10669
  )
10454
10670
  };
10455
10671
  }
@@ -10469,7 +10685,7 @@ var CursorRule = class _CursorRule extends ToolRule {
10469
10685
  };
10470
10686
 
10471
10687
  // src/features/rules/geminicli-rule.ts
10472
- var import_node_path86 = require("path");
10688
+ var import_node_path87 = require("path");
10473
10689
  var GeminiCliRule = class _GeminiCliRule extends ToolRule {
10474
10690
  static getSettablePaths({
10475
10691
  global
@@ -10488,7 +10704,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
10488
10704
  relativeFilePath: "GEMINI.md"
10489
10705
  },
10490
10706
  nonRoot: {
10491
- relativeDirPath: (0, import_node_path86.join)(".gemini", "memories")
10707
+ relativeDirPath: (0, import_node_path87.join)(".gemini", "memories")
10492
10708
  }
10493
10709
  };
10494
10710
  }
@@ -10503,7 +10719,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
10503
10719
  if (isRoot) {
10504
10720
  const relativePath2 = paths.root.relativeFilePath;
10505
10721
  const fileContent2 = await readFileContent(
10506
- (0, import_node_path86.join)(baseDir, paths.root.relativeDirPath, relativePath2)
10722
+ (0, import_node_path87.join)(baseDir, paths.root.relativeDirPath, relativePath2)
10507
10723
  );
10508
10724
  return new _GeminiCliRule({
10509
10725
  baseDir,
@@ -10517,8 +10733,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
10517
10733
  if (!paths.nonRoot) {
10518
10734
  throw new Error("nonRoot path is not set");
10519
10735
  }
10520
- const relativePath = (0, import_node_path86.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
10521
- const fileContent = await readFileContent((0, import_node_path86.join)(baseDir, relativePath));
10736
+ const relativePath = (0, import_node_path87.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
10737
+ const fileContent = await readFileContent((0, import_node_path87.join)(baseDir, relativePath));
10522
10738
  return new _GeminiCliRule({
10523
10739
  baseDir,
10524
10740
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -10577,7 +10793,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
10577
10793
  };
10578
10794
 
10579
10795
  // src/features/rules/junie-rule.ts
10580
- var import_node_path87 = require("path");
10796
+ var import_node_path88 = require("path");
10581
10797
  var JunieRule = class _JunieRule extends ToolRule {
10582
10798
  static getSettablePaths() {
10583
10799
  return {
@@ -10586,7 +10802,7 @@ var JunieRule = class _JunieRule extends ToolRule {
10586
10802
  relativeFilePath: "guidelines.md"
10587
10803
  },
10588
10804
  nonRoot: {
10589
- relativeDirPath: (0, import_node_path87.join)(".junie", "memories")
10805
+ relativeDirPath: (0, import_node_path88.join)(".junie", "memories")
10590
10806
  }
10591
10807
  };
10592
10808
  }
@@ -10596,8 +10812,8 @@ var JunieRule = class _JunieRule extends ToolRule {
10596
10812
  validate = true
10597
10813
  }) {
10598
10814
  const isRoot = relativeFilePath === "guidelines.md";
10599
- const relativePath = isRoot ? "guidelines.md" : (0, import_node_path87.join)(".junie", "memories", relativeFilePath);
10600
- const fileContent = await readFileContent((0, import_node_path87.join)(baseDir, relativePath));
10815
+ const relativePath = isRoot ? "guidelines.md" : (0, import_node_path88.join)(".junie", "memories", relativeFilePath);
10816
+ const fileContent = await readFileContent((0, import_node_path88.join)(baseDir, relativePath));
10601
10817
  return new _JunieRule({
10602
10818
  baseDir,
10603
10819
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -10652,12 +10868,12 @@ var JunieRule = class _JunieRule extends ToolRule {
10652
10868
  };
10653
10869
 
10654
10870
  // src/features/rules/kilo-rule.ts
10655
- var import_node_path88 = require("path");
10871
+ var import_node_path89 = require("path");
10656
10872
  var KiloRule = class _KiloRule extends ToolRule {
10657
10873
  static getSettablePaths(_options = {}) {
10658
10874
  return {
10659
10875
  nonRoot: {
10660
- relativeDirPath: (0, import_node_path88.join)(".kilocode", "rules")
10876
+ relativeDirPath: (0, import_node_path89.join)(".kilocode", "rules")
10661
10877
  }
10662
10878
  };
10663
10879
  }
@@ -10667,7 +10883,7 @@ var KiloRule = class _KiloRule extends ToolRule {
10667
10883
  validate = true
10668
10884
  }) {
10669
10885
  const fileContent = await readFileContent(
10670
- (0, import_node_path88.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
10886
+ (0, import_node_path89.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
10671
10887
  );
10672
10888
  return new _KiloRule({
10673
10889
  baseDir,
@@ -10719,12 +10935,12 @@ var KiloRule = class _KiloRule extends ToolRule {
10719
10935
  };
10720
10936
 
10721
10937
  // src/features/rules/kiro-rule.ts
10722
- var import_node_path89 = require("path");
10938
+ var import_node_path90 = require("path");
10723
10939
  var KiroRule = class _KiroRule extends ToolRule {
10724
10940
  static getSettablePaths() {
10725
10941
  return {
10726
10942
  nonRoot: {
10727
- relativeDirPath: (0, import_node_path89.join)(".kiro", "steering")
10943
+ relativeDirPath: (0, import_node_path90.join)(".kiro", "steering")
10728
10944
  }
10729
10945
  };
10730
10946
  }
@@ -10734,7 +10950,7 @@ var KiroRule = class _KiroRule extends ToolRule {
10734
10950
  validate = true
10735
10951
  }) {
10736
10952
  const fileContent = await readFileContent(
10737
- (0, import_node_path89.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
10953
+ (0, import_node_path90.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
10738
10954
  );
10739
10955
  return new _KiroRule({
10740
10956
  baseDir,
@@ -10788,7 +11004,7 @@ var KiroRule = class _KiroRule extends ToolRule {
10788
11004
  };
10789
11005
 
10790
11006
  // src/features/rules/opencode-rule.ts
10791
- var import_node_path90 = require("path");
11007
+ var import_node_path91 = require("path");
10792
11008
  var OpenCodeRule = class _OpenCodeRule extends ToolRule {
10793
11009
  static getSettablePaths() {
10794
11010
  return {
@@ -10797,7 +11013,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
10797
11013
  relativeFilePath: "AGENTS.md"
10798
11014
  },
10799
11015
  nonRoot: {
10800
- relativeDirPath: (0, import_node_path90.join)(".opencode", "memories")
11016
+ relativeDirPath: (0, import_node_path91.join)(".opencode", "memories")
10801
11017
  }
10802
11018
  };
10803
11019
  }
@@ -10807,8 +11023,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
10807
11023
  validate = true
10808
11024
  }) {
10809
11025
  const isRoot = relativeFilePath === "AGENTS.md";
10810
- const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path90.join)(".opencode", "memories", relativeFilePath);
10811
- const fileContent = await readFileContent((0, import_node_path90.join)(baseDir, relativePath));
11026
+ const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path91.join)(".opencode", "memories", relativeFilePath);
11027
+ const fileContent = await readFileContent((0, import_node_path91.join)(baseDir, relativePath));
10812
11028
  return new _OpenCodeRule({
10813
11029
  baseDir,
10814
11030
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -10863,7 +11079,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
10863
11079
  };
10864
11080
 
10865
11081
  // src/features/rules/qwencode-rule.ts
10866
- var import_node_path91 = require("path");
11082
+ var import_node_path92 = require("path");
10867
11083
  var QwencodeRule = class _QwencodeRule extends ToolRule {
10868
11084
  static getSettablePaths() {
10869
11085
  return {
@@ -10872,7 +11088,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
10872
11088
  relativeFilePath: "QWEN.md"
10873
11089
  },
10874
11090
  nonRoot: {
10875
- relativeDirPath: (0, import_node_path91.join)(".qwen", "memories")
11091
+ relativeDirPath: (0, import_node_path92.join)(".qwen", "memories")
10876
11092
  }
10877
11093
  };
10878
11094
  }
@@ -10882,8 +11098,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
10882
11098
  validate = true
10883
11099
  }) {
10884
11100
  const isRoot = relativeFilePath === "QWEN.md";
10885
- const relativePath = isRoot ? "QWEN.md" : (0, import_node_path91.join)(".qwen", "memories", relativeFilePath);
10886
- const fileContent = await readFileContent((0, import_node_path91.join)(baseDir, relativePath));
11101
+ const relativePath = isRoot ? "QWEN.md" : (0, import_node_path92.join)(".qwen", "memories", relativeFilePath);
11102
+ const fileContent = await readFileContent((0, import_node_path92.join)(baseDir, relativePath));
10887
11103
  return new _QwencodeRule({
10888
11104
  baseDir,
10889
11105
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -10935,7 +11151,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
10935
11151
  };
10936
11152
 
10937
11153
  // src/features/rules/replit-rule.ts
10938
- var import_node_path92 = require("path");
11154
+ var import_node_path93 = require("path");
10939
11155
  var ReplitRule = class _ReplitRule extends ToolRule {
10940
11156
  static getSettablePaths() {
10941
11157
  return {
@@ -10957,7 +11173,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
10957
11173
  }
10958
11174
  const relativePath = paths.root.relativeFilePath;
10959
11175
  const fileContent = await readFileContent(
10960
- (0, import_node_path92.join)(baseDir, paths.root.relativeDirPath, relativePath)
11176
+ (0, import_node_path93.join)(baseDir, paths.root.relativeDirPath, relativePath)
10961
11177
  );
10962
11178
  return new _ReplitRule({
10963
11179
  baseDir,
@@ -11023,12 +11239,12 @@ var ReplitRule = class _ReplitRule extends ToolRule {
11023
11239
  };
11024
11240
 
11025
11241
  // src/features/rules/roo-rule.ts
11026
- var import_node_path93 = require("path");
11242
+ var import_node_path94 = require("path");
11027
11243
  var RooRule = class _RooRule extends ToolRule {
11028
11244
  static getSettablePaths() {
11029
11245
  return {
11030
11246
  nonRoot: {
11031
- relativeDirPath: (0, import_node_path93.join)(".roo", "rules")
11247
+ relativeDirPath: (0, import_node_path94.join)(".roo", "rules")
11032
11248
  }
11033
11249
  };
11034
11250
  }
@@ -11038,7 +11254,7 @@ var RooRule = class _RooRule extends ToolRule {
11038
11254
  validate = true
11039
11255
  }) {
11040
11256
  const fileContent = await readFileContent(
11041
- (0, import_node_path93.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
11257
+ (0, import_node_path94.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
11042
11258
  );
11043
11259
  return new _RooRule({
11044
11260
  baseDir,
@@ -11107,7 +11323,7 @@ var RooRule = class _RooRule extends ToolRule {
11107
11323
  };
11108
11324
 
11109
11325
  // src/features/rules/warp-rule.ts
11110
- var import_node_path94 = require("path");
11326
+ var import_node_path95 = require("path");
11111
11327
  var WarpRule = class _WarpRule extends ToolRule {
11112
11328
  constructor({ fileContent, root, ...rest }) {
11113
11329
  super({
@@ -11123,7 +11339,7 @@ var WarpRule = class _WarpRule extends ToolRule {
11123
11339
  relativeFilePath: "WARP.md"
11124
11340
  },
11125
11341
  nonRoot: {
11126
- relativeDirPath: (0, import_node_path94.join)(".warp", "memories")
11342
+ relativeDirPath: (0, import_node_path95.join)(".warp", "memories")
11127
11343
  }
11128
11344
  };
11129
11345
  }
@@ -11133,8 +11349,8 @@ var WarpRule = class _WarpRule extends ToolRule {
11133
11349
  validate = true
11134
11350
  }) {
11135
11351
  const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
11136
- const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path94.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
11137
- const fileContent = await readFileContent((0, import_node_path94.join)(baseDir, relativePath));
11352
+ const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path95.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
11353
+ const fileContent = await readFileContent((0, import_node_path95.join)(baseDir, relativePath));
11138
11354
  return new _WarpRule({
11139
11355
  baseDir,
11140
11356
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
@@ -11189,12 +11405,12 @@ var WarpRule = class _WarpRule extends ToolRule {
11189
11405
  };
11190
11406
 
11191
11407
  // src/features/rules/windsurf-rule.ts
11192
- var import_node_path95 = require("path");
11408
+ var import_node_path96 = require("path");
11193
11409
  var WindsurfRule = class _WindsurfRule extends ToolRule {
11194
11410
  static getSettablePaths() {
11195
11411
  return {
11196
11412
  nonRoot: {
11197
- relativeDirPath: (0, import_node_path95.join)(".windsurf", "rules")
11413
+ relativeDirPath: (0, import_node_path96.join)(".windsurf", "rules")
11198
11414
  }
11199
11415
  };
11200
11416
  }
@@ -11204,7 +11420,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
11204
11420
  validate = true
11205
11421
  }) {
11206
11422
  const fileContent = await readFileContent(
11207
- (0, import_node_path95.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
11423
+ (0, import_node_path96.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
11208
11424
  );
11209
11425
  return new _WindsurfRule({
11210
11426
  baseDir,
@@ -11278,7 +11494,7 @@ var rulesProcessorToolTargets = [
11278
11494
  "warp",
11279
11495
  "windsurf"
11280
11496
  ];
11281
- var RulesProcessorToolTargetSchema = import_mini43.z.enum(rulesProcessorToolTargets);
11497
+ var RulesProcessorToolTargetSchema = import_mini44.z.enum(rulesProcessorToolTargets);
11282
11498
  var toolRuleFactories = /* @__PURE__ */ new Map([
11283
11499
  [
11284
11500
  "agentsmd",
@@ -11510,9 +11726,11 @@ var RulesProcessor = class extends FeatureProcessor {
11510
11726
  const rulesyncRules = rulesyncFiles.filter(
11511
11727
  (file) => file instanceof RulesyncRule
11512
11728
  );
11729
+ const localRootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().localRoot);
11730
+ const nonLocalRootRules = rulesyncRules.filter((rule) => !rule.getFrontmatter().localRoot);
11513
11731
  const factory = this.getFactory(this.toolTarget);
11514
11732
  const { meta } = factory;
11515
- const toolRules = rulesyncRules.map((rulesyncRule) => {
11733
+ const toolRules = nonLocalRootRules.map((rulesyncRule) => {
11516
11734
  if (!factory.class.isTargetedByRulesyncRule(rulesyncRule)) {
11517
11735
  return null;
11518
11736
  }
@@ -11523,6 +11741,12 @@ var RulesProcessor = class extends FeatureProcessor {
11523
11741
  global: this.global
11524
11742
  });
11525
11743
  }).filter((rule) => rule !== null);
11744
+ if (localRootRules.length > 0 && !this.global) {
11745
+ const localRootRule = localRootRules[0];
11746
+ if (localRootRule && factory.class.isTargetedByRulesyncRule(localRootRule)) {
11747
+ this.handleLocalRootRule(toolRules, localRootRule, factory);
11748
+ }
11749
+ }
11526
11750
  const isSimulated = this.simulateCommands || this.simulateSubagents || this.simulateSkills;
11527
11751
  if (isSimulated && meta.createsSeparateConventionsRule && meta.additionalConventions) {
11528
11752
  const conventionsContent = this.generateAdditionalConventionsSectionFromMeta(meta);
@@ -11569,7 +11793,7 @@ var RulesProcessor = class extends FeatureProcessor {
11569
11793
  }).relativeDirPath;
11570
11794
  return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
11571
11795
  const frontmatter = skill.getFrontmatter();
11572
- const relativePath = (0, import_node_path96.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
11796
+ const relativePath = (0, import_node_path97.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
11573
11797
  return {
11574
11798
  name: frontmatter.name,
11575
11799
  description: frontmatter.description,
@@ -11577,6 +11801,50 @@ var RulesProcessor = class extends FeatureProcessor {
11577
11801
  };
11578
11802
  });
11579
11803
  }
11804
+ /**
11805
+ * Handle localRoot rule generation based on tool target.
11806
+ * - Claude Code: generates `.claude/CLAUDE.local.md`
11807
+ * - Claude Code Legacy: generates `./CLAUDE.local.md`
11808
+ * - Other tools: appends content to the root file with one blank line separator
11809
+ */
11810
+ handleLocalRootRule(toolRules, localRootRule, _factory) {
11811
+ const localRootBody = localRootRule.getBody();
11812
+ if (this.toolTarget === "claudecode") {
11813
+ const paths = ClaudecodeRule.getSettablePaths({ global: this.global });
11814
+ toolRules.push(
11815
+ new ClaudecodeRule({
11816
+ baseDir: this.baseDir,
11817
+ relativeDirPath: paths.root.relativeDirPath,
11818
+ relativeFilePath: "CLAUDE.local.md",
11819
+ frontmatter: {},
11820
+ body: localRootBody,
11821
+ validate: true,
11822
+ root: true
11823
+ // Treat as root so it doesn't have frontmatter
11824
+ })
11825
+ );
11826
+ } else if (this.toolTarget === "claudecode-legacy") {
11827
+ const paths = ClaudecodeLegacyRule.getSettablePaths({ global: this.global });
11828
+ toolRules.push(
11829
+ new ClaudecodeLegacyRule({
11830
+ baseDir: this.baseDir,
11831
+ relativeDirPath: paths.root.relativeDirPath,
11832
+ relativeFilePath: "CLAUDE.local.md",
11833
+ fileContent: localRootBody,
11834
+ validate: true,
11835
+ root: true
11836
+ // Treat as root so it doesn't have frontmatter
11837
+ })
11838
+ );
11839
+ } else {
11840
+ const rootRule = toolRules.find((rule) => rule.isRoot());
11841
+ if (rootRule) {
11842
+ const currentContent = rootRule.getFileContent();
11843
+ const newContent = currentContent + "\n\n" + localRootBody;
11844
+ rootRule.setFileContent(newContent);
11845
+ }
11846
+ }
11847
+ }
11580
11848
  /**
11581
11849
  * Generate reference section based on meta configuration.
11582
11850
  */
@@ -11636,15 +11904,27 @@ var RulesProcessor = class extends FeatureProcessor {
11636
11904
  * Load and parse rulesync rule files from .rulesync/rules/ directory
11637
11905
  */
11638
11906
  async loadRulesyncFiles() {
11639
- const files = await findFilesByGlobs((0, import_node_path96.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
11907
+ const files = await findFilesByGlobs((0, import_node_path97.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
11640
11908
  logger.debug(`Found ${files.length} rulesync files`);
11641
11909
  const rulesyncRules = await Promise.all(
11642
- files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path96.basename)(file) }))
11910
+ files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path97.basename)(file) }))
11643
11911
  );
11644
11912
  const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
11645
11913
  if (rootRules.length > 1) {
11646
11914
  throw new Error("Multiple root rulesync rules found");
11647
11915
  }
11916
+ if (rootRules.length === 0 && rulesyncRules.length > 0) {
11917
+ logger.warn(
11918
+ `No root rulesync rule file found. Consider adding 'root: true' to one of your rule files in ${RULESYNC_RULES_RELATIVE_DIR_PATH}.`
11919
+ );
11920
+ }
11921
+ const localRootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().localRoot);
11922
+ if (localRootRules.length > 1) {
11923
+ throw new Error("Multiple localRoot rules found. Only one rule can have localRoot: true");
11924
+ }
11925
+ if (localRootRules.length > 0 && rootRules.length === 0) {
11926
+ throw new Error("localRoot: true requires a root: true rule to exist");
11927
+ }
11648
11928
  if (this.global) {
11649
11929
  const nonRootRules = rulesyncRules.filter((rule) => !rule.getFrontmatter().root);
11650
11930
  if (nonRootRules.length > 0) {
@@ -11652,15 +11932,20 @@ var RulesProcessor = class extends FeatureProcessor {
11652
11932
  `${nonRootRules.length} non-root rulesync rules found, but it's in global mode, so ignoring them`
11653
11933
  );
11654
11934
  }
11935
+ if (localRootRules.length > 0) {
11936
+ logger.warn(
11937
+ `${localRootRules.length} localRoot rules found, but localRoot is not supported in global mode, ignoring them`
11938
+ );
11939
+ }
11655
11940
  return rootRules;
11656
11941
  }
11657
11942
  return rulesyncRules;
11658
11943
  }
11659
11944
  async loadRulesyncFilesLegacy() {
11660
- const legacyFiles = await findFilesByGlobs((0, import_node_path96.join)(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
11945
+ const legacyFiles = await findFilesByGlobs((0, import_node_path97.join)(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
11661
11946
  logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
11662
11947
  return Promise.all(
11663
- legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path96.basename)(file) }))
11948
+ legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path97.basename)(file) }))
11664
11949
  );
11665
11950
  }
11666
11951
  /**
@@ -11678,7 +11963,7 @@ var RulesProcessor = class extends FeatureProcessor {
11678
11963
  return [];
11679
11964
  }
11680
11965
  const rootFilePaths = await findFilesByGlobs(
11681
- (0, import_node_path96.join)(
11966
+ (0, import_node_path97.join)(
11682
11967
  this.baseDir,
11683
11968
  settablePaths.root.relativeDirPath ?? ".",
11684
11969
  settablePaths.root.relativeFilePath
@@ -11689,7 +11974,7 @@ var RulesProcessor = class extends FeatureProcessor {
11689
11974
  (filePath) => factory.class.forDeletion({
11690
11975
  baseDir: this.baseDir,
11691
11976
  relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
11692
- relativeFilePath: (0, import_node_path96.basename)(filePath),
11977
+ relativeFilePath: (0, import_node_path97.basename)(filePath),
11693
11978
  global: this.global
11694
11979
  })
11695
11980
  ).filter((rule) => rule.isDeletable());
@@ -11698,26 +11983,49 @@ var RulesProcessor = class extends FeatureProcessor {
11698
11983
  rootFilePaths.map(
11699
11984
  (filePath) => factory.class.fromFile({
11700
11985
  baseDir: this.baseDir,
11701
- relativeFilePath: (0, import_node_path96.basename)(filePath),
11986
+ relativeFilePath: (0, import_node_path97.basename)(filePath),
11702
11987
  global: this.global
11703
11988
  })
11704
11989
  )
11705
11990
  );
11706
11991
  })();
11707
11992
  logger.debug(`Found ${rootToolRules.length} root tool rule files`);
11993
+ const localRootToolRules = await (async () => {
11994
+ if (!forDeletion) {
11995
+ return [];
11996
+ }
11997
+ if (this.toolTarget !== "claudecode" && this.toolTarget !== "claudecode-legacy") {
11998
+ return [];
11999
+ }
12000
+ if (!settablePaths.root) {
12001
+ return [];
12002
+ }
12003
+ const localRootFilePaths = await findFilesByGlobs(
12004
+ (0, import_node_path97.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md")
12005
+ );
12006
+ return localRootFilePaths.map(
12007
+ (filePath) => factory.class.forDeletion({
12008
+ baseDir: this.baseDir,
12009
+ relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
12010
+ relativeFilePath: (0, import_node_path97.basename)(filePath),
12011
+ global: this.global
12012
+ })
12013
+ ).filter((rule) => rule.isDeletable());
12014
+ })();
12015
+ logger.debug(`Found ${localRootToolRules.length} local root tool rule files for deletion`);
11708
12016
  const nonRootToolRules = await (async () => {
11709
12017
  if (!settablePaths.nonRoot) {
11710
12018
  return [];
11711
12019
  }
11712
12020
  const nonRootFilePaths = await findFilesByGlobs(
11713
- (0, import_node_path96.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
12021
+ (0, import_node_path97.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
11714
12022
  );
11715
12023
  if (forDeletion) {
11716
12024
  return nonRootFilePaths.map(
11717
12025
  (filePath) => factory.class.forDeletion({
11718
12026
  baseDir: this.baseDir,
11719
12027
  relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
11720
- relativeFilePath: (0, import_node_path96.basename)(filePath),
12028
+ relativeFilePath: (0, import_node_path97.basename)(filePath),
11721
12029
  global: this.global
11722
12030
  })
11723
12031
  ).filter((rule) => rule.isDeletable());
@@ -11726,14 +12034,14 @@ var RulesProcessor = class extends FeatureProcessor {
11726
12034
  nonRootFilePaths.map(
11727
12035
  (filePath) => factory.class.fromFile({
11728
12036
  baseDir: this.baseDir,
11729
- relativeFilePath: (0, import_node_path96.basename)(filePath),
12037
+ relativeFilePath: (0, import_node_path97.basename)(filePath),
11730
12038
  global: this.global
11731
12039
  })
11732
12040
  )
11733
12041
  );
11734
12042
  })();
11735
12043
  logger.debug(`Found ${nonRootToolRules.length} non-root tool rule files`);
11736
- return [...rootToolRules, ...nonRootToolRules];
12044
+ return [...rootToolRules, ...localRootToolRules, ...nonRootToolRules];
11737
12045
  } catch (error) {
11738
12046
  logger.error(`Failed to load tool files: ${formatError(error)}`);
11739
12047
  return [];
@@ -11819,14 +12127,14 @@ s/<command> [arguments]
11819
12127
  This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
11820
12128
  The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
11821
12129
 
11822
- When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path96.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
12130
+ When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path97.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
11823
12131
  const subagentsSection = subagents ? `## Simulated Subagents
11824
12132
 
11825
12133
  Simulated subagents are specialized AI assistants that can be invoked to handle specific types of tasks. In this case, it can be appear something like custom slash commands simply. Simulated subagents can be called by custom slash commands.
11826
12134
 
11827
- When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path96.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
12135
+ When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path97.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
11828
12136
 
11829
- For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path96.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
12137
+ For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path97.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
11830
12138
  const skillsSection = skills ? this.generateSkillsSection(skills) : "";
11831
12139
  const result = [
11832
12140
  overview,
@@ -11853,48 +12161,34 @@ ${toonContent}`;
11853
12161
  }
11854
12162
  };
11855
12163
 
11856
- // src/cli/commands/generate.ts
11857
- async function generateCommand(options) {
11858
- const config = await ConfigResolver.resolve(options);
11859
- logger.setVerbose(config.getVerbose());
11860
- logger.info("Generating files...");
11861
- if (!await fileExists(RULESYNC_RELATIVE_DIR_PATH)) {
11862
- logger.error("\u274C .rulesync directory not found. Run 'rulesync init' first.");
11863
- process.exit(1);
11864
- }
11865
- logger.info(`Base directories: ${config.getBaseDirs().join(", ")}`);
11866
- const totalIgnoreOutputs = await generateIgnore(config);
11867
- const totalMcpOutputs = await generateMcp(config);
11868
- const totalCommandOutputs = await generateCommands(config);
11869
- const totalSubagentOutputs = await generateSubagents(config);
11870
- const skillsResult = await generateSkills(config);
11871
- const totalRulesOutputs = await generateRules(config, {
12164
+ // src/lib/generate.ts
12165
+ async function checkRulesyncDirExists(params) {
12166
+ return fileExists((0, import_node_path98.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
12167
+ }
12168
+ async function generate(params) {
12169
+ const { config } = params;
12170
+ const ignoreCount = await generateIgnoreCore({ config });
12171
+ const mcpCount = await generateMcpCore({ config });
12172
+ const commandsCount = await generateCommandsCore({ config });
12173
+ const subagentsCount = await generateSubagentsCore({ config });
12174
+ const skillsResult = await generateSkillsCore({ config });
12175
+ const rulesCount = await generateRulesCore({ config, skills: skillsResult.skills });
12176
+ return {
12177
+ rulesCount,
12178
+ ignoreCount,
12179
+ mcpCount,
12180
+ commandsCount,
12181
+ subagentsCount,
12182
+ skillsCount: skillsResult.count,
11872
12183
  skills: skillsResult.skills
11873
- });
11874
- const totalGenerated = totalRulesOutputs + totalMcpOutputs + totalCommandOutputs + totalIgnoreOutputs + totalSubagentOutputs + skillsResult.totalOutputs;
11875
- if (totalGenerated === 0) {
11876
- const enabledFeatures = config.getFeatures().join(", ");
11877
- logger.warn(`\u26A0\uFE0F No files generated for enabled features: ${enabledFeatures}`);
11878
- return;
11879
- }
11880
- if (totalGenerated > 0) {
11881
- const parts = [];
11882
- if (totalRulesOutputs > 0) parts.push(`${totalRulesOutputs} rules`);
11883
- if (totalIgnoreOutputs > 0) parts.push(`${totalIgnoreOutputs} ignore files`);
11884
- if (totalMcpOutputs > 0) parts.push(`${totalMcpOutputs} MCP files`);
11885
- if (totalCommandOutputs > 0) parts.push(`${totalCommandOutputs} commands`);
11886
- if (totalSubagentOutputs > 0) parts.push(`${totalSubagentOutputs} subagents`);
11887
- if (skillsResult.totalOutputs > 0) parts.push(`${skillsResult.totalOutputs} skills`);
11888
- logger.success(`\u{1F389} All done! Generated ${totalGenerated} file(s) total (${parts.join(" + ")})`);
11889
- }
12184
+ };
11890
12185
  }
11891
- async function generateRules(config, options) {
12186
+ async function generateRulesCore(params) {
12187
+ const { config, skills } = params;
11892
12188
  if (!config.getFeatures().includes("rules")) {
11893
- logger.debug("Skipping rule generation (not in --features)");
11894
12189
  return 0;
11895
12190
  }
11896
- let totalRulesOutputs = 0;
11897
- logger.info("Generating rule files...");
12191
+ let totalCount = 0;
11898
12192
  const toolTargets = (0, import_es_toolkit4.intersection)(
11899
12193
  config.getTargets(),
11900
12194
  RulesProcessor.getToolTargets({ global: config.getGlobal() })
@@ -11908,7 +12202,7 @@ async function generateRules(config, options) {
11908
12202
  simulateCommands: config.getSimulateCommands(),
11909
12203
  simulateSubagents: config.getSimulateSubagents(),
11910
12204
  simulateSkills: config.getSimulateSkills(),
11911
- skills: options?.skills
12205
+ skills
11912
12206
  });
11913
12207
  if (config.getDelete()) {
11914
12208
  const oldToolFiles = await processor.loadToolFiles({ forDeletion: true });
@@ -11917,23 +12211,20 @@ async function generateRules(config, options) {
11917
12211
  const rulesyncFiles = await processor.loadRulesyncFiles();
11918
12212
  const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
11919
12213
  const writtenCount = await processor.writeAiFiles(toolFiles);
11920
- totalRulesOutputs += writtenCount;
11921
- logger.success(`Generated ${writtenCount} ${toolTarget} rule(s) in ${baseDir}`);
12214
+ totalCount += writtenCount;
11922
12215
  }
11923
12216
  }
11924
- return totalRulesOutputs;
12217
+ return totalCount;
11925
12218
  }
11926
- async function generateIgnore(config) {
12219
+ async function generateIgnoreCore(params) {
12220
+ const { config } = params;
11927
12221
  if (!config.getFeatures().includes("ignore")) {
11928
- logger.debug("Skipping ignore file generation (not in --features)");
11929
12222
  return 0;
11930
12223
  }
11931
12224
  if (config.getGlobal()) {
11932
- logger.debug("Skipping ignore file generation (not supported in global mode)");
11933
12225
  return 0;
11934
12226
  }
11935
- let totalIgnoreOutputs = 0;
11936
- logger.info("Generating ignore files...");
12227
+ let totalCount = 0;
11937
12228
  for (const toolTarget of (0, import_es_toolkit4.intersection)(config.getTargets(), IgnoreProcessor.getToolTargets())) {
11938
12229
  for (const baseDir of config.getBaseDirs()) {
11939
12230
  try {
@@ -11949,30 +12240,24 @@ async function generateIgnore(config) {
11949
12240
  if (rulesyncFiles.length > 0) {
11950
12241
  const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
11951
12242
  const writtenCount = await processor.writeAiFiles(toolFiles);
11952
- totalIgnoreOutputs += writtenCount;
11953
- logger.success(`Generated ${writtenCount} ${toolTarget} ignore file(s) in ${baseDir}`);
12243
+ totalCount += writtenCount;
11954
12244
  }
11955
12245
  } catch (error) {
11956
12246
  logger.warn(
11957
- `Failed to generate ${toolTarget} ignore files for ${baseDir}:`,
11958
- error instanceof Error ? error.message : String(error)
12247
+ `Failed to generate ${toolTarget} ignore files for ${baseDir}: ${formatError(error)}`
11959
12248
  );
11960
12249
  continue;
11961
12250
  }
11962
12251
  }
11963
12252
  }
11964
- return totalIgnoreOutputs;
12253
+ return totalCount;
11965
12254
  }
11966
- async function generateMcp(config) {
12255
+ async function generateMcpCore(params) {
12256
+ const { config } = params;
11967
12257
  if (!config.getFeatures().includes("mcp")) {
11968
- logger.debug("Skipping MCP configuration generation (not in --features)");
11969
12258
  return 0;
11970
12259
  }
11971
- let totalMcpOutputs = 0;
11972
- logger.info("Generating MCP files...");
11973
- if (config.getModularMcp()) {
11974
- logger.info("\u2139\uFE0F Modular MCP support is experimental.");
11975
- }
12260
+ let totalCount = 0;
11976
12261
  const toolTargets = (0, import_es_toolkit4.intersection)(
11977
12262
  config.getTargets(),
11978
12263
  McpProcessor.getToolTargets({ global: config.getGlobal() })
@@ -11992,19 +12277,17 @@ async function generateMcp(config) {
11992
12277
  const rulesyncFiles = await processor.loadRulesyncFiles();
11993
12278
  const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
11994
12279
  const writtenCount = await processor.writeAiFiles(toolFiles);
11995
- totalMcpOutputs += writtenCount;
11996
- logger.success(`Generated ${writtenCount} ${toolTarget} MCP configuration(s) in ${baseDir}`);
12280
+ totalCount += writtenCount;
11997
12281
  }
11998
12282
  }
11999
- return totalMcpOutputs;
12283
+ return totalCount;
12000
12284
  }
12001
- async function generateCommands(config) {
12285
+ async function generateCommandsCore(params) {
12286
+ const { config } = params;
12002
12287
  if (!config.getFeatures().includes("commands")) {
12003
- logger.debug("Skipping command file generation (not in --features)");
12004
12288
  return 0;
12005
12289
  }
12006
- let totalCommandOutputs = 0;
12007
- logger.info("Generating command files...");
12290
+ let totalCount = 0;
12008
12291
  const toolTargets = (0, import_es_toolkit4.intersection)(
12009
12292
  config.getTargets(),
12010
12293
  CommandsProcessor.getToolTargets({
@@ -12026,19 +12309,17 @@ async function generateCommands(config) {
12026
12309
  const rulesyncFiles = await processor.loadRulesyncFiles();
12027
12310
  const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
12028
12311
  const writtenCount = await processor.writeAiFiles(toolFiles);
12029
- totalCommandOutputs += writtenCount;
12030
- logger.success(`Generated ${writtenCount} ${toolTarget} command(s) in ${baseDir}`);
12312
+ totalCount += writtenCount;
12031
12313
  }
12032
12314
  }
12033
- return totalCommandOutputs;
12315
+ return totalCount;
12034
12316
  }
12035
- async function generateSubagents(config) {
12317
+ async function generateSubagentsCore(params) {
12318
+ const { config } = params;
12036
12319
  if (!config.getFeatures().includes("subagents")) {
12037
- logger.debug("Skipping subagent file generation (not in --features)");
12038
12320
  return 0;
12039
12321
  }
12040
- let totalSubagentOutputs = 0;
12041
- logger.info("Generating subagent files...");
12322
+ let totalCount = 0;
12042
12323
  const toolTargets = (0, import_es_toolkit4.intersection)(
12043
12324
  config.getTargets(),
12044
12325
  SubagentsProcessor.getToolTargets({
@@ -12060,20 +12341,18 @@ async function generateSubagents(config) {
12060
12341
  const rulesyncFiles = await processor.loadRulesyncFiles();
12061
12342
  const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
12062
12343
  const writtenCount = await processor.writeAiFiles(toolFiles);
12063
- totalSubagentOutputs += writtenCount;
12064
- logger.success(`Generated ${writtenCount} ${toolTarget} subagent(s) in ${baseDir}`);
12344
+ totalCount += writtenCount;
12065
12345
  }
12066
12346
  }
12067
- return totalSubagentOutputs;
12347
+ return totalCount;
12068
12348
  }
12069
- async function generateSkills(config) {
12349
+ async function generateSkillsCore(params) {
12350
+ const { config } = params;
12070
12351
  if (!config.getFeatures().includes("skills")) {
12071
- logger.debug("Skipping skill generation (not in --features)");
12072
- return { totalOutputs: 0, skills: [] };
12352
+ return { count: 0, skills: [] };
12073
12353
  }
12074
- let totalSkillOutputs = 0;
12354
+ let totalCount = 0;
12075
12355
  const allSkills = [];
12076
- logger.info("Generating skill files...");
12077
12356
  const toolTargets = (0, import_es_toolkit4.intersection)(
12078
12357
  config.getTargets(),
12079
12358
  SkillsProcessor.getToolTargets({
@@ -12100,15 +12379,84 @@ async function generateSkills(config) {
12100
12379
  }
12101
12380
  const toolDirs = await processor.convertRulesyncDirsToToolDirs(rulesyncDirs);
12102
12381
  const writtenCount = await processor.writeAiDirs(toolDirs);
12103
- totalSkillOutputs += writtenCount;
12104
- logger.success(`Generated ${writtenCount} ${toolTarget} skill(s) in ${baseDir}`);
12382
+ totalCount += writtenCount;
12105
12383
  }
12106
12384
  }
12107
- return { totalOutputs: totalSkillOutputs, skills: allSkills };
12385
+ return { count: totalCount, skills: allSkills };
12386
+ }
12387
+
12388
+ // src/cli/commands/generate.ts
12389
+ async function generateCommand(options) {
12390
+ const config = await ConfigResolver.resolve(options);
12391
+ logger.configure({
12392
+ verbose: config.getVerbose(),
12393
+ silent: config.getSilent()
12394
+ });
12395
+ logger.info("Generating files...");
12396
+ if (!await checkRulesyncDirExists({ baseDir: config.getBaseDirs()[0] ?? process.cwd() })) {
12397
+ logger.error("\u274C .rulesync directory not found. Run 'rulesync init' first.");
12398
+ process.exit(1);
12399
+ }
12400
+ logger.info(`Base directories: ${config.getBaseDirs().join(", ")}`);
12401
+ const features = config.getFeatures();
12402
+ if (features.includes("ignore")) {
12403
+ logger.info("Generating ignore files...");
12404
+ }
12405
+ if (features.includes("mcp")) {
12406
+ logger.info("Generating MCP files...");
12407
+ if (config.getModularMcp()) {
12408
+ logger.info("\u2139\uFE0F Modular MCP support is experimental.");
12409
+ }
12410
+ }
12411
+ if (features.includes("commands")) {
12412
+ logger.info("Generating command files...");
12413
+ }
12414
+ if (features.includes("subagents")) {
12415
+ logger.info("Generating subagent files...");
12416
+ }
12417
+ if (features.includes("skills")) {
12418
+ logger.info("Generating skill files...");
12419
+ }
12420
+ if (features.includes("rules")) {
12421
+ logger.info("Generating rule files...");
12422
+ }
12423
+ const result = await generate({ config });
12424
+ if (result.ignoreCount > 0) {
12425
+ logger.success(`Generated ${result.ignoreCount} ignore file(s)`);
12426
+ }
12427
+ if (result.mcpCount > 0) {
12428
+ logger.success(`Generated ${result.mcpCount} MCP configuration(s)`);
12429
+ }
12430
+ if (result.commandsCount > 0) {
12431
+ logger.success(`Generated ${result.commandsCount} command(s)`);
12432
+ }
12433
+ if (result.subagentsCount > 0) {
12434
+ logger.success(`Generated ${result.subagentsCount} subagent(s)`);
12435
+ }
12436
+ if (result.skillsCount > 0) {
12437
+ logger.success(`Generated ${result.skillsCount} skill(s)`);
12438
+ }
12439
+ if (result.rulesCount > 0) {
12440
+ logger.success(`Generated ${result.rulesCount} rule(s)`);
12441
+ }
12442
+ const totalGenerated = result.rulesCount + result.ignoreCount + result.mcpCount + result.commandsCount + result.subagentsCount + result.skillsCount;
12443
+ if (totalGenerated === 0) {
12444
+ const enabledFeatures = features.join(", ");
12445
+ logger.warn(`\u26A0\uFE0F No files generated for enabled features: ${enabledFeatures}`);
12446
+ return;
12447
+ }
12448
+ const parts = [];
12449
+ if (result.rulesCount > 0) parts.push(`${result.rulesCount} rules`);
12450
+ if (result.ignoreCount > 0) parts.push(`${result.ignoreCount} ignore files`);
12451
+ if (result.mcpCount > 0) parts.push(`${result.mcpCount} MCP files`);
12452
+ if (result.commandsCount > 0) parts.push(`${result.commandsCount} commands`);
12453
+ if (result.subagentsCount > 0) parts.push(`${result.subagentsCount} subagents`);
12454
+ if (result.skillsCount > 0) parts.push(`${result.skillsCount} skills`);
12455
+ logger.success(`\u{1F389} All done! Generated ${totalGenerated} file(s) total (${parts.join(" + ")})`);
12108
12456
  }
12109
12457
 
12110
12458
  // src/cli/commands/gitignore.ts
12111
- var import_node_path97 = require("path");
12459
+ var import_node_path99 = require("path");
12112
12460
  var RULESYNC_HEADER = "# Generated by Rulesync";
12113
12461
  var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
12114
12462
  var RULESYNC_IGNORE_ENTRIES = [
@@ -12125,7 +12473,9 @@ var RULESYNC_IGNORE_ENTRIES = [
12125
12473
  "**/.augment-guidelines",
12126
12474
  // Claude Code
12127
12475
  "**/CLAUDE.md",
12476
+ "**/CLAUDE.local.md",
12128
12477
  "**/.claude/CLAUDE.md",
12478
+ "**/.claude/CLAUDE.local.md",
12129
12479
  "**/.claude/memories/",
12130
12480
  "**/.claude/rules/",
12131
12481
  "**/.claude/commands/",
@@ -12172,6 +12522,7 @@ var RULESYNC_IGNORE_ENTRIES = [
12172
12522
  // Kiro
12173
12523
  "**/.kiro/steering/",
12174
12524
  "**/.kiro/prompts/",
12525
+ "**/.kiro/skills/",
12175
12526
  "**/.kiro/agents/",
12176
12527
  "**/.kiro/settings/mcp.json",
12177
12528
  "**/.aiignore",
@@ -12248,7 +12599,7 @@ var removeExistingRulesyncEntries = (content) => {
12248
12599
  return result;
12249
12600
  };
12250
12601
  var gitignoreCommand = async () => {
12251
- const gitignorePath = (0, import_node_path97.join)(process.cwd(), ".gitignore");
12602
+ const gitignorePath = (0, import_node_path99.join)(process.cwd(), ".gitignore");
12252
12603
  let gitignoreContent = "";
12253
12604
  if (await fileExists(gitignorePath)) {
12254
12605
  gitignoreContent = await readFileContent(gitignorePath);
@@ -12282,7 +12633,10 @@ async function importCommand(options) {
12282
12633
  process.exit(1);
12283
12634
  }
12284
12635
  const config = await ConfigResolver.resolve(options);
12285
- logger.setVerbose(config.getVerbose());
12636
+ logger.configure({
12637
+ verbose: config.getVerbose(),
12638
+ silent: config.getSilent()
12639
+ });
12286
12640
  const tool = config.getTargets()[0];
12287
12641
  await importRules(config, tool);
12288
12642
  await importIgnore(config, tool);
@@ -12447,7 +12801,7 @@ async function importSkills(config, tool) {
12447
12801
  }
12448
12802
 
12449
12803
  // src/cli/commands/init.ts
12450
- var import_node_path98 = require("path");
12804
+ var import_node_path100 = require("path");
12451
12805
  async function initCommand() {
12452
12806
  logger.info("Initializing rulesync...");
12453
12807
  await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
@@ -12625,14 +12979,14 @@ Keep the summary concise and ready to reuse in future tasks.`
12625
12979
  await ensureDir(subagentPaths.relativeDirPath);
12626
12980
  await ensureDir(skillPaths.relativeDirPath);
12627
12981
  await ensureDir(ignorePaths.recommended.relativeDirPath);
12628
- const ruleFilepath = (0, import_node_path98.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
12982
+ const ruleFilepath = (0, import_node_path100.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
12629
12983
  if (!await fileExists(ruleFilepath)) {
12630
12984
  await writeFileContent(ruleFilepath, sampleRuleFile.content);
12631
12985
  logger.success(`Created ${ruleFilepath}`);
12632
12986
  } else {
12633
12987
  logger.info(`Skipped ${ruleFilepath} (already exists)`);
12634
12988
  }
12635
- const mcpFilepath = (0, import_node_path98.join)(
12989
+ const mcpFilepath = (0, import_node_path100.join)(
12636
12990
  mcpPaths.recommended.relativeDirPath,
12637
12991
  mcpPaths.recommended.relativeFilePath
12638
12992
  );
@@ -12642,30 +12996,30 @@ Keep the summary concise and ready to reuse in future tasks.`
12642
12996
  } else {
12643
12997
  logger.info(`Skipped ${mcpFilepath} (already exists)`);
12644
12998
  }
12645
- const commandFilepath = (0, import_node_path98.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
12999
+ const commandFilepath = (0, import_node_path100.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
12646
13000
  if (!await fileExists(commandFilepath)) {
12647
13001
  await writeFileContent(commandFilepath, sampleCommandFile.content);
12648
13002
  logger.success(`Created ${commandFilepath}`);
12649
13003
  } else {
12650
13004
  logger.info(`Skipped ${commandFilepath} (already exists)`);
12651
13005
  }
12652
- const subagentFilepath = (0, import_node_path98.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
13006
+ const subagentFilepath = (0, import_node_path100.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
12653
13007
  if (!await fileExists(subagentFilepath)) {
12654
13008
  await writeFileContent(subagentFilepath, sampleSubagentFile.content);
12655
13009
  logger.success(`Created ${subagentFilepath}`);
12656
13010
  } else {
12657
13011
  logger.info(`Skipped ${subagentFilepath} (already exists)`);
12658
13012
  }
12659
- const skillDirPath = (0, import_node_path98.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
13013
+ const skillDirPath = (0, import_node_path100.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
12660
13014
  await ensureDir(skillDirPath);
12661
- const skillFilepath = (0, import_node_path98.join)(skillDirPath, SKILL_FILE_NAME);
13015
+ const skillFilepath = (0, import_node_path100.join)(skillDirPath, SKILL_FILE_NAME);
12662
13016
  if (!await fileExists(skillFilepath)) {
12663
13017
  await writeFileContent(skillFilepath, sampleSkillFile.content);
12664
13018
  logger.success(`Created ${skillFilepath}`);
12665
13019
  } else {
12666
13020
  logger.info(`Skipped ${skillFilepath} (already exists)`);
12667
13021
  }
12668
- const ignoreFilepath = (0, import_node_path98.join)(
13022
+ const ignoreFilepath = (0, import_node_path100.join)(
12669
13023
  ignorePaths.recommended.relativeDirPath,
12670
13024
  ignorePaths.recommended.relativeFilePath
12671
13025
  );
@@ -12681,15 +13035,15 @@ Keep the summary concise and ready to reuse in future tasks.`
12681
13035
  var import_fastmcp = require("fastmcp");
12682
13036
 
12683
13037
  // src/mcp/tools.ts
12684
- var import_mini50 = require("zod/mini");
13038
+ var import_mini51 = require("zod/mini");
12685
13039
 
12686
13040
  // src/mcp/commands.ts
12687
- var import_node_path99 = require("path");
12688
- var import_mini44 = require("zod/mini");
13041
+ var import_node_path101 = require("path");
13042
+ var import_mini45 = require("zod/mini");
12689
13043
  var maxCommandSizeBytes = 1024 * 1024;
12690
13044
  var maxCommandsCount = 1e3;
12691
13045
  async function listCommands() {
12692
- const commandsDir = (0, import_node_path99.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
13046
+ const commandsDir = (0, import_node_path101.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
12693
13047
  try {
12694
13048
  const files = await listDirectoryFiles(commandsDir);
12695
13049
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -12701,7 +13055,7 @@ async function listCommands() {
12701
13055
  });
12702
13056
  const frontmatter = command.getFrontmatter();
12703
13057
  return {
12704
- relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
13058
+ relativePathFromCwd: (0, import_node_path101.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
12705
13059
  frontmatter
12706
13060
  };
12707
13061
  } catch (error) {
@@ -12721,13 +13075,13 @@ async function getCommand({ relativePathFromCwd }) {
12721
13075
  relativePath: relativePathFromCwd,
12722
13076
  intendedRootDir: process.cwd()
12723
13077
  });
12724
- const filename = (0, import_node_path99.basename)(relativePathFromCwd);
13078
+ const filename = (0, import_node_path101.basename)(relativePathFromCwd);
12725
13079
  try {
12726
13080
  const command = await RulesyncCommand.fromFile({
12727
13081
  relativeFilePath: filename
12728
13082
  });
12729
13083
  return {
12730
- relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
13084
+ relativePathFromCwd: (0, import_node_path101.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
12731
13085
  frontmatter: command.getFrontmatter(),
12732
13086
  body: command.getBody()
12733
13087
  };
@@ -12746,7 +13100,7 @@ async function putCommand({
12746
13100
  relativePath: relativePathFromCwd,
12747
13101
  intendedRootDir: process.cwd()
12748
13102
  });
12749
- const filename = (0, import_node_path99.basename)(relativePathFromCwd);
13103
+ const filename = (0, import_node_path101.basename)(relativePathFromCwd);
12750
13104
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
12751
13105
  if (estimatedSize > maxCommandSizeBytes) {
12752
13106
  throw new Error(
@@ -12756,7 +13110,7 @@ async function putCommand({
12756
13110
  try {
12757
13111
  const existingCommands = await listCommands();
12758
13112
  const isUpdate = existingCommands.some(
12759
- (command2) => command2.relativePathFromCwd === (0, import_node_path99.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
13113
+ (command2) => command2.relativePathFromCwd === (0, import_node_path101.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
12760
13114
  );
12761
13115
  if (!isUpdate && existingCommands.length >= maxCommandsCount) {
12762
13116
  throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
@@ -12771,11 +13125,11 @@ async function putCommand({
12771
13125
  fileContent,
12772
13126
  validate: true
12773
13127
  });
12774
- const commandsDir = (0, import_node_path99.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
13128
+ const commandsDir = (0, import_node_path101.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
12775
13129
  await ensureDir(commandsDir);
12776
13130
  await writeFileContent(command.getFilePath(), command.getFileContent());
12777
13131
  return {
12778
- relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
13132
+ relativePathFromCwd: (0, import_node_path101.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
12779
13133
  frontmatter: command.getFrontmatter(),
12780
13134
  body: command.getBody()
12781
13135
  };
@@ -12790,12 +13144,12 @@ async function deleteCommand({ relativePathFromCwd }) {
12790
13144
  relativePath: relativePathFromCwd,
12791
13145
  intendedRootDir: process.cwd()
12792
13146
  });
12793
- const filename = (0, import_node_path99.basename)(relativePathFromCwd);
12794
- const fullPath = (0, import_node_path99.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
13147
+ const filename = (0, import_node_path101.basename)(relativePathFromCwd);
13148
+ const fullPath = (0, import_node_path101.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
12795
13149
  try {
12796
13150
  await removeFile(fullPath);
12797
13151
  return {
12798
- relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
13152
+ relativePathFromCwd: (0, import_node_path101.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
12799
13153
  };
12800
13154
  } catch (error) {
12801
13155
  throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
@@ -12804,23 +13158,23 @@ async function deleteCommand({ relativePathFromCwd }) {
12804
13158
  }
12805
13159
  }
12806
13160
  var commandToolSchemas = {
12807
- listCommands: import_mini44.z.object({}),
12808
- getCommand: import_mini44.z.object({
12809
- relativePathFromCwd: import_mini44.z.string()
13161
+ listCommands: import_mini45.z.object({}),
13162
+ getCommand: import_mini45.z.object({
13163
+ relativePathFromCwd: import_mini45.z.string()
12810
13164
  }),
12811
- putCommand: import_mini44.z.object({
12812
- relativePathFromCwd: import_mini44.z.string(),
13165
+ putCommand: import_mini45.z.object({
13166
+ relativePathFromCwd: import_mini45.z.string(),
12813
13167
  frontmatter: RulesyncCommandFrontmatterSchema,
12814
- body: import_mini44.z.string()
13168
+ body: import_mini45.z.string()
12815
13169
  }),
12816
- deleteCommand: import_mini44.z.object({
12817
- relativePathFromCwd: import_mini44.z.string()
13170
+ deleteCommand: import_mini45.z.object({
13171
+ relativePathFromCwd: import_mini45.z.string()
12818
13172
  })
12819
13173
  };
12820
13174
  var commandTools = {
12821
13175
  listCommands: {
12822
13176
  name: "listCommands",
12823
- description: `List all commands from ${(0, import_node_path99.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
13177
+ description: `List all commands from ${(0, import_node_path101.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
12824
13178
  parameters: commandToolSchemas.listCommands,
12825
13179
  execute: async () => {
12826
13180
  const commands = await listCommands();
@@ -12862,11 +13216,11 @@ var commandTools = {
12862
13216
  };
12863
13217
 
12864
13218
  // src/mcp/ignore.ts
12865
- var import_node_path100 = require("path");
12866
- var import_mini45 = require("zod/mini");
13219
+ var import_node_path102 = require("path");
13220
+ var import_mini46 = require("zod/mini");
12867
13221
  var maxIgnoreFileSizeBytes = 100 * 1024;
12868
13222
  async function getIgnoreFile() {
12869
- const ignoreFilePath = (0, import_node_path100.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
13223
+ const ignoreFilePath = (0, import_node_path102.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
12870
13224
  try {
12871
13225
  const content = await readFileContent(ignoreFilePath);
12872
13226
  return {
@@ -12880,7 +13234,7 @@ async function getIgnoreFile() {
12880
13234
  }
12881
13235
  }
12882
13236
  async function putIgnoreFile({ content }) {
12883
- const ignoreFilePath = (0, import_node_path100.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
13237
+ const ignoreFilePath = (0, import_node_path102.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
12884
13238
  const contentSizeBytes = Buffer.byteLength(content, "utf8");
12885
13239
  if (contentSizeBytes > maxIgnoreFileSizeBytes) {
12886
13240
  throw new Error(
@@ -12901,8 +13255,8 @@ async function putIgnoreFile({ content }) {
12901
13255
  }
12902
13256
  }
12903
13257
  async function deleteIgnoreFile() {
12904
- const aiignorePath = (0, import_node_path100.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
12905
- const legacyIgnorePath = (0, import_node_path100.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
13258
+ const aiignorePath = (0, import_node_path102.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
13259
+ const legacyIgnorePath = (0, import_node_path102.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
12906
13260
  try {
12907
13261
  await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
12908
13262
  return {
@@ -12920,11 +13274,11 @@ async function deleteIgnoreFile() {
12920
13274
  }
12921
13275
  }
12922
13276
  var ignoreToolSchemas = {
12923
- getIgnoreFile: import_mini45.z.object({}),
12924
- putIgnoreFile: import_mini45.z.object({
12925
- content: import_mini45.z.string()
13277
+ getIgnoreFile: import_mini46.z.object({}),
13278
+ putIgnoreFile: import_mini46.z.object({
13279
+ content: import_mini46.z.string()
12926
13280
  }),
12927
- deleteIgnoreFile: import_mini45.z.object({})
13281
+ deleteIgnoreFile: import_mini46.z.object({})
12928
13282
  };
12929
13283
  var ignoreTools = {
12930
13284
  getIgnoreFile: {
@@ -12957,8 +13311,8 @@ var ignoreTools = {
12957
13311
  };
12958
13312
 
12959
13313
  // src/mcp/mcp.ts
12960
- var import_node_path101 = require("path");
12961
- var import_mini46 = require("zod/mini");
13314
+ var import_node_path103 = require("path");
13315
+ var import_mini47 = require("zod/mini");
12962
13316
  var maxMcpSizeBytes = 1024 * 1024;
12963
13317
  async function getMcpFile() {
12964
13318
  const config = await ConfigResolver.resolve({});
@@ -12967,7 +13321,7 @@ async function getMcpFile() {
12967
13321
  validate: true,
12968
13322
  modularMcp: config.getModularMcp()
12969
13323
  });
12970
- const relativePathFromCwd = (0, import_node_path101.join)(
13324
+ const relativePathFromCwd = (0, import_node_path103.join)(
12971
13325
  rulesyncMcp.getRelativeDirPath(),
12972
13326
  rulesyncMcp.getRelativeFilePath()
12973
13327
  );
@@ -13000,7 +13354,7 @@ async function putMcpFile({ content }) {
13000
13354
  const paths = RulesyncMcp.getSettablePaths();
13001
13355
  const relativeDirPath = paths.recommended.relativeDirPath;
13002
13356
  const relativeFilePath = paths.recommended.relativeFilePath;
13003
- const fullPath = (0, import_node_path101.join)(baseDir, relativeDirPath, relativeFilePath);
13357
+ const fullPath = (0, import_node_path103.join)(baseDir, relativeDirPath, relativeFilePath);
13004
13358
  const rulesyncMcp = new RulesyncMcp({
13005
13359
  baseDir,
13006
13360
  relativeDirPath,
@@ -13009,9 +13363,9 @@ async function putMcpFile({ content }) {
13009
13363
  validate: true,
13010
13364
  modularMcp: config.getModularMcp()
13011
13365
  });
13012
- await ensureDir((0, import_node_path101.join)(baseDir, relativeDirPath));
13366
+ await ensureDir((0, import_node_path103.join)(baseDir, relativeDirPath));
13013
13367
  await writeFileContent(fullPath, content);
13014
- const relativePathFromCwd = (0, import_node_path101.join)(relativeDirPath, relativeFilePath);
13368
+ const relativePathFromCwd = (0, import_node_path103.join)(relativeDirPath, relativeFilePath);
13015
13369
  return {
13016
13370
  relativePathFromCwd,
13017
13371
  content: rulesyncMcp.getFileContent()
@@ -13026,15 +13380,15 @@ async function deleteMcpFile() {
13026
13380
  try {
13027
13381
  const baseDir = process.cwd();
13028
13382
  const paths = RulesyncMcp.getSettablePaths();
13029
- const recommendedPath = (0, import_node_path101.join)(
13383
+ const recommendedPath = (0, import_node_path103.join)(
13030
13384
  baseDir,
13031
13385
  paths.recommended.relativeDirPath,
13032
13386
  paths.recommended.relativeFilePath
13033
13387
  );
13034
- const legacyPath = (0, import_node_path101.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
13388
+ const legacyPath = (0, import_node_path103.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
13035
13389
  await removeFile(recommendedPath);
13036
13390
  await removeFile(legacyPath);
13037
- const relativePathFromCwd = (0, import_node_path101.join)(
13391
+ const relativePathFromCwd = (0, import_node_path103.join)(
13038
13392
  paths.recommended.relativeDirPath,
13039
13393
  paths.recommended.relativeFilePath
13040
13394
  );
@@ -13048,11 +13402,11 @@ async function deleteMcpFile() {
13048
13402
  }
13049
13403
  }
13050
13404
  var mcpToolSchemas = {
13051
- getMcpFile: import_mini46.z.object({}),
13052
- putMcpFile: import_mini46.z.object({
13053
- content: import_mini46.z.string()
13405
+ getMcpFile: import_mini47.z.object({}),
13406
+ putMcpFile: import_mini47.z.object({
13407
+ content: import_mini47.z.string()
13054
13408
  }),
13055
- deleteMcpFile: import_mini46.z.object({})
13409
+ deleteMcpFile: import_mini47.z.object({})
13056
13410
  };
13057
13411
  var mcpTools = {
13058
13412
  getMcpFile: {
@@ -13085,12 +13439,12 @@ var mcpTools = {
13085
13439
  };
13086
13440
 
13087
13441
  // src/mcp/rules.ts
13088
- var import_node_path102 = require("path");
13089
- var import_mini47 = require("zod/mini");
13442
+ var import_node_path104 = require("path");
13443
+ var import_mini48 = require("zod/mini");
13090
13444
  var maxRuleSizeBytes = 1024 * 1024;
13091
13445
  var maxRulesCount = 1e3;
13092
13446
  async function listRules() {
13093
- const rulesDir = (0, import_node_path102.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
13447
+ const rulesDir = (0, import_node_path104.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
13094
13448
  try {
13095
13449
  const files = await listDirectoryFiles(rulesDir);
13096
13450
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -13103,7 +13457,7 @@ async function listRules() {
13103
13457
  });
13104
13458
  const frontmatter = rule.getFrontmatter();
13105
13459
  return {
13106
- relativePathFromCwd: (0, import_node_path102.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
13460
+ relativePathFromCwd: (0, import_node_path104.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
13107
13461
  frontmatter
13108
13462
  };
13109
13463
  } catch (error) {
@@ -13123,14 +13477,14 @@ async function getRule({ relativePathFromCwd }) {
13123
13477
  relativePath: relativePathFromCwd,
13124
13478
  intendedRootDir: process.cwd()
13125
13479
  });
13126
- const filename = (0, import_node_path102.basename)(relativePathFromCwd);
13480
+ const filename = (0, import_node_path104.basename)(relativePathFromCwd);
13127
13481
  try {
13128
13482
  const rule = await RulesyncRule.fromFile({
13129
13483
  relativeFilePath: filename,
13130
13484
  validate: true
13131
13485
  });
13132
13486
  return {
13133
- relativePathFromCwd: (0, import_node_path102.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
13487
+ relativePathFromCwd: (0, import_node_path104.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
13134
13488
  frontmatter: rule.getFrontmatter(),
13135
13489
  body: rule.getBody()
13136
13490
  };
@@ -13149,7 +13503,7 @@ async function putRule({
13149
13503
  relativePath: relativePathFromCwd,
13150
13504
  intendedRootDir: process.cwd()
13151
13505
  });
13152
- const filename = (0, import_node_path102.basename)(relativePathFromCwd);
13506
+ const filename = (0, import_node_path104.basename)(relativePathFromCwd);
13153
13507
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
13154
13508
  if (estimatedSize > maxRuleSizeBytes) {
13155
13509
  throw new Error(
@@ -13159,7 +13513,7 @@ async function putRule({
13159
13513
  try {
13160
13514
  const existingRules = await listRules();
13161
13515
  const isUpdate = existingRules.some(
13162
- (rule2) => rule2.relativePathFromCwd === (0, import_node_path102.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
13516
+ (rule2) => rule2.relativePathFromCwd === (0, import_node_path104.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
13163
13517
  );
13164
13518
  if (!isUpdate && existingRules.length >= maxRulesCount) {
13165
13519
  throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
@@ -13172,11 +13526,11 @@ async function putRule({
13172
13526
  body,
13173
13527
  validate: true
13174
13528
  });
13175
- const rulesDir = (0, import_node_path102.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
13529
+ const rulesDir = (0, import_node_path104.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
13176
13530
  await ensureDir(rulesDir);
13177
13531
  await writeFileContent(rule.getFilePath(), rule.getFileContent());
13178
13532
  return {
13179
- relativePathFromCwd: (0, import_node_path102.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
13533
+ relativePathFromCwd: (0, import_node_path104.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
13180
13534
  frontmatter: rule.getFrontmatter(),
13181
13535
  body: rule.getBody()
13182
13536
  };
@@ -13191,12 +13545,12 @@ async function deleteRule({ relativePathFromCwd }) {
13191
13545
  relativePath: relativePathFromCwd,
13192
13546
  intendedRootDir: process.cwd()
13193
13547
  });
13194
- const filename = (0, import_node_path102.basename)(relativePathFromCwd);
13195
- const fullPath = (0, import_node_path102.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
13548
+ const filename = (0, import_node_path104.basename)(relativePathFromCwd);
13549
+ const fullPath = (0, import_node_path104.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
13196
13550
  try {
13197
13551
  await removeFile(fullPath);
13198
13552
  return {
13199
- relativePathFromCwd: (0, import_node_path102.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
13553
+ relativePathFromCwd: (0, import_node_path104.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
13200
13554
  };
13201
13555
  } catch (error) {
13202
13556
  throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
@@ -13205,23 +13559,23 @@ async function deleteRule({ relativePathFromCwd }) {
13205
13559
  }
13206
13560
  }
13207
13561
  var ruleToolSchemas = {
13208
- listRules: import_mini47.z.object({}),
13209
- getRule: import_mini47.z.object({
13210
- relativePathFromCwd: import_mini47.z.string()
13562
+ listRules: import_mini48.z.object({}),
13563
+ getRule: import_mini48.z.object({
13564
+ relativePathFromCwd: import_mini48.z.string()
13211
13565
  }),
13212
- putRule: import_mini47.z.object({
13213
- relativePathFromCwd: import_mini47.z.string(),
13566
+ putRule: import_mini48.z.object({
13567
+ relativePathFromCwd: import_mini48.z.string(),
13214
13568
  frontmatter: RulesyncRuleFrontmatterSchema,
13215
- body: import_mini47.z.string()
13569
+ body: import_mini48.z.string()
13216
13570
  }),
13217
- deleteRule: import_mini47.z.object({
13218
- relativePathFromCwd: import_mini47.z.string()
13571
+ deleteRule: import_mini48.z.object({
13572
+ relativePathFromCwd: import_mini48.z.string()
13219
13573
  })
13220
13574
  };
13221
13575
  var ruleTools = {
13222
13576
  listRules: {
13223
13577
  name: "listRules",
13224
- description: `List all rules from ${(0, import_node_path102.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
13578
+ description: `List all rules from ${(0, import_node_path104.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
13225
13579
  parameters: ruleToolSchemas.listRules,
13226
13580
  execute: async () => {
13227
13581
  const rules = await listRules();
@@ -13263,8 +13617,8 @@ var ruleTools = {
13263
13617
  };
13264
13618
 
13265
13619
  // src/mcp/skills.ts
13266
- var import_node_path103 = require("path");
13267
- var import_mini48 = require("zod/mini");
13620
+ var import_node_path105 = require("path");
13621
+ var import_mini49 = require("zod/mini");
13268
13622
  var maxSkillSizeBytes = 1024 * 1024;
13269
13623
  var maxSkillsCount = 1e3;
13270
13624
  function aiDirFileToMcpSkillFile(file) {
@@ -13280,19 +13634,19 @@ function mcpSkillFileToAiDirFile(file) {
13280
13634
  };
13281
13635
  }
13282
13636
  function extractDirName(relativeDirPathFromCwd) {
13283
- const dirName = (0, import_node_path103.basename)(relativeDirPathFromCwd);
13637
+ const dirName = (0, import_node_path105.basename)(relativeDirPathFromCwd);
13284
13638
  if (!dirName) {
13285
13639
  throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
13286
13640
  }
13287
13641
  return dirName;
13288
13642
  }
13289
13643
  async function listSkills() {
13290
- const skillsDir = (0, import_node_path103.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
13644
+ const skillsDir = (0, import_node_path105.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
13291
13645
  try {
13292
- const skillDirPaths = await findFilesByGlobs((0, import_node_path103.join)(skillsDir, "*"), { type: "dir" });
13646
+ const skillDirPaths = await findFilesByGlobs((0, import_node_path105.join)(skillsDir, "*"), { type: "dir" });
13293
13647
  const skills = await Promise.all(
13294
13648
  skillDirPaths.map(async (dirPath) => {
13295
- const dirName = (0, import_node_path103.basename)(dirPath);
13649
+ const dirName = (0, import_node_path105.basename)(dirPath);
13296
13650
  if (!dirName) return null;
13297
13651
  try {
13298
13652
  const skill = await RulesyncSkill.fromDir({
@@ -13300,7 +13654,7 @@ async function listSkills() {
13300
13654
  });
13301
13655
  const frontmatter = skill.getFrontmatter();
13302
13656
  return {
13303
- relativeDirPathFromCwd: (0, import_node_path103.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
13657
+ relativeDirPathFromCwd: (0, import_node_path105.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
13304
13658
  frontmatter
13305
13659
  };
13306
13660
  } catch (error) {
@@ -13326,7 +13680,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
13326
13680
  dirName
13327
13681
  });
13328
13682
  return {
13329
- relativeDirPathFromCwd: (0, import_node_path103.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
13683
+ relativeDirPathFromCwd: (0, import_node_path105.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
13330
13684
  frontmatter: skill.getFrontmatter(),
13331
13685
  body: skill.getBody(),
13332
13686
  otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
@@ -13360,7 +13714,7 @@ async function putSkill({
13360
13714
  try {
13361
13715
  const existingSkills = await listSkills();
13362
13716
  const isUpdate = existingSkills.some(
13363
- (skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path103.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
13717
+ (skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path105.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
13364
13718
  );
13365
13719
  if (!isUpdate && existingSkills.length >= maxSkillsCount) {
13366
13720
  throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
@@ -13375,9 +13729,9 @@ async function putSkill({
13375
13729
  otherFiles: aiDirFiles,
13376
13730
  validate: true
13377
13731
  });
13378
- const skillDirPath = (0, import_node_path103.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
13732
+ const skillDirPath = (0, import_node_path105.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
13379
13733
  await ensureDir(skillDirPath);
13380
- const skillFilePath = (0, import_node_path103.join)(skillDirPath, SKILL_FILE_NAME);
13734
+ const skillFilePath = (0, import_node_path105.join)(skillDirPath, SKILL_FILE_NAME);
13381
13735
  const skillFileContent = stringifyFrontmatter(body, frontmatter);
13382
13736
  await writeFileContent(skillFilePath, skillFileContent);
13383
13737
  for (const file of otherFiles) {
@@ -13385,15 +13739,15 @@ async function putSkill({
13385
13739
  relativePath: file.name,
13386
13740
  intendedRootDir: skillDirPath
13387
13741
  });
13388
- const filePath = (0, import_node_path103.join)(skillDirPath, file.name);
13389
- const fileDir = (0, import_node_path103.join)(skillDirPath, (0, import_node_path103.dirname)(file.name));
13742
+ const filePath = (0, import_node_path105.join)(skillDirPath, file.name);
13743
+ const fileDir = (0, import_node_path105.join)(skillDirPath, (0, import_node_path105.dirname)(file.name));
13390
13744
  if (fileDir !== skillDirPath) {
13391
13745
  await ensureDir(fileDir);
13392
13746
  }
13393
13747
  await writeFileContent(filePath, file.body);
13394
13748
  }
13395
13749
  return {
13396
- relativeDirPathFromCwd: (0, import_node_path103.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
13750
+ relativeDirPathFromCwd: (0, import_node_path105.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
13397
13751
  frontmatter: skill.getFrontmatter(),
13398
13752
  body: skill.getBody(),
13399
13753
  otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
@@ -13415,13 +13769,13 @@ async function deleteSkill({
13415
13769
  intendedRootDir: process.cwd()
13416
13770
  });
13417
13771
  const dirName = extractDirName(relativeDirPathFromCwd);
13418
- const skillDirPath = (0, import_node_path103.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
13772
+ const skillDirPath = (0, import_node_path105.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
13419
13773
  try {
13420
13774
  if (await directoryExists(skillDirPath)) {
13421
13775
  await removeDirectory(skillDirPath);
13422
13776
  }
13423
13777
  return {
13424
- relativeDirPathFromCwd: (0, import_node_path103.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
13778
+ relativeDirPathFromCwd: (0, import_node_path105.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
13425
13779
  };
13426
13780
  } catch (error) {
13427
13781
  throw new Error(
@@ -13432,29 +13786,29 @@ async function deleteSkill({
13432
13786
  );
13433
13787
  }
13434
13788
  }
13435
- var McpSkillFileSchema = import_mini48.z.object({
13436
- name: import_mini48.z.string(),
13437
- body: import_mini48.z.string()
13789
+ var McpSkillFileSchema = import_mini49.z.object({
13790
+ name: import_mini49.z.string(),
13791
+ body: import_mini49.z.string()
13438
13792
  });
13439
13793
  var skillToolSchemas = {
13440
- listSkills: import_mini48.z.object({}),
13441
- getSkill: import_mini48.z.object({
13442
- relativeDirPathFromCwd: import_mini48.z.string()
13794
+ listSkills: import_mini49.z.object({}),
13795
+ getSkill: import_mini49.z.object({
13796
+ relativeDirPathFromCwd: import_mini49.z.string()
13443
13797
  }),
13444
- putSkill: import_mini48.z.object({
13445
- relativeDirPathFromCwd: import_mini48.z.string(),
13798
+ putSkill: import_mini49.z.object({
13799
+ relativeDirPathFromCwd: import_mini49.z.string(),
13446
13800
  frontmatter: RulesyncSkillFrontmatterSchema,
13447
- body: import_mini48.z.string(),
13448
- otherFiles: import_mini48.z.optional(import_mini48.z.array(McpSkillFileSchema))
13801
+ body: import_mini49.z.string(),
13802
+ otherFiles: import_mini49.z.optional(import_mini49.z.array(McpSkillFileSchema))
13449
13803
  }),
13450
- deleteSkill: import_mini48.z.object({
13451
- relativeDirPathFromCwd: import_mini48.z.string()
13804
+ deleteSkill: import_mini49.z.object({
13805
+ relativeDirPathFromCwd: import_mini49.z.string()
13452
13806
  })
13453
13807
  };
13454
13808
  var skillTools = {
13455
13809
  listSkills: {
13456
13810
  name: "listSkills",
13457
- description: `List all skills from ${(0, import_node_path103.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
13811
+ description: `List all skills from ${(0, import_node_path105.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
13458
13812
  parameters: skillToolSchemas.listSkills,
13459
13813
  execute: async () => {
13460
13814
  const skills = await listSkills();
@@ -13497,12 +13851,12 @@ var skillTools = {
13497
13851
  };
13498
13852
 
13499
13853
  // src/mcp/subagents.ts
13500
- var import_node_path104 = require("path");
13501
- var import_mini49 = require("zod/mini");
13854
+ var import_node_path106 = require("path");
13855
+ var import_mini50 = require("zod/mini");
13502
13856
  var maxSubagentSizeBytes = 1024 * 1024;
13503
13857
  var maxSubagentsCount = 1e3;
13504
13858
  async function listSubagents() {
13505
- const subagentsDir = (0, import_node_path104.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
13859
+ const subagentsDir = (0, import_node_path106.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
13506
13860
  try {
13507
13861
  const files = await listDirectoryFiles(subagentsDir);
13508
13862
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -13515,7 +13869,7 @@ async function listSubagents() {
13515
13869
  });
13516
13870
  const frontmatter = subagent.getFrontmatter();
13517
13871
  return {
13518
- relativePathFromCwd: (0, import_node_path104.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
13872
+ relativePathFromCwd: (0, import_node_path106.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
13519
13873
  frontmatter
13520
13874
  };
13521
13875
  } catch (error) {
@@ -13537,14 +13891,14 @@ async function getSubagent({ relativePathFromCwd }) {
13537
13891
  relativePath: relativePathFromCwd,
13538
13892
  intendedRootDir: process.cwd()
13539
13893
  });
13540
- const filename = (0, import_node_path104.basename)(relativePathFromCwd);
13894
+ const filename = (0, import_node_path106.basename)(relativePathFromCwd);
13541
13895
  try {
13542
13896
  const subagent = await RulesyncSubagent.fromFile({
13543
13897
  relativeFilePath: filename,
13544
13898
  validate: true
13545
13899
  });
13546
13900
  return {
13547
- relativePathFromCwd: (0, import_node_path104.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
13901
+ relativePathFromCwd: (0, import_node_path106.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
13548
13902
  frontmatter: subagent.getFrontmatter(),
13549
13903
  body: subagent.getBody()
13550
13904
  };
@@ -13563,7 +13917,7 @@ async function putSubagent({
13563
13917
  relativePath: relativePathFromCwd,
13564
13918
  intendedRootDir: process.cwd()
13565
13919
  });
13566
- const filename = (0, import_node_path104.basename)(relativePathFromCwd);
13920
+ const filename = (0, import_node_path106.basename)(relativePathFromCwd);
13567
13921
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
13568
13922
  if (estimatedSize > maxSubagentSizeBytes) {
13569
13923
  throw new Error(
@@ -13573,7 +13927,7 @@ async function putSubagent({
13573
13927
  try {
13574
13928
  const existingSubagents = await listSubagents();
13575
13929
  const isUpdate = existingSubagents.some(
13576
- (subagent2) => subagent2.relativePathFromCwd === (0, import_node_path104.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
13930
+ (subagent2) => subagent2.relativePathFromCwd === (0, import_node_path106.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
13577
13931
  );
13578
13932
  if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
13579
13933
  throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
@@ -13586,11 +13940,11 @@ async function putSubagent({
13586
13940
  body,
13587
13941
  validate: true
13588
13942
  });
13589
- const subagentsDir = (0, import_node_path104.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
13943
+ const subagentsDir = (0, import_node_path106.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
13590
13944
  await ensureDir(subagentsDir);
13591
13945
  await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
13592
13946
  return {
13593
- relativePathFromCwd: (0, import_node_path104.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
13947
+ relativePathFromCwd: (0, import_node_path106.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
13594
13948
  frontmatter: subagent.getFrontmatter(),
13595
13949
  body: subagent.getBody()
13596
13950
  };
@@ -13605,12 +13959,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
13605
13959
  relativePath: relativePathFromCwd,
13606
13960
  intendedRootDir: process.cwd()
13607
13961
  });
13608
- const filename = (0, import_node_path104.basename)(relativePathFromCwd);
13609
- const fullPath = (0, import_node_path104.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
13962
+ const filename = (0, import_node_path106.basename)(relativePathFromCwd);
13963
+ const fullPath = (0, import_node_path106.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
13610
13964
  try {
13611
13965
  await removeFile(fullPath);
13612
13966
  return {
13613
- relativePathFromCwd: (0, import_node_path104.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
13967
+ relativePathFromCwd: (0, import_node_path106.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
13614
13968
  };
13615
13969
  } catch (error) {
13616
13970
  throw new Error(
@@ -13622,23 +13976,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
13622
13976
  }
13623
13977
  }
13624
13978
  var subagentToolSchemas = {
13625
- listSubagents: import_mini49.z.object({}),
13626
- getSubagent: import_mini49.z.object({
13627
- relativePathFromCwd: import_mini49.z.string()
13979
+ listSubagents: import_mini50.z.object({}),
13980
+ getSubagent: import_mini50.z.object({
13981
+ relativePathFromCwd: import_mini50.z.string()
13628
13982
  }),
13629
- putSubagent: import_mini49.z.object({
13630
- relativePathFromCwd: import_mini49.z.string(),
13983
+ putSubagent: import_mini50.z.object({
13984
+ relativePathFromCwd: import_mini50.z.string(),
13631
13985
  frontmatter: RulesyncSubagentFrontmatterSchema,
13632
- body: import_mini49.z.string()
13986
+ body: import_mini50.z.string()
13633
13987
  }),
13634
- deleteSubagent: import_mini49.z.object({
13635
- relativePathFromCwd: import_mini49.z.string()
13988
+ deleteSubagent: import_mini50.z.object({
13989
+ relativePathFromCwd: import_mini50.z.string()
13636
13990
  })
13637
13991
  };
13638
13992
  var subagentTools = {
13639
13993
  listSubagents: {
13640
13994
  name: "listSubagents",
13641
- description: `List all subagents from ${(0, import_node_path104.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
13995
+ description: `List all subagents from ${(0, import_node_path106.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
13642
13996
  parameters: subagentToolSchemas.listSubagents,
13643
13997
  execute: async () => {
13644
13998
  const subagents = await listSubagents();
@@ -13680,20 +14034,20 @@ var subagentTools = {
13680
14034
  };
13681
14035
 
13682
14036
  // src/mcp/tools.ts
13683
- var rulesyncFeatureSchema = import_mini50.z.enum(["rule", "command", "subagent", "skill", "ignore", "mcp"]);
13684
- var rulesyncOperationSchema = import_mini50.z.enum(["list", "get", "put", "delete"]);
13685
- var skillFileSchema = import_mini50.z.object({
13686
- name: import_mini50.z.string(),
13687
- body: import_mini50.z.string()
14037
+ var rulesyncFeatureSchema = import_mini51.z.enum(["rule", "command", "subagent", "skill", "ignore", "mcp"]);
14038
+ var rulesyncOperationSchema = import_mini51.z.enum(["list", "get", "put", "delete"]);
14039
+ var skillFileSchema = import_mini51.z.object({
14040
+ name: import_mini51.z.string(),
14041
+ body: import_mini51.z.string()
13688
14042
  });
13689
- var rulesyncToolSchema = import_mini50.z.object({
14043
+ var rulesyncToolSchema = import_mini51.z.object({
13690
14044
  feature: rulesyncFeatureSchema,
13691
14045
  operation: rulesyncOperationSchema,
13692
- targetPathFromCwd: import_mini50.z.optional(import_mini50.z.string()),
13693
- frontmatter: import_mini50.z.optional(import_mini50.z.unknown()),
13694
- body: import_mini50.z.optional(import_mini50.z.string()),
13695
- otherFiles: import_mini50.z.optional(import_mini50.z.array(skillFileSchema)),
13696
- content: import_mini50.z.optional(import_mini50.z.string())
14046
+ targetPathFromCwd: import_mini51.z.optional(import_mini51.z.string()),
14047
+ frontmatter: import_mini51.z.optional(import_mini51.z.unknown()),
14048
+ body: import_mini51.z.optional(import_mini51.z.string()),
14049
+ otherFiles: import_mini51.z.optional(import_mini51.z.array(skillFileSchema)),
14050
+ content: import_mini51.z.optional(import_mini51.z.string())
13697
14051
  });
13698
14052
  var supportedOperationsByFeature = {
13699
14053
  rule: ["list", "get", "put", "delete"],
@@ -13889,7 +14243,7 @@ async function mcpCommand({ version }) {
13889
14243
  }
13890
14244
 
13891
14245
  // src/cli/index.ts
13892
- var getVersion = () => "5.7.0";
14246
+ var getVersion = () => "5.9.0";
13893
14247
  var main = async () => {
13894
14248
  const program = new import_commander.Command();
13895
14249
  const version = getVersion();
@@ -13913,12 +14267,13 @@ var main = async () => {
13913
14267
  (value) => {
13914
14268
  return value.split(",").map((f) => f.trim());
13915
14269
  }
13916
- ).option("-V, --verbose", "Verbose output").option("-g, --global", "Import for global(user scope) configuration files").action(async (options) => {
14270
+ ).option("-V, --verbose", "Verbose output").option("-s, --silent", "Suppress all output").option("-g, --global", "Import for global(user scope) configuration files").action(async (options) => {
13917
14271
  try {
13918
14272
  await importCommand({
13919
14273
  targets: options.targets,
13920
14274
  features: options.features,
13921
14275
  verbose: options.verbose,
14276
+ silent: options.silent,
13922
14277
  configPath: options.config,
13923
14278
  global: options.global
13924
14279
  });
@@ -13950,7 +14305,7 @@ var main = async () => {
13950
14305
  ).option("--delete", "Delete all existing files in output directories before generating").option(
13951
14306
  "-b, --base-dir <paths>",
13952
14307
  "Base directories to generate files (comma-separated for multiple paths)"
13953
- ).option("-V, --verbose", "Verbose output").option("-c, --config <path>", "Path to configuration file").option("-g, --global", "Generate for global(user scope) configuration files").option(
14308
+ ).option("-V, --verbose", "Verbose output").option("-s, --silent", "Suppress all output").option("-c, --config <path>", "Path to configuration file").option("-g, --global", "Generate for global(user scope) configuration files").option(
13954
14309
  "--simulate-commands",
13955
14310
  "Generate simulated commands. This feature is only available for copilot, cursor and codexcli."
13956
14311
  ).option(
@@ -13968,6 +14323,7 @@ var main = async () => {
13968
14323
  targets: options.targets,
13969
14324
  features: options.features,
13970
14325
  verbose: options.verbose,
14326
+ silent: options.silent,
13971
14327
  delete: options.delete,
13972
14328
  baseDirs: options.baseDirs,
13973
14329
  configPath: options.config,