rulesync 7.12.2 → 7.14.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.
@@ -128,7 +128,7 @@ var Logger = class {
128
128
  var logger = new Logger();
129
129
 
130
130
  // src/lib/fetch.ts
131
- var import_node_path114 = require("path");
131
+ var import_node_path116 = require("path");
132
132
  var import_promise = require("es-toolkit/promise");
133
133
 
134
134
  // src/constants/rulesync-paths.ts
@@ -242,6 +242,24 @@ async function fileExists(filepath) {
242
242
  return false;
243
243
  }
244
244
  }
245
+ async function getFileSize(filepath) {
246
+ try {
247
+ const stats = await (0, import_promises.stat)(filepath);
248
+ return stats.size;
249
+ } catch (error) {
250
+ throw new Error(`Failed to get file size for "${filepath}": ${formatError(error)}`, {
251
+ cause: error
252
+ });
253
+ }
254
+ }
255
+ async function isSymlink(filepath) {
256
+ try {
257
+ const stats = await (0, import_promises.lstat)(filepath);
258
+ return stats.isSymbolicLink();
259
+ } catch {
260
+ return false;
261
+ }
262
+ }
245
263
  async function listDirectoryFiles(dir) {
246
264
  try {
247
265
  return await (0, import_promises.readdir)(dir);
@@ -7137,9 +7155,9 @@ var McpProcessor = class extends FeatureProcessor {
7137
7155
  };
7138
7156
 
7139
7157
  // src/features/rules/rules-processor.ts
7140
- var import_node_path113 = require("path");
7158
+ var import_node_path115 = require("path");
7141
7159
  var import_toon = require("@toon-format/toon");
7142
- var import_mini53 = require("zod/mini");
7160
+ var import_mini55 = require("zod/mini");
7143
7161
 
7144
7162
  // src/constants/general.ts
7145
7163
  var SKILL_FILE_NAME = "SKILL.md";
@@ -7607,8 +7625,8 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
7607
7625
  };
7608
7626
 
7609
7627
  // src/features/skills/skills-processor.ts
7610
- var import_node_path75 = require("path");
7611
- var import_mini37 = require("zod/mini");
7628
+ var import_node_path76 = require("path");
7629
+ var import_mini38 = require("zod/mini");
7612
7630
 
7613
7631
  // src/types/dir-feature-processor.ts
7614
7632
  var import_node_path59 = require("path");
@@ -7738,7 +7756,8 @@ var RulesyncSkillFrontmatterSchemaInternal = import_mini23.z.looseObject({
7738
7756
  claudecode: import_mini23.z.optional(
7739
7757
  import_mini23.z.looseObject({
7740
7758
  "allowed-tools": import_mini23.z.optional(import_mini23.z.array(import_mini23.z.string())),
7741
- model: import_mini23.z.optional(import_mini23.z.string())
7759
+ model: import_mini23.z.optional(import_mini23.z.string()),
7760
+ "disable-model-invocation": import_mini23.z.optional(import_mini23.z.boolean())
7742
7761
  })
7743
7762
  ),
7744
7763
  codexcli: import_mini23.z.optional(
@@ -8175,7 +8194,8 @@ var ClaudecodeSkillFrontmatterSchema = import_mini26.z.looseObject({
8175
8194
  name: import_mini26.z.string(),
8176
8195
  description: import_mini26.z.string(),
8177
8196
  "allowed-tools": import_mini26.z.optional(import_mini26.z.array(import_mini26.z.string())),
8178
- model: import_mini26.z.optional(import_mini26.z.string())
8197
+ model: import_mini26.z.optional(import_mini26.z.string()),
8198
+ "disable-model-invocation": import_mini26.z.optional(import_mini26.z.boolean())
8179
8199
  });
8180
8200
  var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
8181
8201
  constructor({
@@ -8243,7 +8263,10 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
8243
8263
  const frontmatter = this.getFrontmatter();
8244
8264
  const claudecodeSection = {
8245
8265
  ...frontmatter["allowed-tools"] && { "allowed-tools": frontmatter["allowed-tools"] },
8246
- ...frontmatter.model && { model: frontmatter.model }
8266
+ ...frontmatter.model && { model: frontmatter.model },
8267
+ ...frontmatter["disable-model-invocation"] !== void 0 && {
8268
+ "disable-model-invocation": frontmatter["disable-model-invocation"]
8269
+ }
8247
8270
  };
8248
8271
  const rulesyncFrontmatter = {
8249
8272
  name: frontmatter.name,
@@ -8276,6 +8299,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
8276
8299
  },
8277
8300
  ...rulesyncFrontmatter.claudecode?.model && {
8278
8301
  model: rulesyncFrontmatter.claudecode.model
8302
+ },
8303
+ ...rulesyncFrontmatter.claudecode?.["disable-model-invocation"] !== void 0 && {
8304
+ "disable-model-invocation": rulesyncFrontmatter.claudecode["disable-model-invocation"]
8279
8305
  }
8280
8306
  };
8281
8307
  const settablePaths = _ClaudecodeSkill.getSettablePaths({ global });
@@ -9152,17 +9178,193 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
9152
9178
  }
9153
9179
  };
9154
9180
 
9155
- // src/features/skills/kilo-skill.ts
9181
+ // src/features/skills/junie-skill.ts
9156
9182
  var import_node_path69 = require("path");
9157
9183
  var import_mini32 = require("zod/mini");
9158
- var KiloSkillFrontmatterSchema = import_mini32.z.looseObject({
9184
+ var JunieSkillFrontmatterSchema = import_mini32.z.looseObject({
9159
9185
  name: import_mini32.z.string(),
9160
9186
  description: import_mini32.z.string()
9161
9187
  });
9188
+ var JunieSkill = class _JunieSkill extends ToolSkill {
9189
+ constructor({
9190
+ baseDir = process.cwd(),
9191
+ relativeDirPath = (0, import_node_path69.join)(".junie", "skills"),
9192
+ dirName,
9193
+ frontmatter,
9194
+ body,
9195
+ otherFiles = [],
9196
+ validate = true,
9197
+ global = false
9198
+ }) {
9199
+ super({
9200
+ baseDir,
9201
+ relativeDirPath,
9202
+ dirName,
9203
+ mainFile: {
9204
+ name: SKILL_FILE_NAME,
9205
+ body,
9206
+ frontmatter: { ...frontmatter }
9207
+ },
9208
+ otherFiles,
9209
+ global
9210
+ });
9211
+ if (validate) {
9212
+ const result = this.validate();
9213
+ if (!result.success) {
9214
+ throw result.error;
9215
+ }
9216
+ }
9217
+ }
9218
+ static getSettablePaths(options) {
9219
+ if (options?.global) {
9220
+ throw new Error("JunieSkill does not support global mode.");
9221
+ }
9222
+ return {
9223
+ relativeDirPath: (0, import_node_path69.join)(".junie", "skills")
9224
+ };
9225
+ }
9226
+ getFrontmatter() {
9227
+ const result = JunieSkillFrontmatterSchema.parse(this.requireMainFileFrontmatter());
9228
+ return result;
9229
+ }
9230
+ getBody() {
9231
+ return this.mainFile?.body ?? "";
9232
+ }
9233
+ validate() {
9234
+ if (!this.mainFile) {
9235
+ return {
9236
+ success: false,
9237
+ error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
9238
+ };
9239
+ }
9240
+ const result = JunieSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
9241
+ if (!result.success) {
9242
+ return {
9243
+ success: false,
9244
+ error: new Error(
9245
+ `Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
9246
+ )
9247
+ };
9248
+ }
9249
+ if (result.data.name !== this.getDirName()) {
9250
+ return {
9251
+ success: false,
9252
+ error: new Error(
9253
+ `${this.getDirPath()}: frontmatter name (${result.data.name}) must match directory name (${this.getDirName()})`
9254
+ )
9255
+ };
9256
+ }
9257
+ return { success: true, error: null };
9258
+ }
9259
+ toRulesyncSkill() {
9260
+ const frontmatter = this.getFrontmatter();
9261
+ const rulesyncFrontmatter = {
9262
+ name: frontmatter.name,
9263
+ description: frontmatter.description,
9264
+ targets: ["*"]
9265
+ };
9266
+ return new RulesyncSkill({
9267
+ baseDir: this.baseDir,
9268
+ relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
9269
+ dirName: this.getDirName(),
9270
+ frontmatter: rulesyncFrontmatter,
9271
+ body: this.getBody(),
9272
+ otherFiles: this.getOtherFiles(),
9273
+ validate: true,
9274
+ global: this.global
9275
+ });
9276
+ }
9277
+ static fromRulesyncSkill({
9278
+ rulesyncSkill,
9279
+ validate = true,
9280
+ global = false
9281
+ }) {
9282
+ const settablePaths = _JunieSkill.getSettablePaths({ global });
9283
+ const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
9284
+ const junieFrontmatter = {
9285
+ name: rulesyncFrontmatter.name,
9286
+ description: rulesyncFrontmatter.description
9287
+ };
9288
+ return new _JunieSkill({
9289
+ baseDir: rulesyncSkill.getBaseDir(),
9290
+ relativeDirPath: settablePaths.relativeDirPath,
9291
+ dirName: junieFrontmatter.name,
9292
+ frontmatter: junieFrontmatter,
9293
+ body: rulesyncSkill.getBody(),
9294
+ otherFiles: rulesyncSkill.getOtherFiles(),
9295
+ validate,
9296
+ global
9297
+ });
9298
+ }
9299
+ static isTargetedByRulesyncSkill(rulesyncSkill) {
9300
+ const targets = rulesyncSkill.getFrontmatter().targets;
9301
+ return targets.includes("*") || targets.includes("junie");
9302
+ }
9303
+ static async fromDir(params) {
9304
+ const loaded = await this.loadSkillDirContent({
9305
+ ...params,
9306
+ getSettablePaths: _JunieSkill.getSettablePaths
9307
+ });
9308
+ const result = JunieSkillFrontmatterSchema.safeParse(loaded.frontmatter);
9309
+ if (!result.success) {
9310
+ const skillDirPath = (0, import_node_path69.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
9311
+ throw new Error(
9312
+ `Invalid frontmatter in ${(0, import_node_path69.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
9313
+ );
9314
+ }
9315
+ if (result.data.name !== loaded.dirName) {
9316
+ const skillFilePath = (0, import_node_path69.join)(
9317
+ loaded.baseDir,
9318
+ loaded.relativeDirPath,
9319
+ loaded.dirName,
9320
+ SKILL_FILE_NAME
9321
+ );
9322
+ throw new Error(
9323
+ `Frontmatter name (${result.data.name}) must match directory name (${loaded.dirName}) in ${skillFilePath}`
9324
+ );
9325
+ }
9326
+ return new _JunieSkill({
9327
+ baseDir: loaded.baseDir,
9328
+ relativeDirPath: loaded.relativeDirPath,
9329
+ dirName: loaded.dirName,
9330
+ frontmatter: result.data,
9331
+ body: loaded.body,
9332
+ otherFiles: loaded.otherFiles,
9333
+ validate: true,
9334
+ global: loaded.global
9335
+ });
9336
+ }
9337
+ static forDeletion({
9338
+ baseDir = process.cwd(),
9339
+ relativeDirPath,
9340
+ dirName,
9341
+ global = false
9342
+ }) {
9343
+ const settablePaths = _JunieSkill.getSettablePaths({ global });
9344
+ return new _JunieSkill({
9345
+ baseDir,
9346
+ relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
9347
+ dirName,
9348
+ frontmatter: { name: "", description: "" },
9349
+ body: "",
9350
+ otherFiles: [],
9351
+ validate: false,
9352
+ global
9353
+ });
9354
+ }
9355
+ };
9356
+
9357
+ // src/features/skills/kilo-skill.ts
9358
+ var import_node_path70 = require("path");
9359
+ var import_mini33 = require("zod/mini");
9360
+ var KiloSkillFrontmatterSchema = import_mini33.z.looseObject({
9361
+ name: import_mini33.z.string(),
9362
+ description: import_mini33.z.string()
9363
+ });
9162
9364
  var KiloSkill = class _KiloSkill extends ToolSkill {
9163
9365
  constructor({
9164
9366
  baseDir = process.cwd(),
9165
- relativeDirPath = (0, import_node_path69.join)(".kilocode", "skills"),
9367
+ relativeDirPath = (0, import_node_path70.join)(".kilocode", "skills"),
9166
9368
  dirName,
9167
9369
  frontmatter,
9168
9370
  body,
@@ -9193,7 +9395,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
9193
9395
  global: _global = false
9194
9396
  } = {}) {
9195
9397
  return {
9196
- relativeDirPath: (0, import_node_path69.join)(".kilocode", "skills")
9398
+ relativeDirPath: (0, import_node_path70.join)(".kilocode", "skills")
9197
9399
  };
9198
9400
  }
9199
9401
  getFrontmatter() {
@@ -9280,13 +9482,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
9280
9482
  });
9281
9483
  const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
9282
9484
  if (!result.success) {
9283
- const skillDirPath = (0, import_node_path69.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
9485
+ const skillDirPath = (0, import_node_path70.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
9284
9486
  throw new Error(
9285
- `Invalid frontmatter in ${(0, import_node_path69.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
9487
+ `Invalid frontmatter in ${(0, import_node_path70.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
9286
9488
  );
9287
9489
  }
9288
9490
  if (result.data.name !== loaded.dirName) {
9289
- const skillFilePath = (0, import_node_path69.join)(
9491
+ const skillFilePath = (0, import_node_path70.join)(
9290
9492
  loaded.baseDir,
9291
9493
  loaded.relativeDirPath,
9292
9494
  loaded.dirName,
@@ -9327,16 +9529,16 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
9327
9529
  };
9328
9530
 
9329
9531
  // src/features/skills/kiro-skill.ts
9330
- var import_node_path70 = require("path");
9331
- var import_mini33 = require("zod/mini");
9332
- var KiroSkillFrontmatterSchema = import_mini33.z.looseObject({
9333
- name: import_mini33.z.string(),
9334
- description: import_mini33.z.string()
9532
+ var import_node_path71 = require("path");
9533
+ var import_mini34 = require("zod/mini");
9534
+ var KiroSkillFrontmatterSchema = import_mini34.z.looseObject({
9535
+ name: import_mini34.z.string(),
9536
+ description: import_mini34.z.string()
9335
9537
  });
9336
9538
  var KiroSkill = class _KiroSkill extends ToolSkill {
9337
9539
  constructor({
9338
9540
  baseDir = process.cwd(),
9339
- relativeDirPath = (0, import_node_path70.join)(".kiro", "skills"),
9541
+ relativeDirPath = (0, import_node_path71.join)(".kiro", "skills"),
9340
9542
  dirName,
9341
9543
  frontmatter,
9342
9544
  body,
@@ -9368,7 +9570,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
9368
9570
  throw new Error("KiroSkill does not support global mode.");
9369
9571
  }
9370
9572
  return {
9371
- relativeDirPath: (0, import_node_path70.join)(".kiro", "skills")
9573
+ relativeDirPath: (0, import_node_path71.join)(".kiro", "skills")
9372
9574
  };
9373
9575
  }
9374
9576
  getFrontmatter() {
@@ -9455,13 +9657,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
9455
9657
  });
9456
9658
  const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
9457
9659
  if (!result.success) {
9458
- const skillDirPath = (0, import_node_path70.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
9660
+ const skillDirPath = (0, import_node_path71.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
9459
9661
  throw new Error(
9460
- `Invalid frontmatter in ${(0, import_node_path70.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
9662
+ `Invalid frontmatter in ${(0, import_node_path71.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
9461
9663
  );
9462
9664
  }
9463
9665
  if (result.data.name !== loaded.dirName) {
9464
- const skillFilePath = (0, import_node_path70.join)(
9666
+ const skillFilePath = (0, import_node_path71.join)(
9465
9667
  loaded.baseDir,
9466
9668
  loaded.relativeDirPath,
9467
9669
  loaded.dirName,
@@ -9503,17 +9705,17 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
9503
9705
  };
9504
9706
 
9505
9707
  // src/features/skills/opencode-skill.ts
9506
- var import_node_path71 = require("path");
9507
- var import_mini34 = require("zod/mini");
9508
- var OpenCodeSkillFrontmatterSchema = import_mini34.z.looseObject({
9509
- name: import_mini34.z.string(),
9510
- description: import_mini34.z.string(),
9511
- "allowed-tools": import_mini34.z.optional(import_mini34.z.array(import_mini34.z.string()))
9708
+ var import_node_path72 = require("path");
9709
+ var import_mini35 = require("zod/mini");
9710
+ var OpenCodeSkillFrontmatterSchema = import_mini35.z.looseObject({
9711
+ name: import_mini35.z.string(),
9712
+ description: import_mini35.z.string(),
9713
+ "allowed-tools": import_mini35.z.optional(import_mini35.z.array(import_mini35.z.string()))
9512
9714
  });
9513
9715
  var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
9514
9716
  constructor({
9515
9717
  baseDir = process.cwd(),
9516
- relativeDirPath = (0, import_node_path71.join)(".opencode", "skill"),
9718
+ relativeDirPath = (0, import_node_path72.join)(".opencode", "skill"),
9517
9719
  dirName,
9518
9720
  frontmatter,
9519
9721
  body,
@@ -9542,7 +9744,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
9542
9744
  }
9543
9745
  static getSettablePaths({ global = false } = {}) {
9544
9746
  return {
9545
- relativeDirPath: global ? (0, import_node_path71.join)(".config", "opencode", "skill") : (0, import_node_path71.join)(".opencode", "skill")
9747
+ relativeDirPath: global ? (0, import_node_path72.join)(".config", "opencode", "skill") : (0, import_node_path72.join)(".opencode", "skill")
9546
9748
  };
9547
9749
  }
9548
9750
  getFrontmatter() {
@@ -9627,9 +9829,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
9627
9829
  });
9628
9830
  const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
9629
9831
  if (!result.success) {
9630
- const skillDirPath = (0, import_node_path71.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
9832
+ const skillDirPath = (0, import_node_path72.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
9631
9833
  throw new Error(
9632
- `Invalid frontmatter in ${(0, import_node_path71.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
9834
+ `Invalid frontmatter in ${(0, import_node_path72.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
9633
9835
  );
9634
9836
  }
9635
9837
  return new _OpenCodeSkill({
@@ -9663,16 +9865,16 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
9663
9865
  };
9664
9866
 
9665
9867
  // src/features/skills/replit-skill.ts
9666
- var import_node_path72 = require("path");
9667
- var import_mini35 = require("zod/mini");
9668
- var ReplitSkillFrontmatterSchema = import_mini35.z.looseObject({
9669
- name: import_mini35.z.string(),
9670
- description: import_mini35.z.string()
9868
+ var import_node_path73 = require("path");
9869
+ var import_mini36 = require("zod/mini");
9870
+ var ReplitSkillFrontmatterSchema = import_mini36.z.looseObject({
9871
+ name: import_mini36.z.string(),
9872
+ description: import_mini36.z.string()
9671
9873
  });
9672
9874
  var ReplitSkill = class _ReplitSkill extends ToolSkill {
9673
9875
  constructor({
9674
9876
  baseDir = process.cwd(),
9675
- relativeDirPath = (0, import_node_path72.join)(".agents", "skills"),
9877
+ relativeDirPath = (0, import_node_path73.join)(".agents", "skills"),
9676
9878
  dirName,
9677
9879
  frontmatter,
9678
9880
  body,
@@ -9704,7 +9906,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
9704
9906
  throw new Error("ReplitSkill does not support global mode.");
9705
9907
  }
9706
9908
  return {
9707
- relativeDirPath: (0, import_node_path72.join)(".agents", "skills")
9909
+ relativeDirPath: (0, import_node_path73.join)(".agents", "skills")
9708
9910
  };
9709
9911
  }
9710
9912
  getFrontmatter() {
@@ -9783,9 +9985,9 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
9783
9985
  });
9784
9986
  const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
9785
9987
  if (!result.success) {
9786
- const skillDirPath = (0, import_node_path72.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
9988
+ const skillDirPath = (0, import_node_path73.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
9787
9989
  throw new Error(
9788
- `Invalid frontmatter in ${(0, import_node_path72.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
9990
+ `Invalid frontmatter in ${(0, import_node_path73.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
9789
9991
  );
9790
9992
  }
9791
9993
  return new _ReplitSkill({
@@ -9820,16 +10022,16 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
9820
10022
  };
9821
10023
 
9822
10024
  // src/features/skills/roo-skill.ts
9823
- var import_node_path73 = require("path");
9824
- var import_mini36 = require("zod/mini");
9825
- var RooSkillFrontmatterSchema = import_mini36.z.looseObject({
9826
- name: import_mini36.z.string(),
9827
- description: import_mini36.z.string()
10025
+ var import_node_path74 = require("path");
10026
+ var import_mini37 = require("zod/mini");
10027
+ var RooSkillFrontmatterSchema = import_mini37.z.looseObject({
10028
+ name: import_mini37.z.string(),
10029
+ description: import_mini37.z.string()
9828
10030
  });
9829
10031
  var RooSkill = class _RooSkill extends ToolSkill {
9830
10032
  constructor({
9831
10033
  baseDir = process.cwd(),
9832
- relativeDirPath = (0, import_node_path73.join)(".roo", "skills"),
10034
+ relativeDirPath = (0, import_node_path74.join)(".roo", "skills"),
9833
10035
  dirName,
9834
10036
  frontmatter,
9835
10037
  body,
@@ -9860,7 +10062,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
9860
10062
  global: _global = false
9861
10063
  } = {}) {
9862
10064
  return {
9863
- relativeDirPath: (0, import_node_path73.join)(".roo", "skills")
10065
+ relativeDirPath: (0, import_node_path74.join)(".roo", "skills")
9864
10066
  };
9865
10067
  }
9866
10068
  getFrontmatter() {
@@ -9947,13 +10149,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
9947
10149
  });
9948
10150
  const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
9949
10151
  if (!result.success) {
9950
- const skillDirPath = (0, import_node_path73.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
10152
+ const skillDirPath = (0, import_node_path74.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
9951
10153
  throw new Error(
9952
- `Invalid frontmatter in ${(0, import_node_path73.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
10154
+ `Invalid frontmatter in ${(0, import_node_path74.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
9953
10155
  );
9954
10156
  }
9955
10157
  if (result.data.name !== loaded.dirName) {
9956
- const skillFilePath = (0, import_node_path73.join)(
10158
+ const skillFilePath = (0, import_node_path74.join)(
9957
10159
  loaded.baseDir,
9958
10160
  loaded.relativeDirPath,
9959
10161
  loaded.dirName,
@@ -9994,17 +10196,17 @@ var RooSkill = class _RooSkill extends ToolSkill {
9994
10196
  };
9995
10197
 
9996
10198
  // src/features/skills/skills-utils.ts
9997
- var import_node_path74 = require("path");
10199
+ var import_node_path75 = require("path");
9998
10200
  async function getLocalSkillDirNames(baseDir) {
9999
- const skillsDir = (0, import_node_path74.join)(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
10201
+ const skillsDir = (0, import_node_path75.join)(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
10000
10202
  const names = /* @__PURE__ */ new Set();
10001
10203
  if (!await directoryExists(skillsDir)) {
10002
10204
  return names;
10003
10205
  }
10004
- const dirPaths = await findFilesByGlobs((0, import_node_path74.join)(skillsDir, "*"), { type: "dir" });
10206
+ const dirPaths = await findFilesByGlobs((0, import_node_path75.join)(skillsDir, "*"), { type: "dir" });
10005
10207
  for (const dirPath of dirPaths) {
10006
- const name = (0, import_node_path74.basename)(dirPath);
10007
- if (name === (0, import_node_path74.basename)(RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH)) continue;
10208
+ const name = (0, import_node_path75.basename)(dirPath);
10209
+ if (name === (0, import_node_path75.basename)(RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH)) continue;
10008
10210
  names.add(name);
10009
10211
  }
10010
10212
  return names;
@@ -10023,13 +10225,14 @@ var skillsProcessorToolTargetTuple = [
10023
10225
  "cursor",
10024
10226
  "factorydroid",
10025
10227
  "geminicli",
10228
+ "junie",
10026
10229
  "kilo",
10027
10230
  "kiro",
10028
10231
  "opencode",
10029
10232
  "replit",
10030
10233
  "roo"
10031
10234
  ];
10032
- var SkillsProcessorToolTargetSchema = import_mini37.z.enum(skillsProcessorToolTargetTuple);
10235
+ var SkillsProcessorToolTargetSchema = import_mini38.z.enum(skillsProcessorToolTargetTuple);
10033
10236
  var toolSkillFactories = /* @__PURE__ */ new Map([
10034
10237
  [
10035
10238
  "agentsmd",
@@ -10108,6 +10311,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
10108
10311
  meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
10109
10312
  }
10110
10313
  ],
10314
+ [
10315
+ "junie",
10316
+ {
10317
+ class: JunieSkill,
10318
+ meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: false }
10319
+ }
10320
+ ],
10111
10321
  [
10112
10322
  "kilo",
10113
10323
  {
@@ -10230,11 +10440,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
10230
10440
  )
10231
10441
  );
10232
10442
  const localSkillNames = new Set(localDirNames);
10233
- const curatedDirPath = (0, import_node_path75.join)(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
10443
+ const curatedDirPath = (0, import_node_path76.join)(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
10234
10444
  let curatedSkills = [];
10235
10445
  if (await directoryExists(curatedDirPath)) {
10236
- const curatedDirPaths = await findFilesByGlobs((0, import_node_path75.join)(curatedDirPath, "*"), { type: "dir" });
10237
- const curatedDirNames = curatedDirPaths.map((path4) => (0, import_node_path75.basename)(path4));
10446
+ const curatedDirPaths = await findFilesByGlobs((0, import_node_path76.join)(curatedDirPath, "*"), { type: "dir" });
10447
+ const curatedDirNames = curatedDirPaths.map((path4) => (0, import_node_path76.basename)(path4));
10238
10448
  const nonConflicting = curatedDirNames.filter((name) => {
10239
10449
  if (localSkillNames.has(name)) {
10240
10450
  logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
@@ -10267,9 +10477,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
10267
10477
  async loadToolDirs() {
10268
10478
  const factory = this.getFactory(this.toolTarget);
10269
10479
  const paths = factory.class.getSettablePaths({ global: this.global });
10270
- const skillsDirPath = (0, import_node_path75.join)(this.baseDir, paths.relativeDirPath);
10271
- const dirPaths = await findFilesByGlobs((0, import_node_path75.join)(skillsDirPath, "*"), { type: "dir" });
10272
- const dirNames = dirPaths.map((path4) => (0, import_node_path75.basename)(path4));
10480
+ const skillsDirPath = (0, import_node_path76.join)(this.baseDir, paths.relativeDirPath);
10481
+ const dirPaths = await findFilesByGlobs((0, import_node_path76.join)(skillsDirPath, "*"), { type: "dir" });
10482
+ const dirNames = dirPaths.map((path4) => (0, import_node_path76.basename)(path4));
10273
10483
  const toolSkills = await Promise.all(
10274
10484
  dirNames.map(
10275
10485
  (dirName) => factory.class.fromDir({
@@ -10285,9 +10495,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
10285
10495
  async loadToolDirsToDelete() {
10286
10496
  const factory = this.getFactory(this.toolTarget);
10287
10497
  const paths = factory.class.getSettablePaths({ global: this.global });
10288
- const skillsDirPath = (0, import_node_path75.join)(this.baseDir, paths.relativeDirPath);
10289
- const dirPaths = await findFilesByGlobs((0, import_node_path75.join)(skillsDirPath, "*"), { type: "dir" });
10290
- const dirNames = dirPaths.map((path4) => (0, import_node_path75.basename)(path4));
10498
+ const skillsDirPath = (0, import_node_path76.join)(this.baseDir, paths.relativeDirPath);
10499
+ const dirPaths = await findFilesByGlobs((0, import_node_path76.join)(skillsDirPath, "*"), { type: "dir" });
10500
+ const dirNames = dirPaths.map((path4) => (0, import_node_path76.basename)(path4));
10291
10501
  const toolSkills = dirNames.map(
10292
10502
  (dirName) => factory.class.forDeletion({
10293
10503
  baseDir: this.baseDir,
@@ -10348,11 +10558,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
10348
10558
  };
10349
10559
 
10350
10560
  // src/features/subagents/agentsmd-subagent.ts
10351
- var import_node_path77 = require("path");
10561
+ var import_node_path78 = require("path");
10352
10562
 
10353
10563
  // src/features/subagents/simulated-subagent.ts
10354
- var import_node_path76 = require("path");
10355
- var import_mini38 = require("zod/mini");
10564
+ var import_node_path77 = require("path");
10565
+ var import_mini39 = require("zod/mini");
10356
10566
 
10357
10567
  // src/features/subagents/tool-subagent.ts
10358
10568
  var ToolSubagent = class extends ToolFile {
@@ -10404,9 +10614,9 @@ var ToolSubagent = class extends ToolFile {
10404
10614
  };
10405
10615
 
10406
10616
  // src/features/subagents/simulated-subagent.ts
10407
- var SimulatedSubagentFrontmatterSchema = import_mini38.z.object({
10408
- name: import_mini38.z.string(),
10409
- description: import_mini38.z.optional(import_mini38.z.string())
10617
+ var SimulatedSubagentFrontmatterSchema = import_mini39.z.object({
10618
+ name: import_mini39.z.string(),
10619
+ description: import_mini39.z.optional(import_mini39.z.string())
10410
10620
  });
10411
10621
  var SimulatedSubagent = class extends ToolSubagent {
10412
10622
  frontmatter;
@@ -10416,7 +10626,7 @@ var SimulatedSubagent = class extends ToolSubagent {
10416
10626
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
10417
10627
  if (!result.success) {
10418
10628
  throw new Error(
10419
- `Invalid frontmatter in ${(0, import_node_path76.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
10629
+ `Invalid frontmatter in ${(0, import_node_path77.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
10420
10630
  );
10421
10631
  }
10422
10632
  }
@@ -10467,7 +10677,7 @@ var SimulatedSubagent = class extends ToolSubagent {
10467
10677
  return {
10468
10678
  success: false,
10469
10679
  error: new Error(
10470
- `Invalid frontmatter in ${(0, import_node_path76.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
10680
+ `Invalid frontmatter in ${(0, import_node_path77.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
10471
10681
  )
10472
10682
  };
10473
10683
  }
@@ -10477,7 +10687,7 @@ var SimulatedSubagent = class extends ToolSubagent {
10477
10687
  relativeFilePath,
10478
10688
  validate = true
10479
10689
  }) {
10480
- const filePath = (0, import_node_path76.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
10690
+ const filePath = (0, import_node_path77.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
10481
10691
  const fileContent = await readFileContent(filePath);
10482
10692
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
10483
10693
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -10487,7 +10697,7 @@ var SimulatedSubagent = class extends ToolSubagent {
10487
10697
  return {
10488
10698
  baseDir,
10489
10699
  relativeDirPath: this.getSettablePaths().relativeDirPath,
10490
- relativeFilePath: (0, import_node_path76.basename)(relativeFilePath),
10700
+ relativeFilePath: (0, import_node_path77.basename)(relativeFilePath),
10491
10701
  frontmatter: result.data,
10492
10702
  body: content.trim(),
10493
10703
  validate
@@ -10513,7 +10723,7 @@ var SimulatedSubagent = class extends ToolSubagent {
10513
10723
  var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
10514
10724
  static getSettablePaths() {
10515
10725
  return {
10516
- relativeDirPath: (0, import_node_path77.join)(".agents", "subagents")
10726
+ relativeDirPath: (0, import_node_path78.join)(".agents", "subagents")
10517
10727
  };
10518
10728
  }
10519
10729
  static async fromFile(params) {
@@ -10536,11 +10746,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
10536
10746
  };
10537
10747
 
10538
10748
  // src/features/subagents/factorydroid-subagent.ts
10539
- var import_node_path78 = require("path");
10749
+ var import_node_path79 = require("path");
10540
10750
  var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
10541
10751
  static getSettablePaths(_options) {
10542
10752
  return {
10543
- relativeDirPath: (0, import_node_path78.join)(".factory", "droids")
10753
+ relativeDirPath: (0, import_node_path79.join)(".factory", "droids")
10544
10754
  };
10545
10755
  }
10546
10756
  static async fromFile(params) {
@@ -10563,11 +10773,11 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
10563
10773
  };
10564
10774
 
10565
10775
  // src/features/subagents/geminicli-subagent.ts
10566
- var import_node_path79 = require("path");
10776
+ var import_node_path80 = require("path");
10567
10777
  var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
10568
10778
  static getSettablePaths() {
10569
10779
  return {
10570
- relativeDirPath: (0, import_node_path79.join)(".gemini", "subagents")
10780
+ relativeDirPath: (0, import_node_path80.join)(".gemini", "subagents")
10571
10781
  };
10572
10782
  }
10573
10783
  static async fromFile(params) {
@@ -10590,11 +10800,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
10590
10800
  };
10591
10801
 
10592
10802
  // src/features/subagents/roo-subagent.ts
10593
- var import_node_path80 = require("path");
10803
+ var import_node_path81 = require("path");
10594
10804
  var RooSubagent = class _RooSubagent extends SimulatedSubagent {
10595
10805
  static getSettablePaths() {
10596
10806
  return {
10597
- relativeDirPath: (0, import_node_path80.join)(".roo", "subagents")
10807
+ relativeDirPath: (0, import_node_path81.join)(".roo", "subagents")
10598
10808
  };
10599
10809
  }
10600
10810
  static async fromFile(params) {
@@ -10617,20 +10827,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
10617
10827
  };
10618
10828
 
10619
10829
  // src/features/subagents/subagents-processor.ts
10620
- var import_node_path88 = require("path");
10621
- var import_mini46 = require("zod/mini");
10830
+ var import_node_path90 = require("path");
10831
+ var import_mini48 = require("zod/mini");
10622
10832
 
10623
10833
  // src/features/subagents/claudecode-subagent.ts
10624
- var import_node_path82 = require("path");
10625
- var import_mini40 = require("zod/mini");
10834
+ var import_node_path83 = require("path");
10835
+ var import_mini41 = require("zod/mini");
10626
10836
 
10627
10837
  // src/features/subagents/rulesync-subagent.ts
10628
- var import_node_path81 = require("path");
10629
- var import_mini39 = require("zod/mini");
10630
- var RulesyncSubagentFrontmatterSchema = import_mini39.z.looseObject({
10631
- targets: import_mini39.z._default(RulesyncTargetsSchema, ["*"]),
10632
- name: import_mini39.z.string(),
10633
- description: import_mini39.z.optional(import_mini39.z.string())
10838
+ var import_node_path82 = require("path");
10839
+ var import_mini40 = require("zod/mini");
10840
+ var RulesyncSubagentFrontmatterSchema = import_mini40.z.looseObject({
10841
+ targets: import_mini40.z._default(RulesyncTargetsSchema, ["*"]),
10842
+ name: import_mini40.z.string(),
10843
+ description: import_mini40.z.optional(import_mini40.z.string())
10634
10844
  });
10635
10845
  var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
10636
10846
  frontmatter;
@@ -10639,7 +10849,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
10639
10849
  const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
10640
10850
  if (!parseResult.success && rest.validate !== false) {
10641
10851
  throw new Error(
10642
- `Invalid frontmatter in ${(0, import_node_path81.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
10852
+ `Invalid frontmatter in ${(0, import_node_path82.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
10643
10853
  );
10644
10854
  }
10645
10855
  const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
@@ -10672,7 +10882,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
10672
10882
  return {
10673
10883
  success: false,
10674
10884
  error: new Error(
10675
- `Invalid frontmatter in ${(0, import_node_path81.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
10885
+ `Invalid frontmatter in ${(0, import_node_path82.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
10676
10886
  )
10677
10887
  };
10678
10888
  }
@@ -10680,14 +10890,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
10680
10890
  static async fromFile({
10681
10891
  relativeFilePath
10682
10892
  }) {
10683
- const filePath = (0, import_node_path81.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
10893
+ const filePath = (0, import_node_path82.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
10684
10894
  const fileContent = await readFileContent(filePath);
10685
10895
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
10686
10896
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
10687
10897
  if (!result.success) {
10688
10898
  throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
10689
10899
  }
10690
- const filename = (0, import_node_path81.basename)(relativeFilePath);
10900
+ const filename = (0, import_node_path82.basename)(relativeFilePath);
10691
10901
  return new _RulesyncSubagent({
10692
10902
  baseDir: process.cwd(),
10693
10903
  relativeDirPath: this.getSettablePaths().relativeDirPath,
@@ -10699,13 +10909,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
10699
10909
  };
10700
10910
 
10701
10911
  // src/features/subagents/claudecode-subagent.ts
10702
- var ClaudecodeSubagentFrontmatterSchema = import_mini40.z.looseObject({
10703
- name: import_mini40.z.string(),
10704
- description: import_mini40.z.optional(import_mini40.z.string()),
10705
- model: import_mini40.z.optional(import_mini40.z.string()),
10706
- tools: import_mini40.z.optional(import_mini40.z.union([import_mini40.z.string(), import_mini40.z.array(import_mini40.z.string())])),
10707
- permissionMode: import_mini40.z.optional(import_mini40.z.string()),
10708
- skills: import_mini40.z.optional(import_mini40.z.union([import_mini40.z.string(), import_mini40.z.array(import_mini40.z.string())]))
10912
+ var ClaudecodeSubagentFrontmatterSchema = import_mini41.z.looseObject({
10913
+ name: import_mini41.z.string(),
10914
+ description: import_mini41.z.optional(import_mini41.z.string()),
10915
+ model: import_mini41.z.optional(import_mini41.z.string()),
10916
+ tools: import_mini41.z.optional(import_mini41.z.union([import_mini41.z.string(), import_mini41.z.array(import_mini41.z.string())])),
10917
+ permissionMode: import_mini41.z.optional(import_mini41.z.string()),
10918
+ skills: import_mini41.z.optional(import_mini41.z.union([import_mini41.z.string(), import_mini41.z.array(import_mini41.z.string())]))
10709
10919
  });
10710
10920
  var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
10711
10921
  frontmatter;
@@ -10715,7 +10925,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
10715
10925
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
10716
10926
  if (!result.success) {
10717
10927
  throw new Error(
10718
- `Invalid frontmatter in ${(0, import_node_path82.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
10928
+ `Invalid frontmatter in ${(0, import_node_path83.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
10719
10929
  );
10720
10930
  }
10721
10931
  }
@@ -10727,7 +10937,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
10727
10937
  }
10728
10938
  static getSettablePaths(_options = {}) {
10729
10939
  return {
10730
- relativeDirPath: (0, import_node_path82.join)(".claude", "agents")
10940
+ relativeDirPath: (0, import_node_path83.join)(".claude", "agents")
10731
10941
  };
10732
10942
  }
10733
10943
  getFrontmatter() {
@@ -10766,7 +10976,10 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
10766
10976
  global = false
10767
10977
  }) {
10768
10978
  const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
10769
- const claudecodeSection = rulesyncFrontmatter.claudecode ?? {};
10979
+ const claudecodeSection = this.filterToolSpecificSection(rulesyncFrontmatter.claudecode ?? {}, [
10980
+ "name",
10981
+ "description"
10982
+ ]);
10770
10983
  const rawClaudecodeFrontmatter = {
10771
10984
  name: rulesyncFrontmatter.name,
10772
10985
  description: rulesyncFrontmatter.description,
@@ -10803,7 +11016,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
10803
11016
  return {
10804
11017
  success: false,
10805
11018
  error: new Error(
10806
- `Invalid frontmatter in ${(0, import_node_path82.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
11019
+ `Invalid frontmatter in ${(0, import_node_path83.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
10807
11020
  )
10808
11021
  };
10809
11022
  }
@@ -10821,7 +11034,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
10821
11034
  global = false
10822
11035
  }) {
10823
11036
  const paths = this.getSettablePaths({ global });
10824
- const filePath = (0, import_node_path82.join)(baseDir, paths.relativeDirPath, relativeFilePath);
11037
+ const filePath = (0, import_node_path83.join)(baseDir, paths.relativeDirPath, relativeFilePath);
10825
11038
  const fileContent = await readFileContent(filePath);
10826
11039
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
10827
11040
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -10856,16 +11069,16 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
10856
11069
  };
10857
11070
 
10858
11071
  // src/features/subagents/codexcli-subagent.ts
10859
- var import_node_path83 = require("path");
11072
+ var import_node_path84 = require("path");
10860
11073
  var smolToml2 = __toESM(require("smol-toml"), 1);
10861
- var import_mini41 = require("zod/mini");
10862
- var CodexCliSubagentTomlSchema = import_mini41.z.looseObject({
10863
- name: import_mini41.z.string(),
10864
- description: import_mini41.z.optional(import_mini41.z.string()),
10865
- developer_instructions: import_mini41.z.optional(import_mini41.z.string()),
10866
- model: import_mini41.z.optional(import_mini41.z.string()),
10867
- model_reasoning_effort: import_mini41.z.optional(import_mini41.z.string()),
10868
- sandbox_mode: import_mini41.z.optional(import_mini41.z.string())
11074
+ var import_mini42 = require("zod/mini");
11075
+ var CodexCliSubagentTomlSchema = import_mini42.z.looseObject({
11076
+ name: import_mini42.z.string(),
11077
+ description: import_mini42.z.optional(import_mini42.z.string()),
11078
+ developer_instructions: import_mini42.z.optional(import_mini42.z.string()),
11079
+ model: import_mini42.z.optional(import_mini42.z.string()),
11080
+ model_reasoning_effort: import_mini42.z.optional(import_mini42.z.string()),
11081
+ sandbox_mode: import_mini42.z.optional(import_mini42.z.string())
10869
11082
  });
10870
11083
  var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
10871
11084
  body;
@@ -10876,7 +11089,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
10876
11089
  CodexCliSubagentTomlSchema.parse(parsed);
10877
11090
  } catch (error) {
10878
11091
  throw new Error(
10879
- `Invalid TOML in ${(0, import_node_path83.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
11092
+ `Invalid TOML in ${(0, import_node_path84.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
10880
11093
  { cause: error }
10881
11094
  );
10882
11095
  }
@@ -10888,7 +11101,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
10888
11101
  }
10889
11102
  static getSettablePaths(_options = {}) {
10890
11103
  return {
10891
- relativeDirPath: (0, import_node_path83.join)(".codex", "agents")
11104
+ relativeDirPath: (0, import_node_path84.join)(".codex", "agents")
10892
11105
  };
10893
11106
  }
10894
11107
  getBody() {
@@ -10900,7 +11113,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
10900
11113
  parsed = CodexCliSubagentTomlSchema.parse(smolToml2.parse(this.body));
10901
11114
  } catch (error) {
10902
11115
  throw new Error(
10903
- `Failed to parse TOML in ${(0, import_node_path83.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
11116
+ `Failed to parse TOML in ${(0, import_node_path84.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
10904
11117
  { cause: error }
10905
11118
  );
10906
11119
  }
@@ -10981,7 +11194,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
10981
11194
  global = false
10982
11195
  }) {
10983
11196
  const paths = this.getSettablePaths({ global });
10984
- const filePath = (0, import_node_path83.join)(baseDir, paths.relativeDirPath, relativeFilePath);
11197
+ const filePath = (0, import_node_path84.join)(baseDir, paths.relativeDirPath, relativeFilePath);
10985
11198
  const fileContent = await readFileContent(filePath);
10986
11199
  const subagent = new _CodexCliSubagent({
10987
11200
  baseDir,
@@ -11019,13 +11232,13 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
11019
11232
  };
11020
11233
 
11021
11234
  // src/features/subagents/copilot-subagent.ts
11022
- var import_node_path84 = require("path");
11023
- var import_mini42 = require("zod/mini");
11235
+ var import_node_path85 = require("path");
11236
+ var import_mini43 = require("zod/mini");
11024
11237
  var REQUIRED_TOOL = "agent/runSubagent";
11025
- var CopilotSubagentFrontmatterSchema = import_mini42.z.looseObject({
11026
- name: import_mini42.z.string(),
11027
- description: import_mini42.z.optional(import_mini42.z.string()),
11028
- tools: import_mini42.z.optional(import_mini42.z.union([import_mini42.z.string(), import_mini42.z.array(import_mini42.z.string())]))
11238
+ var CopilotSubagentFrontmatterSchema = import_mini43.z.looseObject({
11239
+ name: import_mini43.z.string(),
11240
+ description: import_mini43.z.optional(import_mini43.z.string()),
11241
+ tools: import_mini43.z.optional(import_mini43.z.union([import_mini43.z.string(), import_mini43.z.array(import_mini43.z.string())]))
11029
11242
  });
11030
11243
  var normalizeTools = (tools) => {
11031
11244
  if (!tools) {
@@ -11045,7 +11258,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
11045
11258
  const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
11046
11259
  if (!result.success) {
11047
11260
  throw new Error(
11048
- `Invalid frontmatter in ${(0, import_node_path84.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
11261
+ `Invalid frontmatter in ${(0, import_node_path85.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
11049
11262
  );
11050
11263
  }
11051
11264
  }
@@ -11057,7 +11270,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
11057
11270
  }
11058
11271
  static getSettablePaths(_options = {}) {
11059
11272
  return {
11060
- relativeDirPath: (0, import_node_path84.join)(".github", "agents")
11273
+ relativeDirPath: (0, import_node_path85.join)(".github", "agents")
11061
11274
  };
11062
11275
  }
11063
11276
  getFrontmatter() {
@@ -11131,7 +11344,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
11131
11344
  return {
11132
11345
  success: false,
11133
11346
  error: new Error(
11134
- `Invalid frontmatter in ${(0, import_node_path84.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
11347
+ `Invalid frontmatter in ${(0, import_node_path85.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
11135
11348
  )
11136
11349
  };
11137
11350
  }
@@ -11149,7 +11362,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
11149
11362
  global = false
11150
11363
  }) {
11151
11364
  const paths = this.getSettablePaths({ global });
11152
- const filePath = (0, import_node_path84.join)(baseDir, paths.relativeDirPath, relativeFilePath);
11365
+ const filePath = (0, import_node_path85.join)(baseDir, paths.relativeDirPath, relativeFilePath);
11153
11366
  const fileContent = await readFileContent(filePath);
11154
11367
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
11155
11368
  const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -11185,11 +11398,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
11185
11398
  };
11186
11399
 
11187
11400
  // src/features/subagents/cursor-subagent.ts
11188
- var import_node_path85 = require("path");
11189
- var import_mini43 = require("zod/mini");
11190
- var CursorSubagentFrontmatterSchema = import_mini43.z.looseObject({
11191
- name: import_mini43.z.string(),
11192
- description: import_mini43.z.optional(import_mini43.z.string())
11401
+ var import_node_path86 = require("path");
11402
+ var import_mini44 = require("zod/mini");
11403
+ var CursorSubagentFrontmatterSchema = import_mini44.z.looseObject({
11404
+ name: import_mini44.z.string(),
11405
+ description: import_mini44.z.optional(import_mini44.z.string())
11193
11406
  });
11194
11407
  var CursorSubagent = class _CursorSubagent extends ToolSubagent {
11195
11408
  frontmatter;
@@ -11199,7 +11412,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
11199
11412
  const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
11200
11413
  if (!result.success) {
11201
11414
  throw new Error(
11202
- `Invalid frontmatter in ${(0, import_node_path85.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
11415
+ `Invalid frontmatter in ${(0, import_node_path86.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
11203
11416
  );
11204
11417
  }
11205
11418
  }
@@ -11211,7 +11424,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
11211
11424
  }
11212
11425
  static getSettablePaths(_options = {}) {
11213
11426
  return {
11214
- relativeDirPath: (0, import_node_path85.join)(".cursor", "agents")
11427
+ relativeDirPath: (0, import_node_path86.join)(".cursor", "agents")
11215
11428
  };
11216
11429
  }
11217
11430
  getFrontmatter() {
@@ -11278,7 +11491,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
11278
11491
  return {
11279
11492
  success: false,
11280
11493
  error: new Error(
11281
- `Invalid frontmatter in ${(0, import_node_path85.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
11494
+ `Invalid frontmatter in ${(0, import_node_path86.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
11282
11495
  )
11283
11496
  };
11284
11497
  }
@@ -11296,7 +11509,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
11296
11509
  global = false
11297
11510
  }) {
11298
11511
  const paths = this.getSettablePaths({ global });
11299
- const filePath = (0, import_node_path85.join)(baseDir, paths.relativeDirPath, relativeFilePath);
11512
+ const filePath = (0, import_node_path86.join)(baseDir, paths.relativeDirPath, relativeFilePath);
11300
11513
  const fileContent = await readFileContent(filePath);
11301
11514
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
11302
11515
  const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -11331,24 +11544,182 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
11331
11544
  }
11332
11545
  };
11333
11546
 
11547
+ // src/features/subagents/junie-subagent.ts
11548
+ var import_node_path87 = require("path");
11549
+ var import_mini45 = require("zod/mini");
11550
+ var JunieSubagentFrontmatterSchema = import_mini45.z.looseObject({
11551
+ name: import_mini45.z.optional(import_mini45.z.string()),
11552
+ description: import_mini45.z.string()
11553
+ });
11554
+ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
11555
+ frontmatter;
11556
+ body;
11557
+ constructor({ frontmatter, body, ...rest }) {
11558
+ if (rest.validate !== false) {
11559
+ const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
11560
+ if (!result.success) {
11561
+ throw new Error(
11562
+ `Invalid frontmatter in ${(0, import_node_path87.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
11563
+ );
11564
+ }
11565
+ }
11566
+ super({
11567
+ ...rest
11568
+ });
11569
+ this.frontmatter = frontmatter;
11570
+ this.body = body;
11571
+ }
11572
+ static getSettablePaths(options = {}) {
11573
+ if (options?.global) {
11574
+ throw new Error("JunieSubagent does not support global mode.");
11575
+ }
11576
+ return {
11577
+ relativeDirPath: (0, import_node_path87.join)(".junie", "agents")
11578
+ };
11579
+ }
11580
+ getFrontmatter() {
11581
+ return this.frontmatter;
11582
+ }
11583
+ getBody() {
11584
+ return this.body;
11585
+ }
11586
+ toRulesyncSubagent() {
11587
+ const { name, description, ...restFields } = this.frontmatter;
11588
+ const junieSection = {
11589
+ ...restFields
11590
+ };
11591
+ const rulesyncFrontmatter = {
11592
+ targets: ["*"],
11593
+ name: name ?? this.getRelativeFilePath().replace(/\.md$/, ""),
11594
+ description,
11595
+ ...Object.keys(junieSection).length > 0 && { junie: junieSection }
11596
+ };
11597
+ return new RulesyncSubagent({
11598
+ baseDir: ".",
11599
+ frontmatter: rulesyncFrontmatter,
11600
+ body: this.body,
11601
+ relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
11602
+ relativeFilePath: this.getRelativeFilePath(),
11603
+ validate: true
11604
+ });
11605
+ }
11606
+ static fromRulesyncSubagent({
11607
+ baseDir = process.cwd(),
11608
+ rulesyncSubagent,
11609
+ validate = true,
11610
+ global = false
11611
+ }) {
11612
+ const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
11613
+ const junieSection = this.filterToolSpecificSection(rulesyncFrontmatter.junie ?? {}, [
11614
+ "name",
11615
+ "description"
11616
+ ]);
11617
+ const rawJunieFrontmatter = {
11618
+ name: rulesyncFrontmatter.name,
11619
+ description: rulesyncFrontmatter.description,
11620
+ ...junieSection
11621
+ };
11622
+ const result = JunieSubagentFrontmatterSchema.safeParse(rawJunieFrontmatter);
11623
+ if (!result.success) {
11624
+ throw new Error(
11625
+ `Invalid junie subagent frontmatter in ${rulesyncSubagent.getRelativeFilePath()}: ${formatError(result.error)}`
11626
+ );
11627
+ }
11628
+ const junieFrontmatter = result.data;
11629
+ const body = rulesyncSubagent.getBody();
11630
+ const fileContent = stringifyFrontmatter(body, junieFrontmatter);
11631
+ const paths = this.getSettablePaths({ global });
11632
+ return new _JunieSubagent({
11633
+ baseDir,
11634
+ frontmatter: junieFrontmatter,
11635
+ body,
11636
+ relativeDirPath: paths.relativeDirPath,
11637
+ relativeFilePath: rulesyncSubagent.getRelativeFilePath(),
11638
+ fileContent,
11639
+ validate
11640
+ });
11641
+ }
11642
+ validate() {
11643
+ if (!this.frontmatter) {
11644
+ return { success: true, error: null };
11645
+ }
11646
+ const result = JunieSubagentFrontmatterSchema.safeParse(this.frontmatter);
11647
+ if (result.success) {
11648
+ return { success: true, error: null };
11649
+ } else {
11650
+ return {
11651
+ success: false,
11652
+ error: new Error(
11653
+ `Invalid frontmatter in ${(0, import_node_path87.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
11654
+ )
11655
+ };
11656
+ }
11657
+ }
11658
+ static isTargetedByRulesyncSubagent(rulesyncSubagent) {
11659
+ return this.isTargetedByRulesyncSubagentDefault({
11660
+ rulesyncSubagent,
11661
+ toolTarget: "junie"
11662
+ });
11663
+ }
11664
+ static async fromFile({
11665
+ baseDir = process.cwd(),
11666
+ relativeFilePath,
11667
+ validate = true,
11668
+ global = false
11669
+ }) {
11670
+ const paths = this.getSettablePaths({ global });
11671
+ const filePath = (0, import_node_path87.join)(baseDir, paths.relativeDirPath, relativeFilePath);
11672
+ const fileContent = await readFileContent(filePath);
11673
+ const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
11674
+ const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
11675
+ if (!result.success) {
11676
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
11677
+ }
11678
+ return new _JunieSubagent({
11679
+ baseDir,
11680
+ relativeDirPath: paths.relativeDirPath,
11681
+ relativeFilePath,
11682
+ frontmatter: result.data,
11683
+ body: content.trim(),
11684
+ fileContent,
11685
+ validate
11686
+ });
11687
+ }
11688
+ static forDeletion({
11689
+ baseDir = process.cwd(),
11690
+ relativeDirPath,
11691
+ relativeFilePath
11692
+ }) {
11693
+ return new _JunieSubagent({
11694
+ baseDir,
11695
+ relativeDirPath,
11696
+ relativeFilePath,
11697
+ frontmatter: { name: "", description: "" },
11698
+ body: "",
11699
+ fileContent: "",
11700
+ validate: false
11701
+ });
11702
+ }
11703
+ };
11704
+
11334
11705
  // src/features/subagents/kiro-subagent.ts
11335
- var import_node_path86 = require("path");
11336
- var import_mini44 = require("zod/mini");
11337
- var KiroCliSubagentJsonSchema = import_mini44.z.looseObject({
11338
- name: import_mini44.z.string(),
11339
- description: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.string())),
11340
- prompt: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.string())),
11341
- tools: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.array(import_mini44.z.string()))),
11342
- toolAliases: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.record(import_mini44.z.string(), import_mini44.z.string()))),
11343
- toolSettings: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.unknown())),
11344
- toolSchema: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.unknown())),
11345
- hooks: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.record(import_mini44.z.string(), import_mini44.z.array(import_mini44.z.unknown())))),
11346
- model: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.string())),
11347
- mcpServers: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.record(import_mini44.z.string(), import_mini44.z.unknown()))),
11348
- useLegacyMcpJson: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.boolean())),
11349
- resources: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.array(import_mini44.z.string()))),
11350
- allowedTools: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.array(import_mini44.z.string()))),
11351
- includeMcpJson: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.boolean()))
11706
+ var import_node_path88 = require("path");
11707
+ var import_mini46 = require("zod/mini");
11708
+ var KiroCliSubagentJsonSchema = import_mini46.z.looseObject({
11709
+ name: import_mini46.z.string(),
11710
+ description: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.string())),
11711
+ prompt: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.string())),
11712
+ tools: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.array(import_mini46.z.string()))),
11713
+ toolAliases: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.record(import_mini46.z.string(), import_mini46.z.string()))),
11714
+ toolSettings: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.unknown())),
11715
+ toolSchema: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.unknown())),
11716
+ hooks: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.record(import_mini46.z.string(), import_mini46.z.array(import_mini46.z.unknown())))),
11717
+ model: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.string())),
11718
+ mcpServers: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.record(import_mini46.z.string(), import_mini46.z.unknown()))),
11719
+ useLegacyMcpJson: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.boolean())),
11720
+ resources: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.array(import_mini46.z.string()))),
11721
+ allowedTools: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.array(import_mini46.z.string()))),
11722
+ includeMcpJson: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.boolean()))
11352
11723
  });
11353
11724
  var KiroSubagent = class _KiroSubagent extends ToolSubagent {
11354
11725
  body;
@@ -11359,7 +11730,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
11359
11730
  KiroCliSubagentJsonSchema.parse(parsed);
11360
11731
  } catch (error) {
11361
11732
  throw new Error(
11362
- `Invalid JSON in ${(0, import_node_path86.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
11733
+ `Invalid JSON in ${(0, import_node_path88.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
11363
11734
  { cause: error }
11364
11735
  );
11365
11736
  }
@@ -11371,7 +11742,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
11371
11742
  }
11372
11743
  static getSettablePaths(_options = {}) {
11373
11744
  return {
11374
- relativeDirPath: (0, import_node_path86.join)(".kiro", "agents")
11745
+ relativeDirPath: (0, import_node_path88.join)(".kiro", "agents")
11375
11746
  };
11376
11747
  }
11377
11748
  getBody() {
@@ -11383,7 +11754,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
11383
11754
  parsed = JSON.parse(this.body);
11384
11755
  } catch (error) {
11385
11756
  throw new Error(
11386
- `Failed to parse JSON in ${(0, import_node_path86.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
11757
+ `Failed to parse JSON in ${(0, import_node_path88.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
11387
11758
  { cause: error }
11388
11759
  );
11389
11760
  }
@@ -11464,7 +11835,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
11464
11835
  global = false
11465
11836
  }) {
11466
11837
  const paths = this.getSettablePaths({ global });
11467
- const filePath = (0, import_node_path86.join)(baseDir, paths.relativeDirPath, relativeFilePath);
11838
+ const filePath = (0, import_node_path88.join)(baseDir, paths.relativeDirPath, relativeFilePath);
11468
11839
  const fileContent = await readFileContent(filePath);
11469
11840
  const subagent = new _KiroSubagent({
11470
11841
  baseDir,
@@ -11502,12 +11873,12 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
11502
11873
  };
11503
11874
 
11504
11875
  // src/features/subagents/opencode-subagent.ts
11505
- var import_node_path87 = require("path");
11506
- var import_mini45 = require("zod/mini");
11507
- var OpenCodeSubagentFrontmatterSchema = import_mini45.z.looseObject({
11508
- description: import_mini45.z.optional(import_mini45.z.string()),
11509
- mode: import_mini45.z._default(import_mini45.z.string(), "subagent"),
11510
- name: import_mini45.z.optional(import_mini45.z.string())
11876
+ var import_node_path89 = require("path");
11877
+ var import_mini47 = require("zod/mini");
11878
+ var OpenCodeSubagentFrontmatterSchema = import_mini47.z.looseObject({
11879
+ description: import_mini47.z.optional(import_mini47.z.string()),
11880
+ mode: import_mini47.z._default(import_mini47.z.string(), "subagent"),
11881
+ name: import_mini47.z.optional(import_mini47.z.string())
11511
11882
  });
11512
11883
  var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
11513
11884
  frontmatter;
@@ -11517,7 +11888,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
11517
11888
  const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
11518
11889
  if (!result.success) {
11519
11890
  throw new Error(
11520
- `Invalid frontmatter in ${(0, import_node_path87.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
11891
+ `Invalid frontmatter in ${(0, import_node_path89.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
11521
11892
  );
11522
11893
  }
11523
11894
  }
@@ -11531,7 +11902,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
11531
11902
  global = false
11532
11903
  } = {}) {
11533
11904
  return {
11534
- relativeDirPath: global ? (0, import_node_path87.join)(".config", "opencode", "agent") : (0, import_node_path87.join)(".opencode", "agent")
11905
+ relativeDirPath: global ? (0, import_node_path89.join)(".config", "opencode", "agent") : (0, import_node_path89.join)(".opencode", "agent")
11535
11906
  };
11536
11907
  }
11537
11908
  getFrontmatter() {
@@ -11544,7 +11915,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
11544
11915
  const { description, mode, name, ...opencodeSection } = this.frontmatter;
11545
11916
  const rulesyncFrontmatter = {
11546
11917
  targets: ["*"],
11547
- name: name ?? (0, import_node_path87.basename)(this.getRelativeFilePath(), ".md"),
11918
+ name: name ?? (0, import_node_path89.basename)(this.getRelativeFilePath(), ".md"),
11548
11919
  description,
11549
11920
  opencode: { mode, ...opencodeSection }
11550
11921
  };
@@ -11597,7 +11968,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
11597
11968
  return {
11598
11969
  success: false,
11599
11970
  error: new Error(
11600
- `Invalid frontmatter in ${(0, import_node_path87.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
11971
+ `Invalid frontmatter in ${(0, import_node_path89.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
11601
11972
  )
11602
11973
  };
11603
11974
  }
@@ -11614,7 +11985,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
11614
11985
  global = false
11615
11986
  }) {
11616
11987
  const paths = this.getSettablePaths({ global });
11617
- const filePath = (0, import_node_path87.join)(baseDir, paths.relativeDirPath, relativeFilePath);
11988
+ const filePath = (0, import_node_path89.join)(baseDir, paths.relativeDirPath, relativeFilePath);
11618
11989
  const fileContent = await readFileContent(filePath);
11619
11990
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
11620
11991
  const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -11659,11 +12030,12 @@ var subagentsProcessorToolTargetTuple = [
11659
12030
  "cursor",
11660
12031
  "factorydroid",
11661
12032
  "geminicli",
12033
+ "junie",
11662
12034
  "kiro",
11663
12035
  "opencode",
11664
12036
  "roo"
11665
12037
  ];
11666
- var SubagentsProcessorToolTargetSchema = import_mini46.z.enum(subagentsProcessorToolTargetTuple);
12038
+ var SubagentsProcessorToolTargetSchema = import_mini48.z.enum(subagentsProcessorToolTargetTuple);
11667
12039
  var toolSubagentFactories = /* @__PURE__ */ new Map([
11668
12040
  [
11669
12041
  "agentsmd",
@@ -11721,6 +12093,13 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
11721
12093
  meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
11722
12094
  }
11723
12095
  ],
12096
+ [
12097
+ "junie",
12098
+ {
12099
+ class: JunieSubagent,
12100
+ meta: { supportsSimulated: false, supportsGlobal: false, filePattern: "*.md" }
12101
+ }
12102
+ ],
11724
12103
  [
11725
12104
  "kiro",
11726
12105
  {
@@ -11825,7 +12204,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
11825
12204
  * Load and parse rulesync subagent files from .rulesync/subagents/ directory
11826
12205
  */
11827
12206
  async loadRulesyncFiles() {
11828
- const subagentsDir = (0, import_node_path88.join)(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
12207
+ const subagentsDir = (0, import_node_path90.join)(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
11829
12208
  const dirExists = await directoryExists(subagentsDir);
11830
12209
  if (!dirExists) {
11831
12210
  logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
@@ -11840,7 +12219,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
11840
12219
  logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
11841
12220
  const rulesyncSubagents = [];
11842
12221
  for (const mdFile of mdFiles) {
11843
- const filepath = (0, import_node_path88.join)(subagentsDir, mdFile);
12222
+ const filepath = (0, import_node_path90.join)(subagentsDir, mdFile);
11844
12223
  try {
11845
12224
  const rulesyncSubagent = await RulesyncSubagent.fromFile({
11846
12225
  relativeFilePath: mdFile,
@@ -11870,14 +12249,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
11870
12249
  const factory = this.getFactory(this.toolTarget);
11871
12250
  const paths = factory.class.getSettablePaths({ global: this.global });
11872
12251
  const subagentFilePaths = await findFilesByGlobs(
11873
- (0, import_node_path88.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
12252
+ (0, import_node_path90.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
11874
12253
  );
11875
12254
  if (forDeletion) {
11876
12255
  const toolSubagents2 = subagentFilePaths.map(
11877
12256
  (path4) => factory.class.forDeletion({
11878
12257
  baseDir: this.baseDir,
11879
12258
  relativeDirPath: paths.relativeDirPath,
11880
- relativeFilePath: (0, import_node_path88.basename)(path4),
12259
+ relativeFilePath: (0, import_node_path90.basename)(path4),
11881
12260
  global: this.global
11882
12261
  })
11883
12262
  ).filter((subagent) => subagent.isDeletable());
@@ -11890,7 +12269,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
11890
12269
  subagentFilePaths.map(
11891
12270
  (path4) => factory.class.fromFile({
11892
12271
  baseDir: this.baseDir,
11893
- relativeFilePath: (0, import_node_path88.basename)(path4),
12272
+ relativeFilePath: (0, import_node_path90.basename)(path4),
11894
12273
  global: this.global
11895
12274
  })
11896
12275
  )
@@ -11935,49 +12314,49 @@ var SubagentsProcessor = class extends FeatureProcessor {
11935
12314
  };
11936
12315
 
11937
12316
  // src/features/rules/agentsmd-rule.ts
11938
- var import_node_path91 = require("path");
12317
+ var import_node_path93 = require("path");
11939
12318
 
11940
12319
  // src/features/rules/tool-rule.ts
11941
- var import_node_path90 = require("path");
12320
+ var import_node_path92 = require("path");
11942
12321
 
11943
12322
  // src/features/rules/rulesync-rule.ts
11944
- var import_node_path89 = require("path");
11945
- var import_mini47 = require("zod/mini");
11946
- var RulesyncRuleFrontmatterSchema = import_mini47.z.object({
11947
- root: import_mini47.z.optional(import_mini47.z.boolean()),
11948
- localRoot: import_mini47.z.optional(import_mini47.z.boolean()),
11949
- targets: import_mini47.z._default(RulesyncTargetsSchema, ["*"]),
11950
- description: import_mini47.z.optional(import_mini47.z.string()),
11951
- globs: import_mini47.z.optional(import_mini47.z.array(import_mini47.z.string())),
11952
- agentsmd: import_mini47.z.optional(
11953
- import_mini47.z.object({
12323
+ var import_node_path91 = require("path");
12324
+ var import_mini49 = require("zod/mini");
12325
+ var RulesyncRuleFrontmatterSchema = import_mini49.z.object({
12326
+ root: import_mini49.z.optional(import_mini49.z.boolean()),
12327
+ localRoot: import_mini49.z.optional(import_mini49.z.boolean()),
12328
+ targets: import_mini49.z._default(RulesyncTargetsSchema, ["*"]),
12329
+ description: import_mini49.z.optional(import_mini49.z.string()),
12330
+ globs: import_mini49.z.optional(import_mini49.z.array(import_mini49.z.string())),
12331
+ agentsmd: import_mini49.z.optional(
12332
+ import_mini49.z.object({
11954
12333
  // @example "path/to/subproject"
11955
- subprojectPath: import_mini47.z.optional(import_mini47.z.string())
12334
+ subprojectPath: import_mini49.z.optional(import_mini49.z.string())
11956
12335
  })
11957
12336
  ),
11958
- claudecode: import_mini47.z.optional(
11959
- import_mini47.z.object({
12337
+ claudecode: import_mini49.z.optional(
12338
+ import_mini49.z.object({
11960
12339
  // Glob patterns for conditional rules (takes precedence over globs)
11961
12340
  // @example ["src/**/*.ts", "tests/**/*.test.ts"]
11962
- paths: import_mini47.z.optional(import_mini47.z.array(import_mini47.z.string()))
12341
+ paths: import_mini49.z.optional(import_mini49.z.array(import_mini49.z.string()))
11963
12342
  })
11964
12343
  ),
11965
- cursor: import_mini47.z.optional(
11966
- import_mini47.z.object({
11967
- alwaysApply: import_mini47.z.optional(import_mini47.z.boolean()),
11968
- description: import_mini47.z.optional(import_mini47.z.string()),
11969
- globs: import_mini47.z.optional(import_mini47.z.array(import_mini47.z.string()))
12344
+ cursor: import_mini49.z.optional(
12345
+ import_mini49.z.object({
12346
+ alwaysApply: import_mini49.z.optional(import_mini49.z.boolean()),
12347
+ description: import_mini49.z.optional(import_mini49.z.string()),
12348
+ globs: import_mini49.z.optional(import_mini49.z.array(import_mini49.z.string()))
11970
12349
  })
11971
12350
  ),
11972
- copilot: import_mini47.z.optional(
11973
- import_mini47.z.object({
11974
- excludeAgent: import_mini47.z.optional(import_mini47.z.union([import_mini47.z.literal("code-review"), import_mini47.z.literal("coding-agent")]))
12351
+ copilot: import_mini49.z.optional(
12352
+ import_mini49.z.object({
12353
+ excludeAgent: import_mini49.z.optional(import_mini49.z.union([import_mini49.z.literal("code-review"), import_mini49.z.literal("coding-agent")]))
11975
12354
  })
11976
12355
  ),
11977
- antigravity: import_mini47.z.optional(
11978
- import_mini47.z.looseObject({
11979
- trigger: import_mini47.z.optional(import_mini47.z.string()),
11980
- globs: import_mini47.z.optional(import_mini47.z.array(import_mini47.z.string()))
12356
+ antigravity: import_mini49.z.optional(
12357
+ import_mini49.z.looseObject({
12358
+ trigger: import_mini49.z.optional(import_mini49.z.string()),
12359
+ globs: import_mini49.z.optional(import_mini49.z.array(import_mini49.z.string()))
11981
12360
  })
11982
12361
  )
11983
12362
  });
@@ -11988,7 +12367,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
11988
12367
  const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
11989
12368
  if (!parseResult.success && rest.validate !== false) {
11990
12369
  throw new Error(
11991
- `Invalid frontmatter in ${(0, import_node_path89.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
12370
+ `Invalid frontmatter in ${(0, import_node_path91.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
11992
12371
  );
11993
12372
  }
11994
12373
  const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
@@ -12023,7 +12402,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
12023
12402
  return {
12024
12403
  success: false,
12025
12404
  error: new Error(
12026
- `Invalid frontmatter in ${(0, import_node_path89.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
12405
+ `Invalid frontmatter in ${(0, import_node_path91.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
12027
12406
  )
12028
12407
  };
12029
12408
  }
@@ -12032,7 +12411,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
12032
12411
  relativeFilePath,
12033
12412
  validate = true
12034
12413
  }) {
12035
- const filePath = (0, import_node_path89.join)(
12414
+ const filePath = (0, import_node_path91.join)(
12036
12415
  process.cwd(),
12037
12416
  this.getSettablePaths().recommended.relativeDirPath,
12038
12417
  relativeFilePath
@@ -12134,7 +12513,7 @@ var ToolRule = class extends ToolFile {
12134
12513
  rulesyncRule,
12135
12514
  validate = true,
12136
12515
  rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
12137
- nonRootPath = { relativeDirPath: (0, import_node_path90.join)(".agents", "memories") }
12516
+ nonRootPath = { relativeDirPath: (0, import_node_path92.join)(".agents", "memories") }
12138
12517
  }) {
12139
12518
  const params = this.buildToolRuleParamsDefault({
12140
12519
  baseDir,
@@ -12145,7 +12524,7 @@ var ToolRule = class extends ToolFile {
12145
12524
  });
12146
12525
  const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
12147
12526
  if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
12148
- params.relativeDirPath = (0, import_node_path90.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
12527
+ params.relativeDirPath = (0, import_node_path92.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
12149
12528
  params.relativeFilePath = "AGENTS.md";
12150
12529
  }
12151
12530
  return params;
@@ -12194,7 +12573,7 @@ var ToolRule = class extends ToolFile {
12194
12573
  }
12195
12574
  };
12196
12575
  function buildToolPath(toolDir, subDir, excludeToolDir) {
12197
- return excludeToolDir ? subDir : (0, import_node_path90.join)(toolDir, subDir);
12576
+ return excludeToolDir ? subDir : (0, import_node_path92.join)(toolDir, subDir);
12198
12577
  }
12199
12578
 
12200
12579
  // src/features/rules/agentsmd-rule.ts
@@ -12223,8 +12602,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
12223
12602
  validate = true
12224
12603
  }) {
12225
12604
  const isRoot = relativeFilePath === "AGENTS.md";
12226
- const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path91.join)(".agents", "memories", relativeFilePath);
12227
- const fileContent = await readFileContent((0, import_node_path91.join)(baseDir, relativePath));
12605
+ const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path93.join)(".agents", "memories", relativeFilePath);
12606
+ const fileContent = await readFileContent((0, import_node_path93.join)(baseDir, relativePath));
12228
12607
  return new _AgentsMdRule({
12229
12608
  baseDir,
12230
12609
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -12279,21 +12658,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
12279
12658
  };
12280
12659
 
12281
12660
  // src/features/rules/antigravity-rule.ts
12282
- var import_node_path92 = require("path");
12283
- var import_mini48 = require("zod/mini");
12284
- var AntigravityRuleFrontmatterSchema = import_mini48.z.looseObject({
12285
- trigger: import_mini48.z.optional(
12286
- import_mini48.z.union([
12287
- import_mini48.z.literal("always_on"),
12288
- import_mini48.z.literal("glob"),
12289
- import_mini48.z.literal("manual"),
12290
- import_mini48.z.literal("model_decision"),
12291
- import_mini48.z.string()
12661
+ var import_node_path94 = require("path");
12662
+ var import_mini50 = require("zod/mini");
12663
+ var AntigravityRuleFrontmatterSchema = import_mini50.z.looseObject({
12664
+ trigger: import_mini50.z.optional(
12665
+ import_mini50.z.union([
12666
+ import_mini50.z.literal("always_on"),
12667
+ import_mini50.z.literal("glob"),
12668
+ import_mini50.z.literal("manual"),
12669
+ import_mini50.z.literal("model_decision"),
12670
+ import_mini50.z.string()
12292
12671
  // accepts any string for forward compatibility
12293
12672
  ])
12294
12673
  ),
12295
- globs: import_mini48.z.optional(import_mini48.z.string()),
12296
- description: import_mini48.z.optional(import_mini48.z.string())
12674
+ globs: import_mini50.z.optional(import_mini50.z.string()),
12675
+ description: import_mini50.z.optional(import_mini50.z.string())
12297
12676
  });
12298
12677
  function parseGlobsString(globs) {
12299
12678
  if (!globs) {
@@ -12438,7 +12817,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
12438
12817
  const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
12439
12818
  if (!result.success) {
12440
12819
  throw new Error(
12441
- `Invalid frontmatter in ${(0, import_node_path92.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
12820
+ `Invalid frontmatter in ${(0, import_node_path94.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
12442
12821
  );
12443
12822
  }
12444
12823
  }
@@ -12462,7 +12841,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
12462
12841
  relativeFilePath,
12463
12842
  validate = true
12464
12843
  }) {
12465
- const filePath = (0, import_node_path92.join)(
12844
+ const filePath = (0, import_node_path94.join)(
12466
12845
  baseDir,
12467
12846
  this.getSettablePaths().nonRoot.relativeDirPath,
12468
12847
  relativeFilePath
@@ -12602,7 +12981,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
12602
12981
  };
12603
12982
 
12604
12983
  // src/features/rules/augmentcode-legacy-rule.ts
12605
- var import_node_path93 = require("path");
12984
+ var import_node_path95 = require("path");
12606
12985
  var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
12607
12986
  toRulesyncRule() {
12608
12987
  const rulesyncFrontmatter = {
@@ -12662,8 +13041,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
12662
13041
  }) {
12663
13042
  const settablePaths = this.getSettablePaths();
12664
13043
  const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
12665
- const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path93.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
12666
- const fileContent = await readFileContent((0, import_node_path93.join)(baseDir, relativePath));
13044
+ const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path95.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
13045
+ const fileContent = await readFileContent((0, import_node_path95.join)(baseDir, relativePath));
12667
13046
  return new _AugmentcodeLegacyRule({
12668
13047
  baseDir,
12669
13048
  relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
@@ -12692,7 +13071,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
12692
13071
  };
12693
13072
 
12694
13073
  // src/features/rules/augmentcode-rule.ts
12695
- var import_node_path94 = require("path");
13074
+ var import_node_path96 = require("path");
12696
13075
  var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
12697
13076
  toRulesyncRule() {
12698
13077
  return this.toRulesyncRuleDefault();
@@ -12723,7 +13102,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
12723
13102
  relativeFilePath,
12724
13103
  validate = true
12725
13104
  }) {
12726
- const filePath = (0, import_node_path94.join)(
13105
+ const filePath = (0, import_node_path96.join)(
12727
13106
  baseDir,
12728
13107
  this.getSettablePaths().nonRoot.relativeDirPath,
12729
13108
  relativeFilePath
@@ -12763,7 +13142,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
12763
13142
  };
12764
13143
 
12765
13144
  // src/features/rules/claudecode-legacy-rule.ts
12766
- var import_node_path95 = require("path");
13145
+ var import_node_path97 = require("path");
12767
13146
  var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
12768
13147
  static getSettablePaths({
12769
13148
  global,
@@ -12805,7 +13184,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
12805
13184
  if (isRoot) {
12806
13185
  const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
12807
13186
  const fileContent2 = await readFileContent(
12808
- (0, import_node_path95.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
13187
+ (0, import_node_path97.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
12809
13188
  );
12810
13189
  return new _ClaudecodeLegacyRule({
12811
13190
  baseDir,
@@ -12819,8 +13198,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
12819
13198
  if (!paths.nonRoot) {
12820
13199
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
12821
13200
  }
12822
- const relativePath = (0, import_node_path95.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
12823
- const fileContent = await readFileContent((0, import_node_path95.join)(baseDir, relativePath));
13201
+ const relativePath = (0, import_node_path97.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
13202
+ const fileContent = await readFileContent((0, import_node_path97.join)(baseDir, relativePath));
12824
13203
  return new _ClaudecodeLegacyRule({
12825
13204
  baseDir,
12826
13205
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -12879,10 +13258,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
12879
13258
  };
12880
13259
 
12881
13260
  // src/features/rules/claudecode-rule.ts
12882
- var import_node_path96 = require("path");
12883
- var import_mini49 = require("zod/mini");
12884
- var ClaudecodeRuleFrontmatterSchema = import_mini49.z.object({
12885
- paths: import_mini49.z.optional(import_mini49.z.array(import_mini49.z.string()))
13261
+ var import_node_path98 = require("path");
13262
+ var import_mini51 = require("zod/mini");
13263
+ var ClaudecodeRuleFrontmatterSchema = import_mini51.z.object({
13264
+ paths: import_mini51.z.optional(import_mini51.z.array(import_mini51.z.string()))
12886
13265
  });
12887
13266
  var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
12888
13267
  frontmatter;
@@ -12920,7 +13299,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
12920
13299
  const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
12921
13300
  if (!result.success) {
12922
13301
  throw new Error(
12923
- `Invalid frontmatter in ${(0, import_node_path96.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
13302
+ `Invalid frontmatter in ${(0, import_node_path98.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
12924
13303
  );
12925
13304
  }
12926
13305
  }
@@ -12950,7 +13329,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
12950
13329
  if (isRoot) {
12951
13330
  const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
12952
13331
  const fileContent2 = await readFileContent(
12953
- (0, import_node_path96.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
13332
+ (0, import_node_path98.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
12954
13333
  );
12955
13334
  return new _ClaudecodeRule({
12956
13335
  baseDir,
@@ -12965,8 +13344,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
12965
13344
  if (!paths.nonRoot) {
12966
13345
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
12967
13346
  }
12968
- const relativePath = (0, import_node_path96.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
12969
- const filePath = (0, import_node_path96.join)(baseDir, relativePath);
13347
+ const relativePath = (0, import_node_path98.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
13348
+ const filePath = (0, import_node_path98.join)(baseDir, relativePath);
12970
13349
  const fileContent = await readFileContent(filePath);
12971
13350
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
12972
13351
  const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
@@ -13077,7 +13456,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
13077
13456
  return {
13078
13457
  success: false,
13079
13458
  error: new Error(
13080
- `Invalid frontmatter in ${(0, import_node_path96.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
13459
+ `Invalid frontmatter in ${(0, import_node_path98.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
13081
13460
  )
13082
13461
  };
13083
13462
  }
@@ -13097,10 +13476,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
13097
13476
  };
13098
13477
 
13099
13478
  // src/features/rules/cline-rule.ts
13100
- var import_node_path97 = require("path");
13101
- var import_mini50 = require("zod/mini");
13102
- var ClineRuleFrontmatterSchema = import_mini50.z.object({
13103
- description: import_mini50.z.string()
13479
+ var import_node_path99 = require("path");
13480
+ var import_mini52 = require("zod/mini");
13481
+ var ClineRuleFrontmatterSchema = import_mini52.z.object({
13482
+ description: import_mini52.z.string()
13104
13483
  });
13105
13484
  var ClineRule = class _ClineRule extends ToolRule {
13106
13485
  static getSettablePaths(_options = {}) {
@@ -13143,7 +13522,7 @@ var ClineRule = class _ClineRule extends ToolRule {
13143
13522
  validate = true
13144
13523
  }) {
13145
13524
  const fileContent = await readFileContent(
13146
- (0, import_node_path97.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
13525
+ (0, import_node_path99.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
13147
13526
  );
13148
13527
  return new _ClineRule({
13149
13528
  baseDir,
@@ -13169,7 +13548,7 @@ var ClineRule = class _ClineRule extends ToolRule {
13169
13548
  };
13170
13549
 
13171
13550
  // src/features/rules/codexcli-rule.ts
13172
- var import_node_path98 = require("path");
13551
+ var import_node_path100 = require("path");
13173
13552
  var CodexcliRule = class _CodexcliRule extends ToolRule {
13174
13553
  static getSettablePaths({
13175
13554
  global,
@@ -13204,7 +13583,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
13204
13583
  if (isRoot) {
13205
13584
  const relativePath2 = paths.root.relativeFilePath;
13206
13585
  const fileContent2 = await readFileContent(
13207
- (0, import_node_path98.join)(baseDir, paths.root.relativeDirPath, relativePath2)
13586
+ (0, import_node_path100.join)(baseDir, paths.root.relativeDirPath, relativePath2)
13208
13587
  );
13209
13588
  return new _CodexcliRule({
13210
13589
  baseDir,
@@ -13218,8 +13597,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
13218
13597
  if (!paths.nonRoot) {
13219
13598
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
13220
13599
  }
13221
- const relativePath = (0, import_node_path98.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
13222
- const fileContent = await readFileContent((0, import_node_path98.join)(baseDir, relativePath));
13600
+ const relativePath = (0, import_node_path100.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
13601
+ const fileContent = await readFileContent((0, import_node_path100.join)(baseDir, relativePath));
13223
13602
  return new _CodexcliRule({
13224
13603
  baseDir,
13225
13604
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -13278,12 +13657,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
13278
13657
  };
13279
13658
 
13280
13659
  // src/features/rules/copilot-rule.ts
13281
- var import_node_path99 = require("path");
13282
- var import_mini51 = require("zod/mini");
13283
- var CopilotRuleFrontmatterSchema = import_mini51.z.object({
13284
- description: import_mini51.z.optional(import_mini51.z.string()),
13285
- applyTo: import_mini51.z.optional(import_mini51.z.string()),
13286
- excludeAgent: import_mini51.z.optional(import_mini51.z.union([import_mini51.z.literal("code-review"), import_mini51.z.literal("coding-agent")]))
13660
+ var import_node_path101 = require("path");
13661
+ var import_mini53 = require("zod/mini");
13662
+ var CopilotRuleFrontmatterSchema = import_mini53.z.object({
13663
+ description: import_mini53.z.optional(import_mini53.z.string()),
13664
+ applyTo: import_mini53.z.optional(import_mini53.z.string()),
13665
+ excludeAgent: import_mini53.z.optional(import_mini53.z.union([import_mini53.z.literal("code-review"), import_mini53.z.literal("coding-agent")]))
13287
13666
  });
13288
13667
  var CopilotRule = class _CopilotRule extends ToolRule {
13289
13668
  frontmatter;
@@ -13294,6 +13673,9 @@ var CopilotRule = class _CopilotRule extends ToolRule {
13294
13673
  root: {
13295
13674
  relativeDirPath: buildToolPath(".copilot", ".", options.excludeToolDir),
13296
13675
  relativeFilePath: "copilot-instructions.md"
13676
+ },
13677
+ nonRoot: {
13678
+ relativeDirPath: buildToolPath(".copilot", "instructions", options.excludeToolDir)
13297
13679
  }
13298
13680
  };
13299
13681
  }
@@ -13312,7 +13694,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
13312
13694
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
13313
13695
  if (!result.success) {
13314
13696
  throw new Error(
13315
- `Invalid frontmatter in ${(0, import_node_path99.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
13697
+ `Invalid frontmatter in ${(0, import_node_path101.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
13316
13698
  );
13317
13699
  }
13318
13700
  }
@@ -13402,8 +13784,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
13402
13784
  const paths = this.getSettablePaths({ global });
13403
13785
  const isRoot = relativeFilePath === paths.root.relativeFilePath;
13404
13786
  if (isRoot) {
13405
- const relativePath2 = (0, import_node_path99.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
13406
- const filePath2 = (0, import_node_path99.join)(baseDir, relativePath2);
13787
+ const relativePath2 = (0, import_node_path101.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
13788
+ const filePath2 = (0, import_node_path101.join)(baseDir, relativePath2);
13407
13789
  const fileContent2 = await readFileContent(filePath2);
13408
13790
  return new _CopilotRule({
13409
13791
  baseDir,
@@ -13418,8 +13800,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
13418
13800
  if (!paths.nonRoot) {
13419
13801
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
13420
13802
  }
13421
- const relativePath = (0, import_node_path99.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
13422
- const filePath = (0, import_node_path99.join)(baseDir, relativePath);
13803
+ const relativePath = (0, import_node_path101.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
13804
+ const filePath = (0, import_node_path101.join)(baseDir, relativePath);
13423
13805
  const fileContent = await readFileContent(filePath);
13424
13806
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
13425
13807
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
@@ -13465,7 +13847,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
13465
13847
  return {
13466
13848
  success: false,
13467
13849
  error: new Error(
13468
- `Invalid frontmatter in ${(0, import_node_path99.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
13850
+ `Invalid frontmatter in ${(0, import_node_path101.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
13469
13851
  )
13470
13852
  };
13471
13853
  }
@@ -13485,12 +13867,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
13485
13867
  };
13486
13868
 
13487
13869
  // src/features/rules/cursor-rule.ts
13488
- var import_node_path100 = require("path");
13489
- var import_mini52 = require("zod/mini");
13490
- var CursorRuleFrontmatterSchema = import_mini52.z.object({
13491
- description: import_mini52.z.optional(import_mini52.z.string()),
13492
- globs: import_mini52.z.optional(import_mini52.z.string()),
13493
- alwaysApply: import_mini52.z.optional(import_mini52.z.boolean())
13870
+ var import_node_path102 = require("path");
13871
+ var import_mini54 = require("zod/mini");
13872
+ var CursorRuleFrontmatterSchema = import_mini54.z.object({
13873
+ description: import_mini54.z.optional(import_mini54.z.string()),
13874
+ globs: import_mini54.z.optional(import_mini54.z.string()),
13875
+ alwaysApply: import_mini54.z.optional(import_mini54.z.boolean())
13494
13876
  });
13495
13877
  var CursorRule = class _CursorRule extends ToolRule {
13496
13878
  frontmatter;
@@ -13507,7 +13889,7 @@ var CursorRule = class _CursorRule extends ToolRule {
13507
13889
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
13508
13890
  if (!result.success) {
13509
13891
  throw new Error(
13510
- `Invalid frontmatter in ${(0, import_node_path100.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
13892
+ `Invalid frontmatter in ${(0, import_node_path102.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
13511
13893
  );
13512
13894
  }
13513
13895
  }
@@ -13623,7 +14005,7 @@ var CursorRule = class _CursorRule extends ToolRule {
13623
14005
  relativeFilePath,
13624
14006
  validate = true
13625
14007
  }) {
13626
- const filePath = (0, import_node_path100.join)(
14008
+ const filePath = (0, import_node_path102.join)(
13627
14009
  baseDir,
13628
14010
  this.getSettablePaths().nonRoot.relativeDirPath,
13629
14011
  relativeFilePath
@@ -13633,7 +14015,7 @@ var CursorRule = class _CursorRule extends ToolRule {
13633
14015
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
13634
14016
  if (!result.success) {
13635
14017
  throw new Error(
13636
- `Invalid frontmatter in ${(0, import_node_path100.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
14018
+ `Invalid frontmatter in ${(0, import_node_path102.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
13637
14019
  );
13638
14020
  }
13639
14021
  return new _CursorRule({
@@ -13670,7 +14052,7 @@ var CursorRule = class _CursorRule extends ToolRule {
13670
14052
  return {
13671
14053
  success: false,
13672
14054
  error: new Error(
13673
- `Invalid frontmatter in ${(0, import_node_path100.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
14055
+ `Invalid frontmatter in ${(0, import_node_path102.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
13674
14056
  )
13675
14057
  };
13676
14058
  }
@@ -13690,7 +14072,7 @@ var CursorRule = class _CursorRule extends ToolRule {
13690
14072
  };
13691
14073
 
13692
14074
  // src/features/rules/factorydroid-rule.ts
13693
- var import_node_path101 = require("path");
14075
+ var import_node_path103 = require("path");
13694
14076
  var FactorydroidRule = class _FactorydroidRule extends ToolRule {
13695
14077
  constructor({ fileContent, root, ...rest }) {
13696
14078
  super({
@@ -13730,8 +14112,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
13730
14112
  const paths = this.getSettablePaths({ global });
13731
14113
  const isRoot = relativeFilePath === paths.root.relativeFilePath;
13732
14114
  if (isRoot) {
13733
- const relativePath2 = (0, import_node_path101.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
13734
- const fileContent2 = await readFileContent((0, import_node_path101.join)(baseDir, relativePath2));
14115
+ const relativePath2 = (0, import_node_path103.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
14116
+ const fileContent2 = await readFileContent((0, import_node_path103.join)(baseDir, relativePath2));
13735
14117
  return new _FactorydroidRule({
13736
14118
  baseDir,
13737
14119
  relativeDirPath: paths.root.relativeDirPath,
@@ -13744,8 +14126,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
13744
14126
  if (!paths.nonRoot) {
13745
14127
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
13746
14128
  }
13747
- const relativePath = (0, import_node_path101.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
13748
- const fileContent = await readFileContent((0, import_node_path101.join)(baseDir, relativePath));
14129
+ const relativePath = (0, import_node_path103.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
14130
+ const fileContent = await readFileContent((0, import_node_path103.join)(baseDir, relativePath));
13749
14131
  return new _FactorydroidRule({
13750
14132
  baseDir,
13751
14133
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -13804,7 +14186,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
13804
14186
  };
13805
14187
 
13806
14188
  // src/features/rules/geminicli-rule.ts
13807
- var import_node_path102 = require("path");
14189
+ var import_node_path104 = require("path");
13808
14190
  var GeminiCliRule = class _GeminiCliRule extends ToolRule {
13809
14191
  static getSettablePaths({
13810
14192
  global,
@@ -13839,7 +14221,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
13839
14221
  if (isRoot) {
13840
14222
  const relativePath2 = paths.root.relativeFilePath;
13841
14223
  const fileContent2 = await readFileContent(
13842
- (0, import_node_path102.join)(baseDir, paths.root.relativeDirPath, relativePath2)
14224
+ (0, import_node_path104.join)(baseDir, paths.root.relativeDirPath, relativePath2)
13843
14225
  );
13844
14226
  return new _GeminiCliRule({
13845
14227
  baseDir,
@@ -13853,8 +14235,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
13853
14235
  if (!paths.nonRoot) {
13854
14236
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
13855
14237
  }
13856
- const relativePath = (0, import_node_path102.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
13857
- const fileContent = await readFileContent((0, import_node_path102.join)(baseDir, relativePath));
14238
+ const relativePath = (0, import_node_path104.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
14239
+ const fileContent = await readFileContent((0, import_node_path104.join)(baseDir, relativePath));
13858
14240
  return new _GeminiCliRule({
13859
14241
  baseDir,
13860
14242
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -13913,7 +14295,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
13913
14295
  };
13914
14296
 
13915
14297
  // src/features/rules/goose-rule.ts
13916
- var import_node_path103 = require("path");
14298
+ var import_node_path105 = require("path");
13917
14299
  var GooseRule = class _GooseRule extends ToolRule {
13918
14300
  static getSettablePaths({
13919
14301
  global,
@@ -13948,7 +14330,7 @@ var GooseRule = class _GooseRule extends ToolRule {
13948
14330
  if (isRoot) {
13949
14331
  const relativePath2 = paths.root.relativeFilePath;
13950
14332
  const fileContent2 = await readFileContent(
13951
- (0, import_node_path103.join)(baseDir, paths.root.relativeDirPath, relativePath2)
14333
+ (0, import_node_path105.join)(baseDir, paths.root.relativeDirPath, relativePath2)
13952
14334
  );
13953
14335
  return new _GooseRule({
13954
14336
  baseDir,
@@ -13962,8 +14344,8 @@ var GooseRule = class _GooseRule extends ToolRule {
13962
14344
  if (!paths.nonRoot) {
13963
14345
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
13964
14346
  }
13965
- const relativePath = (0, import_node_path103.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
13966
- const fileContent = await readFileContent((0, import_node_path103.join)(baseDir, relativePath));
14347
+ const relativePath = (0, import_node_path105.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
14348
+ const fileContent = await readFileContent((0, import_node_path105.join)(baseDir, relativePath));
13967
14349
  return new _GooseRule({
13968
14350
  baseDir,
13969
14351
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -14022,7 +14404,7 @@ var GooseRule = class _GooseRule extends ToolRule {
14022
14404
  };
14023
14405
 
14024
14406
  // src/features/rules/junie-rule.ts
14025
- var import_node_path104 = require("path");
14407
+ var import_node_path106 = require("path");
14026
14408
  var JunieRule = class _JunieRule extends ToolRule {
14027
14409
  static getSettablePaths(_options = {}) {
14028
14410
  return {
@@ -14041,8 +14423,8 @@ var JunieRule = class _JunieRule extends ToolRule {
14041
14423
  validate = true
14042
14424
  }) {
14043
14425
  const isRoot = relativeFilePath === "guidelines.md";
14044
- const relativePath = isRoot ? "guidelines.md" : (0, import_node_path104.join)(".junie", "memories", relativeFilePath);
14045
- const fileContent = await readFileContent((0, import_node_path104.join)(baseDir, relativePath));
14426
+ const relativePath = isRoot ? "guidelines.md" : (0, import_node_path106.join)(".junie", "memories", relativeFilePath);
14427
+ const fileContent = await readFileContent((0, import_node_path106.join)(baseDir, relativePath));
14046
14428
  return new _JunieRule({
14047
14429
  baseDir,
14048
14430
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -14097,7 +14479,7 @@ var JunieRule = class _JunieRule extends ToolRule {
14097
14479
  };
14098
14480
 
14099
14481
  // src/features/rules/kilo-rule.ts
14100
- var import_node_path105 = require("path");
14482
+ var import_node_path107 = require("path");
14101
14483
  var KiloRule = class _KiloRule extends ToolRule {
14102
14484
  static getSettablePaths(_options = {}) {
14103
14485
  return {
@@ -14112,7 +14494,7 @@ var KiloRule = class _KiloRule extends ToolRule {
14112
14494
  validate = true
14113
14495
  }) {
14114
14496
  const fileContent = await readFileContent(
14115
- (0, import_node_path105.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
14497
+ (0, import_node_path107.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
14116
14498
  );
14117
14499
  return new _KiloRule({
14118
14500
  baseDir,
@@ -14164,7 +14546,7 @@ var KiloRule = class _KiloRule extends ToolRule {
14164
14546
  };
14165
14547
 
14166
14548
  // src/features/rules/kiro-rule.ts
14167
- var import_node_path106 = require("path");
14549
+ var import_node_path108 = require("path");
14168
14550
  var KiroRule = class _KiroRule extends ToolRule {
14169
14551
  static getSettablePaths(_options = {}) {
14170
14552
  return {
@@ -14179,7 +14561,7 @@ var KiroRule = class _KiroRule extends ToolRule {
14179
14561
  validate = true
14180
14562
  }) {
14181
14563
  const fileContent = await readFileContent(
14182
- (0, import_node_path106.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
14564
+ (0, import_node_path108.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
14183
14565
  );
14184
14566
  return new _KiroRule({
14185
14567
  baseDir,
@@ -14233,7 +14615,7 @@ var KiroRule = class _KiroRule extends ToolRule {
14233
14615
  };
14234
14616
 
14235
14617
  // src/features/rules/opencode-rule.ts
14236
- var import_node_path107 = require("path");
14618
+ var import_node_path109 = require("path");
14237
14619
  var OpenCodeRule = class _OpenCodeRule extends ToolRule {
14238
14620
  static getSettablePaths({
14239
14621
  global,
@@ -14268,7 +14650,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
14268
14650
  if (isRoot) {
14269
14651
  const relativePath2 = paths.root.relativeFilePath;
14270
14652
  const fileContent2 = await readFileContent(
14271
- (0, import_node_path107.join)(baseDir, paths.root.relativeDirPath, relativePath2)
14653
+ (0, import_node_path109.join)(baseDir, paths.root.relativeDirPath, relativePath2)
14272
14654
  );
14273
14655
  return new _OpenCodeRule({
14274
14656
  baseDir,
@@ -14282,8 +14664,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
14282
14664
  if (!paths.nonRoot) {
14283
14665
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
14284
14666
  }
14285
- const relativePath = (0, import_node_path107.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
14286
- const fileContent = await readFileContent((0, import_node_path107.join)(baseDir, relativePath));
14667
+ const relativePath = (0, import_node_path109.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
14668
+ const fileContent = await readFileContent((0, import_node_path109.join)(baseDir, relativePath));
14287
14669
  return new _OpenCodeRule({
14288
14670
  baseDir,
14289
14671
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -14342,7 +14724,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
14342
14724
  };
14343
14725
 
14344
14726
  // src/features/rules/qwencode-rule.ts
14345
- var import_node_path108 = require("path");
14727
+ var import_node_path110 = require("path");
14346
14728
  var QwencodeRule = class _QwencodeRule extends ToolRule {
14347
14729
  static getSettablePaths(_options = {}) {
14348
14730
  return {
@@ -14361,8 +14743,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
14361
14743
  validate = true
14362
14744
  }) {
14363
14745
  const isRoot = relativeFilePath === "QWEN.md";
14364
- const relativePath = isRoot ? "QWEN.md" : (0, import_node_path108.join)(".qwen", "memories", relativeFilePath);
14365
- const fileContent = await readFileContent((0, import_node_path108.join)(baseDir, relativePath));
14746
+ const relativePath = isRoot ? "QWEN.md" : (0, import_node_path110.join)(".qwen", "memories", relativeFilePath);
14747
+ const fileContent = await readFileContent((0, import_node_path110.join)(baseDir, relativePath));
14366
14748
  return new _QwencodeRule({
14367
14749
  baseDir,
14368
14750
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -14414,7 +14796,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
14414
14796
  };
14415
14797
 
14416
14798
  // src/features/rules/replit-rule.ts
14417
- var import_node_path109 = require("path");
14799
+ var import_node_path111 = require("path");
14418
14800
  var ReplitRule = class _ReplitRule extends ToolRule {
14419
14801
  static getSettablePaths(_options = {}) {
14420
14802
  return {
@@ -14436,7 +14818,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
14436
14818
  }
14437
14819
  const relativePath = paths.root.relativeFilePath;
14438
14820
  const fileContent = await readFileContent(
14439
- (0, import_node_path109.join)(baseDir, paths.root.relativeDirPath, relativePath)
14821
+ (0, import_node_path111.join)(baseDir, paths.root.relativeDirPath, relativePath)
14440
14822
  );
14441
14823
  return new _ReplitRule({
14442
14824
  baseDir,
@@ -14502,7 +14884,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
14502
14884
  };
14503
14885
 
14504
14886
  // src/features/rules/roo-rule.ts
14505
- var import_node_path110 = require("path");
14887
+ var import_node_path112 = require("path");
14506
14888
  var RooRule = class _RooRule extends ToolRule {
14507
14889
  static getSettablePaths(_options = {}) {
14508
14890
  return {
@@ -14517,7 +14899,7 @@ var RooRule = class _RooRule extends ToolRule {
14517
14899
  validate = true
14518
14900
  }) {
14519
14901
  const fileContent = await readFileContent(
14520
- (0, import_node_path110.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
14902
+ (0, import_node_path112.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
14521
14903
  );
14522
14904
  return new _RooRule({
14523
14905
  baseDir,
@@ -14586,7 +14968,7 @@ var RooRule = class _RooRule extends ToolRule {
14586
14968
  };
14587
14969
 
14588
14970
  // src/features/rules/warp-rule.ts
14589
- var import_node_path111 = require("path");
14971
+ var import_node_path113 = require("path");
14590
14972
  var WarpRule = class _WarpRule extends ToolRule {
14591
14973
  constructor({ fileContent, root, ...rest }) {
14592
14974
  super({
@@ -14612,8 +14994,8 @@ var WarpRule = class _WarpRule extends ToolRule {
14612
14994
  validate = true
14613
14995
  }) {
14614
14996
  const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
14615
- const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path111.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
14616
- const fileContent = await readFileContent((0, import_node_path111.join)(baseDir, relativePath));
14997
+ const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path113.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
14998
+ const fileContent = await readFileContent((0, import_node_path113.join)(baseDir, relativePath));
14617
14999
  return new _WarpRule({
14618
15000
  baseDir,
14619
15001
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
@@ -14668,7 +15050,7 @@ var WarpRule = class _WarpRule extends ToolRule {
14668
15050
  };
14669
15051
 
14670
15052
  // src/features/rules/windsurf-rule.ts
14671
- var import_node_path112 = require("path");
15053
+ var import_node_path114 = require("path");
14672
15054
  var WindsurfRule = class _WindsurfRule extends ToolRule {
14673
15055
  static getSettablePaths(_options = {}) {
14674
15056
  return {
@@ -14683,7 +15065,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
14683
15065
  validate = true
14684
15066
  }) {
14685
15067
  const fileContent = await readFileContent(
14686
- (0, import_node_path112.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
15068
+ (0, import_node_path114.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
14687
15069
  );
14688
15070
  return new _WindsurfRule({
14689
15071
  baseDir,
@@ -14759,8 +15141,8 @@ var rulesProcessorToolTargets = [
14759
15141
  "warp",
14760
15142
  "windsurf"
14761
15143
  ];
14762
- var RulesProcessorToolTargetSchema = import_mini53.z.enum(rulesProcessorToolTargets);
14763
- var formatRulePaths = (rules) => rules.map((r) => (0, import_node_path113.join)(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
15144
+ var RulesProcessorToolTargetSchema = import_mini55.z.enum(rulesProcessorToolTargets);
15145
+ var formatRulePaths = (rules) => rules.map((r) => (0, import_node_path115.join)(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
14764
15146
  var toolRuleFactories = /* @__PURE__ */ new Map([
14765
15147
  [
14766
15148
  "agentsmd",
@@ -15135,7 +15517,7 @@ var RulesProcessor = class extends FeatureProcessor {
15135
15517
  }).relativeDirPath;
15136
15518
  return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
15137
15519
  const frontmatter = skill.getFrontmatter();
15138
- const relativePath = (0, import_node_path113.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
15520
+ const relativePath = (0, import_node_path115.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
15139
15521
  return {
15140
15522
  name: frontmatter.name,
15141
15523
  description: frontmatter.description,
@@ -15248,12 +15630,12 @@ var RulesProcessor = class extends FeatureProcessor {
15248
15630
  * Load and parse rulesync rule files from .rulesync/rules/ directory
15249
15631
  */
15250
15632
  async loadRulesyncFiles() {
15251
- const rulesyncBaseDir = (0, import_node_path113.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
15252
- const files = await findFilesByGlobs((0, import_node_path113.join)(rulesyncBaseDir, "**", "*.md"));
15633
+ const rulesyncBaseDir = (0, import_node_path115.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
15634
+ const files = await findFilesByGlobs((0, import_node_path115.join)(rulesyncBaseDir, "**", "*.md"));
15253
15635
  logger.debug(`Found ${files.length} rulesync files`);
15254
15636
  const rulesyncRules = await Promise.all(
15255
15637
  files.map((file) => {
15256
- const relativeFilePath = (0, import_node_path113.relative)(rulesyncBaseDir, file);
15638
+ const relativeFilePath = (0, import_node_path115.relative)(rulesyncBaseDir, file);
15257
15639
  checkPathTraversal({
15258
15640
  relativePath: relativeFilePath,
15259
15641
  intendedRootDir: rulesyncBaseDir
@@ -15263,41 +15645,57 @@ var RulesProcessor = class extends FeatureProcessor {
15263
15645
  });
15264
15646
  })
15265
15647
  );
15648
+ const factory = this.getFactory(this.toolTarget);
15266
15649
  const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
15267
- if (rootRules.length > 1) {
15268
- throw new Error(`Multiple root rulesync rules found: ${formatRulePaths(rootRules)}`);
15650
+ const targetedRootRules = rootRules.filter(
15651
+ (rule) => factory.class.isTargetedByRulesyncRule(rule)
15652
+ );
15653
+ if (targetedRootRules.length > 1) {
15654
+ throw new Error(
15655
+ `Multiple root rulesync rules found for target '${this.toolTarget}': ${formatRulePaths(targetedRootRules)}`
15656
+ );
15269
15657
  }
15270
- if (rootRules.length === 0 && rulesyncRules.length > 0) {
15658
+ if (targetedRootRules.length === 0 && rulesyncRules.length > 0) {
15271
15659
  logger.warn(
15272
- `No root rulesync rule file found. Consider adding 'root: true' to one of your rule files in ${RULESYNC_RULES_RELATIVE_DIR_PATH}.`
15660
+ `No root rulesync rule file found for target '${this.toolTarget}'. Consider adding 'root: true' to one of your rule files in ${RULESYNC_RULES_RELATIVE_DIR_PATH}.`
15273
15661
  );
15274
15662
  }
15275
15663
  const localRootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().localRoot);
15276
- if (localRootRules.length > 1) {
15664
+ const targetedLocalRootRules = localRootRules.filter(
15665
+ (rule) => factory.class.isTargetedByRulesyncRule(rule)
15666
+ );
15667
+ if (targetedLocalRootRules.length > 1) {
15277
15668
  throw new Error(
15278
- `Multiple localRoot rules found: ${formatRulePaths(localRootRules)}. Only one rule can have localRoot: true`
15669
+ `Multiple localRoot rules found for target '${this.toolTarget}': ${formatRulePaths(targetedLocalRootRules)}. Only one rule can have localRoot: true`
15279
15670
  );
15280
15671
  }
15281
- if (localRootRules.length > 0 && rootRules.length === 0) {
15672
+ if (targetedLocalRootRules.length > 0 && targetedRootRules.length === 0) {
15282
15673
  throw new Error(
15283
- `localRoot: true requires a root: true rule to exist (found in ${formatRulePaths(localRootRules)})`
15674
+ `localRoot: true requires a root: true rule to exist for target '${this.toolTarget}' (found in ${formatRulePaths(targetedLocalRootRules)})`
15284
15675
  );
15285
15676
  }
15286
15677
  if (this.global) {
15287
- const nonRootRules = rulesyncRules.filter((rule) => !rule.getFrontmatter().root);
15288
- if (nonRootRules.length > 0) {
15678
+ const globalPaths = factory.class.getSettablePaths({ global: true });
15679
+ const supportsGlobalNonRoot = "nonRoot" in globalPaths && globalPaths.nonRoot !== null;
15680
+ const nonRootRules2 = rulesyncRules.filter(
15681
+ (rule) => !rule.getFrontmatter().root && !rule.getFrontmatter().localRoot && factory.class.isTargetedByRulesyncRule(rule)
15682
+ );
15683
+ if (nonRootRules2.length > 0 && !supportsGlobalNonRoot) {
15289
15684
  logger.warn(
15290
- `${nonRootRules.length} non-root rulesync rules found, but it's in global mode, so ignoring them: ${formatRulePaths(nonRootRules)}`
15685
+ `${nonRootRules2.length} non-root rulesync rules found, but it's in global mode, so ignoring them: ${formatRulePaths(nonRootRules2)}`
15291
15686
  );
15292
15687
  }
15293
- if (localRootRules.length > 0) {
15688
+ if (targetedLocalRootRules.length > 0) {
15294
15689
  logger.warn(
15295
- `${localRootRules.length} localRoot rules found, but localRoot is not supported in global mode, ignoring them: ${formatRulePaths(localRootRules)}`
15690
+ `${targetedLocalRootRules.length} localRoot rules found, but localRoot is not supported in global mode, ignoring them: ${formatRulePaths(targetedLocalRootRules)}`
15296
15691
  );
15297
15692
  }
15298
- return rootRules;
15693
+ return supportsGlobalNonRoot ? [...targetedRootRules, ...nonRootRules2] : targetedRootRules;
15299
15694
  }
15300
- return rulesyncRules;
15695
+ const nonRootRules = rulesyncRules.filter(
15696
+ (rule) => !rule.getFrontmatter().root && factory.class.isTargetedByRulesyncRule(rule)
15697
+ );
15698
+ return [...targetedRootRules, ...nonRootRules];
15301
15699
  }
15302
15700
  /**
15303
15701
  * Implementation of abstract method from FeatureProcessor
@@ -15312,7 +15710,7 @@ var RulesProcessor = class extends FeatureProcessor {
15312
15710
  global: this.global
15313
15711
  });
15314
15712
  const resolveRelativeDirPath = (filePath) => {
15315
- const dirName = (0, import_node_path113.dirname)((0, import_node_path113.relative)(this.baseDir, filePath));
15713
+ const dirName = (0, import_node_path115.dirname)((0, import_node_path115.relative)(this.baseDir, filePath));
15316
15714
  return dirName === "" ? "." : dirName;
15317
15715
  };
15318
15716
  const findFilesWithFallback = async (primaryGlob, alternativeRoots, buildAltGlob) => {
@@ -15330,13 +15728,13 @@ var RulesProcessor = class extends FeatureProcessor {
15330
15728
  return [];
15331
15729
  }
15332
15730
  const uniqueRootFilePaths = await findFilesWithFallback(
15333
- (0, import_node_path113.join)(
15731
+ (0, import_node_path115.join)(
15334
15732
  this.baseDir,
15335
15733
  settablePaths.root.relativeDirPath ?? ".",
15336
15734
  settablePaths.root.relativeFilePath
15337
15735
  ),
15338
15736
  settablePaths.alternativeRoots,
15339
- (alt) => (0, import_node_path113.join)(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
15737
+ (alt) => (0, import_node_path115.join)(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
15340
15738
  );
15341
15739
  if (forDeletion) {
15342
15740
  return uniqueRootFilePaths.map((filePath) => {
@@ -15348,7 +15746,7 @@ var RulesProcessor = class extends FeatureProcessor {
15348
15746
  return factory.class.forDeletion({
15349
15747
  baseDir: this.baseDir,
15350
15748
  relativeDirPath,
15351
- relativeFilePath: (0, import_node_path113.basename)(filePath),
15749
+ relativeFilePath: (0, import_node_path115.basename)(filePath),
15352
15750
  global: this.global
15353
15751
  });
15354
15752
  }).filter((rule) => rule.isDeletable());
@@ -15362,7 +15760,7 @@ var RulesProcessor = class extends FeatureProcessor {
15362
15760
  });
15363
15761
  return factory.class.fromFile({
15364
15762
  baseDir: this.baseDir,
15365
- relativeFilePath: (0, import_node_path113.basename)(filePath),
15763
+ relativeFilePath: (0, import_node_path115.basename)(filePath),
15366
15764
  relativeDirPath,
15367
15765
  global: this.global
15368
15766
  });
@@ -15381,9 +15779,9 @@ var RulesProcessor = class extends FeatureProcessor {
15381
15779
  return [];
15382
15780
  }
15383
15781
  const uniqueLocalRootFilePaths = await findFilesWithFallback(
15384
- (0, import_node_path113.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
15782
+ (0, import_node_path115.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
15385
15783
  settablePaths.alternativeRoots,
15386
- (alt) => (0, import_node_path113.join)(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
15784
+ (alt) => (0, import_node_path115.join)(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
15387
15785
  );
15388
15786
  return uniqueLocalRootFilePaths.map((filePath) => {
15389
15787
  const relativeDirPath = resolveRelativeDirPath(filePath);
@@ -15394,7 +15792,7 @@ var RulesProcessor = class extends FeatureProcessor {
15394
15792
  return factory.class.forDeletion({
15395
15793
  baseDir: this.baseDir,
15396
15794
  relativeDirPath,
15397
- relativeFilePath: (0, import_node_path113.basename)(filePath),
15795
+ relativeFilePath: (0, import_node_path115.basename)(filePath),
15398
15796
  global: this.global
15399
15797
  });
15400
15798
  }).filter((rule) => rule.isDeletable());
@@ -15404,13 +15802,13 @@ var RulesProcessor = class extends FeatureProcessor {
15404
15802
  if (!settablePaths.nonRoot) {
15405
15803
  return [];
15406
15804
  }
15407
- const nonRootBaseDir = (0, import_node_path113.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath);
15805
+ const nonRootBaseDir = (0, import_node_path115.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath);
15408
15806
  const nonRootFilePaths = await findFilesByGlobs(
15409
- (0, import_node_path113.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
15807
+ (0, import_node_path115.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
15410
15808
  );
15411
15809
  if (forDeletion) {
15412
15810
  return nonRootFilePaths.map((filePath) => {
15413
- const relativeFilePath = (0, import_node_path113.relative)(nonRootBaseDir, filePath);
15811
+ const relativeFilePath = (0, import_node_path115.relative)(nonRootBaseDir, filePath);
15414
15812
  checkPathTraversal({
15415
15813
  relativePath: relativeFilePath,
15416
15814
  intendedRootDir: nonRootBaseDir
@@ -15425,7 +15823,7 @@ var RulesProcessor = class extends FeatureProcessor {
15425
15823
  }
15426
15824
  return await Promise.all(
15427
15825
  nonRootFilePaths.map((filePath) => {
15428
- const relativeFilePath = (0, import_node_path113.relative)(nonRootBaseDir, filePath);
15826
+ const relativeFilePath = (0, import_node_path115.relative)(nonRootBaseDir, filePath);
15429
15827
  checkPathTraversal({
15430
15828
  relativePath: relativeFilePath,
15431
15829
  intendedRootDir: nonRootBaseDir
@@ -15538,14 +15936,14 @@ s/<command> [arguments]
15538
15936
  This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
15539
15937
  The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
15540
15938
 
15541
- When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path113.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
15939
+ When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path115.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
15542
15940
  const subagentsSection = subagents ? `## Simulated Subagents
15543
15941
 
15544
15942
  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.
15545
15943
 
15546
- When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path113.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
15944
+ When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path115.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
15547
15945
 
15548
- For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path113.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
15946
+ For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path115.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
15549
15947
  const skillsSection = skills ? this.generateSkillsSection(skills) : "";
15550
15948
  const result = [
15551
15949
  overview,
@@ -15577,51 +15975,51 @@ var import_request_error = require("@octokit/request-error");
15577
15975
  var import_rest = require("@octokit/rest");
15578
15976
 
15579
15977
  // src/types/fetch.ts
15580
- var import_mini55 = require("zod/mini");
15978
+ var import_mini57 = require("zod/mini");
15581
15979
 
15582
15980
  // src/types/fetch-targets.ts
15583
- var import_mini54 = require("zod/mini");
15981
+ var import_mini56 = require("zod/mini");
15584
15982
  var ALL_FETCH_TARGETS = ["rulesync", ...ALL_TOOL_TARGETS];
15585
- var FetchTargetSchema = import_mini54.z.enum(ALL_FETCH_TARGETS);
15983
+ var FetchTargetSchema = import_mini56.z.enum(ALL_FETCH_TARGETS);
15586
15984
 
15587
15985
  // src/types/fetch.ts
15588
- var ConflictStrategySchema = import_mini55.z.enum(["skip", "overwrite"]);
15589
- var GitHubFileTypeSchema = import_mini55.z.enum(["file", "dir", "symlink", "submodule"]);
15590
- var GitHubFileEntrySchema = import_mini55.z.looseObject({
15591
- name: import_mini55.z.string(),
15592
- path: import_mini55.z.string(),
15593
- sha: import_mini55.z.string(),
15594
- size: import_mini55.z.number(),
15986
+ var ConflictStrategySchema = import_mini57.z.enum(["skip", "overwrite"]);
15987
+ var GitHubFileTypeSchema = import_mini57.z.enum(["file", "dir", "symlink", "submodule"]);
15988
+ var GitHubFileEntrySchema = import_mini57.z.looseObject({
15989
+ name: import_mini57.z.string(),
15990
+ path: import_mini57.z.string(),
15991
+ sha: import_mini57.z.string(),
15992
+ size: import_mini57.z.number(),
15595
15993
  type: GitHubFileTypeSchema,
15596
- download_url: import_mini55.z.nullable(import_mini55.z.string())
15994
+ download_url: import_mini57.z.nullable(import_mini57.z.string())
15597
15995
  });
15598
- var FetchOptionsSchema = import_mini55.z.looseObject({
15599
- target: import_mini55.z.optional(FetchTargetSchema),
15600
- features: import_mini55.z.optional(import_mini55.z.array(import_mini55.z.enum(ALL_FEATURES_WITH_WILDCARD))),
15601
- ref: import_mini55.z.optional(import_mini55.z.string()),
15602
- path: import_mini55.z.optional(import_mini55.z.string()),
15603
- output: import_mini55.z.optional(import_mini55.z.string()),
15604
- conflict: import_mini55.z.optional(ConflictStrategySchema),
15605
- token: import_mini55.z.optional(import_mini55.z.string()),
15606
- verbose: import_mini55.z.optional(import_mini55.z.boolean()),
15607
- silent: import_mini55.z.optional(import_mini55.z.boolean())
15996
+ var FetchOptionsSchema = import_mini57.z.looseObject({
15997
+ target: import_mini57.z.optional(FetchTargetSchema),
15998
+ features: import_mini57.z.optional(import_mini57.z.array(import_mini57.z.enum(ALL_FEATURES_WITH_WILDCARD))),
15999
+ ref: import_mini57.z.optional(import_mini57.z.string()),
16000
+ path: import_mini57.z.optional(import_mini57.z.string()),
16001
+ output: import_mini57.z.optional(import_mini57.z.string()),
16002
+ conflict: import_mini57.z.optional(ConflictStrategySchema),
16003
+ token: import_mini57.z.optional(import_mini57.z.string()),
16004
+ verbose: import_mini57.z.optional(import_mini57.z.boolean()),
16005
+ silent: import_mini57.z.optional(import_mini57.z.boolean())
15608
16006
  });
15609
- var FetchFileStatusSchema = import_mini55.z.enum(["created", "overwritten", "skipped"]);
15610
- var GitHubRepoInfoSchema = import_mini55.z.looseObject({
15611
- default_branch: import_mini55.z.string(),
15612
- private: import_mini55.z.boolean()
16007
+ var FetchFileStatusSchema = import_mini57.z.enum(["created", "overwritten", "skipped"]);
16008
+ var GitHubRepoInfoSchema = import_mini57.z.looseObject({
16009
+ default_branch: import_mini57.z.string(),
16010
+ private: import_mini57.z.boolean()
15613
16011
  });
15614
- var GitHubReleaseAssetSchema = import_mini55.z.looseObject({
15615
- name: import_mini55.z.string(),
15616
- browser_download_url: import_mini55.z.string(),
15617
- size: import_mini55.z.number()
16012
+ var GitHubReleaseAssetSchema = import_mini57.z.looseObject({
16013
+ name: import_mini57.z.string(),
16014
+ browser_download_url: import_mini57.z.string(),
16015
+ size: import_mini57.z.number()
15618
16016
  });
15619
- var GitHubReleaseSchema = import_mini55.z.looseObject({
15620
- tag_name: import_mini55.z.string(),
15621
- name: import_mini55.z.nullable(import_mini55.z.string()),
15622
- prerelease: import_mini55.z.boolean(),
15623
- draft: import_mini55.z.boolean(),
15624
- assets: import_mini55.z.array(GitHubReleaseAssetSchema)
16017
+ var GitHubReleaseSchema = import_mini57.z.looseObject({
16018
+ tag_name: import_mini57.z.string(),
16019
+ name: import_mini57.z.nullable(import_mini57.z.string()),
16020
+ prerelease: import_mini57.z.boolean(),
16021
+ draft: import_mini57.z.boolean(),
16022
+ assets: import_mini57.z.array(GitHubReleaseAssetSchema)
15625
16023
  });
15626
16024
 
15627
16025
  // src/lib/github-client.ts
@@ -15921,9 +16319,9 @@ async function listDirectoryRecursive(params) {
15921
16319
  }
15922
16320
 
15923
16321
  // src/types/git-provider.ts
15924
- var import_mini56 = require("zod/mini");
16322
+ var import_mini58 = require("zod/mini");
15925
16323
  var ALL_GIT_PROVIDERS = ["github", "gitlab"];
15926
- var GitProviderSchema = import_mini56.z.enum(ALL_GIT_PROVIDERS);
16324
+ var GitProviderSchema = import_mini58.z.enum(ALL_GIT_PROVIDERS);
15927
16325
 
15928
16326
  // src/lib/source-parser.ts
15929
16327
  var GITHUB_HOSTS = /* @__PURE__ */ new Set(["github.com", "www.github.com"]);
@@ -16048,8 +16446,8 @@ async function processFeatureConversion(params) {
16048
16446
  }
16049
16447
  const rulesyncFiles = await processor.convertToolFilesToRulesyncFiles(toolFiles);
16050
16448
  for (const file of rulesyncFiles) {
16051
- const relativePath = (0, import_node_path114.join)(file.getRelativeDirPath(), file.getRelativeFilePath());
16052
- const outputPath = (0, import_node_path114.join)(outputDir, relativePath);
16449
+ const relativePath = (0, import_node_path116.join)(file.getRelativeDirPath(), file.getRelativeFilePath());
16450
+ const outputPath = (0, import_node_path116.join)(outputDir, relativePath);
16053
16451
  await writeFileContent(outputPath, file.getFileContent());
16054
16452
  paths.push(relativePath);
16055
16453
  }
@@ -16195,7 +16593,7 @@ async function fetchFiles(params) {
16195
16593
  skipped: 0
16196
16594
  };
16197
16595
  }
16198
- const outputBasePath = (0, import_node_path114.join)(baseDir, outputDir);
16596
+ const outputBasePath = (0, import_node_path116.join)(baseDir, outputDir);
16199
16597
  for (const { relativePath, size } of filesToFetch) {
16200
16598
  checkPathTraversal({
16201
16599
  relativePath,
@@ -16205,7 +16603,7 @@ async function fetchFiles(params) {
16205
16603
  }
16206
16604
  const results = await Promise.all(
16207
16605
  filesToFetch.map(async ({ remotePath, relativePath }) => {
16208
- const localPath = (0, import_node_path114.join)(outputBasePath, relativePath);
16606
+ const localPath = (0, import_node_path116.join)(outputBasePath, relativePath);
16209
16607
  const exists = await fileExists(localPath);
16210
16608
  if (exists && conflictStrategy === "skip") {
16211
16609
  logger.debug(`Skipping existing file: ${relativePath}`);
@@ -16247,7 +16645,7 @@ async function collectFeatureFiles(params) {
16247
16645
  );
16248
16646
  const results = await Promise.all(
16249
16647
  tasks.map(async ({ featurePath }) => {
16250
- const fullPath = basePath === "." || basePath === "" ? featurePath : (0, import_node_path114.join)(basePath, featurePath);
16648
+ const fullPath = basePath === "." || basePath === "" ? featurePath : (0, import_node_path116.join)(basePath, featurePath);
16251
16649
  const collected = [];
16252
16650
  try {
16253
16651
  if (featurePath.includes(".")) {
@@ -16347,7 +16745,7 @@ async function fetchAndConvertToolFiles(params) {
16347
16745
  relativePath: toolRelativePath,
16348
16746
  intendedRootDir: tempDir
16349
16747
  });
16350
- const localPath = (0, import_node_path114.join)(tempDir, toolRelativePath);
16748
+ const localPath = (0, import_node_path116.join)(tempDir, toolRelativePath);
16351
16749
  const content = await withSemaphore(
16352
16750
  semaphore,
16353
16751
  () => client.getFileContent(parsed.owner, parsed.repo, remotePath, ref)
@@ -16356,7 +16754,7 @@ async function fetchAndConvertToolFiles(params) {
16356
16754
  logger.debug(`Fetched to temp: ${toolRelativePath}`);
16357
16755
  })
16358
16756
  );
16359
- const outputBasePath = (0, import_node_path114.join)(baseDir, outputDir);
16757
+ const outputBasePath = (0, import_node_path116.join)(baseDir, outputDir);
16360
16758
  const { converted, convertedPaths } = await convertFetchedFilesToRulesync({
16361
16759
  tempDir,
16362
16760
  outputDir: outputBasePath,
@@ -16429,7 +16827,7 @@ function mapToToolPath(relativePath, toolPaths) {
16429
16827
  if (relativePath.startsWith("rules/")) {
16430
16828
  const restPath = relativePath.substring("rules/".length);
16431
16829
  if (toolPaths.rules?.nonRoot) {
16432
- return (0, import_node_path114.join)(toolPaths.rules.nonRoot, restPath);
16830
+ return (0, import_node_path116.join)(toolPaths.rules.nonRoot, restPath);
16433
16831
  }
16434
16832
  }
16435
16833
  if (toolPaths.rules?.root && relativePath === toolPaths.rules.root) {
@@ -16438,19 +16836,19 @@ function mapToToolPath(relativePath, toolPaths) {
16438
16836
  if (relativePath.startsWith("commands/")) {
16439
16837
  const restPath = relativePath.substring("commands/".length);
16440
16838
  if (toolPaths.commands) {
16441
- return (0, import_node_path114.join)(toolPaths.commands, restPath);
16839
+ return (0, import_node_path116.join)(toolPaths.commands, restPath);
16442
16840
  }
16443
16841
  }
16444
16842
  if (relativePath.startsWith("subagents/")) {
16445
16843
  const restPath = relativePath.substring("subagents/".length);
16446
16844
  if (toolPaths.subagents) {
16447
- return (0, import_node_path114.join)(toolPaths.subagents, restPath);
16845
+ return (0, import_node_path116.join)(toolPaths.subagents, restPath);
16448
16846
  }
16449
16847
  }
16450
16848
  if (relativePath.startsWith("skills/")) {
16451
16849
  const restPath = relativePath.substring("skills/".length);
16452
16850
  if (toolPaths.skills) {
16453
- return (0, import_node_path114.join)(toolPaths.skills, restPath);
16851
+ return (0, import_node_path116.join)(toolPaths.skills, restPath);
16454
16852
  }
16455
16853
  }
16456
16854
  return relativePath;
@@ -16502,38 +16900,60 @@ async function fetchCommand(options) {
16502
16900
  }
16503
16901
 
16504
16902
  // src/config/config-resolver.ts
16505
- var import_node_path115 = require("path");
16903
+ var import_node_path118 = require("path");
16506
16904
  var import_jsonc_parser2 = require("jsonc-parser");
16507
16905
 
16508
16906
  // src/config/config.ts
16509
- var import_mini57 = require("zod/mini");
16510
- var SourceEntrySchema = import_mini57.z.object({
16511
- source: import_mini57.z.string().check((0, import_mini57.minLength)(1, "source must be a non-empty string")),
16512
- skills: (0, import_mini57.optional)(import_mini57.z.array(import_mini57.z.string()))
16907
+ var import_node_path117 = require("path");
16908
+ var import_mini59 = require("zod/mini");
16909
+ function hasControlCharacters(value) {
16910
+ for (let i = 0; i < value.length; i++) {
16911
+ const code = value.charCodeAt(i);
16912
+ if (code >= 0 && code <= 31 || code === 127) return true;
16913
+ }
16914
+ return false;
16915
+ }
16916
+ var SourceEntrySchema = import_mini59.z.object({
16917
+ source: import_mini59.z.string().check((0, import_mini59.minLength)(1, "source must be a non-empty string")),
16918
+ skills: (0, import_mini59.optional)(import_mini59.z.array(import_mini59.z.string())),
16919
+ transport: (0, import_mini59.optional)(import_mini59.z.enum(["github", "git"])),
16920
+ ref: (0, import_mini59.optional)(
16921
+ import_mini59.z.string().check(
16922
+ (0, import_mini59.refine)((v) => !v.startsWith("-"), 'ref must not start with "-"'),
16923
+ (0, import_mini59.refine)((v) => !hasControlCharacters(v), "ref must not contain control characters")
16924
+ )
16925
+ ),
16926
+ path: (0, import_mini59.optional)(
16927
+ import_mini59.z.string().check(
16928
+ (0, import_mini59.refine)((v) => !v.includes(".."), 'path must not contain ".."'),
16929
+ (0, import_mini59.refine)((v) => !(0, import_node_path117.isAbsolute)(v), "path must not be absolute"),
16930
+ (0, import_mini59.refine)((v) => !hasControlCharacters(v), "path must not contain control characters")
16931
+ )
16932
+ )
16513
16933
  });
16514
- var ConfigParamsSchema = import_mini57.z.object({
16515
- baseDirs: import_mini57.z.array(import_mini57.z.string()),
16934
+ var ConfigParamsSchema = import_mini59.z.object({
16935
+ baseDirs: import_mini59.z.array(import_mini59.z.string()),
16516
16936
  targets: RulesyncTargetsSchema,
16517
16937
  features: RulesyncFeaturesSchema,
16518
- verbose: import_mini57.z.boolean(),
16519
- delete: import_mini57.z.boolean(),
16938
+ verbose: import_mini59.z.boolean(),
16939
+ delete: import_mini59.z.boolean(),
16520
16940
  // New non-experimental options
16521
- global: (0, import_mini57.optional)(import_mini57.z.boolean()),
16522
- silent: (0, import_mini57.optional)(import_mini57.z.boolean()),
16523
- simulateCommands: (0, import_mini57.optional)(import_mini57.z.boolean()),
16524
- simulateSubagents: (0, import_mini57.optional)(import_mini57.z.boolean()),
16525
- simulateSkills: (0, import_mini57.optional)(import_mini57.z.boolean()),
16526
- dryRun: (0, import_mini57.optional)(import_mini57.z.boolean()),
16527
- check: (0, import_mini57.optional)(import_mini57.z.boolean()),
16941
+ global: (0, import_mini59.optional)(import_mini59.z.boolean()),
16942
+ silent: (0, import_mini59.optional)(import_mini59.z.boolean()),
16943
+ simulateCommands: (0, import_mini59.optional)(import_mini59.z.boolean()),
16944
+ simulateSubagents: (0, import_mini59.optional)(import_mini59.z.boolean()),
16945
+ simulateSkills: (0, import_mini59.optional)(import_mini59.z.boolean()),
16946
+ dryRun: (0, import_mini59.optional)(import_mini59.z.boolean()),
16947
+ check: (0, import_mini59.optional)(import_mini59.z.boolean()),
16528
16948
  // Declarative skill sources
16529
- sources: (0, import_mini57.optional)(import_mini57.z.array(SourceEntrySchema))
16949
+ sources: (0, import_mini59.optional)(import_mini59.z.array(SourceEntrySchema))
16530
16950
  });
16531
- var PartialConfigParamsSchema = import_mini57.z.partial(ConfigParamsSchema);
16532
- var ConfigFileSchema = import_mini57.z.object({
16533
- $schema: (0, import_mini57.optional)(import_mini57.z.string()),
16534
- ...import_mini57.z.partial(ConfigParamsSchema).shape
16951
+ var PartialConfigParamsSchema = import_mini59.z.partial(ConfigParamsSchema);
16952
+ var ConfigFileSchema = import_mini59.z.object({
16953
+ $schema: (0, import_mini59.optional)(import_mini59.z.string()),
16954
+ ...import_mini59.z.partial(ConfigParamsSchema).shape
16535
16955
  });
16536
- var RequiredConfigParamsSchema = import_mini57.z.required(ConfigParamsSchema);
16956
+ var RequiredConfigParamsSchema = import_mini59.z.required(ConfigParamsSchema);
16537
16957
  var CONFLICTING_TARGET_PAIRS = [
16538
16958
  ["augmentcode", "augmentcode-legacy"],
16539
16959
  ["claudecode", "claudecode-legacy"]
@@ -16754,8 +17174,8 @@ var ConfigResolver = class {
16754
17174
  }) {
16755
17175
  const validatedConfigPath = resolvePath(configPath, process.cwd());
16756
17176
  const baseConfig = await loadConfigFromFile(validatedConfigPath);
16757
- const configDir = (0, import_node_path115.dirname)(validatedConfigPath);
16758
- const localConfigPath = (0, import_node_path115.join)(configDir, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH);
17177
+ const configDir = (0, import_node_path118.dirname)(validatedConfigPath);
17178
+ const localConfigPath = (0, import_node_path118.join)(configDir, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH);
16759
17179
  const localConfig = await loadConfigFromFile(localConfigPath);
16760
17180
  const configByFile = mergeConfigs(baseConfig, localConfig);
16761
17181
  const resolvedGlobal = global ?? configByFile.global ?? getDefaults().global;
@@ -16790,7 +17210,7 @@ function getBaseDirsInLightOfGlobal({
16790
17210
  if (global) {
16791
17211
  return [getHomeDirectory()];
16792
17212
  }
16793
- const resolvedBaseDirs = baseDirs.map((baseDir) => (0, import_node_path115.resolve)(baseDir));
17213
+ const resolvedBaseDirs = baseDirs.map((baseDir) => (0, import_node_path118.resolve)(baseDir));
16794
17214
  resolvedBaseDirs.forEach((baseDir) => {
16795
17215
  validateBaseDir(baseDir);
16796
17216
  });
@@ -16798,7 +17218,7 @@ function getBaseDirsInLightOfGlobal({
16798
17218
  }
16799
17219
 
16800
17220
  // src/lib/generate.ts
16801
- var import_node_path116 = require("path");
17221
+ var import_node_path119 = require("path");
16802
17222
  var import_es_toolkit4 = require("es-toolkit");
16803
17223
  async function processFeatureGeneration(params) {
16804
17224
  const { config, processor, toolFiles } = params;
@@ -16852,7 +17272,7 @@ function warnUnsupportedTargets(params) {
16852
17272
  }
16853
17273
  }
16854
17274
  async function checkRulesyncDirExists(params) {
16855
- return fileExists((0, import_node_path116.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
17275
+ return fileExists((0, import_node_path119.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
16856
17276
  }
16857
17277
  async function generate(params) {
16858
17278
  const { config } = params;
@@ -17310,7 +17730,7 @@ async function generateCommand(options) {
17310
17730
  }
17311
17731
 
17312
17732
  // src/cli/commands/gitignore.ts
17313
- var import_node_path117 = require("path");
17733
+ var import_node_path120 = require("path");
17314
17734
  var RULESYNC_HEADER = "# Generated by Rulesync";
17315
17735
  var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
17316
17736
  var RULESYNC_IGNORE_ENTRIES = [
@@ -17378,6 +17798,8 @@ var RULESYNC_IGNORE_ENTRIES = [
17378
17798
  // Junie
17379
17799
  "**/.junie/guidelines.md",
17380
17800
  "**/.junie/mcp.json",
17801
+ "**/.junie/skills/",
17802
+ "**/.junie/agents/",
17381
17803
  // Kilo Code
17382
17804
  "**/.kilocode/rules/",
17383
17805
  "**/.kilocode/skills/",
@@ -17466,7 +17888,7 @@ var removeExistingRulesyncEntries = (content) => {
17466
17888
  return result;
17467
17889
  };
17468
17890
  var gitignoreCommand = async () => {
17469
- const gitignorePath = (0, import_node_path117.join)(process.cwd(), ".gitignore");
17891
+ const gitignorePath = (0, import_node_path120.join)(process.cwd(), ".gitignore");
17470
17892
  let gitignoreContent = "";
17471
17893
  if (await fileExists(gitignorePath)) {
17472
17894
  gitignoreContent = await readFileContent(gitignorePath);
@@ -17753,7 +18175,7 @@ async function importCommand(options) {
17753
18175
  }
17754
18176
 
17755
18177
  // src/lib/init.ts
17756
- var import_node_path118 = require("path");
18178
+ var import_node_path121 = require("path");
17757
18179
  async function init() {
17758
18180
  const sampleFiles = await createSampleFiles();
17759
18181
  const configFile = await createConfigFile();
@@ -17943,27 +18365,27 @@ Keep the summary concise and ready to reuse in future tasks.`
17943
18365
  await ensureDir(subagentPaths.relativeDirPath);
17944
18366
  await ensureDir(skillPaths.relativeDirPath);
17945
18367
  await ensureDir(ignorePaths.recommended.relativeDirPath);
17946
- const ruleFilepath = (0, import_node_path118.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
18368
+ const ruleFilepath = (0, import_node_path121.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
17947
18369
  results.push(await writeIfNotExists(ruleFilepath, sampleRuleFile.content));
17948
- const mcpFilepath = (0, import_node_path118.join)(
18370
+ const mcpFilepath = (0, import_node_path121.join)(
17949
18371
  mcpPaths.recommended.relativeDirPath,
17950
18372
  mcpPaths.recommended.relativeFilePath
17951
18373
  );
17952
18374
  results.push(await writeIfNotExists(mcpFilepath, sampleMcpFile.content));
17953
- const commandFilepath = (0, import_node_path118.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
18375
+ const commandFilepath = (0, import_node_path121.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
17954
18376
  results.push(await writeIfNotExists(commandFilepath, sampleCommandFile.content));
17955
- const subagentFilepath = (0, import_node_path118.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
18377
+ const subagentFilepath = (0, import_node_path121.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
17956
18378
  results.push(await writeIfNotExists(subagentFilepath, sampleSubagentFile.content));
17957
- const skillDirPath = (0, import_node_path118.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
18379
+ const skillDirPath = (0, import_node_path121.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
17958
18380
  await ensureDir(skillDirPath);
17959
- const skillFilepath = (0, import_node_path118.join)(skillDirPath, SKILL_FILE_NAME);
18381
+ const skillFilepath = (0, import_node_path121.join)(skillDirPath, SKILL_FILE_NAME);
17960
18382
  results.push(await writeIfNotExists(skillFilepath, sampleSkillFile.content));
17961
- const ignoreFilepath = (0, import_node_path118.join)(
18383
+ const ignoreFilepath = (0, import_node_path121.join)(
17962
18384
  ignorePaths.recommended.relativeDirPath,
17963
18385
  ignorePaths.recommended.relativeFilePath
17964
18386
  );
17965
18387
  results.push(await writeIfNotExists(ignoreFilepath, sampleIgnoreFile.content));
17966
- const hooksFilepath = (0, import_node_path118.join)(hooksPaths.relativeDirPath, hooksPaths.relativeFilePath);
18388
+ const hooksFilepath = (0, import_node_path121.join)(hooksPaths.relativeDirPath, hooksPaths.relativeFilePath);
17967
18389
  results.push(await writeIfNotExists(hooksFilepath, sampleHooksFile.content));
17968
18390
  return results;
17969
18391
  }
@@ -18001,33 +18423,196 @@ async function initCommand() {
18001
18423
  }
18002
18424
 
18003
18425
  // src/lib/sources.ts
18004
- var import_node_path120 = require("path");
18426
+ var import_node_path124 = require("path");
18005
18427
  var import_promise2 = require("es-toolkit/promise");
18006
18428
 
18429
+ // src/lib/git-client.ts
18430
+ var import_node_child_process = require("child_process");
18431
+ var import_node_path122 = require("path");
18432
+ var import_node_util = require("util");
18433
+ var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
18434
+ var GIT_TIMEOUT_MS = 6e4;
18435
+ var ALLOWED_URL_SCHEMES = /^(https?:\/\/|ssh:\/\/|git:\/\/|file:\/\/\/|[a-zA-Z0-9_.+-]+@[a-zA-Z0-9.-]+:[a-zA-Z0-9_.+/~-]+)/;
18436
+ var INSECURE_URL_SCHEMES = /^(git:\/\/|http:\/\/)/;
18437
+ function findControlCharacter(value) {
18438
+ for (let i = 0; i < value.length; i++) {
18439
+ const code = value.charCodeAt(i);
18440
+ if (code >= 0 && code <= 31 || code === 127) {
18441
+ return { position: i, hex: `0x${code.toString(16).padStart(2, "0")}` };
18442
+ }
18443
+ }
18444
+ return null;
18445
+ }
18446
+ var GitClientError = class extends Error {
18447
+ constructor(message, cause) {
18448
+ super(message, { cause });
18449
+ this.name = "GitClientError";
18450
+ }
18451
+ };
18452
+ function validateGitUrl(url) {
18453
+ const ctrl = findControlCharacter(url);
18454
+ if (ctrl) {
18455
+ throw new GitClientError(
18456
+ `Git URL contains control character ${ctrl.hex} at position ${ctrl.position}`
18457
+ );
18458
+ }
18459
+ if (!ALLOWED_URL_SCHEMES.test(url)) {
18460
+ throw new GitClientError(
18461
+ `Unsupported or unsafe git URL: "${url}". Use https, ssh, git, or file schemes.`
18462
+ );
18463
+ }
18464
+ if (INSECURE_URL_SCHEMES.test(url)) {
18465
+ logger.warn(
18466
+ `URL "${url}" uses an unencrypted protocol. Consider using https:// or ssh:// instead.`
18467
+ );
18468
+ }
18469
+ }
18470
+ function validateRef(ref) {
18471
+ if (ref.startsWith("-")) {
18472
+ throw new GitClientError(`Ref must not start with "-": "${ref}"`);
18473
+ }
18474
+ const ctrl = findControlCharacter(ref);
18475
+ if (ctrl) {
18476
+ throw new GitClientError(
18477
+ `Ref contains control character ${ctrl.hex} at position ${ctrl.position}`
18478
+ );
18479
+ }
18480
+ }
18481
+ var gitChecked = false;
18482
+ async function checkGitAvailable() {
18483
+ if (gitChecked) return;
18484
+ try {
18485
+ await execFileAsync("git", ["--version"], { timeout: GIT_TIMEOUT_MS });
18486
+ gitChecked = true;
18487
+ } catch {
18488
+ throw new GitClientError("git is not installed or not found in PATH");
18489
+ }
18490
+ }
18491
+ async function resolveDefaultRef(url) {
18492
+ validateGitUrl(url);
18493
+ await checkGitAvailable();
18494
+ try {
18495
+ const { stdout } = await execFileAsync("git", ["ls-remote", "--symref", "--", url, "HEAD"], {
18496
+ timeout: GIT_TIMEOUT_MS
18497
+ });
18498
+ const ref = stdout.match(/^ref: refs\/heads\/(.+)\tHEAD$/m)?.[1];
18499
+ const sha = stdout.match(/^([0-9a-f]{40})\tHEAD$/m)?.[1];
18500
+ if (!ref || !sha) throw new GitClientError(`Could not parse default branch from: ${url}`);
18501
+ return { ref, sha };
18502
+ } catch (error) {
18503
+ if (error instanceof GitClientError) throw error;
18504
+ throw new GitClientError(`Failed to resolve default ref for ${url}`, error);
18505
+ }
18506
+ }
18507
+ async function resolveRefToSha(url, ref) {
18508
+ validateGitUrl(url);
18509
+ validateRef(ref);
18510
+ await checkGitAvailable();
18511
+ try {
18512
+ const { stdout } = await execFileAsync("git", ["ls-remote", "--", url, ref], {
18513
+ timeout: GIT_TIMEOUT_MS
18514
+ });
18515
+ const sha = stdout.match(/^([0-9a-f]{40})\t/m)?.[1];
18516
+ if (!sha) throw new GitClientError(`Ref "${ref}" not found in ${url}`);
18517
+ return sha;
18518
+ } catch (error) {
18519
+ if (error instanceof GitClientError) throw error;
18520
+ throw new GitClientError(`Failed to resolve ref "${ref}" for ${url}`, error);
18521
+ }
18522
+ }
18523
+ async function fetchSkillFiles(params) {
18524
+ const { url, ref, skillsPath } = params;
18525
+ validateGitUrl(url);
18526
+ validateRef(ref);
18527
+ await checkGitAvailable();
18528
+ const tmpDir = await createTempDirectory("rulesync-git-");
18529
+ try {
18530
+ await execFileAsync(
18531
+ "git",
18532
+ [
18533
+ "clone",
18534
+ "--depth",
18535
+ "1",
18536
+ "--branch",
18537
+ ref,
18538
+ "--no-checkout",
18539
+ "--filter=blob:none",
18540
+ "--",
18541
+ url,
18542
+ tmpDir
18543
+ ],
18544
+ { timeout: GIT_TIMEOUT_MS }
18545
+ );
18546
+ await execFileAsync("git", ["-C", tmpDir, "sparse-checkout", "set", "--", skillsPath], {
18547
+ timeout: GIT_TIMEOUT_MS
18548
+ });
18549
+ await execFileAsync("git", ["-C", tmpDir, "checkout"], { timeout: GIT_TIMEOUT_MS });
18550
+ const skillsDir = (0, import_node_path122.join)(tmpDir, skillsPath);
18551
+ if (!await directoryExists(skillsDir)) return [];
18552
+ return await walkDirectory(skillsDir, skillsDir);
18553
+ } catch (error) {
18554
+ if (error instanceof GitClientError) throw error;
18555
+ throw new GitClientError(`Failed to fetch skill files from ${url}`, error);
18556
+ } finally {
18557
+ await removeTempDirectory(tmpDir);
18558
+ }
18559
+ }
18560
+ var MAX_WALK_DEPTH = 20;
18561
+ async function walkDirectory(dir, baseDir, depth = 0) {
18562
+ if (depth > MAX_WALK_DEPTH) {
18563
+ throw new GitClientError(
18564
+ `Directory tree exceeds max depth of ${MAX_WALK_DEPTH}: "${dir}". Aborting to prevent resource exhaustion.`
18565
+ );
18566
+ }
18567
+ const results = [];
18568
+ for (const name of await listDirectoryFiles(dir)) {
18569
+ if (name === ".git") continue;
18570
+ const fullPath = (0, import_node_path122.join)(dir, name);
18571
+ if (await isSymlink(fullPath)) {
18572
+ logger.warn(`Skipping symlink "${fullPath}".`);
18573
+ continue;
18574
+ }
18575
+ if (await directoryExists(fullPath)) {
18576
+ results.push(...await walkDirectory(fullPath, baseDir, depth + 1));
18577
+ } else {
18578
+ const size = await getFileSize(fullPath);
18579
+ if (size > MAX_FILE_SIZE) {
18580
+ logger.warn(
18581
+ `Skipping file "${fullPath}" (${(size / 1024 / 1024).toFixed(2)}MB exceeds ${MAX_FILE_SIZE / 1024 / 1024}MB limit).`
18582
+ );
18583
+ continue;
18584
+ }
18585
+ const content = await readFileContent(fullPath);
18586
+ results.push({ relativePath: fullPath.substring(baseDir.length + 1), content, size });
18587
+ }
18588
+ }
18589
+ return results;
18590
+ }
18591
+
18007
18592
  // src/lib/sources-lock.ts
18008
18593
  var import_node_crypto = require("crypto");
18009
- var import_node_path119 = require("path");
18010
- var import_mini58 = require("zod/mini");
18594
+ var import_node_path123 = require("path");
18595
+ var import_mini60 = require("zod/mini");
18011
18596
  var LOCKFILE_VERSION = 1;
18012
- var LockedSkillSchema = import_mini58.z.object({
18013
- integrity: import_mini58.z.string()
18597
+ var LockedSkillSchema = import_mini60.z.object({
18598
+ integrity: import_mini60.z.string()
18014
18599
  });
18015
- var LockedSourceSchema = import_mini58.z.object({
18016
- requestedRef: (0, import_mini58.optional)(import_mini58.z.string()),
18017
- resolvedRef: import_mini58.z.string(),
18018
- resolvedAt: (0, import_mini58.optional)(import_mini58.z.string()),
18019
- skills: import_mini58.z.record(import_mini58.z.string(), LockedSkillSchema)
18600
+ var LockedSourceSchema = import_mini60.z.object({
18601
+ requestedRef: (0, import_mini60.optional)(import_mini60.z.string()),
18602
+ resolvedRef: import_mini60.z.string(),
18603
+ resolvedAt: (0, import_mini60.optional)(import_mini60.z.string()),
18604
+ skills: import_mini60.z.record(import_mini60.z.string(), LockedSkillSchema)
18020
18605
  });
18021
- var SourcesLockSchema = import_mini58.z.object({
18022
- lockfileVersion: import_mini58.z.number(),
18023
- sources: import_mini58.z.record(import_mini58.z.string(), LockedSourceSchema)
18606
+ var SourcesLockSchema = import_mini60.z.object({
18607
+ lockfileVersion: import_mini60.z.number(),
18608
+ sources: import_mini60.z.record(import_mini60.z.string(), LockedSourceSchema)
18024
18609
  });
18025
- var LegacyLockedSourceSchema = import_mini58.z.object({
18026
- resolvedRef: import_mini58.z.string(),
18027
- skills: import_mini58.z.array(import_mini58.z.string())
18610
+ var LegacyLockedSourceSchema = import_mini60.z.object({
18611
+ resolvedRef: import_mini60.z.string(),
18612
+ skills: import_mini60.z.array(import_mini60.z.string())
18028
18613
  });
18029
- var LegacySourcesLockSchema = import_mini58.z.object({
18030
- sources: import_mini58.z.record(import_mini58.z.string(), LegacyLockedSourceSchema)
18614
+ var LegacySourcesLockSchema = import_mini60.z.object({
18615
+ sources: import_mini60.z.record(import_mini60.z.string(), LegacyLockedSourceSchema)
18031
18616
  });
18032
18617
  function migrateLegacyLock(legacy) {
18033
18618
  const sources = {};
@@ -18050,7 +18635,7 @@ function createEmptyLock() {
18050
18635
  return { lockfileVersion: LOCKFILE_VERSION, sources: {} };
18051
18636
  }
18052
18637
  async function readLockFile(params) {
18053
- const lockPath = (0, import_node_path119.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
18638
+ const lockPath = (0, import_node_path123.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
18054
18639
  if (!await fileExists(lockPath)) {
18055
18640
  logger.debug("No sources lockfile found, starting fresh.");
18056
18641
  return createEmptyLock();
@@ -18078,7 +18663,7 @@ async function readLockFile(params) {
18078
18663
  }
18079
18664
  }
18080
18665
  async function writeLockFile(params) {
18081
- const lockPath = (0, import_node_path119.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
18666
+ const lockPath = (0, import_node_path123.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
18082
18667
  const content = JSON.stringify(params.lock, null, 2) + "\n";
18083
18668
  await writeFileContent(lockPath, content);
18084
18669
  logger.debug(`Wrote sources lockfile to ${lockPath}`);
@@ -18184,15 +18769,30 @@ async function resolveAndFetchSources(params) {
18184
18769
  const allFetchedSkillNames = /* @__PURE__ */ new Set();
18185
18770
  for (const sourceEntry of sources) {
18186
18771
  try {
18187
- const { skillCount, fetchedSkillNames, updatedLock } = await fetchSource({
18188
- sourceEntry,
18189
- client,
18190
- baseDir,
18191
- lock,
18192
- localSkillNames,
18193
- alreadyFetchedSkillNames: allFetchedSkillNames,
18194
- updateSources: options.updateSources ?? false
18195
- });
18772
+ const transport = sourceEntry.transport ?? "github";
18773
+ let result;
18774
+ if (transport === "git") {
18775
+ result = await fetchSourceViaGit({
18776
+ sourceEntry,
18777
+ baseDir,
18778
+ lock,
18779
+ localSkillNames,
18780
+ alreadyFetchedSkillNames: allFetchedSkillNames,
18781
+ updateSources: options.updateSources ?? false,
18782
+ frozen: options.frozen ?? false
18783
+ });
18784
+ } else {
18785
+ result = await fetchSource({
18786
+ sourceEntry,
18787
+ client,
18788
+ baseDir,
18789
+ lock,
18790
+ localSkillNames,
18791
+ alreadyFetchedSkillNames: allFetchedSkillNames,
18792
+ updateSources: options.updateSources ?? false
18793
+ });
18794
+ }
18795
+ const { skillCount, fetchedSkillNames, updatedLock } = result;
18196
18796
  lock = updatedLock;
18197
18797
  totalSkillCount += skillCount;
18198
18798
  for (const name of fetchedSkillNames) {
@@ -18225,7 +18825,7 @@ async function resolveAndFetchSources(params) {
18225
18825
  async function checkLockedSkillsExist(curatedDir, skillNames) {
18226
18826
  if (skillNames.length === 0) return true;
18227
18827
  for (const name of skillNames) {
18228
- if (!await directoryExists((0, import_node_path120.join)(curatedDir, name))) {
18828
+ if (!await directoryExists((0, import_node_path124.join)(curatedDir, name))) {
18229
18829
  return false;
18230
18830
  }
18231
18831
  }
@@ -18256,7 +18856,7 @@ async function fetchSource(params) {
18256
18856
  ref = resolvedSha;
18257
18857
  logger.debug(`Resolved ${sourceKey} ref "${requestedRef}" to SHA: ${resolvedSha}`);
18258
18858
  }
18259
- const curatedDir = (0, import_node_path120.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
18859
+ const curatedDir = (0, import_node_path124.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
18260
18860
  if (locked && resolvedSha === locked.resolvedRef && !updateSources) {
18261
18861
  const allExist = await checkLockedSkillsExist(curatedDir, lockedSkillNames);
18262
18862
  if (allExist) {
@@ -18286,10 +18886,10 @@ async function fetchSource(params) {
18286
18886
  const semaphore = new import_promise2.Semaphore(FETCH_CONCURRENCY_LIMIT);
18287
18887
  const fetchedSkills = {};
18288
18888
  if (locked) {
18289
- const resolvedCuratedDir = (0, import_node_path120.resolve)(curatedDir);
18889
+ const resolvedCuratedDir = (0, import_node_path124.resolve)(curatedDir);
18290
18890
  for (const prevSkill of lockedSkillNames) {
18291
- const prevDir = (0, import_node_path120.join)(curatedDir, prevSkill);
18292
- if (!(0, import_node_path120.resolve)(prevDir).startsWith(resolvedCuratedDir + import_node_path120.sep)) {
18891
+ const prevDir = (0, import_node_path124.join)(curatedDir, prevSkill);
18892
+ if (!(0, import_node_path124.resolve)(prevDir).startsWith(resolvedCuratedDir + import_node_path124.sep)) {
18293
18893
  logger.warn(
18294
18894
  `Skipping removal of "${prevSkill}": resolved path is outside the curated directory.`
18295
18895
  );
@@ -18339,10 +18939,10 @@ async function fetchSource(params) {
18339
18939
  const skillFiles = [];
18340
18940
  for (const file of files) {
18341
18941
  const relativeToSkill = file.path.substring(skillDir.path.length + 1);
18342
- const localFilePath = (0, import_node_path120.join)(curatedDir, skillDir.name, relativeToSkill);
18942
+ const localFilePath = (0, import_node_path124.join)(curatedDir, skillDir.name, relativeToSkill);
18343
18943
  checkPathTraversal({
18344
18944
  relativePath: relativeToSkill,
18345
- intendedRootDir: (0, import_node_path120.join)(curatedDir, skillDir.name)
18945
+ intendedRootDir: (0, import_node_path124.join)(curatedDir, skillDir.name)
18346
18946
  });
18347
18947
  const content = await withSemaphore(
18348
18948
  semaphore,
@@ -18385,6 +18985,127 @@ async function fetchSource(params) {
18385
18985
  updatedLock: lock
18386
18986
  };
18387
18987
  }
18988
+ async function fetchSourceViaGit(params) {
18989
+ const { sourceEntry, baseDir, localSkillNames, alreadyFetchedSkillNames, updateSources, frozen } = params;
18990
+ let { lock } = params;
18991
+ const url = sourceEntry.source;
18992
+ const locked = getLockedSource(lock, url);
18993
+ const lockedSkillNames = locked ? getLockedSkillNames(locked) : [];
18994
+ let resolvedSha;
18995
+ let requestedRef;
18996
+ if (locked && !updateSources) {
18997
+ resolvedSha = locked.resolvedRef;
18998
+ requestedRef = locked.requestedRef;
18999
+ if (requestedRef) {
19000
+ validateRef(requestedRef);
19001
+ }
19002
+ } else if (sourceEntry.ref) {
19003
+ requestedRef = sourceEntry.ref;
19004
+ resolvedSha = await resolveRefToSha(url, requestedRef);
19005
+ } else {
19006
+ const def = await resolveDefaultRef(url);
19007
+ requestedRef = def.ref;
19008
+ resolvedSha = def.sha;
19009
+ }
19010
+ const curatedDir = (0, import_node_path124.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
19011
+ if (locked && resolvedSha === locked.resolvedRef && !updateSources) {
19012
+ if (await checkLockedSkillsExist(curatedDir, lockedSkillNames)) {
19013
+ return { skillCount: 0, fetchedSkillNames: lockedSkillNames, updatedLock: lock };
19014
+ }
19015
+ }
19016
+ if (!requestedRef) {
19017
+ if (frozen) {
19018
+ throw new Error(
19019
+ `Frozen install failed: lockfile entry for "${url}" is missing requestedRef. Run 'rulesync install' to update the lockfile.`
19020
+ );
19021
+ }
19022
+ const def = await resolveDefaultRef(url);
19023
+ requestedRef = def.ref;
19024
+ resolvedSha = def.sha;
19025
+ }
19026
+ const skillFilter = sourceEntry.skills ?? ["*"];
19027
+ const isWildcard = skillFilter.length === 1 && skillFilter[0] === "*";
19028
+ const remoteFiles = await fetchSkillFiles({
19029
+ url,
19030
+ ref: requestedRef,
19031
+ skillsPath: sourceEntry.path ?? "skills"
19032
+ });
19033
+ const skillFileMap = /* @__PURE__ */ new Map();
19034
+ for (const file of remoteFiles) {
19035
+ const idx = file.relativePath.indexOf("/");
19036
+ if (idx === -1) continue;
19037
+ const name = file.relativePath.substring(0, idx);
19038
+ const inner = file.relativePath.substring(idx + 1);
19039
+ const arr = skillFileMap.get(name) ?? [];
19040
+ arr.push({ relativePath: inner, content: file.content });
19041
+ skillFileMap.set(name, arr);
19042
+ }
19043
+ const allNames = [...skillFileMap.keys()];
19044
+ const filteredNames = isWildcard ? allNames : allNames.filter((n) => skillFilter.includes(n));
19045
+ if (locked) {
19046
+ const base = (0, import_node_path124.resolve)(curatedDir);
19047
+ for (const prev of lockedSkillNames) {
19048
+ const dir = (0, import_node_path124.join)(curatedDir, prev);
19049
+ if ((0, import_node_path124.resolve)(dir).startsWith(base + import_node_path124.sep) && await directoryExists(dir)) {
19050
+ await removeDirectory(dir);
19051
+ }
19052
+ }
19053
+ }
19054
+ const fetchedSkills = {};
19055
+ for (const skillName of filteredNames) {
19056
+ if (skillName.includes("..") || skillName.includes("/") || skillName.includes("\\")) {
19057
+ logger.warn(
19058
+ `Skipping skill with invalid name "${skillName}" from ${url}: contains path traversal characters.`
19059
+ );
19060
+ continue;
19061
+ }
19062
+ if (localSkillNames.has(skillName)) {
19063
+ logger.debug(
19064
+ `Skipping remote skill "${skillName}" from ${url}: local skill takes precedence.`
19065
+ );
19066
+ continue;
19067
+ }
19068
+ if (alreadyFetchedSkillNames.has(skillName)) {
19069
+ logger.warn(
19070
+ `Skipping duplicate skill "${skillName}" from ${url}: already fetched from another source.`
19071
+ );
19072
+ continue;
19073
+ }
19074
+ const files = skillFileMap.get(skillName) ?? [];
19075
+ const written = [];
19076
+ for (const file of files) {
19077
+ checkPathTraversal({
19078
+ relativePath: file.relativePath,
19079
+ intendedRootDir: (0, import_node_path124.join)(curatedDir, skillName)
19080
+ });
19081
+ await writeFileContent((0, import_node_path124.join)(curatedDir, skillName, file.relativePath), file.content);
19082
+ written.push({ path: file.relativePath, content: file.content });
19083
+ }
19084
+ const integrity = computeSkillIntegrity(written);
19085
+ const lockedSkillEntry = locked?.skills[skillName];
19086
+ if (lockedSkillEntry?.integrity && lockedSkillEntry.integrity !== integrity && resolvedSha === locked?.resolvedRef) {
19087
+ logger.warn(`Integrity mismatch for skill "${skillName}" from ${url}.`);
19088
+ }
19089
+ fetchedSkills[skillName] = { integrity };
19090
+ }
19091
+ const fetchedNames = Object.keys(fetchedSkills);
19092
+ const mergedSkills = { ...fetchedSkills };
19093
+ if (locked) {
19094
+ for (const [k, v] of Object.entries(locked.skills)) {
19095
+ if (!(k in mergedSkills)) mergedSkills[k] = v;
19096
+ }
19097
+ }
19098
+ lock = setLockedSource(lock, url, {
19099
+ requestedRef,
19100
+ resolvedRef: resolvedSha,
19101
+ resolvedAt: (/* @__PURE__ */ new Date()).toISOString(),
19102
+ skills: mergedSkills
19103
+ });
19104
+ logger.info(
19105
+ `Fetched ${fetchedNames.length} skill(s) from ${url}: ${fetchedNames.join(", ") || "(none)"}`
19106
+ );
19107
+ return { skillCount: fetchedNames.length, fetchedSkillNames: fetchedNames, updatedLock: lock };
19108
+ }
18388
19109
 
18389
19110
  // src/cli/commands/install.ts
18390
19111
  async function installCommand(options) {
@@ -18425,15 +19146,15 @@ async function installCommand(options) {
18425
19146
  var import_fastmcp = require("fastmcp");
18426
19147
 
18427
19148
  // src/mcp/tools.ts
18428
- var import_mini67 = require("zod/mini");
19149
+ var import_mini69 = require("zod/mini");
18429
19150
 
18430
19151
  // src/mcp/commands.ts
18431
- var import_node_path121 = require("path");
18432
- var import_mini59 = require("zod/mini");
19152
+ var import_node_path125 = require("path");
19153
+ var import_mini61 = require("zod/mini");
18433
19154
  var maxCommandSizeBytes = 1024 * 1024;
18434
19155
  var maxCommandsCount = 1e3;
18435
19156
  async function listCommands() {
18436
- const commandsDir = (0, import_node_path121.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
19157
+ const commandsDir = (0, import_node_path125.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
18437
19158
  try {
18438
19159
  const files = await listDirectoryFiles(commandsDir);
18439
19160
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -18449,7 +19170,7 @@ async function listCommands() {
18449
19170
  });
18450
19171
  const frontmatter = command.getFrontmatter();
18451
19172
  return {
18452
- relativePathFromCwd: (0, import_node_path121.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
19173
+ relativePathFromCwd: (0, import_node_path125.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
18453
19174
  frontmatter
18454
19175
  };
18455
19176
  } catch (error) {
@@ -18471,13 +19192,13 @@ async function getCommand({ relativePathFromCwd }) {
18471
19192
  relativePath: relativePathFromCwd,
18472
19193
  intendedRootDir: process.cwd()
18473
19194
  });
18474
- const filename = (0, import_node_path121.basename)(relativePathFromCwd);
19195
+ const filename = (0, import_node_path125.basename)(relativePathFromCwd);
18475
19196
  try {
18476
19197
  const command = await RulesyncCommand.fromFile({
18477
19198
  relativeFilePath: filename
18478
19199
  });
18479
19200
  return {
18480
- relativePathFromCwd: (0, import_node_path121.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
19201
+ relativePathFromCwd: (0, import_node_path125.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
18481
19202
  frontmatter: command.getFrontmatter(),
18482
19203
  body: command.getBody()
18483
19204
  };
@@ -18496,7 +19217,7 @@ async function putCommand({
18496
19217
  relativePath: relativePathFromCwd,
18497
19218
  intendedRootDir: process.cwd()
18498
19219
  });
18499
- const filename = (0, import_node_path121.basename)(relativePathFromCwd);
19220
+ const filename = (0, import_node_path125.basename)(relativePathFromCwd);
18500
19221
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
18501
19222
  if (estimatedSize > maxCommandSizeBytes) {
18502
19223
  throw new Error(
@@ -18506,7 +19227,7 @@ async function putCommand({
18506
19227
  try {
18507
19228
  const existingCommands = await listCommands();
18508
19229
  const isUpdate = existingCommands.some(
18509
- (command2) => command2.relativePathFromCwd === (0, import_node_path121.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
19230
+ (command2) => command2.relativePathFromCwd === (0, import_node_path125.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
18510
19231
  );
18511
19232
  if (!isUpdate && existingCommands.length >= maxCommandsCount) {
18512
19233
  throw new Error(
@@ -18523,11 +19244,11 @@ async function putCommand({
18523
19244
  fileContent,
18524
19245
  validate: true
18525
19246
  });
18526
- const commandsDir = (0, import_node_path121.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
19247
+ const commandsDir = (0, import_node_path125.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
18527
19248
  await ensureDir(commandsDir);
18528
19249
  await writeFileContent(command.getFilePath(), command.getFileContent());
18529
19250
  return {
18530
- relativePathFromCwd: (0, import_node_path121.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
19251
+ relativePathFromCwd: (0, import_node_path125.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
18531
19252
  frontmatter: command.getFrontmatter(),
18532
19253
  body: command.getBody()
18533
19254
  };
@@ -18542,12 +19263,12 @@ async function deleteCommand({ relativePathFromCwd }) {
18542
19263
  relativePath: relativePathFromCwd,
18543
19264
  intendedRootDir: process.cwd()
18544
19265
  });
18545
- const filename = (0, import_node_path121.basename)(relativePathFromCwd);
18546
- const fullPath = (0, import_node_path121.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
19266
+ const filename = (0, import_node_path125.basename)(relativePathFromCwd);
19267
+ const fullPath = (0, import_node_path125.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
18547
19268
  try {
18548
19269
  await removeFile(fullPath);
18549
19270
  return {
18550
- relativePathFromCwd: (0, import_node_path121.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
19271
+ relativePathFromCwd: (0, import_node_path125.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
18551
19272
  };
18552
19273
  } catch (error) {
18553
19274
  throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
@@ -18556,23 +19277,23 @@ async function deleteCommand({ relativePathFromCwd }) {
18556
19277
  }
18557
19278
  }
18558
19279
  var commandToolSchemas = {
18559
- listCommands: import_mini59.z.object({}),
18560
- getCommand: import_mini59.z.object({
18561
- relativePathFromCwd: import_mini59.z.string()
19280
+ listCommands: import_mini61.z.object({}),
19281
+ getCommand: import_mini61.z.object({
19282
+ relativePathFromCwd: import_mini61.z.string()
18562
19283
  }),
18563
- putCommand: import_mini59.z.object({
18564
- relativePathFromCwd: import_mini59.z.string(),
19284
+ putCommand: import_mini61.z.object({
19285
+ relativePathFromCwd: import_mini61.z.string(),
18565
19286
  frontmatter: RulesyncCommandFrontmatterSchema,
18566
- body: import_mini59.z.string()
19287
+ body: import_mini61.z.string()
18567
19288
  }),
18568
- deleteCommand: import_mini59.z.object({
18569
- relativePathFromCwd: import_mini59.z.string()
19289
+ deleteCommand: import_mini61.z.object({
19290
+ relativePathFromCwd: import_mini61.z.string()
18570
19291
  })
18571
19292
  };
18572
19293
  var commandTools = {
18573
19294
  listCommands: {
18574
19295
  name: "listCommands",
18575
- description: `List all commands from ${(0, import_node_path121.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
19296
+ description: `List all commands from ${(0, import_node_path125.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
18576
19297
  parameters: commandToolSchemas.listCommands,
18577
19298
  execute: async () => {
18578
19299
  const commands = await listCommands();
@@ -18614,15 +19335,15 @@ var commandTools = {
18614
19335
  };
18615
19336
 
18616
19337
  // src/mcp/generate.ts
18617
- var import_mini60 = require("zod/mini");
18618
- var generateOptionsSchema = import_mini60.z.object({
18619
- targets: import_mini60.z.optional(import_mini60.z.array(import_mini60.z.string())),
18620
- features: import_mini60.z.optional(import_mini60.z.array(import_mini60.z.string())),
18621
- delete: import_mini60.z.optional(import_mini60.z.boolean()),
18622
- global: import_mini60.z.optional(import_mini60.z.boolean()),
18623
- simulateCommands: import_mini60.z.optional(import_mini60.z.boolean()),
18624
- simulateSubagents: import_mini60.z.optional(import_mini60.z.boolean()),
18625
- simulateSkills: import_mini60.z.optional(import_mini60.z.boolean())
19338
+ var import_mini62 = require("zod/mini");
19339
+ var generateOptionsSchema = import_mini62.z.object({
19340
+ targets: import_mini62.z.optional(import_mini62.z.array(import_mini62.z.string())),
19341
+ features: import_mini62.z.optional(import_mini62.z.array(import_mini62.z.string())),
19342
+ delete: import_mini62.z.optional(import_mini62.z.boolean()),
19343
+ global: import_mini62.z.optional(import_mini62.z.boolean()),
19344
+ simulateCommands: import_mini62.z.optional(import_mini62.z.boolean()),
19345
+ simulateSubagents: import_mini62.z.optional(import_mini62.z.boolean()),
19346
+ simulateSkills: import_mini62.z.optional(import_mini62.z.boolean())
18626
19347
  });
18627
19348
  async function executeGenerate(options = {}) {
18628
19349
  try {
@@ -18699,11 +19420,11 @@ var generateTools = {
18699
19420
  };
18700
19421
 
18701
19422
  // src/mcp/ignore.ts
18702
- var import_node_path122 = require("path");
18703
- var import_mini61 = require("zod/mini");
19423
+ var import_node_path126 = require("path");
19424
+ var import_mini63 = require("zod/mini");
18704
19425
  var maxIgnoreFileSizeBytes = 100 * 1024;
18705
19426
  async function getIgnoreFile() {
18706
- const ignoreFilePath = (0, import_node_path122.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
19427
+ const ignoreFilePath = (0, import_node_path126.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
18707
19428
  try {
18708
19429
  const content = await readFileContent(ignoreFilePath);
18709
19430
  return {
@@ -18720,7 +19441,7 @@ async function getIgnoreFile() {
18720
19441
  }
18721
19442
  }
18722
19443
  async function putIgnoreFile({ content }) {
18723
- const ignoreFilePath = (0, import_node_path122.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
19444
+ const ignoreFilePath = (0, import_node_path126.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
18724
19445
  const contentSizeBytes = Buffer.byteLength(content, "utf8");
18725
19446
  if (contentSizeBytes > maxIgnoreFileSizeBytes) {
18726
19447
  throw new Error(
@@ -18744,8 +19465,8 @@ async function putIgnoreFile({ content }) {
18744
19465
  }
18745
19466
  }
18746
19467
  async function deleteIgnoreFile() {
18747
- const aiignorePath = (0, import_node_path122.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
18748
- const legacyIgnorePath = (0, import_node_path122.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
19468
+ const aiignorePath = (0, import_node_path126.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
19469
+ const legacyIgnorePath = (0, import_node_path126.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
18749
19470
  try {
18750
19471
  await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
18751
19472
  return {
@@ -18763,11 +19484,11 @@ async function deleteIgnoreFile() {
18763
19484
  }
18764
19485
  }
18765
19486
  var ignoreToolSchemas = {
18766
- getIgnoreFile: import_mini61.z.object({}),
18767
- putIgnoreFile: import_mini61.z.object({
18768
- content: import_mini61.z.string()
19487
+ getIgnoreFile: import_mini63.z.object({}),
19488
+ putIgnoreFile: import_mini63.z.object({
19489
+ content: import_mini63.z.string()
18769
19490
  }),
18770
- deleteIgnoreFile: import_mini61.z.object({})
19491
+ deleteIgnoreFile: import_mini63.z.object({})
18771
19492
  };
18772
19493
  var ignoreTools = {
18773
19494
  getIgnoreFile: {
@@ -18800,11 +19521,11 @@ var ignoreTools = {
18800
19521
  };
18801
19522
 
18802
19523
  // src/mcp/import.ts
18803
- var import_mini62 = require("zod/mini");
18804
- var importOptionsSchema = import_mini62.z.object({
18805
- target: import_mini62.z.string(),
18806
- features: import_mini62.z.optional(import_mini62.z.array(import_mini62.z.string())),
18807
- global: import_mini62.z.optional(import_mini62.z.boolean())
19524
+ var import_mini64 = require("zod/mini");
19525
+ var importOptionsSchema = import_mini64.z.object({
19526
+ target: import_mini64.z.string(),
19527
+ features: import_mini64.z.optional(import_mini64.z.array(import_mini64.z.string())),
19528
+ global: import_mini64.z.optional(import_mini64.z.boolean())
18808
19529
  });
18809
19530
  async function executeImport(options) {
18810
19531
  try {
@@ -18873,15 +19594,15 @@ var importTools = {
18873
19594
  };
18874
19595
 
18875
19596
  // src/mcp/mcp.ts
18876
- var import_node_path123 = require("path");
18877
- var import_mini63 = require("zod/mini");
19597
+ var import_node_path127 = require("path");
19598
+ var import_mini65 = require("zod/mini");
18878
19599
  var maxMcpSizeBytes = 1024 * 1024;
18879
19600
  async function getMcpFile() {
18880
19601
  try {
18881
19602
  const rulesyncMcp = await RulesyncMcp.fromFile({
18882
19603
  validate: true
18883
19604
  });
18884
- const relativePathFromCwd = (0, import_node_path123.join)(
19605
+ const relativePathFromCwd = (0, import_node_path127.join)(
18885
19606
  rulesyncMcp.getRelativeDirPath(),
18886
19607
  rulesyncMcp.getRelativeFilePath()
18887
19608
  );
@@ -18919,7 +19640,7 @@ async function putMcpFile({ content }) {
18919
19640
  const paths = RulesyncMcp.getSettablePaths();
18920
19641
  const relativeDirPath = paths.recommended.relativeDirPath;
18921
19642
  const relativeFilePath = paths.recommended.relativeFilePath;
18922
- const fullPath = (0, import_node_path123.join)(baseDir, relativeDirPath, relativeFilePath);
19643
+ const fullPath = (0, import_node_path127.join)(baseDir, relativeDirPath, relativeFilePath);
18923
19644
  const rulesyncMcp = new RulesyncMcp({
18924
19645
  baseDir,
18925
19646
  relativeDirPath,
@@ -18927,9 +19648,9 @@ async function putMcpFile({ content }) {
18927
19648
  fileContent: content,
18928
19649
  validate: true
18929
19650
  });
18930
- await ensureDir((0, import_node_path123.join)(baseDir, relativeDirPath));
19651
+ await ensureDir((0, import_node_path127.join)(baseDir, relativeDirPath));
18931
19652
  await writeFileContent(fullPath, content);
18932
- const relativePathFromCwd = (0, import_node_path123.join)(relativeDirPath, relativeFilePath);
19653
+ const relativePathFromCwd = (0, import_node_path127.join)(relativeDirPath, relativeFilePath);
18933
19654
  return {
18934
19655
  relativePathFromCwd,
18935
19656
  content: rulesyncMcp.getFileContent()
@@ -18947,15 +19668,15 @@ async function deleteMcpFile() {
18947
19668
  try {
18948
19669
  const baseDir = process.cwd();
18949
19670
  const paths = RulesyncMcp.getSettablePaths();
18950
- const recommendedPath = (0, import_node_path123.join)(
19671
+ const recommendedPath = (0, import_node_path127.join)(
18951
19672
  baseDir,
18952
19673
  paths.recommended.relativeDirPath,
18953
19674
  paths.recommended.relativeFilePath
18954
19675
  );
18955
- const legacyPath = (0, import_node_path123.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
19676
+ const legacyPath = (0, import_node_path127.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
18956
19677
  await removeFile(recommendedPath);
18957
19678
  await removeFile(legacyPath);
18958
- const relativePathFromCwd = (0, import_node_path123.join)(
19679
+ const relativePathFromCwd = (0, import_node_path127.join)(
18959
19680
  paths.recommended.relativeDirPath,
18960
19681
  paths.recommended.relativeFilePath
18961
19682
  );
@@ -18972,11 +19693,11 @@ async function deleteMcpFile() {
18972
19693
  }
18973
19694
  }
18974
19695
  var mcpToolSchemas = {
18975
- getMcpFile: import_mini63.z.object({}),
18976
- putMcpFile: import_mini63.z.object({
18977
- content: import_mini63.z.string()
19696
+ getMcpFile: import_mini65.z.object({}),
19697
+ putMcpFile: import_mini65.z.object({
19698
+ content: import_mini65.z.string()
18978
19699
  }),
18979
- deleteMcpFile: import_mini63.z.object({})
19700
+ deleteMcpFile: import_mini65.z.object({})
18980
19701
  };
18981
19702
  var mcpTools = {
18982
19703
  getMcpFile: {
@@ -19009,12 +19730,12 @@ var mcpTools = {
19009
19730
  };
19010
19731
 
19011
19732
  // src/mcp/rules.ts
19012
- var import_node_path124 = require("path");
19013
- var import_mini64 = require("zod/mini");
19733
+ var import_node_path128 = require("path");
19734
+ var import_mini66 = require("zod/mini");
19014
19735
  var maxRuleSizeBytes = 1024 * 1024;
19015
19736
  var maxRulesCount = 1e3;
19016
19737
  async function listRules() {
19017
- const rulesDir = (0, import_node_path124.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
19738
+ const rulesDir = (0, import_node_path128.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
19018
19739
  try {
19019
19740
  const files = await listDirectoryFiles(rulesDir);
19020
19741
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -19027,7 +19748,7 @@ async function listRules() {
19027
19748
  });
19028
19749
  const frontmatter = rule.getFrontmatter();
19029
19750
  return {
19030
- relativePathFromCwd: (0, import_node_path124.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
19751
+ relativePathFromCwd: (0, import_node_path128.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
19031
19752
  frontmatter
19032
19753
  };
19033
19754
  } catch (error) {
@@ -19049,14 +19770,14 @@ async function getRule({ relativePathFromCwd }) {
19049
19770
  relativePath: relativePathFromCwd,
19050
19771
  intendedRootDir: process.cwd()
19051
19772
  });
19052
- const filename = (0, import_node_path124.basename)(relativePathFromCwd);
19773
+ const filename = (0, import_node_path128.basename)(relativePathFromCwd);
19053
19774
  try {
19054
19775
  const rule = await RulesyncRule.fromFile({
19055
19776
  relativeFilePath: filename,
19056
19777
  validate: true
19057
19778
  });
19058
19779
  return {
19059
- relativePathFromCwd: (0, import_node_path124.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
19780
+ relativePathFromCwd: (0, import_node_path128.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
19060
19781
  frontmatter: rule.getFrontmatter(),
19061
19782
  body: rule.getBody()
19062
19783
  };
@@ -19075,7 +19796,7 @@ async function putRule({
19075
19796
  relativePath: relativePathFromCwd,
19076
19797
  intendedRootDir: process.cwd()
19077
19798
  });
19078
- const filename = (0, import_node_path124.basename)(relativePathFromCwd);
19799
+ const filename = (0, import_node_path128.basename)(relativePathFromCwd);
19079
19800
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
19080
19801
  if (estimatedSize > maxRuleSizeBytes) {
19081
19802
  throw new Error(
@@ -19085,7 +19806,7 @@ async function putRule({
19085
19806
  try {
19086
19807
  const existingRules = await listRules();
19087
19808
  const isUpdate = existingRules.some(
19088
- (rule2) => rule2.relativePathFromCwd === (0, import_node_path124.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
19809
+ (rule2) => rule2.relativePathFromCwd === (0, import_node_path128.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
19089
19810
  );
19090
19811
  if (!isUpdate && existingRules.length >= maxRulesCount) {
19091
19812
  throw new Error(
@@ -19100,11 +19821,11 @@ async function putRule({
19100
19821
  body,
19101
19822
  validate: true
19102
19823
  });
19103
- const rulesDir = (0, import_node_path124.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
19824
+ const rulesDir = (0, import_node_path128.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
19104
19825
  await ensureDir(rulesDir);
19105
19826
  await writeFileContent(rule.getFilePath(), rule.getFileContent());
19106
19827
  return {
19107
- relativePathFromCwd: (0, import_node_path124.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
19828
+ relativePathFromCwd: (0, import_node_path128.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
19108
19829
  frontmatter: rule.getFrontmatter(),
19109
19830
  body: rule.getBody()
19110
19831
  };
@@ -19119,12 +19840,12 @@ async function deleteRule({ relativePathFromCwd }) {
19119
19840
  relativePath: relativePathFromCwd,
19120
19841
  intendedRootDir: process.cwd()
19121
19842
  });
19122
- const filename = (0, import_node_path124.basename)(relativePathFromCwd);
19123
- const fullPath = (0, import_node_path124.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
19843
+ const filename = (0, import_node_path128.basename)(relativePathFromCwd);
19844
+ const fullPath = (0, import_node_path128.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
19124
19845
  try {
19125
19846
  await removeFile(fullPath);
19126
19847
  return {
19127
- relativePathFromCwd: (0, import_node_path124.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
19848
+ relativePathFromCwd: (0, import_node_path128.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
19128
19849
  };
19129
19850
  } catch (error) {
19130
19851
  throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
@@ -19133,23 +19854,23 @@ async function deleteRule({ relativePathFromCwd }) {
19133
19854
  }
19134
19855
  }
19135
19856
  var ruleToolSchemas = {
19136
- listRules: import_mini64.z.object({}),
19137
- getRule: import_mini64.z.object({
19138
- relativePathFromCwd: import_mini64.z.string()
19857
+ listRules: import_mini66.z.object({}),
19858
+ getRule: import_mini66.z.object({
19859
+ relativePathFromCwd: import_mini66.z.string()
19139
19860
  }),
19140
- putRule: import_mini64.z.object({
19141
- relativePathFromCwd: import_mini64.z.string(),
19861
+ putRule: import_mini66.z.object({
19862
+ relativePathFromCwd: import_mini66.z.string(),
19142
19863
  frontmatter: RulesyncRuleFrontmatterSchema,
19143
- body: import_mini64.z.string()
19864
+ body: import_mini66.z.string()
19144
19865
  }),
19145
- deleteRule: import_mini64.z.object({
19146
- relativePathFromCwd: import_mini64.z.string()
19866
+ deleteRule: import_mini66.z.object({
19867
+ relativePathFromCwd: import_mini66.z.string()
19147
19868
  })
19148
19869
  };
19149
19870
  var ruleTools = {
19150
19871
  listRules: {
19151
19872
  name: "listRules",
19152
- description: `List all rules from ${(0, import_node_path124.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
19873
+ description: `List all rules from ${(0, import_node_path128.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
19153
19874
  parameters: ruleToolSchemas.listRules,
19154
19875
  execute: async () => {
19155
19876
  const rules = await listRules();
@@ -19191,8 +19912,8 @@ var ruleTools = {
19191
19912
  };
19192
19913
 
19193
19914
  // src/mcp/skills.ts
19194
- var import_node_path125 = require("path");
19195
- var import_mini65 = require("zod/mini");
19915
+ var import_node_path129 = require("path");
19916
+ var import_mini67 = require("zod/mini");
19196
19917
  var maxSkillSizeBytes = 1024 * 1024;
19197
19918
  var maxSkillsCount = 1e3;
19198
19919
  function aiDirFileToMcpSkillFile(file) {
@@ -19208,19 +19929,19 @@ function mcpSkillFileToAiDirFile(file) {
19208
19929
  };
19209
19930
  }
19210
19931
  function extractDirName(relativeDirPathFromCwd) {
19211
- const dirName = (0, import_node_path125.basename)(relativeDirPathFromCwd);
19932
+ const dirName = (0, import_node_path129.basename)(relativeDirPathFromCwd);
19212
19933
  if (!dirName) {
19213
19934
  throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
19214
19935
  }
19215
19936
  return dirName;
19216
19937
  }
19217
19938
  async function listSkills() {
19218
- const skillsDir = (0, import_node_path125.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
19939
+ const skillsDir = (0, import_node_path129.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
19219
19940
  try {
19220
- const skillDirPaths = await findFilesByGlobs((0, import_node_path125.join)(skillsDir, "*"), { type: "dir" });
19941
+ const skillDirPaths = await findFilesByGlobs((0, import_node_path129.join)(skillsDir, "*"), { type: "dir" });
19221
19942
  const skills = await Promise.all(
19222
19943
  skillDirPaths.map(async (dirPath) => {
19223
- const dirName = (0, import_node_path125.basename)(dirPath);
19944
+ const dirName = (0, import_node_path129.basename)(dirPath);
19224
19945
  if (!dirName) return null;
19225
19946
  try {
19226
19947
  const skill = await RulesyncSkill.fromDir({
@@ -19228,7 +19949,7 @@ async function listSkills() {
19228
19949
  });
19229
19950
  const frontmatter = skill.getFrontmatter();
19230
19951
  return {
19231
- relativeDirPathFromCwd: (0, import_node_path125.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
19952
+ relativeDirPathFromCwd: (0, import_node_path129.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
19232
19953
  frontmatter
19233
19954
  };
19234
19955
  } catch (error) {
@@ -19256,7 +19977,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
19256
19977
  dirName
19257
19978
  });
19258
19979
  return {
19259
- relativeDirPathFromCwd: (0, import_node_path125.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
19980
+ relativeDirPathFromCwd: (0, import_node_path129.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
19260
19981
  frontmatter: skill.getFrontmatter(),
19261
19982
  body: skill.getBody(),
19262
19983
  otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
@@ -19290,7 +20011,7 @@ async function putSkill({
19290
20011
  try {
19291
20012
  const existingSkills = await listSkills();
19292
20013
  const isUpdate = existingSkills.some(
19293
- (skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path125.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
20014
+ (skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path129.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
19294
20015
  );
19295
20016
  if (!isUpdate && existingSkills.length >= maxSkillsCount) {
19296
20017
  throw new Error(
@@ -19307,9 +20028,9 @@ async function putSkill({
19307
20028
  otherFiles: aiDirFiles,
19308
20029
  validate: true
19309
20030
  });
19310
- const skillDirPath = (0, import_node_path125.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
20031
+ const skillDirPath = (0, import_node_path129.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
19311
20032
  await ensureDir(skillDirPath);
19312
- const skillFilePath = (0, import_node_path125.join)(skillDirPath, SKILL_FILE_NAME);
20033
+ const skillFilePath = (0, import_node_path129.join)(skillDirPath, SKILL_FILE_NAME);
19313
20034
  const skillFileContent = stringifyFrontmatter(body, frontmatter);
19314
20035
  await writeFileContent(skillFilePath, skillFileContent);
19315
20036
  for (const file of otherFiles) {
@@ -19317,15 +20038,15 @@ async function putSkill({
19317
20038
  relativePath: file.name,
19318
20039
  intendedRootDir: skillDirPath
19319
20040
  });
19320
- const filePath = (0, import_node_path125.join)(skillDirPath, file.name);
19321
- const fileDir = (0, import_node_path125.join)(skillDirPath, (0, import_node_path125.dirname)(file.name));
20041
+ const filePath = (0, import_node_path129.join)(skillDirPath, file.name);
20042
+ const fileDir = (0, import_node_path129.join)(skillDirPath, (0, import_node_path129.dirname)(file.name));
19322
20043
  if (fileDir !== skillDirPath) {
19323
20044
  await ensureDir(fileDir);
19324
20045
  }
19325
20046
  await writeFileContent(filePath, file.body);
19326
20047
  }
19327
20048
  return {
19328
- relativeDirPathFromCwd: (0, import_node_path125.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
20049
+ relativeDirPathFromCwd: (0, import_node_path129.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
19329
20050
  frontmatter: skill.getFrontmatter(),
19330
20051
  body: skill.getBody(),
19331
20052
  otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
@@ -19347,13 +20068,13 @@ async function deleteSkill({
19347
20068
  intendedRootDir: process.cwd()
19348
20069
  });
19349
20070
  const dirName = extractDirName(relativeDirPathFromCwd);
19350
- const skillDirPath = (0, import_node_path125.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
20071
+ const skillDirPath = (0, import_node_path129.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
19351
20072
  try {
19352
20073
  if (await directoryExists(skillDirPath)) {
19353
20074
  await removeDirectory(skillDirPath);
19354
20075
  }
19355
20076
  return {
19356
- relativeDirPathFromCwd: (0, import_node_path125.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
20077
+ relativeDirPathFromCwd: (0, import_node_path129.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
19357
20078
  };
19358
20079
  } catch (error) {
19359
20080
  throw new Error(
@@ -19364,29 +20085,29 @@ async function deleteSkill({
19364
20085
  );
19365
20086
  }
19366
20087
  }
19367
- var McpSkillFileSchema = import_mini65.z.object({
19368
- name: import_mini65.z.string(),
19369
- body: import_mini65.z.string()
20088
+ var McpSkillFileSchema = import_mini67.z.object({
20089
+ name: import_mini67.z.string(),
20090
+ body: import_mini67.z.string()
19370
20091
  });
19371
20092
  var skillToolSchemas = {
19372
- listSkills: import_mini65.z.object({}),
19373
- getSkill: import_mini65.z.object({
19374
- relativeDirPathFromCwd: import_mini65.z.string()
20093
+ listSkills: import_mini67.z.object({}),
20094
+ getSkill: import_mini67.z.object({
20095
+ relativeDirPathFromCwd: import_mini67.z.string()
19375
20096
  }),
19376
- putSkill: import_mini65.z.object({
19377
- relativeDirPathFromCwd: import_mini65.z.string(),
20097
+ putSkill: import_mini67.z.object({
20098
+ relativeDirPathFromCwd: import_mini67.z.string(),
19378
20099
  frontmatter: RulesyncSkillFrontmatterSchema,
19379
- body: import_mini65.z.string(),
19380
- otherFiles: import_mini65.z.optional(import_mini65.z.array(McpSkillFileSchema))
20100
+ body: import_mini67.z.string(),
20101
+ otherFiles: import_mini67.z.optional(import_mini67.z.array(McpSkillFileSchema))
19381
20102
  }),
19382
- deleteSkill: import_mini65.z.object({
19383
- relativeDirPathFromCwd: import_mini65.z.string()
20103
+ deleteSkill: import_mini67.z.object({
20104
+ relativeDirPathFromCwd: import_mini67.z.string()
19384
20105
  })
19385
20106
  };
19386
20107
  var skillTools = {
19387
20108
  listSkills: {
19388
20109
  name: "listSkills",
19389
- description: `List all skills from ${(0, import_node_path125.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
20110
+ description: `List all skills from ${(0, import_node_path129.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
19390
20111
  parameters: skillToolSchemas.listSkills,
19391
20112
  execute: async () => {
19392
20113
  const skills = await listSkills();
@@ -19429,12 +20150,12 @@ var skillTools = {
19429
20150
  };
19430
20151
 
19431
20152
  // src/mcp/subagents.ts
19432
- var import_node_path126 = require("path");
19433
- var import_mini66 = require("zod/mini");
20153
+ var import_node_path130 = require("path");
20154
+ var import_mini68 = require("zod/mini");
19434
20155
  var maxSubagentSizeBytes = 1024 * 1024;
19435
20156
  var maxSubagentsCount = 1e3;
19436
20157
  async function listSubagents() {
19437
- const subagentsDir = (0, import_node_path126.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
20158
+ const subagentsDir = (0, import_node_path130.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
19438
20159
  try {
19439
20160
  const files = await listDirectoryFiles(subagentsDir);
19440
20161
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -19447,7 +20168,7 @@ async function listSubagents() {
19447
20168
  });
19448
20169
  const frontmatter = subagent.getFrontmatter();
19449
20170
  return {
19450
- relativePathFromCwd: (0, import_node_path126.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
20171
+ relativePathFromCwd: (0, import_node_path130.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
19451
20172
  frontmatter
19452
20173
  };
19453
20174
  } catch (error) {
@@ -19471,14 +20192,14 @@ async function getSubagent({ relativePathFromCwd }) {
19471
20192
  relativePath: relativePathFromCwd,
19472
20193
  intendedRootDir: process.cwd()
19473
20194
  });
19474
- const filename = (0, import_node_path126.basename)(relativePathFromCwd);
20195
+ const filename = (0, import_node_path130.basename)(relativePathFromCwd);
19475
20196
  try {
19476
20197
  const subagent = await RulesyncSubagent.fromFile({
19477
20198
  relativeFilePath: filename,
19478
20199
  validate: true
19479
20200
  });
19480
20201
  return {
19481
- relativePathFromCwd: (0, import_node_path126.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
20202
+ relativePathFromCwd: (0, import_node_path130.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
19482
20203
  frontmatter: subagent.getFrontmatter(),
19483
20204
  body: subagent.getBody()
19484
20205
  };
@@ -19497,7 +20218,7 @@ async function putSubagent({
19497
20218
  relativePath: relativePathFromCwd,
19498
20219
  intendedRootDir: process.cwd()
19499
20220
  });
19500
- const filename = (0, import_node_path126.basename)(relativePathFromCwd);
20221
+ const filename = (0, import_node_path130.basename)(relativePathFromCwd);
19501
20222
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
19502
20223
  if (estimatedSize > maxSubagentSizeBytes) {
19503
20224
  throw new Error(
@@ -19507,7 +20228,7 @@ async function putSubagent({
19507
20228
  try {
19508
20229
  const existingSubagents = await listSubagents();
19509
20230
  const isUpdate = existingSubagents.some(
19510
- (subagent2) => subagent2.relativePathFromCwd === (0, import_node_path126.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
20231
+ (subagent2) => subagent2.relativePathFromCwd === (0, import_node_path130.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
19511
20232
  );
19512
20233
  if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
19513
20234
  throw new Error(
@@ -19522,11 +20243,11 @@ async function putSubagent({
19522
20243
  body,
19523
20244
  validate: true
19524
20245
  });
19525
- const subagentsDir = (0, import_node_path126.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
20246
+ const subagentsDir = (0, import_node_path130.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
19526
20247
  await ensureDir(subagentsDir);
19527
20248
  await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
19528
20249
  return {
19529
- relativePathFromCwd: (0, import_node_path126.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
20250
+ relativePathFromCwd: (0, import_node_path130.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
19530
20251
  frontmatter: subagent.getFrontmatter(),
19531
20252
  body: subagent.getBody()
19532
20253
  };
@@ -19541,12 +20262,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
19541
20262
  relativePath: relativePathFromCwd,
19542
20263
  intendedRootDir: process.cwd()
19543
20264
  });
19544
- const filename = (0, import_node_path126.basename)(relativePathFromCwd);
19545
- const fullPath = (0, import_node_path126.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
20265
+ const filename = (0, import_node_path130.basename)(relativePathFromCwd);
20266
+ const fullPath = (0, import_node_path130.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
19546
20267
  try {
19547
20268
  await removeFile(fullPath);
19548
20269
  return {
19549
- relativePathFromCwd: (0, import_node_path126.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
20270
+ relativePathFromCwd: (0, import_node_path130.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
19550
20271
  };
19551
20272
  } catch (error) {
19552
20273
  throw new Error(
@@ -19558,23 +20279,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
19558
20279
  }
19559
20280
  }
19560
20281
  var subagentToolSchemas = {
19561
- listSubagents: import_mini66.z.object({}),
19562
- getSubagent: import_mini66.z.object({
19563
- relativePathFromCwd: import_mini66.z.string()
20282
+ listSubagents: import_mini68.z.object({}),
20283
+ getSubagent: import_mini68.z.object({
20284
+ relativePathFromCwd: import_mini68.z.string()
19564
20285
  }),
19565
- putSubagent: import_mini66.z.object({
19566
- relativePathFromCwd: import_mini66.z.string(),
20286
+ putSubagent: import_mini68.z.object({
20287
+ relativePathFromCwd: import_mini68.z.string(),
19567
20288
  frontmatter: RulesyncSubagentFrontmatterSchema,
19568
- body: import_mini66.z.string()
20289
+ body: import_mini68.z.string()
19569
20290
  }),
19570
- deleteSubagent: import_mini66.z.object({
19571
- relativePathFromCwd: import_mini66.z.string()
20291
+ deleteSubagent: import_mini68.z.object({
20292
+ relativePathFromCwd: import_mini68.z.string()
19572
20293
  })
19573
20294
  };
19574
20295
  var subagentTools = {
19575
20296
  listSubagents: {
19576
20297
  name: "listSubagents",
19577
- description: `List all subagents from ${(0, import_node_path126.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
20298
+ description: `List all subagents from ${(0, import_node_path130.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
19578
20299
  parameters: subagentToolSchemas.listSubagents,
19579
20300
  execute: async () => {
19580
20301
  const subagents = await listSubagents();
@@ -19616,7 +20337,7 @@ var subagentTools = {
19616
20337
  };
19617
20338
 
19618
20339
  // src/mcp/tools.ts
19619
- var rulesyncFeatureSchema = import_mini67.z.enum([
20340
+ var rulesyncFeatureSchema = import_mini69.z.enum([
19620
20341
  "rule",
19621
20342
  "command",
19622
20343
  "subagent",
@@ -19626,21 +20347,21 @@ var rulesyncFeatureSchema = import_mini67.z.enum([
19626
20347
  "generate",
19627
20348
  "import"
19628
20349
  ]);
19629
- var rulesyncOperationSchema = import_mini67.z.enum(["list", "get", "put", "delete", "run"]);
19630
- var skillFileSchema = import_mini67.z.object({
19631
- name: import_mini67.z.string(),
19632
- body: import_mini67.z.string()
20350
+ var rulesyncOperationSchema = import_mini69.z.enum(["list", "get", "put", "delete", "run"]);
20351
+ var skillFileSchema = import_mini69.z.object({
20352
+ name: import_mini69.z.string(),
20353
+ body: import_mini69.z.string()
19633
20354
  });
19634
- var rulesyncToolSchema = import_mini67.z.object({
20355
+ var rulesyncToolSchema = import_mini69.z.object({
19635
20356
  feature: rulesyncFeatureSchema,
19636
20357
  operation: rulesyncOperationSchema,
19637
- targetPathFromCwd: import_mini67.z.optional(import_mini67.z.string()),
19638
- frontmatter: import_mini67.z.optional(import_mini67.z.unknown()),
19639
- body: import_mini67.z.optional(import_mini67.z.string()),
19640
- otherFiles: import_mini67.z.optional(import_mini67.z.array(skillFileSchema)),
19641
- content: import_mini67.z.optional(import_mini67.z.string()),
19642
- generateOptions: import_mini67.z.optional(generateOptionsSchema),
19643
- importOptions: import_mini67.z.optional(importOptionsSchema)
20358
+ targetPathFromCwd: import_mini69.z.optional(import_mini69.z.string()),
20359
+ frontmatter: import_mini69.z.optional(import_mini69.z.unknown()),
20360
+ body: import_mini69.z.optional(import_mini69.z.string()),
20361
+ otherFiles: import_mini69.z.optional(import_mini69.z.array(skillFileSchema)),
20362
+ content: import_mini69.z.optional(import_mini69.z.string()),
20363
+ generateOptions: import_mini69.z.optional(generateOptionsSchema),
20364
+ importOptions: import_mini69.z.optional(importOptionsSchema)
19644
20365
  });
19645
20366
  var supportedOperationsByFeature = {
19646
20367
  rule: ["list", "get", "put", "delete"],
@@ -20199,7 +20920,7 @@ async function updateCommand(currentVersion, options) {
20199
20920
  }
20200
20921
 
20201
20922
  // src/cli/index.ts
20202
- var getVersion = () => "7.12.2";
20923
+ var getVersion = () => "7.14.0";
20203
20924
  var main = async () => {
20204
20925
  const program = new import_commander.Command();
20205
20926
  const version = getVersion();