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.cjs CHANGED
@@ -672,6 +672,17 @@ var ToolCommand = class extends AiFile {
672
672
  static async fromFile(_params) {
673
673
  throw new Error("Please implement this method in the subclass.");
674
674
  }
675
+ /**
676
+ * Create a minimal instance for deletion purposes.
677
+ * This method does not read or parse file content, making it safe to use
678
+ * even when files have old/incompatible formats.
679
+ *
680
+ * @param params - Parameters including the file path
681
+ * @returns A concrete ToolCommand instance with minimal data for deletion
682
+ */
683
+ static forDeletion(_params) {
684
+ throw new Error("Please implement this method in the subclass.");
685
+ }
675
686
  /**
676
687
  * Convert a RulesyncCommand to the tool-specific command format.
677
688
  *
@@ -814,6 +825,20 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
814
825
  validate
815
826
  };
816
827
  }
828
+ static forDeletionDefault({
829
+ baseDir = process.cwd(),
830
+ relativeDirPath,
831
+ relativeFilePath
832
+ }) {
833
+ return {
834
+ baseDir,
835
+ relativeDirPath,
836
+ relativeFilePath,
837
+ frontmatter: { description: "" },
838
+ body: "",
839
+ validate: false
840
+ };
841
+ }
817
842
  };
818
843
 
819
844
  // src/features/commands/agentsmd-command.ts
@@ -863,6 +888,15 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
863
888
  toolTarget: "agentsmd"
864
889
  });
865
890
  }
891
+ static forDeletion({
892
+ baseDir = process.cwd(),
893
+ relativeDirPath,
894
+ relativeFilePath
895
+ }) {
896
+ return new _AgentsmdCommand(
897
+ this.forDeletionDefault({ baseDir, relativeDirPath, relativeFilePath })
898
+ );
899
+ }
866
900
  };
867
901
 
868
902
  // src/features/commands/antigravity-command.ts
@@ -1080,6 +1114,21 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
1080
1114
  validate
1081
1115
  });
1082
1116
  }
1117
+ static forDeletion({
1118
+ baseDir = process.cwd(),
1119
+ relativeDirPath,
1120
+ relativeFilePath
1121
+ }) {
1122
+ return new _AntigravityCommand({
1123
+ baseDir,
1124
+ relativeDirPath,
1125
+ relativeFilePath,
1126
+ frontmatter: { description: "" },
1127
+ body: "",
1128
+ fileContent: "",
1129
+ validate: false
1130
+ });
1131
+ }
1083
1132
  };
1084
1133
 
1085
1134
  // src/features/commands/claudecode-command.ts
@@ -1210,6 +1259,20 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
1210
1259
  validate
1211
1260
  });
1212
1261
  }
1262
+ static forDeletion({
1263
+ baseDir = process.cwd(),
1264
+ relativeDirPath,
1265
+ relativeFilePath
1266
+ }) {
1267
+ return new _ClaudecodeCommand({
1268
+ baseDir,
1269
+ relativeDirPath,
1270
+ relativeFilePath,
1271
+ frontmatter: { description: "" },
1272
+ body: "",
1273
+ validate: false
1274
+ });
1275
+ }
1213
1276
  };
1214
1277
 
1215
1278
  // src/features/commands/codexcli-command.ts
@@ -1284,13 +1347,26 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
1284
1347
  validate
1285
1348
  });
1286
1349
  }
1350
+ static forDeletion({
1351
+ baseDir = process.cwd(),
1352
+ relativeDirPath,
1353
+ relativeFilePath
1354
+ }) {
1355
+ return new _CodexcliCommand({
1356
+ baseDir,
1357
+ relativeDirPath,
1358
+ relativeFilePath,
1359
+ fileContent: "",
1360
+ validate: false
1361
+ });
1362
+ }
1287
1363
  };
1288
1364
 
1289
1365
  // src/features/commands/copilot-command.ts
1290
1366
  var import_node_path11 = require("path");
1291
1367
  var import_mini8 = require("zod/mini");
1292
1368
  var CopilotCommandFrontmatterSchema = import_mini8.z.looseObject({
1293
- mode: import_mini8.z.literal("agent"),
1369
+ mode: import_mini8.z.optional(import_mini8.z.string()),
1294
1370
  description: import_mini8.z.string()
1295
1371
  });
1296
1372
  var CopilotCommand = class _CopilotCommand extends ToolCommand {
@@ -1368,7 +1444,6 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
1368
1444
  const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
1369
1445
  const copilotFields = rulesyncFrontmatter.copilot ?? {};
1370
1446
  const copilotFrontmatter = {
1371
- mode: "agent",
1372
1447
  description: rulesyncFrontmatter.description,
1373
1448
  ...copilotFields
1374
1449
  };
@@ -1412,6 +1487,20 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
1412
1487
  toolTarget: "copilot"
1413
1488
  });
1414
1489
  }
1490
+ static forDeletion({
1491
+ baseDir = process.cwd(),
1492
+ relativeDirPath,
1493
+ relativeFilePath
1494
+ }) {
1495
+ return new _CopilotCommand({
1496
+ baseDir,
1497
+ relativeDirPath,
1498
+ relativeFilePath,
1499
+ frontmatter: { description: "" },
1500
+ body: "",
1501
+ validate: false
1502
+ });
1503
+ }
1415
1504
  };
1416
1505
 
1417
1506
  // src/features/commands/cursor-command.ts
@@ -1483,6 +1572,19 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
1483
1572
  validate
1484
1573
  });
1485
1574
  }
1575
+ static forDeletion({
1576
+ baseDir = process.cwd(),
1577
+ relativeDirPath,
1578
+ relativeFilePath
1579
+ }) {
1580
+ return new _CursorCommand({
1581
+ baseDir,
1582
+ relativeDirPath,
1583
+ relativeFilePath,
1584
+ fileContent: "",
1585
+ validate: false
1586
+ });
1587
+ }
1486
1588
  };
1487
1589
 
1488
1590
  // src/features/commands/geminicli-command.ts
@@ -1610,6 +1712,21 @@ ${geminiFrontmatter.prompt}
1610
1712
  toolTarget: "geminicli"
1611
1713
  });
1612
1714
  }
1715
+ static forDeletion({
1716
+ baseDir = process.cwd(),
1717
+ relativeDirPath,
1718
+ relativeFilePath
1719
+ }) {
1720
+ const placeholderToml = `description = ""
1721
+ prompt = ""`;
1722
+ return new _GeminiCliCommand({
1723
+ baseDir,
1724
+ relativeDirPath,
1725
+ relativeFilePath,
1726
+ fileContent: placeholderToml,
1727
+ validate: false
1728
+ });
1729
+ }
1613
1730
  };
1614
1731
 
1615
1732
  // src/features/commands/opencode-command.ts
@@ -1736,6 +1853,20 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
1736
1853
  toolTarget: "opencode"
1737
1854
  });
1738
1855
  }
1856
+ static forDeletion({
1857
+ baseDir = process.cwd(),
1858
+ relativeDirPath,
1859
+ relativeFilePath
1860
+ }) {
1861
+ return new _OpenCodeCommand({
1862
+ baseDir,
1863
+ relativeDirPath,
1864
+ relativeFilePath,
1865
+ frontmatter: { description: "" },
1866
+ body: "",
1867
+ validate: false
1868
+ });
1869
+ }
1739
1870
  };
1740
1871
 
1741
1872
  // src/features/commands/roo-command.ts
@@ -1862,6 +1993,21 @@ var RooCommand = class _RooCommand extends ToolCommand {
1862
1993
  validate
1863
1994
  });
1864
1995
  }
1996
+ static forDeletion({
1997
+ baseDir = process.cwd(),
1998
+ relativeDirPath,
1999
+ relativeFilePath
2000
+ }) {
2001
+ return new _RooCommand({
2002
+ baseDir,
2003
+ relativeDirPath,
2004
+ relativeFilePath,
2005
+ frontmatter: { description: "" },
2006
+ body: "",
2007
+ fileContent: "",
2008
+ validate: false
2009
+ });
2010
+ }
1865
2011
  };
1866
2012
 
1867
2013
  // src/features/commands/commands-processor.ts
@@ -2044,6 +2190,18 @@ var CommandsProcessor = class extends FeatureProcessor {
2044
2190
  const commandFilePaths = await findFilesByGlobs(
2045
2191
  (0, import_node_path16.join)(this.baseDir, paths.relativeDirPath, `*.${factory.meta.extension}`)
2046
2192
  );
2193
+ if (forDeletion) {
2194
+ const toolCommands2 = commandFilePaths.map(
2195
+ (path3) => factory.class.forDeletion({
2196
+ baseDir: this.baseDir,
2197
+ relativeDirPath: paths.relativeDirPath,
2198
+ relativeFilePath: (0, import_node_path16.basename)(path3),
2199
+ global: this.global
2200
+ })
2201
+ ).filter((cmd) => cmd.isDeletable());
2202
+ logger.info(`Successfully loaded ${toolCommands2.length} ${paths.relativeDirPath} commands`);
2203
+ return toolCommands2;
2204
+ }
2047
2205
  const toolCommands = await Promise.all(
2048
2206
  commandFilePaths.map(
2049
2207
  (path3) => factory.class.fromFile({
@@ -2053,9 +2211,8 @@ var CommandsProcessor = class extends FeatureProcessor {
2053
2211
  })
2054
2212
  )
2055
2213
  );
2056
- const result = forDeletion ? toolCommands.filter((cmd) => cmd.isDeletable()) : toolCommands;
2057
- logger.info(`Successfully loaded ${result.length} ${paths.relativeDirPath} commands`);
2058
- return result;
2214
+ logger.info(`Successfully loaded ${toolCommands.length} ${paths.relativeDirPath} commands`);
2215
+ return toolCommands;
2059
2216
  }
2060
2217
  /**
2061
2218
  * Implementation of abstract method from FeatureProcessor
@@ -2184,6 +2341,14 @@ var ToolIgnore = class extends ToolFile {
2184
2341
  static async fromFile(_params) {
2185
2342
  throw new Error("Please implement this method in the subclass.");
2186
2343
  }
2344
+ /**
2345
+ * Create a minimal instance for deletion purposes.
2346
+ * This method does not read or parse file content, making it safe to use
2347
+ * even when files have old/incompatible formats.
2348
+ */
2349
+ static forDeletion(_params) {
2350
+ throw new Error("Please implement this method in the subclass.");
2351
+ }
2187
2352
  };
2188
2353
 
2189
2354
  // src/features/ignore/amazonqcli-ignore.ts
@@ -2239,6 +2404,19 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
2239
2404
  validate
2240
2405
  });
2241
2406
  }
2407
+ static forDeletion({
2408
+ baseDir = process.cwd(),
2409
+ relativeDirPath,
2410
+ relativeFilePath
2411
+ }) {
2412
+ return new _AmazonqcliIgnore({
2413
+ baseDir,
2414
+ relativeDirPath,
2415
+ relativeFilePath,
2416
+ fileContent: "",
2417
+ validate: false
2418
+ });
2419
+ }
2242
2420
  };
2243
2421
 
2244
2422
  // src/features/ignore/augmentcode-ignore.ts
@@ -2294,6 +2472,19 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
2294
2472
  validate
2295
2473
  });
2296
2474
  }
2475
+ static forDeletion({
2476
+ baseDir = process.cwd(),
2477
+ relativeDirPath,
2478
+ relativeFilePath
2479
+ }) {
2480
+ return new _AugmentcodeIgnore({
2481
+ baseDir,
2482
+ relativeDirPath,
2483
+ relativeFilePath,
2484
+ fileContent: "",
2485
+ validate: false
2486
+ });
2487
+ }
2297
2488
  };
2298
2489
 
2299
2490
  // src/features/ignore/claudecode-ignore.ts
@@ -2390,6 +2581,19 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
2390
2581
  validate
2391
2582
  });
2392
2583
  }
2584
+ static forDeletion({
2585
+ baseDir = process.cwd(),
2586
+ relativeDirPath,
2587
+ relativeFilePath
2588
+ }) {
2589
+ return new _ClaudecodeIgnore({
2590
+ baseDir,
2591
+ relativeDirPath,
2592
+ relativeFilePath,
2593
+ fileContent: "{}",
2594
+ validate: false
2595
+ });
2596
+ }
2393
2597
  };
2394
2598
 
2395
2599
  // src/features/ignore/cline-ignore.ts
@@ -2444,6 +2648,19 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
2444
2648
  validate
2445
2649
  });
2446
2650
  }
2651
+ static forDeletion({
2652
+ baseDir = process.cwd(),
2653
+ relativeDirPath,
2654
+ relativeFilePath
2655
+ }) {
2656
+ return new _ClineIgnore({
2657
+ baseDir,
2658
+ relativeDirPath,
2659
+ relativeFilePath,
2660
+ fileContent: "",
2661
+ validate: false
2662
+ });
2663
+ }
2447
2664
  };
2448
2665
 
2449
2666
  // src/features/ignore/cursor-ignore.ts
@@ -2494,6 +2711,19 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
2494
2711
  validate
2495
2712
  });
2496
2713
  }
2714
+ static forDeletion({
2715
+ baseDir = process.cwd(),
2716
+ relativeDirPath,
2717
+ relativeFilePath
2718
+ }) {
2719
+ return new _CursorIgnore({
2720
+ baseDir,
2721
+ relativeDirPath,
2722
+ relativeFilePath,
2723
+ fileContent: "",
2724
+ validate: false
2725
+ });
2726
+ }
2497
2727
  };
2498
2728
 
2499
2729
  // src/features/ignore/geminicli-ignore.ts
@@ -2538,6 +2768,19 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
2538
2768
  validate
2539
2769
  });
2540
2770
  }
2771
+ static forDeletion({
2772
+ baseDir = process.cwd(),
2773
+ relativeDirPath,
2774
+ relativeFilePath
2775
+ }) {
2776
+ return new _GeminiCliIgnore({
2777
+ baseDir,
2778
+ relativeDirPath,
2779
+ relativeFilePath,
2780
+ fileContent: "",
2781
+ validate: false
2782
+ });
2783
+ }
2541
2784
  };
2542
2785
 
2543
2786
  // src/features/ignore/junie-ignore.ts
@@ -2582,6 +2825,19 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
2582
2825
  validate
2583
2826
  });
2584
2827
  }
2828
+ static forDeletion({
2829
+ baseDir = process.cwd(),
2830
+ relativeDirPath,
2831
+ relativeFilePath
2832
+ }) {
2833
+ return new _JunieIgnore({
2834
+ baseDir,
2835
+ relativeDirPath,
2836
+ relativeFilePath,
2837
+ fileContent: "",
2838
+ validate: false
2839
+ });
2840
+ }
2585
2841
  };
2586
2842
 
2587
2843
  // src/features/ignore/kiro-ignore.ts
@@ -2626,6 +2882,19 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
2626
2882
  validate
2627
2883
  });
2628
2884
  }
2885
+ static forDeletion({
2886
+ baseDir = process.cwd(),
2887
+ relativeDirPath,
2888
+ relativeFilePath
2889
+ }) {
2890
+ return new _KiroIgnore({
2891
+ baseDir,
2892
+ relativeDirPath,
2893
+ relativeFilePath,
2894
+ fileContent: "",
2895
+ validate: false
2896
+ });
2897
+ }
2629
2898
  };
2630
2899
 
2631
2900
  // src/features/ignore/qwencode-ignore.ts
@@ -2670,6 +2939,19 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
2670
2939
  validate
2671
2940
  });
2672
2941
  }
2942
+ static forDeletion({
2943
+ baseDir = process.cwd(),
2944
+ relativeDirPath,
2945
+ relativeFilePath
2946
+ }) {
2947
+ return new _QwencodeIgnore({
2948
+ baseDir,
2949
+ relativeDirPath,
2950
+ relativeFilePath,
2951
+ fileContent: "",
2952
+ validate: false
2953
+ });
2954
+ }
2673
2955
  };
2674
2956
 
2675
2957
  // src/features/ignore/roo-ignore.ts
@@ -2714,6 +2996,19 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
2714
2996
  validate
2715
2997
  });
2716
2998
  }
2999
+ static forDeletion({
3000
+ baseDir = process.cwd(),
3001
+ relativeDirPath,
3002
+ relativeFilePath
3003
+ }) {
3004
+ return new _RooIgnore({
3005
+ baseDir,
3006
+ relativeDirPath,
3007
+ relativeFilePath,
3008
+ fileContent: "",
3009
+ validate: false
3010
+ });
3011
+ }
2717
3012
  };
2718
3013
 
2719
3014
  // src/features/ignore/windsurf-ignore.ts
@@ -2758,6 +3053,19 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
2758
3053
  validate
2759
3054
  });
2760
3055
  }
3056
+ static forDeletion({
3057
+ baseDir = process.cwd(),
3058
+ relativeDirPath,
3059
+ relativeFilePath
3060
+ }) {
3061
+ return new _WindsurfIgnore({
3062
+ baseDir,
3063
+ relativeDirPath,
3064
+ relativeFilePath,
3065
+ fileContent: "",
3066
+ validate: false
3067
+ });
3068
+ }
2761
3069
  };
2762
3070
 
2763
3071
  // src/features/ignore/ignore-processor.ts
@@ -2837,10 +3145,18 @@ var IgnoreProcessor = class extends FeatureProcessor {
2837
3145
  forDeletion = false
2838
3146
  } = {}) {
2839
3147
  try {
2840
- const toolIgnores = await this.loadToolIgnores();
3148
+ const factory = this.getFactory(this.toolTarget);
3149
+ const paths = factory.class.getSettablePaths();
2841
3150
  if (forDeletion) {
2842
- return toolIgnores.filter((toolFile) => toolFile.isDeletable());
3151
+ const toolIgnore = factory.class.forDeletion({
3152
+ baseDir: this.baseDir,
3153
+ relativeDirPath: paths.relativeDirPath,
3154
+ relativeFilePath: paths.relativeFilePath
3155
+ });
3156
+ const toolIgnores2 = toolIgnore.isDeletable() ? [toolIgnore] : [];
3157
+ return toolIgnores2;
2843
3158
  }
3159
+ const toolIgnores = await this.loadToolIgnores();
2844
3160
  return toolIgnores;
2845
3161
  } catch (error) {
2846
3162
  const errorMessage = `Failed to load tool files: ${formatError(error)}`;
@@ -3085,6 +3401,14 @@ var ToolMcp = class extends ToolFile {
3085
3401
  static async fromFile(_params) {
3086
3402
  throw new Error("Please implement this method in the subclass.");
3087
3403
  }
3404
+ /**
3405
+ * Create a minimal instance for deletion purposes.
3406
+ * This method does not read or parse file content, making it safe to use
3407
+ * even when files have old/incompatible formats.
3408
+ */
3409
+ static forDeletion(_params) {
3410
+ throw new Error("Please implement this method in the subclass.");
3411
+ }
3088
3412
  static fromRulesyncMcp(_params) {
3089
3413
  throw new Error("Please implement this method in the subclass.");
3090
3414
  }
@@ -3144,10 +3468,23 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
3144
3468
  validate() {
3145
3469
  return { success: true, error: null };
3146
3470
  }
3147
- };
3148
-
3149
- // src/features/mcp/claudecode-mcp.ts
3150
- var import_node_path32 = require("path");
3471
+ static forDeletion({
3472
+ baseDir = process.cwd(),
3473
+ relativeDirPath,
3474
+ relativeFilePath
3475
+ }) {
3476
+ return new _AmazonqcliMcp({
3477
+ baseDir,
3478
+ relativeDirPath,
3479
+ relativeFilePath,
3480
+ fileContent: "{}",
3481
+ validate: false
3482
+ });
3483
+ }
3484
+ };
3485
+
3486
+ // src/features/mcp/claudecode-mcp.ts
3487
+ var import_node_path32 = require("path");
3151
3488
 
3152
3489
  // src/features/mcp/modular-mcp.ts
3153
3490
  var import_node_path31 = require("path");
@@ -3340,6 +3677,19 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
3340
3677
  validate() {
3341
3678
  return { success: true, error: null };
3342
3679
  }
3680
+ static forDeletion({
3681
+ baseDir = process.cwd(),
3682
+ relativeDirPath,
3683
+ relativeFilePath
3684
+ }) {
3685
+ return new _ClaudecodeMcp({
3686
+ baseDir,
3687
+ relativeDirPath,
3688
+ relativeFilePath,
3689
+ fileContent: "{}",
3690
+ validate: false
3691
+ });
3692
+ }
3343
3693
  };
3344
3694
 
3345
3695
  // src/features/mcp/cline-mcp.ts
@@ -3397,6 +3747,19 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
3397
3747
  validate() {
3398
3748
  return { success: true, error: null };
3399
3749
  }
3750
+ static forDeletion({
3751
+ baseDir = process.cwd(),
3752
+ relativeDirPath,
3753
+ relativeFilePath
3754
+ }) {
3755
+ return new _ClineMcp({
3756
+ baseDir,
3757
+ relativeDirPath,
3758
+ relativeFilePath,
3759
+ fileContent: "{}",
3760
+ validate: false
3761
+ });
3762
+ }
3400
3763
  };
3401
3764
 
3402
3765
  // src/features/mcp/codexcli-mcp.ts
@@ -3491,6 +3854,19 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
3491
3854
  }
3492
3855
  return filtered;
3493
3856
  }
3857
+ static forDeletion({
3858
+ baseDir = process.cwd(),
3859
+ relativeDirPath,
3860
+ relativeFilePath
3861
+ }) {
3862
+ return new _CodexcliMcp({
3863
+ baseDir,
3864
+ relativeDirPath,
3865
+ relativeFilePath,
3866
+ fileContent: "",
3867
+ validate: false
3868
+ });
3869
+ }
3494
3870
  };
3495
3871
 
3496
3872
  // src/features/mcp/copilot-mcp.ts
@@ -3558,6 +3934,19 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
3558
3934
  validate() {
3559
3935
  return { success: true, error: null };
3560
3936
  }
3937
+ static forDeletion({
3938
+ baseDir = process.cwd(),
3939
+ relativeDirPath,
3940
+ relativeFilePath
3941
+ }) {
3942
+ return new _CopilotMcp({
3943
+ baseDir,
3944
+ relativeDirPath,
3945
+ relativeFilePath,
3946
+ fileContent: "{}",
3947
+ validate: false
3948
+ });
3949
+ }
3561
3950
  };
3562
3951
 
3563
3952
  // src/features/mcp/cursor-mcp.ts
@@ -3626,6 +4015,19 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
3626
4015
  validate() {
3627
4016
  return { success: true, error: null };
3628
4017
  }
4018
+ static forDeletion({
4019
+ baseDir = process.cwd(),
4020
+ relativeDirPath,
4021
+ relativeFilePath
4022
+ }) {
4023
+ return new _CursorMcp({
4024
+ baseDir,
4025
+ relativeDirPath,
4026
+ relativeFilePath,
4027
+ fileContent: "{}",
4028
+ validate: false
4029
+ });
4030
+ }
3629
4031
  };
3630
4032
 
3631
4033
  // src/features/mcp/geminicli-mcp.ts
@@ -3700,6 +4102,19 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
3700
4102
  validate() {
3701
4103
  return { success: true, error: null };
3702
4104
  }
4105
+ static forDeletion({
4106
+ baseDir = process.cwd(),
4107
+ relativeDirPath,
4108
+ relativeFilePath
4109
+ }) {
4110
+ return new _GeminiCliMcp({
4111
+ baseDir,
4112
+ relativeDirPath,
4113
+ relativeFilePath,
4114
+ fileContent: "{}",
4115
+ validate: false
4116
+ });
4117
+ }
3703
4118
  };
3704
4119
 
3705
4120
  // src/features/mcp/junie-mcp.ts
@@ -3757,6 +4172,19 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
3757
4172
  validate() {
3758
4173
  return { success: true, error: null };
3759
4174
  }
4175
+ static forDeletion({
4176
+ baseDir = process.cwd(),
4177
+ relativeDirPath,
4178
+ relativeFilePath
4179
+ }) {
4180
+ return new _JunieMcp({
4181
+ baseDir,
4182
+ relativeDirPath,
4183
+ relativeFilePath,
4184
+ fileContent: "{}",
4185
+ validate: false
4186
+ });
4187
+ }
3760
4188
  };
3761
4189
 
3762
4190
  // src/features/mcp/opencode-mcp.ts
@@ -3933,6 +4361,19 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
3933
4361
  }
3934
4362
  return { success: true, error: null };
3935
4363
  }
4364
+ static forDeletion({
4365
+ baseDir = process.cwd(),
4366
+ relativeDirPath,
4367
+ relativeFilePath
4368
+ }) {
4369
+ return new _OpencodeMcp({
4370
+ baseDir,
4371
+ relativeDirPath,
4372
+ relativeFilePath,
4373
+ fileContent: "{}",
4374
+ validate: false
4375
+ });
4376
+ }
3936
4377
  };
3937
4378
 
3938
4379
  // src/features/mcp/roo-mcp.ts
