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.
@@ -159,7 +159,7 @@ var MAX_FILE_SIZE = 10 * 1024 * 1024;
159
159
  var FETCH_CONCURRENCY_LIMIT = 10;
160
160
 
161
161
  // src/utils/file.ts
162
- import { mkdir, mkdtemp, readdir, readFile, rm, stat, writeFile } from "fs/promises";
162
+ import { lstat, mkdir, mkdtemp, readdir, readFile, rm, stat, writeFile } from "fs/promises";
163
163
  import os from "os";
164
164
  import { dirname, join as join2, relative, resolve } from "path";
165
165
  import { kebabCase } from "es-toolkit";
@@ -240,6 +240,24 @@ async function fileExists(filepath) {
240
240
  return false;
241
241
  }
242
242
  }
243
+ async function getFileSize(filepath) {
244
+ try {
245
+ const stats = await stat(filepath);
246
+ return stats.size;
247
+ } catch (error) {
248
+ throw new Error(`Failed to get file size for "${filepath}": ${formatError(error)}`, {
249
+ cause: error
250
+ });
251
+ }
252
+ }
253
+ async function isSymlink(filepath) {
254
+ try {
255
+ const stats = await lstat(filepath);
256
+ return stats.isSymbolicLink();
257
+ } catch {
258
+ return false;
259
+ }
260
+ }
243
261
  async function listDirectoryFiles(dir) {
244
262
  try {
245
263
  return await readdir(dir);
@@ -314,10 +332,32 @@ async function removeTempDirectory(tempDir) {
314
332
  }
315
333
 
316
334
  // src/config/config.ts
317
- import { minLength, optional, z as z3 } from "zod/mini";
335
+ import { isAbsolute } from "path";
336
+ import { minLength, optional, refine, z as z3 } from "zod/mini";
337
+ function hasControlCharacters(value) {
338
+ for (let i = 0; i < value.length; i++) {
339
+ const code = value.charCodeAt(i);
340
+ if (code >= 0 && code <= 31 || code === 127) return true;
341
+ }
342
+ return false;
343
+ }
318
344
  var SourceEntrySchema = z3.object({
319
345
  source: z3.string().check(minLength(1, "source must be a non-empty string")),
320
- skills: optional(z3.array(z3.string()))
346
+ skills: optional(z3.array(z3.string())),
347
+ transport: optional(z3.enum(["github", "git"])),
348
+ ref: optional(
349
+ z3.string().check(
350
+ refine((v) => !v.startsWith("-"), 'ref must not start with "-"'),
351
+ refine((v) => !hasControlCharacters(v), "ref must not contain control characters")
352
+ )
353
+ ),
354
+ path: optional(
355
+ z3.string().check(
356
+ refine((v) => !v.includes(".."), 'path must not contain ".."'),
357
+ refine((v) => !isAbsolute(v), "path must not be absolute"),
358
+ refine((v) => !hasControlCharacters(v), "path must not contain control characters")
359
+ )
360
+ )
321
361
  });
322
362
  var ConfigParamsSchema = z3.object({
323
363
  baseDirs: z3.array(z3.string()),
@@ -606,7 +646,7 @@ function getBaseDirsInLightOfGlobal({
606
646
  }
607
647
 
608
648
  // src/lib/generate.ts
609
- import { join as join114 } from "path";
649
+ import { join as join116 } from "path";
610
650
  import { intersection } from "es-toolkit";
611
651
 
612
652
  // src/features/commands/commands-processor.ts
@@ -7402,9 +7442,9 @@ var McpProcessor = class extends FeatureProcessor {
7402
7442
  };
7403
7443
 
7404
7444
  // src/features/rules/rules-processor.ts
7405
- import { basename as basename10, dirname as dirname3, join as join113, relative as relative5 } from "path";
7445
+ import { basename as basename10, dirname as dirname3, join as join115, relative as relative5 } from "path";
7406
7446
  import { encode } from "@toon-format/toon";
7407
- import { z as z54 } from "zod/mini";
7447
+ import { z as z56 } from "zod/mini";
7408
7448
 
7409
7449
  // src/constants/general.ts
7410
7450
  var SKILL_FILE_NAME = "SKILL.md";
@@ -7872,8 +7912,8 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
7872
7912
  };
7873
7913
 
7874
7914
  // src/features/skills/skills-processor.ts
7875
- import { basename as basename5, join as join75 } from "path";
7876
- import { z as z38 } from "zod/mini";
7915
+ import { basename as basename5, join as join76 } from "path";
7916
+ import { z as z39 } from "zod/mini";
7877
7917
 
7878
7918
  // src/types/dir-feature-processor.ts
7879
7919
  import { join as join59 } from "path";
@@ -8003,7 +8043,8 @@ var RulesyncSkillFrontmatterSchemaInternal = z24.looseObject({
8003
8043
  claudecode: z24.optional(
8004
8044
  z24.looseObject({
8005
8045
  "allowed-tools": z24.optional(z24.array(z24.string())),
8006
- model: z24.optional(z24.string())
8046
+ model: z24.optional(z24.string()),
8047
+ "disable-model-invocation": z24.optional(z24.boolean())
8007
8048
  })
8008
8049
  ),
8009
8050
  codexcli: z24.optional(
@@ -8440,7 +8481,8 @@ var ClaudecodeSkillFrontmatterSchema = z27.looseObject({
8440
8481
  name: z27.string(),
8441
8482
  description: z27.string(),
8442
8483
  "allowed-tools": z27.optional(z27.array(z27.string())),
8443
- model: z27.optional(z27.string())
8484
+ model: z27.optional(z27.string()),
8485
+ "disable-model-invocation": z27.optional(z27.boolean())
8444
8486
  });
8445
8487
  var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
8446
8488
  constructor({
@@ -8508,7 +8550,10 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
8508
8550
  const frontmatter = this.getFrontmatter();
8509
8551
  const claudecodeSection = {
8510
8552
  ...frontmatter["allowed-tools"] && { "allowed-tools": frontmatter["allowed-tools"] },
8511
- ...frontmatter.model && { model: frontmatter.model }
8553
+ ...frontmatter.model && { model: frontmatter.model },
8554
+ ...frontmatter["disable-model-invocation"] !== void 0 && {
8555
+ "disable-model-invocation": frontmatter["disable-model-invocation"]
8556
+ }
8512
8557
  };
8513
8558
  const rulesyncFrontmatter = {
8514
8559
  name: frontmatter.name,
@@ -8541,6 +8586,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
8541
8586
  },
8542
8587
  ...rulesyncFrontmatter.claudecode?.model && {
8543
8588
  model: rulesyncFrontmatter.claudecode.model
8589
+ },
8590
+ ...rulesyncFrontmatter.claudecode?.["disable-model-invocation"] !== void 0 && {
8591
+ "disable-model-invocation": rulesyncFrontmatter.claudecode["disable-model-invocation"]
8544
8592
  }
8545
8593
  };
8546
8594
  const settablePaths = _ClaudecodeSkill.getSettablePaths({ global });
@@ -9417,17 +9465,193 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
9417
9465
  }
9418
9466
  };
9419
9467
 
9420
- // src/features/skills/kilo-skill.ts
9468
+ // src/features/skills/junie-skill.ts
9421
9469
  import { join as join69 } from "path";
9422
9470
  import { z as z33 } from "zod/mini";
9423
- var KiloSkillFrontmatterSchema = z33.looseObject({
9471
+ var JunieSkillFrontmatterSchema = z33.looseObject({
9424
9472
  name: z33.string(),
9425
9473
  description: z33.string()
9426
9474
  });
9475
+ var JunieSkill = class _JunieSkill extends ToolSkill {
9476
+ constructor({
9477
+ baseDir = process.cwd(),
9478
+ relativeDirPath = join69(".junie", "skills"),
9479
+ dirName,
9480
+ frontmatter,
9481
+ body,
9482
+ otherFiles = [],
9483
+ validate = true,
9484
+ global = false
9485
+ }) {
9486
+ super({
9487
+ baseDir,
9488
+ relativeDirPath,
9489
+ dirName,
9490
+ mainFile: {
9491
+ name: SKILL_FILE_NAME,
9492
+ body,
9493
+ frontmatter: { ...frontmatter }
9494
+ },
9495
+ otherFiles,
9496
+ global
9497
+ });
9498
+ if (validate) {
9499
+ const result = this.validate();
9500
+ if (!result.success) {
9501
+ throw result.error;
9502
+ }
9503
+ }
9504
+ }
9505
+ static getSettablePaths(options) {
9506
+ if (options?.global) {
9507
+ throw new Error("JunieSkill does not support global mode.");
9508
+ }
9509
+ return {
9510
+ relativeDirPath: join69(".junie", "skills")
9511
+ };
9512
+ }
9513
+ getFrontmatter() {
9514
+ const result = JunieSkillFrontmatterSchema.parse(this.requireMainFileFrontmatter());
9515
+ return result;
9516
+ }
9517
+ getBody() {
9518
+ return this.mainFile?.body ?? "";
9519
+ }
9520
+ validate() {
9521
+ if (!this.mainFile) {
9522
+ return {
9523
+ success: false,
9524
+ error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
9525
+ };
9526
+ }
9527
+ const result = JunieSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
9528
+ if (!result.success) {
9529
+ return {
9530
+ success: false,
9531
+ error: new Error(
9532
+ `Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
9533
+ )
9534
+ };
9535
+ }
9536
+ if (result.data.name !== this.getDirName()) {
9537
+ return {
9538
+ success: false,
9539
+ error: new Error(
9540
+ `${this.getDirPath()}: frontmatter name (${result.data.name}) must match directory name (${this.getDirName()})`
9541
+ )
9542
+ };
9543
+ }
9544
+ return { success: true, error: null };
9545
+ }
9546
+ toRulesyncSkill() {
9547
+ const frontmatter = this.getFrontmatter();
9548
+ const rulesyncFrontmatter = {
9549
+ name: frontmatter.name,
9550
+ description: frontmatter.description,
9551
+ targets: ["*"]
9552
+ };
9553
+ return new RulesyncSkill({
9554
+ baseDir: this.baseDir,
9555
+ relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
9556
+ dirName: this.getDirName(),
9557
+ frontmatter: rulesyncFrontmatter,
9558
+ body: this.getBody(),
9559
+ otherFiles: this.getOtherFiles(),
9560
+ validate: true,
9561
+ global: this.global
9562
+ });
9563
+ }
9564
+ static fromRulesyncSkill({
9565
+ rulesyncSkill,
9566
+ validate = true,
9567
+ global = false
9568
+ }) {
9569
+ const settablePaths = _JunieSkill.getSettablePaths({ global });
9570
+ const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
9571
+ const junieFrontmatter = {
9572
+ name: rulesyncFrontmatter.name,
9573
+ description: rulesyncFrontmatter.description
9574
+ };
9575
+ return new _JunieSkill({
9576
+ baseDir: rulesyncSkill.getBaseDir(),
9577
+ relativeDirPath: settablePaths.relativeDirPath,
9578
+ dirName: junieFrontmatter.name,
9579
+ frontmatter: junieFrontmatter,
9580
+ body: rulesyncSkill.getBody(),
9581
+ otherFiles: rulesyncSkill.getOtherFiles(),
9582
+ validate,
9583
+ global
9584
+ });
9585
+ }
9586
+ static isTargetedByRulesyncSkill(rulesyncSkill) {
9587
+ const targets = rulesyncSkill.getFrontmatter().targets;
9588
+ return targets.includes("*") || targets.includes("junie");
9589
+ }
9590
+ static async fromDir(params) {
9591
+ const loaded = await this.loadSkillDirContent({
9592
+ ...params,
9593
+ getSettablePaths: _JunieSkill.getSettablePaths
9594
+ });
9595
+ const result = JunieSkillFrontmatterSchema.safeParse(loaded.frontmatter);
9596
+ if (!result.success) {
9597
+ const skillDirPath = join69(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
9598
+ throw new Error(
9599
+ `Invalid frontmatter in ${join69(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
9600
+ );
9601
+ }
9602
+ if (result.data.name !== loaded.dirName) {
9603
+ const skillFilePath = join69(
9604
+ loaded.baseDir,
9605
+ loaded.relativeDirPath,
9606
+ loaded.dirName,
9607
+ SKILL_FILE_NAME
9608
+ );
9609
+ throw new Error(
9610
+ `Frontmatter name (${result.data.name}) must match directory name (${loaded.dirName}) in ${skillFilePath}`
9611
+ );
9612
+ }
9613
+ return new _JunieSkill({
9614
+ baseDir: loaded.baseDir,
9615
+ relativeDirPath: loaded.relativeDirPath,
9616
+ dirName: loaded.dirName,
9617
+ frontmatter: result.data,
9618
+ body: loaded.body,
9619
+ otherFiles: loaded.otherFiles,
9620
+ validate: true,
9621
+ global: loaded.global
9622
+ });
9623
+ }
9624
+ static forDeletion({
9625
+ baseDir = process.cwd(),
9626
+ relativeDirPath,
9627
+ dirName,
9628
+ global = false
9629
+ }) {
9630
+ const settablePaths = _JunieSkill.getSettablePaths({ global });
9631
+ return new _JunieSkill({
9632
+ baseDir,
9633
+ relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
9634
+ dirName,
9635
+ frontmatter: { name: "", description: "" },
9636
+ body: "",
9637
+ otherFiles: [],
9638
+ validate: false,
9639
+ global
9640
+ });
9641
+ }
9642
+ };
9643
+
9644
+ // src/features/skills/kilo-skill.ts
9645
+ import { join as join70 } from "path";
9646
+ import { z as z34 } from "zod/mini";
9647
+ var KiloSkillFrontmatterSchema = z34.looseObject({
9648
+ name: z34.string(),
9649
+ description: z34.string()
9650
+ });
9427
9651
  var KiloSkill = class _KiloSkill extends ToolSkill {
9428
9652
  constructor({
9429
9653
  baseDir = process.cwd(),
9430
- relativeDirPath = join69(".kilocode", "skills"),
9654
+ relativeDirPath = join70(".kilocode", "skills"),
9431
9655
  dirName,
9432
9656
  frontmatter,
9433
9657
  body,
@@ -9458,7 +9682,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
9458
9682
  global: _global = false
9459
9683
  } = {}) {
9460
9684
  return {
9461
- relativeDirPath: join69(".kilocode", "skills")
9685
+ relativeDirPath: join70(".kilocode", "skills")
9462
9686
  };
9463
9687
  }
9464
9688
  getFrontmatter() {
@@ -9545,13 +9769,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
9545
9769
  });
9546
9770
  const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
9547
9771
  if (!result.success) {
9548
- const skillDirPath = join69(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
9772
+ const skillDirPath = join70(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
9549
9773
  throw new Error(
9550
- `Invalid frontmatter in ${join69(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
9774
+ `Invalid frontmatter in ${join70(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
9551
9775
  );
9552
9776
  }
9553
9777
  if (result.data.name !== loaded.dirName) {
9554
- const skillFilePath = join69(
9778
+ const skillFilePath = join70(
9555
9779
  loaded.baseDir,
9556
9780
  loaded.relativeDirPath,
9557
9781
  loaded.dirName,
@@ -9592,16 +9816,16 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
9592
9816
  };
9593
9817
 
9594
9818
  // src/features/skills/kiro-skill.ts
9595
- import { join as join70 } from "path";
9596
- import { z as z34 } from "zod/mini";
9597
- var KiroSkillFrontmatterSchema = z34.looseObject({
9598
- name: z34.string(),
9599
- description: z34.string()
9819
+ import { join as join71 } from "path";
9820
+ import { z as z35 } from "zod/mini";
9821
+ var KiroSkillFrontmatterSchema = z35.looseObject({
9822
+ name: z35.string(),
9823
+ description: z35.string()
9600
9824
  });
9601
9825
  var KiroSkill = class _KiroSkill extends ToolSkill {
9602
9826
  constructor({
9603
9827
  baseDir = process.cwd(),
9604
- relativeDirPath = join70(".kiro", "skills"),
9828
+ relativeDirPath = join71(".kiro", "skills"),
9605
9829
  dirName,
9606
9830
  frontmatter,
9607
9831
  body,
@@ -9633,7 +9857,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
9633
9857
  throw new Error("KiroSkill does not support global mode.");
9634
9858
  }
9635
9859
  return {
9636
- relativeDirPath: join70(".kiro", "skills")
9860
+ relativeDirPath: join71(".kiro", "skills")
9637
9861
  };
9638
9862
  }
9639
9863
  getFrontmatter() {
@@ -9720,13 +9944,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
9720
9944
  });
9721
9945
  const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
9722
9946
  if (!result.success) {
9723
- const skillDirPath = join70(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
9947
+ const skillDirPath = join71(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
9724
9948
  throw new Error(
9725
- `Invalid frontmatter in ${join70(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
9949
+ `Invalid frontmatter in ${join71(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
9726
9950
  );
9727
9951
  }
9728
9952
  if (result.data.name !== loaded.dirName) {
9729
- const skillFilePath = join70(
9953
+ const skillFilePath = join71(
9730
9954
  loaded.baseDir,
9731
9955
  loaded.relativeDirPath,
9732
9956
  loaded.dirName,
@@ -9768,17 +9992,17 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
9768
9992
  };
9769
9993
 
9770
9994
  // src/features/skills/opencode-skill.ts
9771
- import { join as join71 } from "path";
9772
- import { z as z35 } from "zod/mini";
9773
- var OpenCodeSkillFrontmatterSchema = z35.looseObject({
9774
- name: z35.string(),
9775
- description: z35.string(),
9776
- "allowed-tools": z35.optional(z35.array(z35.string()))
9995
+ import { join as join72 } from "path";
9996
+ import { z as z36 } from "zod/mini";
9997
+ var OpenCodeSkillFrontmatterSchema = z36.looseObject({
9998
+ name: z36.string(),
9999
+ description: z36.string(),
10000
+ "allowed-tools": z36.optional(z36.array(z36.string()))
9777
10001
  });
9778
10002
  var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
9779
10003
  constructor({
9780
10004
  baseDir = process.cwd(),
9781
- relativeDirPath = join71(".opencode", "skill"),
10005
+ relativeDirPath = join72(".opencode", "skill"),
9782
10006
  dirName,
9783
10007
  frontmatter,
9784
10008
  body,
@@ -9807,7 +10031,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
9807
10031
  }
9808
10032
  static getSettablePaths({ global = false } = {}) {
9809
10033
  return {
9810
- relativeDirPath: global ? join71(".config", "opencode", "skill") : join71(".opencode", "skill")
10034
+ relativeDirPath: global ? join72(".config", "opencode", "skill") : join72(".opencode", "skill")
9811
10035
  };
9812
10036
  }
9813
10037
  getFrontmatter() {
@@ -9892,9 +10116,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
9892
10116
  });
9893
10117
  const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
9894
10118
  if (!result.success) {
9895
- const skillDirPath = join71(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
10119
+ const skillDirPath = join72(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
9896
10120
  throw new Error(
9897
- `Invalid frontmatter in ${join71(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
10121
+ `Invalid frontmatter in ${join72(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
9898
10122
  );
9899
10123
  }
9900
10124
  return new _OpenCodeSkill({
@@ -9928,16 +10152,16 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
9928
10152
  };
9929
10153
 
9930
10154
  // src/features/skills/replit-skill.ts
9931
- import { join as join72 } from "path";
9932
- import { z as z36 } from "zod/mini";
9933
- var ReplitSkillFrontmatterSchema = z36.looseObject({
9934
- name: z36.string(),
9935
- description: z36.string()
10155
+ import { join as join73 } from "path";
10156
+ import { z as z37 } from "zod/mini";
10157
+ var ReplitSkillFrontmatterSchema = z37.looseObject({
10158
+ name: z37.string(),
10159
+ description: z37.string()
9936
10160
  });
9937
10161
  var ReplitSkill = class _ReplitSkill extends ToolSkill {
9938
10162
  constructor({
9939
10163
  baseDir = process.cwd(),
9940
- relativeDirPath = join72(".agents", "skills"),
10164
+ relativeDirPath = join73(".agents", "skills"),
9941
10165
  dirName,
9942
10166
  frontmatter,
9943
10167
  body,
@@ -9969,7 +10193,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
9969
10193
  throw new Error("ReplitSkill does not support global mode.");
9970
10194
  }
9971
10195
  return {
9972
- relativeDirPath: join72(".agents", "skills")
10196
+ relativeDirPath: join73(".agents", "skills")
9973
10197
  };
9974
10198
  }
9975
10199
  getFrontmatter() {
@@ -10048,9 +10272,9 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
10048
10272
  });
10049
10273
  const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
10050
10274
  if (!result.success) {
10051
- const skillDirPath = join72(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
10275
+ const skillDirPath = join73(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
10052
10276
  throw new Error(
10053
- `Invalid frontmatter in ${join72(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
10277
+ `Invalid frontmatter in ${join73(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
10054
10278
  );
10055
10279
  }
10056
10280
  return new _ReplitSkill({
@@ -10085,16 +10309,16 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
10085
10309
  };
10086
10310
 
10087
10311
  // src/features/skills/roo-skill.ts
10088
- import { join as join73 } from "path";
10089
- import { z as z37 } from "zod/mini";
10090
- var RooSkillFrontmatterSchema = z37.looseObject({
10091
- name: z37.string(),
10092
- description: z37.string()
10312
+ import { join as join74 } from "path";
10313
+ import { z as z38 } from "zod/mini";
10314
+ var RooSkillFrontmatterSchema = z38.looseObject({
10315
+ name: z38.string(),
10316
+ description: z38.string()
10093
10317
  });
10094
10318
  var RooSkill = class _RooSkill extends ToolSkill {
10095
10319
  constructor({
10096
10320
  baseDir = process.cwd(),
10097
- relativeDirPath = join73(".roo", "skills"),
10321
+ relativeDirPath = join74(".roo", "skills"),
10098
10322
  dirName,
10099
10323
  frontmatter,
10100
10324
  body,
@@ -10125,7 +10349,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
10125
10349
  global: _global = false
10126
10350
  } = {}) {
10127
10351
  return {
10128
- relativeDirPath: join73(".roo", "skills")
10352
+ relativeDirPath: join74(".roo", "skills")
10129
10353
  };
10130
10354
  }
10131
10355
  getFrontmatter() {
@@ -10212,13 +10436,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
10212
10436
  });
10213
10437
  const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
10214
10438
  if (!result.success) {
10215
- const skillDirPath = join73(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
10439
+ const skillDirPath = join74(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
10216
10440
  throw new Error(
10217
- `Invalid frontmatter in ${join73(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
10441
+ `Invalid frontmatter in ${join74(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
10218
10442
  );
10219
10443
  }
10220
10444
  if (result.data.name !== loaded.dirName) {
10221
- const skillFilePath = join73(
10445
+ const skillFilePath = join74(
10222
10446
  loaded.baseDir,
10223
10447
  loaded.relativeDirPath,
10224
10448
  loaded.dirName,
@@ -10259,14 +10483,14 @@ var RooSkill = class _RooSkill extends ToolSkill {
10259
10483
  };
10260
10484
 
10261
10485
  // src/features/skills/skills-utils.ts
10262
- import { basename as basename4, join as join74 } from "path";
10486
+ import { basename as basename4, join as join75 } from "path";
10263
10487
  async function getLocalSkillDirNames(baseDir) {
10264
- const skillsDir = join74(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
10488
+ const skillsDir = join75(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
10265
10489
  const names = /* @__PURE__ */ new Set();
10266
10490
  if (!await directoryExists(skillsDir)) {
10267
10491
  return names;
10268
10492
  }
10269
- const dirPaths = await findFilesByGlobs(join74(skillsDir, "*"), { type: "dir" });
10493
+ const dirPaths = await findFilesByGlobs(join75(skillsDir, "*"), { type: "dir" });
10270
10494
  for (const dirPath of dirPaths) {
10271
10495
  const name = basename4(dirPath);
10272
10496
  if (name === basename4(RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH)) continue;
@@ -10288,13 +10512,14 @@ var skillsProcessorToolTargetTuple = [
10288
10512
  "cursor",
10289
10513
  "factorydroid",
10290
10514
  "geminicli",
10515
+ "junie",
10291
10516
  "kilo",
10292
10517
  "kiro",
10293
10518
  "opencode",
10294
10519
  "replit",
10295
10520
  "roo"
10296
10521
  ];
10297
- var SkillsProcessorToolTargetSchema = z38.enum(skillsProcessorToolTargetTuple);
10522
+ var SkillsProcessorToolTargetSchema = z39.enum(skillsProcessorToolTargetTuple);
10298
10523
  var toolSkillFactories = /* @__PURE__ */ new Map([
10299
10524
  [
10300
10525
  "agentsmd",
@@ -10373,6 +10598,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
10373
10598
  meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
10374
10599
  }
10375
10600
  ],
10601
+ [
10602
+ "junie",
10603
+ {
10604
+ class: JunieSkill,
10605
+ meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: false }
10606
+ }
10607
+ ],
10376
10608
  [
10377
10609
  "kilo",
10378
10610
  {
@@ -10495,10 +10727,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
10495
10727
  )
10496
10728
  );
10497
10729
  const localSkillNames = new Set(localDirNames);
10498
- const curatedDirPath = join75(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
10730
+ const curatedDirPath = join76(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
10499
10731
  let curatedSkills = [];
10500
10732
  if (await directoryExists(curatedDirPath)) {
10501
- const curatedDirPaths = await findFilesByGlobs(join75(curatedDirPath, "*"), { type: "dir" });
10733
+ const curatedDirPaths = await findFilesByGlobs(join76(curatedDirPath, "*"), { type: "dir" });
10502
10734
  const curatedDirNames = curatedDirPaths.map((path3) => basename5(path3));
10503
10735
  const nonConflicting = curatedDirNames.filter((name) => {
10504
10736
  if (localSkillNames.has(name)) {
@@ -10532,8 +10764,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
10532
10764
  async loadToolDirs() {
10533
10765
  const factory = this.getFactory(this.toolTarget);
10534
10766
  const paths = factory.class.getSettablePaths({ global: this.global });
10535
- const skillsDirPath = join75(this.baseDir, paths.relativeDirPath);
10536
- const dirPaths = await findFilesByGlobs(join75(skillsDirPath, "*"), { type: "dir" });
10767
+ const skillsDirPath = join76(this.baseDir, paths.relativeDirPath);
10768
+ const dirPaths = await findFilesByGlobs(join76(skillsDirPath, "*"), { type: "dir" });
10537
10769
  const dirNames = dirPaths.map((path3) => basename5(path3));
10538
10770
  const toolSkills = await Promise.all(
10539
10771
  dirNames.map(
@@ -10550,8 +10782,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
10550
10782
  async loadToolDirsToDelete() {
10551
10783
  const factory = this.getFactory(this.toolTarget);
10552
10784
  const paths = factory.class.getSettablePaths({ global: this.global });
10553
- const skillsDirPath = join75(this.baseDir, paths.relativeDirPath);
10554
- const dirPaths = await findFilesByGlobs(join75(skillsDirPath, "*"), { type: "dir" });
10785
+ const skillsDirPath = join76(this.baseDir, paths.relativeDirPath);
10786
+ const dirPaths = await findFilesByGlobs(join76(skillsDirPath, "*"), { type: "dir" });
10555
10787
  const dirNames = dirPaths.map((path3) => basename5(path3));
10556
10788
  const toolSkills = dirNames.map(
10557
10789
  (dirName) => factory.class.forDeletion({
@@ -10613,11 +10845,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
10613
10845
  };
10614
10846
 
10615
10847
  // src/features/subagents/agentsmd-subagent.ts
10616
- import { join as join77 } from "path";
10848
+ import { join as join78 } from "path";
10617
10849
 
10618
10850
  // src/features/subagents/simulated-subagent.ts
10619
- import { basename as basename6, join as join76 } from "path";
10620
- import { z as z39 } from "zod/mini";
10851
+ import { basename as basename6, join as join77 } from "path";
10852
+ import { z as z40 } from "zod/mini";
10621
10853
 
10622
10854
  // src/features/subagents/tool-subagent.ts
10623
10855
  var ToolSubagent = class extends ToolFile {
@@ -10669,9 +10901,9 @@ var ToolSubagent = class extends ToolFile {
10669
10901
  };
10670
10902
 
10671
10903
  // src/features/subagents/simulated-subagent.ts
10672
- var SimulatedSubagentFrontmatterSchema = z39.object({
10673
- name: z39.string(),
10674
- description: z39.optional(z39.string())
10904
+ var SimulatedSubagentFrontmatterSchema = z40.object({
10905
+ name: z40.string(),
10906
+ description: z40.optional(z40.string())
10675
10907
  });
10676
10908
  var SimulatedSubagent = class extends ToolSubagent {
10677
10909
  frontmatter;
@@ -10681,7 +10913,7 @@ var SimulatedSubagent = class extends ToolSubagent {
10681
10913
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
10682
10914
  if (!result.success) {
10683
10915
  throw new Error(
10684
- `Invalid frontmatter in ${join76(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
10916
+ `Invalid frontmatter in ${join77(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
10685
10917
  );
10686
10918
  }
10687
10919
  }
@@ -10732,7 +10964,7 @@ var SimulatedSubagent = class extends ToolSubagent {
10732
10964
  return {
10733
10965
  success: false,
10734
10966
  error: new Error(
10735
- `Invalid frontmatter in ${join76(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
10967
+ `Invalid frontmatter in ${join77(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
10736
10968
  )
10737
10969
  };
10738
10970
  }
@@ -10742,7 +10974,7 @@ var SimulatedSubagent = class extends ToolSubagent {
10742
10974
  relativeFilePath,
10743
10975
  validate = true
10744
10976
  }) {
10745
- const filePath = join76(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
10977
+ const filePath = join77(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
10746
10978
  const fileContent = await readFileContent(filePath);
10747
10979
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
10748
10980
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -10778,7 +11010,7 @@ var SimulatedSubagent = class extends ToolSubagent {
10778
11010
  var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
10779
11011
  static getSettablePaths() {
10780
11012
  return {
10781
- relativeDirPath: join77(".agents", "subagents")
11013
+ relativeDirPath: join78(".agents", "subagents")
10782
11014
  };
10783
11015
  }
10784
11016
  static async fromFile(params) {
@@ -10801,11 +11033,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
10801
11033
  };
10802
11034
 
10803
11035
  // src/features/subagents/factorydroid-subagent.ts
10804
- import { join as join78 } from "path";
11036
+ import { join as join79 } from "path";
10805
11037
  var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
10806
11038
  static getSettablePaths(_options) {
10807
11039
  return {
10808
- relativeDirPath: join78(".factory", "droids")
11040
+ relativeDirPath: join79(".factory", "droids")
10809
11041
  };
10810
11042
  }
10811
11043
  static async fromFile(params) {
@@ -10828,11 +11060,11 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
10828
11060
  };
10829
11061
 
10830
11062
  // src/features/subagents/geminicli-subagent.ts
10831
- import { join as join79 } from "path";
11063
+ import { join as join80 } from "path";
10832
11064
  var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
10833
11065
  static getSettablePaths() {
10834
11066
  return {
10835
- relativeDirPath: join79(".gemini", "subagents")
11067
+ relativeDirPath: join80(".gemini", "subagents")
10836
11068
  };
10837
11069
  }
10838
11070
  static async fromFile(params) {
@@ -10855,11 +11087,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
10855
11087
  };
10856
11088
 
10857
11089
  // src/features/subagents/roo-subagent.ts
10858
- import { join as join80 } from "path";
11090
+ import { join as join81 } from "path";
10859
11091
  var RooSubagent = class _RooSubagent extends SimulatedSubagent {
10860
11092
  static getSettablePaths() {
10861
11093
  return {
10862
- relativeDirPath: join80(".roo", "subagents")
11094
+ relativeDirPath: join81(".roo", "subagents")
10863
11095
  };
10864
11096
  }
10865
11097
  static async fromFile(params) {
@@ -10882,20 +11114,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
10882
11114
  };
10883
11115
 
10884
11116
  // src/features/subagents/subagents-processor.ts
10885
- import { basename as basename9, join as join88 } from "path";
10886
- import { z as z47 } from "zod/mini";
11117
+ import { basename as basename9, join as join90 } from "path";
11118
+ import { z as z49 } from "zod/mini";
10887
11119
 
10888
11120
  // src/features/subagents/claudecode-subagent.ts
10889
- import { join as join82 } from "path";
10890
- import { z as z41 } from "zod/mini";
11121
+ import { join as join83 } from "path";
11122
+ import { z as z42 } from "zod/mini";
10891
11123
 
10892
11124
  // src/features/subagents/rulesync-subagent.ts
10893
- import { basename as basename7, join as join81 } from "path";
10894
- import { z as z40 } from "zod/mini";
10895
- var RulesyncSubagentFrontmatterSchema = z40.looseObject({
10896
- targets: z40._default(RulesyncTargetsSchema, ["*"]),
10897
- name: z40.string(),
10898
- description: z40.optional(z40.string())
11125
+ import { basename as basename7, join as join82 } from "path";
11126
+ import { z as z41 } from "zod/mini";
11127
+ var RulesyncSubagentFrontmatterSchema = z41.looseObject({
11128
+ targets: z41._default(RulesyncTargetsSchema, ["*"]),
11129
+ name: z41.string(),
11130
+ description: z41.optional(z41.string())
10899
11131
  });
10900
11132
  var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
10901
11133
  frontmatter;
@@ -10904,7 +11136,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
10904
11136
  const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
10905
11137
  if (!parseResult.success && rest.validate !== false) {
10906
11138
  throw new Error(
10907
- `Invalid frontmatter in ${join81(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
11139
+ `Invalid frontmatter in ${join82(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
10908
11140
  );
10909
11141
  }
10910
11142
  const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
@@ -10937,7 +11169,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
10937
11169
  return {
10938
11170
  success: false,
10939
11171
  error: new Error(
10940
- `Invalid frontmatter in ${join81(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
11172
+ `Invalid frontmatter in ${join82(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
10941
11173
  )
10942
11174
  };
10943
11175
  }
@@ -10945,7 +11177,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
10945
11177
  static async fromFile({
10946
11178
  relativeFilePath
10947
11179
  }) {
10948
- const filePath = join81(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
11180
+ const filePath = join82(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
10949
11181
  const fileContent = await readFileContent(filePath);
10950
11182
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
10951
11183
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -10964,14 +11196,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
10964
11196
  };
10965
11197
 
10966
11198
  // src/features/subagents/claudecode-subagent.ts
10967
- var ClaudecodeSubagentFrontmatterSchema = z41.looseObject({
10968
- name: z41.string(),
10969
- description: z41.optional(z41.string()),
10970
- model: z41.optional(z41.string()),
10971
- tools: z41.optional(z41.union([z41.string(), z41.array(z41.string())])),
10972
- permissionMode: z41.optional(z41.string()),
10973
- skills: z41.optional(z41.union([z41.string(), z41.array(z41.string())]))
10974
- });
11199
+ var ClaudecodeSubagentFrontmatterSchema = z42.looseObject({
11200
+ name: z42.string(),
11201
+ description: z42.optional(z42.string()),
11202
+ model: z42.optional(z42.string()),
11203
+ tools: z42.optional(z42.union([z42.string(), z42.array(z42.string())])),
11204
+ permissionMode: z42.optional(z42.string()),
11205
+ skills: z42.optional(z42.union([z42.string(), z42.array(z42.string())]))
11206
+ });
10975
11207
  var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
10976
11208
  frontmatter;
10977
11209
  body;
@@ -10980,7 +11212,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
10980
11212
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
10981
11213
  if (!result.success) {
10982
11214
  throw new Error(
10983
- `Invalid frontmatter in ${join82(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
11215
+ `Invalid frontmatter in ${join83(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
10984
11216
  );
10985
11217
  }
10986
11218
  }
@@ -10992,7 +11224,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
10992
11224
  }
10993
11225
  static getSettablePaths(_options = {}) {
10994
11226
  return {
10995
- relativeDirPath: join82(".claude", "agents")
11227
+ relativeDirPath: join83(".claude", "agents")
10996
11228
  };
10997
11229
  }
10998
11230
  getFrontmatter() {
@@ -11031,7 +11263,10 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
11031
11263
  global = false
11032
11264
  }) {
11033
11265
  const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
11034
- const claudecodeSection = rulesyncFrontmatter.claudecode ?? {};
11266
+ const claudecodeSection = this.filterToolSpecificSection(rulesyncFrontmatter.claudecode ?? {}, [
11267
+ "name",
11268
+ "description"
11269
+ ]);
11035
11270
  const rawClaudecodeFrontmatter = {
11036
11271
  name: rulesyncFrontmatter.name,
11037
11272
  description: rulesyncFrontmatter.description,
@@ -11068,7 +11303,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
11068
11303
  return {
11069
11304
  success: false,
11070
11305
  error: new Error(
11071
- `Invalid frontmatter in ${join82(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
11306
+ `Invalid frontmatter in ${join83(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
11072
11307
  )
11073
11308
  };
11074
11309
  }
@@ -11086,7 +11321,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
11086
11321
  global = false
11087
11322
  }) {
11088
11323
  const paths = this.getSettablePaths({ global });
11089
- const filePath = join82(baseDir, paths.relativeDirPath, relativeFilePath);
11324
+ const filePath = join83(baseDir, paths.relativeDirPath, relativeFilePath);
11090
11325
  const fileContent = await readFileContent(filePath);
11091
11326
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
11092
11327
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -11121,16 +11356,16 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
11121
11356
  };
11122
11357
 
11123
11358
  // src/features/subagents/codexcli-subagent.ts
11124
- import { join as join83 } from "path";
11359
+ import { join as join84 } from "path";
11125
11360
  import * as smolToml2 from "smol-toml";
11126
- import { z as z42 } from "zod/mini";
11127
- var CodexCliSubagentTomlSchema = z42.looseObject({
11128
- name: z42.string(),
11129
- description: z42.optional(z42.string()),
11130
- developer_instructions: z42.optional(z42.string()),
11131
- model: z42.optional(z42.string()),
11132
- model_reasoning_effort: z42.optional(z42.string()),
11133
- sandbox_mode: z42.optional(z42.string())
11361
+ import { z as z43 } from "zod/mini";
11362
+ var CodexCliSubagentTomlSchema = z43.looseObject({
11363
+ name: z43.string(),
11364
+ description: z43.optional(z43.string()),
11365
+ developer_instructions: z43.optional(z43.string()),
11366
+ model: z43.optional(z43.string()),
11367
+ model_reasoning_effort: z43.optional(z43.string()),
11368
+ sandbox_mode: z43.optional(z43.string())
11134
11369
  });
11135
11370
  var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
11136
11371
  body;
@@ -11141,7 +11376,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
11141
11376
  CodexCliSubagentTomlSchema.parse(parsed);
11142
11377
  } catch (error) {
11143
11378
  throw new Error(
11144
- `Invalid TOML in ${join83(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
11379
+ `Invalid TOML in ${join84(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
11145
11380
  { cause: error }
11146
11381
  );
11147
11382
  }
@@ -11153,7 +11388,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
11153
11388
  }
11154
11389
  static getSettablePaths(_options = {}) {
11155
11390
  return {
11156
- relativeDirPath: join83(".codex", "agents")
11391
+ relativeDirPath: join84(".codex", "agents")
11157
11392
  };
11158
11393
  }
11159
11394
  getBody() {
@@ -11165,7 +11400,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
11165
11400
  parsed = CodexCliSubagentTomlSchema.parse(smolToml2.parse(this.body));
11166
11401
  } catch (error) {
11167
11402
  throw new Error(
11168
- `Failed to parse TOML in ${join83(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
11403
+ `Failed to parse TOML in ${join84(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
11169
11404
  { cause: error }
11170
11405
  );
11171
11406
  }
@@ -11246,7 +11481,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
11246
11481
  global = false
11247
11482
  }) {
11248
11483
  const paths = this.getSettablePaths({ global });
11249
- const filePath = join83(baseDir, paths.relativeDirPath, relativeFilePath);
11484
+ const filePath = join84(baseDir, paths.relativeDirPath, relativeFilePath);
11250
11485
  const fileContent = await readFileContent(filePath);
11251
11486
  const subagent = new _CodexCliSubagent({
11252
11487
  baseDir,
@@ -11284,13 +11519,13 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
11284
11519
  };
11285
11520
 
11286
11521
  // src/features/subagents/copilot-subagent.ts
11287
- import { join as join84 } from "path";
11288
- import { z as z43 } from "zod/mini";
11522
+ import { join as join85 } from "path";
11523
+ import { z as z44 } from "zod/mini";
11289
11524
  var REQUIRED_TOOL = "agent/runSubagent";
11290
- var CopilotSubagentFrontmatterSchema = z43.looseObject({
11291
- name: z43.string(),
11292
- description: z43.optional(z43.string()),
11293
- tools: z43.optional(z43.union([z43.string(), z43.array(z43.string())]))
11525
+ var CopilotSubagentFrontmatterSchema = z44.looseObject({
11526
+ name: z44.string(),
11527
+ description: z44.optional(z44.string()),
11528
+ tools: z44.optional(z44.union([z44.string(), z44.array(z44.string())]))
11294
11529
  });
11295
11530
  var normalizeTools = (tools) => {
11296
11531
  if (!tools) {
@@ -11310,7 +11545,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
11310
11545
  const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
11311
11546
  if (!result.success) {
11312
11547
  throw new Error(
11313
- `Invalid frontmatter in ${join84(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
11548
+ `Invalid frontmatter in ${join85(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
11314
11549
  );
11315
11550
  }
11316
11551
  }
@@ -11322,7 +11557,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
11322
11557
  }
11323
11558
  static getSettablePaths(_options = {}) {
11324
11559
  return {
11325
- relativeDirPath: join84(".github", "agents")
11560
+ relativeDirPath: join85(".github", "agents")
11326
11561
  };
11327
11562
  }
11328
11563
  getFrontmatter() {
@@ -11396,7 +11631,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
11396
11631
  return {
11397
11632
  success: false,
11398
11633
  error: new Error(
11399
- `Invalid frontmatter in ${join84(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
11634
+ `Invalid frontmatter in ${join85(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
11400
11635
  )
11401
11636
  };
11402
11637
  }
@@ -11414,7 +11649,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
11414
11649
  global = false
11415
11650
  }) {
11416
11651
  const paths = this.getSettablePaths({ global });
11417
- const filePath = join84(baseDir, paths.relativeDirPath, relativeFilePath);
11652
+ const filePath = join85(baseDir, paths.relativeDirPath, relativeFilePath);
11418
11653
  const fileContent = await readFileContent(filePath);
11419
11654
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
11420
11655
  const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -11450,11 +11685,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
11450
11685
  };
11451
11686
 
11452
11687
  // src/features/subagents/cursor-subagent.ts
11453
- import { join as join85 } from "path";
11454
- import { z as z44 } from "zod/mini";
11455
- var CursorSubagentFrontmatterSchema = z44.looseObject({
11456
- name: z44.string(),
11457
- description: z44.optional(z44.string())
11688
+ import { join as join86 } from "path";
11689
+ import { z as z45 } from "zod/mini";
11690
+ var CursorSubagentFrontmatterSchema = z45.looseObject({
11691
+ name: z45.string(),
11692
+ description: z45.optional(z45.string())
11458
11693
  });
11459
11694
  var CursorSubagent = class _CursorSubagent extends ToolSubagent {
11460
11695
  frontmatter;
@@ -11464,7 +11699,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
11464
11699
  const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
11465
11700
  if (!result.success) {
11466
11701
  throw new Error(
11467
- `Invalid frontmatter in ${join85(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
11702
+ `Invalid frontmatter in ${join86(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
11468
11703
  );
11469
11704
  }
11470
11705
  }
@@ -11476,7 +11711,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
11476
11711
  }
11477
11712
  static getSettablePaths(_options = {}) {
11478
11713
  return {
11479
- relativeDirPath: join85(".cursor", "agents")
11714
+ relativeDirPath: join86(".cursor", "agents")
11480
11715
  };
11481
11716
  }
11482
11717
  getFrontmatter() {
@@ -11543,7 +11778,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
11543
11778
  return {
11544
11779
  success: false,
11545
11780
  error: new Error(
11546
- `Invalid frontmatter in ${join85(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
11781
+ `Invalid frontmatter in ${join86(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
11547
11782
  )
11548
11783
  };
11549
11784
  }
@@ -11561,7 +11796,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
11561
11796
  global = false
11562
11797
  }) {
11563
11798
  const paths = this.getSettablePaths({ global });
11564
- const filePath = join85(baseDir, paths.relativeDirPath, relativeFilePath);
11799
+ const filePath = join86(baseDir, paths.relativeDirPath, relativeFilePath);
11565
11800
  const fileContent = await readFileContent(filePath);
11566
11801
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
11567
11802
  const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -11596,24 +11831,182 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
11596
11831
  }
11597
11832
  };
11598
11833
 
11834
+ // src/features/subagents/junie-subagent.ts
11835
+ import { join as join87 } from "path";
11836
+ import { z as z46 } from "zod/mini";
11837
+ var JunieSubagentFrontmatterSchema = z46.looseObject({
11838
+ name: z46.optional(z46.string()),
11839
+ description: z46.string()
11840
+ });
11841
+ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
11842
+ frontmatter;
11843
+ body;
11844
+ constructor({ frontmatter, body, ...rest }) {
11845
+ if (rest.validate !== false) {
11846
+ const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
11847
+ if (!result.success) {
11848
+ throw new Error(
11849
+ `Invalid frontmatter in ${join87(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
11850
+ );
11851
+ }
11852
+ }
11853
+ super({
11854
+ ...rest
11855
+ });
11856
+ this.frontmatter = frontmatter;
11857
+ this.body = body;
11858
+ }
11859
+ static getSettablePaths(options = {}) {
11860
+ if (options?.global) {
11861
+ throw new Error("JunieSubagent does not support global mode.");
11862
+ }
11863
+ return {
11864
+ relativeDirPath: join87(".junie", "agents")
11865
+ };
11866
+ }
11867
+ getFrontmatter() {
11868
+ return this.frontmatter;
11869
+ }
11870
+ getBody() {
11871
+ return this.body;
11872
+ }
11873
+ toRulesyncSubagent() {
11874
+ const { name, description, ...restFields } = this.frontmatter;
11875
+ const junieSection = {
11876
+ ...restFields
11877
+ };
11878
+ const rulesyncFrontmatter = {
11879
+ targets: ["*"],
11880
+ name: name ?? this.getRelativeFilePath().replace(/\.md$/, ""),
11881
+ description,
11882
+ ...Object.keys(junieSection).length > 0 && { junie: junieSection }
11883
+ };
11884
+ return new RulesyncSubagent({
11885
+ baseDir: ".",
11886
+ frontmatter: rulesyncFrontmatter,
11887
+ body: this.body,
11888
+ relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
11889
+ relativeFilePath: this.getRelativeFilePath(),
11890
+ validate: true
11891
+ });
11892
+ }
11893
+ static fromRulesyncSubagent({
11894
+ baseDir = process.cwd(),
11895
+ rulesyncSubagent,
11896
+ validate = true,
11897
+ global = false
11898
+ }) {
11899
+ const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
11900
+ const junieSection = this.filterToolSpecificSection(rulesyncFrontmatter.junie ?? {}, [
11901
+ "name",
11902
+ "description"
11903
+ ]);
11904
+ const rawJunieFrontmatter = {
11905
+ name: rulesyncFrontmatter.name,
11906
+ description: rulesyncFrontmatter.description,
11907
+ ...junieSection
11908
+ };
11909
+ const result = JunieSubagentFrontmatterSchema.safeParse(rawJunieFrontmatter);
11910
+ if (!result.success) {
11911
+ throw new Error(
11912
+ `Invalid junie subagent frontmatter in ${rulesyncSubagent.getRelativeFilePath()}: ${formatError(result.error)}`
11913
+ );
11914
+ }
11915
+ const junieFrontmatter = result.data;
11916
+ const body = rulesyncSubagent.getBody();
11917
+ const fileContent = stringifyFrontmatter(body, junieFrontmatter);
11918
+ const paths = this.getSettablePaths({ global });
11919
+ return new _JunieSubagent({
11920
+ baseDir,
11921
+ frontmatter: junieFrontmatter,
11922
+ body,
11923
+ relativeDirPath: paths.relativeDirPath,
11924
+ relativeFilePath: rulesyncSubagent.getRelativeFilePath(),
11925
+ fileContent,
11926
+ validate
11927
+ });
11928
+ }
11929
+ validate() {
11930
+ if (!this.frontmatter) {
11931
+ return { success: true, error: null };
11932
+ }
11933
+ const result = JunieSubagentFrontmatterSchema.safeParse(this.frontmatter);
11934
+ if (result.success) {
11935
+ return { success: true, error: null };
11936
+ } else {
11937
+ return {
11938
+ success: false,
11939
+ error: new Error(
11940
+ `Invalid frontmatter in ${join87(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
11941
+ )
11942
+ };
11943
+ }
11944
+ }
11945
+ static isTargetedByRulesyncSubagent(rulesyncSubagent) {
11946
+ return this.isTargetedByRulesyncSubagentDefault({
11947
+ rulesyncSubagent,
11948
+ toolTarget: "junie"
11949
+ });
11950
+ }
11951
+ static async fromFile({
11952
+ baseDir = process.cwd(),
11953
+ relativeFilePath,
11954
+ validate = true,
11955
+ global = false
11956
+ }) {
11957
+ const paths = this.getSettablePaths({ global });
11958
+ const filePath = join87(baseDir, paths.relativeDirPath, relativeFilePath);
11959
+ const fileContent = await readFileContent(filePath);
11960
+ const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
11961
+ const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
11962
+ if (!result.success) {
11963
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
11964
+ }
11965
+ return new _JunieSubagent({
11966
+ baseDir,
11967
+ relativeDirPath: paths.relativeDirPath,
11968
+ relativeFilePath,
11969
+ frontmatter: result.data,
11970
+ body: content.trim(),
11971
+ fileContent,
11972
+ validate
11973
+ });
11974
+ }
11975
+ static forDeletion({
11976
+ baseDir = process.cwd(),
11977
+ relativeDirPath,
11978
+ relativeFilePath
11979
+ }) {
11980
+ return new _JunieSubagent({
11981
+ baseDir,
11982
+ relativeDirPath,
11983
+ relativeFilePath,
11984
+ frontmatter: { name: "", description: "" },
11985
+ body: "",
11986
+ fileContent: "",
11987
+ validate: false
11988
+ });
11989
+ }
11990
+ };
11991
+
11599
11992
  // src/features/subagents/kiro-subagent.ts
11600
- import { join as join86 } from "path";
11601
- import { z as z45 } from "zod/mini";
11602
- var KiroCliSubagentJsonSchema = z45.looseObject({
11603
- name: z45.string(),
11604
- description: z45.optional(z45.nullable(z45.string())),
11605
- prompt: z45.optional(z45.nullable(z45.string())),
11606
- tools: z45.optional(z45.nullable(z45.array(z45.string()))),
11607
- toolAliases: z45.optional(z45.nullable(z45.record(z45.string(), z45.string()))),
11608
- toolSettings: z45.optional(z45.nullable(z45.unknown())),
11609
- toolSchema: z45.optional(z45.nullable(z45.unknown())),
11610
- hooks: z45.optional(z45.nullable(z45.record(z45.string(), z45.array(z45.unknown())))),
11611
- model: z45.optional(z45.nullable(z45.string())),
11612
- mcpServers: z45.optional(z45.nullable(z45.record(z45.string(), z45.unknown()))),
11613
- useLegacyMcpJson: z45.optional(z45.nullable(z45.boolean())),
11614
- resources: z45.optional(z45.nullable(z45.array(z45.string()))),
11615
- allowedTools: z45.optional(z45.nullable(z45.array(z45.string()))),
11616
- includeMcpJson: z45.optional(z45.nullable(z45.boolean()))
11993
+ import { join as join88 } from "path";
11994
+ import { z as z47 } from "zod/mini";
11995
+ var KiroCliSubagentJsonSchema = z47.looseObject({
11996
+ name: z47.string(),
11997
+ description: z47.optional(z47.nullable(z47.string())),
11998
+ prompt: z47.optional(z47.nullable(z47.string())),
11999
+ tools: z47.optional(z47.nullable(z47.array(z47.string()))),
12000
+ toolAliases: z47.optional(z47.nullable(z47.record(z47.string(), z47.string()))),
12001
+ toolSettings: z47.optional(z47.nullable(z47.unknown())),
12002
+ toolSchema: z47.optional(z47.nullable(z47.unknown())),
12003
+ hooks: z47.optional(z47.nullable(z47.record(z47.string(), z47.array(z47.unknown())))),
12004
+ model: z47.optional(z47.nullable(z47.string())),
12005
+ mcpServers: z47.optional(z47.nullable(z47.record(z47.string(), z47.unknown()))),
12006
+ useLegacyMcpJson: z47.optional(z47.nullable(z47.boolean())),
12007
+ resources: z47.optional(z47.nullable(z47.array(z47.string()))),
12008
+ allowedTools: z47.optional(z47.nullable(z47.array(z47.string()))),
12009
+ includeMcpJson: z47.optional(z47.nullable(z47.boolean()))
11617
12010
  });
11618
12011
  var KiroSubagent = class _KiroSubagent extends ToolSubagent {
11619
12012
  body;
@@ -11624,7 +12017,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
11624
12017
  KiroCliSubagentJsonSchema.parse(parsed);
11625
12018
  } catch (error) {
11626
12019
  throw new Error(
11627
- `Invalid JSON in ${join86(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
12020
+ `Invalid JSON in ${join88(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
11628
12021
  { cause: error }
11629
12022
  );
11630
12023
  }
@@ -11636,7 +12029,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
11636
12029
  }
11637
12030
  static getSettablePaths(_options = {}) {
11638
12031
  return {
11639
- relativeDirPath: join86(".kiro", "agents")
12032
+ relativeDirPath: join88(".kiro", "agents")
11640
12033
  };
11641
12034
  }
11642
12035
  getBody() {
@@ -11648,7 +12041,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
11648
12041
  parsed = JSON.parse(this.body);
11649
12042
  } catch (error) {
11650
12043
  throw new Error(
11651
- `Failed to parse JSON in ${join86(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
12044
+ `Failed to parse JSON in ${join88(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
11652
12045
  { cause: error }
11653
12046
  );
11654
12047
  }
@@ -11729,7 +12122,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
11729
12122
  global = false
11730
12123
  }) {
11731
12124
  const paths = this.getSettablePaths({ global });
11732
- const filePath = join86(baseDir, paths.relativeDirPath, relativeFilePath);
12125
+ const filePath = join88(baseDir, paths.relativeDirPath, relativeFilePath);
11733
12126
  const fileContent = await readFileContent(filePath);
11734
12127
  const subagent = new _KiroSubagent({
11735
12128
  baseDir,
@@ -11767,12 +12160,12 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
11767
12160
  };
11768
12161
 
11769
12162
  // src/features/subagents/opencode-subagent.ts
11770
- import { basename as basename8, join as join87 } from "path";
11771
- import { z as z46 } from "zod/mini";
11772
- var OpenCodeSubagentFrontmatterSchema = z46.looseObject({
11773
- description: z46.optional(z46.string()),
11774
- mode: z46._default(z46.string(), "subagent"),
11775
- name: z46.optional(z46.string())
12163
+ import { basename as basename8, join as join89 } from "path";
12164
+ import { z as z48 } from "zod/mini";
12165
+ var OpenCodeSubagentFrontmatterSchema = z48.looseObject({
12166
+ description: z48.optional(z48.string()),
12167
+ mode: z48._default(z48.string(), "subagent"),
12168
+ name: z48.optional(z48.string())
11776
12169
  });
11777
12170
  var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
11778
12171
  frontmatter;
@@ -11782,7 +12175,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
11782
12175
  const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
11783
12176
  if (!result.success) {
11784
12177
  throw new Error(
11785
- `Invalid frontmatter in ${join87(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
12178
+ `Invalid frontmatter in ${join89(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
11786
12179
  );
11787
12180
  }
11788
12181
  }
@@ -11796,7 +12189,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
11796
12189
  global = false
11797
12190
  } = {}) {
11798
12191
  return {
11799
- relativeDirPath: global ? join87(".config", "opencode", "agent") : join87(".opencode", "agent")
12192
+ relativeDirPath: global ? join89(".config", "opencode", "agent") : join89(".opencode", "agent")
11800
12193
  };
11801
12194
  }
11802
12195
  getFrontmatter() {
@@ -11862,7 +12255,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
11862
12255
  return {
11863
12256
  success: false,
11864
12257
  error: new Error(
11865
- `Invalid frontmatter in ${join87(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
12258
+ `Invalid frontmatter in ${join89(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
11866
12259
  )
11867
12260
  };
11868
12261
  }
@@ -11879,7 +12272,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
11879
12272
  global = false
11880
12273
  }) {
11881
12274
  const paths = this.getSettablePaths({ global });
11882
- const filePath = join87(baseDir, paths.relativeDirPath, relativeFilePath);
12275
+ const filePath = join89(baseDir, paths.relativeDirPath, relativeFilePath);
11883
12276
  const fileContent = await readFileContent(filePath);
11884
12277
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
11885
12278
  const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -11924,11 +12317,12 @@ var subagentsProcessorToolTargetTuple = [
11924
12317
  "cursor",
11925
12318
  "factorydroid",
11926
12319
  "geminicli",
12320
+ "junie",
11927
12321
  "kiro",
11928
12322
  "opencode",
11929
12323
  "roo"
11930
12324
  ];
11931
- var SubagentsProcessorToolTargetSchema = z47.enum(subagentsProcessorToolTargetTuple);
12325
+ var SubagentsProcessorToolTargetSchema = z49.enum(subagentsProcessorToolTargetTuple);
11932
12326
  var toolSubagentFactories = /* @__PURE__ */ new Map([
11933
12327
  [
11934
12328
  "agentsmd",
@@ -11986,6 +12380,13 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
11986
12380
  meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
11987
12381
  }
11988
12382
  ],
12383
+ [
12384
+ "junie",
12385
+ {
12386
+ class: JunieSubagent,
12387
+ meta: { supportsSimulated: false, supportsGlobal: false, filePattern: "*.md" }
12388
+ }
12389
+ ],
11989
12390
  [
11990
12391
  "kiro",
11991
12392
  {
@@ -12090,7 +12491,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
12090
12491
  * Load and parse rulesync subagent files from .rulesync/subagents/ directory
12091
12492
  */
12092
12493
  async loadRulesyncFiles() {
12093
- const subagentsDir = join88(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
12494
+ const subagentsDir = join90(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
12094
12495
  const dirExists = await directoryExists(subagentsDir);
12095
12496
  if (!dirExists) {
12096
12497
  logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
@@ -12105,7 +12506,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
12105
12506
  logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
12106
12507
  const rulesyncSubagents = [];
12107
12508
  for (const mdFile of mdFiles) {
12108
- const filepath = join88(subagentsDir, mdFile);
12509
+ const filepath = join90(subagentsDir, mdFile);
12109
12510
  try {
12110
12511
  const rulesyncSubagent = await RulesyncSubagent.fromFile({
12111
12512
  relativeFilePath: mdFile,
@@ -12135,7 +12536,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
12135
12536
  const factory = this.getFactory(this.toolTarget);
12136
12537
  const paths = factory.class.getSettablePaths({ global: this.global });
12137
12538
  const subagentFilePaths = await findFilesByGlobs(
12138
- join88(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
12539
+ join90(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
12139
12540
  );
12140
12541
  if (forDeletion) {
12141
12542
  const toolSubagents2 = subagentFilePaths.map(
@@ -12200,49 +12601,49 @@ var SubagentsProcessor = class extends FeatureProcessor {
12200
12601
  };
12201
12602
 
12202
12603
  // src/features/rules/agentsmd-rule.ts
12203
- import { join as join91 } from "path";
12604
+ import { join as join93 } from "path";
12204
12605
 
12205
12606
  // src/features/rules/tool-rule.ts
12206
- import { join as join90 } from "path";
12607
+ import { join as join92 } from "path";
12207
12608
 
12208
12609
  // src/features/rules/rulesync-rule.ts
12209
- import { join as join89 } from "path";
12210
- import { z as z48 } from "zod/mini";
12211
- var RulesyncRuleFrontmatterSchema = z48.object({
12212
- root: z48.optional(z48.boolean()),
12213
- localRoot: z48.optional(z48.boolean()),
12214
- targets: z48._default(RulesyncTargetsSchema, ["*"]),
12215
- description: z48.optional(z48.string()),
12216
- globs: z48.optional(z48.array(z48.string())),
12217
- agentsmd: z48.optional(
12218
- z48.object({
12610
+ import { join as join91 } from "path";
12611
+ import { z as z50 } from "zod/mini";
12612
+ var RulesyncRuleFrontmatterSchema = z50.object({
12613
+ root: z50.optional(z50.boolean()),
12614
+ localRoot: z50.optional(z50.boolean()),
12615
+ targets: z50._default(RulesyncTargetsSchema, ["*"]),
12616
+ description: z50.optional(z50.string()),
12617
+ globs: z50.optional(z50.array(z50.string())),
12618
+ agentsmd: z50.optional(
12619
+ z50.object({
12219
12620
  // @example "path/to/subproject"
12220
- subprojectPath: z48.optional(z48.string())
12621
+ subprojectPath: z50.optional(z50.string())
12221
12622
  })
12222
12623
  ),
12223
- claudecode: z48.optional(
12224
- z48.object({
12624
+ claudecode: z50.optional(
12625
+ z50.object({
12225
12626
  // Glob patterns for conditional rules (takes precedence over globs)
12226
12627
  // @example ["src/**/*.ts", "tests/**/*.test.ts"]
12227
- paths: z48.optional(z48.array(z48.string()))
12628
+ paths: z50.optional(z50.array(z50.string()))
12228
12629
  })
12229
12630
  ),
12230
- cursor: z48.optional(
12231
- z48.object({
12232
- alwaysApply: z48.optional(z48.boolean()),
12233
- description: z48.optional(z48.string()),
12234
- globs: z48.optional(z48.array(z48.string()))
12631
+ cursor: z50.optional(
12632
+ z50.object({
12633
+ alwaysApply: z50.optional(z50.boolean()),
12634
+ description: z50.optional(z50.string()),
12635
+ globs: z50.optional(z50.array(z50.string()))
12235
12636
  })
12236
12637
  ),
12237
- copilot: z48.optional(
12238
- z48.object({
12239
- excludeAgent: z48.optional(z48.union([z48.literal("code-review"), z48.literal("coding-agent")]))
12638
+ copilot: z50.optional(
12639
+ z50.object({
12640
+ excludeAgent: z50.optional(z50.union([z50.literal("code-review"), z50.literal("coding-agent")]))
12240
12641
  })
12241
12642
  ),
12242
- antigravity: z48.optional(
12243
- z48.looseObject({
12244
- trigger: z48.optional(z48.string()),
12245
- globs: z48.optional(z48.array(z48.string()))
12643
+ antigravity: z50.optional(
12644
+ z50.looseObject({
12645
+ trigger: z50.optional(z50.string()),
12646
+ globs: z50.optional(z50.array(z50.string()))
12246
12647
  })
12247
12648
  )
12248
12649
  });
@@ -12253,7 +12654,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
12253
12654
  const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
12254
12655
  if (!parseResult.success && rest.validate !== false) {
12255
12656
  throw new Error(
12256
- `Invalid frontmatter in ${join89(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
12657
+ `Invalid frontmatter in ${join91(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
12257
12658
  );
12258
12659
  }
12259
12660
  const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
@@ -12288,7 +12689,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
12288
12689
  return {
12289
12690
  success: false,
12290
12691
  error: new Error(
12291
- `Invalid frontmatter in ${join89(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
12692
+ `Invalid frontmatter in ${join91(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
12292
12693
  )
12293
12694
  };
12294
12695
  }
@@ -12297,7 +12698,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
12297
12698
  relativeFilePath,
12298
12699
  validate = true
12299
12700
  }) {
12300
- const filePath = join89(
12701
+ const filePath = join91(
12301
12702
  process.cwd(),
12302
12703
  this.getSettablePaths().recommended.relativeDirPath,
12303
12704
  relativeFilePath
@@ -12399,7 +12800,7 @@ var ToolRule = class extends ToolFile {
12399
12800
  rulesyncRule,
12400
12801
  validate = true,
12401
12802
  rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
12402
- nonRootPath = { relativeDirPath: join90(".agents", "memories") }
12803
+ nonRootPath = { relativeDirPath: join92(".agents", "memories") }
12403
12804
  }) {
12404
12805
  const params = this.buildToolRuleParamsDefault({
12405
12806
  baseDir,
@@ -12410,7 +12811,7 @@ var ToolRule = class extends ToolFile {
12410
12811
  });
12411
12812
  const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
12412
12813
  if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
12413
- params.relativeDirPath = join90(rulesyncFrontmatter.agentsmd.subprojectPath);
12814
+ params.relativeDirPath = join92(rulesyncFrontmatter.agentsmd.subprojectPath);
12414
12815
  params.relativeFilePath = "AGENTS.md";
12415
12816
  }
12416
12817
  return params;
@@ -12459,7 +12860,7 @@ var ToolRule = class extends ToolFile {
12459
12860
  }
12460
12861
  };
12461
12862
  function buildToolPath(toolDir, subDir, excludeToolDir) {
12462
- return excludeToolDir ? subDir : join90(toolDir, subDir);
12863
+ return excludeToolDir ? subDir : join92(toolDir, subDir);
12463
12864
  }
12464
12865
 
12465
12866
  // src/features/rules/agentsmd-rule.ts
@@ -12488,8 +12889,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
12488
12889
  validate = true
12489
12890
  }) {
12490
12891
  const isRoot = relativeFilePath === "AGENTS.md";
12491
- const relativePath = isRoot ? "AGENTS.md" : join91(".agents", "memories", relativeFilePath);
12492
- const fileContent = await readFileContent(join91(baseDir, relativePath));
12892
+ const relativePath = isRoot ? "AGENTS.md" : join93(".agents", "memories", relativeFilePath);
12893
+ const fileContent = await readFileContent(join93(baseDir, relativePath));
12493
12894
  return new _AgentsMdRule({
12494
12895
  baseDir,
12495
12896
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -12544,21 +12945,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
12544
12945
  };
12545
12946
 
12546
12947
  // src/features/rules/antigravity-rule.ts
12547
- import { join as join92 } from "path";
12548
- import { z as z49 } from "zod/mini";
12549
- var AntigravityRuleFrontmatterSchema = z49.looseObject({
12550
- trigger: z49.optional(
12551
- z49.union([
12552
- z49.literal("always_on"),
12553
- z49.literal("glob"),
12554
- z49.literal("manual"),
12555
- z49.literal("model_decision"),
12556
- z49.string()
12948
+ import { join as join94 } from "path";
12949
+ import { z as z51 } from "zod/mini";
12950
+ var AntigravityRuleFrontmatterSchema = z51.looseObject({
12951
+ trigger: z51.optional(
12952
+ z51.union([
12953
+ z51.literal("always_on"),
12954
+ z51.literal("glob"),
12955
+ z51.literal("manual"),
12956
+ z51.literal("model_decision"),
12957
+ z51.string()
12557
12958
  // accepts any string for forward compatibility
12558
12959
  ])
12559
12960
  ),
12560
- globs: z49.optional(z49.string()),
12561
- description: z49.optional(z49.string())
12961
+ globs: z51.optional(z51.string()),
12962
+ description: z51.optional(z51.string())
12562
12963
  });
12563
12964
  function parseGlobsString(globs) {
12564
12965
  if (!globs) {
@@ -12703,7 +13104,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
12703
13104
  const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
12704
13105
  if (!result.success) {
12705
13106
  throw new Error(
12706
- `Invalid frontmatter in ${join92(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
13107
+ `Invalid frontmatter in ${join94(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
12707
13108
  );
12708
13109
  }
12709
13110
  }
@@ -12727,7 +13128,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
12727
13128
  relativeFilePath,
12728
13129
  validate = true
12729
13130
  }) {
12730
- const filePath = join92(
13131
+ const filePath = join94(
12731
13132
  baseDir,
12732
13133
  this.getSettablePaths().nonRoot.relativeDirPath,
12733
13134
  relativeFilePath
@@ -12867,7 +13268,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
12867
13268
  };
12868
13269
 
12869
13270
  // src/features/rules/augmentcode-legacy-rule.ts
12870
- import { join as join93 } from "path";
13271
+ import { join as join95 } from "path";
12871
13272
  var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
12872
13273
  toRulesyncRule() {
12873
13274
  const rulesyncFrontmatter = {
@@ -12927,8 +13328,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
12927
13328
  }) {
12928
13329
  const settablePaths = this.getSettablePaths();
12929
13330
  const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
12930
- const relativePath = isRoot ? settablePaths.root.relativeFilePath : join93(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
12931
- const fileContent = await readFileContent(join93(baseDir, relativePath));
13331
+ const relativePath = isRoot ? settablePaths.root.relativeFilePath : join95(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
13332
+ const fileContent = await readFileContent(join95(baseDir, relativePath));
12932
13333
  return new _AugmentcodeLegacyRule({
12933
13334
  baseDir,
12934
13335
  relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
@@ -12957,7 +13358,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
12957
13358
  };
12958
13359
 
12959
13360
  // src/features/rules/augmentcode-rule.ts
12960
- import { join as join94 } from "path";
13361
+ import { join as join96 } from "path";
12961
13362
  var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
12962
13363
  toRulesyncRule() {
12963
13364
  return this.toRulesyncRuleDefault();
@@ -12988,7 +13389,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
12988
13389
  relativeFilePath,
12989
13390
  validate = true
12990
13391
  }) {
12991
- const filePath = join94(
13392
+ const filePath = join96(
12992
13393
  baseDir,
12993
13394
  this.getSettablePaths().nonRoot.relativeDirPath,
12994
13395
  relativeFilePath
@@ -13028,7 +13429,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
13028
13429
  };
13029
13430
 
13030
13431
  // src/features/rules/claudecode-legacy-rule.ts
13031
- import { join as join95 } from "path";
13432
+ import { join as join97 } from "path";
13032
13433
  var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
13033
13434
  static getSettablePaths({
13034
13435
  global,
@@ -13070,7 +13471,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
13070
13471
  if (isRoot) {
13071
13472
  const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
13072
13473
  const fileContent2 = await readFileContent(
13073
- join95(baseDir, rootDirPath, paths.root.relativeFilePath)
13474
+ join97(baseDir, rootDirPath, paths.root.relativeFilePath)
13074
13475
  );
13075
13476
  return new _ClaudecodeLegacyRule({
13076
13477
  baseDir,
@@ -13084,8 +13485,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
13084
13485
  if (!paths.nonRoot) {
13085
13486
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
13086
13487
  }
13087
- const relativePath = join95(paths.nonRoot.relativeDirPath, relativeFilePath);
13088
- const fileContent = await readFileContent(join95(baseDir, relativePath));
13488
+ const relativePath = join97(paths.nonRoot.relativeDirPath, relativeFilePath);
13489
+ const fileContent = await readFileContent(join97(baseDir, relativePath));
13089
13490
  return new _ClaudecodeLegacyRule({
13090
13491
  baseDir,
13091
13492
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -13144,10 +13545,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
13144
13545
  };
13145
13546
 
13146
13547
  // src/features/rules/claudecode-rule.ts
13147
- import { join as join96 } from "path";
13148
- import { z as z50 } from "zod/mini";
13149
- var ClaudecodeRuleFrontmatterSchema = z50.object({
13150
- paths: z50.optional(z50.array(z50.string()))
13548
+ import { join as join98 } from "path";
13549
+ import { z as z52 } from "zod/mini";
13550
+ var ClaudecodeRuleFrontmatterSchema = z52.object({
13551
+ paths: z52.optional(z52.array(z52.string()))
13151
13552
  });
13152
13553
  var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
13153
13554
  frontmatter;
@@ -13185,7 +13586,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
13185
13586
  const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
13186
13587
  if (!result.success) {
13187
13588
  throw new Error(
13188
- `Invalid frontmatter in ${join96(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
13589
+ `Invalid frontmatter in ${join98(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
13189
13590
  );
13190
13591
  }
13191
13592
  }
@@ -13215,7 +13616,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
13215
13616
  if (isRoot) {
13216
13617
  const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
13217
13618
  const fileContent2 = await readFileContent(
13218
- join96(baseDir, rootDirPath, paths.root.relativeFilePath)
13619
+ join98(baseDir, rootDirPath, paths.root.relativeFilePath)
13219
13620
  );
13220
13621
  return new _ClaudecodeRule({
13221
13622
  baseDir,
@@ -13230,8 +13631,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
13230
13631
  if (!paths.nonRoot) {
13231
13632
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
13232
13633
  }
13233
- const relativePath = join96(paths.nonRoot.relativeDirPath, relativeFilePath);
13234
- const filePath = join96(baseDir, relativePath);
13634
+ const relativePath = join98(paths.nonRoot.relativeDirPath, relativeFilePath);
13635
+ const filePath = join98(baseDir, relativePath);
13235
13636
  const fileContent = await readFileContent(filePath);
13236
13637
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
13237
13638
  const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
@@ -13342,7 +13743,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
13342
13743
  return {
13343
13744
  success: false,
13344
13745
  error: new Error(
13345
- `Invalid frontmatter in ${join96(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
13746
+ `Invalid frontmatter in ${join98(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
13346
13747
  )
13347
13748
  };
13348
13749
  }
@@ -13362,10 +13763,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
13362
13763
  };
13363
13764
 
13364
13765
  // src/features/rules/cline-rule.ts
13365
- import { join as join97 } from "path";
13366
- import { z as z51 } from "zod/mini";
13367
- var ClineRuleFrontmatterSchema = z51.object({
13368
- description: z51.string()
13766
+ import { join as join99 } from "path";
13767
+ import { z as z53 } from "zod/mini";
13768
+ var ClineRuleFrontmatterSchema = z53.object({
13769
+ description: z53.string()
13369
13770
  });
13370
13771
  var ClineRule = class _ClineRule extends ToolRule {
13371
13772
  static getSettablePaths(_options = {}) {
@@ -13408,7 +13809,7 @@ var ClineRule = class _ClineRule extends ToolRule {
13408
13809
  validate = true
13409
13810
  }) {
13410
13811
  const fileContent = await readFileContent(
13411
- join97(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
13812
+ join99(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
13412
13813
  );
13413
13814
  return new _ClineRule({
13414
13815
  baseDir,
@@ -13434,7 +13835,7 @@ var ClineRule = class _ClineRule extends ToolRule {
13434
13835
  };
13435
13836
 
13436
13837
  // src/features/rules/codexcli-rule.ts
13437
- import { join as join98 } from "path";
13838
+ import { join as join100 } from "path";
13438
13839
  var CodexcliRule = class _CodexcliRule extends ToolRule {
13439
13840
  static getSettablePaths({
13440
13841
  global,
@@ -13469,7 +13870,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
13469
13870
  if (isRoot) {
13470
13871
  const relativePath2 = paths.root.relativeFilePath;
13471
13872
  const fileContent2 = await readFileContent(
13472
- join98(baseDir, paths.root.relativeDirPath, relativePath2)
13873
+ join100(baseDir, paths.root.relativeDirPath, relativePath2)
13473
13874
  );
13474
13875
  return new _CodexcliRule({
13475
13876
  baseDir,
@@ -13483,8 +13884,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
13483
13884
  if (!paths.nonRoot) {
13484
13885
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
13485
13886
  }
13486
- const relativePath = join98(paths.nonRoot.relativeDirPath, relativeFilePath);
13487
- const fileContent = await readFileContent(join98(baseDir, relativePath));
13887
+ const relativePath = join100(paths.nonRoot.relativeDirPath, relativeFilePath);
13888
+ const fileContent = await readFileContent(join100(baseDir, relativePath));
13488
13889
  return new _CodexcliRule({
13489
13890
  baseDir,
13490
13891
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -13543,12 +13944,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
13543
13944
  };
13544
13945
 
13545
13946
  // src/features/rules/copilot-rule.ts
13546
- import { join as join99 } from "path";
13547
- import { z as z52 } from "zod/mini";
13548
- var CopilotRuleFrontmatterSchema = z52.object({
13549
- description: z52.optional(z52.string()),
13550
- applyTo: z52.optional(z52.string()),
13551
- excludeAgent: z52.optional(z52.union([z52.literal("code-review"), z52.literal("coding-agent")]))
13947
+ import { join as join101 } from "path";
13948
+ import { z as z54 } from "zod/mini";
13949
+ var CopilotRuleFrontmatterSchema = z54.object({
13950
+ description: z54.optional(z54.string()),
13951
+ applyTo: z54.optional(z54.string()),
13952
+ excludeAgent: z54.optional(z54.union([z54.literal("code-review"), z54.literal("coding-agent")]))
13552
13953
  });
13553
13954
  var CopilotRule = class _CopilotRule extends ToolRule {
13554
13955
  frontmatter;
@@ -13559,6 +13960,9 @@ var CopilotRule = class _CopilotRule extends ToolRule {
13559
13960
  root: {
13560
13961
  relativeDirPath: buildToolPath(".copilot", ".", options.excludeToolDir),
13561
13962
  relativeFilePath: "copilot-instructions.md"
13963
+ },
13964
+ nonRoot: {
13965
+ relativeDirPath: buildToolPath(".copilot", "instructions", options.excludeToolDir)
13562
13966
  }
13563
13967
  };
13564
13968
  }
@@ -13577,7 +13981,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
13577
13981
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
13578
13982
  if (!result.success) {
13579
13983
  throw new Error(
13580
- `Invalid frontmatter in ${join99(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
13984
+ `Invalid frontmatter in ${join101(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
13581
13985
  );
13582
13986
  }
13583
13987
  }
@@ -13667,8 +14071,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
13667
14071
  const paths = this.getSettablePaths({ global });
13668
14072
  const isRoot = relativeFilePath === paths.root.relativeFilePath;
13669
14073
  if (isRoot) {
13670
- const relativePath2 = join99(paths.root.relativeDirPath, paths.root.relativeFilePath);
13671
- const filePath2 = join99(baseDir, relativePath2);
14074
+ const relativePath2 = join101(paths.root.relativeDirPath, paths.root.relativeFilePath);
14075
+ const filePath2 = join101(baseDir, relativePath2);
13672
14076
  const fileContent2 = await readFileContent(filePath2);
13673
14077
  return new _CopilotRule({
13674
14078
  baseDir,
@@ -13683,8 +14087,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
13683
14087
  if (!paths.nonRoot) {
13684
14088
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
13685
14089
  }
13686
- const relativePath = join99(paths.nonRoot.relativeDirPath, relativeFilePath);
13687
- const filePath = join99(baseDir, relativePath);
14090
+ const relativePath = join101(paths.nonRoot.relativeDirPath, relativeFilePath);
14091
+ const filePath = join101(baseDir, relativePath);
13688
14092
  const fileContent = await readFileContent(filePath);
13689
14093
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
13690
14094
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
@@ -13730,7 +14134,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
13730
14134
  return {
13731
14135
  success: false,
13732
14136
  error: new Error(
13733
- `Invalid frontmatter in ${join99(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
14137
+ `Invalid frontmatter in ${join101(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
13734
14138
  )
13735
14139
  };
13736
14140
  }
@@ -13750,12 +14154,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
13750
14154
  };
13751
14155
 
13752
14156
  // src/features/rules/cursor-rule.ts
13753
- import { join as join100 } from "path";
13754
- import { z as z53 } from "zod/mini";
13755
- var CursorRuleFrontmatterSchema = z53.object({
13756
- description: z53.optional(z53.string()),
13757
- globs: z53.optional(z53.string()),
13758
- alwaysApply: z53.optional(z53.boolean())
14157
+ import { join as join102 } from "path";
14158
+ import { z as z55 } from "zod/mini";
14159
+ var CursorRuleFrontmatterSchema = z55.object({
14160
+ description: z55.optional(z55.string()),
14161
+ globs: z55.optional(z55.string()),
14162
+ alwaysApply: z55.optional(z55.boolean())
13759
14163
  });
13760
14164
  var CursorRule = class _CursorRule extends ToolRule {
13761
14165
  frontmatter;
@@ -13772,7 +14176,7 @@ var CursorRule = class _CursorRule extends ToolRule {
13772
14176
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
13773
14177
  if (!result.success) {
13774
14178
  throw new Error(
13775
- `Invalid frontmatter in ${join100(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
14179
+ `Invalid frontmatter in ${join102(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
13776
14180
  );
13777
14181
  }
13778
14182
  }
@@ -13888,7 +14292,7 @@ var CursorRule = class _CursorRule extends ToolRule {
13888
14292
  relativeFilePath,
13889
14293
  validate = true
13890
14294
  }) {
13891
- const filePath = join100(
14295
+ const filePath = join102(
13892
14296
  baseDir,
13893
14297
  this.getSettablePaths().nonRoot.relativeDirPath,
13894
14298
  relativeFilePath
@@ -13898,7 +14302,7 @@ var CursorRule = class _CursorRule extends ToolRule {
13898
14302
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
13899
14303
  if (!result.success) {
13900
14304
  throw new Error(
13901
- `Invalid frontmatter in ${join100(baseDir, relativeFilePath)}: ${formatError(result.error)}`
14305
+ `Invalid frontmatter in ${join102(baseDir, relativeFilePath)}: ${formatError(result.error)}`
13902
14306
  );
13903
14307
  }
13904
14308
  return new _CursorRule({
@@ -13935,7 +14339,7 @@ var CursorRule = class _CursorRule extends ToolRule {
13935
14339
  return {
13936
14340
  success: false,
13937
14341
  error: new Error(
13938
- `Invalid frontmatter in ${join100(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
14342
+ `Invalid frontmatter in ${join102(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
13939
14343
  )
13940
14344
  };
13941
14345
  }
@@ -13955,7 +14359,7 @@ var CursorRule = class _CursorRule extends ToolRule {
13955
14359
  };
13956
14360
 
13957
14361
  // src/features/rules/factorydroid-rule.ts
13958
- import { join as join101 } from "path";
14362
+ import { join as join103 } from "path";
13959
14363
  var FactorydroidRule = class _FactorydroidRule extends ToolRule {
13960
14364
  constructor({ fileContent, root, ...rest }) {
13961
14365
  super({
@@ -13995,8 +14399,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
13995
14399
  const paths = this.getSettablePaths({ global });
13996
14400
  const isRoot = relativeFilePath === paths.root.relativeFilePath;
13997
14401
  if (isRoot) {
13998
- const relativePath2 = join101(paths.root.relativeDirPath, paths.root.relativeFilePath);
13999
- const fileContent2 = await readFileContent(join101(baseDir, relativePath2));
14402
+ const relativePath2 = join103(paths.root.relativeDirPath, paths.root.relativeFilePath);
14403
+ const fileContent2 = await readFileContent(join103(baseDir, relativePath2));
14000
14404
  return new _FactorydroidRule({
14001
14405
  baseDir,
14002
14406
  relativeDirPath: paths.root.relativeDirPath,
@@ -14009,8 +14413,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
14009
14413
  if (!paths.nonRoot) {
14010
14414
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
14011
14415
  }
14012
- const relativePath = join101(paths.nonRoot.relativeDirPath, relativeFilePath);
14013
- const fileContent = await readFileContent(join101(baseDir, relativePath));
14416
+ const relativePath = join103(paths.nonRoot.relativeDirPath, relativeFilePath);
14417
+ const fileContent = await readFileContent(join103(baseDir, relativePath));
14014
14418
  return new _FactorydroidRule({
14015
14419
  baseDir,
14016
14420
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -14069,7 +14473,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
14069
14473
  };
14070
14474
 
14071
14475
  // src/features/rules/geminicli-rule.ts
14072
- import { join as join102 } from "path";
14476
+ import { join as join104 } from "path";
14073
14477
  var GeminiCliRule = class _GeminiCliRule extends ToolRule {
14074
14478
  static getSettablePaths({
14075
14479
  global,
@@ -14104,7 +14508,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
14104
14508
  if (isRoot) {
14105
14509
  const relativePath2 = paths.root.relativeFilePath;
14106
14510
  const fileContent2 = await readFileContent(
14107
- join102(baseDir, paths.root.relativeDirPath, relativePath2)
14511
+ join104(baseDir, paths.root.relativeDirPath, relativePath2)
14108
14512
  );
14109
14513
  return new _GeminiCliRule({
14110
14514
  baseDir,
@@ -14118,8 +14522,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
14118
14522
  if (!paths.nonRoot) {
14119
14523
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
14120
14524
  }
14121
- const relativePath = join102(paths.nonRoot.relativeDirPath, relativeFilePath);
14122
- const fileContent = await readFileContent(join102(baseDir, relativePath));
14525
+ const relativePath = join104(paths.nonRoot.relativeDirPath, relativeFilePath);
14526
+ const fileContent = await readFileContent(join104(baseDir, relativePath));
14123
14527
  return new _GeminiCliRule({
14124
14528
  baseDir,
14125
14529
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -14178,7 +14582,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
14178
14582
  };
14179
14583
 
14180
14584
  // src/features/rules/goose-rule.ts
14181
- import { join as join103 } from "path";
14585
+ import { join as join105 } from "path";
14182
14586
  var GooseRule = class _GooseRule extends ToolRule {
14183
14587
  static getSettablePaths({
14184
14588
  global,
@@ -14213,7 +14617,7 @@ var GooseRule = class _GooseRule extends ToolRule {
14213
14617
  if (isRoot) {
14214
14618
  const relativePath2 = paths.root.relativeFilePath;
14215
14619
  const fileContent2 = await readFileContent(
14216
- join103(baseDir, paths.root.relativeDirPath, relativePath2)
14620
+ join105(baseDir, paths.root.relativeDirPath, relativePath2)
14217
14621
  );
14218
14622
  return new _GooseRule({
14219
14623
  baseDir,
@@ -14227,8 +14631,8 @@ var GooseRule = class _GooseRule extends ToolRule {
14227
14631
  if (!paths.nonRoot) {
14228
14632
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
14229
14633
  }
14230
- const relativePath = join103(paths.nonRoot.relativeDirPath, relativeFilePath);
14231
- const fileContent = await readFileContent(join103(baseDir, relativePath));
14634
+ const relativePath = join105(paths.nonRoot.relativeDirPath, relativeFilePath);
14635
+ const fileContent = await readFileContent(join105(baseDir, relativePath));
14232
14636
  return new _GooseRule({
14233
14637
  baseDir,
14234
14638
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -14287,7 +14691,7 @@ var GooseRule = class _GooseRule extends ToolRule {
14287
14691
  };
14288
14692
 
14289
14693
  // src/features/rules/junie-rule.ts
14290
- import { join as join104 } from "path";
14694
+ import { join as join106 } from "path";
14291
14695
  var JunieRule = class _JunieRule extends ToolRule {
14292
14696
  static getSettablePaths(_options = {}) {
14293
14697
  return {
@@ -14306,8 +14710,8 @@ var JunieRule = class _JunieRule extends ToolRule {
14306
14710
  validate = true
14307
14711
  }) {
14308
14712
  const isRoot = relativeFilePath === "guidelines.md";
14309
- const relativePath = isRoot ? "guidelines.md" : join104(".junie", "memories", relativeFilePath);
14310
- const fileContent = await readFileContent(join104(baseDir, relativePath));
14713
+ const relativePath = isRoot ? "guidelines.md" : join106(".junie", "memories", relativeFilePath);
14714
+ const fileContent = await readFileContent(join106(baseDir, relativePath));
14311
14715
  return new _JunieRule({
14312
14716
  baseDir,
14313
14717
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -14362,7 +14766,7 @@ var JunieRule = class _JunieRule extends ToolRule {
14362
14766
  };
14363
14767
 
14364
14768
  // src/features/rules/kilo-rule.ts
14365
- import { join as join105 } from "path";
14769
+ import { join as join107 } from "path";
14366
14770
  var KiloRule = class _KiloRule extends ToolRule {
14367
14771
  static getSettablePaths(_options = {}) {
14368
14772
  return {
@@ -14377,7 +14781,7 @@ var KiloRule = class _KiloRule extends ToolRule {
14377
14781
  validate = true
14378
14782
  }) {
14379
14783
  const fileContent = await readFileContent(
14380
- join105(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
14784
+ join107(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
14381
14785
  );
14382
14786
  return new _KiloRule({
14383
14787
  baseDir,
@@ -14429,7 +14833,7 @@ var KiloRule = class _KiloRule extends ToolRule {
14429
14833
  };
14430
14834
 
14431
14835
  // src/features/rules/kiro-rule.ts
14432
- import { join as join106 } from "path";
14836
+ import { join as join108 } from "path";
14433
14837
  var KiroRule = class _KiroRule extends ToolRule {
14434
14838
  static getSettablePaths(_options = {}) {
14435
14839
  return {
@@ -14444,7 +14848,7 @@ var KiroRule = class _KiroRule extends ToolRule {
14444
14848
  validate = true
14445
14849
  }) {
14446
14850
  const fileContent = await readFileContent(
14447
- join106(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
14851
+ join108(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
14448
14852
  );
14449
14853
  return new _KiroRule({
14450
14854
  baseDir,
@@ -14498,7 +14902,7 @@ var KiroRule = class _KiroRule extends ToolRule {
14498
14902
  };
14499
14903
 
14500
14904
  // src/features/rules/opencode-rule.ts
14501
- import { join as join107 } from "path";
14905
+ import { join as join109 } from "path";
14502
14906
  var OpenCodeRule = class _OpenCodeRule extends ToolRule {
14503
14907
  static getSettablePaths({
14504
14908
  global,
@@ -14533,7 +14937,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
14533
14937
  if (isRoot) {
14534
14938
  const relativePath2 = paths.root.relativeFilePath;
14535
14939
  const fileContent2 = await readFileContent(
14536
- join107(baseDir, paths.root.relativeDirPath, relativePath2)
14940
+ join109(baseDir, paths.root.relativeDirPath, relativePath2)
14537
14941
  );
14538
14942
  return new _OpenCodeRule({
14539
14943
  baseDir,
@@ -14547,8 +14951,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
14547
14951
  if (!paths.nonRoot) {
14548
14952
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
14549
14953
  }
14550
- const relativePath = join107(paths.nonRoot.relativeDirPath, relativeFilePath);
14551
- const fileContent = await readFileContent(join107(baseDir, relativePath));
14954
+ const relativePath = join109(paths.nonRoot.relativeDirPath, relativeFilePath);
14955
+ const fileContent = await readFileContent(join109(baseDir, relativePath));
14552
14956
  return new _OpenCodeRule({
14553
14957
  baseDir,
14554
14958
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -14607,7 +15011,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
14607
15011
  };
14608
15012
 
14609
15013
  // src/features/rules/qwencode-rule.ts
14610
- import { join as join108 } from "path";
15014
+ import { join as join110 } from "path";
14611
15015
  var QwencodeRule = class _QwencodeRule extends ToolRule {
14612
15016
  static getSettablePaths(_options = {}) {
14613
15017
  return {
@@ -14626,8 +15030,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
14626
15030
  validate = true
14627
15031
  }) {
14628
15032
  const isRoot = relativeFilePath === "QWEN.md";
14629
- const relativePath = isRoot ? "QWEN.md" : join108(".qwen", "memories", relativeFilePath);
14630
- const fileContent = await readFileContent(join108(baseDir, relativePath));
15033
+ const relativePath = isRoot ? "QWEN.md" : join110(".qwen", "memories", relativeFilePath);
15034
+ const fileContent = await readFileContent(join110(baseDir, relativePath));
14631
15035
  return new _QwencodeRule({
14632
15036
  baseDir,
14633
15037
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -14679,7 +15083,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
14679
15083
  };
14680
15084
 
14681
15085
  // src/features/rules/replit-rule.ts
14682
- import { join as join109 } from "path";
15086
+ import { join as join111 } from "path";
14683
15087
  var ReplitRule = class _ReplitRule extends ToolRule {
14684
15088
  static getSettablePaths(_options = {}) {
14685
15089
  return {
@@ -14701,7 +15105,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
14701
15105
  }
14702
15106
  const relativePath = paths.root.relativeFilePath;
14703
15107
  const fileContent = await readFileContent(
14704
- join109(baseDir, paths.root.relativeDirPath, relativePath)
15108
+ join111(baseDir, paths.root.relativeDirPath, relativePath)
14705
15109
  );
14706
15110
  return new _ReplitRule({
14707
15111
  baseDir,
@@ -14767,7 +15171,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
14767
15171
  };
14768
15172
 
14769
15173
  // src/features/rules/roo-rule.ts
14770
- import { join as join110 } from "path";
15174
+ import { join as join112 } from "path";
14771
15175
  var RooRule = class _RooRule extends ToolRule {
14772
15176
  static getSettablePaths(_options = {}) {
14773
15177
  return {
@@ -14782,7 +15186,7 @@ var RooRule = class _RooRule extends ToolRule {
14782
15186
  validate = true
14783
15187
  }) {
14784
15188
  const fileContent = await readFileContent(
14785
- join110(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
15189
+ join112(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
14786
15190
  );
14787
15191
  return new _RooRule({
14788
15192
  baseDir,
@@ -14851,7 +15255,7 @@ var RooRule = class _RooRule extends ToolRule {
14851
15255
  };
14852
15256
 
14853
15257
  // src/features/rules/warp-rule.ts
14854
- import { join as join111 } from "path";
15258
+ import { join as join113 } from "path";
14855
15259
  var WarpRule = class _WarpRule extends ToolRule {
14856
15260
  constructor({ fileContent, root, ...rest }) {
14857
15261
  super({
@@ -14877,8 +15281,8 @@ var WarpRule = class _WarpRule extends ToolRule {
14877
15281
  validate = true
14878
15282
  }) {
14879
15283
  const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
14880
- const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join111(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
14881
- const fileContent = await readFileContent(join111(baseDir, relativePath));
15284
+ const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join113(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
15285
+ const fileContent = await readFileContent(join113(baseDir, relativePath));
14882
15286
  return new _WarpRule({
14883
15287
  baseDir,
14884
15288
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
@@ -14933,7 +15337,7 @@ var WarpRule = class _WarpRule extends ToolRule {
14933
15337
  };
14934
15338
 
14935
15339
  // src/features/rules/windsurf-rule.ts
14936
- import { join as join112 } from "path";
15340
+ import { join as join114 } from "path";
14937
15341
  var WindsurfRule = class _WindsurfRule extends ToolRule {
14938
15342
  static getSettablePaths(_options = {}) {
14939
15343
  return {
@@ -14948,7 +15352,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
14948
15352
  validate = true
14949
15353
  }) {
14950
15354
  const fileContent = await readFileContent(
14951
- join112(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
15355
+ join114(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
14952
15356
  );
14953
15357
  return new _WindsurfRule({
14954
15358
  baseDir,
@@ -15024,8 +15428,8 @@ var rulesProcessorToolTargets = [
15024
15428
  "warp",
15025
15429
  "windsurf"
15026
15430
  ];
15027
- var RulesProcessorToolTargetSchema = z54.enum(rulesProcessorToolTargets);
15028
- var formatRulePaths = (rules) => rules.map((r) => join113(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
15431
+ var RulesProcessorToolTargetSchema = z56.enum(rulesProcessorToolTargets);
15432
+ var formatRulePaths = (rules) => rules.map((r) => join115(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
15029
15433
  var toolRuleFactories = /* @__PURE__ */ new Map([
15030
15434
  [
15031
15435
  "agentsmd",
@@ -15400,7 +15804,7 @@ var RulesProcessor = class extends FeatureProcessor {
15400
15804
  }).relativeDirPath;
15401
15805
  return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
15402
15806
  const frontmatter = skill.getFrontmatter();
15403
- const relativePath = join113(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
15807
+ const relativePath = join115(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
15404
15808
  return {
15405
15809
  name: frontmatter.name,
15406
15810
  description: frontmatter.description,
@@ -15513,8 +15917,8 @@ var RulesProcessor = class extends FeatureProcessor {
15513
15917
  * Load and parse rulesync rule files from .rulesync/rules/ directory
15514
15918
  */
15515
15919
  async loadRulesyncFiles() {
15516
- const rulesyncBaseDir = join113(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
15517
- const files = await findFilesByGlobs(join113(rulesyncBaseDir, "**", "*.md"));
15920
+ const rulesyncBaseDir = join115(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
15921
+ const files = await findFilesByGlobs(join115(rulesyncBaseDir, "**", "*.md"));
15518
15922
  logger.debug(`Found ${files.length} rulesync files`);
15519
15923
  const rulesyncRules = await Promise.all(
15520
15924
  files.map((file) => {
@@ -15528,41 +15932,57 @@ var RulesProcessor = class extends FeatureProcessor {
15528
15932
  });
15529
15933
  })
15530
15934
  );
15935
+ const factory = this.getFactory(this.toolTarget);
15531
15936
  const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
15532
- if (rootRules.length > 1) {
15533
- throw new Error(`Multiple root rulesync rules found: ${formatRulePaths(rootRules)}`);
15937
+ const targetedRootRules = rootRules.filter(
15938
+ (rule) => factory.class.isTargetedByRulesyncRule(rule)
15939
+ );
15940
+ if (targetedRootRules.length > 1) {
15941
+ throw new Error(
15942
+ `Multiple root rulesync rules found for target '${this.toolTarget}': ${formatRulePaths(targetedRootRules)}`
15943
+ );
15534
15944
  }
15535
- if (rootRules.length === 0 && rulesyncRules.length > 0) {
15945
+ if (targetedRootRules.length === 0 && rulesyncRules.length > 0) {
15536
15946
  logger.warn(
15537
- `No root rulesync rule file found. Consider adding 'root: true' to one of your rule files in ${RULESYNC_RULES_RELATIVE_DIR_PATH}.`
15947
+ `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}.`
15538
15948
  );
15539
15949
  }
15540
15950
  const localRootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().localRoot);
15541
- if (localRootRules.length > 1) {
15951
+ const targetedLocalRootRules = localRootRules.filter(
15952
+ (rule) => factory.class.isTargetedByRulesyncRule(rule)
15953
+ );
15954
+ if (targetedLocalRootRules.length > 1) {
15542
15955
  throw new Error(
15543
- `Multiple localRoot rules found: ${formatRulePaths(localRootRules)}. Only one rule can have localRoot: true`
15956
+ `Multiple localRoot rules found for target '${this.toolTarget}': ${formatRulePaths(targetedLocalRootRules)}. Only one rule can have localRoot: true`
15544
15957
  );
15545
15958
  }
15546
- if (localRootRules.length > 0 && rootRules.length === 0) {
15959
+ if (targetedLocalRootRules.length > 0 && targetedRootRules.length === 0) {
15547
15960
  throw new Error(
15548
- `localRoot: true requires a root: true rule to exist (found in ${formatRulePaths(localRootRules)})`
15961
+ `localRoot: true requires a root: true rule to exist for target '${this.toolTarget}' (found in ${formatRulePaths(targetedLocalRootRules)})`
15549
15962
  );
15550
15963
  }
15551
15964
  if (this.global) {
15552
- const nonRootRules = rulesyncRules.filter((rule) => !rule.getFrontmatter().root);
15553
- if (nonRootRules.length > 0) {
15965
+ const globalPaths = factory.class.getSettablePaths({ global: true });
15966
+ const supportsGlobalNonRoot = "nonRoot" in globalPaths && globalPaths.nonRoot !== null;
15967
+ const nonRootRules2 = rulesyncRules.filter(
15968
+ (rule) => !rule.getFrontmatter().root && !rule.getFrontmatter().localRoot && factory.class.isTargetedByRulesyncRule(rule)
15969
+ );
15970
+ if (nonRootRules2.length > 0 && !supportsGlobalNonRoot) {
15554
15971
  logger.warn(
15555
- `${nonRootRules.length} non-root rulesync rules found, but it's in global mode, so ignoring them: ${formatRulePaths(nonRootRules)}`
15972
+ `${nonRootRules2.length} non-root rulesync rules found, but it's in global mode, so ignoring them: ${formatRulePaths(nonRootRules2)}`
15556
15973
  );
15557
15974
  }
15558
- if (localRootRules.length > 0) {
15975
+ if (targetedLocalRootRules.length > 0) {
15559
15976
  logger.warn(
15560
- `${localRootRules.length} localRoot rules found, but localRoot is not supported in global mode, ignoring them: ${formatRulePaths(localRootRules)}`
15977
+ `${targetedLocalRootRules.length} localRoot rules found, but localRoot is not supported in global mode, ignoring them: ${formatRulePaths(targetedLocalRootRules)}`
15561
15978
  );
15562
15979
  }
15563
- return rootRules;
15980
+ return supportsGlobalNonRoot ? [...targetedRootRules, ...nonRootRules2] : targetedRootRules;
15564
15981
  }
15565
- return rulesyncRules;
15982
+ const nonRootRules = rulesyncRules.filter(
15983
+ (rule) => !rule.getFrontmatter().root && factory.class.isTargetedByRulesyncRule(rule)
15984
+ );
15985
+ return [...targetedRootRules, ...nonRootRules];
15566
15986
  }
15567
15987
  /**
15568
15988
  * Implementation of abstract method from FeatureProcessor
@@ -15595,13 +16015,13 @@ var RulesProcessor = class extends FeatureProcessor {
15595
16015
  return [];
15596
16016
  }
15597
16017
  const uniqueRootFilePaths = await findFilesWithFallback(
15598
- join113(
16018
+ join115(
15599
16019
  this.baseDir,
15600
16020
  settablePaths.root.relativeDirPath ?? ".",
15601
16021
  settablePaths.root.relativeFilePath
15602
16022
  ),
15603
16023
  settablePaths.alternativeRoots,
15604
- (alt) => join113(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
16024
+ (alt) => join115(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
15605
16025
  );
15606
16026
  if (forDeletion) {
15607
16027
  return uniqueRootFilePaths.map((filePath) => {
@@ -15646,9 +16066,9 @@ var RulesProcessor = class extends FeatureProcessor {
15646
16066
  return [];
15647
16067
  }
15648
16068
  const uniqueLocalRootFilePaths = await findFilesWithFallback(
15649
- join113(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
16069
+ join115(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
15650
16070
  settablePaths.alternativeRoots,
15651
- (alt) => join113(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
16071
+ (alt) => join115(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
15652
16072
  );
15653
16073
  return uniqueLocalRootFilePaths.map((filePath) => {
15654
16074
  const relativeDirPath = resolveRelativeDirPath(filePath);
@@ -15669,9 +16089,9 @@ var RulesProcessor = class extends FeatureProcessor {
15669
16089
  if (!settablePaths.nonRoot) {
15670
16090
  return [];
15671
16091
  }
15672
- const nonRootBaseDir = join113(this.baseDir, settablePaths.nonRoot.relativeDirPath);
16092
+ const nonRootBaseDir = join115(this.baseDir, settablePaths.nonRoot.relativeDirPath);
15673
16093
  const nonRootFilePaths = await findFilesByGlobs(
15674
- join113(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
16094
+ join115(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
15675
16095
  );
15676
16096
  if (forDeletion) {
15677
16097
  return nonRootFilePaths.map((filePath) => {
@@ -15803,14 +16223,14 @@ s/<command> [arguments]
15803
16223
  This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
15804
16224
  The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
15805
16225
 
15806
- When users call a custom slash command, you have to look for the markdown file, \`${join113(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
16226
+ When users call a custom slash command, you have to look for the markdown file, \`${join115(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
15807
16227
  const subagentsSection = subagents ? `## Simulated Subagents
15808
16228
 
15809
16229
  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.
15810
16230
 
15811
- When users call a simulated subagent, it will look for the corresponding markdown file, \`${join113(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
16231
+ When users call a simulated subagent, it will look for the corresponding markdown file, \`${join115(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
15812
16232
 
15813
- For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join113(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
16233
+ For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join115(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
15814
16234
  const skillsSection = skills ? this.generateSkillsSection(skills) : "";
15815
16235
  const result = [
15816
16236
  overview,
@@ -15890,7 +16310,7 @@ function warnUnsupportedTargets(params) {
15890
16310
  }
15891
16311
  }
15892
16312
  async function checkRulesyncDirExists(params) {
15893
- return fileExists(join114(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
16313
+ return fileExists(join116(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
15894
16314
  }
15895
16315
  async function generate(params) {
15896
16316
  const { config } = params;
@@ -16458,6 +16878,8 @@ export {
16458
16878
  readFileContent,
16459
16879
  writeFileContent,
16460
16880
  fileExists,
16881
+ getFileSize,
16882
+ isSymlink,
16461
16883
  listDirectoryFiles,
16462
16884
  findFilesByGlobs,
16463
16885
  removeDirectory,