rulesync 4.0.1 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +10 -5
  2. package/dist/index.cjs +2027 -593
  3. package/dist/index.js +2009 -575
  4. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -649,6 +649,17 @@ var ToolCommand = class extends AiFile {
649
649
  static async fromFile(_params) {
650
650
  throw new Error("Please implement this method in the subclass.");
651
651
  }
652
+ /**
653
+ * Create a minimal instance for deletion purposes.
654
+ * This method does not read or parse file content, making it safe to use
655
+ * even when files have old/incompatible formats.
656
+ *
657
+ * @param params - Parameters including the file path
658
+ * @returns A concrete ToolCommand instance with minimal data for deletion
659
+ */
660
+ static forDeletion(_params) {
661
+ throw new Error("Please implement this method in the subclass.");
662
+ }
652
663
  /**
653
664
  * Convert a RulesyncCommand to the tool-specific command format.
654
665
  *
@@ -791,6 +802,20 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
791
802
  validate
792
803
  };
793
804
  }
805
+ static forDeletionDefault({
806
+ baseDir = process.cwd(),
807
+ relativeDirPath,
808
+ relativeFilePath
809
+ }) {
810
+ return {
811
+ baseDir,
812
+ relativeDirPath,
813
+ relativeFilePath,
814
+ frontmatter: { description: "" },
815
+ body: "",
816
+ validate: false
817
+ };
818
+ }
794
819
  };
795
820
 
796
821
  // src/features/commands/agentsmd-command.ts
@@ -840,6 +865,15 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
840
865
  toolTarget: "agentsmd"
841
866
  });
842
867
  }
868
+ static forDeletion({
869
+ baseDir = process.cwd(),
870
+ relativeDirPath,
871
+ relativeFilePath
872
+ }) {
873
+ return new _AgentsmdCommand(
874
+ this.forDeletionDefault({ baseDir, relativeDirPath, relativeFilePath })
875
+ );
876
+ }
843
877
  };
844
878
 
845
879
  // src/features/commands/antigravity-command.ts
@@ -1057,6 +1091,21 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
1057
1091
  validate
1058
1092
  });
1059
1093
  }
1094
+ static forDeletion({
1095
+ baseDir = process.cwd(),
1096
+ relativeDirPath,
1097
+ relativeFilePath
1098
+ }) {
1099
+ return new _AntigravityCommand({
1100
+ baseDir,
1101
+ relativeDirPath,
1102
+ relativeFilePath,
1103
+ frontmatter: { description: "" },
1104
+ body: "",
1105
+ fileContent: "",
1106
+ validate: false
1107
+ });
1108
+ }
1060
1109
  };
1061
1110
 
1062
1111
  // src/features/commands/claudecode-command.ts
@@ -1187,6 +1236,20 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
1187
1236
  validate
1188
1237
  });
1189
1238
  }
1239
+ static forDeletion({
1240
+ baseDir = process.cwd(),
1241
+ relativeDirPath,
1242
+ relativeFilePath
1243
+ }) {
1244
+ return new _ClaudecodeCommand({
1245
+ baseDir,
1246
+ relativeDirPath,
1247
+ relativeFilePath,
1248
+ frontmatter: { description: "" },
1249
+ body: "",
1250
+ validate: false
1251
+ });
1252
+ }
1190
1253
  };
1191
1254
 
1192
1255
  // src/features/commands/codexcli-command.ts
@@ -1261,13 +1324,26 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
1261
1324
  validate
1262
1325
  });
1263
1326
  }
1327
+ static forDeletion({
1328
+ baseDir = process.cwd(),
1329
+ relativeDirPath,
1330
+ relativeFilePath
1331
+ }) {
1332
+ return new _CodexcliCommand({
1333
+ baseDir,
1334
+ relativeDirPath,
1335
+ relativeFilePath,
1336
+ fileContent: "",
1337
+ validate: false
1338
+ });
1339
+ }
1264
1340
  };
1265
1341
 
1266
1342
  // src/features/commands/copilot-command.ts
1267
1343
  import { basename as basename7, join as join9 } from "path";
1268
1344
  import { z as z8 } from "zod/mini";
1269
1345
  var CopilotCommandFrontmatterSchema = z8.looseObject({
1270
- mode: z8.literal("agent"),
1346
+ mode: z8.optional(z8.string()),
1271
1347
  description: z8.string()
1272
1348
  });
1273
1349
  var CopilotCommand = class _CopilotCommand extends ToolCommand {
@@ -1345,7 +1421,6 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
1345
1421
  const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
1346
1422
  const copilotFields = rulesyncFrontmatter.copilot ?? {};
1347
1423
  const copilotFrontmatter = {
1348
- mode: "agent",
1349
1424
  description: rulesyncFrontmatter.description,
1350
1425
  ...copilotFields
1351
1426
  };
@@ -1389,6 +1464,20 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
1389
1464
  toolTarget: "copilot"
1390
1465
  });
1391
1466
  }
1467
+ static forDeletion({
1468
+ baseDir = process.cwd(),
1469
+ relativeDirPath,
1470
+ relativeFilePath
1471
+ }) {
1472
+ return new _CopilotCommand({
1473
+ baseDir,
1474
+ relativeDirPath,
1475
+ relativeFilePath,
1476
+ frontmatter: { description: "" },
1477
+ body: "",
1478
+ validate: false
1479
+ });
1480
+ }
1392
1481
  };
1393
1482
 
1394
1483
  // src/features/commands/cursor-command.ts
@@ -1460,6 +1549,19 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
1460
1549
  validate
1461
1550
  });
1462
1551
  }
1552
+ static forDeletion({
1553
+ baseDir = process.cwd(),
1554
+ relativeDirPath,
1555
+ relativeFilePath
1556
+ }) {
1557
+ return new _CursorCommand({
1558
+ baseDir,
1559
+ relativeDirPath,
1560
+ relativeFilePath,
1561
+ fileContent: "",
1562
+ validate: false
1563
+ });
1564
+ }
1463
1565
  };
1464
1566
 
1465
1567
  // src/features/commands/geminicli-command.ts
@@ -1587,6 +1689,21 @@ ${geminiFrontmatter.prompt}
1587
1689
  toolTarget: "geminicli"
1588
1690
  });
1589
1691
  }
1692
+ static forDeletion({
1693
+ baseDir = process.cwd(),
1694
+ relativeDirPath,
1695
+ relativeFilePath
1696
+ }) {
1697
+ const placeholderToml = `description = ""
1698
+ prompt = ""`;
1699
+ return new _GeminiCliCommand({
1700
+ baseDir,
1701
+ relativeDirPath,
1702
+ relativeFilePath,
1703
+ fileContent: placeholderToml,
1704
+ validate: false
1705
+ });
1706
+ }
1590
1707
  };
1591
1708
 
1592
1709
  // src/features/commands/opencode-command.ts
@@ -1713,6 +1830,20 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
1713
1830
  toolTarget: "opencode"
1714
1831
  });
1715
1832
  }
1833
+ static forDeletion({
1834
+ baseDir = process.cwd(),
1835
+ relativeDirPath,
1836
+ relativeFilePath
1837
+ }) {
1838
+ return new _OpenCodeCommand({
1839
+ baseDir,
1840
+ relativeDirPath,
1841
+ relativeFilePath,
1842
+ frontmatter: { description: "" },
1843
+ body: "",
1844
+ validate: false
1845
+ });
1846
+ }
1716
1847
  };
1717
1848
 
1718
1849
  // src/features/commands/roo-command.ts
@@ -1839,6 +1970,21 @@ var RooCommand = class _RooCommand extends ToolCommand {
1839
1970
  validate
1840
1971
  });
1841
1972
  }
1973
+ static forDeletion({
1974
+ baseDir = process.cwd(),
1975
+ relativeDirPath,
1976
+ relativeFilePath
1977
+ }) {
1978
+ return new _RooCommand({
1979
+ baseDir,
1980
+ relativeDirPath,
1981
+ relativeFilePath,
1982
+ frontmatter: { description: "" },
1983
+ body: "",
1984
+ fileContent: "",
1985
+ validate: false
1986
+ });
1987
+ }
1842
1988
  };
1843
1989
 
1844
1990
  // src/features/commands/commands-processor.ts
@@ -2021,6 +2167,18 @@ var CommandsProcessor = class extends FeatureProcessor {
2021
2167
  const commandFilePaths = await findFilesByGlobs(
2022
2168
  join14(this.baseDir, paths.relativeDirPath, `*.${factory.meta.extension}`)
2023
2169
  );
2170
+ if (forDeletion) {
2171
+ const toolCommands2 = commandFilePaths.map(
2172
+ (path3) => factory.class.forDeletion({
2173
+ baseDir: this.baseDir,
2174
+ relativeDirPath: paths.relativeDirPath,
2175
+ relativeFilePath: basename12(path3),
2176
+ global: this.global
2177
+ })
2178
+ ).filter((cmd) => cmd.isDeletable());
2179
+ logger.info(`Successfully loaded ${toolCommands2.length} ${paths.relativeDirPath} commands`);
2180
+ return toolCommands2;
2181
+ }
2024
2182
  const toolCommands = await Promise.all(
2025
2183
  commandFilePaths.map(
2026
2184
  (path3) => factory.class.fromFile({
@@ -2030,9 +2188,8 @@ var CommandsProcessor = class extends FeatureProcessor {
2030
2188
  })
2031
2189
  )
2032
2190
  );
2033
- const result = forDeletion ? toolCommands.filter((cmd) => cmd.isDeletable()) : toolCommands;
2034
- logger.info(`Successfully loaded ${result.length} ${paths.relativeDirPath} commands`);
2035
- return result;
2191
+ logger.info(`Successfully loaded ${toolCommands.length} ${paths.relativeDirPath} commands`);
2192
+ return toolCommands;
2036
2193
  }
2037
2194
  /**
2038
2195
  * Implementation of abstract method from FeatureProcessor
@@ -2161,6 +2318,14 @@ var ToolIgnore = class extends ToolFile {
2161
2318
  static async fromFile(_params) {
2162
2319
  throw new Error("Please implement this method in the subclass.");
2163
2320
  }
2321
+ /**
2322
+ * Create a minimal instance for deletion purposes.
2323
+ * This method does not read or parse file content, making it safe to use
2324
+ * even when files have old/incompatible formats.
2325
+ */
2326
+ static forDeletion(_params) {
2327
+ throw new Error("Please implement this method in the subclass.");
2328
+ }
2164
2329
  };
2165
2330
 
2166
2331
  // src/features/ignore/amazonqcli-ignore.ts
@@ -2216,6 +2381,19 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
2216
2381
  validate
2217
2382
  });
2218
2383
  }
2384
+ static forDeletion({
2385
+ baseDir = process.cwd(),
2386
+ relativeDirPath,
2387
+ relativeFilePath
2388
+ }) {
2389
+ return new _AmazonqcliIgnore({
2390
+ baseDir,
2391
+ relativeDirPath,
2392
+ relativeFilePath,
2393
+ fileContent: "",
2394
+ validate: false
2395
+ });
2396
+ }
2219
2397
  };
2220
2398
 
2221
2399
  // src/features/ignore/augmentcode-ignore.ts
@@ -2271,6 +2449,19 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
2271
2449
  validate
2272
2450
  });
2273
2451
  }
2452
+ static forDeletion({
2453
+ baseDir = process.cwd(),
2454
+ relativeDirPath,
2455
+ relativeFilePath
2456
+ }) {
2457
+ return new _AugmentcodeIgnore({
2458
+ baseDir,
2459
+ relativeDirPath,
2460
+ relativeFilePath,
2461
+ fileContent: "",
2462
+ validate: false
2463
+ });
2464
+ }
2274
2465
  };
2275
2466
 
2276
2467
  // src/features/ignore/claudecode-ignore.ts
@@ -2367,6 +2558,19 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
2367
2558
  validate
2368
2559
  });
2369
2560
  }
2561
+ static forDeletion({
2562
+ baseDir = process.cwd(),
2563
+ relativeDirPath,
2564
+ relativeFilePath
2565
+ }) {
2566
+ return new _ClaudecodeIgnore({
2567
+ baseDir,
2568
+ relativeDirPath,
2569
+ relativeFilePath,
2570
+ fileContent: "{}",
2571
+ validate: false
2572
+ });
2573
+ }
2370
2574
  };
2371
2575
 
2372
2576
  // src/features/ignore/cline-ignore.ts
@@ -2421,6 +2625,19 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
2421
2625
  validate
2422
2626
  });
2423
2627
  }
2628
+ static forDeletion({
2629
+ baseDir = process.cwd(),
2630
+ relativeDirPath,
2631
+ relativeFilePath
2632
+ }) {
2633
+ return new _ClineIgnore({
2634
+ baseDir,
2635
+ relativeDirPath,
2636
+ relativeFilePath,
2637
+ fileContent: "",
2638
+ validate: false
2639
+ });
2640
+ }
2424
2641
  };
2425
2642
 
2426
2643
  // src/features/ignore/cursor-ignore.ts
@@ -2471,6 +2688,19 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
2471
2688
  validate
2472
2689
  });
2473
2690
  }
2691
+ static forDeletion({
2692
+ baseDir = process.cwd(),
2693
+ relativeDirPath,
2694
+ relativeFilePath
2695
+ }) {
2696
+ return new _CursorIgnore({
2697
+ baseDir,
2698
+ relativeDirPath,
2699
+ relativeFilePath,
2700
+ fileContent: "",
2701
+ validate: false
2702
+ });
2703
+ }
2474
2704
  };
2475
2705
 
2476
2706
  // src/features/ignore/geminicli-ignore.ts
@@ -2515,6 +2745,19 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
2515
2745
  validate
2516
2746
  });
2517
2747
  }
2748
+ static forDeletion({
2749
+ baseDir = process.cwd(),
2750
+ relativeDirPath,
2751
+ relativeFilePath
2752
+ }) {
2753
+ return new _GeminiCliIgnore({
2754
+ baseDir,
2755
+ relativeDirPath,
2756
+ relativeFilePath,
2757
+ fileContent: "",
2758
+ validate: false
2759
+ });
2760
+ }
2518
2761
  };
2519
2762
 
2520
2763
  // src/features/ignore/junie-ignore.ts
@@ -2559,6 +2802,19 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
2559
2802
  validate
2560
2803
  });
2561
2804
  }
2805
+ static forDeletion({
2806
+ baseDir = process.cwd(),
2807
+ relativeDirPath,
2808
+ relativeFilePath
2809
+ }) {
2810
+ return new _JunieIgnore({
2811
+ baseDir,
2812
+ relativeDirPath,
2813
+ relativeFilePath,
2814
+ fileContent: "",
2815
+ validate: false
2816
+ });
2817
+ }
2562
2818
  };
2563
2819
 
2564
2820
  // src/features/ignore/kiro-ignore.ts
@@ -2603,6 +2859,19 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
2603
2859
  validate
2604
2860
  });
2605
2861
  }
2862
+ static forDeletion({
2863
+ baseDir = process.cwd(),
2864
+ relativeDirPath,
2865
+ relativeFilePath
2866
+ }) {
2867
+ return new _KiroIgnore({
2868
+ baseDir,
2869
+ relativeDirPath,
2870
+ relativeFilePath,
2871
+ fileContent: "",
2872
+ validate: false
2873
+ });
2874
+ }
2606
2875
  };
2607
2876
 
2608
2877
  // src/features/ignore/qwencode-ignore.ts
@@ -2647,6 +2916,19 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
2647
2916
  validate
2648
2917
  });
2649
2918
  }
2919
+ static forDeletion({
2920
+ baseDir = process.cwd(),
2921
+ relativeDirPath,
2922
+ relativeFilePath
2923
+ }) {
2924
+ return new _QwencodeIgnore({
2925
+ baseDir,
2926
+ relativeDirPath,
2927
+ relativeFilePath,
2928
+ fileContent: "",
2929
+ validate: false
2930
+ });
2931
+ }
2650
2932
  };
2651
2933
 
2652
2934
  // src/features/ignore/roo-ignore.ts
@@ -2691,6 +2973,19 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
2691
2973
  validate
2692
2974
  });
2693
2975
  }
2976
+ static forDeletion({
2977
+ baseDir = process.cwd(),
2978
+ relativeDirPath,
2979
+ relativeFilePath
2980
+ }) {
2981
+ return new _RooIgnore({
2982
+ baseDir,
2983
+ relativeDirPath,
2984
+ relativeFilePath,
2985
+ fileContent: "",
2986
+ validate: false
2987
+ });
2988
+ }
2694
2989
  };
2695
2990
 
2696
2991
  // src/features/ignore/windsurf-ignore.ts
@@ -2735,6 +3030,19 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
2735
3030
  validate
2736
3031
  });
2737
3032
  }
3033
+ static forDeletion({
3034
+ baseDir = process.cwd(),
3035
+ relativeDirPath,
3036
+ relativeFilePath
3037
+ }) {
3038
+ return new _WindsurfIgnore({
3039
+ baseDir,
3040
+ relativeDirPath,
3041
+ relativeFilePath,
3042
+ fileContent: "",
3043
+ validate: false
3044
+ });
3045
+ }
2738
3046
  };
2739
3047
 
2740
3048
  // src/features/ignore/ignore-processor.ts
@@ -2814,10 +3122,18 @@ var IgnoreProcessor = class extends FeatureProcessor {
2814
3122
  forDeletion = false
2815
3123
  } = {}) {
2816
3124
  try {
2817
- const toolIgnores = await this.loadToolIgnores();
3125
+ const factory = this.getFactory(this.toolTarget);
3126
+ const paths = factory.class.getSettablePaths();
2818
3127
  if (forDeletion) {
2819
- return toolIgnores.filter((toolFile) => toolFile.isDeletable());
3128
+ const toolIgnore = factory.class.forDeletion({
3129
+ baseDir: this.baseDir,
3130
+ relativeDirPath: paths.relativeDirPath,
3131
+ relativeFilePath: paths.relativeFilePath
3132
+ });
3133
+ const toolIgnores2 = toolIgnore.isDeletable() ? [toolIgnore] : [];
3134
+ return toolIgnores2;
2820
3135
  }
3136
+ const toolIgnores = await this.loadToolIgnores();
2821
3137
  return toolIgnores;
2822
3138
  } catch (error) {
2823
3139
  const errorMessage = `Failed to load tool files: ${formatError(error)}`;
@@ -3062,6 +3378,14 @@ var ToolMcp = class extends ToolFile {
3062
3378
  static async fromFile(_params) {
3063
3379
  throw new Error("Please implement this method in the subclass.");
3064
3380
  }
3381
+ /**
3382
+ * Create a minimal instance for deletion purposes.
3383
+ * This method does not read or parse file content, making it safe to use
3384
+ * even when files have old/incompatible formats.
3385
+ */
3386
+ static forDeletion(_params) {
3387
+ throw new Error("Please implement this method in the subclass.");
3388
+ }
3065
3389
  static fromRulesyncMcp(_params) {
3066
3390
  throw new Error("Please implement this method in the subclass.");
3067
3391
  }
@@ -3121,10 +3445,23 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
3121
3445
  validate() {
3122
3446
  return { success: true, error: null };
3123
3447
  }
3124
- };
3125
-
3126
- // src/features/mcp/claudecode-mcp.ts
3127
- import { join as join30 } from "path";
3448
+ static forDeletion({
3449
+ baseDir = process.cwd(),
3450
+ relativeDirPath,
3451
+ relativeFilePath
3452
+ }) {
3453
+ return new _AmazonqcliMcp({
3454
+ baseDir,
3455
+ relativeDirPath,
3456
+ relativeFilePath,
3457
+ fileContent: "{}",
3458
+ validate: false
3459
+ });
3460
+ }
3461
+ };
3462
+
3463
+ // src/features/mcp/claudecode-mcp.ts
3464
+ import { join as join30 } from "path";
3128
3465
 
3129
3466
  // src/features/mcp/modular-mcp.ts
3130
3467
  import { join as join29 } from "path";
@@ -3317,6 +3654,19 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
3317
3654
  validate() {
3318
3655
  return { success: true, error: null };
3319
3656
  }
3657
+ static forDeletion({
3658
+ baseDir = process.cwd(),
3659
+ relativeDirPath,
3660
+ relativeFilePath
3661
+ }) {
3662
+ return new _ClaudecodeMcp({
3663
+ baseDir,
3664
+ relativeDirPath,
3665
+ relativeFilePath,
3666
+ fileContent: "{}",
3667
+ validate: false
3668
+ });
3669
+ }
3320
3670
  };
3321
3671
 
3322
3672
  // src/features/mcp/cline-mcp.ts
@@ -3374,6 +3724,19 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
3374
3724
  validate() {
3375
3725
  return { success: true, error: null };
3376
3726
  }
3727
+ static forDeletion({
3728
+ baseDir = process.cwd(),
3729
+ relativeDirPath,
3730
+ relativeFilePath
3731
+ }) {
3732
+ return new _ClineMcp({
3733
+ baseDir,
3734
+ relativeDirPath,
3735
+ relativeFilePath,
3736
+ fileContent: "{}",
3737
+ validate: false
3738
+ });
3739
+ }
3377
3740
  };
3378
3741
 
3379
3742
  // src/features/mcp/codexcli-mcp.ts
@@ -3468,6 +3831,19 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
3468
3831
  }
3469
3832
  return filtered;
3470
3833
  }
3834
+ static forDeletion({
3835
+ baseDir = process.cwd(),
3836
+ relativeDirPath,
3837
+ relativeFilePath
3838
+ }) {
3839
+ return new _CodexcliMcp({
3840
+ baseDir,
3841
+ relativeDirPath,
3842
+ relativeFilePath,
3843
+ fileContent: "",
3844
+ validate: false
3845
+ });
3846
+ }
3471
3847
  };
3472
3848
 
3473
3849
  // src/features/mcp/copilot-mcp.ts
@@ -3535,6 +3911,19 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
3535
3911
  validate() {
3536
3912
  return { success: true, error: null };
3537
3913
  }
3914
+ static forDeletion({
3915
+ baseDir = process.cwd(),
3916
+ relativeDirPath,
3917
+ relativeFilePath
3918
+ }) {
3919
+ return new _CopilotMcp({
3920
+ baseDir,
3921
+ relativeDirPath,
3922
+ relativeFilePath,
3923
+ fileContent: "{}",
3924
+ validate: false
3925
+ });
3926
+ }
3538
3927
  };
3539
3928
 
3540
3929
  // src/features/mcp/cursor-mcp.ts
@@ -3603,6 +3992,19 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
3603
3992
  validate() {
3604
3993
  return { success: true, error: null };
3605
3994
  }
3995
+ static forDeletion({
3996
+ baseDir = process.cwd(),
3997
+ relativeDirPath,
3998
+ relativeFilePath
3999
+ }) {
4000
+ return new _CursorMcp({
4001
+ baseDir,
4002
+ relativeDirPath,
4003
+ relativeFilePath,
4004
+ fileContent: "{}",
4005
+ validate: false
4006
+ });
4007
+ }
3606
4008
  };
3607
4009
 
3608
4010
  // src/features/mcp/geminicli-mcp.ts
@@ -3677,6 +4079,19 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
3677
4079
  validate() {
3678
4080
  return { success: true, error: null };
3679
4081
  }
