rulesync 7.28.0 → 8.0.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.
@@ -30,10 +30,21 @@ var ALL_FEATURES = [
30
30
  var ALL_FEATURES_WITH_WILDCARD = [...ALL_FEATURES, "*"];
31
31
  var FeatureSchema = z.enum(ALL_FEATURES);
32
32
  var FeaturesSchema = z.array(FeatureSchema);
33
+ var FeatureOptionsSchema = z.record(z.string(), z.unknown());
34
+ var FeatureValueSchema = z.union([z.boolean(), FeatureOptionsSchema]);
35
+ var PerFeatureConfigSchema = z.record(z.string(), FeatureValueSchema);
33
36
  var RulesyncFeaturesSchema = z.union([
34
37
  z.array(z.enum(ALL_FEATURES_WITH_WILDCARD)),
35
- z.record(z.string(), z.array(z.enum(ALL_FEATURES_WITH_WILDCARD)))
38
+ z.record(
39
+ z.string(),
40
+ z.union([z.array(z.enum(ALL_FEATURES_WITH_WILDCARD)), PerFeatureConfigSchema])
41
+ )
36
42
  ]);
43
+ var isFeatureValueEnabled = (value) => {
44
+ if (value === true) return true;
45
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) return true;
46
+ return false;
47
+ };
37
48
 
38
49
  // src/types/tool-targets.ts
39
50
  import { z as z2 } from "zod/mini";
@@ -353,7 +364,7 @@ var CONFLICTING_TARGET_PAIRS = [
353
364
  ["claudecode", "claudecode-legacy"]
354
365
  ];
355
366
  var LEGACY_TARGETS = ["augmentcode-legacy", "claudecode-legacy"];
