rulesync 3.33.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +4 -5
  2. package/dist/index.cjs +380 -228
  3. package/dist/index.js +432 -280
  4. package/package.json +15 -15
package/dist/index.js CHANGED
@@ -89,7 +89,8 @@ import { parse as parseJsonc } from "jsonc-parser";
89
89
  import { globSync } from "fs";
90
90
  import { mkdir, readdir, readFile, rm, stat, writeFile } from "fs/promises";
91
91
  import os from "os";
92
- import { basename, dirname, join, relative, resolve } from "path";
92
+ import { dirname, join, relative, resolve } from "path";
93
+ import { kebabCase } from "es-toolkit";
93
94
  async function ensureDir(dirPath) {
94
95
  try {
95
96
  await stat(dirPath);
@@ -217,6 +218,13 @@ function validateBaseDir(baseDir) {
217
218
  }
218
219
  checkPathTraversal({ relativePath: baseDir, intendedRootDir: process.cwd() });
219
220
  }
221
+ function toKebabCaseFilename(filename) {
222
+ const lastDotIndex = filename.lastIndexOf(".");
223
+ const extension = lastDotIndex > 0 ? filename.slice(lastDotIndex) : "";
224
+ const nameWithoutExt = lastDotIndex > 0 ? filename.slice(0, lastDotIndex) : filename;
225
+ const kebabName = kebabCase(nameWithoutExt);
226
+ return kebabName + extension;
227
+ }
220
228
 
221
229
  // src/config/config.ts
222
230
  import { optional, z as z3 } from "zod/mini";
@@ -261,11 +269,7 @@ var ConfigParamsSchema = z3.object({
261
269
  simulateCommands: optional(z3.boolean()),
262
270
  simulateSubagents: optional(z3.boolean()),
263
271
  simulateSkills: optional(z3.boolean()),
264
- modularMcp: optional(z3.boolean()),
265
- // Deprecated experimental options (for backward compatibility)
266
- experimentalGlobal: optional(z3.boolean()),
267
- experimentalSimulateCommands: optional(z3.boolean()),
268
- experimentalSimulateSubagents: optional(z3.boolean())
272
+ modularMcp: optional(z3.boolean())
269
273
  });
270
274
  var PartialConfigParamsSchema = z3.partial(ConfigParamsSchema);
271
275
  var ConfigFileSchema = z3.object({
@@ -299,10 +303,7 @@ var Config = class {
299
303
  simulateCommands,
300
304
  simulateSubagents,
301
305
  simulateSkills,
302
- modularMcp,
303
- experimentalGlobal,
304
- experimentalSimulateCommands,
305
- experimentalSimulateSubagents
306
+ modularMcp
306
307
  }) {
307
308
  this.validateConflictingTargets(targets);
308
309
  this.baseDirs = baseDirs;
@@ -310,9 +311,9 @@ var Config = class {
310
311
  this.features = features;
311
312
  this.verbose = verbose;
312
313
  this.delete = isDelete;
313
- this.global = global ?? experimentalGlobal ?? false;
314
- this.simulateCommands = simulateCommands ?? experimentalSimulateCommands ?? false;
315
- this.simulateSubagents = simulateSubagents ?? experimentalSimulateSubagents ?? false;
314
+ this.global = global ?? false;
315
+ this.simulateCommands = simulateCommands ?? false;
316
+ this.simulateSubagents = simulateSubagents ?? false;
316
317
  this.simulateSkills = simulateSkills ?? false;
317
318
  this.modularMcp = modularMcp ?? false;
318
319
  }
@@ -366,19 +367,6 @@ var Config = class {
366
367
  getModularMcp() {
367
368
  return this.modularMcp;
368
369
  }
369
- // Deprecated getters for backward compatibility
370
- /** @deprecated Use getGlobal() instead */
371
- getExperimentalGlobal() {
372
- return this.global;
373
- }
374
- /** @deprecated Use getSimulateCommands() instead */
375
- getExperimentalSimulateCommands() {
376
- return this.simulateCommands;
377
- }
378
- /** @deprecated Use getSimulateSubagents() instead */
379
- getExperimentalSimulateSubagents() {
380
- return this.simulateSubagents;
381
- }
382
370
  };
383
371
 
384
372
  // src/config/config-resolver.ts
@@ -393,10 +381,7 @@ var getDefaults = () => ({
393
381
  simulateCommands: false,
394
382
  simulateSubagents: false,
395
383
  simulateSkills: false,
396
- modularMcp: false,
397
- experimentalGlobal: false,
398
- experimentalSimulateCommands: false,
399
- experimentalSimulateSubagents: false
384
+ modularMcp: false
400
385
  });
401
386
  var ConfigResolver = class {
402
387
  static async resolve({
@@ -410,10 +395,7 @@ var ConfigResolver = class {
410
395
  simulateCommands,
411
396
  simulateSubagents,
412
397
  simulateSkills,
413
- modularMcp,
414
- experimentalGlobal,
415
- experimentalSimulateCommands,
416
- experimentalSimulateSubagents
398
+ modularMcp
417
399
  }) {
418
400
  const validatedConfigPath = resolvePath(configPath, process.cwd());
419
401
  let configByFile = {};
@@ -429,21 +411,9 @@ var ConfigResolver = class {
429
411
  throw error;
430
412
  }
431
413
  }
432
- const deprecatedGlobal = experimentalGlobal ?? configByFile.experimentalGlobal;
433
- const deprecatedCommands = experimentalSimulateCommands ?? configByFile.experimentalSimulateCommands;
434
- const deprecatedSubagents = experimentalSimulateSubagents ?? configByFile.experimentalSimulateSubagents;
435
- if (deprecatedGlobal !== void 0) {
436
- warnDeprecatedOptions({ experimentalGlobal: deprecatedGlobal });
437
- }
438
- if (deprecatedCommands !== void 0) {
439
- warnDeprecatedOptions({ experimentalSimulateCommands: deprecatedCommands });
440
- }
441
- if (deprecatedSubagents !== void 0) {
442
- warnDeprecatedOptions({ experimentalSimulateSubagents: deprecatedSubagents });
443
- }
444
- const resolvedGlobal = global ?? configByFile.global ?? experimentalGlobal ?? configByFile.experimentalGlobal ?? getDefaults().global;
445
- const resolvedSimulateCommands = simulateCommands ?? configByFile.simulateCommands ?? experimentalSimulateCommands ?? configByFile.experimentalSimulateCommands ?? getDefaults().simulateCommands;
446
- const resolvedSimulateSubagents = simulateSubagents ?? configByFile.simulateSubagents ?? experimentalSimulateSubagents ?? configByFile.experimentalSimulateSubagents ?? getDefaults().simulateSubagents;
414
+ const resolvedGlobal = global ?? configByFile.global ?? getDefaults().global;
415
+ const resolvedSimulateCommands = simulateCommands ?? configByFile.simulateCommands ?? getDefaults().simulateCommands;
416
+ const resolvedSimulateSubagents = simulateSubagents ?? configByFile.simulateSubagents ?? getDefaults().simulateSubagents;
447
417
  const resolvedSimulateSkills = simulateSkills ?? configByFile.simulateSkills ?? getDefaults().simulateSkills;
448
418
  const configParams = {
449
419
  targets: targets ?? configByFile.targets ?? getDefaults().targets,
@@ -463,25 +433,6 @@ var ConfigResolver = class {
463
433
  return new Config(configParams);
464
434
  }
465
435
  };
466
- function warnDeprecatedOptions({
467
- experimentalGlobal,
468
- experimentalSimulateCommands,
469
- experimentalSimulateSubagents
470
- }) {
471
- if (experimentalGlobal !== void 0) {
472
- logger.warn("'experimentalGlobal' option is deprecated. Please use 'global' instead.");
473
- }
474
- if (experimentalSimulateCommands !== void 0) {
475
- logger.warn(
476
- "'experimentalSimulateCommands' option is deprecated. Please use 'simulateCommands' instead."
477
- );
478
- }
479
- if (experimentalSimulateSubagents !== void 0) {
480
- logger.warn(
481
- "'experimentalSimulateSubagents' option is deprecated. Please use 'simulateSubagents' instead."
482
- );
483
- }
484
- }
485
436
  function getBaseDirsInLightOfGlobal({
486
437
  baseDirs,
487
438
  global
@@ -511,7 +462,7 @@ var RULESYNC_OVERVIEW_FILE_NAME = "overview.md";
511
462
  var RULESYNC_SKILLS_RELATIVE_DIR_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "skills");
512
463
 
513
464
  // src/features/commands/commands-processor.ts
514
- import { basename as basename13, join as join14 } from "path";
465
+ import { basename as basename12, join as join14 } from "path";
515
466
  import { z as z12 } from "zod/mini";
516
467
 
517
468
  // src/types/feature-processor.ts
@@ -545,7 +496,7 @@ var FeatureProcessor = class {
545
496
  };
546
497
 
547
498
  // src/features/commands/agentsmd-command.ts
548
- import { basename as basename3, join as join4 } from "path";
499
+ import { basename as basename2, join as join4 } from "path";
549
500
 
550
501
  // src/utils/frontmatter.ts
551
502
  import matter from "gray-matter";
@@ -597,7 +548,7 @@ function parseFrontmatter(content) {
597
548
  }
598
549
 
599
550
  // src/features/commands/simulated-command.ts
600
- import { basename as basename2, join as join3 } from "path";
551
+ import { basename, join as join3 } from "path";
601
552
  import { z as z4 } from "zod/mini";
602
553
 
603
554
  // src/types/ai-file.ts
@@ -834,7 +785,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
834
785
  return {
835
786
  baseDir,
836
787
  relativeDirPath: _SimulatedCommand.getSettablePaths().relativeDirPath,
837
- relativeFilePath: basename2(relativeFilePath),
788
+ relativeFilePath: basename(relativeFilePath),
838
789
  frontmatter: result.data,
839
790
  body: content.trim(),
840
791
  validate
@@ -877,7 +828,7 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
877
828
  return new _AgentsmdCommand({
878
829
  baseDir,
879
830
  relativeDirPath: _AgentsmdCommand.getSettablePaths().relativeDirPath,
880
- relativeFilePath: basename3(relativeFilePath),
831
+ relativeFilePath: basename2(relativeFilePath),
881
832
  frontmatter: result.data,
882
833
  body: content.trim(),
883
834
  validate
@@ -892,11 +843,11 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
892
843
  };
893
844
 
894
845
  // src/features/commands/antigravity-command.ts
895
- import { basename as basename5, join as join6 } from "path";
846
+ import { basename as basename4, join as join6 } from "path";
896
847
  import { z as z6 } from "zod/mini";
897
848
 
898
849
  // src/features/commands/rulesync-command.ts
899
- import { basename as basename4, join as join5 } from "path";
850
+ import { basename as basename3, join as join5 } from "path";
900
851
  import { z as z5 } from "zod/mini";
901
852
 
902
853
  // src/types/rulesync-file.ts
@@ -974,7 +925,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
974
925
  if (!result.success) {
975
926
  throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
976
927
  }
977
- const filename = basename4(relativeFilePath);
928
+ const filename = basename3(relativeFilePath);
978
929
  return new _RulesyncCommand({
979
930
  baseDir: process.cwd(),
980
931
  relativeDirPath: _RulesyncCommand.getSettablePaths().relativeDirPath,
@@ -1099,7 +1050,7 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
1099
1050
  return new _AntigravityCommand({
1100
1051
  baseDir,
1101
1052
  relativeDirPath: _AntigravityCommand.getSettablePaths().relativeDirPath,
1102
- relativeFilePath: basename5(relativeFilePath),
1053
+ relativeFilePath: basename4(relativeFilePath),
1103
1054
  frontmatter: result.data,
1104
1055
  body: content.trim(),
1105
1056
  fileContent,
@@ -1109,7 +1060,7 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
1109
1060
  };
1110
1061
 
1111
1062
  // src/features/commands/claudecode-command.ts
1112
- import { basename as basename6, join as join7 } from "path";
1063
+ import { basename as basename5, join as join7 } from "path";
1113
1064
  import { z as z7 } from "zod/mini";
1114
1065
  var ClaudecodeCommandFrontmatterSchema = z7.looseObject({
1115
1066
  description: z7.string(),
@@ -1230,7 +1181,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
1230
1181
  return new _ClaudecodeCommand({
1231
1182
  baseDir,
1232
1183
  relativeDirPath: paths.relativeDirPath,
1233
- relativeFilePath: basename6(relativeFilePath),
1184
+ relativeFilePath: basename5(relativeFilePath),
1234
1185
  frontmatter: result.data,
1235
1186
  body: content.trim(),
1236
1187
  validate
@@ -1239,7 +1190,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
1239
1190
  };
1240
1191
 
1241
1192
  // src/features/commands/codexcli-command.ts
1242
- import { basename as basename7, join as join8 } from "path";
1193
+ import { basename as basename6, join as join8 } from "path";
1243
1194
  var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
1244
1195
  static getSettablePaths({ global } = {}) {
1245
1196
  if (!global) {
@@ -1305,7 +1256,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
1305
1256
  return new _CodexcliCommand({
1306
1257
  baseDir,
1307
1258
  relativeDirPath: paths.relativeDirPath,
1308
- relativeFilePath: basename7(relativeFilePath),
1259
+ relativeFilePath: basename6(relativeFilePath),
1309
1260
  fileContent: content.trim(),
1310
1261
  validate
1311
1262
  });
@@ -1313,7 +1264,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
1313
1264
  };
1314
1265
 
1315
1266
  // src/features/commands/copilot-command.ts
1316
- import { basename as basename8, join as join9 } from "path";
1267
+ import { basename as basename7, join as join9 } from "path";
1317
1268
  import { z as z8 } from "zod/mini";
1318
1269
  var CopilotCommandFrontmatterSchema = z8.looseObject({
1319
1270
  mode: z8.literal("agent"),
@@ -1426,7 +1377,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
1426
1377
  return new _CopilotCommand({
1427
1378
  baseDir,
1428
1379
  relativeDirPath: paths.relativeDirPath,
1429
- relativeFilePath: basename8(relativeFilePath),
1380
+ relativeFilePath: basename7(relativeFilePath),
1430
1381
  frontmatter: result.data,
1431
1382
  body: content.trim(),
1432
1383
  validate
@@ -1441,7 +1392,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
1441
1392
  };
1442
1393
 
1443
1394
  // src/features/commands/cursor-command.ts
1444
- import { basename as basename9, join as join10 } from "path";
1395
+ import { basename as basename8, join as join10 } from "path";
1445
1396
  var CursorCommand = class _CursorCommand extends ToolCommand {
1446
1397
  static getSettablePaths(_options = {}) {
1447
1398
  return {
@@ -1504,7 +1455,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
1504
1455
  return new _CursorCommand({
1505
1456
  baseDir,
1506
1457
  relativeDirPath: paths.relativeDirPath,
1507
- relativeFilePath: basename9(relativeFilePath),
1458
+ relativeFilePath: basename8(relativeFilePath),
1508
1459
  fileContent: content.trim(),
1509
1460
  validate
1510
1461
  });
@@ -1512,7 +1463,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
1512
1463
  };
1513
1464
 
1514
1465
  // src/features/commands/geminicli-command.ts
1515
- import { basename as basename10, join as join11 } from "path";
1466
+ import { basename as basename9, join as join11 } from "path";
1516
1467
  import { parse as parseToml } from "smol-toml";
1517
1468
  import { z as z9 } from "zod/mini";
1518
1469
  var GeminiCliCommandFrontmatterSchema = z9.looseObject({
@@ -1617,7 +1568,7 @@ ${geminiFrontmatter.prompt}
1617
1568
  return new _GeminiCliCommand({
1618
1569
  baseDir,
1619
1570
  relativeDirPath: paths.relativeDirPath,
1620
- relativeFilePath: basename10(relativeFilePath),
1571
+ relativeFilePath: basename9(relativeFilePath),
1621
1572
  fileContent,
1622
1573
  validate
1623
1574
  });
@@ -1639,7 +1590,7 @@ ${geminiFrontmatter.prompt}
1639
1590
  };
1640
1591
 
1641
1592
  // src/features/commands/opencode-command.ts
1642
- import { basename as basename11, join as join12 } from "path";
1593
+ import { basename as basename10, join as join12 } from "path";
1643
1594
  import { optional as optional2, z as z10 } from "zod/mini";
1644
1595
  var OpenCodeCommandFrontmatterSchema = z10.looseObject({
1645
1596
  description: z10.string(),
@@ -1750,7 +1701,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
1750
1701
  return new _OpenCodeCommand({
1751
1702
  baseDir,
1752
1703
  relativeDirPath: paths.relativeDirPath,
1753
- relativeFilePath: basename11(relativeFilePath),
1704
+ relativeFilePath: basename10(relativeFilePath),
1754
1705
  frontmatter: result.data,
1755
1706
  body: content.trim(),
1756
1707
  validate
@@ -1765,7 +1716,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
1765
1716
  };
1766
1717
 
1767
1718
  // src/features/commands/roo-command.ts
1768
- import { basename as basename12, join as join13 } from "path";
1719
+ import { basename as basename11, join as join13 } from "path";
1769
1720
  import { optional as optional3, z as z11 } from "zod/mini";
1770
1721
  var RooCommandFrontmatterSchema = z11.looseObject({
1771
1722
  description: z11.string(),
@@ -1881,7 +1832,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
1881
1832
  return new _RooCommand({
1882
1833
  baseDir,
1883
1834
  relativeDirPath: _RooCommand.getSettablePaths().relativeDirPath,
1884
- relativeFilePath: basename12(relativeFilePath),
1835
+ relativeFilePath: basename11(relativeFilePath),
1885
1836
  frontmatter: result.data,
1886
1837
  body: content.trim(),
1887
1838
  fileContent,
@@ -2052,7 +2003,7 @@ var CommandsProcessor = class extends FeatureProcessor {
2052
2003
  );
2053
2004
  const rulesyncCommands = await Promise.all(
2054
2005
  rulesyncCommandPaths.map(
2055
- (path3) => RulesyncCommand.fromFile({ relativeFilePath: basename13(path3) })
2006
+ (path3) => RulesyncCommand.fromFile({ relativeFilePath: basename12(path3) })
2056
2007
  )
2057
2008
  );
2058
2009
  logger.info(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
@@ -2074,7 +2025,7 @@ var CommandsProcessor = class extends FeatureProcessor {
2074
2025
  commandFilePaths.map(
2075
2026
  (path3) => factory.class.fromFile({
2076
2027
  baseDir: this.baseDir,
2077
- relativeFilePath: basename13(path3),
2028
+ relativeFilePath: basename12(path3),
2078
2029
  global: this.global
2079
2030
  })
2080
2031
  )
@@ -2374,11 +2325,19 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
2374
2325
  const exists = await fileExists(filePath);
2375
2326
  const existingFileContent = exists ? await readFileContent(filePath) : "{}";
2376
2327
  const existingJsonValue = JSON.parse(existingFileContent);
2328
+ const existingDenies = existingJsonValue.permissions?.deny ?? [];
2329
+ const preservedDenies = existingDenies.filter((deny) => {
2330
+ const isReadPattern = deny.startsWith("Read(") && deny.endsWith(")");
2331
+ if (isReadPattern) {
2332
+ return deniedValues.includes(deny);
2333
+ }
2334
+ return true;
2335
+ });
2377
2336
  const jsonValue = {
2378
2337
  ...existingJsonValue,
2379
2338
  permissions: {
2380
2339
  ...existingJsonValue.permissions,
2381
- deny: uniq([...existingJsonValue.permissions?.deny ?? [], ...deniedValues].toSorted())
2340
+ deny: uniq([...preservedDenies, ...deniedValues].toSorted())
2382
2341
  }
2383
2342
  };
2384
2343
  return new _ClaudecodeIgnore({
@@ -4282,9 +4241,9 @@ var McpProcessor = class extends FeatureProcessor {
4282
4241
  };
4283
4242
 
4284
4243
  // src/features/rules/rules-processor.ts
4285
- import { basename as basename21, join as join82 } from "path";
4244
+ import { basename as basename20, join as join82 } from "path";
4286
4245
  import { encode } from "@toon-format/toon";
4287
- import { z as z33 } from "zod/mini";
4246
+ import { z as z34 } from "zod/mini";
4288
4247
 
4289
4248
  // src/constants/general.ts
4290
4249
  var SKILL_FILE_NAME = "SKILL.md";
@@ -4300,7 +4259,7 @@ import { z as z19 } from "zod/mini";
4300
4259
  import { join as join40 } from "path";
4301
4260
 
4302
4261
  // src/types/ai-dir.ts
4303
- import path2, { basename as basename14, join as join39, relative as relative3, resolve as resolve4 } from "path";
4262
+ import path2, { basename as basename13, join as join39, relative as relative3, resolve as resolve4 } from "path";
4304
4263
  var AiDir = class {
4305
4264
  /**
4306
4265
  * @example "."
@@ -4397,7 +4356,7 @@ var AiDir = class {
4397
4356
  const dirPath = join39(baseDir, relativeDirPath, dirName);
4398
4357
  const glob = join39(dirPath, "**", "*");
4399
4358
  const filePaths = await findFilesByGlobs(glob, { type: "file" });
4400
- const filteredPaths = filePaths.filter((filePath) => basename14(filePath) !== excludeFileName);
4359
+ const filteredPaths = filePaths.filter((filePath) => basename13(filePath) !== excludeFileName);
4401
4360
  const files = await Promise.all(
4402
4361
  filteredPaths.map(async (filePath) => {
4403
4362
  const fileBuffer = await readFileBuffer(filePath);
@@ -5024,7 +4983,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
5024
4983
  };
5025
4984
 
5026
4985
  // src/features/skills/skills-processor.ts
5027
- import { basename as basename15, join as join50 } from "path";
4986
+ import { basename as basename14, join as join50 } from "path";
5028
4987
  import { z as z23 } from "zod/mini";
5029
4988
 
5030
4989
  // src/types/dir-feature-processor.ts
@@ -5351,7 +5310,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
5351
5310
  const paths = RulesyncSkill.getSettablePaths();
5352
5311
  const rulesyncSkillsDirPath = join50(this.baseDir, paths.relativeDirPath);
5353
5312
  const dirPaths = await findFilesByGlobs(join50(rulesyncSkillsDirPath, "*"), { type: "dir" });
5354
- const dirNames = dirPaths.map((path3) => basename15(path3));
5313
+ const dirNames = dirPaths.map((path3) => basename14(path3));
5355
5314
  const rulesyncSkills = await Promise.all(
5356
5315
  dirNames.map(
5357
5316
  (dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
@@ -5369,7 +5328,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
5369
5328
  const paths = factory.class.getSettablePaths({ global: this.global });
5370
5329
  const skillsDirPath = join50(this.baseDir, paths.relativeDirPath);
5371
5330
  const dirPaths = await findFilesByGlobs(join50(skillsDirPath, "*"), { type: "dir" });
5372
- const dirNames = dirPaths.map((path3) => basename15(path3));
5331
+ const dirNames = dirPaths.map((path3) => basename14(path3));
5373
5332
  const toolSkills = await Promise.all(
5374
5333
  dirNames.map(
5375
5334
  (dirName) => factory.class.fromDir({
@@ -5422,7 +5381,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
5422
5381
  import { join as join52 } from "path";
5423
5382
 
5424
5383
  // src/features/subagents/simulated-subagent.ts
5425
- import { basename as basename16, join as join51 } from "path";
5384
+ import { basename as basename15, join as join51 } from "path";
5426
5385
  import { z as z24 } from "zod/mini";
5427
5386
 
5428
5387
  // src/features/subagents/tool-subagent.ts
@@ -5541,7 +5500,7 @@ var SimulatedSubagent = class extends ToolSubagent {
5541
5500
  return {
5542
5501
  baseDir,
5543
5502
  relativeDirPath: this.getSettablePaths().relativeDirPath,
5544
- relativeFilePath: basename16(relativeFilePath),
5503
+ relativeFilePath: basename15(relativeFilePath),
5545
5504
  frontmatter: result.data,
5546
5505
  body: content.trim(),
5547
5506
  validate
@@ -5693,7 +5652,7 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
5693
5652
  };
5694
5653
 
5695
5654
  // src/features/subagents/subagents-processor.ts
5696
- import { basename as basename18, join as join60 } from "path";
5655
+ import { basename as basename17, join as join60 } from "path";
5697
5656
  import { z as z27 } from "zod/mini";
5698
5657
 
5699
5658
  // src/features/subagents/claudecode-subagent.ts
@@ -5701,7 +5660,7 @@ import { join as join59 } from "path";
5701
5660
  import { z as z26 } from "zod/mini";
5702
5661
 
5703
5662
  // src/features/subagents/rulesync-subagent.ts
5704
- import { basename as basename17, join as join58 } from "path";
5663
+ import { basename as basename16, join as join58 } from "path";
5705
5664
  import { z as z25 } from "zod/mini";
5706
5665
  var RulesyncSubagentFrontmatterSchema = z25.looseObject({
5707
5666
  targets: RulesyncTargetsSchema,
@@ -5765,7 +5724,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
5765
5724
  if (!result.success) {
5766
5725
  throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
5767
5726
  }
5768
- const filename = basename17(relativeFilePath);
5727
+ const filename = basename16(relativeFilePath);
5769
5728
  return new _RulesyncSubagent({
5770
5729
  baseDir: process.cwd(),
5771
5730
  relativeDirPath: this.getSettablePaths().relativeDirPath,
@@ -6080,7 +6039,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
6080
6039
  subagentFilePaths.map(
6081
6040
  (path3) => factory.class.fromFile({
6082
6041
  baseDir: this.baseDir,
6083
- relativeFilePath: basename18(path3),
6042
+ relativeFilePath: basename17(path3),
6084
6043
  global: this.global
6085
6044
  })
6086
6045
  )
@@ -6119,7 +6078,7 @@ import { join as join63 } from "path";
6119
6078
  import { join as join62 } from "path";
6120
6079
 
6121
6080
  // src/features/rules/rulesync-rule.ts
6122
- import { basename as basename19, join as join61 } from "path";
6081
+ import { basename as basename18, join as join61 } from "path";
6123
6082
  import { z as z28 } from "zod/mini";
6124
6083
  var RulesyncRuleFrontmatterSchema = z28.object({
6125
6084
  root: z28.optional(z28.optional(z28.boolean())),
@@ -6150,6 +6109,12 @@ var RulesyncRuleFrontmatterSchema = z28.object({
6150
6109
  z28.object({
6151
6110
  excludeAgent: z28.optional(z28.union([z28.literal("code-review"), z28.literal("coding-agent")]))
6152
6111
  })
6112
+ ),
6113
+ antigravity: z28.optional(
6114
+ z28.looseObject({
6115
+ trigger: z28.optional(z28.string()),
6116
+ globs: z28.optional(z28.array(z28.string()))
6117
+ })
6153
6118
  )
6154
6119
  });
6155
6120
  var RulesyncRule = class _RulesyncRule extends RulesyncFile {
@@ -6175,9 +6140,6 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
6175
6140
  return {
6176
6141
  recommended: {
6177
6142
  relativeDirPath: RULESYNC_RULES_RELATIVE_DIR_PATH
6178
- },
6179
- legacy: {
6180
- relativeDirPath: RULESYNC_RELATIVE_DIR_PATH
6181
6143
  }
6182
6144
  };
6183
6145
  }
@@ -6200,44 +6162,6 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
6200
6162
  };
6201
6163
  }
6202
6164
  }
6203
- static async fromFileLegacy({
6204
- relativeFilePath,
6205
- validate = true
6206
- }) {
6207
- const legacyPath = join61(
6208
- process.cwd(),
6209
- this.getSettablePaths().legacy.relativeDirPath,
6210
- relativeFilePath
6211
- );
6212
- const recommendedPath = join61(
6213
- this.getSettablePaths().recommended.relativeDirPath,
6214
- relativeFilePath
6215
- );
6216
- logger.warn(`\u26A0\uFE0F Using deprecated path "${legacyPath}". Please migrate to "${recommendedPath}"`);
6217
- const fileContent = await readFileContent(legacyPath);
6218
- const { frontmatter, body: content } = parseFrontmatter(fileContent);
6219
- const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
6220
- if (!result.success) {
6221
- throw new Error(`Invalid frontmatter in ${legacyPath}: ${formatError(result.error)}`);
6222
- }
6223
- const validatedFrontmatter = {
6224
- root: result.data.root ?? false,
6225
- targets: result.data.targets ?? ["*"],
6226
- description: result.data.description ?? "",
6227
- globs: result.data.globs ?? [],
6228
- agentsmd: result.data.agentsmd,
6229
- cursor: result.data.cursor
6230
- };
6231
- const filename = basename19(legacyPath);
6232
- return new _RulesyncRule({
6233
- baseDir: process.cwd(),
6234
- relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
6235
- relativeFilePath: filename,
6236
- frontmatter: validatedFrontmatter,
6237
- body: content.trim(),
6238
- validate
6239
- });
6240
- }
6241
6165
  static async fromFile({
6242
6166
  relativeFilePath,
6243
6167
  validate = true
@@ -6261,7 +6185,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
6261
6185
  agentsmd: result.data.agentsmd,
6262
6186
  cursor: result.data.cursor
6263
6187
  };
6264
- const filename = basename19(filePath);
6188
+ const filename = basename18(filePath);
6265
6189
  return new _RulesyncRule({
6266
6190
  baseDir: process.cwd(),
6267
6191
  relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
@@ -6519,7 +6443,176 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
6519
6443
 
6520
6444
  // src/features/rules/antigravity-rule.ts
6521
6445
  import { join as join65 } from "path";
6446
+ import { z as z29 } from "zod/mini";
6447
+ var AntigravityRuleFrontmatterSchema = z29.looseObject({
6448
+ trigger: z29.optional(
6449
+ z29.union([
6450
+ z29.literal("always_on"),
6451
+ z29.literal("glob"),
6452
+ z29.literal("manual"),
6453
+ z29.literal("model_decision"),
6454
+ z29.string()
6455
+ // accepts any string for forward compatibility
6456
+ ])
6457
+ ),
6458
+ globs: z29.optional(z29.string()),
6459
+ description: z29.optional(z29.string())
6460
+ });
6461
+ function parseGlobsString(globs) {
6462
+ if (!globs) {
6463
+ return [];
6464
+ }
6465
+ if (Array.isArray(globs)) {
6466
+ return globs;
6467
+ }
6468
+ if (globs.trim() === "") {
6469
+ return [];
6470
+ }
6471
+ return globs.split(",").map((g) => g.trim());
6472
+ }
6473
+ function stringifyGlobs(globs) {
6474
+ if (!globs || globs.length === 0) {
6475
+ return void 0;
6476
+ }
6477
+ return globs.join(",");
6478
+ }
6479
+ function normalizeStoredAntigravity(stored) {
6480
+ if (!stored) {
6481
+ return void 0;
6482
+ }
6483
+ const { globs, ...rest } = stored;
6484
+ return {
6485
+ ...rest,
6486
+ globs: Array.isArray(globs) ? stringifyGlobs(globs) : globs
6487
+ };
6488
+ }
6489
+ var globStrategy = {
6490
+ canHandle: (trigger) => trigger === "glob",
6491
+ generateFrontmatter: (normalized, rulesyncFrontmatter) => {
6492
+ const effectiveGlobsArray = normalized?.globs ? parseGlobsString(normalized.globs) : rulesyncFrontmatter.globs ?? [];
6493
+ return {
6494
+ ...normalized,
6495
+ trigger: "glob",
6496
+ globs: stringifyGlobs(effectiveGlobsArray)
6497
+ };
6498
+ },
6499
+ exportRulesyncData: ({ description, ...frontmatter }) => ({
6500
+ globs: parseGlobsString(frontmatter.globs),
6501
+ description: description || "",
6502
+ antigravity: frontmatter
6503
+ })
6504
+ };
6505
+ var manualStrategy = {
6506
+ canHandle: (trigger) => trigger === "manual",
6507
+ generateFrontmatter: (normalized) => ({
6508
+ ...normalized,
6509
+ trigger: "manual"
6510
+ }),
6511
+ exportRulesyncData: ({ description, ...frontmatter }) => ({
6512
+ globs: [],
6513
+ description: description || "",
6514
+ antigravity: frontmatter
6515
+ })
6516
+ };
6517
+ var alwaysOnStrategy = {
6518
+ canHandle: (trigger) => trigger === "always_on",
6519
+ generateFrontmatter: (normalized) => ({
6520
+ ...normalized,
6521
+ trigger: "always_on"
6522
+ }),
6523
+ exportRulesyncData: ({ description, ...frontmatter }) => ({
6524
+ globs: ["**/*"],
6525
+ description: description || "",
6526
+ antigravity: frontmatter
6527
+ })
6528
+ };
6529
+ var modelDecisionStrategy = {
6530
+ canHandle: (trigger) => trigger === "model_decision",
6531
+ generateFrontmatter: (normalized, rulesyncFrontmatter) => ({
6532
+ ...normalized,
6533
+ trigger: "model_decision",
6534
+ description: rulesyncFrontmatter.description
6535
+ }),
6536
+ exportRulesyncData: ({ description, ...frontmatter }) => ({
6537
+ globs: [],
6538
+ description: description || "",
6539
+ antigravity: frontmatter
6540
+ })
6541
+ };
6542
+ var unknownStrategy = {
6543
+ canHandle: (trigger) => trigger !== void 0,
6544
+ generateFrontmatter: (normalized) => {
6545
+ const trigger = typeof normalized?.trigger === "string" ? normalized.trigger : "manual";
6546
+ return {
6547
+ ...normalized,
6548
+ trigger
6549
+ };
6550
+ },
6551
+ exportRulesyncData: ({ description, ...frontmatter }) => ({
6552
+ globs: frontmatter.globs ? parseGlobsString(frontmatter.globs) : ["**/*"],
6553
+ description: description || "",
6554
+ antigravity: frontmatter
6555
+ })
6556
+ };
6557
+ var inferenceStrategy = {
6558
+ canHandle: (trigger) => trigger === void 0,
6559
+ generateFrontmatter: (normalized, rulesyncFrontmatter) => {
6560
+ const effectiveGlobsArray = normalized?.globs ? parseGlobsString(normalized.globs) : rulesyncFrontmatter.globs ?? [];
6561
+ if (effectiveGlobsArray.length > 0 && !effectiveGlobsArray.includes("**/*") && !effectiveGlobsArray.includes("*")) {
6562
+ return {
6563
+ ...normalized,
6564
+ trigger: "glob",
6565
+ globs: stringifyGlobs(effectiveGlobsArray)
6566
+ };
6567
+ }
6568
+ return {
6569
+ ...normalized,
6570
+ trigger: "always_on"
6571
+ };
6572
+ },
6573
+ exportRulesyncData: ({ description, ...frontmatter }) => ({
6574
+ globs: frontmatter.globs ? parseGlobsString(frontmatter.globs) : ["**/*"],
6575
+ description: description || "",
6576
+ antigravity: frontmatter
6577
+ })
6578
+ };
6579
+ var STRATEGIES = [
6580
+ globStrategy,
6581
+ manualStrategy,
6582
+ alwaysOnStrategy,
6583
+ modelDecisionStrategy,
6584
+ unknownStrategy,
6585
+ inferenceStrategy
6586
+ ];
6522
6587
  var AntigravityRule = class _AntigravityRule extends ToolRule {
6588
+ frontmatter;
6589
+ body;
6590
+ /**
6591
+ * Creates an AntigravityRule instance.
6592
+ *
6593
+ * @param params - Rule parameters including frontmatter and body
6594
+ * @param params.frontmatter - Antigravity-specific frontmatter configuration
6595
+ * @param params.body - The markdown body content (without frontmatter)
6596
+ *
6597
+ * Note: Files without frontmatter will default to always_on trigger during fromFile().
6598
+ */
6599
+ constructor({ frontmatter, body, ...rest }) {
6600
+ if (rest.validate !== false) {
6601
+ const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
6602
+ if (!result.success) {
6603
+ throw new Error(
6604
+ `Invalid frontmatter in ${join65(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
6605
+ );
6606
+ }
6607
+ }
6608
+ super({
6609
+ ...rest,
6610
+ // Ensure fileContent includes frontmatter when constructed directly
6611
+ fileContent: stringifyFrontmatter(body, frontmatter)
6612
+ });
6613
+ this.frontmatter = frontmatter;
6614
+ this.body = body;
6615
+ }
6523
6616
  static getSettablePaths() {
6524
6617
  return {
6525
6618
  nonRoot: {
@@ -6532,36 +6625,121 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
6532
6625
  relativeFilePath,
6533
6626
  validate = true
6534
6627
  }) {
6535
- const fileContent = await readFileContent(
6536
- join65(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
6628
+ const filePath = join65(
6629
+ baseDir,
6630
+ this.getSettablePaths().nonRoot.relativeDirPath,
6631
+ relativeFilePath
6537
6632
  );
6633
+ const fileContent = await readFileContent(filePath);
6634
+ const { frontmatter, body } = parseFrontmatter(fileContent);
6635
+ let parsedFrontmatter;
6636
+ if (validate) {
6637
+ const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
6638
+ if (result.success) {
6639
+ parsedFrontmatter = result.data;
6640
+ } else {
6641
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
6642
+ }
6643
+ } else {
6644
+ parsedFrontmatter = frontmatter;
6645
+ }
6538
6646
  return new _AntigravityRule({
6539
6647
  baseDir,
6540
6648
  relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
6541
6649
  relativeFilePath,
6542
- fileContent,
6650
+ body,
6651
+ frontmatter: parsedFrontmatter,
6543
6652
  validate,
6544
6653
  root: false
6545
6654
  });
6546
6655
  }
6656
+ /**
6657
+ * Converts a RulesyncRule to an AntigravityRule.
6658
+ *
6659
+ * Trigger inference:
6660
+ * - If antigravity.trigger is set, it's preserved
6661
+ * - If specific globs are set, infers "glob" trigger
6662
+ * - Otherwise, infers "always_on" trigger
6663
+ */
6547
6664
  static fromRulesyncRule({
6548
6665
  baseDir = process.cwd(),
6549
6666
  rulesyncRule,
6550
6667
  validate = true
6551
6668
  }) {
6552
- return new _AntigravityRule(
6553
- this.buildToolRuleParamsDefault({
6554
- baseDir,
6555
- rulesyncRule,
6556
- validate,
6557
- nonRootPath: this.getSettablePaths().nonRoot
6558
- })
6559
- );
6669
+ const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
6670
+ const storedAntigravity = rulesyncFrontmatter.antigravity;
6671
+ const normalized = normalizeStoredAntigravity(storedAntigravity);
6672
+ const storedTrigger = storedAntigravity?.trigger;
6673
+ const strategy = STRATEGIES.find((s) => s.canHandle(storedTrigger));
6674
+ if (!strategy) {
6675
+ throw new Error(`No strategy found for trigger: ${storedTrigger}`);
6676
+ }
6677
+ const frontmatter = strategy.generateFrontmatter(normalized, rulesyncFrontmatter);
6678
+ const paths = this.getSettablePaths();
6679
+ const kebabCaseFilename = toKebabCaseFilename(rulesyncRule.getRelativeFilePath());
6680
+ return new _AntigravityRule({
6681
+ baseDir,
6682
+ relativeDirPath: paths.nonRoot.relativeDirPath,
6683
+ relativeFilePath: kebabCaseFilename,
6684
+ frontmatter,
6685
+ body: rulesyncRule.getBody(),
6686
+ validate,
6687
+ root: false
6688
+ });
6560
6689
  }
6690
+ /**
6691
+ * Converts this AntigravityRule to a RulesyncRule.
6692
+ *
6693
+ * The Antigravity configuration is preserved in the RulesyncRule's
6694
+ * frontmatter.antigravity field for round-trip compatibility.
6695
+ *
6696
+ * Note: All Antigravity rules are treated as non-root (root: false),
6697
+ * as they are all placed in the .agent/rules directory.
6698
+ *
6699
+ * @returns RulesyncRule instance with Antigravity config preserved
6700
+ */
6561
6701
  toRulesyncRule() {
6562
- return this.toRulesyncRuleDefault();
6702
+ const strategy = STRATEGIES.find((s) => s.canHandle(this.frontmatter.trigger));
6703
+ let rulesyncData = {
6704
+ globs: [],
6705
+ description: "",
6706
+ antigravity: this.frontmatter
6707
+ };
6708
+ if (strategy) {
6709
+ rulesyncData = strategy.exportRulesyncData(this.frontmatter);
6710
+ }
6711
+ const antigravityForRulesync = {
6712
+ ...rulesyncData.antigravity,
6713
+ globs: this.frontmatter.globs ? parseGlobsString(this.frontmatter.globs) : void 0
6714
+ };
6715
+ return new RulesyncRule({
6716
+ baseDir: process.cwd(),
6717
+ relativeDirPath: RulesyncRule.getSettablePaths().recommended.relativeDirPath,
6718
+ relativeFilePath: this.getRelativeFilePath(),
6719
+ frontmatter: {
6720
+ root: false,
6721
+ targets: ["*"],
6722
+ ...rulesyncData,
6723
+ antigravity: antigravityForRulesync
6724
+ },
6725
+ // When converting back, we only want the body content
6726
+ body: this.body
6727
+ });
6728
+ }
6729
+ getBody() {
6730
+ return this.body;
6731
+ }
6732
+ // Helper to access raw file content including frontmatter is `this.fileContent` (from ToolFile)
6733
+ // But we might want `body` only for some operations?
6734
+ // ToolFile.getFileContent() returns the whole string.
6735
+ getFrontmatter() {
6736
+ return this.frontmatter;
6563
6737
  }
6564
6738
  validate() {
6739
+ const result = AntigravityRuleFrontmatterSchema.safeParse(this.frontmatter);
6740
+ if (!result.success) {
6741
+ return { success: false, error: new Error(formatError(result.error)) };
6742
+ }
6565
6743
  return { success: true, error: null };
6566
6744
  }
6567
6745
  static isTargetedByRulesyncRule(rulesyncRule) {
@@ -6795,9 +6973,9 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
6795
6973
 
6796
6974
  // src/features/rules/claudecode-rule.ts
6797
6975
  import { join as join69 } from "path";
6798
- import { z as z29 } from "zod/mini";
6799
- var ClaudecodeRuleFrontmatterSchema = z29.object({
6800
- paths: z29.optional(z29.string())
6976
+ import { z as z30 } from "zod/mini";
6977
+ var ClaudecodeRuleFrontmatterSchema = z30.object({
6978
+ paths: z30.optional(z30.string())
6801
6979
  });
6802
6980
  var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
6803
6981
  frontmatter;
@@ -6987,9 +7165,9 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
6987
7165
 
6988
7166
  // src/features/rules/cline-rule.ts
6989
7167
  import { join as join70 } from "path";
6990
- import { z as z30 } from "zod/mini";
6991
- var ClineRuleFrontmatterSchema = z30.object({
6992
- description: z30.string()
7168
+ import { z as z31 } from "zod/mini";
7169
+ var ClineRuleFrontmatterSchema = z31.object({
7170
+ description: z31.string()
6993
7171
  });
6994
7172
  var ClineRule = class _ClineRule extends ToolRule {
6995
7173
  static getSettablePaths() {
@@ -7136,11 +7314,11 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
7136
7314
 
7137
7315
  // src/features/rules/copilot-rule.ts
7138
7316
  import { join as join72 } from "path";
7139
- import { z as z31 } from "zod/mini";
7140
- var CopilotRuleFrontmatterSchema = z31.object({
7141
- description: z31.optional(z31.string()),
7142
- applyTo: z31.optional(z31.string()),
7143
- excludeAgent: z31.optional(z31.union([z31.literal("code-review"), z31.literal("coding-agent")]))
7317
+ import { z as z32 } from "zod/mini";
7318
+ var CopilotRuleFrontmatterSchema = z32.object({
7319
+ description: z32.optional(z32.string()),
7320
+ applyTo: z32.optional(z32.string()),
7321
+ excludeAgent: z32.optional(z32.union([z32.literal("code-review"), z32.literal("coding-agent")]))
7144
7322
  });
7145
7323
  var CopilotRule = class _CopilotRule extends ToolRule {
7146
7324
  frontmatter;
@@ -7307,12 +7485,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
7307
7485
  };
7308
7486
 
7309
7487
  // src/features/rules/cursor-rule.ts
7310
- import { basename as basename20, join as join73 } from "path";
7311
- import { z as z32 } from "zod/mini";
7312
- var CursorRuleFrontmatterSchema = z32.object({
7313
- description: z32.optional(z32.string()),
7314
- globs: z32.optional(z32.string()),
7315
- alwaysApply: z32.optional(z32.boolean())
7488
+ import { basename as basename19, join as join73 } from "path";
7489
+ import { z as z33 } from "zod/mini";
7490
+ var CursorRuleFrontmatterSchema = z33.object({
7491
+ description: z33.optional(z33.string()),
7492
+ globs: z33.optional(z33.string()),
7493
+ alwaysApply: z33.optional(z33.boolean())
7316
7494
  });
7317
7495
  var CursorRule = class _CursorRule extends ToolRule {
7318
7496
  frontmatter;
@@ -7458,7 +7636,7 @@ var CursorRule = class _CursorRule extends ToolRule {
7458
7636
  return new _CursorRule({
7459
7637
  baseDir,
7460
7638
  relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
7461
- relativeFilePath: basename20(relativeFilePath),
7639
+ relativeFilePath: basename19(relativeFilePath),
7462
7640
  frontmatter: result.data,
7463
7641
  body: content.trim(),
7464
7642
  validate
@@ -8030,7 +8208,7 @@ var rulesProcessorToolTargets = [
8030
8208
  "warp",
8031
8209
  "windsurf"
8032
8210
  ];
8033
- var RulesProcessorToolTargetSchema = z33.enum(rulesProcessorToolTargets);
8211
+ var RulesProcessorToolTargetSchema = z34.enum(rulesProcessorToolTargets);
8034
8212
  var toolRuleFactories = /* @__PURE__ */ new Map([
8035
8213
  [
8036
8214
  "agentsmd",
@@ -8394,7 +8572,7 @@ var RulesProcessor = class extends FeatureProcessor {
8394
8572
  const files = await findFilesByGlobs(join82(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
8395
8573
  logger.debug(`Found ${files.length} rulesync files`);
8396
8574
  const rulesyncRules = await Promise.all(
8397
- files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename21(file) }))
8575
+ files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename20(file) }))
8398
8576
  );
8399
8577
  const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
8400
8578
  if (rootRules.length > 1) {
@@ -8411,13 +8589,6 @@ var RulesProcessor = class extends FeatureProcessor {
8411
8589
  }
8412
8590
  return rulesyncRules;
8413
8591
  }
8414
- async loadRulesyncFilesLegacy() {
8415
- const legacyFiles = await findFilesByGlobs(join82(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
8416
- logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
8417
- return Promise.all(
8418
- legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename21(file) }))
8419
- );
8420
- }
8421
8592
  /**
8422
8593
  * Implementation of abstract method from FeatureProcessor
8423
8594
  * Load tool-specific rule configurations and parse them into ToolRule instances
@@ -8443,7 +8614,7 @@ var RulesProcessor = class extends FeatureProcessor {
8443
8614
  rootFilePaths.map(
8444
8615
  (filePath) => factory.class.fromFile({
8445
8616
  baseDir: this.baseDir,
8446
- relativeFilePath: basename21(filePath),
8617
+ relativeFilePath: basename20(filePath),
8447
8618
  global: this.global
8448
8619
  })
8449
8620
  )
@@ -8461,7 +8632,7 @@ var RulesProcessor = class extends FeatureProcessor {
8461
8632
  nonRootFilePaths.map(
8462
8633
  (filePath) => factory.class.fromFile({
8463
8634
  baseDir: this.baseDir,
8464
- relativeFilePath: basename21(filePath),
8635
+ relativeFilePath: basename20(filePath),
8465
8636
  global: this.global
8466
8637
  })
8467
8638
  )
@@ -8649,10 +8820,7 @@ async function generateRules(config, options) {
8649
8820
  const oldToolFiles = await processor.loadToolFiles({ forDeletion: true });
8650
8821
  await processor.removeAiFiles(oldToolFiles);
8651
8822
  }
8652
- let rulesyncFiles = await processor.loadRulesyncFiles();
8653
- if (rulesyncFiles.length === 0) {
8654
- rulesyncFiles = await processor.loadRulesyncFilesLegacy();
8655
- }
8823
+ const rulesyncFiles = await processor.loadRulesyncFiles();
8656
8824
  const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
8657
8825
  const writtenCount = await processor.writeAiFiles(toolFiles);
8658
8826
  totalRulesOutputs += writtenCount;
@@ -9378,8 +9546,8 @@ Attention, again, you are just the planner, so though you can read any files and
9378
9546
  import { FastMCP } from "fastmcp";
9379
9547
 
9380
9548
  // src/mcp/commands.ts
9381
- import { basename as basename22, join as join85 } from "path";
9382
- import { z as z34 } from "zod/mini";
9549
+ import { basename as basename21, join as join85 } from "path";
9550
+ import { z as z35 } from "zod/mini";
9383
9551
  var maxCommandSizeBytes = 1024 * 1024;
9384
9552
  var maxCommandsCount = 1e3;
9385
9553
  async function listCommands() {
@@ -9415,7 +9583,7 @@ async function getCommand({ relativePathFromCwd }) {
9415
9583
  relativePath: relativePathFromCwd,
9416
9584
  intendedRootDir: process.cwd()
9417
9585
  });
9418
- const filename = basename22(relativePathFromCwd);
9586
+ const filename = basename21(relativePathFromCwd);
9419
9587
  try {
9420
9588
  const command = await RulesyncCommand.fromFile({
9421
9589
  relativeFilePath: filename
@@ -9440,7 +9608,7 @@ async function putCommand({
9440
9608
  relativePath: relativePathFromCwd,
9441
9609
  intendedRootDir: process.cwd()
9442
9610
  });
9443
- const filename = basename22(relativePathFromCwd);
9611
+ const filename = basename21(relativePathFromCwd);
9444
9612
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
9445
9613
  if (estimatedSize > maxCommandSizeBytes) {
9446
9614
  throw new Error(
@@ -9484,7 +9652,7 @@ async function deleteCommand({ relativePathFromCwd }) {
9484
9652
  relativePath: relativePathFromCwd,
9485
9653
  intendedRootDir: process.cwd()
9486
9654
  });
9487
- const filename = basename22(relativePathFromCwd);
9655
+ const filename = basename21(relativePathFromCwd);
9488
9656
  const fullPath = join85(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
9489
9657
  try {
9490
9658
  await removeFile(fullPath);
@@ -9498,17 +9666,17 @@ async function deleteCommand({ relativePathFromCwd }) {
9498
9666
  }
9499
9667
  }
9500
9668
  var commandToolSchemas = {
9501
- listCommands: z34.object({}),
9502
- getCommand: z34.object({
9503
- relativePathFromCwd: z34.string()
9669
+ listCommands: z35.object({}),
9670
+ getCommand: z35.object({
9671
+ relativePathFromCwd: z35.string()
9504
9672
  }),
9505
- putCommand: z34.object({
9506
- relativePathFromCwd: z34.string(),
9673
+ putCommand: z35.object({
9674
+ relativePathFromCwd: z35.string(),
9507
9675
  frontmatter: RulesyncCommandFrontmatterSchema,
9508
- body: z34.string()
9676
+ body: z35.string()
9509
9677
  }),
9510
- deleteCommand: z34.object({
9511
- relativePathFromCwd: z34.string()
9678
+ deleteCommand: z35.object({
9679
+ relativePathFromCwd: z35.string()
9512
9680
  })
9513
9681
  };
9514
9682
  var commandTools = {
@@ -9557,7 +9725,7 @@ var commandTools = {
9557
9725
 
9558
9726
  // src/mcp/ignore.ts
9559
9727
  import { join as join86 } from "path";
9560
- import { z as z35 } from "zod/mini";
9728
+ import { z as z36 } from "zod/mini";
9561
9729
  var maxIgnoreFileSizeBytes = 100 * 1024;
9562
9730
  async function getIgnoreFile() {
9563
9731
  const ignoreFilePath = join86(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
@@ -9614,11 +9782,11 @@ async function deleteIgnoreFile() {
9614
9782
  }
9615
9783
  }
9616
9784
  var ignoreToolSchemas = {
9617
- getIgnoreFile: z35.object({}),
9618
- putIgnoreFile: z35.object({
9619
- content: z35.string()
9785
+ getIgnoreFile: z36.object({}),
9786
+ putIgnoreFile: z36.object({
9787
+ content: z36.string()
9620
9788
  }),
9621
- deleteIgnoreFile: z35.object({})
9789
+ deleteIgnoreFile: z36.object({})
9622
9790
  };
9623
9791
  var ignoreTools = {
9624
9792
  getIgnoreFile: {
@@ -9652,7 +9820,7 @@ var ignoreTools = {
9652
9820
 
9653
9821
  // src/mcp/mcp.ts
9654
9822
  import { join as join87 } from "path";
9655
- import { z as z36 } from "zod/mini";
9823
+ import { z as z37 } from "zod/mini";
9656
9824
  var maxMcpSizeBytes = 1024 * 1024;
9657
9825
  async function getMcpFile() {
9658
9826
  const config = await ConfigResolver.resolve({});
@@ -9742,11 +9910,11 @@ async function deleteMcpFile() {
9742
9910
  }
9743
9911
  }
9744
9912
  var mcpToolSchemas = {
9745
- getMcpFile: z36.object({}),
9746
- putMcpFile: z36.object({
9747
- content: z36.string()
9913
+ getMcpFile: z37.object({}),
9914
+ putMcpFile: z37.object({
9915
+ content: z37.string()
9748
9916
  }),
9749
- deleteMcpFile: z36.object({})
9917
+ deleteMcpFile: z37.object({})
9750
9918
  };
9751
9919
  var mcpTools = {
9752
9920
  getMcpFile: {
@@ -9779,8 +9947,8 @@ var mcpTools = {
9779
9947
  };
9780
9948
 
9781
9949
  // src/mcp/rules.ts
9782
- import { basename as basename23, join as join88 } from "path";
9783
- import { z as z37 } from "zod/mini";
9950
+ import { basename as basename22, join as join88 } from "path";
9951
+ import { z as z38 } from "zod/mini";
9784
9952
  var maxRuleSizeBytes = 1024 * 1024;
9785
9953
  var maxRulesCount = 1e3;
9786
9954
  async function listRules() {
@@ -9817,7 +9985,7 @@ async function getRule({ relativePathFromCwd }) {
9817
9985
  relativePath: relativePathFromCwd,
9818
9986
  intendedRootDir: process.cwd()
9819
9987
  });
9820
- const filename = basename23(relativePathFromCwd);
9988
+ const filename = basename22(relativePathFromCwd);
9821
9989
  try {
9822
9990
  const rule = await RulesyncRule.fromFile({
9823
9991
  relativeFilePath: filename,
@@ -9843,7 +10011,7 @@ async function putRule({
9843
10011
  relativePath: relativePathFromCwd,
9844
10012
  intendedRootDir: process.cwd()
9845
10013
  });
9846
- const filename = basename23(relativePathFromCwd);
10014
+ const filename = basename22(relativePathFromCwd);
9847
10015
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
9848
10016
  if (estimatedSize > maxRuleSizeBytes) {
9849
10017
  throw new Error(
@@ -9885,7 +10053,7 @@ async function deleteRule({ relativePathFromCwd }) {
9885
10053
  relativePath: relativePathFromCwd,
9886
10054
  intendedRootDir: process.cwd()
9887
10055
  });
9888
- const filename = basename23(relativePathFromCwd);
10056
+ const filename = basename22(relativePathFromCwd);
9889
10057
  const fullPath = join88(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
9890
10058
  try {
9891
10059
  await removeFile(fullPath);
@@ -9899,17 +10067,17 @@ async function deleteRule({ relativePathFromCwd }) {
9899
10067
  }
9900
10068
  }
9901
10069
  var ruleToolSchemas = {
9902
- listRules: z37.object({}),
9903
- getRule: z37.object({
9904
- relativePathFromCwd: z37.string()
10070
+ listRules: z38.object({}),
10071
+ getRule: z38.object({
10072
+ relativePathFromCwd: z38.string()
9905
10073
  }),
9906
- putRule: z37.object({
9907
- relativePathFromCwd: z37.string(),
10074
+ putRule: z38.object({
10075
+ relativePathFromCwd: z38.string(),
9908
10076
  frontmatter: RulesyncRuleFrontmatterSchema,
9909
- body: z37.string()
10077
+ body: z38.string()
9910
10078
  }),
9911
- deleteRule: z37.object({
9912
- relativePathFromCwd: z37.string()
10079
+ deleteRule: z38.object({
10080
+ relativePathFromCwd: z38.string()
9913
10081
  })
9914
10082
  };
9915
10083
  var ruleTools = {
@@ -9957,8 +10125,8 @@ var ruleTools = {
9957
10125
  };
9958
10126
 
9959
10127
  // src/mcp/skills.ts
9960
- import { basename as basename24, dirname as dirname2, join as join89 } from "path";
9961
- import { z as z38 } from "zod/mini";
10128
+ import { basename as basename23, dirname as dirname2, join as join89 } from "path";
10129
+ import { z as z39 } from "zod/mini";
9962
10130
  var maxSkillSizeBytes = 1024 * 1024;
9963
10131
  var maxSkillsCount = 1e3;
9964
10132
  function aiDirFileToMcpSkillFile(file) {
@@ -9974,7 +10142,7 @@ function mcpSkillFileToAiDirFile(file) {
9974
10142
  };
9975
10143
  }
9976
10144
  function extractDirName(relativeDirPathFromCwd) {
9977
- const dirName = basename24(relativeDirPathFromCwd);
10145
+ const dirName = basename23(relativeDirPathFromCwd);
9978
10146
  if (!dirName) {
9979
10147
  throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
9980
10148
  }
@@ -9986,7 +10154,7 @@ async function listSkills() {
9986
10154
  const skillDirPaths = await findFilesByGlobs(join89(skillsDir, "*"), { type: "dir" });
9987
10155
  const skills = await Promise.all(
9988
10156
  skillDirPaths.map(async (dirPath) => {
9989
- const dirName = basename24(dirPath);
10157
+ const dirName = basename23(dirPath);
9990
10158
  if (!dirName) return null;
9991
10159
  try {
9992
10160
  const skill = await RulesyncSkill.fromDir({
@@ -10126,23 +10294,23 @@ async function deleteSkill({
10126
10294
  );
10127
10295
  }
10128
10296
  }
10129
- var McpSkillFileSchema = z38.object({
10130
- name: z38.string(),
10131
- body: z38.string()
10297
+ var McpSkillFileSchema = z39.object({
10298
+ name: z39.string(),
10299
+ body: z39.string()
10132
10300
  });
10133
10301
  var skillToolSchemas = {
10134
- listSkills: z38.object({}),
10135
- getSkill: z38.object({
10136
- relativeDirPathFromCwd: z38.string()
10302
+ listSkills: z39.object({}),
10303
+ getSkill: z39.object({
10304
+ relativeDirPathFromCwd: z39.string()
10137
10305
  }),
10138
- putSkill: z38.object({
10139
- relativeDirPathFromCwd: z38.string(),
10306
+ putSkill: z39.object({
10307
+ relativeDirPathFromCwd: z39.string(),
10140
10308
  frontmatter: RulesyncSkillFrontmatterSchema,
10141
- body: z38.string(),
10142
- otherFiles: z38.optional(z38.array(McpSkillFileSchema))
10309
+ body: z39.string(),
10310
+ otherFiles: z39.optional(z39.array(McpSkillFileSchema))
10143
10311
  }),
10144
- deleteSkill: z38.object({
10145
- relativeDirPathFromCwd: z38.string()
10312
+ deleteSkill: z39.object({
10313
+ relativeDirPathFromCwd: z39.string()
10146
10314
  })
10147
10315
  };
10148
10316
  var skillTools = {
@@ -10191,8 +10359,8 @@ var skillTools = {
10191
10359
  };
10192
10360
 
10193
10361
  // src/mcp/subagents.ts
10194
- import { basename as basename25, join as join90 } from "path";
10195
- import { z as z39 } from "zod/mini";
10362
+ import { basename as basename24, join as join90 } from "path";
10363
+ import { z as z40 } from "zod/mini";
10196
10364
  var maxSubagentSizeBytes = 1024 * 1024;
10197
10365
  var maxSubagentsCount = 1e3;
10198
10366
  async function listSubagents() {
@@ -10231,7 +10399,7 @@ async function getSubagent({ relativePathFromCwd }) {
10231
10399
  relativePath: relativePathFromCwd,
10232
10400
  intendedRootDir: process.cwd()
10233
10401
  });
10234
- const filename = basename25(relativePathFromCwd);
10402
+ const filename = basename24(relativePathFromCwd);
10235
10403
  try {
10236
10404
  const subagent = await RulesyncSubagent.fromFile({
10237
10405
  relativeFilePath: filename,
@@ -10257,7 +10425,7 @@ async function putSubagent({
10257
10425
  relativePath: relativePathFromCwd,
10258
10426
  intendedRootDir: process.cwd()
10259
10427
  });
10260
- const filename = basename25(relativePathFromCwd);
10428
+ const filename = basename24(relativePathFromCwd);
10261
10429
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
10262
10430
  if (estimatedSize > maxSubagentSizeBytes) {
10263
10431
  throw new Error(
@@ -10299,7 +10467,7 @@ async function deleteSubagent({ relativePathFromCwd }) {
10299
10467
  relativePath: relativePathFromCwd,
10300
10468
  intendedRootDir: process.cwd()
10301
10469
  });
10302
- const filename = basename25(relativePathFromCwd);
10470
+ const filename = basename24(relativePathFromCwd);
10303
10471
  const fullPath = join90(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
10304
10472
  try {
10305
10473
  await removeFile(fullPath);
@@ -10316,17 +10484,17 @@ async function deleteSubagent({ relativePathFromCwd }) {
10316
10484
  }
10317
10485
  }
10318
10486
  var subagentToolSchemas = {
10319
- listSubagents: z39.object({}),
10320
- getSubagent: z39.object({
10321
- relativePathFromCwd: z39.string()
10487
+ listSubagents: z40.object({}),
10488
+ getSubagent: z40.object({
10489
+ relativePathFromCwd: z40.string()
10322
10490
  }),
10323
- putSubagent: z39.object({
10324
- relativePathFromCwd: z39.string(),
10491
+ putSubagent: z40.object({
10492
+ relativePathFromCwd: z40.string(),
10325
10493
  frontmatter: RulesyncSubagentFrontmatterSchema,
10326
- body: z39.string()
10494
+ body: z40.string()
10327
10495
  }),
10328
- deleteSubagent: z39.object({
10329
- relativePathFromCwd: z39.string()
10496
+ deleteSubagent: z40.object({
10497
+ relativePathFromCwd: z40.string()
10330
10498
  })
10331
10499
  };
10332
10500
  var subagentTools = {
@@ -10410,7 +10578,7 @@ async function mcpCommand({ version }) {
10410
10578
  }
10411
10579
 
10412
10580
  // src/cli/index.ts
10413
- var getVersion = () => "3.33.0";
10581
+ var getVersion = () => "4.0.0";
10414
10582
  var main = async () => {
10415
10583
  const program = new Command();
10416
10584
  const version = getVersion();
@@ -10434,18 +10602,14 @@ var main = async () => {
10434
10602
  (value) => {
10435
10603
  return value.split(",").map((f) => f.trim());
10436
10604
  }
10437
- ).option("-V, --verbose", "Verbose output").option("-g, --global", "Import for global(user scope) configuration files").option(
10438
- "--experimental-global",
10439
- "Import for global(user scope) configuration files (deprecated: use --global instead)"
10440
- ).action(async (options) => {
10605
+ ).option("-V, --verbose", "Verbose output").option("-g, --global", "Import for global(user scope) configuration files").action(async (options) => {
10441
10606
  try {
10442
10607
  await importCommand({
10443
10608
  targets: options.targets,
10444
10609
  features: options.features,
10445
10610
  verbose: options.verbose,
10446
10611
  configPath: options.config,
10447
- global: options.global,
10448
- experimentalGlobal: options.experimentalGlobal
10612
+ global: options.global
10449
10613
  });
10450
10614
  } catch (error) {
10451
10615
  logger.error(formatError(error));
@@ -10484,15 +10648,6 @@ var main = async () => {
10484
10648
  ).option(
10485
10649
  "--simulate-skills",
10486
10650
  "Generate simulated skills. This feature is only available for copilot, cursor and codexcli."
10487
- ).option(
10488
- "--experimental-global",
10489
- "Generate for global(user scope) configuration files (deprecated: use --global instead)"
10490
- ).option(
10491
- "--experimental-simulate-commands",
10492
- "Generate simulated commands (deprecated: use --simulate-commands instead)"
10493
- ).option(
10494
- "--experimental-simulate-subagents",
10495
- "Generate simulated subagents (deprecated: use --simulate-subagents instead)"
10496
10651
  ).option(
10497
10652
  "--modular-mcp",
10498
10653
  "Generate modular-mcp configuration for context compression (experimental)"
@@ -10509,10 +10664,7 @@ var main = async () => {
10509
10664
  simulateCommands: options.simulateCommands,
10510
10665
  simulateSubagents: options.simulateSubagents,
10511
10666
  simulateSkills: options.simulateSkills,
10512
- modularMcp: options.modularMcp,
10513
- experimentalGlobal: options.experimentalGlobal,
10514
- experimentalSimulateCommands: options.experimentalSimulateCommands,
10515
- experimentalSimulateSubagents: options.experimentalSimulateSubagents
10667
+ modularMcp: options.modularMcp
10516
10668
  });
10517
10669
  } catch (error) {
10518
10670
  logger.error(formatError(error));