4082
+ static forDeletion({
4083
+ baseDir = process.cwd(),
4084
+ relativeDirPath,
4085
+ relativeFilePath
4086
+ }) {
4087
+ return new _GeminiCliMcp({
4088
+ baseDir,
4089
+ relativeDirPath,
4090
+ relativeFilePath,
4091
+ fileContent: "{}",
4092
+ validate: false
4093
+ });
4094
+ }
3680
4095
  };
3681
4096
 
3682
4097
  // src/features/mcp/junie-mcp.ts
@@ -3734,6 +4149,19 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
3734
4149
  validate() {
3735
4150
  return { success: true, error: null };
3736
4151
  }
4152
+ static forDeletion({
4153
+ baseDir = process.cwd(),
4154
+ relativeDirPath,
4155
+ relativeFilePath
4156
+ }) {
4157
+ return new _JunieMcp({
4158
+ baseDir,
4159
+ relativeDirPath,
4160
+ relativeFilePath,
4161
+ fileContent: "{}",
4162
+ validate: false
4163
+ });
4164
+ }
3737
4165
  };
3738
4166
 
3739
4167
  // src/features/mcp/opencode-mcp.ts
@@ -3910,6 +4338,19 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
3910
4338
  }
3911
4339
  return { success: true, error: null };
3912
4340
  }
4341
+ static forDeletion({
4342
+ baseDir = process.cwd(),
4343
+ relativeDirPath,
4344
+ relativeFilePath
4345
+ }) {
4346
+ return new _OpencodeMcp({
4347
+ baseDir,
4348
+ relativeDirPath,
4349
+ relativeFilePath,
4350
+ fileContent: "{}",
4351
+ validate: false
4352
+ });
4353
+ }
3913
4354
  };
3914
4355
 
3915
4356
  // src/features/mcp/roo-mcp.ts
@@ -4005,6 +4446,19 @@ var RooMcp = class _RooMcp extends ToolMcp {
4005
4446
  validate() {
4006
4447
  return { success: true, error: null };
4007
4448
  }
4449
+ static forDeletion({
4450
+ baseDir = process.cwd(),
4451
+ relativeDirPath,
4452
+ relativeFilePath
4453
+ }) {
4454
+ return new _RooMcp({
4455
+ baseDir,
4456
+ relativeDirPath,
4457
+ relativeFilePath,
4458
+ fileContent: "{}",
4459
+ validate: false
4460
+ });
4461
+ }
4008
4462
  };
4009
4463
 
4010
4464
  // src/features/mcp/mcp-processor.ts