@@ -4028,6 +4469,19 @@ var RooMcp = class _RooMcp extends ToolMcp {
4028
4469
  validate() {
4029
4470
  return { success: true, error: null };
4030
4471
  }
4472
+ static forDeletion({
4473
+ baseDir = process.cwd(),
4474
+ relativeDirPath,
4475
+ relativeFilePath
4476
+ }) {
4477
+ return new _RooMcp({
4478
+ baseDir,
4479
+ relativeDirPath,
4480
+ relativeFilePath,
4481
+ fileContent: "{}",
4482
+ validate: false
4483
+ });
4484
+ }
4031
4485
  };
4032
4486
 
4033
4487
  // src/features/mcp/mcp-processor.ts
@@ -4181,6 +4635,18 @@ var McpProcessor = class extends FeatureProcessor {
4181
4635
  } = {}) {
4182
4636
  try {
4183
4637
  const factory = this.getFactory(this.toolTarget);
4638
+ const paths = factory.class.getSettablePaths({ global: this.global });
4639
+ if (forDeletion) {
4640
+ const toolMcp = factory.class.forDeletion({
4641
+ baseDir: this.baseDir,
4642
+ relativeDirPath: paths.relativeDirPath,
4643
+ relativeFilePath: paths.relativeFilePath,
4644
+ global: this.global
4645
+ });
4646
+ const toolMcps2 = toolMcp.isDeletable() ? [toolMcp] : [];
4647
+ logger.info(`Successfully loaded ${toolMcps2.length} ${this.toolTarget} MCP files`);
4648
+ return toolMcps2;
4649
+ }
4184
4650
  const toolMcps = [
4185
4651
  await factory.class.fromFile({
4186
4652
  baseDir: this.baseDir,
@@ -4189,9 +4655,6 @@ var McpProcessor = class extends FeatureProcessor {
4189
4655
  })
4190
4656
  ];
4191
4657
  logger.info(`Successfully loaded ${toolMcps.length} ${this.toolTarget} MCP files`);
4192
- if (forDeletion) {
4193
- return toolMcps.filter((toolFile) => toolFile.isDeletable());
4194
- }
4195
4658
  return toolMcps;
4196
4659
  } catch (error) {
4197
4660
  const errorMessage = `Failed to load MCP files for tool target: ${this.toolTarget}: ${formatError(error)}`;
@@ -4264,9 +4727,9 @@ var McpProcessor = class extends FeatureProcessor {
4264
4727
  };
4265
4728
 
4266
4729
  // src/features/rules/rules-processor.ts
4267
- var import_node_path84 = require("path");
4730
+ var import_node_path85 = require("path");
4268
4731
  var import_toon = require("@toon-format/toon");
4269
- var import_mini34 = require("zod/mini");
4732
+ var import_mini37 = require("zod/mini");
4270
4733
 
4271
4734
  // src/constants/general.ts
4272
4735
  var SKILL_FILE_NAME = "SKILL.md";
@@ -4420,6 +4883,14 @@ var ToolSkill = class extends AiDir {
4420
4883
  static async fromDir(_params) {
4421
4884
  throw new Error("Please implement this method in the subclass.");
4422
4885
  }
4886
+ /**
4887
+ * Create a minimal instance for deletion purposes.
4888
+ * This method does not read or parse directory content, making it safe to use
4889
+ * even when skill files have old/incompatible formats.
4890
+ */
4891
+ static forDeletion(_params) {
4892
+ throw new Error("Please implement this method in the subclass.");
4893
+ }
4423
4894
  /**
4424
4895
  * Convert a RulesyncSkill to the tool-specific skill format.
4425
4896
  *
@@ -4493,7 +4964,7 @@ var ToolSkill = class extends AiDir {
4493
4964
  };
4494
4965
 
4495
4966
  // src/features/skills/simulated-skill.ts
4496
- var SimulatedSkillFrontmatterSchema = import_mini19.z.object({
4967
+ var SimulatedSkillFrontmatterSchema = import_mini19.z.looseObject({
4497
4968
  name: import_mini19.z.string(),
4498
4969
  description: import_mini19.z.string()
4499
4970
  });
@@ -4611,6 +5082,26 @@ var SimulatedSkill = class extends ToolSkill {
4611
5082
  validate: true
4612
5083
  };
4613
5084
  }
5085
+ /**
5086
+ * Create minimal params for deletion purposes.
5087
+ * This method does not read or parse directory content, making it safe to use
5088
+ * even when skill files have old/incompatible formats.
5089
+ */
5090
+ static forDeletionDefault({
5091
+ baseDir = process.cwd(),
5092
+ relativeDirPath,
5093
+ dirName
5094
+ }) {
5095
+ return {
5096
+ baseDir,
5097
+ relativeDirPath,
5098
+ dirName,
5099
+ frontmatter: { name: "", description: "" },
5100
+ body: "",
5101
+ otherFiles: [],
5102
+ validate: false
5103
+ };
5104
+ }
4614
5105
  /**
4615
5106
  * Check if a RulesyncSkill should be converted to this simulated skill type.
4616
5107
  * Uses the targets field in the RulesyncSkill frontmatter to determine targeting.
@@ -4662,23 +5153,153 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
4662
5153
  toolTarget: "agentsmd"
4663
5154
  });
4664
5155
  }
5156
+ static forDeletion(params) {
5157
+ const baseParams = this.forDeletionDefault(params);
5158
+ return new _AgentsmdSkill(baseParams);
5159
+ }
4665
5160
  };
4666
5161
 
4667
- // src/features/skills/codexcli-skill.ts
5162
+ // src/features/skills/cursor-skill.ts
5163
+ var import_node_path45 = require("path");
5164
+ var CursorSkill = class _CursorSkill extends SimulatedSkill {
5165
+ static getSettablePaths(options) {
5166
+ if (options?.global) {
5167
+ throw new Error("CursorSkill does not support global mode.");
5168
+ }
5169
+ return {
5170
+ relativeDirPath: (0, import_node_path45.join)(".cursor", "skills")
5171
+ };
5172
+ }
5173
+ static async fromDir(params) {
5174
+ const baseParams = await this.fromDirDefault(params);
5175
+ return new _CursorSkill(baseParams);
5176
+ }
5177
+ static fromRulesyncSkill(params) {
5178
+ const baseParams = {
5179
+ ...this.fromRulesyncSkillDefault(params),
5180
+ relativeDirPath: this.getSettablePaths().relativeDirPath
5181
+ };
5182
+ return new _CursorSkill(baseParams);
5183
+ }
5184
+ static isTargetedByRulesyncSkill(rulesyncSkill) {
5185
+ return this.isTargetedByRulesyncSkillDefault({
5186
+ rulesyncSkill,
5187
+ toolTarget: "cursor"
5188
+ });
5189
+ }
5190
+ static forDeletion(params) {
5191
+ const baseParams = this.forDeletionDefault(params);
5192
+ return new _CursorSkill(baseParams);
5193
+ }
5194
+ };
5195
+
5196
+ // src/features/skills/geminicli-skill.ts
4668
5197
  var import_node_path46 = require("path");
5198
+ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
5199
+ static getSettablePaths(options) {
5200
+ if (options?.global) {
5201
+ throw new Error("GeminiCliSkill does not support global mode.");
5202
+ }
5203
+ return {
5204
+ relativeDirPath: (0, import_node_path46.join)(".gemini", "skills")
5205
+ };
5206
+ }
5207
+ static async fromDir(params) {
5208
+ const baseParams = await this.fromDirDefault(params);
5209
+ return new _GeminiCliSkill(baseParams);
5210
+ }
5211
+ static fromRulesyncSkill(params) {
5212
+ const baseParams = {
5213
+ ...this.fromRulesyncSkillDefault(params),
5214
+ relativeDirPath: this.getSettablePaths().relativeDirPath
5215
+ };
5216
+ return new _GeminiCliSkill(baseParams);
5217
+ }
5218
+ static isTargetedByRulesyncSkill(rulesyncSkill) {
5219
+ return this.isTargetedByRulesyncSkillDefault({
5220
+ rulesyncSkill,
5221
+ toolTarget: "geminicli"
5222
+ });
5223
+ }
5224
+ static forDeletion(params) {
5225
+ const baseParams = this.forDeletionDefault(params);
5226
+ return new _GeminiCliSkill(baseParams);
5227
+ }
5228
+ };
5229
+
5230
+ // src/features/skills/skills-processor.ts
5231
+ var import_node_path53 = require("path");
5232
+ var import_mini25 = require("zod/mini");
5233
+
5234
+ // src/types/dir-feature-processor.ts
5235
+ var import_node_path47 = require("path");
5236
+ var DirFeatureProcessor = class {
5237
+ baseDir;
5238
+ constructor({ baseDir = process.cwd() }) {
5239
+ this.baseDir = baseDir;
5240
+ }
5241
+ /**
5242
+ * Return tool targets that this feature supports.
5243
+ */
5244
+ static getToolTargets(_params = {}) {
5245
+ throw new Error("Not implemented");
5246
+ }
5247
+ /**
5248
+ * Once converted to rulesync/tool dirs, write them to the filesystem.
5249
+ * Returns the number of directories written.
5250
+ */
5251
+ async writeAiDirs(aiDirs) {
5252
+ for (const aiDir of aiDirs) {
5253
+ const dirPath = aiDir.getDirPath();
5254
+ await ensureDir(dirPath);
5255
+ const mainFile = aiDir.getMainFile();
5256
+ if (mainFile) {
5257
+ const mainFilePath = (0, import_node_path47.join)(dirPath, mainFile.name);
5258
+ const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
5259
+ const contentWithNewline = addTrailingNewline(content);
5260
+ await writeFileContent(mainFilePath, contentWithNewline);
5261
+ }
5262
+ const otherFiles = aiDir.getOtherFiles();
5263
+ for (const file of otherFiles) {
5264
+ const filePath = (0, import_node_path47.join)(dirPath, file.relativeFilePathToDirPath);
5265
+ const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
5266
+ await writeFileContent(filePath, contentWithNewline);
5267
+ }
5268
+ }
5269
+ return aiDirs.length;
5270
+ }
5271
+ async removeAiDirs(aiDirs) {
5272
+ for (const aiDir of aiDirs) {
5273
+ await removeDirectory(aiDir.getDirPath());
5274
+ }
5275
+ }
5276
+ };
5277
+
5278
+ // src/features/skills/claudecode-skill.ts
5279
+ var import_node_path49 = require("path");
4669
5280
  var import_mini21 = require("zod/mini");
4670
5281
 
4671
5282
  // src/features/skills/rulesync-skill.ts
4672
- var import_node_path45 = require("path");
5283
+ var import_node_path48 = require("path");
4673
5284
  var import_mini20 = require("zod/mini");
4674
- var RulesyncSkillFrontmatterSchemaInternal = import_mini20.z.object({
5285
+ var RulesyncSkillFrontmatterSchemaInternal = import_mini20.z.looseObject({
4675
5286
  name: import_mini20.z.string(),
4676
5287
  description: import_mini20.z.string(),
4677
5288
  targets: import_mini20.z._default(RulesyncTargetsSchema, ["*"]),
4678
5289
  claudecode: import_mini20.z.optional(
4679
- import_mini20.z.object({
5290
+ import_mini20.z.looseObject({
4680
5291
  "allowed-tools": import_mini20.z.optional(import_mini20.z.array(import_mini20.z.string()))
4681
5292
  })
5293
+ ),
5294
+ opencode: import_mini20.z.optional(
5295
+ import_mini20.z.looseObject({
5296
+ "allowed-tools": import_mini20.z.optional(import_mini20.z.array(import_mini20.z.string()))
5297
+ })
5298
+ ),
5299
+ copilot: import_mini20.z.optional(
5300
+ import_mini20.z.looseObject({
5301
+ license: import_mini20.z.optional(import_mini20.z.string())
5302
+ })
4682
5303
  )
4683
5304
  });
4684
5305
  var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
@@ -4745,8 +5366,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
4745
5366
  dirName,
4746
5367
  global = false
4747
5368
  }) {
4748
- const skillDirPath = (0, import_node_path45.join)(baseDir, relativeDirPath, dirName);
4749
- const skillFilePath = (0, import_node_path45.join)(skillDirPath, SKILL_FILE_NAME);
5369
+ const skillDirPath = (0, import_node_path48.join)(baseDir, relativeDirPath, dirName);
5370
+ const skillFilePath = (0, import_node_path48.join)(skillDirPath, SKILL_FILE_NAME);
4750
5371
  if (!await fileExists(skillFilePath)) {
4751
5372
  throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
4752
5373
  }
@@ -4775,15 +5396,180 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
4775
5396
  }
4776
5397
  };
4777
5398
 
4778
- // src/features/skills/codexcli-skill.ts
4779
- var CodexCliSkillFrontmatterSchema = import_mini21.z.object({
5399
+ // src/features/skills/claudecode-skill.ts
5400
+ var ClaudecodeSkillFrontmatterSchema = import_mini21.z.looseObject({
4780
5401
  name: import_mini21.z.string(),
4781
- description: import_mini21.z.string()
5402
+ description: import_mini21.z.string(),
5403
+ "allowed-tools": import_mini21.z.optional(import_mini21.z.array(import_mini21.z.string()))
5404
+ });
5405
+ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
5406
+ constructor({
5407
+ baseDir = process.cwd(),
5408
+ relativeDirPath = (0, import_node_path49.join)(".claude", "skills"),
5409
+ dirName,
5410
+ frontmatter,
5411
+ body,
5412
+ otherFiles = [],
5413
+ validate = true,
5414
+ global = false
5415
+ }) {
5416
+ super({
5417
+ baseDir,
5418
+ relativeDirPath,
5419
+ dirName,
5420
+ mainFile: {
5421
+ name: SKILL_FILE_NAME,
5422
+ body,
5423
+ frontmatter: { ...frontmatter }
5424
+ },
5425
+ otherFiles,
5426
+ global
5427
+ });
5428
+ if (validate) {
5429
+ const result = this.validate();
5430
+ if (!result.success) {
5431
+ throw result.error;
5432
+ }
5433
+ }
5434
+ }
5435
+ static getSettablePaths({
5436
+ global: _global = false
5437
+ } = {}) {
5438
+ return {
5439
+ relativeDirPath: (0, import_node_path49.join)(".claude", "skills")
5440
+ };
5441
+ }
5442
+ getFrontmatter() {
5443
+ if (!this.mainFile?.frontmatter) {
5444
+ throw new Error("Frontmatter is not defined");
5445
+ }
5446
+ const result = ClaudecodeSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
5447
+ return result;
5448
+ }
5449
+ getBody() {
5450
+ return this.mainFile?.body ?? "";
5451
+ }
5452
+ validate() {
5453
+ if (this.mainFile === void 0) {
5454
+ return {
5455
+ success: false,
5456
+ error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
5457
+ };
5458
+ }
5459
+ const result = ClaudecodeSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
5460
+ if (!result.success) {
5461
+ return {
5462
+ success: false,
5463
+ error: new Error(
5464
+ `Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
5465
+ )
5466
+ };
5467
+ }
5468
+ return { success: true, error: null };
5469
+ }
5470
+ toRulesyncSkill() {
5471
+ const frontmatter = this.getFrontmatter();
5472
+ const rulesyncFrontmatter = {
5473
+ name: frontmatter.name,
5474
+ description: frontmatter.description,
5475
+ targets: ["*"],
5476
+ ...frontmatter["allowed-tools"] && {
5477
+ claudecode: {
5478
+ "allowed-tools": frontmatter["allowed-tools"]
5479
+ }
5480
+ }
5481
+ };
5482
+ return new RulesyncSkill({
5483
+ baseDir: this.baseDir,
5484
+ relativeDirPath: this.relativeDirPath,
5485
+ dirName: this.getDirName(),
5486
+ frontmatter: rulesyncFrontmatter,
5487
+ body: this.getBody(),
5488
+ otherFiles: this.getOtherFiles(),
5489
+ validate: true,
5490
+ global: this.global
5491
+ });
5492
+ }
5493
+ static fromRulesyncSkill({
5494
+ rulesyncSkill,
5495
+ validate = true,
5496
+ global = false
5497
+ }) {
5498
+ const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
5499
+ const claudecodeFrontmatter = {
5500
+ name: rulesyncFrontmatter.name,
5501
+ description: rulesyncFrontmatter.description,
5502
+ "allowed-tools": rulesyncFrontmatter.claudecode?.["allowed-tools"]
5503
+ };
5504
+ const settablePaths = _ClaudecodeSkill.getSettablePaths({ global });
5505
+ return new _ClaudecodeSkill({
5506
+ baseDir: rulesyncSkill.getBaseDir(),
5507
+ relativeDirPath: settablePaths.relativeDirPath,
5508
+ dirName: rulesyncSkill.getDirName(),
5509
+ frontmatter: claudecodeFrontmatter,
5510
+ body: rulesyncSkill.getBody(),
5511
+ otherFiles: rulesyncSkill.getOtherFiles(),
5512
+ validate,
5513
+ global
5514
+ });
5515
+ }
5516
+ static isTargetedByRulesyncSkill(rulesyncSkill) {
5517
+ const targets = rulesyncSkill.getFrontmatter().targets;
5518
+ return targets.includes("*") || targets.includes("claudecode");
5519
+ }
5520
+ static async fromDir(params) {
5521
+ const loaded = await this.loadSkillDirContent({
5522
+ ...params,
5523
+ getSettablePaths: _ClaudecodeSkill.getSettablePaths
5524
+ });
5525
+ const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
5526
+ if (!result.success) {
5527
+ const skillDirPath = (0, import_node_path49.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
5528
+ throw new Error(
5529
+ `Invalid frontmatter in ${(0, import_node_path49.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
5530
+ );
5531
+ }
5532
+ return new _ClaudecodeSkill({
5533
+ baseDir: loaded.baseDir,
5534
+ relativeDirPath: loaded.relativeDirPath,
5535
+ dirName: loaded.dirName,
5536
+ frontmatter: result.data,
5537
+ body: loaded.body,
5538
+ otherFiles: loaded.otherFiles,
5539
+ validate: true,
5540
+ global: loaded.global
5541
+ });
5542
+ }
5543
+ static forDeletion({
5544
+ baseDir = process.cwd(),
5545
+ relativeDirPath,
5546
+ dirName,
5547
+ global = false
5548
+ }) {
5549
+ return new _ClaudecodeSkill({
5550
+ baseDir,
5551
+ relativeDirPath,
5552
+ dirName,
5553
+ frontmatter: { name: "", description: "" },
5554
+ body: "",
5555
+ otherFiles: [],
5556
+ validate: false,
5557
+ global
5558
+ });
5559
+ }
5560
+ };
5561
+
5562
+ // src/features/skills/codexcli-skill.ts
5563
+ var import_node_path50 = require("path");
5564
+ var import_mini22 = require("zod/mini");
5565
+ var CodexCliSkillFrontmatterSchema = import_mini22.z.looseObject({
5566
+ name: import_mini22.z.string(),
5567
+ description: import_mini22.z.string()
4782
5568
  });
4783
5569
  var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
4784
5570
  constructor({
4785
5571
  baseDir = process.cwd(),
4786
- relativeDirPath = (0, import_node_path46.join)(".codex", "skills"),
5572
+ relativeDirPath = (0, import_node_path50.join)(".codex", "skills"),
4787
5573
  dirName,
4788
5574
  frontmatter,
4789
5575
  body,
@@ -4815,7 +5601,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
4815
5601
  throw new Error("CodexCliSkill only supports global mode. Please pass { global: true }.");
4816
5602
  }
4817
5603
  return {
4818
- relativeDirPath: (0, import_node_path46.join)(".codex", "skills")
5604
+ relativeDirPath: (0, import_node_path50.join)(".codex", "skills")
4819
5605
  };
4820
5606
  }
4821
5607
  getFrontmatter() {
@@ -4897,9 +5683,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
4897
5683
  });
4898
5684
  const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
4899
5685
  if (!result.success) {
4900
- const skillDirPath = (0, import_node_path46.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
5686
+ const skillDirPath = (0, import_node_path50.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
4901
5687
  throw new Error(
4902
- `Invalid frontmatter in ${(0, import_node_path46.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
5688
+ `Invalid frontmatter in ${(0, import_node_path50.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
4903
5689
  );
4904
5690
  }
4905
5691
  return new _CodexCliSkill({
@@ -4913,158 +5699,204 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
4913
5699
  global: loaded.global
4914
5700
  });
4915
5701
  }
5702
+ static forDeletion({
5703
+ baseDir = process.cwd(),
5704
+ relativeDirPath,
5705
+ dirName,
5706
+ global = false
5707
+ }) {
5708
+ return new _CodexCliSkill({
5709
+ baseDir,
5710
+ relativeDirPath,
5711
+ dirName,
5712
+ frontmatter: { name: "", description: "" },
5713
+ body: "",
5714
+ otherFiles: [],
5715
+ validate: false,
5716
+ global
5717
+ });
5718
+ }
4916
5719
  };
4917
5720
 
4918
5721
  // src/features/skills/copilot-skill.ts
4919
- var import_node_path47 = require("path");
4920
- var CopilotSkill = class _CopilotSkill extends SimulatedSkill {
5722
+ var import_node_path51 = require("path");
5723
+ var import_mini23 = require("zod/mini");
5724
+ var CopilotSkillFrontmatterSchema = import_mini23.z.looseObject({
5725
+ name: import_mini23.z.string(),
5726
+ description: import_mini23.z.string(),
5727
+ license: import_mini23.z.optional(import_mini23.z.string())
5728
+ });
5729
+ var CopilotSkill = class _CopilotSkill extends ToolSkill {
5730
+ constructor({
5731
+ baseDir = process.cwd(),
5732
+ relativeDirPath = (0, import_node_path51.join)(".github", "skills"),
5733
+ dirName,
5734
+ frontmatter,
5735
+ body,
5736
+ otherFiles = [],
5737
+ validate = true,
5738
+ global = false
5739
+ }) {
5740
+ super({
5741
+ baseDir,
5742
+ relativeDirPath,
5743
+ dirName,
5744
+ mainFile: {
5745
+ name: SKILL_FILE_NAME,
5746
+ body,
5747
+ frontmatter: { ...frontmatter }
5748
+ },
5749
+ otherFiles,
5750
+ global
5751
+ });
5752
+ if (validate) {
5753
+ const result = this.validate();
5754
+ if (!result.success) {
5755
+ throw result.error;
5756
+ }
5757
+ }
5758
+ }
4921
5759
  static getSettablePaths(options) {
4922
5760
  if (options?.global) {
4923
5761
  throw new Error("CopilotSkill does not support global mode.");
4924
5762
  }
4925
5763
  return {
4926
- relativeDirPath: (0, import_node_path47.join)(".github", "skills")
5764
+ relativeDirPath: (0, import_node_path51.join)(".github", "skills")
4927
5765
  };
4928
5766
  }
4929
- static async fromDir(params) {
4930
- const baseParams = await this.fromDirDefault(params);
4931
- return new _CopilotSkill(baseParams);
4932
- }
4933
- static fromRulesyncSkill(params) {
4934
- const baseParams = {
4935
- ...this.fromRulesyncSkillDefault(params),
4936
- relativeDirPath: this.getSettablePaths().relativeDirPath
4937
- };
4938
- return new _CopilotSkill(baseParams);
5767
+ getFrontmatter() {
5768
+ if (!this.mainFile?.frontmatter) {
5769
+ throw new Error("Frontmatter is not defined");
5770
+ }
5771
+ const result = CopilotSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
5772
+ return result;
4939
5773
  }
4940
- static isTargetedByRulesyncSkill(rulesyncSkill) {
4941
- return this.isTargetedByRulesyncSkillDefault({
4942
- rulesyncSkill,
4943
- toolTarget: "copilot"
4944
- });
5774
+ getBody() {
5775
+ return this.mainFile?.body ?? "";
4945
5776
  }
4946
- };
4947
-
4948
- // src/features/skills/cursor-skill.ts
4949
- var import_node_path48 = require("path");
4950
- var CursorSkill = class _CursorSkill extends SimulatedSkill {
4951
- static getSettablePaths(options) {
4952
- if (options?.global) {
4953
- throw new Error("CursorSkill does not support global mode.");
5777
+ validate() {
5778
+ if (!this.mainFile) {
5779
+ return {
5780
+ success: false,
5781
+ error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
5782
+ };
4954
5783
  }
4955
- return {
4956
- relativeDirPath: (0, import_node_path48.join)(".cursor", "skills")
4957
- };
4958
- }
4959
- static async fromDir(params) {
4960
- const baseParams = await this.fromDirDefault(params);
4961
- return new _CursorSkill(baseParams);
5784
+ const result = CopilotSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
5785
+ if (!result.success) {
5786
+ return {
5787
+ success: false,
5788
+ error: new Error(
5789
+ `Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
5790
+ )
5791
+ };
5792
+ }
5793
+ return { success: true, error: null };
4962
5794
  }
4963
- static fromRulesyncSkill(params) {
4964
- const baseParams = {
4965
- ...this.fromRulesyncSkillDefault(params),
4966
- relativeDirPath: this.getSettablePaths().relativeDirPath
5795
+ toRulesyncSkill() {
5796
+ const frontmatter = this.getFrontmatter();
5797
+ const rulesyncFrontmatter = {
5798
+ name: frontmatter.name,
5799
+ description: frontmatter.description,
5800
+ targets: ["*"],
5801
+ ...frontmatter.license && {
5802
+ copilot: {
5803
+ license: frontmatter.license
5804
+ }
5805
+ }
4967
5806
  };
4968
- return new _CursorSkill(baseParams);
4969
- }
4970
- static isTargetedByRulesyncSkill(rulesyncSkill) {
4971
- return this.isTargetedByRulesyncSkillDefault({
4972
- rulesyncSkill,
4973
- toolTarget: "cursor"
5807
+ return new RulesyncSkill({
5808
+ baseDir: this.baseDir,
5809
+ relativeDirPath: this.relativeDirPath,
5810
+ dirName: this.getDirName(),
5811
+ frontmatter: rulesyncFrontmatter,
5812
+ body: this.getBody(),
5813
+ otherFiles: this.getOtherFiles(),
5814
+ validate: true,
5815
+ global: this.global
4974
5816
  });
4975
5817
  }
4976
- };
4977
-
4978
- // src/features/skills/geminicli-skill.ts
4979
- var import_node_path49 = require("path");
4980
- var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
4981
- static getSettablePaths(options) {
4982
- if (options?.global) {
4983
- throw new Error("GeminiCliSkill does not support global mode.");
4984
- }
4985
- return {
4986
- relativeDirPath: (0, import_node_path49.join)(".gemini", "skills")
4987
- };
4988
- }
4989
- static async fromDir(params) {
4990
- const baseParams = await this.fromDirDefault(params);
4991
- return new _GeminiCliSkill(baseParams);
4992
- }
4993
- static fromRulesyncSkill(params) {
4994
- const baseParams = {
4995
- ...this.fromRulesyncSkillDefault(params),
4996
- relativeDirPath: this.getSettablePaths().relativeDirPath
5818
+ static fromRulesyncSkill({
5819
+ rulesyncSkill,
5820
+ validate = true,
5821
+ global = false
5822
+ }) {
5823
+ const settablePaths = _CopilotSkill.getSettablePaths({ global });
5824
+ const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
5825
+ const copilotFrontmatter = {
5826
+ name: rulesyncFrontmatter.name,
5827
+ description: rulesyncFrontmatter.description,
5828
+ license: rulesyncFrontmatter.copilot?.license
4997
5829
  };
4998
- return new _GeminiCliSkill(baseParams);
4999
- }
5000
- static isTargetedByRulesyncSkill(rulesyncSkill) {
5001
- return this.isTargetedByRulesyncSkillDefault({
5002
- rulesyncSkill,
5003
- toolTarget: "geminicli"
5830
+ return new _CopilotSkill({
5831
+ baseDir: rulesyncSkill.getBaseDir(),
5832
+ relativeDirPath: settablePaths.relativeDirPath,
5833
+ dirName: rulesyncSkill.getDirName(),
5834
+ frontmatter: copilotFrontmatter,
5835
+ body: rulesyncSkill.getBody(),
5836
+ otherFiles: rulesyncSkill.getOtherFiles(),
5837
+ validate,
5838
+ global
5004
5839
  });
5005
5840
  }
5006
- };
5007
-
5008
- // src/features/skills/skills-processor.ts
5009
- var import_node_path52 = require("path");
5010
- var import_mini23 = require("zod/mini");
5011
-
5012
- // src/types/dir-feature-processor.ts
5013
- var import_node_path50 = require("path");
5014
- var DirFeatureProcessor = class {
5015
- baseDir;
5016
- constructor({ baseDir = process.cwd() }) {
5017
- this.baseDir = baseDir;
5018
- }
5019
- /**
5020
- * Return tool targets that this feature supports.
5021
- */
5022
- static getToolTargets(_params = {}) {
5023
- throw new Error("Not implemented");
5841
+ static isTargetedByRulesyncSkill(rulesyncSkill) {
5842
+ const targets = rulesyncSkill.getFrontmatter().targets;
5843
+ return targets.includes("*") || targets.includes("copilot");
5024
5844
  }
5025
- /**
5026
- * Once converted to rulesync/tool dirs, write them to the filesystem.
5027
- * Returns the number of directories written.
5028
- */
5029
- async writeAiDirs(aiDirs) {
5030
- for (const aiDir of aiDirs) {
5031
- const dirPath = aiDir.getDirPath();
5032
- await ensureDir(dirPath);
5033
- const mainFile = aiDir.getMainFile();
5034
- if (mainFile) {
5035
- const mainFilePath = (0, import_node_path50.join)(dirPath, mainFile.name);
5036
- const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
5037
- const contentWithNewline = addTrailingNewline(content);
5038
- await writeFileContent(mainFilePath, contentWithNewline);
5039
- }
5040
- const otherFiles = aiDir.getOtherFiles();
5041
- for (const file of otherFiles) {
5042
- const filePath = (0, import_node_path50.join)(dirPath, file.relativeFilePathToDirPath);
5043
- const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
5044
- await writeFileContent(filePath, contentWithNewline);
5045
- }
5845
+ static async fromDir(params) {
5846
+ const loaded = await this.loadSkillDirContent({
5847
+ ...params,
5848
+ getSettablePaths: _CopilotSkill.getSettablePaths
5849
+ });
5850
+ const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
5851
+ if (!result.success) {
5852
+ const skillDirPath = (0, import_node_path51.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
5853
+ throw new Error(
5854
+ `Invalid frontmatter in ${(0, import_node_path51.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
5855
+ );
5046
5856
  }
5047
- return aiDirs.length;
5857
+ return new _CopilotSkill({
5858
+ baseDir: loaded.baseDir,
5859
+ relativeDirPath: loaded.relativeDirPath,
5860
+ dirName: loaded.dirName,
5861
+ frontmatter: result.data,
5862
+ body: loaded.body,
5863
+ otherFiles: loaded.otherFiles,
5864
+ validate: true,
5865
+ global: loaded.global
5866
+ });
5048
5867
  }
5049
- async removeAiDirs(aiDirs) {
5050
- for (const aiDir of aiDirs) {
5051
- await removeDirectory(aiDir.getDirPath());
5052
- }
5868
+ static forDeletion({
5869
+ baseDir = process.cwd(),
5870
+ relativeDirPath,
5871
+ dirName,
5872
+ global = false
5873
+ }) {
5874
+ const settablePaths = _CopilotSkill.getSettablePaths({ global });
5875
+ return new _CopilotSkill({
5876
+ baseDir,
5877
+ relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
5878
+ dirName,
5879
+ frontmatter: { name: "", description: "" },
5880
+ body: "",
5881
+ otherFiles: [],
5882
+ validate: false,
5883
+ global
5884
+ });
5053
5885
  }
5054
5886
  };
5055
5887
 
5056
- // src/features/skills/claudecode-skill.ts
5057
- var import_node_path51 = require("path");
5058
- var import_mini22 = require("zod/mini");
5059
- var ClaudecodeSkillFrontmatterSchema = import_mini22.z.object({
5060
- name: import_mini22.z.string(),
5061
- description: import_mini22.z.string(),
5062
- "allowed-tools": import_mini22.z.optional(import_mini22.z.array(import_mini22.z.string()))
5888
+ // src/features/skills/opencode-skill.ts
5889
+ var import_node_path52 = require("path");
5890
+ var import_mini24 = require("zod/mini");
5891
+ var OpenCodeSkillFrontmatterSchema = import_mini24.z.looseObject({
5892
+ name: import_mini24.z.string(),
5893
+ description: import_mini24.z.string(),
5894
+ "allowed-tools": import_mini24.z.optional(import_mini24.z.array(import_mini24.z.string()))
5063
5895
  });
5064
- var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
5896
+ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
5065
5897
  constructor({
5066
5898
  baseDir = process.cwd(),
5067
- relativeDirPath = (0, import_node_path51.join)(".claude", "skills"),
5899
+ relativeDirPath = (0, import_node_path52.join)(".opencode", "skills"),
5068
5900
  dirName,
5069
5901
  frontmatter,
5070
5902
  body,
@@ -5091,18 +5923,16 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
5091
5923
  }
5092
5924
  }
5093
5925
  }
5094
- static getSettablePaths({
5095
- global: _global = false
5096
- } = {}) {
5926
+ static getSettablePaths({ global = false } = {}) {
5097
5927
  return {
5098
- relativeDirPath: (0, import_node_path51.join)(".claude", "skills")
5928
+ relativeDirPath: global ? (0, import_node_path52.join)(".config", "opencode", "skills") : (0, import_node_path52.join)(".opencode", "skills")
5099
5929
  };
5100
5930
  }
5101
5931
  getFrontmatter() {
5102
5932
  if (!this.mainFile?.frontmatter) {
5103
5933
  throw new Error("Frontmatter is not defined");
5104
5934
  }
5105
- const result = ClaudecodeSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
5935
+ const result = OpenCodeSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
5106
5936
  return result;
5107
5937
  }
5108
5938
  getBody() {
@@ -5115,7 +5945,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
5115
5945
  error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
5116
5946
  };
5117
5947
  }
5118
- const result = ClaudecodeSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
5948
+ const result = OpenCodeSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
5119
5949
  if (!result.success) {
5120
5950
  return {
5121
5951
  success: false,
@@ -5133,7 +5963,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
5133
5963
  description: frontmatter.description,
5134
5964
  targets: ["*"],
5135
5965
  ...frontmatter["allowed-tools"] && {
5136
- claudecode: {
5966
+ opencode: {
5137
5967
  "allowed-tools": frontmatter["allowed-tools"]
5138
5968
  }
5139
5969
  }
@@ -5155,39 +5985,40 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
5155
5985
  global = false
5156
5986
  }) {
5157
5987
  const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
5158
- const claudecodeFrontmatter = {
5988
+ const opencodeFrontmatter = {
5159
5989
  name: rulesyncFrontmatter.name,
5160
5990
  description: rulesyncFrontmatter.description,
5161
- "allowed-tools": rulesyncFrontmatter.claudecode?.["allowed-tools"]
5991
+ "allowed-tools": rulesyncFrontmatter.opencode?.["allowed-tools"]
5162
5992
  };
5163
- const settablePaths = _ClaudecodeSkill.getSettablePaths({ global });
5164
- return new _ClaudecodeSkill({
5993
+ const settablePaths = _OpenCodeSkill.getSettablePaths({ global });
5994
+ return new _OpenCodeSkill({
5165
5995
  baseDir: rulesyncSkill.getBaseDir(),
5166
5996
  relativeDirPath: settablePaths.relativeDirPath,
5167
5997
  dirName: rulesyncSkill.getDirName(),
5168
- frontmatter: claudecodeFrontmatter,
5998
+ frontmatter: opencodeFrontmatter,
5169
5999
  body: rulesyncSkill.getBody(),
5170
6000
  otherFiles: rulesyncSkill.getOtherFiles(),
5171
6001
  validate,
5172
6002
  global
5173
6003
  });
5174
6004
  }
5175
- static isTargetedByRulesyncSkill(_rulesyncSkill) {
5176
- return true;
6005
+ static isTargetedByRulesyncSkill(rulesyncSkill) {
6006
+ const targets = rulesyncSkill.getFrontmatter().targets;
6007
+ return targets.includes("*") || targets.includes("opencode");
5177
6008
  }
5178
6009
  static async fromDir(params) {
5179
6010
  const loaded = await this.loadSkillDirContent({
5180
6011
  ...params,
5181
- getSettablePaths: _ClaudecodeSkill.getSettablePaths
6012
+ getSettablePaths: _OpenCodeSkill.getSettablePaths
5182
6013
  });
5183
- const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
6014
+ const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
5184
6015
  if (!result.success) {
5185
- const skillDirPath = (0, import_node_path51.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
6016
+ const skillDirPath = (0, import_node_path52.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
5186
6017
  throw new Error(
5187
- `Invalid frontmatter in ${(0, import_node_path51.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
6018
+ `Invalid frontmatter in ${(0, import_node_path52.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
5188
6019
  );
5189
6020
  }
5190
- return new _ClaudecodeSkill({
6021
+ return new _OpenCodeSkill({
5191
6022
  baseDir: loaded.baseDir,
5192
6023
  relativeDirPath: loaded.relativeDirPath,
5193
6024
  dirName: loaded.dirName,
@@ -5198,6 +6029,23 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
5198
6029
  global: loaded.global
5199
6030
  });
5200
6031
  }
6032
+ static forDeletion({
6033
+ baseDir = process.cwd(),
6034
+ relativeDirPath,
6035
+ dirName,
6036
+ global = false
6037
+ }) {
6038
+ return new _OpenCodeSkill({
6039
+ baseDir,
6040
+ relativeDirPath,
6041
+ dirName,
6042
+ frontmatter: { name: "", description: "" },
6043
+ body: "",
6044
+ otherFiles: [],
6045
+ validate: false,
6046
+ global
6047
+ });
6048
+ }
5201
6049
  };
5202
6050
 
5203
6051
  // src/features/skills/skills-processor.ts
@@ -5207,9 +6055,10 @@ var skillsProcessorToolTargetTuple = [
5207
6055
  "codexcli",
5208
6056
  "copilot",
5209
6057
  "cursor",
5210
- "geminicli"
6058
+ "geminicli",
6059
+ "opencode"
5211
6060
  ];
5212
- var SkillsProcessorToolTargetSchema = import_mini23.z.enum(skillsProcessorToolTargetTuple);
6061
+ var SkillsProcessorToolTargetSchema = import_mini25.z.enum(skillsProcessorToolTargetTuple);
5213
6062
  var toolSkillFactories = /* @__PURE__ */ new Map([
5214
6063
  [
5215
6064
  "agentsmd",
@@ -5236,7 +6085,7 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
5236
6085
  "copilot",
5237
6086
  {
5238
6087
  class: CopilotSkill,
5239
- meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
6088
+ meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: false }
5240
6089
  }
5241
6090
  ],
5242
6091
  [
@@ -5252,6 +6101,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
5252
6101
  class: GeminiCliSkill,
5253
6102
  meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
5254
6103
  }
6104
+ ],
6105
+ [
6106
+ "opencode",
6107
+ {
6108
+ class: OpenCodeSkill,
6109
+ meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
6110
+ }
5255
6111
  ]
5256
6112
  ]);
5257
6113
  var defaultGetFactory4 = (target) => {
@@ -5331,9 +6187,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
5331
6187
  */
5332
6188
  async loadRulesyncDirs() {
5333
6189
  const paths = RulesyncSkill.getSettablePaths();
5334
- const rulesyncSkillsDirPath = (0, import_node_path52.join)(this.baseDir, paths.relativeDirPath);
5335
- const dirPaths = await findFilesByGlobs((0, import_node_path52.join)(rulesyncSkillsDirPath, "*"), { type: "dir" });
5336
- const dirNames = dirPaths.map((path3) => (0, import_node_path52.basename)(path3));
6190
+ const rulesyncSkillsDirPath = (0, import_node_path53.join)(this.baseDir, paths.relativeDirPath);
6191
+ const dirPaths = await findFilesByGlobs((0, import_node_path53.join)(rulesyncSkillsDirPath, "*"), { type: "dir" });
6192
+ const dirNames = dirPaths.map((path3) => (0, import_node_path53.basename)(path3));
5337
6193
  const rulesyncSkills = await Promise.all(
5338
6194
  dirNames.map(
5339
6195
  (dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
@@ -5349,9 +6205,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
5349
6205
  async loadToolDirs() {
5350
6206
  const factory = this.getFactory(this.toolTarget);
5351
6207
  const paths = factory.class.getSettablePaths({ global: this.global });
5352
- const skillsDirPath = (0, import_node_path52.join)(this.baseDir, paths.relativeDirPath);
5353
- const dirPaths = await findFilesByGlobs((0, import_node_path52.join)(skillsDirPath, "*"), { type: "dir" });
5354
- const dirNames = dirPaths.map((path3) => (0, import_node_path52.basename)(path3));
6208
+ const skillsDirPath = (0, import_node_path53.join)(this.baseDir, paths.relativeDirPath);
6209
+ const dirPaths = await findFilesByGlobs((0, import_node_path53.join)(skillsDirPath, "*"), { type: "dir" });
6210
+ const dirNames = dirPaths.map((path3) => (0, import_node_path53.basename)(path3));
5355
6211
  const toolSkills = await Promise.all(
5356
6212
  dirNames.map(
5357
6213
  (dirName) => factory.class.fromDir({
@@ -5365,7 +6221,23 @@ var SkillsProcessor = class extends DirFeatureProcessor {
5365
6221
  return toolSkills;
5366
6222
  }
5367
6223
  async loadToolDirsToDelete() {
5368
- return this.loadToolDirs();
6224
+ const factory = this.getFactory(this.toolTarget);
6225
+ const paths = factory.class.getSettablePaths({ global: this.global });
6226
+ const skillsDirPath = (0, import_node_path53.join)(this.baseDir, paths.relativeDirPath);
6227
+ const dirPaths = await findFilesByGlobs((0, import_node_path53.join)(skillsDirPath, "*"), { type: "dir" });
6228
+ const dirNames = dirPaths.map((path3) => (0, import_node_path53.basename)(path3));
6229
+ const toolSkills = dirNames.map(
6230
+ (dirName) => factory.class.forDeletion({
6231
+ baseDir: this.baseDir,
6232
+ relativeDirPath: paths.relativeDirPath,
6233
+ dirName,
6234
+ global: this.global
6235
+ })
6236
+ );
6237
+ logger.info(
6238
+ `Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills for deletion`
6239
+ );
6240
+ return toolSkills;
5369
6241
  }
5370
6242
  /**
5371
6243
  * Implementation of abstract method from DirFeatureProcessor
@@ -5401,11 +6273,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
5401
6273
  };
5402
6274
 
5403
6275
  // src/features/subagents/agentsmd-subagent.ts
5404
- var import_node_path54 = require("path");
6276
+ var import_node_path55 = require("path");
5405
6277
 
5406
6278
  // src/features/subagents/simulated-subagent.ts
5407
- var import_node_path53 = require("path");
5408
- var import_mini24 = require("zod/mini");
6279
+ var import_node_path54 = require("path");
6280
+ var import_mini26 = require("zod/mini");
5409
6281
 
5410
6282
  // src/features/subagents/tool-subagent.ts
5411
6283
  var ToolSubagent = class extends ToolFile {
@@ -5415,6 +6287,14 @@ var ToolSubagent = class extends ToolFile {
5415
6287
  static async fromFile(_params) {
5416
6288
  throw new Error("Please implement this method in the subclass.");
5417
6289
  }
6290
+ /**
6291
+ * Create a minimal instance for deletion purposes.
6292
+ * This method does not read or parse file content, making it safe to use
6293
+ * even when files have old/incompatible formats.
6294
+ */
6295
+ static forDeletion(_params) {
6296
+ throw new Error("Please implement this method in the subclass.");
6297
+ }
5418
6298
  static fromRulesyncSubagent(_params) {
5419
6299
  throw new Error("Please implement this method in the subclass.");
5420
6300
  }
@@ -5440,9 +6320,9 @@ var ToolSubagent = class extends ToolFile {
5440
6320
  };
5441
6321
 
5442
6322
  // src/features/subagents/simulated-subagent.ts
5443
- var SimulatedSubagentFrontmatterSchema = import_mini24.z.object({
5444
- name: import_mini24.z.string(),
5445
- description: import_mini24.z.string()
6323
+ var SimulatedSubagentFrontmatterSchema = import_mini26.z.object({
6324
+ name: import_mini26.z.string(),
6325
+ description: import_mini26.z.string()
5446
6326
  });
5447
6327
  var SimulatedSubagent = class extends ToolSubagent {
5448
6328
  frontmatter;
@@ -5452,7 +6332,7 @@ var SimulatedSubagent = class extends ToolSubagent {
5452
6332
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
5453
6333
  if (!result.success) {
5454
6334
  throw new Error(
5455
- `Invalid frontmatter in ${(0, import_node_path53.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
6335
+ `Invalid frontmatter in ${(0, import_node_path54.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5456
6336
  );
5457
6337
  }
5458
6338
  }
@@ -5503,7 +6383,7 @@ var SimulatedSubagent = class extends ToolSubagent {
5503
6383
  return {
5504
6384
  success: false,
5505
6385
  error: new Error(
5506
- `Invalid frontmatter in ${(0, import_node_path53.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
6386
+ `Invalid frontmatter in ${(0, import_node_path54.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5507
6387
  )
5508
6388
  };
5509
6389
  }
@@ -5513,7 +6393,7 @@ var SimulatedSubagent = class extends ToolSubagent {
5513
6393
  relativeFilePath,
5514
6394
  validate = true
5515
6395
  }) {
5516
- const filePath = (0, import_node_path53.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
6396
+ const filePath = (0, import_node_path54.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
5517
6397
  const fileContent = await readFileContent(filePath);
5518
6398
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
5519
6399
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -5523,19 +6403,33 @@ var SimulatedSubagent = class extends ToolSubagent {
5523
6403
  return {
5524
6404
  baseDir,
5525
6405
  relativeDirPath: this.getSettablePaths().relativeDirPath,
5526
- relativeFilePath: (0, import_node_path53.basename)(relativeFilePath),
6406
+ relativeFilePath: (0, import_node_path54.basename)(relativeFilePath),
5527
6407
  frontmatter: result.data,
5528
6408
  body: content.trim(),
5529
6409
  validate
5530
6410
  };
5531
6411
  }
6412
+ static forDeletionDefault({
6413
+ baseDir = process.cwd(),
6414
+ relativeDirPath,
6415
+ relativeFilePath
6416
+ }) {
6417
+ return {
6418
+ baseDir,
6419
+ relativeDirPath,
6420
+ relativeFilePath,
6421
+ frontmatter: { name: "", description: "" },
6422
+ body: "",
6423
+ validate: false
6424
+ };
6425
+ }
5532
6426
  };
5533
6427
 
5534
6428
  // src/features/subagents/agentsmd-subagent.ts
5535
6429
  var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
5536
6430
  static getSettablePaths() {
5537
6431
  return {
5538
- relativeDirPath: (0, import_node_path54.join)(".agents", "subagents")
6432
+ relativeDirPath: (0, import_node_path55.join)(".agents", "subagents")
5539
6433
  };
5540
6434
  }
5541
6435
  static async fromFile(params) {
@@ -5552,14 +6446,17 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
5552
6446
  toolTarget: "agentsmd"
5553
6447
  });
5554
6448
  }
6449
+ static forDeletion(params) {
6450
+ return new _AgentsmdSubagent(this.forDeletionDefault(params));
6451
+ }
5555
6452
  };
5556
6453
 
5557
6454
  // src/features/subagents/codexcli-subagent.ts
5558
- var import_node_path55 = require("path");
6455
+ var import_node_path56 = require("path");
5559
6456
  var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
5560
6457
  static getSettablePaths() {
5561
6458
  return {
5562
- relativeDirPath: (0, import_node_path55.join)(".codex", "subagents")
6459
+ relativeDirPath: (0, import_node_path56.join)(".codex", "subagents")
5563
6460
  };
5564
6461
  }
5565
6462
  static async fromFile(params) {
@@ -5576,29 +6473,8 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
5576
6473
  toolTarget: "codexcli"
5577
6474
  });
5578
6475
  }
5579
- };
5580
-
5581
- // src/features/subagents/copilot-subagent.ts
5582
- var import_node_path56 = require("path");
5583
- var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
5584
- static getSettablePaths() {
5585
- return {
5586
- relativeDirPath: (0, import_node_path56.join)(".github", "subagents")
5587
- };
5588
- }
5589
- static async fromFile(params) {
5590
- const baseParams = await this.fromFileDefault(params);
5591
- return new _CopilotSubagent(baseParams);
5592
- }
5593
- static fromRulesyncSubagent(params) {
5594
- const baseParams = this.fromRulesyncSubagentDefault(params);
5595
- return new _CopilotSubagent(baseParams);
5596
- }
5597
- static isTargetedByRulesyncSubagent(rulesyncSubagent) {
5598
- return this.isTargetedByRulesyncSubagentDefault({
5599
- rulesyncSubagent,
5600
- toolTarget: "copilot"
5601
- });
6476
+ static forDeletion(params) {
6477
+ return new _CodexCliSubagent(this.forDeletionDefault(params));
5602
6478
  }
5603
6479
  };
5604
6480
 
@@ -5624,6 +6500,9 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
5624
6500
  toolTarget: "cursor"
5625
6501
  });
5626
6502
  }
6503
+ static forDeletion(params) {
6504
+ return new _CursorSubagent(this.forDeletionDefault(params));
6505
+ }
5627
6506
  };
5628
6507
 
5629
6508
  // src/features/subagents/geminicli-subagent.ts
@@ -5648,6 +6527,9 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
5648
6527
  toolTarget: "geminicli"
5649
6528
  });
5650
6529
  }
6530
+ static forDeletion(params) {
6531
+ return new _GeminiCliSubagent(this.forDeletionDefault(params));
6532
+ }
5651
6533
  };
5652
6534
 
5653
6535
  // src/features/subagents/roo-subagent.ts
@@ -5672,23 +6554,26 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
5672
6554
  toolTarget: "roo"
5673
6555
  });
5674
6556
  }
6557
+ static forDeletion(params) {
6558
+ return new _RooSubagent(this.forDeletionDefault(params));
6559
+ }
5675
6560
  };
5676
6561
 
5677
6562
  // src/features/subagents/subagents-processor.ts
5678
- var import_node_path62 = require("path");
5679
- var import_mini27 = require("zod/mini");
6563
+ var import_node_path63 = require("path");
6564
+ var import_mini30 = require("zod/mini");
5680
6565
 
5681
6566
  // src/features/subagents/claudecode-subagent.ts
5682
6567
  var import_node_path61 = require("path");
5683
- var import_mini26 = require("zod/mini");
6568
+ var import_mini28 = require("zod/mini");
5684
6569
 
5685
6570
  // src/features/subagents/rulesync-subagent.ts
5686
6571
  var import_node_path60 = require("path");
5687
- var import_mini25 = require("zod/mini");
5688
- var RulesyncSubagentFrontmatterSchema = import_mini25.z.looseObject({
6572
+ var import_mini27 = require("zod/mini");
6573
+ var RulesyncSubagentFrontmatterSchema = import_mini27.z.looseObject({
5689
6574
  targets: RulesyncTargetsSchema,
5690
- name: import_mini25.z.string(),
5691
- description: import_mini25.z.string()
6575
+ name: import_mini27.z.string(),
6576
+ description: import_mini27.z.string()
5692
6577
  });
5693
6578
  var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
5694
6579
  frontmatter;
@@ -5706,76 +6591,241 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
5706
6591
  ...rest,
5707
6592
  fileContent: stringifyFrontmatter(body, frontmatter)
5708
6593
  });
5709
- this.frontmatter = frontmatter;
5710
- this.body = body;
5711
- }
5712
- static getSettablePaths() {
5713
- return {
5714
- relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH
5715
- };
5716
- }
5717
- getFrontmatter() {
5718
- return this.frontmatter;
5719
- }
5720
- getBody() {
5721
- return this.body;
6594
+ this.frontmatter = frontmatter;
6595
+ this.body = body;
6596
+ }
6597
+ static getSettablePaths() {
6598
+ return {
6599
+ relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH
6600
+ };
6601
+ }
6602
+ getFrontmatter() {
6603
+ return this.frontmatter;
6604
+ }
6605
+ getBody() {
6606
+ return this.body;
6607
+ }
6608
+ validate() {
6609
+ if (!this.frontmatter) {
6610
+ return { success: true, error: null };
6611
+ }
6612
+ const result = RulesyncSubagentFrontmatterSchema.safeParse(this.frontmatter);
6613
+ if (result.success) {
6614
+ return { success: true, error: null };
6615
+ } else {
6616
+ return {
6617
+ success: false,
6618
+ error: new Error(
6619
+ `Invalid frontmatter in ${(0, import_node_path60.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
6620
+ )
6621
+ };
6622
+ }
6623
+ }
6624
+ static async fromFile({
6625
+ relativeFilePath
6626
+ }) {
6627
+ const fileContent = await readFileContent(
6628
+ (0, import_node_path60.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
6629
+ );
6630
+ const { frontmatter, body: content } = parseFrontmatter(fileContent);
6631
+ const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
6632
+ if (!result.success) {
6633
+ throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
6634
+ }
6635
+ const filename = (0, import_node_path60.basename)(relativeFilePath);
6636
+ return new _RulesyncSubagent({
6637
+ baseDir: process.cwd(),
6638
+ relativeDirPath: this.getSettablePaths().relativeDirPath,
6639
+ relativeFilePath: filename,
6640
+ frontmatter: result.data,
6641
+ body: content.trim()
6642
+ });
6643
+ }
6644
+ };
6645
+
6646
+ // src/features/subagents/claudecode-subagent.ts
6647
+ var ClaudecodeSubagentFrontmatterSchema = import_mini28.z.looseObject({
6648
+ name: import_mini28.z.string(),
6649
+ description: import_mini28.z.string(),
6650
+ model: import_mini28.z.optional(import_mini28.z.string()),
6651
+ tools: import_mini28.z.optional(import_mini28.z.union([import_mini28.z.string(), import_mini28.z.array(import_mini28.z.string())])),
6652
+ permissionMode: import_mini28.z.optional(import_mini28.z.string()),
6653
+ skills: import_mini28.z.optional(import_mini28.z.union([import_mini28.z.string(), import_mini28.z.array(import_mini28.z.string())]))
6654
+ });
6655
+ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
6656
+ frontmatter;
6657
+ body;
6658
+ constructor({ frontmatter, body, ...rest }) {
6659
+ if (rest.validate !== false) {
6660
+ const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
6661
+ if (!result.success) {
6662
+ throw new Error(
6663
+ `Invalid frontmatter in ${(0, import_node_path61.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
6664
+ );
6665
+ }
6666
+ }
6667
+ super({
6668
+ ...rest
6669
+ });
6670
+ this.frontmatter = frontmatter;
6671
+ this.body = body;
6672
+ }
6673
+ static getSettablePaths(_options = {}) {
6674
+ return {
6675
+ relativeDirPath: (0, import_node_path61.join)(".claude", "agents")
6676
+ };
6677
+ }
6678
+ getFrontmatter() {
6679
+ return this.frontmatter;
6680
+ }
6681
+ getBody() {
6682
+ return this.body;
6683
+ }
6684
+ toRulesyncSubagent() {
6685
+ const { name, description, model, ...restFields } = this.frontmatter;
6686
+ const claudecodeSection = {
6687
+ ...model && { model },
6688
+ ...restFields
6689
+ };
6690
+ const rulesyncFrontmatter = {
6691
+ targets: ["claudecode"],
6692
+ name,
6693
+ description,
6694
+ // Only include claudecode section if there are fields
6695
+ ...Object.keys(claudecodeSection).length > 0 && { claudecode: claudecodeSection }
6696
+ };
6697
+ return new RulesyncSubagent({
6698
+ baseDir: ".",
6699
+ // RulesyncCommand baseDir is always the project root directory
6700
+ frontmatter: rulesyncFrontmatter,
6701
+ body: this.body,
6702
+ relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
6703
+ relativeFilePath: this.getRelativeFilePath(),
6704
+ validate: true
6705
+ });
6706
+ }
6707
+ static fromRulesyncSubagent({
6708
+ baseDir = process.cwd(),
6709
+ rulesyncSubagent,
6710
+ validate = true,
6711
+ global = false
6712
+ }) {
6713
+ const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
6714
+ const claudecodeSection = rulesyncFrontmatter.claudecode ?? {};
6715
+ const rawClaudecodeFrontmatter = {
6716
+ name: rulesyncFrontmatter.name,
6717
+ description: rulesyncFrontmatter.description,
6718
+ ...claudecodeSection
6719
+ };
6720
+ const result = ClaudecodeSubagentFrontmatterSchema.safeParse(rawClaudecodeFrontmatter);
6721
+ if (!result.success) {
6722
+ throw new Error(`Invalid claudecode subagent frontmatter: ${formatError(result.error)}`);
6723
+ }
6724
+ const claudecodeFrontmatter = result.data;
6725
+ const body = rulesyncSubagent.getBody();
6726
+ const fileContent = stringifyFrontmatter(body, claudecodeFrontmatter);
6727
+ const paths = this.getSettablePaths({ global });
6728
+ return new _ClaudecodeSubagent({
6729
+ baseDir,
6730
+ frontmatter: claudecodeFrontmatter,
6731
+ body,
6732
+ relativeDirPath: paths.relativeDirPath,
6733
+ relativeFilePath: rulesyncSubagent.getRelativeFilePath(),
6734
+ fileContent,
6735
+ validate
6736
+ });
5722
6737
  }
5723
6738
  validate() {
5724
6739
  if (!this.frontmatter) {
5725
6740
  return { success: true, error: null };
5726
6741
  }
5727
- const result = RulesyncSubagentFrontmatterSchema.safeParse(this.frontmatter);
6742
+ const result = ClaudecodeSubagentFrontmatterSchema.safeParse(this.frontmatter);
5728
6743
  if (result.success) {
5729
6744
  return { success: true, error: null };
5730
6745
  } else {
5731
6746
  return {
5732
6747
  success: false,
5733
6748
  error: new Error(
5734
- `Invalid frontmatter in ${(0, import_node_path60.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
6749
+ `Invalid frontmatter in ${(0, import_node_path61.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5735
6750
  )
5736
6751
  };
5737
6752
  }
5738
6753
  }
6754
+ static isTargetedByRulesyncSubagent(rulesyncSubagent) {
6755
+ return this.isTargetedByRulesyncSubagentDefault({
6756
+ rulesyncSubagent,
6757
+ toolTarget: "claudecode"
6758
+ });
6759
+ }
5739
6760
  static async fromFile({
5740
- relativeFilePath
6761
+ baseDir = process.cwd(),
6762
+ relativeFilePath,
6763
+ validate = true,
6764
+ global = false
5741
6765
  }) {
5742
- const fileContent = await readFileContent(
5743
- (0, import_node_path60.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
5744
- );
6766
+ const paths = this.getSettablePaths({ global });
6767
+ const filePath = (0, import_node_path61.join)(baseDir, paths.relativeDirPath, relativeFilePath);
6768
+ const fileContent = await readFileContent(filePath);
5745
6769
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
5746
- const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
6770
+ const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
5747
6771
  if (!result.success) {
5748
- throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
6772
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
5749
6773
  }
5750
- const filename = (0, import_node_path60.basename)(relativeFilePath);
5751
- return new _RulesyncSubagent({
5752
- baseDir: process.cwd(),
5753
- relativeDirPath: this.getSettablePaths().relativeDirPath,
5754
- relativeFilePath: filename,
6774
+ return new _ClaudecodeSubagent({
6775
+ baseDir,
6776
+ relativeDirPath: paths.relativeDirPath,
6777
+ relativeFilePath,
5755
6778
  frontmatter: result.data,
5756
- body: content.trim()
6779
+ body: content.trim(),
6780
+ fileContent,
6781
+ validate
6782
+ });
6783
+ }
6784
+ static forDeletion({
6785
+ baseDir = process.cwd(),
6786
+ relativeDirPath,
6787
+ relativeFilePath
6788
+ }) {
6789
+ return new _ClaudecodeSubagent({
6790
+ baseDir,
6791
+ relativeDirPath,
6792
+ relativeFilePath,
6793
+ frontmatter: { name: "", description: "" },
6794
+ body: "",
6795
+ fileContent: "",
6796
+ validate: false
5757
6797
  });
5758
6798
  }
5759
6799
  };
5760
6800
 
5761
- // src/features/subagents/claudecode-subagent.ts
5762
- var ClaudecodeSubagentFrontmatterSchema = import_mini26.z.looseObject({
5763
- name: import_mini26.z.string(),
5764
- description: import_mini26.z.string(),
5765
- model: import_mini26.z.optional(import_mini26.z.string()),
5766
- tools: import_mini26.z.optional(import_mini26.z.union([import_mini26.z.string(), import_mini26.z.array(import_mini26.z.string())])),
5767
- permissionMode: import_mini26.z.optional(import_mini26.z.string()),
5768
- skills: import_mini26.z.optional(import_mini26.z.union([import_mini26.z.string(), import_mini26.z.array(import_mini26.z.string())]))
6801
+ // src/features/subagents/copilot-subagent.ts
6802
+ var import_node_path62 = require("path");
6803
+ var import_mini29 = require("zod/mini");
6804
+ var REQUIRED_TOOL = "agent/runSubagent";
6805
+ var CopilotSubagentFrontmatterSchema = import_mini29.z.looseObject({
6806
+ name: import_mini29.z.string(),
6807
+ description: import_mini29.z.string(),
6808
+ tools: import_mini29.z.optional(import_mini29.z.union([import_mini29.z.string(), import_mini29.z.array(import_mini29.z.string())]))
5769
6809
  });
5770
- var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
6810
+ var normalizeTools = (tools) => {
6811
+ if (!tools) {
6812
+ return [];
6813
+ }
6814
+ return Array.isArray(tools) ? tools : [tools];
6815
+ };
6816
+ var ensureRequiredTool = (tools) => {
6817
+ const mergedTools = /* @__PURE__ */ new Set([REQUIRED_TOOL, ...tools]);
6818
+ return Array.from(mergedTools);
6819
+ };
6820
+ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
5771
6821
  frontmatter;
5772
6822
  body;
5773
6823
  constructor({ frontmatter, body, ...rest }) {
5774
6824
  if (rest.validate !== false) {
5775
- const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
6825
+ const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
5776
6826
  if (!result.success) {
5777
6827
  throw new Error(
5778
- `Invalid frontmatter in ${(0, import_node_path61.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
6828
+ `Invalid frontmatter in ${(0, import_node_path62.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5779
6829
  );
5780
6830
  }
5781
6831
  }
@@ -5787,7 +6837,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
5787
6837
  }
5788
6838
  static getSettablePaths(_options = {}) {
5789
6839
  return {
5790
- relativeDirPath: (0, import_node_path61.join)(".claude", "agents")
6840
+ relativeDirPath: (0, import_node_path62.join)(".github", "agents")
5791
6841
  };
5792
6842
  }
5793
6843
  getFrontmatter() {
@@ -5797,17 +6847,15 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
5797
6847
  return this.body;
5798
6848
  }
5799
6849
  toRulesyncSubagent() {
5800
- const { name, description, model, ...restFields } = this.frontmatter;
5801
- const claudecodeSection = {
5802
- ...model && { model },
5803
- ...restFields
5804
- };
6850
+ const { name, description, tools, ...rest } = this.frontmatter;
5805
6851
  const rulesyncFrontmatter = {
5806
- targets: ["claudecode"],
6852
+ targets: ["copilot"],
5807
6853
  name,
5808
6854
  description,
5809
- // Only include claudecode section if there are fields
5810
- ...Object.keys(claudecodeSection).length > 0 && { claudecode: claudecodeSection }
6855
+ copilot: {
6856
+ ...tools && { tools },
6857
+ ...rest
6858
+ }
5811
6859
  };
5812
6860
  return new RulesyncSubagent({
5813
6861
  baseDir: ".",
@@ -5826,42 +6874,44 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
5826
6874
  global = false
5827
6875
  }) {
5828
6876
  const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
5829
- const claudecodeSection = rulesyncFrontmatter.claudecode ?? {};
5830
- const rawClaudecodeFrontmatter = {
6877
+ const copilotSection = rulesyncFrontmatter.copilot ?? {};
6878
+ const toolsField = copilotSection.tools;
6879
+ const userTools = normalizeTools(
6880
+ Array.isArray(toolsField) || typeof toolsField === "string" ? toolsField : void 0
6881
+ );
6882
+ const mergedTools = ensureRequiredTool(userTools);
6883
+ const copilotFrontmatter = {
5831
6884
  name: rulesyncFrontmatter.name,
5832
6885
  description: rulesyncFrontmatter.description,
5833
- ...claudecodeSection
6886
+ ...copilotSection,
6887
+ ...mergedTools.length > 0 && { tools: mergedTools }
5834
6888
  };
5835
- const result = ClaudecodeSubagentFrontmatterSchema.safeParse(rawClaudecodeFrontmatter);
5836
- if (!result.success) {
5837
- throw new Error(`Invalid claudecode subagent frontmatter: ${formatError(result.error)}`);
5838
- }
5839
- const claudecodeFrontmatter = result.data;
5840
6889
  const body = rulesyncSubagent.getBody();
5841
- const fileContent = stringifyFrontmatter(body, claudecodeFrontmatter);
6890
+ const fileContent = stringifyFrontmatter(body, copilotFrontmatter);
5842
6891
  const paths = this.getSettablePaths({ global });
5843
- return new _ClaudecodeSubagent({
6892
+ return new _CopilotSubagent({
5844
6893
  baseDir,
5845
- frontmatter: claudecodeFrontmatter,
6894
+ frontmatter: copilotFrontmatter,
5846
6895
  body,
5847
6896
  relativeDirPath: paths.relativeDirPath,
5848
6897
  relativeFilePath: rulesyncSubagent.getRelativeFilePath(),
5849
6898
  fileContent,
5850
- validate
6899
+ validate,
6900
+ global
5851
6901
  });
5852
6902
  }
5853
6903
  validate() {
5854
6904
  if (!this.frontmatter) {
5855
6905
  return { success: true, error: null };
5856
6906
  }
5857
- const result = ClaudecodeSubagentFrontmatterSchema.safeParse(this.frontmatter);
6907
+ const result = CopilotSubagentFrontmatterSchema.safeParse(this.frontmatter);
5858
6908
  if (result.success) {
5859
6909
  return { success: true, error: null };
5860
6910
  } else {
5861
6911
  return {
5862
6912
  success: false,
5863
6913
  error: new Error(
5864
- `Invalid frontmatter in ${(0, import_node_path61.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
6914
+ `Invalid frontmatter in ${(0, import_node_path62.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5865
6915
  )
5866
6916
  };
5867
6917
  }
@@ -5869,7 +6919,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
5869
6919
  static isTargetedByRulesyncSubagent(rulesyncSubagent) {
5870
6920
  return this.isTargetedByRulesyncSubagentDefault({
5871
6921
  rulesyncSubagent,
5872
- toolTarget: "claudecode"
6922
+ toolTarget: "copilot"
5873
6923
  });
5874
6924
  }
5875
6925
  static async fromFile({
@@ -5879,21 +6929,37 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
5879
6929
  global = false
5880
6930
  }) {
5881
6931
  const paths = this.getSettablePaths({ global });
5882
- const filePath = (0, import_node_path61.join)(baseDir, paths.relativeDirPath, relativeFilePath);
6932
+ const filePath = (0, import_node_path62.join)(baseDir, paths.relativeDirPath, relativeFilePath);
5883
6933
  const fileContent = await readFileContent(filePath);
5884
6934
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
5885
- const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
6935
+ const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
5886
6936
  if (!result.success) {
5887
6937
  throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
5888
6938
  }
5889
- return new _ClaudecodeSubagent({
6939
+ return new _CopilotSubagent({
5890
6940
  baseDir,
5891
6941
  relativeDirPath: paths.relativeDirPath,
5892
6942
  relativeFilePath,
5893
6943
  frontmatter: result.data,
5894
6944
  body: content.trim(),
5895
6945
  fileContent,
5896
- validate
6946
+ validate,
6947
+ global
6948
+ });
6949
+ }
6950
+ static forDeletion({
6951
+ baseDir = process.cwd(),
6952
+ relativeDirPath,
6953
+ relativeFilePath
6954
+ }) {
6955
+ return new _CopilotSubagent({
6956
+ baseDir,
6957
+ relativeDirPath,
6958
+ relativeFilePath,
6959
+ frontmatter: { name: "", description: "" },
6960
+ body: "",
6961
+ fileContent: "",
6962
+ validate: false
5897
6963
  });
5898
6964
  }
5899
6965
  };
@@ -5908,7 +6974,7 @@ var subagentsProcessorToolTargetTuple = [
5908
6974
  "geminicli",
5909
6975
  "roo"
5910
6976
  ];
5911
- var SubagentsProcessorToolTargetSchema = import_mini27.z.enum(subagentsProcessorToolTargetTuple);
6977
+ var SubagentsProcessorToolTargetSchema = import_mini30.z.enum(subagentsProcessorToolTargetTuple);
5912
6978
  var toolSubagentFactories = /* @__PURE__ */ new Map([
5913
6979
  [
5914
6980
  "agentsmd",
@@ -5922,7 +6988,10 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
5922
6988
  "codexcli",
5923
6989
  { class: CodexCliSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }
5924
6990
  ],
5925
- ["copilot", { class: CopilotSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }],
6991
+ [
6992
+ "copilot",
6993
+ { class: CopilotSubagent, meta: { supportsSimulated: false, supportsGlobal: false } }
6994
+ ],
5926
6995
  ["cursor", { class: CursorSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }],
5927
6996
  [
5928
6997
  "geminicli",
@@ -6011,7 +7080,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
6011
7080
  * Load and parse rulesync subagent files from .rulesync/subagents/ directory
6012
7081
  */
6013
7082
  async loadRulesyncFiles() {
6014
- const subagentsDir = (0, import_node_path62.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
7083
+ const subagentsDir = (0, import_node_path63.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
6015
7084
  const dirExists = await directoryExists(subagentsDir);
6016
7085
  if (!dirExists) {
6017
7086
  logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
@@ -6026,7 +7095,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
6026
7095
  logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
6027
7096
  const rulesyncSubagents = [];
6028
7097
  for (const mdFile of mdFiles) {
6029
- const filepath = (0, import_node_path62.join)(subagentsDir, mdFile);
7098
+ const filepath = (0, import_node_path63.join)(subagentsDir, mdFile);
6030
7099
  try {
6031
7100
  const rulesyncSubagent = await RulesyncSubagent.fromFile({
6032
7101
  relativeFilePath: mdFile,
@@ -6056,20 +7125,31 @@ var SubagentsProcessor = class extends FeatureProcessor {
6056
7125
  const factory = this.getFactory(this.toolTarget);
6057
7126
  const paths = factory.class.getSettablePaths({ global: this.global });
6058
7127
  const subagentFilePaths = await findFilesByGlobs(
6059
- (0, import_node_path62.join)(this.baseDir, paths.relativeDirPath, "*.md")
7128
+ (0, import_node_path63.join)(this.baseDir, paths.relativeDirPath, "*.md")
6060
7129
  );
7130
+ if (forDeletion) {
7131
+ const toolSubagents2 = subagentFilePaths.map(
7132
+ (path3) => factory.class.forDeletion({
7133
+ baseDir: this.baseDir,
7134
+ relativeDirPath: paths.relativeDirPath,
7135
+ relativeFilePath: (0, import_node_path63.basename)(path3),
7136
+ global: this.global
7137
+ })
7138
+ ).filter((subagent) => subagent.isDeletable());
7139
+ logger.info(`Successfully loaded ${toolSubagents2.length} ${paths.relativeDirPath} subagents`);
7140
+ return toolSubagents2;
7141
+ }
6061
7142
  const toolSubagents = await Promise.all(
6062
7143
  subagentFilePaths.map(
6063
7144
  (path3) => factory.class.fromFile({
6064
7145
  baseDir: this.baseDir,
6065
- relativeFilePath: (0, import_node_path62.basename)(path3),
7146
+ relativeFilePath: (0, import_node_path63.basename)(path3),
6066
7147
  global: this.global
6067
7148
  })
6068
7149
  )
6069
7150
  );
6070
- const result = forDeletion ? toolSubagents.filter((subagent) => subagent.isDeletable()) : toolSubagents;
6071
- logger.info(`Successfully loaded ${result.length} ${paths.relativeDirPath} subagents`);
6072
- return result;
7151
+ logger.info(`Successfully loaded ${toolSubagents.length} ${paths.relativeDirPath} subagents`);
7152
+ return toolSubagents;
6073
7153
  }
6074
7154
  /**
6075
7155
  * Implementation of abstract method from FeatureProcessor
@@ -6095,48 +7175,48 @@ var SubagentsProcessor = class extends FeatureProcessor {
6095
7175
  };
6096
7176
 
6097
7177
  // src/features/rules/agentsmd-rule.ts
6098
- var import_node_path65 = require("path");
7178
+ var import_node_path66 = require("path");
6099
7179
 
6100
7180
  // src/features/rules/tool-rule.ts
6101
- var import_node_path64 = require("path");
7181
+ var import_node_path65 = require("path");
6102
7182
 
6103
7183
  // src/features/rules/rulesync-rule.ts
6104
- var import_node_path63 = require("path");
6105
- var import_mini28 = require("zod/mini");
6106
- var RulesyncRuleFrontmatterSchema = import_mini28.z.object({
6107
- root: import_mini28.z.optional(import_mini28.z.optional(import_mini28.z.boolean())),
6108
- targets: import_mini28.z.optional(RulesyncTargetsSchema),
6109
- description: import_mini28.z.optional(import_mini28.z.string()),
6110
- globs: import_mini28.z.optional(import_mini28.z.array(import_mini28.z.string())),
6111
- agentsmd: import_mini28.z.optional(
6112
- import_mini28.z.object({
7184
+ var import_node_path64 = require("path");
7185
+ var import_mini31 = require("zod/mini");
7186
+ var RulesyncRuleFrontmatterSchema = import_mini31.z.object({
7187
+ root: import_mini31.z.optional(import_mini31.z.optional(import_mini31.z.boolean())),
7188
+ targets: import_mini31.z.optional(RulesyncTargetsSchema),
7189
+ description: import_mini31.z.optional(import_mini31.z.string()),
7190
+ globs: import_mini31.z.optional(import_mini31.z.array(import_mini31.z.string())),
7191
+ agentsmd: import_mini31.z.optional(
7192
+ import_mini31.z.object({
6113
7193
  // @example "path/to/subproject"
6114
- subprojectPath: import_mini28.z.optional(import_mini28.z.string())
7194
+ subprojectPath: import_mini31.z.optional(import_mini31.z.string())
6115
7195
  })
6116
7196
  ),
6117
- claudecode: import_mini28.z.optional(
6118
- import_mini28.z.object({
7197
+ claudecode: import_mini31.z.optional(
7198
+ import_mini31.z.object({
6119
7199
  // Glob patterns for conditional rules (takes precedence over globs)
6120
7200
  // @example "src/**/*.ts, tests/**/*.test.ts"
6121
- paths: import_mini28.z.optional(import_mini28.z.string())
7201
+ paths: import_mini31.z.optional(import_mini31.z.string())
6122
7202
  })
6123
7203
  ),
6124
- cursor: import_mini28.z.optional(
6125
- import_mini28.z.object({
6126
- alwaysApply: import_mini28.z.optional(import_mini28.z.boolean()),
6127
- description: import_mini28.z.optional(import_mini28.z.string()),
6128
- globs: import_mini28.z.optional(import_mini28.z.array(import_mini28.z.string()))
7204
+ cursor: import_mini31.z.optional(
7205
+ import_mini31.z.object({
7206
+ alwaysApply: import_mini31.z.optional(import_mini31.z.boolean()),
7207
+ description: import_mini31.z.optional(import_mini31.z.string()),
7208
+ globs: import_mini31.z.optional(import_mini31.z.array(import_mini31.z.string()))
6129
7209
  })
6130
7210
  ),
6131
- copilot: import_mini28.z.optional(
6132
- import_mini28.z.object({
6133
- excludeAgent: import_mini28.z.optional(import_mini28.z.union([import_mini28.z.literal("code-review"), import_mini28.z.literal("coding-agent")]))
7211
+ copilot: import_mini31.z.optional(
7212
+ import_mini31.z.object({
7213
+ excludeAgent: import_mini31.z.optional(import_mini31.z.union([import_mini31.z.literal("code-review"), import_mini31.z.literal("coding-agent")]))
6134
7214
  })
6135
7215
  ),
6136
- antigravity: import_mini28.z.optional(
6137
- import_mini28.z.looseObject({
6138
- trigger: import_mini28.z.optional(import_mini28.z.string()),
6139
- globs: import_mini28.z.optional(import_mini28.z.array(import_mini28.z.string()))
7216
+ antigravity: import_mini31.z.optional(
7217
+ import_mini31.z.looseObject({
7218
+ trigger: import_mini31.z.optional(import_mini31.z.string()),
7219
+ globs: import_mini31.z.optional(import_mini31.z.array(import_mini31.z.string()))
6140
7220
  })
6141
7221
  )
6142
7222
  });
@@ -6148,7 +7228,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
6148
7228
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
6149
7229
  if (!result.success) {
6150
7230
  throw new Error(
6151
- `Invalid frontmatter in ${(0, import_node_path63.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
7231
+ `Invalid frontmatter in ${(0, import_node_path64.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
6152
7232
  );
6153
7233
  }
6154
7234
  }
@@ -6163,6 +7243,9 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
6163
7243
  return {
6164
7244
  recommended: {
6165
7245
  relativeDirPath: RULESYNC_RULES_RELATIVE_DIR_PATH
7246
+ },
7247
+ legacy: {
7248
+ relativeDirPath: RULESYNC_RELATIVE_DIR_PATH
6166
7249
  }
6167
7250
  };
6168
7251
  }
@@ -6180,16 +7263,54 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
6180
7263
  return {
6181
7264
  success: false,
6182
7265
  error: new Error(
6183
- `Invalid frontmatter in ${(0, import_node_path63.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7266
+ `Invalid frontmatter in ${(0, import_node_path64.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
6184
7267
  )
6185
7268
  };
6186
7269
  }
6187
7270
  }
7271
+ static async fromFileLegacy({
7272
+ relativeFilePath,
7273
+ validate = true
7274
+ }) {
7275
+ const legacyPath = (0, import_node_path64.join)(
7276
+ process.cwd(),
7277
+ this.getSettablePaths().legacy.relativeDirPath,
7278
+ relativeFilePath
7279
+ );
7280
+ const recommendedPath = (0, import_node_path64.join)(
7281
+ this.getSettablePaths().recommended.relativeDirPath,
7282
+ relativeFilePath
7283
+ );
7284
+ logger.warn(`\u26A0\uFE0F Using deprecated path "${legacyPath}". Please migrate to "${recommendedPath}"`);
7285
+ const fileContent = await readFileContent(legacyPath);
7286
+ const { frontmatter, body: content } = parseFrontmatter(fileContent);
7287
+ const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
7288
+ if (!result.success) {
7289
+ throw new Error(`Invalid frontmatter in ${legacyPath}: ${formatError(result.error)}`);
7290
+ }
7291
+ const validatedFrontmatter = {
7292
+ root: result.data.root ?? false,
7293
+ targets: result.data.targets ?? ["*"],
7294
+ description: result.data.description ?? "",
7295
+ globs: result.data.globs ?? [],
7296
+ agentsmd: result.data.agentsmd,
7297
+ cursor: result.data.cursor
7298
+ };
7299
+ const filename = (0, import_node_path64.basename)(legacyPath);
7300
+ return new _RulesyncRule({
7301
+ baseDir: process.cwd(),
7302
+ relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
7303
+ relativeFilePath: filename,
7304
+ frontmatter: validatedFrontmatter,
7305
+ body: content.trim(),
7306
+ validate
7307
+ });
7308
+ }
6188
7309
  static async fromFile({
6189
7310
  relativeFilePath,
6190
7311
  validate = true
6191
7312
  }) {
6192
- const filePath = (0, import_node_path63.join)(
7313
+ const filePath = (0, import_node_path64.join)(
6193
7314
  process.cwd(),
6194
7315
  this.getSettablePaths().recommended.relativeDirPath,
6195
7316
  relativeFilePath
@@ -6208,7 +7329,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
6208
7329
  agentsmd: result.data.agentsmd,
6209
7330
  cursor: result.data.cursor
6210
7331
  };
6211
- const filename = (0, import_node_path63.basename)(filePath);
7332
+ const filename = (0, import_node_path64.basename)(filePath);
6212
7333
  return new _RulesyncRule({
6213
7334
  baseDir: process.cwd(),
6214
7335
  relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
@@ -6240,6 +7361,14 @@ var ToolRule = class extends ToolFile {
6240
7361
  static async fromFile(_params) {
6241
7362
  throw new Error("Please implement this method in the subclass.");
6242
7363
  }
7364
+ /**
7365
+ * Create a minimal instance for deletion purposes.
7366
+ * This method does not read or parse file content, making it safe to use
7367
+ * even when files have old/incompatible formats.
7368
+ */
7369
+ static forDeletion(_params) {
7370
+ throw new Error("Please implement this method in the subclass.");
7371
+ }
6243
7372
  static fromRulesyncRule(_params) {
6244
7373
  throw new Error("Please implement this method in the subclass.");
6245
7374
  }
@@ -6283,7 +7412,7 @@ var ToolRule = class extends ToolFile {
6283
7412
  rulesyncRule,
6284
7413
  validate = true,
6285
7414
  rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
6286
- nonRootPath = { relativeDirPath: (0, import_node_path64.join)(".agents", "memories") }
7415
+ nonRootPath = { relativeDirPath: (0, import_node_path65.join)(".agents", "memories") }
6287
7416
  }) {
6288
7417
  const params = this.buildToolRuleParamsDefault({
6289
7418
  baseDir,
@@ -6294,7 +7423,7 @@ var ToolRule = class extends ToolFile {
6294
7423
  });
6295
7424
  const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
6296
7425
  if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
6297
- params.relativeDirPath = (0, import_node_path64.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
7426
+ params.relativeDirPath = (0, import_node_path65.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
6298
7427
  params.relativeFilePath = "AGENTS.md";
6299
7428
  }
6300
7429
  return params;
@@ -6359,7 +7488,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
6359
7488
  relativeFilePath: "AGENTS.md"
6360
7489
  },
6361
7490
  nonRoot: {
6362
- relativeDirPath: (0, import_node_path65.join)(".agents", "memories")
7491
+ relativeDirPath: (0, import_node_path66.join)(".agents", "memories")
6363
7492
  }
6364
7493
  };
6365
7494
  }
@@ -6369,8 +7498,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
6369
7498
  validate = true
6370
7499
  }) {
6371
7500
  const isRoot = relativeFilePath === "AGENTS.md";
6372
- const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path65.join)(".agents", "memories", relativeFilePath);
6373
- const fileContent = await readFileContent((0, import_node_path65.join)(baseDir, relativePath));
7501
+ const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path66.join)(".agents", "memories", relativeFilePath);
7502
+ const fileContent = await readFileContent((0, import_node_path66.join)(baseDir, relativePath));
6374
7503
  return new _AgentsMdRule({
6375
7504
  baseDir,
6376
7505
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -6380,6 +7509,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
6380
7509
  root: isRoot
6381
7510
  });
6382
7511
  }
7512
+ static forDeletion({
7513
+ baseDir = process.cwd(),
7514
+ relativeDirPath,
7515
+ relativeFilePath
7516
+ }) {
7517
+ const isRoot = relativeFilePath === "AGENTS.md" && relativeDirPath === ".";
7518
+ return new _AgentsMdRule({
7519
+ baseDir,
7520
+ relativeDirPath,
7521
+ relativeFilePath,
7522
+ fileContent: "",
7523
+ validate: false,
7524
+ root: isRoot
7525
+ });
7526
+ }
6383
7527
  static fromRulesyncRule({
6384
7528
  baseDir = process.cwd(),
6385
7529
  rulesyncRule,
@@ -6410,12 +7554,12 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
6410
7554
  };
6411
7555
 
6412
7556
  // src/features/rules/amazonqcli-rule.ts
6413
- var import_node_path66 = require("path");
7557
+ var import_node_path67 = require("path");
6414
7558
  var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
6415
7559
  static getSettablePaths() {
6416
7560
  return {
6417
7561
  nonRoot: {
6418
- relativeDirPath: (0, import_node_path66.join)(".amazonq", "rules")
7562
+ relativeDirPath: (0, import_node_path67.join)(".amazonq", "rules")
6419
7563
  }
6420
7564
  };
6421
7565
  }
@@ -6425,7 +7569,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
6425
7569
  validate = true
6426
7570
  }) {
6427
7571
  const fileContent = await readFileContent(
6428
- (0, import_node_path66.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7572
+ (0, import_node_path67.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6429
7573
  );
6430
7574
  return new _AmazonQCliRule({
6431
7575
  baseDir,
@@ -6456,6 +7600,20 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
6456
7600
  validate() {
6457
7601
  return { success: true, error: null };
6458
7602
  }
7603
+ static forDeletion({
7604
+ baseDir = process.cwd(),
7605
+ relativeDirPath,
7606
+ relativeFilePath
7607
+ }) {
7608
+ return new _AmazonQCliRule({
7609
+ baseDir,
7610
+ relativeDirPath,
7611
+ relativeFilePath,
7612
+ fileContent: "",
7613
+ validate: false,
7614
+ root: false
7615
+ });
7616
+ }
6459
7617
  static isTargetedByRulesyncRule(rulesyncRule) {
6460
7618
  return this.isTargetedByRulesyncRuleDefault({
6461
7619
  rulesyncRule,
@@ -6465,21 +7623,21 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
6465
7623
  };
6466
7624
 
6467
7625
  // src/features/rules/antigravity-rule.ts
6468
- var import_node_path67 = require("path");
6469
- var import_mini29 = require("zod/mini");
6470
- var AntigravityRuleFrontmatterSchema = import_mini29.z.looseObject({
6471
- trigger: import_mini29.z.optional(
6472
- import_mini29.z.union([
6473
- import_mini29.z.literal("always_on"),
6474
- import_mini29.z.literal("glob"),
6475
- import_mini29.z.literal("manual"),
6476
- import_mini29.z.literal("model_decision"),
6477
- import_mini29.z.string()
7626
+ var import_node_path68 = require("path");
7627
+ var import_mini32 = require("zod/mini");
7628
+ var AntigravityRuleFrontmatterSchema = import_mini32.z.looseObject({
7629
+ trigger: import_mini32.z.optional(
7630
+ import_mini32.z.union([
7631
+ import_mini32.z.literal("always_on"),
7632
+ import_mini32.z.literal("glob"),
7633
+ import_mini32.z.literal("manual"),
7634
+ import_mini32.z.literal("model_decision"),
7635
+ import_mini32.z.string()
6478
7636
  // accepts any string for forward compatibility
6479
7637
  ])
6480
7638
  ),
6481
- globs: import_mini29.z.optional(import_mini29.z.string()),
6482
- description: import_mini29.z.optional(import_mini29.z.string())
7639
+ globs: import_mini32.z.optional(import_mini32.z.string()),
7640
+ description: import_mini32.z.optional(import_mini32.z.string())
6483
7641
  });
6484
7642
  function parseGlobsString(globs) {
6485
7643
  if (!globs) {
@@ -6624,7 +7782,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
6624
7782
  const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
6625
7783
  if (!result.success) {
6626
7784
  throw new Error(
6627
- `Invalid frontmatter in ${(0, import_node_path67.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
7785
+ `Invalid frontmatter in ${(0, import_node_path68.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
6628
7786
  );
6629
7787
  }
6630
7788
  }
@@ -6639,7 +7797,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
6639
7797
  static getSettablePaths() {
6640
7798
  return {
6641
7799
  nonRoot: {
6642
- relativeDirPath: (0, import_node_path67.join)(".agent", "rules")
7800
+ relativeDirPath: (0, import_node_path68.join)(".agent", "rules")
6643
7801
  }
6644
7802
  };
6645
7803
  }
@@ -6648,7 +7806,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
6648
7806
  relativeFilePath,
6649
7807
  validate = true
6650
7808
  }) {
6651
- const filePath = (0, import_node_path67.join)(
7809
+ const filePath = (0, import_node_path68.join)(
6652
7810
  baseDir,
6653
7811
  this.getSettablePaths().nonRoot.relativeDirPath,
6654
7812
  relativeFilePath
@@ -6765,6 +7923,21 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
6765
7923
  }
6766
7924
  return { success: true, error: null };
6767
7925
  }
7926
+ static forDeletion({
7927
+ baseDir = process.cwd(),
7928
+ relativeDirPath,
7929
+ relativeFilePath
7930
+ }) {
7931
+ return new _AntigravityRule({
7932
+ baseDir,
7933
+ relativeDirPath,
7934
+ relativeFilePath,
7935
+ frontmatter: {},
7936
+ body: "",
7937
+ validate: false,
7938
+ root: false
7939
+ });
7940
+ }
6768
7941
  static isTargetedByRulesyncRule(rulesyncRule) {
6769
7942
  return this.isTargetedByRulesyncRuleDefault({
6770
7943
  rulesyncRule,
@@ -6774,7 +7947,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
6774
7947
  };
6775
7948
 
6776
7949
  // src/features/rules/augmentcode-legacy-rule.ts
6777
- var import_node_path68 = require("path");
7950
+ var import_node_path69 = require("path");
6778
7951
  var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
6779
7952
  toRulesyncRule() {
6780
7953
  const rulesyncFrontmatter = {
@@ -6800,7 +7973,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
6800
7973
  relativeFilePath: ".augment-guidelines"
6801
7974
  },
6802
7975
  nonRoot: {
6803
- relativeDirPath: (0, import_node_path68.join)(".augment", "rules")
7976
+ relativeDirPath: (0, import_node_path69.join)(".augment", "rules")
6804
7977
  }
6805
7978
  };
6806
7979
  }
@@ -6835,8 +8008,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
6835
8008
  }) {
6836
8009
  const settablePaths = this.getSettablePaths();
6837
8010
  const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
6838
- const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path68.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
6839
- const fileContent = await readFileContent((0, import_node_path68.join)(baseDir, relativePath));
8011
+ const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path69.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
8012
+ const fileContent = await readFileContent((0, import_node_path69.join)(baseDir, relativePath));
6840
8013
  return new _AugmentcodeLegacyRule({
6841
8014
  baseDir,
6842
8015
  relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
@@ -6846,10 +8019,26 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
6846
8019
  root: isRoot
6847
8020
  });
6848
8021
  }
8022
+ static forDeletion({
8023
+ baseDir = process.cwd(),
8024
+ relativeDirPath,
8025
+ relativeFilePath
8026
+ }) {
8027
+ const settablePaths = this.getSettablePaths();
8028
+ const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
8029
+ return new _AugmentcodeLegacyRule({
8030
+ baseDir,
8031
+ relativeDirPath,
8032
+ relativeFilePath,
8033
+ fileContent: "",
8034
+ validate: false,
8035
+ root: isRoot
8036
+ });
8037
+ }
6849
8038
  };
6850
8039
 
6851
8040
  // src/features/rules/augmentcode-rule.ts
6852
- var import_node_path69 = require("path");
8041
+ var import_node_path70 = require("path");
6853
8042
  var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
6854
8043
  toRulesyncRule() {
6855
8044
  return this.toRulesyncRuleDefault();
@@ -6857,7 +8046,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
6857
8046
  static getSettablePaths() {
6858
8047
  return {
6859
8048
  nonRoot: {
6860
- relativeDirPath: (0, import_node_path69.join)(".augment", "rules")
8049
+ relativeDirPath: (0, import_node_path70.join)(".augment", "rules")
6861
8050
  }
6862
8051
  };
6863
8052
  }
@@ -6881,7 +8070,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
6881
8070
  validate = true
6882
8071
  }) {
6883
8072
  const fileContent = await readFileContent(
6884
- (0, import_node_path69.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
8073
+ (0, import_node_path70.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6885
8074
  );
6886
8075
  const { body: content } = parseFrontmatter(fileContent);
6887
8076
  return new _AugmentcodeRule({
@@ -6895,6 +8084,19 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
6895
8084
  validate() {
6896
8085
  return { success: true, error: null };
6897
8086
  }
8087
+ static forDeletion({
8088
+ baseDir = process.cwd(),
8089
+ relativeDirPath,
8090
+ relativeFilePath
8091
+ }) {
8092
+ return new _AugmentcodeRule({
8093
+ baseDir,
8094
+ relativeDirPath,
8095
+ relativeFilePath,
8096
+ fileContent: "",
8097
+ validate: false
8098
+ });
8099
+ }
6898
8100
  static isTargetedByRulesyncRule(rulesyncRule) {
6899
8101
  return this.isTargetedByRulesyncRuleDefault({
6900
8102
  rulesyncRule,
@@ -6904,7 +8106,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
6904
8106
  };
6905
8107
 
6906
8108
  // src/features/rules/claudecode-legacy-rule.ts
6907
- var import_node_path70 = require("path");
8109
+ var import_node_path71 = require("path");
6908
8110
  var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
6909
8111
  static getSettablePaths({
6910
8112
  global
@@ -6923,7 +8125,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
6923
8125
  relativeFilePath: "CLAUDE.md"
6924
8126
  },
6925
8127
  nonRoot: {
6926
- relativeDirPath: (0, import_node_path70.join)(".claude", "memories")
8128
+ relativeDirPath: (0, import_node_path71.join)(".claude", "memories")
6927
8129
  }
6928
8130
  };
6929
8131
  }
@@ -6938,7 +8140,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
6938
8140
  if (isRoot) {
6939
8141
  const relativePath2 = paths.root.relativeFilePath;
6940
8142
  const fileContent2 = await readFileContent(
6941
- (0, import_node_path70.join)(baseDir, paths.root.relativeDirPath, relativePath2)
8143
+ (0, import_node_path71.join)(baseDir, paths.root.relativeDirPath, relativePath2)
6942
8144
  );
6943
8145
  return new _ClaudecodeLegacyRule({
6944
8146
  baseDir,
@@ -6952,8 +8154,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
6952
8154
  if (!paths.nonRoot) {
6953
8155
  throw new Error("nonRoot path is not set");
6954
8156
  }
6955
- const relativePath = (0, import_node_path70.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
6956
- const fileContent = await readFileContent((0, import_node_path70.join)(baseDir, relativePath));
8157
+ const relativePath = (0, import_node_path71.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
8158
+ const fileContent = await readFileContent((0, import_node_path71.join)(baseDir, relativePath));
6957
8159
  return new _ClaudecodeLegacyRule({
6958
8160
  baseDir,
6959
8161
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -6986,6 +8188,23 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
6986
8188
  validate() {
6987
8189
  return { success: true, error: null };
6988
8190
  }
8191
+ static forDeletion({
8192
+ baseDir = process.cwd(),
8193
+ relativeDirPath,
8194
+ relativeFilePath,
8195
+ global = false
8196
+ }) {
8197
+ const paths = this.getSettablePaths({ global });
8198
+ const isRoot = relativeFilePath === paths.root.relativeFilePath;
8199
+ return new _ClaudecodeLegacyRule({
8200
+ baseDir,
8201
+ relativeDirPath,
8202
+ relativeFilePath,
8203
+ fileContent: "",
8204
+ validate: false,
8205
+ root: isRoot
8206
+ });
8207
+ }
6989
8208
  static isTargetedByRulesyncRule(rulesyncRule) {
6990
8209
  return this.isTargetedByRulesyncRuleDefault({
6991
8210
  rulesyncRule,
@@ -6995,10 +8214,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
6995
8214
  };
6996
8215
 
6997
8216
  // src/features/rules/claudecode-rule.ts
6998
- var import_node_path71 = require("path");
6999
- var import_mini30 = require("zod/mini");
7000
- var ClaudecodeRuleFrontmatterSchema = import_mini30.z.object({
7001
- paths: import_mini30.z.optional(import_mini30.z.string())
8217
+ var import_node_path72 = require("path");
8218
+ var import_mini33 = require("zod/mini");
8219
+ var ClaudecodeRuleFrontmatterSchema = import_mini33.z.object({
8220
+ paths: import_mini33.z.optional(import_mini33.z.string())
7002
8221
  });
7003
8222
  var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
7004
8223
  frontmatter;
@@ -7020,7 +8239,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
7020
8239
  relativeFilePath: "CLAUDE.md"
7021
8240
  },
7022
8241
  nonRoot: {
7023
- relativeDirPath: (0, import_node_path71.join)(".claude", "rules")
8242
+ relativeDirPath: (0, import_node_path72.join)(".claude", "rules")
7024
8243
  }
7025
8244
  };
7026
8245
  }
@@ -7029,7 +8248,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
7029
8248
  const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
7030
8249
  if (!result.success) {
7031
8250
  throw new Error(
7032
- `Invalid frontmatter in ${(0, import_node_path71.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
8251
+ `Invalid frontmatter in ${(0, import_node_path72.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
7033
8252
  );
7034
8253
  }
7035
8254
  }
@@ -7057,7 +8276,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
7057
8276
  const isRoot = relativeFilePath === paths.root.relativeFilePath;
7058
8277
  if (isRoot) {
7059
8278
  const fileContent2 = await readFileContent(
7060
- (0, import_node_path71.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
8279
+ (0, import_node_path72.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
7061
8280
  );
7062
8281
  return new _ClaudecodeRule({
7063
8282
  baseDir,
@@ -7072,13 +8291,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
7072
8291
  if (!paths.nonRoot) {
7073
8292
  throw new Error("nonRoot path is not set");
7074
8293
  }
7075
- const relativePath = (0, import_node_path71.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
7076
- const fileContent = await readFileContent((0, import_node_path71.join)(baseDir, relativePath));
8294
+ const relativePath = (0, import_node_path72.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
8295
+ const fileContent = await readFileContent((0, import_node_path72.join)(baseDir, relativePath));
7077
8296
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
7078
8297
  const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
7079
8298
  if (!result.success) {
7080
8299
  throw new Error(
7081
- `Invalid frontmatter in ${(0, import_node_path71.join)(baseDir, relativePath)}: ${formatError(result.error)}`
8300
+ `Invalid frontmatter in ${(0, import_node_path72.join)(baseDir, relativePath)}: ${formatError(result.error)}`
7082
8301
  );
7083
8302
  }
7084
8303
  return new _ClaudecodeRule({
@@ -7091,6 +8310,24 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
7091
8310
  root: false
7092
8311
  });
7093
8312
  }
8313
+ static forDeletion({
8314
+ baseDir = process.cwd(),
8315
+ relativeDirPath,
8316
+ relativeFilePath,
8317
+ global = false
8318
+ }) {
8319
+ const paths = this.getSettablePaths({ global });
8320
+ const isRoot = relativeFilePath === paths.root.relativeFilePath;
8321
+ return new _ClaudecodeRule({
8322
+ baseDir,
8323
+ relativeDirPath,
8324
+ relativeFilePath,
8325
+ frontmatter: {},
8326
+ body: "",
8327
+ validate: false,
8328
+ root: isRoot
8329
+ });
8330
+ }
7094
8331
  static fromRulesyncRule({
7095
8332
  baseDir = process.cwd(),
7096
8333
  rulesyncRule,
@@ -7167,7 +8404,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
7167
8404
  return {
7168
8405
  success: false,
7169
8406
  error: new Error(
7170
- `Invalid frontmatter in ${(0, import_node_path71.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
8407
+ `Invalid frontmatter in ${(0, import_node_path72.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7171
8408
  )
7172
8409
  };
7173
8410
  }
@@ -7187,10 +8424,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
7187
8424
  };
7188
8425
 
7189
8426
  // src/features/rules/cline-rule.ts
7190
- var import_node_path72 = require("path");
7191
- var import_mini31 = require("zod/mini");
7192
- var ClineRuleFrontmatterSchema = import_mini31.z.object({
7193
- description: import_mini31.z.string()
8427
+ var import_node_path73 = require("path");
8428
+ var import_mini34 = require("zod/mini");
8429
+ var ClineRuleFrontmatterSchema = import_mini34.z.object({
8430
+ description: import_mini34.z.string()
7194
8431
  });
7195
8432
  var ClineRule = class _ClineRule extends ToolRule {
7196
8433
  static getSettablePaths() {
@@ -7232,7 +8469,7 @@ var ClineRule = class _ClineRule extends ToolRule {
7232
8469
  validate = true
7233
8470
  }) {
7234
8471
  const fileContent = await readFileContent(
7235
- (0, import_node_path72.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
8472
+ (0, import_node_path73.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7236
8473
  );
7237
8474
  return new _ClineRule({
7238
8475
  baseDir,
@@ -7242,10 +8479,23 @@ var ClineRule = class _ClineRule extends ToolRule {
7242
8479
  validate
7243
8480
  });
7244
8481
  }
8482
+ static forDeletion({
8483
+ baseDir = process.cwd(),
8484
+ relativeDirPath,
8485
+ relativeFilePath
8486
+ }) {
8487
+ return new _ClineRule({
8488
+ baseDir,
8489
+ relativeDirPath,
8490
+ relativeFilePath,
8491
+ fileContent: "",
8492
+ validate: false
8493
+ });
8494
+ }
7245
8495
  };
7246
8496
 
7247
8497
  // src/features/rules/codexcli-rule.ts
7248
- var import_node_path73 = require("path");
8498
+ var import_node_path74 = require("path");
7249
8499
  var CodexcliRule = class _CodexcliRule extends ToolRule {
7250
8500
  static getSettablePaths({
7251
8501
  global
@@ -7264,7 +8514,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
7264
8514
  relativeFilePath: "AGENTS.md"
7265
8515
  },
7266
8516
  nonRoot: {
7267
- relativeDirPath: (0, import_node_path73.join)(".codex", "memories")
8517
+ relativeDirPath: (0, import_node_path74.join)(".codex", "memories")
7268
8518
  }
7269
8519
  };
7270
8520
  }
@@ -7279,7 +8529,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
7279
8529
  if (isRoot) {
7280
8530
  const relativePath2 = paths.root.relativeFilePath;
7281
8531
  const fileContent2 = await readFileContent(
7282
- (0, import_node_path73.join)(baseDir, paths.root.relativeDirPath, relativePath2)
8532
+ (0, import_node_path74.join)(baseDir, paths.root.relativeDirPath, relativePath2)
7283
8533
  );
7284
8534
  return new _CodexcliRule({
7285
8535
  baseDir,
@@ -7293,8 +8543,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
7293
8543
  if (!paths.nonRoot) {
7294
8544
  throw new Error("nonRoot path is not set");
7295
8545
  }
7296
- const relativePath = (0, import_node_path73.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
7297
- const fileContent = await readFileContent((0, import_node_path73.join)(baseDir, relativePath));
8546
+ const relativePath = (0, import_node_path74.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
8547
+ const fileContent = await readFileContent((0, import_node_path74.join)(baseDir, relativePath));
7298
8548
  return new _CodexcliRule({
7299
8549
  baseDir,
7300
8550
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -7327,6 +8577,23 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
7327
8577
  validate() {
7328
8578
  return { success: true, error: null };
7329
8579
  }
8580
+ static forDeletion({
8581
+ baseDir = process.cwd(),
8582
+ relativeDirPath,
8583
+ relativeFilePath,
8584
+ global = false
8585
+ }) {
8586
+ const paths = this.getSettablePaths({ global });
8587
+ const isRoot = relativeFilePath === paths.root.relativeFilePath;
8588
+ return new _CodexcliRule({
8589
+ baseDir,
8590
+ relativeDirPath,
8591
+ relativeFilePath,
8592
+ fileContent: "",
8593
+ validate: false,
8594
+ root: isRoot
8595
+ });
8596
+ }
7330
8597
  static isTargetedByRulesyncRule(rulesyncRule) {
7331
8598
  return this.isTargetedByRulesyncRuleDefault({
7332
8599
  rulesyncRule,
@@ -7336,12 +8603,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
7336
8603
  };
7337
8604
 
7338
8605
  // src/features/rules/copilot-rule.ts
7339
- var import_node_path74 = require("path");
7340
- var import_mini32 = require("zod/mini");
7341
- var CopilotRuleFrontmatterSchema = import_mini32.z.object({
7342
- description: import_mini32.z.optional(import_mini32.z.string()),
7343
- applyTo: import_mini32.z.optional(import_mini32.z.string()),
7344
- excludeAgent: import_mini32.z.optional(import_mini32.z.union([import_mini32.z.literal("code-review"), import_mini32.z.literal("coding-agent")]))
8606
+ var import_node_path75 = require("path");
8607
+ var import_mini35 = require("zod/mini");
8608
+ var CopilotRuleFrontmatterSchema = import_mini35.z.object({
8609
+ description: import_mini35.z.optional(import_mini35.z.string()),
8610
+ applyTo: import_mini35.z.optional(import_mini35.z.string()),
8611
+ excludeAgent: import_mini35.z.optional(import_mini35.z.union([import_mini35.z.literal("code-review"), import_mini35.z.literal("coding-agent")]))
7345
8612
  });
7346
8613
  var CopilotRule = class _CopilotRule extends ToolRule {
7347
8614
  frontmatter;
@@ -7353,7 +8620,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
7353
8620
  relativeFilePath: "copilot-instructions.md"
7354
8621
  },
7355
8622
  nonRoot: {
7356
- relativeDirPath: (0, import_node_path74.join)(".github", "instructions")
8623
+ relativeDirPath: (0, import_node_path75.join)(".github", "instructions")
7357
8624
  }
7358
8625
  };
7359
8626
  }
@@ -7362,7 +8629,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
7362
8629
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
7363
8630
  if (!result.success) {
7364
8631
  throw new Error(
7365
- `Invalid frontmatter in ${(0, import_node_path74.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
8632
+ `Invalid frontmatter in ${(0, import_node_path75.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
7366
8633
  );
7367
8634
  }
7368
8635
  }
@@ -7444,11 +8711,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
7444
8711
  validate = true
7445
8712
  }) {
7446
8713
  const isRoot = relativeFilePath === "copilot-instructions.md";
7447
- const relativePath = isRoot ? (0, import_node_path74.join)(
8714
+ const relativePath = isRoot ? (0, import_node_path75.join)(
7448
8715
  this.getSettablePaths().root.relativeDirPath,
7449
8716
  this.getSettablePaths().root.relativeFilePath
7450
- ) : (0, import_node_path74.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
7451
- const fileContent = await readFileContent((0, import_node_path74.join)(baseDir, relativePath));
8717
+ ) : (0, import_node_path75.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
8718
+ const fileContent = await readFileContent((0, import_node_path75.join)(baseDir, relativePath));
7452
8719
  if (isRoot) {
7453
8720
  return new _CopilotRule({
7454
8721
  baseDir,
@@ -7464,7 +8731,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
7464
8731
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
7465
8732
  if (!result.success) {
7466
8733
  throw new Error(
7467
- `Invalid frontmatter in ${(0, import_node_path74.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
8734
+ `Invalid frontmatter in ${(0, import_node_path75.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
7468
8735
  );
7469
8736
  }
7470
8737
  return new _CopilotRule({
@@ -7477,6 +8744,22 @@ var CopilotRule = class _CopilotRule extends ToolRule {
7477
8744
  root: isRoot
7478
8745
  });
7479
8746
  }
8747
+ static forDeletion({
8748
+ baseDir = process.cwd(),
8749
+ relativeDirPath,
8750
+ relativeFilePath
8751
+ }) {
8752
+ const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
8753
+ return new _CopilotRule({
8754
+ baseDir,
8755
+ relativeDirPath,
8756
+ relativeFilePath,
8757
+ frontmatter: {},
8758
+ body: "",
8759
+ validate: false,
8760
+ root: isRoot
8761
+ });
8762
+ }
7480
8763
  validate() {
7481
8764
  if (!this.frontmatter) {
7482
8765
  return { success: true, error: null };
@@ -7488,7 +8771,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
7488
8771
  return {
7489
8772
  success: false,
7490
8773
  error: new Error(
7491
- `Invalid frontmatter in ${(0, import_node_path74.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
8774
+ `Invalid frontmatter in ${(0, import_node_path75.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7492
8775
  )
7493
8776
  };
7494
8777
  }
@@ -7508,12 +8791,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
7508
8791
  };
7509
8792
 
7510
8793
  // src/features/rules/cursor-rule.ts
7511
- var import_node_path75 = require("path");
7512
- var import_mini33 = require("zod/mini");
7513
- var CursorRuleFrontmatterSchema = import_mini33.z.object({
7514
- description: import_mini33.z.optional(import_mini33.z.string()),
7515
- globs: import_mini33.z.optional(import_mini33.z.string()),
7516
- alwaysApply: import_mini33.z.optional(import_mini33.z.boolean())
8794
+ var import_node_path76 = require("path");
8795
+ var import_mini36 = require("zod/mini");
8796
+ var CursorRuleFrontmatterSchema = import_mini36.z.object({
8797
+ description: import_mini36.z.optional(import_mini36.z.string()),
8798
+ globs: import_mini36.z.optional(import_mini36.z.string()),
8799
+ alwaysApply: import_mini36.z.optional(import_mini36.z.boolean())
7517
8800
  });
7518
8801
  var CursorRule = class _CursorRule extends ToolRule {
7519
8802
  frontmatter;
@@ -7521,7 +8804,7 @@ var CursorRule = class _CursorRule extends ToolRule {
7521
8804
  static getSettablePaths() {
7522
8805
  return {
7523
8806
  nonRoot: {
7524
- relativeDirPath: (0, import_node_path75.join)(".cursor", "rules")
8807
+ relativeDirPath: (0, import_node_path76.join)(".cursor", "rules")
7525
8808
  }
7526
8809
  };
7527
8810
  }
@@ -7530,7 +8813,7 @@ var CursorRule = class _CursorRule extends ToolRule {
7530
8813
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
7531
8814
  if (!result.success) {
7532
8815
  throw new Error(
7533
- `Invalid frontmatter in ${(0, import_node_path75.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
8816
+ `Invalid frontmatter in ${(0, import_node_path76.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
7534
8817
  );
7535
8818
  }
7536
8819
  }
@@ -7647,24 +8930,38 @@ var CursorRule = class _CursorRule extends ToolRule {
7647
8930
  validate = true
7648
8931
  }) {
7649
8932
  const fileContent = await readFileContent(
7650
- (0, import_node_path75.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
8933
+ (0, import_node_path76.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7651
8934
  );
7652
8935
  const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
7653
8936
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
7654
8937
  if (!result.success) {
7655
8938
  throw new Error(
7656
- `Invalid frontmatter in ${(0, import_node_path75.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
8939
+ `Invalid frontmatter in ${(0, import_node_path76.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
7657
8940
  );
7658
8941
  }
7659
8942
  return new _CursorRule({
7660
8943
  baseDir,
7661
8944
  relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
7662
- relativeFilePath: (0, import_node_path75.basename)(relativeFilePath),
8945
+ relativeFilePath: (0, import_node_path76.basename)(relativeFilePath),
7663
8946
  frontmatter: result.data,
7664
8947
  body: content.trim(),
7665
8948
  validate
7666
8949
  });
7667
8950
  }
8951
+ static forDeletion({
8952
+ baseDir = process.cwd(),
8953
+ relativeDirPath,
8954
+ relativeFilePath
8955
+ }) {
8956
+ return new _CursorRule({
8957
+ baseDir,
8958
+ relativeDirPath,
8959
+ relativeFilePath,
8960
+ frontmatter: {},
8961
+ body: "",
8962
+ validate: false
8963
+ });
8964
+ }
7668
8965
  validate() {
7669
8966
  if (!this.frontmatter) {
7670
8967
  return { success: true, error: null };
@@ -7676,7 +8973,7 @@ var CursorRule = class _CursorRule extends ToolRule {
7676
8973
  return {
7677
8974
  success: false,
7678
8975
  error: new Error(
7679
- `Invalid frontmatter in ${(0, import_node_path75.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
8976
+ `Invalid frontmatter in ${(0, import_node_path76.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7680
8977
  )
7681
8978
  };
7682
8979
  }
@@ -7696,7 +8993,7 @@ var CursorRule = class _CursorRule extends ToolRule {
7696
8993
  };
7697
8994
 
7698
8995
  // src/features/rules/geminicli-rule.ts
7699
- var import_node_path76 = require("path");
8996
+ var import_node_path77 = require("path");
7700
8997
  var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7701
8998
  static getSettablePaths({
7702
8999
  global
@@ -7715,7 +9012,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7715
9012
  relativeFilePath: "GEMINI.md"
7716
9013
  },
7717
9014
  nonRoot: {
7718
- relativeDirPath: (0, import_node_path76.join)(".gemini", "memories")
9015
+ relativeDirPath: (0, import_node_path77.join)(".gemini", "memories")
7719
9016
  }
7720
9017
  };
7721
9018
  }
@@ -7730,7 +9027,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7730
9027
  if (isRoot) {
7731
9028
  const relativePath2 = paths.root.relativeFilePath;
7732
9029
  const fileContent2 = await readFileContent(
7733
- (0, import_node_path76.join)(baseDir, paths.root.relativeDirPath, relativePath2)
9030
+ (0, import_node_path77.join)(baseDir, paths.root.relativeDirPath, relativePath2)
7734
9031
  );
7735
9032
  return new _GeminiCliRule({
7736
9033
  baseDir,
@@ -7744,8 +9041,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7744
9041
  if (!paths.nonRoot) {
7745
9042
  throw new Error("nonRoot path is not set");
7746
9043
  }
7747
- const relativePath = (0, import_node_path76.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
7748
- const fileContent = await readFileContent((0, import_node_path76.join)(baseDir, relativePath));
9044
+ const relativePath = (0, import_node_path77.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
9045
+ const fileContent = await readFileContent((0, import_node_path77.join)(baseDir, relativePath));
7749
9046
  return new _GeminiCliRule({
7750
9047
  baseDir,
7751
9048
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -7778,6 +9075,23 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7778
9075
  validate() {
7779
9076
  return { success: true, error: null };
7780
9077
  }
9078
+ static forDeletion({
9079
+ baseDir = process.cwd(),
9080
+ relativeDirPath,
9081
+ relativeFilePath,
9082
+ global = false
9083
+ }) {
9084
+ const paths = this.getSettablePaths({ global });
9085
+ const isRoot = relativeFilePath === paths.root.relativeFilePath;
9086
+ return new _GeminiCliRule({
9087
+ baseDir,
9088
+ relativeDirPath,
9089
+ relativeFilePath,
9090
+ fileContent: "",
9091
+ validate: false,
9092
+ root: isRoot
9093
+ });
9094
+ }
7781
9095
  static isTargetedByRulesyncRule(rulesyncRule) {
7782
9096
  return this.isTargetedByRulesyncRuleDefault({
7783
9097
  rulesyncRule,
@@ -7787,7 +9101,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
7787
9101
  };
7788
9102
 
7789
9103
  // src/features/rules/junie-rule.ts
7790
- var import_node_path77 = require("path");
9104
+ var import_node_path78 = require("path");
7791
9105
  var JunieRule = class _JunieRule extends ToolRule {
7792
9106
  static getSettablePaths() {
7793
9107
  return {
@@ -7796,7 +9110,7 @@ var JunieRule = class _JunieRule extends ToolRule {
7796
9110
  relativeFilePath: "guidelines.md"
7797
9111
  },
7798
9112
  nonRoot: {
7799
- relativeDirPath: (0, import_node_path77.join)(".junie", "memories")
9113
+ relativeDirPath: (0, import_node_path78.join)(".junie", "memories")
7800
9114
  }
7801
9115
  };
7802
9116
  }
@@ -7806,8 +9120,8 @@ var JunieRule = class _JunieRule extends ToolRule {
7806
9120
  validate = true
7807
9121
  }) {
7808
9122
  const isRoot = relativeFilePath === "guidelines.md";
7809
- const relativePath = isRoot ? "guidelines.md" : (0, import_node_path77.join)(".junie", "memories", relativeFilePath);
7810
- const fileContent = await readFileContent((0, import_node_path77.join)(baseDir, relativePath));
9123
+ const relativePath = isRoot ? "guidelines.md" : (0, import_node_path78.join)(".junie", "memories", relativeFilePath);
9124
+ const fileContent = await readFileContent((0, import_node_path78.join)(baseDir, relativePath));
7811
9125
  return new _JunieRule({
7812
9126
  baseDir,
7813
9127
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -7838,6 +9152,21 @@ var JunieRule = class _JunieRule extends ToolRule {
7838
9152
  validate() {
7839
9153
  return { success: true, error: null };
7840
9154
  }
9155
+ static forDeletion({
9156
+ baseDir = process.cwd(),
9157
+ relativeDirPath,
9158
+ relativeFilePath
9159
+ }) {
9160
+ const isRoot = relativeFilePath === "guidelines.md";
9161
+ return new _JunieRule({
9162
+ baseDir,
9163
+ relativeDirPath,
9164
+ relativeFilePath,
9165
+ fileContent: "",
9166
+ validate: false,
9167
+ root: isRoot
9168
+ });
9169
+ }
7841
9170
  static isTargetedByRulesyncRule(rulesyncRule) {
7842
9171
  return this.isTargetedByRulesyncRuleDefault({
7843
9172
  rulesyncRule,
@@ -7847,12 +9176,12 @@ var JunieRule = class _JunieRule extends ToolRule {
7847
9176
  };
7848
9177
 
7849
9178
  // src/features/rules/kiro-rule.ts
7850
- var import_node_path78 = require("path");
9179
+ var import_node_path79 = require("path");
7851
9180
  var KiroRule = class _KiroRule extends ToolRule {
7852
9181
  static getSettablePaths() {
7853
9182
  return {
7854
9183
  nonRoot: {
7855
- relativeDirPath: (0, import_node_path78.join)(".kiro", "steering")
9184
+ relativeDirPath: (0, import_node_path79.join)(".kiro", "steering")
7856
9185
  }
7857
9186
  };
7858
9187
  }
@@ -7862,7 +9191,7 @@ var KiroRule = class _KiroRule extends ToolRule {
7862
9191
  validate = true
7863
9192
  }) {
7864
9193
  const fileContent = await readFileContent(
7865
- (0, import_node_path78.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
9194
+ (0, import_node_path79.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7866
9195
  );
7867
9196
  return new _KiroRule({
7868
9197
  baseDir,
@@ -7893,6 +9222,20 @@ var KiroRule = class _KiroRule extends ToolRule {
7893
9222
  validate() {
7894
9223
  return { success: true, error: null };
7895
9224
  }
9225
+ static forDeletion({
9226
+ baseDir = process.cwd(),
9227
+ relativeDirPath,
9228
+ relativeFilePath
9229
+ }) {
9230
+ return new _KiroRule({
9231
+ baseDir,
9232
+ relativeDirPath,
9233
+ relativeFilePath,
9234
+ fileContent: "",
9235
+ validate: false,
9236
+ root: false
9237
+ });
9238
+ }
7896
9239
  static isTargetedByRulesyncRule(rulesyncRule) {
7897
9240
  return this.isTargetedByRulesyncRuleDefault({
7898
9241
  rulesyncRule,
@@ -7902,7 +9245,7 @@ var KiroRule = class _KiroRule extends ToolRule {
7902
9245
  };
7903
9246
 
7904
9247
  // src/features/rules/opencode-rule.ts
7905
- var import_node_path79 = require("path");
9248
+ var import_node_path80 = require("path");
7906
9249
  var OpenCodeRule = class _OpenCodeRule extends ToolRule {
7907
9250
  static getSettablePaths() {
7908
9251
  return {
@@ -7911,7 +9254,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
7911
9254
  relativeFilePath: "AGENTS.md"
7912
9255
  },
7913
9256
  nonRoot: {
7914
- relativeDirPath: (0, import_node_path79.join)(".opencode", "memories")
9257
+ relativeDirPath: (0, import_node_path80.join)(".opencode", "memories")
7915
9258
  }
7916
9259
  };
7917
9260
  }
@@ -7921,8 +9264,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
7921
9264
  validate = true
7922
9265
  }) {
7923
9266
  const isRoot = relativeFilePath === "AGENTS.md";
7924
- const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path79.join)(".opencode", "memories", relativeFilePath);
7925
- const fileContent = await readFileContent((0, import_node_path79.join)(baseDir, relativePath));
9267
+ const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path80.join)(".opencode", "memories", relativeFilePath);
9268
+ const fileContent = await readFileContent((0, import_node_path80.join)(baseDir, relativePath));
7926
9269
  return new _OpenCodeRule({
7927
9270
  baseDir,
7928
9271
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -7953,6 +9296,21 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
7953
9296
  validate() {
7954
9297
  return { success: true, error: null };
7955
9298
  }
9299
+ static forDeletion({
9300
+ baseDir = process.cwd(),
9301
+ relativeDirPath,
9302
+ relativeFilePath
9303
+ }) {
9304
+ const isRoot = relativeFilePath === "AGENTS.md" && relativeDirPath === ".";
9305
+ return new _OpenCodeRule({
9306
+ baseDir,
9307
+ relativeDirPath,
9308
+ relativeFilePath,
9309
+ fileContent: "",
9310
+ validate: false,
9311
+ root: isRoot
9312
+ });
9313
+ }
7956
9314
  static isTargetedByRulesyncRule(rulesyncRule) {
7957
9315
  return this.isTargetedByRulesyncRuleDefault({
7958
9316
  rulesyncRule,
@@ -7962,7 +9320,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
7962
9320
  };
7963
9321
 
7964
9322
  // src/features/rules/qwencode-rule.ts
7965
- var import_node_path80 = require("path");
9323
+ var import_node_path81 = require("path");
7966
9324
  var QwencodeRule = class _QwencodeRule extends ToolRule {
7967
9325
  static getSettablePaths() {
7968
9326
  return {
@@ -7971,7 +9329,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
7971
9329
  relativeFilePath: "QWEN.md"
7972
9330
  },
7973
9331
  nonRoot: {
7974
- relativeDirPath: (0, import_node_path80.join)(".qwen", "memories")
9332
+ relativeDirPath: (0, import_node_path81.join)(".qwen", "memories")
7975
9333
  }
7976
9334
  };
7977
9335
  }
@@ -7981,8 +9339,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
7981
9339
  validate = true
7982
9340
  }) {
7983
9341
  const isRoot = relativeFilePath === "QWEN.md";
7984
- const relativePath = isRoot ? "QWEN.md" : (0, import_node_path80.join)(".qwen", "memories", relativeFilePath);
7985
- const fileContent = await readFileContent((0, import_node_path80.join)(baseDir, relativePath));
9342
+ const relativePath = isRoot ? "QWEN.md" : (0, import_node_path81.join)(".qwen", "memories", relativeFilePath);
9343
+ const fileContent = await readFileContent((0, import_node_path81.join)(baseDir, relativePath));
7986
9344
  return new _QwencodeRule({
7987
9345
  baseDir,
7988
9346
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -8010,6 +9368,21 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
8010
9368
  validate() {
8011
9369
  return { success: true, error: null };
8012
9370
  }
9371
+ static forDeletion({
9372
+ baseDir = process.cwd(),
9373
+ relativeDirPath,
9374
+ relativeFilePath
9375
+ }) {
9376
+ const isRoot = relativeFilePath === "QWEN.md" && relativeDirPath === ".";
9377
+ return new _QwencodeRule({
9378
+ baseDir,
9379
+ relativeDirPath,
9380
+ relativeFilePath,
9381
+ fileContent: "",
9382
+ validate: false,
9383
+ root: isRoot
9384
+ });
9385
+ }
8013
9386
  static isTargetedByRulesyncRule(rulesyncRule) {
8014
9387
  return this.isTargetedByRulesyncRuleDefault({
8015
9388
  rulesyncRule,
@@ -8019,12 +9392,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
8019
9392
  };
8020
9393
 
8021
9394
  // src/features/rules/roo-rule.ts
8022
- var import_node_path81 = require("path");
9395
+ var import_node_path82 = require("path");
8023
9396
  var RooRule = class _RooRule extends ToolRule {
8024
9397
  static getSettablePaths() {
8025
9398
  return {
8026
9399
  nonRoot: {
8027
- relativeDirPath: (0, import_node_path81.join)(".roo", "rules")
9400
+ relativeDirPath: (0, import_node_path82.join)(".roo", "rules")
8028
9401
  }
8029
9402
  };
8030
9403
  }
@@ -8034,7 +9407,7 @@ var RooRule = class _RooRule extends ToolRule {
8034
9407
  validate = true
8035
9408
  }) {
8036
9409
  const fileContent = await readFileContent(
8037
- (0, import_node_path81.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
9410
+ (0, import_node_path82.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
8038
9411
  );
8039
9412
  return new _RooRule({
8040
9413
  baseDir,
@@ -8080,6 +9453,20 @@ var RooRule = class _RooRule extends ToolRule {
8080
9453
  validate() {
8081
9454
  return { success: true, error: null };
8082
9455
  }
9456
+ static forDeletion({
9457
+ baseDir = process.cwd(),
9458
+ relativeDirPath,
9459
+ relativeFilePath
9460
+ }) {
9461
+ return new _RooRule({
9462
+ baseDir,
9463
+ relativeDirPath,
9464
+ relativeFilePath,
9465
+ fileContent: "",
9466
+ validate: false,
9467
+ root: false
9468
+ });
9469
+ }
8083
9470
  static isTargetedByRulesyncRule(rulesyncRule) {
8084
9471
  return this.isTargetedByRulesyncRuleDefault({
8085
9472
  rulesyncRule,
@@ -8089,7 +9476,7 @@ var RooRule = class _RooRule extends ToolRule {
8089
9476
  };
8090
9477
 
8091
9478
  // src/features/rules/warp-rule.ts
8092
- var import_node_path82 = require("path");
9479
+ var import_node_path83 = require("path");
8093
9480
  var WarpRule = class _WarpRule extends ToolRule {
8094
9481
  constructor({ fileContent, root, ...rest }) {
8095
9482
  super({
@@ -8105,7 +9492,7 @@ var WarpRule = class _WarpRule extends ToolRule {
8105
9492
  relativeFilePath: "WARP.md"
8106
9493
  },
8107
9494
  nonRoot: {
8108
- relativeDirPath: (0, import_node_path82.join)(".warp", "memories")
9495
+ relativeDirPath: (0, import_node_path83.join)(".warp", "memories")
8109
9496
  }
8110
9497
  };
8111
9498
  }
@@ -8115,8 +9502,8 @@ var WarpRule = class _WarpRule extends ToolRule {
8115
9502
  validate = true
8116
9503
  }) {
8117
9504
  const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
8118
- const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path82.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
8119
- const fileContent = await readFileContent((0, import_node_path82.join)(baseDir, relativePath));
9505
+ const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path83.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
9506
+ const fileContent = await readFileContent((0, import_node_path83.join)(baseDir, relativePath));
8120
9507
  return new _WarpRule({
8121
9508
  baseDir,
8122
9509
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
@@ -8147,6 +9534,21 @@ var WarpRule = class _WarpRule extends ToolRule {
8147
9534
  validate() {
8148
9535
  return { success: true, error: null };
8149
9536
  }
9537
+ static forDeletion({
9538
+ baseDir = process.cwd(),
9539
+ relativeDirPath,
9540
+ relativeFilePath
9541
+ }) {
9542
+ const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
9543
+ return new _WarpRule({
9544
+ baseDir,
9545
+ relativeDirPath,
9546
+ relativeFilePath,
9547
+ fileContent: "",
9548
+ validate: false,
9549
+ root: isRoot
9550
+ });
9551
+ }
8150
9552
  static isTargetedByRulesyncRule(rulesyncRule) {
8151
9553
  return this.isTargetedByRulesyncRuleDefault({
8152
9554
  rulesyncRule,
@@ -8156,12 +9558,12 @@ var WarpRule = class _WarpRule extends ToolRule {
8156
9558
  };
8157
9559
 
8158
9560
  // src/features/rules/windsurf-rule.ts
8159
- var import_node_path83 = require("path");
9561
+ var import_node_path84 = require("path");
8160
9562
  var WindsurfRule = class _WindsurfRule extends ToolRule {
8161
9563
  static getSettablePaths() {
8162
9564
  return {
8163
9565
  nonRoot: {
8164
- relativeDirPath: (0, import_node_path83.join)(".windsurf", "rules")
9566
+ relativeDirPath: (0, import_node_path84.join)(".windsurf", "rules")
8165
9567
  }
8166
9568
  };
8167
9569
  }
@@ -8171,7 +9573,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
8171
9573
  validate = true
8172
9574
  }) {
8173
9575
  const fileContent = await readFileContent(
8174
- (0, import_node_path83.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
9576
+ (0, import_node_path84.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
8175
9577
  );
8176
9578
  return new _WindsurfRule({
8177
9579
  baseDir,
@@ -8201,6 +9603,19 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
8201
9603
  validate() {
8202
9604
  return { success: true, error: null };
8203
9605
  }
9606
+ static forDeletion({
9607
+ baseDir = process.cwd(),
9608
+ relativeDirPath,
9609
+ relativeFilePath
9610
+ }) {
9611
+ return new _WindsurfRule({
9612
+ baseDir,
9613
+ relativeDirPath,
9614
+ relativeFilePath,
9615
+ fileContent: "",
9616
+ validate: false
9617
+ });
9618
+ }
8204
9619
  static isTargetedByRulesyncRule(rulesyncRule) {
8205
9620
  return this.isTargetedByRulesyncRuleDefault({
8206
9621
  rulesyncRule,
@@ -8231,7 +9646,7 @@ var rulesProcessorToolTargets = [
8231
9646
  "warp",
8232
9647
  "windsurf"
8233
9648
  ];
8234
- var RulesProcessorToolTargetSchema = import_mini34.z.enum(rulesProcessorToolTargets);
9649
+ var RulesProcessorToolTargetSchema = import_mini37.z.enum(rulesProcessorToolTargets);
8235
9650
  var toolRuleFactories = /* @__PURE__ */ new Map([
8236
9651
  [
8237
9652
  "agentsmd",
@@ -8307,8 +9722,7 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
8307
9722
  supportsGlobal: true,
8308
9723
  ruleDiscoveryMode: "toon",
8309
9724
  additionalConventions: {
8310
- subagents: { subagentClass: CodexCliSubagent },
8311
- skills: { skillClass: CodexCliSkill, globalOnly: true }
9725
+ subagents: { subagentClass: CodexCliSubagent }
8312
9726
  }
8313
9727
  }
8314
9728
  }
@@ -8320,12 +9734,7 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
8320
9734
  meta: {
8321
9735
  extension: "md",
8322
9736
  supportsGlobal: false,
8323
- ruleDiscoveryMode: "auto",
8324
- additionalConventions: {
8325
- commands: { commandClass: CopilotCommand },
8326
- subagents: { subagentClass: CopilotSubagent },
8327
- skills: { skillClass: CopilotSkill }
8328
- }
9737
+ ruleDiscoveryMode: "auto"
8329
9738
  }
8330
9739
  }
8331
9740
  ],
@@ -8338,7 +9747,6 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
8338
9747
  supportsGlobal: false,
8339
9748
  ruleDiscoveryMode: "auto",
8340
9749
  additionalConventions: {
8341
- commands: { commandClass: CursorCommand },
8342
9750
  subagents: { subagentClass: CursorSubagent },
8343
9751
  skills: { skillClass: CursorSkill }
8344
9752
  },
@@ -8355,7 +9763,6 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
8355
9763
  supportsGlobal: true,
8356
9764
  ruleDiscoveryMode: "toon",
8357
9765
  additionalConventions: {
8358
- commands: { commandClass: GeminiCliCommand },
8359
9766
  subagents: { subagentClass: GeminiCliSubagent },
8360
9767
  skills: { skillClass: GeminiCliSkill }
8361
9768
  }
@@ -8399,7 +9806,6 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
8399
9806
  supportsGlobal: false,
8400
9807
  ruleDiscoveryMode: "auto",
8401
9808
  additionalConventions: {
8402
- commands: { commandClass: RooCommand },
8403
9809
  subagents: { subagentClass: RooSubagent }
8404
9810
  },
8405
9811
  createsSeparateConventionsRule: true
@@ -8525,7 +9931,7 @@ var RulesProcessor = class extends FeatureProcessor {
8525
9931
  }).relativeDirPath;
8526
9932
  return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
8527
9933
  const frontmatter = skill.getFrontmatter();
8528
- const relativePath = (0, import_node_path84.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
9934
+ const relativePath = (0, import_node_path85.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
8529
9935
  return {
8530
9936
  name: frontmatter.name,
8531
9937
  description: frontmatter.description,
@@ -8592,10 +9998,10 @@ var RulesProcessor = class extends FeatureProcessor {
8592
9998
  * Load and parse rulesync rule files from .rulesync/rules/ directory
8593
9999
  */
8594
10000
  async loadRulesyncFiles() {
8595
- const files = await findFilesByGlobs((0, import_node_path84.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
10001
+ const files = await findFilesByGlobs((0, import_node_path85.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
8596
10002
  logger.debug(`Found ${files.length} rulesync files`);
8597
10003
  const rulesyncRules = await Promise.all(
8598
- files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path84.basename)(file) }))
10004
+ files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path85.basename)(file) }))
8599
10005
  );
8600
10006
  const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
8601
10007
  if (rootRules.length > 1) {
@@ -8612,12 +10018,19 @@ var RulesProcessor = class extends FeatureProcessor {
8612
10018
  }
8613
10019
  return rulesyncRules;
8614
10020
  }
10021
+ async loadRulesyncFilesLegacy() {
10022
+ const legacyFiles = await findFilesByGlobs((0, import_node_path85.join)(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
10023
+ logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
10024
+ return Promise.all(
10025
+ legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path85.basename)(file) }))
10026
+ );
10027
+ }
8615
10028
  /**
8616
10029
  * Implementation of abstract method from FeatureProcessor
8617
10030
  * Load tool-specific rule configurations and parse them into ToolRule instances
8618
10031
  */
8619
10032
  async loadToolFiles({
8620
- forDeletion: _forDeletion = false
10033
+ forDeletion = false
8621
10034
  } = {}) {
8622
10035
  try {
8623
10036
  const factory = this.getFactory(this.toolTarget);
@@ -8627,17 +10040,27 @@ var RulesProcessor = class extends FeatureProcessor {
8627
10040
  return [];
8628
10041
  }
8629
10042
  const rootFilePaths = await findFilesByGlobs(
8630
- (0, import_node_path84.join)(
10043
+ (0, import_node_path85.join)(
8631
10044
  this.baseDir,
8632
10045
  settablePaths.root.relativeDirPath ?? ".",
8633
10046
  settablePaths.root.relativeFilePath
8634
10047
  )
8635
10048
  );
10049
+ if (forDeletion) {
10050
+ return rootFilePaths.map(
10051
+ (filePath) => factory.class.forDeletion({
10052
+ baseDir: this.baseDir,
10053
+ relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
10054
+ relativeFilePath: (0, import_node_path85.basename)(filePath),
10055
+ global: this.global
10056
+ })
10057
+ ).filter((rule) => rule.isDeletable());
10058
+ }
8636
10059
  return await Promise.all(
8637
10060
  rootFilePaths.map(
8638
10061
  (filePath) => factory.class.fromFile({
8639
10062
  baseDir: this.baseDir,
8640
- relativeFilePath: (0, import_node_path84.basename)(filePath),
10063
+ relativeFilePath: (0, import_node_path85.basename)(filePath),
8641
10064
  global: this.global
8642
10065
  })
8643
10066
  )
@@ -8649,13 +10072,23 @@ var RulesProcessor = class extends FeatureProcessor {
8649
10072
  return [];
8650
10073
  }
8651
10074
  const nonRootFilePaths = await findFilesByGlobs(
8652
- (0, import_node_path84.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
10075
+ (0, import_node_path85.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
8653
10076
  );
10077
+ if (forDeletion) {
10078
+ return nonRootFilePaths.map(
10079
+ (filePath) => factory.class.forDeletion({
10080
+ baseDir: this.baseDir,
10081
+ relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
10082
+ relativeFilePath: (0, import_node_path85.basename)(filePath),
10083
+ global: this.global
10084
+ })
10085
+ ).filter((rule) => rule.isDeletable());
10086
+ }
8654
10087
  return await Promise.all(
8655
10088
  nonRootFilePaths.map(
8656
10089
  (filePath) => factory.class.fromFile({
8657
10090
  baseDir: this.baseDir,
8658
- relativeFilePath: (0, import_node_path84.basename)(filePath),
10091
+ relativeFilePath: (0, import_node_path85.basename)(filePath),
8659
10092
  global: this.global
8660
10093
  })
8661
10094
  )
@@ -8748,14 +10181,14 @@ s/<command> [arguments]
8748
10181
  This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
8749
10182
  The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
8750
10183
 
8751
- When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path84.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
10184
+ When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path85.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
8752
10185
  const subagentsSection = subagents ? `## Simulated Subagents
8753
10186
 
8754
10187
  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.
8755
10188
 
8756
- When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path84.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
10189
+ When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path85.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
8757
10190
 
8758
- For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path84.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
10191
+ For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path85.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
8759
10192
  const skillsSection = skills ? this.generateSkillsSection(skills) : "";
8760
10193
  const result = [
8761
10194
  overview,
@@ -9037,7 +10470,7 @@ async function generateSkills(config) {
9037
10470
  }
9038
10471
 
9039
10472
  // src/cli/commands/gitignore.ts
9040
- var import_node_path85 = require("path");
10473
+ var import_node_path86 = require("path");
9041
10474
  var RULESYNC_HEADER = "# Generated by Rulesync";
9042
10475
  var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
9043
10476
  var RULESYNC_IGNORE_ENTRIES = [
@@ -9082,7 +10515,7 @@ var RULESYNC_IGNORE_ENTRIES = [
9082
10515
  "**/.github/copilot-instructions.md",
9083
10516
  "**/.github/instructions/",
9084
10517
  "**/.github/prompts/",
9085
- "**/.github/subagents/",
10518
+ "**/.github/agents/",
9086
10519
  "**/.github/skills/",
9087
10520
  "**/.vscode/mcp.json",
9088
10521
  // Junie
@@ -9094,6 +10527,7 @@ var RULESYNC_IGNORE_ENTRIES = [
9094
10527
  // OpenCode
9095
10528
  "**/.opencode/memories/",
9096
10529
  "**/.opencode/command/",
10530
+ "**/.opencode/skills/",
9097
10531
  "**/opencode.json",
9098
10532
  // Qwen
9099
10533
  "**/QWEN.md",
@@ -9160,7 +10594,7 @@ var removeExistingRulesyncEntries = (content) => {
9160
10594
  return result;
9161
10595
  };
9162
10596
  var gitignoreCommand = async () => {
9163
- const gitignorePath = (0, import_node_path85.join)(process.cwd(), ".gitignore");
10597
+ const gitignorePath = (0, import_node_path86.join)(process.cwd(), ".gitignore");
9164
10598
  let gitignoreContent = "";
9165
10599
  if (await fileExists(gitignorePath)) {
9166
10600
  gitignoreContent = await readFileContent(gitignorePath);
@@ -9359,7 +10793,7 @@ async function importSkills(config, tool) {
9359
10793
  }
9360
10794
 
9361
10795
  // src/cli/commands/init.ts
9362
- var import_node_path86 = require("path");
10796
+ var import_node_path87 = require("path");
9363
10797
  async function initCommand() {
9364
10798
  logger.info("Initializing rulesync...");
9365
10799
  await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
@@ -9522,14 +10956,14 @@ Attention, again, you are just the planner, so though you can read any files and
9522
10956
  await ensureDir(commandPaths.relativeDirPath);
9523
10957
  await ensureDir(subagentPaths.relativeDirPath);
9524
10958
  await ensureDir(ignorePaths.recommended.relativeDirPath);
9525
- const ruleFilepath = (0, import_node_path86.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
10959
+ const ruleFilepath = (0, import_node_path87.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
9526
10960
  if (!await fileExists(ruleFilepath)) {
9527
10961
  await writeFileContent(ruleFilepath, sampleRuleFile.content);
9528
10962
  logger.success(`Created ${ruleFilepath}`);
9529
10963
  } else {
9530
10964
  logger.info(`Skipped ${ruleFilepath} (already exists)`);
9531
10965
  }
9532
- const mcpFilepath = (0, import_node_path86.join)(
10966
+ const mcpFilepath = (0, import_node_path87.join)(
9533
10967
  mcpPaths.recommended.relativeDirPath,
9534
10968
  mcpPaths.recommended.relativeFilePath
9535
10969
  );
@@ -9539,21 +10973,21 @@ Attention, again, you are just the planner, so though you can read any files and
9539
10973
  } else {
9540
10974
  logger.info(`Skipped ${mcpFilepath} (already exists)`);
9541
10975
  }
9542
- const commandFilepath = (0, import_node_path86.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
10976
+ const commandFilepath = (0, import_node_path87.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
9543
10977
  if (!await fileExists(commandFilepath)) {
9544
10978
  await writeFileContent(commandFilepath, sampleCommandFile.content);
9545
10979
  logger.success(`Created ${commandFilepath}`);
9546
10980
  } else {
9547
10981
  logger.info(`Skipped ${commandFilepath} (already exists)`);
9548
10982
  }
9549
- const subagentFilepath = (0, import_node_path86.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
10983
+ const subagentFilepath = (0, import_node_path87.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
9550
10984
  if (!await fileExists(subagentFilepath)) {
9551
10985
  await writeFileContent(subagentFilepath, sampleSubagentFile.content);
9552
10986
  logger.success(`Created ${subagentFilepath}`);
9553
10987
  } else {
9554
10988
  logger.info(`Skipped ${subagentFilepath} (already exists)`);
9555
10989
  }
9556
- const ignoreFilepath = (0, import_node_path86.join)(
10990
+ const ignoreFilepath = (0, import_node_path87.join)(
9557
10991
  ignorePaths.recommended.relativeDirPath,
9558
10992
  ignorePaths.recommended.relativeFilePath
9559
10993
  );
@@ -9569,12 +11003,12 @@ Attention, again, you are just the planner, so though you can read any files and
9569
11003
  var import_fastmcp = require("fastmcp");
9570
11004
 
9571
11005
  // src/mcp/commands.ts
9572
- var import_node_path87 = require("path");
9573
- var import_mini35 = require("zod/mini");
11006
+ var import_node_path88 = require("path");
11007
+ var import_mini38 = require("zod/mini");
9574
11008
  var maxCommandSizeBytes = 1024 * 1024;
9575
11009
  var maxCommandsCount = 1e3;
9576
11010
  async function listCommands() {
9577
- const commandsDir = (0, import_node_path87.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
11011
+ const commandsDir = (0, import_node_path88.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
9578
11012
  try {
9579
11013
  const files = await listDirectoryFiles(commandsDir);
9580
11014
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -9586,7 +11020,7 @@ async function listCommands() {
9586
11020
  });
9587
11021
  const frontmatter = command.getFrontmatter();
9588
11022
  return {
9589
- relativePathFromCwd: (0, import_node_path87.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
11023
+ relativePathFromCwd: (0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
9590
11024
  frontmatter
9591
11025
  };
9592
11026
  } catch (error) {
@@ -9606,13 +11040,13 @@ async function getCommand({ relativePathFromCwd }) {
9606
11040
  relativePath: relativePathFromCwd,
9607
11041
  intendedRootDir: process.cwd()
9608
11042
  });
9609
- const filename = (0, import_node_path87.basename)(relativePathFromCwd);
11043
+ const filename = (0, import_node_path88.basename)(relativePathFromCwd);
9610
11044
  try {
9611
11045
  const command = await RulesyncCommand.fromFile({
9612
11046
  relativeFilePath: filename
9613
11047
  });
9614
11048
  return {
9615
- relativePathFromCwd: (0, import_node_path87.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
11049
+ relativePathFromCwd: (0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
9616
11050
  frontmatter: command.getFrontmatter(),
9617
11051
  body: command.getBody()
9618
11052
  };
@@ -9631,7 +11065,7 @@ async function putCommand({
9631
11065
  relativePath: relativePathFromCwd,
9632
11066
  intendedRootDir: process.cwd()
9633
11067
  });
9634
- const filename = (0, import_node_path87.basename)(relativePathFromCwd);
11068
+ const filename = (0, import_node_path88.basename)(relativePathFromCwd);
9635
11069
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
9636
11070
  if (estimatedSize > maxCommandSizeBytes) {
9637
11071
  throw new Error(
@@ -9641,7 +11075,7 @@ async function putCommand({
9641
11075
  try {
9642
11076
  const existingCommands = await listCommands();
9643
11077
  const isUpdate = existingCommands.some(
9644
- (command2) => command2.relativePathFromCwd === (0, import_node_path87.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
11078
+ (command2) => command2.relativePathFromCwd === (0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
9645
11079
  );
9646
11080
  if (!isUpdate && existingCommands.length >= maxCommandsCount) {
9647
11081
  throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
@@ -9656,11 +11090,11 @@ async function putCommand({
9656
11090
  fileContent,
9657
11091
  validate: true
9658
11092
  });
9659
- const commandsDir = (0, import_node_path87.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
11093
+ const commandsDir = (0, import_node_path88.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
9660
11094
  await ensureDir(commandsDir);
9661
11095
  await writeFileContent(command.getFilePath(), command.getFileContent());
9662
11096
  return {
9663
- relativePathFromCwd: (0, import_node_path87.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
11097
+ relativePathFromCwd: (0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
9664
11098
  frontmatter: command.getFrontmatter(),
9665
11099
  body: command.getBody()
9666
11100
  };
@@ -9675,12 +11109,12 @@ async function deleteCommand({ relativePathFromCwd }) {
9675
11109
  relativePath: relativePathFromCwd,
9676
11110
  intendedRootDir: process.cwd()
9677
11111
  });
9678
- const filename = (0, import_node_path87.basename)(relativePathFromCwd);
9679
- const fullPath = (0, import_node_path87.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
11112
+ const filename = (0, import_node_path88.basename)(relativePathFromCwd);
11113
+ const fullPath = (0, import_node_path88.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
9680
11114
  try {
9681
11115
  await removeFile(fullPath);
9682
11116
  return {
9683
- relativePathFromCwd: (0, import_node_path87.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
11117
+ relativePathFromCwd: (0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
9684
11118
  };
9685
11119
  } catch (error) {
9686
11120
  throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
@@ -9689,23 +11123,23 @@ async function deleteCommand({ relativePathFromCwd }) {
9689
11123
  }
9690
11124
  }
9691
11125
  var commandToolSchemas = {
9692
- listCommands: import_mini35.z.object({}),
9693
- getCommand: import_mini35.z.object({
9694
- relativePathFromCwd: import_mini35.z.string()
11126
+ listCommands: import_mini38.z.object({}),
11127
+ getCommand: import_mini38.z.object({
11128
+ relativePathFromCwd: import_mini38.z.string()
9695
11129
  }),
9696
- putCommand: import_mini35.z.object({
9697
- relativePathFromCwd: import_mini35.z.string(),
11130
+ putCommand: import_mini38.z.object({
11131
+ relativePathFromCwd: import_mini38.z.string(),
9698
11132
  frontmatter: RulesyncCommandFrontmatterSchema,
9699
- body: import_mini35.z.string()
11133
+ body: import_mini38.z.string()
9700
11134
  }),
9701
- deleteCommand: import_mini35.z.object({
9702
- relativePathFromCwd: import_mini35.z.string()
11135
+ deleteCommand: import_mini38.z.object({
11136
+ relativePathFromCwd: import_mini38.z.string()
9703
11137
  })
9704
11138
  };
9705
11139
  var commandTools = {
9706
11140
  listCommands: {
9707
11141
  name: "listCommands",
9708
- description: `List all commands from ${(0, import_node_path87.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
11142
+ description: `List all commands from ${(0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
9709
11143
  parameters: commandToolSchemas.listCommands,
9710
11144
  execute: async () => {
9711
11145
  const commands = await listCommands();
@@ -9747,11 +11181,11 @@ var commandTools = {
9747
11181
  };
9748
11182
 
9749
11183
  // src/mcp/ignore.ts
9750
- var import_node_path88 = require("path");
9751
- var import_mini36 = require("zod/mini");
11184
+ var import_node_path89 = require("path");
11185
+ var import_mini39 = require("zod/mini");
9752
11186
  var maxIgnoreFileSizeBytes = 100 * 1024;
9753
11187
  async function getIgnoreFile() {
9754
- const ignoreFilePath = (0, import_node_path88.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
11188
+ const ignoreFilePath = (0, import_node_path89.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
9755
11189
  try {
9756
11190
  const content = await readFileContent(ignoreFilePath);
9757
11191
  return {
@@ -9765,7 +11199,7 @@ async function getIgnoreFile() {
9765
11199
  }
9766
11200
  }
9767
11201
  async function putIgnoreFile({ content }) {
9768
- const ignoreFilePath = (0, import_node_path88.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
11202
+ const ignoreFilePath = (0, import_node_path89.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
9769
11203
  const contentSizeBytes = Buffer.byteLength(content, "utf8");
9770
11204
  if (contentSizeBytes > maxIgnoreFileSizeBytes) {
9771
11205
  throw new Error(
@@ -9786,8 +11220,8 @@ async function putIgnoreFile({ content }) {
9786
11220
  }
9787
11221
  }
9788
11222
  async function deleteIgnoreFile() {
9789
- const aiignorePath = (0, import_node_path88.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
9790
- const legacyIgnorePath = (0, import_node_path88.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
11223
+ const aiignorePath = (0, import_node_path89.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
11224
+ const legacyIgnorePath = (0, import_node_path89.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
9791
11225
  try {
9792
11226
  await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
9793
11227
  return {
@@ -9805,11 +11239,11 @@ async function deleteIgnoreFile() {
9805
11239
  }
9806
11240
  }
9807
11241
  var ignoreToolSchemas = {
9808
- getIgnoreFile: import_mini36.z.object({}),
9809
- putIgnoreFile: import_mini36.z.object({
9810
- content: import_mini36.z.string()
11242
+ getIgnoreFile: import_mini39.z.object({}),
11243
+ putIgnoreFile: import_mini39.z.object({
11244
+ content: import_mini39.z.string()
9811
11245
  }),
9812
- deleteIgnoreFile: import_mini36.z.object({})
11246
+ deleteIgnoreFile: import_mini39.z.object({})
9813
11247
  };
9814
11248
  var ignoreTools = {
9815
11249
  getIgnoreFile: {
@@ -9842,8 +11276,8 @@ var ignoreTools = {
9842
11276
  };
9843
11277
 
9844
11278
  // src/mcp/mcp.ts
9845
- var import_node_path89 = require("path");
9846
- var import_mini37 = require("zod/mini");
11279
+ var import_node_path90 = require("path");
11280
+ var import_mini40 = require("zod/mini");
9847
11281
  var maxMcpSizeBytes = 1024 * 1024;
9848
11282
  async function getMcpFile() {
9849
11283
  const config = await ConfigResolver.resolve({});
@@ -9852,7 +11286,7 @@ async function getMcpFile() {
9852
11286
  validate: true,
9853
11287
  modularMcp: config.getModularMcp()
9854
11288
  });
9855
- const relativePathFromCwd = (0, import_node_path89.join)(
11289
+ const relativePathFromCwd = (0, import_node_path90.join)(
9856
11290
  rulesyncMcp.getRelativeDirPath(),
9857
11291
  rulesyncMcp.getRelativeFilePath()
9858
11292
  );
@@ -9885,7 +11319,7 @@ async function putMcpFile({ content }) {
9885
11319
  const paths = RulesyncMcp.getSettablePaths();
9886
11320
  const relativeDirPath = paths.recommended.relativeDirPath;
9887
11321
  const relativeFilePath = paths.recommended.relativeFilePath;
9888
- const fullPath = (0, import_node_path89.join)(baseDir, relativeDirPath, relativeFilePath);
11322
+ const fullPath = (0, import_node_path90.join)(baseDir, relativeDirPath, relativeFilePath);
9889
11323
  const rulesyncMcp = new RulesyncMcp({
9890
11324
  baseDir,
9891
11325
  relativeDirPath,
@@ -9894,9 +11328,9 @@ async function putMcpFile({ content }) {
9894
11328
  validate: true,
9895
11329
  modularMcp: config.getModularMcp()
9896
11330
  });
9897
- await ensureDir((0, import_node_path89.join)(baseDir, relativeDirPath));
11331
+ await ensureDir((0, import_node_path90.join)(baseDir, relativeDirPath));
9898
11332
  await writeFileContent(fullPath, content);
9899
- const relativePathFromCwd = (0, import_node_path89.join)(relativeDirPath, relativeFilePath);
11333
+ const relativePathFromCwd = (0, import_node_path90.join)(relativeDirPath, relativeFilePath);
9900
11334
  return {
9901
11335
  relativePathFromCwd,
9902
11336
  content: rulesyncMcp.getFileContent()
@@ -9911,15 +11345,15 @@ async function deleteMcpFile() {
9911
11345
  try {
9912
11346
  const baseDir = process.cwd();
9913
11347
  const paths = RulesyncMcp.getSettablePaths();
9914
- const recommendedPath = (0, import_node_path89.join)(
11348
+ const recommendedPath = (0, import_node_path90.join)(
9915
11349
  baseDir,
9916
11350
  paths.recommended.relativeDirPath,
9917
11351
  paths.recommended.relativeFilePath
9918
11352
  );
9919
- const legacyPath = (0, import_node_path89.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
11353
+ const legacyPath = (0, import_node_path90.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
9920
11354
  await removeFile(recommendedPath);
9921
11355
  await removeFile(legacyPath);
9922
- const relativePathFromCwd = (0, import_node_path89.join)(
11356
+ const relativePathFromCwd = (0, import_node_path90.join)(
9923
11357
  paths.recommended.relativeDirPath,
9924
11358
  paths.recommended.relativeFilePath
9925
11359
  );
@@ -9933,11 +11367,11 @@ async function deleteMcpFile() {
9933
11367
  }
9934
11368
  }
9935
11369
  var mcpToolSchemas = {
9936
- getMcpFile: import_mini37.z.object({}),
9937
- putMcpFile: import_mini37.z.object({
9938
- content: import_mini37.z.string()
11370
+ getMcpFile: import_mini40.z.object({}),
11371
+ putMcpFile: import_mini40.z.object({
11372
+ content: import_mini40.z.string()
9939
11373
  }),
9940
- deleteMcpFile: import_mini37.z.object({})
11374
+ deleteMcpFile: import_mini40.z.object({})
9941
11375
  };
9942
11376
  var mcpTools = {
9943
11377
  getMcpFile: {
@@ -9970,12 +11404,12 @@ var mcpTools = {
9970
11404
  };
9971
11405
 
9972
11406
  // src/mcp/rules.ts
9973
- var import_node_path90 = require("path");
9974
- var import_mini38 = require("zod/mini");
11407
+ var import_node_path91 = require("path");
11408
+ var import_mini41 = require("zod/mini");
9975
11409
  var maxRuleSizeBytes = 1024 * 1024;
9976
11410
  var maxRulesCount = 1e3;
9977
11411
  async function listRules() {
9978
- const rulesDir = (0, import_node_path90.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
11412
+ const rulesDir = (0, import_node_path91.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
9979
11413
  try {
9980
11414
  const files = await listDirectoryFiles(rulesDir);
9981
11415
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -9988,7 +11422,7 @@ async function listRules() {
9988
11422
  });
9989
11423
  const frontmatter = rule.getFrontmatter();
9990
11424
  return {
9991
- relativePathFromCwd: (0, import_node_path90.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
11425
+ relativePathFromCwd: (0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
9992
11426
  frontmatter
9993
11427
  };
9994
11428
  } catch (error) {
@@ -10008,14 +11442,14 @@ async function getRule({ relativePathFromCwd }) {
10008
11442
  relativePath: relativePathFromCwd,
10009
11443
  intendedRootDir: process.cwd()
10010
11444
  });
10011
- const filename = (0, import_node_path90.basename)(relativePathFromCwd);
11445
+ const filename = (0, import_node_path91.basename)(relativePathFromCwd);
10012
11446
  try {
10013
11447
  const rule = await RulesyncRule.fromFile({
10014
11448
  relativeFilePath: filename,
10015
11449
  validate: true
10016
11450
  });
10017
11451
  return {
10018
- relativePathFromCwd: (0, import_node_path90.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
11452
+ relativePathFromCwd: (0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
10019
11453
  frontmatter: rule.getFrontmatter(),
10020
11454
  body: rule.getBody()
10021
11455
  };
@@ -10034,7 +11468,7 @@ async function putRule({
10034
11468
  relativePath: relativePathFromCwd,
10035
11469
  intendedRootDir: process.cwd()
10036
11470
  });
10037
- const filename = (0, import_node_path90.basename)(relativePathFromCwd);
11471
+ const filename = (0, import_node_path91.basename)(relativePathFromCwd);
10038
11472
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
10039
11473
  if (estimatedSize > maxRuleSizeBytes) {
10040
11474
  throw new Error(
@@ -10044,7 +11478,7 @@ async function putRule({
10044
11478
  try {
10045
11479
  const existingRules = await listRules();
10046
11480
  const isUpdate = existingRules.some(
10047
- (rule2) => rule2.relativePathFromCwd === (0, import_node_path90.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
11481
+ (rule2) => rule2.relativePathFromCwd === (0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
10048
11482
  );
10049
11483
  if (!isUpdate && existingRules.length >= maxRulesCount) {
10050
11484
  throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
@@ -10057,11 +11491,11 @@ async function putRule({
10057
11491
  body,
10058
11492
  validate: true
10059
11493
  });
10060
- const rulesDir = (0, import_node_path90.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
11494
+ const rulesDir = (0, import_node_path91.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
10061
11495
  await ensureDir(rulesDir);
10062
11496
  await writeFileContent(rule.getFilePath(), rule.getFileContent());
10063
11497
  return {
10064
- relativePathFromCwd: (0, import_node_path90.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
11498
+ relativePathFromCwd: (0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
10065
11499
  frontmatter: rule.getFrontmatter(),
10066
11500
  body: rule.getBody()
10067
11501
  };
@@ -10076,12 +11510,12 @@ async function deleteRule({ relativePathFromCwd }) {
10076
11510
  relativePath: relativePathFromCwd,
10077
11511
  intendedRootDir: process.cwd()
10078
11512
  });
10079
- const filename = (0, import_node_path90.basename)(relativePathFromCwd);
10080
- const fullPath = (0, import_node_path90.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
11513
+ const filename = (0, import_node_path91.basename)(relativePathFromCwd);
11514
+ const fullPath = (0, import_node_path91.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
10081
11515
  try {
10082
11516
  await removeFile(fullPath);
10083
11517
  return {
10084
- relativePathFromCwd: (0, import_node_path90.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
11518
+ relativePathFromCwd: (0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
10085
11519
  };
10086
11520
  } catch (error) {
10087
11521
  throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
@@ -10090,23 +11524,23 @@ async function deleteRule({ relativePathFromCwd }) {
10090
11524
  }
10091
11525
  }
10092
11526
  var ruleToolSchemas = {
10093
- listRules: import_mini38.z.object({}),
10094
- getRule: import_mini38.z.object({
10095
- relativePathFromCwd: import_mini38.z.string()
11527
+ listRules: import_mini41.z.object({}),
11528
+ getRule: import_mini41.z.object({
11529
+ relativePathFromCwd: import_mini41.z.string()
10096
11530
  }),
10097
- putRule: import_mini38.z.object({
10098
- relativePathFromCwd: import_mini38.z.string(),
11531
+ putRule: import_mini41.z.object({
11532
+ relativePathFromCwd: import_mini41.z.string(),
10099
11533
  frontmatter: RulesyncRuleFrontmatterSchema,
10100
- body: import_mini38.z.string()
11534
+ body: import_mini41.z.string()
10101
11535
  }),
10102
- deleteRule: import_mini38.z.object({
10103
- relativePathFromCwd: import_mini38.z.string()
11536
+ deleteRule: import_mini41.z.object({
11537
+ relativePathFromCwd: import_mini41.z.string()
10104
11538
  })
10105
11539
  };
10106
11540
  var ruleTools = {
10107
11541
  listRules: {
10108
11542
  name: "listRules",
10109
- description: `List all rules from ${(0, import_node_path90.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
11543
+ description: `List all rules from ${(0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
10110
11544
  parameters: ruleToolSchemas.listRules,
10111
11545
  execute: async () => {
10112
11546
  const rules = await listRules();
@@ -10148,8 +11582,8 @@ var ruleTools = {
10148
11582
  };
10149
11583
 
10150
11584
  // src/mcp/skills.ts
10151
- var import_node_path91 = require("path");
10152
- var import_mini39 = require("zod/mini");
11585
+ var import_node_path92 = require("path");
11586
+ var import_mini42 = require("zod/mini");
10153
11587
  var maxSkillSizeBytes = 1024 * 1024;
10154
11588
  var maxSkillsCount = 1e3;
10155
11589
  function aiDirFileToMcpSkillFile(file) {
@@ -10165,19 +11599,19 @@ function mcpSkillFileToAiDirFile(file) {
10165
11599
  };
10166
11600
  }
10167
11601
  function extractDirName(relativeDirPathFromCwd) {
10168
- const dirName = (0, import_node_path91.basename)(relativeDirPathFromCwd);
11602
+ const dirName = (0, import_node_path92.basename)(relativeDirPathFromCwd);
10169
11603
  if (!dirName) {
10170
11604
  throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
10171
11605
  }
10172
11606
  return dirName;
10173
11607
  }
10174
11608
  async function listSkills() {
10175
- const skillsDir = (0, import_node_path91.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
11609
+ const skillsDir = (0, import_node_path92.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
10176
11610
  try {
10177
- const skillDirPaths = await findFilesByGlobs((0, import_node_path91.join)(skillsDir, "*"), { type: "dir" });
11611
+ const skillDirPaths = await findFilesByGlobs((0, import_node_path92.join)(skillsDir, "*"), { type: "dir" });
10178
11612
  const skills = await Promise.all(
10179
11613
  skillDirPaths.map(async (dirPath) => {
10180
- const dirName = (0, import_node_path91.basename)(dirPath);
11614
+ const dirName = (0, import_node_path92.basename)(dirPath);
10181
11615
  if (!dirName) return null;
10182
11616
  try {
10183
11617
  const skill = await RulesyncSkill.fromDir({
@@ -10185,7 +11619,7 @@ async function listSkills() {
10185
11619
  });
10186
11620
  const frontmatter = skill.getFrontmatter();
10187
11621
  return {
10188
- relativeDirPathFromCwd: (0, import_node_path91.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
11622
+ relativeDirPathFromCwd: (0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
10189
11623
  frontmatter
10190
11624
  };
10191
11625
  } catch (error) {
@@ -10211,7 +11645,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
10211
11645
  dirName
10212
11646
  });
10213
11647
  return {
10214
- relativeDirPathFromCwd: (0, import_node_path91.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
11648
+ relativeDirPathFromCwd: (0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
10215
11649
  frontmatter: skill.getFrontmatter(),
10216
11650
  body: skill.getBody(),
10217
11651
  otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
@@ -10245,7 +11679,7 @@ async function putSkill({
10245
11679
  try {
10246
11680
  const existingSkills = await listSkills();
10247
11681
  const isUpdate = existingSkills.some(
10248
- (skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path91.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
11682
+ (skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
10249
11683
  );
10250
11684
  if (!isUpdate && existingSkills.length >= maxSkillsCount) {
10251
11685
  throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
@@ -10260,9 +11694,9 @@ async function putSkill({
10260
11694
  otherFiles: aiDirFiles,
10261
11695
  validate: true
10262
11696
  });
10263
- const skillDirPath = (0, import_node_path91.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
11697
+ const skillDirPath = (0, import_node_path92.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
10264
11698
  await ensureDir(skillDirPath);
10265
- const skillFilePath = (0, import_node_path91.join)(skillDirPath, SKILL_FILE_NAME);
11699
+ const skillFilePath = (0, import_node_path92.join)(skillDirPath, SKILL_FILE_NAME);
10266
11700
  const skillFileContent = stringifyFrontmatter(body, frontmatter);
10267
11701
  await writeFileContent(skillFilePath, skillFileContent);
10268
11702
  for (const file of otherFiles) {
@@ -10270,15 +11704,15 @@ async function putSkill({
10270
11704
  relativePath: file.name,
10271
11705
  intendedRootDir: skillDirPath
10272
11706
  });
10273
- const filePath = (0, import_node_path91.join)(skillDirPath, file.name);
10274
- const fileDir = (0, import_node_path91.join)(skillDirPath, (0, import_node_path91.dirname)(file.name));
11707
+ const filePath = (0, import_node_path92.join)(skillDirPath, file.name);
11708
+ const fileDir = (0, import_node_path92.join)(skillDirPath, (0, import_node_path92.dirname)(file.name));
10275
11709
  if (fileDir !== skillDirPath) {
10276
11710
  await ensureDir(fileDir);
10277
11711
  }
10278
11712
  await writeFileContent(filePath, file.body);
10279
11713
  }
10280
11714
  return {
10281
- relativeDirPathFromCwd: (0, import_node_path91.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
11715
+ relativeDirPathFromCwd: (0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
10282
11716
  frontmatter: skill.getFrontmatter(),
10283
11717
  body: skill.getBody(),
10284
11718
  otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
@@ -10300,13 +11734,13 @@ async function deleteSkill({
10300
11734
  intendedRootDir: process.cwd()
10301
11735
  });
10302
11736
  const dirName = extractDirName(relativeDirPathFromCwd);
10303
- const skillDirPath = (0, import_node_path91.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
11737
+ const skillDirPath = (0, import_node_path92.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
10304
11738
  try {
10305
11739
  if (await directoryExists(skillDirPath)) {
10306
11740
  await removeDirectory(skillDirPath);
10307
11741
  }
10308
11742
  return {
10309
- relativeDirPathFromCwd: (0, import_node_path91.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
11743
+ relativeDirPathFromCwd: (0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
10310
11744
  };
10311
11745
  } catch (error) {
10312
11746
  throw new Error(
@@ -10317,29 +11751,29 @@ async function deleteSkill({
10317
11751
  );
10318
11752
  }
10319
11753
  }
10320
- var McpSkillFileSchema = import_mini39.z.object({
10321
- name: import_mini39.z.string(),
10322
- body: import_mini39.z.string()
11754
+ var McpSkillFileSchema = import_mini42.z.object({
11755
+ name: import_mini42.z.string(),
11756
+ body: import_mini42.z.string()
10323
11757
  });
10324
11758
  var skillToolSchemas = {
10325
- listSkills: import_mini39.z.object({}),
10326
- getSkill: import_mini39.z.object({
10327
- relativeDirPathFromCwd: import_mini39.z.string()
11759
+ listSkills: import_mini42.z.object({}),
11760
+ getSkill: import_mini42.z.object({
11761
+ relativeDirPathFromCwd: import_mini42.z.string()
10328
11762
  }),
10329
- putSkill: import_mini39.z.object({
10330
- relativeDirPathFromCwd: import_mini39.z.string(),
11763
+ putSkill: import_mini42.z.object({
11764
+ relativeDirPathFromCwd: import_mini42.z.string(),
10331
11765
  frontmatter: RulesyncSkillFrontmatterSchema,
10332
- body: import_mini39.z.string(),
10333
- otherFiles: import_mini39.z.optional(import_mini39.z.array(McpSkillFileSchema))
11766
+ body: import_mini42.z.string(),
11767
+ otherFiles: import_mini42.z.optional(import_mini42.z.array(McpSkillFileSchema))
10334
11768
  }),
10335
- deleteSkill: import_mini39.z.object({
10336
- relativeDirPathFromCwd: import_mini39.z.string()
11769
+ deleteSkill: import_mini42.z.object({
11770
+ relativeDirPathFromCwd: import_mini42.z.string()
10337
11771
  })
10338
11772
  };
10339
11773
  var skillTools = {
10340
11774
  listSkills: {
10341
11775
  name: "listSkills",
10342
- description: `List all skills from ${(0, import_node_path91.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
11776
+ description: `List all skills from ${(0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
10343
11777
  parameters: skillToolSchemas.listSkills,
10344
11778
  execute: async () => {
10345
11779
  const skills = await listSkills();
@@ -10382,12 +11816,12 @@ var skillTools = {
10382
11816
  };
10383
11817
 
10384
11818
  // src/mcp/subagents.ts
10385
- var import_node_path92 = require("path");
10386
- var import_mini40 = require("zod/mini");
11819
+ var import_node_path93 = require("path");
11820
+ var import_mini43 = require("zod/mini");
10387
11821
  var maxSubagentSizeBytes = 1024 * 1024;
10388
11822
  var maxSubagentsCount = 1e3;
10389
11823
  async function listSubagents() {
10390
- const subagentsDir = (0, import_node_path92.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
11824
+ const subagentsDir = (0, import_node_path93.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
10391
11825
  try {
10392
11826
  const files = await listDirectoryFiles(subagentsDir);
10393
11827
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -10400,7 +11834,7 @@ async function listSubagents() {
10400
11834
  });
10401
11835
  const frontmatter = subagent.getFrontmatter();
10402
11836
  return {
10403
- relativePathFromCwd: (0, import_node_path92.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
11837
+ relativePathFromCwd: (0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
10404
11838
  frontmatter
10405
11839
  };
10406
11840
  } catch (error) {
@@ -10422,14 +11856,14 @@ async function getSubagent({ relativePathFromCwd }) {
10422
11856
  relativePath: relativePathFromCwd,
10423
11857
  intendedRootDir: process.cwd()
10424
11858
  });
10425
- const filename = (0, import_node_path92.basename)(relativePathFromCwd);
11859
+ const filename = (0, import_node_path93.basename)(relativePathFromCwd);
10426
11860
  try {
10427
11861
  const subagent = await RulesyncSubagent.fromFile({
10428
11862
  relativeFilePath: filename,
10429
11863
  validate: true
10430
11864
  });
10431
11865
  return {
10432
- relativePathFromCwd: (0, import_node_path92.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
11866
+ relativePathFromCwd: (0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
10433
11867
  frontmatter: subagent.getFrontmatter(),
10434
11868
  body: subagent.getBody()
10435
11869
  };
@@ -10448,7 +11882,7 @@ async function putSubagent({
10448
11882
  relativePath: relativePathFromCwd,
10449
11883
  intendedRootDir: process.cwd()
10450
11884
  });
10451
- const filename = (0, import_node_path92.basename)(relativePathFromCwd);
11885
+ const filename = (0, import_node_path93.basename)(relativePathFromCwd);
10452
11886
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
10453
11887
  if (estimatedSize > maxSubagentSizeBytes) {
10454
11888
  throw new Error(
@@ -10458,7 +11892,7 @@ async function putSubagent({
10458
11892
  try {
10459
11893
  const existingSubagents = await listSubagents();
10460
11894
  const isUpdate = existingSubagents.some(
10461
- (subagent2) => subagent2.relativePathFromCwd === (0, import_node_path92.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
11895
+ (subagent2) => subagent2.relativePathFromCwd === (0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
10462
11896
  );
10463
11897
  if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
10464
11898
  throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
@@ -10471,11 +11905,11 @@ async function putSubagent({
10471
11905
  body,
10472
11906
  validate: true
10473
11907
  });
10474
- const subagentsDir = (0, import_node_path92.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
11908
+ const subagentsDir = (0, import_node_path93.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
10475
11909
  await ensureDir(subagentsDir);
10476
11910
  await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
10477
11911
  return {
10478
- relativePathFromCwd: (0, import_node_path92.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
11912
+ relativePathFromCwd: (0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
10479
11913
  frontmatter: subagent.getFrontmatter(),
10480
11914
  body: subagent.getBody()
10481
11915
  };
@@ -10490,12 +11924,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
10490
11924
  relativePath: relativePathFromCwd,
10491
11925
  intendedRootDir: process.cwd()
10492
11926
  });
10493
- const filename = (0, import_node_path92.basename)(relativePathFromCwd);
10494
- const fullPath = (0, import_node_path92.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
11927
+ const filename = (0, import_node_path93.basename)(relativePathFromCwd);
11928
+ const fullPath = (0, import_node_path93.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
10495
11929
  try {
10496
11930
  await removeFile(fullPath);
10497
11931
  return {
10498
- relativePathFromCwd: (0, import_node_path92.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
11932
+ relativePathFromCwd: (0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
10499
11933
  };
10500
11934
  } catch (error) {
10501
11935
  throw new Error(
@@ -10507,23 +11941,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
10507
11941
  }
10508
11942
  }
10509
11943
  var subagentToolSchemas = {
10510
- listSubagents: import_mini40.z.object({}),
10511
- getSubagent: import_mini40.z.object({
10512
- relativePathFromCwd: import_mini40.z.string()
11944
+ listSubagents: import_mini43.z.object({}),
11945
+ getSubagent: import_mini43.z.object({
11946
+ relativePathFromCwd: import_mini43.z.string()
10513
11947
  }),
10514
- putSubagent: import_mini40.z.object({
10515
- relativePathFromCwd: import_mini40.z.string(),
11948
+ putSubagent: import_mini43.z.object({
11949
+ relativePathFromCwd: import_mini43.z.string(),
10516
11950
  frontmatter: RulesyncSubagentFrontmatterSchema,
10517
- body: import_mini40.z.string()
11951
+ body: import_mini43.z.string()
10518
11952
  }),
10519
- deleteSubagent: import_mini40.z.object({
10520
- relativePathFromCwd: import_mini40.z.string()
11953
+ deleteSubagent: import_mini43.z.object({
11954
+ relativePathFromCwd: import_mini43.z.string()
10521
11955
  })
10522
11956
  };
10523
11957
  var subagentTools = {
10524
11958
  listSubagents: {
10525
11959
  name: "listSubagents",
10526
- description: `List all subagents from ${(0, import_node_path92.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
11960
+ description: `List all subagents from ${(0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
10527
11961
  parameters: subagentToolSchemas.listSubagents,
10528
11962
  execute: async () => {
10529
11963
  const subagents = await listSubagents();
@@ -10601,7 +12035,7 @@ async function mcpCommand({ version }) {
10601
12035
  }
10602
12036
 
10603
12037
  // src/cli/index.ts
10604
- var getVersion = () => "4.0.1";
12038
+ var getVersion = () => "4.1.1";
10605
12039
  var main = async () => {
10606
12040
  const program = new import_commander.Command();
10607
12041
  const version = getVersion();