356
- var Config = class {
367
+ var Config = class _Config {
357
368
  baseDirs;
358
369
  targets;
359
370
  features;
@@ -428,26 +439,23 @@ var Config = class {
428
439
  const perTargetFeatures = this.features;
429
440
  if (target) {
430
441
  const targetFeatures = perTargetFeatures[target];
431
- if (!targetFeatures || targetFeatures.length === 0) {
442
+ if (!targetFeatures) {
432
443
  return [];
433
444
  }
434
- if (targetFeatures.includes("*")) {
435
- return [...ALL_FEATURES];
436
- }
437
- return targetFeatures.filter((feature) => feature !== "*");
445
+ return _Config.normalizeTargetFeatures(targetFeatures);
438
446
  }
439
447
  const allFeatures = [];
440
448
  for (const features of Object.values(perTargetFeatures)) {
441
- if (features && features.length > 0) {
442
- if (features.includes("*")) {
443
- return [...ALL_FEATURES];
444
- }
445
- for (const feature of features) {
446
- if (feature !== "*" && !allFeatures.includes(feature)) {
447
- allFeatures.push(feature);
448
- }
449
+ if (!features) continue;
450
+ const normalized = _Config.normalizeTargetFeatures(features);
451
+ for (const feature of normalized) {
452
+ if (!allFeatures.includes(feature)) {
453
+ allFeatures.push(feature);
449
454
  }
450
455
  }
456
+ if (allFeatures.length === ALL_FEATURES.length) {
457
+ return allFeatures;
458
+ }
451
459
  }
452
460
  return allFeatures;
453
461
  }
@@ -456,6 +464,47 @@ var Config = class {
456
464
  }
457
465
  return this.features.filter((feature) => feature !== "*");
458
466
  }
467
+ /**
468
+ * Normalize a per-target features value (array or per-feature object) into
469
+ * the flat list of enabled features.
470
+ */
471
+ static normalizeTargetFeatures(value) {
472
+ if (Array.isArray(value)) {
473
+ if (value.length === 0) return [];
474
+ if (value.includes("*")) return [...ALL_FEATURES];
475
+ return value.filter((feature) => feature !== "*");
476
+ }
477
+ if (isFeatureValueEnabled(value["*"])) {
478
+ return [...ALL_FEATURES];
479
+ }
480
+ const enabled = [];
481
+ for (const [key, val] of Object.entries(value)) {
482
+ if (key === "*") continue;
483
+ if (!isFeatureValueEnabled(val)) continue;
484
+ enabled.push(key);
485
+ }
486
+ return enabled;
487
+ }
488
+ /**
489
+ * Returns the per-feature options object for a given target/feature, if any.
490
+ * Returns `undefined` when no per-feature options were provided or when the
491
+ * feature is not enabled for the given target.
492
+ */
493
+ getFeatureOptions(target, feature) {
494
+ if (Array.isArray(this.features)) {
495
+ return void 0;
496
+ }
497
+ const targetFeatures = this.features[target];
498
+ if (!targetFeatures || Array.isArray(targetFeatures)) {
499
+ return void 0;
500
+ }
501
+ const perFeature = targetFeatures;
502
+ const value = perFeature[feature];
503
+ if (value && typeof value === "object" && isFeatureValueEnabled(value)) {
504
+ return value;
505
+ }
506
+ return void 0;
507
+ }
459
508
  /**
460
509
  * Check if per-target features configuration is being used.
461
510
  */
@@ -607,7 +656,7 @@ function getBaseDirsInLightOfGlobal({
607
656
  }
608
657
 
609
658
  // src/lib/generate.ts
610
- import { join as join131 } from "path";
659
+ import { join as join136 } from "path";
611
660
  import { intersection } from "es-toolkit";
612
661
 
613
662
  // src/features/commands/commands-processor.ts
@@ -5355,7 +5404,7 @@ var HooksProcessor = class extends FeatureProcessor {
5355
5404
  };
5356
5405
 
5357
5406
  // src/features/ignore/ignore-processor.ts
5358
- import { z as z21 } from "zod/mini";
5407
+ import { z as z22 } from "zod/mini";
5359
5408
 
5360
5409
  // src/features/ignore/augmentcode-ignore.ts
5361
5410
  import { join as join32 } from "path";
@@ -5431,7 +5480,7 @@ var ToolIgnore = class extends ToolFile {
5431
5480
  }
5432
5481
  }
5433
5482
  }
5434
- static getSettablePaths() {
5483
+ static getSettablePaths(_params) {
5435
5484
  throw new Error("Please implement this method in the subclass.");
5436
5485
  }
5437
5486
  getPatterns() {
@@ -5534,21 +5583,47 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
5534
5583
  // src/features/ignore/claudecode-ignore.ts
5535
5584
  import { join as join33 } from "path";
5536
5585
  import { uniq } from "es-toolkit";
5586
+ import { z as z21 } from "zod/mini";
5587
+ var SHARED_SETTINGS_FILE = "settings.json";
5588
+ var LOCAL_SETTINGS_FILE = "settings.local.json";
5589
+ var DEFAULT_FILE_MODE = "shared";
5590
+ var ClaudecodeIgnoreOptionsSchema = z21.looseObject({
5591
+ fileMode: z21.optional(z21.enum(["shared", "local"]))
5592
+ });
5593
+ var resolveFileMode = (options) => {
5594
+ if (!options) return DEFAULT_FILE_MODE;
5595
+ const parsed = ClaudecodeIgnoreOptionsSchema.safeParse(options);
5596
+ if (!parsed.success) {
5597
+ throw new Error(
5598
+ `Invalid options for claudecode ignore feature: ${parsed.error.message}. \`fileMode\` must be either "shared" or "local".`
5599
+ );
5600
+ }
5601
+ return parsed.data.fileMode ?? DEFAULT_FILE_MODE;
5602
+ };
5603
+ var fileNameForMode = (fileMode) => {
5604
+ return fileMode === "local" ? LOCAL_SETTINGS_FILE : SHARED_SETTINGS_FILE;
5605
+ };
5537
5606
  var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
5538
5607
  constructor(params) {
5539
5608
  super(params);
5540
5609
  const jsonValue = JSON.parse(this.fileContent);
5541
5610
  this.patterns = jsonValue.permissions?.deny ?? [];
5542
5611
  }
5543
- static getSettablePaths() {
5612
+ static getSettablePaths(params) {
5613
+ const fileMode = resolveFileMode(params?.options);
5544
5614
  return {
5545
5615
  relativeDirPath: ".claude",
5546
- relativeFilePath: "settings.json"
5616
+ relativeFilePath: fileNameForMode(fileMode)
5547
5617
  };
5548
5618
  }
5549
5619
  /**
5550
- * ClaudecodeIgnore uses settings.json, which can include non-ignore settings.
5551
- * It should not be deleted by rulesync.
5620
+ * ClaudecodeIgnore uses settings.json (or settings.local.json), which can
5621
+ * include non-ignore settings. It should not be deleted by rulesync.
5622
+ *
5623
+ * NOTE: Because this returns `false`, switching `fileMode` (e.g. from
5624
+ * `"local"` to `"shared"`) will not automatically clean up deny patterns
5625
+ * in the previously-used file. Users must manually remove stale deny
5626
+ * entries from the old file when changing `fileMode`.
5552
5627
  */
5553
5628
  isDeletable() {
5554
5629
  return false;
@@ -5570,16 +5645,14 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
5570
5645
  }
5571
5646
  static async fromRulesyncIgnore({
5572
5647
  baseDir = process.cwd(),
5573
- rulesyncIgnore
5648
+ rulesyncIgnore,
5649
+ options
5574
5650
  }) {
5575
5651
  const fileContent = rulesyncIgnore.getFileContent();
5576
5652
  const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
5577
5653
  const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
5578
- const filePath = join33(
5579
- baseDir,
5580
- this.getSettablePaths().relativeDirPath,
5581
- this.getSettablePaths().relativeFilePath
5582
- );
5654
+ const paths = this.getSettablePaths({ options });
5655
+ const filePath = join33(baseDir, paths.relativeDirPath, paths.relativeFilePath);
5583
5656
  const exists = await fileExists(filePath);
5584
5657
  const existingFileContent = exists ? await readFileContent(filePath) : "{}";
5585
5658
  const existingJsonValue = JSON.parse(existingFileContent);
@@ -5600,27 +5673,29 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
5600
5673
  };
5601
5674
  return new _ClaudecodeIgnore({
5602
5675
  baseDir,
5603
- relativeDirPath: this.getSettablePaths().relativeDirPath,
5604
- relativeFilePath: this.getSettablePaths().relativeFilePath,
5676
+ relativeDirPath: paths.relativeDirPath,
5677
+ relativeFilePath: paths.relativeFilePath,
5605
5678
  fileContent: JSON.stringify(jsonValue, null, 2),
5606
5679
  validate: true
5607
5680
  });
5608
5681
  }
5609
5682
  static async fromFile({
5610
5683
  baseDir = process.cwd(),
5611
- validate = true
5684
+ validate = true,
5685
+ options
5612
5686
  }) {
5613
- const fileContent = await readFileContent(
5614
- join33(
5615
- baseDir,
5616
- this.getSettablePaths().relativeDirPath,
5617
- this.getSettablePaths().relativeFilePath
5618
- )
5619
- );
5687
+ const fileMode = resolveFileMode(options);
5688
+ const paths = this.getSettablePaths({ options });
5689
+ const filePath = join33(baseDir, paths.relativeDirPath, paths.relativeFilePath);
5690
+ const exists = await fileExists(filePath);
5691
+ if (!exists && fileMode === "shared") {
5692
+ throw new Error(`File not found: ${filePath}`);
5693
+ }
5694
+ const fileContent = exists ? await readFileContent(filePath) : "{}";
5620
5695
  return new _ClaudecodeIgnore({
5621
5696
  baseDir,
5622
- relativeDirPath: this.getSettablePaths().relativeDirPath,
5623
- relativeFilePath: this.getSettablePaths().relativeFilePath,
5697
+ relativeDirPath: paths.relativeDirPath,
5698
+ relativeFilePath: paths.relativeFilePath,
5624
5699
  fileContent,
5625
5700
  validate
5626
5701
  });
@@ -6357,7 +6432,7 @@ var ignoreProcessorToolTargets = [
6357
6432
  "windsurf",
6358
6433
  "zed"
6359
6434
  ];
6360
- var IgnoreProcessorToolTargetSchema = z21.enum(ignoreProcessorToolTargets);
6435
+ var IgnoreProcessorToolTargetSchema = z22.enum(ignoreProcessorToolTargets);
6361
6436
  var toolIgnoreFactories = /* @__PURE__ */ new Map([
6362
6437
  ["augmentcode", { class: AugmentcodeIgnore }],
6363
6438
  ["claudecode", { class: ClaudecodeIgnore }],
@@ -6384,12 +6459,14 @@ var defaultGetFactory2 = (target) => {
6384
6459
  var IgnoreProcessor = class extends FeatureProcessor {
6385
6460
  toolTarget;
6386
6461
  getFactory;
6462
+ featureOptions;
6387
6463
  constructor({
6388
6464
  baseDir = process.cwd(),
6389
6465
  toolTarget,
6390
6466
  getFactory = defaultGetFactory2,
6391
6467
  dryRun = false,
6392
- logger
6468
+ logger,
6469
+ featureOptions
6393
6470
  }) {
6394
6471
  super({ baseDir, dryRun, logger });
6395
6472
  const result = IgnoreProcessorToolTargetSchema.safeParse(toolTarget);
@@ -6400,6 +6477,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
6400
6477
  }
6401
6478
  this.toolTarget = result.data;
6402
6479
  this.getFactory = getFactory;
6480
+ this.featureOptions = featureOptions;
6403
6481
  }
6404
6482
  async writeToolIgnoresFromRulesyncIgnores(rulesyncIgnores) {
6405
6483
  const toolIgnores = await this.convertRulesyncFilesToToolFiles(rulesyncIgnores);
@@ -6428,7 +6506,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
6428
6506
  } = {}) {
6429
6507
  try {
6430
6508
  const factory = this.getFactory(this.toolTarget);
6431
- const paths = factory.class.getSettablePaths();
6509
+ const paths = factory.class.getSettablePaths({ options: this.featureOptions });
6432
6510
  if (forDeletion) {
6433
6511
  const toolIgnore = factory.class.forDeletion({
6434
6512
  baseDir: this.baseDir,
@@ -6452,7 +6530,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
6452
6530
  }
6453
6531
  async loadToolIgnores() {
6454
6532
  const factory = this.getFactory(this.toolTarget);
6455
- return [await factory.class.fromFile({ baseDir: this.baseDir })];
6533
+ return [await factory.class.fromFile({ baseDir: this.baseDir, options: this.featureOptions })];
6456
6534
  }
6457
6535
  /**
6458
6536
  * Implementation of abstract method from FeatureProcessor
@@ -6468,7 +6546,8 @@ var IgnoreProcessor = class extends FeatureProcessor {
6468
6546
  const factory = this.getFactory(this.toolTarget);
6469
6547
  const toolIgnore = await factory.class.fromRulesyncIgnore({
6470
6548
  baseDir: this.baseDir,
6471
- rulesyncIgnore
6549
+ rulesyncIgnore,
6550
+ options: this.featureOptions
6472
6551
  });
6473
6552
  return [toolIgnore];
6474
6553
  }
@@ -6496,7 +6575,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
6496
6575
  };
6497
6576
 
6498
6577
  // src/features/mcp/mcp-processor.ts
6499
- import { z as z26 } from "zod/mini";
6578
+ import { z as z27 } from "zod/mini";
6500
6579
 
6501
6580
  // src/features/mcp/claudecode-mcp.ts
6502
6581
  import { join as join46 } from "path";
@@ -6504,47 +6583,47 @@ import { join as join46 } from "path";
6504
6583
  // src/features/mcp/rulesync-mcp.ts
6505
6584
  import { join as join45 } from "path";
6506
6585
  import { omit } from "es-toolkit/object";
6507
- import { z as z23 } from "zod/mini";
6586
+ import { z as z24 } from "zod/mini";
6508
6587
 
6509
6588
  // src/types/mcp.ts
6510
- import { z as z22 } from "zod/mini";
6511
- var McpServerSchema = z22.looseObject({
6512
- type: z22.optional(z22.enum(["local", "stdio", "sse", "http"])),
6513
- command: z22.optional(z22.union([z22.string(), z22.array(z22.string())])),
6514
- args: z22.optional(z22.array(z22.string())),
6515
- url: z22.optional(z22.string()),
6516
- httpUrl: z22.optional(z22.string()),
6517
- env: z22.optional(z22.record(z22.string(), z22.string())),
6518
- disabled: z22.optional(z22.boolean()),
6519
- networkTimeout: z22.optional(z22.number()),
6520
- timeout: z22.optional(z22.number()),
6521
- trust: z22.optional(z22.boolean()),
6522
- cwd: z22.optional(z22.string()),
6523
- transport: z22.optional(z22.enum(["local", "stdio", "sse", "http"])),
6524
- alwaysAllow: z22.optional(z22.array(z22.string())),
6525
- tools: z22.optional(z22.array(z22.string())),
6526
- kiroAutoApprove: z22.optional(z22.array(z22.string())),
6527
- kiroAutoBlock: z22.optional(z22.array(z22.string())),
6528
- headers: z22.optional(z22.record(z22.string(), z22.string())),
6529
- enabledTools: z22.optional(z22.array(z22.string())),
6530
- disabledTools: z22.optional(z22.array(z22.string()))
6589
+ import { z as z23 } from "zod/mini";
6590
+ var McpServerSchema = z23.looseObject({
6591
+ type: z23.optional(z23.enum(["local", "stdio", "sse", "http"])),
6592
+ command: z23.optional(z23.union([z23.string(), z23.array(z23.string())])),
6593
+ args: z23.optional(z23.array(z23.string())),
6594
+ url: z23.optional(z23.string()),
6595
+ httpUrl: z23.optional(z23.string()),
6596
+ env: z23.optional(z23.record(z23.string(), z23.string())),
6597
+ disabled: z23.optional(z23.boolean()),
6598
+ networkTimeout: z23.optional(z23.number()),
6599
+ timeout: z23.optional(z23.number()),
6600
+ trust: z23.optional(z23.boolean()),
6601
+ cwd: z23.optional(z23.string()),
6602
+ transport: z23.optional(z23.enum(["local", "stdio", "sse", "http"])),
6603
+ alwaysAllow: z23.optional(z23.array(z23.string())),
6604
+ tools: z23.optional(z23.array(z23.string())),
6605
+ kiroAutoApprove: z23.optional(z23.array(z23.string())),
6606
+ kiroAutoBlock: z23.optional(z23.array(z23.string())),
6607
+ headers: z23.optional(z23.record(z23.string(), z23.string())),
6608
+ enabledTools: z23.optional(z23.array(z23.string())),
6609
+ disabledTools: z23.optional(z23.array(z23.string()))
6531
6610
  });
6532
- var McpServersSchema = z22.record(z22.string(), McpServerSchema);
6611
+ var McpServersSchema = z23.record(z23.string(), McpServerSchema);
6533
6612
  function isMcpServers(value) {
6534
6613
  return value !== void 0 && value !== null && typeof value === "object" && !Array.isArray(value);
6535
6614
  }
6536
6615
 
6537
6616
  // src/features/mcp/rulesync-mcp.ts
6538
- var RulesyncMcpServerSchema = z23.extend(McpServerSchema, {
6539
- targets: z23.optional(RulesyncTargetsSchema),
6540
- description: z23.optional(z23.string()),
6541
- exposed: z23.optional(z23.boolean())
6617
+ var RulesyncMcpServerSchema = z24.extend(McpServerSchema, {
6618
+ targets: z24.optional(RulesyncTargetsSchema),
6619
+ description: z24.optional(z24.string()),
6620
+ exposed: z24.optional(z24.boolean())
6542
6621
  });
6543
- var RulesyncMcpConfigSchema = z23.object({
6544
- mcpServers: z23.record(z23.string(), RulesyncMcpServerSchema)
6622
+ var RulesyncMcpConfigSchema = z24.object({
6623
+ mcpServers: z24.record(z24.string(), RulesyncMcpServerSchema)
6545
6624
  });
6546
- var RulesyncMcpFileSchema = z23.looseObject({
6547
- $schema: z23.optional(z23.string()),
6625
+ var RulesyncMcpFileSchema = z24.looseObject({
6626
+ $schema: z24.optional(z24.string()),
6548
6627
  ...RulesyncMcpConfigSchema.shape
6549
6628
  });
6550
6629
  var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
@@ -6751,7 +6830,8 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
6751
6830
  relativeDirPath: paths.relativeDirPath,
6752
6831
  relativeFilePath: paths.relativeFilePath,
6753
6832
  fileContent: JSON.stringify(newJson, null, 2),
6754
- validate
6833
+ validate,
6834
+ global
6755
6835
  });
6756
6836
  }
6757
6837
  static async fromRulesyncMcp({
@@ -6772,7 +6852,8 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
6772
6852
  relativeDirPath: paths.relativeDirPath,
6773
6853
  relativeFilePath: paths.relativeFilePath,
6774
6854
  fileContent: JSON.stringify(mcpJson, null, 2),
6775
- validate
6855
+ validate,
6856
+ global
6776
6857
  });
6777
6858
  }
6778
6859
  toRulesyncMcp() {
@@ -7745,25 +7826,25 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
7745
7826
  // src/features/mcp/kilo-mcp.ts
7746
7827
  import { join as join56 } from "path";
7747
7828
  import { parse as parseJsonc3 } from "jsonc-parser";
7748
- import { z as z24 } from "zod/mini";
7749
- var KiloMcpLocalServerSchema = z24.object({
7750
- type: z24.literal("local"),
7751
- command: z24.array(z24.string()),
7752
- environment: z24.optional(z24.record(z24.string(), z24.string())),
7753
- enabled: z24._default(z24.boolean(), true),
7754
- cwd: z24.optional(z24.string())
7829
+ import { z as z25 } from "zod/mini";
7830
+ var KiloMcpLocalServerSchema = z25.object({
7831
+ type: z25.literal("local"),
7832
+ command: z25.array(z25.string()),
7833
+ environment: z25.optional(z25.record(z25.string(), z25.string())),
7834
+ enabled: z25._default(z25.boolean(), true),
7835
+ cwd: z25.optional(z25.string())
7755
7836
  });
7756
- var KiloMcpRemoteServerSchema = z24.object({
7757
- type: z24.literal("remote"),
7758
- url: z24.string(),
7759
- headers: z24.optional(z24.record(z24.string(), z24.string())),
7760
- enabled: z24._default(z24.boolean(), true)
7837
+ var KiloMcpRemoteServerSchema = z25.object({
7838
+ type: z25.literal("remote"),
7839
+ url: z25.string(),
7840
+ headers: z25.optional(z25.record(z25.string(), z25.string())),
7841
+ enabled: z25._default(z25.boolean(), true)
7761
7842
  });
7762
- var KiloMcpServerSchema = z24.union([KiloMcpLocalServerSchema, KiloMcpRemoteServerSchema]);
7763
- var KiloConfigSchema = z24.looseObject({
7764
- $schema: z24.optional(z24.string()),
7765
- mcp: z24.optional(z24.record(z24.string(), KiloMcpServerSchema)),
7766
- tools: z24.optional(z24.record(z24.string(), z24.boolean()))
7843
+ var KiloMcpServerSchema = z25.union([KiloMcpLocalServerSchema, KiloMcpRemoteServerSchema]);
7844
+ var KiloConfigSchema = z25.looseObject({
7845
+ $schema: z25.optional(z25.string()),
7846
+ mcp: z25.optional(z25.record(z25.string(), KiloMcpServerSchema)),
7847
+ tools: z25.optional(z25.record(z25.string(), z25.boolean()))
7767
7848
  });
7768
7849
  function convertFromKiloFormat(kiloMcp, tools) {
7769
7850
  return Object.fromEntries(
@@ -8060,28 +8141,28 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
8060
8141
  // src/features/mcp/opencode-mcp.ts
8061
8142
  import { join as join58 } from "path";
8062
8143
  import { parse as parseJsonc4 } from "jsonc-parser";
8063
- import { z as z25 } from "zod/mini";
8064
- var OpencodeMcpLocalServerSchema = z25.object({
8065
- type: z25.literal("local"),
8066
- command: z25.array(z25.string()),
8067
- environment: z25.optional(z25.record(z25.string(), z25.string())),
8068
- enabled: z25._default(z25.boolean(), true),
8069
- cwd: z25.optional(z25.string())
8144
+ import { z as z26 } from "zod/mini";
8145
+ var OpencodeMcpLocalServerSchema = z26.object({
8146
+ type: z26.literal("local"),
8147
+ command: z26.array(z26.string()),
8148
+ environment: z26.optional(z26.record(z26.string(), z26.string())),
8149
+ enabled: z26._default(z26.boolean(), true),
8150
+ cwd: z26.optional(z26.string())
8070
8151
  });
8071
- var OpencodeMcpRemoteServerSchema = z25.object({
8072
- type: z25.literal("remote"),
8073
- url: z25.string(),
8074
- headers: z25.optional(z25.record(z25.string(), z25.string())),
8075
- enabled: z25._default(z25.boolean(), true)
8152
+ var OpencodeMcpRemoteServerSchema = z26.object({
8153
+ type: z26.literal("remote"),
8154
+ url: z26.string(),
8155
+ headers: z26.optional(z26.record(z26.string(), z26.string())),
8156
+ enabled: z26._default(z26.boolean(), true)
8076
8157
  });
8077
- var OpencodeMcpServerSchema = z25.union([
8158
+ var OpencodeMcpServerSchema = z26.union([
8078
8159
  OpencodeMcpLocalServerSchema,
8079
8160
  OpencodeMcpRemoteServerSchema
8080
8161
  ]);
8081
- var OpencodeConfigSchema = z25.looseObject({
8082
- $schema: z25.optional(z25.string()),
8083
- mcp: z25.optional(z25.record(z25.string(), OpencodeMcpServerSchema)),
8084
- tools: z25.optional(z25.record(z25.string(), z25.boolean()))
8162
+ var OpencodeConfigSchema = z26.looseObject({
8163
+ $schema: z26.optional(z26.string()),
8164
+ mcp: z26.optional(z26.record(z26.string(), OpencodeMcpServerSchema)),
8165
+ tools: z26.optional(z26.record(z26.string(), z26.boolean()))
8085
8166
  });
8086
8167
  function convertFromOpencodeFormat(opencodeMcp, tools) {
8087
8168
  return Object.fromEntries(
@@ -8552,7 +8633,7 @@ var mcpProcessorToolTargetTuple = [
8552
8633
  "roo",
8553
8634
  "rovodev"
8554
8635
  ];
8555
- var McpProcessorToolTargetSchema = z26.enum(mcpProcessorToolTargetTuple);
8636
+ var McpProcessorToolTargetSchema = z27.enum(mcpProcessorToolTargetTuple);
8556
8637
  var toolMcpFactories = /* @__PURE__ */ new Map([
8557
8638
  [
8558
8639
  "claudecode",
@@ -8890,113 +8971,1088 @@ var McpProcessor = class extends FeatureProcessor {
8890
8971
  }
8891
8972
  };
8892
8973
 
8893
- // src/features/rules/rules-processor.ts
8894
- import { basename as basename10, dirname as dirname3, join as join130, relative as relative5 } from "path";
8895
- import { encode } from "@toon-format/toon";
8896
- import { z as z65 } from "zod/mini";
8897
-
8898
- // src/constants/general.ts
8899
- var SKILL_FILE_NAME = "SKILL.md";
8974
+ // src/features/permissions/permissions-processor.ts
8975
+ import { z as z31 } from "zod/mini";
8900
8976
 
8901
- // src/features/skills/agentsmd-skill.ts
8902
- import { join as join64 } from "path";
8977
+ // src/features/permissions/claudecode-permissions.ts
8978
+ import { join as join62 } from "path";
8979
+ import { uniq as uniq3 } from "es-toolkit";
8903
8980
 
8904
- // src/features/skills/simulated-skill.ts
8905
- import { join as join63 } from "path";
8906
- import { z as z27 } from "zod/mini";
8981
+ // src/features/permissions/rulesync-permissions.ts
8982
+ import { join as join61 } from "path";
8907
8983
 
8908
- // src/features/skills/tool-skill.ts
8909
- import { join as join62 } from "path";
8984
+ // src/types/permissions.ts
8985
+ import { z as z28 } from "zod/mini";
8986
+ var PermissionActionSchema = z28.enum(["allow", "ask", "deny"]);
8987
+ var PermissionRulesSchema = z28.record(z28.string(), PermissionActionSchema);
8988
+ var PermissionsConfigSchema = z28.looseObject({
8989
+ permission: z28.record(z28.string(), PermissionRulesSchema)
8990
+ });
8991
+ var RulesyncPermissionsFileSchema = z28.looseObject({
8992
+ $schema: z28.optional(z28.string()),
8993
+ ...PermissionsConfigSchema.shape
8994
+ });
8910
8995
 
8911
- // src/types/ai-dir.ts
8912
- import path2, { basename as basename3, join as join61, relative as relative4, resolve as resolve4 } from "path";
8913
- var AiDir = class {
8914
- /**
8915
- * @example "."
8916
- */
8917
- baseDir;
8918
- /**
8919
- * @example ".rulesync/skills"
8920
- */
8921
- relativeDirPath;
8922
- /**
8923
- * @example "my-skill"
8924
- */
8925
- dirName;
8926
- /**
8927
- * Optional main file with frontmatter support
8928
- */
8929
- mainFile;
8930
- /**
8931
- * Additional files in the directory
8932
- */
8933
- otherFiles;
8934
- /**
8935
- * @example false
8936
- */
8937
- global;
8938
- constructor({
8996
+ // src/features/permissions/rulesync-permissions.ts
8997
+ var RulesyncPermissions = class _RulesyncPermissions extends RulesyncFile {
8998
+ json;
8999
+ constructor(params) {
9000
+ super({ ...params });
9001
+ this.json = JSON.parse(this.fileContent);
9002
+ if (params.validate) {
9003
+ const result = this.validate();
9004
+ if (!result.success) {
9005
+ throw result.error;
9006
+ }
9007
+ }
9008
+ }
9009
+ static getSettablePaths() {
9010
+ return {
9011
+ relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
9012
+ relativeFilePath: RULESYNC_PERMISSIONS_FILE_NAME
9013
+ };
9014
+ }
9015
+ validate() {
9016
+ const result = RulesyncPermissionsFileSchema.safeParse(this.json);
9017
+ if (!result.success) {
9018
+ return { success: false, error: result.error };
9019
+ }
9020
+ return { success: true, error: null };
9021
+ }
9022
+ static async fromFile({
8939
9023
  baseDir = process.cwd(),
8940
- relativeDirPath,
8941
- dirName,
8942
- mainFile,
8943
- otherFiles = [],
8944
- global = false
9024
+ validate = true
8945
9025
  }) {
8946
- if (dirName.includes(path2.sep) || dirName.includes("/") || dirName.includes("\\")) {
8947
- throw new Error(`Directory name cannot contain path separators: dirName="${dirName}"`);
9026
+ const paths = _RulesyncPermissions.getSettablePaths();
9027
+ const filePath = join61(baseDir, paths.relativeDirPath, paths.relativeFilePath);
9028
+ if (!await fileExists(filePath)) {
9029
+ throw new Error(`No ${RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH} found.`);
8948
9030
  }
8949
- this.baseDir = baseDir;
8950
- this.relativeDirPath = relativeDirPath;
8951
- this.dirName = dirName;
8952
- this.mainFile = mainFile;
8953
- this.otherFiles = otherFiles;
8954
- this.global = global;
9031
+ const fileContent = await readFileContent(filePath);
9032
+ return new _RulesyncPermissions({
9033
+ baseDir,
9034
+ relativeDirPath: paths.relativeDirPath,
9035
+ relativeFilePath: paths.relativeFilePath,
9036
+ fileContent,
9037
+ validate
9038
+ });
8955
9039
  }
8956
- static async fromDir(_params) {
9040
+ getJson() {
9041
+ return this.json;
9042
+ }
9043
+ };
9044
+
9045
+ // src/features/permissions/tool-permissions.ts
9046
+ var ToolPermissions = class extends ToolFile {
9047
+ static getSettablePaths(_options) {
8957
9048
  throw new Error("Please implement this method in the subclass.");
8958
9049
  }
8959
- getBaseDir() {
8960
- return this.baseDir;
9050
+ validate() {
9051
+ return { success: true, error: null };
8961
9052
  }
8962
- getRelativeDirPath() {
8963
- return this.relativeDirPath;
9053
+ static fromRulesyncPermissions(_params) {
9054
+ throw new Error("Please implement this method in the subclass.");
8964
9055
  }
8965
- getDirName() {
8966
- return this.dirName;
9056
+ toRulesyncPermissionsDefault({
9057
+ fileContent
9058
+ }) {
9059
+ return new RulesyncPermissions({
9060
+ baseDir: this.baseDir,
9061
+ relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
9062
+ relativeFilePath: RULESYNC_PERMISSIONS_FILE_NAME,
9063
+ fileContent
9064
+ });
8967
9065
  }
8968
- getDirPath() {
8969
- const fullPath = path2.join(this.baseDir, this.relativeDirPath, this.dirName);
8970
- const resolvedFull = resolve4(fullPath);
8971
- const resolvedBase = resolve4(this.baseDir);
8972
- const rel = relative4(resolvedBase, resolvedFull);
8973
- if (rel.startsWith("..") || path2.isAbsolute(rel)) {
8974
- throw new Error(
8975
- `Path traversal detected: Final path escapes baseDir. baseDir="${this.baseDir}", relativeDirPath="${this.relativeDirPath}", dirName="${this.dirName}"`
8976
- );
8977
- }
8978
- return fullPath;
9066
+ static async fromFile(_params) {
9067
+ throw new Error("Please implement this method in the subclass.");
8979
9068
  }
8980
- getMainFile() {
8981
- return this.mainFile;
9069
+ static forDeletion(_params) {
9070
+ throw new Error("Please implement this method in the subclass.");
8982
9071
  }
8983
- getOtherFiles() {
8984
- return this.otherFiles;
9072
+ };
9073
+
9074
+ // src/features/permissions/claudecode-permissions.ts
9075
+ var CANONICAL_TO_CLAUDE_TOOL_NAMES = {
9076
+ bash: "Bash",
9077
+ read: "Read",
9078
+ edit: "Edit",
9079
+ write: "Write",
9080
+ webfetch: "WebFetch",
9081
+ websearch: "WebSearch",
9082
+ grep: "Grep",
9083
+ glob: "Glob",
9084
+ notebookedit: "NotebookEdit",
9085
+ agent: "Agent"
9086
+ };
9087
+ var CLAUDE_TO_CANONICAL_TOOL_NAMES = Object.fromEntries(
9088
+ Object.entries(CANONICAL_TO_CLAUDE_TOOL_NAMES).map(([k, v]) => [v, k])
9089
+ );
9090
+ function toClaudeToolName(canonical) {
9091
+ return CANONICAL_TO_CLAUDE_TOOL_NAMES[canonical] ?? canonical;
9092
+ }
9093
+ function toCanonicalToolName(claudeName) {
9094
+ return CLAUDE_TO_CANONICAL_TOOL_NAMES[claudeName] ?? claudeName;
9095
+ }
9096
+ function parseClaudePermissionEntry(entry) {
9097
+ const parenIndex = entry.indexOf("(");
9098
+ if (parenIndex === -1) {
9099
+ return { toolName: entry, pattern: "*" };
8985
9100
  }
8986
- /**
8987
- * Returns the relative path from CWD with POSIX separators for consistent cross-platform output.
8988
- */
8989
- getRelativePathFromCwd() {
8990
- return toPosixPath(path2.join(this.relativeDirPath, this.dirName));
9101
+ const toolName = entry.slice(0, parenIndex);
9102
+ if (!entry.endsWith(")")) {
9103
+ return { toolName, pattern: "*" };
8991
9104
  }
8992
- getGlobal() {
8993
- return this.global;
9105
+ const pattern = entry.slice(parenIndex + 1, -1);
9106
+ return { toolName, pattern: pattern || "*" };
9107
+ }
9108
+ function buildClaudePermissionEntry(toolName, pattern) {
9109
+ if (pattern === "*") {
9110
+ return toolName;
8994
9111
  }
8995
- setMainFile(name, body, frontmatter) {
8996
- this.mainFile = { name, body, frontmatter };
9112
+ return `${toolName}(${pattern})`;
9113
+ }
9114
+ var ClaudecodePermissions = class _ClaudecodePermissions extends ToolPermissions {
9115
+ constructor(params) {
9116
+ super({
9117
+ ...params,
9118
+ fileContent: params.fileContent ?? "{}"
9119
+ });
8997
9120
  }
8998
- /**
8999
- * Recursively collects all files from a directory, excluding the specified main file.
9121
+ isDeletable() {
9122
+ return false;
9123
+ }
9124
+ static getSettablePaths() {
9125
+ return {
9126
+ relativeDirPath: ".claude",
9127
+ relativeFilePath: "settings.json"
9128
+ };
9129
+ }
9130
+ static async fromFile({
9131
+ baseDir = process.cwd(),
9132
+ validate = true
9133
+ }) {
9134
+ const paths = _ClaudecodePermissions.getSettablePaths();
9135
+ const filePath = join62(baseDir, paths.relativeDirPath, paths.relativeFilePath);
9136
+ const fileContent = await readFileContentOrNull(filePath) ?? '{"permissions":{}}';
9137
+ return new _ClaudecodePermissions({
9138
+ baseDir,
9139
+ relativeDirPath: paths.relativeDirPath,
9140
+ relativeFilePath: paths.relativeFilePath,
9141
+ fileContent,
9142
+ validate
9143
+ });
9144
+ }
9145
+ static async fromRulesyncPermissions({
9146
+ baseDir = process.cwd(),
9147
+ rulesyncPermissions,
9148
+ logger
9149
+ }) {
9150
+ const paths = _ClaudecodePermissions.getSettablePaths();
9151
+ const filePath = join62(baseDir, paths.relativeDirPath, paths.relativeFilePath);
9152
+ const existingContent = await readOrInitializeFileContent(
9153
+ filePath,
9154
+ JSON.stringify({}, null, 2)
9155
+ );
9156
+ let settings;
9157
+ try {
9158
+ settings = JSON.parse(existingContent);
9159
+ } catch (error) {
9160
+ throw new Error(
9161
+ `Failed to parse existing Claude settings at ${filePath}: ${formatError(error)}`,
9162
+ { cause: error }
9163
+ );
9164
+ }
9165
+ const config = rulesyncPermissions.getJson();
9166
+ const { allow, ask, deny } = convertRulesyncToClaudePermissions(config);
9167
+ const managedToolNames = new Set(
9168
+ Object.keys(config.permission).map((category) => toClaudeToolName(category))
9169
+ );
9170
+ const existingPermissions = settings.permissions ?? {};
9171
+ const preservedAllow = (existingPermissions.allow ?? []).filter(
9172
+ (entry) => !managedToolNames.has(parseClaudePermissionEntry(entry).toolName)
9173
+ );
9174
+ const preservedAsk = (existingPermissions.ask ?? []).filter(
9175
+ (entry) => !managedToolNames.has(parseClaudePermissionEntry(entry).toolName)
9176
+ );
9177
+ const preservedDeny = (existingPermissions.deny ?? []).filter(
9178
+ (entry) => !managedToolNames.has(parseClaudePermissionEntry(entry).toolName)
9179
+ );
9180
+ if (logger && managedToolNames.has("Read")) {
9181
+ const droppedReadDenyEntries = (existingPermissions.deny ?? []).filter((entry) => {
9182
+ const { toolName } = parseClaudePermissionEntry(entry);
9183
+ return toolName === "Read";
9184
+ });
9185
+ if (droppedReadDenyEntries.length > 0) {
9186
+ logger.warn(
9187
+ `Permissions feature manages 'Read' tool and will overwrite ${droppedReadDenyEntries.length} existing Read deny entries (possibly from ignore feature). Permissions take precedence.`
9188
+ );
9189
+ }
9190
+ }
9191
+ const mergedPermissions = {
9192
+ ...existingPermissions
9193
+ };
9194
+ const mergedAllow = uniq3([...preservedAllow, ...allow].toSorted());
9195
+ const mergedAsk = uniq3([...preservedAsk, ...ask].toSorted());
9196
+ const mergedDeny = uniq3([...preservedDeny, ...deny].toSorted());
9197
+ if (mergedAllow.length > 0) {
9198
+ mergedPermissions.allow = mergedAllow;
9199
+ } else {
9200
+ delete mergedPermissions.allow;
9201
+ }
9202
+ if (mergedAsk.length > 0) {
9203
+ mergedPermissions.ask = mergedAsk;
9204
+ } else {
9205
+ delete mergedPermissions.ask;
9206
+ }
9207
+ if (mergedDeny.length > 0) {
9208
+ mergedPermissions.deny = mergedDeny;
9209
+ } else {
9210
+ delete mergedPermissions.deny;
9211
+ }
9212
+ const merged = { ...settings, permissions: mergedPermissions };
9213
+ const fileContent = JSON.stringify(merged, null, 2);
9214
+ return new _ClaudecodePermissions({
9215
+ baseDir,
9216
+ relativeDirPath: paths.relativeDirPath,
9217
+ relativeFilePath: paths.relativeFilePath,
9218
+ fileContent,
9219
+ validate: true
9220
+ });
9221
+ }
9222
+ toRulesyncPermissions() {
9223
+ let settings;
9224
+ try {
9225
+ settings = JSON.parse(this.getFileContent());
9226
+ } catch (error) {
9227
+ throw new Error(
9228
+ `Failed to parse Claude permissions content in ${join62(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
9229
+ { cause: error }
9230
+ );
9231
+ }
9232
+ const permissions = settings.permissions ?? {};
9233
+ const config = convertClaudeToRulesyncPermissions({
9234
+ allow: permissions.allow ?? [],
9235
+ ask: permissions.ask ?? [],
9236
+ deny: permissions.deny ?? []
9237
+ });
9238
+ return this.toRulesyncPermissionsDefault({
9239
+ fileContent: JSON.stringify(config, null, 2)
9240
+ });
9241
+ }
9242
+ validate() {
9243
+ return { success: true, error: null };
9244
+ }
9245
+ static forDeletion({
9246
+ baseDir = process.cwd(),
9247
+ relativeDirPath,
9248
+ relativeFilePath
9249
+ }) {
9250
+ return new _ClaudecodePermissions({
9251
+ baseDir,
9252
+ relativeDirPath,
9253
+ relativeFilePath,
9254
+ fileContent: JSON.stringify({ permissions: {} }, null, 2),
9255
+ validate: false
9256
+ });
9257
+ }
9258
+ };
9259
+ function convertRulesyncToClaudePermissions(config) {
9260
+ const allow = [];
9261
+ const ask = [];
9262
+ const deny = [];
9263
+ for (const [category, rules] of Object.entries(config.permission)) {
9264
+ const claudeToolName = toClaudeToolName(category);
9265
+ for (const [pattern, action] of Object.entries(rules)) {
9266
+ const entry = buildClaudePermissionEntry(claudeToolName, pattern);
9267
+ switch (action) {
9268
+ case "allow":
9269
+ allow.push(entry);
9270
+ break;
9271
+ case "ask":
9272
+ ask.push(entry);
9273
+ break;
9274
+ case "deny":
9275
+ deny.push(entry);
9276
+ break;
9277
+ }
9278
+ }
9279
+ }
9280
+ return { allow, ask, deny };
9281
+ }
9282
+ function convertClaudeToRulesyncPermissions(params) {
9283
+ const permission = {};
9284
+ const processEntries = (entries, action) => {
9285
+ for (const entry of entries) {
9286
+ const { toolName, pattern } = parseClaudePermissionEntry(entry);
9287
+ const canonical = toCanonicalToolName(toolName);
9288
+ if (!permission[canonical]) {
9289
+ permission[canonical] = {};
9290
+ }
9291
+ permission[canonical][pattern] = action;
9292
+ }
9293
+ };
9294
+ processEntries(params.allow, "allow");
9295
+ processEntries(params.ask, "ask");
9296
+ processEntries(params.deny, "deny");
9297
+ return { permission };
9298
+ }
9299
+
9300
+ // src/features/permissions/codexcli-permissions.ts
9301
+ import { join as join63 } from "path";
9302
+ import * as smolToml4 from "smol-toml";
9303
+ var RULESYNC_PROFILE_NAME = "rulesync";
9304
+ var CodexcliPermissions = class _CodexcliPermissions extends ToolPermissions {
9305
+ static getSettablePaths(_options = {}) {
9306
+ return {
9307
+ relativeDirPath: ".codex",
9308
+ relativeFilePath: "config.toml"
9309
+ };
9310
+ }
9311
+ isDeletable() {
9312
+ return false;
9313
+ }
9314
+ static async fromFile({
9315
+ baseDir = process.cwd(),
9316
+ validate = true,
9317
+ global = false
9318
+ }) {
9319
+ const paths = this.getSettablePaths({ global });
9320
+ const filePath = join63(baseDir, paths.relativeDirPath, paths.relativeFilePath);
9321
+ const fileContent = await readFileContentOrNull(filePath) ?? smolToml4.stringify({});
9322
+ return new _CodexcliPermissions({
9323
+ baseDir,
9324
+ relativeDirPath: paths.relativeDirPath,
9325
+ relativeFilePath: paths.relativeFilePath,
9326
+ fileContent,
9327
+ validate
9328
+ });
9329
+ }
9330
+ static async fromRulesyncPermissions({
9331
+ baseDir = process.cwd(),
9332
+ rulesyncPermissions,
9333
+ validate = true,
9334
+ logger,
9335
+ global = false
9336
+ }) {
9337
+ const paths = this.getSettablePaths({ global });
9338
+ const filePath = join63(baseDir, paths.relativeDirPath, paths.relativeFilePath);
9339
+ const existingContent = await readFileContentOrNull(filePath) ?? smolToml4.stringify({});
9340
+ const parsed = toMutableTable(smolToml4.parse(existingContent));
9341
+ const profile = convertRulesyncToCodexProfile({
9342
+ config: rulesyncPermissions.getJson(),
9343
+ logger
9344
+ });
9345
+ const permissionsTable = toMutableTable(parsed.permissions);
9346
+ permissionsTable[RULESYNC_PROFILE_NAME] = profile;
9347
+ parsed.permissions = permissionsTable;
9348
+ parsed.default_permissions = RULESYNC_PROFILE_NAME;
9349
+ return new _CodexcliPermissions({
9350
+ baseDir,
9351
+ relativeDirPath: paths.relativeDirPath,
9352
+ relativeFilePath: paths.relativeFilePath,
9353
+ fileContent: smolToml4.stringify(parsed),
9354
+ validate
9355
+ });
9356
+ }
9357
+ toRulesyncPermissions() {
9358
+ let parsed;
9359
+ try {
9360
+ parsed = smolToml4.parse(this.getFileContent());
9361
+ } catch (error) {
9362
+ throw new Error(
9363
+ `Failed to parse Codex CLI permissions content in ${join63(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
9364
+ { cause: error }
9365
+ );
9366
+ }
9367
+ const table = toMutableTable(parsed);
9368
+ const defaultProfile = typeof table.default_permissions === "string" ? table.default_permissions : void 0;
9369
+ const permissionsTable = toMutableTable(table.permissions);
9370
+ const profile = toCodexProfile(permissionsTable[defaultProfile ?? RULESYNC_PROFILE_NAME]) ?? toCodexProfile(permissionsTable[RULESYNC_PROFILE_NAME]);
9371
+ const config = convertCodexProfileToRulesync(profile);
9372
+ return this.toRulesyncPermissionsDefault({
9373
+ fileContent: JSON.stringify(config, null, 2)
9374
+ });
9375
+ }
9376
+ validate() {
9377
+ return { success: true, error: null };
9378
+ }
9379
+ static forDeletion({
9380
+ baseDir = process.cwd(),
9381
+ relativeDirPath,
9382
+ relativeFilePath
9383
+ }) {
9384
+ return new _CodexcliPermissions({
9385
+ baseDir,
9386
+ relativeDirPath,
9387
+ relativeFilePath,
9388
+ fileContent: smolToml4.stringify({}),
9389
+ validate: false
9390
+ });
9391
+ }
9392
+ };
9393
+ function convertRulesyncToCodexProfile({
9394
+ config,
9395
+ logger
9396
+ }) {
9397
+ const filesystem = {};
9398
+ const domains = {};
9399
+ for (const [toolName, rules] of Object.entries(config.permission)) {
9400
+ if (toolName === "read") {
9401
+ for (const [pattern, action] of Object.entries(rules)) {
9402
+ filesystem[pattern] = mapReadAction(action);
9403
+ }
9404
+ continue;
9405
+ }
9406
+ if (toolName === "edit" || toolName === "write") {
9407
+ for (const [pattern, action] of Object.entries(rules)) {
9408
+ filesystem[pattern] = mapWriteAction(action);
9409
+ }
9410
+ continue;
9411
+ }
9412
+ if (toolName === "webfetch") {
9413
+ for (const [pattern, action] of Object.entries(rules)) {
9414
+ if (action === "ask") {
9415
+ logger?.warn(
9416
+ `Codex CLI does not support "ask" for network domain permissions. Skipping webfetch rule: ${pattern}`
9417
+ );
9418
+ continue;
9419
+ }
9420
+ domains[pattern] = action;
9421
+ }
9422
+ continue;
9423
+ }
9424
+ logger?.warn(
9425
+ `Codex CLI permissions support only read/edit/write/webfetch categories. Skipping: ${toolName}`
9426
+ );
9427
+ }
9428
+ return {
9429
+ ...Object.keys(filesystem).length > 0 ? { filesystem } : {},
9430
+ ...Object.keys(domains).length > 0 ? { network: { domains } } : {}
9431
+ };
9432
+ }
9433
+ function convertCodexProfileToRulesync(profile) {
9434
+ const permission = {};
9435
+ if (profile?.filesystem) {
9436
+ permission.read = {};
9437
+ permission.edit = {};
9438
+ for (const [pattern, access] of Object.entries(profile.filesystem)) {
9439
+ if (access === "none") {
9440
+ permission.read[pattern] = "deny";
9441
+ permission.edit[pattern] = "deny";
9442
+ } else if (access === "read") {
9443
+ permission.read[pattern] = "allow";
9444
+ } else {
9445
+ permission.edit[pattern] = "allow";
9446
+ }
9447
+ }
9448
+ }
9449
+ if (profile?.network?.domains) {
9450
+ permission.webfetch = {};
9451
+ for (const [domain, value] of Object.entries(profile.network.domains)) {
9452
+ permission.webfetch[domain] = value;
9453
+ }
9454
+ }
9455
+ return { permission };
9456
+ }
9457
+ function toCodexProfile(value) {
9458
+ if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
9459
+ const table = toMutableTable(value);
9460
+ const filesystem = toFilesystemRecord(table.filesystem);
9461
+ const networkRaw = toMutableTable(table.network);
9462
+ const domains = toDomainRecord(networkRaw.domains);
9463
+ return {
9464
+ ...filesystem ? { filesystem } : {},
9465
+ ...domains ? { network: { domains } } : {}
9466
+ };
9467
+ }
9468
+ function toMutableTable(value) {
9469
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
9470
+ return {};
9471
+ }
9472
+ return { ...value };
9473
+ }
9474
+ function toFilesystemRecord(value) {
9475
+ if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
9476
+ const result = {};
9477
+ for (const [key, raw] of Object.entries(value)) {
9478
+ if (typeof raw !== "string") continue;
9479
+ if (raw === "read" || raw === "write" || raw === "none") {
9480
+ result[key] = raw;
9481
+ }
9482
+ }
9483
+ return Object.keys(result).length > 0 ? result : void 0;
9484
+ }
9485
+ function toDomainRecord(value) {
9486
+ if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
9487
+ const result = {};
9488
+ for (const [key, raw] of Object.entries(value)) {
9489
+ if (raw === "allow" || raw === "deny") {
9490
+ result[key] = raw;
9491
+ }
9492
+ }
9493
+ return Object.keys(result).length > 0 ? result : void 0;
9494
+ }
9495
+ function mapReadAction(action) {
9496
+ return action === "allow" ? "read" : "none";
9497
+ }
9498
+ function mapWriteAction(action) {
9499
+ return action === "allow" ? "write" : "none";
9500
+ }
9501
+
9502
+ // src/features/permissions/geminicli-permissions.ts
9503
+ import { join as join64 } from "path";
9504
+ import { z as z29 } from "zod/mini";
9505
+ var GeminiCliSettingsSchema = z29.looseObject({
9506
+ tools: z29.optional(
9507
+ z29.looseObject({
9508
+ allowed: z29.optional(z29.array(z29.string())),
9509
+ exclude: z29.optional(z29.array(z29.string()))
9510
+ })
9511
+ )
9512
+ });
9513
+ var RULESYNC_TO_GEMINICLI_TOOL_NAME = {
9514
+ bash: "run_shell_command",
9515
+ read: "read_file",
9516
+ edit: "replace",
9517
+ write: "write_file",
9518
+ webfetch: "web_fetch"
9519
+ };
9520
+ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
9521
+ static getSettablePaths(_options = {}) {
9522
+ return {
9523
+ relativeDirPath: ".gemini",
9524
+ relativeFilePath: "settings.json"
9525
+ };
9526
+ }
9527
+ isDeletable() {
9528
+ return false;
9529
+ }
9530
+ static async fromFile({
9531
+ baseDir = process.cwd(),
9532
+ validate = true,
9533
+ global = false
9534
+ }) {
9535
+ const paths = this.getSettablePaths({ global });
9536
+ const filePath = join64(baseDir, paths.relativeDirPath, paths.relativeFilePath);
9537
+ const fileContent = await readFileContentOrNull(filePath) ?? JSON.stringify({}, null, 2);
9538
+ return new _GeminicliPermissions({
9539
+ baseDir,
9540
+ relativeDirPath: paths.relativeDirPath,
9541
+ relativeFilePath: paths.relativeFilePath,
9542
+ fileContent,
9543
+ validate
9544
+ });
9545
+ }
9546
+ static async fromRulesyncPermissions({
9547
+ baseDir = process.cwd(),
9548
+ rulesyncPermissions,
9549
+ validate = true,
9550
+ logger,
9551
+ global = false
9552
+ }) {
9553
+ const paths = this.getSettablePaths({ global });
9554
+ const filePath = join64(baseDir, paths.relativeDirPath, paths.relativeFilePath);
9555
+ const existingContent = await readFileContentOrNull(filePath) ?? JSON.stringify({}, null, 2);
9556
+ const settingsResult = GeminiCliSettingsSchema.safeParse(JSON.parse(existingContent));
9557
+ if (!settingsResult.success) {
9558
+ throw new Error(
9559
+ `Failed to parse existing Gemini CLI settings at ${filePath}: ${formatError(settingsResult.error)}`
9560
+ );
9561
+ }
9562
+ const { allowed, exclude } = convertRulesyncToGeminicliTools({
9563
+ config: rulesyncPermissions.getJson(),
9564
+ logger
9565
+ });
9566
+ const merged = {
9567
+ ...settingsResult.data,
9568
+ tools: {
9569
+ ...settingsResult.data.tools,
9570
+ ...allowed.length > 0 ? { allowed } : {},
9571
+ ...exclude.length > 0 ? { exclude } : {}
9572
+ }
9573
+ };
9574
+ return new _GeminicliPermissions({
9575
+ baseDir,
9576
+ relativeDirPath: paths.relativeDirPath,
9577
+ relativeFilePath: paths.relativeFilePath,
9578
+ fileContent: JSON.stringify(merged, null, 2),
9579
+ validate
9580
+ });
9581
+ }
9582
+ toRulesyncPermissions() {
9583
+ let settings;
9584
+ try {
9585
+ const parsed = JSON.parse(this.getFileContent());
9586
+ settings = GeminiCliSettingsSchema.parse(parsed);
9587
+ } catch (error) {
9588
+ throw new Error(
9589
+ `Failed to parse Gemini CLI permissions content in ${join64(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
9590
+ { cause: error }
9591
+ );
9592
+ }
9593
+ const permission = {};
9594
+ for (const toolEntry of settings.tools?.allowed ?? []) {
9595
+ const mapped = parseGeminicliToolEntry({ entry: toolEntry });
9596
+ const rules = permission[mapped.category] ??= {};
9597
+ rules[mapped.pattern] = "allow";
9598
+ }
9599
+ for (const toolEntry of settings.tools?.exclude ?? []) {
9600
+ const mapped = parseGeminicliToolEntry({ entry: toolEntry });
9601
+ const rules = permission[mapped.category] ??= {};
9602
+ rules[mapped.pattern] = "deny";
9603
+ }
9604
+ return this.toRulesyncPermissionsDefault({
9605
+ fileContent: JSON.stringify({ permission }, null, 2)
9606
+ });
9607
+ }
9608
+ validate() {
9609
+ return { success: true, error: null };
9610
+ }
9611
+ static forDeletion({
9612
+ baseDir = process.cwd(),
9613
+ relativeDirPath,
9614
+ relativeFilePath
9615
+ }) {
9616
+ return new _GeminicliPermissions({
9617
+ baseDir,
9618
+ relativeDirPath,
9619
+ relativeFilePath,
9620
+ fileContent: JSON.stringify({}, null, 2),
9621
+ validate: false
9622
+ });
9623
+ }
9624
+ };
9625
+ function convertRulesyncToGeminicliTools({
9626
+ config,
9627
+ logger
9628
+ }) {
9629
+ const allowed = [];
9630
+ const exclude = [];
9631
+ for (const [toolName, rules] of Object.entries(config.permission)) {
9632
+ const mappedToolName = RULESYNC_TO_GEMINICLI_TOOL_NAME[toolName] ?? toolName;
9633
+ if (!RULESYNC_TO_GEMINICLI_TOOL_NAME[toolName]) {
9634
+ logger?.warn(`Gemini CLI permissions use direct tool names. Mapping as-is: ${toolName}`);
9635
+ }
9636
+ for (const [pattern, action] of Object.entries(rules)) {
9637
+ if (action === "ask") {
9638
+ logger?.warn(
9639
+ `Gemini CLI does not support explicit "ask" rules in settings. Skipping ${toolName}:${pattern}`
9640
+ );
9641
+ continue;
9642
+ }
9643
+ const geminiEntry = pattern === "*" ? mappedToolName : `${mappedToolName}(${pattern})`;
9644
+ if (action === "allow") {
9645
+ allowed.push(geminiEntry);
9646
+ } else {
9647
+ exclude.push(geminiEntry);
9648
+ }
9649
+ }
9650
+ }
9651
+ return { allowed, exclude };
9652
+ }
9653
+ function parseGeminicliToolEntry({ entry }) {
9654
+ const match = /^([^()]+?)(?:\((.*)\))?$/.exec(entry);
9655
+ if (!match) return { category: entry, pattern: "*" };
9656
+ const rawToolName = match[1]?.trim() ?? entry;
9657
+ const mappedCategory = Object.entries(RULESYNC_TO_GEMINICLI_TOOL_NAME).find(
9658
+ ([, value]) => value === rawToolName
9659
+ )?.[0];
9660
+ return {
9661
+ category: mappedCategory ?? rawToolName,
9662
+ pattern: (match[2] ?? "*").trim()
9663
+ };
9664
+ }
9665
+
9666
+ // src/features/permissions/opencode-permissions.ts
9667
+ import { join as join65 } from "path";
9668
+ import { parse as parseJsonc5 } from "jsonc-parser";
9669
+ import { z as z30 } from "zod/mini";
9670
+ var OpencodePermissionSchema = z30.union([
9671
+ z30.enum(["allow", "ask", "deny"]),
9672
+ z30.record(z30.string(), z30.enum(["allow", "ask", "deny"]))
9673
+ ]);
9674
+ var OpencodePermissionsConfigSchema = z30.looseObject({
9675
+ permission: z30.optional(z30.record(z30.string(), OpencodePermissionSchema))
9676
+ });
9677
+ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
9678
+ json;
9679
+ constructor(params) {
9680
+ super(params);
9681
+ this.json = OpencodePermissionsConfigSchema.parse(parseJsonc5(this.fileContent || "{}"));
9682
+ }
9683
+ getJson() {
9684
+ return this.json;
9685
+ }
9686
+ isDeletable() {
9687
+ return false;
9688
+ }
9689
+ static getSettablePaths({
9690
+ global = false
9691
+ } = {}) {
9692
+ return global ? { relativeDirPath: join65(".config", "opencode"), relativeFilePath: "opencode.json" } : { relativeDirPath: ".", relativeFilePath: "opencode.json" };
9693
+ }
9694
+ static async fromFile({
9695
+ baseDir = process.cwd(),
9696
+ validate = true,
9697
+ global = false
9698
+ }) {
9699
+ const basePaths = _OpencodePermissions.getSettablePaths({ global });
9700
+ const jsonDir = join65(baseDir, basePaths.relativeDirPath);
9701
+ const jsoncPath = join65(jsonDir, "opencode.jsonc");
9702
+ const jsonPath = join65(jsonDir, "opencode.json");
9703
+ let fileContent = await readFileContentOrNull(jsoncPath);
9704
+ let relativeFilePath = "opencode.jsonc";
9705
+ if (!fileContent) {
9706
+ fileContent = await readFileContentOrNull(jsonPath);
9707
+ if (fileContent) {
9708
+ relativeFilePath = "opencode.json";
9709
+ }
9710
+ }
9711
+ const parsed = parseJsonc5(fileContent ?? "{}");
9712
+ const nextJson = { ...parsed, permission: parsed.permission ?? {} };
9713
+ return new _OpencodePermissions({
9714
+ baseDir,
9715
+ relativeDirPath: basePaths.relativeDirPath,
9716
+ relativeFilePath,
9717
+ fileContent: JSON.stringify(nextJson, null, 2),
9718
+ validate
9719
+ });
9720
+ }
9721
+ static async fromRulesyncPermissions({
9722
+ baseDir = process.cwd(),
9723
+ rulesyncPermissions,
9724
+ global = false
9725
+ }) {
9726
+ const basePaths = _OpencodePermissions.getSettablePaths({ global });
9727
+ const jsonDir = join65(baseDir, basePaths.relativeDirPath);
9728
+ const jsoncPath = join65(jsonDir, "opencode.jsonc");
9729
+ const jsonPath = join65(jsonDir, "opencode.json");
9730
+ let fileContent = await readFileContentOrNull(jsoncPath);
9731
+ let relativeFilePath = "opencode.jsonc";
9732
+ if (!fileContent) {
9733
+ fileContent = await readFileContentOrNull(jsonPath);
9734
+ if (fileContent) {
9735
+ relativeFilePath = "opencode.json";
9736
+ }
9737
+ }
9738
+ const parsed = parseJsonc5(fileContent ?? "{}");
9739
+ const nextJson = {
9740
+ ...parsed,
9741
+ permission: rulesyncPermissions.getJson().permission
9742
+ };
9743
+ return new _OpencodePermissions({
9744
+ baseDir,
9745
+ relativeDirPath: basePaths.relativeDirPath,
9746
+ relativeFilePath,
9747
+ fileContent: JSON.stringify(nextJson, null, 2),
9748
+ validate: true
9749
+ });
9750
+ }
9751
+ toRulesyncPermissions() {
9752
+ const permission = this.normalizePermission(this.json.permission);
9753
+ return this.toRulesyncPermissionsDefault({
9754
+ fileContent: JSON.stringify({ permission }, null, 2)
9755
+ });
9756
+ }
9757
+ validate() {
9758
+ try {
9759
+ const json = JSON.parse(this.fileContent || "{}");
9760
+ const result = OpencodePermissionsConfigSchema.safeParse(json);
9761
+ if (!result.success) {
9762
+ return { success: false, error: result.error };
9763
+ }
9764
+ return { success: true, error: null };
9765
+ } catch (error) {
9766
+ return {
9767
+ success: false,
9768
+ error: new Error(`Failed to parse OpenCode permissions JSON: ${formatError(error)}`)
9769
+ };
9770
+ }
9771
+ }
9772
+ static forDeletion({
9773
+ baseDir = process.cwd(),
9774
+ relativeDirPath,
9775
+ relativeFilePath
9776
+ }) {
9777
+ return new _OpencodePermissions({
9778
+ baseDir,
9779
+ relativeDirPath,
9780
+ relativeFilePath,
9781
+ fileContent: JSON.stringify({ permission: {} }, null, 2),
9782
+ validate: false
9783
+ });
9784
+ }
9785
+ normalizePermission(permission) {
9786
+ if (!permission) {
9787
+ return {};
9788
+ }
9789
+ return Object.fromEntries(
9790
+ Object.entries(permission).map(([tool, value]) => [
9791
+ tool,
9792
+ typeof value === "string" ? { "*": value } : value
9793
+ ])
9794
+ );
9795
+ }
9796
+ };
9797
+
9798
+ // src/features/permissions/permissions-processor.ts
9799
+ var permissionsProcessorToolTargetTuple = [
9800
+ "claudecode",
9801
+ "codexcli",
9802
+ "geminicli",
9803
+ "opencode"
9804
+ ];
9805
+ var PermissionsProcessorToolTargetSchema = z31.enum(permissionsProcessorToolTargetTuple);
9806
+ var toolPermissionsFactories = /* @__PURE__ */ new Map([
9807
+ [
9808
+ "claudecode",
9809
+ {
9810
+ class: ClaudecodePermissions,
9811
+ meta: {
9812
+ supportsProject: true,
9813
+ supportsGlobal: false,
9814
+ supportsImport: true
9815
+ }
9816
+ }
9817
+ ],
9818
+ [
9819
+ "codexcli",
9820
+ {
9821
+ class: CodexcliPermissions,
9822
+ meta: {
9823
+ supportsProject: true,
9824
+ supportsGlobal: true,
9825
+ supportsImport: true
9826
+ }
9827
+ }
9828
+ ],
9829
+ [
9830
+ "geminicli",
9831
+ {
9832
+ class: GeminicliPermissions,
9833
+ meta: {
9834
+ supportsProject: true,
9835
+ supportsGlobal: true,
9836
+ supportsImport: true
9837
+ }
9838
+ }
9839
+ ],
9840
+ [
9841
+ "opencode",
9842
+ {
9843
+ class: OpencodePermissions,
9844
+ meta: {
9845
+ supportsProject: true,
9846
+ supportsGlobal: true,
9847
+ supportsImport: true
9848
+ }
9849
+ }
9850
+ ]
9851
+ ]);
9852
+ var PermissionsProcessor = class extends FeatureProcessor {
9853
+ toolTarget;
9854
+ global;
9855
+ constructor({
9856
+ baseDir = process.cwd(),
9857
+ toolTarget,
9858
+ global = false,
9859
+ dryRun = false,
9860
+ logger
9861
+ }) {
9862
+ super({ baseDir, dryRun, logger });
9863
+ const result = PermissionsProcessorToolTargetSchema.safeParse(toolTarget);
9864
+ if (!result.success) {
9865
+ throw new Error(
9866
+ `Invalid tool target for PermissionsProcessor: ${toolTarget}. ${formatError(result.error)}`
9867
+ );
9868
+ }
9869
+ this.toolTarget = result.data;
9870
+ this.global = global;
9871
+ }
9872
+ async loadRulesyncFiles() {
9873
+ try {
9874
+ return [
9875
+ await RulesyncPermissions.fromFile({
9876
+ baseDir: process.cwd(),
9877
+ validate: true
9878
+ })
9879
+ ];
9880
+ } catch (error) {
9881
+ this.logger.error(
9882
+ `Failed to load Rulesync permissions file (${RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH}): ${formatError(error)}`
9883
+ );
9884
+ return [];
9885
+ }
9886
+ }
9887
+ async loadToolFiles({
9888
+ forDeletion = false
9889
+ } = {}) {
9890
+ try {
9891
+ const factory = toolPermissionsFactories.get(this.toolTarget);
9892
+ if (!factory) throw new Error(`Unsupported tool target: ${this.toolTarget}`);
9893
+ const paths = factory.class.getSettablePaths({ global: this.global });
9894
+ if (forDeletion) {
9895
+ const toolPermissions2 = factory.class.forDeletion({
9896
+ baseDir: this.baseDir,
9897
+ relativeDirPath: paths.relativeDirPath,
9898
+ relativeFilePath: paths.relativeFilePath,
9899
+ global: this.global
9900
+ });
9901
+ const list = toolPermissions2.isDeletable?.() !== false ? [toolPermissions2] : [];
9902
+ return list;
9903
+ }
9904
+ const toolPermissions = await factory.class.fromFile({
9905
+ baseDir: this.baseDir,
9906
+ validate: true,
9907
+ global: this.global
9908
+ });
9909
+ return [toolPermissions];
9910
+ } catch (error) {
9911
+ const msg = `Failed to load permissions files for tool target: ${this.toolTarget}: ${formatError(error)}`;
9912
+ if (error instanceof Error && error.message.includes("no such file or directory")) {
9913
+ this.logger.debug(msg);
9914
+ } else {
9915
+ this.logger.error(msg);
9916
+ }
9917
+ return [];
9918
+ }
9919
+ }
9920
+ async convertRulesyncFilesToToolFiles(rulesyncFiles) {
9921
+ const rulesyncPermissions = rulesyncFiles.find(
9922
+ (f) => f instanceof RulesyncPermissions
9923
+ );
9924
+ if (!rulesyncPermissions) {
9925
+ throw new Error(`No ${RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH} found.`);
9926
+ }
9927
+ const factory = toolPermissionsFactories.get(this.toolTarget);
9928
+ if (!factory) throw new Error(`Unsupported tool target: ${this.toolTarget}`);
9929
+ const toolPermissions = await factory.class.fromRulesyncPermissions({
9930
+ baseDir: this.baseDir,
9931
+ rulesyncPermissions,
9932
+ logger: this.logger,
9933
+ global: this.global
9934
+ });
9935
+ return [toolPermissions];
9936
+ }
9937
+ async convertToolFilesToRulesyncFiles(toolFiles) {
9938
+ const permissions = toolFiles.filter((f) => f instanceof ToolPermissions);
9939
+ return permissions.map((p) => p.toRulesyncPermissions());
9940
+ }
9941
+ static getToolTargets({
9942
+ global = false,
9943
+ importOnly = false
9944
+ } = {}) {
9945
+ return [...toolPermissionsFactories.entries()].filter(([, f]) => global ? f.meta.supportsGlobal : f.meta.supportsProject).filter(([, f]) => importOnly ? f.meta.supportsImport : true).map(([target]) => target);
9946
+ }
9947
+ };
9948
+
9949
+ // src/features/rules/rules-processor.ts
9950
+ import { basename as basename10, dirname as dirname3, join as join135, relative as relative5 } from "path";
9951
+ import { encode } from "@toon-format/toon";
9952
+ import { z as z70 } from "zod/mini";
9953
+
9954
+ // src/constants/general.ts
9955
+ var SKILL_FILE_NAME = "SKILL.md";
9956
+
9957
+ // src/features/skills/agentsmd-skill.ts
9958
+ import { join as join69 } from "path";
9959
+
9960
+ // src/features/skills/simulated-skill.ts
9961
+ import { join as join68 } from "path";
9962
+ import { z as z32 } from "zod/mini";
9963
+
9964
+ // src/features/skills/tool-skill.ts
9965
+ import { join as join67 } from "path";
9966
+
9967
+ // src/types/ai-dir.ts
9968
+ import path2, { basename as basename3, join as join66, relative as relative4, resolve as resolve4 } from "path";
9969
+ var AiDir = class {
9970
+ /**
9971
+ * @example "."
9972
+ */
9973
+ baseDir;
9974
+ /**
9975
+ * @example ".rulesync/skills"
9976
+ */
9977
+ relativeDirPath;
9978
+ /**
9979
+ * @example "my-skill"
9980
+ */
9981
+ dirName;
9982
+ /**
9983
+ * Optional main file with frontmatter support
9984
+ */
9985
+ mainFile;
9986
+ /**
9987
+ * Additional files in the directory
9988
+ */
9989
+ otherFiles;
9990
+ /**
9991
+ * @example false
9992
+ */
9993
+ global;
9994
+ constructor({
9995
+ baseDir = process.cwd(),
9996
+ relativeDirPath,
9997
+ dirName,
9998
+ mainFile,
9999
+ otherFiles = [],
10000
+ global = false
10001
+ }) {
10002
+ if (dirName.includes(path2.sep) || dirName.includes("/") || dirName.includes("\\")) {
10003
+ throw new Error(`Directory name cannot contain path separators: dirName="${dirName}"`);
10004
+ }
10005
+ this.baseDir = baseDir;
10006
+ this.relativeDirPath = relativeDirPath;
10007
+ this.dirName = dirName;
10008
+ this.mainFile = mainFile;
10009
+ this.otherFiles = otherFiles;
10010
+ this.global = global;
10011
+ }
10012
+ static async fromDir(_params) {
10013
+ throw new Error("Please implement this method in the subclass.");
10014
+ }
10015
+ getBaseDir() {
10016
+ return this.baseDir;
10017
+ }
10018
+ getRelativeDirPath() {
10019
+ return this.relativeDirPath;
10020
+ }
10021
+ getDirName() {
10022
+ return this.dirName;
10023
+ }
10024
+ getDirPath() {
10025
+ const fullPath = path2.join(this.baseDir, this.relativeDirPath, this.dirName);
10026
+ const resolvedFull = resolve4(fullPath);
10027
+ const resolvedBase = resolve4(this.baseDir);
10028
+ const rel = relative4(resolvedBase, resolvedFull);
10029
+ if (rel.startsWith("..") || path2.isAbsolute(rel)) {
10030
+ throw new Error(
10031
+ `Path traversal detected: Final path escapes baseDir. baseDir="${this.baseDir}", relativeDirPath="${this.relativeDirPath}", dirName="${this.dirName}"`
10032
+ );
10033
+ }
10034
+ return fullPath;
10035
+ }
10036
+ getMainFile() {
10037
+ return this.mainFile;
10038
+ }
10039
+ getOtherFiles() {
10040
+ return this.otherFiles;
10041
+ }
10042
+ /**
10043
+ * Returns the relative path from CWD with POSIX separators for consistent cross-platform output.
10044
+ */
10045
+ getRelativePathFromCwd() {
10046
+ return toPosixPath(path2.join(this.relativeDirPath, this.dirName));
10047
+ }
10048
+ getGlobal() {
10049
+ return this.global;
10050
+ }
10051
+ setMainFile(name, body, frontmatter) {
10052
+ this.mainFile = { name, body, frontmatter };
10053
+ }
10054
+ /**
10055
+ * Recursively collects all files from a directory, excluding the specified main file.
9000
10056
  * This is a common utility for loading additional files alongside the main file.
9001
10057
  *
9002
10058
  * @param baseDir - The base directory path
@@ -9006,8 +10062,8 @@ var AiDir = class {
9006
10062
  * @returns Array of files with their relative paths and buffers
9007
10063
  */
9008
10064
  static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
9009
- const dirPath = join61(baseDir, relativeDirPath, dirName);
9010
- const glob = join61(dirPath, "**", "*");
10065
+ const dirPath = join66(baseDir, relativeDirPath, dirName);
10066
+ const glob = join66(dirPath, "**", "*");
9011
10067
  const filePaths = await findFilesByGlobs(glob, { type: "file" });
9012
10068
  const filteredPaths = filePaths.filter((filePath) => basename3(filePath) !== excludeFileName);
9013
10069
  const files = await Promise.all(
@@ -9108,8 +10164,8 @@ var ToolSkill = class extends AiDir {
9108
10164
  }) {
9109
10165
  const settablePaths = getSettablePaths({ global });
9110
10166
  const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
9111
- const skillDirPath = join62(baseDir, actualRelativeDirPath, dirName);
9112
- const skillFilePath = join62(skillDirPath, SKILL_FILE_NAME);
10167
+ const skillDirPath = join67(baseDir, actualRelativeDirPath, dirName);
10168
+ const skillFilePath = join67(skillDirPath, SKILL_FILE_NAME);
9113
10169
  if (!await fileExists(skillFilePath)) {
9114
10170
  throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
9115
10171
  }
@@ -9133,16 +10189,16 @@ var ToolSkill = class extends AiDir {
9133
10189
  }
9134
10190
  requireMainFileFrontmatter() {
9135
10191
  if (!this.mainFile?.frontmatter) {
9136
- throw new Error(`Frontmatter is not defined in ${join62(this.relativeDirPath, this.dirName)}`);
10192
+ throw new Error(`Frontmatter is not defined in ${join67(this.relativeDirPath, this.dirName)}`);
9137
10193
  }
9138
10194
  return this.mainFile.frontmatter;
9139
10195
  }
9140
10196
  };
9141
10197
 
9142
10198
  // src/features/skills/simulated-skill.ts
9143
- var SimulatedSkillFrontmatterSchema = z27.looseObject({
9144
- name: z27.string(),
9145
- description: z27.string()
10199
+ var SimulatedSkillFrontmatterSchema = z32.looseObject({
10200
+ name: z32.string(),
10201
+ description: z32.string()
9146
10202
  });
9147
10203
  var SimulatedSkill = class extends ToolSkill {
9148
10204
  frontmatter;
@@ -9173,7 +10229,7 @@ var SimulatedSkill = class extends ToolSkill {
9173
10229
  const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
9174
10230
  if (!result.success) {
9175
10231
  throw new Error(
9176
- `Invalid frontmatter in ${join63(relativeDirPath, dirName)}: ${formatError(result.error)}`
10232
+ `Invalid frontmatter in ${join68(relativeDirPath, dirName)}: ${formatError(result.error)}`
9177
10233
  );
9178
10234
  }
9179
10235
  }
@@ -9232,8 +10288,8 @@ var SimulatedSkill = class extends ToolSkill {
9232
10288
  }) {
9233
10289
  const settablePaths = this.getSettablePaths();
9234
10290
  const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
9235
- const skillDirPath = join63(baseDir, actualRelativeDirPath, dirName);
9236
- const skillFilePath = join63(skillDirPath, SKILL_FILE_NAME);
10291
+ const skillDirPath = join68(baseDir, actualRelativeDirPath, dirName);
10292
+ const skillFilePath = join68(skillDirPath, SKILL_FILE_NAME);
9237
10293
  if (!await fileExists(skillFilePath)) {
9238
10294
  throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
9239
10295
  }
@@ -9310,7 +10366,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
9310
10366
  throw new Error("AgentsmdSkill does not support global mode.");
9311
10367
  }
9312
10368
  return {
9313
- relativeDirPath: join64(".agents", "skills")
10369
+ relativeDirPath: join69(".agents", "skills")
9314
10370
  };
9315
10371
  }
9316
10372
  static async fromDir(params) {
@@ -9337,11 +10393,11 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
9337
10393
  };
9338
10394
 
9339
10395
  // src/features/skills/factorydroid-skill.ts
9340
- import { join as join65 } from "path";
10396
+ import { join as join70 } from "path";
9341
10397
  var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
9342
10398
  static getSettablePaths(_options) {
9343
10399
  return {
9344
- relativeDirPath: join65(".factory", "skills")
10400
+ relativeDirPath: join70(".factory", "skills")
9345
10401
  };
9346
10402
  }
9347
10403
  static async fromDir(params) {
@@ -9368,50 +10424,50 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
9368
10424
  };
9369
10425
 
9370
10426
  // src/features/skills/rovodev-skill.ts
9371
- import { join as join67 } from "path";
9372
- import { z as z29 } from "zod/mini";
10427
+ import { join as join72 } from "path";
10428
+ import { z as z34 } from "zod/mini";
9373
10429
 
9374
10430
  // src/features/skills/rulesync-skill.ts
9375
- import { join as join66 } from "path";
9376
- import { z as z28 } from "zod/mini";
9377
- var RulesyncSkillFrontmatterSchemaInternal = z28.looseObject({
9378
- name: z28.string(),
9379
- description: z28.string(),
9380
- targets: z28._default(RulesyncTargetsSchema, ["*"]),
9381
- claudecode: z28.optional(
9382
- z28.looseObject({
9383
- "allowed-tools": z28.optional(z28.array(z28.string())),
9384
- model: z28.optional(z28.string()),
9385
- "disable-model-invocation": z28.optional(z28.boolean())
10431
+ import { join as join71 } from "path";
10432
+ import { z as z33 } from "zod/mini";
10433
+ var RulesyncSkillFrontmatterSchemaInternal = z33.looseObject({
10434
+ name: z33.string(),
10435
+ description: z33.string(),
10436
+ targets: z33._default(RulesyncTargetsSchema, ["*"]),
10437
+ claudecode: z33.optional(
10438
+ z33.looseObject({
10439
+ "allowed-tools": z33.optional(z33.array(z33.string())),
10440
+ model: z33.optional(z33.string()),
10441
+ "disable-model-invocation": z33.optional(z33.boolean())
9386
10442
  })
9387
10443
  ),
9388
- codexcli: z28.optional(
9389
- z28.looseObject({
9390
- "short-description": z28.optional(z28.string())
10444
+ codexcli: z33.optional(
10445
+ z33.looseObject({
10446
+ "short-description": z33.optional(z33.string())
9391
10447
  })
9392
10448
  ),
9393
- opencode: z28.optional(
9394
- z28.looseObject({
9395
- "allowed-tools": z28.optional(z28.array(z28.string()))
10449
+ opencode: z33.optional(
10450
+ z33.looseObject({
10451
+ "allowed-tools": z33.optional(z33.array(z33.string()))
9396
10452
  })
9397
10453
  ),
9398
- kilo: z28.optional(
9399
- z28.looseObject({
9400
- "allowed-tools": z28.optional(z28.array(z28.string()))
10454
+ kilo: z33.optional(
10455
+ z33.looseObject({
10456
+ "allowed-tools": z33.optional(z33.array(z33.string()))
9401
10457
  })
9402
10458
  ),
9403
- deepagents: z28.optional(
9404
- z28.looseObject({
9405
- "allowed-tools": z28.optional(z28.array(z28.string()))
10459
+ deepagents: z33.optional(
10460
+ z33.looseObject({
10461
+ "allowed-tools": z33.optional(z33.array(z33.string()))
9406
10462
  })
9407
10463
  ),
9408
- copilot: z28.optional(
9409
- z28.looseObject({
9410
- license: z28.optional(z28.string())
10464
+ copilot: z33.optional(
10465
+ z33.looseObject({
10466
+ license: z33.optional(z33.string())
9411
10467
  })
9412
10468
  ),
9413
- cline: z28.optional(z28.looseObject({})),
9414
- roo: z28.optional(z28.looseObject({}))
10469
+ cline: z33.optional(z33.looseObject({})),
10470
+ roo: z33.optional(z33.looseObject({}))
9415
10471
  });
9416
10472
  var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
9417
10473
  var RulesyncSkill = class _RulesyncSkill extends AiDir {
@@ -9451,7 +10507,7 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
9451
10507
  }
9452
10508
  getFrontmatter() {
9453
10509
  if (!this.mainFile?.frontmatter) {
9454
- throw new Error(`Frontmatter is not defined in ${join66(this.relativeDirPath, this.dirName)}`);
10510
+ throw new Error(`Frontmatter is not defined in ${join71(this.relativeDirPath, this.dirName)}`);
9455
10511
  }
9456
10512
  const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
9457
10513
  return result;
@@ -9477,8 +10533,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
9477
10533
  dirName,
9478
10534
  global = false
9479
10535
  }) {
9480
- const skillDirPath = join66(baseDir, relativeDirPath, dirName);
9481
- const skillFilePath = join66(skillDirPath, SKILL_FILE_NAME);
10536
+ const skillDirPath = join71(baseDir, relativeDirPath, dirName);
10537
+ const skillFilePath = join71(skillDirPath, SKILL_FILE_NAME);
9482
10538
  if (!await fileExists(skillFilePath)) {
9483
10539
  throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
9484
10540
  }
@@ -9508,14 +10564,14 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
9508
10564
  };
9509
10565
 
9510
10566
  // src/features/skills/rovodev-skill.ts
9511
- var RovodevSkillFrontmatterSchema = z29.looseObject({
9512
- name: z29.string(),
9513
- description: z29.string()
10567
+ var RovodevSkillFrontmatterSchema = z34.looseObject({
10568
+ name: z34.string(),
10569
+ description: z34.string()
9514
10570
  });
9515
10571
  var RovodevSkill = class _RovodevSkill extends ToolSkill {
9516
10572
  constructor({
9517
10573
  baseDir = process.cwd(),
9518
- relativeDirPath = join67(".rovodev", "skills"),
10574
+ relativeDirPath = join72(".rovodev", "skills"),
9519
10575
  dirName,
9520
10576
  frontmatter,
9521
10577
  body,
@@ -9544,8 +10600,8 @@ var RovodevSkill = class _RovodevSkill extends ToolSkill {
9544
10600
  }
9545
10601
  static getSettablePaths(_options) {
9546
10602
  return {
9547
- relativeDirPath: join67(".rovodev", "skills"),
9548
- alternativeSkillRoots: [join67(".agents", "skills")]
10603
+ relativeDirPath: join72(".rovodev", "skills"),
10604
+ alternativeSkillRoots: [join72(".agents", "skills")]
9549
10605
  };
9550
10606
  }
9551
10607
  getFrontmatter() {
@@ -9633,13 +10689,13 @@ var RovodevSkill = class _RovodevSkill extends ToolSkill {
9633
10689
  });
9634
10690
  const result = RovodevSkillFrontmatterSchema.safeParse(loaded.frontmatter);
9635
10691
  if (!result.success) {
9636
- const skillDirPath = join67(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
10692
+ const skillDirPath = join72(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
9637
10693
  throw new Error(
9638
- `Invalid frontmatter in ${join67(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
10694
+ `Invalid frontmatter in ${join72(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
9639
10695
  );
9640
10696
  }
9641
10697
  if (result.data.name !== loaded.dirName) {
9642
- const skillFilePath = join67(
10698
+ const skillFilePath = join72(
9643
10699
  loaded.baseDir,
9644
10700
  loaded.relativeDirPath,
9645
10701
  loaded.dirName,
@@ -9681,11 +10737,11 @@ var RovodevSkill = class _RovodevSkill extends ToolSkill {
9681
10737
  };
9682
10738
 
9683
10739
  // src/features/skills/skills-processor.ts
9684
- import { basename as basename5, join as join85 } from "path";
9685
- import { z as z45 } from "zod/mini";
10740
+ import { basename as basename5, join as join90 } from "path";
10741
+ import { z as z50 } from "zod/mini";
9686
10742
 
9687
10743
  // src/types/dir-feature-processor.ts
9688
- import { join as join68 } from "path";
10744
+ import { join as join73 } from "path";
9689
10745
  var DirFeatureProcessor = class {
9690
10746
  baseDir;
9691
10747
  dryRun;
@@ -9725,7 +10781,7 @@ var DirFeatureProcessor = class {
9725
10781
  const mainFile = aiDir.getMainFile();
9726
10782
  let mainFileContent;
9727
10783
  if (mainFile) {
9728
- const mainFilePath = join68(dirPath, mainFile.name);
10784
+ const mainFilePath = join73(dirPath, mainFile.name);
9729
10785
  const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter, {
9730
10786
  avoidBlockScalars: this.avoidBlockScalars
9731
10787
  });
@@ -9745,7 +10801,7 @@ var DirFeatureProcessor = class {
9745
10801
  const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
9746
10802
  otherFileContents.push(contentWithNewline);
9747
10803
  if (!dirHasChanges) {
9748
- const filePath = join68(dirPath, file.relativeFilePathToDirPath);
10804
+ const filePath = join73(dirPath, file.relativeFilePathToDirPath);
9749
10805
  const existingContent = await readFileContentOrNull(filePath);
9750
10806
  if (!fileContentsEquivalent({
9751
10807
  filePath,
@@ -9763,24 +10819,24 @@ var DirFeatureProcessor = class {
9763
10819
  if (this.dryRun) {
9764
10820
  this.logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
9765
10821
  if (mainFile) {
9766
- this.logger.info(`[DRY RUN] Would write: ${join68(dirPath, mainFile.name)}`);
9767
- changedPaths.push(join68(relativeDir, mainFile.name));
10822
+ this.logger.info(`[DRY RUN] Would write: ${join73(dirPath, mainFile.name)}`);
10823
+ changedPaths.push(join73(relativeDir, mainFile.name));
9768
10824
  }
9769
10825
  for (const file of otherFiles) {
9770
10826
  this.logger.info(
9771
- `[DRY RUN] Would write: ${join68(dirPath, file.relativeFilePathToDirPath)}`
10827
+ `[DRY RUN] Would write: ${join73(dirPath, file.relativeFilePathToDirPath)}`
9772
10828
  );
9773
- changedPaths.push(join68(relativeDir, file.relativeFilePathToDirPath));
10829
+ changedPaths.push(join73(relativeDir, file.relativeFilePathToDirPath));
9774
10830
  }
9775
10831
  } else {
9776
10832
  await ensureDir(dirPath);
9777
10833
  if (mainFile && mainFileContent) {
9778
- const mainFilePath = join68(dirPath, mainFile.name);
10834
+ const mainFilePath = join73(dirPath, mainFile.name);
9779
10835
  await writeFileContent(mainFilePath, mainFileContent);
9780
- changedPaths.push(join68(relativeDir, mainFile.name));
10836
+ changedPaths.push(join73(relativeDir, mainFile.name));
9781
10837
  }
9782
10838
  for (const [i, file] of otherFiles.entries()) {
9783
- const filePath = join68(dirPath, file.relativeFilePathToDirPath);
10839
+ const filePath = join73(dirPath, file.relativeFilePathToDirPath);
9784
10840
  const content = otherFileContents[i];
9785
10841
  if (content === void 0) {
9786
10842
  throw new Error(
@@ -9788,7 +10844,7 @@ var DirFeatureProcessor = class {
9788
10844
  );
9789
10845
  }
9790
10846
  await writeFileContent(filePath, content);
9791
- changedPaths.push(join68(relativeDir, file.relativeFilePathToDirPath));
10847
+ changedPaths.push(join73(relativeDir, file.relativeFilePathToDirPath));
9792
10848
  }
9793
10849
  }
9794
10850
  changedCount++;
@@ -9820,16 +10876,16 @@ var DirFeatureProcessor = class {
9820
10876
  };
9821
10877
 
9822
10878
  // src/features/skills/agentsskills-skill.ts
9823
- import { join as join69 } from "path";
9824
- import { z as z30 } from "zod/mini";
9825
- var AgentsSkillsSkillFrontmatterSchema = z30.looseObject({
9826
- name: z30.string(),
9827
- description: z30.string()
10879
+ import { join as join74 } from "path";
10880
+ import { z as z35 } from "zod/mini";
10881
+ var AgentsSkillsSkillFrontmatterSchema = z35.looseObject({
10882
+ name: z35.string(),
10883
+ description: z35.string()
9828
10884
  });
9829
10885
  var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
9830
10886
  constructor({
9831
10887
  baseDir = process.cwd(),
9832
- relativeDirPath = join69(".agents", "skills"),
10888
+ relativeDirPath = join74(".agents", "skills"),
9833
10889
  dirName,
9834
10890
  frontmatter,
9835
10891
  body,
@@ -9861,7 +10917,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
9861
10917
  throw new Error("AgentsSkillsSkill does not support global mode.");
9862
10918
  }
9863
10919
  return {
9864
- relativeDirPath: join69(".agents", "skills")
10920
+ relativeDirPath: join74(".agents", "skills")
9865
10921
  };
9866
10922
  }
9867
10923
  getFrontmatter() {
@@ -9941,9 +10997,9 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
9941
10997
  });
9942
10998
  const result = AgentsSkillsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
9943
10999
  if (!result.success) {
9944
- const skillDirPath = join69(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
11000
+ const skillDirPath = join74(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
9945
11001
  throw new Error(
9946
- `Invalid frontmatter in ${join69(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
11002
+ `Invalid frontmatter in ${join74(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
9947
11003
  );
9948
11004
  }
9949
11005
  return new _AgentsSkillsSkill({
@@ -9978,16 +11034,16 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
9978
11034
  };
9979
11035
 
9980
11036
  // src/features/skills/antigravity-skill.ts
9981
- import { join as join70 } from "path";
9982
- import { z as z31 } from "zod/mini";
9983
- var AntigravitySkillFrontmatterSchema = z31.looseObject({
9984
- name: z31.string(),
9985
- description: z31.string()
11037
+ import { join as join75 } from "path";
11038
+ import { z as z36 } from "zod/mini";
11039
+ var AntigravitySkillFrontmatterSchema = z36.looseObject({
11040
+ name: z36.string(),
11041
+ description: z36.string()
9986
11042
  });
9987
11043
  var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
9988
11044
  constructor({
9989
11045
  baseDir = process.cwd(),
9990
- relativeDirPath = join70(".agent", "skills"),
11046
+ relativeDirPath = join75(".agent", "skills"),
9991
11047
  dirName,
9992
11048
  frontmatter,
9993
11049
  body,
@@ -10019,11 +11075,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
10019
11075
  } = {}) {
10020
11076
  if (global) {
10021
11077
  return {
10022
- relativeDirPath: join70(".gemini", "antigravity", "skills")
11078
+ relativeDirPath: join75(".gemini", "antigravity", "skills")
10023
11079
  };
10024
11080
  }
10025
11081
  return {
10026
- relativeDirPath: join70(".agent", "skills")
11082
+ relativeDirPath: join75(".agent", "skills")
10027
11083
  };
10028
11084
  }
10029
11085
  getFrontmatter() {
@@ -10103,9 +11159,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
10103
11159
  });
10104
11160
  const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
10105
11161
  if (!result.success) {
10106
- const skillDirPath = join70(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
11162
+ const skillDirPath = join75(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
10107
11163
  throw new Error(
10108
- `Invalid frontmatter in ${join70(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
11164
+ `Invalid frontmatter in ${join75(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
10109
11165
  );
10110
11166
  }
10111
11167
  return new _AntigravitySkill({
@@ -10139,19 +11195,19 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
10139
11195
  };
10140
11196
 
10141
11197
  // src/features/skills/claudecode-skill.ts
10142
- import { join as join71 } from "path";
10143
- import { z as z32 } from "zod/mini";
10144
- var ClaudecodeSkillFrontmatterSchema = z32.looseObject({
10145
- name: z32.string(),
10146
- description: z32.string(),
10147
- "allowed-tools": z32.optional(z32.array(z32.string())),
10148
- model: z32.optional(z32.string()),
10149
- "disable-model-invocation": z32.optional(z32.boolean())
11198
+ import { join as join76 } from "path";
11199
+ import { z as z37 } from "zod/mini";
11200
+ var ClaudecodeSkillFrontmatterSchema = z37.looseObject({
11201
+ name: z37.string(),
11202
+ description: z37.string(),
11203
+ "allowed-tools": z37.optional(z37.array(z37.string())),
11204
+ model: z37.optional(z37.string()),
11205
+ "disable-model-invocation": z37.optional(z37.boolean())
10150
11206
  });
10151
11207
  var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
10152
11208
  constructor({
10153
11209
  baseDir = process.cwd(),
10154
- relativeDirPath = join71(".claude", "skills"),
11210
+ relativeDirPath = join76(".claude", "skills"),
10155
11211
  dirName,
10156
11212
  frontmatter,
10157
11213
  body,
@@ -10182,7 +11238,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
10182
11238
  global: _global = false
10183
11239
  } = {}) {
10184
11240
  return {
10185
- relativeDirPath: join71(".claude", "skills")
11241
+ relativeDirPath: join76(".claude", "skills")
10186
11242
  };
10187
11243
  }
10188
11244
  getFrontmatter() {
@@ -10279,9 +11335,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
10279
11335
  });
10280
11336
  const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
10281
11337
  if (!result.success) {
10282
- const skillDirPath = join71(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
11338
+ const skillDirPath = join76(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
10283
11339
  throw new Error(
10284
- `Invalid frontmatter in ${join71(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
11340
+ `Invalid frontmatter in ${join76(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
10285
11341
  );
10286
11342
  }
10287
11343
  return new _ClaudecodeSkill({
@@ -10315,16 +11371,16 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
10315
11371
  };
10316
11372
 
10317
11373
  // src/features/skills/cline-skill.ts
10318
- import { join as join72 } from "path";
10319
- import { z as z33 } from "zod/mini";
10320
- var ClineSkillFrontmatterSchema = z33.looseObject({
10321
- name: z33.string(),
10322
- description: z33.string()
11374
+ import { join as join77 } from "path";
11375
+ import { z as z38 } from "zod/mini";
11376
+ var ClineSkillFrontmatterSchema = z38.looseObject({
11377
+ name: z38.string(),
11378
+ description: z38.string()
10323
11379
  });
10324
11380
  var ClineSkill = class _ClineSkill extends ToolSkill {
10325
11381
  constructor({
10326
11382
  baseDir = process.cwd(),
10327
- relativeDirPath = join72(".cline", "skills"),
11383
+ relativeDirPath = join77(".cline", "skills"),
10328
11384
  dirName,
10329
11385
  frontmatter,
10330
11386
  body,
@@ -10353,7 +11409,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
10353
11409
  }
10354
11410
  static getSettablePaths(_options = {}) {
10355
11411
  return {
10356
- relativeDirPath: join72(".cline", "skills")
11412
+ relativeDirPath: join77(".cline", "skills")
10357
11413
  };
10358
11414
  }
10359
11415
  getFrontmatter() {
@@ -10441,13 +11497,13 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
10441
11497
  });
10442
11498
  const result = ClineSkillFrontmatterSchema.safeParse(loaded.frontmatter);
10443
11499
  if (!result.success) {
10444
- const skillDirPath = join72(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
11500
+ const skillDirPath = join77(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
10445
11501
  throw new Error(
10446
- `Invalid frontmatter in ${join72(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
11502
+ `Invalid frontmatter in ${join77(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
10447
11503
  );
10448
11504
  }
10449
11505
  if (result.data.name !== loaded.dirName) {
10450
- const skillFilePath = join72(
11506
+ const skillFilePath = join77(
10451
11507
  loaded.baseDir,
10452
11508
  loaded.relativeDirPath,
10453
11509
  loaded.dirName,
@@ -10488,21 +11544,21 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
10488
11544
  };
10489
11545
 
10490
11546
  // src/features/skills/codexcli-skill.ts
10491
- import { join as join73 } from "path";
10492
- import { z as z34 } from "zod/mini";
10493
- var CodexCliSkillFrontmatterSchema = z34.looseObject({
10494
- name: z34.string(),
10495
- description: z34.string(),
10496
- metadata: z34.optional(
10497
- z34.looseObject({
10498
- "short-description": z34.optional(z34.string())
11547
+ import { join as join78 } from "path";
11548
+ import { z as z39 } from "zod/mini";
11549
+ var CodexCliSkillFrontmatterSchema = z39.looseObject({
11550
+ name: z39.string(),
11551
+ description: z39.string(),
11552
+ metadata: z39.optional(
11553
+ z39.looseObject({
11554
+ "short-description": z39.optional(z39.string())
10499
11555
  })
10500
11556
  )
10501
11557
  });
10502
11558
  var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
10503
11559
  constructor({
10504
11560
  baseDir = process.cwd(),
10505
- relativeDirPath = join73(".codex", "skills"),
11561
+ relativeDirPath = join78(".codex", "skills"),
10506
11562
  dirName,
10507
11563
  frontmatter,
10508
11564
  body,
@@ -10533,7 +11589,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
10533
11589
  global: _global = false
10534
11590
  } = {}) {
10535
11591
  return {
10536
- relativeDirPath: join73(".codex", "skills")
11592
+ relativeDirPath: join78(".codex", "skills")
10537
11593
  };
10538
11594
  }
10539
11595
  getFrontmatter() {
@@ -10623,9 +11679,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
10623
11679
  });
10624
11680
  const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
10625
11681
  if (!result.success) {
10626
- const skillDirPath = join73(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
11682
+ const skillDirPath = join78(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
10627
11683
  throw new Error(
10628
- `Invalid frontmatter in ${join73(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
11684
+ `Invalid frontmatter in ${join78(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
10629
11685
  );
10630
11686
  }
10631
11687
  return new _CodexCliSkill({
@@ -10659,17 +11715,17 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
10659
11715
  };
10660
11716
 
10661
11717
  // src/features/skills/copilot-skill.ts
10662
- import { join as join74 } from "path";
10663
- import { z as z35 } from "zod/mini";
10664
- var CopilotSkillFrontmatterSchema = z35.looseObject({
10665
- name: z35.string(),
10666
- description: z35.string(),
10667
- license: z35.optional(z35.string())
11718
+ import { join as join79 } from "path";
11719
+ import { z as z40 } from "zod/mini";
11720
+ var CopilotSkillFrontmatterSchema = z40.looseObject({
11721
+ name: z40.string(),
11722
+ description: z40.string(),
11723
+ license: z40.optional(z40.string())
10668
11724
  });
10669
11725
  var CopilotSkill = class _CopilotSkill extends ToolSkill {
10670
11726
  constructor({
10671
11727
  baseDir = process.cwd(),
10672
- relativeDirPath = join74(".github", "skills"),
11728
+ relativeDirPath = join79(".github", "skills"),
10673
11729
  dirName,
10674
11730
  frontmatter,
10675
11731
  body,
@@ -10701,7 +11757,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
10701
11757
  throw new Error("CopilotSkill does not support global mode.");
10702
11758
  }
10703
11759
  return {
10704
- relativeDirPath: join74(".github", "skills")
11760
+ relativeDirPath: join79(".github", "skills")
10705
11761
  };
10706
11762
  }
10707
11763
  getFrontmatter() {
@@ -10787,9 +11843,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
10787
11843
  });
10788
11844
  const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
10789
11845
  if (!result.success) {
10790
- const skillDirPath = join74(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
11846
+ const skillDirPath = join79(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
10791
11847
  throw new Error(
10792
- `Invalid frontmatter in ${join74(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
11848
+ `Invalid frontmatter in ${join79(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
10793
11849
  );
10794
11850
  }
10795
11851
  return new _CopilotSkill({
@@ -10824,16 +11880,16 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
10824
11880
  };
10825
11881
 
10826
11882
  // src/features/skills/cursor-skill.ts
10827
- import { join as join75 } from "path";
10828
- import { z as z36 } from "zod/mini";
10829
- var CursorSkillFrontmatterSchema = z36.looseObject({
10830
- name: z36.string(),
10831
- description: z36.string()
11883
+ import { join as join80 } from "path";
11884
+ import { z as z41 } from "zod/mini";
11885
+ var CursorSkillFrontmatterSchema = z41.looseObject({
11886
+ name: z41.string(),
11887
+ description: z41.string()
10832
11888
  });
10833
11889
  var CursorSkill = class _CursorSkill extends ToolSkill {
10834
11890
  constructor({
10835
11891
  baseDir = process.cwd(),
10836
- relativeDirPath = join75(".cursor", "skills"),
11892
+ relativeDirPath = join80(".cursor", "skills"),
10837
11893
  dirName,
10838
11894
  frontmatter,
10839
11895
  body,
@@ -10862,7 +11918,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
10862
11918
  }
10863
11919
  static getSettablePaths(_options) {
10864
11920
  return {
10865
- relativeDirPath: join75(".cursor", "skills")
11921
+ relativeDirPath: join80(".cursor", "skills")
10866
11922
  };
10867
11923
  }
10868
11924
  getFrontmatter() {
@@ -10942,9 +11998,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
10942
11998
  });
10943
11999
  const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
10944
12000
  if (!result.success) {
10945
- const skillDirPath = join75(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
12001
+ const skillDirPath = join80(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
10946
12002
  throw new Error(
10947
- `Invalid frontmatter in ${join75(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
12003
+ `Invalid frontmatter in ${join80(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
10948
12004
  );
10949
12005
  }
10950
12006
  return new _CursorSkill({
@@ -10979,17 +12035,17 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
10979
12035
  };
10980
12036
 
10981
12037
  // src/features/skills/deepagents-skill.ts
10982
- import { join as join76 } from "path";
10983
- import { z as z37 } from "zod/mini";
10984
- var DeepagentsSkillFrontmatterSchema = z37.looseObject({
10985
- name: z37.string(),
10986
- description: z37.string(),
10987
- "allowed-tools": z37.optional(z37.array(z37.string()))
12038
+ import { join as join81 } from "path";
12039
+ import { z as z42 } from "zod/mini";
12040
+ var DeepagentsSkillFrontmatterSchema = z42.looseObject({
12041
+ name: z42.string(),
12042
+ description: z42.string(),
12043
+ "allowed-tools": z42.optional(z42.array(z42.string()))
10988
12044
  });
10989
12045
  var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
10990
12046
  constructor({
10991
12047
  baseDir = process.cwd(),
10992
- relativeDirPath = join76(".deepagents", "skills"),
12048
+ relativeDirPath = join81(".deepagents", "skills"),
10993
12049
  dirName,
10994
12050
  frontmatter,
10995
12051
  body,
@@ -11018,7 +12074,7 @@ var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
11018
12074
  }
11019
12075
  static getSettablePaths(_options) {
11020
12076
  return {
11021
- relativeDirPath: join76(".deepagents", "skills")
12077
+ relativeDirPath: join81(".deepagents", "skills")
11022
12078
  };
11023
12079
  }
11024
12080
  getFrontmatter() {
@@ -11104,9 +12160,9 @@ var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
11104
12160
  });
11105
12161
  const result = DeepagentsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
11106
12162
  if (!result.success) {
11107
- const skillDirPath = join76(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
12163
+ const skillDirPath = join81(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
11108
12164
  throw new Error(
11109
- `Invalid frontmatter in ${join76(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
12165
+ `Invalid frontmatter in ${join81(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
11110
12166
  );
11111
12167
  }
11112
12168
  return new _DeepagentsSkill({
@@ -11141,11 +12197,11 @@ var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
11141
12197
  };
11142
12198
 
11143
12199
  // src/features/skills/geminicli-skill.ts
11144
- import { join as join77 } from "path";
11145
- import { z as z38 } from "zod/mini";
11146
- var GeminiCliSkillFrontmatterSchema = z38.looseObject({
11147
- name: z38.string(),
11148
- description: z38.string()
12200
+ import { join as join82 } from "path";
12201
+ import { z as z43 } from "zod/mini";
12202
+ var GeminiCliSkillFrontmatterSchema = z43.looseObject({
12203
+ name: z43.string(),
12204
+ description: z43.string()
11149
12205
  });
11150
12206
  var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
11151
12207
  constructor({
@@ -11181,7 +12237,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
11181
12237
  global: _global = false
11182
12238
  } = {}) {
11183
12239
  return {
11184
- relativeDirPath: join77(".gemini", "skills")
12240
+ relativeDirPath: join82(".gemini", "skills")
11185
12241
  };
11186
12242
  }
11187
12243
  getFrontmatter() {
@@ -11261,9 +12317,9 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
11261
12317
  });
11262
12318
  const result = GeminiCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
11263
12319
  if (!result.success) {
11264
- const skillDirPath = join77(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
12320
+ const skillDirPath = join82(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
11265
12321
  throw new Error(
11266
- `Invalid frontmatter in ${join77(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
12322
+ `Invalid frontmatter in ${join82(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
11267
12323
  );
11268
12324
  }
11269
12325
  return new _GeminiCliSkill({
@@ -11298,16 +12354,16 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
11298
12354
  };
11299
12355
 
11300
12356
  // src/features/skills/junie-skill.ts
11301
- import { join as join78 } from "path";
11302
- import { z as z39 } from "zod/mini";
11303
- var JunieSkillFrontmatterSchema = z39.looseObject({
11304
- name: z39.string(),
11305
- description: z39.string()
12357
+ import { join as join83 } from "path";
12358
+ import { z as z44 } from "zod/mini";
12359
+ var JunieSkillFrontmatterSchema = z44.looseObject({
12360
+ name: z44.string(),
12361
+ description: z44.string()
11306
12362
  });
11307
12363
  var JunieSkill = class _JunieSkill extends ToolSkill {
11308
12364
  constructor({
11309
12365
  baseDir = process.cwd(),
11310
- relativeDirPath = join78(".junie", "skills"),
12366
+ relativeDirPath = join83(".junie", "skills"),
11311
12367
  dirName,
11312
12368
  frontmatter,
11313
12369
  body,
@@ -11339,7 +12395,7 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
11339
12395
  throw new Error("JunieSkill does not support global mode.");
11340
12396
  }
11341
12397
  return {
11342
- relativeDirPath: join78(".junie", "skills")
12398
+ relativeDirPath: join83(".junie", "skills")
11343
12399
  };
11344
12400
  }
11345
12401
  getFrontmatter() {
@@ -11426,13 +12482,13 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
11426
12482
  });
11427
12483
  const result = JunieSkillFrontmatterSchema.safeParse(loaded.frontmatter);
11428
12484
  if (!result.success) {
11429
- const skillDirPath = join78(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
12485
+ const skillDirPath = join83(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
11430
12486
  throw new Error(
11431
- `Invalid frontmatter in ${join78(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
12487
+ `Invalid frontmatter in ${join83(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
11432
12488
  );
11433
12489
  }
11434
12490
  if (result.data.name !== loaded.dirName) {
11435
- const skillFilePath = join78(
12491
+ const skillFilePath = join83(
11436
12492
  loaded.baseDir,
11437
12493
  loaded.relativeDirPath,
11438
12494
  loaded.dirName,
@@ -11474,17 +12530,17 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
11474
12530
  };
11475
12531
 
11476
12532
  // src/features/skills/kilo-skill.ts
11477
- import { join as join79 } from "path";
11478
- import { z as z40 } from "zod/mini";
11479
- var KiloSkillFrontmatterSchema = z40.looseObject({
11480
- name: z40.string(),
11481
- description: z40.string(),
11482
- "allowed-tools": z40.optional(z40.array(z40.string()))
12533
+ import { join as join84 } from "path";
12534
+ import { z as z45 } from "zod/mini";
12535
+ var KiloSkillFrontmatterSchema = z45.looseObject({
12536
+ name: z45.string(),
12537
+ description: z45.string(),
12538
+ "allowed-tools": z45.optional(z45.array(z45.string()))
11483
12539
  });
11484
12540
  var KiloSkill = class _KiloSkill extends ToolSkill {
11485
12541
  constructor({
11486
12542
  baseDir = process.cwd(),
11487
- relativeDirPath = join79(".kilo", "skills"),
12543
+ relativeDirPath = join84(".kilo", "skills"),
11488
12544
  dirName,
11489
12545
  frontmatter,
11490
12546
  body,
@@ -11513,7 +12569,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
11513
12569
  }
11514
12570
  static getSettablePaths({ global = false } = {}) {
11515
12571
  return {
11516
- relativeDirPath: global ? join79(".config", "kilo", "skills") : join79(".kilo", "skills")
12572
+ relativeDirPath: global ? join84(".config", "kilo", "skills") : join84(".kilo", "skills")
11517
12573
  };
11518
12574
  }
11519
12575
  getFrontmatter() {
@@ -11599,9 +12655,9 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
11599
12655
  });
11600
12656
  const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
11601
12657
  if (!result.success) {
11602
- const skillDirPath = join79(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
12658
+ const skillDirPath = join84(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
11603
12659
  throw new Error(
11604
- `Invalid frontmatter in ${join79(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
12660
+ `Invalid frontmatter in ${join84(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
11605
12661
  );
11606
12662
  }
11607
12663
  return new _KiloSkill({
@@ -11635,16 +12691,16 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
11635
12691
  };
11636
12692
 
11637
12693
  // src/features/skills/kiro-skill.ts
11638
- import { join as join80 } from "path";
11639
- import { z as z41 } from "zod/mini";
11640
- var KiroSkillFrontmatterSchema = z41.looseObject({
11641
- name: z41.string(),
11642
- description: z41.string()
12694
+ import { join as join85 } from "path";
12695
+ import { z as z46 } from "zod/mini";
12696
+ var KiroSkillFrontmatterSchema = z46.looseObject({
12697
+ name: z46.string(),
12698
+ description: z46.string()
11643
12699
  });
11644
12700
  var KiroSkill = class _KiroSkill extends ToolSkill {
11645
12701
  constructor({
11646
12702
  baseDir = process.cwd(),
11647
- relativeDirPath = join80(".kiro", "skills"),
12703
+ relativeDirPath = join85(".kiro", "skills"),
11648
12704
  dirName,
11649
12705
  frontmatter,
11650
12706
  body,
@@ -11676,7 +12732,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
11676
12732
  throw new Error("KiroSkill does not support global mode.");
11677
12733
  }
11678
12734
  return {
11679
- relativeDirPath: join80(".kiro", "skills")
12735
+ relativeDirPath: join85(".kiro", "skills")
11680
12736
  };
11681
12737
  }
11682
12738
  getFrontmatter() {
@@ -11764,13 +12820,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
11764
12820
  });
11765
12821
  const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
11766
12822
  if (!result.success) {
11767
- const skillDirPath = join80(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
12823
+ const skillDirPath = join85(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
11768
12824
  throw new Error(
11769
- `Invalid frontmatter in ${join80(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
12825
+ `Invalid frontmatter in ${join85(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
11770
12826
  );
11771
12827
  }
11772
12828
  if (result.data.name !== loaded.dirName) {
11773
- const skillFilePath = join80(
12829
+ const skillFilePath = join85(
11774
12830
  loaded.baseDir,
11775
12831
  loaded.relativeDirPath,
11776
12832
  loaded.dirName,
@@ -11812,17 +12868,17 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
11812
12868
  };
11813
12869
 
11814
12870
  // src/features/skills/opencode-skill.ts
11815
- import { join as join81 } from "path";
11816
- import { z as z42 } from "zod/mini";
11817
- var OpenCodeSkillFrontmatterSchema = z42.looseObject({
11818
- name: z42.string(),
11819
- description: z42.string(),
11820
- "allowed-tools": z42.optional(z42.array(z42.string()))
12871
+ import { join as join86 } from "path";
12872
+ import { z as z47 } from "zod/mini";
12873
+ var OpenCodeSkillFrontmatterSchema = z47.looseObject({
12874
+ name: z47.string(),
12875
+ description: z47.string(),
12876
+ "allowed-tools": z47.optional(z47.array(z47.string()))
11821
12877
  });
11822
12878
  var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
11823
12879
  constructor({
11824
12880
  baseDir = process.cwd(),
11825
- relativeDirPath = join81(".opencode", "skill"),
12881
+ relativeDirPath = join86(".opencode", "skill"),
11826
12882
  dirName,
11827
12883
  frontmatter,
11828
12884
  body,
@@ -11851,7 +12907,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
11851
12907
  }
11852
12908
  static getSettablePaths({ global = false } = {}) {
11853
12909
  return {
11854
- relativeDirPath: global ? join81(".config", "opencode", "skill") : join81(".opencode", "skill")
12910
+ relativeDirPath: global ? join86(".config", "opencode", "skill") : join86(".opencode", "skill")
11855
12911
  };
11856
12912
  }
11857
12913
  getFrontmatter() {
@@ -11937,9 +12993,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
11937
12993
  });
11938
12994
  const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
11939
12995
  if (!result.success) {
11940
- const skillDirPath = join81(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
12996
+ const skillDirPath = join86(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
11941
12997
  throw new Error(
11942
- `Invalid frontmatter in ${join81(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
12998
+ `Invalid frontmatter in ${join86(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
11943
12999
  );
11944
13000
  }
11945
13001
  return new _OpenCodeSkill({
@@ -11973,16 +13029,16 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
11973
13029
  };
11974
13030
 
11975
13031
  // src/features/skills/replit-skill.ts
11976
- import { join as join82 } from "path";
11977
- import { z as z43 } from "zod/mini";
11978
- var ReplitSkillFrontmatterSchema = z43.looseObject({
11979
- name: z43.string(),
11980
- description: z43.string()
13032
+ import { join as join87 } from "path";
13033
+ import { z as z48 } from "zod/mini";
13034
+ var ReplitSkillFrontmatterSchema = z48.looseObject({
13035
+ name: z48.string(),
13036
+ description: z48.string()
11981
13037
  });
11982
13038
  var ReplitSkill = class _ReplitSkill extends ToolSkill {
11983
13039
  constructor({
11984
13040
  baseDir = process.cwd(),
11985
- relativeDirPath = join82(".agents", "skills"),
13041
+ relativeDirPath = join87(".agents", "skills"),
11986
13042
  dirName,
11987
13043
  frontmatter,
11988
13044
  body,
@@ -12014,7 +13070,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
12014
13070
  throw new Error("ReplitSkill does not support global mode.");
12015
13071
  }
12016
13072
  return {
12017
- relativeDirPath: join82(".agents", "skills")
13073
+ relativeDirPath: join87(".agents", "skills")
12018
13074
  };
12019
13075
  }
12020
13076
  getFrontmatter() {
@@ -12094,9 +13150,9 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
12094
13150
  });
12095
13151
  const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
12096
13152
  if (!result.success) {
12097
- const skillDirPath = join82(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
13153
+ const skillDirPath = join87(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
12098
13154
  throw new Error(
12099
- `Invalid frontmatter in ${join82(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
13155
+ `Invalid frontmatter in ${join87(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
12100
13156
  );
12101
13157
  }
12102
13158
  return new _ReplitSkill({
@@ -12131,16 +13187,16 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
12131
13187
  };
12132
13188
 
12133
13189
  // src/features/skills/roo-skill.ts
12134
- import { join as join83 } from "path";
12135
- import { z as z44 } from "zod/mini";
12136
- var RooSkillFrontmatterSchema = z44.looseObject({
12137
- name: z44.string(),
12138
- description: z44.string()
13190
+ import { join as join88 } from "path";
13191
+ import { z as z49 } from "zod/mini";
13192
+ var RooSkillFrontmatterSchema = z49.looseObject({
13193
+ name: z49.string(),
13194
+ description: z49.string()
12139
13195
  });
12140
13196
  var RooSkill = class _RooSkill extends ToolSkill {
12141
13197
  constructor({
12142
13198
  baseDir = process.cwd(),
12143
- relativeDirPath = join83(".roo", "skills"),
13199
+ relativeDirPath = join88(".roo", "skills"),
12144
13200
  dirName,
12145
13201
  frontmatter,
12146
13202
  body,
@@ -12171,7 +13227,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
12171
13227
  global: _global = false
12172
13228
  } = {}) {
12173
13229
  return {
12174
- relativeDirPath: join83(".roo", "skills")
13230
+ relativeDirPath: join88(".roo", "skills")
12175
13231
  };
12176
13232
  }
12177
13233
  getFrontmatter() {
@@ -12259,13 +13315,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
12259
13315
  });
12260
13316
  const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
12261
13317
  if (!result.success) {
12262
- const skillDirPath = join83(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
13318
+ const skillDirPath = join88(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
12263
13319
  throw new Error(
12264
- `Invalid frontmatter in ${join83(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
13320
+ `Invalid frontmatter in ${join88(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
12265
13321
  );
12266
13322
  }
12267
13323
  if (result.data.name !== loaded.dirName) {
12268
- const skillFilePath = join83(
13324
+ const skillFilePath = join88(
12269
13325
  loaded.baseDir,
12270
13326
  loaded.relativeDirPath,
12271
13327
  loaded.dirName,
@@ -12306,14 +13362,14 @@ var RooSkill = class _RooSkill extends ToolSkill {
12306
13362
  };
12307
13363
 
12308
13364
  // src/features/skills/skills-utils.ts
12309
- import { basename as basename4, join as join84 } from "path";
13365
+ import { basename as basename4, join as join89 } from "path";
12310
13366
  async function getLocalSkillDirNames(baseDir) {
12311
- const skillsDir = join84(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
13367
+ const skillsDir = join89(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
12312
13368
  const names = /* @__PURE__ */ new Set();
12313
13369
  if (!await directoryExists(skillsDir)) {
12314
13370
  return names;
12315
13371
  }
12316
- const dirPaths = await findFilesByGlobs(join84(skillsDir, "*"), { type: "dir" });
13372
+ const dirPaths = await findFilesByGlobs(join89(skillsDir, "*"), { type: "dir" });
12317
13373
  for (const dirPath of dirPaths) {
12318
13374
  const name = basename4(dirPath);
12319
13375
  if (name === basename4(RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH)) continue;
@@ -12344,7 +13400,7 @@ var skillsProcessorToolTargetTuple = [
12344
13400
  "roo",
12345
13401
  "rovodev"
12346
13402
  ];
12347
- var SkillsProcessorToolTargetSchema = z45.enum(skillsProcessorToolTargetTuple);
13403
+ var SkillsProcessorToolTargetSchema = z50.enum(skillsProcessorToolTargetTuple);
12348
13404
  var toolSkillFactories = /* @__PURE__ */ new Map([
12349
13405
  [
12350
13406
  "agentsmd",
@@ -12568,10 +13624,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
12568
13624
  )
12569
13625
  );
12570
13626
  const localSkillNames = new Set(localDirNames);
12571
- const curatedDirPath = join85(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
13627
+ const curatedDirPath = join90(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
12572
13628
  let curatedSkills = [];
12573
13629
  if (await directoryExists(curatedDirPath)) {
12574
- const curatedDirPaths = await findFilesByGlobs(join85(curatedDirPath, "*"), { type: "dir" });
13630
+ const curatedDirPaths = await findFilesByGlobs(join90(curatedDirPath, "*"), { type: "dir" });
12575
13631
  const curatedDirNames = curatedDirPaths.map((path3) => basename5(path3));
12576
13632
  const nonConflicting = curatedDirNames.filter((name) => {
12577
13633
  if (localSkillNames.has(name)) {
@@ -12609,11 +13665,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
12609
13665
  const seenDirNames = /* @__PURE__ */ new Set();
12610
13666
  const loadEntries = [];
12611
13667
  for (const root of roots) {
12612
- const skillsDirPath = join85(this.baseDir, root);
13668
+ const skillsDirPath = join90(this.baseDir, root);
12613
13669
  if (!await directoryExists(skillsDirPath)) {
12614
13670
  continue;
12615
13671
  }
12616
- const dirPaths = await findFilesByGlobs(join85(skillsDirPath, "*"), { type: "dir" });
13672
+ const dirPaths = await findFilesByGlobs(join90(skillsDirPath, "*"), { type: "dir" });
12617
13673
  for (const dirPath of dirPaths) {
12618
13674
  const dirName = basename5(dirPath);
12619
13675
  if (seenDirNames.has(dirName)) {
@@ -12644,11 +13700,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
12644
13700
  const roots = toolSkillSearchRoots(paths);
12645
13701
  const toolSkills = [];
12646
13702
  for (const root of roots) {
12647
- const skillsDirPath = join85(this.baseDir, root);
13703
+ const skillsDirPath = join90(this.baseDir, root);
12648
13704
  if (!await directoryExists(skillsDirPath)) {
12649
13705
  continue;
12650
13706
  }
12651
- const dirPaths = await findFilesByGlobs(join85(skillsDirPath, "*"), { type: "dir" });
13707
+ const dirPaths = await findFilesByGlobs(join90(skillsDirPath, "*"), { type: "dir" });
12652
13708
  for (const dirPath of dirPaths) {
12653
13709
  const dirName = basename5(dirPath);
12654
13710
  const toolSkill = factory.class.forDeletion({
@@ -12712,11 +13768,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
12712
13768
  };
12713
13769
 
12714
13770
  // src/features/subagents/agentsmd-subagent.ts
12715
- import { join as join87 } from "path";
13771
+ import { join as join92 } from "path";
12716
13772
 
12717
13773
  // src/features/subagents/simulated-subagent.ts
12718
- import { basename as basename6, join as join86 } from "path";
12719
- import { z as z46 } from "zod/mini";
13774
+ import { basename as basename6, join as join91 } from "path";
13775
+ import { z as z51 } from "zod/mini";
12720
13776
 
12721
13777
  // src/features/subagents/tool-subagent.ts
12722
13778
  var ToolSubagent = class extends ToolFile {
@@ -12768,9 +13824,9 @@ var ToolSubagent = class extends ToolFile {
12768
13824
  };
12769
13825
 
12770
13826
  // src/features/subagents/simulated-subagent.ts
12771
- var SimulatedSubagentFrontmatterSchema = z46.object({
12772
- name: z46.string(),
12773
- description: z46.optional(z46.string())
13827
+ var SimulatedSubagentFrontmatterSchema = z51.object({
13828
+ name: z51.string(),
13829
+ description: z51.optional(z51.string())
12774
13830
  });
12775
13831
  var SimulatedSubagent = class extends ToolSubagent {
12776
13832
  frontmatter;
@@ -12780,7 +13836,7 @@ var SimulatedSubagent = class extends ToolSubagent {
12780
13836
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
12781
13837
  if (!result.success) {
12782
13838
  throw new Error(
12783
- `Invalid frontmatter in ${join86(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
13839
+ `Invalid frontmatter in ${join91(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
12784
13840
  );
12785
13841
  }
12786
13842
  }
@@ -12831,7 +13887,7 @@ var SimulatedSubagent = class extends ToolSubagent {
12831
13887
  return {
12832
13888
  success: false,
12833
13889
  error: new Error(
12834
- `Invalid frontmatter in ${join86(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
13890
+ `Invalid frontmatter in ${join91(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
12835
13891
  )
12836
13892
  };
12837
13893
  }
@@ -12841,7 +13897,7 @@ var SimulatedSubagent = class extends ToolSubagent {
12841
13897
  relativeFilePath,
12842
13898
  validate = true
12843
13899
  }) {
12844
- const filePath = join86(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
13900
+ const filePath = join91(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
12845
13901
  const fileContent = await readFileContent(filePath);
12846
13902
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
12847
13903
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -12877,7 +13933,7 @@ var SimulatedSubagent = class extends ToolSubagent {
12877
13933
  var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
12878
13934
  static getSettablePaths() {
12879
13935
  return {
12880
- relativeDirPath: join87(".agents", "subagents")
13936
+ relativeDirPath: join92(".agents", "subagents")
12881
13937
  };
12882
13938
  }
12883
13939
  static async fromFile(params) {
@@ -12900,11 +13956,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
12900
13956
  };
12901
13957
 
12902
13958
  // src/features/subagents/factorydroid-subagent.ts
12903
- import { join as join88 } from "path";
13959
+ import { join as join93 } from "path";
12904
13960
  var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
12905
13961
  static getSettablePaths(_options) {
12906
13962
  return {
12907
- relativeDirPath: join88(".factory", "droids")
13963
+ relativeDirPath: join93(".factory", "droids")
12908
13964
  };
12909
13965
  }
12910
13966
  static async fromFile(params) {
@@ -12927,16 +13983,16 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
12927
13983
  };
12928
13984
 
12929
13985
  // src/features/subagents/geminicli-subagent.ts
12930
- import { join as join90 } from "path";
12931
- import { z as z48 } from "zod/mini";
13986
+ import { join as join95 } from "path";
13987
+ import { z as z53 } from "zod/mini";
12932
13988
 
12933
13989
  // src/features/subagents/rulesync-subagent.ts
12934
- import { basename as basename7, join as join89 } from "path";
12935
- import { z as z47 } from "zod/mini";
12936
- var RulesyncSubagentFrontmatterSchema = z47.looseObject({
12937
- targets: z47._default(RulesyncTargetsSchema, ["*"]),
12938
- name: z47.string(),
12939
- description: z47.optional(z47.string())
13990
+ import { basename as basename7, join as join94 } from "path";
13991
+ import { z as z52 } from "zod/mini";
13992
+ var RulesyncSubagentFrontmatterSchema = z52.looseObject({
13993
+ targets: z52._default(RulesyncTargetsSchema, ["*"]),
13994
+ name: z52.string(),
13995
+ description: z52.optional(z52.string())
12940
13996
  });
12941
13997
  var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
12942
13998
  frontmatter;
@@ -12945,7 +14001,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
12945
14001
  const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
12946
14002
  if (!parseResult.success && rest.validate !== false) {
12947
14003
  throw new Error(
12948
- `Invalid frontmatter in ${join89(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
14004
+ `Invalid frontmatter in ${join94(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
12949
14005
  );
12950
14006
  }
12951
14007
  const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
@@ -12978,7 +14034,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
12978
14034
  return {
12979
14035
  success: false,
12980
14036
  error: new Error(
12981
- `Invalid frontmatter in ${join89(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
14037
+ `Invalid frontmatter in ${join94(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
12982
14038
  )
12983
14039
  };
12984
14040
  }
@@ -12986,7 +14042,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
12986
14042
  static async fromFile({
12987
14043
  relativeFilePath
12988
14044
  }) {
12989
- const filePath = join89(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
14045
+ const filePath = join94(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
12990
14046
  const fileContent = await readFileContent(filePath);
12991
14047
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
12992
14048
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -13005,9 +14061,9 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
13005
14061
  };
13006
14062
 
13007
14063
  // src/features/subagents/geminicli-subagent.ts
13008
- var GeminiCliSubagentFrontmatterSchema = z48.looseObject({
13009
- name: z48.string(),
13010
- description: z48.optional(z48.string())
14064
+ var GeminiCliSubagentFrontmatterSchema = z53.looseObject({
14065
+ name: z53.string(),
14066
+ description: z53.optional(z53.string())
13011
14067
  });
13012
14068
  var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
13013
14069
  frontmatter;
@@ -13017,7 +14073,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
13017
14073
  const result = GeminiCliSubagentFrontmatterSchema.safeParse(frontmatter);
13018
14074
  if (!result.success) {
13019
14075
  throw new Error(
13020
- `Invalid frontmatter in ${join90(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
14076
+ `Invalid frontmatter in ${join95(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
13021
14077
  );
13022
14078
  }
13023
14079
  }
@@ -13030,7 +14086,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
13030
14086
  }
13031
14087
  static getSettablePaths(_options = {}) {
13032
14088
  return {
13033
- relativeDirPath: join90(".gemini", "agents")
14089
+ relativeDirPath: join95(".gemini", "agents")
13034
14090
  };
13035
14091
  }
13036
14092
  getFrontmatter() {
@@ -13098,7 +14154,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
13098
14154
  return {
13099
14155
  success: false,
13100
14156
  error: new Error(
13101
- `Invalid frontmatter in ${join90(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
14157
+ `Invalid frontmatter in ${join95(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
13102
14158
  )
13103
14159
  };
13104
14160
  }
@@ -13116,7 +14172,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
13116
14172
  global = false
13117
14173
  }) {
13118
14174
  const paths = this.getSettablePaths({ global });
13119
- const filePath = join90(baseDir, paths.relativeDirPath, relativeFilePath);
14175
+ const filePath = join95(baseDir, paths.relativeDirPath, relativeFilePath);
13120
14176
  const fileContent = await readFileContent(filePath);
13121
14177
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
13122
14178
  const result = GeminiCliSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -13152,11 +14208,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
13152
14208
  };
13153
14209
 
13154
14210
  // src/features/subagents/roo-subagent.ts
13155
- import { join as join91 } from "path";
14211
+ import { join as join96 } from "path";
13156
14212
  var RooSubagent = class _RooSubagent extends SimulatedSubagent {
13157
14213
  static getSettablePaths() {
13158
14214
  return {
13159
- relativeDirPath: join91(".roo", "subagents")
14215
+ relativeDirPath: join96(".roo", "subagents")
13160
14216
  };
13161
14217
  }
13162
14218
  static async fromFile(params) {
@@ -13179,11 +14235,11 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
13179
14235
  };
13180
14236
 
13181
14237
  // src/features/subagents/rovodev-subagent.ts
13182
- import { join as join92 } from "path";
13183
- import { z as z49 } from "zod/mini";
13184
- var RovodevSubagentFrontmatterSchema = z49.looseObject({
13185
- name: z49.string(),
13186
- description: z49.optional(z49.string())
14238
+ import { join as join97 } from "path";
14239
+ import { z as z54 } from "zod/mini";
14240
+ var RovodevSubagentFrontmatterSchema = z54.looseObject({
14241
+ name: z54.string(),
14242
+ description: z54.optional(z54.string())
13187
14243
  });
13188
14244
  var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
13189
14245
  frontmatter;
@@ -13193,7 +14249,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
13193
14249
  const result = RovodevSubagentFrontmatterSchema.safeParse(frontmatter);
13194
14250
  if (!result.success) {
13195
14251
  throw new Error(
13196
- `Invalid frontmatter in ${join92(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
14252
+ `Invalid frontmatter in ${join97(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
13197
14253
  );
13198
14254
  }
13199
14255
  }
@@ -13205,7 +14261,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
13205
14261
  }
13206
14262
  static getSettablePaths(_options = {}) {
13207
14263
  return {
13208
- relativeDirPath: join92(".rovodev", "subagents")
14264
+ relativeDirPath: join97(".rovodev", "subagents")
13209
14265
  };
13210
14266
  }
13211
14267
  getFrontmatter() {
@@ -13268,7 +14324,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
13268
14324
  return {
13269
14325
  success: false,
13270
14326
  error: new Error(
13271
- `Invalid frontmatter in ${join92(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
14327
+ `Invalid frontmatter in ${join97(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
13272
14328
  )
13273
14329
  };
13274
14330
  }
@@ -13285,7 +14341,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
13285
14341
  global = false
13286
14342
  }) {
13287
14343
  const paths = this.getSettablePaths({ global });
13288
- const filePath = join92(baseDir, paths.relativeDirPath, relativeFilePath);
14344
+ const filePath = join97(baseDir, paths.relativeDirPath, relativeFilePath);
13289
14345
  const fileContent = await readFileContent(filePath);
13290
14346
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
13291
14347
  const result = RovodevSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -13324,19 +14380,19 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
13324
14380
  };
13325
14381
 
13326
14382
  // src/features/subagents/subagents-processor.ts
13327
- import { basename as basename9, join as join103 } from "path";
13328
- import { z as z58 } from "zod/mini";
14383
+ import { basename as basename9, join as join108 } from "path";
14384
+ import { z as z63 } from "zod/mini";
13329
14385
 
13330
14386
  // src/features/subagents/claudecode-subagent.ts
13331
- import { join as join93 } from "path";
13332
- import { z as z50 } from "zod/mini";
13333
- var ClaudecodeSubagentFrontmatterSchema = z50.looseObject({
13334
- name: z50.string(),
13335
- description: z50.optional(z50.string()),
13336
- model: z50.optional(z50.string()),
13337
- tools: z50.optional(z50.union([z50.string(), z50.array(z50.string())])),
13338
- permissionMode: z50.optional(z50.string()),
13339
- skills: z50.optional(z50.union([z50.string(), z50.array(z50.string())]))
14387
+ import { join as join98 } from "path";
14388
+ import { z as z55 } from "zod/mini";
14389
+ var ClaudecodeSubagentFrontmatterSchema = z55.looseObject({
14390
+ name: z55.string(),
14391
+ description: z55.optional(z55.string()),
14392
+ model: z55.optional(z55.string()),
14393
+ tools: z55.optional(z55.union([z55.string(), z55.array(z55.string())])),
14394
+ permissionMode: z55.optional(z55.string()),
14395
+ skills: z55.optional(z55.union([z55.string(), z55.array(z55.string())]))
13340
14396
  });
13341
14397
  var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
13342
14398
  frontmatter;
@@ -13346,7 +14402,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
13346
14402
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
13347
14403
  if (!result.success) {
13348
14404
  throw new Error(
13349
- `Invalid frontmatter in ${join93(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
14405
+ `Invalid frontmatter in ${join98(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
13350
14406
  );
13351
14407
  }
13352
14408
  }
@@ -13358,7 +14414,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
13358
14414
  }
13359
14415
  static getSettablePaths(_options = {}) {
13360
14416
  return {
13361
- relativeDirPath: join93(".claude", "agents")
14417
+ relativeDirPath: join98(".claude", "agents")
13362
14418
  };
13363
14419
  }
13364
14420
  getFrontmatter() {
@@ -13437,7 +14493,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
13437
14493
  return {
13438
14494
  success: false,
13439
14495
  error: new Error(
13440
- `Invalid frontmatter in ${join93(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
14496
+ `Invalid frontmatter in ${join98(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
13441
14497
  )
13442
14498
  };
13443
14499
  }
@@ -13455,7 +14511,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
13455
14511
  global = false
13456
14512
  }) {
13457
14513
  const paths = this.getSettablePaths({ global });
13458
- const filePath = join93(baseDir, paths.relativeDirPath, relativeFilePath);
14514
+ const filePath = join98(baseDir, paths.relativeDirPath, relativeFilePath);
13459
14515
  const fileContent = await readFileContent(filePath);
13460
14516
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
13461
14517
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -13490,27 +14546,27 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
13490
14546
  };
13491
14547
 
13492
14548
  // src/features/subagents/codexcli-subagent.ts
13493
- import { join as join94 } from "path";
13494
- import * as smolToml4 from "smol-toml";
13495
- import { z as z51 } from "zod/mini";
13496
- var CodexCliSubagentTomlSchema = z51.looseObject({
13497
- name: z51.string(),
13498
- description: z51.optional(z51.string()),
13499
- developer_instructions: z51.optional(z51.string()),
13500
- model: z51.optional(z51.string()),
13501
- model_reasoning_effort: z51.optional(z51.string()),
13502
- sandbox_mode: z51.optional(z51.string())
14549
+ import { join as join99 } from "path";
14550
+ import * as smolToml5 from "smol-toml";
14551
+ import { z as z56 } from "zod/mini";
14552
+ var CodexCliSubagentTomlSchema = z56.looseObject({
14553
+ name: z56.string(),
14554
+ description: z56.optional(z56.string()),
14555
+ developer_instructions: z56.optional(z56.string()),
14556
+ model: z56.optional(z56.string()),
14557
+ model_reasoning_effort: z56.optional(z56.string()),
14558
+ sandbox_mode: z56.optional(z56.string())
13503
14559
  });
13504
14560
  var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
13505
14561
  body;
13506
14562
  constructor({ body, ...rest }) {
13507
14563
  if (rest.validate !== false) {
13508
14564
  try {
13509
- const parsed = smolToml4.parse(body);
14565
+ const parsed = smolToml5.parse(body);
13510
14566
  CodexCliSubagentTomlSchema.parse(parsed);
13511
14567
  } catch (error) {
13512
14568
  throw new Error(
13513
- `Invalid TOML in ${join94(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
14569
+ `Invalid TOML in ${join99(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
13514
14570
  { cause: error }
13515
14571
  );
13516
14572
  }
@@ -13522,7 +14578,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
13522
14578
  }
13523
14579
  static getSettablePaths(_options = {}) {
13524
14580
  return {
13525
- relativeDirPath: join94(".codex", "agents")
14581
+ relativeDirPath: join99(".codex", "agents")
13526
14582
  };
13527
14583
  }
13528
14584
  getBody() {
@@ -13531,10 +14587,10 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
13531
14587
  toRulesyncSubagent() {
13532
14588
  let parsed;
13533
14589
  try {
13534
- parsed = CodexCliSubagentTomlSchema.parse(smolToml4.parse(this.body));
14590
+ parsed = CodexCliSubagentTomlSchema.parse(smolToml5.parse(this.body));
13535
14591
  } catch (error) {
13536
14592
  throw new Error(
13537
- `Failed to parse TOML in ${join94(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
14593
+ `Failed to parse TOML in ${join99(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
13538
14594
  { cause: error }
13539
14595
  );
13540
14596
  }
@@ -13577,7 +14633,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
13577
14633
  ...rulesyncSubagent.getBody() ? { developer_instructions: rulesyncSubagent.getBody() } : {},
13578
14634
  ...codexcliSection
13579
14635
  };
13580
- const body = smolToml4.stringify(tomlObj);
14636
+ const body = smolToml5.stringify(tomlObj);
13581
14637
  const paths = this.getSettablePaths({ global });
13582
14638
  const relativeFilePath = rulesyncSubagent.getRelativeFilePath().replace(/\.md$/, ".toml");
13583
14639
  return new _CodexCliSubagent({
@@ -13592,7 +14648,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
13592
14648
  }
13593
14649
  validate() {
13594
14650
  try {
13595
- const parsed = smolToml4.parse(this.body);
14651
+ const parsed = smolToml5.parse(this.body);
13596
14652
  CodexCliSubagentTomlSchema.parse(parsed);
13597
14653
  return { success: true, error: null };
13598
14654
  } catch (error) {
@@ -13615,7 +14671,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
13615
14671
  global = false
13616
14672
  }) {
13617
14673
  const paths = this.getSettablePaths({ global });
13618
- const filePath = join94(baseDir, paths.relativeDirPath, relativeFilePath);
14674
+ const filePath = join99(baseDir, paths.relativeDirPath, relativeFilePath);
13619
14675
  const fileContent = await readFileContent(filePath);
13620
14676
  const subagent = new _CodexCliSubagent({
13621
14677
  baseDir,
@@ -13653,13 +14709,13 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
13653
14709
  };
13654
14710
 
13655
14711
  // src/features/subagents/copilot-subagent.ts
13656
- import { join as join95 } from "path";
13657
- import { z as z52 } from "zod/mini";
14712
+ import { join as join100 } from "path";
14713
+ import { z as z57 } from "zod/mini";
13658
14714
  var REQUIRED_TOOL = "agent/runSubagent";
13659
- var CopilotSubagentFrontmatterSchema = z52.looseObject({
13660
- name: z52.string(),
13661
- description: z52.optional(z52.string()),
13662
- tools: z52.optional(z52.union([z52.string(), z52.array(z52.string())]))
14715
+ var CopilotSubagentFrontmatterSchema = z57.looseObject({
14716
+ name: z57.string(),
14717
+ description: z57.optional(z57.string()),
14718
+ tools: z57.optional(z57.union([z57.string(), z57.array(z57.string())]))
13663
14719
  });
13664
14720
  var normalizeTools = (tools) => {
13665
14721
  if (!tools) {
@@ -13679,7 +14735,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
13679
14735
  const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
13680
14736
  if (!result.success) {
13681
14737
  throw new Error(
13682
- `Invalid frontmatter in ${join95(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
14738
+ `Invalid frontmatter in ${join100(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
13683
14739
  );
13684
14740
  }
13685
14741
  }
@@ -13691,7 +14747,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
13691
14747
  }
13692
14748
  static getSettablePaths(_options = {}) {
13693
14749
  return {
13694
- relativeDirPath: join95(".github", "agents")
14750
+ relativeDirPath: join100(".github", "agents")
13695
14751
  };
13696
14752
  }
13697
14753
  getFrontmatter() {
@@ -13765,7 +14821,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
13765
14821
  return {
13766
14822
  success: false,
13767
14823
  error: new Error(
13768
- `Invalid frontmatter in ${join95(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
14824
+ `Invalid frontmatter in ${join100(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
13769
14825
  )
13770
14826
  };
13771
14827
  }
@@ -13783,7 +14839,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
13783
14839
  global = false
13784
14840
  }) {
13785
14841
  const paths = this.getSettablePaths({ global });
13786
- const filePath = join95(baseDir, paths.relativeDirPath, relativeFilePath);
14842
+ const filePath = join100(baseDir, paths.relativeDirPath, relativeFilePath);
13787
14843
  const fileContent = await readFileContent(filePath);
13788
14844
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
13789
14845
  const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -13819,11 +14875,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
13819
14875
  };
13820
14876
 
13821
14877
  // src/features/subagents/cursor-subagent.ts
13822
- import { join as join96 } from "path";
13823
- import { z as z53 } from "zod/mini";
13824
- var CursorSubagentFrontmatterSchema = z53.looseObject({
13825
- name: z53.string(),
13826
- description: z53.optional(z53.string())
14878
+ import { join as join101 } from "path";
14879
+ import { z as z58 } from "zod/mini";
14880
+ var CursorSubagentFrontmatterSchema = z58.looseObject({
14881
+ name: z58.string(),
14882
+ description: z58.optional(z58.string())
13827
14883
  });
13828
14884
  var CursorSubagent = class _CursorSubagent extends ToolSubagent {
13829
14885
  frontmatter;
@@ -13833,7 +14889,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
13833
14889
  const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
13834
14890
  if (!result.success) {
13835
14891
  throw new Error(
13836
- `Invalid frontmatter in ${join96(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
14892
+ `Invalid frontmatter in ${join101(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
13837
14893
  );
13838
14894
  }
13839
14895
  }
@@ -13845,7 +14901,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
13845
14901
  }
13846
14902
  static getSettablePaths(_options = {}) {
13847
14903
  return {
13848
- relativeDirPath: join96(".cursor", "agents")
14904
+ relativeDirPath: join101(".cursor", "agents")
13849
14905
  };
13850
14906
  }
13851
14907
  getFrontmatter() {
@@ -13912,7 +14968,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
13912
14968
  return {
13913
14969
  success: false,
13914
14970
  error: new Error(
13915
- `Invalid frontmatter in ${join96(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
14971
+ `Invalid frontmatter in ${join101(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
13916
14972
  )
13917
14973
  };
13918
14974
  }
@@ -13930,7 +14986,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
13930
14986
  global = false
13931
14987
  }) {
13932
14988
  const paths = this.getSettablePaths({ global });
13933
- const filePath = join96(baseDir, paths.relativeDirPath, relativeFilePath);
14989
+ const filePath = join101(baseDir, paths.relativeDirPath, relativeFilePath);
13934
14990
  const fileContent = await readFileContent(filePath);
13935
14991
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
13936
14992
  const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -13966,12 +15022,12 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
13966
15022
  };
13967
15023
 
13968
15024
  // src/features/subagents/deepagents-subagent.ts
13969
- import { join as join97 } from "path";
13970
- import { z as z54 } from "zod/mini";
13971
- var DeepagentsSubagentFrontmatterSchema = z54.looseObject({
13972
- name: z54.string(),
13973
- description: z54.optional(z54.string()),
13974
- model: z54.optional(z54.string())
15025
+ import { join as join102 } from "path";
15026
+ import { z as z59 } from "zod/mini";
15027
+ var DeepagentsSubagentFrontmatterSchema = z59.looseObject({
15028
+ name: z59.string(),
15029
+ description: z59.optional(z59.string()),
15030
+ model: z59.optional(z59.string())
13975
15031
  });
13976
15032
  var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
13977
15033
  frontmatter;
@@ -13981,7 +15037,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
13981
15037
  const result = DeepagentsSubagentFrontmatterSchema.safeParse(frontmatter);
13982
15038
  if (!result.success) {
13983
15039
  throw new Error(
13984
- `Invalid frontmatter in ${join97(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
15040
+ `Invalid frontmatter in ${join102(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
13985
15041
  );
13986
15042
  }
13987
15043
  }
@@ -13991,7 +15047,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
13991
15047
  }
13992
15048
  static getSettablePaths(_options = {}) {
13993
15049
  return {
13994
- relativeDirPath: join97(".deepagents", "agents")
15050
+ relativeDirPath: join102(".deepagents", "agents")
13995
15051
  };
13996
15052
  }
13997
15053
  getFrontmatter() {
@@ -14066,7 +15122,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
14066
15122
  return {
14067
15123
  success: false,
14068
15124
  error: new Error(
14069
- `Invalid frontmatter in ${join97(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
15125
+ `Invalid frontmatter in ${join102(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
14070
15126
  )
14071
15127
  };
14072
15128
  }
@@ -14084,7 +15140,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
14084
15140
  global = false
14085
15141
  }) {
14086
15142
  const paths = this.getSettablePaths({ global });
14087
- const filePath = join97(baseDir, paths.relativeDirPath, relativeFilePath);
15143
+ const filePath = join102(baseDir, paths.relativeDirPath, relativeFilePath);
14088
15144
  const fileContent = await readFileContent(filePath);
14089
15145
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
14090
15146
  const result = DeepagentsSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -14119,11 +15175,11 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
14119
15175
  };
14120
15176
 
14121
15177
  // src/features/subagents/junie-subagent.ts
14122
- import { join as join98 } from "path";
14123
- import { z as z55 } from "zod/mini";
14124
- var JunieSubagentFrontmatterSchema = z55.looseObject({
14125
- name: z55.optional(z55.string()),
14126
- description: z55.string()
15178
+ import { join as join103 } from "path";
15179
+ import { z as z60 } from "zod/mini";
15180
+ var JunieSubagentFrontmatterSchema = z60.looseObject({
15181
+ name: z60.optional(z60.string()),
15182
+ description: z60.string()
14127
15183
  });
14128
15184
  var JunieSubagent = class _JunieSubagent extends ToolSubagent {
14129
15185
  frontmatter;
@@ -14133,7 +15189,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
14133
15189
  const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
14134
15190
  if (!result.success) {
14135
15191
  throw new Error(
14136
- `Invalid frontmatter in ${join98(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
15192
+ `Invalid frontmatter in ${join103(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
14137
15193
  );
14138
15194
  }
14139
15195
  }
@@ -14148,7 +15204,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
14148
15204
  throw new Error("JunieSubagent does not support global mode.");
14149
15205
  }
14150
15206
  return {
14151
- relativeDirPath: join98(".junie", "agents")
15207
+ relativeDirPath: join103(".junie", "agents")
14152
15208
  };
14153
15209
  }
14154
15210
  getFrontmatter() {
@@ -14224,7 +15280,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
14224
15280
  return {
14225
15281
  success: false,
14226
15282
  error: new Error(
14227
- `Invalid frontmatter in ${join98(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
15283
+ `Invalid frontmatter in ${join103(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
14228
15284
  )
14229
15285
  };
14230
15286
  }
@@ -14242,7 +15298,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
14242
15298
  global = false
14243
15299
  }) {
14244
15300
  const paths = this.getSettablePaths({ global });
14245
- const filePath = join98(baseDir, paths.relativeDirPath, relativeFilePath);
15301
+ const filePath = join103(baseDir, paths.relativeDirPath, relativeFilePath);
14246
15302
  const fileContent = await readFileContent(filePath);
14247
15303
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
14248
15304
  const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -14277,15 +15333,15 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
14277
15333
  };
14278
15334
 
14279
15335
  // src/features/subagents/kilo-subagent.ts
14280
- import { join as join100 } from "path";
15336
+ import { join as join105 } from "path";
14281
15337
 
14282
15338
  // src/features/subagents/opencode-style-subagent.ts
14283
- import { basename as basename8, join as join99 } from "path";
14284
- import { z as z56 } from "zod/mini";
14285
- var OpenCodeStyleSubagentFrontmatterSchema = z56.looseObject({
14286
- description: z56.optional(z56.string()),
14287
- mode: z56._default(z56.string(), "subagent"),
14288
- name: z56.optional(z56.string())
15339
+ import { basename as basename8, join as join104 } from "path";
15340
+ import { z as z61 } from "zod/mini";
15341
+ var OpenCodeStyleSubagentFrontmatterSchema = z61.looseObject({
15342
+ description: z61.optional(z61.string()),
15343
+ mode: z61._default(z61.string(), "subagent"),
15344
+ name: z61.optional(z61.string())
14289
15345
  });
14290
15346
  var OpenCodeStyleSubagent = class extends ToolSubagent {
14291
15347
  frontmatter;
@@ -14295,7 +15351,7 @@ var OpenCodeStyleSubagent = class extends ToolSubagent {
14295
15351
  const result = OpenCodeStyleSubagentFrontmatterSchema.safeParse(frontmatter);
14296
15352
  if (!result.success) {
14297
15353
  throw new Error(
14298
- `Invalid frontmatter in ${join99(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
15354
+ `Invalid frontmatter in ${join104(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
14299
15355
  );
14300
15356
  }
14301
15357
  }
@@ -14337,7 +15393,7 @@ var OpenCodeStyleSubagent = class extends ToolSubagent {
14337
15393
  return {
14338
15394
  success: false,
14339
15395
  error: new Error(
14340
- `Invalid frontmatter in ${join99(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
15396
+ `Invalid frontmatter in ${join104(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
14341
15397
  )
14342
15398
  };
14343
15399
  }
@@ -14353,7 +15409,7 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
14353
15409
  global = false
14354
15410
  } = {}) {
14355
15411
  return {
14356
- relativeDirPath: global ? join100(".config", "kilo", "agent") : join100(".kilo", "agent")
15412
+ relativeDirPath: global ? join105(".config", "kilo", "agent") : join105(".kilo", "agent")
14357
15413
  };
14358
15414
  }
14359
15415
  static fromRulesyncSubagent({
@@ -14397,7 +15453,7 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
14397
15453
  global = false
14398
15454
  }) {
14399
15455
  const paths = this.getSettablePaths({ global });
14400
- const filePath = join100(baseDir, paths.relativeDirPath, relativeFilePath);
15456
+ const filePath = join105(baseDir, paths.relativeDirPath, relativeFilePath);
14401
15457
  const fileContent = await readFileContent(filePath);
14402
15458
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
14403
15459
  const result = KiloSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -14433,23 +15489,23 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
14433
15489
  };
14434
15490
 
14435
15491
  // src/features/subagents/kiro-subagent.ts
14436
- import { join as join101 } from "path";
14437
- import { z as z57 } from "zod/mini";
14438
- var KiroCliSubagentJsonSchema = z57.looseObject({
14439
- name: z57.string(),
14440
- description: z57.optional(z57.nullable(z57.string())),
14441
- prompt: z57.optional(z57.nullable(z57.string())),
14442
- tools: z57.optional(z57.nullable(z57.array(z57.string()))),
14443
- toolAliases: z57.optional(z57.nullable(z57.record(z57.string(), z57.string()))),
14444
- toolSettings: z57.optional(z57.nullable(z57.unknown())),
14445
- toolSchema: z57.optional(z57.nullable(z57.unknown())),
14446
- hooks: z57.optional(z57.nullable(z57.record(z57.string(), z57.array(z57.unknown())))),
14447
- model: z57.optional(z57.nullable(z57.string())),
14448
- mcpServers: z57.optional(z57.nullable(z57.record(z57.string(), z57.unknown()))),
14449
- useLegacyMcpJson: z57.optional(z57.nullable(z57.boolean())),
14450
- resources: z57.optional(z57.nullable(z57.array(z57.string()))),
14451
- allowedTools: z57.optional(z57.nullable(z57.array(z57.string()))),
14452
- includeMcpJson: z57.optional(z57.nullable(z57.boolean()))
15492
+ import { join as join106 } from "path";
15493
+ import { z as z62 } from "zod/mini";
15494
+ var KiroCliSubagentJsonSchema = z62.looseObject({
15495
+ name: z62.string(),
15496
+ description: z62.optional(z62.nullable(z62.string())),
15497
+ prompt: z62.optional(z62.nullable(z62.string())),
15498
+ tools: z62.optional(z62.nullable(z62.array(z62.string()))),
15499
+ toolAliases: z62.optional(z62.nullable(z62.record(z62.string(), z62.string()))),
15500
+ toolSettings: z62.optional(z62.nullable(z62.unknown())),
15501
+ toolSchema: z62.optional(z62.nullable(z62.unknown())),
15502
+ hooks: z62.optional(z62.nullable(z62.record(z62.string(), z62.array(z62.unknown())))),
15503
+ model: z62.optional(z62.nullable(z62.string())),
15504
+ mcpServers: z62.optional(z62.nullable(z62.record(z62.string(), z62.unknown()))),
15505
+ useLegacyMcpJson: z62.optional(z62.nullable(z62.boolean())),
15506
+ resources: z62.optional(z62.nullable(z62.array(z62.string()))),
15507
+ allowedTools: z62.optional(z62.nullable(z62.array(z62.string()))),
15508
+ includeMcpJson: z62.optional(z62.nullable(z62.boolean()))
14453
15509
  });
14454
15510
  var KiroSubagent = class _KiroSubagent extends ToolSubagent {
14455
15511
  body;
@@ -14460,7 +15516,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
14460
15516
  KiroCliSubagentJsonSchema.parse(parsed);
14461
15517
  } catch (error) {
14462
15518
  throw new Error(
14463
- `Invalid JSON in ${join101(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
15519
+ `Invalid JSON in ${join106(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
14464
15520
  { cause: error }
14465
15521
  );
14466
15522
  }
@@ -14472,7 +15528,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
14472
15528
  }
14473
15529
  static getSettablePaths(_options = {}) {
14474
15530
  return {
14475
- relativeDirPath: join101(".kiro", "agents")
15531
+ relativeDirPath: join106(".kiro", "agents")
14476
15532
  };
14477
15533
  }
14478
15534
  getBody() {
@@ -14484,7 +15540,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
14484
15540
  parsed = JSON.parse(this.body);
14485
15541
  } catch (error) {
14486
15542
  throw new Error(
14487
- `Failed to parse JSON in ${join101(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
15543
+ `Failed to parse JSON in ${join106(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
14488
15544
  { cause: error }
14489
15545
  );
14490
15546
  }
@@ -14565,7 +15621,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
14565
15621
  global = false
14566
15622
  }) {
14567
15623
  const paths = this.getSettablePaths({ global });
14568
- const filePath = join101(baseDir, paths.relativeDirPath, relativeFilePath);
15624
+ const filePath = join106(baseDir, paths.relativeDirPath, relativeFilePath);
14569
15625
  const fileContent = await readFileContent(filePath);
14570
15626
  const subagent = new _KiroSubagent({
14571
15627
  baseDir,
@@ -14603,7 +15659,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
14603
15659
  };
14604
15660
 
14605
15661
  // src/features/subagents/opencode-subagent.ts
14606
- import { join as join102 } from "path";
15662
+ import { join as join107 } from "path";
14607
15663
  var OpenCodeSubagentFrontmatterSchema = OpenCodeStyleSubagentFrontmatterSchema;
14608
15664
  var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
14609
15665
  getToolTarget() {
@@ -14613,7 +15669,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
14613
15669
  global = false
14614
15670
  } = {}) {
14615
15671
  return {
14616
- relativeDirPath: global ? join102(".config", "opencode", "agent") : join102(".opencode", "agent")
15672
+ relativeDirPath: global ? join107(".config", "opencode", "agent") : join107(".opencode", "agent")
14617
15673
  };
14618
15674
  }
14619
15675
  static fromRulesyncSubagent({
@@ -14657,7 +15713,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
14657
15713
  global = false
14658
15714
  }) {
14659
15715
  const paths = this.getSettablePaths({ global });
14660
- const filePath = join102(baseDir, paths.relativeDirPath, relativeFilePath);
15716
+ const filePath = join107(baseDir, paths.relativeDirPath, relativeFilePath);
14661
15717
  const fileContent = await readFileContent(filePath);
14662
15718
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
14663
15719
  const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -14710,7 +15766,7 @@ var subagentsProcessorToolTargetTuple = [
14710
15766
  "roo",
14711
15767
  "rovodev"
14712
15768
  ];
14713
- var SubagentsProcessorToolTargetSchema = z58.enum(subagentsProcessorToolTargetTuple);
15769
+ var SubagentsProcessorToolTargetSchema = z63.enum(subagentsProcessorToolTargetTuple);
14714
15770
  var toolSubagentFactories = /* @__PURE__ */ new Map([
14715
15771
  [
14716
15772
  "agentsmd",
@@ -14901,7 +15957,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
14901
15957
  * Load and parse rulesync subagent files from .rulesync/subagents/ directory
14902
15958
  */
14903
15959
  async loadRulesyncFiles() {
14904
- const subagentsDir = join103(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
15960
+ const subagentsDir = join108(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
14905
15961
  const dirExists = await directoryExists(subagentsDir);
14906
15962
  if (!dirExists) {
14907
15963
  this.logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
@@ -14916,7 +15972,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
14916
15972
  this.logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
14917
15973
  const rulesyncSubagents = [];
14918
15974
  for (const mdFile of mdFiles) {
14919
- const filepath = join103(subagentsDir, mdFile);
15975
+ const filepath = join108(subagentsDir, mdFile);
14920
15976
  try {
14921
15977
  const rulesyncSubagent = await RulesyncSubagent.fromFile({
14922
15978
  relativeFilePath: mdFile,
@@ -14946,7 +16002,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
14946
16002
  const factory = this.getFactory(this.toolTarget);
14947
16003
  const paths = factory.class.getSettablePaths({ global: this.global });
14948
16004
  const subagentFilePaths = await findFilesByGlobs(
14949
- join103(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
16005
+ join108(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
14950
16006
  );
14951
16007
  if (forDeletion) {
14952
16008
  const toolSubagents2 = subagentFilePaths.map(
@@ -15013,49 +16069,49 @@ var SubagentsProcessor = class extends FeatureProcessor {
15013
16069
  };
15014
16070
 
15015
16071
  // src/features/rules/agentsmd-rule.ts
15016
- import { join as join106 } from "path";
16072
+ import { join as join111 } from "path";
15017
16073
 
15018
16074
  // src/features/rules/tool-rule.ts
15019
- import { join as join105 } from "path";
16075
+ import { join as join110 } from "path";
15020
16076
 
15021
16077
  // src/features/rules/rulesync-rule.ts
15022
- import { join as join104 } from "path";
15023
- import { z as z59 } from "zod/mini";
15024
- var RulesyncRuleFrontmatterSchema = z59.object({
15025
- root: z59.optional(z59.boolean()),
15026
- localRoot: z59.optional(z59.boolean()),
15027
- targets: z59._default(RulesyncTargetsSchema, ["*"]),
15028
- description: z59.optional(z59.string()),
15029
- globs: z59.optional(z59.array(z59.string())),
15030
- agentsmd: z59.optional(
15031
- z59.looseObject({
16078
+ import { join as join109 } from "path";
16079
+ import { z as z64 } from "zod/mini";
16080
+ var RulesyncRuleFrontmatterSchema = z64.object({
16081
+ root: z64.optional(z64.boolean()),
16082
+ localRoot: z64.optional(z64.boolean()),
16083
+ targets: z64._default(RulesyncTargetsSchema, ["*"]),
16084
+ description: z64.optional(z64.string()),
16085
+ globs: z64.optional(z64.array(z64.string())),
16086
+ agentsmd: z64.optional(
16087
+ z64.looseObject({
15032
16088
  // @example "path/to/subproject"
15033
- subprojectPath: z59.optional(z59.string())
16089
+ subprojectPath: z64.optional(z64.string())
15034
16090
  })
15035
16091
  ),
15036
- claudecode: z59.optional(
15037
- z59.looseObject({
16092
+ claudecode: z64.optional(
16093
+ z64.looseObject({
15038
16094
  // Glob patterns for conditional rules (takes precedence over globs)
15039
16095
  // @example ["src/**/*.ts", "tests/**/*.test.ts"]
15040
- paths: z59.optional(z59.array(z59.string()))
16096
+ paths: z64.optional(z64.array(z64.string()))
15041
16097
  })
15042
16098
  ),
15043
- cursor: z59.optional(
15044
- z59.looseObject({
15045
- alwaysApply: z59.optional(z59.boolean()),
15046
- description: z59.optional(z59.string()),
15047
- globs: z59.optional(z59.array(z59.string()))
16099
+ cursor: z64.optional(
16100
+ z64.looseObject({
16101
+ alwaysApply: z64.optional(z64.boolean()),
16102
+ description: z64.optional(z64.string()),
16103
+ globs: z64.optional(z64.array(z64.string()))
15048
16104
  })
15049
16105
  ),
15050
- copilot: z59.optional(
15051
- z59.looseObject({
15052
- excludeAgent: z59.optional(z59.union([z59.literal("code-review"), z59.literal("coding-agent")]))
16106
+ copilot: z64.optional(
16107
+ z64.looseObject({
16108
+ excludeAgent: z64.optional(z64.union([z64.literal("code-review"), z64.literal("coding-agent")]))
15053
16109
  })
15054
16110
  ),
15055
- antigravity: z59.optional(
15056
- z59.looseObject({
15057
- trigger: z59.optional(z59.string()),
15058
- globs: z59.optional(z59.array(z59.string()))
16111
+ antigravity: z64.optional(
16112
+ z64.looseObject({
16113
+ trigger: z64.optional(z64.string()),
16114
+ globs: z64.optional(z64.array(z64.string()))
15059
16115
  })
15060
16116
  )
15061
16117
  });
@@ -15066,7 +16122,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
15066
16122
  const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
15067
16123
  if (!parseResult.success && rest.validate !== false) {
15068
16124
  throw new Error(
15069
- `Invalid frontmatter in ${join104(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
16125
+ `Invalid frontmatter in ${join109(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
15070
16126
  );
15071
16127
  }
15072
16128
  const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
@@ -15101,7 +16157,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
15101
16157
  return {
15102
16158
  success: false,
15103
16159
  error: new Error(
15104
- `Invalid frontmatter in ${join104(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
16160
+ `Invalid frontmatter in ${join109(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
15105
16161
  )
15106
16162
  };
15107
16163
  }
@@ -15110,7 +16166,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
15110
16166
  relativeFilePath,
15111
16167
  validate = true
15112
16168
  }) {
15113
- const filePath = join104(
16169
+ const filePath = join109(
15114
16170
  process.cwd(),
15115
16171
  this.getSettablePaths().recommended.relativeDirPath,
15116
16172
  relativeFilePath
@@ -15209,7 +16265,7 @@ var ToolRule = class extends ToolFile {
15209
16265
  rulesyncRule,
15210
16266
  validate = true,
15211
16267
  rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
15212
- nonRootPath = { relativeDirPath: join105(".agents", "memories") }
16268
+ nonRootPath = { relativeDirPath: join110(".agents", "memories") }
15213
16269
  }) {
15214
16270
  const params = this.buildToolRuleParamsDefault({
15215
16271
  baseDir,
@@ -15220,7 +16276,7 @@ var ToolRule = class extends ToolFile {
15220
16276
  });
15221
16277
  const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
15222
16278
  if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
15223
- params.relativeDirPath = join105(rulesyncFrontmatter.agentsmd.subprojectPath);
16279
+ params.relativeDirPath = join110(rulesyncFrontmatter.agentsmd.subprojectPath);
15224
16280
  params.relativeFilePath = "AGENTS.md";
15225
16281
  }
15226
16282
  return params;
@@ -15269,7 +16325,7 @@ var ToolRule = class extends ToolFile {
15269
16325
  }
15270
16326
  };
15271
16327
  function buildToolPath(toolDir, subDir, excludeToolDir) {
15272
- return excludeToolDir ? subDir : join105(toolDir, subDir);
16328
+ return excludeToolDir ? subDir : join110(toolDir, subDir);
15273
16329
  }
15274
16330
 
15275
16331
  // src/features/rules/agentsmd-rule.ts
@@ -15298,8 +16354,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
15298
16354
  validate = true
15299
16355
  }) {
15300
16356
  const isRoot = relativeFilePath === "AGENTS.md";
15301
- const relativePath = isRoot ? "AGENTS.md" : join106(".agents", "memories", relativeFilePath);
15302
- const fileContent = await readFileContent(join106(baseDir, relativePath));
16357
+ const relativePath = isRoot ? "AGENTS.md" : join111(".agents", "memories", relativeFilePath);
16358
+ const fileContent = await readFileContent(join111(baseDir, relativePath));
15303
16359
  return new _AgentsMdRule({
15304
16360
  baseDir,
15305
16361
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -15354,21 +16410,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
15354
16410
  };
15355
16411
 
15356
16412
  // src/features/rules/antigravity-rule.ts
15357
- import { join as join107 } from "path";
15358
- import { z as z60 } from "zod/mini";
15359
- var AntigravityRuleFrontmatterSchema = z60.looseObject({
15360
- trigger: z60.optional(
15361
- z60.union([
15362
- z60.literal("always_on"),
15363
- z60.literal("glob"),
15364
- z60.literal("manual"),
15365
- z60.literal("model_decision"),
15366
- z60.string()
16413
+ import { join as join112 } from "path";
16414
+ import { z as z65 } from "zod/mini";
16415
+ var AntigravityRuleFrontmatterSchema = z65.looseObject({
16416
+ trigger: z65.optional(
16417
+ z65.union([
16418
+ z65.literal("always_on"),
16419
+ z65.literal("glob"),
16420
+ z65.literal("manual"),
16421
+ z65.literal("model_decision"),
16422
+ z65.string()
15367
16423
  // accepts any string for forward compatibility
15368
16424
  ])
15369
16425
  ),
15370
- globs: z60.optional(z60.string()),
15371
- description: z60.optional(z60.string())
16426
+ globs: z65.optional(z65.string()),
16427
+ description: z65.optional(z65.string())
15372
16428
  });
15373
16429
  function parseGlobsString(globs) {
15374
16430
  if (!globs) {
@@ -15513,7 +16569,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
15513
16569
  const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
15514
16570
  if (!result.success) {
15515
16571
  throw new Error(
15516
- `Invalid frontmatter in ${join107(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
16572
+ `Invalid frontmatter in ${join112(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
15517
16573
  );
15518
16574
  }
15519
16575
  }
@@ -15537,7 +16593,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
15537
16593
  relativeFilePath,
15538
16594
  validate = true
15539
16595
  }) {
15540
- const filePath = join107(
16596
+ const filePath = join112(
15541
16597
  baseDir,
15542
16598
  this.getSettablePaths().nonRoot.relativeDirPath,
15543
16599
  relativeFilePath
@@ -15677,7 +16733,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
15677
16733
  };
15678
16734
 
15679
16735
  // src/features/rules/augmentcode-legacy-rule.ts
15680
- import { join as join108 } from "path";
16736
+ import { join as join113 } from "path";
15681
16737
  var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
15682
16738
  toRulesyncRule() {
15683
16739
  const rulesyncFrontmatter = {
@@ -15737,8 +16793,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
15737
16793
  }) {
15738
16794
  const settablePaths = this.getSettablePaths();
15739
16795
  const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
15740
- const relativePath = isRoot ? settablePaths.root.relativeFilePath : join108(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
15741
- const fileContent = await readFileContent(join108(baseDir, relativePath));
16796
+ const relativePath = isRoot ? settablePaths.root.relativeFilePath : join113(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
16797
+ const fileContent = await readFileContent(join113(baseDir, relativePath));
15742
16798
  return new _AugmentcodeLegacyRule({
15743
16799
  baseDir,
15744
16800
  relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
@@ -15767,7 +16823,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
15767
16823
  };
15768
16824
 
15769
16825
  // src/features/rules/augmentcode-rule.ts
15770
- import { join as join109 } from "path";
16826
+ import { join as join114 } from "path";
15771
16827
  var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
15772
16828
  toRulesyncRule() {
15773
16829
  return this.toRulesyncRuleDefault();
@@ -15798,7 +16854,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
15798
16854
  relativeFilePath,
15799
16855
  validate = true
15800
16856
  }) {
15801
- const filePath = join109(
16857
+ const filePath = join114(
15802
16858
  baseDir,
15803
16859
  this.getSettablePaths().nonRoot.relativeDirPath,
15804
16860
  relativeFilePath
@@ -15838,7 +16894,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
15838
16894
  };
15839
16895
 
15840
16896
  // src/features/rules/claudecode-legacy-rule.ts
15841
- import { join as join110 } from "path";
16897
+ import { join as join115 } from "path";
15842
16898
  var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
15843
16899
  static getSettablePaths({
15844
16900
  global,
@@ -15880,7 +16936,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
15880
16936
  if (isRoot) {
15881
16937
  const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
15882
16938
  const fileContent2 = await readFileContent(
15883
- join110(baseDir, rootDirPath, paths.root.relativeFilePath)
16939
+ join115(baseDir, rootDirPath, paths.root.relativeFilePath)
15884
16940
  );
15885
16941
  return new _ClaudecodeLegacyRule({
15886
16942
  baseDir,
@@ -15894,8 +16950,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
15894
16950
  if (!paths.nonRoot) {
15895
16951
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
15896
16952
  }
15897
- const relativePath = join110(paths.nonRoot.relativeDirPath, relativeFilePath);
15898
- const fileContent = await readFileContent(join110(baseDir, relativePath));
16953
+ const relativePath = join115(paths.nonRoot.relativeDirPath, relativeFilePath);
16954
+ const fileContent = await readFileContent(join115(baseDir, relativePath));
15899
16955
  return new _ClaudecodeLegacyRule({
15900
16956
  baseDir,
15901
16957
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -15954,10 +17010,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
15954
17010
  };
15955
17011
 
15956
17012
  // src/features/rules/claudecode-rule.ts
15957
- import { join as join111 } from "path";
15958
- import { z as z61 } from "zod/mini";
15959
- var ClaudecodeRuleFrontmatterSchema = z61.object({
15960
- paths: z61.optional(z61.array(z61.string()))
17013
+ import { join as join116 } from "path";
17014
+ import { z as z66 } from "zod/mini";
17015
+ var ClaudecodeRuleFrontmatterSchema = z66.object({
17016
+ paths: z66.optional(z66.array(z66.string()))
15961
17017
  });
15962
17018
  var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
15963
17019
  frontmatter;
@@ -15995,7 +17051,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
15995
17051
  const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
15996
17052
  if (!result.success) {
15997
17053
  throw new Error(
15998
- `Invalid frontmatter in ${join111(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
17054
+ `Invalid frontmatter in ${join116(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
15999
17055
  );
16000
17056
  }
16001
17057
  }
@@ -16025,7 +17081,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
16025
17081
  if (isRoot) {
16026
17082
  const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
16027
17083
  const fileContent2 = await readFileContent(
16028
- join111(baseDir, rootDirPath, paths.root.relativeFilePath)
17084
+ join116(baseDir, rootDirPath, paths.root.relativeFilePath)
16029
17085
  );
16030
17086
  return new _ClaudecodeRule({
16031
17087
  baseDir,
@@ -16040,8 +17096,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
16040
17096
  if (!paths.nonRoot) {
16041
17097
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
16042
17098
  }
16043
- const relativePath = join111(paths.nonRoot.relativeDirPath, relativeFilePath);
16044
- const filePath = join111(baseDir, relativePath);
17099
+ const relativePath = join116(paths.nonRoot.relativeDirPath, relativeFilePath);
17100
+ const filePath = join116(baseDir, relativePath);
16045
17101
  const fileContent = await readFileContent(filePath);
16046
17102
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
16047
17103
  const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
@@ -16152,7 +17208,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
16152
17208
  return {
16153
17209
  success: false,
16154
17210
  error: new Error(
16155
- `Invalid frontmatter in ${join111(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
17211
+ `Invalid frontmatter in ${join116(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
16156
17212
  )
16157
17213
  };
16158
17214
  }
@@ -16172,10 +17228,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
16172
17228
  };
16173
17229
 
16174
17230
  // src/features/rules/cline-rule.ts
16175
- import { join as join112 } from "path";
16176
- import { z as z62 } from "zod/mini";
16177
- var ClineRuleFrontmatterSchema = z62.object({
16178
- description: z62.string()
17231
+ import { join as join117 } from "path";
17232
+ import { z as z67 } from "zod/mini";
17233
+ var ClineRuleFrontmatterSchema = z67.object({
17234
+ description: z67.string()
16179
17235
  });
16180
17236
  var ClineRule = class _ClineRule extends ToolRule {
16181
17237
  static getSettablePaths(_options = {}) {
@@ -16218,7 +17274,7 @@ var ClineRule = class _ClineRule extends ToolRule {
16218
17274
  validate = true
16219
17275
  }) {
16220
17276
  const fileContent = await readFileContent(
16221
- join112(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
17277
+ join117(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
16222
17278
  );
16223
17279
  return new _ClineRule({
16224
17280
  baseDir,
@@ -16244,7 +17300,7 @@ var ClineRule = class _ClineRule extends ToolRule {
16244
17300
  };
16245
17301
 
16246
17302
  // src/features/rules/codexcli-rule.ts
16247
- import { join as join113 } from "path";
17303
+ import { join as join118 } from "path";
16248
17304
  var CodexcliRule = class _CodexcliRule extends ToolRule {
16249
17305
  static getSettablePaths({
16250
17306
  global,
@@ -16279,7 +17335,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
16279
17335
  if (isRoot) {
16280
17336
  const relativePath2 = paths.root.relativeFilePath;
16281
17337
  const fileContent2 = await readFileContent(
16282
- join113(baseDir, paths.root.relativeDirPath, relativePath2)
17338
+ join118(baseDir, paths.root.relativeDirPath, relativePath2)
16283
17339
  );
16284
17340
  return new _CodexcliRule({
16285
17341
  baseDir,
@@ -16293,8 +17349,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
16293
17349
  if (!paths.nonRoot) {
16294
17350
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
16295
17351
  }
16296
- const relativePath = join113(paths.nonRoot.relativeDirPath, relativeFilePath);
16297
- const fileContent = await readFileContent(join113(baseDir, relativePath));
17352
+ const relativePath = join118(paths.nonRoot.relativeDirPath, relativeFilePath);
17353
+ const fileContent = await readFileContent(join118(baseDir, relativePath));
16298
17354
  return new _CodexcliRule({
16299
17355
  baseDir,
16300
17356
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -16353,12 +17409,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
16353
17409
  };
16354
17410
 
16355
17411
  // src/features/rules/copilot-rule.ts
16356
- import { join as join114 } from "path";
16357
- import { z as z63 } from "zod/mini";
16358
- var CopilotRuleFrontmatterSchema = z63.object({
16359
- description: z63.optional(z63.string()),
16360
- applyTo: z63.optional(z63.string()),
16361
- excludeAgent: z63.optional(z63.union([z63.literal("code-review"), z63.literal("coding-agent")]))
17412
+ import { join as join119 } from "path";
17413
+ import { z as z68 } from "zod/mini";
17414
+ var CopilotRuleFrontmatterSchema = z68.object({
17415
+ description: z68.optional(z68.string()),
17416
+ applyTo: z68.optional(z68.string()),
17417
+ excludeAgent: z68.optional(z68.union([z68.literal("code-review"), z68.literal("coding-agent")]))
16362
17418
  });
16363
17419
  var CopilotRule = class _CopilotRule extends ToolRule {
16364
17420
  frontmatter;
@@ -16390,7 +17446,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
16390
17446
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
16391
17447
  if (!result.success) {
16392
17448
  throw new Error(
16393
- `Invalid frontmatter in ${join114(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
17449
+ `Invalid frontmatter in ${join119(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
16394
17450
  );
16395
17451
  }
16396
17452
  }
@@ -16480,8 +17536,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
16480
17536
  const paths = this.getSettablePaths({ global });
16481
17537
  const isRoot = relativeFilePath === paths.root.relativeFilePath;
16482
17538
  if (isRoot) {
16483
- const relativePath2 = join114(paths.root.relativeDirPath, paths.root.relativeFilePath);
16484
- const filePath2 = join114(baseDir, relativePath2);
17539
+ const relativePath2 = join119(paths.root.relativeDirPath, paths.root.relativeFilePath);
17540
+ const filePath2 = join119(baseDir, relativePath2);
16485
17541
  const fileContent2 = await readFileContent(filePath2);
16486
17542
  return new _CopilotRule({
16487
17543
  baseDir,
@@ -16496,8 +17552,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
16496
17552
  if (!paths.nonRoot) {
16497
17553
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
16498
17554
  }
16499
- const relativePath = join114(paths.nonRoot.relativeDirPath, relativeFilePath);
16500
- const filePath = join114(baseDir, relativePath);
17555
+ const relativePath = join119(paths.nonRoot.relativeDirPath, relativeFilePath);
17556
+ const filePath = join119(baseDir, relativePath);
16501
17557
  const fileContent = await readFileContent(filePath);
16502
17558
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
16503
17559
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
@@ -16543,7 +17599,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
16543
17599
  return {
16544
17600
  success: false,
16545
17601
  error: new Error(
16546
- `Invalid frontmatter in ${join114(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
17602
+ `Invalid frontmatter in ${join119(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
16547
17603
  )
16548
17604
  };
16549
17605
  }
@@ -16599,12 +17655,12 @@ var CopilotcliRule = class _CopilotcliRule extends CopilotRule {
16599
17655
  };
16600
17656
 
16601
17657
  // src/features/rules/cursor-rule.ts
16602
- import { join as join115 } from "path";
16603
- import { z as z64 } from "zod/mini";
16604
- var CursorRuleFrontmatterSchema = z64.object({
16605
- description: z64.optional(z64.string()),
16606
- globs: z64.optional(z64.string()),
16607
- alwaysApply: z64.optional(z64.boolean())
17658
+ import { join as join120 } from "path";
17659
+ import { z as z69 } from "zod/mini";
17660
+ var CursorRuleFrontmatterSchema = z69.object({
17661
+ description: z69.optional(z69.string()),
17662
+ globs: z69.optional(z69.string()),
17663
+ alwaysApply: z69.optional(z69.boolean())
16608
17664
  });
16609
17665
  var CursorRule = class _CursorRule extends ToolRule {
16610
17666
  frontmatter;
@@ -16621,7 +17677,7 @@ var CursorRule = class _CursorRule extends ToolRule {
16621
17677
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
16622
17678
  if (!result.success) {
16623
17679
  throw new Error(
16624
- `Invalid frontmatter in ${join115(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
17680
+ `Invalid frontmatter in ${join120(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
16625
17681
  );
16626
17682
  }
16627
17683
  }
@@ -16737,7 +17793,7 @@ var CursorRule = class _CursorRule extends ToolRule {
16737
17793
  relativeFilePath,
16738
17794
  validate = true
16739
17795
  }) {
16740
- const filePath = join115(
17796
+ const filePath = join120(
16741
17797
  baseDir,
16742
17798
  this.getSettablePaths().nonRoot.relativeDirPath,
16743
17799
  relativeFilePath
@@ -16747,7 +17803,7 @@ var CursorRule = class _CursorRule extends ToolRule {
16747
17803
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
16748
17804
  if (!result.success) {
16749
17805
  throw new Error(
16750
- `Invalid frontmatter in ${join115(baseDir, relativeFilePath)}: ${formatError(result.error)}`
17806
+ `Invalid frontmatter in ${join120(baseDir, relativeFilePath)}: ${formatError(result.error)}`
16751
17807
  );
16752
17808
  }
16753
17809
  return new _CursorRule({
@@ -16784,7 +17840,7 @@ var CursorRule = class _CursorRule extends ToolRule {
16784
17840
  return {
16785
17841
  success: false,
16786
17842
  error: new Error(
16787
- `Invalid frontmatter in ${join115(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
17843
+ `Invalid frontmatter in ${join120(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
16788
17844
  )
16789
17845
  };
16790
17846
  }
@@ -16804,7 +17860,7 @@ var CursorRule = class _CursorRule extends ToolRule {
16804
17860
  };
16805
17861
 
16806
17862
  // src/features/rules/deepagents-rule.ts
16807
- import { join as join116 } from "path";
17863
+ import { join as join121 } from "path";
16808
17864
  var DeepagentsRule = class _DeepagentsRule extends ToolRule {
16809
17865
  constructor({ fileContent, root, ...rest }) {
16810
17866
  super({
@@ -16831,8 +17887,8 @@ var DeepagentsRule = class _DeepagentsRule extends ToolRule {
16831
17887
  }) {
16832
17888
  const settablePaths = this.getSettablePaths();
16833
17889
  const isRoot = relativeFilePath === "AGENTS.md";
16834
- const relativePath = isRoot ? join116(".deepagents", "AGENTS.md") : join116(".deepagents", "memories", relativeFilePath);
16835
- const fileContent = await readFileContent(join116(baseDir, relativePath));
17890
+ const relativePath = isRoot ? join121(".deepagents", "AGENTS.md") : join121(".deepagents", "memories", relativeFilePath);
17891
+ const fileContent = await readFileContent(join121(baseDir, relativePath));
16836
17892
  return new _DeepagentsRule({
16837
17893
  baseDir,
16838
17894
  relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
@@ -16887,7 +17943,7 @@ var DeepagentsRule = class _DeepagentsRule extends ToolRule {
16887
17943
  };
16888
17944
 
16889
17945
  // src/features/rules/factorydroid-rule.ts
16890
- import { join as join117 } from "path";
17946
+ import { join as join122 } from "path";
16891
17947
  var FactorydroidRule = class _FactorydroidRule extends ToolRule {
16892
17948
  constructor({ fileContent, root, ...rest }) {
16893
17949
  super({
@@ -16927,8 +17983,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
16927
17983
  const paths = this.getSettablePaths({ global });
16928
17984
  const isRoot = relativeFilePath === paths.root.relativeFilePath;
16929
17985
  if (isRoot) {
16930
- const relativePath2 = join117(paths.root.relativeDirPath, paths.root.relativeFilePath);
16931
- const fileContent2 = await readFileContent(join117(baseDir, relativePath2));
17986
+ const relativePath2 = join122(paths.root.relativeDirPath, paths.root.relativeFilePath);
17987
+ const fileContent2 = await readFileContent(join122(baseDir, relativePath2));
16932
17988
  return new _FactorydroidRule({
16933
17989
  baseDir,
16934
17990
  relativeDirPath: paths.root.relativeDirPath,
@@ -16941,8 +17997,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
16941
17997
  if (!paths.nonRoot) {
16942
17998
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
16943
17999
  }
16944
- const relativePath = join117(paths.nonRoot.relativeDirPath, relativeFilePath);
16945
- const fileContent = await readFileContent(join117(baseDir, relativePath));
18000
+ const relativePath = join122(paths.nonRoot.relativeDirPath, relativeFilePath);
18001
+ const fileContent = await readFileContent(join122(baseDir, relativePath));
16946
18002
  return new _FactorydroidRule({
16947
18003
  baseDir,
16948
18004
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -17001,7 +18057,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
17001
18057
  };
17002
18058
 
17003
18059
  // src/features/rules/geminicli-rule.ts
17004
- import { join as join118 } from "path";
18060
+ import { join as join123 } from "path";
17005
18061
  var GeminiCliRule = class _GeminiCliRule extends ToolRule {
17006
18062
  static getSettablePaths({
17007
18063
  global,
@@ -17036,7 +18092,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
17036
18092
  if (isRoot) {
17037
18093
  const relativePath2 = paths.root.relativeFilePath;
17038
18094
  const fileContent2 = await readFileContent(
17039
- join118(baseDir, paths.root.relativeDirPath, relativePath2)
18095
+ join123(baseDir, paths.root.relativeDirPath, relativePath2)
17040
18096
  );
17041
18097
  return new _GeminiCliRule({
17042
18098
  baseDir,
@@ -17050,8 +18106,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
17050
18106
  if (!paths.nonRoot) {
17051
18107
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
17052
18108
  }
17053
- const relativePath = join118(paths.nonRoot.relativeDirPath, relativeFilePath);
17054
- const fileContent = await readFileContent(join118(baseDir, relativePath));
18109
+ const relativePath = join123(paths.nonRoot.relativeDirPath, relativeFilePath);
18110
+ const fileContent = await readFileContent(join123(baseDir, relativePath));
17055
18111
  return new _GeminiCliRule({
17056
18112
  baseDir,
17057
18113
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -17110,7 +18166,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
17110
18166
  };
17111
18167
 
17112
18168
  // src/features/rules/goose-rule.ts
17113
- import { join as join119 } from "path";
18169
+ import { join as join124 } from "path";
17114
18170
  var GooseRule = class _GooseRule extends ToolRule {
17115
18171
  static getSettablePaths({
17116
18172
  global,
@@ -17145,7 +18201,7 @@ var GooseRule = class _GooseRule extends ToolRule {
17145
18201
  if (isRoot) {
17146
18202
  const relativePath2 = paths.root.relativeFilePath;
17147
18203
  const fileContent2 = await readFileContent(
17148
- join119(baseDir, paths.root.relativeDirPath, relativePath2)
18204
+ join124(baseDir, paths.root.relativeDirPath, relativePath2)
17149
18205
  );
17150
18206
  return new _GooseRule({
17151
18207
  baseDir,
@@ -17159,8 +18215,8 @@ var GooseRule = class _GooseRule extends ToolRule {
17159
18215
  if (!paths.nonRoot) {
17160
18216
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
17161
18217
  }
17162
- const relativePath = join119(paths.nonRoot.relativeDirPath, relativeFilePath);
17163
- const fileContent = await readFileContent(join119(baseDir, relativePath));
18218
+ const relativePath = join124(paths.nonRoot.relativeDirPath, relativeFilePath);
18219
+ const fileContent = await readFileContent(join124(baseDir, relativePath));
17164
18220
  return new _GooseRule({
17165
18221
  baseDir,
17166
18222
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -17219,7 +18275,7 @@ var GooseRule = class _GooseRule extends ToolRule {
17219
18275
  };
17220
18276
 
17221
18277
  // src/features/rules/junie-rule.ts
17222
- import { join as join120 } from "path";
18278
+ import { join as join125 } from "path";
17223
18279
  var JunieRule = class _JunieRule extends ToolRule {
17224
18280
  static getSettablePaths(_options = {}) {
17225
18281
  return {
@@ -17248,8 +18304,8 @@ var JunieRule = class _JunieRule extends ToolRule {
17248
18304
  }) {
17249
18305
  const isRoot = _JunieRule.isRootRelativeFilePath(relativeFilePath);
17250
18306
  const settablePaths = this.getSettablePaths();
17251
- const relativePath = isRoot ? join120(settablePaths.root.relativeDirPath, settablePaths.root.relativeFilePath) : join120(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
17252
- const fileContent = await readFileContent(join120(baseDir, relativePath));
18307
+ const relativePath = isRoot ? join125(settablePaths.root.relativeDirPath, settablePaths.root.relativeFilePath) : join125(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
18308
+ const fileContent = await readFileContent(join125(baseDir, relativePath));
17253
18309
  return new _JunieRule({
17254
18310
  baseDir,
17255
18311
  relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
@@ -17304,7 +18360,7 @@ var JunieRule = class _JunieRule extends ToolRule {
17304
18360
  };
17305
18361
 
17306
18362
  // src/features/rules/kilo-rule.ts
17307
- import { join as join121 } from "path";
18363
+ import { join as join126 } from "path";
17308
18364
  var KiloRule = class _KiloRule extends ToolRule {
17309
18365
  static getSettablePaths({
17310
18366
  global,
@@ -17339,7 +18395,7 @@ var KiloRule = class _KiloRule extends ToolRule {
17339
18395
  if (isRoot) {
17340
18396
  const relativePath2 = paths.root.relativeFilePath;
17341
18397
  const fileContent2 = await readFileContent(
17342
- join121(baseDir, paths.root.relativeDirPath, relativePath2)
18398
+ join126(baseDir, paths.root.relativeDirPath, relativePath2)
17343
18399
  );
17344
18400
  return new _KiloRule({
17345
18401
  baseDir,
@@ -17353,8 +18409,8 @@ var KiloRule = class _KiloRule extends ToolRule {
17353
18409
  if (!paths.nonRoot) {
17354
18410
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
17355
18411
  }
17356
- const relativePath = join121(paths.nonRoot.relativeDirPath, relativeFilePath);
17357
- const fileContent = await readFileContent(join121(baseDir, relativePath));
18412
+ const relativePath = join126(paths.nonRoot.relativeDirPath, relativeFilePath);
18413
+ const fileContent = await readFileContent(join126(baseDir, relativePath));
17358
18414
  return new _KiloRule({
17359
18415
  baseDir,
17360
18416
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -17413,7 +18469,7 @@ var KiloRule = class _KiloRule extends ToolRule {
17413
18469
  };
17414
18470
 
17415
18471
  // src/features/rules/kiro-rule.ts
17416
- import { join as join122 } from "path";
18472
+ import { join as join127 } from "path";
17417
18473
  var KiroRule = class _KiroRule extends ToolRule {
17418
18474
  static getSettablePaths(_options = {}) {
17419
18475
  return {
@@ -17428,7 +18484,7 @@ var KiroRule = class _KiroRule extends ToolRule {
17428
18484
  validate = true
17429
18485
  }) {
17430
18486
  const fileContent = await readFileContent(
17431
- join122(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
18487
+ join127(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
17432
18488
  );
17433
18489
  return new _KiroRule({
17434
18490
  baseDir,
@@ -17482,7 +18538,7 @@ var KiroRule = class _KiroRule extends ToolRule {
17482
18538
  };
17483
18539
 
17484
18540
  // src/features/rules/opencode-rule.ts
17485
- import { join as join123 } from "path";
18541
+ import { join as join128 } from "path";
17486
18542
  var OpenCodeRule = class _OpenCodeRule extends ToolRule {
17487
18543
  static getSettablePaths({
17488
18544
  global,
@@ -17517,7 +18573,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
17517
18573
  if (isRoot) {
17518
18574
  const relativePath2 = paths.root.relativeFilePath;
17519
18575
  const fileContent2 = await readFileContent(
17520
- join123(baseDir, paths.root.relativeDirPath, relativePath2)
18576
+ join128(baseDir, paths.root.relativeDirPath, relativePath2)
17521
18577
  );
17522
18578
  return new _OpenCodeRule({
17523
18579
  baseDir,
@@ -17531,8 +18587,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
17531
18587
  if (!paths.nonRoot) {
17532
18588
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
17533
18589
  }
17534
- const relativePath = join123(paths.nonRoot.relativeDirPath, relativeFilePath);
17535
- const fileContent = await readFileContent(join123(baseDir, relativePath));
18590
+ const relativePath = join128(paths.nonRoot.relativeDirPath, relativeFilePath);
18591
+ const fileContent = await readFileContent(join128(baseDir, relativePath));
17536
18592
  return new _OpenCodeRule({
17537
18593
  baseDir,
17538
18594
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -17591,7 +18647,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
17591
18647
  };
17592
18648
 
17593
18649
  // src/features/rules/qwencode-rule.ts
17594
- import { join as join124 } from "path";
18650
+ import { join as join129 } from "path";
17595
18651
  var QwencodeRule = class _QwencodeRule extends ToolRule {
17596
18652
  static getSettablePaths(_options = {}) {
17597
18653
  return {
@@ -17610,8 +18666,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
17610
18666
  validate = true
17611
18667
  }) {
17612
18668
  const isRoot = relativeFilePath === "QWEN.md";
17613
- const relativePath = isRoot ? "QWEN.md" : join124(".qwen", "memories", relativeFilePath);
17614
- const fileContent = await readFileContent(join124(baseDir, relativePath));
18669
+ const relativePath = isRoot ? "QWEN.md" : join129(".qwen", "memories", relativeFilePath);
18670
+ const fileContent = await readFileContent(join129(baseDir, relativePath));
17615
18671
  return new _QwencodeRule({
17616
18672
  baseDir,
17617
18673
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -17663,7 +18719,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
17663
18719
  };
17664
18720
 
17665
18721
  // src/features/rules/replit-rule.ts
17666
- import { join as join125 } from "path";
18722
+ import { join as join130 } from "path";
17667
18723
  var ReplitRule = class _ReplitRule extends ToolRule {
17668
18724
  static getSettablePaths(_options = {}) {
17669
18725
  return {
@@ -17685,7 +18741,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
17685
18741
  }
17686
18742
  const relativePath = paths.root.relativeFilePath;
17687
18743
  const fileContent = await readFileContent(
17688
- join125(baseDir, paths.root.relativeDirPath, relativePath)
18744
+ join130(baseDir, paths.root.relativeDirPath, relativePath)
17689
18745
  );
17690
18746
  return new _ReplitRule({
17691
18747
  baseDir,
@@ -17751,7 +18807,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
17751
18807
  };
17752
18808
 
17753
18809
  // src/features/rules/roo-rule.ts
17754
- import { join as join126 } from "path";
18810
+ import { join as join131 } from "path";
17755
18811
  var RooRule = class _RooRule extends ToolRule {
17756
18812
  static getSettablePaths(_options = {}) {
17757
18813
  return {
@@ -17766,7 +18822,7 @@ var RooRule = class _RooRule extends ToolRule {
17766
18822
  validate = true
17767
18823
  }) {
17768
18824
  const fileContent = await readFileContent(
17769
- join126(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
18825
+ join131(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
17770
18826
  );
17771
18827
  return new _RooRule({
17772
18828
  baseDir,
@@ -17835,7 +18891,7 @@ var RooRule = class _RooRule extends ToolRule {
17835
18891
  };
17836
18892
 
17837
18893
  // src/features/rules/rovodev-rule.ts
17838
- import { join as join127 } from "path";
18894
+ import { join as join132 } from "path";
17839
18895
  var DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES = /* @__PURE__ */ new Set(["agents.md", "agents.local.md"]);
17840
18896
  var RovodevRule = class _RovodevRule extends ToolRule {
17841
18897
  /**
@@ -17879,7 +18935,7 @@ var RovodevRule = class _RovodevRule extends ToolRule {
17879
18935
  root: rovodevAgents,
17880
18936
  alternativeRoots: [{ relativeDirPath: ".", relativeFilePath: "AGENTS.md" }],
17881
18937
  nonRoot: {
17882
- relativeDirPath: join127(".rovodev", ".rulesync", "modular-rules")
18938
+ relativeDirPath: join132(".rovodev", ".rulesync", "modular-rules")
17883
18939
  }
17884
18940
  };
17885
18941
  }
@@ -17918,10 +18974,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
17918
18974
  }) {
17919
18975
  if (!this.isAllowedModularRulesRelativePath(relativeFilePath)) {
17920
18976
  throw new Error(
17921
- `Reserved Rovodev memory basename under modular-rules (not a modular rule): ${join127(relativeDirPath, relativeFilePath)}`
18977
+ `Reserved Rovodev memory basename under modular-rules (not a modular rule): ${join132(relativeDirPath, relativeFilePath)}`
17922
18978
  );
17923
18979
  }
17924
- const fileContent = await readFileContent(join127(baseDir, relativeDirPath, relativeFilePath));
18980
+ const fileContent = await readFileContent(join132(baseDir, relativeDirPath, relativeFilePath));
17925
18981
  return new _RovodevRule({
17926
18982
  baseDir,
17927
18983
  relativeDirPath,
@@ -17941,10 +18997,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
17941
18997
  paths
17942
18998
  }) {
17943
18999
  const relativeDirPath = overrideDirPath ?? paths.root.relativeDirPath;
17944
- const agentsMdExpectedLocationsDescription = "alternativeRoots" in paths && paths.alternativeRoots && paths.alternativeRoots.length > 0 ? `${join127(paths.root.relativeDirPath, paths.root.relativeFilePath)} or project root` : join127(paths.root.relativeDirPath, paths.root.relativeFilePath);
19000
+ const agentsMdExpectedLocationsDescription = "alternativeRoots" in paths && paths.alternativeRoots && paths.alternativeRoots.length > 0 ? `${join132(paths.root.relativeDirPath, paths.root.relativeFilePath)} or project root` : join132(paths.root.relativeDirPath, paths.root.relativeFilePath);
17945
19001
  if (relativeFilePath !== "AGENTS.md") {
17946
19002
  throw new Error(
17947
- `Rovodev rules support only AGENTS.md at ${agentsMdExpectedLocationsDescription}, got: ${join127(relativeDirPath, relativeFilePath)}`
19003
+ `Rovodev rules support only AGENTS.md at ${agentsMdExpectedLocationsDescription}, got: ${join132(relativeDirPath, relativeFilePath)}`
17948
19004
  );
17949
19005
  }
17950
19006
  const allowed = relativeDirPath === paths.root.relativeDirPath || "alternativeRoots" in paths && paths.alternativeRoots?.some(
@@ -17952,10 +19008,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
17952
19008
  );
17953
19009
  if (!allowed) {
17954
19010
  throw new Error(
17955
- `Rovodev AGENTS.md must be at ${agentsMdExpectedLocationsDescription}, got: ${join127(relativeDirPath, relativeFilePath)}`
19011
+ `Rovodev AGENTS.md must be at ${agentsMdExpectedLocationsDescription}, got: ${join132(relativeDirPath, relativeFilePath)}`
17956
19012
  );
17957
19013
  }
17958
- const fileContent = await readFileContent(join127(baseDir, relativeDirPath, relativeFilePath));
19014
+ const fileContent = await readFileContent(join132(baseDir, relativeDirPath, relativeFilePath));
17959
19015
  return new _RovodevRule({
17960
19016
  baseDir,
17961
19017
  relativeDirPath,
@@ -18069,7 +19125,7 @@ var RovodevRule = class _RovodevRule extends ToolRule {
18069
19125
  };
18070
19126
 
18071
19127
  // src/features/rules/warp-rule.ts
18072
- import { join as join128 } from "path";
19128
+ import { join as join133 } from "path";
18073
19129
  var WarpRule = class _WarpRule extends ToolRule {
18074
19130
  constructor({ fileContent, root, ...rest }) {
18075
19131
  super({
@@ -18095,8 +19151,8 @@ var WarpRule = class _WarpRule extends ToolRule {
18095
19151
  validate = true
18096
19152
  }) {
18097
19153
  const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
18098
- const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join128(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
18099
- const fileContent = await readFileContent(join128(baseDir, relativePath));
19154
+ const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join133(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
19155
+ const fileContent = await readFileContent(join133(baseDir, relativePath));
18100
19156
  return new _WarpRule({
18101
19157
  baseDir,
18102
19158
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
@@ -18151,7 +19207,7 @@ var WarpRule = class _WarpRule extends ToolRule {
18151
19207
  };
18152
19208
 
18153
19209
  // src/features/rules/windsurf-rule.ts
18154
- import { join as join129 } from "path";
19210
+ import { join as join134 } from "path";
18155
19211
  var WindsurfRule = class _WindsurfRule extends ToolRule {
18156
19212
  static getSettablePaths(_options = {}) {
18157
19213
  return {
@@ -18166,7 +19222,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
18166
19222
  validate = true
18167
19223
  }) {
18168
19224
  const fileContent = await readFileContent(
18169
- join129(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
19225
+ join134(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
18170
19226
  );
18171
19227
  return new _WindsurfRule({
18172
19228
  baseDir,
@@ -18181,14 +19237,21 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
18181
19237
  rulesyncRule,
18182
19238
  validate = true
18183
19239
  }) {
18184
- return new _WindsurfRule(
18185
- this.buildToolRuleParamsDefault({
18186
- baseDir,
18187
- rulesyncRule,
18188
- validate,
18189
- nonRootPath: this.getSettablePaths().nonRoot
18190
- })
18191
- );
19240
+ const toolRuleParams = this.buildToolRuleParamsDefault({
19241
+ baseDir,
19242
+ rulesyncRule,
19243
+ validate,
19244
+ nonRootPath: this.getSettablePaths().nonRoot
19245
+ });
19246
+ const windsurfFrontmatter = this.buildWindsurfFrontmatter({
19247
+ relativeFilePath: rulesyncRule.getRelativeFilePath(),
19248
+ description: rulesyncRule.getFrontmatter().description,
19249
+ globs: rulesyncRule.getFrontmatter().globs
19250
+ });
19251
+ return new _WindsurfRule({
19252
+ ...toolRuleParams,
19253
+ fileContent: stringifyFrontmatter(rulesyncRule.getBody(), windsurfFrontmatter)
19254
+ });
18192
19255
  }
18193
19256
  toRulesyncRule() {
18194
19257
  return this.toRulesyncRuleDefault();
@@ -18215,6 +19278,18 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
18215
19278
  toolTarget: "windsurf"
18216
19279
  });
18217
19280
  }
19281
+ static buildWindsurfFrontmatter({
19282
+ relativeFilePath,
19283
+ description,
19284
+ globs
19285
+ }) {
19286
+ const hasSpecificGlobs = Boolean(globs && globs.length > 0 && !globs.includes("**/*"));
19287
+ return {
19288
+ title: description ?? relativeFilePath.replace(/\.md$/, ""),
19289
+ trigger: hasSpecificGlobs ? "glob" : "always_on",
19290
+ ...hasSpecificGlobs && { globs }
19291
+ };
19292
+ }
18218
19293
  };
18219
19294
 
18220
19295
  // src/features/rules/rules-processor.ts
@@ -18245,8 +19320,30 @@ var rulesProcessorToolTargets = [
18245
19320
  "warp",
18246
19321
  "windsurf"
18247
19322
  ];
18248
- var RulesProcessorToolTargetSchema = z65.enum(rulesProcessorToolTargets);
18249
- var formatRulePaths = (rules) => rules.map((r) => join130(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
19323
+ var RulesProcessorToolTargetSchema = z70.enum(rulesProcessorToolTargets);
19324
+ var formatRulePaths = (rules) => rules.map((r) => join135(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
19325
+ var RulesFeatureOptionsSchema = z70.looseObject({
19326
+ ruleDiscoveryMode: z70.optional(z70.enum(["none", "explicit"]))
19327
+ });
19328
+ var resolveRuleDiscoveryMode = ({
19329
+ defaultMode,
19330
+ options
19331
+ }) => {
19332
+ if (defaultMode === "claudecode-legacy") {
19333
+ return defaultMode;
19334
+ }
19335
+ if (!options) return defaultMode;
19336
+ const parsed = RulesFeatureOptionsSchema.safeParse(options);
19337
+ if (!parsed.success) {
19338
+ throw new Error(
19339
+ `Invalid options for rules feature: ${parsed.error.message}. \`ruleDiscoveryMode\` must be either "none" or "explicit".`
19340
+ );
19341
+ }
19342
+ if (!parsed.data.ruleDiscoveryMode) {
19343
+ return defaultMode;
19344
+ }
19345
+ return parsed.data.ruleDiscoveryMode === "none" ? "auto" : "toon";
19346
+ };
18250
19347
  var toolRuleFactories = /* @__PURE__ */ new Map([
18251
19348
  [
18252
19349
  "agentsmd",
@@ -18561,6 +19658,7 @@ var RulesProcessor = class extends FeatureProcessor {
18561
19658
  global;
18562
19659
  getFactory;
18563
19660
  skills;
19661
+ featureOptions;
18564
19662
  constructor({
18565
19663
  baseDir = process.cwd(),
18566
19664
  toolTarget,
@@ -18570,6 +19668,7 @@ var RulesProcessor = class extends FeatureProcessor {
18570
19668
  global = false,
18571
19669
  getFactory = defaultGetFactory6,
18572
19670
  skills,
19671
+ featureOptions,
18573
19672
  dryRun = false,
18574
19673
  logger
18575
19674
  }) {
@@ -18587,6 +19686,7 @@ var RulesProcessor = class extends FeatureProcessor {
18587
19686
  this.simulateSkills = simulateSkills;
18588
19687
  this.getFactory = getFactory;
18589
19688
  this.skills = skills;
19689
+ this.featureOptions = featureOptions;
18590
19690
  }
18591
19691
  async convertRulesyncFilesToToolFiles(rulesyncFiles) {
18592
19692
  const rulesyncRules = rulesyncFiles.filter(
@@ -18674,7 +19774,7 @@ var RulesProcessor = class extends FeatureProcessor {
18674
19774
  }).relativeDirPath;
18675
19775
  return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
18676
19776
  const frontmatter = skill.getFrontmatter();
18677
- const relativePath = join130(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
19777
+ const relativePath = join135(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
18678
19778
  return {
18679
19779
  name: frontmatter.name,
18680
19780
  description: frontmatter.description,
@@ -18744,7 +19844,11 @@ var RulesProcessor = class extends FeatureProcessor {
18744
19844
  * Generate reference section based on meta configuration.
18745
19845
  */
18746
19846
  generateReferenceSectionFromMeta(meta, toolRules) {
18747
- switch (meta.ruleDiscoveryMode) {
19847
+ const mode = resolveRuleDiscoveryMode({
19848
+ defaultMode: meta.ruleDiscoveryMode,
19849
+ options: this.featureOptions
19850
+ });
19851
+ switch (mode) {
18748
19852
  case "toon":
18749
19853
  return this.generateToonReferencesSection(toolRules);
18750
19854
  case "claudecode-legacy":
@@ -18799,8 +19903,8 @@ var RulesProcessor = class extends FeatureProcessor {
18799
19903
  * Load and parse rulesync rule files from .rulesync/rules/ directory
18800
19904
  */
18801
19905
  async loadRulesyncFiles() {
18802
- const rulesyncBaseDir = join130(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
18803
- const files = await findFilesByGlobs(join130(rulesyncBaseDir, "**", "*.md"));
19906
+ const rulesyncBaseDir = join135(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
19907
+ const files = await findFilesByGlobs(join135(rulesyncBaseDir, "**", "*.md"));
18804
19908
  this.logger.debug(`Found ${files.length} rulesync files`);
18805
19909
  const rulesyncRules = await Promise.all(
18806
19910
  files.map((file) => {
@@ -18915,13 +20019,13 @@ var RulesProcessor = class extends FeatureProcessor {
18915
20019
  return [];
18916
20020
  }
18917
20021
  const uniqueRootFilePaths = await findFilesWithFallback(
18918
- join130(
20022
+ join135(
18919
20023
  this.baseDir,
18920
20024
  settablePaths.root.relativeDirPath ?? ".",
18921
20025
  settablePaths.root.relativeFilePath
18922
20026
  ),
18923
20027
  settablePaths.alternativeRoots,
18924
- (alt) => join130(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
20028
+ (alt) => join135(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
18925
20029
  );
18926
20030
  if (forDeletion) {
18927
20031
  return buildDeletionRulesFromPaths(uniqueRootFilePaths);
@@ -18952,7 +20056,7 @@ var RulesProcessor = class extends FeatureProcessor {
18952
20056
  return [];
18953
20057
  }
18954
20058
  const uniqueLocalRootFilePaths2 = await findFilesByGlobs(
18955
- join130(this.baseDir, "AGENTS.local.md")
20059
+ join135(this.baseDir, "AGENTS.local.md")
18956
20060
  );
18957
20061
  return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths2);
18958
20062
  }
@@ -18963,9 +20067,9 @@ var RulesProcessor = class extends FeatureProcessor {
18963
20067
  return [];
18964
20068
  }
18965
20069
  const uniqueLocalRootFilePaths = await findFilesWithFallback(
18966
- join130(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
20070
+ join135(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
18967
20071
  settablePaths.alternativeRoots,
18968
- (alt) => join130(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
20072
+ (alt) => join135(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
18969
20073
  );
18970
20074
  return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths);
18971
20075
  })();
@@ -18976,20 +20080,20 @@ var RulesProcessor = class extends FeatureProcessor {
18976
20080
  if (!forDeletion || this.toolTarget !== "rovodev" || this.global) {
18977
20081
  return [];
18978
20082
  }
18979
- const primaryPaths = await findFilesByGlobs(join130(this.baseDir, ".rovodev", "AGENTS.md"));
20083
+ const primaryPaths = await findFilesByGlobs(join135(this.baseDir, ".rovodev", "AGENTS.md"));
18980
20084
  if (primaryPaths.length === 0) {
18981
20085
  return [];
18982
20086
  }
18983
- const mirrorPaths = await findFilesByGlobs(join130(this.baseDir, "AGENTS.md"));
20087
+ const mirrorPaths = await findFilesByGlobs(join135(this.baseDir, "AGENTS.md"));
18984
20088
  return buildDeletionRulesFromPaths(mirrorPaths);
18985
20089
  })();
18986
20090
  const nonRootToolRules = await (async () => {
18987
20091
  if (!settablePaths.nonRoot) {
18988
20092
  return [];
18989
20093
  }
18990
- const nonRootBaseDir = join130(this.baseDir, settablePaths.nonRoot.relativeDirPath);
20094
+ const nonRootBaseDir = join135(this.baseDir, settablePaths.nonRoot.relativeDirPath);
18991
20095
  const nonRootFilePaths = await findFilesByGlobs(
18992
- join130(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
20096
+ join135(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
18993
20097
  );
18994
20098
  if (forDeletion) {
18995
20099
  return buildDeletionRulesFromPaths(nonRootFilePaths, {
@@ -19003,7 +20107,7 @@ var RulesProcessor = class extends FeatureProcessor {
19003
20107
  const ok = RovodevRule.isAllowedModularRulesRelativePath(relativeFilePath);
19004
20108
  if (!ok) {
19005
20109
  this.logger.warn(
19006
- `Skipping reserved Rovodev path under modular-rules (import): ${join130(modularRootRelative, relativeFilePath)}`
20110
+ `Skipping reserved Rovodev path under modular-rules (import): ${join135(modularRootRelative, relativeFilePath)}`
19007
20111
  );
19008
20112
  }
19009
20113
  return ok;
@@ -19129,14 +20233,14 @@ s/<command> [arguments]
19129
20233
  This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
19130
20234
  The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
19131
20235
 
19132
- When users call a custom slash command, you have to look for the markdown file, \`${join130(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
20236
+ When users call a custom slash command, you have to look for the markdown file, \`${join135(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
19133
20237
  const subagentsSection = subagents ? `## Simulated Subagents
19134
20238
 
19135
20239
  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.
19136
20240
 
19137
- When users call a simulated subagent, it will look for the corresponding markdown file, \`${join130(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
20241
+ When users call a simulated subagent, it will look for the corresponding markdown file, \`${join135(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
19138
20242
 
19139
- For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join130(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
20243
+ For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join135(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
19140
20244
  const skillsSection = skills ? this.generateSkillsSection(skills) : "";
19141
20245
  const result = [
19142
20246
  overview,
@@ -19236,7 +20340,7 @@ function warnUnsupportedTargets(params) {
19236
20340
  }
19237
20341
  }
19238
20342
  async function checkRulesyncDirExists(params) {
19239
- return fileExists(join131(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
20343
+ return fileExists(join136(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
19240
20344
  }
19241
20345
  async function generate(params) {
19242
20346
  const { config, logger } = params;
@@ -19246,8 +20350,9 @@ async function generate(params) {
19246
20350
  const subagentsResult = await generateSubagentsCore({ config, logger });
19247
20351
  const skillsResult = await generateSkillsCore({ config, logger });
19248
20352
  const hooksResult = await generateHooksCore({ config, logger });
20353
+ const permissionsResult = await generatePermissionsCore({ config, logger });
19249
20354
  const rulesResult = await generateRulesCore({ config, logger, skills: skillsResult.skills });
19250
- const hasDiff = ignoreResult.hasDiff || mcpResult.hasDiff || commandsResult.hasDiff || subagentsResult.hasDiff || skillsResult.hasDiff || hooksResult.hasDiff || rulesResult.hasDiff;
20355
+ const hasDiff = ignoreResult.hasDiff || mcpResult.hasDiff || commandsResult.hasDiff || subagentsResult.hasDiff || skillsResult.hasDiff || hooksResult.hasDiff || permissionsResult.hasDiff || rulesResult.hasDiff;
19251
20356
  return {
19252
20357
  rulesCount: rulesResult.count,
19253
20358
  rulesPaths: rulesResult.paths,
@@ -19263,6 +20368,8 @@ async function generate(params) {
19263
20368
  skillsPaths: skillsResult.paths,
19264
20369
  hooksCount: hooksResult.count,
19265
20370
  hooksPaths: hooksResult.paths,
20371
+ permissionsCount: permissionsResult.count,
20372
+ permissionsPaths: permissionsResult.paths,
19266
20373
  skills: skillsResult.skills,
19267
20374
  hasDiff
19268
20375
  };
@@ -19288,6 +20395,7 @@ async function generateRulesCore(params) {
19288
20395
  simulateSubagents: config.getSimulateSubagents(),
19289
20396
  simulateSkills: config.getSimulateSkills(),
19290
20397
  skills,
20398
+ featureOptions: config.getFeatureOptions(toolTarget, "rules"),
19291
20399
  dryRun: config.isPreviewMode(),
19292
20400
  logger
19293
20401
  });
@@ -19325,7 +20433,8 @@ async function generateIgnoreCore(params) {
19325
20433
  baseDir: baseDir === process.cwd() ? "." : baseDir,
19326
20434
  toolTarget,
19327
20435
  dryRun: config.isPreviewMode(),
19328
- logger
20436
+ logger,
20437
+ featureOptions: config.getFeatureOptions(toolTarget, "ignore")
19329
20438
  });
19330
20439
  const rulesyncFiles = await processor.loadRulesyncFiles();
19331
20440
  const result = await processFeatureWithRulesyncFiles({ config, processor, rulesyncFiles });
@@ -19535,6 +20644,48 @@ async function generateHooksCore(params) {
19535
20644
  }
19536
20645
  return { count: totalCount, paths: allPaths, hasDiff };
19537
20646
  }
20647
+ async function generatePermissionsCore(params) {
20648
+ const { config, logger } = params;
20649
+ const supportedPermissionsTargets = PermissionsProcessor.getToolTargets({
20650
+ global: config.getGlobal()
20651
+ });
20652
+ warnUnsupportedTargets({
20653
+ config,
20654
+ supportedTargets: supportedPermissionsTargets,
20655
+ featureName: "permissions",
20656
+ logger
20657
+ });
20658
+ let totalCount = 0;
20659
+ const allPaths = [];
20660
+ let hasDiff = false;
20661
+ for (const baseDir of config.getBaseDirs()) {
20662
+ for (const toolTarget of intersection(config.getTargets(), supportedPermissionsTargets)) {
20663
+ if (!config.getFeatures(toolTarget).includes("permissions")) {
20664
+ continue;
20665
+ }
20666
+ try {
20667
+ const processor = new PermissionsProcessor({
20668
+ baseDir,
20669
+ toolTarget,
20670
+ global: config.getGlobal(),
20671
+ dryRun: config.isPreviewMode(),
20672
+ logger
20673
+ });
20674
+ const rulesyncFiles = await processor.loadRulesyncFiles();
20675
+ const result = await processFeatureWithRulesyncFiles({ config, processor, rulesyncFiles });
20676
+ totalCount += result.count;
20677
+ allPaths.push(...result.paths);
20678
+ if (result.hasDiff) hasDiff = true;
20679
+ } catch (error) {
20680
+ logger.warn(
20681
+ `Failed to generate ${toolTarget} permissions files for ${baseDir}: ${formatError(error)}`
20682
+ );
20683
+ continue;
20684
+ }
20685
+ }
20686
+ }
20687
+ return { count: totalCount, paths: allPaths, hasDiff };
20688
+ }
19538
20689
 
19539
20690
  // src/lib/import.ts
19540
20691
  async function importFromTool(params) {
@@ -19546,6 +20697,7 @@ async function importFromTool(params) {
19546
20697
  const subagentsCount = await importSubagentsCore({ config, tool, logger });
19547
20698
  const skillsCount = await importSkillsCore({ config, tool, logger });
19548
20699
  const hooksCount = await importHooksCore({ config, tool, logger });
20700
+ const permissionsCount = await importPermissionsCore({ config, tool, logger });
19549
20701
  return {
19550
20702
  rulesCount,
19551
20703
  ignoreCount,
@@ -19553,7 +20705,8 @@ async function importFromTool(params) {
19553
20705
  commandsCount,
19554
20706
  subagentsCount,
19555
20707
  skillsCount,
19556
- hooksCount
20708
+ hooksCount,
20709
+ permissionsCount
19557
20710
  };
19558
20711
  }
19559
20712
  async function importRulesCore(params) {
@@ -19599,7 +20752,8 @@ async function importIgnoreCore(params) {
19599
20752
  const ignoreProcessor = new IgnoreProcessor({
19600
20753
  baseDir: config.getBaseDirs()[0] ?? ".",
19601
20754
  toolTarget: tool,
19602
- logger
20755
+ logger,
20756
+ featureOptions: config.getFeatureOptions(tool, "ignore")
19603
20757
  });
19604
20758
  const toolFiles = await ignoreProcessor.loadToolFiles();
19605
20759
  if (toolFiles.length === 0) {
@@ -19761,6 +20915,41 @@ async function importHooksCore(params) {
19761
20915
  }
19762
20916
  return writtenCount;
19763
20917
  }
20918
+ async function importPermissionsCore(params) {
20919
+ const { config, tool, logger } = params;
20920
+ if (!config.getFeatures(tool).includes("permissions")) {
20921
+ return 0;
20922
+ }
20923
+ const allTargets = PermissionsProcessor.getToolTargets({ global: config.getGlobal() });
20924
+ const importableTargets = PermissionsProcessor.getToolTargets({
20925
+ global: config.getGlobal(),
20926
+ importOnly: true
20927
+ });
20928
+ if (!allTargets.includes(tool)) {
20929
+ return 0;
20930
+ }
20931
+ if (!importableTargets.includes(tool)) {
20932
+ logger.warn(`Import is not supported for ${tool} permissions. Skipping.`);
20933
+ return 0;
20934
+ }
20935
+ const permissionsProcessor = new PermissionsProcessor({
20936
+ baseDir: config.getBaseDirs()[0] ?? ".",
20937
+ toolTarget: tool,
20938
+ global: config.getGlobal(),
20939
+ logger
20940
+ });
20941
+ const toolFiles = await permissionsProcessor.loadToolFiles();
20942
+ if (toolFiles.length === 0) {
20943
+ logger.warn(`No permissions files found for ${tool}. Skipping import.`);
20944
+ return 0;
20945
+ }
20946
+ const rulesyncFiles = await permissionsProcessor.convertToolFilesToRulesyncFiles(toolFiles);
20947
+ const { count: writtenCount } = await permissionsProcessor.writeAiFiles(rulesyncFiles);
20948
+ if (config.getVerbose() && writtenCount > 0) {
20949
+ logger.success(`Created ${writtenCount} permissions file(s)`);
20950
+ }
20951
+ return writtenCount;
20952
+ }
19764
20953
 
19765
20954
  // src/types/json-output.ts
19766
20955
  var ErrorCodes = {
@@ -19972,6 +21161,7 @@ export {
19972
21161
  removeTempDirectory,
19973
21162
  ALL_FEATURES,
19974
21163
  ALL_FEATURES_WITH_WILDCARD,
21164
+ isFeatureValueEnabled,
19975
21165
  ALL_TOOL_TARGETS,
19976
21166
  ALL_TOOL_TARGETS_WITH_WILDCARD,
19977
21167
  findControlCharacter,