@@ -4158,6 +4612,18 @@ var McpProcessor = class extends FeatureProcessor {
4158
4612
  } = {}) {
4159
4613
  try {
4160
4614
  const factory = this.getFactory(this.toolTarget);
4615
+ const paths = factory.class.getSettablePaths({ global: this.global });
4616
+ if (forDeletion) {
4617
+ const toolMcp = factory.class.forDeletion({
4618
+ baseDir: this.baseDir,
4619
+ relativeDirPath: paths.relativeDirPath,
4620
+ relativeFilePath: paths.relativeFilePath,
4621
+ global: this.global
4622
+ });
4623
+ const toolMcps2 = toolMcp.isDeletable() ? [toolMcp] : [];
4624
+ logger.info(`Successfully loaded ${toolMcps2.length} ${this.toolTarget} MCP files`);
4625
+ return toolMcps2;
4626
+ }
4161
4627
  const toolMcps = [
4162
4628
  await factory.class.fromFile({
4163
4629
  baseDir: this.baseDir,
@@ -4166,9 +4632,6 @@ var McpProcessor = class extends FeatureProcessor {
4166
4632
  })
4167
4633
  ];
4168
4634
  logger.info(`Successfully loaded ${toolMcps.length} ${this.toolTarget} MCP files`);
4169
- if (forDeletion) {
4170
- return toolMcps.filter((toolFile) => toolFile.isDeletable());
4171
- }
4172
4635
  return toolMcps;
4173
4636
  } catch (error) {
4174
4637
  const errorMessage = `Failed to load MCP files for tool target: ${this.toolTarget}: ${formatError(error)}`;
@@ -4241,9 +4704,9 @@ var McpProcessor = class extends FeatureProcessor {
4241
4704
  };
4242
4705
 
4243
4706
  // src/features/rules/rules-processor.ts
4244
- import { basename as basename20, join as join82 } from "path";
4707
+ import { basename as basename20, join as join83 } from "path";
4245
4708
  import { encode } from "@toon-format/toon";
4246
- import { z as z34 } from "zod/mini";
4709
+ import { z as z37 } from "zod/mini";
4247
4710
 
4248
4711
  // src/constants/general.ts
4249
4712
  var SKILL_FILE_NAME = "SKILL.md";
@@ -4397,6 +4860,14 @@ var ToolSkill = class extends AiDir {
4397
4860
  static async fromDir(_params) {
4398
4861
  throw new Error("Please implement this method in the subclass.");
4399
4862
  }
4863
+ /**
4864
+ * Create a minimal instance for deletion purposes.
4865
+ * This method does not read or parse directory content, making it safe to use
4866
+ * even when skill files have old/incompatible formats.
4867
+ */
4868
+ static forDeletion(_params) {
4869
+ throw new Error("Please implement this method in the subclass.");
4870
+ }
4400
4871
  /**
4401
4872
  * Convert a RulesyncSkill to the tool-specific skill format.
4402
4873
  *
@@ -4470,7 +4941,7 @@ var ToolSkill = class extends AiDir {
4470
4941
  };
4471
4942
 
4472
4943
  // src/features/skills/simulated-skill.ts
4473
- var SimulatedSkillFrontmatterSchema = z19.object({
4944
+ var SimulatedSkillFrontmatterSchema = z19.looseObject({
4474
4945
  name: z19.string(),
4475
4946
  description: z19.string()
4476
4947
  });
@@ -4588,6 +5059,26 @@ var SimulatedSkill = class extends ToolSkill {
4588
5059
  validate: true
4589
5060
  };
4590
5061
  }
5062
+ /**
5063
+ * Create minimal params for deletion purposes.
5064
+ * This method does not read or parse directory content, making it safe to use
5065
+ * even when skill files have old/incompatible formats.
5066
+ */
5067
+ static forDeletionDefault({
5068
+ baseDir = process.cwd(),
5069
+ relativeDirPath,
5070
+ dirName
5071
+ }) {
5072
+ return {
5073
+ baseDir,
5074
+ relativeDirPath,
5075
+ dirName,
5076
+ frontmatter: { name: "", description: "" },
5077
+ body: "",
5078
+ otherFiles: [],
5079
+ validate: false
5080
+ };
5081
+ }
4591
5082
  /**
4592
5083
  * Check if a RulesyncSkill should be converted to this simulated skill type.
4593
5084
  * Uses the targets field in the RulesyncSkill frontmatter to determine targeting.
@@ -4639,26 +5130,156 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
4639
5130
  toolTarget: "agentsmd"
4640
5131
  });
4641
5132
  }
5133
+ static forDeletion(params) {
5134
+ const baseParams = this.forDeletionDefault(params);
5135
+ return new _AgentsmdSkill(baseParams);
5136
+ }
4642
5137
  };
4643
5138
 
4644
- // src/features/skills/codexcli-skill.ts
5139
+ // src/features/skills/cursor-skill.ts
5140
+ import { join as join43 } from "path";
5141
+ var CursorSkill = class _CursorSkill extends SimulatedSkill {
5142
+ static getSettablePaths(options) {
5143
+ if (options?.global) {
5144
+ throw new Error("CursorSkill does not support global mode.");
5145
+ }
5146
+ return {
5147
+ relativeDirPath: join43(".cursor", "skills")
5148
+ };
5149
+ }
5150
+ static async fromDir(params) {
5151
+ const baseParams = await this.fromDirDefault(params);
5152
+ return new _CursorSkill(baseParams);
5153
+ }
5154
+ static fromRulesyncSkill(params) {
5155
+ const baseParams = {
5156
+ ...this.fromRulesyncSkillDefault(params),
5157
+ relativeDirPath: this.getSettablePaths().relativeDirPath
5158
+ };
5159
+ return new _CursorSkill(baseParams);
5160
+ }
5161
+ static isTargetedByRulesyncSkill(rulesyncSkill) {
5162
+ return this.isTargetedByRulesyncSkillDefault({
5163
+ rulesyncSkill,
5164
+ toolTarget: "cursor"
5165
+ });
5166
+ }
5167
+ static forDeletion(params) {
5168
+ const baseParams = this.forDeletionDefault(params);
5169
+ return new _CursorSkill(baseParams);
5170
+ }
5171
+ };
5172
+
5173
+ // src/features/skills/geminicli-skill.ts
4645
5174
  import { join as join44 } from "path";
5175
+ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
5176
+ static getSettablePaths(options) {
5177
+ if (options?.global) {
5178
+ throw new Error("GeminiCliSkill does not support global mode.");
5179
+ }
5180
+ return {
5181
+ relativeDirPath: join44(".gemini", "skills")
5182
+ };
5183
+ }
5184
+ static async fromDir(params) {
5185
+ const baseParams = await this.fromDirDefault(params);
5186
+ return new _GeminiCliSkill(baseParams);
5187
+ }
5188
+ static fromRulesyncSkill(params) {
5189
+ const baseParams = {
5190
+ ...this.fromRulesyncSkillDefault(params),
5191
+ relativeDirPath: this.getSettablePaths().relativeDirPath
5192
+ };
5193
+ return new _GeminiCliSkill(baseParams);
5194
+ }
5195
+ static isTargetedByRulesyncSkill(rulesyncSkill) {
5196
+ return this.isTargetedByRulesyncSkillDefault({
5197
+ rulesyncSkill,
5198
+ toolTarget: "geminicli"
5199
+ });
5200
+ }
5201
+ static forDeletion(params) {
5202
+ const baseParams = this.forDeletionDefault(params);
5203
+ return new _GeminiCliSkill(baseParams);
5204
+ }
5205
+ };
5206
+
5207
+ // src/features/skills/skills-processor.ts
5208
+ import { basename as basename14, join as join51 } from "path";
5209
+ import { z as z25 } from "zod/mini";
5210
+
5211
+ // src/types/dir-feature-processor.ts
5212
+ import { join as join45 } from "path";
5213
+ var DirFeatureProcessor = class {
5214
+ baseDir;
5215
+ constructor({ baseDir = process.cwd() }) {
5216
+ this.baseDir = baseDir;
5217
+ }
5218
+ /**
5219
+ * Return tool targets that this feature supports.
5220
+ */
5221
+ static getToolTargets(_params = {}) {
5222
+ throw new Error("Not implemented");
5223
+ }
5224
+ /**
5225
+ * Once converted to rulesync/tool dirs, write them to the filesystem.
5226
+ * Returns the number of directories written.
5227
+ */
5228
+ async writeAiDirs(aiDirs) {
5229
+ for (const aiDir of aiDirs) {
5230
+ const dirPath = aiDir.getDirPath();
5231
+ await ensureDir(dirPath);
5232
+ const mainFile = aiDir.getMainFile();
5233
+ if (mainFile) {
5234
+ const mainFilePath = join45(dirPath, mainFile.name);
5235
+ const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
5236
+ const contentWithNewline = addTrailingNewline(content);
5237
+ await writeFileContent(mainFilePath, contentWithNewline);
5238
+ }
5239
+ const otherFiles = aiDir.getOtherFiles();
5240
+ for (const file of otherFiles) {
5241
+ const filePath = join45(dirPath, file.relativeFilePathToDirPath);
5242
+ const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
5243
+ await writeFileContent(filePath, contentWithNewline);
5244
+ }
5245
+ }
5246
+ return aiDirs.length;
5247
+ }
5248
+ async removeAiDirs(aiDirs) {
5249
+ for (const aiDir of aiDirs) {
5250
+ await removeDirectory(aiDir.getDirPath());
5251
+ }
5252
+ }
5253
+ };
5254
+
5255
+ // src/features/skills/claudecode-skill.ts
5256
+ import { join as join47 } from "path";
4646
5257
  import { z as z21 } from "zod/mini";
4647
5258
 
4648
5259
  // src/features/skills/rulesync-skill.ts
4649
- import { join as join43 } from "path";
5260
+ import { join as join46 } from "path";
4650
5261
  import { z as z20 } from "zod/mini";
4651
- var RulesyncSkillFrontmatterSchemaInternal = z20.object({
5262
+ var RulesyncSkillFrontmatterSchemaInternal = z20.looseObject({
4652
5263
  name: z20.string(),
4653
5264
  description: z20.string(),
4654
5265
  targets: z20._default(RulesyncTargetsSchema, ["*"]),
4655
5266
  claudecode: z20.optional(
4656
- z20.object({
5267
+ z20.looseObject({
4657
5268
  "allowed-tools": z20.optional(z20.array(z20.string()))
4658
5269
  })
4659
- )
4660
- });
4661
- var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
5270
+ ),
5271
+ opencode: z20.optional(
5272
+ z20.looseObject({
5273
+ "allowed-tools": z20.optional(z20.array(z20.string()))
5274
+ })
5275
+ ),
5276
+ copilot: z20.optional(
5277
+ z20.looseObject({
5278
+ license: z20.optional(z20.string())
5279
+ })
5280
+ )
5281
+ });
5282
+ var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
4662
5283
  var RulesyncSkill = class _RulesyncSkill extends AiDir {
4663
5284
  constructor({
4664
5285
  baseDir = process.cwd(),
@@ -4722,8 +5343,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
4722
5343
  dirName,
4723
5344
  global = false
4724
5345
  }) {
4725
- const skillDirPath = join43(baseDir, relativeDirPath, dirName);
4726
- const skillFilePath = join43(skillDirPath, SKILL_FILE_NAME);
5346
+ const skillDirPath = join46(baseDir, relativeDirPath, dirName);
5347
+ const skillFilePath = join46(skillDirPath, SKILL_FILE_NAME);
4727
5348
  if (!await fileExists(skillFilePath)) {
4728
5349
  throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
4729
5350
  }
@@ -4752,15 +5373,180 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
4752
5373
  }
4753
5374
  };
4754
5375
 
4755
- // src/features/skills/codexcli-skill.ts
4756
- var CodexCliSkillFrontmatterSchema = z21.object({
5376
+ // src/features/skills/claudecode-skill.ts
5377
+ var ClaudecodeSkillFrontmatterSchema = z21.looseObject({
4757
5378
  name: z21.string(),
4758
- description: z21.string()
5379
+ description: z21.string(),
5380
+ "allowed-tools": z21.optional(z21.array(z21.string()))
5381
+ });
5382
+ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
5383
+ constructor({
5384
+ baseDir = process.cwd(),
5385
+ relativeDirPath = join47(".claude", "skills"),
5386
+ dirName,
5387
+ frontmatter,
5388
+ body,
5389
+ otherFiles = [],
5390
+ validate = true,
5391
+ global = false
5392
+ }) {
5393
+ super({
5394
+ baseDir,
5395
+ relativeDirPath,
5396
+ dirName,
5397
+ mainFile: {
5398
+ name: SKILL_FILE_NAME,
5399
+ body,
5400
+ frontmatter: { ...frontmatter }
5401
+ },
5402
+ otherFiles,
5403
+ global
5404
+ });
5405
+ if (validate) {
5406
+ const result = this.validate();
5407
+ if (!result.success) {
5408
+ throw result.error;
5409
+ }
5410
+ }
5411
+ }
5412
+ static getSettablePaths({
5413
+ global: _global = false
5414
+ } = {}) {
5415
+ return {
5416
+ relativeDirPath: join47(".claude", "skills")
5417
+ };
5418
+ }
5419
+ getFrontmatter() {
5420
+ if (!this.mainFile?.frontmatter) {
5421
+ throw new Error("Frontmatter is not defined");
5422
+ }
5423
+ const result = ClaudecodeSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
5424
+ return result;
5425
+ }
5426
+ getBody() {
5427
+ return this.mainFile?.body ?? "";
5428
+ }
5429
+ validate() {
5430
+ if (this.mainFile === void 0) {
5431
+ return {
5432
+ success: false,
5433
+ error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
5434
+ };
5435
+ }
5436
+ const result = ClaudecodeSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
5437
+ if (!result.success) {
5438
+ return {
5439
+ success: false,
5440
+ error: new Error(
5441
+ `Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
5442
+ )
5443
+ };
5444
+ }
5445
+ return { success: true, error: null };
5446
+ }
5447
+ toRulesyncSkill() {
5448
+ const frontmatter = this.getFrontmatter();
5449
+ const rulesyncFrontmatter = {
5450
+ name: frontmatter.name,
5451
+ description: frontmatter.description,
5452
+ targets: ["*"],
5453
+ ...frontmatter["allowed-tools"] && {
5454
+ claudecode: {
5455
+ "allowed-tools": frontmatter["allowed-tools"]
5456
+ }
5457
+ }
5458
+ };
5459
+ return new RulesyncSkill({
5460
+ baseDir: this.baseDir,
5461
+ relativeDirPath: this.relativeDirPath,
5462
+ dirName: this.getDirName(),
5463
+ frontmatter: rulesyncFrontmatter,
5464
+ body: this.getBody(),
5465
+ otherFiles: this.getOtherFiles(),
5466
+ validate: true,
5467
+ global: this.global
5468
+ });
5469
+ }
5470
+ static fromRulesyncSkill({
5471
+ rulesyncSkill,
5472
+ validate = true,
5473
+ global = false
5474
+ }) {
5475
+ const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
5476
+ const claudecodeFrontmatter = {
5477
+ name: rulesyncFrontmatter.name,
5478
+ description: rulesyncFrontmatter.description,
5479
+ "allowed-tools": rulesyncFrontmatter.claudecode?.["allowed-tools"]
5480
+ };
5481
+ const settablePaths = _ClaudecodeSkill.getSettablePaths({ global });
5482
+ return new _ClaudecodeSkill({
5483
+ baseDir: rulesyncSkill.getBaseDir(),
5484
+ relativeDirPath: settablePaths.relativeDirPath,
5485
+ dirName: rulesyncSkill.getDirName(),
5486
+ frontmatter: claudecodeFrontmatter,
5487
+ body: rulesyncSkill.getBody(),
5488
+ otherFiles: rulesyncSkill.getOtherFiles(),
5489
+ validate,
5490
+ global
5491
+ });
5492
+ }
5493
+ static isTargetedByRulesyncSkill(rulesyncSkill) {
5494
+ const targets = rulesyncSkill.getFrontmatter().targets;
5495
+ return targets.includes("*") || targets.includes("claudecode");
5496
+ }
5497
+ static async fromDir(params) {
5498
+ const loaded = await this.loadSkillDirContent({
5499
+ ...params,
5500
+ getSettablePaths: _ClaudecodeSkill.getSettablePaths
5501
+ });
5502
+ const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
5503
+ if (!result.success) {
5504
+ const skillDirPath = join47(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
5505
+ throw new Error(
5506
+ `Invalid frontmatter in ${join47(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
5507
+ );
5508
+ }
5509
+ return new _ClaudecodeSkill({
5510
+ baseDir: loaded.baseDir,
5511
+ relativeDirPath: loaded.relativeDirPath,
5512
+ dirName: loaded.dirName,
5513
+ frontmatter: result.data,
5514
+ body: loaded.body,
5515
+ otherFiles: loaded.otherFiles,
5516
+ validate: true,
5517
+ global: loaded.global
5518
+ });
5519
+ }
5520
+ static forDeletion({
5521
+ baseDir = process.cwd(),
5522
+ relativeDirPath,
5523
+ dirName,
5524
+ global = false
5525
+ }) {
5526
+ return new _ClaudecodeSkill({
5527
+ baseDir,
5528
+ relativeDirPath,
5529
+ dirName,
5530
+ frontmatter: { name: "", description: "" },
5531
+ body: "",
5532
+ otherFiles: [],
5533
+ validate: false,
5534
+ global
5535
+ });
5536
+ }
5537
+ };
5538
+
5539
+ // src/features/skills/codexcli-skill.ts
5540
+ import { join as join48 } from "path";
5541
+ import { z as z22 } from "zod/mini";
5542
+ var CodexCliSkillFrontmatterSchema = z22.looseObject({
5543
+ name: z22.string(),
5544
+ description: z22.string()
4759
5545
  });
4760
5546
  var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
4761
5547
  constructor({
4762
5548
  baseDir = process.cwd(),
4763
- relativeDirPath = join44(".codex", "skills"),
5549
+ relativeDirPath = join48(".codex", "skills"),
4764
5550
  dirName,
4765
5551
  frontmatter,
4766
5552
  body,
@@ -4792,7 +5578,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
4792
5578
  throw new Error("CodexCliSkill only supports global mode. Please pass { global: true }.");
4793
5579
  }
4794
5580
  return {
4795
- relativeDirPath: join44(".codex", "skills")
5581
+ relativeDirPath: join48(".codex", "skills")
4796
5582
  };
4797
5583
  }
4798
5584
  getFrontmatter() {
@@ -4874,9 +5660,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
4874
5660
  });
4875
5661
  const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
4876
5662
  if (!result.success) {
4877
- const skillDirPath = join44(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
5663
+ const skillDirPath = join48(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
4878
5664
  throw new Error(
4879
- `Invalid frontmatter in ${join44(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
5665
+ `Invalid frontmatter in ${join48(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
4880
5666
  );
4881
5667
  }
4882
5668
  return new _CodexCliSkill({
@@ -4890,158 +5676,204 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
4890
5676
  global: loaded.global
4891
5677
  });
4892
5678
  }
5679
+ static forDeletion({
5680
+ baseDir = process.cwd(),
5681
+ relativeDirPath,
5682
+ dirName,
5683
+ global = false
5684
+ }) {
5685
+ return new _CodexCliSkill({
5686
+ baseDir,
5687
+ relativeDirPath,
5688
+ dirName,
5689
+ frontmatter: { name: "", description: "" },
5690
+ body: "",
5691
+ otherFiles: [],
5692
+ validate: false,
5693
+ global
5694
+ });
5695
+ }
4893
5696
  };
4894
5697
 
4895
5698
  // src/features/skills/copilot-skill.ts
4896
- import { join as join45 } from "path";
4897
- var CopilotSkill = class _CopilotSkill extends SimulatedSkill {
4898
- static getSettablePaths(options) {
4899
- if (options?.global) {
4900
- throw new Error("CopilotSkill does not support global mode.");
4901
- }
4902
- return {
4903
- relativeDirPath: join45(".github", "skills")
4904
- };
4905
- }
4906
- static async fromDir(params) {
4907
- const baseParams = await this.fromDirDefault(params);
4908
- return new _CopilotSkill(baseParams);
4909
- }
4910
- static fromRulesyncSkill(params) {
4911
- const baseParams = {
4912
- ...this.fromRulesyncSkillDefault(params),
4913
- relativeDirPath: this.getSettablePaths().relativeDirPath
4914
- };
4915
- return new _CopilotSkill(baseParams);
4916
- }
4917
- static isTargetedByRulesyncSkill(rulesyncSkill) {
4918
- return this.isTargetedByRulesyncSkillDefault({
4919
- rulesyncSkill,
4920
- toolTarget: "copilot"
5699
+ import { join as join49 } from "path";
5700
+ import { z as z23 } from "zod/mini";
5701
+ var CopilotSkillFrontmatterSchema = z23.looseObject({
5702
+ name: z23.string(),
5703
+ description: z23.string(),
5704
+ license: z23.optional(z23.string())
5705
+ });
5706
+ var CopilotSkill = class _CopilotSkill extends ToolSkill {
5707
+ constructor({
5708
+ baseDir = process.cwd(),
5709
+ relativeDirPath = join49(".github", "skills"),
5710
+ dirName,
5711
+ frontmatter,
5712
+ body,
5713
+ otherFiles = [],
5714
+ validate = true,
5715
+ global = false
5716
+ }) {
5717
+ super({
5718
+ baseDir,
5719
+ relativeDirPath,
5720
+ dirName,
5721
+ mainFile: {
5722
+ name: SKILL_FILE_NAME,
5723
+ body,
5724
+ frontmatter: { ...frontmatter }
5725
+ },
5726
+ otherFiles,
5727
+ global
4921
5728
  });
5729
+ if (validate) {
5730
+ const result = this.validate();
5731
+ if (!result.success) {
5732
+ throw result.error;
5733
+ }
5734
+ }
4922
5735
  }
4923
- };
4924
-
4925
- // src/features/skills/cursor-skill.ts
4926
- import { join as join46 } from "path";
4927
- var CursorSkill = class _CursorSkill extends SimulatedSkill {
4928
5736
  static getSettablePaths(options) {
4929
5737
  if (options?.global) {
4930
- throw new Error("CursorSkill does not support global mode.");
5738
+ throw new Error("CopilotSkill does not support global mode.");
4931
5739
  }
4932
5740
  return {
4933
- relativeDirPath: join46(".cursor", "skills")
5741
+ relativeDirPath: join49(".github", "skills")
4934
5742
  };
4935
5743
  }
4936
- static async fromDir(params) {
4937
- const baseParams = await this.fromDirDefault(params);
4938
- return new _CursorSkill(baseParams);
4939
- }
4940
- static fromRulesyncSkill(params) {
4941
- const baseParams = {
4942
- ...this.fromRulesyncSkillDefault(params),
4943
- relativeDirPath: this.getSettablePaths().relativeDirPath
4944
- };
4945
- return new _CursorSkill(baseParams);
5744
+ getFrontmatter() {
5745
+ if (!this.mainFile?.frontmatter) {
5746
+ throw new Error("Frontmatter is not defined");
5747
+ }
5748
+ const result = CopilotSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
5749
+ return result;
4946
5750
  }
4947
- static isTargetedByRulesyncSkill(rulesyncSkill) {
4948
- return this.isTargetedByRulesyncSkillDefault({
4949
- rulesyncSkill,
4950
- toolTarget: "cursor"
4951
- });
5751
+ getBody() {
5752
+ return this.mainFile?.body ?? "";
4952
5753
  }
4953
- };
4954
-
4955
- // src/features/skills/geminicli-skill.ts
4956
- import { join as join47 } from "path";
4957
- var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
4958
- static getSettablePaths(options) {
4959
- if (options?.global) {
4960
- throw new Error("GeminiCliSkill does not support global mode.");
5754
+ validate() {
5755
+ if (!this.mainFile) {
5756
+ return {
5757
+ success: false,
5758
+ error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
5759
+ };
4961
5760
  }
4962
- return {
4963
- relativeDirPath: join47(".gemini", "skills")
4964
- };
4965
- }
4966
- static async fromDir(params) {
4967
- const baseParams = await this.fromDirDefault(params);
4968
- return new _GeminiCliSkill(baseParams);
5761
+ const result = CopilotSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
5762
+ if (!result.success) {
5763
+ return {
5764
+ success: false,
5765
+ error: new Error(
5766
+ `Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
5767
+ )
5768
+ };
5769
+ }
5770
+ return { success: true, error: null };
4969
5771
  }
4970
- static fromRulesyncSkill(params) {
4971
- const baseParams = {
4972
- ...this.fromRulesyncSkillDefault(params),
4973
- relativeDirPath: this.getSettablePaths().relativeDirPath
5772
+ toRulesyncSkill() {
5773
+ const frontmatter = this.getFrontmatter();
5774
+ const rulesyncFrontmatter = {
5775
+ name: frontmatter.name,
5776
+ description: frontmatter.description,
5777
+ targets: ["*"],
5778
+ ...frontmatter.license && {
5779
+ copilot: {
5780
+ license: frontmatter.license
5781
+ }
5782
+ }
4974
5783
  };
4975
- return new _GeminiCliSkill(baseParams);
4976
- }
4977
- static isTargetedByRulesyncSkill(rulesyncSkill) {
4978
- return this.isTargetedByRulesyncSkillDefault({
4979
- rulesyncSkill,
4980
- toolTarget: "geminicli"
5784
+ return new RulesyncSkill({
5785
+ baseDir: this.baseDir,
5786
+ relativeDirPath: this.relativeDirPath,
5787
+ dirName: this.getDirName(),
5788
+ frontmatter: rulesyncFrontmatter,
5789
+ body: this.getBody(),
5790
+ otherFiles: this.getOtherFiles(),
5791
+ validate: true,
5792
+ global: this.global
4981
5793
  });
4982
5794
  }
4983
- };
4984
-
4985
- // src/features/skills/skills-processor.ts
4986
- import { basename as basename14, join as join50 } from "path";
4987
- import { z as z23 } from "zod/mini";
4988
-
4989
- // src/types/dir-feature-processor.ts
4990
- import { join as join48 } from "path";
4991
- var DirFeatureProcessor = class {
4992
- baseDir;
4993
- constructor({ baseDir = process.cwd() }) {
4994
- this.baseDir = baseDir;
4995
- }
4996
- /**
4997
- * Return tool targets that this feature supports.
4998
- */
4999
- static getToolTargets(_params = {}) {
5000
- throw new Error("Not implemented");
5001
- }
5002
- /**
5003
- * Once converted to rulesync/tool dirs, write them to the filesystem.
5004
- * Returns the number of directories written.
5005
- */
5006
- async writeAiDirs(aiDirs) {
5007
- for (const aiDir of aiDirs) {
5008
- const dirPath = aiDir.getDirPath();
5009
- await ensureDir(dirPath);
5010
- const mainFile = aiDir.getMainFile();
5011
- if (mainFile) {
5012
- const mainFilePath = join48(dirPath, mainFile.name);
5013
- const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
5014
- const contentWithNewline = addTrailingNewline(content);
5015
- await writeFileContent(mainFilePath, contentWithNewline);
5016
- }
5017
- const otherFiles = aiDir.getOtherFiles();
5018
- for (const file of otherFiles) {
5019
- const filePath = join48(dirPath, file.relativeFilePathToDirPath);
5020
- const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
5021
- await writeFileContent(filePath, contentWithNewline);
5022
- }
5023
- }
5024
- return aiDirs.length;
5795
+ static fromRulesyncSkill({
5796
+ rulesyncSkill,
5797
+ validate = true,
5798
+ global = false
5799
+ }) {
5800
+ const settablePaths = _CopilotSkill.getSettablePaths({ global });
5801
+ const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
5802
+ const copilotFrontmatter = {
5803
+ name: rulesyncFrontmatter.name,
5804
+ description: rulesyncFrontmatter.description,
5805
+ license: rulesyncFrontmatter.copilot?.license
5806
+ };
5807
+ return new _CopilotSkill({
5808
+ baseDir: rulesyncSkill.getBaseDir(),
5809
+ relativeDirPath: settablePaths.relativeDirPath,
5810
+ dirName: rulesyncSkill.getDirName(),
5811
+ frontmatter: copilotFrontmatter,
5812
+ body: rulesyncSkill.getBody(),
5813
+ otherFiles: rulesyncSkill.getOtherFiles(),
5814
+ validate,
5815
+ global
5816
+ });
5025
5817
  }
5026
- async removeAiDirs(aiDirs) {
5027
- for (const aiDir of aiDirs) {
5028
- await removeDirectory(aiDir.getDirPath());
5818
+ static isTargetedByRulesyncSkill(rulesyncSkill) {
5819
+ const targets = rulesyncSkill.getFrontmatter().targets;
5820
+ return targets.includes("*") || targets.includes("copilot");
5821
+ }
5822
+ static async fromDir(params) {
5823
+ const loaded = await this.loadSkillDirContent({
5824
+ ...params,
5825
+ getSettablePaths: _CopilotSkill.getSettablePaths
5826
+ });
5827
+ const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
5828
+ if (!result.success) {
5829
+ const skillDirPath = join49(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
5830
+ throw new Error(
5831
+ `Invalid frontmatter in ${join49(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
5832
+ );
5029
5833
  }
5834
+ return new _CopilotSkill({
5835
+ baseDir: loaded.baseDir,
5836
+ relativeDirPath: loaded.relativeDirPath,
5837
+ dirName: loaded.dirName,
5838
+ frontmatter: result.data,
5839
+ body: loaded.body,
5840
+ otherFiles: loaded.otherFiles,
5841
+ validate: true,
5842
+ global: loaded.global
5843
+ });
5844
+ }
5845
+ static forDeletion({
5846
+ baseDir = process.cwd(),
5847
+ relativeDirPath,
5848
+ dirName,
5849
+ global = false
5850
+ }) {
5851
+ const settablePaths = _CopilotSkill.getSettablePaths({ global });
5852
+ return new _CopilotSkill({
5853
+ baseDir,
5854
+ relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
5855
+ dirName,
5856
+ frontmatter: { name: "", description: "" },
5857
+ body: "",
5858
+ otherFiles: [],
5859
+ validate: false,
5860
+ global
5861
+ });
5030
5862
  }
5031
5863
  };
5032
5864
 
5033
- // src/features/skills/claudecode-skill.ts
5034
- import { join as join49 } from "path";
5035
- import { z as z22 } from "zod/mini";
5036
- var ClaudecodeSkillFrontmatterSchema = z22.object({
5037
- name: z22.string(),
5038
- description: z22.string(),
5039
- "allowed-tools": z22.optional(z22.array(z22.string()))
5865
+ // src/features/skills/opencode-skill.ts
5866
+ import { join as join50 } from "path";
5867
+ import { z as z24 } from "zod/mini";
5868
+ var OpenCodeSkillFrontmatterSchema = z24.looseObject({
5869
+ name: z24.string(),
5870
+ description: z24.string(),
5871
+ "allowed-tools": z24.optional(z24.array(z24.string()))
5040
5872
  });
5041
- var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
5873
+ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
5042
5874
  constructor({
5043
5875
  baseDir = process.cwd(),
5044
- relativeDirPath = join49(".claude", "skills"),
5876
+ relativeDirPath = join50(".opencode", "skills"),
5045
5877
  dirName,
5046
5878
  frontmatter,
5047
5879
  body,
@@ -5068,18 +5900,16 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
5068
5900
  }
5069
5901
  }
5070
5902
  }
5071
- static getSettablePaths({
5072
- global: _global = false
5073
- } = {}) {
5903
+ static getSettablePaths({ global = false } = {}) {
5074
5904
  return {
5075
- relativeDirPath: join49(".claude", "skills")
5905
+ relativeDirPath: global ? join50(".config", "opencode", "skills") : join50(".opencode", "skills")
5076
5906
  };
5077
5907
  }
5078
5908
  getFrontmatter() {
5079
5909
  if (!this.mainFile?.frontmatter) {
5080
5910
  throw new Error("Frontmatter is not defined");
5081
5911
  }
5082
- const result = ClaudecodeSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
5912
+ const result = OpenCodeSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
5083
5913
  return result;
5084
5914
  }
5085
5915
  getBody() {
@@ -5092,7 +5922,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
5092
5922
  error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
5093
5923
  };
5094
5924
  }
5095
- const result = ClaudecodeSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
5925
+ const result = OpenCodeSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
5096
5926
  if (!result.success) {
5097
5927
  return {
5098
5928
  success: false,
@@ -5110,7 +5940,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
5110
5940
  description: frontmatter.description,
5111
5941
  targets: ["*"],
5112
5942
  ...frontmatter["allowed-tools"] && {
5113
- claudecode: {
5943
+ opencode: {
5114
5944
  "allowed-tools": frontmatter["allowed-tools"]
5115
5945
  }
5116
5946
  }
@@ -5132,39 +5962,40 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
5132
5962
  global = false
5133
5963
  }) {
5134
5964
  const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
5135
- const claudecodeFrontmatter = {
5965
+ const opencodeFrontmatter = {
5136
5966
  name: rulesyncFrontmatter.name,
5137
5967
  description: rulesyncFrontmatter.description,
5138
- "allowed-tools": rulesyncFrontmatter.claudecode?.["allowed-tools"]
5968
+ "allowed-tools": rulesyncFrontmatter.opencode?.["allowed-tools"]
5139
5969
  };
5140
- const settablePaths = _ClaudecodeSkill.getSettablePaths({ global });
5141
- return new _ClaudecodeSkill({
5970
+ const settablePaths = _OpenCodeSkill.getSettablePaths({ global });
5971
+ return new _OpenCodeSkill({
5142
5972
  baseDir: rulesyncSkill.getBaseDir(),
5143
5973
  relativeDirPath: settablePaths.relativeDirPath,
5144
5974
  dirName: rulesyncSkill.getDirName(),
5145
- frontmatter: claudecodeFrontmatter,
5975
+ frontmatter: opencodeFrontmatter,
5146
5976
  body: rulesyncSkill.getBody(),
5147
5977
  otherFiles: rulesyncSkill.getOtherFiles(),
5148
5978
  validate,
5149
5979
  global
5150
5980
  });
5151
5981
  }
5152
- static isTargetedByRulesyncSkill(_rulesyncSkill) {
5153
- return true;
5982
+ static isTargetedByRulesyncSkill(rulesyncSkill) {
5983
+ const targets = rulesyncSkill.getFrontmatter().targets;
5984
+ return targets.includes("*") || targets.includes("opencode");
5154
5985
  }
5155
5986
  static async fromDir(params) {
5156
5987
  const loaded = await this.loadSkillDirContent({
5157
5988
  ...params,
5158
- getSettablePaths: _ClaudecodeSkill.getSettablePaths
5989
+ getSettablePaths: _OpenCodeSkill.getSettablePaths
5159
5990
  });
5160
- const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
5991
+ const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
5161
5992
  if (!result.success) {
5162
- const skillDirPath = join49(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
5993
+ const skillDirPath = join50(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
5163
5994
  throw new Error(
5164
- `Invalid frontmatter in ${join49(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
5995
+ `Invalid frontmatter in ${join50(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
5165
5996
  );
5166
5997
  }
5167
- return new _ClaudecodeSkill({
5998
+ return new _OpenCodeSkill({
5168
5999
  baseDir: loaded.baseDir,
5169
6000
  relativeDirPath: loaded.relativeDirPath,
5170
6001
  dirName: loaded.dirName,
@@ -5175,6 +6006,23 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
5175
6006
  global: loaded.global
5176
6007
  });
5177
6008
  }
6009
+ static forDeletion({
6010
+ baseDir = process.cwd(),
6011
+ relativeDirPath,
6012
+ dirName,
6013
+ global = false
6014
+ }) {
6015
+ return new _OpenCodeSkill({
6016
+ baseDir,
6017
+ relativeDirPath,
6018
+ dirName,
6019
+ frontmatter: { name: "", description: "" },
6020
+ body: "",
6021
+ otherFiles: [],
6022
+ validate: false,
6023
+ global
6024
+ });
6025
+ }
5178
6026
  };
5179
6027
 
5180
6028
  // src/features/skills/skills-processor.ts
@@ -5184,9 +6032,10 @@ var skillsProcessorToolTargetTuple = [
5184
6032
  "codexcli",
5185
6033
  "copilot",
5186
6034
  "cursor",
5187
- "geminicli"
6035
+ "geminicli",
6036
+ "opencode"
5188
6037
  ];
5189
- var SkillsProcessorToolTargetSchema = z23.enum(skillsProcessorToolTargetTuple);
6038
+ var SkillsProcessorToolTargetSchema = z25.enum(skillsProcessorToolTargetTuple);
5190
6039
  var toolSkillFactories = /* @__PURE__ */ new Map([
5191
6040
  [
5192
6041
  "agentsmd",
@@ -5213,7 +6062,7 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
5213
6062
  "copilot",
5214
6063
  {
5215
6064
  class: CopilotSkill,
5216
- meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
6065
+ meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: false }
5217
6066
  }
5218
6067
  ],
5219
6068
  [
@@ -5229,6 +6078,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
5229
6078
  class: GeminiCliSkill,
5230
6079
  meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
5231
6080
  }
6081
+ ],
6082
+ [
6083
+ "opencode",
6084
+ {
6085
+ class: OpenCodeSkill,
6086
+ meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
6087
+ }
5232
6088
  ]
5233
6089
  ]);
5234
6090
  var defaultGetFactory4 = (target) => {
@@ -5308,8 +6164,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
5308
6164
  */
5309
6165
  async loadRulesyncDirs() {
5310
6166
  const paths = RulesyncSkill.getSettablePaths();
5311
- const rulesyncSkillsDirPath = join50(this.baseDir, paths.relativeDirPath);
5312
- const dirPaths = await findFilesByGlobs(join50(rulesyncSkillsDirPath, "*"), { type: "dir" });
6167
+ const rulesyncSkillsDirPath = join51(this.baseDir, paths.relativeDirPath);
6168
+ const dirPaths = await findFilesByGlobs(join51(rulesyncSkillsDirPath, "*"), { type: "dir" });
5313
6169
  const dirNames = dirPaths.map((path3) => basename14(path3));
5314
6170
  const rulesyncSkills = await Promise.all(
5315
6171
  dirNames.map(
@@ -5326,8 +6182,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
5326
6182
  async loadToolDirs() {
5327
6183
  const factory = this.getFactory(this.toolTarget);
5328
6184
  const paths = factory.class.getSettablePaths({ global: this.global });
5329
- const skillsDirPath = join50(this.baseDir, paths.relativeDirPath);
5330
- const dirPaths = await findFilesByGlobs(join50(skillsDirPath, "*"), { type: "dir" });
6185
+ const skillsDirPath = join51(this.baseDir, paths.relativeDirPath);
6186
+ const dirPaths = await findFilesByGlobs(join51(skillsDirPath, "*"), { type: "dir" });
5331
6187
  const dirNames = dirPaths.map((path3) => basename14(path3));
5332
6188
  const toolSkills = await Promise.all(
5333
6189
  dirNames.map(
@@ -5342,7 +6198,23 @@ var SkillsProcessor = class extends DirFeatureProcessor {
5342
6198
  return toolSkills;
5343
6199
  }
5344
6200
  async loadToolDirsToDelete() {
5345
- return this.loadToolDirs();
6201
+ const factory = this.getFactory(this.toolTarget);
6202
+ const paths = factory.class.getSettablePaths({ global: this.global });
6203
+ const skillsDirPath = join51(this.baseDir, paths.relativeDirPath);
6204
+ const dirPaths = await findFilesByGlobs(join51(skillsDirPath, "*"), { type: "dir" });
6205
+ const dirNames = dirPaths.map((path3) => basename14(path3));
6206
+ const toolSkills = dirNames.map(
6207
+ (dirName) => factory.class.forDeletion({
6208
+ baseDir: this.baseDir,
6209
+ relativeDirPath: paths.relativeDirPath,
6210
+ dirName,
6211
+ global: this.global
6212
+ })
6213
+ );
6214
+ logger.info(
6215
+ `Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills for deletion`
6216
+ );
6217
+ return toolSkills;
5346
6218
  }
5347
6219
  /**
5348
6220
  * Implementation of abstract method from DirFeatureProcessor
@@ -5378,11 +6250,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
5378
6250
  };
5379
6251
 
5380
6252
  // src/features/subagents/agentsmd-subagent.ts
5381
- import { join as join52 } from "path";
6253
+ import { join as join53 } from "path";
5382
6254
 
5383
6255
  // src/features/subagents/simulated-subagent.ts
5384
- import { basename as basename15, join as join51 } from "path";
5385
- import { z as z24 } from "zod/mini";
6256
+ import { basename as basename15, join as join52 } from "path";
6257
+ import { z as z26 } from "zod/mini";
5386
6258
 
5387
6259
  // src/features/subagents/tool-subagent.ts
5388
6260
  var ToolSubagent = class extends ToolFile {
@@ -5392,6 +6264,14 @@ var ToolSubagent = class extends ToolFile {
5392
6264
  static async fromFile(_params) {
5393
6265
  throw new Error("Please implement this method in the subclass.");
5394
6266
  }
6267
+ /**
6268
+ * Create a minimal instance for deletion purposes.
6269
+ * This method does not read or parse file content, making it safe to use
6270
+ * even when files have old/incompatible formats.
6271
+ */
6272
+ static forDeletion(_params) {
6273
+ throw new Error("Please implement this method in the subclass.");
6274
+ }
5395
6275
  static fromRulesyncSubagent(_params) {
5396
6276
  throw new Error("Please implement this method in the subclass.");
5397
6277
  }
@@ -5417,9 +6297,9 @@ var ToolSubagent = class extends ToolFile {
5417
6297
  };
5418
6298
 
5419
6299
  // src/features/subagents/simulated-subagent.ts
5420
- var SimulatedSubagentFrontmatterSchema = z24.object({
5421
- name: z24.string(),
5422
- description: z24.string()
6300
+ var SimulatedSubagentFrontmatterSchema = z26.object({
6301
+ name: z26.string(),
6302
+ description: z26.string()
5423
6303
  });
5424
6304
  var SimulatedSubagent = class extends ToolSubagent {
5425
6305
  frontmatter;
@@ -5429,7 +6309,7 @@ var SimulatedSubagent = class extends ToolSubagent {
5429
6309
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
5430
6310
  if (!result.success) {
5431
6311
  throw new Error(
5432
- `Invalid frontmatter in ${join51(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
6312
+ `Invalid frontmatter in ${join52(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5433
6313
  );
5434
6314
  }
5435
6315
  }
@@ -5480,7 +6360,7 @@ var SimulatedSubagent = class extends ToolSubagent {
5480
6360
  return {
5481
6361
  success: false,
5482
6362
  error: new Error(
5483
- `Invalid frontmatter in ${join51(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
6363
+ `Invalid frontmatter in ${join52(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5484
6364
  )
5485
6365
  };
5486
6366
  }
@@ -5490,7 +6370,7 @@ var SimulatedSubagent = class extends ToolSubagent {
5490
6370
  relativeFilePath,
5491
6371
  validate = true
5492
6372
  }) {
5493
- const filePath = join51(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
6373
+ const filePath = join52(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
5494
6374
  const fileContent = await readFileContent(filePath);
5495
6375
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
5496
6376
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -5506,13 +6386,27 @@ var SimulatedSubagent = class extends ToolSubagent {
5506
6386
  validate
5507
6387
  };
5508
6388
  }
6389
+ static forDeletionDefault({
6390
+ baseDir = process.cwd(),
6391
+ relativeDirPath,
6392
+ relativeFilePath
6393
+ }) {
6394
+ return {
6395
+ baseDir,
6396
+ relativeDirPath,
6397
+ relativeFilePath,
6398
+ frontmatter: { name: "", description: "" },
6399
+ body: "",
6400
+ validate: false
6401
+ };
6402
+ }
5509
6403
  };
5510
6404
 
5511
6405
  // src/features/subagents/agentsmd-subagent.ts
5512
6406
  var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
5513
6407
  static getSettablePaths() {
5514
6408
  return {
5515
- relativeDirPath: join52(".agents", "subagents")
6409
+ relativeDirPath: join53(".agents", "subagents")
5516
6410
  };
5517
6411
  }
5518
6412
  static async fromFile(params) {
@@ -5529,14 +6423,17 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
5529
6423
  toolTarget: "agentsmd"
5530
6424
  });
5531
6425
  }
6426
+ static forDeletion(params) {
6427
+ return new _AgentsmdSubagent(this.forDeletionDefault(params));
6428
+ }
5532
6429
  };
5533
6430
 
5534
6431
  // src/features/subagents/codexcli-subagent.ts
5535
- import { join as join53 } from "path";
6432
+ import { join as join54 } from "path";
5536
6433
  var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
5537
6434
  static getSettablePaths() {
5538
6435
  return {
5539
- relativeDirPath: join53(".codex", "subagents")
6436
+ relativeDirPath: join54(".codex", "subagents")
5540
6437
  };
5541
6438
  }
5542
6439
  static async fromFile(params) {
@@ -5553,29 +6450,8 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
5553
6450
  toolTarget: "codexcli"
5554
6451
  });
5555
6452
  }
5556
- };
5557
-
5558
- // src/features/subagents/copilot-subagent.ts
5559
- import { join as join54 } from "path";
5560
- var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
5561
- static getSettablePaths() {
5562
- return {
5563
- relativeDirPath: join54(".github", "subagents")
5564
- };
5565
- }
5566
- static async fromFile(params) {
5567
- const baseParams = await this.fromFileDefault(params);
5568
- return new _CopilotSubagent(baseParams);
5569
- }
5570
- static fromRulesyncSubagent(params) {
5571
- const baseParams = this.fromRulesyncSubagentDefault(params);
5572
- return new _CopilotSubagent(baseParams);
5573
- }
5574
- static isTargetedByRulesyncSubagent(rulesyncSubagent) {
5575
- return this.isTargetedByRulesyncSubagentDefault({
5576
- rulesyncSubagent,
5577
- toolTarget: "copilot"
5578
- });
6453
+ static forDeletion(params) {
6454
+ return new _CodexCliSubagent(this.forDeletionDefault(params));
5579
6455
  }
5580
6456
  };
5581
6457
 
@@ -5601,6 +6477,9 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
5601
6477
  toolTarget: "cursor"
5602
6478
  });
5603
6479
  }
6480
+ static forDeletion(params) {
6481
+ return new _CursorSubagent(this.forDeletionDefault(params));
6482
+ }
5604
6483
  };
5605
6484
 
5606
6485
  // src/features/subagents/geminicli-subagent.ts
@@ -5625,6 +6504,9 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
5625
6504
  toolTarget: "geminicli"
5626
6505
  });
5627
6506
  }
6507
+ static forDeletion(params) {
6508
+ return new _GeminiCliSubagent(this.forDeletionDefault(params));
6509
+ }
5628
6510
  };
5629
6511
 
5630
6512
  // src/features/subagents/roo-subagent.ts
@@ -5649,23 +6531,26 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
5649
6531
  toolTarget: "roo"
5650
6532
  });
5651
6533
  }
6534
+ static forDeletion(params) {
6535
+ return new _RooSubagent(this.forDeletionDefault(params));
6536
+ }
5652
6537
  };
5653
6538
 
5654
6539
  // src/features/subagents/subagents-processor.ts
5655
- import { basename as basename17, join as join60 } from "path";
5656
- import { z as z27 } from "zod/mini";
6540
+ import { basename as basename17, join as join61 } from "path";
6541
+ import { z as z30 } from "zod/mini";
5657
6542
 
5658
6543
  // src/features/subagents/claudecode-subagent.ts
5659
6544
  import { join as join59 } from "path";
5660
- import { z as z26 } from "zod/mini";
6545
+ import { z as z28 } from "zod/mini";
5661
6546
 
5662
6547
  // src/features/subagents/rulesync-subagent.ts
5663
6548
  import { basename as basename16, join as join58 } from "path";
5664
- import { z as z25 } from "zod/mini";
5665
- var RulesyncSubagentFrontmatterSchema = z25.looseObject({
6549
+ import { z as z27 } from "zod/mini";
6550
+ var RulesyncSubagentFrontmatterSchema = z27.looseObject({
5666
6551
  targets: RulesyncTargetsSchema,
5667
- name: z25.string(),
5668
- description: z25.string()
6552
+ name: z27.string(),
6553
+ description: z27.string()
5669
6554
  });
5670
6555
  var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
5671
6556
  frontmatter;
@@ -5690,69 +6575,234 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
5690
6575
  return {
5691
6576
  relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH
5692
6577
  };
5693
- }
5694
- getFrontmatter() {
5695
- return this.frontmatter;
5696
- }
5697
- getBody() {
5698
- return this.body;
6578
+ }
6579
+ getFrontmatter() {
6580
+ return this.frontmatter;
6581
+ }
6582
+ getBody() {
6583
+ return this.body;
6584
+ }
6585
+ validate() {
6586
+ if (!this.frontmatter) {
6587
+ return { success: true, error: null };
6588
+ }
6589
+ const result = RulesyncSubagentFrontmatterSchema.safeParse(this.frontmatter);
6590
+ if (result.success) {
6591
+ return { success: true, error: null };
6592
+ } else {
6593
+ return {
6594
+ success: false,
6595
+ error: new Error(
6596
+ `Invalid frontmatter in ${join58(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
6597
+ )
6598
+ };
6599
+ }
6600
+ }
6601
+ static async fromFile({
6602
+ relativeFilePath
6603
+ }) {
6604
+ const fileContent = await readFileContent(
6605
+ join58(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
6606
+ );
6607
+ const { frontmatter, body: content } = parseFrontmatter(fileContent);
6608
+ const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
6609
+ if (!result.success) {
6610
+ throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
6611
+ }
6612
+ const filename = basename16(relativeFilePath);
6613
+ return new _RulesyncSubagent({
6614
+ baseDir: process.cwd(),
6615
+ relativeDirPath: this.getSettablePaths().relativeDirPath,
6616
+ relativeFilePath: filename,
6617
+ frontmatter: result.data,
6618
+ body: content.trim()
6619
+ });
6620
+ }
6621
+ };
6622
+
6623
+ // src/features/subagents/claudecode-subagent.ts
6624
+ var ClaudecodeSubagentFrontmatterSchema = z28.looseObject({
6625
+ name: z28.string(),
6626
+ description: z28.string(),
6627
+ model: z28.optional(z28.string()),
6628
+ tools: z28.optional(z28.union([z28.string(), z28.array(z28.string())])),
6629
+ permissionMode: z28.optional(z28.string()),
6630
+ skills: z28.optional(z28.union([z28.string(), z28.array(z28.string())]))
6631
+ });
6632
+ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
6633
+ frontmatter;
6634
+ body;
6635
+ constructor({ frontmatter, body, ...rest }) {
6636
+ if (rest.validate !== false) {
6637
+ const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
6638
+ if (!result.success) {
6639
+ throw new Error(
6640
+ `Invalid frontmatter in ${join59(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
6641
+ );
6642
+ }
6643
+ }
6644
+ super({
6645
+ ...rest
6646
+ });
6647
+ this.frontmatter = frontmatter;
6648
+ this.body = body;
6649
+ }
6650
+ static getSettablePaths(_options = {}) {
6651
+ return {
6652
+ relativeDirPath: join59(".claude", "agents")
6653
+ };
6654
+ }
6655
+ getFrontmatter() {
6656
+ return this.frontmatter;
6657
+ }
6658
+ getBody() {
6659
+ return this.body;
6660
+ }
6661
+ toRulesyncSubagent() {
6662
+ const { name, description, model, ...restFields } = this.frontmatter;
6663
+ const claudecodeSection = {
6664
+ ...model && { model },
6665
+ ...restFields
6666
+ };
6667
+ const rulesyncFrontmatter = {
6668
+ targets: ["claudecode"],
6669
+ name,
6670
+ description,
6671
+ // Only include claudecode section if there are fields
6672
+ ...Object.keys(claudecodeSection).length > 0 && { claudecode: claudecodeSection }
6673
+ };
6674
+ return new RulesyncSubagent({
6675
+ baseDir: ".",
6676
+ // RulesyncCommand baseDir is always the project root directory
6677
+ frontmatter: rulesyncFrontmatter,
6678
+ body: this.body,
6679
+ relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
6680
+ relativeFilePath: this.getRelativeFilePath(),
6681
+ validate: true
6682
+ });
6683
+ }
6684
+ static fromRulesyncSubagent({
6685
+ baseDir = process.cwd(),
6686
+ rulesyncSubagent,
6687
+ validate = true,
6688
+ global = false
6689
+ }) {
6690
+ const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
6691
+ const claudecodeSection = rulesyncFrontmatter.claudecode ?? {};
6692
+ const rawClaudecodeFrontmatter = {
6693
+ name: rulesyncFrontmatter.name,
6694
+ description: rulesyncFrontmatter.description,
6695
+ ...claudecodeSection
6696
+ };
6697
+ const result = ClaudecodeSubagentFrontmatterSchema.safeParse(rawClaudecodeFrontmatter);
6698
+ if (!result.success) {
6699
+ throw new Error(`Invalid claudecode subagent frontmatter: ${formatError(result.error)}`);
6700
+ }
6701
+ const claudecodeFrontmatter = result.data;
6702
+ const body = rulesyncSubagent.getBody();
6703
+ const fileContent = stringifyFrontmatter(body, claudecodeFrontmatter);
6704
+ const paths = this.getSettablePaths({ global });
6705
+ return new _ClaudecodeSubagent({
6706
+ baseDir,
6707
+ frontmatter: claudecodeFrontmatter,
6708
+ body,
6709
+ relativeDirPath: paths.relativeDirPath,
6710
+ relativeFilePath: rulesyncSubagent.getRelativeFilePath(),
6711
+ fileContent,
6712
+ validate
6713
+ });
5699
6714
  }
5700
6715
  validate() {
5701
6716
  if (!this.frontmatter) {
5702
6717
  return { success: true, error: null };
5703
6718
  }
5704
- const result = RulesyncSubagentFrontmatterSchema.safeParse(this.frontmatter);
6719
+ const result = ClaudecodeSubagentFrontmatterSchema.safeParse(this.frontmatter);
5705
6720
  if (result.success) {
5706
6721
  return { success: true, error: null };
5707
6722
  } else {
5708
6723
  return {
5709
6724
  success: false,
5710
6725
  error: new Error(
5711
- `Invalid frontmatter in ${join58(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
6726
+ `Invalid frontmatter in ${join59(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5712
6727
  )
5713
6728
  };
5714
6729
  }
5715
6730
  }
6731
+ static isTargetedByRulesyncSubagent(rulesyncSubagent) {
6732
+ return this.isTargetedByRulesyncSubagentDefault({
6733
+ rulesyncSubagent,
6734
+ toolTarget: "claudecode"
6735
+ });
6736
+ }
5716
6737
  static async fromFile({
5717
- relativeFilePath
6738
+ baseDir = process.cwd(),
6739
+ relativeFilePath,
6740
+ validate = true,
6741
+ global = false
5718
6742
  }) {
5719
- const fileContent = await readFileContent(
5720
- join58(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
5721
- );
6743
+ const paths = this.getSettablePaths({ global });
6744
+ const filePath = join59(baseDir, paths.relativeDirPath, relativeFilePath);
6745
+ const fileContent = await readFileContent(filePath);
5722
6746
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
5723
- const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
6747
+ const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
5724
6748
  if (!result.success) {
5725
- throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
6749
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
5726
6750
  }
5727
- const filename = basename16(relativeFilePath);
5728
- return new _RulesyncSubagent({
5729
- baseDir: process.cwd(),
5730
- relativeDirPath: this.getSettablePaths().relativeDirPath,
5731
- relativeFilePath: filename,
6751
+ return new _ClaudecodeSubagent({
6752
+ baseDir,
6753
+ relativeDirPath: paths.relativeDirPath,
6754
+ relativeFilePath,
5732
6755
  frontmatter: result.data,
5733
- body: content.trim()
6756
+ body: content.trim(),
6757
+ fileContent,
6758
+ validate
6759
+ });
6760
+ }
6761
+ static forDeletion({
6762
+ baseDir = process.cwd(),
6763
+ relativeDirPath,
6764
+ relativeFilePath
6765
+ }) {
6766
+ return new _ClaudecodeSubagent({
6767
+ baseDir,
6768
+ relativeDirPath,
6769
+ relativeFilePath,
6770
+ frontmatter: { name: "", description: "" },
6771
+ body: "",
6772
+ fileContent: "",
6773
+ validate: false
5734
6774
  });
5735
6775
  }
5736
6776
  };
5737
6777
 
5738
- // src/features/subagents/claudecode-subagent.ts
5739
- var ClaudecodeSubagentFrontmatterSchema = z26.looseObject({
5740
- name: z26.string(),
5741
- description: z26.string(),
5742
- model: z26.optional(z26.string()),
5743
- tools: z26.optional(z26.union([z26.string(), z26.array(z26.string())])),
5744
- permissionMode: z26.optional(z26.string()),
5745
- skills: z26.optional(z26.union([z26.string(), z26.array(z26.string())]))
6778
+ // src/features/subagents/copilot-subagent.ts
6779
+ import { join as join60 } from "path";
6780
+ import { z as z29 } from "zod/mini";
6781
+ var REQUIRED_TOOL = "agent/runSubagent";
6782
+ var CopilotSubagentFrontmatterSchema = z29.looseObject({
6783
+ name: z29.string(),
6784
+ description: z29.string(),
6785
+ tools: z29.optional(z29.union([z29.string(), z29.array(z29.string())]))
5746
6786
  });
5747
- var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
6787
+ var normalizeTools = (tools) => {
6788
+ if (!tools) {
6789
+ return [];
6790
+ }
6791
+ return Array.isArray(tools) ? tools : [tools];
6792
+ };
6793
+ var ensureRequiredTool = (tools) => {
6794
+ const mergedTools = /* @__PURE__ */ new Set([REQUIRED_TOOL, ...tools]);
6795
+ return Array.from(mergedTools);
6796
+ };
6797
+ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
5748
6798
  frontmatter;
5749
6799
  body;
5750
6800
  constructor({ frontmatter, body, ...rest }) {
5751
6801
  if (rest.validate !== false) {
5752
- const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
6802
+ const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
5753
6803
  if (!result.success) {
5754
6804
  throw new Error(
5755
- `Invalid frontmatter in ${join59(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
6805
+ `Invalid frontmatter in ${join60(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5756
6806
  );
5757
6807
  }
5758
6808
  }
@@ -5764,7 +6814,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
5764
6814
  }
5765
6815
  static getSettablePaths(_options = {}) {
5766
6816
  return {
5767
- relativeDirPath: join59(".claude", "agents")
6817
+ relativeDirPath: join60(".github", "agents")
5768
6818
  };
5769
6819
  }
5770
6820
  getFrontmatter() {
@@ -5774,17 +6824,15 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
5774
6824
  return this.body;
5775
6825
  }
5776
6826
  toRulesyncSubagent() {
5777
- const { name, description, model, ...restFields } = this.frontmatter;
5778
- const claudecodeSection = {
5779
- ...model && { model },
5780
- ...restFields
5781
- };
6827
+ const { name, description, tools, ...rest } = this.frontmatter;
5782
6828
  const rulesyncFrontmatter = {
5783
- targets: ["claudecode"],
6829
+ targets: ["copilot"],
5784
6830
  name,
5785
6831
  description,
5786
- // Only include claudecode section if there are fields
5787
- ...Object.keys(claudecodeSection).length > 0 && { claudecode: claudecodeSection }
6832
+ copilot: {
6833
+ ...tools && { tools },
6834
+ ...rest
6835
+ }
5788
6836
  };
5789
6837
  return new RulesyncSubagent({
5790
6838
  baseDir: ".",
@@ -5803,42 +6851,44 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
5803
6851
  global = false
5804
6852
  }) {
5805
6853
  const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
5806
- const claudecodeSection = rulesyncFrontmatter.claudecode ?? {};
5807
- const rawClaudecodeFrontmatter = {
6854
+ const copilotSection = rulesyncFrontmatter.copilot ?? {};
6855
+ const toolsField = copilotSection.tools;
6856
+ const userTools = normalizeTools(
6857
+ Array.isArray(toolsField) || typeof toolsField === "string" ? toolsField : void 0
6858
+ );
6859
+ const mergedTools = ensureRequiredTool(userTools);
6860
+ const copilotFrontmatter = {
5808
6861
  name: rulesyncFrontmatter.name,
5809
6862
  description: rulesyncFrontmatter.description,
5810
- ...claudecodeSection
6863
+ ...copilotSection,
6864
+ ...mergedTools.length > 0 && { tools: mergedTools }
5811
6865
  };
5812
- const result = ClaudecodeSubagentFrontmatterSchema.safeParse(rawClaudecodeFrontmatter);
5813
- if (!result.success) {
5814
- throw new Error(`Invalid claudecode subagent frontmatter: ${formatError(result.error)}`);
5815
- }
5816
- const claudecodeFrontmatter = result.data;
5817
6866
  const body = rulesyncSubagent.getBody();
5818
- const fileContent = stringifyFrontmatter(body, claudecodeFrontmatter);
6867
+ const fileContent = stringifyFrontmatter(body, copilotFrontmatter);
5819
6868
  const paths = this.getSettablePaths({ global });
5820
- return new _ClaudecodeSubagent({
6869
+ return new _CopilotSubagent({
5821
6870
  baseDir,
5822
- frontmatter: claudecodeFrontmatter,
6871
+ frontmatter: copilotFrontmatter,
5823
6872
  body,
5824
6873
  relativeDirPath: paths.relativeDirPath,
5825
6874
  relativeFilePath: rulesyncSubagent.getRelativeFilePath(),
5826
6875
  fileContent,
5827
- validate
6876
+ validate,
6877
+ global
5828
6878
  });
5829
6879
  }
5830
6880
  validate() {
5831
6881
  if (!this.frontmatter) {
5832
6882
  return { success: true, error: null };
5833
6883
  }
5834
- const result = ClaudecodeSubagentFrontmatterSchema.safeParse(this.frontmatter);
6884
+ const result = CopilotSubagentFrontmatterSchema.safeParse(this.frontmatter);
5835
6885
  if (result.success) {
5836
6886
  return { success: true, error: null };
5837
6887
  } else {
5838
6888
  return {
5839
6889
  success: false,
5840
6890
  error: new Error(
5841
- `Invalid frontmatter in ${join59(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
6891
+ `Invalid frontmatter in ${join60(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5842
6892
  )
5843
6893
  };
5844
6894
  }
@@ -5846,7 +6896,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
5846
6896
  static isTargetedByRulesyncSubagent(rulesyncSubagent) {
5847
6897
  return this.isTargetedByRulesyncSubagentDefault({
5848
6898
  rulesyncSubagent,
5849
- toolTarget: "claudecode"
6899
+ toolTarget: "copilot"
5850
6900
  });
5851
6901
  }
5852
6902
  static async fromFile({
@@ -5856,21 +6906,37 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
5856
6906
  global = false
5857
6907
  }) {
5858
6908
  const paths = this.getSettablePaths({ global });
5859
- const filePath = join59(baseDir, paths.relativeDirPath, relativeFilePath);
6909
+ const filePath = join60(baseDir, paths.relativeDirPath, relativeFilePath);
5860
6910
  const fileContent = await readFileContent(filePath);
5861
6911
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
5862
- const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
6912
+ const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
5863
6913
  if (!result.success) {
5864
6914
  throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
5865
6915
  }
5866
- return new _ClaudecodeSubagent({
6916
+ return new _CopilotSubagent({
5867
6917
  baseDir,
5868
6918
  relativeDirPath: paths.relativeDirPath,
5869
6919
  relativeFilePath,
5870
6920
  frontmatter: result.data,
5871
6921
  body: content.trim(),
5872
6922
  fileContent,
5873
- validate
6923
+ validate,
6924
+ global
6925
+ });
6926
+ }
6927
+ static forDeletion({
6928
+ baseDir = process.cwd(),
6929
+ relativeDirPath,
6930
+ relativeFilePath
6931
+ }) {
6932
+ return new _CopilotSubagent({
6933
+ baseDir,
6934
+ relativeDirPath,
6935
+ relativeFilePath,
6936
+ frontmatter: { name: "", description: "" },
6937
+ body: "",
6938
+ fileContent: "",
6939
+ validate: false
5874
6940
  });
5875
6941
  }
5876
6942
  };
@@ -5885,7 +6951,7 @@ var subagentsProcessorToolTargetTuple = [
5885
6951
  "geminicli",
5886
6952
  "roo"
5887
6953
  ];
5888
- var SubagentsProcessorToolTargetSchema = z27.enum(subagentsProcessorToolTargetTuple);
6954
+ var SubagentsProcessorToolTargetSchema = z30.enum(subagentsProcessorToolTargetTuple);
5889
6955
  var toolSubagentFactories = /* @__PURE__ */ new Map([
5890
6956
  [
5891
6957
  "agentsmd",
@@ -5899,7 +6965,10 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
5899
6965
  "codexcli",
5900
6966
  { class: CodexCliSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }
5901
6967
  ],
5902
- ["copilot", { class: CopilotSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }],
6968
+ [
6969
+ "copilot",
6970
+ { class: CopilotSubagent, meta: { supportsSimulated: false, supportsGlobal: false } }
6971
+ ],
5903
6972
  ["cursor", { class: CursorSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }],
5904
6973
  [
5905
6974
  "geminicli",
@@ -5988,7 +7057,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
5988
7057
  * Load and parse rulesync subagent files from .rulesync/subagents/ directory
5989
7058
  */
5990
7059
  async loadRulesyncFiles() {
5991
- const subagentsDir = join60(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
7060
+ const subagentsDir = join61(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
5992
7061
  const dirExists = await directoryExists(subagentsDir);
5993
7062
  if (!dirExists) {
5994
7063
  logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
@@ -6003,7 +7072,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
6003
7072
  logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
6004
7073
  const rulesyncSubagents = [];
6005
7074
  for (const mdFile of mdFiles) {
6006
- const filepath = join60(subagentsDir, mdFile);
7075
+ const filepath = join61(subagentsDir, mdFile);
6007
7076
  try {
6008
7077
  const rulesyncSubagent = await RulesyncSubagent.fromFile({
6009
7078
  relativeFilePath: mdFile,
@@ -6033,8 +7102,20 @@ var SubagentsProcessor = class extends FeatureProcessor {
6033
7102
  const factory = this.getFactory(this.toolTarget);
6034
7103
  const paths = factory.class.getSettablePaths({ global: this.global });
6035
7104
  const subagentFilePaths = await findFilesByGlobs(
6036
- join60(this.baseDir, paths.relativeDirPath, "*.md")
7105
+ join61(this.baseDir, paths.relativeDirPath, "*.md")
6037
7106
  );
7107
+ if (forDeletion) {
7108
+ const toolSubagents2 = subagentFilePaths.map(
7109
+ (path3) => factory.class.forDeletion({
7110
+ baseDir: this.baseDir,
7111
+ relativeDirPath: paths.relativeDirPath,
7112
+ relativeFilePath: basename17(path3),
7113
+ global: this.global
7114
+ })
7115
+ ).filter((subagent) => subagent.isDeletable());
7116
+ logger.info(`Successfully loaded ${toolSubagents2.length} ${paths.relativeDirPath} subagents`);
7117
+ return toolSubagents2;
7118
+ }
6038
7119
  const toolSubagents = await Promise.all(
6039
7120
  subagentFilePaths.map(
6040
7121
  (path3) => factory.class.fromFile({
@@ -6044,9 +7125,8 @@ var SubagentsProcessor = class extends FeatureProcessor {
6044
7125
  })
6045
7126
  )
6046
7127
  );
6047
- const result = forDeletion ? toolSubagents.filter((subagent) => subagent.isDeletable()) : toolSubagents;
6048
- logger.info(`Successfully loaded ${result.length} ${paths.relativeDirPath} subagents`);
6049
- return result;
7128
+ logger.info(`Successfully loaded ${toolSubagents.length} ${paths.relativeDirPath} subagents`);
7129
+ return toolSubagents;
6050
7130
  }
6051
7131
  /**
6052
7132
  * Implementation of abstract method from FeatureProcessor
@@ -6072,48 +7152,48 @@ var SubagentsProcessor = class extends FeatureProcessor {
6072
7152
  };
6073
7153
 
6074
7154
  // src/features/rules/agentsmd-rule.ts
6075
- import { join as join63 } from "path";
7155
+ import { join as join64 } from "path";
6076
7156
 
6077
7157
  // src/features/rules/tool-rule.ts
6078
- import { join as join62 } from "path";
7158
+ import { join as join63 } from "path";
6079
7159
 
6080
7160
  // src/features/rules/rulesync-rule.ts
6081
- import { basename as basename18, join as join61 } from "path";
6082
- import { z as z28 } from "zod/mini";
6083
- var RulesyncRuleFrontmatterSchema = z28.object({
6084
- root: z28.optional(z28.optional(z28.boolean())),
6085
- targets: z28.optional(RulesyncTargetsSchema),
6086
- description: z28.optional(z28.string()),
6087
- globs: z28.optional(z28.array(z28.string())),
6088
- agentsmd: z28.optional(
6089
- z28.object({
7161
+ import { basename as basename18, join as join62 } from "path";
7162
+ import { z as z31 } from "zod/mini";
7163
+ var RulesyncRuleFrontmatterSchema = z31.object({
7164
+ root: z31.optional(z31.optional(z31.boolean())),
7165
+ targets: z31.optional(RulesyncTargetsSchema),
7166
+ description: z31.optional(z31.string()),
7167
+ globs: z31.optional(z31.array(z31.string())),
7168
+ agentsmd: z31.optional(
7169
+ z31.object({
6090
7170
  // @example "path/to/subproject"
6091
- subprojectPath: z28.optional(z28.string())
7171
+ subprojectPath: z31.optional(z31.string())
6092
7172
  })
6093
7173
  ),
6094
- claudecode: z28.optional(
6095
- z28.object({
7174
+ claudecode: z31.optional(
7175
+ z31.object({
6096
7176
  // Glob patterns for conditional rules (takes precedence over globs)
6097
7177
  // @example "src/**/*.ts, tests/**/*.test.ts"
6098
- paths: z28.optional(z28.string())
7178
+ paths: z31.optional(z31.string())
6099
7179
  })
6100
7180
  ),
6101
- cursor: z28.optional(
6102
- z28.object({
6103
- alwaysApply: z28.optional(z28.boolean()),
6104
- description: z28.optional(z28.string()),
6105
- globs: z28.optional(z28.array(z28.string()))
7181
+ cursor: z31.optional(
7182
+ z31.object({
7183
+ alwaysApply: z31.optional(z31.boolean()),
7184
+ description: z31.optional(z31.string()),
7185
+ globs: z31.optional(z31.array(z31.string()))
6106
7186
  })
6107
7187
  ),
6108
- copilot: z28.optional(
6109
- z28.object({
6110
- excludeAgent: z28.optional(z28.union([z28.literal("code-review"), z28.literal("coding-agent")]))
7188
+ copilot: z31.optional(
7189
+ z31.object({
7190
+ excludeAgent: z31.optional(z31.union([z31.literal("code-review"), z31.literal("coding-agent")]))
6111
7191
  })
6112
7192
  ),
6113
- antigravity: z28.optional(
6114
- z28.looseObject({
6115
- trigger: z28.optional(z28.string()),
6116
- globs: z28.optional(z28.array(z28.string()))
7193
+ antigravity: z31.optional(
7194
+ z31.looseObject({
7195
+ trigger: z31.optional(z31.string()),
7196
+ globs: z31.optional(z31.array(z31.string()))
6117
7197
  })
6118
7198
  )
6119
7199
  });
@@ -6125,7 +7205,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
6125
7205
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
6126
7206
  if (!result.success) {
6127
7207
  throw new Error(
6128
- `Invalid frontmatter in ${join61(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
7208
+ `Invalid frontmatter in ${join62(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
6129
7209
  );
6130
7210
  }
6131
7211
  }
@@ -6140,6 +7220,9 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
6140
7220
  return {
6141
7221
  recommended: {
6142
7222
  relativeDirPath: RULESYNC_RULES_RELATIVE_DIR_PATH
7223
+ },
7224
+ legacy: {
7225
+ relativeDirPath: RULESYNC_RELATIVE_DIR_PATH
6143
7226
  }
6144
7227
  };
6145
7228
  }
@@ -6157,16 +7240,54 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
6157
7240
  return {
6158
7241
  success: false,
6159
7242
  error: new Error(
6160
- `Invalid frontmatter in ${join61(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7243
+ `Invalid frontmatter in ${join62(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
6161
7244
  )
6162
7245
  };
6163
7246
  }
6164
7247
  }
7248
+ static async fromFileLegacy({
7249
+ relativeFilePath,
7250
+ validate = true
7251
+ }) {
7252
+ const legacyPath = join62(
7253
+ process.cwd(),
7254
+ this.getSettablePaths().legacy.relativeDirPath,
7255
+ relativeFilePath
7256
+ );
7257
+ const recommendedPath = join62(
7258
+ this.getSettablePaths().recommended.relativeDirPath,
7259
+ relativeFilePath
7260
+ );
7261
+ logger.warn(`\u26A0\uFE0F Using deprecated path "${legacyPath}". Please migrate to "${recommendedPath}"`);
7262
+ const fileContent = await readFileContent(legacyPath);
7263
+ const { frontmatter, body: content } = parseFrontmatter(fileContent);
7264
+ const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
7265
+ if (!result.success) {
7266
+ throw new Error(`Invalid frontmatter in ${legacyPath}: ${formatError(result.error)}`);
7267
+ }
7268
+ const validatedFrontmatter = {
7269
+ root: result.data.root ?? false,
7270
+ targets: result.data.targets ?? ["*"],
7271
+ description: result.data.description ?? "",
7272
+ globs: result.data.globs ?? [],
7273
+ agentsmd: result.data.agentsmd,
7274
+ cursor: result.data.cursor
7275
+ };
7276
+ const filename = basename18(legacyPath);
7277
+ return new _RulesyncRule({
7278
+ baseDir: process.cwd(),
7279
+ relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
7280
+ relativeFilePath: filename,
7281
+ frontmatter: validatedFrontmatter,
7282
+ body: content.trim(),
7283
+ validate
7284
+ });
7285
+ }
6165
7286
  static async fromFile({
6166
7287
  relativeFilePath,
6167
7288
  validate = true
6168
7289
  }) {
6169
- const filePath = join61(
7290
+ const filePath = join62(
6170
7291
  process.cwd(),
6171
7292
  this.getSettablePaths().recommended.relativeDirPath,
6172
7293
  relativeFilePath
@@ -6217,6 +7338,14 @@ var ToolRule = class extends ToolFile {
6217
7338
  static async fromFile(_params) {
6218
7339
  throw new Error("Please implement this method in the subclass.");
6219
7340
  }
7341
+ /**
7342
+ * Create a minimal instance for deletion purposes.
7343
+ * This method does not read or parse file content, making it safe to use
7344
+ * even when files have old/incompatible formats.
7345
+ */
7346
+ static forDeletion(_params) {
7347
+ throw new Error("Please implement this method in the subclass.");
7348
+ }
6220
7349
  static fromRulesyncRule(_params) {
6221
7350
  throw new Error("Please implement this method in the subclass.");
6222
7351
  }
@@ -6260,7 +7389,7 @@ var ToolRule = class extends ToolFile {
6260
7389
  rulesyncRule,
6261
7390
  validate = true,
6262
7391
  rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
6263
- nonRootPath = { relativeDirPath: join62(".agents", "memories") }
7392
+ nonRootPath = { relativeDirPath: join63(".agents", "memories") }
6264
7393
  }) {
6265
7394
  const params = this.buildToolRuleParamsDefault({
6266
7395
  baseDir,
@@ -6271,7 +7400,7 @@ var ToolRule = class extends ToolFile {
6271
7400
  });
6272
7401
  const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
6273
7402
  if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
6274
- params.relativeDirPath = join62(rulesyncFrontmatter.agentsmd.subprojectPath);
7403
+ params.relativeDirPath = join63(rulesyncFrontmatter.agentsmd.subprojectPath);
6275
7404
  params.relativeFilePath = "AGENTS.md";
6276
7405
  }
6277
7406
  return params;
@@ -6336,7 +7465,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
6336
7465
  relativeFilePath: "AGENTS.md"
6337
7466
  },
6338
7467
  nonRoot: {
6339
- relativeDirPath: join63(".agents", "memories")
7468
+ relativeDirPath: join64(".agents", "memories")
6340
7469
  }
6341
7470
  };
6342
7471
  }
@@ -6346,8 +7475,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
6346
7475
  validate = true
6347
7476
  }) {
6348
7477
  const isRoot = relativeFilePath === "AGENTS.md";
6349
- const relativePath = isRoot ? "AGENTS.md" : join63(".agents", "memories", relativeFilePath);
6350
- const fileContent = await readFileContent(join63(baseDir, relativePath));
7478
+ const relativePath = isRoot ? "AGENTS.md" : join64(".agents", "memories", relativeFilePath);
7479
+ const fileContent = await readFileContent(join64(baseDir, relativePath));
6351
7480
  return new _AgentsMdRule({
6352
7481
  baseDir,
6353
7482
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -6357,6 +7486,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
6357
7486
  root: isRoot
6358
7487
  });
6359
7488
  }
7489
+ static forDeletion({
7490
+ baseDir = process.cwd(),
7491
+ relativeDirPath,
7492
+ relativeFilePath
7493
+ }) {
7494
+ const isRoot = relativeFilePath === "AGENTS.md" && relativeDirPath === ".";
7495
+ return new _AgentsMdRule({
7496
+ baseDir,
7497
+ relativeDirPath,
7498
+ relativeFilePath,
7499
+ fileContent: "",
7500
+ validate: false,
7501
+ root: isRoot
7502
+ });
7503
+ }
6360
7504
  static fromRulesyncRule({
6361
7505
  baseDir = process.cwd(),
6362
7506
  rulesyncRule,
@@ -6387,12 +7531,12 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
6387
7531
  };
6388
7532
 
6389
7533
  // src/features/rules/amazonqcli-rule.ts
6390
- import { join as join64 } from "path";
7534
+ import { join as join65 } from "path";
6391
7535
  var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
6392
7536
  static getSettablePaths() {
6393
7537
  return {
6394
7538
  nonRoot: {
6395
- relativeDirPath: join64(".amazonq", "rules")
7539
+ relativeDirPath: join65(".amazonq", "rules")
6396
7540
  }
6397
7541
  };
6398
7542
  }
@@ -6402,7 +7546,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
6402
7546
  validate = true
6403
7547
  }) {
6404
7548
  const fileContent = await readFileContent(
6405
- join64(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7549
+ join65(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6406
7550
  );
6407
7551
  return new _AmazonQCliRule({
6408
7552
  baseDir,
@@ -6433,6 +7577,20 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
6433
7577
  validate() {
6434
7578
  return { success: true, error: null };
6435
7579
  }
7580
+ static forDeletion({
7581
+ baseDir = process.cwd(),
7582
+ relativeDirPath,
7583
+ relativeFilePath
7584
+ }) {
7585
+ return new _AmazonQCliRule({
7586
+ baseDir,
7587
+ relativeDirPath,
7588
+ relativeFilePath,
7589
+ fileContent: "",
7590
+ validate: false,
7591
+ root: false
7592
+ });
7593
+ }
6436
7594
  static isTargetedByRulesyncRule(rulesyncRule) {
6437
7595
  return this.isTargetedByRulesyncRuleDefault({
6438
7596
  rulesyncRule,
@@ -6442,21 +7600,21 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
6442
7600
  };
6443
7601
 
6444
7602
  // src/features/rules/antigravity-rule.ts
6445
- import { join as join65 } from "path";
6446
- import { z as z29 } from "zod/mini";
6447
- var AntigravityRuleFrontmatterSchema = z29.looseObject({
6448
- trigger: z29.optional(
6449
- z29.union([
6450
- z29.literal("always_on"),
6451
- z29.literal("glob"),
6452
- z29.literal("manual"),
6453
- z29.literal("model_decision"),
6454
- z29.string()
7603
+ import { join as join66 } from "path";
7604
+ import { z as z32 } from "zod/mini";
7605
+ var AntigravityRuleFrontmatterSchema = z32.looseObject({
7606
+ trigger: z32.optional(
7607
+ z32.union([
7608
+ z32.literal("always_on"),
7609
+ z32.literal("glob"),
7610
+ z32.literal("manual"),
7611
+ z32.literal("model_decision"),
7612
+ z32.string()
6455
7613
  // accepts any string for forward compatibility
6456
7614
  ])
6457
7615
  ),
6458
- globs: z29.optional(z29.string()),
6459
- description: z29.optional(z29.string())
7616
+ globs: z32.optional(z32.string()),
7617
+ description: z32.optional(z32.string())
6460
7618
  });
6461
7619
  function parseGlobsString(globs) {
6462
7620
  if (!globs) {
@@ -6601,7 +7759,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
6601
7759
  const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
6602
7760
  if (!result.success) {
6603
7761
  throw new Error(
6604
- `Invalid frontmatter in ${join65(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
7762
+ `Invalid frontmatter in ${join66(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
6605
7763
  );
6606
7764
  }
6607
7765
  }
@@ -6616,7 +7774,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
6616
7774
  static getSettablePaths() {
6617
7775
  return {
6618
7776
  nonRoot: {
6619
- relativeDirPath: join65(".agent", "rules")
7777
+ relativeDirPath: join66(".agent", "rules")
6620
7778
  }
6621
7779
  };
6622
7780
  }
@@ -6625,7 +7783,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
6625
7783
  relativeFilePath,
6626
7784
  validate = true
6627
7785
  }) {
6628
- const filePath = join65(
7786
+ const filePath = join66(
6629
7787
  baseDir,
6630
7788
  this.getSettablePaths().nonRoot.relativeDirPath,
6631
7789
  relativeFilePath
@@ -6742,6 +7900,21 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
6742
7900
  }
6743
7901
  return { success: true, error: null };
6744
7902
  }
7903
+ static forDeletion({
7904
+ baseDir = process.cwd(),
7905
+ relativeDirPath,
7906
+ relativeFilePath
7907
+ }) {
7908
+ return new _AntigravityRule({
7909
+ baseDir,
7910
+ relativeDirPath,
7911
+ relativeFilePath,
7912
+ frontmatter: {},
7913
+ body: "",
7914
+ validate: false,
7915
+ root: false
7916
+ });
7917
+ }
6745
7918
  static isTargetedByRulesyncRule(rulesyncRule) {
6746
7919
  return this.isTargetedByRulesyncRuleDefault({
6747
7920
  rulesyncRule,
@@ -6751,7 +7924,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
6751
7924
  };
6752
7925
 
6753
7926
  // src/features/rules/augmentcode-legacy-rule.ts
6754
- import { join as join66 } from "path";
7927
+ import { join as join67 } from "path";
6755
7928
  var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
6756
7929
  toRulesyncRule() {
6757
7930
  const rulesyncFrontmatter = {
@@ -6777,7 +7950,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
6777
7950
  relativeFilePath: ".augment-guidelines"
6778
7951
  },
6779
7952
  nonRoot: {
6780
- relativeDirPath: join66(".augment", "rules")
7953
+ relativeDirPath: join67(".augment", "rules")
6781
7954
  }
6782
7955
  };
6783
7956
  }
@@ -6812,8 +7985,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
6812
7985
  }) {
6813
7986
  const settablePaths = this.getSettablePaths();
6814
7987
  const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
6815
- const relativePath = isRoot ? settablePaths.root.relativeFilePath : join66(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
6816
- const fileContent = await readFileContent(join66(baseDir, relativePath));
7988
+ const relativePath = isRoot ? settablePaths.root.relativeFilePath : join67(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
7989
+ const fileContent = await readFileContent(join67(baseDir, relativePath));
6817
7990
  return new _AugmentcodeLegacyRule({
6818
7991
  baseDir,
6819
7992
  relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
@@ -6823,10 +7996,26 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
6823
7996
  root: isRoot
6824
7997
  });
6825
7998
  }
7999
+ static forDeletion({
8000
+ baseDir = process.cwd(),
8001
+ relativeDirPath,
8002
+ relativeFilePath
8003
+ }) {
8004
+ const settablePaths = this.getSettablePaths();
8005
+ const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
8006
+ return new _AugmentcodeLegacyRule({
8007
+ baseDir,
8008
+ relativeDirPath,
8009
+ relativeFilePath,
8010
+ fileContent: "",
8011
+ validate: false,
8012
+ root: isRoot
8013
+ });
8014
+ }
6826
8015
  };
6827
8016
 
6828
8017
  // src/features/rules/augmentcode-rule.ts
6829
- import { join as join67 } from "path";
8018
+ import { join as join68 } from "path";
6830
8019
  var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
6831
8020
  toRulesyncRule() {
6832
8021
  return this.toRulesyncRuleDefault();
@@ -6834,7 +8023,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
6834
8023
  static getSettablePaths() {
6835
8024
  return {
6836
8025
  nonRoot: {
6837
- relativeDirPath: join67(".augment", "rules")
8026
+ relativeDirPath: join68(".augment", "rules")
6838
8027
  }
6839
8028
  };
6840
8029
  }
@@ -6858,7 +8047,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
6858
8047
  validate = true
6859
8048
  }) {
6860
8049
  const fileContent = await readFileContent(
6861
- join67(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
8050
+ join68(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6862
8051
  );
6863
8052
  const { body: content } = parseFrontmatter(fileContent);
6864
8053
  return new _AugmentcodeRule({
@@ -6869,9 +8058,22 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
6869
8058
  validate
6870
8059
  });
6871
8060
  }
6872
- validate() {
6873
- return { success: true, error: null };
6874
- }
8061
+ validate() {
8062
+ return { success: true, error: null };
8063
+ }
8064
+ static forDeletion({
8065
+ baseDir = process.cwd(),
8066
+ relativeDirPath,
8067
+ relativeFilePath
8068
+ }) {
8069
+ return new _AugmentcodeRule({
8070
+ baseDir,
8071
+ relativeDirPath,
8072
+ relativeFilePath,
8073
+ fileContent: "",
8074
+ validate: false
8075
+ });
8076
+ }
6875
8077
  static isTargetedByRulesyncRule(rulesyncRule) {
6876
8078
  return this.isTargetedByRulesyncRuleDefault({
6877
8079
  rulesyncRule,
@@ -6881,7 +8083,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
6881
8083
  };
6882
8084
 
6883
8085
  // src/features/rules/claudecode-legacy-rule.ts
6884
- import { join as join68 } from "path";
8086
+ import { join as join69 } from "path";
6885
8087
  var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
6886
8088
  static getSettablePaths({
6887
8089
  global
@@ -6900,7 +8102,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
6900
8102
  relativeFilePath: "CLAUDE.md"
6901
8103
  },
6902
8104
  nonRoot: {
6903
- relativeDirPath: join68(".claude", "memories")
8105
+ relativeDirPath: join69(".claude", "memories")
6904
8106
  }
6905
8107
  };
6906
8108
  }
@@ -6915,7 +8117,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
6915
8117
  if (isRoot) {
6916
8118
  const relativePath2 = paths.root.relativeFilePath;
6917
8119
  const fileContent2 = await readFileContent(
6918
- join68(baseDir, paths.root.relativeDirPath, relativePath2)
8120
+ join69(baseDir, paths.root.relativeDirPath, relativePath2)
6919
8121
  );
6920
8122
  return new _ClaudecodeLegacyRule({
6921
8123
  baseDir,
@@ -6929,8 +8131,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
6929
8131
  if (!paths.nonRoot) {
6930
8132
  throw new Error("nonRoot path is not set");
6931
8133
  }
6932
- const relativePath = join68(paths.nonRoot.relativeDirPath, relativeFilePath);
6933
- const fileContent = await readFileContent(join68(baseDir, relativePath));
8134
+ const relativePath = join69(paths.nonRoot.relativeDirPath, relativeFilePath);
8135
+ const fileContent = await readFileContent(join69(baseDir, relativePath));
6934
8136
  return new _ClaudecodeLegacyRule({
6935
8137
  baseDir,
6936
8138
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -6963,6 +8165,23 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
6963
8165
  validate() {
6964
8166
  return { success: true, error: null };
6965
8167
  }
8168
+ static forDeletion({
8169
+ baseDir = process.cwd(),
8170
+ relativeDirPath,
8171
+ relativeFilePath,
8172
+ global = false
8173
+ }) {
8174
+ const paths = this.getSettablePaths({ global });
8175
+ const isRoot = relativeFilePath === paths.root.relativeFilePath;
8176
+ return new _ClaudecodeLegacyRule({
8177
+ baseDir,
8178
+ relativeDirPath,
8179
+ relativeFilePath,
8180
+ fileContent: "",
8181
+ validate: false,
8182
+ root: isRoot
8183
+ });
8184
+ }
6966
8185
  static isTargetedByRulesyncRule(rulesyncRule) {
6967
8186
  return this.isTargetedByRulesyncRuleDefault({
6968
8187
  rulesyncRule,
@@ -6972,10 +8191,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
6972
8191
  };
6973
8192
 
6974
8193
  // src/features/rules/claudecode-rule.ts
6975
- import { join as join69 } from "path";
6976
- import { z as z30 } from "zod/mini";
6977
- var ClaudecodeRuleFrontmatterSchema = z30.object({
6978
- paths: z30.optional(z30.string())
8194
+ import { join as join70 } from "path";
8195
+ import { z as z33 } from "zod/mini";
8196
+ var ClaudecodeRuleFrontmatterSchema = z33.object({
8197
+ paths: z33.optional(z33.string())
6979
8198
  });
6980
8199
  var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
6981
8200
  frontmatter;
@@ -6997,7 +8216,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
6997
8216
  relativeFilePath: "CLAUDE.md"
6998
8217
  },
6999
8218
  nonRoot: {
7000
- relativeDirPath: join69(".claude", "rules")
8219
+ relativeDirPath: join70(".claude", "rules")
7001
8220
  }
7002
8221
  };
7003
8222
  }
@@ -7006,7 +8225,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
7006
8225
  const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
7007
8226
  if (!result.success) {
7008
8227
  throw new Error(
7009
- `Invalid frontmatter in ${join69(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
8228
+ `Invalid frontmatter in ${join70(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
7010
8229
  );
7011
8230
  }
7012
8231
  }
@@ -7034,7 +8253,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
7034
8253
  const isRoot = relativeFilePath === paths.root.relativeFilePath;
7035
8254
  if (isRoot) {
7036
8255
  const fileContent2 = await readFileContent(
7037
- join69(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
8256
+ join70(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
7038
8257
  );
7039
8258
  return new _ClaudecodeRule({
7040
8259
  baseDir,
@@ -7049,13 +8268,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
7049
8268
  if (!paths.nonRoot) {
7050
8269
  throw new Error("nonRoot path is not set");
7051
8270
  }
7052
- const relativePath = join69(paths.nonRoot.relativeDirPath, relativeFilePath);
7053
- const fileContent = await readFileContent(join69(baseDir, relativePath));
8271
+ const relativePath = join70(paths.nonRoot.relativeDirPath, relativeFilePath);
8272
+ const fileContent = await readFileContent(join70(baseDir, relativePath));
7054
8273
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
7055
8274
  const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
7056
8275
  if (!result.success) {
7057
8276
  throw new Error(
7058
- `Invalid frontmatter in ${join69(baseDir, relativePath)}: ${formatError(result.error)}`
8277
+ `Invalid frontmatter in ${join70(baseDir, relativePath)}: ${formatError(result.error)}`
7059
8278
  );
7060
8279
  }
7061
8280
  return new _ClaudecodeRule({
@@ -7068,6 +8287,24 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
7068
8287
  root: false
7069
8288
  });
7070
8289
  }
8290
+ static forDeletion({
8291
+ baseDir = process.cwd(),
8292
+ relativeDirPath,
8293
+ relativeFilePath,
8294
+ global = false
8295
+ }) {
8296
+ const paths = this.getSettablePaths({ global });
8297
+ const isRoot = relativeFilePath === paths.root.relativeFilePath;
8298
+ return new _ClaudecodeRule({
8299
+ baseDir,
8300
+ relativeDirPath,
8301
+ relativeFilePath,
8302
+ frontmatter: {},
8303
+ body: "",
8304
+ validate: false,
8305
+ root: isRoot
8306
+ });
8307
+ }
7071
8308
  static fromRulesyncRule({
7072
8309
  baseDir = process.cwd(),
7073
8310
  rulesyncRule,
@@ -7144,7 +8381,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
7144
8381
  return {
7145
8382
  success: false,
7146
8383
  error: new Error(
7147
- `Invalid frontmatter in ${join69(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
8384
+ `Invalid frontmatter in ${join70(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7148
8385
  )
7149
8386
  };
7150
8387
  }
@@ -7164,10 +8401,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
7164
8401
  };
7165
8402
 
7166
8403
  // src/features/rules/cline-rule.ts
7167
- import { join as join70 } from "path";
7168
- import { z as z31 } from "zod/mini";
7169
- var ClineRuleFrontmatterSchema = z31.object({
7170
- description: z31.string()
8404
+ import { join as join71 } from "path";
8405
+ import { z as z34 } from "zod/mini";
8406
+ var ClineRuleFrontmatterSchema = z34.object({
8407
+ description: z34.string()
7171
8408
  });
7172
8409
  var ClineRule = class _ClineRule extends ToolRule {
7173
8410
  static getSettablePaths() {
@@ -7209,7 +8446,7 @@ var ClineRule = class _ClineRule extends ToolRule {
7209
8446
  validate = true
7210
8447
  }) {
7211
8448
  const fileContent = await readFileContent(
7212
- join70(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
8449
+ join71(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7213
8450
  );
7214
8451
  return new _ClineRule({
7215
8452
  baseDir,
@@ -7219,10 +8456,23 @@ var ClineRule = class _ClineRule extends ToolRule {
7219
8456
  validate
7220
8457
  });
7221
8458
  }
8459
+ static forDeletion({
8460
+ baseDir = process.cwd(),
8461
+ relativeDirPath,
8462
+ relativeFilePath
8463
+ }) {
8464
+ return new _ClineRule({
8465
+ baseDir,
8466
+ relativeDirPath,
8467
+ relativeFilePath,
8468
+ fileContent: "",
8469
+ validate: false
8470
+ });
8471
+ }
7222
8472
  };
7223
8473
 
7224
8474
  // src/features/rules/codexcli-rule.ts
7225
- import { join as join71 } from "path";
8475
+ import { join as join72 } from "path";
7226
8476
  var CodexcliRule = class _CodexcliRule extends ToolRule {
7227
8477
  static getSettablePaths({
7228
8478
  global
@@ -7241,7 +8491,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
7241
8491
  relativeFilePath: "AGENTS.md"
7242
8492
  },
7243
8493
  nonRoot: {
7244
- relativeDirPath: join71(".codex", "memories")
8494
+ relativeDirPath: join72(".codex", "memories")
7245
8495
  }
7246
8496
  };
7247
8497
  }
@@ -7256,7 +8506,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
7256
8506
  if (isRoot) {
7257
8507
  const relativePath2 = paths.root.relativeFilePath;
7258
8508
  const fileContent2 = await readFileContent(
7259
- join71(baseDir, paths.root.relativeDirPath, relativePath2)
8509
+ join72(baseDir, paths.root.relativeDirPath, relativePath2)
7260
8510
  );
7261
8511
  return new _CodexcliRule({
7262
8512
  baseDir,
@@ -7270,8 +8520,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
7270
8520
  if (!paths.nonRoot) {
7271
8521
  throw new Error("nonRoot path is not set");
7272
8522
  }
7273
- const relativePath = join71(paths.nonRoot.relativeDirPath, relativeFilePath);
7274
- const fileContent = await readFileContent(join71(baseDir, relativePath));
8523
+ const relativePath = join72(paths.nonRoot.relativeDirPath, relativeFilePath);
8524
+ const fileContent = await readFileContent(join72(baseDir, relativePath));
7275
8525
  return new _CodexcliRule({
7276
8526
  baseDir,
7277
8527
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -7304,6 +8554,23 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
7304
8554
  validate() {
7305
8555
  return { success: true, error: null };
7306
8556
  }
8557
+ static forDeletion({
8558
+ baseDir = process.cwd(),
8559
+ relativeDirPath,
8560
+ relativeFilePath,
8561
+ global = false
8562
+ }) {
8563
+ const paths = this.getSettablePaths({ global });
8564
+ const isRoot = relativeFilePath === paths.root.relativeFilePath;
8565
+ return new _CodexcliRule({
8566
+ baseDir,
8567
+ relativeDirPath,
8568
+ relativeFilePath,
8569
+ fileContent: "",
8570
+ validate: false,
8571
+ root: isRoot
8572
+ });
8573
+ }
7307
8574
  static isTargetedByRulesyncRule(rulesyncRule) {
7308
8575
  return this.isTargetedByRulesyncRuleDefault({
7309
8576
  rulesyncRule,
@@ -7313,12 +8580,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
7313
8580
  };
7314
8581
 
7315
8582
  // src/features/rules/copilot-rule.ts
7316
- import { join as join72 } from "path";
7317
- import { z as z32 } from "zod/mini";
7318
- var CopilotRuleFrontmatterSchema = z32.object({
7319
- description: z32.optional(z32.string()),
7320
- applyTo: z32.optional(z32.string()),
7321
- excludeAgent: z32.optional(z32.union([z32.literal("code-review"), z32.literal("coding-agent")]))
8583
+ import { join as join73 } from "path";
8584
+ import { z as z35 } from "zod/mini";
8585
+ var CopilotRuleFrontmatterSchema = z35.object({
8586
+ description: z35.optional(z35.string()),
8587
+ applyTo: z35.optional(z35.string()),
8588
+ excludeAgent: z35.optional(z35.union([z35.literal("code-review"), z35.literal("coding-agent")]))
7322
8589
  });
7323
8590
  var CopilotRule = class _CopilotRule extends ToolRule {
7324
8591
  frontmatter;
@@ -7330,7 +8597,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
7330
8597
  relativeFilePath: "copilot-instructions.md"
7331
8598
  },
7332
8599
  nonRoot: {
7333
- relativeDirPath: join72(".github", "instructions")
8600
+ relativeDirPath: join73(".github", "instructions")
7334
8601
  }
7335
8602
  };
7336
8603
  }
@@ -7339,7 +8606,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
7339
8606
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
7340
8607
  if (!result.success) {
7341
8608
  throw new Error(
7342
- `Invalid frontmatter in ${join72(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
8609
+ `Invalid frontmatter in ${join73(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
7343
8610
  );
7344
8611
  }
7345
8612
  }
@@ -7421,11 +8688,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
7421
8688
  validate = true
7422
8689
  }) {
7423
8690
  const isRoot = relativeFilePath === "copilot-instructions.md";
7424
- const relativePath = isRoot ? join72(
8691
+ const relativePath = isRoot ? join73(
7425
8692
  this.getSettablePaths().root.relativeDirPath,
7426
8693
  this.getSettablePaths().root.relativeFilePath
7427
- ) : join72(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
7428
- const fileContent = await readFileContent(join72(baseDir, relativePath));
8694
+ ) : join73(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
8695
+ const fileContent = await readFileContent(join73(baseDir, relativePath));
7429
8696
  if (isRoot) {
7430
8697
  return new _CopilotRule({
7431
8698
  baseDir,
@@ -7441,7 +8708,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
7441
8708
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
7442
8709
  if (!result.success) {
7443
8710
  throw new Error(
7444
- `Invalid frontmatter in ${join72(baseDir, relativeFilePath)}: ${formatError(result.error)}`
8711
+ `Invalid frontmatter in ${join73(baseDir, relativeFilePath)}: ${formatError(result.error)}`
7445
8712
  );
7446
8713
  }
7447
8714
  return new _CopilotRule({
@@ -7454,6 +8721,22 @@ var CopilotRule = class _CopilotRule extends ToolRule {
7454
8721
  root: isRoot
7455
8722
  });
7456
8723
  }
8724
+ static forDeletion({
8725
+ baseDir = process.cwd(),
8726
+ relativeDirPath,
8727
+ relativeFilePath
8728
+ }) {
8729
+ const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
8730
+ return new _CopilotRule({
8731
+ baseDir,
8732
+ relativeDirPath,
8733
+ relativeFilePath,
8734
+ frontmatter: {},
8735
+ body: "",
8736
+ validate: false,
8737
+ root: isRoot
8738
+ });
8739
+ }
7457
8740
  validate() {
7458
8741
  if (!this.frontmatter) {
7459
8742
  return { success: true, error: null };
@@ -7465,7 +8748,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
7465
8748
  return {
7466
8749
  success: false,
7467
8750
  error: new Error(
7468
- `Invalid frontmatter in ${join72(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
8751
+ `Invalid frontmatter in ${join73(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7469
8752
  )
7470
8753
  };
7471
8754
  }
@@ -7485,12 +8768,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
7485
8768
  };
7486
8769
 
7487
8770
  // src/features/rules/cursor-rule.ts
7488
- import { basename as basename19, join as join73 } from "path";
7489
- import { z as z33 } from "zod/mini";
7490
- var CursorRuleFrontmatterSchema = z33.object({
7491
- description: z33.optional(z33.string()),
7492
- globs: z33.optional(z33.string()),
7493
- alwaysApply: z33.optional(z33.boolean())
8771
+ import { basename as basename19, join as join74 } from "path";
8772
+ import { z as z36 } from "zod/mini";
8773
+ var CursorRuleFrontmatterSchema = z36.object({
8774
+ description: z36.optional(z36.string()),
8775
+ globs: z36.optional(z36.string()),
8776
+ alwaysApply: z36.optional(z36.boolean())
7494
8777
  });
7495
8778
  var CursorRule = class _CursorRule extends ToolRule {
7496
8779
  frontmatter;
@@ -7498,7 +8781,7 @@ var CursorRule = class _CursorRule extends ToolRule {
7498
8781
  static getSettablePaths() {
7499
8782
  return {
7500
8783
  nonRoot: {
7501
- relativeDirPath: join73(".cursor", "rules")
8784
+ relativeDirPath: join74(".cursor", "rules")
7502
8785
  }
7503
8786
  };
7504
8787
  }
@@ -7507,7 +8790,7 @@ var CursorRule = class _CursorRule extends ToolRule {
7507
8790
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
7508
8791
  if (!result.success) {
7509
8792
  throw new Error(
7510
- `Invalid frontmatter in ${join73(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
8793
+ `Invalid frontmatter in ${join74(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
7511
8794
  );
7512
8795
  }
7513
8796
  }
@@ -7624,13 +8907,13 @@ var CursorRule = class _CursorRule extends ToolRule {
7624
8907
  validate = true
7625
8908
  }) {
7626
8909
  const fileContent = await readFileContent(
7627
- join73(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
8910
+ join74(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7628
8911
  );
7629
8912
  const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
7630
8913
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
7631
8914
  if (!result.success) {
7632
8915
  throw new Error(
7633
- `Invalid frontmatter in ${join73(baseDir, relativeFilePath)}: ${formatError(result.error)}`
8916
+ `Invalid frontmatter in ${join74(baseDir, relativeFilePath)}: ${formatError(result.error)}`
7634
8917
  );
7635
8918
  }
7636
8919
  return new _CursorRule({
@@ -7642,6 +8925,20 @@ var CursorRule = class _CursorRule extends ToolRule {
7642
8925
  validate
7643
8926
  });
7644
8927
  }
8928
+ static forDeletion({
8929
+ baseDir = process.cwd(),
8930
+ relativeDirPath,
8931
+ relativeFilePath
8932
+ }) {
8933
+ return new _CursorRule({
8934
+ baseDir,
8935
+ relativeDirPath,
8936
+ relativeFilePath,
8937
+ frontmatter: {},
8938
+ body: "",
8939
+ validate: false
8940
+ });
8941
+ }
7645
8942
  validate() {
7646
8943
  if (!this.frontmatter) {
7647
8944
  return { success: true, error: null };
@@ -7653,7 +8950,7 @@ var CursorRule = class _CursorRule extends ToolRule {
7653
8950
  return {
7654
8951
  success: false,
7655
8952
  error: new Error(
7656
- `Invalid frontmatter in ${join73(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
8953
+ `Invalid frontmatter in ${join74(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7657
8954
  )
7658
8955
  };
7659
8956
  }
@@ -7673,7 +8970,7 @@ var CursorRule = class _CursorRule extends ToolRule {
7673
8970
  };
7674
8971
 
7675
8972
  // src/features/rules/geminicli-rule.ts
7676
- import { join as join74 } from "path";
8973
+ import { join as join75 } from "path";
7677
8974
  var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7678
8975
  static getSettablePaths({
7679
8976
  global
@@ -7692,7 +8989,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7692
8989
  relativeFilePath: "GEMINI.md"
7693
8990
  },
7694
8991
  nonRoot: {
7695
- relativeDirPath: join74(".gemini", "memories")
8992
+ relativeDirPath: join75(".gemini", "memories")
7696
8993
  }
7697
8994
  };
7698
8995
  }
@@ -7707,7 +9004,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7707
9004
  if (isRoot) {
7708
9005
  const relativePath2 = paths.root.relativeFilePath;
7709
9006
  const fileContent2 = await readFileContent(
7710
- join74(baseDir, paths.root.relativeDirPath, relativePath2)
9007
+ join75(baseDir, paths.root.relativeDirPath, relativePath2)
7711
9008
  );
7712
9009
  return new _GeminiCliRule({
7713
9010
  baseDir,
@@ -7721,8 +9018,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7721
9018
  if (!paths.nonRoot) {
7722
9019
  throw new Error("nonRoot path is not set");
7723
9020
  }
7724
- const relativePath = join74(paths.nonRoot.relativeDirPath, relativeFilePath);
7725
- const fileContent = await readFileContent(join74(baseDir, relativePath));
9021
+ const relativePath = join75(paths.nonRoot.relativeDirPath, relativeFilePath);
9022
+ const fileContent = await readFileContent(join75(baseDir, relativePath));
7726
9023
  return new _GeminiCliRule({
7727
9024
  baseDir,
7728
9025
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -7755,6 +9052,23 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7755
9052
  validate() {
7756
9053
  return { success: true, error: null };
7757
9054
  }
9055
+ static forDeletion({
9056
+ baseDir = process.cwd(),
9057
+ relativeDirPath,
9058
+ relativeFilePath,
9059
+ global = false
9060
+ }) {
9061
+ const paths = this.getSettablePaths({ global });
9062
+ const isRoot = relativeFilePath === paths.root.relativeFilePath;
9063
+ return new _GeminiCliRule({
9064
+ baseDir,
9065
+ relativeDirPath,
9066
+ relativeFilePath,
9067
+ fileContent: "",
9068
+ validate: false,
9069
+ root: isRoot
9070
+ });
9071
+ }
7758
9072
  static isTargetedByRulesyncRule(rulesyncRule) {
7759
9073
  return this.isTargetedByRulesyncRuleDefault({
7760
9074
  rulesyncRule,
@@ -7764,7 +9078,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7764
9078
  };
7765
9079
 
7766
9080
  // src/features/rules/junie-rule.ts
7767
- import { join as join75 } from "path";
9081
+ import { join as join76 } from "path";
7768
9082
  var JunieRule = class _JunieRule extends ToolRule {
7769
9083
  static getSettablePaths() {
7770
9084
  return {
@@ -7773,7 +9087,7 @@ var JunieRule = class _JunieRule extends ToolRule {
7773
9087
  relativeFilePath: "guidelines.md"
7774
9088
  },
7775
9089
  nonRoot: {
7776
- relativeDirPath: join75(".junie", "memories")
9090
+ relativeDirPath: join76(".junie", "memories")
7777
9091
  }
7778
9092
  };
7779
9093
  }
@@ -7783,8 +9097,8 @@ var JunieRule = class _JunieRule extends ToolRule {
7783
9097
  validate = true
7784
9098
  }) {
7785
9099
  const isRoot = relativeFilePath === "guidelines.md";
7786
- const relativePath = isRoot ? "guidelines.md" : join75(".junie", "memories", relativeFilePath);
7787
- const fileContent = await readFileContent(join75(baseDir, relativePath));
9100
+ const relativePath = isRoot ? "guidelines.md" : join76(".junie", "memories", relativeFilePath);
9101
+ const fileContent = await readFileContent(join76(baseDir, relativePath));
7788
9102
  return new _JunieRule({
7789
9103
  baseDir,
7790
9104
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -7815,6 +9129,21 @@ var JunieRule = class _JunieRule extends ToolRule {
7815
9129
  validate() {
7816
9130
  return { success: true, error: null };
7817
9131
  }
9132
+ static forDeletion({
9133
+ baseDir = process.cwd(),
9134
+ relativeDirPath,
9135
+ relativeFilePath
9136
+ }) {
9137
+ const isRoot = relativeFilePath === "guidelines.md";
9138
+ return new _JunieRule({
9139
+ baseDir,
9140
+ relativeDirPath,
9141
+ relativeFilePath,
9142
+ fileContent: "",
9143
+ validate: false,
9144
+ root: isRoot
9145
+ });
9146
+ }
7818
9147
  static isTargetedByRulesyncRule(rulesyncRule) {
7819
9148
  return this.isTargetedByRulesyncRuleDefault({
7820
9149
  rulesyncRule,
@@ -7824,12 +9153,12 @@ var JunieRule = class _JunieRule extends ToolRule {
7824
9153
  };
7825
9154
 
7826
9155
  // src/features/rules/kiro-rule.ts
7827
- import { join as join76 } from "path";
9156
+ import { join as join77 } from "path";
7828
9157
  var KiroRule = class _KiroRule extends ToolRule {
7829
9158
  static getSettablePaths() {
7830
9159
  return {
7831
9160
  nonRoot: {
7832
- relativeDirPath: join76(".kiro", "steering")
9161
+ relativeDirPath: join77(".kiro", "steering")
7833
9162
  }
7834
9163
  };
7835
9164
  }
@@ -7839,7 +9168,7 @@ var KiroRule = class _KiroRule extends ToolRule {
7839
9168
  validate = true
7840
9169
  }) {
7841
9170
  const fileContent = await readFileContent(
7842
- join76(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
9171
+ join77(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7843
9172
  );
7844
9173
  return new _KiroRule({
7845
9174
  baseDir,
@@ -7870,6 +9199,20 @@ var KiroRule = class _KiroRule extends ToolRule {
7870
9199
  validate() {
7871
9200
  return { success: true, error: null };
7872
9201
  }
9202
+ static forDeletion({
9203
+ baseDir = process.cwd(),
9204
+ relativeDirPath,
9205
+ relativeFilePath
9206
+ }) {
9207
+ return new _KiroRule({
9208
+ baseDir,
9209
+ relativeDirPath,
9210
+ relativeFilePath,
9211
+ fileContent: "",
9212
+ validate: false,
9213
+ root: false
9214
+ });
9215
+ }
7873
9216
  static isTargetedByRulesyncRule(rulesyncRule) {
7874
9217
  return this.isTargetedByRulesyncRuleDefault({
7875
9218
  rulesyncRule,
@@ -7879,7 +9222,7 @@ var KiroRule = class _KiroRule extends ToolRule {
7879
9222
  };
7880
9223
 
7881
9224
  // src/features/rules/opencode-rule.ts
7882
- import { join as join77 } from "path";
9225
+ import { join as join78 } from "path";
7883
9226
  var OpenCodeRule = class _OpenCodeRule extends ToolRule {
7884
9227
  static getSettablePaths() {
7885
9228
  return {
@@ -7888,7 +9231,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
7888
9231
  relativeFilePath: "AGENTS.md"
7889
9232
  },
7890
9233
  nonRoot: {
7891
- relativeDirPath: join77(".opencode", "memories")
9234
+ relativeDirPath: join78(".opencode", "memories")
7892
9235
  }
7893
9236
  };
7894
9237
  }
@@ -7898,8 +9241,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
7898
9241
  validate = true
7899
9242
  }) {
7900
9243
  const isRoot = relativeFilePath === "AGENTS.md";
7901
- const relativePath = isRoot ? "AGENTS.md" : join77(".opencode", "memories", relativeFilePath);
7902
- const fileContent = await readFileContent(join77(baseDir, relativePath));
9244
+ const relativePath = isRoot ? "AGENTS.md" : join78(".opencode", "memories", relativeFilePath);
9245
+ const fileContent = await readFileContent(join78(baseDir, relativePath));
7903
9246
  return new _OpenCodeRule({
7904
9247
  baseDir,
7905
9248
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -7930,6 +9273,21 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
7930
9273
  validate() {
7931
9274
  return { success: true, error: null };
7932
9275
  }
9276
+ static forDeletion({
9277
+ baseDir = process.cwd(),
9278
+ relativeDirPath,
9279
+ relativeFilePath
9280
+ }) {
9281
+ const isRoot = relativeFilePath === "AGENTS.md" && relativeDirPath === ".";
9282
+ return new _OpenCodeRule({
9283
+ baseDir,
9284
+ relativeDirPath,
9285
+ relativeFilePath,
9286
+ fileContent: "",
9287
+ validate: false,
9288
+ root: isRoot
9289
+ });
9290
+ }
7933
9291
  static isTargetedByRulesyncRule(rulesyncRule) {
7934
9292
  return this.isTargetedByRulesyncRuleDefault({
7935
9293
  rulesyncRule,
@@ -7939,7 +9297,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
7939
9297
  };
7940
9298
 
7941
9299
  // src/features/rules/qwencode-rule.ts
7942
- import { join as join78 } from "path";
9300
+ import { join as join79 } from "path";
7943
9301
  var QwencodeRule = class _QwencodeRule extends ToolRule {
7944
9302
  static getSettablePaths() {
7945
9303
  return {
@@ -7948,7 +9306,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
7948
9306
  relativeFilePath: "QWEN.md"
7949
9307
  },
7950
9308
  nonRoot: {
7951
- relativeDirPath: join78(".qwen", "memories")
9309
+ relativeDirPath: join79(".qwen", "memories")
7952
9310
  }
7953
9311
  };
7954
9312
  }
@@ -7958,8 +9316,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
7958
9316
  validate = true
7959
9317
  }) {
7960
9318
  const isRoot = relativeFilePath === "QWEN.md";
7961
- const relativePath = isRoot ? "QWEN.md" : join78(".qwen", "memories", relativeFilePath);
7962
- const fileContent = await readFileContent(join78(baseDir, relativePath));
9319
+ const relativePath = isRoot ? "QWEN.md" : join79(".qwen", "memories", relativeFilePath);
9320
+ const fileContent = await readFileContent(join79(baseDir, relativePath));
7963
9321
  return new _QwencodeRule({
7964
9322
  baseDir,
7965
9323
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -7987,6 +9345,21 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
7987
9345
  validate() {
7988
9346
  return { success: true, error: null };
7989
9347
  }
9348
+ static forDeletion({
9349
+ baseDir = process.cwd(),
9350
+ relativeDirPath,
9351
+ relativeFilePath
9352
+ }) {
9353
+ const isRoot = relativeFilePath === "QWEN.md" && relativeDirPath === ".";
9354
+ return new _QwencodeRule({
9355
+ baseDir,
9356
+ relativeDirPath,
9357
+ relativeFilePath,
9358
+ fileContent: "",
9359
+ validate: false,
9360
+ root: isRoot
9361
+ });
9362
+ }
7990
9363
  static isTargetedByRulesyncRule(rulesyncRule) {
7991
9364
  return this.isTargetedByRulesyncRuleDefault({
7992
9365
  rulesyncRule,
@@ -7996,12 +9369,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
7996
9369
  };
7997
9370
 
7998
9371
  // src/features/rules/roo-rule.ts
7999
- import { join as join79 } from "path";
9372
+ import { join as join80 } from "path";
8000
9373
  var RooRule = class _RooRule extends ToolRule {
8001
9374
  static getSettablePaths() {
8002
9375
  return {
8003
9376
  nonRoot: {
8004
- relativeDirPath: join79(".roo", "rules")
9377
+ relativeDirPath: join80(".roo", "rules")
8005
9378
  }
8006
9379
  };
8007
9380
  }
@@ -8011,7 +9384,7 @@ var RooRule = class _RooRule extends ToolRule {
8011
9384
  validate = true
8012
9385
  }) {
8013
9386
  const fileContent = await readFileContent(
8014
- join79(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
9387
+ join80(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
8015
9388
  );
8016
9389
  return new _RooRule({
8017
9390
  baseDir,
@@ -8057,6 +9430,20 @@ var RooRule = class _RooRule extends ToolRule {
8057
9430
  validate() {
8058
9431
  return { success: true, error: null };
8059
9432
  }
9433
+ static forDeletion({
9434
+ baseDir = process.cwd(),
9435
+ relativeDirPath,
9436
+ relativeFilePath
9437
+ }) {
9438
+ return new _RooRule({
9439
+ baseDir,
9440
+ relativeDirPath,
9441
+ relativeFilePath,
9442
+ fileContent: "",
9443
+ validate: false,
9444
+ root: false
9445
+ });
9446
+ }
8060
9447
  static isTargetedByRulesyncRule(rulesyncRule) {
8061
9448
  return this.isTargetedByRulesyncRuleDefault({
8062
9449
  rulesyncRule,
@@ -8066,7 +9453,7 @@ var RooRule = class _RooRule extends ToolRule {
8066
9453
  };
8067
9454
 
8068
9455
  // src/features/rules/warp-rule.ts
8069
- import { join as join80 } from "path";
9456
+ import { join as join81 } from "path";
8070
9457
  var WarpRule = class _WarpRule extends ToolRule {
8071
9458
  constructor({ fileContent, root, ...rest }) {
8072
9459
  super({
@@ -8082,7 +9469,7 @@ var WarpRule = class _WarpRule extends ToolRule {
8082
9469
  relativeFilePath: "WARP.md"
8083
9470
  },
8084
9471
  nonRoot: {
8085
- relativeDirPath: join80(".warp", "memories")
9472
+ relativeDirPath: join81(".warp", "memories")
8086
9473
  }
8087
9474
  };
8088
9475
  }
@@ -8092,8 +9479,8 @@ var WarpRule = class _WarpRule extends ToolRule {
8092
9479
  validate = true
8093
9480
  }) {
8094
9481
  const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
8095
- const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join80(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
8096
- const fileContent = await readFileContent(join80(baseDir, relativePath));
9482
+ const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join81(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
9483
+ const fileContent = await readFileContent(join81(baseDir, relativePath));
8097
9484
  return new _WarpRule({
8098
9485
  baseDir,
8099
9486
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
@@ -8124,6 +9511,21 @@ var WarpRule = class _WarpRule extends ToolRule {
8124
9511
  validate() {
8125
9512
  return { success: true, error: null };
8126
9513
  }
9514
+ static forDeletion({
9515
+ baseDir = process.cwd(),
9516
+ relativeDirPath,
9517
+ relativeFilePath
9518
+ }) {
9519
+ const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
9520
+ return new _WarpRule({
9521
+ baseDir,
9522
+ relativeDirPath,
9523
+ relativeFilePath,
9524
+ fileContent: "",
9525
+ validate: false,
9526
+ root: isRoot
9527
+ });
9528
+ }
8127
9529
  static isTargetedByRulesyncRule(rulesyncRule) {
8128
9530
  return this.isTargetedByRulesyncRuleDefault({
8129
9531
  rulesyncRule,
@@ -8133,12 +9535,12 @@ var WarpRule = class _WarpRule extends ToolRule {
8133
9535
  };
8134
9536
 
8135
9537
  // src/features/rules/windsurf-rule.ts
8136
- import { join as join81 } from "path";
9538
+ import { join as join82 } from "path";
8137
9539
  var WindsurfRule = class _WindsurfRule extends ToolRule {
8138
9540
  static getSettablePaths() {
8139
9541
  return {
8140
9542
  nonRoot: {
8141
- relativeDirPath: join81(".windsurf", "rules")
9543
+ relativeDirPath: join82(".windsurf", "rules")
8142
9544
  }
8143
9545
  };
8144
9546
  }
@@ -8148,7 +9550,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
8148
9550
  validate = true
8149
9551
  }) {
8150
9552
  const fileContent = await readFileContent(
8151
- join81(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
9553
+ join82(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
8152
9554
  );
8153
9555
  return new _WindsurfRule({
8154
9556
  baseDir,
@@ -8178,6 +9580,19 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
8178
9580
  validate() {
8179
9581
  return { success: true, error: null };
8180
9582
  }
9583
+ static forDeletion({
9584
+ baseDir = process.cwd(),
9585
+ relativeDirPath,
9586
+ relativeFilePath
9587
+ }) {
9588
+ return new _WindsurfRule({
9589
+ baseDir,
9590
+ relativeDirPath,
9591
+ relativeFilePath,
9592
+ fileContent: "",
9593
+ validate: false
9594
+ });
9595
+ }
8181
9596
  static isTargetedByRulesyncRule(rulesyncRule) {
8182
9597
  return this.isTargetedByRulesyncRuleDefault({
8183
9598
  rulesyncRule,
@@ -8208,7 +9623,7 @@ var rulesProcessorToolTargets = [
8208
9623
  "warp",
8209
9624
  "windsurf"
8210
9625
  ];
8211
- var RulesProcessorToolTargetSchema = z34.enum(rulesProcessorToolTargets);
9626
+ var RulesProcessorToolTargetSchema = z37.enum(rulesProcessorToolTargets);
8212
9627
  var toolRuleFactories = /* @__PURE__ */ new Map([
8213
9628
  [
8214
9629
  "agentsmd",
@@ -8284,8 +9699,7 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
8284
9699
  supportsGlobal: true,
8285
9700
  ruleDiscoveryMode: "toon",
8286
9701
  additionalConventions: {
8287
- subagents: { subagentClass: CodexCliSubagent },
8288
- skills: { skillClass: CodexCliSkill, globalOnly: true }
9702
+ subagents: { subagentClass: CodexCliSubagent }
8289
9703
  }
8290
9704
  }
8291
9705
  }
@@ -8297,12 +9711,7 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
8297
9711
  meta: {
8298
9712
  extension: "md",
8299
9713
  supportsGlobal: false,
8300
- ruleDiscoveryMode: "auto",
8301
- additionalConventions: {
8302
- commands: { commandClass: CopilotCommand },
8303
- subagents: { subagentClass: CopilotSubagent },
8304
- skills: { skillClass: CopilotSkill }
8305
- }
9714
+ ruleDiscoveryMode: "auto"
8306
9715
  }
8307
9716
  }
8308
9717
  ],
@@ -8315,7 +9724,6 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
8315
9724
  supportsGlobal: false,
8316
9725
  ruleDiscoveryMode: "auto",
8317
9726
  additionalConventions: {
8318
- commands: { commandClass: CursorCommand },
8319
9727
  subagents: { subagentClass: CursorSubagent },
8320
9728
  skills: { skillClass: CursorSkill }
8321
9729
  },
@@ -8332,7 +9740,6 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
8332
9740
  supportsGlobal: true,
8333
9741
  ruleDiscoveryMode: "toon",
8334
9742
  additionalConventions: {
8335
- commands: { commandClass: GeminiCliCommand },
8336
9743
  subagents: { subagentClass: GeminiCliSubagent },
8337
9744
  skills: { skillClass: GeminiCliSkill }
8338
9745
  }
@@ -8376,7 +9783,6 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
8376
9783
  supportsGlobal: false,
8377
9784
  ruleDiscoveryMode: "auto",
8378
9785
  additionalConventions: {
8379
- commands: { commandClass: RooCommand },
8380
9786
  subagents: { subagentClass: RooSubagent }
8381
9787
  },
8382
9788
  createsSeparateConventionsRule: true
@@ -8502,7 +9908,7 @@ var RulesProcessor = class extends FeatureProcessor {
8502
9908
  }).relativeDirPath;
8503
9909
  return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
8504
9910
  const frontmatter = skill.getFrontmatter();
8505
- const relativePath = join82(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
9911
+ const relativePath = join83(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
8506
9912
  return {
8507
9913
  name: frontmatter.name,
8508
9914
  description: frontmatter.description,
@@ -8569,7 +9975,7 @@ var RulesProcessor = class extends FeatureProcessor {
8569
9975
  * Load and parse rulesync rule files from .rulesync/rules/ directory
8570
9976
  */
8571
9977
  async loadRulesyncFiles() {
8572
- const files = await findFilesByGlobs(join82(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
9978
+ const files = await findFilesByGlobs(join83(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
8573
9979
  logger.debug(`Found ${files.length} rulesync files`);
8574
9980
  const rulesyncRules = await Promise.all(
8575
9981
  files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename20(file) }))
@@ -8589,12 +9995,19 @@ var RulesProcessor = class extends FeatureProcessor {
8589
9995
  }
8590
9996
  return rulesyncRules;
8591
9997
  }
9998
+ async loadRulesyncFilesLegacy() {
9999
+ const legacyFiles = await findFilesByGlobs(join83(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
10000
+ logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
10001
+ return Promise.all(
10002
+ legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename20(file) }))
10003
+ );
10004
+ }
8592
10005
  /**
8593
10006
  * Implementation of abstract method from FeatureProcessor
8594
10007
  * Load tool-specific rule configurations and parse them into ToolRule instances
8595
10008
  */
8596
10009
  async loadToolFiles({
8597
- forDeletion: _forDeletion = false
10010
+ forDeletion = false
8598
10011
  } = {}) {
8599
10012
  try {
8600
10013
  const factory = this.getFactory(this.toolTarget);
@@ -8604,12 +10017,22 @@ var RulesProcessor = class extends FeatureProcessor {
8604
10017
  return [];
8605
10018
  }
8606
10019
  const rootFilePaths = await findFilesByGlobs(
8607
- join82(
10020
+ join83(
8608
10021
  this.baseDir,
8609
10022
  settablePaths.root.relativeDirPath ?? ".",
8610
10023
  settablePaths.root.relativeFilePath
8611
10024
  )
8612
10025
  );
10026
+ if (forDeletion) {
10027
+ return rootFilePaths.map(
10028
+ (filePath) => factory.class.forDeletion({
10029
+ baseDir: this.baseDir,
10030
+ relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
10031
+ relativeFilePath: basename20(filePath),
10032
+ global: this.global
10033
+ })
10034
+ ).filter((rule) => rule.isDeletable());
10035
+ }
8613
10036
  return await Promise.all(
8614
10037
  rootFilePaths.map(
8615
10038
  (filePath) => factory.class.fromFile({
@@ -8626,8 +10049,18 @@ var RulesProcessor = class extends FeatureProcessor {
8626
10049
  return [];
8627
10050
  }
8628
10051
  const nonRootFilePaths = await findFilesByGlobs(
8629
- join82(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
10052
+ join83(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
8630
10053
  );
10054
+ if (forDeletion) {
10055
+ return nonRootFilePaths.map(
10056
+ (filePath) => factory.class.forDeletion({
10057
+ baseDir: this.baseDir,
10058
+ relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
10059
+ relativeFilePath: basename20(filePath),
10060
+ global: this.global
10061
+ })
10062
+ ).filter((rule) => rule.isDeletable());
10063
+ }
8631
10064
  return await Promise.all(
8632
10065
  nonRootFilePaths.map(
8633
10066
  (filePath) => factory.class.fromFile({
@@ -8725,14 +10158,14 @@ s/<command> [arguments]
8725
10158
  This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
8726
10159
  The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
8727
10160
 
8728
- When users call a custom slash command, you have to look for the markdown file, \`${join82(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
10161
+ When users call a custom slash command, you have to look for the markdown file, \`${join83(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
8729
10162
  const subagentsSection = subagents ? `## Simulated Subagents
8730
10163
 
8731
10164
  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.
8732
10165
 
8733
- When users call a simulated subagent, it will look for the corresponding markdown file, \`${join82(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
10166
+ When users call a simulated subagent, it will look for the corresponding markdown file, \`${join83(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
8734
10167
 
8735
- For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join82(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
10168
+ For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join83(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
8736
10169
  const skillsSection = skills ? this.generateSkillsSection(skills) : "";
8737
10170
  const result = [
8738
10171
  overview,
@@ -9014,7 +10447,7 @@ async function generateSkills(config) {
9014
10447
  }
9015
10448
 
9016
10449
  // src/cli/commands/gitignore.ts
9017
- import { join as join83 } from "path";
10450
+ import { join as join84 } from "path";
9018
10451
  var RULESYNC_HEADER = "# Generated by Rulesync";
9019
10452
  var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
9020
10453
  var RULESYNC_IGNORE_ENTRIES = [
@@ -9059,7 +10492,7 @@ var RULESYNC_IGNORE_ENTRIES = [
9059
10492
  "**/.github/copilot-instructions.md",
9060
10493
  "**/.github/instructions/",
9061
10494
  "**/.github/prompts/",
9062
- "**/.github/subagents/",
10495
+ "**/.github/agents/",
9063
10496
  "**/.github/skills/",
9064
10497
  "**/.vscode/mcp.json",
9065
10498
  // Junie
@@ -9071,6 +10504,7 @@ var RULESYNC_IGNORE_ENTRIES = [
9071
10504
  // OpenCode
9072
10505
  "**/.opencode/memories/",
9073
10506
  "**/.opencode/command/",
10507
+ "**/.opencode/skills/",
9074
10508
  "**/opencode.json",
9075
10509
  // Qwen
9076
10510
  "**/QWEN.md",
@@ -9137,7 +10571,7 @@ var removeExistingRulesyncEntries = (content) => {
9137
10571
  return result;
9138
10572
  };
9139
10573
  var gitignoreCommand = async () => {
9140
- const gitignorePath = join83(process.cwd(), ".gitignore");
10574
+ const gitignorePath = join84(process.cwd(), ".gitignore");
9141
10575
  let gitignoreContent = "";
9142
10576
  if (await fileExists(gitignorePath)) {
9143
10577
  gitignoreContent = await readFileContent(gitignorePath);
@@ -9336,7 +10770,7 @@ async function importSkills(config, tool) {
9336
10770
  }
9337
10771
 
9338
10772
  // src/cli/commands/init.ts
9339
- import { join as join84 } from "path";
10773
+ import { join as join85 } from "path";
9340
10774
  async function initCommand() {
9341
10775
  logger.info("Initializing rulesync...");
9342
10776
  await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
@@ -9499,14 +10933,14 @@ Attention, again, you are just the planner, so though you can read any files and
9499
10933
  await ensureDir(commandPaths.relativeDirPath);
9500
10934
  await ensureDir(subagentPaths.relativeDirPath);
9501
10935
  await ensureDir(ignorePaths.recommended.relativeDirPath);
9502
- const ruleFilepath = join84(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
10936
+ const ruleFilepath = join85(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
9503
10937
  if (!await fileExists(ruleFilepath)) {
9504
10938
  await writeFileContent(ruleFilepath, sampleRuleFile.content);
9505
10939
  logger.success(`Created ${ruleFilepath}`);
9506
10940
  } else {
9507
10941
  logger.info(`Skipped ${ruleFilepath} (already exists)`);
9508
10942
  }
9509
- const mcpFilepath = join84(
10943
+ const mcpFilepath = join85(
9510
10944
  mcpPaths.recommended.relativeDirPath,
9511
10945
  mcpPaths.recommended.relativeFilePath
9512
10946
  );
@@ -9516,21 +10950,21 @@ Attention, again, you are just the planner, so though you can read any files and
9516
10950
  } else {
9517
10951
  logger.info(`Skipped ${mcpFilepath} (already exists)`);
9518
10952
  }
9519
- const commandFilepath = join84(commandPaths.relativeDirPath, sampleCommandFile.filename);
10953
+ const commandFilepath = join85(commandPaths.relativeDirPath, sampleCommandFile.filename);
9520
10954
  if (!await fileExists(commandFilepath)) {
9521
10955
  await writeFileContent(commandFilepath, sampleCommandFile.content);
9522
10956
  logger.success(`Created ${commandFilepath}`);
9523
10957
  } else {
9524
10958
  logger.info(`Skipped ${commandFilepath} (already exists)`);
9525
10959
  }
9526
- const subagentFilepath = join84(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
10960
+ const subagentFilepath = join85(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
9527
10961
  if (!await fileExists(subagentFilepath)) {
9528
10962
  await writeFileContent(subagentFilepath, sampleSubagentFile.content);
9529
10963
  logger.success(`Created ${subagentFilepath}`);
9530
10964
  } else {
9531
10965
  logger.info(`Skipped ${subagentFilepath} (already exists)`);
9532
10966
  }
9533
- const ignoreFilepath = join84(
10967
+ const ignoreFilepath = join85(
9534
10968
  ignorePaths.recommended.relativeDirPath,
9535
10969
  ignorePaths.recommended.relativeFilePath
9536
10970
  );
@@ -9546,12 +10980,12 @@ Attention, again, you are just the planner, so though you can read any files and
9546
10980
  import { FastMCP } from "fastmcp";
9547
10981
 
9548
10982
  // src/mcp/commands.ts
9549
- import { basename as basename21, join as join85 } from "path";
9550
- import { z as z35 } from "zod/mini";
10983
+ import { basename as basename21, join as join86 } from "path";
10984
+ import { z as z38 } from "zod/mini";
9551
10985
  var maxCommandSizeBytes = 1024 * 1024;
9552
10986
  var maxCommandsCount = 1e3;
9553
10987
  async function listCommands() {
9554
- const commandsDir = join85(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
10988
+ const commandsDir = join86(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
9555
10989
  try {
9556
10990
  const files = await listDirectoryFiles(commandsDir);
9557
10991
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -9563,7 +10997,7 @@ async function listCommands() {
9563
10997
  });
9564
10998
  const frontmatter = command.getFrontmatter();
9565
10999
  return {
9566
- relativePathFromCwd: join85(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
11000
+ relativePathFromCwd: join86(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
9567
11001
  frontmatter
9568
11002
  };
9569
11003
  } catch (error) {
@@ -9589,7 +11023,7 @@ async function getCommand({ relativePathFromCwd }) {
9589
11023
  relativeFilePath: filename
9590
11024
  });
9591
11025
  return {
9592
- relativePathFromCwd: join85(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
11026
+ relativePathFromCwd: join86(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
9593
11027
  frontmatter: command.getFrontmatter(),
9594
11028
  body: command.getBody()
9595
11029
  };
@@ -9618,7 +11052,7 @@ async function putCommand({
9618
11052
  try {
9619
11053
  const existingCommands = await listCommands();
9620
11054
  const isUpdate = existingCommands.some(
9621
- (command2) => command2.relativePathFromCwd === join85(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
11055
+ (command2) => command2.relativePathFromCwd === join86(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
9622
11056
  );
9623
11057
  if (!isUpdate && existingCommands.length >= maxCommandsCount) {
9624
11058
  throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
@@ -9633,11 +11067,11 @@ async function putCommand({
9633
11067
  fileContent,
9634
11068
  validate: true
9635
11069
  });
9636
- const commandsDir = join85(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
11070
+ const commandsDir = join86(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
9637
11071
  await ensureDir(commandsDir);
9638
11072
  await writeFileContent(command.getFilePath(), command.getFileContent());
9639
11073
  return {
9640
- relativePathFromCwd: join85(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
11074
+ relativePathFromCwd: join86(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
9641
11075
  frontmatter: command.getFrontmatter(),
9642
11076
  body: command.getBody()
9643
11077
  };
@@ -9653,11 +11087,11 @@ async function deleteCommand({ relativePathFromCwd }) {
9653
11087
  intendedRootDir: process.cwd()
9654
11088
  });
9655
11089
  const filename = basename21(relativePathFromCwd);
9656
- const fullPath = join85(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
11090
+ const fullPath = join86(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
9657
11091
  try {
9658
11092
  await removeFile(fullPath);
9659
11093
  return {
9660
- relativePathFromCwd: join85(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
11094
+ relativePathFromCwd: join86(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
9661
11095
  };
9662
11096
  } catch (error) {
9663
11097
  throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
@@ -9666,23 +11100,23 @@ async function deleteCommand({ relativePathFromCwd }) {
9666
11100
  }
9667
11101
  }
9668
11102
  var commandToolSchemas = {
9669
- listCommands: z35.object({}),
9670
- getCommand: z35.object({
9671
- relativePathFromCwd: z35.string()
11103
+ listCommands: z38.object({}),
11104
+ getCommand: z38.object({
11105
+ relativePathFromCwd: z38.string()
9672
11106
  }),
9673
- putCommand: z35.object({
9674
- relativePathFromCwd: z35.string(),
11107
+ putCommand: z38.object({
11108
+ relativePathFromCwd: z38.string(),
9675
11109
  frontmatter: RulesyncCommandFrontmatterSchema,
9676
- body: z35.string()
11110
+ body: z38.string()
9677
11111
  }),
9678
- deleteCommand: z35.object({
9679
- relativePathFromCwd: z35.string()
11112
+ deleteCommand: z38.object({
11113
+ relativePathFromCwd: z38.string()
9680
11114
  })
9681
11115
  };
9682
11116
  var commandTools = {
9683
11117
  listCommands: {
9684
11118
  name: "listCommands",
9685
- description: `List all commands from ${join85(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
11119
+ description: `List all commands from ${join86(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
9686
11120
  parameters: commandToolSchemas.listCommands,
9687
11121
  execute: async () => {
9688
11122
  const commands = await listCommands();
@@ -9724,11 +11158,11 @@ var commandTools = {
9724
11158
  };
9725
11159
 
9726
11160
  // src/mcp/ignore.ts
9727
- import { join as join86 } from "path";
9728
- import { z as z36 } from "zod/mini";
11161
+ import { join as join87 } from "path";
11162
+ import { z as z39 } from "zod/mini";
9729
11163
  var maxIgnoreFileSizeBytes = 100 * 1024;
9730
11164
  async function getIgnoreFile() {
9731
- const ignoreFilePath = join86(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
11165
+ const ignoreFilePath = join87(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
9732
11166
  try {
9733
11167
  const content = await readFileContent(ignoreFilePath);
9734
11168
  return {
@@ -9742,7 +11176,7 @@ async function getIgnoreFile() {
9742
11176
  }
9743
11177
  }
9744
11178
  async function putIgnoreFile({ content }) {
9745
- const ignoreFilePath = join86(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
11179
+ const ignoreFilePath = join87(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
9746
11180
  const contentSizeBytes = Buffer.byteLength(content, "utf8");
9747
11181
  if (contentSizeBytes > maxIgnoreFileSizeBytes) {
9748
11182
  throw new Error(
@@ -9763,8 +11197,8 @@ async function putIgnoreFile({ content }) {
9763
11197
  }
9764
11198
  }
9765
11199
  async function deleteIgnoreFile() {
9766
- const aiignorePath = join86(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
9767
- const legacyIgnorePath = join86(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
11200
+ const aiignorePath = join87(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
11201
+ const legacyIgnorePath = join87(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
9768
11202
  try {
9769
11203
  await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
9770
11204
  return {
@@ -9782,11 +11216,11 @@ async function deleteIgnoreFile() {
9782
11216
  }
9783
11217
  }
9784
11218
  var ignoreToolSchemas = {
9785
- getIgnoreFile: z36.object({}),
9786
- putIgnoreFile: z36.object({
9787
- content: z36.string()
11219
+ getIgnoreFile: z39.object({}),
11220
+ putIgnoreFile: z39.object({
11221
+ content: z39.string()
9788
11222
  }),
9789
- deleteIgnoreFile: z36.object({})
11223
+ deleteIgnoreFile: z39.object({})
9790
11224
  };
9791
11225
  var ignoreTools = {
9792
11226
  getIgnoreFile: {
@@ -9819,8 +11253,8 @@ var ignoreTools = {
9819
11253
  };
9820
11254
 
9821
11255
  // src/mcp/mcp.ts
9822
- import { join as join87 } from "path";
9823
- import { z as z37 } from "zod/mini";
11256
+ import { join as join88 } from "path";
11257
+ import { z as z40 } from "zod/mini";
9824
11258
  var maxMcpSizeBytes = 1024 * 1024;
9825
11259
  async function getMcpFile() {
9826
11260
  const config = await ConfigResolver.resolve({});
@@ -9829,7 +11263,7 @@ async function getMcpFile() {
9829
11263
  validate: true,
9830
11264
  modularMcp: config.getModularMcp()
9831
11265
  });
9832
- const relativePathFromCwd = join87(
11266
+ const relativePathFromCwd = join88(
9833
11267
  rulesyncMcp.getRelativeDirPath(),
9834
11268
  rulesyncMcp.getRelativeFilePath()
9835
11269
  );
@@ -9862,7 +11296,7 @@ async function putMcpFile({ content }) {
9862
11296
  const paths = RulesyncMcp.getSettablePaths();
9863
11297
  const relativeDirPath = paths.recommended.relativeDirPath;
9864
11298
  const relativeFilePath = paths.recommended.relativeFilePath;
9865
- const fullPath = join87(baseDir, relativeDirPath, relativeFilePath);
11299
+ const fullPath = join88(baseDir, relativeDirPath, relativeFilePath);
9866
11300
  const rulesyncMcp = new RulesyncMcp({
9867
11301
  baseDir,
9868
11302
  relativeDirPath,
@@ -9871,9 +11305,9 @@ async function putMcpFile({ content }) {
9871
11305
  validate: true,
9872
11306
  modularMcp: config.getModularMcp()
9873
11307
  });
9874
- await ensureDir(join87(baseDir, relativeDirPath));
11308
+ await ensureDir(join88(baseDir, relativeDirPath));
9875
11309
  await writeFileContent(fullPath, content);
9876
- const relativePathFromCwd = join87(relativeDirPath, relativeFilePath);
11310
+ const relativePathFromCwd = join88(relativeDirPath, relativeFilePath);
9877
11311
  return {
9878
11312
  relativePathFromCwd,
9879
11313
  content: rulesyncMcp.getFileContent()
@@ -9888,15 +11322,15 @@ async function deleteMcpFile() {
9888
11322
  try {
9889
11323
  const baseDir = process.cwd();
9890
11324
  const paths = RulesyncMcp.getSettablePaths();
9891
- const recommendedPath = join87(
11325
+ const recommendedPath = join88(
9892
11326
  baseDir,
9893
11327
  paths.recommended.relativeDirPath,
9894
11328
  paths.recommended.relativeFilePath
9895
11329
  );
9896
- const legacyPath = join87(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
11330
+ const legacyPath = join88(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
9897
11331
  await removeFile(recommendedPath);
9898
11332
  await removeFile(legacyPath);
9899
- const relativePathFromCwd = join87(
11333
+ const relativePathFromCwd = join88(
9900
11334
  paths.recommended.relativeDirPath,
9901
11335
  paths.recommended.relativeFilePath
9902
11336
  );
@@ -9910,11 +11344,11 @@ async function deleteMcpFile() {
9910
11344
  }
9911
11345
  }
9912
11346
  var mcpToolSchemas = {
9913
- getMcpFile: z37.object({}),
9914
- putMcpFile: z37.object({
9915
- content: z37.string()
11347
+ getMcpFile: z40.object({}),
11348
+ putMcpFile: z40.object({
11349
+ content: z40.string()
9916
11350
  }),
9917
- deleteMcpFile: z37.object({})
11351
+ deleteMcpFile: z40.object({})
9918
11352
  };
9919
11353
  var mcpTools = {
9920
11354
  getMcpFile: {
@@ -9947,12 +11381,12 @@ var mcpTools = {
9947
11381
  };
9948
11382
 
9949
11383
  // src/mcp/rules.ts
9950
- import { basename as basename22, join as join88 } from "path";
9951
- import { z as z38 } from "zod/mini";
11384
+ import { basename as basename22, join as join89 } from "path";
11385
+ import { z as z41 } from "zod/mini";
9952
11386
  var maxRuleSizeBytes = 1024 * 1024;
9953
11387
  var maxRulesCount = 1e3;
9954
11388
  async function listRules() {
9955
- const rulesDir = join88(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
11389
+ const rulesDir = join89(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
9956
11390
  try {
9957
11391
  const files = await listDirectoryFiles(rulesDir);
9958
11392
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -9965,7 +11399,7 @@ async function listRules() {
9965
11399
  });
9966
11400
  const frontmatter = rule.getFrontmatter();
9967
11401
  return {
9968
- relativePathFromCwd: join88(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
11402
+ relativePathFromCwd: join89(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
9969
11403
  frontmatter
9970
11404
  };
9971
11405
  } catch (error) {
@@ -9992,7 +11426,7 @@ async function getRule({ relativePathFromCwd }) {
9992
11426
  validate: true
9993
11427
  });
9994
11428
  return {
9995
- relativePathFromCwd: join88(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
11429
+ relativePathFromCwd: join89(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
9996
11430
  frontmatter: rule.getFrontmatter(),
9997
11431
  body: rule.getBody()
9998
11432
  };
@@ -10021,7 +11455,7 @@ async function putRule({
10021
11455
  try {
10022
11456
  const existingRules = await listRules();
10023
11457
  const isUpdate = existingRules.some(
10024
- (rule2) => rule2.relativePathFromCwd === join88(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
11458
+ (rule2) => rule2.relativePathFromCwd === join89(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
10025
11459
  );
10026
11460
  if (!isUpdate && existingRules.length >= maxRulesCount) {
10027
11461
  throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
@@ -10034,11 +11468,11 @@ async function putRule({
10034
11468
  body,
10035
11469
  validate: true
10036
11470
  });
10037
- const rulesDir = join88(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
11471
+ const rulesDir = join89(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
10038
11472
  await ensureDir(rulesDir);
10039
11473
  await writeFileContent(rule.getFilePath(), rule.getFileContent());
10040
11474
  return {
10041
- relativePathFromCwd: join88(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
11475
+ relativePathFromCwd: join89(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
10042
11476
  frontmatter: rule.getFrontmatter(),
10043
11477
  body: rule.getBody()
10044
11478
  };
@@ -10054,11 +11488,11 @@ async function deleteRule({ relativePathFromCwd }) {
10054
11488
  intendedRootDir: process.cwd()
10055
11489
  });
10056
11490
  const filename = basename22(relativePathFromCwd);
10057
- const fullPath = join88(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
11491
+ const fullPath = join89(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
10058
11492
  try {
10059
11493
  await removeFile(fullPath);
10060
11494
  return {
10061
- relativePathFromCwd: join88(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
11495
+ relativePathFromCwd: join89(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
10062
11496
  };
10063
11497
  } catch (error) {
10064
11498
  throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
@@ -10067,23 +11501,23 @@ async function deleteRule({ relativePathFromCwd }) {
10067
11501
  }
10068
11502
  }
10069
11503
  var ruleToolSchemas = {
10070
- listRules: z38.object({}),
10071
- getRule: z38.object({
10072
- relativePathFromCwd: z38.string()
11504
+ listRules: z41.object({}),
11505
+ getRule: z41.object({
11506
+ relativePathFromCwd: z41.string()
10073
11507
  }),
10074
- putRule: z38.object({
10075
- relativePathFromCwd: z38.string(),
11508
+ putRule: z41.object({
11509
+ relativePathFromCwd: z41.string(),
10076
11510
  frontmatter: RulesyncRuleFrontmatterSchema,
10077
- body: z38.string()
11511
+ body: z41.string()
10078
11512
  }),
10079
- deleteRule: z38.object({
10080
- relativePathFromCwd: z38.string()
11513
+ deleteRule: z41.object({
11514
+ relativePathFromCwd: z41.string()
10081
11515
  })
10082
11516
  };
10083
11517
  var ruleTools = {
10084
11518
  listRules: {
10085
11519
  name: "listRules",
10086
- description: `List all rules from ${join88(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
11520
+ description: `List all rules from ${join89(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
10087
11521
  parameters: ruleToolSchemas.listRules,
10088
11522
  execute: async () => {
10089
11523
  const rules = await listRules();
@@ -10125,8 +11559,8 @@ var ruleTools = {
10125
11559
  };
10126
11560
 
10127
11561
  // src/mcp/skills.ts
10128
- import { basename as basename23, dirname as dirname2, join as join89 } from "path";
10129
- import { z as z39 } from "zod/mini";
11562
+ import { basename as basename23, dirname as dirname2, join as join90 } from "path";
11563
+ import { z as z42 } from "zod/mini";
10130
11564
  var maxSkillSizeBytes = 1024 * 1024;
10131
11565
  var maxSkillsCount = 1e3;
10132
11566
  function aiDirFileToMcpSkillFile(file) {
@@ -10149,9 +11583,9 @@ function extractDirName(relativeDirPathFromCwd) {
10149
11583
  return dirName;
10150
11584
  }
10151
11585
  async function listSkills() {
10152
- const skillsDir = join89(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
11586
+ const skillsDir = join90(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
10153
11587
  try {
10154
- const skillDirPaths = await findFilesByGlobs(join89(skillsDir, "*"), { type: "dir" });
11588
+ const skillDirPaths = await findFilesByGlobs(join90(skillsDir, "*"), { type: "dir" });
10155
11589
  const skills = await Promise.all(
10156
11590
  skillDirPaths.map(async (dirPath) => {
10157
11591
  const dirName = basename23(dirPath);
@@ -10162,7 +11596,7 @@ async function listSkills() {
10162
11596
  });
10163
11597
  const frontmatter = skill.getFrontmatter();
10164
11598
  return {
10165
- relativeDirPathFromCwd: join89(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
11599
+ relativeDirPathFromCwd: join90(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
10166
11600
  frontmatter
10167
11601
  };
10168
11602
  } catch (error) {
@@ -10188,7 +11622,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
10188
11622
  dirName
10189
11623
  });
10190
11624
  return {
10191
- relativeDirPathFromCwd: join89(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
11625
+ relativeDirPathFromCwd: join90(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
10192
11626
  frontmatter: skill.getFrontmatter(),
10193
11627
  body: skill.getBody(),
10194
11628
  otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
@@ -10222,7 +11656,7 @@ async function putSkill({
10222
11656
  try {
10223
11657
  const existingSkills = await listSkills();
10224
11658
  const isUpdate = existingSkills.some(
10225
- (skill2) => skill2.relativeDirPathFromCwd === join89(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
11659
+ (skill2) => skill2.relativeDirPathFromCwd === join90(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
10226
11660
  );
10227
11661
  if (!isUpdate && existingSkills.length >= maxSkillsCount) {
10228
11662
  throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
@@ -10237,9 +11671,9 @@ async function putSkill({
10237
11671
  otherFiles: aiDirFiles,
10238
11672
  validate: true
10239
11673
  });
10240
- const skillDirPath = join89(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
11674
+ const skillDirPath = join90(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
10241
11675
  await ensureDir(skillDirPath);
10242
- const skillFilePath = join89(skillDirPath, SKILL_FILE_NAME);
11676
+ const skillFilePath = join90(skillDirPath, SKILL_FILE_NAME);
10243
11677
  const skillFileContent = stringifyFrontmatter(body, frontmatter);
10244
11678
  await writeFileContent(skillFilePath, skillFileContent);
10245
11679
  for (const file of otherFiles) {
@@ -10247,15 +11681,15 @@ async function putSkill({
10247
11681
  relativePath: file.name,
10248
11682
  intendedRootDir: skillDirPath
10249
11683
  });
10250
- const filePath = join89(skillDirPath, file.name);
10251
- const fileDir = join89(skillDirPath, dirname2(file.name));
11684
+ const filePath = join90(skillDirPath, file.name);
11685
+ const fileDir = join90(skillDirPath, dirname2(file.name));
10252
11686
  if (fileDir !== skillDirPath) {
10253
11687
  await ensureDir(fileDir);
10254
11688
  }
10255
11689
  await writeFileContent(filePath, file.body);
10256
11690
  }
10257
11691
  return {
10258
- relativeDirPathFromCwd: join89(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
11692
+ relativeDirPathFromCwd: join90(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
10259
11693
  frontmatter: skill.getFrontmatter(),
10260
11694
  body: skill.getBody(),
10261
11695
  otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
@@ -10277,13 +11711,13 @@ async function deleteSkill({
10277
11711
  intendedRootDir: process.cwd()
10278
11712
  });
10279
11713
  const dirName = extractDirName(relativeDirPathFromCwd);
10280
- const skillDirPath = join89(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
11714
+ const skillDirPath = join90(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
10281
11715
  try {
10282
11716
  if (await directoryExists(skillDirPath)) {
10283
11717
  await removeDirectory(skillDirPath);
10284
11718
  }
10285
11719
  return {
10286
- relativeDirPathFromCwd: join89(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
11720
+ relativeDirPathFromCwd: join90(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
10287
11721
  };
10288
11722
  } catch (error) {
10289
11723
  throw new Error(
@@ -10294,29 +11728,29 @@ async function deleteSkill({
10294
11728
  );
10295
11729
  }
10296
11730
  }
10297
- var McpSkillFileSchema = z39.object({
10298
- name: z39.string(),
10299
- body: z39.string()
11731
+ var McpSkillFileSchema = z42.object({
11732
+ name: z42.string(),
11733
+ body: z42.string()
10300
11734
  });
10301
11735
  var skillToolSchemas = {
10302
- listSkills: z39.object({}),
10303
- getSkill: z39.object({
10304
- relativeDirPathFromCwd: z39.string()
11736
+ listSkills: z42.object({}),
11737
+ getSkill: z42.object({
11738
+ relativeDirPathFromCwd: z42.string()
10305
11739
  }),
10306
- putSkill: z39.object({
10307
- relativeDirPathFromCwd: z39.string(),
11740
+ putSkill: z42.object({
11741
+ relativeDirPathFromCwd: z42.string(),
10308
11742
  frontmatter: RulesyncSkillFrontmatterSchema,
10309
- body: z39.string(),
10310
- otherFiles: z39.optional(z39.array(McpSkillFileSchema))
11743
+ body: z42.string(),
11744
+ otherFiles: z42.optional(z42.array(McpSkillFileSchema))
10311
11745
  }),
10312
- deleteSkill: z39.object({
10313
- relativeDirPathFromCwd: z39.string()
11746
+ deleteSkill: z42.object({
11747
+ relativeDirPathFromCwd: z42.string()
10314
11748
  })
10315
11749
  };
10316
11750
  var skillTools = {
10317
11751
  listSkills: {
10318
11752
  name: "listSkills",
10319
- description: `List all skills from ${join89(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
11753
+ description: `List all skills from ${join90(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
10320
11754
  parameters: skillToolSchemas.listSkills,
10321
11755
  execute: async () => {
10322
11756
  const skills = await listSkills();
@@ -10359,12 +11793,12 @@ var skillTools = {
10359
11793
  };
10360
11794
 
10361
11795
  // src/mcp/subagents.ts
10362
- import { basename as basename24, join as join90 } from "path";
10363
- import { z as z40 } from "zod/mini";
11796
+ import { basename as basename24, join as join91 } from "path";
11797
+ import { z as z43 } from "zod/mini";
10364
11798
  var maxSubagentSizeBytes = 1024 * 1024;
10365
11799
  var maxSubagentsCount = 1e3;
10366
11800
  async function listSubagents() {
10367
- const subagentsDir = join90(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
11801
+ const subagentsDir = join91(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
10368
11802
  try {
10369
11803
  const files = await listDirectoryFiles(subagentsDir);
10370
11804
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -10377,7 +11811,7 @@ async function listSubagents() {
10377
11811
  });
10378
11812
  const frontmatter = subagent.getFrontmatter();
10379
11813
  return {
10380
- relativePathFromCwd: join90(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
11814
+ relativePathFromCwd: join91(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
10381
11815
  frontmatter
10382
11816
  };
10383
11817
  } catch (error) {
@@ -10406,7 +11840,7 @@ async function getSubagent({ relativePathFromCwd }) {
10406
11840
  validate: true
10407
11841
  });
10408
11842
  return {
10409
- relativePathFromCwd: join90(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
11843
+ relativePathFromCwd: join91(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
10410
11844
  frontmatter: subagent.getFrontmatter(),
10411
11845
  body: subagent.getBody()
10412
11846
  };
@@ -10435,7 +11869,7 @@ async function putSubagent({
10435
11869
  try {
10436
11870
  const existingSubagents = await listSubagents();
10437
11871
  const isUpdate = existingSubagents.some(
10438
- (subagent2) => subagent2.relativePathFromCwd === join90(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
11872
+ (subagent2) => subagent2.relativePathFromCwd === join91(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
10439
11873
  );
10440
11874
  if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
10441
11875
  throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
@@ -10448,11 +11882,11 @@ async function putSubagent({
10448
11882
  body,
10449
11883
  validate: true
10450
11884
  });
10451
- const subagentsDir = join90(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
11885
+ const subagentsDir = join91(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
10452
11886
  await ensureDir(subagentsDir);
10453
11887
  await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
10454
11888
  return {
10455
- relativePathFromCwd: join90(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
11889
+ relativePathFromCwd: join91(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
10456
11890
  frontmatter: subagent.getFrontmatter(),
10457
11891
  body: subagent.getBody()
10458
11892
  };
@@ -10468,11 +11902,11 @@ async function deleteSubagent({ relativePathFromCwd }) {
10468
11902
  intendedRootDir: process.cwd()
10469
11903
  });
10470
11904
  const filename = basename24(relativePathFromCwd);
10471
- const fullPath = join90(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
11905
+ const fullPath = join91(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
10472
11906
  try {
10473
11907
  await removeFile(fullPath);
10474
11908
  return {
10475
- relativePathFromCwd: join90(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
11909
+ relativePathFromCwd: join91(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
10476
11910
  };
10477
11911
  } catch (error) {
10478
11912
  throw new Error(
@@ -10484,23 +11918,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
10484
11918
  }
10485
11919
  }
10486
11920
  var subagentToolSchemas = {
10487
- listSubagents: z40.object({}),
10488
- getSubagent: z40.object({
10489
- relativePathFromCwd: z40.string()
11921
+ listSubagents: z43.object({}),
11922
+ getSubagent: z43.object({
11923
+ relativePathFromCwd: z43.string()
10490
11924
  }),
10491
- putSubagent: z40.object({
10492
- relativePathFromCwd: z40.string(),
11925
+ putSubagent: z43.object({
11926
+ relativePathFromCwd: z43.string(),
10493
11927
  frontmatter: RulesyncSubagentFrontmatterSchema,
10494
- body: z40.string()
11928
+ body: z43.string()
10495
11929
  }),
10496
- deleteSubagent: z40.object({
10497
- relativePathFromCwd: z40.string()
11930
+ deleteSubagent: z43.object({
11931
+ relativePathFromCwd: z43.string()
10498
11932
  })
10499
11933
  };
10500
11934
  var subagentTools = {
10501
11935
  listSubagents: {
10502
11936
  name: "listSubagents",
10503
- description: `List all subagents from ${join90(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
11937
+ description: `List all subagents from ${join91(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
10504
11938
  parameters: subagentToolSchemas.listSubagents,
10505
11939
  execute: async () => {
10506
11940
  const subagents = await listSubagents();
@@ -10578,7 +12012,7 @@ async function mcpCommand({ version }) {
10578
12012
  }
10579
12013
 
10580
12014
  // src/cli/index.ts
10581
- var getVersion = () => "4.0.1";
12015
+ var getVersion = () => "4.1.1";
10582
12016
  var main = async () => {
10583
12017
  const program = new Command();
10584
12018
  const version = getVersion();